Sprint B-1: wires the real SavantClient.run() events to the StreamEvent schema, replacing the v0.1 placeholder 'got your prompt' message.
What changed
\stream-json\ mode (--output-format stream-json, or auto-detect when stdout is not a TTY) now emits real agent output: session.start, message.user, message.assistant (chunked), message.assistant.done, message.reasoning (NEW), message.reasoning.done (NEW), tool.call, tool.result, error, session.end.
A new pure mapper \mapPrintModeToStream\ converts SDK \PrintModeEvent\ -> \StreamEvent\ for all 9 PrintModeEvent types.
Cancellation via stdin EOF or SIGINT now emits \session.end: cancelled\ (exit 1) immediately.
Schema additions (backwards-compat)
- \message.reasoning\ { id, delta } — chunks of agent reasoning, id =
unId\ - \message.reasoning.done\ { id } — signals end of reasoning block
Existing stream-json consumers using only the 8 original event types continue to work.
Perfection Loop (converged)
- Pass 1: 11/12 tests, 1 improvement (counter -> runId for reasoning)
- Pass 2: 12/12 tests, 0 improvements (converged)
- Pass 3: 12/12 tests, 0 functional improvements (cosmetic cleanup)
Verification
- \�un x tsc --noEmit -p tsconfig.json\ — PASS (exit 0)
- \�un test\ — 21 pass, 0 fail, 67 expect() calls (275ms)
- call-graph reachability: 39 grep matches, all new symbols wired
Numbers
- +477 / -80 lines (1 new mapper, 1 new test file, 1 new schema variant, runner refactored)
- 12 new mapper tests + 9 existing stream-json-emitter tests still pass
- v0.1.0 -> v0.2.0 (semver minor: new event types, backwards-compat)
Sister Projects
- savant-trading
- savant-bot
- Savant
- savant-protocol - ECHO Protocol (MIT)