/**
 * Permission-rule parsing for the settings.json `permissions` block.
 *
 * The schema is CC-compatible:
 *
 *   {
 *     "permissions": {
 *       "allow": ["Edit(src/**)"],
 *       "deny":  ["*(~/.ssh/**)", "Read(./.env)"],
 *       "ask":   []
 *     }
 *   }
 *
 * Each entry is a `Tool(pattern)` or `*(pattern)` string. OwlCoda adds the
 * `*(pattern)` sugar which CC does not have; everything else matches CC
 * verbatim.
 *
 * `Bash(...)` rules PARSE but are NOT ENFORCED in v1 — they emit a load-time
 * warning so users who paste a CC `settings.json` know what's been skipped.
 * `ask:` rules are stored as deny + warning (no interactive approval path
 * in v1). Bare strings (no `Tool(...)` wrapper) are rejected at parse time
 * so the grammar stays unambiguous.
 *
 * See spec §17 for the full enforcement matrix.
 */
import type { ProvenanceRecord } from './protocol/write-provenance-types.js';
import type { PermissionRule, PermissionWarning, ResolvedPermissions } from './protocol/permission-rule-types.js';
/**
 * Result of parsing a single rule string. `rule` is present when parsing
 * produced a usable record (even with caveats — eg. Bash rules return a
 * rule with `enforced=false`). `warnings` lists every concern that
 * downstream telemetry should surface. An entirely unparseable input
 * returns `rule: undefined` plus at least one warning.
 */
export interface ParsePermissionRuleResult {
    rule?: PermissionRule;
    warnings: PermissionWarning[];
}
/**
 * Parse one entry from a `permissions.{allow,deny,ask}` array.
 *
 * Grammar:
 *   ToolName ::= [A-Za-z][A-Za-z]* | "*"
 *   Pattern  ::= any chars (trimmed of surrounding whitespace)
 *   Rule     ::= ToolName "(" Pattern ")"
 *
 * `effect` is the section the rule was found under. `ask` collapses to
 * `deny` here so downstream code can treat all enforced effects as one of
 * the two `PermissionEffect` values; the collapse is logged.
 */
export declare function parsePermissionRule(raw: string, effect: 'allow' | 'deny' | 'ask'): ParsePermissionRuleResult;
/**
 * Test whether a canonical absolute path matches a user-written rule
 * pattern. Empty pattern or empty path returns false.
 *
 * `projectRoot` resolves relative patterns; `homeDir` expands `~/`. Both
 * should be canonical (callers pass `taskState.contract.cwd` etc).
 */
export declare function matchRulePattern(pattern: string, canonicalPath: string, projectRoot: string, homeDir: string): boolean;
export interface LoadPermissionsOptions {
    /** Project root for relative-pattern resolution. Required. */
    projectRoot: string;
    /** Home directory for `~/` expansion. Defaults to `os.homedir()`. */
    homeDir?: string;
    /** OwlCoda home for user-level settings. Defaults to `$OWLCODA_HOME` or `~/.owlcoda`. */
    owlcodaHome?: string;
}
/**
 * Load and merge permission rules from the three settings.json files.
 *
 * The returned `allow` / `deny` / `ask` arrays carry rules in
 * (user → project → local) order. `warnings` includes every parse warning
 * AND every layer-load error encountered. `ask` rules collapse to `deny`
 * inside this function (carrying their warning) — so consumers can iterate
 * `result.deny` alone to find all denies.
 */
export declare function loadResolvedPermissions(opts: LoadPermissionsOptions): ResolvedPermissions;
export interface CompileRulesResult {
    pathRecords: ProvenanceRecord[];
}
export interface CompileRulesOptions {
    /** Synthetic record timestamp. Defaults to -Infinity (oldest possible). */
    ts?: number;
}
/**
 * Compile rules into synthetic provenance records for the given target.
 *
 * Caller passes the canonical write-target path (already through
 * `canonicalizeProvenancePath`) and the tool name from the live tool call.
 * Returns one synthetic record per matching enforced rule. The caller
 * (`evaluateWriteTargetProvenance` after PERM-6) feeds these into
 * `evaluateAdmission`'s synthetic-record channel.
 */
export declare function compileRulesForTarget(rules: ResolvedPermissions, toolName: string, canonicalPath: string, projectRoot: string, homeDir: string, opts?: CompileRulesOptions): CompileRulesResult;
