@mastra/server 0.21.2-alpha.0 → 0.22.0-alpha.1
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 +27 -0
- package/dist/{chunk-OEOGYAQC.js → chunk-CO4OYKRH.js} +30 -5
- package/dist/chunk-CO4OYKRH.js.map +1 -0
- package/dist/{chunk-FWO7VQDC.js → chunk-CVOGYUL7.js} +2254 -255
- package/dist/chunk-CVOGYUL7.js.map +1 -0
- package/dist/{chunk-FRWNQFDM.cjs → chunk-FHSOPERI.cjs} +33 -14
- package/dist/chunk-FHSOPERI.cjs.map +1 -0
- package/dist/{chunk-XVPBGW6Y.cjs → chunk-QU6N55W6.cjs} +9 -9
- package/dist/{chunk-XVPBGW6Y.cjs.map → chunk-QU6N55W6.cjs.map} +1 -1
- package/dist/{chunk-MQDBNHBT.cjs → chunk-RJX63KSA.cjs} +85 -36
- package/dist/chunk-RJX63KSA.cjs.map +1 -0
- package/dist/{chunk-SIW6CYO3.js → chunk-SHWNNZBL.js} +7 -7
- package/dist/{chunk-SIW6CYO3.js.map → chunk-SHWNNZBL.js.map} +1 -1
- package/dist/{chunk-FZNS32WJ.js → chunk-TOCYBDP2.js} +4 -4
- package/dist/{chunk-FZNS32WJ.js.map → chunk-TOCYBDP2.js.map} +1 -1
- package/dist/{chunk-OYL5TBJW.cjs → chunk-X6C7BUWN.cjs} +4 -4
- package/dist/{chunk-OYL5TBJW.cjs.map → chunk-X6C7BUWN.cjs.map} +1 -1
- package/dist/{chunk-7H6JZWE3.js → chunk-XDAYZS6N.js} +33 -14
- package/dist/{chunk-7H6JZWE3.js.map → chunk-XDAYZS6N.js.map} +1 -1
- package/dist/{chunk-DB63UMTV.js → chunk-XXPCYVTH.js} +84 -37
- package/dist/chunk-XXPCYVTH.js.map +1 -0
- package/dist/{chunk-7HDOBOGG.cjs → chunk-YKENCZQ2.cjs} +2268 -269
- package/dist/chunk-YKENCZQ2.cjs.map +1 -0
- package/dist/{chunk-3LTO44EP.cjs → chunk-ZEDPVPID.cjs} +30 -5
- package/dist/chunk-ZEDPVPID.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +16 -16
- package/dist/server/handlers/agent-builder.d.ts +1 -1
- package/dist/server/handlers/agent-builder.d.ts.map +1 -1
- package/dist/server/handlers/agent-builder.js +1 -1
- package/dist/server/handlers/agents.cjs +19 -19
- package/dist/server/handlers/agents.d.ts.map +1 -1
- package/dist/server/handlers/agents.js +1 -1
- package/dist/server/handlers/memory.cjs +16 -16
- package/dist/server/handlers/memory.d.ts.map +1 -1
- package/dist/server/handlers/memory.js +1 -1
- package/dist/server/handlers/workflows.cjs +27 -19
- package/dist/server/handlers/workflows.d.ts +10 -4
- package/dist/server/handlers/workflows.d.ts.map +1 -1
- package/dist/server/handlers/workflows.js +1 -1
- package/dist/server/handlers.cjs +8 -8
- package/dist/server/handlers.js +4 -4
- package/dist/{token-53CFGXUO.cjs → token-375W3LEI.cjs} +10 -10
- package/dist/{token-53CFGXUO.cjs.map → token-375W3LEI.cjs.map} +1 -1
- package/dist/{token-WAEKDUVY.js → token-C3IMNCC4.js} +8 -8
- package/dist/{token-WAEKDUVY.js.map → token-C3IMNCC4.js.map} +1 -1
- package/dist/token-util-CV3RRG6K.cjs +9 -0
- package/dist/{token-util-S4A355II.cjs.map → token-util-CV3RRG6K.cjs.map} +1 -1
- package/dist/token-util-E5QO2RCL.js +7 -0
- package/dist/{token-util-LY37VCIN.js.map → token-util-E5QO2RCL.js.map} +1 -1
- package/package.json +5 -5
- package/dist/chunk-3LTO44EP.cjs.map +0 -1
- package/dist/chunk-7HDOBOGG.cjs.map +0 -1
- package/dist/chunk-DB63UMTV.js.map +0 -1
- package/dist/chunk-FRWNQFDM.cjs.map +0 -1
- package/dist/chunk-FWO7VQDC.js.map +0 -1
- package/dist/chunk-MQDBNHBT.cjs.map +0 -1
- package/dist/chunk-OEOGYAQC.js.map +0 -1
- package/dist/token-util-LY37VCIN.js +0 -7
- package/dist/token-util-S4A355II.cjs +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkRJX63KSA_cjs = require('./chunk-RJX63KSA.cjs');
|
|
4
|
+
var chunkX6C7BUWN_cjs = require('./chunk-X6C7BUWN.cjs');
|
|
5
5
|
var chunk2PLXW4ZX_cjs = require('./chunk-2PLXW4ZX.cjs');
|
|
6
6
|
var chunkLPM6BBAX_cjs = require('./chunk-LPM6BBAX.cjs');
|
|
7
7
|
var chunkVY4ENABS_cjs = require('./chunk-VY4ENABS.cjs');
|
|
@@ -45,28 +45,28 @@ function _interopNamespace(e) {
|
|
|
45
45
|
|
|
46
46
|
var z42__namespace = /*#__PURE__*/_interopNamespace(z42);
|
|
47
47
|
|
|
48
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
48
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-context.js
|
|
49
49
|
var require_get_context = chunkO7I5CWRX_cjs.__commonJS({
|
|
50
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
51
|
-
var
|
|
50
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-context.js"(exports, module) {
|
|
51
|
+
var __defProp5 = Object.defineProperty;
|
|
52
52
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
53
53
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
54
54
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
55
|
-
var
|
|
56
|
-
for (var
|
|
57
|
-
|
|
55
|
+
var __export5 = (target, all) => {
|
|
56
|
+
for (var name21 in all)
|
|
57
|
+
__defProp5(target, name21, { get: all[name21], enumerable: true });
|
|
58
58
|
};
|
|
59
59
|
var __copyProps = (to, from, except, desc) => {
|
|
60
60
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
61
61
|
for (let key of __getOwnPropNames(from))
|
|
62
62
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
63
|
-
|
|
63
|
+
__defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
64
64
|
}
|
|
65
65
|
return to;
|
|
66
66
|
};
|
|
67
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
67
|
+
var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
|
|
68
68
|
var get_context_exports = {};
|
|
69
|
-
|
|
69
|
+
__export5(get_context_exports, {
|
|
70
70
|
SYMBOL_FOR_REQ_CONTEXT: () => SYMBOL_FOR_REQ_CONTEXT,
|
|
71
71
|
getContext: () => getContext3
|
|
72
72
|
});
|
|
@@ -79,34 +79,34 @@ var require_get_context = chunkO7I5CWRX_cjs.__commonJS({
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
|
|
82
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
82
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js
|
|
83
83
|
var require_get_vercel_oidc_token = chunkO7I5CWRX_cjs.__commonJS({
|
|
84
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
85
|
-
var
|
|
84
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/get-vercel-oidc-token.js"(exports, module) {
|
|
85
|
+
var __defProp5 = Object.defineProperty;
|
|
86
86
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
87
87
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
88
88
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
89
|
-
var
|
|
90
|
-
for (var
|
|
91
|
-
|
|
89
|
+
var __export5 = (target, all) => {
|
|
90
|
+
for (var name21 in all)
|
|
91
|
+
__defProp5(target, name21, { get: all[name21], enumerable: true });
|
|
92
92
|
};
|
|
93
93
|
var __copyProps = (to, from, except, desc) => {
|
|
94
94
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
95
95
|
for (let key of __getOwnPropNames(from))
|
|
96
96
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
97
|
-
|
|
97
|
+
__defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
98
98
|
}
|
|
99
99
|
return to;
|
|
100
100
|
};
|
|
101
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
101
|
+
var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
|
|
102
102
|
var get_vercel_oidc_token_exports = {};
|
|
103
|
-
|
|
103
|
+
__export5(get_vercel_oidc_token_exports, {
|
|
104
104
|
getVercelOidcToken: () => getVercelOidcToken3,
|
|
105
105
|
getVercelOidcTokenSync: () => getVercelOidcTokenSync2
|
|
106
106
|
});
|
|
107
107
|
module.exports = __toCommonJS(get_vercel_oidc_token_exports);
|
|
108
108
|
var import_get_context = require_get_context();
|
|
109
|
-
var import_token_error =
|
|
109
|
+
var import_token_error = chunkX6C7BUWN_cjs.require_token_error();
|
|
110
110
|
async function getVercelOidcToken3() {
|
|
111
111
|
let token = "";
|
|
112
112
|
let err;
|
|
@@ -117,8 +117,8 @@ var require_get_vercel_oidc_token = chunkO7I5CWRX_cjs.__commonJS({
|
|
|
117
117
|
}
|
|
118
118
|
try {
|
|
119
119
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
120
|
-
await import('./token-util-
|
|
121
|
-
await import('./token-
|
|
120
|
+
await import('./token-util-CV3RRG6K.cjs'),
|
|
121
|
+
await import('./token-375W3LEI.cjs')
|
|
122
122
|
]);
|
|
123
123
|
if (!token || isExpired(getTokenPayload(token))) {
|
|
124
124
|
await refreshToken();
|
|
@@ -145,28 +145,28 @@ ${error.message}`;
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
|
|
148
|
-
// ../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
148
|
+
// ../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/index.js
|
|
149
149
|
var require_dist = chunkO7I5CWRX_cjs.__commonJS({
|
|
150
|
-
"../../node_modules/.pnpm/@vercel+oidc@3.0.
|
|
151
|
-
var
|
|
150
|
+
"../../node_modules/.pnpm/@vercel+oidc@3.0.3/node_modules/@vercel/oidc/dist/index.js"(exports, module) {
|
|
151
|
+
var __defProp5 = Object.defineProperty;
|
|
152
152
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
153
153
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
154
154
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
155
|
-
var
|
|
156
|
-
for (var
|
|
157
|
-
|
|
155
|
+
var __export5 = (target, all) => {
|
|
156
|
+
for (var name21 in all)
|
|
157
|
+
__defProp5(target, name21, { get: all[name21], enumerable: true });
|
|
158
158
|
};
|
|
159
159
|
var __copyProps = (to, from, except, desc) => {
|
|
160
160
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
161
161
|
for (let key of __getOwnPropNames(from))
|
|
162
162
|
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
163
|
-
|
|
163
|
+
__defProp5(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
164
164
|
}
|
|
165
165
|
return to;
|
|
166
166
|
};
|
|
167
|
-
var __toCommonJS = (mod) => __copyProps(
|
|
167
|
+
var __toCommonJS = (mod) => __copyProps(__defProp5({}, "__esModule", { value: true }), mod);
|
|
168
168
|
var src_exports = {};
|
|
169
|
-
|
|
169
|
+
__export5(src_exports, {
|
|
170
170
|
getContext: () => import_get_context.getContext,
|
|
171
171
|
getVercelOidcToken: () => import_get_vercel_oidc_token.getVercelOidcToken,
|
|
172
172
|
getVercelOidcTokenSync: () => import_get_vercel_oidc_token.getVercelOidcTokenSync
|
|
@@ -300,8 +300,8 @@ var require_ignore = chunkO7I5CWRX_cjs.__commonJS({
|
|
|
300
300
|
TMP_KEY_IGNORE = Symbol.for("node-ignore");
|
|
301
301
|
}
|
|
302
302
|
var KEY_IGNORE = TMP_KEY_IGNORE;
|
|
303
|
-
var define = (
|
|
304
|
-
Object.defineProperty(
|
|
303
|
+
var define = (object4, key, value) => {
|
|
304
|
+
Object.defineProperty(object4, key, { value });
|
|
305
305
|
return value;
|
|
306
306
|
};
|
|
307
307
|
var REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g;
|
|
@@ -797,11 +797,11 @@ var getRefs = (options) => {
|
|
|
797
797
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
798
798
|
currentPath,
|
|
799
799
|
propertyPath: void 0,
|
|
800
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
800
|
+
seen: new Map(Object.entries(_options.definitions).map(([name21, def]) => [
|
|
801
801
|
def._def,
|
|
802
802
|
{
|
|
803
803
|
def: def._def,
|
|
804
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
804
|
+
path: [..._options.basePath, _options.definitionPath, name21],
|
|
805
805
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
806
806
|
jsonSchema: void 0
|
|
807
807
|
}
|
|
@@ -1469,11 +1469,11 @@ function parseMapDef(def, refs) {
|
|
|
1469
1469
|
|
|
1470
1470
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
1471
1471
|
function parseNativeEnumDef(def) {
|
|
1472
|
-
const
|
|
1472
|
+
const object4 = def.values;
|
|
1473
1473
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
1474
|
-
return typeof
|
|
1474
|
+
return typeof object4[object4[key]] !== "number";
|
|
1475
1475
|
});
|
|
1476
|
-
const actualValues = actualKeys.map((key) =>
|
|
1476
|
+
const actualValues = actualKeys.map((key) => object4[key]);
|
|
1477
1477
|
const parsedTypes = Array.from(new Set(actualValues.map((values) => typeof values)));
|
|
1478
1478
|
return {
|
|
1479
1479
|
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
@@ -1923,17 +1923,17 @@ function parseDef(def, refs, forceResolution = false) {
|
|
|
1923
1923
|
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
1924
1924
|
refs.seen.set(def, newItem);
|
|
1925
1925
|
const jsonSchemaOrGetter = selectParser(def, def.typeName, refs);
|
|
1926
|
-
const
|
|
1927
|
-
if (
|
|
1928
|
-
addMeta(def, refs,
|
|
1926
|
+
const jsonSchema4 = typeof jsonSchemaOrGetter === "function" ? parseDef(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
1927
|
+
if (jsonSchema4) {
|
|
1928
|
+
addMeta(def, refs, jsonSchema4);
|
|
1929
1929
|
}
|
|
1930
1930
|
if (refs.postProcess) {
|
|
1931
|
-
const postProcessResult = refs.postProcess(
|
|
1932
|
-
newItem.jsonSchema =
|
|
1931
|
+
const postProcessResult = refs.postProcess(jsonSchema4, def, refs);
|
|
1932
|
+
newItem.jsonSchema = jsonSchema4;
|
|
1933
1933
|
return postProcessResult;
|
|
1934
1934
|
}
|
|
1935
|
-
newItem.jsonSchema =
|
|
1936
|
-
return
|
|
1935
|
+
newItem.jsonSchema = jsonSchema4;
|
|
1936
|
+
return jsonSchema4;
|
|
1937
1937
|
}
|
|
1938
1938
|
var get$ref = (item, refs) => {
|
|
1939
1939
|
switch (refs.$refStrategy) {
|
|
@@ -1951,30 +1951,30 @@ var get$ref = (item, refs) => {
|
|
|
1951
1951
|
}
|
|
1952
1952
|
}
|
|
1953
1953
|
};
|
|
1954
|
-
var addMeta = (def, refs,
|
|
1954
|
+
var addMeta = (def, refs, jsonSchema4) => {
|
|
1955
1955
|
if (def.description) {
|
|
1956
|
-
|
|
1956
|
+
jsonSchema4.description = def.description;
|
|
1957
1957
|
if (refs.markdownDescription) {
|
|
1958
|
-
|
|
1958
|
+
jsonSchema4.markdownDescription = def.description;
|
|
1959
1959
|
}
|
|
1960
1960
|
}
|
|
1961
|
-
return
|
|
1961
|
+
return jsonSchema4;
|
|
1962
1962
|
};
|
|
1963
1963
|
|
|
1964
1964
|
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1965
1965
|
var zodToJsonSchema = (schema, options) => {
|
|
1966
1966
|
const refs = getRefs(options);
|
|
1967
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [
|
|
1967
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name26, schema2]) => ({
|
|
1968
1968
|
...acc,
|
|
1969
|
-
[
|
|
1969
|
+
[name26]: parseDef(schema2._def, {
|
|
1970
1970
|
...refs,
|
|
1971
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1971
|
+
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
1972
1972
|
}, true) ?? parseAnyDef(refs)
|
|
1973
1973
|
}), {}) : void 0;
|
|
1974
|
-
const
|
|
1975
|
-
const main = parseDef(schema._def,
|
|
1974
|
+
const name21 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1975
|
+
const main = parseDef(schema._def, name21 === void 0 ? refs : {
|
|
1976
1976
|
...refs,
|
|
1977
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1977
|
+
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
1978
1978
|
}, false) ?? parseAnyDef(refs);
|
|
1979
1979
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1980
1980
|
if (title !== void 0) {
|
|
@@ -1998,18 +1998,18 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
1998
1998
|
};
|
|
1999
1999
|
}
|
|
2000
2000
|
}
|
|
2001
|
-
const combined =
|
|
2001
|
+
const combined = name21 === void 0 ? definitions ? {
|
|
2002
2002
|
...main,
|
|
2003
2003
|
[refs.definitionPath]: definitions
|
|
2004
2004
|
} : main : {
|
|
2005
2005
|
$ref: [
|
|
2006
2006
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
2007
2007
|
refs.definitionPath,
|
|
2008
|
-
|
|
2008
|
+
name21
|
|
2009
2009
|
].join("/"),
|
|
2010
2010
|
[refs.definitionPath]: {
|
|
2011
2011
|
...definitions,
|
|
2012
|
-
[
|
|
2012
|
+
[name21]: main
|
|
2013
2013
|
}
|
|
2014
2014
|
};
|
|
2015
2015
|
if (refs.target === "jsonSchema7") {
|
|
@@ -2027,10 +2027,10 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2027
2027
|
var esm_default = zodToJsonSchema;
|
|
2028
2028
|
|
|
2029
2029
|
// ../schema-compat/dist/chunk-GWTUXMDD.js
|
|
2030
|
-
function zodToJsonSchema2(
|
|
2030
|
+
function zodToJsonSchema2(zodSchema4, target = "jsonSchema7", strategy = "relative") {
|
|
2031
2031
|
const fn = "toJSONSchema";
|
|
2032
2032
|
if (fn in zod.z) {
|
|
2033
|
-
return zod.z[fn](
|
|
2033
|
+
return zod.z[fn](zodSchema4, {
|
|
2034
2034
|
unrepresentable: "any",
|
|
2035
2035
|
override: (ctx) => {
|
|
2036
2036
|
const def = ctx.zodSchema?._zod?.def;
|
|
@@ -2041,7 +2041,7 @@ function zodToJsonSchema2(zodSchema3, target = "jsonSchema7", strategy = "relati
|
|
|
2041
2041
|
}
|
|
2042
2042
|
});
|
|
2043
2043
|
} else {
|
|
2044
|
-
return esm_default(
|
|
2044
|
+
return esm_default(zodSchema4, {
|
|
2045
2045
|
$refStrategy: strategy,
|
|
2046
2046
|
target
|
|
2047
2047
|
});
|
|
@@ -2641,8 +2641,8 @@ function formatDataStreamPart(type, value) {
|
|
|
2641
2641
|
`;
|
|
2642
2642
|
}
|
|
2643
2643
|
function zodSchema(zodSchema22, options) {
|
|
2644
|
-
var
|
|
2645
|
-
const useReferences = (
|
|
2644
|
+
var _a21;
|
|
2645
|
+
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
2646
2646
|
return jsonSchema(
|
|
2647
2647
|
esm_default(zodSchema22, {
|
|
2648
2648
|
$refStrategy: useReferences ? "root" : "none",
|
|
@@ -2755,11 +2755,11 @@ var major = VERSION.split(".")[0];
|
|
|
2755
2755
|
var GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for("opentelemetry.js.api." + major);
|
|
2756
2756
|
var _global = _globalThis;
|
|
2757
2757
|
function registerGlobal(type, instance, diag, allowOverride) {
|
|
2758
|
-
var
|
|
2758
|
+
var _a21;
|
|
2759
2759
|
if (allowOverride === void 0) {
|
|
2760
2760
|
allowOverride = false;
|
|
2761
2761
|
}
|
|
2762
|
-
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
2762
|
+
var api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_a21 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _a21 !== void 0 ? _a21 : {
|
|
2763
2763
|
version: VERSION
|
|
2764
2764
|
};
|
|
2765
2765
|
if (!allowOverride && api[type]) {
|
|
@@ -2777,8 +2777,8 @@ function registerGlobal(type, instance, diag, allowOverride) {
|
|
|
2777
2777
|
return true;
|
|
2778
2778
|
}
|
|
2779
2779
|
function getGlobal(type) {
|
|
2780
|
-
var
|
|
2781
|
-
var globalVersion = (
|
|
2780
|
+
var _a21, _b8;
|
|
2781
|
+
var globalVersion = (_a21 = _global[GLOBAL_OPENTELEMETRY_API_KEY]) === null || _a21 === void 0 ? void 0 : _a21.version;
|
|
2782
2782
|
if (!globalVersion || !isCompatible(globalVersion)) {
|
|
2783
2783
|
return;
|
|
2784
2784
|
}
|
|
@@ -2955,13 +2955,13 @@ var DiagAPI = (
|
|
|
2955
2955
|
}
|
|
2956
2956
|
var self = this;
|
|
2957
2957
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
2958
|
-
var
|
|
2958
|
+
var _a21, _b8, _c;
|
|
2959
2959
|
if (optionsOrLogLevel === void 0) {
|
|
2960
2960
|
optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
2961
2961
|
}
|
|
2962
2962
|
if (logger === self) {
|
|
2963
2963
|
var err = new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
2964
|
-
self.error((
|
|
2964
|
+
self.error((_a21 = err.stack) !== null && _a21 !== void 0 ? _a21 : err.message);
|
|
2965
2965
|
return false;
|
|
2966
2966
|
}
|
|
2967
2967
|
if (typeof optionsOrLogLevel === "number") {
|
|
@@ -3132,12 +3132,12 @@ var ContextAPI = (
|
|
|
3132
3132
|
return this._getContextManager().active();
|
|
3133
3133
|
};
|
|
3134
3134
|
ContextAPI2.prototype.with = function(context, fn, thisArg) {
|
|
3135
|
-
var
|
|
3135
|
+
var _a21;
|
|
3136
3136
|
var args = [];
|
|
3137
3137
|
for (var _i = 3; _i < arguments.length; _i++) {
|
|
3138
3138
|
args[_i - 3] = arguments[_i];
|
|
3139
3139
|
}
|
|
3140
|
-
return (
|
|
3140
|
+
return (_a21 = this._getContextManager()).with.apply(_a21, __spreadArray4([context, fn, thisArg], __read4(args), false));
|
|
3141
3141
|
};
|
|
3142
3142
|
ContextAPI2.prototype.bind = function(context, target) {
|
|
3143
3143
|
return this._getContextManager().bind(context, target);
|
|
@@ -3232,8 +3232,8 @@ function setSpanContext(context, spanContext) {
|
|
|
3232
3232
|
return setSpan(context, new NonRecordingSpan(spanContext));
|
|
3233
3233
|
}
|
|
3234
3234
|
function getSpanContext(context) {
|
|
3235
|
-
var
|
|
3236
|
-
return (
|
|
3235
|
+
var _a21;
|
|
3236
|
+
return (_a21 = getSpan(context)) === null || _a21 === void 0 ? void 0 : _a21.spanContext();
|
|
3237
3237
|
}
|
|
3238
3238
|
|
|
3239
3239
|
// ../../node_modules/.pnpm/@opentelemetry+api@1.9.0/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js
|
|
@@ -3259,7 +3259,7 @@ var NoopTracer = (
|
|
|
3259
3259
|
(function() {
|
|
3260
3260
|
function NoopTracer2() {
|
|
3261
3261
|
}
|
|
3262
|
-
NoopTracer2.prototype.startSpan = function(
|
|
3262
|
+
NoopTracer2.prototype.startSpan = function(name21, options, context) {
|
|
3263
3263
|
if (context === void 0) {
|
|
3264
3264
|
context = contextApi.active();
|
|
3265
3265
|
}
|
|
@@ -3274,7 +3274,7 @@ var NoopTracer = (
|
|
|
3274
3274
|
return new NonRecordingSpan();
|
|
3275
3275
|
}
|
|
3276
3276
|
};
|
|
3277
|
-
NoopTracer2.prototype.startActiveSpan = function(
|
|
3277
|
+
NoopTracer2.prototype.startActiveSpan = function(name21, arg2, arg3, arg4) {
|
|
3278
3278
|
var opts;
|
|
3279
3279
|
var ctx;
|
|
3280
3280
|
var fn;
|
|
@@ -3291,7 +3291,7 @@ var NoopTracer = (
|
|
|
3291
3291
|
fn = arg4;
|
|
3292
3292
|
}
|
|
3293
3293
|
var parentContext = ctx !== null && ctx !== void 0 ? ctx : contextApi.active();
|
|
3294
|
-
var span = this.startSpan(
|
|
3294
|
+
var span = this.startSpan(name21, opts, parentContext);
|
|
3295
3295
|
var contextWithSpanSet = setSpan(parentContext, span);
|
|
3296
3296
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
3297
3297
|
};
|
|
@@ -3307,14 +3307,14 @@ var NOOP_TRACER = new NoopTracer();
|
|
|
3307
3307
|
var ProxyTracer = (
|
|
3308
3308
|
/** @class */
|
|
3309
3309
|
(function() {
|
|
3310
|
-
function ProxyTracer2(_provider,
|
|
3310
|
+
function ProxyTracer2(_provider, name21, version, options) {
|
|
3311
3311
|
this._provider = _provider;
|
|
3312
|
-
this.name =
|
|
3312
|
+
this.name = name21;
|
|
3313
3313
|
this.version = version;
|
|
3314
3314
|
this.options = options;
|
|
3315
3315
|
}
|
|
3316
|
-
ProxyTracer2.prototype.startSpan = function(
|
|
3317
|
-
return this._getTracer().startSpan(
|
|
3316
|
+
ProxyTracer2.prototype.startSpan = function(name21, options, context) {
|
|
3317
|
+
return this._getTracer().startSpan(name21, options, context);
|
|
3318
3318
|
};
|
|
3319
3319
|
ProxyTracer2.prototype.startActiveSpan = function(_name, _options, _context, _fn) {
|
|
3320
3320
|
var tracer = this._getTracer();
|
|
@@ -3355,20 +3355,20 @@ var ProxyTracerProvider = (
|
|
|
3355
3355
|
(function() {
|
|
3356
3356
|
function ProxyTracerProvider2() {
|
|
3357
3357
|
}
|
|
3358
|
-
ProxyTracerProvider2.prototype.getTracer = function(
|
|
3359
|
-
var
|
|
3360
|
-
return (
|
|
3358
|
+
ProxyTracerProvider2.prototype.getTracer = function(name21, version, options) {
|
|
3359
|
+
var _a21;
|
|
3360
|
+
return (_a21 = this.getDelegateTracer(name21, version, options)) !== null && _a21 !== void 0 ? _a21 : new ProxyTracer(this, name21, version, options);
|
|
3361
3361
|
};
|
|
3362
3362
|
ProxyTracerProvider2.prototype.getDelegate = function() {
|
|
3363
|
-
var
|
|
3364
|
-
return (
|
|
3363
|
+
var _a21;
|
|
3364
|
+
return (_a21 = this._delegate) !== null && _a21 !== void 0 ? _a21 : NOOP_TRACER_PROVIDER;
|
|
3365
3365
|
};
|
|
3366
3366
|
ProxyTracerProvider2.prototype.setDelegate = function(delegate) {
|
|
3367
3367
|
this._delegate = delegate;
|
|
3368
3368
|
};
|
|
3369
|
-
ProxyTracerProvider2.prototype.getDelegateTracer = function(
|
|
3370
|
-
var
|
|
3371
|
-
return (
|
|
3369
|
+
ProxyTracerProvider2.prototype.getDelegateTracer = function(name21, version, options) {
|
|
3370
|
+
var _a21;
|
|
3371
|
+
return (_a21 = this._delegate) === null || _a21 === void 0 ? void 0 : _a21.getTracer(name21, version, options);
|
|
3372
3372
|
};
|
|
3373
3373
|
return ProxyTracerProvider2;
|
|
3374
3374
|
})()
|
|
@@ -3414,8 +3414,8 @@ var TraceAPI = (
|
|
|
3414
3414
|
TraceAPI2.prototype.getTracerProvider = function() {
|
|
3415
3415
|
return getGlobal(API_NAME3) || this._proxyTracerProvider;
|
|
3416
3416
|
};
|
|
3417
|
-
TraceAPI2.prototype.getTracer = function(
|
|
3418
|
-
return this.getTracerProvider().getTracer(
|
|
3417
|
+
TraceAPI2.prototype.getTracer = function(name21, version) {
|
|
3418
|
+
return this.getTracerProvider().getTracer(name21, version);
|
|
3419
3419
|
};
|
|
3420
3420
|
TraceAPI2.prototype.disable = function() {
|
|
3421
3421
|
unregisterGlobal(API_NAME3, DiagAPI.instance());
|
|
@@ -4586,13 +4586,13 @@ var _AISDKError = class _AISDKError2 extends Error {
|
|
|
4586
4586
|
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
4587
4587
|
*/
|
|
4588
4588
|
constructor({
|
|
4589
|
-
name:
|
|
4589
|
+
name: name144,
|
|
4590
4590
|
message,
|
|
4591
4591
|
cause
|
|
4592
4592
|
}) {
|
|
4593
4593
|
super(message);
|
|
4594
4594
|
this[_a17] = true;
|
|
4595
|
-
this.name =
|
|
4595
|
+
this.name = name144;
|
|
4596
4596
|
this.cause = cause;
|
|
4597
4597
|
}
|
|
4598
4598
|
/**
|
|
@@ -4603,8 +4603,8 @@ var _AISDKError = class _AISDKError2 extends Error {
|
|
|
4603
4603
|
static isInstance(error) {
|
|
4604
4604
|
return _AISDKError2.hasMarker(error, marker17);
|
|
4605
4605
|
}
|
|
4606
|
-
static hasMarker(error,
|
|
4607
|
-
const markerSymbol = Symbol.for(
|
|
4606
|
+
static hasMarker(error, marker154) {
|
|
4607
|
+
const markerSymbol = Symbol.for(marker154);
|
|
4608
4608
|
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
4609
4609
|
}
|
|
4610
4610
|
};
|
|
@@ -4696,15 +4696,15 @@ var marker72 = `vercel.ai.error.${name62}`;
|
|
|
4696
4696
|
var symbol72 = Symbol.for(marker72);
|
|
4697
4697
|
var _a72;
|
|
4698
4698
|
var JSONParseError = class extends AISDKError2 {
|
|
4699
|
-
constructor({ text:
|
|
4699
|
+
constructor({ text: text4, cause }) {
|
|
4700
4700
|
super({
|
|
4701
4701
|
name: name62,
|
|
4702
|
-
message: `JSON parsing failed: Text: ${
|
|
4702
|
+
message: `JSON parsing failed: Text: ${text4}.
|
|
4703
4703
|
Error message: ${getErrorMessage2(cause)}`,
|
|
4704
4704
|
cause
|
|
4705
4705
|
});
|
|
4706
4706
|
this[_a72] = true;
|
|
4707
|
-
this.text =
|
|
4707
|
+
this.text = text4;
|
|
4708
4708
|
}
|
|
4709
4709
|
static isInstance(error) {
|
|
4710
4710
|
return AISDKError2.hasMarker(error, marker72);
|
|
@@ -4937,11 +4937,11 @@ function extractResponseHeaders(response) {
|
|
|
4937
4937
|
return Object.fromEntries([...response.headers]);
|
|
4938
4938
|
}
|
|
4939
4939
|
function getRuntimeEnvironmentUserAgent(globalThisAny = globalThis) {
|
|
4940
|
-
var
|
|
4940
|
+
var _a21, _b8, _c;
|
|
4941
4941
|
if (globalThisAny.window) {
|
|
4942
4942
|
return `runtime/browser`;
|
|
4943
4943
|
}
|
|
4944
|
-
if ((
|
|
4944
|
+
if ((_a21 = globalThisAny.navigator) == null ? void 0 : _a21.userAgent) {
|
|
4945
4945
|
return `runtime/${globalThisAny.navigator.userAgent.toLowerCase()}`;
|
|
4946
4946
|
}
|
|
4947
4947
|
if ((_c = (_b8 = globalThisAny.process) == null ? void 0 : _b8.versions) == null ? void 0 : _c.node) {
|
|
@@ -5122,12 +5122,12 @@ function loadOptionalSetting({
|
|
|
5122
5122
|
}
|
|
5123
5123
|
var suspectProtoRx = /"__proto__"\s*:/;
|
|
5124
5124
|
var suspectConstructorRx = /"constructor"\s*:/;
|
|
5125
|
-
function _parse(
|
|
5126
|
-
const obj = JSON.parse(
|
|
5125
|
+
function _parse(text4) {
|
|
5126
|
+
const obj = JSON.parse(text4);
|
|
5127
5127
|
if (obj === null || typeof obj !== "object") {
|
|
5128
5128
|
return obj;
|
|
5129
5129
|
}
|
|
5130
|
-
if (suspectProtoRx.test(
|
|
5130
|
+
if (suspectProtoRx.test(text4) === false && suspectConstructorRx.test(text4) === false) {
|
|
5131
5131
|
return obj;
|
|
5132
5132
|
}
|
|
5133
5133
|
return filter(obj);
|
|
@@ -5154,11 +5154,11 @@ function filter(obj) {
|
|
|
5154
5154
|
}
|
|
5155
5155
|
return obj;
|
|
5156
5156
|
}
|
|
5157
|
-
function secureJsonParse(
|
|
5157
|
+
function secureJsonParse(text4) {
|
|
5158
5158
|
const { stackTraceLimit } = Error;
|
|
5159
5159
|
Error.stackTraceLimit = 0;
|
|
5160
5160
|
try {
|
|
5161
|
-
return _parse(
|
|
5161
|
+
return _parse(text4);
|
|
5162
5162
|
} finally {
|
|
5163
5163
|
Error.stackTraceLimit = stackTraceLimit;
|
|
5164
5164
|
}
|
|
@@ -5199,12 +5199,12 @@ async function safeValidateTypes2({
|
|
|
5199
5199
|
value,
|
|
5200
5200
|
schema
|
|
5201
5201
|
}) {
|
|
5202
|
-
const
|
|
5202
|
+
const validator22 = asValidator(schema);
|
|
5203
5203
|
try {
|
|
5204
|
-
if (
|
|
5204
|
+
if (validator22.validate == null) {
|
|
5205
5205
|
return { success: true, value, rawValue: value };
|
|
5206
5206
|
}
|
|
5207
|
-
const result = await
|
|
5207
|
+
const result = await validator22.validate(value);
|
|
5208
5208
|
if (result.success) {
|
|
5209
5209
|
return { success: true, value: result.value, rawValue: value };
|
|
5210
5210
|
}
|
|
@@ -5222,11 +5222,11 @@ async function safeValidateTypes2({
|
|
|
5222
5222
|
}
|
|
5223
5223
|
}
|
|
5224
5224
|
async function parseJSON({
|
|
5225
|
-
text:
|
|
5225
|
+
text: text4,
|
|
5226
5226
|
schema
|
|
5227
5227
|
}) {
|
|
5228
5228
|
try {
|
|
5229
|
-
const value = secureJsonParse(
|
|
5229
|
+
const value = secureJsonParse(text4);
|
|
5230
5230
|
if (schema == null) {
|
|
5231
5231
|
return value;
|
|
5232
5232
|
}
|
|
@@ -5235,15 +5235,15 @@ async function parseJSON({
|
|
|
5235
5235
|
if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
|
|
5236
5236
|
throw error;
|
|
5237
5237
|
}
|
|
5238
|
-
throw new JSONParseError({ text:
|
|
5238
|
+
throw new JSONParseError({ text: text4, cause: error });
|
|
5239
5239
|
}
|
|
5240
5240
|
}
|
|
5241
5241
|
async function safeParseJSON2({
|
|
5242
|
-
text:
|
|
5242
|
+
text: text4,
|
|
5243
5243
|
schema
|
|
5244
5244
|
}) {
|
|
5245
5245
|
try {
|
|
5246
|
-
const value = secureJsonParse(
|
|
5246
|
+
const value = secureJsonParse(text4);
|
|
5247
5247
|
if (schema == null) {
|
|
5248
5248
|
return { success: true, value, rawValue: value };
|
|
5249
5249
|
}
|
|
@@ -5251,7 +5251,7 @@ async function safeParseJSON2({
|
|
|
5251
5251
|
} catch (error) {
|
|
5252
5252
|
return {
|
|
5253
5253
|
success: false,
|
|
5254
|
-
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text:
|
|
5254
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
|
|
5255
5255
|
rawValue: void 0
|
|
5256
5256
|
};
|
|
5257
5257
|
}
|
|
@@ -5504,11 +5504,11 @@ function parseAnyDef2() {
|
|
|
5504
5504
|
return {};
|
|
5505
5505
|
}
|
|
5506
5506
|
function parseArrayDef2(def, refs) {
|
|
5507
|
-
var
|
|
5507
|
+
var _a21, _b8, _c;
|
|
5508
5508
|
const res = {
|
|
5509
5509
|
type: "array"
|
|
5510
5510
|
};
|
|
5511
|
-
if (((
|
|
5511
|
+
if (((_a21 = def.type) == null ? void 0 : _a21._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
5512
5512
|
res.items = parseDef2(def.type._def, {
|
|
5513
5513
|
...refs,
|
|
5514
5514
|
currentPath: [...refs.currentPath, "items"]
|
|
@@ -5869,8 +5869,8 @@ function escapeNonAlphaNumeric2(source) {
|
|
|
5869
5869
|
return result;
|
|
5870
5870
|
}
|
|
5871
5871
|
function addFormat2(schema, value, message, refs) {
|
|
5872
|
-
var
|
|
5873
|
-
if (schema.format || ((
|
|
5872
|
+
var _a21;
|
|
5873
|
+
if (schema.format || ((_a21 = schema.anyOf) == null ? void 0 : _a21.some((x) => x.format))) {
|
|
5874
5874
|
if (!schema.anyOf) {
|
|
5875
5875
|
schema.anyOf = [];
|
|
5876
5876
|
}
|
|
@@ -5889,8 +5889,8 @@ function addFormat2(schema, value, message, refs) {
|
|
|
5889
5889
|
}
|
|
5890
5890
|
}
|
|
5891
5891
|
function addPattern2(schema, regex, message, refs) {
|
|
5892
|
-
var
|
|
5893
|
-
if (schema.pattern || ((
|
|
5892
|
+
var _a21;
|
|
5893
|
+
if (schema.pattern || ((_a21 = schema.allOf) == null ? void 0 : _a21.some((x) => x.pattern))) {
|
|
5894
5894
|
if (!schema.allOf) {
|
|
5895
5895
|
schema.allOf = [];
|
|
5896
5896
|
}
|
|
@@ -5909,7 +5909,7 @@ function addPattern2(schema, regex, message, refs) {
|
|
|
5909
5909
|
}
|
|
5910
5910
|
}
|
|
5911
5911
|
function stringifyRegExpWithFlags2(regex, refs) {
|
|
5912
|
-
var
|
|
5912
|
+
var _a21;
|
|
5913
5913
|
if (!refs.applyRegexFlags || !regex.flags) {
|
|
5914
5914
|
return regex.source;
|
|
5915
5915
|
}
|
|
@@ -5939,7 +5939,7 @@ function stringifyRegExpWithFlags2(regex, refs) {
|
|
|
5939
5939
|
pattern += source[i];
|
|
5940
5940
|
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
5941
5941
|
inCharRange = false;
|
|
5942
|
-
} else if (source[i + 1] === "-" && ((
|
|
5942
|
+
} else if (source[i + 1] === "-" && ((_a21 = source[i + 2]) == null ? void 0 : _a21.match(/[a-z]/))) {
|
|
5943
5943
|
pattern += source[i];
|
|
5944
5944
|
inCharRange = true;
|
|
5945
5945
|
} else {
|
|
@@ -5981,13 +5981,13 @@ function stringifyRegExpWithFlags2(regex, refs) {
|
|
|
5981
5981
|
return pattern;
|
|
5982
5982
|
}
|
|
5983
5983
|
function parseRecordDef2(def, refs) {
|
|
5984
|
-
var
|
|
5984
|
+
var _a21, _b8, _c, _d, _e, _f;
|
|
5985
5985
|
const schema = {
|
|
5986
5986
|
type: "object",
|
|
5987
|
-
additionalProperties: (
|
|
5987
|
+
additionalProperties: (_a21 = parseDef2(def.valueType._def, {
|
|
5988
5988
|
...refs,
|
|
5989
5989
|
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
5990
|
-
})) != null ?
|
|
5990
|
+
})) != null ? _a21 : refs.allowedAdditionalProperties
|
|
5991
5991
|
};
|
|
5992
5992
|
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
5993
5993
|
const { type, ...keyType } = parseStringDef2(def.keyType._def, refs);
|
|
@@ -6038,11 +6038,11 @@ function parseMapDef2(def, refs) {
|
|
|
6038
6038
|
};
|
|
6039
6039
|
}
|
|
6040
6040
|
function parseNativeEnumDef2(def) {
|
|
6041
|
-
const
|
|
6041
|
+
const object4 = def.values;
|
|
6042
6042
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
6043
|
-
return typeof
|
|
6043
|
+
return typeof object4[object4[key]] !== "number";
|
|
6044
6044
|
});
|
|
6045
|
-
const actualValues = actualKeys.map((key) =>
|
|
6045
|
+
const actualValues = actualKeys.map((key) => object4[key]);
|
|
6046
6046
|
const parsedTypes = Array.from(
|
|
6047
6047
|
new Set(actualValues.map((values) => typeof values))
|
|
6048
6048
|
);
|
|
@@ -6246,8 +6246,8 @@ function safeIsOptional2(schema) {
|
|
|
6246
6246
|
}
|
|
6247
6247
|
}
|
|
6248
6248
|
var parseOptionalDef2 = (def, refs) => {
|
|
6249
|
-
var
|
|
6250
|
-
if (refs.currentPath.toString() === ((
|
|
6249
|
+
var _a21;
|
|
6250
|
+
if (refs.currentPath.toString() === ((_a21 = refs.propertyPath) == null ? void 0 : _a21.toString())) {
|
|
6251
6251
|
return parseDef2(def.innerType._def, refs);
|
|
6252
6252
|
}
|
|
6253
6253
|
const innerSchema = parseDef2(def.innerType._def, {
|
|
@@ -6417,10 +6417,10 @@ var selectParser2 = (def, typeName, refs) => {
|
|
|
6417
6417
|
}
|
|
6418
6418
|
};
|
|
6419
6419
|
function parseDef2(def, refs, forceResolution = false) {
|
|
6420
|
-
var
|
|
6420
|
+
var _a21;
|
|
6421
6421
|
const seenItem = refs.seen.get(def);
|
|
6422
6422
|
if (refs.override) {
|
|
6423
|
-
const overrideResult = (
|
|
6423
|
+
const overrideResult = (_a21 = refs.override) == null ? void 0 : _a21.call(
|
|
6424
6424
|
refs,
|
|
6425
6425
|
def,
|
|
6426
6426
|
refs,
|
|
@@ -6486,11 +6486,11 @@ var getRefs2 = (options) => {
|
|
|
6486
6486
|
currentPath,
|
|
6487
6487
|
propertyPath: void 0,
|
|
6488
6488
|
seen: new Map(
|
|
6489
|
-
Object.entries(_options.definitions).map(([
|
|
6489
|
+
Object.entries(_options.definitions).map(([name21, def]) => [
|
|
6490
6490
|
def._def,
|
|
6491
6491
|
{
|
|
6492
6492
|
def: def._def,
|
|
6493
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
6493
|
+
path: [..._options.basePath, _options.definitionPath, name21],
|
|
6494
6494
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
6495
6495
|
jsonSchema: void 0
|
|
6496
6496
|
}
|
|
@@ -6499,50 +6499,50 @@ var getRefs2 = (options) => {
|
|
|
6499
6499
|
};
|
|
6500
6500
|
};
|
|
6501
6501
|
var zodToJsonSchema3 = (schema, options) => {
|
|
6502
|
-
var
|
|
6502
|
+
var _a21;
|
|
6503
6503
|
const refs = getRefs2(options);
|
|
6504
6504
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
6505
|
-
(acc, [
|
|
6506
|
-
var
|
|
6505
|
+
(acc, [name26, schema2]) => {
|
|
6506
|
+
var _a26;
|
|
6507
6507
|
return {
|
|
6508
6508
|
...acc,
|
|
6509
|
-
[
|
|
6509
|
+
[name26]: (_a26 = parseDef2(
|
|
6510
6510
|
schema2._def,
|
|
6511
6511
|
{
|
|
6512
6512
|
...refs,
|
|
6513
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
6513
|
+
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
6514
6514
|
},
|
|
6515
6515
|
true
|
|
6516
|
-
)) != null ?
|
|
6516
|
+
)) != null ? _a26 : parseAnyDef2()
|
|
6517
6517
|
};
|
|
6518
6518
|
},
|
|
6519
6519
|
{}
|
|
6520
6520
|
) : void 0;
|
|
6521
|
-
const
|
|
6522
|
-
const main = (
|
|
6521
|
+
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
6522
|
+
const main = (_a21 = parseDef2(
|
|
6523
6523
|
schema._def,
|
|
6524
|
-
|
|
6524
|
+
name21 === void 0 ? refs : {
|
|
6525
6525
|
...refs,
|
|
6526
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
6526
|
+
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
6527
6527
|
},
|
|
6528
6528
|
false
|
|
6529
|
-
)) != null ?
|
|
6529
|
+
)) != null ? _a21 : parseAnyDef2();
|
|
6530
6530
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
6531
6531
|
if (title !== void 0) {
|
|
6532
6532
|
main.title = title;
|
|
6533
6533
|
}
|
|
6534
|
-
const combined =
|
|
6534
|
+
const combined = name21 === void 0 ? definitions ? {
|
|
6535
6535
|
...main,
|
|
6536
6536
|
[refs.definitionPath]: definitions
|
|
6537
6537
|
} : main : {
|
|
6538
6538
|
$ref: [
|
|
6539
6539
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
6540
6540
|
refs.definitionPath,
|
|
6541
|
-
|
|
6541
|
+
name21
|
|
6542
6542
|
].join("/"),
|
|
6543
6543
|
[refs.definitionPath]: {
|
|
6544
6544
|
...definitions,
|
|
6545
|
-
[
|
|
6545
|
+
[name21]: main
|
|
6546
6546
|
}
|
|
6547
6547
|
};
|
|
6548
6548
|
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
@@ -6550,8 +6550,8 @@ var zodToJsonSchema3 = (schema, options) => {
|
|
|
6550
6550
|
};
|
|
6551
6551
|
var zod_to_json_schema_default = zodToJsonSchema3;
|
|
6552
6552
|
function zod3Schema(zodSchema22, options) {
|
|
6553
|
-
var
|
|
6554
|
-
const useReferences = (
|
|
6553
|
+
var _a21;
|
|
6554
|
+
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
6555
6555
|
return jsonSchema2(
|
|
6556
6556
|
zod_to_json_schema_default(zodSchema22, {
|
|
6557
6557
|
$refStrategy: useReferences ? "root" : "none"
|
|
@@ -6565,8 +6565,8 @@ function zod3Schema(zodSchema22, options) {
|
|
|
6565
6565
|
);
|
|
6566
6566
|
}
|
|
6567
6567
|
function zod4Schema(zodSchema22, options) {
|
|
6568
|
-
var
|
|
6569
|
-
const useReferences = (
|
|
6568
|
+
var _a21;
|
|
6569
|
+
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
6570
6570
|
const z4JSONSchema = z42__namespace.toJSONSchema(zodSchema22, {
|
|
6571
6571
|
target: "draft-7",
|
|
6572
6572
|
io: "output",
|
|
@@ -6878,14 +6878,14 @@ var gatewayErrorResponseSchema = z42.z.object({
|
|
|
6878
6878
|
})
|
|
6879
6879
|
});
|
|
6880
6880
|
function asGatewayError(error, authMethod) {
|
|
6881
|
-
var
|
|
6881
|
+
var _a85;
|
|
6882
6882
|
if (GatewayError.isInstance(error)) {
|
|
6883
6883
|
return error;
|
|
6884
6884
|
}
|
|
6885
6885
|
if (APICallError2.isInstance(error)) {
|
|
6886
6886
|
return createGatewayErrorFromResponse({
|
|
6887
6887
|
response: extractApiCallResponse(error),
|
|
6888
|
-
statusCode: (
|
|
6888
|
+
statusCode: (_a85 = error.statusCode) != null ? _a85 : 500,
|
|
6889
6889
|
defaultMessage: "Gateway request failed",
|
|
6890
6890
|
cause: error,
|
|
6891
6891
|
authMethod
|
|
@@ -7161,7 +7161,7 @@ var GatewayEmbeddingModel = class {
|
|
|
7161
7161
|
abortSignal,
|
|
7162
7162
|
providerOptions
|
|
7163
7163
|
}) {
|
|
7164
|
-
var
|
|
7164
|
+
var _a85;
|
|
7165
7165
|
const resolvedHeaders = await resolve(this.config.headers());
|
|
7166
7166
|
try {
|
|
7167
7167
|
const {
|
|
@@ -7192,7 +7192,7 @@ var GatewayEmbeddingModel = class {
|
|
|
7192
7192
|
});
|
|
7193
7193
|
return {
|
|
7194
7194
|
embeddings: responseBody.embeddings,
|
|
7195
|
-
usage: (
|
|
7195
|
+
usage: (_a85 = responseBody.usage) != null ? _a85 : void 0,
|
|
7196
7196
|
providerMetadata: responseBody.providerMetadata,
|
|
7197
7197
|
response: { headers: responseHeaders, body: rawValue }
|
|
7198
7198
|
};
|
|
@@ -7216,16 +7216,16 @@ var gatewayEmbeddingResponseSchema = z42.z.object({
|
|
|
7216
7216
|
providerMetadata: z42.z.record(z42.z.string(), z42.z.record(z42.z.string(), z42.z.unknown())).optional()
|
|
7217
7217
|
});
|
|
7218
7218
|
async function getVercelRequestId() {
|
|
7219
|
-
var
|
|
7220
|
-
return (
|
|
7219
|
+
var _a85;
|
|
7220
|
+
return (_a85 = (0, import_oidc.getContext)().headers) == null ? void 0 : _a85["x-vercel-id"];
|
|
7221
7221
|
}
|
|
7222
7222
|
var VERSION3 = "1.0.33" ;
|
|
7223
7223
|
var AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
7224
7224
|
function createGatewayProvider(options = {}) {
|
|
7225
|
-
var
|
|
7225
|
+
var _a85, _b8;
|
|
7226
7226
|
let pendingMetadata = null;
|
|
7227
7227
|
let metadataCache = null;
|
|
7228
|
-
const cacheRefreshMillis = (
|
|
7228
|
+
const cacheRefreshMillis = (_a85 = options.metadataCacheRefreshMillis) != null ? _a85 : 1e3 * 60 * 5;
|
|
7229
7229
|
let lastFetchTime = 0;
|
|
7230
7230
|
const baseURL = (_b8 = withoutTrailingSlash(options.baseURL)) != null ? _b8 : "https://ai-gateway.vercel.sh/v1/ai";
|
|
7231
7231
|
const getHeaders = async () => {
|
|
@@ -7280,8 +7280,8 @@ function createGatewayProvider(options = {}) {
|
|
|
7280
7280
|
});
|
|
7281
7281
|
};
|
|
7282
7282
|
const getAvailableModels = async () => {
|
|
7283
|
-
var
|
|
7284
|
-
const now = (_c = (_b9 = (
|
|
7283
|
+
var _a95, _b9, _c;
|
|
7284
|
+
const now = (_c = (_b9 = (_a95 = options._internal) == null ? void 0 : _a95.currentDate) == null ? void 0 : _b9.call(_a95).getTime()) != null ? _c : Date.now();
|
|
7285
7285
|
if (!pendingMetadata || now - lastFetchTime > cacheRefreshMillis) {
|
|
7286
7286
|
lastFetchTime = now;
|
|
7287
7287
|
pendingMetadata = new GatewayFetchMetadata({
|
|
@@ -7902,9 +7902,6 @@ function prepareRetries2({
|
|
|
7902
7902
|
})
|
|
7903
7903
|
};
|
|
7904
7904
|
}
|
|
7905
|
-
function stepCountIs(stepCount) {
|
|
7906
|
-
return ({ steps }) => steps.length === stepCount;
|
|
7907
|
-
}
|
|
7908
7905
|
createIdGenerator2({
|
|
7909
7906
|
prefix: "aitxt",
|
|
7910
7907
|
size: 24
|
|
@@ -9616,50 +9613,50 @@ function isValidWithSchema(schema, value) {
|
|
|
9616
9613
|
return schema.safeParse(value).success;
|
|
9617
9614
|
}
|
|
9618
9615
|
var NotHandler = class {
|
|
9619
|
-
apply(
|
|
9620
|
-
if (!schema.not) return
|
|
9616
|
+
apply(zodSchema4, schema) {
|
|
9617
|
+
if (!schema.not) return zodSchema4;
|
|
9621
9618
|
const notSchema = convertJsonSchemaToZod(schema.not);
|
|
9622
|
-
return
|
|
9619
|
+
return zodSchema4.refine(
|
|
9623
9620
|
(value) => !isValidWithSchema(notSchema, value),
|
|
9624
9621
|
{ message: "Value must not match the 'not' schema" }
|
|
9625
9622
|
);
|
|
9626
9623
|
}
|
|
9627
9624
|
};
|
|
9628
9625
|
var UniqueItemsHandler = class {
|
|
9629
|
-
apply(
|
|
9626
|
+
apply(zodSchema4, schema) {
|
|
9630
9627
|
const arraySchema = schema;
|
|
9631
|
-
if (arraySchema.uniqueItems !== true) return
|
|
9632
|
-
return
|
|
9628
|
+
if (arraySchema.uniqueItems !== true) return zodSchema4;
|
|
9629
|
+
return zodSchema4.refine(createUniqueItemsValidator(), {
|
|
9633
9630
|
message: "Array items must be unique"
|
|
9634
9631
|
});
|
|
9635
9632
|
}
|
|
9636
9633
|
};
|
|
9637
9634
|
var AllOfHandler = class {
|
|
9638
|
-
apply(
|
|
9639
|
-
if (!schema.allOf || schema.allOf.length === 0) return
|
|
9635
|
+
apply(zodSchema4, schema) {
|
|
9636
|
+
if (!schema.allOf || schema.allOf.length === 0) return zodSchema4;
|
|
9640
9637
|
const allOfSchemas = schema.allOf.map((s) => convertJsonSchemaToZod(s));
|
|
9641
9638
|
return allOfSchemas.reduce(
|
|
9642
9639
|
(acc, s) => z42.z.intersection(acc, s),
|
|
9643
|
-
|
|
9640
|
+
zodSchema4
|
|
9644
9641
|
);
|
|
9645
9642
|
}
|
|
9646
9643
|
};
|
|
9647
9644
|
var AnyOfHandler = class {
|
|
9648
|
-
apply(
|
|
9649
|
-
if (!schema.anyOf || schema.anyOf.length === 0) return
|
|
9645
|
+
apply(zodSchema4, schema) {
|
|
9646
|
+
if (!schema.anyOf || schema.anyOf.length === 0) return zodSchema4;
|
|
9650
9647
|
const anyOfSchema = schema.anyOf.length === 1 ? convertJsonSchemaToZod(schema.anyOf[0]) : z42.z.union([
|
|
9651
9648
|
convertJsonSchemaToZod(schema.anyOf[0]),
|
|
9652
9649
|
convertJsonSchemaToZod(schema.anyOf[1]),
|
|
9653
9650
|
...schema.anyOf.slice(2).map((s) => convertJsonSchemaToZod(s))
|
|
9654
9651
|
]);
|
|
9655
|
-
return z42.z.intersection(
|
|
9652
|
+
return z42.z.intersection(zodSchema4, anyOfSchema);
|
|
9656
9653
|
}
|
|
9657
9654
|
};
|
|
9658
9655
|
var OneOfHandler = class {
|
|
9659
|
-
apply(
|
|
9660
|
-
if (!schema.oneOf || schema.oneOf.length === 0) return
|
|
9656
|
+
apply(zodSchema4, schema) {
|
|
9657
|
+
if (!schema.oneOf || schema.oneOf.length === 0) return zodSchema4;
|
|
9661
9658
|
const oneOfSchemas = schema.oneOf.map((s) => convertJsonSchemaToZod(s));
|
|
9662
|
-
return
|
|
9659
|
+
return zodSchema4.refine(
|
|
9663
9660
|
(value) => {
|
|
9664
9661
|
let validCount = 0;
|
|
9665
9662
|
for (const oneOfSchema of oneOfSchemas) {
|
|
@@ -9676,12 +9673,12 @@ var OneOfHandler = class {
|
|
|
9676
9673
|
}
|
|
9677
9674
|
};
|
|
9678
9675
|
var PrefixItemsHandler = class {
|
|
9679
|
-
apply(
|
|
9676
|
+
apply(zodSchema4, schema) {
|
|
9680
9677
|
const arraySchema = schema;
|
|
9681
9678
|
if (arraySchema.prefixItems && Array.isArray(arraySchema.prefixItems)) {
|
|
9682
9679
|
const prefixItems = arraySchema.prefixItems;
|
|
9683
9680
|
const prefixSchemas = prefixItems.map((itemSchema) => convertJsonSchemaToZod(itemSchema));
|
|
9684
|
-
return
|
|
9681
|
+
return zodSchema4.refine(
|
|
9685
9682
|
(value) => {
|
|
9686
9683
|
if (!Array.isArray(value)) return true;
|
|
9687
9684
|
for (let i = 0; i < Math.min(value.length, prefixSchemas.length); i++) {
|
|
@@ -9706,16 +9703,16 @@ var PrefixItemsHandler = class {
|
|
|
9706
9703
|
{ message: "Array does not match prefixItems schema" }
|
|
9707
9704
|
);
|
|
9708
9705
|
}
|
|
9709
|
-
return
|
|
9706
|
+
return zodSchema4;
|
|
9710
9707
|
}
|
|
9711
9708
|
};
|
|
9712
9709
|
var ObjectPropertiesHandler = class {
|
|
9713
|
-
apply(
|
|
9710
|
+
apply(zodSchema4, schema) {
|
|
9714
9711
|
const objectSchema = schema;
|
|
9715
9712
|
if (!objectSchema.properties && !objectSchema.required && objectSchema.additionalProperties !== false) {
|
|
9716
|
-
return
|
|
9713
|
+
return zodSchema4;
|
|
9717
9714
|
}
|
|
9718
|
-
if (
|
|
9715
|
+
if (zodSchema4 instanceof z42.z.ZodObject || zodSchema4 instanceof z42.z.ZodRecord) {
|
|
9719
9716
|
const shape = {};
|
|
9720
9717
|
if (objectSchema.properties) {
|
|
9721
9718
|
for (const [key, propSchema] of Object.entries(objectSchema.properties)) {
|
|
@@ -9742,7 +9739,7 @@ var ObjectPropertiesHandler = class {
|
|
|
9742
9739
|
return z42.z.object(shape).passthrough();
|
|
9743
9740
|
}
|
|
9744
9741
|
}
|
|
9745
|
-
return
|
|
9742
|
+
return zodSchema4.refine(
|
|
9746
9743
|
(value) => {
|
|
9747
9744
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
9748
9745
|
return true;
|
|
@@ -9784,13 +9781,13 @@ var ObjectPropertiesHandler = class {
|
|
|
9784
9781
|
}
|
|
9785
9782
|
};
|
|
9786
9783
|
var EnumComplexHandler = class {
|
|
9787
|
-
apply(
|
|
9788
|
-
if (!schema.enum || schema.enum.length === 0) return
|
|
9784
|
+
apply(zodSchema4, schema) {
|
|
9785
|
+
if (!schema.enum || schema.enum.length === 0) return zodSchema4;
|
|
9789
9786
|
const complexValues = schema.enum.filter(
|
|
9790
9787
|
(v) => Array.isArray(v) || typeof v === "object" && v !== null
|
|
9791
9788
|
);
|
|
9792
|
-
if (complexValues.length === 0) return
|
|
9793
|
-
return
|
|
9789
|
+
if (complexValues.length === 0) return zodSchema4;
|
|
9790
|
+
return zodSchema4.refine(
|
|
9794
9791
|
(value) => {
|
|
9795
9792
|
if (typeof value !== "object" || value === null) return true;
|
|
9796
9793
|
return complexValues.some(
|
|
@@ -9802,32 +9799,32 @@ var EnumComplexHandler = class {
|
|
|
9802
9799
|
}
|
|
9803
9800
|
};
|
|
9804
9801
|
var ConstComplexHandler = class {
|
|
9805
|
-
apply(
|
|
9806
|
-
if (schema.const === void 0) return
|
|
9802
|
+
apply(zodSchema4, schema) {
|
|
9803
|
+
if (schema.const === void 0) return zodSchema4;
|
|
9807
9804
|
const constValue = schema.const;
|
|
9808
9805
|
if (typeof constValue !== "object" || constValue === null) {
|
|
9809
|
-
return
|
|
9806
|
+
return zodSchema4;
|
|
9810
9807
|
}
|
|
9811
|
-
return
|
|
9808
|
+
return zodSchema4.refine(
|
|
9812
9809
|
(value) => deepEqual(value, constValue),
|
|
9813
9810
|
{ message: "Value must equal the const value" }
|
|
9814
9811
|
);
|
|
9815
9812
|
}
|
|
9816
9813
|
};
|
|
9817
9814
|
var MetadataHandler = class {
|
|
9818
|
-
apply(
|
|
9815
|
+
apply(zodSchema4, schema) {
|
|
9819
9816
|
if (schema.description) {
|
|
9820
|
-
|
|
9817
|
+
zodSchema4 = zodSchema4.describe(schema.description);
|
|
9821
9818
|
}
|
|
9822
|
-
return
|
|
9819
|
+
return zodSchema4;
|
|
9823
9820
|
}
|
|
9824
9821
|
};
|
|
9825
9822
|
var ProtoRequiredHandler = class {
|
|
9826
|
-
apply(
|
|
9827
|
-
var
|
|
9823
|
+
apply(zodSchema4, schema) {
|
|
9824
|
+
var _a21;
|
|
9828
9825
|
const objectSchema = schema;
|
|
9829
|
-
if (!((
|
|
9830
|
-
return
|
|
9826
|
+
if (!((_a21 = objectSchema.required) == null ? void 0 : _a21.includes("__proto__")) || schema.type !== void 0) {
|
|
9827
|
+
return zodSchema4;
|
|
9831
9828
|
}
|
|
9832
9829
|
return z42.z.any().refine(
|
|
9833
9830
|
(value) => this.validateRequired(value, objectSchema.required),
|
|
@@ -9844,14 +9841,14 @@ var ProtoRequiredHandler = class {
|
|
|
9844
9841
|
}
|
|
9845
9842
|
};
|
|
9846
9843
|
var ContainsHandler = class {
|
|
9847
|
-
apply(
|
|
9848
|
-
var
|
|
9844
|
+
apply(zodSchema4, schema) {
|
|
9845
|
+
var _a21;
|
|
9849
9846
|
const arraySchema = schema;
|
|
9850
|
-
if (arraySchema.contains === void 0) return
|
|
9847
|
+
if (arraySchema.contains === void 0) return zodSchema4;
|
|
9851
9848
|
const containsSchema = convertJsonSchemaToZod(arraySchema.contains);
|
|
9852
|
-
const minContains = (
|
|
9849
|
+
const minContains = (_a21 = arraySchema.minContains) != null ? _a21 : 1;
|
|
9853
9850
|
const maxContains = arraySchema.maxContains;
|
|
9854
|
-
return
|
|
9851
|
+
return zodSchema4.refine(
|
|
9855
9852
|
(value) => {
|
|
9856
9853
|
if (!Array.isArray(value)) {
|
|
9857
9854
|
return true;
|
|
@@ -9960,32 +9957,32 @@ function convertJsonSchemaToZod(schema) {
|
|
|
9960
9957
|
allowedSchemas.push(objectSchema);
|
|
9961
9958
|
}
|
|
9962
9959
|
}
|
|
9963
|
-
let
|
|
9960
|
+
let zodSchema4;
|
|
9964
9961
|
if (allowedSchemas.length === 0) {
|
|
9965
|
-
|
|
9962
|
+
zodSchema4 = z42.z.never();
|
|
9966
9963
|
} else if (allowedSchemas.length === 1) {
|
|
9967
|
-
|
|
9964
|
+
zodSchema4 = allowedSchemas[0];
|
|
9968
9965
|
} else {
|
|
9969
9966
|
const hasConstraints = Object.keys(schema).some(
|
|
9970
9967
|
(key) => key !== "$schema" && key !== "title" && key !== "description"
|
|
9971
9968
|
);
|
|
9972
9969
|
if (!hasConstraints) {
|
|
9973
|
-
|
|
9970
|
+
zodSchema4 = z42.z.any();
|
|
9974
9971
|
} else {
|
|
9975
|
-
|
|
9972
|
+
zodSchema4 = z42.z.union(allowedSchemas);
|
|
9976
9973
|
}
|
|
9977
9974
|
}
|
|
9978
9975
|
for (const handler of refinementHandlers) {
|
|
9979
|
-
|
|
9976
|
+
zodSchema4 = handler.apply(zodSchema4, schema);
|
|
9980
9977
|
}
|
|
9981
|
-
return
|
|
9978
|
+
return zodSchema4;
|
|
9982
9979
|
}
|
|
9983
9980
|
function convertJsonSchemaToZod2(schema) {
|
|
9984
|
-
function addMetadata(
|
|
9985
|
-
if (
|
|
9986
|
-
|
|
9981
|
+
function addMetadata(zodSchema4, jsonSchema4) {
|
|
9982
|
+
if (jsonSchema4.description) {
|
|
9983
|
+
zodSchema4 = zodSchema4.describe(jsonSchema4.description);
|
|
9987
9984
|
}
|
|
9988
|
-
return
|
|
9985
|
+
return zodSchema4;
|
|
9989
9986
|
}
|
|
9990
9987
|
if (schema.const !== void 0) {
|
|
9991
9988
|
if (typeof schema.const === "string") {
|
|
@@ -10091,13 +10088,13 @@ function convertJsonSchemaToZod2(schema) {
|
|
|
10091
10088
|
shape[key] = shape[key].optional();
|
|
10092
10089
|
}
|
|
10093
10090
|
}
|
|
10094
|
-
let
|
|
10091
|
+
let zodSchema4;
|
|
10095
10092
|
if (schema.additionalProperties !== false) {
|
|
10096
|
-
|
|
10093
|
+
zodSchema4 = zod.z.object(shape).passthrough();
|
|
10097
10094
|
} else {
|
|
10098
|
-
|
|
10095
|
+
zodSchema4 = zod.z.object(shape);
|
|
10099
10096
|
}
|
|
10100
|
-
return addMetadata(
|
|
10097
|
+
return addMetadata(zodSchema4, schema);
|
|
10101
10098
|
}
|
|
10102
10099
|
return addMetadata(zod.z.object({}), schema);
|
|
10103
10100
|
case "array": {
|
|
@@ -10674,11 +10671,11 @@ ${workingMemory}`;
|
|
|
10674
10671
|
release();
|
|
10675
10672
|
}
|
|
10676
10673
|
}
|
|
10677
|
-
chunkText(
|
|
10674
|
+
chunkText(text4, tokenSize = 4096) {
|
|
10678
10675
|
const charSize = tokenSize * CHARS_PER_TOKEN;
|
|
10679
10676
|
const chunks = [];
|
|
10680
10677
|
let currentChunk = "";
|
|
10681
|
-
const words =
|
|
10678
|
+
const words = text4.split(/\s+/);
|
|
10682
10679
|
for (const word of words) {
|
|
10683
10680
|
const wordWithSpace = currentChunk ? " " + word : word;
|
|
10684
10681
|
if (currentChunk.length + wordWithSpace.length > charSize) {
|
|
@@ -10840,10 +10837,10 @@ ${workingMemory}`;
|
|
|
10840
10837
|
}
|
|
10841
10838
|
return newMessage;
|
|
10842
10839
|
}
|
|
10843
|
-
parseWorkingMemory(
|
|
10840
|
+
parseWorkingMemory(text4) {
|
|
10844
10841
|
if (!this.threadConfig.workingMemory?.enabled) return null;
|
|
10845
10842
|
const workingMemoryRegex = /<working_memory>([^]*?)<\/working_memory>/g;
|
|
10846
|
-
const matches =
|
|
10843
|
+
const matches = text4.match(workingMemoryRegex);
|
|
10847
10844
|
const match = matches?.[0];
|
|
10848
10845
|
if (match) {
|
|
10849
10846
|
return match.replace(/<\/?working_memory>/g, "").trim();
|
|
@@ -11143,12 +11140,12 @@ var _Tiktoken = class {
|
|
|
11143
11140
|
this.textMap.set(rank, bytes);
|
|
11144
11141
|
}
|
|
11145
11142
|
this.specialTokens = { ...ranks.special_tokens, ...extendedSpecialTokens };
|
|
11146
|
-
this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [
|
|
11147
|
-
memo[rank] = this.textEncoder.encode(
|
|
11143
|
+
this.inverseSpecialTokens = Object.entries(this.specialTokens).reduce((memo, [text4, rank]) => {
|
|
11144
|
+
memo[rank] = this.textEncoder.encode(text4);
|
|
11148
11145
|
return memo;
|
|
11149
11146
|
}, {});
|
|
11150
11147
|
}
|
|
11151
|
-
encode(
|
|
11148
|
+
encode(text4, allowedSpecial = [], disallowedSpecial = "all") {
|
|
11152
11149
|
const regexes = new RegExp(this.patStr, "ug");
|
|
11153
11150
|
const specialRegex = _Tiktoken.specialTokenRegex(
|
|
11154
11151
|
Object.keys(this.specialTokens)
|
|
@@ -11166,7 +11163,7 @@ var _Tiktoken = class {
|
|
|
11166
11163
|
const disallowedSpecialRegex = _Tiktoken.specialTokenRegex([
|
|
11167
11164
|
...disallowedSpecialSet
|
|
11168
11165
|
]);
|
|
11169
|
-
const specialMatch =
|
|
11166
|
+
const specialMatch = text4.match(disallowedSpecialRegex);
|
|
11170
11167
|
if (specialMatch != null) {
|
|
11171
11168
|
throw new Error(
|
|
11172
11169
|
`The text contains a special token that is not allowed: ${specialMatch[0]}`
|
|
@@ -11179,13 +11176,13 @@ var _Tiktoken = class {
|
|
|
11179
11176
|
let startFind = start;
|
|
11180
11177
|
while (true) {
|
|
11181
11178
|
specialRegex.lastIndex = startFind;
|
|
11182
|
-
nextSpecial = specialRegex.exec(
|
|
11179
|
+
nextSpecial = specialRegex.exec(text4);
|
|
11183
11180
|
if (nextSpecial == null || allowedSpecialSet.has(nextSpecial[0]))
|
|
11184
11181
|
break;
|
|
11185
11182
|
startFind = nextSpecial.index + 1;
|
|
11186
11183
|
}
|
|
11187
|
-
const end = nextSpecial?.index ??
|
|
11188
|
-
for (const match of
|
|
11184
|
+
const end = nextSpecial?.index ?? text4.length;
|
|
11185
|
+
for (const match of text4.substring(start, end).matchAll(regexes)) {
|
|
11189
11186
|
const piece = this.textEncoder.encode(match[0]);
|
|
11190
11187
|
const token2 = this.rankMap.get(piece.join(","));
|
|
11191
11188
|
if (token2 != null) {
|
|
@@ -11333,6 +11330,2008 @@ var TokenLimiter = class extends memory.MemoryProcessor {
|
|
|
11333
11330
|
|
|
11334
11331
|
// ../agent-builder/dist/index.js
|
|
11335
11332
|
var import_ignore = chunkO7I5CWRX_cjs.__toESM(require_ignore(), 1);
|
|
11333
|
+
var createIdGenerator3 = ({
|
|
11334
|
+
prefix,
|
|
11335
|
+
size = 16,
|
|
11336
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
11337
|
+
separator = "-"
|
|
11338
|
+
} = {}) => {
|
|
11339
|
+
const generator = () => {
|
|
11340
|
+
const alphabetLength = alphabet.length;
|
|
11341
|
+
const chars = new Array(size);
|
|
11342
|
+
for (let i = 0; i < size; i++) {
|
|
11343
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
11344
|
+
}
|
|
11345
|
+
return chars.join("");
|
|
11346
|
+
};
|
|
11347
|
+
if (prefix == null) {
|
|
11348
|
+
return generator;
|
|
11349
|
+
}
|
|
11350
|
+
if (alphabet.includes(separator)) {
|
|
11351
|
+
throw new InvalidArgumentError2({
|
|
11352
|
+
argument: "separator",
|
|
11353
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
11354
|
+
});
|
|
11355
|
+
}
|
|
11356
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
11357
|
+
};
|
|
11358
|
+
createIdGenerator3();
|
|
11359
|
+
var suspectProtoRx2 = /"__proto__"\s*:/;
|
|
11360
|
+
var suspectConstructorRx2 = /"constructor"\s*:/;
|
|
11361
|
+
function _parse2(text4) {
|
|
11362
|
+
const obj = JSON.parse(text4);
|
|
11363
|
+
if (obj === null || typeof obj !== "object") {
|
|
11364
|
+
return obj;
|
|
11365
|
+
}
|
|
11366
|
+
if (suspectProtoRx2.test(text4) === false && suspectConstructorRx2.test(text4) === false) {
|
|
11367
|
+
return obj;
|
|
11368
|
+
}
|
|
11369
|
+
return filter2(obj);
|
|
11370
|
+
}
|
|
11371
|
+
function filter2(obj) {
|
|
11372
|
+
let next = [obj];
|
|
11373
|
+
while (next.length) {
|
|
11374
|
+
const nodes = next;
|
|
11375
|
+
next = [];
|
|
11376
|
+
for (const node of nodes) {
|
|
11377
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
11378
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
11379
|
+
}
|
|
11380
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
11381
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
11382
|
+
}
|
|
11383
|
+
for (const key in node) {
|
|
11384
|
+
const value = node[key];
|
|
11385
|
+
if (value && typeof value === "object") {
|
|
11386
|
+
next.push(value);
|
|
11387
|
+
}
|
|
11388
|
+
}
|
|
11389
|
+
}
|
|
11390
|
+
}
|
|
11391
|
+
return obj;
|
|
11392
|
+
}
|
|
11393
|
+
function secureJsonParse2(text4) {
|
|
11394
|
+
const { stackTraceLimit } = Error;
|
|
11395
|
+
Error.stackTraceLimit = 0;
|
|
11396
|
+
try {
|
|
11397
|
+
return _parse2(text4);
|
|
11398
|
+
} finally {
|
|
11399
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
11400
|
+
}
|
|
11401
|
+
}
|
|
11402
|
+
var validatorSymbol3 = Symbol.for("vercel.ai.validator");
|
|
11403
|
+
function validator2(validate) {
|
|
11404
|
+
return { [validatorSymbol3]: true, validate };
|
|
11405
|
+
}
|
|
11406
|
+
function isValidator2(value) {
|
|
11407
|
+
return typeof value === "object" && value !== null && validatorSymbol3 in value && value[validatorSymbol3] === true && "validate" in value;
|
|
11408
|
+
}
|
|
11409
|
+
function asValidator2(value) {
|
|
11410
|
+
return isValidator2(value) ? value : typeof value === "function" ? value() : standardSchemaValidator2(value);
|
|
11411
|
+
}
|
|
11412
|
+
function standardSchemaValidator2(standardSchema) {
|
|
11413
|
+
return validator2(async (value) => {
|
|
11414
|
+
const result = await standardSchema["~standard"].validate(value);
|
|
11415
|
+
return result.issues == null ? { success: true, value: result.value } : {
|
|
11416
|
+
success: false,
|
|
11417
|
+
error: new TypeValidationError({
|
|
11418
|
+
value,
|
|
11419
|
+
cause: result.issues
|
|
11420
|
+
})
|
|
11421
|
+
};
|
|
11422
|
+
});
|
|
11423
|
+
}
|
|
11424
|
+
async function safeValidateTypes3({
|
|
11425
|
+
value,
|
|
11426
|
+
schema
|
|
11427
|
+
}) {
|
|
11428
|
+
const validator22 = asValidator2(schema);
|
|
11429
|
+
try {
|
|
11430
|
+
if (validator22.validate == null) {
|
|
11431
|
+
return { success: true, value, rawValue: value };
|
|
11432
|
+
}
|
|
11433
|
+
const result = await validator22.validate(value);
|
|
11434
|
+
if (result.success) {
|
|
11435
|
+
return { success: true, value: result.value, rawValue: value };
|
|
11436
|
+
}
|
|
11437
|
+
return {
|
|
11438
|
+
success: false,
|
|
11439
|
+
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
11440
|
+
rawValue: value
|
|
11441
|
+
};
|
|
11442
|
+
} catch (error) {
|
|
11443
|
+
return {
|
|
11444
|
+
success: false,
|
|
11445
|
+
error: TypeValidationError.wrap({ value, cause: error }),
|
|
11446
|
+
rawValue: value
|
|
11447
|
+
};
|
|
11448
|
+
}
|
|
11449
|
+
}
|
|
11450
|
+
async function safeParseJSON3({
|
|
11451
|
+
text: text4,
|
|
11452
|
+
schema
|
|
11453
|
+
}) {
|
|
11454
|
+
try {
|
|
11455
|
+
const value = secureJsonParse2(text4);
|
|
11456
|
+
if (schema == null) {
|
|
11457
|
+
return { success: true, value, rawValue: value };
|
|
11458
|
+
}
|
|
11459
|
+
return await safeValidateTypes3({ value, schema });
|
|
11460
|
+
} catch (error) {
|
|
11461
|
+
return {
|
|
11462
|
+
success: false,
|
|
11463
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text: text4, cause: error }),
|
|
11464
|
+
rawValue: void 0
|
|
11465
|
+
};
|
|
11466
|
+
}
|
|
11467
|
+
}
|
|
11468
|
+
var getRelativePath3 = (pathA, pathB) => {
|
|
11469
|
+
let i = 0;
|
|
11470
|
+
for (; i < pathA.length && i < pathB.length; i++) {
|
|
11471
|
+
if (pathA[i] !== pathB[i]) break;
|
|
11472
|
+
}
|
|
11473
|
+
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
11474
|
+
};
|
|
11475
|
+
var ignoreOverride3 = Symbol(
|
|
11476
|
+
"Let zodToJsonSchema decide on which parser to use"
|
|
11477
|
+
);
|
|
11478
|
+
var defaultOptions3 = {
|
|
11479
|
+
name: void 0,
|
|
11480
|
+
$refStrategy: "root",
|
|
11481
|
+
basePath: ["#"],
|
|
11482
|
+
effectStrategy: "input",
|
|
11483
|
+
pipeStrategy: "all",
|
|
11484
|
+
dateStrategy: "format:date-time",
|
|
11485
|
+
mapStrategy: "entries",
|
|
11486
|
+
removeAdditionalStrategy: "passthrough",
|
|
11487
|
+
allowedAdditionalProperties: true,
|
|
11488
|
+
rejectedAdditionalProperties: false,
|
|
11489
|
+
definitionPath: "definitions",
|
|
11490
|
+
strictUnions: false,
|
|
11491
|
+
definitions: {},
|
|
11492
|
+
errorMessages: false,
|
|
11493
|
+
patternStrategy: "escape",
|
|
11494
|
+
applyRegexFlags: false,
|
|
11495
|
+
emailStrategy: "format:email",
|
|
11496
|
+
base64Strategy: "contentEncoding:base64",
|
|
11497
|
+
nameStrategy: "ref"
|
|
11498
|
+
};
|
|
11499
|
+
var getDefaultOptions3 = (options) => typeof options === "string" ? {
|
|
11500
|
+
...defaultOptions3,
|
|
11501
|
+
name: options
|
|
11502
|
+
} : {
|
|
11503
|
+
...defaultOptions3,
|
|
11504
|
+
...options
|
|
11505
|
+
};
|
|
11506
|
+
function parseAnyDef3() {
|
|
11507
|
+
return {};
|
|
11508
|
+
}
|
|
11509
|
+
function parseArrayDef3(def, refs) {
|
|
11510
|
+
var _a21, _b8, _c;
|
|
11511
|
+
const res = {
|
|
11512
|
+
type: "array"
|
|
11513
|
+
};
|
|
11514
|
+
if (((_a21 = def.type) == null ? void 0 : _a21._def) && ((_c = (_b8 = def.type) == null ? void 0 : _b8._def) == null ? void 0 : _c.typeName) !== v3.ZodFirstPartyTypeKind.ZodAny) {
|
|
11515
|
+
res.items = parseDef3(def.type._def, {
|
|
11516
|
+
...refs,
|
|
11517
|
+
currentPath: [...refs.currentPath, "items"]
|
|
11518
|
+
});
|
|
11519
|
+
}
|
|
11520
|
+
if (def.minLength) {
|
|
11521
|
+
res.minItems = def.minLength.value;
|
|
11522
|
+
}
|
|
11523
|
+
if (def.maxLength) {
|
|
11524
|
+
res.maxItems = def.maxLength.value;
|
|
11525
|
+
}
|
|
11526
|
+
if (def.exactLength) {
|
|
11527
|
+
res.minItems = def.exactLength.value;
|
|
11528
|
+
res.maxItems = def.exactLength.value;
|
|
11529
|
+
}
|
|
11530
|
+
return res;
|
|
11531
|
+
}
|
|
11532
|
+
function parseBigintDef3(def) {
|
|
11533
|
+
const res = {
|
|
11534
|
+
type: "integer",
|
|
11535
|
+
format: "int64"
|
|
11536
|
+
};
|
|
11537
|
+
if (!def.checks) return res;
|
|
11538
|
+
for (const check of def.checks) {
|
|
11539
|
+
switch (check.kind) {
|
|
11540
|
+
case "min":
|
|
11541
|
+
if (check.inclusive) {
|
|
11542
|
+
res.minimum = check.value;
|
|
11543
|
+
} else {
|
|
11544
|
+
res.exclusiveMinimum = check.value;
|
|
11545
|
+
}
|
|
11546
|
+
break;
|
|
11547
|
+
case "max":
|
|
11548
|
+
if (check.inclusive) {
|
|
11549
|
+
res.maximum = check.value;
|
|
11550
|
+
} else {
|
|
11551
|
+
res.exclusiveMaximum = check.value;
|
|
11552
|
+
}
|
|
11553
|
+
break;
|
|
11554
|
+
case "multipleOf":
|
|
11555
|
+
res.multipleOf = check.value;
|
|
11556
|
+
break;
|
|
11557
|
+
}
|
|
11558
|
+
}
|
|
11559
|
+
return res;
|
|
11560
|
+
}
|
|
11561
|
+
function parseBooleanDef3() {
|
|
11562
|
+
return { type: "boolean" };
|
|
11563
|
+
}
|
|
11564
|
+
function parseBrandedDef3(_def, refs) {
|
|
11565
|
+
return parseDef3(_def.type._def, refs);
|
|
11566
|
+
}
|
|
11567
|
+
var parseCatchDef3 = (def, refs) => {
|
|
11568
|
+
return parseDef3(def.innerType._def, refs);
|
|
11569
|
+
};
|
|
11570
|
+
function parseDateDef3(def, refs, overrideDateStrategy) {
|
|
11571
|
+
const strategy = overrideDateStrategy != null ? overrideDateStrategy : refs.dateStrategy;
|
|
11572
|
+
if (Array.isArray(strategy)) {
|
|
11573
|
+
return {
|
|
11574
|
+
anyOf: strategy.map((item, i) => parseDateDef3(def, refs, item))
|
|
11575
|
+
};
|
|
11576
|
+
}
|
|
11577
|
+
switch (strategy) {
|
|
11578
|
+
case "string":
|
|
11579
|
+
case "format:date-time":
|
|
11580
|
+
return {
|
|
11581
|
+
type: "string",
|
|
11582
|
+
format: "date-time"
|
|
11583
|
+
};
|
|
11584
|
+
case "format:date":
|
|
11585
|
+
return {
|
|
11586
|
+
type: "string",
|
|
11587
|
+
format: "date"
|
|
11588
|
+
};
|
|
11589
|
+
case "integer":
|
|
11590
|
+
return integerDateParser3(def);
|
|
11591
|
+
}
|
|
11592
|
+
}
|
|
11593
|
+
var integerDateParser3 = (def) => {
|
|
11594
|
+
const res = {
|
|
11595
|
+
type: "integer",
|
|
11596
|
+
format: "unix-time"
|
|
11597
|
+
};
|
|
11598
|
+
for (const check of def.checks) {
|
|
11599
|
+
switch (check.kind) {
|
|
11600
|
+
case "min":
|
|
11601
|
+
res.minimum = check.value;
|
|
11602
|
+
break;
|
|
11603
|
+
case "max":
|
|
11604
|
+
res.maximum = check.value;
|
|
11605
|
+
break;
|
|
11606
|
+
}
|
|
11607
|
+
}
|
|
11608
|
+
return res;
|
|
11609
|
+
};
|
|
11610
|
+
function parseDefaultDef3(_def, refs) {
|
|
11611
|
+
return {
|
|
11612
|
+
...parseDef3(_def.innerType._def, refs),
|
|
11613
|
+
default: _def.defaultValue()
|
|
11614
|
+
};
|
|
11615
|
+
}
|
|
11616
|
+
function parseEffectsDef3(_def, refs) {
|
|
11617
|
+
return refs.effectStrategy === "input" ? parseDef3(_def.schema._def, refs) : parseAnyDef3();
|
|
11618
|
+
}
|
|
11619
|
+
function parseEnumDef3(def) {
|
|
11620
|
+
return {
|
|
11621
|
+
type: "string",
|
|
11622
|
+
enum: Array.from(def.values)
|
|
11623
|
+
};
|
|
11624
|
+
}
|
|
11625
|
+
var isJsonSchema7AllOfType3 = (type) => {
|
|
11626
|
+
if ("type" in type && type.type === "string") return false;
|
|
11627
|
+
return "allOf" in type;
|
|
11628
|
+
};
|
|
11629
|
+
function parseIntersectionDef3(def, refs) {
|
|
11630
|
+
const allOf = [
|
|
11631
|
+
parseDef3(def.left._def, {
|
|
11632
|
+
...refs,
|
|
11633
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
11634
|
+
}),
|
|
11635
|
+
parseDef3(def.right._def, {
|
|
11636
|
+
...refs,
|
|
11637
|
+
currentPath: [...refs.currentPath, "allOf", "1"]
|
|
11638
|
+
})
|
|
11639
|
+
].filter((x) => !!x);
|
|
11640
|
+
const mergedAllOf = [];
|
|
11641
|
+
allOf.forEach((schema) => {
|
|
11642
|
+
if (isJsonSchema7AllOfType3(schema)) {
|
|
11643
|
+
mergedAllOf.push(...schema.allOf);
|
|
11644
|
+
} else {
|
|
11645
|
+
let nestedSchema = schema;
|
|
11646
|
+
if ("additionalProperties" in schema && schema.additionalProperties === false) {
|
|
11647
|
+
const { additionalProperties, ...rest } = schema;
|
|
11648
|
+
nestedSchema = rest;
|
|
11649
|
+
}
|
|
11650
|
+
mergedAllOf.push(nestedSchema);
|
|
11651
|
+
}
|
|
11652
|
+
});
|
|
11653
|
+
return mergedAllOf.length ? { allOf: mergedAllOf } : void 0;
|
|
11654
|
+
}
|
|
11655
|
+
function parseLiteralDef3(def) {
|
|
11656
|
+
const parsedType = typeof def.value;
|
|
11657
|
+
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
11658
|
+
return {
|
|
11659
|
+
type: Array.isArray(def.value) ? "array" : "object"
|
|
11660
|
+
};
|
|
11661
|
+
}
|
|
11662
|
+
return {
|
|
11663
|
+
type: parsedType === "bigint" ? "integer" : parsedType,
|
|
11664
|
+
const: def.value
|
|
11665
|
+
};
|
|
11666
|
+
}
|
|
11667
|
+
var emojiRegex3 = void 0;
|
|
11668
|
+
var zodPatterns3 = {
|
|
11669
|
+
/**
|
|
11670
|
+
* `c` was changed to `[cC]` to replicate /i flag
|
|
11671
|
+
*/
|
|
11672
|
+
cuid: /^[cC][^\s-]{8,}$/,
|
|
11673
|
+
cuid2: /^[0-9a-z]+$/,
|
|
11674
|
+
ulid: /^[0-9A-HJKMNP-TV-Z]{26}$/,
|
|
11675
|
+
/**
|
|
11676
|
+
* `a-z` was added to replicate /i flag
|
|
11677
|
+
*/
|
|
11678
|
+
email: /^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,
|
|
11679
|
+
/**
|
|
11680
|
+
* Constructed a valid Unicode RegExp
|
|
11681
|
+
*
|
|
11682
|
+
* Lazily instantiate since this type of regex isn't supported
|
|
11683
|
+
* in all envs (e.g. React Native).
|
|
11684
|
+
*
|
|
11685
|
+
* See:
|
|
11686
|
+
* https://github.com/colinhacks/zod/issues/2433
|
|
11687
|
+
* Fix in Zod:
|
|
11688
|
+
* https://github.com/colinhacks/zod/commit/9340fd51e48576a75adc919bff65dbc4a5d4c99b
|
|
11689
|
+
*/
|
|
11690
|
+
emoji: () => {
|
|
11691
|
+
if (emojiRegex3 === void 0) {
|
|
11692
|
+
emojiRegex3 = RegExp(
|
|
11693
|
+
"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",
|
|
11694
|
+
"u"
|
|
11695
|
+
);
|
|
11696
|
+
}
|
|
11697
|
+
return emojiRegex3;
|
|
11698
|
+
},
|
|
11699
|
+
/**
|
|
11700
|
+
* Unused
|
|
11701
|
+
*/
|
|
11702
|
+
uuid: /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/,
|
|
11703
|
+
/**
|
|
11704
|
+
* Unused
|
|
11705
|
+
*/
|
|
11706
|
+
ipv4: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,
|
|
11707
|
+
ipv4Cidr: /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,
|
|
11708
|
+
/**
|
|
11709
|
+
* Unused
|
|
11710
|
+
*/
|
|
11711
|
+
ipv6: /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,
|
|
11712
|
+
ipv6Cidr: /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,
|
|
11713
|
+
base64: /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,
|
|
11714
|
+
base64url: /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,
|
|
11715
|
+
nanoid: /^[a-zA-Z0-9_-]{21}$/,
|
|
11716
|
+
jwt: /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/
|
|
11717
|
+
};
|
|
11718
|
+
function parseStringDef3(def, refs) {
|
|
11719
|
+
const res = {
|
|
11720
|
+
type: "string"
|
|
11721
|
+
};
|
|
11722
|
+
if (def.checks) {
|
|
11723
|
+
for (const check of def.checks) {
|
|
11724
|
+
switch (check.kind) {
|
|
11725
|
+
case "min":
|
|
11726
|
+
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
11727
|
+
break;
|
|
11728
|
+
case "max":
|
|
11729
|
+
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
11730
|
+
break;
|
|
11731
|
+
case "email":
|
|
11732
|
+
switch (refs.emailStrategy) {
|
|
11733
|
+
case "format:email":
|
|
11734
|
+
addFormat3(res, "email", check.message, refs);
|
|
11735
|
+
break;
|
|
11736
|
+
case "format:idn-email":
|
|
11737
|
+
addFormat3(res, "idn-email", check.message, refs);
|
|
11738
|
+
break;
|
|
11739
|
+
case "pattern:zod":
|
|
11740
|
+
addPattern3(res, zodPatterns3.email, check.message, refs);
|
|
11741
|
+
break;
|
|
11742
|
+
}
|
|
11743
|
+
break;
|
|
11744
|
+
case "url":
|
|
11745
|
+
addFormat3(res, "uri", check.message, refs);
|
|
11746
|
+
break;
|
|
11747
|
+
case "uuid":
|
|
11748
|
+
addFormat3(res, "uuid", check.message, refs);
|
|
11749
|
+
break;
|
|
11750
|
+
case "regex":
|
|
11751
|
+
addPattern3(res, check.regex, check.message, refs);
|
|
11752
|
+
break;
|
|
11753
|
+
case "cuid":
|
|
11754
|
+
addPattern3(res, zodPatterns3.cuid, check.message, refs);
|
|
11755
|
+
break;
|
|
11756
|
+
case "cuid2":
|
|
11757
|
+
addPattern3(res, zodPatterns3.cuid2, check.message, refs);
|
|
11758
|
+
break;
|
|
11759
|
+
case "startsWith":
|
|
11760
|
+
addPattern3(
|
|
11761
|
+
res,
|
|
11762
|
+
RegExp(`^${escapeLiteralCheckValue3(check.value, refs)}`),
|
|
11763
|
+
check.message,
|
|
11764
|
+
refs
|
|
11765
|
+
);
|
|
11766
|
+
break;
|
|
11767
|
+
case "endsWith":
|
|
11768
|
+
addPattern3(
|
|
11769
|
+
res,
|
|
11770
|
+
RegExp(`${escapeLiteralCheckValue3(check.value, refs)}$`),
|
|
11771
|
+
check.message,
|
|
11772
|
+
refs
|
|
11773
|
+
);
|
|
11774
|
+
break;
|
|
11775
|
+
case "datetime":
|
|
11776
|
+
addFormat3(res, "date-time", check.message, refs);
|
|
11777
|
+
break;
|
|
11778
|
+
case "date":
|
|
11779
|
+
addFormat3(res, "date", check.message, refs);
|
|
11780
|
+
break;
|
|
11781
|
+
case "time":
|
|
11782
|
+
addFormat3(res, "time", check.message, refs);
|
|
11783
|
+
break;
|
|
11784
|
+
case "duration":
|
|
11785
|
+
addFormat3(res, "duration", check.message, refs);
|
|
11786
|
+
break;
|
|
11787
|
+
case "length":
|
|
11788
|
+
res.minLength = typeof res.minLength === "number" ? Math.max(res.minLength, check.value) : check.value;
|
|
11789
|
+
res.maxLength = typeof res.maxLength === "number" ? Math.min(res.maxLength, check.value) : check.value;
|
|
11790
|
+
break;
|
|
11791
|
+
case "includes": {
|
|
11792
|
+
addPattern3(
|
|
11793
|
+
res,
|
|
11794
|
+
RegExp(escapeLiteralCheckValue3(check.value, refs)),
|
|
11795
|
+
check.message,
|
|
11796
|
+
refs
|
|
11797
|
+
);
|
|
11798
|
+
break;
|
|
11799
|
+
}
|
|
11800
|
+
case "ip": {
|
|
11801
|
+
if (check.version !== "v6") {
|
|
11802
|
+
addFormat3(res, "ipv4", check.message, refs);
|
|
11803
|
+
}
|
|
11804
|
+
if (check.version !== "v4") {
|
|
11805
|
+
addFormat3(res, "ipv6", check.message, refs);
|
|
11806
|
+
}
|
|
11807
|
+
break;
|
|
11808
|
+
}
|
|
11809
|
+
case "base64url":
|
|
11810
|
+
addPattern3(res, zodPatterns3.base64url, check.message, refs);
|
|
11811
|
+
break;
|
|
11812
|
+
case "jwt":
|
|
11813
|
+
addPattern3(res, zodPatterns3.jwt, check.message, refs);
|
|
11814
|
+
break;
|
|
11815
|
+
case "cidr": {
|
|
11816
|
+
if (check.version !== "v6") {
|
|
11817
|
+
addPattern3(res, zodPatterns3.ipv4Cidr, check.message, refs);
|
|
11818
|
+
}
|
|
11819
|
+
if (check.version !== "v4") {
|
|
11820
|
+
addPattern3(res, zodPatterns3.ipv6Cidr, check.message, refs);
|
|
11821
|
+
}
|
|
11822
|
+
break;
|
|
11823
|
+
}
|
|
11824
|
+
case "emoji":
|
|
11825
|
+
addPattern3(res, zodPatterns3.emoji(), check.message, refs);
|
|
11826
|
+
break;
|
|
11827
|
+
case "ulid": {
|
|
11828
|
+
addPattern3(res, zodPatterns3.ulid, check.message, refs);
|
|
11829
|
+
break;
|
|
11830
|
+
}
|
|
11831
|
+
case "base64": {
|
|
11832
|
+
switch (refs.base64Strategy) {
|
|
11833
|
+
case "format:binary": {
|
|
11834
|
+
addFormat3(res, "binary", check.message, refs);
|
|
11835
|
+
break;
|
|
11836
|
+
}
|
|
11837
|
+
case "contentEncoding:base64": {
|
|
11838
|
+
res.contentEncoding = "base64";
|
|
11839
|
+
break;
|
|
11840
|
+
}
|
|
11841
|
+
case "pattern:zod": {
|
|
11842
|
+
addPattern3(res, zodPatterns3.base64, check.message, refs);
|
|
11843
|
+
break;
|
|
11844
|
+
}
|
|
11845
|
+
}
|
|
11846
|
+
break;
|
|
11847
|
+
}
|
|
11848
|
+
case "nanoid": {
|
|
11849
|
+
addPattern3(res, zodPatterns3.nanoid, check.message, refs);
|
|
11850
|
+
}
|
|
11851
|
+
}
|
|
11852
|
+
}
|
|
11853
|
+
}
|
|
11854
|
+
return res;
|
|
11855
|
+
}
|
|
11856
|
+
function escapeLiteralCheckValue3(literal, refs) {
|
|
11857
|
+
return refs.patternStrategy === "escape" ? escapeNonAlphaNumeric3(literal) : literal;
|
|
11858
|
+
}
|
|
11859
|
+
var ALPHA_NUMERIC3 = new Set(
|
|
11860
|
+
"ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789"
|
|
11861
|
+
);
|
|
11862
|
+
function escapeNonAlphaNumeric3(source) {
|
|
11863
|
+
let result = "";
|
|
11864
|
+
for (let i = 0; i < source.length; i++) {
|
|
11865
|
+
if (!ALPHA_NUMERIC3.has(source[i])) {
|
|
11866
|
+
result += "\\";
|
|
11867
|
+
}
|
|
11868
|
+
result += source[i];
|
|
11869
|
+
}
|
|
11870
|
+
return result;
|
|
11871
|
+
}
|
|
11872
|
+
function addFormat3(schema, value, message, refs) {
|
|
11873
|
+
var _a21;
|
|
11874
|
+
if (schema.format || ((_a21 = schema.anyOf) == null ? void 0 : _a21.some((x) => x.format))) {
|
|
11875
|
+
if (!schema.anyOf) {
|
|
11876
|
+
schema.anyOf = [];
|
|
11877
|
+
}
|
|
11878
|
+
if (schema.format) {
|
|
11879
|
+
schema.anyOf.push({
|
|
11880
|
+
format: schema.format
|
|
11881
|
+
});
|
|
11882
|
+
delete schema.format;
|
|
11883
|
+
}
|
|
11884
|
+
schema.anyOf.push({
|
|
11885
|
+
format: value,
|
|
11886
|
+
...message && refs.errorMessages && { errorMessage: { format: message } }
|
|
11887
|
+
});
|
|
11888
|
+
} else {
|
|
11889
|
+
schema.format = value;
|
|
11890
|
+
}
|
|
11891
|
+
}
|
|
11892
|
+
function addPattern3(schema, regex, message, refs) {
|
|
11893
|
+
var _a21;
|
|
11894
|
+
if (schema.pattern || ((_a21 = schema.allOf) == null ? void 0 : _a21.some((x) => x.pattern))) {
|
|
11895
|
+
if (!schema.allOf) {
|
|
11896
|
+
schema.allOf = [];
|
|
11897
|
+
}
|
|
11898
|
+
if (schema.pattern) {
|
|
11899
|
+
schema.allOf.push({
|
|
11900
|
+
pattern: schema.pattern
|
|
11901
|
+
});
|
|
11902
|
+
delete schema.pattern;
|
|
11903
|
+
}
|
|
11904
|
+
schema.allOf.push({
|
|
11905
|
+
pattern: stringifyRegExpWithFlags3(regex, refs),
|
|
11906
|
+
...message && refs.errorMessages && { errorMessage: { pattern: message } }
|
|
11907
|
+
});
|
|
11908
|
+
} else {
|
|
11909
|
+
schema.pattern = stringifyRegExpWithFlags3(regex, refs);
|
|
11910
|
+
}
|
|
11911
|
+
}
|
|
11912
|
+
function stringifyRegExpWithFlags3(regex, refs) {
|
|
11913
|
+
var _a21;
|
|
11914
|
+
if (!refs.applyRegexFlags || !regex.flags) {
|
|
11915
|
+
return regex.source;
|
|
11916
|
+
}
|
|
11917
|
+
const flags = {
|
|
11918
|
+
i: regex.flags.includes("i"),
|
|
11919
|
+
// Case-insensitive
|
|
11920
|
+
m: regex.flags.includes("m"),
|
|
11921
|
+
// `^` and `$` matches adjacent to newline characters
|
|
11922
|
+
s: regex.flags.includes("s")
|
|
11923
|
+
// `.` matches newlines
|
|
11924
|
+
};
|
|
11925
|
+
const source = flags.i ? regex.source.toLowerCase() : regex.source;
|
|
11926
|
+
let pattern = "";
|
|
11927
|
+
let isEscaped = false;
|
|
11928
|
+
let inCharGroup = false;
|
|
11929
|
+
let inCharRange = false;
|
|
11930
|
+
for (let i = 0; i < source.length; i++) {
|
|
11931
|
+
if (isEscaped) {
|
|
11932
|
+
pattern += source[i];
|
|
11933
|
+
isEscaped = false;
|
|
11934
|
+
continue;
|
|
11935
|
+
}
|
|
11936
|
+
if (flags.i) {
|
|
11937
|
+
if (inCharGroup) {
|
|
11938
|
+
if (source[i].match(/[a-z]/)) {
|
|
11939
|
+
if (inCharRange) {
|
|
11940
|
+
pattern += source[i];
|
|
11941
|
+
pattern += `${source[i - 2]}-${source[i]}`.toUpperCase();
|
|
11942
|
+
inCharRange = false;
|
|
11943
|
+
} else if (source[i + 1] === "-" && ((_a21 = source[i + 2]) == null ? void 0 : _a21.match(/[a-z]/))) {
|
|
11944
|
+
pattern += source[i];
|
|
11945
|
+
inCharRange = true;
|
|
11946
|
+
} else {
|
|
11947
|
+
pattern += `${source[i]}${source[i].toUpperCase()}`;
|
|
11948
|
+
}
|
|
11949
|
+
continue;
|
|
11950
|
+
}
|
|
11951
|
+
} else if (source[i].match(/[a-z]/)) {
|
|
11952
|
+
pattern += `[${source[i]}${source[i].toUpperCase()}]`;
|
|
11953
|
+
continue;
|
|
11954
|
+
}
|
|
11955
|
+
}
|
|
11956
|
+
if (flags.m) {
|
|
11957
|
+
if (source[i] === "^") {
|
|
11958
|
+
pattern += `(^|(?<=[\r
|
|
11959
|
+
]))`;
|
|
11960
|
+
continue;
|
|
11961
|
+
} else if (source[i] === "$") {
|
|
11962
|
+
pattern += `($|(?=[\r
|
|
11963
|
+
]))`;
|
|
11964
|
+
continue;
|
|
11965
|
+
}
|
|
11966
|
+
}
|
|
11967
|
+
if (flags.s && source[i] === ".") {
|
|
11968
|
+
pattern += inCharGroup ? `${source[i]}\r
|
|
11969
|
+
` : `[${source[i]}\r
|
|
11970
|
+
]`;
|
|
11971
|
+
continue;
|
|
11972
|
+
}
|
|
11973
|
+
pattern += source[i];
|
|
11974
|
+
if (source[i] === "\\") {
|
|
11975
|
+
isEscaped = true;
|
|
11976
|
+
} else if (inCharGroup && source[i] === "]") {
|
|
11977
|
+
inCharGroup = false;
|
|
11978
|
+
} else if (!inCharGroup && source[i] === "[") {
|
|
11979
|
+
inCharGroup = true;
|
|
11980
|
+
}
|
|
11981
|
+
}
|
|
11982
|
+
return pattern;
|
|
11983
|
+
}
|
|
11984
|
+
function parseRecordDef3(def, refs) {
|
|
11985
|
+
var _a21, _b8, _c, _d, _e, _f;
|
|
11986
|
+
const schema = {
|
|
11987
|
+
type: "object",
|
|
11988
|
+
additionalProperties: (_a21 = parseDef3(def.valueType._def, {
|
|
11989
|
+
...refs,
|
|
11990
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
11991
|
+
})) != null ? _a21 : refs.allowedAdditionalProperties
|
|
11992
|
+
};
|
|
11993
|
+
if (((_b8 = def.keyType) == null ? void 0 : _b8._def.typeName) === v3.ZodFirstPartyTypeKind.ZodString && ((_c = def.keyType._def.checks) == null ? void 0 : _c.length)) {
|
|
11994
|
+
const { type, ...keyType } = parseStringDef3(def.keyType._def, refs);
|
|
11995
|
+
return {
|
|
11996
|
+
...schema,
|
|
11997
|
+
propertyNames: keyType
|
|
11998
|
+
};
|
|
11999
|
+
} else if (((_d = def.keyType) == null ? void 0 : _d._def.typeName) === v3.ZodFirstPartyTypeKind.ZodEnum) {
|
|
12000
|
+
return {
|
|
12001
|
+
...schema,
|
|
12002
|
+
propertyNames: {
|
|
12003
|
+
enum: def.keyType._def.values
|
|
12004
|
+
}
|
|
12005
|
+
};
|
|
12006
|
+
} else if (((_e = def.keyType) == null ? void 0 : _e._def.typeName) === v3.ZodFirstPartyTypeKind.ZodBranded && def.keyType._def.type._def.typeName === v3.ZodFirstPartyTypeKind.ZodString && ((_f = def.keyType._def.type._def.checks) == null ? void 0 : _f.length)) {
|
|
12007
|
+
const { type, ...keyType } = parseBrandedDef3(
|
|
12008
|
+
def.keyType._def,
|
|
12009
|
+
refs
|
|
12010
|
+
);
|
|
12011
|
+
return {
|
|
12012
|
+
...schema,
|
|
12013
|
+
propertyNames: keyType
|
|
12014
|
+
};
|
|
12015
|
+
}
|
|
12016
|
+
return schema;
|
|
12017
|
+
}
|
|
12018
|
+
function parseMapDef3(def, refs) {
|
|
12019
|
+
if (refs.mapStrategy === "record") {
|
|
12020
|
+
return parseRecordDef3(def, refs);
|
|
12021
|
+
}
|
|
12022
|
+
const keys = parseDef3(def.keyType._def, {
|
|
12023
|
+
...refs,
|
|
12024
|
+
currentPath: [...refs.currentPath, "items", "items", "0"]
|
|
12025
|
+
}) || parseAnyDef3();
|
|
12026
|
+
const values = parseDef3(def.valueType._def, {
|
|
12027
|
+
...refs,
|
|
12028
|
+
currentPath: [...refs.currentPath, "items", "items", "1"]
|
|
12029
|
+
}) || parseAnyDef3();
|
|
12030
|
+
return {
|
|
12031
|
+
type: "array",
|
|
12032
|
+
maxItems: 125,
|
|
12033
|
+
items: {
|
|
12034
|
+
type: "array",
|
|
12035
|
+
items: [keys, values],
|
|
12036
|
+
minItems: 2,
|
|
12037
|
+
maxItems: 2
|
|
12038
|
+
}
|
|
12039
|
+
};
|
|
12040
|
+
}
|
|
12041
|
+
function parseNativeEnumDef3(def) {
|
|
12042
|
+
const object4 = def.values;
|
|
12043
|
+
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
12044
|
+
return typeof object4[object4[key]] !== "number";
|
|
12045
|
+
});
|
|
12046
|
+
const actualValues = actualKeys.map((key) => object4[key]);
|
|
12047
|
+
const parsedTypes = Array.from(
|
|
12048
|
+
new Set(actualValues.map((values) => typeof values))
|
|
12049
|
+
);
|
|
12050
|
+
return {
|
|
12051
|
+
type: parsedTypes.length === 1 ? parsedTypes[0] === "string" ? "string" : "number" : ["string", "number"],
|
|
12052
|
+
enum: actualValues
|
|
12053
|
+
};
|
|
12054
|
+
}
|
|
12055
|
+
function parseNeverDef3() {
|
|
12056
|
+
return { not: parseAnyDef3() };
|
|
12057
|
+
}
|
|
12058
|
+
function parseNullDef3() {
|
|
12059
|
+
return {
|
|
12060
|
+
type: "null"
|
|
12061
|
+
};
|
|
12062
|
+
}
|
|
12063
|
+
var primitiveMappings3 = {
|
|
12064
|
+
ZodString: "string",
|
|
12065
|
+
ZodNumber: "number",
|
|
12066
|
+
ZodBigInt: "integer",
|
|
12067
|
+
ZodBoolean: "boolean",
|
|
12068
|
+
ZodNull: "null"
|
|
12069
|
+
};
|
|
12070
|
+
function parseUnionDef3(def, refs) {
|
|
12071
|
+
const options = def.options instanceof Map ? Array.from(def.options.values()) : def.options;
|
|
12072
|
+
if (options.every(
|
|
12073
|
+
(x) => x._def.typeName in primitiveMappings3 && (!x._def.checks || !x._def.checks.length)
|
|
12074
|
+
)) {
|
|
12075
|
+
const types = options.reduce((types2, x) => {
|
|
12076
|
+
const type = primitiveMappings3[x._def.typeName];
|
|
12077
|
+
return type && !types2.includes(type) ? [...types2, type] : types2;
|
|
12078
|
+
}, []);
|
|
12079
|
+
return {
|
|
12080
|
+
type: types.length > 1 ? types : types[0]
|
|
12081
|
+
};
|
|
12082
|
+
} else if (options.every((x) => x._def.typeName === "ZodLiteral" && !x.description)) {
|
|
12083
|
+
const types = options.reduce(
|
|
12084
|
+
(acc, x) => {
|
|
12085
|
+
const type = typeof x._def.value;
|
|
12086
|
+
switch (type) {
|
|
12087
|
+
case "string":
|
|
12088
|
+
case "number":
|
|
12089
|
+
case "boolean":
|
|
12090
|
+
return [...acc, type];
|
|
12091
|
+
case "bigint":
|
|
12092
|
+
return [...acc, "integer"];
|
|
12093
|
+
case "object":
|
|
12094
|
+
if (x._def.value === null) return [...acc, "null"];
|
|
12095
|
+
case "symbol":
|
|
12096
|
+
case "undefined":
|
|
12097
|
+
case "function":
|
|
12098
|
+
default:
|
|
12099
|
+
return acc;
|
|
12100
|
+
}
|
|
12101
|
+
},
|
|
12102
|
+
[]
|
|
12103
|
+
);
|
|
12104
|
+
if (types.length === options.length) {
|
|
12105
|
+
const uniqueTypes = types.filter((x, i, a) => a.indexOf(x) === i);
|
|
12106
|
+
return {
|
|
12107
|
+
type: uniqueTypes.length > 1 ? uniqueTypes : uniqueTypes[0],
|
|
12108
|
+
enum: options.reduce(
|
|
12109
|
+
(acc, x) => {
|
|
12110
|
+
return acc.includes(x._def.value) ? acc : [...acc, x._def.value];
|
|
12111
|
+
},
|
|
12112
|
+
[]
|
|
12113
|
+
)
|
|
12114
|
+
};
|
|
12115
|
+
}
|
|
12116
|
+
} else if (options.every((x) => x._def.typeName === "ZodEnum")) {
|
|
12117
|
+
return {
|
|
12118
|
+
type: "string",
|
|
12119
|
+
enum: options.reduce(
|
|
12120
|
+
(acc, x) => [
|
|
12121
|
+
...acc,
|
|
12122
|
+
...x._def.values.filter((x2) => !acc.includes(x2))
|
|
12123
|
+
],
|
|
12124
|
+
[]
|
|
12125
|
+
)
|
|
12126
|
+
};
|
|
12127
|
+
}
|
|
12128
|
+
return asAnyOf3(def, refs);
|
|
12129
|
+
}
|
|
12130
|
+
var asAnyOf3 = (def, refs) => {
|
|
12131
|
+
const anyOf = (def.options instanceof Map ? Array.from(def.options.values()) : def.options).map(
|
|
12132
|
+
(x, i) => parseDef3(x._def, {
|
|
12133
|
+
...refs,
|
|
12134
|
+
currentPath: [...refs.currentPath, "anyOf", `${i}`]
|
|
12135
|
+
})
|
|
12136
|
+
).filter(
|
|
12137
|
+
(x) => !!x && (!refs.strictUnions || typeof x === "object" && Object.keys(x).length > 0)
|
|
12138
|
+
);
|
|
12139
|
+
return anyOf.length ? { anyOf } : void 0;
|
|
12140
|
+
};
|
|
12141
|
+
function parseNullableDef3(def, refs) {
|
|
12142
|
+
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(
|
|
12143
|
+
def.innerType._def.typeName
|
|
12144
|
+
) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
12145
|
+
return {
|
|
12146
|
+
type: [
|
|
12147
|
+
primitiveMappings3[def.innerType._def.typeName],
|
|
12148
|
+
"null"
|
|
12149
|
+
]
|
|
12150
|
+
};
|
|
12151
|
+
}
|
|
12152
|
+
const base = parseDef3(def.innerType._def, {
|
|
12153
|
+
...refs,
|
|
12154
|
+
currentPath: [...refs.currentPath, "anyOf", "0"]
|
|
12155
|
+
});
|
|
12156
|
+
return base && { anyOf: [base, { type: "null" }] };
|
|
12157
|
+
}
|
|
12158
|
+
function parseNumberDef3(def) {
|
|
12159
|
+
const res = {
|
|
12160
|
+
type: "number"
|
|
12161
|
+
};
|
|
12162
|
+
if (!def.checks) return res;
|
|
12163
|
+
for (const check of def.checks) {
|
|
12164
|
+
switch (check.kind) {
|
|
12165
|
+
case "int":
|
|
12166
|
+
res.type = "integer";
|
|
12167
|
+
break;
|
|
12168
|
+
case "min":
|
|
12169
|
+
if (check.inclusive) {
|
|
12170
|
+
res.minimum = check.value;
|
|
12171
|
+
} else {
|
|
12172
|
+
res.exclusiveMinimum = check.value;
|
|
12173
|
+
}
|
|
12174
|
+
break;
|
|
12175
|
+
case "max":
|
|
12176
|
+
if (check.inclusive) {
|
|
12177
|
+
res.maximum = check.value;
|
|
12178
|
+
} else {
|
|
12179
|
+
res.exclusiveMaximum = check.value;
|
|
12180
|
+
}
|
|
12181
|
+
break;
|
|
12182
|
+
case "multipleOf":
|
|
12183
|
+
res.multipleOf = check.value;
|
|
12184
|
+
break;
|
|
12185
|
+
}
|
|
12186
|
+
}
|
|
12187
|
+
return res;
|
|
12188
|
+
}
|
|
12189
|
+
function parseObjectDef3(def, refs) {
|
|
12190
|
+
const result = {
|
|
12191
|
+
type: "object",
|
|
12192
|
+
properties: {}
|
|
12193
|
+
};
|
|
12194
|
+
const required = [];
|
|
12195
|
+
const shape = def.shape();
|
|
12196
|
+
for (const propName in shape) {
|
|
12197
|
+
let propDef = shape[propName];
|
|
12198
|
+
if (propDef === void 0 || propDef._def === void 0) {
|
|
12199
|
+
continue;
|
|
12200
|
+
}
|
|
12201
|
+
const propOptional = safeIsOptional3(propDef);
|
|
12202
|
+
const parsedDef = parseDef3(propDef._def, {
|
|
12203
|
+
...refs,
|
|
12204
|
+
currentPath: [...refs.currentPath, "properties", propName],
|
|
12205
|
+
propertyPath: [...refs.currentPath, "properties", propName]
|
|
12206
|
+
});
|
|
12207
|
+
if (parsedDef === void 0) {
|
|
12208
|
+
continue;
|
|
12209
|
+
}
|
|
12210
|
+
result.properties[propName] = parsedDef;
|
|
12211
|
+
if (!propOptional) {
|
|
12212
|
+
required.push(propName);
|
|
12213
|
+
}
|
|
12214
|
+
}
|
|
12215
|
+
if (required.length) {
|
|
12216
|
+
result.required = required;
|
|
12217
|
+
}
|
|
12218
|
+
const additionalProperties = decideAdditionalProperties3(def, refs);
|
|
12219
|
+
if (additionalProperties !== void 0) {
|
|
12220
|
+
result.additionalProperties = additionalProperties;
|
|
12221
|
+
}
|
|
12222
|
+
return result;
|
|
12223
|
+
}
|
|
12224
|
+
function decideAdditionalProperties3(def, refs) {
|
|
12225
|
+
if (def.catchall._def.typeName !== "ZodNever") {
|
|
12226
|
+
return parseDef3(def.catchall._def, {
|
|
12227
|
+
...refs,
|
|
12228
|
+
currentPath: [...refs.currentPath, "additionalProperties"]
|
|
12229
|
+
});
|
|
12230
|
+
}
|
|
12231
|
+
switch (def.unknownKeys) {
|
|
12232
|
+
case "passthrough":
|
|
12233
|
+
return refs.allowedAdditionalProperties;
|
|
12234
|
+
case "strict":
|
|
12235
|
+
return refs.rejectedAdditionalProperties;
|
|
12236
|
+
case "strip":
|
|
12237
|
+
return refs.removeAdditionalStrategy === "strict" ? refs.allowedAdditionalProperties : refs.rejectedAdditionalProperties;
|
|
12238
|
+
}
|
|
12239
|
+
}
|
|
12240
|
+
function safeIsOptional3(schema) {
|
|
12241
|
+
try {
|
|
12242
|
+
return schema.isOptional();
|
|
12243
|
+
} catch (e2) {
|
|
12244
|
+
return true;
|
|
12245
|
+
}
|
|
12246
|
+
}
|
|
12247
|
+
var parseOptionalDef3 = (def, refs) => {
|
|
12248
|
+
var _a21;
|
|
12249
|
+
if (refs.currentPath.toString() === ((_a21 = refs.propertyPath) == null ? void 0 : _a21.toString())) {
|
|
12250
|
+
return parseDef3(def.innerType._def, refs);
|
|
12251
|
+
}
|
|
12252
|
+
const innerSchema = parseDef3(def.innerType._def, {
|
|
12253
|
+
...refs,
|
|
12254
|
+
currentPath: [...refs.currentPath, "anyOf", "1"]
|
|
12255
|
+
});
|
|
12256
|
+
return innerSchema ? { anyOf: [{ not: parseAnyDef3() }, innerSchema] } : parseAnyDef3();
|
|
12257
|
+
};
|
|
12258
|
+
var parsePipelineDef3 = (def, refs) => {
|
|
12259
|
+
if (refs.pipeStrategy === "input") {
|
|
12260
|
+
return parseDef3(def.in._def, refs);
|
|
12261
|
+
} else if (refs.pipeStrategy === "output") {
|
|
12262
|
+
return parseDef3(def.out._def, refs);
|
|
12263
|
+
}
|
|
12264
|
+
const a = parseDef3(def.in._def, {
|
|
12265
|
+
...refs,
|
|
12266
|
+
currentPath: [...refs.currentPath, "allOf", "0"]
|
|
12267
|
+
});
|
|
12268
|
+
const b = parseDef3(def.out._def, {
|
|
12269
|
+
...refs,
|
|
12270
|
+
currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"]
|
|
12271
|
+
});
|
|
12272
|
+
return {
|
|
12273
|
+
allOf: [a, b].filter((x) => x !== void 0)
|
|
12274
|
+
};
|
|
12275
|
+
};
|
|
12276
|
+
function parsePromiseDef3(def, refs) {
|
|
12277
|
+
return parseDef3(def.type._def, refs);
|
|
12278
|
+
}
|
|
12279
|
+
function parseSetDef3(def, refs) {
|
|
12280
|
+
const items = parseDef3(def.valueType._def, {
|
|
12281
|
+
...refs,
|
|
12282
|
+
currentPath: [...refs.currentPath, "items"]
|
|
12283
|
+
});
|
|
12284
|
+
const schema = {
|
|
12285
|
+
type: "array",
|
|
12286
|
+
uniqueItems: true,
|
|
12287
|
+
items
|
|
12288
|
+
};
|
|
12289
|
+
if (def.minSize) {
|
|
12290
|
+
schema.minItems = def.minSize.value;
|
|
12291
|
+
}
|
|
12292
|
+
if (def.maxSize) {
|
|
12293
|
+
schema.maxItems = def.maxSize.value;
|
|
12294
|
+
}
|
|
12295
|
+
return schema;
|
|
12296
|
+
}
|
|
12297
|
+
function parseTupleDef3(def, refs) {
|
|
12298
|
+
if (def.rest) {
|
|
12299
|
+
return {
|
|
12300
|
+
type: "array",
|
|
12301
|
+
minItems: def.items.length,
|
|
12302
|
+
items: def.items.map(
|
|
12303
|
+
(x, i) => parseDef3(x._def, {
|
|
12304
|
+
...refs,
|
|
12305
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12306
|
+
})
|
|
12307
|
+
).reduce(
|
|
12308
|
+
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
12309
|
+
[]
|
|
12310
|
+
),
|
|
12311
|
+
additionalItems: parseDef3(def.rest._def, {
|
|
12312
|
+
...refs,
|
|
12313
|
+
currentPath: [...refs.currentPath, "additionalItems"]
|
|
12314
|
+
})
|
|
12315
|
+
};
|
|
12316
|
+
} else {
|
|
12317
|
+
return {
|
|
12318
|
+
type: "array",
|
|
12319
|
+
minItems: def.items.length,
|
|
12320
|
+
maxItems: def.items.length,
|
|
12321
|
+
items: def.items.map(
|
|
12322
|
+
(x, i) => parseDef3(x._def, {
|
|
12323
|
+
...refs,
|
|
12324
|
+
currentPath: [...refs.currentPath, "items", `${i}`]
|
|
12325
|
+
})
|
|
12326
|
+
).reduce(
|
|
12327
|
+
(acc, x) => x === void 0 ? acc : [...acc, x],
|
|
12328
|
+
[]
|
|
12329
|
+
)
|
|
12330
|
+
};
|
|
12331
|
+
}
|
|
12332
|
+
}
|
|
12333
|
+
function parseUndefinedDef3() {
|
|
12334
|
+
return {
|
|
12335
|
+
not: parseAnyDef3()
|
|
12336
|
+
};
|
|
12337
|
+
}
|
|
12338
|
+
function parseUnknownDef3() {
|
|
12339
|
+
return parseAnyDef3();
|
|
12340
|
+
}
|
|
12341
|
+
var parseReadonlyDef3 = (def, refs) => {
|
|
12342
|
+
return parseDef3(def.innerType._def, refs);
|
|
12343
|
+
};
|
|
12344
|
+
var selectParser3 = (def, typeName, refs) => {
|
|
12345
|
+
switch (typeName) {
|
|
12346
|
+
case v3.ZodFirstPartyTypeKind.ZodString:
|
|
12347
|
+
return parseStringDef3(def, refs);
|
|
12348
|
+
case v3.ZodFirstPartyTypeKind.ZodNumber:
|
|
12349
|
+
return parseNumberDef3(def);
|
|
12350
|
+
case v3.ZodFirstPartyTypeKind.ZodObject:
|
|
12351
|
+
return parseObjectDef3(def, refs);
|
|
12352
|
+
case v3.ZodFirstPartyTypeKind.ZodBigInt:
|
|
12353
|
+
return parseBigintDef3(def);
|
|
12354
|
+
case v3.ZodFirstPartyTypeKind.ZodBoolean:
|
|
12355
|
+
return parseBooleanDef3();
|
|
12356
|
+
case v3.ZodFirstPartyTypeKind.ZodDate:
|
|
12357
|
+
return parseDateDef3(def, refs);
|
|
12358
|
+
case v3.ZodFirstPartyTypeKind.ZodUndefined:
|
|
12359
|
+
return parseUndefinedDef3();
|
|
12360
|
+
case v3.ZodFirstPartyTypeKind.ZodNull:
|
|
12361
|
+
return parseNullDef3();
|
|
12362
|
+
case v3.ZodFirstPartyTypeKind.ZodArray:
|
|
12363
|
+
return parseArrayDef3(def, refs);
|
|
12364
|
+
case v3.ZodFirstPartyTypeKind.ZodUnion:
|
|
12365
|
+
case v3.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:
|
|
12366
|
+
return parseUnionDef3(def, refs);
|
|
12367
|
+
case v3.ZodFirstPartyTypeKind.ZodIntersection:
|
|
12368
|
+
return parseIntersectionDef3(def, refs);
|
|
12369
|
+
case v3.ZodFirstPartyTypeKind.ZodTuple:
|
|
12370
|
+
return parseTupleDef3(def, refs);
|
|
12371
|
+
case v3.ZodFirstPartyTypeKind.ZodRecord:
|
|
12372
|
+
return parseRecordDef3(def, refs);
|
|
12373
|
+
case v3.ZodFirstPartyTypeKind.ZodLiteral:
|
|
12374
|
+
return parseLiteralDef3(def);
|
|
12375
|
+
case v3.ZodFirstPartyTypeKind.ZodEnum:
|
|
12376
|
+
return parseEnumDef3(def);
|
|
12377
|
+
case v3.ZodFirstPartyTypeKind.ZodNativeEnum:
|
|
12378
|
+
return parseNativeEnumDef3(def);
|
|
12379
|
+
case v3.ZodFirstPartyTypeKind.ZodNullable:
|
|
12380
|
+
return parseNullableDef3(def, refs);
|
|
12381
|
+
case v3.ZodFirstPartyTypeKind.ZodOptional:
|
|
12382
|
+
return parseOptionalDef3(def, refs);
|
|
12383
|
+
case v3.ZodFirstPartyTypeKind.ZodMap:
|
|
12384
|
+
return parseMapDef3(def, refs);
|
|
12385
|
+
case v3.ZodFirstPartyTypeKind.ZodSet:
|
|
12386
|
+
return parseSetDef3(def, refs);
|
|
12387
|
+
case v3.ZodFirstPartyTypeKind.ZodLazy:
|
|
12388
|
+
return () => def.getter()._def;
|
|
12389
|
+
case v3.ZodFirstPartyTypeKind.ZodPromise:
|
|
12390
|
+
return parsePromiseDef3(def, refs);
|
|
12391
|
+
case v3.ZodFirstPartyTypeKind.ZodNaN:
|
|
12392
|
+
case v3.ZodFirstPartyTypeKind.ZodNever:
|
|
12393
|
+
return parseNeverDef3();
|
|
12394
|
+
case v3.ZodFirstPartyTypeKind.ZodEffects:
|
|
12395
|
+
return parseEffectsDef3(def, refs);
|
|
12396
|
+
case v3.ZodFirstPartyTypeKind.ZodAny:
|
|
12397
|
+
return parseAnyDef3();
|
|
12398
|
+
case v3.ZodFirstPartyTypeKind.ZodUnknown:
|
|
12399
|
+
return parseUnknownDef3();
|
|
12400
|
+
case v3.ZodFirstPartyTypeKind.ZodDefault:
|
|
12401
|
+
return parseDefaultDef3(def, refs);
|
|
12402
|
+
case v3.ZodFirstPartyTypeKind.ZodBranded:
|
|
12403
|
+
return parseBrandedDef3(def, refs);
|
|
12404
|
+
case v3.ZodFirstPartyTypeKind.ZodReadonly:
|
|
12405
|
+
return parseReadonlyDef3(def, refs);
|
|
12406
|
+
case v3.ZodFirstPartyTypeKind.ZodCatch:
|
|
12407
|
+
return parseCatchDef3(def, refs);
|
|
12408
|
+
case v3.ZodFirstPartyTypeKind.ZodPipeline:
|
|
12409
|
+
return parsePipelineDef3(def, refs);
|
|
12410
|
+
case v3.ZodFirstPartyTypeKind.ZodFunction:
|
|
12411
|
+
case v3.ZodFirstPartyTypeKind.ZodVoid:
|
|
12412
|
+
case v3.ZodFirstPartyTypeKind.ZodSymbol:
|
|
12413
|
+
return void 0;
|
|
12414
|
+
default:
|
|
12415
|
+
return /* @__PURE__ */ ((_) => void 0)();
|
|
12416
|
+
}
|
|
12417
|
+
};
|
|
12418
|
+
function parseDef3(def, refs, forceResolution = false) {
|
|
12419
|
+
var _a21;
|
|
12420
|
+
const seenItem = refs.seen.get(def);
|
|
12421
|
+
if (refs.override) {
|
|
12422
|
+
const overrideResult = (_a21 = refs.override) == null ? void 0 : _a21.call(
|
|
12423
|
+
refs,
|
|
12424
|
+
def,
|
|
12425
|
+
refs,
|
|
12426
|
+
seenItem,
|
|
12427
|
+
forceResolution
|
|
12428
|
+
);
|
|
12429
|
+
if (overrideResult !== ignoreOverride3) {
|
|
12430
|
+
return overrideResult;
|
|
12431
|
+
}
|
|
12432
|
+
}
|
|
12433
|
+
if (seenItem && !forceResolution) {
|
|
12434
|
+
const seenSchema = get$ref3(seenItem, refs);
|
|
12435
|
+
if (seenSchema !== void 0) {
|
|
12436
|
+
return seenSchema;
|
|
12437
|
+
}
|
|
12438
|
+
}
|
|
12439
|
+
const newItem = { def, path: refs.currentPath, jsonSchema: void 0 };
|
|
12440
|
+
refs.seen.set(def, newItem);
|
|
12441
|
+
const jsonSchemaOrGetter = selectParser3(def, def.typeName, refs);
|
|
12442
|
+
const jsonSchema22 = typeof jsonSchemaOrGetter === "function" ? parseDef3(jsonSchemaOrGetter(), refs) : jsonSchemaOrGetter;
|
|
12443
|
+
if (jsonSchema22) {
|
|
12444
|
+
addMeta3(def, refs, jsonSchema22);
|
|
12445
|
+
}
|
|
12446
|
+
if (refs.postProcess) {
|
|
12447
|
+
const postProcessResult = refs.postProcess(jsonSchema22, def, refs);
|
|
12448
|
+
newItem.jsonSchema = jsonSchema22;
|
|
12449
|
+
return postProcessResult;
|
|
12450
|
+
}
|
|
12451
|
+
newItem.jsonSchema = jsonSchema22;
|
|
12452
|
+
return jsonSchema22;
|
|
12453
|
+
}
|
|
12454
|
+
var get$ref3 = (item, refs) => {
|
|
12455
|
+
switch (refs.$refStrategy) {
|
|
12456
|
+
case "root":
|
|
12457
|
+
return { $ref: item.path.join("/") };
|
|
12458
|
+
case "relative":
|
|
12459
|
+
return { $ref: getRelativePath3(refs.currentPath, item.path) };
|
|
12460
|
+
case "none":
|
|
12461
|
+
case "seen": {
|
|
12462
|
+
if (item.path.length < refs.currentPath.length && item.path.every((value, index) => refs.currentPath[index] === value)) {
|
|
12463
|
+
console.warn(
|
|
12464
|
+
`Recursive reference detected at ${refs.currentPath.join(
|
|
12465
|
+
"/"
|
|
12466
|
+
)}! Defaulting to any`
|
|
12467
|
+
);
|
|
12468
|
+
return parseAnyDef3();
|
|
12469
|
+
}
|
|
12470
|
+
return refs.$refStrategy === "seen" ? parseAnyDef3() : void 0;
|
|
12471
|
+
}
|
|
12472
|
+
}
|
|
12473
|
+
};
|
|
12474
|
+
var addMeta3 = (def, refs, jsonSchema22) => {
|
|
12475
|
+
if (def.description) {
|
|
12476
|
+
jsonSchema22.description = def.description;
|
|
12477
|
+
}
|
|
12478
|
+
return jsonSchema22;
|
|
12479
|
+
};
|
|
12480
|
+
var getRefs3 = (options) => {
|
|
12481
|
+
const _options = getDefaultOptions3(options);
|
|
12482
|
+
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
12483
|
+
return {
|
|
12484
|
+
..._options,
|
|
12485
|
+
currentPath,
|
|
12486
|
+
propertyPath: void 0,
|
|
12487
|
+
seen: new Map(
|
|
12488
|
+
Object.entries(_options.definitions).map(([name21, def]) => [
|
|
12489
|
+
def._def,
|
|
12490
|
+
{
|
|
12491
|
+
def: def._def,
|
|
12492
|
+
path: [..._options.basePath, _options.definitionPath, name21],
|
|
12493
|
+
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
12494
|
+
jsonSchema: void 0
|
|
12495
|
+
}
|
|
12496
|
+
])
|
|
12497
|
+
)
|
|
12498
|
+
};
|
|
12499
|
+
};
|
|
12500
|
+
var zodToJsonSchema4 = (schema, options) => {
|
|
12501
|
+
var _a21;
|
|
12502
|
+
const refs = getRefs3(options);
|
|
12503
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce(
|
|
12504
|
+
(acc, [name26, schema2]) => {
|
|
12505
|
+
var _a26;
|
|
12506
|
+
return {
|
|
12507
|
+
...acc,
|
|
12508
|
+
[name26]: (_a26 = parseDef3(
|
|
12509
|
+
schema2._def,
|
|
12510
|
+
{
|
|
12511
|
+
...refs,
|
|
12512
|
+
currentPath: [...refs.basePath, refs.definitionPath, name26]
|
|
12513
|
+
},
|
|
12514
|
+
true
|
|
12515
|
+
)) != null ? _a26 : parseAnyDef3()
|
|
12516
|
+
};
|
|
12517
|
+
},
|
|
12518
|
+
{}
|
|
12519
|
+
) : void 0;
|
|
12520
|
+
const name21 = typeof options === "string" ? options : (options == null ? void 0 : options.nameStrategy) === "title" ? void 0 : options == null ? void 0 : options.name;
|
|
12521
|
+
const main = (_a21 = parseDef3(
|
|
12522
|
+
schema._def,
|
|
12523
|
+
name21 === void 0 ? refs : {
|
|
12524
|
+
...refs,
|
|
12525
|
+
currentPath: [...refs.basePath, refs.definitionPath, name21]
|
|
12526
|
+
},
|
|
12527
|
+
false
|
|
12528
|
+
)) != null ? _a21 : parseAnyDef3();
|
|
12529
|
+
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
12530
|
+
if (title !== void 0) {
|
|
12531
|
+
main.title = title;
|
|
12532
|
+
}
|
|
12533
|
+
const combined = name21 === void 0 ? definitions ? {
|
|
12534
|
+
...main,
|
|
12535
|
+
[refs.definitionPath]: definitions
|
|
12536
|
+
} : main : {
|
|
12537
|
+
$ref: [
|
|
12538
|
+
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
12539
|
+
refs.definitionPath,
|
|
12540
|
+
name21
|
|
12541
|
+
].join("/"),
|
|
12542
|
+
[refs.definitionPath]: {
|
|
12543
|
+
...definitions,
|
|
12544
|
+
[name21]: main
|
|
12545
|
+
}
|
|
12546
|
+
};
|
|
12547
|
+
combined.$schema = "http://json-schema.org/draft-07/schema#";
|
|
12548
|
+
return combined;
|
|
12549
|
+
};
|
|
12550
|
+
var zod_to_json_schema_default2 = zodToJsonSchema4;
|
|
12551
|
+
function zod3Schema2(zodSchema22, options) {
|
|
12552
|
+
var _a21;
|
|
12553
|
+
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
12554
|
+
return jsonSchema3(
|
|
12555
|
+
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
12556
|
+
() => zod_to_json_schema_default2(zodSchema22, {
|
|
12557
|
+
$refStrategy: useReferences ? "root" : "none"
|
|
12558
|
+
}),
|
|
12559
|
+
{
|
|
12560
|
+
validate: async (value) => {
|
|
12561
|
+
const result = await zodSchema22.safeParseAsync(value);
|
|
12562
|
+
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
12563
|
+
}
|
|
12564
|
+
}
|
|
12565
|
+
);
|
|
12566
|
+
}
|
|
12567
|
+
function zod4Schema2(zodSchema22, options) {
|
|
12568
|
+
var _a21;
|
|
12569
|
+
const useReferences = (_a21 = void 0 ) != null ? _a21 : false;
|
|
12570
|
+
return jsonSchema3(
|
|
12571
|
+
// defer json schema creation to avoid unnecessary computation when only validation is needed
|
|
12572
|
+
() => z42__namespace.toJSONSchema(zodSchema22, {
|
|
12573
|
+
target: "draft-7",
|
|
12574
|
+
io: "output",
|
|
12575
|
+
reused: useReferences ? "ref" : "inline"
|
|
12576
|
+
}),
|
|
12577
|
+
{
|
|
12578
|
+
validate: async (value) => {
|
|
12579
|
+
const result = await z42__namespace.safeParseAsync(zodSchema22, value);
|
|
12580
|
+
return result.success ? { success: true, value: result.data } : { success: false, error: result.error };
|
|
12581
|
+
}
|
|
12582
|
+
}
|
|
12583
|
+
);
|
|
12584
|
+
}
|
|
12585
|
+
function isZod4Schema2(zodSchema22) {
|
|
12586
|
+
return "_zod" in zodSchema22;
|
|
12587
|
+
}
|
|
12588
|
+
function zodSchema3(zodSchema22, options) {
|
|
12589
|
+
if (isZod4Schema2(zodSchema22)) {
|
|
12590
|
+
return zod4Schema2(zodSchema22);
|
|
12591
|
+
} else {
|
|
12592
|
+
return zod3Schema2(zodSchema22);
|
|
12593
|
+
}
|
|
12594
|
+
}
|
|
12595
|
+
var schemaSymbol3 = Symbol.for("vercel.ai.schema");
|
|
12596
|
+
function jsonSchema3(jsonSchema22, {
|
|
12597
|
+
validate
|
|
12598
|
+
} = {}) {
|
|
12599
|
+
return {
|
|
12600
|
+
[schemaSymbol3]: true,
|
|
12601
|
+
_type: void 0,
|
|
12602
|
+
// should never be used directly
|
|
12603
|
+
[validatorSymbol3]: true,
|
|
12604
|
+
get jsonSchema() {
|
|
12605
|
+
if (typeof jsonSchema22 === "function") {
|
|
12606
|
+
jsonSchema22 = jsonSchema22();
|
|
12607
|
+
}
|
|
12608
|
+
return jsonSchema22;
|
|
12609
|
+
},
|
|
12610
|
+
validate
|
|
12611
|
+
};
|
|
12612
|
+
}
|
|
12613
|
+
function isSchema3(value) {
|
|
12614
|
+
return typeof value === "object" && value !== null && schemaSymbol3 in value && value[schemaSymbol3] === true && "jsonSchema" in value && "validate" in value;
|
|
12615
|
+
}
|
|
12616
|
+
function asSchema3(schema) {
|
|
12617
|
+
return schema == null ? jsonSchema3({
|
|
12618
|
+
properties: {},
|
|
12619
|
+
additionalProperties: false
|
|
12620
|
+
}) : isSchema3(schema) ? schema : typeof schema === "function" ? schema() : zodSchema3(schema);
|
|
12621
|
+
}
|
|
12622
|
+
var __defProp4 = Object.defineProperty;
|
|
12623
|
+
var __export4 = (target, all) => {
|
|
12624
|
+
for (var name172 in all)
|
|
12625
|
+
__defProp4(target, name172, { get: all[name172], enumerable: true });
|
|
12626
|
+
};
|
|
12627
|
+
var name74 = "AI_NoObjectGeneratedError";
|
|
12628
|
+
var marker75 = `vercel.ai.error.${name74}`;
|
|
12629
|
+
var symbol75 = Symbol.for(marker75);
|
|
12630
|
+
var _a75;
|
|
12631
|
+
var NoObjectGeneratedError3 = class extends AISDKError2 {
|
|
12632
|
+
constructor({
|
|
12633
|
+
message = "No object generated.",
|
|
12634
|
+
cause,
|
|
12635
|
+
text: text22,
|
|
12636
|
+
response,
|
|
12637
|
+
usage,
|
|
12638
|
+
finishReason
|
|
12639
|
+
}) {
|
|
12640
|
+
super({ name: name74, message, cause });
|
|
12641
|
+
this[_a75] = true;
|
|
12642
|
+
this.text = text22;
|
|
12643
|
+
this.response = response;
|
|
12644
|
+
this.usage = usage;
|
|
12645
|
+
this.finishReason = finishReason;
|
|
12646
|
+
}
|
|
12647
|
+
static isInstance(error) {
|
|
12648
|
+
return AISDKError2.hasMarker(error, marker75);
|
|
12649
|
+
}
|
|
12650
|
+
};
|
|
12651
|
+
_a75 = symbol75;
|
|
12652
|
+
var dataContentSchema3 = z42.z.union([
|
|
12653
|
+
z42.z.string(),
|
|
12654
|
+
z42.z.instanceof(Uint8Array),
|
|
12655
|
+
z42.z.instanceof(ArrayBuffer),
|
|
12656
|
+
z42.z.custom(
|
|
12657
|
+
// Buffer might not be available in some environments such as CloudFlare:
|
|
12658
|
+
(value) => {
|
|
12659
|
+
var _a172, _b8;
|
|
12660
|
+
return (_b8 = (_a172 = globalThis.Buffer) == null ? void 0 : _a172.isBuffer(value)) != null ? _b8 : false;
|
|
12661
|
+
},
|
|
12662
|
+
{ message: "Must be a Buffer" }
|
|
12663
|
+
)
|
|
12664
|
+
]);
|
|
12665
|
+
var jsonValueSchema3 = z42.z.lazy(
|
|
12666
|
+
() => z42.z.union([
|
|
12667
|
+
z42.z.null(),
|
|
12668
|
+
z42.z.string(),
|
|
12669
|
+
z42.z.number(),
|
|
12670
|
+
z42.z.boolean(),
|
|
12671
|
+
z42.z.record(z42.z.string(), jsonValueSchema3),
|
|
12672
|
+
z42.z.array(jsonValueSchema3)
|
|
12673
|
+
])
|
|
12674
|
+
);
|
|
12675
|
+
var providerMetadataSchema3 = z42.z.record(
|
|
12676
|
+
z42.z.string(),
|
|
12677
|
+
z42.z.record(z42.z.string(), jsonValueSchema3)
|
|
12678
|
+
);
|
|
12679
|
+
var textPartSchema3 = z42.z.object({
|
|
12680
|
+
type: z42.z.literal("text"),
|
|
12681
|
+
text: z42.z.string(),
|
|
12682
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12683
|
+
});
|
|
12684
|
+
var imagePartSchema3 = z42.z.object({
|
|
12685
|
+
type: z42.z.literal("image"),
|
|
12686
|
+
image: z42.z.union([dataContentSchema3, z42.z.instanceof(URL)]),
|
|
12687
|
+
mediaType: z42.z.string().optional(),
|
|
12688
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12689
|
+
});
|
|
12690
|
+
var filePartSchema3 = z42.z.object({
|
|
12691
|
+
type: z42.z.literal("file"),
|
|
12692
|
+
data: z42.z.union([dataContentSchema3, z42.z.instanceof(URL)]),
|
|
12693
|
+
filename: z42.z.string().optional(),
|
|
12694
|
+
mediaType: z42.z.string(),
|
|
12695
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12696
|
+
});
|
|
12697
|
+
var reasoningPartSchema3 = z42.z.object({
|
|
12698
|
+
type: z42.z.literal("reasoning"),
|
|
12699
|
+
text: z42.z.string(),
|
|
12700
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12701
|
+
});
|
|
12702
|
+
var toolCallPartSchema3 = z42.z.object({
|
|
12703
|
+
type: z42.z.literal("tool-call"),
|
|
12704
|
+
toolCallId: z42.z.string(),
|
|
12705
|
+
toolName: z42.z.string(),
|
|
12706
|
+
input: z42.z.unknown(),
|
|
12707
|
+
providerOptions: providerMetadataSchema3.optional(),
|
|
12708
|
+
providerExecuted: z42.z.boolean().optional()
|
|
12709
|
+
});
|
|
12710
|
+
var outputSchema2 = z42.z.discriminatedUnion("type", [
|
|
12711
|
+
z42.z.object({
|
|
12712
|
+
type: z42.z.literal("text"),
|
|
12713
|
+
value: z42.z.string()
|
|
12714
|
+
}),
|
|
12715
|
+
z42.z.object({
|
|
12716
|
+
type: z42.z.literal("json"),
|
|
12717
|
+
value: jsonValueSchema3
|
|
12718
|
+
}),
|
|
12719
|
+
z42.z.object({
|
|
12720
|
+
type: z42.z.literal("error-text"),
|
|
12721
|
+
value: z42.z.string()
|
|
12722
|
+
}),
|
|
12723
|
+
z42.z.object({
|
|
12724
|
+
type: z42.z.literal("error-json"),
|
|
12725
|
+
value: jsonValueSchema3
|
|
12726
|
+
}),
|
|
12727
|
+
z42.z.object({
|
|
12728
|
+
type: z42.z.literal("content"),
|
|
12729
|
+
value: z42.z.array(
|
|
12730
|
+
z42.z.union([
|
|
12731
|
+
z42.z.object({
|
|
12732
|
+
type: z42.z.literal("text"),
|
|
12733
|
+
text: z42.z.string()
|
|
12734
|
+
}),
|
|
12735
|
+
z42.z.object({
|
|
12736
|
+
type: z42.z.literal("media"),
|
|
12737
|
+
data: z42.z.string(),
|
|
12738
|
+
mediaType: z42.z.string()
|
|
12739
|
+
})
|
|
12740
|
+
])
|
|
12741
|
+
)
|
|
12742
|
+
})
|
|
12743
|
+
]);
|
|
12744
|
+
var toolResultPartSchema3 = z42.z.object({
|
|
12745
|
+
type: z42.z.literal("tool-result"),
|
|
12746
|
+
toolCallId: z42.z.string(),
|
|
12747
|
+
toolName: z42.z.string(),
|
|
12748
|
+
output: outputSchema2,
|
|
12749
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12750
|
+
});
|
|
12751
|
+
var systemModelMessageSchema2 = z42.z.object(
|
|
12752
|
+
{
|
|
12753
|
+
role: z42.z.literal("system"),
|
|
12754
|
+
content: z42.z.string(),
|
|
12755
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12756
|
+
}
|
|
12757
|
+
);
|
|
12758
|
+
var userModelMessageSchema2 = z42.z.object({
|
|
12759
|
+
role: z42.z.literal("user"),
|
|
12760
|
+
content: z42.z.union([
|
|
12761
|
+
z42.z.string(),
|
|
12762
|
+
z42.z.array(z42.z.union([textPartSchema3, imagePartSchema3, filePartSchema3]))
|
|
12763
|
+
]),
|
|
12764
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12765
|
+
});
|
|
12766
|
+
var assistantModelMessageSchema2 = z42.z.object({
|
|
12767
|
+
role: z42.z.literal("assistant"),
|
|
12768
|
+
content: z42.z.union([
|
|
12769
|
+
z42.z.string(),
|
|
12770
|
+
z42.z.array(
|
|
12771
|
+
z42.z.union([
|
|
12772
|
+
textPartSchema3,
|
|
12773
|
+
filePartSchema3,
|
|
12774
|
+
reasoningPartSchema3,
|
|
12775
|
+
toolCallPartSchema3,
|
|
12776
|
+
toolResultPartSchema3
|
|
12777
|
+
])
|
|
12778
|
+
)
|
|
12779
|
+
]),
|
|
12780
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12781
|
+
});
|
|
12782
|
+
var toolModelMessageSchema2 = z42.z.object({
|
|
12783
|
+
role: z42.z.literal("tool"),
|
|
12784
|
+
content: z42.z.array(toolResultPartSchema3),
|
|
12785
|
+
providerOptions: providerMetadataSchema3.optional()
|
|
12786
|
+
});
|
|
12787
|
+
z42.z.union([
|
|
12788
|
+
systemModelMessageSchema2,
|
|
12789
|
+
userModelMessageSchema2,
|
|
12790
|
+
assistantModelMessageSchema2,
|
|
12791
|
+
toolModelMessageSchema2
|
|
12792
|
+
]);
|
|
12793
|
+
function stepCountIs(stepCount) {
|
|
12794
|
+
return ({ steps }) => steps.length === stepCount;
|
|
12795
|
+
}
|
|
12796
|
+
createIdGenerator3({
|
|
12797
|
+
prefix: "aitxt",
|
|
12798
|
+
size: 24
|
|
12799
|
+
});
|
|
12800
|
+
function fixJson3(input) {
|
|
12801
|
+
const stack = ["ROOT"];
|
|
12802
|
+
let lastValidIndex = -1;
|
|
12803
|
+
let literalStart = null;
|
|
12804
|
+
function processValueStart(char, i, swapState) {
|
|
12805
|
+
{
|
|
12806
|
+
switch (char) {
|
|
12807
|
+
case '"': {
|
|
12808
|
+
lastValidIndex = i;
|
|
12809
|
+
stack.pop();
|
|
12810
|
+
stack.push(swapState);
|
|
12811
|
+
stack.push("INSIDE_STRING");
|
|
12812
|
+
break;
|
|
12813
|
+
}
|
|
12814
|
+
case "f":
|
|
12815
|
+
case "t":
|
|
12816
|
+
case "n": {
|
|
12817
|
+
lastValidIndex = i;
|
|
12818
|
+
literalStart = i;
|
|
12819
|
+
stack.pop();
|
|
12820
|
+
stack.push(swapState);
|
|
12821
|
+
stack.push("INSIDE_LITERAL");
|
|
12822
|
+
break;
|
|
12823
|
+
}
|
|
12824
|
+
case "-": {
|
|
12825
|
+
stack.pop();
|
|
12826
|
+
stack.push(swapState);
|
|
12827
|
+
stack.push("INSIDE_NUMBER");
|
|
12828
|
+
break;
|
|
12829
|
+
}
|
|
12830
|
+
case "0":
|
|
12831
|
+
case "1":
|
|
12832
|
+
case "2":
|
|
12833
|
+
case "3":
|
|
12834
|
+
case "4":
|
|
12835
|
+
case "5":
|
|
12836
|
+
case "6":
|
|
12837
|
+
case "7":
|
|
12838
|
+
case "8":
|
|
12839
|
+
case "9": {
|
|
12840
|
+
lastValidIndex = i;
|
|
12841
|
+
stack.pop();
|
|
12842
|
+
stack.push(swapState);
|
|
12843
|
+
stack.push("INSIDE_NUMBER");
|
|
12844
|
+
break;
|
|
12845
|
+
}
|
|
12846
|
+
case "{": {
|
|
12847
|
+
lastValidIndex = i;
|
|
12848
|
+
stack.pop();
|
|
12849
|
+
stack.push(swapState);
|
|
12850
|
+
stack.push("INSIDE_OBJECT_START");
|
|
12851
|
+
break;
|
|
12852
|
+
}
|
|
12853
|
+
case "[": {
|
|
12854
|
+
lastValidIndex = i;
|
|
12855
|
+
stack.pop();
|
|
12856
|
+
stack.push(swapState);
|
|
12857
|
+
stack.push("INSIDE_ARRAY_START");
|
|
12858
|
+
break;
|
|
12859
|
+
}
|
|
12860
|
+
}
|
|
12861
|
+
}
|
|
12862
|
+
}
|
|
12863
|
+
function processAfterObjectValue(char, i) {
|
|
12864
|
+
switch (char) {
|
|
12865
|
+
case ",": {
|
|
12866
|
+
stack.pop();
|
|
12867
|
+
stack.push("INSIDE_OBJECT_AFTER_COMMA");
|
|
12868
|
+
break;
|
|
12869
|
+
}
|
|
12870
|
+
case "}": {
|
|
12871
|
+
lastValidIndex = i;
|
|
12872
|
+
stack.pop();
|
|
12873
|
+
break;
|
|
12874
|
+
}
|
|
12875
|
+
}
|
|
12876
|
+
}
|
|
12877
|
+
function processAfterArrayValue(char, i) {
|
|
12878
|
+
switch (char) {
|
|
12879
|
+
case ",": {
|
|
12880
|
+
stack.pop();
|
|
12881
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
12882
|
+
break;
|
|
12883
|
+
}
|
|
12884
|
+
case "]": {
|
|
12885
|
+
lastValidIndex = i;
|
|
12886
|
+
stack.pop();
|
|
12887
|
+
break;
|
|
12888
|
+
}
|
|
12889
|
+
}
|
|
12890
|
+
}
|
|
12891
|
+
for (let i = 0; i < input.length; i++) {
|
|
12892
|
+
const char = input[i];
|
|
12893
|
+
const currentState = stack[stack.length - 1];
|
|
12894
|
+
switch (currentState) {
|
|
12895
|
+
case "ROOT":
|
|
12896
|
+
processValueStart(char, i, "FINISH");
|
|
12897
|
+
break;
|
|
12898
|
+
case "INSIDE_OBJECT_START": {
|
|
12899
|
+
switch (char) {
|
|
12900
|
+
case '"': {
|
|
12901
|
+
stack.pop();
|
|
12902
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
12903
|
+
break;
|
|
12904
|
+
}
|
|
12905
|
+
case "}": {
|
|
12906
|
+
lastValidIndex = i;
|
|
12907
|
+
stack.pop();
|
|
12908
|
+
break;
|
|
12909
|
+
}
|
|
12910
|
+
}
|
|
12911
|
+
break;
|
|
12912
|
+
}
|
|
12913
|
+
case "INSIDE_OBJECT_AFTER_COMMA": {
|
|
12914
|
+
switch (char) {
|
|
12915
|
+
case '"': {
|
|
12916
|
+
stack.pop();
|
|
12917
|
+
stack.push("INSIDE_OBJECT_KEY");
|
|
12918
|
+
break;
|
|
12919
|
+
}
|
|
12920
|
+
}
|
|
12921
|
+
break;
|
|
12922
|
+
}
|
|
12923
|
+
case "INSIDE_OBJECT_KEY": {
|
|
12924
|
+
switch (char) {
|
|
12925
|
+
case '"': {
|
|
12926
|
+
stack.pop();
|
|
12927
|
+
stack.push("INSIDE_OBJECT_AFTER_KEY");
|
|
12928
|
+
break;
|
|
12929
|
+
}
|
|
12930
|
+
}
|
|
12931
|
+
break;
|
|
12932
|
+
}
|
|
12933
|
+
case "INSIDE_OBJECT_AFTER_KEY": {
|
|
12934
|
+
switch (char) {
|
|
12935
|
+
case ":": {
|
|
12936
|
+
stack.pop();
|
|
12937
|
+
stack.push("INSIDE_OBJECT_BEFORE_VALUE");
|
|
12938
|
+
break;
|
|
12939
|
+
}
|
|
12940
|
+
}
|
|
12941
|
+
break;
|
|
12942
|
+
}
|
|
12943
|
+
case "INSIDE_OBJECT_BEFORE_VALUE": {
|
|
12944
|
+
processValueStart(char, i, "INSIDE_OBJECT_AFTER_VALUE");
|
|
12945
|
+
break;
|
|
12946
|
+
}
|
|
12947
|
+
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
12948
|
+
processAfterObjectValue(char, i);
|
|
12949
|
+
break;
|
|
12950
|
+
}
|
|
12951
|
+
case "INSIDE_STRING": {
|
|
12952
|
+
switch (char) {
|
|
12953
|
+
case '"': {
|
|
12954
|
+
stack.pop();
|
|
12955
|
+
lastValidIndex = i;
|
|
12956
|
+
break;
|
|
12957
|
+
}
|
|
12958
|
+
case "\\": {
|
|
12959
|
+
stack.push("INSIDE_STRING_ESCAPE");
|
|
12960
|
+
break;
|
|
12961
|
+
}
|
|
12962
|
+
default: {
|
|
12963
|
+
lastValidIndex = i;
|
|
12964
|
+
}
|
|
12965
|
+
}
|
|
12966
|
+
break;
|
|
12967
|
+
}
|
|
12968
|
+
case "INSIDE_ARRAY_START": {
|
|
12969
|
+
switch (char) {
|
|
12970
|
+
case "]": {
|
|
12971
|
+
lastValidIndex = i;
|
|
12972
|
+
stack.pop();
|
|
12973
|
+
break;
|
|
12974
|
+
}
|
|
12975
|
+
default: {
|
|
12976
|
+
lastValidIndex = i;
|
|
12977
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
12978
|
+
break;
|
|
12979
|
+
}
|
|
12980
|
+
}
|
|
12981
|
+
break;
|
|
12982
|
+
}
|
|
12983
|
+
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
12984
|
+
switch (char) {
|
|
12985
|
+
case ",": {
|
|
12986
|
+
stack.pop();
|
|
12987
|
+
stack.push("INSIDE_ARRAY_AFTER_COMMA");
|
|
12988
|
+
break;
|
|
12989
|
+
}
|
|
12990
|
+
case "]": {
|
|
12991
|
+
lastValidIndex = i;
|
|
12992
|
+
stack.pop();
|
|
12993
|
+
break;
|
|
12994
|
+
}
|
|
12995
|
+
default: {
|
|
12996
|
+
lastValidIndex = i;
|
|
12997
|
+
break;
|
|
12998
|
+
}
|
|
12999
|
+
}
|
|
13000
|
+
break;
|
|
13001
|
+
}
|
|
13002
|
+
case "INSIDE_ARRAY_AFTER_COMMA": {
|
|
13003
|
+
processValueStart(char, i, "INSIDE_ARRAY_AFTER_VALUE");
|
|
13004
|
+
break;
|
|
13005
|
+
}
|
|
13006
|
+
case "INSIDE_STRING_ESCAPE": {
|
|
13007
|
+
stack.pop();
|
|
13008
|
+
lastValidIndex = i;
|
|
13009
|
+
break;
|
|
13010
|
+
}
|
|
13011
|
+
case "INSIDE_NUMBER": {
|
|
13012
|
+
switch (char) {
|
|
13013
|
+
case "0":
|
|
13014
|
+
case "1":
|
|
13015
|
+
case "2":
|
|
13016
|
+
case "3":
|
|
13017
|
+
case "4":
|
|
13018
|
+
case "5":
|
|
13019
|
+
case "6":
|
|
13020
|
+
case "7":
|
|
13021
|
+
case "8":
|
|
13022
|
+
case "9": {
|
|
13023
|
+
lastValidIndex = i;
|
|
13024
|
+
break;
|
|
13025
|
+
}
|
|
13026
|
+
case "e":
|
|
13027
|
+
case "E":
|
|
13028
|
+
case "-":
|
|
13029
|
+
case ".": {
|
|
13030
|
+
break;
|
|
13031
|
+
}
|
|
13032
|
+
case ",": {
|
|
13033
|
+
stack.pop();
|
|
13034
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13035
|
+
processAfterArrayValue(char, i);
|
|
13036
|
+
}
|
|
13037
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13038
|
+
processAfterObjectValue(char, i);
|
|
13039
|
+
}
|
|
13040
|
+
break;
|
|
13041
|
+
}
|
|
13042
|
+
case "}": {
|
|
13043
|
+
stack.pop();
|
|
13044
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13045
|
+
processAfterObjectValue(char, i);
|
|
13046
|
+
}
|
|
13047
|
+
break;
|
|
13048
|
+
}
|
|
13049
|
+
case "]": {
|
|
13050
|
+
stack.pop();
|
|
13051
|
+
if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13052
|
+
processAfterArrayValue(char, i);
|
|
13053
|
+
}
|
|
13054
|
+
break;
|
|
13055
|
+
}
|
|
13056
|
+
default: {
|
|
13057
|
+
stack.pop();
|
|
13058
|
+
break;
|
|
13059
|
+
}
|
|
13060
|
+
}
|
|
13061
|
+
break;
|
|
13062
|
+
}
|
|
13063
|
+
case "INSIDE_LITERAL": {
|
|
13064
|
+
const partialLiteral = input.substring(literalStart, i + 1);
|
|
13065
|
+
if (!"false".startsWith(partialLiteral) && !"true".startsWith(partialLiteral) && !"null".startsWith(partialLiteral)) {
|
|
13066
|
+
stack.pop();
|
|
13067
|
+
if (stack[stack.length - 1] === "INSIDE_OBJECT_AFTER_VALUE") {
|
|
13068
|
+
processAfterObjectValue(char, i);
|
|
13069
|
+
} else if (stack[stack.length - 1] === "INSIDE_ARRAY_AFTER_VALUE") {
|
|
13070
|
+
processAfterArrayValue(char, i);
|
|
13071
|
+
}
|
|
13072
|
+
} else {
|
|
13073
|
+
lastValidIndex = i;
|
|
13074
|
+
}
|
|
13075
|
+
break;
|
|
13076
|
+
}
|
|
13077
|
+
}
|
|
13078
|
+
}
|
|
13079
|
+
let result = input.slice(0, lastValidIndex + 1);
|
|
13080
|
+
for (let i = stack.length - 1; i >= 0; i--) {
|
|
13081
|
+
const state = stack[i];
|
|
13082
|
+
switch (state) {
|
|
13083
|
+
case "INSIDE_STRING": {
|
|
13084
|
+
result += '"';
|
|
13085
|
+
break;
|
|
13086
|
+
}
|
|
13087
|
+
case "INSIDE_OBJECT_KEY":
|
|
13088
|
+
case "INSIDE_OBJECT_AFTER_KEY":
|
|
13089
|
+
case "INSIDE_OBJECT_AFTER_COMMA":
|
|
13090
|
+
case "INSIDE_OBJECT_START":
|
|
13091
|
+
case "INSIDE_OBJECT_BEFORE_VALUE":
|
|
13092
|
+
case "INSIDE_OBJECT_AFTER_VALUE": {
|
|
13093
|
+
result += "}";
|
|
13094
|
+
break;
|
|
13095
|
+
}
|
|
13096
|
+
case "INSIDE_ARRAY_START":
|
|
13097
|
+
case "INSIDE_ARRAY_AFTER_COMMA":
|
|
13098
|
+
case "INSIDE_ARRAY_AFTER_VALUE": {
|
|
13099
|
+
result += "]";
|
|
13100
|
+
break;
|
|
13101
|
+
}
|
|
13102
|
+
case "INSIDE_LITERAL": {
|
|
13103
|
+
const partialLiteral = input.substring(literalStart, input.length);
|
|
13104
|
+
if ("true".startsWith(partialLiteral)) {
|
|
13105
|
+
result += "true".slice(partialLiteral.length);
|
|
13106
|
+
} else if ("false".startsWith(partialLiteral)) {
|
|
13107
|
+
result += "false".slice(partialLiteral.length);
|
|
13108
|
+
} else if ("null".startsWith(partialLiteral)) {
|
|
13109
|
+
result += "null".slice(partialLiteral.length);
|
|
13110
|
+
}
|
|
13111
|
+
}
|
|
13112
|
+
}
|
|
13113
|
+
}
|
|
13114
|
+
return result;
|
|
13115
|
+
}
|
|
13116
|
+
async function parsePartialJson3(jsonText) {
|
|
13117
|
+
if (jsonText === void 0) {
|
|
13118
|
+
return { value: void 0, state: "undefined-input" };
|
|
13119
|
+
}
|
|
13120
|
+
let result = await safeParseJSON3({ text: jsonText });
|
|
13121
|
+
if (result.success) {
|
|
13122
|
+
return { value: result.value, state: "successful-parse" };
|
|
13123
|
+
}
|
|
13124
|
+
result = await safeParseJSON3({ text: fixJson3(jsonText) });
|
|
13125
|
+
if (result.success) {
|
|
13126
|
+
return { value: result.value, state: "repaired-parse" };
|
|
13127
|
+
}
|
|
13128
|
+
return { value: void 0, state: "failed-parse" };
|
|
13129
|
+
}
|
|
13130
|
+
createIdGenerator3({
|
|
13131
|
+
prefix: "aitxt",
|
|
13132
|
+
size: 24
|
|
13133
|
+
});
|
|
13134
|
+
createIdGenerator3({ prefix: "aiobj", size: 24 });
|
|
13135
|
+
createIdGenerator3({ prefix: "aiobj", size: 24 });
|
|
13136
|
+
var output_exports3 = {};
|
|
13137
|
+
__export4(output_exports3, {
|
|
13138
|
+
object: () => object3,
|
|
13139
|
+
text: () => text3
|
|
13140
|
+
});
|
|
13141
|
+
var text3 = () => ({
|
|
13142
|
+
type: "text",
|
|
13143
|
+
responseFormat: { type: "text" },
|
|
13144
|
+
async parsePartial({ text: text22 }) {
|
|
13145
|
+
return { partial: text22 };
|
|
13146
|
+
},
|
|
13147
|
+
async parseOutput({ text: text22 }) {
|
|
13148
|
+
return text22;
|
|
13149
|
+
}
|
|
13150
|
+
});
|
|
13151
|
+
var object3 = ({
|
|
13152
|
+
schema: inputSchema
|
|
13153
|
+
}) => {
|
|
13154
|
+
const schema = asSchema3(inputSchema);
|
|
13155
|
+
return {
|
|
13156
|
+
type: "object",
|
|
13157
|
+
responseFormat: {
|
|
13158
|
+
type: "json",
|
|
13159
|
+
schema: schema.jsonSchema
|
|
13160
|
+
},
|
|
13161
|
+
async parsePartial({ text: text22 }) {
|
|
13162
|
+
const result = await parsePartialJson3(text22);
|
|
13163
|
+
switch (result.state) {
|
|
13164
|
+
case "failed-parse":
|
|
13165
|
+
case "undefined-input":
|
|
13166
|
+
return void 0;
|
|
13167
|
+
case "repaired-parse":
|
|
13168
|
+
case "successful-parse":
|
|
13169
|
+
return {
|
|
13170
|
+
// Note: currently no validation of partial results:
|
|
13171
|
+
partial: result.value
|
|
13172
|
+
};
|
|
13173
|
+
default: {
|
|
13174
|
+
const _exhaustiveCheck = result.state;
|
|
13175
|
+
throw new Error(`Unsupported parse state: ${_exhaustiveCheck}`);
|
|
13176
|
+
}
|
|
13177
|
+
}
|
|
13178
|
+
},
|
|
13179
|
+
async parseOutput({ text: text22 }, context) {
|
|
13180
|
+
const parseResult = await safeParseJSON3({ text: text22 });
|
|
13181
|
+
if (!parseResult.success) {
|
|
13182
|
+
throw new NoObjectGeneratedError3({
|
|
13183
|
+
message: "No object generated: could not parse the response.",
|
|
13184
|
+
cause: parseResult.error,
|
|
13185
|
+
text: text22,
|
|
13186
|
+
response: context.response,
|
|
13187
|
+
usage: context.usage,
|
|
13188
|
+
finishReason: context.finishReason
|
|
13189
|
+
});
|
|
13190
|
+
}
|
|
13191
|
+
const validationResult = await safeValidateTypes3({
|
|
13192
|
+
value: parseResult.value,
|
|
13193
|
+
schema
|
|
13194
|
+
});
|
|
13195
|
+
if (!validationResult.success) {
|
|
13196
|
+
throw new NoObjectGeneratedError3({
|
|
13197
|
+
message: "No object generated: response did not match schema.",
|
|
13198
|
+
cause: validationResult.error,
|
|
13199
|
+
text: text22,
|
|
13200
|
+
response: context.response,
|
|
13201
|
+
usage: context.usage,
|
|
13202
|
+
finishReason: context.finishReason
|
|
13203
|
+
});
|
|
13204
|
+
}
|
|
13205
|
+
return validationResult.value;
|
|
13206
|
+
}
|
|
13207
|
+
};
|
|
13208
|
+
};
|
|
13209
|
+
var ClientOrServerImplementationSchema3 = z42.z.looseObject({
|
|
13210
|
+
name: z42.z.string(),
|
|
13211
|
+
version: z42.z.string()
|
|
13212
|
+
});
|
|
13213
|
+
var BaseParamsSchema3 = z42.z.looseObject({
|
|
13214
|
+
_meta: z42.z.optional(z42.z.object({}).loose())
|
|
13215
|
+
});
|
|
13216
|
+
var ResultSchema3 = BaseParamsSchema3;
|
|
13217
|
+
var RequestSchema3 = z42.z.object({
|
|
13218
|
+
method: z42.z.string(),
|
|
13219
|
+
params: z42.z.optional(BaseParamsSchema3)
|
|
13220
|
+
});
|
|
13221
|
+
var ServerCapabilitiesSchema3 = z42.z.looseObject({
|
|
13222
|
+
experimental: z42.z.optional(z42.z.object({}).loose()),
|
|
13223
|
+
logging: z42.z.optional(z42.z.object({}).loose()),
|
|
13224
|
+
prompts: z42.z.optional(
|
|
13225
|
+
z42.z.looseObject({
|
|
13226
|
+
listChanged: z42.z.optional(z42.z.boolean())
|
|
13227
|
+
})
|
|
13228
|
+
),
|
|
13229
|
+
resources: z42.z.optional(
|
|
13230
|
+
z42.z.looseObject({
|
|
13231
|
+
subscribe: z42.z.optional(z42.z.boolean()),
|
|
13232
|
+
listChanged: z42.z.optional(z42.z.boolean())
|
|
13233
|
+
})
|
|
13234
|
+
),
|
|
13235
|
+
tools: z42.z.optional(
|
|
13236
|
+
z42.z.looseObject({
|
|
13237
|
+
listChanged: z42.z.optional(z42.z.boolean())
|
|
13238
|
+
})
|
|
13239
|
+
)
|
|
13240
|
+
});
|
|
13241
|
+
ResultSchema3.extend({
|
|
13242
|
+
protocolVersion: z42.z.string(),
|
|
13243
|
+
capabilities: ServerCapabilitiesSchema3,
|
|
13244
|
+
serverInfo: ClientOrServerImplementationSchema3,
|
|
13245
|
+
instructions: z42.z.optional(z42.z.string())
|
|
13246
|
+
});
|
|
13247
|
+
var PaginatedResultSchema3 = ResultSchema3.extend({
|
|
13248
|
+
nextCursor: z42.z.optional(z42.z.string())
|
|
13249
|
+
});
|
|
13250
|
+
var ToolSchema3 = z42.z.object({
|
|
13251
|
+
name: z42.z.string(),
|
|
13252
|
+
description: z42.z.optional(z42.z.string()),
|
|
13253
|
+
inputSchema: z42.z.object({
|
|
13254
|
+
type: z42.z.literal("object"),
|
|
13255
|
+
properties: z42.z.optional(z42.z.object({}).loose())
|
|
13256
|
+
}).loose()
|
|
13257
|
+
}).loose();
|
|
13258
|
+
PaginatedResultSchema3.extend({
|
|
13259
|
+
tools: z42.z.array(ToolSchema3)
|
|
13260
|
+
});
|
|
13261
|
+
var TextContentSchema3 = z42.z.object({
|
|
13262
|
+
type: z42.z.literal("text"),
|
|
13263
|
+
text: z42.z.string()
|
|
13264
|
+
}).loose();
|
|
13265
|
+
var ImageContentSchema3 = z42.z.object({
|
|
13266
|
+
type: z42.z.literal("image"),
|
|
13267
|
+
data: z42.z.base64(),
|
|
13268
|
+
mimeType: z42.z.string()
|
|
13269
|
+
}).loose();
|
|
13270
|
+
var ResourceContentsSchema3 = z42.z.object({
|
|
13271
|
+
/**
|
|
13272
|
+
* The URI of this resource.
|
|
13273
|
+
*/
|
|
13274
|
+
uri: z42.z.string(),
|
|
13275
|
+
/**
|
|
13276
|
+
* The MIME type of this resource, if known.
|
|
13277
|
+
*/
|
|
13278
|
+
mimeType: z42.z.optional(z42.z.string())
|
|
13279
|
+
}).loose();
|
|
13280
|
+
var TextResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13281
|
+
text: z42.z.string()
|
|
13282
|
+
});
|
|
13283
|
+
var BlobResourceContentsSchema3 = ResourceContentsSchema3.extend({
|
|
13284
|
+
blob: z42.z.base64()
|
|
13285
|
+
});
|
|
13286
|
+
var EmbeddedResourceSchema3 = z42.z.object({
|
|
13287
|
+
type: z42.z.literal("resource"),
|
|
13288
|
+
resource: z42.z.union([TextResourceContentsSchema3, BlobResourceContentsSchema3])
|
|
13289
|
+
}).loose();
|
|
13290
|
+
ResultSchema3.extend({
|
|
13291
|
+
content: z42.z.array(
|
|
13292
|
+
z42.z.union([TextContentSchema3, ImageContentSchema3, EmbeddedResourceSchema3])
|
|
13293
|
+
),
|
|
13294
|
+
isError: z42.z.boolean().default(false).optional()
|
|
13295
|
+
}).or(
|
|
13296
|
+
ResultSchema3.extend({
|
|
13297
|
+
toolResult: z42.z.unknown()
|
|
13298
|
+
})
|
|
13299
|
+
);
|
|
13300
|
+
var JSONRPC_VERSION3 = "2.0";
|
|
13301
|
+
var JSONRPCRequestSchema3 = z42.z.object({
|
|
13302
|
+
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13303
|
+
id: z42.z.union([z42.z.string(), z42.z.number().int()])
|
|
13304
|
+
}).merge(RequestSchema3).strict();
|
|
13305
|
+
var JSONRPCResponseSchema3 = z42.z.object({
|
|
13306
|
+
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13307
|
+
id: z42.z.union([z42.z.string(), z42.z.number().int()]),
|
|
13308
|
+
result: ResultSchema3
|
|
13309
|
+
}).strict();
|
|
13310
|
+
var JSONRPCErrorSchema3 = z42.z.object({
|
|
13311
|
+
jsonrpc: z42.z.literal(JSONRPC_VERSION3),
|
|
13312
|
+
id: z42.z.union([z42.z.string(), z42.z.number().int()]),
|
|
13313
|
+
error: z42.z.object({
|
|
13314
|
+
code: z42.z.number().int(),
|
|
13315
|
+
message: z42.z.string(),
|
|
13316
|
+
data: z42.z.optional(z42.z.unknown())
|
|
13317
|
+
})
|
|
13318
|
+
}).strict();
|
|
13319
|
+
var JSONRPCNotificationSchema3 = z42.z.object({
|
|
13320
|
+
jsonrpc: z42.z.literal(JSONRPC_VERSION3)
|
|
13321
|
+
}).merge(
|
|
13322
|
+
z42.z.object({
|
|
13323
|
+
method: z42.z.string(),
|
|
13324
|
+
params: z42.z.optional(BaseParamsSchema3)
|
|
13325
|
+
})
|
|
13326
|
+
).strict();
|
|
13327
|
+
z42.z.union([
|
|
13328
|
+
JSONRPCRequestSchema3,
|
|
13329
|
+
JSONRPCNotificationSchema3,
|
|
13330
|
+
JSONRPCResponseSchema3,
|
|
13331
|
+
JSONRPCErrorSchema3
|
|
13332
|
+
]);
|
|
13333
|
+
|
|
13334
|
+
// ../agent-builder/dist/index.js
|
|
11336
13335
|
var UNIT_KINDS = ["mcp-server", "tool", "workflow", "agent", "integration", "network", "other"];
|
|
11337
13336
|
var TemplateUnitSchema = zod.z.object({
|
|
11338
13337
|
kind: zod.z.enum(UNIT_KINDS),
|
|
@@ -13505,14 +15504,14 @@ export const mastra = new Mastra({
|
|
|
13505
15504
|
noEmit: true
|
|
13506
15505
|
};
|
|
13507
15506
|
const host = {
|
|
13508
|
-
getSourceFile: (
|
|
15507
|
+
getSourceFile: (name21) => name21 === fileName ? sourceFile : void 0,
|
|
13509
15508
|
writeFile: () => {
|
|
13510
15509
|
},
|
|
13511
15510
|
getCurrentDirectory: () => "",
|
|
13512
15511
|
getDirectories: () => [],
|
|
13513
|
-
fileExists: (
|
|
13514
|
-
readFile: (
|
|
13515
|
-
getCanonicalFileName: (
|
|
15512
|
+
fileExists: (name21) => name21 === fileName,
|
|
15513
|
+
readFile: (name21) => name21 === fileName ? fileContent : void 0,
|
|
15514
|
+
getCanonicalFileName: (name21) => name21,
|
|
13516
15515
|
useCaseSensitiveFileNames: () => true,
|
|
13517
15516
|
getNewLine: () => "\n",
|
|
13518
15517
|
getDefaultLibFileName: () => "lib.d.ts"
|
|
@@ -14894,25 +16893,25 @@ var packageMergeStep = workflows.createStep({
|
|
|
14894
16893
|
const tplDevDeps = ensureObj(packageInfo.devDependencies);
|
|
14895
16894
|
const tplPeerDeps = ensureObj(packageInfo.peerDependencies);
|
|
14896
16895
|
const tplScripts = ensureObj(packageInfo.scripts);
|
|
14897
|
-
const existsAnywhere = (
|
|
14898
|
-
for (const [
|
|
14899
|
-
if (!existsAnywhere(
|
|
14900
|
-
targetPkg.dependencies[
|
|
16896
|
+
const existsAnywhere = (name21) => name21 in targetPkg.dependencies || name21 in targetPkg.devDependencies || name21 in targetPkg.peerDependencies;
|
|
16897
|
+
for (const [name21, ver] of Object.entries(tplDeps)) {
|
|
16898
|
+
if (!existsAnywhere(name21)) {
|
|
16899
|
+
targetPkg.dependencies[name21] = String(ver);
|
|
14901
16900
|
}
|
|
14902
16901
|
}
|
|
14903
|
-
for (const [
|
|
14904
|
-
if (!existsAnywhere(
|
|
14905
|
-
targetPkg.devDependencies[
|
|
16902
|
+
for (const [name21, ver] of Object.entries(tplDevDeps)) {
|
|
16903
|
+
if (!existsAnywhere(name21)) {
|
|
16904
|
+
targetPkg.devDependencies[name21] = String(ver);
|
|
14906
16905
|
}
|
|
14907
16906
|
}
|
|
14908
|
-
for (const [
|
|
14909
|
-
if (!(
|
|
14910
|
-
targetPkg.peerDependencies[
|
|
16907
|
+
for (const [name21, ver] of Object.entries(tplPeerDeps)) {
|
|
16908
|
+
if (!(name21 in targetPkg.peerDependencies)) {
|
|
16909
|
+
targetPkg.peerDependencies[name21] = String(ver);
|
|
14911
16910
|
}
|
|
14912
16911
|
}
|
|
14913
16912
|
const prefix = `template:${slug}:`;
|
|
14914
|
-
for (const [
|
|
14915
|
-
const newKey = `${prefix}${
|
|
16913
|
+
for (const [name21, cmd] of Object.entries(tplScripts)) {
|
|
16914
|
+
const newKey = `${prefix}${name21}`;
|
|
14916
16915
|
if (!(newKey in targetPkg.scripts)) {
|
|
14917
16916
|
targetPkg.scripts[newKey] = String(cmd);
|
|
14918
16917
|
}
|
|
@@ -14997,9 +16996,9 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
14997
16996
|
return "unknown";
|
|
14998
16997
|
}
|
|
14999
16998
|
};
|
|
15000
|
-
const convertNaming = (
|
|
15001
|
-
const baseName = path.basename(
|
|
15002
|
-
const ext = path.extname(
|
|
16999
|
+
const convertNaming = (name21, convention) => {
|
|
17000
|
+
const baseName = path.basename(name21, path.extname(name21));
|
|
17001
|
+
const ext = path.extname(name21);
|
|
15003
17002
|
switch (convention) {
|
|
15004
17003
|
case "camelCase":
|
|
15005
17004
|
return baseName.replace(/[-_]/g, "").replace(/([A-Z])/g, (match, p1, offset) => offset === 0 ? p1.toLowerCase() : p1) + ext;
|
|
@@ -15010,7 +17009,7 @@ var programmaticFileCopyStep = workflows.createStep({
|
|
|
15010
17009
|
case "PascalCase":
|
|
15011
17010
|
return baseName.replace(/[-_]/g, "").replace(/^[a-z]/, (match) => match.toUpperCase()) + ext;
|
|
15012
17011
|
default:
|
|
15013
|
-
return
|
|
17012
|
+
return name21;
|
|
15014
17013
|
}
|
|
15015
17014
|
};
|
|
15016
17015
|
for (const unit of orderedUnits) {
|
|
@@ -17441,59 +19440,59 @@ var getAgentBuilderActionsHandler = createAgentBuilderWorkflowHandler(async () =
|
|
|
17441
19440
|
}
|
|
17442
19441
|
}, "Getting agent builder actions");
|
|
17443
19442
|
var getAgentBuilderActionByIdHandler = createAgentBuilderWorkflowHandler(
|
|
17444
|
-
|
|
19443
|
+
chunkRJX63KSA_cjs.getWorkflowByIdHandler,
|
|
17445
19444
|
"Getting agent builder action by ID"
|
|
17446
19445
|
);
|
|
17447
19446
|
var getAgentBuilderActionRunByIdHandler = createAgentBuilderWorkflowHandler(
|
|
17448
|
-
|
|
19447
|
+
chunkRJX63KSA_cjs.getWorkflowRunByIdHandler,
|
|
17449
19448
|
"Getting agent builder action run by ID"
|
|
17450
19449
|
);
|
|
17451
19450
|
var getAgentBuilderActionRunExecutionResultHandler = createAgentBuilderWorkflowHandler(
|
|
17452
|
-
|
|
19451
|
+
chunkRJX63KSA_cjs.getWorkflowRunExecutionResultHandler,
|
|
17453
19452
|
"Getting agent builder action run execution result"
|
|
17454
19453
|
);
|
|
17455
19454
|
var createAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
17456
|
-
|
|
19455
|
+
chunkRJX63KSA_cjs.createWorkflowRunHandler,
|
|
17457
19456
|
"Creating agent builder action run"
|
|
17458
19457
|
);
|
|
17459
19458
|
var startAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17460
|
-
|
|
19459
|
+
chunkRJX63KSA_cjs.startAsyncWorkflowHandler,
|
|
17461
19460
|
"Starting async agent builder action"
|
|
17462
19461
|
);
|
|
17463
19462
|
var startAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
17464
|
-
|
|
19463
|
+
chunkRJX63KSA_cjs.startWorkflowRunHandler,
|
|
17465
19464
|
"Starting agent builder action run"
|
|
17466
19465
|
);
|
|
17467
19466
|
var watchAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17468
|
-
|
|
19467
|
+
chunkRJX63KSA_cjs.watchWorkflowHandler,
|
|
17469
19468
|
"Watching agent builder action"
|
|
17470
19469
|
);
|
|
17471
19470
|
var streamAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17472
|
-
|
|
19471
|
+
chunkRJX63KSA_cjs.streamLegacyWorkflowHandler,
|
|
17473
19472
|
"Streaming agent builder action"
|
|
17474
19473
|
);
|
|
17475
19474
|
var streamVNextAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17476
|
-
|
|
19475
|
+
chunkRJX63KSA_cjs.streamVNextWorkflowHandler,
|
|
17477
19476
|
"Streaming VNext agent builder action"
|
|
17478
19477
|
);
|
|
17479
19478
|
var resumeAsyncAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17480
|
-
|
|
19479
|
+
chunkRJX63KSA_cjs.resumeAsyncWorkflowHandler,
|
|
17481
19480
|
"Resuming async agent builder action"
|
|
17482
19481
|
);
|
|
17483
19482
|
var resumeAgentBuilderActionHandler = createAgentBuilderWorkflowHandler(
|
|
17484
|
-
|
|
19483
|
+
chunkRJX63KSA_cjs.resumeWorkflowHandler,
|
|
17485
19484
|
"Resuming agent builder action"
|
|
17486
19485
|
);
|
|
17487
19486
|
var getAgentBuilderActionRunsHandler = createAgentBuilderWorkflowHandler(
|
|
17488
|
-
|
|
19487
|
+
chunkRJX63KSA_cjs.getWorkflowRunsHandler,
|
|
17489
19488
|
"Getting agent builder action runs"
|
|
17490
19489
|
);
|
|
17491
19490
|
var cancelAgentBuilderActionRunHandler = createAgentBuilderWorkflowHandler(
|
|
17492
|
-
|
|
19491
|
+
chunkRJX63KSA_cjs.cancelWorkflowRunHandler,
|
|
17493
19492
|
"Cancelling agent builder action run"
|
|
17494
19493
|
);
|
|
17495
19494
|
var sendAgentBuilderActionRunEventHandler = createAgentBuilderWorkflowHandler(
|
|
17496
|
-
|
|
19495
|
+
chunkRJX63KSA_cjs.sendWorkflowRunEventHandler,
|
|
17497
19496
|
"Sending agent builder action run event"
|
|
17498
19497
|
);
|
|
17499
19498
|
|
|
@@ -17513,5 +19512,5 @@ exports.startAsyncAgentBuilderActionHandler = startAsyncAgentBuilderActionHandle
|
|
|
17513
19512
|
exports.streamAgentBuilderActionHandler = streamAgentBuilderActionHandler;
|
|
17514
19513
|
exports.streamVNextAgentBuilderActionHandler = streamVNextAgentBuilderActionHandler;
|
|
17515
19514
|
exports.watchAgentBuilderActionHandler = watchAgentBuilderActionHandler;
|
|
17516
|
-
//# sourceMappingURL=chunk-
|
|
17517
|
-
//# sourceMappingURL=chunk-
|
|
19515
|
+
//# sourceMappingURL=chunk-YKENCZQ2.cjs.map
|
|
19516
|
+
//# sourceMappingURL=chunk-YKENCZQ2.cjs.map
|