UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

37 lines • 1.96 kB
/** What a built-in file operation is about to do with a path. */ export type FilesystemOperation = "read" | "enumerate" | "write"; export interface FilesystemPolicyRequest { operation: FilesystemOperation; canonicalPath: string; toolName: string; } /** A filesystem policy must explicitly allow or deny each request. */ export type FilesystemPolicyDecision = { allow: true; } | { allow: false; reason: string; }; /** One registered filesystem access policy. `deniedRoots` is metadata; callers enforce `check`. */ export interface FilesystemPolicy { check(request: Readonly<FilesystemPolicyRequest>): FilesystemPolicyDecision | Promise<FilesystemPolicyDecision>; deniedRoots?: readonly string[]; } /** Composed deny-wins checker. */ export type FilesystemPolicyChecker = (request: Readonly<FilesystemPolicyRequest>) => Promise<FilesystemPolicyDecision>; /** * Resolve a filesystem target through existing symlinks. Missing descendants * are appended to the nearest existing real parent so new write targets still * receive a stable canonical path. * * The answer feeds extension containment decisions, so it comes from real `realpath` traversal: * that is what supplies the on-disk case of a case-insensitive name, applies `..` the way the * following I/O will, and fails closed on EACCES/EIO/ELOOP instead of guessing. Because this runs * before every read/ls/grep/find/edit/write and `realpath` never returns on a wedged mount, the * traversal is bounded by a deadline; past it the open(2)-free walker answers instead, which still * refuses to guess past a non-missing error. */ export declare function canonicalizeFilesystemPath(filePath: string): Promise<string>; /** Compose extension policies in registration order. The first denial wins. */ export declare function composeFilesystemPolicies(policies: readonly FilesystemPolicy[]): FilesystemPolicyChecker | undefined; //# sourceMappingURL=filesystem.d.ts.map