@ai-matrx/content-ir 0.2.2 → 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/dist/index.d.cts CHANGED
@@ -462,7 +462,7 @@ declare class KindStreamParser {
462
462
  * Recorded at the first root key; ADOPTED only when the root object closes
463
463
  * (`completeTypedObject`). That is the surface registry's complete-only
464
464
  * convergence law, and every json_root_key row is `streaming:false` — these
465
- * legacy shapes are recognised by their whole payload, so speculating
465
+ * legacy shapes are recognized by their whole payload, so speculating
466
466
  * mid-stream would flash a kind component over an object that may never
467
467
  * satisfy the schema. An explicit `expectedRootKind` (an agent's declared
468
468
  * output schema) is stronger context and always wins; an actual `__kind`
@@ -877,7 +877,7 @@ declare function envelopeCacheFromEnvelopes(envelopes: readonly CanonicalBlockIR
877
877
  *
878
878
  * The frontend host shell is `redux/render-block-envelope.ts` (binds the
879
879
  * hooks to `seedEnvelope` + `captureError`); aidream's Workflow Studio binds
880
- * its own. Contract: features/content-ir/docs/PYTHON_ENVELOPE_CONTRACT.md.
880
+ * its own. Contract: /Users/armanisadeghi/code/common-docs/systems/content-ir-system/PYTHON_ENVELOPE_CONTRACT.md.
881
881
  */
882
882
 
883
883
  /** Read a CanonicalBlockIR envelope off a block's metadata (or anything). */
@@ -1194,7 +1194,7 @@ interface KindDefinition {
1194
1194
  * edges → the same `KindSchema` the parser/emitter consume, re-attaching
1195
1195
  * `object.kind` / `array.itemKinds` from the edges by path.
1196
1196
  *
1197
- * Design invariants (KIND_REGISTRY_STORAGE.md §4):
1197
+ * Design invariants (from the 2026-07-05 kind-registry storage design, since deleted):
1198
1198
  * - The `data` element is `FieldSchema` + `name`, MINUS ref targets. Order is
1199
1199
  * intrinsic to the array (fixes the jsonb key-reorder bug).
1200
1200
  * - `kind_edge` is the SINGLE source of truth for kind→kind refs: `object`
@@ -1334,7 +1334,7 @@ declare function storageToKindSchema(kind: string, shape: KindStorageShape): Kin
1334
1334
  * row out of production. This module is PURE (deps injected) so it runs in the
1335
1335
  * harness, in CI, and in a browser author-save alike.
1336
1336
  *
1337
- * Ownership split (KIND_REGISTRY_STORAGE.md §2): the caller writes the outcome
1337
+ * Ownership split (the 2026-07-05 kind-registry storage design, since deleted; the live contract is the code below): the caller writes the outcome
1338
1338
  * to the LIVE `content_ir.kind_definition` row's `is_active`; the canonical
1339
1339
  * `_version_capture` trigger snapshots that state into `history.row_versions`
1340
1340
  * (never a post-hoc history mutation).
package/dist/index.d.ts CHANGED
@@ -462,7 +462,7 @@ declare class KindStreamParser {
462
462
  * Recorded at the first root key; ADOPTED only when the root object closes
463
463
  * (`completeTypedObject`). That is the surface registry's complete-only
464
464
  * convergence law, and every json_root_key row is `streaming:false` — these
465
- * legacy shapes are recognised by their whole payload, so speculating
465
+ * legacy shapes are recognized by their whole payload, so speculating
466
466
  * mid-stream would flash a kind component over an object that may never
467
467
  * satisfy the schema. An explicit `expectedRootKind` (an agent's declared
468
468
  * output schema) is stronger context and always wins; an actual `__kind`
@@ -877,7 +877,7 @@ declare function envelopeCacheFromEnvelopes(envelopes: readonly CanonicalBlockIR
877
877
  *
878
878
  * The frontend host shell is `redux/render-block-envelope.ts` (binds the
879
879
  * hooks to `seedEnvelope` + `captureError`); aidream's Workflow Studio binds
880
- * its own. Contract: features/content-ir/docs/PYTHON_ENVELOPE_CONTRACT.md.
880
+ * its own. Contract: /Users/armanisadeghi/code/common-docs/systems/content-ir-system/PYTHON_ENVELOPE_CONTRACT.md.
881
881
  */
882
882
 
883
883
  /** Read a CanonicalBlockIR envelope off a block's metadata (or anything). */
@@ -1194,7 +1194,7 @@ interface KindDefinition {
1194
1194
  * edges → the same `KindSchema` the parser/emitter consume, re-attaching
1195
1195
  * `object.kind` / `array.itemKinds` from the edges by path.
1196
1196
  *
1197
- * Design invariants (KIND_REGISTRY_STORAGE.md §4):
1197
+ * Design invariants (from the 2026-07-05 kind-registry storage design, since deleted):
1198
1198
  * - The `data` element is `FieldSchema` + `name`, MINUS ref targets. Order is
1199
1199
  * intrinsic to the array (fixes the jsonb key-reorder bug).
1200
1200
  * - `kind_edge` is the SINGLE source of truth for kind→kind refs: `object`
@@ -1334,7 +1334,7 @@ declare function storageToKindSchema(kind: string, shape: KindStorageShape): Kin
1334
1334
  * row out of production. This module is PURE (deps injected) so it runs in the
1335
1335
  * harness, in CI, and in a browser author-save alike.
1336
1336
  *
1337
- * Ownership split (KIND_REGISTRY_STORAGE.md §2): the caller writes the outcome
1337
+ * Ownership split (the 2026-07-05 kind-registry storage design, since deleted; the live contract is the code below): the caller writes the outcome
1338
1338
  * to the LIVE `content_ir.kind_definition` row's `is_active`; the canonical
1339
1339
  * `_version_capture` trigger snapshots that state into `history.row_versions`
1340
1340
  * (never a post-hoc history mutation).
package/dist/index.js CHANGED
@@ -384,7 +384,11 @@ var IrTree = class {
384
384
  }
385
385
  for (const [pathKey] of this.rawPaths) {
386
386
  if (pathKey === "") continue;
387
- nodeIndex[pathKey] = { kind: "", kindState: "raw", status: "complete" };
387
+ nodeIndex[pathKey] = {
388
+ kind: this.rawKinds.get(pathKey) ?? "",
389
+ kindState: "raw",
390
+ status: "complete"
391
+ };
388
392
  }
389
393
  return {
390
394
  v: IR_VERSION,
@@ -899,7 +903,7 @@ var KindStreamParser = class {
899
903
  * Recorded at the first root key; ADOPTED only when the root object closes
900
904
  * (`completeTypedObject`). That is the surface registry's complete-only
901
905
  * convergence law, and every json_root_key row is `streaming:false` — these
902
- * legacy shapes are recognised by their whole payload, so speculating
906
+ * legacy shapes are recognized by their whole payload, so speculating
903
907
  * mid-stream would flash a kind component over an object that may never
904
908
  * satisfy the schema. An explicit `expectedRootKind` (an agent's declared
905
909
  * output schema) is stronger context and always wins; an actual `__kind`
@@ -1308,12 +1312,12 @@ var KindStreamParser = class {
1308
1312
  }
1309
1313
  const arrayItemError = this.validateArrayItemKind(path, kind);
1310
1314
  if (arrayItemError) {
1311
- this.emitRawObject(path, objectValue, arrayItemError, at);
1315
+ this.emitRawObject(path, objectValue, arrayItemError, at, kind);
1312
1316
  return;
1313
1317
  }
1314
1318
  const outcome = this.validateObjectAgainstSchema(objectValue, schema);
1315
1319
  if (outcome.error) {
1316
- this.emitRawObject(path, objectValue, outcome.error, at);
1320
+ this.emitRawObject(path, objectValue, outcome.error, at, kind);
1317
1321
  return;
1318
1322
  }
1319
1323
  this.objectKinds.set(pathKey, kind);
@@ -1345,7 +1349,7 @@ var KindStreamParser = class {
1345
1349
  schema
1346
1350
  );
1347
1351
  if (outcome.error) {
1348
- this.emitRawObject(path, objectValue, outcome.error, at);
1352
+ this.emitRawObject(path, objectValue, outcome.error, at, kind);
1349
1353
  return;
1350
1354
  }
1351
1355
  this.emitSchemaNotices(path, kind, outcome, at);
@@ -1405,8 +1409,9 @@ var KindStreamParser = class {
1405
1409
  markNodeRaw(path, liveValue, reason, at) {
1406
1410
  const pathKey = this.pathKey(path);
1407
1411
  if (this.rawObjectPaths.has(pathKey)) return;
1412
+ const identifiedKind = this.objectKinds.get(pathKey) ?? (typeof liveValue === "object" && liveValue !== null && !Array.isArray(liveValue) ? readObjectKind(liveValue) ?? void 0 : void 0);
1408
1413
  this.speculativeKinds.delete(pathKey);
1409
- this.emitRawObject(path, safeCopy(liveValue), reason, at);
1414
+ this.emitRawObject(path, safeCopy(liveValue), reason, at, identifiedKind);
1410
1415
  }
1411
1416
  emitRawObject(path, value, reason, at, identifiedKind) {
1412
1417
  const pathKey = this.pathKey(path);