/** * Hierarchical reduce execution. * * The runtime owns interpolation, cache policy, and runner wiring; this module * owns the tree algorithm and its hard admission cap so runtime.ts does not * grow another phase-sized control-flow block. */ import type { RunResult } from "../../host/runner-types.ts"; import { type Phase } from "../../schema.ts"; import { type PhaseState, type RunState } from "../../store.ts"; import { type UsageStats } from "../../usage.ts"; export interface TreeReduceItem { label: string; output: string; } export interface TreeReduceSource { id: string; output: string; } export interface TreeReduceTask { task: string; warning?: string; } export interface TreeReduceExecutionOptions { phase: Phase; inputs: TreeReduceSource[]; batchSize: number; agentName: string; inputHash: string; isAborted: () => boolean; isOverBudget: () => boolean; resolveTask: (batchValue: string) => TreeReduceTask; runOne: (task: string, usageBefore: UsageStats | undefined, beforeAttempt: () => string | undefined, callId: string) => Promise; } export interface TreeReduceExecutionResult { phaseState: PhaseState; refWarning?: string; cacheable: boolean; } export declare function collectTreeReduceInputs(state: RunState, phase: Phase): TreeReduceSource[]; export declare function formatTreeReduceBatch(items: TreeReduceItem[]): string; /** Stable, pre-execution cache material. It deliberately excludes intermediate * model outputs (unknowable before execution) and includes every authored * dependency plus invocation args so non-`from` refs cannot produce false hits. */ export declare function treeReduceCacheParts(state: RunState, phase: Phase, inputs: TreeReduceSource[], batchSize: number): string[]; export declare function executeTreeReduction(opts: TreeReduceExecutionOptions): Promise; //# sourceMappingURL=reduce.d.ts.map