Conversation
Add an authenticated loopback SSE endpoint that forwards the normalized Agent EventEnvelope already consumed by the renderer. Add a bounded batch status operation for initial snapshots and reconnects, keeping the existing MCP POST contract and IPC permission path unchanged. The event hub is process-memory only, filters by session, bounds subscribers, and cleans up disconnected clients. Local sidecar, native agent, and remote host event paths all feed the same hub. Update English/Chinese IPC specs and register E2E-221 for event-first status delivery. Refs: mocode vastsa#467
Contributor
Author
|
@vastsa — gentle ping on this one: it has been open since 2026-09-27 with all four CI jobs green and no review comments yet, so I suspect it may have slipped off the radar. Where it stands:
It is the natural companion to #1014 (which exposes pending asktool questions): this one adds the Agent event stream plus a batched runtime-status read, so a remote client can follow a turn without polling per-entity calls. If it needs a rebase onto the current Thank you. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds an event-first status path for remote/local clients without changing the existing MCP POST contract or renderer IPC contract.
GET /eventsSSE endpoint.AgentEventEnvelopefrom local sidecar, native-agent, and remote-host event paths.agent/getStatusesandpi_agent_status_batchfor one-call initial/reconnect snapshots.E2E-221.Why
The current mobile client must poll
pi_agent_statusandpi_session_get. That creates per-session RPC fan-out, adds visible latency, and loses intermediate retry/error/progress events. The new contract is subscribe-first, snapshot-on-start/reconnect, with polling only as a compatibility fallback for older transports.Validation
pnpm --filter @pi-desktop/agent-runtime build— PASSpnpm --filter @pi-desktop/shared build— PASSpnpm --filter @pi-desktop/desktop typecheck— PASSpnpm lint:biome— PASSpnpm docs:check— PASS (81 English/Chinese pairs, 517 docs pages)node --test apps/desktop/test/agent-events.test.mjs apps/desktop/test/mcp-control.test.mjs— 11/11 PASSpnpm check:pr-base— PASSFull Electron E2E was not run in this environment; E2E-221 documents the required candidate validation and remaining risk.
Refs: mocode #467