@jsonstudio/rcc 0.89.3 → 0.89.168
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/README.md +240 -179
- package/config/modules.json +1 -11
- package/dist/build-info.js +3 -3
- package/dist/build-info.js.map +1 -1
- package/dist/client/gemini-cli/gemini-cli-protocol-client.d.ts +16 -0
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js +56 -0
- package/dist/client/gemini-cli/gemini-cli-protocol-client.js.map +1 -0
- package/dist/client/openai/chat-protocol-client.js.map +1 -1
- package/dist/config/modules.json +1 -11
- package/dist/core/provider-health-manager.d.ts +17 -0
- package/dist/core/provider-health-manager.js +66 -0
- package/dist/core/provider-health-manager.js.map +1 -0
- package/dist/error-handling/route-error-hub.d.ts +48 -0
- package/dist/error-handling/route-error-hub.js +131 -0
- package/dist/error-handling/route-error-hub.js.map +1 -0
- package/dist/index.js +26 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/llmswitch/bridge.d.ts +2 -0
- package/dist/modules/llmswitch/bridge.js +17 -0
- package/dist/modules/llmswitch/bridge.js.map +1 -1
- package/dist/modules/pipeline/utils/colored-logger.d.ts +14 -0
- package/dist/modules/pipeline/utils/colored-logger.js +48 -0
- package/dist/modules/pipeline/utils/colored-logger.js.map +1 -0
- package/dist/modules/pipeline/utils/debug-logger.d.ts +2 -0
- package/dist/modules/pipeline/utils/debug-logger.js +36 -0
- package/dist/modules/pipeline/utils/debug-logger.js.map +1 -1
- package/dist/providers/auth/gemini-cli-userinfo-helper.d.ts +53 -0
- package/dist/providers/auth/gemini-cli-userinfo-helper.js +152 -0
- package/dist/providers/auth/gemini-cli-userinfo-helper.js.map +1 -0
- package/dist/providers/auth/oauth-auth.js +3 -2
- package/dist/providers/auth/oauth-auth.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle.js +21 -20
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/auth/oauth-logger.d.ts +1 -0
- package/dist/providers/auth/oauth-logger.js +21 -0
- package/dist/providers/auth/oauth-logger.js.map +1 -0
- package/dist/providers/compat/compat-directory-loader.js +2 -55
- package/dist/providers/compat/compat-directory-loader.js.map +1 -1
- package/dist/providers/compat/compatibility-factory.d.ts +4 -4
- package/dist/providers/compat/compatibility-factory.js +108 -0
- package/dist/providers/compat/compatibility-factory.js.map +1 -1
- package/dist/providers/compat/glm/glm-compatibility.d.ts +2 -2
- package/dist/providers/compat/glm/glm-compatibility.js +7 -7
- package/dist/providers/compat/glm/glm-compatibility.js.map +1 -1
- package/dist/providers/compat/glm/index.js +0 -6
- package/dist/providers/compat/glm/index.js.map +1 -1
- package/dist/providers/compat/iflow/iflow-compatibility.d.ts +1 -1
- package/dist/providers/compat/iflow/iflow-compatibility.js +6 -6
- package/dist/providers/compat/iflow/iflow-compatibility.js.map +1 -1
- package/dist/providers/compat/index.d.ts +0 -6
- package/dist/providers/compat/index.js +0 -7
- package/dist/providers/compat/index.js.map +1 -1
- package/dist/providers/compat/lmstudio-compatibility.d.ts +2 -2
- package/dist/providers/compat/lmstudio-compatibility.js +4 -4
- package/dist/providers/compat/lmstudio-compatibility.js.map +1 -1
- package/dist/providers/compat/passthrough-compatibility.d.ts +1 -1
- package/dist/providers/compat/passthrough-compatibility.js +3 -3
- package/dist/providers/compat/passthrough-compatibility.js.map +1 -1
- package/dist/providers/compat/profiles/chat/glm/index.d.ts +6 -0
- package/dist/providers/compat/profiles/chat/glm/index.js +6 -0
- package/dist/providers/compat/profiles/chat/glm/index.js.map +1 -0
- package/dist/providers/compat/profiles/chat/iflow/index.d.ts +6 -0
- package/dist/providers/compat/profiles/chat/iflow/index.js +6 -0
- package/dist/providers/compat/profiles/chat/iflow/index.js.map +1 -0
- package/dist/providers/compat/profiles/chat/lmstudio/index.d.ts +6 -0
- package/dist/providers/compat/profiles/chat/lmstudio/index.js +6 -0
- package/dist/providers/compat/profiles/chat/lmstudio/index.js.map +1 -0
- package/dist/providers/compat/profiles/chat/qwen/index.d.ts +6 -0
- package/dist/providers/compat/profiles/chat/qwen/index.js +6 -0
- package/dist/providers/compat/profiles/chat/qwen/index.js.map +1 -0
- package/dist/providers/compat/profiles/compat/passthrough/index.d.ts +6 -0
- package/dist/providers/compat/profiles/compat/passthrough/index.js +6 -0
- package/dist/providers/compat/profiles/compat/passthrough/index.js.map +1 -0
- package/dist/providers/compat/profiles/responses/c4m/index.d.ts +6 -0
- package/dist/providers/compat/profiles/responses/c4m/index.js +6 -0
- package/dist/providers/compat/profiles/responses/c4m/index.js.map +1 -0
- package/dist/providers/compat/profiles/responses/default/index.d.ts +6 -0
- package/dist/providers/compat/profiles/responses/default/index.js +6 -0
- package/dist/providers/compat/profiles/responses/default/index.js.map +1 -0
- package/dist/providers/compat/profiles/responses/fai/index.d.ts +6 -0
- package/dist/providers/compat/profiles/responses/fai/index.js +6 -0
- package/dist/providers/compat/profiles/responses/fai/index.js.map +1 -0
- package/dist/providers/compat/profiles/responses/fc/index.d.ts +6 -0
- package/dist/providers/compat/profiles/responses/fc/index.js +6 -0
- package/dist/providers/compat/profiles/responses/fc/index.js.map +1 -0
- package/dist/providers/compat/qwen/index.js +0 -6
- package/dist/providers/compat/qwen/index.js.map +1 -1
- package/dist/providers/compat/qwen-compatibility.d.ts +2 -2
- package/dist/providers/compat/qwen-compatibility.js +4 -4
- package/dist/providers/compat/qwen-compatibility.js.map +1 -1
- package/dist/providers/compat/register-compat-module.d.ts +8 -0
- package/dist/providers/compat/register-compat-module.js +53 -0
- package/dist/providers/compat/register-compat-module.js.map +1 -0
- package/dist/providers/compat/responses/c4m-responses-compatibility.d.ts +6 -2
- package/dist/providers/compat/responses/c4m-responses-compatibility.js +85 -3
- package/dist/providers/compat/responses/c4m-responses-compatibility.js.map +1 -1
- package/dist/providers/compat/standard-compatibility-utils.js +45 -15
- package/dist/providers/compat/standard-compatibility-utils.js.map +1 -1
- package/dist/providers/core/api/provider-config.d.ts +1 -1
- package/dist/providers/core/api/provider-types.d.ts +3 -1
- package/dist/providers/core/api/provider-types.js +1 -0
- package/dist/providers/core/api/provider-types.js.map +1 -1
- package/dist/providers/core/config/service-profiles.js +19 -2
- package/dist/providers/core/config/service-profiles.js.map +1 -1
- package/dist/providers/core/runtime/base-provider.d.ts +8 -0
- package/dist/providers/core/runtime/base-provider.js +79 -36
- package/dist/providers/core/runtime/base-provider.js.map +1 -1
- package/dist/providers/core/runtime/gemini-cli-http-provider.d.ts +33 -0
- package/dist/providers/core/runtime/gemini-cli-http-provider.js +156 -0
- package/dist/providers/core/runtime/gemini-cli-http-provider.js.map +1 -0
- package/dist/providers/core/runtime/gemini-http-provider.d.ts +1 -2
- package/dist/providers/core/runtime/gemini-http-provider.js +0 -12
- package/dist/providers/core/runtime/gemini-http-provider.js.map +1 -1
- package/dist/providers/core/runtime/http-request-executor.d.ts +42 -0
- package/dist/providers/core/runtime/http-request-executor.js +133 -0
- package/dist/providers/core/runtime/http-request-executor.js.map +1 -0
- package/dist/providers/core/runtime/http-transport-provider.d.ts +7 -11
- package/dist/providers/core/runtime/http-transport-provider.js +226 -371
- package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
- package/dist/providers/core/runtime/provider-error-classifier.d.ts +25 -0
- package/dist/providers/core/runtime/provider-error-classifier.js +139 -0
- package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -0
- package/dist/providers/core/runtime/provider-error-types.d.ts +23 -0
- package/dist/providers/core/runtime/provider-error-types.js +2 -0
- package/dist/providers/core/runtime/provider-error-types.js.map +1 -0
- package/dist/providers/core/runtime/provider-factory.d.ts +1 -1
- package/dist/providers/core/runtime/provider-factory.js +14 -0
- package/dist/providers/core/runtime/provider-factory.js.map +1 -1
- package/dist/providers/core/runtime/provider-runtime-metadata.d.ts +1 -0
- package/dist/providers/core/runtime/provider-runtime-metadata.js.map +1 -1
- package/dist/providers/core/runtime/responses-provider.d.ts +7 -0
- package/dist/providers/core/runtime/responses-provider.js +228 -12
- package/dist/providers/core/runtime/responses-provider.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +10 -9
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/strategies/oauth-device-flow.js +10 -9
- package/dist/providers/core/strategies/oauth-device-flow.js.map +1 -1
- package/dist/providers/core/utils/provider-error-reporter.js +63 -15
- package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
- package/dist/providers/core/utils/provider-type-utils.d.ts +1 -1
- package/dist/providers/core/utils/provider-type-utils.js +6 -1
- package/dist/providers/core/utils/provider-type-utils.js.map +1 -1
- package/dist/providers/core/utils/snapshot-writer.d.ts +10 -0
- package/dist/providers/core/utils/snapshot-writer.js +85 -0
- package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
- package/dist/providers/mock/mock-provider-runtime.js +44 -0
- package/dist/providers/mock/mock-provider-runtime.js.map +1 -1
- package/dist/providers/profile/provider-profile-loader.js +26 -19
- package/dist/providers/profile/provider-profile-loader.js.map +1 -1
- package/dist/providers/profile/provider-profile.d.ts +2 -2
- package/dist/server/handlers/chat-handler.js +9 -3
- package/dist/server/handlers/chat-handler.js.map +1 -1
- package/dist/server/handlers/handler-utils.d.ts +7 -1
- package/dist/server/handlers/handler-utils.js +64 -52
- package/dist/server/handlers/handler-utils.js.map +1 -1
- package/dist/server/handlers/messages-handler.js +9 -3
- package/dist/server/handlers/messages-handler.js.map +1 -1
- package/dist/server/handlers/responses-handler.js +21 -13
- package/dist/server/handlers/responses-handler.js.map +1 -1
- package/dist/server/runtime/http-server/colored-logger.d.ts +1 -0
- package/dist/server/runtime/http-server/colored-logger.js +33 -0
- package/dist/server/runtime/http-server/colored-logger.js.map +1 -0
- package/dist/server/runtime/http-server/index.d.ts +3 -0
- package/dist/server/runtime/http-server/index.js +76 -19
- package/dist/server/runtime/http-server/index.js.map +1 -1
- package/dist/server/runtime/http-server/provider-utils.d.ts +3 -1
- package/dist/server/runtime/http-server/provider-utils.js +12 -2
- package/dist/server/runtime/http-server/provider-utils.js.map +1 -1
- package/dist/server/runtime/http-server/request-executor.js +6 -2
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/routes.js +31 -11
- package/dist/server/runtime/http-server/routes.js.map +1 -1
- package/dist/server/runtime/http-server/types.d.ts +2 -1
- package/dist/utils/error-center-payload.d.ts +7 -0
- package/dist/utils/error-center-payload.js +67 -0
- package/dist/utils/error-center-payload.js.map +1 -0
- package/dist/utils/error-handler-registry.d.ts +7 -0
- package/dist/utils/error-handler-registry.js +44 -12
- package/dist/utils/error-handler-registry.js.map +1 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/codecs/responses-openai-codec.js +16 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-glm.json +17 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-iflow.json +36 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-lmstudio.json +37 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-qwen.json +18 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/responses-c4m.json +45 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/config/compat-profiles.json +38 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/config/sample-config.json +314 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/config/version-switch.json +150 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-engine.d.ts +4 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-engine.js +667 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-profile-store.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-profile-store.js +76 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-types.d.ts +62 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-types.js +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.js +110 -29
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.d.ts +14 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_outbound/req_outbound_stage3_compat/index.js +23 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.js +34 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process.js +4 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/provider-response.js +26 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge.js +71 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-conversation-store.d.ts +35 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-conversation-store.js +64 -19
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-filter-pipeline.d.ts +21 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-filter-pipeline.js +138 -22
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-governor.d.ts +21 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-governor.js +116 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-mapping.js +52 -2
- package/node_modules/@jsonstudio/llms/dist/filters/config/openai-openai.fieldmap.json +18 -0
- package/node_modules/@jsonstudio/llms/dist/filters/special/request-tools-normalize.js +20 -1
- package/node_modules/@jsonstudio/llms/dist/guidance/index.js +6 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap.js +16 -7
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/classifier.js +40 -37
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/default-thinking-keywords.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/default-thinking-keywords.js +13 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.d.ts +39 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.js +52 -11
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/features.js +340 -11
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-counter.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/token-counter.js +105 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.d.ts +8 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.js +2 -2
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/builders/response-builder.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/builders/response-builder.js +53 -11
- package/node_modules/@jsonstudio/llms/dist/test-output/virtual-router/results.json +1 -0
- package/node_modules/@jsonstudio/llms/dist/test-output/virtual-router/summary.json +12 -0
- package/node_modules/@jsonstudio/llms/dist/tools/tool-registry.js +4 -3
- package/node_modules/@jsonstudio/llms/package.json +3 -3
- package/package.json +13 -10
- package/scripts/analyze-routing-classifier.mjs +166 -0
- package/scripts/analyze-routing-samples.mjs +216 -0
- package/scripts/analyze-thinking-keywords.mjs +17 -2
- package/scripts/build-core.mjs +8 -0
- package/scripts/classify-sample-tools.mjs +252 -0
- package/scripts/ensure-llmswitch-mode.mjs +95 -0
- package/scripts/gen-build-info.mjs +58 -4
- package/scripts/install-global.sh +1 -1
- package/scripts/install-release.sh +7 -0
- package/scripts/mock-provider/run-regressions.mjs +60 -14
- package/scripts/pack-mode.mjs +30 -1
- package/scripts/publish-rcc.mjs +31 -0
- package/scripts/tests/apply-patch-loop.mjs +100 -9
- package/scripts/tests/golden-provider-cycle.mjs +12 -1
- package/scripts/tests/responses-provider-dry-run.mjs +15 -1
- package/scripts/tests/virtual-router-health.mjs +12 -5
- package/scripts/tools/capture-provider-goldens.mjs +75 -25
- package/scripts/tools/responses-golden-dry-run.mjs +17 -1
- package/scripts/tools/responses-provider-replay.mjs +17 -1
- package/scripts/tools/sync-ci-goldens.mjs +131 -0
- package/scripts/verification/samples/openai-chat-list-local-files.json +19 -796
- package/scripts/verify-e2e-toolcall.mjs +52 -0
- package/dist/providers/compat/config/index.d.ts +0 -1
- package/dist/providers/compat/config/index.js +0 -5
- package/dist/providers/compat/config/index.js.map +0 -1
- package/dist/providers/compat/iflow/index.d.ts +0 -27
- package/dist/providers/compat/iflow/index.js +0 -32
- package/dist/providers/compat/iflow/index.js.map +0 -1
- package/dist/providers/compat/lmstudio/index.d.ts +0 -4
- package/dist/providers/compat/lmstudio/index.js +0 -10
- package/dist/providers/compat/lmstudio/index.js.map +0 -1
- package/dist/providers/compat/passthrough/index.d.ts +0 -4
- package/dist/providers/compat/passthrough/index.js +0 -9
- package/dist/providers/compat/passthrough/index.js.map +0 -1
- package/dist/providers/compat/responses/index.d.ts +0 -1
- package/dist/providers/compat/responses/index.js +0 -8
- package/dist/providers/compat/responses/index.js.map +0 -1
- package/dist/providers/core/composite/compat/anthropic.d.ts +0 -3
- package/dist/providers/core/composite/compat/anthropic.js +0 -7
- package/dist/providers/core/composite/compat/anthropic.js.map +0 -1
- package/dist/providers/core/composite/compat/gemini.d.ts +0 -3
- package/dist/providers/core/composite/compat/gemini.js +0 -7
- package/dist/providers/core/composite/compat/gemini.js.map +0 -1
- package/dist/providers/core/composite/compat/openai-compat-aggregator.d.ts +0 -9
- package/dist/providers/core/composite/compat/openai-compat-aggregator.js +0 -135
- package/dist/providers/core/composite/compat/openai-compat-aggregator.js.map +0 -1
- package/dist/providers/core/composite/compat/responses.d.ts +0 -3
- package/dist/providers/core/composite/compat/responses.js +0 -91
- package/dist/providers/core/composite/compat/responses.js.map +0 -1
- package/dist/providers/core/composite/provider-composite.d.ts +0 -50
- package/dist/providers/core/composite/provider-composite.js +0 -235
- package/dist/providers/core/composite/provider-composite.js.map +0 -1
- package/scripts/tests/apply-patch-loop.mjs.bak +0 -363
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.0.0",
|
|
3
|
+
"description": "LLM Switch Conversion 配置文件",
|
|
4
|
+
"lastModified": "2024-11-13T00:00:00.000Z",
|
|
5
|
+
"httpserver": {
|
|
6
|
+
"port": 5520,
|
|
7
|
+
"host": "0.0.0.0",
|
|
8
|
+
"timeout": 30000,
|
|
9
|
+
"cors": {
|
|
10
|
+
"enabled": true,
|
|
11
|
+
"origin": "*",
|
|
12
|
+
"methods": ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"virtualrouter": {
|
|
16
|
+
"inputProtocol": "openai",
|
|
17
|
+
"outputProtocol": "openai",
|
|
18
|
+
"providers": {
|
|
19
|
+
"chat-provider-1": {
|
|
20
|
+
"id": "chat-provider-1",
|
|
21
|
+
"enabled": true,
|
|
22
|
+
"type": "openai",
|
|
23
|
+
"name": "Generic Chat Provider",
|
|
24
|
+
"description": "Example chat-completions provider",
|
|
25
|
+
"baseUrl": "https://api.example.com/chat",
|
|
26
|
+
"apiVersion": "v1",
|
|
27
|
+
"compatibility": {
|
|
28
|
+
"type": "openai",
|
|
29
|
+
"features": ["streaming", "function-calling"]
|
|
30
|
+
},
|
|
31
|
+
"models": {
|
|
32
|
+
"chat-model-a": {
|
|
33
|
+
"displayName": "Chat-Model-A",
|
|
34
|
+
"description": "Latest chat model with improved reasoning",
|
|
35
|
+
"supportsStreaming": true,
|
|
36
|
+
"maxTokens": 128000,
|
|
37
|
+
"contextWindow": 128000,
|
|
38
|
+
"capabilities": ["text", "code", "reasoning", "tool-use"],
|
|
39
|
+
"pricing": {
|
|
40
|
+
"input": "0.001",
|
|
41
|
+
"output": "0.002",
|
|
42
|
+
"currency": "CNY"
|
|
43
|
+
},
|
|
44
|
+
"compatibility": {
|
|
45
|
+
"type": "openai",
|
|
46
|
+
"moduleConfig": {
|
|
47
|
+
"policy": {
|
|
48
|
+
"preflight": true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"chat-model-b": {
|
|
54
|
+
"displayName": "Chat-Model-B",
|
|
55
|
+
"description": "Lightweight chat model for faster responses",
|
|
56
|
+
"supportsStreaming": true,
|
|
57
|
+
"maxTokens": 8192,
|
|
58
|
+
"contextWindow": 8192,
|
|
59
|
+
"capabilities": ["text", "code", "basic-tool-use"],
|
|
60
|
+
"pricing": {
|
|
61
|
+
"input": "0.0005",
|
|
62
|
+
"output": "0.001",
|
|
63
|
+
"currency": "CNY"
|
|
64
|
+
},
|
|
65
|
+
"compatibility": {
|
|
66
|
+
"type": "openai",
|
|
67
|
+
"moduleConfig": {
|
|
68
|
+
"policy": {
|
|
69
|
+
"preflight": false
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"chat-model-c": {
|
|
75
|
+
"displayName": "Chat-Model-C",
|
|
76
|
+
"description": "Ultra-fast chat model for quick responses",
|
|
77
|
+
"supportsStreaming": false,
|
|
78
|
+
"maxTokens": 4096,
|
|
79
|
+
"contextWindow": 4096,
|
|
80
|
+
"capabilities": ["text", "code"],
|
|
81
|
+
"pricing": {
|
|
82
|
+
"input": "0.0002",
|
|
83
|
+
"output": "0.0004",
|
|
84
|
+
"currency": "CNY"
|
|
85
|
+
},
|
|
86
|
+
"compatibility": {
|
|
87
|
+
"type": "openai",
|
|
88
|
+
"moduleConfig": {
|
|
89
|
+
"policy": {
|
|
90
|
+
"preflight": false
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"apiKey": [
|
|
97
|
+
"your-api-key-here"
|
|
98
|
+
],
|
|
99
|
+
"auth": {
|
|
100
|
+
"type": "apikey",
|
|
101
|
+
"apiKey": "your-api-key-here"
|
|
102
|
+
},
|
|
103
|
+
"rateLimit": {
|
|
104
|
+
"requestsPerMinute": 60,
|
|
105
|
+
"tokensPerMinute": 6000,
|
|
106
|
+
"concurrent": 5
|
|
107
|
+
},
|
|
108
|
+
"healthCheck": {
|
|
109
|
+
"enabled": true,
|
|
110
|
+
"endpoint": "/health",
|
|
111
|
+
"interval": 30000
|
|
112
|
+
}
|
|
113
|
+
},
|
|
114
|
+
"openai": {
|
|
115
|
+
"id": "openai",
|
|
116
|
+
"enabled": false,
|
|
117
|
+
"type": "openai",
|
|
118
|
+
"name": "OpenAI Provider",
|
|
119
|
+
"description": "Official OpenAI provider",
|
|
120
|
+
"baseUrl": "https://api.openai.com/v1",
|
|
121
|
+
"apiVersion": "v1",
|
|
122
|
+
"models": {
|
|
123
|
+
"gpt-4": {
|
|
124
|
+
"displayName": "GPT-4",
|
|
125
|
+
"supportsStreaming": true,
|
|
126
|
+
"maxTokens": 8192,
|
|
127
|
+
"contextWindow": 8192
|
|
128
|
+
},
|
|
129
|
+
"gpt-4-turbo": {
|
|
130
|
+
"displayName": "GPT-4 Turbo",
|
|
131
|
+
"supportsStreaming": true,
|
|
132
|
+
"maxTokens": 4096,
|
|
133
|
+
"contextWindow": 4096
|
|
134
|
+
},
|
|
135
|
+
"gpt-3.5-turbo": {
|
|
136
|
+
"displayName": "GPT-3.5 Turbo",
|
|
137
|
+
"supportsStreaming": true,
|
|
138
|
+
"maxTokens": 4096,
|
|
139
|
+
"contextWindow": 16384
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"apiKey": [],
|
|
143
|
+
"auth": {
|
|
144
|
+
"type": "apikey"
|
|
145
|
+
},
|
|
146
|
+
"rateLimit": {
|
|
147
|
+
"requestsPerMinute": 3500,
|
|
148
|
+
"tokensPerMinute": 90000,
|
|
149
|
+
"concurrent": 100
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"anthropic": {
|
|
153
|
+
"id": "anthropic",
|
|
154
|
+
"enabled": false,
|
|
155
|
+
"type": "anthropic",
|
|
156
|
+
"name": "Anthropic Claude Provider",
|
|
157
|
+
"description": "Anthropic Claude provider",
|
|
158
|
+
"baseUrl": "https://api.anthropic.com",
|
|
159
|
+
"apiVersion": "2023-06-01",
|
|
160
|
+
"models": {
|
|
161
|
+
"claude-3-sonnet": {
|
|
162
|
+
"displayName": "Claude 3 Sonnet",
|
|
163
|
+
"supportsStreaming": true,
|
|
164
|
+
"maxTokens": 200000,
|
|
165
|
+
"contextWindow": 200000
|
|
166
|
+
},
|
|
167
|
+
"claude-3-haiku": {
|
|
168
|
+
"displayName": "Claude 3 Haiku",
|
|
169
|
+
"supportsStreaming": false,
|
|
170
|
+
"maxTokens": 200000,
|
|
171
|
+
"contextWindow": 200000
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
"apiKey": [],
|
|
175
|
+
"auth": {
|
|
176
|
+
"type": "apikey"
|
|
177
|
+
},
|
|
178
|
+
"rateLimit": {
|
|
179
|
+
"requestsPerMinute": 1000,
|
|
180
|
+
"tokensPerMinute": 40000,
|
|
181
|
+
"concurrent": 5
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
"routing": {
|
|
186
|
+
"default": ["chat-provider-1.chat-model-a"],
|
|
187
|
+
"coding": ["chat-provider-1.chat-model-a"],
|
|
188
|
+
"longcontext": ["chat-provider-1.chat-model-a"],
|
|
189
|
+
"thinking": ["chat-provider-1.chat-model-a", "chat-model-b"],
|
|
190
|
+
"fast": ["chat-model-c"],
|
|
191
|
+
"vision": [],
|
|
192
|
+
"websearch": [],
|
|
193
|
+
"background": [],
|
|
194
|
+
"fallback": ["chat-provider-1.chat-model-b"]
|
|
195
|
+
},
|
|
196
|
+
"rules": {
|
|
197
|
+
"inputValidation": {
|
|
198
|
+
"enabled": true,
|
|
199
|
+
"strict": false,
|
|
200
|
+
"maxMessageLength": 100000,
|
|
201
|
+
"maxToolCount": 50
|
|
202
|
+
},
|
|
203
|
+
"outputValidation": {
|
|
204
|
+
"enabled": true,
|
|
205
|
+
"strict": false,
|
|
206
|
+
"maxResponseLength": 100000
|
|
207
|
+
},
|
|
208
|
+
"contentFiltering": {
|
|
209
|
+
"enabled": true,
|
|
210
|
+
"blockedWords": [],
|
|
211
|
+
"blockedPatterns": []
|
|
212
|
+
},
|
|
213
|
+
"rateLimiting": {
|
|
214
|
+
"enabled": true,
|
|
215
|
+
"perUser": {
|
|
216
|
+
"requestsPerMinute": 10,
|
|
217
|
+
"tokensPerMinute": 1000
|
|
218
|
+
},
|
|
219
|
+
"perProvider": {
|
|
220
|
+
"chat-provider-1": { "requestsPerMinute": 60, "tokensPerMinute": 6000 },
|
|
221
|
+
"openai": { "requestsPerMinute": 3500, "tokensPerMinute": 90000 },
|
|
222
|
+
"anthropic": { "requestsPerMinute": 1000, "tokensPerMinute": 40000 }
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"serverTools": {
|
|
228
|
+
"replace": {
|
|
229
|
+
"web_fetch": {
|
|
230
|
+
"enabled": true,
|
|
231
|
+
"timeout": 30000,
|
|
232
|
+
"maxResponseSize": 1000000,
|
|
233
|
+
"allowedDomains": ["*"],
|
|
234
|
+
"blockedDomains": []
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
"custom": {
|
|
238
|
+
"enabled": false,
|
|
239
|
+
"tools": []
|
|
240
|
+
},
|
|
241
|
+
"enabled": true
|
|
242
|
+
},
|
|
243
|
+
"monitoring": {
|
|
244
|
+
"enabled": true,
|
|
245
|
+
"metrics": {
|
|
246
|
+
"requestCount": true,
|
|
247
|
+
"responseTime": true,
|
|
248
|
+
"errorRate": true,
|
|
249
|
+
"tokenUsage": true,
|
|
250
|
+
"providerPerformance": true
|
|
251
|
+
},
|
|
252
|
+
"logging": {
|
|
253
|
+
"level": "info",
|
|
254
|
+
"maxFileSize": "10MB",
|
|
255
|
+
"rotate": true,
|
|
256
|
+
"keepFiles": 7
|
|
257
|
+
},
|
|
258
|
+
"alerts": {
|
|
259
|
+
"errorRateThreshold": 0.05,
|
|
260
|
+
"responseTimeThreshold": 5000,
|
|
261
|
+
"tokenUsageThreshold": 10000
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
"conversion": {
|
|
265
|
+
"defaultVersion": "v2",
|
|
266
|
+
"passthrough": {
|
|
267
|
+
"enabled": true,
|
|
268
|
+
"criteria": {
|
|
269
|
+
"sameProtocol": true,
|
|
270
|
+
"sameProvider": true,
|
|
271
|
+
"minimalProcessing": true
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
"optimization": {
|
|
275
|
+
"enabled": true,
|
|
276
|
+
"caching": {
|
|
277
|
+
"enabled": true,
|
|
278
|
+
"maxSize": "100MB",
|
|
279
|
+
"ttl": 300000
|
|
280
|
+
},
|
|
281
|
+
"batching": {
|
|
282
|
+
"enabled": true,
|
|
283
|
+
"maxBatchSize": 10,
|
|
284
|
+
"maxBatchWaitTime": 100
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
"security": {
|
|
289
|
+
"apiKeyEncryption": {
|
|
290
|
+
"enabled": true,
|
|
291
|
+
"algorithm": "AES-256-GCM"
|
|
292
|
+
},
|
|
293
|
+
"requestValidation": {
|
|
294
|
+
"enabled": true,
|
|
295
|
+
"maxRequestSize": "10MB",
|
|
296
|
+
"allowedOrigins": ["*"],
|
|
297
|
+
"rateLimit": {
|
|
298
|
+
"enabled": true,
|
|
299
|
+
"requestsPerMinute": 1000,
|
|
300
|
+
"tokensPerMinute": 50000
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
"contentFiltering": {
|
|
304
|
+
"enabled": false,
|
|
305
|
+
"blockedContent": {
|
|
306
|
+
"profanity": false,
|
|
307
|
+
"personalData": false,
|
|
308
|
+
"malware": true,
|
|
309
|
+
"spam": true
|
|
310
|
+
},
|
|
311
|
+
"customFilters": []
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
{
|
|
2
|
+
"defaultVersion": "v2",
|
|
3
|
+
"envVarName": "LLMSWITCH_CONVERTER_VERSION",
|
|
4
|
+
"allowRuntimeSwitch": true,
|
|
5
|
+
"versionPriority": {
|
|
6
|
+
"v2": 1,
|
|
7
|
+
"v3": 2,
|
|
8
|
+
"auto": 0
|
|
9
|
+
},
|
|
10
|
+
"versionSettings": {
|
|
11
|
+
"v2": {
|
|
12
|
+
"description": "Legacy conversion-core implementation",
|
|
13
|
+
"stability": "stable",
|
|
14
|
+
"features": [
|
|
15
|
+
"proven_stability",
|
|
16
|
+
"comprehensive_coverage",
|
|
17
|
+
"extensive_testing"
|
|
18
|
+
],
|
|
19
|
+
"performance": "baseline",
|
|
20
|
+
"recommendedFor": [
|
|
21
|
+
"production",
|
|
22
|
+
"legacy_compatibility",
|
|
23
|
+
"maximum_stability"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"v3": {
|
|
27
|
+
"description": "New node-based pipeline architecture",
|
|
28
|
+
"stability": "beta",
|
|
29
|
+
"features": [
|
|
30
|
+
"intelligent_passthrough",
|
|
31
|
+
"node_based_processing",
|
|
32
|
+
"automatic_optimization",
|
|
33
|
+
"zero_config"
|
|
34
|
+
],
|
|
35
|
+
"performance": "optimized",
|
|
36
|
+
"recommendedFor": [
|
|
37
|
+
"development",
|
|
38
|
+
"performance_critical",
|
|
39
|
+
"new_features"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"auto": {
|
|
43
|
+
"description": "Automatically select best version based on request",
|
|
44
|
+
"stability": "dynamic",
|
|
45
|
+
"features": [
|
|
46
|
+
"smart_selection",
|
|
47
|
+
"performance_optimization",
|
|
48
|
+
"adaptive_behavior"
|
|
49
|
+
],
|
|
50
|
+
"performance": "variable",
|
|
51
|
+
"recommendedFor": [
|
|
52
|
+
"testing",
|
|
53
|
+
"benchmarking",
|
|
54
|
+
"a_b_testing"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"switchingRules": {
|
|
59
|
+
"autoSelection": {
|
|
60
|
+
"simpleRequests": {
|
|
61
|
+
"conditions": {
|
|
62
|
+
"messageCount": "<= 5",
|
|
63
|
+
"toolCount": 0,
|
|
64
|
+
"streaming": false
|
|
65
|
+
},
|
|
66
|
+
"preferredVersion": "v3",
|
|
67
|
+
"reason": "Simple requests benefit from v3 passthrough optimization"
|
|
68
|
+
},
|
|
69
|
+
"complexRequests": {
|
|
70
|
+
"conditions": {
|
|
71
|
+
"messageCount": "> 20",
|
|
72
|
+
"toolCount": "> 10",
|
|
73
|
+
"hasStreaming": true
|
|
74
|
+
},
|
|
75
|
+
"preferredVersion": "v2",
|
|
76
|
+
"reason": "Complex requests benefit from v2 stability"
|
|
77
|
+
},
|
|
78
|
+
"toolHeavyRequests": {
|
|
79
|
+
"conditions": {
|
|
80
|
+
"toolCount": "> 5",
|
|
81
|
+
"hasComplexTools": true
|
|
82
|
+
},
|
|
83
|
+
"preferredVersion": "v3",
|
|
84
|
+
"reason": "V3 has better tool processing architecture"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"fallbackRules": {
|
|
88
|
+
"v3FallbackToV2": {
|
|
89
|
+
"conditions": [
|
|
90
|
+
"conversion_error",
|
|
91
|
+
"timeout",
|
|
92
|
+
"unsupported_endpoint"
|
|
93
|
+
],
|
|
94
|
+
"retryCount": 3
|
|
95
|
+
},
|
|
96
|
+
"v2FallbackToV3": {
|
|
97
|
+
"conditions": [
|
|
98
|
+
"performance_degradation",
|
|
99
|
+
"memory_pressure"
|
|
100
|
+
],
|
|
101
|
+
"retryCount": 1
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"monitoring": {
|
|
106
|
+
"enabled": true,
|
|
107
|
+
"metrics": [
|
|
108
|
+
"conversion_success_rate",
|
|
109
|
+
"average_latency",
|
|
110
|
+
"passthrough_rate",
|
|
111
|
+
"error_rate_by_version",
|
|
112
|
+
"performance_comparison"
|
|
113
|
+
],
|
|
114
|
+
"alertThresholds": {
|
|
115
|
+
"errorRate": 0.05,
|
|
116
|
+
"latencyIncrease": 2.0,
|
|
117
|
+
"successRateDrop": 0.1
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"hooks": {
|
|
121
|
+
"beforeSwitch": {
|
|
122
|
+
"logLevel": "info",
|
|
123
|
+
"metrics": true
|
|
124
|
+
},
|
|
125
|
+
"afterSwitch": {
|
|
126
|
+
"logLevel": "info",
|
|
127
|
+
"metrics": true,
|
|
128
|
+
"validate": true
|
|
129
|
+
},
|
|
130
|
+
"onError": {
|
|
131
|
+
"logLevel": "error",
|
|
132
|
+
"metrics": true,
|
|
133
|
+
"escalate": true
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
"testing": {
|
|
137
|
+
"enabled": false,
|
|
138
|
+
"canaryDeployment": {
|
|
139
|
+
"percentage": 0.1,
|
|
140
|
+
"version": "v3"
|
|
141
|
+
},
|
|
142
|
+
"abTesting": {
|
|
143
|
+
"enabled": false,
|
|
144
|
+
"split": {
|
|
145
|
+
"v2": 0.5,
|
|
146
|
+
"v3": 0.5
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { JsonObject } from '../../types/json.js';
|
|
2
|
+
import type { CompatApplicationResult } from './compat-types.js';
|
|
3
|
+
export declare function applyRequestCompat(profileId: string | undefined, payload: JsonObject): CompatApplicationResult;
|
|
4
|
+
export declare function applyResponseCompat(profileId: string | undefined, payload: JsonObject): CompatApplicationResult;
|