opencode-quota-gui 1.3.1 → 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 (155) hide show
  1. package/README.md +16 -12
  2. package/dist/contracts/build-identity.js +1 -1
  3. package/dist/contracts/card-order.d.ts +2 -0
  4. package/dist/contracts/card-order.js +2 -2
  5. package/dist/contracts/card-visibility.d.ts +2 -1
  6. package/dist/contracts/card-visibility.js +2 -1
  7. package/dist/contracts/dashboard.d.ts +87 -5
  8. package/dist/contracts/dashboard.js +10 -0
  9. package/dist/contracts/dto-guards.d.ts +4 -0
  10. package/dist/contracts/dto-guards.js +29 -7
  11. package/dist/contracts/guards.js +3 -1
  12. package/dist/contracts/identity.d.ts +37 -5
  13. package/dist/contracts/identity.js +43 -0
  14. package/dist/contracts/provider-auto-resume.d.ts +9 -0
  15. package/dist/contracts/provider-auto-resume.js +24 -0
  16. package/dist/contracts/provider-failure.d.ts +22 -0
  17. package/dist/contracts/provider-failure.js +25 -1
  18. package/dist/contracts/row-order.d.ts +13 -0
  19. package/dist/contracts/row-order.js +34 -0
  20. package/dist/contracts/row-visibility.d.ts +53 -0
  21. package/dist/contracts/row-visibility.js +130 -0
  22. package/dist/data/modelsdev-pricing.min.json +1 -1
  23. package/dist/data/modelsdev-temporal.min.json +3 -634
  24. package/dist/gui/aggregation.d.ts +29 -1
  25. package/dist/gui/aggregation.js +157 -4
  26. package/dist/gui/analytics-bridge.d.ts +8 -9
  27. package/dist/gui/analytics-bridge.js +197 -54
  28. package/dist/gui/analytics-engine.d.ts +7 -15
  29. package/dist/gui/analytics-engine.js +246 -106
  30. package/dist/gui/analytics-model.d.ts +7 -0
  31. package/dist/gui/analytics-model.js +75 -9
  32. package/dist/gui/analytics-pricing-upkeep.d.ts +21 -0
  33. package/dist/gui/analytics-pricing-upkeep.js +23 -0
  34. package/dist/gui/analytics-protocol.d.ts +17 -7
  35. package/dist/gui/analytics-protocol.js +1 -0
  36. package/dist/gui/analytics-service.d.ts +10 -0
  37. package/dist/gui/analytics-service.js +30 -9
  38. package/dist/gui/analytics-state.d.ts +30 -5
  39. package/dist/gui/analytics-state.js +46 -7
  40. package/dist/gui/analytics-worker-runtime.d.ts +5 -0
  41. package/dist/gui/analytics-worker-runtime.js +9 -1
  42. package/dist/gui/analytics-worker.js +11 -0
  43. package/dist/gui/config.d.ts +2 -2
  44. package/dist/gui/config.js +46 -5
  45. package/dist/gui/identity.d.ts +6 -20
  46. package/dist/gui/identity.js +6 -54
  47. package/dist/gui/primary-quota-windows.js +55 -34
  48. package/dist/gui/provider-cards.d.ts +12 -8
  49. package/dist/gui/provider-cards.js +12 -53
  50. package/dist/gui/quota-notification-detector.d.ts +25 -2
  51. package/dist/gui/quota-notification-detector.js +60 -5
  52. package/dist/gui/quota-notification-observer.d.ts +1 -1
  53. package/dist/gui/quota-notification-observer.js +5 -1
  54. package/dist/gui/quota-observation.d.ts +4 -0
  55. package/dist/gui/quota-observation.js +18 -0
  56. package/dist/gui/rpc.js +3 -0
  57. package/dist/gui/server.js +6 -1
  58. package/dist/gui/snapshot-service.d.ts +3 -17
  59. package/dist/gui/snapshot-service.js +159 -9
  60. package/dist/gui/sources.js +84 -11
  61. package/dist/gui/temporal-status.d.ts +3 -2
  62. package/dist/gui/temporal-status.js +10 -6
  63. package/dist/gui-experimental.cjs +228 -228
  64. package/dist/lib/accounting-format.d.ts +8 -0
  65. package/dist/lib/accounting-format.js +12 -2
  66. package/dist/lib/anthropic-api-auth.d.ts +7 -0
  67. package/dist/lib/anthropic-api-auth.js +27 -0
  68. package/dist/lib/anthropic-api-rate-limits.d.ts +47 -0
  69. package/dist/lib/anthropic-api-rate-limits.js +92 -0
  70. package/dist/lib/anthropic-oauth-throttle.d.ts +76 -0
  71. package/dist/lib/anthropic-oauth-throttle.js +379 -0
  72. package/dist/lib/anthropic.d.ts +22 -4
  73. package/dist/lib/anthropic.js +498 -180
  74. package/dist/lib/cache-observer-ingestion.js +27 -0
  75. package/dist/lib/cache-observer.d.ts +3 -0
  76. package/dist/lib/cache-observer.js +9 -3
  77. package/dist/lib/cli-show.d.ts +5 -0
  78. package/dist/lib/cli-show.js +16 -5
  79. package/dist/lib/cli-status.js +3 -6
  80. package/dist/lib/config.d.ts +1 -1
  81. package/dist/lib/config.js +64 -2
  82. package/dist/lib/dashboard-visibility.d.ts +5 -0
  83. package/dist/lib/dashboard-visibility.js +11 -10
  84. package/dist/lib/display-sanitize.js +1 -0
  85. package/dist/lib/entries.d.ts +10 -1
  86. package/dist/lib/entries.js +4 -0
  87. package/dist/lib/grouped-entry-normalization.js +1 -1
  88. package/dist/lib/maintainer-announcements.js +2 -2
  89. package/dist/lib/modelsdev-pricing.d.ts +74 -2
  90. package/dist/lib/modelsdev-pricing.js +457 -63
  91. package/dist/lib/modelsdev-temporal.d.ts +6 -0
  92. package/dist/lib/modelsdev-temporal.js +16 -2
  93. package/dist/lib/opencode-config-providers.js +2 -2
  94. package/dist/lib/opencode-storage.d.ts +20 -0
  95. package/dist/lib/opencode-storage.js +89 -2
  96. package/dist/lib/opencode-version-core.d.ts +7 -0
  97. package/dist/lib/opencode-version-core.js +10 -0
  98. package/dist/lib/opencode-warming-refresh.d.ts +19 -0
  99. package/dist/lib/opencode-warming-refresh.js +95 -0
  100. package/dist/lib/provider-metadata.d.ts +11 -3
  101. package/dist/lib/provider-metadata.js +20 -2
  102. package/dist/lib/provider-registration.d.ts +342 -3
  103. package/dist/lib/provider-registration.js +409 -27
  104. package/dist/lib/quota-auto-resume.d.ts +74 -0
  105. package/dist/lib/quota-auto-resume.js +539 -0
  106. package/dist/lib/quota-command-format.js +22 -9
  107. package/dist/lib/quota-identity.d.ts +64 -0
  108. package/dist/lib/quota-identity.js +111 -0
  109. package/dist/lib/quota-providers.js +2 -2
  110. package/dist/lib/quota-render-data.js +2 -2
  111. package/dist/lib/quota-reset-notifications.js +11 -155
  112. package/dist/lib/quota-retry-wait.d.ts +106 -5
  113. package/dist/lib/quota-retry-wait.js +301 -34
  114. package/dist/lib/quota-runtime-context.js +1 -0
  115. package/dist/lib/quota-state-codec.d.ts +2 -0
  116. package/dist/lib/quota-state-codec.js +14 -1
  117. package/dist/lib/quota-state.d.ts +1 -1
  118. package/dist/lib/quota-state.js +60 -28
  119. package/dist/lib/quota-stats.d.ts +26 -0
  120. package/dist/lib/quota-stats.js +19 -1
  121. package/dist/lib/quota-surface-data.js +18 -3
  122. package/dist/lib/quota-telemetry.js +2 -2
  123. package/dist/lib/resolved-auth-identity.d.ts +19 -0
  124. package/dist/lib/resolved-auth-identity.js +44 -0
  125. package/dist/lib/state-file-lock.d.ts +26 -0
  126. package/dist/lib/state-file-lock.js +205 -0
  127. package/dist/lib/toast-format-grouped.js +7 -4
  128. package/dist/lib/tui-compact-format.js +29 -16
  129. package/dist/lib/types.d.ts +20 -0
  130. package/dist/lib/types.js +4 -1
  131. package/dist/plugin.js +67 -1
  132. package/dist/providers/alibaba-coding-plan.js +21 -3
  133. package/dist/providers/alibaba-token-plan.js +9 -5
  134. package/dist/providers/anthropic.d.ts +6 -2
  135. package/dist/providers/anthropic.js +123 -14
  136. package/dist/providers/chutes.js +2 -0
  137. package/dist/providers/claude-agent.js +24 -5
  138. package/dist/providers/copilot.js +5 -4
  139. package/dist/providers/glm-coding-plan-provider.js +30 -23
  140. package/dist/providers/ollama-cloud.js +10 -0
  141. package/dist/providers/openai.js +24 -23
  142. package/dist/providers/opencode-go.js +7 -6
  143. package/dist/providers/opencode-zen.js +1 -1
  144. package/dist/providers/result-helpers.d.ts +4 -2
  145. package/dist/providers/result-helpers.js +5 -1
  146. package/dist/providers/synthetic.js +4 -0
  147. package/dist/providers/xai.js +9 -8
  148. package/dist/rpc.d.ts +8 -0
  149. package/dist/rpc.js +15 -2
  150. package/dist/ui/assets/{index-BcueIm3Z.css → index-6_g1FHs-.css} +1 -1
  151. package/dist/ui/assets/index-sZnGUuML.js +10 -0
  152. package/dist/ui/assets/{popover-4bFSvRZ7.js → popover-C4ZLYe9E.js} +1 -1
  153. package/dist/ui/index.html +2 -2
  154. package/package.json +3 -3
  155. package/dist/ui/assets/index-C6qRSoh8.js +0 -10
@@ -1,3 +1,63 @@
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",
@@ -5,9 +65,37 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
5
65
  runtimeIds: ["anthropic"],
6
66
  synonyms: [],
7
67
  shape: {
8
- autoSetup: "unavailable",
9
- authentication: "unavailable",
10
- quota: "unavailable",
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",
11
99
  },
12
100
  },
13
101
  {
@@ -19,7 +107,44 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
19
107
  autoSetup: "needs_quick_setup",
20
108
  authentication: "local_cli_auth",
21
109
  quota: "local_cli_report",
110
+ autoResume: "single-source",
22
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
+ ],
23
148
  },
24
149
  },
25
150
  {
@@ -31,6 +156,25 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
31
156
  autoSetup: "usually",
32
157
  authentication: "github_oauth_or_pat",
33
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
+ ],
34
178
  notes: "OAuth for personal flow; PAT for managed billing",
35
179
  },
36
180
  },
@@ -43,6 +187,49 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
43
187
  autoSetup: "yes",
44
188
  authentication: "opencode_auth_oauth_token",
45
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
+ ],
46
233
  },
47
234
  },
48
235
  {
@@ -67,6 +254,22 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
67
254
  authentication: "opencode_auth_api_key",
68
255
  authFallbacks: ["env_api_key", "global_opencode_config"],
69
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
+ ],
70
273
  notes: "Queries Kilo Pass state first, then falls back to the documented personal Gateway balance when no active subscription exists",
71
274
  },
72
275
  },
@@ -94,6 +297,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
94
297
  autoSetup: "needs_quick_setup",
95
298
  authentication: "local_cli_auth",
96
299
  quota: "local_cli_report",
300
+ optionalVisibilityRows: cliWindowRows("Coding Plan", ["five_hour", "week", "month"]),
97
301
  quickSetupAnchor: "alibaba-coding-plan",
98
302
  },
99
303
  },
@@ -106,6 +310,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
106
310
  autoSetup: "needs_quick_setup",
107
311
  authentication: "local_cli_auth",
108
312
  quota: "local_cli_report",
313
+ optionalVisibilityRows: cliWindowRows("Personal Token Plan", ["five_hour", "week"]),
109
314
  quickSetupAnchor: "alibaba-personal-token-plan",
110
315
  },
111
316
  },
@@ -119,6 +324,23 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
119
324
  authentication: "opencode_auth_api_key",
120
325
  authFallbacks: ["env_api_key", "global_opencode_config"],
121
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
+ ],
122
344
  },
123
345
  },
124
346
  {
@@ -127,10 +349,16 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
127
349
  runtimeIds: ["chutes", "chutes-ai"],
128
350
  synonyms: [],
129
351
  shape: {
130
- autoSetup: "usually",
131
- authentication: "opencode_auth_api_key",
132
- authFallbacks: ["env_api_key", "global_opencode_config"],
133
- 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
+ ],
134
362
  },
135
363
  },
136
364
  {
@@ -163,24 +391,14 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
163
391
  label: "Z.ai",
164
392
  runtimeIds: ["zai", "glm", "zai-coding-plan"],
165
393
  synonyms: [],
166
- shape: {
167
- autoSetup: "yes",
168
- authentication: "opencode_auth_api_key",
169
- authFallbacks: ["env_api_key", "global_opencode_config"],
170
- quota: "remote_api",
171
- },
394
+ shape: GLM_CODING_PLAN_SHAPE,
172
395
  },
173
396
  {
174
397
  id: "zhipu",
175
398
  label: "Zhipu",
176
399
  runtimeIds: ["zhipu", "glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
177
400
  synonyms: ["glm-coding-plan", "zhipu-coding-plan", "zhipuai-coding-plan"],
178
- shape: {
179
- autoSetup: "yes",
180
- authentication: "opencode_auth_api_key",
181
- authFallbacks: ["env_api_key", "global_opencode_config"],
182
- quota: "remote_api",
183
- },
401
+ shape: GLM_CODING_PLAN_SHAPE,
184
402
  },
185
403
  {
186
404
  id: "nanogpt",
@@ -188,10 +406,30 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
188
406
  runtimeIds: ["nanogpt", "nano-gpt"],
189
407
  synonyms: ["nano-gpt"],
190
408
  shape: {
191
- autoSetup: "usually",
192
- authentication: "opencode_auth_api_key",
193
- authFallbacks: ["env_api_key", "global_opencode_config"],
194
- 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
+ ],
195
433
  },
196
434
  },
197
435
  {
@@ -204,6 +442,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
204
442
  authentication: "opencode_auth_api_key",
205
443
  authFallbacks: ["env_api_key", "global_opencode_config"],
206
444
  quota: "remote_api",
445
+ autoResume: "account-or-single-source",
207
446
  },
208
447
  },
209
448
  {
@@ -222,6 +461,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
222
461
  authentication: "opencode_auth_api_key",
223
462
  authFallbacks: ["env_api_key", "global_opencode_config"],
224
463
  quota: "remote_api",
464
+ autoResume: "account-or-single-source",
225
465
  },
226
466
  },
227
467
  {
@@ -259,6 +499,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
259
499
  authentication: "opencode_auth_api_key",
260
500
  authFallbacks: ["env_api_key", "global_opencode_config"],
261
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
+ ],
262
532
  },
263
533
  },
264
534
  {
@@ -270,6 +540,7 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
270
540
  autoSetup: "yes",
271
541
  authentication: "opencode_auth_oauth_token",
272
542
  quota: "remote_api",
543
+ autoResume: "account",
273
544
  notes: "SuperGrok OAuth via OpenCode /connect; shared weekly credit meter",
274
545
  },
275
546
  },
@@ -287,6 +558,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
287
558
  autoSetup: "needs_quick_setup",
288
559
  authentication: "state_only",
289
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
+ ],
290
591
  quickSetupAnchor: "xiaomi-mimo",
291
592
  notes: "Reads the Xiaomi MiMo dashboard with a filtered trusted cookie",
292
593
  },
@@ -301,6 +602,30 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
301
602
  authentication: "opencode_auth_api_key",
302
603
  authFallbacks: ["env_api_key", "global_opencode_config"],
303
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
+ ],
304
629
  notes: "Reads the official OpenCode Go usage API through standard Go API-key sources",
305
630
  },
306
631
  },
@@ -313,6 +638,37 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
313
638
  autoSetup: "yes",
314
639
  authentication: "opencode_auth_oauth_token",
315
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
+ ],
316
672
  notes: "Reads the OpenCode Console billing, budget and usage APIs with your OpenCode Console sign-in",
317
673
  },
318
674
  },
@@ -322,10 +678,36 @@ export const QUOTA_PROVIDER_REGISTRATION_SOURCE = [
322
678
  runtimeIds: ["ollama-cloud"],
323
679
  synonyms: [],
324
680
  shape: {
325
- autoSetup: "usually",
326
- authentication: "opencode_auth_api_key",
327
- authFallbacks: ["env_api_key", "global_opencode_config"],
328
- 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
+ ],
329
711
  notes: "Queries the Ollama Cloud balance API; reports included credits or session and weekly limits, plus purchased credits",
330
712
  },
331
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