import type { BindingOrigin } from "./contract/expression.js"; import type { FlowDefinition, FlowNode } from "./engine/types.js"; import type { Approval, FlowExecution, InputRequest, NodeError, NodeOutput } from "@skaile/workspaces/types"; /** Strict v2 sub-flow node admitted by the pure engine. */ export type SubFlowFlowNode = FlowNode & { run: Extract, { kind: "sub-flow"; }>; }; /** Live child surface temporarily exposed through the parent's existing connector tools. */ export interface InlineSubFlowOperationTarget { /** Parent sub-flow node that owns this transient child. */ parentNodeId: string; /** Whether this child currently owns the session agent's operation surface. */ isAgentTurnActive(): boolean; /** Executes one agent operation against the live child. */ executeAgentOp(operation: string, args: Record): Promise; /** Applies a host approval addressed to the parent sub-flow node. */ applyParentApproval(args: Record): Promise; /** Applies host input addressed to the parent sub-flow node. */ applyParentInput(args: Record): Promise; /** Cancels, disconnects, and forgets this transient child. */ cancel(): Promise; /** Returns the child snapshot visible to scripted and production agent drivers. */ getExecution(): FlowExecution; /** Returns child agent nodes whose approval policy remains mandatory. */ getMandatoryAgentApprovalNodeIds(): string[]; } /** Host-owned request to drive one delegated flow through the existing session lifecycle. */ export interface InlineSubFlowRequest { /** Available parent node whose delegated flow is starting. */ node: SubFlowFlowNode; /** Delegated flow identifier from the node's run declaration. */ flowId: string; /** Values resolved at the parent node boundary. */ inputs: Record; /** Provenance retained separately from the values passed to the child. */ inputOrigins: Record; /** Whether the authored legacy/shared-context intent should be applied to child input. */ passContext: boolean; /** Parent definition, used only to derive child run input when context passing is enabled. */ parentFlow: FlowDefinition; /** Live parent snapshot; the child never mutates or persists it directly. */ parentExecution: FlowExecution; /** In-memory flow ancestry used for cycle and depth checks. */ ancestry: string[]; /** Registers this parent node's transient child operation target. */ routeOperationsTo(target: InlineSubFlowOperationTarget | undefined): void; } /** Existing parent-node interaction fields projected from a transient parked child. */ export interface InlineSubFlowProjection { status: "running" | "awaiting_approval" | "awaiting_input"; approval?: Approval; input?: InputRequest; } /** * Terminal or deliberately parked result reported by the host-owned inline lifecycle. * * A completing implementation must not populate `output.fields`. A sub-flow * node's persisted `inputOrigins` record only the parent's bindings into the * child, so a child agent's value re-emerging as this node's own field would * classify runtime-obtained — laundering the very taint transitive provenance * exists to carry. Summary and artifacts are unaffected: no binding can read them. */ export type InlineSubFlowResult = { status: "complete"; output?: NodeOutput; } | { status: "failed"; error: NodeError; output?: NodeOutput; } | { status: "paused"; projection: InlineSubFlowProjection; }; /** Host seam for resolving and driving an inline child inside the materialized session. */ export interface InlineSubFlowRunner { /** Drives one child until it completes, fails, or parks for unavailable host input. */ run(request: InlineSubFlowRequest): Promise; } //# sourceMappingURL=sub-flow-runner.d.ts.map