@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
74 lines • 3.83 kB
TypeScript
import type { TranscriptTransition } from "../../core/session-transcript-journal.ts";
import type { CallIdentity } from "./compact-call-model.ts";
/**
* An accepted end's settled ids: the message's `messageId` and the end's accepted sequence. A pending or failed terminal
* pages them as the `message-<terminalSequence>` member; a joined message writes no terminal row and pages only its
* `join-<n>` member's `messageId`.
*/
export interface TerminalIdentity {
readonly messageId: string;
readonly terminalSequence: number;
}
/**
* RULING-120 (#5331): the ids the settled store records for one message, which a compact peer's own copy of the live
* record carries too: an accepted end's terminal ids, a failed write's `messageId`, an entry join's `owningMessageId`
* (the `messageId` of its `join-<n>` member). RULING-123 (#5346): a live call record's call, by its snapshot key.
*/
export type LiveIdentity = TerminalIdentity | {
readonly messageId: string;
} | {
readonly owningMessageId: string;
} | {
readonly ownerUnknown: true;
} | CallIdentity;
/** An end the settled store accepted: whether it joined the message to its durable entry, and the ids it recorded. */
export interface SettledEnd {
readonly joined: boolean;
readonly identity: TerminalIdentity;
}
/**
* How many joined entries may wait for their `entry_appended` at once. Each normally arrives within a batch or two of
* its append, so this only bounds entries whose `entry_appended` the lane never folds; the oldest is dropped first.
*/
export declare const MAX_PENDING_JOINS = 1024;
/**
* RULING-122 (#5337): how many unvouched entry ids the epoch remembers, so their `entry_appended` says `ownerUnknown`
* instead of a false not-owned: an owned append whose join was dropped at `MAX_PENDING_JOINS`, or that the settled
* store never joined (its transcript unavailable, its join refused). Past this the epoch overflows and can no longer
* vouch for any entry it has no join for.
*/
export declare const MAX_EVICTED_JOINS = 4096;
/**
* One lane epoch's view of those ids for delivery: each joined entry's owning message, captured when its append is
* applied and kept by entry id until that entry's `entry_appended` takes it (RULING-121, #5337), so transcript batches
* applied in between cannot drop it; and the ids of the record it accepted last, answered only while that record, at
* that sequence, is the one being delivered.
*/
export declare class MessageIdentities {
private readonly joins;
private readonly unvouched;
private overflowed;
private evictions;
private overflows;
private held;
/** The epoch ended: nothing it joined or held can name a record delivered later. */
reset(): void;
/** Joins dropped at the bound and evicted ids dropped from the ring, over the lane's life (never reset). */
status(): {
ownerJoinsEvicted: number;
ownerJoinsOverflowed: number;
};
/**
* `owner`: the message the settled store joined this append to, the `messageId` of its `join-<n>` member; undefined
* when it recorded no join, which for an owned append (it carries `owningMessageId`) leaves the entry unvouched.
*/
joined(transition: TranscriptTransition, owner: string | undefined): void;
private unvouch;
/** Every acceptance starts with nothing held, so a record the lane refuses never inherits its predecessor's ids. */
clear(): void;
/** Holds the ids the settled store recorded for this record, or for an `entry_appended`, its entry's join (taken). */
hold(type: string, sequence: number, record: object, recorded: LiveIdentity | undefined): void;
of(type: unknown, sequence: number): LiveIdentity | undefined;
private takeEntryOwner;
}
//# sourceMappingURL=compact-message-identity.d.ts.map