/** * CapSet -- capability lattice. * * Re-parameterized from `@kit`: `pure < read < ... < system` becomes `static < styled < reactive < animated < gpu`. * * @module */ /** * Rung on the rendering-capability ladder. Higher levels imply lower ones: * `gpu > animated > reactive > styled > static`. */ export type CapTier = 'static' | 'styled' | 'reactive' | 'animated' | 'gpu'; /** * Immutable set of {@link CapTier}s — the tagged value returned by {@link Cap} combinators. * * `levels` is a canonical **sorted, deduped array** (ladder order via `LEVEL_ORD`), NOT a * `Set`. A `CapSet` rides inside a content-addressed graph node and travels over JSON * transports (the client→server mutation channel), and a `Set` is neither: `JSON.stringify` * turns it into `{}` (silent loss), and its insertion order made the content address * nondeterministic for the same logical set. The sorted array is JSON-faithful and gives one * canonical form. `Cap`'s combinators keep it deduped + sorted; treat it as a set. */ export interface CapSet { readonly _tag: 'CapSet'; readonly levels: readonly CapTier[]; } /** * Whether a CapSet's `levels` are already canonical — STRICTLY ascending by ladder order, * which is deduped + sorted in a single predicate. `Cap`'s combinators always produce this, * but an UNTRUSTED wire payload (a policy patch over the mutation channel) can carry any array * of valid tiers. The graph-node schema demands canonical levels so a non-canonical array * (`['gpu','static']`, or a dup) cannot seal and content-address DIFFERENTLY from the same * logical set built via {@link Cap.from} — the identity law holds at the untrusted boundary too. * Not re-exported from `@czap/core`: it is the schema's internal gate, not public surface. */ export declare const isCanonicalCapSet: (caps: { readonly levels: readonly CapTier[]; }) => boolean; /** * Cap — algebra over {@link CapSet}. * Pure, immutable helpers for building, combining, and comparing capability * sets; the underlying `CapTier` lattice is totally ordered via {@link Cap.ordinal}. */ export declare const Cap: { /** The empty {@link CapSet}. */ empty: () => CapSet; /** Build a {@link CapSet} from an array of {@link CapTier}s. */ from: (levels: ReadonlyArray) => CapSet; /** Return a new {@link CapSet} with the given level added. */ grant: (caps: CapSet, level: CapTier) => CapSet; /** Return a new {@link CapSet} with the given level removed. */ revoke: (caps: CapSet, level: CapTier) => CapSet; /** Whether a {@link CapSet} contains the given level. */ has: (caps: CapSet, level: CapTier) => boolean; /** Whether `a` contains every level of `b` (i.e. `a ⊇ b`). */ superset: (a: CapSet, b: CapSet) => boolean; /** Set union of two {@link CapSet}s. */ union: (a: CapSet, b: CapSet) => CapSet; /** Set intersection of two {@link CapSet}s. */ intersection: (a: CapSet, b: CapSet) => CapSet; /** Whether `a` ranks `>=` `b` on the underlying ordered ladder. */ atLeast: (a: CapTier, b: CapTier) => boolean; /** Integer ordinal for a {@link CapTier} — useful for sorting / comparison. */ ordinal: (level: CapTier) => number; }; export declare namespace Cap { /** Alias for {@link CapSet}. */ type Shape = CapSet; } //# sourceMappingURL=caps.d.ts.map