feat: emit artifact content + proposal_created on the event stream#25
Merged
Conversation
…tream Add `content` to the `artifact` RuntimeStreamEvent variant and a new `proposal_created` variant, so a run's event stream carries what the agent produced, not just metadata. mapCommonBackendEvent maps both from the common SSE/HTTP wire (fail-loud — drops an event with no id); the sanitizer gates `content`/`title` behind includeControlPayloads (redacted by default); trace-bridge maps proposal_created to a state_mutation trace event. This package provides the typed contract + wire mapping. The runtime does not originate these events — content events originate in the agent execution backend and pass through; backend/tool-layer emission is separate. Additive (+157, 0 deletions); 218/218 tests green.
`biome check src tests examples` ran red on two pre-existing errors: noAssignInExpressions in chat-engine.test.ts (rewrote the indexOf loop as a for(;;) + break, matching the file's existing style) and an unused import in agent.test.ts. No behavior change; 218/218 tests green.
biome check --write reflowed the produced-state wire-mapping block to satisfy the linter. No behavior change.
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
Enrich the runtime event stream so a run carries what the agent produced — not just metadata. This is the emitter half of the
ProducedStatepathway (consumer half:extractProducedStatein agent-eval#69).content?: stringto theartifactRuntimeStreamEventvariant.proposal_createdvariant (proposalId,title,status?).mapCommonBackendEventmaps both from the common SSE/HTTP wire — fail-loud, drops an event with no id.content/ proposaltitlebehindincludeControlPayloads(redacted by default).trace-bridgemapsproposal_created→ astate_mutationtrace event.The runtime does not originate these — content events originate in the agent execution backend and pass through; this package provides the typed contract + wire mapping. Additive (+157 / -0).
Test plan
pnpm build— cleanpnpm typecheck— clean (new union variant handled in exhaustive consumers)pnpm test— 218/218 (new wire-mapping + trace-bridge + redaction tests)