cartethyia 2.8.0 → 2.8.1
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/.env.example +3 -3
- package/dist/dashboard/assets/{BannedPage-Cc0vKpMG.js → BannedPage-Dq530awD.js} +1 -1
- package/dist/dashboard/assets/BannedPage-Dq530awD.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolDetailPage-Bqj2aa1T.js → CliToolDetailPage-DZzaS-7S.js} +1 -1
- package/dist/dashboard/assets/CliToolDetailPage-DZzaS-7S.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolsPage-CXsaOAO2.js → CliToolsPage-DaZZ3cqP.js} +1 -1
- package/dist/dashboard/assets/CliToolsPage-DaZZ3cqP.js.gz +0 -0
- package/dist/dashboard/assets/{CombosPage-BeLpJ4ma.js → CombosPage-BlC_xdkX.js} +1 -1
- package/dist/dashboard/assets/CombosPage-BlC_xdkX.js.gz +0 -0
- package/dist/dashboard/assets/{ConsoleLogPage-DnV0uZ3m.js → ConsoleLogPage-D-rqeVtG.js} +1 -1
- package/dist/dashboard/assets/ConsoleLogPage-D-rqeVtG.js.gz +0 -0
- package/dist/dashboard/assets/{CustomizationPage-CBxAjo63.js → CustomizationPage-7xT5yg2E.js} +1 -1
- package/dist/dashboard/assets/CustomizationPage-7xT5yg2E.js.gz +0 -0
- package/dist/dashboard/assets/{HealthEventsModal-B5yEE0k6.js → HealthEventsModal-Clq8E9cW.js} +1 -1
- package/dist/dashboard/assets/HealthEventsModal-Clq8E9cW.js.gz +0 -0
- package/dist/dashboard/assets/{InjectSystemPromptPanel-BWFLECmz.js → InjectSystemPromptPanel-6Teoq9Se.js} +1 -1
- package/dist/dashboard/assets/InjectSystemPromptPanel-6Teoq9Se.js.gz +0 -0
- package/dist/dashboard/assets/{LoginPage-CgoPc5B9.js → LoginPage-CZuI0MAR.js} +1 -1
- package/dist/dashboard/assets/LoginPage-CZuI0MAR.js.gz +0 -0
- package/dist/dashboard/assets/{ModelPicker-D9bFQern.js → ModelPicker-C1hNTlkr.js} +1 -1
- package/dist/dashboard/assets/ModelPicker-C1hNTlkr.js.gz +0 -0
- package/dist/dashboard/assets/{OverviewPage-B_p4tL8k.js → OverviewPage-0yfhSI1C.js} +1 -1
- package/dist/dashboard/assets/OverviewPage-0yfhSI1C.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage-xqTxdQ4c.js +8 -0
- package/dist/dashboard/assets/ProviderDetailPage-xqTxdQ4c.js.gz +0 -0
- package/dist/dashboard/assets/{ProviderIcon-D_0PiZtg.js → ProviderIcon-Ddhm1InL.js} +1 -1
- package/dist/dashboard/assets/ProviderIcon-Ddhm1InL.js.gz +0 -0
- package/dist/dashboard/assets/{ProvidersPage-CLI2bJTK.js → ProvidersPage-C3fYuu6i.js} +1 -1
- package/dist/dashboard/assets/ProvidersPage-C3fYuu6i.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-CHtJtZ3u.js +9 -0
- package/dist/dashboard/assets/ProxyPage-CHtJtZ3u.js.gz +0 -0
- package/dist/dashboard/assets/{QuotaPage-DA-a1iSN.js → QuotaPage-D1RV_2BX.js} +1 -1
- package/dist/dashboard/assets/QuotaPage-D1RV_2BX.js.gz +0 -0
- package/dist/dashboard/assets/{SettingsPage-CctTga2C.js → SettingsPage-BzZAvYSX.js} +1 -1
- package/dist/dashboard/assets/SettingsPage-BzZAvYSX.js.gz +0 -0
- package/dist/dashboard/assets/{SetupPage-febLU4r1.js → SetupPage--s-EfEIL.js} +1 -1
- package/dist/dashboard/assets/SetupPage--s-EfEIL.js.gz +0 -0
- package/dist/dashboard/assets/{StudioPage-M6fvR5Wz.js → StudioPage-BjXFGSK4.js} +1 -1
- package/dist/dashboard/assets/StudioPage-BjXFGSK4.js.gz +0 -0
- package/dist/dashboard/assets/{UsagePage-nyeuRqz9.js → UsagePage-CP8F8BN7.js} +1 -1
- package/dist/dashboard/assets/UsagePage-CP8F8BN7.js.gz +0 -0
- package/dist/dashboard/assets/{api-keys-BFOlvrJC.js → api-keys-2hc12Uz2.js} +1 -1
- package/dist/dashboard/assets/api-keys-2hc12Uz2.js.gz +0 -0
- package/dist/dashboard/assets/app-DGXbNfAR.css +2 -0
- package/dist/dashboard/assets/app-DGXbNfAR.css.gz +0 -0
- package/dist/dashboard/assets/{assert-CqTLw5e7.js → assert-BMcj1xZE.js} +1 -1
- package/dist/dashboard/assets/assert-BMcj1xZE.js.gz +0 -0
- package/dist/dashboard/assets/{badge-C83EqLB0.js → badge-DkRUuVfz.js} +1 -1
- package/dist/dashboard/assets/badge-DkRUuVfz.js.gz +0 -0
- package/dist/dashboard/assets/{banner-D1xn7pIe.js → banner-CDjW841Q.js} +1 -1
- package/dist/dashboard/assets/banner-CDjW841Q.js.gz +0 -0
- package/dist/dashboard/assets/{card-DU3Lq5Lm.js → card-Bto5UlL9.js} +1 -1
- package/dist/dashboard/assets/card-Bto5UlL9.js.gz +0 -0
- package/dist/dashboard/assets/{cli-tools-Dw1U_drK.js → cli-tools-DaH6g9hL.js} +1 -1
- package/dist/dashboard/assets/cli-tools-DaH6g9hL.js.gz +0 -0
- package/dist/dashboard/assets/{clipboard-button-CEL5Sg_J.js → clipboard-button-BYKBCzjk.js} +1 -1
- package/dist/dashboard/assets/clipboard-button-BYKBCzjk.js.gz +0 -0
- package/dist/dashboard/assets/{dialog-BjFR5UHy.js → dialog-DL0Zftwv.js} +1 -1
- package/dist/dashboard/assets/dialog-DL0Zftwv.js.gz +0 -0
- package/dist/dashboard/assets/{drawer-HvBW0AjI.js → drawer-Dpx_UXaS.js} +1 -1
- package/dist/dashboard/assets/drawer-Dpx_UXaS.js.gz +0 -0
- package/dist/dashboard/assets/{entry-CECVELyy.js → entry-BV7-1NoM.js} +1 -1
- package/dist/dashboard/assets/entry-BV7-1NoM.js.gz +0 -0
- package/dist/dashboard/assets/{entry-DYYofQ7W.js → entry-CGvdNU6r.js} +1 -1
- package/dist/dashboard/assets/entry-CGvdNU6r.js.gz +0 -0
- package/dist/dashboard/assets/{entry-BSu3gFlt.js → entry-DScKYvZj.js} +3 -3
- package/dist/dashboard/assets/entry-DScKYvZj.js.gz +0 -0
- package/dist/dashboard/assets/{formatters-DLW4i8zK.js → formatters-BS3DZlZj.js} +1 -1
- package/dist/dashboard/assets/formatters-BS3DZlZj.js.gz +0 -0
- package/dist/dashboard/assets/{index-1-fCqe64.js → index-SQnvvTWX.js} +2 -2
- package/dist/dashboard/assets/index-SQnvvTWX.js.gz +0 -0
- package/dist/dashboard/assets/{inline-DGvU2oLK.js → inline-Dl-cuLK0.js} +1 -1
- package/dist/dashboard/assets/inline-Dl-cuLK0.js.gz +0 -0
- package/dist/dashboard/assets/{input-iNnO1X2K.js → input-Bfx0EzRc.js} +1 -1
- package/dist/dashboard/assets/input-Bfx0EzRc.js.gz +0 -0
- package/dist/dashboard/assets/{layout-0q8UGypb.js → layout-BxhbQ_JS.js} +1 -1
- package/dist/dashboard/assets/layout-BxhbQ_JS.js.gz +0 -0
- package/dist/dashboard/assets/{list-row-C0w2bQjJ.js → list-row-D49Y4ptn.js} +1 -1
- package/dist/dashboard/assets/list-row-D49Y4ptn.js.gz +0 -0
- package/dist/dashboard/assets/{live-M5aJ_xCa.js → live-CbVTdX9V.js} +1 -1
- package/dist/dashboard/assets/live-CbVTdX9V.js.gz +0 -0
- package/dist/dashboard/assets/{network-BKeQGT3K.js → network-JGvDveof.js} +1 -1
- package/dist/dashboard/assets/network-JGvDveof.js.gz +0 -0
- package/dist/dashboard/assets/{numbers-CivAk3da.js → numbers-Dw6kiew-.js} +1 -1
- package/dist/dashboard/assets/numbers-Dw6kiew-.js.gz +0 -0
- package/dist/dashboard/assets/{pagination-CpzvI5ep.js → pagination-iUoI8GeE.js} +1 -1
- package/dist/dashboard/assets/pagination-iUoI8GeE.js.gz +0 -0
- package/dist/dashboard/assets/providers/sensenova-intl.png +0 -0
- package/dist/dashboard/assets/providers/sensenova.png +0 -0
- package/dist/dashboard/assets/{routing-BFQX2VBc.js → routing-8jZr-3WE.js} +1 -1
- package/dist/dashboard/assets/routing-8jZr-3WE.js.gz +0 -0
- package/dist/dashboard/assets/{select-CXbck0jG.js → select-oO1FxMVb.js} +1 -1
- package/dist/dashboard/assets/select-oO1FxMVb.js.gz +0 -0
- package/dist/dashboard/assets/{settings-C_XvMHh9.js → settings-CLr3kdIx.js} +1 -1
- package/dist/dashboard/assets/settings-CLr3kdIx.js.gz +0 -0
- package/dist/dashboard/assets/{stack-DggRiCxE.js → stack-Y3pDteZr.js} +1 -1
- package/dist/dashboard/assets/stack-Y3pDteZr.js.gz +0 -0
- package/dist/dashboard/assets/{state-ClFzfbYp.js → state-CArX_Iak.js} +1 -1
- package/dist/dashboard/assets/state-CArX_Iak.js.gz +0 -0
- package/dist/dashboard/assets/{switch-CTIFxKqS.js → switch-DwlwmDO-.js} +1 -1
- package/dist/dashboard/assets/switch-DwlwmDO-.js.gz +0 -0
- package/dist/dashboard/assets/{useMutation-BClG3yWj.js → useMutation-DJ9GYEgf.js} +1 -1
- package/dist/dashboard/assets/useMutation-DJ9GYEgf.js.gz +0 -0
- package/dist/dashboard/index.html +2 -2
- package/dist/dashboard/index.html.gz +0 -0
- package/dist/dashboard/precompressed-assets.json +51 -51
- package/migrations/full-postgres/0047_add_provider_device_flow_proxy.sql +17 -0
- package/migrations/lite-sqlite3/0047_add_provider_device_flow_proxy.sql +19 -0
- package/package.json +1 -1
- package/src/boot/app.ts +1 -1
- package/src/boot/dependencies.ts +4 -6
- package/src/config/providers.ts +6 -5
- package/src/config/spec.ts +8 -8
- package/src/console/backup/nine-router.ts +71 -10
- package/src/console/backup/service.ts +8 -1
- package/src/console/console-router.ts +1 -1
- package/src/console/domain-registration.ts +7 -2
- package/src/console/inferhub/client.ts +1 -1
- package/src/console/observability/live.ts +2 -2
- package/src/console/providers/catalog/contracts.ts +9 -3
- package/src/console/providers/catalog/model-operations.ts +2 -3
- package/src/console/providers/catalog/provider-operations.ts +1 -1
- package/src/console/providers/catalog/routes.ts +2 -2
- package/src/console/providers/catalog/store.ts +1914 -1907
- package/src/console/providers/detail/routes.ts +1 -0
- package/src/console/providers/detail/store.ts +4 -0
- package/src/console/providers/oauth/callback-listener.ts +30 -11
- package/src/console/providers/oauth/device-egress.ts +123 -0
- package/src/console/providers/oauth/routes.ts +123 -16
- package/src/console/quota/account-quota-tenant.ts +5 -5
- package/src/console/quota/account-test-egress.ts +2 -2
- package/src/console/quota/daily-growth-job.ts +1 -1
- package/src/console/routing/pools/contracts.ts +1 -1
- package/src/console/routing/pools/operations.ts +1 -1
- package/src/console/routing/pools/probe-verdict.ts +2 -2
- package/src/console/routing/pools/relay-deploy.ts +1 -1
- package/src/console/routing/pools/store.ts +4 -4
- package/src/network/client.ts +67 -0
- package/src/network/egress/bidi-session.ts +322 -0
- package/src/network/egress/dial.ts +201 -0
- package/src/network/egress/factory.ts +191 -0
- package/src/network/{outbound-fetch.ts → egress/fetch.ts} +195 -29
- package/src/network/egress/tls-profile.ts +123 -0
- package/src/network/egress/ws.ts +175 -0
- package/src/network/{types.ts → pool/agent-config.ts} +1 -1
- package/src/network/pool/agent.ts +2 -2
- package/src/network/{pool-cooldown-store.ts → pool/cooldown-store.ts} +7 -7
- package/src/network/{pool-health-machine.ts → pool/health.ts} +205 -6
- package/src/network/pool/resolver.ts +10 -849
- package/src/network/pool/selector.ts +2 -2
- package/src/network/ssrf.ts +1 -1
- package/src/network/{retry.ts → util/retry.ts} +1 -1
- package/src/observability/telemetry-buffer.ts +1 -1
- package/src/persistence/schema.ts +9 -0
- package/src/persistence/ttl-cache.ts +1 -1
- package/src/protocol/codecs.ts +58 -1
- package/src/protocol/request/messages.ts +31 -18
- package/src/protocol/response/messages.ts +34 -7
- package/src/protocol/translation/quirks.ts +15 -0
- package/src/protocol/upstream/send-claude-messages.ts +2 -2
- package/src/providers/adapters/compatible-adapter.ts +5 -0
- package/src/providers/authentication/oauth-client.ts +40 -6
- package/src/providers/authentication/oauth-device-flow.ts +7 -3
- package/src/providers/authentication/oauth-flow-store.ts +82 -1
- package/src/providers/authentication/oauth-refresh-service.ts +766 -739
- package/src/providers/default-registry.ts +76 -0
- package/src/providers/discovery/discovery-types.ts +7 -0
- package/src/providers/discovery/probe-phases.ts +6 -2
- package/src/providers/discovery/probing-service.ts +7 -0
- package/src/providers/integrations/antigravity/antigravity-protocol.ts +11 -0
- package/src/providers/integrations/buddy/account.ts +969 -0
- package/src/providers/integrations/buddy/capabilities.ts +10 -10
- package/src/providers/integrations/buddy/{buddy-catalog-shared.ts → catalog.ts} +198 -136
- package/src/providers/integrations/buddy/{buddy-chat-shared.ts → chat.ts} +5 -5
- package/src/providers/integrations/buddy/codebuddy/index.ts +429 -0
- package/src/providers/integrations/buddy/codebuddy/shared.ts +4 -4
- package/src/providers/integrations/buddy/{buddy-identity.ts → headers.ts} +138 -140
- package/src/providers/integrations/buddy/lifecycle.ts +1018 -0
- package/src/providers/integrations/buddy/{buddy-media.ts → media.ts} +1 -1
- package/src/providers/integrations/cline/cline-oauth.ts +10 -5
- package/src/providers/integrations/cline/cline.ts +3 -4
- package/src/providers/integrations/clixad/clixad-oauth.ts +98 -0
- package/src/providers/integrations/clixad/clixad-quota.ts +132 -0
- package/src/providers/integrations/clixad/provider.ts +145 -0
- package/src/providers/integrations/codex/codex-oauth.ts +8 -5
- package/src/providers/integrations/cursor/cursor-auth.ts +1 -1
- package/src/providers/integrations/cursor/cursor-hardening.ts +279 -0
- package/src/providers/integrations/cursor/cursor-http2.ts +605 -6
- package/src/providers/integrations/cursor/cursor-shared.ts +1 -1
- package/src/providers/integrations/cursor/cursor.ts +485 -70
- package/src/providers/integrations/deepai/deepai-catalog.ts +149 -0
- package/src/providers/integrations/deepai/deepai-common.ts +145 -0
- package/src/providers/integrations/deepai/deepai-oauth.ts +129 -0
- package/src/providers/integrations/deepai/deepai-quota.ts +97 -0
- package/src/providers/integrations/deepai/provider.ts +42 -0
- package/src/providers/integrations/devin/devin-auth.ts +7 -0
- package/src/providers/integrations/factory/factory-oauth.ts +16 -7
- package/src/providers/integrations/freebuff/freebuff.ts +2 -2
- package/src/providers/integrations/freepi/freepi-catalog.ts +5 -0
- package/src/providers/integrations/freepi/freepi-discovery.ts +2 -2
- package/src/providers/integrations/freepi/freepi-headers.ts +2 -2
- package/src/providers/integrations/freepi/freepi-protocol.ts +11 -2
- package/src/providers/integrations/freepi/freepi-realm.ts +0 -3
- package/src/providers/integrations/freepi/freepi-session.ts +158 -0
- package/src/providers/integrations/freepi/freepi.ts +80 -54
- package/src/providers/integrations/github/github-discovery.ts +30 -13
- package/src/providers/integrations/github/github-oauth.ts +217 -44
- package/src/providers/integrations/github/github-quota.ts +22 -5
- package/src/providers/integrations/github/github.ts +40 -32
- package/src/providers/integrations/grok/grok-oauth.ts +4 -4
- package/src/providers/integrations/hermes/hermes-oauth.ts +3 -3
- package/src/providers/integrations/hermes/hermes.ts +34 -5
- package/src/providers/integrations/kilo/kilo-oauth.ts +4 -4
- package/src/providers/integrations/kilo/kilo.ts +1 -1
- package/src/providers/integrations/kimi/kimi-oauth.ts +3 -3
- package/src/providers/integrations/kiro/kiro-oauth.ts +2 -2
- package/src/providers/integrations/muse/muse-oauth.ts +5 -5
- package/src/providers/integrations/opencode/fingerprint.ts +1 -1
- package/src/providers/integrations/openrouter/provider.ts +1 -1
- package/src/providers/integrations/perch/perch-protocol.ts +0 -3
- package/src/providers/integrations/perch/perch.ts +3 -3
- package/src/providers/integrations/qoder/claim-qoder-credits.ts +1 -1
- package/src/providers/integrations/qoder/qoder-adapter.ts +19 -113
- package/src/providers/integrations/qoder/qoder-auth.ts +8 -1
- package/src/providers/integrations/qoder/qoder-catalog.ts +1 -1
- package/src/providers/integrations/qoder/qoder-chat.ts +25 -8
- package/src/providers/integrations/qoder/qoder-checkin.ts +1 -1
- package/src/providers/integrations/qoder/qoder-cosy.ts +37 -9
- package/src/providers/integrations/qoder/qoder-oauth.ts +9 -2
- package/src/providers/integrations/qoder/qoder-realm.ts +13 -36
- package/src/providers/integrations/qoder/qoder-sse.ts +447 -68
- package/src/providers/integrations/qoder/qoder-types.ts +9 -0
- package/src/providers/integrations/qoder/qoder.ts +3 -25
- package/src/providers/integrations/sensenova/provider.ts +144 -0
- package/src/providers/integrations/trae/trae-quota.ts +15 -1
- package/src/providers/integrations/vercel/provider.ts +117 -0
- package/src/providers/integrations/vercel/vercel-quota.ts +96 -0
- package/src/providers/integrations/xai/xai-oauth.ts +5 -5
- package/src/providers/integrations/zcode-start-plan/gifts.ts +1 -1
- package/src/providers/integrations/zcode-start-plan/oauth.ts +3 -3
- package/src/providers/integrations/zro/zro.ts +2 -1
- package/src/providers/operations/account-refresh-status.ts +14 -0
- package/src/providers/operations/client-versions.ts +95 -30
- package/src/providers/operations/oauth-refresh-lead.ts +46 -22
- package/src/providers/operations/provider-caches.ts +1 -1
- package/src/providers/operations/provider-credential-service.ts +22 -25
- package/src/providers/operations/session-resolution.ts +17 -1
- package/src/providers/provider-contracts.ts +2 -2
- package/src/providers/provider-metadata.ts +30 -0
- package/src/providers/quota/quota-contracts.ts +2 -0
- package/src/providers/quota/refresh.ts +25 -3
- package/src/security/ip-boundary.ts +1 -1
- package/src/transport/dispatch/attempt-finalize.ts +1 -1
- package/src/transport/dispatch/attempt-loop.ts +3 -3
- package/src/transport/dispatch/handler-deps.ts +1 -1
- package/src/transport/dispatch/leases.ts +1 -1
- package/src/transport/dispatch/retry-policy.ts +1 -1
- package/src/transport/dispatch/streaming/finalize.ts +2 -2
- package/src/transport/dispatch/streaming/stream.ts +1 -1
- package/src/transport/dispatch/upstream.ts +1 -1
- package/src/transport/shutdown-notice.ts +1 -1
- package/src/workers/buddy-growth-tasks.ts +8 -8
- package/src/workers/daily-checkin.ts +4 -4
- package/src/workers/quota-refresh-sweep.ts +1 -1
- package/src/workers/zcode-gift-claim.ts +1 -1
- package/dist/dashboard/assets/BannedPage-Cc0vKpMG.js.gz +0 -0
- package/dist/dashboard/assets/CliToolDetailPage-Bqj2aa1T.js.gz +0 -0
- package/dist/dashboard/assets/CliToolsPage-CXsaOAO2.js.gz +0 -0
- package/dist/dashboard/assets/CombosPage-BeLpJ4ma.js.gz +0 -0
- package/dist/dashboard/assets/ConsoleLogPage-DnV0uZ3m.js.gz +0 -0
- package/dist/dashboard/assets/CustomizationPage-CBxAjo63.js.gz +0 -0
- package/dist/dashboard/assets/HealthEventsModal-B5yEE0k6.js.gz +0 -0
- package/dist/dashboard/assets/InjectSystemPromptPanel-BWFLECmz.js.gz +0 -0
- package/dist/dashboard/assets/LoginPage-CgoPc5B9.js.gz +0 -0
- package/dist/dashboard/assets/ModelPicker-D9bFQern.js.gz +0 -0
- package/dist/dashboard/assets/OverviewPage-B_p4tL8k.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage-rs5E2rxv.js +0 -8
- package/dist/dashboard/assets/ProviderDetailPage-rs5E2rxv.js.gz +0 -0
- package/dist/dashboard/assets/ProviderIcon-D_0PiZtg.js.gz +0 -0
- package/dist/dashboard/assets/ProvidersPage-CLI2bJTK.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-BwNC_-Cx.js +0 -9
- package/dist/dashboard/assets/ProxyPage-BwNC_-Cx.js.gz +0 -0
- package/dist/dashboard/assets/QuotaPage-DA-a1iSN.js.gz +0 -0
- package/dist/dashboard/assets/SettingsPage-CctTga2C.js.gz +0 -0
- package/dist/dashboard/assets/SetupPage-febLU4r1.js.gz +0 -0
- package/dist/dashboard/assets/StudioPage-M6fvR5Wz.js.gz +0 -0
- package/dist/dashboard/assets/UsagePage-nyeuRqz9.js.gz +0 -0
- package/dist/dashboard/assets/api-keys-BFOlvrJC.js.gz +0 -0
- package/dist/dashboard/assets/app-Dx2QgsNj.css +0 -2
- package/dist/dashboard/assets/app-Dx2QgsNj.css.gz +0 -0
- package/dist/dashboard/assets/assert-CqTLw5e7.js.gz +0 -0
- package/dist/dashboard/assets/badge-C83EqLB0.js.gz +0 -0
- package/dist/dashboard/assets/banner-D1xn7pIe.js.gz +0 -0
- package/dist/dashboard/assets/card-DU3Lq5Lm.js.gz +0 -0
- package/dist/dashboard/assets/cli-tools-Dw1U_drK.js.gz +0 -0
- package/dist/dashboard/assets/clipboard-button-CEL5Sg_J.js.gz +0 -0
- package/dist/dashboard/assets/dialog-BjFR5UHy.js.gz +0 -0
- package/dist/dashboard/assets/drawer-HvBW0AjI.js.gz +0 -0
- package/dist/dashboard/assets/entry-BSu3gFlt.js.gz +0 -0
- package/dist/dashboard/assets/entry-CECVELyy.js.gz +0 -0
- package/dist/dashboard/assets/entry-DYYofQ7W.js.gz +0 -0
- package/dist/dashboard/assets/formatters-DLW4i8zK.js.gz +0 -0
- package/dist/dashboard/assets/index-1-fCqe64.js.gz +0 -0
- package/dist/dashboard/assets/inline-DGvU2oLK.js.gz +0 -0
- package/dist/dashboard/assets/input-iNnO1X2K.js.gz +0 -0
- package/dist/dashboard/assets/layout-0q8UGypb.js.gz +0 -0
- package/dist/dashboard/assets/list-row-C0w2bQjJ.js.gz +0 -0
- package/dist/dashboard/assets/live-M5aJ_xCa.js.gz +0 -0
- package/dist/dashboard/assets/network-BKeQGT3K.js.gz +0 -0
- package/dist/dashboard/assets/numbers-CivAk3da.js.gz +0 -0
- package/dist/dashboard/assets/pagination-CpzvI5ep.js.gz +0 -0
- package/dist/dashboard/assets/routing-BFQX2VBc.js.gz +0 -0
- package/dist/dashboard/assets/select-CXbck0jG.js.gz +0 -0
- package/dist/dashboard/assets/settings-C_XvMHh9.js.gz +0 -0
- package/dist/dashboard/assets/stack-DggRiCxE.js.gz +0 -0
- package/dist/dashboard/assets/state-ClFzfbYp.js.gz +0 -0
- package/dist/dashboard/assets/switch-CTIFxKqS.js.gz +0 -0
- package/dist/dashboard/assets/useMutation-BClG3yWj.js.gz +0 -0
- package/src/console/providers/catalog/discover-constants.ts +0 -6
- package/src/network/pool-health.ts +0 -198
- package/src/providers/integrations/buddy/buddy-checkin.ts +0 -521
- package/src/providers/integrations/buddy/buddy-cli-headers.ts +0 -76
- package/src/providers/integrations/buddy/buddy-conversation-headers.ts +0 -130
- package/src/providers/integrations/buddy/buddy-discovery-shared.ts +0 -234
- package/src/providers/integrations/buddy/buddy-growth-shared.ts +0 -496
- package/src/providers/integrations/buddy/buddy-oauth-shared.ts +0 -341
- package/src/providers/integrations/buddy/buddy-quota-shared.ts +0 -417
- package/src/providers/integrations/buddy/buddy-server-tools.ts +0 -240
- package/src/providers/integrations/buddy/buddy-usage-shared.ts +0 -221
- package/src/providers/integrations/buddy/buddy-usage-store.ts +0 -181
- package/src/providers/integrations/buddy/codebuddy/cn-catalog.ts +0 -37
- package/src/providers/integrations/buddy/codebuddy/cn-provider.ts +0 -188
- package/src/providers/integrations/buddy/codebuddy/oauth.ts +0 -47
- package/src/providers/integrations/buddy/codebuddy/provider.ts +0 -179
- package/src/providers/integrations/buddy/codebuddy/quota.ts +0 -154
- package/src/providers/integrations/qoder/chat-proto.ts +0 -328
- package/src/providers/integrations/qoder/qoder-grpc.ts +0 -870
- package/src/providers/integrations/qoder/qoder-ide.ts +0 -481
- /package/dist/dashboard/assets/{app-DIXLjojg.js → app-C0gTXEoN.js} +0 -0
- /package/dist/dashboard/assets/{app-DIXLjojg.js.gz → app-C0gTXEoN.js.gz} +0 -0
- /package/src/network/{http2-bidi.ts → bidi.ts} +0 -0
- /package/src/network/pool/{byte-accounting.ts → accounting.ts} +0 -0
- /package/src/network/pool/{pool-scripts.ts → scripts.ts} +0 -0
- /package/src/network/pool/{pool-state.ts → state.ts} +0 -0
- /package/src/network/{backoff.ts → util/backoff.ts} +0 -0
- /package/src/network/{deduplication.ts → util/dedupe.ts} +0 -0
- /package/src/network/{ip-utils.ts → util/ip.ts} +0 -0
- /package/src/network/{rate-limit-verdict.ts → verdict.ts} +0 -0
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// CodeBuddy International adapter — exact provider contract.
|
|
2
|
-
// Canonical provider ID: cb
|
|
3
|
-
// Base (manifest-owned CODEBUDDY_BASE_URL) → Chat: base + /chat/completions
|
|
4
|
-
// Auth: Authorization Bearer for both api_key and oauth
|
|
5
|
-
// Stream: force stream=true upstream, factory reaggregates for non-stream callers
|
|
6
|
-
// Headers: per-provider CodeBuddy headers with fresh correlation IDs per dispatch
|
|
7
|
-
// Payload: leading CodeBuddy system prompt + typed user content, reasoning_summary auto only when reasoning_effort
|
|
8
|
-
|
|
9
|
-
import { BuddyMediaAdapter } from "../buddy-media";
|
|
10
|
-
import type { ProviderDispatchContext, ProviderDispatchTarget, ProviderAdapter } from "../../../provider-contracts";
|
|
11
|
-
import type { ModelDefinition } from "../../../provider-model-definition";
|
|
12
|
-
import type { DiscoveryInput } from "../../../discovery/discovery-types";
|
|
13
|
-
import { GatewayError } from "../../../../protocol/gateway-error";
|
|
14
|
-
import type { CanonicalRequest } from "../../../../protocol/canonical-model";
|
|
15
|
-
import { providerBaseUrl } from "../../../provider-metadata";
|
|
16
|
-
import {
|
|
17
|
-
codebuddyAdapterConfig,
|
|
18
|
-
codebuddyHeaders,
|
|
19
|
-
} from "./shared";
|
|
20
|
-
import {
|
|
21
|
-
BUDDY_SHARED_RAW,
|
|
22
|
-
BUDDY_IMAGE_MODEL_ID_SET,
|
|
23
|
-
BUDDY_VIDEO_MODEL_ID_SET,
|
|
24
|
-
makeBuddyModel,
|
|
25
|
-
makeBuddyImageModels,
|
|
26
|
-
makeBuddyVideoModels,
|
|
27
|
-
type BuddyRawEntry,
|
|
28
|
-
} from "../buddy-catalog-shared";
|
|
29
|
-
import { BUDDY_INTL_MODELS_PATH, fetchBuddyDirectoryModels } from "../buddy-discovery-shared";
|
|
30
|
-
import {
|
|
31
|
-
applyBuddySystemPrompt,
|
|
32
|
-
buddyPrePayloadCommon,
|
|
33
|
-
injectBuddyParallelToolCalls,
|
|
34
|
-
normalizeBuddyToolNames,
|
|
35
|
-
} from "../buddy-chat-shared";
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Constants — public contract
|
|
39
|
-
export const CODEBUDDY_PROVIDER_ID = "cb" as const;
|
|
40
|
-
export const CODEBUDDY_BASE_URL = providerBaseUrl("cb");
|
|
41
|
-
// Upstream model translation — preserve provider mapping
|
|
42
|
-
|
|
43
|
-
// Payload hook — provider intl semantics
|
|
44
|
-
// - force stream=true
|
|
45
|
-
// - reasoning_summary auto only when reasoning_effort requested
|
|
46
|
-
// - upstreamId translation
|
|
47
|
-
// - leading CodeBuddy system prompt + typed user content normalization
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Leading system turn for this variant.
|
|
51
|
-
*
|
|
52
|
-
* The wire contract is that the request *opens* with a `system` turn (code
|
|
53
|
-
* `11128`); the gateway replaces any caller `system`/`developer` turn with this
|
|
54
|
-
* fixed prompt. Deliberately neutral: a simple helpful-assistant persona with
|
|
55
|
-
* no client/CLI branding, kept minimal so the text reads naturally to any
|
|
56
|
-
* model and does not advertise a channel identity upstream.
|
|
57
|
-
*/
|
|
58
|
-
export const CODEBUDDY_SYSTEM_PROMPT = "You are a helpful assistant.";
|
|
59
|
-
|
|
60
|
-
function codeBuddyIntlPrePayload(
|
|
61
|
-
payload: Record<string, unknown>,
|
|
62
|
-
request: CanonicalRequest,
|
|
63
|
-
candidate: ProviderDispatchTarget,
|
|
64
|
-
context?: ProviderDispatchContext,
|
|
65
|
-
): void {
|
|
66
|
-
// International ladder: DeepSeek Flash and friends serve only `high`.
|
|
67
|
-
buddyPrePayloadCommon(payload, request, "intl", context);
|
|
68
|
-
const rawModel = payload["model"];
|
|
69
|
-
const source =
|
|
70
|
-
typeof rawModel === "string" && rawModel.length > 0
|
|
71
|
-
? rawModel
|
|
72
|
-
: candidate.model_id;
|
|
73
|
-
if (!source) throw new GatewayError("invalid_request", 400, "CodeBuddy model is required (request {requestId}). Check the shape of what you sent — then resend 🪞");
|
|
74
|
-
const messages = payload["messages"];
|
|
75
|
-
if (Array.isArray(messages)) {
|
|
76
|
-
applyBuddySystemPrompt(
|
|
77
|
-
messages as Array<Record<string, unknown>>,
|
|
78
|
-
CODEBUDDY_SYSTEM_PROMPT,
|
|
79
|
-
context?.tenant_system_prompt,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
normalizeBuddyToolNames(payload);
|
|
83
|
-
injectBuddyParallelToolCalls(payload, request);
|
|
84
|
-
void request;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Model catalog — shared CodeBuddy international roster
|
|
88
|
-
|
|
89
|
-
const CODEBUDDY_INTL_RAW: readonly BuddyRawEntry[] = BUDDY_SHARED_RAW;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* CodeBuddy's image generation rows.
|
|
93
|
-
*
|
|
94
|
-
* These ids also sit on the shared chat roster as ordinary `llm` rows, which is
|
|
95
|
-
* why they were unreachable as image models: nothing downstream could tell a
|
|
96
|
-
* chat model from one that returns an image, so `mediaGeneration` was false for
|
|
97
|
-
* every catalog row. The roster and the declared capabilities come from
|
|
98
|
-
* {@link makeBuddyImageModels} so cb and cbcn cannot drift.
|
|
99
|
-
*/
|
|
100
|
-
export const CODEBUDDY_IMAGE_MODELS: readonly ModelDefinition[] = makeBuddyImageModels(
|
|
101
|
-
"cb",
|
|
102
|
-
"/images/generations",
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* CodeBuddy's video-generation rows (`seedance-2.5`).
|
|
107
|
-
*
|
|
108
|
-
* Reached through `/videos/generations` on the `/v2` base, so the endpoint is
|
|
109
|
-
* the upstream video path rather than a chat-completions path.
|
|
110
|
-
*/
|
|
111
|
-
export const CODEBUDDY_VIDEO_MODELS: readonly ModelDefinition[] = makeBuddyVideoModels(
|
|
112
|
-
"cb",
|
|
113
|
-
"/videos/generations",
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* The full cb catalog the registry loads: chat roster plus image and video rows.
|
|
118
|
-
*
|
|
119
|
-
* The image and video ids are filtered out of the chat pass so one id never
|
|
120
|
-
* appears under two service kinds. Exported as a single list so
|
|
121
|
-
* `default-registry.ts` keeps one import for this provider.
|
|
122
|
-
*/
|
|
123
|
-
export const CODEBUDDY_MODELS: readonly ModelDefinition[] = [
|
|
124
|
-
...CODEBUDDY_INTL_RAW.filter(
|
|
125
|
-
(entry) => !BUDDY_IMAGE_MODEL_ID_SET.has(entry[0]) && !BUDDY_VIDEO_MODEL_ID_SET.has(entry[0]),
|
|
126
|
-
).map((entry) => makeBuddyModel(entry, "cb")),
|
|
127
|
-
...CODEBUDDY_IMAGE_MODELS,
|
|
128
|
-
...CODEBUDDY_VIDEO_MODELS,
|
|
129
|
-
];
|
|
130
|
-
|
|
131
|
-
/**
|
|
132
|
-
* Reads the CodeBuddy intl console directory.
|
|
133
|
-
*
|
|
134
|
-
* The static `CODEBUDDY_MODELS` above stays the fallback — this console is
|
|
135
|
-
* documented to answer 500 intermittently — while discovery carries the
|
|
136
|
-
* upstream's own limits and capability flags.
|
|
137
|
-
*/
|
|
138
|
-
export async function discoverCodeBuddyModels(
|
|
139
|
-
input: DiscoveryInput,
|
|
140
|
-
): Promise<readonly ModelDefinition[] | null> {
|
|
141
|
-
return fetchBuddyDirectoryModels({
|
|
142
|
-
siteUrl: CODEBUDDY_BASE_URL,
|
|
143
|
-
providerId: CODEBUDDY_PROVIDER_ID,
|
|
144
|
-
credential: input.credential,
|
|
145
|
-
modelsPath: BUDDY_INTL_MODELS_PATH,
|
|
146
|
-
endpoint: undefined,
|
|
147
|
-
...(input.signal ? { signal: input.signal } : {}),
|
|
148
|
-
...(input.fetcher ? { fetcher: input.fetcher } : {}),
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Public factory — uses OpenAI-compatible factory but forces provider semantics
|
|
153
|
-
// Supports both api_key and oauth via Authorization Bearer (factory handles both)
|
|
154
|
-
|
|
155
|
-
export function createCodeBuddyAdapter(fetchImpl?: typeof fetch): ProviderAdapter {
|
|
156
|
-
return new BuddyMediaAdapter(
|
|
157
|
-
codebuddyAdapterConfig({
|
|
158
|
-
providerId: CODEBUDDY_PROVIDER_ID,
|
|
159
|
-
baseUrl: CODEBUDDY_BASE_URL,
|
|
160
|
-
variant: "IDE",
|
|
161
|
-
cliIdentity: true,
|
|
162
|
-
prePayload: codeBuddyIntlPrePayload,
|
|
163
|
-
// The intl CLI profile gzips the chat body and recovers a channel-check
|
|
164
|
-
// 400 by retrying once on the console chat endpoint (donor behavior).
|
|
165
|
-
requestCompression: "gzip",
|
|
166
|
-
channelFallbackPath: "/console/chat/completions",
|
|
167
|
-
...(fetchImpl ? { fetchImpl } : {}),
|
|
168
|
-
}),
|
|
169
|
-
{
|
|
170
|
-
variant: "IDE",
|
|
171
|
-
// BuddyMediaConfig has no `cliIdentity`; the CLI identity is selected by
|
|
172
|
-
// supplying the builder that takes it.
|
|
173
|
-
buildHeaders: (context, request) => codebuddyHeaders("IDE", context, request, true),
|
|
174
|
-
systemPrompt: CODEBUDDY_SYSTEM_PROMPT,
|
|
175
|
-
baseUrl: CODEBUDDY_BASE_URL,
|
|
176
|
-
imageGenerationPath: "/images/generations",
|
|
177
|
-
},
|
|
178
|
-
);
|
|
179
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { FetchLike, ProviderQuotaResult } from "../../../quota/quota-contracts";
|
|
2
|
-
import { providerBaseUrl } from "../../../provider-metadata";
|
|
3
|
-
import { buildCodeBuddyUserAgent } from "../../../operations/client-versions";
|
|
4
|
-
import { codebuddyDomain } from "./shared";
|
|
5
|
-
import { fetchTencentBillingQuota } from "../buddy-quota-shared";
|
|
6
|
-
import { fetchBuddyRequestUsage, type BuddyUsageResult } from "../buddy-usage-shared";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* CodeBuddy Tencent billing quota — exact provider mapping.
|
|
10
|
-
*
|
|
11
|
-
* Endpoints:
|
|
12
|
-
* - cb → POST https://www.codebuddy.ai/v2/billing/meter/get-user-resource
|
|
13
|
-
* - cbcn → POST https://copilot.tencent.com/v2/billing/meter/get-user-resource
|
|
14
|
-
* Request: Authorization: Bearer <accessToken||apiKey>, provider transport headers,
|
|
15
|
-
* Content-Type: application/json, Accept: application/json, body "{}"
|
|
16
|
-
* Response: { code: 0, data: { Response: { Data: { Accounts: [...] } } } }
|
|
17
|
-
*
|
|
18
|
-
* The envelope arithmetic (refill vs bonus split, cadence labels, bonus
|
|
19
|
-
* numbering) is shared with the rest of the family in `buddy-quota-shared.ts`;
|
|
20
|
-
* only the endpoint and identity headers are CodeBuddy-specific.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
export const CODEBUDDY_CN_USAGE_URL =
|
|
24
|
-
`${providerBaseUrl("cbcn")}/billing/meter/get-user-resource`;
|
|
25
|
-
export const CODEBUDDY_INTL_USAGE_URL =
|
|
26
|
-
`${providerBaseUrl("cb")}/billing/meter/get-user-resource`;
|
|
27
|
-
const CODEBUDDY_CN_REQUEST_USAGE_URL =
|
|
28
|
-
`${providerBaseUrl("cbcn")}/billing/meter/get-user-request-usage`;
|
|
29
|
-
const CODEBUDDY_INTL_REQUEST_USAGE_URL =
|
|
30
|
-
`${providerBaseUrl("cb")}/billing/meter/get-user-request-usage`;
|
|
31
|
-
|
|
32
|
-
type CodeBuddyProviderId = "cb" | "cbcn";
|
|
33
|
-
|
|
34
|
-
async function cnHeaders(enterpriseId?: string): Promise<Record<string, string>> {
|
|
35
|
-
return {
|
|
36
|
-
"User-Agent": buildCodeBuddyUserAgent("CLI"),
|
|
37
|
-
"X-Product": "SaaS",
|
|
38
|
-
"X-IDE-Type": "CLI",
|
|
39
|
-
"X-IDE-Name": "CLI",
|
|
40
|
-
"X-Domain": codebuddyDomain("CLI"),
|
|
41
|
-
"x-requested-with": "XMLHttpRequest",
|
|
42
|
-
"x-codebuddy-request": "1",
|
|
43
|
-
...(enterpriseId === undefined || enterpriseId.length === 0
|
|
44
|
-
? {}
|
|
45
|
-
: { "X-Tenant-Id": enterpriseId, "X-Enterprise-Id": enterpriseId }),
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function intlHeaders(enterpriseId?: string): Promise<Record<string, string>> {
|
|
50
|
-
return {
|
|
51
|
-
"User-Agent": buildCodeBuddyUserAgent("IDE"),
|
|
52
|
-
"X-Product": "SaaS",
|
|
53
|
-
"X-IDE-Type": "IDE",
|
|
54
|
-
"X-IDE-Name": "IDE",
|
|
55
|
-
"X-Domain": codebuddyDomain("IDE"),
|
|
56
|
-
"x-requested-with": "XMLHttpRequest",
|
|
57
|
-
"x-codebuddy-request": "1",
|
|
58
|
-
...(enterpriseId === undefined || enterpriseId.length === 0
|
|
59
|
-
? {}
|
|
60
|
-
: { "X-Tenant-Id": enterpriseId, "X-Enterprise-Id": enterpriseId }),
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function parseProviderId(providerId: string): CodeBuddyProviderId {
|
|
65
|
-
const value = providerId.trim().toLowerCase();
|
|
66
|
-
if (value === "cb") return "cb";
|
|
67
|
-
if (value === "cbcn") return "cbcn";
|
|
68
|
-
throw new Error(`Unsupported CodeBuddy provider ${providerId}`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async function providerConfig(
|
|
72
|
-
providerId: CodeBuddyProviderId,
|
|
73
|
-
enterpriseId?: string,
|
|
74
|
-
): Promise<{
|
|
75
|
-
url: string;
|
|
76
|
-
headers: Record<string, string>;
|
|
77
|
-
display: string;
|
|
78
|
-
}> {
|
|
79
|
-
if (providerId === "cb") {
|
|
80
|
-
return { url: CODEBUDDY_INTL_USAGE_URL, headers: await intlHeaders(enterpriseId), display: "CodeBuddy" };
|
|
81
|
-
}
|
|
82
|
-
return { url: CODEBUDDY_CN_USAGE_URL, headers: await cnHeaders(enterpriseId), display: "CodeBuddy CN" };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Fetches CodeBuddy quota for either provider (cn/intl) via the Tencent billing endpoint.
|
|
87
|
-
*
|
|
88
|
-
* Provider-specific wiring:
|
|
89
|
-
* - cn: POST https://copilot.tencent.com/v2/billing/meter/get-user-resource
|
|
90
|
-
* headers: CLI/<resolved-version>, X-IDE-Type CLI, etc.
|
|
91
|
-
* - intl: POST https://www.codebuddy.ai/v2/billing/meter/get-user-resource
|
|
92
|
-
* headers: IDE/<resolved-version>, X-IDE-Type IDE, etc.
|
|
93
|
-
*
|
|
94
|
-
* Auth: `Authorization: Bearer <credential>` (credential_kind api_key and oauth
|
|
95
|
-
* both use Bearer; the caller passes the resolved secret).
|
|
96
|
-
*/
|
|
97
|
-
export async function fetchCodeBuddyQuota(
|
|
98
|
-
credential: string,
|
|
99
|
-
fetcher: FetchLike,
|
|
100
|
-
providerId: string = "cbcn",
|
|
101
|
-
enterpriseId?: string,
|
|
102
|
-
): Promise<ProviderQuotaResult> {
|
|
103
|
-
const source = parseProviderId(providerId);
|
|
104
|
-
const cfg = await providerConfig(source, enterpriseId);
|
|
105
|
-
return fetchTencentBillingQuota({
|
|
106
|
-
source,
|
|
107
|
-
display: cfg.display,
|
|
108
|
-
url: cfg.url,
|
|
109
|
-
headers: cfg.headers,
|
|
110
|
-
credential,
|
|
111
|
-
fetcher,
|
|
112
|
-
defaultPlan: "CodeBuddy",
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// Convenience wrappers for direct fetcher wiring (canonical source IDs)
|
|
117
|
-
export const fetchCodeBuddyCnQuota = (
|
|
118
|
-
credential: string,
|
|
119
|
-
fetcher: FetchLike,
|
|
120
|
-
): Promise<ProviderQuotaResult> => fetchCodeBuddyQuota(credential, fetcher, "cbcn");
|
|
121
|
-
|
|
122
|
-
export const fetchCodeBuddyIntlQuota = (
|
|
123
|
-
credential: string,
|
|
124
|
-
fetcher: FetchLike,
|
|
125
|
-
): Promise<ProviderQuotaResult> => fetchCodeBuddyQuota(credential, fetcher, "cb");
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Real credit deductions for one CodeBuddy account.
|
|
129
|
-
*
|
|
130
|
-
* Separate from {@link fetchCodeBuddyQuota} on purpose: that one reads the
|
|
131
|
-
* *entitlement* (what the account has left), this one reads what it already
|
|
132
|
-
* spent, per day and per model. Same billing host and the same identity
|
|
133
|
-
* headers, so the wiring mirrors the quota path exactly — only the endpoint
|
|
134
|
-
* and the default window differ.
|
|
135
|
-
*/
|
|
136
|
-
export async function fetchCodeBuddyRequestUsage(
|
|
137
|
-
credential: string,
|
|
138
|
-
fetcher: FetchLike,
|
|
139
|
-
providerId: string = "cbcn",
|
|
140
|
-
days: number = 30,
|
|
141
|
-
enterpriseId?: string,
|
|
142
|
-
): Promise<BuddyUsageResult> {
|
|
143
|
-
const source = parseProviderId(providerId);
|
|
144
|
-
const cfg = await providerConfig(source, enterpriseId);
|
|
145
|
-
return fetchBuddyRequestUsage({
|
|
146
|
-
url:
|
|
147
|
-
source === "cb" ? CODEBUDDY_INTL_REQUEST_USAGE_URL : CODEBUDDY_CN_REQUEST_USAGE_URL,
|
|
148
|
-
headers: cfg.headers,
|
|
149
|
-
credential,
|
|
150
|
-
fetcher,
|
|
151
|
-
days,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated from `vendor/qoder-proto/chat.proto` (Qoder desktop client v1.1.81,
|
|
3
|
-
* `qoder-worker-runtime.mjs`). Do not edit by hand — regenerate from the
|
|
4
|
-
* proto file via `scripts/provider-probing/qoder/dev/gen-chat-proto.ts`.
|
|
5
|
-
*/
|
|
6
|
-
export const CHAT_PROTO_SOURCE = `syntax = "proto3";
|
|
7
|
-
|
|
8
|
-
package model.chat;
|
|
9
|
-
|
|
10
|
-
import "google/protobuf/struct.proto";
|
|
11
|
-
import "google/protobuf/wrappers.proto";
|
|
12
|
-
|
|
13
|
-
option java_multiple_files = true;
|
|
14
|
-
option java_package = "com.qoder.grpc.model.chat";
|
|
15
|
-
option java_outer_classname = "ChatProto";
|
|
16
|
-
|
|
17
|
-
// Reasoning effort level for model reasoning
|
|
18
|
-
enum ReasoningEffort {
|
|
19
|
-
REASONING_EFFORT_UNSPECIFIED = 0;
|
|
20
|
-
REASONING_EFFORT_NONE = 1;
|
|
21
|
-
REASONING_EFFORT_LOW = 2;
|
|
22
|
-
REASONING_EFFORT_MEDIUM = 3;
|
|
23
|
-
REASONING_EFFORT_HIGH = 4;
|
|
24
|
-
REASONING_EFFORT_XHIGH = 5;
|
|
25
|
-
REASONING_EFFORT_MAX = 6;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// ─── Request messages ────────────────────────────────────────────────────────
|
|
29
|
-
|
|
30
|
-
// Chat completion request matching OpenAI-compatible API
|
|
31
|
-
message ChatCompletionRequest {
|
|
32
|
-
string model = 1;
|
|
33
|
-
repeated ChatMessage messages = 2;
|
|
34
|
-
google.protobuf.DoubleValue temperature = 3;
|
|
35
|
-
google.protobuf.DoubleValue top_p = 4;
|
|
36
|
-
google.protobuf.Int32Value max_tokens = 5;
|
|
37
|
-
bool stream = 6;
|
|
38
|
-
repeated string stop = 7;
|
|
39
|
-
google.protobuf.DoubleValue presence_penalty = 8;
|
|
40
|
-
google.protobuf.DoubleValue frequency_penalty = 9;
|
|
41
|
-
google.protobuf.Int32Value n = 10;
|
|
42
|
-
google.protobuf.StringValue user = 11;
|
|
43
|
-
google.protobuf.Int32Value seed = 12;
|
|
44
|
-
Reasoning reasoning = 13;
|
|
45
|
-
google.protobuf.BoolValue parallel_tool_calls = 14;
|
|
46
|
-
map<string, double> logit_bias = 15;
|
|
47
|
-
repeated Tool tools = 16;
|
|
48
|
-
google.protobuf.Value tool_choice = 17;
|
|
49
|
-
ResponseFormat response_format = 18;
|
|
50
|
-
repeated string modalities = 19;
|
|
51
|
-
StreamOptions stream_options = 20;
|
|
52
|
-
map<string, ChatPatchList> patches = 21;
|
|
53
|
-
ChatMetadata metadata = 22;
|
|
54
|
-
google.protobuf.Struct extras = 23;
|
|
55
|
-
CustomModelConfig custom_model = 24;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Wrapper for repeated ChatPatch (used in patches map value)
|
|
59
|
-
message ChatPatchList {
|
|
60
|
-
repeated ChatPatch patches = 1;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Chat message in the conversation (request side)
|
|
64
|
-
message ChatMessage {
|
|
65
|
-
string cache_id = 1;
|
|
66
|
-
string role = 2;
|
|
67
|
-
// content can be plain text or a list of multimodal content parts
|
|
68
|
-
oneof content_type {
|
|
69
|
-
string text_content = 3;
|
|
70
|
-
ContentPartList parts_content = 12;
|
|
71
|
-
}
|
|
72
|
-
google.protobuf.StringValue name = 4;
|
|
73
|
-
repeated ToolCall tool_calls = 5;
|
|
74
|
-
google.protobuf.StringValue tool_call_id = 6;
|
|
75
|
-
google.protobuf.StringValue tool_call_call_id = 7;
|
|
76
|
-
google.protobuf.StringValue reasoning_content = 8;
|
|
77
|
-
ReasoningItem reasoning_item = 9;
|
|
78
|
-
google.protobuf.Struct extends = 10;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Wrapper for repeated ContentPart
|
|
82
|
-
message ContentPartList {
|
|
83
|
-
repeated ContentPart parts = 1;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// Content part for multimodal messages
|
|
87
|
-
message ContentPart {
|
|
88
|
-
string type = 1;
|
|
89
|
-
google.protobuf.StringValue text = 2;
|
|
90
|
-
ImageUrl image_url = 3;
|
|
91
|
-
InputAudio input_audio = 4;
|
|
92
|
-
CacheControl cache_control = 5;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
// Cache control configuration for content parts
|
|
96
|
-
message CacheControl {
|
|
97
|
-
string type = 1;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Image URL in message content
|
|
101
|
-
message ImageUrl {
|
|
102
|
-
string url = 1;
|
|
103
|
-
google.protobuf.StringValue detail = 2;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Audio input in message content
|
|
107
|
-
message InputAudio {
|
|
108
|
-
string data = 1;
|
|
109
|
-
string format = 2;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
// Reasoning item for model series (e.g. gpt-5)
|
|
113
|
-
message ReasoningItem {
|
|
114
|
-
string id = 1;
|
|
115
|
-
google.protobuf.StringValue encrypted_content = 2;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// Streaming options
|
|
119
|
-
message StreamOptions {
|
|
120
|
-
google.protobuf.BoolValue include_usage = 1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Tool available for the model to call
|
|
124
|
-
message Tool {
|
|
125
|
-
string cache_id = 1;
|
|
126
|
-
string type = 2;
|
|
127
|
-
Function function = 3;
|
|
128
|
-
Advisor advisor = 4;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
// Function definition
|
|
132
|
-
message Function {
|
|
133
|
-
string name = 1;
|
|
134
|
-
google.protobuf.StringValue description = 2;
|
|
135
|
-
google.protobuf.Struct parameters = 3;
|
|
136
|
-
google.protobuf.BoolValue strict = 4;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Advisor definition
|
|
140
|
-
message Advisor {
|
|
141
|
-
string name = 1;
|
|
142
|
-
string model = 2;
|
|
143
|
-
int32 max_uses = 3;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Tool call made by the assistant
|
|
147
|
-
message ToolCall {
|
|
148
|
-
google.protobuf.StringValue id = 1;
|
|
149
|
-
google.protobuf.StringValue call_id = 2;
|
|
150
|
-
google.protobuf.StringValue type = 3;
|
|
151
|
-
FunctionCall function = 4;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// Function call details
|
|
155
|
-
message FunctionCall {
|
|
156
|
-
string name = 1;
|
|
157
|
-
google.protobuf.Value arguments = 2;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Reasoning configuration
|
|
161
|
-
message Reasoning {
|
|
162
|
-
ReasoningEffort effort = 1;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Response format specification
|
|
166
|
-
message ResponseFormat {
|
|
167
|
-
string type = 1;
|
|
168
|
-
JsonSchema json_schema = 2;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// JSON schema for structured outputs
|
|
172
|
-
message JsonSchema {
|
|
173
|
-
string name = 1;
|
|
174
|
-
google.protobuf.StringValue description = 2;
|
|
175
|
-
google.protobuf.Struct schema = 3;
|
|
176
|
-
google.protobuf.BoolValue strict = 4;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Metadata attached to the chat request
|
|
180
|
-
message ChatMetadata {
|
|
181
|
-
WorkspaceMetadata workspace = 1;
|
|
182
|
-
BusinessMetadata business = 2;
|
|
183
|
-
ContextMetadata context = 3;
|
|
184
|
-
UserMetadata user = 4;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
// Workspace metadata
|
|
188
|
-
message WorkspaceMetadata {
|
|
189
|
-
int32 file_count = 1;
|
|
190
|
-
repeated string languages = 2;
|
|
191
|
-
string codebase_status = 3;
|
|
192
|
-
string codebase_soft_status = 4;
|
|
193
|
-
string codebase_external_id = 5;
|
|
194
|
-
string data_policy = 6;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
// Business metadata
|
|
198
|
-
message BusinessMetadata {
|
|
199
|
-
string id = 1;
|
|
200
|
-
string name = 2;
|
|
201
|
-
int64 begin_at = 3;
|
|
202
|
-
string product = 4;
|
|
203
|
-
string version = 5;
|
|
204
|
-
string type = 6;
|
|
205
|
-
string stage = 7;
|
|
206
|
-
string sub_task = 8;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Context metadata for request tracing and client identification
|
|
210
|
-
message ContextMetadata {
|
|
211
|
-
string request_id = 1;
|
|
212
|
-
string session_id = 2;
|
|
213
|
-
string task_id = 3;
|
|
214
|
-
string request_set_id = 4;
|
|
215
|
-
string machine_id = 5;
|
|
216
|
-
string client_type = 6;
|
|
217
|
-
string source_session_id = 7;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
// User metadata
|
|
221
|
-
message UserMetadata {
|
|
222
|
-
string user_id = 1;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Custom model configuration (bring-your-own-key)
|
|
226
|
-
message CustomModelConfig {
|
|
227
|
-
string name = 1;
|
|
228
|
-
string url = 2;
|
|
229
|
-
string style = 3;
|
|
230
|
-
string provider = 4;
|
|
231
|
-
string type = 5;
|
|
232
|
-
string model = 6;
|
|
233
|
-
google.protobuf.Struct parameters = 7;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
// Patch to apply to the chat request
|
|
237
|
-
message ChatPatch {
|
|
238
|
-
string cache_id = 1;
|
|
239
|
-
string action = 2;
|
|
240
|
-
google.protobuf.Int32Value position = 3;
|
|
241
|
-
google.protobuf.StringValue content = 4;
|
|
242
|
-
google.protobuf.StringValue name = 5;
|
|
243
|
-
google.protobuf.StringValue rename_to = 6;
|
|
244
|
-
google.protobuf.StringValue description = 7;
|
|
245
|
-
google.protobuf.Struct parameters = 8;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// ─── Response messages ───────────────────────────────────────────────────────
|
|
249
|
-
|
|
250
|
-
// Shared response chat message type (used in both streaming delta and
|
|
251
|
-
// non-streaming message fields)
|
|
252
|
-
message ResponseChatMessage {
|
|
253
|
-
string role = 1;
|
|
254
|
-
string content = 2;
|
|
255
|
-
string reasoning_content = 3;
|
|
256
|
-
repeated google.protobuf.Struct tool_calls = 4;
|
|
257
|
-
google.protobuf.Value reasoning_item = 5;
|
|
258
|
-
google.protobuf.Struct extends = 6;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
// Single choice in the non-streaming response
|
|
262
|
-
message NonStreamChoice {
|
|
263
|
-
int32 index = 1;
|
|
264
|
-
ResponseChatMessage message = 2;
|
|
265
|
-
string finish_reason = 3;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Chat completion response (non-streaming)
|
|
269
|
-
message ChatCompletionResponse {
|
|
270
|
-
int64 code = 1;
|
|
271
|
-
string id = 2;
|
|
272
|
-
string object = 3;
|
|
273
|
-
int64 created = 4;
|
|
274
|
-
string model = 5;
|
|
275
|
-
repeated NonStreamChoice choices = 6;
|
|
276
|
-
Usage usage = 7;
|
|
277
|
-
google.protobuf.Struct extras = 8;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
// Single choice in the streaming chunk
|
|
281
|
-
message StreamChoice {
|
|
282
|
-
int32 index = 1;
|
|
283
|
-
ResponseChatMessage delta = 2;
|
|
284
|
-
string finish_reason = 3;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// Streaming response chunk
|
|
288
|
-
message ChatCompletionChunk {
|
|
289
|
-
int64 code = 1;
|
|
290
|
-
string id = 2;
|
|
291
|
-
string object = 3;
|
|
292
|
-
int64 created = 4;
|
|
293
|
-
string model = 5;
|
|
294
|
-
repeated StreamChoice choices = 6;
|
|
295
|
-
Usage usage = 7;
|
|
296
|
-
google.protobuf.Struct extras = 8;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Token usage statistics
|
|
300
|
-
message Usage {
|
|
301
|
-
int32 prompt_tokens = 1;
|
|
302
|
-
int32 completion_tokens = 2;
|
|
303
|
-
int32 total_tokens = 3;
|
|
304
|
-
PromptTokensDetails prompt_tokens_details = 4;
|
|
305
|
-
CompletionTokensDetails completion_tokens_details = 5;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// Prompt token details
|
|
309
|
-
message PromptTokensDetails {
|
|
310
|
-
int32 cached_tokens = 1;
|
|
311
|
-
int32 cacheable_tokens = 2;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// Completion token details
|
|
315
|
-
message CompletionTokensDetails {
|
|
316
|
-
int32 reasoning_tokens = 1;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
// ─── Service definition ──────────────────────────────────────────────────────
|
|
320
|
-
|
|
321
|
-
service ChatService {
|
|
322
|
-
// Unary non-streaming chat completion
|
|
323
|
-
rpc ChatCompletion(ChatCompletionRequest) returns (ChatCompletionResponse);
|
|
324
|
-
|
|
325
|
-
// Server-streaming chat completion; each message is one SSE chunk
|
|
326
|
-
rpc ChatCompletionStream(ChatCompletionRequest) returns (stream ChatCompletionChunk);
|
|
327
|
-
}
|
|
328
|
-
`;
|