UNPKG

@code-yeongyu/senpi

Version:

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

65 lines • 3.97 kB
/** * The durable steps of a session move on one device, in order (senpi#4004). Each row says what is on disk and what the * receiver's move record says right after that step, and what a crash there (the process dies) or a throw there (the * step's caller sees an error) must leave. Three rules hold after every row: * - at most one copy of the session is writable, across the sender's file and every receiver folder; * - the move record agrees with the files: `status` answers what the files prove, never a stale or contradicting state; * - a revoke mark, once the copy is sealed, is never lost. * * The code calls `moveStep(row.step)` right after each durable step; a test sets a hook there to stand for a crash or * a throw, and `rpc-move-session-steps.test.ts` drives one injection per row. Unset outside tests, so a no-op. */ export declare const MOVE_STEPS: readonly [{ readonly step: "import:received"; readonly flow: "import"; readonly disk: "the bundle is verified; nothing has landed in the session folder"; readonly record: "receiving, with the landing target recorded"; readonly after: "nothing landed: status answers receiving; an import into the same folder lands it, any other folder is fenced"; }, { readonly step: "import:stamped"; readonly flow: "import"; readonly disk: "nothing has landed yet; the staged copy is ready"; readonly record: "receiving, target recorded, stamped committing"; readonly after: "a move lands once, so every import is fenced; status checks the target: no file there means receiving while the stamp is young (a stalled commit may still land it) and failed after that (the sender takes the session back)"; }, { readonly step: "import:renamed"; readonly flow: "import"; readonly disk: "the copy landed at the target, writable, recording session_moved_in"; readonly record: "still receiving and stamped committing"; readonly after: "status and a same-file import confirm the landed file (accepted); a failure here never records failed; any other folder is fenced"; }, { readonly step: "import:accepted"; readonly flow: "import"; readonly disk: "the copy landed at the target"; readonly record: "accepted, target recorded (final)"; readonly after: "the import is done; a crash or throw after it changes nothing"; }, { readonly step: "revoke:sealed"; readonly flow: "revoke"; readonly disk: "the receiver's copy records session_moved reason revoked: read-only"; readonly record: "accepted, not yet marked revoked"; readonly after: "status reads the sealed file and answers revoked, writing the mark; a repeated revoke writes it too; never plain accepted"; }, { readonly step: "revoke:marked"; readonly flow: "revoke"; readonly disk: "the receiver's copy is sealed"; readonly record: "accepted and revoked"; readonly after: "the revoke is done"; }, { readonly step: "finish:recorded"; readonly flow: "finish"; readonly disk: "the sender's file records session_moved (moved) or session_reclaimed (taken back); its bundle is kept"; readonly record: "unchanged (the sender's side)"; readonly after: "a repeated finish re-queues the dropped input once (stable ids) and then removes the bundle"; }, { readonly step: "finish:requeued"; readonly flow: "finish"; readonly disk: "the dropped input is queued again on a taken-back file; the bundle is still there"; readonly record: "unchanged (the sender's side)"; readonly after: "a repeated finish finds the input already queued and removes the bundle"; }]; export type MoveStep = (typeof MOVE_STEPS)[number]["step"]; /** Test seam: the hook runs right after each durable step; throwing from it stands for a crash or a throw there. */ export declare function setMoveStepHook(next: ((step: MoveStep) => void) | undefined): void; export declare function moveStep(step: MoveStep): void; //# sourceMappingURL=move-steps.d.ts.map