/**
 * 发布问题场景注册表 — 共享前置条件设置
 *
 * 从 架构设计 返回结果中提取并确认通用 decision_workshop。
 * 合同来源于第一次 架构设计 返回对象，经用户确认字段修改后回传。
 * 不得自行新建一份合同。
 */
export function confirmDecisionWorkshopFromResponse(expResult) {
    const workshop = expResult?.decision_workshop;
    if (!workshop)
        return undefined;
    // 确认所有扩展域
    for (const key of Object.keys(workshop.extended_domains ?? {})) {
        const domain = workshop.extended_domains?.[key];
        if (domain) {
            domain.status = "confirmed";
            domain.user_confirmation_ref = "scenario-user-confirm-ref";
        }
    }
    workshop.prerequisite_evidence_refs = ["scenario-evidence-ref"];
    // 清除阻断发现（evaluateDecisionWorkshop 会继承 contract.blocking_findings）
    workshop.blocking_findings = [];
    workshop.status = "confirmed";
    workshop.generation_allowed = true;
    return workshop;
}
/** 架构研讨场景的完整技术决策契约，确保证据门禁和决策主权门禁都能通过 */
export function makeTechnologyDecisionContract(taskId) {
    return {
        decision_id: `td-${taskId}`,
        decision_scope: "architecture",
        options: [
            { option_id: "microservices", title: "微服务架构", description: "微服务架构" },
            { option_id: "monolith", title: "单体架构", description: "单体架构" },
        ],
        recommended_option: "microservices",
        evidence: [
            { source_type: "heuristic", source_ref: "技术选型评估", confidence: 0.7 },
            { source_type: "heuristic", source_ref: "团队经验评估", confidence: 0.6 },
        ],
        rejected_options: [],
        falsification: ["性能测试不达标"],
        failure_conditions: ["交付延迟超过2周"],
        validation_plan: ["架构评审", "性能基准测试"],
        rollback_or_exit_plan: ["回退到单体架构"],
        human_gate_required: true,
        executable_without_human: false,
        human_gate_evidence: "用户确认技术选型",
    };
}
/** 架构研讨场景的第一性原理帧，确保高影响意图通过第一性原理门禁 */
export function makeFirstPrinciplesFrame(taskId) {
    return {
        problem_id: `fp-${taskId}`,
        user_goal: "为新系统生成架构设计文档",
        fundamental_need: "系统化的架构设计，支撑后续开发",
        known_facts: ["项目为新系统", "需要架构设计文档", "涉及微服务架构选型"],
        assumptions: ["团队具备微服务开发经验", "基础设施支持容器化部署"],
        non_negotiable_constraints: ["必须支持水平扩展", "技术栈基于 TypeScript"],
        candidate_solutions: ["微服务架构", "单体模块化架构"],
        simplest_viable_solution: "单体模块化架构",
        falsification_questions: ["性能测试是否满足要求", "团队规模是否支撑微服务运维"],
        chosen_solution: "微服务架构",
        why_not_legacy_path: "遗留方案无法满足水平扩展需求",
        first_principles_status: "passed",
    };
}
/** 为架构研讨场景注入技术决策契约和第一性原理帧，确保证据门禁、决策主权门禁和第一性原理门禁都能通过 */
export async function injectTechDecisionForWorkshop(harness, taskId) {
    const ctx = await harness.taskContext.load(taskId);
    if (!ctx)
        return null;
    ctx.technology_decision_contract = makeTechnologyDecisionContract(taskId);
    ctx.first_principles_frame = makeFirstPrinciplesFrame(taskId);
    await harness.taskContext.save(ctx);
    return ctx;
}
//# sourceMappingURL=workshop_helpers.js.map