@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
37 lines • 2.13 kB
TypeScript
import type { ResourceDiagnostic } from "./diagnostics.ts";
export interface SkillProvenance {
readonly kind: "user" | "project-auto" | "project-selected";
/** Kept as selected, before dereferencing a root link. */
readonly selectedRoot: string;
readonly projectRoot?: string;
}
export interface SkillAllowedSet {
readonly roots: readonly string[];
readonly files: readonly string[];
readonly digest: string;
}
export declare const EMPTY_SKILL_ALLOWED_SET: SkillAllowedSet;
export declare function skillProjectRoot(cwd: string): string;
export declare function insideSkillRoot(path: string, root: string): boolean;
export declare function buildSkillAllowedSet(sources: readonly string[]): SkillAllowedSet;
export declare class BlockedSkillLinkError extends Error {
readonly diagnostic: ResourceDiagnostic;
constructor(path: string, target: string);
}
export declare function authorizeSkillPath(path: string, provenance: SkillProvenance | undefined, allowed?: SkillAllowedSet, directory?: boolean): string;
/**
* All project skill bytes use this descriptor read. Inode rechecking catches
* some concurrent swaps, not ancestor replacement after canonicalization.
* The guarantee is for the design's unchanged-filesystem threat model.
*/
export declare function readSkillFileCheckedSync(path: string, provenance?: SkillProvenance, allowed?: SkillAllowedSet): string;
/**
* The session-path read: the same descriptor read as `readSkillFileCheckedSync`, without blocking the loop.
* The awaits between the identity pin and the open widen the swap window, so nothing after the pin trusts
* the path again: O_NOFOLLOW refuses a swapped-in link, the opened handle must match the pinned dev/ino,
* and the bytes are read from that handle (senpi#3796).
* As in the sync read, ancestor-directory replacement after canonicalization is out of scope:
* the guarantee assumes the design's unchanged-filesystem threat model.
*/
export declare function readSkillFileChecked(path: string, provenance?: SkillProvenance, allowed?: SkillAllowedSet): Promise<string>;
//# sourceMappingURL=skill-access.d.ts.map