@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
44 lines • 1.93 kB
TypeScript
/**
* A move record as the receiving device keeps it and as a sender hears it: its states and reasons, the parser that
* reads one back from the record file or from a sender's `finish`, and the refusal a move gets once its record no
* longer lets it land.
*/
import type { MoveId } from "./ownership.ts";
export type DeclineReason = "no_record" | "expired" | "cancelled" | "chunk_without_ready" | "repository";
export type FailReason = "bundle_invalid" | "import_failed";
/** The answers a sender can hear. */
export type MoveStatus = {
readonly state: "receiving";
} | {
readonly state: "accepted";
} | {
readonly state: "declined";
readonly reason: DeclineReason;
} | {
readonly state: "failed";
readonly reason: FailReason;
};
/**
* A status answer as the sender hears it. `revoked` marks an accepted import the receiver later sealed with `revoke`:
* the record stays `accepted` (final), but the receiver's copy is read-only, so the sender must take the session back.
*/
export type MoveAnswer = MoveStatus | {
readonly state: "accepted";
readonly revoked: true;
};
/** `ready`: this device told the sender it can take the move; no bundle has been verified yet. */
export type MoveRecord = MoveAnswer | {
readonly state: "ready";
readonly expiresAt: string;
};
export declare class MoveFencedError extends Error {
readonly code = "move_fenced";
readonly moveId: MoveId;
readonly record: MoveRecord | undefined;
constructor(moveId: MoveId, record: MoveRecord | undefined, detail?: string);
}
/** A receiver's answer as it arrives back at the sender; a `ready` record is not an answer. */
export declare function parseMoveStatus(value: unknown): MoveAnswer | undefined;
/** A record as it was written; `undefined` when the value is not one. */
export declare function parseRecord(value: unknown): MoveRecord | undefined;
//# sourceMappingURL=move-record.d.ts.map