@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
49 lines • 2.89 kB
TypeScript
import type { FrozenCheckpoint, RecoveryCheckpoints } from "./compact-recovery-state.ts";
import { type RecoveryOutcome } from "./compact-recovery-types.ts";
import type { LegacyReplayStore } from "./legacy-replay-store.ts";
import type { SessionAcceptanceLane } from "./session-acceptance-lane.ts";
import type { ResyncCut, ResyncReason } from "./socket-peer-recovery.ts";
import type { ShedMode } from "./socket-peer-shed.ts";
/**
* A lane-owned session pinned for one frozen view (R3.C1.5): the freeze outcome, so a view can tell a retired lane
* from unavailable storage, and the lane's epoch at the pin, the incarnation the view's liveness is bound to.
*/
export interface PinnedSession {
readonly sessionId: string;
readonly lane: SessionAcceptanceLane;
readonly sessionEpoch: string;
readonly outcome: RecoveryOutcome<FrozenCheckpoint>;
}
/** What the pins read of the fanout's peers: a registration's incarnation and the attach ordinals it holds. */
export interface RecoveryPeers {
socketEpoch(id: string): string | undefined;
/** Per attached session, the ordinal of the attach that holds it for `id`; undefined for an unknown peer. */
ordinals(id: string): ReadonlyMap<string, number> | undefined;
has(id: string, capability: string): boolean;
required?(id: string): readonly string[];
}
export declare const admissionOf: (ordinal: number) => string;
/**
* The checkpoints a host pins for its peers' legacy views (S08a producers): one per held lane-owned session on the
* admission (the attach ordinal) that holds it, and the shed's recovery cut read from them.
*/
export declare class SessionRecoveryPins {
private readonly acceptance;
private readonly checkpoints;
private readonly replay;
private readonly peers;
private readonly shedMode;
constructor(acceptance: ReadonlyMap<string, SessionAcceptanceLane>, checkpoints: RecoveryCheckpoints, replay: LegacyReplayStore, peers: RecoveryPeers, shedMode: ShedMode);
/** One freeze per held lane-owned session, on the admission (the attach ordinal) that holds it for `id`. */
pin(id: string, sessionIds: readonly string[]): readonly PinnedSession[];
unpin(pinned: readonly PinnedSession[]): void;
/** The admission holding `sessionId` for `id` ends (a detach): its route leaves its stream. */
retire(id: string, sessionId: string): void;
/**
* The shed's recovery: checkpoints frozen at the shed, before the actor awaits its drain (R3.C1.5), as the next
* generation of each held admission; released when the recovery ends. The cut owns each root from the freeze to
* that end: a detach, re-attach or supersession before its gap is delivered retires the token, never the root.
*/
resync(id: string, reason: ResyncReason, carried?: readonly string[]): ResyncCut;
}
//# sourceMappingURL=session-recovery-pins.d.ts.map