UNPKG

@code-yeongyu/senpi

Version:

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

90 lines • 5.72 kB
import type { FileEntry } from "../../core/session-manager.ts"; import type { TranscriptRoot } from "./accepted-transcript.ts"; import { type BoundedId } from "./compact-recovery-ids.ts"; /** * The versioned checkpoint schema's families (R4.B2, RULING-60 Q1): engine-owned state only. Desktop-only entities * (timeline groups, relations, plans, checkpoints) are derived by the desktop from these families, never cataloged * here. Membership is fixed by this list; a family the catalog does not emit is a construction error, not "empty". */ export declare const CATALOG_FAMILIES: readonly ["transcript", "run", "lifecycle", "dialogs", "opaque", "active", "calls", "settled", "identity", "source"]; export type CatalogFamily = (typeof CATALOG_FAMILIES)[number]; /** * Who produces a family's members: `complete` enumerates every member (for the families fed by entry kinds, the * catalog's members of this epoch plus the loaded base's stamped-row stream each names with a `base` member, S11c), * `partial` enumerates some and never declares the rest absent (an unavailable transcript). The assembly is complete * only when every family is `complete`, and a complete producer that emitted nothing fails the gate (`assertCoverage`). */ declare const PRODUCERS: readonly ["complete", "partial"]; type FamilyProducer = (typeof PRODUCERS)[number]; export type FamilyProducers = Readonly<Record<CatalogFamily, FamilyProducer>>; /** What this build's producers reach for a root with no loaded base; `familyProducers` narrows it per root. */ export declare const FAMILY_PRODUCERS: FamilyProducers; /** * The producers at one root (RULING-61 Q1): an unavailable transcript enumerates nothing, so the families fed by * entry kinds (transcript, opaque, source) are then `partial`, never complete or empty. A loaded base keeps them * complete since S11c: its members are the stamped rows of the base stream every one of them names. A client * correlation refused at the protocol depth limit never became the lane's standing one, so `identity` is then * `partial` too: its member reports the count (RULING-67 (4)). */ export declare function familyProducers(root: { readonly transcript: TranscriptRoot; readonly refusedCorrelations: number; }): FamilyProducers; /** * Every engine source kind (the session file's entry union) and the family that owns its data. The compiler refuses * a kind this map misses (TS2741), so a new engine entry type cannot ship uncataloged. A kind outside the union at * run time (an extension's own entry type) is `opaque`: kept whole, never dropped (RULING-60 Q1 (2)). */ type EngineEntryKind = FileEntry["type"]; export declare const ENTRY_FAMILIES: Readonly<Record<EngineEntryKind, CatalogFamily>>; export declare const entryFamily: (kind: string) => CatalogFamily; export declare const familyId: (family: CatalogFamily) => BoundedId; /** One member of a family: a fixed-width ordinal, so an arbitrary entry id or key never becomes a catalog id. */ export declare const memberId: (prefix: "entry" | "dialog" | "message" | "call" | "join", ordinal: number | string) => BoundedId; interface FamilyRow { readonly family: CatalogFamily; readonly producer: FamilyProducer; } interface RegistryBase { readonly format: "senpi-recovery-families"; readonly version: 1; readonly families: readonly FamilyRow[]; /** * The families a root built from these producers requires (RULING-128): every `complete` one, in code-unit order, * each once. The manifest carries this exact list, and this component's digest is inside `checkpointDigest`. */ readonly requiredKinds: readonly CatalogFamily[]; } /** * Set only by `familyRegistry`, which `readFamilyRegistry` decodes through and `completeAssembly` narrows to, so no other * module can write a complete registry by hand. A symbol key is not serialized: the component text is unchanged. */ declare const COMPLETE: unique symbol; export interface CompleteFamilyRegistry extends RegistryBase { readonly assembly: "complete"; readonly [COMPLETE]: true; } interface IncompleteFamilyRegistry extends RegistryBase { readonly assembly: "incomplete"; /** The families a consumer cannot treat as enumerated: every one whose producer is not `complete`. */ readonly incomplete: readonly CatalogFamily[]; } /** The registry every consumer receives (RULING-61 Q3): the assembly state is the discriminant, never a side flag. */ export type FamilyRegistry = CompleteFamilyRegistry | IncompleteFamilyRegistry; /** The registry component's value for one root: the schema as its producers stand, with the assembly state. */ export declare function familyRegistry(producers: FamilyProducers): FamilyRegistry; /** A registry that is complete only when every producer is; an incomplete one needs the consumer's own check. */ export declare const completeAssembly: (registry: FamilyRegistry) => CompleteFamilyRegistry | undefined; /** * The completeness gate (X03): every family whose producer is `complete` must have emitted at least one component, * an explicit empty included; a missing one is a construction error that refuses the whole catalog, never a * registry that claims more than its components hold. A `partial` family may emit nothing. */ export declare function assertCoverage(registry: FamilyRegistry, emitted: ReadonlySet<string>): void; /** * The one decoder of a `families/families` component (RULING-61 Q3): a consumer gets the discriminated registry or * a refusal, never a registry whose assembly state disagrees with its rows. */ export declare function readFamilyRegistry(text: string): FamilyRegistry; export {}; //# sourceMappingURL=compact-catalog-registry.d.ts.map