feat(service,features,host): a plan's inbox and an agent's are read through the central live layer

Merged
CH
1h ago
+3084-158

A plan's inbox and an agent's are read through the central live layer: the sealed live procedures on the service, and liveRows on the host. This replaces the service's own held inbox read for the window.

Stacked on #4228 (luke/live-same-user). It will be retargeted to main once #4228 merges.

What changes

Service (live-procedures.ts, inbox-store.ts)

  • New live.taskInbox and live.agentInbox procedures. Each:
    1. checks the read names the caller's own account (sameUser);
    2. reads the plan or agent as that account, so one it doesn't reach is not found;
    3. answers three statements: the open items with the latest settled ones, their threads' latest messages, and their files.
  • With LUKE_REALTIME off, as main runs, the rows are answered inline (sealedParts), held until they move past after.
  • Every statement calls only immutable functions (live-statements.test.ts).

Features

  • scopeInboxLiveAnswerSchema and scopeInboxLiveRowsSchema.
  • inboxOfLiveRows, which joins the three parts back into the held read's items.
  • taskInboxLive and agentInboxLive on the client. Each names the account, and reads a session of another account as signed out.

Host (scope-inbox-follow.ts)

  • One liveRows read per plan or agent (an RcMap), kept while windows read it and for 30 s after. Each read names the account that was signed in when it started.
  • codingAgents.inbox and codingAgents.agentInbox with a cursor answer as soon as the items move past it, or unchanged when the 20 s hold ends. So the renderer doesn't change in this PR.
  • A sign-out lets every read go.

The account inbox stays on its held read.

Tests

  • live-procedures.test.ts: each read is sealed for the bearer, answered polled when asked, not found for a stranger, and signed out when it names another account.
  • live-statements.test.ts: the immutability check covers the new statements.
  • inbox-store.test.ts: the live rows equal the held read's items, read markers included.
  • compose-coding-agents.test.ts: the host answers reads from the followed rows.