@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
39 lines • 2.58 kB
TypeScript
import type { FrozenBytes } from "./compact-recovery-bytes.ts";
import type { PageRef } from "./compact-recovery-ids.ts";
import type { FrozenAcceptedRoot } from "./session-acceptance-lane.ts";
/**
* A second checkpoint token tried to pin a frozen root another live token still pins: the one-token-per-root invariant
* the verified-component cache rests on is broken. An internal defect, never a refusal a peer can cause or recover from.
*/
export declare class FrozenRootPinnedError extends Error {
readonly tokenId: string;
readonly holder: string;
constructor(tokenId: string, holder: string);
}
/**
* The verified byte sources of one host's frozen roots (RULING-69 (2)): a component's open-time verification runs once
* per frozen root, so a re-open on that root serves pages without re-reading a leaf. Entries are keyed by the root and
* dropped with the lease of the one token that pins it.
*
* Invariant: a frozen root is pinned by exactly one live token. `RecoveryCheckpoints.freeze` is the only place a token
* is minted, and it pins the root its own `lane.freeze()` call just built; every freeze builds a new root object with
* its own references (`SessionAcceptanceLane.freeze`, `CompactLaneCurrent.freeze`, `CompactSessionState.freeze`), so
* two peers, a re-attach or a shed's resync each get a root of their own, and `FrozenCheckpoint.retain` (on the
* checkpoint `RecoveryCheckpoints.freeze` builds) hands a root to a non-token consumer under the same token's lease. A
* second peer on the same session therefore never shares an entry; it verifies its own root once. `pin` enforces the
* invariant with `FrozenRootPinnedError` instead of serving or overwriting another token's entries.
* An entry holds positions only, never bytes: at most one number per stored leaf of a component, or per row of the
* base stream (`compact-recovery-base.ts`).
*/
export declare class VerifiedComponents {
private readonly roots;
private readonly pinned;
get size(): number;
/** Registers `tokenId` as the root's one holder; idempotent for that token, a typed internal error for another. */
pin(tokenId: string, root: FrozenAcceptedRoot): void;
get(root: FrozenAcceptedRoot, ref: PageRef["ref"]): FrozenBytes | undefined;
/** Cached only while `tokenId` still pins `root`; once its lease dropped the entry, a late open caches nothing. */
set(tokenId: string, root: FrozenAcceptedRoot, ref: PageRef["ref"], bytes: FrozenBytes): void;
drop(tokenId: string): void;
}
//# sourceMappingURL=compact-verified-components.d.ts.map