maka-agent 0.2.0-dev.62.20260928 → 0.2.0-dev.64.20260929
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/LICENSE +15 -15
- package/THIRD_PARTY_NOTICES.txt +26 -26
- package/native/runtime-host-windows-task-launcher/prebuilds/win32-x64/maka-runtime-host-task-launcher.exe +0 -0
- package/node_modules/@agentclientprotocol/sdk/dist/examples/dual-version-agent.js +12 -12
- package/node_modules/@agentclientprotocol/sdk/dist/schema/zod.gen.js +52 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/acp.js +5 -4
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/guards.gen.js +7 -0
- package/node_modules/@agentclientprotocol/sdk/dist/v2/schema/zod.gen.js +51 -8
- package/node_modules/@agentclientprotocol/sdk/package.json +2 -2
- package/node_modules/@agentclientprotocol/sdk/schema/schema.json +90 -2
- package/node_modules/@agentclientprotocol/sdk/schema/v2/schema.unstable.json +103 -12
- package/node_modules/@ai-sdk/anthropic/CHANGELOG.md +140 -0
- package/node_modules/@ai-sdk/anthropic/README.md +1 -1
- package/node_modules/@ai-sdk/anthropic/dist/index.js +1622 -868
- package/node_modules/@ai-sdk/anthropic/dist/internal/index.js +1516 -763
- package/node_modules/@ai-sdk/anthropic/docs/05-anthropic.mdx +483 -62
- package/node_modules/@ai-sdk/anthropic/package.json +4 -4
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/approval-continuation.js +0 -1
- package/node_modules/@ai-sdk/code-mode/dist/code-mode-tool.js +59 -0
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/errors.js +0 -8
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/interrupt-continuation.js +0 -2
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/tool-prompt.js +43 -15
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/package.json +3 -3
- package/node_modules/@ai-sdk/cohere/CHANGELOG.md +99 -0
- package/node_modules/@ai-sdk/cohere/README.md +1 -1
- package/node_modules/@ai-sdk/cohere/dist/index.js +35 -49
- package/node_modules/@ai-sdk/cohere/docs/25-cohere.mdx +11 -9
- package/node_modules/@ai-sdk/cohere/package.json +4 -4
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/CHANGELOG.md +183 -0
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/README.md +1 -1
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/dist/index.js +587 -245
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/docs/00-ai-gateway.mdx +235 -30
- package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/gateway/package.json +4 -4
- package/node_modules/@ai-sdk/google/CHANGELOG.md +180 -0
- package/node_modules/@ai-sdk/google/README.md +1 -1
- package/node_modules/@ai-sdk/google/dist/index.js +1147 -1130
- package/node_modules/@ai-sdk/google/dist/internal/index.js +809 -889
- package/node_modules/@ai-sdk/google/docs/15-google.mdx +224 -41
- package/node_modules/@ai-sdk/google/package.json +4 -4
- package/node_modules/@ai-sdk/open-responses/CHANGELOG.md +109 -0
- package/node_modules/@ai-sdk/open-responses/dist/index.js +419 -183
- package/node_modules/@ai-sdk/open-responses/docs/06-open-responses.mdx +121 -6
- package/node_modules/@ai-sdk/open-responses/package.json +4 -4
- package/node_modules/@ai-sdk/openai/CHANGELOG.md +147 -0
- package/node_modules/@ai-sdk/openai/README.md +27 -2
- package/node_modules/@ai-sdk/openai/dist/index.js +2445 -1828
- package/node_modules/@ai-sdk/openai/dist/internal/index.js +2170 -2041
- package/node_modules/@ai-sdk/openai/docs/03-openai.mdx +311 -102
- package/node_modules/@ai-sdk/openai/package.json +4 -4
- package/node_modules/@ai-sdk/openai-compatible/CHANGELOG.md +110 -0
- package/node_modules/@ai-sdk/openai-compatible/dist/index.js +120 -130
- package/node_modules/@ai-sdk/openai-compatible/dist/internal/index.js +22 -14
- package/node_modules/@ai-sdk/openai-compatible/docs/index.mdx +2 -0
- package/node_modules/@ai-sdk/openai-compatible/package.json +4 -4
- package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/CHANGELOG.md +47 -0
- package/node_modules/@ai-sdk/{cohere/node_modules/@ai-sdk/provider → provider}/dist/index.js +127 -102
- package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/package.json +1 -1
- package/node_modules/@ai-sdk/provider-utils/CHANGELOG.md +99 -0
- package/node_modules/@ai-sdk/provider-utils/dist/experimental-evaluation/index.js +1618 -0
- package/node_modules/@ai-sdk/provider-utils/dist/index.js +470 -268
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h1.js +23 -8
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client-h2.js +84 -19
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/dispatcher/client.js +6 -2
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/cache-handler.js +21 -5
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/handler/retry-handler.js +109 -23
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/cache.js +20 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/decompress.js +338 -46
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/connection.js +19 -9
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/@ai-sdk/provider-utils/node_modules/undici/package.json +1 -1
- package/node_modules/@ai-sdk/provider-utils/package.json +7 -2
- package/node_modules/@earendil-works/pi-tui/README.md +8 -2
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +18 -11
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +7 -6
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +23 -22
- package/node_modules/@earendil-works/pi-tui/dist/index.js +2 -0
- package/node_modules/@earendil-works/pi-tui/dist/latex.js +109 -16
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +3 -44
- package/node_modules/@earendil-works/pi-tui/dist/native-platform.js +42 -0
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +2 -20
- package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +25 -6
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +4 -0
- package/node_modules/@earendil-works/pi-tui/native/clipboard.h +170 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/README.md +8 -6
- package/node_modules/@earendil-works/pi-tui/native/darwin/build.sh +12 -5
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/{darwin-modifiers.node → darwin-platform.node} +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-platform.m +93 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/README.md +23 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/build.sh +65 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/src/clipboard-worker.h +70 -0
- package/node_modules/@earendil-works/pi-tui/native/linux/src/linux-platform-x11.c +274 -0
- package/node_modules/@earendil-works/pi-tui/native/napi.h +89 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/README.md +16 -7
- package/node_modules/@earendil-works/pi-tui/native/win32/build.mjs +7 -4
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-platform.c +241 -0
- package/node_modules/@earendil-works/pi-tui/package.json +11 -4
- package/node_modules/@larksuiteoapi/node-sdk/README.md +20 -0
- package/node_modules/@larksuiteoapi/node-sdk/README.zh.md +20 -0
- package/node_modules/@larksuiteoapi/node-sdk/es/index.js +33 -1
- package/node_modules/@larksuiteoapi/node-sdk/lib/index.js +33 -1
- package/node_modules/@larksuiteoapi/node-sdk/package.json +1 -1
- package/node_modules/@maka/acp-executor-plugin/dist/plugin.mjs +17 -0
- package/node_modules/@maka/acp-executor-plugin/package.json +1 -1
- package/node_modules/@maka/core/dist/model-web-search.js +2 -3
- package/node_modules/@maka/core/dist/relative-time.js +19 -20
- package/node_modules/@maka/eval/harbor/egress_filter.py +64 -47
- package/node_modules/@maka/eval/harbor/eval_framework.py +3 -3
- package/node_modules/@maka/eval/harbor/run_trial.py +2 -2
- package/node_modules/@maka/eval/node_modules/undici/README.md +10 -1
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/@maka/eval/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/@maka/eval/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/@maka/eval/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/@maka/eval/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/@maka/eval/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/@maka/eval/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/@maka/eval/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/@maka/eval/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/mcp/package.json +1 -1
- package/node_modules/@maka/runtime/dist/ai-sdk-compaction.js +15 -3
- package/node_modules/@maka/runtime/dist/ai-sdk-message-projection.js +33 -3
- package/node_modules/@maka/runtime/dist/deepseek-web-search-codec.js +71 -0
- package/node_modules/@maka/runtime/dist/history-compaction.js +11 -4
- package/node_modules/@maka/runtime/dist/model-adapter.js +9 -5
- package/node_modules/@maka/runtime/dist/model-factory.js +4 -0
- package/node_modules/@maka/runtime/dist/plugin-agent-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-attachment-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-composition-loader.js +26 -36
- package/node_modules/@maka/runtime/dist/plugin-data-services.js +9 -26
- package/node_modules/@maka/runtime/dist/plugin-fs-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-goal-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-internals.js +78 -0
- package/node_modules/@maka/runtime/dist/plugin-llm-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-runtime.js +4 -32
- package/node_modules/@maka/runtime/dist/plugin-session-query-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-shell-service.js +5 -13
- package/node_modules/@maka/runtime/dist/plugin-web-service.js +5 -13
- package/node_modules/@maka/runtime/dist/stream-graph-coordinator.js +3 -3
- package/node_modules/@maka/runtime/dist/workers/filesystem-worker.js +161 -104
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h1.js +23 -8
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client-h2.js +84 -19
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/dispatcher/client.js +6 -2
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/cache-handler.js +21 -5
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/handler/retry-handler.js +109 -23
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/cache.js +20 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/decompress.js +338 -46
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/connection.js +19 -9
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/@slack/socket-mode/package.json +1 -1
- package/node_modules/@maka/runtime/node_modules/undici/README.md +10 -1
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/@maka/runtime/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/@maka/runtime/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/@maka/runtime/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/@maka/runtime/node_modules/undici/package.json +1 -1
- package/node_modules/@maka/runtime/package.json +11 -11
- package/node_modules/@maka/runtime-host/dist/adapter/session-projector.js +3 -7
- package/node_modules/@maka/runtime-host/dist/candidate-cli.js +7 -7
- package/node_modules/@maka/runtime-host/dist/protocol/turn.js +20 -8
- package/node_modules/@maka/runtime-host/dist/server/message-coordinator.js +107 -63
- package/node_modules/@maka/runtime-host/dist/server/root-turn-coordinator.js +1 -3
- package/node_modules/@maka/runtime-host/dist/server/session-continuity-coordinator.js +51 -16
- package/node_modules/@maka/runtime-host/package.json +2 -2
- package/node_modules/@maka/storage/dist/project-catalog.js +13 -20
- package/node_modules/@modelcontextprotocol/client/dist/index-BCtJi0p5.d.mts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index-CEk3qkZM.d.cts.map +1 -0
- package/node_modules/@modelcontextprotocol/client/dist/index.cjs +375 -60
- package/node_modules/@modelcontextprotocol/client/dist/index.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/index.mjs +369 -61
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.cjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/shimsWorkerd.mjs +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/{src-NAgB4Mp8.cjs → src-D0qEN74R.cjs} +111 -38
- package/node_modules/@modelcontextprotocol/client/dist/{src-D_zzAWoS.mjs → src-DDAAhLnO.mjs} +106 -33
- package/node_modules/@modelcontextprotocol/client/dist/stdio.cjs +8 -2
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.cts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.d.mts.map +1 -1
- package/node_modules/@modelcontextprotocol/client/dist/stdio.mjs +8 -2
- package/node_modules/@modelcontextprotocol/{core/dist/auth-hYtaIUZm.d.cts.map → client/node_modules/@modelcontextprotocol/core/dist/auth--n_Yzytt.d.cts.map} +1 -1
- package/node_modules/@modelcontextprotocol/{core/dist/auth-CfDMXiII.cjs → client/node_modules/@modelcontextprotocol/core/dist/auth-4-zilcqg.cjs} +3 -2
- package/node_modules/@modelcontextprotocol/{core/dist/auth-CUe6YdwF.mjs → client/node_modules/@modelcontextprotocol/core/dist/auth-CGP0BDVq.mjs} +3 -2
- package/node_modules/@modelcontextprotocol/{core/dist/auth-BWdKR39I.d.mts.map → client/node_modules/@modelcontextprotocol/core/dist/auth-YUQV3RRv.d.mts.map} +1 -1
- package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/index.cjs +1 -1
- package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/index.mjs +1 -1
- package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.cjs +1 -1
- package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.mjs +1 -1
- package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/package.json +1 -1
- package/node_modules/@modelcontextprotocol/client/package.json +4 -4
- package/node_modules/@types/node/README.md +2 -2
- package/node_modules/@types/node/package.json +2 -17
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/CHANGELOG.md +311 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/README.md +6 -6
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/dist/index.js +4830 -1974
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/dist/internal/index.js +694 -332
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/00-introduction/index.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/02-providers-and-models.mdx +5 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/03-prompts.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/04-tools.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/06-provider-options.mdx +11 -11
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/00-choosing-a-provider.mdx +4 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/02-nextjs-app-router.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/03-nextjs-pages-router.mdx +4 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/04-svelte.mdx +7 -7
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/05-nuxt.mdx +8 -8
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/06-nodejs.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/07-expo.mdx +10 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/08-tanstack-start.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/09-coding-agents.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/02-building-agents.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/03-workflows.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/04-loop-control.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/05-configuring-call-options.mdx +4 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-memory.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-policy-tool-approvals.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-tool-approvals.mdx +16 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/07-workflow-agent.mdx +12 -12
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/08-terminal-ui.mdx +14 -10
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/05-generating-text.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/15-tools-and-tool-calling.mdx +6 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/16-mcp-tools.mdx +31 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/17-mcp-apps.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/18-code-mode.mdx +50 -0
- package/node_modules/ai/docs/03-ai-sdk-core/19-tool-search.mdx +82 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/20-prompt-engineering.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/26-reasoning.mdx +15 -14
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/31-reranking.mdx +12 -10
- package/node_modules/ai/docs/03-ai-sdk-core/32-evaluation.mdx +287 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/35-image-generation.mdx +40 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-realtime.mdx +41 -18
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-transcription.mdx +1 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/37-speech.mdx +8 -6
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/39-file-uploads.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/40-middleware.mdx +92 -7
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/41-skill-uploads.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/42-batch.mdx +2 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/45-provider-management.mdx +31 -21
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/55-testing.mdx +75 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/60-telemetry.mdx +57 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/65-devtools.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/65-lifecycle-callbacks.mdx +132 -7
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/index.mdx +6 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/01-overview.mdx +3 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/02-harness-agent.mdx +151 -112
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/03-tools.mdx +47 -22
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/04-skills.mdx +0 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/05-harness-adapters.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/06-workflow-utilities.mdx +43 -9
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/07-ui.mdx +33 -30
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/08-terminal-ui.mdx +8 -6
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/01-overview.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/02-chatbot.mdx +47 -21
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-message-persistence.mdx +46 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-resume-streams.mdx +11 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/03-chatbot-tool-usage.mdx +10 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/05-completion.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/08-object-generation.mdx +4 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/21-error-handling.mdx +28 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/21-transport.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/02-streaming-react-components.mdx +5 -5
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/04-multistep-interfaces.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/06-loading-state.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/10-migrating-to-ui.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/02-stopping-streams.mdx +8 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/04-caching.mdx +2 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/11-secure-url-fetching.mdx +47 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/01-generate-text.mdx +13 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/02-stream-text.mdx +16 -7
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/06-rerank.mdx +5 -5
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-transcribe.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/12-generate-speech.mdx +3 -3
- package/node_modules/ai/docs/07-reference/01-ai-sdk-core/14-evaluate.mdx +74 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/16-tool-loop-agent.mdx +4 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/20-start-batch.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/20-tool.mdx +7 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/22-dynamic-tool.mdx +7 -0
- package/node_modules/ai/docs/07-reference/01-ai-sdk-core/23-tool-search.mdx +76 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/32-validate-ui-messages.mdx +30 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/33-safe-validate-ui-messages.mdx +12 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/40-provider-registry.mdx +19 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/42-custom-provider.mdx +22 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/60-wrap-language-model.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/61-wrap-image-model.mdx +17 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/index.mdx +6 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/01-use-chat.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/03-use-object.mdx +4 -1
- package/node_modules/ai/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +563 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-messages.mdx +12 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/40-create-ui-message-stream.mdx +9 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/50-direct-chat-transport.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/01-stream-ui.mdx +2 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/02-create-ai.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/03-create-streamable-ui.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/01-workflow-agent.mdx +8 -8
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/02-workflow-chat-transport.mdx +4 -4
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-api-call-error.mdx +4 -0
- package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/ai-evaluation-unsupported-question-type-error.mdx +31 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-model-error.mdx +4 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-error.mdx +4 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-ui-message-stream-error.mdx +6 -2
- package/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +138 -0
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/06-ai-sdk-tui/01-run-agent-tui.mdx +13 -9
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/29-migration-guide-4-0.mdx +5 -5
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/37-migration-guide-3-3.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/11-use-chat-custom-request-options.mdx +3 -3
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/13-repeated-assistant-messages.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/17-use-chat-stale-body-data.mdx +1 -1
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/70-high-memory-usage-with-images.mdx +2 -2
- package/node_modules/{@maka/runtime/node_modules/ai → ai}/package.json +13 -13
- package/node_modules/image-dimensions/cli.js +18 -3
- package/node_modules/image-dimensions/index.js +7 -5
- package/node_modules/image-dimensions/package.json +4 -1
- package/node_modules/image-dimensions/readme.md +2 -1
- package/node_modules/image-dimensions/types/avif.js +2 -24
- package/node_modules/image-dimensions/types/heic.js +2 -24
- package/node_modules/image-dimensions/types/jpeg.js +28 -7
- package/node_modules/image-dimensions/types/png.js +13 -2
- package/node_modules/image-dimensions/types/webp.js +20 -36
- package/node_modules/image-dimensions/utilities.js +184 -60
- package/node_modules/ip-address/README.md +145 -135
- package/node_modules/ip-address/dist/common.js +48 -0
- package/node_modules/ip-address/dist/ipv4.js +117 -11
- package/node_modules/ip-address/dist/ipv6.js +162 -48
- package/node_modules/ip-address/dist/v4/constants.js +40 -1
- package/node_modules/ip-address/dist/v6/constants.js +47 -1
- package/node_modules/ip-address/package.json +1 -1
- package/node_modules/marked/README.md +1 -0
- package/node_modules/marked/lib/marked.esm.js +30 -29
- package/node_modules/marked/lib/marked.umd.js +30 -29
- package/node_modules/marked/man/marked.1 +1 -1
- package/node_modules/marked/package.json +11 -11
- package/node_modules/systeminformation/lib/battery.js +32 -11
- package/node_modules/systeminformation/lib/cpu.js +23 -23
- package/node_modules/systeminformation/lib/filesystem.js +14 -8
- package/node_modules/systeminformation/lib/memory.js +3 -5
- package/node_modules/systeminformation/lib/network.js +8 -2
- package/node_modules/systeminformation/lib/osinfo.js +17 -3
- package/node_modules/systeminformation/lib/util.js +7 -0
- package/node_modules/systeminformation/package.json +1 -1
- package/node_modules/undici/README.md +10 -1
- package/node_modules/undici/docs/docs/api/Agent.md +8 -8
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +9 -6
- package/node_modules/undici/docs/docs/api/Dispatcher.md +9 -0
- package/node_modules/undici/docs/docs/api/Errors.md +25 -0
- package/node_modules/undici/docs/docs/api/Fetch.md +10 -0
- package/node_modules/undici/docs/docs/api/Interceptors.md +4 -3
- package/node_modules/undici/docs/docs/api/Pool.md +5 -6
- package/node_modules/undici/docs/docs/index.md +10 -1
- package/node_modules/undici/lib/api/readable.js +1 -2
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/util.js +0 -39
- package/node_modules/undici/lib/dispatcher/client-h1.js +11 -4
- package/node_modules/undici/lib/dispatcher/client-h2.js +52 -8
- package/node_modules/undici/lib/dispatcher/client.js +6 -1
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +21 -6
- package/node_modules/undici/lib/dispatcher/pool-base.js +63 -2
- package/node_modules/undici/lib/dispatcher/pool.js +90 -7
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +16 -3
- package/node_modules/undici/lib/handler/deduplication-handler.js +24 -11
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -0
- package/node_modules/undici/lib/handler/retry-handler.js +72 -13
- package/node_modules/undici/lib/interceptor/cache.js +4 -1
- package/node_modules/undici/lib/interceptor/decompress.js +236 -69
- package/node_modules/undici/lib/web/cache/cache.js +17 -8
- package/node_modules/undici/lib/web/cache/cachestorage.js +11 -5
- package/node_modules/undici/lib/web/cookies/index.js +19 -7
- package/node_modules/undici/lib/web/cookies/util.js +3 -1
- package/node_modules/undici/lib/web/eventsource/eventsource.js +25 -1
- package/node_modules/undici/lib/web/fetch/body.js +22 -15
- package/node_modules/undici/lib/web/fetch/data-url.js +6 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +30 -36
- package/node_modules/undici/lib/web/fetch/headers.js +34 -31
- package/node_modules/undici/lib/web/fetch/index.js +46 -25
- package/node_modules/undici/lib/web/fetch/request.js +74 -79
- package/node_modules/undici/lib/web/fetch/response.js +43 -44
- package/node_modules/undici/lib/web/fetch/util.js +7 -7
- package/node_modules/undici/lib/web/infra/index.js +16 -1
- package/node_modules/undici/lib/web/webidl/index.js +2 -14
- package/node_modules/undici/lib/web/websocket/connection.js +33 -12
- package/node_modules/undici/lib/web/websocket/events.js +43 -26
- package/node_modules/undici/lib/web/websocket/receiver.js +2 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketerror.js +13 -10
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +19 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +44 -41
- package/node_modules/undici/package.json +1 -1
- package/package.json +4 -4
- package/node_modules/@ai-sdk/anthropic/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/cohere/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/google/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/open-responses/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/LICENSE +0 -13
- package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/openai/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/LICENSE +0 -13
- package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/openai-compatible/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/LICENSE +0 -13
- package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@ai-sdk/provider-utils/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@earendil-works/pi-tui/native/darwin/src/darwin-modifiers.c +0 -70
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/src/win32-console-mode.c +0 -119
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/LICENSE +0 -13
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/code-mode/dist/code-mode-tool.js +0 -40
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/gateway/LICENSE +0 -13
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/CHANGELOG.md +0 -1262
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/LICENSE +0 -13
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/README.md +0 -1
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/dist/index.js +0 -426
- package/node_modules/@maka/runtime/node_modules/@ai-sdk/provider/package.json +0 -63
- package/node_modules/@maka/runtime/node_modules/ai/LICENSE +0 -13
- package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/02-ai-sdk-ui/05-use-realtime.mdx +0 -247
- package/node_modules/@maka/runtime/node_modules/ai/docs/07-reference/05-ai-sdk-errors/index.mdx +0 -43
- package/node_modules/@modelcontextprotocol/client/dist/index-CHhhk6PQ.d.cts.map +0 -1
- package/node_modules/@modelcontextprotocol/client/dist/index-D4xIIEF6.d.mts.map +0 -1
- /package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → code-mode}/LICENSE +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/README.md +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/approval.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/continuation-capability.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/direct-tool-call.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/host-interrupt.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/index.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/run-code-mode.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/tool-invocation.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/types.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/dist/utils/serialization.js +0 -0
- /package/node_modules/{@maka/runtime/node_modules/@ai-sdk → @ai-sdk}/code-mode/src/tsconfig.json +0 -0
- /package/node_modules/@ai-sdk/{cohere/node_modules/@ai-sdk/provider → gateway}/LICENSE +0 -0
- /package/node_modules/@ai-sdk/{google/node_modules/@ai-sdk/provider → provider}/LICENSE +0 -0
- /package/node_modules/@ai-sdk/{anthropic/node_modules/@ai-sdk/provider → provider}/README.md +0 -0
- /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/LICENSE +0 -0
- /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/README.md +0 -0
- /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.d.cts.map +0 -0
- /package/node_modules/@modelcontextprotocol/{core → client/node_modules/@modelcontextprotocol/core}/dist/internal.d.mts.map +0 -0
- /package/node_modules/{@ai-sdk/open-responses/node_modules/@ai-sdk/provider → ai}/LICENSE +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/01-overview.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/05-streaming.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-foundations/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/01-navigating-the-library.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/02-getting-started/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/01-overview.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/06-subagents.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-agents/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/01-overview.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/10-generating-structured-data.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/17-runtime-and-tool-context.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/25-settings.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/30-embeddings.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/36-translation.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/38-video-generation.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-core/50-error-handling.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/03-ai-sdk-harnesses/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/04-generative-user-interfaces.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/20-streaming-data.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/24-reading-ui-message-streams.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/25-message-metadata.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/50-stream-protocol.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/04-ai-sdk-ui/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/01-overview.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/03-generative-ui-state.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/03-saving-and-restoring-states.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/05-streaming-values.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/08-error-handling.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/09-authentication.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/05-ai-sdk-rsc/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/01-prompt-engineering.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/03-backpressure.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/05-multiple-streamables.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/06-rate-limiting.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/07-rendering-ui-with-language-models.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/08-model-as-router.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/09-multistep-interfaces.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/09-sequential-generations.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/10-vercel-deployment-guide.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/06-advanced/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/05-embed.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/06-embed-many.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/10-generate-image.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-stream-transcribe.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/11-stream-translate.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/14-upload-file.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/14-upload-skill.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/15-agent.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/17-create-agent-ui-stream.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/18-create-agent-ui-stream-response.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/18-pipe-agent-ui-stream-to-response.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/21-get-batch-status.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/22-get-batch-results.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-cancel-batch.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-create-mcp-client.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/23-get-realtime-tool-definitions.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-list-batches.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-mcp-apps.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/24-mcp-stdio-transport.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/25-json-schema.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/26-zod-schema.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/27-valibot-schema.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/28-output.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/29-filter-active-tools.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/30-model-message.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/31-ui-message.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/34-sandbox.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/50-cosine-similarity.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/65-language-model-v2-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/66-extract-reasoning-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/67-simulate-streaming-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/68-default-instructions-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/68-default-settings-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/69-add-tool-input-examples-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/70-extract-json-middleware.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/70-is-step-count.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/71-has-tool-call.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/72-loop-finished.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/75-simulate-readable-stream.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/80-smooth-stream.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/90-generate-id.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/91-create-id-generator.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/01-ai-sdk-core/92-default-generated-file.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/02-use-completion.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/32-prune-messages.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/41-create-ui-message-stream-response.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/42-pipe-ui-message-stream-to-response.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/43-read-ui-message-stream.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/46-infer-ui-tools.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/47-infer-ui-tool.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/48-mcp-app-renderer.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/02-ai-sdk-ui/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/04-create-streamable-value.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/05-read-streamable-value.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/06-get-ai-state.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/07-get-mutable-ai-state.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/08-use-ai-state.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/09-use-actions.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/10-use-ui-state.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/11-use-streamable-value.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/20-render.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/03-ai-sdk-rsc/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/03-generate-video.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/04-ai-sdk-workflow/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-download-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-empty-response-body-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-argument-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-data-content-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-message-role-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-prompt-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-response-data-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-approval-signature-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-invalid-tool-input-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-json-parse-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-load-api-key-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-load-setting-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-message-conversion-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-content-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-image-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-object-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-output-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-speech-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-provider-reference-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-such-tool-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-transcript-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-translation-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-no-video-generated-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-retry-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-stream-provider-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-too-many-embedding-values-for-call-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-not-found-for-approval-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-call-repair-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-tool-choice-violation-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-type-validation-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/05-ai-sdk-errors/ai-unsupported-functionality-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/06-ai-sdk-tui/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/07-reference/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/00-versioning.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/23-migration-guide-7-0.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/24-migration-guide-6-0.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/25-migration-guide-5-0-data.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/26-migration-guide-5-0.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/27-migration-guide-4-2.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/28-migration-guide-4-1.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/36-migration-guide-3-4.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/38-migration-guide-3-2.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/39-migration-guide-3-1.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/08-migration-guides/index.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/01-azure-stream-slow.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/03-server-actions-in-client-components.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/04-strange-stream-output.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/05-streamable-ui-errors.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/05-tool-invocation-missing-result.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-streaming-not-working-when-deployed.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-streaming-not-working-when-proxied.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/06-timeout-on-vercel.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/07-unclosed-streams.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/08-use-chat-failed-to-parse-stream.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/09-client-stream-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/10-use-chat-tools-no-response.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/12-typescript-performance-zod.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/12-use-chat-an-error-occurred.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/14-stream-abort-handling.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/14-tool-calling-with-structured-outputs.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/15-abort-breaks-resumable-streams.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/15-stream-text-not-working.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/16-streaming-status-delay.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/18-ontoolcall-type-narrowing.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/19-unsupported-model-version.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/20-no-object-generated-content-filter.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/21-missing-tool-results-error.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/30-model-is-not-assignable-to-type.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/40-typescript-cannot-find-namespace-jsx.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/50-react-maximum-update-depth-exceeded.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/60-jest-cannot-find-module-ai-rsc.mdx +0 -0
- /package/node_modules/{@maka/runtime/node_modules/ai → ai}/docs/09-troubleshooting/index.mdx +0 -0
|
@@ -10,17 +10,16 @@ function asAsyncIterableStream(stream) {
|
|
|
10
10
|
const reader = this.getReader();
|
|
11
11
|
let finished = false;
|
|
12
12
|
async function cleanup(cancelStream) {
|
|
13
|
-
var _a12;
|
|
14
13
|
if (finished) return;
|
|
15
14
|
finished = true;
|
|
16
15
|
try {
|
|
17
16
|
if (cancelStream) {
|
|
18
|
-
await
|
|
17
|
+
await reader.cancel?.();
|
|
19
18
|
}
|
|
20
19
|
} finally {
|
|
21
20
|
try {
|
|
22
21
|
reader.releaseLock();
|
|
23
|
-
} catch
|
|
22
|
+
} catch {
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
}
|
|
@@ -85,13 +84,13 @@ import {
|
|
|
85
84
|
DownloadError,
|
|
86
85
|
readResponseWithSizeLimit,
|
|
87
86
|
DEFAULT_MAX_DOWNLOAD_SIZE,
|
|
88
|
-
|
|
87
|
+
fetchUntrustedUrl,
|
|
89
88
|
withUserAgentSuffix,
|
|
90
89
|
getRuntimeEnvironmentUserAgent
|
|
91
90
|
} from "@ai-sdk/provider-utils";
|
|
92
91
|
|
|
93
92
|
// src/version.ts
|
|
94
|
-
var VERSION = true ? "7.0.
|
|
93
|
+
var VERSION = true ? "7.0.122" : "0.0.0-test";
|
|
95
94
|
|
|
96
95
|
// src/util/download/download.ts
|
|
97
96
|
var download = async ({
|
|
@@ -99,7 +98,6 @@ var download = async ({
|
|
|
99
98
|
maxBytes,
|
|
100
99
|
abortSignal
|
|
101
100
|
}) => {
|
|
102
|
-
var _a12;
|
|
103
101
|
const urlText = url.toString();
|
|
104
102
|
try {
|
|
105
103
|
const headers = withUserAgentSuffix(
|
|
@@ -107,7 +105,7 @@ var download = async ({
|
|
|
107
105
|
`ai-sdk/${VERSION}`,
|
|
108
106
|
getRuntimeEnvironmentUserAgent()
|
|
109
107
|
);
|
|
110
|
-
const response = await
|
|
108
|
+
const response = await fetchUntrustedUrl({
|
|
111
109
|
url: urlText,
|
|
112
110
|
headers,
|
|
113
111
|
abortSignal
|
|
@@ -123,11 +121,11 @@ var download = async ({
|
|
|
123
121
|
const data = await readResponseWithSizeLimit({
|
|
124
122
|
response,
|
|
125
123
|
url: urlText,
|
|
126
|
-
maxBytes: maxBytes
|
|
124
|
+
maxBytes: maxBytes ?? DEFAULT_MAX_DOWNLOAD_SIZE
|
|
127
125
|
});
|
|
128
126
|
return {
|
|
129
127
|
data,
|
|
130
|
-
mediaType:
|
|
128
|
+
mediaType: response.headers.get("content-type") ?? void 0
|
|
131
129
|
};
|
|
132
130
|
} catch (error) {
|
|
133
131
|
if (DownloadError.isInstance(error)) {
|
|
@@ -138,9 +136,9 @@ var download = async ({
|
|
|
138
136
|
};
|
|
139
137
|
|
|
140
138
|
// src/util/download/download-function.ts
|
|
141
|
-
var createDefaultDownloadFunction = (download2 = download) => (requestedDownloads) => Promise.all(
|
|
139
|
+
var createDefaultDownloadFunction = (download2 = download, abortSignal) => (requestedDownloads) => Promise.all(
|
|
142
140
|
requestedDownloads.map(
|
|
143
|
-
async (requestedDownload) => requestedDownload.isUrlSupportedByModel ? null : await download2(requestedDownload)
|
|
141
|
+
async (requestedDownload) => requestedDownload.isUrlSupportedByModel ? null : await download2({ ...requestedDownload, abortSignal })
|
|
144
142
|
)
|
|
145
143
|
);
|
|
146
144
|
|
|
@@ -214,7 +212,7 @@ function splitDataUrl(dataUrl) {
|
|
|
214
212
|
mediaType: header.split(";")[0].split(":")[1],
|
|
215
213
|
base64Content
|
|
216
214
|
};
|
|
217
|
-
} catch
|
|
215
|
+
} catch {
|
|
218
216
|
return {
|
|
219
217
|
mediaType: void 0,
|
|
220
218
|
base64Content: void 0
|
|
@@ -228,7 +226,7 @@ function isTaggedFileData(value) {
|
|
|
228
226
|
const type = value.type;
|
|
229
227
|
return type === "data" || type === "url" || type === "reference" || type === "text";
|
|
230
228
|
}
|
|
231
|
-
function convertUrlToFilePartData(url) {
|
|
229
|
+
function convertUrlToFilePartData(url, originalUrl) {
|
|
232
230
|
if (url.protocol === "data:") {
|
|
233
231
|
const { mediaType, base64Content } = splitDataUrl(url.toString());
|
|
234
232
|
if (mediaType == null || base64Content == null) {
|
|
@@ -239,7 +237,17 @@ function convertUrlToFilePartData(url) {
|
|
|
239
237
|
}
|
|
240
238
|
return { data: { type: "data", data: base64Content }, mediaType };
|
|
241
239
|
}
|
|
242
|
-
return {
|
|
240
|
+
return {
|
|
241
|
+
data: { type: "url", url, ...originalUrl != null ? { originalUrl } : {} },
|
|
242
|
+
mediaType: void 0
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
function convertUrlStringToFilePartData(content) {
|
|
246
|
+
const result = convertUrlToFilePartData(new URL(content));
|
|
247
|
+
if (result.data.type === "url" && result.data.url.toString() !== content) {
|
|
248
|
+
result.data.originalUrl = content;
|
|
249
|
+
}
|
|
250
|
+
return result;
|
|
243
251
|
}
|
|
244
252
|
function convertInlineDataToFilePartData(content) {
|
|
245
253
|
if (content instanceof Uint8Array) {
|
|
@@ -274,7 +282,7 @@ function convertToLanguageModelV4FilePart(content) {
|
|
|
274
282
|
}
|
|
275
283
|
return convertInlineDataToFilePartData(content.data);
|
|
276
284
|
case "url":
|
|
277
|
-
return convertUrlToFilePartData(content.url);
|
|
285
|
+
return convertUrlToFilePartData(content.url, content.originalUrl);
|
|
278
286
|
case "reference":
|
|
279
287
|
return {
|
|
280
288
|
data: { type: "reference", reference: content.reference },
|
|
@@ -292,8 +300,8 @@ function convertToLanguageModelV4FilePart(content) {
|
|
|
292
300
|
}
|
|
293
301
|
if (typeof content === "string") {
|
|
294
302
|
try {
|
|
295
|
-
return
|
|
296
|
-
} catch
|
|
303
|
+
return convertUrlStringToFilePartData(content);
|
|
304
|
+
} catch {
|
|
297
305
|
return convertInlineDataToFilePartData(content);
|
|
298
306
|
}
|
|
299
307
|
}
|
|
@@ -430,14 +438,15 @@ var MissingToolResultsError = class extends (_b3 = AISDKError3, _a3 = symbol3, _
|
|
|
430
438
|
async function convertToLanguageModelPrompt({
|
|
431
439
|
prompt,
|
|
432
440
|
supportedUrls,
|
|
433
|
-
download: download2
|
|
441
|
+
download: download2,
|
|
442
|
+
abortSignal,
|
|
434
443
|
// `provider` is only needed here to convert legacy tool output types via `mapToolResultOutput`.
|
|
435
444
|
// TODO: remove in v8 when "file-id" and "image-file-id" types are removed
|
|
436
445
|
provider
|
|
437
446
|
}) {
|
|
438
447
|
const downloadedAssets = await downloadAssets(
|
|
439
448
|
prompt.messages,
|
|
440
|
-
download2,
|
|
449
|
+
download2 ?? createDefaultDownloadFunction(void 0, abortSignal),
|
|
441
450
|
supportedUrls
|
|
442
451
|
);
|
|
443
452
|
const approvalIdToToolCallId = /* @__PURE__ */ new Map();
|
|
@@ -483,7 +492,7 @@ async function convertToLanguageModelPrompt({
|
|
|
483
492
|
continue;
|
|
484
493
|
}
|
|
485
494
|
const lastCombinedMessage = combinedMessages.at(-1);
|
|
486
|
-
if (
|
|
495
|
+
if (lastCombinedMessage?.role === "tool") {
|
|
487
496
|
const lastContentPart = lastCombinedMessage.content.at(-1);
|
|
488
497
|
if (lastContentPart != null && lastCombinedMessage.providerOptions != null) {
|
|
489
498
|
lastContentPart.providerOptions = mergeObjects(
|
|
@@ -620,7 +629,7 @@ function convertToLanguageModelMessage({
|
|
|
620
629
|
type: "file",
|
|
621
630
|
data,
|
|
622
631
|
filename: part.filename,
|
|
623
|
-
mediaType: mediaType
|
|
632
|
+
mediaType: mediaType ?? part.mediaType,
|
|
624
633
|
providerOptions
|
|
625
634
|
};
|
|
626
635
|
}
|
|
@@ -643,7 +652,7 @@ function convertToLanguageModelMessage({
|
|
|
643
652
|
return {
|
|
644
653
|
type: "reasoning-file",
|
|
645
654
|
data,
|
|
646
|
-
mediaType: mediaType
|
|
655
|
+
mediaType: mediaType ?? part.mediaType,
|
|
647
656
|
providerOptions
|
|
648
657
|
};
|
|
649
658
|
}
|
|
@@ -733,14 +742,13 @@ function convertToLanguageModelMessage({
|
|
|
733
742
|
}
|
|
734
743
|
}
|
|
735
744
|
function convertImagePartToFilePart(part) {
|
|
736
|
-
var _a12;
|
|
737
745
|
if (part.type !== "image") {
|
|
738
746
|
return part;
|
|
739
747
|
}
|
|
740
748
|
return {
|
|
741
749
|
type: "file",
|
|
742
750
|
data: part.image,
|
|
743
|
-
mediaType:
|
|
751
|
+
mediaType: part.mediaType ?? "image",
|
|
744
752
|
providerOptions: part.providerOptions
|
|
745
753
|
};
|
|
746
754
|
}
|
|
@@ -817,7 +825,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
|
817
825
|
};
|
|
818
826
|
}
|
|
819
827
|
const { data: normalizedData, mediaType: dataUrlMediaType } = convertToLanguageModelV4FilePart(part.data);
|
|
820
|
-
let mediaType = dataUrlMediaType
|
|
828
|
+
let mediaType = dataUrlMediaType ?? part.mediaType;
|
|
821
829
|
let data = normalizedData;
|
|
822
830
|
if (data.type === "url") {
|
|
823
831
|
const downloadedFile = downloadedAssets[data.url.toString()];
|
|
@@ -862,7 +870,6 @@ function mapToolResultOutput({
|
|
|
862
870
|
return {
|
|
863
871
|
type: "content",
|
|
864
872
|
value: output.value.map((item) => {
|
|
865
|
-
var _a12;
|
|
866
873
|
switch (item.type) {
|
|
867
874
|
case "file": {
|
|
868
875
|
const convertedPart = convertPartToLanguageModelPart(
|
|
@@ -891,7 +898,8 @@ function mapToolResultOutput({
|
|
|
891
898
|
};
|
|
892
899
|
}
|
|
893
900
|
case "file-url": {
|
|
894
|
-
const mediaType =
|
|
901
|
+
const mediaType = item.mediaType ?? getMediaTypeFromUrl(item.url);
|
|
902
|
+
const url = new URL(item.url);
|
|
895
903
|
let message = `The "file-url" type for tool result content is deprecated. Use the "file" type with mediaType and { type: 'url', url } instead.`;
|
|
896
904
|
if (!item.mediaType) {
|
|
897
905
|
const inferenceSuffix = mediaType === "application/octet-stream" ? `Unable to infer media type from URL. Defaulting to 'application/octet-stream'.` : `Inferred media type '${mediaType}' from URL.`;
|
|
@@ -904,7 +912,11 @@ function mapToolResultOutput({
|
|
|
904
912
|
});
|
|
905
913
|
return {
|
|
906
914
|
type: "file",
|
|
907
|
-
data: {
|
|
915
|
+
data: {
|
|
916
|
+
type: "url",
|
|
917
|
+
url,
|
|
918
|
+
...url.toString() !== item.url ? { originalUrl: item.url } : {}
|
|
919
|
+
},
|
|
908
920
|
mediaType,
|
|
909
921
|
providerOptions: item.providerOptions
|
|
910
922
|
};
|
|
@@ -960,6 +972,7 @@ function mapToolResultOutput({
|
|
|
960
972
|
};
|
|
961
973
|
}
|
|
962
974
|
case "image-url": {
|
|
975
|
+
const url = new URL(item.url);
|
|
963
976
|
warnings.push({
|
|
964
977
|
type: "deprecated",
|
|
965
978
|
setting: '"tool-result" content of type "image-url"',
|
|
@@ -967,7 +980,11 @@ function mapToolResultOutput({
|
|
|
967
980
|
});
|
|
968
981
|
return {
|
|
969
982
|
type: "file",
|
|
970
|
-
data: {
|
|
983
|
+
data: {
|
|
984
|
+
type: "url",
|
|
985
|
+
url,
|
|
986
|
+
...url.toString() !== item.url ? { originalUrl: item.url } : {}
|
|
987
|
+
},
|
|
971
988
|
mediaType: "image",
|
|
972
989
|
providerOptions: item.providerOptions
|
|
973
990
|
};
|
|
@@ -1047,14 +1064,13 @@ var URL_EXTENSION_TO_MEDIA_TYPE = {
|
|
|
1047
1064
|
ogg: "audio/ogg"
|
|
1048
1065
|
};
|
|
1049
1066
|
function getMediaTypeFromUrl(url, fallbackMediaType = "application/octet-stream") {
|
|
1050
|
-
var _a12;
|
|
1051
1067
|
try {
|
|
1052
1068
|
const pathname = new URL(url).pathname;
|
|
1053
|
-
const fileExtension =
|
|
1069
|
+
const fileExtension = pathname.split(".").pop()?.toLowerCase();
|
|
1054
1070
|
if (fileExtension && Object.hasOwn(URL_EXTENSION_TO_MEDIA_TYPE, fileExtension)) {
|
|
1055
1071
|
return URL_EXTENSION_TO_MEDIA_TYPE[fileExtension];
|
|
1056
1072
|
}
|
|
1057
|
-
} catch
|
|
1073
|
+
} catch {
|
|
1058
1074
|
}
|
|
1059
1075
|
return fallbackMediaType;
|
|
1060
1076
|
}
|
|
@@ -1065,7 +1081,7 @@ async function createToolModelOutput({
|
|
|
1065
1081
|
toolCallId,
|
|
1066
1082
|
input,
|
|
1067
1083
|
output,
|
|
1068
|
-
tool,
|
|
1084
|
+
tool: tool2,
|
|
1069
1085
|
errorMode
|
|
1070
1086
|
}) {
|
|
1071
1087
|
if (errorMode === "text") {
|
|
@@ -1073,13 +1089,17 @@ async function createToolModelOutput({
|
|
|
1073
1089
|
} else if (errorMode === "json") {
|
|
1074
1090
|
return { type: "error-json", value: toJSONValue(output) };
|
|
1075
1091
|
}
|
|
1076
|
-
if (
|
|
1077
|
-
return await
|
|
1092
|
+
if (tool2?.toModelOutput) {
|
|
1093
|
+
return await tool2.toModelOutput({ toolCallId, input, output });
|
|
1078
1094
|
}
|
|
1079
1095
|
return typeof output === "string" ? { type: "text", value: output } : { type: "json", value: toJSONValue(output) };
|
|
1080
1096
|
}
|
|
1081
1097
|
function toJSONValue(value) {
|
|
1082
|
-
|
|
1098
|
+
if (value === void 0) {
|
|
1099
|
+
return null;
|
|
1100
|
+
}
|
|
1101
|
+
const serialized = JSON.stringify(value);
|
|
1102
|
+
return serialized === void 0 ? null : JSON.parse(serialized);
|
|
1083
1103
|
}
|
|
1084
1104
|
|
|
1085
1105
|
// src/prompt/prepare-tool-choice.ts
|
|
@@ -1110,25 +1130,25 @@ async function prepareTools({
|
|
|
1110
1130
|
return void 0;
|
|
1111
1131
|
}
|
|
1112
1132
|
const languageModelTools = [];
|
|
1113
|
-
for (const [name12,
|
|
1114
|
-
const toolType =
|
|
1133
|
+
for (const [name12, tool2] of orderToolEntries({ tools, toolOrder })) {
|
|
1134
|
+
const toolType = tool2.type;
|
|
1115
1135
|
switch (toolType) {
|
|
1116
1136
|
case void 0:
|
|
1117
1137
|
case "dynamic":
|
|
1118
1138
|
case "function": {
|
|
1119
1139
|
const description = resolveToolDescription({
|
|
1120
|
-
tool,
|
|
1140
|
+
tool: tool2,
|
|
1121
1141
|
toolName: name12,
|
|
1122
1142
|
toolsContext,
|
|
1123
1143
|
experimental_sandbox: sandbox
|
|
1124
1144
|
});
|
|
1125
|
-
const providerOptions =
|
|
1126
|
-
const inputExamples =
|
|
1127
|
-
const strict =
|
|
1145
|
+
const providerOptions = tool2.providerOptions;
|
|
1146
|
+
const inputExamples = tool2.inputExamples;
|
|
1147
|
+
const strict = tool2.strict;
|
|
1128
1148
|
languageModelTools.push({
|
|
1129
1149
|
type: "function",
|
|
1130
1150
|
name: name12,
|
|
1131
|
-
inputSchema: await asSchema(
|
|
1151
|
+
inputSchema: await asSchema(tool2.inputSchema).jsonSchema,
|
|
1132
1152
|
...description != null ? { description } : {},
|
|
1133
1153
|
...inputExamples != null ? { inputExamples } : {},
|
|
1134
1154
|
...providerOptions != null ? { providerOptions } : {},
|
|
@@ -1140,8 +1160,8 @@ async function prepareTools({
|
|
|
1140
1160
|
languageModelTools.push({
|
|
1141
1161
|
type: "provider",
|
|
1142
1162
|
name: name12,
|
|
1143
|
-
id:
|
|
1144
|
-
args:
|
|
1163
|
+
id: tool2.id,
|
|
1164
|
+
args: tool2.args
|
|
1145
1165
|
});
|
|
1146
1166
|
break;
|
|
1147
1167
|
}
|
|
@@ -1168,12 +1188,12 @@ function orderToolEntries({
|
|
|
1168
1188
|
return [...orderedTools, ...unorderedTools];
|
|
1169
1189
|
}
|
|
1170
1190
|
function resolveToolDescription({
|
|
1171
|
-
tool,
|
|
1191
|
+
tool: tool2,
|
|
1172
1192
|
toolName,
|
|
1173
1193
|
toolsContext,
|
|
1174
1194
|
experimental_sandbox: sandbox
|
|
1175
1195
|
}) {
|
|
1176
|
-
return
|
|
1196
|
+
return tool2.description === void 0 ? void 0 : typeof tool2.description === "string" ? tool2.description : tool2.description({
|
|
1177
1197
|
context: toolsContext[toolName],
|
|
1178
1198
|
experimental_sandbox: sandbox
|
|
1179
1199
|
});
|
|
@@ -1440,7 +1460,10 @@ var toolApprovalRequestSchema = z.object(
|
|
|
1440
1460
|
type: z.literal("tool-approval-request"),
|
|
1441
1461
|
approvalId: z.string(),
|
|
1442
1462
|
toolCallId: z.string(),
|
|
1443
|
-
reason: z.string().optional()
|
|
1463
|
+
reason: z.string().optional(),
|
|
1464
|
+
isAutomatic: z.boolean().optional(),
|
|
1465
|
+
signature: z.string().optional(),
|
|
1466
|
+
inputSchemaInput: z.unknown().optional()
|
|
1444
1467
|
}
|
|
1445
1468
|
);
|
|
1446
1469
|
var toolApprovalResponseSchema = z.object({
|
|
@@ -1779,7 +1802,7 @@ function prepareRetries({
|
|
|
1779
1802
|
});
|
|
1780
1803
|
}
|
|
1781
1804
|
}
|
|
1782
|
-
const maxRetriesResult = maxRetries
|
|
1805
|
+
const maxRetriesResult = maxRetries ?? defaultMaxRetries;
|
|
1783
1806
|
return {
|
|
1784
1807
|
maxRetries: maxRetriesResult,
|
|
1785
1808
|
retry: retryWithExponentialBackoffRespectingRetryHeaders({
|
|
@@ -1829,49 +1852,52 @@ function createNullLanguageModelUsage() {
|
|
|
1829
1852
|
};
|
|
1830
1853
|
}
|
|
1831
1854
|
function addLanguageModelUsage(usage1, usage2) {
|
|
1832
|
-
var _a12, _b12, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1833
1855
|
return {
|
|
1834
1856
|
inputTokens: addTokenCounts(usage1.inputTokens, usage2.inputTokens),
|
|
1835
1857
|
inputTokenDetails: {
|
|
1836
1858
|
noCacheTokens: addTokenCounts(
|
|
1837
|
-
|
|
1838
|
-
|
|
1859
|
+
usage1.inputTokenDetails?.noCacheTokens,
|
|
1860
|
+
usage2.inputTokenDetails?.noCacheTokens
|
|
1839
1861
|
),
|
|
1840
1862
|
cacheReadTokens: addTokenCounts(
|
|
1841
|
-
|
|
1842
|
-
|
|
1863
|
+
usage1.inputTokenDetails?.cacheReadTokens,
|
|
1864
|
+
usage2.inputTokenDetails?.cacheReadTokens
|
|
1843
1865
|
),
|
|
1844
1866
|
cacheWriteTokens: addTokenCounts(
|
|
1845
|
-
|
|
1846
|
-
|
|
1867
|
+
usage1.inputTokenDetails?.cacheWriteTokens,
|
|
1868
|
+
usage2.inputTokenDetails?.cacheWriteTokens
|
|
1847
1869
|
)
|
|
1848
1870
|
},
|
|
1849
1871
|
outputTokens: addTokenCounts(usage1.outputTokens, usage2.outputTokens),
|
|
1850
1872
|
outputTokenDetails: {
|
|
1851
1873
|
textTokens: addTokenCounts(
|
|
1852
|
-
|
|
1853
|
-
|
|
1874
|
+
usage1.outputTokenDetails?.textTokens,
|
|
1875
|
+
usage2.outputTokenDetails?.textTokens
|
|
1854
1876
|
),
|
|
1855
1877
|
reasoningTokens: addTokenCounts(
|
|
1856
|
-
|
|
1857
|
-
|
|
1878
|
+
usage1.outputTokenDetails?.reasoningTokens,
|
|
1879
|
+
usage2.outputTokenDetails?.reasoningTokens
|
|
1858
1880
|
)
|
|
1859
1881
|
},
|
|
1860
1882
|
totalTokens: addTokenCounts(usage1.totalTokens, usage2.totalTokens)
|
|
1861
1883
|
};
|
|
1862
1884
|
}
|
|
1863
1885
|
function addTokenCounts(tokenCount1, tokenCount2) {
|
|
1864
|
-
return tokenCount1 == null && tokenCount2 == null ? void 0 : (tokenCount1
|
|
1886
|
+
return tokenCount1 == null && tokenCount2 == null ? void 0 : (tokenCount1 ?? 0) + (tokenCount2 ?? 0);
|
|
1865
1887
|
}
|
|
1866
1888
|
|
|
1867
1889
|
// src/model/resolve-model.ts
|
|
1868
1890
|
import { gateway } from "@ai-sdk/gateway";
|
|
1891
|
+
import {
|
|
1892
|
+
NoSuchModelError as NoSuchModelError2
|
|
1893
|
+
} from "@ai-sdk/provider";
|
|
1869
1894
|
|
|
1870
1895
|
// src/error/index.ts
|
|
1871
1896
|
import {
|
|
1872
1897
|
AISDKError as AISDKError13,
|
|
1873
1898
|
APICallError as APICallError2,
|
|
1874
1899
|
EmptyResponseBodyError,
|
|
1900
|
+
Experimental_EvaluationUnsupportedQuestionTypeError,
|
|
1875
1901
|
InvalidPromptError as InvalidPromptError2,
|
|
1876
1902
|
InvalidResponseDataError,
|
|
1877
1903
|
JSONParseError,
|
|
@@ -2117,6 +2143,9 @@ function asImageModelV4(model) {
|
|
|
2117
2143
|
});
|
|
2118
2144
|
}
|
|
2119
2145
|
|
|
2146
|
+
// src/model/as-language-model-v4.ts
|
|
2147
|
+
import { convertUint8ArrayToBase64 } from "@ai-sdk/provider-utils";
|
|
2148
|
+
|
|
2120
2149
|
// src/model/as-language-model-v3.ts
|
|
2121
2150
|
function asLanguageModelV3(model) {
|
|
2122
2151
|
if (model.specificationVersion === "v3") {
|
|
@@ -2204,11 +2233,131 @@ function asLanguageModelV4(model) {
|
|
|
2204
2233
|
const v3Model = model.specificationVersion === "v2" ? asLanguageModelV3(model) : model;
|
|
2205
2234
|
return new Proxy(v3Model, {
|
|
2206
2235
|
get(target, prop) {
|
|
2207
|
-
|
|
2208
|
-
|
|
2236
|
+
switch (prop) {
|
|
2237
|
+
case "specificationVersion":
|
|
2238
|
+
return "v4";
|
|
2239
|
+
case "doGenerate":
|
|
2240
|
+
return async (options) => {
|
|
2241
|
+
const result = await target.doGenerate({
|
|
2242
|
+
...options,
|
|
2243
|
+
prompt: convertV4PromptToV3(options.prompt)
|
|
2244
|
+
});
|
|
2245
|
+
return {
|
|
2246
|
+
...result,
|
|
2247
|
+
content: result.content.map(convertV3ContentToV4)
|
|
2248
|
+
};
|
|
2249
|
+
};
|
|
2250
|
+
case "doStream":
|
|
2251
|
+
return async (options) => {
|
|
2252
|
+
const result = await target.doStream({
|
|
2253
|
+
...options,
|
|
2254
|
+
prompt: convertV4PromptToV3(options.prompt)
|
|
2255
|
+
});
|
|
2256
|
+
return {
|
|
2257
|
+
...result,
|
|
2258
|
+
stream: convertV3StreamToV4(result.stream)
|
|
2259
|
+
};
|
|
2260
|
+
};
|
|
2261
|
+
default:
|
|
2262
|
+
return target[prop];
|
|
2263
|
+
}
|
|
2264
|
+
}
|
|
2265
|
+
});
|
|
2266
|
+
}
|
|
2267
|
+
function convertV4PromptToV3(prompt) {
|
|
2268
|
+
return prompt.map((message) => {
|
|
2269
|
+
if (message.role === "system") {
|
|
2270
|
+
return message;
|
|
2209
2271
|
}
|
|
2272
|
+
return {
|
|
2273
|
+
...message,
|
|
2274
|
+
content: message.content.map((part) => {
|
|
2275
|
+
switch (part.type) {
|
|
2276
|
+
case "file":
|
|
2277
|
+
return {
|
|
2278
|
+
...part,
|
|
2279
|
+
data: convertV4FileDataToV3(part.data)
|
|
2280
|
+
};
|
|
2281
|
+
case "tool-result":
|
|
2282
|
+
return {
|
|
2283
|
+
...part,
|
|
2284
|
+
output: convertV4ToolResultOutputToV3(part.output)
|
|
2285
|
+
};
|
|
2286
|
+
default:
|
|
2287
|
+
return part;
|
|
2288
|
+
}
|
|
2289
|
+
})
|
|
2290
|
+
};
|
|
2210
2291
|
});
|
|
2211
2292
|
}
|
|
2293
|
+
function convertV4FileDataToV3(data) {
|
|
2294
|
+
switch (data.type) {
|
|
2295
|
+
case "data":
|
|
2296
|
+
return data.data;
|
|
2297
|
+
case "url":
|
|
2298
|
+
return data.url;
|
|
2299
|
+
case "reference":
|
|
2300
|
+
case "text":
|
|
2301
|
+
return data;
|
|
2302
|
+
}
|
|
2303
|
+
}
|
|
2304
|
+
function convertV4ToolResultOutputToV3(output) {
|
|
2305
|
+
if (output.type !== "content") {
|
|
2306
|
+
return output;
|
|
2307
|
+
}
|
|
2308
|
+
return {
|
|
2309
|
+
...output,
|
|
2310
|
+
value: output.value.map((part) => {
|
|
2311
|
+
if (part.type !== "file") {
|
|
2312
|
+
return part;
|
|
2313
|
+
}
|
|
2314
|
+
switch (part.data.type) {
|
|
2315
|
+
case "data":
|
|
2316
|
+
return {
|
|
2317
|
+
type: "file-data",
|
|
2318
|
+
data: typeof part.data.data === "string" ? part.data.data : convertUint8ArrayToBase64(part.data.data),
|
|
2319
|
+
mediaType: part.mediaType,
|
|
2320
|
+
filename: part.filename,
|
|
2321
|
+
providerOptions: part.providerOptions
|
|
2322
|
+
};
|
|
2323
|
+
case "url":
|
|
2324
|
+
return {
|
|
2325
|
+
type: "file-url",
|
|
2326
|
+
url: part.data.url.toString(),
|
|
2327
|
+
providerOptions: part.providerOptions
|
|
2328
|
+
};
|
|
2329
|
+
case "reference":
|
|
2330
|
+
return {
|
|
2331
|
+
type: "file-id",
|
|
2332
|
+
fileId: part.data.reference,
|
|
2333
|
+
providerOptions: part.providerOptions
|
|
2334
|
+
};
|
|
2335
|
+
case "text":
|
|
2336
|
+
return part;
|
|
2337
|
+
}
|
|
2338
|
+
})
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function convertV3ContentToV4(content) {
|
|
2342
|
+
return content.type === "file" ? {
|
|
2343
|
+
...content,
|
|
2344
|
+
data: { type: "data", data: content.data }
|
|
2345
|
+
} : content;
|
|
2346
|
+
}
|
|
2347
|
+
function convertV3StreamToV4(stream) {
|
|
2348
|
+
return stream.pipeThrough(
|
|
2349
|
+
new TransformStream({
|
|
2350
|
+
transform(chunk, controller) {
|
|
2351
|
+
controller.enqueue(
|
|
2352
|
+
chunk.type === "file" ? {
|
|
2353
|
+
...chunk,
|
|
2354
|
+
data: { type: "data", data: chunk.data }
|
|
2355
|
+
} : chunk
|
|
2356
|
+
);
|
|
2357
|
+
}
|
|
2358
|
+
})
|
|
2359
|
+
);
|
|
2360
|
+
}
|
|
2212
2361
|
|
|
2213
2362
|
// src/model/as-reranking-model-v4.ts
|
|
2214
2363
|
function asRerankingModelV4(model) {
|
|
@@ -2336,8 +2485,7 @@ function resolveLanguageModel(model) {
|
|
|
2336
2485
|
return asLanguageModelV4(model);
|
|
2337
2486
|
}
|
|
2338
2487
|
function getGlobalProvider() {
|
|
2339
|
-
|
|
2340
|
-
const provider = (_a12 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a12 : gateway;
|
|
2488
|
+
const provider = globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway;
|
|
2341
2489
|
return asProviderV4(provider);
|
|
2342
2490
|
}
|
|
2343
2491
|
|
|
@@ -2355,7 +2503,7 @@ function mergeCallbacks(...callbacks) {
|
|
|
2355
2503
|
return async (event) => {
|
|
2356
2504
|
await Promise.allSettled(
|
|
2357
2505
|
callbacks.map(async (callback) => {
|
|
2358
|
-
await
|
|
2506
|
+
await callback?.(event);
|
|
2359
2507
|
})
|
|
2360
2508
|
);
|
|
2361
2509
|
};
|
|
@@ -2364,13 +2512,56 @@ function mergeCallbacks(...callbacks) {
|
|
|
2364
2512
|
// src/telemetry/create-telemetry-dispatcher.ts
|
|
2365
2513
|
import { asArray as asArray3 } from "@ai-sdk/provider-utils";
|
|
2366
2514
|
|
|
2515
|
+
// src/telemetry/filter-included-context.ts
|
|
2516
|
+
function filterIncludedContext({
|
|
2517
|
+
context,
|
|
2518
|
+
includeContext
|
|
2519
|
+
}) {
|
|
2520
|
+
if (context == null) {
|
|
2521
|
+
return {};
|
|
2522
|
+
}
|
|
2523
|
+
return Object.fromEntries(
|
|
2524
|
+
Object.entries(context).filter(
|
|
2525
|
+
([key]) => includeContext?.[key] === true
|
|
2526
|
+
)
|
|
2527
|
+
);
|
|
2528
|
+
}
|
|
2529
|
+
function filterToolsContext({
|
|
2530
|
+
toolsContext,
|
|
2531
|
+
includeToolsContext
|
|
2532
|
+
}) {
|
|
2533
|
+
if (includeToolsContext == null) {
|
|
2534
|
+
return {};
|
|
2535
|
+
}
|
|
2536
|
+
return Object.fromEntries(
|
|
2537
|
+
Object.entries(toolsContext).map(([toolName, toolContext]) => [
|
|
2538
|
+
toolName,
|
|
2539
|
+
filterToolContext({
|
|
2540
|
+
toolName,
|
|
2541
|
+
toolContext,
|
|
2542
|
+
includeToolsContext
|
|
2543
|
+
})
|
|
2544
|
+
])
|
|
2545
|
+
);
|
|
2546
|
+
}
|
|
2547
|
+
function filterToolContext({
|
|
2548
|
+
toolName,
|
|
2549
|
+
toolContext,
|
|
2550
|
+
includeToolsContext
|
|
2551
|
+
}) {
|
|
2552
|
+
const includeToolContext = includeToolsContext?.[toolName];
|
|
2553
|
+
return filterIncludedContext({
|
|
2554
|
+
context: toolContext,
|
|
2555
|
+
includeContext: includeToolContext
|
|
2556
|
+
});
|
|
2557
|
+
}
|
|
2558
|
+
|
|
2367
2559
|
// src/telemetry/tracing-channel.ts
|
|
2368
2560
|
var AI_SDK_TELEMETRY_TRACING_CHANNEL = "ai:telemetry";
|
|
2369
2561
|
|
|
2370
2562
|
// src/util/is-node-runtime.ts
|
|
2371
2563
|
function isNodeRuntime() {
|
|
2372
|
-
|
|
2373
|
-
return typeof process !== "undefined" && ((_a12 = process.release) == null ? void 0 : _a12.name) === "node";
|
|
2564
|
+
return typeof process !== "undefined" && process.release?.name === "node";
|
|
2374
2565
|
}
|
|
2375
2566
|
|
|
2376
2567
|
// src/telemetry/tracing-channel-publisher.ts
|
|
@@ -2387,19 +2578,16 @@ async function loadDiagnosticsChannel() {
|
|
|
2387
2578
|
return diagnosticsChannelPromise;
|
|
2388
2579
|
}
|
|
2389
2580
|
function loadBuiltinModule(id) {
|
|
2390
|
-
var _a12;
|
|
2391
2581
|
const processWithBuiltins = globalThis.process;
|
|
2392
2582
|
try {
|
|
2393
|
-
return
|
|
2394
|
-
} catch
|
|
2583
|
+
return processWithBuiltins?.getBuiltinModule?.(id);
|
|
2584
|
+
} catch {
|
|
2395
2585
|
return void 0;
|
|
2396
2586
|
}
|
|
2397
2587
|
}
|
|
2398
2588
|
async function runWithTracingChannelSpan(message, execute) {
|
|
2399
|
-
var _a12;
|
|
2400
2589
|
const diagnosticsChannel = await loadDiagnosticsChannel();
|
|
2401
|
-
const tracingChannel =
|
|
2402
|
-
diagnosticsChannel,
|
|
2590
|
+
const tracingChannel = diagnosticsChannel?.tracingChannel?.(
|
|
2403
2591
|
AI_SDK_TELEMETRY_TRACING_CHANNEL
|
|
2404
2592
|
);
|
|
2405
2593
|
if (tracingChannel == null || tracingChannel.hasSubscribers === false) {
|
|
@@ -2432,7 +2620,7 @@ async function runWithTracingChannelSpan(message, execute) {
|
|
|
2432
2620
|
};
|
|
2433
2621
|
try {
|
|
2434
2622
|
return await tracingChannel.tracePromise(tracedExecute, message);
|
|
2435
|
-
} catch
|
|
2623
|
+
} catch {
|
|
2436
2624
|
if (hasExecutionError) {
|
|
2437
2625
|
throw executionError;
|
|
2438
2626
|
}
|
|
@@ -2449,16 +2637,16 @@ function openTelemetryChannelSpanContext({
|
|
|
2449
2637
|
message,
|
|
2450
2638
|
completion
|
|
2451
2639
|
}) {
|
|
2452
|
-
var _a12;
|
|
2453
2640
|
if (!isNodeRuntime()) {
|
|
2641
|
+
Promise.resolve(completion).catch(() => {
|
|
2642
|
+
});
|
|
2454
2643
|
return void 0;
|
|
2455
2644
|
}
|
|
2456
2645
|
const diagnosticsChannel = loadBuiltinModule(
|
|
2457
2646
|
"node:diagnostics_channel"
|
|
2458
2647
|
);
|
|
2459
2648
|
const asyncHooks = loadBuiltinModule("node:async_hooks");
|
|
2460
|
-
const tracingChannel =
|
|
2461
|
-
diagnosticsChannel,
|
|
2649
|
+
const tracingChannel = diagnosticsChannel?.tracingChannel?.(
|
|
2462
2650
|
AI_SDK_TELEMETRY_TRACING_CHANNEL
|
|
2463
2651
|
);
|
|
2464
2652
|
if (tracingChannel == null || tracingChannel.hasSubscribers === false || asyncHooks == null) {
|
|
@@ -2472,7 +2660,7 @@ function openTelemetryChannelSpanContext({
|
|
|
2472
2660
|
const safePublish = (publish) => {
|
|
2473
2661
|
try {
|
|
2474
2662
|
publish();
|
|
2475
|
-
} catch
|
|
2663
|
+
} catch {
|
|
2476
2664
|
}
|
|
2477
2665
|
};
|
|
2478
2666
|
const publishAsyncEnd = ({
|
|
@@ -2509,36 +2697,59 @@ function openTelemetryChannelSpanContext({
|
|
|
2509
2697
|
|
|
2510
2698
|
// src/telemetry/telemetry-registry.ts
|
|
2511
2699
|
function getGlobalTelemetryIntegrations() {
|
|
2512
|
-
|
|
2513
|
-
return (_a12 = globalThis.AI_SDK_TELEMETRY_INTEGRATIONS) != null ? _a12 : [];
|
|
2700
|
+
return globalThis.AI_SDK_TELEMETRY_INTEGRATIONS ?? [];
|
|
2514
2701
|
}
|
|
2515
2702
|
|
|
2516
2703
|
// src/telemetry/create-telemetry-dispatcher.ts
|
|
2517
|
-
function augmentEvent(event, telemetry) {
|
|
2518
|
-
|
|
2704
|
+
function augmentEvent(event, telemetry, filterContext = false) {
|
|
2705
|
+
const augmentedEvent = Object.assign(
|
|
2519
2706
|
Object.create(Object.getPrototypeOf(event)),
|
|
2520
2707
|
event,
|
|
2521
|
-
|
|
2708
|
+
{
|
|
2709
|
+
recordInputs: telemetry.recordInputs,
|
|
2710
|
+
recordOutputs: telemetry.recordOutputs,
|
|
2711
|
+
functionId: telemetry.functionId
|
|
2712
|
+
}
|
|
2522
2713
|
);
|
|
2714
|
+
if (filterContext && event != null && typeof event === "object" && "runtimeContext" in event) {
|
|
2715
|
+
augmentedEvent.runtimeContext = filterIncludedContext({
|
|
2716
|
+
context: event.runtimeContext,
|
|
2717
|
+
includeContext: telemetry.includeRuntimeContext
|
|
2718
|
+
});
|
|
2719
|
+
}
|
|
2720
|
+
if (filterContext && event != null && typeof event === "object") {
|
|
2721
|
+
if ("toolsContext" in event) {
|
|
2722
|
+
augmentedEvent.toolsContext = filterToolsContext({
|
|
2723
|
+
toolsContext: event.toolsContext,
|
|
2724
|
+
includeToolsContext: telemetry.includeToolsContext
|
|
2725
|
+
});
|
|
2726
|
+
} else if ("toolContext" in event && event.toolContext != null && "toolCall" in event && event.toolCall != null && typeof event.toolCall === "object" && "toolName" in event.toolCall) {
|
|
2727
|
+
augmentedEvent.toolContext = filterToolContext({
|
|
2728
|
+
toolName: event.toolCall.toolName,
|
|
2729
|
+
toolContext: event.toolContext,
|
|
2730
|
+
includeToolsContext: telemetry.includeToolsContext
|
|
2731
|
+
});
|
|
2732
|
+
}
|
|
2733
|
+
}
|
|
2734
|
+
return augmentedEvent;
|
|
2523
2735
|
}
|
|
2524
2736
|
function createTelemetryDispatcher({
|
|
2525
2737
|
telemetry
|
|
2526
2738
|
}) {
|
|
2527
|
-
if (
|
|
2739
|
+
if (telemetry?.isEnabled === false) {
|
|
2528
2740
|
return {};
|
|
2529
2741
|
}
|
|
2530
|
-
const localIntegrations = telemetry
|
|
2742
|
+
const localIntegrations = telemetry?.integrations;
|
|
2531
2743
|
const integrations = localIntegrations != null ? asArray3(localIntegrations) : getGlobalTelemetryIntegrations();
|
|
2532
2744
|
const telemetryMetadata = {
|
|
2533
|
-
recordInputs: telemetry
|
|
2534
|
-
recordOutputs: telemetry
|
|
2535
|
-
functionId: telemetry
|
|
2745
|
+
recordInputs: telemetry?.recordInputs,
|
|
2746
|
+
recordOutputs: telemetry?.recordOutputs,
|
|
2747
|
+
functionId: telemetry?.functionId,
|
|
2748
|
+
includeRuntimeContext: telemetry?.includeRuntimeContext,
|
|
2749
|
+
includeToolsContext: telemetry?.includeToolsContext
|
|
2536
2750
|
};
|
|
2537
2751
|
const mergeTelemetryCallback = (key) => {
|
|
2538
|
-
const integrationCallbacks = integrations.map((integration) =>
|
|
2539
|
-
var _a12;
|
|
2540
|
-
return (_a12 = integration[key]) == null ? void 0 : _a12.bind(integration);
|
|
2541
|
-
}).filter(Boolean).map(
|
|
2752
|
+
const integrationCallbacks = integrations.map((integration) => integration[key]?.bind(integration)).filter(Boolean).map(
|
|
2542
2753
|
(callback) => ((event) => callback(augmentEvent(event, telemetryMetadata)))
|
|
2543
2754
|
);
|
|
2544
2755
|
const mergedIntegrationCallback = mergeCallbacks(...integrationCallbacks);
|
|
@@ -2546,26 +2757,20 @@ function createTelemetryDispatcher({
|
|
|
2546
2757
|
await mergedIntegrationCallback(event);
|
|
2547
2758
|
};
|
|
2548
2759
|
};
|
|
2549
|
-
const executeLanguageModelCallWrappers = integrations.map((integration) =>
|
|
2550
|
-
|
|
2551
|
-
return (_a12 = integration.executeLanguageModelCall) == null ? void 0 : _a12.bind(integration);
|
|
2552
|
-
}).filter(Boolean);
|
|
2553
|
-
const executeToolWrappers = integrations.map((integration) => {
|
|
2554
|
-
var _a12;
|
|
2555
|
-
return (_a12 = integration.executeTool) == null ? void 0 : _a12.bind(integration);
|
|
2556
|
-
}).filter(Boolean);
|
|
2760
|
+
const executeLanguageModelCallWrappers = integrations.map((integration) => integration.executeLanguageModelCall?.bind(integration)).filter(Boolean);
|
|
2761
|
+
const executeToolWrappers = integrations.map((integration) => integration.executeTool?.bind(integration)).filter(Boolean);
|
|
2557
2762
|
return {
|
|
2558
2763
|
runInTracingChannelSpan: async ({ type, event, execute }) => await runWithTracingChannelSpan(
|
|
2559
2764
|
{
|
|
2560
2765
|
type,
|
|
2561
|
-
event: augmentEvent(event, telemetryMetadata)
|
|
2766
|
+
event: augmentEvent(event, telemetryMetadata, true)
|
|
2562
2767
|
},
|
|
2563
2768
|
execute
|
|
2564
2769
|
),
|
|
2565
2770
|
startTracingChannelContext: ({ type, event, completion }) => openTelemetryChannelSpanContext({
|
|
2566
2771
|
message: {
|
|
2567
2772
|
type,
|
|
2568
|
-
event: augmentEvent(event, telemetryMetadata)
|
|
2773
|
+
event: augmentEvent(event, telemetryMetadata, true)
|
|
2569
2774
|
},
|
|
2570
2775
|
completion
|
|
2571
2776
|
}),
|
|
@@ -2591,6 +2796,18 @@ function createTelemetryDispatcher({
|
|
|
2591
2796
|
onEmbedEnd: mergeTelemetryCallback("onEmbedEnd"),
|
|
2592
2797
|
onRerankStart: mergeTelemetryCallback("onRerankStart"),
|
|
2593
2798
|
onRerankEnd: mergeTelemetryCallback("onRerankEnd"),
|
|
2799
|
+
experimental_onEvaluateStart: mergeTelemetryCallback(
|
|
2800
|
+
"experimental_onEvaluateStart"
|
|
2801
|
+
),
|
|
2802
|
+
experimental_onEvaluationModelCallStart: mergeTelemetryCallback(
|
|
2803
|
+
"experimental_onEvaluationModelCallStart"
|
|
2804
|
+
),
|
|
2805
|
+
experimental_onEvaluationModelCallEnd: mergeTelemetryCallback(
|
|
2806
|
+
"experimental_onEvaluationModelCallEnd"
|
|
2807
|
+
),
|
|
2808
|
+
experimental_onEvaluateEnd: mergeTelemetryCallback(
|
|
2809
|
+
"experimental_onEvaluateEnd"
|
|
2810
|
+
),
|
|
2594
2811
|
onEnd: mergeTelemetryCallback("onEnd"),
|
|
2595
2812
|
onAbort: mergeTelemetryCallback("onAbort"),
|
|
2596
2813
|
onError: mergeTelemetryCallback("onError"),
|
|
@@ -2628,21 +2845,6 @@ function createTelemetryDispatcher({
|
|
|
2628
2845
|
};
|
|
2629
2846
|
}
|
|
2630
2847
|
|
|
2631
|
-
// src/telemetry/filter-included-context.ts
|
|
2632
|
-
function filterIncludedContext({
|
|
2633
|
-
context,
|
|
2634
|
-
includeContext
|
|
2635
|
-
}) {
|
|
2636
|
-
if (context == null) {
|
|
2637
|
-
return {};
|
|
2638
|
-
}
|
|
2639
|
-
return Object.fromEntries(
|
|
2640
|
-
Object.entries(context).filter(
|
|
2641
|
-
([key]) => (includeContext == null ? void 0 : includeContext[key]) === true
|
|
2642
|
-
)
|
|
2643
|
-
);
|
|
2644
|
-
}
|
|
2645
|
-
|
|
2646
2848
|
// src/generate-text/reasoning.ts
|
|
2647
2849
|
function asReasoningText(reasoningParts) {
|
|
2648
2850
|
const reasoningText = reasoningParts.map((part) => "text" in part ? part.text : "").join("");
|
|
@@ -2779,35 +2981,6 @@ function restrictStepResult({
|
|
|
2779
2981
|
providerMetadata: step.providerMetadata
|
|
2780
2982
|
});
|
|
2781
2983
|
}
|
|
2782
|
-
function filterToolsContext({
|
|
2783
|
-
toolsContext,
|
|
2784
|
-
includeToolsContext
|
|
2785
|
-
}) {
|
|
2786
|
-
if (includeToolsContext == null) {
|
|
2787
|
-
return {};
|
|
2788
|
-
}
|
|
2789
|
-
return Object.fromEntries(
|
|
2790
|
-
Object.entries(toolsContext).map(([toolName, toolContext]) => [
|
|
2791
|
-
toolName,
|
|
2792
|
-
filterToolContext({
|
|
2793
|
-
toolName,
|
|
2794
|
-
toolContext,
|
|
2795
|
-
includeToolsContext
|
|
2796
|
-
})
|
|
2797
|
-
])
|
|
2798
|
-
);
|
|
2799
|
-
}
|
|
2800
|
-
function filterToolContext({
|
|
2801
|
-
toolName,
|
|
2802
|
-
toolContext,
|
|
2803
|
-
includeToolsContext
|
|
2804
|
-
}) {
|
|
2805
|
-
const includeToolContext = includeToolsContext == null ? void 0 : includeToolsContext[toolName];
|
|
2806
|
-
return filterIncludedContext({
|
|
2807
|
-
context: toolContext,
|
|
2808
|
-
includeContext: includeToolContext
|
|
2809
|
-
});
|
|
2810
|
-
}
|
|
2811
2984
|
function createRestrictedTelemetryDispatcher({
|
|
2812
2985
|
telemetry,
|
|
2813
2986
|
includeRuntimeContext,
|
|
@@ -2816,127 +2989,100 @@ function createRestrictedTelemetryDispatcher({
|
|
|
2816
2989
|
const telemetryDispatcher = createTelemetryDispatcher({ telemetry });
|
|
2817
2990
|
return {
|
|
2818
2991
|
...telemetryDispatcher,
|
|
2819
|
-
onStart: (event) => {
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2992
|
+
onStart: (event) => telemetryDispatcher.onStart?.({
|
|
2993
|
+
...event,
|
|
2994
|
+
runtimeContext: filterIncludedContext({
|
|
2995
|
+
context: event.runtimeContext,
|
|
2996
|
+
includeContext: includeRuntimeContext
|
|
2997
|
+
}),
|
|
2998
|
+
toolsContext: filterToolsContext({
|
|
2999
|
+
toolsContext: event.toolsContext,
|
|
3000
|
+
includeToolsContext
|
|
3001
|
+
})
|
|
3002
|
+
}),
|
|
3003
|
+
onStepStart: (event) => telemetryDispatcher.onStepStart?.({
|
|
3004
|
+
...event,
|
|
3005
|
+
runtimeContext: filterIncludedContext({
|
|
3006
|
+
context: event.runtimeContext,
|
|
3007
|
+
includeContext: includeRuntimeContext
|
|
3008
|
+
}),
|
|
3009
|
+
steps: event.steps.map(
|
|
3010
|
+
(step) => restrictStepResult({
|
|
3011
|
+
step,
|
|
3012
|
+
includeRuntimeContext,
|
|
2829
3013
|
includeToolsContext
|
|
2830
3014
|
})
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
3015
|
+
),
|
|
3016
|
+
toolsContext: filterToolsContext({
|
|
3017
|
+
toolsContext: event.toolsContext,
|
|
3018
|
+
includeToolsContext
|
|
3019
|
+
})
|
|
3020
|
+
}),
|
|
3021
|
+
onStepEnd: (event) => telemetryDispatcher.onStepEnd?.(
|
|
3022
|
+
restrictStepResult({
|
|
3023
|
+
step: event,
|
|
3024
|
+
includeRuntimeContext,
|
|
3025
|
+
includeToolsContext
|
|
3026
|
+
})
|
|
3027
|
+
),
|
|
3028
|
+
onStepFinish: (event) => telemetryDispatcher.onStepEnd?.(
|
|
3029
|
+
restrictStepResult({
|
|
3030
|
+
step: event,
|
|
3031
|
+
includeRuntimeContext,
|
|
3032
|
+
includeToolsContext
|
|
3033
|
+
})
|
|
3034
|
+
),
|
|
3035
|
+
onEnd: (event) => telemetryDispatcher.onEnd?.(
|
|
3036
|
+
((restrictedSteps) => {
|
|
3037
|
+
return {
|
|
3038
|
+
...event,
|
|
3039
|
+
runtimeContext: filterIncludedContext({
|
|
3040
|
+
context: event.runtimeContext,
|
|
3041
|
+
includeContext: includeRuntimeContext
|
|
3042
|
+
}),
|
|
3043
|
+
steps: restrictedSteps,
|
|
3044
|
+
finalStep: restrictedSteps.at(-1),
|
|
3045
|
+
toolsContext: filterToolsContext({
|
|
3046
|
+
toolsContext: event.toolsContext,
|
|
2845
3047
|
includeToolsContext
|
|
2846
3048
|
})
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
includeToolsContext
|
|
2851
|
-
})
|
|
2852
|
-
});
|
|
2853
|
-
},
|
|
2854
|
-
onStepEnd: (event) => {
|
|
2855
|
-
var _a12;
|
|
2856
|
-
return (_a12 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a12.call(
|
|
2857
|
-
telemetryDispatcher,
|
|
2858
|
-
restrictStepResult({
|
|
2859
|
-
step: event,
|
|
2860
|
-
includeRuntimeContext,
|
|
2861
|
-
includeToolsContext
|
|
2862
|
-
})
|
|
2863
|
-
);
|
|
2864
|
-
},
|
|
2865
|
-
onStepFinish: (event) => {
|
|
2866
|
-
var _a12;
|
|
2867
|
-
return (_a12 = telemetryDispatcher.onStepEnd) == null ? void 0 : _a12.call(
|
|
2868
|
-
telemetryDispatcher,
|
|
2869
|
-
restrictStepResult({
|
|
2870
|
-
step: event,
|
|
2871
|
-
includeRuntimeContext,
|
|
2872
|
-
includeToolsContext
|
|
2873
|
-
})
|
|
2874
|
-
);
|
|
2875
|
-
},
|
|
2876
|
-
onEnd: (event) => {
|
|
2877
|
-
var _a12;
|
|
2878
|
-
return (_a12 = telemetryDispatcher.onEnd) == null ? void 0 : _a12.call(
|
|
2879
|
-
telemetryDispatcher,
|
|
2880
|
-
((restrictedSteps) => {
|
|
2881
|
-
return {
|
|
2882
|
-
...event,
|
|
2883
|
-
runtimeContext: filterIncludedContext({
|
|
2884
|
-
context: event.runtimeContext,
|
|
2885
|
-
includeContext: includeRuntimeContext
|
|
2886
|
-
}),
|
|
2887
|
-
steps: restrictedSteps,
|
|
2888
|
-
finalStep: restrictedSteps.at(-1),
|
|
2889
|
-
toolsContext: filterToolsContext({
|
|
2890
|
-
toolsContext: event.toolsContext,
|
|
2891
|
-
includeToolsContext
|
|
2892
|
-
})
|
|
2893
|
-
};
|
|
2894
|
-
})(
|
|
2895
|
-
event.steps.map(
|
|
2896
|
-
(step) => restrictStepResult({
|
|
2897
|
-
step,
|
|
2898
|
-
includeRuntimeContext,
|
|
2899
|
-
includeToolsContext
|
|
2900
|
-
})
|
|
2901
|
-
)
|
|
2902
|
-
)
|
|
2903
|
-
);
|
|
2904
|
-
},
|
|
2905
|
-
onAbort: (event) => {
|
|
2906
|
-
var _a12;
|
|
2907
|
-
return (_a12 = telemetryDispatcher.onAbort) == null ? void 0 : _a12.call(telemetryDispatcher, {
|
|
2908
|
-
...event,
|
|
2909
|
-
steps: event.steps.map(
|
|
3049
|
+
};
|
|
3050
|
+
})(
|
|
3051
|
+
event.steps.map(
|
|
2910
3052
|
(step) => restrictStepResult({
|
|
2911
3053
|
step,
|
|
2912
3054
|
includeRuntimeContext,
|
|
2913
3055
|
includeToolsContext
|
|
2914
3056
|
})
|
|
2915
3057
|
)
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
toolContext: event.toolContext,
|
|
2925
|
-
includeToolsContext
|
|
2926
|
-
})
|
|
2927
|
-
});
|
|
2928
|
-
},
|
|
2929
|
-
onToolExecutionEnd: (event) => {
|
|
2930
|
-
var _a12;
|
|
2931
|
-
return (_a12 = telemetryDispatcher.onToolExecutionEnd) == null ? void 0 : _a12.call(telemetryDispatcher, {
|
|
2932
|
-
...event,
|
|
2933
|
-
toolContext: filterToolContext({
|
|
2934
|
-
toolName: event.toolCall.toolName,
|
|
2935
|
-
toolContext: event.toolContext,
|
|
3058
|
+
)
|
|
3059
|
+
),
|
|
3060
|
+
onAbort: (event) => telemetryDispatcher.onAbort?.({
|
|
3061
|
+
...event,
|
|
3062
|
+
steps: event.steps.map(
|
|
3063
|
+
(step) => restrictStepResult({
|
|
3064
|
+
step,
|
|
3065
|
+
includeRuntimeContext,
|
|
2936
3066
|
includeToolsContext
|
|
2937
3067
|
})
|
|
2938
|
-
|
|
2939
|
-
}
|
|
3068
|
+
)
|
|
3069
|
+
}),
|
|
3070
|
+
onToolExecutionStart: (event) => telemetryDispatcher.onToolExecutionStart?.({
|
|
3071
|
+
...event,
|
|
3072
|
+
toolContext: filterToolContext({
|
|
3073
|
+
toolName: event.toolCall.toolName,
|
|
3074
|
+
toolContext: event.toolContext,
|
|
3075
|
+
includeToolsContext
|
|
3076
|
+
})
|
|
3077
|
+
}),
|
|
3078
|
+
onToolExecutionEnd: (event) => telemetryDispatcher.onToolExecutionEnd?.({
|
|
3079
|
+
...event,
|
|
3080
|
+
toolContext: filterToolContext({
|
|
3081
|
+
toolName: event.toolCall.toolName,
|
|
3082
|
+
toolContext: event.toolContext,
|
|
3083
|
+
includeToolsContext
|
|
3084
|
+
})
|
|
3085
|
+
})
|
|
2940
3086
|
};
|
|
2941
3087
|
}
|
|
2942
3088
|
|
|
@@ -2952,6 +3098,20 @@ function getOwn(obj, key) {
|
|
|
2952
3098
|
return obj != null && Object.hasOwn(obj, key) ? obj[key] : void 0;
|
|
2953
3099
|
}
|
|
2954
3100
|
|
|
3101
|
+
// src/generate-text/tool-call.ts
|
|
3102
|
+
var inputSchemaInputSymbol = /* @__PURE__ */ Symbol("ai-sdk-tool-call-input-schema-input");
|
|
3103
|
+
function setToolCallInputSchemaInput(toolCall, inputSchemaInput) {
|
|
3104
|
+
Object.defineProperty(toolCall, inputSchemaInputSymbol, {
|
|
3105
|
+
value: inputSchemaInput
|
|
3106
|
+
});
|
|
3107
|
+
return toolCall;
|
|
3108
|
+
}
|
|
3109
|
+
function getToolCallInputSchemaInput(toolCall) {
|
|
3110
|
+
return inputSchemaInputSymbol in toolCall ? {
|
|
3111
|
+
value: toolCall[inputSchemaInputSymbol]
|
|
3112
|
+
} : void 0;
|
|
3113
|
+
}
|
|
3114
|
+
|
|
2955
3115
|
// src/generate-text/parse-tool-call.ts
|
|
2956
3116
|
async function parseToolCall({
|
|
2957
3117
|
toolCall,
|
|
@@ -2959,7 +3119,8 @@ async function parseToolCall({
|
|
|
2959
3119
|
repairToolCall,
|
|
2960
3120
|
refineToolInput,
|
|
2961
3121
|
messages,
|
|
2962
|
-
instructions
|
|
3122
|
+
instructions,
|
|
3123
|
+
abortSignal
|
|
2963
3124
|
}) {
|
|
2964
3125
|
try {
|
|
2965
3126
|
if (tools == null) {
|
|
@@ -2982,20 +3143,25 @@ async function parseToolCall({
|
|
|
2982
3143
|
}
|
|
2983
3144
|
let repairedToolCall = null;
|
|
2984
3145
|
try {
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
3146
|
+
abortSignal?.throwIfAborted();
|
|
3147
|
+
repairedToolCall = await waitForPromiseWithAbortSignal({
|
|
3148
|
+
promise: repairToolCall({
|
|
3149
|
+
toolCall,
|
|
3150
|
+
tools,
|
|
3151
|
+
inputSchema: async ({ toolName }) => {
|
|
3152
|
+
const inputSchema = getOwn(tools, toolName)?.inputSchema;
|
|
3153
|
+
return await asSchema2(inputSchema).jsonSchema;
|
|
3154
|
+
},
|
|
3155
|
+
instructions,
|
|
3156
|
+
system: instructions,
|
|
3157
|
+
messages,
|
|
3158
|
+
error,
|
|
3159
|
+
abortSignal
|
|
3160
|
+
}),
|
|
3161
|
+
abortSignal
|
|
2997
3162
|
});
|
|
2998
3163
|
} catch (repairError) {
|
|
3164
|
+
abortSignal?.throwIfAborted();
|
|
2999
3165
|
throw new ToolCallRepairError({
|
|
3000
3166
|
cause: repairError,
|
|
3001
3167
|
originalError: error
|
|
@@ -3004,15 +3170,18 @@ async function parseToolCall({
|
|
|
3004
3170
|
if (repairedToolCall == null) {
|
|
3005
3171
|
throw error;
|
|
3006
3172
|
}
|
|
3007
|
-
|
|
3173
|
+
const parsedRepairedToolCall = await refineParsedToolCallInput({
|
|
3008
3174
|
toolCall: await doParseToolCall({ toolCall: repairedToolCall, tools }),
|
|
3009
3175
|
refineToolInput
|
|
3010
3176
|
});
|
|
3177
|
+
abortSignal?.throwIfAborted();
|
|
3178
|
+
return parsedRepairedToolCall;
|
|
3011
3179
|
}
|
|
3012
3180
|
} catch (error) {
|
|
3181
|
+
abortSignal?.throwIfAborted();
|
|
3013
3182
|
const parsedInput = await safeParseJSON({ text: toolCall.input });
|
|
3014
3183
|
const input = parsedInput.success ? parsedInput.value : toolCall.input;
|
|
3015
|
-
const
|
|
3184
|
+
const tool2 = getOwn(tools, toolCall.toolName);
|
|
3016
3185
|
return {
|
|
3017
3186
|
type: "tool-call",
|
|
3018
3187
|
toolCallId: toolCall.toolCallId,
|
|
@@ -3021,13 +3190,41 @@ async function parseToolCall({
|
|
|
3021
3190
|
dynamic: true,
|
|
3022
3191
|
invalid: true,
|
|
3023
3192
|
error,
|
|
3024
|
-
title:
|
|
3193
|
+
title: tool2?.title,
|
|
3025
3194
|
providerExecuted: toolCall.providerExecuted,
|
|
3026
3195
|
providerMetadata: toolCall.providerMetadata,
|
|
3027
|
-
...
|
|
3196
|
+
...tool2?.metadata != null ? { toolMetadata: tool2.metadata } : {}
|
|
3028
3197
|
};
|
|
3029
3198
|
}
|
|
3030
3199
|
}
|
|
3200
|
+
async function waitForPromiseWithAbortSignal({
|
|
3201
|
+
promise,
|
|
3202
|
+
abortSignal
|
|
3203
|
+
}) {
|
|
3204
|
+
if (abortSignal == null) {
|
|
3205
|
+
return await promise;
|
|
3206
|
+
}
|
|
3207
|
+
return await new Promise((resolve, reject) => {
|
|
3208
|
+
const cleanup = () => {
|
|
3209
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
3210
|
+
};
|
|
3211
|
+
const onAbort = () => {
|
|
3212
|
+
cleanup();
|
|
3213
|
+
reject(abortSignal.reason);
|
|
3214
|
+
};
|
|
3215
|
+
Promise.resolve(promise).then((value) => {
|
|
3216
|
+
cleanup();
|
|
3217
|
+
resolve(value);
|
|
3218
|
+
}).catch((error) => {
|
|
3219
|
+
cleanup();
|
|
3220
|
+
reject(error);
|
|
3221
|
+
});
|
|
3222
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
3223
|
+
if (abortSignal.aborted) {
|
|
3224
|
+
onAbort();
|
|
3225
|
+
}
|
|
3226
|
+
});
|
|
3227
|
+
}
|
|
3031
3228
|
async function refineParsedToolCallInput({
|
|
3032
3229
|
toolCall,
|
|
3033
3230
|
refineToolInput
|
|
@@ -3036,10 +3233,12 @@ async function refineParsedToolCallInput({
|
|
|
3036
3233
|
if (refine == null) {
|
|
3037
3234
|
return toolCall;
|
|
3038
3235
|
}
|
|
3039
|
-
|
|
3236
|
+
const refinedToolCall = {
|
|
3040
3237
|
...toolCall,
|
|
3041
3238
|
input: await refine(toolCall.input)
|
|
3042
3239
|
};
|
|
3240
|
+
const inputSchemaInput = getToolCallInputSchemaInput(toolCall);
|
|
3241
|
+
return inputSchemaInput == null ? refinedToolCall : setToolCallInputSchemaInput(refinedToolCall, inputSchemaInput.value);
|
|
3043
3242
|
}
|
|
3044
3243
|
async function parseProviderExecutedDynamicToolCall(toolCall) {
|
|
3045
3244
|
const parseResult = toolCall.input.trim() === "" ? { success: true, value: {} } : await safeParseJSON({ text: toolCall.input });
|
|
@@ -3065,8 +3264,8 @@ async function doParseToolCall({
|
|
|
3065
3264
|
tools
|
|
3066
3265
|
}) {
|
|
3067
3266
|
const toolName = toolCall.toolName;
|
|
3068
|
-
const
|
|
3069
|
-
if (
|
|
3267
|
+
const tool2 = getOwn(tools, toolName);
|
|
3268
|
+
if (tool2 == null) {
|
|
3070
3269
|
if (toolCall.providerExecuted && toolCall.dynamic) {
|
|
3071
3270
|
return await parseProviderExecutedDynamicToolCall(toolCall);
|
|
3072
3271
|
}
|
|
@@ -3075,7 +3274,7 @@ async function doParseToolCall({
|
|
|
3075
3274
|
availableTools: Object.keys(tools)
|
|
3076
3275
|
});
|
|
3077
3276
|
}
|
|
3078
|
-
const schema = asSchema2(
|
|
3277
|
+
const schema = asSchema2(tool2.inputSchema);
|
|
3079
3278
|
const parseResult = toolCall.input.trim() === "" ? await safeValidateTypes2({ value: {}, schema }) : await safeParseJSON({ text: toolCall.input, schema });
|
|
3080
3279
|
if (parseResult.success === false) {
|
|
3081
3280
|
throw new InvalidToolInputError({
|
|
@@ -3084,34 +3283,161 @@ async function doParseToolCall({
|
|
|
3084
3283
|
cause: parseResult.error
|
|
3085
3284
|
});
|
|
3086
3285
|
}
|
|
3087
|
-
return
|
|
3088
|
-
type
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3286
|
+
return setToolCallInputSchemaInput(
|
|
3287
|
+
tool2.type === "dynamic" ? {
|
|
3288
|
+
type: "tool-call",
|
|
3289
|
+
toolCallId: toolCall.toolCallId,
|
|
3290
|
+
toolName: toolCall.toolName,
|
|
3291
|
+
input: parseResult.value,
|
|
3292
|
+
providerExecuted: toolCall.providerExecuted,
|
|
3293
|
+
providerMetadata: toolCall.providerMetadata,
|
|
3294
|
+
...tool2.metadata != null ? { toolMetadata: tool2.metadata } : {},
|
|
3295
|
+
dynamic: true,
|
|
3296
|
+
title: tool2.title
|
|
3297
|
+
} : {
|
|
3298
|
+
type: "tool-call",
|
|
3299
|
+
toolCallId: toolCall.toolCallId,
|
|
3300
|
+
toolName,
|
|
3301
|
+
input: parseResult.value,
|
|
3302
|
+
providerExecuted: toolCall.providerExecuted,
|
|
3303
|
+
providerMetadata: toolCall.providerMetadata,
|
|
3304
|
+
...tool2.metadata != null ? { toolMetadata: tool2.metadata } : {},
|
|
3305
|
+
title: tool2.title
|
|
3306
|
+
},
|
|
3307
|
+
parseResult.rawValue
|
|
3308
|
+
);
|
|
3309
|
+
}
|
|
3310
|
+
|
|
3311
|
+
// src/generate-text/validate-tool-context.ts
|
|
3312
|
+
import { validateTypes } from "@ai-sdk/provider-utils";
|
|
3313
|
+
async function validateToolContext({
|
|
3314
|
+
toolName,
|
|
3315
|
+
context,
|
|
3316
|
+
contextSchema
|
|
3317
|
+
}) {
|
|
3318
|
+
if (contextSchema == null) {
|
|
3319
|
+
return context;
|
|
3320
|
+
}
|
|
3321
|
+
return await validateTypes({
|
|
3322
|
+
value: context,
|
|
3323
|
+
schema: contextSchema,
|
|
3324
|
+
context: {
|
|
3325
|
+
field: "tool context",
|
|
3326
|
+
entityName: toolName
|
|
3327
|
+
}
|
|
3328
|
+
});
|
|
3329
|
+
}
|
|
3330
|
+
|
|
3331
|
+
// src/tool-search/prepare-tool-search.ts
|
|
3332
|
+
import {
|
|
3333
|
+
experimental_getToolCaller as experimental_getToolCaller2
|
|
3334
|
+
} from "@ai-sdk/provider-utils";
|
|
3335
|
+
|
|
3336
|
+
// src/generate-text/tool-caller-configuration.ts
|
|
3337
|
+
import {
|
|
3338
|
+
experimental_getToolCaller
|
|
3339
|
+
} from "@ai-sdk/provider-utils";
|
|
3340
|
+
var DIRECT_TOOL_CALL = "AI_SDK_DIRECT_TOOL_CALL";
|
|
3341
|
+
|
|
3342
|
+
// src/tool-search/tool-search.ts
|
|
3343
|
+
import { jsonSchema, tool } from "@ai-sdk/provider-utils";
|
|
3344
|
+
var toolSearchSymbol = /* @__PURE__ */ Symbol.for("vercel.ai.toolSearch");
|
|
3345
|
+
function isToolSearch(tool2) {
|
|
3346
|
+
return tool2[toolSearchSymbol] === true;
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
// src/tool-search/prepare-tool-search.ts
|
|
3350
|
+
function createToolSearchState({
|
|
3351
|
+
tools,
|
|
3352
|
+
toolCallers
|
|
3353
|
+
}) {
|
|
3354
|
+
const searchTools = Object.entries(tools ?? {}).filter(
|
|
3355
|
+
([, tool2]) => tool2.deferLoading || isToolSearch(tool2)
|
|
3356
|
+
);
|
|
3357
|
+
if (searchTools.length === 0) {
|
|
3358
|
+
return (activeTools) => activeTools;
|
|
3359
|
+
}
|
|
3360
|
+
const discovered = /* @__PURE__ */ new Set();
|
|
3361
|
+
const getCallers = (name12) => getOwn(toolCallers, name12) ?? [DIRECT_TOOL_CALL];
|
|
3362
|
+
for (const [name12, tool2] of searchTools) {
|
|
3363
|
+
const callers = getCallers(name12);
|
|
3364
|
+
if (callers.some((name13) => {
|
|
3365
|
+
if (name13 === DIRECT_TOOL_CALL) {
|
|
3366
|
+
return false;
|
|
3367
|
+
}
|
|
3368
|
+
const caller = experimental_getToolCaller2(tools?.[name13]);
|
|
3369
|
+
return caller?.type !== "local" || caller.prepareModelMessage == null;
|
|
3370
|
+
}) || isToolSearch(tool2) && tool2.deferLoading) {
|
|
3371
|
+
throw new InvalidArgumentError({
|
|
3372
|
+
parameter: "tools",
|
|
3373
|
+
value: name12,
|
|
3374
|
+
message: `tool "${name12}" must be callable directly or through code mode with toolDiscovery: 'conversation'. The search tool itself must not defer loading.`
|
|
3375
|
+
});
|
|
3376
|
+
}
|
|
3377
|
+
}
|
|
3378
|
+
return (activeTools, { toolsContext = {}, experimental_sandbox } = {}) => {
|
|
3379
|
+
if (activeTools == null) {
|
|
3380
|
+
return void 0;
|
|
3381
|
+
}
|
|
3382
|
+
const entries = Object.entries(activeTools);
|
|
3383
|
+
return Object.fromEntries(
|
|
3384
|
+
entries.filter(([name12, tool2]) => !tool2.deferLoading || discovered.has(name12)).map(([searchName, tool2]) => {
|
|
3385
|
+
if (!isToolSearch(tool2)) {
|
|
3386
|
+
return [searchName, tool2];
|
|
3387
|
+
}
|
|
3388
|
+
const callers = getCallers(searchName).filter(
|
|
3389
|
+
(name12) => name12 === DIRECT_TOOL_CALL || Object.hasOwn(activeTools, name12)
|
|
3390
|
+
);
|
|
3391
|
+
const candidates = entries.filter(
|
|
3392
|
+
([name12, candidate]) => candidate.deferLoading && !isToolSearch(candidate) && callers.some((caller) => getCallers(name12).includes(caller))
|
|
3393
|
+
);
|
|
3394
|
+
return [
|
|
3395
|
+
searchName,
|
|
3396
|
+
{
|
|
3397
|
+
...tool2,
|
|
3398
|
+
execute: ({ query }) => {
|
|
3399
|
+
const terms = [...new Set(tokenize(query))];
|
|
3400
|
+
const matches = candidates.map(([name12, candidate]) => {
|
|
3401
|
+
const description = resolveToolDescription({
|
|
3402
|
+
tool: candidate,
|
|
3403
|
+
toolName: name12,
|
|
3404
|
+
toolsContext,
|
|
3405
|
+
experimental_sandbox
|
|
3406
|
+
});
|
|
3407
|
+
const nameTerms = tokenize(name12);
|
|
3408
|
+
const descriptionTerms = tokenize(description ?? "");
|
|
3409
|
+
const score = terms.reduce(
|
|
3410
|
+
(score2, term) => score2 + (nameTerms.includes(term) ? 2 : 0) + (descriptionTerms.includes(term) ? 1 : 0),
|
|
3411
|
+
0
|
|
3412
|
+
);
|
|
3413
|
+
return { name: name12, description, score };
|
|
3414
|
+
}).filter((match) => match.score > 0).sort((a, b) => b.score - a.score).slice(0, 5);
|
|
3415
|
+
for (const { name: name12 } of matches) {
|
|
3416
|
+
discovered.add(name12);
|
|
3417
|
+
}
|
|
3418
|
+
return {
|
|
3419
|
+
tools: matches.map(({ name: name12, description }) => ({
|
|
3420
|
+
name: name12,
|
|
3421
|
+
...description == null ? {} : { description }
|
|
3422
|
+
}))
|
|
3423
|
+
};
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
];
|
|
3427
|
+
})
|
|
3428
|
+
);
|
|
3106
3429
|
};
|
|
3107
3430
|
}
|
|
3431
|
+
function tokenize(text) {
|
|
3432
|
+
return text.replace(/([a-z\d])([A-Z])/g, "$1 $2").toLowerCase().match(/[\p{L}\p{N}]+/gu) ?? [];
|
|
3433
|
+
}
|
|
3108
3434
|
|
|
3109
3435
|
// src/generate-text/collect-tool-approvals.ts
|
|
3110
3436
|
function collectToolApprovals({
|
|
3111
3437
|
messages
|
|
3112
3438
|
}) {
|
|
3113
3439
|
const lastMessage = messages.at(-1);
|
|
3114
|
-
if (
|
|
3440
|
+
if (lastMessage?.role != "tool") {
|
|
3115
3441
|
return {
|
|
3116
3442
|
approvedToolApprovals: [],
|
|
3117
3443
|
deniedToolApprovals: []
|
|
@@ -3187,7 +3513,7 @@ function collectToolApprovals({
|
|
|
3187
3513
|
import { convertBase64ToUint8Array } from "@ai-sdk/provider-utils";
|
|
3188
3514
|
|
|
3189
3515
|
// src/util/canonical-hash.ts
|
|
3190
|
-
import { convertUint8ArrayToBase64 } from "@ai-sdk/provider-utils";
|
|
3516
|
+
import { convertUint8ArrayToBase64 as convertUint8ArrayToBase642 } from "@ai-sdk/provider-utils";
|
|
3191
3517
|
var encoder = new TextEncoder();
|
|
3192
3518
|
function canonicalJSON(value) {
|
|
3193
3519
|
if (value === null || value === void 0) {
|
|
@@ -3206,7 +3532,7 @@ function canonicalJSON(value) {
|
|
|
3206
3532
|
return `{${entries.join(",")}}`;
|
|
3207
3533
|
}
|
|
3208
3534
|
function toBase64url(bytes) {
|
|
3209
|
-
return
|
|
3535
|
+
return convertUint8ArrayToBase642(bytes).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
|
|
3210
3536
|
}
|
|
3211
3537
|
async function hashCanonical(value) {
|
|
3212
3538
|
const digest = await crypto.subtle.digest(
|
|
@@ -3297,24 +3623,31 @@ import {
|
|
|
3297
3623
|
safeValidateTypes as safeValidateTypes3
|
|
3298
3624
|
} from "@ai-sdk/provider-utils";
|
|
3299
3625
|
|
|
3300
|
-
// src/
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
if (
|
|
3308
|
-
return
|
|
3309
|
-
}
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
field: "tool context",
|
|
3315
|
-
entityName: toolName
|
|
3626
|
+
// src/util/is-deep-equal-data.ts
|
|
3627
|
+
function isDeepEqualData(obj1, obj2) {
|
|
3628
|
+
if (obj1 === obj2) return true;
|
|
3629
|
+
if (obj1 == null || obj2 == null) return false;
|
|
3630
|
+
if (typeof obj1 !== "object" && typeof obj2 !== "object")
|
|
3631
|
+
return obj1 === obj2;
|
|
3632
|
+
if (obj1.constructor !== obj2.constructor) return false;
|
|
3633
|
+
if (obj1 instanceof Date && obj2 instanceof Date) {
|
|
3634
|
+
return obj1.getTime() === obj2.getTime();
|
|
3635
|
+
}
|
|
3636
|
+
if (Array.isArray(obj1)) {
|
|
3637
|
+
if (obj1.length !== obj2.length) return false;
|
|
3638
|
+
for (let i = 0; i < obj1.length; i++) {
|
|
3639
|
+
if (!isDeepEqualData(obj1[i], obj2[i])) return false;
|
|
3316
3640
|
}
|
|
3317
|
-
|
|
3641
|
+
return true;
|
|
3642
|
+
}
|
|
3643
|
+
const keys1 = Object.keys(obj1);
|
|
3644
|
+
const keys2 = Object.keys(obj2);
|
|
3645
|
+
if (keys1.length !== keys2.length) return false;
|
|
3646
|
+
for (const key of keys1) {
|
|
3647
|
+
if (!keys2.includes(key)) return false;
|
|
3648
|
+
if (!isDeepEqualData(obj1[key], obj2[key])) return false;
|
|
3649
|
+
}
|
|
3650
|
+
return true;
|
|
3318
3651
|
}
|
|
3319
3652
|
|
|
3320
3653
|
// src/generate-text/resolve-tool-approval.ts
|
|
@@ -3338,7 +3671,7 @@ async function resolveToolApproval({
|
|
|
3338
3671
|
);
|
|
3339
3672
|
}
|
|
3340
3673
|
const toolName = toolCall.toolName;
|
|
3341
|
-
const
|
|
3674
|
+
const tool2 = getOwn(tools, toolName);
|
|
3342
3675
|
const input = toolCall.input;
|
|
3343
3676
|
const userDefinedToolApprovalStatus = getOwn(toolApproval, toolName);
|
|
3344
3677
|
if (userDefinedToolApprovalStatus != null) {
|
|
@@ -3348,24 +3681,24 @@ async function resolveToolApproval({
|
|
|
3348
3681
|
toolContext: await validateToolContext({
|
|
3349
3682
|
toolName,
|
|
3350
3683
|
context: getOwn(toolsContext, toolName),
|
|
3351
|
-
contextSchema:
|
|
3684
|
+
contextSchema: tool2?.contextSchema
|
|
3352
3685
|
}),
|
|
3353
3686
|
runtimeContext
|
|
3354
3687
|
}) : userDefinedToolApprovalStatus;
|
|
3355
3688
|
return normalizeToolApprovalStatus(approvalStatus);
|
|
3356
3689
|
}
|
|
3357
|
-
if (
|
|
3690
|
+
if (tool2?.needsApproval == null) {
|
|
3358
3691
|
return { type: "not-applicable" };
|
|
3359
3692
|
}
|
|
3360
|
-
const needsApproval = typeof
|
|
3693
|
+
const needsApproval = typeof tool2.needsApproval === "function" ? await tool2.needsApproval(input, {
|
|
3361
3694
|
toolCallId: toolCall.toolCallId,
|
|
3362
3695
|
messages,
|
|
3363
3696
|
context: await validateToolContext({
|
|
3364
3697
|
toolName,
|
|
3365
3698
|
context: getOwn(toolsContext, toolName),
|
|
3366
|
-
contextSchema:
|
|
3699
|
+
contextSchema: tool2?.contextSchema
|
|
3367
3700
|
})
|
|
3368
|
-
}) :
|
|
3701
|
+
}) : tool2.needsApproval;
|
|
3369
3702
|
return needsApproval ? { type: "user-approval" } : { type: "not-applicable" };
|
|
3370
3703
|
}
|
|
3371
3704
|
function normalizeToolApprovalStatus(status) {
|
|
@@ -3380,15 +3713,15 @@ async function validateApprovedToolApprovals({
|
|
|
3380
3713
|
messages,
|
|
3381
3714
|
toolsContext,
|
|
3382
3715
|
runtimeContext,
|
|
3383
|
-
toolApprovalSecret
|
|
3716
|
+
toolApprovalSecret,
|
|
3717
|
+
refineToolInput
|
|
3384
3718
|
}) {
|
|
3385
|
-
var _a12;
|
|
3386
3719
|
const approved = [];
|
|
3387
3720
|
const denied = [];
|
|
3388
3721
|
const invalid = [];
|
|
3389
3722
|
for (const approval of approvedToolApprovals) {
|
|
3390
|
-
const {
|
|
3391
|
-
const
|
|
3723
|
+
const { approvalRequest, toolCall } = approval;
|
|
3724
|
+
const tool2 = getOwn(tools, toolCall.toolName);
|
|
3392
3725
|
if (toolApprovalSecret != null) {
|
|
3393
3726
|
if (approvalRequest.signature == null) {
|
|
3394
3727
|
throw new InvalidToolApprovalSignatureError({
|
|
@@ -3413,18 +3746,43 @@ async function validateApprovedToolApprovals({
|
|
|
3413
3746
|
});
|
|
3414
3747
|
}
|
|
3415
3748
|
}
|
|
3416
|
-
if (isExecutableTool(
|
|
3749
|
+
if (isExecutableTool(tool2) && tool2.inputSchema != null) {
|
|
3750
|
+
const hasInputSchemaInput = Object.prototype.hasOwnProperty.call(
|
|
3751
|
+
approvalRequest,
|
|
3752
|
+
"inputSchemaInput"
|
|
3753
|
+
);
|
|
3417
3754
|
const validation = await safeValidateTypes3({
|
|
3418
|
-
value: toolCall.input,
|
|
3419
|
-
schema: asSchema3(
|
|
3755
|
+
value: hasInputSchemaInput ? approvalRequest.inputSchemaInput : toolCall.input,
|
|
3756
|
+
schema: asSchema3(tool2.inputSchema)
|
|
3420
3757
|
});
|
|
3758
|
+
let validationError;
|
|
3421
3759
|
if (!validation.success) {
|
|
3760
|
+
validationError = validation.error;
|
|
3761
|
+
} else {
|
|
3762
|
+
try {
|
|
3763
|
+
const revalidatedToolCall = await refineParsedToolCallInput({
|
|
3764
|
+
toolCall: {
|
|
3765
|
+
...toolCall,
|
|
3766
|
+
input: validation.value
|
|
3767
|
+
},
|
|
3768
|
+
refineToolInput
|
|
3769
|
+
});
|
|
3770
|
+
if (!isDeepEqualData(revalidatedToolCall.input, toolCall.input)) {
|
|
3771
|
+
validationError = new Error(
|
|
3772
|
+
"Approved tool input does not match the validated schema output."
|
|
3773
|
+
);
|
|
3774
|
+
}
|
|
3775
|
+
} catch (error) {
|
|
3776
|
+
validationError = error;
|
|
3777
|
+
}
|
|
3778
|
+
}
|
|
3779
|
+
if (validationError != null) {
|
|
3422
3780
|
invalid.push({
|
|
3423
3781
|
...approval,
|
|
3424
3782
|
error: new InvalidToolInputError({
|
|
3425
3783
|
toolName: toolCall.toolName,
|
|
3426
3784
|
toolInput: JSON.stringify(toolCall.input),
|
|
3427
|
-
cause:
|
|
3785
|
+
cause: validationError
|
|
3428
3786
|
})
|
|
3429
3787
|
});
|
|
3430
3788
|
continue;
|
|
@@ -3444,7 +3802,7 @@ async function validateApprovedToolApprovals({
|
|
|
3444
3802
|
approvalResponse: {
|
|
3445
3803
|
...approval.approvalResponse,
|
|
3446
3804
|
approved: false,
|
|
3447
|
-
reason:
|
|
3805
|
+
reason: approvalStatus.reason ?? approval.approvalResponse.reason
|
|
3448
3806
|
}
|
|
3449
3807
|
});
|
|
3450
3808
|
} else {
|
|
@@ -3562,13 +3920,15 @@ async function toResponseMessages({
|
|
|
3562
3920
|
break;
|
|
3563
3921
|
}
|
|
3564
3922
|
case "tool-approval-request":
|
|
3923
|
+
const inputSchemaInput = getToolCallInputSchemaInput(part.toolCall);
|
|
3565
3924
|
content.push({
|
|
3566
3925
|
type: "tool-approval-request",
|
|
3567
3926
|
approvalId: part.approvalId,
|
|
3568
3927
|
toolCallId: part.toolCall.toolCallId,
|
|
3569
3928
|
...part.reason != null ? { reason: part.reason } : {},
|
|
3570
3929
|
isAutomatic: part.isAutomatic,
|
|
3571
|
-
...part.signature != null ? { signature: part.signature } : {}
|
|
3930
|
+
...part.signature != null ? { signature: part.signature } : {},
|
|
3931
|
+
...inputSchemaInput != null && !isDeepEqualData(inputSchemaInput.value, part.toolCall.input) ? { inputSchemaInput: inputSchemaInput.value } : {}
|
|
3572
3932
|
});
|
|
3573
3933
|
break;
|
|
3574
3934
|
}
|
|
@@ -3670,6 +4030,7 @@ export {
|
|
|
3670
4030
|
createRestrictedTelemetryDispatcher,
|
|
3671
4031
|
createTelemetryDispatcher,
|
|
3672
4032
|
createToolModelOutput,
|
|
4033
|
+
createToolSearchState,
|
|
3673
4034
|
downloadAssets,
|
|
3674
4035
|
mapToolResultOutput,
|
|
3675
4036
|
mergeAbortSignals,
|
|
@@ -3685,6 +4046,7 @@ export {
|
|
|
3685
4046
|
standardizePrompt,
|
|
3686
4047
|
toResponseMessages,
|
|
3687
4048
|
validateApprovedToolApprovals,
|
|
4049
|
+
validateToolContext,
|
|
3688
4050
|
verifyToolApprovalSignature
|
|
3689
4051
|
};
|
|
3690
4052
|
//# sourceMappingURL=index.js.map
|