"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PULL_REQUEST_REVIEW_NECESSITY_SYSTEM_PROMPT_NAMES = exports.WORKFLOW_PLAN_REVIEW_SYSTEM_PROMPT_NAMES = exports.FOLLOWUP_PROPOSAL_REVIEW_SYSTEM_PROMPT_NAMES = exports.WORKFLOW_OPTIONS_SYSTEM_PROMPT_NAMES = exports.EVENT_HOOK_CREATE_SYSTEM_PROMPT_NAMES = exports.WORKFLOW_TEMPLATE_AUTHORING_SYSTEM_PROMPT_NAMES = exports.ISSUE_DRAFT_SYSTEM_PROMPT_NAMES = exports.CONTINUATION_ISSUE_SYSTEM_PROMPT_NAMES = exports.WORKER_COMMON_SYSTEM_PROMPT_NAMES = void 0;
exports.resolveWorkerRunSystemPromptNames = resolveWorkerRunSystemPromptNames;
exports.resolveWorkflowContextSystemPromptNames = resolveWorkflowContextSystemPromptNames;
const types_1 = require("../system-prompts/types");
const types_2 = require("./types");
exports.WORKER_COMMON_SYSTEM_PROMPT_NAMES = [
    "worker-common",
];
exports.CONTINUATION_ISSUE_SYSTEM_PROMPT_NAMES = [
    "worker-common",
];
exports.ISSUE_DRAFT_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "workflow-common",
    "issue-create",
];
exports.WORKFLOW_TEMPLATE_AUTHORING_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "workflow-common",
    "workflow-create",
];
exports.EVENT_HOOK_CREATE_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "event-hook-create",
];
exports.WORKFLOW_OPTIONS_SYSTEM_PROMPT_NAMES = [
    "worker-common",
];
exports.FOLLOWUP_PROPOSAL_REVIEW_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "workflow-common",
    types_1.FOLLOWUP_RECOMMENDATION_GUIDANCE_SYSTEM_PROMPT_NAME,
];
exports.WORKFLOW_PLAN_REVIEW_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "workflow-common",
    "workflow-plan-review",
];
exports.PULL_REQUEST_REVIEW_NECESSITY_SYSTEM_PROMPT_NAMES = [
    "worker-common",
    "workflow-common",
    "pull-request-review-necessity",
];
function resolveWorkerRunSystemPromptNames(workflow) {
    return [
        ...exports.WORKER_COMMON_SYSTEM_PROMPT_NAMES,
        ...resolveWorkflowContextSystemPromptNames(workflow),
    ];
}
function resolveWorkflowContextSystemPromptNames(workflow) {
    if (workflow === null || workflow === undefined) {
        return [];
    }
    const names = ["workflow-common"];
    switch (workflow.mode) {
        case types_2.WORKER_RUN_MODES.workflowSelect:
            break;
        case types_2.WORKER_RUN_MODES.workflowPlan:
            names.push("workflow-planning", "human-handoff");
            break;
        case types_2.WORKER_RUN_MODES.workflowExecute:
            names.push("workflow-execution", "human-handoff");
            break;
        case types_2.WORKER_RUN_MODES.workflowReconcileStepBatch:
            names.push("workflow-execution", "human-handoff");
            break;
        case types_2.WORKER_RUN_MODES.workflowClosing:
            names.push("workflow-execution", "human-handoff");
            maybeAddFollowupRecommendationGuidancePrompt(names, workflow);
            break;
    }
    if (workflow.mergeContext !== undefined && workflow.mergeContext !== null) {
        names.push("merge-guidance");
    }
    return names;
}
function maybeAddFollowupRecommendationGuidancePrompt(names, workflow) {
    if (workflow.state?.followup?.proposalPolicy !== "off") {
        names.push(types_1.FOLLOWUP_RECOMMENDATION_GUIDANCE_SYSTEM_PROMPT_NAME);
    }
}
