@ai-matrx/content-ir-react 0.1.0 → 0.4.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 +24 -0
- package/dist/index.cjs +11 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -3
- package/dist/index.d.ts +40 -3
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -42,8 +42,19 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
|
|
|
42
42
|
*/
|
|
43
43
|
/** JSON object, restated locally so this package depends on no host type. */
|
|
44
44
|
type JsonObject = Record<string, unknown>;
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Which face of the shape a component draws.
|
|
47
|
+
*
|
|
48
|
+
* - `output` — the shape's finished value, the component a reader sees.
|
|
49
|
+
* - `input` — the authoring form for a value of this shape.
|
|
50
|
+
* - `loading` — the shape's LOADING face: what renders from the instant the
|
|
51
|
+
* kind is identified until its output component has a renderable frame.
|
|
52
|
+
* Authored per kind like any other component and fed the region's partial
|
|
53
|
+
* value each frame, so it can PERFORM the arrival (surface real text as it
|
|
54
|
+
* lands) instead of drawing a shapeless skeleton. Optional: a kind with no
|
|
55
|
+
* `loading` component falls back to the host's loading library.
|
|
56
|
+
*/
|
|
57
|
+
type ComponentRole = "output" | "input" | "loading";
|
|
47
58
|
/**
|
|
48
59
|
* One `content_ir.kind_component` row, projected to exactly what rendering
|
|
49
60
|
* needs. Hosts map their own query result onto this.
|
|
@@ -430,7 +441,33 @@ type GenericFallbackReason =
|
|
|
430
441
|
/** No compiled bridge and no `content_ir.kind_component` row at all. */
|
|
431
442
|
"no-component"
|
|
432
443
|
/** A component row exists but is held `is_active = false`. */
|
|
433
|
-
| "inactive"
|
|
444
|
+
| "inactive"
|
|
445
|
+
/**
|
|
446
|
+
* An ACTIVE component row exists and names `generic_structured` — i.e. the
|
|
447
|
+
* fallback, registered under a component's name. This reads as coverage to
|
|
448
|
+
* every count-the-rows check on the platform and is not: the reader still
|
|
449
|
+
* gets a key/value dump. Kept as its own reason because the repair differs
|
|
450
|
+
* (author a component AND retire the decoy row), and because a page that
|
|
451
|
+
* silently marked itself `by: "bundled"` here is how 226 of 428 active
|
|
452
|
+
* kinds came to be certified as renderable while rendering generically
|
|
453
|
+
* (found 2026-08-23).
|
|
454
|
+
*/
|
|
455
|
+
| "generic-row"
|
|
456
|
+
/**
|
|
457
|
+
* The envelope carries a kind-preserved RAW: the payload identified a
|
|
458
|
+
* registered kind but its value failed the schema (or the schema never
|
|
459
|
+
* arrived before the region closed). The instance is BROKEN, not
|
|
460
|
+
* component-less — the repair is fixing the payload/schema, and the generic
|
|
461
|
+
* floor must acknowledge the kind and surface the recorded problems.
|
|
462
|
+
*/
|
|
463
|
+
| "broken-instance"
|
|
464
|
+
/**
|
|
465
|
+
* The slug is not in the registry at all (typo, foreign emitter, a shape
|
|
466
|
+
* not yet created). Routed anyway — Arman's 2026-08-29 ruling: a root
|
|
467
|
+
* `__kind` key means the kind system owns the render, no exceptions. The
|
|
468
|
+
* repair is creating/registering the shape (or fixing the slug).
|
|
469
|
+
*/
|
|
470
|
+
| "unregistered";
|
|
434
471
|
interface IrRouteMarker {
|
|
435
472
|
by: ComponentResolution["resolvedBy"] | "generic";
|
|
436
473
|
key: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -42,8 +42,19 @@ declare const consoleErrorReporter: ContentIrErrorReporter;
|
|
|
42
42
|
*/
|
|
43
43
|
/** JSON object, restated locally so this package depends on no host type. */
|
|
44
44
|
type JsonObject = Record<string, unknown>;
|
|
45
|
-
/**
|
|
46
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Which face of the shape a component draws.
|
|
47
|
+
*
|
|
48
|
+
* - `output` — the shape's finished value, the component a reader sees.
|
|
49
|
+
* - `input` — the authoring form for a value of this shape.
|
|
50
|
+
* - `loading` — the shape's LOADING face: what renders from the instant the
|
|
51
|
+
* kind is identified until its output component has a renderable frame.
|
|
52
|
+
* Authored per kind like any other component and fed the region's partial
|
|
53
|
+
* value each frame, so it can PERFORM the arrival (surface real text as it
|
|
54
|
+
* lands) instead of drawing a shapeless skeleton. Optional: a kind with no
|
|
55
|
+
* `loading` component falls back to the host's loading library.
|
|
56
|
+
*/
|
|
57
|
+
type ComponentRole = "output" | "input" | "loading";
|
|
47
58
|
/**
|
|
48
59
|
* One `content_ir.kind_component` row, projected to exactly what rendering
|
|
49
60
|
* needs. Hosts map their own query result onto this.
|
|
@@ -430,7 +441,33 @@ type GenericFallbackReason =
|
|
|
430
441
|
/** No compiled bridge and no `content_ir.kind_component` row at all. */
|
|
431
442
|
"no-component"
|
|
432
443
|
/** A component row exists but is held `is_active = false`. */
|
|
433
|
-
| "inactive"
|
|
444
|
+
| "inactive"
|
|
445
|
+
/**
|
|
446
|
+
* An ACTIVE component row exists and names `generic_structured` — i.e. the
|
|
447
|
+
* fallback, registered under a component's name. This reads as coverage to
|
|
448
|
+
* every count-the-rows check on the platform and is not: the reader still
|
|
449
|
+
* gets a key/value dump. Kept as its own reason because the repair differs
|
|
450
|
+
* (author a component AND retire the decoy row), and because a page that
|
|
451
|
+
* silently marked itself `by: "bundled"` here is how 226 of 428 active
|
|
452
|
+
* kinds came to be certified as renderable while rendering generically
|
|
453
|
+
* (found 2026-08-23).
|
|
454
|
+
*/
|
|
455
|
+
| "generic-row"
|
|
456
|
+
/**
|
|
457
|
+
* The envelope carries a kind-preserved RAW: the payload identified a
|
|
458
|
+
* registered kind but its value failed the schema (or the schema never
|
|
459
|
+
* arrived before the region closed). The instance is BROKEN, not
|
|
460
|
+
* component-less — the repair is fixing the payload/schema, and the generic
|
|
461
|
+
* floor must acknowledge the kind and surface the recorded problems.
|
|
462
|
+
*/
|
|
463
|
+
| "broken-instance"
|
|
464
|
+
/**
|
|
465
|
+
* The slug is not in the registry at all (typo, foreign emitter, a shape
|
|
466
|
+
* not yet created). Routed anyway — Arman's 2026-08-29 ruling: a root
|
|
467
|
+
* `__kind` key means the kind system owns the render, no exceptions. The
|
|
468
|
+
* repair is creating/registering the shape (or fixing the slug).
|
|
469
|
+
*/
|
|
470
|
+
| "unregistered";
|
|
434
471
|
interface IrRouteMarker {
|
|
435
472
|
by: ComponentResolution["resolvedBy"] | "generic";
|
|
436
473
|
key: string;
|
package/dist/index.js
CHANGED
|
@@ -381,6 +381,12 @@ function applyIrKindRoute(block, env, options) {
|
|
|
381
381
|
if (envelope.root.kindState === "pending_schema") return block;
|
|
382
382
|
const def = env.kinds.getDefinition(kind);
|
|
383
383
|
const resolution = env.components.resolve(kind, env.platform, "output");
|
|
384
|
+
if (envelope.root.kindState === "raw") {
|
|
385
|
+
return routeToGeneric(
|
|
386
|
+
block,
|
|
387
|
+
def || resolution ? "broken-instance" : "unregistered"
|
|
388
|
+
);
|
|
389
|
+
}
|
|
384
390
|
const dbRouted = routeToDbComponent(block, kind, resolution, env);
|
|
385
391
|
if (dbRouted) return dbRouted;
|
|
386
392
|
if (def?.legacyBlockType) {
|
|
@@ -397,6 +403,9 @@ function applyIrKindRoute(block, env, options) {
|
|
|
397
403
|
};
|
|
398
404
|
}
|
|
399
405
|
if (resolution?.isActive) {
|
|
406
|
+
if (resolution.componentKey === GENERIC_STRUCTURED_COMPONENT_KEY) {
|
|
407
|
+
return routeToGeneric(block, "generic-row");
|
|
408
|
+
}
|
|
400
409
|
if (block.type === resolution.componentKey) return block;
|
|
401
410
|
return {
|
|
402
411
|
...block,
|
|
@@ -410,7 +419,7 @@ function applyIrKindRoute(block, env, options) {
|
|
|
410
419
|
if (def) {
|
|
411
420
|
return routeToGeneric(block, resolution ? "inactive" : "no-component");
|
|
412
421
|
}
|
|
413
|
-
return block;
|
|
422
|
+
return routeToGeneric(block, "unregistered");
|
|
414
423
|
}
|
|
415
424
|
function kindServerDataFromStoredValue(value, env) {
|
|
416
425
|
if (!isRecord(value)) return null;
|
|
@@ -644,7 +653,7 @@ function GenericStructuredView({
|
|
|
644
653
|
const { value, recovered } = readStructuredValue(content, metadata);
|
|
645
654
|
const kind = envelope?.root.kind ?? (typeof value === "object" && value !== null && !Array.isArray(value) ? readObjectKind(value) : null) ?? "";
|
|
646
655
|
const marker = readIrRouteMarker(metadata);
|
|
647
|
-
const note = marker?.reason === "inactive" ? "a custom view is registered but held inactive" : "no custom view yet";
|
|
656
|
+
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";
|
|
648
657
|
return /* @__PURE__ */ jsxs("div", { className: className ? `my-2 min-w-0 ${className}` : "my-2 min-w-0", children: [
|
|
649
658
|
status === "streaming" ? streamingIndicator ?? /* @__PURE__ */ jsx("div", { className: "mb-2 text-xs text-muted-foreground", children: "Still arriving\u2026" }) : null,
|
|
650
659
|
recovered ? host.renderValue({ value, ...kind ? { kind } : {}, note }) : (
|