Repository navigation
feat(agent-email/npm): /v1/email/query SSE streaming client + contract 2.4 - #2102
Conversation
…t 2.4
A Node integrator could not reach the sidecar's streaming agent loop through
the package — the 2.4 endpoints (POST /v1/email/query + /query/{run_id}/cancel,
#2061) existed only as raw-fetch instructions in the docs. Now
EmailClient.query() returns an async iterator of the seven typed canonical SSE
events (frozen #2057 contract) and cancelQuery(runId) stops a run between
steps, with the per-session bearer and host-minted run_id semantics handled by
the client.
- SCHEMA_VERSION 2.3 -> 2.4 (additive; every 2.3 shape unchanged), lifecycle
expected-version default follows it.
- Fail-loud stream handling: non-SSE response, malformed event, or a stream
that closes without the mandated terminal final/error throws
QueryStreamError; an unknown event type is yielded as a visible
{ type: "unknown" } placeholder, never dropped (spec §7).
- Unit tests: incremental SSE parser (arbitrary chunk splits, multi-line data,
CRLF, multibyte flush at EOF) + client call-shape and event-stream behavior.
- Integration test: startSidecar spawns the real Python sidecar in dev mode
(scripted fake-agent seam, same one test_query_route.py swaps) and asserts
the 2.4 version handshake, the status->tool_call->tool_result->final
sequence, mid-run cancel, the 401 bearer gate, and the 404 cancel. Skips
visibly when no capable Python interpreter is available (e.g. npm CI).
- README/SPEC.md/SKILL.md/CHANGELOG updated together (#1841): the 'no wrapper
yet' claims for /query are gone; docs show the typed iterator.
Closes #2097
|
Verified locally on the PR branch: |
|
Verdict: Approve ✅ This wraps the sidecar's I found no blocking issues. Two minor things worth a glance before publish:
Nicely done — the "assert the outgoing call shape, not just a stubbed 200" tests and the real-sidecar integration harness are exactly the pattern the repo asks for. 🔍 Technical details🟢 Minor1. CHANGELOG 2. Error paths leave the response body undrained ( Strengths
|
A Node integrator (and the #1653 dogfood) couldn't reach the sidecar's streaming agent loop through
@amd-gaia/agent-email— the 2.4 endpoints landed Python-side in #2061 but the package's answer was "hand-rollfetch+ SSE parsing". Nowclient.query()streams the seven typed canonical events (frozen #2057 contract) as an async iterator andclient.cancelQuery(runId)stops a run mid-flight, with bearer auth and host-mintedrun_idsemantics handled for you. The client speaks contract 2.4 (SCHEMA_VERSION2.3 → 2.4, additive — every 2.3 shape unchanged), and streams fail loud: a malformed event, a non-SSE response, or a stream that dies without the mandated terminalfinal/errorthrows, while an unknown event type is surfaced as a visible placeholder, never dropped.Closes #2097
Test plan
cd hub/agents/npm/agent-email && npm ci && npm run build && npm test— 101 tests: SSE parser (chunk splits at every boundary, multi-line data, CRLF, multibyte flush), client call-shape + event-stream unit tests, and the existing suite.GAIA_EMAIL_TEST_PYTHON=<repo-venv>/bin/python npm test—startSidecarspawns the real Python sidecar in dev mode (scripted fake-agent seam, the same onetest_query_route.pyswaps) and asserts the 2.4 version handshake, thestatus→tool_call→tool_result→finalsequence, mid-run cancel viacancelQuery, the 401 bearer gate, and the 404 cancel. Skips visibly on npm CI (no capable interpreter there).grep -rn 'no wrapper yet' hub/agents/npm/agent-email/{README,SPEC,SKILL}.mdno longer matches the/queryrows.