opencode-quota-gui 1.3.0 → 1.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.
Files changed (146) hide show
  1. package/README.md +27 -17
  2. package/dist/bin/opencode-quota-gui.js +0 -0
  3. package/dist/contracts/build-identity.js +1 -1
  4. package/dist/contracts/dashboard.d.ts +8 -1
  5. package/dist/contracts/dto-guards.js +2 -0
  6. package/dist/contracts/openai-quota.d.ts +3 -0
  7. package/dist/contracts/openai-quota.js +3 -0
  8. package/dist/data/modelsdev-temporal.min.json +57 -0
  9. package/dist/gui/config.d.ts +3 -3
  10. package/dist/gui/config.js +31 -2
  11. package/dist/gui/lifecycle.d.ts +5 -3
  12. package/dist/gui/lifecycle.js +3 -3
  13. package/dist/gui/primary-quota-windows.js +16 -14
  14. package/dist/gui/provider-cards.d.ts +10 -2
  15. package/dist/gui/provider-cards.js +51 -23
  16. package/dist/gui/quota-notification-detector.d.ts +4 -4
  17. package/dist/gui/quota-notification-detector.js +76 -42
  18. package/dist/gui/quota-notification-observer.d.ts +2 -3
  19. package/dist/gui/quota-notification-observer.js +68 -19
  20. package/dist/gui/rpc.d.ts +2 -0
  21. package/dist/gui/rpc.js +11 -3
  22. package/dist/gui/server.js +11 -2
  23. package/dist/gui/snapshot-service.d.ts +3 -1
  24. package/dist/gui/snapshot-service.js +126 -18
  25. package/dist/gui/sources.js +98 -56
  26. package/dist/gui-experimental.cjs +230 -225
  27. package/dist/lib/accounting-format.js +8 -0
  28. package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
  29. package/dist/lib/alibaba-coding-plan-cli.js +539 -0
  30. package/dist/lib/anthropic-auth.d.ts +2 -3
  31. package/dist/lib/anthropic-auth.js +2 -3
  32. package/dist/lib/anthropic.d.ts +48 -12
  33. package/dist/lib/anthropic.js +610 -275
  34. package/dist/lib/api-key-retry-after.d.ts +7 -0
  35. package/dist/lib/api-key-retry-after.js +62 -0
  36. package/dist/lib/atomic-json.d.ts +2 -0
  37. package/dist/lib/atomic-json.js +1 -0
  38. package/dist/lib/cache-observer-ingestion.d.ts +90 -0
  39. package/dist/lib/cache-observer-ingestion.js +981 -0
  40. package/dist/lib/cache-observer.d.ts +138 -0
  41. package/dist/lib/cache-observer.js +317 -0
  42. package/dist/lib/canonical-config-lock.d.ts +9 -0
  43. package/dist/lib/canonical-config-lock.js +36 -0
  44. package/dist/lib/chutes.js +62 -51
  45. package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
  46. package/dist/lib/claude-agent-transcript-ttl.js +154 -0
  47. package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
  48. package/dist/lib/claude-agent-ttl-tracker.js +152 -0
  49. package/dist/lib/cli-show.js +5 -3
  50. package/dist/lib/config-write-target.d.ts +1 -1
  51. package/dist/lib/config-write-target.js +5 -2
  52. package/dist/lib/config.d.ts +2 -1
  53. package/dist/lib/config.js +193 -2
  54. package/dist/lib/copilot.js +171 -86
  55. package/dist/lib/dashboard-web-policy.d.ts +4 -4
  56. package/dist/lib/dashboard-web-policy.js +2 -2
  57. package/dist/lib/deepseek.js +25 -13
  58. package/dist/lib/display-sanitize.js +1 -0
  59. package/dist/lib/entries.d.ts +23 -0
  60. package/dist/lib/entries.js +2 -0
  61. package/dist/lib/glm-coding-plan.js +98 -74
  62. package/dist/lib/google-agy.js +90 -12
  63. package/dist/lib/google-gemini-cli.js +84 -11
  64. package/dist/lib/http.d.ts +4 -0
  65. package/dist/lib/http.js +16 -2
  66. package/dist/lib/init-installer.js +5 -3
  67. package/dist/lib/kilo.js +37 -18
  68. package/dist/lib/kimi.js +35 -18
  69. package/dist/lib/mimo.d.ts +2 -0
  70. package/dist/lib/mimo.js +36 -0
  71. package/dist/lib/nanogpt.d.ts +1 -0
  72. package/dist/lib/nanogpt.js +26 -3
  73. package/dist/lib/ollama-cloud.d.ts +1 -1
  74. package/dist/lib/ollama-cloud.js +48 -35
  75. package/dist/lib/openai.js +84 -38
  76. package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
  77. package/dist/lib/opencode-auth-sqlite.js +2 -2
  78. package/dist/lib/opencode-config-editor.d.ts +1 -0
  79. package/dist/lib/opencode-config-editor.js +6 -1
  80. package/dist/lib/opencode-go.js +29 -2
  81. package/dist/lib/opencode-version-core.d.ts +23 -0
  82. package/dist/lib/opencode-version-core.js +49 -0
  83. package/dist/lib/opencode-version.d.ts +2 -22
  84. package/dist/lib/opencode-version.js +4 -48
  85. package/dist/lib/opencode-zen.d.ts +3 -0
  86. package/dist/lib/opencode-zen.js +71 -5
  87. package/dist/lib/provider-add.js +5 -2
  88. package/dist/lib/provider-registration.d.ts +19 -9
  89. package/dist/lib/provider-registration.js +17 -6
  90. package/dist/lib/quota-command-format.js +1 -1
  91. package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
  92. package/dist/lib/quota-exhaustion-projection.js +25 -0
  93. package/dist/lib/quota-providers-remote.d.ts +2 -1
  94. package/dist/lib/quota-providers-remote.js +59 -3
  95. package/dist/lib/quota-providers.d.ts +1 -1
  96. package/dist/lib/quota-providers.js +12 -35
  97. package/dist/lib/quota-render-data.d.ts +6 -0
  98. package/dist/lib/quota-render-data.js +43 -17
  99. package/dist/lib/quota-state-codec.js +17 -1
  100. package/dist/lib/quota-state.d.ts +7 -1
  101. package/dist/lib/quota-state.js +208 -34
  102. package/dist/lib/quota-stats.js +21 -0
  103. package/dist/lib/quota-status.js +3 -51
  104. package/dist/lib/scoped-update.d.ts +1 -1
  105. package/dist/lib/synthetic.js +65 -54
  106. package/dist/lib/types.d.ts +31 -1
  107. package/dist/lib/types.js +13 -0
  108. package/dist/lib/xai.js +48 -22
  109. package/dist/plugin.js +261 -13
  110. package/dist/provider-logos/NOTICE.md +1 -1
  111. package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
  112. package/dist/providers/alibaba-coding-plan.js +107 -104
  113. package/dist/providers/anthropic.d.ts +12 -3
  114. package/dist/providers/anthropic.js +71 -228
  115. package/dist/providers/cache-policies.d.ts +11 -4
  116. package/dist/providers/cache-policies.js +19 -13
  117. package/dist/providers/claude-agent.d.ts +19 -0
  118. package/dist/providers/claude-agent.js +196 -0
  119. package/dist/providers/copilot.js +2 -0
  120. package/dist/providers/glm-coding-plan-provider.d.ts +1 -0
  121. package/dist/providers/google-account-format.js +1 -0
  122. package/dist/providers/google-agy.d.ts +6 -5
  123. package/dist/providers/google-agy.js +43 -15
  124. package/dist/providers/google-gemini-cli.js +1 -0
  125. package/dist/providers/kilo.js +1 -0
  126. package/dist/providers/kimi-code.js +2 -0
  127. package/dist/providers/mimo.js +1 -0
  128. package/dist/providers/nanogpt.js +1 -0
  129. package/dist/providers/opencode-go.js +3 -0
  130. package/dist/providers/opencode-zen.js +2 -0
  131. package/dist/providers/openrouter.js +1 -0
  132. package/dist/providers/quota-providers.js +16 -5
  133. package/dist/providers/registry.js +2 -0
  134. package/dist/providers/result-helpers.d.ts +2 -0
  135. package/dist/providers/result-helpers.js +2 -0
  136. package/dist/rpc.d.ts +121 -8
  137. package/dist/rpc.js +204 -12
  138. package/dist/ui/assets/{index-cDd9jUVY.css → index-BcueIm3Z.css} +1 -1
  139. package/dist/ui/assets/index-C6qRSoh8.js +10 -0
  140. package/dist/ui/assets/{popover-BGkgv9s0.js → popover-4bFSvRZ7.js} +1 -1
  141. package/dist/ui/assets/providers/claude-agent.svg +3 -0
  142. package/dist/ui/index.html +2 -2
  143. package/package.json +44 -45
  144. package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
  145. package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
  146. package/dist/ui/assets/index-DLHeXYff.js +0 -9
package/README.md CHANGED
@@ -13,9 +13,9 @@ Quota, token usage, and analytics inside OpenCode Desktop. OpenCode Quota GUI ad
13
13
 
14
14
  ## Native OpenCode Desktop
15
15
 
16
- The Native panel is the primary experience in **v1.3.0**. Open **Quota & Usage** for Quota, Analytics, Models, and their detail pages; OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows a compact quota slot with a combined preview.
16
+ The Native panel is the primary experience in **v1.3.1**. Open **Quota & Usage** for Quota, Analytics, Models, and their detail pages; OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows a compact quota slot with a combined preview.
17
17
 
18
- The Native integration ships from **v1.3.0** and requires **OpenCode Desktop 2.2.0 or newer**.
18
+ The full Native integration ships from **v1.3.0** and requires **OpenCode Desktop 2.2.1 or newer**.
19
19
 
20
20
  <p align="center">
21
21
  <img src="images/opencode-quota-gui_quota.png" alt="OpenCode Desktop with the native Quota & Usage side panel showing provider account cards, remaining quota windows, and reset countdowns" />
@@ -50,14 +50,14 @@ The Native integration ships from **v1.3.0** and requires **OpenCode Desktop 2.2
50
50
 
51
51
  ## What you get
52
52
 
53
- The Native panel is the primary surface in v1.3.0. Every feature below is available there, and the optional browser dashboard mirrors the same views as a fallback.
53
+ The Native panel is the primary surface in v1.3.1. Every feature below is available there, and the optional browser dashboard mirrors the same views as a fallback.
54
54
 
55
55
  ## Features
56
56
 
57
57
  - **Native panel:** Quota, Analytics, Models, and Settings live in OpenCode Desktop, with project, session, provider, and model drilldowns in the same side panel.
58
58
  - **Header quota slot:** compact rings for quota windows with a stable identity, plus a combined preview of every visible provider and account.
59
59
  - **Native notifications:** low quota, exhausted quota, quota reset, and provider or API failures. A focused window shows an in-app toast; a background window asks OpenCode to notify you. Set the low-quota threshold and duplicate cooldown in Settings.
60
- - **Quota by provider account:** provider logos with plan, account, or workspace labels, and one card per signed-in account, seat, API key, or workspace. Multiple logins for one provider each get their own card. Cards show the quota and rate-limit windows, reset countdowns, and balance, spend, budget, or status rows the integration supports. OpenAI cards can add banked resets and credits; Cursor and Alibaba can estimate from local history; the active login is marked `(active)`.
60
+ - **Quota by provider account:** provider logos with plan, account, or workspace labels, and one card per signed-in account, seat, API key, or workspace. Multiple logins for one provider each get their own card. Cards show the quota and rate-limit windows, reset countdowns, and balance, spend, budget, or status rows the integration supports. OpenAI cards can add banked resets and credits; Claude Agent cards can show read-only saved resets; Cursor can estimate from local history; Alibaba Coding Plan reads quota from the Bailian CLI. The active login is marked `(active)`.
61
61
  - **Peak and off-peak pricing:** for providers whose published rules define time-of-day pricing, the Quota header shows **Peak**, **Off-peak**, or **Mixed** with the next change, a per-model schedule in your local time, and holiday exceptions. Model detail pages split each provider route's historical tokens and API-equivalent cost into Peak and Off-peak rows.
62
62
  - **Analytics:** token usage over `24h`, `7d`, `30d`, or `lifetime`; a stacked daily token chart for cache read, input, reasoning, and output; a cache hit rate line; and projects you can sort by activity or tokens.
63
63
  - **Models:** stacked token charts grouped by provider or model, with an API-equivalent cost line and a sortable cost/token breakdown. Open a provider to see its models or a model to see its providers.
@@ -86,9 +86,9 @@ That adds this entry to your OpenCode configuration, keeping the other plugins t
86
86
 
87
87
  OpenCode installs the configured npm plugin itself; you do not need a separate `npm install`. If you prefer to edit the config manually, add the same `opencode-quota-gui` entry to the plural `plugins` array in `~/.config/opencode/opencode.json(c)` or a project `opencode.json(c)`.
88
88
 
89
- Then open **Quota & Usage** in OpenCode Desktop. The Native panel is available from **v1.3.0** and requires **OpenCode Desktop 2.2.0 or newer**.
89
+ Then open **Quota & Usage** in OpenCode Desktop. The full Native panel is available from **v1.3.0** and requires **OpenCode Desktop 2.2.1 or newer**.
90
90
 
91
- The browser dashboard default follows the OpenCode host version. On hosts below **2.2.0**, it is on by default because the Native panel is unavailable there; at **2.2.0 or newer** it is off by default. An explicit `dashboard.enabled` value in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at `dashboard.port` (default `4144`). To pin the behavior either way, edit the canonical settings file and restart OpenCode:
91
+ The browser dashboard default follows the OpenCode host version. On supported hosts below **2.2.1** (including **2.2.0**), it is on by default because the full Native panel is unavailable there; at **2.2.1 or newer** it is off by default. An explicit `dashboard.enabled` value in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at `dashboard.port` (default `4144`). To pin the behavior either way, edit the canonical settings file and restart OpenCode:
92
92
 
93
93
  ```jsonc
94
94
  {
@@ -101,11 +101,11 @@ The browser dashboard default follows the OpenCode host version. On hosts below
101
101
 
102
102
  `true` forces web access on and `false` keeps it off. Then open <http://localhost:4144/quota>. The first page may show an empty dashboard until OpenCode has loaded the plugin and discovered a provider account. The path and platform overrides are in [Configuration](docs/readme/configuration.md#web-dashboard).
103
103
 
104
- Requirements: OpenCode `>= 2.0.16 < 2.3.0` and Node.js `22.13+` or `23.4+`. The Native Desktop integration ships from v1.3.0 and requires OpenCode Desktop 2.2.0+. This package does not support OpenCode 1.
104
+ Requirements: OpenCode `>= 2.0.16 < 2.3.0` and Node.js `22.13+` or `23.4+`. The full Native Desktop integration ships from v1.3.0 and requires OpenCode Desktop 2.2.1+. On supported older hosts, the browser dashboard is the automatic fallback. This package does not support OpenCode 1.
105
105
 
106
106
  ## Native panel
107
107
 
108
- In OpenCode Desktop 2.2.0+, **Quota & Usage** opens the product in the side panel, and OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows compact quota rings; select the slot for the combined preview.
108
+ In OpenCode Desktop 2.2.1+, **Quota & Usage** opens the product in the side panel, and OpenCode Settings includes the plugin's **Quota & analytics** page. The session header shows compact quota rings; select the slot for the combined preview.
109
109
 
110
110
  - **Quota:** cards for discovered provider accounts, ordered and grouped by provider. Each card shows the provider mark, plan and account or workspace labels, the rows the integration supports, a compact percentage bar for percentage rows, reset countdowns, and card-local errors. OpenAI cards can include banked resets and credits. Multiple logins for one provider get their own cards, and the active login is marked `(active)`. For providers with time-based pricing, the header shows live peak and off-peak status; open a status for its schedule, next change, and holiday exceptions.
111
111
  - **Analytics:** total tokens and API-equivalent estimate for the selected range, a stacked token chart with cache hit rate, and projects ordered by activity or tokens. Open a project for its own token chart, worktree label, and root sessions.
@@ -115,11 +115,19 @@ In OpenCode Desktop 2.2.0+, **Quota & Usage** opens the product in the side pane
115
115
 
116
116
  The panel follows you between sessions: switching sessions reuses the same shared quota and analytics state instead of starting over, and header quota indicators stay in place across OpenCode Desktop's normal dashboard watch rotations.
117
117
 
118
- Native notifications cover low quota, exhausted quota, quota reset, and provider or API failures. The low-quota threshold and duplicate cooldown are configurable in Settings. A focused window shows an in-app toast; a background window asks OpenCode to notify you. Delivery is best effort, not exactly once.
118
+ The Native composer also shows **Cache observation**, for example `TTL ~4m 30s · Cache 99.70% · Hit`. Its percentage is the cache-read share of the last completed primary call with reliable usage data, not a session average, labelled by how much of the prompt was reused: `Low reuse` (above 0% up to 50%), `Partial reuse` (above 50% to under 90%) and `Hit` (90% or more). These are reuse-efficiency bands, not provider cache-hit semantics, so a small positive cache read is technically a cache hit but shows `Low reuse`. `Miss` is reserved for an independently confirmed zero. `Unknown` means the usage data was missing or invalid, or the share is zero: OpenCode reports a missing cache-read count as zero, so a plain zero is never shown as a confirmed `Miss`. The `~` marks the TTL countdown as an estimate; it is not an authoritative expiry, and no supported OpenCode host exposes one. For Claude Agent, a call whose cache writes are recorded as 1-hour-only with zero cache reads in its session record is estimated at 60 minutes instead of 5; an observed 1-hour write does not prove that earlier cached segments last an hour. See [Cache TTL evidence](docs/readme/cache-ttl-evidence.md) for what is and is not observable per route. Green means cache reuse is likely within an estimated retention window; yellow means the estimate is uncertain or in its final 20%; red means estimated expiry, observed invalidation, or a model change; gray means there is insufficient reliable information. An active session with confirmed prior cache reads may also show yellow when its retention is unknown, without a countdown. Colors estimate future reuse and do not guarantee the next hit or prove what a provider retained. Select a session row to open its Session Analytics in the panel without switching the active chat; its breadcrumbs link back to parent sessions.
119
+
120
+ <p align="center">
121
+ <img src="https://raw.githubusercontent.com/PVLPM/opencode-quota-gui/main/images/opencode-quota-gui_composer_pill.png" alt="Native composer Cache observation popover listing per-session TTL estimates and cache-read percentages above the TTL, Cache and Hit pill" width="320" />
122
+ </p>
123
+
124
+ For eligible quota windows, hover or focus the percentage or progress bar to see a linear runway estimate. It is available only when the provider data supports a reliable window projection; a reset timestamp alone is not enough. In particular, OpenCode Go's rolling five-hour window does not establish a fixed window start.
125
+
126
+ Native notifications cover low quota, exhausted quota, quota reset, and provider or API failures. The low-quota threshold and duplicate cooldown are configurable in Settings. A focused window shows an in-app toast; a background window asks OpenCode to notify you. The model-change toast has its own Settings toggle and does not control cache mismatch detection. Delivery is best effort, not exactly once.
119
127
 
120
128
  ## Optional browser dashboard
121
129
 
122
- The browser dashboard is a fallback for browser access, not the primary surface. Its default follows the OpenCode host version: on hosts below **2.2.0** it is on by default, because the Native panel requires 2.2.0 or newer; at **2.2.0 or newer** it is off by default. An explicit `dashboard.enabled: true` or `false` in the canonical settings always wins. When it runs, it is served on `127.0.0.1` at the fixed `dashboard.port` (default `4144`) only. It does not listen on network interfaces, does not fall back to another port, and has no cloud component. Local port forwarding, proxy configuration, or another process running on the same machine is outside this guarantee.
130
+ The browser dashboard is a fallback for browser access, not the primary surface. Its default follows the OpenCode host version: on supported hosts below **2.2.1**, including **2.2.0**, it is on by default because the full Native panel requires 2.2.1 or newer; at **2.2.1 or newer** it is off by default. An explicit `dashboard.enabled: true` or `false` in the canonical settings always wins. If the host version is missing or unparseable, the automatic fallback fails closed; a valid explicit setting still applies. A malformed canonical config or invalid setting also fails closed. When it runs, it is served on `127.0.0.1` at the fixed `dashboard.port` (default `4144`) only. It does not listen on network interfaces, does not fall back to another port, and has no cloud component. Local port forwarding, proxy configuration, or another process running on the same machine is outside this guarantee.
123
131
 
124
132
  The browser view exposes the same product areas:
125
133
 
@@ -143,8 +151,8 @@ The routes are real URLs, so reload and browser back/forward work:
143
151
  - **Tokens are not quota.** Quota cards show provider-reported quota, rate-limit, balance, spend, budget, or status values, plus documented local estimates for some providers. Analytics shows token activity recorded by OpenCode on this machine. A token total does not measure remaining quota, and a quota reset does not clear token history. Provider quota can include usage from outside OpenCode, while local analytics cannot see that usage.
144
152
  - **Cost estimates are not bills.** The API-equivalent figure applies list prices to recorded tokens. It is not subscription spend, an invoice, or a reconciliation of what a provider charged; plan pricing, credits, discounts, taxes, and provider billing adjustments are not applied.
145
153
  - **`Free`, `Unpriced`, and unknown tokens are distinct.** `Free` appears only for a non-empty total whose every token has an explicit zero list price. Unpriced or unknown tokens are excluded from the estimate; a mixed total is marked `Partial estimate`, and a non-empty total with no priced tokens is `Unpriced`, never `Free` or `USD 0`. A model with a missing or unrecognized identity or price can make a total partial or unpriced.
146
- - **Coverage is local and provider-limited.** Analytics covers completed steps in the local OpenCode database; other machines, other clients, deleted sessions, and activity not recorded as completed steps are absent. Historical provider/model attribution depends on the raw identities OpenCode stored. Provider coverage and plan support vary: some APIs expose only balance, spend, budget, or status, and a card cannot invent quota that the provider does not return. Cursor and Alibaba cards that use local history are estimates, not official provider totals.
147
- - **Native and browser surfaces.** The Native panel requires OpenCode Desktop 2.2.0+ and ships from v1.3.0. The optional browser dashboard binds to `127.0.0.1`; it is not a hosted service, and the package has no TUI.
154
+ - **Coverage is local and provider-limited.** Analytics covers completed steps in the local OpenCode database; other machines, other clients, deleted sessions, and activity not recorded as completed steps are absent. Historical provider/model attribution depends on the raw identities OpenCode stored. Provider coverage and plan support vary: some APIs expose only balance, spend, budget, or status, and a card cannot invent quota that the provider does not return. Cursor's local-history billing-cycle estimate is not an official provider total. Alibaba Coding Plan uses quota reported by the Bailian CLI.
155
+ - **Native and browser surfaces.** The full Native panel requires OpenCode Desktop 2.2.1+ and ships from v1.3.0. The optional browser dashboard binds to `127.0.0.1`; it is not a hosted service, and the package has no TUI.
148
156
 
149
157
  ## Providers
150
158
 
@@ -157,7 +165,8 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
157
165
 
158
166
  | Provider | Auth/setup | Data from | Reports |
159
167
  | ------------------ | -------------------------------------------------------------- | ------------------ | ------------------ |
160
- | Anthropic (Claude) | [Needs setup](docs/readme/providers.md#anthropic-claude) | Local CLI/OAuth | Quota |
168
+ | Anthropic | [Unavailable](docs/readme/providers.md#anthropic) | — | — |
169
+ | Claude Agent | [Needs setup](docs/readme/providers.md#claude-agent) | Local CLI/OAuth | Quota |
161
170
  | Chutes AI | Automatic | Remote API | Quota |
162
171
  | Cursor | [Needs setup](docs/readme/providers.md#cursor) | Local estimate | Budget and spend |
163
172
  | GitHub Copilot | Automatic | Remote API | Budget and usage |
@@ -179,7 +188,8 @@ Most providers work automatically once you log in through OpenCode. A **Needs se
179
188
 
180
189
  | Provider | Auth/setup | Data from | Reports |
181
190
  | ----------------------- | -------------------------------------------------------------- | ------------------ | ------------------ |
182
- | Anthropic (Claude) | [Needs setup](docs/readme/providers.md#anthropic-claude) | Local CLI/OAuth | Quota |
191
+ | Anthropic | [Unavailable](docs/readme/providers.md#anthropic) | — | — |
192
+ | Claude Agent | [Needs setup](docs/readme/providers.md#claude-agent) | Local CLI/OAuth | Quota |
183
193
  | Chutes AI | Automatic | Remote API | Quota |
184
194
  | Cursor | [Needs setup](docs/readme/providers.md#cursor) | Local estimate | Budget and spend |
185
195
  | Gemini CLI | [Needs setup](docs/readme/providers.md#gemini-cli) | Remote API | Quota |
@@ -203,7 +213,7 @@ Gemini CLI works only with Gemini Code Assist Standard or Enterprise (organizati
203
213
 
204
214
  | Provider | Auth/setup | Data from | Reports |
205
215
  | ----------------------------- | ---------------------------------------------------------------------------- | -------------- | ------------------ |
206
- | Alibaba Coding Plan | Automatic | Local estimate | Quota |
216
+ | Alibaba Coding Plan | [Needs setup](docs/readme/providers.md#alibaba-coding-plan) | Official CLI | Quota |
207
217
  | Alibaba Personal Token Plan | [Needs setup](docs/readme/providers.md#alibaba-personal-token-plan) | Official CLI | Quota |
208
218
  | DeepSeek | Automatic | Remote API | Balance and status |
209
219
  | Kimi Code | Automatic | Remote API | Quota |
@@ -248,7 +258,7 @@ The plugin reads only the canonical file at runtime:
248
258
  - **Legacy import:** when a global legacy OpenCode Quota source exists, Settings can preview and copy seven compatible keys: `percentDisplayMode`, `percentLabelStyle`, `enabledProviders`, `minIntervalMs`, `requestTimeoutMs`, `accountingDetail`, and `waitForQuotaReset`. The import is read-only for the source; files stay byte-for-byte untouched. Custom provider definitions are not imported, so copy `quotaProviders` into the canonical file yourself.
249
259
  - **Visibility:** hiding a provider or row is presentation only and never changes polling or provider data. Opaque card and row IDs in `dashboard.hiddenCards` and `dashboard.hiddenRows` are internal identifiers: use **Settings → Visibility** to manage them instead of editing or deriving IDs by hand.
250
260
  - **Temporal pricing:** `dashboard.temporalProviderOverrides` stores sparse per-provider on/off choices for the live peak and off-peak status in the Quota header. A provider with a discovered account is shown by default; an explicit choice wins. Hiding a status is presentation only and never changes polling, quota values, or recorded usage.
251
- - **Web dashboard (optional fallback):** on by default below OpenCode 2.2.0 and off by default at 2.2.0 and newer. An explicit `"dashboard": { "enabled": true }` or `"dashboard": { "enabled": false }` in the canonical file always wins. When enabled, the browser UI is served on `127.0.0.1` at `dashboard.port` (default `4144`), and the server never falls back to another port. Changes apply after an OpenCode restart.
261
+ - **Web dashboard (optional fallback):** on by default below OpenCode 2.2.1 (including 2.2.0) and off by default at 2.2.1 and newer. An explicit `"dashboard": { "enabled": true }` or `"dashboard": { "enabled": false }` in the canonical file always wins. When enabled, the browser UI is served on `127.0.0.1` at `dashboard.port` (default `4144`), and the server never falls back to another port. Missing/unparseable host versions and malformed or invalid canonical settings fail closed when the switch is absent. Changes apply after an OpenCode restart.
252
262
  - **Browser storage:** the dashboard uses browser-local storage for display state such as the selected range and a visibility-catalog cache. It does not use cross-site cookies.
253
263
  - **Local data:** the plugin reads OpenCode's local configuration and login data through OpenCode, plus OpenCode's local session database for usage and session views. Provider quota checks use the provider's API or the documented local CLI or companion plugin. Token pricing can come from the bundled snapshot or `models.dev` at runtime. Peak and off-peak rules ship in the bundled snapshot and are evaluated locally.
254
264
  - **OpenTelemetry (optional):** off by default. Set `"telemetry": { "enabled": true }` in the canonical file to publish two gauges, `opencode.quota.consumed` and `opencode.quota.cache.age`, through the `@opentelemetry/api` global `MeterProvider` that your host process configures. The plugin does not create a `MeterProvider`, exporter, collector, or metrics endpoint, sends no metrics by itself, and makes no extra provider requests for telemetry. Metric names and attributes are not a public API. See [External integration](docs/readme/external-integration.md#optional-opentelemetry-advanced-host-owned).
@@ -279,7 +289,7 @@ This project has no TUI panel, terminal quota interface or reports, slash comman
279
289
 
280
290
  It is independent of the upstream `@slkiser/opencode-quota` package. The two packages may be configured at the same time, and there is no dependency or conflict guard between them. Each owns its configuration and private state; this package writes under the `opencode-quota-gui` namespace and does not migrate, rewrite, or delete upstream configuration, cache, or credential files.
281
291
 
282
- The browser dashboard default follows the OpenCode host version: it is on by default below 2.2.0, where the Native panel does not exist, and off by default at 2.2.0 and newer. An explicit `dashboard.enabled` value in the canonical settings always wins. Either way, the server stays loopback-only on `127.0.0.1`.
292
+ The browser dashboard default follows the OpenCode host version: it is on by default below 2.2.1 (including 2.2.0), where the full Native panel is unavailable, and off by default at 2.2.1 and newer. An explicit `dashboard.enabled` value in the canonical settings always wins. Either way, the server stays loopback-only on `127.0.0.1`.
283
293
 
284
294
  Use the upstream project if you want its terminal surfaces. Use this project if you want quota and usage inside OpenCode Desktop. See [Updating safely](docs/readme/updating.md) for migration and coexistence details.
285
295
 
File without changes
@@ -1 +1 @@
1
- export const BUILD_IDENTITY = Object.freeze({"version":"1.3.0","build":"fea4e867c45c"});
1
+ export const BUILD_IDENTITY = Object.freeze({"version":"1.3.1","build":"f35c0fbe33be"});
@@ -282,6 +282,8 @@ export interface PrimaryQuotaWindowRef {
282
282
  slot: PrimaryQuotaWindowSlot;
283
283
  }
284
284
  export interface ProviderCard {
285
+ /** Rows are retained from the last successful measurement. */
286
+ stale?: true;
285
287
  cardId: CardId;
286
288
  providerId: string;
287
289
  providerLabel: string;
@@ -311,6 +313,8 @@ export interface ProviderCard {
311
313
  label: string;
312
314
  message: string;
313
315
  retryable?: boolean;
316
+ retryAtMs?: number;
317
+ kind?: "intentional-filter";
314
318
  /** Source-assigned safe category; absence means unknown and consumers fail closed. */
315
319
  failureCategory?: ProviderFailureCategory;
316
320
  }[];
@@ -341,6 +345,7 @@ export interface HomeSnapshot {
341
345
  generatedAtMs: number;
342
346
  range: RangeKey;
343
347
  stale: boolean;
348
+ /** `polledAtMs` is a poll time, not a guarantee that every provider succeeded. */
344
349
  providers: {
345
350
  cards: ProviderCard[];
346
351
  enabledProviders: string[] | "auto";
@@ -511,7 +516,9 @@ export interface DashboardDataSource {
511
516
  home(input: {
512
517
  range: RangeKey;
513
518
  }): Promise<HomeSnapshot>;
514
- quota(): Promise<QuotaSnapshot>;
519
+ quota(input?: {
520
+ refresh?: boolean;
521
+ }): Promise<QuotaSnapshot>;
515
522
  project(input: {
516
523
  projectId: string;
517
524
  range: RangeKey;
@@ -211,6 +211,8 @@ function isProviderCard(value) {
211
211
  isText(entry.label) &&
212
212
  isText(entry.message) &&
213
213
  isOptional(entry.retryable, isBoolean) &&
214
+ isOptional(entry.retryAtMs, isFiniteNumber) &&
215
+ isOptional(entry.kind, (kind) => kind === "intentional-filter") &&
214
216
  isOptional(entry.failureCategory, isProviderFailureCategory)))) {
215
217
  return false;
216
218
  }
@@ -30,5 +30,8 @@ export declare const OPENAI_RESETS_ROW_LABEL = "Resets";
30
30
  export declare const OPENAI_CREDITS_ROW_LABEL = "Credits";
31
31
  /** Exact owner-approved info copy, shown immediately next to the row label. */
32
32
  export declare const OPENAI_RESETS_INFO = "Shown only when OpenAI reports one or more available banked resets.";
33
+ /** Claude Agent reuses the same Resets row; only its stable key and info copy differ. */
34
+ export declare const CLAUDE_AGENT_RESETS_ROW_KEY = "claude-agent:resets";
35
+ export declare const CLAUDE_AGENT_RESETS_INFO = "Shown only when Claude Agent reports one or more available saved resets.";
33
36
  export declare const OPENAI_CREDITS_INFO = "Shown only when OpenAI reports a positive credit balance or unlimited credits.";
34
37
  //# sourceMappingURL=openai-quota.d.ts.map
@@ -15,5 +15,8 @@ export const OPENAI_RESETS_ROW_LABEL = "Resets";
15
15
  export const OPENAI_CREDITS_ROW_LABEL = "Credits";
16
16
  /** Exact owner-approved info copy, shown immediately next to the row label. */
17
17
  export const OPENAI_RESETS_INFO = "Shown only when OpenAI reports one or more available banked resets.";
18
+ /** Claude Agent reuses the same Resets row; only its stable key and info copy differ. */
19
+ export const CLAUDE_AGENT_RESETS_ROW_KEY = "claude-agent:resets";
20
+ export const CLAUDE_AGENT_RESETS_INFO = "Shown only when Claude Agent reports one or more available saved resets.";
18
21
  export const OPENAI_CREDITS_INFO = "Shown only when OpenAI reports a positive credit balance or unlimited credits.";
19
22
  //# sourceMappingURL=openai-quota.js.map
@@ -68,6 +68,63 @@
68
68
  "2026-09-20",
69
69
  "2026-10-10"
70
70
  ]
71
+ },
72
+ "2027": {
73
+ "timeZone": "Asia/Shanghai",
74
+ "source": "https://english.www.gov.cn/policies/latestreleases/202611/06/content_WS6aed74dcc6d00ca5f9a0e22e.html",
75
+ "published": "2026-11-06",
76
+ "intervals": [
77
+ {
78
+ "id": "new-year",
79
+ "localStart": "2027-01-01",
80
+ "localEnd": "2027-01-04",
81
+ "startMs": 1798732800000,
82
+ "endMs": 1798992000000
83
+ },
84
+ {
85
+ "id": "spring-festival",
86
+ "localStart": "2027-02-05",
87
+ "localEnd": "2027-02-14",
88
+ "startMs": 1801756800000,
89
+ "endMs": 1802534400000
90
+ },
91
+ {
92
+ "id": "qingming",
93
+ "localStart": "2027-04-03",
94
+ "localEnd": "2027-04-06",
95
+ "startMs": 1806681600000,
96
+ "endMs": 1806940800000
97
+ },
98
+ {
99
+ "id": "labour-day",
100
+ "localStart": "2027-05-01",
101
+ "localEnd": "2027-05-06",
102
+ "startMs": 1809100800000,
103
+ "endMs": 1809532800000
104
+ },
105
+ {
106
+ "id": "dragon-boat-festival",
107
+ "localStart": "2027-06-09",
108
+ "localEnd": "2027-06-10",
109
+ "startMs": 1812470400000,
110
+ "endMs": 1812556800000
111
+ },
112
+ {
113
+ "id": "mid-autumn-festival",
114
+ "localStart": "2027-09-15",
115
+ "localEnd": "2027-09-16",
116
+ "startMs": 1820937600000,
117
+ "endMs": 1821024000000
118
+ },
119
+ {
120
+ "id": "national-day",
121
+ "localStart": "2027-10-01",
122
+ "localEnd": "2027-10-08",
123
+ "startMs": 1822320000000,
124
+ "endMs": 1822924800000
125
+ }
126
+ ],
127
+ "makeupWorkdays": []
71
128
  }
72
129
  }
73
130
  },
@@ -10,17 +10,17 @@
10
10
  * write helpers.
11
11
  */
12
12
  import type { GuiSettingsStore } from "../contracts/dashboard.js";
13
- import type { OpenCodeVersion } from "../lib/opencode-version.js";
13
+ import type { OpenCodeVersion } from "../lib/opencode-version-core.js";
14
14
  import { type SettingsFileOpener } from "./settings-file-opener.js";
15
15
  /** Writable GUI settings keys (spec §5.4 table order plus the web switch; port excluded). */
16
- export declare const GUI_SETTINGS_WRITABLE_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled"];
16
+ export declare const GUI_SETTINGS_WRITABLE_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "nativeQuotaNotifications", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled"];
17
17
  /**
18
18
  * Read-only GUI settings keys: the port needs a restart, and the hidden-card
19
19
  * semantics marker is server-managed after an automatic write stamp.
20
20
  */
21
21
  export declare const GUI_SETTINGS_READ_ONLY_KEYS: readonly ["dashboard.port", "dashboard.hiddenCardsVersion"];
22
22
  /** Every GUI-exposed settings key (spec §5.4), in table order. */
23
- export declare const GUI_SETTINGS_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled", "dashboard.port", "dashboard.hiddenCardsVersion"];
23
+ export declare const GUI_SETTINGS_KEYS: readonly ["formatStyle", "percentDisplayMode", "percentLabelStyle", "quotaProjection", "resetTimeDecimals", "resetTimeSpaced", "waitForQuotaReset", "enabledProviders", "minIntervalMs", "requestTimeoutMs", "accountingDetail", "lowQuotaThresholdRemainingPercent", "duplicateCooldownMinutes", "nativeQuotaNotifications", "opencodeGoWindows", "opencodeMonthlyLimit", "dashboard.hiddenCards", "dashboard.hiddenRows", "dashboard.providerOrder", "dashboard.cardOrder", "dashboard.temporalProviderOverrides", "dashboard.enabled", "dashboard.port", "dashboard.hiddenCardsVersion"];
24
24
  export type GuiSettingsKey = (typeof GUI_SETTINGS_KEYS)[number];
25
25
  export type GuiSettingsErrorCode = "config-read-error" | "config-changed" | "config-target-error" | "config-write-error" | "unknown-setting" | "invalid-setting";
26
26
  export interface GuiSettingsErrorDetails {
@@ -14,7 +14,8 @@ import { existsSync } from "node:fs";
14
14
  import { readFile } from "node:fs/promises";
15
15
  import { resolve } from "node:path";
16
16
  import { LEGACY_IMPORT_KEYS } from "../contracts/settings.js";
17
- import { buildConfigLayerCandidates, createLoadConfigMeta, GUI_CONFIG_RELATIVE_PATH, GUI_CONFIG_SIBLING_JSON_RELATIVE_PATH, getGuiConfigPath, getGuiConfigSiblingJsonPath, isPositiveNumber, isValidDuplicateCooldownMinutes, isValidLowQuotaThresholdRemainingPercent, isValidOpenCodeGoWindows, loadConfig, loadConfigLayered, normalizeEnabledProviders, } from "../lib/config.js";
17
+ import { withCanonicalConfigLock } from "../lib/canonical-config-lock.js";
18
+ import { buildConfigLayerCandidates, createLoadConfigMeta, GUI_CONFIG_RELATIVE_PATH, GUI_CONFIG_SIBLING_JSON_RELATIVE_PATH, getGuiConfigPath, getGuiConfigSiblingJsonPath, isPositiveNumber, isValidDuplicateCooldownMinutes, isValidLowQuotaThresholdRemainingPercent, isValidNativeQuotaNotificationPolicy, isValidOpenCodeGoWindows, loadConfig, loadConfigLayered, normalizeEnabledProviders, } from "../lib/config.js";
18
19
  import { ConfigWriteTargetError, } from "../lib/config-write-target.js";
19
20
  import { DASHBOARD_HIDDEN_CARDS_VERSION } from "../lib/dashboard-visibility.js";
20
21
  import { getDashboardEnabledSetting, hasInvalidDashboardWebConfig, resolveDashboardWebEnabled, } from "../lib/dashboard-web-policy.js";
@@ -39,6 +40,7 @@ export const GUI_SETTINGS_WRITABLE_KEYS = [
39
40
  "accountingDetail",
40
41
  "lowQuotaThresholdRemainingPercent",
41
42
  "duplicateCooldownMinutes",
43
+ "nativeQuotaNotifications",
42
44
  "opencodeGoWindows",
43
45
  "opencodeMonthlyLimit",
44
46
  "dashboard.hiddenCards",
@@ -164,7 +166,8 @@ export function createGuiSettingsStore(options) {
164
166
  let previewedRevision;
165
167
  /** One serialized queue for all writers: the loser's stale revision yields 409. */
166
168
  function withLock(run) {
167
- const next = lockTail.then(run, run);
169
+ const write = () => withCanonicalConfigLock(canonicalPath, run);
170
+ const next = lockTail.then(write, write);
168
171
  lockTail = next.then(() => undefined, () => undefined);
169
172
  return next;
170
173
  }
@@ -222,6 +225,19 @@ export function createGuiSettingsStore(options) {
222
225
  return config.lowQuotaThresholdRemainingPercent;
223
226
  case "duplicateCooldownMinutes":
224
227
  return config.duplicateCooldownMinutes;
228
+ case "nativeQuotaNotifications":
229
+ return {
230
+ enabled: config.nativeQuotaNotifications.enabled,
231
+ modelChangeToastEnabled: config.nativeQuotaNotifications.modelChangeToastEnabled,
232
+ low: { ...config.nativeQuotaNotifications.low },
233
+ exhausted: { ...config.nativeQuotaNotifications.exhausted },
234
+ reset: {
235
+ ...config.nativeQuotaNotifications.reset,
236
+ windows: [...config.nativeQuotaNotifications.reset.windows],
237
+ },
238
+ providerError: { ...config.nativeQuotaNotifications.providerError },
239
+ duplicateCooldownMinutes: config.nativeQuotaNotifications.duplicateCooldownMinutes,
240
+ };
225
241
  case "opencodeGoWindows":
226
242
  return [...config.opencodeGoWindows];
227
243
  case "opencodeMonthlyLimit":
@@ -417,6 +433,19 @@ export function createGuiSettingsStore(options) {
417
433
  throw invalidSetting(key, "expected an integer of 0 or more");
418
434
  }
419
435
  return value;
436
+ case "nativeQuotaNotifications":
437
+ if (!isValidNativeQuotaNotificationPolicy(value)) {
438
+ throw invalidSetting(key, "expected a complete Native quota notification policy");
439
+ }
440
+ return {
441
+ enabled: value.enabled,
442
+ modelChangeToastEnabled: value.modelChangeToastEnabled,
443
+ low: { ...value.low },
444
+ exhausted: { ...value.exhausted },
445
+ reset: { ...value.reset, windows: [...new Set(value.reset.windows)] },
446
+ providerError: { ...value.providerError },
447
+ duplicateCooldownMinutes: value.duplicateCooldownMinutes,
448
+ };
420
449
  case "opencodeGoWindows":
421
450
  if (!isValidOpenCodeGoWindows(value)) {
422
451
  throw invalidSetting(key, 'expected a non-empty subset of "rolling", "weekly", "monthly"');
@@ -12,7 +12,7 @@
12
12
  * shared by every transport attached to that host. The host closes with the
13
13
  * last lease, releasing the snapshot service and every source it created. The
14
14
  * web transport is optional and follows the host version when `dashboard.enabled`
15
- * is absent (on below OpenCode 2.2.0, off from 2.2.0): when it is off, or when
15
+ * is absent (on below OpenCode 2.2.1, off from 2.2.1): when it is off, or when
16
16
  * its fixed port cannot bind, the shared runtime stays available for the
17
17
  * remaining leases and no HTTP/SSE/static surface is started.
18
18
  *
@@ -29,7 +29,7 @@
29
29
  */
30
30
  import type { DashboardDataSource, GuiSettingsStore, QuotaSnapshot } from "../contracts/dashboard.js";
31
31
  import type { QuotaProviderContext } from "../lib/entries.js";
32
- import { type OpenCodeVersion } from "../lib/opencode-version.js";
32
+ import type { OpenCodeVersion } from "../lib/opencode-version-core.js";
33
33
  import { type GuiSettingsStoreOptions } from "./config.js";
34
34
  import { type GuiLogger } from "./log.js";
35
35
  import { type QuotaNotificationObserver } from "./quota-notification-observer.js";
@@ -42,7 +42,9 @@ import { type SnapshotService, type SnapshotServiceOptions } from "./snapshot-se
42
42
  export type DashboardClient = QuotaProviderContext["client"];
43
43
  /** The read side of the dashboard source this lifecycle needs (P3 producer). */
44
44
  export type DashboardReadSource = Pick<DashboardDataSource, "home" | "project" | "session" | "groups"> & {
45
- quota?(): Promise<QuotaSnapshot>;
45
+ quota?(input?: {
46
+ refresh?: boolean;
47
+ }): Promise<QuotaSnapshot>;
46
48
  /** One shared analytics refresh per transport tick, when the owner loaded analytics. */
47
49
  refreshAnalytics?(): Promise<void>;
48
50
  /** Owner dispose / host close: releases lazily created analytics resources. */
@@ -12,7 +12,7 @@
12
12
  * shared by every transport attached to that host. The host closes with the
13
13
  * last lease, releasing the snapshot service and every source it created. The
14
14
  * web transport is optional and follows the host version when `dashboard.enabled`
15
- * is absent (on below OpenCode 2.2.0, off from 2.2.0): when it is off, or when
15
+ * is absent (on below OpenCode 2.2.1, off from 2.2.1): when it is off, or when
16
16
  * its fixed port cannot bind, the shared runtime stays available for the
17
17
  * remaining leases and no HTTP/SSE/static surface is started.
18
18
  *
@@ -213,7 +213,7 @@ function createDelegatingSource(delegation, logger, observation) {
213
213
  project: async (input) => (await requireSource()).project(input),
214
214
  session: async (input) => (await requireSource()).session(input),
215
215
  groups: async (query) => (await requireSource()).groups(query),
216
- quota: async () => {
216
+ quota: async (input) => {
217
217
  // Capture the source generation before resolving the owner and before the
218
218
  // asynchronous provider read. A handoff during either step changes the
219
219
  // token, and the observer drops the old source's snapshot instead of
@@ -225,7 +225,7 @@ function createDelegatingSource(delegation, logger, observation) {
225
225
  // Mirrors `SnapshotService`: a source without quota answers as unavailable.
226
226
  if (!source.quota)
227
227
  throw new Error("Quota source unavailable");
228
- const snapshot = await source.quota();
228
+ const snapshot = await source.quota(input);
229
229
  if (observer !== undefined && delegation.activeOwner === owner) {
230
230
  observer.observe(snapshot, epoch);
231
231
  }
@@ -1,4 +1,11 @@
1
1
  import { isPercentEntry } from "../lib/entries.js";
2
+ const ANTHROPIC_SUBSCRIPTION_WINDOWS = {
3
+ rowKeys: [
4
+ { value: "window:five_hour", slot: 0 },
5
+ { value: "window:week", slot: 1 },
6
+ ],
7
+ namedMetrics: [{ value: "Fable weekly", slot: 2 }],
8
+ };
2
9
  /**
3
10
  * Explicit, evidence-backed mapping. Omitted providers intentionally have no
4
11
  * defensible primary/auxiliary split in their current source (see the Stage 6
@@ -6,14 +13,10 @@ import { isPercentEntry } from "../lib/entries.js";
6
13
  */
7
14
  const PRIMARY_QUOTA_WINDOW_RULES = {
8
15
  // 5h, weekly, and the provider's explicit Fable weekly slot; `window:month`
9
- // is Usage Credits (`src/providers/anthropic.ts` 160-195, 240-274).
10
- anthropic: {
11
- rowKeys: [
12
- { value: "window:five_hour", slot: 0 },
13
- { value: "window:week", slot: 1 },
14
- ],
15
- namedMetrics: [{ value: "Fable weekly", slot: 2 }],
16
- },
16
+ // is Usage Credits (`anthropicQuotaEntries` in `src/providers/anthropic.ts`).
17
+ anthropic: ANTHROPIC_SUBSCRIPTION_WINDOWS,
18
+ // Claude Agent emits the same subscription rows from its Claude CLI login.
19
+ "claude-agent": ANTHROPIC_SUBSCRIPTION_WINDOWS,
17
20
  // 5h/weekly/monthly ChatGPT windows; Code Review is a special secondary
18
21
  // window (`src/providers/openai.ts` 56-75, 239-261).
19
22
  openai: {
@@ -90,12 +93,11 @@ const PRIMARY_QUOTA_WINDOW_RULES = {
90
93
  { value: "named:period", slot: 0 },
91
94
  ],
92
95
  },
93
- // These providers always emit the same single surviving row, so its window
94
- // meaning cannot move with availability. Synthetic always emits 5h then
95
- // weekly; Alibaba Coding Plan always emits 5h/weekly/monthly in that order;
96
- // Chutes emits one daily-reset quota window (`src/providers/synthetic.ts`
97
- // 84-103, `src/providers/alibaba-coding-plan.ts` 116-159,
98
- // `src/providers/chutes.ts` 43-55).
96
+ // These provider cards compact their quota entries into one aggregate row.
97
+ // Synthetic returns 5h before weekly; Bailian CLI Coding Plan may return any
98
+ // of 5h/weekly/monthly in that order; Chutes returns one daily-reset window
99
+ // (`src/providers/synthetic.ts` 84-103, `src/providers/alibaba-coding-plan.ts`
100
+ // 116-159, `src/providers/chutes.ts` 43-55).
99
101
  //
100
102
  // Deliberately omitted untyped providers:
101
103
  // - Alibaba Token Plan emits optional 5h/weekly
@@ -13,7 +13,6 @@ export declare const PROVIDER_ERROR_GENERIC_LABEL = "Provider error";
13
13
  */
14
14
  export interface ProviderCardPreferences {
15
15
  accountingDetail: QuotaToastConfig["accountingDetail"];
16
- quotaProjection?: QuotaToastConfig["quotaProjection"];
17
16
  resetTimeDecimals?: QuotaToastConfig["resetTimeDecimals"];
18
17
  resetTimeSpaced?: QuotaToastConfig["resetTimeSpaced"];
19
18
  /**
@@ -31,8 +30,15 @@ export interface ProviderCardPreferences {
31
30
  */
32
31
  cardOrder?: readonly string[];
33
32
  }
33
+ export declare const UNSCOPED: unique symbol;
34
+ export type SourceKey = string | typeof UNSCOPED;
35
+ export declare function cardSourceKey(sourceId: string | undefined, accountSourceIds: ReadonlySet<string>): SourceKey;
36
+ export type MergedProbe = QuotaStatusLiveProbe & {
37
+ retainedSourceIds?: ReadonlySet<string>;
38
+ retainedUnscoped?: boolean;
39
+ };
34
40
  export interface BuildProviderCardsInput {
35
- probes: readonly QuotaStatusLiveProbe[];
41
+ probes: readonly MergedProbe[];
36
42
  preferences: ProviderCardPreferences;
37
43
  nowMs: number;
38
44
  /** Provider display label resolver; defaults to the registration table. */
@@ -43,6 +49,8 @@ export interface BuildProviderCardsInput {
43
49
  * the Settings eyes only; they never create a zero/empty Quota data row.
44
50
  */
45
51
  export declare function openAiOptionalVisibilityRows(cardId: CardId): NonNullable<ProviderCard["visibilityRows"]>;
52
+ /** Persistent Resets choice for a Claude Agent card (no Credits row). */
53
+ export declare function claudeAgentOptionalVisibilityRows(cardId: CardId): NonNullable<ProviderCard["visibilityRows"]>;
46
54
  /**
47
55
  * One card per discovered account (zero-entry and failed ones included) plus a
48
56
  * provider-scope card for unscoped content or when no account was discovered.