Skip to content

v0.2.6 - fix streaming: lossless-JSON chunks

Choose a tag to compare

@amlyczz amlyczz released this 19 Aug 07:58
· 24 commits to main since this release

v0.2.6 - fix streaming: lossless-JSON chunks

Real agy sessions crashed with: session event "assistant/chunk" carries non-JSON-serializable data.

DSH's session layer rejects any chunk whose fields are undefined (lossless-JSON boundary). Four sites assigned undefined into chunk/event objects - every usage event, replayState-less finish, and parser event could kill the turn, which also stopped thinking from streaming:

  • usageFromRaw: cacheRead/cacheWrite/reasoningTokens set to undefined
  • finish: replayState: undefined when no conversation id
  • parseUsage: input/output/thinking/cache fields set to undefined
  • parser events: tool/error/conversationId set to undefined

All four now omit absent optional fields instead of assigning undefined. New test/lossless-json.test.ts replicates the dsh-session lossless-JSON walker and asserts every emitted chunk survives it (63 tests green).