@jsonstudio/rcc 0.90.367 → 0.90.701
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/config/providers/ali-coding-plan.json +5 -0
- package/dist/build-info.js +2 -2
- package/dist/cli/commands/codex.js +37 -35
- package/dist/cli/commands/codex.js.map +1 -1
- package/dist/cli/commands/heartbeat.d.ts +20 -0
- package/dist/cli/commands/heartbeat.js +322 -0
- package/dist/cli/commands/heartbeat.js.map +1 -0
- package/dist/cli/commands/launcher/types.d.ts +1 -1
- package/dist/cli/commands/launcher/utils.js +28 -2
- package/dist/cli/commands/launcher/utils.js.map +1 -1
- package/dist/cli/commands/launcher-kernel.js +226 -82
- package/dist/cli/commands/launcher-kernel.js.map +1 -1
- package/dist/cli/commands/start.js +5 -3
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/register/heartbeat-command.d.ts +3 -0
- package/dist/cli/register/heartbeat-command.js +5 -0
- package/dist/cli/register/heartbeat-command.js.map +1 -0
- package/dist/cli.js +12 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/validate.js +34 -13
- package/dist/commands/validate.js.map +1 -1
- package/dist/config/system-prompts/codex-cli.txt +1 -1
- package/dist/config/user-data-paths.d.ts +1 -0
- package/dist/config/user-data-paths.js +43 -3
- package/dist/config/user-data-paths.js.map +1 -1
- package/dist/index.js +31 -12
- package/dist/index.js.map +1 -1
- package/dist/manager/modules/quota/antigravity-quota-manager.js +50 -37
- package/dist/manager/modules/quota/antigravity-quota-manager.js.map +1 -1
- package/dist/manager/modules/quota/antigravity-quota-persistence.js +38 -21
- package/dist/manager/modules/quota/antigravity-quota-persistence.js.map +1 -1
- package/dist/manager/modules/quota/antigravity-quota-runtime.js +20 -11
- package/dist/manager/modules/quota/antigravity-quota-runtime.js.map +1 -1
- package/dist/manager/modules/quota/quota-adapter.js +28 -12
- package/dist/manager/modules/quota/quota-adapter.js.map +1 -1
- package/dist/manager/quota/provider-quota-store.js +32 -18
- package/dist/manager/quota/provider-quota-store.js.map +1 -1
- package/dist/manager/storage/file-store.js +15 -9
- package/dist/manager/storage/file-store.js.map +1 -1
- package/dist/modules/llmswitch/bridge/index.d.ts +2 -2
- package/dist/modules/llmswitch/bridge/index.js +2 -2
- package/dist/modules/llmswitch/bridge/index.js.map +1 -1
- package/dist/modules/llmswitch/bridge/module-loader.js +2 -2
- package/dist/modules/llmswitch/bridge/module-loader.js.map +1 -1
- package/dist/modules/llmswitch/bridge/quota-manager.js +1 -1
- package/dist/modules/llmswitch/bridge/quota-manager.js.map +1 -1
- package/dist/modules/llmswitch/bridge/runtime-integrations.d.ts +1 -1
- package/dist/modules/llmswitch/bridge/runtime-integrations.js +1 -1
- package/dist/modules/llmswitch/bridge/runtime-integrations.js.map +1 -1
- package/dist/modules/llmswitch/bridge/snapshot-recorder.d.ts +1 -0
- package/dist/modules/llmswitch/bridge/snapshot-recorder.js +227 -24
- package/dist/modules/llmswitch/bridge/snapshot-recorder.js.map +1 -1
- package/dist/modules/llmswitch/bridge/state-integrations.d.ts +46 -0
- package/dist/modules/llmswitch/bridge/state-integrations.js +171 -0
- package/dist/modules/llmswitch/bridge/state-integrations.js.map +1 -1
- package/dist/modules/llmswitch/bridge.d.ts +7 -7
- package/dist/modules/llmswitch/bridge.js +2 -2
- package/dist/modules/llmswitch/bridge.js.map +1 -1
- package/dist/modules/llmswitch/core-loader.js +24 -35
- package/dist/modules/llmswitch/core-loader.js.map +1 -1
- package/dist/providers/auth/apikey-auth.d.ts +1 -0
- package/dist/providers/auth/apikey-auth.js +7 -2
- package/dist/providers/auth/apikey-auth.js.map +1 -1
- package/dist/providers/auth/oauth-auth.js +5 -3
- package/dist/providers/auth/oauth-auth.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle.js +84 -34
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/auth/tokenfile-auth.js +22 -12
- package/dist/providers/auth/tokenfile-auth.js.map +1 -1
- package/dist/providers/core/api/provider-types.d.ts +16 -0
- package/dist/providers/core/runtime/provider-factory-helpers.js +25 -3
- package/dist/providers/core/runtime/provider-factory-helpers.js.map +1 -1
- package/dist/providers/core/runtime/transport/request-header-builder.d.ts +8 -0
- package/dist/providers/core/runtime/transport/request-header-builder.js +129 -9
- package/dist/providers/core/runtime/transport/request-header-builder.js.map +1 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/openai-sdk-transport.d.ts +2 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/openai-sdk-transport.js +28 -2
- package/dist/providers/core/runtime/vercel-ai-sdk/openai-sdk-transport.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +3 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/utils/snapshot-writer.js +36 -27
- package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
- package/dist/providers/mock/mock-provider-runtime.js +1 -1
- package/dist/providers/mock/mock-provider-runtime.js.map +1 -1
- package/dist/server/handlers/handler-response-utils.js +155 -17
- package/dist/server/handlers/handler-response-utils.js.map +1 -1
- package/dist/server/handlers/handler-utils.js +18 -10
- package/dist/server/handlers/handler-utils.js.map +1 -1
- package/dist/server/handlers/types.d.ts +4 -0
- package/dist/server/runtime/http-server/clock-runtime-hooks.js +133 -37
- package/dist/server/runtime/http-server/clock-runtime-hooks.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js +0 -30
- package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js +1 -113
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/status-handler.js +11 -2
- package/dist/server/runtime/http-server/daemon-admin/status-handler.js.map +1 -1
- package/dist/server/runtime/http-server/executor/client-injection-flow.js +9 -8
- package/dist/server/runtime/http-server/executor/client-injection-flow.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-response-converter.js +35 -140
- package/dist/server/runtime/http-server/executor/provider-response-converter.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js +11 -1
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js.map +1 -1
- package/dist/server/runtime/http-server/executor-metadata.js +60 -6
- package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
- package/dist/server/runtime/http-server/executor-pipeline.js +24 -1
- package/dist/server/runtime/http-server/executor-pipeline.js.map +1 -1
- package/dist/server/runtime/http-server/executor-provider.js +1 -1
- package/dist/server/runtime/http-server/executor-provider.js.map +1 -1
- package/dist/server/runtime/http-server/executor-response.js +1 -62
- package/dist/server/runtime/http-server/executor-response.js.map +1 -1
- package/dist/server/runtime/http-server/heartbeat-runtime-hooks.d.ts +23 -0
- package/dist/server/runtime/http-server/heartbeat-runtime-hooks.js +248 -0
- package/dist/server/runtime/http-server/heartbeat-runtime-hooks.js.map +1 -0
- package/dist/server/runtime/http-server/http-server-legacy-pipeline.js +6 -2
- package/dist/server/runtime/http-server/http-server-legacy-pipeline.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-lifecycle.js +18 -0
- package/dist/server/runtime/http-server/http-server-lifecycle.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-runtime-providers.js +14 -0
- package/dist/server/runtime/http-server/http-server-runtime-providers.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-runtime-setup.js +2 -0
- package/dist/server/runtime/http-server/http-server-runtime-setup.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-session-daemon.d.ts +1 -0
- package/dist/server/runtime/http-server/http-server-session-daemon.js +34 -8
- package/dist/server/runtime/http-server/http-server-session-daemon.js.map +1 -1
- package/dist/server/runtime/http-server/index.d.ts +1 -0
- package/dist/server/runtime/http-server/index.js +38 -2
- package/dist/server/runtime/http-server/index.js.map +1 -1
- package/dist/server/runtime/http-server/request-activity-tracker.d.ts +7 -0
- package/dist/server/runtime/http-server/request-activity-tracker.js +58 -0
- package/dist/server/runtime/http-server/request-activity-tracker.js.map +1 -0
- package/dist/server/runtime/http-server/request-executor.d.ts +7 -0
- package/dist/server/runtime/http-server/request-executor.js +554 -472
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-reaper.js +9 -2
- package/dist/server/runtime/http-server/session-client-reaper.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-registry-utils.d.ts +1 -0
- package/dist/server/runtime/http-server/session-client-registry-utils.js +10 -2
- package/dist/server/runtime/http-server/session-client-registry-utils.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-registry.d.ts +3 -0
- package/dist/server/runtime/http-server/session-client-registry.js +32 -1
- package/dist/server/runtime/http-server/session-client-registry.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-route-utils.js +5 -38
- package/dist/server/runtime/http-server/session-client-route-utils.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-routes.js +154 -3
- package/dist/server/runtime/http-server/session-client-routes.js.map +1 -1
- package/dist/server/runtime/http-server/session-execution-state.d.ts +47 -0
- package/dist/server/runtime/http-server/session-execution-state.js +328 -0
- package/dist/server/runtime/http-server/session-execution-state.js.map +1 -0
- package/dist/server/runtime/http-server/session-scope-resolution.d.ts +2 -0
- package/dist/server/runtime/http-server/session-scope-resolution.js +98 -4
- package/dist/server/runtime/http-server/session-scope-resolution.js.map +1 -1
- package/dist/server/runtime/http-server/session-storage-cleanup.d.ts +19 -0
- package/dist/server/runtime/http-server/session-storage-cleanup.js +325 -0
- package/dist/server/runtime/http-server/session-storage-cleanup.js.map +1 -0
- package/dist/server/runtime/http-server/tmux-injection-history.d.ts +12 -0
- package/dist/server/runtime/http-server/tmux-injection-history.js +94 -0
- package/dist/server/runtime/http-server/tmux-injection-history.js.map +1 -0
- package/dist/server/runtime/http-server/tmux-injection-runtime-config.d.ts +42 -0
- package/dist/server/runtime/http-server/tmux-injection-runtime-config.js +245 -0
- package/dist/server/runtime/http-server/tmux-injection-runtime-config.js.map +1 -0
- package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.d.ts +21 -0
- package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.js +59 -0
- package/dist/server/runtime/http-server/tmux-scope-cleanup-policy.js.map +1 -0
- package/dist/server/runtime/http-server/tmux-session-probe.d.ts +2 -0
- package/dist/server/runtime/http-server/tmux-session-probe.js +112 -2
- package/dist/server/runtime/http-server/tmux-session-probe.js.map +1 -1
- package/dist/server/utils/request-id-manager.d.ts +8 -0
- package/dist/server/utils/request-id-manager.js +116 -27
- package/dist/server/utils/request-id-manager.js.map +1 -1
- package/dist/server/utils/request-log-color.d.ts +1 -0
- package/dist/server/utils/request-log-color.js +12 -1
- package/dist/server/utils/request-log-color.js.map +1 -1
- package/dist/server/utils/stage-logger.js +37 -3
- package/dist/server/utils/stage-logger.js.map +1 -1
- package/dist/server-lifecycle/port-utils.js +38 -7
- package/dist/server-lifecycle/port-utils.js.map +1 -1
- package/dist/tools/semantic-replay-snapshot-loader.js +2 -2
- package/dist/tools/semantic-replay-snapshot-loader.js.map +1 -1
- package/dist/utils/errorsamples.js +181 -1
- package/dist/utils/errorsamples.js.map +1 -1
- package/dist/utils/snapshot-writer.js +18 -12
- package/dist/utils/snapshot-writer.js.map +1 -1
- package/docs/ARCHITECTURE.md +8 -0
- package/docs/CLOCK.md +51 -0
- package/docs/INSTRUCTION_MARKUP.md +28 -2
- package/docs/design/heartbeat-session-execution-state.md +227 -0
- package/docs/reports/apply-patch-errorsamples-classification.md +144 -0
- package/docs/session-client-daemon-design.md +92 -0
- package/package.json +9 -7
- package/scripts/analyze-thinking-keywords.mjs +1 -1
- package/scripts/ci/repo-sanity.mjs +38 -32
- package/scripts/ensure-llmswitch-mode.mjs +63 -5
- package/scripts/install-global.sh +23 -0
- package/scripts/install-release.sh +55 -5
- package/scripts/install-verify.mjs +143 -18
- package/scripts/link-global-llms-local.mjs +108 -0
- package/scripts/link-llmswitch.mjs +56 -0
- package/scripts/pack-mode.mjs +39 -16
- package/scripts/pack-rcc.mjs +63 -4
- package/scripts/publish-rcc.mjs +59 -4
- package/scripts/snapshot-inspect.mjs +5 -24
- package/scripts/tests/blackbox-rcc-vs-routecodex-antigravity.mjs +2 -2
- package/scripts/vendor-core.mjs +9 -30
- package/vendor/llmswitch-core/README.md +0 -271
- package/vendor/llmswitch-core/dist/bridge/routecodex-adapter.d.ts +0 -74
- package/vendor/llmswitch-core/dist/bridge/routecodex-adapter.js +0 -229
- package/vendor/llmswitch-core/dist/config-unified/enhanced-path-resolver.d.ts +0 -5
- package/vendor/llmswitch-core/dist/config-unified/enhanced-path-resolver.js +0 -46
- package/vendor/llmswitch-core/dist/config-unified/unified-config.d.ts +0 -26
- package/vendor/llmswitch-core/dist/config-unified/unified-config.js +0 -231
- package/vendor/llmswitch-core/dist/conversion/args-mapping.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/args-mapping.js +0 -8
- package/vendor/llmswitch-core/dist/conversion/bridge-actions.d.ts +0 -39
- package/vendor/llmswitch-core/dist/conversion/bridge-actions.js +0 -82
- package/vendor/llmswitch-core/dist/conversion/bridge-id-utils.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/bridge-id-utils.js +0 -13
- package/vendor/llmswitch-core/dist/conversion/bridge-instructions.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/bridge-instructions.js +0 -17
- package/vendor/llmswitch-core/dist/conversion/bridge-message-utils.d.ts +0 -23
- package/vendor/llmswitch-core/dist/conversion/bridge-message-utils.js +0 -45
- package/vendor/llmswitch-core/dist/conversion/bridge-metadata.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/bridge-metadata.js +0 -5
- package/vendor/llmswitch-core/dist/conversion/bridge-policies.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/bridge-policies.js +0 -11
- package/vendor/llmswitch-core/dist/conversion/codec-registry.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/codec-registry.js +0 -37
- package/vendor/llmswitch-core/dist/conversion/codecs/anthropic-openai-codec.d.ts +0 -22
- package/vendor/llmswitch-core/dist/conversion/codecs/anthropic-openai-codec.js +0 -52
- package/vendor/llmswitch-core/dist/conversion/codecs/gemini-openai-codec.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/codecs/gemini-openai-codec.js +0 -85
- package/vendor/llmswitch-core/dist/conversion/codecs/openai-openai-codec.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/codecs/openai-openai-codec.js +0 -54
- package/vendor/llmswitch-core/dist/conversion/codecs/responses-openai-codec.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/codecs/responses-openai-codec.js +0 -66
- package/vendor/llmswitch-core/dist/conversion/compaction-detect.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compaction-detect.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-system-prompt.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-system-prompt.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-user-id.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/anthropic-claude-code-user-id.js +0 -30
- package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-cache.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-cache.js +0 -8
- package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-prepare.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/antigravity-thought-signature-prepare.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/compat/actions/apply-patch-fixer.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/compat/actions/apply-patch-fixer.js +0 -30
- package/vendor/llmswitch-core/dist/conversion/compat/actions/auto-thinking.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/compat/actions/auto-thinking.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/compat/actions/claude-thinking-tools.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/claude-thinking-tools.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-request.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-request.js +0 -62
- package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-response.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/compat/actions/deepseek-web-response.js +0 -114
- package/vendor/llmswitch-core/dist/conversion/compat/actions/field-mapping.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/compat/actions/field-mapping.js +0 -155
- package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-cli-request.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-cli-request.js +0 -27
- package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-web-search.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/gemini-web-search.js +0 -24
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-history-image-trim.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-history-image-trim.js +0 -54
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-image-content.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-image-content.js +0 -54
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-native-compat.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-native-compat.js +0 -34
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-tool-extraction.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-tool-extraction.js +0 -35
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-vision-prompt.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-vision-prompt.js +0 -104
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-web-search.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/glm-web-search.js +0 -30
- package/vendor/llmswitch-core/dist/conversion/compat/actions/harvest-tool-calls-from-text.d.ts +0 -15
- package/vendor/llmswitch-core/dist/conversion/compat/actions/harvest-tool-calls-from-text.js +0 -124
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-cli-defaults.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-cli-defaults.js +0 -31
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.js +0 -25
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.js +0 -46
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-native-compat.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-native-compat.js +0 -36
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-response-body-unwrap.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-response-body-unwrap.js +0 -25
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-tool-text-fallback.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-tool-text-fallback.js +0 -29
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-web-search.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/compat/actions/iflow-web-search.js +0 -49
- package/vendor/llmswitch-core/dist/conversion/compat/actions/index.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/index.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-fc-ids.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-fc-ids.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-input-stringify.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/compat/actions/lmstudio-responses-input-stringify.js +0 -125
- package/vendor/llmswitch-core/dist/conversion/compat/actions/normalize-tool-call-ids.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/normalize-tool-call-ids.js +0 -10
- package/vendor/llmswitch-core/dist/conversion/compat/actions/qwen-transform.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/qwen-transform.js +0 -40
- package/vendor/llmswitch-core/dist/conversion/compat/actions/request-rules.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/compat/actions/request-rules.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-blacklist.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-blacklist.js +0 -10
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-normalize.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-normalize.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-validate.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/compat/actions/response-validate.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/snapshot.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/compat/actions/snapshot.js +0 -21
- package/vendor/llmswitch-core/dist/conversion/compat/actions/strip-orphan-function-calls-tag.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/compat/actions/strip-orphan-function-calls-tag.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-schema.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-schema.js +0 -91
- package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-text-request-guidance.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/compat/actions/tool-text-request-guidance.js +0 -7
- package/vendor/llmswitch-core/dist/conversion/compat/actions/universal-shape-filter.d.ts +0 -57
- package/vendor/llmswitch-core/dist/conversion/compat/actions/universal-shape-filter.js +0 -14
- package/vendor/llmswitch-core/dist/conversion/compat/antigravity-session-signature.d.ts +0 -86
- package/vendor/llmswitch-core/dist/conversion/compat/antigravity-session-signature.js +0 -1143
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/anthropic-claude-code.json +0 -17
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-claude-code.json +0 -18
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-deepseek-web.json +0 -47
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-gemini-cli.json +0 -23
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-gemini.json +0 -31
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-glm.json +0 -405
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-iflow.json +0 -353
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-lmstudio.json +0 -80
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/chat-qwen.json +0 -22
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-c4m.json +0 -45
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-crs.json +0 -15
- package/vendor/llmswitch-core/dist/conversion/compat/profiles/responses-output2choices-test.json +0 -12
- package/vendor/llmswitch-core/dist/conversion/config/config-manager.d.ts +0 -212
- package/vendor/llmswitch-core/dist/conversion/config/config-manager.js +0 -310
- package/vendor/llmswitch-core/dist/conversion/config/sample-config.json +0 -314
- package/vendor/llmswitch-core/dist/conversion/config/version-switch.json +0 -150
- package/vendor/llmswitch-core/dist/conversion/hub/config/types.d.ts +0 -26
- package/vendor/llmswitch-core/dist/conversion/hub/config/types.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/core/detour-registry.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/hub/core/detour-registry.js +0 -23
- package/vendor/llmswitch-core/dist/conversion/hub/core/hub-context.d.ts +0 -23
- package/vendor/llmswitch-core/dist/conversion/hub/core/hub-context.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/core/index.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/core/index.js +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/core/stage-driver.d.ts +0 -30
- package/vendor/llmswitch-core/dist/conversion/hub/core/stage-driver.js +0 -33
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/anthropic-format-adapter.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/anthropic-format-adapter.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/chat-format-adapter.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/chat-format-adapter.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/gemini-format-adapter.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/gemini-format-adapter.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/index.d.ts +0 -21
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/index.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/responses-format-adapter.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/hub/format-adapters/responses-format-adapter.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/hub/hub-feature.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/hub-feature.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/hub/node-support.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/hub/node-support.js +0 -136
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/operation-table-runner.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/operation-table-runner.js +0 -162
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper.js +0 -503
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/archive/chat-mapper.archive.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/archive/chat-mapper.archive.js +0 -409
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/chat-mapper.js +0 -350
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper.js +0 -1540
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.d.ts +0 -21
- package/vendor/llmswitch-core/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +0 -491
- package/vendor/llmswitch-core/dist/conversion/hub/ops/operations.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/hub/ops/operations.js +0 -7
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-engine.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-engine.js +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-pipeline-executor.js +0 -46
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-resolver.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-resolver.js +0 -14
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-store.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-profile-store.js +0 -94
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-types.d.ts +0 -175
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/compat-types.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/native-adapter-context.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/compat/native-adapter-context.js +0 -40
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-pipeline.d.ts +0 -111
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-pipeline.js +0 -1927
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-stage-timing.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/hub-stage-timing.js +0 -211
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/session-identifiers.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/session-identifiers.js +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage1_format_parse/index.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage1_format_parse/index.js +0 -236
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +0 -132
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/semantic-lift.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/semantic-lift.js +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/archive/shell-like-tool-call-normalization-fallback.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/archive/shell-like-tool-call-normalization-fallback.js +0 -157
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-capture-orchestration.js +0 -29
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-factories.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/context-factories.js +0 -19
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/index.js +0 -22
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.js +0 -28
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-diagnostics.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-diagnostics.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-snapshot.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/tool-output-snapshot.js +0 -12
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/context-merge.js +0 -30
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage1_semantic_map/index.js +0 -84
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage2_format_build/index.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage2_format_build/index.js +0 -12
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.js +0 -45
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage1_tool_governance/index.js +0 -62
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/req_process/req_process_stage2_route_select/index.js +0 -35
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/index.js +0 -243
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/stream-json-sniffer.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage1_sse_decode/stream-json-sniffer.js +0 -81
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage2_format_parse/index.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage2_format_parse/index.js +0 -50
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage3_semantic_map/index.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_inbound/resp_inbound_stage3_semantic_map/index.js +0 -25
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.js +0 -17
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.js +0 -103
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.js +0 -30
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage2_sse_stream/index.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage2_sse_stream/index.js +0 -35
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +0 -52
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.js +0 -40
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.d.ts +0 -44
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.js +0 -88
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/utils.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/stages/utils.js +0 -27
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/target-utils.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/pipeline/target-utils.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/hub/pipelines/inbound.d.ts +0 -22
- package/vendor/llmswitch-core/dist/conversion/hub/pipelines/inbound.js +0 -66
- package/vendor/llmswitch-core/dist/conversion/hub/pipelines/outbound.d.ts +0 -22
- package/vendor/llmswitch-core/dist/conversion/hub/pipelines/outbound.js +0 -59
- package/vendor/llmswitch-core/dist/conversion/hub/policy/policy-engine.d.ts +0 -48
- package/vendor/llmswitch-core/dist/conversion/hub/policy/policy-engine.js +0 -269
- package/vendor/llmswitch-core/dist/conversion/hub/policy/protocol-spec.d.ts +0 -75
- package/vendor/llmswitch-core/dist/conversion/hub/policy/protocol-spec.js +0 -27
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-anthropic-alias.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-anthropic-alias.js +0 -36
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directive-parser.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directive-parser.js +0 -56
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directives.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-directives.js +0 -98
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-directives.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-directives.js +0 -42
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-finalize.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-finalize.js +0 -10
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-messages.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-messages.js +0 -10
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-orchestration.d.ts +0 -30
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-orchestration.js +0 -68
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-time-tag.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminder-time-tag.js +0 -18
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminders.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-reminders.js +0 -104
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tool-schemas.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tool-schemas.js +0 -280
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tools.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-clock-tools.js +0 -41
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-continue-execution.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-continue-execution.js +0 -83
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-context.d.ts +0 -15
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-context.js +0 -7
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-finalize.d.ts +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-finalize.js +0 -11
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-orchestration.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governance-orchestration.js +0 -49
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-control-ops.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-control-ops.js +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-filter-call.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-filter-call.js +0 -18
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-merge.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-governed-merge.js +0 -11
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-media.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-media.js +0 -108
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-node-result.d.ts +0 -23
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-node-result.js +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-pending-tool-sync.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-pending-tool-sync.js +0 -52
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-post-governed-normalization.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-post-governed-normalization.js +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-review.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-review.js +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-servertool-orchestration.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-servertool-orchestration.js +0 -22
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-session-usage.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-session-usage.js +0 -147
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-tool-normalization.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-tool-normalization.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-intent.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-intent.js +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-tool-schema.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search-tool-schema.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process-web-search.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process.d.ts +0 -15
- package/vendor/llmswitch-core/dist/conversion/hub/process/chat-process.js +0 -27
- package/vendor/llmswitch-core/dist/conversion/hub/process/client-inject-readiness.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/process/client-inject-readiness.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/registry.d.ts +0 -28
- package/vendor/llmswitch-core/dist/conversion/hub/registry.js +0 -101
- package/vendor/llmswitch-core/dist/conversion/hub/response/chat-response-utils.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/response/chat-response-utils.js +0 -8
- package/vendor/llmswitch-core/dist/conversion/hub/response/provider-response.d.ts +0 -51
- package/vendor/llmswitch-core/dist/conversion/hub/response/provider-response.js +0 -529
- package/vendor/llmswitch-core/dist/conversion/hub/response/response-mappers.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/response/response-mappers.js +0 -73
- package/vendor/llmswitch-core/dist/conversion/hub/response/response-runtime.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/response/response-runtime.js +0 -758
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/anthropic-mapper.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/anthropic-mapper.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/chat-mapper.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/chat-mapper.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/gemini-mapper.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/gemini-mapper.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/index.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/index.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/responses-mapper.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/semantic-mappers/responses-mapper.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/snapshot-recorder.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/snapshot-recorder.js +0 -38
- package/vendor/llmswitch-core/dist/conversion/hub/standardized-bridge.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/hub/standardized-bridge.js +0 -16
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/engine.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/engine.js +0 -118
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/index.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/index.js +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/rules.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/rules.js +0 -80
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/types.d.ts +0 -38
- package/vendor/llmswitch-core/dist/conversion/hub/tool-governance/types.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/tool-session-compat.d.ts +0 -26
- package/vendor/llmswitch-core/dist/conversion/hub/tool-session-compat.js +0 -86
- package/vendor/llmswitch-core/dist/conversion/hub/tool-surface/tool-surface-engine.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/hub/tool-surface/tool-surface-engine.js +0 -574
- package/vendor/llmswitch-core/dist/conversion/hub/types/chat-envelope.d.ts +0 -79
- package/vendor/llmswitch-core/dist/conversion/hub/types/chat-envelope.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/types/chat-schema.d.ts +0 -112
- package/vendor/llmswitch-core/dist/conversion/hub/types/chat-schema.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/types/errors.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/hub/types/errors.js +0 -13
- package/vendor/llmswitch-core/dist/conversion/hub/types/format-envelope.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/hub/types/format-envelope.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/types/index.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/types/index.js +0 -6
- package/vendor/llmswitch-core/dist/conversion/hub/types/json.d.ts +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/types/json.js +0 -9
- package/vendor/llmswitch-core/dist/conversion/hub/types/node.d.ts +0 -31
- package/vendor/llmswitch-core/dist/conversion/hub/types/node.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/hub/types/standardized.d.ts +0 -99
- package/vendor/llmswitch-core/dist/conversion/hub/types/standardized.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/index.d.ts +0 -33
- package/vendor/llmswitch-core/dist/conversion/index.js +0 -33
- package/vendor/llmswitch-core/dist/conversion/jsonish.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/jsonish.js +0 -20
- package/vendor/llmswitch-core/dist/conversion/mcp-injection.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/mcp-injection.js +0 -7
- package/vendor/llmswitch-core/dist/conversion/media.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/media.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/metadata-passthrough.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/metadata-passthrough.js +0 -20
- package/vendor/llmswitch-core/dist/conversion/payload-budget.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/payload-budget.js +0 -47
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/anthropic-openai-pipeline.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/anthropic-openai-pipeline.js +0 -104
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/openai-openai-pipeline.d.ts +0 -15
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/openai-openai-pipeline.js +0 -176
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/responses-openai-pipeline.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/responses-openai-pipeline.js +0 -212
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/shared/openai-chat-helpers.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/pipeline/codecs/v2/shared/openai-chat-helpers.js +0 -34
- package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/adapter-context.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/adapter-context.js +0 -18
- package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/protocol-hooks.d.ts +0 -67
- package/vendor/llmswitch-core/dist/conversion/pipeline/hooks/protocol-hooks.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/pipeline/index.d.ts +0 -35
- package/vendor/llmswitch-core/dist/conversion/pipeline/index.js +0 -103
- package/vendor/llmswitch-core/dist/conversion/pipeline/meta/meta-bag.d.ts +0 -20
- package/vendor/llmswitch-core/dist/conversion/pipeline/meta/meta-bag.js +0 -81
- package/vendor/llmswitch-core/dist/conversion/pipeline/schema/canonical-chat.d.ts +0 -18
- package/vendor/llmswitch-core/dist/conversion/pipeline/schema/canonical-chat.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/pipeline/schema/index.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/pipeline/schema/index.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/protocol-field-allowlists.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/protocol-field-allowlists.js +0 -9
- package/vendor/llmswitch-core/dist/conversion/protocol-state.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/protocol-state.js +0 -27
- package/vendor/llmswitch-core/dist/conversion/provider-protocol-error.d.ts +0 -17
- package/vendor/llmswitch-core/dist/conversion/provider-protocol-error.js +0 -25
- package/vendor/llmswitch-core/dist/conversion/responses/responses-host-policy.d.ts +0 -6
- package/vendor/llmswitch-core/dist/conversion/responses/responses-host-policy.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/response-payload.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/response-payload.js +0 -190
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/types.d.ts +0 -35
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge/types.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge.d.ts +0 -15
- package/vendor/llmswitch-core/dist/conversion/responses/responses-openai-bridge.js +0 -475
- package/vendor/llmswitch-core/dist/conversion/runtime-metadata.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/runtime-metadata.js +0 -31
- package/vendor/llmswitch-core/dist/conversion/schema-validator.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/schema-validator.js +0 -67
- package/vendor/llmswitch-core/dist/conversion/shared/anthropic-message-utils.d.ts +0 -22
- package/vendor/llmswitch-core/dist/conversion/shared/anthropic-message-utils.js +0 -1416
- package/vendor/llmswitch-core/dist/conversion/shared/chat-envelope-validator.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/shared/chat-envelope-validator.js +0 -4
- package/vendor/llmswitch-core/dist/conversion/shared/chat-output-normalizer.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/shared/chat-output-normalizer.js +0 -10
- package/vendor/llmswitch-core/dist/conversion/shared/chat-request-filters.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/shared/chat-request-filters.js +0 -63
- package/vendor/llmswitch-core/dist/conversion/shared/gemini-tool-utils.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/shared/gemini-tool-utils.js +0 -20
- package/vendor/llmswitch-core/dist/conversion/shared/openai-finalizer.d.ts +0 -8
- package/vendor/llmswitch-core/dist/conversion/shared/openai-finalizer.js +0 -22
- package/vendor/llmswitch-core/dist/conversion/shared/openai-message-normalize.d.ts +0 -1
- package/vendor/llmswitch-core/dist/conversion/shared/openai-message-normalize.js +0 -151
- package/vendor/llmswitch-core/dist/conversion/shared/output-content-normalizer.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/shared/output-content-normalizer.js +0 -26
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-mapping.d.ts +0 -5
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-mapping.js +0 -7
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-normalizer.d.ts +0 -25
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-normalizer.js +0 -114
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-normalizer.d.ts +0 -12
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-normalizer.js +0 -22
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-parser.d.ts +0 -10
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-tool-parser.js +0 -11
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-utils.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/shared/reasoning-utils.js +0 -19
- package/vendor/llmswitch-core/dist/conversion/shared/responses-conversation-store.d.ts +0 -35
- package/vendor/llmswitch-core/dist/conversion/shared/responses-conversation-store.js +0 -195
- package/vendor/llmswitch-core/dist/conversion/shared/responses-output-builder.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/shared/responses-output-builder.js +0 -32
- package/vendor/llmswitch-core/dist/conversion/shared/responses-reasoning-registry.d.ts +0 -24
- package/vendor/llmswitch-core/dist/conversion/shared/responses-reasoning-registry.js +0 -185
- package/vendor/llmswitch-core/dist/conversion/shared/responses-request-adapter.d.ts +0 -7
- package/vendor/llmswitch-core/dist/conversion/shared/responses-request-adapter.js +0 -14
- package/vendor/llmswitch-core/dist/conversion/shared/responses-response-utils.d.ts +0 -3
- package/vendor/llmswitch-core/dist/conversion/shared/responses-response-utils.js +0 -254
- package/vendor/llmswitch-core/dist/conversion/shared/responses-tool-utils.d.ts +0 -14
- package/vendor/llmswitch-core/dist/conversion/shared/responses-tool-utils.js +0 -102
- package/vendor/llmswitch-core/dist/conversion/shared/streaming-text-extractor.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/shared/streaming-text-extractor.js +0 -39
- package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer/normalize.d.ts +0 -2
- package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer/normalize.js +0 -116
- package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer.d.ts +0 -4
- package/vendor/llmswitch-core/dist/conversion/shared/text-markup-normalizer.js +0 -3
- package/vendor/llmswitch-core/dist/conversion/shared/thought-signature-validator.d.ts +0 -52
- package/vendor/llmswitch-core/dist/conversion/shared/thought-signature-validator.js +0 -58
- package/vendor/llmswitch-core/dist/conversion/shared/tool-argument-repairer.d.ts +0 -39
- package/vendor/llmswitch-core/dist/conversion/shared/tool-argument-repairer.js +0 -53
- package/vendor/llmswitch-core/dist/conversion/shared/tool-call-id-manager.d.ts +0 -109
- package/vendor/llmswitch-core/dist/conversion/shared/tool-call-id-manager.js +0 -202
- package/vendor/llmswitch-core/dist/conversion/shared/tool-call-utils.d.ts +0 -11
- package/vendor/llmswitch-core/dist/conversion/shared/tool-call-utils.js +0 -14
- package/vendor/llmswitch-core/dist/conversion/shared/tool-filter-pipeline.d.ts +0 -21
- package/vendor/llmswitch-core/dist/conversion/shared/tool-filter-pipeline.js +0 -171
- package/vendor/llmswitch-core/dist/conversion/shared/tool-governor.d.ts +0 -29
- package/vendor/llmswitch-core/dist/conversion/shared/tool-governor.js +0 -694
- package/vendor/llmswitch-core/dist/conversion/shared/tool-harvester.d.ts +0 -31
- package/vendor/llmswitch-core/dist/conversion/shared/tool-harvester.js +0 -23
- package/vendor/llmswitch-core/dist/conversion/shared/tool-mapping.d.ts +0 -19
- package/vendor/llmswitch-core/dist/conversion/shared/tool-mapping.js +0 -65
- package/vendor/llmswitch-core/dist/conversion/shared/tooling.d.ts +0 -29
- package/vendor/llmswitch-core/dist/conversion/shared/tooling.js +0 -57
- package/vendor/llmswitch-core/dist/conversion/snapshot-utils.d.ts +0 -31
- package/vendor/llmswitch-core/dist/conversion/snapshot-utils.js +0 -49
- package/vendor/llmswitch-core/dist/conversion/types/bridge-message-types.d.ts +0 -41
- package/vendor/llmswitch-core/dist/conversion/types/bridge-message-types.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/types/text-markup-normalizer.d.ts +0 -13
- package/vendor/llmswitch-core/dist/conversion/types/text-markup-normalizer.js +0 -1
- package/vendor/llmswitch-core/dist/conversion/types.d.ts +0 -33
- package/vendor/llmswitch-core/dist/conversion/types.js +0 -1
- package/vendor/llmswitch-core/dist/filters/builtin/add-fields-filter.d.ts +0 -8
- package/vendor/llmswitch-core/dist/filters/builtin/add-fields-filter.js +0 -16
- package/vendor/llmswitch-core/dist/filters/builtin/blacklist-filter.d.ts +0 -8
- package/vendor/llmswitch-core/dist/filters/builtin/blacklist-filter.js +0 -19
- package/vendor/llmswitch-core/dist/filters/builtin/whitelist-filter.d.ts +0 -8
- package/vendor/llmswitch-core/dist/filters/builtin/whitelist-filter.js +0 -19
- package/vendor/llmswitch-core/dist/filters/config/openai-openai.fieldmap.json +0 -18
- package/vendor/llmswitch-core/dist/filters/engine.d.ts +0 -16
- package/vendor/llmswitch-core/dist/filters/engine.js +0 -167
- package/vendor/llmswitch-core/dist/filters/index.d.ts +0 -18
- package/vendor/llmswitch-core/dist/filters/index.js +0 -22
- package/vendor/llmswitch-core/dist/filters/special/request-tool-choice-policy.d.ts +0 -11
- package/vendor/llmswitch-core/dist/filters/special/request-tool-choice-policy.js +0 -29
- package/vendor/llmswitch-core/dist/filters/special/request-tool-list-filter.d.ts +0 -11
- package/vendor/llmswitch-core/dist/filters/special/request-tool-list-filter.js +0 -322
- package/vendor/llmswitch-core/dist/filters/special/request-toolcalls-stringify.d.ts +0 -13
- package/vendor/llmswitch-core/dist/filters/special/request-toolcalls-stringify.js +0 -94
- package/vendor/llmswitch-core/dist/filters/special/request-tools-normalize.d.ts +0 -11
- package/vendor/llmswitch-core/dist/filters/special/request-tools-normalize.js +0 -114
- package/vendor/llmswitch-core/dist/filters/special/response-finish-invariants.d.ts +0 -11
- package/vendor/llmswitch-core/dist/filters/special/response-finish-invariants.js +0 -30
- package/vendor/llmswitch-core/dist/filters/special/response-openai-to-responses-bridge.d.ts +0 -13
- package/vendor/llmswitch-core/dist/filters/special/response-openai-to-responses-bridge.js +0 -24
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-blacklist.d.ts +0 -12
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-blacklist.js +0 -63
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-schema-converge.d.ts +0 -13
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-schema-converge.js +0 -63
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-stringify.d.ts +0 -9
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-stringify.js +0 -132
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-whitelist.d.ts +0 -11
- package/vendor/llmswitch-core/dist/filters/special/response-tool-arguments-whitelist.js +0 -56
- package/vendor/llmswitch-core/dist/filters/special/response-tool-text-canonicalize.d.ts +0 -13
- package/vendor/llmswitch-core/dist/filters/special/response-tool-text-canonicalize.js +0 -16
- package/vendor/llmswitch-core/dist/filters/special/tool-filter-hooks.d.ts +0 -19
- package/vendor/llmswitch-core/dist/filters/special/tool-filter-hooks.js +0 -394
- package/vendor/llmswitch-core/dist/filters/special/tool-post-constraints.d.ts +0 -31
- package/vendor/llmswitch-core/dist/filters/special/tool-post-constraints.js +0 -120
- package/vendor/llmswitch-core/dist/filters/types.d.ts +0 -68
- package/vendor/llmswitch-core/dist/filters/types.js +0 -3
- package/vendor/llmswitch-core/dist/filters/utils/fieldmap-loader.d.ts +0 -2
- package/vendor/llmswitch-core/dist/filters/utils/fieldmap-loader.js +0 -16
- package/vendor/llmswitch-core/dist/filters/utils/snapshot-writer.d.ts +0 -10
- package/vendor/llmswitch-core/dist/filters/utils/snapshot-writer.js +0 -85
- package/vendor/llmswitch-core/dist/guidance/index.d.ts +0 -3
- package/vendor/llmswitch-core/dist/guidance/index.js +0 -299
- package/vendor/llmswitch-core/dist/http/sse-response.d.ts +0 -22
- package/vendor/llmswitch-core/dist/http/sse-response.js +0 -103
- package/vendor/llmswitch-core/dist/index.d.ts +0 -11
- package/vendor/llmswitch-core/dist/index.js +0 -11
- package/vendor/llmswitch-core/dist/native/router_hotpath_napi.node +0 -0
- package/vendor/llmswitch-core/dist/quota/apikey-reset.d.ts +0 -17
- package/vendor/llmswitch-core/dist/quota/apikey-reset.js +0 -43
- package/vendor/llmswitch-core/dist/quota/index.d.ts +0 -2
- package/vendor/llmswitch-core/dist/quota/index.js +0 -1
- package/vendor/llmswitch-core/dist/quota/quota-manager.d.ts +0 -44
- package/vendor/llmswitch-core/dist/quota/quota-manager.js +0 -463
- package/vendor/llmswitch-core/dist/quota/quota-state.d.ts +0 -6
- package/vendor/llmswitch-core/dist/quota/quota-state.js +0 -191
- package/vendor/llmswitch-core/dist/quota/types.d.ts +0 -62
- package/vendor/llmswitch-core/dist/quota/types.js +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/auth-utils.d.ts +0 -6
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/auth-utils.js +0 -288
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/claude-code-helpers.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/claude-code-helpers.js +0 -18
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-defaults.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-defaults.js +0 -13
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-normalizers.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/config-normalizers.js +0 -106
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/profile-builder.d.ts +0 -8
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/profile-builder.js +0 -87
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +0 -44
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/provider-normalization.js +0 -272
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/responses-helpers.d.ts +0 -15
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/responses-helpers.js +0 -65
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/routing-config.d.ts +0 -24
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/routing-config.js +0 -346
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/streaming-helpers.d.ts +0 -19
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/streaming-helpers.js +0 -172
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/utils.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/utils.js +0 -41
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/web-search-config.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap/web-search-config.js +0 -156
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/bootstrap.js +0 -329
- package/vendor/llmswitch-core/dist/router/virtual-router/classifier.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/classifier.js +0 -187
- package/vendor/llmswitch-core/dist/router/virtual-router/context-advisor.d.ts +0 -23
- package/vendor/llmswitch-core/dist/router/virtual-router/context-advisor.js +0 -67
- package/vendor/llmswitch-core/dist/router/virtual-router/context-weighted.d.ts +0 -31
- package/vendor/llmswitch-core/dist/router/virtual-router/context-weighted.js +0 -54
- package/vendor/llmswitch-core/dist/router/virtual-router/default-thinking-keywords.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/default-thinking-keywords.js +0 -13
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/antigravity/alias-lease.d.ts +0 -33
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/antigravity/alias-lease.js +0 -257
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/cooldown-manager.d.ts +0 -34
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/cooldown-manager.js +0 -118
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/health/index.d.ts +0 -23
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/health/index.js +0 -724
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/provider-key/parse.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/provider-key/parse.js +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/route-analytics.d.ts +0 -28
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/route-analytics.js +0 -44
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-pools/index.d.ts +0 -13
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-pools/index.js +0 -386
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/keys.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/keys.js +0 -30
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/metadata.d.ts +0 -6
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/metadata.js +0 -132
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/store.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/routing-state/store.js +0 -156
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/sticky-session-manager.d.ts +0 -29
- package/vendor/llmswitch-core/dist/router/virtual-router/engine/sticky-session-manager.js +0 -55
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-health.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-health.js +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/config.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/config.js +0 -108
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/direct-model.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/direct-model.js +0 -38
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/health.d.ts +0 -13
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/health.js +0 -104
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/helpers.d.ts +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/helpers.js +0 -226
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/route-utils.d.ts +0 -19
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/route-utils.js +0 -212
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-core.d.ts +0 -28
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-core.js +0 -112
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-state.d.ts +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/selection-state.js +0 -187
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/state-accessors.d.ts +0 -21
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy/state-accessors.js +0 -118
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy.d.ts +0 -123
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-legacy.js +0 -245
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-logging.d.ts +0 -67
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-logging.js +0 -356
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/alias-selection.d.ts +0 -15
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/alias-selection.js +0 -118
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/context-weight-multipliers.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/context-weight-multipliers.js +0 -23
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/direct-provider-model.d.ts +0 -9
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/direct-provider-model.js +0 -49
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/instruction-target.d.ts +0 -6
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/instruction-target.js +0 -54
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/key-parsing.d.ts +0 -8
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/key-parsing.js +0 -47
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/multimodal-capability.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/multimodal-capability.js +0 -26
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-directive-parser.d.ts +0 -24
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-directive-parser.js +0 -209
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-directives.d.ts +0 -7
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-directives.js +0 -121
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-orchestration-semantics.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-orchestration-semantics.js +0 -110
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-semantics.d.ts +0 -8
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-semantics.js +0 -281
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-time-tag-semantics.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-time-tag-semantics.js +0 -25
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminders-semantics.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminders-semantics.js +0 -44
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-tool-schema-semantics.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-clock-tool-schema-semantics.js +0 -62
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governance-semantics.d.ts +0 -49
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governance-semantics.js +0 -552
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.d.ts +0 -9
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-governed-filter-semantics.js +0 -64
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.js +0 -163
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-post-governed-normalization-semantics.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-post-governed-normalization-semantics.js +0 -49
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-servertool-orchestration-semantics.d.ts +0 -30
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-servertool-orchestration-semantics.js +0 -446
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-web-search-intent-semantics.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-process-web-search-intent-semantics.js +0 -49
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-chat-request-filter-semantics.js +0 -54
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-compat-action-semantics.d.ts +0 -22
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-compat-action-semantics.js +0 -559
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-deepseek-web-compat.d.ts +0 -17
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-deepseek-web-compat.js +0 -26
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.d.ts +0 -276
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics.js +0 -1291
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.d.ts +0 -72
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.js +0 -405
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.d.ts +0 -18
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.js +0 -333
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.d.ts +0 -30
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-governance-semantics.js +0 -202
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.d.ts +0 -22
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.js +0 -426
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics.d.ts +0 -57
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics.js +0 -705
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.d.ts +0 -53
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics.js +0 -598
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics.d.ts +0 -147
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics.js +0 -570
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-process-semantics.d.ts +0 -26
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-process-semantics.js +0 -148
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics.d.ts +0 -46
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics.js +0 -755
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-semantic-mappers.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-semantic-mappers.js +0 -83
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-session-identifiers-semantics.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-session-identifiers-semantics.js +0 -207
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-target-semantics.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-hub-pipeline-target-semantics.js +0 -128
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-analysis.d.ts +0 -57
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-analysis.js +0 -217
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-loader.js +0 -464
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-policy.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-policy.js +0 -18
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-quota-buckets.d.ts +0 -25
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath-quota-buckets.js +0 -85
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath.d.ts +0 -59
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-router-hotpath.js +0 -117
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +0 -243
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +0 -2594
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-snapshot-hooks.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-snapshot-hooks.js +0 -109
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-alias-selection-semantics.d.ts +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-alias-selection-semantics.js +0 -96
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.d.ts +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-engine-proxy.js +0 -14
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-routing-instructions-semantics.js +0 -123
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-actions-semantics.d.ts +0 -6
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-actions-semantics.js +0 -85
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-semantics.d.ts +0 -9
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-semantics.js +0 -70
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-state-semantics.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/native-virtual-router-stop-message-state-semantics.js +0 -76
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/route-utils.d.ts +0 -15
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/route-utils.js +0 -248
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/routing-state-filter.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/routing-state-filter.js +0 -50
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/selection-deps.d.ts +0 -58
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/selection-deps.js +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/sticky-pool.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/sticky-pool.js +0 -109
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-load-balancing.d.ts +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-load-balancing.js +0 -120
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-priority.d.ts +0 -11
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-priority.js +0 -55
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-session-lease.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-session-lease.js +0 -231
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-target-split.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-antigravity-target-split.js +0 -43
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.d.ts +0 -29
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-quota-integration.js +0 -194
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-select.d.ts +0 -22
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection-select.js +0 -352
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection/tier-selection.js +0 -309
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection.d.ts +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine-selection.js +0 -1
- package/vendor/llmswitch-core/dist/router/virtual-router/engine.d.ts +0 -43
- package/vendor/llmswitch-core/dist/router/virtual-router/engine.js +0 -360
- package/vendor/llmswitch-core/dist/router/virtual-router/error-center.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/error-center.js +0 -39
- package/vendor/llmswitch-core/dist/router/virtual-router/features.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/features.js +0 -124
- package/vendor/llmswitch-core/dist/router/virtual-router/health-manager.d.ts +0 -23
- package/vendor/llmswitch-core/dist/router/virtual-router/health-manager.js +0 -107
- package/vendor/llmswitch-core/dist/router/virtual-router/health-weighted.d.ts +0 -25
- package/vendor/llmswitch-core/dist/router/virtual-router/health-weighted.js +0 -63
- package/vendor/llmswitch-core/dist/router/virtual-router/load-balancer.d.ts +0 -28
- package/vendor/llmswitch-core/dist/router/virtual-router/load-balancer.js +0 -160
- package/vendor/llmswitch-core/dist/router/virtual-router/message-utils.d.ts +0 -15
- package/vendor/llmswitch-core/dist/router/virtual-router/message-utils.js +0 -235
- package/vendor/llmswitch-core/dist/router/virtual-router/pre-command-file-resolver.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/pre-command-file-resolver.js +0 -117
- package/vendor/llmswitch-core/dist/router/virtual-router/provider-registry.d.ts +0 -17
- package/vendor/llmswitch-core/dist/router/virtual-router/provider-registry.js +0 -145
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/clean.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/clean.js +0 -34
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/parse.d.ts +0 -6
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/parse.js +0 -24
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/state.d.ts +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/state.js +0 -284
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/types.d.ts +0 -74
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions/types.js +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions.d.ts +0 -5
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-instructions.js +0 -4
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-actions.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-actions.js +0 -26
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-parser.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-parser.js +0 -85
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-state-codec.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-pre-command-state-codec.js +0 -24
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-actions.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-actions.js +0 -99
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-parser.d.ts +0 -3
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-parser.js +0 -19
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-state-codec.d.ts +0 -7
- package/vendor/llmswitch-core/dist/router/virtual-router/routing-stop-message-state-codec.js +0 -121
- package/vendor/llmswitch-core/dist/router/virtual-router/sticky-session-store.d.ts +0 -8
- package/vendor/llmswitch-core/dist/router/virtual-router/sticky-session-store.js +0 -296
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-file-resolver.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-file-resolver.js +0 -76
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-stage-template-files.d.ts +0 -12
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-stage-template-files.js +0 -67
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-state-sync.d.ts +0 -17
- package/vendor/llmswitch-core/dist/router/virtual-router/stop-message-state-sync.js +0 -82
- package/vendor/llmswitch-core/dist/router/virtual-router/success-center.d.ts +0 -10
- package/vendor/llmswitch-core/dist/router/virtual-router/success-center.js +0 -32
- package/vendor/llmswitch-core/dist/router/virtual-router/token-counter.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/token-counter.js +0 -148
- package/vendor/llmswitch-core/dist/router/virtual-router/token-estimator.d.ts +0 -2
- package/vendor/llmswitch-core/dist/router/virtual-router/token-estimator.js +0 -16
- package/vendor/llmswitch-core/dist/router/virtual-router/token-file-scanner.d.ts +0 -24
- package/vendor/llmswitch-core/dist/router/virtual-router/token-file-scanner.js +0 -117
- package/vendor/llmswitch-core/dist/router/virtual-router/tool-signals.d.ts +0 -19
- package/vendor/llmswitch-core/dist/router/virtual-router/tool-signals.js +0 -647
- package/vendor/llmswitch-core/dist/router/virtual-router/types.d.ts +0 -681
- package/vendor/llmswitch-core/dist/router/virtual-router/types.js +0 -34
- package/vendor/llmswitch-core/dist/runtime/user-data-paths.d.ts +0 -5
- package/vendor/llmswitch-core/dist/runtime/user-data-paths.js +0 -43
- package/vendor/llmswitch-core/dist/servertool/clock/config.d.ts +0 -17
- package/vendor/llmswitch-core/dist/servertool/clock/config.js +0 -48
- package/vendor/llmswitch-core/dist/servertool/clock/daemon.d.ts +0 -24
- package/vendor/llmswitch-core/dist/servertool/clock/daemon.js +0 -207
- package/vendor/llmswitch-core/dist/servertool/clock/io.d.ts +0 -2
- package/vendor/llmswitch-core/dist/servertool/clock/io.js +0 -14
- package/vendor/llmswitch-core/dist/servertool/clock/log.d.ts +0 -3
- package/vendor/llmswitch-core/dist/servertool/clock/log.js +0 -13
- package/vendor/llmswitch-core/dist/servertool/clock/ntp.d.ts +0 -18
- package/vendor/llmswitch-core/dist/servertool/clock/ntp.js +0 -318
- package/vendor/llmswitch-core/dist/servertool/clock/paths.d.ts +0 -5
- package/vendor/llmswitch-core/dist/servertool/clock/paths.js +0 -28
- package/vendor/llmswitch-core/dist/servertool/clock/recurrence.d.ts +0 -7
- package/vendor/llmswitch-core/dist/servertool/clock/recurrence.js +0 -248
- package/vendor/llmswitch-core/dist/servertool/clock/session-scope.d.ts +0 -3
- package/vendor/llmswitch-core/dist/servertool/clock/session-scope.js +0 -41
- package/vendor/llmswitch-core/dist/servertool/clock/session-store.d.ts +0 -3
- package/vendor/llmswitch-core/dist/servertool/clock/session-store.js +0 -63
- package/vendor/llmswitch-core/dist/servertool/clock/state.d.ts +0 -9
- package/vendor/llmswitch-core/dist/servertool/clock/state.js +0 -135
- package/vendor/llmswitch-core/dist/servertool/clock/task-store.d.ts +0 -5
- package/vendor/llmswitch-core/dist/servertool/clock/task-store.js +0 -4
- package/vendor/llmswitch-core/dist/servertool/clock/tasks.d.ts +0 -24
- package/vendor/llmswitch-core/dist/servertool/clock/tasks.js +0 -595
- package/vendor/llmswitch-core/dist/servertool/clock/types.d.ts +0 -98
- package/vendor/llmswitch-core/dist/servertool/clock/types.js +0 -1
- package/vendor/llmswitch-core/dist/servertool/continue-execution/log.d.ts +0 -3
- package/vendor/llmswitch-core/dist/servertool/continue-execution/log.js +0 -13
- package/vendor/llmswitch-core/dist/servertool/engine.d.ts +0 -38
- package/vendor/llmswitch-core/dist/servertool/engine.js +0 -1660
- package/vendor/llmswitch-core/dist/servertool/followup-shadow.d.ts +0 -16
- package/vendor/llmswitch-core/dist/servertool/followup-shadow.js +0 -145
- package/vendor/llmswitch-core/dist/servertool/handlers/antigravity-thought-signature-bootstrap.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/antigravity-thought-signature-bootstrap.js +0 -225
- package/vendor/llmswitch-core/dist/servertool/handlers/apply-patch-guard.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/apply-patch-guard.js +0 -5
- package/vendor/llmswitch-core/dist/servertool/handlers/clock-auto.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/clock-auto.js +0 -177
- package/vendor/llmswitch-core/dist/servertool/handlers/clock.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/clock.js +0 -544
- package/vendor/llmswitch-core/dist/servertool/handlers/compaction-detect.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/compaction-detect.js +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/continue-execution.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/continue-execution.js +0 -110
- package/vendor/llmswitch-core/dist/servertool/handlers/exec-command-guard.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/exec-command-guard.js +0 -10
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-message-trimmer.d.ts +0 -16
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-message-trimmer.js +0 -198
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-request-builder.d.ts +0 -25
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-request-builder.js +0 -515
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-sanitize.d.ts +0 -2
- package/vendor/llmswitch-core/dist/servertool/handlers/followup-sanitize.js +0 -7
- package/vendor/llmswitch-core/dist/servertool/handlers/gemini-empty-reply-continue.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/gemini-empty-reply-continue.js +0 -3
- package/vendor/llmswitch-core/dist/servertool/handlers/iflow-model-error-retry.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/iflow-model-error-retry.js +0 -92
- package/vendor/llmswitch-core/dist/servertool/handlers/recursive-detection-guard.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/recursive-detection-guard.js +0 -374
- package/vendor/llmswitch-core/dist/servertool/handlers/review.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/review.js +0 -181
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/blocked-report.d.ts +0 -16
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/blocked-report.js +0 -407
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/iflow-followup.d.ts +0 -44
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/iflow-followup.js +0 -816
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/routing-state.d.ts +0 -28
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/routing-state.js +0 -123
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/runtime-utils.d.ts +0 -81
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto/runtime-utils.js +0 -355
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto.d.ts +0 -1
- package/vendor/llmswitch-core/dist/servertool/handlers/stop-message-auto.js +0 -553
- package/vendor/llmswitch-core/dist/servertool/handlers/vision.d.ts +0 -7
- package/vendor/llmswitch-core/dist/servertool/handlers/vision.js +0 -240
- package/vendor/llmswitch-core/dist/servertool/handlers/web-search.d.ts +0 -7
- package/vendor/llmswitch-core/dist/servertool/handlers/web-search.js +0 -926
- package/vendor/llmswitch-core/dist/servertool/log/progress-file.d.ts +0 -14
- package/vendor/llmswitch-core/dist/servertool/log/progress-file.js +0 -88
- package/vendor/llmswitch-core/dist/servertool/pending-session.d.ts +0 -19
- package/vendor/llmswitch-core/dist/servertool/pending-session.js +0 -99
- package/vendor/llmswitch-core/dist/servertool/pre-command-hooks.d.ts +0 -17
- package/vendor/llmswitch-core/dist/servertool/pre-command-hooks.js +0 -491
- package/vendor/llmswitch-core/dist/servertool/reenter-backend.d.ts +0 -23
- package/vendor/llmswitch-core/dist/servertool/reenter-backend.js +0 -20
- package/vendor/llmswitch-core/dist/servertool/registry.d.ts +0 -35
- package/vendor/llmswitch-core/dist/servertool/registry.js +0 -92
- package/vendor/llmswitch-core/dist/servertool/server-side-tools.d.ts +0 -15
- package/vendor/llmswitch-core/dist/servertool/server-side-tools.js +0 -898
- package/vendor/llmswitch-core/dist/servertool/stop-gateway-context.d.ts +0 -14
- package/vendor/llmswitch-core/dist/servertool/stop-gateway-context.js +0 -167
- package/vendor/llmswitch-core/dist/servertool/stop-message-compare-context.d.ts +0 -24
- package/vendor/llmswitch-core/dist/servertool/stop-message-compare-context.js +0 -133
- package/vendor/llmswitch-core/dist/servertool/strip-servertool-calls.d.ts +0 -2
- package/vendor/llmswitch-core/dist/servertool/strip-servertool-calls.js +0 -75
- package/vendor/llmswitch-core/dist/servertool/types.d.ts +0 -235
- package/vendor/llmswitch-core/dist/servertool/types.js +0 -1
- package/vendor/llmswitch-core/dist/sse/index.d.ts +0 -176
- package/vendor/llmswitch-core/dist/sse/index.js +0 -142
- package/vendor/llmswitch-core/dist/sse/json-to-sse/anthropic-json-to-sse-converter.d.ts +0 -15
- package/vendor/llmswitch-core/dist/sse/json-to-sse/anthropic-json-to-sse-converter.js +0 -112
- package/vendor/llmswitch-core/dist/sse/json-to-sse/chat-json-to-sse-converter.d.ts +0 -80
- package/vendor/llmswitch-core/dist/sse/json-to-sse/chat-json-to-sse-converter.js +0 -300
- package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/chat.d.ts +0 -55
- package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/chat.js +0 -233
- package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/responses.d.ts +0 -103
- package/vendor/llmswitch-core/dist/sse/json-to-sse/event-generators/responses.js +0 -703
- package/vendor/llmswitch-core/dist/sse/json-to-sse/gemini-json-to-sse-converter.d.ts +0 -15
- package/vendor/llmswitch-core/dist/sse/json-to-sse/gemini-json-to-sse-converter.js +0 -99
- package/vendor/llmswitch-core/dist/sse/json-to-sse/index.d.ts +0 -7
- package/vendor/llmswitch-core/dist/sse/json-to-sse/index.js +0 -9
- package/vendor/llmswitch-core/dist/sse/json-to-sse/responses-json-to-sse-converter.d.ts +0 -80
- package/vendor/llmswitch-core/dist/sse/json-to-sse/responses-json-to-sse-converter.js +0 -322
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/anthropic-sequencer.d.ts +0 -13
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/anthropic-sequencer.js +0 -162
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/chat-sequencer.d.ts +0 -39
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/chat-sequencer.js +0 -264
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/gemini-sequencer.d.ts +0 -10
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/gemini-sequencer.js +0 -95
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/responses-sequencer.d.ts +0 -40
- package/vendor/llmswitch-core/dist/sse/json-to-sse/sequencers/responses-sequencer.js +0 -293
- package/vendor/llmswitch-core/dist/sse/registry/sse-codec-registry.d.ts +0 -32
- package/vendor/llmswitch-core/dist/sse/registry/sse-codec-registry.js +0 -135
- package/vendor/llmswitch-core/dist/sse/shared/chat-serializer.d.ts +0 -4
- package/vendor/llmswitch-core/dist/sse/shared/chat-serializer.js +0 -40
- package/vendor/llmswitch-core/dist/sse/shared/constants.d.ts +0 -272
- package/vendor/llmswitch-core/dist/sse/shared/constants.js +0 -321
- package/vendor/llmswitch-core/dist/sse/shared/reasoning-dispatcher.d.ts +0 -10
- package/vendor/llmswitch-core/dist/sse/shared/reasoning-dispatcher.js +0 -25
- package/vendor/llmswitch-core/dist/sse/shared/responses-output-normalizer.d.ts +0 -13
- package/vendor/llmswitch-core/dist/sse/shared/responses-output-normalizer.js +0 -47
- package/vendor/llmswitch-core/dist/sse/shared/serializers/anthropic-event-serializer.d.ts +0 -2
- package/vendor/llmswitch-core/dist/sse/shared/serializers/anthropic-event-serializer.js +0 -9
- package/vendor/llmswitch-core/dist/sse/shared/serializers/base-serializer.d.ts +0 -158
- package/vendor/llmswitch-core/dist/sse/shared/serializers/base-serializer.js +0 -210
- package/vendor/llmswitch-core/dist/sse/shared/serializers/chat-event-serializer.d.ts +0 -82
- package/vendor/llmswitch-core/dist/sse/shared/serializers/chat-event-serializer.js +0 -275
- package/vendor/llmswitch-core/dist/sse/shared/serializers/gemini-event-serializer.d.ts +0 -2
- package/vendor/llmswitch-core/dist/sse/shared/serializers/gemini-event-serializer.js +0 -5
- package/vendor/llmswitch-core/dist/sse/shared/serializers/index.d.ts +0 -42
- package/vendor/llmswitch-core/dist/sse/shared/serializers/index.js +0 -56
- package/vendor/llmswitch-core/dist/sse/shared/serializers/responses-event-serializer.d.ts +0 -131
- package/vendor/llmswitch-core/dist/sse/shared/serializers/responses-event-serializer.js +0 -375
- package/vendor/llmswitch-core/dist/sse/shared/serializers/types.d.ts +0 -51
- package/vendor/llmswitch-core/dist/sse/shared/serializers/types.js +0 -4
- package/vendor/llmswitch-core/dist/sse/shared/utils.d.ts +0 -254
- package/vendor/llmswitch-core/dist/sse/shared/utils.js +0 -543
- package/vendor/llmswitch-core/dist/sse/shared/writer.d.ts +0 -127
- package/vendor/llmswitch-core/dist/sse/shared/writer.js +0 -321
- package/vendor/llmswitch-core/dist/sse/sse-to-json/anthropic-sse-to-json-converter.d.ts +0 -20
- package/vendor/llmswitch-core/dist/sse/sse-to-json/anthropic-sse-to-json-converter.js +0 -204
- package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/anthropic-response-builder.d.ts +0 -16
- package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/anthropic-response-builder.js +0 -258
- package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/response-builder.d.ts +0 -177
- package/vendor/llmswitch-core/dist/sse/sse-to-json/builders/response-builder.js +0 -1135
- package/vendor/llmswitch-core/dist/sse/sse-to-json/chat-sse-to-json-converter.d.ts +0 -119
- package/vendor/llmswitch-core/dist/sse/sse-to-json/chat-sse-to-json-converter.js +0 -850
- package/vendor/llmswitch-core/dist/sse/sse-to-json/gemini-sse-to-json-converter.d.ts +0 -14
- package/vendor/llmswitch-core/dist/sse/sse-to-json/gemini-sse-to-json-converter.js +0 -186
- package/vendor/llmswitch-core/dist/sse/sse-to-json/index.d.ts +0 -7
- package/vendor/llmswitch-core/dist/sse/sse-to-json/index.js +0 -9
- package/vendor/llmswitch-core/dist/sse/sse-to-json/parsers/sse-parser.d.ts +0 -73
- package/vendor/llmswitch-core/dist/sse/sse-to-json/parsers/sse-parser.js +0 -434
- package/vendor/llmswitch-core/dist/sse/sse-to-json/responses-sse-to-json-converter.d.ts +0 -61
- package/vendor/llmswitch-core/dist/sse/sse-to-json/responses-sse-to-json-converter.js +0 -306
- package/vendor/llmswitch-core/dist/sse/types/anthropic-types.d.ts +0 -194
- package/vendor/llmswitch-core/dist/sse/types/anthropic-types.js +0 -8
- package/vendor/llmswitch-core/dist/sse/types/chat-types.d.ts +0 -321
- package/vendor/llmswitch-core/dist/sse/types/chat-types.js +0 -33
- package/vendor/llmswitch-core/dist/sse/types/conversion-context.d.ts +0 -214
- package/vendor/llmswitch-core/dist/sse/types/conversion-context.js +0 -20
- package/vendor/llmswitch-core/dist/sse/types/core-interfaces.d.ts +0 -94
- package/vendor/llmswitch-core/dist/sse/types/core-interfaces.js +0 -5
- package/vendor/llmswitch-core/dist/sse/types/gemini-types.d.ts +0 -135
- package/vendor/llmswitch-core/dist/sse/types/gemini-types.js +0 -5
- package/vendor/llmswitch-core/dist/sse/types/index.d.ts +0 -17
- package/vendor/llmswitch-core/dist/sse/types/index.js +0 -9
- package/vendor/llmswitch-core/dist/sse/types/responses-types.d.ts +0 -334
- package/vendor/llmswitch-core/dist/sse/types/responses-types.js +0 -38
- package/vendor/llmswitch-core/dist/sse/types/sse-events.d.ts +0 -181
- package/vendor/llmswitch-core/dist/sse/types/sse-events.js +0 -150
- package/vendor/llmswitch-core/dist/sse/types/stream-state.d.ts +0 -199
- package/vendor/llmswitch-core/dist/sse/types/stream-state.js +0 -44
- package/vendor/llmswitch-core/dist/sse/types/utility-types.d.ts +0 -234
- package/vendor/llmswitch-core/dist/sse/types/utility-types.js +0 -46
- package/vendor/llmswitch-core/dist/telemetry/stats-center.d.ts +0 -82
- package/vendor/llmswitch-core/dist/telemetry/stats-center.js +0 -308
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/default-actions.d.ts +0 -2
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/default-actions.js +0 -12
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/extract-patch.d.ts +0 -2
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/extract-patch.js +0 -15
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/index.d.ts +0 -2
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/index.js +0 -164
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/structured-builders.d.ts +0 -7
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/structured-builders.js +0 -85
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/types.d.ts +0 -54
- package/vendor/llmswitch-core/dist/tools/apply-patch/args-normalizer/types.js +0 -1
- package/vendor/llmswitch-core/dist/tools/apply-patch/execution-capturer.d.ts +0 -13
- package/vendor/llmswitch-core/dist/tools/apply-patch/execution-capturer.js +0 -181
- package/vendor/llmswitch-core/dist/tools/apply-patch/json/parse-loose.d.ts +0 -3
- package/vendor/llmswitch-core/dist/tools/apply-patch/json/parse-loose.js +0 -139
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/context-diff.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/context-diff.js +0 -173
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/git-diff.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/git-diff.js +0 -138
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/looks-like-patch.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/looks-like-patch.js +0 -11
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/normalize.d.ts +0 -3
- package/vendor/llmswitch-core/dist/tools/apply-patch/patch-text/normalize.js +0 -383
- package/vendor/llmswitch-core/dist/tools/apply-patch/regression-capturer.d.ts +0 -13
- package/vendor/llmswitch-core/dist/tools/apply-patch/regression-capturer.js +0 -113
- package/vendor/llmswitch-core/dist/tools/apply-patch/structured/coercion.d.ts +0 -3
- package/vendor/llmswitch-core/dist/tools/apply-patch/structured/coercion.js +0 -103
- package/vendor/llmswitch-core/dist/tools/apply-patch/structured.d.ts +0 -20
- package/vendor/llmswitch-core/dist/tools/apply-patch/structured.js +0 -537
- package/vendor/llmswitch-core/dist/tools/apply-patch/validation/shared.d.ts +0 -3
- package/vendor/llmswitch-core/dist/tools/apply-patch/validation/shared.js +0 -6
- package/vendor/llmswitch-core/dist/tools/apply-patch/validator.d.ts +0 -8
- package/vendor/llmswitch-core/dist/tools/apply-patch/validator.js +0 -21
- package/vendor/llmswitch-core/dist/tools/apply-patch-structured.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/apply-patch-structured.js +0 -1
- package/vendor/llmswitch-core/dist/tools/args-json.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/args-json.js +0 -204
- package/vendor/llmswitch-core/dist/tools/exec-command/normalize.d.ts +0 -17
- package/vendor/llmswitch-core/dist/tools/exec-command/normalize.js +0 -116
- package/vendor/llmswitch-core/dist/tools/exec-command/regression-capturer.d.ts +0 -11
- package/vendor/llmswitch-core/dist/tools/exec-command/regression-capturer.js +0 -144
- package/vendor/llmswitch-core/dist/tools/exec-command/validator.d.ts +0 -10
- package/vendor/llmswitch-core/dist/tools/exec-command/validator.js +0 -238
- package/vendor/llmswitch-core/dist/tools/patch-regression-capturer.d.ts +0 -1
- package/vendor/llmswitch-core/dist/tools/patch-regression-capturer.js +0 -1
- package/vendor/llmswitch-core/dist/tools/tool-description-utils.d.ts +0 -5
- package/vendor/llmswitch-core/dist/tools/tool-description-utils.js +0 -50
- package/vendor/llmswitch-core/dist/tools/tool-registry.d.ts +0 -15
- package/vendor/llmswitch-core/dist/tools/tool-registry.js +0 -253
- package/vendor/llmswitch-core/package.json +0 -189
|
@@ -1,1416 +0,0 @@
|
|
|
1
|
-
import { createBridgeActionState, runBridgeActionPipeline } from '../bridge-actions.js';
|
|
2
|
-
import { resolveBridgePolicy, resolvePolicyActions } from '../bridge-policies.js';
|
|
3
|
-
import { normalizeChatMessageContent } from './chat-output-normalizer.js';
|
|
4
|
-
import { mapBridgeToolsToChat, mapChatToolsToBridge } from './tool-mapping.js';
|
|
5
|
-
import { jsonClone } from '../hub/types/json.js';
|
|
6
|
-
import { ProviderProtocolError } from '../provider-protocol-error.js';
|
|
7
|
-
import { parseLenientJsonishWithNative } from '../../router/virtual-router/engine-selection/native-shared-conversion-semantics.js';
|
|
8
|
-
function isObject(v) {
|
|
9
|
-
return !!v && typeof v === 'object' && !Array.isArray(v);
|
|
10
|
-
}
|
|
11
|
-
function safeJson(v) {
|
|
12
|
-
try {
|
|
13
|
-
return JSON.stringify(v ?? {});
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return '{}';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
function stripOpenAIChatToolAliasFields(messages) {
|
|
20
|
-
// No-op: preserve tool_call_id/call_id for downstream consumers and regression parity.
|
|
21
|
-
void messages;
|
|
22
|
-
}
|
|
23
|
-
function stripToolCallIdFieldsFromAssistant(messages) {
|
|
24
|
-
for (const message of messages) {
|
|
25
|
-
if (!message || typeof message !== 'object')
|
|
26
|
-
continue;
|
|
27
|
-
const role = String(message.role || '').toLowerCase();
|
|
28
|
-
if (role !== 'assistant')
|
|
29
|
-
continue;
|
|
30
|
-
const calls = message.tool_calls;
|
|
31
|
-
if (!Array.isArray(calls))
|
|
32
|
-
continue;
|
|
33
|
-
for (const call of calls) {
|
|
34
|
-
if (!call || typeof call !== 'object')
|
|
35
|
-
continue;
|
|
36
|
-
delete call.call_id;
|
|
37
|
-
delete call.tool_call_id;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
function sanitizeToolUseId(raw) {
|
|
42
|
-
const trimmed = typeof raw === 'string' ? raw.trim() : '';
|
|
43
|
-
if (!trimmed) {
|
|
44
|
-
return `call_${Math.random().toString(36).slice(2, 10)}`;
|
|
45
|
-
}
|
|
46
|
-
if (/^[A-Za-z0-9_-]+$/.test(trimmed)) {
|
|
47
|
-
return trimmed;
|
|
48
|
-
}
|
|
49
|
-
const sanitized = trimmed
|
|
50
|
-
.replace(/[^A-Za-z0-9_-]/g, '_')
|
|
51
|
-
.replace(/_{2,}/g, '_')
|
|
52
|
-
.replace(/^_+/, '')
|
|
53
|
-
.replace(/_+$/, '');
|
|
54
|
-
return sanitized || `call_${Math.random().toString(36).slice(2, 10)}`;
|
|
55
|
-
}
|
|
56
|
-
function flattenAnthropicText(content) {
|
|
57
|
-
if (content == null)
|
|
58
|
-
return '';
|
|
59
|
-
if (typeof content === 'string')
|
|
60
|
-
return content;
|
|
61
|
-
if (Array.isArray(content))
|
|
62
|
-
return content.map(flattenAnthropicText).join('');
|
|
63
|
-
if (typeof content === 'object') {
|
|
64
|
-
const t = String(content.type || '').toLowerCase();
|
|
65
|
-
if (t === 'text' && typeof content.text === 'string')
|
|
66
|
-
return String(content.text);
|
|
67
|
-
if (Array.isArray(content.content))
|
|
68
|
-
return content.content.map(flattenAnthropicText).join('');
|
|
69
|
-
if (typeof content.content === 'string')
|
|
70
|
-
return String(content.content);
|
|
71
|
-
}
|
|
72
|
-
return '';
|
|
73
|
-
}
|
|
74
|
-
function normalizeToolResultContent(block) {
|
|
75
|
-
if (!block || typeof block !== 'object') {
|
|
76
|
-
return '';
|
|
77
|
-
}
|
|
78
|
-
const content = block.content;
|
|
79
|
-
if (typeof content === 'string') {
|
|
80
|
-
return content;
|
|
81
|
-
}
|
|
82
|
-
if (Array.isArray(content)) {
|
|
83
|
-
const segments = [];
|
|
84
|
-
for (const entry of content) {
|
|
85
|
-
const segment = extractToolResultSegment(entry);
|
|
86
|
-
if (segment) {
|
|
87
|
-
segments.push(segment);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (segments.length) {
|
|
91
|
-
return segments.join('\n');
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
else if (content != null) {
|
|
95
|
-
try {
|
|
96
|
-
return JSON.stringify(content);
|
|
97
|
-
}
|
|
98
|
-
catch {
|
|
99
|
-
return String(content);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
return '';
|
|
103
|
-
}
|
|
104
|
-
function extractToolResultSegment(entry) {
|
|
105
|
-
if (entry == null) {
|
|
106
|
-
return '';
|
|
107
|
-
}
|
|
108
|
-
if (typeof entry === 'string') {
|
|
109
|
-
return entry;
|
|
110
|
-
}
|
|
111
|
-
if (Array.isArray(entry)) {
|
|
112
|
-
return entry.map(extractToolResultSegment).filter(Boolean).join('');
|
|
113
|
-
}
|
|
114
|
-
if (typeof entry === 'object') {
|
|
115
|
-
const node = entry;
|
|
116
|
-
const type = typeof node.type === 'string' ? node.type.toLowerCase() : '';
|
|
117
|
-
if (type === 'input_text' || type === 'input_json' || type === 'tool_result_status' || type === 'status' || type === 'metadata') {
|
|
118
|
-
return '';
|
|
119
|
-
}
|
|
120
|
-
if (type === 'output_text' || type === 'text' || type === 'reasoning' || type === 'log') {
|
|
121
|
-
return flattenAnthropicText(entry);
|
|
122
|
-
}
|
|
123
|
-
if (type === 'output_json' || type === 'json') {
|
|
124
|
-
const payload = node.content ?? node.text ?? node.data ?? node.output;
|
|
125
|
-
if (payload === undefined) {
|
|
126
|
-
return '';
|
|
127
|
-
}
|
|
128
|
-
try {
|
|
129
|
-
return JSON.stringify(payload);
|
|
130
|
-
}
|
|
131
|
-
catch {
|
|
132
|
-
return String(payload ?? '');
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
if (typeof node.text === 'string') {
|
|
136
|
-
return node.text;
|
|
137
|
-
}
|
|
138
|
-
if ('content' in node) {
|
|
139
|
-
const nested = extractToolResultSegment(node.content);
|
|
140
|
-
if (nested) {
|
|
141
|
-
return nested;
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
try {
|
|
145
|
-
return JSON.stringify(entry);
|
|
146
|
-
}
|
|
147
|
-
catch {
|
|
148
|
-
return '';
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return String(entry);
|
|
152
|
-
}
|
|
153
|
-
function resolveProtocolErrorCode(context) {
|
|
154
|
-
const ctx = context.toLowerCase();
|
|
155
|
-
return ctx.includes('tool') ? 'TOOL_PROTOCOL_ERROR' : 'MALFORMED_REQUEST';
|
|
156
|
-
}
|
|
157
|
-
function requireTrimmedString(value, context) {
|
|
158
|
-
if (typeof value !== 'string') {
|
|
159
|
-
throw new ProviderProtocolError(`Anthropic bridge constraint violated: ${context} must be a string`, {
|
|
160
|
-
code: resolveProtocolErrorCode(context),
|
|
161
|
-
protocol: 'anthropic-messages',
|
|
162
|
-
providerType: 'anthropic',
|
|
163
|
-
details: { context, actualType: typeof value }
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
const trimmed = value.trim();
|
|
167
|
-
if (!trimmed.length) {
|
|
168
|
-
throw new ProviderProtocolError(`Anthropic bridge constraint violated: ${context} must not be empty`, {
|
|
169
|
-
code: resolveProtocolErrorCode(context),
|
|
170
|
-
protocol: 'anthropic-messages',
|
|
171
|
-
providerType: 'anthropic',
|
|
172
|
-
details: { context }
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return trimmed;
|
|
176
|
-
}
|
|
177
|
-
function requireSystemText(block, context) {
|
|
178
|
-
const text = flattenAnthropicText(block).trim();
|
|
179
|
-
if (!text) {
|
|
180
|
-
throw new ProviderProtocolError(`Anthropic bridge constraint violated: ${context} must contain text`, {
|
|
181
|
-
code: resolveProtocolErrorCode(context),
|
|
182
|
-
protocol: 'anthropic-messages',
|
|
183
|
-
providerType: 'anthropic',
|
|
184
|
-
details: { context }
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
return text;
|
|
188
|
-
}
|
|
189
|
-
const ANTHROPIC_TOOL_NAME_ALIASES = new Map();
|
|
190
|
-
const CANONICAL_TO_ANTHROPIC_TOOL_NAMES = new Map([['shell_command', 'Bash']]);
|
|
191
|
-
const ANTHROPIC_TOP_LEVEL_FIELDS = new Set([
|
|
192
|
-
'model',
|
|
193
|
-
'messages',
|
|
194
|
-
'tools',
|
|
195
|
-
'system',
|
|
196
|
-
'stop_sequences',
|
|
197
|
-
'temperature',
|
|
198
|
-
'top_p',
|
|
199
|
-
'top_k',
|
|
200
|
-
'max_tokens',
|
|
201
|
-
'max_output_tokens',
|
|
202
|
-
'metadata',
|
|
203
|
-
'stream',
|
|
204
|
-
'tool_choice',
|
|
205
|
-
'thinking'
|
|
206
|
-
]);
|
|
207
|
-
const ANTHROPIC_STABLE_TOOL_SCHEMA_NAMES = new Set([
|
|
208
|
-
'exec_command',
|
|
209
|
-
'write_stdin',
|
|
210
|
-
'apply_patch',
|
|
211
|
-
'request_user_input',
|
|
212
|
-
'update_plan',
|
|
213
|
-
'view_image',
|
|
214
|
-
'web_search',
|
|
215
|
-
'clock',
|
|
216
|
-
'continue_execution',
|
|
217
|
-
'review'
|
|
218
|
-
]);
|
|
219
|
-
const ANTHROPIC_STABLE_TOOL_SCHEMA_KEYS = new Map([
|
|
220
|
-
['exec_command', new Set(['cmd', 'command', 'workdir', 'justification', 'login', 'max_output_tokens', 'sandbox_permissions', 'shell', 'yield_time_ms', 'tty', 'prefix_rule'])],
|
|
221
|
-
['write_stdin', new Set(['session_id', 'chars', 'text', 'yield_time_ms', 'max_output_tokens'])],
|
|
222
|
-
['apply_patch', new Set(['patch', 'input', 'instructions', 'text', 'file', 'changes'])],
|
|
223
|
-
['request_user_input', new Set(['questions'])],
|
|
224
|
-
['update_plan', new Set(['explanation', 'plan'])],
|
|
225
|
-
['view_image', new Set(['path'])],
|
|
226
|
-
['web_search', new Set(['query', 'q', 'domains', 'recency'])],
|
|
227
|
-
['clock', new Set(['action', 'items', 'taskId'])]
|
|
228
|
-
]);
|
|
229
|
-
export function normalizeAnthropicToolName(value) {
|
|
230
|
-
if (typeof value !== 'string') {
|
|
231
|
-
return undefined;
|
|
232
|
-
}
|
|
233
|
-
const trimmed = value.trim();
|
|
234
|
-
if (!trimmed) {
|
|
235
|
-
return undefined;
|
|
236
|
-
}
|
|
237
|
-
const lower = trimmed.toLowerCase();
|
|
238
|
-
const alias = ANTHROPIC_TOOL_NAME_ALIASES.get(lower);
|
|
239
|
-
if (alias) {
|
|
240
|
-
return alias;
|
|
241
|
-
}
|
|
242
|
-
if (lower.startsWith('mcp__')) {
|
|
243
|
-
return lower;
|
|
244
|
-
}
|
|
245
|
-
return lower;
|
|
246
|
-
}
|
|
247
|
-
export function denormalizeAnthropicToolName(value) {
|
|
248
|
-
if (typeof value !== 'string') {
|
|
249
|
-
return undefined;
|
|
250
|
-
}
|
|
251
|
-
const trimmed = value.trim();
|
|
252
|
-
if (!trimmed) {
|
|
253
|
-
return undefined;
|
|
254
|
-
}
|
|
255
|
-
const lower = trimmed.toLowerCase();
|
|
256
|
-
const mapped = CANONICAL_TO_ANTHROPIC_TOOL_NAMES.get(lower);
|
|
257
|
-
if (mapped) {
|
|
258
|
-
return mapped;
|
|
259
|
-
}
|
|
260
|
-
if (lower.startsWith('mcp__')) {
|
|
261
|
-
return trimmed;
|
|
262
|
-
}
|
|
263
|
-
return trimmed;
|
|
264
|
-
}
|
|
265
|
-
function coerceShellLikeCommand(value) {
|
|
266
|
-
if (typeof value === 'string') {
|
|
267
|
-
const trimmed = value.trim();
|
|
268
|
-
return trimmed.length ? trimmed : undefined;
|
|
269
|
-
}
|
|
270
|
-
if (Array.isArray(value)) {
|
|
271
|
-
const parts = value
|
|
272
|
-
.map((entry) => (typeof entry === 'string' ? entry.trim() : ''))
|
|
273
|
-
.filter((entry) => entry.length > 0);
|
|
274
|
-
if (!parts.length) {
|
|
275
|
-
return undefined;
|
|
276
|
-
}
|
|
277
|
-
return parts.join(' ');
|
|
278
|
-
}
|
|
279
|
-
return undefined;
|
|
280
|
-
}
|
|
281
|
-
function normalizeShellLikeToolInput(toolName, input) {
|
|
282
|
-
const canonical = normalizeAnthropicToolName(toolName);
|
|
283
|
-
if (canonical !== 'shell_command') {
|
|
284
|
-
return input;
|
|
285
|
-
}
|
|
286
|
-
const rawToolName = typeof toolName === 'string' ? toolName.trim().toLowerCase() : '';
|
|
287
|
-
const isExecCommand = rawToolName === 'exec_command';
|
|
288
|
-
if (!input || typeof input !== 'object' || Array.isArray(input)) {
|
|
289
|
-
const cmd = coerceShellLikeCommand(input);
|
|
290
|
-
if (!cmd) {
|
|
291
|
-
return {};
|
|
292
|
-
}
|
|
293
|
-
return isExecCommand ? { cmd } : { command: cmd };
|
|
294
|
-
}
|
|
295
|
-
const next = { ...input };
|
|
296
|
-
const commandValue = coerceShellLikeCommand(next.command);
|
|
297
|
-
const cmdValue = coerceShellLikeCommand(next.cmd);
|
|
298
|
-
const fallbackValue = coerceShellLikeCommand(next.script) ??
|
|
299
|
-
coerceShellLikeCommand(next.toon);
|
|
300
|
-
if (commandValue) {
|
|
301
|
-
next.command = commandValue;
|
|
302
|
-
}
|
|
303
|
-
if (cmdValue) {
|
|
304
|
-
next.cmd = cmdValue;
|
|
305
|
-
}
|
|
306
|
-
if (!commandValue && !cmdValue && fallbackValue) {
|
|
307
|
-
if (isExecCommand) {
|
|
308
|
-
next.cmd = fallbackValue;
|
|
309
|
-
}
|
|
310
|
-
else {
|
|
311
|
-
next.command = fallbackValue;
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
else if (!commandValue && cmdValue && !isExecCommand) {
|
|
315
|
-
next.command = cmdValue;
|
|
316
|
-
}
|
|
317
|
-
else if (!cmdValue && commandValue && isExecCommand) {
|
|
318
|
-
next.cmd = commandValue;
|
|
319
|
-
}
|
|
320
|
-
if (!isExecCommand && 'cmd' in next) {
|
|
321
|
-
delete next.cmd;
|
|
322
|
-
}
|
|
323
|
-
if (typeof next.workdir !== 'string' && typeof next.cwd === 'string' && next.cwd.trim().length > 0) {
|
|
324
|
-
next.workdir = next.cwd.trim();
|
|
325
|
-
}
|
|
326
|
-
return next;
|
|
327
|
-
}
|
|
328
|
-
function invertAnthropicAliasMap(source) {
|
|
329
|
-
if (!source) {
|
|
330
|
-
return undefined;
|
|
331
|
-
}
|
|
332
|
-
const inverted = {};
|
|
333
|
-
for (const [canonical, raw] of Object.entries(source)) {
|
|
334
|
-
if (typeof canonical !== 'string' || typeof raw !== 'string') {
|
|
335
|
-
continue;
|
|
336
|
-
}
|
|
337
|
-
const trimmedCanonical = canonical.trim();
|
|
338
|
-
const trimmedRaw = raw.trim();
|
|
339
|
-
if (!trimmedCanonical.length) {
|
|
340
|
-
continue;
|
|
341
|
-
}
|
|
342
|
-
if (trimmedRaw.length) {
|
|
343
|
-
inverted[trimmedRaw.toLowerCase()] = trimmedCanonical;
|
|
344
|
-
}
|
|
345
|
-
if (!inverted[trimmedCanonical.toLowerCase()]) {
|
|
346
|
-
inverted[trimmedCanonical.toLowerCase()] = trimmedCanonical;
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
return Object.keys(inverted).length ? inverted : undefined;
|
|
350
|
-
}
|
|
351
|
-
export function buildOpenAIChatFromAnthropic(payload, options) {
|
|
352
|
-
const newMessages = [];
|
|
353
|
-
const body = isObject(payload) ? payload : {};
|
|
354
|
-
const canonicalAliasMap = coerceAliasRecord(buildAnthropicToolAliasMap(body.tools));
|
|
355
|
-
const reverseAliasMap = invertAnthropicAliasMap(canonicalAliasMap);
|
|
356
|
-
const resolveToolName = (candidate) => {
|
|
357
|
-
if (typeof candidate !== 'string') {
|
|
358
|
-
return '';
|
|
359
|
-
}
|
|
360
|
-
const trimmed = candidate.trim();
|
|
361
|
-
if (!trimmed.length) {
|
|
362
|
-
return trimmed;
|
|
363
|
-
}
|
|
364
|
-
const normalized = normalizeAnthropicToolName(trimmed) ?? trimmed;
|
|
365
|
-
if (reverseAliasMap) {
|
|
366
|
-
const direct = reverseAliasMap[trimmed.toLowerCase()];
|
|
367
|
-
if (typeof direct === 'string' && direct.trim().length) {
|
|
368
|
-
return direct.trim();
|
|
369
|
-
}
|
|
370
|
-
const normalizedLookup = reverseAliasMap[normalized.toLowerCase()];
|
|
371
|
-
if (typeof normalizedLookup === 'string' && normalizedLookup.trim().length) {
|
|
372
|
-
return normalizedLookup.trim();
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
return normalized;
|
|
376
|
-
};
|
|
377
|
-
const rawSystem = body.system;
|
|
378
|
-
const systemBlocks = Array.isArray(rawSystem)
|
|
379
|
-
? rawSystem
|
|
380
|
-
: rawSystem !== undefined && rawSystem !== null
|
|
381
|
-
? [rawSystem]
|
|
382
|
-
: [];
|
|
383
|
-
for (const block of systemBlocks) {
|
|
384
|
-
const text = requireSystemText(block, 'system entry');
|
|
385
|
-
newMessages.push({ role: 'system', content: text });
|
|
386
|
-
}
|
|
387
|
-
const msgs = Array.isArray(body.messages) ? body.messages : [];
|
|
388
|
-
for (const m of msgs) {
|
|
389
|
-
if (!m || typeof m !== 'object')
|
|
390
|
-
continue;
|
|
391
|
-
const role = typeof m.role === 'string' ? String(m.role) : 'user';
|
|
392
|
-
const content = m.content;
|
|
393
|
-
if (!Array.isArray(content)) {
|
|
394
|
-
const text = flattenAnthropicText(content);
|
|
395
|
-
if (text) {
|
|
396
|
-
const normalized = normalizeChatMessageContent(text);
|
|
397
|
-
const message = {
|
|
398
|
-
role,
|
|
399
|
-
content: normalized.contentText ?? text
|
|
400
|
-
};
|
|
401
|
-
if (typeof normalized.reasoningText === 'string' && normalized.reasoningText.trim().length) {
|
|
402
|
-
message.reasoning_content = normalized.reasoningText.trim();
|
|
403
|
-
}
|
|
404
|
-
newMessages.push(message);
|
|
405
|
-
}
|
|
406
|
-
continue;
|
|
407
|
-
}
|
|
408
|
-
const textParts = [];
|
|
409
|
-
const imageBlocks = [];
|
|
410
|
-
const toolCalls = [];
|
|
411
|
-
const reasoningParts = [];
|
|
412
|
-
const toolResults = [];
|
|
413
|
-
for (const block of content) {
|
|
414
|
-
if (!block || typeof block !== 'object')
|
|
415
|
-
continue;
|
|
416
|
-
const t = String(block.type || '').toLowerCase();
|
|
417
|
-
if (t === 'text' && typeof block.text === 'string') {
|
|
418
|
-
const s = block.text.trim();
|
|
419
|
-
if (s)
|
|
420
|
-
textParts.push(s);
|
|
421
|
-
}
|
|
422
|
-
else if (t === 'thinking' || t === 'reasoning') {
|
|
423
|
-
const thinkingText = flattenAnthropicText(block).trim();
|
|
424
|
-
if (thinkingText) {
|
|
425
|
-
reasoningParts.push(thinkingText);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
else if (t === 'image') {
|
|
429
|
-
const source = block.source;
|
|
430
|
-
if (source && typeof source === 'object') {
|
|
431
|
-
const s = source;
|
|
432
|
-
const srcType = typeof s.type === 'string' ? s.type.toLowerCase() : '';
|
|
433
|
-
let url;
|
|
434
|
-
if (srcType === 'url' && typeof s.url === 'string') {
|
|
435
|
-
url = s.url;
|
|
436
|
-
}
|
|
437
|
-
else if (srcType === 'base64' && typeof s.data === 'string') {
|
|
438
|
-
const mediaType = typeof s.media_type === 'string' && s.media_type.trim().length
|
|
439
|
-
? s.media_type.trim()
|
|
440
|
-
: 'image/png';
|
|
441
|
-
url = `data:${mediaType};base64,${s.data}`;
|
|
442
|
-
}
|
|
443
|
-
if (url && url.trim().length) {
|
|
444
|
-
imageBlocks.push({
|
|
445
|
-
type: 'image_url',
|
|
446
|
-
image_url: { url: url.trim() }
|
|
447
|
-
});
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
else if (t === 'tool_use') {
|
|
452
|
-
const name = requireTrimmedString(block.name, 'tool_use.name');
|
|
453
|
-
const id = requireTrimmedString(block.id, 'tool_use.id');
|
|
454
|
-
const input = block.input ?? {};
|
|
455
|
-
const args = safeJson(input);
|
|
456
|
-
const canonicalName = resolveToolName(name) || name;
|
|
457
|
-
const includeIds = options?.includeToolCallIds === true;
|
|
458
|
-
toolCalls.push({
|
|
459
|
-
id,
|
|
460
|
-
...(includeIds ? { call_id: id, tool_call_id: id } : {}),
|
|
461
|
-
type: 'function',
|
|
462
|
-
function: { name: canonicalName, arguments: args }
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
else if (t === 'tool_result') {
|
|
466
|
-
const callId = requireTrimmedString(block.tool_call_id ??
|
|
467
|
-
block.call_id ??
|
|
468
|
-
block.tool_use_id ??
|
|
469
|
-
block.id, 'tool_result.tool_use_id');
|
|
470
|
-
const contentStr = normalizeToolResultContent(block);
|
|
471
|
-
toolResults.push({ role: 'tool', tool_call_id: callId, content: contentStr });
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
const combinedText = textParts.join('\n');
|
|
475
|
-
const normalized = normalizeChatMessageContent(combinedText);
|
|
476
|
-
const hasRawText = typeof combinedText === 'string' && combinedText.trim().length > 0;
|
|
477
|
-
const mergedReasoning = [...reasoningParts];
|
|
478
|
-
if (typeof normalized.reasoningText === 'string' && normalized.reasoningText.trim().length) {
|
|
479
|
-
mergedReasoning.push(normalized.reasoningText.trim());
|
|
480
|
-
}
|
|
481
|
-
const hasText = typeof normalized.contentText === 'string' && normalized.contentText.length > 0;
|
|
482
|
-
const hasReasoning = mergedReasoning.length > 0;
|
|
483
|
-
if (hasText || hasRawText || toolCalls.length > 0 || hasReasoning || imageBlocks.length > 0) {
|
|
484
|
-
let contentNode = (hasText ? normalized.contentText : undefined) ?? combinedText ?? '';
|
|
485
|
-
if (imageBlocks.length > 0) {
|
|
486
|
-
const blocks = [];
|
|
487
|
-
const textPayload = (hasText ? normalized.contentText : undefined) ?? combinedText ?? '';
|
|
488
|
-
if (typeof textPayload === 'string' && textPayload.trim().length) {
|
|
489
|
-
blocks.push({ type: 'text', text: textPayload.trim() });
|
|
490
|
-
}
|
|
491
|
-
for (const img of imageBlocks) {
|
|
492
|
-
blocks.push(jsonClone(img));
|
|
493
|
-
}
|
|
494
|
-
contentNode = blocks;
|
|
495
|
-
}
|
|
496
|
-
const msg = {
|
|
497
|
-
role,
|
|
498
|
-
content: contentNode
|
|
499
|
-
};
|
|
500
|
-
if (toolCalls.length)
|
|
501
|
-
msg.tool_calls = toolCalls;
|
|
502
|
-
if (hasReasoning) {
|
|
503
|
-
msg.reasoning_content = mergedReasoning.join('\n');
|
|
504
|
-
}
|
|
505
|
-
newMessages.push(msg);
|
|
506
|
-
}
|
|
507
|
-
for (const tr of toolResults)
|
|
508
|
-
newMessages.push(tr);
|
|
509
|
-
}
|
|
510
|
-
const request = { messages: newMessages };
|
|
511
|
-
if (typeof body.model === 'string')
|
|
512
|
-
request.model = body.model;
|
|
513
|
-
if (typeof body.max_tokens === 'number')
|
|
514
|
-
request.max_tokens = body.max_tokens;
|
|
515
|
-
if (typeof body.temperature === 'number')
|
|
516
|
-
request.temperature = body.temperature;
|
|
517
|
-
if (typeof body.top_p === 'number')
|
|
518
|
-
request.top_p = body.top_p;
|
|
519
|
-
if (typeof body.stream === 'boolean')
|
|
520
|
-
request.stream = body.stream;
|
|
521
|
-
if (typeof body.id === 'string') {
|
|
522
|
-
request.request_id = body.id;
|
|
523
|
-
}
|
|
524
|
-
else if (typeof body.request_id === 'string') {
|
|
525
|
-
request.request_id = body.request_id;
|
|
526
|
-
}
|
|
527
|
-
if ('tool_choice' in body)
|
|
528
|
-
request.tool_choice = body.tool_choice;
|
|
529
|
-
const normalizedTools = mapAnthropicToolsToChat(body.tools);
|
|
530
|
-
if (normalizedTools !== undefined) {
|
|
531
|
-
request.tools = normalizedTools;
|
|
532
|
-
}
|
|
533
|
-
try {
|
|
534
|
-
const bridgePolicy = resolveBridgePolicy({ protocol: 'anthropic-messages' });
|
|
535
|
-
const actions = resolvePolicyActions(bridgePolicy, 'request_inbound');
|
|
536
|
-
if (actions?.length) {
|
|
537
|
-
const actionState = createBridgeActionState({
|
|
538
|
-
messages: newMessages,
|
|
539
|
-
rawRequest: body
|
|
540
|
-
});
|
|
541
|
-
runBridgeActionPipeline({
|
|
542
|
-
stage: 'request_inbound',
|
|
543
|
-
actions,
|
|
544
|
-
protocol: bridgePolicy?.protocol ?? 'anthropic-messages',
|
|
545
|
-
moduleType: bridgePolicy?.moduleType ?? 'anthropic-messages',
|
|
546
|
-
requestId: typeof body?.id === 'string' ? String(body.id) : undefined,
|
|
547
|
-
state: actionState
|
|
548
|
-
});
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
catch {
|
|
552
|
-
// ignore policy failures
|
|
553
|
-
}
|
|
554
|
-
stripToolCallIdFieldsFromAssistant(newMessages);
|
|
555
|
-
stripOpenAIChatToolAliasFields(newMessages);
|
|
556
|
-
return request;
|
|
557
|
-
}
|
|
558
|
-
export function buildAnthropicFromOpenAIChat(oa, options) {
|
|
559
|
-
const mapFinishReason = (reason) => {
|
|
560
|
-
if (typeof reason !== 'string' || !reason.trim().length) {
|
|
561
|
-
return undefined;
|
|
562
|
-
}
|
|
563
|
-
const mapping = {
|
|
564
|
-
stop: 'end_turn',
|
|
565
|
-
length: 'max_tokens',
|
|
566
|
-
tool_calls: 'tool_use',
|
|
567
|
-
content_filter: 'stop_sequence',
|
|
568
|
-
function_call: 'tool_use'
|
|
569
|
-
};
|
|
570
|
-
return mapping[reason.trim()];
|
|
571
|
-
};
|
|
572
|
-
const body = isObject(oa) ? oa : {};
|
|
573
|
-
const choices = Array.isArray(body.choices) ? body.choices : [];
|
|
574
|
-
const primary = choices[0] && typeof choices[0] === 'object' ? choices[0] : {};
|
|
575
|
-
const msg = isObject(primary.message) ? primary.message : {};
|
|
576
|
-
const role = typeof msg.role === 'string' ? msg.role : 'assistant';
|
|
577
|
-
const blocks = [];
|
|
578
|
-
const content = msg?.content;
|
|
579
|
-
const contentArray = Array.isArray(content) ? content : undefined;
|
|
580
|
-
if (typeof content === 'string') {
|
|
581
|
-
blocks.push({ type: 'text', text: content });
|
|
582
|
-
}
|
|
583
|
-
if (contentArray) {
|
|
584
|
-
const text = contentArray
|
|
585
|
-
.map((p) => p && typeof p.text === 'string'
|
|
586
|
-
? String(p.text)
|
|
587
|
-
: typeof p === 'string'
|
|
588
|
-
? p
|
|
589
|
-
: '')
|
|
590
|
-
.filter(Boolean)
|
|
591
|
-
.join('');
|
|
592
|
-
if (text) {
|
|
593
|
-
blocks.push({ type: 'text', text });
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
const extensionReasoning = body?.__responses_reasoning;
|
|
597
|
-
const extensionContent = Array.isArray(extensionReasoning?.content)
|
|
598
|
-
? extensionReasoning?.content?.map((entry) => String(entry.text ?? '')).filter((text) => text.trim().length > 0)
|
|
599
|
-
: [];
|
|
600
|
-
const extensionSummary = Array.isArray(extensionReasoning?.summary)
|
|
601
|
-
? extensionReasoning?.summary?.map((entry) => String(entry.text ?? '')).filter((text) => text.trim().length > 0)
|
|
602
|
-
: [];
|
|
603
|
-
const extensionEncrypted = typeof extensionReasoning?.encrypted_content === 'string' && extensionReasoning.encrypted_content.trim().length
|
|
604
|
-
? extensionReasoning.encrypted_content.trim()
|
|
605
|
-
: undefined;
|
|
606
|
-
const extensionText = extensionContent.length > 0
|
|
607
|
-
? extensionContent.join('\n')
|
|
608
|
-
: (extensionSummary.length > 0 ? extensionSummary.join('\n') : undefined);
|
|
609
|
-
const reasoningField = extensionText ??
|
|
610
|
-
(typeof msg?.reasoning_content === 'string'
|
|
611
|
-
? msg.reasoning_content
|
|
612
|
-
: typeof msg?.reasoning === 'string'
|
|
613
|
-
? msg.reasoning
|
|
614
|
-
: undefined);
|
|
615
|
-
if (reasoningField && reasoningField.trim().length) {
|
|
616
|
-
blocks.push({ type: 'thinking', text: reasoningField.trim() });
|
|
617
|
-
}
|
|
618
|
-
if (extensionEncrypted) {
|
|
619
|
-
blocks.push({ type: 'redacted_thinking', data: extensionEncrypted });
|
|
620
|
-
}
|
|
621
|
-
const toolCalls = Array.isArray(msg?.tool_calls) ? msg.tool_calls : [];
|
|
622
|
-
const toolNameResolver = createAnthropicToolNameResolver(options?.toolNameMap ?? extractToolNameMapFromPayload(oa));
|
|
623
|
-
for (const tc of toolCalls) {
|
|
624
|
-
try {
|
|
625
|
-
const id = sanitizeToolUseId(requireTrimmedString(tc?.id, 'chat.tool_call.id'));
|
|
626
|
-
const fn = isObject(tc?.function) ? tc.function : {};
|
|
627
|
-
const canonicalName = requireTrimmedString(fn.name, 'chat.tool_call.function.name');
|
|
628
|
-
const name = toolNameResolver ? toolNameResolver(canonicalName) : canonicalName;
|
|
629
|
-
const argsRaw = fn.arguments;
|
|
630
|
-
let input;
|
|
631
|
-
if (typeof argsRaw === 'string') {
|
|
632
|
-
const parsed = parseLenientJsonishWithNative(argsRaw);
|
|
633
|
-
input = parsed && typeof parsed === 'object' ? parsed : { _raw: argsRaw };
|
|
634
|
-
}
|
|
635
|
-
else {
|
|
636
|
-
input = argsRaw ?? {};
|
|
637
|
-
}
|
|
638
|
-
input = normalizeShellLikeToolInput(name, input);
|
|
639
|
-
blocks.push({ type: 'tool_use', id, name, input });
|
|
640
|
-
}
|
|
641
|
-
catch {
|
|
642
|
-
// ignore malformed tool call
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
const usageChunk = isObject(body.usage) ? body.usage : {};
|
|
646
|
-
const inputTokens = Number(usageChunk.prompt_tokens ?? usageChunk.input_tokens ?? 0);
|
|
647
|
-
const outputTokens = Number(usageChunk.completion_tokens ?? usageChunk.output_tokens ?? 0);
|
|
648
|
-
const finishReason = Array.isArray(body.choices) &&
|
|
649
|
-
body.choices[0] &&
|
|
650
|
-
typeof body.choices[0]?.finish_reason === 'string'
|
|
651
|
-
? String(body.choices[0].finish_reason).trim()
|
|
652
|
-
: undefined;
|
|
653
|
-
const stopReasonCandidate = mapFinishReason(finishReason) ||
|
|
654
|
-
mapFinishReason(typeof primary?.finish_reason === 'string' ? String(primary.finish_reason) : undefined) ||
|
|
655
|
-
(typeof body?.stop_reason === 'string' ? String(body.stop_reason).trim() : undefined) ||
|
|
656
|
-
(typeof primary?.stop_reason === 'string' ? String(primary.stop_reason).trim() : undefined);
|
|
657
|
-
const hasToolCalls = toolCalls.length > 0;
|
|
658
|
-
const stopReason = stopReasonCandidate ?? (hasToolCalls ? 'tool_use' : 'end_turn');
|
|
659
|
-
const resolveResponseId = () => {
|
|
660
|
-
const preferred = [
|
|
661
|
-
body?.id,
|
|
662
|
-
body?.response?.id,
|
|
663
|
-
body?.response_id
|
|
664
|
-
];
|
|
665
|
-
for (const candidateRaw of preferred) {
|
|
666
|
-
if (typeof candidateRaw !== 'string')
|
|
667
|
-
continue;
|
|
668
|
-
const candidate = candidateRaw.trim();
|
|
669
|
-
if (!candidate.length)
|
|
670
|
-
continue;
|
|
671
|
-
if (candidate.startsWith('resp_')) {
|
|
672
|
-
return candidate;
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
const fromRequest = typeof options?.requestId === 'string' && options.requestId.trim().startsWith('resp_')
|
|
676
|
-
? options.requestId.trim()
|
|
677
|
-
: undefined;
|
|
678
|
-
return fromRequest ?? `resp_${Date.now()}`;
|
|
679
|
-
};
|
|
680
|
-
const resolveCreated = () => {
|
|
681
|
-
const candidateNumbers = [
|
|
682
|
-
body?.created,
|
|
683
|
-
body?.created_at,
|
|
684
|
-
body?.response?.created,
|
|
685
|
-
body?.response?.created_at
|
|
686
|
-
];
|
|
687
|
-
for (const candidate of candidateNumbers) {
|
|
688
|
-
if (typeof candidate === 'number' && Number.isFinite(candidate)) {
|
|
689
|
-
return Math.floor(candidate);
|
|
690
|
-
}
|
|
691
|
-
}
|
|
692
|
-
return Math.floor(Date.now() / 1000);
|
|
693
|
-
};
|
|
694
|
-
return {
|
|
695
|
-
id: resolveResponseId(),
|
|
696
|
-
type: 'message',
|
|
697
|
-
role,
|
|
698
|
-
model: String(body.model || 'unknown'),
|
|
699
|
-
created: resolveCreated(),
|
|
700
|
-
content: blocks,
|
|
701
|
-
usage: inputTokens || outputTokens ? { input_tokens: inputTokens, output_tokens: outputTokens } : undefined,
|
|
702
|
-
stop_reason: stopReason
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
function extractToolNameMapFromPayload(payload) {
|
|
706
|
-
if (!payload || typeof payload !== 'object') {
|
|
707
|
-
return undefined;
|
|
708
|
-
}
|
|
709
|
-
const candidateSources = [
|
|
710
|
-
payload.anthropicToolNameMap,
|
|
711
|
-
payload.__anthropicToolNameMap,
|
|
712
|
-
payload.metadata &&
|
|
713
|
-
typeof payload.metadata === 'object'
|
|
714
|
-
? payload.metadata.anthropicToolNameMap
|
|
715
|
-
: undefined,
|
|
716
|
-
payload.metadata &&
|
|
717
|
-
typeof payload.metadata === 'object'
|
|
718
|
-
? payload.metadata.extraFields &&
|
|
719
|
-
typeof payload.metadata.extraFields === 'object'
|
|
720
|
-
? payload.metadata.extraFields.anthropicToolNameMap
|
|
721
|
-
: undefined
|
|
722
|
-
: undefined,
|
|
723
|
-
payload.metadata &&
|
|
724
|
-
typeof payload.metadata === 'object' &&
|
|
725
|
-
payload.metadata.capturedContext &&
|
|
726
|
-
typeof payload.metadata.capturedContext === 'object'
|
|
727
|
-
? (payload.metadata.capturedContext.__hub_capture &&
|
|
728
|
-
typeof payload.metadata.capturedContext.__hub_capture === 'object'
|
|
729
|
-
? payload.metadata.capturedContext.__hub_capture.extraFields &&
|
|
730
|
-
typeof payload.metadata.capturedContext.__hub_capture.extraFields === 'object'
|
|
731
|
-
? payload.metadata.capturedContext.__hub_capture.extraFields
|
|
732
|
-
: undefined
|
|
733
|
-
: undefined)
|
|
734
|
-
: undefined
|
|
735
|
-
];
|
|
736
|
-
for (const candidate of candidateSources) {
|
|
737
|
-
const map = coerceAliasRecord(candidate);
|
|
738
|
-
if (map) {
|
|
739
|
-
return map;
|
|
740
|
-
}
|
|
741
|
-
}
|
|
742
|
-
return undefined;
|
|
743
|
-
}
|
|
744
|
-
function coerceAliasRecord(candidate) {
|
|
745
|
-
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {
|
|
746
|
-
return undefined;
|
|
747
|
-
}
|
|
748
|
-
let hasEntry = false;
|
|
749
|
-
const output = {};
|
|
750
|
-
for (const [key, value] of Object.entries(candidate)) {
|
|
751
|
-
if (typeof key !== 'string' || typeof value !== 'string') {
|
|
752
|
-
continue;
|
|
753
|
-
}
|
|
754
|
-
const trimmedKey = key.trim();
|
|
755
|
-
if (!trimmedKey.length) {
|
|
756
|
-
continue;
|
|
757
|
-
}
|
|
758
|
-
output[trimmedKey] = value;
|
|
759
|
-
hasEntry = true;
|
|
760
|
-
}
|
|
761
|
-
return hasEntry ? output : undefined;
|
|
762
|
-
}
|
|
763
|
-
function createAnthropicToolNameResolver(source) {
|
|
764
|
-
if (!source) {
|
|
765
|
-
return undefined;
|
|
766
|
-
}
|
|
767
|
-
const lookup = new Map();
|
|
768
|
-
for (const [key, value] of Object.entries(source)) {
|
|
769
|
-
if (typeof key !== 'string' || typeof value !== 'string')
|
|
770
|
-
continue;
|
|
771
|
-
const canonical = key.trim();
|
|
772
|
-
if (!canonical.length)
|
|
773
|
-
continue;
|
|
774
|
-
const alias = value.trim() || canonical;
|
|
775
|
-
lookup.set(canonical, alias);
|
|
776
|
-
const lower = canonical.toLowerCase();
|
|
777
|
-
if (!lookup.has(lower)) {
|
|
778
|
-
lookup.set(lower, alias);
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
if (!lookup.size) {
|
|
782
|
-
return undefined;
|
|
783
|
-
}
|
|
784
|
-
return (name) => {
|
|
785
|
-
const trimmed = name.trim();
|
|
786
|
-
if (!trimmed.length) {
|
|
787
|
-
return name;
|
|
788
|
-
}
|
|
789
|
-
const direct = lookup.get(trimmed) ?? lookup.get(trimmed.toLowerCase());
|
|
790
|
-
if (direct) {
|
|
791
|
-
return direct;
|
|
792
|
-
}
|
|
793
|
-
const normalized = normalizeAnthropicToolName(trimmed);
|
|
794
|
-
if (normalized) {
|
|
795
|
-
return lookup.get(normalized) ?? lookup.get(normalized.toLowerCase()) ?? trimmed;
|
|
796
|
-
}
|
|
797
|
-
return trimmed;
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
function normalizeAnthropicToolChoice(value) {
|
|
801
|
-
if (value === undefined || value === null) {
|
|
802
|
-
return undefined;
|
|
803
|
-
}
|
|
804
|
-
if (isPlainRecord(value)) {
|
|
805
|
-
// Already an object – best-effort clone while trimming type, and also support
|
|
806
|
-
// Chat-style { type: 'function', function: { name } } by mapping to Anthropic's
|
|
807
|
-
// { type: 'tool', name } shape.
|
|
808
|
-
const cloned = cloneAnthropicSchema(value);
|
|
809
|
-
const rawType = typeof cloned.type === 'string' ? String(cloned.type).trim() : '';
|
|
810
|
-
if (rawType) {
|
|
811
|
-
cloned.type = rawType;
|
|
812
|
-
return cloned;
|
|
813
|
-
}
|
|
814
|
-
const selectorType = typeof cloned.type === 'string' ? String(cloned.type).trim() : '';
|
|
815
|
-
const fn = cloned.function;
|
|
816
|
-
if (selectorType === 'function' &&
|
|
817
|
-
fn &&
|
|
818
|
-
typeof fn === 'object' &&
|
|
819
|
-
typeof fn.name === 'string' &&
|
|
820
|
-
String(fn.name).trim().length) {
|
|
821
|
-
return { type: 'tool', name: String(fn.name).trim() };
|
|
822
|
-
}
|
|
823
|
-
return cloned;
|
|
824
|
-
}
|
|
825
|
-
if (typeof value === 'string') {
|
|
826
|
-
const trimmed = value.trim();
|
|
827
|
-
if (!trimmed.length) {
|
|
828
|
-
return undefined;
|
|
829
|
-
}
|
|
830
|
-
const lower = trimmed.toLowerCase();
|
|
831
|
-
if (lower === 'auto') {
|
|
832
|
-
return { type: 'auto' };
|
|
833
|
-
}
|
|
834
|
-
if (lower === 'none') {
|
|
835
|
-
return { type: 'none' };
|
|
836
|
-
}
|
|
837
|
-
if (lower === 'any') {
|
|
838
|
-
return { type: 'any' };
|
|
839
|
-
}
|
|
840
|
-
if (lower === 'required') {
|
|
841
|
-
// "required" in canonical Chat roughly maps to Anthropic's "any" semantics:
|
|
842
|
-
// the model must choose some tool if available.
|
|
843
|
-
return { type: 'any' };
|
|
844
|
-
}
|
|
845
|
-
// Fallback: preserve custom mode as-is in type field.
|
|
846
|
-
return { type: trimmed };
|
|
847
|
-
}
|
|
848
|
-
return undefined;
|
|
849
|
-
}
|
|
850
|
-
export function buildAnthropicRequestFromOpenAIChat(chatReq) {
|
|
851
|
-
const requestBody = isObject(chatReq) ? chatReq : {};
|
|
852
|
-
const model = String(requestBody?.model || 'unknown');
|
|
853
|
-
const messages = [];
|
|
854
|
-
try {
|
|
855
|
-
const bridgePolicy = resolveBridgePolicy({ protocol: 'anthropic-messages' });
|
|
856
|
-
const actions = resolvePolicyActions(bridgePolicy, 'request_outbound');
|
|
857
|
-
if (actions?.length && Array.isArray(requestBody.messages)) {
|
|
858
|
-
const actionState = createBridgeActionState({
|
|
859
|
-
messages: requestBody.messages,
|
|
860
|
-
rawRequest: requestBody
|
|
861
|
-
});
|
|
862
|
-
runBridgeActionPipeline({
|
|
863
|
-
stage: 'request_outbound',
|
|
864
|
-
actions,
|
|
865
|
-
protocol: bridgePolicy?.protocol ?? 'anthropic-messages',
|
|
866
|
-
moduleType: bridgePolicy?.moduleType ?? 'anthropic-messages',
|
|
867
|
-
state: actionState
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
}
|
|
871
|
-
catch {
|
|
872
|
-
// ignore policy errors
|
|
873
|
-
}
|
|
874
|
-
const collectText = (val) => {
|
|
875
|
-
if (!val)
|
|
876
|
-
return '';
|
|
877
|
-
if (typeof val === 'string')
|
|
878
|
-
return val;
|
|
879
|
-
if (Array.isArray(val))
|
|
880
|
-
return val.map(collectText).join('');
|
|
881
|
-
if (typeof val === 'object') {
|
|
882
|
-
if (typeof val.text === 'string')
|
|
883
|
-
return String(val.text);
|
|
884
|
-
if (Array.isArray(val.content))
|
|
885
|
-
return collectText(val.content);
|
|
886
|
-
}
|
|
887
|
-
return '';
|
|
888
|
-
};
|
|
889
|
-
const msgs = Array.isArray(requestBody?.messages) ? requestBody.messages : [];
|
|
890
|
-
const mirrorShapes = extractMirrorShapesFromRequest(requestBody);
|
|
891
|
-
let mirrorIndex = 0;
|
|
892
|
-
const knownToolCallIds = new Set();
|
|
893
|
-
for (const m of msgs) {
|
|
894
|
-
if (!m || typeof m !== 'object')
|
|
895
|
-
continue;
|
|
896
|
-
const role = String(m.role || 'user');
|
|
897
|
-
if (role !== 'assistant')
|
|
898
|
-
continue;
|
|
899
|
-
const toolCalls = m.tool_calls;
|
|
900
|
-
if (!Array.isArray(toolCalls))
|
|
901
|
-
continue;
|
|
902
|
-
for (const tc of toolCalls) {
|
|
903
|
-
if (!tc || typeof tc !== 'object')
|
|
904
|
-
continue;
|
|
905
|
-
const id = sanitizeToolUseId(requireTrimmedString(tc.id, 'chat.tool_call.id'));
|
|
906
|
-
knownToolCallIds.add(id);
|
|
907
|
-
}
|
|
908
|
-
}
|
|
909
|
-
const systemBlocks = [];
|
|
910
|
-
const pushSystemBlock = (text) => {
|
|
911
|
-
const trimmed = text.trim();
|
|
912
|
-
if (trimmed)
|
|
913
|
-
systemBlocks.push({ type: 'text', text: trimmed });
|
|
914
|
-
};
|
|
915
|
-
try {
|
|
916
|
-
const sys = requestBody.system;
|
|
917
|
-
const ingestSystem = (val) => {
|
|
918
|
-
if (!val)
|
|
919
|
-
return;
|
|
920
|
-
if (typeof val === 'string') {
|
|
921
|
-
pushSystemBlock(requireSystemText(val, 'top-level system'));
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
if (Array.isArray(val)) {
|
|
925
|
-
for (const entry of val)
|
|
926
|
-
ingestSystem(entry);
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
if (typeof val === 'object') {
|
|
930
|
-
pushSystemBlock(requireSystemText(val, 'top-level system'));
|
|
931
|
-
return;
|
|
932
|
-
}
|
|
933
|
-
throw new ProviderProtocolError('Anthropic bridge constraint violated: unsupported system payload type', {
|
|
934
|
-
code: 'MALFORMED_REQUEST',
|
|
935
|
-
protocol: 'anthropic-messages',
|
|
936
|
-
providerType: 'anthropic',
|
|
937
|
-
details: { context: 'top-level system', actualType: typeof val }
|
|
938
|
-
});
|
|
939
|
-
};
|
|
940
|
-
ingestSystem(sys);
|
|
941
|
-
}
|
|
942
|
-
catch {
|
|
943
|
-
// ignore system pre-scan errors
|
|
944
|
-
}
|
|
945
|
-
for (const m of msgs) {
|
|
946
|
-
if (!m || typeof m !== 'object')
|
|
947
|
-
continue;
|
|
948
|
-
const role = String(m.role || 'user');
|
|
949
|
-
let targetShape;
|
|
950
|
-
if (role !== 'system' && Array.isArray(mirrorShapes)) {
|
|
951
|
-
targetShape = mirrorShapes[mirrorIndex];
|
|
952
|
-
mirrorIndex += 1;
|
|
953
|
-
}
|
|
954
|
-
const contentNode = m.content;
|
|
955
|
-
const text = collectText(contentNode).trim();
|
|
956
|
-
if (role === 'system') {
|
|
957
|
-
if (!text) {
|
|
958
|
-
throw new ProviderProtocolError('Anthropic bridge constraint violated: Chat system message must contain text', {
|
|
959
|
-
code: 'MALFORMED_REQUEST',
|
|
960
|
-
protocol: 'anthropic-messages',
|
|
961
|
-
providerType: 'anthropic',
|
|
962
|
-
details: { context: 'chat.system', original: contentNode }
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
pushSystemBlock(text);
|
|
966
|
-
continue;
|
|
967
|
-
}
|
|
968
|
-
if (role === 'tool') {
|
|
969
|
-
const toolCallId = sanitizeToolUseId(requireTrimmedString(m.tool_call_id ?? m.call_id ?? m.tool_use_id ?? m.id, 'tool_result.tool_call_id'));
|
|
970
|
-
if (!knownToolCallIds.has(toolCallId)) {
|
|
971
|
-
throw new ProviderProtocolError(`Anthropic bridge constraint violated: tool result ${toolCallId} has no matching tool call`, {
|
|
972
|
-
code: 'TOOL_PROTOCOL_ERROR',
|
|
973
|
-
protocol: 'anthropic-messages',
|
|
974
|
-
providerType: 'anthropic',
|
|
975
|
-
details: { toolCallId }
|
|
976
|
-
});
|
|
977
|
-
}
|
|
978
|
-
const block = {
|
|
979
|
-
type: 'tool_result',
|
|
980
|
-
content: text
|
|
981
|
-
};
|
|
982
|
-
block.tool_use_id = toolCallId;
|
|
983
|
-
messages.push({
|
|
984
|
-
role: 'user',
|
|
985
|
-
content: [block]
|
|
986
|
-
});
|
|
987
|
-
continue;
|
|
988
|
-
}
|
|
989
|
-
const blocks = [];
|
|
990
|
-
if (Array.isArray(contentNode)) {
|
|
991
|
-
// Preserve or synthesize image blocks where possible, and fall back to text for the rest.
|
|
992
|
-
for (const entry of contentNode) {
|
|
993
|
-
if (!entry || typeof entry !== 'object')
|
|
994
|
-
continue;
|
|
995
|
-
const node = entry;
|
|
996
|
-
const t = typeof node.type === 'string' ? node.type.toLowerCase() : '';
|
|
997
|
-
if (t === 'image' && node.source && typeof node.source === 'object') {
|
|
998
|
-
// Pass-through Anthropic image block as-is.
|
|
999
|
-
blocks.push({
|
|
1000
|
-
type: 'image',
|
|
1001
|
-
source: jsonClone(node.source)
|
|
1002
|
-
});
|
|
1003
|
-
continue;
|
|
1004
|
-
}
|
|
1005
|
-
if (t === 'image_url') {
|
|
1006
|
-
let url = '';
|
|
1007
|
-
const imageUrl = node.image_url;
|
|
1008
|
-
if (typeof imageUrl === 'string') {
|
|
1009
|
-
url = imageUrl;
|
|
1010
|
-
}
|
|
1011
|
-
else if (imageUrl && typeof imageUrl === 'object' && typeof imageUrl.url === 'string') {
|
|
1012
|
-
url = imageUrl.url;
|
|
1013
|
-
}
|
|
1014
|
-
const trimmed = url.trim();
|
|
1015
|
-
if (!trimmed.length)
|
|
1016
|
-
continue;
|
|
1017
|
-
const source = {};
|
|
1018
|
-
if (trimmed.startsWith('data:')) {
|
|
1019
|
-
const match = /^data:([^;,]+)?(?:;base64)?,(.*)$/s.exec(trimmed);
|
|
1020
|
-
if (match) {
|
|
1021
|
-
const mediaType = (match[1] || '').trim() || 'image/png';
|
|
1022
|
-
source.type = 'base64';
|
|
1023
|
-
source.media_type = mediaType;
|
|
1024
|
-
source.data = match[2] || '';
|
|
1025
|
-
}
|
|
1026
|
-
else {
|
|
1027
|
-
source.type = 'url';
|
|
1028
|
-
source.url = trimmed;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
else {
|
|
1032
|
-
source.type = 'url';
|
|
1033
|
-
source.url = trimmed;
|
|
1034
|
-
}
|
|
1035
|
-
blocks.push({
|
|
1036
|
-
type: 'image',
|
|
1037
|
-
source
|
|
1038
|
-
});
|
|
1039
|
-
}
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
if (text) {
|
|
1043
|
-
blocks.push({ type: 'text', text });
|
|
1044
|
-
}
|
|
1045
|
-
const toolCalls = Array.isArray(m.tool_calls) ? m.tool_calls : [];
|
|
1046
|
-
for (const tc of toolCalls) {
|
|
1047
|
-
if (!tc || typeof tc !== 'object')
|
|
1048
|
-
continue;
|
|
1049
|
-
const id = sanitizeToolUseId(requireTrimmedString(tc.id, 'chat.tool_call.id'));
|
|
1050
|
-
const fn = tc.function || {};
|
|
1051
|
-
const name = requireTrimmedString(fn.name, 'chat.tool_call.function.name');
|
|
1052
|
-
const argsRaw = fn.arguments;
|
|
1053
|
-
let input;
|
|
1054
|
-
if (typeof argsRaw === 'string') {
|
|
1055
|
-
const parsed = parseLenientJsonishWithNative(argsRaw);
|
|
1056
|
-
input = parsed && typeof parsed === 'object' ? parsed : { _raw: argsRaw };
|
|
1057
|
-
}
|
|
1058
|
-
else {
|
|
1059
|
-
input = argsRaw ?? {};
|
|
1060
|
-
}
|
|
1061
|
-
input = normalizeShellLikeToolInput(name, input);
|
|
1062
|
-
blocks.push({ type: 'tool_use', id, name, input });
|
|
1063
|
-
}
|
|
1064
|
-
if (blocks.length > 0) {
|
|
1065
|
-
const hasStructuredBlocks = blocks.some((block) => block && typeof block === 'object' && block.type !== 'text');
|
|
1066
|
-
let contentNode = blocks;
|
|
1067
|
-
if (!hasStructuredBlocks && (targetShape === 'string' || !targetShape)) {
|
|
1068
|
-
contentNode = text;
|
|
1069
|
-
}
|
|
1070
|
-
messages.push({ role, content: contentNode });
|
|
1071
|
-
}
|
|
1072
|
-
}
|
|
1073
|
-
const out = { model };
|
|
1074
|
-
if (systemBlocks.length) {
|
|
1075
|
-
out.system = systemBlocks;
|
|
1076
|
-
}
|
|
1077
|
-
out.messages = messages;
|
|
1078
|
-
const anthropicTools = mapChatToolsToAnthropicTools(requestBody.tools);
|
|
1079
|
-
if (anthropicTools !== undefined) {
|
|
1080
|
-
out.tools = anthropicTools;
|
|
1081
|
-
}
|
|
1082
|
-
const normalizedToolChoice = normalizeAnthropicToolChoice(requestBody.tool_choice);
|
|
1083
|
-
if (normalizedToolChoice !== undefined) {
|
|
1084
|
-
out.tool_choice = normalizedToolChoice;
|
|
1085
|
-
}
|
|
1086
|
-
if (requestBody.thinking !== undefined) {
|
|
1087
|
-
try {
|
|
1088
|
-
out.thinking = JSON.parse(JSON.stringify(requestBody.thinking));
|
|
1089
|
-
}
|
|
1090
|
-
catch {
|
|
1091
|
-
out.thinking = requestBody.thinking;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
try {
|
|
1095
|
-
if (requestBody.metadata && typeof requestBody.metadata === 'object') {
|
|
1096
|
-
out.metadata = JSON.parse(JSON.stringify(requestBody.metadata));
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
catch {
|
|
1100
|
-
// best-effort metadata clone
|
|
1101
|
-
}
|
|
1102
|
-
const mt = Number(requestBody.max_tokens ??
|
|
1103
|
-
requestBody.maxTokens ??
|
|
1104
|
-
NaN);
|
|
1105
|
-
if (Number.isFinite(mt) && mt > 0)
|
|
1106
|
-
out.max_tokens = mt;
|
|
1107
|
-
if (typeof requestBody.temperature === 'number') {
|
|
1108
|
-
out.temperature = Number(requestBody.temperature);
|
|
1109
|
-
}
|
|
1110
|
-
if (typeof requestBody.top_p === 'number') {
|
|
1111
|
-
out.top_p = Number(requestBody.top_p);
|
|
1112
|
-
}
|
|
1113
|
-
if (typeof requestBody.stream === 'boolean') {
|
|
1114
|
-
out.stream = Boolean(requestBody.stream);
|
|
1115
|
-
}
|
|
1116
|
-
const stop = requestBody.stop;
|
|
1117
|
-
if (typeof stop === 'string' && stop.trim()) {
|
|
1118
|
-
out.stop_sequences = [stop.trim()];
|
|
1119
|
-
}
|
|
1120
|
-
else if (Array.isArray(stop) && stop.length > 0) {
|
|
1121
|
-
out.stop_sequences = stop.map((s) => String(s)).filter(Boolean);
|
|
1122
|
-
}
|
|
1123
|
-
return pruneAnthropicRequest(out);
|
|
1124
|
-
}
|
|
1125
|
-
function isPlainRecord(value) {
|
|
1126
|
-
return !!value && typeof value === 'object' && !Array.isArray(value);
|
|
1127
|
-
}
|
|
1128
|
-
function coerceJsonValue(value) {
|
|
1129
|
-
if (value === null || typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
1130
|
-
return value;
|
|
1131
|
-
}
|
|
1132
|
-
if (Array.isArray(value)) {
|
|
1133
|
-
return value.map((entry) => coerceJsonValue(entry));
|
|
1134
|
-
}
|
|
1135
|
-
if (isPlainRecord(value)) {
|
|
1136
|
-
const obj = {};
|
|
1137
|
-
for (const [key, entry] of Object.entries(value)) {
|
|
1138
|
-
obj[key] = coerceJsonValue(entry);
|
|
1139
|
-
}
|
|
1140
|
-
return obj;
|
|
1141
|
-
}
|
|
1142
|
-
return String(value ?? '');
|
|
1143
|
-
}
|
|
1144
|
-
function cloneAnthropicSchema(value) {
|
|
1145
|
-
if (isPlainRecord(value)) {
|
|
1146
|
-
try {
|
|
1147
|
-
return JSON.parse(JSON.stringify(value));
|
|
1148
|
-
}
|
|
1149
|
-
catch {
|
|
1150
|
-
return value;
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
return { type: 'object', properties: {} };
|
|
1154
|
-
}
|
|
1155
|
-
function normalizeAnthropicSchemaType(value) {
|
|
1156
|
-
if (typeof value === 'string') {
|
|
1157
|
-
const trimmed = value.trim().toLowerCase();
|
|
1158
|
-
if (trimmed === 'string' ||
|
|
1159
|
-
trimmed === 'number' ||
|
|
1160
|
-
trimmed === 'integer' ||
|
|
1161
|
-
trimmed === 'boolean' ||
|
|
1162
|
-
trimmed === 'object' ||
|
|
1163
|
-
trimmed === 'array') {
|
|
1164
|
-
return trimmed;
|
|
1165
|
-
}
|
|
1166
|
-
return undefined;
|
|
1167
|
-
}
|
|
1168
|
-
if (Array.isArray(value)) {
|
|
1169
|
-
for (const entry of value) {
|
|
1170
|
-
const normalized = normalizeAnthropicSchemaType(entry);
|
|
1171
|
-
if (normalized) {
|
|
1172
|
-
return normalized;
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
return undefined;
|
|
1177
|
-
}
|
|
1178
|
-
function compactAnthropicPropertySchema(schema) {
|
|
1179
|
-
if (!isPlainRecord(schema)) {
|
|
1180
|
-
return { type: 'string' };
|
|
1181
|
-
}
|
|
1182
|
-
const out = {};
|
|
1183
|
-
const type = normalizeAnthropicSchemaType(schema.type);
|
|
1184
|
-
if (type) {
|
|
1185
|
-
out.type = type;
|
|
1186
|
-
}
|
|
1187
|
-
if (typeof schema.description === 'string' && schema.description.trim()) {
|
|
1188
|
-
out.description = schema.description;
|
|
1189
|
-
}
|
|
1190
|
-
const enumRaw = Array.isArray(schema.enum) ? schema.enum : undefined;
|
|
1191
|
-
if (enumRaw && enumRaw.length) {
|
|
1192
|
-
const enumValues = enumRaw
|
|
1193
|
-
.filter((entry) => {
|
|
1194
|
-
const entryType = typeof entry;
|
|
1195
|
-
return entryType === 'string' || entryType === 'number' || entryType === 'boolean';
|
|
1196
|
-
})
|
|
1197
|
-
.slice(0, 64);
|
|
1198
|
-
if (enumValues.length) {
|
|
1199
|
-
out.enum = enumValues;
|
|
1200
|
-
if (!out.type) {
|
|
1201
|
-
const inferred = typeof enumValues[0];
|
|
1202
|
-
out.type = inferred === 'boolean' ? 'boolean' : inferred === 'number' ? 'number' : 'string';
|
|
1203
|
-
}
|
|
1204
|
-
}
|
|
1205
|
-
}
|
|
1206
|
-
if (out.type === 'array') {
|
|
1207
|
-
const items = isPlainRecord(schema.items) ? schema.items : {};
|
|
1208
|
-
const itemType = normalizeAnthropicSchemaType(items.type) ?? 'string';
|
|
1209
|
-
out.items = { type: itemType };
|
|
1210
|
-
}
|
|
1211
|
-
else if (out.type === 'object') {
|
|
1212
|
-
out.properties = {};
|
|
1213
|
-
out.additionalProperties = false;
|
|
1214
|
-
}
|
|
1215
|
-
if (!out.type) {
|
|
1216
|
-
out.type = 'string';
|
|
1217
|
-
}
|
|
1218
|
-
return out;
|
|
1219
|
-
}
|
|
1220
|
-
function sanitizeAnthropicBuiltinInputSchema(toolName, schemaSource) {
|
|
1221
|
-
const normalizedName = toolName.trim().toLowerCase();
|
|
1222
|
-
if (!ANTHROPIC_STABLE_TOOL_SCHEMA_NAMES.has(normalizedName)) {
|
|
1223
|
-
return cloneAnthropicSchema(schemaSource);
|
|
1224
|
-
}
|
|
1225
|
-
const source = cloneAnthropicSchema(schemaSource);
|
|
1226
|
-
const sourceProperties = isPlainRecord(source.properties) ? source.properties : {};
|
|
1227
|
-
const allowedKeys = ANTHROPIC_STABLE_TOOL_SCHEMA_KEYS.get(normalizedName);
|
|
1228
|
-
const sanitizedProperties = {};
|
|
1229
|
-
for (const [key, value] of Object.entries(sourceProperties)) {
|
|
1230
|
-
if (allowedKeys && !allowedKeys.has(key)) {
|
|
1231
|
-
continue;
|
|
1232
|
-
}
|
|
1233
|
-
sanitizedProperties[key] = compactAnthropicPropertySchema(value);
|
|
1234
|
-
}
|
|
1235
|
-
const required = Array.isArray(source.required)
|
|
1236
|
-
? source.required.filter((entry) => typeof entry === 'string' && entry.trim().length > 0)
|
|
1237
|
-
: [];
|
|
1238
|
-
const filteredRequired = allowedKeys
|
|
1239
|
-
? required.filter((key) => allowedKeys.has(key))
|
|
1240
|
-
: required;
|
|
1241
|
-
for (const key of filteredRequired) {
|
|
1242
|
-
if (!Object.prototype.hasOwnProperty.call(sanitizedProperties, key)) {
|
|
1243
|
-
sanitizedProperties[key] = { type: 'string' };
|
|
1244
|
-
}
|
|
1245
|
-
}
|
|
1246
|
-
const output = {
|
|
1247
|
-
type: 'object',
|
|
1248
|
-
properties: sanitizedProperties,
|
|
1249
|
-
additionalProperties: false
|
|
1250
|
-
};
|
|
1251
|
-
if (filteredRequired.length) {
|
|
1252
|
-
output.required = Array.from(new Set(filteredRequired));
|
|
1253
|
-
}
|
|
1254
|
-
return output;
|
|
1255
|
-
}
|
|
1256
|
-
function prepareAnthropicBridgeTools(rawTools, missing) {
|
|
1257
|
-
if (!Array.isArray(rawTools) || rawTools.length === 0) {
|
|
1258
|
-
return undefined;
|
|
1259
|
-
}
|
|
1260
|
-
const result = [];
|
|
1261
|
-
rawTools.forEach((entry, index) => {
|
|
1262
|
-
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
1263
|
-
missing?.push({
|
|
1264
|
-
path: `tools[${index}]`,
|
|
1265
|
-
reason: 'invalid_entry',
|
|
1266
|
-
originalValue: jsonClone(coerceJsonValue(entry))
|
|
1267
|
-
});
|
|
1268
|
-
return;
|
|
1269
|
-
}
|
|
1270
|
-
const name = typeof entry.name === 'string'
|
|
1271
|
-
? entry.name
|
|
1272
|
-
: undefined;
|
|
1273
|
-
if (!name) {
|
|
1274
|
-
missing?.push({ path: `tools[${index}].name`, reason: 'missing_name' });
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
const description = typeof entry.description === 'string'
|
|
1278
|
-
? entry.description
|
|
1279
|
-
: undefined;
|
|
1280
|
-
const schemaSource = entry.input_schema;
|
|
1281
|
-
const parameters = cloneAnthropicSchema(schemaSource);
|
|
1282
|
-
result.push({
|
|
1283
|
-
type: 'function',
|
|
1284
|
-
function: {
|
|
1285
|
-
name,
|
|
1286
|
-
description,
|
|
1287
|
-
parameters
|
|
1288
|
-
}
|
|
1289
|
-
});
|
|
1290
|
-
});
|
|
1291
|
-
return result.length ? result : undefined;
|
|
1292
|
-
}
|
|
1293
|
-
function convertBridgeToolToAnthropic(def) {
|
|
1294
|
-
if (!def || typeof def !== 'object') {
|
|
1295
|
-
return null;
|
|
1296
|
-
}
|
|
1297
|
-
const fnNode = def.function && typeof def.function === 'object' ? def.function : undefined;
|
|
1298
|
-
const name = typeof fnNode?.name === 'string'
|
|
1299
|
-
? fnNode.name
|
|
1300
|
-
: typeof def.name === 'string'
|
|
1301
|
-
? def.name
|
|
1302
|
-
: undefined;
|
|
1303
|
-
if (!name) {
|
|
1304
|
-
return null;
|
|
1305
|
-
}
|
|
1306
|
-
const description = typeof fnNode?.description === 'string'
|
|
1307
|
-
? fnNode.description
|
|
1308
|
-
: typeof def.description === 'string'
|
|
1309
|
-
? def.description
|
|
1310
|
-
: undefined;
|
|
1311
|
-
const schemaSource = fnNode?.parameters ?? def.parameters;
|
|
1312
|
-
const inputSchema = sanitizeAnthropicBuiltinInputSchema(name, schemaSource);
|
|
1313
|
-
const tool = {
|
|
1314
|
-
name,
|
|
1315
|
-
input_schema: inputSchema
|
|
1316
|
-
};
|
|
1317
|
-
if (description !== undefined) {
|
|
1318
|
-
tool.description = description;
|
|
1319
|
-
}
|
|
1320
|
-
return tool;
|
|
1321
|
-
}
|
|
1322
|
-
export function mapAnthropicToolsToChat(rawTools, missing) {
|
|
1323
|
-
const prepared = prepareAnthropicBridgeTools(rawTools, missing);
|
|
1324
|
-
if (prepared === undefined) {
|
|
1325
|
-
return undefined;
|
|
1326
|
-
}
|
|
1327
|
-
return mapBridgeToolsToChat(prepared, { sanitizeName: normalizeAnthropicToolName });
|
|
1328
|
-
}
|
|
1329
|
-
export function mapChatToolsToAnthropicTools(rawTools) {
|
|
1330
|
-
if (!Array.isArray(rawTools) || rawTools.length === 0) {
|
|
1331
|
-
return undefined;
|
|
1332
|
-
}
|
|
1333
|
-
const bridgeDefs = mapChatToolsToBridge(rawTools, { sanitizeName: denormalizeAnthropicToolName });
|
|
1334
|
-
if (!bridgeDefs || !bridgeDefs.length) {
|
|
1335
|
-
return undefined;
|
|
1336
|
-
}
|
|
1337
|
-
const converted = bridgeDefs
|
|
1338
|
-
.map((def) => convertBridgeToolToAnthropic(def))
|
|
1339
|
-
.filter((entry) => !!entry);
|
|
1340
|
-
return converted.length ? converted : undefined;
|
|
1341
|
-
}
|
|
1342
|
-
function pruneAnthropicRequest(payload) {
|
|
1343
|
-
for (const key of Object.keys(payload)) {
|
|
1344
|
-
if (!ANTHROPIC_TOP_LEVEL_FIELDS.has(key)) {
|
|
1345
|
-
delete payload[key];
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
return payload;
|
|
1349
|
-
}
|
|
1350
|
-
function extractMirrorShapesFromRequest(source) {
|
|
1351
|
-
const directMirror = source &&
|
|
1352
|
-
typeof source === 'object' &&
|
|
1353
|
-
source.__anthropicMirror &&
|
|
1354
|
-
typeof source.__anthropicMirror === 'object'
|
|
1355
|
-
? source.__anthropicMirror
|
|
1356
|
-
: extractMirrorFromMetadata(source);
|
|
1357
|
-
if (!directMirror) {
|
|
1358
|
-
return undefined;
|
|
1359
|
-
}
|
|
1360
|
-
const shapes = directMirror.messageContentShape;
|
|
1361
|
-
if (!Array.isArray(shapes)) {
|
|
1362
|
-
return undefined;
|
|
1363
|
-
}
|
|
1364
|
-
return shapes.map((entry) => (typeof entry === 'string' ? entry : String(entry ?? '')));
|
|
1365
|
-
}
|
|
1366
|
-
function extractMirrorFromMetadata(source) {
|
|
1367
|
-
if (!source || typeof source !== 'object') {
|
|
1368
|
-
return undefined;
|
|
1369
|
-
}
|
|
1370
|
-
const metadata = source.metadata;
|
|
1371
|
-
if (!metadata || typeof metadata !== 'object') {
|
|
1372
|
-
return undefined;
|
|
1373
|
-
}
|
|
1374
|
-
const extraFields = metadata.extraFields;
|
|
1375
|
-
if (!extraFields || typeof extraFields !== 'object') {
|
|
1376
|
-
return undefined;
|
|
1377
|
-
}
|
|
1378
|
-
const mirror = extraFields.anthropicMirror;
|
|
1379
|
-
return mirror && typeof mirror === 'object' ? mirror : undefined;
|
|
1380
|
-
}
|
|
1381
|
-
export function buildAnthropicToolAliasMap(rawTools) {
|
|
1382
|
-
if (!Array.isArray(rawTools) || rawTools.length === 0) {
|
|
1383
|
-
return undefined;
|
|
1384
|
-
}
|
|
1385
|
-
const aliasMap = new Map();
|
|
1386
|
-
for (const entry of rawTools) {
|
|
1387
|
-
if (!entry || typeof entry !== 'object' || Array.isArray(entry)) {
|
|
1388
|
-
continue;
|
|
1389
|
-
}
|
|
1390
|
-
const rawName = typeof entry.name === 'string'
|
|
1391
|
-
? entry.name.trim()
|
|
1392
|
-
: undefined;
|
|
1393
|
-
if (!rawName) {
|
|
1394
|
-
continue;
|
|
1395
|
-
}
|
|
1396
|
-
const normalized = normalizeAnthropicToolName(rawName) ?? rawName;
|
|
1397
|
-
const canonicalKey = normalized.trim();
|
|
1398
|
-
if (!canonicalKey.length) {
|
|
1399
|
-
continue;
|
|
1400
|
-
}
|
|
1401
|
-
aliasMap.set(canonicalKey, rawName);
|
|
1402
|
-
const lowered = canonicalKey.toLowerCase();
|
|
1403
|
-
const lowerKey = canonicalKey.toLowerCase();
|
|
1404
|
-
if (lowerKey !== canonicalKey && !aliasMap.has(lowerKey)) {
|
|
1405
|
-
aliasMap.set(lowerKey, rawName);
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
if (!aliasMap.size) {
|
|
1409
|
-
return undefined;
|
|
1410
|
-
}
|
|
1411
|
-
const serialized = {};
|
|
1412
|
-
for (const [key, value] of aliasMap.entries()) {
|
|
1413
|
-
serialized[key] = value;
|
|
1414
|
-
}
|
|
1415
|
-
return serialized;
|
|
1416
|
-
}
|