@jsonstudio/rcc 0.90.876 → 0.90.1270
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 +5 -6
- package/configsamples/provider-default/ali-coding-plan/config.v2.json +6 -1
- package/configsamples/provider-default/antigravity/config.v2.json +6 -1
- package/configsamples/provider-default/ark-coding-plan/config.v2.json +7 -2
- package/configsamples/provider-default/crs/config.v2.json +6 -1
- package/configsamples/provider-default/deepseek-web/config.v2.json +6 -1
- package/configsamples/provider-default/gemini/config.v2.json +6 -1
- package/configsamples/provider-default/gemini-cli/config.v2.json +6 -1
- package/configsamples/provider-default/gemini-native/config.v2.json +6 -1
- package/configsamples/provider-default/glm/config.v2.json +7 -2
- package/configsamples/provider-default/glm-anthropic/config.v2.json +6 -1
- package/configsamples/provider-default/kimi/config.v2.json +7 -2
- package/configsamples/provider-default/lmstudio/config.v2.json +6 -1
- package/configsamples/provider-default/lmstudio-proxy/config.v2.json +6 -1
- package/configsamples/provider-default/manifest.json +0 -1
- package/configsamples/provider-default/meituan/config.v2.json +6 -1
- package/configsamples/provider-default/mimo/config.v2.json +7 -2
- package/configsamples/provider-default/modelscope/config.v2.json +7 -2
- package/configsamples/provider-default/my-openai/config.v2.json +6 -1
- package/configsamples/provider-default/nvidia/config.v2.json +7 -2
- package/configsamples/provider-default/opencode-zen-free/config.v2.json +6 -1
- package/configsamples/provider-default/openrouter/config.v2.json +6 -1
- package/configsamples/provider-default/qwen/config.v2.json +11 -1
- package/configsamples/provider-default/tab/config.v2.json +6 -1
- package/configsamples/provider-default/tabglm/config.v2.json +7 -2
- package/dist/build-info.js +2 -2
- package/dist/build-info.js.map +1 -1
- package/dist/cli/commands/camoufox.js +44 -3
- package/dist/cli/commands/camoufox.js.map +1 -1
- package/dist/cli/commands/config.js +2 -2
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/heartbeat.js +82 -27
- package/dist/cli/commands/heartbeat.js.map +1 -1
- package/dist/cli/commands/init.js +1 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/launcher/utils.js +37 -24
- package/dist/cli/commands/launcher/utils.js.map +1 -1
- package/dist/cli/commands/launcher-kernel.js +6 -3
- package/dist/cli/commands/launcher-kernel.js.map +1 -1
- package/dist/cli/commands/restart.js +102 -31
- package/dist/cli/commands/restart.js.map +1 -1
- package/dist/cli/commands/start-types.d.ts +1 -0
- package/dist/cli/commands/start-utils.d.ts +1 -0
- package/dist/cli/commands/start-utils.js +3 -0
- package/dist/cli/commands/start-utils.js.map +1 -1
- package/dist/cli/commands/start.js +217 -51
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/status.js +48 -9
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/config/bootstrap-provider-templates.js +1 -1
- package/dist/cli/config/bootstrap-provider-templates.js.map +1 -1
- package/dist/cli/config/init-provider-catalog.js +3 -50
- package/dist/cli/config/init-provider-catalog.js.map +1 -1
- package/dist/cli/config/init-v2-builder.js +0 -1
- package/dist/cli/config/init-v2-builder.js.map +1 -1
- package/dist/cli/guardian/client.js +40 -18
- package/dist/cli/guardian/client.js.map +1 -1
- package/dist/cli/server/port-utils.d.ts +5 -0
- package/dist/cli/server/port-utils.js +45 -31
- package/dist/cli/server/port-utils.js.map +1 -1
- package/dist/commands/camoufox-fp.js +1 -1
- package/dist/commands/camoufox-fp.js.map +1 -1
- package/dist/commands/oauth.js +48 -64
- package/dist/commands/oauth.js.map +1 -1
- package/dist/commands/provider-update-maintenance.js +4 -4
- package/dist/commands/provider-update-maintenance.js.map +1 -1
- package/dist/commands/token-daemon.js +38 -10
- package/dist/commands/token-daemon.js.map +1 -1
- package/dist/commands/validate.js +31 -3
- package/dist/commands/validate.js.map +1 -1
- package/dist/config/provider-v2-loader.d.ts +5 -2
- package/dist/config/provider-v2-loader.js +80 -26
- package/dist/config/provider-v2-loader.js.map +1 -1
- package/dist/config/routecodex-config-loader.d.ts +1 -0
- package/dist/config/routecodex-config-loader.js +18 -207
- package/dist/config/routecodex-config-loader.js.map +1 -1
- package/dist/config/virtual-router-builder.d.ts +3 -2
- package/dist/config/virtual-router-builder.js +4 -214
- package/dist/config/virtual-router-builder.js.map +1 -1
- package/dist/constants/index.d.ts +2 -3
- package/dist/constants/index.js +2 -4
- package/dist/constants/index.js.map +1 -1
- package/dist/error-handling/route-error-hub.js +1 -0
- package/dist/error-handling/route-error-hub.js.map +1 -1
- package/dist/index.js +98 -21
- package/dist/index.js.map +1 -1
- package/dist/manager/modules/quota/antigravity-quota-manager.d.ts +1 -1
- package/dist/manager/modules/quota/antigravity-quota-manager.js +21 -12
- package/dist/manager/modules/quota/antigravity-quota-manager.js.map +1 -1
- package/dist/manager/modules/quota/antigravity-quota-runtime.d.ts +1 -1
- package/dist/manager/modules/quota/antigravity-quota-runtime.js +32 -45
- package/dist/manager/modules/quota/antigravity-quota-runtime.js.map +1 -1
- package/dist/manager/modules/quota/provider-key-normalization.js +10 -1
- package/dist/manager/modules/quota/provider-key-normalization.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.d.ts +2 -1
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.d.ts +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js +22 -12
- package/dist/manager/modules/quota/provider-quota-daemon.error-helpers.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.events.js +69 -33
- package/dist/manager/modules/quota/provider-quota-daemon.events.js.map +1 -1
- package/dist/manager/modules/quota/provider-quota-daemon.js +47 -35
- package/dist/manager/modules/quota/provider-quota-daemon.js.map +1 -1
- package/dist/manager/storage/file-store.js +3 -0
- package/dist/manager/storage/file-store.js.map +1 -1
- package/dist/modules/llmswitch/bridge/antigravity-signature.js +58 -20
- package/dist/modules/llmswitch/bridge/antigravity-signature.js.map +1 -1
- package/dist/modules/llmswitch/bridge/index.d.ts +1 -1
- package/dist/modules/llmswitch/bridge/index.js +1 -1
- package/dist/modules/llmswitch/bridge/index.js.map +1 -1
- package/dist/modules/llmswitch/bridge/runtime-integrations.d.ts +22 -16
- package/dist/modules/llmswitch/bridge/runtime-integrations.js +89 -30
- package/dist/modules/llmswitch/bridge/runtime-integrations.js.map +1 -1
- package/dist/modules/llmswitch/bridge/snapshot-recorder-runtime.js +10 -9
- package/dist/modules/llmswitch/bridge/snapshot-recorder-runtime.js.map +1 -1
- package/dist/modules/llmswitch/bridge/snapshot-recorder.js +3 -0
- package/dist/modules/llmswitch/bridge/snapshot-recorder.js.map +1 -1
- package/dist/modules/llmswitch/bridge/state-integrations.d.ts +1 -0
- package/dist/modules/llmswitch/bridge/state-integrations.js +263 -51
- package/dist/modules/llmswitch/bridge/state-integrations.js.map +1 -1
- package/dist/modules/llmswitch/bridge.d.ts +2 -2
- package/dist/modules/llmswitch/bridge.js +2 -2
- package/dist/modules/llmswitch/bridge.js.map +1 -1
- package/dist/provider-sdk/provider-add-template.d.ts +1 -1
- package/dist/provider-sdk/provider-add-template.js.map +1 -1
- package/dist/provider-sdk/provider-runtime-inference.js +48 -13
- package/dist/provider-sdk/provider-runtime-inference.js.map +1 -1
- package/dist/providers/auth/deepseek-account-token-acquirer.d.ts +24 -0
- package/dist/providers/auth/deepseek-account-token-acquirer.js +42 -13
- package/dist/providers/auth/deepseek-account-token-acquirer.js.map +1 -1
- package/dist/providers/auth/oauth-auth.js +12 -5
- package/dist/providers/auth/oauth-auth.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle/path-resolver.d.ts +0 -1
- package/dist/providers/auth/oauth-lifecycle/path-resolver.js +10 -9
- package/dist/providers/auth/oauth-lifecycle/path-resolver.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle/token-helpers.js +0 -1
- package/dist/providers/auth/oauth-lifecycle/token-helpers.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle/token-io.js +18 -8
- package/dist/providers/auth/oauth-lifecycle/token-io.js.map +1 -1
- package/dist/providers/auth/oauth-lifecycle.d.ts +5 -0
- package/dist/providers/auth/oauth-lifecycle.js +370 -353
- package/dist/providers/auth/oauth-lifecycle.js.map +1 -1
- package/dist/providers/auth/oauth-repair-env.js +0 -26
- package/dist/providers/auth/oauth-repair-env.js.map +1 -1
- package/dist/providers/auth/qwen-userinfo-helper.d.ts +11 -0
- package/dist/providers/auth/qwen-userinfo-helper.js +85 -13
- package/dist/providers/auth/qwen-userinfo-helper.js.map +1 -1
- package/dist/providers/auth/token-refresh/token-state.js +1 -4
- package/dist/providers/auth/token-refresh/token-state.js.map +1 -1
- package/dist/providers/auth/token-scanner/index.d.ts +1 -1
- package/dist/providers/auth/token-scanner/index.js +2 -2
- package/dist/providers/auth/token-storage/token-file-resolver.js +0 -3
- package/dist/providers/auth/token-storage/token-file-resolver.js.map +1 -1
- package/dist/providers/auth/token-storage/token-persistence.js +10 -3
- package/dist/providers/auth/token-storage/token-persistence.js.map +1 -1
- package/dist/providers/auth/tokenfile-auth.d.ts +0 -1
- package/dist/providers/auth/tokenfile-auth.js +23 -30
- package/dist/providers/auth/tokenfile-auth.js.map +1 -1
- package/dist/providers/core/api/provider-config.d.ts +1 -1
- package/dist/providers/core/api/provider-types.d.ts +2 -1
- package/dist/providers/core/config/camoufox-actions.js +23 -15
- package/dist/providers/core/config/camoufox-actions.js.map +1 -1
- package/dist/providers/core/config/camoufox-launcher.js +235 -121
- package/dist/providers/core/config/camoufox-launcher.js.map +1 -1
- package/dist/providers/core/config/oauth-flows.js +23 -1
- package/dist/providers/core/config/oauth-flows.js.map +1 -1
- package/dist/providers/core/config/provider-oauth-configs.js +2 -93
- package/dist/providers/core/config/provider-oauth-configs.js.map +1 -1
- package/dist/providers/core/config/service-profiles.d.ts +0 -1
- package/dist/providers/core/config/service-profiles.js +23 -66
- package/dist/providers/core/config/service-profiles.js.map +1 -1
- package/dist/providers/core/runtime/base-provider-runtime-helpers.js +4 -1
- package/dist/providers/core/runtime/base-provider-runtime-helpers.js.map +1 -1
- package/dist/providers/core/runtime/base-provider.js +21 -11
- package/dist/providers/core/runtime/base-provider.js.map +1 -1
- package/dist/providers/core/runtime/deepseek-http-provider-helpers.d.ts +1 -0
- package/dist/providers/core/runtime/deepseek-http-provider-helpers.js +28 -0
- package/dist/providers/core/runtime/deepseek-http-provider-helpers.js.map +1 -1
- package/dist/providers/core/runtime/deepseek-http-provider.d.ts +0 -2
- package/dist/providers/core/runtime/deepseek-http-provider.js +3 -33
- package/dist/providers/core/runtime/deepseek-http-provider.js.map +1 -1
- package/dist/providers/core/runtime/http-request-executor.d.ts +1 -0
- package/dist/providers/core/runtime/http-request-executor.js +131 -47
- package/dist/providers/core/runtime/http-request-executor.js.map +1 -1
- package/dist/providers/core/runtime/http-transport-provider.d.ts +5 -5
- package/dist/providers/core/runtime/http-transport-provider.js +97 -38
- package/dist/providers/core/runtime/http-transport-provider.js.map +1 -1
- package/dist/providers/core/runtime/openai-responses-sdk-transport.js +2 -1
- package/dist/providers/core/runtime/openai-responses-sdk-transport.js.map +1 -1
- package/dist/providers/core/runtime/provider-error-classifier.js +19 -126
- package/dist/providers/core/runtime/provider-error-classifier.js.map +1 -1
- package/dist/providers/core/runtime/provider-factory-helpers.d.ts +1 -0
- package/dist/providers/core/runtime/provider-factory-helpers.js +8 -12
- package/dist/providers/core/runtime/provider-factory-helpers.js.map +1 -1
- package/dist/providers/core/runtime/provider-factory.js +2 -9
- package/dist/providers/core/runtime/provider-factory.js.map +1 -1
- package/dist/providers/core/runtime/provider-failure-policy.d.ts +135 -0
- package/dist/providers/core/runtime/provider-failure-policy.js +685 -0
- package/dist/providers/core/runtime/provider-failure-policy.js.map +1 -0
- package/dist/providers/core/runtime/provider-family-profile-utils.d.ts +0 -10
- package/dist/providers/core/runtime/provider-family-profile-utils.js +0 -28
- package/dist/providers/core/runtime/provider-family-profile-utils.js.map +1 -1
- package/dist/providers/core/runtime/provider-http-executor-utils.js +40 -1
- package/dist/providers/core/runtime/provider-http-executor-utils.js.map +1 -1
- package/dist/providers/core/runtime/provider-request-header-orchestrator.d.ts +0 -2
- package/dist/providers/core/runtime/provider-request-header-orchestrator.js +35 -8
- package/dist/providers/core/runtime/provider-request-header-orchestrator.js.map +1 -1
- package/dist/providers/core/runtime/provider-response-postprocessor.js +3 -23
- package/dist/providers/core/runtime/provider-response-postprocessor.js.map +1 -1
- package/dist/providers/core/runtime/provider-runtime-utils.js +4 -1
- package/dist/providers/core/runtime/provider-runtime-utils.js.map +1 -1
- package/dist/providers/core/runtime/provider-startup-tasks.js +18 -2
- package/dist/providers/core/runtime/provider-startup-tasks.js.map +1 -1
- package/dist/providers/core/runtime/responses-provider-helpers.d.ts +1 -0
- package/dist/providers/core/runtime/responses-provider-helpers.js +11 -12
- package/dist/providers/core/runtime/responses-provider-helpers.js.map +1 -1
- package/dist/providers/core/runtime/responses-provider.js +15 -10
- package/dist/providers/core/runtime/responses-provider.js.map +1 -1
- package/dist/providers/core/runtime/transport/auth-provider-factory.d.ts +0 -1
- package/dist/providers/core/runtime/transport/auth-provider-factory.js +1 -15
- package/dist/providers/core/runtime/transport/auth-provider-factory.js.map +1 -1
- package/dist/providers/core/runtime/transport/index.d.ts +0 -1
- package/dist/providers/core/runtime/transport/index.js +0 -1
- package/dist/providers/core/runtime/transport/index.js.map +1 -1
- package/dist/providers/core/runtime/transport/oauth-recovery-handler.d.ts +2 -0
- package/dist/providers/core/runtime/transport/oauth-recovery-handler.js +76 -5
- package/dist/providers/core/runtime/transport/oauth-recovery-handler.js.map +1 -1
- package/dist/providers/core/runtime/transport/request-header-builder.d.ts +0 -1
- package/dist/providers/core/runtime/transport/request-header-builder.js +1 -7
- package/dist/providers/core/runtime/transport/request-header-builder.js.map +1 -1
- package/dist/providers/core/runtime/transport/runtime-detector.d.ts +0 -2
- package/dist/providers/core/runtime/transport/runtime-detector.js +0 -20
- package/dist/providers/core/runtime/transport/runtime-detector.js.map +1 -1
- package/dist/providers/core/runtime/transport/session-header-utils.d.ts +6 -0
- package/dist/providers/core/runtime/transport/session-header-utils.js +61 -2
- package/dist/providers/core/runtime/transport/session-header-utils.js.map +1 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/anthropic-sdk-request-exec.js +2 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/anthropic-sdk-request-exec.js.map +1 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/openai-sdk-transport.js +2 -1
- package/dist/providers/core/runtime/vercel-ai-sdk/openai-sdk-transport.js.map +1 -1
- package/dist/providers/core/strategies/oauth-auth-code-flow.d.ts +1 -4
- package/dist/providers/core/strategies/oauth-auth-code-flow.js +26 -84
- package/dist/providers/core/strategies/oauth-auth-code-flow.js.map +1 -1
- package/dist/providers/core/strategies/oauth-device-flow.d.ts +2 -0
- package/dist/providers/core/strategies/oauth-device-flow.js +43 -8
- package/dist/providers/core/strategies/oauth-device-flow.js.map +1 -1
- package/dist/providers/core/utils/http-client.d.ts +7 -5
- package/dist/providers/core/utils/http-client.js +108 -33
- package/dist/providers/core/utils/http-client.js.map +1 -1
- package/dist/providers/core/utils/provider-error-reporter.d.ts +2 -2
- package/dist/providers/core/utils/provider-error-reporter.js +9 -85
- package/dist/providers/core/utils/provider-error-reporter.js.map +1 -1
- package/dist/providers/core/utils/provider-type-utils.js +1 -3
- package/dist/providers/core/utils/provider-type-utils.js.map +1 -1
- package/dist/providers/core/utils/qwen-client-fingerprint.d.ts +15 -0
- package/dist/providers/core/utils/qwen-client-fingerprint.js +47 -0
- package/dist/providers/core/utils/qwen-client-fingerprint.js.map +1 -0
- package/dist/providers/core/utils/snapshot-writer.d.ts +3 -0
- package/dist/providers/core/utils/snapshot-writer.js +385 -26
- package/dist/providers/core/utils/snapshot-writer.js.map +1 -1
- package/dist/providers/profile/families/qwen-profile.js +285 -22
- package/dist/providers/profile/families/qwen-profile.js.map +1 -1
- package/dist/providers/profile/profile-registry.js +0 -2
- package/dist/providers/profile/profile-registry.js.map +1 -1
- package/dist/providers/profile/provider-directory.js +0 -1
- package/dist/providers/profile/provider-directory.js.map +1 -1
- package/dist/providers/profile/provider-profile-loader.js +1 -1
- package/dist/providers/profile/provider-profile-loader.js.map +1 -1
- package/dist/server/handlers/chat-handler.js +6 -5
- package/dist/server/handlers/chat-handler.js.map +1 -1
- package/dist/server/handlers/config-admin-handler.js +44 -69
- package/dist/server/handlers/config-admin-handler.js.map +1 -1
- package/dist/server/handlers/handler-response-utils.js +190 -27
- package/dist/server/handlers/handler-response-utils.js.map +1 -1
- package/dist/server/handlers/handler-utils.d.ts +3 -0
- package/dist/server/handlers/handler-utils.js +72 -0
- package/dist/server/handlers/handler-utils.js.map +1 -1
- package/dist/server/handlers/images-handler.js +7 -7
- package/dist/server/handlers/images-handler.js.map +1 -1
- package/dist/server/handlers/messages-handler.js +6 -5
- package/dist/server/handlers/messages-handler.js.map +1 -1
- package/dist/server/handlers/responses-handler.js +32 -14
- package/dist/server/handlers/responses-handler.js.map +1 -1
- package/dist/server/handlers/sse-dispatcher.js +55 -13
- package/dist/server/handlers/sse-dispatcher.js.map +1 -1
- package/dist/server/handlers/types.d.ts +12 -0
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js +5 -2
- package/dist/server/runtime/http-server/daemon-admin/auth-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/control-handler.js +62 -18
- package/dist/server/runtime/http-server/daemon-admin/control-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler-utils.js +1 -1
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler-utils.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js +9 -9
- package/dist/server/runtime/http-server/daemon-admin/credentials-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/providers-handler-routing-utils.js +36 -10
- 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 +11 -11
- package/dist/server/runtime/http-server/daemon-admin/providers-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin/quota-handler.js +49 -8
- package/dist/server/runtime/http-server/daemon-admin/quota-handler.js.map +1 -1
- package/dist/server/runtime/http-server/daemon-admin-routes.d.ts +1 -0
- package/dist/server/runtime/http-server/daemon-admin-routes.js +46 -0
- package/dist/server/runtime/http-server/daemon-admin-routes.js.map +1 -1
- package/dist/server/runtime/http-server/executor/client-injection-flow.js +2 -0
- package/dist/server/runtime/http-server/executor/client-injection-flow.js.map +1 -1
- package/dist/server/runtime/http-server/executor/log-rollup.d.ts +38 -0
- package/dist/server/runtime/http-server/executor/log-rollup.js +775 -0
- package/dist/server/runtime/http-server/executor/log-rollup.js.map +1 -0
- package/dist/server/runtime/http-server/executor/provider-response-converter.js +654 -281
- package/dist/server/runtime/http-server/executor/provider-response-converter.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-response-utils.js +34 -3
- package/dist/server/runtime/http-server/executor/provider-response-utils.js.map +1 -1
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js +14 -68
- package/dist/server/runtime/http-server/executor/provider-runtime-resolver.js.map +1 -1
- package/dist/server/runtime/http-server/executor/request-executor-core-utils.js +26 -2
- package/dist/server/runtime/http-server/executor/request-executor-core-utils.js.map +1 -1
- package/dist/server/runtime/http-server/executor/request-retry-helpers.js +20 -2
- package/dist/server/runtime/http-server/executor/request-retry-helpers.js.map +1 -1
- package/dist/server/runtime/http-server/executor/servertool-adapter-context.d.ts +10 -0
- package/dist/server/runtime/http-server/executor/servertool-adapter-context.js +120 -0
- package/dist/server/runtime/http-server/executor/servertool-adapter-context.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-dispatch.d.ts +35 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-dispatch.js +101 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-dispatch.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-error.d.ts +46 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-error.js +127 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-error.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-metadata.d.ts +7 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-metadata.js +186 -0
- package/dist/server/runtime/http-server/executor/servertool-followup-metadata.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-request-normalizer.d.ts +2 -0
- package/dist/server/runtime/http-server/executor/servertool-request-normalizer.js +56 -0
- package/dist/server/runtime/http-server/executor/servertool-request-normalizer.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-response-normalizer.d.ts +8 -0
- package/dist/server/runtime/http-server/executor/servertool-response-normalizer.js +31 -0
- package/dist/server/runtime/http-server/executor/servertool-response-normalizer.js.map +1 -0
- package/dist/server/runtime/http-server/executor/servertool-runtime-log.d.ts +8 -0
- package/dist/server/runtime/http-server/executor/servertool-runtime-log.js +33 -0
- package/dist/server/runtime/http-server/executor/servertool-runtime-log.js.map +1 -0
- package/dist/server/runtime/http-server/executor/sse-error-handler.js +37 -0
- package/dist/server/runtime/http-server/executor/sse-error-handler.js.map +1 -1
- package/dist/server/runtime/http-server/executor/usage-aggregator.js +32 -2
- package/dist/server/runtime/http-server/executor/usage-aggregator.js.map +1 -1
- package/dist/server/runtime/http-server/executor/usage-logger.d.ts +12 -0
- package/dist/server/runtime/http-server/executor/usage-logger.js +56 -1
- package/dist/server/runtime/http-server/executor/usage-logger.js.map +1 -1
- package/dist/server/runtime/http-server/executor-metadata.d.ts +15 -0
- package/dist/server/runtime/http-server/executor-metadata.js +60 -18
- package/dist/server/runtime/http-server/executor-metadata.js.map +1 -1
- package/dist/server/runtime/http-server/executor-provider.d.ts +2 -0
- package/dist/server/runtime/http-server/executor-provider.js +88 -205
- package/dist/server/runtime/http-server/executor-provider.js.map +1 -1
- package/dist/server/runtime/http-server/executor-response.js +30 -149
- package/dist/server/runtime/http-server/executor-response.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-bootstrap.js +53 -17
- package/dist/server/runtime/http-server/http-server-bootstrap.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-legacy-pipeline.js +28 -1
- package/dist/server/runtime/http-server/http-server-legacy-pipeline.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-lifecycle.js +17 -4
- package/dist/server/runtime/http-server/http-server-lifecycle.js.map +1 -1
- package/dist/server/runtime/http-server/http-server-runtime-providers.js +42 -13
- 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 +40 -2
- package/dist/server/runtime/http-server/http-server-runtime-setup.js.map +1 -1
- package/dist/server/runtime/http-server/hub-shadow-compare.js +8 -4
- package/dist/server/runtime/http-server/hub-shadow-compare.js.map +1 -1
- package/dist/server/runtime/http-server/managed-process-probe.js +30 -4
- package/dist/server/runtime/http-server/managed-process-probe.js.map +1 -1
- package/dist/server/runtime/http-server/middleware.js +32 -4
- package/dist/server/runtime/http-server/middleware.js.map +1 -1
- package/dist/server/runtime/http-server/provider-traffic-governor.d.ts +45 -1
- package/dist/server/runtime/http-server/provider-traffic-governor.js +697 -111
- package/dist/server/runtime/http-server/provider-traffic-governor.js.map +1 -1
- package/dist/server/runtime/http-server/provider-utils.js +2 -6
- package/dist/server/runtime/http-server/provider-utils.js.map +1 -1
- package/dist/server/runtime/http-server/request-activity-tracker.d.ts +4 -0
- package/dist/server/runtime/http-server/request-activity-tracker.js +54 -11
- package/dist/server/runtime/http-server/request-activity-tracker.js.map +1 -1
- package/dist/server/runtime/http-server/request-executor.d.ts +247 -0
- package/dist/server/runtime/http-server/request-executor.js +2444 -334
- package/dist/server/runtime/http-server/request-executor.js.map +1 -1
- package/dist/server/runtime/http-server/routes.js +59 -16
- package/dist/server/runtime/http-server/routes.js.map +1 -1
- package/dist/server/runtime/http-server/runtime-manager.js +0 -15
- package/dist/server/runtime/http-server/runtime-manager.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-registry-utils.js +46 -10
- package/dist/server/runtime/http-server/session-client-registry-utils.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-registry.js +22 -4
- package/dist/server/runtime/http-server/session-client-registry.js.map +1 -1
- package/dist/server/runtime/http-server/session-client-routes.js +40 -18
- package/dist/server/runtime/http-server/session-client-routes.js.map +1 -1
- package/dist/server/runtime/http-server/session-dir.js +35 -2
- package/dist/server/runtime/http-server/session-dir.js.map +1 -1
- package/dist/server/runtime/http-server/session-scope-resolution.js +38 -9
- package/dist/server/runtime/http-server/session-scope-resolution.js.map +1 -1
- package/dist/server/runtime/http-server/session-storage-cleanup.js +64 -27
- package/dist/server/runtime/http-server/session-storage-cleanup.js.map +1 -1
- package/dist/server/runtime/http-server/stats-manager.d.ts +5 -0
- package/dist/server/runtime/http-server/stats-manager.js +138 -6
- package/dist/server/runtime/http-server/stats-manager.js.map +1 -1
- package/dist/server/runtime/http-server/tmux-injection-history.js +30 -4
- package/dist/server/runtime/http-server/tmux-injection-history.js.map +1 -1
- package/dist/server/runtime/http-server/tmux-session-probe.d.ts +3 -1
- package/dist/server/runtime/http-server/tmux-session-probe.js +198 -9
- package/dist/server/runtime/http-server/tmux-session-probe.js.map +1 -1
- package/dist/server/utils/client-connection-state.d.ts +1 -0
- package/dist/server/utils/client-connection-state.js +45 -5
- package/dist/server/utils/client-connection-state.js.map +1 -1
- package/dist/server/utils/finish-reason.js +61 -2
- package/dist/server/utils/finish-reason.js.map +1 -1
- package/dist/server/utils/http-error-mapper.d.ts +4 -0
- package/dist/server/utils/http-error-mapper.js +31 -6
- package/dist/server/utils/http-error-mapper.js.map +1 -1
- package/dist/server/utils/stage-logger.js +42 -13
- package/dist/server/utils/stage-logger.js.map +1 -1
- package/dist/server-lifecycle/port-utils.js +6 -2
- package/dist/server-lifecycle/port-utils.js.map +1 -1
- package/dist/token-daemon/index.js +44 -15
- package/dist/token-daemon/index.js.map +1 -1
- package/dist/token-daemon/leader-lock.js +65 -7
- package/dist/token-daemon/leader-lock.js.map +1 -1
- package/dist/token-daemon/provider-registry.js +1 -1
- package/dist/token-daemon/provider-registry.js.map +1 -1
- package/dist/token-daemon/server-utils.d.ts +11 -0
- package/dist/token-daemon/server-utils.js +71 -18
- package/dist/token-daemon/server-utils.js.map +1 -1
- package/dist/token-daemon/token-daemon.d.ts +0 -1
- package/dist/token-daemon/token-daemon.js +81 -63
- package/dist/token-daemon/token-daemon.js.map +1 -1
- package/dist/token-daemon/token-types.d.ts +1 -1
- package/dist/token-daemon/token-types.js +0 -1
- package/dist/token-daemon/token-types.js.map +1 -1
- package/dist/token-daemon/token-utils.js +4 -2
- package/dist/token-daemon/token-utils.js.map +1 -1
- package/dist/tools/provider-update/fetch-models.js +1 -5
- package/dist/tools/provider-update/fetch-models.js.map +1 -1
- package/dist/utils/error-handler-registry.js +50 -13
- package/dist/utils/error-handler-registry.js.map +1 -1
- package/dist/utils/errorsamples.d.ts +3 -1
- package/dist/utils/errorsamples.js +198 -14
- package/dist/utils/errorsamples.js.map +1 -1
- package/dist/utils/http-health-probe.d.ts +42 -0
- package/dist/utils/http-health-probe.js +231 -0
- package/dist/utils/http-health-probe.js.map +1 -0
- package/dist/utils/managed-server-pids.js +2 -2
- package/dist/utils/managed-server-pids.js.map +1 -1
- package/dist/utils/module-config-reader.js +11 -1
- package/dist/utils/module-config-reader.js.map +1 -1
- package/dist/utils/runtime-package-root.d.ts +2 -0
- package/dist/utils/runtime-package-root.js +47 -0
- package/dist/utils/runtime-package-root.js.map +1 -0
- package/dist/utils/snapshot-local-disk-gate.d.ts +3 -0
- package/dist/utils/snapshot-local-disk-gate.js +50 -0
- package/dist/utils/snapshot-local-disk-gate.js.map +1 -0
- package/dist/utils/snapshot-payload-guard.d.ts +1 -0
- package/dist/utils/snapshot-payload-guard.js +234 -0
- package/dist/utils/snapshot-payload-guard.js.map +1 -0
- package/dist/utils/snapshot-request-retention.d.ts +3 -0
- package/dist/utils/snapshot-request-retention.js +128 -0
- package/dist/utils/snapshot-request-retention.js.map +1 -0
- package/dist/utils/snapshot-stage-policy.d.ts +3 -0
- package/dist/utils/snapshot-stage-policy.js +111 -0
- package/dist/utils/snapshot-stage-policy.js.map +1 -0
- package/dist/utils/snapshot-writer.js +124 -127
- package/dist/utils/snapshot-writer.js.map +1 -1
- package/docs/CHAT_PROCESS_PROTOCOL_AND_PIPELINE.md +4 -0
- package/docs/CONFIG_ARCHITECTURE.md +2 -2
- package/docs/INSTALLATION_AND_QUICKSTART.md +5 -5
- package/docs/OAUTH.md +2 -5
- package/docs/PORTS.md +1 -1
- package/docs/PROVIDERS_BUILTIN.md +1 -5
- package/docs/PROVIDER_TYPES.md +1 -1
- package/docs/agent-routing/10-runtime-ssot-routing.md +4 -0
- package/docs/agent-routing/20-build-test-release-routing.md +2 -2
- package/docs/agent-routing/30-servertool-lifecycle-routing.md +2 -0
- package/docs/agent-routing/40-task-memory-routing.md +22 -2
- package/docs/audit/286.1-provider-failure-policy-audit.md +341 -0
- package/docs/audits/2026-04-26-fallback-silent-failure-audit.md +119 -0
- package/docs/audits/2026-04-27-provider-failure-policy-ssot-audit.md +153 -0
- package/docs/chat-process-continuation-state-contract.md +196 -0
- package/docs/chat-semantic-expansion-plan.md +2 -0
- package/docs/daemon-admin-api-design.md +9 -9
- package/docs/design/provider-failure-policy-ssot.md +215 -0
- package/docs/design/reasoning-stop-lifecycle.md +90 -0
- package/docs/design/servertool-unified-skeleton.md +202 -0
- package/docs/design/websearch-servertool-orchestration.md +190 -0
- package/docs/error-handling-v2.md +120 -11
- package/docs/protocol-compatibility-matrix.md +147 -0
- package/docs/providers/provider-composite-design.md +4 -5
- package/docs/providers/provider-composite-testing.md +1 -1
- package/docs/providers/provider-type-only-migration.md +2 -15
- package/docs/refactoring/compatibility-v2-architecture-design.md +1 -3
- package/docs/refactoring/host-164.3-responsibility-migration.md +0 -1
- package/docs/routing-instructions.md +42 -1
- package/docs/stop-message-auto.md +0 -1
- package/docs/token-refresh-daemon-plan.md +14 -14
- package/docs/v2-architecture/IMPLEMENTATION-ROADMAP.md +1 -1
- package/docs/v2-architecture/PROVIDER-V2-CHANGESET-RELEASE-CHECKLIST.md +1 -9
- package/docs/v2-architecture/PROVIDER-V2-LAYERING-ADR-DRAFT.md +3 -4
- package/docs/v2-architecture/PROVIDER-V2-MIGRATION-MATRIX-DRAFT.md +4 -15
- package/docs/v2-architecture/PROVIDER-V2-PHASED-MIGRATION-ROLLBACK-DRAFT.md +4 -5
- package/docs/v2-architecture/PROVIDER-V2-PROFILE-API-REGISTRY-DRAFT.md +4 -4
- package/docs/v2-architecture/PROVIDER-V2-REFACTOR-OVERVIEW-DRAFT.md +1 -2
- package/docs/v2-architecture/PROVIDER-V2-VERIFICATION-MATRIX-DRAFT.md +2 -2
- package/node_modules/@jsonstudio/llms/dist/config-unified/unified-config.js +36 -10
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/deepseek-web-request.js +7 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/deepseek-web-response.js +2 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/antigravity-session-signature.js +33 -17
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/header-policies.d.ts +20 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/header-policies.js +79 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/policy-overrides.d.ts +16 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/policy-overrides.js +27 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/provider-resolver.d.ts +26 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/provider-resolver.js +59 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/registry.d.ts +35 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/registry.js +154 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/types.d.ts +75 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profile-registry/types.js +8 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/anthropic-claude-code.json +13 -7
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-claude-code.json +13 -8
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-deepseek-web.json +37 -8
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-qwen.json +48 -11
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/compat-passthrough.json +6 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/provider-resolution-config.json +24 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper-config.js +0 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper-from-chat.js +54 -7
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/anthropic-mapper-to-chat.js +15 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/anthropic-semantics-audit.d.ts +11 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/anthropic-semantics-audit.js +16 -30
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper-config.js +0 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapper-from-chat.js +15 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapping-audit.d.ts +10 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/gemini-mapping-audit.js +9 -30
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/protocol-mapping-audit.d.ts +43 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/protocol-mapping-audit.js +148 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper-from-chat.js +16 -6
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper-helpers.d.ts +2 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper-helpers.js +65 -3
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper-to-chat.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/operation-table/semantic-mappers/responses-mapper.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/compat/compat-types.d.ts +14 -154
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-chat-process-request-utils.d.ts +6 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-chat-process-request-utils.js +83 -3
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-execute-chat-process-entry.js +6 -5
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-execute-request-stage-inbound.d.ts +0 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-execute-request-stage-inbound.js +9 -5
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-execute-request-stage-provider-payload.js +132 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-execute-request-stage.js +0 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-heavy-input-fastpath.d.ts +4 -22
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-heavy-input-fastpath.js +109 -139
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-max-tokens-policy.js +40 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-route-and-outbound.d.ts +0 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline-route-and-outbound.js +19 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.d.ts +0 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/hub-pipeline.js +45 -43
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/route-aware-responses-continuation.d.ts +10 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/route-aware-responses-continuation.js +143 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/index.js +37 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage2_semantic_map/semantic-lift.js +14 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.d.ts +3 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/req_inbound/req_inbound_stage3_context_capture/responses-context-snapshot.js +22 -11
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/chat-process-semantics-bridge.js +59 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/client-remap-protocol-switch.js +3 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_outbound/resp_outbound_stage1_client_remap/index.js +2 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage1_tool_governance/index.js +53 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage2_finalize/index.js +4 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/pipeline/stages/resp_process/resp_process_stage3_servertool_orchestration/index.js +16 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/policy/policy-engine.js +14 -4
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process-anthropic-alias.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process-anthropic-alias.js +29 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process-pending-tool-sync.js +38 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/process/chat-process-request-sanitizer.js +164 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/provider-response.js +27 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/response-mappers.d.ts +9 -3
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/response-mappers.js +8 -7
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/response/response-runtime-anthropic.js +20 -5
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/snapshot-recorder.js +1 -247
- package/node_modules/@jsonstudio/llms/dist/conversion/hub/types/chat-envelope.d.ts +84 -4
- package/node_modules/@jsonstudio/llms/dist/conversion/pipeline/codecs/v2/responses-openai-pipeline.js +26 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge/response-payload.js +10 -9
- package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge/utils.js +20 -5
- package/node_modules/@jsonstudio/llms/dist/conversion/responses/responses-openai-bridge.js +88 -4
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils-core.js +5 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils-openai-request.js +55 -14
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils-tool-schema.js +1 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/anthropic-message-utils.js +38 -15
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/openai-message-normalize.js +45 -6
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-conversation-store.d.ts +15 -0
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-conversation-store.js +157 -13
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-reasoning-registry.d.ts +8 -2
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-reasoning-registry.js +103 -9
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/responses-response-utils.js +10 -10
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-filter-pipeline.js +59 -9
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-governor-guards.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-governor-guards.js +54 -43
- package/node_modules/@jsonstudio/llms/dist/conversion/shared/tool-governor.js +62 -8
- package/node_modules/@jsonstudio/llms/dist/conversion/snapshot-utils.js +121 -8
- package/node_modules/@jsonstudio/llms/dist/filters/engine.js +64 -6
- package/node_modules/@jsonstudio/llms/dist/filters/special/request-tool-list-filter.js +32 -11
- package/node_modules/@jsonstudio/llms/dist/filters/special/request-toolcalls-stringify.js +26 -1
- package/node_modules/@jsonstudio/llms/dist/filters/special/request-tools-normalize.js +46 -7
- package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-arguments-blacklist.js +10 -1
- package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-arguments-schema-converge.js +10 -1
- package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-arguments-stringify.js +30 -5
- package/node_modules/@jsonstudio/llms/dist/filters/special/response-tool-arguments-whitelist.js +10 -1
- package/node_modules/@jsonstudio/llms/dist/filters/special/tool-filter-hooks.js +16 -14
- package/node_modules/@jsonstudio/llms/dist/filters/utils/snapshot-writer.js +47 -5
- package/node_modules/@jsonstudio/llms/dist/guidance/index.js +16 -2
- package/node_modules/@jsonstudio/llms/dist/http/sse-response.js +42 -6
- package/node_modules/@jsonstudio/llms/dist/native/router_hotpath_napi.node +0 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/auth-utils.js +33 -31
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/provider-normalization.d.ts +6 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/provider-normalization.js +78 -98
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/responses-helpers.js +22 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/routing-config.js +56 -3
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap/streaming-helpers.js +19 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/bootstrap.js +62 -293
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/classifier.js +11 -82
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/antigravity/alias-lease.js +42 -15
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/cooldown-manager.js +55 -3
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/health/index.js +66 -15
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/routing-pools/index.js +44 -8
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/routing-state/keys.d.ts +7 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/routing-state/keys.js +65 -21
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/routing-state/store.js +19 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/sticky-session-manager.d.ts +9 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine/sticky-session-manager.js +139 -4
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-logging.js +2 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-chat-process-clock-reminder-semantics.js +68 -59
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-chat-process-governance-semantics.js +156 -157
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-chat-process-node-result-semantics.js +31 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-chat-process-servertool-orchestration-semantics.js +94 -95
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-compat-action-semantics.d.ts +0 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-compat-action-semantics.js +0 -7
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics-parsers.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics-parsers.js +203 -305
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics-tools-post.js +35 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics-tools-request.js +2 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-action-semantics-types.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-bridge-policy-semantics.js +173 -154
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-edge-stage-semantics.js +106 -57
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-inbound-outbound-semantics.js +122 -114
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics-builders.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics-metadata-policy.js +100 -86
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics-passthrough.js +52 -33
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics-protocol.js +79 -62
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-orchestration-semantics.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics-parsers.js +50 -33
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-inbound-semantics-types.d.ts +2 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics-parsers.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-req-outbound-semantics-parsers.js +161 -177
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics-outbound-tools.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics-outbound-tools.js +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics-parsers.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-hub-pipeline-resp-semantics-parsers.js +231 -286
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-router-hotpath-analysis.js +143 -164
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-router-hotpath-required-exports.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-router-hotpath-required-exports.js +8 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics-reasoning.js +57 -28
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics-responses.d.ts +8 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics-responses.js +76 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-shared-conversion-semantics.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-virtual-router-bootstrap-providers.d.ts +24 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-virtual-router-bootstrap-providers.js +78 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-virtual-router-bootstrap-routing.d.ts +17 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/native-virtual-router-bootstrap-routing.js +72 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/route-utils.js +9 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-selection/tier-selection-select.js +11 -5
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine.js +4 -39
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/features.js +199 -31
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/health-manager.js +7 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/load-balancer.d.ts +3 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/load-balancer.js +47 -3
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/native-error.d.ts +11 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/native-error.js +71 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-registry.js +81 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-runtime-ingress.d.ts +24 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/provider-runtime-ingress.js +139 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-instructions/parse.js +21 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-instructions/state.js +46 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-instructions/types.d.ts +7 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/routing-stop-message-state-codec.js +30 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/sticky-session-store.js +44 -15
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/stop-message-state-sync.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/stop-message-state-sync.js +10 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/success-center.js +39 -2
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/tool-signals.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/tool-signals.js +25 -24
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/types.d.ts +3 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/engine.js +255 -71
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/clock.js +20 -2
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/followup-request-builder.js +120 -85
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/memory-appender.d.ts +6 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/memory-appender.js +42 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/reasoning-only-continue.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/reasoning-stop-guard.js +630 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/reasoning-stop-state.d.ts +24 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/reasoning-stop-state.js +606 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/reasoning-stop.js +292 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/{iflow-followup.d.ts → ai-followup.d.ts} +3 -3
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/{iflow-followup.js → ai-followup.js} +76 -81
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/config.d.ts +1 -2
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/config.js +2 -6
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/runtime-utils.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto/runtime-utils.js +51 -11
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/stop-message-auto.js +5 -4
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/web-search-auto-trigger.d.ts +9 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/web-search-auto-trigger.js +91 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/web-search.js +1 -131
- package/node_modules/@jsonstudio/llms/dist/servertool/heartbeat/session-store.js +49 -18
- package/node_modules/@jsonstudio/llms/dist/servertool/registry.js +3 -0
- package/node_modules/@jsonstudio/llms/dist/servertool/server-side-tools.d.ts +2 -2
- package/node_modules/@jsonstudio/llms/dist/servertool/server-side-tools.js +14 -10
- package/node_modules/@jsonstudio/llms/dist/servertool/strip-servertool-calls.js +2 -3
- package/node_modules/@jsonstudio/llms/dist/servertool/types.d.ts +11 -1
- package/node_modules/@jsonstudio/llms/dist/sse/json-to-sse/chat-json-to-sse-converter.js +26 -1
- package/node_modules/@jsonstudio/llms/dist/sse/json-to-sse/event-generators/chat.d.ts +2 -2
- package/node_modules/@jsonstudio/llms/dist/sse/json-to-sse/event-generators/chat.js +38 -3
- package/node_modules/@jsonstudio/llms/dist/sse/json-to-sse/sequencers/chat-sequencer.js +6 -3
- package/node_modules/@jsonstudio/llms/dist/sse/shared/chat-serializer.js +27 -3
- package/node_modules/@jsonstudio/llms/dist/sse/shared/constants.d.ts +6 -6
- package/node_modules/@jsonstudio/llms/dist/sse/shared/constants.js +3 -3
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/anthropic-sse-to-json-converter.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/anthropic-sse-to-json-converter.js +36 -1
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/builders/anthropic-response-builder.js +6 -20
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/builders/response-builder.d.ts +3 -0
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/builders/response-builder.js +125 -42
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/chat-sse-to-json-converter.js +59 -10
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/parsers/sse-parser.js +2 -0
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/responses-sse-to-json-converter.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/sse/sse-to-json/responses-sse-to-json-converter.js +71 -2
- package/node_modules/@jsonstudio/llms/dist/sse/types/chat-types.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/sse/types/chat-types.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/sse/types/conversion-context.js +2 -2
- package/node_modules/@jsonstudio/llms/dist/sse/types/index.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/sse/types/responses-types.d.ts +1 -1
- package/node_modules/@jsonstudio/llms/dist/sse/types/responses-types.js +1 -1
- package/node_modules/@jsonstudio/llms/dist/telemetry/stats-center.js +34 -12
- package/node_modules/@jsonstudio/llms/dist/tools/apply-patch/patch-text/fuzzy-match.d.ts +14 -0
- package/node_modules/@jsonstudio/llms/dist/tools/apply-patch/patch-text/fuzzy-match.js +174 -0
- package/node_modules/@jsonstudio/llms/dist/tools/apply-patch/patch-text/normalize.js +148 -0
- package/node_modules/@jsonstudio/llms/dist/tools/apply-patch/structured.js +31 -2
- package/node_modules/@jsonstudio/llms/dist/tools/apply-patch/validator.js +121 -4
- package/node_modules/@jsonstudio/llms/dist/tools/exec-command/normalize.d.ts +4 -1
- package/node_modules/@jsonstudio/llms/dist/tools/exec-command/normalize.js +31 -16
- package/node_modules/@jsonstudio/llms/dist/tools/exec-command/validator.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/tools/exec-command/validator.js +3 -1
- package/node_modules/@jsonstudio/llms/dist/tools/tool-registry.d.ts +1 -0
- package/node_modules/@jsonstudio/llms/dist/tools/tool-registry.js +5 -27
- package/node_modules/@jsonstudio/llms/package.json +1 -1
- package/package.json +6 -7
- package/scripts/ci/repo-sanity.mjs +1 -0
- package/scripts/ci/silent-failure-audit.mjs +112 -70
- package/scripts/cleanup-stale-server-pids.mjs +0 -6
- package/scripts/ensure-cli-command-shim.mjs +49 -15
- package/scripts/ensure-cli-executable.mjs +1 -1
- package/scripts/install-global.sh +7 -6
- package/scripts/install-release-snapshot.mjs +232 -0
- package/scripts/install-release.sh +30 -24
- package/scripts/link-global-llms-local.mjs +1 -2
- package/scripts/pack-mode.mjs +0 -4
- package/scripts/pack-rcc.mjs +17 -58
- package/scripts/run-bg.sh +0 -6
- package/scripts/run-fg-gtimeout.sh +0 -6
- package/scripts/tests/antigravity-codex-sample-pipeline-compare.mjs +1 -1
- package/scripts/tests/blackbox-rcc-vs-routecodex-antigravity.mjs +60 -39
- package/scripts/verify-install-e2e.mjs +64 -26
- package/configsamples/provider-default/qwenchat/config.v2.json +0 -53
- package/dist/providers/auth/iflow-cookie-auth.d.ts +0 -27
- package/dist/providers/auth/iflow-cookie-auth.js +0 -207
- package/dist/providers/auth/iflow-cookie-auth.js.map +0 -1
- package/dist/providers/auth/iflow-userinfo-helper.d.ts +0 -32
- package/dist/providers/auth/iflow-userinfo-helper.js +0 -81
- package/dist/providers/auth/iflow-userinfo-helper.js.map +0 -1
- package/dist/providers/core/runtime/iflow-http-provider.d.ts +0 -13
- package/dist/providers/core/runtime/iflow-http-provider.js +0 -22
- package/dist/providers/core/runtime/iflow-http-provider.js.map +0 -1
- package/dist/providers/core/runtime/provider-iflow-business-error-utils.d.ts +0 -15
- package/dist/providers/core/runtime/provider-iflow-business-error-utils.js +0 -49
- package/dist/providers/core/runtime/provider-iflow-business-error-utils.js.map +0 -1
- package/dist/providers/core/runtime/qwenchat-http-provider-helpers.d.ts +0 -89
- package/dist/providers/core/runtime/qwenchat-http-provider-helpers.js +0 -1698
- package/dist/providers/core/runtime/qwenchat-http-provider-helpers.js.map +0 -1
- package/dist/providers/core/runtime/qwenchat-http-provider.d.ts +0 -9
- package/dist/providers/core/runtime/qwenchat-http-provider.js +0 -78
- package/dist/providers/core/runtime/qwenchat-http-provider.js.map +0 -1
- package/dist/providers/core/runtime/standard-tool-text-request-transform.d.ts +0 -13
- package/dist/providers/core/runtime/standard-tool-text-request-transform.js +0 -138
- package/dist/providers/core/runtime/standard-tool-text-request-transform.js.map +0 -1
- package/dist/providers/core/runtime/transport/iflow-signer.d.ts +0 -12
- package/dist/providers/core/runtime/transport/iflow-signer.js +0 -63
- package/dist/providers/core/runtime/transport/iflow-signer.js.map +0 -1
- package/dist/providers/profile/families/iflow-profile.d.ts +0 -2
- package/dist/providers/profile/families/iflow-profile.js +0 -384
- package/dist/providers/profile/families/iflow-profile.js.map +0 -1
- package/docs/mapping-tables/iflow-to-openai.json +0 -215
- package/docs/mapping-tables/openai-to-iflow.json +0 -227
- package/docs/multi-token-auth-guide.md +0 -66
- package/docs/oauth-authentication-guide.md +0 -172
- package/docs/oauth-iflow-implementation.md +0 -157
- package/docs/release-iflow-400-gate.md +0 -58
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-cli-defaults.d.ts +0 -10
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-cli-defaults.js +0 -31
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.d.ts +0 -7
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-history-media-placeholder.js +0 -25
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.d.ts +0 -12
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-kimi-thinking-reasoning-fill.js +0 -46
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-native-compat.d.ts +0 -6
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-native-compat.js +0 -36
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-response-body-unwrap.d.ts +0 -9
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-response-body-unwrap.js +0 -25
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-tool-text-fallback.d.ts +0 -5
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-tool-text-fallback.js +0 -29
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-web-search.d.ts +0 -18
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/iflow-web-search.js +0 -49
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/qwenchat-web-request.d.ts +0 -3
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/actions/qwenchat-web-request.js +0 -62
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-iflow.json +0 -353
- package/node_modules/@jsonstudio/llms/dist/conversion/compat/profiles/chat-qwenchat-web.json +0 -47
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-health.d.ts +0 -1
- package/node_modules/@jsonstudio/llms/dist/router/virtual-router/engine-health.js +0 -1
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/iflow-model-error-retry.js +0 -92
- package/node_modules/@jsonstudio/llms/dist/servertool/handlers/review.js +0 -202
- package/scripts/publish-rcc.mjs +0 -81
- /package/node_modules/@jsonstudio/llms/dist/servertool/handlers/{iflow-model-error-retry.d.ts → reasoning-stop-guard.d.ts} +0 -0
- /package/node_modules/@jsonstudio/llms/dist/servertool/handlers/{review.d.ts → reasoning-stop.d.ts} +0 -0
|
@@ -251,10 +251,6 @@ function isGeminiWebSearchEngine(engine) {
|
|
|
251
251
|
key.startsWith('antigravity.') ||
|
|
252
252
|
key.startsWith('gemini.'));
|
|
253
253
|
}
|
|
254
|
-
function isIflowWebSearchEngine(engine) {
|
|
255
|
-
const key = engine.providerKey.toLowerCase();
|
|
256
|
-
return key.startsWith('iflow.');
|
|
257
|
-
}
|
|
258
254
|
function isQwenWebSearchEngine(engine) {
|
|
259
255
|
const key = engine.providerKey.toLowerCase();
|
|
260
256
|
return key.startsWith('qwen.');
|
|
@@ -277,22 +273,7 @@ async function executeWebSearchBackend(args) {
|
|
|
277
273
|
try {
|
|
278
274
|
logServerToolWebSearch(engine, options.requestId, query);
|
|
279
275
|
const requestSuffix = args.requestSuffix;
|
|
280
|
-
|
|
281
|
-
// 即使 reenterPipeline 可用,也不走 Chat 模型 + tools。
|
|
282
|
-
if (isIflowWebSearchEngine(engine) && options.providerInvoker) {
|
|
283
|
-
const backendResult = await executeIflowWebSearchViaProvider({
|
|
284
|
-
options,
|
|
285
|
-
engine,
|
|
286
|
-
query,
|
|
287
|
-
recency,
|
|
288
|
-
count: args.resultCount,
|
|
289
|
-
requestSuffix
|
|
290
|
-
});
|
|
291
|
-
summary = backendResult.summary;
|
|
292
|
-
hits = backendResult.hits;
|
|
293
|
-
ok = backendResult.ok;
|
|
294
|
-
}
|
|
295
|
-
else if (isQwenWebSearchEngine(engine) && options.providerInvoker) {
|
|
276
|
+
if (isQwenWebSearchEngine(engine) && options.providerInvoker) {
|
|
296
277
|
const backendResult = await executeQwenWebSearchViaProvider({
|
|
297
278
|
options,
|
|
298
279
|
engine,
|
|
@@ -529,117 +510,6 @@ async function executeWebSearchViaProvider(args) {
|
|
|
529
510
|
}
|
|
530
511
|
return extractTextFromChatLike(providerResponse);
|
|
531
512
|
}
|
|
532
|
-
async function executeIflowWebSearchViaProvider(args) {
|
|
533
|
-
const { options, engine, query, count, requestSuffix } = args;
|
|
534
|
-
if (!options.providerInvoker) {
|
|
535
|
-
return {
|
|
536
|
-
summary: '',
|
|
537
|
-
hits: [],
|
|
538
|
-
ok: false
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
const searchEngineList = Array.isArray(engine.searchEngineList) && engine.searchEngineList.length
|
|
542
|
-
? engine.searchEngineList
|
|
543
|
-
: ['GOOGLE', 'BING', 'SCHOLAR', 'AIPGC', 'PDF'];
|
|
544
|
-
const searchBody = {
|
|
545
|
-
query,
|
|
546
|
-
history: {},
|
|
547
|
-
userId: 2,
|
|
548
|
-
userIp: '42.120.74.197',
|
|
549
|
-
appCode: 'SEARCH_CHATBOT',
|
|
550
|
-
chatId: Date.now(),
|
|
551
|
-
phase: 'UNIFY',
|
|
552
|
-
enableQueryRewrite: false,
|
|
553
|
-
enableRetrievalSecurity: false,
|
|
554
|
-
enableIntention: false,
|
|
555
|
-
searchEngineList
|
|
556
|
-
};
|
|
557
|
-
let providerKey = engine.providerKey;
|
|
558
|
-
try {
|
|
559
|
-
const adapter = options.adapterContext && typeof options.adapterContext === 'object'
|
|
560
|
-
? options.adapterContext
|
|
561
|
-
: null;
|
|
562
|
-
const target = adapter && adapter.target && typeof adapter.target === 'object'
|
|
563
|
-
? adapter.target
|
|
564
|
-
: null;
|
|
565
|
-
const targetProviderKey = target && typeof target.providerKey === 'string' && target.providerKey.trim()
|
|
566
|
-
? target.providerKey.trim()
|
|
567
|
-
: undefined;
|
|
568
|
-
if (targetProviderKey) {
|
|
569
|
-
providerKey = targetProviderKey;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
catch {
|
|
573
|
-
// best-effort: fallback to engine.providerKey
|
|
574
|
-
}
|
|
575
|
-
const payload = {
|
|
576
|
-
data: searchBody,
|
|
577
|
-
metadata: {
|
|
578
|
-
entryEndpoint: '/chat/retrieve',
|
|
579
|
-
iflowWebSearch: true,
|
|
580
|
-
routeName: 'web_search'
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
const backend = await options.providerInvoker({
|
|
584
|
-
providerKey,
|
|
585
|
-
providerType: undefined,
|
|
586
|
-
modelId: undefined,
|
|
587
|
-
providerProtocol: options.providerProtocol,
|
|
588
|
-
payload,
|
|
589
|
-
entryEndpoint: '/v1/chat/retrieve',
|
|
590
|
-
requestId: `${options.requestId}${requestSuffix}`,
|
|
591
|
-
routeHint: 'web_search'
|
|
592
|
-
});
|
|
593
|
-
const providerResponse = backend.providerResponse && typeof backend.providerResponse === 'object'
|
|
594
|
-
? backend.providerResponse
|
|
595
|
-
: null;
|
|
596
|
-
if (!providerResponse) {
|
|
597
|
-
return {
|
|
598
|
-
summary: '',
|
|
599
|
-
hits: [],
|
|
600
|
-
ok: false
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
const container = providerResponse;
|
|
604
|
-
const rawHits = Array.isArray(container.data) ? container.data : [];
|
|
605
|
-
const hits = [];
|
|
606
|
-
for (const item of rawHits) {
|
|
607
|
-
if (!item || typeof item !== 'object' || Array.isArray(item))
|
|
608
|
-
continue;
|
|
609
|
-
const record = item;
|
|
610
|
-
const link = typeof record.url === 'string' && record.url.trim() ? record.url.trim() : '';
|
|
611
|
-
if (!link)
|
|
612
|
-
continue;
|
|
613
|
-
const title = typeof record.title === 'string' && record.title.trim() ? record.title.trim() : undefined;
|
|
614
|
-
const publishDate = typeof record.time === 'string' && record.time.trim() ? record.time.trim() : undefined;
|
|
615
|
-
const content = typeof record.abstractInfo === 'string' && record.abstractInfo.trim()
|
|
616
|
-
? record.abstractInfo.trim()
|
|
617
|
-
: undefined;
|
|
618
|
-
hits.push({
|
|
619
|
-
title,
|
|
620
|
-
link,
|
|
621
|
-
publish_date: publishDate,
|
|
622
|
-
content
|
|
623
|
-
});
|
|
624
|
-
if (hits.length >= count) {
|
|
625
|
-
break;
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
let summary = '';
|
|
629
|
-
if (typeof container.message === 'string' && container.message.trim()) {
|
|
630
|
-
summary = container.message.trim();
|
|
631
|
-
}
|
|
632
|
-
if (!summary && hits.length) {
|
|
633
|
-
summary = formatHitsSummary(hits);
|
|
634
|
-
}
|
|
635
|
-
const successField = container.success;
|
|
636
|
-
const ok = typeof successField === 'boolean' ? successField : hits.length > 0;
|
|
637
|
-
return {
|
|
638
|
-
summary,
|
|
639
|
-
hits,
|
|
640
|
-
ok
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
513
|
async function executeQwenWebSearchViaProvider(args) {
|
|
644
514
|
const { options, engine, query, count, requestSuffix } = args;
|
|
645
515
|
if (!options.providerInvoker) {
|
|
@@ -5,6 +5,11 @@ import { readJsonFile, writeJsonFileAtomic } from "../clock/io.js";
|
|
|
5
5
|
import { nowMs } from "../clock/state.js";
|
|
6
6
|
import { readSessionDirEnv, resolveHeartbeatDir, resolveHeartbeatStateFile, resolveHeartbeatStateFileInDir, resolveLegacyHeartbeatDir, resolveHeartbeatStoreBaseDir, } from "./paths.js";
|
|
7
7
|
import { appendHeartbeatHistoryEvent } from "./history-store.js";
|
|
8
|
+
function logHeartbeatSessionStoreNonBlocking(stage, error, details = {}) {
|
|
9
|
+
const reason = error instanceof Error ? error.stack || `${error.name}: ${error.message}` : String(error);
|
|
10
|
+
const detailSuffix = Object.keys(details).length > 0 ? ` details=${JSON.stringify(details)}` : "";
|
|
11
|
+
console.warn(`[heartbeat-session-store] ${stage} failed (non-blocking): ${reason}${detailSuffix}`);
|
|
12
|
+
}
|
|
8
13
|
function readString(value) {
|
|
9
14
|
if (typeof value !== "string") {
|
|
10
15
|
return undefined;
|
|
@@ -106,7 +111,8 @@ async function pathExists(filePath) {
|
|
|
106
111
|
await fs.access(filePath);
|
|
107
112
|
return true;
|
|
108
113
|
}
|
|
109
|
-
catch {
|
|
114
|
+
catch (error) {
|
|
115
|
+
logHeartbeatSessionStoreNonBlocking("path_exists.access", error, { filePath });
|
|
110
116
|
return false;
|
|
111
117
|
}
|
|
112
118
|
}
|
|
@@ -140,8 +146,11 @@ async function resolveLegacyHeartbeatStateFiles(sessionDir, tmuxSessionId) {
|
|
|
140
146
|
}
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
|
-
catch {
|
|
144
|
-
|
|
149
|
+
catch (error) {
|
|
150
|
+
logHeartbeatSessionStoreNonBlocking("resolve_legacy_state_files.scan_store_base", error, {
|
|
151
|
+
storeBaseDir,
|
|
152
|
+
tmuxSessionId,
|
|
153
|
+
});
|
|
145
154
|
}
|
|
146
155
|
return Array.from(out);
|
|
147
156
|
}
|
|
@@ -200,8 +209,11 @@ export async function loadHeartbeatState(tmuxSessionId) {
|
|
|
200
209
|
const raw = await readJsonFile(filePath);
|
|
201
210
|
return coerceHeartbeatState(raw, tmuxSessionId);
|
|
202
211
|
}
|
|
203
|
-
catch {
|
|
204
|
-
|
|
212
|
+
catch (error) {
|
|
213
|
+
logHeartbeatSessionStoreNonBlocking("load_state.primary_read", error, {
|
|
214
|
+
filePath,
|
|
215
|
+
tmuxSessionId,
|
|
216
|
+
});
|
|
205
217
|
}
|
|
206
218
|
}
|
|
207
219
|
const legacyFiles = await resolveLegacyHeartbeatStateFiles(sessionDir, tmuxSessionId);
|
|
@@ -216,13 +228,19 @@ export async function loadHeartbeatState(tmuxSessionId) {
|
|
|
216
228
|
try {
|
|
217
229
|
await fs.rm(legacyFilePath, { force: true });
|
|
218
230
|
}
|
|
219
|
-
catch {
|
|
220
|
-
|
|
231
|
+
catch (error) {
|
|
232
|
+
logHeartbeatSessionStoreNonBlocking("load_state.cleanup_legacy_file", error, {
|
|
233
|
+
legacyFilePath,
|
|
234
|
+
tmuxSessionId,
|
|
235
|
+
});
|
|
221
236
|
}
|
|
222
237
|
return migrated;
|
|
223
238
|
}
|
|
224
|
-
catch {
|
|
225
|
-
|
|
239
|
+
catch (error) {
|
|
240
|
+
logHeartbeatSessionStoreNonBlocking("load_state.read_legacy_candidate", error, {
|
|
241
|
+
legacyFilePath,
|
|
242
|
+
tmuxSessionId,
|
|
243
|
+
});
|
|
226
244
|
}
|
|
227
245
|
}
|
|
228
246
|
return buildHeartbeatState(tmuxSessionId);
|
|
@@ -283,8 +301,11 @@ export async function removeHeartbeatState(tmuxSessionId) {
|
|
|
283
301
|
try {
|
|
284
302
|
await fs.rm(filePath, { force: true });
|
|
285
303
|
}
|
|
286
|
-
catch {
|
|
287
|
-
|
|
304
|
+
catch (error) {
|
|
305
|
+
logHeartbeatSessionStoreNonBlocking("remove_state.primary_file", error, {
|
|
306
|
+
filePath,
|
|
307
|
+
tmuxSessionId,
|
|
308
|
+
});
|
|
288
309
|
}
|
|
289
310
|
}
|
|
290
311
|
const legacyFiles = await resolveLegacyHeartbeatStateFiles(sessionDir, tmuxSessionId);
|
|
@@ -292,8 +313,11 @@ export async function removeHeartbeatState(tmuxSessionId) {
|
|
|
292
313
|
try {
|
|
293
314
|
await fs.rm(legacyFilePath, { force: true });
|
|
294
315
|
}
|
|
295
|
-
catch {
|
|
296
|
-
|
|
316
|
+
catch (error) {
|
|
317
|
+
logHeartbeatSessionStoreNonBlocking("remove_state.legacy_file", error, {
|
|
318
|
+
legacyFilePath,
|
|
319
|
+
tmuxSessionId,
|
|
320
|
+
});
|
|
297
321
|
}
|
|
298
322
|
}
|
|
299
323
|
}
|
|
@@ -319,8 +343,10 @@ export async function listHeartbeatStates() {
|
|
|
319
343
|
dirs.add(path.join(storeBaseDir, entry.name, "heartbeat"));
|
|
320
344
|
}
|
|
321
345
|
}
|
|
322
|
-
catch {
|
|
323
|
-
|
|
346
|
+
catch (error) {
|
|
347
|
+
logHeartbeatSessionStoreNonBlocking("list_states.scan_store_base", error, {
|
|
348
|
+
storeBaseDir,
|
|
349
|
+
});
|
|
324
350
|
}
|
|
325
351
|
}
|
|
326
352
|
const merged = new Map();
|
|
@@ -340,17 +366,22 @@ export async function listHeartbeatStates() {
|
|
|
340
366
|
merged.set(state.tmuxSessionId, state);
|
|
341
367
|
}
|
|
342
368
|
}
|
|
343
|
-
catch {
|
|
369
|
+
catch (error) {
|
|
344
370
|
const fallback = buildHeartbeatState(tmuxSessionId);
|
|
345
371
|
const prev = merged.get(fallback.tmuxSessionId);
|
|
346
372
|
if (!prev || fallback.updatedAtMs >= prev.updatedAtMs) {
|
|
347
373
|
merged.set(fallback.tmuxSessionId, fallback);
|
|
348
374
|
}
|
|
375
|
+
logHeartbeatSessionStoreNonBlocking("list_states.read_state_file", error, {
|
|
376
|
+
dir,
|
|
377
|
+
file: entry.name,
|
|
378
|
+
tmuxSessionId,
|
|
379
|
+
});
|
|
349
380
|
}
|
|
350
381
|
}
|
|
351
382
|
}
|
|
352
|
-
catch {
|
|
353
|
-
|
|
383
|
+
catch (error) {
|
|
384
|
+
logHeartbeatSessionStoreNonBlocking("list_states.read_directory", error, { dir });
|
|
354
385
|
}
|
|
355
386
|
}
|
|
356
387
|
return Array.from(merged.values()).sort((a, b) => b.updatedAtMs - a.updatedAtMs);
|
|
@@ -10,6 +10,9 @@ function normalizeServerToolName(value) {
|
|
|
10
10
|
if (key === 'websearch' || key === 'web-search') {
|
|
11
11
|
return 'web_search';
|
|
12
12
|
}
|
|
13
|
+
if (key === 'reasoning_stop' || key === 'reasoning-stop') {
|
|
14
|
+
return 'reasoning.stop';
|
|
15
|
+
}
|
|
13
16
|
return key;
|
|
14
17
|
}
|
|
15
18
|
function normalizeAutoHookPhase(value) {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { JsonObject } from '../conversion/hub/types/json.js';
|
|
2
2
|
import type { ServerSideToolEngineOptions, ServerSideToolEngineResult, ToolCall } from './types.js';
|
|
3
|
-
import './handlers/iflow-model-error-retry.js';
|
|
4
3
|
import './handlers/antigravity-thought-signature-bootstrap.js';
|
|
5
4
|
import './handlers/memory/cache-auto.js';
|
|
6
5
|
import './handlers/stop-message-auto.js';
|
|
7
6
|
import './handlers/reasoning-only-continue.js';
|
|
7
|
+
import './handlers/reasoning-stop.js';
|
|
8
|
+
import './handlers/reasoning-stop-guard.js';
|
|
8
9
|
import './handlers/clock.js';
|
|
9
10
|
import './handlers/clock-auto.js';
|
|
10
11
|
import './handlers/exec-command-guard.js';
|
|
11
12
|
import './handlers/apply-patch-guard.js';
|
|
12
13
|
import './handlers/continue-execution.js';
|
|
13
|
-
import './handlers/review.js';
|
|
14
14
|
export declare function runServerSideToolEngine(options: ServerSideToolEngineOptions): Promise<ServerSideToolEngineResult>;
|
|
15
15
|
export declare function extractToolCalls(chatResponse: JsonObject): ToolCall[];
|
|
16
16
|
export declare function cloneJson<T>(value: T): T;
|
|
@@ -2,17 +2,17 @@ import { getServerToolHandler, listAutoServerToolHooks } from './registry.js';
|
|
|
2
2
|
import { ProviderProtocolError } from '../conversion/provider-protocol-error.js';
|
|
3
3
|
import { executeWebSearchBackendPlan } from './handlers/web-search.js';
|
|
4
4
|
import { executeVisionBackendPlan } from './handlers/vision.js';
|
|
5
|
-
import './handlers/iflow-model-error-retry.js';
|
|
6
5
|
import './handlers/antigravity-thought-signature-bootstrap.js';
|
|
7
6
|
import './handlers/memory/cache-auto.js';
|
|
8
7
|
import './handlers/stop-message-auto.js';
|
|
9
8
|
import './handlers/reasoning-only-continue.js';
|
|
9
|
+
import './handlers/reasoning-stop.js';
|
|
10
|
+
import './handlers/reasoning-stop-guard.js';
|
|
10
11
|
import './handlers/clock.js';
|
|
11
12
|
import './handlers/clock-auto.js';
|
|
12
13
|
import './handlers/exec-command-guard.js';
|
|
13
14
|
import './handlers/apply-patch-guard.js';
|
|
14
15
|
import './handlers/continue-execution.js';
|
|
15
|
-
import './handlers/review.js';
|
|
16
16
|
import { runPreCommandHooks } from './pre-command-hooks.js';
|
|
17
17
|
import { readRuntimeMetadata } from '../conversion/runtime-metadata.js';
|
|
18
18
|
import { loadRoutingInstructionStateSync } from '../router/virtual-router/sticky-session-store.js';
|
|
@@ -166,6 +166,9 @@ function normalizeServerToolCallName(name) {
|
|
|
166
166
|
if (normalized === 'websearch' || normalized === 'web-search') {
|
|
167
167
|
return 'web_search';
|
|
168
168
|
}
|
|
169
|
+
if (normalized === 'reasoning_stop' || normalized === 'reasoning-stop') {
|
|
170
|
+
return 'reasoning.stop';
|
|
171
|
+
}
|
|
169
172
|
return normalized;
|
|
170
173
|
}
|
|
171
174
|
function looksLikeToolExecutionTranscript(raw) {
|
|
@@ -331,16 +334,17 @@ function stripToolOutputs(base) {
|
|
|
331
334
|
}
|
|
332
335
|
}
|
|
333
336
|
function replaceJsonObjectInPlace(target, next) {
|
|
334
|
-
|
|
335
|
-
|
|
337
|
+
// Copy new properties first, then remove stale keys.
|
|
338
|
+
// This ordering guarantees `target` is never left in a half-deleted state
|
|
339
|
+
// even if an unexpected error occurs mid-operation.
|
|
340
|
+
const newKeys = new Set(Object.keys(next));
|
|
341
|
+
for (const [k, v] of Object.entries(next)) {
|
|
342
|
+
target[k] = v;
|
|
343
|
+
}
|
|
344
|
+
for (const key of Object.keys(target)) {
|
|
345
|
+
if (!newKeys.has(key)) {
|
|
336
346
|
delete target[key];
|
|
337
347
|
}
|
|
338
|
-
for (const [k, v] of Object.entries(next)) {
|
|
339
|
-
target[k] = v;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
// ignore
|
|
344
348
|
}
|
|
345
349
|
}
|
|
346
350
|
function patchToolCallArgumentsById(chatResponse, toolCallId, argumentsText) {
|
|
@@ -8,9 +8,8 @@ function collectExecutedServerToolCallIds(payload) {
|
|
|
8
8
|
const toolCallId = typeof entry.tool_call_id === 'string' ? String(entry.tool_call_id).trim() : '';
|
|
9
9
|
if (!name || !toolCallId)
|
|
10
10
|
continue;
|
|
11
|
-
//
|
|
12
|
-
|
|
13
|
-
continue;
|
|
11
|
+
// tool_outputs at this stage are emitted by executed servertool handlers.
|
|
12
|
+
// Strip every executed servertool call id so client remap only sees client-declared tools.
|
|
14
13
|
ids.add(toolCallId);
|
|
15
14
|
}
|
|
16
15
|
return ids;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AdapterContext } from '../conversion/hub/types/chat-envelope.js';
|
|
2
|
-
import type { JsonObject } from '../conversion/hub/types/json.js';
|
|
2
|
+
import type { JsonObject, JsonValue } from '../conversion/hub/types/json.js';
|
|
3
3
|
/**
|
|
4
4
|
* ProviderInvoker 由 Host 注入,用于在 llmswitch-core 内部发起二次 provider 请求。
|
|
5
5
|
* 该接口对 ServerTool 框架是抽象的,不关心 HTTP 细节。
|
|
@@ -79,6 +79,12 @@ export type ServerToolFollowupInjectionOp = {
|
|
|
79
79
|
op: 'preserve_tools';
|
|
80
80
|
} | {
|
|
81
81
|
op: 'ensure_standard_tools';
|
|
82
|
+
} | {
|
|
83
|
+
op: 'replace_tools';
|
|
84
|
+
tools: JsonObject[];
|
|
85
|
+
} | {
|
|
86
|
+
op: 'force_tool_choice';
|
|
87
|
+
value: JsonValue;
|
|
82
88
|
} | {
|
|
83
89
|
op: 'append_assistant_message';
|
|
84
90
|
required?: boolean;
|
|
@@ -100,6 +106,10 @@ export type ServerToolFollowupInjectionOp = {
|
|
|
100
106
|
} | {
|
|
101
107
|
op: 'trim_openai_messages';
|
|
102
108
|
maxNonSystemMessages: number;
|
|
109
|
+
} | {
|
|
110
|
+
op: 'append_tool_if_missing';
|
|
111
|
+
toolName: string;
|
|
112
|
+
toolDefinition: JsonObject;
|
|
103
113
|
} | {
|
|
104
114
|
op: 'compact_tool_content';
|
|
105
115
|
maxChars: number;
|
|
@@ -7,6 +7,26 @@ import { DEFAULT_CHAT_CONVERSION_CONFIG } from '../types/index.js';
|
|
|
7
7
|
import { ErrorUtils } from '../shared/utils.js';
|
|
8
8
|
import { createChatSequencer } from './sequencers/chat-sequencer.js';
|
|
9
9
|
import { createChatStreamWriter } from '../shared/writer.js';
|
|
10
|
+
function formatUnknownError(error) {
|
|
11
|
+
if (error instanceof Error) {
|
|
12
|
+
return error.stack || `${error.name}: ${error.message}`;
|
|
13
|
+
}
|
|
14
|
+
try {
|
|
15
|
+
return JSON.stringify(error);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return String(error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function logChatJsonToSseNonBlocking(stage, error, details = {}) {
|
|
22
|
+
try {
|
|
23
|
+
const detailSuffix = Object.keys(details).length ? ` details=${JSON.stringify(details)}` : '';
|
|
24
|
+
console.warn(`[chat-json-to-sse] ${stage} failed (non-blocking): ${formatUnknownError(error)}${detailSuffix}`);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// Never throw from non-blocking logging.
|
|
28
|
+
}
|
|
29
|
+
}
|
|
10
30
|
/**
|
|
11
31
|
* 重构后的Chat JSON到SSE转换器
|
|
12
32
|
* 采用函数化架构,专注于编排而非具体业务逻辑
|
|
@@ -171,7 +191,12 @@ export class ChatJsonToSseConverterRefactored {
|
|
|
171
191
|
context.eventStats.totalTokens += deltaContent.length;
|
|
172
192
|
}
|
|
173
193
|
}
|
|
174
|
-
catch {
|
|
194
|
+
catch (error) {
|
|
195
|
+
logChatJsonToSseNonBlocking('stats.parse_chat_chunk', error, {
|
|
196
|
+
requestId: context.requestId,
|
|
197
|
+
eventType: et
|
|
198
|
+
});
|
|
199
|
+
}
|
|
175
200
|
}
|
|
176
201
|
if (typeof event?.timestamp === 'number')
|
|
177
202
|
context.eventStats.lastEventTime = event.timestamp;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Chat协议事件生成器
|
|
3
3
|
* 提供纯函数,将Chat响应数据转换为SSE事件对象,不处理流写入
|
|
4
4
|
*/
|
|
5
|
-
import type { ChatSseEvent, ChatToolCall } from '../../types/index.js';
|
|
5
|
+
import type { ChatSseEvent, ChatCompletionResponse, ChatToolCall } from '../../types/index.js';
|
|
6
6
|
export interface ChatEventGeneratorConfig {
|
|
7
7
|
chunkSize: number;
|
|
8
8
|
chunkDelayMs: number;
|
|
@@ -44,7 +44,7 @@ export declare function buildToolCallArgsDeltas(args: string, toolCallIndex: num
|
|
|
44
44
|
/**
|
|
45
45
|
* 构建finish_reason事件
|
|
46
46
|
*/
|
|
47
|
-
export declare function buildFinishEvent(finishReason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', context: ChatEventGeneratorContext, config?: ChatEventGeneratorConfig): ChatSseEvent;
|
|
47
|
+
export declare function buildFinishEvent(finishReason: 'stop' | 'length' | 'tool_calls' | 'content_filter' | 'function_call', context: ChatEventGeneratorContext, config?: ChatEventGeneratorConfig, usage?: ChatCompletionResponse['usage']): ChatSseEvent;
|
|
48
48
|
/**
|
|
49
49
|
* 构建done事件
|
|
50
50
|
*/
|
|
@@ -10,6 +10,39 @@ export const DEFAULT_CHAT_EVENT_GENERATOR_CONFIG = {
|
|
|
10
10
|
enableIdGeneration: true,
|
|
11
11
|
enableTimestampGeneration: true
|
|
12
12
|
};
|
|
13
|
+
function readNonNegativeInteger(value) {
|
|
14
|
+
if (typeof value === 'number' && Number.isFinite(value) && value >= 0) {
|
|
15
|
+
return Math.round(value);
|
|
16
|
+
}
|
|
17
|
+
if (typeof value === 'string' && value.trim()) {
|
|
18
|
+
const parsed = Number(value);
|
|
19
|
+
if (Number.isFinite(parsed) && parsed >= 0) {
|
|
20
|
+
return Math.round(parsed);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
function normalizeChatUsage(usage) {
|
|
26
|
+
if (!usage || typeof usage !== 'object' || Array.isArray(usage)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const record = usage;
|
|
30
|
+
const promptTokens = readNonNegativeInteger(record.prompt_tokens ?? record.input_tokens ?? record.promptTokens ?? record.inputTokens);
|
|
31
|
+
const completionTokens = readNonNegativeInteger(record.completion_tokens ?? record.output_tokens ?? record.completionTokens ?? record.outputTokens);
|
|
32
|
+
const totalTokens = readNonNegativeInteger(record.total_tokens ??
|
|
33
|
+
record.totalTokens ??
|
|
34
|
+
((promptTokens ?? 0) + (completionTokens ?? 0) > 0
|
|
35
|
+
? (promptTokens ?? 0) + (completionTokens ?? 0)
|
|
36
|
+
: undefined));
|
|
37
|
+
if (promptTokens === undefined || completionTokens === undefined || totalTokens === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
prompt_tokens: promptTokens,
|
|
42
|
+
completion_tokens: completionTokens,
|
|
43
|
+
total_tokens: totalTokens
|
|
44
|
+
};
|
|
45
|
+
}
|
|
13
46
|
/**
|
|
14
47
|
* 创建默认上下文
|
|
15
48
|
*/
|
|
@@ -68,7 +101,7 @@ export function* buildReasoningDeltas(reasoning, context, config = DEFAULT_CHAT_
|
|
|
68
101
|
...baseChunk,
|
|
69
102
|
choices: [{
|
|
70
103
|
index: context.choiceIndex,
|
|
71
|
-
delta: { reasoning },
|
|
104
|
+
delta: { reasoning, reasoning_content: reasoning },
|
|
72
105
|
logprobs: null,
|
|
73
106
|
finish_reason: null
|
|
74
107
|
}]
|
|
@@ -176,8 +209,9 @@ export function* buildToolCallArgsDeltas(args, toolCallIndex, context, config =
|
|
|
176
209
|
/**
|
|
177
210
|
* 构建finish_reason事件
|
|
178
211
|
*/
|
|
179
|
-
export function buildFinishEvent(finishReason, context, config = DEFAULT_CHAT_EVENT_GENERATOR_CONFIG) {
|
|
212
|
+
export function buildFinishEvent(finishReason, context, config = DEFAULT_CHAT_EVENT_GENERATOR_CONFIG, usage) {
|
|
180
213
|
const baseChunk = createBaseChunk(context, config);
|
|
214
|
+
const normalizedUsage = normalizeChatUsage(usage);
|
|
181
215
|
const chunk = {
|
|
182
216
|
...baseChunk,
|
|
183
217
|
choices: [{
|
|
@@ -185,7 +219,8 @@ export function buildFinishEvent(finishReason, context, config = DEFAULT_CHAT_EV
|
|
|
185
219
|
delta: {},
|
|
186
220
|
logprobs: null,
|
|
187
221
|
finish_reason: finishReason
|
|
188
|
-
}]
|
|
222
|
+
}],
|
|
223
|
+
...(normalizedUsage ? { usage: normalizedUsage } : {})
|
|
189
224
|
};
|
|
190
225
|
return {
|
|
191
226
|
event: 'chat_chunk',
|
|
@@ -23,10 +23,13 @@ function validateMessageSequence(message, previousMessage) {
|
|
|
23
23
|
return false;
|
|
24
24
|
// 允许两种有效形态:
|
|
25
25
|
// 1) content 存在(字符串/数组/对象)
|
|
26
|
-
// 2)
|
|
26
|
+
// 2) reasoning-only 输出
|
|
27
|
+
// 3) 仅工具调用(content 为空,但存在 tool_calls[] 且 finish_reason=tool_calls)
|
|
27
28
|
const hasContent = hasMeaningfulContent(message.content);
|
|
29
|
+
const hasReasoning = (typeof message.reasoning_content === 'string' && message.reasoning_content.trim().length > 0)
|
|
30
|
+
|| (typeof message.reasoning === 'string' && message.reasoning.trim().length > 0);
|
|
28
31
|
const hasToolCalls = Array.isArray(message.tool_calls) && message.tool_calls.length > 0;
|
|
29
|
-
if (!hasContent && !hasToolCalls)
|
|
32
|
+
if (!hasContent && !hasReasoning && !hasToolCalls)
|
|
30
33
|
return false;
|
|
31
34
|
// 不允许 assistant 之后出现 user 倒序
|
|
32
35
|
if (previousMessage?.role === 'assistant' && message.role === 'user')
|
|
@@ -163,7 +166,7 @@ export async function* sequenceChatResponse(response, context, config = DEFAULT_
|
|
|
163
166
|
// 序列化消息内容
|
|
164
167
|
yield* sequenceMessageContent(message, context, config);
|
|
165
168
|
// 发送finish_reason事件(若未提供则根据消息推断)
|
|
166
|
-
yield buildFinishEvent(choice.finish_reason || (message?.tool_calls ? 'tool_calls' : 'stop'), context, config);
|
|
169
|
+
yield buildFinishEvent(choice.finish_reason || (message?.tool_calls ? 'tool_calls' : 'stop'), context, config, response.usage);
|
|
167
170
|
// 发送done事件
|
|
168
171
|
yield buildDoneEvent(context, config);
|
|
169
172
|
}
|
|
@@ -1,4 +1,23 @@
|
|
|
1
1
|
import { PassThrough } from 'node:stream';
|
|
2
|
+
function formatUnknownError(error) {
|
|
3
|
+
if (error instanceof Error) {
|
|
4
|
+
return error.stack || `${error.name}: ${error.message}`;
|
|
5
|
+
}
|
|
6
|
+
try {
|
|
7
|
+
return JSON.stringify(error);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return String(error);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function logChatSerializerNonBlocking(stage, error) {
|
|
14
|
+
try {
|
|
15
|
+
console.warn(`[chat-serializer] ${stage} failed (non-blocking): ${formatUnknownError(error)}`);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
// Never throw from non-blocking logging.
|
|
19
|
+
}
|
|
20
|
+
}
|
|
2
21
|
// Serialize an internal ChatSseEvent (object-mode) to SSE wire frames
|
|
3
22
|
export function serializeChatEventToSSE(evt) {
|
|
4
23
|
const lines = [];
|
|
@@ -22,18 +41,23 @@ export function toSSETextStream(objectEventStream) {
|
|
|
22
41
|
await new Promise(r => out.once('drain', r));
|
|
23
42
|
}
|
|
24
43
|
}
|
|
25
|
-
catch {
|
|
44
|
+
catch (error) {
|
|
26
45
|
// emit minimal error frame, then close
|
|
46
|
+
logChatSerializerNonBlocking('stream.serialize', error);
|
|
27
47
|
try {
|
|
28
48
|
out.write('data: {"error":"chat sse serialization failed"}\n\n');
|
|
29
49
|
}
|
|
30
|
-
catch {
|
|
50
|
+
catch (writeError) {
|
|
51
|
+
logChatSerializerNonBlocking('stream.write_error_frame', writeError);
|
|
52
|
+
}
|
|
31
53
|
}
|
|
32
54
|
finally {
|
|
33
55
|
try {
|
|
34
56
|
out.end();
|
|
35
57
|
}
|
|
36
|
-
catch {
|
|
58
|
+
catch (endError) {
|
|
59
|
+
logChatSerializerNonBlocking('stream.end', endError);
|
|
60
|
+
}
|
|
37
61
|
}
|
|
38
62
|
})();
|
|
39
63
|
return out;
|
|
@@ -11,12 +11,12 @@ export declare const CONVERSION_DIRECTIONS: {
|
|
|
11
11
|
readonly SSE_TO_JSON: "sse_to_json";
|
|
12
12
|
};
|
|
13
13
|
export declare const TIMEOUT_CONSTANTS: {
|
|
14
|
-
readonly DEFAULT_TIMEOUT_MS:
|
|
14
|
+
readonly DEFAULT_TIMEOUT_MS: 900000;
|
|
15
15
|
readonly HEARTBEAT_INTERVAL_MS: 15000;
|
|
16
|
-
readonly INACTIVITY_TIMEOUT_MS:
|
|
16
|
+
readonly INACTIVITY_TIMEOUT_MS: 900000;
|
|
17
17
|
readonly EVENT_PROCESSING_TIMEOUT_MS: 5000;
|
|
18
18
|
readonly CHUNK_TIMEOUT_MS: 10000;
|
|
19
|
-
readonly TOTAL_TIMEOUT_MS:
|
|
19
|
+
readonly TOTAL_TIMEOUT_MS: 900000;
|
|
20
20
|
};
|
|
21
21
|
export declare const CHUNK_CONSTANTS: {
|
|
22
22
|
readonly DEFAULT_CHUNK_SIZE: 12;
|
|
@@ -143,14 +143,14 @@ export declare const REQUIRED_ACTION_TYPES: {
|
|
|
143
143
|
readonly RUN_PARALLEL_TOOLS: "run_parallel_tools";
|
|
144
144
|
};
|
|
145
145
|
export declare const DEFAULT_CONFIG: {
|
|
146
|
-
readonly TIMEOUT_MS:
|
|
146
|
+
readonly TIMEOUT_MS: 900000;
|
|
147
147
|
readonly HEARTBEAT_INTERVAL_MS: 15000;
|
|
148
148
|
readonly CHUNK_SIZE: 12;
|
|
149
149
|
readonly DELAY_MS: 8;
|
|
150
150
|
readonly VALIDATION_MODE: "basic";
|
|
151
151
|
readonly DEBUG_MODE: false;
|
|
152
152
|
readonly CHAT: {
|
|
153
|
-
readonly TIMEOUT_MS:
|
|
153
|
+
readonly TIMEOUT_MS: 900000;
|
|
154
154
|
readonly HEARTBEAT_INTERVAL_MS: 15000;
|
|
155
155
|
readonly CHUNK_DELAY_MS: 10;
|
|
156
156
|
readonly MAX_TOKENS_PER_CHUNK: 100;
|
|
@@ -161,7 +161,7 @@ export declare const DEFAULT_CONFIG: {
|
|
|
161
161
|
readonly MAX_CONCURRENT_TOOL_CALLS: 50;
|
|
162
162
|
};
|
|
163
163
|
readonly RESPONSES: {
|
|
164
|
-
readonly TIMEOUT_MS:
|
|
164
|
+
readonly TIMEOUT_MS: 900000;
|
|
165
165
|
readonly HEARTBEAT_INTERVAL_MS: 15000;
|
|
166
166
|
readonly REASONING_CHUNK_SIZE: 24;
|
|
167
167
|
readonly TEXT_CHUNK_SIZE: 12;
|