@ai-matrx/content-ir-react 0.2.0 → 0.5.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 +36 -0
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +11 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,13 @@ interface KindComponentRow {
|
|
|
70
70
|
isActive: boolean;
|
|
71
71
|
componentSource: string | null;
|
|
72
72
|
propsTransform: string | null;
|
|
73
|
+
/**
|
|
74
|
+
* Whether the row carries a real `component_source` body — supplied by the
|
|
75
|
+
* host when its warm list is BODY-LESS (the lazy design: metadata travels
|
|
76
|
+
* on the list, the body arrives per kind via the cold fetch). Omitted →
|
|
77
|
+
* derived from `componentSource` itself, so eager hosts change nothing.
|
|
78
|
+
*/
|
|
79
|
+
hasComponentSource?: boolean;
|
|
73
80
|
pinnedKindVersion: number | null;
|
|
74
81
|
updatedAt: string | null;
|
|
75
82
|
createdBy: string | null;
|
|
@@ -101,6 +108,14 @@ interface ComponentResolution {
|
|
|
101
108
|
resolvedBy: "compiled" | "db";
|
|
102
109
|
componentSource: string | null;
|
|
103
110
|
propsTransform: string | null;
|
|
111
|
+
/**
|
|
112
|
+
* TRUE when the row owns a real component body — even if `componentSource`
|
|
113
|
+
* is null because the host's warm list is body-less and the cold fetch has
|
|
114
|
+
* not landed it yet. THE routing gate: `routeToDbComponent` re-types on
|
|
115
|
+
* this flag, never on body presence, so a body-less row still routes and
|
|
116
|
+
* the renderer fetches/compiles the body lazily.
|
|
117
|
+
*/
|
|
118
|
+
hasComponentSource: boolean;
|
|
104
119
|
pinnedKindVersion: number | null;
|
|
105
120
|
/** The db row's `updated_at` — the compile-cache staleness key. */
|
|
106
121
|
updatedAt: string | null;
|
|
@@ -452,7 +467,22 @@ type GenericFallbackReason =
|
|
|
452
467
|
* kinds came to be certified as renderable while rendering generically
|
|
453
468
|
* (found 2026-08-23).
|
|
454
469
|
*/
|
|
455
|
-
| "generic-row"
|
|
470
|
+
| "generic-row"
|
|
471
|
+
/**
|
|
472
|
+
* The envelope carries a kind-preserved RAW: the payload identified a
|
|
473
|
+
* registered kind but its value failed the schema (or the schema never
|
|
474
|
+
* arrived before the region closed). The instance is BROKEN, not
|
|
475
|
+
* component-less — the repair is fixing the payload/schema, and the generic
|
|
476
|
+
* floor must acknowledge the kind and surface the recorded problems.
|
|
477
|
+
*/
|
|
478
|
+
| "broken-instance"
|
|
479
|
+
/**
|
|
480
|
+
* The slug is not in the registry at all (typo, foreign emitter, a shape
|
|
481
|
+
* not yet created). Routed anyway — Arman's 2026-08-29 ruling: a root
|
|
482
|
+
* `__kind` key means the kind system owns the render, no exceptions. The
|
|
483
|
+
* repair is creating/registering the shape (or fixing the slug).
|
|
484
|
+
*/
|
|
485
|
+
| "unregistered";
|
|
456
486
|
interface IrRouteMarker {
|
|
457
487
|
by: ComponentResolution["resolvedBy"] | "generic";
|
|
458
488
|
key: string;
|
package/dist/index.js
CHANGED
|
@@ -120,6 +120,7 @@ var ComponentResolver = class {
|
|
|
120
120
|
resolvedBy: "db",
|
|
121
121
|
componentSource: dbRow.componentSource,
|
|
122
122
|
propsTransform: dbRow.propsTransform,
|
|
123
|
+
hasComponentSource: dbRow.hasComponentSource ?? Boolean(dbRow.componentSource && dbRow.componentSource.trim()),
|
|
123
124
|
pinnedKindVersion: dbRow.pinnedKindVersion,
|
|
124
125
|
updatedAt: dbRow.updatedAt,
|
|
125
126
|
createdBy: dbRow.createdBy
|
|
@@ -136,6 +137,7 @@ var ComponentResolver = class {
|
|
|
136
137
|
resolvedBy: "compiled",
|
|
137
138
|
componentSource: null,
|
|
138
139
|
propsTransform: null,
|
|
140
|
+
hasComponentSource: false,
|
|
139
141
|
pinnedKindVersion: null,
|
|
140
142
|
updatedAt: null,
|
|
141
143
|
createdBy: null
|
|
@@ -322,7 +324,7 @@ function resetSourcelessDbRowReports() {
|
|
|
322
324
|
}
|
|
323
325
|
function routeToDbComponent(block, kind, resolution, env) {
|
|
324
326
|
if (!isDbSourceResolution(resolution)) return null;
|
|
325
|
-
if (!resolution.
|
|
327
|
+
if (!resolution.hasComponentSource) {
|
|
326
328
|
reportDbRowWithoutSource(kind, env);
|
|
327
329
|
return null;
|
|
328
330
|
}
|
|
@@ -381,6 +383,12 @@ function applyIrKindRoute(block, env, options) {
|
|
|
381
383
|
if (envelope.root.kindState === "pending_schema") return block;
|
|
382
384
|
const def = env.kinds.getDefinition(kind);
|
|
383
385
|
const resolution = env.components.resolve(kind, env.platform, "output");
|
|
386
|
+
if (envelope.root.kindState === "raw") {
|
|
387
|
+
return routeToGeneric(
|
|
388
|
+
block,
|
|
389
|
+
def || resolution ? "broken-instance" : "unregistered"
|
|
390
|
+
);
|
|
391
|
+
}
|
|
384
392
|
const dbRouted = routeToDbComponent(block, kind, resolution, env);
|
|
385
393
|
if (dbRouted) return dbRouted;
|
|
386
394
|
if (def?.legacyBlockType) {
|
|
@@ -413,7 +421,7 @@ function applyIrKindRoute(block, env, options) {
|
|
|
413
421
|
if (def) {
|
|
414
422
|
return routeToGeneric(block, resolution ? "inactive" : "no-component");
|
|
415
423
|
}
|
|
416
|
-
return block;
|
|
424
|
+
return routeToGeneric(block, "unregistered");
|
|
417
425
|
}
|
|
418
426
|
function kindServerDataFromStoredValue(value, env) {
|
|
419
427
|
if (!isRecord(value)) return null;
|
|
@@ -647,7 +655,7 @@ function GenericStructuredView({
|
|
|
647
655
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
648
656
|
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? readObjectKind(value) : null) ?? "";
|
|
649
657
|
const marker = readIrRouteMarker(metadata);
|
|
650
|
-
const note = marker?.reason === "inactive" ? "a custom view is registered but held inactive" : "no custom view yet";
|
|
658
|
+
const note = marker?.reason === "inactive" ? "a custom view is registered but held inactive" : marker?.reason === "broken-instance" ? "this instance did not match the shape's schema" : marker?.reason === "unregistered" ? "this shape isn't registered on this platform" : "no custom view yet";
|
|
651
659
|
return /* @__PURE__ */ jsxs("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
652
660
|
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ jsx("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
|
|
653
661
|
recovered ? host.renderValue({ value, ...kind ? { kind } : {}, note }) : (
|