/** * WorkflowFunnelLoader — Loads and watches workflows.yaml as the SSOT * for WORKFLOW_FUNNELS definition table. * * D-01: workflows.yaml is the single source of truth (SSOT). * D-02: workflows.yaml lives in .state/ directory per workspace. * D-03: Developers manually maintain workflows.yaml (no auto-registration). * D-04: Code only reads YAML, never writes it. */ /** * A single stage in a workflow funnel. * Policy fields are optional — existing stages without policy fields remain valid. */ export interface WorkflowStage { name: string; eventType: string; eventCategory: string; statsField: string; timeoutMs?: number; successCriteria?: string; legacyDisabled?: boolean; observability?: { enabled?: boolean; emitEvents?: string[]; }; } /** * Funnel-level policy that applies to all stages unless overridden per-stage. */ export interface FunnelPolicy { timeoutMs?: number; stageOrder?: 'strict' | 'relaxed'; legacyDisabled?: boolean; observability?: { enabled?: boolean; emitEvents?: string[]; logLevel?: 'debug' | 'info' | 'warn' | 'error'; }; } /** * A workflow funnel definition. */ export interface WorkflowFunnel { workflowId: string; stages: WorkflowStage[]; policy?: FunnelPolicy; } /** * Root of workflows.yaml schema. */ export interface WorkflowFunnelConfig { version: string; funnels: WorkflowFunnel[]; } export declare class WorkflowFunnelLoader { private readonly funnels; private readonly fullFunnels; private readonly configPath; private watchHandle?; private readonly warnings; constructor(stateDir: string); load(): void; watch(): void; dispose(): void; getStages(workflowId: string): WorkflowStage[]; getFunnel(workflowId: string): WorkflowFunnel | undefined; getAllFunnels(): Map; getAllFunnelsWithPolicy(): Map; getWarnings(): string[]; getConfigPath(): string; private cloneFunnel; }