feat(service,features): the task list is a live read

Merged
CH
9d ago
+1092-4

Stack 2 · Task list and automations, piece 2. Stacked on #3265 (luke/neon-realtime-agent-status) → #4228 (luke/live-same-user).

What: the task list becomes a live read, live.tasks (GET /api/live/tasks), on the central live layer.

  • With LUKE_REALTIME off, as in production, it answers each statement's rows inline at the poll address, held until they move past the reader's after.
  • With Realtime on, it answers sealed statements.
  • It names the account it's read for, and sameUser refuses anyone else's session.

The two statements:

  • The tasks the account reaches, with the reader's pin and the owner's and assignee's names.
  • Every agent on those tasks and every agent with no task. Each row carries its newest turn, when its newest awaiting line was written, what it last published, and the members it names.

Shared builder: @luke/features/task-list-live (taskListOfLiveRows) builds exactly the held /api/plans?archived=include answer at an instant, using the shared status rule from #3265.

Tests:

  • A PGlite parity test runs both statements as raw SQL and checks the built list equals the held read for the owner, a teammate and an outsider. It covers every agent status, pins, archives, a PR and an assignee.
  • Both statements pass mutableFunctionsOf.
  • live-procedures.test.ts covers the procedure.