import { type ApprovalId, type Json, type Step, type ToolCall, type ToolOutcome } from "../../core/index.js"; /** * Pure step-walker kernel for compound tools (04-actions §6). * * Semantics deliberately mirror the automations engine's `continueSteps` * (packages/vendo/src/automations/run-execution.ts) — same if/forEach/args ordering, * same forEach cap and error texts, same verbatim re-issue of a parked call on * resume — WITHOUT the run-record/stop persistence concerns. Automations is * the reference implementation; parity is enforced by a shared fixture table * (packages/vendo/tests/compound-parity.test.ts). Single-sourcing automations * onto this kernel is a tracked follow-up. * * The kernel performs no I/O and never imports jsonata: `evaluate` and * `invoke` are injected, so the caller decides both the expression language * and the (guarded) execution path. */ /** Same constant as automations' FOREACH_MAX_ITEMS — the texts must match too. */ export declare const STEP_FOREACH_MAX_ITEMS = 1000; /** Where a parked walk stopped, sufficient to resume without re-running completed steps. */ export interface StepResumePoint { stepIndex: number; forEachIndex?: number; iterationItems?: Json[]; iterationOutputs?: Json[]; stepOutputs: Record; /** Re-issued VERBATIM (same id, same args) on resume so guard's single-use approval replay matches. */ pendingCall: ToolCall; } export type StepWalkResult = { status: "ok"; stepOutputs: Record; } | { status: "halted"; outcome: ToolOutcome; step: Step; } | { status: "parked"; approvalId: ApprovalId; resume: StepResumePoint; }; export interface StepWalkOptions { steps: Step[]; /** Root expression bindings — `{ args }` for compounds, `{ event }` for automations. */ root: Record; evaluate(expression: string, context: Record): Promise; /** Every real call goes through here; the caller owns guarding. */ invoke(call: ToolCall): Promise; newCallId(): string; resumeFrom?: StepResumePoint; } export declare function walkSteps(options: StepWalkOptions): Promise;