/** * Workflow node lifecycle — pure transition tables (RD §3). * * Pure functions: no filesystem, no env access. The transition * tables encode the allowed lease + node status transitions defined * in RD §3. Forbidden transitions return a typed error code so the * CLI / orchestrator can surface actionable hints. * * Anti-fake-green rule: this module never imports a vendor env var. * The vendor signal lives entirely in the IDE adapters. */ import { type GraphNodeStatus, type LeaseStatus, type AckStatus, type WorkflowGraph, type WorkflowGraphNode, type NodeId, type WorkflowId } from './workflow-graph-types.js'; export interface LifecycleError extends Error { readonly code: string; } export declare function transitionLease(from: LeaseStatus, to: LeaseStatus, input?: Record): Record; export declare function transitionNode(from: GraphNodeStatus, to: GraphNodeStatus, input?: Record): Record; export declare function acknowledgeNode(node: WorkflowGraphNode): WorkflowGraphNode; export declare function markNodeLost(node: WorkflowGraphNode, reason: string): WorkflowGraphNode; declare function _purePrepareNode(graph: WorkflowGraph, node: WorkflowGraphNode): WorkflowGraph; export declare function isFirstHeartbeat(node: WorkflowGraphNode, inputFirstHeartbeat: unknown): boolean; export declare function buildGraphNode(input: { id: NodeId; kind: 'step' | 'dispatch' | 'terminal'; label: string; status: GraphNodeStatus; dispatchRef?: string; lastHeartbeat?: string; ackStatus?: AckStatus; dependsOn?: readonly NodeId[]; }): WorkflowGraphNode; export interface GraphDispatchBinding { readonly workflowId: WorkflowId; readonly graphNodeId: NodeId; readonly graphRef: string; } export declare function resolveDispatchBinding(input: { workflowId?: WorkflowId; graphNodeId?: NodeId; graphRef?: string; }): GraphDispatchBinding; export interface NodeLifecycleInput { readonly projectRoot?: string; readonly sessionId?: string; readonly workflowId?: string; readonly graphRef?: string; readonly nodeId?: string; readonly graphNode?: WorkflowGraphNode; readonly dispatchRef?: string; readonly envelopeDispatchRef?: string; readonly status?: GraphNodeStatus; readonly lastHeartbeat?: string; readonly firstHeartbeat?: boolean; readonly dependsOn?: readonly NodeId[]; readonly duplicate?: boolean; readonly cycle?: boolean; } export declare function prepareNodeAction(input: NodeLifecycleInput): WorkflowGraphNode; export declare function dispatchNode(input: NodeLifecycleInput): Record; export declare function heartbeatNode(input: NodeLifecycleInput): Record; export declare function writeEnvelope(input: NodeLifecycleInput): Record; export declare function ackNode(input: NodeLifecycleInput): Record; export declare function markLost(input: NodeLifecycleInput): Record; export declare function prepareNode(arg1: WorkflowGraph | NodeLifecycleInput, arg2?: WorkflowGraphNode): WorkflowGraph | WorkflowGraphNode; export declare const nodePrepare: typeof prepareNodeAction; export declare const nodePreparePure: typeof _purePrepareNode; export {};