feat(runtime): ExecCtx.onSandboxEvent per-event tee for live output#378
Draft
Tjemmmic wants to merge 1 commit into
Draft
feat(runtime): ExecCtx.onSandboxEvent per-event tee for live output#378Tjemmmic wants to merge 1 commit into
Tjemmmic wants to merge 1 commit into
Conversation
Contributor
Author
🤖 AI Code Review (ensemble)SummaryThe PR adds an optional Issues Found2 total — 0 P1 (blocking) · 2 P2 (should fix) · 0 P3 (nice to have)
|
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.
Overview
The loop kernel buffers every
SandboxEventfrom each iteration'sstreamPromptinto a private array and only exposes iteration-boundary trace events (with a ~280-char output preview). A host that wants to stream the agent's live, token-by-token output has no seam to observe the raw event stream the kernel is already iterating.What changed
onSandboxEvent?(event, { iterationIndex, agentRunName })toExecCtx.Compatibility
Additive and opt-in: when
onSandboxEventis unset (every existing caller) behavior is byte-identical. No change to buffering, parsing, cost/token extraction, or the existingtraceEmitter.Testing
src/runtime/run-loop.tsandsrc/runtime/types.tstypecheck clean and the ESM build succeeds. Note: this repo's fullpnpm typecheck/.d.tsbuild currently fails on pre-existing unrelated issues (@tangle-network/agent-interfacenot installed,@tangle-network/agent-evalexport drift) — not introduced by this change. A unit test asserting the tee fires per event is a sensible follow-up.