@ai-matrx/content-ir-react 0.1.0

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 ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — 2026-08-23
4
+
5
+ First release: the shared Content IR RENDER layer, extracted from
6
+ matrx-frontend so the dashboard, the Chrome extension, the desktop app, and
7
+ customers building on the platform render kinds through ONE implementation
8
+ (KINDS_EVERYWHERE_PLAN §10d-A4).
9
+
10
+ - `route/kind-route` — `applyIrKindRoute`, the marker helpers, and
11
+ `kindServerDataFromStoredValue`. Was matrx-frontend's
12
+ `features/content-ir/react/kind-route.ts`; the registries, the resolution
13
+ platform, and the error sink are now a `KindRouteEnv` argument, and the
14
+ `artifact` special case became the host's `ownedTypes` option.
15
+ - `route/partial-kind-route` — `resolveProvisionalKindRender`,
16
+ `resolveAnnouncedKindLoading`, the partial-unsafe session latch.
17
+ - `resolver/component-resolver` — `ComponentResolver`, was matrx-frontend's
18
+ `ComponentRegistry`: compiled floor, DB override, granular per-kind repaint
19
+ counters, cold-fetch dedupe, warm/refresh with loud recovery. Its two loaders
20
+ and its error sink are constructor arguments.
21
+ - **Fixed in the move:** `lastRefreshAt` used `0` as "never refreshed", so a
22
+ host supplying a clock that starts near zero had its FIRST refresh silently
23
+ rate-limited away. It is now explicitly nullable.
24
+ - `react/` — `KindInstanceRender`, `GenericStructuredView`, `NodeOutcomeView` /
25
+ `RunResultView` / `DelegatedOutput`, `ProvisionalKindBoundary` /
26
+ `ProvisionalKindFrame`, `useContentIrKindVersion`.
27
+ - `NodeOutcomeView` / `RunResultView` / `DelegatedOutput` take `fallback` as a
28
+ RENDER FUNCTION `(output) => ReactNode`, not a node: the fallback needs the
29
+ payload, and the only component that has read the wrapper is the view. A
30
+ static node would force every host to re-read the wrapper — a second reader,
31
+ which is exactly what this family exists to prevent.
32
+ - `host/` — the seam contract (`ContentIrHost`) and
33
+ `ContentIrRenderProvider`. Reading the host outside a provider throws rather
34
+ than defaulting: a silent default would render the wrong component for every
35
+ kind in an app and look like a data problem for weeks.
36
+
37
+ Peer dependencies: `react >= 19` and `@ai-matrx/content-ir` 0.2.0 (exact).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 AI Matrix Engine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,78 @@
1
+ # @ai-matrx/content-ir-react
2
+
3
+ The shared **render layer** for AI Matrx Content IR.
4
+
5
+ [`@ai-matrx/content-ir`](https://www.npmjs.com/package/@ai-matrx/content-ir) is
6
+ the pure kernel — it parses a kind, validates it, reads a streaming partial, and
7
+ reads a runtime wrapper. This package is the layer above it: the one that
8
+ decides **which component a kind renders through**, and draws the chrome around
9
+ that decision.
10
+
11
+ It is framework-portable React. No Next.js, no Redux, no Supabase, no router,
12
+ no host error capture. Every host-specific capability enters through an explicit
13
+ seam.
14
+
15
+ ```bash
16
+ npm install @ai-matrx/content-ir-react @ai-matrx/content-ir react
17
+ ```
18
+
19
+ ## Wire your host once
20
+
21
+ ```tsx
22
+ import {
23
+ ComponentResolver,
24
+ ContentIrRenderProvider,
25
+ applyIrKindRoute,
26
+ type ContentIrHost,
27
+ } from "@ai-matrx/content-ir-react";
28
+
29
+ const components = new ComponentResolver({
30
+ loadAll: () => fetchKindComponentRows(),
31
+ loadForKind: (kind, platform) => fetchKindComponentRows({ kind, platform }),
32
+ reportError: (report) => myErrorLog(report),
33
+ });
34
+
35
+ const host: ContentIrHost = {
36
+ platform: "web",
37
+ kinds: myKindDefinitionSource,
38
+ components,
39
+ reportError: (report) => myErrorLog(report),
40
+ // The host's dispatch table — the ONE place a component key becomes a
41
+ // component. Run the route here.
42
+ renderBlock: (block) => <MyBlockRenderer block={applyIrKindRoute(block, env)} />,
43
+ // The FLOOR: any JSON value as a human document.
44
+ renderValue: ({ value, kind, note }) => (
45
+ <MyStructuredValueView value={value} kind={kind} note={note} />
46
+ ),
47
+ };
48
+
49
+ <ContentIrRenderProvider host={host}>
50
+ <App />
51
+ </ContentIrRenderProvider>;
52
+ ```
53
+
54
+ ## What you get
55
+
56
+ | Export | What it is |
57
+ |---|---|
58
+ | `applyIrKindRoute` | THE kind route: envelope → registered kind → the right component key. Pure; callable from a reducer or a stream accumulator. |
59
+ | `resolveProvisionalKindRender` / `resolveAnnouncedKindLoading` | The streaming partial-kinds route — a provisional value renders through the SAME component the final value will. |
60
+ | `ComponentResolver` | `(kind, platform, role) → component`, compiled floor + DB override, granular repaint counters, cold-fetch dedupe. |
61
+ | `KindInstanceRender` | Render one canonical kind instance through the real production path, with the "no component yet" floor beneath it. |
62
+ | `GenericStructuredView` | The R6 disposition for a known shape nothing render-trusted claims — readable, honest, never an error. |
63
+ | `NodeOutcomeView` / `RunResultView` | The runtime-wrapper chrome. Transparent routers: they delegate, they never render a payload. |
64
+ | `ProvisionalKindBoundary` / `ProvisionalKindFrame` | The mid-stream safety net and the "still arriving" affordance. |
65
+ | `useContentIrKindVersion` | Granular late-arrival repaint for one kind. |
66
+
67
+ ## The rule this package exists to enforce
68
+
69
+ **A shape has exactly one component, everywhere.** A second implementation of
70
+ the routing decisions — in a dashboard, an extension, a desktop webview, a
71
+ customer's app — is a guaranteed divergence, and it is banned. If this package
72
+ cannot express what your host needs, add a seam; never fork the route.
73
+
74
+ ## Docs
75
+
76
+ - Package internals and boundary: `FEATURE.md` beside this file.
77
+ - Cross-repo system-of-record: `common-docs/systems/content-ir-twin/FEATURE.md`.
78
+ - Shape System semantics: `matrx-frontend/features/content-ir/docs/SHAPE_SYSTEM.md`.