@fudrouter/fsrouter 0.6.72 → 0.6.74
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/dist/lib/headroom/detect.js +97 -7
- package/dist/lib/headroom/process.js +136 -4
- package/dist/open-sse/config/appConstants.js +23 -79
- package/dist/open-sse/config/cliFingerprints.js +1 -1
- package/dist/open-sse/config/errorConfig.js +0 -11
- package/dist/open-sse/config/grokCli.js +10 -0
- package/dist/open-sse/config/kiroConstants.js +99 -46
- package/dist/open-sse/config/runtimeConfig.js +2 -0
- package/dist/open-sse/config/ttsModels.js +2 -0
- package/dist/open-sse/executors/antigravity.js +250 -164
- package/dist/open-sse/executors/base.js +16 -11
- package/dist/open-sse/executors/codex.js +269 -1108
- package/dist/open-sse/executors/commandCode.js +1 -1
- package/dist/open-sse/executors/commandcode.js +10 -4
- package/dist/open-sse/executors/cursor.js +96 -203
- package/dist/open-sse/executors/default.js +146 -244
- package/dist/open-sse/executors/github.js +128 -73
- package/dist/open-sse/executors/grok-cli.js +527 -94
- package/dist/open-sse/executors/grok-web.js +5 -7
- package/dist/open-sse/executors/index.js +12 -0
- package/dist/open-sse/executors/kiro.js +150 -61
- package/dist/open-sse/executors/opencode-go.js +12 -4
- package/dist/open-sse/executors/opencode.js +1 -1
- package/dist/open-sse/executors/perplexity-web.js +20 -96
- package/dist/open-sse/executors/qoder.js +28 -18
- package/dist/open-sse/executors/vertex.js +53 -7
- package/dist/open-sse/executors/xiaomi-tokenplan.js +6 -5
- package/dist/open-sse/handlers/chatCore/nonStreamingHandler.js +97 -85
- package/dist/open-sse/handlers/chatCore/requestDetail.js +32 -8
- package/dist/open-sse/handlers/chatCore/sseToJsonHandler.js +13 -7
- package/dist/open-sse/handlers/chatCore/streamingHandler.js +74 -25
- package/dist/open-sse/handlers/chatCore.js +35 -41
- package/dist/open-sse/handlers/embeddingProviders/index.js +1 -0
- package/dist/open-sse/handlers/embeddingProviders/openai.js +8 -16
- package/dist/open-sse/handlers/imageProviders/blackForestLabs.js +2 -21
- package/dist/open-sse/handlers/imageProviders/cloudflareAi.js +2 -30
- package/dist/open-sse/handlers/imageProviders/codex.js +2 -20
- package/dist/open-sse/handlers/imageProviders/comfyui.js +5 -18
- package/dist/open-sse/handlers/imageProviders/falAi.js +2 -22
- package/dist/open-sse/handlers/imageProviders/gemini.js +2 -16
- package/dist/open-sse/handlers/imageProviders/huggingface.js +2 -17
- package/dist/open-sse/handlers/imageProviders/index.js +3 -4
- package/dist/open-sse/handlers/imageProviders/leonardo.js +1 -1
- package/dist/open-sse/handlers/imageProviders/nanobanana.js +4 -23
- package/dist/open-sse/handlers/imageProviders/openai.js +15 -43
- package/dist/open-sse/handlers/imageProviders/runwayml.js +2 -26
- package/dist/open-sse/handlers/imageProviders/sdwebui.js +4 -20
- package/dist/open-sse/handlers/imageProviders/stabilityAi.js +2 -26
- package/dist/open-sse/handlers/imageProviders/weavy.js +1 -1
- package/dist/open-sse/handlers/search/chatSearch.js +60 -14
- package/dist/open-sse/handlers/ttsProviders/gemini.js +14 -3
- package/dist/open-sse/handlers/ttsProviders/index.js +4 -2
- package/dist/open-sse/handlers/ttsProviders/openai.js +4 -1
- package/dist/open-sse/handlers/ttsProviders/openrouter.js +7 -4
- package/dist/open-sse/handlers/videoCore.js +166 -0
- package/dist/open-sse/handlers/videoProviders/weavy.js +1 -1
- package/dist/open-sse/mcp-server/catalog.js +1 -1
- package/dist/open-sse/mcp-server/server.js +2 -2
- package/dist/open-sse/mcp-server/tools/advancedTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/agentSkillTools.js +1 -1
- package/dist/open-sse/mcp-server/tools/compressionTools.js +4 -4
- package/dist/open-sse/mcp-server/tools/gamificationTools.js +10 -10
- package/dist/open-sse/mcp-server/tools/githubSkillTools.js +1 -1
- package/dist/open-sse/mcp-server/tools/memoryTools.js +3 -3
- package/dist/open-sse/mcp-server/tools/notionTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/obsidianTools.js +2 -2
- package/dist/open-sse/mcp-server/tools/pickFastestModel.js +1 -1
- package/dist/open-sse/mcp-server/tools/pluginTools.js +4 -4
- package/dist/open-sse/mcp-server/tools/skillTools.js +2 -2
- package/dist/open-sse/providers/capabilities.js +24 -4
- package/dist/open-sse/providers/registry/alicode-intl.js +1 -1
- package/dist/open-sse/providers/registry/anthropic.js +1 -8
- package/dist/open-sse/providers/registry/codex.js +0 -9
- package/dist/open-sse/providers/registry/cohere.js +0 -2
- package/dist/open-sse/providers/registry/gemini.js +0 -2
- package/dist/open-sse/providers/registry/github.js +9 -6
- package/dist/open-sse/providers/registry/grok-cli.js +28 -18
- package/dist/open-sse/providers/registry/index.js +74 -80
- package/dist/open-sse/providers/registry/kiro.js +12 -0
- package/dist/open-sse/providers/registry/mistral.js +0 -3
- package/dist/open-sse/providers/registry/openai.js +0 -3
- package/dist/open-sse/providers/registry/perplexity.js +0 -2
- package/dist/open-sse/providers/registry/xai.js +5 -3
- package/dist/open-sse/rtk/autodetect.js +10 -2
- package/dist/open-sse/rtk/caveman.js +2 -93
- package/dist/open-sse/rtk/cavemanPrompts.js +34 -2
- package/dist/open-sse/rtk/constants.js +7 -2
- package/dist/open-sse/rtk/headroom.js +133 -0
- package/dist/open-sse/rtk/ponytail.js +1 -1
- package/dist/open-sse/rtk/registry.js +2 -0
- package/dist/open-sse/services/accountFallback.js +0 -108
- package/dist/open-sse/services/combo/quotaExhaustionCutoff.js +2 -2
- package/dist/open-sse/services/combo/quotaShareStrategy.js +1 -1
- package/dist/open-sse/services/combo/resolveAutoStrategy.js +1 -1
- package/dist/open-sse/services/combo/sessionStickiness.js +1 -1
- package/dist/open-sse/services/combo/targetSorters.js +2 -2
- package/dist/open-sse/services/combo/validateQuality.js +1 -1
- package/dist/open-sse/services/comboConfig.js +1 -1
- package/dist/open-sse/services/emergencyFallback.js +1 -1
- package/dist/open-sse/services/grokCliModels.js +127 -0
- package/dist/open-sse/services/model.js +7 -1
- package/dist/open-sse/services/provider.js +1 -1
- package/dist/open-sse/services/proxyAutoSelector.js +1 -1
- package/dist/open-sse/services/tokenRefresh/providers.js +3 -3
- package/dist/open-sse/services/usage/codex.js +148 -214
- package/dist/open-sse/services/usage/grok-cli.js +61 -7
- package/dist/open-sse/services/usage/misc.js +0 -19
- package/dist/open-sse/services/usage.js +0 -2
- package/dist/open-sse/translator/concerns/paramSupport.js +2 -2
- package/dist/open-sse/translator/concerns/thinkingUnified.js +6 -0
- package/dist/open-sse/translator/index.js +97 -59
- package/dist/open-sse/translator/request/claude-to-kiro.js +67 -40
- package/dist/open-sse/translator/request/openai-responses.js +1 -0
- package/dist/open-sse/translator/request/openai-to-commandcode.js +0 -4
- package/dist/open-sse/translator/request/openai-to-kiro.js +49 -20
- package/dist/open-sse/translator/response/commandcode-to-openai.js +0 -4
- package/dist/open-sse/utils/bypassHandler.js +18 -3
- package/dist/open-sse/utils/claudeCloaking.js +15 -5
- package/dist/open-sse/utils/cursorImages.js +1 -1
- package/dist/open-sse/utils/error.js +0 -17
- package/dist/open-sse/utils/keepaliveThreshold.js +4 -4
- package/dist/open-sse/utils/kiroSessionReplay.js +125 -0
- package/dist/open-sse/utils/noThinkingAlias.js +1 -1
- package/dist/open-sse/utils/proxyFetch.js +0 -1
- package/dist/open-sse/utils/reasoningContentInjector.js +4 -7
- package/dist/open-sse/utils/responsesStatePolicy.js +1 -1
- package/dist/open-sse/utils/responsesStreamHelpers.js +1 -0
- package/dist/open-sse/utils/sessionManager.js +49 -22
- package/dist/open-sse/utils/stream.js +54 -77
- package/dist/open-sse/utils/streamHandler.js +19 -15
- package/dist/open-sse/utils/streamHelpers.js +2 -17
- package/dist/open-sse/utils/usageTracking.js +103 -12
- package/dist/routes/headroom/extras/route.js +58 -0
- package/dist/routes/headroom/restart/route.js +33 -0
- package/open-sse/config/appConstants.js +23 -79
- package/open-sse/config/errorConfig.js +0 -11
- package/open-sse/config/grokCli.js +10 -0
- package/open-sse/config/kiroConstants.js +99 -46
- package/open-sse/config/runtimeConfig.js +2 -0
- package/open-sse/config/ttsModels.js +2 -0
- package/open-sse/executors/antigravity.js +250 -164
- package/open-sse/executors/base.js +16 -11
- package/open-sse/executors/codex.js +269 -1108
- package/open-sse/executors/commandcode.js +10 -4
- package/open-sse/executors/cursor.js +96 -203
- package/open-sse/executors/default.js +146 -244
- package/open-sse/executors/github.js +128 -73
- package/open-sse/executors/grok-cli.js +527 -94
- package/open-sse/executors/grok-web.js +5 -7
- package/open-sse/executors/index.js +12 -0
- package/open-sse/executors/kiro.js +150 -61
- package/open-sse/executors/opencode-go.js +12 -4
- package/open-sse/executors/opencode.js +1 -1
- package/open-sse/executors/perplexity-web.js +20 -96
- package/open-sse/executors/qoder.js +28 -18
- package/open-sse/executors/vertex.js +53 -7
- package/open-sse/executors/xiaomi-tokenplan.js +6 -5
- package/open-sse/handlers/chatCore/nonStreamingHandler.js +97 -85
- package/open-sse/handlers/chatCore/requestDetail.js +32 -8
- package/open-sse/handlers/chatCore/sseToJsonHandler.js +13 -7
- package/open-sse/handlers/chatCore/streamingHandler.js +74 -25
- package/open-sse/handlers/chatCore.js +35 -41
- package/open-sse/handlers/embeddingProviders/index.js +1 -0
- package/open-sse/handlers/embeddingProviders/openai.js +8 -16
- package/open-sse/handlers/imageProviders/blackForestLabs.js +2 -21
- package/open-sse/handlers/imageProviders/cloudflareAi.js +2 -30
- package/open-sse/handlers/imageProviders/codex.js +2 -20
- package/open-sse/handlers/imageProviders/comfyui.js +5 -18
- package/open-sse/handlers/imageProviders/falAi.js +2 -22
- package/open-sse/handlers/imageProviders/gemini.js +2 -16
- package/open-sse/handlers/imageProviders/huggingface.js +2 -17
- package/open-sse/handlers/imageProviders/index.js +3 -4
- package/open-sse/handlers/imageProviders/leonardo.js +1 -1
- package/open-sse/handlers/imageProviders/nanobanana.js +4 -23
- package/open-sse/handlers/imageProviders/openai.js +15 -43
- package/open-sse/handlers/imageProviders/runwayml.js +2 -26
- package/open-sse/handlers/imageProviders/sdwebui.js +4 -20
- package/open-sse/handlers/imageProviders/stabilityAi.js +2 -26
- package/open-sse/handlers/imageProviders/weavy.js +1 -1
- package/open-sse/handlers/search/chatSearch.js +60 -14
- package/open-sse/handlers/ttsProviders/gemini.js +14 -3
- package/open-sse/handlers/ttsProviders/index.js +4 -2
- package/open-sse/handlers/ttsProviders/openai.js +4 -1
- package/open-sse/handlers/ttsProviders/openrouter.js +7 -4
- package/open-sse/handlers/videoCore.js +166 -0
- package/open-sse/handlers/videoProviders/weavy.js +1 -1
- package/open-sse/mcp-server/audit.js +1 -1
- package/open-sse/mcp-server/catalog.js +2 -2
- package/open-sse/mcp-server/descriptionCompressor.js +1 -1
- package/open-sse/mcp-server/mcpCallerIdentity.js +1 -1
- package/open-sse/mcp-server/schemas/tools.js +1 -1
- package/open-sse/mcp-server/server.js +4 -4
- package/open-sse/mcp-server/tools/advancedTools.js +5 -5
- package/open-sse/mcp-server/tools/agentSkillTools.js +1 -1
- package/open-sse/mcp-server/tools/compressionTools.js +4 -4
- package/open-sse/mcp-server/tools/gamificationTools.js +10 -10
- package/open-sse/mcp-server/tools/githubSkillTools.js +1 -1
- package/open-sse/mcp-server/tools/memoryTools.js +3 -3
- package/open-sse/mcp-server/tools/notionTools.js +2 -2
- package/open-sse/mcp-server/tools/obsidianTools.js +2 -2
- package/open-sse/mcp-server/tools/pickFastestModel.js +3 -3
- package/open-sse/mcp-server/tools/pluginTools.js +4 -4
- package/open-sse/mcp-server/tools/skillTools.js +2 -2
- package/open-sse/providers/capabilities.js +24 -4
- package/open-sse/providers/registry/alicode-intl.js +1 -1
- package/open-sse/providers/registry/anthropic.js +1 -8
- package/open-sse/providers/registry/codex.js +0 -9
- package/open-sse/providers/registry/cohere.js +0 -2
- package/open-sse/providers/registry/gemini.js +0 -2
- package/open-sse/providers/registry/github.js +9 -6
- package/open-sse/providers/registry/grok-cli.js +28 -18
- package/open-sse/providers/registry/index.js +74 -80
- package/open-sse/providers/registry/kiro.js +12 -0
- package/open-sse/providers/registry/mistral.js +0 -3
- package/open-sse/providers/registry/openai.js +0 -3
- package/open-sse/providers/registry/perplexity.js +0 -2
- package/open-sse/providers/registry/xai.js +5 -3
- package/open-sse/rtk/autodetect.js +10 -2
- package/open-sse/rtk/caveman.js +2 -93
- package/open-sse/rtk/cavemanPrompts.js +34 -2
- package/open-sse/rtk/constants.js +7 -2
- package/open-sse/rtk/headroom.js +133 -0
- package/open-sse/rtk/ponytail.js +1 -1
- package/open-sse/rtk/registry.js +2 -0
- package/open-sse/services/accountFallback.js +0 -108
- package/open-sse/services/combo/quotaExhaustionCutoff.js +2 -2
- package/open-sse/services/combo/quotaShareStrategy.js +1 -1
- package/open-sse/services/combo/resolveAutoStrategy.js +1 -1
- package/open-sse/services/combo/sessionStickiness.js +1 -1
- package/open-sse/services/combo/shadowRouting.js +1 -1
- package/open-sse/services/combo/targetSorters.js +4 -4
- package/open-sse/services/combo/validateQuality.js +1 -1
- package/open-sse/services/evalRouting.js +1 -1
- package/open-sse/services/grokCliModels.js +127 -0
- package/open-sse/services/model.js +7 -1
- package/open-sse/services/modelCapabilities.js +1 -1
- package/open-sse/services/modelFamilyFallback.js +1 -1
- package/open-sse/services/provider.js +1 -1
- package/open-sse/services/providerCooldownTracker.js +1 -1
- package/open-sse/services/rateLimitManager.js +1 -1
- package/open-sse/services/tokenRefresh/providers.js +3 -3
- package/open-sse/services/usage/codex.js +148 -214
- package/open-sse/services/usage/grok-cli.js +61 -7
- package/open-sse/services/usage/misc.js +0 -19
- package/open-sse/services/usage.js +0 -2
- package/open-sse/translator/concerns/paramSupport.js +2 -2
- package/open-sse/translator/concerns/thinkingUnified.js +6 -0
- package/open-sse/translator/index.js +97 -59
- package/open-sse/translator/request/claude-to-kiro.js +67 -40
- package/open-sse/translator/request/openai-responses.js +1 -0
- package/open-sse/translator/request/openai-to-commandcode.js +0 -4
- package/open-sse/translator/request/openai-to-kiro.js +49 -20
- package/open-sse/translator/response/commandcode-to-openai.js +0 -4
- package/open-sse/utils/bypassHandler.js +18 -3
- package/open-sse/utils/claudeCloaking.js +15 -5
- package/open-sse/utils/error.js +0 -17
- package/open-sse/utils/kiroSessionReplay.js +125 -0
- package/open-sse/utils/logger.js +1 -1
- package/open-sse/utils/proxyFetch.js +0 -1
- package/open-sse/utils/reasoningContentInjector.js +4 -7
- package/open-sse/utils/responsesStreamHelpers.js +1 -0
- package/open-sse/utils/sessionManager.js +49 -22
- package/open-sse/utils/stream.js +54 -77
- package/open-sse/utils/streamHandler.js +19 -15
- package/open-sse/utils/streamHelpers.js +2 -17
- package/open-sse/utils/usageTracking.js +103 -12
- package/package.json +4 -7
- package/public/assets/EndpointPageClient.C2WMTYy0.js +6 -0
- package/public/assets/{Loading.Bj-WGl4k.js → Loading.BHPtQ9vj.js} +1 -1
- package/public/assets/{NoAuthProxyCard.qAv57b-0.js → NoAuthProxyCard.BDcXaWvM.js} +1 -1
- package/public/assets/index.Be3gbrBl.js +89 -0
- package/public/assets/index.COMgQZYj.css +1 -0
- package/public/assets/{page.CbkENBd5.js → page.-lpNgYAw.js} +1 -1
- package/public/assets/{page.CssmrzTT.js → page.11hpNKmq.js} +1 -1
- package/public/assets/{page.C72FTTJr.js → page.B-LxsnqU.js} +1 -1
- package/public/assets/{page.sOFOrxqq.js → page.B-dzeIUC.js} +1 -1
- package/public/assets/{page.CsxWmPoI.js → page.B-nBR75u.js} +1 -1
- package/public/assets/{page.Dx_GRRdT.js → page.B3QqvLep.js} +1 -1
- package/public/assets/{page.DPyOkPVo.js → page.B8xdkCWA.js} +1 -1
- package/public/assets/{page.DUI8kqOY.js → page.BFb7yUd8.js} +1 -1
- package/public/assets/page.BbPPdoas.js +1 -0
- package/public/assets/page.BdS20a1O.js +1 -0
- package/public/assets/{page.DibhF7f-.js → page.BfmI9KYe.js} +1 -1
- package/public/assets/{page.DX4Nno6M.js → page.BgGJovOg.js} +1 -1
- package/public/assets/{page.BnmTC5jG.js → page.C0gBvR4O.js} +1 -1
- package/public/assets/{page.D5gj98Oe.js → page.C6bYizL7.js} +1 -1
- package/public/assets/{page.vla5Mzki.js → page.C8sLEMa6.js} +1 -1
- package/public/assets/{page.CXd_R9yU.js → page.CCNsZBXp.js} +1 -1
- package/public/assets/{page.CQlVGoXg.js → page.CF_YSLwP.js} +1 -1
- package/public/assets/{page.BbO1pspY.js → page.CPTtRDxw.js} +1 -1
- package/public/assets/{page.D1oKew1j.js → page.CdMmlUEm.js} +1 -1
- package/public/assets/{page.DxMDTbSx.js → page.Cged1bOZ.js} +1 -1
- package/public/assets/{page.Cj5h09Zo.js → page.Ch647dVk.js} +1 -1
- package/public/assets/{page.DVIHRbxB.js → page.CpvXDkQF.js} +1 -1
- package/public/assets/{page.i4KDuWcM.js → page.CrBl7f8N.js} +1 -1
- package/public/assets/{page.BSLJ4tx5.js → page.CrP7niA2.js} +1 -1
- package/public/assets/{page.CnTop8Zt.js → page.CvUFZzXr.js} +1 -1
- package/public/assets/{page.O2ddJYoT.js → page.CyUqJPmx.js} +1 -1
- package/public/assets/{page.DBhu4Arl.js → page.D8Rp8fFR.js} +1 -1
- package/public/assets/{page.CPZav1_c.js → page.Df9qtrdG.js} +1 -1
- package/public/assets/{page.Qkkv8roc.js → page.DiL4Gwqe.js} +1 -1
- package/public/assets/{page.BdmJ3yY3.js → page.Dl1apZE2.js} +1 -1
- package/public/assets/{page.1qjqvrwX.js → page.HV0w1d5C.js} +1 -1
- package/public/assets/{page.ChX1NqmC.js → page.N1x4YL8_.js} +1 -1
- package/public/assets/{page.Dh5f0XJC.js → page.P2Ny5veR.js} +1 -1
- package/public/assets/{page.CSs3-gdt.js → page.fOOCr18J.js} +1 -1
- package/public/assets/{page.Ir7KvKcF.js → page.sUIPWIiF.js} +1 -1
- package/public/assets/{page.CzlQTyAL.js → page.tE7PpWYW.js} +1 -1
- package/public/assets/{page.DzZLqI5Q.js → page.uziaGZsT.js} +1 -1
- package/public/index.html +2 -2
- package/public/assets/EndpointPageClient.LyNNvZ4z.js +0 -6
- package/public/assets/index.BuPfZebu.css +0 -1
- package/public/assets/index.CShjRV_B.js +0 -89
- package/public/assets/page.DD_czjjP.js +0 -1
|
@@ -1,44 +1,10 @@
|
|
|
1
1
|
import { platform, arch } from "os";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
// === Kimchi CLI version (dynamic, cached from GitHub releases) ===
|
|
5
|
-
const KIMCHI_FALLBACK_VERSION = "0.1.39";
|
|
6
|
-
let _kimchiVersionCache = null;
|
|
7
|
-
let _kimchiVersionFetching = null;
|
|
8
|
-
const KIMCHI_VERSION_TTL_MS = 3600_000; // 1h
|
|
9
|
-
|
|
10
|
-
async function fetchKimchiVersion() {
|
|
11
|
-
try {
|
|
12
|
-
const res = await proxyAwareFetch("https://api.github.com/repos/getkimchi/kimchi/releases/latest", {
|
|
13
|
-
headers: { Accept: "application/vnd.github+json" },
|
|
14
|
-
signal: AbortSignal.timeout(5000),
|
|
15
|
-
});
|
|
16
|
-
if (!res.ok) return KIMCHI_FALLBACK_VERSION;
|
|
17
|
-
const body = await res.json();
|
|
18
|
-
const tag = body?.tag_name || "";
|
|
19
|
-
const ver = tag.replace(/^v/, "");
|
|
20
|
-
return ver || KIMCHI_FALLBACK_VERSION;
|
|
21
|
-
} catch {
|
|
22
|
-
return KIMCHI_FALLBACK_VERSION;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function getKimchiVersion() {
|
|
27
|
-
if (_kimchiVersionCache && Date.now() - _kimchiVersionCache.ts < KIMCHI_VERSION_TTL_MS) return _kimchiVersionCache.ver;
|
|
28
|
-
if (_kimchiVersionFetching) return _kimchiVersionFetching;
|
|
29
|
-
_kimchiVersionFetching = fetchKimchiVersion().finally(() => { _kimchiVersionFetching = null; });
|
|
30
|
-
const ver = await _kimchiVersionFetching;
|
|
31
|
-
_kimchiVersionCache = { ver, ts: Date.now() };
|
|
32
|
-
return ver;
|
|
33
|
-
}
|
|
2
|
+
import { PROVIDERS, PROVIDER_OAUTH } from "./providers.js";
|
|
3
|
+
import { ANTIGRAVITY_IDE_USER_AGENT } from "../providers/shared.js";
|
|
34
4
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
// === Gemini CLI ===
|
|
40
|
-
export const GEMINI_CLI_VERSION = "0.34.0";
|
|
41
|
-
export const GEMINI_CLI_API_CLIENT = "google-genai-sdk/1.41.0 gl-node/v22.19.0";
|
|
5
|
+
// === Gemini CLI === derive từ registry gemini-cli.transport
|
|
6
|
+
export const GEMINI_CLI_VERSION = PROVIDERS["gemini-cli"]?.cliVersion;
|
|
7
|
+
export const GEMINI_CLI_API_CLIENT = PROVIDERS["gemini-cli"]?.apiClient;
|
|
42
8
|
|
|
43
9
|
// Map Node arch to Gemini CLI arch string (x64/x86/arm64/...)
|
|
44
10
|
function geminiCLIArch() {
|
|
@@ -52,11 +18,13 @@ export function geminiCLIUserAgent(model = "unknown") {
|
|
|
52
18
|
}
|
|
53
19
|
|
|
54
20
|
// === GitHub Copilot ===
|
|
21
|
+
// Derive từ registry github.transport.copilot
|
|
22
|
+
const _ghCopilot = PROVIDERS.github?.copilot || {};
|
|
55
23
|
export const GITHUB_COPILOT = {
|
|
56
|
-
VSCODE_VERSION:
|
|
57
|
-
COPILOT_CHAT_VERSION:
|
|
58
|
-
USER_AGENT:
|
|
59
|
-
API_VERSION:
|
|
24
|
+
VSCODE_VERSION: _ghCopilot.vscodeVersion,
|
|
25
|
+
COPILOT_CHAT_VERSION: _ghCopilot.chatVersion,
|
|
26
|
+
USER_AGENT: _ghCopilot.userAgent,
|
|
27
|
+
API_VERSION: _ghCopilot.apiVersion,
|
|
60
28
|
};
|
|
61
29
|
|
|
62
30
|
// === Antigravity enums ===
|
|
@@ -92,7 +60,7 @@ export function getPlatformEnum() {
|
|
|
92
60
|
}
|
|
93
61
|
|
|
94
62
|
export function getPlatformUserAgent() {
|
|
95
|
-
return
|
|
63
|
+
return ANTIGRAVITY_IDE_USER_AGENT;
|
|
96
64
|
}
|
|
97
65
|
|
|
98
66
|
export const CLIENT_METADATA = {
|
|
@@ -162,7 +130,7 @@ export const AG_DEFAULT_TOOLS = new Set([
|
|
|
162
130
|
|
|
163
131
|
// Antigravity chat/stream headers
|
|
164
132
|
export const ANTIGRAVITY_HEADERS = {
|
|
165
|
-
"User-Agent":
|
|
133
|
+
"User-Agent": ANTIGRAVITY_IDE_USER_AGENT
|
|
166
134
|
};
|
|
167
135
|
|
|
168
136
|
// Cloud Code Assist API
|
|
@@ -188,43 +156,19 @@ export const LOAD_CODE_ASSIST_METADATA = {
|
|
|
188
156
|
export const CLAUDE_SYSTEM_PROMPT = "You are Claude Code, Anthropic's official CLI for Claude.";
|
|
189
157
|
export const ANTIGRAVITY_DEFAULT_SYSTEM = "You are Antigravity, a powerful agentic AI coding assistant designed by the Google Deepmind team working on Advanced Agentic Coding.You are pair programming with a USER to solve their coding task. The task may require creating a new codebase, modifying or debugging an existing codebase, or simply answering a question.**Absolute paths only****Proactiveness**";
|
|
190
158
|
|
|
191
|
-
//
|
|
192
|
-
export const REFRESH_LEAD_MS =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
iflow: 24 * 60 * 60 * 1000, // 24 hours
|
|
196
|
-
qwen: 20 * 60 * 1000, // 20 minutes
|
|
197
|
-
"kimi-coding": 5 * 60 * 1000, // 5 minutes
|
|
198
|
-
antigravity: 5 * 60 * 1000, // 5 minutes
|
|
199
|
-
};
|
|
159
|
+
// Derive từ registry oauth.refreshLeadMs
|
|
160
|
+
export const REFRESH_LEAD_MS = Object.fromEntries(
|
|
161
|
+
Object.entries(PROVIDER_OAUTH).filter(([, o]) => o.refreshLeadMs).map(([id, o]) => [id, o.refreshLeadMs])
|
|
162
|
+
);
|
|
200
163
|
|
|
201
164
|
// OAuth endpoints
|
|
202
165
|
export const OAUTH_ENDPOINTS = {
|
|
203
|
-
google:
|
|
204
|
-
token: "
|
|
205
|
-
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
token: "
|
|
209
|
-
auth: "https://auth.openai.com/oauth/authorize"
|
|
210
|
-
},
|
|
211
|
-
anthropic: {
|
|
212
|
-
token: "https://api.anthropic.com/v1/oauth/token",
|
|
213
|
-
auth: "https://api.anthropic.com/v1/oauth/authorize"
|
|
214
|
-
},
|
|
215
|
-
qwen: {
|
|
216
|
-
token: "https://qwen.ai/api/v1/oauth2/token",
|
|
217
|
-
auth: "https://qwen.ai/api/v1/oauth2/device/code"
|
|
218
|
-
},
|
|
219
|
-
iflow: {
|
|
220
|
-
token: "https://iflow.cn/oauth/token",
|
|
221
|
-
auth: "https://iflow.cn/oauth"
|
|
222
|
-
},
|
|
223
|
-
github: {
|
|
224
|
-
token: "https://github.com/login/oauth/access_token",
|
|
225
|
-
auth: "https://github.com/login/oauth/authorize",
|
|
226
|
-
deviceCode: "https://github.com/login/device/code"
|
|
227
|
-
}
|
|
166
|
+
google: { token: "https://oauth2.googleapis.com/token", auth: "https://accounts.google.com/o/oauth2/auth" },
|
|
167
|
+
openai: { token: PROVIDER_OAUTH["codex"]?.tokenUrl, auth: PROVIDER_OAUTH["codex"]?.authorizeUrl },
|
|
168
|
+
anthropic: { token: PROVIDER_OAUTH["claude"]?.tokenUrl, auth: "https://api.anthropic.com/v1/oauth/authorize" }, // ≠ claude.authorizeUrl (claude.ai login) — keep
|
|
169
|
+
qwen: { token: PROVIDER_OAUTH["qwen"]?.tokenUrl, auth: PROVIDER_OAUTH["qwen"]?.deviceCodeUrl },
|
|
170
|
+
iflow: { token: PROVIDER_OAUTH["iflow"]?.tokenUrl, auth: PROVIDER_OAUTH["iflow"]?.authorizeUrl },
|
|
171
|
+
github: { token: PROVIDER_OAUTH["github"]?.tokenUrl, auth: PROVIDER_OAUTH["github"]?.authorizeUrl, deviceCode: PROVIDER_OAUTH["github"]?.deviceCodeUrl },
|
|
228
172
|
};
|
|
229
173
|
|
|
230
174
|
// Generate Kimi OAuth custom headers
|
|
@@ -45,7 +45,6 @@ export const MAX_RATE_LIMIT_COOLDOWN_MS = 30 * 60 * 1000;
|
|
|
45
45
|
const COOLDOWN = {
|
|
46
46
|
long: 2 * 60 * 1000,
|
|
47
47
|
short: 5 * 1000,
|
|
48
|
-
exhausted: 24 * 60 * 60 * 1000, // 24 hours
|
|
49
48
|
};
|
|
50
49
|
|
|
51
50
|
/**
|
|
@@ -59,16 +58,6 @@ const COOLDOWN = {
|
|
|
59
58
|
*/
|
|
60
59
|
export const ERROR_RULES = [
|
|
61
60
|
// --- Text-based rules (checked first, order = priority) ---
|
|
62
|
-
{ text: "exhausted", cooldownMs: COOLDOWN.exhausted },
|
|
63
|
-
{ text: "insufficient credits", cooldownMs: COOLDOWN.exhausted },
|
|
64
|
-
{ text: "1076", cooldownMs: COOLDOWN.exhausted },
|
|
65
|
-
{ text: "only available on paid plans", cooldownMs: COOLDOWN.exhausted },
|
|
66
|
-
{ text: "failed to capture weavy firebase id token", cooldownMs: COOLDOWN.exhausted },
|
|
67
|
-
{ text: "trial version is not yet", cooldownMs: COOLDOWN.exhausted },
|
|
68
|
-
{ text: "neurons", cooldownMs: COOLDOWN.exhausted }, // CF Workers AI daily quota
|
|
69
|
-
{ text: "daily free allocation", cooldownMs: COOLDOWN.exhausted }, // CF Workers AI daily quota
|
|
70
|
-
{ text: "upgrade to cloudflare", cooldownMs: COOLDOWN.exhausted }, // CF Workers AI paid plan prompt
|
|
71
|
-
{ text: "4006", cooldownMs: COOLDOWN.exhausted }, // CF Workers AI error code
|
|
72
61
|
{ text: "no credentials", cooldownMs: COOLDOWN.long },
|
|
73
62
|
{ text: "request not allowed", cooldownMs: COOLDOWN.short },
|
|
74
63
|
{ text: "improperly formed request", cooldownMs: COOLDOWN.long },
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const GROK_CLI_VERSION = "0.2.99";
|
|
2
|
+
export const GROK_CLI_MODEL = "grok-build";
|
|
3
|
+
export const GROK_CLI_BASE_URL = "https://cli-chat-proxy.grok.com/v1";
|
|
4
|
+
export const GROK_CLI_CLIENT_IDENTIFIER = "grok-shell";
|
|
5
|
+
export const GROK_CLI_USER_AGENT = `grok-shell/${GROK_CLI_VERSION} (linux; x86_64)`;
|
|
6
|
+
|
|
7
|
+
export function supportsGrokCliReasoningEffort(model) {
|
|
8
|
+
// ponytail: unknown models omit effort until live metadata reaches dispatch.
|
|
9
|
+
return /^grok-4\.5(?:$|-)/.test(String(model || ""));
|
|
10
|
+
}
|
|
@@ -15,9 +15,29 @@
|
|
|
15
15
|
* fiction. The suffix is stripped before the request leaves this process.
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
+
import { extractThinking } from "../translator/concerns/thinkingUnified.js";
|
|
19
|
+
import { effortToBudget } from "../translator/concerns/thinking.js";
|
|
20
|
+
|
|
18
21
|
export const KIRO_AGENTIC_SUFFIX = "-agentic";
|
|
19
22
|
export const KIRO_THINKING_SUFFIX = "-thinking";
|
|
20
23
|
|
|
24
|
+
// Public default CodeWhisperer profile ARNs (us-east-1), keyed by auth method.
|
|
25
|
+
// Used when an account cannot resolve its own profileArn. Builder ID and social
|
|
26
|
+
// (Google/GitHub) sign-ins map to different shared profiles.
|
|
27
|
+
export const KIRO_DEFAULT_PROFILE_ARNS = {
|
|
28
|
+
"builder-id": "arn:aws:codewhisperer:us-east-1:638616132270:profile/AAAACCCCXXXX",
|
|
29
|
+
social: "arn:aws:codewhisperer:us-east-1:699475941385:profile/EHGA3GRVQMUK",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Back-compat single default (Builder ID).
|
|
33
|
+
export const KIRO_DEFAULT_PROFILE_ARN = KIRO_DEFAULT_PROFILE_ARNS["builder-id"];
|
|
34
|
+
|
|
35
|
+
/** Resolve the shared default profileArn for a given auth method. */
|
|
36
|
+
export function resolveDefaultProfileArn(authMethod) {
|
|
37
|
+
const social = authMethod === "google" || authMethod === "github";
|
|
38
|
+
return social ? KIRO_DEFAULT_PROFILE_ARNS.social : KIRO_DEFAULT_PROFILE_ARNS["builder-id"];
|
|
39
|
+
}
|
|
40
|
+
|
|
21
41
|
export const KIRO_THINKING_BUDGET_DEFAULT = 16000;
|
|
22
42
|
|
|
23
43
|
export const KIRO_AGENTIC_SYSTEM_PROMPT = `
|
|
@@ -72,61 +92,100 @@ REMEMBER: When in doubt, write LESS per operation. Multiple small operations > o
|
|
|
72
92
|
`.trim();
|
|
73
93
|
|
|
74
94
|
/**
|
|
75
|
-
*
|
|
95
|
+
* Resolve the Kiro thinking budget requested by a client.
|
|
76
96
|
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* - System prompt contains `<thinking_mode>enabled</thinking_mode>` or
|
|
83
|
-
* `<thinking_mode>interleaved</thinking_mode>` (AMP / Cursor)
|
|
84
|
-
* - Model name contains `thinking` or `-reason`
|
|
97
|
+
* Reuses the shared thinkingUnified parser (extractThinking) so every client
|
|
98
|
+
* shape (Claude output_config.effort / thinking.budget_tokens, OpenAI
|
|
99
|
+
* reasoning_effort / reasoning.effort, Gemini, Qwen) maps consistently. Explicit
|
|
100
|
+
* `none`/`off`/disabled wins and returns null (no prefix injected).
|
|
101
|
+
* buildThinkingSystemPrefix performs Kiro's final 1..32000 clamp.
|
|
85
102
|
*
|
|
86
|
-
* @param {object} body OpenAI-shaped request body
|
|
103
|
+
* @param {object} body OpenAI/Claude-shaped request body
|
|
87
104
|
* @param {object} [headers] Original inbound HTTP headers (case-insensitive)
|
|
88
|
-
* @param {string} [model] Model id the caller asked for
|
|
89
|
-
* @returns {
|
|
105
|
+
* @param {string} [model] Model id the caller asked for
|
|
106
|
+
* @returns {number|null} budget to inject, or null when thinking is disabled
|
|
90
107
|
*/
|
|
91
|
-
export function
|
|
108
|
+
export function resolveKiroThinkingBudget(body, headers, model) {
|
|
109
|
+
const cfg = extractThinking(body);
|
|
110
|
+
if (cfg) {
|
|
111
|
+
if (cfg.mode === "none") return null;
|
|
112
|
+
if (cfg.mode === "budget") return cfg.budget;
|
|
113
|
+
if (cfg.mode === "level") return effortToBudget(cfg.level) ?? KIRO_THINKING_BUDGET_DEFAULT;
|
|
114
|
+
return KIRO_THINKING_BUDGET_DEFAULT;
|
|
115
|
+
}
|
|
116
|
+
|
|
92
117
|
if (headers) {
|
|
93
118
|
const beta = pickHeader(headers, "anthropic-beta");
|
|
94
119
|
if (typeof beta === "string" && beta.toLowerCase().includes("interleaved-thinking")) {
|
|
95
|
-
return
|
|
120
|
+
return KIRO_THINKING_BUDGET_DEFAULT;
|
|
96
121
|
}
|
|
97
122
|
}
|
|
98
123
|
|
|
99
|
-
if (body
|
|
100
|
-
const thinking = body.thinking;
|
|
101
|
-
if (thinking && typeof thinking === "object" && thinking.type === "enabled") {
|
|
102
|
-
const budget = Number(thinking.budget_tokens);
|
|
103
|
-
if (!Number.isFinite(budget) || budget > 0) {
|
|
104
|
-
return true;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const effort = body.reasoning_effort
|
|
109
|
-
?? (body.reasoning && typeof body.reasoning === "object" ? body.reasoning.effort : null);
|
|
110
|
-
if (typeof effort === "string") {
|
|
111
|
-
const v = effort.toLowerCase();
|
|
112
|
-
if (v && v !== "none" && (v === "low" || v === "medium" || v === "high" || v === "auto")) {
|
|
113
|
-
return true;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (containsThinkingModeTag(body)) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
124
|
+
if (containsThinkingModeTag(body)) return KIRO_THINKING_BUDGET_DEFAULT;
|
|
121
125
|
|
|
122
126
|
if (typeof model === "string" && model) {
|
|
123
127
|
const m = model.toLowerCase();
|
|
124
|
-
if (m.includes("thinking") || m.includes("-reason"))
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
128
|
+
if (m.includes("thinking") || m.includes("-reason")) return KIRO_THINKING_BUDGET_DEFAULT;
|
|
127
129
|
}
|
|
128
130
|
|
|
129
|
-
return
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function extractKiroEffortLevel(body) {
|
|
135
|
+
const effort =
|
|
136
|
+
body?.output_config?.effort ??
|
|
137
|
+
body?.reasoning_effort ??
|
|
138
|
+
(typeof body?.reasoning === "object" ? body.reasoning?.effort : null);
|
|
139
|
+
if (typeof effort !== "string") return null;
|
|
140
|
+
const normalized = effort.toLowerCase();
|
|
141
|
+
if (normalized === "none" || normalized === "off" || normalized === "disabled") return null;
|
|
142
|
+
if (normalized === "xhigh" || normalized === "max") return "high";
|
|
143
|
+
if (["low", "medium", "high"].includes(normalized)) return normalized;
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export function buildKiroAdditionalModelRequestFields(body) {
|
|
148
|
+
const effort = extractKiroEffortLevel(body);
|
|
149
|
+
if (!effort) return undefined;
|
|
150
|
+
// Mirrors Kiro CLI/KAS buildEffortRequestFields("output_config").
|
|
151
|
+
return {
|
|
152
|
+
thinking: { type: "adaptive", display: "summarized" },
|
|
153
|
+
output_config: { effort },
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function supportsKiroAdditionalModelRequestFields(model) {
|
|
158
|
+
if (typeof model !== "string") return false;
|
|
159
|
+
const normalized = model.toLowerCase().replace(/-/g, ".");
|
|
160
|
+
if (!normalized.includes("claude")) return false;
|
|
161
|
+
const match = normalized.match(/(?:^|[/.])claude(?:[/.][a-z]+)*[/.](\d+)(?:[/.](\d+))?(?:[/.]|$)/);
|
|
162
|
+
if (!match) return false;
|
|
163
|
+
const [, majorText, minorText] = match;
|
|
164
|
+
const major = Number(majorText);
|
|
165
|
+
const minor = minorText === undefined ? null : Number(minorText);
|
|
166
|
+
const dateSuffixMinor = minor !== null && minor >= 1000;
|
|
167
|
+
// Kiro rejected additionalModelRequestFields on legacy 4.5 models in live smoke.
|
|
168
|
+
// Default future Claude/Kiro models to supported so new model releases do not
|
|
169
|
+
// need a code allowlist update.
|
|
170
|
+
return !(major < 4 || (major === 4 && (minor === null || minor <= 5 || dateSuffixMinor)));
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export function buildKiroAdditionalModelRequestFieldsForModel(body, model) {
|
|
174
|
+
if (!supportsKiroAdditionalModelRequestFields(model)) return undefined;
|
|
175
|
+
return buildKiroAdditionalModelRequestFields(body);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Detect whether an inbound request is asking for reasoning / thinking output.
|
|
180
|
+
* Thin wrapper over resolveKiroThinkingBudget (single source of truth).
|
|
181
|
+
*
|
|
182
|
+
* @param {object} body OpenAI-shaped request body (post-translation)
|
|
183
|
+
* @param {object} [headers] Original inbound HTTP headers (case-insensitive)
|
|
184
|
+
* @param {string} [model] Model id the caller asked for (post-strip ok)
|
|
185
|
+
* @returns {boolean}
|
|
186
|
+
*/
|
|
187
|
+
export function isThinkingEnabled(body, headers, model) {
|
|
188
|
+
return resolveKiroThinkingBudget(body, headers, model) !== null;
|
|
130
189
|
}
|
|
131
190
|
|
|
132
191
|
/**
|
|
@@ -260,9 +319,3 @@ function containsTagInText(text) {
|
|
|
260
319
|
return text.includes("<thinking_mode>enabled</thinking_mode>")
|
|
261
320
|
|| text.includes("<thinking_mode>interleaved</thinking_mode>");
|
|
262
321
|
}
|
|
263
|
-
|
|
264
|
-
// Added from 9router - missing exports
|
|
265
|
-
export function resolveDefaultProfileArn(authMethod) {
|
|
266
|
-
const social = authMethod === "google" || authMethod === "github";
|
|
267
|
-
return social ? KIRO_DEFAULT_PROFILE_ARNS.social : KIRO_DEFAULT_PROFILE_ARNS["builder-id"];
|
|
268
|
-
}
|
|
@@ -65,6 +65,8 @@ export const GEMINI_NATIVE_TTS_FETCH_TIMEOUT_MS = envMs("GEMINI_NATIVE_TTS_FETCH
|
|
|
65
65
|
export const DEFAULT_MAX_TOKENS = 64000;
|
|
66
66
|
export const DEFAULT_MIN_TOKENS = 32000;
|
|
67
67
|
|
|
68
|
+
export const TOKEN_SAVER_HEADER = "x-9router-token-saver";
|
|
69
|
+
|
|
68
70
|
// Retry config for 429 responses (legacy - kept for backward compatibility)
|
|
69
71
|
export const RETRY_CONFIG = {
|
|
70
72
|
maxAttempts: 2,
|
|
@@ -96,10 +96,12 @@ export const TTS_MODELS_CONFIG = {
|
|
|
96
96
|
},
|
|
97
97
|
gemini: {
|
|
98
98
|
models: [
|
|
99
|
+
{ id: "gemini-3.1-flash-tts-preview", name: "Gemini 3.1 Flash TTS", type: "tts" },
|
|
99
100
|
{ id: "gemini-2.5-flash-preview-tts", name: "Gemini 2.5 Flash TTS", type: "tts" },
|
|
100
101
|
{ id: "gemini-2.5-pro-preview-tts", name: "Gemini 2.5 Pro TTS", type: "tts" },
|
|
101
102
|
],
|
|
102
103
|
voices: {
|
|
104
|
+
"gemini-3.1-flash-tts-preview": GEMINI_VOICES,
|
|
103
105
|
"gemini-2.5-flash-preview-tts": GEMINI_VOICES,
|
|
104
106
|
"gemini-2.5-pro-preview-tts": GEMINI_VOICES,
|
|
105
107
|
},
|