/** * Cache key for a recursive search rooted at `directoryKey`. Such a search reads below subfolders, * which a folder grant does not cover, so it carries an opaque key of its own: only a grant the user * recorded for that same tree silences it, and a grant on the folder never does by accident. */ export declare function approvalTreeSearchKey(directoryKey: string): string; /** The folder key a tree key was minted from, or `undefined` when the key is not a tree key. */ export declare function approvalTreeSearchFolderKey(key: string): string | undefined; /** Whether a readable URL's host is public, so Ask and remember can leave it ungated. */ export declare function isApprovalPublicUrl(url: string): boolean; /** * Whether an exact grant target names a file rather than a directory or a * non-filesystem target (an internal or web URL) — the file-flavoured answer is * only named for a file. A path nothing occupies yet still counts as a file: * approving a write is how its file comes to exist. */ export declare function approvalTargetNamesFile(target: string): boolean; /** * Normalize one tool argument into an approval-cache key, or `undefined` when * the argument is empty. Unresolvable-but-non-empty targets fall back to their * trimmed text so a grant still sticks to the exact target that was approved. */ export declare function approvalTargetKey(cwd: string, target: string): string | undefined; /** What a folder grant on a directory reaches: its own entries, `limit` of them named. */ export interface ApprovalFolderListing { /** Entry names in sort order, a trailing slash marking a folder, `limit` of them at most. */ readonly entries: readonly string[]; /** Entries past `limit`, counted but not named. */ readonly rest: number; readonly folders: number; readonly files: number; readonly total: number; /** True when the scan stopped at its bound, so the counts are lower bounds. */ readonly truncated: boolean; } /** * The entries directly inside `directory`, as a folder grant covers them — one * level deep, since that is as far as a folder grant reaches — for the approval * prompt to show what it is about to allow. Directories are marked with a * trailing slash (they need their own approval). Reads asynchronously and stops * after {@link APPROVAL_FOLDER_SCAN_LIMIT} entries, so a big or slow folder * cannot block the event loop while the prompt is prepared. `undefined` when * `directory` is not a readable directory. */ export declare function approvalFolderListing(directory: string, limit: number): Promise;