/**
 * 工作流契约注册表 — 管线双层架构。
 *
 * 顶层：管线契约（新系统管线 / 老系统管线），管控阶段流转。
 * 底层：阶段契约（每个 TaskStage 一个），管控阶段内部执行。
 * 快捷路径：wf-direct-answer / wf-single-artifact 不走管线。
 */
import type { IntentRoute, ExecutionShape, IntentRouteDecision } from "../pipeline/intent_router.js";
import type { TaskStage } from "./workflow_navigation_contract.js";
import type { SystemType } from "./legacy_type_migration.js";
export type WorkflowDegradationPolicy = "block_execution" | "advisory_only" | "conservative_output" | "human_confirmation_required";
/** 阶段契约 — 每个 TaskStage 对应一个 */
export interface StageContract {
    /** 阶段契约 ID，格式: "stage-{阶段名}" */
    id: string;
    /** 对应的任务阶段 */
    task_stage: TaskStage;
    /** 管线归属：新系统 / 老系统 / 两者 */
    pipeline_scope: SystemType[] | "*";
    /** 必需机制 */
    required_mechanisms: string[];
    /** 建议机制 */
    advisory_mechanisms: string[];
    /** 必需输入 */
    required_inputs: string[];
    /** 产出输出 */
    produced_outputs: string[];
    /** 门禁检查项 */
    gate_checks: string[];
    /** 允许的回退目标阶段 */
    rollback_targets: TaskStage[];
    /** 回退并标注的目标阶段（需人工确认） */
    rollback_annotate_targets: TaskStage[];
    /** 降级策略 */
    degradation_policy: WorkflowDegradationPolicy;
    /** 人工门禁 */
    human_gate: string[];
    /** 治理检查 */
    governance_checks: string[];
}
/** 管线契约 — 定义完整的项目工作流 */
export interface PipelineContract {
    /** 管线 ID */
    id: string;
    /** 管线名称 */
    name: string;
    /** 系统类型 */
    system_type: SystemType;
    /** 阶段序列（按执行顺序） */
    stages: TaskStage[];
    /** 管线级治理检查 */
    governance_checks: string[];
}
/** 快捷路径契约 — 不走管线 */
export interface ShortcutContract {
    id: string;
    routes: IntentRoute[];
    execution_shapes: ExecutionShape[];
    mutation_allowed: boolean;
    required_mechanisms: string[];
    prompt_template: string;
    verification_strategy: string;
}
export interface WorkflowGovernanceFinding {
    severity: "hard_fail" | "advisory";
    workflow_id: string;
    rule: string;
    message: string;
}
export interface WorkflowContract {
    id: string;
    routes: IntentRoute[];
    execution_shapes: ExecutionShape[];
    mutation_allowed: boolean;
    required_mechanisms: string[];
    advisory_mechanisms: string[];
    required_inputs: string[];
    produced_outputs: string[];
    allowed_state_transitions: string[];
    required_evidence: string[];
    degradation_policy: WorkflowDegradationPolicy;
    human_gate: string[];
    governance_checks: string[];
    tests: string[];
    prompt_template: string;
    verification_strategy: string;
}
export declare const PIPELINE_CONTRACTS: PipelineContract[];
export declare const STAGE_CONTRACTS: StageContract[];
/** 根据系统类型获取管线契约 */
export declare function findPipelineBySystemType(systemType: SystemType): PipelineContract | undefined;
/** 根据任务阶段获取阶段契约 */
export declare function findStageContract(taskStage: TaskStage): StageContract | undefined;
/** 根据路由决策解析管线或快捷路径 */
export declare function resolveWorkflowFromRoute(routeDecision: IntentRouteDecision): {
    type: "pipeline";
    pipeline: PipelineContract;
    stage: StageContract;
} | {
    type: "shortcut";
    contract: ShortcutContract;
} | undefined;
export declare function listWorkflowContracts(): WorkflowContract[];
export declare function findWorkflowContractById(id: string): WorkflowContract | undefined;
export declare function findWorkflowContractByRoute(route: IntentRoute, shape?: ExecutionShape): WorkflowContract | undefined;
export declare function resolveWorkflow(routeDecision: IntentRouteDecision): WorkflowContract | undefined;
export declare function validateWorkflowContracts(contracts?: WorkflowContract[]): WorkflowGovernanceFinding[];
//# sourceMappingURL=workflow_contract_registry.d.ts.map