import type { Risk, Complexity, Ambiguity, TaskType } from "./base.js";
import type { ExecutionTier } from "./execution.js";
import type { RepairLoopState } from "./execution.js";
import type { UncertaintyTrigger } from "./phase.js";
import type { PhaseDirective, ReworkHistory } from "./phase.js";
import type { WorkflowTrace } from "./pipeline.js";
import type { ExpandResult } from "./pipeline.js";
import type { VerifyResult } from "./pipeline.js";
import type { FailureRecord } from "./pipeline.js";
import type { PlanResult } from "./analysis.js";
import type { CodeReviewResult } from "./review.js";
import type { DeliveryResult } from "./delivery.js";
import type { IntentRouteDecision } from "../engine/pipeline/intent_router.js";
import type { ToolInvocationViolation, ToolTrace } from "../engine/contracts/tool_invocation_contract_registry.js";
import type { IngestionEvidence } from "../engine/pipeline/input_material_contract_registry.js";
import type { OutputArtifact } from "../engine/contracts/artifact_contract_registry.js";
import type { DataSensitivityLabel, RedactionRecord } from "../engine/audit/privacy_secret_contract.js";
import type { VerificationPlan, VerificationResult } from "../engine/contracts/verification_contract.js";
import type { FailureReport } from "../engine/audit/failure_report.js";
import type { DegradationEvent } from "../engine/audit/degradation.js";
import type { DeliveryReadinessReport } from "../engine/audit/delivery_readiness.js";
import type { BrainstormSession, DetailDisciplineContract, FinalLocalReviewAccess, FirstPrinciplesFrame, TechnologyDecisionContract, TechnologyDecisionRecord } from "../engine/contracts/extension_platform_contracts.js";
import type { PlanProposalEvidence, PlanProposalGateResult, UserConfirmationRef, VerificationPlanRef } from "../engine/pipeline/plan_proposal_gate.js";
import type { CoreExperiencePrincipleEvaluation } from "../engine/audit/core_experience_principle.js";
import type { EvidenceConflict, EvidenceGateResult, EvidenceMatrix } from "../engine/contracts/evidence_grounding_contract.js";
import type { ArchitectureDecisionWorkshopContract } from "../engine/contracts/architecture_decision_workshop.js";
import type { DecisionWorkshopContract } from "../engine/contracts/decision_workshop.js";
import type { OodDesignSummary, SolidReviewFinding } from "../engine/contracts/ood_solid_contract.js";
import type { BackendImplementationFinding, BackendImplementationWorkPackage } from "../engine/contracts/backend_implementation_contract.js";
import type { CodeObservabilityFinding, CodeObservabilityWorkPackage } from "../engine/contracts/code_maintainability_observability_contract.js";
import type { InstructionContract } from "../engine/contracts/instruction_contract.js";
import type { ReadinessEvaluationResult } from "../engine/contracts/coding_readiness_gate.js";
/** 设计产物包状态 */
export type DesignArtifactPackStatus = "draft" | "awaiting_decisions" | "needs_revalidation" | "awaiting_upgrade_confirmation" | "verification_failed" | "confirmed" | "implementation_ready" | "superseded" | "blocked";
/** 设计产物文件路径 */
export interface DesignArtifactPaths {
    decision_record: string;
    architecture_document: string;
    database_document: string;
    api_document: string;
    optional_detail_design_document?: string;
    slice_plan: string;
    consistency_report: string;
    traceability_matrix?: string;
    openapi: string;
    sql_roots: string[];
}
/** 设计产物发现 */
export interface DesignArtifactFinding {
    code: string;
    severity: "hard_fail" | "advisory";
    file?: string;
    message_zh: string;
    recovery_zh?: string;
    recovery_command?: string;
    template_path?: string;
}
/** 设计产物包契约 */
export interface DesignArtifactPackContract {
    task_id: string;
    standard_version: string;
    status: DesignArtifactPackStatus;
    paths: DesignArtifactPaths;
    baseline_hashes: Record<string, string>;
    decision_workshop_ref?: string;
    user_confirmation_ref?: string;
    findings: DesignArtifactFinding[];
    verified_at?: string;
}
/** 设计产物包验证结果 */
export interface DesignArtifactVerificationResult {
    passed: boolean;
    status: DesignArtifactPackStatus;
    findings: DesignArtifactFinding[];
    checked_files: string[];
    hashes: Record<string, string>;
}
/** 失败记录 */
/** 任务上下文，贯穿任务全生命周期的状态容器 */
export interface TaskContext {
    /** 任务唯一标识 */
    task_id: string;
    /** 创建时间 (ISO 8601) */
    created_at: string;
    /** 最近一次由 TaskContextManager 持久化更新时间 (ISO 8601) */
    updated_at?: string;
    /** 用户意图描述 */
    intent: string;
    /** 产品画像 */
    product_profile: string;
    /** 当前状态 */
    status: "classifying" | "expanding" | "clarifying" | "executing" | "verifying" | "retrying" | "learning" | "reworking" | "done" | "failed";
    /** 分类结果 */
    classification?: ClassifyResult;
    /** 意图路由决策（从 classify 阶段产生，贯穿整个任务生命周期） */
    route_decision?: IntentRouteDecision;
    /** 扩展结果 */
    expansion?: ExpandResult;
    /** 执行状态 */
    execution?: {
        /** 已变更文件列表 */
        changed_files: string[];
        /** 已尝试次数 */
        attempt_count: number;
        /** 最大尝试次数 */
        max_attempts: number;
        /** 失败历史 */
        failure_history: FailureRecord[];
        /** 修复循环状态 */
        repair_loop?: RepairLoopState;
        /** single_artifact/source_extraction 无代码变更时显式标记 */
        no_change_artifact?: boolean;
    };
    /** 验证结果 */
    verification?: VerifyResult;
    /** 显式跳过验证的原因（不允许默认空推进到 done/learning） */
    skip_verification_reason?: string;
    /** 规划结果 */
    planning?: PlanResult;
    /** 代码审查结果 */
    code_review?: CodeReviewResult;
    /** 交付结果 */
    delivery?: DeliveryResult;
    /** 当前阶段指令 */
    phase_directive?: PhaseDirective;
    /** 返工历史 */
    rework_history?: ReworkHistory[];
    /** 最后一次工具调用追踪*/
    last_tool_trace?: ToolTrace;
    /** 工具调用违规记录*/
    invocation_violations?: ToolInvocationViolation[];
    /** 摄取证据列表*/
    ingestion_evidences?: IngestionEvidence[];
    /** 输出产物记录*/
    artifact_output?: OutputArtifact;
    /** 敏感度标签列表（ 隐私） */
    sensitivity_labels?: DataSensitivityLabel[];
    /** 脱敏记录列表（ 隐私） */
    redaction_records?: RedactionRecord[];
    /** 验证计划（plan_only，非执行结果） */
    verification_plan?: VerificationPlan;
    /** 验证结果（真实执行产出） */
    verification_result?: VerificationResult;
    /** 失败报告（脱敏，非 raw error_output） */
    failure_report?: FailureReport;
    /** 降级事件 */
    degradation_event?: DegradationEvent;
    /** 交付就绪报告 */
    delivery_readiness?: DeliveryReadinessReport;
    /** 用户确认后的本地验收证据（问题五十二/六十三：交付放行前的可审计依据） */
    local_acceptance_evidence?: {
        status: "passed" | "not_applicable";
        run_mode: "manual_review" | "not_applicable";
        confirmed_by: string;
        confirmation_ref: string;
        final_access: FinalLocalReviewAccess;
        evidence_refs: string[];
    };
    /** 计划前置门证据 */
    plan_proposal_gate?: PlanProposalGateResult;
    /** 计划提案证据 */
    plan_proposal_evidence?: PlanProposalEvidence;
    /** 用户确认引用 */
    user_confirmation_ref?: UserConfirmationRef;
    /** 验证计划引用 */
    verification_plan_ref?: VerificationPlanRef;
    /** 核心体验原则评估 */
    core_experience_evaluation?: CoreExperiencePrincipleEvaluation;
    /** 证据矩阵（问题六十：证据驱动门禁产出） */
    evidence_matrix?: EvidenceMatrix;
    /** 证据门禁结果（问题六十：阻断原因和诊断码） */
    evidence_gate_result?: EvidenceGateResult;
    /** 无证据声明 ID 列表（问题六十：被门禁标记为证据不足的 claim） */
    unsupported_claims?: string[];
    /** 证据冲突记录（问题六十：未裁决的互相矛盾证据） */
    conflict_resolutions?: EvidenceConflict[];
    /** 架构设计前的六域决策研讨契约（问题六十一子包） */
    architecture_decision_workshop?: ArchitectureDecisionWorkshopContract;
    /** 通用决策研讨契约（问题六十一） — 覆盖所有高影响/不确定任务的决策前置确认 */
    decision_workshop?: DecisionWorkshopContract;
    /** 技术决策主权契约（问题十六） */
    technology_decision_contract?: TechnologyDecisionContract;
    /** 技术决策执行记录（问题十六） */
    technology_decision_record?: TechnologyDecisionRecord;
    /** 细节纪律契约（问题二十六） */
    detail_discipline_contract?: DetailDisciplineContract;
    /** 细节纪律已提供证据（问题二十六） */
    provided_details?: Record<string, string[]>;
    /** 第一性原理框架（问题二十七） */
    first_principles_frame?: FirstPrinciplesFrame;
    /** 脑暴/方案探索会话（问题四十二） */
    brainstorm_session?: BrainstormSession;
    /** 模板契约修复重验指令（问题六十三） */
    repair_reverify_directive?: {
        contract_id: string;
        file_path: string;
        status: string;
        repair_suggestion: string;
        blocked: boolean;
    };
    /** 架构、数据库与 API 设计产物包状态（问题六十二） */
    design_artifact_pack?: DesignArtifactPackContract;
    /** 需求/原型/设计/切片/验收追踪绑定（问题七十三） */
    traceability_binding?: {
        requirement_ids: string[];
        prototype_ids: string[];
        architecture_ids: string[];
        detail_design_ids: string[];
        phase_ids?: string[];
        slice_ids: string[];
        acceptance_ids: string[];
        status: "bound" | "missing" | "needs_backfill";
        findings: string[];
    };
    /** OOD/SOLID 编码前设计摘要（问题六十六） */
    ood_solid_summary?: OodDesignSummary;
    /** OOD/SOLID 代码审查结论（问题六十六） */
    ood_solid_findings?: SolidReviewFinding[];
    /** 后端实现工程工作包（问题六十七） */
    backend_implementation_work_package?: BackendImplementationWorkPackage;
    /** 后端工程审查结论（问题六十七） */
    backend_implementation_findings?: BackendImplementationFinding[];
    /** 代码可维护性与可观测性工作包（问题六十八） */
    code_observability_work_package?: CodeObservabilityWorkPackage;
    /** 代码可维护性与可观测性审查结论（问题六十八） */
    code_observability_findings?: CodeObservabilityFinding[];
    /** 指令契约（施工执行约束） */
    instruction_contract?: InstructionContract;
    /** 编码就绪契约 */
    coding_readiness_contract?: ReadinessEvaluationResult;
    /** 现有系统分析结果 */
    existing_system_analysis?: Record<string, unknown>;
    /** 需求差距分析结果 */
    requirement_gap_analysis?: Record<string, unknown>;
    /** 工作流追踪 */
    workflow_trace?: WorkflowTrace;
    /** 遗漏扫描结果（防 AI 偷懒 — sf_verify 步骤 9） */
    omission_scan_result?: {
        scanned_files: string[];
        total_findings: number;
        hard_fail_count: number;
        summary: string;
        adversarial_prompt?: string;
    };
    /** 代码质量门禁结果（防 AI 偷懒 — sf_verify 步骤 7a-7e） */
    code_quality_result?: {
        lazy_pattern_findings: number;
        error_path_findings: number;
        test_quality_hard_fails: number;
        mutation_hard_fails: number;
        behavior_coverage_warnings: number;
        summary: string;
    };
    /** sf_verify 阶段匹配的知识提示 */
    review_knowledge_hints?: string[];
}
/** 分类结果 */
export interface ClassifyResult {
    /** 任务类型 */
    task_type: TaskType;
    /** 风险等级 */
    risk: Risk;
    /** 复杂度 */
    complexity: Complexity;
    /** 歧义度 */
    ambiguity: Ambiguity;
    /** 受影响的仓库列表 */
    affected_repos: string[];
    /** 执行模式: autonomous=自主, supervised=受监督, passthrough=直通 */
    mode: "autonomous" | "supervised" | "passthrough";
    /** 执行策略: full_pipeline=完整流水线, quick_fix=快速修复, skip_soloForge=跳过 */
    strategy: "full_pipeline" | "quick_fix" | "skip_soloForge";
    /** 澄清请求 */
    clarification?: {
        /** 澄清摘要 */
        summary: string;
        /** 待确认的问题列表 */
        questions?: string[];
    };
    /** 执行层级 */
    execution_tier?: ExecutionTier;
    /** 不确定性触发器列表 */
    uncertainty_triggers?: UncertaintyTrigger[];
    /** 路由决策结果 */
    route_decision?: IntentRouteDecision;
}
//# sourceMappingURL=task.d.ts.map