UNPKG

@code-yeongyu/senpi

Version:

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

69 lines • 3.86 kB
/** * The one identifier grammar of the recovery protocol (S09-Q2 A, RULING-57 Q2): every id, digest and ref is parsed * here before any use as a key, a path element, a log field or a lookup, and S15's admission ids reuse these parsers. * * A content ref is CUT-SCOPED (RULING-58 (3)): it is the position of a node or component under one catalog root, * minted by this process for one token, and it resolves only under that token through verified node reads. It is * never a stable identifier outside the process: another cut, another host or a later run of this host gives the * same bytes another ref, and a ref from one cut names nothing under another (a typed `range` refusal). */ declare const identity: unique symbol; /** An opaque protocol identifier: ASCII from the allow-list below, 1..128 bytes (S09-Q2 A, RULING-57 Q2). */ export type BoundedId = string & { readonly [identity]: "BoundedId"; }; /** A SHA-256 digest: exactly 64 lowercase hex characters. */ export type ContentDigest = string & { readonly [identity]: "ContentDigest"; }; /** A catalog ref: a 16-digit catalog counter root and at most `CATALOG_REF_MAX_STEPS` three-digit child steps. */ export type ContentRef = string & { readonly [identity]: "ContentRef"; }; /** * The reserved ref of a cut's loaded transcript base (S11c, RULING-70 (1)): the catalog root with the `base` step. * It is a bounded id like every ref (RULING-71 (1)); the `base` step is reserved, so the component grammar refuses it * by name and no catalog node or component is ever minted with it. It names the stamped-row stream of the base the cut * captured, served by the page route only, and like every ref it is cut-scoped: another cut's base ref names nothing * under this token. */ export type BaseRef = string & { readonly [identity]: "BaseRef"; }; /** What the page route addresses: a catalog component, or the cut's base stream. */ export type PageRef = { readonly kind: "catalog"; readonly ref: ContentRef; } | { readonly kind: "base"; readonly ref: BaseRef; }; type IdentityRefusal = "empty" | "overlong" | "forbidden_character" | "malformed" | "too_deep" | "reserved"; type IdentityOutcome<T> = { readonly ok: true; readonly value: T; } | { readonly ok: false; readonly reason: IdentityRefusal; }; export declare const BOUNDED_ID_MAX_BYTES = 128; /** Child descriptors per catalog node (R4.B1), the bound of every child step. */ export declare const CATALOG_NODE_MAX_ENTRIES = 128; /** The deepest ref: 128^8 addressable children, far past any catalog, in 50 of the 128 bytes an id may have. */ export declare const CATALOG_REF_MAX_STEPS = 8; /** The allow-list check every identifier passes before any use as a key, a path element or a log field. */ export declare function parseBoundedId(value: string): IdentityOutcome<BoundedId>; export declare function parseContentDigest(value: string): IdentityOutcome<ContentDigest>; export declare function parseContentRef(value: string): IdentityOutcome<ContentRef>; /** Either grammar, checked before any use; the two never overlap (`base` is not three digits). */ export declare function parsePageRef(value: string): IdentityOutcome<PageRef>; /** A literal or generated protocol identifier; a refusal is a programming error, never input. */ export declare function protocolId(value: string): BoundedId; export declare const catalogRootRef: (counter: number) => ContentRef; export declare const childRef: (parent: ContentRef, index: number) => ContentRef; /** The one base ref under a catalog root; a ref with steps is a programming error. */ export declare function baseRef(root: ContentRef): BaseRef; /** The child indexes from the catalog root to the ref. */ export declare const refSteps: (ref: ContentRef) => readonly number[]; export {}; //# sourceMappingURL=compact-recovery-ids.d.ts.map