feat(dev): Agent Inspector agent-proxy routes (C2) - #2085
Open
tejaskash wants to merge 2 commits into
Open
Conversation
tejaskash
had a problem deploying
to
e2e-testing
August 24, 2026 17:31 — with
GitHub Actions
Failure
tejaskash
had a problem deploying
to
e2e-testing
August 24, 2026 18:08 — with
GitHub Actions
Failure
Add the Inspector routes that talk to a running agent or read the project spec, extending the C1 route table: - POST /invocations proxies HTTP, A2A, and AGUI agents, normalizing each into the SPA's data:<json> SSE contract. MCP agents get a clear error directing them to /api/mcp rather than being mis-proxied as HTTP. - POST /api/mcp forwards a JSON-RPC body to the agent's /mcp endpoint and buffers the reply under a 10MB cap. - GET /api/a2a/agent-card fetches the running agent's A2A card. - GET /api/resources flattens the project spec into the resource graph. Every upstream fetch carries the client's abort signal, and io/httpServer streams async-iterable bodies with backpressure so a disconnect tears the upstream request down on Node. A single session id threads through the request header, agent body, and echoed x-session-id. SSE parsing follows the framing rules (optional leading space, multi-line data fields, blank-line event boundary) instead of a hardcoded slice.
- collapse invokeHttpAgent/invokeAguiAgent into a shared forwardInvocation - single-return parseAgentEvent normalizing empty payloads to null - hoist the SSE TextEncoder to module scope - readCapped iterates over the shared iterateBody helper - drop the a2aId counter; A2A message ids use randomUUID - add the AGUI missing-prompt test
tejaskash
force-pushed
the
feat/inspector-http-layer
branch
from
August 25, 2026 17:35
e59cda5 to
1b3491b
Compare
tejaskash
force-pushed
the
feat/inspector-agent-proxies
branch
from
August 25, 2026 17:35
fcff328 to
013ffe2
Compare
tejaskash
had a problem deploying
to
e2e-testing
August 25, 2026 17:36 — with
GitHub Actions
Failure
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.
What
PR C2 of the Agent Inspector stack (C1 = #2082). Adds every Inspector route that talks to a running agent or reads the project spec, extending C1's route table. Still not reachable from the CLI; wiring lands in C3.
Stacks on
feat/inspector-http-layer(C1). Re-authored against currentrefactorAPIs usingfeat/agent-inspectoras the reference.Routes
POST /invocations— protocol-aware proxy for HTTP, A2A, and AGUI agents, each normalized into the SPA'sdata: <json>SSE contract. MCP agents get an explicit error pointing at/api/mcpinstead of being mis-proxied as HTTP.POST /api/mcp— forwards a JSON-RPC body to the agent's/mcpendpoint, buffering the reply under a 10MB cap.GET /api/a2a/agent-card— fetches the running agent's A2A card.GET /api/resources— flattensproject.specinto the resource graph the SPA renders.Reviewer preempts addressed
fetchcarries the client request'sAbortSignal.io/httpServernow streams async-iterable bodies with backpressure and aborts a controller on the responsecloseevent, so on Node (the published runtime) a browser disconnect tears the upstream request down. Bun'snode:httpdoes not surface mid-stream disconnects; that limitation is documented inline (dev-only leak of a local fetch until it finishes).sseDatafollows the framing rules (optional leading space afterdata:, multi-linedata:fields, blank-line event boundary) and never forwards unparsable payloads as content. The hardcodedslice(6)is gone.x-session-id.Accept: application/jsononly (it buffers, never streams) and enforces a body-size cap.Tests (both altitudes)
invocations.test.ts— routing (409, MCP arm), SSE normalization (test.eachover event shapes), error frames, non-SSE passthrough, single-session-id forwarding, A2A message/stream translation + dedup + non-streaming fallback, AGUI RunAgentInput.proxies.test.ts— MCP forward, 400s (test.each), not-running, upstream error, body-cap 502; agent-card happy/missing-param/unavailable.resources.test.ts— resource graph happy path + no-project 404.httpServer.test.ts— async-iterable streaming and a deterministicstream()abort-honoring unit test (real socket disconnect is not observable underbun test).bun test(1841 pass),bun run typecheck,bun run lint:check,bun run format:checkall green.