cartethyia 2.4.6 → 2.5.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/README.md +45 -13
- package/dist/dashboard/assets/BannedPage-ChqnTRpZ.js +1 -0
- package/dist/dashboard/assets/BannedPage-ChqnTRpZ.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolDetailPage-Bcy150Jo.js → CliToolDetailPage-Bb9CNuoh.js} +1 -1
- package/dist/dashboard/assets/CliToolDetailPage-Bb9CNuoh.js.gz +0 -0
- package/dist/dashboard/assets/{CliToolsPage-DyNXefph.js → CliToolsPage-BXUaRCQQ.js} +1 -1
- package/dist/dashboard/assets/CliToolsPage-BXUaRCQQ.js.gz +0 -0
- package/dist/dashboard/assets/CombosPage-CisNZOUt.js +1 -0
- package/dist/dashboard/assets/CombosPage-CisNZOUt.js.gz +0 -0
- package/dist/dashboard/assets/{ConsoleLogPage-CATpAEOz.js → ConsoleLogPage-BOpI_LOH.js} +1 -1
- package/dist/dashboard/assets/ConsoleLogPage-BOpI_LOH.js.gz +0 -0
- package/dist/dashboard/assets/{CustomizationPage-D6jEU7nL.js → CustomizationPage-DAkdvJ4k.js} +1 -1
- package/dist/dashboard/assets/CustomizationPage-DAkdvJ4k.js.gz +0 -0
- package/dist/dashboard/assets/{HealthEventsModal-CZkpn0a7.js → HealthEventsModal-DeT-VXHd.js} +1 -1
- package/dist/dashboard/assets/HealthEventsModal-DeT-VXHd.js.gz +0 -0
- package/dist/dashboard/assets/{LoginPage-BJlMVN4U.js → LoginPage-CytxSeGP.js} +1 -1
- package/dist/dashboard/assets/LoginPage-CytxSeGP.js.gz +0 -0
- package/dist/dashboard/assets/{ModelPicker-Br3CXEau.js → ModelPicker-oQ-SDXp8.js} +1 -1
- package/dist/dashboard/assets/ModelPicker-oQ-SDXp8.js.gz +0 -0
- package/dist/dashboard/assets/OverviewPage-CU7S1wJs.js +1 -0
- package/dist/dashboard/assets/OverviewPage-CU7S1wJs.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage-DLm2baot.js +3 -0
- package/dist/dashboard/assets/ProviderDetailPage-DLm2baot.js.gz +0 -0
- package/dist/dashboard/assets/ProviderIcon-CmfzxpVM.js +1 -0
- package/dist/dashboard/assets/ProviderIcon-CmfzxpVM.js.gz +0 -0
- package/dist/dashboard/assets/ProvidersPage-DOXfuzfL.js +1 -0
- package/dist/dashboard/assets/ProvidersPage-DOXfuzfL.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-wvk0ciQN.js +7 -0
- package/dist/dashboard/assets/ProxyPage-wvk0ciQN.js.gz +0 -0
- package/dist/dashboard/assets/QuotaPage-Cn_fcUHE.js +1 -0
- package/dist/dashboard/assets/QuotaPage-Cn_fcUHE.js.gz +0 -0
- package/dist/dashboard/assets/{SettingsPage-BHW4Zt06.js → SettingsPage-8-eVadhc.js} +1 -1
- package/dist/dashboard/assets/SettingsPage-8-eVadhc.js.gz +0 -0
- package/dist/dashboard/assets/{SetupPage-VOYC_lIa.js → SetupPage-uEIXPyGO.js} +1 -1
- package/dist/dashboard/assets/SetupPage-uEIXPyGO.js.gz +0 -0
- package/dist/dashboard/assets/SortableList-DCY0TPTZ.js +1 -0
- package/dist/dashboard/assets/SortableList-DCY0TPTZ.js.gz +0 -0
- package/dist/dashboard/assets/{StudioPage-BNIDLiU6.js → StudioPage-DqK5E26W.js} +4 -4
- package/dist/dashboard/assets/StudioPage-DqK5E26W.js.gz +0 -0
- package/dist/dashboard/assets/UsagePage-38JfiZ0H.js +56 -0
- package/dist/dashboard/assets/UsagePage-38JfiZ0H.js.gz +0 -0
- package/dist/dashboard/assets/{api-keys-BETfaMYZ.js → api-keys-BmDbsior.js} +1 -1
- package/dist/dashboard/assets/api-keys-BmDbsior.js.gz +0 -0
- package/dist/dashboard/assets/app-BbpSarVV.css +2 -0
- package/dist/dashboard/assets/app-BbpSarVV.css.gz +0 -0
- package/dist/dashboard/assets/assert-BHfaei-X.js +1 -0
- package/dist/dashboard/assets/assert-BHfaei-X.js.gz +0 -0
- package/dist/dashboard/assets/{badge-BTyGk_DL.js → badge-DpXT4Ixt.js} +1 -1
- package/dist/dashboard/assets/badge-DpXT4Ixt.js.gz +0 -0
- package/dist/dashboard/assets/{banner-bujTWYM4.js → banner-CSAAWLJv.js} +1 -1
- package/dist/dashboard/assets/banner-CSAAWLJv.js.gz +0 -0
- package/dist/dashboard/assets/{card-B0Bnx5CA.js → card-DEhRXXw4.js} +1 -1
- package/dist/dashboard/assets/card-DEhRXXw4.js.gz +0 -0
- package/dist/dashboard/assets/{cli-tools-DE2ug812.js → cli-tools-B0wBq-RL.js} +1 -1
- package/dist/dashboard/assets/cli-tools-B0wBq-RL.js.gz +0 -0
- package/dist/dashboard/assets/{clipboard-button-R_rArH8S.js → clipboard-button-DOo6EU8O.js} +1 -1
- package/dist/dashboard/assets/clipboard-button-DOo6EU8O.js.gz +0 -0
- package/dist/dashboard/assets/{dialog-BWIP_EvW.js → dialog-BvQeBMfP.js} +1 -1
- package/dist/dashboard/assets/dialog-BvQeBMfP.js.gz +0 -0
- package/dist/dashboard/assets/{drawer-BKcgVugF.js → drawer-CMwPXwQB.js} +1 -1
- package/dist/dashboard/assets/drawer-CMwPXwQB.js.gz +0 -0
- package/dist/dashboard/assets/entry--yj84zk3.js +4 -0
- package/dist/dashboard/assets/entry--yj84zk3.js.gz +0 -0
- package/dist/dashboard/assets/{entry-CcWkGR4a.js → entry-D4O2229X.js} +1 -1
- package/dist/dashboard/assets/{entry-CcWkGR4a.js.gz → entry-D4O2229X.js.gz} +0 -0
- package/dist/dashboard/assets/{entry-kTiTFrvh.js → entry-DKvr5Q9K.js} +1 -1
- package/dist/dashboard/assets/entry-DKvr5Q9K.js.gz +0 -0
- package/dist/dashboard/assets/{github-badge-Booc5mNe.js → github-badge-zliLvBwr.js} +1 -1
- package/dist/dashboard/assets/github-badge-zliLvBwr.js.gz +0 -0
- package/dist/dashboard/assets/{index-D70pChfn.js → index-CcD1eSJ6.js} +2 -2
- package/dist/dashboard/assets/index-CcD1eSJ6.js.gz +0 -0
- package/dist/dashboard/assets/{inline-D1TCqM2D.js → inline-D1IlZZ8H.js} +1 -1
- package/dist/dashboard/assets/inline-D1IlZZ8H.js.gz +0 -0
- package/dist/dashboard/assets/{input-B9oyU93y.js → input-BpVZdrbc.js} +1 -1
- package/dist/dashboard/assets/input-BpVZdrbc.js.gz +0 -0
- package/dist/dashboard/assets/{layout-BArzXirQ.js → layout-BioLW7gN.js} +1 -1
- package/dist/dashboard/assets/layout-BioLW7gN.js.gz +0 -0
- package/dist/dashboard/assets/{list-row-BVZzaoHF.js → list-row-CwVcGAIc.js} +1 -1
- package/dist/dashboard/assets/list-row-CwVcGAIc.js.gz +0 -0
- package/dist/dashboard/assets/{live-EmuIayqp.js → live-yfEJFF9T.js} +1 -1
- package/dist/dashboard/assets/live-yfEJFF9T.js.gz +0 -0
- package/dist/dashboard/assets/{model-bans-CSPQ9xB0.js → model-bans-CT-TxSNX.js} +1 -1
- package/dist/dashboard/assets/model-bans-CT-TxSNX.js.gz +0 -0
- package/dist/dashboard/assets/providers/cursor.webp +0 -0
- package/dist/dashboard/assets/providers/trae.webp +0 -0
- package/dist/dashboard/assets/{routing-BExgxxBU.js → routing-Cs6jl49L.js} +1 -1
- package/dist/dashboard/assets/routing-Cs6jl49L.js.gz +0 -0
- package/dist/dashboard/assets/select-XPJ-dIw3.js +41 -0
- package/dist/dashboard/assets/select-XPJ-dIw3.js.gz +0 -0
- package/dist/dashboard/assets/settings-CfcTcOyU.js +1 -0
- package/dist/dashboard/assets/settings-CfcTcOyU.js.gz +0 -0
- package/dist/dashboard/assets/{stack-Ca5HxI5i.js → stack-C9_uUjaA.js} +1 -1
- package/dist/dashboard/assets/stack-C9_uUjaA.js.gz +0 -0
- package/dist/dashboard/assets/{state-CzUPfLXo.js → state-DA0B95UQ.js} +1 -1
- package/dist/dashboard/assets/state-DA0B95UQ.js.gz +0 -0
- package/dist/dashboard/assets/{switch-DOUIky_i.js → switch-Cittxy-x.js} +1 -1
- package/dist/dashboard/assets/switch-Cittxy-x.js.gz +0 -0
- package/dist/dashboard/assets/{toast-C76WrMhc.js → toast-CNt_jzO4.js} +1 -1
- package/dist/dashboard/assets/toast-CNt_jzO4.js.gz +0 -0
- package/dist/dashboard/assets/{useMutation-D87FZwH0.js → useMutation-BQKMcJ1H.js} +1 -1
- package/dist/dashboard/assets/useMutation-BQKMcJ1H.js.gz +0 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/dashboard/index.html.gz +0 -0
- package/dist/dashboard/precompressed-assets.json +51 -52
- package/migrations/full-postgres/0015_add_payload_stages.sql +18 -0
- package/migrations/full-postgres/0016_add_share_link_slug.sql +20 -0
- package/migrations/full-postgres/0017_add_models_pro_only.sql +18 -0
- package/migrations/full-postgres/0018_add_accounts_quota_plan.sql +18 -0
- package/migrations/full-postgres/0019_add_models_free_tier.sql +15 -0
- package/migrations/lite-sqlite3/0015_add_payload_stages.sql +18 -0
- package/migrations/lite-sqlite3/0016_add_share_link_slug.sql +20 -0
- package/migrations/lite-sqlite3/0017_add_models_pro_only.sql +18 -0
- package/migrations/lite-sqlite3/0018_add_accounts_quota_plan.sql +18 -0
- package/migrations/lite-sqlite3/0019_add_models_free_tier.sql +15 -0
- package/package.json +3 -2
- package/scripts/cli/command/console-menu.ts +30 -11
- package/scripts/cli/command/start.ts +77 -13
- package/scripts/cli/command/tray.ts +47 -8
- package/scripts/cli/command/update.ts +1 -1
- package/scripts/cli/gateway/instance-lock.ts +105 -0
- package/scripts/cli/gateway/spawn.ts +173 -101
- package/scripts/cli/ui/background.ts +110 -49
- package/src/boot/app.ts +20 -6
- package/src/boot/dependencies.ts +19 -0
- package/src/boot/elysia-typebox-bridge.ts +37 -0
- package/src/boot/lifecycle.ts +2 -0
- package/src/config/cooldowns.ts +138 -138
- package/src/config/providers.ts +5 -5
- package/src/config/runtime.ts +19 -3
- package/src/config/spec.ts +9 -0
- package/src/console/api-keys/contracts.ts +414 -391
- package/src/console/api-keys/routes.ts +880 -870
- package/src/console/auth/account-reset-store.ts +14 -0
- package/src/console/auth/account-reset.ts +3 -2
- package/src/console/auth/setup-service.ts +6 -3
- package/src/console/domain-registration.ts +9 -2
- package/src/console/observability/contracts.ts +475 -455
- package/src/console/observability/store.ts +1015 -952
- package/src/console/providers/catalog/contracts.ts +31 -0
- package/src/console/providers/catalog/provider-operations.ts +8 -0
- package/src/console/providers/catalog/store.ts +1532 -1525
- package/src/console/providers/oauth/callback-listener.ts +18 -3
- package/src/console/providers/oauth/routes.ts +38 -15
- package/src/console/quota/refresh.ts +19 -0
- package/src/console/updates/routes.ts +162 -4
- package/src/main.ts +3 -0
- package/src/network/http2-bidi.ts +85 -0
- package/src/network/outbound-fetch.ts +1 -26
- package/src/network/pool/agent.ts +478 -460
- package/src/network/pool/resolver.ts +1104 -544
- package/src/network/pool-health-machine.ts +12 -5
- package/src/observability/payload-capture.ts +344 -324
- package/src/persistence/db-pg.ts +9 -3
- package/src/persistence/db-sqlite.ts +497 -495
- package/src/persistence/health-event-flush.ts +137 -0
- package/src/persistence/migrate.ts +181 -129
- package/src/persistence/schema.ts +1360 -1295
- package/src/persistence/settings-revision.ts +25 -0
- package/src/persistence/shared-cache.ts +217 -0
- package/src/persistence/stores/share-store.ts +556 -528
- package/src/persistence/usage-flush.ts +61 -1
- package/src/protocol/canonical-model.ts +23 -1
- package/src/protocol/response/chat.ts +143 -10
- package/src/protocol/response/omp-tool-call-markup.ts +221 -0
- package/src/providers/default-registry.ts +173 -1
- package/src/providers/discovery/openai-model-discovery.ts +39 -3
- package/src/providers/discovery/openrouter-free-roster.ts +98 -0
- package/src/providers/discovery/probing-service.ts +1022 -1001
- package/src/providers/integrations/buddy/buddy-catalog-shared.ts +39 -0
- package/src/providers/integrations/buddy/buddy-chat-shared.ts +913 -914
- package/src/providers/integrations/buddy/buddy-conversation-headers.ts +18 -5
- package/src/providers/integrations/buddy/codebuddy/cn-provider.ts +4 -0
- package/src/providers/integrations/buddy/codebuddy/provider.ts +180 -175
- package/src/providers/integrations/buddy/codebuddy/shared.ts +15 -6
- package/src/providers/integrations/buddy/workbuddy/provider.ts +206 -204
- package/src/providers/integrations/buddy/workbuddy/shared.ts +3 -3
- package/src/providers/integrations/claude/claude.ts +606 -582
- package/src/providers/integrations/cline/cline-quota.ts +18 -16
- package/src/providers/integrations/cline/cline.ts +539 -468
- package/src/providers/integrations/commandcode/commandcode.ts +675 -541
- package/src/providers/integrations/commandcode/discovery.ts +116 -0
- package/src/providers/integrations/commandcode/quota.ts +160 -0
- package/src/providers/integrations/cursor/cursor-auth.ts +418 -0
- package/src/providers/integrations/cursor/cursor-catalog.ts +368 -0
- package/src/providers/integrations/cursor/cursor-http2.ts +300 -0
- package/src/providers/integrations/cursor/cursor-identity.ts +92 -0
- package/src/providers/integrations/cursor/cursor-request.ts +471 -0
- package/src/providers/integrations/cursor/cursor-session-manager.ts +281 -0
- package/src/providers/integrations/cursor/cursor-shared.ts +108 -0
- package/src/providers/integrations/cursor/cursor.ts +960 -0
- package/src/providers/integrations/cursor/protocol/framing.ts +129 -0
- package/src/providers/integrations/cursor/protocol/messages.ts +2355 -0
- package/src/providers/integrations/cursor/protocol/struct.ts +305 -0
- package/src/providers/integrations/github/github.ts +4 -4
- package/src/providers/integrations/hermes.ts +79 -8
- package/src/providers/integrations/kilo/kilo-discovery.ts +10 -1
- package/src/providers/integrations/kilo/kilo.ts +153 -146
- package/src/providers/integrations/opencode/provider.ts +532 -538
- package/src/providers/integrations/openrouter/provider.ts +139 -281
- package/src/providers/integrations/qoder/qoder-catalog.ts +450 -0
- package/src/providers/integrations/qoder/qoder-oauth.ts +310 -257
- package/src/providers/integrations/qoder/qoder-realm.ts +106 -0
- package/src/providers/integrations/qoder/qoder-virtual.ts +77 -0
- package/src/providers/integrations/qoder/qoder.ts +865 -730
- package/src/providers/integrations/trae/trae-catalog.ts +190 -0
- package/src/providers/integrations/trae/trae-headers.ts +149 -0
- package/src/providers/integrations/trae/trae-oauth.ts +773 -0
- package/src/providers/integrations/trae/trae-protocol.ts +400 -0
- package/src/providers/integrations/trae/trae-realm.ts +220 -0
- package/src/providers/integrations/trae/trae.ts +458 -0
- package/src/providers/operations/account-health-service.ts +107 -10
- package/src/providers/operations/client-versions.ts +133 -6
- package/src/providers/operations/provider-catalog-seeder.ts +95 -86
- package/src/providers/operations/provider-credential-service.ts +46 -7
- package/src/providers/provider-contracts.ts +76 -0
- package/src/providers/provider-metadata.ts +78 -6
- package/src/providers/provider-model-definition.ts +373 -349
- package/src/security/api-key-auth.ts +126 -8
- package/src/transport/contracts.ts +3 -0
- package/src/transport/dispatch/attempt-finalize.ts +32 -1
- package/src/transport/dispatch/attempt-loop.ts +530 -515
- package/src/transport/dispatch/generation.ts +88 -21
- package/src/transport/dispatch/leases.ts +99 -2
- package/src/transport/dispatch/proxy-request.ts +60 -3
- package/src/transport/dispatch/streaming/finalize.ts +16 -1
- package/src/transport/dispatch/streaming/stream.ts +22 -2
- package/src/transport/dispatch/upstream.ts +19 -1
- package/src/transport/guards/auth-guard.ts +26 -1
- package/src/transport/guards/body-policy.ts +5 -4
- package/src/transport/request/preparer.ts +103 -0
- package/src/transport/request/state.ts +14 -0
- package/src/transport/routing/plan-gate.ts +45 -0
- package/src/transport/routing/route-catalog.ts +799 -777
- package/src/transport/routing/route-model.ts +52 -1
- package/src/transport/routing/router.ts +51 -0
- package/dist/dashboard/assets/BannedPage-QhvbJB9o.js +0 -1
- package/dist/dashboard/assets/BannedPage-QhvbJB9o.js.gz +0 -0
- package/dist/dashboard/assets/CliToolDetailPage-Bcy150Jo.js.gz +0 -0
- package/dist/dashboard/assets/CliToolsPage-DyNXefph.js.gz +0 -0
- package/dist/dashboard/assets/CombosPage-Cak0ljnO.js +0 -1
- package/dist/dashboard/assets/CombosPage-Cak0ljnO.js.gz +0 -0
- package/dist/dashboard/assets/ConsoleLogPage-CATpAEOz.js.gz +0 -0
- package/dist/dashboard/assets/CustomizationPage-D6jEU7nL.js.gz +0 -0
- package/dist/dashboard/assets/HealthEventsModal-CZkpn0a7.js.gz +0 -0
- package/dist/dashboard/assets/LoginPage-BJlMVN4U.js.gz +0 -0
- package/dist/dashboard/assets/ModelPicker-Br3CXEau.js.gz +0 -0
- package/dist/dashboard/assets/OverviewPage-CQxXbo2g.js +0 -1
- package/dist/dashboard/assets/OverviewPage-CQxXbo2g.js.gz +0 -0
- package/dist/dashboard/assets/ProviderDetailPage--0RBNh99.js +0 -3
- package/dist/dashboard/assets/ProviderDetailPage--0RBNh99.js.gz +0 -0
- package/dist/dashboard/assets/ProviderIcon-paOCq8I0.js +0 -1
- package/dist/dashboard/assets/ProviderIcon-paOCq8I0.js.gz +0 -0
- package/dist/dashboard/assets/ProvidersPage-1M-C3mbu.js +0 -1
- package/dist/dashboard/assets/ProvidersPage-1M-C3mbu.js.gz +0 -0
- package/dist/dashboard/assets/ProxyPage-CXiumA53.js +0 -7
- package/dist/dashboard/assets/ProxyPage-CXiumA53.js.gz +0 -0
- package/dist/dashboard/assets/QuotaPage-BGDIfIYP.js +0 -1
- package/dist/dashboard/assets/QuotaPage-BGDIfIYP.js.gz +0 -0
- package/dist/dashboard/assets/SettingsPage-BHW4Zt06.js.gz +0 -0
- package/dist/dashboard/assets/SetupPage-VOYC_lIa.js.gz +0 -0
- package/dist/dashboard/assets/SortableList-DpOTnGuH.js +0 -1
- package/dist/dashboard/assets/SortableList-DpOTnGuH.js.gz +0 -0
- package/dist/dashboard/assets/StudioPage-BNIDLiU6.js.gz +0 -0
- package/dist/dashboard/assets/UsagePage-BAFaSDQV.js +0 -56
- package/dist/dashboard/assets/UsagePage-BAFaSDQV.js.gz +0 -0
- package/dist/dashboard/assets/api-keys-BETfaMYZ.js.gz +0 -0
- package/dist/dashboard/assets/app-BLCvGdzb.css +0 -2
- package/dist/dashboard/assets/app-BLCvGdzb.css.gz +0 -0
- package/dist/dashboard/assets/assert-7J6_LVD3.js +0 -1
- package/dist/dashboard/assets/assert-7J6_LVD3.js.gz +0 -0
- package/dist/dashboard/assets/badge-BTyGk_DL.js.gz +0 -0
- package/dist/dashboard/assets/banner-bujTWYM4.js.gz +0 -0
- package/dist/dashboard/assets/card-B0Bnx5CA.js.gz +0 -0
- package/dist/dashboard/assets/cli-tools-DE2ug812.js.gz +0 -0
- package/dist/dashboard/assets/clipboard-button-R_rArH8S.js.gz +0 -0
- package/dist/dashboard/assets/dialog-BWIP_EvW.js.gz +0 -0
- package/dist/dashboard/assets/drawer-BKcgVugF.js.gz +0 -0
- package/dist/dashboard/assets/entry-7dpgvpJ3.js +0 -4
- package/dist/dashboard/assets/entry-7dpgvpJ3.js.gz +0 -0
- package/dist/dashboard/assets/entry-kTiTFrvh.js.gz +0 -0
- package/dist/dashboard/assets/github-badge-Booc5mNe.js.gz +0 -0
- package/dist/dashboard/assets/index-D70pChfn.js.gz +0 -0
- package/dist/dashboard/assets/inline-D1TCqM2D.js.gz +0 -0
- package/dist/dashboard/assets/input-B9oyU93y.js.gz +0 -0
- package/dist/dashboard/assets/layout-BArzXirQ.js.gz +0 -0
- package/dist/dashboard/assets/list-row-BVZzaoHF.js.gz +0 -0
- package/dist/dashboard/assets/live-EmuIayqp.js.gz +0 -0
- package/dist/dashboard/assets/model-bans-CSPQ9xB0.js.gz +0 -0
- package/dist/dashboard/assets/routing-BExgxxBU.js.gz +0 -0
- package/dist/dashboard/assets/select-C9mMoEpJ.js +0 -41
- package/dist/dashboard/assets/select-C9mMoEpJ.js.gz +0 -0
- package/dist/dashboard/assets/settings-C4_Gn_wq.js +0 -1
- package/dist/dashboard/assets/settings-C4_Gn_wq.js.gz +0 -0
- package/dist/dashboard/assets/sliders-horizontal-ClG7dBeJ.js +0 -1
- package/dist/dashboard/assets/sliders-horizontal-ClG7dBeJ.js.gz +0 -0
- package/dist/dashboard/assets/stack-Ca5HxI5i.js.gz +0 -0
- package/dist/dashboard/assets/state-CzUPfLXo.js.gz +0 -0
- package/dist/dashboard/assets/switch-DOUIky_i.js.gz +0 -0
- package/dist/dashboard/assets/toast-C76WrMhc.js.gz +0 -0
- package/dist/dashboard/assets/useMutation-D87FZwH0.js.gz +0 -0
- package/src/network/tls/bun-client-hello.ts +0 -112
- /package/dist/dashboard/assets/{app-Cjq7nrwu.js → app-C-Y4oZT0.js} +0 -0
- /package/dist/dashboard/assets/{app-Cjq7nrwu.js.gz → app-C-Y4oZT0.js.gz} +0 -0
|
@@ -1,204 +1,206 @@
|
|
|
1
|
-
// WorkBuddy international adapter — exact provider contract.
|
|
2
|
-
// Canonical provider ID: workbuddy
|
|
3
|
-
// Base (manifest-owned) → Chat: base + /v2/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: official desktop-client identity (WorkBuddy AI brand) with fresh
|
|
7
|
-
// correlation IDs + account-stable device headers per dispatch
|
|
8
|
-
// Payload: leading WorkBuddy system prompt + typed user content, reasoning_summary
|
|
9
|
-
// auto only when reasoning_effort requested
|
|
10
|
-
|
|
11
|
-
import { BuddyMediaAdapter } from "../buddy-media";
|
|
12
|
-
import { providerBaseUrl } from "../../../provider-metadata";
|
|
13
|
-
import { GatewayError } from "../../../../protocol/gateway-error";
|
|
14
|
-
import type { CanonicalRequest } from "../../../../protocol/canonical-model";
|
|
15
|
-
import type { ProviderAdapter, ProviderDispatchContext, ProviderDispatchTarget } from "../../../provider-contracts";
|
|
16
|
-
import type { ModelDefinition } from "../../../provider-model-definition";
|
|
17
|
-
import type { DiscoveryInput } from "../../../discovery/discovery-types";
|
|
18
|
-
import {
|
|
19
|
-
WORKBUDDY_CHAT_PATH,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
//
|
|
45
|
-
// -
|
|
46
|
-
// -
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
//
|
|
127
|
-
//
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
//
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
//
|
|
158
|
-
//
|
|
159
|
-
|
|
160
|
-
...
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
...(input.
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
1
|
+
// WorkBuddy international adapter — exact provider contract.
|
|
2
|
+
// Canonical provider ID: workbuddy
|
|
3
|
+
// Base (manifest-owned) → Chat: base + /v2/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: official desktop-client identity (WorkBuddy AI brand) with fresh
|
|
7
|
+
// correlation IDs + account-stable device headers per dispatch
|
|
8
|
+
// Payload: leading WorkBuddy system prompt + typed user content, reasoning_summary
|
|
9
|
+
// auto only when reasoning_effort requested
|
|
10
|
+
|
|
11
|
+
import { BuddyMediaAdapter } from "../buddy-media";
|
|
12
|
+
import { providerBaseUrl } from "../../../provider-metadata";
|
|
13
|
+
import { GatewayError } from "../../../../protocol/gateway-error";
|
|
14
|
+
import type { CanonicalRequest } from "../../../../protocol/canonical-model";
|
|
15
|
+
import type { ProviderAdapter, ProviderDispatchContext, ProviderDispatchTarget } from "../../../provider-contracts";
|
|
16
|
+
import type { ModelDefinition } from "../../../provider-model-definition";
|
|
17
|
+
import type { DiscoveryInput } from "../../../discovery/discovery-types";
|
|
18
|
+
import {
|
|
19
|
+
WORKBUDDY_CHAT_PATH,
|
|
20
|
+
WORKBUDDY_DOMAIN,
|
|
21
|
+
workbuddyAdapterConfig,
|
|
22
|
+
workbuddyHeaders,
|
|
23
|
+
} from "./shared";
|
|
24
|
+
import {
|
|
25
|
+
BUDDY_SHARED_RAW,
|
|
26
|
+
BUDDY_IMAGE_MODEL_ID_SET,
|
|
27
|
+
BUDDY_VIDEO_MODEL_ID_SET,
|
|
28
|
+
makeBuddyModel,
|
|
29
|
+
makeBuddyImageModels,
|
|
30
|
+
makeBuddyVideoModels,
|
|
31
|
+
type BuddyRawEntry,
|
|
32
|
+
} from "../buddy-catalog-shared";
|
|
33
|
+
import { BUDDY_INTL_MODELS_PATH, fetchBuddyDirectoryModels } from "../buddy-discovery-shared";
|
|
34
|
+
import {
|
|
35
|
+
applyBuddySystemPrompt,
|
|
36
|
+
buddyPrePayloadCommon,
|
|
37
|
+
normalizeBuddyToolNames,
|
|
38
|
+
} from "../buddy-chat-shared";
|
|
39
|
+
|
|
40
|
+
// Constants — public contract
|
|
41
|
+
export const WORKBUDDY_PROVIDER_ID = "workbuddy" as const;
|
|
42
|
+
export const WORKBUDDY_BASE_URL = providerBaseUrl("workbuddy");
|
|
43
|
+
|
|
44
|
+
// Payload hook — provider semantics
|
|
45
|
+
// - force stream=true
|
|
46
|
+
// - reasoning_summary auto only when reasoning_effort requested
|
|
47
|
+
// - leading WorkBuddy system prompt + typed user content normalization
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Leading system turn for this variant.
|
|
51
|
+
*
|
|
52
|
+
* The upstream does validate the leading system turn's *text*, not just that
|
|
53
|
+
* the wire opens with one: sending caller text in its place answers
|
|
54
|
+
* `400 · 11128 "Illegal API invocation from an unapproved channel"` on
|
|
55
|
+
* CodeBuddy, which treats that prompt as the calling channel's identity. So
|
|
56
|
+
* this prompt is a wire contract, not merely a product choice — see the
|
|
57
|
+
* sibling in `codebuddy.ts`. The previous line named the vendor product, which
|
|
58
|
+
* made every request claim an identity the caller never chose.
|
|
59
|
+
*/
|
|
60
|
+
export const WORKBUDDY_SYSTEM_PROMPT =
|
|
61
|
+
"You are a pragmatic and direct software engineering assistant. " +
|
|
62
|
+
"Be honest and truthful: state what you know, say plainly when you are unsure " +
|
|
63
|
+
"or do not know, and never claim to have done something you have not done. " +
|
|
64
|
+
"Prefer concrete answers over filler, and say so when a request is ambiguous " +
|
|
65
|
+
"instead of guessing silently.";
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Reconstructs generic function declarations when a later tool-history turn
|
|
69
|
+
* arrives without the client's current `tools` array. WorkBuddy validates the
|
|
70
|
+
* Chat Completions envelope against every historical tool call, so forwarding
|
|
71
|
+
* `tool_calls`/`tool` messages without declarations yields model_param_invalid.
|
|
72
|
+
*/
|
|
73
|
+
function restoreHistoricalToolDefinitions(
|
|
74
|
+
payload: Record<string, unknown>,
|
|
75
|
+
messages: readonly Record<string, unknown>[],
|
|
76
|
+
): void {
|
|
77
|
+
const historicalNames = new Set<string>();
|
|
78
|
+
for (const message of messages) {
|
|
79
|
+
if (message["role"] !== "assistant" || !Array.isArray(message["tool_calls"])) continue;
|
|
80
|
+
for (const rawCall of message["tool_calls"]) {
|
|
81
|
+
if (!rawCall || typeof rawCall !== "object") continue;
|
|
82
|
+
const call = rawCall as Record<string, unknown>;
|
|
83
|
+
const functionValue =
|
|
84
|
+
call["function"] && typeof call["function"] === "object"
|
|
85
|
+
? (call["function"] as Record<string, unknown>)
|
|
86
|
+
: undefined;
|
|
87
|
+
const name = functionValue?.["name"];
|
|
88
|
+
if (typeof name === "string" && name.trim().length > 0) historicalNames.add(name);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
if (historicalNames.size === 0) return;
|
|
92
|
+
|
|
93
|
+
const existing = Array.isArray(payload["tools"])
|
|
94
|
+
? (payload["tools"] as Array<Record<string, unknown>>)
|
|
95
|
+
: [];
|
|
96
|
+
const definedNames = new Set<string>();
|
|
97
|
+
for (const rawTool of existing) {
|
|
98
|
+
if (!rawTool || typeof rawTool !== "object") continue;
|
|
99
|
+
const tool = rawTool as Record<string, unknown>;
|
|
100
|
+
const functionValue =
|
|
101
|
+
tool["function"] && typeof tool["function"] === "object"
|
|
102
|
+
? (tool["function"] as Record<string, unknown>)
|
|
103
|
+
: tool;
|
|
104
|
+
if (typeof functionValue["name"] === "string") definedNames.add(functionValue["name"]);
|
|
105
|
+
}
|
|
106
|
+
const recovered = [...historicalNames]
|
|
107
|
+
.filter((name) => !definedNames.has(name))
|
|
108
|
+
.map((name) => ({
|
|
109
|
+
type: "function",
|
|
110
|
+
function: {
|
|
111
|
+
name,
|
|
112
|
+
description: "Recovered from historical tool calls.",
|
|
113
|
+
parameters: { type: "object", additionalProperties: true },
|
|
114
|
+
},
|
|
115
|
+
}));
|
|
116
|
+
if (recovered.length > 0) payload["tools"] = [...existing, ...recovered];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
export function workbuddyPrePayload(
|
|
121
|
+
payload: Record<string, unknown>,
|
|
122
|
+
request: CanonicalRequest,
|
|
123
|
+
candidate: ProviderDispatchTarget,
|
|
124
|
+
context?: ProviderDispatchContext,
|
|
125
|
+
): void {
|
|
126
|
+
// International ladder. This hook is shared by `workbuddy` and `workbuddycn`
|
|
127
|
+
// (see workbuddy/cn-provider.ts): the CN effort ladders in the reference
|
|
128
|
+
// gateways are a CodeBuddy-CN concern, so `workbuddycn` deliberately stays on
|
|
129
|
+
// the intl table. Switch to `"cn"` only if a live CN WorkBuddy account proves
|
|
130
|
+
// it serves levels the intl table clamps.
|
|
131
|
+
buddyPrePayloadCommon(payload, request, "intl", context);
|
|
132
|
+
const rawModel = payload["model"];
|
|
133
|
+
const source =
|
|
134
|
+
typeof rawModel === "string" && rawModel.length > 0 ? rawModel : candidate.model_id;
|
|
135
|
+
if (!source) throw new GatewayError("invalid_request", 400, "WorkBuddy model is required");
|
|
136
|
+
const messages = payload["messages"];
|
|
137
|
+
if (Array.isArray(messages)) {
|
|
138
|
+
const normalizedMessages = messages as Array<Record<string, unknown>>;
|
|
139
|
+
applyBuddySystemPrompt(normalizedMessages, WORKBUDDY_SYSTEM_PROMPT);
|
|
140
|
+
restoreHistoricalToolDefinitions(payload, normalizedMessages);
|
|
141
|
+
}
|
|
142
|
+
normalizeBuddyToolNames(payload);
|
|
143
|
+
void request;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Model catalog — WorkBuddy international catalog.
|
|
147
|
+
// Static seed derived from the reference gateway's model.json (context/output
|
|
148
|
+
// limits) plus its global effort table; `reasoning` marks models with a
|
|
149
|
+
// declared reasoning-effort scale.
|
|
150
|
+
const WORKBUDDY_RAW: readonly BuddyRawEntry[] = BUDDY_SHARED_RAW;
|
|
151
|
+
|
|
152
|
+
export function makeWorkBuddyModels(providerId: "workbuddy" | "workbuddycn"): readonly ModelDefinition[] {
|
|
153
|
+
return [
|
|
154
|
+
...WORKBUDDY_RAW.filter(
|
|
155
|
+
(entry) => !BUDDY_IMAGE_MODEL_ID_SET.has(entry[0]) && !BUDDY_VIDEO_MODEL_ID_SET.has(entry[0]),
|
|
156
|
+
).map((entry) => makeBuddyModel(entry, providerId, WORKBUDDY_CHAT_PATH)),
|
|
157
|
+
// WorkBuddy's base URL carries no version segment, so the image rows need the
|
|
158
|
+
// same explicit path the chat rows use — the generic default would produce a
|
|
159
|
+
// URL this upstream answers with a 405.
|
|
160
|
+
...makeBuddyImageModels(providerId, WORKBUDDY_CHAT_PATH),
|
|
161
|
+
...makeBuddyVideoModels(providerId, "/v2/videos/generations"),
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const WORKBUDDY_MODELS: readonly ModelDefinition[] = makeWorkBuddyModels("workbuddy");
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Reads WorkBuddy's live console directory.
|
|
169
|
+
*
|
|
170
|
+
* The static `WORKBUDDY_MODELS` above is the fallback: this is what the "Fetch
|
|
171
|
+
* models" action persists, and it carries the upstream's own limits and
|
|
172
|
+
* capability flags rather than the seed's snapshot of them.
|
|
173
|
+
*/
|
|
174
|
+
export async function discoverWorkBuddyModels(
|
|
175
|
+
input: DiscoveryInput,
|
|
176
|
+
): Promise<readonly ModelDefinition[] | null> {
|
|
177
|
+
return fetchBuddyDirectoryModels({
|
|
178
|
+
siteUrl: WORKBUDDY_BASE_URL,
|
|
179
|
+
providerId: WORKBUDDY_PROVIDER_ID,
|
|
180
|
+
credential: input.credential,
|
|
181
|
+
modelsPath: BUDDY_INTL_MODELS_PATH,
|
|
182
|
+
endpoint: WORKBUDDY_CHAT_PATH,
|
|
183
|
+
...(input.signal ? { signal: input.signal } : {}),
|
|
184
|
+
...(input.fetcher ? { fetcher: input.fetcher } : {}),
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Public factory — uses the OpenAI-compatible factory but forces provider semantics.
|
|
189
|
+
// Supports both api_key and oauth via Authorization Bearer (factory handles both).
|
|
190
|
+
export function createWorkBuddyAdapter(fetchImpl?: typeof fetch): ProviderAdapter {
|
|
191
|
+
return new BuddyMediaAdapter(
|
|
192
|
+
workbuddyAdapterConfig({
|
|
193
|
+
providerId: WORKBUDDY_PROVIDER_ID,
|
|
194
|
+
baseUrl: WORKBUDDY_BASE_URL,
|
|
195
|
+
prePayload: workbuddyPrePayload,
|
|
196
|
+
...(fetchImpl ? { fetchImpl } : {}),
|
|
197
|
+
}),
|
|
198
|
+
{
|
|
199
|
+
variant: "IDE",
|
|
200
|
+
systemPrompt: WORKBUDDY_SYSTEM_PROMPT,
|
|
201
|
+
baseUrl: WORKBUDDY_BASE_URL,
|
|
202
|
+
buildHeaders: (context, request) =>
|
|
203
|
+
workbuddyHeaders(context, request, WORKBUDDY_DOMAIN, undefined, true),
|
|
204
|
+
},
|
|
205
|
+
);
|
|
206
|
+
}
|
|
@@ -117,9 +117,9 @@ export async function workbuddyHeaders(
|
|
|
117
117
|
"x-no-enterprise-id": "1",
|
|
118
118
|
};
|
|
119
119
|
// The conversation/tracing family the upstream's channel check looks for. A
|
|
120
|
-
// live request
|
|
121
|
-
//
|
|
122
|
-
//
|
|
120
|
+
// live request carrying only `x-session-id` was refused for a missing
|
|
121
|
+
// conversation id; the aggregation key below is the one the reference marks
|
|
122
|
+
// mandatory.
|
|
123
123
|
Object.assign(headers, conversation);
|
|
124
124
|
if (accountId) {
|
|
125
125
|
headers["x-user-id"] = accountId;
|