@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
29 lines • 1.77 kB
TypeScript
/**
* A project write may state the folder its caller means (`expectedCwd`). A client that reaches a session by a key that
* can since name another session (a remote desktop, through a relay) states it, so the write lands only in the project
* it means: when the session's working directory is another folder, the write is refused and nothing is written.
* Absent, the write goes as it always has.
*/
import { RPC_ERROR_INVALID_ARGUMENT, RPC_ERROR_PROJECT_CWD_MISMATCH } from "./rpc-error-types.ts";
/**
* A folder path for comparison. Trailing separators of the path's own style are dropped (only `/` for a POSIX path;
* `\\` or `/` for a drive or UNC path), but a bare POSIX or drive root keeps one: `"/"` stays `"/"`, and a bare drive
* root becomes `"X:\\"` (`"C:"`, `"C:/"` and `"c:\\"` all become `"C:\\"`). A Windows drive letter is compared
* without case (`c:` and `C:` are one drive). Nothing else is folded: the rest of the path is compared as written,
* because whether a file system ignores case depends on the volume and cannot be assumed; and nothing is trimmed,
* since on POSIX `"/w/app "` and `"/w/app\\"` are other directories.
*/
export declare function comparableFolder(path: string): string;
export interface CwdMismatch {
readonly message: string;
readonly errorCode: typeof RPC_ERROR_PROJECT_CWD_MISMATCH | typeof RPC_ERROR_INVALID_ARGUMENT;
}
/**
* The refusal of a project write whose stated folder is not the session's, or whose `expectedCwd` is present but not a
* string, or undefined when it may go.
*/
export declare function projectCwdMismatch(command: {
readonly type: string;
readonly expectedCwd?: unknown;
}, sessionCwd: string): CwdMismatch | undefined;
//# sourceMappingURL=project-expected-cwd.d.ts.map