import { c as NonInteractivePermissionPolicy, l as PermissionMode, o as AuthPolicy, p as PromptInput, s as McpServer$1, t as SessionAgentOptions, u as PermissionPolicy } from "./session-options-jkYbBxGE.js"; import { SetSessionConfigOptionResponse } from "@agentclientprotocol/sdk"; //#region src/flows/types.d.ts type MaybePromise = T | Promise; type FlowRunDefinition = { title?: string | ((context: { input: TInput; flowName: string; flowPath?: string; }) => MaybePromise); }; type FlowNodeContext = { input: TInput; outputs: Record; results: Record; state: FlowRunState; services: Record; }; type FlowNodeCommon = { timeoutMs?: number; heartbeatMs?: number; statusDetail?: string; }; type FlowEdge = { from: string; to: string; } | { from: string; switch: { on: string; cases: Record; }; }; type AcpNodeDefinition = FlowNodeCommon & { nodeType: "acp"; profile?: string; cwd?: string | ((context: FlowNodeContext) => MaybePromise); session?: { handle?: string; isolated?: boolean; }; prompt: (context: FlowNodeContext) => MaybePromise; parse?: (text: string, context: FlowNodeContext) => MaybePromise; }; type ComputeNodeDefinition = FlowNodeCommon & { nodeType: "compute"; run: (context: FlowNodeContext) => MaybePromise; }; type FunctionActionNodeDefinition = FlowNodeCommon & { nodeType: "action"; run: (context: FlowNodeContext) => MaybePromise; }; type ShellActionExecution = { command: string; args?: string[]; cwd?: string; env?: Record; stdin?: string; shell?: boolean | string; allowNonZeroExit?: boolean; timeoutMs?: number; }; type ShellActionResult = { command: string; args: string[]; cwd: string; stdout: string; stderr: string; combinedOutput: string; exitCode: number | null; signal: NodeJS.Signals | null; durationMs: number; }; type ShellActionNodeDefinition = FlowNodeCommon & { nodeType: "action"; exec: (context: FlowNodeContext) => MaybePromise; parse?: (result: ShellActionResult, context: FlowNodeContext) => MaybePromise; }; type ActionNodeDefinition = FunctionActionNodeDefinition | ShellActionNodeDefinition; type CheckpointNodeDefinition = FlowNodeCommon & { nodeType: "checkpoint"; summary?: string; run?: (context: FlowNodeContext) => MaybePromise; }; type FlowNodeDefinition = AcpNodeDefinition | ComputeNodeDefinition | ActionNodeDefinition | CheckpointNodeDefinition; type FlowPermissionRequirements = { requiredMode: PermissionMode; requireExplicitGrant?: boolean; reason?: string; }; type FlowDefinition = { name: string; run?: FlowRunDefinition; permissions?: FlowPermissionRequirements; startAt: string; nodes: Record; edges: FlowEdge[]; }; type FlowNodeOutcome = "ok" | "timed_out" | "failed" | "cancelled"; type FlowNodeResult = { attemptId: string; nodeId: string; nodeType: FlowNodeDefinition["nodeType"]; outcome: FlowNodeOutcome; startedAt: string; finishedAt: string; durationMs: number; output?: unknown; error?: string; }; type FlowArtifactRef = { path: string; mediaType: string; bytes: number; sha256: string; }; type FlowConversationTrace = { sessionId: string; messageStart: number; messageEnd: number; eventStartSeq: number; eventEndSeq: number; }; type FlowActionReceipt = { actionType: "shell" | "function"; command?: string; args?: string[]; cwd?: string; exitCode?: number | null; signal?: NodeJS.Signals | null; durationMs?: number; }; type FlowStepTrace = { sessionId?: string; promptArtifact?: FlowArtifactRef; rawResponseArtifact?: FlowArtifactRef; outputArtifact?: FlowArtifactRef; outputInline?: unknown; stdoutArtifact?: FlowArtifactRef; stderrArtifact?: FlowArtifactRef; conversation?: FlowConversationTrace; action?: FlowActionReceipt; }; type FlowStepRecord = { attemptId: string; nodeId: string; nodeType: FlowNodeDefinition["nodeType"]; outcome: FlowNodeOutcome; startedAt: string; finishedAt: string; promptText: string | null; rawText: string | null; output: unknown; error?: string; session: FlowSessionBinding | null; agent: { agentName: string; agentCommand: string; cwd: string; } | null; trace?: FlowStepTrace; }; type FlowSessionBinding = { key: string; handle: string; bundleId: string; name: string; profile?: string; agentName: string; agentCommand: string; cwd: string; acpxRecordId: string; acpSessionId: string; agentSessionId?: string; }; type FlowRunState = { runId: string; flowName: string; runTitle?: string; flowPath?: string; startedAt: string; finishedAt?: string; updatedAt: string; status: "running" | "waiting" | "completed" | "failed" | "timed_out"; input: unknown; outputs: Record; results: Record; steps: FlowStepRecord[]; sessionBindings: Record; currentNode?: string; currentAttemptId?: string; currentNodeType?: FlowNodeDefinition["nodeType"]; currentNodeStartedAt?: string; lastHeartbeatAt?: string; statusDetail?: string; waitingOn?: string; error?: string; }; type FlowRunResult = { runDir: string; state: FlowRunState; }; type ResolvedFlowAgent = { agentName: string; agentCommand: string; cwd: string; }; type FlowRunnerOptions = { resolveAgent: (profile?: string) => ResolvedFlowAgent; permissionMode: PermissionMode; mcpServers?: McpServer$1[]; nonInteractivePermissions?: NonInteractivePermissionPolicy; permissionPolicy?: PermissionPolicy; authCredentials?: Record; authPolicy?: AuthPolicy; timeoutMs?: number; defaultNodeTimeoutMs?: number; ttlMs?: number; verbose?: boolean; suppressSdkConsoleErrors?: boolean; sessionOptions?: SessionAgentOptions; services?: Record; outputRoot?: string; }; //#endregion //#region src/flows/definition.d.ts declare function defineFlow(definition: TFlow): TFlow; declare function acp(definition: Omit): AcpNodeDefinition; declare function compute(definition: Omit): ComputeNodeDefinition; declare function action(definition: Omit): FunctionActionNodeDefinition; declare function action(definition: Omit): ShellActionNodeDefinition; declare function shell(definition: Omit): ShellActionNodeDefinition; declare function checkpoint(definition?: Omit): CheckpointNodeDefinition; //#endregion //#region src/flows/runtime.d.ts declare class FlowRunner { private readonly resolveAgent; private readonly defaultCwd; private readonly permissionMode; private readonly mcpServers?; private readonly nonInteractivePermissions?; private readonly permissionPolicy?; private readonly authCredentials?; private readonly authPolicy?; private readonly timeoutMs?; private readonly defaultNodeTimeoutMs; private readonly verbose?; private readonly suppressSdkConsoleErrors?; private readonly sessionOptions?; private readonly services; private readonly store; private readonly pendingPersistentSessionClients; constructor(options: FlowRunnerOptions); run(flow: FlowDefinition, input: unknown, options?: { flowPath?: string; }): Promise; private executeFlowRun; private executeFlowStep; private writeNodeStartedSnapshot; private executeStartedFlowStep; private createSuccessfulFlowStep; private createFailedFlowStep; private maybeCompleteCheckpointStep; private resolveNextNode; private completeFlowRun; private recordFlowStepOutcome; private executeNode; private executeComputeNode; private executeActionNode; private executeCheckpointNode; private executeAcpNode; private prepareAcpPrompt; private writeAcpPromptHeartbeat; private executeIsolatedAcpPrompt; private initializeIsolatedSessionBundle; private executePersistentAcpPrompt; private appendAcpPromptPreparedTrace; private finishAcpPrompt; private writeAcpRawResponseArtifact; private appendAcpResponseParsedTrace; private parseAcpOutput; private runWithHeartbeat; private ensureSessionBinding; private refreshSessionBinding; private runPersistentPrompt; private closePendingPersistentSessionClients; private runIsolatedPrompt; } //#endregion //#region src/flows/decision.d.ts type DecisionAcpOptions = Omit; type DecisionDefinition = DecisionAcpOptions & { question: string | ((context: FlowNodeContext) => string | Promise); choices: readonly TChoice[]; field?: string; }; declare function decision(definition: DecisionDefinition): AcpNodeDefinition; declare function decisionEdge(args: { from: string; choices: readonly TChoice[]; field?: string; cases: Record; }): FlowEdge; //#endregion //#region src/flows/store.d.ts declare function flowRunsBaseDir(homeDir?: string): string; //#endregion //#region src/flows/json.d.ts type JsonObjectParseMode = "strict" | "fenced" | "compat"; declare function parseJsonObject(text: string, options?: { mode?: JsonObjectParseMode; }): unknown; declare function parseStrictJsonObject(text: string): unknown; declare function extractJsonObject(text: string): unknown; //#endregion export { type AcpNodeDefinition, type ActionNodeDefinition, type CheckpointNodeDefinition, type ComputeNodeDefinition, type DecisionDefinition, type FlowDefinition, type FlowEdge, type FlowNodeCommon, type FlowNodeContext, type FlowNodeDefinition, type FlowPermissionRequirements, type FlowRunDefinition, type FlowRunResult, type FlowRunState, FlowRunner, type FlowRunnerOptions, type FlowSessionBinding, type FlowStepRecord, type FunctionActionNodeDefinition, type JsonObjectParseMode, type ResolvedFlowAgent, type ShellActionExecution, type ShellActionNodeDefinition, type ShellActionResult, acp, action, checkpoint, compute, decision, decisionEdge, defineFlow, extractJsonObject, flowRunsBaseDir, parseJsonObject, parseStrictJsonObject, shell }; //# sourceMappingURL=flows.d.ts.map