1
0
Эх сурвалжийг харах

docs(subagent): note the settlement-fold optimization condition

Hypatia May 1 сар өмнө
parent
commit
0a4bdd8ee8

+ 4 - 0
packages/subagent/subagent/src/assistant-output.ts

@@ -65,6 +65,10 @@ export class AssistantOutputFold {
  * @returns the selected output, or `undefined` when the child produced none.
  */
 export function finalAssistantOutput(events: readonly SessionEvent[]): ContentBlock[] | undefined {
+  // TODO: this folds the complete suffix once per run/epoch settlement. If a
+  // long continuable epoch ever profiles hot here, scan backward with early
+  // exit for the last non-empty message and fold text deltas only on the
+  // no-message fallback.
   const fold = new AssistantOutputFold()
   for (const event of events) fold.push(event)
   return fold.collect()