@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
31 lines • 1.76 kB
TypeScript
import type { MoveAnswer } from "./move-ledger.ts";
import { type MoveId } from "./ownership.ts";
export interface FinishMoveOptions {
readonly sessionFile: string;
/** The bundle this device kept while the move was open; it holds the input the release took out. */
readonly bundleDir: string;
/** The move the answer is about; the bundle and the file must be about the same move. */
readonly moveId: MoveId;
/** The receiver's signed answer. `receiving` changes nothing: the move is still open. */
readonly answer: MoveAnswer;
/** Runs inside the move lock before anything is read; throw to refuse. */
readonly guard?: () => void | Promise<void>;
}
export declare class MoveMismatchError extends Error {
readonly code = "move_mismatch";
constructor(expected: MoveId, found: string, what: string);
}
export declare class MoveAlreadyMovedError extends Error {
readonly code = "move_already_moved";
constructor(moveId: MoveId);
}
/**
* Closes a move on the sending device from the receiver's answer. `accepted` records `session_moved` (read-only for
* good). `declined`/`failed`, and `accepted` with `revoked` (the receiver sealed its copy), take the session back:
* `session_reclaimed` makes the file writable, the queued input is re-queued under ids stable per move, then the
* bundle goes. While the bundle exists the re-queue runs again on the next call, so a crash between any two steps
* loses nothing and doubles nothing. A revoked answer for a file already marked moved is refused.
*/
export declare function finishMove(options: FinishMoveOptions): Promise<void>;
export declare function requeueDroppedInput(sessionFile: string, bundleDir: string): Promise<void>;
//# sourceMappingURL=finish.d.ts.map