File tree Expand file tree Collapse file tree
packages/provider-acp/src/server Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1339,6 +1339,10 @@ interface SnapshotMessageState {
13391339
13401340const TOOL_UPDATE_PERSIST_EVERY = 10 ;
13411341
1342+ // A command row only ever shows a tail read from the last 256 KiB of its persisted
1343+ // output, so project a little more than that instead of the whole terminal buffer.
1344+ const MAX_AGENT_TERMINAL_OUTPUT_CHARS = 320 * 1024 ;
1345+
13421346/**
13431347 * Some agents stream a tool's arguments (a file write's diff, `rawInput`) and
13441348 * resend the whole call each time.
@@ -4408,6 +4412,9 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
44084412 embeddedToolCallIds === undefined || embeddedToolCallIds . size === 0
44094413 ? [ `acp-agent-terminal:${ update . terminalId } ` ]
44104414 : [ ...embeddedToolCallIds ] ;
4415+ // Every chunk re-emits the output, so a whole long build log here grew
4416+ // serialization and the event store with the square of its length.
4417+ const output = next . output . slice ( - MAX_AGENT_TERMINAL_OUTPUT_CHARS ) ;
44114418 for ( const toolCallId of projectedToolCallIds ) {
44124419 const existing = context . tools . get ( toolCallId ) ;
44134420 const seeded : AcpToolCallState =
@@ -4428,7 +4435,7 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
44284435 status,
44294436 ...( next . command === undefined ? { } : { command : next . command } ) ,
44304437 } ,
4431- next . output ,
4438+ output ,
44324439 ) ,
44334440 ) ;
44344441 }
You can’t perform that action at this time.
0 commit comments