@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
35 lines • 2.09 kB
TypeScript
/**
* Which workspace files `read_project_file` / `write_project_file` may touch, and where they resolve on disk.
*
* The allowlist is the project files the engine itself reads: `AGENTS.md` / `CLAUDE.md` at the workspace root or
* in any folder below it, anything under `.omo/rules/`, and the folder's OmO config `.omo/omo.jsonc` (per-agent and
* per-category model routing; at the workspace root only, where OmO reads it). A path is relative, `/`-separated and canonical (no empty,
* `.` or `..` segment), and never passes through `.git` or `node_modules`. Resolution walks the path one segment at a
* time with `lstat` from the real workspace root and refuses any symlink or non-folder on the way, so neither a
* traversal nor a link can reach a file outside the workspace.
*/
/** Under the host's 1,000,000-character message limit, so an oversized write reaches this typed refusal. */
export declare const PROJECT_FILE_MAX_BYTES: number;
/** `O_NOFOLLOW` where the platform has it, so a link swapped in after resolution still fails the open. */
export declare const NO_FOLLOW: number;
export interface ProjectFilePath {
readonly relative: string;
readonly segments: readonly string[];
}
export declare function parseProjectFilePath(input: string): ProjectFilePath | undefined;
export type ResolvedProjectFile = {
readonly ok: true;
readonly absolute: string;
readonly exists: boolean;
readonly missingFolders: readonly string[];
} | {
readonly ok: false;
};
/** Resolves `file` inside the real workspace root; `missingFolders` are the parent folders a write must create. */
export declare function resolveProjectFile(cwd: string, file: ProjectFilePath): Promise<ResolvedProjectFile>;
/**
* Creates the missing parent folders one at a time; a non-recursive `mkdir` fails on anything that appeared in the
* meantime, and each new folder is re-checked as a real folder before the next one is made inside it.
*/
export declare function createMissingFolders(folders: readonly string[]): Promise<boolean>;
//# sourceMappingURL=project-file-path.d.ts.map