@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
33 lines • 1.62 kB
TypeScript
/**
* `read_project_file` / `write_project_file`: read and edit the session workspace's instruction files over RPC, so a
* client with no filesystem access to the machine (a remote desktop) edits Rules the way a local one does.
*
* Reading runs nothing, so trust does not gate it; a write passes the per-write gates of `project-write-gate.ts` (trust
* as it stands at commit, and this machine's own edit permission for that path), like the folder MCP and skill-file
* writes. Every write names the version it replaces (`ifEtag`, `null` to create), is refused as a
* conflict carrying the current etag when the file moved on, and lands by temp file + rename so a reader never sees a
* half-written file. Writes to one file are serialized inside the engine.
*/
import type { AgentSession } from "../../core/agent-session.ts";
export interface RpcProjectFile {
cwd: string;
/** The canonical workspace-relative path. */
path: string;
exists: boolean;
content: string | null;
/** Opaque version of the stored bytes; compare it, never parse it. */
etag: string | null;
projectTrusted: boolean;
}
export type ProjectFileResult = {
ok: true;
data: RpcProjectFile;
} | {
ok: false;
message: string;
errorCode: string;
errorData?: Record<string, unknown>;
};
export declare function readProjectFile(session: AgentSession, path: unknown): Promise<ProjectFileResult>;
export declare function writeProjectFile(session: AgentSession, path: unknown, content: unknown, ifEtag: unknown): Promise<ProjectFileResult>;
//# sourceMappingURL=project-file-commands.d.ts.map