"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TASK_VALIDATION_UNRECORDABLE_RECOVERY_ID = void 0;
exports.createTaskValidationUnrecordableRecoveryAction = createTaskValidationUnrecordableRecoveryAction;
exports.createTaskValidationEnvironmentRecoveryAction = createTaskValidationEnvironmentRecoveryAction;
exports.createTaskChronologyRecoveryAction = createTaskChronologyRecoveryAction;
const errors_1 = require("../errors");
exports.TASK_VALIDATION_UNRECORDABLE_RECOVERY_ID = 'recovery.validation.unrecordable-execution';
function createTaskValidationUnrecordableRecoveryAction() {
    return (0, errors_1.createNonCallableRecoveryAction)({
        id: exports.TASK_VALIDATION_UNRECORDABLE_RECOVERY_ID,
        command: 'resume run resume',
        explanation: 'Inspect the immutable command execution evidence and select an audited attempt or task-pair recovery without rerunning the exact argv.',
        reason: 'The validation-set boundary cannot infer whether pair restoration, attempt supersession, or another authorized recovery is valid for the changed repository state.',
        expectedPostcondition: 'The completed execution remains preserved while recovery is selected without treating it as recorded validation evidence.',
    });
}
function createTaskValidationEnvironmentRecoveryAction(failure) {
    const [action] = (0, errors_1.createEnvironmentExecutionError)(failure).recoveryActions;
    return action;
}
function createTaskChronologyRecoveryAction(options) {
    return (0, errors_1.createDescriptorBackedRecoveryAction)({
        command: 'task attempt-chronology-recover',
        argv: [
            'day-shift', 'task', 'attempt-chronology-recover',
            '--chronology-run-directory', options.runDirectory,
            '--task-definition', options.taskDefinitionPath,
            '--attempt-id', options.attemptId,
            '--task-revision', options.taskRevision,
            '--recorded-by', options.recordedBy,
            '--recorded-at', options.recordedAt,
            '--reason', options.reason,
            '--dry-run',
        ],
        explanation: 'Preview the evidence-preserving invalid_chronology transition against the exact current task, attempt, and immutable source run.',
        selectedArtifactPath: options.taskDefinitionPath,
    });
}
