Add bounded Code Mode output collection and rendering (#57848)

## What changed

Add output collection and rendering components in `code-mode-runtime`, without wiring them into runtime execution yet.

- Retain a text prefix and rolling tail under a 1 MiB text allowance, with independent allowances of 8 MiB for image URLs and 62 MiB for audio URLs and a separate 32,768-item limit.
- Render retained output using the shared token-budget formatter, preserving media details and reporting collector losses even with a zero-token budget. Summarize scattered losses to keep notices bounded.
- Preserve collected output and omission accounting when delivery fails, and document the separate media limits in the protocol.

## Testing

Add unit tests for Unicode retention, item pressure, independent media allowances, media-space reclamation, failed delivery, default token budgets, and loss-notice placement and aggregation.

GitOrigin-RevId: f419fdbe316a8456cea3b7b097c4d3a658f3150f
This commit is contained in:
Sean Huang
2026-10-28 22:31:05 +00:00
committed by copyberry
parent d373d64967
commit 6d97d6ecb4
11 changed files with 1443 additions and 8 deletions
+6
View File
@@ -1,4 +1,10 @@
mod cell_actor;
#[allow(
dead_code,
unused_imports,
reason = "Wired into the runtime in the next stack layer"
)]
mod output;
mod runtime;
mod service;
mod session_runtime;