/** * Workflow graph schemas (RD §2 — slice 4.0.8 presence-lease-graph). * * Pure type definitions and Zod-free runtime validators (we keep * types synchronous + cheap; the on-disk validation lives in the * graph store). The types here are the canonical reference for * transitions, node kinds, and edge invariants. * * No vendor env lookups; no filesystem I/O. */ export type WorkflowId = string; export type NodeId = string; export type GraphNodeKind = 'step' | 'dispatch' | 'terminal'; export type GraphNodeStatus = 'prepared' | 'dispatched' | 'running' | 'envelope-received' | 'consumed-by-parent' | 'terminalized' | 'lost'; export type AckStatus = 'pending' | 'acknowledged' | 'not-required'; export type TerminalReason = 'success' | 'aborted' | 'sub-agent-crashed' | 'ttl-expired' | 'outer-session-mismatch' | 'parent-acked-no-envelope' | 'graph-corrupted' | 'unknown'; export declare const TERMINAL_REASONS: ReadonlyArray; export type LeaseStatus = 'preparing' | 'running' | 'terminalized' | 'lost'; export declare const LEASE_STATUSES: ReadonlyArray; export declare const GRAPH_NODE_STATUSES: ReadonlyArray; export interface WorkflowGraphEdge { readonly from: NodeId; readonly to: NodeId; } export interface WorkflowGraphNode { readonly id: NodeId; readonly kind: GraphNodeKind; readonly label: string; readonly status: GraphNodeStatus; readonly dispatchRef?: string; readonly lastHeartbeat?: string; readonly ackStatus?: AckStatus; readonly dependsOn: readonly NodeId[]; } export interface WorkflowGraph { readonly workflowId: WorkflowId; readonly rootSkill: string; readonly parentWorkflowId?: WorkflowId; readonly nodes: readonly WorkflowGraphNode[]; readonly edges: readonly WorkflowGraphEdge[]; readonly schemaVersion: 1; } /** * `id` regex: ASCII letters, digits, dot, underscore, hyphen; 1-200 chars. * caller-id contract — node ids appear in file paths). */ export declare const NODE_ID_REGEX: RegExp; export declare const WORKFLOW_ID_REGEX: RegExp; export declare const DISPATCH_REF_REGEX: RegExp; /** `graphRef` must normalize to `graphs/.json`. */ export declare function normalizeGraphRef(graphRef: string, workflowId: WorkflowId): string; /** Validate `graphRef` does not escape the session directory. */ export declare function isSafeRelativeGraphRef(graphRef: string, workflowId: WorkflowId): boolean; /** Throws `TypeError` with `code` set on shape failure (used by pure validators). */ export declare function failShape(code: string, message: string): never;