/**
 * Categories that cause code execution / forge writes. They default to disabled
 * AND to confirm mode; silent execution requires an explicit opt-in (with a
 * warning surfaced in the UI).
 */
export const REMOTE_CONTROL_HIGH_RISK_CATEGORIES = ["start-runs", "open-prs"];
/**
 * Resolves what to do with a verified remote command of the given category,
 * given its stored policy row (or undefined when no row exists). Fail-closed:
 * a missing or disabled row denies; an enabled confirm-mode row requires local
 * confirmation; only an enabled silent row executes.
 */
export function resolveRemoteControlDecision(_category, row) {
    if (!row || !row.enabled) {
        return { outcome: "denied", reasonCode: "category_not_enabled" };
    }
    return row.riskMode === "silent"
        ? { outcome: "execute" }
        : { outcome: "confirm-required" };
}
/**
 * The system-default policy for a category before any user override: every
 * category disabled; low-risk categories default to silent-once-enabled,
 * high-risk default to confirm-once-enabled. Used to seed the Settings UI.
 */
export function defaultRiskModeFor(category) {
    return REMOTE_CONTROL_HIGH_RISK_CATEGORIES.includes(category)
        ? "confirm"
        : "silent";
}
