opencode-quota-gui 1.3.0 → 1.3.2

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 (238) hide show
  1. package/README.md +34 -20
  2. package/dist/bin/opencode-quota-gui.js +0 -0
  3. package/dist/contracts/build-identity.js +1 -1
  4. package/dist/contracts/card-order.d.ts +2 -0
  5. package/dist/contracts/card-order.js +2 -2
  6. package/dist/contracts/card-visibility.d.ts +2 -1
  7. package/dist/contracts/card-visibility.js +2 -1
  8. package/dist/contracts/dashboard.d.ts +95 -6
  9. package/dist/contracts/dashboard.js +10 -0
  10. package/dist/contracts/dto-guards.d.ts +4 -0
  11. package/dist/contracts/dto-guards.js +31 -7
  12. package/dist/contracts/guards.js +3 -1
  13. package/dist/contracts/identity.d.ts +37 -5
  14. package/dist/contracts/identity.js +43 -0
  15. package/dist/contracts/openai-quota.d.ts +3 -0
  16. package/dist/contracts/openai-quota.js +3 -0
  17. package/dist/contracts/provider-auto-resume.d.ts +9 -0
  18. package/dist/contracts/provider-auto-resume.js +24 -0
  19. package/dist/contracts/provider-failure.d.ts +22 -0
  20. package/dist/contracts/provider-failure.js +25 -1
  21. package/dist/contracts/row-order.d.ts +13 -0
  22. package/dist/contracts/row-order.js +34 -0
  23. package/dist/contracts/row-visibility.d.ts +53 -0
  24. package/dist/contracts/row-visibility.js +130 -0
  25. package/dist/data/modelsdev-pricing.min.json +1 -1
  26. package/dist/data/modelsdev-temporal.min.json +60 -634
  27. package/dist/gui/aggregation.d.ts +29 -1
  28. package/dist/gui/aggregation.js +157 -4
  29. package/dist/gui/analytics-bridge.d.ts +8 -9
  30. package/dist/gui/analytics-bridge.js +197 -54
  31. package/dist/gui/analytics-engine.d.ts +7 -15
  32. package/dist/gui/analytics-engine.js +246 -106
  33. package/dist/gui/analytics-model.d.ts +7 -0
  34. package/dist/gui/analytics-model.js +75 -9
  35. package/dist/gui/analytics-pricing-upkeep.d.ts +21 -0
  36. package/dist/gui/analytics-pricing-upkeep.js +23 -0
  37. package/dist/gui/analytics-protocol.d.ts +17 -7
  38. package/dist/gui/analytics-protocol.js +1 -0
  39. package/dist/gui/analytics-service.d.ts +10 -0
  40. package/dist/gui/analytics-service.js +30 -9
  41. package/dist/gui/analytics-state.d.ts +30 -5
  42. package/dist/gui/analytics-state.js +46 -7
  43. package/dist/gui/analytics-worker-runtime.d.ts +5 -0
  44. package/dist/gui/analytics-worker-runtime.js +9 -1
  45. package/dist/gui/analytics-worker.js +11 -0
  46. package/dist/gui/config.d.ts +3 -3
  47. package/dist/gui/config.js +77 -7
  48. package/dist/gui/identity.d.ts +6 -20
  49. package/dist/gui/identity.js +6 -54
  50. package/dist/gui/lifecycle.d.ts +5 -3
  51. package/dist/gui/lifecycle.js +3 -3
  52. package/dist/gui/primary-quota-windows.js +67 -44
  53. package/dist/gui/provider-cards.d.ts +20 -8
  54. package/dist/gui/provider-cards.js +42 -55
  55. package/dist/gui/quota-notification-detector.d.ts +29 -6
  56. package/dist/gui/quota-notification-detector.js +136 -47
  57. package/dist/gui/quota-notification-observer.d.ts +3 -4
  58. package/dist/gui/quota-notification-observer.js +73 -20
  59. package/dist/gui/quota-observation.d.ts +4 -0
  60. package/dist/gui/quota-observation.js +18 -0
  61. package/dist/gui/rpc.d.ts +2 -0
  62. package/dist/gui/rpc.js +14 -3
  63. package/dist/gui/server.js +17 -3
  64. package/dist/gui/snapshot-service.d.ts +3 -15
  65. package/dist/gui/snapshot-service.js +281 -23
  66. package/dist/gui/sources.js +179 -64
  67. package/dist/gui/temporal-status.d.ts +3 -2
  68. package/dist/gui/temporal-status.js +10 -6
  69. package/dist/gui-experimental.cjs +230 -225
  70. package/dist/lib/accounting-format.d.ts +8 -0
  71. package/dist/lib/accounting-format.js +20 -2
  72. package/dist/lib/alibaba-coding-plan-cli.d.ts +79 -0
  73. package/dist/lib/alibaba-coding-plan-cli.js +539 -0
  74. package/dist/lib/anthropic-api-auth.d.ts +7 -0
  75. package/dist/lib/anthropic-api-auth.js +27 -0
  76. package/dist/lib/anthropic-api-rate-limits.d.ts +47 -0
  77. package/dist/lib/anthropic-api-rate-limits.js +92 -0
  78. package/dist/lib/anthropic-auth.d.ts +2 -3
  79. package/dist/lib/anthropic-auth.js +2 -3
  80. package/dist/lib/anthropic-oauth-throttle.d.ts +76 -0
  81. package/dist/lib/anthropic-oauth-throttle.js +379 -0
  82. package/dist/lib/anthropic.d.ts +68 -14
  83. package/dist/lib/anthropic.js +1016 -363
  84. package/dist/lib/api-key-retry-after.d.ts +7 -0
  85. package/dist/lib/api-key-retry-after.js +62 -0
  86. package/dist/lib/atomic-json.d.ts +2 -0
  87. package/dist/lib/atomic-json.js +1 -0
  88. package/dist/lib/cache-observer-ingestion.d.ts +90 -0
  89. package/dist/lib/cache-observer-ingestion.js +1008 -0
  90. package/dist/lib/cache-observer.d.ts +141 -0
  91. package/dist/lib/cache-observer.js +323 -0
  92. package/dist/lib/canonical-config-lock.d.ts +9 -0
  93. package/dist/lib/canonical-config-lock.js +36 -0
  94. package/dist/lib/chutes.js +62 -51
  95. package/dist/lib/claude-agent-transcript-ttl.d.ts +48 -0
  96. package/dist/lib/claude-agent-transcript-ttl.js +154 -0
  97. package/dist/lib/claude-agent-ttl-tracker.d.ts +21 -0
  98. package/dist/lib/claude-agent-ttl-tracker.js +152 -0
  99. package/dist/lib/cli-show.d.ts +5 -0
  100. package/dist/lib/cli-show.js +21 -8
  101. package/dist/lib/cli-status.js +3 -6
  102. package/dist/lib/config-write-target.d.ts +1 -1
  103. package/dist/lib/config-write-target.js +5 -2
  104. package/dist/lib/config.d.ts +2 -1
  105. package/dist/lib/config.js +257 -4
  106. package/dist/lib/copilot.js +171 -86
  107. package/dist/lib/dashboard-visibility.d.ts +5 -0
  108. package/dist/lib/dashboard-visibility.js +11 -10
  109. package/dist/lib/dashboard-web-policy.d.ts +4 -4
  110. package/dist/lib/dashboard-web-policy.js +2 -2
  111. package/dist/lib/deepseek.js +25 -13
  112. package/dist/lib/display-sanitize.js +2 -0
  113. package/dist/lib/entries.d.ts +33 -1
  114. package/dist/lib/entries.js +6 -0
  115. package/dist/lib/glm-coding-plan.js +98 -74
  116. package/dist/lib/google-agy.js +90 -12
  117. package/dist/lib/google-gemini-cli.js +84 -11
  118. package/dist/lib/grouped-entry-normalization.js +1 -1
  119. package/dist/lib/http.d.ts +4 -0
  120. package/dist/lib/http.js +16 -2
  121. package/dist/lib/init-installer.js +5 -3
  122. package/dist/lib/kilo.js +37 -18
  123. package/dist/lib/kimi.js +35 -18
  124. package/dist/lib/maintainer-announcements.js +2 -2
  125. package/dist/lib/mimo.d.ts +2 -0
  126. package/dist/lib/mimo.js +36 -0
  127. package/dist/lib/modelsdev-pricing.d.ts +74 -2
  128. package/dist/lib/modelsdev-pricing.js +457 -63
  129. package/dist/lib/modelsdev-temporal.d.ts +6 -0
  130. package/dist/lib/modelsdev-temporal.js +16 -2
  131. package/dist/lib/nanogpt.d.ts +1 -0
  132. package/dist/lib/nanogpt.js +26 -3
  133. package/dist/lib/ollama-cloud.d.ts +1 -1
  134. package/dist/lib/ollama-cloud.js +48 -35
  135. package/dist/lib/openai.js +84 -38
  136. package/dist/lib/opencode-auth-sqlite.d.ts +2 -2
  137. package/dist/lib/opencode-auth-sqlite.js +2 -2
  138. package/dist/lib/opencode-config-editor.d.ts +1 -0
  139. package/dist/lib/opencode-config-editor.js +6 -1
  140. package/dist/lib/opencode-config-providers.js +2 -2
  141. package/dist/lib/opencode-go.js +29 -2
  142. package/dist/lib/opencode-storage.d.ts +20 -0
  143. package/dist/lib/opencode-storage.js +89 -2
  144. package/dist/lib/opencode-version-core.d.ts +30 -0
  145. package/dist/lib/opencode-version-core.js +59 -0
  146. package/dist/lib/opencode-version.d.ts +2 -22
  147. package/dist/lib/opencode-version.js +4 -48
  148. package/dist/lib/opencode-warming-refresh.d.ts +19 -0
  149. package/dist/lib/opencode-warming-refresh.js +95 -0
  150. package/dist/lib/opencode-zen.d.ts +3 -0
  151. package/dist/lib/opencode-zen.js +71 -5
  152. package/dist/lib/provider-add.js +5 -2
  153. package/dist/lib/provider-metadata.d.ts +11 -3
  154. package/dist/lib/provider-metadata.js +20 -2
  155. package/dist/lib/provider-registration.d.ts +358 -9
  156. package/dist/lib/provider-registration.js +423 -30
  157. package/dist/lib/quota-auto-resume.d.ts +74 -0
  158. package/dist/lib/quota-auto-resume.js +539 -0
  159. package/dist/lib/quota-command-format.js +23 -10
  160. package/dist/lib/quota-exhaustion-projection.d.ts +11 -0
  161. package/dist/lib/quota-exhaustion-projection.js +25 -0
  162. package/dist/lib/quota-identity.d.ts +64 -0
  163. package/dist/lib/quota-identity.js +111 -0
  164. package/dist/lib/quota-providers-remote.d.ts +2 -1
  165. package/dist/lib/quota-providers-remote.js +59 -3
  166. package/dist/lib/quota-providers.d.ts +1 -1
  167. package/dist/lib/quota-providers.js +14 -37
  168. package/dist/lib/quota-render-data.d.ts +6 -0
  169. package/dist/lib/quota-render-data.js +45 -19
  170. package/dist/lib/quota-reset-notifications.js +11 -155
  171. package/dist/lib/quota-retry-wait.d.ts +106 -5
  172. package/dist/lib/quota-retry-wait.js +301 -34
  173. package/dist/lib/quota-runtime-context.js +1 -0
  174. package/dist/lib/quota-state-codec.d.ts +2 -0
  175. package/dist/lib/quota-state-codec.js +31 -2
  176. package/dist/lib/quota-state.d.ts +8 -2
  177. package/dist/lib/quota-state.js +253 -47
  178. package/dist/lib/quota-stats.d.ts +26 -0
  179. package/dist/lib/quota-stats.js +40 -1
  180. package/dist/lib/quota-status.js +3 -51
  181. package/dist/lib/quota-surface-data.js +18 -3
  182. package/dist/lib/quota-telemetry.js +2 -2
  183. package/dist/lib/resolved-auth-identity.d.ts +19 -0
  184. package/dist/lib/resolved-auth-identity.js +44 -0
  185. package/dist/lib/scoped-update.d.ts +1 -1
  186. package/dist/lib/state-file-lock.d.ts +26 -0
  187. package/dist/lib/state-file-lock.js +205 -0
  188. package/dist/lib/synthetic.js +65 -54
  189. package/dist/lib/toast-format-grouped.js +7 -4
  190. package/dist/lib/tui-compact-format.js +29 -16
  191. package/dist/lib/types.d.ts +51 -1
  192. package/dist/lib/types.js +17 -1
  193. package/dist/lib/xai.js +48 -22
  194. package/dist/plugin.js +328 -14
  195. package/dist/provider-logos/NOTICE.md +1 -1
  196. package/dist/provider-logos/OPENCODE-NOTICE.md +4 -3
  197. package/dist/providers/alibaba-coding-plan.js +125 -104
  198. package/dist/providers/alibaba-token-plan.js +9 -5
  199. package/dist/providers/anthropic.d.ts +16 -3
  200. package/dist/providers/anthropic.js +172 -220
  201. package/dist/providers/cache-policies.d.ts +11 -4
  202. package/dist/providers/cache-policies.js +19 -13
  203. package/dist/providers/chutes.js +2 -0
  204. package/dist/providers/claude-agent.d.ts +19 -0
  205. package/dist/providers/claude-agent.js +215 -0
  206. package/dist/providers/copilot.js +7 -4
  207. package/dist/providers/glm-coding-plan-provider.d.ts +1 -0
  208. package/dist/providers/glm-coding-plan-provider.js +30 -23
  209. package/dist/providers/google-account-format.js +1 -0
  210. package/dist/providers/google-agy.d.ts +6 -5
  211. package/dist/providers/google-agy.js +43 -15
  212. package/dist/providers/google-gemini-cli.js +1 -0
  213. package/dist/providers/kilo.js +1 -0
  214. package/dist/providers/kimi-code.js +2 -0
  215. package/dist/providers/mimo.js +1 -0
  216. package/dist/providers/nanogpt.js +1 -0
  217. package/dist/providers/ollama-cloud.js +10 -0
  218. package/dist/providers/openai.js +24 -23
  219. package/dist/providers/opencode-go.js +10 -6
  220. package/dist/providers/opencode-zen.js +3 -1
  221. package/dist/providers/openrouter.js +1 -0
  222. package/dist/providers/quota-providers.js +16 -5
  223. package/dist/providers/registry.js +2 -0
  224. package/dist/providers/result-helpers.d.ts +6 -2
  225. package/dist/providers/result-helpers.js +7 -1
  226. package/dist/providers/synthetic.js +4 -0
  227. package/dist/providers/xai.js +9 -8
  228. package/dist/rpc.d.ts +129 -8
  229. package/dist/rpc.js +219 -14
  230. package/dist/ui/assets/{index-cDd9jUVY.css → index-6_g1FHs-.css} +1 -1
  231. package/dist/ui/assets/index-sZnGUuML.js +10 -0
  232. package/dist/ui/assets/{popover-BGkgv9s0.js → popover-C4ZLYe9E.js} +1 -1
  233. package/dist/ui/assets/providers/claude-agent.svg +3 -0
  234. package/dist/ui/index.html +2 -2
  235. package/package.json +45 -46
  236. package/dist/lib/alibaba-coding-plan-local-quota.d.ts +0 -47
  237. package/dist/lib/alibaba-coding-plan-local-quota.js +0 -146
  238. package/dist/ui/assets/index-DLHeXYff.js +0 -9
@@ -1,14 +1,150 @@
1
+ import { CLAUDE_AGENT_RESETS_INFO, CLAUDE_AGENT_RESETS_ROW_KEY, OPENAI_CREDITS_INFO, OPENAI_CREDITS_ROW_KEY, OPENAI_CREDITS_ROW_LABEL, OPENAI_CREDITS_ROW_RESULT_TYPE, OPENAI_RESETS_INFO, OPENAI_RESETS_ROW_KEY, OPENAI_RESETS_ROW_LABEL, OPENAI_RESETS_ROW_RESULT_TYPE, } from "../contracts/openai-quota.js";
2
+ const GLM_OPTIONAL_VISIBILITY_ROWS = [
3
+ {
4
+ rowKey: "window:five_hour",
5
+ resultType: "quota",
6
+ kind: "percent",
7
+ label: "5h",
8
+ info: "GLM coding-plan 5-hour window, when the plan reports it.",
9
+ },
10
+ {
11
+ rowKey: "window:week",
12
+ resultType: "quota",
13
+ kind: "percent",
14
+ label: "Weekly",
15
+ info: "GLM coding-plan weekly window, when the plan reports it.",
16
+ },
17
+ {
18
+ rowKey: "window:mcp",
19
+ resultType: "quota",
20
+ kind: "percent",
21
+ label: "MCP",
22
+ info: "GLM coding-plan MCP quota, when the plan reports it.",
23
+ },
24
+ ];
25
+ const GLM_CODING_PLAN_SHAPE = {
26
+ autoSetup: "yes",
27
+ authentication: "opencode_auth_api_key",
28
+ authFallbacks: ["env_api_key", "global_opencode_config"],
29
+ quota: "remote_api",
30
+ autoResume: "account-or-single-source",
31
+ optionalVisibilityRows: GLM_OPTIONAL_VISIBILITY_ROWS,
32
+ };
33
+ const SINGLE_SOURCE_KEY_SHAPE = {
34
+ autoSetup: "usually",
35
+ authentication: "opencode_auth_api_key",
36
+ authFallbacks: ["env_api_key", "global_opencode_config"],
37
+ quota: "remote_api",
38
+ autoResume: "single-source",
39
+ };
40
+ const CLI_WINDOW_ROWS = [
41
+ { window: "five_hour", label: "5h", unit: "5-hour" },
42
+ { window: "week", label: "Weekly", unit: "weekly" },
43
+ { window: "month", label: "Monthly", unit: "monthly" },
44
+ ];
45
+ /**
46
+ * The optional window rows a local-CLI plan declares. Both Alibaba plans share
47
+ * the row contract (ids, result type and alternate status shape) and differ
48
+ * only in their plan name and which windows the CLI reports, so one factory
49
+ * keeps their declared ids aligned.
50
+ */
51
+ function cliWindowRows(planLabel, windows) {
52
+ return CLI_WINDOW_ROWS.filter((row) => windows.includes(row.window)).map((row) => ({
53
+ rowKey: `window:${row.window}`,
54
+ resultType: "quota",
55
+ kind: "percent",
56
+ alternateShapes: [{ resultType: "status", kind: "value" }],
57
+ label: row.label,
58
+ info: `${planLabel} ${row.unit} window, when the CLI reports it.`,
59
+ }));
60
+ }
1
61
  export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
2
62
  {
3
63
  id: "anthropic",
4
64
  label: "Anthropic",
5
65
  runtimeIds: ["anthropic"],
6
- synonyms: ["claude", "claude-code"],
66
+ synonyms: [],
67
+ shape: {
68
+ autoSetup: "usually",
69
+ authentication: "opencode_auth_api_key",
70
+ authFallbacks: ["env_api_key", "global_opencode_config"],
71
+ quota: "remote_api",
72
+ optionalVisibilityRows: [
73
+ {
74
+ rowKey: "rate_limit:requests",
75
+ resultType: "rate_limit",
76
+ label: "Requests",
77
+ info: "Passive per-minute request rate limit observed on API-key traffic.",
78
+ },
79
+ {
80
+ rowKey: "rate_limit:tokens",
81
+ resultType: "rate_limit",
82
+ label: "Tokens",
83
+ info: "Passive per-minute token rate limit observed on API-key traffic.",
84
+ },
85
+ {
86
+ rowKey: "rate_limit:inputTokens",
87
+ resultType: "rate_limit",
88
+ label: "Input tokens",
89
+ info: "Passive per-minute input-token rate limit observed on API-key traffic.",
90
+ },
91
+ {
92
+ rowKey: "rate_limit:outputTokens",
93
+ resultType: "rate_limit",
94
+ label: "Output tokens",
95
+ info: "Passive per-minute output-token rate limit observed on API-key traffic.",
96
+ },
97
+ ],
98
+ notes: "Passive per-minute rate-limit headers from real API-key requests; no spend or balance",
99
+ },
100
+ },
101
+ {
102
+ id: "claude-agent",
103
+ label: "Claude Agent",
104
+ runtimeIds: ["claude-agent", "claude-code"],
105
+ synonyms: ["claude-code", "claude"],
7
106
  shape: {
8
107
  autoSetup: "needs_quick_setup",
9
108
  authentication: "local_cli_auth",
10
109
  quota: "local_cli_report",
11
- quickSetupAnchor: "anthropic-claude",
110
+ autoResume: "single-source",
111
+ quickSetupAnchor: "claude-agent",
112
+ optionalVisibilityRows: [
113
+ {
114
+ rowKey: "window:five_hour",
115
+ resultType: "quota",
116
+ kind: "percent",
117
+ label: "5h",
118
+ info: "Claude Agent 5-hour subscription window.",
119
+ },
120
+ {
121
+ rowKey: "window:week",
122
+ resultType: "quota",
123
+ kind: "percent",
124
+ label: "Weekly",
125
+ info: "Claude Agent weekly subscription window.",
126
+ },
127
+ {
128
+ rowKey: "window:month",
129
+ resultType: "quota",
130
+ kind: "percent",
131
+ label: "Monthly credits",
132
+ info: "Claude Agent monthly usage credits, when the plan reports them.",
133
+ },
134
+ {
135
+ rowKey: "named:Fable weekly",
136
+ resultType: "quota",
137
+ kind: "percent",
138
+ label: "Fable",
139
+ info: "Claude Agent Fable weekly window, when the plan reports it.",
140
+ },
141
+ {
142
+ rowKey: CLAUDE_AGENT_RESETS_ROW_KEY,
143
+ resultType: OPENAI_RESETS_ROW_RESULT_TYPE,
144
+ label: OPENAI_RESETS_ROW_LABEL,
145
+ info: CLAUDE_AGENT_RESETS_INFO,
146
+ },
147
+ ],
12
148
  },
13
149
  },
14
150
  {
@@ -20,6 +156,25 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
20
156
  autoSetup: "usually",
21
157
  authentication: "github_oauth_or_pat",
22
158
  quota: "remote_api",
159
+ autoResume: "account",
160
+ optionalVisibilityRows: [
161
+ {
162
+ rowKey: "window:month",
163
+ resultType: "quota",
164
+ kind: "percent",
165
+ alternateShapes: [{ resultType: "quota", kind: "value" }],
166
+ label: "Monthly quota",
167
+ info: "Copilot premium-request or AI-credit quota for the current month.",
168
+ },
169
+ {
170
+ rowKey: "named:additional_usage",
171
+ resultType: "budget",
172
+ kind: "percent",
173
+ alternateShapes: [{ resultType: "budget", kind: "value" }],
174
+ label: "Additional usage",
175
+ info: "Copilot additional-usage budget, when billing reports spend against it.",
176
+ },
177
+ ],
23
178
  notes: "OAuth for personal flow; PAT for managed billing",
24
179
  },
25
180
  },
@@ -32,6 +187,49 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
32
187
  autoSetup: "yes",
33
188
  authentication: "opencode_auth_oauth_token",
34
189
  quota: "remote_api",
190
+ autoResume: "account",
191
+ optionalVisibilityRows: [
192
+ {
193
+ rowKey: "window:five_hour",
194
+ resultType: "rate_limit",
195
+ kind: "percent",
196
+ label: "5h",
197
+ info: "OpenAI 5-hour rate-limit window, when the account reports it.",
198
+ },
199
+ {
200
+ rowKey: "window:week",
201
+ resultType: "rate_limit",
202
+ kind: "percent",
203
+ label: "Weekly",
204
+ info: "OpenAI weekly rate-limit window, when the account reports it.",
205
+ },
206
+ {
207
+ rowKey: "window:month",
208
+ resultType: "rate_limit",
209
+ kind: "percent",
210
+ label: "Monthly",
211
+ info: "OpenAI monthly rate-limit window, when the account reports it.",
212
+ },
213
+ {
214
+ rowKey: "window:code_review",
215
+ resultType: "rate_limit",
216
+ kind: "percent",
217
+ label: "Code Review",
218
+ info: "OpenAI Code Review rate-limit window, when the account reports it.",
219
+ },
220
+ {
221
+ rowKey: OPENAI_RESETS_ROW_KEY,
222
+ resultType: OPENAI_RESETS_ROW_RESULT_TYPE,
223
+ label: OPENAI_RESETS_ROW_LABEL,
224
+ info: OPENAI_RESETS_INFO,
225
+ },
226
+ {
227
+ rowKey: OPENAI_CREDITS_ROW_KEY,
228
+ resultType: OPENAI_CREDITS_ROW_RESULT_TYPE,
229
+ label: OPENAI_CREDITS_ROW_LABEL,
230
+ info: OPENAI_CREDITS_INFO,
231
+ },
232
+ ],
35
233
  },
36
234
  },
37
235
  {
@@ -56,6 +254,22 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
56
254
  authentication: "opencode_auth_api_key",
57
255
  authFallbacks: ["env_api_key", "global_opencode_config"],
58
256
  quota: "remote_api",
257
+ optionalVisibilityRows: [
258
+ {
259
+ rowKey: "component:remaining_credits",
260
+ resultType: "quota",
261
+ kind: "percent",
262
+ label: "Remaining credits",
263
+ info: "Kilo Pass credit balance, when an active pass reports a total.",
264
+ },
265
+ {
266
+ rowKey: "component:total_balance",
267
+ resultType: "balance",
268
+ kind: "quantity",
269
+ label: "Balance",
270
+ info: "Kilo Gateway prepaid balance, when no active Pass is present.",
271
+ },
272
+ ],
59
273
  notes: "Queries Kilo Pass state first, then falls back to the documented personal Gateway balance when no active subscription exists",
60
274
  },
61
275
  },
@@ -80,10 +294,11 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
80
294
  synonyms: ["alibaba"],
81
295
  liveLocalUsage: true,
82
296
  shape: {
83
- autoSetup: "yes",
84
- authentication: "opencode_auth_api_key",
85
- authFallbacks: ["env_api_key", "global_opencode_config"],
86
- quota: "local_estimation",
297
+ autoSetup: "needs_quick_setup",
298
+ authentication: "local_cli_auth",
299
+ quota: "local_cli_report",
300
+ optionalVisibilityRows: cliWindowRows("Coding Plan", ["five_hour", "week", "month"]),
301
+ quickSetupAnchor: "alibaba-coding-plan",
87
302
  },
88
303
  },
89
304
  {
@@ -95,6 +310,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
95
310
  autoSetup: "needs_quick_setup",
96
311
  authentication: "local_cli_auth",
97
312
  quota: "local_cli_report",
313
+ optionalVisibilityRows: cliWindowRows("Personal Token Plan", ["five_hour", "week"]),
98
314
  quickSetupAnchor: "alibaba-personal-token-plan",
99
315
  },
100
316
  },
@@ -108,6 +324,23 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
108
324
  authentication: "opencode_auth_api_key",
109
325
  authFallbacks: ["env_api_key", "global_opencode_config"],
110
326
  quota: "remote_api",
327
+ autoResume: "single-source",
328
+ optionalVisibilityRows: [
329
+ {
330
+ rowKey: "window:five_hour",
331
+ resultType: "quota",
332
+ kind: "percent",
333
+ label: "5h",
334
+ info: "Synthetic 5-hour window, when the API reports it.",
335
+ },
336
+ {
337
+ rowKey: "window:week",
338
+ resultType: "quota",
339
+ kind: "percent",
340
+ label: "Weekly",
341
+ info: "Synthetic weekly window, when the API reports it.",
342
+ },
343
+ ],
111
344
  },
112
345
  },
113
346
  {
@@ -116,10 +349,16 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
116
349
  runtimeIds: ["chutes", "chutes-ai"],
117
350
  synonyms: [],
118
351
  shape: {
119
- autoSetup: "usually",
120
- authentication: "opencode_auth_api_key",
121
- authFallbacks: ["env_api_key", "global_opencode_config"],
122
- quota: "remote_api",
352
+ ...SINGLE_SOURCE_KEY_SHAPE,
353
+ optionalVisibilityRows: [
354
+ {
355
+ rowKey: "window:day",
356
+ resultType: "quota",
357
+ kind: "percent",
358
+ label: "Daily",
359
+ info: "Chutes daily quota window.",
360
+ },
361
+ ],
123
362
  },
124
363
  },
125
364
  {
@@ -152,24 +391,14 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
152
391
  label: "Z.ai",
153
392
  runtimeIds: ["zai", "glm", "zai-coding-plan"],
154
393
  synonyms: [],
155
- shape: {
156
- autoSetup: "yes",
157
- authentication: "opencode_auth_api_key",
158
- authFallbacks: ["env_api_key", "global_opencode_config"],
159
- quota: "remote_api",
160
- },
394
+ shape: GLM_CODING_PLAN_SHAPE,
161
395
  },
162
396
  {
163
397
  id: "zhipu",
164
398
  label: "Zhipu",
165
399
  runtimeIds: ["zhipu", "glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
166
400
  synonyms: ["glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
167
- shape: {
168
- autoSetup: "yes",
169
- authentication: "opencode_auth_api_key",
170
- authFallbacks: ["env_api_key", "global_opencode_config"],
171
- quota: "remote_api",
172
- },
401
+ shape: GLM_CODING_PLAN_SHAPE,
173
402
  },
174
403
  {
175
404
  id: "nanogpt",
@@ -177,10 +406,30 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
177
406
  runtimeIds: ["nanogpt", "nano-gpt"],
178
407
  synonyms: ["nano-gpt"],
179
408
  shape: {
180
- autoSetup: "usually",
181
- authentication: "opencode_auth_api_key",
182
- authFallbacks: ["env_api_key", "global_opencode_config"],
183
- quota: "remote_api",
409
+ ...SINGLE_SOURCE_KEY_SHAPE,
410
+ optionalVisibilityRows: [
411
+ {
412
+ rowKey: "window:day",
413
+ resultType: "quota",
414
+ kind: "percent",
415
+ label: "Daily",
416
+ info: "NanoGPT daily subscription limit, when the plan reports it.",
417
+ },
418
+ {
419
+ rowKey: "window:month",
420
+ resultType: "quota",
421
+ kind: "percent",
422
+ label: "Monthly",
423
+ info: "NanoGPT monthly subscription limit, when the plan reports it.",
424
+ },
425
+ {
426
+ rowKey: "component:current_balance",
427
+ resultType: "balance",
428
+ kind: "quantity",
429
+ label: "Balance",
430
+ info: "NanoGPT account balance, when the API reports it.",
431
+ },
432
+ ],
184
433
  },
185
434
  },
186
435
  {
@@ -193,6 +442,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
193
442
  authentication: "opencode_auth_api_key",
194
443
  authFallbacks: ["env_api_key", "global_opencode_config"],
195
444
  quota: "remote_api",
445
+ autoResume: "account-or-single-source",
196
446
  },
197
447
  },
198
448
  {
@@ -211,6 +461,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
211
461
  authentication: "opencode_auth_api_key",
212
462
  authFallbacks: ["env_api_key", "global_opencode_config"],
213
463
  quota: "remote_api",
464
+ autoResume: "account-or-single-source",
214
465
  },
215
466
  },
216
467
  {
@@ -248,6 +499,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
248
499
  authentication: "opencode_auth_api_key",
249
500
  authFallbacks: ["env_api_key", "global_opencode_config"],
250
501
  quota: "remote_api",
502
+ optionalVisibilityRows: [
503
+ {
504
+ rowKey: "component:total_balance",
505
+ resultType: "balance",
506
+ kind: "quantity",
507
+ label: "Total balance",
508
+ info: "DeepSeek total account balance, when the API reports it.",
509
+ },
510
+ {
511
+ rowKey: "component:granted_balance",
512
+ resultType: "balance",
513
+ kind: "quantity",
514
+ label: "Granted balance",
515
+ info: "DeepSeek granted balance, when the API reports it.",
516
+ },
517
+ {
518
+ rowKey: "component:topped_up_balance",
519
+ resultType: "balance",
520
+ kind: "quantity",
521
+ label: "Topped-up balance",
522
+ info: "DeepSeek topped-up balance, when the API reports it.",
523
+ },
524
+ {
525
+ rowKey: "named:Availability",
526
+ resultType: "status",
527
+ kind: "boolean",
528
+ label: "Availability",
529
+ info: "DeepSeek account availability, shown only when no balance is reported.",
530
+ },
531
+ ],
251
532
  },
252
533
  },
253
534
  {
@@ -259,6 +540,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
259
540
  autoSetup: "yes",
260
541
  authentication: "opencode_auth_oauth_token",
261
542
  quota: "remote_api",
543
+ autoResume: "account",
262
544
  notes: "SuperGrok OAuth via OpenCode /connect; shared weekly credit meter",
263
545
  },
264
546
  },
@@ -276,6 +558,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
276
558
  autoSetup: "needs_quick_setup",
277
559
  authentication: "state_only",
278
560
  quota: "remote_api",
561
+ optionalVisibilityRows: [
562
+ {
563
+ rowKey: "window:month",
564
+ resultType: "quota",
565
+ kind: "percent",
566
+ label: "Monthly",
567
+ info: "Xiaomi MiMo monthly plan usage, when the dashboard reports it.",
568
+ },
569
+ {
570
+ rowKey: "component:total_balance",
571
+ resultType: "balance",
572
+ kind: "quantity",
573
+ label: "Total balance",
574
+ info: "Xiaomi MiMo total balance, when the dashboard reports it.",
575
+ },
576
+ {
577
+ rowKey: "component:cash_balance",
578
+ resultType: "balance",
579
+ kind: "quantity",
580
+ label: "Cash balance",
581
+ info: "Xiaomi MiMo cash balance, when the dashboard reports it.",
582
+ },
583
+ {
584
+ rowKey: "component:gift_balance",
585
+ resultType: "balance",
586
+ kind: "quantity",
587
+ label: "Gift balance",
588
+ info: "Xiaomi MiMo gift balance, when the dashboard reports it.",
589
+ },
590
+ ],
279
591
  quickSetupAnchor: "xiaomi-mimo",
280
592
  notes: "Reads the Xiaomi MiMo dashboard with a filtered trusted cookie",
281
593
  },
@@ -290,6 +602,30 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
290
602
  authentication: "opencode_auth_api_key",
291
603
  authFallbacks: ["env_api_key", "global_opencode_config"],
292
604
  quota: "remote_api",
605
+ autoResume: "account",
606
+ optionalVisibilityRows: [
607
+ {
608
+ rowKey: "window:five_hour",
609
+ resultType: "quota",
610
+ kind: "percent",
611
+ label: "5h",
612
+ info: "OpenCode Go rolling 5-hour window.",
613
+ },
614
+ {
615
+ rowKey: "window:week",
616
+ resultType: "quota",
617
+ kind: "percent",
618
+ label: "Weekly",
619
+ info: "OpenCode Go weekly window.",
620
+ },
621
+ {
622
+ rowKey: "window:month",
623
+ resultType: "quota",
624
+ kind: "percent",
625
+ label: "Monthly",
626
+ info: "OpenCode Go monthly window.",
627
+ },
628
+ ],
293
629
  notes: "Reads the official OpenCode Go usage API through standard Go API-key sources",
294
630
  },
295
631
  },
@@ -302,6 +638,37 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
302
638
  autoSetup: "yes",
303
639
  authentication: "opencode_auth_oauth_token",
304
640
  quota: "remote_api",
641
+ autoResume: "account",
642
+ optionalVisibilityRows: [
643
+ {
644
+ rowKey: "window:month",
645
+ resultType: "budget",
646
+ kind: "percent",
647
+ label: "Monthly budget",
648
+ info: "OpenCode Zen monthly budget usage, when a limit is configured or reported.",
649
+ },
650
+ {
651
+ rowKey: "window:month",
652
+ resultType: "spend",
653
+ kind: "quantity",
654
+ label: "Monthly spend",
655
+ info: "OpenCode Zen monthly spend, shown when no budget limit exists.",
656
+ },
657
+ {
658
+ rowKey: "component:current_balance",
659
+ resultType: "balance",
660
+ kind: "quantity",
661
+ label: "Balance",
662
+ info: "OpenCode Zen current account balance.",
663
+ },
664
+ {
665
+ rowKey: "component:auto_reload",
666
+ resultType: "status",
667
+ kind: "boolean",
668
+ label: "Auto-reload",
669
+ info: "OpenCode Zen auto-reload setting, when the console reports it.",
670
+ },
671
+ ],
305
672
  notes: "Reads the OpenCode Console billing, budget and usage APIs with your OpenCode Console sign-in",
306
673
  },
307
674
  },
@@ -311,10 +678,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
311
678
  runtimeIds: ["ollama-cloud"],
312
679
  synonyms: [],
313
680
  shape: {
314
- autoSetup: "usually",
315
- authentication: "opencode_auth_api_key",
316
- authFallbacks: ["env_api_key", "global_opencode_config"],
317
- quota: "remote_api",
681
+ ...SINGLE_SOURCE_KEY_SHAPE,
682
+ optionalVisibilityRows: [
683
+ {
684
+ rowKey: "named:Session",
685
+ resultType: "quota",
686
+ kind: "percent",
687
+ label: "Session",
688
+ info: "Ollama Cloud legacy session limit; its fixed reset window is not documented.",
689
+ },
690
+ {
691
+ rowKey: "window:week",
692
+ resultType: "quota",
693
+ kind: "percent",
694
+ label: "Weekly",
695
+ info: "Ollama Cloud legacy weekly limit.",
696
+ },
697
+ {
698
+ rowKey: "window:month",
699
+ resultType: "quota",
700
+ kind: "percent",
701
+ label: "Monthly",
702
+ info: "Ollama Cloud included credits remaining in the current plan period.",
703
+ },
704
+ {
705
+ rowKey: "component:remaining_credits",
706
+ resultType: "balance",
707
+ label: "Purchased",
708
+ info: "Ollama Cloud purchased credits, when any remain.",
709
+ },
710
+ ],
318
711
  notes: "Queries the Ollama Cloud balance API; reports included credits or session and weekly limits, plus purchased credits",
319
712
  },
320
713
  },
@@ -0,0 +1,74 @@
1
+ import { type QuotaWindowCollection } from "./quota-retry-wait.js";
2
+ /** Confirmed recovery must hold this long before the single continuation. */
3
+ export declare const QUOTA_AUTO_RESUME_GRACE_MS = 120000;
4
+ /** The single continuation prompt; no native continue API exists. */
5
+ export declare const QUOTA_AUTO_RESUME_PROMPT = "continue";
6
+ /** Marker used to ignore the module's own prompt and to make the continuation visible. */
7
+ export declare const QUOTA_AUTO_RESUME_SOURCE = "opencode-quota-gui-autoresume";
8
+ export type QuotaAutoResumeSessionInfo = {
9
+ model?: {
10
+ id: string;
11
+ providerID: string;
12
+ };
13
+ parentID?: string;
14
+ outcome?: "succeeded" | "failed" | "interrupted";
15
+ time?: {
16
+ idle?: number;
17
+ };
18
+ };
19
+ /**
20
+ * The probe's evidence state; the setting's enablement, permanent route support, and temporary
21
+ * evidence absence stay distinct.
22
+ */
23
+ export type QuotaAutoResumeProbe = {
24
+ readonly kind: "collection";
25
+ readonly collection: QuotaWindowCollection;
26
+ } | {
27
+ readonly kind: "absent";
28
+ } | {
29
+ readonly kind: "disabled";
30
+ } | {
31
+ readonly kind: "unsupported";
32
+ };
33
+ export interface QuotaAutoResumeDeps {
34
+ /**
35
+ * Current windows for the failed route. `absent` means the setting is on but the observation is
36
+ * temporarily unavailable (probe failure, cooldown, timeout, missing row or identity); `disabled`
37
+ * means the setting is off, so a pending resume is cancelled instead of polled.
38
+ */
39
+ probe: (model: {
40
+ id: string;
41
+ providerID: string;
42
+ }) => Promise<QuotaAutoResumeProbe>;
43
+ session: {
44
+ get(input: {
45
+ sessionID: string;
46
+ }): Promise<QuotaAutoResumeSessionInfo>;
47
+ prompt(input: {
48
+ sessionID: string;
49
+ text: string;
50
+ metadata?: Record<string, string | number | boolean>;
51
+ }): Promise<unknown>;
52
+ };
53
+ now?: () => number;
54
+ /** Receives uncontrolled failures only; never session ids or prompts. */
55
+ log?: (message: string) => void;
56
+ }
57
+ export interface QuotaAutoResumeEvent {
58
+ readonly type: string;
59
+ readonly created?: number;
60
+ readonly data?: unknown;
61
+ }
62
+ /**
63
+ * Creates the in-process auto-resume controller. Feed every host event through `handleEvent`,
64
+ * user prompt submissions through `onPrompt`, and call `dispose` from the plugin cleanup.
65
+ */
66
+ export declare function createQuotaAutoResumption(deps: QuotaAutoResumeDeps): {
67
+ handleEvent: (event: QuotaAutoResumeEvent) => void;
68
+ onPrompt: (event: {
69
+ readonly sessionID?: string;
70
+ readonly metadata?: Record<string, unknown> | null;
71
+ }) => void;
72
+ dispose: () => void;
73
+ };
74
+ //# sourceMappingURL=quota-auto-resume.d.ts.map