@eigenpal/automations 0.20.84 → 0.20.86

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
  # @eigenpal/automations
2
2
 
3
+ ## 0.20.86
4
+
5
+ ### Patch Changes
6
+
7
+ - ab37b58: An agent input or output schema that carries `.meta({ id })` compiles again. With the updated validation library, its JSON Schema root came back as a reference instead of the object, and compiling failed with "Root schema type must be object".
8
+
3
9
  ## 0.20.73
4
10
 
5
11
  ### Patch Changes
package/dist/compiler.js CHANGED
@@ -15,10 +15,25 @@ const portableChecks = new Set([
15
15
  'length_equals',
16
16
  'string_format',
17
17
  ]);
18
+ // zod 4.6 moves a root schema that has `.meta({ id })` into `definitions` and
19
+ // returns only a `$ref` to it. Inline that definition so the root stays the
20
+ // object itself; `definitions` is kept for any self-references.
21
+ function inlineRootRef(json) {
22
+ const prefix = '#/definitions/';
23
+ const definitions = json.definitions;
24
+ if (typeof json.$ref !== 'string' || !json.$ref.startsWith(prefix) || !definitions)
25
+ return json;
26
+ const id = json.$ref.slice(prefix.length).replace(/~1/g, '/').replace(/~0/g, '~');
27
+ const body = definitions[id];
28
+ if (!body || typeof body !== 'object')
29
+ return json;
30
+ const { $ref: _ref, ...rest } = json;
31
+ return { ...rest, ...body };
32
+ }
18
33
  export function compileSchema(schema, field) {
19
34
  try {
20
35
  const json = schema instanceof z.ZodType
21
- ? z.toJSONSchema(schema, {
36
+ ? inlineRootRef(z.toJSONSchema(schema, {
22
37
  target: 'draft-7',
23
38
  io: 'input',
24
39
  unrepresentable: 'throw',
@@ -31,7 +46,7 @@ export function compileSchema(schema, field) {
31
46
  throw new Error('Parsing effects and custom refinements are not portable; use JSON Schema constraints');
32
47
  }
33
48
  },
34
- })
49
+ }))
35
50
  : schema;
36
51
  const parsed = copyJsonSchema(json);
37
52
  if (Object.keys(parsed).length !== 0 && parsed.type !== 'object')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eigenpal/automations",
3
- "version": "0.20.84",
3
+ "version": "0.20.86",
4
4
  "description": "TypeScript definitions for EigenPal agents.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",