UNPKG

@code-yeongyu/senpi

Version:

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

69 lines • 3.74 kB
export { hasTrustRequiringProjectResources, projectAgentsSkillDirs } from "./trust-requiring-resources.ts"; export type ProjectTrustDecision = boolean | null; export interface ProjectTrustStoreEntry { path: string; decision: boolean; } /** The nearest entry at or above a folder; `decision: null` is an explicit "no decision, none inherited" entry. */ export interface ProjectTrustNearestEntry { path: string; decision: ProjectTrustDecision; } export interface ProjectTrustUpdate { path: string; /** `null` removes the folder's entry; `"no_inherit"` saves an explicit `null` for it (see `findNearestTrustEntry`). */ decision: ProjectTrustDecision | "no_inherit"; } export interface ProjectTrustOption { label: string; trusted: boolean; updates: ProjectTrustUpdate[]; savedPath?: string; } export declare function getProjectTrustParentPath(cwd: string): string | undefined; export declare function getProjectTrustOptions(cwd: string, options?: { includeSessionOnly?: boolean; }): ProjectTrustOption[]; /** * `set_project_trust`'s `no_inherit`: no decision for the folder, and none inherited from a folder above it or, for a * linked worktree, from its main checkout, so the folder is decided as if nothing were saved (Full access trusts it, * a session that may ask asks). `/trust` never offers it. */ export declare function getProjectTrustNoInheritOption(cwd: string): ProjectTrustOption; export declare class ProjectTrustStore { private trustPath; /** Counts the writes made through `setMany`, by any process; bumped under the store lock. */ private generationPath; constructor(agentDir: string); /** * Changes on every write made through `setMany` by an engine that has this generation file, in any process or * engine copy: each such write bumps it under the store lock before it writes `trust.json`, so a value read * before the write never equals one read after it. Any other writer (an older engine sharing the agent * directory, another program editing `trust.json`) changes it only when it changes the file's modification * time or size. */ revision(): Promise<string>; private readGeneration; get(cwd: string): ProjectTrustDecision; /** The nearest saved decision at or above `cwd`; `null` also when the nearest entry holds no decision. */ getEntry(cwd: string): ProjectTrustStoreEntry | null; getNearestEntry(cwd: string): ProjectTrustNearestEntry | null; set(cwd: string, decision: ProjectTrustDecision): Promise<void>; setMany(decisions: ProjectTrustUpdate[]): Promise<void>; } /** * What is saved for a folder: a decision, `"no_inherit"` for the explicit no-decision entry * (`set_project_trust`'s `no_inherit`), or `null` when nothing is saved. The two undecided values stay * apart because only `null` may be filled in by an answer the process kept without saving it. */ export type SavedProjectTrust = boolean | "no_inherit" | null; /** * What is saved for `cwd`: the store's own entry (the folder or the nearest folder above it), and only * when it has none and `cwd` is inside a linked git worktree, the main checkout's entry for the * matching folder. An entry saved for the worktree or above it always wins, including the explicit * no-decision entry, which leaves the folder undecided. */ export declare function getSavedProjectTrustState(store: ProjectTrustStore, cwd: string): Promise<SavedProjectTrust>; /** The saved decision for `cwd` (`getSavedProjectTrustState`), with both undecided values as `null`. */ export declare function getSavedProjectTrust(store: ProjectTrustStore, cwd: string): Promise<ProjectTrustDecision>; //# sourceMappingURL=trust-manager.d.ts.map