"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ISSUE_LOG_TEXT = void 0;
exports.formatLogRunStartHeading = formatLogRunStartHeading;
exports.formatLogList = formatLogList;
exports.formatLogNullable = formatLogNullable;
exports.formatLogBoolean = formatLogBoolean;
exports.formatLogWorkflowPresence = formatLogWorkflowPresence;
exports.issueLogSection = issueLogSection;
exports.issueLogField = issueLogField;
exports.ISSUE_LOG_TEXT = {
    none: "(none)",
    yes: "yes",
    no: "no",
    workflowPresent: "present",
    workflowAbsent: "absent",
    unlockExplicitRelease: "The unlock command requested ownership release and returned the issue to AI: Ready.",
    runStart: {
        timestamp: "timestamp",
        runKind: "run kind",
        issueId: "issue id",
        issueDisplayId: "issue display id",
        issueUrl: "issue url",
        issueTitle: "issue title",
        currentLabels: "current labels",
    },
    section: {
        unlockReason: "unlock reason",
        resolvedTransition: "resolved transition",
        finalLabelsCloseResult: "final labels / close result",
        freshnessRefresh: "freshness refresh",
        workerDeferred: "worker deferred",
        networkRecoveryScheduled: "network recovery scheduled",
        networkRecoveryEscalated: "network recovery escalated",
        finalSummary: "final summary",
        freshnessRerun: "freshness rerun",
        failureDetails: "failure details",
        claimIssue: "claim issue",
        workerStart: "worker start",
        workspaceSetup: "workspace setup",
        workerStdout: "worker stdout",
        workerStderr: "worker stderr",
        workerRepairRetry: "worker repair retry",
        resolvedSignIn: "resolved sign-in",
        parsedDecision: "parsed decision",
        preflightResolution: "setup issue",
        publishAborted: "publish aborted",
        interruptReason: "interrupt reason",
        plannedEffects: "planned effects",
        effectResult: "effect result",
        effectFailure: "effect failure",
    },
    field: {
        pr: "PR",
        from: "from",
        requestedOutcome: "requested outcome",
        finalOutcome: "final outcome",
        to: "to",
        branchAheadOfBase: "branch ahead of base",
        openPrExists: "open PR exists",
        note: "note",
        workflow: "workflow",
        closed: "closed",
        deferredReason: "deferred reason",
        triedSignIns: "tried sign-ins",
        cooldownUntil: "cooldown until",
        headline: "headline",
        outcome: "outcome",
        issueUrl: "issue url",
        commentUrl: "comment url",
        nextStep: "next step",
        interruptReason: "interrupt reason",
        workflowBeforeUnlock: "workflow before unlock",
        workflowAfterClaim: "workflow after claim",
        mode: "mode",
        template: "template",
        workspace: "workspace",
        branch: "branch",
        workspaceHead: "workspace HEAD",
        expectedCommit: "expected commit",
        expectedCommitKind: "expected commit kind",
        freshnessVerified: "freshness verified",
        commentCount: "comment count",
        consecutiveAiRunsBeforeWorker: "run count before worker",
        totalAiRunHoursBeforeWorker: "run hours before worker",
        worker: "worker",
        signIn: "sign-in",
        summary: "summary",
        comment: "comment",
        stepIds: "step ids",
        stepResults: "step results",
        repairAttemptCount: "repair attempt count",
        repaired: "repaired",
        repairKind: "repair kind",
        repairResult: "repair result",
        repairTrace: "repair trace",
        effect: "effect",
        source: "source",
        pass: "pass",
        issueOpen: "issue open",
        cursor: "cursor",
        currentConsecutiveAiRuns: "current run count",
        currentTotalAiRunHours: "current run hours",
        reason: "reason",
        cursorBefore: "cursor before",
        cursorAfter: "cursor after",
        claimedWorkflow: "claimed workflow",
        currentWorkflow: "current workflow",
        attemptCount: "attempt count",
        retryAt: "retry at",
        lastError: "last error",
        error: "error",
        warning: "warning",
        command: "command",
        args: "args",
        cwd: "cwd",
        stdout: "stdout",
        stderr: "stderr",
    },
};
function formatLogRunStartHeading(timestamp) {
    return `=== run start ${timestamp} ===`;
}
function formatLogList(values) {
    return values.length > 0 ? values.join(", ") : exports.ISSUE_LOG_TEXT.none;
}
function formatLogNullable(value) {
    return value ?? exports.ISSUE_LOG_TEXT.none;
}
function formatLogBoolean(value) {
    return value ? exports.ISSUE_LOG_TEXT.yes : exports.ISSUE_LOG_TEXT.no;
}
function formatLogWorkflowPresence(value) {
    return value ? exports.ISSUE_LOG_TEXT.workflowPresent : exports.ISSUE_LOG_TEXT.workflowAbsent;
}
function issueLogSection(key) {
    return exports.ISSUE_LOG_TEXT.section[key];
}
function issueLogField(key, value) {
    return `${exports.ISSUE_LOG_TEXT.field[key]}: ${value}`;
}
