@mastra/server 0.0.0-support-d1-client-20250701191943 → 0.0.0-suspendRuntimeContextTypeFix-20250930142630
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 +3812 -0
- package/LICENSE.md +11 -42
- package/README.md +0 -5
- package/dist/{chunk-H5PTF3Y4.js → chunk-4QCXUEAT.js} +11 -2
- package/dist/chunk-4QCXUEAT.js.map +1 -0
- package/dist/chunk-4RRMWXQ2.js +3522 -0
- package/dist/chunk-4RRMWXQ2.js.map +1 -0
- package/dist/chunk-52UP7DFT.cjs +130 -0
- package/dist/chunk-52UP7DFT.cjs.map +1 -0
- package/dist/chunk-5DP5XZH6.cjs +928 -0
- package/dist/chunk-5DP5XZH6.cjs.map +1 -0
- package/dist/chunk-66YYHFGF.js +761 -0
- package/dist/chunk-66YYHFGF.js.map +1 -0
- package/dist/chunk-6GMFZ5LK.js +2774 -0
- package/dist/chunk-6GMFZ5LK.js.map +1 -0
- package/dist/{chunk-GHC4YV6R.js → chunk-6IJWRJZE.js} +109 -136
- package/dist/chunk-6IJWRJZE.js.map +1 -0
- package/dist/chunk-743UIDHI.cjs +2013 -0
- package/dist/chunk-743UIDHI.cjs.map +1 -0
- package/dist/chunk-7ESQBAXS.cjs +18023 -0
- package/dist/chunk-7ESQBAXS.cjs.map +1 -0
- package/dist/{chunk-OCWPVYNI.cjs → chunk-7NADHFD2.cjs} +3 -0
- package/dist/chunk-7NADHFD2.cjs.map +1 -0
- package/dist/{chunk-BOXE6WSV.js → chunk-A3AL7EWJ.js} +5 -3
- package/dist/chunk-A3AL7EWJ.js.map +1 -0
- package/dist/chunk-AK2FXLLB.cjs +849 -0
- package/dist/chunk-AK2FXLLB.cjs.map +1 -0
- package/dist/chunk-BKCWZLEL.cjs +197 -0
- package/dist/chunk-BKCWZLEL.cjs.map +1 -0
- package/dist/chunk-BOVFMBXY.js +607 -0
- package/dist/chunk-BOVFMBXY.js.map +1 -0
- package/dist/{chunk-QDOJJCS4.js → chunk-CY4TP3FK.js} +6 -2
- package/dist/chunk-CY4TP3FK.js.map +1 -0
- package/dist/chunk-EMMSS5I5.cjs +37 -0
- package/dist/chunk-EMMSS5I5.cjs.map +1 -0
- package/dist/chunk-EMNGA4R4.js +845 -0
- package/dist/chunk-EMNGA4R4.js.map +1 -0
- package/dist/chunk-FALVL2VV.cjs +3525 -0
- package/dist/chunk-FALVL2VV.cjs.map +1 -0
- package/dist/chunk-FQNT7PI4.js +937 -0
- package/dist/chunk-FQNT7PI4.js.map +1 -0
- package/dist/chunk-G3PMV62Z.js +33 -0
- package/dist/chunk-G3PMV62Z.js.map +1 -0
- package/dist/chunk-G4PUALCE.cjs +28 -0
- package/dist/chunk-G4PUALCE.cjs.map +1 -0
- package/dist/chunk-GU4EWMZB.cjs +769 -0
- package/dist/chunk-GU4EWMZB.cjs.map +1 -0
- package/dist/chunk-HJQKWRKQ.cjs +764 -0
- package/dist/chunk-HJQKWRKQ.cjs.map +1 -0
- package/dist/{chunk-LI436ITD.cjs → chunk-HVBBFCDH.cjs} +1041 -762
- package/dist/chunk-HVBBFCDH.cjs.map +1 -0
- package/dist/chunk-HZJRQ5L3.cjs +1411 -0
- package/dist/chunk-HZJRQ5L3.cjs.map +1 -0
- package/dist/chunk-IGFMAZZ5.cjs +1150 -0
- package/dist/chunk-IGFMAZZ5.cjs.map +1 -0
- package/dist/chunk-IOQGI4ML.js +931 -0
- package/dist/chunk-IOQGI4ML.js.map +1 -0
- package/dist/chunk-JQ74G5IO.js +17987 -0
- package/dist/chunk-JQ74G5IO.js.map +1 -0
- package/dist/{chunk-G37NVEDX.js → chunk-JRDEOHAJ.js} +23 -13
- package/dist/chunk-JRDEOHAJ.js.map +1 -0
- package/dist/chunk-JSMP6GVP.cjs +595 -0
- package/dist/chunk-JSMP6GVP.cjs.map +1 -0
- package/dist/{chunk-DFJUGWNU.js → chunk-KM7EJKXV.js} +50 -12
- package/dist/chunk-KM7EJKXV.js.map +1 -0
- package/dist/{chunk-TGZIR6AK.cjs → chunk-KNGXRN26.cjs} +48 -45
- package/dist/chunk-KNGXRN26.cjs.map +1 -0
- package/dist/{chunk-BP24Z4WG.js → chunk-KV6VHX4V.js} +24 -5
- package/dist/chunk-KV6VHX4V.js.map +1 -0
- package/dist/chunk-LF2ZLOFP.js +767 -0
- package/dist/chunk-LF2ZLOFP.js.map +1 -0
- package/dist/chunk-LJFAAEU7.cjs +167 -0
- package/dist/chunk-LJFAAEU7.cjs.map +1 -0
- package/dist/chunk-LYPU75T6.js +1147 -0
- package/dist/chunk-LYPU75T6.js.map +1 -0
- package/dist/{chunk-NYN7KFXL.js → chunk-MMROOK5J.js} +3 -0
- package/dist/chunk-MMROOK5J.js.map +1 -0
- package/dist/{chunk-MEGCYGBU.js → chunk-N7F33WAD.js} +1013 -762
- package/dist/chunk-N7F33WAD.js.map +1 -0
- package/dist/chunk-NG5IVLEZ.js +1012 -0
- package/dist/chunk-NG5IVLEZ.js.map +1 -0
- package/dist/chunk-NLWACBE7.cjs +128 -0
- package/dist/chunk-NLWACBE7.cjs.map +1 -0
- package/dist/chunk-OGW6HHVI.js +1408 -0
- package/dist/chunk-OGW6HHVI.js.map +1 -0
- package/dist/{chunk-SDPGVWQJ.cjs → chunk-OPI3FZYH.cjs} +110 -137
- package/dist/chunk-OPI3FZYH.cjs.map +1 -0
- package/dist/chunk-OZLRIVC4.cjs +588 -0
- package/dist/chunk-OZLRIVC4.cjs.map +1 -0
- package/dist/chunk-P7CIEIJ3.js +925 -0
- package/dist/chunk-P7CIEIJ3.js.map +1 -0
- package/dist/chunk-P7RBMCBE.cjs +934 -0
- package/dist/chunk-P7RBMCBE.cjs.map +1 -0
- package/dist/chunk-PPYGWINI.cjs +2777 -0
- package/dist/chunk-PPYGWINI.cjs.map +1 -0
- package/dist/{chunk-ULFULEW4.cjs → chunk-PWTXZZTR.cjs} +28 -8
- package/dist/chunk-PWTXZZTR.cjs.map +1 -0
- package/dist/chunk-RCHEPTZZ.js +2006 -0
- package/dist/chunk-RCHEPTZZ.js.map +1 -0
- package/dist/chunk-RE4RPXT2.cjs +18 -0
- package/dist/chunk-RE4RPXT2.cjs.map +1 -0
- package/dist/chunk-SIGXR3JT.cjs +1043 -0
- package/dist/chunk-SIGXR3JT.cjs.map +1 -0
- package/dist/{chunk-CNVDCLSY.cjs → chunk-SPLSYTYW.cjs} +11 -9
- package/dist/chunk-SPLSYTYW.cjs.map +1 -0
- package/dist/chunk-SQY4T6EJ.js +571 -0
- package/dist/chunk-SQY4T6EJ.js.map +1 -0
- package/dist/chunk-SXENNNR7.cjs +625 -0
- package/dist/chunk-SXENNNR7.cjs.map +1 -0
- package/dist/{chunk-TVBPFPTN.cjs → chunk-T3TIA3O6.cjs} +20 -18
- package/dist/chunk-T3TIA3O6.cjs.map +1 -0
- package/dist/{chunk-7GQJAMTA.js → chunk-TTHEEIZ3.js} +13 -10
- package/dist/chunk-TTHEEIZ3.js.map +1 -0
- package/dist/chunk-TVSIG4JE.cjs +940 -0
- package/dist/chunk-TVSIG4JE.cjs.map +1 -0
- package/dist/chunk-VY4ENABS.cjs +135 -0
- package/dist/chunk-VY4ENABS.cjs.map +1 -0
- package/dist/{chunk-FVMGZKFD.js → chunk-WHN4VX55.js} +5 -3
- package/dist/chunk-WHN4VX55.js.map +1 -0
- package/dist/chunk-WUJLVNLU.js +124 -0
- package/dist/chunk-WUJLVNLU.js.map +1 -0
- package/dist/chunk-XJOYGRTN.js +189 -0
- package/dist/chunk-XJOYGRTN.js.map +1 -0
- package/dist/chunk-YWOK4F5A.js +131 -0
- package/dist/chunk-YWOK4F5A.js.map +1 -0
- package/dist/{chunk-Z5TH5F35.js → chunk-ZAYTLC6C.js} +188 -80
- package/dist/chunk-ZAYTLC6C.js.map +1 -0
- package/dist/dist-26HWEQY6.js +3 -0
- package/dist/dist-26HWEQY6.js.map +1 -0
- package/dist/dist-3A5DXB37.cjs +20 -0
- package/dist/dist-3A5DXB37.cjs.map +1 -0
- package/dist/dist-3SJKQJGY.cjs +16 -0
- package/dist/dist-3SJKQJGY.cjs.map +1 -0
- package/dist/dist-4ZQSPE5K.js +3 -0
- package/dist/dist-4ZQSPE5K.js.map +1 -0
- package/dist/dist-5W5QNRTD.js +3 -0
- package/dist/dist-5W5QNRTD.js.map +1 -0
- package/dist/dist-653SRMPL.js +3 -0
- package/dist/dist-653SRMPL.js.map +1 -0
- package/dist/dist-6U6EFC5C.cjs +16 -0
- package/dist/dist-6U6EFC5C.cjs.map +1 -0
- package/dist/dist-7IHNNYMF.cjs +16 -0
- package/dist/dist-7IHNNYMF.cjs.map +1 -0
- package/dist/dist-B5IPRF6W.js +3 -0
- package/dist/dist-B5IPRF6W.js.map +1 -0
- package/dist/dist-EOMYFT4Y.cjs +16 -0
- package/dist/dist-EOMYFT4Y.cjs.map +1 -0
- package/dist/dist-EZZMMMNT.cjs +16 -0
- package/dist/dist-EZZMMMNT.cjs.map +1 -0
- package/dist/dist-F2ET4MNO.cjs +16 -0
- package/dist/dist-F2ET4MNO.cjs.map +1 -0
- package/dist/dist-H64VX6DE.js +3 -0
- package/dist/dist-H64VX6DE.js.map +1 -0
- package/dist/dist-HY7RMLJQ.cjs +16 -0
- package/dist/dist-HY7RMLJQ.cjs.map +1 -0
- package/dist/dist-M6S4P3FJ.js +3 -0
- package/dist/dist-M6S4P3FJ.js.map +1 -0
- package/dist/dist-NR7QSCQT.js +3 -0
- package/dist/dist-NR7QSCQT.js.map +1 -0
- package/dist/dist-QLFMCMCX.js +3 -0
- package/dist/dist-QLFMCMCX.js.map +1 -0
- package/dist/dist-UY46BFRP.js +3 -0
- package/dist/dist-UY46BFRP.js.map +1 -0
- package/dist/dist-WCQDRTIV.cjs +16 -0
- package/dist/dist-WCQDRTIV.cjs.map +1 -0
- package/dist/dist-WKYB3LTJ.cjs +16 -0
- package/dist/dist-WKYB3LTJ.cjs.map +1 -0
- package/dist/index.cjs +6 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server/a2a/protocol.d.ts +8 -0
- package/dist/server/a2a/protocol.d.ts.map +1 -0
- package/dist/server/a2a/store.cjs +25 -0
- package/dist/server/a2a/store.cjs.map +1 -0
- package/dist/server/a2a/store.d.ts +14 -0
- package/dist/server/a2a/store.d.ts.map +1 -0
- package/dist/server/a2a/store.js +23 -0
- package/dist/server/a2a/store.js.map +1 -0
- package/dist/server/a2a/tasks.d.ts +20 -0
- package/dist/server/a2a/tasks.d.ts.map +1 -0
- package/dist/server/handlers/a2a.cjs +13 -11
- package/dist/server/handlers/a2a.cjs.map +1 -0
- package/dist/server/handlers/a2a.d.ts +68 -6
- package/dist/server/handlers/a2a.d.ts.map +1 -0
- package/dist/server/handlers/a2a.js +3 -1
- package/dist/server/handlers/a2a.js.map +1 -0
- package/dist/server/handlers/agent-builder.cjs +68 -0
- package/dist/server/handlers/agent-builder.cjs.map +1 -0
- package/dist/server/handlers/agent-builder.d.ts +92 -0
- package/dist/server/handlers/agent-builder.d.ts.map +1 -0
- package/dist/server/handlers/agent-builder.js +3 -0
- package/dist/server/handlers/agent-builder.js.map +1 -0
- package/dist/server/handlers/agents.cjs +49 -7
- package/dist/server/handlers/agents.cjs.map +1 -0
- package/dist/server/handlers/agents.d.ts +185 -6
- package/dist/server/handlers/agents.d.ts.map +1 -0
- package/dist/server/handlers/agents.js +3 -1
- package/dist/server/handlers/agents.js.map +1 -0
- package/dist/server/handlers/error.cjs +4 -2
- package/dist/server/handlers/error.cjs.map +1 -0
- package/dist/server/handlers/error.d.ts +2 -1
- package/dist/server/handlers/error.d.ts.map +1 -0
- package/dist/server/handlers/error.js +3 -1
- package/dist/server/handlers/error.js.map +1 -0
- package/dist/server/handlers/legacyWorkflows.cjs +13 -11
- package/dist/server/handlers/legacyWorkflows.cjs.map +1 -0
- package/dist/server/handlers/legacyWorkflows.d.ts +59 -10
- package/dist/server/handlers/legacyWorkflows.d.ts.map +1 -0
- package/dist/server/handlers/legacyWorkflows.js +3 -1
- package/dist/server/handlers/legacyWorkflows.js.map +1 -0
- package/dist/server/handlers/logs.cjs +6 -4
- package/dist/server/handlers/logs.cjs.map +1 -0
- package/dist/server/handlers/logs.d.ts +34 -3
- package/dist/server/handlers/logs.d.ts.map +1 -0
- package/dist/server/handlers/logs.js +3 -1
- package/dist/server/handlers/logs.js.map +1 -0
- package/dist/server/handlers/memory.cjs +39 -9
- package/dist/server/handlers/memory.cjs.map +1 -0
- package/dist/server/handlers/memory.d.ts +118 -8
- package/dist/server/handlers/memory.d.ts.map +1 -0
- package/dist/server/handlers/memory.js +3 -1
- package/dist/server/handlers/memory.js.map +1 -0
- package/dist/server/handlers/observability.cjs +24 -0
- package/dist/server/handlers/observability.cjs.map +1 -0
- package/dist/server/handlers/observability.d.ts +49 -0
- package/dist/server/handlers/observability.d.ts.map +1 -0
- package/dist/server/handlers/observability.js +3 -0
- package/dist/server/handlers/observability.js.map +1 -0
- package/dist/server/handlers/scores.cjs +32 -0
- package/dist/server/handlers/scores.cjs.map +1 -0
- package/dist/server/handlers/scores.d.ts +251 -0
- package/dist/server/handlers/scores.d.ts.map +1 -0
- package/dist/server/handlers/scores.js +3 -0
- package/dist/server/handlers/scores.js.map +1 -0
- package/dist/server/handlers/telemetry.cjs +9 -3
- package/dist/server/handlers/telemetry.cjs.map +1 -0
- package/dist/server/handlers/telemetry.d.ts +33 -2
- package/dist/server/handlers/telemetry.d.ts.map +1 -0
- package/dist/server/handlers/telemetry.js +3 -1
- package/dist/server/handlers/telemetry.js.map +1 -0
- package/dist/server/handlers/tools.cjs +11 -5
- package/dist/server/handlers/tools.cjs.map +1 -0
- package/dist/server/handlers/tools.d.ts +25 -4
- package/dist/server/handlers/tools.d.ts.map +1 -0
- package/dist/server/handlers/tools.js +3 -1
- package/dist/server/handlers/tools.js.map +1 -0
- package/dist/server/handlers/utils.cjs +8 -2
- package/dist/server/handlers/utils.cjs.map +1 -0
- package/dist/server/handlers/utils.d.ts +8 -1
- package/dist/server/handlers/utils.d.ts.map +1 -0
- package/dist/server/handlers/utils.js +3 -1
- package/dist/server/handlers/utils.js.map +1 -0
- package/dist/server/handlers/vNextNetwork.cjs +26 -24
- package/dist/server/handlers/vNextNetwork.cjs.map +1 -0
- package/dist/server/handlers/vNextNetwork.d.ts +246 -6
- package/dist/server/handlers/vNextNetwork.d.ts.map +1 -0
- package/dist/server/handlers/vNextNetwork.js +11 -9
- package/dist/server/handlers/vNextNetwork.js.map +1 -0
- package/dist/server/handlers/vector.cjs +9 -7
- package/dist/server/handlers/vector.cjs.map +1 -0
- package/dist/server/handlers/vector.d.ts +51 -6
- package/dist/server/handlers/vector.d.ts.map +1 -0
- package/dist/server/handlers/vector.js +3 -1
- package/dist/server/handlers/vector.js.map +1 -0
- package/dist/server/handlers/voice.cjs +7 -5
- package/dist/server/handlers/voice.cjs.map +1 -0
- package/dist/server/handlers/voice.d.ts +41 -4
- package/dist/server/handlers/voice.d.ts.map +1 -0
- package/dist/server/handlers/voice.js +3 -1
- package/dist/server/handlers/voice.js.map +1 -0
- package/dist/server/handlers/workflows.cjs +32 -14
- package/dist/server/handlers/workflows.cjs.map +1 -0
- package/dist/server/handlers/workflows.d.ts +87 -13
- package/dist/server/handlers/workflows.d.ts.map +1 -0
- package/dist/server/handlers/workflows.js +3 -1
- package/dist/server/handlers/workflows.js.map +1 -0
- package/dist/server/handlers.cjs +44 -32
- package/dist/server/handlers.cjs.map +1 -0
- package/dist/server/handlers.d.ts +14 -11
- package/dist/server/handlers.d.ts.map +1 -0
- package/dist/server/handlers.js +15 -11
- package/dist/server/handlers.js.map +1 -0
- package/dist/server/http-exception.d.ts +87 -0
- package/dist/server/http-exception.d.ts.map +1 -0
- package/dist/server/types.d.ts +10 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server/utils.d.ts +44 -0
- package/dist/server/utils.d.ts.map +1 -0
- package/package.json +46 -15
- package/dist/_tsup-dts-rollup.d.cts +0 -1068
- package/dist/_tsup-dts-rollup.d.ts +0 -1068
- package/dist/chunk-3DKDT264.cjs +0 -251
- package/dist/chunk-4QBIUKVY.js +0 -270
- package/dist/chunk-57CJTIPW.cjs +0 -18
- package/dist/chunk-7524QH7G.cjs +0 -483
- package/dist/chunk-75ZPJI57.cjs +0 -9
- package/dist/chunk-BWHGBV3K.cjs +0 -278
- package/dist/chunk-DPRB3R7Y.cjs +0 -148
- package/dist/chunk-FGGMQCPP.cjs +0 -128
- package/dist/chunk-L3N7ST2Z.cjs +0 -118
- package/dist/chunk-LTJNMM2Y.js +0 -241
- package/dist/chunk-MLKGABMK.js +0 -7
- package/dist/chunk-MTR2B27E.cjs +0 -14
- package/dist/chunk-VMXLEF54.js +0 -142
- package/dist/index.d.cts +0 -1
- package/dist/server/handlers/a2a.d.cts +0 -6
- package/dist/server/handlers/agents.d.cts +0 -6
- package/dist/server/handlers/error.d.cts +0 -1
- package/dist/server/handlers/legacyWorkflows.d.cts +0 -10
- package/dist/server/handlers/logs.d.cts +0 -3
- package/dist/server/handlers/memory.d.cts +0 -8
- package/dist/server/handlers/network.cjs +0 -22
- package/dist/server/handlers/network.d.cts +0 -4
- package/dist/server/handlers/network.d.ts +0 -4
- package/dist/server/handlers/network.js +0 -1
- package/dist/server/handlers/telemetry.d.cts +0 -2
- package/dist/server/handlers/tools.d.cts +0 -4
- package/dist/server/handlers/utils.d.cts +0 -1
- package/dist/server/handlers/vNextNetwork.d.cts +0 -6
- package/dist/server/handlers/vector.d.cts +0 -6
- package/dist/server/handlers/voice.d.cts +0 -4
- package/dist/server/handlers/workflows.d.cts +0 -13
- package/dist/server/handlers.d.cts +0 -11
|
@@ -1,770 +1,422 @@
|
|
|
1
1
|
import { ZodFirstPartyTypeKind } from 'zod';
|
|
2
2
|
|
|
3
|
-
// ../../node_modules/.pnpm
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider@2.0.0/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
4
|
+
var marker = "vercel.ai.error";
|
|
5
|
+
var symbol = Symbol.for(marker);
|
|
6
|
+
var _a;
|
|
7
|
+
var _AISDKError = class _AISDKError2 extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* Creates an AI SDK Error.
|
|
10
|
+
*
|
|
11
|
+
* @param {Object} params - The parameters for creating the error.
|
|
12
|
+
* @param {string} params.name - The name of the error.
|
|
13
|
+
* @param {string} params.message - The error message.
|
|
14
|
+
* @param {unknown} [params.cause] - The underlying cause of the error.
|
|
15
|
+
*/
|
|
16
|
+
constructor({
|
|
17
|
+
name: name14,
|
|
18
|
+
message,
|
|
19
|
+
cause
|
|
20
|
+
}) {
|
|
21
|
+
super(message);
|
|
22
|
+
this[_a] = true;
|
|
23
|
+
this.name = name14;
|
|
24
|
+
this.cause = cause;
|
|
15
25
|
}
|
|
16
|
-
|
|
17
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the given error is an AI SDK Error.
|
|
28
|
+
* @param {unknown} error - The error to check.
|
|
29
|
+
* @returns {boolean} True if the error is an AI SDK Error, false otherwise.
|
|
30
|
+
*/
|
|
31
|
+
static isInstance(error) {
|
|
32
|
+
return _AISDKError2.hasMarker(error, marker);
|
|
18
33
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
34
|
+
static hasMarker(error, marker15) {
|
|
35
|
+
const markerSymbol = Symbol.for(marker15);
|
|
36
|
+
return error != null && typeof error === "object" && markerSymbol in error && typeof error[markerSymbol] === "boolean" && error[markerSymbol] === true;
|
|
22
37
|
}
|
|
23
38
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
39
|
+
_a = symbol;
|
|
40
|
+
var AISDKError = _AISDKError;
|
|
41
|
+
var name = "AI_APICallError";
|
|
42
|
+
var marker2 = `vercel.ai.error.${name}`;
|
|
43
|
+
var symbol2 = Symbol.for(marker2);
|
|
44
|
+
var _a2;
|
|
45
|
+
var APICallError = class extends AISDKError {
|
|
46
|
+
constructor({
|
|
47
|
+
message,
|
|
48
|
+
url,
|
|
49
|
+
requestBodyValues,
|
|
50
|
+
statusCode,
|
|
51
|
+
responseHeaders,
|
|
52
|
+
responseBody,
|
|
53
|
+
cause,
|
|
54
|
+
isRetryable = statusCode != null && (statusCode === 408 || // request timeout
|
|
55
|
+
statusCode === 409 || // conflict
|
|
56
|
+
statusCode === 429 || // too many requests
|
|
57
|
+
statusCode >= 500),
|
|
58
|
+
// server error
|
|
59
|
+
data
|
|
60
|
+
}) {
|
|
61
|
+
super({ name, message, cause });
|
|
62
|
+
this[_a2] = true;
|
|
63
|
+
this.url = url;
|
|
64
|
+
this.requestBodyValues = requestBodyValues;
|
|
65
|
+
this.statusCode = statusCode;
|
|
66
|
+
this.responseHeaders = responseHeaders;
|
|
67
|
+
this.responseBody = responseBody;
|
|
68
|
+
this.isRetryable = isRetryable;
|
|
69
|
+
this.data = data;
|
|
70
|
+
}
|
|
71
|
+
static isInstance(error) {
|
|
72
|
+
return AISDKError.hasMarker(error, marker2);
|
|
48
73
|
}
|
|
49
74
|
};
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
var
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} else {
|
|
64
|
-
super.register(value, options);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
getAllowedProps(value) {
|
|
68
|
-
return this.classToAllowedProps.get(value);
|
|
75
|
+
_a2 = symbol2;
|
|
76
|
+
var name2 = "AI_EmptyResponseBodyError";
|
|
77
|
+
var marker3 = `vercel.ai.error.${name2}`;
|
|
78
|
+
var symbol3 = Symbol.for(marker3);
|
|
79
|
+
var _a3;
|
|
80
|
+
var EmptyResponseBodyError = class extends AISDKError {
|
|
81
|
+
// used in isInstance
|
|
82
|
+
constructor({ message = "Empty response body" } = {}) {
|
|
83
|
+
super({ name: name2, message });
|
|
84
|
+
this[_a3] = true;
|
|
85
|
+
}
|
|
86
|
+
static isInstance(error) {
|
|
87
|
+
return AISDKError.hasMarker(error, marker3);
|
|
69
88
|
}
|
|
70
89
|
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return Object.values(record);
|
|
76
|
-
}
|
|
77
|
-
const values = [];
|
|
78
|
-
for (const key in record) {
|
|
79
|
-
if (record.hasOwnProperty(key)) {
|
|
80
|
-
values.push(record[key]);
|
|
81
|
-
}
|
|
90
|
+
_a3 = symbol3;
|
|
91
|
+
function getErrorMessage(error) {
|
|
92
|
+
if (error == null) {
|
|
93
|
+
return "unknown error";
|
|
82
94
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
function find(record, predicate) {
|
|
86
|
-
const values = valuesOfObj(record);
|
|
87
|
-
if ("find" in values) {
|
|
88
|
-
return values.find(predicate);
|
|
95
|
+
if (typeof error === "string") {
|
|
96
|
+
return error;
|
|
89
97
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const value = valuesNotNever[i];
|
|
93
|
-
if (predicate(value)) {
|
|
94
|
-
return value;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return void 0;
|
|
98
|
-
}
|
|
99
|
-
function forEach(record, run) {
|
|
100
|
-
Object.entries(record).forEach(([key, value]) => run(value, key));
|
|
101
|
-
}
|
|
102
|
-
function includes(arr, value) {
|
|
103
|
-
return arr.indexOf(value) !== -1;
|
|
104
|
-
}
|
|
105
|
-
function findArr(record, predicate) {
|
|
106
|
-
for (let i = 0; i < record.length; i++) {
|
|
107
|
-
const value = record[i];
|
|
108
|
-
if (predicate(value)) {
|
|
109
|
-
return value;
|
|
110
|
-
}
|
|
98
|
+
if (error instanceof Error) {
|
|
99
|
+
return error.message;
|
|
111
100
|
}
|
|
112
|
-
return
|
|
101
|
+
return JSON.stringify(error);
|
|
113
102
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
103
|
+
var name3 = "AI_InvalidArgumentError";
|
|
104
|
+
var marker4 = `vercel.ai.error.${name3}`;
|
|
105
|
+
var symbol4 = Symbol.for(marker4);
|
|
106
|
+
var _a4;
|
|
107
|
+
var InvalidArgumentError = class extends AISDKError {
|
|
108
|
+
constructor({
|
|
109
|
+
message,
|
|
110
|
+
cause,
|
|
111
|
+
argument
|
|
112
|
+
}) {
|
|
113
|
+
super({ name: name3, message, cause });
|
|
114
|
+
this[_a4] = true;
|
|
115
|
+
this.argument = argument;
|
|
116
|
+
}
|
|
117
|
+
static isInstance(error) {
|
|
118
|
+
return AISDKError.hasMarker(error, marker4);
|
|
128
119
|
}
|
|
129
120
|
};
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
var
|
|
133
|
-
var
|
|
134
|
-
var
|
|
135
|
-
var
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
121
|
+
_a4 = symbol4;
|
|
122
|
+
var name4 = "AI_InvalidPromptError";
|
|
123
|
+
var marker5 = `vercel.ai.error.${name4}`;
|
|
124
|
+
var symbol5 = Symbol.for(marker5);
|
|
125
|
+
var _a5;
|
|
126
|
+
var InvalidPromptError = class extends AISDKError {
|
|
127
|
+
constructor({
|
|
128
|
+
prompt,
|
|
129
|
+
message,
|
|
130
|
+
cause
|
|
131
|
+
}) {
|
|
132
|
+
super({ name: name4, message: `Invalid prompt: ${message}`, cause });
|
|
133
|
+
this[_a5] = true;
|
|
134
|
+
this.prompt = prompt;
|
|
135
|
+
}
|
|
136
|
+
static isInstance(error) {
|
|
137
|
+
return AISDKError.hasMarker(error, marker5);
|
|
138
|
+
}
|
|
143
139
|
};
|
|
144
|
-
|
|
145
|
-
var
|
|
146
|
-
var
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
var isURL = (payload) => payload instanceof URL;
|
|
161
|
-
|
|
162
|
-
// ../../node_modules/.pnpm/superjson@2.2.2/node_modules/superjson/dist/pathstringifier.js
|
|
163
|
-
var escapeKey = (key) => key.replace(/\./g, "\\.");
|
|
164
|
-
var stringifyPath = (path) => path.map(String).map(escapeKey).join(".");
|
|
165
|
-
var parsePath = (string) => {
|
|
166
|
-
const result = [];
|
|
167
|
-
let segment = "";
|
|
168
|
-
for (let i = 0; i < string.length; i++) {
|
|
169
|
-
let char = string.charAt(i);
|
|
170
|
-
const isEscapedDot = char === "\\" && string.charAt(i + 1) === ".";
|
|
171
|
-
if (isEscapedDot) {
|
|
172
|
-
segment += ".";
|
|
173
|
-
i++;
|
|
174
|
-
continue;
|
|
175
|
-
}
|
|
176
|
-
const isEndOfSegment = char === ".";
|
|
177
|
-
if (isEndOfSegment) {
|
|
178
|
-
result.push(segment);
|
|
179
|
-
segment = "";
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
segment += char;
|
|
140
|
+
_a5 = symbol5;
|
|
141
|
+
var name5 = "AI_InvalidResponseDataError";
|
|
142
|
+
var marker6 = `vercel.ai.error.${name5}`;
|
|
143
|
+
var symbol6 = Symbol.for(marker6);
|
|
144
|
+
var _a6;
|
|
145
|
+
var InvalidResponseDataError = class extends AISDKError {
|
|
146
|
+
constructor({
|
|
147
|
+
data,
|
|
148
|
+
message = `Invalid response data: ${JSON.stringify(data)}.`
|
|
149
|
+
}) {
|
|
150
|
+
super({ name: name5, message });
|
|
151
|
+
this[_a6] = true;
|
|
152
|
+
this.data = data;
|
|
153
|
+
}
|
|
154
|
+
static isInstance(error) {
|
|
155
|
+
return AISDKError.hasMarker(error, marker6);
|
|
183
156
|
}
|
|
184
|
-
const lastSegment = segment;
|
|
185
|
-
result.push(lastSegment);
|
|
186
|
-
return result;
|
|
187
157
|
};
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
simpleTransformation(isBigint, "bigint", (v) => v.toString(), (v) => {
|
|
201
|
-
if (typeof BigInt !== "undefined") {
|
|
202
|
-
return BigInt(v);
|
|
203
|
-
}
|
|
204
|
-
console.error("Please add a BigInt polyfill.");
|
|
205
|
-
return v;
|
|
206
|
-
}),
|
|
207
|
-
simpleTransformation(isDate, "Date", (v) => v.toISOString(), (v) => new Date(v)),
|
|
208
|
-
simpleTransformation(isError, "Error", (v, superJson) => {
|
|
209
|
-
const baseError = {
|
|
210
|
-
name: v.name,
|
|
211
|
-
message: v.message
|
|
212
|
-
};
|
|
213
|
-
superJson.allowedErrorProps.forEach((prop) => {
|
|
214
|
-
baseError[prop] = v[prop];
|
|
158
|
+
_a6 = symbol6;
|
|
159
|
+
var name6 = "AI_JSONParseError";
|
|
160
|
+
var marker7 = `vercel.ai.error.${name6}`;
|
|
161
|
+
var symbol7 = Symbol.for(marker7);
|
|
162
|
+
var _a7;
|
|
163
|
+
var JSONParseError = class extends AISDKError {
|
|
164
|
+
constructor({ text, cause }) {
|
|
165
|
+
super({
|
|
166
|
+
name: name6,
|
|
167
|
+
message: `JSON parsing failed: Text: ${text}.
|
|
168
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
169
|
+
cause
|
|
215
170
|
});
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const e = new Error(v.message);
|
|
219
|
-
e.name = v.name;
|
|
220
|
-
e.stack = v.stack;
|
|
221
|
-
superJson.allowedErrorProps.forEach((prop) => {
|
|
222
|
-
e[prop] = v[prop];
|
|
223
|
-
});
|
|
224
|
-
return e;
|
|
225
|
-
}),
|
|
226
|
-
simpleTransformation(isRegExp, "regexp", (v) => "" + v, (regex) => {
|
|
227
|
-
const body = regex.slice(1, regex.lastIndexOf("/"));
|
|
228
|
-
const flags = regex.slice(regex.lastIndexOf("/") + 1);
|
|
229
|
-
return new RegExp(body, flags);
|
|
230
|
-
}),
|
|
231
|
-
simpleTransformation(
|
|
232
|
-
isSet,
|
|
233
|
-
"set",
|
|
234
|
-
// (sets only exist in es6+)
|
|
235
|
-
// eslint-disable-next-line es5/no-es6-methods
|
|
236
|
-
(v) => [...v.values()],
|
|
237
|
-
(v) => new Set(v)
|
|
238
|
-
),
|
|
239
|
-
simpleTransformation(isMap, "map", (v) => [...v.entries()], (v) => new Map(v)),
|
|
240
|
-
simpleTransformation((v) => isNaNValue(v) || isInfinite(v), "number", (v) => {
|
|
241
|
-
if (isNaNValue(v)) {
|
|
242
|
-
return "NaN";
|
|
243
|
-
}
|
|
244
|
-
if (v > 0) {
|
|
245
|
-
return "Infinity";
|
|
246
|
-
} else {
|
|
247
|
-
return "-Infinity";
|
|
248
|
-
}
|
|
249
|
-
}, Number),
|
|
250
|
-
simpleTransformation((v) => v === 0 && 1 / v === -Infinity, "number", () => {
|
|
251
|
-
return "-0";
|
|
252
|
-
}, Number),
|
|
253
|
-
simpleTransformation(isURL, "URL", (v) => v.toString(), (v) => new URL(v))
|
|
254
|
-
];
|
|
255
|
-
function compositeTransformation(isApplicable, annotation, transform, untransform) {
|
|
256
|
-
return {
|
|
257
|
-
isApplicable,
|
|
258
|
-
annotation,
|
|
259
|
-
transform,
|
|
260
|
-
untransform
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
var symbolRule = compositeTransformation((s, superJson) => {
|
|
264
|
-
if (isSymbol(s)) {
|
|
265
|
-
const isRegistered = !!superJson.symbolRegistry.getIdentifier(s);
|
|
266
|
-
return isRegistered;
|
|
267
|
-
}
|
|
268
|
-
return false;
|
|
269
|
-
}, (s, superJson) => {
|
|
270
|
-
const identifier = superJson.symbolRegistry.getIdentifier(s);
|
|
271
|
-
return ["symbol", identifier];
|
|
272
|
-
}, (v) => v.description, (_, a, superJson) => {
|
|
273
|
-
const value = superJson.symbolRegistry.getValue(a[1]);
|
|
274
|
-
if (!value) {
|
|
275
|
-
throw new Error("Trying to deserialize unknown symbol");
|
|
276
|
-
}
|
|
277
|
-
return value;
|
|
278
|
-
});
|
|
279
|
-
var constructorToName = [
|
|
280
|
-
Int8Array,
|
|
281
|
-
Uint8Array,
|
|
282
|
-
Int16Array,
|
|
283
|
-
Uint16Array,
|
|
284
|
-
Int32Array,
|
|
285
|
-
Uint32Array,
|
|
286
|
-
Float32Array,
|
|
287
|
-
Float64Array,
|
|
288
|
-
Uint8ClampedArray
|
|
289
|
-
].reduce((obj, ctor) => {
|
|
290
|
-
obj[ctor.name] = ctor;
|
|
291
|
-
return obj;
|
|
292
|
-
}, {});
|
|
293
|
-
var typedArrayRule = compositeTransformation(isTypedArray, (v) => ["typed-array", v.constructor.name], (v) => [...v], (v, a) => {
|
|
294
|
-
const ctor = constructorToName[a[1]];
|
|
295
|
-
if (!ctor) {
|
|
296
|
-
throw new Error("Trying to deserialize unknown typed array");
|
|
297
|
-
}
|
|
298
|
-
return new ctor(v);
|
|
299
|
-
});
|
|
300
|
-
function isInstanceOfRegisteredClass(potentialClass, superJson) {
|
|
301
|
-
if (potentialClass?.constructor) {
|
|
302
|
-
const isRegistered = !!superJson.classRegistry.getIdentifier(potentialClass.constructor);
|
|
303
|
-
return isRegistered;
|
|
304
|
-
}
|
|
305
|
-
return false;
|
|
306
|
-
}
|
|
307
|
-
var classRule = compositeTransformation(isInstanceOfRegisteredClass, (clazz, superJson) => {
|
|
308
|
-
const identifier = superJson.classRegistry.getIdentifier(clazz.constructor);
|
|
309
|
-
return ["class", identifier];
|
|
310
|
-
}, (clazz, superJson) => {
|
|
311
|
-
const allowedProps = superJson.classRegistry.getAllowedProps(clazz.constructor);
|
|
312
|
-
if (!allowedProps) {
|
|
313
|
-
return { ...clazz };
|
|
314
|
-
}
|
|
315
|
-
const result = {};
|
|
316
|
-
allowedProps.forEach((prop) => {
|
|
317
|
-
result[prop] = clazz[prop];
|
|
318
|
-
});
|
|
319
|
-
return result;
|
|
320
|
-
}, (v, a, superJson) => {
|
|
321
|
-
const clazz = superJson.classRegistry.getValue(a[1]);
|
|
322
|
-
if (!clazz) {
|
|
323
|
-
throw new Error(`Trying to deserialize unknown class '${a[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
|
|
324
|
-
}
|
|
325
|
-
return Object.assign(Object.create(clazz.prototype), v);
|
|
326
|
-
});
|
|
327
|
-
var customRule = compositeTransformation((value, superJson) => {
|
|
328
|
-
return !!superJson.customTransformerRegistry.findApplicable(value);
|
|
329
|
-
}, (value, superJson) => {
|
|
330
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
331
|
-
return ["custom", transformer.name];
|
|
332
|
-
}, (value, superJson) => {
|
|
333
|
-
const transformer = superJson.customTransformerRegistry.findApplicable(value);
|
|
334
|
-
return transformer.serialize(value);
|
|
335
|
-
}, (v, a, superJson) => {
|
|
336
|
-
const transformer = superJson.customTransformerRegistry.findByName(a[1]);
|
|
337
|
-
if (!transformer) {
|
|
338
|
-
throw new Error("Trying to deserialize unknown custom value");
|
|
339
|
-
}
|
|
340
|
-
return transformer.deserialize(v);
|
|
341
|
-
});
|
|
342
|
-
var compositeRules = [classRule, symbolRule, customRule, typedArrayRule];
|
|
343
|
-
var transformValue = (value, superJson) => {
|
|
344
|
-
const applicableCompositeRule = findArr(compositeRules, (rule) => rule.isApplicable(value, superJson));
|
|
345
|
-
if (applicableCompositeRule) {
|
|
346
|
-
return {
|
|
347
|
-
value: applicableCompositeRule.transform(value, superJson),
|
|
348
|
-
type: applicableCompositeRule.annotation(value, superJson)
|
|
349
|
-
};
|
|
171
|
+
this[_a7] = true;
|
|
172
|
+
this.text = text;
|
|
350
173
|
}
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
return {
|
|
354
|
-
value: applicableSimpleRule.transform(value, superJson),
|
|
355
|
-
type: applicableSimpleRule.annotation
|
|
356
|
-
};
|
|
174
|
+
static isInstance(error) {
|
|
175
|
+
return AISDKError.hasMarker(error, marker7);
|
|
357
176
|
}
|
|
358
|
-
return void 0;
|
|
359
177
|
};
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
var
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
case "typed-array":
|
|
374
|
-
return typedArrayRule.untransform(json, type, superJson);
|
|
375
|
-
default:
|
|
376
|
-
throw new Error("Unknown transformation: " + type);
|
|
377
|
-
}
|
|
378
|
-
} else {
|
|
379
|
-
const transformation = simpleRulesByAnnotation[type];
|
|
380
|
-
if (!transformation) {
|
|
381
|
-
throw new Error("Unknown transformation: " + type);
|
|
382
|
-
}
|
|
383
|
-
return transformation.untransform(json, superJson);
|
|
178
|
+
_a7 = symbol7;
|
|
179
|
+
var name7 = "AI_LoadAPIKeyError";
|
|
180
|
+
var marker8 = `vercel.ai.error.${name7}`;
|
|
181
|
+
var symbol8 = Symbol.for(marker8);
|
|
182
|
+
var _a8;
|
|
183
|
+
var LoadAPIKeyError = class extends AISDKError {
|
|
184
|
+
// used in isInstance
|
|
185
|
+
constructor({ message }) {
|
|
186
|
+
super({ name: name7, message });
|
|
187
|
+
this[_a8] = true;
|
|
188
|
+
}
|
|
189
|
+
static isInstance(error) {
|
|
190
|
+
return AISDKError.hasMarker(error, marker8);
|
|
384
191
|
}
|
|
385
192
|
};
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
if (includes(path, "constructor")) {
|
|
406
|
-
throw new Error("constructor is not allowed as a property");
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
var getDeep = (object, path) => {
|
|
410
|
-
validatePath(path);
|
|
411
|
-
for (let i = 0; i < path.length; i++) {
|
|
412
|
-
const key = path[i];
|
|
413
|
-
if (isSet(object)) {
|
|
414
|
-
object = getNthKey(object, +key);
|
|
415
|
-
} else if (isMap(object)) {
|
|
416
|
-
const row = +key;
|
|
417
|
-
const type = +path[++i] === 0 ? "key" : "value";
|
|
418
|
-
const keyOfRow = getNthKey(object, row);
|
|
419
|
-
switch (type) {
|
|
420
|
-
case "key":
|
|
421
|
-
object = keyOfRow;
|
|
422
|
-
break;
|
|
423
|
-
case "value":
|
|
424
|
-
object = object.get(keyOfRow);
|
|
425
|
-
break;
|
|
426
|
-
}
|
|
427
|
-
} else {
|
|
428
|
-
object = object[key];
|
|
429
|
-
}
|
|
193
|
+
_a8 = symbol8;
|
|
194
|
+
var name10 = "AI_NoSuchModelError";
|
|
195
|
+
var marker11 = `vercel.ai.error.${name10}`;
|
|
196
|
+
var symbol11 = Symbol.for(marker11);
|
|
197
|
+
var _a11;
|
|
198
|
+
var NoSuchModelError = class extends AISDKError {
|
|
199
|
+
constructor({
|
|
200
|
+
errorName = name10,
|
|
201
|
+
modelId,
|
|
202
|
+
modelType,
|
|
203
|
+
message = `No such ${modelType}: ${modelId}`
|
|
204
|
+
}) {
|
|
205
|
+
super({ name: errorName, message });
|
|
206
|
+
this[_a11] = true;
|
|
207
|
+
this.modelId = modelId;
|
|
208
|
+
this.modelType = modelType;
|
|
209
|
+
}
|
|
210
|
+
static isInstance(error) {
|
|
211
|
+
return AISDKError.hasMarker(error, marker11);
|
|
430
212
|
}
|
|
431
|
-
return object;
|
|
432
213
|
};
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
} else if (isMap(parent)) {
|
|
450
|
-
const isEnd = i === path.length - 2;
|
|
451
|
-
if (isEnd) {
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
const row = +key;
|
|
455
|
-
const type = +path[++i] === 0 ? "key" : "value";
|
|
456
|
-
const keyOfRow = getNthKey(parent, row);
|
|
457
|
-
switch (type) {
|
|
458
|
-
case "key":
|
|
459
|
-
parent = keyOfRow;
|
|
460
|
-
break;
|
|
461
|
-
case "value":
|
|
462
|
-
parent = parent.get(keyOfRow);
|
|
463
|
-
break;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
const lastKey = path[path.length - 1];
|
|
468
|
-
if (isArray(parent)) {
|
|
469
|
-
parent[+lastKey] = mapper(parent[+lastKey]);
|
|
470
|
-
} else if (isPlainObject(parent)) {
|
|
471
|
-
parent[lastKey] = mapper(parent[lastKey]);
|
|
472
|
-
}
|
|
473
|
-
if (isSet(parent)) {
|
|
474
|
-
const oldValue = getNthKey(parent, +lastKey);
|
|
475
|
-
const newValue = mapper(oldValue);
|
|
476
|
-
if (oldValue !== newValue) {
|
|
477
|
-
parent.delete(oldValue);
|
|
478
|
-
parent.add(newValue);
|
|
479
|
-
}
|
|
214
|
+
_a11 = symbol11;
|
|
215
|
+
var name11 = "AI_TooManyEmbeddingValuesForCallError";
|
|
216
|
+
var marker12 = `vercel.ai.error.${name11}`;
|
|
217
|
+
var symbol12 = Symbol.for(marker12);
|
|
218
|
+
var _a12;
|
|
219
|
+
var TooManyEmbeddingValuesForCallError = class extends AISDKError {
|
|
220
|
+
constructor(options) {
|
|
221
|
+
super({
|
|
222
|
+
name: name11,
|
|
223
|
+
message: `Too many values for a single embedding call. The ${options.provider} model "${options.modelId}" can only embed up to ${options.maxEmbeddingsPerCall} values per call, but ${options.values.length} values were provided.`
|
|
224
|
+
});
|
|
225
|
+
this[_a12] = true;
|
|
226
|
+
this.provider = options.provider;
|
|
227
|
+
this.modelId = options.modelId;
|
|
228
|
+
this.maxEmbeddingsPerCall = options.maxEmbeddingsPerCall;
|
|
229
|
+
this.values = options.values;
|
|
480
230
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
const keyToRow = getNthKey(parent, row);
|
|
484
|
-
const type = +lastKey === 0 ? "key" : "value";
|
|
485
|
-
switch (type) {
|
|
486
|
-
case "key": {
|
|
487
|
-
const newKey = mapper(keyToRow);
|
|
488
|
-
parent.set(newKey, parent.get(keyToRow));
|
|
489
|
-
if (newKey !== keyToRow) {
|
|
490
|
-
parent.delete(keyToRow);
|
|
491
|
-
}
|
|
492
|
-
break;
|
|
493
|
-
}
|
|
494
|
-
case "value": {
|
|
495
|
-
parent.set(keyToRow, mapper(parent.get(keyToRow)));
|
|
496
|
-
break;
|
|
497
|
-
}
|
|
498
|
-
}
|
|
231
|
+
static isInstance(error) {
|
|
232
|
+
return AISDKError.hasMarker(error, marker12);
|
|
499
233
|
}
|
|
500
|
-
return object;
|
|
501
234
|
};
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
forEach(children, (child, key) => {
|
|
515
|
-
traverse(child, walker2, [...origin, ...parsePath(key)]);
|
|
235
|
+
_a12 = symbol12;
|
|
236
|
+
var name12 = "AI_TypeValidationError";
|
|
237
|
+
var marker13 = `vercel.ai.error.${name12}`;
|
|
238
|
+
var symbol13 = Symbol.for(marker13);
|
|
239
|
+
var _a13;
|
|
240
|
+
var _TypeValidationError = class _TypeValidationError2 extends AISDKError {
|
|
241
|
+
constructor({ value, cause }) {
|
|
242
|
+
super({
|
|
243
|
+
name: name12,
|
|
244
|
+
message: `Type validation failed: Value: ${JSON.stringify(value)}.
|
|
245
|
+
Error message: ${getErrorMessage(cause)}`,
|
|
246
|
+
cause
|
|
516
247
|
});
|
|
248
|
+
this[_a13] = true;
|
|
249
|
+
this.value = value;
|
|
517
250
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
function applyValueAnnotations(plain, annotations, superJson) {
|
|
521
|
-
traverse(annotations, (type, path) => {
|
|
522
|
-
plain = setDeep(plain, path, (v) => untransformValue(v, type, superJson));
|
|
523
|
-
});
|
|
524
|
-
return plain;
|
|
525
|
-
}
|
|
526
|
-
function applyReferentialEqualityAnnotations(plain, annotations) {
|
|
527
|
-
function apply(identicalPaths, path) {
|
|
528
|
-
const object = getDeep(plain, parsePath(path));
|
|
529
|
-
identicalPaths.map(parsePath).forEach((identicalObjectPath) => {
|
|
530
|
-
plain = setDeep(plain, identicalObjectPath, () => object);
|
|
531
|
-
});
|
|
251
|
+
static isInstance(error) {
|
|
252
|
+
return AISDKError.hasMarker(error, marker13);
|
|
532
253
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
254
|
+
/**
|
|
255
|
+
* Wraps an error into a TypeValidationError.
|
|
256
|
+
* If the cause is already a TypeValidationError with the same value, it returns the cause.
|
|
257
|
+
* Otherwise, it creates a new TypeValidationError.
|
|
258
|
+
*
|
|
259
|
+
* @param {Object} params - The parameters for wrapping the error.
|
|
260
|
+
* @param {unknown} params.value - The value that failed validation.
|
|
261
|
+
* @param {unknown} params.cause - The original error or cause of the validation failure.
|
|
262
|
+
* @returns {TypeValidationError} A TypeValidationError instance.
|
|
263
|
+
*/
|
|
264
|
+
static wrap({
|
|
265
|
+
value,
|
|
266
|
+
cause
|
|
267
|
+
}) {
|
|
268
|
+
return _TypeValidationError2.isInstance(cause) && cause.value === value ? cause : new _TypeValidationError2({ value, cause });
|
|
543
269
|
}
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
var
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
270
|
+
};
|
|
271
|
+
_a13 = symbol13;
|
|
272
|
+
var TypeValidationError = _TypeValidationError;
|
|
273
|
+
var name13 = "AI_UnsupportedFunctionalityError";
|
|
274
|
+
var marker14 = `vercel.ai.error.${name13}`;
|
|
275
|
+
var symbol14 = Symbol.for(marker14);
|
|
276
|
+
var _a14;
|
|
277
|
+
var UnsupportedFunctionalityError = class extends AISDKError {
|
|
278
|
+
constructor({
|
|
279
|
+
functionality,
|
|
280
|
+
message = `'${functionality}' functionality not supported.`
|
|
281
|
+
}) {
|
|
282
|
+
super({ name: name13, message });
|
|
283
|
+
this[_a14] = true;
|
|
284
|
+
this.functionality = functionality;
|
|
285
|
+
}
|
|
286
|
+
static isInstance(error) {
|
|
287
|
+
return AISDKError.hasMarker(error, marker14);
|
|
553
288
|
}
|
|
289
|
+
};
|
|
290
|
+
_a14 = symbol14;
|
|
291
|
+
|
|
292
|
+
// ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/index.js
|
|
293
|
+
var ParseError = class extends Error {
|
|
294
|
+
constructor(message, options) {
|
|
295
|
+
super(message), this.name = "ParseError", this.type = options.type, this.field = options.field, this.value = options.value, this.line = options.line;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
function noop(_arg) {
|
|
554
299
|
}
|
|
555
|
-
function
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
300
|
+
function createParser(callbacks) {
|
|
301
|
+
if (typeof callbacks == "function")
|
|
302
|
+
throw new TypeError(
|
|
303
|
+
"`callbacks` must be an object, got a function instead. Did you mean `{onEvent: fn}`?"
|
|
304
|
+
);
|
|
305
|
+
const { onEvent = noop, onError = noop, onRetry = noop, onComment } = callbacks;
|
|
306
|
+
let incompleteLine = "", isFirstChunk = true, id, data = "", eventType = "";
|
|
307
|
+
function feed(newChunk) {
|
|
308
|
+
const chunk = isFirstChunk ? newChunk.replace(/^\xEF\xBB\xBF/, "") : newChunk, [complete, incomplete] = splitLines(`${incompleteLine}${chunk}`);
|
|
309
|
+
for (const line of complete)
|
|
310
|
+
parseLine(line);
|
|
311
|
+
incompleteLine = incomplete, isFirstChunk = false;
|
|
312
|
+
}
|
|
313
|
+
function parseLine(line) {
|
|
314
|
+
if (line === "") {
|
|
315
|
+
dispatchEvent();
|
|
560
316
|
return;
|
|
561
317
|
}
|
|
562
|
-
if (
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
const [representativePath, ...identicalPaths] = paths;
|
|
566
|
-
if (representativePath.length === 0) {
|
|
567
|
-
rootEqualityPaths = identicalPaths.map(stringifyPath);
|
|
568
|
-
} else {
|
|
569
|
-
result[stringifyPath(representativePath)] = identicalPaths.map(stringifyPath);
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
|
-
if (rootEqualityPaths) {
|
|
573
|
-
if (isEmptyObject(result)) {
|
|
574
|
-
return [rootEqualityPaths];
|
|
575
|
-
} else {
|
|
576
|
-
return [rootEqualityPaths, result];
|
|
318
|
+
if (line.startsWith(":")) {
|
|
319
|
+
onComment && onComment(line.slice(line.startsWith(": ") ? 2 : 1));
|
|
320
|
+
return;
|
|
577
321
|
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
const primitive = isPrimitive(object);
|
|
584
|
-
if (!primitive) {
|
|
585
|
-
addIdentity(object, path, identities);
|
|
586
|
-
const seen = seenObjects.get(object);
|
|
587
|
-
if (seen) {
|
|
588
|
-
return dedupe ? {
|
|
589
|
-
transformedValue: null
|
|
590
|
-
} : seen;
|
|
322
|
+
const fieldSeparatorIndex = line.indexOf(":");
|
|
323
|
+
if (fieldSeparatorIndex !== -1) {
|
|
324
|
+
const field = line.slice(0, fieldSeparatorIndex), offset = line[fieldSeparatorIndex + 1] === " " ? 2 : 1, value = line.slice(fieldSeparatorIndex + offset);
|
|
325
|
+
processField(field, value, line);
|
|
326
|
+
return;
|
|
591
327
|
}
|
|
328
|
+
processField(line, "", line);
|
|
592
329
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
330
|
+
function processField(field, value, line) {
|
|
331
|
+
switch (field) {
|
|
332
|
+
case "event":
|
|
333
|
+
eventType = value;
|
|
334
|
+
break;
|
|
335
|
+
case "data":
|
|
336
|
+
data = `${data}${value}
|
|
337
|
+
`;
|
|
338
|
+
break;
|
|
339
|
+
case "id":
|
|
340
|
+
id = value.includes("\0") ? void 0 : value;
|
|
341
|
+
break;
|
|
342
|
+
case "retry":
|
|
343
|
+
/^\d+$/.test(value) ? onRetry(parseInt(value, 10)) : onError(
|
|
344
|
+
new ParseError(`Invalid \`retry\` value: "${value}"`, {
|
|
345
|
+
type: "invalid-retry",
|
|
346
|
+
value,
|
|
347
|
+
line
|
|
348
|
+
})
|
|
349
|
+
);
|
|
350
|
+
break;
|
|
351
|
+
default:
|
|
352
|
+
onError(
|
|
353
|
+
new ParseError(
|
|
354
|
+
`Unknown field "${field.length > 20 ? `${field.slice(0, 20)}\u2026` : field}"`,
|
|
355
|
+
{ type: "unknown-field", field, value, line }
|
|
356
|
+
)
|
|
357
|
+
);
|
|
358
|
+
break;
|
|
603
359
|
}
|
|
604
|
-
return result2;
|
|
605
|
-
}
|
|
606
|
-
if (includes(objectsInThisPath, object)) {
|
|
607
|
-
return {
|
|
608
|
-
transformedValue: null
|
|
609
|
-
};
|
|
610
360
|
}
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
transformedValue[index] = recursiveResult.transformedValue;
|
|
621
|
-
if (isArray(recursiveResult.annotations)) {
|
|
622
|
-
innerAnnotations[index] = recursiveResult.annotations;
|
|
623
|
-
} else if (isPlainObject(recursiveResult.annotations)) {
|
|
624
|
-
forEach(recursiveResult.annotations, (tree, key) => {
|
|
625
|
-
innerAnnotations[escapeKey(index) + "." + key] = tree;
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
const result = isEmptyObject(innerAnnotations) ? {
|
|
630
|
-
transformedValue,
|
|
631
|
-
annotations: !!transformationResult ? [transformationResult.type] : void 0
|
|
632
|
-
} : {
|
|
633
|
-
transformedValue,
|
|
634
|
-
annotations: !!transformationResult ? [transformationResult.type, innerAnnotations] : innerAnnotations
|
|
635
|
-
};
|
|
636
|
-
if (!primitive) {
|
|
637
|
-
seenObjects.set(object, result);
|
|
361
|
+
function dispatchEvent() {
|
|
362
|
+
data.length > 0 && onEvent({
|
|
363
|
+
id,
|
|
364
|
+
event: eventType || void 0,
|
|
365
|
+
// If the data buffer's last character is a U+000A LINE FEED (LF) character,
|
|
366
|
+
// then remove the last character from the data buffer.
|
|
367
|
+
data: data.endsWith(`
|
|
368
|
+
`) ? data.slice(0, -1) : data
|
|
369
|
+
}), id = void 0, data = "", eventType = "";
|
|
638
370
|
}
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
// ../../node_modules/.pnpm/is-what@4.1.16/node_modules/is-what/dist/index.js
|
|
643
|
-
function getType2(payload) {
|
|
644
|
-
return Object.prototype.toString.call(payload).slice(8, -1);
|
|
645
|
-
}
|
|
646
|
-
function isArray2(payload) {
|
|
647
|
-
return getType2(payload) === "Array";
|
|
648
|
-
}
|
|
649
|
-
function isPlainObject2(payload) {
|
|
650
|
-
if (getType2(payload) !== "Object")
|
|
651
|
-
return false;
|
|
652
|
-
const prototype = Object.getPrototypeOf(payload);
|
|
653
|
-
return !!prototype && prototype.constructor === Object && prototype === Object.prototype;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
// ../../node_modules/.pnpm/copy-anything@3.0.5/node_modules/copy-anything/dist/index.js
|
|
657
|
-
function assignProp(carry, key, newVal, originalObject, includeNonenumerable) {
|
|
658
|
-
const propType = {}.propertyIsEnumerable.call(originalObject, key) ? "enumerable" : "nonenumerable";
|
|
659
|
-
if (propType === "enumerable")
|
|
660
|
-
carry[key] = newVal;
|
|
661
|
-
if (includeNonenumerable && propType === "nonenumerable") {
|
|
662
|
-
Object.defineProperty(carry, key, {
|
|
663
|
-
value: newVal,
|
|
664
|
-
enumerable: false,
|
|
665
|
-
writable: true,
|
|
666
|
-
configurable: true
|
|
667
|
-
});
|
|
371
|
+
function reset(options = {}) {
|
|
372
|
+
incompleteLine && options.consume && parseLine(incompleteLine), isFirstChunk = true, id = void 0, data = "", eventType = "", incompleteLine = "";
|
|
668
373
|
}
|
|
374
|
+
return { feed, reset };
|
|
669
375
|
}
|
|
670
|
-
function
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
376
|
+
function splitLines(chunk) {
|
|
377
|
+
const lines = [];
|
|
378
|
+
let incompleteLine = "", searchIndex = 0;
|
|
379
|
+
for (; searchIndex < chunk.length; ) {
|
|
380
|
+
const crIndex = chunk.indexOf("\r", searchIndex), lfIndex = chunk.indexOf(`
|
|
381
|
+
`, searchIndex);
|
|
382
|
+
let lineEnd = -1;
|
|
383
|
+
if (crIndex !== -1 && lfIndex !== -1 ? lineEnd = Math.min(crIndex, lfIndex) : crIndex !== -1 ? crIndex === chunk.length - 1 ? lineEnd = -1 : lineEnd = crIndex : lfIndex !== -1 && (lineEnd = lfIndex), lineEnd === -1) {
|
|
384
|
+
incompleteLine = chunk.slice(searchIndex);
|
|
385
|
+
break;
|
|
386
|
+
} else {
|
|
387
|
+
const line = chunk.slice(searchIndex, lineEnd);
|
|
388
|
+
lines.push(line), searchIndex = lineEnd + 1, chunk[searchIndex - 1] === "\r" && chunk[searchIndex] === `
|
|
389
|
+
` && searchIndex++;
|
|
682
390
|
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
assignProp(carry, key, newVal, target, options.nonenumerable);
|
|
686
|
-
return carry;
|
|
687
|
-
}, {});
|
|
391
|
+
}
|
|
392
|
+
return [lines, incompleteLine];
|
|
688
393
|
}
|
|
689
394
|
|
|
690
|
-
// ../../node_modules/.pnpm/
|
|
691
|
-
var
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
...res.meta,
|
|
711
|
-
values: output.annotations
|
|
712
|
-
};
|
|
713
|
-
}
|
|
714
|
-
const equalityAnnotations = generateReferentialEqualityAnnotations(identities, this.dedupe);
|
|
715
|
-
if (equalityAnnotations) {
|
|
716
|
-
res.meta = {
|
|
717
|
-
...res.meta,
|
|
718
|
-
referentialEqualities: equalityAnnotations
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
return res;
|
|
722
|
-
}
|
|
723
|
-
deserialize(payload) {
|
|
724
|
-
const { json, meta } = payload;
|
|
725
|
-
let result = copy(json);
|
|
726
|
-
if (meta?.values) {
|
|
727
|
-
result = applyValueAnnotations(result, meta.values, this);
|
|
728
|
-
}
|
|
729
|
-
if (meta?.referentialEqualities) {
|
|
730
|
-
result = applyReferentialEqualityAnnotations(result, meta.referentialEqualities);
|
|
731
|
-
}
|
|
732
|
-
return result;
|
|
733
|
-
}
|
|
734
|
-
stringify(object) {
|
|
735
|
-
return JSON.stringify(this.serialize(object));
|
|
736
|
-
}
|
|
737
|
-
parse(string) {
|
|
738
|
-
return this.deserialize(JSON.parse(string));
|
|
739
|
-
}
|
|
740
|
-
registerClass(v, options) {
|
|
741
|
-
this.classRegistry.register(v, options);
|
|
742
|
-
}
|
|
743
|
-
registerSymbol(v, identifier) {
|
|
744
|
-
this.symbolRegistry.register(v, identifier);
|
|
745
|
-
}
|
|
746
|
-
registerCustom(transformer, name) {
|
|
747
|
-
this.customTransformerRegistry.register({
|
|
748
|
-
name,
|
|
749
|
-
...transformer
|
|
395
|
+
// ../../node_modules/.pnpm/eventsource-parser@3.0.6/node_modules/eventsource-parser/dist/stream.js
|
|
396
|
+
var EventSourceParserStream = class extends TransformStream {
|
|
397
|
+
constructor({ onError, onRetry, onComment } = {}) {
|
|
398
|
+
let parser;
|
|
399
|
+
super({
|
|
400
|
+
start(controller) {
|
|
401
|
+
parser = createParser({
|
|
402
|
+
onEvent: (event) => {
|
|
403
|
+
controller.enqueue(event);
|
|
404
|
+
},
|
|
405
|
+
onError(error) {
|
|
406
|
+
onError === "terminate" ? controller.error(error) : typeof onError == "function" && onError(error);
|
|
407
|
+
},
|
|
408
|
+
onRetry,
|
|
409
|
+
onComment
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
transform(chunk) {
|
|
413
|
+
parser.feed(chunk);
|
|
414
|
+
}
|
|
750
415
|
});
|
|
751
416
|
}
|
|
752
|
-
allowErrorProps(...props) {
|
|
753
|
-
this.allowedErrorProps.push(...props);
|
|
754
|
-
}
|
|
755
417
|
};
|
|
756
|
-
SuperJSON.defaultInstance = new SuperJSON();
|
|
757
|
-
SuperJSON.serialize = SuperJSON.defaultInstance.serialize.bind(SuperJSON.defaultInstance);
|
|
758
|
-
SuperJSON.deserialize = SuperJSON.defaultInstance.deserialize.bind(SuperJSON.defaultInstance);
|
|
759
|
-
SuperJSON.stringify = SuperJSON.defaultInstance.stringify.bind(SuperJSON.defaultInstance);
|
|
760
|
-
SuperJSON.parse = SuperJSON.defaultInstance.parse.bind(SuperJSON.defaultInstance);
|
|
761
|
-
SuperJSON.registerClass = SuperJSON.defaultInstance.registerClass.bind(SuperJSON.defaultInstance);
|
|
762
|
-
SuperJSON.registerSymbol = SuperJSON.defaultInstance.registerSymbol.bind(SuperJSON.defaultInstance);
|
|
763
|
-
SuperJSON.registerCustom = SuperJSON.defaultInstance.registerCustom.bind(SuperJSON.defaultInstance);
|
|
764
|
-
SuperJSON.allowErrorProps = SuperJSON.defaultInstance.allowErrorProps.bind(SuperJSON.defaultInstance);
|
|
765
|
-
var stringify = SuperJSON.stringify;
|
|
766
418
|
|
|
767
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
419
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
768
420
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
769
421
|
var defaultOptions = {
|
|
770
422
|
name: void 0,
|
|
@@ -798,7 +450,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
798
450
|
...options
|
|
799
451
|
};
|
|
800
452
|
|
|
801
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
453
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
802
454
|
var getRefs = (options) => {
|
|
803
455
|
const _options = getDefaultOptions(options);
|
|
804
456
|
const currentPath = _options.name !== void 0 ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -807,11 +459,11 @@ var getRefs = (options) => {
|
|
|
807
459
|
flags: { hasReferencedOpenAiAnyType: false },
|
|
808
460
|
currentPath,
|
|
809
461
|
propertyPath: void 0,
|
|
810
|
-
seen: new Map(Object.entries(_options.definitions).map(([
|
|
462
|
+
seen: new Map(Object.entries(_options.definitions).map(([name14, def]) => [
|
|
811
463
|
def._def,
|
|
812
464
|
{
|
|
813
465
|
def: def._def,
|
|
814
|
-
path: [..._options.basePath, _options.definitionPath,
|
|
466
|
+
path: [..._options.basePath, _options.definitionPath, name14],
|
|
815
467
|
// Resolution of references will be forced even though seen, so it's ok that the schema is undefined here for now.
|
|
816
468
|
jsonSchema: void 0
|
|
817
469
|
}
|
|
@@ -819,7 +471,7 @@ var getRefs = (options) => {
|
|
|
819
471
|
};
|
|
820
472
|
};
|
|
821
473
|
|
|
822
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
474
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
823
475
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
824
476
|
if (!refs?.errorMessages)
|
|
825
477
|
return;
|
|
@@ -835,7 +487,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
835
487
|
addErrorMessage(res, key, errorMessage, refs);
|
|
836
488
|
}
|
|
837
489
|
|
|
838
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
490
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
839
491
|
var getRelativePath = (pathA, pathB) => {
|
|
840
492
|
let i = 0;
|
|
841
493
|
for (; i < pathA.length && i < pathB.length; i++) {
|
|
@@ -845,7 +497,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
845
497
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
846
498
|
};
|
|
847
499
|
|
|
848
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
500
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
849
501
|
function parseAnyDef(refs) {
|
|
850
502
|
if (refs.target !== "openAi") {
|
|
851
503
|
return {};
|
|
@@ -883,7 +535,7 @@ function parseArrayDef(def, refs) {
|
|
|
883
535
|
return res;
|
|
884
536
|
}
|
|
885
537
|
|
|
886
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
538
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
887
539
|
function parseBigintDef(def, refs) {
|
|
888
540
|
const res = {
|
|
889
541
|
type: "integer",
|
|
@@ -929,24 +581,24 @@ function parseBigintDef(def, refs) {
|
|
|
929
581
|
return res;
|
|
930
582
|
}
|
|
931
583
|
|
|
932
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
584
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
933
585
|
function parseBooleanDef() {
|
|
934
586
|
return {
|
|
935
587
|
type: "boolean"
|
|
936
588
|
};
|
|
937
589
|
}
|
|
938
590
|
|
|
939
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
591
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
940
592
|
function parseBrandedDef(_def, refs) {
|
|
941
593
|
return parseDef(_def.type._def, refs);
|
|
942
594
|
}
|
|
943
595
|
|
|
944
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
596
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
945
597
|
var parseCatchDef = (def, refs) => {
|
|
946
598
|
return parseDef(def.innerType._def, refs);
|
|
947
599
|
};
|
|
948
600
|
|
|
949
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
601
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
950
602
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
951
603
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
952
604
|
if (Array.isArray(strategy)) {
|
|
@@ -1005,7 +657,7 @@ var integerDateParser = (def, refs) => {
|
|
|
1005
657
|
return res;
|
|
1006
658
|
};
|
|
1007
659
|
|
|
1008
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
660
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
1009
661
|
function parseDefaultDef(_def, refs) {
|
|
1010
662
|
return {
|
|
1011
663
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -1013,12 +665,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
1013
665
|
};
|
|
1014
666
|
}
|
|
1015
667
|
|
|
1016
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
668
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
1017
669
|
function parseEffectsDef(_def, refs) {
|
|
1018
670
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
1019
671
|
}
|
|
1020
672
|
|
|
1021
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
673
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
1022
674
|
function parseEnumDef(def) {
|
|
1023
675
|
return {
|
|
1024
676
|
type: "string",
|
|
@@ -1026,7 +678,7 @@ function parseEnumDef(def) {
|
|
|
1026
678
|
};
|
|
1027
679
|
}
|
|
1028
680
|
|
|
1029
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
681
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
1030
682
|
var isJsonSchema7AllOfType = (type) => {
|
|
1031
683
|
if ("type" in type && type.type === "string")
|
|
1032
684
|
return false;
|
|
@@ -1068,7 +720,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
1068
720
|
} : void 0;
|
|
1069
721
|
}
|
|
1070
722
|
|
|
1071
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
723
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
1072
724
|
function parseLiteralDef(def, refs) {
|
|
1073
725
|
const parsedType = typeof def.value;
|
|
1074
726
|
if (parsedType !== "bigint" && parsedType !== "number" && parsedType !== "boolean" && parsedType !== "string") {
|
|
@@ -1088,7 +740,7 @@ function parseLiteralDef(def, refs) {
|
|
|
1088
740
|
};
|
|
1089
741
|
}
|
|
1090
742
|
|
|
1091
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
743
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
1092
744
|
var emojiRegex = void 0;
|
|
1093
745
|
var zodPatterns = {
|
|
1094
746
|
/**
|
|
@@ -1400,7 +1052,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
1400
1052
|
return pattern;
|
|
1401
1053
|
}
|
|
1402
1054
|
|
|
1403
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1055
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
1404
1056
|
function parseRecordDef(def, refs) {
|
|
1405
1057
|
if (refs.target === "openAi") {
|
|
1406
1058
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -1452,7 +1104,7 @@ function parseRecordDef(def, refs) {
|
|
|
1452
1104
|
return schema;
|
|
1453
1105
|
}
|
|
1454
1106
|
|
|
1455
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1107
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
1456
1108
|
function parseMapDef(def, refs) {
|
|
1457
1109
|
if (refs.mapStrategy === "record") {
|
|
1458
1110
|
return parseRecordDef(def, refs);
|
|
@@ -1477,7 +1129,7 @@ function parseMapDef(def, refs) {
|
|
|
1477
1129
|
};
|
|
1478
1130
|
}
|
|
1479
1131
|
|
|
1480
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1132
|
+
// ../../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
|
|
1481
1133
|
function parseNativeEnumDef(def) {
|
|
1482
1134
|
const object = def.values;
|
|
1483
1135
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -1491,7 +1143,7 @@ function parseNativeEnumDef(def) {
|
|
|
1491
1143
|
};
|
|
1492
1144
|
}
|
|
1493
1145
|
|
|
1494
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1146
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
1495
1147
|
function parseNeverDef(refs) {
|
|
1496
1148
|
return refs.target === "openAi" ? void 0 : {
|
|
1497
1149
|
not: parseAnyDef({
|
|
@@ -1501,7 +1153,7 @@ function parseNeverDef(refs) {
|
|
|
1501
1153
|
};
|
|
1502
1154
|
}
|
|
1503
1155
|
|
|
1504
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1156
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
1505
1157
|
function parseNullDef(refs) {
|
|
1506
1158
|
return refs.target === "openApi3" ? {
|
|
1507
1159
|
enum: ["null"],
|
|
@@ -1511,7 +1163,7 @@ function parseNullDef(refs) {
|
|
|
1511
1163
|
};
|
|
1512
1164
|
}
|
|
1513
1165
|
|
|
1514
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1166
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
1515
1167
|
var primitiveMappings = {
|
|
1516
1168
|
ZodString: "string",
|
|
1517
1169
|
ZodNumber: "number",
|
|
@@ -1579,7 +1231,7 @@ var asAnyOf = (def, refs) => {
|
|
|
1579
1231
|
return anyOf.length ? { anyOf } : void 0;
|
|
1580
1232
|
};
|
|
1581
1233
|
|
|
1582
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1234
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
1583
1235
|
function parseNullableDef(def, refs) {
|
|
1584
1236
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
1585
1237
|
if (refs.target === "openApi3") {
|
|
@@ -1611,7 +1263,7 @@ function parseNullableDef(def, refs) {
|
|
|
1611
1263
|
return base && { anyOf: [base, { type: "null" }] };
|
|
1612
1264
|
}
|
|
1613
1265
|
|
|
1614
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1266
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
1615
1267
|
function parseNumberDef(def, refs) {
|
|
1616
1268
|
const res = {
|
|
1617
1269
|
type: "number"
|
|
@@ -1660,7 +1312,7 @@ function parseNumberDef(def, refs) {
|
|
|
1660
1312
|
return res;
|
|
1661
1313
|
}
|
|
1662
1314
|
|
|
1663
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1315
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
1664
1316
|
function parseObjectDef(def, refs) {
|
|
1665
1317
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
1666
1318
|
const result = {
|
|
@@ -1730,7 +1382,7 @@ function safeIsOptional(schema) {
|
|
|
1730
1382
|
}
|
|
1731
1383
|
}
|
|
1732
1384
|
|
|
1733
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1385
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
1734
1386
|
var parseOptionalDef = (def, refs) => {
|
|
1735
1387
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
1736
1388
|
return parseDef(def.innerType._def, refs);
|
|
@@ -1749,7 +1401,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
1749
1401
|
} : parseAnyDef(refs);
|
|
1750
1402
|
};
|
|
1751
1403
|
|
|
1752
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1404
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
1753
1405
|
var parsePipelineDef = (def, refs) => {
|
|
1754
1406
|
if (refs.pipeStrategy === "input") {
|
|
1755
1407
|
return parseDef(def.in._def, refs);
|
|
@@ -1769,12 +1421,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
1769
1421
|
};
|
|
1770
1422
|
};
|
|
1771
1423
|
|
|
1772
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1424
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
1773
1425
|
function parsePromiseDef(def, refs) {
|
|
1774
1426
|
return parseDef(def.type._def, refs);
|
|
1775
1427
|
}
|
|
1776
1428
|
|
|
1777
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1429
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
1778
1430
|
function parseSetDef(def, refs) {
|
|
1779
1431
|
const items = parseDef(def.valueType._def, {
|
|
1780
1432
|
...refs,
|
|
@@ -1794,7 +1446,7 @@ function parseSetDef(def, refs) {
|
|
|
1794
1446
|
return schema;
|
|
1795
1447
|
}
|
|
1796
1448
|
|
|
1797
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1449
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
1798
1450
|
function parseTupleDef(def, refs) {
|
|
1799
1451
|
if (def.rest) {
|
|
1800
1452
|
return {
|
|
@@ -1822,24 +1474,24 @@ function parseTupleDef(def, refs) {
|
|
|
1822
1474
|
}
|
|
1823
1475
|
}
|
|
1824
1476
|
|
|
1825
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1477
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
1826
1478
|
function parseUndefinedDef(refs) {
|
|
1827
1479
|
return {
|
|
1828
1480
|
not: parseAnyDef(refs)
|
|
1829
1481
|
};
|
|
1830
1482
|
}
|
|
1831
1483
|
|
|
1832
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1484
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
1833
1485
|
function parseUnknownDef(refs) {
|
|
1834
1486
|
return parseAnyDef(refs);
|
|
1835
1487
|
}
|
|
1836
1488
|
|
|
1837
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1489
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
1838
1490
|
var parseReadonlyDef = (def, refs) => {
|
|
1839
1491
|
return parseDef(def.innerType._def, refs);
|
|
1840
1492
|
};
|
|
1841
1493
|
|
|
1842
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1494
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
1843
1495
|
var selectParser = (def, typeName, refs) => {
|
|
1844
1496
|
switch (typeName) {
|
|
1845
1497
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -1915,7 +1567,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
1915
1567
|
}
|
|
1916
1568
|
};
|
|
1917
1569
|
|
|
1918
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1570
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
1919
1571
|
function parseDef(def, refs, forceResolution = false) {
|
|
1920
1572
|
const seenItem = refs.seen.get(def);
|
|
1921
1573
|
if (refs.override) {
|
|
@@ -1971,20 +1623,20 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
1971
1623
|
return jsonSchema;
|
|
1972
1624
|
};
|
|
1973
1625
|
|
|
1974
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1626
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
1975
1627
|
var zodToJsonSchema = (schema, options) => {
|
|
1976
1628
|
const refs = getRefs(options);
|
|
1977
|
-
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [
|
|
1629
|
+
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name15, schema2]) => ({
|
|
1978
1630
|
...acc,
|
|
1979
|
-
[
|
|
1631
|
+
[name15]: parseDef(schema2._def, {
|
|
1980
1632
|
...refs,
|
|
1981
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1633
|
+
currentPath: [...refs.basePath, refs.definitionPath, name15]
|
|
1982
1634
|
}, true) ?? parseAnyDef(refs)
|
|
1983
1635
|
}), {}) : void 0;
|
|
1984
|
-
const
|
|
1985
|
-
const main = parseDef(schema._def,
|
|
1636
|
+
const name14 = typeof options === "string" ? options : options?.nameStrategy === "title" ? void 0 : options?.name;
|
|
1637
|
+
const main = parseDef(schema._def, name14 === void 0 ? refs : {
|
|
1986
1638
|
...refs,
|
|
1987
|
-
currentPath: [...refs.basePath, refs.definitionPath,
|
|
1639
|
+
currentPath: [...refs.basePath, refs.definitionPath, name14]
|
|
1988
1640
|
}, false) ?? parseAnyDef(refs);
|
|
1989
1641
|
const title = typeof options === "object" && options.name !== void 0 && options.nameStrategy === "title" ? options.name : void 0;
|
|
1990
1642
|
if (title !== void 0) {
|
|
@@ -2008,18 +1660,18 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2008
1660
|
};
|
|
2009
1661
|
}
|
|
2010
1662
|
}
|
|
2011
|
-
const combined =
|
|
1663
|
+
const combined = name14 === void 0 ? definitions ? {
|
|
2012
1664
|
...main,
|
|
2013
1665
|
[refs.definitionPath]: definitions
|
|
2014
1666
|
} : main : {
|
|
2015
1667
|
$ref: [
|
|
2016
1668
|
...refs.$refStrategy === "relative" ? [] : refs.basePath,
|
|
2017
1669
|
refs.definitionPath,
|
|
2018
|
-
|
|
1670
|
+
name14
|
|
2019
1671
|
].join("/"),
|
|
2020
1672
|
[refs.definitionPath]: {
|
|
2021
1673
|
...definitions,
|
|
2022
|
-
[
|
|
1674
|
+
[name14]: main
|
|
2023
1675
|
}
|
|
2024
1676
|
};
|
|
2025
1677
|
if (refs.target === "jsonSchema7") {
|
|
@@ -2033,7 +1685,606 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
2033
1685
|
return combined;
|
|
2034
1686
|
};
|
|
2035
1687
|
|
|
2036
|
-
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.
|
|
1688
|
+
// ../../node_modules/.pnpm/zod-to-json-schema@3.24.6_zod@3.25.76/node_modules/zod-to-json-schema/dist/esm/index.js
|
|
2037
1689
|
var esm_default = zodToJsonSchema;
|
|
2038
1690
|
|
|
2039
|
-
|
|
1691
|
+
// ../../node_modules/.pnpm/@ai-sdk+provider-utils@3.0.3_zod@3.25.76/node_modules/@ai-sdk/provider-utils/dist/index.mjs
|
|
1692
|
+
function combineHeaders(...headers) {
|
|
1693
|
+
return headers.reduce(
|
|
1694
|
+
(combinedHeaders, currentHeaders) => ({
|
|
1695
|
+
...combinedHeaders,
|
|
1696
|
+
...currentHeaders != null ? currentHeaders : {}
|
|
1697
|
+
}),
|
|
1698
|
+
{}
|
|
1699
|
+
);
|
|
1700
|
+
}
|
|
1701
|
+
function extractResponseHeaders(response) {
|
|
1702
|
+
return Object.fromEntries([...response.headers]);
|
|
1703
|
+
}
|
|
1704
|
+
var createIdGenerator = ({
|
|
1705
|
+
prefix,
|
|
1706
|
+
size = 16,
|
|
1707
|
+
alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
1708
|
+
separator = "-"
|
|
1709
|
+
} = {}) => {
|
|
1710
|
+
const generator = () => {
|
|
1711
|
+
const alphabetLength = alphabet.length;
|
|
1712
|
+
const chars = new Array(size);
|
|
1713
|
+
for (let i = 0; i < size; i++) {
|
|
1714
|
+
chars[i] = alphabet[Math.random() * alphabetLength | 0];
|
|
1715
|
+
}
|
|
1716
|
+
return chars.join("");
|
|
1717
|
+
};
|
|
1718
|
+
if (prefix == null) {
|
|
1719
|
+
return generator;
|
|
1720
|
+
}
|
|
1721
|
+
if (alphabet.includes(separator)) {
|
|
1722
|
+
throw new InvalidArgumentError({
|
|
1723
|
+
argument: "separator",
|
|
1724
|
+
message: `The separator "${separator}" must not be part of the alphabet "${alphabet}".`
|
|
1725
|
+
});
|
|
1726
|
+
}
|
|
1727
|
+
return () => `${prefix}${separator}${generator()}`;
|
|
1728
|
+
};
|
|
1729
|
+
var generateId = createIdGenerator();
|
|
1730
|
+
function isAbortError(error) {
|
|
1731
|
+
return (error instanceof Error || error instanceof DOMException) && (error.name === "AbortError" || error.name === "ResponseAborted" || // Next.js
|
|
1732
|
+
error.name === "TimeoutError");
|
|
1733
|
+
}
|
|
1734
|
+
var FETCH_FAILED_ERROR_MESSAGES = ["fetch failed", "failed to fetch"];
|
|
1735
|
+
function handleFetchError({
|
|
1736
|
+
error,
|
|
1737
|
+
url,
|
|
1738
|
+
requestBodyValues
|
|
1739
|
+
}) {
|
|
1740
|
+
if (isAbortError(error)) {
|
|
1741
|
+
return error;
|
|
1742
|
+
}
|
|
1743
|
+
if (error instanceof TypeError && FETCH_FAILED_ERROR_MESSAGES.includes(error.message.toLowerCase())) {
|
|
1744
|
+
const cause = error.cause;
|
|
1745
|
+
if (cause != null) {
|
|
1746
|
+
return new APICallError({
|
|
1747
|
+
message: `Cannot connect to API: ${cause.message}`,
|
|
1748
|
+
cause,
|
|
1749
|
+
url,
|
|
1750
|
+
requestBodyValues,
|
|
1751
|
+
isRetryable: true
|
|
1752
|
+
// retry when network error
|
|
1753
|
+
});
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
return error;
|
|
1757
|
+
}
|
|
1758
|
+
function removeUndefinedEntries(record) {
|
|
1759
|
+
return Object.fromEntries(
|
|
1760
|
+
Object.entries(record).filter(([_key, value]) => value != null)
|
|
1761
|
+
);
|
|
1762
|
+
}
|
|
1763
|
+
function loadApiKey({
|
|
1764
|
+
apiKey,
|
|
1765
|
+
environmentVariableName,
|
|
1766
|
+
apiKeyParameterName = "apiKey",
|
|
1767
|
+
description
|
|
1768
|
+
}) {
|
|
1769
|
+
if (typeof apiKey === "string") {
|
|
1770
|
+
return apiKey;
|
|
1771
|
+
}
|
|
1772
|
+
if (apiKey != null) {
|
|
1773
|
+
throw new LoadAPIKeyError({
|
|
1774
|
+
message: `${description} API key must be a string.`
|
|
1775
|
+
});
|
|
1776
|
+
}
|
|
1777
|
+
if (typeof process === "undefined") {
|
|
1778
|
+
throw new LoadAPIKeyError({
|
|
1779
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter. Environment variables is not supported in this environment.`
|
|
1780
|
+
});
|
|
1781
|
+
}
|
|
1782
|
+
apiKey = process.env[environmentVariableName];
|
|
1783
|
+
if (apiKey == null) {
|
|
1784
|
+
throw new LoadAPIKeyError({
|
|
1785
|
+
message: `${description} API key is missing. Pass it using the '${apiKeyParameterName}' parameter or the ${environmentVariableName} environment variable.`
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
if (typeof apiKey !== "string") {
|
|
1789
|
+
throw new LoadAPIKeyError({
|
|
1790
|
+
message: `${description} API key must be a string. The value of the ${environmentVariableName} environment variable is not a string.`
|
|
1791
|
+
});
|
|
1792
|
+
}
|
|
1793
|
+
return apiKey;
|
|
1794
|
+
}
|
|
1795
|
+
var suspectProtoRx = /"__proto__"\s*:/;
|
|
1796
|
+
var suspectConstructorRx = /"constructor"\s*:/;
|
|
1797
|
+
function _parse(text) {
|
|
1798
|
+
const obj = JSON.parse(text);
|
|
1799
|
+
if (obj === null || typeof obj !== "object") {
|
|
1800
|
+
return obj;
|
|
1801
|
+
}
|
|
1802
|
+
if (suspectProtoRx.test(text) === false && suspectConstructorRx.test(text) === false) {
|
|
1803
|
+
return obj;
|
|
1804
|
+
}
|
|
1805
|
+
return filter(obj);
|
|
1806
|
+
}
|
|
1807
|
+
function filter(obj) {
|
|
1808
|
+
let next = [obj];
|
|
1809
|
+
while (next.length) {
|
|
1810
|
+
const nodes = next;
|
|
1811
|
+
next = [];
|
|
1812
|
+
for (const node of nodes) {
|
|
1813
|
+
if (Object.prototype.hasOwnProperty.call(node, "__proto__")) {
|
|
1814
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1815
|
+
}
|
|
1816
|
+
if (Object.prototype.hasOwnProperty.call(node, "constructor") && Object.prototype.hasOwnProperty.call(node.constructor, "prototype")) {
|
|
1817
|
+
throw new SyntaxError("Object contains forbidden prototype property");
|
|
1818
|
+
}
|
|
1819
|
+
for (const key in node) {
|
|
1820
|
+
const value = node[key];
|
|
1821
|
+
if (value && typeof value === "object") {
|
|
1822
|
+
next.push(value);
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
return obj;
|
|
1828
|
+
}
|
|
1829
|
+
function secureJsonParse(text) {
|
|
1830
|
+
const { stackTraceLimit } = Error;
|
|
1831
|
+
Error.stackTraceLimit = 0;
|
|
1832
|
+
try {
|
|
1833
|
+
return _parse(text);
|
|
1834
|
+
} finally {
|
|
1835
|
+
Error.stackTraceLimit = stackTraceLimit;
|
|
1836
|
+
}
|
|
1837
|
+
}
|
|
1838
|
+
var validatorSymbol = Symbol.for("vercel.ai.validator");
|
|
1839
|
+
function validator(validate) {
|
|
1840
|
+
return { [validatorSymbol]: true, validate };
|
|
1841
|
+
}
|
|
1842
|
+
function isValidator(value) {
|
|
1843
|
+
return typeof value === "object" && value !== null && validatorSymbol in value && value[validatorSymbol] === true && "validate" in value;
|
|
1844
|
+
}
|
|
1845
|
+
function asValidator(value) {
|
|
1846
|
+
return isValidator(value) ? value : standardSchemaValidator(value);
|
|
1847
|
+
}
|
|
1848
|
+
function standardSchemaValidator(standardSchema) {
|
|
1849
|
+
return validator(async (value) => {
|
|
1850
|
+
const result = await standardSchema["~standard"].validate(value);
|
|
1851
|
+
return result.issues == null ? { success: true, value: result.value } : {
|
|
1852
|
+
success: false,
|
|
1853
|
+
error: new TypeValidationError({
|
|
1854
|
+
value,
|
|
1855
|
+
cause: result.issues
|
|
1856
|
+
})
|
|
1857
|
+
};
|
|
1858
|
+
});
|
|
1859
|
+
}
|
|
1860
|
+
async function validateTypes({
|
|
1861
|
+
value,
|
|
1862
|
+
schema
|
|
1863
|
+
}) {
|
|
1864
|
+
const result = await safeValidateTypes({ value, schema });
|
|
1865
|
+
if (!result.success) {
|
|
1866
|
+
throw TypeValidationError.wrap({ value, cause: result.error });
|
|
1867
|
+
}
|
|
1868
|
+
return result.value;
|
|
1869
|
+
}
|
|
1870
|
+
async function safeValidateTypes({
|
|
1871
|
+
value,
|
|
1872
|
+
schema
|
|
1873
|
+
}) {
|
|
1874
|
+
const validator2 = asValidator(schema);
|
|
1875
|
+
try {
|
|
1876
|
+
if (validator2.validate == null) {
|
|
1877
|
+
return { success: true, value, rawValue: value };
|
|
1878
|
+
}
|
|
1879
|
+
const result = await validator2.validate(value);
|
|
1880
|
+
if (result.success) {
|
|
1881
|
+
return { success: true, value: result.value, rawValue: value };
|
|
1882
|
+
}
|
|
1883
|
+
return {
|
|
1884
|
+
success: false,
|
|
1885
|
+
error: TypeValidationError.wrap({ value, cause: result.error }),
|
|
1886
|
+
rawValue: value
|
|
1887
|
+
};
|
|
1888
|
+
} catch (error) {
|
|
1889
|
+
return {
|
|
1890
|
+
success: false,
|
|
1891
|
+
error: TypeValidationError.wrap({ value, cause: error }),
|
|
1892
|
+
rawValue: value
|
|
1893
|
+
};
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
async function parseJSON({
|
|
1897
|
+
text,
|
|
1898
|
+
schema
|
|
1899
|
+
}) {
|
|
1900
|
+
try {
|
|
1901
|
+
const value = secureJsonParse(text);
|
|
1902
|
+
if (schema == null) {
|
|
1903
|
+
return value;
|
|
1904
|
+
}
|
|
1905
|
+
return validateTypes({ value, schema });
|
|
1906
|
+
} catch (error) {
|
|
1907
|
+
if (JSONParseError.isInstance(error) || TypeValidationError.isInstance(error)) {
|
|
1908
|
+
throw error;
|
|
1909
|
+
}
|
|
1910
|
+
throw new JSONParseError({ text, cause: error });
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
async function safeParseJSON({
|
|
1914
|
+
text,
|
|
1915
|
+
schema
|
|
1916
|
+
}) {
|
|
1917
|
+
try {
|
|
1918
|
+
const value = secureJsonParse(text);
|
|
1919
|
+
if (schema == null) {
|
|
1920
|
+
return { success: true, value, rawValue: value };
|
|
1921
|
+
}
|
|
1922
|
+
return await safeValidateTypes({ value, schema });
|
|
1923
|
+
} catch (error) {
|
|
1924
|
+
return {
|
|
1925
|
+
success: false,
|
|
1926
|
+
error: JSONParseError.isInstance(error) ? error : new JSONParseError({ text, cause: error }),
|
|
1927
|
+
rawValue: void 0
|
|
1928
|
+
};
|
|
1929
|
+
}
|
|
1930
|
+
}
|
|
1931
|
+
function isParsableJson(input) {
|
|
1932
|
+
try {
|
|
1933
|
+
secureJsonParse(input);
|
|
1934
|
+
return true;
|
|
1935
|
+
} catch (e) {
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1938
|
+
}
|
|
1939
|
+
function parseJsonEventStream({
|
|
1940
|
+
stream,
|
|
1941
|
+
schema
|
|
1942
|
+
}) {
|
|
1943
|
+
return stream.pipeThrough(new TextDecoderStream()).pipeThrough(new EventSourceParserStream()).pipeThrough(
|
|
1944
|
+
new TransformStream({
|
|
1945
|
+
async transform({ data }, controller) {
|
|
1946
|
+
if (data === "[DONE]") {
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
controller.enqueue(await safeParseJSON({ text: data, schema }));
|
|
1950
|
+
}
|
|
1951
|
+
})
|
|
1952
|
+
);
|
|
1953
|
+
}
|
|
1954
|
+
async function parseProviderOptions({
|
|
1955
|
+
provider,
|
|
1956
|
+
providerOptions,
|
|
1957
|
+
schema
|
|
1958
|
+
}) {
|
|
1959
|
+
if ((providerOptions == null ? void 0 : providerOptions[provider]) == null) {
|
|
1960
|
+
return void 0;
|
|
1961
|
+
}
|
|
1962
|
+
const parsedProviderOptions = await safeValidateTypes({
|
|
1963
|
+
value: providerOptions[provider],
|
|
1964
|
+
schema
|
|
1965
|
+
});
|
|
1966
|
+
if (!parsedProviderOptions.success) {
|
|
1967
|
+
throw new InvalidArgumentError({
|
|
1968
|
+
argument: "providerOptions",
|
|
1969
|
+
message: `invalid ${provider} provider options`,
|
|
1970
|
+
cause: parsedProviderOptions.error
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
return parsedProviderOptions.value;
|
|
1974
|
+
}
|
|
1975
|
+
var getOriginalFetch2 = () => globalThis.fetch;
|
|
1976
|
+
var postJsonToApi = async ({
|
|
1977
|
+
url,
|
|
1978
|
+
headers,
|
|
1979
|
+
body,
|
|
1980
|
+
failedResponseHandler,
|
|
1981
|
+
successfulResponseHandler,
|
|
1982
|
+
abortSignal,
|
|
1983
|
+
fetch
|
|
1984
|
+
}) => postToApi({
|
|
1985
|
+
url,
|
|
1986
|
+
headers: {
|
|
1987
|
+
"Content-Type": "application/json",
|
|
1988
|
+
...headers
|
|
1989
|
+
},
|
|
1990
|
+
body: {
|
|
1991
|
+
content: JSON.stringify(body),
|
|
1992
|
+
values: body
|
|
1993
|
+
},
|
|
1994
|
+
failedResponseHandler,
|
|
1995
|
+
successfulResponseHandler,
|
|
1996
|
+
abortSignal,
|
|
1997
|
+
fetch
|
|
1998
|
+
});
|
|
1999
|
+
var postFormDataToApi = async ({
|
|
2000
|
+
url,
|
|
2001
|
+
headers,
|
|
2002
|
+
formData,
|
|
2003
|
+
failedResponseHandler,
|
|
2004
|
+
successfulResponseHandler,
|
|
2005
|
+
abortSignal,
|
|
2006
|
+
fetch
|
|
2007
|
+
}) => postToApi({
|
|
2008
|
+
url,
|
|
2009
|
+
headers,
|
|
2010
|
+
body: {
|
|
2011
|
+
content: formData,
|
|
2012
|
+
values: Object.fromEntries(formData.entries())
|
|
2013
|
+
},
|
|
2014
|
+
failedResponseHandler,
|
|
2015
|
+
successfulResponseHandler,
|
|
2016
|
+
abortSignal,
|
|
2017
|
+
fetch
|
|
2018
|
+
});
|
|
2019
|
+
var postToApi = async ({
|
|
2020
|
+
url,
|
|
2021
|
+
headers = {},
|
|
2022
|
+
body,
|
|
2023
|
+
successfulResponseHandler,
|
|
2024
|
+
failedResponseHandler,
|
|
2025
|
+
abortSignal,
|
|
2026
|
+
fetch = getOriginalFetch2()
|
|
2027
|
+
}) => {
|
|
2028
|
+
try {
|
|
2029
|
+
const response = await fetch(url, {
|
|
2030
|
+
method: "POST",
|
|
2031
|
+
headers: removeUndefinedEntries(headers),
|
|
2032
|
+
body: body.content,
|
|
2033
|
+
signal: abortSignal
|
|
2034
|
+
});
|
|
2035
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2036
|
+
if (!response.ok) {
|
|
2037
|
+
let errorInformation;
|
|
2038
|
+
try {
|
|
2039
|
+
errorInformation = await failedResponseHandler({
|
|
2040
|
+
response,
|
|
2041
|
+
url,
|
|
2042
|
+
requestBodyValues: body.values
|
|
2043
|
+
});
|
|
2044
|
+
} catch (error) {
|
|
2045
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2046
|
+
throw error;
|
|
2047
|
+
}
|
|
2048
|
+
throw new APICallError({
|
|
2049
|
+
message: "Failed to process error response",
|
|
2050
|
+
cause: error,
|
|
2051
|
+
statusCode: response.status,
|
|
2052
|
+
url,
|
|
2053
|
+
responseHeaders,
|
|
2054
|
+
requestBodyValues: body.values
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
throw errorInformation.value;
|
|
2058
|
+
}
|
|
2059
|
+
try {
|
|
2060
|
+
return await successfulResponseHandler({
|
|
2061
|
+
response,
|
|
2062
|
+
url,
|
|
2063
|
+
requestBodyValues: body.values
|
|
2064
|
+
});
|
|
2065
|
+
} catch (error) {
|
|
2066
|
+
if (error instanceof Error) {
|
|
2067
|
+
if (isAbortError(error) || APICallError.isInstance(error)) {
|
|
2068
|
+
throw error;
|
|
2069
|
+
}
|
|
2070
|
+
}
|
|
2071
|
+
throw new APICallError({
|
|
2072
|
+
message: "Failed to process successful response",
|
|
2073
|
+
cause: error,
|
|
2074
|
+
statusCode: response.status,
|
|
2075
|
+
url,
|
|
2076
|
+
responseHeaders,
|
|
2077
|
+
requestBodyValues: body.values
|
|
2078
|
+
});
|
|
2079
|
+
}
|
|
2080
|
+
} catch (error) {
|
|
2081
|
+
throw handleFetchError({ error, url, requestBodyValues: body.values });
|
|
2082
|
+
}
|
|
2083
|
+
};
|
|
2084
|
+
function tool(tool2) {
|
|
2085
|
+
return tool2;
|
|
2086
|
+
}
|
|
2087
|
+
function createProviderDefinedToolFactory({
|
|
2088
|
+
id,
|
|
2089
|
+
name: name14,
|
|
2090
|
+
inputSchema
|
|
2091
|
+
}) {
|
|
2092
|
+
return ({
|
|
2093
|
+
execute,
|
|
2094
|
+
outputSchema,
|
|
2095
|
+
toModelOutput,
|
|
2096
|
+
onInputStart,
|
|
2097
|
+
onInputDelta,
|
|
2098
|
+
onInputAvailable,
|
|
2099
|
+
...args
|
|
2100
|
+
}) => tool({
|
|
2101
|
+
type: "provider-defined",
|
|
2102
|
+
id,
|
|
2103
|
+
name: name14,
|
|
2104
|
+
args,
|
|
2105
|
+
inputSchema,
|
|
2106
|
+
outputSchema,
|
|
2107
|
+
execute,
|
|
2108
|
+
toModelOutput,
|
|
2109
|
+
onInputStart,
|
|
2110
|
+
onInputDelta,
|
|
2111
|
+
onInputAvailable
|
|
2112
|
+
});
|
|
2113
|
+
}
|
|
2114
|
+
function createProviderDefinedToolFactoryWithOutputSchema({
|
|
2115
|
+
id,
|
|
2116
|
+
name: name14,
|
|
2117
|
+
inputSchema,
|
|
2118
|
+
outputSchema
|
|
2119
|
+
}) {
|
|
2120
|
+
return ({
|
|
2121
|
+
execute,
|
|
2122
|
+
toModelOutput,
|
|
2123
|
+
onInputStart,
|
|
2124
|
+
onInputDelta,
|
|
2125
|
+
onInputAvailable,
|
|
2126
|
+
...args
|
|
2127
|
+
}) => tool({
|
|
2128
|
+
type: "provider-defined",
|
|
2129
|
+
id,
|
|
2130
|
+
name: name14,
|
|
2131
|
+
args,
|
|
2132
|
+
inputSchema,
|
|
2133
|
+
outputSchema,
|
|
2134
|
+
execute,
|
|
2135
|
+
toModelOutput,
|
|
2136
|
+
onInputStart,
|
|
2137
|
+
onInputDelta,
|
|
2138
|
+
onInputAvailable
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
async function resolve(value) {
|
|
2142
|
+
if (typeof value === "function") {
|
|
2143
|
+
value = value();
|
|
2144
|
+
}
|
|
2145
|
+
return Promise.resolve(value);
|
|
2146
|
+
}
|
|
2147
|
+
var createJsonErrorResponseHandler = ({
|
|
2148
|
+
errorSchema,
|
|
2149
|
+
errorToMessage,
|
|
2150
|
+
isRetryable
|
|
2151
|
+
}) => async ({ response, url, requestBodyValues }) => {
|
|
2152
|
+
const responseBody = await response.text();
|
|
2153
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2154
|
+
if (responseBody.trim() === "") {
|
|
2155
|
+
return {
|
|
2156
|
+
responseHeaders,
|
|
2157
|
+
value: new APICallError({
|
|
2158
|
+
message: response.statusText,
|
|
2159
|
+
url,
|
|
2160
|
+
requestBodyValues,
|
|
2161
|
+
statusCode: response.status,
|
|
2162
|
+
responseHeaders,
|
|
2163
|
+
responseBody,
|
|
2164
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2165
|
+
})
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
try {
|
|
2169
|
+
const parsedError = await parseJSON({
|
|
2170
|
+
text: responseBody,
|
|
2171
|
+
schema: errorSchema
|
|
2172
|
+
});
|
|
2173
|
+
return {
|
|
2174
|
+
responseHeaders,
|
|
2175
|
+
value: new APICallError({
|
|
2176
|
+
message: errorToMessage(parsedError),
|
|
2177
|
+
url,
|
|
2178
|
+
requestBodyValues,
|
|
2179
|
+
statusCode: response.status,
|
|
2180
|
+
responseHeaders,
|
|
2181
|
+
responseBody,
|
|
2182
|
+
data: parsedError,
|
|
2183
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response, parsedError)
|
|
2184
|
+
})
|
|
2185
|
+
};
|
|
2186
|
+
} catch (parseError) {
|
|
2187
|
+
return {
|
|
2188
|
+
responseHeaders,
|
|
2189
|
+
value: new APICallError({
|
|
2190
|
+
message: response.statusText,
|
|
2191
|
+
url,
|
|
2192
|
+
requestBodyValues,
|
|
2193
|
+
statusCode: response.status,
|
|
2194
|
+
responseHeaders,
|
|
2195
|
+
responseBody,
|
|
2196
|
+
isRetryable: isRetryable == null ? void 0 : isRetryable(response)
|
|
2197
|
+
})
|
|
2198
|
+
};
|
|
2199
|
+
}
|
|
2200
|
+
};
|
|
2201
|
+
var createEventSourceResponseHandler = (chunkSchema) => async ({ response }) => {
|
|
2202
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2203
|
+
if (response.body == null) {
|
|
2204
|
+
throw new EmptyResponseBodyError({});
|
|
2205
|
+
}
|
|
2206
|
+
return {
|
|
2207
|
+
responseHeaders,
|
|
2208
|
+
value: parseJsonEventStream({
|
|
2209
|
+
stream: response.body,
|
|
2210
|
+
schema: chunkSchema
|
|
2211
|
+
})
|
|
2212
|
+
};
|
|
2213
|
+
};
|
|
2214
|
+
var createJsonResponseHandler = (responseSchema) => async ({ response, url, requestBodyValues }) => {
|
|
2215
|
+
const responseBody = await response.text();
|
|
2216
|
+
const parsedResult = await safeParseJSON({
|
|
2217
|
+
text: responseBody,
|
|
2218
|
+
schema: responseSchema
|
|
2219
|
+
});
|
|
2220
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2221
|
+
if (!parsedResult.success) {
|
|
2222
|
+
throw new APICallError({
|
|
2223
|
+
message: "Invalid JSON response",
|
|
2224
|
+
cause: parsedResult.error,
|
|
2225
|
+
statusCode: response.status,
|
|
2226
|
+
responseHeaders,
|
|
2227
|
+
responseBody,
|
|
2228
|
+
url,
|
|
2229
|
+
requestBodyValues
|
|
2230
|
+
});
|
|
2231
|
+
}
|
|
2232
|
+
return {
|
|
2233
|
+
responseHeaders,
|
|
2234
|
+
value: parsedResult.value,
|
|
2235
|
+
rawValue: parsedResult.rawValue
|
|
2236
|
+
};
|
|
2237
|
+
};
|
|
2238
|
+
var createBinaryResponseHandler = () => async ({ response, url, requestBodyValues }) => {
|
|
2239
|
+
const responseHeaders = extractResponseHeaders(response);
|
|
2240
|
+
if (!response.body) {
|
|
2241
|
+
throw new APICallError({
|
|
2242
|
+
message: "Response body is empty",
|
|
2243
|
+
url,
|
|
2244
|
+
requestBodyValues,
|
|
2245
|
+
statusCode: response.status,
|
|
2246
|
+
responseHeaders,
|
|
2247
|
+
responseBody: void 0
|
|
2248
|
+
});
|
|
2249
|
+
}
|
|
2250
|
+
try {
|
|
2251
|
+
const buffer = await response.arrayBuffer();
|
|
2252
|
+
return {
|
|
2253
|
+
responseHeaders,
|
|
2254
|
+
value: new Uint8Array(buffer)
|
|
2255
|
+
};
|
|
2256
|
+
} catch (error) {
|
|
2257
|
+
throw new APICallError({
|
|
2258
|
+
message: "Failed to read response as array buffer",
|
|
2259
|
+
url,
|
|
2260
|
+
requestBodyValues,
|
|
2261
|
+
statusCode: response.status,
|
|
2262
|
+
responseHeaders,
|
|
2263
|
+
responseBody: void 0,
|
|
2264
|
+
cause: error
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
var { btoa, atob } = globalThis;
|
|
2269
|
+
function convertBase64ToUint8Array(base64String) {
|
|
2270
|
+
const base64Url = base64String.replace(/-/g, "+").replace(/_/g, "/");
|
|
2271
|
+
const latin1string = atob(base64Url);
|
|
2272
|
+
return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
|
|
2273
|
+
}
|
|
2274
|
+
function convertUint8ArrayToBase64(array) {
|
|
2275
|
+
let latin1string = "";
|
|
2276
|
+
for (let i = 0; i < array.length; i++) {
|
|
2277
|
+
latin1string += String.fromCodePoint(array[i]);
|
|
2278
|
+
}
|
|
2279
|
+
return btoa(latin1string);
|
|
2280
|
+
}
|
|
2281
|
+
function convertToBase64(value) {
|
|
2282
|
+
return value instanceof Uint8Array ? convertUint8ArrayToBase64(value) : value;
|
|
2283
|
+
}
|
|
2284
|
+
function withoutTrailingSlash(url) {
|
|
2285
|
+
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
2286
|
+
}
|
|
2287
|
+
|
|
2288
|
+
export { AISDKError, APICallError, EmptyResponseBodyError, EventSourceParserStream, InvalidArgumentError, InvalidPromptError, InvalidResponseDataError, JSONParseError, NoSuchModelError, TooManyEmbeddingValuesForCallError, TypeValidationError, UnsupportedFunctionalityError, combineHeaders, convertBase64ToUint8Array, convertToBase64, createBinaryResponseHandler, createEventSourceResponseHandler, createJsonErrorResponseHandler, createJsonResponseHandler, createProviderDefinedToolFactory, createProviderDefinedToolFactoryWithOutputSchema, esm_default, generateId, isParsableJson, loadApiKey, parseProviderOptions, postFormDataToApi, postJsonToApi, resolve, withoutTrailingSlash };
|
|
2289
|
+
//# sourceMappingURL=chunk-N7F33WAD.js.map
|
|
2290
|
+
//# sourceMappingURL=chunk-N7F33WAD.js.map
|