@ai-matrx/content-ir 0.2.1 → 0.3.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 CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0 — 2026-08-29
4
+
5
+ - **KIND PRESERVATION now covers STRUCTURAL raws.** A node that degrades to
6
+ `raw_object` because its value failed schema validation, carried a duplicate
7
+ key, or violated the parent's `itemKinds` keeps its identified kind on the
8
+ raw event, the envelope root (`root.kind` with `kindState: "raw"`), and the
9
+ `nodeIndex` entry for nested children. Previously only schema-availability
10
+ raws preserved the kind, so a payload that was off by ONE field rendered as
11
+ anonymous raw JSON with no repaint subscription and no route — the single
12
+ most damaging class of the 2026-08-29 "kind slips through the cracks" audit
13
+ (crack #9). The render seam's registration boundary is unchanged: an
14
+ unregistered slug is still never claimed. Consumers should route a
15
+ registered kind-preserved raw to their generic floor and surface
16
+ `residue.notices` (the exact `raw_fallback` reason is recorded there).
17
+ Pinned by two new kind-parser tests.
18
+
19
+ ## 0.2.2 — 2026-08-24
20
+
21
+ - `rehydrateRunResult` now rejects nested entries whose `__kind` is not
22
+ `node_outcome`, even when the object carries plausible run/node identity.
23
+ This keeps a malformed sibling from masquerading as a valid terminal result.
24
+ - Workflow Studio now delegates runtime-wrapper field reading and output-ref
25
+ rehydration to the package APIs; its host adapter retains only deferred,
26
+ persistent diagnostics for present-but-broken wrappers.
27
+
3
28
  ## 0.2.1 — 2026-08-24
4
29
 
5
30
  - **FIX — `validateStructuralLeg` no longer rejects every current kind
package/dist/index.cjs CHANGED
@@ -390,7 +390,11 @@ var IrTree = class {
390
390
  }
391
391
  for (const [pathKey] of this.rawPaths) {
392
392
  if (pathKey === "") continue;
393
- nodeIndex[pathKey] = { kind: "", kindState: "raw", status: "complete" };
393
+ nodeIndex[pathKey] = {
394
+ kind: this.rawKinds.get(pathKey) ?? "",
395
+ kindState: "raw",
396
+ status: "complete"
397
+ };
394
398
  }
395
399
  return {
396
400
  v: IR_VERSION,
@@ -905,7 +909,7 @@ var KindStreamParser = class {
905
909
  * Recorded at the first root key; ADOPTED only when the root object closes
906
910
  * (`completeTypedObject`). That is the surface registry's complete-only
907
911
  * convergence law, and every json_root_key row is `streaming:false` — these
908
- * legacy shapes are recognised by their whole payload, so speculating
912
+ * legacy shapes are recognized by their whole payload, so speculating
909
913
  * mid-stream would flash a kind component over an object that may never
910
914
  * satisfy the schema. An explicit `expectedRootKind` (an agent's declared
911
915
  * output schema) is stronger context and always wins; an actual `__kind`
@@ -1314,12 +1318,12 @@ var KindStreamParser = class {
1314
1318
  }
1315
1319
  const arrayItemError = this.validateArrayItemKind(path, kind);
1316
1320
  if (arrayItemError) {
1317
- this.emitRawObject(path, objectValue, arrayItemError, at);
1321
+ this.emitRawObject(path, objectValue, arrayItemError, at, kind);
1318
1322
  return;
1319
1323
  }
1320
1324
  const outcome = this.validateObjectAgainstSchema(objectValue, schema);
1321
1325
  if (outcome.error) {
1322
- this.emitRawObject(path, objectValue, outcome.error, at);
1326
+ this.emitRawObject(path, objectValue, outcome.error, at, kind);
1323
1327
  return;
1324
1328
  }
1325
1329
  this.objectKinds.set(pathKey, kind);
@@ -1351,7 +1355,7 @@ var KindStreamParser = class {
1351
1355
  schema
1352
1356
  );
1353
1357
  if (outcome.error) {
1354
- this.emitRawObject(path, objectValue, outcome.error, at);
1358
+ this.emitRawObject(path, objectValue, outcome.error, at, kind);
1355
1359
  return;
1356
1360
  }
1357
1361
  this.emitSchemaNotices(path, kind, outcome, at);
@@ -1411,8 +1415,9 @@ var KindStreamParser = class {
1411
1415
  markNodeRaw(path, liveValue, reason, at) {
1412
1416
  const pathKey = this.pathKey(path);
1413
1417
  if (this.rawObjectPaths.has(pathKey)) return;
1418
+ const identifiedKind = this.objectKinds.get(pathKey) ?? (typeof liveValue === "object" && liveValue !== null && !Array.isArray(liveValue) ? readObjectKind(liveValue) ?? void 0 : void 0);
1414
1419
  this.speculativeKinds.delete(pathKey);
1415
- this.emitRawObject(path, safeCopy(liveValue), reason, at);
1420
+ this.emitRawObject(path, safeCopy(liveValue), reason, at, identifiedKind);
1416
1421
  }
1417
1422
  emitRawObject(path, value, reason, at, identifiedKind) {
1418
1423
  const pathKey = this.pathKey(path);
@@ -4376,7 +4381,7 @@ function rehydrateRunResult(raw, frame) {
4376
4381
  if (raw[KIND_KEY] !== RUN_RESULT_KIND) return null;
4377
4382
  const ref = str(raw, "output_ref");
4378
4383
  const resolved = ref === null ? void 0 : readOutputRef(frame, ref);
4379
- const outputs = Array.isArray(raw.outputs) ? raw.outputs.map((child) => rehydrateNodeOutcome(child, frame) ?? child) : [];
4384
+ const outputs = Array.isArray(raw.outputs) ? raw.outputs.map((child) => rehydrateNodeOutcome(child, frame)).filter((child) => child !== null) : [];
4380
4385
  return readRunResultValue({
4381
4386
  ...raw,
4382
4387
  ...resolved === void 0 ? {} : { output: resolved },