UNPKG

@code-yeongyu/senpi

Version:

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

64 lines • 3.69 kB
import type { TranscriptPersistence, TranscriptTransition } from "../../core/session-transcript-journal.ts"; import { type StagedContent, type TransferStaging } from "./compact-transfer-staging.ts"; /** * Tail bytes the staging store may hold in RAM, unspilled, when an entry is staged: what bounds memory when the spool * lags or failed. Never below the 16 MiB of UTF-8 the old tail allowed, as UTF-16 stores at most two bytes per byte. */ export declare const TRANSCRIPT_TAIL_RESIDENT_BYTES: number; /** The tail bytes one transcript's tails hold in its store, kept segments included, against their one bound. */ export declare class TailBudget { readonly max: number; held: number; constructor(max?: number); } /** * The internal bootstrap reader (S12a): stages the text of every entry a bootstrap carries, in bounded fragments, * before the epoch publishes any of it. One refusal releases everything already staged and refuses the bootstrap * whole (undefined), so no partial transcript exists; the caller abandons whatever it does not adopt. */ export declare function stageBootstrap(staging: TransferStaging, transitions: readonly TranscriptTransition[]): Map<TranscriptTransition, StagedContent> | undefined; /** What a read by identity of a tail entry can fail with (RULING-78 (2)), never returning other bytes. */ export type TailReadFailure = "transcript_segment_missing" | "transcript_segment_mismatch"; /** * A reader's consistent cut of one tail: the first `fileCount` entries come from the file through its identity, every * later one from its own segments, pinned until `release`. */ export interface TailHold { readonly fileCount: number; readonly persistence: TranscriptPersistence | null; has(index: number): boolean; chunks(index: number, valid?: () => void): AsyncGenerator<string>; release(): void; } /** * The unpersisted entries of one epoch as staged content in the lane's store, shared by every root frozen from it: a * persistence report releases the entries it covers from the tail, held cuts included (RULING-21 (4)), and moves them * to the spool. An entry a live cut still names stays there, `kept`, until the last such cut is released (RULING-78 * (1)): a held cut reads its own segments, whatever later happens to the file. Persistence never changes a count. */ export declare class TranscriptTail { #private; readonly entries: Map<number, StagedContent>; readonly kept: Map<number, StagedContent>; retainedBytes: number; persistence: TranscriptPersistence | null; constructor(staging: TransferStaging, persistence: TranscriptPersistence | null, budget?: TailBudget); stage(index: number, text: string): StagedContent | undefined; adopt(index: number, content: StagedContent): void; retainCut(count: number): void; /** * A `replace` within the epoch left this tail behind: released now unless a live cut still names it, else by the last * such cut's release, so a replaced version still reads its own entries (RULING-78 (1), C1.1). */ supersede(): void; /** The last live cut naming a kept entry releases its segments; the last cut of a superseded tail releases it all. */ releaseCut(count: number): void; /** `baseCount` entries precede this tail's index 0 in the file. */ persisted(persistence: TranscriptPersistence, baseCount: number): void; releaseAll(): void; hold(count: number, baseCount: number): TailHold; /** Content leaves the store and the bound together: kept segments stay counted until exactly this release. */ private free; private reach; } //# sourceMappingURL=accepted-transcript-tail.d.ts.map