@ai-matrx/content-ir-react 0.5.0 → 0.6.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 +29 -0
- package/dist/index.cjs +34 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -4
- package/dist/index.d.ts +22 -4
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -381,6 +381,18 @@ declare class ComponentResolver implements ComponentResolutionSource {
|
|
|
381
381
|
subscribe(listener: () => void): () => void;
|
|
382
382
|
private bumpKind;
|
|
383
383
|
private notifyChanged;
|
|
384
|
+
/**
|
|
385
|
+
* A warm metadata shell is resolved enough for routing, but not for the
|
|
386
|
+
* host's db-component renderer. Its body must still come from the cold
|
|
387
|
+
* single-kind loader.
|
|
388
|
+
*/
|
|
389
|
+
private needsColdFetch;
|
|
390
|
+
/**
|
|
391
|
+
* Cold rows are the authoritative heavy form of warm metadata shells. Keep
|
|
392
|
+
* the same first-row-per-key winner contract, but replace an existing shell
|
|
393
|
+
* so `componentSource` / `propsTransform` can land and repaint the kind.
|
|
394
|
+
*/
|
|
395
|
+
private ingestColdRows;
|
|
384
396
|
/**
|
|
385
397
|
* The eager lightweight single-kind fetch (streaming path): the moment a
|
|
386
398
|
* cloud kind is identified mid-stream, pull ONLY that kind's resolver rows
|
|
@@ -470,10 +482,16 @@ type GenericFallbackReason =
|
|
|
470
482
|
| "generic-row"
|
|
471
483
|
/**
|
|
472
484
|
* The envelope carries a kind-preserved RAW: the payload identified a
|
|
473
|
-
* registered kind
|
|
474
|
-
*
|
|
475
|
-
* component-less — the repair is fixing the
|
|
476
|
-
* floor must acknowledge the kind and
|
|
485
|
+
* registered kind and its value FAILED a check — a schema violation, an
|
|
486
|
+
* array-item kind mismatch, a duplicate key, a contradicted speculation.
|
|
487
|
+
* The instance is BROKEN, not component-less — the repair is fixing the
|
|
488
|
+
* payload or the schema, and the generic floor must acknowledge the kind and
|
|
489
|
+
* surface the recorded problems.
|
|
490
|
+
*
|
|
491
|
+
* NOT this: a kind whose schema was never available (`kindState:
|
|
492
|
+
* "unverified"`). Nothing checked that value, so calling it broken is a
|
|
493
|
+
* false accusation — it routes to its component. The two were one state
|
|
494
|
+
* until 2026-08-29 and conflating them was a platform-wide outage.
|
|
477
495
|
*/
|
|
478
496
|
| "broken-instance"
|
|
479
497
|
/**
|
package/dist/index.js
CHANGED
|
@@ -215,6 +215,35 @@ var ComponentResolver = class {
|
|
|
215
215
|
this.version += 1;
|
|
216
216
|
for (const listener of this.listeners) listener();
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* A warm metadata shell is resolved enough for routing, but not for the
|
|
220
|
+
* host's db-component renderer. Its body must still come from the cold
|
|
221
|
+
* single-kind loader.
|
|
222
|
+
*/
|
|
223
|
+
needsColdFetch(kind, platform, role) {
|
|
224
|
+
const resolution = this.resolve(kind, platform, role);
|
|
225
|
+
return resolution === null || resolution.resolvedBy === "db" && resolution.hasComponentSource && resolution.componentSource === null;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Cold rows are the authoritative heavy form of warm metadata shells. Keep
|
|
229
|
+
* the same first-row-per-key winner contract, but replace an existing shell
|
|
230
|
+
* so `componentSource` / `propsTransform` can land and repaint the kind.
|
|
231
|
+
*/
|
|
232
|
+
ingestColdRows(rows) {
|
|
233
|
+
const winners = /* @__PURE__ */ new Map();
|
|
234
|
+
for (const row of rows) {
|
|
235
|
+
const key = keyOf(row.kind, row.platform, row.role);
|
|
236
|
+
if (!winners.has(key)) winners.set(key, row);
|
|
237
|
+
}
|
|
238
|
+
if (winners.size === 0) return;
|
|
239
|
+
const changedKinds = /* @__PURE__ */ new Set();
|
|
240
|
+
for (const [key, row] of winners) {
|
|
241
|
+
this.db.set(key, row);
|
|
242
|
+
changedKinds.add(row.kind);
|
|
243
|
+
}
|
|
244
|
+
for (const kind of changedKinds) this.bumpKind(kind);
|
|
245
|
+
this.notifyChanged();
|
|
246
|
+
}
|
|
218
247
|
/**
|
|
219
248
|
* The eager lightweight single-kind fetch (streaming path): the moment a
|
|
220
249
|
* cloud kind is identified mid-stream, pull ONLY that kind's resolver rows
|
|
@@ -225,7 +254,7 @@ var ComponentResolver = class {
|
|
|
225
254
|
requestComponent(kind, platform, role) {
|
|
226
255
|
const loadForKind = this.options.loadForKind;
|
|
227
256
|
if (!loadForKind) return;
|
|
228
|
-
if (this.
|
|
257
|
+
if (!this.needsColdFetch(kind, platform, role)) return;
|
|
229
258
|
const missKey = keyOf(kind, platform, role);
|
|
230
259
|
const flightKey = `${kind}${KEY_SEPARATOR}${platform}`;
|
|
231
260
|
if (this.coldInFlight.has(flightKey) || this.coldMisses.has(missKey)) {
|
|
@@ -234,8 +263,10 @@ var ComponentResolver = class {
|
|
|
234
263
|
this.coldInFlight.add(flightKey);
|
|
235
264
|
void (async () => {
|
|
236
265
|
try {
|
|
237
|
-
this.
|
|
238
|
-
if (
|
|
266
|
+
this.ingestColdRows(await loadForKind(kind, platform));
|
|
267
|
+
if (this.needsColdFetch(kind, platform, role)) {
|
|
268
|
+
this.coldMisses.add(missKey);
|
|
269
|
+
}
|
|
239
270
|
} catch (error) {
|
|
240
271
|
this.reportError({
|
|
241
272
|
source: "content-ir",
|