"use strict";
// Permission outcome → trust-ladder feedback.
//
// Whenever the user resolves a permission prompt (or the engine grants/denies
// one automatically), the outcome flows here so the trust ladder learns
// without the user having to click promote/demote in the UI.
//
// Capability mapping is intentionally narrow: we use the tool name as the
// capability key. Callers may pass an explicit override.
Object.defineProperty(exports, "__esModule", { value: true });
exports.recordPermissionOutcome = recordPermissionOutcome;
const trustLadder_1 = require("./trustLadder");
async function recordPermissionOutcome(projectDir, toolName, outcome, options = {}) {
    if (options.skip)
        return;
    const capability = options.capability ?? toolName;
    if (!capability)
        return;
    const snap = await (0, trustLadder_1.loadTrustLadder)(projectDir);
    (0, trustLadder_1.ensureCapability)(snap, capability);
    (0, trustLadder_1.recordOutcome)(snap, capability, outcome === 'allowed' ? 'accepted' : 'rejected');
    await (0, trustLadder_1.saveTrustLadder)(projectDir, snap);
}
//# sourceMappingURL=permissionFeedback.js.map