UNPKG

@code-yeongyu/senpi

Version:

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

28 lines • 1.01 kB
function assertNever(value) { throw new Error(`unexpected recovery failure: ${JSON.stringify(value)}`); } export function refusalReason(failure) { switch (failure.kind) { case "storage_unavailable": return failure.kind; case "repair_needed": return failure.reason; default: return assertNever(failure); } } export const recovered = (value) => ({ ok: true, value }); export const repairNeeded = (reason) => ({ kind: "repair_needed", reason }); export const storageUnavailable = (reason) => ({ kind: "storage_unavailable", reason, }); /** Thrown inside a token's operation lease when the cut stopped being valid; mapped to its failure by the owner. */ export class RecoveryRefusedError extends Error { constructor(failure) { super(`recovery refused (${failure.kind}: ${failure.reason})`); this.name = "RecoveryRefusedError"; this.failure = failure; } } //# sourceMappingURL=compact-recovery-types.js.map