docs(subagent): note the settlement-fold optimization condition
This commit is contained in:
@@ -65,6 +65,10 @@ export class AssistantOutputFold {
|
|||||||
* @returns the selected output, or `undefined` when the child produced none.
|
* @returns the selected output, or `undefined` when the child produced none.
|
||||||
*/
|
*/
|
||||||
export function finalAssistantOutput(events: readonly SessionEvent[]): ContentBlock[] | undefined {
|
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()
|
const fold = new AssistantOutputFold()
|
||||||
for (const event of events) fold.push(event)
|
for (const event of events) fold.push(event)
|
||||||
return fold.collect()
|
return fold.collect()
|
||||||
|
|||||||
Reference in New Issue
Block a user