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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/anthropic-provider.ts
|
|
2
2
|
import {
|
|
3
|
-
InvalidArgumentError as
|
|
3
|
+
InvalidArgumentError as InvalidArgumentError3,
|
|
4
4
|
NoSuchModelError
|
|
5
5
|
} from "@ai-sdk/provider";
|
|
6
6
|
import {
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
withoutTrailingSlash,
|
|
12
12
|
withUserAgentSuffix
|
|
13
13
|
} from "@ai-sdk/provider-utils";
|
|
14
|
+
import { Experimental_EvaluationLanguageModel as EvaluationLanguageModel } from "@ai-sdk/provider-utils/experimental-evaluation";
|
|
14
15
|
|
|
15
16
|
// src/anthropic-files.ts
|
|
16
17
|
import {
|
|
@@ -75,7 +76,6 @@ var AnthropicFiles = class {
|
|
|
75
76
|
abortSignal,
|
|
76
77
|
headers
|
|
77
78
|
}) {
|
|
78
|
-
var _a, _b;
|
|
79
79
|
const fileBytes = convertInlineFileDataToUint8Array(data);
|
|
80
80
|
const blob = new Blob([fileBytes], { type: mediaType });
|
|
81
81
|
const formData = new FormData();
|
|
@@ -102,8 +102,8 @@ var AnthropicFiles = class {
|
|
|
102
102
|
return {
|
|
103
103
|
warnings: [],
|
|
104
104
|
providerReference: { anthropic: response.id },
|
|
105
|
-
mediaType:
|
|
106
|
-
filename:
|
|
105
|
+
mediaType: response.mime_type ?? mediaType,
|
|
106
|
+
filename: response.filename ?? filename,
|
|
107
107
|
providerMetadata: {
|
|
108
108
|
anthropic: {
|
|
109
109
|
filename: response.filename,
|
|
@@ -120,6 +120,7 @@ var AnthropicFiles = class {
|
|
|
120
120
|
// src/anthropic-language-model.ts
|
|
121
121
|
import {
|
|
122
122
|
APICallError,
|
|
123
|
+
InvalidArgumentError,
|
|
123
124
|
InvalidResponseDataError
|
|
124
125
|
} from "@ai-sdk/provider";
|
|
125
126
|
import {
|
|
@@ -155,6 +156,20 @@ var anthropicStopDetailsSchema = z3.object({
|
|
|
155
156
|
explanation: z3.string().nullish(),
|
|
156
157
|
recommended_model: z3.string().nullish()
|
|
157
158
|
});
|
|
159
|
+
var anthropicSafeguardResultSchema = z3.object({
|
|
160
|
+
type: z3.string(),
|
|
161
|
+
status: z3.object({
|
|
162
|
+
type: z3.string(),
|
|
163
|
+
tool_uses: z3.record(
|
|
164
|
+
z3.string(),
|
|
165
|
+
z3.object({
|
|
166
|
+
type: z3.string(),
|
|
167
|
+
outcome: z3.string().nullish(),
|
|
168
|
+
explanation: z3.string().nullish()
|
|
169
|
+
})
|
|
170
|
+
).nullish()
|
|
171
|
+
})
|
|
172
|
+
});
|
|
158
173
|
var anthropicToolCallCallerSchema = z3.union([
|
|
159
174
|
z3.object({
|
|
160
175
|
type: z3.literal("code_execution_20250825"),
|
|
@@ -257,7 +272,8 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
257
272
|
}),
|
|
258
273
|
z3.object({
|
|
259
274
|
type: z3.literal("compaction"),
|
|
260
|
-
content: z3.string()
|
|
275
|
+
content: z3.string().nullish(),
|
|
276
|
+
signature: z3.string().nullish()
|
|
261
277
|
}),
|
|
262
278
|
z3.object({
|
|
263
279
|
type: z3.literal("tool_use"),
|
|
@@ -265,7 +281,9 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
265
281
|
name: z3.string(),
|
|
266
282
|
input: z3.unknown(),
|
|
267
283
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
268
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
284
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
285
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
286
|
+
toolset_name: z3.string().nullish()
|
|
269
287
|
}),
|
|
270
288
|
z3.object({
|
|
271
289
|
type: z3.literal("server_tool_use"),
|
|
@@ -488,6 +506,7 @@ var anthropicResponseSchema = lazySchema3(
|
|
|
488
506
|
stop_sequence: z3.string().nullish(),
|
|
489
507
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
490
508
|
input_transformations: z3.array(anthropicInputTransformationSchema).nullish(),
|
|
509
|
+
safeguard_results: z3.array(anthropicSafeguardResultSchema).nullish(),
|
|
491
510
|
usage: z3.looseObject({
|
|
492
511
|
input_tokens: z3.number(),
|
|
493
512
|
output_tokens: z3.number(),
|
|
@@ -567,7 +586,8 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
567
586
|
id: z3.string(),
|
|
568
587
|
name: z3.string(),
|
|
569
588
|
input: z3.unknown(),
|
|
570
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
589
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
590
|
+
toolset_name: z3.string().nullish()
|
|
571
591
|
})
|
|
572
592
|
])
|
|
573
593
|
).nullish(),
|
|
@@ -598,7 +618,9 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
598
618
|
// Programmatic tool calling: input may be present directly for deferred tool calls
|
|
599
619
|
input: z3.record(z3.string(), z3.unknown()).optional(),
|
|
600
620
|
// Programmatic tool calling: caller info when triggered from code execution
|
|
601
|
-
caller: anthropicToolCallCallerSchema.optional()
|
|
621
|
+
caller: anthropicToolCallCallerSchema.optional(),
|
|
622
|
+
// Toolsets (e.g. computer toolset): name of the toolset this member call belongs to
|
|
623
|
+
toolset_name: z3.string().nullish()
|
|
602
624
|
}),
|
|
603
625
|
z3.object({
|
|
604
626
|
type: z3.literal("redacted_thinking"),
|
|
@@ -606,7 +628,8 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
606
628
|
}),
|
|
607
629
|
z3.object({
|
|
608
630
|
type: z3.literal("compaction"),
|
|
609
|
-
content: z3.string().nullish()
|
|
631
|
+
content: z3.string().nullish(),
|
|
632
|
+
signature: z3.string().nullish()
|
|
610
633
|
}),
|
|
611
634
|
z3.object({
|
|
612
635
|
type: z3.literal("server_tool_use"),
|
|
@@ -871,6 +894,7 @@ var anthropicChunkSchema = lazySchema3(
|
|
|
871
894
|
stop_reason: z3.string().nullish(),
|
|
872
895
|
stop_sequence: z3.string().nullish(),
|
|
873
896
|
stop_details: anthropicStopDetailsSchema.nullish(),
|
|
897
|
+
safeguard_results: z3.array(anthropicSafeguardResultSchema).nullish(),
|
|
874
898
|
container: z3.object({
|
|
875
899
|
expires_at: z3.string(),
|
|
876
900
|
id: z3.string(),
|
|
@@ -989,9 +1013,10 @@ var anthropicSystemMessageProviderOptions = z4.object({
|
|
|
989
1013
|
*/
|
|
990
1014
|
clearAt: z4.literal("next_user_message").optional(),
|
|
991
1015
|
/**
|
|
992
|
-
* Sets the model effort
|
|
993
|
-
*
|
|
994
|
-
*
|
|
1016
|
+
* Sets the model effort from the next user turn until a later message
|
|
1017
|
+
* changes it. An effort-only system message with empty content can appear
|
|
1018
|
+
* first. The required `mid-conversation-output-config-2026-07-01` beta is
|
|
1019
|
+
* added automatically.
|
|
995
1020
|
*/
|
|
996
1021
|
effort: z4.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
997
1022
|
/**
|
|
@@ -1041,6 +1066,14 @@ var anthropicLanguageModelOptions = z4.object({
|
|
|
1041
1066
|
*
|
|
1042
1067
|
* When enabled, responses include thinking content blocks showing Claude's thinking process before the final answer.
|
|
1043
1068
|
* Requires a minimum budget of 1,024 tokens and counts towards the `max_tokens` limit.
|
|
1069
|
+
*
|
|
1070
|
+
* Models that always use adaptive thinking (e.g. `claude-opus-5-5`,
|
|
1071
|
+
* `claude-fable-5-1`) reject `enabled` and `disabled`. For those models the
|
|
1072
|
+
* provider drops the unsupported setting, emits a warning, and sends an
|
|
1073
|
+
* adaptive thinking request. Use `effort` to control how much they think.
|
|
1074
|
+
*
|
|
1075
|
+
* `claude-sonnet-5-5` supports `between_tools`, its lowest thinking setting,
|
|
1076
|
+
* and the provider uses it in place of `disabled` for that model.
|
|
1044
1077
|
*/
|
|
1045
1078
|
thinking: z4.union([
|
|
1046
1079
|
z4.discriminatedUnion("type", [
|
|
@@ -1069,6 +1102,14 @@ var anthropicLanguageModelOptions = z4.object({
|
|
|
1069
1102
|
}),
|
|
1070
1103
|
z4.object({
|
|
1071
1104
|
type: z4.literal("disabled")
|
|
1105
|
+
}),
|
|
1106
|
+
z4.object({
|
|
1107
|
+
/**
|
|
1108
|
+
* for `claude-sonnet-5-5`: no upfront thinking, but progress notes
|
|
1109
|
+
* between tool calls are returned as summarized thinking blocks.
|
|
1110
|
+
* Only supported at `low`, `medium`, and `high` effort.
|
|
1111
|
+
*/
|
|
1112
|
+
type: z4.literal("between_tools")
|
|
1072
1113
|
})
|
|
1073
1114
|
]),
|
|
1074
1115
|
z4.object({
|
|
@@ -1153,7 +1194,11 @@ var anthropicLanguageModelOptions = z4.object({
|
|
|
1153
1194
|
*/
|
|
1154
1195
|
toolStreaming: z4.boolean().optional(),
|
|
1155
1196
|
/**
|
|
1156
|
-
*
|
|
1197
|
+
* Controls how much effort the model spends on thinking, text responses,
|
|
1198
|
+
* and tool calls. On models that always use adaptive thinking
|
|
1199
|
+
* (e.g. `claude-opus-5-5`), effort is the main lever for latency and cost.
|
|
1200
|
+
*
|
|
1201
|
+
* The API default is `high` for most models and `medium` for `claude-opus-5-5`.
|
|
1157
1202
|
*/
|
|
1158
1203
|
effort: z4.enum(["low", "medium", "high", "xhigh", "max"]).optional(),
|
|
1159
1204
|
/**
|
|
@@ -1219,6 +1264,32 @@ var anthropicLanguageModelOptions = z4.object({
|
|
|
1219
1264
|
* Allow a provider to receive the full `betas` set if it needs it.
|
|
1220
1265
|
*/
|
|
1221
1266
|
anthropicBeta: z4.array(z4.string()).optional(),
|
|
1267
|
+
/**
|
|
1268
|
+
* Server-side safeguards to run as part of the request.
|
|
1269
|
+
*
|
|
1270
|
+
* `dangerous_tool_use` asks the API to classify every `tool_use` block in
|
|
1271
|
+
* the response for dangerous actions (the check Claude Code's auto mode
|
|
1272
|
+
* relies on). The per-call verdicts are returned in
|
|
1273
|
+
* `providerMetadata.anthropic.safeguardResults`, keyed by tool call id.
|
|
1274
|
+
* `classifierContext` is passed through to the API as `classifier_context`.
|
|
1275
|
+
* The `dangerous-tool-use-2026-09-03` beta is added automatically.
|
|
1276
|
+
*/
|
|
1277
|
+
safeguards: z4.array(
|
|
1278
|
+
z4.object({
|
|
1279
|
+
type: z4.literal("dangerous_tool_use"),
|
|
1280
|
+
classifierContext: z4.record(z4.string(), z4.unknown()).optional()
|
|
1281
|
+
})
|
|
1282
|
+
).optional(),
|
|
1283
|
+
/**
|
|
1284
|
+
* Requests an on-demand summary of the supplied conversation.
|
|
1285
|
+
*
|
|
1286
|
+
* The required `compact-2026-09-04` beta is added automatically.
|
|
1287
|
+
* Cannot be combined with `contextManagement`.
|
|
1288
|
+
*/
|
|
1289
|
+
compaction: z4.object({
|
|
1290
|
+
type: z4.literal("summarize"),
|
|
1291
|
+
instructions: z4.string().optional()
|
|
1292
|
+
}).optional(),
|
|
1222
1293
|
contextManagement: z4.object({
|
|
1223
1294
|
edits: z4.array(
|
|
1224
1295
|
z4.discriminatedUnion("type", [
|
|
@@ -1277,9 +1348,8 @@ import {
|
|
|
1277
1348
|
// src/get-cache-control.ts
|
|
1278
1349
|
var MAX_CACHE_BREAKPOINTS = 4;
|
|
1279
1350
|
function getCacheControl(providerMetadata) {
|
|
1280
|
-
|
|
1281
|
-
const
|
|
1282
|
-
const cacheControlValue = (_a = anthropic2 == null ? void 0 : anthropic2.cacheControl) != null ? _a : anthropic2 == null ? void 0 : anthropic2.cache_control;
|
|
1351
|
+
const anthropic2 = providerMetadata?.anthropic;
|
|
1352
|
+
const cacheControlValue = anthropic2?.cacheControl ?? anthropic2?.cache_control;
|
|
1283
1353
|
return cacheControlValue;
|
|
1284
1354
|
}
|
|
1285
1355
|
var CacheControlValidator = class {
|
|
@@ -1369,103 +1439,114 @@ var advisor_20260301 = (args) => {
|
|
|
1369
1439
|
return factory(args);
|
|
1370
1440
|
};
|
|
1371
1441
|
|
|
1372
|
-
// src/tool/
|
|
1442
|
+
// src/tool/computer-toolset_20260801.ts
|
|
1373
1443
|
import {
|
|
1374
1444
|
createProviderDefinedToolFactory,
|
|
1375
1445
|
lazySchema as lazySchema5,
|
|
1376
1446
|
zodSchema as zodSchema5
|
|
1377
1447
|
} from "@ai-sdk/provider-utils";
|
|
1378
1448
|
import { z as z6 } from "zod/v4";
|
|
1379
|
-
var
|
|
1449
|
+
var computerToolset_20260801Members = [
|
|
1450
|
+
"screenshot",
|
|
1451
|
+
"zoom",
|
|
1452
|
+
"left_click",
|
|
1453
|
+
"right_click",
|
|
1454
|
+
"middle_click",
|
|
1455
|
+
"double_click",
|
|
1456
|
+
"triple_click",
|
|
1457
|
+
"left_click_drag",
|
|
1458
|
+
"mouse_move",
|
|
1459
|
+
"left_mouse_down",
|
|
1460
|
+
"left_mouse_up",
|
|
1461
|
+
"cursor_position",
|
|
1462
|
+
"scroll",
|
|
1463
|
+
"type",
|
|
1464
|
+
"key",
|
|
1465
|
+
"hold_key",
|
|
1466
|
+
"wait"
|
|
1467
|
+
];
|
|
1468
|
+
var computerToolset_20260801InputSchema = lazySchema5(
|
|
1380
1469
|
() => zodSchema5(
|
|
1381
1470
|
z6.object({
|
|
1382
|
-
|
|
1471
|
+
action: z6.enum(computerToolset_20260801Members),
|
|
1472
|
+
coordinate: z6.tuple([z6.number().int(), z6.number().int()]).optional(),
|
|
1473
|
+
duration: z6.number().optional(),
|
|
1474
|
+
region: z6.tuple([
|
|
1475
|
+
z6.number().int(),
|
|
1476
|
+
z6.number().int(),
|
|
1477
|
+
z6.number().int(),
|
|
1478
|
+
z6.number().int()
|
|
1479
|
+
]).optional(),
|
|
1480
|
+
repeat: z6.number().int().optional(),
|
|
1481
|
+
scroll_amount: z6.number().optional(),
|
|
1482
|
+
scroll_direction: z6.enum(["up", "down", "left", "right"]).optional(),
|
|
1483
|
+
start_coordinate: z6.tuple([z6.number().int(), z6.number().int()]).optional(),
|
|
1484
|
+
text: z6.string().optional()
|
|
1383
1485
|
})
|
|
1384
1486
|
)
|
|
1385
1487
|
);
|
|
1386
|
-
var
|
|
1488
|
+
var computerToolset_20260801ArgsSchema = lazySchema5(
|
|
1387
1489
|
() => zodSchema5(
|
|
1388
1490
|
z6.object({
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
view_range: z6.array(z6.number().int()).optional()
|
|
1491
|
+
configs: z6.partialRecord(
|
|
1492
|
+
z6.enum(computerToolset_20260801Members),
|
|
1493
|
+
z6.object({
|
|
1494
|
+
enabled: z6.boolean().optional(),
|
|
1495
|
+
deferLoading: z6.boolean().optional()
|
|
1496
|
+
})
|
|
1497
|
+
).optional()
|
|
1397
1498
|
})
|
|
1398
1499
|
)
|
|
1399
1500
|
);
|
|
1400
|
-
var
|
|
1401
|
-
id: "anthropic.
|
|
1402
|
-
inputSchema:
|
|
1501
|
+
var computerToolset_20260801 = createProviderDefinedToolFactory({
|
|
1502
|
+
id: "anthropic.computer_toolset_20260801",
|
|
1503
|
+
inputSchema: computerToolset_20260801InputSchema
|
|
1403
1504
|
});
|
|
1404
|
-
var textEditor_20250728 = (args = {}) => {
|
|
1405
|
-
return factory2(args);
|
|
1406
|
-
};
|
|
1407
1505
|
|
|
1408
|
-
// src/tool/
|
|
1506
|
+
// src/tool/text-editor_20250728.ts
|
|
1409
1507
|
import {
|
|
1410
|
-
|
|
1508
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory2,
|
|
1411
1509
|
lazySchema as lazySchema6,
|
|
1412
1510
|
zodSchema as zodSchema6
|
|
1413
1511
|
} from "@ai-sdk/provider-utils";
|
|
1414
1512
|
import { z as z7 } from "zod/v4";
|
|
1415
|
-
var
|
|
1513
|
+
var textEditor_20250728ArgsSchema = lazySchema6(
|
|
1416
1514
|
() => zodSchema6(
|
|
1417
1515
|
z7.object({
|
|
1418
|
-
|
|
1419
|
-
allowedDomains: z7.array(z7.string()).optional(),
|
|
1420
|
-
blockedDomains: z7.array(z7.string()).optional(),
|
|
1421
|
-
userLocation: z7.object({
|
|
1422
|
-
type: z7.literal("approximate"),
|
|
1423
|
-
city: z7.string().optional(),
|
|
1424
|
-
region: z7.string().optional(),
|
|
1425
|
-
country: z7.string().optional(),
|
|
1426
|
-
timezone: z7.string().optional()
|
|
1427
|
-
}).optional()
|
|
1516
|
+
maxCharacters: z7.number().optional()
|
|
1428
1517
|
})
|
|
1429
1518
|
)
|
|
1430
1519
|
);
|
|
1431
|
-
var
|
|
1432
|
-
() => zodSchema6(
|
|
1433
|
-
z7.array(
|
|
1434
|
-
z7.object({
|
|
1435
|
-
url: z7.string(),
|
|
1436
|
-
title: z7.string().nullable(),
|
|
1437
|
-
pageAge: z7.string().nullable(),
|
|
1438
|
-
encryptedContent: z7.string(),
|
|
1439
|
-
type: z7.literal("web_search_result")
|
|
1440
|
-
})
|
|
1441
|
-
)
|
|
1442
|
-
)
|
|
1443
|
-
);
|
|
1444
|
-
var webSearch_20260209InputSchema = lazySchema6(
|
|
1520
|
+
var textEditor_20250728InputSchema = lazySchema6(
|
|
1445
1521
|
() => zodSchema6(
|
|
1446
1522
|
z7.object({
|
|
1447
|
-
|
|
1523
|
+
command: z7.enum(["view", "create", "str_replace", "insert"]),
|
|
1524
|
+
path: z7.string(),
|
|
1525
|
+
file_text: z7.string().optional(),
|
|
1526
|
+
insert_line: z7.number().int().optional(),
|
|
1527
|
+
new_str: z7.string().optional(),
|
|
1528
|
+
insert_text: z7.string().optional(),
|
|
1529
|
+
old_str: z7.string().optional(),
|
|
1530
|
+
view_range: z7.array(z7.number().int()).optional()
|
|
1448
1531
|
})
|
|
1449
1532
|
)
|
|
1450
1533
|
);
|
|
1451
|
-
var
|
|
1452
|
-
id: "anthropic.
|
|
1453
|
-
inputSchema:
|
|
1454
|
-
outputSchema: webSearch_20260209OutputSchema,
|
|
1455
|
-
supportsDeferredResults: true
|
|
1534
|
+
var factory2 = createProviderDefinedToolFactory2({
|
|
1535
|
+
id: "anthropic.text_editor_20250728",
|
|
1536
|
+
inputSchema: textEditor_20250728InputSchema
|
|
1456
1537
|
});
|
|
1457
|
-
var
|
|
1458
|
-
return
|
|
1538
|
+
var textEditor_20250728 = (args = {}) => {
|
|
1539
|
+
return factory2(args);
|
|
1459
1540
|
};
|
|
1460
1541
|
|
|
1461
|
-
// src/tool/web-
|
|
1542
|
+
// src/tool/web-search_20260318.ts
|
|
1462
1543
|
import {
|
|
1463
|
-
createProviderExecutedToolFactory as
|
|
1544
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
1464
1545
|
lazySchema as lazySchema7,
|
|
1465
1546
|
zodSchema as zodSchema7
|
|
1466
1547
|
} from "@ai-sdk/provider-utils";
|
|
1467
1548
|
import { z as z8 } from "zod/v4";
|
|
1468
|
-
var
|
|
1549
|
+
var webSearch_20260318ArgsSchema = lazySchema7(
|
|
1469
1550
|
() => zodSchema7(
|
|
1470
1551
|
z8.object({
|
|
1471
1552
|
maxUses: z8.number().optional(),
|
|
@@ -1477,11 +1558,12 @@ var webSearch_20250305ArgsSchema = lazySchema7(
|
|
|
1477
1558
|
region: z8.string().optional(),
|
|
1478
1559
|
country: z8.string().optional(),
|
|
1479
1560
|
timezone: z8.string().optional()
|
|
1480
|
-
}).optional()
|
|
1561
|
+
}).optional(),
|
|
1562
|
+
responseInclusion: z8.enum(["full", "excluded"]).optional()
|
|
1481
1563
|
})
|
|
1482
1564
|
)
|
|
1483
1565
|
);
|
|
1484
|
-
var
|
|
1566
|
+
var webSearch_20260318OutputSchema = lazySchema7(
|
|
1485
1567
|
() => zodSchema7(
|
|
1486
1568
|
z8.array(
|
|
1487
1569
|
z8.object({
|
|
@@ -1494,143 +1576,312 @@ var webSearch_20250305OutputSchema = lazySchema7(
|
|
|
1494
1576
|
)
|
|
1495
1577
|
)
|
|
1496
1578
|
);
|
|
1497
|
-
var
|
|
1579
|
+
var webSearch_20260318InputSchema = lazySchema7(
|
|
1498
1580
|
() => zodSchema7(
|
|
1499
1581
|
z8.object({
|
|
1500
1582
|
query: z8.string()
|
|
1501
1583
|
})
|
|
1502
1584
|
)
|
|
1503
1585
|
);
|
|
1504
|
-
var
|
|
1505
|
-
id: "anthropic.
|
|
1506
|
-
inputSchema:
|
|
1507
|
-
outputSchema:
|
|
1586
|
+
var factory3 = createProviderExecutedToolFactory2({
|
|
1587
|
+
id: "anthropic.web_search_20260318",
|
|
1588
|
+
inputSchema: webSearch_20260318InputSchema,
|
|
1589
|
+
outputSchema: webSearch_20260318OutputSchema,
|
|
1508
1590
|
supportsDeferredResults: true
|
|
1509
1591
|
});
|
|
1510
|
-
var
|
|
1511
|
-
return
|
|
1592
|
+
var webSearch_20260318 = (args = {}) => {
|
|
1593
|
+
return factory3(args);
|
|
1512
1594
|
};
|
|
1513
1595
|
|
|
1514
|
-
// src/tool/web-
|
|
1596
|
+
// src/tool/web-search_20260209.ts
|
|
1515
1597
|
import {
|
|
1516
|
-
createProviderExecutedToolFactory as
|
|
1598
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
1517
1599
|
lazySchema as lazySchema8,
|
|
1518
1600
|
zodSchema as zodSchema8
|
|
1519
1601
|
} from "@ai-sdk/provider-utils";
|
|
1520
1602
|
import { z as z9 } from "zod/v4";
|
|
1521
|
-
var
|
|
1603
|
+
var webSearch_20260209ArgsSchema = lazySchema8(
|
|
1522
1604
|
() => zodSchema8(
|
|
1523
1605
|
z9.object({
|
|
1524
1606
|
maxUses: z9.number().optional(),
|
|
1525
1607
|
allowedDomains: z9.array(z9.string()).optional(),
|
|
1526
1608
|
blockedDomains: z9.array(z9.string()).optional(),
|
|
1527
|
-
|
|
1528
|
-
|
|
1609
|
+
userLocation: z9.object({
|
|
1610
|
+
type: z9.literal("approximate"),
|
|
1611
|
+
city: z9.string().optional(),
|
|
1612
|
+
region: z9.string().optional(),
|
|
1613
|
+
country: z9.string().optional(),
|
|
1614
|
+
timezone: z9.string().optional()
|
|
1615
|
+
}).optional()
|
|
1529
1616
|
})
|
|
1530
1617
|
)
|
|
1531
1618
|
);
|
|
1532
|
-
var
|
|
1619
|
+
var webSearch_20260209OutputSchema = lazySchema8(
|
|
1533
1620
|
() => zodSchema8(
|
|
1534
|
-
z9.
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
content: z9.object({
|
|
1538
|
-
type: z9.literal("document"),
|
|
1621
|
+
z9.array(
|
|
1622
|
+
z9.object({
|
|
1623
|
+
url: z9.string(),
|
|
1539
1624
|
title: z9.string().nullable(),
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
data: z9.string()
|
|
1546
|
-
}),
|
|
1547
|
-
z9.object({
|
|
1548
|
-
type: z9.literal("text"),
|
|
1549
|
-
mediaType: z9.literal("text/plain"),
|
|
1550
|
-
data: z9.string()
|
|
1551
|
-
})
|
|
1552
|
-
])
|
|
1553
|
-
}),
|
|
1554
|
-
retrievedAt: z9.string().nullable()
|
|
1555
|
-
})
|
|
1625
|
+
pageAge: z9.string().nullable(),
|
|
1626
|
+
encryptedContent: z9.string(),
|
|
1627
|
+
type: z9.literal("web_search_result")
|
|
1628
|
+
})
|
|
1629
|
+
)
|
|
1556
1630
|
)
|
|
1557
1631
|
);
|
|
1558
|
-
var
|
|
1632
|
+
var webSearch_20260209InputSchema = lazySchema8(
|
|
1559
1633
|
() => zodSchema8(
|
|
1560
1634
|
z9.object({
|
|
1561
|
-
|
|
1635
|
+
query: z9.string()
|
|
1562
1636
|
})
|
|
1563
1637
|
)
|
|
1564
1638
|
);
|
|
1565
|
-
var
|
|
1566
|
-
id: "anthropic.
|
|
1567
|
-
inputSchema:
|
|
1568
|
-
outputSchema:
|
|
1639
|
+
var factory4 = createProviderExecutedToolFactory3({
|
|
1640
|
+
id: "anthropic.web_search_20260209",
|
|
1641
|
+
inputSchema: webSearch_20260209InputSchema,
|
|
1642
|
+
outputSchema: webSearch_20260209OutputSchema,
|
|
1569
1643
|
supportsDeferredResults: true
|
|
1570
1644
|
});
|
|
1571
|
-
var
|
|
1572
|
-
return
|
|
1645
|
+
var webSearch_20260209 = (args = {}) => {
|
|
1646
|
+
return factory4(args);
|
|
1573
1647
|
};
|
|
1574
1648
|
|
|
1575
|
-
// src/tool/web-
|
|
1649
|
+
// src/tool/web-search_20250305.ts
|
|
1576
1650
|
import {
|
|
1577
|
-
createProviderExecutedToolFactory as
|
|
1651
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
1578
1652
|
lazySchema as lazySchema9,
|
|
1579
1653
|
zodSchema as zodSchema9
|
|
1580
1654
|
} from "@ai-sdk/provider-utils";
|
|
1581
1655
|
import { z as z10 } from "zod/v4";
|
|
1582
|
-
var
|
|
1656
|
+
var webSearch_20250305ArgsSchema = lazySchema9(
|
|
1583
1657
|
() => zodSchema9(
|
|
1584
1658
|
z10.object({
|
|
1585
1659
|
maxUses: z10.number().optional(),
|
|
1586
1660
|
allowedDomains: z10.array(z10.string()).optional(),
|
|
1587
1661
|
blockedDomains: z10.array(z10.string()).optional(),
|
|
1588
|
-
|
|
1589
|
-
|
|
1662
|
+
userLocation: z10.object({
|
|
1663
|
+
type: z10.literal("approximate"),
|
|
1664
|
+
city: z10.string().optional(),
|
|
1665
|
+
region: z10.string().optional(),
|
|
1666
|
+
country: z10.string().optional(),
|
|
1667
|
+
timezone: z10.string().optional()
|
|
1668
|
+
}).optional()
|
|
1590
1669
|
})
|
|
1591
1670
|
)
|
|
1592
1671
|
);
|
|
1593
|
-
var
|
|
1672
|
+
var webSearch_20250305OutputSchema = lazySchema9(
|
|
1594
1673
|
() => zodSchema9(
|
|
1595
|
-
z10.
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
content: z10.object({
|
|
1599
|
-
type: z10.literal("document"),
|
|
1674
|
+
z10.array(
|
|
1675
|
+
z10.object({
|
|
1676
|
+
url: z10.string(),
|
|
1600
1677
|
title: z10.string().nullable(),
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1678
|
+
pageAge: z10.string().nullable(),
|
|
1679
|
+
encryptedContent: z10.string(),
|
|
1680
|
+
type: z10.literal("web_search_result")
|
|
1681
|
+
})
|
|
1682
|
+
)
|
|
1683
|
+
)
|
|
1684
|
+
);
|
|
1685
|
+
var webSearch_20250305InputSchema = lazySchema9(
|
|
1686
|
+
() => zodSchema9(
|
|
1687
|
+
z10.object({
|
|
1688
|
+
query: z10.string()
|
|
1689
|
+
})
|
|
1690
|
+
)
|
|
1691
|
+
);
|
|
1692
|
+
var factory5 = createProviderExecutedToolFactory4({
|
|
1693
|
+
id: "anthropic.web_search_20250305",
|
|
1694
|
+
inputSchema: webSearch_20250305InputSchema,
|
|
1695
|
+
outputSchema: webSearch_20250305OutputSchema,
|
|
1696
|
+
supportsDeferredResults: true
|
|
1697
|
+
});
|
|
1698
|
+
var webSearch_20250305 = (args = {}) => {
|
|
1699
|
+
return factory5(args);
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
// src/tool/web-fetch-20260318.ts
|
|
1703
|
+
import {
|
|
1704
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
|
|
1705
|
+
lazySchema as lazySchema10,
|
|
1706
|
+
zodSchema as zodSchema10
|
|
1707
|
+
} from "@ai-sdk/provider-utils";
|
|
1708
|
+
import { z as z11 } from "zod/v4";
|
|
1709
|
+
var webFetch_20260318ArgsSchema = lazySchema10(
|
|
1710
|
+
() => zodSchema10(
|
|
1711
|
+
z11.object({
|
|
1712
|
+
maxUses: z11.number().optional(),
|
|
1713
|
+
allowedDomains: z11.array(z11.string()).optional(),
|
|
1714
|
+
blockedDomains: z11.array(z11.string()).optional(),
|
|
1715
|
+
citations: z11.object({ enabled: z11.boolean() }).optional(),
|
|
1716
|
+
maxContentTokens: z11.number().optional(),
|
|
1717
|
+
useCache: z11.boolean().optional(),
|
|
1718
|
+
responseInclusion: z11.enum(["full", "excluded"]).optional()
|
|
1719
|
+
})
|
|
1720
|
+
)
|
|
1721
|
+
);
|
|
1722
|
+
var webFetch_20260318OutputSchema = lazySchema10(
|
|
1723
|
+
() => zodSchema10(
|
|
1724
|
+
z11.object({
|
|
1725
|
+
type: z11.literal("web_fetch_result"),
|
|
1726
|
+
url: z11.string(),
|
|
1727
|
+
content: z11.object({
|
|
1728
|
+
type: z11.literal("document"),
|
|
1729
|
+
title: z11.string().nullable(),
|
|
1730
|
+
citations: z11.object({ enabled: z11.boolean() }).optional(),
|
|
1731
|
+
source: z11.union([
|
|
1732
|
+
z11.object({
|
|
1733
|
+
type: z11.literal("base64"),
|
|
1734
|
+
mediaType: z11.literal("application/pdf"),
|
|
1735
|
+
data: z11.string()
|
|
1607
1736
|
}),
|
|
1608
|
-
|
|
1609
|
-
type:
|
|
1610
|
-
mediaType:
|
|
1611
|
-
data:
|
|
1737
|
+
z11.object({
|
|
1738
|
+
type: z11.literal("text"),
|
|
1739
|
+
mediaType: z11.literal("text/plain"),
|
|
1740
|
+
data: z11.string()
|
|
1612
1741
|
})
|
|
1613
1742
|
])
|
|
1614
1743
|
}),
|
|
1615
|
-
retrievedAt:
|
|
1744
|
+
retrievedAt: z11.string().nullable()
|
|
1616
1745
|
})
|
|
1617
1746
|
)
|
|
1618
1747
|
);
|
|
1619
|
-
var
|
|
1620
|
-
() =>
|
|
1621
|
-
|
|
1622
|
-
url:
|
|
1748
|
+
var webFetch_20260318InputSchema = lazySchema10(
|
|
1749
|
+
() => zodSchema10(
|
|
1750
|
+
z11.object({
|
|
1751
|
+
url: z11.string()
|
|
1623
1752
|
})
|
|
1624
1753
|
)
|
|
1625
1754
|
);
|
|
1626
1755
|
var factory6 = createProviderExecutedToolFactory5({
|
|
1756
|
+
id: "anthropic.web_fetch_20260318",
|
|
1757
|
+
inputSchema: webFetch_20260318InputSchema,
|
|
1758
|
+
outputSchema: webFetch_20260318OutputSchema,
|
|
1759
|
+
supportsDeferredResults: true
|
|
1760
|
+
});
|
|
1761
|
+
var webFetch_20260318 = (args = {}) => {
|
|
1762
|
+
return factory6(args);
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1765
|
+
// src/tool/web-fetch-20260209.ts
|
|
1766
|
+
import {
|
|
1767
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
|
|
1768
|
+
lazySchema as lazySchema11,
|
|
1769
|
+
zodSchema as zodSchema11
|
|
1770
|
+
} from "@ai-sdk/provider-utils";
|
|
1771
|
+
import { z as z12 } from "zod/v4";
|
|
1772
|
+
var webFetch_20260209ArgsSchema = lazySchema11(
|
|
1773
|
+
() => zodSchema11(
|
|
1774
|
+
z12.object({
|
|
1775
|
+
maxUses: z12.number().optional(),
|
|
1776
|
+
allowedDomains: z12.array(z12.string()).optional(),
|
|
1777
|
+
blockedDomains: z12.array(z12.string()).optional(),
|
|
1778
|
+
citations: z12.object({ enabled: z12.boolean() }).optional(),
|
|
1779
|
+
maxContentTokens: z12.number().optional()
|
|
1780
|
+
})
|
|
1781
|
+
)
|
|
1782
|
+
);
|
|
1783
|
+
var webFetch_20260209OutputSchema = lazySchema11(
|
|
1784
|
+
() => zodSchema11(
|
|
1785
|
+
z12.object({
|
|
1786
|
+
type: z12.literal("web_fetch_result"),
|
|
1787
|
+
url: z12.string(),
|
|
1788
|
+
content: z12.object({
|
|
1789
|
+
type: z12.literal("document"),
|
|
1790
|
+
title: z12.string().nullable(),
|
|
1791
|
+
citations: z12.object({ enabled: z12.boolean() }).optional(),
|
|
1792
|
+
source: z12.union([
|
|
1793
|
+
z12.object({
|
|
1794
|
+
type: z12.literal("base64"),
|
|
1795
|
+
mediaType: z12.literal("application/pdf"),
|
|
1796
|
+
data: z12.string()
|
|
1797
|
+
}),
|
|
1798
|
+
z12.object({
|
|
1799
|
+
type: z12.literal("text"),
|
|
1800
|
+
mediaType: z12.literal("text/plain"),
|
|
1801
|
+
data: z12.string()
|
|
1802
|
+
})
|
|
1803
|
+
])
|
|
1804
|
+
}),
|
|
1805
|
+
retrievedAt: z12.string().nullable()
|
|
1806
|
+
})
|
|
1807
|
+
)
|
|
1808
|
+
);
|
|
1809
|
+
var webFetch_20260209InputSchema = lazySchema11(
|
|
1810
|
+
() => zodSchema11(
|
|
1811
|
+
z12.object({
|
|
1812
|
+
url: z12.string()
|
|
1813
|
+
})
|
|
1814
|
+
)
|
|
1815
|
+
);
|
|
1816
|
+
var factory7 = createProviderExecutedToolFactory6({
|
|
1817
|
+
id: "anthropic.web_fetch_20260209",
|
|
1818
|
+
inputSchema: webFetch_20260209InputSchema,
|
|
1819
|
+
outputSchema: webFetch_20260209OutputSchema,
|
|
1820
|
+
supportsDeferredResults: true
|
|
1821
|
+
});
|
|
1822
|
+
var webFetch_20260209 = (args = {}) => {
|
|
1823
|
+
return factory7(args);
|
|
1824
|
+
};
|
|
1825
|
+
|
|
1826
|
+
// src/tool/web-fetch-20250910.ts
|
|
1827
|
+
import {
|
|
1828
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
|
|
1829
|
+
lazySchema as lazySchema12,
|
|
1830
|
+
zodSchema as zodSchema12
|
|
1831
|
+
} from "@ai-sdk/provider-utils";
|
|
1832
|
+
import { z as z13 } from "zod/v4";
|
|
1833
|
+
var webFetch_20250910ArgsSchema = lazySchema12(
|
|
1834
|
+
() => zodSchema12(
|
|
1835
|
+
z13.object({
|
|
1836
|
+
maxUses: z13.number().optional(),
|
|
1837
|
+
allowedDomains: z13.array(z13.string()).optional(),
|
|
1838
|
+
blockedDomains: z13.array(z13.string()).optional(),
|
|
1839
|
+
citations: z13.object({ enabled: z13.boolean() }).optional(),
|
|
1840
|
+
maxContentTokens: z13.number().optional()
|
|
1841
|
+
})
|
|
1842
|
+
)
|
|
1843
|
+
);
|
|
1844
|
+
var webFetch_20250910OutputSchema = lazySchema12(
|
|
1845
|
+
() => zodSchema12(
|
|
1846
|
+
z13.object({
|
|
1847
|
+
type: z13.literal("web_fetch_result"),
|
|
1848
|
+
url: z13.string(),
|
|
1849
|
+
content: z13.object({
|
|
1850
|
+
type: z13.literal("document"),
|
|
1851
|
+
title: z13.string().nullable(),
|
|
1852
|
+
citations: z13.object({ enabled: z13.boolean() }).optional(),
|
|
1853
|
+
source: z13.union([
|
|
1854
|
+
z13.object({
|
|
1855
|
+
type: z13.literal("base64"),
|
|
1856
|
+
mediaType: z13.literal("application/pdf"),
|
|
1857
|
+
data: z13.string()
|
|
1858
|
+
}),
|
|
1859
|
+
z13.object({
|
|
1860
|
+
type: z13.literal("text"),
|
|
1861
|
+
mediaType: z13.literal("text/plain"),
|
|
1862
|
+
data: z13.string()
|
|
1863
|
+
})
|
|
1864
|
+
])
|
|
1865
|
+
}),
|
|
1866
|
+
retrievedAt: z13.string().nullable()
|
|
1867
|
+
})
|
|
1868
|
+
)
|
|
1869
|
+
);
|
|
1870
|
+
var webFetch_20250910InputSchema = lazySchema12(
|
|
1871
|
+
() => zodSchema12(
|
|
1872
|
+
z13.object({
|
|
1873
|
+
url: z13.string()
|
|
1874
|
+
})
|
|
1875
|
+
)
|
|
1876
|
+
);
|
|
1877
|
+
var factory8 = createProviderExecutedToolFactory7({
|
|
1627
1878
|
id: "anthropic.web_fetch_20250910",
|
|
1628
1879
|
inputSchema: webFetch_20250910InputSchema,
|
|
1629
1880
|
outputSchema: webFetch_20250910OutputSchema,
|
|
1630
1881
|
supportsDeferredResults: true
|
|
1631
1882
|
});
|
|
1632
1883
|
var webFetch_20250910 = (args = {}) => {
|
|
1633
|
-
return
|
|
1884
|
+
return factory8(args);
|
|
1634
1885
|
};
|
|
1635
1886
|
|
|
1636
1887
|
// src/anthropic-prepare-tools.ts
|
|
@@ -1642,10 +1893,10 @@ async function prepareTools({
|
|
|
1642
1893
|
cacheControlValidator,
|
|
1643
1894
|
supportsStructuredOutput,
|
|
1644
1895
|
supportsStrictTools,
|
|
1645
|
-
defaultEagerInputStreaming = false
|
|
1896
|
+
defaultEagerInputStreaming = false,
|
|
1897
|
+
rejectsForcedToolUse = false
|
|
1646
1898
|
}) {
|
|
1647
|
-
|
|
1648
|
-
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
1899
|
+
tools = tools?.length ? tools : void 0;
|
|
1649
1900
|
const toolWarnings = [];
|
|
1650
1901
|
const betas = /* @__PURE__ */ new Set();
|
|
1651
1902
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
@@ -1660,10 +1911,10 @@ async function prepareTools({
|
|
|
1660
1911
|
type: "tool definition",
|
|
1661
1912
|
canCache: true
|
|
1662
1913
|
});
|
|
1663
|
-
const anthropicOptions =
|
|
1664
|
-
const eagerInputStreaming =
|
|
1665
|
-
const deferLoading = anthropicOptions
|
|
1666
|
-
const allowedCallers = anthropicOptions
|
|
1914
|
+
const anthropicOptions = tool.providerOptions?.anthropic;
|
|
1915
|
+
const eagerInputStreaming = anthropicOptions?.eagerInputStreaming ?? defaultEagerInputStreaming;
|
|
1916
|
+
const deferLoading = anthropicOptions?.deferLoading;
|
|
1917
|
+
const allowedCallers = anthropicOptions?.allowedCallers;
|
|
1667
1918
|
if (!supportsStrictTools && tool.strict != null) {
|
|
1668
1919
|
toolWarnings.push({
|
|
1669
1920
|
type: "unsupported",
|
|
@@ -1745,6 +1996,31 @@ async function prepareTools({
|
|
|
1745
1996
|
});
|
|
1746
1997
|
break;
|
|
1747
1998
|
}
|
|
1999
|
+
case "anthropic.computer_toolset_20260801": {
|
|
2000
|
+
const args = await validateTypes({
|
|
2001
|
+
value: tool.args,
|
|
2002
|
+
schema: computerToolset_20260801ArgsSchema
|
|
2003
|
+
});
|
|
2004
|
+
const configs = args.configs != null ? Object.fromEntries(
|
|
2005
|
+
Object.entries(args.configs).map(([member, config]) => [
|
|
2006
|
+
member,
|
|
2007
|
+
{
|
|
2008
|
+
...config?.enabled != null && {
|
|
2009
|
+
enabled: config.enabled
|
|
2010
|
+
},
|
|
2011
|
+
...config?.deferLoading != null && {
|
|
2012
|
+
defer_loading: config.deferLoading
|
|
2013
|
+
}
|
|
2014
|
+
}
|
|
2015
|
+
])
|
|
2016
|
+
) : void 0;
|
|
2017
|
+
anthropicTools2.push({
|
|
2018
|
+
type: "computer_toolset_20260801",
|
|
2019
|
+
...configs != null && { configs },
|
|
2020
|
+
cache_control: void 0
|
|
2021
|
+
});
|
|
2022
|
+
break;
|
|
2023
|
+
}
|
|
1748
2024
|
case "anthropic.computer_20241022": {
|
|
1749
2025
|
betas.add("computer-use-2024-10-22");
|
|
1750
2026
|
anthropicTools2.push({
|
|
@@ -1859,6 +2135,25 @@ async function prepareTools({
|
|
|
1859
2135
|
});
|
|
1860
2136
|
break;
|
|
1861
2137
|
}
|
|
2138
|
+
case "anthropic.web_fetch_20260318": {
|
|
2139
|
+
const args = await validateTypes({
|
|
2140
|
+
value: tool.args,
|
|
2141
|
+
schema: webFetch_20260318ArgsSchema
|
|
2142
|
+
});
|
|
2143
|
+
anthropicTools2.push({
|
|
2144
|
+
type: "web_fetch_20260318",
|
|
2145
|
+
name: "web_fetch",
|
|
2146
|
+
max_uses: args.maxUses,
|
|
2147
|
+
allowed_domains: args.allowedDomains,
|
|
2148
|
+
blocked_domains: args.blockedDomains,
|
|
2149
|
+
citations: args.citations,
|
|
2150
|
+
max_content_tokens: args.maxContentTokens,
|
|
2151
|
+
use_cache: args.useCache,
|
|
2152
|
+
response_inclusion: args.responseInclusion,
|
|
2153
|
+
cache_control: void 0
|
|
2154
|
+
});
|
|
2155
|
+
break;
|
|
2156
|
+
}
|
|
1862
2157
|
case "anthropic.web_search_20250305": {
|
|
1863
2158
|
const args = await validateTypes({
|
|
1864
2159
|
value: tool.args,
|
|
@@ -1892,6 +2187,23 @@ async function prepareTools({
|
|
|
1892
2187
|
});
|
|
1893
2188
|
break;
|
|
1894
2189
|
}
|
|
2190
|
+
case "anthropic.web_search_20260318": {
|
|
2191
|
+
const args = await validateTypes({
|
|
2192
|
+
value: tool.args,
|
|
2193
|
+
schema: webSearch_20260318ArgsSchema
|
|
2194
|
+
});
|
|
2195
|
+
anthropicTools2.push({
|
|
2196
|
+
type: "web_search_20260318",
|
|
2197
|
+
name: "web_search",
|
|
2198
|
+
max_uses: args.maxUses,
|
|
2199
|
+
allowed_domains: args.allowedDomains,
|
|
2200
|
+
blocked_domains: args.blockedDomains,
|
|
2201
|
+
user_location: args.userLocation,
|
|
2202
|
+
response_inclusion: args.responseInclusion,
|
|
2203
|
+
cache_control: void 0
|
|
2204
|
+
});
|
|
2205
|
+
break;
|
|
2206
|
+
}
|
|
1895
2207
|
case "anthropic.tool_search_regex_20251119": {
|
|
1896
2208
|
anthropicTools2.push({
|
|
1897
2209
|
type: "tool_search_tool_regex_20251119",
|
|
@@ -1964,6 +2276,22 @@ async function prepareTools({
|
|
|
1964
2276
|
betas
|
|
1965
2277
|
};
|
|
1966
2278
|
case "required":
|
|
2279
|
+
if (rejectsForcedToolUse) {
|
|
2280
|
+
toolWarnings.push({
|
|
2281
|
+
type: "unsupported",
|
|
2282
|
+
feature: "toolChoice",
|
|
2283
|
+
details: `toolChoice 'required' is not supported by this model because it rejects forced tool use. Using 'auto' instead. Instruct the model to use a tool in the prompt and verify that a tool call was made.`
|
|
2284
|
+
});
|
|
2285
|
+
return {
|
|
2286
|
+
tools: anthropicTools2,
|
|
2287
|
+
toolChoice: {
|
|
2288
|
+
type: "auto",
|
|
2289
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
2290
|
+
},
|
|
2291
|
+
toolWarnings,
|
|
2292
|
+
betas
|
|
2293
|
+
};
|
|
2294
|
+
}
|
|
1967
2295
|
return {
|
|
1968
2296
|
tools: anthropicTools2,
|
|
1969
2297
|
toolChoice: {
|
|
@@ -1976,6 +2304,24 @@ async function prepareTools({
|
|
|
1976
2304
|
case "none":
|
|
1977
2305
|
return { tools: void 0, toolChoice: void 0, toolWarnings, betas };
|
|
1978
2306
|
case "tool":
|
|
2307
|
+
if (rejectsForcedToolUse) {
|
|
2308
|
+
toolWarnings.push({
|
|
2309
|
+
type: "unsupported",
|
|
2310
|
+
feature: "toolChoice",
|
|
2311
|
+
details: `toolChoice 'tool' is not supported by this model because it rejects forced tool use. Only the '${toolChoice.toolName}' tool is sent with 'auto' tool choice. Instruct the model to use the tool in the prompt and verify that a tool call was made.`
|
|
2312
|
+
});
|
|
2313
|
+
return {
|
|
2314
|
+
tools: anthropicTools2.filter(
|
|
2315
|
+
(tool) => "name" in tool && tool.name === toolChoice.toolName
|
|
2316
|
+
),
|
|
2317
|
+
toolChoice: {
|
|
2318
|
+
type: "auto",
|
|
2319
|
+
disable_parallel_tool_use: disableParallelToolUse
|
|
2320
|
+
},
|
|
2321
|
+
toolWarnings,
|
|
2322
|
+
betas
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
1979
2325
|
return {
|
|
1980
2326
|
tools: anthropicTools2,
|
|
1981
2327
|
toolChoice: {
|
|
@@ -2000,13 +2346,12 @@ function convertAnthropicUsage({
|
|
|
2000
2346
|
usage,
|
|
2001
2347
|
rawUsage
|
|
2002
2348
|
}) {
|
|
2003
|
-
|
|
2004
|
-
const
|
|
2005
|
-
const
|
|
2006
|
-
const reasoningTokens = (_d = (_c = usage.output_tokens_details) == null ? void 0 : _c.thinking_tokens) != null ? _d : void 0;
|
|
2349
|
+
const cacheCreationTokens = usage.cache_creation_input_tokens ?? 0;
|
|
2350
|
+
const cacheReadTokens = usage.cache_read_input_tokens ?? 0;
|
|
2351
|
+
const reasoningTokens = usage.output_tokens_details?.thinking_tokens ?? void 0;
|
|
2007
2352
|
let inputTokens;
|
|
2008
2353
|
let outputTokens;
|
|
2009
|
-
const servedByFallback =
|
|
2354
|
+
const servedByFallback = usage.iterations?.some(
|
|
2010
2355
|
(iter) => iter.type === "fallback_message"
|
|
2011
2356
|
);
|
|
2012
2357
|
if (usage.iterations && usage.iterations.length > 0 && !servedByFallback) {
|
|
@@ -2043,7 +2388,7 @@ function convertAnthropicUsage({
|
|
|
2043
2388
|
text: reasoningTokens == null ? void 0 : outputTokens - reasoningTokens,
|
|
2044
2389
|
reasoning: reasoningTokens
|
|
2045
2390
|
},
|
|
2046
|
-
raw: rawUsage
|
|
2391
|
+
raw: rawUsage ?? usage
|
|
2047
2392
|
};
|
|
2048
2393
|
}
|
|
2049
2394
|
|
|
@@ -2065,145 +2410,145 @@ import {
|
|
|
2065
2410
|
|
|
2066
2411
|
// src/tool/code-execution_20250522.ts
|
|
2067
2412
|
import {
|
|
2068
|
-
createProviderExecutedToolFactory as
|
|
2069
|
-
lazySchema as
|
|
2070
|
-
zodSchema as
|
|
2413
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory8,
|
|
2414
|
+
lazySchema as lazySchema13,
|
|
2415
|
+
zodSchema as zodSchema13
|
|
2071
2416
|
} from "@ai-sdk/provider-utils";
|
|
2072
|
-
import { z as
|
|
2073
|
-
var codeExecution_20250522OutputSchema =
|
|
2074
|
-
() =>
|
|
2075
|
-
|
|
2076
|
-
type:
|
|
2077
|
-
stdout:
|
|
2078
|
-
stderr:
|
|
2079
|
-
return_code:
|
|
2080
|
-
content:
|
|
2081
|
-
|
|
2082
|
-
type:
|
|
2083
|
-
file_id:
|
|
2417
|
+
import { z as z14 } from "zod/v4";
|
|
2418
|
+
var codeExecution_20250522OutputSchema = lazySchema13(
|
|
2419
|
+
() => zodSchema13(
|
|
2420
|
+
z14.object({
|
|
2421
|
+
type: z14.literal("code_execution_result"),
|
|
2422
|
+
stdout: z14.string(),
|
|
2423
|
+
stderr: z14.string(),
|
|
2424
|
+
return_code: z14.number(),
|
|
2425
|
+
content: z14.array(
|
|
2426
|
+
z14.object({
|
|
2427
|
+
type: z14.literal("code_execution_output"),
|
|
2428
|
+
file_id: z14.string()
|
|
2084
2429
|
})
|
|
2085
2430
|
).optional().default([])
|
|
2086
2431
|
})
|
|
2087
2432
|
)
|
|
2088
2433
|
);
|
|
2089
|
-
var codeExecution_20250522InputSchema =
|
|
2090
|
-
() =>
|
|
2091
|
-
|
|
2092
|
-
code:
|
|
2434
|
+
var codeExecution_20250522InputSchema = lazySchema13(
|
|
2435
|
+
() => zodSchema13(
|
|
2436
|
+
z14.object({
|
|
2437
|
+
code: z14.string()
|
|
2093
2438
|
})
|
|
2094
2439
|
)
|
|
2095
2440
|
);
|
|
2096
|
-
var
|
|
2441
|
+
var factory9 = createProviderExecutedToolFactory8({
|
|
2097
2442
|
id: "anthropic.code_execution_20250522",
|
|
2098
2443
|
inputSchema: codeExecution_20250522InputSchema,
|
|
2099
2444
|
outputSchema: codeExecution_20250522OutputSchema
|
|
2100
2445
|
});
|
|
2101
2446
|
var codeExecution_20250522 = (args = {}) => {
|
|
2102
|
-
return
|
|
2447
|
+
return factory9(args);
|
|
2103
2448
|
};
|
|
2104
2449
|
|
|
2105
2450
|
// src/tool/code-execution_20250825.ts
|
|
2106
2451
|
import {
|
|
2107
|
-
createProviderExecutedToolFactory as
|
|
2452
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory9,
|
|
2108
2453
|
experimental_toolCaller,
|
|
2109
|
-
lazySchema as
|
|
2110
|
-
zodSchema as
|
|
2454
|
+
lazySchema as lazySchema14,
|
|
2455
|
+
zodSchema as zodSchema14
|
|
2111
2456
|
} from "@ai-sdk/provider-utils";
|
|
2112
|
-
import { z as
|
|
2113
|
-
var codeExecution_20250825OutputSchema =
|
|
2114
|
-
() =>
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
type:
|
|
2118
|
-
stdout:
|
|
2119
|
-
stderr:
|
|
2120
|
-
return_code:
|
|
2121
|
-
content:
|
|
2122
|
-
|
|
2123
|
-
type:
|
|
2124
|
-
file_id:
|
|
2457
|
+
import { z as z15 } from "zod/v4";
|
|
2458
|
+
var codeExecution_20250825OutputSchema = lazySchema14(
|
|
2459
|
+
() => zodSchema14(
|
|
2460
|
+
z15.discriminatedUnion("type", [
|
|
2461
|
+
z15.object({
|
|
2462
|
+
type: z15.literal("code_execution_result"),
|
|
2463
|
+
stdout: z15.string(),
|
|
2464
|
+
stderr: z15.string(),
|
|
2465
|
+
return_code: z15.number(),
|
|
2466
|
+
content: z15.array(
|
|
2467
|
+
z15.object({
|
|
2468
|
+
type: z15.literal("code_execution_output"),
|
|
2469
|
+
file_id: z15.string()
|
|
2125
2470
|
})
|
|
2126
2471
|
).optional().default([])
|
|
2127
2472
|
}),
|
|
2128
|
-
|
|
2129
|
-
type:
|
|
2130
|
-
content:
|
|
2131
|
-
|
|
2132
|
-
type:
|
|
2133
|
-
file_id:
|
|
2473
|
+
z15.object({
|
|
2474
|
+
type: z15.literal("bash_code_execution_result"),
|
|
2475
|
+
content: z15.array(
|
|
2476
|
+
z15.object({
|
|
2477
|
+
type: z15.literal("bash_code_execution_output"),
|
|
2478
|
+
file_id: z15.string()
|
|
2134
2479
|
})
|
|
2135
2480
|
),
|
|
2136
|
-
stdout:
|
|
2137
|
-
stderr:
|
|
2138
|
-
return_code:
|
|
2481
|
+
stdout: z15.string(),
|
|
2482
|
+
stderr: z15.string(),
|
|
2483
|
+
return_code: z15.number()
|
|
2139
2484
|
}),
|
|
2140
|
-
|
|
2141
|
-
type:
|
|
2142
|
-
error_code:
|
|
2485
|
+
z15.object({
|
|
2486
|
+
type: z15.literal("bash_code_execution_tool_result_error"),
|
|
2487
|
+
error_code: z15.string()
|
|
2143
2488
|
}),
|
|
2144
|
-
|
|
2145
|
-
type:
|
|
2146
|
-
error_code:
|
|
2489
|
+
z15.object({
|
|
2490
|
+
type: z15.literal("text_editor_code_execution_tool_result_error"),
|
|
2491
|
+
error_code: z15.string()
|
|
2147
2492
|
}),
|
|
2148
|
-
|
|
2149
|
-
type:
|
|
2150
|
-
content:
|
|
2151
|
-
file_type:
|
|
2152
|
-
num_lines:
|
|
2153
|
-
start_line:
|
|
2154
|
-
total_lines:
|
|
2493
|
+
z15.object({
|
|
2494
|
+
type: z15.literal("text_editor_code_execution_view_result"),
|
|
2495
|
+
content: z15.string(),
|
|
2496
|
+
file_type: z15.string(),
|
|
2497
|
+
num_lines: z15.number().nullable(),
|
|
2498
|
+
start_line: z15.number().nullable(),
|
|
2499
|
+
total_lines: z15.number().nullable()
|
|
2155
2500
|
}),
|
|
2156
|
-
|
|
2157
|
-
type:
|
|
2158
|
-
is_file_update:
|
|
2501
|
+
z15.object({
|
|
2502
|
+
type: z15.literal("text_editor_code_execution_create_result"),
|
|
2503
|
+
is_file_update: z15.boolean()
|
|
2159
2504
|
}),
|
|
2160
|
-
|
|
2161
|
-
type:
|
|
2162
|
-
lines:
|
|
2163
|
-
new_lines:
|
|
2164
|
-
new_start:
|
|
2165
|
-
old_lines:
|
|
2166
|
-
old_start:
|
|
2505
|
+
z15.object({
|
|
2506
|
+
type: z15.literal("text_editor_code_execution_str_replace_result"),
|
|
2507
|
+
lines: z15.array(z15.string()).nullable(),
|
|
2508
|
+
new_lines: z15.number().nullable(),
|
|
2509
|
+
new_start: z15.number().nullable(),
|
|
2510
|
+
old_lines: z15.number().nullable(),
|
|
2511
|
+
old_start: z15.number().nullable()
|
|
2167
2512
|
})
|
|
2168
2513
|
])
|
|
2169
2514
|
)
|
|
2170
2515
|
);
|
|
2171
|
-
var codeExecution_20250825InputSchema =
|
|
2172
|
-
() =>
|
|
2173
|
-
|
|
2516
|
+
var codeExecution_20250825InputSchema = lazySchema14(
|
|
2517
|
+
() => zodSchema14(
|
|
2518
|
+
z15.discriminatedUnion("type", [
|
|
2174
2519
|
// Programmatic tool calling format (mapped from { code } by AI SDK)
|
|
2175
|
-
|
|
2176
|
-
type:
|
|
2177
|
-
code:
|
|
2520
|
+
z15.object({
|
|
2521
|
+
type: z15.literal("programmatic-tool-call"),
|
|
2522
|
+
code: z15.string()
|
|
2178
2523
|
}),
|
|
2179
|
-
|
|
2180
|
-
type:
|
|
2181
|
-
command:
|
|
2524
|
+
z15.object({
|
|
2525
|
+
type: z15.literal("bash_code_execution"),
|
|
2526
|
+
command: z15.string()
|
|
2182
2527
|
}),
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
type:
|
|
2186
|
-
command:
|
|
2187
|
-
path:
|
|
2528
|
+
z15.discriminatedUnion("command", [
|
|
2529
|
+
z15.object({
|
|
2530
|
+
type: z15.literal("text_editor_code_execution"),
|
|
2531
|
+
command: z15.literal("view"),
|
|
2532
|
+
path: z15.string()
|
|
2188
2533
|
}),
|
|
2189
|
-
|
|
2190
|
-
type:
|
|
2191
|
-
command:
|
|
2192
|
-
path:
|
|
2193
|
-
file_text:
|
|
2534
|
+
z15.object({
|
|
2535
|
+
type: z15.literal("text_editor_code_execution"),
|
|
2536
|
+
command: z15.literal("create"),
|
|
2537
|
+
path: z15.string(),
|
|
2538
|
+
file_text: z15.string().nullish()
|
|
2194
2539
|
}),
|
|
2195
|
-
|
|
2196
|
-
type:
|
|
2197
|
-
command:
|
|
2198
|
-
path:
|
|
2199
|
-
old_str:
|
|
2200
|
-
new_str:
|
|
2540
|
+
z15.object({
|
|
2541
|
+
type: z15.literal("text_editor_code_execution"),
|
|
2542
|
+
command: z15.literal("str_replace"),
|
|
2543
|
+
path: z15.string(),
|
|
2544
|
+
old_str: z15.string(),
|
|
2545
|
+
new_str: z15.string()
|
|
2201
2546
|
})
|
|
2202
2547
|
])
|
|
2203
2548
|
])
|
|
2204
2549
|
)
|
|
2205
2550
|
);
|
|
2206
|
-
var
|
|
2551
|
+
var factory10 = createProviderExecutedToolFactory9({
|
|
2207
2552
|
id: "anthropic.code_execution_20250825",
|
|
2208
2553
|
inputSchema: codeExecution_20250825InputSchema,
|
|
2209
2554
|
outputSchema: codeExecution_20250825OutputSchema,
|
|
@@ -2213,18 +2558,17 @@ var factory8 = createProviderExecutedToolFactory7({
|
|
|
2213
2558
|
supportsDeferredResults: true
|
|
2214
2559
|
});
|
|
2215
2560
|
var codeExecution_20250825 = (args = {}) => {
|
|
2216
|
-
return experimental_toolCaller(
|
|
2561
|
+
return experimental_toolCaller(factory10(args), {
|
|
2217
2562
|
type: "provider",
|
|
2218
2563
|
prepareProviderOptions: (providerOptions) => {
|
|
2219
|
-
|
|
2220
|
-
const anthropicOptions = providerOptions == null ? void 0 : providerOptions.anthropic;
|
|
2564
|
+
const anthropicOptions = providerOptions?.anthropic;
|
|
2221
2565
|
return {
|
|
2222
2566
|
...providerOptions,
|
|
2223
2567
|
anthropic: {
|
|
2224
2568
|
...anthropicOptions,
|
|
2225
2569
|
allowedCallers: [
|
|
2226
2570
|
.../* @__PURE__ */ new Set([
|
|
2227
|
-
...
|
|
2571
|
+
...anthropicOptions?.allowedCallers ?? [],
|
|
2228
2572
|
"code_execution_20250825"
|
|
2229
2573
|
])
|
|
2230
2574
|
]
|
|
@@ -2236,135 +2580,134 @@ var codeExecution_20250825 = (args = {}) => {
|
|
|
2236
2580
|
|
|
2237
2581
|
// src/tool/code-execution_20260120.ts
|
|
2238
2582
|
import {
|
|
2239
|
-
createProviderExecutedToolFactory as
|
|
2583
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory10,
|
|
2240
2584
|
experimental_toolCaller as experimental_toolCaller2,
|
|
2241
|
-
lazySchema as
|
|
2242
|
-
zodSchema as
|
|
2585
|
+
lazySchema as lazySchema15,
|
|
2586
|
+
zodSchema as zodSchema15
|
|
2243
2587
|
} from "@ai-sdk/provider-utils";
|
|
2244
|
-
import { z as
|
|
2245
|
-
var codeExecution_20260120OutputSchema =
|
|
2246
|
-
() =>
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
type:
|
|
2250
|
-
stdout:
|
|
2251
|
-
stderr:
|
|
2252
|
-
return_code:
|
|
2253
|
-
content:
|
|
2254
|
-
|
|
2255
|
-
type:
|
|
2256
|
-
file_id:
|
|
2588
|
+
import { z as z16 } from "zod/v4";
|
|
2589
|
+
var codeExecution_20260120OutputSchema = lazySchema15(
|
|
2590
|
+
() => zodSchema15(
|
|
2591
|
+
z16.discriminatedUnion("type", [
|
|
2592
|
+
z16.object({
|
|
2593
|
+
type: z16.literal("code_execution_result"),
|
|
2594
|
+
stdout: z16.string(),
|
|
2595
|
+
stderr: z16.string(),
|
|
2596
|
+
return_code: z16.number(),
|
|
2597
|
+
content: z16.array(
|
|
2598
|
+
z16.object({
|
|
2599
|
+
type: z16.literal("code_execution_output"),
|
|
2600
|
+
file_id: z16.string()
|
|
2257
2601
|
})
|
|
2258
2602
|
).optional().default([])
|
|
2259
2603
|
}),
|
|
2260
|
-
|
|
2261
|
-
type:
|
|
2262
|
-
encrypted_stdout:
|
|
2263
|
-
stderr:
|
|
2264
|
-
return_code:
|
|
2265
|
-
content:
|
|
2266
|
-
|
|
2267
|
-
type:
|
|
2268
|
-
file_id:
|
|
2604
|
+
z16.object({
|
|
2605
|
+
type: z16.literal("encrypted_code_execution_result"),
|
|
2606
|
+
encrypted_stdout: z16.string(),
|
|
2607
|
+
stderr: z16.string(),
|
|
2608
|
+
return_code: z16.number(),
|
|
2609
|
+
content: z16.array(
|
|
2610
|
+
z16.object({
|
|
2611
|
+
type: z16.literal("code_execution_output"),
|
|
2612
|
+
file_id: z16.string()
|
|
2269
2613
|
})
|
|
2270
2614
|
).optional().default([])
|
|
2271
2615
|
}),
|
|
2272
|
-
|
|
2273
|
-
type:
|
|
2274
|
-
content:
|
|
2275
|
-
|
|
2276
|
-
type:
|
|
2277
|
-
file_id:
|
|
2616
|
+
z16.object({
|
|
2617
|
+
type: z16.literal("bash_code_execution_result"),
|
|
2618
|
+
content: z16.array(
|
|
2619
|
+
z16.object({
|
|
2620
|
+
type: z16.literal("bash_code_execution_output"),
|
|
2621
|
+
file_id: z16.string()
|
|
2278
2622
|
})
|
|
2279
2623
|
),
|
|
2280
|
-
stdout:
|
|
2281
|
-
stderr:
|
|
2282
|
-
return_code:
|
|
2624
|
+
stdout: z16.string(),
|
|
2625
|
+
stderr: z16.string(),
|
|
2626
|
+
return_code: z16.number()
|
|
2283
2627
|
}),
|
|
2284
|
-
|
|
2285
|
-
type:
|
|
2286
|
-
error_code:
|
|
2628
|
+
z16.object({
|
|
2629
|
+
type: z16.literal("bash_code_execution_tool_result_error"),
|
|
2630
|
+
error_code: z16.string()
|
|
2287
2631
|
}),
|
|
2288
|
-
|
|
2289
|
-
type:
|
|
2290
|
-
error_code:
|
|
2632
|
+
z16.object({
|
|
2633
|
+
type: z16.literal("text_editor_code_execution_tool_result_error"),
|
|
2634
|
+
error_code: z16.string()
|
|
2291
2635
|
}),
|
|
2292
|
-
|
|
2293
|
-
type:
|
|
2294
|
-
content:
|
|
2295
|
-
file_type:
|
|
2296
|
-
num_lines:
|
|
2297
|
-
start_line:
|
|
2298
|
-
total_lines:
|
|
2636
|
+
z16.object({
|
|
2637
|
+
type: z16.literal("text_editor_code_execution_view_result"),
|
|
2638
|
+
content: z16.string(),
|
|
2639
|
+
file_type: z16.string(),
|
|
2640
|
+
num_lines: z16.number().nullable(),
|
|
2641
|
+
start_line: z16.number().nullable(),
|
|
2642
|
+
total_lines: z16.number().nullable()
|
|
2299
2643
|
}),
|
|
2300
|
-
|
|
2301
|
-
type:
|
|
2302
|
-
is_file_update:
|
|
2644
|
+
z16.object({
|
|
2645
|
+
type: z16.literal("text_editor_code_execution_create_result"),
|
|
2646
|
+
is_file_update: z16.boolean()
|
|
2303
2647
|
}),
|
|
2304
|
-
|
|
2305
|
-
type:
|
|
2306
|
-
lines:
|
|
2307
|
-
new_lines:
|
|
2308
|
-
new_start:
|
|
2309
|
-
old_lines:
|
|
2310
|
-
old_start:
|
|
2648
|
+
z16.object({
|
|
2649
|
+
type: z16.literal("text_editor_code_execution_str_replace_result"),
|
|
2650
|
+
lines: z16.array(z16.string()).nullable(),
|
|
2651
|
+
new_lines: z16.number().nullable(),
|
|
2652
|
+
new_start: z16.number().nullable(),
|
|
2653
|
+
old_lines: z16.number().nullable(),
|
|
2654
|
+
old_start: z16.number().nullable()
|
|
2311
2655
|
})
|
|
2312
2656
|
])
|
|
2313
2657
|
)
|
|
2314
2658
|
);
|
|
2315
|
-
var codeExecution_20260120InputSchema =
|
|
2316
|
-
() =>
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
type:
|
|
2320
|
-
code:
|
|
2659
|
+
var codeExecution_20260120InputSchema = lazySchema15(
|
|
2660
|
+
() => zodSchema15(
|
|
2661
|
+
z16.discriminatedUnion("type", [
|
|
2662
|
+
z16.object({
|
|
2663
|
+
type: z16.literal("programmatic-tool-call"),
|
|
2664
|
+
code: z16.string()
|
|
2321
2665
|
}),
|
|
2322
|
-
|
|
2323
|
-
type:
|
|
2324
|
-
command:
|
|
2666
|
+
z16.object({
|
|
2667
|
+
type: z16.literal("bash_code_execution"),
|
|
2668
|
+
command: z16.string()
|
|
2325
2669
|
}),
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
type:
|
|
2329
|
-
command:
|
|
2330
|
-
path:
|
|
2670
|
+
z16.discriminatedUnion("command", [
|
|
2671
|
+
z16.object({
|
|
2672
|
+
type: z16.literal("text_editor_code_execution"),
|
|
2673
|
+
command: z16.literal("view"),
|
|
2674
|
+
path: z16.string()
|
|
2331
2675
|
}),
|
|
2332
|
-
|
|
2333
|
-
type:
|
|
2334
|
-
command:
|
|
2335
|
-
path:
|
|
2336
|
-
file_text:
|
|
2676
|
+
z16.object({
|
|
2677
|
+
type: z16.literal("text_editor_code_execution"),
|
|
2678
|
+
command: z16.literal("create"),
|
|
2679
|
+
path: z16.string(),
|
|
2680
|
+
file_text: z16.string().nullish()
|
|
2337
2681
|
}),
|
|
2338
|
-
|
|
2339
|
-
type:
|
|
2340
|
-
command:
|
|
2341
|
-
path:
|
|
2342
|
-
old_str:
|
|
2343
|
-
new_str:
|
|
2682
|
+
z16.object({
|
|
2683
|
+
type: z16.literal("text_editor_code_execution"),
|
|
2684
|
+
command: z16.literal("str_replace"),
|
|
2685
|
+
path: z16.string(),
|
|
2686
|
+
old_str: z16.string(),
|
|
2687
|
+
new_str: z16.string()
|
|
2344
2688
|
})
|
|
2345
2689
|
])
|
|
2346
2690
|
])
|
|
2347
2691
|
)
|
|
2348
2692
|
);
|
|
2349
|
-
var
|
|
2693
|
+
var factory11 = createProviderExecutedToolFactory10({
|
|
2350
2694
|
id: "anthropic.code_execution_20260120",
|
|
2351
2695
|
inputSchema: codeExecution_20260120InputSchema,
|
|
2352
2696
|
outputSchema: codeExecution_20260120OutputSchema,
|
|
2353
2697
|
supportsDeferredResults: true
|
|
2354
2698
|
});
|
|
2355
2699
|
var codeExecution_20260120 = (args = {}) => {
|
|
2356
|
-
return experimental_toolCaller2(
|
|
2700
|
+
return experimental_toolCaller2(factory11(args), {
|
|
2357
2701
|
type: "provider",
|
|
2358
2702
|
prepareProviderOptions: (providerOptions) => {
|
|
2359
|
-
|
|
2360
|
-
const anthropicOptions = providerOptions == null ? void 0 : providerOptions.anthropic;
|
|
2703
|
+
const anthropicOptions = providerOptions?.anthropic;
|
|
2361
2704
|
return {
|
|
2362
2705
|
...providerOptions,
|
|
2363
2706
|
anthropic: {
|
|
2364
2707
|
...anthropicOptions,
|
|
2365
2708
|
allowedCallers: [
|
|
2366
2709
|
.../* @__PURE__ */ new Set([
|
|
2367
|
-
...
|
|
2710
|
+
...anthropicOptions?.allowedCallers ?? [],
|
|
2368
2711
|
"code_execution_20260120"
|
|
2369
2712
|
])
|
|
2370
2713
|
]
|
|
@@ -2376,24 +2719,24 @@ var codeExecution_20260120 = (args = {}) => {
|
|
|
2376
2719
|
|
|
2377
2720
|
// src/tool/tool-search-regex_20251119.ts
|
|
2378
2721
|
import {
|
|
2379
|
-
createProviderExecutedToolFactory as
|
|
2380
|
-
lazySchema as
|
|
2381
|
-
zodSchema as
|
|
2722
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory11,
|
|
2723
|
+
lazySchema as lazySchema16,
|
|
2724
|
+
zodSchema as zodSchema16
|
|
2382
2725
|
} from "@ai-sdk/provider-utils";
|
|
2383
|
-
import { z as
|
|
2384
|
-
var toolSearchRegex_20251119OutputSchema =
|
|
2385
|
-
() =>
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
type:
|
|
2389
|
-
toolName:
|
|
2726
|
+
import { z as z17 } from "zod/v4";
|
|
2727
|
+
var toolSearchRegex_20251119OutputSchema = lazySchema16(
|
|
2728
|
+
() => zodSchema16(
|
|
2729
|
+
z17.array(
|
|
2730
|
+
z17.object({
|
|
2731
|
+
type: z17.literal("tool_reference"),
|
|
2732
|
+
toolName: z17.string()
|
|
2390
2733
|
})
|
|
2391
2734
|
)
|
|
2392
2735
|
)
|
|
2393
2736
|
);
|
|
2394
|
-
var toolSearchRegex_20251119InputSchema =
|
|
2395
|
-
() =>
|
|
2396
|
-
|
|
2737
|
+
var toolSearchRegex_20251119InputSchema = lazySchema16(
|
|
2738
|
+
() => zodSchema16(
|
|
2739
|
+
z17.object({
|
|
2397
2740
|
/**
|
|
2398
2741
|
* A regex pattern to search for tools.
|
|
2399
2742
|
* Uses Python re.search() syntax. Maximum 200 characters.
|
|
@@ -2404,22 +2747,22 @@ var toolSearchRegex_20251119InputSchema = lazySchema13(
|
|
|
2404
2747
|
* - "database.*query|query.*database" - OR patterns for flexibility
|
|
2405
2748
|
* - "(?i)slack" - case-insensitive search
|
|
2406
2749
|
*/
|
|
2407
|
-
pattern:
|
|
2750
|
+
pattern: z17.string(),
|
|
2408
2751
|
/**
|
|
2409
2752
|
* Maximum number of tools to return. Optional.
|
|
2410
2753
|
*/
|
|
2411
|
-
limit:
|
|
2754
|
+
limit: z17.number().optional()
|
|
2412
2755
|
})
|
|
2413
2756
|
)
|
|
2414
2757
|
);
|
|
2415
|
-
var
|
|
2758
|
+
var factory12 = createProviderExecutedToolFactory11({
|
|
2416
2759
|
id: "anthropic.tool_search_regex_20251119",
|
|
2417
2760
|
inputSchema: toolSearchRegex_20251119InputSchema,
|
|
2418
2761
|
outputSchema: toolSearchRegex_20251119OutputSchema,
|
|
2419
2762
|
supportsDeferredResults: true
|
|
2420
2763
|
});
|
|
2421
2764
|
var toolSearchRegex_20251119 = (args = {}) => {
|
|
2422
|
-
return
|
|
2765
|
+
return factory12(args);
|
|
2423
2766
|
};
|
|
2424
2767
|
|
|
2425
2768
|
// src/convert-to-anthropic-prompt.ts
|
|
@@ -2436,8 +2779,8 @@ function extractErrorValue(value) {
|
|
|
2436
2779
|
} else if (typeof value === "object" && value !== null) {
|
|
2437
2780
|
return value;
|
|
2438
2781
|
}
|
|
2439
|
-
} catch
|
|
2440
|
-
const extractedErrorCode = value
|
|
2782
|
+
} catch {
|
|
2783
|
+
const extractedErrorCode = value?.errorCode;
|
|
2441
2784
|
return {
|
|
2442
2785
|
errorCode: typeof extractedErrorCode === "string" ? extractedErrorCode : "unavailable"
|
|
2443
2786
|
};
|
|
@@ -2449,31 +2792,30 @@ async function convertToAnthropicPrompt({
|
|
|
2449
2792
|
sendReasoning,
|
|
2450
2793
|
warnings,
|
|
2451
2794
|
cacheControlValidator,
|
|
2452
|
-
toolNameMapping
|
|
2795
|
+
toolNameMapping,
|
|
2796
|
+
toolsetNames = {}
|
|
2453
2797
|
}) {
|
|
2454
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
2455
2798
|
const betas = /* @__PURE__ */ new Set();
|
|
2456
2799
|
const blocks = groupIntoBlocks(prompt);
|
|
2457
2800
|
const validator = cacheControlValidator || new CacheControlValidator();
|
|
2458
2801
|
let system = void 0;
|
|
2459
2802
|
const messages = [];
|
|
2803
|
+
let lastUserMessageIndex = -1;
|
|
2460
2804
|
async function shouldEnableCitations(providerMetadata) {
|
|
2461
|
-
var _a2, _b2;
|
|
2462
2805
|
const anthropicOptions = await parseProviderOptions({
|
|
2463
2806
|
provider: "anthropic",
|
|
2464
2807
|
providerOptions: providerMetadata,
|
|
2465
2808
|
schema: anthropicFilePartProviderOptions
|
|
2466
2809
|
});
|
|
2467
|
-
return
|
|
2810
|
+
return anthropicOptions?.citations?.enabled ?? false;
|
|
2468
2811
|
}
|
|
2469
2812
|
async function shouldUseContainerUpload(providerMetadata) {
|
|
2470
|
-
var _a2;
|
|
2471
2813
|
const anthropicOptions = await parseProviderOptions({
|
|
2472
2814
|
provider: "anthropic",
|
|
2473
2815
|
providerOptions: providerMetadata,
|
|
2474
2816
|
schema: anthropicFilePartProviderOptions
|
|
2475
2817
|
});
|
|
2476
|
-
return
|
|
2818
|
+
return anthropicOptions?.containerUpload ?? false;
|
|
2477
2819
|
}
|
|
2478
2820
|
async function getDocumentMetadata(providerMetadata) {
|
|
2479
2821
|
const anthropicOptions = await parseProviderOptions({
|
|
@@ -2482,8 +2824,8 @@ async function convertToAnthropicPrompt({
|
|
|
2482
2824
|
schema: anthropicFilePartProviderOptions
|
|
2483
2825
|
});
|
|
2484
2826
|
return {
|
|
2485
|
-
title: anthropicOptions
|
|
2486
|
-
context: anthropicOptions
|
|
2827
|
+
title: anthropicOptions?.title,
|
|
2828
|
+
context: anthropicOptions?.context
|
|
2487
2829
|
};
|
|
2488
2830
|
}
|
|
2489
2831
|
for (let i = 0; i < blocks.length; i++) {
|
|
@@ -2499,9 +2841,9 @@ async function convertToAnthropicPrompt({
|
|
|
2499
2841
|
providerOptions,
|
|
2500
2842
|
schema: anthropicSystemMessageProviderOptions
|
|
2501
2843
|
});
|
|
2502
|
-
const toolChanges =
|
|
2844
|
+
const toolChanges = systemMessageOptions?.toolChanges ?? [];
|
|
2503
2845
|
const content = [];
|
|
2504
|
-
if (text !== "" || toolChanges.length === 0 &&
|
|
2846
|
+
if (text !== "" || toolChanges.length === 0 && systemMessageOptions?.clearAt == null && systemMessageOptions?.effort == null) {
|
|
2505
2847
|
content.push({
|
|
2506
2848
|
type: "text",
|
|
2507
2849
|
text,
|
|
@@ -2522,8 +2864,8 @@ async function convertToAnthropicPrompt({
|
|
|
2522
2864
|
}
|
|
2523
2865
|
convertedMessages.push({
|
|
2524
2866
|
content,
|
|
2525
|
-
clearAt: systemMessageOptions
|
|
2526
|
-
effort: systemMessageOptions
|
|
2867
|
+
clearAt: systemMessageOptions?.clearAt,
|
|
2868
|
+
effort: systemMessageOptions?.effort,
|
|
2527
2869
|
toolChangeCount: toolChanges.length
|
|
2528
2870
|
});
|
|
2529
2871
|
}
|
|
@@ -2542,10 +2884,17 @@ async function convertToAnthropicPrompt({
|
|
|
2542
2884
|
});
|
|
2543
2885
|
}
|
|
2544
2886
|
for (const message of convertedMessages) {
|
|
2545
|
-
if (message.clearAt
|
|
2887
|
+
if (message.content.length === 0 && message.clearAt == null && message.effort != null) {
|
|
2888
|
+
messages.push({
|
|
2889
|
+
role: "system",
|
|
2890
|
+
content: [],
|
|
2891
|
+
output_config: { effort: message.effort }
|
|
2892
|
+
});
|
|
2893
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
2894
|
+
} else if (message.clearAt != null || message.effort != null) {
|
|
2546
2895
|
warnings.push({
|
|
2547
2896
|
type: "other",
|
|
2548
|
-
message: "clearAt and effort on
|
|
2897
|
+
message: "clearAt and effort on this initial system message are not supported by Anthropic. Use a separate effort-only system message with empty content to set effort. These options have been ignored."
|
|
2549
2898
|
});
|
|
2550
2899
|
}
|
|
2551
2900
|
}
|
|
@@ -2572,7 +2921,7 @@ async function convertToAnthropicPrompt({
|
|
|
2572
2921
|
betas.add("mid-conversation-system-clear-at-2026-08-21");
|
|
2573
2922
|
}
|
|
2574
2923
|
if (message.effort != null) {
|
|
2575
|
-
betas.add("mid-conversation-
|
|
2924
|
+
betas.add("mid-conversation-output-config-2026-07-01");
|
|
2576
2925
|
}
|
|
2577
2926
|
}
|
|
2578
2927
|
}
|
|
@@ -2584,16 +2933,19 @@ async function convertToAnthropicPrompt({
|
|
|
2584
2933
|
const { role, content } = message;
|
|
2585
2934
|
switch (role) {
|
|
2586
2935
|
case "user": {
|
|
2936
|
+
if (content.length > 0) {
|
|
2937
|
+
lastUserMessageIndex = messages.length;
|
|
2938
|
+
}
|
|
2587
2939
|
for (let j = 0; j < content.length; j++) {
|
|
2588
2940
|
const part = content[j];
|
|
2589
2941
|
const isLastPart = j === content.length - 1;
|
|
2590
|
-
const cacheControl =
|
|
2942
|
+
const cacheControl = validator.getCacheControl(part.providerOptions, {
|
|
2591
2943
|
type: "user message part",
|
|
2592
2944
|
canCache: true
|
|
2593
|
-
})
|
|
2945
|
+
}) ?? (isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
2594
2946
|
type: "user message",
|
|
2595
2947
|
canCache: true
|
|
2596
|
-
}) : void 0;
|
|
2948
|
+
}) : void 0);
|
|
2597
2949
|
switch (part.type) {
|
|
2598
2950
|
case "text": {
|
|
2599
2951
|
anthropicContent.push({
|
|
@@ -2645,7 +2997,7 @@ async function convertToAnthropicPrompt({
|
|
|
2645
2997
|
media_type: "text/plain",
|
|
2646
2998
|
data: part.data.text
|
|
2647
2999
|
},
|
|
2648
|
-
title:
|
|
3000
|
+
title: metadata.title ?? part.filename,
|
|
2649
3001
|
...metadata.context && {
|
|
2650
3002
|
context: metadata.context
|
|
2651
3003
|
},
|
|
@@ -2690,7 +3042,7 @@ async function convertToAnthropicPrompt({
|
|
|
2690
3042
|
media_type: "application/pdf",
|
|
2691
3043
|
data: convertToBase64(part.data.data)
|
|
2692
3044
|
},
|
|
2693
|
-
title:
|
|
3045
|
+
title: metadata.title ?? part.filename,
|
|
2694
3046
|
...metadata.context && {
|
|
2695
3047
|
context: metadata.context
|
|
2696
3048
|
},
|
|
@@ -2718,7 +3070,7 @@ async function convertToAnthropicPrompt({
|
|
|
2718
3070
|
part.data.data
|
|
2719
3071
|
)
|
|
2720
3072
|
},
|
|
2721
|
-
title:
|
|
3073
|
+
title: metadata.title ?? part.filename,
|
|
2722
3074
|
...metadata.context && {
|
|
2723
3075
|
context: metadata.context
|
|
2724
3076
|
},
|
|
@@ -2748,25 +3100,24 @@ async function convertToAnthropicPrompt({
|
|
|
2748
3100
|
continue;
|
|
2749
3101
|
}
|
|
2750
3102
|
const output = part.output;
|
|
2751
|
-
const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ?
|
|
3103
|
+
const outputProviderOptions = "providerOptions" in output ? output.providerOptions : output.type === "content" ? output.value.find(
|
|
2752
3104
|
(contentPart) => contentPart.providerOptions != null
|
|
2753
|
-
)
|
|
3105
|
+
)?.providerOptions : void 0;
|
|
2754
3106
|
const isLastPart = i2 === content.length - 1;
|
|
2755
|
-
const cacheControl =
|
|
3107
|
+
const cacheControl = validator.getCacheControl(part.providerOptions, {
|
|
2756
3108
|
type: "tool result part",
|
|
2757
3109
|
canCache: true
|
|
2758
|
-
})
|
|
3110
|
+
}) ?? validator.getCacheControl(outputProviderOptions, {
|
|
2759
3111
|
type: "tool result output",
|
|
2760
3112
|
canCache: true
|
|
2761
|
-
})
|
|
3113
|
+
}) ?? (isLastPart ? validator.getCacheControl(message.providerOptions, {
|
|
2762
3114
|
type: "tool result message",
|
|
2763
3115
|
canCache: true
|
|
2764
|
-
}) : void 0;
|
|
3116
|
+
}) : void 0);
|
|
2765
3117
|
let contentValue;
|
|
2766
3118
|
switch (output.type) {
|
|
2767
3119
|
case "content":
|
|
2768
3120
|
contentValue = output.value.map((contentPart) => {
|
|
2769
|
-
var _a2;
|
|
2770
3121
|
switch (contentPart.type) {
|
|
2771
3122
|
case "text":
|
|
2772
3123
|
return {
|
|
@@ -2836,8 +3187,8 @@ async function convertToAnthropicPrompt({
|
|
|
2836
3187
|
return void 0;
|
|
2837
3188
|
}
|
|
2838
3189
|
case "custom": {
|
|
2839
|
-
const anthropicOptions =
|
|
2840
|
-
if (
|
|
3190
|
+
const anthropicOptions = contentPart.providerOptions?.anthropic;
|
|
3191
|
+
if (anthropicOptions?.type === "tool-reference") {
|
|
2841
3192
|
return {
|
|
2842
3193
|
type: "tool_reference",
|
|
2843
3194
|
tool_name: anthropicOptions.toolName
|
|
@@ -2864,7 +3215,7 @@ async function convertToAnthropicPrompt({
|
|
|
2864
3215
|
contentValue = output.value;
|
|
2865
3216
|
break;
|
|
2866
3217
|
case "execution-denied":
|
|
2867
|
-
contentValue =
|
|
3218
|
+
contentValue = output.reason ?? "Tool call execution denied.";
|
|
2868
3219
|
break;
|
|
2869
3220
|
case "json":
|
|
2870
3221
|
case "error-json":
|
|
@@ -2872,9 +3223,15 @@ async function convertToAnthropicPrompt({
|
|
|
2872
3223
|
contentValue = JSON.stringify(output.value);
|
|
2873
3224
|
break;
|
|
2874
3225
|
}
|
|
3226
|
+
const toolsetName = getAnthropicToolsetName({
|
|
3227
|
+
toolName: part.toolName,
|
|
3228
|
+
providerOptions: part.providerOptions,
|
|
3229
|
+
toolsetNames
|
|
3230
|
+
});
|
|
2875
3231
|
anthropicContent.push({
|
|
2876
3232
|
type: "tool_result",
|
|
2877
3233
|
tool_use_id: part.toolCallId,
|
|
3234
|
+
...toolsetName != null && { toolset_name: toolsetName },
|
|
2878
3235
|
content: contentValue,
|
|
2879
3236
|
is_error: output.type === "error-text" || output.type === "error-json" ? true : void 0,
|
|
2880
3237
|
cache_control: cacheControl
|
|
@@ -2901,20 +3258,29 @@ async function convertToAnthropicPrompt({
|
|
|
2901
3258
|
for (let k = 0; k < content.length; k++) {
|
|
2902
3259
|
const part = content[k];
|
|
2903
3260
|
const isLastContentPart = k === content.length - 1;
|
|
2904
|
-
const cacheControl =
|
|
3261
|
+
const cacheControl = validator.getCacheControl(part.providerOptions, {
|
|
2905
3262
|
type: "assistant message part",
|
|
2906
3263
|
canCache: true
|
|
2907
|
-
})
|
|
3264
|
+
}) ?? (isLastContentPart ? validator.getCacheControl(message.providerOptions, {
|
|
2908
3265
|
type: "assistant message",
|
|
2909
3266
|
canCache: true
|
|
2910
|
-
}) : void 0;
|
|
3267
|
+
}) : void 0);
|
|
2911
3268
|
switch (part.type) {
|
|
2912
3269
|
case "text": {
|
|
2913
|
-
const textMetadata =
|
|
2914
|
-
if (
|
|
3270
|
+
const textMetadata = part.providerOptions?.anthropic;
|
|
3271
|
+
if (textMetadata?.type === "compaction") {
|
|
3272
|
+
if (part.text === "") {
|
|
3273
|
+
break;
|
|
3274
|
+
}
|
|
3275
|
+
if (typeof textMetadata.signature === "string") {
|
|
3276
|
+
betas.add("compact-2026-09-04");
|
|
3277
|
+
}
|
|
2915
3278
|
anthropicContent.push({
|
|
2916
3279
|
type: "compaction",
|
|
2917
3280
|
content: part.text,
|
|
3281
|
+
...typeof textMetadata.signature === "string" && {
|
|
3282
|
+
signature: textMetadata.signature
|
|
3283
|
+
},
|
|
2918
3284
|
cache_control: cacheControl
|
|
2919
3285
|
});
|
|
2920
3286
|
} else {
|
|
@@ -2926,7 +3292,7 @@ async function convertToAnthropicPrompt({
|
|
|
2926
3292
|
// in pre-filled assistant responses
|
|
2927
3293
|
isLastBlock && isLastMessage && isLastContentPart ? part.text.trim() : part.text
|
|
2928
3294
|
),
|
|
2929
|
-
...
|
|
3295
|
+
...textMetadata?.citations != null && {
|
|
2930
3296
|
citations: textMetadata.citations
|
|
2931
3297
|
},
|
|
2932
3298
|
cache_control: cacheControl
|
|
@@ -2987,10 +3353,10 @@ async function convertToAnthropicPrompt({
|
|
|
2987
3353
|
const providerToolName = toolNameMapping.toProviderToolName(
|
|
2988
3354
|
part.toolName
|
|
2989
3355
|
);
|
|
2990
|
-
const isMcpToolUse =
|
|
3356
|
+
const isMcpToolUse = part.providerOptions?.anthropic?.type === "mcp-tool-use";
|
|
2991
3357
|
if (isMcpToolUse) {
|
|
2992
3358
|
mcpToolUseIds.add(part.toolCallId);
|
|
2993
|
-
const serverName =
|
|
3359
|
+
const serverName = part.providerOptions?.anthropic?.serverName;
|
|
2994
3360
|
if (serverName == null || typeof serverName !== "string") {
|
|
2995
3361
|
warnings.push({
|
|
2996
3362
|
type: "other",
|
|
@@ -3072,6 +3438,33 @@ async function convertToAnthropicPrompt({
|
|
|
3072
3438
|
}
|
|
3073
3439
|
break;
|
|
3074
3440
|
}
|
|
3441
|
+
const toolsetName = getAnthropicToolsetName({
|
|
3442
|
+
toolName: part.toolName,
|
|
3443
|
+
providerOptions: part.providerOptions,
|
|
3444
|
+
toolsetNames
|
|
3445
|
+
});
|
|
3446
|
+
if (toolsetName != null) {
|
|
3447
|
+
const { action, ...memberInput } = toAnthropicToolInput(
|
|
3448
|
+
part.input
|
|
3449
|
+
);
|
|
3450
|
+
if (typeof action !== "string") {
|
|
3451
|
+
warnings.push({
|
|
3452
|
+
type: "other",
|
|
3453
|
+
message: `toolset tool call for tool ${part.toolName} is missing the action`
|
|
3454
|
+
});
|
|
3455
|
+
break;
|
|
3456
|
+
}
|
|
3457
|
+
anthropicContent.push({
|
|
3458
|
+
type: "tool_use",
|
|
3459
|
+
id: part.toolCallId,
|
|
3460
|
+
name: action,
|
|
3461
|
+
toolset_name: toolsetName,
|
|
3462
|
+
input: memberInput,
|
|
3463
|
+
...caller && { caller },
|
|
3464
|
+
cache_control: cacheControl
|
|
3465
|
+
});
|
|
3466
|
+
break;
|
|
3467
|
+
}
|
|
3075
3468
|
anthropicContent.push({
|
|
3076
3469
|
type: "tool_use",
|
|
3077
3470
|
id: part.toolCallId,
|
|
@@ -3113,7 +3506,7 @@ async function convertToAnthropicPrompt({
|
|
|
3113
3506
|
} else if (typeof output.value === "object" && output.value !== null) {
|
|
3114
3507
|
errorInfo = output.value;
|
|
3115
3508
|
}
|
|
3116
|
-
} catch
|
|
3509
|
+
} catch {
|
|
3117
3510
|
}
|
|
3118
3511
|
if (errorInfo.type === "code_execution_tool_result_error") {
|
|
3119
3512
|
anthropicContent.push({
|
|
@@ -3121,7 +3514,7 @@ async function convertToAnthropicPrompt({
|
|
|
3121
3514
|
tool_use_id: part.toolCallId,
|
|
3122
3515
|
content: {
|
|
3123
3516
|
type: "code_execution_tool_result_error",
|
|
3124
|
-
error_code:
|
|
3517
|
+
error_code: errorInfo.errorCode ?? "unknown"
|
|
3125
3518
|
},
|
|
3126
3519
|
cache_control: cacheControl
|
|
3127
3520
|
});
|
|
@@ -3132,7 +3525,7 @@ async function convertToAnthropicPrompt({
|
|
|
3132
3525
|
cache_control: cacheControl,
|
|
3133
3526
|
content: {
|
|
3134
3527
|
type: "bash_code_execution_tool_result_error",
|
|
3135
|
-
error_code:
|
|
3528
|
+
error_code: errorInfo.errorCode ?? "unknown"
|
|
3136
3529
|
}
|
|
3137
3530
|
});
|
|
3138
3531
|
}
|
|
@@ -3165,7 +3558,7 @@ async function convertToAnthropicPrompt({
|
|
|
3165
3558
|
stdout: codeExecutionOutput.stdout,
|
|
3166
3559
|
stderr: codeExecutionOutput.stderr,
|
|
3167
3560
|
return_code: codeExecutionOutput.return_code,
|
|
3168
|
-
content:
|
|
3561
|
+
content: codeExecutionOutput.content ?? []
|
|
3169
3562
|
},
|
|
3170
3563
|
cache_control: cacheControl
|
|
3171
3564
|
});
|
|
@@ -3183,7 +3576,7 @@ async function convertToAnthropicPrompt({
|
|
|
3183
3576
|
encrypted_stdout: codeExecutionOutput.encrypted_stdout,
|
|
3184
3577
|
stderr: codeExecutionOutput.stderr,
|
|
3185
3578
|
return_code: codeExecutionOutput.return_code,
|
|
3186
|
-
content:
|
|
3579
|
+
content: codeExecutionOutput.content ?? []
|
|
3187
3580
|
},
|
|
3188
3581
|
cache_control: cacheControl
|
|
3189
3582
|
});
|
|
@@ -3202,7 +3595,7 @@ async function convertToAnthropicPrompt({
|
|
|
3202
3595
|
stdout: codeExecutionOutput.stdout,
|
|
3203
3596
|
stderr: codeExecutionOutput.stderr,
|
|
3204
3597
|
return_code: codeExecutionOutput.return_code,
|
|
3205
|
-
content:
|
|
3598
|
+
content: codeExecutionOutput.content ?? []
|
|
3206
3599
|
},
|
|
3207
3600
|
cache_control: cacheControl
|
|
3208
3601
|
});
|
|
@@ -3240,7 +3633,7 @@ async function convertToAnthropicPrompt({
|
|
|
3240
3633
|
tool_use_id: part.toolCallId,
|
|
3241
3634
|
content: {
|
|
3242
3635
|
type: "web_fetch_tool_result_error",
|
|
3243
|
-
error_code:
|
|
3636
|
+
error_code: extractErrorValue(output.value).errorCode ?? "unavailable"
|
|
3244
3637
|
},
|
|
3245
3638
|
...caller && { caller },
|
|
3246
3639
|
cache_control: cacheControl
|
|
@@ -3289,7 +3682,7 @@ async function convertToAnthropicPrompt({
|
|
|
3289
3682
|
tool_use_id: part.toolCallId,
|
|
3290
3683
|
content: {
|
|
3291
3684
|
type: "web_search_tool_result_error",
|
|
3292
|
-
error_code:
|
|
3685
|
+
error_code: extractErrorValue(output.value).errorCode ?? "unavailable"
|
|
3293
3686
|
},
|
|
3294
3687
|
...caller && { caller },
|
|
3295
3688
|
cache_control: cacheControl
|
|
@@ -3411,10 +3804,12 @@ async function convertToAnthropicPrompt({
|
|
|
3411
3804
|
}
|
|
3412
3805
|
}
|
|
3413
3806
|
}
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3807
|
+
if (anthropicContent.length > 0) {
|
|
3808
|
+
messages.push({
|
|
3809
|
+
role: "assistant",
|
|
3810
|
+
content: moveToolUseBlocksToEnd(anthropicContent)
|
|
3811
|
+
});
|
|
3812
|
+
}
|
|
3418
3813
|
break;
|
|
3419
3814
|
}
|
|
3420
3815
|
default: {
|
|
@@ -3423,6 +3818,42 @@ async function convertToAnthropicPrompt({
|
|
|
3423
3818
|
}
|
|
3424
3819
|
}
|
|
3425
3820
|
}
|
|
3821
|
+
const codeExecutionToolCallIds = /* @__PURE__ */ new Set();
|
|
3822
|
+
for (const message of messages) {
|
|
3823
|
+
if (message.role !== "assistant") {
|
|
3824
|
+
continue;
|
|
3825
|
+
}
|
|
3826
|
+
for (const part of message.content) {
|
|
3827
|
+
if (part.type === "server_tool_use" && part.name === "code_execution") {
|
|
3828
|
+
codeExecutionToolCallIds.add(part.id);
|
|
3829
|
+
}
|
|
3830
|
+
}
|
|
3831
|
+
}
|
|
3832
|
+
const warnedToolCallIds = /* @__PURE__ */ new Set();
|
|
3833
|
+
for (let i = 0; i < lastUserMessageIndex; i++) {
|
|
3834
|
+
const message = messages[i];
|
|
3835
|
+
if (message.role !== "assistant") {
|
|
3836
|
+
continue;
|
|
3837
|
+
}
|
|
3838
|
+
for (const part of message.content) {
|
|
3839
|
+
if (!("caller" in part)) {
|
|
3840
|
+
continue;
|
|
3841
|
+
}
|
|
3842
|
+
const caller = part.caller;
|
|
3843
|
+
if (caller == null || caller.type === "direct" || codeExecutionToolCallIds.has(caller.tool_id)) {
|
|
3844
|
+
continue;
|
|
3845
|
+
}
|
|
3846
|
+
const toolCallId = "id" in part ? part.id : part.tool_use_id;
|
|
3847
|
+
delete part.caller;
|
|
3848
|
+
if (!warnedToolCallIds.has(toolCallId)) {
|
|
3849
|
+
warnedToolCallIds.add(toolCallId);
|
|
3850
|
+
warnings.push({
|
|
3851
|
+
type: "other",
|
|
3852
|
+
message: `Omitted caller metadata for tool ${toolCallId} because source code execution tool ${caller.tool_id} is missing from the conversation history.`
|
|
3853
|
+
});
|
|
3854
|
+
}
|
|
3855
|
+
}
|
|
3856
|
+
}
|
|
3426
3857
|
return {
|
|
3427
3858
|
prompt: { system, messages },
|
|
3428
3859
|
betas
|
|
@@ -3435,7 +3866,7 @@ function groupIntoBlocks(prompt) {
|
|
|
3435
3866
|
const { role } = message;
|
|
3436
3867
|
switch (role) {
|
|
3437
3868
|
case "system": {
|
|
3438
|
-
if (
|
|
3869
|
+
if (currentBlock?.type !== "system") {
|
|
3439
3870
|
currentBlock = { type: "system", messages: [] };
|
|
3440
3871
|
blocks.push(currentBlock);
|
|
3441
3872
|
}
|
|
@@ -3443,7 +3874,7 @@ function groupIntoBlocks(prompt) {
|
|
|
3443
3874
|
break;
|
|
3444
3875
|
}
|
|
3445
3876
|
case "assistant": {
|
|
3446
|
-
if (
|
|
3877
|
+
if (currentBlock?.type !== "assistant") {
|
|
3447
3878
|
currentBlock = { type: "assistant", messages: [] };
|
|
3448
3879
|
blocks.push(currentBlock);
|
|
3449
3880
|
}
|
|
@@ -3451,7 +3882,7 @@ function groupIntoBlocks(prompt) {
|
|
|
3451
3882
|
break;
|
|
3452
3883
|
}
|
|
3453
3884
|
case "user": {
|
|
3454
|
-
if (
|
|
3885
|
+
if (currentBlock?.type !== "user") {
|
|
3455
3886
|
currentBlock = { type: "user", messages: [] };
|
|
3456
3887
|
blocks.push(currentBlock);
|
|
3457
3888
|
}
|
|
@@ -3459,7 +3890,7 @@ function groupIntoBlocks(prompt) {
|
|
|
3459
3890
|
break;
|
|
3460
3891
|
}
|
|
3461
3892
|
case "tool": {
|
|
3462
|
-
if (
|
|
3893
|
+
if (currentBlock?.type !== "user") {
|
|
3463
3894
|
currentBlock = { type: "user", messages: [] };
|
|
3464
3895
|
blocks.push(currentBlock);
|
|
3465
3896
|
}
|
|
@@ -3495,16 +3926,27 @@ function moveToolUseBlocksToEnd(content) {
|
|
|
3495
3926
|
flushSegment();
|
|
3496
3927
|
return result;
|
|
3497
3928
|
}
|
|
3929
|
+
function getAnthropicToolsetName({
|
|
3930
|
+
toolName,
|
|
3931
|
+
providerOptions,
|
|
3932
|
+
toolsetNames
|
|
3933
|
+
}) {
|
|
3934
|
+
const fromTools = toolsetNames[toolName];
|
|
3935
|
+
if (fromTools != null) {
|
|
3936
|
+
return fromTools;
|
|
3937
|
+
}
|
|
3938
|
+
const fromMetadata = providerOptions?.anthropic?.toolsetName;
|
|
3939
|
+
return typeof fromMetadata === "string" ? fromMetadata : void 0;
|
|
3940
|
+
}
|
|
3498
3941
|
function getAnthropicCaller(providerOptions) {
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
if (((caller == null ? void 0 : caller.type) === "code_execution_20250825" || (caller == null ? void 0 : caller.type) === "code_execution_20260120") && caller.toolId) {
|
|
3942
|
+
const caller = providerOptions?.anthropic?.caller;
|
|
3943
|
+
if ((caller?.type === "code_execution_20250825" || caller?.type === "code_execution_20260120") && caller.toolId) {
|
|
3502
3944
|
return {
|
|
3503
3945
|
type: caller.type,
|
|
3504
3946
|
tool_id: caller.toolId
|
|
3505
3947
|
};
|
|
3506
3948
|
}
|
|
3507
|
-
return
|
|
3949
|
+
return caller?.type === "direct" ? { type: "direct" } : void 0;
|
|
3508
3950
|
}
|
|
3509
3951
|
function toAnthropicToolInput(input) {
|
|
3510
3952
|
return typeof input === "object" && input !== null && !Array.isArray(input) ? input : { rawInvalidInput: input };
|
|
@@ -3680,14 +4122,13 @@ function formatConstraintValue(value) {
|
|
|
3680
4122
|
|
|
3681
4123
|
// src/anthropic-language-model.ts
|
|
3682
4124
|
function createAnthropicStreamError(error) {
|
|
3683
|
-
var _a, _b, _c;
|
|
3684
4125
|
const inferredMetadata = getAnthropicStreamErrorMetadata(error.type);
|
|
3685
4126
|
return createProviderStreamError({
|
|
3686
4127
|
message: error.message,
|
|
3687
4128
|
type: error.type,
|
|
3688
|
-
code:
|
|
3689
|
-
statusCode:
|
|
3690
|
-
isRetryable:
|
|
4129
|
+
code: error.code ?? void 0,
|
|
4130
|
+
statusCode: error.statusCode ?? inferredMetadata.statusCode,
|
|
4131
|
+
isRetryable: error.isRetryable ?? inferredMetadata.isRetryable,
|
|
3691
4132
|
data: "data" in error ? error.data : error
|
|
3692
4133
|
});
|
|
3693
4134
|
}
|
|
@@ -3715,14 +4156,13 @@ function getAnthropicStreamErrorMetadata(type) {
|
|
|
3715
4156
|
}
|
|
3716
4157
|
}
|
|
3717
4158
|
function createCitationSource(citation, citationDocuments, generateId4) {
|
|
3718
|
-
var _a, _b;
|
|
3719
4159
|
if (citation.type === "web_search_result_location") {
|
|
3720
4160
|
return {
|
|
3721
4161
|
type: "source",
|
|
3722
4162
|
sourceType: "url",
|
|
3723
4163
|
id: generateId4(),
|
|
3724
4164
|
url: citation.url,
|
|
3725
|
-
title:
|
|
4165
|
+
title: citation.title ?? void 0,
|
|
3726
4166
|
providerMetadata: {
|
|
3727
4167
|
anthropic: {
|
|
3728
4168
|
citedText: citation.cited_text,
|
|
@@ -3743,7 +4183,7 @@ function createCitationSource(citation, citationDocuments, generateId4) {
|
|
|
3743
4183
|
sourceType: "document",
|
|
3744
4184
|
id: generateId4(),
|
|
3745
4185
|
mediaType: documentInfo.mediaType,
|
|
3746
|
-
title:
|
|
4186
|
+
title: citation.document_title ?? documentInfo.title,
|
|
3747
4187
|
filename: documentInfo.filename,
|
|
3748
4188
|
providerMetadata: {
|
|
3749
4189
|
anthropic: citation.type === "page_location" ? {
|
|
@@ -3768,6 +4208,24 @@ function getAnthropicCallerMetadata(caller) {
|
|
|
3768
4208
|
const callerInfo = getAnthropicCallerInfo(caller);
|
|
3769
4209
|
return callerInfo == null ? {} : { providerMetadata: { anthropic: { caller: callerInfo } } };
|
|
3770
4210
|
}
|
|
4211
|
+
function getAnthropicToolsetNames(tools) {
|
|
4212
|
+
const toolsetNames = {};
|
|
4213
|
+
for (const tool of tools ?? []) {
|
|
4214
|
+
if (tool.type === "provider" && tool.id === "anthropic.computer_toolset_20260801") {
|
|
4215
|
+
toolsetNames[tool.name] = "computer";
|
|
4216
|
+
}
|
|
4217
|
+
}
|
|
4218
|
+
return toolsetNames;
|
|
4219
|
+
}
|
|
4220
|
+
function toToolsetMemberInput({
|
|
4221
|
+
memberName,
|
|
4222
|
+
input
|
|
4223
|
+
}) {
|
|
4224
|
+
return {
|
|
4225
|
+
action: memberName,
|
|
4226
|
+
...typeof input === "object" && input !== null && !Array.isArray(input) ? input : {}
|
|
4227
|
+
};
|
|
4228
|
+
}
|
|
3771
4229
|
function getProviderOptionsName(provider) {
|
|
3772
4230
|
const dotIndex = provider.indexOf(".");
|
|
3773
4231
|
return dotIndex === -1 ? provider : provider.substring(0, dotIndex);
|
|
@@ -3775,10 +4233,9 @@ function getProviderOptionsName(provider) {
|
|
|
3775
4233
|
var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
3776
4234
|
constructor(modelId, config) {
|
|
3777
4235
|
this.specificationVersion = "v4";
|
|
3778
|
-
var _a;
|
|
3779
4236
|
this.modelId = modelId;
|
|
3780
4237
|
this.config = config;
|
|
3781
|
-
this.generateId =
|
|
4238
|
+
this.generateId = config.generateId ?? generateId;
|
|
3782
4239
|
}
|
|
3783
4240
|
static [WORKFLOW_SERIALIZE](model) {
|
|
3784
4241
|
return serializeModelOptions({
|
|
@@ -3796,8 +4253,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3796
4253
|
return this.config.provider;
|
|
3797
4254
|
}
|
|
3798
4255
|
get supportedUrls() {
|
|
3799
|
-
|
|
3800
|
-
return (_c = (_b = (_a = this.config).supportedUrls) == null ? void 0 : _b.call(_a)) != null ? _c : {};
|
|
4256
|
+
return this.config.supportedUrls?.() ?? {};
|
|
3801
4257
|
}
|
|
3802
4258
|
static async prepareRequest({
|
|
3803
4259
|
modelId,
|
|
@@ -3821,7 +4277,6 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3821
4277
|
stream
|
|
3822
4278
|
}
|
|
3823
4279
|
}) {
|
|
3824
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
3825
4280
|
const warnings = [];
|
|
3826
4281
|
if (frequencyPenalty != null) {
|
|
3827
4282
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3847,7 +4302,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3847
4302
|
});
|
|
3848
4303
|
temperature = 0;
|
|
3849
4304
|
}
|
|
3850
|
-
if (
|
|
4305
|
+
if (responseFormat?.type === "json") {
|
|
3851
4306
|
if (responseFormat.schema == null) {
|
|
3852
4307
|
warnings.push({
|
|
3853
4308
|
type: "unsupported",
|
|
@@ -3870,8 +4325,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3870
4325
|
const usedCustomProviderKey = customProviderOptions != null;
|
|
3871
4326
|
const anthropicOptions = Object.assign(
|
|
3872
4327
|
{},
|
|
3873
|
-
canonicalOptions
|
|
3874
|
-
customProviderOptions
|
|
4328
|
+
canonicalOptions ?? {},
|
|
4329
|
+
customProviderOptions ?? {}
|
|
3875
4330
|
);
|
|
3876
4331
|
const {
|
|
3877
4332
|
maxOutputTokens: maxOutputTokensForModel,
|
|
@@ -3880,6 +4335,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3880
4335
|
rejectsSamplingParameters,
|
|
3881
4336
|
supportsXhighEffort,
|
|
3882
4337
|
rejectsThinkingDisabledAboveHighEffort,
|
|
4338
|
+
rejectsThinkingDisabled,
|
|
4339
|
+
rejectsForcedToolUse,
|
|
4340
|
+
supportsBetweenToolsThinking,
|
|
3883
4341
|
isKnownModel
|
|
3884
4342
|
} = getModelCapabilities(modelId);
|
|
3885
4343
|
if (!isKnownModel && maxOutputTokens == null) {
|
|
@@ -3916,24 +4374,39 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3916
4374
|
}
|
|
3917
4375
|
}
|
|
3918
4376
|
const isAnthropicModel = isKnownModel || modelId.includes("claude-");
|
|
3919
|
-
const supportsStructuredOutput = (
|
|
3920
|
-
const supportsStrictTools = (
|
|
3921
|
-
const structureOutputMode =
|
|
3922
|
-
|
|
3923
|
-
|
|
4377
|
+
const supportsStructuredOutput = (config.supportsNativeStructuredOutput ?? true) && modelSupportsStructuredOutput;
|
|
4378
|
+
const supportsStrictTools = (config.supportsStrictTools ?? true) && modelSupportsStructuredOutput;
|
|
4379
|
+
const structureOutputMode = anthropicOptions?.structuredOutputMode ?? "auto";
|
|
4380
|
+
let useStructuredOutput = structureOutputMode === "outputFormat" || structureOutputMode === "auto" && supportsStructuredOutput;
|
|
4381
|
+
if (!useStructuredOutput && rejectsForcedToolUse && supportsStructuredOutput && responseFormat?.type === "json" && responseFormat.schema != null) {
|
|
4382
|
+
warnings.push({
|
|
4383
|
+
type: "unsupported",
|
|
4384
|
+
feature: "providerOptions.anthropic.structuredOutputMode",
|
|
4385
|
+
details: `structuredOutputMode 'jsonTool' is not supported by ${modelId} because it rejects forced tool use. Using 'outputFormat' instead.`
|
|
4386
|
+
});
|
|
4387
|
+
useStructuredOutput = true;
|
|
4388
|
+
}
|
|
4389
|
+
const jsonResponseTool = responseFormat?.type === "json" && responseFormat.schema != null && !useStructuredOutput ? {
|
|
3924
4390
|
type: "function",
|
|
3925
4391
|
name: "json",
|
|
3926
4392
|
description: "Respond with a JSON object.",
|
|
3927
4393
|
inputSchema: responseFormat.schema
|
|
3928
4394
|
} : void 0;
|
|
3929
|
-
if (jsonResponseTool != null &&
|
|
4395
|
+
if (jsonResponseTool != null && anthropicOptions?.disableParallelToolUse === false) {
|
|
3930
4396
|
warnings.push({
|
|
3931
4397
|
type: "unsupported",
|
|
3932
4398
|
feature: "providerOptions.anthropic.disableParallelToolUse",
|
|
3933
4399
|
details: "`disableParallelToolUse: false` is ignored when using the JSON response tool. Parallel tool use is disabled to ensure a single coherent JSON tool call."
|
|
3934
4400
|
});
|
|
3935
4401
|
}
|
|
3936
|
-
const contextManagement = anthropicOptions
|
|
4402
|
+
const contextManagement = anthropicOptions?.contextManagement;
|
|
4403
|
+
const compaction = anthropicOptions?.compaction;
|
|
4404
|
+
if (contextManagement != null && compaction != null) {
|
|
4405
|
+
throw new InvalidArgumentError({
|
|
4406
|
+
argument: "providerOptions",
|
|
4407
|
+
message: "Anthropic provider options `compaction` and `contextManagement` cannot be used together."
|
|
4408
|
+
});
|
|
4409
|
+
}
|
|
3937
4410
|
const cacheControlValidator = new CacheControlValidator();
|
|
3938
4411
|
const toolNameMapping = createToolNameMapping({
|
|
3939
4412
|
tools,
|
|
@@ -3943,6 +4416,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3943
4416
|
"anthropic.code_execution_20260120": "code_execution",
|
|
3944
4417
|
"anthropic.computer_20241022": "computer",
|
|
3945
4418
|
"anthropic.computer_20250124": "computer",
|
|
4419
|
+
"anthropic.computer_20251124": "computer",
|
|
4420
|
+
"anthropic.computer_toolset_20260801": "computer",
|
|
3946
4421
|
"anthropic.text_editor_20241022": "str_replace_editor",
|
|
3947
4422
|
"anthropic.text_editor_20250124": "str_replace_editor",
|
|
3948
4423
|
"anthropic.text_editor_20250429": "str_replace_based_edit_tool",
|
|
@@ -3952,25 +4427,32 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3952
4427
|
"anthropic.memory_20250818": "memory",
|
|
3953
4428
|
"anthropic.web_search_20250305": "web_search",
|
|
3954
4429
|
"anthropic.web_search_20260209": "web_search",
|
|
4430
|
+
"anthropic.web_search_20260318": "web_search",
|
|
3955
4431
|
"anthropic.web_fetch_20250910": "web_fetch",
|
|
3956
4432
|
"anthropic.web_fetch_20260209": "web_fetch",
|
|
4433
|
+
"anthropic.web_fetch_20260318": "web_fetch",
|
|
3957
4434
|
"anthropic.tool_search_regex_20251119": "tool_search_tool_regex",
|
|
3958
4435
|
"anthropic.tool_search_bm25_20251119": "tool_search_tool_bm25",
|
|
3959
4436
|
"anthropic.advisor_20260301": "advisor"
|
|
3960
4437
|
}
|
|
3961
4438
|
});
|
|
4439
|
+
const toolsetNames = getAnthropicToolsetNames(tools);
|
|
3962
4440
|
const { prompt: messagesPrompt, betas } = await convertToAnthropicPrompt({
|
|
3963
4441
|
prompt,
|
|
3964
|
-
sendReasoning:
|
|
4442
|
+
sendReasoning: anthropicOptions?.sendReasoning ?? true,
|
|
3965
4443
|
warnings,
|
|
3966
4444
|
cacheControlValidator,
|
|
3967
|
-
toolNameMapping
|
|
4445
|
+
toolNameMapping,
|
|
4446
|
+
toolsetNames
|
|
3968
4447
|
});
|
|
3969
|
-
if (isCustomReasoning(reasoning) &&
|
|
4448
|
+
if (isCustomReasoning(reasoning) && anthropicOptions?.effort == null) {
|
|
3970
4449
|
const reasoningConfig = resolveAnthropicReasoningConfig({
|
|
3971
4450
|
reasoning,
|
|
4451
|
+
modelId,
|
|
3972
4452
|
supportsAdaptiveThinking,
|
|
3973
4453
|
supportsXhighEffort,
|
|
4454
|
+
rejectsThinkingDisabled,
|
|
4455
|
+
supportsBetweenToolsThinking,
|
|
3974
4456
|
maxOutputTokensForModel,
|
|
3975
4457
|
warnings
|
|
3976
4458
|
});
|
|
@@ -3978,12 +4460,37 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3978
4460
|
if (anthropicOptions.thinking == null) {
|
|
3979
4461
|
anthropicOptions.thinking = reasoningConfig.thinking;
|
|
3980
4462
|
}
|
|
3981
|
-
if (reasoningConfig.effort != null &&
|
|
4463
|
+
if (reasoningConfig.effort != null && anthropicOptions.thinking?.type !== "disabled") {
|
|
3982
4464
|
anthropicOptions.effort = reasoningConfig.effort;
|
|
3983
4465
|
}
|
|
3984
4466
|
}
|
|
3985
4467
|
}
|
|
3986
|
-
if (
|
|
4468
|
+
if (rejectsThinkingDisabled && anthropicOptions?.thinking != null) {
|
|
4469
|
+
const thinking = anthropicOptions.thinking;
|
|
4470
|
+
if (thinking.type === "disabled" && supportsBetweenToolsThinking) {
|
|
4471
|
+
warnings.push({
|
|
4472
|
+
type: "unsupported",
|
|
4473
|
+
feature: "providerOptions.anthropic.thinking",
|
|
4474
|
+
details: `thinking cannot be disabled for ${modelId}. Using 'between_tools' thinking, the lowest thinking setting, instead.`
|
|
4475
|
+
});
|
|
4476
|
+
anthropicOptions.thinking = { type: "between_tools" };
|
|
4477
|
+
} else if (thinking.type === "disabled") {
|
|
4478
|
+
warnings.push({
|
|
4479
|
+
type: "unsupported",
|
|
4480
|
+
feature: "providerOptions.anthropic.thinking",
|
|
4481
|
+
details: `thinking cannot be disabled for ${modelId}; it always uses adaptive thinking. The thinking setting has been removed. Lower 'effort' to reduce thinking.`
|
|
4482
|
+
});
|
|
4483
|
+
anthropicOptions.thinking = void 0;
|
|
4484
|
+
} else if (thinking.type === "enabled") {
|
|
4485
|
+
warnings.push({
|
|
4486
|
+
type: "unsupported",
|
|
4487
|
+
feature: "providerOptions.anthropic.thinking",
|
|
4488
|
+
details: `budget-based thinking is not supported by ${modelId}; it always uses adaptive thinking. Using adaptive thinking instead. Use 'effort' to control how much the model thinks.`
|
|
4489
|
+
});
|
|
4490
|
+
anthropicOptions.thinking = { type: "adaptive" };
|
|
4491
|
+
}
|
|
4492
|
+
}
|
|
4493
|
+
if (rejectsThinkingDisabledAboveHighEffort && anthropicOptions?.thinking?.type === "disabled" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
3987
4494
|
warnings.push({
|
|
3988
4495
|
type: "unsupported",
|
|
3989
4496
|
feature: "providerOptions.anthropic.effort",
|
|
@@ -3991,13 +4498,21 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
3991
4498
|
});
|
|
3992
4499
|
anthropicOptions.effort = "high";
|
|
3993
4500
|
}
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
4501
|
+
if (anthropicOptions?.thinking?.type === "between_tools" && (anthropicOptions.effort === "xhigh" || anthropicOptions.effort === "max")) {
|
|
4502
|
+
warnings.push({
|
|
4503
|
+
type: "unsupported",
|
|
4504
|
+
feature: "providerOptions.anthropic.effort",
|
|
4505
|
+
details: `effort '${anthropicOptions.effort}' is not supported with 'between_tools' thinking. The effort has been lowered to 'high'.`
|
|
4506
|
+
});
|
|
4507
|
+
anthropicOptions.effort = "high";
|
|
4508
|
+
}
|
|
4509
|
+
const thinkingType = anthropicOptions?.thinking?.type;
|
|
4510
|
+
const isThinking = thinkingType === "enabled" || thinkingType === "adaptive" || thinkingType === "between_tools";
|
|
4511
|
+
const thinkingBlockBinding = anthropicOptions?.thinking != null && "blockBinding" in anthropicOptions.thinking ? anthropicOptions.thinking.blockBinding : void 0;
|
|
3997
4512
|
const sendThinking = isThinking || thinkingType === "disabled" || thinkingBlockBinding != null;
|
|
3998
|
-
let thinkingBudget = thinkingType === "enabled" ?
|
|
3999
|
-
const thinkingDisplay = thinkingType === "adaptive" ?
|
|
4000
|
-
const maxTokens = maxOutputTokens
|
|
4513
|
+
let thinkingBudget = thinkingType === "enabled" ? anthropicOptions?.thinking?.budgetTokens : void 0;
|
|
4514
|
+
const thinkingDisplay = thinkingType === "adaptive" ? anthropicOptions?.thinking?.display : void 0;
|
|
4515
|
+
const maxTokens = maxOutputTokens ?? maxOutputTokensForModel;
|
|
4001
4516
|
const baseArgs = {
|
|
4002
4517
|
// model id:
|
|
4003
4518
|
model: modelId,
|
|
@@ -4020,12 +4535,12 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4020
4535
|
}
|
|
4021
4536
|
}
|
|
4022
4537
|
},
|
|
4023
|
-
...(
|
|
4538
|
+
...(anthropicOptions?.effort || anthropicOptions?.taskBudget || useStructuredOutput && responseFormat?.type === "json" && responseFormat.schema != null) && {
|
|
4024
4539
|
output_config: {
|
|
4025
|
-
...
|
|
4540
|
+
...anthropicOptions?.effort && {
|
|
4026
4541
|
effort: anthropicOptions.effort
|
|
4027
4542
|
},
|
|
4028
|
-
...
|
|
4543
|
+
...anthropicOptions?.taskBudget && {
|
|
4029
4544
|
task_budget: {
|
|
4030
4545
|
type: anthropicOptions.taskBudget.type,
|
|
4031
4546
|
total: anthropicOptions.taskBudget.total,
|
|
@@ -4034,7 +4549,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4034
4549
|
}
|
|
4035
4550
|
}
|
|
4036
4551
|
},
|
|
4037
|
-
...useStructuredOutput &&
|
|
4552
|
+
...useStructuredOutput && responseFormat?.type === "json" && responseFormat.schema != null && {
|
|
4038
4553
|
format: {
|
|
4039
4554
|
type: "json_schema",
|
|
4040
4555
|
schema: sanitizeJsonSchema(responseFormat.schema)
|
|
@@ -4042,26 +4557,26 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4042
4557
|
}
|
|
4043
4558
|
}
|
|
4044
4559
|
},
|
|
4045
|
-
...
|
|
4560
|
+
...anthropicOptions?.speed && {
|
|
4046
4561
|
speed: anthropicOptions.speed
|
|
4047
4562
|
},
|
|
4048
|
-
...
|
|
4563
|
+
...anthropicOptions?.serviceTier && {
|
|
4049
4564
|
service_tier: anthropicOptions.serviceTier
|
|
4050
4565
|
},
|
|
4051
|
-
...
|
|
4566
|
+
...anthropicOptions?.inferenceGeo && {
|
|
4052
4567
|
inference_geo: anthropicOptions.inferenceGeo
|
|
4053
4568
|
},
|
|
4054
|
-
...
|
|
4569
|
+
...anthropicOptions?.fallbacks != null && (anthropicOptions.fallbacks === "default" || anthropicOptions.fallbacks.length > 0) && {
|
|
4055
4570
|
fallbacks: anthropicOptions.fallbacks
|
|
4056
4571
|
},
|
|
4057
|
-
...
|
|
4572
|
+
...anthropicOptions?.cacheControl && {
|
|
4058
4573
|
cache_control: anthropicOptions.cacheControl
|
|
4059
4574
|
},
|
|
4060
|
-
...
|
|
4575
|
+
...anthropicOptions?.metadata?.userId != null && {
|
|
4061
4576
|
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
4062
4577
|
},
|
|
4063
4578
|
// mcp servers:
|
|
4064
|
-
...
|
|
4579
|
+
...anthropicOptions?.mcpServers && anthropicOptions.mcpServers.length > 0 && {
|
|
4065
4580
|
mcp_servers: anthropicOptions.mcpServers.map((server) => ({
|
|
4066
4581
|
type: server.type,
|
|
4067
4582
|
name: server.name,
|
|
@@ -4074,7 +4589,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4074
4589
|
}))
|
|
4075
4590
|
},
|
|
4076
4591
|
// container: For programmatic tool calling (just an ID string) or agent skills (object with id and skills)
|
|
4077
|
-
...
|
|
4592
|
+
...anthropicOptions?.container && {
|
|
4078
4593
|
container: anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0 ? (
|
|
4079
4594
|
// Object format when skills are provided (agent skills feature)
|
|
4080
4595
|
{
|
|
@@ -4096,6 +4611,22 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4096
4611
|
// prompt:
|
|
4097
4612
|
system: messagesPrompt.system,
|
|
4098
4613
|
messages: messagesPrompt.messages,
|
|
4614
|
+
...anthropicOptions?.safeguards && anthropicOptions.safeguards.length > 0 && {
|
|
4615
|
+
safeguards: anthropicOptions.safeguards.map((safeguard) => ({
|
|
4616
|
+
type: safeguard.type,
|
|
4617
|
+
...safeguard.classifierContext !== void 0 && {
|
|
4618
|
+
classifier_context: safeguard.classifierContext
|
|
4619
|
+
}
|
|
4620
|
+
}))
|
|
4621
|
+
},
|
|
4622
|
+
...compaction && {
|
|
4623
|
+
compaction: {
|
|
4624
|
+
type: compaction.type,
|
|
4625
|
+
...compaction.instructions !== void 0 && {
|
|
4626
|
+
instructions: compaction.instructions
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
},
|
|
4099
4630
|
...contextManagement && {
|
|
4100
4631
|
context_management: {
|
|
4101
4632
|
edits: contextManagement.edits.map((edit) => {
|
|
@@ -4184,7 +4715,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4184
4715
|
details: "topP is not supported when thinking is enabled"
|
|
4185
4716
|
});
|
|
4186
4717
|
}
|
|
4187
|
-
baseArgs.max_tokens = maxTokens + (thinkingBudget
|
|
4718
|
+
baseArgs.max_tokens = maxTokens + (thinkingBudget ?? 0);
|
|
4188
4719
|
} else {
|
|
4189
4720
|
if (isAnthropicModel && topP != null && temperature != null) {
|
|
4190
4721
|
warnings.push({
|
|
@@ -4205,32 +4736,38 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4205
4736
|
}
|
|
4206
4737
|
baseArgs.max_tokens = maxOutputTokensForModel;
|
|
4207
4738
|
}
|
|
4208
|
-
if (
|
|
4739
|
+
if (anthropicOptions?.mcpServers && anthropicOptions.mcpServers.length > 0) {
|
|
4209
4740
|
betas.add("mcp-client-2025-04-04");
|
|
4210
4741
|
}
|
|
4742
|
+
if (anthropicOptions?.safeguards && anthropicOptions.safeguards.length > 0) {
|
|
4743
|
+
betas.add("dangerous-tool-use-2026-09-03");
|
|
4744
|
+
}
|
|
4745
|
+
if (compaction) {
|
|
4746
|
+
betas.add("compact-2026-09-04");
|
|
4747
|
+
}
|
|
4211
4748
|
if (contextManagement) {
|
|
4212
4749
|
betas.add("context-management-2025-06-27");
|
|
4213
4750
|
if (contextManagement.edits.some((e) => e.type === "compact_20260112")) {
|
|
4214
4751
|
betas.add("compact-2026-01-12");
|
|
4215
4752
|
}
|
|
4216
4753
|
}
|
|
4217
|
-
if (
|
|
4754
|
+
if (anthropicOptions?.container && anthropicOptions.container.skills && anthropicOptions.container.skills.length > 0) {
|
|
4218
4755
|
betas.add("code-execution-2025-08-25");
|
|
4219
4756
|
betas.add("skills-2025-10-02");
|
|
4220
4757
|
betas.add("files-api-2025-04-14");
|
|
4221
|
-
if (!
|
|
4758
|
+
if (!tools?.some(
|
|
4222
4759
|
(tool) => tool.type === "provider" && (tool.id === "anthropic.code_execution_20250825" || tool.id === "anthropic.code_execution_20260120")
|
|
4223
|
-
))
|
|
4760
|
+
)) {
|
|
4224
4761
|
warnings.push({
|
|
4225
4762
|
type: "other",
|
|
4226
4763
|
message: "code execution tool is required when using skills"
|
|
4227
4764
|
});
|
|
4228
4765
|
}
|
|
4229
4766
|
}
|
|
4230
|
-
if (anthropicOptions
|
|
4767
|
+
if (anthropicOptions?.taskBudget) {
|
|
4231
4768
|
betas.add("task-budgets-2026-03-13");
|
|
4232
4769
|
}
|
|
4233
|
-
if (
|
|
4770
|
+
if (anthropicOptions?.speed === "fast") {
|
|
4234
4771
|
betas.add("fast-mode-2026-02-01");
|
|
4235
4772
|
}
|
|
4236
4773
|
if (thinkingDisplay === "updates") {
|
|
@@ -4239,12 +4776,12 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4239
4776
|
if (thinkingBlockBinding != null) {
|
|
4240
4777
|
betas.add("thinking-binding-controls-2026-08-01");
|
|
4241
4778
|
}
|
|
4242
|
-
if (
|
|
4779
|
+
if (anthropicOptions?.fallbacks === "default") {
|
|
4243
4780
|
betas.add("server-side-fallback-2026-07-01");
|
|
4244
|
-
} else if (
|
|
4781
|
+
} else if (anthropicOptions?.fallbacks && anthropicOptions.fallbacks.length > 0) {
|
|
4245
4782
|
betas.add("server-side-fallback-2026-06-01");
|
|
4246
4783
|
}
|
|
4247
|
-
const defaultEagerInputStreaming = stream && (
|
|
4784
|
+
const defaultEagerInputStreaming = stream && (anthropicOptions?.toolStreaming ?? true);
|
|
4248
4785
|
const {
|
|
4249
4786
|
tools: anthropicTools2,
|
|
4250
4787
|
toolChoice: anthropicToolChoice,
|
|
@@ -4252,21 +4789,23 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4252
4789
|
betas: toolsBetas
|
|
4253
4790
|
} = await prepareTools(
|
|
4254
4791
|
jsonResponseTool != null ? {
|
|
4255
|
-
tools: [...tools
|
|
4792
|
+
tools: [...tools ?? [], jsonResponseTool],
|
|
4256
4793
|
toolChoice: { type: "required" },
|
|
4257
4794
|
disableParallelToolUse: true,
|
|
4258
4795
|
cacheControlValidator,
|
|
4259
4796
|
supportsStructuredOutput: false,
|
|
4260
4797
|
supportsStrictTools,
|
|
4261
|
-
defaultEagerInputStreaming
|
|
4798
|
+
defaultEagerInputStreaming,
|
|
4799
|
+
rejectsForcedToolUse
|
|
4262
4800
|
} : {
|
|
4263
|
-
tools: tools
|
|
4801
|
+
tools: tools ?? [],
|
|
4264
4802
|
toolChoice,
|
|
4265
|
-
disableParallelToolUse: anthropicOptions
|
|
4803
|
+
disableParallelToolUse: anthropicOptions?.disableParallelToolUse,
|
|
4266
4804
|
cacheControlValidator,
|
|
4267
4805
|
supportsStructuredOutput,
|
|
4268
4806
|
supportsStrictTools,
|
|
4269
|
-
defaultEagerInputStreaming
|
|
4807
|
+
defaultEagerInputStreaming,
|
|
4808
|
+
rejectsForcedToolUse
|
|
4270
4809
|
}
|
|
4271
4810
|
);
|
|
4272
4811
|
const cacheWarnings = cacheControlValidator.getWarnings();
|
|
@@ -4283,7 +4822,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4283
4822
|
...betas,
|
|
4284
4823
|
...toolsBetas,
|
|
4285
4824
|
...userSuppliedBetas,
|
|
4286
|
-
...
|
|
4825
|
+
...anthropicOptions?.anthropicBeta ?? []
|
|
4287
4826
|
]),
|
|
4288
4827
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
4289
4828
|
toolNameMapping,
|
|
@@ -4309,10 +4848,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4309
4848
|
);
|
|
4310
4849
|
}
|
|
4311
4850
|
async getBetasFromHeaders(requestHeaders) {
|
|
4312
|
-
var _a, _b;
|
|
4313
4851
|
const configHeaders = this.config.headers ? await resolve(this.config.headers) : void 0;
|
|
4314
|
-
const configBetaHeader =
|
|
4315
|
-
const requestBetaHeader =
|
|
4852
|
+
const configBetaHeader = configHeaders?.["anthropic-beta"] ?? "";
|
|
4853
|
+
const requestBetaHeader = requestHeaders?.["anthropic-beta"] ?? "";
|
|
4316
4854
|
return new Set(
|
|
4317
4855
|
[
|
|
4318
4856
|
...configBetaHeader.toLowerCase().split(","),
|
|
@@ -4321,38 +4859,33 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4321
4859
|
);
|
|
4322
4860
|
}
|
|
4323
4861
|
buildRequestUrl(isStreaming) {
|
|
4324
|
-
|
|
4325
|
-
return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
|
|
4862
|
+
return this.config.buildRequestUrl?.(this.config.baseURL, isStreaming) ?? `${this.config.baseURL}/messages`;
|
|
4326
4863
|
}
|
|
4327
4864
|
transformRequestBody(args, betas) {
|
|
4328
|
-
|
|
4329
|
-
return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
|
|
4865
|
+
return this.config.transformRequestBody?.(args, betas) ?? args;
|
|
4330
4866
|
}
|
|
4331
4867
|
extractCitationDocuments(prompt) {
|
|
4332
4868
|
const isCitationPart = (part) => {
|
|
4333
|
-
var _a, _b;
|
|
4334
4869
|
if (part.type !== "file") {
|
|
4335
4870
|
return false;
|
|
4336
4871
|
}
|
|
4337
4872
|
if (part.mediaType !== "application/pdf" && part.mediaType !== "text/plain") {
|
|
4338
4873
|
return false;
|
|
4339
4874
|
}
|
|
4340
|
-
const anthropic2 =
|
|
4341
|
-
const citationsConfig = anthropic2
|
|
4342
|
-
return
|
|
4875
|
+
const anthropic2 = part.providerOptions?.anthropic;
|
|
4876
|
+
const citationsConfig = anthropic2?.citations;
|
|
4877
|
+
return citationsConfig?.enabled ?? false;
|
|
4343
4878
|
};
|
|
4344
4879
|
return prompt.filter((message) => message.role === "user").flatMap((message) => message.content).filter(isCitationPart).map((part) => {
|
|
4345
|
-
var _a;
|
|
4346
4880
|
const filePart = part;
|
|
4347
4881
|
return {
|
|
4348
|
-
title:
|
|
4882
|
+
title: filePart.filename ?? "Untitled Document",
|
|
4349
4883
|
filename: filePart.filename,
|
|
4350
4884
|
mediaType: filePart.mediaType
|
|
4351
4885
|
};
|
|
4352
4886
|
});
|
|
4353
4887
|
}
|
|
4354
4888
|
async doGenerate(options) {
|
|
4355
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
4356
4889
|
const {
|
|
4357
4890
|
args,
|
|
4358
4891
|
warnings,
|
|
@@ -4369,9 +4902,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4369
4902
|
const citationDocuments = [
|
|
4370
4903
|
...this.extractCitationDocuments(options.prompt)
|
|
4371
4904
|
];
|
|
4372
|
-
const markCodeExecutionDynamic =
|
|
4373
|
-
args.tools
|
|
4374
|
-
);
|
|
4905
|
+
const markCodeExecutionDynamic = hasDynamicFilteringWebToolWithoutCodeExecution(args.tools);
|
|
4375
4906
|
const {
|
|
4376
4907
|
responseHeaders,
|
|
4377
4908
|
value: response,
|
|
@@ -4395,7 +4926,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4395
4926
|
switch (part.type) {
|
|
4396
4927
|
case "text": {
|
|
4397
4928
|
if (!usesJsonResponseTool) {
|
|
4398
|
-
const webSearchCitations =
|
|
4929
|
+
const webSearchCitations = part.citations?.filter(
|
|
4399
4930
|
(citation) => citation.type === "web_search_result_location"
|
|
4400
4931
|
);
|
|
4401
4932
|
content.push({
|
|
@@ -4457,12 +4988,18 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4457
4988
|
break;
|
|
4458
4989
|
}
|
|
4459
4990
|
case "compaction": {
|
|
4991
|
+
if (!part.content) {
|
|
4992
|
+
break;
|
|
4993
|
+
}
|
|
4460
4994
|
content.push({
|
|
4461
4995
|
type: "text",
|
|
4462
4996
|
text: part.content,
|
|
4463
4997
|
providerMetadata: {
|
|
4464
4998
|
anthropic: {
|
|
4465
|
-
type: "compaction"
|
|
4999
|
+
type: "compaction",
|
|
5000
|
+
...part.signature != null && {
|
|
5001
|
+
signature: part.signature
|
|
5002
|
+
}
|
|
4466
5003
|
}
|
|
4467
5004
|
}
|
|
4468
5005
|
});
|
|
@@ -4476,6 +5013,24 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4476
5013
|
type: "text",
|
|
4477
5014
|
text: JSON.stringify(part.input)
|
|
4478
5015
|
});
|
|
5016
|
+
} else if (part.toolset_name != null) {
|
|
5017
|
+
content.push({
|
|
5018
|
+
type: "tool-call",
|
|
5019
|
+
toolCallId: part.id,
|
|
5020
|
+
toolName: toolNameMapping.toCustomToolName(part.toolset_name),
|
|
5021
|
+
input: JSON.stringify(
|
|
5022
|
+
toToolsetMemberInput({
|
|
5023
|
+
memberName: part.name,
|
|
5024
|
+
input: part.input
|
|
5025
|
+
})
|
|
5026
|
+
),
|
|
5027
|
+
providerMetadata: {
|
|
5028
|
+
anthropic: {
|
|
5029
|
+
toolsetName: part.toolset_name,
|
|
5030
|
+
...getAnthropicCallerMetadata(part.caller).providerMetadata?.anthropic
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
});
|
|
4479
5034
|
} else {
|
|
4480
5035
|
content.push({
|
|
4481
5036
|
type: "tool-call",
|
|
@@ -4573,7 +5128,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4573
5128
|
case "web_fetch_tool_result": {
|
|
4574
5129
|
if (part.content.type === "web_fetch_result") {
|
|
4575
5130
|
citationDocuments.push({
|
|
4576
|
-
title:
|
|
5131
|
+
title: part.content.content.title ?? part.content.url,
|
|
4577
5132
|
mediaType: part.content.content.source.media_type
|
|
4578
5133
|
});
|
|
4579
5134
|
content.push({
|
|
@@ -4618,16 +5173,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4618
5173
|
type: "tool-result",
|
|
4619
5174
|
toolCallId: part.tool_use_id,
|
|
4620
5175
|
toolName: toolNameMapping.toCustomToolName("web_search"),
|
|
4621
|
-
result: part.content.map((result) => {
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
type: result.type
|
|
4629
|
-
};
|
|
4630
|
-
}),
|
|
5176
|
+
result: part.content.map((result) => ({
|
|
5177
|
+
url: result.url,
|
|
5178
|
+
...result.title != null ? { title: result.title } : {},
|
|
5179
|
+
pageAge: result.page_age ?? null,
|
|
5180
|
+
encryptedContent: result.encrypted_content,
|
|
5181
|
+
type: result.type
|
|
5182
|
+
})),
|
|
4631
5183
|
...getAnthropicCallerMetadata(part.caller)
|
|
4632
5184
|
});
|
|
4633
5185
|
for (const result of part.content) {
|
|
@@ -4639,7 +5191,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4639
5191
|
...result.title != null ? { title: result.title } : {},
|
|
4640
5192
|
providerMetadata: {
|
|
4641
5193
|
anthropic: {
|
|
4642
|
-
pageAge:
|
|
5194
|
+
pageAge: result.page_age ?? null
|
|
4643
5195
|
}
|
|
4644
5196
|
}
|
|
4645
5197
|
});
|
|
@@ -4671,7 +5223,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4671
5223
|
stdout: part.content.stdout,
|
|
4672
5224
|
stderr: part.content.stderr,
|
|
4673
5225
|
return_code: part.content.return_code,
|
|
4674
|
-
content:
|
|
5226
|
+
content: part.content.content ?? []
|
|
4675
5227
|
}
|
|
4676
5228
|
});
|
|
4677
5229
|
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
@@ -4684,7 +5236,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4684
5236
|
encrypted_stdout: part.content.encrypted_stdout,
|
|
4685
5237
|
stderr: part.content.stderr,
|
|
4686
5238
|
return_code: part.content.return_code,
|
|
4687
|
-
content:
|
|
5239
|
+
content: part.content.content ?? []
|
|
4688
5240
|
}
|
|
4689
5241
|
});
|
|
4690
5242
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -4812,25 +5364,25 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4812
5364
|
finishReason: response.stop_reason,
|
|
4813
5365
|
isJsonResponseFromTool
|
|
4814
5366
|
}),
|
|
4815
|
-
raw:
|
|
5367
|
+
raw: response.stop_reason ?? void 0
|
|
4816
5368
|
},
|
|
4817
5369
|
usage: convertAnthropicUsage({ usage: response.usage }),
|
|
4818
5370
|
request: { body: args },
|
|
4819
5371
|
response: {
|
|
4820
|
-
id:
|
|
4821
|
-
modelId:
|
|
5372
|
+
id: response.id ?? void 0,
|
|
5373
|
+
modelId: response.model ?? void 0,
|
|
4822
5374
|
headers: responseHeaders,
|
|
4823
5375
|
body: rawResponse
|
|
4824
5376
|
},
|
|
4825
5377
|
warnings,
|
|
4826
5378
|
providerMetadata: (() => {
|
|
4827
|
-
var _a2, _b2, _c2, _d2;
|
|
4828
5379
|
const stopDetails = mapAnthropicStopDetails(response.stop_details);
|
|
4829
5380
|
const anthropicMetadata = {
|
|
4830
5381
|
usage: response.usage,
|
|
4831
|
-
stopSequence:
|
|
5382
|
+
stopSequence: response.stop_sequence ?? null,
|
|
4832
5383
|
...stopDetails != null ? { stopDetails } : {},
|
|
4833
5384
|
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
5385
|
+
...response.safeguard_results != null ? { safeguardResults: response.safeguard_results } : {},
|
|
4834
5386
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
4835
5387
|
(iter) => ({
|
|
4836
5388
|
type: iter.type,
|
|
@@ -4848,15 +5400,15 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4848
5400
|
container: response.container ? {
|
|
4849
5401
|
expiresAt: response.container.expires_at,
|
|
4850
5402
|
id: response.container.id,
|
|
4851
|
-
skills:
|
|
5403
|
+
skills: response.container.skills?.map((skill) => ({
|
|
4852
5404
|
type: skill.type,
|
|
4853
5405
|
skillId: skill.skill_id,
|
|
4854
5406
|
version: skill.version
|
|
4855
|
-
}))
|
|
5407
|
+
})) ?? null
|
|
4856
5408
|
} : null,
|
|
4857
|
-
contextManagement:
|
|
5409
|
+
contextManagement: mapAnthropicResponseContextManagement(
|
|
4858
5410
|
response.context_management
|
|
4859
|
-
)
|
|
5411
|
+
) ?? null
|
|
4860
5412
|
};
|
|
4861
5413
|
const providerMetadata = {
|
|
4862
5414
|
anthropic: anthropicMetadata
|
|
@@ -4870,7 +5422,6 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4870
5422
|
}
|
|
4871
5423
|
async doStream(options) {
|
|
4872
5424
|
"use step";
|
|
4873
|
-
var _a, _b, _c, _d;
|
|
4874
5425
|
const {
|
|
4875
5426
|
args: body,
|
|
4876
5427
|
warnings,
|
|
@@ -4887,9 +5438,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4887
5438
|
const citationDocuments = [
|
|
4888
5439
|
...this.extractCitationDocuments(options.prompt)
|
|
4889
5440
|
];
|
|
4890
|
-
const markCodeExecutionDynamic =
|
|
4891
|
-
body.tools
|
|
4892
|
-
);
|
|
5441
|
+
const markCodeExecutionDynamic = hasDynamicFilteringWebToolWithoutCodeExecution(body.tools);
|
|
4893
5442
|
const url = this.buildRequestUrl(true);
|
|
4894
5443
|
const { responseHeaders, value: response } = await postJsonToApi({
|
|
4895
5444
|
url,
|
|
@@ -4919,6 +5468,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4919
5468
|
let stopSequence = null;
|
|
4920
5469
|
let stopDetails = void 0;
|
|
4921
5470
|
let inputTransformations;
|
|
5471
|
+
let safeguardResults;
|
|
4922
5472
|
let container = null;
|
|
4923
5473
|
let isJsonResponseFromTool = false;
|
|
4924
5474
|
let isMessageOpen = false;
|
|
@@ -4932,7 +5482,6 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
4932
5482
|
controller.enqueue({ type: "stream-start", warnings });
|
|
4933
5483
|
},
|
|
4934
5484
|
transform(chunk, controller) {
|
|
4935
|
-
var _a2, _b2, _c2, _d2, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
4936
5485
|
if (hasInvalidMessageSequence) {
|
|
4937
5486
|
return;
|
|
4938
5487
|
}
|
|
@@ -5001,10 +5550,20 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5001
5550
|
id: String(value.index),
|
|
5002
5551
|
providerMetadata: {
|
|
5003
5552
|
anthropic: {
|
|
5004
|
-
type: "compaction"
|
|
5553
|
+
type: "compaction",
|
|
5554
|
+
...part.signature != null && {
|
|
5555
|
+
signature: part.signature
|
|
5556
|
+
}
|
|
5005
5557
|
}
|
|
5006
5558
|
}
|
|
5007
5559
|
});
|
|
5560
|
+
if (part.signature != null && part.content != null && part.content !== "") {
|
|
5561
|
+
controller.enqueue({
|
|
5562
|
+
type: "text-delta",
|
|
5563
|
+
id: String(value.index),
|
|
5564
|
+
delta: part.content
|
|
5565
|
+
});
|
|
5566
|
+
}
|
|
5008
5567
|
return;
|
|
5009
5568
|
}
|
|
5010
5569
|
case "tool_use": {
|
|
@@ -5019,6 +5578,29 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5019
5578
|
type: "text-start",
|
|
5020
5579
|
id: String(value.index)
|
|
5021
5580
|
});
|
|
5581
|
+
} else if (part.toolset_name != null) {
|
|
5582
|
+
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
5583
|
+
const customToolName = toolNameMapping.toCustomToolName(
|
|
5584
|
+
part.toolset_name
|
|
5585
|
+
);
|
|
5586
|
+
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
5587
|
+
contentBlocks[value.index] = {
|
|
5588
|
+
type: "tool-call",
|
|
5589
|
+
toolCallId: part.id,
|
|
5590
|
+
toolName: customToolName,
|
|
5591
|
+
input: hasNonEmptyInput ? JSON.stringify(part.input) : "",
|
|
5592
|
+
firstDelta: true,
|
|
5593
|
+
toolset: {
|
|
5594
|
+
name: part.toolset_name,
|
|
5595
|
+
memberName: part.name
|
|
5596
|
+
},
|
|
5597
|
+
...callerInfo && { caller: callerInfo }
|
|
5598
|
+
};
|
|
5599
|
+
controller.enqueue({
|
|
5600
|
+
type: "tool-input-start",
|
|
5601
|
+
id: part.id,
|
|
5602
|
+
toolName: customToolName
|
|
5603
|
+
});
|
|
5022
5604
|
} else {
|
|
5023
5605
|
const callerInfo = getAnthropicCallerInfo(part.caller);
|
|
5024
5606
|
const hasNonEmptyInput = part.input && Object.keys(part.input).length > 0;
|
|
@@ -5127,7 +5709,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5127
5709
|
case "web_fetch_tool_result": {
|
|
5128
5710
|
if (part.content.type === "web_fetch_result") {
|
|
5129
5711
|
citationDocuments.push({
|
|
5130
|
-
title:
|
|
5712
|
+
title: part.content.content.title ?? part.content.url,
|
|
5131
5713
|
mediaType: part.content.content.source.media_type
|
|
5132
5714
|
});
|
|
5133
5715
|
controller.enqueue({
|
|
@@ -5172,16 +5754,13 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5172
5754
|
type: "tool-result",
|
|
5173
5755
|
toolCallId: part.tool_use_id,
|
|
5174
5756
|
toolName: toolNameMapping.toCustomToolName("web_search"),
|
|
5175
|
-
result: part.content.map((result) => {
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
type: result.type
|
|
5183
|
-
};
|
|
5184
|
-
}),
|
|
5757
|
+
result: part.content.map((result) => ({
|
|
5758
|
+
url: result.url,
|
|
5759
|
+
...result.title != null ? { title: result.title } : {},
|
|
5760
|
+
pageAge: result.page_age ?? null,
|
|
5761
|
+
encryptedContent: result.encrypted_content,
|
|
5762
|
+
type: result.type
|
|
5763
|
+
})),
|
|
5185
5764
|
...getAnthropicCallerMetadata(part.caller)
|
|
5186
5765
|
});
|
|
5187
5766
|
for (const result of part.content) {
|
|
@@ -5193,7 +5772,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5193
5772
|
...result.title != null ? { title: result.title } : {},
|
|
5194
5773
|
providerMetadata: {
|
|
5195
5774
|
anthropic: {
|
|
5196
|
-
pageAge:
|
|
5775
|
+
pageAge: result.page_age ?? null
|
|
5197
5776
|
}
|
|
5198
5777
|
}
|
|
5199
5778
|
});
|
|
@@ -5225,7 +5804,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5225
5804
|
stdout: part.content.stdout,
|
|
5226
5805
|
stderr: part.content.stderr,
|
|
5227
5806
|
return_code: part.content.return_code,
|
|
5228
|
-
content:
|
|
5807
|
+
content: part.content.content ?? []
|
|
5229
5808
|
}
|
|
5230
5809
|
});
|
|
5231
5810
|
} else if (part.content.type === "encrypted_code_execution_result") {
|
|
@@ -5238,7 +5817,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5238
5817
|
encrypted_stdout: part.content.encrypted_stdout,
|
|
5239
5818
|
stderr: part.content.stderr,
|
|
5240
5819
|
return_code: part.content.return_code,
|
|
5241
|
-
content:
|
|
5820
|
+
content: part.content.content ?? []
|
|
5242
5821
|
}
|
|
5243
5822
|
});
|
|
5244
5823
|
} else if (part.content.type === "code_execution_tool_result_error") {
|
|
@@ -5418,6 +5997,25 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5418
5997
|
case "tool-call":
|
|
5419
5998
|
const isJsonResponseTool = usesJsonResponseTool && contentBlock.toolName === "json";
|
|
5420
5999
|
if (!isJsonResponseTool) {
|
|
6000
|
+
if (contentBlock.toolset != null) {
|
|
6001
|
+
let memberInput = {};
|
|
6002
|
+
try {
|
|
6003
|
+
memberInput = contentBlock.input === "" ? {} : secureJsonParse2(contentBlock.input);
|
|
6004
|
+
} catch {
|
|
6005
|
+
memberInput = void 0;
|
|
6006
|
+
}
|
|
6007
|
+
contentBlock.input = memberInput === void 0 ? contentBlock.input : JSON.stringify(
|
|
6008
|
+
toToolsetMemberInput({
|
|
6009
|
+
memberName: contentBlock.toolset.memberName,
|
|
6010
|
+
input: memberInput
|
|
6011
|
+
})
|
|
6012
|
+
);
|
|
6013
|
+
controller.enqueue({
|
|
6014
|
+
type: "tool-input-delta",
|
|
6015
|
+
id: contentBlock.toolCallId,
|
|
6016
|
+
delta: contentBlock.input
|
|
6017
|
+
});
|
|
6018
|
+
}
|
|
5421
6019
|
controller.enqueue({
|
|
5422
6020
|
type: "tool-input-end",
|
|
5423
6021
|
id: contentBlock.toolCallId
|
|
@@ -5432,7 +6030,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5432
6030
|
...parsed
|
|
5433
6031
|
});
|
|
5434
6032
|
}
|
|
5435
|
-
} catch
|
|
6033
|
+
} catch {
|
|
5436
6034
|
}
|
|
5437
6035
|
}
|
|
5438
6036
|
controller.enqueue({
|
|
@@ -5446,10 +6044,15 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5446
6044
|
// tool was not explicitly provided. We therefore bypass the general validation by marking the
|
|
5447
6045
|
// tool as dynamic.
|
|
5448
6046
|
...markCodeExecutionDynamic && contentBlock.providerToolName === "code_execution" ? { dynamic: true } : {},
|
|
5449
|
-
...contentBlock.caller && {
|
|
6047
|
+
...(contentBlock.caller || contentBlock.toolset) && {
|
|
5450
6048
|
providerMetadata: {
|
|
5451
6049
|
anthropic: {
|
|
5452
|
-
|
|
6050
|
+
...contentBlock.toolset && {
|
|
6051
|
+
toolsetName: contentBlock.toolset.name
|
|
6052
|
+
},
|
|
6053
|
+
...contentBlock.caller && {
|
|
6054
|
+
caller: contentBlock.caller
|
|
6055
|
+
}
|
|
5453
6056
|
}
|
|
5454
6057
|
}
|
|
5455
6058
|
}
|
|
@@ -5516,7 +6119,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5516
6119
|
return;
|
|
5517
6120
|
}
|
|
5518
6121
|
if (isJsonResponseFromTool) {
|
|
5519
|
-
if (
|
|
6122
|
+
if (contentBlock?.type !== "text") {
|
|
5520
6123
|
return;
|
|
5521
6124
|
}
|
|
5522
6125
|
controller.enqueue({
|
|
@@ -5525,7 +6128,11 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5525
6128
|
delta
|
|
5526
6129
|
});
|
|
5527
6130
|
} else {
|
|
5528
|
-
if (
|
|
6131
|
+
if (contentBlock?.type !== "tool-call") {
|
|
6132
|
+
return;
|
|
6133
|
+
}
|
|
6134
|
+
if (contentBlock.toolset != null) {
|
|
6135
|
+
contentBlock.input += delta;
|
|
5529
6136
|
return;
|
|
5530
6137
|
}
|
|
5531
6138
|
if (contentBlock.firstDelta && contentBlock.providerToolInputType != null) {
|
|
@@ -5544,7 +6151,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5544
6151
|
case "citations_delta": {
|
|
5545
6152
|
const citation = value.delta.citation;
|
|
5546
6153
|
const contentBlock = contentBlocks[value.index];
|
|
5547
|
-
if (
|
|
6154
|
+
if (contentBlock?.type === "text" && citation.type === "web_search_result_location") {
|
|
5548
6155
|
contentBlock.citations.push(citation);
|
|
5549
6156
|
}
|
|
5550
6157
|
const source = createCitationSource(
|
|
@@ -5583,8 +6190,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5583
6190
|
isMessageOpen = true;
|
|
5584
6191
|
activeMessageId = value.message.id;
|
|
5585
6192
|
usage.input_tokens = value.message.usage.input_tokens;
|
|
5586
|
-
usage.cache_read_input_tokens =
|
|
5587
|
-
usage.cache_creation_input_tokens =
|
|
6193
|
+
usage.cache_read_input_tokens = value.message.usage.cache_read_input_tokens ?? 0;
|
|
6194
|
+
usage.cache_creation_input_tokens = value.message.usage.cache_creation_input_tokens ?? 0;
|
|
5588
6195
|
rawUsage = {
|
|
5589
6196
|
...value.message.usage
|
|
5590
6197
|
};
|
|
@@ -5609,8 +6216,8 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5609
6216
|
}
|
|
5610
6217
|
controller.enqueue({
|
|
5611
6218
|
type: "response-metadata",
|
|
5612
|
-
id:
|
|
5613
|
-
modelId:
|
|
6219
|
+
id: value.message.id ?? void 0,
|
|
6220
|
+
modelId: value.message.model ?? void 0
|
|
5614
6221
|
});
|
|
5615
6222
|
if (value.message.content != null) {
|
|
5616
6223
|
for (let contentIndex = 0; contentIndex < value.message.content.length; contentIndex++) {
|
|
@@ -5622,7 +6229,7 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5622
6229
|
id: part.id,
|
|
5623
6230
|
toolName: part.name
|
|
5624
6231
|
});
|
|
5625
|
-
const inputStr = JSON.stringify(
|
|
6232
|
+
const inputStr = JSON.stringify(part.input ?? {});
|
|
5626
6233
|
controller.enqueue({
|
|
5627
6234
|
type: "tool-input-delta",
|
|
5628
6235
|
id: part.id,
|
|
@@ -5672,18 +6279,18 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5672
6279
|
finishReason: value.delta.stop_reason,
|
|
5673
6280
|
isJsonResponseFromTool
|
|
5674
6281
|
}),
|
|
5675
|
-
raw:
|
|
6282
|
+
raw: value.delta.stop_reason ?? void 0
|
|
5676
6283
|
};
|
|
5677
|
-
stopSequence =
|
|
6284
|
+
stopSequence = value.delta.stop_sequence ?? null;
|
|
5678
6285
|
stopDetails = mapAnthropicStopDetails(value.delta.stop_details);
|
|
5679
6286
|
container = value.delta.container != null ? {
|
|
5680
6287
|
expiresAt: value.delta.container.expires_at,
|
|
5681
6288
|
id: value.delta.container.id,
|
|
5682
|
-
skills:
|
|
6289
|
+
skills: value.delta.container.skills?.map((skill) => ({
|
|
5683
6290
|
type: skill.type,
|
|
5684
6291
|
skillId: skill.skill_id,
|
|
5685
6292
|
version: skill.version
|
|
5686
|
-
}))
|
|
6293
|
+
})) ?? null
|
|
5687
6294
|
} : null;
|
|
5688
6295
|
if (value.context_management) {
|
|
5689
6296
|
contextManagement = mapAnthropicResponseContextManagement(
|
|
@@ -5693,6 +6300,9 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5693
6300
|
if (value.input_transformations != null) {
|
|
5694
6301
|
inputTransformations = value.input_transformations;
|
|
5695
6302
|
}
|
|
6303
|
+
if (value.delta.safeguard_results != null) {
|
|
6304
|
+
safeguardResults = value.delta.safeguard_results;
|
|
6305
|
+
}
|
|
5696
6306
|
rawUsage = {
|
|
5697
6307
|
...rawUsage,
|
|
5698
6308
|
...value.usage
|
|
@@ -5703,10 +6313,11 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5703
6313
|
isMessageOpen = false;
|
|
5704
6314
|
activeMessageId = void 0;
|
|
5705
6315
|
const anthropicMetadata = {
|
|
5706
|
-
usage: rawUsage
|
|
6316
|
+
usage: rawUsage ?? null,
|
|
5707
6317
|
stopSequence,
|
|
5708
6318
|
...stopDetails != null ? { stopDetails } : {},
|
|
5709
6319
|
...inputTransformations != null ? { inputTransformations } : {},
|
|
6320
|
+
...safeguardResults != null ? { safeguardResults } : {},
|
|
5710
6321
|
iterations: usage.iterations ? usage.iterations.map(
|
|
5711
6322
|
(iter) => ({
|
|
5712
6323
|
type: iter.type,
|
|
@@ -5758,10 +6369,10 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5758
6369
|
try {
|
|
5759
6370
|
await firstChunkReader.read();
|
|
5760
6371
|
let result = await firstChunkReader.read();
|
|
5761
|
-
if (
|
|
6372
|
+
if (result.value?.type === "raw") {
|
|
5762
6373
|
result = await firstChunkReader.read();
|
|
5763
6374
|
}
|
|
5764
|
-
if (
|
|
6375
|
+
if (result.value?.type === "error") {
|
|
5765
6376
|
const error = result.value.error;
|
|
5766
6377
|
if (!isProviderStreamError(error)) {
|
|
5767
6378
|
throw new Error("Expected a normalized Anthropic stream error");
|
|
@@ -5770,10 +6381,10 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5770
6381
|
message: error.message,
|
|
5771
6382
|
url,
|
|
5772
6383
|
requestBodyValues: body,
|
|
5773
|
-
statusCode:
|
|
6384
|
+
statusCode: error.statusCode ?? 500,
|
|
5774
6385
|
responseHeaders,
|
|
5775
6386
|
responseBody: JSON.stringify(error.data),
|
|
5776
|
-
isRetryable:
|
|
6387
|
+
isRetryable: error.isRetryable ?? false
|
|
5777
6388
|
});
|
|
5778
6389
|
}
|
|
5779
6390
|
} finally {
|
|
@@ -5789,7 +6400,33 @@ var AnthropicLanguageModel = class _AnthropicLanguageModel {
|
|
|
5789
6400
|
}
|
|
5790
6401
|
};
|
|
5791
6402
|
function getModelCapabilities(modelId) {
|
|
5792
|
-
if (modelId.includes("claude-
|
|
6403
|
+
if (modelId.includes("claude-sonnet-5-5")) {
|
|
6404
|
+
return {
|
|
6405
|
+
maxOutputTokens: 128e3,
|
|
6406
|
+
supportsStructuredOutput: true,
|
|
6407
|
+
supportsAdaptiveThinking: true,
|
|
6408
|
+
rejectsSamplingParameters: true,
|
|
6409
|
+
supportsXhighEffort: true,
|
|
6410
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
6411
|
+
rejectsThinkingDisabled: true,
|
|
6412
|
+
rejectsForcedToolUse: true,
|
|
6413
|
+
supportsBetweenToolsThinking: true,
|
|
6414
|
+
isKnownModel: true
|
|
6415
|
+
};
|
|
6416
|
+
} else if (modelId.includes("claude-opus-5-5")) {
|
|
6417
|
+
return {
|
|
6418
|
+
maxOutputTokens: 128e3,
|
|
6419
|
+
supportsStructuredOutput: true,
|
|
6420
|
+
supportsAdaptiveThinking: true,
|
|
6421
|
+
rejectsSamplingParameters: true,
|
|
6422
|
+
supportsXhighEffort: true,
|
|
6423
|
+
rejectsThinkingDisabledAboveHighEffort: true,
|
|
6424
|
+
rejectsThinkingDisabled: true,
|
|
6425
|
+
rejectsForcedToolUse: true,
|
|
6426
|
+
supportsBetweenToolsThinking: false,
|
|
6427
|
+
isKnownModel: true
|
|
6428
|
+
};
|
|
6429
|
+
} else if (modelId.includes("claude-opus-5")) {
|
|
5793
6430
|
return {
|
|
5794
6431
|
maxOutputTokens: 128e3,
|
|
5795
6432
|
supportsStructuredOutput: true,
|
|
@@ -5797,9 +6434,38 @@ function getModelCapabilities(modelId) {
|
|
|
5797
6434
|
rejectsSamplingParameters: true,
|
|
5798
6435
|
supportsXhighEffort: true,
|
|
5799
6436
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
6437
|
+
rejectsThinkingDisabled: false,
|
|
6438
|
+
rejectsForcedToolUse: false,
|
|
6439
|
+
supportsBetweenToolsThinking: false,
|
|
6440
|
+
isKnownModel: true
|
|
6441
|
+
};
|
|
6442
|
+
} else if (modelId.includes("claude-fable-5-1")) {
|
|
6443
|
+
return {
|
|
6444
|
+
maxOutputTokens: 128e3,
|
|
6445
|
+
supportsStructuredOutput: true,
|
|
6446
|
+
supportsAdaptiveThinking: true,
|
|
6447
|
+
rejectsSamplingParameters: true,
|
|
6448
|
+
supportsXhighEffort: true,
|
|
6449
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6450
|
+
rejectsThinkingDisabled: true,
|
|
6451
|
+
rejectsForcedToolUse: true,
|
|
6452
|
+
supportsBetweenToolsThinking: false,
|
|
6453
|
+
isKnownModel: true
|
|
6454
|
+
};
|
|
6455
|
+
} else if (modelId.includes("claude-fable-5")) {
|
|
6456
|
+
return {
|
|
6457
|
+
maxOutputTokens: 128e3,
|
|
6458
|
+
supportsStructuredOutput: true,
|
|
6459
|
+
supportsAdaptiveThinking: true,
|
|
6460
|
+
rejectsSamplingParameters: true,
|
|
6461
|
+
supportsXhighEffort: true,
|
|
6462
|
+
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6463
|
+
rejectsThinkingDisabled: true,
|
|
6464
|
+
rejectsForcedToolUse: false,
|
|
6465
|
+
supportsBetweenToolsThinking: false,
|
|
5800
6466
|
isKnownModel: true
|
|
5801
6467
|
};
|
|
5802
|
-
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-
|
|
6468
|
+
} else if (modelId.includes("claude-opus-4-8") || modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5")) {
|
|
5803
6469
|
return {
|
|
5804
6470
|
maxOutputTokens: 128e3,
|
|
5805
6471
|
supportsStructuredOutput: true,
|
|
@@ -5807,6 +6473,9 @@ function getModelCapabilities(modelId) {
|
|
|
5807
6473
|
rejectsSamplingParameters: true,
|
|
5808
6474
|
supportsXhighEffort: true,
|
|
5809
6475
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6476
|
+
rejectsThinkingDisabled: false,
|
|
6477
|
+
rejectsForcedToolUse: false,
|
|
6478
|
+
supportsBetweenToolsThinking: false,
|
|
5810
6479
|
isKnownModel: true
|
|
5811
6480
|
};
|
|
5812
6481
|
} else if (modelId.includes("claude-sonnet-4-6") || modelId.includes("claude-opus-4-6")) {
|
|
@@ -5817,6 +6486,9 @@ function getModelCapabilities(modelId) {
|
|
|
5817
6486
|
rejectsSamplingParameters: false,
|
|
5818
6487
|
supportsXhighEffort: false,
|
|
5819
6488
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6489
|
+
rejectsThinkingDisabled: false,
|
|
6490
|
+
rejectsForcedToolUse: false,
|
|
6491
|
+
supportsBetweenToolsThinking: false,
|
|
5820
6492
|
isKnownModel: true
|
|
5821
6493
|
};
|
|
5822
6494
|
} else if (modelId.includes("claude-sonnet-4-5") || modelId.includes("claude-opus-4-5") || modelId.includes("claude-haiku-4-5")) {
|
|
@@ -5827,6 +6499,9 @@ function getModelCapabilities(modelId) {
|
|
|
5827
6499
|
rejectsSamplingParameters: false,
|
|
5828
6500
|
supportsXhighEffort: false,
|
|
5829
6501
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6502
|
+
rejectsThinkingDisabled: false,
|
|
6503
|
+
rejectsForcedToolUse: false,
|
|
6504
|
+
supportsBetweenToolsThinking: false,
|
|
5830
6505
|
isKnownModel: true
|
|
5831
6506
|
};
|
|
5832
6507
|
} else if (modelId.includes("claude-opus-4-1")) {
|
|
@@ -5837,6 +6512,9 @@ function getModelCapabilities(modelId) {
|
|
|
5837
6512
|
rejectsSamplingParameters: false,
|
|
5838
6513
|
supportsXhighEffort: false,
|
|
5839
6514
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6515
|
+
rejectsThinkingDisabled: false,
|
|
6516
|
+
rejectsForcedToolUse: false,
|
|
6517
|
+
supportsBetweenToolsThinking: false,
|
|
5840
6518
|
isKnownModel: true
|
|
5841
6519
|
};
|
|
5842
6520
|
} else if (/claude-sonnet-4(?:-|@)/.test(modelId)) {
|
|
@@ -5847,6 +6525,9 @@ function getModelCapabilities(modelId) {
|
|
|
5847
6525
|
rejectsSamplingParameters: false,
|
|
5848
6526
|
supportsXhighEffort: false,
|
|
5849
6527
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6528
|
+
rejectsThinkingDisabled: false,
|
|
6529
|
+
rejectsForcedToolUse: false,
|
|
6530
|
+
supportsBetweenToolsThinking: false,
|
|
5850
6531
|
isKnownModel: true
|
|
5851
6532
|
};
|
|
5852
6533
|
} else if (/claude-opus-4(?:-|@)/.test(modelId)) {
|
|
@@ -5857,6 +6538,9 @@ function getModelCapabilities(modelId) {
|
|
|
5857
6538
|
rejectsSamplingParameters: false,
|
|
5858
6539
|
supportsXhighEffort: false,
|
|
5859
6540
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6541
|
+
rejectsThinkingDisabled: false,
|
|
6542
|
+
rejectsForcedToolUse: false,
|
|
6543
|
+
supportsBetweenToolsThinking: false,
|
|
5860
6544
|
isKnownModel: true
|
|
5861
6545
|
};
|
|
5862
6546
|
} else if (modelId.includes("claude-3-haiku")) {
|
|
@@ -5867,6 +6551,9 @@ function getModelCapabilities(modelId) {
|
|
|
5867
6551
|
rejectsSamplingParameters: false,
|
|
5868
6552
|
supportsXhighEffort: false,
|
|
5869
6553
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6554
|
+
rejectsThinkingDisabled: false,
|
|
6555
|
+
rejectsForcedToolUse: false,
|
|
6556
|
+
supportsBetweenToolsThinking: false,
|
|
5870
6557
|
isKnownModel: true
|
|
5871
6558
|
};
|
|
5872
6559
|
} else if (/claude-(?:instant(?:-|$)|v?2(?=$|[-.:])|3(?=$|[-.]))/.test(modelId)) {
|
|
@@ -5877,6 +6564,9 @@ function getModelCapabilities(modelId) {
|
|
|
5877
6564
|
rejectsSamplingParameters: false,
|
|
5878
6565
|
supportsXhighEffort: false,
|
|
5879
6566
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6567
|
+
rejectsThinkingDisabled: false,
|
|
6568
|
+
rejectsForcedToolUse: false,
|
|
6569
|
+
supportsBetweenToolsThinking: false,
|
|
5880
6570
|
isKnownModel: false
|
|
5881
6571
|
};
|
|
5882
6572
|
} else if (modelId.includes("claude-")) {
|
|
@@ -5887,6 +6577,9 @@ function getModelCapabilities(modelId) {
|
|
|
5887
6577
|
rejectsSamplingParameters: true,
|
|
5888
6578
|
supportsXhighEffort: true,
|
|
5889
6579
|
rejectsThinkingDisabledAboveHighEffort: true,
|
|
6580
|
+
rejectsThinkingDisabled: false,
|
|
6581
|
+
rejectsForcedToolUse: false,
|
|
6582
|
+
supportsBetweenToolsThinking: false,
|
|
5890
6583
|
isKnownModel: false
|
|
5891
6584
|
};
|
|
5892
6585
|
} else {
|
|
@@ -5897,19 +6590,22 @@ function getModelCapabilities(modelId) {
|
|
|
5897
6590
|
rejectsSamplingParameters: false,
|
|
5898
6591
|
supportsXhighEffort: false,
|
|
5899
6592
|
rejectsThinkingDisabledAboveHighEffort: false,
|
|
6593
|
+
rejectsThinkingDisabled: false,
|
|
6594
|
+
rejectsForcedToolUse: false,
|
|
6595
|
+
supportsBetweenToolsThinking: false,
|
|
5900
6596
|
isKnownModel: false
|
|
5901
6597
|
};
|
|
5902
6598
|
}
|
|
5903
6599
|
}
|
|
5904
|
-
function
|
|
6600
|
+
function hasDynamicFilteringWebToolWithoutCodeExecution(tools) {
|
|
5905
6601
|
if (!tools) {
|
|
5906
6602
|
return false;
|
|
5907
6603
|
}
|
|
5908
|
-
let
|
|
6604
|
+
let hasDynamicFilteringWebTool = false;
|
|
5909
6605
|
let hasCodeExecutionTool = false;
|
|
5910
6606
|
for (const tool of tools) {
|
|
5911
|
-
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_search_20260209")) {
|
|
5912
|
-
|
|
6607
|
+
if ("type" in tool && (tool.type === "web_fetch_20260209" || tool.type === "web_fetch_20260318" || tool.type === "web_search_20260209" || tool.type === "web_search_20260318")) {
|
|
6608
|
+
hasDynamicFilteringWebTool = true;
|
|
5913
6609
|
continue;
|
|
5914
6610
|
}
|
|
5915
6611
|
if ("type" in tool && (tool.type === "code_execution_20250522" || tool.type === "code_execution_20250825" || tool.type === "code_execution_20260120")) {
|
|
@@ -5917,12 +6613,15 @@ function hasWebTool20260209WithoutCodeExecution(tools) {
|
|
|
5917
6613
|
break;
|
|
5918
6614
|
}
|
|
5919
6615
|
}
|
|
5920
|
-
return
|
|
6616
|
+
return hasDynamicFilteringWebTool && !hasCodeExecutionTool;
|
|
5921
6617
|
}
|
|
5922
6618
|
function resolveAnthropicReasoningConfig({
|
|
5923
6619
|
reasoning,
|
|
6620
|
+
modelId,
|
|
5924
6621
|
supportsAdaptiveThinking,
|
|
5925
6622
|
supportsXhighEffort,
|
|
6623
|
+
rejectsThinkingDisabled,
|
|
6624
|
+
supportsBetweenToolsThinking,
|
|
5926
6625
|
maxOutputTokensForModel,
|
|
5927
6626
|
warnings
|
|
5928
6627
|
}) {
|
|
@@ -5930,6 +6629,17 @@ function resolveAnthropicReasoningConfig({
|
|
|
5930
6629
|
return void 0;
|
|
5931
6630
|
}
|
|
5932
6631
|
if (reasoning === "none") {
|
|
6632
|
+
if (supportsBetweenToolsThinking) {
|
|
6633
|
+
return { thinking: { type: "between_tools" } };
|
|
6634
|
+
}
|
|
6635
|
+
if (rejectsThinkingDisabled) {
|
|
6636
|
+
warnings.push({
|
|
6637
|
+
type: "compatibility",
|
|
6638
|
+
feature: "reasoning",
|
|
6639
|
+
details: `reasoning 'none' is not supported by ${modelId}; it always uses adaptive thinking. Using effort 'low' to minimize thinking instead.`
|
|
6640
|
+
});
|
|
6641
|
+
return { effort: "low" };
|
|
6642
|
+
}
|
|
5933
6643
|
return { thinking: { type: "disabled" } };
|
|
5934
6644
|
}
|
|
5935
6645
|
if (supportsAdaptiveThinking) {
|
|
@@ -5999,7 +6709,7 @@ function mapAnthropicStopDetails(stopDetails) {
|
|
|
5999
6709
|
|
|
6000
6710
|
// src/anthropic-batch.ts
|
|
6001
6711
|
import {
|
|
6002
|
-
InvalidArgumentError,
|
|
6712
|
+
InvalidArgumentError as InvalidArgumentError2,
|
|
6003
6713
|
InvalidResponseDataError as InvalidResponseDataError2,
|
|
6004
6714
|
UnsupportedFunctionalityError as UnsupportedFunctionalityError3
|
|
6005
6715
|
} from "@ai-sdk/provider";
|
|
@@ -6011,47 +6721,47 @@ import {
|
|
|
6011
6721
|
generateId as generateId2,
|
|
6012
6722
|
getFromApi,
|
|
6013
6723
|
isRecord as isRecord2,
|
|
6014
|
-
lazySchema as
|
|
6724
|
+
lazySchema as lazySchema17,
|
|
6015
6725
|
normalizeBatchRequestCounts,
|
|
6016
6726
|
normalizeHeaders,
|
|
6017
6727
|
parseProviderOptions as parseProviderOptions3,
|
|
6018
6728
|
postJsonToApi as postJsonToApi2,
|
|
6019
6729
|
resolve as resolve2,
|
|
6020
6730
|
safeValidateTypes,
|
|
6021
|
-
zodSchema as
|
|
6731
|
+
zodSchema as zodSchema17
|
|
6022
6732
|
} from "@ai-sdk/provider-utils";
|
|
6023
|
-
import { z as
|
|
6733
|
+
import { z as z18 } from "zod/v4";
|
|
6024
6734
|
var anthropicBatchRequestIdPattern = /^[A-Za-z0-9_-]{1,64}$/;
|
|
6025
6735
|
var anthropicBatchProviderOptionsSchema = anthropicLanguageModelOptions.pick({
|
|
6026
6736
|
anthropicBeta: true
|
|
6027
6737
|
});
|
|
6028
|
-
var anthropicBatchResponseZodSchema = () =>
|
|
6029
|
-
id:
|
|
6030
|
-
type:
|
|
6031
|
-
processing_status:
|
|
6032
|
-
request_counts:
|
|
6033
|
-
processing:
|
|
6034
|
-
succeeded:
|
|
6035
|
-
errored:
|
|
6036
|
-
canceled:
|
|
6037
|
-
expired:
|
|
6738
|
+
var anthropicBatchResponseZodSchema = () => z18.object({
|
|
6739
|
+
id: z18.string(),
|
|
6740
|
+
type: z18.literal("message_batch"),
|
|
6741
|
+
processing_status: z18.string(),
|
|
6742
|
+
request_counts: z18.object({
|
|
6743
|
+
processing: z18.number(),
|
|
6744
|
+
succeeded: z18.number(),
|
|
6745
|
+
errored: z18.number(),
|
|
6746
|
+
canceled: z18.number(),
|
|
6747
|
+
expired: z18.number()
|
|
6038
6748
|
}),
|
|
6039
|
-
created_at:
|
|
6040
|
-
expires_at:
|
|
6041
|
-
archived_at:
|
|
6042
|
-
cancel_initiated_at:
|
|
6043
|
-
ended_at:
|
|
6044
|
-
results_url:
|
|
6749
|
+
created_at: z18.string(),
|
|
6750
|
+
expires_at: z18.string(),
|
|
6751
|
+
archived_at: z18.string().nullish(),
|
|
6752
|
+
cancel_initiated_at: z18.string().nullish(),
|
|
6753
|
+
ended_at: z18.string().nullish(),
|
|
6754
|
+
results_url: z18.string().nullish()
|
|
6045
6755
|
});
|
|
6046
|
-
var anthropicBatchResponseSchema =
|
|
6047
|
-
() =>
|
|
6756
|
+
var anthropicBatchResponseSchema = lazySchema17(
|
|
6757
|
+
() => zodSchema17(anthropicBatchResponseZodSchema())
|
|
6048
6758
|
);
|
|
6049
|
-
var anthropicBatchListResponseSchema =
|
|
6050
|
-
() =>
|
|
6051
|
-
|
|
6052
|
-
data:
|
|
6053
|
-
has_more:
|
|
6054
|
-
last_id:
|
|
6759
|
+
var anthropicBatchListResponseSchema = lazySchema17(
|
|
6760
|
+
() => zodSchema17(
|
|
6761
|
+
z18.object({
|
|
6762
|
+
data: z18.array(anthropicBatchResponseZodSchema()),
|
|
6763
|
+
has_more: z18.boolean(),
|
|
6764
|
+
last_id: z18.string().nullish()
|
|
6055
6765
|
})
|
|
6056
6766
|
)
|
|
6057
6767
|
);
|
|
@@ -6074,34 +6784,34 @@ var knownAnthropicBatchContentTypes = /* @__PURE__ */ new Set([
|
|
|
6074
6784
|
"web_fetch_tool_result",
|
|
6075
6785
|
"web_search_tool_result"
|
|
6076
6786
|
]);
|
|
6077
|
-
var anthropicBatchResultSchema =
|
|
6078
|
-
() =>
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
type:
|
|
6082
|
-
message:
|
|
6787
|
+
var anthropicBatchResultSchema = lazySchema17(
|
|
6788
|
+
() => zodSchema17(
|
|
6789
|
+
z18.discriminatedUnion("type", [
|
|
6790
|
+
z18.object({
|
|
6791
|
+
type: z18.literal("succeeded"),
|
|
6792
|
+
message: z18.unknown()
|
|
6083
6793
|
}),
|
|
6084
|
-
|
|
6085
|
-
type:
|
|
6086
|
-
error:
|
|
6087
|
-
type:
|
|
6088
|
-
error:
|
|
6089
|
-
type:
|
|
6090
|
-
message:
|
|
6794
|
+
z18.object({
|
|
6795
|
+
type: z18.literal("errored"),
|
|
6796
|
+
error: z18.object({
|
|
6797
|
+
type: z18.literal("error"),
|
|
6798
|
+
error: z18.object({
|
|
6799
|
+
type: z18.string(),
|
|
6800
|
+
message: z18.string()
|
|
6091
6801
|
}),
|
|
6092
|
-
request_id:
|
|
6802
|
+
request_id: z18.string().nullish()
|
|
6093
6803
|
})
|
|
6094
6804
|
}),
|
|
6095
|
-
|
|
6096
|
-
|
|
6805
|
+
z18.object({ type: z18.literal("canceled") }),
|
|
6806
|
+
z18.object({ type: z18.literal("expired") })
|
|
6097
6807
|
])
|
|
6098
6808
|
)
|
|
6099
6809
|
);
|
|
6100
|
-
var anthropicBatchResultLineSchema =
|
|
6101
|
-
() =>
|
|
6102
|
-
|
|
6103
|
-
custom_id:
|
|
6104
|
-
result:
|
|
6810
|
+
var anthropicBatchResultLineSchema = lazySchema17(
|
|
6811
|
+
() => zodSchema17(
|
|
6812
|
+
z18.object({
|
|
6813
|
+
custom_id: z18.string(),
|
|
6814
|
+
result: z18.unknown()
|
|
6105
6815
|
})
|
|
6106
6816
|
)
|
|
6107
6817
|
);
|
|
@@ -6120,10 +6830,9 @@ var AnthropicBatch = class {
|
|
|
6120
6830
|
constructor(options) {
|
|
6121
6831
|
this.options = options;
|
|
6122
6832
|
this.specificationVersion = "v4";
|
|
6123
|
-
var _a;
|
|
6124
6833
|
this.provider = options.provider;
|
|
6125
6834
|
this.supportedUrls = options.supportedUrls;
|
|
6126
|
-
this.generateId =
|
|
6835
|
+
this.generateId = options.config.generateId ?? generateId2;
|
|
6127
6836
|
}
|
|
6128
6837
|
async doStartBatch({
|
|
6129
6838
|
requests,
|
|
@@ -6132,7 +6841,6 @@ var AnthropicBatch = class {
|
|
|
6132
6841
|
abortSignal,
|
|
6133
6842
|
webhookUrl
|
|
6134
6843
|
}) {
|
|
6135
|
-
var _a, _b, _c, _d;
|
|
6136
6844
|
assertTextBatchRequests(requests);
|
|
6137
6845
|
validateRequestIds(requests);
|
|
6138
6846
|
const explicitBatchBetas = new Set(
|
|
@@ -6178,7 +6886,7 @@ var AnthropicBatch = class {
|
|
|
6178
6886
|
message: `Anthropic Message Batches cannot decode the JSON-tool structured-output fallback (request "${request.id}") because batch results are retrieved independently of the start call. Use a model that supports native output_format structured outputs.`
|
|
6179
6887
|
});
|
|
6180
6888
|
}
|
|
6181
|
-
const aliasedProviderTool =
|
|
6889
|
+
const aliasedProviderTool = request.options.tools?.find(
|
|
6182
6890
|
(tool) => tool.type === "provider" && prepared.toolNameMapping.toProviderToolName(tool.name) !== tool.name
|
|
6183
6891
|
);
|
|
6184
6892
|
if (aliasedProviderTool != null) {
|
|
@@ -6187,11 +6895,10 @@ var AnthropicBatch = class {
|
|
|
6187
6895
|
message: `Anthropic Message Batches cannot restore the custom provider-tool name "${aliasedProviderTool.name}" when results are retrieved independently of the start call (request "${request.id}"). Use the provider's canonical tool name.`
|
|
6188
6896
|
});
|
|
6189
6897
|
}
|
|
6190
|
-
const body =
|
|
6191
|
-
_b,
|
|
6898
|
+
const body = this.options.config.transformRequestBody?.(
|
|
6192
6899
|
prepared.args,
|
|
6193
6900
|
prepared.betas
|
|
6194
|
-
)
|
|
6901
|
+
) ?? prepared.args;
|
|
6195
6902
|
validateAnthropicBatchBody({
|
|
6196
6903
|
body,
|
|
6197
6904
|
requestId: request.id
|
|
@@ -6268,13 +6975,13 @@ var AnthropicBatch = class {
|
|
|
6268
6975
|
async doGetBatchResults(options) {
|
|
6269
6976
|
const batch = await this.retrieveBatch(options);
|
|
6270
6977
|
if (convertAnthropicBatchStatus(batch).status === "pending") {
|
|
6271
|
-
throw new
|
|
6978
|
+
throw new InvalidArgumentError2({
|
|
6272
6979
|
argument: "batchId",
|
|
6273
6980
|
message: `Anthropic batch "${options.batchId}" is not complete.`
|
|
6274
6981
|
});
|
|
6275
6982
|
}
|
|
6276
6983
|
if (batch.archived_at != null) {
|
|
6277
|
-
throw new
|
|
6984
|
+
throw new InvalidArgumentError2({
|
|
6278
6985
|
argument: "batchId",
|
|
6279
6986
|
message: `Anthropic batch "${options.batchId}" results are no longer available.`
|
|
6280
6987
|
});
|
|
@@ -6346,7 +7053,6 @@ async function getAnthropicBatchProviderBetas({
|
|
|
6346
7053
|
provider,
|
|
6347
7054
|
providerOptions
|
|
6348
7055
|
}) {
|
|
6349
|
-
var _a;
|
|
6350
7056
|
const providerOptionsName = provider.split(".")[0];
|
|
6351
7057
|
const canonicalOptions = await parseProviderOptions3({
|
|
6352
7058
|
provider: "anthropic",
|
|
@@ -6360,22 +7066,22 @@ async function getAnthropicBatchProviderBetas({
|
|
|
6360
7066
|
}) : void 0;
|
|
6361
7067
|
const anthropicOptions = Object.assign(
|
|
6362
7068
|
{},
|
|
6363
|
-
canonicalOptions
|
|
6364
|
-
customOptions
|
|
7069
|
+
canonicalOptions ?? {},
|
|
7070
|
+
customOptions ?? {}
|
|
6365
7071
|
);
|
|
6366
|
-
return
|
|
7072
|
+
return anthropicOptions.anthropicBeta ?? [];
|
|
6367
7073
|
}
|
|
6368
7074
|
function validateRequestIds(requests) {
|
|
6369
7075
|
const ids = /* @__PURE__ */ new Set();
|
|
6370
7076
|
for (const request of requests) {
|
|
6371
7077
|
if (!anthropicBatchRequestIdPattern.test(request.id)) {
|
|
6372
|
-
throw new
|
|
7078
|
+
throw new InvalidArgumentError2({
|
|
6373
7079
|
argument: "requests",
|
|
6374
7080
|
message: `Anthropic batch request ID "${request.id}" must match ^[A-Za-z0-9_-]{1,64}$.`
|
|
6375
7081
|
});
|
|
6376
7082
|
}
|
|
6377
7083
|
if (ids.has(request.id)) {
|
|
6378
|
-
throw new
|
|
7084
|
+
throw new InvalidArgumentError2({
|
|
6379
7085
|
argument: "requests",
|
|
6380
7086
|
message: `Anthropic batch request IDs must be unique; duplicate ID "${request.id}".`
|
|
6381
7087
|
});
|
|
@@ -6403,7 +7109,6 @@ function validateAnthropicBatchBody({
|
|
|
6403
7109
|
}
|
|
6404
7110
|
}
|
|
6405
7111
|
function convertAnthropicBatchStatus(batch) {
|
|
6406
|
-
var _a, _b, _c, _d;
|
|
6407
7112
|
const requestCounts = convertAnthropicRequestCounts(batch.request_counts);
|
|
6408
7113
|
return {
|
|
6409
7114
|
status: mapAnthropicBatchStatus(batch.processing_status),
|
|
@@ -6413,11 +7118,11 @@ function convertAnthropicBatchStatus(batch) {
|
|
|
6413
7118
|
expiresAt: batch.expires_at,
|
|
6414
7119
|
providerMetadata: {
|
|
6415
7120
|
anthropic: {
|
|
6416
|
-
archivedAt:
|
|
6417
|
-
cancelInitiatedAt:
|
|
6418
|
-
endedAt:
|
|
7121
|
+
archivedAt: batch.archived_at ?? null,
|
|
7122
|
+
cancelInitiatedAt: batch.cancel_initiated_at ?? null,
|
|
7123
|
+
endedAt: batch.ended_at ?? null,
|
|
6419
7124
|
requestCounts: batch.request_counts,
|
|
6420
|
-
resultsUrl:
|
|
7125
|
+
resultsUrl: batch.results_url ?? null
|
|
6421
7126
|
}
|
|
6422
7127
|
}
|
|
6423
7128
|
};
|
|
@@ -6529,7 +7234,6 @@ async function parseAnthropicBatchResponse(message) {
|
|
|
6529
7234
|
return recovered.success ? recovered.value : void 0;
|
|
6530
7235
|
}
|
|
6531
7236
|
function convertAnthropicBatchResponse(response, generateId4) {
|
|
6532
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
6533
7237
|
const content = [];
|
|
6534
7238
|
const mcpToolCalls = {};
|
|
6535
7239
|
const serverToolCalls = {};
|
|
@@ -6546,7 +7250,7 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6546
7250
|
}
|
|
6547
7251
|
}
|
|
6548
7252
|
});
|
|
6549
|
-
for (const citation of
|
|
7253
|
+
for (const citation of part.citations ?? []) {
|
|
6550
7254
|
const source = createCitationSource(citation, [], generateId4);
|
|
6551
7255
|
if (source != null) {
|
|
6552
7256
|
content.push(source);
|
|
@@ -6583,10 +7287,18 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6583
7287
|
});
|
|
6584
7288
|
break;
|
|
6585
7289
|
case "compaction":
|
|
7290
|
+
if (!part.content) {
|
|
7291
|
+
break;
|
|
7292
|
+
}
|
|
6586
7293
|
content.push({
|
|
6587
7294
|
type: "text",
|
|
6588
7295
|
text: part.content,
|
|
6589
|
-
providerMetadata: {
|
|
7296
|
+
providerMetadata: {
|
|
7297
|
+
anthropic: {
|
|
7298
|
+
type: "compaction",
|
|
7299
|
+
...part.signature != null && { signature: part.signature }
|
|
7300
|
+
}
|
|
7301
|
+
}
|
|
6590
7302
|
});
|
|
6591
7303
|
break;
|
|
6592
7304
|
case "tool_use":
|
|
@@ -6610,7 +7322,7 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6610
7322
|
toolCallId: part.id,
|
|
6611
7323
|
toolName,
|
|
6612
7324
|
input: JSON.stringify(
|
|
6613
|
-
isCodeExecutionAlias ? { type: part.name, ...
|
|
7325
|
+
isCodeExecutionAlias ? { type: part.name, ...part.input } : part.name === "code_execution" && part.input != null && "code" in part.input && !("type" in part.input) ? { type: "programmatic-tool-call", ...part.input } : part.input
|
|
6614
7326
|
),
|
|
6615
7327
|
providerExecuted: true,
|
|
6616
7328
|
// Batch results are retrieved without the original request tools, so
|
|
@@ -6644,11 +7356,11 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6644
7356
|
content.push({
|
|
6645
7357
|
type: "tool-result",
|
|
6646
7358
|
toolCallId: part.tool_use_id,
|
|
6647
|
-
toolName:
|
|
7359
|
+
toolName: toolCall?.toolName ?? "mcp",
|
|
6648
7360
|
isError: part.is_error,
|
|
6649
7361
|
result: part.content,
|
|
6650
7362
|
dynamic: true,
|
|
6651
|
-
...
|
|
7363
|
+
...toolCall?.providerMetadata != null && {
|
|
6652
7364
|
providerMetadata: toolCall.providerMetadata
|
|
6653
7365
|
}
|
|
6654
7366
|
});
|
|
@@ -6691,16 +7403,13 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6691
7403
|
toolCallId: part.tool_use_id,
|
|
6692
7404
|
toolName: "web_search",
|
|
6693
7405
|
...Array.isArray(part.content) ? {
|
|
6694
|
-
result: part.content.map((result) => {
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
url: result.url
|
|
6702
|
-
};
|
|
6703
|
-
})
|
|
7406
|
+
result: part.content.map((result) => ({
|
|
7407
|
+
encryptedContent: result.encrypted_content,
|
|
7408
|
+
pageAge: result.page_age ?? null,
|
|
7409
|
+
...result.title != null ? { title: result.title } : {},
|
|
7410
|
+
type: result.type,
|
|
7411
|
+
url: result.url
|
|
7412
|
+
}))
|
|
6704
7413
|
} : {
|
|
6705
7414
|
isError: true,
|
|
6706
7415
|
result: {
|
|
@@ -6720,7 +7429,7 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6720
7429
|
...result.title != null ? { title: result.title } : {},
|
|
6721
7430
|
providerMetadata: {
|
|
6722
7431
|
anthropic: {
|
|
6723
|
-
pageAge:
|
|
7432
|
+
pageAge: result.page_age ?? null
|
|
6724
7433
|
}
|
|
6725
7434
|
}
|
|
6726
7435
|
});
|
|
@@ -6751,7 +7460,7 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6751
7460
|
});
|
|
6752
7461
|
break;
|
|
6753
7462
|
case "tool_search_tool_result": {
|
|
6754
|
-
const toolName =
|
|
7463
|
+
const toolName = serverToolCalls[part.tool_use_id] ?? "tool_search_tool_regex";
|
|
6755
7464
|
content.push({
|
|
6756
7465
|
type: "tool-result",
|
|
6757
7466
|
toolCallId: part.tool_use_id,
|
|
@@ -6817,12 +7526,12 @@ function convertAnthropicBatchResponse(response, generateId4) {
|
|
|
6817
7526
|
unified: mapAnthropicStopReason({
|
|
6818
7527
|
finishReason: response.stop_reason
|
|
6819
7528
|
}),
|
|
6820
|
-
raw:
|
|
7529
|
+
raw: response.stop_reason ?? void 0
|
|
6821
7530
|
},
|
|
6822
7531
|
usage: convertAnthropicUsage({ usage: response.usage }),
|
|
6823
7532
|
response: {
|
|
6824
|
-
id:
|
|
6825
|
-
modelId:
|
|
7533
|
+
id: response.id ?? void 0,
|
|
7534
|
+
modelId: response.model ?? void 0
|
|
6826
7535
|
},
|
|
6827
7536
|
warnings: [],
|
|
6828
7537
|
providerMetadata: {
|
|
@@ -6843,13 +7552,13 @@ function anthropicCallerMetadata(caller) {
|
|
|
6843
7552
|
};
|
|
6844
7553
|
}
|
|
6845
7554
|
function convertAnthropicMessageMetadata(response) {
|
|
6846
|
-
var _a, _b, _c;
|
|
6847
7555
|
const stopDetails = mapAnthropicStopDetails2(response.stop_details);
|
|
6848
7556
|
return {
|
|
6849
7557
|
usage: response.usage,
|
|
6850
|
-
stopSequence:
|
|
7558
|
+
stopSequence: response.stop_sequence ?? null,
|
|
6851
7559
|
...stopDetails != null ? { stopDetails } : {},
|
|
6852
7560
|
...response.input_transformations != null ? { inputTransformations: response.input_transformations } : {},
|
|
7561
|
+
...response.safeguard_results != null ? { safeguardResults: response.safeguard_results } : {},
|
|
6853
7562
|
iterations: response.usage.iterations ? response.usage.iterations.map(
|
|
6854
7563
|
(iteration) => ({
|
|
6855
7564
|
type: iteration.type,
|
|
@@ -6865,11 +7574,11 @@ function convertAnthropicMessageMetadata(response) {
|
|
|
6865
7574
|
container: response.container ? {
|
|
6866
7575
|
expiresAt: response.container.expires_at,
|
|
6867
7576
|
id: response.container.id,
|
|
6868
|
-
skills:
|
|
7577
|
+
skills: response.container.skills?.map((skill) => ({
|
|
6869
7578
|
type: skill.type,
|
|
6870
7579
|
skillId: skill.skill_id,
|
|
6871
7580
|
version: skill.version
|
|
6872
|
-
}))
|
|
7581
|
+
})) ?? null
|
|
6873
7582
|
} : null,
|
|
6874
7583
|
contextManagement: mapAnthropicResponseContextManagement2(
|
|
6875
7584
|
response.context_management
|
|
@@ -6912,20 +7621,20 @@ function mapAnthropicStopDetails2(stopDetails) {
|
|
|
6912
7621
|
|
|
6913
7622
|
// src/tool/bash_20241022.ts
|
|
6914
7623
|
import {
|
|
6915
|
-
createProviderDefinedToolFactory as
|
|
6916
|
-
lazySchema as
|
|
6917
|
-
zodSchema as
|
|
7624
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory3,
|
|
7625
|
+
lazySchema as lazySchema18,
|
|
7626
|
+
zodSchema as zodSchema18
|
|
6918
7627
|
} from "@ai-sdk/provider-utils";
|
|
6919
|
-
import { z as
|
|
6920
|
-
var bash_20241022InputSchema =
|
|
6921
|
-
() =>
|
|
6922
|
-
|
|
6923
|
-
command:
|
|
6924
|
-
restart:
|
|
7628
|
+
import { z as z19 } from "zod/v4";
|
|
7629
|
+
var bash_20241022InputSchema = lazySchema18(
|
|
7630
|
+
() => zodSchema18(
|
|
7631
|
+
z19.object({
|
|
7632
|
+
command: z19.string(),
|
|
7633
|
+
restart: z19.boolean().optional()
|
|
6925
7634
|
})
|
|
6926
7635
|
)
|
|
6927
7636
|
);
|
|
6928
|
-
var bash_20241022_internal =
|
|
7637
|
+
var bash_20241022_internal = createProviderDefinedToolFactory3({
|
|
6929
7638
|
id: "anthropic.bash_20241022",
|
|
6930
7639
|
inputSchema: bash_20241022InputSchema
|
|
6931
7640
|
});
|
|
@@ -6953,20 +7662,20 @@ function bash_20241022(options = {}) {
|
|
|
6953
7662
|
|
|
6954
7663
|
// src/tool/bash_20250124.ts
|
|
6955
7664
|
import {
|
|
6956
|
-
createProviderDefinedToolFactory as
|
|
6957
|
-
lazySchema as
|
|
6958
|
-
zodSchema as
|
|
7665
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory4,
|
|
7666
|
+
lazySchema as lazySchema19,
|
|
7667
|
+
zodSchema as zodSchema19
|
|
6959
7668
|
} from "@ai-sdk/provider-utils";
|
|
6960
|
-
import { z as
|
|
6961
|
-
var bash_20250124InputSchema =
|
|
6962
|
-
() =>
|
|
6963
|
-
|
|
6964
|
-
command:
|
|
6965
|
-
restart:
|
|
7669
|
+
import { z as z20 } from "zod/v4";
|
|
7670
|
+
var bash_20250124InputSchema = lazySchema19(
|
|
7671
|
+
() => zodSchema19(
|
|
7672
|
+
z20.object({
|
|
7673
|
+
command: z20.string(),
|
|
7674
|
+
restart: z20.boolean().optional()
|
|
6966
7675
|
})
|
|
6967
7676
|
)
|
|
6968
7677
|
);
|
|
6969
|
-
var bash_20250124_internal =
|
|
7678
|
+
var bash_20250124_internal = createProviderDefinedToolFactory4({
|
|
6970
7679
|
id: "anthropic.bash_20250124",
|
|
6971
7680
|
inputSchema: bash_20250124InputSchema
|
|
6972
7681
|
});
|
|
@@ -6994,15 +7703,15 @@ function bash_20250124(options = {}) {
|
|
|
6994
7703
|
|
|
6995
7704
|
// src/tool/computer_20241022.ts
|
|
6996
7705
|
import {
|
|
6997
|
-
createProviderDefinedToolFactory as
|
|
6998
|
-
lazySchema as
|
|
6999
|
-
zodSchema as
|
|
7706
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory5,
|
|
7707
|
+
lazySchema as lazySchema20,
|
|
7708
|
+
zodSchema as zodSchema20
|
|
7000
7709
|
} from "@ai-sdk/provider-utils";
|
|
7001
|
-
import { z as
|
|
7002
|
-
var computer_20241022InputSchema =
|
|
7003
|
-
() =>
|
|
7004
|
-
|
|
7005
|
-
action:
|
|
7710
|
+
import { z as z21 } from "zod/v4";
|
|
7711
|
+
var computer_20241022InputSchema = lazySchema20(
|
|
7712
|
+
() => zodSchema20(
|
|
7713
|
+
z21.object({
|
|
7714
|
+
action: z21.enum([
|
|
7006
7715
|
"key",
|
|
7007
7716
|
"type",
|
|
7008
7717
|
"mouse_move",
|
|
@@ -7014,27 +7723,27 @@ var computer_20241022InputSchema = lazySchema17(
|
|
|
7014
7723
|
"screenshot",
|
|
7015
7724
|
"cursor_position"
|
|
7016
7725
|
]),
|
|
7017
|
-
coordinate:
|
|
7018
|
-
text:
|
|
7726
|
+
coordinate: z21.array(z21.number().int()).optional(),
|
|
7727
|
+
text: z21.string().optional()
|
|
7019
7728
|
})
|
|
7020
7729
|
)
|
|
7021
7730
|
);
|
|
7022
|
-
var computer_20241022 =
|
|
7731
|
+
var computer_20241022 = createProviderDefinedToolFactory5({
|
|
7023
7732
|
id: "anthropic.computer_20241022",
|
|
7024
7733
|
inputSchema: computer_20241022InputSchema
|
|
7025
7734
|
});
|
|
7026
7735
|
|
|
7027
7736
|
// src/tool/computer_20250124.ts
|
|
7028
7737
|
import {
|
|
7029
|
-
createProviderDefinedToolFactory as
|
|
7030
|
-
lazySchema as
|
|
7031
|
-
zodSchema as
|
|
7738
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory6,
|
|
7739
|
+
lazySchema as lazySchema21,
|
|
7740
|
+
zodSchema as zodSchema21
|
|
7032
7741
|
} from "@ai-sdk/provider-utils";
|
|
7033
|
-
import { z as
|
|
7034
|
-
var computer_20250124InputSchema =
|
|
7035
|
-
() =>
|
|
7036
|
-
|
|
7037
|
-
action:
|
|
7742
|
+
import { z as z22 } from "zod/v4";
|
|
7743
|
+
var computer_20250124InputSchema = lazySchema21(
|
|
7744
|
+
() => zodSchema21(
|
|
7745
|
+
z22.object({
|
|
7746
|
+
action: z22.enum([
|
|
7038
7747
|
"key",
|
|
7039
7748
|
"hold_key",
|
|
7040
7749
|
"type",
|
|
@@ -7052,31 +7761,31 @@ var computer_20250124InputSchema = lazySchema18(
|
|
|
7052
7761
|
"wait",
|
|
7053
7762
|
"screenshot"
|
|
7054
7763
|
]),
|
|
7055
|
-
coordinate:
|
|
7056
|
-
duration:
|
|
7057
|
-
scroll_amount:
|
|
7058
|
-
scroll_direction:
|
|
7059
|
-
start_coordinate:
|
|
7060
|
-
text:
|
|
7764
|
+
coordinate: z22.tuple([z22.number().int(), z22.number().int()]).optional(),
|
|
7765
|
+
duration: z22.number().optional(),
|
|
7766
|
+
scroll_amount: z22.number().optional(),
|
|
7767
|
+
scroll_direction: z22.enum(["up", "down", "left", "right"]).optional(),
|
|
7768
|
+
start_coordinate: z22.tuple([z22.number().int(), z22.number().int()]).optional(),
|
|
7769
|
+
text: z22.string().optional()
|
|
7061
7770
|
})
|
|
7062
7771
|
)
|
|
7063
7772
|
);
|
|
7064
|
-
var computer_20250124 =
|
|
7773
|
+
var computer_20250124 = createProviderDefinedToolFactory6({
|
|
7065
7774
|
id: "anthropic.computer_20250124",
|
|
7066
7775
|
inputSchema: computer_20250124InputSchema
|
|
7067
7776
|
});
|
|
7068
7777
|
|
|
7069
7778
|
// src/tool/computer_20251124.ts
|
|
7070
7779
|
import {
|
|
7071
|
-
createProviderDefinedToolFactory as
|
|
7072
|
-
lazySchema as
|
|
7073
|
-
zodSchema as
|
|
7780
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory7,
|
|
7781
|
+
lazySchema as lazySchema22,
|
|
7782
|
+
zodSchema as zodSchema22
|
|
7074
7783
|
} from "@ai-sdk/provider-utils";
|
|
7075
|
-
import { z as
|
|
7076
|
-
var computer_20251124InputSchema =
|
|
7077
|
-
() =>
|
|
7078
|
-
|
|
7079
|
-
action:
|
|
7784
|
+
import { z as z23 } from "zod/v4";
|
|
7785
|
+
var computer_20251124InputSchema = lazySchema22(
|
|
7786
|
+
() => zodSchema22(
|
|
7787
|
+
z23.object({
|
|
7788
|
+
action: z23.enum([
|
|
7080
7789
|
"key",
|
|
7081
7790
|
"hold_key",
|
|
7082
7791
|
"type",
|
|
@@ -7095,193 +7804,193 @@ var computer_20251124InputSchema = lazySchema19(
|
|
|
7095
7804
|
"screenshot",
|
|
7096
7805
|
"zoom"
|
|
7097
7806
|
]),
|
|
7098
|
-
coordinate:
|
|
7099
|
-
duration:
|
|
7100
|
-
region:
|
|
7101
|
-
|
|
7102
|
-
|
|
7103
|
-
|
|
7104
|
-
|
|
7807
|
+
coordinate: z23.tuple([z23.number().int(), z23.number().int()]).optional(),
|
|
7808
|
+
duration: z23.number().optional(),
|
|
7809
|
+
region: z23.tuple([
|
|
7810
|
+
z23.number().int(),
|
|
7811
|
+
z23.number().int(),
|
|
7812
|
+
z23.number().int(),
|
|
7813
|
+
z23.number().int()
|
|
7105
7814
|
]).optional(),
|
|
7106
|
-
scroll_amount:
|
|
7107
|
-
scroll_direction:
|
|
7108
|
-
start_coordinate:
|
|
7109
|
-
text:
|
|
7815
|
+
scroll_amount: z23.number().optional(),
|
|
7816
|
+
scroll_direction: z23.enum(["up", "down", "left", "right"]).optional(),
|
|
7817
|
+
start_coordinate: z23.tuple([z23.number().int(), z23.number().int()]).optional(),
|
|
7818
|
+
text: z23.string().optional()
|
|
7110
7819
|
})
|
|
7111
7820
|
)
|
|
7112
7821
|
);
|
|
7113
|
-
var computer_20251124 =
|
|
7822
|
+
var computer_20251124 = createProviderDefinedToolFactory7({
|
|
7114
7823
|
id: "anthropic.computer_20251124",
|
|
7115
7824
|
inputSchema: computer_20251124InputSchema
|
|
7116
7825
|
});
|
|
7117
7826
|
|
|
7118
7827
|
// src/tool/memory_20250818.ts
|
|
7119
7828
|
import {
|
|
7120
|
-
createProviderDefinedToolFactory as
|
|
7121
|
-
lazySchema as
|
|
7122
|
-
zodSchema as
|
|
7829
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory8,
|
|
7830
|
+
lazySchema as lazySchema23,
|
|
7831
|
+
zodSchema as zodSchema23
|
|
7123
7832
|
} from "@ai-sdk/provider-utils";
|
|
7124
|
-
import { z as
|
|
7125
|
-
var memory_20250818InputSchema =
|
|
7126
|
-
() =>
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
command:
|
|
7130
|
-
path:
|
|
7131
|
-
view_range:
|
|
7833
|
+
import { z as z24 } from "zod/v4";
|
|
7834
|
+
var memory_20250818InputSchema = lazySchema23(
|
|
7835
|
+
() => zodSchema23(
|
|
7836
|
+
z24.discriminatedUnion("command", [
|
|
7837
|
+
z24.object({
|
|
7838
|
+
command: z24.literal("view"),
|
|
7839
|
+
path: z24.string(),
|
|
7840
|
+
view_range: z24.tuple([z24.number(), z24.number()]).optional()
|
|
7132
7841
|
}),
|
|
7133
|
-
|
|
7134
|
-
command:
|
|
7135
|
-
path:
|
|
7136
|
-
file_text:
|
|
7842
|
+
z24.object({
|
|
7843
|
+
command: z24.literal("create"),
|
|
7844
|
+
path: z24.string(),
|
|
7845
|
+
file_text: z24.string()
|
|
7137
7846
|
}),
|
|
7138
|
-
|
|
7139
|
-
command:
|
|
7140
|
-
path:
|
|
7141
|
-
old_str:
|
|
7142
|
-
new_str:
|
|
7847
|
+
z24.object({
|
|
7848
|
+
command: z24.literal("str_replace"),
|
|
7849
|
+
path: z24.string(),
|
|
7850
|
+
old_str: z24.string(),
|
|
7851
|
+
new_str: z24.string()
|
|
7143
7852
|
}),
|
|
7144
|
-
|
|
7145
|
-
command:
|
|
7146
|
-
path:
|
|
7147
|
-
insert_line:
|
|
7148
|
-
insert_text:
|
|
7853
|
+
z24.object({
|
|
7854
|
+
command: z24.literal("insert"),
|
|
7855
|
+
path: z24.string(),
|
|
7856
|
+
insert_line: z24.number(),
|
|
7857
|
+
insert_text: z24.string()
|
|
7149
7858
|
}),
|
|
7150
|
-
|
|
7151
|
-
command:
|
|
7152
|
-
path:
|
|
7859
|
+
z24.object({
|
|
7860
|
+
command: z24.literal("delete"),
|
|
7861
|
+
path: z24.string()
|
|
7153
7862
|
}),
|
|
7154
|
-
|
|
7155
|
-
command:
|
|
7156
|
-
old_path:
|
|
7157
|
-
new_path:
|
|
7863
|
+
z24.object({
|
|
7864
|
+
command: z24.literal("rename"),
|
|
7865
|
+
old_path: z24.string(),
|
|
7866
|
+
new_path: z24.string()
|
|
7158
7867
|
})
|
|
7159
7868
|
])
|
|
7160
7869
|
)
|
|
7161
7870
|
);
|
|
7162
|
-
var memory_20250818 =
|
|
7871
|
+
var memory_20250818 = createProviderDefinedToolFactory8({
|
|
7163
7872
|
id: "anthropic.memory_20250818",
|
|
7164
7873
|
inputSchema: memory_20250818InputSchema
|
|
7165
7874
|
});
|
|
7166
7875
|
|
|
7167
7876
|
// src/tool/text-editor_20241022.ts
|
|
7168
7877
|
import {
|
|
7169
|
-
createProviderDefinedToolFactory as
|
|
7170
|
-
lazySchema as
|
|
7171
|
-
zodSchema as
|
|
7878
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory9,
|
|
7879
|
+
lazySchema as lazySchema24,
|
|
7880
|
+
zodSchema as zodSchema24
|
|
7172
7881
|
} from "@ai-sdk/provider-utils";
|
|
7173
|
-
import { z as
|
|
7174
|
-
var textEditor_20241022InputSchema =
|
|
7175
|
-
() =>
|
|
7176
|
-
|
|
7177
|
-
command:
|
|
7178
|
-
path:
|
|
7179
|
-
file_text:
|
|
7180
|
-
insert_line:
|
|
7181
|
-
new_str:
|
|
7182
|
-
insert_text:
|
|
7183
|
-
old_str:
|
|
7184
|
-
view_range:
|
|
7882
|
+
import { z as z25 } from "zod/v4";
|
|
7883
|
+
var textEditor_20241022InputSchema = lazySchema24(
|
|
7884
|
+
() => zodSchema24(
|
|
7885
|
+
z25.object({
|
|
7886
|
+
command: z25.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
7887
|
+
path: z25.string(),
|
|
7888
|
+
file_text: z25.string().optional(),
|
|
7889
|
+
insert_line: z25.number().int().optional(),
|
|
7890
|
+
new_str: z25.string().optional(),
|
|
7891
|
+
insert_text: z25.string().optional(),
|
|
7892
|
+
old_str: z25.string().optional(),
|
|
7893
|
+
view_range: z25.array(z25.number().int()).optional()
|
|
7185
7894
|
})
|
|
7186
7895
|
)
|
|
7187
7896
|
);
|
|
7188
|
-
var textEditor_20241022 =
|
|
7897
|
+
var textEditor_20241022 = createProviderDefinedToolFactory9({
|
|
7189
7898
|
id: "anthropic.text_editor_20241022",
|
|
7190
7899
|
inputSchema: textEditor_20241022InputSchema
|
|
7191
7900
|
});
|
|
7192
7901
|
|
|
7193
7902
|
// src/tool/text-editor_20250124.ts
|
|
7194
7903
|
import {
|
|
7195
|
-
createProviderDefinedToolFactory as
|
|
7196
|
-
lazySchema as
|
|
7197
|
-
zodSchema as
|
|
7904
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory10,
|
|
7905
|
+
lazySchema as lazySchema25,
|
|
7906
|
+
zodSchema as zodSchema25
|
|
7198
7907
|
} from "@ai-sdk/provider-utils";
|
|
7199
|
-
import { z as
|
|
7200
|
-
var textEditor_20250124InputSchema =
|
|
7201
|
-
() =>
|
|
7202
|
-
|
|
7203
|
-
command:
|
|
7204
|
-
path:
|
|
7205
|
-
file_text:
|
|
7206
|
-
insert_line:
|
|
7207
|
-
new_str:
|
|
7208
|
-
insert_text:
|
|
7209
|
-
old_str:
|
|
7210
|
-
view_range:
|
|
7908
|
+
import { z as z26 } from "zod/v4";
|
|
7909
|
+
var textEditor_20250124InputSchema = lazySchema25(
|
|
7910
|
+
() => zodSchema25(
|
|
7911
|
+
z26.object({
|
|
7912
|
+
command: z26.enum(["view", "create", "str_replace", "insert", "undo_edit"]),
|
|
7913
|
+
path: z26.string(),
|
|
7914
|
+
file_text: z26.string().optional(),
|
|
7915
|
+
insert_line: z26.number().int().optional(),
|
|
7916
|
+
new_str: z26.string().optional(),
|
|
7917
|
+
insert_text: z26.string().optional(),
|
|
7918
|
+
old_str: z26.string().optional(),
|
|
7919
|
+
view_range: z26.array(z26.number().int()).optional()
|
|
7211
7920
|
})
|
|
7212
7921
|
)
|
|
7213
7922
|
);
|
|
7214
|
-
var textEditor_20250124 =
|
|
7923
|
+
var textEditor_20250124 = createProviderDefinedToolFactory10({
|
|
7215
7924
|
id: "anthropic.text_editor_20250124",
|
|
7216
7925
|
inputSchema: textEditor_20250124InputSchema
|
|
7217
7926
|
});
|
|
7218
7927
|
|
|
7219
7928
|
// src/tool/text-editor_20250429.ts
|
|
7220
7929
|
import {
|
|
7221
|
-
createProviderDefinedToolFactory as
|
|
7222
|
-
lazySchema as
|
|
7223
|
-
zodSchema as
|
|
7930
|
+
createProviderDefinedToolFactory as createProviderDefinedToolFactory11,
|
|
7931
|
+
lazySchema as lazySchema26,
|
|
7932
|
+
zodSchema as zodSchema26
|
|
7224
7933
|
} from "@ai-sdk/provider-utils";
|
|
7225
|
-
import { z as
|
|
7226
|
-
var textEditor_20250429InputSchema =
|
|
7227
|
-
() =>
|
|
7228
|
-
|
|
7229
|
-
command:
|
|
7230
|
-
path:
|
|
7231
|
-
file_text:
|
|
7232
|
-
insert_line:
|
|
7233
|
-
new_str:
|
|
7234
|
-
insert_text:
|
|
7235
|
-
old_str:
|
|
7236
|
-
view_range:
|
|
7934
|
+
import { z as z27 } from "zod/v4";
|
|
7935
|
+
var textEditor_20250429InputSchema = lazySchema26(
|
|
7936
|
+
() => zodSchema26(
|
|
7937
|
+
z27.object({
|
|
7938
|
+
command: z27.enum(["view", "create", "str_replace", "insert"]),
|
|
7939
|
+
path: z27.string(),
|
|
7940
|
+
file_text: z27.string().optional(),
|
|
7941
|
+
insert_line: z27.number().int().optional(),
|
|
7942
|
+
new_str: z27.string().optional(),
|
|
7943
|
+
insert_text: z27.string().optional(),
|
|
7944
|
+
old_str: z27.string().optional(),
|
|
7945
|
+
view_range: z27.array(z27.number().int()).optional()
|
|
7237
7946
|
})
|
|
7238
7947
|
)
|
|
7239
7948
|
);
|
|
7240
|
-
var textEditor_20250429 =
|
|
7949
|
+
var textEditor_20250429 = createProviderDefinedToolFactory11({
|
|
7241
7950
|
id: "anthropic.text_editor_20250429",
|
|
7242
7951
|
inputSchema: textEditor_20250429InputSchema
|
|
7243
7952
|
});
|
|
7244
7953
|
|
|
7245
7954
|
// src/tool/tool-search-bm25_20251119.ts
|
|
7246
7955
|
import {
|
|
7247
|
-
createProviderExecutedToolFactory as
|
|
7248
|
-
lazySchema as
|
|
7249
|
-
zodSchema as
|
|
7956
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory12,
|
|
7957
|
+
lazySchema as lazySchema27,
|
|
7958
|
+
zodSchema as zodSchema27
|
|
7250
7959
|
} from "@ai-sdk/provider-utils";
|
|
7251
|
-
import { z as
|
|
7252
|
-
var toolSearchBm25_20251119OutputSchema =
|
|
7253
|
-
() =>
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
type:
|
|
7257
|
-
toolName:
|
|
7960
|
+
import { z as z28 } from "zod/v4";
|
|
7961
|
+
var toolSearchBm25_20251119OutputSchema = lazySchema27(
|
|
7962
|
+
() => zodSchema27(
|
|
7963
|
+
z28.array(
|
|
7964
|
+
z28.object({
|
|
7965
|
+
type: z28.literal("tool_reference"),
|
|
7966
|
+
toolName: z28.string()
|
|
7258
7967
|
})
|
|
7259
7968
|
)
|
|
7260
7969
|
)
|
|
7261
7970
|
);
|
|
7262
|
-
var toolSearchBm25_20251119InputSchema =
|
|
7263
|
-
() =>
|
|
7264
|
-
|
|
7971
|
+
var toolSearchBm25_20251119InputSchema = lazySchema27(
|
|
7972
|
+
() => zodSchema27(
|
|
7973
|
+
z28.object({
|
|
7265
7974
|
/**
|
|
7266
7975
|
* A natural language query to search for tools.
|
|
7267
7976
|
* Claude will use BM25 text search to find relevant tools.
|
|
7268
7977
|
*/
|
|
7269
|
-
query:
|
|
7978
|
+
query: z28.string(),
|
|
7270
7979
|
/**
|
|
7271
7980
|
* Maximum number of tools to return. Optional.
|
|
7272
7981
|
*/
|
|
7273
|
-
limit:
|
|
7982
|
+
limit: z28.number().optional()
|
|
7274
7983
|
})
|
|
7275
7984
|
)
|
|
7276
7985
|
);
|
|
7277
|
-
var
|
|
7986
|
+
var factory13 = createProviderExecutedToolFactory12({
|
|
7278
7987
|
id: "anthropic.tool_search_bm25_20251119",
|
|
7279
7988
|
inputSchema: toolSearchBm25_20251119InputSchema,
|
|
7280
7989
|
outputSchema: toolSearchBm25_20251119OutputSchema,
|
|
7281
7990
|
supportsDeferredResults: true
|
|
7282
7991
|
});
|
|
7283
7992
|
var toolSearchBm25_20251119 = (args = {}) => {
|
|
7284
|
-
return
|
|
7993
|
+
return factory13(args);
|
|
7285
7994
|
};
|
|
7286
7995
|
|
|
7287
7996
|
// src/anthropic-tools.ts
|
|
@@ -7402,6 +8111,29 @@ var anthropicTools = {
|
|
|
7402
8111
|
* @param enableZoom - Enable zoom action. Set to true to allow Claude to zoom into specific screen regions. Default: false.
|
|
7403
8112
|
*/
|
|
7404
8113
|
computer_20251124,
|
|
8114
|
+
/**
|
|
8115
|
+
* The computer toolset lets Claude control a computer through screenshots,
|
|
8116
|
+
* mouse, and keyboard. It replaces the versioned computer tools
|
|
8117
|
+
* (`computer_20251124` and earlier) on newer models.
|
|
8118
|
+
*
|
|
8119
|
+
* The API returns each computer action as its own `tool_use` block with
|
|
8120
|
+
* `toolset_name: 'computer'`. The AI SDK maps every member call to this tool
|
|
8121
|
+
* and exposes the member name as `action`, so `execute` receives the same
|
|
8122
|
+
* input shape as the older computer tools. Claude may return several actions
|
|
8123
|
+
* in one turn.
|
|
8124
|
+
*
|
|
8125
|
+
* Coordinates are always in the pixel space of the screenshots you return;
|
|
8126
|
+
* there are no display size parameters. Zoom is enabled by default.
|
|
8127
|
+
*
|
|
8128
|
+
* Does not require a beta header.
|
|
8129
|
+
*
|
|
8130
|
+
* Supported models: Claude Opus 5.5 (required; older computer tool types
|
|
8131
|
+
* are rejected), Opus 5, Sonnet 5, Fable 5, Fable 5.1, Opus 4.8.
|
|
8132
|
+
*
|
|
8133
|
+
* @param configs - Per-member settings keyed by member name, e.g.
|
|
8134
|
+
* `{ zoom: { enabled: false } }`. Omitted members keep their defaults.
|
|
8135
|
+
*/
|
|
8136
|
+
computerToolset_20260801,
|
|
7405
8137
|
/**
|
|
7406
8138
|
* The memory tool enables Claude to store and retrieve information across conversations through a memory file directory.
|
|
7407
8139
|
* Claude can create, read, update, and delete files that persist between sessions,
|
|
@@ -7469,6 +8201,18 @@ var anthropicTools = {
|
|
|
7469
8201
|
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
7470
8202
|
*/
|
|
7471
8203
|
webFetch_20260209,
|
|
8204
|
+
/**
|
|
8205
|
+
* Creates a web fetch tool that gives Claude direct access to real-time web content.
|
|
8206
|
+
*
|
|
8207
|
+
* @param maxUses - The max_uses parameter limits the number of web fetches performed
|
|
8208
|
+
* @param allowedDomains - Only fetch from these domains
|
|
8209
|
+
* @param blockedDomains - Never fetch from these domains
|
|
8210
|
+
* @param citations - Unlike web search where citations are always enabled, citations are optional for web fetch. Set "citations": {"enabled": true} to enable Claude to cite specific passages from fetched documents.
|
|
8211
|
+
* @param maxContentTokens - The max_content_tokens parameter limits the amount of content that will be included in the context.
|
|
8212
|
+
* @param useCache - Whether cached content may be returned. Set to false to fetch fresh content.
|
|
8213
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
8214
|
+
*/
|
|
8215
|
+
webFetch_20260318,
|
|
7472
8216
|
/**
|
|
7473
8217
|
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
7474
8218
|
*
|
|
@@ -7487,6 +8231,16 @@ var anthropicTools = {
|
|
|
7487
8231
|
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
7488
8232
|
*/
|
|
7489
8233
|
webSearch_20260209,
|
|
8234
|
+
/**
|
|
8235
|
+
* Creates a web search tool that gives Claude direct access to real-time web content.
|
|
8236
|
+
*
|
|
8237
|
+
* @param maxUses - Maximum number of web searches Claude can perform during the conversation.
|
|
8238
|
+
* @param allowedDomains - Optional list of domains that Claude is allowed to search.
|
|
8239
|
+
* @param blockedDomains - Optional list of domains that Claude should avoid when searching.
|
|
8240
|
+
* @param userLocation - Optional user location information to provide geographically relevant search results.
|
|
8241
|
+
* @param responseInclusion - Whether result blocks consumed by completed code execution calls are returned. Defaults to "full".
|
|
8242
|
+
*/
|
|
8243
|
+
webSearch_20260318,
|
|
7490
8244
|
/**
|
|
7491
8245
|
* Creates a tool search tool that uses regex patterns to find tools.
|
|
7492
8246
|
*
|
|
@@ -7528,40 +8282,40 @@ import {
|
|
|
7528
8282
|
} from "@ai-sdk/provider-utils";
|
|
7529
8283
|
|
|
7530
8284
|
// src/skills/anthropic-skills-api.ts
|
|
7531
|
-
import { lazySchema as
|
|
7532
|
-
import { z as
|
|
7533
|
-
var anthropicSkillResponseSchema =
|
|
7534
|
-
() =>
|
|
7535
|
-
|
|
7536
|
-
id:
|
|
7537
|
-
display_title:
|
|
7538
|
-
name:
|
|
7539
|
-
description:
|
|
7540
|
-
latest_version:
|
|
7541
|
-
source:
|
|
7542
|
-
created_at:
|
|
7543
|
-
updated_at:
|
|
8285
|
+
import { lazySchema as lazySchema28, zodSchema as zodSchema28 } from "@ai-sdk/provider-utils";
|
|
8286
|
+
import { z as z29 } from "zod/v4";
|
|
8287
|
+
var anthropicSkillResponseSchema = lazySchema28(
|
|
8288
|
+
() => zodSchema28(
|
|
8289
|
+
z29.object({
|
|
8290
|
+
id: z29.string(),
|
|
8291
|
+
display_title: z29.string().nullish(),
|
|
8292
|
+
name: z29.string().nullish(),
|
|
8293
|
+
description: z29.string().nullish(),
|
|
8294
|
+
latest_version: z29.string().nullish(),
|
|
8295
|
+
source: z29.string(),
|
|
8296
|
+
created_at: z29.string(),
|
|
8297
|
+
updated_at: z29.string()
|
|
7544
8298
|
})
|
|
7545
8299
|
)
|
|
7546
8300
|
);
|
|
7547
|
-
var anthropicSkillVersionListResponseSchema =
|
|
7548
|
-
() =>
|
|
7549
|
-
|
|
7550
|
-
data:
|
|
7551
|
-
|
|
7552
|
-
version:
|
|
8301
|
+
var anthropicSkillVersionListResponseSchema = lazySchema28(
|
|
8302
|
+
() => zodSchema28(
|
|
8303
|
+
z29.object({
|
|
8304
|
+
data: z29.array(
|
|
8305
|
+
z29.object({
|
|
8306
|
+
version: z29.string()
|
|
7553
8307
|
})
|
|
7554
8308
|
)
|
|
7555
8309
|
})
|
|
7556
8310
|
)
|
|
7557
8311
|
);
|
|
7558
|
-
var anthropicSkillVersionResponseSchema =
|
|
7559
|
-
() =>
|
|
7560
|
-
|
|
7561
|
-
type:
|
|
7562
|
-
skill_id:
|
|
7563
|
-
name:
|
|
7564
|
-
description:
|
|
8312
|
+
var anthropicSkillVersionResponseSchema = lazySchema28(
|
|
8313
|
+
() => zodSchema28(
|
|
8314
|
+
z29.object({
|
|
8315
|
+
type: z29.string(),
|
|
8316
|
+
skill_id: z29.string(),
|
|
8317
|
+
name: z29.string().nullish(),
|
|
8318
|
+
description: z29.string().nullish()
|
|
7565
8319
|
})
|
|
7566
8320
|
)
|
|
7567
8321
|
);
|
|
@@ -7605,7 +8359,6 @@ var AnthropicSkills = class {
|
|
|
7605
8359
|
};
|
|
7606
8360
|
}
|
|
7607
8361
|
async uploadSkill(params) {
|
|
7608
|
-
var _a, _b;
|
|
7609
8362
|
const warnings = [];
|
|
7610
8363
|
const formData = new FormData();
|
|
7611
8364
|
if (params.displayTitle != null) {
|
|
@@ -7631,8 +8384,8 @@ var AnthropicSkills = class {
|
|
|
7631
8384
|
version: response.latest_version,
|
|
7632
8385
|
headers
|
|
7633
8386
|
}) : {};
|
|
7634
|
-
const name =
|
|
7635
|
-
const description =
|
|
8387
|
+
const name = versionMetadata.name ?? response.name;
|
|
8388
|
+
const description = versionMetadata.description ?? response.description;
|
|
7636
8389
|
return {
|
|
7637
8390
|
providerReference: { anthropic: response.id },
|
|
7638
8391
|
...response.display_title != null ? { displayTitle: response.display_title } : {},
|
|
@@ -7652,7 +8405,7 @@ var AnthropicSkills = class {
|
|
|
7652
8405
|
};
|
|
7653
8406
|
|
|
7654
8407
|
// src/version.ts
|
|
7655
|
-
var VERSION = true ? "4.0.
|
|
8408
|
+
var VERSION = true ? "4.0.68" : "0.0.0-test";
|
|
7656
8409
|
|
|
7657
8410
|
// src/anthropic-provider.ts
|
|
7658
8411
|
var ANTHROPIC_API_URL = "https://api.anthropic.com";
|
|
@@ -7664,20 +8417,19 @@ function normalizeBaseURL(baseURL) {
|
|
|
7664
8417
|
return baseURLWithoutTrailingSlash === ANTHROPIC_API_URL ? ANTHROPIC_API_VERSIONED_URL : baseURLWithoutTrailingSlash;
|
|
7665
8418
|
}
|
|
7666
8419
|
function createAnthropic(options = {}) {
|
|
7667
|
-
|
|
7668
|
-
const baseURL = (_a = normalizeBaseURL(
|
|
8420
|
+
const baseURL = normalizeBaseURL(
|
|
7669
8421
|
loadOptionalSetting({
|
|
7670
8422
|
settingValue: options.baseURL,
|
|
7671
8423
|
environmentVariableName: "ANTHROPIC_BASE_URL"
|
|
7672
8424
|
})
|
|
7673
|
-
)
|
|
7674
|
-
const providerName =
|
|
8425
|
+
) ?? ANTHROPIC_API_VERSIONED_URL;
|
|
8426
|
+
const providerName = options.name ?? "anthropic.messages";
|
|
7675
8427
|
const supportedUrls = {
|
|
7676
8428
|
"image/*": [/^https?:\/\/.*$/],
|
|
7677
8429
|
"application/pdf": [/^https?:\/\/.*$/]
|
|
7678
8430
|
};
|
|
7679
8431
|
if (options.apiKey && options.authToken) {
|
|
7680
|
-
throw new
|
|
8432
|
+
throw new InvalidArgumentError3({
|
|
7681
8433
|
argument: "apiKey/authToken",
|
|
7682
8434
|
message: "Both apiKey and authToken were provided. Please use only one authentication method."
|
|
7683
8435
|
});
|
|
@@ -7696,7 +8448,7 @@ function createAnthropic(options = {}) {
|
|
|
7696
8448
|
...authHeaders,
|
|
7697
8449
|
...options.headers
|
|
7698
8450
|
},
|
|
7699
|
-
`ai-sdk
|
|
8451
|
+
`ai-sdk-anthropic/${VERSION}`
|
|
7700
8452
|
);
|
|
7701
8453
|
};
|
|
7702
8454
|
const languageModelConfig = {
|
|
@@ -7704,7 +8456,7 @@ function createAnthropic(options = {}) {
|
|
|
7704
8456
|
baseURL,
|
|
7705
8457
|
headers: getHeaders,
|
|
7706
8458
|
fetch: options.fetch,
|
|
7707
|
-
generateId:
|
|
8459
|
+
generateId: options.generateId ?? generateId3,
|
|
7708
8460
|
supportedUrls: () => supportedUrls
|
|
7709
8461
|
};
|
|
7710
8462
|
const createChatModel = (modelId) => new AnthropicLanguageModel(modelId, languageModelConfig);
|
|
@@ -7731,6 +8483,10 @@ function createAnthropic(options = {}) {
|
|
|
7731
8483
|
provider.languageModel = createChatModel;
|
|
7732
8484
|
provider.chat = createChatModel;
|
|
7733
8485
|
provider.messages = createChatModel;
|
|
8486
|
+
provider.evaluationModel = (modelId) => new EvaluationLanguageModel({
|
|
8487
|
+
model: createChatModel(modelId),
|
|
8488
|
+
provider: `${providerName.replace(/\.messages$/, "")}.evaluation`
|
|
8489
|
+
});
|
|
7734
8490
|
provider.experimental_batch = createBatch;
|
|
7735
8491
|
provider.embeddingModel = (modelId) => {
|
|
7736
8492
|
throw new NoSuchModelError({ modelId, modelType: "embeddingModel" });
|
|
@@ -7755,9 +8511,8 @@ var anthropic = createAnthropic();
|
|
|
7755
8511
|
function forwardAnthropicContainerIdFromLastStep({
|
|
7756
8512
|
steps
|
|
7757
8513
|
}) {
|
|
7758
|
-
var _a, _b, _c;
|
|
7759
8514
|
for (let i = steps.length - 1; i >= 0; i--) {
|
|
7760
|
-
const containerId =
|
|
8515
|
+
const containerId = steps[i].providerMetadata?.anthropic?.container?.id;
|
|
7761
8516
|
if (containerId) {
|
|
7762
8517
|
return {
|
|
7763
8518
|
providerOptions: {
|
|
@@ -7768,7 +8523,6 @@ function forwardAnthropicContainerIdFromLastStep({
|
|
|
7768
8523
|
};
|
|
7769
8524
|
}
|
|
7770
8525
|
}
|
|
7771
|
-
return void 0;
|
|
7772
8526
|
}
|
|
7773
8527
|
export {
|
|
7774
8528
|
VERSION,
|