@ai-matrx/content-ir 0.19.20 → 0.19.25

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.
@@ -91,7 +91,7 @@ interface KindDefinition {
91
91
  * throws anyway is caught, screams, and permanently drops this kind back to
92
92
  * withhold for the session.
93
93
  *
94
- * Contract: common-docs/systems/content-ir-system/STREAMING_PARTIAL_KINDS.md
94
+ * Contract: common-docs/systems/architecture/content-ir/STREAMING_PARTIAL_KINDS.md
95
95
  */
96
96
  partialReady?: boolean;
97
97
  /**
@@ -91,7 +91,7 @@ interface KindDefinition {
91
91
  * throws anyway is caught, screams, and permanently drops this kind back to
92
92
  * withhold for the session.
93
93
  *
94
- * Contract: common-docs/systems/content-ir-system/STREAMING_PARTIAL_KINDS.md
94
+ * Contract: common-docs/systems/architecture/content-ir/STREAMING_PARTIAL_KINDS.md
95
95
  */
96
96
  partialReady?: boolean;
97
97
  /**
package/dist/session.cjs CHANGED
@@ -1255,7 +1255,7 @@ var KindStreamParser = class {
1255
1255
  }
1256
1256
  if (!declaredKind && committedKind && this.speculativeKinds.has(pathKey)) {
1257
1257
  this.speculativeKinds.delete(pathKey);
1258
- this.finalizeSpeculatedObject(path, objectValue, committedKind, at);
1258
+ this.finalizeSpeculatedObject(path, objectValue, committedKind, at, true);
1259
1259
  return;
1260
1260
  }
1261
1261
  if (path.length === 0 && !declaredKind && !committedKind && this.rootSurfaceKind) {
@@ -1333,7 +1333,7 @@ var KindStreamParser = class {
1333
1333
  });
1334
1334
  }
1335
1335
  /** Validate + complete an object typed purely by parent prediction. */
1336
- finalizeSpeculatedObject(path, objectValue, kind, at) {
1336
+ finalizeSpeculatedObject(path, objectValue, kind, at, requireSharedField = false) {
1337
1337
  const schema = this.lookupSchema(kind);
1338
1338
  if (!schema) {
1339
1339
  this.emitRawObject(
@@ -1346,6 +1346,15 @@ var KindStreamParser = class {
1346
1346
  );
1347
1347
  return;
1348
1348
  }
1349
+ if (requireSharedField && !Object.keys(objectValue).some((key) => key in schema.fields)) {
1350
+ this.emitRawObject(
1351
+ path,
1352
+ objectValue,
1353
+ `Object carries none of "${kind}"'s fields.`,
1354
+ at
1355
+ );
1356
+ return;
1357
+ }
1349
1358
  const outcome = this.validateObjectAgainstSchema(
1350
1359
  { ...objectValue, [KIND_KEY]: kind },
1351
1360
  schema
@@ -1606,16 +1615,7 @@ var KindStreamParser = class {
1606
1615
  ...emptyOutcome
1607
1616
  };
1608
1617
  }
1609
- for (const [fieldName, fieldSchema] of Object.entries(schema.fields)) {
1610
- if (fieldSchema.required) {
1611
- if (!(fieldName in objectValue)) {
1612
- return {
1613
- error: `Kind "${schema.kind}" is missing required field "${fieldName}".`,
1614
- ...emptyOutcome
1615
- };
1616
- }
1617
- continue;
1618
- }
1618
+ for (const fieldName of Object.keys(schema.fields)) {
1619
1619
  if (!(fieldName in objectValue)) {
1620
1620
  optionalMissing.push(fieldName);
1621
1621
  }
@@ -1822,17 +1822,7 @@ var KindStreamParser = class {
1822
1822
  validateObjectAgainstFields(objectValue, fields) {
1823
1823
  const optionalMissing = [];
1824
1824
  const extraFields = [];
1825
- const emptyOutcome = { optionalMissing, extraFields };
1826
- for (const [fieldName, fieldSchema] of Object.entries(fields)) {
1827
- if (fieldSchema.required) {
1828
- if (!(fieldName in objectValue)) {
1829
- return {
1830
- error: `Inline object is missing required field "${fieldName}".`,
1831
- ...emptyOutcome
1832
- };
1833
- }
1834
- continue;
1835
- }
1825
+ for (const fieldName of Object.keys(fields)) {
1836
1826
  if (!(fieldName in objectValue)) {
1837
1827
  optionalMissing.push(fieldName);
1838
1828
  }