/** * Approval decisions that persist and generalize, the rule side. * * An approval prompt can offer remember tiers beyond "this session": * - 'exact' , this exact command (exec) * - 'command-class', this command class, e.g. every `git ...` (exec) * - 'path' , edits/writes under the asked path's directory * - 'tool' , always allow/deny this tool in this project * - 'session' , the classic in-memory session cache only * * A tiered decision becomes a durable user-origin PolicyRule (the same shape * evaluateRuntimePolicy consults), stored per project. The session approval * map is a cache over these rules. The tier options ride on the broker's ask * payload so ANY surface can offer them. */ import type { PolicyRule } from '../runtime/permissions/types.js'; /** How far a remembered approval decision reaches. */ export type RememberTier = 'session' | 'exact' | 'command-class' | 'path' | 'tool'; /** One offerable remember tier, rendered by whatever surface shows the ask. */ export interface RememberTierOption { readonly tier: RememberTier; /** Human-readable option label, e.g. `Always allow git commands`. */ readonly label: string; /** What the resulting durable rule will match, stated concretely. */ readonly detail: string; } /** First whitespace token of a command, its class (git, npm, bun, ...). */ export declare function commandClassOf(command: string): string; /** * The remember tiers that make sense for this call, most specific first. * 'session' is always offered; surfaces may also offer plain one-time * approve/deny (a decision with no remember at all). */ export declare function buildRememberOptions(toolName: string, args: Record): RememberTierOption[]; /** * Build the durable user-origin rule a tiered decision persists. * Returns null for 'session' (cache-only) or when the tier cannot be * derived from the call's arguments (e.g. 'path' with no path args). */ export declare function buildDurableRuleForDecision(input: { readonly toolName: string; readonly args: Record; readonly tier: RememberTier; readonly effect: 'allow' | 'deny'; readonly now?: number | undefined; }): PolicyRule | null; export interface DurableRuleMatch { readonly effect: 'allow' | 'deny'; readonly ruleId: string; } /** * First-match-wins evaluation of durable user rules against a call, the * lightweight matcher behind the session-cache layer (it must work with the * policy engine flag on OR off, so it does not go through the full layered * evaluator). */ export declare function matchDurableRules(rules: readonly PolicyRule[], toolName: string, args: Record, options?: { readonly projectRoot?: string | undefined; }): DurableRuleMatch | null; //# sourceMappingURL=approval-rules.d.ts.map