@ai-matrx/content-ir 0.1.2 โ 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +6 -0
- package/dist/index.cjs +345 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +340 -6
- package/dist/index.d.ts +340 -6
- package/dist/index.js +328 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -392,7 +392,6 @@ type KindStreamParserOptions = {
|
|
|
392
392
|
expectedRootKind?: string;
|
|
393
393
|
};
|
|
394
394
|
declare class KindStreamParser {
|
|
395
|
-
private readonly options;
|
|
396
395
|
private readonly resolver;
|
|
397
396
|
private readonly stack;
|
|
398
397
|
private readonly objectKinds;
|
|
@@ -427,6 +426,7 @@ declare class KindStreamParser {
|
|
|
427
426
|
private rootKind;
|
|
428
427
|
private rootDone;
|
|
429
428
|
private failed;
|
|
429
|
+
private readonly options;
|
|
430
430
|
constructor(options: KindStreamParserOptions);
|
|
431
431
|
push(chunk: string): void;
|
|
432
432
|
end(): void;
|
|
@@ -677,13 +677,13 @@ type JsonToken = {
|
|
|
677
677
|
at: number;
|
|
678
678
|
};
|
|
679
679
|
declare class JsonStreamTokenizer {
|
|
680
|
-
private readonly onToken;
|
|
681
680
|
private mode;
|
|
682
681
|
private pos;
|
|
683
682
|
private stringBuffer;
|
|
684
683
|
private primitiveBuffer;
|
|
685
684
|
private unicodeBuffer;
|
|
686
685
|
private tokenStart;
|
|
686
|
+
private readonly onToken;
|
|
687
687
|
constructor(onToken: (token: JsonToken) => void);
|
|
688
688
|
get position(): number;
|
|
689
689
|
push(chunk: string): void;
|
|
@@ -950,7 +950,18 @@ declare function sanitizeInboundEnvelopeMetadata(metadata: Record<string, unknow
|
|
|
950
950
|
* a schema knew about it.
|
|
951
951
|
*/
|
|
952
952
|
declare function reconstructRegionValue(envelope: CanonicalBlockIR): Record<string, unknown>;
|
|
953
|
-
/**
|
|
953
|
+
/**
|
|
954
|
+
* Deep-remove the `__kind` discriminator.
|
|
955
|
+
*
|
|
956
|
+
* ๐จ NOT A TRANSFORM FOR PLATFORM DATA. `__kind` is part of the data
|
|
957
|
+
* (KINDS_EVERYWHERE_PLAN ยง4.2) and stripping it from anything stored, passed or
|
|
958
|
+
* rendered was annihilated on 2026-08-23. This helper survives for exactly two
|
|
959
|
+
* shapes of caller, both of which are guarded:
|
|
960
|
+
* - a SYMMETRIC COMPARISON that reduces both sides and returns a boolean;
|
|
961
|
+
* - legacy validation TOLERANCE against a pre-2026-08-23 schema version.
|
|
962
|
+
* Guards: aidream `scripts/check_kind_marker_law.py`,
|
|
963
|
+
* matrx-frontend `pnpm check:kind-marker-law`.
|
|
964
|
+
*/
|
|
954
965
|
declare function stripKindDeep(value: unknown): unknown;
|
|
955
966
|
|
|
956
967
|
/**
|
|
@@ -1406,8 +1417,8 @@ interface DualGateResult {
|
|
|
1406
1417
|
/**
|
|
1407
1418
|
* The structural leg, exported on its own so the shape doctor
|
|
1408
1419
|
* (`shape-doctor.ts`) RECOMPUTES gate validation with the exact same ajv
|
|
1409
|
-
* config +
|
|
1410
|
-
* validator. `sample` is `unknown` (not `Record`) because kind examples may
|
|
1420
|
+
* config + marker semantics as activation (verbatim first, marker-free retry
|
|
1421
|
+
* second) โ never a parallel validator. `sample` is `unknown` (not `Record`) because kind examples may
|
|
1411
1422
|
* legitimately be scalars/arrays (workflow I/O kinds like `text`/`number`).
|
|
1412
1423
|
*/
|
|
1413
1424
|
declare function validateStructuralLeg(sample: unknown, emittedJsonSchema: unknown): LegResult;
|
|
@@ -1598,4 +1609,327 @@ declare function collectReferencedKinds(fields: Record<string, FieldSchema>): st
|
|
|
1598
1609
|
declare function collectSchemaReferencedKinds(schema: KindSchema): string[];
|
|
1599
1610
|
declare function kindSchemaToJsonSchema(kind: string, resolve: (kind: string) => KindSchema | undefined, options?: KindJsonSchemaOptions): KindJsonSchemaExport | null;
|
|
1600
1611
|
|
|
1601
|
-
|
|
1612
|
+
/**
|
|
1613
|
+
* Streaming partial kinds โ the TS twin of the Python producer's contract.
|
|
1614
|
+
*
|
|
1615
|
+
* Cross-repo system-of-record (read it before changing anything here):
|
|
1616
|
+
* `common-docs/systems/content-ir-system/STREAMING_PARTIAL_KINDS.md`.
|
|
1617
|
+
* Python twin: `aidream/packages/matrx-graph/matrx_graph/content_ir/partial.py`.
|
|
1618
|
+
*
|
|
1619
|
+
* WHAT THIS IS
|
|
1620
|
+
* ------------
|
|
1621
|
+
* While a structured region streams, the server announces what it thinks the
|
|
1622
|
+
* region IS and what has arrived so far, so the UI fills in progressively
|
|
1623
|
+
* instead of showing a spinner until the closing brace. Three events, a CLOSED
|
|
1624
|
+
* union on `state`, all riding `metadata.__ir_partial` on the `render_block`
|
|
1625
|
+
* events this app already receives:
|
|
1626
|
+
*
|
|
1627
|
+
* partial โ repeatable. A provisional instance whose `root.value` is
|
|
1628
|
+
* VALID, CLOSED JSON (the server truncates and closes it, so
|
|
1629
|
+
* this side never repairs or guesses). `kindState` is
|
|
1630
|
+
* "speculative": it MAY still turn out to be something else.
|
|
1631
|
+
* superseded โ TERMINAL. The region completed as the announced kind; drop
|
|
1632
|
+
* the provisional render, the block's own content/`__ir` is the
|
|
1633
|
+
* truth.
|
|
1634
|
+
* retracted โ TERMINAL escape hatch. Detection was wrong; `becameKind` /
|
|
1635
|
+
* `becameBlockType` name what it actually is. Never a silent
|
|
1636
|
+
* swap.
|
|
1637
|
+
*
|
|
1638
|
+
* WHY IT IS NOT ON `__ir`
|
|
1639
|
+
* -----------------------
|
|
1640
|
+
* `__ir` means "validated against the registered schema", and a valid `__ir`
|
|
1641
|
+
* is SEEDED into the fingerprint-keyed envelope memo. A provisional value
|
|
1642
|
+
* there would poison every later read of that region. The two channels never
|
|
1643
|
+
* touch: `classifyInboundEnvelopeMetadata` sees `absent` for a partial and
|
|
1644
|
+
* passes the metadata through by reference.
|
|
1645
|
+
*
|
|
1646
|
+
* Pure kernel module: types + validators only. No React, no Redux, no IO.
|
|
1647
|
+
* Lives in @ai-matrx/content-ir `wire/` so EVERY UI (Matrix, Workflow Studio,
|
|
1648
|
+
* the dashboard, the Chrome extension, the desktop app) reads the channel
|
|
1649
|
+
* through the same reader.
|
|
1650
|
+
*/
|
|
1651
|
+
|
|
1652
|
+
/** The reserved metadata key carrying every event of this contract. */
|
|
1653
|
+
declare const IR_PARTIAL_KEY: "__ir_partial";
|
|
1654
|
+
type PartialKindState = "partial" | "superseded" | "retracted";
|
|
1655
|
+
/** The provisional node. Deliberately `IrStructuredNode`-shaped so existing IR readers work. */
|
|
1656
|
+
interface PartialKindNode {
|
|
1657
|
+
role: "structured";
|
|
1658
|
+
/** The server's DETECTION GUESS for this region. */
|
|
1659
|
+
kind: string;
|
|
1660
|
+
/** Always "speculative" on a partial โ pre-recognition, not a resolved kind. */
|
|
1661
|
+
kindState: "speculative";
|
|
1662
|
+
discriminator: IrDiscriminator;
|
|
1663
|
+
path: IrPath;
|
|
1664
|
+
status: "streaming";
|
|
1665
|
+
/**
|
|
1666
|
+
* Valid, closed JSON carrying its own `__kind`. MAY be missing required
|
|
1667
|
+
* schema fields โ that is what `partial_unvalidated` in `residue.notices`
|
|
1668
|
+
* says. A renderer that throws on an absent field is not partial-ready and
|
|
1669
|
+
* must not be routed a provisional value.
|
|
1670
|
+
*/
|
|
1671
|
+
value: Record<string, unknown>;
|
|
1672
|
+
residue: IrResidue | null;
|
|
1673
|
+
}
|
|
1674
|
+
interface PartialKindEvent {
|
|
1675
|
+
v: typeof IR_VERSION;
|
|
1676
|
+
engine: string;
|
|
1677
|
+
state: "partial";
|
|
1678
|
+
/** Monotonic PER BLOCK โ the ordering / staleness key. Keep the highest. */
|
|
1679
|
+
seq: number;
|
|
1680
|
+
fingerprint: string;
|
|
1681
|
+
root: PartialKindNode;
|
|
1682
|
+
}
|
|
1683
|
+
interface SupersededKindEvent {
|
|
1684
|
+
v: typeof IR_VERSION;
|
|
1685
|
+
engine: string;
|
|
1686
|
+
state: "superseded";
|
|
1687
|
+
seq: number;
|
|
1688
|
+
kind: string;
|
|
1689
|
+
}
|
|
1690
|
+
interface RetractedKindEvent {
|
|
1691
|
+
v: typeof IR_VERSION;
|
|
1692
|
+
engine: string;
|
|
1693
|
+
state: "retracted";
|
|
1694
|
+
seq: number;
|
|
1695
|
+
/** The kind that was WRONGLY announced. */
|
|
1696
|
+
kind: string;
|
|
1697
|
+
reason: string;
|
|
1698
|
+
/** What it actually is โ null when it resolved to no registered kind. */
|
|
1699
|
+
becameKind: string | null;
|
|
1700
|
+
/** The detector's final block type, so a consumer re-routes without guessing. */
|
|
1701
|
+
becameBlockType: string | null;
|
|
1702
|
+
}
|
|
1703
|
+
type AnyPartialKindEvent = PartialKindEvent | SupersededKindEvent | RetractedKindEvent;
|
|
1704
|
+
/**
|
|
1705
|
+
* Read + validate a partial-channel event off a block's metadata.
|
|
1706
|
+
*
|
|
1707
|
+
* Returns null for anything malformed, foreign, or of an unknown `state`. A
|
|
1708
|
+
* malformed partial degrades to "no live rendering" โ never to a wrong render,
|
|
1709
|
+
* and never to a thrown error inside a stream handler.
|
|
1710
|
+
*/
|
|
1711
|
+
declare function readPartialKindEvent(metadata: Record<string, unknown> | null | undefined): AnyPartialKindEvent | null;
|
|
1712
|
+
/**
|
|
1713
|
+
* Ingest guard for the partial channel on a `render_block` event โ the twin of
|
|
1714
|
+
* `sanitizeInboundEnvelopeMetadata` for `__ir`, and it exists for the same
|
|
1715
|
+
* reason: a malformed server event must be stripped at the wire boundary, not
|
|
1716
|
+
* carried into Redux where every later reader has to re-decide whether to
|
|
1717
|
+
* trust it.
|
|
1718
|
+
*
|
|
1719
|
+
* - no `__ir_partial` key โ the SAME metadata reference back (zero-touch).
|
|
1720
|
+
* - valid event โ the SAME metadata reference back (idempotence law).
|
|
1721
|
+
* - malformed โ a COPY with the key stripped, plus a loud `reportMalformed`.
|
|
1722
|
+
* Dropping it degrades that block to "no live rendering" and nothing more.
|
|
1723
|
+
*
|
|
1724
|
+
* Pure: the host injects the reporter, exactly like the envelope gate, so
|
|
1725
|
+
* aidream's Workflow Studio can bind its own.
|
|
1726
|
+
*/
|
|
1727
|
+
declare function sanitizeInboundPartialKindMetadata(metadata: Record<string, unknown> | null | undefined, context: {
|
|
1728
|
+
blockId: string;
|
|
1729
|
+
}, hooks?: {
|
|
1730
|
+
reportMalformed?: (info: {
|
|
1731
|
+
blockId: string;
|
|
1732
|
+
raw: unknown;
|
|
1733
|
+
}) => void;
|
|
1734
|
+
}): Record<string, unknown> | undefined;
|
|
1735
|
+
/** Narrowing helper: is this the repeatable provisional event? */
|
|
1736
|
+
declare function isProvisionalKind(event: AnyPartialKindEvent | null): event is PartialKindEvent;
|
|
1737
|
+
/**
|
|
1738
|
+
* Narrowing helper: is this a TERMINAL event? Every partial ends in exactly
|
|
1739
|
+
* one of these โ that law is what makes a stuck skeleton impossible, so a
|
|
1740
|
+
* consumer clears its provisional render here and nowhere else.
|
|
1741
|
+
*/
|
|
1742
|
+
declare function isTerminalKindEvent(event: AnyPartialKindEvent | null): event is SupersededKindEvent | RetractedKindEvent;
|
|
1743
|
+
/**
|
|
1744
|
+
* Per-block staleness gate. Events can be re-dispatched, replayed on reconnect,
|
|
1745
|
+
* or arrive out of order; only a strictly higher `seq` advances a block.
|
|
1746
|
+
* Returns null when the event should be ignored.
|
|
1747
|
+
*
|
|
1748
|
+
* Pure: the caller owns the `seen` map, so this composes into a reducer
|
|
1749
|
+
* without hiding module state.
|
|
1750
|
+
*/
|
|
1751
|
+
declare function advancePartialKind(seen: Record<string, number>, blockId: string, event: AnyPartialKindEvent | null): AnyPartialKindEvent | null;
|
|
1752
|
+
/**
|
|
1753
|
+
* The per-block staleness GATE, as a stateful closure over `advancePartialKind`
|
|
1754
|
+
* โ one per stream.
|
|
1755
|
+
*
|
|
1756
|
+
* `upsertRenderBlock` REPLACES the stored block, so an event landing on a block
|
|
1757
|
+
* would regress what the user is looking at (a filled-in quiz snapping back to
|
|
1758
|
+
* two questions, or a terminal being undone by a late `partial`). The highest
|
|
1759
|
+
* accepted event is CARRIED FORWARD rather than dropped, so it is a no-op on
|
|
1760
|
+
* screen instead of a flicker back to the skeleton.
|
|
1761
|
+
*
|
|
1762
|
+
* ๐จ TWO arrivals must be carried, and the second one is the common case:
|
|
1763
|
+
*
|
|
1764
|
+
* 1. A STALE key โ a replay or an out-of-order event (`seq <= last`).
|
|
1765
|
+
* 2. **NO key at all.** The producer clears `__ir_partial` at the top of every
|
|
1766
|
+
* stamp and re-adds it only when the value genuinely advanced
|
|
1767
|
+
* (`stream_processor.py::_stamp_partial` โ `_partials.advanced(...)`), so
|
|
1768
|
+
* it is CORRECT for it to omit the key โ re-shipping an identical payload
|
|
1769
|
+
* every token is pure wire cost. But the block still ships whole, and
|
|
1770
|
+
* replacing the stored block with one that has no partial metadata is what
|
|
1771
|
+
* made the provisional render vanish between advances: every non-advancing
|
|
1772
|
+
* token dropped the user back to the pending skeleton.
|
|
1773
|
+
*
|
|
1774
|
+
* Carrying stops at the TERMINAL, and only there. After `superseded` /
|
|
1775
|
+
* `retracted` the region's truth is its own content or `__ir`, so resurrecting
|
|
1776
|
+
* a provisional value would be a lie that outlives its own contract.
|
|
1777
|
+
*
|
|
1778
|
+
* Returns the metadata to store: the same reference when nothing changed, a
|
|
1779
|
+
* copy with the carried-forward event otherwise.
|
|
1780
|
+
*/
|
|
1781
|
+
declare function makePartialKindStalenessGate(): (blockId: string, metadata: Record<string, unknown> | undefined) => Record<string, unknown> | undefined;
|
|
1782
|
+
|
|
1783
|
+
/**
|
|
1784
|
+
* Runtime wrapper kinds โ the reader, and THE elision gate.
|
|
1785
|
+
*
|
|
1786
|
+
* Cross-repo contract (system of record):
|
|
1787
|
+
* `common-docs/systems/content-ir-system/RUNTIME_WRAPPER_WIRE.md`.
|
|
1788
|
+
*
|
|
1789
|
+
* A runtime wrapper is the CLOSED set of envelopes that carry instance
|
|
1790
|
+
* context with a data kind NESTED inside: `node_outcome` (one settled node
|
|
1791
|
+
* invocation) and `run_result` (one terminated run, nesting one
|
|
1792
|
+
* `node_outcome` per terminal node). `tool_result` is registered server-side
|
|
1793
|
+
* but nothing emits it yet, so nothing here reads it.
|
|
1794
|
+
*
|
|
1795
|
+
* ## THE ELISION RULE โ do it ONCE, here
|
|
1796
|
+
*
|
|
1797
|
+
* The payload is NEVER sent twice. On the wire `output` is `null` and
|
|
1798
|
+
* `output_ref` names the FRAME field that already holds the value:
|
|
1799
|
+
*
|
|
1800
|
+
* - `"output"` โ the frame's own `output` (`node_completed.output`,
|
|
1801
|
+
* the run row's `output`).
|
|
1802
|
+
* - `"output.<node_id>"` โ that key of the frame's terminal output map.
|
|
1803
|
+
*
|
|
1804
|
+
* PRESENCE OF `output_ref` IS THE MARKER. A bare `output: null` with NO ref is
|
|
1805
|
+
* a legitimately empty payload โ never an elision, never something to go
|
|
1806
|
+
* looking for. This is the same rule the `__ir` envelope follows with
|
|
1807
|
+
* `value_ref`, for the same reason: otherwise every payload is serialized
|
|
1808
|
+
* twice per streamed event, twice per durable row and twice per run read.
|
|
1809
|
+
*
|
|
1810
|
+
* Rehydration happens at the single INGEST GATE (each host's one ingest point โ
|
|
1811
|
+
* Matrix's workflow-runs reducer, the Studio's inbound-envelope gate),
|
|
1812
|
+
* before anything reads the wrapper. No renderer, selector or component ever
|
|
1813
|
+
* sees an un-rehydrated wrapper, so none of them may re-implement this.
|
|
1814
|
+
*
|
|
1815
|
+
* ## Never load-bearing
|
|
1816
|
+
*
|
|
1817
|
+
* Assembly is a pure read. A malformed wrapper yields `null` and the frame's
|
|
1818
|
+
* own fields carry the surface exactly as they did before the wrapper
|
|
1819
|
+
* existed โ additive on the wire, additive here.
|
|
1820
|
+
*/
|
|
1821
|
+
/** The registered slugs โ named once, never spelled by hand elsewhere. */
|
|
1822
|
+
declare const NODE_OUTCOME_KIND = "node_outcome";
|
|
1823
|
+
declare const RUN_RESULT_KIND = "run_result";
|
|
1824
|
+
/** One settled node invocation, with its data kind nested in `output`. */
|
|
1825
|
+
interface NodeOutcomeWrapper {
|
|
1826
|
+
__kind: typeof NODE_OUTCOME_KIND;
|
|
1827
|
+
run_id: string;
|
|
1828
|
+
node_id: string;
|
|
1829
|
+
workflow_id: string | null;
|
|
1830
|
+
step: number | null;
|
|
1831
|
+
attempt: number;
|
|
1832
|
+
status: string;
|
|
1833
|
+
started_at: string | null;
|
|
1834
|
+
ended_at: string | null;
|
|
1835
|
+
/** `0` is a REAL duration, not "unknown"; `null` is unknown. */
|
|
1836
|
+
duration_ms: number | null;
|
|
1837
|
+
/** null = the node declared no kind (a loud defect, never a pass). */
|
|
1838
|
+
output_kind: string | null;
|
|
1839
|
+
/** null = never checked / degraded โ NEVER renderable as a pass. */
|
|
1840
|
+
output_kind_ok: boolean | null;
|
|
1841
|
+
output_kind_errors: string[] | null;
|
|
1842
|
+
/** Rehydrated by {@link rehydrateNodeOutcome}; null = genuinely empty. */
|
|
1843
|
+
output: unknown;
|
|
1844
|
+
}
|
|
1845
|
+
/** One terminated run. `outputs` is one wrapper per TERMINAL node. */
|
|
1846
|
+
interface RunResultWrapper {
|
|
1847
|
+
__kind: typeof RUN_RESULT_KIND;
|
|
1848
|
+
run_id: string;
|
|
1849
|
+
workflow_id: string | null;
|
|
1850
|
+
status: string;
|
|
1851
|
+
started_at: string | null;
|
|
1852
|
+
ended_at: string | null;
|
|
1853
|
+
duration_ms: number | null;
|
|
1854
|
+
output_kind: string | null;
|
|
1855
|
+
output: unknown;
|
|
1856
|
+
outputs: NodeOutcomeWrapper[];
|
|
1857
|
+
}
|
|
1858
|
+
/**
|
|
1859
|
+
* Resolve a dotted `output_ref` against the frame that carries the payload.
|
|
1860
|
+
* Returns `undefined` when the path does not resolve โ the caller keeps
|
|
1861
|
+
* `output: null` rather than inventing a value.
|
|
1862
|
+
*/
|
|
1863
|
+
declare function readOutputRef(frame: unknown, ref: string): unknown;
|
|
1864
|
+
/**
|
|
1865
|
+
* Read a `node_outcome` off a frame and rehydrate its elided payload.
|
|
1866
|
+
*
|
|
1867
|
+
* `frame` is the object the wrapper travelled ON โ the `node_completed` event,
|
|
1868
|
+
* or the run read response for a `run_result`'s children. Returns null for
|
|
1869
|
+
* anything that is not a node_outcome (including a missing wrapper: the
|
|
1870
|
+
* producer fails OPEN, so an absent wrapper is a normal, non-fatal state).
|
|
1871
|
+
*/
|
|
1872
|
+
declare function rehydrateNodeOutcome(raw: unknown, frame: unknown): NodeOutcomeWrapper | null;
|
|
1873
|
+
/**
|
|
1874
|
+
* Read an ALREADY-REHYDRATED node_outcome value into its typed form.
|
|
1875
|
+
*
|
|
1876
|
+
* Deliberately does NOT require `__kind`: the render bridge strips the root
|
|
1877
|
+
* discriminator before the component sees the value, and it does NOT touch
|
|
1878
|
+
* `output_ref` โ by the time anything renders, the ingest gate has already
|
|
1879
|
+
* resolved the elision, and a second resolution attempt against a frame that
|
|
1880
|
+
* is no longer there is how a payload goes missing.
|
|
1881
|
+
*/
|
|
1882
|
+
declare function readNodeOutcomeValue(raw: unknown): NodeOutcomeWrapper | null;
|
|
1883
|
+
/**
|
|
1884
|
+
* Read a `run_result` off the run read response and rehydrate every elided
|
|
1885
|
+
* payload โ its own, and each terminal node's. Both resolve against the SAME
|
|
1886
|
+
* frame (the run read response), which is what `"output.<node_id>"` addresses.
|
|
1887
|
+
*/
|
|
1888
|
+
declare function rehydrateRunResult(raw: unknown, frame: unknown): RunResultWrapper | null;
|
|
1889
|
+
/**
|
|
1890
|
+
* Read an ALREADY-REHYDRATED run_result value into its typed form. Same
|
|
1891
|
+
* contract as {@link readNodeOutcomeValue}: no `__kind` requirement, no
|
|
1892
|
+
* second elision pass.
|
|
1893
|
+
*/
|
|
1894
|
+
declare function readRunResultValue(raw: unknown): RunResultWrapper | null;
|
|
1895
|
+
/**
|
|
1896
|
+
* The kind verdict, as three states the UI must keep distinct.
|
|
1897
|
+
*
|
|
1898
|
+
* `unchecked` is NEVER a pass: the engine either did not check (no declared
|
|
1899
|
+
* kind) or checked and could not conclude. Collapsing it into "ok" is how a
|
|
1900
|
+
* confidently-rendered document gets shown for a shape nobody verified.
|
|
1901
|
+
*/
|
|
1902
|
+
type KindVerdict = "passed" | "failed" | "unchecked";
|
|
1903
|
+
declare function kindVerdictOf(wrapper: {
|
|
1904
|
+
output_kind: string | null;
|
|
1905
|
+
output_kind_ok: boolean | null;
|
|
1906
|
+
}): KindVerdict;
|
|
1907
|
+
|
|
1908
|
+
/**
|
|
1909
|
+
* The forward composer: given a kind's stored example, produce the EMIT/RENDER
|
|
1910
|
+
* payload โ `{ "__kind": <slug>, ...data }`.
|
|
1911
|
+
*
|
|
1912
|
+
* Pure kernel module (@ai-matrx/content-ir `wire/`): no React, no Redux, no IO.
|
|
1913
|
+
*
|
|
1914
|
+
* Since 2026-08-23 stored examples and instances ALREADY carry their marker
|
|
1915
|
+
* (`__kind` is part of the data โ KINDS_EVERYWHERE_PLAN ยง4.2), so for a
|
|
1916
|
+
* well-formed row this is an IDENTITY with a guarantee attached: the marker is
|
|
1917
|
+
* the FIRST key and it names the right slug. It stays because it is also the
|
|
1918
|
+
* repair for the legacy rows and hand-typed values that do not, and because a
|
|
1919
|
+
* caller wanting a copy-ready render payload should not have to know which it
|
|
1920
|
+
* has.
|
|
1921
|
+
*
|
|
1922
|
+
* Scalars/arrays are returned unchanged โ for those kinds the identity travels
|
|
1923
|
+
* out of band (`root.kind`); there is no key to add.
|
|
1924
|
+
*/
|
|
1925
|
+
declare function withRootKind(kind: string, value: unknown): unknown;
|
|
1926
|
+
/** The copy-ready render payload: pretty JSON of `{ __kind, ...data }`. */
|
|
1927
|
+
declare function emitPayloadJson(kind: string, value: unknown): string;
|
|
1928
|
+
/**
|
|
1929
|
+
* The copy-ready render BLOCK โ the render payload inside a ```json fence, the
|
|
1930
|
+
* exact form an agent emits and a user pastes into a prompt or a message to see
|
|
1931
|
+
* it render live.
|
|
1932
|
+
*/
|
|
1933
|
+
declare function emitPayloadFence(kind: string, value: unknown): string;
|
|
1934
|
+
|
|
1935
|
+
export { type AnyPartialKindEvent, type ArrayItemKindBinding, type ArrayItemScalarType, type BlockSchemaDraft, type CanonicalBlockIR, type CanonicalContent, type CanonicalSegment, type CompleteValueEnvelopeOptions, type CompliantKindSnapshot, type ContentRegionInit, type ConversionProblem, type DroppedMetadata, type DualGateDefinition, type DualGateInput, type DualGateResolvedComponent, type DualGateResult, type FieldComparison, type FieldSchema, type Fingerprinter, IR_ENVELOPE_CACHE_VERSION, IR_ENVELOPE_KEY, IR_PARTIAL_KEY, IR_VERSION, type InboundEnvelopeHooks, type InboundEnvelopeVerdict, type IrDiscriminator, type IrEnvelopeCache, type IrKindState, type IrPath, type IrResidue, type IrStructuredNode, IrTree, type IrTreeNode, type ItemKindRefCheck, JSON_DISCRIMINATOR, type JsonPath, type JsonSchemaNode, JsonStreamTokenizer, type JsonToken, KIND_KEY, type KindBlockProps, type KindDefinition, type KindEdgeSpec, type KindJsonSchemaExport, type KindJsonSchemaOptions, type KindResolution, type KindSchema, KindStorageError, type KindStorageShape, type KindStreamEvent, KindStreamParser, type KindStreamParserOptions, type KindTier, type KindVerdict, type LegResult, NODE_OUTCOME_KIND, type NodeOutcomeWrapper, type NormalizeJsonRegionOptions, ParseSession, type ParseSessionOptions, type PartialKindEvent, type PartialKindNode, type PartialKindState, type Punct, ROOT_STORAGE_NAME, RUN_RESULT_KIND, type RecordValueType, type RegionEndReason, type RegionFormat, type RegionSourceKind, type RetractedKindEvent, type RunResultWrapper, type SavePlanEntry, type SavePlanValidation, type ScalarFieldType, type SchemaConversionResult, type SchemaLayoutMode, type SchemaResolver, type StoredFieldElement, type SupersededKindEvent, advancePartialKind, buildAgentSchemaWithRenderBlockSupport, buildCompliantKindSnapshot, classifyInboundEnvelopeMetadata, collectReferencedKinds, collectSchemaReferencedKinds, compareWithExistingKindSchema, convertAiSchemaToBlockFields, createFingerprinter, createKindStreamParser, describeDualGateFailure, disposeParseSession, emitPayloadFence, emitPayloadJson, emptyValueForFieldSchema, envelopeCacheFromEnvelopes, envelopeFromCompleteValue, fenceDiscriminator, fieldsToDbPayload, fingerprintText, formatBlockLabel, getParseSession, injectKindIntoObjectSchema, irPathIsUnderOrEqual, irPathKey, irPathLabel, irPathsEqual, isCanonicalBlockIR, isDuplicateBlockSlug, isEmptyResidue, isIrEnvelopeCache, isJsonAnyField, isProvisionalKind, isScalarArrayType, isTerminalKindEvent, kindSchemaToJsonSchema, kindSchemaToStorage, kindVerdictOf, makePartialKindStalenessGate, mergeResidueIntoValue, normalizeAiSchemaInput, normalizeJsonRegion, openParseSession, readEnvelope, readNodeOutcomeValue, readObjectKind, readOutputRef, readPartialKindEvent, readRunResultValue, reconstructRegionValue, rehydrateNodeOutcome, rehydrateRunResult, reuseEnvelopeIfCurrent, runKindDualGate, runSchemaConversion, sanitizeInboundEnvelopeMetadata, sanitizeInboundPartialKindMetadata, scalarArrayItemType, schemaLayoutMode, schemaStructureDepth, setJsonRootKeyLookup, storageToKindSchema, stripKindDeep, validateBlockSchemaSavePlan, validateStructuralLeg, withRootKind, xmlDiscriminator };
|