@copilotkit/shared 2.0.0-rc.7 → 2.0.0-rc.9

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.
Files changed (100) hide show
  1. package/README.md +3 -14
  2. package/dist/index.cjs +1 -2
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +3 -4
  5. package/dist/index.d.cts.map +1 -1
  6. package/dist/index.d.mts +3 -4
  7. package/dist/index.d.mts.map +1 -1
  8. package/dist/index.mjs +3 -3
  9. package/dist/index.mjs.map +1 -1
  10. package/dist/index.umd.js +25 -95
  11. package/dist/index.umd.js.map +1 -1
  12. package/dist/package.cjs +1 -1
  13. package/dist/package.mjs +1 -1
  14. package/dist/standard-schema.cjs +20 -7
  15. package/dist/standard-schema.cjs.map +1 -1
  16. package/dist/standard-schema.d.cts +15 -16
  17. package/dist/standard-schema.d.cts.map +1 -1
  18. package/dist/standard-schema.d.mts +15 -16
  19. package/dist/standard-schema.d.mts.map +1 -1
  20. package/dist/standard-schema.mjs +20 -8
  21. package/dist/standard-schema.mjs.map +1 -1
  22. package/dist/telemetry/telemetry-disabled.cjs +0 -5
  23. package/dist/telemetry/telemetry-disabled.cjs.map +1 -1
  24. package/dist/telemetry/telemetry-disabled.d.cts +0 -5
  25. package/dist/telemetry/telemetry-disabled.d.cts.map +1 -1
  26. package/dist/telemetry/telemetry-disabled.d.mts +0 -5
  27. package/dist/telemetry/telemetry-disabled.d.mts.map +1 -1
  28. package/dist/telemetry/telemetry-disabled.mjs +0 -5
  29. package/dist/telemetry/telemetry-disabled.mjs.map +1 -1
  30. package/dist/utils/index.d.cts +1 -1
  31. package/dist/utils/index.d.mts +1 -1
  32. package/dist/utils/index.mjs +1 -1
  33. package/dist/utils/json-schema.cjs +0 -79
  34. package/dist/utils/json-schema.cjs.map +1 -1
  35. package/dist/utils/json-schema.d.cts +1 -4
  36. package/dist/utils/json-schema.d.cts.map +1 -1
  37. package/dist/utils/json-schema.d.mts +1 -4
  38. package/dist/utils/json-schema.d.mts.map +1 -1
  39. package/dist/utils/json-schema.mjs +1 -78
  40. package/dist/utils/json-schema.mjs.map +1 -1
  41. package/package.json +7 -28
  42. package/src/__tests__/root-entry-browser-safety.test.ts +5 -7
  43. package/src/__tests__/standard-schema.test.ts +61 -101
  44. package/src/index.ts +3 -16
  45. package/src/standard-schema.ts +24 -27
  46. package/src/telemetry/telemetry-disabled.ts +0 -5
  47. package/src/utils/__tests__/json-schema.test.ts +3 -479
  48. package/src/utils/json-schema.ts +1 -152
  49. package/tsdown.config.ts +2 -10
  50. package/dist/event-transforms/index.cjs +0 -15
  51. package/dist/event-transforms/index.d.cts +0 -4
  52. package/dist/event-transforms/index.d.mts +0 -4
  53. package/dist/event-transforms/index.mjs +0 -5
  54. package/dist/event-transforms/open-generative-ui-middleware.cjs +0 -286
  55. package/dist/event-transforms/open-generative-ui-middleware.cjs.map +0 -1
  56. package/dist/event-transforms/open-generative-ui-middleware.d.cts +0 -60
  57. package/dist/event-transforms/open-generative-ui-middleware.d.cts.map +0 -1
  58. package/dist/event-transforms/open-generative-ui-middleware.d.mts +0 -60
  59. package/dist/event-transforms/open-generative-ui-middleware.d.mts.map +0 -1
  60. package/dist/event-transforms/open-generative-ui-middleware.mjs +0 -283
  61. package/dist/event-transforms/open-generative-ui-middleware.mjs.map +0 -1
  62. package/dist/event-transforms/recorded-events.cjs +0 -59
  63. package/dist/event-transforms/recorded-events.cjs.map +0 -1
  64. package/dist/event-transforms/recorded-events.d.cts +0 -23
  65. package/dist/event-transforms/recorded-events.d.cts.map +0 -1
  66. package/dist/event-transforms/recorded-events.d.mts +0 -23
  67. package/dist/event-transforms/recorded-events.d.mts.map +0 -1
  68. package/dist/event-transforms/recorded-events.mjs +0 -58
  69. package/dist/event-transforms/recorded-events.mjs.map +0 -1
  70. package/dist/telemetry/events.d.cts +0 -72
  71. package/dist/telemetry/events.d.cts.map +0 -1
  72. package/dist/telemetry/events.d.mts +0 -72
  73. package/dist/telemetry/events.d.mts.map +0 -1
  74. package/dist/telemetry/index.cjs +0 -18
  75. package/dist/telemetry/index.d.cts +0 -5
  76. package/dist/telemetry/index.d.mts +0 -5
  77. package/dist/telemetry/index.mjs +0 -6
  78. package/dist/telemetry/telemetry-client.cjs +0 -165
  79. package/dist/telemetry/telemetry-client.cjs.map +0 -1
  80. package/dist/telemetry/telemetry-client.d.cts +0 -87
  81. package/dist/telemetry/telemetry-client.d.cts.map +0 -1
  82. package/dist/telemetry/telemetry-client.d.mts +0 -87
  83. package/dist/telemetry/telemetry-client.d.mts.map +0 -1
  84. package/dist/telemetry/telemetry-client.mjs +0 -164
  85. package/dist/telemetry/telemetry-client.mjs.map +0 -1
  86. package/dist/telemetry/utils.cjs +0 -14
  87. package/dist/telemetry/utils.cjs.map +0 -1
  88. package/dist/telemetry/utils.mjs +0 -13
  89. package/dist/telemetry/utils.mjs.map +0 -1
  90. package/src/__tests__/zod-regression.test.ts +0 -319
  91. package/src/event-transforms/index.ts +0 -5
  92. package/src/event-transforms/open-generative-ui-middleware.ts +0 -392
  93. package/src/event-transforms/recorded-events.test.ts +0 -166
  94. package/src/event-transforms/recorded-events.ts +0 -74
  95. package/src/telemetry/events.ts +0 -68
  96. package/src/telemetry/index.ts +0 -9
  97. package/src/telemetry/telemetry-blank-license-identity.test.ts +0 -128
  98. package/src/telemetry/telemetry-client.test.ts +0 -798
  99. package/src/telemetry/telemetry-client.ts +0 -328
  100. package/src/telemetry/utils.ts +0 -15
package/dist/package.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
  //#region package.json
3
- var version = "2.0.0-rc.7";
3
+ var version = "2.0.0-rc.9";
4
4
 
5
5
  //#endregion
6
6
  Object.defineProperty(exports, 'version', {
package/dist/package.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "2.0.0-rc.7";
2
+ var version = "2.0.0-rc.9";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1,6 +1,18 @@
1
1
 
2
2
  //#region src/standard-schema.ts
3
3
  /**
4
+ * A Standard Schema that accepts any value and returns it unchanged.
5
+ *
6
+ * Wildcard tool call renderers use it when they declare no `args` schema.
7
+ *
8
+ * @internal Application authors must not depend on this contract.
9
+ */
10
+ const ɵanySchema = { "~standard": {
11
+ version: 1,
12
+ vendor: "copilotkit",
13
+ validate: (value) => ({ value })
14
+ } };
15
+ /**
4
16
  * Check whether a schema implements the Standard JSON Schema V1 protocol.
5
17
  */
6
18
  function hasStandardJsonSchema(schema) {
@@ -13,19 +25,20 @@ function hasStandardJsonSchema(schema) {
13
25
  * Strategy:
14
26
  * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
15
27
  * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
16
- * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.
17
- * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the
18
- * injected `zodToJsonSchema()` function.
19
- * 4. Otherwise throw a descriptive error.
28
+ * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.
29
+ * 2. If the schema exposes a `toJSONSchema()` method, call it directly.
30
+ * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they
31
+ * implement Standard Schema validation but cannot describe themselves as
32
+ * JSON Schema.
20
33
  */
21
- function schemaToJsonSchema(schema, options) {
34
+ function schemaToJsonSchema(schema) {
22
35
  if (hasStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-07" });
23
36
  if (typeof schema.toJSONSchema === "function") return schema.toJSONSchema();
24
37
  const vendor = schema["~standard"].vendor;
25
- if (vendor === "zod" && options?.zodToJsonSchema) return options.zodToJsonSchema(schema, { $refStrategy: "none" });
26
- throw new Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1 and no zodToJsonSchema fallback is available. Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) or pass a zodToJsonSchema function in options.`);
38
+ throw new Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1. Use a library that does: Zod 4.2+ (Zod 3 is not supported), Valibot v1+ wrapped with toStandardJsonSchema() from @valibot/to-json-schema, or ArkType v2.1.28+.`);
27
39
  }
28
40
 
29
41
  //#endregion
30
42
  exports.schemaToJsonSchema = schemaToJsonSchema;
43
+ exports.ɵanySchema = ɵanySchema;
31
44
  //# sourceMappingURL=standard-schema.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-schema.cjs","names":[],"sources":["../src/standard-schema.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n} from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1, StandardJSONSchemaV1 };\n\n/**\n * Extract the Output type from a StandardSchemaV1 schema.\n * Replaces `z.infer<S>` for generic schema inference.\n */\nexport type InferSchemaOutput<S> =\n S extends StandardSchemaV1<any, infer O> ? O : never;\n\nexport interface SchemaToJsonSchemaOptions {\n /**\n * Injected `zodToJsonSchema` function so that `shared` does not depend on\n * `zod-to-json-schema`. Required when the schema is a Zod v3 schema that\n * does not implement Standard JSON Schema V1.\n */\n zodToJsonSchema?: (\n schema: unknown,\n options?: { $refStrategy?: string },\n ) => Record<string, unknown>;\n}\n\n/**\n * Check whether a schema implements the Standard JSON Schema V1 protocol.\n */\nfunction hasStandardJsonSchema(\n schema: StandardSchemaV1,\n): schema is StandardSchemaV1 & StandardJSONSchemaV1 {\n const props = schema[\"~standard\"];\n return (\n props != null &&\n typeof props === \"object\" &&\n \"jsonSchema\" in props &&\n props.jsonSchema != null &&\n typeof props.jsonSchema === \"object\" &&\n \"input\" in props.jsonSchema &&\n typeof props.jsonSchema.input === \"function\"\n );\n}\n\n/**\n * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.\n *\n * Strategy:\n * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),\n * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.\n * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.\n * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the\n * injected `zodToJsonSchema()` function.\n * 4. Otherwise throw a descriptive error.\n */\nexport function schemaToJsonSchema(\n schema: StandardSchemaV1,\n options?: SchemaToJsonSchemaOptions,\n): Record<string, unknown> {\n // 1. Standard JSON Schema V1\n if (hasStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n }\n\n // 2. Zod v4 native — exposes toJSONSchema() on the schema itself\n if (typeof (schema as any).toJSONSchema === \"function\") {\n return (schema as any).toJSONSchema() as Record<string, unknown>;\n }\n\n // 3. Zod v3 fallback\n const vendor = schema[\"~standard\"].vendor;\n if (vendor === \"zod\" && options?.zodToJsonSchema) {\n return options.zodToJsonSchema(schema, { $refStrategy: \"none\" });\n }\n\n throw new Error(\n `Cannot convert schema to JSON Schema. The schema (vendor: \"${vendor}\") does not implement Standard JSON Schema V1 ` +\n `and no zodToJsonSchema fallback is available. ` +\n `Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) ` +\n `or pass a zodToJsonSchema function in options.`,\n );\n}\n"],"mappings":";;;;;AA6BA,SAAS,sBACP,QACmD;CACnD,MAAM,QAAQ,OAAO;AACrB,QACE,SAAS,QACT,OAAO,UAAU,YACjB,gBAAgB,SAChB,MAAM,cAAc,QACpB,OAAO,MAAM,eAAe,YAC5B,WAAW,MAAM,cACjB,OAAO,MAAM,WAAW,UAAU;;;;;;;;;;;;;AAetC,SAAgB,mBACd,QACA,SACyB;AAEzB,KAAI,sBAAsB,OAAO,CAC/B,QAAO,OAAO,aAAa,WAAW,MAAM,EAAE,QAAQ,YAAY,CAAC;AAIrE,KAAI,OAAQ,OAAe,iBAAiB,WAC1C,QAAQ,OAAe,cAAc;CAIvC,MAAM,SAAS,OAAO,aAAa;AACnC,KAAI,WAAW,SAAS,SAAS,gBAC/B,QAAO,QAAQ,gBAAgB,QAAQ,EAAE,cAAc,QAAQ,CAAC;AAGlE,OAAM,IAAI,MACR,8DAA8D,OAAO,yOAItE"}
1
+ {"version":3,"file":"standard-schema.cjs","names":[],"sources":["../src/standard-schema.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n} from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1, StandardJSONSchemaV1 };\n\n/**\n * A Standard Schema that accepts any value and returns it unchanged.\n *\n * Wildcard tool call renderers use it when they declare no `args` schema.\n *\n * @internal Application authors must not depend on this contract.\n */\nexport const ɵanySchema: StandardSchemaV1<unknown, unknown> = {\n \"~standard\": {\n version: 1,\n vendor: \"copilotkit\",\n validate: (value) => ({ value }),\n },\n};\n\n/**\n * Extract the Output type from a StandardSchemaV1 schema.\n * Replaces `z.infer<S>` for generic schema inference.\n */\nexport type InferSchemaOutput<S> =\n S extends StandardSchemaV1<any, infer O> ? O : never;\n\n/**\n * Check whether a schema implements the Standard JSON Schema V1 protocol.\n */\nfunction hasStandardJsonSchema(\n schema: StandardSchemaV1,\n): schema is StandardSchemaV1 & StandardJSONSchemaV1 {\n const props = schema[\"~standard\"];\n return (\n props != null &&\n typeof props === \"object\" &&\n \"jsonSchema\" in props &&\n props.jsonSchema != null &&\n typeof props.jsonSchema === \"object\" &&\n \"input\" in props.jsonSchema &&\n typeof props.jsonSchema.input === \"function\"\n );\n}\n\n/**\n * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.\n *\n * Strategy:\n * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),\n * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.\n * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.\n * 2. If the schema exposes a `toJSONSchema()` method, call it directly.\n * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they\n * implement Standard Schema validation but cannot describe themselves as\n * JSON Schema.\n */\nexport function schemaToJsonSchema(\n schema: StandardSchemaV1,\n): Record<string, unknown> {\n // 1. Standard JSON Schema V1\n if (hasStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n }\n\n // 2. Native toJSONSchema() method\n if (typeof (schema as any).toJSONSchema === \"function\") {\n return (schema as any).toJSONSchema() as Record<string, unknown>;\n }\n\n const vendor = schema[\"~standard\"].vendor;\n throw new Error(\n `Cannot convert schema to JSON Schema. The schema (vendor: \"${vendor}\") does not implement Standard JSON Schema V1. ` +\n `Use a library that does: Zod 4.2+ (Zod 3 is not supported), Valibot v1+ wrapped with ` +\n `toStandardJsonSchema() from @valibot/to-json-schema, or ArkType v2.1.28+.`,\n );\n}\n"],"mappings":";;;;;;;;;AAcA,MAAa,aAAiD,EAC5D,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,WAAW,EAAE,OAAO;CAChC,EACF;;;;AAYD,SAAS,sBACP,QACmD;CACnD,MAAM,QAAQ,OAAO;AACrB,QACE,SAAS,QACT,OAAO,UAAU,YACjB,gBAAgB,SAChB,MAAM,cAAc,QACpB,OAAO,MAAM,eAAe,YAC5B,WAAW,MAAM,cACjB,OAAO,MAAM,WAAW,UAAU;;;;;;;;;;;;;;AAgBtC,SAAgB,mBACd,QACyB;AAEzB,KAAI,sBAAsB,OAAO,CAC/B,QAAO,OAAO,aAAa,WAAW,MAAM,EAAE,QAAQ,YAAY,CAAC;AAIrE,KAAI,OAAQ,OAAe,iBAAiB,WAC1C,QAAQ,OAAe,cAAc;CAGvC,MAAM,SAAS,OAAO,aAAa;AACnC,OAAM,IAAI,MACR,8DAA8D,OAAO,+MAGtE"}
@@ -1,33 +1,32 @@
1
1
  import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
2
2
 
3
3
  //#region src/standard-schema.d.ts
4
+ /**
5
+ * A Standard Schema that accepts any value and returns it unchanged.
6
+ *
7
+ * Wildcard tool call renderers use it when they declare no `args` schema.
8
+ *
9
+ * @internal Application authors must not depend on this contract.
10
+ */
11
+ declare const ɵanySchema: StandardSchemaV1<unknown, unknown>;
4
12
  /**
5
13
  * Extract the Output type from a StandardSchemaV1 schema.
6
14
  * Replaces `z.infer<S>` for generic schema inference.
7
15
  */
8
16
  type InferSchemaOutput<S> = S extends StandardSchemaV1<any, infer O> ? O : never;
9
- interface SchemaToJsonSchemaOptions {
10
- /**
11
- * Injected `zodToJsonSchema` function so that `shared` does not depend on
12
- * `zod-to-json-schema`. Required when the schema is a Zod v3 schema that
13
- * does not implement Standard JSON Schema V1.
14
- */
15
- zodToJsonSchema?: (schema: unknown, options?: {
16
- $refStrategy?: string;
17
- }) => Record<string, unknown>;
18
- }
19
17
  /**
20
18
  * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.
21
19
  *
22
20
  * Strategy:
23
21
  * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
24
22
  * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
25
- * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.
26
- * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the
27
- * injected `zodToJsonSchema()` function.
28
- * 4. Otherwise throw a descriptive error.
23
+ * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.
24
+ * 2. If the schema exposes a `toJSONSchema()` method, call it directly.
25
+ * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they
26
+ * implement Standard Schema validation but cannot describe themselves as
27
+ * JSON Schema.
29
28
  */
30
- declare function schemaToJsonSchema(schema: StandardSchemaV1, options?: SchemaToJsonSchemaOptions): Record<string, unknown>;
29
+ declare function schemaToJsonSchema(schema: StandardSchemaV1): Record<string, unknown>;
31
30
  //#endregion
32
- export { InferSchemaOutput, SchemaToJsonSchemaOptions, type StandardJSONSchemaV1, type StandardSchemaV1, schemaToJsonSchema };
31
+ export { InferSchemaOutput, type StandardJSONSchemaV1, type StandardSchemaV1, schemaToJsonSchema, ɵanySchema };
33
32
  //# sourceMappingURL=standard-schema.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-schema.d.cts","names":[],"sources":["../src/standard-schema.ts"],"mappings":";;;;AAWA;;;KAAY,iBAAA,MACV,CAAA,SAAU,gBAAA,iBAAiC,CAAA;AAAA,UAE5B,yBAAA;EAFf;;;;;EAQA,eAAA,IACE,MAAA,WACA,OAAA;IAAY,YAAA;EAAA,MACT,MAAA;AAAA;;;;;;;;;AAgCP;;;iBAAgB,kBAAA,CACd,MAAA,EAAQ,gBAAA,EACR,OAAA,GAAU,yBAAA,GACT,MAAA"}
1
+ {"version":3,"file":"standard-schema.d.cts","names":[],"sources":["../src/standard-schema.ts"],"mappings":";;;;AAcA;;;;;AAYA;cAZa,UAAA,EAAY,gBAAA;;;;;KAYb,iBAAA,MACV,CAAA,SAAU,gBAAA,iBAAiC,CAAA;;;;;AAgC7C;;;;;;;;iBAAgB,kBAAA,CACd,MAAA,EAAQ,gBAAA,GACP,MAAA"}
@@ -1,33 +1,32 @@
1
1
  import { StandardJSONSchemaV1, StandardSchemaV1 } from "@standard-schema/spec";
2
2
 
3
3
  //#region src/standard-schema.d.ts
4
+ /**
5
+ * A Standard Schema that accepts any value and returns it unchanged.
6
+ *
7
+ * Wildcard tool call renderers use it when they declare no `args` schema.
8
+ *
9
+ * @internal Application authors must not depend on this contract.
10
+ */
11
+ declare const ɵanySchema: StandardSchemaV1<unknown, unknown>;
4
12
  /**
5
13
  * Extract the Output type from a StandardSchemaV1 schema.
6
14
  * Replaces `z.infer<S>` for generic schema inference.
7
15
  */
8
16
  type InferSchemaOutput<S> = S extends StandardSchemaV1<any, infer O> ? O : never;
9
- interface SchemaToJsonSchemaOptions {
10
- /**
11
- * Injected `zodToJsonSchema` function so that `shared` does not depend on
12
- * `zod-to-json-schema`. Required when the schema is a Zod v3 schema that
13
- * does not implement Standard JSON Schema V1.
14
- */
15
- zodToJsonSchema?: (schema: unknown, options?: {
16
- $refStrategy?: string;
17
- }) => Record<string, unknown>;
18
- }
19
17
  /**
20
18
  * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.
21
19
  *
22
20
  * Strategy:
23
21
  * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
24
22
  * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
25
- * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.
26
- * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the
27
- * injected `zodToJsonSchema()` function.
28
- * 4. Otherwise throw a descriptive error.
23
+ * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.
24
+ * 2. If the schema exposes a `toJSONSchema()` method, call it directly.
25
+ * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they
26
+ * implement Standard Schema validation but cannot describe themselves as
27
+ * JSON Schema.
29
28
  */
30
- declare function schemaToJsonSchema(schema: StandardSchemaV1, options?: SchemaToJsonSchemaOptions): Record<string, unknown>;
29
+ declare function schemaToJsonSchema(schema: StandardSchemaV1): Record<string, unknown>;
31
30
  //#endregion
32
- export { InferSchemaOutput, SchemaToJsonSchemaOptions, type StandardJSONSchemaV1, type StandardSchemaV1, schemaToJsonSchema };
31
+ export { InferSchemaOutput, type StandardJSONSchemaV1, type StandardSchemaV1, schemaToJsonSchema, ɵanySchema };
33
32
  //# sourceMappingURL=standard-schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-schema.d.mts","names":[],"sources":["../src/standard-schema.ts"],"mappings":";;;;AAWA;;;KAAY,iBAAA,MACV,CAAA,SAAU,gBAAA,iBAAiC,CAAA;AAAA,UAE5B,yBAAA;EAFf;;;;;EAQA,eAAA,IACE,MAAA,WACA,OAAA;IAAY,YAAA;EAAA,MACT,MAAA;AAAA;;;;;;;;;AAgCP;;;iBAAgB,kBAAA,CACd,MAAA,EAAQ,gBAAA,EACR,OAAA,GAAU,yBAAA,GACT,MAAA"}
1
+ {"version":3,"file":"standard-schema.d.mts","names":[],"sources":["../src/standard-schema.ts"],"mappings":";;;;AAcA;;;;;AAYA;cAZa,UAAA,EAAY,gBAAA;;;;;KAYb,iBAAA,MACV,CAAA,SAAU,gBAAA,iBAAiC,CAAA;;;;;AAgC7C;;;;;;;;iBAAgB,kBAAA,CACd,MAAA,EAAQ,gBAAA,GACP,MAAA"}
@@ -1,5 +1,17 @@
1
1
  //#region src/standard-schema.ts
2
2
  /**
3
+ * A Standard Schema that accepts any value and returns it unchanged.
4
+ *
5
+ * Wildcard tool call renderers use it when they declare no `args` schema.
6
+ *
7
+ * @internal Application authors must not depend on this contract.
8
+ */
9
+ const ɵanySchema = { "~standard": {
10
+ version: 1,
11
+ vendor: "copilotkit",
12
+ validate: (value) => ({ value })
13
+ } };
14
+ /**
3
15
  * Check whether a schema implements the Standard JSON Schema V1 protocol.
4
16
  */
5
17
  function hasStandardJsonSchema(schema) {
@@ -12,19 +24,19 @@ function hasStandardJsonSchema(schema) {
12
24
  * Strategy:
13
25
  * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),
14
26
  * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.
15
- * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.
16
- * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the
17
- * injected `zodToJsonSchema()` function.
18
- * 4. Otherwise throw a descriptive error.
27
+ * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.
28
+ * 2. If the schema exposes a `toJSONSchema()` method, call it directly.
29
+ * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they
30
+ * implement Standard Schema validation but cannot describe themselves as
31
+ * JSON Schema.
19
32
  */
20
- function schemaToJsonSchema(schema, options) {
33
+ function schemaToJsonSchema(schema) {
21
34
  if (hasStandardJsonSchema(schema)) return schema["~standard"].jsonSchema.input({ target: "draft-07" });
22
35
  if (typeof schema.toJSONSchema === "function") return schema.toJSONSchema();
23
36
  const vendor = schema["~standard"].vendor;
24
- if (vendor === "zod" && options?.zodToJsonSchema) return options.zodToJsonSchema(schema, { $refStrategy: "none" });
25
- throw new Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1 and no zodToJsonSchema fallback is available. Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) or pass a zodToJsonSchema function in options.`);
37
+ throw new Error(`Cannot convert schema to JSON Schema. The schema (vendor: "${vendor}") does not implement Standard JSON Schema V1. Use a library that does: Zod 4.2+ (Zod 3 is not supported), Valibot v1+ wrapped with toStandardJsonSchema() from @valibot/to-json-schema, or ArkType v2.1.28+.`);
26
38
  }
27
39
 
28
40
  //#endregion
29
- export { schemaToJsonSchema };
41
+ export { schemaToJsonSchema, ɵanySchema };
30
42
  //# sourceMappingURL=standard-schema.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"standard-schema.mjs","names":[],"sources":["../src/standard-schema.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n} from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1, StandardJSONSchemaV1 };\n\n/**\n * Extract the Output type from a StandardSchemaV1 schema.\n * Replaces `z.infer<S>` for generic schema inference.\n */\nexport type InferSchemaOutput<S> =\n S extends StandardSchemaV1<any, infer O> ? O : never;\n\nexport interface SchemaToJsonSchemaOptions {\n /**\n * Injected `zodToJsonSchema` function so that `shared` does not depend on\n * `zod-to-json-schema`. Required when the schema is a Zod v3 schema that\n * does not implement Standard JSON Schema V1.\n */\n zodToJsonSchema?: (\n schema: unknown,\n options?: { $refStrategy?: string },\n ) => Record<string, unknown>;\n}\n\n/**\n * Check whether a schema implements the Standard JSON Schema V1 protocol.\n */\nfunction hasStandardJsonSchema(\n schema: StandardSchemaV1,\n): schema is StandardSchemaV1 & StandardJSONSchemaV1 {\n const props = schema[\"~standard\"];\n return (\n props != null &&\n typeof props === \"object\" &&\n \"jsonSchema\" in props &&\n props.jsonSchema != null &&\n typeof props.jsonSchema === \"object\" &&\n \"input\" in props.jsonSchema &&\n typeof props.jsonSchema.input === \"function\"\n );\n}\n\n/**\n * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.\n *\n * Strategy:\n * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),\n * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.\n * 2. If the schema exposes a `toJSONSchema()` method (Zod v4), call it directly.\n * 3. If the schema is a Zod v3 schema (`~standard.vendor === 'zod'`), use the\n * injected `zodToJsonSchema()` function.\n * 4. Otherwise throw a descriptive error.\n */\nexport function schemaToJsonSchema(\n schema: StandardSchemaV1,\n options?: SchemaToJsonSchemaOptions,\n): Record<string, unknown> {\n // 1. Standard JSON Schema V1\n if (hasStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n }\n\n // 2. Zod v4 native — exposes toJSONSchema() on the schema itself\n if (typeof (schema as any).toJSONSchema === \"function\") {\n return (schema as any).toJSONSchema() as Record<string, unknown>;\n }\n\n // 3. Zod v3 fallback\n const vendor = schema[\"~standard\"].vendor;\n if (vendor === \"zod\" && options?.zodToJsonSchema) {\n return options.zodToJsonSchema(schema, { $refStrategy: \"none\" });\n }\n\n throw new Error(\n `Cannot convert schema to JSON Schema. The schema (vendor: \"${vendor}\") does not implement Standard JSON Schema V1 ` +\n `and no zodToJsonSchema fallback is available. ` +\n `Use a library that supports Standard JSON Schema (e.g., Zod 3.24+, Valibot v1+, ArkType v2+) ` +\n `or pass a zodToJsonSchema function in options.`,\n );\n}\n"],"mappings":";;;;AA6BA,SAAS,sBACP,QACmD;CACnD,MAAM,QAAQ,OAAO;AACrB,QACE,SAAS,QACT,OAAO,UAAU,YACjB,gBAAgB,SAChB,MAAM,cAAc,QACpB,OAAO,MAAM,eAAe,YAC5B,WAAW,MAAM,cACjB,OAAO,MAAM,WAAW,UAAU;;;;;;;;;;;;;AAetC,SAAgB,mBACd,QACA,SACyB;AAEzB,KAAI,sBAAsB,OAAO,CAC/B,QAAO,OAAO,aAAa,WAAW,MAAM,EAAE,QAAQ,YAAY,CAAC;AAIrE,KAAI,OAAQ,OAAe,iBAAiB,WAC1C,QAAQ,OAAe,cAAc;CAIvC,MAAM,SAAS,OAAO,aAAa;AACnC,KAAI,WAAW,SAAS,SAAS,gBAC/B,QAAO,QAAQ,gBAAgB,QAAQ,EAAE,cAAc,QAAQ,CAAC;AAGlE,OAAM,IAAI,MACR,8DAA8D,OAAO,yOAItE"}
1
+ {"version":3,"file":"standard-schema.mjs","names":[],"sources":["../src/standard-schema.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n} from \"@standard-schema/spec\";\n\nexport type { StandardSchemaV1, StandardJSONSchemaV1 };\n\n/**\n * A Standard Schema that accepts any value and returns it unchanged.\n *\n * Wildcard tool call renderers use it when they declare no `args` schema.\n *\n * @internal Application authors must not depend on this contract.\n */\nexport const ɵanySchema: StandardSchemaV1<unknown, unknown> = {\n \"~standard\": {\n version: 1,\n vendor: \"copilotkit\",\n validate: (value) => ({ value }),\n },\n};\n\n/**\n * Extract the Output type from a StandardSchemaV1 schema.\n * Replaces `z.infer<S>` for generic schema inference.\n */\nexport type InferSchemaOutput<S> =\n S extends StandardSchemaV1<any, infer O> ? O : never;\n\n/**\n * Check whether a schema implements the Standard JSON Schema V1 protocol.\n */\nfunction hasStandardJsonSchema(\n schema: StandardSchemaV1,\n): schema is StandardSchemaV1 & StandardJSONSchemaV1 {\n const props = schema[\"~standard\"];\n return (\n props != null &&\n typeof props === \"object\" &&\n \"jsonSchema\" in props &&\n props.jsonSchema != null &&\n typeof props.jsonSchema === \"object\" &&\n \"input\" in props.jsonSchema &&\n typeof props.jsonSchema.input === \"function\"\n );\n}\n\n/**\n * Convert any StandardSchemaV1-compatible schema to a JSON Schema object.\n *\n * Strategy:\n * 1. If the schema implements Standard JSON Schema V1 (`~standard.jsonSchema`),\n * call `schema['~standard'].jsonSchema.input({ target: 'draft-07' })`.\n * Zod 4.2+, ArkType 2.1.28+ and Valibot (via `toStandardJsonSchema`) do.\n * 2. If the schema exposes a `toJSONSchema()` method, call it directly.\n * 3. Otherwise throw a descriptive error. Zod 3 schemas land here: they\n * implement Standard Schema validation but cannot describe themselves as\n * JSON Schema.\n */\nexport function schemaToJsonSchema(\n schema: StandardSchemaV1,\n): Record<string, unknown> {\n // 1. Standard JSON Schema V1\n if (hasStandardJsonSchema(schema)) {\n return schema[\"~standard\"].jsonSchema.input({ target: \"draft-07\" });\n }\n\n // 2. Native toJSONSchema() method\n if (typeof (schema as any).toJSONSchema === \"function\") {\n return (schema as any).toJSONSchema() as Record<string, unknown>;\n }\n\n const vendor = schema[\"~standard\"].vendor;\n throw new Error(\n `Cannot convert schema to JSON Schema. The schema (vendor: \"${vendor}\") does not implement Standard JSON Schema V1. ` +\n `Use a library that does: Zod 4.2+ (Zod 3 is not supported), Valibot v1+ wrapped with ` +\n `toStandardJsonSchema() from @valibot/to-json-schema, or ArkType v2.1.28+.`,\n );\n}\n"],"mappings":";;;;;;;;AAcA,MAAa,aAAiD,EAC5D,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,WAAW,EAAE,OAAO;CAChC,EACF;;;;AAYD,SAAS,sBACP,QACmD;CACnD,MAAM,QAAQ,OAAO;AACrB,QACE,SAAS,QACT,OAAO,UAAU,YACjB,gBAAgB,SAChB,MAAM,cAAc,QACpB,OAAO,MAAM,eAAe,YAC5B,WAAW,MAAM,cACjB,OAAO,MAAM,WAAW,UAAU;;;;;;;;;;;;;;AAgBtC,SAAgB,mBACd,QACyB;AAEzB,KAAI,sBAAsB,OAAO,CAC/B,QAAO,OAAO,aAAa,WAAW,MAAM,EAAE,QAAQ,YAAY,CAAC;AAIrE,KAAI,OAAQ,OAAe,iBAAiB,WAC1C,QAAQ,OAAe,cAAc;CAGvC,MAAM,SAAS,OAAO,aAAa;AACnC,OAAM,IAAI,MACR,8DAA8D,OAAO,+MAGtE"}
@@ -6,11 +6,6 @@ const require_process_env = require('../utils/process-env.cjs');
6
6
  * Users can opt out by setting:
7
7
  * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
8
8
  * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
9
- *
10
- * Lives in its own module so that the browser-facing root entry can
11
- * re-export it without pulling in `telemetry-client.ts`, whose
12
- * `@segment/analytics-node` import drags Node built-ins into browser
13
- * bundler module graphs. See the note in `../index.ts`.
14
9
  */
15
10
  function isTelemetryDisabled() {
16
11
  const env = require_process_env.processEnv();
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-disabled.cjs","names":["processEnv"],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["import { processEnv } from \"../utils/process-env\";\n\n/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n *\n * Lives in its own module so that the browser-facing root entry can\n * re-export it without pulling in `telemetry-client.ts`, whose\n * `@segment/analytics-node` import drags Node built-ins into browser\n * bundler module graphs. See the note in `../index.ts`.\n */\nexport function isTelemetryDisabled(): boolean {\n const env = processEnv();\n return (\n env.COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n env.COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n env.DO_NOT_TRACK === \"true\" ||\n env.DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,sBAA+B;CAC7C,MAAM,MAAMA,gCAAY;AACxB,QACE,IAAI,kCAAkC,UACtC,IAAI,kCAAkC,OACtC,IAAI,iBAAiB,UACrB,IAAI,iBAAiB"}
1
+ {"version":3,"file":"telemetry-disabled.cjs","names":["processEnv"],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["import { processEnv } from \"../utils/process-env\";\n\n/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n */\nexport function isTelemetryDisabled(): boolean {\n const env = processEnv();\n return (\n env.COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n env.COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n env.DO_NOT_TRACK === \"true\" ||\n env.DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,sBAA+B;CAC7C,MAAM,MAAMA,gCAAY;AACxB,QACE,IAAI,kCAAkC,UACtC,IAAI,kCAAkC,OACtC,IAAI,iBAAiB,UACrB,IAAI,iBAAiB"}
@@ -4,11 +4,6 @@
4
4
  * Users can opt out by setting:
5
5
  * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
6
6
  * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
7
- *
8
- * Lives in its own module so that the browser-facing root entry can
9
- * re-export it without pulling in `telemetry-client.ts`, whose
10
- * `@segment/analytics-node` import drags Node built-ins into browser
11
- * bundler module graphs. See the note in `../index.ts`.
12
7
  */
13
8
  declare function isTelemetryDisabled(): boolean;
14
9
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-disabled.d.cts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAaA;;;;;;;;;;iBAAgB,mBAAA,CAAA"}
1
+ {"version":3,"file":"telemetry-disabled.d.cts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAQA;;;;;iBAAgB,mBAAA,CAAA"}
@@ -4,11 +4,6 @@
4
4
  * Users can opt out by setting:
5
5
  * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
6
6
  * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
7
- *
8
- * Lives in its own module so that the browser-facing root entry can
9
- * re-export it without pulling in `telemetry-client.ts`, whose
10
- * `@segment/analytics-node` import drags Node built-ins into browser
11
- * bundler module graphs. See the note in `../index.ts`.
12
7
  */
13
8
  declare function isTelemetryDisabled(): boolean;
14
9
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-disabled.d.mts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAaA;;;;;;;;;;iBAAgB,mBAAA,CAAA"}
1
+ {"version":3,"file":"telemetry-disabled.d.mts","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"mappings":";;AAQA;;;;;iBAAgB,mBAAA,CAAA"}
@@ -6,11 +6,6 @@ import { processEnv } from "../utils/process-env.mjs";
6
6
  * Users can opt out by setting:
7
7
  * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1
8
8
  * - DO_NOT_TRACK=true or DO_NOT_TRACK=1
9
- *
10
- * Lives in its own module so that the browser-facing root entry can
11
- * re-export it without pulling in `telemetry-client.ts`, whose
12
- * `@segment/analytics-node` import drags Node built-ins into browser
13
- * bundler module graphs. See the note in `../index.ts`.
14
9
  */
15
10
  function isTelemetryDisabled() {
16
11
  const env = processEnv();
@@ -1 +1 @@
1
- {"version":3,"file":"telemetry-disabled.mjs","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["import { processEnv } from \"../utils/process-env\";\n\n/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n *\n * Lives in its own module so that the browser-facing root entry can\n * re-export it without pulling in `telemetry-client.ts`, whose\n * `@segment/analytics-node` import drags Node built-ins into browser\n * bundler module graphs. See the note in `../index.ts`.\n */\nexport function isTelemetryDisabled(): boolean {\n const env = processEnv();\n return (\n env.COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n env.COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n env.DO_NOT_TRACK === \"true\" ||\n env.DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,sBAA+B;CAC7C,MAAM,MAAM,YAAY;AACxB,QACE,IAAI,kCAAkC,UACtC,IAAI,kCAAkC,OACtC,IAAI,iBAAiB,UACrB,IAAI,iBAAiB"}
1
+ {"version":3,"file":"telemetry-disabled.mjs","names":[],"sources":["../../src/telemetry/telemetry-disabled.ts"],"sourcesContent":["import { processEnv } from \"../utils/process-env\";\n\n/**\n * Checks if telemetry is disabled via environment variables.\n * Users can opt out by setting:\n * - COPILOTKIT_TELEMETRY_DISABLED=true or COPILOTKIT_TELEMETRY_DISABLED=1\n * - DO_NOT_TRACK=true or DO_NOT_TRACK=1\n */\nexport function isTelemetryDisabled(): boolean {\n const env = processEnv();\n return (\n env.COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n env.COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n env.DO_NOT_TRACK === \"true\" ||\n env.DO_NOT_TRACK === \"1\"\n );\n}\n"],"mappings":";;;;;;;;;AAQA,SAAgB,sBAA+B;CAC7C,MAAM,MAAM,YAAY;AACxB,QACE,IAAI,kCAAkC,UACtC,IAAI,kCAAkC,OACtC,IAAI,iBAAiB,UACrB,IAAI,iBAAiB"}
@@ -1,6 +1,6 @@
1
1
  import { copyToClipboard } from "./clipboard.cjs";
2
2
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, isStructuredCopilotKitError } from "./errors.cjs";
3
- import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./json-schema.cjs";
3
+ import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters } from "./json-schema.cjs";
4
4
  import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./inspector-metadata.cjs";
5
5
  import { InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl } from "./inspector-learning.cjs";
6
6
  import { InspectorVisibilityOptions, shouldEnableInspector } from "./inspector-visibility.cjs";
@@ -1,6 +1,6 @@
1
1
  import { copyToClipboard } from "./clipboard.mjs";
2
2
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitErrorExtensions, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, isStructuredCopilotKitError } from "./errors.mjs";
3
- import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./json-schema.mjs";
3
+ import { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters } from "./json-schema.mjs";
4
4
  import { InspectorMetadataV1, parseInspectorMetadataV1 } from "./inspector-metadata.mjs";
5
5
  import { InspectorLearningEvidence, InspectorLearningInsight, InspectorLearningPage, InspectorLearningRequestV1, InspectorLearningSkill, InspectorLearningSnapshotV1, InspectorLearningTrajectoryEvidence, parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl } from "./inspector-learning.mjs";
6
6
  import { InspectorVisibilityOptions, shouldEnableInspector } from "./inspector-visibility.mjs";
@@ -1,6 +1,6 @@
1
1
  import { copyToClipboard } from "./clipboard.mjs";
2
2
  import { BANNER_ERROR_NAMES, COPILOT_CLOUD_ERROR_NAMES, ConfigurationError, CopilotKitAgentDiscoveryError, CopilotKitApiDiscoveryError, CopilotKitError, CopilotKitErrorCode, CopilotKitLowLevelError, CopilotKitMisuseError, CopilotKitRemoteEndpointDiscoveryError, ERROR_CONFIG, ERROR_NAMES, ErrorVisibility, MissingPublicApiKeyError, ResolvedCopilotKitError, Severity, UpgradeRequiredError, ensureStructuredError, isStructuredCopilotKitError } from "./errors.mjs";
3
- import { actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters } from "./json-schema.mjs";
3
+ import { actionParametersToJsonSchema, jsonSchemaToActionParameters } from "./json-schema.mjs";
4
4
  import { parseInspectorMetadataV1 } from "./inspector-metadata.mjs";
5
5
  import { parseInspectorLearningRequestV1, parseInspectorLearningSnapshotV1, parseInspectorLearningUrl } from "./inspector-learning.mjs";
6
6
  import { shouldEnableInspector } from "./inspector-visibility.mjs";
@@ -1,5 +1,3 @@
1
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
2
- let zod = require("zod");
3
1
 
4
2
  //#region src/utils/json-schema.ts
5
3
  function actionParametersToJsonSchema(actionParameters) {
@@ -131,85 +129,8 @@ function convertAttribute(attribute) {
131
129
  };
132
130
  }
133
131
  }
134
- function convertJsonSchemaToZodSchema(jsonSchema, required, definitions, visitedRefs) {
135
- if (jsonSchema.$ref && definitions) {
136
- const refPath = jsonSchema.$ref.replace(/^#\/\$defs\/|^#\/definitions\//, "");
137
- const refs = visitedRefs ?? /* @__PURE__ */ new Set();
138
- if (refs.has(refPath)) {
139
- console.warn(`[CopilotKit] Circular $ref detected for "${refPath}" — falling back to z.any()`);
140
- let schema = zod.z.any();
141
- if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
142
- return required ? schema : schema.optional();
143
- }
144
- const resolved = definitions[refPath];
145
- if (resolved) {
146
- const nextRefs = new Set(refs);
147
- nextRefs.add(refPath);
148
- return convertJsonSchemaToZodSchema(resolved, required, definitions, nextRefs);
149
- }
150
- }
151
- const defs = definitions ?? jsonSchema.$defs ?? jsonSchema.definitions;
152
- if (Array.isArray(jsonSchema.type)) {
153
- const types = jsonSchema.type;
154
- const hasNull = types.includes("null");
155
- const nonNullTypes = types.filter((t) => t !== "null");
156
- const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : "string";
157
- const innerSchema = convertJsonSchemaToZodSchema({
158
- ...jsonSchema,
159
- type: resolvedType
160
- }, true, defs, visitedRefs);
161
- let schema = hasNull ? zod.z.union([innerSchema, zod.z.null()]) : innerSchema;
162
- if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
163
- return required ? schema : schema.optional();
164
- }
165
- const unionVariants = jsonSchema.anyOf ?? jsonSchema.oneOf;
166
- if (Array.isArray(unionVariants) && unionVariants.length > 0) {
167
- if (unionVariants.length === 1) return convertJsonSchemaToZodSchema(unionVariants[0], required, defs, visitedRefs);
168
- const schemas = unionVariants.map((v) => convertJsonSchemaToZodSchema(v, true, defs, visitedRefs));
169
- let schema = zod.z.union(schemas);
170
- if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
171
- return required ? schema : schema.optional();
172
- }
173
- if (jsonSchema.type === "object") {
174
- const spec = {};
175
- if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) return !required ? zod.z.object(spec).optional() : zod.z.object(spec);
176
- for (const [key, value] of Object.entries(jsonSchema.properties)) spec[key] = convertJsonSchemaToZodSchema(value, jsonSchema.required ? jsonSchema.required.includes(key) : false, defs, visitedRefs);
177
- let schema = zod.z.object(spec).describe(jsonSchema.description);
178
- return required ? schema : schema.optional();
179
- } else if (jsonSchema.type === "string") {
180
- if (jsonSchema.enum && jsonSchema.enum.length > 0) {
181
- let schema = zod.z.enum(jsonSchema.enum).describe(jsonSchema.description);
182
- return required ? schema : schema.optional();
183
- }
184
- let schema = zod.z.string().describe(jsonSchema.description);
185
- return required ? schema : schema.optional();
186
- } else if (jsonSchema.type === "number" || jsonSchema.type === "integer") {
187
- let schema = zod.z.number().describe(jsonSchema.description);
188
- return required ? schema : schema.optional();
189
- } else if (jsonSchema.type === "boolean") {
190
- let schema = zod.z.boolean().describe(jsonSchema.description);
191
- return required ? schema : schema.optional();
192
- } else if (jsonSchema.type === "array") {
193
- let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true, defs, visitedRefs);
194
- let schema = zod.z.array(itemSchema).describe(jsonSchema.description);
195
- return required ? schema : schema.optional();
196
- } else if (jsonSchema.type === "null") {
197
- let schema = zod.z.null().describe(jsonSchema.description);
198
- return required ? schema : schema.optional();
199
- }
200
- console.warn(`[CopilotKit] Unsupported JSON schema type "${jsonSchema.type ?? "unknown"}" — falling back to z.any()`);
201
- let schema = zod.z.any();
202
- if (jsonSchema.description) schema = schema.describe(jsonSchema.description);
203
- return required ? schema : schema.optional();
204
- }
205
- function getZodParameters(parameters) {
206
- if (!parameters) return zod.z.object({});
207
- return convertJsonSchemaToZodSchema(actionParametersToJsonSchema(parameters), true);
208
- }
209
132
 
210
133
  //#endregion
211
134
  exports.actionParametersToJsonSchema = actionParametersToJsonSchema;
212
- exports.convertJsonSchemaToZodSchema = convertJsonSchemaToZodSchema;
213
- exports.getZodParameters = getZodParameters;
214
135
  exports.jsonSchemaToActionParameters = jsonSchemaToActionParameters;
215
136
  //# sourceMappingURL=json-schema.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.cjs","names":["z"],"sources":["../../src/utils/json-schema.ts"],"sourcesContent":["import { z } from \"zod\";\nimport { Parameter } from \"../types\";\n\nexport type JSONSchemaString = {\n type: \"string\";\n description?: string;\n enum?: string[];\n};\n\nexport type JSONSchemaNumber = {\n type: \"number\";\n description?: string;\n};\n\nexport type JSONSchemaBoolean = {\n type: \"boolean\";\n description?: string;\n};\n\nexport type JSONSchemaObject = {\n type: \"object\";\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n};\n\nexport type JSONSchemaArray = {\n type: \"array\";\n items: JSONSchema;\n description?: string;\n};\n\nexport type JSONSchema =\n | JSONSchemaString\n | JSONSchemaNumber\n | JSONSchemaBoolean\n | JSONSchemaObject\n | JSONSchemaArray;\n\nexport function actionParametersToJsonSchema(\n actionParameters: Parameter[],\n): JSONSchema {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of actionParameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of actionParameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n return {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n };\n}\n\n// Convert JSONSchema to Parameter[]\nexport function jsonSchemaToActionParameters(\n jsonSchema: JSONSchema,\n): Parameter[] {\n if (jsonSchema.type !== \"object\" || !jsonSchema.properties) {\n return [];\n }\n\n const parameters: Parameter[] = [];\n const requiredFields = jsonSchema.required || [];\n\n for (const [name, schema] of Object.entries(jsonSchema.properties)) {\n const parameter = convertJsonSchemaToParameter(\n name,\n schema,\n requiredFields.includes(name),\n );\n parameters.push(parameter);\n }\n\n return parameters;\n}\n\n// Convert JSONSchema property to Parameter\nfunction convertJsonSchemaToParameter(\n name: string,\n schema: JSONSchema,\n isRequired: boolean,\n): Parameter {\n const baseParameter: Parameter = {\n name,\n description: schema.description,\n };\n\n if (!isRequired) {\n baseParameter.required = false;\n }\n\n // Handle null-union types like [\"string\", \"null\"] by picking the non-null type\n if (Array.isArray(schema.type)) {\n const types = schema.type as string[];\n const hasNull = types.includes(\"null\");\n const nonNullTypes = types.filter((t: string) => t !== \"null\");\n const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : \"string\";\n return convertJsonSchemaToParameter(\n name,\n { ...schema, type: resolvedType } as JSONSchema,\n hasNull ? false : isRequired,\n );\n }\n\n switch (schema.type) {\n case \"string\":\n return {\n ...baseParameter,\n type: \"string\",\n ...(schema.enum && { enum: schema.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n ...baseParameter,\n type: schema.type,\n };\n case \"object\":\n if (schema.properties) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.required || [];\n\n for (const [propName, propSchema] of Object.entries(\n schema.properties,\n )) {\n attributes.push(\n convertJsonSchemaToParameter(\n propName,\n propSchema,\n requiredFields.includes(propName),\n ),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object\",\n attributes,\n };\n }\n return {\n ...baseParameter,\n type: \"object\",\n };\n case \"array\":\n if (schema.items.type === \"object\" && \"properties\" in schema.items) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.items.required || [];\n\n for (const [propName, propSchema] of Object.entries(\n schema.items.properties || {},\n )) {\n attributes.push(\n convertJsonSchemaToParameter(\n propName,\n propSchema,\n requiredFields.includes(propName),\n ),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object[]\",\n attributes,\n };\n } else if (schema.items.type === \"array\") {\n throw new Error(\"Nested arrays are not supported\");\n } else {\n return {\n ...baseParameter,\n type: `${schema.items.type}[]`,\n };\n }\n default:\n return {\n ...baseParameter,\n type: \"string\",\n };\n }\n}\n\nfunction convertAttribute(attribute: Parameter): JSONSchema {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType as any },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function convertJsonSchemaToZodSchema(\n jsonSchema: any,\n required: boolean,\n definitions?: Record<string, any>,\n visitedRefs?: Set<string>,\n): z.ZodSchema {\n // Resolve $ref references\n if (jsonSchema.$ref && definitions) {\n const refPath = jsonSchema.$ref.replace(\n /^#\\/\\$defs\\/|^#\\/definitions\\//,\n \"\",\n );\n\n // Detect circular $ref cycles\n const refs = visitedRefs ?? new Set<string>();\n if (refs.has(refPath)) {\n console.warn(\n `[CopilotKit] Circular $ref detected for \"${refPath}\" — falling back to z.any()`,\n );\n let schema = z.any();\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n const resolved = definitions[refPath];\n if (resolved) {\n // Clone the set so sibling branches don't see each other's visited refs\n const nextRefs = new Set(refs);\n nextRefs.add(refPath);\n return convertJsonSchemaToZodSchema(\n resolved,\n required,\n definitions,\n nextRefs,\n );\n }\n }\n\n // Collect top-level definitions for $ref resolution\n const defs = definitions ?? jsonSchema.$defs ?? jsonSchema.definitions;\n\n // Handle null-union types like [\"string\", \"null\"]\n if (Array.isArray(jsonSchema.type)) {\n const types = jsonSchema.type as string[];\n const hasNull = types.includes(\"null\");\n const nonNullTypes = types.filter((t: string) => t !== \"null\");\n const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : \"string\";\n const innerSchema = convertJsonSchemaToZodSchema(\n { ...jsonSchema, type: resolvedType },\n true,\n defs,\n visitedRefs,\n );\n let schema = hasNull ? z.union([innerSchema, z.null()]) : innerSchema;\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n // Handle anyOf / oneOf as z.union\n const unionVariants = jsonSchema.anyOf ?? jsonSchema.oneOf;\n if (Array.isArray(unionVariants) && unionVariants.length > 0) {\n if (unionVariants.length === 1) {\n return convertJsonSchemaToZodSchema(\n unionVariants[0],\n required,\n defs,\n visitedRefs,\n );\n }\n const schemas = unionVariants.map((v: any) =>\n convertJsonSchemaToZodSchema(v, true, defs, visitedRefs),\n );\n let schema = z.union(\n schemas as [z.ZodSchema, z.ZodSchema, ...z.ZodSchema[]],\n );\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n }\n\n if (jsonSchema.type === \"object\") {\n const spec: { [key: string]: z.ZodSchema } = {};\n\n if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {\n return !required ? z.object(spec).optional() : z.object(spec);\n }\n\n for (const [key, value] of Object.entries(jsonSchema.properties)) {\n spec[key] = convertJsonSchemaToZodSchema(\n value,\n jsonSchema.required ? jsonSchema.required.includes(key) : false,\n defs,\n visitedRefs,\n );\n }\n let schema = z.object(spec).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"string\") {\n if (jsonSchema.enum && jsonSchema.enum.length > 0) {\n let schema = z\n .enum(jsonSchema.enum as [string, ...string[]])\n .describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n let schema = z.string().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"number\" || jsonSchema.type === \"integer\") {\n let schema = z.number().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"boolean\") {\n let schema = z.boolean().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"array\") {\n let itemSchema = convertJsonSchemaToZodSchema(\n jsonSchema.items,\n true,\n defs,\n visitedRefs,\n );\n let schema = z.array(itemSchema).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"null\") {\n let schema = z.null().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n\n // Fallback: accept any value rather than throwing\n console.warn(\n `[CopilotKit] Unsupported JSON schema type \"${jsonSchema.type ?? \"unknown\"}\" — falling back to z.any()`,\n );\n let schema = z.any();\n if (jsonSchema.description) {\n schema = schema.describe(jsonSchema.description);\n }\n return required ? schema : schema.optional();\n}\n\nexport function getZodParameters<T extends [] | Parameter[] | undefined>(\n parameters: T,\n): any {\n if (!parameters) return z.object({});\n const jsonParams = actionParametersToJsonSchema(parameters);\n return convertJsonSchemaToZodSchema(jsonParams, true);\n}\n"],"mappings":";;;;AAuCA,SAAgB,6BACd,kBACY;CAEZ,IAAI,aAAqC,EAAE;AAC3C,MAAK,IAAI,aAAa,oBAAoB,EAAE,CAC1C,YAAW,UAAU,QAAQ,iBAAiB,UAAU;CAG1D,IAAI,yBAAmC,EAAE;AACzC,MAAK,IAAI,OAAO,oBAAoB,EAAE,CACpC,KAAI,IAAI,aAAa,MACnB,wBAAuB,KAAK,IAAI,KAAK;AAKzC,QAAO;EACL,MAAM;EACN,YAAY;EACZ,UAAU;EACX;;AAIH,SAAgB,6BACd,YACa;AACb,KAAI,WAAW,SAAS,YAAY,CAAC,WAAW,WAC9C,QAAO,EAAE;CAGX,MAAM,aAA0B,EAAE;CAClC,MAAM,iBAAiB,WAAW,YAAY,EAAE;AAEhD,MAAK,MAAM,CAAC,MAAM,WAAW,OAAO,QAAQ,WAAW,WAAW,EAAE;EAClE,MAAM,YAAY,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AS,QAAQ;EACrC,IAAI,SAASA,MAAE,MAAM,CAAC,SAAS,WAAW,YAAY;AACtD,SAAO,WAAW,SAAS,OAAO,UAAU;;AAI9C,SAAQ,KACN,8CAA8C,WAAW,QAAQ,UAAU,6BAC5E;CACD,IAAI,SAASA,MAAE,KAAK;AACpB,KAAI,WAAW,YACb,UAAS,OAAO,SAAS,WAAW,YAAY;AAElD,QAAO,WAAW,SAAS,OAAO,UAAU;;AAG9C,SAAgB,iBACd,YACK;AACL,KAAI,CAAC,WAAY,QAAOA,MAAE,OAAO,EAAE,CAAC;AAEpC,QAAO,6BADY,6BAA6B,WAAW,EACX,KAAK"}
1
+ {"version":3,"file":"json-schema.cjs","names":[],"sources":["../../src/utils/json-schema.ts"],"sourcesContent":["import type { Parameter } from \"../types\";\n\nexport type JSONSchemaString = {\n type: \"string\";\n description?: string;\n enum?: string[];\n};\n\nexport type JSONSchemaNumber = {\n type: \"number\";\n description?: string;\n};\n\nexport type JSONSchemaBoolean = {\n type: \"boolean\";\n description?: string;\n};\n\nexport type JSONSchemaObject = {\n type: \"object\";\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n};\n\nexport type JSONSchemaArray = {\n type: \"array\";\n items: JSONSchema;\n description?: string;\n};\n\nexport type JSONSchema =\n | JSONSchemaString\n | JSONSchemaNumber\n | JSONSchemaBoolean\n | JSONSchemaObject\n | JSONSchemaArray;\n\nexport function actionParametersToJsonSchema(\n actionParameters: Parameter[],\n): JSONSchema {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of actionParameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of actionParameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n return {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n };\n}\n\n// Convert JSONSchema to Parameter[]\nexport function jsonSchemaToActionParameters(\n jsonSchema: JSONSchema,\n): Parameter[] {\n if (jsonSchema.type !== \"object\" || !jsonSchema.properties) {\n return [];\n }\n\n const parameters: Parameter[] = [];\n const requiredFields = jsonSchema.required || [];\n\n for (const [name, schema] of Object.entries(jsonSchema.properties)) {\n const parameter = convertJsonSchemaToParameter(\n name,\n schema,\n requiredFields.includes(name),\n );\n parameters.push(parameter);\n }\n\n return parameters;\n}\n\n// Convert JSONSchema property to Parameter\nfunction convertJsonSchemaToParameter(\n name: string,\n schema: JSONSchema,\n isRequired: boolean,\n): Parameter {\n const baseParameter: Parameter = {\n name,\n description: schema.description,\n };\n\n if (!isRequired) {\n baseParameter.required = false;\n }\n\n // Handle null-union types like [\"string\", \"null\"] by picking the non-null type\n if (Array.isArray(schema.type)) {\n const types = schema.type as string[];\n const hasNull = types.includes(\"null\");\n const nonNullTypes = types.filter((t: string) => t !== \"null\");\n const resolvedType = nonNullTypes.length > 0 ? nonNullTypes[0] : \"string\";\n return convertJsonSchemaToParameter(\n name,\n { ...schema, type: resolvedType } as JSONSchema,\n hasNull ? false : isRequired,\n );\n }\n\n switch (schema.type) {\n case \"string\":\n return {\n ...baseParameter,\n type: \"string\",\n ...(schema.enum && { enum: schema.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n ...baseParameter,\n type: schema.type,\n };\n case \"object\":\n if (schema.properties) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.required || [];\n\n for (const [propName, propSchema] of Object.entries(\n schema.properties,\n )) {\n attributes.push(\n convertJsonSchemaToParameter(\n propName,\n propSchema,\n requiredFields.includes(propName),\n ),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object\",\n attributes,\n };\n }\n return {\n ...baseParameter,\n type: \"object\",\n };\n case \"array\":\n if (schema.items.type === \"object\" && \"properties\" in schema.items) {\n const attributes: Parameter[] = [];\n const requiredFields = schema.items.required || [];\n\n for (const [propName, propSchema] of Object.entries(\n schema.items.properties || {},\n )) {\n attributes.push(\n convertJsonSchemaToParameter(\n propName,\n propSchema,\n requiredFields.includes(propName),\n ),\n );\n }\n\n return {\n ...baseParameter,\n type: \"object[]\",\n attributes,\n };\n } else if (schema.items.type === \"array\") {\n throw new Error(\"Nested arrays are not supported\");\n } else {\n return {\n ...baseParameter,\n type: `${schema.items.type}[]`,\n };\n }\n default:\n return {\n ...baseParameter,\n type: \"string\",\n };\n }\n}\n\nfunction convertAttribute(attribute: Parameter): JSONSchema {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType as any },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n"],"mappings":";;AAsCA,SAAgB,6BACd,kBACY;CAEZ,IAAI,aAAqC,EAAE;AAC3C,MAAK,IAAI,aAAa,oBAAoB,EAAE,CAC1C,YAAW,UAAU,QAAQ,iBAAiB,UAAU;CAG1D,IAAI,yBAAmC,EAAE;AACzC,MAAK,IAAI,OAAO,oBAAoB,EAAE,CACpC,KAAI,IAAI,aAAa,MACnB,wBAAuB,KAAK,IAAI,KAAK;AAKzC,QA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AAS,SAAS,KAAK,EAAE,UAAU;IACpD;EACH;AAEE,OAAI,UAAU,MAAM,SAAS,KAAK,CAEhC,QAAO;IACL,MAAM;IACN,OAAO,EAAE,MAHM,UAAU,KAAK,MAAM,GAAG,GAAG,EAGV;IAChC,aAAa,UAAU;IACxB;AAGH,UAAO;IACL,MAAM;IACN,aAAa,UAAU;IACxB"}
@@ -1,5 +1,4 @@
1
1
  import { Parameter } from "../types/action.cjs";
2
- import { z } from "zod";
3
2
 
4
3
  //#region src/utils/json-schema.d.ts
5
4
  type JSONSchemaString = {
@@ -29,8 +28,6 @@ type JSONSchemaArray = {
29
28
  type JSONSchema = JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean | JSONSchemaObject | JSONSchemaArray;
30
29
  declare function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema;
31
30
  declare function jsonSchemaToActionParameters(jsonSchema: JSONSchema): Parameter[];
32
- declare function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean, definitions?: Record<string, any>, visitedRefs?: Set<string>): z.ZodSchema;
33
- declare function getZodParameters<T extends [] | Parameter[] | undefined>(parameters: T): any;
34
31
  //#endregion
35
- export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters };
32
+ export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters };
36
33
  //# sourceMappingURL=json-schema.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.d.cts","names":[],"sources":["../../src/utils/json-schema.ts"],"mappings":";;;;KAGY,gBAAA;EACV,IAAA;EACA,WAAA;EACA,IAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,UAAA,GAAa,MAAA,SAAe,UAAA;EAC5B,QAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA;EACV,IAAA;EACA,KAAA,EAAO,UAAA;EACP,WAAA;AAAA;AAAA,KAGU,UAAA,GACR,gBAAA,GACA,gBAAA,GACA,iBAAA,GACA,gBAAA,GACA,eAAA;AAAA,iBAEY,4BAAA,CACd,gBAAA,EAAkB,SAAA,KACjB,UAAA;AAAA,iBAuBa,4BAAA,CACd,UAAA,EAAY,UAAA,GACX,SAAA;AAAA,iBA2La,4BAAA,CACd,UAAA,OACA,QAAA,WACA,WAAA,GAAc,MAAA,eACd,WAAA,GAAc,GAAA,WACb,CAAA,CAAE,SAAA;AAAA,iBAyIW,gBAAA,gBAAgC,SAAA,eAAA,CAC9C,UAAA,EAAY,CAAA"}
1
+ {"version":3,"file":"json-schema.d.cts","names":[],"sources":["../../src/utils/json-schema.ts"],"mappings":";;;KAEY,gBAAA;EACV,IAAA;EACA,WAAA;EACA,IAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,UAAA,GAAa,MAAA,SAAe,UAAA;EAC5B,QAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA;EACV,IAAA;EACA,KAAA,EAAO,UAAA;EACP,WAAA;AAAA;AAAA,KAGU,UAAA,GACR,gBAAA,GACA,gBAAA,GACA,iBAAA,GACA,gBAAA,GACA,eAAA;AAAA,iBAEY,4BAAA,CACd,gBAAA,EAAkB,SAAA,KACjB,UAAA;AAAA,iBAuBa,4BAAA,CACd,UAAA,EAAY,UAAA,GACX,SAAA"}
@@ -1,5 +1,4 @@
1
1
  import { Parameter } from "../types/action.mjs";
2
- import { z } from "zod";
3
2
 
4
3
  //#region src/utils/json-schema.d.ts
5
4
  type JSONSchemaString = {
@@ -29,8 +28,6 @@ type JSONSchemaArray = {
29
28
  type JSONSchema = JSONSchemaString | JSONSchemaNumber | JSONSchemaBoolean | JSONSchemaObject | JSONSchemaArray;
30
29
  declare function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema;
31
30
  declare function jsonSchemaToActionParameters(jsonSchema: JSONSchema): Parameter[];
32
- declare function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean, definitions?: Record<string, any>, visitedRefs?: Set<string>): z.ZodSchema;
33
- declare function getZodParameters<T extends [] | Parameter[] | undefined>(parameters: T): any;
34
31
  //#endregion
35
- export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema, getZodParameters, jsonSchemaToActionParameters };
32
+ export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, jsonSchemaToActionParameters };
36
33
  //# sourceMappingURL=json-schema.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../src/utils/json-schema.ts"],"mappings":";;;;KAGY,gBAAA;EACV,IAAA;EACA,WAAA;EACA,IAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,UAAA,GAAa,MAAA,SAAe,UAAA;EAC5B,QAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA;EACV,IAAA;EACA,KAAA,EAAO,UAAA;EACP,WAAA;AAAA;AAAA,KAGU,UAAA,GACR,gBAAA,GACA,gBAAA,GACA,iBAAA,GACA,gBAAA,GACA,eAAA;AAAA,iBAEY,4BAAA,CACd,gBAAA,EAAkB,SAAA,KACjB,UAAA;AAAA,iBAuBa,4BAAA,CACd,UAAA,EAAY,UAAA,GACX,SAAA;AAAA,iBA2La,4BAAA,CACd,UAAA,OACA,QAAA,WACA,WAAA,GAAc,MAAA,eACd,WAAA,GAAc,GAAA,WACb,CAAA,CAAE,SAAA;AAAA,iBAyIW,gBAAA,gBAAgC,SAAA,eAAA,CAC9C,UAAA,EAAY,CAAA"}
1
+ {"version":3,"file":"json-schema.d.mts","names":[],"sources":["../../src/utils/json-schema.ts"],"mappings":";;;KAEY,gBAAA;EACV,IAAA;EACA,WAAA;EACA,IAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,iBAAA;EACV,IAAA;EACA,WAAA;AAAA;AAAA,KAGU,gBAAA;EACV,IAAA;EACA,UAAA,GAAa,MAAA,SAAe,UAAA;EAC5B,QAAA;EACA,WAAA;AAAA;AAAA,KAGU,eAAA;EACV,IAAA;EACA,KAAA,EAAO,UAAA;EACP,WAAA;AAAA;AAAA,KAGU,UAAA,GACR,gBAAA,GACA,gBAAA,GACA,iBAAA,GACA,gBAAA,GACA,eAAA;AAAA,iBAEY,4BAAA,CACd,gBAAA,EAAkB,SAAA,KACjB,UAAA;AAAA,iBAuBa,4BAAA,CACd,UAAA,EAAY,UAAA,GACX,SAAA"}