/**
 * Approval-surface helpers.
 *
 * Approval gating is a runtime-owned concern: headful surfaces may prompt,
 * headless surfaces must deterministically allow or deny.
 */
/** Determines whether the current execution context can display approval UI. */
export function getApprovalSurface(ctx) {
    return ctx?.hasUI ? 'headful' : 'headless';
}
/** Resolves an approval-gated execution request into allow, prompt, or deny. */
export function resolveApprovalExecutionDecision(input) {
    if (input.isSafe) {
        return 'allow';
    }
    if (input.surface === 'headless') {
        if (input.allowHeadlessApproval !== true) {
            return 'deny';
        }
        return !input.alwaysRequireExplicitApproval && input.isAutoApproved ? 'allow' : 'deny';
    }
    if (input.gateAvailable === false) {
        return 'deny';
    }
    if (!input.alwaysRequireExplicitApproval && input.isAutoApproved) {
        return 'allow';
    }
    return 'prompt';
}
//# sourceMappingURL=approval-surface.js.map