UNPKG

@code-yeongyu/senpi

Version:

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

36 lines • 2.46 kB
import type { MoveLedger } from "../../core/session-move/move-ledger.ts"; import type { RpcCommand, RpcResponse } from "./rpc-types.ts"; import type { MoveRequest } from "./session-move-request.ts"; import type { RpcMoveImportData, RpcMoveImportOpen, RpcMoveOpenError } from "./session-move-wire.ts"; import type { OpenReplyAs } from "./session-router-open-result.ts"; export interface MoveImportPort { /** This host's agent directory: the move folders live under `<agentDir>/session-moves`. */ readonly agentDir: string; /** * The open an `import` asks for with `open`: what an `open_session` for the landed file from the importing * connection would do. On success the open queues `reply` as the import's answer, with the open's data beside it, * and resolves `undefined`; otherwise it resolves the open's failure response and queues nothing. */ open(command: Extract<RpcCommand, { type: "open_session"; }>, reply: OpenReplyAs): Promise<RpcResponse | undefined>; } /** * Why a `sessionDir` cannot hold the session: a file is in its place or above it, this host could not look at it (no * permission, a symlink loop), or it is a folder this host may not write into. A request error, asked before the * import touches the move, so the move stays importable. `undefined` for a folder this host can write into and for a * path that is not there yet (ENOENT), which the import creates. */ export declare function sessionDirRefusal(sessionDir: string | undefined): Promise<string | undefined>; /** An inline bundle is staged in this host's own folder under `root`, then read exactly as a folder is. */ export declare function importMoved(parsed: Extract<MoveRequest, { op: "import"; }>, port: MoveImportPort, ledger: MoveLedger, root: string): Promise<RpcMoveImportData>; /** * Opens the session an import landed, in the folder the import named (`cwd`): an open that names no folder runs in * the host's own, whatever the landed file's header says (senpi#6427). `undefined` means the open queued the import's * answer itself; otherwise the open failed, which never undoes the import: the move stands, and the caller opens the * session with `open_session`. */ export declare function openLanded(port: MoveImportPort, id: string | undefined, open: true | RpcMoveImportOpen, cwd: string, landed: RpcMoveImportData): Promise<RpcMoveOpenError | undefined>; //# sourceMappingURL=session-move-import.d.ts.map