@mastra/core 1.87.0-alpha.0 → 1.87.0-alpha.2
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/dist/_types/@ai-sdk_anthropic@3.0.137/dist/index.d.ts +2 -2
- package/dist/_types/@ai-sdk_google@3.0.140/dist/index.d.ts +2 -2
- package/dist/_types/@ai-sdk_openai@3.0.135/dist/index.d.ts +2 -2
- package/dist/a2a/index.cjs +1 -1
- package/dist/a2a/index.js +1 -1
- package/dist/agent/durable/index.cjs +2 -1
- package/dist/agent/durable/index.d.ts +1 -0
- package/dist/agent/durable/index.js +2 -2
- package/dist/agent/durable/run-registry.d.ts +12 -1
- package/dist/agent/durable/types.d.ts +2 -0
- package/dist/agent/durable/workflows/finalize-run.d.ts +2 -1
- package/dist/agent/index.cjs +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/agent/message-list/index.cjs +1 -1
- package/dist/agent/message-list/index.js +1 -1
- package/dist/agent/thread-stream-runtime.d.ts +3 -1
- package/dist/agent-builder/ee/index.cjs +1 -1
- package/dist/agent-builder/ee/index.js +1 -1
- package/dist/agent-controller/index.cjs +1 -1
- package/dist/agent-controller/index.js +1 -1
- package/dist/{agent-controller-B8LoFdtu.js → agent-controller-Dc58ARqw.js} +6 -6
- package/dist/{agent-controller-DSnFynpa.cjs → agent-controller-v64JbuDa.cjs} +6 -6
- package/dist/background-tasks/index.cjs +1 -1
- package/dist/background-tasks/index.js +1 -1
- package/dist/{background-tasks-Ci5h0dhj.cjs → background-tasks-DgiQNKh7.cjs} +1 -1
- package/dist/{background-tasks-IW7M4iD2.js → background-tasks-E-Jjxks4.js} +1 -1
- package/dist/browser/index.cjs +1 -1
- package/dist/browser/index.js +1 -1
- package/dist/{builder-14Uptu8y.cjs → builder-Dfp6Ckjr.cjs} +2 -2
- package/dist/{builder-DI2c2xjy.js → builder-Dh175HnQ.js} +2 -2
- package/dist/capabilities/302ai.json +197 -197
- package/dist/capabilities/abliteratedllm.json +27 -27
- package/dist/capabilities/abliteration-ai.json +10 -10
- package/dist/capabilities/above.json +22 -22
- package/dist/capabilities/adaption.json +12 -12
- package/dist/capabilities/adzuki.json +29 -29
- package/dist/capabilities/agentrouter.json +8 -8
- package/dist/capabilities/agnes.json +3 -3
- package/dist/capabilities/ai-router.json +5 -5
- package/dist/capabilities/aiand.json +23 -23
- package/dist/capabilities/aigrow.json +12 -12
- package/dist/capabilities/aimlapi.json +151 -152
- package/dist/capabilities/aixy.json +23 -23
- package/dist/capabilities/aki-io.json +14 -14
- package/dist/capabilities/alibaba-cn.json +92 -92
- package/dist/capabilities/alibaba-coding-plan-cn.json +5 -5
- package/dist/capabilities/alibaba-coding-plan.json +5 -5
- package/dist/capabilities/alibaba-token-plan-cn.json +53 -53
- package/dist/capabilities/alibaba-token-plan.json +51 -51
- package/dist/capabilities/alibaba.json +62 -62
- package/dist/capabilities/ambient.json +10 -10
- package/dist/capabilities/amd.json +8 -8
- package/dist/capabilities/anthropic.json +34 -34
- package/dist/capabilities/anyapi.json +18 -18
- package/dist/capabilities/apiko.json +4 -4
- package/dist/capabilities/arcee.json +6 -6
- package/dist/capabilities/augure.json +7 -7
- package/dist/capabilities/auriko.json +21 -21
- package/dist/capabilities/bailing.json +5 -5
- package/dist/capabilities/baseten.json +28 -28
- package/dist/capabilities/bee.json +2 -2
- package/dist/capabilities/berget.json +4 -4
- package/dist/capabilities/bothub.json +16 -16
- package/dist/capabilities/boundless.json +39 -39
- package/dist/capabilities/bumo.json +42 -42
- package/dist/capabilities/byteplus.json +29 -29
- package/dist/capabilities/cerebras.json +4 -4
- package/dist/capabilities/cheapaimodel.json +10 -10
- package/dist/capabilities/cheapest-token.json +29 -29
- package/dist/capabilities/chutes.json +5 -5
- package/dist/capabilities/cline-pass.json +39 -39
- package/dist/capabilities/cloudcode.json +8 -8
- package/dist/capabilities/cloudflare-workers-ai.json +18 -18
- package/dist/capabilities/commandcode.json +154 -154
- package/dist/capabilities/concentrate.json +269 -269
- package/dist/capabilities/cortecs.json +113 -113
- package/dist/capabilities/crossmodel.json +168 -168
- package/dist/capabilities/crusoe.json +9 -9
- package/dist/capabilities/daoxe.json +9 -9
- package/dist/capabilities/databricks.json +128 -128
- package/dist/capabilities/deepinfra.json +99 -99
- package/dist/capabilities/deepseek.json +4 -4
- package/dist/capabilities/digitalocean.json +117 -117
- package/dist/capabilities/dothoosh.json +30 -30
- package/dist/capabilities/doubleword.json +27 -27
- package/dist/capabilities/edenai.json +901 -1734
- package/dist/capabilities/empiriolabs.json +175 -175
- package/dist/capabilities/engy.json +21 -21
- package/dist/capabilities/evroc.json +13 -13
- package/dist/capabilities/ezkielyna.json +8 -8
- package/dist/capabilities/fastrouter.json +78 -78
- package/dist/capabilities/fireworks-ai.json +68 -68
- package/dist/capabilities/freemodel.json +21 -21
- package/dist/capabilities/frogbot.json +96 -96
- package/dist/capabilities/gisoo.json +17 -17
- package/dist/capabilities/gmicloud.json +12 -12
- package/dist/capabilities/google.json +51 -51
- package/dist/capabilities/graphn.json +16 -16
- package/dist/capabilities/greenpt.json +35 -35
- package/dist/capabilities/groq.json +2 -2
- package/dist/capabilities/helicone.json +85 -85
- package/dist/capabilities/hopper.json +2 -2
- package/dist/capabilities/hostinger-router.json +13 -13
- package/dist/capabilities/hpc-ai.json +4 -4
- package/dist/capabilities/huawei-maas.json +12 -12
- package/dist/capabilities/hubris.json +29 -29
- package/dist/capabilities/huggingface.json +89 -89
- package/dist/capabilities/humain.json +2 -2
- package/dist/capabilities/hyper.json +27 -27
- package/dist/capabilities/impossibl.json +149 -149
- package/dist/capabilities/inception.json +3 -3
- package/dist/capabilities/inco.json +4 -4
- package/dist/capabilities/infer.json +12 -12
- package/dist/capabilities/inferall.json +10 -10
- package/dist/capabilities/inference-coop.json +11 -11
- package/dist/capabilities/inferenceapis.json +17 -17
- package/dist/capabilities/inferris.json +4 -4
- package/dist/capabilities/infersia.json +12 -12
- package/dist/capabilities/infomaniak.json +3 -3
- package/dist/capabilities/io-net.json +2 -2
- package/dist/capabilities/isoquant.json +4 -4
- package/dist/capabilities/iteracompute.json +44 -44
- package/dist/capabilities/jad-ai.json +2 -2
- package/dist/capabilities/jalapeno.json +11 -11
- package/dist/capabilities/jiekou.json +68 -68
- package/dist/capabilities/jzstoken.json +48 -48
- package/dist/capabilities/keln.json +20 -20
- package/dist/capabilities/kenari.json +125 -125
- package/dist/capabilities/kilo.json +623 -623
- package/dist/capabilities/kimi-code-plan-cn.json +4 -4
- package/dist/capabilities/kimi-code-plan-global.json +4 -4
- package/dist/capabilities/kitani.json +2 -2
- package/dist/capabilities/klavo.json +18 -18
- package/dist/capabilities/korouter.json +30 -30
- package/dist/capabilities/kunavo.json +6 -6
- package/dist/capabilities/liquid.json +12 -12
- package/dist/capabilities/lithosai.json +2 -2
- package/dist/capabilities/llmgateway-providers.json +916 -916
- package/dist/capabilities/llmgateway.json +339 -339
- package/dist/capabilities/llmtr.json +31 -31
- package/dist/capabilities/longcat.json +2 -2
- package/dist/capabilities/lowrouter.json +51 -51
- package/dist/capabilities/lyceum.json +4 -4
- package/dist/capabilities/melious.json +12 -12
- package/dist/capabilities/merge-gateway.json +255 -254
- package/dist/capabilities/meta.json +7 -7
- package/dist/capabilities/minimax-cn-coding-plan.json +2 -2
- package/dist/capabilities/minimax-cn.json +5 -5
- package/dist/capabilities/minimax-coding-plan.json +2 -2
- package/dist/capabilities/minimax.json +5 -5
- package/dist/capabilities/mistral.json +18 -18
- package/dist/capabilities/mixlayer.json +5 -5
- package/dist/capabilities/modal.json +10 -10
- package/dist/capabilities/model-oracle-ai.json +21 -21
- package/dist/capabilities/modelis.json +19 -19
- package/dist/capabilities/modular.json +10 -10
- package/dist/capabilities/moneo.json +14 -14
- package/dist/capabilities/moonshotai-cn.json +5 -5
- package/dist/capabilities/moonshotai.json +5 -5
- package/dist/capabilities/morph.json +14 -14
- package/dist/capabilities/munito-eu.json +8 -8
- package/dist/capabilities/munito.json +9 -9
- package/dist/capabilities/nan.json +28 -28
- package/dist/capabilities/nano-gpt.json +586 -584
- package/dist/capabilities/nearai.json +87 -87
- package/dist/capabilities/nebius.json +26 -26
- package/dist/capabilities/neon.json +122 -122
- package/dist/capabilities/neuralwatt.json +45 -45
- package/dist/capabilities/nokeep.json +2 -2
- package/dist/capabilities/novita-ai.json +163 -163
- package/dist/capabilities/nvidia.json +22 -22
- package/dist/capabilities/oathbreaker.json +2 -2
- package/dist/capabilities/obscurify.json +25 -25
- package/dist/capabilities/oci.json +5 -5
- package/dist/capabilities/ofox.json +293 -293
- package/dist/capabilities/ollama-cloud.json +58 -58
- package/dist/capabilities/openai.json +55 -55
- package/dist/capabilities/opencode-go.json +86 -86
- package/dist/capabilities/openreason.json +4 -4
- package/dist/capabilities/openrouter.json +529 -535
- package/dist/capabilities/opper.json +27 -27
- package/dist/capabilities/orcarouter.json +192 -192
- package/dist/capabilities/outerlabs.json +31 -31
- package/dist/capabilities/ovhcloud.json +20 -20
- package/dist/capabilities/pareto.json +5 -5
- package/dist/capabilities/pendra.json +4 -4
- package/dist/capabilities/perplexity-agent.json +64 -64
- package/dist/capabilities/perplexity.json +2 -2
- package/dist/capabilities/phala.json +22 -22
- package/dist/capabilities/pioneer.json +20 -20
- package/dist/capabilities/poe.json +113 -113
- package/dist/capabilities/poolside.json +3 -3
- package/dist/capabilities/powerspring.json +9 -9
- package/dist/capabilities/primalabs.json +10 -10
- package/dist/capabilities/prime.json +110 -110
- package/dist/capabilities/privatemode-ai.json +12 -12
- package/dist/capabilities/proxystacks.json +7 -7
- package/dist/capabilities/qiniu-ai.json +14 -14
- package/dist/capabilities/refuseless.json +7 -7
- package/dist/capabilities/regolo-ai.json +8 -8
- package/dist/capabilities/requesty.json +172 -172
- package/dist/capabilities/ruapi.json +15 -15
- package/dist/capabilities/runcrate.json +6 -6
- package/dist/capabilities/runinfra.json +13 -13
- package/dist/capabilities/sakana.json +7 -7
- package/dist/capabilities/sambanova.json +9 -9
- package/dist/capabilities/sandbase.json +24 -24
- package/dist/capabilities/sarvam.json +12 -12
- package/dist/capabilities/scaleway.json +18 -18
- package/dist/capabilities/scnet-token-plan.json +9 -9
- package/dist/capabilities/scx-ai.json +30 -30
- package/dist/capabilities/sensenova.json +12 -12
- package/dist/capabilities/siliconflow-cn.json +45 -45
- package/dist/capabilities/siliconflow.json +53 -53
- package/dist/capabilities/snowflake-cortex.json +22 -22
- package/dist/capabilities/sokkan.json +7 -7
- package/dist/capabilities/sparrowcodes.json +19 -19
- package/dist/capabilities/standardcompute.json +89 -89
- package/dist/capabilities/steadyrouter.json +41 -41
- package/dist/capabilities/stepfun-ai-step-plan.json +5 -5
- package/dist/capabilities/stepfun-ai.json +5 -5
- package/dist/capabilities/stepfun-step-plan.json +5 -5
- package/dist/capabilities/stepfun.json +5 -5
- package/dist/capabilities/stepping-stone.json +11 -11
- package/dist/capabilities/subconscious.json +2 -2
- package/dist/capabilities/synthetic.json +10 -10
- package/dist/capabilities/synthorai.json +23 -23
- package/dist/capabilities/teamorouter.json +25 -25
- package/dist/capabilities/teapot-router.json +13 -13
- package/dist/capabilities/tencent-token-plan.json +40 -40
- package/dist/capabilities/tencent-tokenhub.json +45 -45
- package/dist/capabilities/tensorx.json +27 -27
- package/dist/capabilities/the-grid-ai.json +37 -37
- package/dist/capabilities/thinkingmachines.json +74 -74
- package/dist/capabilities/tinfoil.json +12 -12
- package/dist/capabilities/toapis.json +2 -2
- package/dist/capabilities/togetherai.json +53 -53
- package/dist/capabilities/tokengo.json +23 -23
- package/dist/capabilities/tokenify.json +9 -9
- package/dist/capabilities/trustedrouter.json +4 -4
- package/dist/capabilities/trustedtokens.json +12 -12
- package/dist/capabilities/umans-ai-coding-plan.json +14 -14
- package/dist/capabilities/umans-ai.json +10 -10
- package/dist/capabilities/unrestricted.json +8 -8
- package/dist/capabilities/uplinkswitch.json +23 -23
- package/dist/capabilities/upstage.json +7 -7
- package/dist/capabilities/vancine.json +26 -26
- package/dist/capabilities/vercel.json +576 -576
- package/dist/capabilities/vivgrid.json +85 -85
- package/dist/capabilities/volcengine-coding-plan.json +36 -27
- package/dist/capabilities/volcengine.json +27 -27
- package/dist/capabilities/vultr.json +31 -31
- package/dist/capabilities/wafer.ai.json +14 -14
- package/dist/capabilities/wallaby.json +5 -5
- package/dist/capabilities/wally.json +11 -11
- package/dist/capabilities/wandb.json +11 -11
- package/dist/capabilities/watt.json +24 -24
- package/dist/capabilities/xai.json +6 -6
- package/dist/capabilities/xpersona.json +12 -12
- package/dist/capabilities/xxapi.json +29 -29
- package/dist/capabilities/zai-coding-plan.json +6 -6
- package/dist/capabilities/zai.json +32 -32
- package/dist/capabilities/zenifra.json +27 -27
- package/dist/capabilities/zenmux.json +186 -186
- package/dist/capabilities/zerogpu.json +14 -14
- package/dist/capabilities/zhipuai-coding-plan.json +8 -8
- package/dist/capabilities/zhipuai.json +31 -31
- package/dist/capabilities/zro.json +6 -6
- package/dist/channels/agent-channels.d.ts +7 -0
- package/dist/channels/attach-file-tool.d.ts +22 -0
- package/dist/channels/index.cjs +11 -2
- package/dist/channels/index.d.ts +10 -0
- package/dist/channels/index.js +3 -3
- package/dist/channels/reply-guidance-processor.d.ts +26 -0
- package/dist/channels/reply-mode.d.ts +66 -0
- package/dist/channels/reply-reminder-processor.d.ts +23 -0
- package/dist/channels/reply-tool.d.ts +43 -0
- package/dist/channels/thread-link-processor.d.ts +48 -0
- package/dist/channels/thread-lookup.d.ts +16 -0
- package/dist/channels/tool-announcement-processor.d.ts +29 -0
- package/dist/channels/types.d.ts +25 -0
- package/dist/{channels-Wh32drgu.js → channels-0AO7PMJF.js} +99 -2
- package/dist/{channels-tVV_de9Q.cjs → channels-BZL9RT2i.cjs} +122 -1
- package/dist/coding-agent/index.cjs +1 -1
- package/dist/coding-agent/index.js +1 -1
- package/dist/datasets/experiment/index.d.ts +1 -1
- package/dist/datasets/experiment/item.d.ts +4 -3
- package/dist/datasets/experiment/scorer.d.ts +34 -11
- package/dist/datasets/index.cjs +3 -2
- package/dist/datasets/index.js +3 -3
- package/dist/{dist-ByO0vuJJ-BjMue5_p.cjs → dist-CufwpBZM-CwERFaas.cjs} +4 -4
- package/dist/{dist-ByO0vuJJ-CCXLBnvJ.js → dist-CufwpBZM-DK14Qe0Z.js} +4 -4
- package/dist/docs/SKILL.md +2 -1
- package/dist/docs/assets/SOURCE_MAP.json +743 -743
- package/dist/docs/references/docs-channels.md +43 -0
- package/dist/docs/references/docs-evals-experiments.md +13 -3
- package/dist/docs/references/reference-agents-durable-agent.md +2 -0
- package/dist/docs/references/reference-channels-thread-link.md +67 -0
- package/dist/docs/references/reference-workspace-factory-sandbox.md +2 -1
- package/dist/docs/references/reference.md +1 -0
- package/dist/evals/index.cjs +1 -1
- package/dist/evals/index.js +1 -1
- package/dist/evals/scoreTraces/index.cjs +1 -1
- package/dist/evals/scoreTraces/index.js +1 -1
- package/dist/harness/index.cjs +1 -1
- package/dist/harness/index.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/importers/host.d.ts +7 -1
- package/dist/knowledge/importers/runner.d.ts +12 -0
- package/dist/knowledge/importers/types.d.ts +2 -0
- package/dist/knowledge/index.cjs +82 -6
- package/dist/knowledge/index.js +82 -6
- package/dist/llm/index.cjs +3 -3
- package/dist/llm/index.js +3 -3
- package/dist/llm/model/provider-types.generated.d.ts +7397 -7534
- package/dist/{llm-B1zaFLYZ.js → llm-B46V7Mi7.js} +2 -2
- package/dist/{llm-BAiOsNAP.cjs → llm-B4AeSFvV.cjs} +2 -2
- package/dist/loop/index.cjs +2 -2
- package/dist/loop/index.js +2 -2
- package/dist/{manager-ChK9GdGz.js → manager-BRAvwB9b.js} +120 -70
- package/dist/{manager-BVX9nVrM.cjs → manager-BwDxA1Nn.cjs} +125 -69
- package/dist/mastra/index.cjs +1 -1
- package/dist/mastra/index.js +1 -1
- package/dist/{mastra-CUGfgEpZ.js → mastra-CIx6qEq2.js} +16 -16
- package/dist/{mastra-HSmofHEJ.cjs → mastra-DBhdD172.cjs} +16 -16
- package/dist/memory/index.cjs +3 -3
- package/dist/memory/index.js +3 -3
- package/dist/{message-list-Cj0Sq_JP.cjs → message-list-DfN9mWeN.cjs} +121 -121
- package/dist/{message-list-KRbg-TnI.js → message-list-wI71UGxk.js} +1 -1
- package/dist/{model-C47BJRtR.js → model-CJMsDU8w.js} +1 -1
- package/dist/{model-WahorgzJ.cjs → model-CYhAa5qO.cjs} +1 -1
- package/dist/{netlify-D99AnEhW.cjs → netlify-Bw7Vd58y.cjs} +11 -11
- package/dist/{netlify-CfDXkuLf.js → netlify-C9aJA6Cv.js} +10 -10
- package/dist/notifications/index.cjs +1 -1
- package/dist/notifications/index.js +1 -1
- package/dist/processor-provider/index.cjs +1 -1
- package/dist/processor-provider/index.js +1 -1
- package/dist/processors/index.cjs +2 -2
- package/dist/processors/index.js +2 -2
- package/dist/{provider-registry-CO1NVbO5.cjs → provider-registry-Bn_7VvZ8.cjs} +22046 -22320
- package/dist/{provider-registry-CR385GJ4.js → provider-registry-DOfYSEju.js} +22046 -22320
- package/dist/provider-registry.json +22352 -22626
- package/dist/{registry-generator-Cvp34qcB.cjs → registry-generator-BnK5Npgr.cjs} +1 -1
- package/dist/{registry-generator-B3erRqYS.js → registry-generator-Cw594Ttt.js} +1 -1
- package/dist/{rehydrate-Da4hNuaK.cjs → rehydrate-BWnd_TEx.cjs} +2 -2
- package/dist/{rehydrate-CJBLrZxs.js → rehydrate-Dgqkw7Py.js} +2 -2
- package/dist/relevance/index.cjs +2 -2
- package/dist/relevance/index.js +2 -2
- package/dist/{run-registry-DdeEBsVW.js → run-registry-DhOKJtlb.js} +848 -186
- package/dist/{run-registry-TOOfO3hT.cjs → run-registry-lLRc7EE6.cjs} +883 -185
- package/dist/storage/index.cjs +2 -2
- package/dist/storage/index.js +2 -2
- package/dist/stream/index.cjs +2 -2
- package/dist/stream/index.js +2 -2
- package/dist/{stream-DH7Qgz8l.cjs → stream-BIDts1fZ.cjs} +2 -2
- package/dist/{stream-C5PagEDs.js → stream-C8HKG3qC.js} +2 -2
- package/dist/test-utils/llm-mock.cjs +1 -1
- package/dist/test-utils/llm-mock.js +1 -1
- package/dist/tool-loop-agent/index.cjs +1 -1
- package/dist/tool-loop-agent/index.js +1 -1
- package/dist/{tool-loop-agent-DVYJXlQJ.js → tool-loop-agent-DM5V_0XS.js} +4 -4
- package/dist/{tool-loop-agent-CJTs4T8b.cjs → tool-loop-agent-PEY5a1R6.cjs} +4 -4
- package/dist/{utils-xJi_N6Tx.cjs → utils-CxMSu_wc.cjs} +1 -1
- package/dist/{utils-D8upuTwy.js → utils-DcnKVK34.js} +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.js +1 -1
- package/dist/{validate-DTkW3Vlp.js → validate-Dn750ciE.js} +1 -1
- package/dist/{validate-6eZ8Wssn.cjs → validate-RVKgazCf.cjs} +1 -1
- package/dist/vector/index.cjs +2 -2
- package/dist/vector/index.js +2 -2
- package/dist/worker/index.cjs +1 -1
- package/dist/worker/index.js +1 -1
- package/dist/{worker-24ORi-wV.cjs → worker-CFPu9qwV.cjs} +2 -2
- package/dist/{worker-Dqubrnf8.js → worker-DJPAdazC.js} +2 -2
- package/dist/{worker-BO3u_WjZ.cjs → worker-Dx0ZHMGX.cjs} +2 -2
- package/dist/{worker-DbcFkKJO.js → worker-SDi9jbP5.js} +2 -2
- package/dist/{workflow-wXOf72fO.js → workflow-DkBqNn7X.js} +3 -3
- package/dist/{workflow-D5Fc5ieC.cjs → workflow-ZFOz_365.cjs} +3 -3
- package/dist/workflows/builder/index.cjs +1 -1
- package/dist/workflows/builder/index.js +1 -1
- package/dist/workflows/evented/index.cjs +1 -1
- package/dist/workflows/evented/index.js +1 -1
- package/dist/workflows/index.cjs +4 -4
- package/dist/workflows/index.js +4 -4
- package/package.json +7 -7
- package/src/llm/model/provider-types.generated.d.ts +7397 -7534
- /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/dist/index.d.ts +0 -0
- /package/dist/_types/{@ai-sdk_provider-utils@4.0.66 → @ai-sdk_provider-utils@4.0.67}/package.json +0 -0
|
@@ -6,7 +6,7 @@ const require_signals = require("./signals-CWxAMEmE.cjs");
|
|
|
6
6
|
const require_data_content = require("./data-content-CtK4VoHI.cjs");
|
|
7
7
|
const require_to_prompt = require("./to-prompt-B9eZo2U5.cjs");
|
|
8
8
|
const require_dist = require("./dist-P2rjrlmj.cjs");
|
|
9
|
-
const
|
|
9
|
+
const require_dist_CufwpBZM = require("./dist-CufwpBZM-CwERFaas.cjs");
|
|
10
10
|
const require_dist$1 = require("./dist-CXeCeeW7.cjs");
|
|
11
11
|
const require_deep_equal = require("./deep-equal-TMDmByBC.cjs");
|
|
12
12
|
const require_file = require("./file-BEndQUN1.cjs");
|
|
@@ -1982,7 +1982,7 @@ var name = "AI_InvalidArgumentError";
|
|
|
1982
1982
|
var marker = `vercel.ai.error.${name}`;
|
|
1983
1983
|
var symbol = Symbol.for(marker);
|
|
1984
1984
|
var _a;
|
|
1985
|
-
var InvalidArgumentError = class extends
|
|
1985
|
+
var InvalidArgumentError = class extends require_dist_CufwpBZM.AISDKError {
|
|
1986
1986
|
constructor({ parameter, value, message }) {
|
|
1987
1987
|
super({
|
|
1988
1988
|
name,
|
|
@@ -1993,7 +1993,7 @@ var InvalidArgumentError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
1993
1993
|
this.value = value;
|
|
1994
1994
|
}
|
|
1995
1995
|
static isInstance(error) {
|
|
1996
|
-
return
|
|
1996
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker);
|
|
1997
1997
|
}
|
|
1998
1998
|
};
|
|
1999
1999
|
_a = symbol;
|
|
@@ -2001,7 +2001,7 @@ var name3 = "AI_InvalidToolApprovalError";
|
|
|
2001
2001
|
var marker3 = `vercel.ai.error.${name3}`;
|
|
2002
2002
|
var symbol3 = Symbol.for(marker3);
|
|
2003
2003
|
var _a3;
|
|
2004
|
-
var InvalidToolApprovalError = class extends
|
|
2004
|
+
var InvalidToolApprovalError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2005
2005
|
constructor({ approvalId }) {
|
|
2006
2006
|
super({
|
|
2007
2007
|
name: name3,
|
|
@@ -2011,7 +2011,7 @@ var InvalidToolApprovalError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2011
2011
|
this.approvalId = approvalId;
|
|
2012
2012
|
}
|
|
2013
2013
|
static isInstance(error) {
|
|
2014
|
-
return
|
|
2014
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker3);
|
|
2015
2015
|
}
|
|
2016
2016
|
};
|
|
2017
2017
|
_a3 = symbol3;
|
|
@@ -2019,7 +2019,7 @@ var name4 = "AI_InvalidToolApprovalSignatureError";
|
|
|
2019
2019
|
var marker4 = `vercel.ai.error.${name4}`;
|
|
2020
2020
|
var symbol4 = Symbol.for(marker4);
|
|
2021
2021
|
var _a4;
|
|
2022
|
-
var InvalidToolApprovalSignatureError = class extends
|
|
2022
|
+
var InvalidToolApprovalSignatureError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2023
2023
|
constructor({ approvalId, toolCallId, reason }) {
|
|
2024
2024
|
super({
|
|
2025
2025
|
name: name4,
|
|
@@ -2030,7 +2030,7 @@ var InvalidToolApprovalSignatureError = class extends require_dist_ByO0vuJJ.AISD
|
|
|
2030
2030
|
this.toolCallId = toolCallId;
|
|
2031
2031
|
}
|
|
2032
2032
|
static isInstance(error) {
|
|
2033
|
-
return
|
|
2033
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker4);
|
|
2034
2034
|
}
|
|
2035
2035
|
};
|
|
2036
2036
|
_a4 = symbol4;
|
|
@@ -2038,8 +2038,8 @@ var name5 = "AI_InvalidToolInputError";
|
|
|
2038
2038
|
var marker5 = `vercel.ai.error.${name5}`;
|
|
2039
2039
|
var symbol5 = Symbol.for(marker5);
|
|
2040
2040
|
var _a5;
|
|
2041
|
-
var InvalidToolInputError = class extends
|
|
2042
|
-
constructor({ toolInput, toolName, cause, message = `Invalid input for tool ${toolName}: ${
|
|
2041
|
+
var InvalidToolInputError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2042
|
+
constructor({ toolInput, toolName, cause, message = `Invalid input for tool ${toolName}: ${require_dist_CufwpBZM.getErrorMessage$1(cause)}` }) {
|
|
2043
2043
|
super({
|
|
2044
2044
|
name: name5,
|
|
2045
2045
|
message,
|
|
@@ -2050,7 +2050,7 @@ var InvalidToolInputError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2050
2050
|
this.toolName = toolName;
|
|
2051
2051
|
}
|
|
2052
2052
|
static isInstance(error) {
|
|
2053
|
-
return
|
|
2053
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker5);
|
|
2054
2054
|
}
|
|
2055
2055
|
};
|
|
2056
2056
|
_a5 = symbol5;
|
|
@@ -2058,7 +2058,7 @@ var name6 = "AI_ToolCallNotFoundForApprovalError";
|
|
|
2058
2058
|
var marker6 = `vercel.ai.error.${name6}`;
|
|
2059
2059
|
var symbol6 = Symbol.for(marker6);
|
|
2060
2060
|
var _a6;
|
|
2061
|
-
var ToolCallNotFoundForApprovalError = class extends
|
|
2061
|
+
var ToolCallNotFoundForApprovalError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2062
2062
|
constructor({ toolCallId, approvalId }) {
|
|
2063
2063
|
super({
|
|
2064
2064
|
name: name6,
|
|
@@ -2069,7 +2069,7 @@ var ToolCallNotFoundForApprovalError = class extends require_dist_ByO0vuJJ.AISDK
|
|
|
2069
2069
|
this.approvalId = approvalId;
|
|
2070
2070
|
}
|
|
2071
2071
|
static isInstance(error) {
|
|
2072
|
-
return
|
|
2072
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker6);
|
|
2073
2073
|
}
|
|
2074
2074
|
};
|
|
2075
2075
|
_a6 = symbol6;
|
|
@@ -2077,7 +2077,7 @@ var name7 = "AI_MissingToolResultsError";
|
|
|
2077
2077
|
var marker7 = `vercel.ai.error.${name7}`;
|
|
2078
2078
|
var symbol7 = Symbol.for(marker7);
|
|
2079
2079
|
var _a7;
|
|
2080
|
-
var MissingToolResultsError = class extends
|
|
2080
|
+
var MissingToolResultsError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2081
2081
|
constructor({ toolCallIds }) {
|
|
2082
2082
|
super({
|
|
2083
2083
|
name: name7,
|
|
@@ -2087,7 +2087,7 @@ var MissingToolResultsError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2087
2087
|
this.toolCallIds = toolCallIds;
|
|
2088
2088
|
}
|
|
2089
2089
|
static isInstance(error) {
|
|
2090
|
-
return
|
|
2090
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker7);
|
|
2091
2091
|
}
|
|
2092
2092
|
};
|
|
2093
2093
|
_a7 = symbol7;
|
|
@@ -2095,7 +2095,7 @@ var name9 = "AI_NoObjectGeneratedError";
|
|
|
2095
2095
|
var marker9 = `vercel.ai.error.${name9}`;
|
|
2096
2096
|
var symbol9 = Symbol.for(marker9);
|
|
2097
2097
|
var _a9;
|
|
2098
|
-
var NoObjectGeneratedError = class extends
|
|
2098
|
+
var NoObjectGeneratedError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2099
2099
|
constructor({ message = "No object generated.", cause, text: text2, response, usage, finishReason }) {
|
|
2100
2100
|
super({
|
|
2101
2101
|
name: name9,
|
|
@@ -2109,7 +2109,7 @@ var NoObjectGeneratedError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2109
2109
|
this.finishReason = finishReason;
|
|
2110
2110
|
}
|
|
2111
2111
|
static isInstance(error) {
|
|
2112
|
-
return
|
|
2112
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker9);
|
|
2113
2113
|
}
|
|
2114
2114
|
};
|
|
2115
2115
|
_a9 = symbol9;
|
|
@@ -2117,7 +2117,7 @@ var name10 = "AI_NoOutputGeneratedError";
|
|
|
2117
2117
|
var marker10 = `vercel.ai.error.${name10}`;
|
|
2118
2118
|
var symbol10 = Symbol.for(marker10);
|
|
2119
2119
|
var _a10;
|
|
2120
|
-
var NoOutputGeneratedError = class extends
|
|
2120
|
+
var NoOutputGeneratedError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2121
2121
|
constructor({ message = "No output generated.", cause } = {}) {
|
|
2122
2122
|
super({
|
|
2123
2123
|
name: name10,
|
|
@@ -2127,7 +2127,7 @@ var NoOutputGeneratedError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2127
2127
|
this[_a10] = true;
|
|
2128
2128
|
}
|
|
2129
2129
|
static isInstance(error) {
|
|
2130
|
-
return
|
|
2130
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker10);
|
|
2131
2131
|
}
|
|
2132
2132
|
};
|
|
2133
2133
|
_a10 = symbol10;
|
|
@@ -2135,7 +2135,7 @@ var name14 = "AI_NoSuchToolError";
|
|
|
2135
2135
|
var marker14 = `vercel.ai.error.${name14}`;
|
|
2136
2136
|
var symbol14 = Symbol.for(marker14);
|
|
2137
2137
|
var _a14;
|
|
2138
|
-
var NoSuchToolError = class extends
|
|
2138
|
+
var NoSuchToolError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2139
2139
|
constructor({ toolName, availableTools = void 0, message = `Model tried to call unavailable tool '${toolName}'. ${availableTools === void 0 ? "No tools are available." : `Available tools: ${availableTools.join(", ")}.`}` }) {
|
|
2140
2140
|
super({
|
|
2141
2141
|
name: name14,
|
|
@@ -2146,7 +2146,7 @@ var NoSuchToolError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2146
2146
|
this.availableTools = availableTools;
|
|
2147
2147
|
}
|
|
2148
2148
|
static isInstance(error) {
|
|
2149
|
-
return
|
|
2149
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker14);
|
|
2150
2150
|
}
|
|
2151
2151
|
};
|
|
2152
2152
|
_a14 = symbol14;
|
|
@@ -2154,7 +2154,7 @@ var name15 = "AI_ToolChoiceViolationError";
|
|
|
2154
2154
|
var marker15 = `vercel.ai.error.${name15}`;
|
|
2155
2155
|
var symbol15 = Symbol.for(marker15);
|
|
2156
2156
|
var _a15;
|
|
2157
|
-
var ToolChoiceViolationError = class extends
|
|
2157
|
+
var ToolChoiceViolationError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2158
2158
|
constructor({ toolChoice, finishReason, provider, modelId, content, message = toolChoice.type === "none" ? "Model response contained a tool call even though tool choice was none." : toolChoice.type === "required" ? "Model response did not contain a tool call even though tool choice was required." : `Model response did not contain a call to the required tool '${toolChoice.toolName}'.` }) {
|
|
2159
2159
|
super({
|
|
2160
2160
|
name: name15,
|
|
@@ -2168,7 +2168,7 @@ var ToolChoiceViolationError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2168
2168
|
this.content = content;
|
|
2169
2169
|
}
|
|
2170
2170
|
static isInstance(error) {
|
|
2171
|
-
return
|
|
2171
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker15);
|
|
2172
2172
|
}
|
|
2173
2173
|
};
|
|
2174
2174
|
_a15 = symbol15;
|
|
@@ -2176,8 +2176,8 @@ var name16 = "AI_ToolCallRepairError";
|
|
|
2176
2176
|
var marker16 = `vercel.ai.error.${name16}`;
|
|
2177
2177
|
var symbol16 = Symbol.for(marker16);
|
|
2178
2178
|
var _a16;
|
|
2179
|
-
var ToolCallRepairError = class extends
|
|
2180
|
-
constructor({ cause, originalError, message = `Error repairing tool call: ${
|
|
2179
|
+
var ToolCallRepairError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2180
|
+
constructor({ cause, originalError, message = `Error repairing tool call: ${require_dist_CufwpBZM.getErrorMessage$1(cause)}` }) {
|
|
2181
2181
|
super({
|
|
2182
2182
|
name: name16,
|
|
2183
2183
|
message,
|
|
@@ -2187,11 +2187,11 @@ var ToolCallRepairError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2187
2187
|
this.originalError = originalError;
|
|
2188
2188
|
}
|
|
2189
2189
|
static isInstance(error) {
|
|
2190
|
-
return
|
|
2190
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker16);
|
|
2191
2191
|
}
|
|
2192
2192
|
};
|
|
2193
2193
|
_a16 = symbol16;
|
|
2194
|
-
var UnsupportedModelVersionError = class extends
|
|
2194
|
+
var UnsupportedModelVersionError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2195
2195
|
constructor(options) {
|
|
2196
2196
|
super({
|
|
2197
2197
|
name: "AI_UnsupportedModelVersionError",
|
|
@@ -2206,7 +2206,7 @@ var name17 = "AI_UIMessageStreamError";
|
|
|
2206
2206
|
var marker17 = `vercel.ai.error.${name17}`;
|
|
2207
2207
|
var symbol17 = Symbol.for(marker17);
|
|
2208
2208
|
var _a17;
|
|
2209
|
-
var UIMessageStreamError = class extends
|
|
2209
|
+
var UIMessageStreamError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2210
2210
|
constructor({ chunkType, chunkId, message }) {
|
|
2211
2211
|
super({
|
|
2212
2212
|
name: name17,
|
|
@@ -2217,7 +2217,7 @@ var UIMessageStreamError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2217
2217
|
this.chunkId = chunkId;
|
|
2218
2218
|
}
|
|
2219
2219
|
static isInstance(error) {
|
|
2220
|
-
return
|
|
2220
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker17);
|
|
2221
2221
|
}
|
|
2222
2222
|
};
|
|
2223
2223
|
_a17 = symbol17;
|
|
@@ -2225,7 +2225,7 @@ var name18 = "AI_InvalidDataContentError";
|
|
|
2225
2225
|
var marker18 = `vercel.ai.error.${name18}`;
|
|
2226
2226
|
var symbol18 = Symbol.for(marker18);
|
|
2227
2227
|
var _a18;
|
|
2228
|
-
var InvalidDataContentError = class extends
|
|
2228
|
+
var InvalidDataContentError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2229
2229
|
constructor({ content, cause, message = `Invalid data content. Expected a base64 string, Uint8Array, ArrayBuffer, or Buffer, but got ${typeof content}.` }) {
|
|
2230
2230
|
super({
|
|
2231
2231
|
name: name18,
|
|
@@ -2236,7 +2236,7 @@ var InvalidDataContentError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2236
2236
|
this.content = content;
|
|
2237
2237
|
}
|
|
2238
2238
|
static isInstance(error) {
|
|
2239
|
-
return
|
|
2239
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker18);
|
|
2240
2240
|
}
|
|
2241
2241
|
};
|
|
2242
2242
|
_a18 = symbol18;
|
|
@@ -2244,7 +2244,7 @@ var name19 = "AI_InvalidMessageRoleError";
|
|
|
2244
2244
|
var marker19 = `vercel.ai.error.${name19}`;
|
|
2245
2245
|
var symbol19 = Symbol.for(marker19);
|
|
2246
2246
|
var _a19;
|
|
2247
|
-
var InvalidMessageRoleError = class extends
|
|
2247
|
+
var InvalidMessageRoleError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2248
2248
|
constructor({ role, message = `Invalid message role: '${role}'. Must be one of: "system", "user", "assistant", "tool".` }) {
|
|
2249
2249
|
super({
|
|
2250
2250
|
name: name19,
|
|
@@ -2254,7 +2254,7 @@ var InvalidMessageRoleError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2254
2254
|
this.role = role;
|
|
2255
2255
|
}
|
|
2256
2256
|
static isInstance(error) {
|
|
2257
|
-
return
|
|
2257
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker19);
|
|
2258
2258
|
}
|
|
2259
2259
|
};
|
|
2260
2260
|
_a19 = symbol19;
|
|
@@ -2262,7 +2262,7 @@ var name21 = "AI_RetryError";
|
|
|
2262
2262
|
var marker21 = `vercel.ai.error.${name21}`;
|
|
2263
2263
|
var symbol21 = Symbol.for(marker21);
|
|
2264
2264
|
var _a21;
|
|
2265
|
-
var RetryError = class extends
|
|
2265
|
+
var RetryError = class extends require_dist_CufwpBZM.AISDKError {
|
|
2266
2266
|
constructor({ message, reason, errors }) {
|
|
2267
2267
|
super({
|
|
2268
2268
|
name: name21,
|
|
@@ -2274,7 +2274,7 @@ var RetryError = class extends require_dist_ByO0vuJJ.AISDKError {
|
|
|
2274
2274
|
this.lastError = errors[errors.length - 1];
|
|
2275
2275
|
}
|
|
2276
2276
|
static isInstance(error) {
|
|
2277
|
-
return
|
|
2277
|
+
return require_dist_CufwpBZM.AISDKError.hasMarker(error, marker21);
|
|
2278
2278
|
}
|
|
2279
2279
|
};
|
|
2280
2280
|
_a21 = symbol21;
|
|
@@ -2442,7 +2442,7 @@ function resolveEmbeddingModel(model) {
|
|
|
2442
2442
|
}
|
|
2443
2443
|
function getGlobalProvider() {
|
|
2444
2444
|
var _a23;
|
|
2445
|
-
return (_a23 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a23 :
|
|
2445
|
+
return (_a23 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a23 : require_dist_CufwpBZM.gateway;
|
|
2446
2446
|
}
|
|
2447
2447
|
function getTotalTimeoutMs(timeout) {
|
|
2448
2448
|
if (timeout == null) return;
|
|
@@ -2558,7 +2558,7 @@ var ID3_SCAN_BYTES = 131084;
|
|
|
2558
2558
|
function decodePrefix(data, maxBytes) {
|
|
2559
2559
|
if (typeof data !== "string") return data.length > maxBytes ? data.subarray(0, maxBytes) : data;
|
|
2560
2560
|
const maxChars = Math.ceil(maxBytes / 3) * 4;
|
|
2561
|
-
const bytes =
|
|
2561
|
+
const bytes = require_dist_CufwpBZM.convertBase64ToUint8Array(data.substring(0, Math.min(data.length, maxChars)));
|
|
2562
2562
|
return bytes.length > maxBytes ? bytes.subarray(0, maxBytes) : bytes;
|
|
2563
2563
|
}
|
|
2564
2564
|
function hasID3(bytes) {
|
|
@@ -2578,31 +2578,31 @@ var download = async ({ url, maxBytes, abortSignal }) => {
|
|
|
2578
2578
|
var _a23;
|
|
2579
2579
|
const urlText = url.toString();
|
|
2580
2580
|
try {
|
|
2581
|
-
const headers =
|
|
2582
|
-
const response = await
|
|
2581
|
+
const headers = require_dist_CufwpBZM.withUserAgentSuffix({}, `ai-sdk/${VERSION}`, require_dist_CufwpBZM.getRuntimeEnvironmentUserAgent());
|
|
2582
|
+
const response = await require_dist_CufwpBZM.fetchWithValidatedRedirects({
|
|
2583
2583
|
url: urlText,
|
|
2584
2584
|
headers,
|
|
2585
2585
|
abortSignal
|
|
2586
2586
|
});
|
|
2587
2587
|
if (!response.ok) {
|
|
2588
|
-
await
|
|
2589
|
-
throw new
|
|
2588
|
+
await require_dist_CufwpBZM.cancelResponseBody(response);
|
|
2589
|
+
throw new require_dist_CufwpBZM.DownloadError({
|
|
2590
2590
|
url: urlText,
|
|
2591
2591
|
statusCode: response.status,
|
|
2592
2592
|
statusText: response.statusText
|
|
2593
2593
|
});
|
|
2594
2594
|
}
|
|
2595
2595
|
return {
|
|
2596
|
-
data: await
|
|
2596
|
+
data: await require_dist_CufwpBZM.readResponseWithSizeLimit({
|
|
2597
2597
|
response,
|
|
2598
2598
|
url: urlText,
|
|
2599
|
-
maxBytes: maxBytes != null ? maxBytes :
|
|
2599
|
+
maxBytes: maxBytes != null ? maxBytes : require_dist_CufwpBZM.DEFAULT_MAX_DOWNLOAD_SIZE
|
|
2600
2600
|
}),
|
|
2601
2601
|
mediaType: (_a23 = response.headers.get("content-type")) != null ? _a23 : void 0
|
|
2602
2602
|
};
|
|
2603
2603
|
} catch (error) {
|
|
2604
|
-
if (
|
|
2605
|
-
throw new
|
|
2604
|
+
if (require_dist_CufwpBZM.DownloadError.isInstance(error)) throw error;
|
|
2605
|
+
throw new require_dist_CufwpBZM.DownloadError({
|
|
2606
2606
|
url: urlText,
|
|
2607
2607
|
cause: error
|
|
2608
2608
|
});
|
|
@@ -2647,8 +2647,8 @@ function splitDataUrl(dataUrl) {
|
|
|
2647
2647
|
}
|
|
2648
2648
|
var dataContentSchema = zod_v4.z.union([
|
|
2649
2649
|
zod_v4.z.string(),
|
|
2650
|
-
zod_v4.z.custom(
|
|
2651
|
-
zod_v4.z.custom(
|
|
2650
|
+
zod_v4.z.custom(require_dist_CufwpBZM.isUint8Array, { message: "Must be a Uint8Array" }),
|
|
2651
|
+
zod_v4.z.custom(require_dist_CufwpBZM.isArrayBuffer, { message: "Must be an ArrayBuffer" }),
|
|
2652
2652
|
zod_v4.z.custom((value) => {
|
|
2653
2653
|
var _a23, _b;
|
|
2654
2654
|
return (_b = (_a23 = globalThis.Buffer) == null ? void 0 : _a23.isBuffer(value)) != null ? _b : false;
|
|
@@ -2656,11 +2656,11 @@ var dataContentSchema = zod_v4.z.union([
|
|
|
2656
2656
|
]);
|
|
2657
2657
|
function convertToLanguageModelV3DataContent(content) {
|
|
2658
2658
|
let originalUrl;
|
|
2659
|
-
if (
|
|
2659
|
+
if (require_dist_CufwpBZM.isUint8Array(content)) return {
|
|
2660
2660
|
data: convertDataContentToUint8Array(content),
|
|
2661
2661
|
mediaType: void 0
|
|
2662
2662
|
};
|
|
2663
|
-
if (
|
|
2663
|
+
if (require_dist_CufwpBZM.isArrayBuffer(content)) return {
|
|
2664
2664
|
data: new Uint8Array(content),
|
|
2665
2665
|
mediaType: void 0
|
|
2666
2666
|
};
|
|
@@ -2671,7 +2671,7 @@ function convertToLanguageModelV3DataContent(content) {
|
|
|
2671
2671
|
} catch (error) {}
|
|
2672
2672
|
if (content instanceof URL && content.protocol === "data:") {
|
|
2673
2673
|
const { mediaType: dataUrlMediaType, base64Content } = splitDataUrl(content.toString());
|
|
2674
|
-
if (dataUrlMediaType == null || base64Content == null) throw new
|
|
2674
|
+
if (dataUrlMediaType == null || base64Content == null) throw new require_dist_CufwpBZM.AISDKError({
|
|
2675
2675
|
name: "InvalidDataContentError",
|
|
2676
2676
|
message: `Invalid data URL format in content ${content.toString()}`
|
|
2677
2677
|
});
|
|
@@ -2688,16 +2688,16 @@ function convertToLanguageModelV3DataContent(content) {
|
|
|
2688
2688
|
}
|
|
2689
2689
|
function convertDataContentToBase64String(content) {
|
|
2690
2690
|
if (typeof content === "string") return content;
|
|
2691
|
-
return
|
|
2691
|
+
return require_dist_CufwpBZM.convertUint8ArrayToBase64(convertDataContentToUint8Array(content));
|
|
2692
2692
|
}
|
|
2693
2693
|
function convertDataContentToUint8Array(content) {
|
|
2694
|
-
if (
|
|
2694
|
+
if (require_dist_CufwpBZM.isUint8Array(content)) {
|
|
2695
2695
|
if (content instanceof Uint8Array) return content;
|
|
2696
2696
|
const { buffer, byteOffset, byteLength } = content;
|
|
2697
2697
|
return new Uint8Array(buffer, byteOffset, byteLength);
|
|
2698
2698
|
}
|
|
2699
2699
|
if (typeof content === "string") try {
|
|
2700
|
-
return
|
|
2700
|
+
return require_dist_CufwpBZM.convertBase64ToUint8Array(content);
|
|
2701
2701
|
} catch (error) {
|
|
2702
2702
|
throw new InvalidDataContentError({
|
|
2703
2703
|
message: "Invalid data content. Content string is not a base64-encoded media.",
|
|
@@ -2705,7 +2705,7 @@ function convertDataContentToUint8Array(content) {
|
|
|
2705
2705
|
cause: error
|
|
2706
2706
|
});
|
|
2707
2707
|
}
|
|
2708
|
-
if (
|
|
2708
|
+
if (require_dist_CufwpBZM.isArrayBuffer(content)) return new Uint8Array(content);
|
|
2709
2709
|
throw new InvalidDataContentError({ content });
|
|
2710
2710
|
}
|
|
2711
2711
|
async function convertToLanguageModelPrompt({ prompt, supportedUrls, download: download2, abortSignal }) {
|
|
@@ -2885,7 +2885,7 @@ async function downloadAssets(messages, download2, supportedUrls) {
|
|
|
2885
2885
|
};
|
|
2886
2886
|
}).filter((part) => part.data instanceof URL).map((part) => ({
|
|
2887
2887
|
url: part.data,
|
|
2888
|
-
isUrlSupportedByModel: part.mediaType != null &&
|
|
2888
|
+
isUrlSupportedByModel: part.mediaType != null && require_dist_CufwpBZM.isUrlSupported({
|
|
2889
2889
|
url: part.data.toString(),
|
|
2890
2890
|
mediaType: part.mediaType,
|
|
2891
2891
|
supportedUrls
|
|
@@ -2994,7 +2994,7 @@ function mapToolResultOutput({ output, downloadedAssets }) {
|
|
|
2994
2994
|
async function createToolModelOutput({ toolCallId, input, output, tool: tool2, errorMode }) {
|
|
2995
2995
|
if (errorMode === "text") return {
|
|
2996
2996
|
type: "error-text",
|
|
2997
|
-
value:
|
|
2997
|
+
value: require_dist_CufwpBZM.getErrorMessage$1(output)
|
|
2998
2998
|
};
|
|
2999
2999
|
else if (errorMode === "json") return {
|
|
3000
3000
|
type: "error-json",
|
|
@@ -3102,7 +3102,7 @@ async function prepareToolsAndToolChoice({ tools, toolChoice, activeTools }) {
|
|
|
3102
3102
|
type: "function",
|
|
3103
3103
|
name: name23,
|
|
3104
3104
|
description: tool2.description,
|
|
3105
|
-
inputSchema: await
|
|
3105
|
+
inputSchema: await require_dist_CufwpBZM.asSchema(tool2.inputSchema).jsonSchema,
|
|
3106
3106
|
...tool2.inputExamples != null ? { inputExamples: tool2.inputExamples } : {},
|
|
3107
3107
|
providerOptions: tool2.providerOptions,
|
|
3108
3108
|
...tool2.strict != null ? { strict: tool2.strict } : {}
|
|
@@ -3305,15 +3305,15 @@ var modelMessageSchema = zod_v4.z.union([
|
|
|
3305
3305
|
toolModelMessageSchema
|
|
3306
3306
|
]);
|
|
3307
3307
|
async function standardizePrompt({ allowSystemInMessages, system, prompt, messages }) {
|
|
3308
|
-
if (prompt == null && messages == null) throw new
|
|
3308
|
+
if (prompt == null && messages == null) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3309
3309
|
prompt,
|
|
3310
3310
|
message: "prompt or messages must be defined"
|
|
3311
3311
|
});
|
|
3312
|
-
if (prompt != null && messages != null) throw new
|
|
3312
|
+
if (prompt != null && messages != null) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3313
3313
|
prompt,
|
|
3314
3314
|
message: "prompt and messages cannot be defined at the same time"
|
|
3315
3315
|
});
|
|
3316
|
-
if (typeof system !== "string" && !asArray(system).every((message) => message.role === "system")) throw new
|
|
3316
|
+
if (typeof system !== "string" && !asArray(system).every((message) => message.role === "system")) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3317
3317
|
prompt,
|
|
3318
3318
|
message: "system must be a string, SystemModelMessage, or array of SystemModelMessage"
|
|
3319
3319
|
});
|
|
@@ -3322,26 +3322,26 @@ async function standardizePrompt({ allowSystemInMessages, system, prompt, messag
|
|
|
3322
3322
|
content: prompt
|
|
3323
3323
|
}];
|
|
3324
3324
|
else if (prompt != null && Array.isArray(prompt)) messages = prompt;
|
|
3325
|
-
else if (messages == null) throw new
|
|
3325
|
+
else if (messages == null) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3326
3326
|
prompt,
|
|
3327
3327
|
message: "prompt or messages must be defined"
|
|
3328
3328
|
});
|
|
3329
|
-
if (messages.length === 0) throw new
|
|
3329
|
+
if (messages.length === 0) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3330
3330
|
prompt,
|
|
3331
3331
|
message: "messages must not be empty"
|
|
3332
3332
|
});
|
|
3333
3333
|
if (messages.some((message) => message.role === "system")) {
|
|
3334
|
-
if (allowSystemInMessages === false) throw new
|
|
3334
|
+
if (allowSystemInMessages === false) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3335
3335
|
prompt,
|
|
3336
3336
|
message: "System messages are not allowed in the prompt or messages fields. Use the system option instead."
|
|
3337
3337
|
});
|
|
3338
3338
|
if (allowSystemInMessages === void 0) console.warn("AI SDK Warning: System messages in the prompt or messages fields can be a security risk because they may enable prompt injection attacks. Use the system option instead when possible. Set allowSystemInMessages to true to suppress this warning, or false to throw an error.");
|
|
3339
3339
|
}
|
|
3340
|
-
const validationResult = await
|
|
3340
|
+
const validationResult = await require_dist_CufwpBZM.safeValidateTypes({
|
|
3341
3341
|
value: messages,
|
|
3342
3342
|
schema: zod_v4.z.array(modelMessageSchema)
|
|
3343
3343
|
});
|
|
3344
|
-
if (!validationResult.success) throw new
|
|
3344
|
+
if (!validationResult.success) throw new require_dist_CufwpBZM.InvalidPromptError({
|
|
3345
3345
|
prompt,
|
|
3346
3346
|
message: "The messages do not match the ModelMessage[] schema.",
|
|
3347
3347
|
cause: validationResult.error
|
|
@@ -3352,10 +3352,10 @@ async function standardizePrompt({ allowSystemInMessages, system, prompt, messag
|
|
|
3352
3352
|
};
|
|
3353
3353
|
}
|
|
3354
3354
|
function wrapGatewayError(error) {
|
|
3355
|
-
if (!
|
|
3355
|
+
if (!require_dist_CufwpBZM.GatewayAuthenticationError.isInstance(error)) return error;
|
|
3356
3356
|
const isProductionEnv = (process == null ? void 0 : "production") === "production";
|
|
3357
3357
|
const moreInfoURL = "https://ai-sdk.dev/unauthenticated-ai-gateway";
|
|
3358
|
-
if (isProductionEnv) return new
|
|
3358
|
+
if (isProductionEnv) return new require_dist_CufwpBZM.AISDKError({
|
|
3359
3359
|
name: "GatewayError",
|
|
3360
3360
|
message: `Unauthenticated. Configure AI_GATEWAY_API_KEY or use a provider module. Learn more: ${moreInfoURL}`
|
|
3361
3361
|
});
|
|
@@ -3625,7 +3625,7 @@ function addTokenCounts(tokenCount1, tokenCount2) {
|
|
|
3625
3625
|
return tokenCount1 == null && tokenCount2 == null ? void 0 : (tokenCount1 != null ? tokenCount1 : 0) + (tokenCount2 != null ? tokenCount2 : 0);
|
|
3626
3626
|
}
|
|
3627
3627
|
function getRetryDelayInMs({ error, exponentialBackoffDelay }) {
|
|
3628
|
-
const headers =
|
|
3628
|
+
const headers = require_dist_CufwpBZM.APICallError.isInstance(error) ? error.responseHeaders : require_dist_CufwpBZM.APICallError.isInstance(error.cause) ? error.cause.responseHeaders : void 0;
|
|
3629
3629
|
if (!headers) return exponentialBackoffDelay;
|
|
3630
3630
|
let ms;
|
|
3631
3631
|
const retryAfterMs = headers["retry-after-ms"];
|
|
@@ -3642,12 +3642,12 @@ function getRetryDelayInMs({ error, exponentialBackoffDelay }) {
|
|
|
3642
3642
|
if (ms != null && !Number.isNaN(ms) && 0 <= ms && (ms < 6e4 || ms < exponentialBackoffDelay)) return ms;
|
|
3643
3643
|
return exponentialBackoffDelay;
|
|
3644
3644
|
}
|
|
3645
|
-
var retryWithExponentialBackoffRespectingRetryHeaders = ({ maxRetries = 2, initialDelayInMs = 2e3, backoffFactor = 2, abortSignal, additionalRetryableError } = {}) =>
|
|
3645
|
+
var retryWithExponentialBackoffRespectingRetryHeaders = ({ maxRetries = 2, initialDelayInMs = 2e3, backoffFactor = 2, abortSignal, additionalRetryableError } = {}) => require_dist_CufwpBZM.retryWithExponentialBackoff({
|
|
3646
3646
|
maxRetries,
|
|
3647
3647
|
initialDelayInMs,
|
|
3648
3648
|
backoffFactor,
|
|
3649
3649
|
abortSignal,
|
|
3650
|
-
shouldRetry: async (error) => error instanceof Error && (
|
|
3650
|
+
shouldRetry: async (error) => error instanceof Error && (require_dist_CufwpBZM.APICallError.isInstance(error) && error.isRetryable === true || require_dist_CufwpBZM.GatewayError.isInstance(error) && error.isRetryable === true) || additionalRetryableError != null && await additionalRetryableError(error),
|
|
3651
3651
|
getDelayInMs: ({ error, exponentialBackoffDelay }) => getRetryDelayInMs({
|
|
3652
3652
|
error,
|
|
3653
3653
|
exponentialBackoffDelay
|
|
@@ -3774,7 +3774,7 @@ async function executeToolCall({ toolCall, tools, tracer, telemetry, messages, a
|
|
|
3774
3774
|
});
|
|
3775
3775
|
const startTime = now();
|
|
3776
3776
|
try {
|
|
3777
|
-
const stream =
|
|
3777
|
+
const stream = require_dist_CufwpBZM.executeTool({
|
|
3778
3778
|
execute: tool2.execute.bind(tool2),
|
|
3779
3779
|
input,
|
|
3780
3780
|
options: {
|
|
@@ -3863,11 +3863,11 @@ var DefaultGeneratedFile = class {
|
|
|
3863
3863
|
this.mediaType = mediaType;
|
|
3864
3864
|
}
|
|
3865
3865
|
get base64() {
|
|
3866
|
-
if (this.base64Data == null) this.base64Data =
|
|
3866
|
+
if (this.base64Data == null) this.base64Data = require_dist_CufwpBZM.convertUint8ArrayToBase64(this.uint8ArrayData);
|
|
3867
3867
|
return this.base64Data;
|
|
3868
3868
|
}
|
|
3869
3869
|
get uint8Array() {
|
|
3870
|
-
if (this.uint8ArrayData == null) this.uint8ArrayData =
|
|
3870
|
+
if (this.uint8ArrayData == null) this.uint8ArrayData = require_dist_CufwpBZM.convertBase64ToUint8Array(this.base64Data);
|
|
3871
3871
|
return this.uint8ArrayData;
|
|
3872
3872
|
}
|
|
3873
3873
|
};
|
|
@@ -3897,10 +3897,10 @@ function canonicalJSON(value) {
|
|
|
3897
3897
|
return `{${Object.keys(value).sort().map((k) => `${JSON.stringify(k)}:${canonicalJSON(value[k])}`).join(",")}}`;
|
|
3898
3898
|
}
|
|
3899
3899
|
function toBase64url(bytes) {
|
|
3900
|
-
return
|
|
3900
|
+
return require_dist_CufwpBZM.convertUint8ArrayToBase64(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
3901
3901
|
}
|
|
3902
3902
|
function fromBase64url(str) {
|
|
3903
|
-
return
|
|
3903
|
+
return require_dist_CufwpBZM.convertBase64ToUint8Array(str);
|
|
3904
3904
|
}
|
|
3905
3905
|
async function importKey(secret) {
|
|
3906
3906
|
const keyData = typeof secret === "string" ? encoder.encode(secret) : secret;
|
|
@@ -3991,9 +3991,9 @@ async function validateApprovedToolApprovals({ approvedToolApprovals, tools, mes
|
|
|
3991
3991
|
}
|
|
3992
3992
|
if (tool2 != null && typeof tool2.execute === "function" && tool2.inputSchema != null) {
|
|
3993
3993
|
const hasInputSchemaInput = Object.prototype.hasOwnProperty.call(approvalRequest, "inputSchemaInput");
|
|
3994
|
-
const validation = await
|
|
3994
|
+
const validation = await require_dist_CufwpBZM.safeValidateTypes({
|
|
3995
3995
|
value: hasInputSchemaInput ? approvalRequest.inputSchemaInput : toolCall.input,
|
|
3996
|
-
schema:
|
|
3996
|
+
schema: require_dist_CufwpBZM.asSchema(tool2.inputSchema)
|
|
3997
3997
|
});
|
|
3998
3998
|
let validationError;
|
|
3999
3999
|
if (!validation.success) validationError = validation.error;
|
|
@@ -4294,12 +4294,12 @@ async function parsePartialJson(jsonText) {
|
|
|
4294
4294
|
value: void 0,
|
|
4295
4295
|
state: "undefined-input"
|
|
4296
4296
|
};
|
|
4297
|
-
let result = await
|
|
4297
|
+
let result = await require_dist_CufwpBZM.safeParseJSON({ text: jsonText });
|
|
4298
4298
|
if (result.success) return {
|
|
4299
4299
|
value: result.value,
|
|
4300
4300
|
state: "successful-parse"
|
|
4301
4301
|
};
|
|
4302
|
-
result = await
|
|
4302
|
+
result = await require_dist_CufwpBZM.safeParseJSON({ text: fixJson(jsonText) });
|
|
4303
4303
|
if (result.success) return {
|
|
4304
4304
|
value: result.value,
|
|
4305
4305
|
state: "repaired-parse"
|
|
@@ -4321,17 +4321,17 @@ var text = () => ({
|
|
|
4321
4321
|
createElementStreamTransform() {}
|
|
4322
4322
|
});
|
|
4323
4323
|
var object = ({ schema: inputSchema, name: name23, description }) => {
|
|
4324
|
-
const schema =
|
|
4324
|
+
const schema = require_dist_CufwpBZM.asSchema(inputSchema);
|
|
4325
4325
|
return {
|
|
4326
4326
|
name: "object",
|
|
4327
|
-
responseFormat:
|
|
4327
|
+
responseFormat: require_dist_CufwpBZM.resolve(schema.jsonSchema).then((jsonSchema2) => ({
|
|
4328
4328
|
type: "json",
|
|
4329
4329
|
schema: jsonSchema2,
|
|
4330
4330
|
...name23 != null && { name: name23 },
|
|
4331
4331
|
...description != null && { description }
|
|
4332
4332
|
})),
|
|
4333
4333
|
async parseCompleteOutput({ text: text2 }, context2) {
|
|
4334
|
-
const parseResult = await
|
|
4334
|
+
const parseResult = await require_dist_CufwpBZM.safeParseJSON({ text: text2 });
|
|
4335
4335
|
if (!parseResult.success) throw new NoObjectGeneratedError({
|
|
4336
4336
|
message: "No object generated: could not parse the response.",
|
|
4337
4337
|
cause: parseResult.error,
|
|
@@ -4340,7 +4340,7 @@ var object = ({ schema: inputSchema, name: name23, description }) => {
|
|
|
4340
4340
|
usage: context2.usage,
|
|
4341
4341
|
finishReason: context2.finishReason
|
|
4342
4342
|
});
|
|
4343
|
-
const validationResult = await
|
|
4343
|
+
const validationResult = await require_dist_CufwpBZM.safeValidateTypes({
|
|
4344
4344
|
value: parseResult.value,
|
|
4345
4345
|
schema
|
|
4346
4346
|
});
|
|
@@ -4367,10 +4367,10 @@ var object = ({ schema: inputSchema, name: name23, description }) => {
|
|
|
4367
4367
|
};
|
|
4368
4368
|
};
|
|
4369
4369
|
var array = ({ element: inputElementSchema, name: name23, description }) => {
|
|
4370
|
-
const elementSchema =
|
|
4370
|
+
const elementSchema = require_dist_CufwpBZM.asSchema(inputElementSchema);
|
|
4371
4371
|
return {
|
|
4372
4372
|
name: "array",
|
|
4373
|
-
responseFormat:
|
|
4373
|
+
responseFormat: require_dist_CufwpBZM.resolve(elementSchema.jsonSchema).then((jsonSchema2) => {
|
|
4374
4374
|
const { $schema, ...itemSchema } = jsonSchema2;
|
|
4375
4375
|
return {
|
|
4376
4376
|
type: "json",
|
|
@@ -4389,7 +4389,7 @@ var array = ({ element: inputElementSchema, name: name23, description }) => {
|
|
|
4389
4389
|
};
|
|
4390
4390
|
}),
|
|
4391
4391
|
async parseCompleteOutput({ text: text2 }, context2) {
|
|
4392
|
-
const parseResult = await
|
|
4392
|
+
const parseResult = await require_dist_CufwpBZM.safeParseJSON({ text: text2 });
|
|
4393
4393
|
if (!parseResult.success) throw new NoObjectGeneratedError({
|
|
4394
4394
|
message: "No object generated: could not parse the response.",
|
|
4395
4395
|
cause: parseResult.error,
|
|
@@ -4401,7 +4401,7 @@ var array = ({ element: inputElementSchema, name: name23, description }) => {
|
|
|
4401
4401
|
const outerValue = parseResult.value;
|
|
4402
4402
|
if (outerValue == null || typeof outerValue !== "object" || !("elements" in outerValue) || !Array.isArray(outerValue.elements)) throw new NoObjectGeneratedError({
|
|
4403
4403
|
message: "No object generated: response did not match schema.",
|
|
4404
|
-
cause: new
|
|
4404
|
+
cause: new require_dist_CufwpBZM.TypeValidationError({
|
|
4405
4405
|
value: outerValue,
|
|
4406
4406
|
cause: "response must be an object with an elements array"
|
|
4407
4407
|
}),
|
|
@@ -4412,7 +4412,7 @@ var array = ({ element: inputElementSchema, name: name23, description }) => {
|
|
|
4412
4412
|
});
|
|
4413
4413
|
const validatedElements = [];
|
|
4414
4414
|
for (const element of outerValue.elements) {
|
|
4415
|
-
const validationResult = await
|
|
4415
|
+
const validationResult = await require_dist_CufwpBZM.safeValidateTypes({
|
|
4416
4416
|
value: element,
|
|
4417
4417
|
schema: elementSchema
|
|
4418
4418
|
});
|
|
@@ -4440,7 +4440,7 @@ var array = ({ element: inputElementSchema, name: name23, description }) => {
|
|
|
4440
4440
|
const rawElements = result.state === "repaired-parse" && outerValue.elements.length > 0 ? outerValue.elements.slice(0, -1) : outerValue.elements;
|
|
4441
4441
|
const parsedElements = [];
|
|
4442
4442
|
for (const rawElement of rawElements) {
|
|
4443
|
-
const validationResult = await
|
|
4443
|
+
const validationResult = await require_dist_CufwpBZM.safeValidateTypes({
|
|
4444
4444
|
value: rawElement,
|
|
4445
4445
|
schema: elementSchema
|
|
4446
4446
|
});
|
|
@@ -4477,7 +4477,7 @@ var choice = ({ options: choiceOptions, name: name23, description }) => {
|
|
|
4477
4477
|
...description != null && { description }
|
|
4478
4478
|
}),
|
|
4479
4479
|
async parseCompleteOutput({ text: text2 }, context2) {
|
|
4480
|
-
const parseResult = await
|
|
4480
|
+
const parseResult = await require_dist_CufwpBZM.safeParseJSON({ text: text2 });
|
|
4481
4481
|
if (!parseResult.success) throw new NoObjectGeneratedError({
|
|
4482
4482
|
message: "No object generated: could not parse the response.",
|
|
4483
4483
|
cause: parseResult.error,
|
|
@@ -4489,7 +4489,7 @@ var choice = ({ options: choiceOptions, name: name23, description }) => {
|
|
|
4489
4489
|
const outerValue = parseResult.value;
|
|
4490
4490
|
if (outerValue == null || typeof outerValue !== "object" || !("result" in outerValue) || typeof outerValue.result !== "string" || !choiceOptions.includes(outerValue.result)) throw new NoObjectGeneratedError({
|
|
4491
4491
|
message: "No object generated: response did not match schema.",
|
|
4492
|
-
cause: new
|
|
4492
|
+
cause: new require_dist_CufwpBZM.TypeValidationError({
|
|
4493
4493
|
value: outerValue,
|
|
4494
4494
|
cause: "response must be an object that contains a choice value."
|
|
4495
4495
|
}),
|
|
@@ -4527,7 +4527,7 @@ var json = ({ name: name23, description } = {}) => {
|
|
|
4527
4527
|
...description != null && { description }
|
|
4528
4528
|
}),
|
|
4529
4529
|
async parseCompleteOutput({ text: text2 }, context2) {
|
|
4530
|
-
const parseResult = await
|
|
4530
|
+
const parseResult = await require_dist_CufwpBZM.safeParseJSON({ text: text2 });
|
|
4531
4531
|
if (!parseResult.success) throw new NoObjectGeneratedError({
|
|
4532
4532
|
message: "No object generated: could not parse the response.",
|
|
4533
4533
|
cause: parseResult.error,
|
|
@@ -4578,7 +4578,7 @@ async function parseToolCall({ toolCall, tools, repairToolCall, system, messages
|
|
|
4578
4578
|
tools,
|
|
4579
4579
|
inputSchema: async ({ toolName }) => {
|
|
4580
4580
|
const { inputSchema } = tools[toolName];
|
|
4581
|
-
return await
|
|
4581
|
+
return await require_dist_CufwpBZM.asSchema(inputSchema).jsonSchema;
|
|
4582
4582
|
},
|
|
4583
4583
|
system,
|
|
4584
4584
|
messages,
|
|
@@ -4597,7 +4597,7 @@ async function parseToolCall({ toolCall, tools, repairToolCall, system, messages
|
|
|
4597
4597
|
});
|
|
4598
4598
|
}
|
|
4599
4599
|
} catch (error) {
|
|
4600
|
-
const parsedInput = await
|
|
4600
|
+
const parsedInput = await require_dist_CufwpBZM.safeParseJSON({ text: toolCall.input });
|
|
4601
4601
|
const input = parsedInput.success ? parsedInput.value : toolCall.input;
|
|
4602
4602
|
const tool2 = tools == null ? void 0 : tools[toolCall.toolName];
|
|
4603
4603
|
return {
|
|
@@ -4619,7 +4619,7 @@ async function parseProviderExecutedDynamicToolCall(toolCall) {
|
|
|
4619
4619
|
const parseResult = toolCall.input.trim() === "" ? {
|
|
4620
4620
|
success: true,
|
|
4621
4621
|
value: {}
|
|
4622
|
-
} : await
|
|
4622
|
+
} : await require_dist_CufwpBZM.safeParseJSON({ text: toolCall.input });
|
|
4623
4623
|
if (parseResult.success === false) throw new InvalidToolInputError({
|
|
4624
4624
|
toolName: toolCall.toolName,
|
|
4625
4625
|
toolInput: toolCall.input,
|
|
@@ -4645,11 +4645,11 @@ async function doParseToolCall({ toolCall, tools }) {
|
|
|
4645
4645
|
availableTools: Object.keys(tools)
|
|
4646
4646
|
});
|
|
4647
4647
|
}
|
|
4648
|
-
const schema =
|
|
4649
|
-
const parseResult = toolCall.input.trim() === "" ? await
|
|
4648
|
+
const schema = require_dist_CufwpBZM.asSchema(tool2.inputSchema);
|
|
4649
|
+
const parseResult = toolCall.input.trim() === "" ? await require_dist_CufwpBZM.safeValidateTypes({
|
|
4650
4650
|
value: {},
|
|
4651
4651
|
schema
|
|
4652
|
-
}) : await
|
|
4652
|
+
}) : await require_dist_CufwpBZM.safeParseJSON({
|
|
4653
4653
|
text: toolCall.input,
|
|
4654
4654
|
schema
|
|
4655
4655
|
});
|
|
@@ -4897,7 +4897,7 @@ function mergeAbortSignals(...signals) {
|
|
|
4897
4897
|
}
|
|
4898
4898
|
return controller.signal;
|
|
4899
4899
|
}
|
|
4900
|
-
var originalGenerateId =
|
|
4900
|
+
var originalGenerateId = require_dist_CufwpBZM.createIdGenerator({
|
|
4901
4901
|
prefix: "aitxt",
|
|
4902
4902
|
size: 24
|
|
4903
4903
|
});
|
|
@@ -4914,7 +4914,7 @@ async function generateText({ model: modelArg, tools, toolChoice, system, prompt
|
|
|
4914
4914
|
abortSignal: mergedAbortSignal
|
|
4915
4915
|
});
|
|
4916
4916
|
const callSettings = prepareCallSettings(settings);
|
|
4917
|
-
const headersWithUserAgent =
|
|
4917
|
+
const headersWithUserAgent = require_dist_CufwpBZM.withUserAgentSuffix(headers != null ? headers : {}, `ai/${VERSION}`);
|
|
4918
4918
|
const baseTelemetryAttributes = getBaseTelemetryAttributes({
|
|
4919
4919
|
model,
|
|
4920
4920
|
telemetry,
|
|
@@ -5281,7 +5281,7 @@ async function generateText({ model: modelArg, tools, toolChoice, system, prompt
|
|
|
5281
5281
|
toolCallId: toolCall.toolCallId,
|
|
5282
5282
|
toolName: toolCall.toolName,
|
|
5283
5283
|
input: toolCall.input,
|
|
5284
|
-
error:
|
|
5284
|
+
error: require_dist_CufwpBZM.getErrorMessage(toolCall.error),
|
|
5285
5285
|
dynamic: true
|
|
5286
5286
|
});
|
|
5287
5287
|
clientToolCalls = stepToolCalls.filter((toolCall) => !toolCall.providerExecuted);
|
|
@@ -5780,7 +5780,7 @@ function getResponseUIMessageId({ originalMessages, responseMessageId }) {
|
|
|
5780
5780
|
return (lastMessage == null ? void 0 : lastMessage.role) === "assistant" ? lastMessage.id : typeof responseMessageId === "function" ? responseMessageId() : responseMessageId;
|
|
5781
5781
|
}
|
|
5782
5782
|
var toolMetadataSchema = zod_v4.z.record(zod_v4.z.string(), jsonValueSchema.optional());
|
|
5783
|
-
|
|
5783
|
+
require_dist_CufwpBZM.lazySchema(() => require_dist_CufwpBZM.zodSchema(zod_v4.z.union([
|
|
5784
5784
|
zod_v4.z.looseObject({
|
|
5785
5785
|
type: zod_v4.z.literal("text-start"),
|
|
5786
5786
|
id: zod_v4.z.string(),
|
|
@@ -6113,7 +6113,7 @@ function processUIMessageStream({ stream, messageMetadataSchema, dataPartSchemas
|
|
|
6113
6113
|
async function updateMessageMetadata(metadata) {
|
|
6114
6114
|
if (metadata != null) {
|
|
6115
6115
|
const mergedMetadata = state.message.metadata != null ? mergeObjects(state.message.metadata, metadata) : metadata;
|
|
6116
|
-
if (messageMetadataSchema != null) await
|
|
6116
|
+
if (messageMetadataSchema != null) await require_dist_CufwpBZM.validateTypes({
|
|
6117
6117
|
value: mergedMetadata,
|
|
6118
6118
|
schema: messageMetadataSchema,
|
|
6119
6119
|
context: {
|
|
@@ -6458,7 +6458,7 @@ function processUIMessageStream({ stream, messageMetadataSchema, dataPartSchemas
|
|
|
6458
6458
|
if ((dataPartSchemas == null ? void 0 : dataPartSchemas[chunk.type]) != null) {
|
|
6459
6459
|
const partIdx = state.message.parts.findIndex((p) => "id" in p && "data" in p && p.id === chunk.id && p.type === chunk.type);
|
|
6460
6460
|
const actualPartIdx = partIdx >= 0 ? partIdx : state.message.parts.length;
|
|
6461
|
-
await
|
|
6461
|
+
await require_dist_CufwpBZM.validateTypes({
|
|
6462
6462
|
value: chunk.data,
|
|
6463
6463
|
schema: dataPartSchemas[chunk.type],
|
|
6464
6464
|
context: {
|
|
@@ -6981,7 +6981,7 @@ function runToolsTransformation({ tools, toolChoice, generatorStream, tracer, te
|
|
|
6981
6981
|
toolCallId: toolCall.toolCallId,
|
|
6982
6982
|
toolName: toolCall.toolName,
|
|
6983
6983
|
input: toolCall.input,
|
|
6984
|
-
error:
|
|
6984
|
+
error: require_dist_CufwpBZM.getErrorMessage(toolCall.error),
|
|
6985
6985
|
dynamic: true,
|
|
6986
6986
|
title: toolCall.title,
|
|
6987
6987
|
...toolCall.toolMetadata != null ? { toolMetadata: toolCall.toolMetadata } : {}
|
|
@@ -7078,7 +7078,7 @@ function runToolsTransformation({ tools, toolChoice, generatorStream, tracer, te
|
|
|
7078
7078
|
}))]);
|
|
7079
7079
|
} });
|
|
7080
7080
|
}
|
|
7081
|
-
var originalGenerateId2 =
|
|
7081
|
+
var originalGenerateId2 = require_dist_CufwpBZM.createIdGenerator({
|
|
7082
7082
|
prefix: "aitxt",
|
|
7083
7083
|
size: 24
|
|
7084
7084
|
});
|
|
@@ -7243,10 +7243,10 @@ function createOutputTransformStream(output) {
|
|
|
7243
7243
|
}
|
|
7244
7244
|
var DefaultStreamTextResult = class {
|
|
7245
7245
|
constructor({ model, telemetry, headers, settings, maxRetries: maxRetriesArg, abortSignal, stepTimeoutMs, stepAbortController, chunkTimeoutMs, chunkAbortController, system, prompt, messages, allowSystemInMessages, tools, toolChoice, transforms, activeTools, repairToolCall, stopConditions, output, providerOptions, prepareStep, includeRawChunks, now: now2, generateId: generateId2, timeout, stopWhen, originalAbortSignal, onChunk, onError, onFinish, onAbort, onStepFinish, onStart, onStepStart, onToolCallStart, onToolCallFinish, experimental_context, experimental_toolApprovalSecret, download: download2, include }) {
|
|
7246
|
-
this._totalUsage = new
|
|
7247
|
-
this._finishReason = new
|
|
7248
|
-
this._rawFinishReason = new
|
|
7249
|
-
this._steps = new
|
|
7246
|
+
this._totalUsage = new require_dist_CufwpBZM.DelayedPromise();
|
|
7247
|
+
this._finishReason = new require_dist_CufwpBZM.DelayedPromise();
|
|
7248
|
+
this._rawFinishReason = new require_dist_CufwpBZM.DelayedPromise();
|
|
7249
|
+
this._steps = new require_dist_CufwpBZM.DelayedPromise();
|
|
7250
7250
|
this.outputSpecification = output;
|
|
7251
7251
|
this.includeRawChunks = includeRawChunks;
|
|
7252
7252
|
this.tools = tools;
|
|
@@ -7541,7 +7541,7 @@ var DefaultStreamTextResult = class {
|
|
|
7541
7541
|
onAbort?.({ steps: recordedSteps });
|
|
7542
7542
|
controller.enqueue({
|
|
7543
7543
|
type: "abort",
|
|
7544
|
-
...(abortSignal == null ? void 0 : abortSignal.reason) !== void 0 ? { reason:
|
|
7544
|
+
...(abortSignal == null ? void 0 : abortSignal.reason) !== void 0 ? { reason: require_dist_CufwpBZM.getErrorMessage$1(abortSignal.reason) } : {}
|
|
7545
7545
|
});
|
|
7546
7546
|
controller.close();
|
|
7547
7547
|
}
|
|
@@ -7557,7 +7557,7 @@ var DefaultStreamTextResult = class {
|
|
|
7557
7557
|
}
|
|
7558
7558
|
controller.enqueue(value);
|
|
7559
7559
|
} catch (error) {
|
|
7560
|
-
if (
|
|
7560
|
+
if (require_dist_CufwpBZM.isAbortError(error) && (abortSignal == null ? void 0 : abortSignal.aborted)) abort();
|
|
7561
7561
|
else controller.error(error);
|
|
7562
7562
|
}
|
|
7563
7563
|
},
|
|
@@ -7687,7 +7687,7 @@ var DefaultStreamTextResult = class {
|
|
|
7687
7687
|
toolCallId: toolApproval.toolCall.toolCallId,
|
|
7688
7688
|
toolName: toolApproval.toolCall.toolName,
|
|
7689
7689
|
input: toolApproval.toolCall.input,
|
|
7690
|
-
error:
|
|
7690
|
+
error: require_dist_CufwpBZM.getErrorMessage$1(toolApproval.error),
|
|
7691
7691
|
title: toolApproval.toolCall.title,
|
|
7692
7692
|
...toolApproval.toolCall.dynamic === true ? { dynamic: true } : {},
|
|
7693
7693
|
...toolApproval.toolCall.toolMetadata != null ? { toolMetadata: toolApproval.toolCall.toolMetadata } : {}
|
|
@@ -7796,7 +7796,7 @@ var DefaultStreamTextResult = class {
|
|
|
7796
7796
|
}
|
|
7797
7797
|
abortSignal?.addEventListener("abort", cleanupStepTimeouts, { once: true });
|
|
7798
7798
|
try {
|
|
7799
|
-
stepFinish = new
|
|
7799
|
+
stepFinish = new require_dist_CufwpBZM.DelayedPromise();
|
|
7800
7800
|
const stepInputMessages = [...initialMessages, ...responseMessages];
|
|
7801
7801
|
const prepareStepResult = await (prepareStep == null ? void 0 : prepareStep({
|
|
7802
7802
|
model,
|
|
@@ -8345,7 +8345,7 @@ var DefaultStreamTextResult = class {
|
|
|
8345
8345
|
get elementStream() {
|
|
8346
8346
|
var _a23, _b, _c;
|
|
8347
8347
|
const transform = (_a23 = this.outputSpecification) == null ? void 0 : _a23.createElementStreamTransform();
|
|
8348
|
-
if (transform == null) throw new
|
|
8348
|
+
if (transform == null) throw new require_dist_CufwpBZM.UnsupportedFunctionalityError({ functionality: `element streams in ${(_c = (_b = this.outputSpecification) == null ? void 0 : _b.name) != null ? _c : "text"} mode` });
|
|
8349
8349
|
return createAsyncIterableStream(this.teeStream().pipeThrough(transform));
|
|
8350
8350
|
}
|
|
8351
8351
|
getOutputPromise() {
|
|
@@ -8701,7 +8701,7 @@ var ToolLoopAgent = class {
|
|
|
8701
8701
|
async prepareCall(options) {
|
|
8702
8702
|
var _a23, _b, _c, _d;
|
|
8703
8703
|
if (this.settings.callOptionsSchema != null && options.options !== void 0) {
|
|
8704
|
-
const validatedOptions = await
|
|
8704
|
+
const validatedOptions = await require_dist_CufwpBZM.validateTypes({
|
|
8705
8705
|
value: options.options,
|
|
8706
8706
|
schema: this.settings.callOptionsSchema,
|
|
8707
8707
|
context: { field: "options" }
|
|
@@ -8761,7 +8761,7 @@ var ToolLoopAgent = class {
|
|
|
8761
8761
|
}
|
|
8762
8762
|
};
|
|
8763
8763
|
var toolMetadataSchema2 = zod_v4.z.record(zod_v4.z.string(), jsonValueSchema.optional());
|
|
8764
|
-
|
|
8764
|
+
require_dist_CufwpBZM.lazySchema(() => {
|
|
8765
8765
|
const approvalRequestedSchema = zod_v4.z.object({
|
|
8766
8766
|
id: zod_v4.z.string(),
|
|
8767
8767
|
approved: zod_v4.z.never().optional(),
|
|
@@ -8776,7 +8776,7 @@ require_dist_ByO0vuJJ.lazySchema(() => {
|
|
|
8776
8776
|
});
|
|
8777
8777
|
const approvalGrantedSchema = approvalRespondedSchema.extend({ approved: zod_v4.z.literal(true) });
|
|
8778
8778
|
const approvalDeniedSchema = approvalRespondedSchema.extend({ approved: zod_v4.z.literal(false) });
|
|
8779
|
-
return
|
|
8779
|
+
return require_dist_CufwpBZM.zodSchema(zod_v4.z.array(zod_v4.z.object({
|
|
8780
8780
|
id: zod_v4.z.string(),
|
|
8781
8781
|
role: zod_v4.z.enum([
|
|
8782
8782
|
"system",
|
|
@@ -9039,7 +9039,7 @@ async function embed({ model: modelArg, value, providerOptions, maxRetries: maxR
|
|
|
9039
9039
|
maxRetries: maxRetriesArg,
|
|
9040
9040
|
abortSignal
|
|
9041
9041
|
});
|
|
9042
|
-
const headersWithUserAgent =
|
|
9042
|
+
const headersWithUserAgent = require_dist_CufwpBZM.withUserAgentSuffix(headers != null ? headers : {}, `ai/${VERSION}`);
|
|
9043
9043
|
const baseTelemetryAttributes = getBaseTelemetryAttributes({
|
|
9044
9044
|
model,
|
|
9045
9045
|
telemetry,
|
|
@@ -9093,7 +9093,7 @@ async function embed({ model: modelArg, value, providerOptions, maxRetries: maxR
|
|
|
9093
9093
|
"ai.usage.tokens": usage2.tokens
|
|
9094
9094
|
}
|
|
9095
9095
|
}));
|
|
9096
|
-
if (embedding2 == null) throw new
|
|
9096
|
+
if (embedding2 == null) throw new require_dist_CufwpBZM.InvalidResponseDataError({
|
|
9097
9097
|
data: modelResponse.embeddings,
|
|
9098
9098
|
message: "No embedding generated."
|
|
9099
9099
|
});
|
|
@@ -9140,12 +9140,12 @@ var DefaultEmbedResult = class {
|
|
|
9140
9140
|
}
|
|
9141
9141
|
};
|
|
9142
9142
|
new TextEncoder();
|
|
9143
|
-
|
|
9143
|
+
require_dist_CufwpBZM.createIdGenerator({
|
|
9144
9144
|
prefix: "aiobj",
|
|
9145
9145
|
size: 24
|
|
9146
9146
|
});
|
|
9147
9147
|
var { atob } = globalThis;
|
|
9148
|
-
|
|
9148
|
+
require_dist_CufwpBZM.createIdGenerator({
|
|
9149
9149
|
prefix: "aiobj",
|
|
9150
9150
|
size: 24
|
|
9151
9151
|
});
|