Files
letta-code/src/cli/helpers/subagentTurnStart.ts
2026-02-05 18:15:43 -08:00

28 lines
802 B
TypeScript

import type { Buffers } from "./accumulator.js";
/**
* Completed subagents should only be cleared on true new turns.
* During allowReentry (post-approval continuation), completed subagents
* must remain available so deferred Task grouping can still resolve.
*/
export function shouldClearCompletedSubagentsOnTurnStart(
allowReentry: boolean,
hasActiveSubagents: boolean,
): boolean {
return !allowReentry && !hasActiveSubagents;
}
/**
* Flush static-eligible lines before reentry so Task grouping is not delayed
* by deferred non-Task tool commits.
*/
export function flushEligibleLinesBeforeReentry(
commitEligibleLines: (
b: Buffers,
opts?: { deferToolCalls?: boolean },
) => void,
buffers: Buffers,
): void {
commitEligibleLines(buffers, { deferToolCalls: false });
}