@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
46 lines • 2.85 kB
TypeScript
import type { MountSnapshot } from "./mount-table.ts";
/**
* Filesystem types whose names a positive confirmation may trust: the design's measured allowlist. On
* these, a path whose every component its parent lists verbatim is the spelling native realpath returns
* (case folding, per-directory included, only resolves spellings the parent does not list). Every other
* type (devfs, fuse*, autofs, proc, SMB, unmeasured local types) stays alias-bearing.
*/
export declare const REAL_FS: ReadonlySet<string>;
export declare const DETECTOR_MAX_READDIR = 256;
export declare const DETECTOR_MAX_ENTRIES = 5000;
/** Mount points that are aliases of the darwin Data volume: the Data mount and every mount of its device. */
export declare function mountAliasRoots(snapshot: MountSnapshot, platform?: string): string[];
/** The darwin firmlink entries (`/<entry>` lives on `/System/Volumes/Data/<entry>`); empty elsewhere. */
export declare function readFirmlinks(platform?: string): string[];
/** Lexical firmlink rewrite: `/<entry>/...` -> `/System/Volumes/Data/<entry>/...`. */
export declare function createMountRewrite(firmlinks: readonly string[]): (value: string) => string;
/** The longest mount point that is a lexical prefix of the (rewritten) path; `unknown` while degraded. */
export declare function volumeKeyFor(snapshot: MountSnapshot | undefined, rewrite: (value: string) => string, value: string): string;
/**
* `reaches()` of design 6.5.1: the open-free walk of a rule prefix, mount-rewritten and folded like the
* request's canonical path, is a component prefix of (or equal to) it. Any walker error answers true:
* containment may only be over-inclusive.
*/
export declare function containsPrefix(rulePrefix: string, requestCanonical: string, rewrite: (value: string) => string, foldCase: boolean, walk?: (value: string) => string): boolean;
/** Design oracle (6.1.2): native realpath of the deepest existing ancestor plus the missing tail, dangling links followed. */
export declare function oracle(value: string): string;
export type Verdict = {
readonly alias: boolean;
readonly reasons: string[];
readonly readdirs: number;
};
export interface DetectorBudget {
readonly maxReaddir: number;
readonly maxEntries: number;
}
export interface DetectorIO {
readonly walk: (value: string) => string;
readonly readdir: (value: string) => string[];
readonly lstat: (value: string) => unknown;
}
/**
* The INVERTED alias detector (design 5.4): a path is "no alias" ONLY when every component is
* positively confirmed; anything unconfirmed, unrecognised, over budget or errored is "alias in play".
*/
export declare function createDetector(snapshot: MountSnapshot, budget?: DetectorBudget, io?: DetectorIO, platform?: string): (value: string) => Verdict;
//# sourceMappingURL=alias-detector.d.ts.map