@mastra/schema-compat 1.3.5 → 1.3.6-alpha.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,11 @@
1
1
  # @mastra/schema-compat
2
2
 
3
+ ## 1.3.6-alpha.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix supervisor agent tool schemas for Gemini via OpenRouter. Properties with no Gemini-compatible type — most commonly `z.any()`, which serializes to an empty schema — are now rewritten into a permissive `anyOf` instead of being dropped. This resolves the misleading `required[N]: property is not defined` error when using Gemini models through OpenRouter as a supervisor agent (fixes #17325), while keeping fields the model is expected to fill (such as `resumeData` for tool suspend/resume) present in the tool contract. ([#17386](https://github.com/mastra-ai/mastra/pull/17386))
8
+
3
9
  ## 1.3.5
4
10
 
5
11
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -5663,7 +5663,8 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
5663
5663
  s["nullable"] = true;
5664
5664
  } else {
5665
5665
  delete s["type"];
5666
- delete s["nullable"];
5666
+ s["anyOf"] = nonNull.map((t) => ({ type: t }));
5667
+ if (hasNull) s["nullable"] = true;
5667
5668
  }
5668
5669
  }
5669
5670
  if (Array.isArray(s["oneOf"])) {
@@ -5693,6 +5694,25 @@ var GoogleSchemaCompatLayer = class extends SchemaCompatLayer {
5693
5694
  s["nullable"] = true;
5694
5695
  }
5695
5696
  }
5697
+ if (!s["type"] && !s["anyOf"] && !s["oneOf"] && !s["allOf"] && !s["$ref"] && !s["enum"] && !s["const"] && !s["properties"] && !s["items"]) {
5698
+ s["anyOf"] = [...[
5699
+ "string",
5700
+ "number",
5701
+ "integer",
5702
+ "boolean",
5703
+ "object"
5704
+ ].map((t) => ({ type: t })), {
5705
+ type: "array",
5706
+ items: { anyOf: [
5707
+ "string",
5708
+ "number",
5709
+ "integer",
5710
+ "boolean",
5711
+ "object"
5712
+ ].map((t) => ({ type: t })) }
5713
+ }];
5714
+ s["nullable"] = true;
5715
+ }
5696
5716
  }
5697
5717
  #traverse(value, schema) {
5698
5718
  const resolved = this.#resolveAnyOf(schema);