import type { StandardSchemaV1 } from '../types/standard-schema.js'; import type { CollectNode, FlowState, SlotSource } from '../types/flow.js'; import type { Tool } from '../types/effectTool.js'; import type { StreamPart } from '../types/stream.js'; /** Clear a collect node's gathered fields, preserving its turn counter so * `maxTurns` still bounds a recovery loop. */ export declare function clearCollectData(state: FlowState, nodeId: string): void; export declare function getCollectData(state: FlowState, nodeId: string): Record; export declare function setCollectData(state: FlowState, nodeId: string, data: Record): void; export declare function incrementCollectTurns(state: FlowState, nodeId: string): number; export declare function computeMissingFields(node: CollectNode, data: Record): string[]; /** * Fields whose collected value is present but does NOT satisfy the node's schema. * * Completion used to be presence-only: any non-empty value passed, so a model that invented * an enum member (`urgency: "high"` against `z.enum(['emergency','urgent','routine'])`) or * supplied the wrong primitive completed the node and the flow acted on it. The schema was * only ever used to derive key names, never to check a value. * * Validation is awaited so async Standard Schema implementations receive the same * field-level diagnostics as synchronous schemas. * * NOTE this catches SHAPE, not REFERENT. `unitId: "12B"` is a perfectly valid string; that a * unit by that id does not exist is a domain fact only a tool boundary can know. */ export declare function invalidCollectFields(node: CollectNode, data: Record): Promise; export declare function schemaSatisfied(node: CollectNode, state: FlowState): Promise; /** Whether merging tool results into current collect state would satisfy the node. */ export declare function wouldCollectSatisfyAfterToolResults(node: CollectNode, state: FlowState, toolResults: Array<{ name: string; result: unknown; }>, sourceText?: string): Promise; export declare function projectCollectData(node: CollectNode, state: FlowState): Promise; export declare function mergeExtractionData(current: Record, incoming: Record): Record; export declare function createExtractionSubmitTool(node: CollectNode, missingFields: readonly string[], opts?: { userMessage?: string; retryNudge?: boolean; }): Tool; export interface MergeTurnExtractionResult { merged: boolean; incoming?: Record; submitted?: Record; dropped?: string[]; slotSources?: Record; } export declare function mergeTurnExtraction(node: CollectNode, state: FlowState, toolResults: Array<{ name: string; result: unknown; }>, opts?: { sourceText?: string; }): MergeTurnExtractionResult; export declare function emitExtractionTelemetry(node: CollectNode, state: FlowState, incoming: Record, emit: (part: StreamPart) => void, extra?: { dropped?: string[]; slotSources?: Record; }): void; export declare function inferRequiredFields(schema: StandardSchemaV1): string[]; /** Stash author-written copy for the user, to be shown once by the next `ask`. */ export declare function setPendingRecoveryMessage(state: FlowState, nodeId: string, message: string | undefined): void; /** Read and clear it — a reason is shown once, not repeated on every later re-ask. */ export declare function takePendingRecoveryMessage(state: FlowState, nodeId: string): string | undefined;