@openchamber/web 2.3.0 → 2.3.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/dist/assets/AboutDialog-C1ulAXh5.js +1 -0
- package/dist/assets/ArchiveView-DJo1Bpw_.js +1 -0
- package/dist/assets/{CommandPalette-1VlA7PbL.js → CommandPalette-B6r6DPF9.js} +2 -2
- package/dist/assets/{DiffView-SHdJJ6tl.js → DiffView-mJuVm7Z4.js} +2 -2
- package/dist/assets/{FilePreviewCommentMenu-DlVgwRsr.js → FilePreviewCommentMenu-Ca4ziuof.js} +1 -1
- package/dist/assets/{FilesView-BeMtsSlV.js → FilesView-BBFbfDp9.js} +3 -3
- package/dist/assets/{GitView-npRGKKx8.js → GitView-WL1wkRFF.js} +3 -3
- package/dist/assets/GuestSurfacePane-peVDY5gW.js +1 -0
- package/dist/assets/HelpDialog-Dxc2yneu.js +1 -0
- package/dist/assets/{InProgressOperationBanner-B6iO22_7.js → InProgressOperationBanner-Dy0RiPsD.js} +1 -1
- package/dist/assets/JsonTreeView-BKUmh7Iw.js +1 -0
- package/dist/assets/MarkdownImageGallery-Cd6hLNmi.js +1 -0
- package/dist/assets/MarkdownRendererImpl-C-3B3mBt.js +1 -0
- package/dist/assets/MemoryDebugPanel-b116r1SF.js +1 -0
- package/dist/assets/OnboardingScreen-vBEhpU3q.js +1 -0
- package/dist/assets/OpenCodeStatusDialog-DH7dJ6MH.js +1 -0
- package/dist/assets/{PatchDiff-Du2s7T3U.js → PatchDiff-yM7vgQgi.js} +1 -1
- package/dist/assets/{PierreDiffViewer-B9K0gBvV.js → PierreDiffViewer-DnHKbYGl.js} +1 -1
- package/dist/assets/{PlanView-IkTcPrbw.js → PlanView-j0hLJmto.js} +2 -2
- package/dist/assets/RunOverview-ZuFZvDcu.js +2 -0
- package/dist/assets/ScheduledTasksDialog-UKXFFI91.js +5 -0
- package/dist/assets/{SettingsView-DIy5ZL4-.js → SettingsView-gB_NvyX4.js} +8 -8
- package/dist/assets/SettingsWindow-Dfb_RFpD.js +1 -0
- package/dist/assets/SourceBoardView-BjaL0nKs.js +1 -0
- package/dist/assets/SpaceAccessDialog-XzHRmIdT.js +1 -0
- package/dist/assets/SpaceApplyDialog-CxX9mrzT.js +1 -0
- package/dist/assets/{SpaceRow-YPmKQKeD.js → SpaceRow-vCpOCANO.js} +1 -1
- package/dist/assets/SpaceSetupOutput-CDZvJCf_.js +1 -0
- package/dist/assets/SpacesView-D3a9bCzn.js +1 -0
- package/dist/assets/{SubmoduleDiffSummary-RDY5md3p.js → SubmoduleDiffSummary-CQyRcvDZ.js} +1 -1
- package/dist/assets/{ToolOutputDialog-Dx85XZJs.js → ToolOutputDialog-judR_5mS.js} +2 -2
- package/dist/assets/{ToolPartDiffPreview-Dtv0xF9O.js → ToolPartDiffPreview-Ca9ISxfg.js} +1 -1
- package/dist/assets/UsageStatsView-C63Emjfj.js +1 -0
- package/dist/assets/{Virtualizer-DL535kyR.js → Virtualizer-DNgIEKcx.js} +1 -1
- package/dist/assets/{WalkthroughView-DcxbT5tc.js → WalkthroughView-D74b_7sC.js} +2 -2
- package/dist/assets/WorktreesView-hcm8Eb_C.js +1 -0
- package/dist/assets/appThemeRegistry-COeayQaQ.js +1 -0
- package/dist/assets/{ar-lP51qqz9.js → ar-1_zdYVV5.js} +2 -2
- package/dist/assets/computeVirtualFileMetrics-MZqvCQy0.js +3 -0
- package/dist/assets/{de-CpROAvTV.js → de-Ci7SGEQP.js} +3 -3
- package/dist/assets/{decorate-BNB7jeKg.js → decorate-CZeRRVC7.js} +1 -1
- package/dist/assets/{es-Bb8LKRhE.js → es-ZJii-6Tt.js} +2 -2
- package/dist/assets/{fr-BlNN9FC2.js → fr-C-hK8mvI.js} +2 -2
- package/dist/assets/{he-r546pCuc.js → he-t07CylP8.js} +2 -2
- package/dist/assets/index-D2tPUss-.js +1 -0
- package/dist/assets/{initializeSharedPreferences-dCHO04bl.js → initializeSharedPreferences-FxFkTjgn.js} +1 -1
- package/dist/assets/{isDiffPlainText-BwicHPpI.js → isDiffPlainText-C1F9opE5.js} +1 -1
- package/dist/assets/{isFilePlainText-Dk2R7BJo.js → isFilePlainText-B4SyJ-ni.js} +1 -1
- package/dist/assets/{ja-evNvJAHz.js → ja-iJr8aONy.js} +2 -2
- package/dist/assets/{katex-CMY-1eWf.css → katex-BEX7X_K8.css} +1 -1
- package/dist/assets/{katex.min-Iw9WSgM9.js → katex.min-C-51hS9A.js} +18 -18
- package/dist/assets/{ko-BPQP7lXe.js → ko-D5ow_yz-.js} +2 -2
- package/dist/assets/main-BtGnuno4.js +1048 -0
- package/dist/assets/main-uj5954n5.js +2 -0
- package/dist/assets/markdownCore-rBXCnAJp.js +9 -0
- package/dist/assets/miniChat-yWQmT2OS.js +2 -0
- package/dist/assets/mobile-NDAeGtzL.js +2 -0
- package/dist/assets/{moveWorkspacePath-B31RGdgu.js → moveWorkspacePath-BINgpJ9S.js} +1 -1
- package/dist/assets/{nl-CkQXd1nU.js → nl-CfqYrSVe.js} +2 -2
- package/dist/assets/{parseDiffFromFile-DcsKSY0J.js → parseDiffFromFile--DE4eHIp.js} +2 -2
- package/dist/assets/{patchFileDiff-Cx-HpjyI.js → patchFileDiff-BfFUmWgS.js} +1 -1
- package/dist/assets/pierreDiffTint-D9K6_CVD.js +29 -0
- package/dist/assets/{pl-C4i9Aizi.js → pl-Bn2_jAhL.js} +4 -4
- package/dist/assets/{pt-BR-CoYnG1CH.js → pt-BR-ZSDgn6cI.js} +2 -2
- package/dist/assets/relocateRestoredSession-C85Tk2y9.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-BvAEmWhZ.js +2 -0
- package/dist/assets/{renderMobileApp-gDKxRJQi.js → renderMobileApp-T20l8ise.js} +7 -7
- package/dist/assets/{restartOpenCode-dq-SGun3.js → restartOpenCode-VEmIrLer.js} +1 -1
- package/dist/assets/runtimeEndpointReset-ExJsaWzA.js +55 -0
- package/dist/assets/scheduledTasksApi-NSyxVfHu.js +1 -0
- package/dist/assets/{selectionMarkdown-sDTBbKLh.js → selectionMarkdown-BJ2RhTXc.js} +2 -2
- package/dist/assets/{sessionOwnership-kZAtwMQd.js → sessionOwnership-BAX1xEJC.js} +1 -1
- package/dist/assets/{shikiHighlight-BRNXPlF-.js → shikiHighlight-DOzrE7BE.js} +1 -1
- package/dist/assets/{space-apply-CCOKLfrX.js → space-apply-DB_ZfJBW.js} +1 -1
- package/dist/assets/space-close-1kNlTkW1.js +1 -0
- package/dist/assets/{spaceNetwork-DUxJClu3.js → spaceNetwork-DA16ov_y.js} +1 -1
- package/dist/assets/{textMateThemeFromAppTheme-B6UJwdZz.js → textMateThemeFromAppTheme-BfIrjFAU.js} +1 -1
- package/dist/assets/{tr-D-_lz-lC.js → tr-C89uz1hs.js} +2 -2
- package/dist/assets/{uk-B49PGMYB.js → uk-uTYVPFrO.js} +2 -2
- package/dist/assets/{useAppFontEffects-3EN8Ava3.js → useAppFontEffects-C1ceAD51.js} +185 -185
- package/dist/assets/useCallableModelProviders-BkLsgs6y.js +1 -0
- package/dist/assets/{useInlineCommentController-l9cWyfuR.js → useInlineCommentController-ynkUsoVA.js} +1 -1
- package/dist/assets/{useRootScrollLock-UAQn24Y8.js → useRootScrollLock-DnoKH1HE.js} +2 -2
- package/dist/assets/{vendor-codemirror-autocomplete-C8FBSI9t.js → vendor-codemirror-autocomplete-BRKmCSiY.js} +1 -1
- package/dist/assets/{vendor-codemirror-commands-BhRb6jns.js → vendor-codemirror-commands-MmBpgSOc.js} +1 -1
- package/dist/assets/vendor-codemirror-lang-angular-Bj5Pk8sp.js +1 -0
- package/dist/assets/vendor-codemirror-lang-cpp-tZt-BOgi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-css-DfdrZ848.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-go-BHJEONih.js → vendor-codemirror-lang-go-C9OcoXdP.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-html-C5kFuJzc.js +1 -0
- package/dist/assets/vendor-codemirror-lang-java-Divn2dnj.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-javascript-CUmSxayT.js → vendor-codemirror-lang-javascript-DmPuKUEa.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-jinja-B-8miA-Q.js +1 -0
- package/dist/assets/vendor-codemirror-lang-json-L0wsFFxi.js +1 -0
- package/dist/assets/vendor-codemirror-lang-less-CWlCIxCI.js +1 -0
- package/dist/assets/vendor-codemirror-lang-liquid-Dm8xthAW.js +1 -0
- package/dist/assets/vendor-codemirror-lang-markdown-CPn-qinN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-php-DKIOifjN.js +1 -0
- package/dist/assets/vendor-codemirror-lang-python-BAVa3Hg5.js +3 -0
- package/dist/assets/vendor-codemirror-lang-rust-Dab90hdg.js +1 -0
- package/dist/assets/vendor-codemirror-lang-sass-eezaHFBZ.js +1 -0
- package/dist/assets/{vendor-codemirror-lang-sql-C1Jj9uuJ.js → vendor-codemirror-lang-sql-Vu-PR7cv.js} +2 -2
- package/dist/assets/vendor-codemirror-lang-vue-BthRGZHy.js +1 -0
- package/dist/assets/vendor-codemirror-lang-wast-Db6KSic0.js +1 -0
- package/dist/assets/vendor-codemirror-lang-xml-DQkh4sc1.js +1 -0
- package/dist/assets/vendor-codemirror-lang-yaml-Bt2N__AW.js +1 -0
- package/dist/assets/vendor-codemirror-language-DkBxRck3.js +3 -0
- package/dist/assets/vendor-codemirror-language-data-CTYHXywt.js +2 -0
- package/dist/assets/{vendor-codemirror-search-CvXM_pZg.js → vendor-codemirror-search-BKAwkhkm.js} +1 -1
- package/dist/assets/vendor-codemirror-streamparser-CmlTsbN2.js +1 -0
- package/dist/assets/vendor-codemirror-view-B66jUSmE.js +4 -0
- package/dist/assets/{vendor-replit-codemirror-vim-Ck2X_WZC.js → vendor-replit-codemirror-vim-D0bqFa1D.js} +5 -5
- package/dist/assets/{worker-DdhrXE7g.js → worker-BbEdJ2Oi.js} +18 -18
- package/dist/assets/workerFactory-Bw5qLmrM.js +1 -0
- package/dist/assets/{zh-CN-CS-9Os9n.js → zh-CN-DdTNG52a.js} +2 -2
- package/dist/assets/{zh-TW-D0XYVdcl.js → zh-TW-DPm_33Fi.js} +2 -2
- package/dist/index.html +3 -3
- package/dist/mini-chat.html +3 -3
- package/dist/mobile.html +3 -3
- package/package.json +2 -2
- package/server/index.js +4 -0
- package/server/lib/environment/store.js +3 -4
- package/server/lib/environment/store.test.js +17 -0
- package/server/lib/fs/DOCUMENTATION.md +4 -2
- package/server/lib/fs/routes.js +48 -13
- package/server/lib/fs/routes.test.js +118 -5
- package/server/lib/git/DOCUMENTATION.md +3 -1
- package/server/lib/git/contributor-remote.js +4 -0
- package/server/lib/git/contributor-remote.test.js +21 -0
- package/server/lib/git/service.js +20 -25
- package/server/lib/git/service.test.js +99 -0
- package/server/lib/git/worktree-creation.js +4 -5
- package/server/lib/github/DOCUMENTATION.md +1 -1
- package/server/lib/github/routes.auth.test.js +14 -0
- package/server/lib/github/routes.js +13 -5
- package/server/lib/github/routes.mutations.test.js +18 -2
- package/server/lib/message-queue/DOCUMENTATION.md +8 -2
- package/server/lib/message-queue/runtime.js +3 -2
- package/server/lib/message-queue/runtime.test.js +64 -2
- package/server/lib/openchamber-control/service.js +48 -13
- package/server/lib/openchamber-control/service.test.js +42 -0
- package/server/lib/opencode/DOCUMENTATION.md +3 -1
- package/server/lib/opencode/project-start-command.d.ts +11 -0
- package/server/lib/opencode/project-start-command.js +56 -0
- package/server/lib/opencode/project-start-command.test.js +80 -0
- package/server/lib/opencode/session-activity.js +43 -3
- package/server/lib/opencode/session-activity.test.js +97 -0
- package/server/lib/opencode/settings-runtime.js +19 -1
- package/server/lib/opencode/settings-runtime.test.js +23 -0
- package/server/lib/opencode/skill-routes.js +34 -1
- package/server/lib/opencode/skill-routes.test.js +99 -0
- package/server/lib/quota/DOCUMENTATION.md +13 -1
- package/server/lib/quota/providers/antigravity/api.js +104 -0
- package/server/lib/quota/providers/antigravity/auth.js +45 -0
- package/server/lib/quota/providers/antigravity/index.js +76 -0
- package/server/lib/quota/providers/antigravity/transforms.js +168 -0
- package/server/lib/quota/providers/antigravity/transforms.test.js +162 -0
- package/server/lib/quota/providers/codex.js +28 -4
- package/server/lib/quota/providers/codex.test.js +29 -0
- package/server/lib/quota/providers/google/auth.js +4 -49
- package/server/lib/quota/providers/google/transforms.js +3 -22
- package/server/lib/quota/providers/index.js +8 -0
- package/server/lib/quota/providers/opencode-go.js +3 -1
- package/server/lib/quota/providers/opencode-go.test.js +12 -0
- package/server/lib/routing/DOCUMENTATION.md +3 -1
- package/server/lib/routing/runtime.js +34 -1
- package/server/lib/routing/runtime.test.js +43 -1
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +11 -0
- package/server/lib/scheduled-tasks/existing-session.js +52 -8
- package/server/lib/scheduled-tasks/existing-session.test.js +121 -0
- package/server/lib/scheduled-tasks/routes.js +26 -0
- package/server/lib/scheduled-tasks/runtime.js +1 -0
- package/server/lib/session-assist/runtime.js +3 -0
- package/server/lib/session-assist/runtime.test.js +47 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +10 -1
- package/server/lib/skills-catalog/install.js +1 -1
- package/server/lib/skills-catalog/installed-sources.d.ts +17 -0
- package/server/lib/skills-catalog/installed-sources.js +112 -0
- package/server/lib/skills-catalog/installed-sources.test.js +94 -0
- package/server/lib/small-model/DOCUMENTATION.md +12 -5
- package/server/lib/small-model/index.js +6 -4
- package/server/lib/small-model/index.test.js +40 -0
- package/server/lib/small-model/routes.js +3 -2
- package/server/lib/source-control/change-request-worktree.js +2 -6
- package/server/lib/source-control/mutation-storage.js +4 -1
- package/server/lib/source-control/mutation-storage.test.js +21 -0
- package/server/lib/spaces/DOCUMENTATION.md +1 -1
- package/server/lib/spaces/journey.js +10 -3
- package/server/lib/spaces/journey.test.js +13 -1
- package/server/lib/terminal/history.js +22 -2
- package/server/lib/terminal/history.test.js +23 -0
- package/server/lib/terminal/theme-response.js +14 -0
- package/server/lib/terminal/theme-response.test.js +10 -0
- package/dist/assets/AboutDialog-e8ek_kPI.js +0 -1
- package/dist/assets/ArchiveView-CjF4_TFg.js +0 -1
- package/dist/assets/GuestSurfacePane-4kmEXPLD.js +0 -1
- package/dist/assets/HelpDialog-CITMqPDK.js +0 -1
- package/dist/assets/JsonTreeView-xGikhCtL.js +0 -1
- package/dist/assets/MarkdownImageGallery-D0FJyr7C.js +0 -1
- package/dist/assets/MarkdownRendererImpl-BIM7Pjwk.js +0 -1
- package/dist/assets/MemoryDebugPanel-CBk8QW-M.js +0 -1
- package/dist/assets/OnboardingScreen-Cy6ARiMS.js +0 -1
- package/dist/assets/OpenCodeStatusDialog-YMHuJzwt.js +0 -1
- package/dist/assets/RunOverview-CHkGSW1x.js +0 -2
- package/dist/assets/ScheduledTasksDialog-77SO8zdJ.js +0 -4
- package/dist/assets/SettingsWindow-X74FIkdo.js +0 -1
- package/dist/assets/SourceBoardView-Cff2ejOW.js +0 -1
- package/dist/assets/SpaceAccessDialog-BXMZNRei.js +0 -1
- package/dist/assets/SpaceApplyDialog-BEJd2ryu.js +0 -1
- package/dist/assets/SpaceSetupOutput-Cb3XcIII.js +0 -1
- package/dist/assets/SpacesView-I3HaRKtW.js +0 -1
- package/dist/assets/UsageStatsView-DwTt9zIz.js +0 -1
- package/dist/assets/WorktreesView-Bh7GLvrR.js +0 -1
- package/dist/assets/appThemeRegistry-Bzb67M9O.js +0 -1
- package/dist/assets/computeVirtualFileMetrics-WAp98Bb7.js +0 -3
- package/dist/assets/index-BsupKM40.js +0 -1
- package/dist/assets/main-C_QGhDBL.js +0 -1048
- package/dist/assets/main-pWZ7F_hy.js +0 -2
- package/dist/assets/markdownCore-6gz4uJDQ.js +0 -9
- package/dist/assets/miniChat-DnaTfdYh.js +0 -2
- package/dist/assets/mobile-C7DIJqP8.js +0 -2
- package/dist/assets/pierreDiffTint-B297eqF0.js +0 -28
- package/dist/assets/relocateRestoredSession-D3lujODj.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-BF4hNe69.js +0 -2
- package/dist/assets/runtimeEndpointReset-D6Lxhk0S.js +0 -55
- package/dist/assets/scheduledTasksApi-DUbAMrjW.js +0 -1
- package/dist/assets/space-close-CWcWwH4_.js +0 -1
- package/dist/assets/useCallableModelProviders-BB9xkUzM.js +0 -1
- package/dist/assets/vendor-codemirror-lang-angular-BpYCRJSk.js +0 -1
- package/dist/assets/vendor-codemirror-lang-cpp-BI3uPyjT.js +0 -1
- package/dist/assets/vendor-codemirror-lang-css-B2_PZTBl.js +0 -1
- package/dist/assets/vendor-codemirror-lang-html-BpvvTxbZ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-java-BM5LQZ4u.js +0 -1
- package/dist/assets/vendor-codemirror-lang-jinja-D8nLZQPK.js +0 -1
- package/dist/assets/vendor-codemirror-lang-json-VDxF27mO.js +0 -1
- package/dist/assets/vendor-codemirror-lang-less-BecU2BJP.js +0 -1
- package/dist/assets/vendor-codemirror-lang-liquid-DCw83Anh.js +0 -1
- package/dist/assets/vendor-codemirror-lang-markdown-CimQAQbQ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-php-C5Kpnpyb.js +0 -1
- package/dist/assets/vendor-codemirror-lang-python-BFE1OJNx.js +0 -3
- package/dist/assets/vendor-codemirror-lang-rust-hqZDyGIJ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-sass-CAZML-Jl.js +0 -1
- package/dist/assets/vendor-codemirror-lang-vue-BHOTXcKp.js +0 -1
- package/dist/assets/vendor-codemirror-lang-wast-DcCHfPUI.js +0 -1
- package/dist/assets/vendor-codemirror-lang-xml-BO_V-1wZ.js +0 -1
- package/dist/assets/vendor-codemirror-lang-yaml-CPimap_N.js +0 -1
- package/dist/assets/vendor-codemirror-language-BBADuAkg.js +0 -3
- package/dist/assets/vendor-codemirror-language-data-Cu5ZbrPm.js +0 -2
- package/dist/assets/vendor-codemirror-view-1e0FQ6Wn.js +0 -4
- package/dist/assets/workerFactory-De9YXIdE.js +0 -1
|
@@ -12,6 +12,7 @@ extension applies the same policy in its own process at activation.
|
|
|
12
12
|
- `packages/web/server/lib/quota/index.js`: public entrypoint imported by `packages/web/server/index.js`.
|
|
13
13
|
- `packages/web/server/lib/quota/routes.js`: Express route registration for quota endpoints.
|
|
14
14
|
- `packages/web/server/lib/quota/providers/index.js`: provider registry, configured-provider list, and provider dispatcher.
|
|
15
|
+
- `packages/web/server/lib/quota/providers/antigravity/`: Antigravity-specific auth, API, and transform modules.
|
|
15
16
|
- `packages/web/server/lib/quota/providers/google/`: Google-specific auth, API, and transform modules.
|
|
16
17
|
- `packages/web/server/lib/quota/providers/claude/`: Claude credential discovery, usage transforms, and rate-limit handling.
|
|
17
18
|
- `packages/web/server/lib/quota/utils/`: shared auth, transform, and formatting helpers.
|
|
@@ -30,6 +31,7 @@ asked, `/api/quota/providers` answers 500 instead of an empty list.
|
|
|
30
31
|
|
|
31
32
|
| Provider ID | Display name | Module | Auth aliases/keys |
|
|
32
33
|
| --- | --- | --- | --- |
|
|
34
|
+
| `antigravity` | Antigravity | `providers/antigravity/index.js` | Antigravity accounts file (`~/.config/opencode/antigravity-accounts.json` or the `$OPENCODE_CONFIG_DIR` equivalent) |
|
|
33
35
|
| `claude` | Claude | `providers/claude/` | Claude Code Keychain entry, Claude Code credentials file, OpenCode `auth.json` (`anthropic`, `claude`), `CLAUDE_CODE_OAUTH_TOKEN` |
|
|
34
36
|
| `cline-pass` | ClinePass | `providers/cline-pass.js` | `cline-pass` (API key under `key` or `token`) |
|
|
35
37
|
| `codex` | Codex | `providers/codex.js` | `openai`, `codex`, `chatgpt` |
|
|
@@ -38,7 +40,7 @@ asked, `/api/quota/providers` answers 500 instead of an empty list.
|
|
|
38
40
|
| `deepinfra` | DeepInfra | `providers/deepinfra.js` | `deepinfra`, `deep-infra`, `deep_infra` (API key under `key` or `token`) |
|
|
39
41
|
| `deepseek` | DeepSeek | `providers/deepseek.js` | `deepseek` (API key under `key` or `token`) |
|
|
40
42
|
| `exe-dev` | exe.dev | `providers/exe-dev.js` | Usage API token stored under `~/.config/openchamber/quota/` |
|
|
41
|
-
| `google` | Google | `providers/google/index.js` | `google`, `google.oauth
|
|
43
|
+
| `google` | Google | `providers/google/index.js` | `google`, `google.oauth` |
|
|
42
44
|
| `hyper` | Charm Hyper | `providers/hyper.js` | `hyper` (API key under `key` or `token`) |
|
|
43
45
|
| `github-copilot` | GitHub Copilot | `providers/copilot.js` | `github-copilot`, `copilot` |
|
|
44
46
|
| `github-copilot-addon` | GitHub Copilot Add-on | `providers/copilot.js` | `github-copilot`, `copilot` |
|
|
@@ -92,6 +94,8 @@ On the first OpenCode Go usage refresh after upgrading, OpenChamber deletes the
|
|
|
92
94
|
|
|
93
95
|
Codex `credits.balance` is an OpenAI credit count, not a dollar amount. Web/Electron and VS Code expose it as a plain numeric `credits_balance.valueLabel` under the UI's localized Credits Balance title, without a currency symbol or two-decimal money rounding. Numeric strings are accepted; zero, unlimited, and unavailable balances retain their existing handling. Keep `providers/codex.js` and `packages/vscode/src/quotaProviders.ts` in sync. The separate business-account `spend_control.individual_limit` window is unchanged.
|
|
94
96
|
|
|
97
|
+
A Codex usage 401 whose body has `error.type: "rejected_by_access_enforcement"` means the sign-in may not read usage (OpenCode's `chatgpt-token-sharing` method hits it) while the session itself is valid, so both runtimes report usage as unavailable for the sign-in method. Any other 401 reads as an expired session. Web and VS Code keep this branch identical.
|
|
98
|
+
|
|
95
99
|
## Claude credential and limit semantics
|
|
96
100
|
|
|
97
101
|
Claude quota reports the subscription limits Claude Code itself is bound by, read from `GET https://api.anthropic.com/api/oauth/usage`.
|
|
@@ -122,6 +126,14 @@ xAI quota reports the SuperGrok billing cycle from `POST https://grok.com/grok_a
|
|
|
122
126
|
6. Update this file with the new provider ID, module path, and alias/auth details.
|
|
123
127
|
7. Validate with `bun run type-check`, `bun run lint`, and `bun run build`.
|
|
124
128
|
|
|
129
|
+
## Antigravity quota and limit semantics
|
|
130
|
+
|
|
131
|
+
Antigravity reports dual-layer quota for Google Cloud Code / Antigravity IDE accounts, querying Google's `retrieveUserQuotaSummary` endpoint (falling back to `daily-cloudcode-pa.googleapis.com` and `fetchAvailableModels` flat quotaInfo).
|
|
132
|
+
|
|
133
|
+
- **Windows**: each model row carries its group's rolling 5-hour (`5h`) and 7-day weekly (`weekly`) limits across Gemini and 3P (Claude/GPT) model groups. The provider card itself exposes no top-level windows (`windows: {}`), matching the Google provider: one overview row could only reflect a single group and would mislead a user whose tighter limit lives in the other group.
|
|
134
|
+
- **Bottleneck prioritization**: when a group's weekly limit is exhausted or more constrained than its 5-hour limit, the weekly window is prioritized first in the model's window map.
|
|
135
|
+
- **Runtime parity**: `packages/web/server/lib/quota/providers/antigravity/` and `packages/vscode/src/quotaProviders.ts` (`fetchAntigravityQuota`) implement the same summary parsing, fallback chain, and bottleneck ordering — keep them in sync.
|
|
136
|
+
|
|
125
137
|
## MiniMax M3 / Token Plan migration
|
|
126
138
|
|
|
127
139
|
In 2025/2026 MiniMax rebranded "Coding Plan" to "Token Plan" alongside the M3 model release. The API underwent breaking changes:
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Provider - API
|
|
3
|
+
*
|
|
4
|
+
* API calls for Antigravity quota provider.
|
|
5
|
+
* @module quota/providers/antigravity/api
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { asNonEmptyString } from '../../utils/index.js';
|
|
9
|
+
|
|
10
|
+
const ANTIGRAVITY_GOOGLE_CLIENT_ID =
|
|
11
|
+
'1071006060591-tmhssin2h21lcre235vtolojh4g403ep.apps.googleusercontent.com';
|
|
12
|
+
const ANTIGRAVITY_GOOGLE_CLIENT_SECRET =
|
|
13
|
+
'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';
|
|
14
|
+
|
|
15
|
+
const ANTIGRAVITY_ENDPOINTS = [
|
|
16
|
+
'https://daily-cloudcode-pa.googleapis.com',
|
|
17
|
+
'https://daily-cloudcode-pa.sandbox.googleapis.com',
|
|
18
|
+
'https://cloudcode-pa.googleapis.com'
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const ANTIGRAVITY_HEADERS = {
|
|
22
|
+
'User-Agent': 'antigravity/1.11.5 windows/amd64',
|
|
23
|
+
'X-Goog-Api-Client': 'google-cloud-sdk vscode_cloudshelleditor/0.1',
|
|
24
|
+
'Client-Metadata':
|
|
25
|
+
'{"ideType":"IDE_UNSPECIFIED","platform":"PLATFORM_UNSPECIFIED","pluginType":"GEMINI"}'
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const refreshAntigravityToken = async (refreshToken) => {
|
|
29
|
+
try {
|
|
30
|
+
const response = await fetch('https://oauth2.googleapis.com/token', {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
33
|
+
body: new URLSearchParams({
|
|
34
|
+
client_id: ANTIGRAVITY_GOOGLE_CLIENT_ID,
|
|
35
|
+
client_secret: ANTIGRAVITY_GOOGLE_CLIENT_SECRET,
|
|
36
|
+
refresh_token: refreshToken,
|
|
37
|
+
grant_type: 'refresh_token'
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (!response.ok) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const data = await response.json();
|
|
46
|
+
return asNonEmptyString(data?.access_token);
|
|
47
|
+
} catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const fetchAntigravityModels = async (accessToken, projectId) => {
|
|
53
|
+
const body = projectId ? { project: projectId } : {};
|
|
54
|
+
|
|
55
|
+
for (const endpoint of ANTIGRAVITY_ENDPOINTS) {
|
|
56
|
+
try {
|
|
57
|
+
const response = await fetch(`${endpoint}/v1internal:fetchAvailableModels`, {
|
|
58
|
+
method: 'POST',
|
|
59
|
+
headers: {
|
|
60
|
+
Authorization: `Bearer ${accessToken}`,
|
|
61
|
+
'Content-Type': 'application/json',
|
|
62
|
+
...ANTIGRAVITY_HEADERS
|
|
63
|
+
},
|
|
64
|
+
body: JSON.stringify(body),
|
|
65
|
+
signal: AbortSignal.timeout(15000)
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
if (response.ok) {
|
|
69
|
+
return await response.json();
|
|
70
|
+
}
|
|
71
|
+
} catch {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return null;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const fetchAntigravityQuotaSummary = async (accessToken, projectId) => {
|
|
80
|
+
const body = projectId ? { project: projectId } : {};
|
|
81
|
+
|
|
82
|
+
for (const endpoint of ANTIGRAVITY_ENDPOINTS) {
|
|
83
|
+
try {
|
|
84
|
+
const response = await fetch(`${endpoint}/v1internal:retrieveUserQuotaSummary`, {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: `Bearer ${accessToken}`,
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
...ANTIGRAVITY_HEADERS
|
|
90
|
+
},
|
|
91
|
+
body: JSON.stringify(body),
|
|
92
|
+
signal: AbortSignal.timeout(15000)
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
if (response.ok) {
|
|
96
|
+
return await response.json();
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return null;
|
|
104
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Provider - Auth
|
|
3
|
+
*
|
|
4
|
+
* Authentication resolution logic for Antigravity quota provider.
|
|
5
|
+
* @module quota/providers/antigravity/auth
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
ANTIGRAVITY_ACCOUNTS_PATHS,
|
|
10
|
+
readJsonFile,
|
|
11
|
+
asNonEmptyString,
|
|
12
|
+
toNumber
|
|
13
|
+
} from '../../utils/index.js';
|
|
14
|
+
import { parseGoogleRefreshToken } from '../google/transforms.js';
|
|
15
|
+
|
|
16
|
+
export const DEFAULT_PROJECT_ID = 'rising-fact-p41fc';
|
|
17
|
+
|
|
18
|
+
export const resolveAntigravityAuth = () => {
|
|
19
|
+
for (const filePath of ANTIGRAVITY_ACCOUNTS_PATHS) {
|
|
20
|
+
const data = readJsonFile(filePath);
|
|
21
|
+
const accounts = data?.accounts;
|
|
22
|
+
if (Array.isArray(accounts) && accounts.length > 0) {
|
|
23
|
+
const parsedIndex = toNumber(data.activeIndex);
|
|
24
|
+
const index = parsedIndex !== null ? parsedIndex : 0;
|
|
25
|
+
const account = accounts[index] ?? accounts[0];
|
|
26
|
+
if (account?.refreshToken) {
|
|
27
|
+
const refreshParts = parseGoogleRefreshToken(account.refreshToken);
|
|
28
|
+
return {
|
|
29
|
+
sourceId: 'antigravity',
|
|
30
|
+
sourceLabel: 'Antigravity',
|
|
31
|
+
refreshToken: refreshParts.refreshToken,
|
|
32
|
+
projectId: asNonEmptyString(account.projectId)
|
|
33
|
+
?? asNonEmptyString(account.managedProjectId)
|
|
34
|
+
?? refreshParts.projectId
|
|
35
|
+
?? refreshParts.managedProjectId,
|
|
36
|
+
email: account.email
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return null;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const isConfigured = () => resolveAntigravityAuth() !== null;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Quota Provider
|
|
3
|
+
*
|
|
4
|
+
* Dedicated quota provider for Google Cloud Code Antigravity IDE and proxy tools.
|
|
5
|
+
* Supports dual-layer quotas: 5-Hour rolling limits and 7-Day weekly limits.
|
|
6
|
+
* @module quota/providers/antigravity
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { buildResult } from '../../utils/index.js';
|
|
10
|
+
import { resolveAntigravityAuth, isConfigured, DEFAULT_PROJECT_ID } from './auth.js';
|
|
11
|
+
import {
|
|
12
|
+
refreshAntigravityToken,
|
|
13
|
+
fetchAntigravityModels,
|
|
14
|
+
fetchAntigravityQuotaSummary
|
|
15
|
+
} from './api.js';
|
|
16
|
+
import { transformSummary, transformModels } from './transforms.js';
|
|
17
|
+
|
|
18
|
+
export { isConfigured } from './auth.js';
|
|
19
|
+
|
|
20
|
+
export const providerId = 'antigravity';
|
|
21
|
+
export const providerName = 'Antigravity';
|
|
22
|
+
|
|
23
|
+
export const fetchQuota = async () => {
|
|
24
|
+
const auth = resolveAntigravityAuth();
|
|
25
|
+
if (!auth) {
|
|
26
|
+
return buildResult({
|
|
27
|
+
providerId,
|
|
28
|
+
providerName,
|
|
29
|
+
ok: false,
|
|
30
|
+
configured: false,
|
|
31
|
+
error: 'Not configured'
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const accessToken = await refreshAntigravityToken(auth.refreshToken);
|
|
36
|
+
if (!accessToken) {
|
|
37
|
+
return buildResult({
|
|
38
|
+
providerId,
|
|
39
|
+
providerName,
|
|
40
|
+
ok: false,
|
|
41
|
+
configured: true,
|
|
42
|
+
error: 'Failed to refresh Antigravity token'
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const projectId = auth.projectId ?? DEFAULT_PROJECT_ID;
|
|
47
|
+
|
|
48
|
+
const [summaryPayload, modelsPayload] = await Promise.all([
|
|
49
|
+
fetchAntigravityQuotaSummary(accessToken, projectId),
|
|
50
|
+
fetchAntigravityModels(accessToken, projectId)
|
|
51
|
+
]);
|
|
52
|
+
|
|
53
|
+
const { modelGroupWindows } = transformSummary(summaryPayload);
|
|
54
|
+
const models = transformModels(modelsPayload, modelGroupWindows);
|
|
55
|
+
|
|
56
|
+
if (!Object.keys(models).length) {
|
|
57
|
+
return buildResult({
|
|
58
|
+
providerId,
|
|
59
|
+
providerName,
|
|
60
|
+
ok: false,
|
|
61
|
+
configured: true,
|
|
62
|
+
error: 'Failed to fetch Antigravity quota'
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return buildResult({
|
|
67
|
+
providerId,
|
|
68
|
+
providerName,
|
|
69
|
+
ok: true,
|
|
70
|
+
configured: true,
|
|
71
|
+
usage: {
|
|
72
|
+
windows: {},
|
|
73
|
+
models: Object.keys(models).length ? models : undefined
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Antigravity Provider - Transforms
|
|
3
|
+
*
|
|
4
|
+
* Data transformation functions for Antigravity quota responses.
|
|
5
|
+
* @module quota/providers/antigravity/transforms
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
asNonEmptyString,
|
|
10
|
+
toNumber,
|
|
11
|
+
toTimestamp,
|
|
12
|
+
toUsageWindow
|
|
13
|
+
} from '../../utils/index.js';
|
|
14
|
+
|
|
15
|
+
export const FIVE_HOUR_WINDOW_SECONDS = 5 * 60 * 60;
|
|
16
|
+
export const WEEKLY_WINDOW_SECONDS = 7 * 24 * 60 * 60;
|
|
17
|
+
const DAILY_WINDOW_SECONDS = 24 * 60 * 60;
|
|
18
|
+
|
|
19
|
+
export const parseBucket = (bucket) => {
|
|
20
|
+
const remainingFraction = toNumber(bucket?.remainingFraction);
|
|
21
|
+
const remainingPercent = remainingFraction !== null
|
|
22
|
+
? Math.round(remainingFraction * 100)
|
|
23
|
+
: null;
|
|
24
|
+
const usedPercent = remainingPercent !== null ? Math.max(0, 100 - remainingPercent) : null;
|
|
25
|
+
const resetAt = toTimestamp(bucket?.resetTime);
|
|
26
|
+
const windowStr = (bucket?.window || bucket?.bucketId || '').toLowerCase();
|
|
27
|
+
|
|
28
|
+
let label = '5h';
|
|
29
|
+
let seconds = FIVE_HOUR_WINDOW_SECONDS;
|
|
30
|
+
|
|
31
|
+
if (windowStr.includes('week') || windowStr.includes('7d')) {
|
|
32
|
+
label = 'weekly';
|
|
33
|
+
seconds = WEEKLY_WINDOW_SECONDS;
|
|
34
|
+
} else if (windowStr.includes('day') || windowStr.includes('daily')) {
|
|
35
|
+
label = 'daily';
|
|
36
|
+
seconds = DAILY_WINDOW_SECONDS;
|
|
37
|
+
} else {
|
|
38
|
+
label = '5h';
|
|
39
|
+
seconds = FIVE_HOUR_WINDOW_SECONDS;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
label,
|
|
44
|
+
seconds,
|
|
45
|
+
remainingFraction: remainingFraction ?? 1,
|
|
46
|
+
window: toUsageWindow({
|
|
47
|
+
usedPercent,
|
|
48
|
+
windowSeconds: seconds,
|
|
49
|
+
resetAt
|
|
50
|
+
})
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const transformSummary = (summaryPayload) => {
|
|
55
|
+
const groups = Array.isArray(summaryPayload?.groups) ? summaryPayload.groups : [];
|
|
56
|
+
const modelGroupWindows = [];
|
|
57
|
+
|
|
58
|
+
for (const group of groups) {
|
|
59
|
+
const groupName = (group?.displayName || '').toLowerCase();
|
|
60
|
+
const is3p = groupName.includes('claude') || groupName.includes('gpt') || groupName.includes('3p');
|
|
61
|
+
const groupType = is3p ? '3p' : 'gemini';
|
|
62
|
+
|
|
63
|
+
const buckets = Array.isArray(group?.buckets) ? group.buckets : [];
|
|
64
|
+
const windows = {};
|
|
65
|
+
let bucket5h = null;
|
|
66
|
+
let bucketWeekly = null;
|
|
67
|
+
|
|
68
|
+
for (const b of buckets) {
|
|
69
|
+
const parsed = parseBucket(b);
|
|
70
|
+
windows[parsed.label] = parsed.window;
|
|
71
|
+
if (parsed.label === '5h') {
|
|
72
|
+
bucket5h = parsed;
|
|
73
|
+
} else if (parsed.label === 'weekly') {
|
|
74
|
+
bucketWeekly = parsed;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
modelGroupWindows.push({
|
|
79
|
+
groupType,
|
|
80
|
+
displayName: group?.displayName,
|
|
81
|
+
windows,
|
|
82
|
+
bucket5h,
|
|
83
|
+
bucketWeekly
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// The card carries no top-level windows: each model row shows its own
|
|
88
|
+
// group's 5h/weekly, so a single overview row would only mislead (for
|
|
89
|
+
// example a Gemini 5h window shown for someone whose Claude limit is spent).
|
|
90
|
+
return { modelGroupWindows };
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export const transformModels = (modelsPayload, modelGroupWindows = []) => {
|
|
94
|
+
const rawModels = modelsPayload?.models ?? {};
|
|
95
|
+
const transformed = {};
|
|
96
|
+
|
|
97
|
+
for (const [modelName, modelData] of Object.entries(rawModels)) {
|
|
98
|
+
const name = asNonEmptyString(modelName);
|
|
99
|
+
if (!name) continue;
|
|
100
|
+
|
|
101
|
+
const lowerName = name.toLowerCase();
|
|
102
|
+
const is3p = lowerName.includes('claude') || lowerName.includes('gpt');
|
|
103
|
+
const matchedGroup = modelGroupWindows.find((g) => is3p ? g.groupType === '3p' : g.groupType === 'gemini');
|
|
104
|
+
|
|
105
|
+
if (matchedGroup && Object.keys(matchedGroup.windows).length > 0) {
|
|
106
|
+
const isWeeklyConstrained = matchedGroup.bucketWeekly
|
|
107
|
+
&& (matchedGroup.bucketWeekly.remainingFraction <= 0.001
|
|
108
|
+
|| (matchedGroup.bucket5h && matchedGroup.bucketWeekly.remainingFraction < matchedGroup.bucket5h.remainingFraction));
|
|
109
|
+
|
|
110
|
+
const reorderedWindows = {};
|
|
111
|
+
if (isWeeklyConstrained && matchedGroup.windows.weekly) {
|
|
112
|
+
reorderedWindows.weekly = matchedGroup.windows.weekly;
|
|
113
|
+
if (matchedGroup.windows['5h']) {
|
|
114
|
+
reorderedWindows['5h'] = matchedGroup.windows['5h'];
|
|
115
|
+
}
|
|
116
|
+
} else {
|
|
117
|
+
if (matchedGroup.windows['5h']) {
|
|
118
|
+
reorderedWindows['5h'] = matchedGroup.windows['5h'];
|
|
119
|
+
}
|
|
120
|
+
if (matchedGroup.windows.weekly) {
|
|
121
|
+
reorderedWindows.weekly = matchedGroup.windows.weekly;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
for (const [wLabel, wData] of Object.entries(matchedGroup.windows)) {
|
|
126
|
+
if (!reorderedWindows[wLabel]) {
|
|
127
|
+
reorderedWindows[wLabel] = wData;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
transformed[name] = { windows: reorderedWindows };
|
|
132
|
+
} else {
|
|
133
|
+
// Fallback: if retrieveUserQuotaSummary did not return, fall back to the single-window quotaInfo from fetchAvailableModels
|
|
134
|
+
const remainingFraction = toNumber(modelData?.quotaInfo?.remainingFraction);
|
|
135
|
+
const remainingPercent = remainingFraction !== null
|
|
136
|
+
? Math.round(remainingFraction * 100)
|
|
137
|
+
: null;
|
|
138
|
+
const usedPercent = remainingPercent !== null ? Math.max(0, 100 - remainingPercent) : null;
|
|
139
|
+
const resetAt = toTimestamp(modelData?.quotaInfo?.resetTime);
|
|
140
|
+
|
|
141
|
+
const remainingSeconds = resetAt !== null
|
|
142
|
+
? Math.max(0, Math.round((resetAt - Date.now()) / 1000))
|
|
143
|
+
: null;
|
|
144
|
+
|
|
145
|
+
let label = '5h';
|
|
146
|
+
let seconds = FIVE_HOUR_WINDOW_SECONDS;
|
|
147
|
+
if (remainingSeconds !== null && remainingSeconds > 36 * 60 * 60) {
|
|
148
|
+
label = 'weekly';
|
|
149
|
+
seconds = WEEKLY_WINDOW_SECONDS;
|
|
150
|
+
} else if (remainingSeconds !== null && remainingSeconds > 10 * 60 * 60) {
|
|
151
|
+
label = 'daily';
|
|
152
|
+
seconds = DAILY_WINDOW_SECONDS;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
transformed[name] = {
|
|
156
|
+
windows: {
|
|
157
|
+
[label]: toUsageWindow({
|
|
158
|
+
usedPercent,
|
|
159
|
+
windowSeconds: seconds,
|
|
160
|
+
resetAt
|
|
161
|
+
})
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return transformed;
|
|
168
|
+
};
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import {
|
|
3
|
+
parseBucket,
|
|
4
|
+
transformSummary,
|
|
5
|
+
transformModels,
|
|
6
|
+
FIVE_HOUR_WINDOW_SECONDS,
|
|
7
|
+
WEEKLY_WINDOW_SECONDS
|
|
8
|
+
} from './transforms.js';
|
|
9
|
+
|
|
10
|
+
const MOCK_SUMMARY_PAYLOAD = {
|
|
11
|
+
groups: [
|
|
12
|
+
{
|
|
13
|
+
displayName: 'Gemini Models',
|
|
14
|
+
description: 'Models within this group: Gemini Flash, Gemini Pro',
|
|
15
|
+
buckets: [
|
|
16
|
+
{
|
|
17
|
+
bucketId: 'gemini-weekly',
|
|
18
|
+
displayName: 'Weekly Limit Remaining',
|
|
19
|
+
window: 'weekly',
|
|
20
|
+
resetTime: '2026-10-08T14:29:35Z',
|
|
21
|
+
remainingFraction: 0.59
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
bucketId: 'gemini-5h',
|
|
25
|
+
displayName: 'Five Hour Limit Remaining',
|
|
26
|
+
window: '5h',
|
|
27
|
+
resetTime: '2026-10-04T07:31:51Z',
|
|
28
|
+
remainingFraction: 1.0
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Claude and GPT models',
|
|
34
|
+
description: 'Models within this group: Claude Opus, Claude Sonnet, GPT-OSS',
|
|
35
|
+
buckets: [
|
|
36
|
+
{
|
|
37
|
+
bucketId: '3p-weekly',
|
|
38
|
+
displayName: 'Weekly Limit Remaining',
|
|
39
|
+
window: 'weekly',
|
|
40
|
+
resetTime: '2026-10-10T10:01:17Z',
|
|
41
|
+
remainingFraction: 0.46
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
bucketId: '3p-5h',
|
|
45
|
+
displayName: 'Five Hour Limit Remaining',
|
|
46
|
+
window: '5h',
|
|
47
|
+
resetTime: '2026-10-04T07:31:51Z',
|
|
48
|
+
remainingFraction: 0.8
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
]
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const MOCK_MODELS_PAYLOAD = {
|
|
56
|
+
models: {
|
|
57
|
+
'gemini-3.8-flash': {
|
|
58
|
+
displayName: 'Gemini 3.8 Flash',
|
|
59
|
+
quotaInfo: { remainingFraction: 1.0, resetTime: '2026-10-04T07:31:51Z' }
|
|
60
|
+
},
|
|
61
|
+
'claude-sonnet-5-5-low': {
|
|
62
|
+
displayName: 'Claude Sonnet 5.5 (Low)',
|
|
63
|
+
quotaInfo: { remainingFraction: 0.46, resetTime: '2026-10-10T10:01:17Z' }
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
describe('Antigravity transforms', () => {
|
|
69
|
+
it('parses buckets into standardized usage windows with 5h and weekly durations', () => {
|
|
70
|
+
const weeklyBucket = parseBucket({
|
|
71
|
+
bucketId: 'gemini-weekly',
|
|
72
|
+
window: 'weekly',
|
|
73
|
+
resetTime: '2026-10-08T14:29:35Z',
|
|
74
|
+
remainingFraction: 0.6
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
expect(weeklyBucket.label).toBe('weekly');
|
|
78
|
+
expect(weeklyBucket.seconds).toBe(WEEKLY_WINDOW_SECONDS);
|
|
79
|
+
expect(weeklyBucket.window.remainingPercent).toBe(60);
|
|
80
|
+
expect(weeklyBucket.window.usedPercent).toBe(40);
|
|
81
|
+
expect(weeklyBucket.window.resetAt).toBe(Date.parse('2026-10-08T14:29:35Z'));
|
|
82
|
+
|
|
83
|
+
const fiveHourBucket = parseBucket({
|
|
84
|
+
bucketId: 'gemini-5h',
|
|
85
|
+
window: '5h',
|
|
86
|
+
resetTime: '2026-10-04T07:31:51Z',
|
|
87
|
+
remainingFraction: 1.0
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
expect(fiveHourBucket.label).toBe('5h');
|
|
91
|
+
expect(fiveHourBucket.seconds).toBe(FIVE_HOUR_WINDOW_SECONDS);
|
|
92
|
+
expect(fiveHourBucket.window.remainingPercent).toBe(100);
|
|
93
|
+
expect(fiveHourBucket.window.usedPercent).toBe(0);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('parses summary groups into Gemini and 3P model-group windows', () => {
|
|
97
|
+
const { modelGroupWindows } = transformSummary(MOCK_SUMMARY_PAYLOAD);
|
|
98
|
+
|
|
99
|
+
expect(modelGroupWindows).toHaveLength(2);
|
|
100
|
+
expect(modelGroupWindows[0].groupType).toBe('gemini');
|
|
101
|
+
expect(modelGroupWindows[0].windows['5h'].remainingPercent).toBe(100);
|
|
102
|
+
expect(modelGroupWindows[0].windows.weekly.remainingPercent).toBe(59);
|
|
103
|
+
expect(modelGroupWindows[1].groupType).toBe('3p');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('binds dual-layer quotas to individual Gemini and Claude models', () => {
|
|
107
|
+
const { modelGroupWindows } = transformSummary(MOCK_SUMMARY_PAYLOAD);
|
|
108
|
+
const models = transformModels(MOCK_MODELS_PAYLOAD, modelGroupWindows);
|
|
109
|
+
|
|
110
|
+
// Gemini gets Gemini group's 5h and weekly
|
|
111
|
+
const gemini = models['gemini-3.8-flash'];
|
|
112
|
+
expect(gemini.windows['5h'].remainingPercent).toBe(100);
|
|
113
|
+
expect(gemini.windows.weekly.remainingPercent).toBe(59);
|
|
114
|
+
|
|
115
|
+
// Claude gets 3p group's 5h and weekly
|
|
116
|
+
const claude = models['claude-sonnet-5-5-low'];
|
|
117
|
+
expect(claude.windows['5h'].remainingPercent).toBe(80);
|
|
118
|
+
expect(claude.windows.weekly.remainingPercent).toBe(46);
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it('prioritizes weekly window first when weekly quota is exhausted (bottleneck ordering)', () => {
|
|
122
|
+
const exhaustedPayload = {
|
|
123
|
+
groups: [
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Claude and GPT models',
|
|
126
|
+
buckets: [
|
|
127
|
+
{
|
|
128
|
+
bucketId: '3p-weekly',
|
|
129
|
+
window: 'weekly',
|
|
130
|
+
resetTime: '2026-10-10T10:01:17Z',
|
|
131
|
+
remainingFraction: 0.0 // Exhausted
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
bucketId: '3p-5h',
|
|
135
|
+
window: '5h',
|
|
136
|
+
resetTime: '2026-10-04T07:31:51Z',
|
|
137
|
+
remainingFraction: 1.0
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
const { modelGroupWindows } = transformSummary(exhaustedPayload);
|
|
145
|
+
const models = transformModels(
|
|
146
|
+
{
|
|
147
|
+
models: {
|
|
148
|
+
'claude-opus-5-5-high': {
|
|
149
|
+
displayName: 'Claude Opus 5.5',
|
|
150
|
+
quotaInfo: { remainingFraction: 0.0, resetTime: '2026-10-10T10:01:17Z' }
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
modelGroupWindows
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
const windowEntries = Object.entries(models['claude-opus-5-5-high'].windows);
|
|
158
|
+
// Weekly should be first entry
|
|
159
|
+
expect(windowEntries[0][0]).toBe('weekly');
|
|
160
|
+
expect(windowEntries[0][1].remainingPercent).toBe(0);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
@@ -6,7 +6,8 @@ import {
|
|
|
6
6
|
toUsageWindow,
|
|
7
7
|
toNumber,
|
|
8
8
|
toTimestamp,
|
|
9
|
-
resolveWindowLabel
|
|
9
|
+
resolveWindowLabel,
|
|
10
|
+
asNonEmptyString
|
|
10
11
|
} from '../utils/index.js';
|
|
11
12
|
|
|
12
13
|
export const providerId = 'codex';
|
|
@@ -46,14 +47,37 @@ export const fetchQuota = async () => {
|
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
if (!response.ok) {
|
|
50
|
+
// A 401 is not always an expired token. When the endpoint refuses usage
|
|
51
|
+
// access for a still-valid sign-in it answers with an access-enforcement
|
|
52
|
+
// body (e.g. `rejected_by_access_enforcement`), which OpenCode's
|
|
53
|
+
// `chatgpt-token-sharing` sign-in can hit. Saying "session expired" there
|
|
54
|
+
// sends the user to re-authenticate for a credential that is fine.
|
|
55
|
+
if (response.status === 401) {
|
|
56
|
+
const body = await response.json().catch(() => null);
|
|
57
|
+
const errorType = asNonEmptyString(body?.error?.type);
|
|
58
|
+
if (errorType === 'rejected_by_access_enforcement') {
|
|
59
|
+
return buildResult({
|
|
60
|
+
providerId,
|
|
61
|
+
providerName,
|
|
62
|
+
ok: false,
|
|
63
|
+
configured: true,
|
|
64
|
+
error: 'Usage is not available for this OpenAI sign-in method; chat still works'
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return buildResult({
|
|
68
|
+
providerId,
|
|
69
|
+
providerName,
|
|
70
|
+
ok: false,
|
|
71
|
+
configured: true,
|
|
72
|
+
error: 'Session expired \u2014 please re-authenticate with OpenAI'
|
|
73
|
+
});
|
|
74
|
+
}
|
|
49
75
|
return buildResult({
|
|
50
76
|
providerId,
|
|
51
77
|
providerName,
|
|
52
78
|
ok: false,
|
|
53
79
|
configured: true,
|
|
54
|
-
error: response.status
|
|
55
|
-
? 'Session expired \u2014 please re-authenticate with OpenAI'
|
|
56
|
-
: `API error: ${response.status}`
|
|
80
|
+
error: `API error: ${response.status}`
|
|
57
81
|
});
|
|
58
82
|
}
|
|
59
83
|
|
|
@@ -102,4 +102,33 @@ describe('Codex quota windows', () => {
|
|
|
102
102
|
expect(result.usage.windows.credits.valueLabel).toBe('2675 / 7500 used');
|
|
103
103
|
expect(fetchMock).toHaveBeenCalled();
|
|
104
104
|
});
|
|
105
|
+
|
|
106
|
+
it('does not report a 401 access-enforcement rejection as an expired session', async () => {
|
|
107
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
108
|
+
ok: false,
|
|
109
|
+
status: 401,
|
|
110
|
+
json: async () => ({ error: { type: 'rejected_by_access_enforcement', code: 'no_matching_rule', message: 'Unauthorized' } }),
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const result = await fetchQuota();
|
|
114
|
+
|
|
115
|
+
expect(result.ok).toBe(false);
|
|
116
|
+
// The credential is still valid; the endpoint refused usage access. Saying
|
|
117
|
+
// "session expired" would send the user to re-authenticate for nothing.
|
|
118
|
+
expect(result.error).not.toBe('Session expired \u2014 please re-authenticate with OpenAI');
|
|
119
|
+
expect(result.error).toMatch(/usage|access|not available/i);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('still reports an expired session for a plain 401 without a rejection body', async () => {
|
|
123
|
+
vi.stubGlobal('fetch', vi.fn().mockResolvedValue({
|
|
124
|
+
ok: false,
|
|
125
|
+
status: 401,
|
|
126
|
+
json: async () => ({}),
|
|
127
|
+
}));
|
|
128
|
+
|
|
129
|
+
const result = await fetchQuota();
|
|
130
|
+
|
|
131
|
+
expect(result.ok).toBe(false);
|
|
132
|
+
expect(result.error).toBe('Session expired \u2014 please re-authenticate with OpenAI');
|
|
133
|
+
});
|
|
105
134
|
});
|