const VALID_TASK_STATUSES = new Set([
    "Todo",
    "Waiting",
    "InProgress",
    "Review",
    "Done",
]);
const EXECUTION_TO_TASK_STATUS = {
    Done: "Done",
    Waiting: "Waiting",
    Unassigned: "Todo",
    AgentNotStarted: "Todo",
    WaitingForUser: "Todo",
    WaitingForDependency: "Todo",
    WaitingForCapacity: "Todo",
    WaitingForBudget: "Todo",
    Working: "InProgress",
    Questions: "InProgress",
    WaitingForApproval: "Review",
    WaitingForInput: "InProgress",
    WaitingForToolApproval: "InProgress",
    AgentError: "InProgress",
};
const TASK_STATUS_LABELS = {
    Todo: "Todo",
    Waiting: "Waiting",
    InProgress: "In Progress",
    Review: "Review",
    Done: "Done",
};
export function getTaskStatusLabel(status) {
    return TASK_STATUS_LABELS[status] || status;
}
export function normalizeTaskStatus(status, executionState) {
    if (status && VALID_TASK_STATUSES.has(status)) {
        return status;
    }
    if (status && EXECUTION_TO_TASK_STATUS[status]) {
        return EXECUTION_TO_TASK_STATUS[status];
    }
    if (executionState && EXECUTION_TO_TASK_STATUS[executionState]) {
        return EXECUTION_TO_TASK_STATUS[executionState];
    }
    return "Todo";
}
export function isWorkingExecutionState(executionState) {
    return executionState === "Working";
}
export function isTaskReviewExecutionState(executionState) {
    return executionState === "WaitingForApproval";
}
export function isQuestionnaireExecutionState(executionState) {
    return executionState === "Questions";
}
export function isToolApprovalExecutionState(executionState) {
    return executionState === "WaitingForToolApproval";
}
export function isBlockedExecutionState(executionState) {
    return executionState === "WaitingForDependency";
}
export function isErroredExecutionState(executionState) {
    return executionState === "AgentError";
}
export function getAttentionReasonForExecutionState(executionState) {
    switch (executionState) {
        case "WaitingForDependency":
            return "blocked";
        case "WaitingForApproval":
        case "WaitingForToolApproval":
            return "approval";
        case "Questions":
        case "WaitingForInput":
        case "WaitingForUser":
            return "input";
        case "WaitingForBudget":
            return "budget";
        case "AgentError":
            return "failed";
        default:
            return "none";
    }
}
//# sourceMappingURL=taskStatus.js.map