/** * Capsule declaration locking the AI cast's graph SUMMARIZER — {@link * summarizeGraph} — as a standing `pureTransform` contract. Where * `graph-patch-identity.ts` proves the differ inverts itself, this pins the * token-budget LAWS the model-facing context depends on: * * - DETERMINISM: same (graph, budget) ⇒ byte-identical summary (so the same * AIContext content-address every time, on every machine). * - BUDGET HONESTY: `estimatedTokens` never exceeds `tokenBudget` (the summary * fits the budget it was cut to), and `truncated` is set iff a node was * dropped. * - BUDGET MONOTONICITY: a SMALLER budget never yields a LARGER summary — fewer * lines, never more (the law a host relies on to trade context for cost). * - TOTAL NODE-COUNT HONESTY: `nodeCount` always reports the TRUE total even * when lines were elided (so the model knows what was hidden). * * WHY `pureTransform`: `summarizeGraph` is a pure function of `(graph, budget)` — * no receipt byte law, no async hashing, no mutate channel. * * WHY THE INPUT IS SEED MATERIAL (not a raw `DocumentGraph` + budget): a * `DocumentGraph` is content-addressed — node `id`s + graph `id`/`digest` are * `fnv1a` over the canonical CBOR of the payload, minted ONLY through * `sealNode`/`sealGraph`. A schema-arbitrary cannot mint those addresses, so the * seed generates a fully-supported domain (signal-axis name lists + two budgets) * and `run` SEALS a real graph and summarizes it at BOTH budgets, returning the * sealed graph so the invariants assert over the REAL summarizer output. The * axis-name domain deliberately includes the `__proto__`/`constructor` edge * vectors (lesson #12/#26): a node whose `input` is `__proto__` must summarize * and round-trip like any other (the summarizer keys nothing on a poisoned * prototype) — the seed dedups by raw string (distinct axis name ⇒ distinct node) * which is faithful because `summarizeNode` reads the axis VALUE, never folds it. * * @module */ import { Schema } from 'effect'; import type { GraphSummary } from '../ai-cast.js'; import type { DocumentGraph, SignalNode } from '../document-graph.js'; /** * Seed material the schema-arbitrary CAN produce: the signal-axis names of the * graph to summarize, plus two NON-NEGATIVE budgets (one tight, one loose) so the * monotonicity law has two points to compare. `run` seals the graph and * summarizes at both. */ declare const AiCastSummarizeSeed: Schema.Struct<{ /** Signal-axis names → one sealed `SignalNode` per DISTINCT name. */ readonly inputs: Schema.$Array; /** A token budget (clamped to ≥ 0 in `run`). */ readonly budgetA: Schema.Number; /** A second token budget (clamped to ≥ 0 in `run`) — compared against `budgetA`. */ readonly budgetB: Schema.Number; }>; type AiCastSummarizeSeedValue = Schema.Schema.Type; /** Seal a minimal Signal node keyed by its input axis (its id is minted from the payload). */ declare function signalNode(input: string): SignalNode; /** Build a real, sealed graph from the seed (distinct axis names dedup to distinct nodes). */ declare function buildGraph(seed: AiCastSummarizeSeedValue): DocumentGraph; /** Clamp a raw seed number to a non-negative integer budget the summarizer accepts. */ declare function clampBudget(n: number): number; /** Byte-faithful structural equality over a {@link GraphSummary} (deterministic VALUE). */ declare function sameSummary(a: GraphSummary, b: GraphSummary): boolean; /** * Declared capsule for the AI cast summarizer. Registered in the module-level * catalog at import time; walked by the factory compiler. The generated property * test feeds schema-seeds, `run` seals a real graph and summarizes it at two * budgets, and the invariants assert determinism / budget honesty / monotonicity * / node-count honesty over the REAL summaries. */ export declare const aiCastSummarizeCapsule: import("../assembly.js").CapsuleDef<"pureTransform", { readonly inputs: readonly string[]; readonly budgetA: number; readonly budgetB: number; }, unknown, unknown>; /** Internal helpers exported for direct unit assertions over the seed→summary builder. */ export declare const _aiCastSummarizeInternals: { readonly buildGraph: typeof buildGraph; readonly signalNode: typeof signalNode; readonly clampBudget: typeof clampBudget; readonly sameSummary: typeof sameSummary; }; export {}; //# sourceMappingURL=ai-cast-summarize.d.ts.map