mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Move the per-client `agent_update` subscription out of session.ts into session/agent-updates/ behind createAgentUpdatesService(deps). The module owns the mutable subscription state, the bootstrap buffer, the provider-visibility gate, and the filter predicate; the rest of session.ts no longer pokes the subscription shape or hand-rolls `agent_update` payloads — the ~12 call sites collapse to thin delegations (forwardLiveAgent / emitStoredRecord / removeAgent / beginSubscription / flushBootstrapped / clearSubscription / dispose) plus the pure, shared matchesAgentUpdatesFilter used by the snapshot listing pager. The shared payload builders (buildAgentPayload / buildStoredAgentPayload / isProviderVisibleToClient) and buildProjectPlacementForWorkspaceId stay in session.ts and are injected as host callbacks, since they are used widely outside this cluster. session.ts: 6187 -> 5967. Behavior preserved: the existing session.workspaces.test.ts integration suite is repointed through the new boundary and stays green; the previously-untested filter / buffer / flush branches are now covered by a zero-mock unit test with injected fakes. cleanup() now disposes the subscription (it was never cleared before). The clear-attention-for-workspace path that emits agent_update directly (bypassing the buffer) is left as-is — a pre-existing inconsistency, out of scope.