@slkiser/opencode-quota 3.8.7 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +123 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/alibaba-auth.d.ts.map +1 -1
- package/dist/lib/alibaba-auth.js +43 -23
- package/dist/lib/alibaba-auth.js.map +1 -1
- package/dist/lib/chutes-config.d.ts +1 -0
- package/dist/lib/chutes-config.d.ts.map +1 -1
- package/dist/lib/chutes-config.js +5 -2
- package/dist/lib/chutes-config.js.map +1 -1
- package/dist/lib/config.d.ts +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +32 -0
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/crof-config.d.ts +2 -1
- package/dist/lib/crof-config.d.ts.map +1 -1
- package/dist/lib/crof-config.js +9 -1
- package/dist/lib/crof-config.js.map +1 -1
- package/dist/lib/deepseek-auth.d.ts +15 -0
- package/dist/lib/deepseek-auth.d.ts.map +1 -0
- package/dist/lib/deepseek-auth.js +32 -0
- package/dist/lib/deepseek-auth.js.map +1 -0
- package/dist/lib/deepseek.d.ts +40 -0
- package/dist/lib/deepseek.d.ts.map +1 -0
- package/dist/lib/deepseek.js +109 -0
- package/dist/lib/deepseek.js.map +1 -0
- package/dist/lib/init-installer.d.ts +1 -0
- package/dist/lib/init-installer.d.ts.map +1 -1
- package/dist/lib/init-installer.js +39 -0
- package/dist/lib/init-installer.js.map +1 -1
- package/dist/lib/maintainer-announcements.d.ts +43 -0
- package/dist/lib/maintainer-announcements.d.ts.map +1 -0
- package/dist/lib/maintainer-announcements.js +131 -0
- package/dist/lib/maintainer-announcements.js.map +1 -0
- package/dist/lib/minimax-auth.d.ts.map +1 -1
- package/dist/lib/minimax-auth.js +2 -4
- package/dist/lib/minimax-auth.js.map +1 -1
- package/dist/lib/ollama-cloud-config.d.ts +37 -0
- package/dist/lib/ollama-cloud-config.d.ts.map +1 -0
- package/dist/lib/ollama-cloud-config.js +148 -0
- package/dist/lib/ollama-cloud-config.js.map +1 -0
- package/dist/lib/ollama-cloud.d.ts +17 -0
- package/dist/lib/ollama-cloud.d.ts.map +1 -0
- package/dist/lib/ollama-cloud.js +150 -0
- package/dist/lib/ollama-cloud.js.map +1 -0
- package/dist/lib/opencode-sqlite.d.ts.map +1 -1
- package/dist/lib/opencode-sqlite.js +90 -8
- package/dist/lib/opencode-sqlite.js.map +1 -1
- package/dist/lib/provider-metadata.d.ts +1 -1
- package/dist/lib/provider-metadata.d.ts.map +1 -1
- package/dist/lib/provider-metadata.js +27 -7
- package/dist/lib/provider-metadata.js.map +1 -1
- package/dist/lib/quota-render-data.d.ts +7 -0
- package/dist/lib/quota-render-data.d.ts.map +1 -1
- package/dist/lib/quota-render-data.js +17 -0
- package/dist/lib/quota-render-data.js.map +1 -1
- package/dist/lib/quota-status.d.ts +6 -1
- package/dist/lib/quota-status.d.ts.map +1 -1
- package/dist/lib/quota-status.js +34 -4
- package/dist/lib/quota-status.js.map +1 -1
- package/dist/lib/synthetic-config.d.ts +1 -0
- package/dist/lib/synthetic-config.d.ts.map +1 -1
- package/dist/lib/synthetic-config.js +5 -2
- package/dist/lib/synthetic-config.js.map +1 -1
- package/dist/lib/tui-panel-state.d.ts +18 -0
- package/dist/lib/tui-panel-state.d.ts.map +1 -1
- package/dist/lib/tui-panel-state.js +11 -0
- package/dist/lib/tui-panel-state.js.map +1 -1
- package/dist/lib/tui-runtime.d.ts +12 -1
- package/dist/lib/tui-runtime.d.ts.map +1 -1
- package/dist/lib/tui-runtime.js +91 -14
- package/dist/lib/tui-runtime.js.map +1 -1
- package/dist/lib/types.d.ts +30 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/types.js +4 -0
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/zhipu-auth.d.ts.map +1 -1
- package/dist/lib/zhipu-auth.js +7 -2
- package/dist/lib/zhipu-auth.js.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +130 -12
- package/dist/plugin.js.map +1 -1
- package/dist/providers/deepseek.d.ts +9 -0
- package/dist/providers/deepseek.d.ts.map +1 -0
- package/dist/providers/deepseek.js +61 -0
- package/dist/providers/deepseek.js.map +1 -0
- package/dist/providers/ollama-cloud.d.ts +9 -0
- package/dist/providers/ollama-cloud.d.ts.map +1 -0
- package/dist/providers/ollama-cloud.js +77 -0
- package/dist/providers/ollama-cloud.js.map +1 -0
- package/dist/providers/registry.d.ts.map +1 -1
- package/dist/providers/registry.js +4 -0
- package/dist/providers/registry.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.tsx +76 -34
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npx @slkiser/opencode-quota init
|
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
> [!IMPORTANT]
|
|
29
|
-
> OpenCode `>= 1.4.3` and Node.js `>=
|
|
29
|
+
> OpenCode `>= 1.4.3` and Node.js `>= 20` are required.
|
|
30
30
|
|
|
31
31
|
The installer adds missing plugin/config entries and keeps your unrelated settings. Re-running it updates only installer-owned Quota UI choices.
|
|
32
32
|
|
|
@@ -40,14 +40,16 @@ The installer adds missing plugin/config entries and keeps your unrelated settin
|
|
|
40
40
|
| Quota reset periods | Show one reset period per provider, or all known reset periods. |
|
|
41
41
|
| Quota percentage meaning | Show quota remaining, or quota already used. |
|
|
42
42
|
| Session token details | Hide token counts for shorter output, or show them when available. |
|
|
43
|
+
| Maintainer announcements | Keep bundled maintainer announcements enabled, or opt out. Yes is the default; Sidebar or Compact status installs the TUI plugin, where home notices can appear. |
|
|
43
44
|
|
|
44
45
|
### After install
|
|
45
46
|
|
|
46
47
|
1. Restart OpenCode.
|
|
47
48
|
2. Run `/quota`.
|
|
48
49
|
3. If something looks wrong, run `/quota_status`.
|
|
49
|
-
4. If you enabled the
|
|
50
|
-
5. If you enabled
|
|
50
|
+
4. If you kept maintainer announcements enabled and installed the TUI plugin, the home screen can show `Notice: Maintainer announcement available. Run /quota_announcements.` or the plural count form. Without the TUI plugin, the same count-only notice can appear once after the first visible quota toast. Run `/quota_announcements` to read active notices.
|
|
51
|
+
5. If you enabled the Sidebar panel, open the session sidebar and look for `Quota`.
|
|
52
|
+
6. If you enabled Compact status line, look for the home-bottom quota line and the chat/session prompt quota line.
|
|
51
53
|
|
|
52
54
|
### Terminal-only check
|
|
53
55
|
|
|
@@ -68,9 +70,9 @@ opencode-quota show --provider copilot
|
|
|
68
70
|
- A `Quota` Sidebar panel in the TUI
|
|
69
71
|
- Popup quota toasts in OpenCode
|
|
70
72
|
- A Compact status line in the TUI
|
|
71
|
-
- `/quota
|
|
73
|
+
- `/quota`, `/quota_status`, and `/quota_announcements` slash commands
|
|
72
74
|
- Token reports such as `/tokens_today` and `/tokens_weekly`
|
|
73
|
-
- Provider diagnostics for auth, quota sources, and
|
|
75
|
+
- Provider diagnostics for auth, quota sources, pricing, and bundled maintainer announcements
|
|
74
76
|
|
|
75
77
|
<table>
|
|
76
78
|
<tr>
|
|
@@ -118,9 +120,9 @@ This enables providers, slash commands, terminal checks, and popup toasts. Add t
|
|
|
118
120
|
}
|
|
119
121
|
```
|
|
120
122
|
|
|
121
|
-
### 2. Add the TUI plugin (for Sidebar panel
|
|
123
|
+
### 2. Add the TUI plugin (for Sidebar panel, Compact status line, or announcement home notices)
|
|
122
124
|
|
|
123
|
-
If you want the Sidebar panel
|
|
125
|
+
If you want the Sidebar panel, Compact status line, or maintainer announcement home notices, also add this to `tui.json` or `tui.jsonc`:
|
|
124
126
|
|
|
125
127
|
```jsonc
|
|
126
128
|
{
|
|
@@ -149,6 +151,10 @@ Start with this, then adjust the UI choices in the next section:
|
|
|
149
151
|
"tuiCompactStatus": {
|
|
150
152
|
"enabled": false,
|
|
151
153
|
},
|
|
154
|
+
"maintainerAnnouncements": {
|
|
155
|
+
"enabled": true,
|
|
156
|
+
"home": true,
|
|
157
|
+
},
|
|
152
158
|
}
|
|
153
159
|
```
|
|
154
160
|
|
|
@@ -164,10 +170,13 @@ All UI surfaces use the same quota data. Put these settings in `opencode-quota/q
|
|
|
164
170
|
| Sidebar panel | `tuiSidebarPanel.enabled: true` | Full `Quota` panel in OpenCode's session sidebar. Requires the TUI plugin entry above. |
|
|
165
171
|
| Toast | `enableToast: true` | Popup toast after idle/question/compact events. Requires the server plugin entry above. |
|
|
166
172
|
| Compact status line | `tuiCompactStatus.enabled: true` | Short text-only quota line at the home bottom and chat/session prompt locations, for example `Copilot 94% | OpenAI Pro 5h 100%, 7d 100%`. Requires the TUI plugin entry above. |
|
|
167
|
-
|
|
|
173
|
+
| Maintainer announcement notice | `maintainerAnnouncements.enabled: true`, `maintainerAnnouncements.home: true` | Prefers the TUI home notice when the quota TUI plugin is configured. Without the TUI plugin, shows the same count-only notice once after the first visible quota toast. |
|
|
174
|
+
| Terminal/slash only | `enableToast: false`, `tuiSidebarPanel.enabled: false`, `tuiCompactStatus.enabled: false`, `maintainerAnnouncements.enabled: false` | Keeps `/quota`, `/quota_status`, `/quota_announcements`, and terminal checks. |
|
|
168
175
|
|
|
169
176
|
Selecting Compact status line in the installer enables both compact surfaces by default. To keep compact status home-only, set `tuiCompactStatus.sessionPrompt: false`.
|
|
170
177
|
|
|
178
|
+
In the sidebar panel, click the `Quota` header to switch between the compact summary (`▶ Quota`) and the detailed all-windows view (`▼ Quota`). OpenCode remembers the last sidebar state for the plugin.
|
|
179
|
+
|
|
171
180
|
For more examples, see [Common configuration](#common-configuration). For every option, see [Full configuration reference](#full-configuration-reference).
|
|
172
181
|
|
|
173
182
|
## Commands
|
|
@@ -176,7 +185,8 @@ For more examples, see [Common configuration](#common-configuration). For every
|
|
|
176
185
|
| --- | --- |
|
|
177
186
|
| `opencode-quota show` | Terminal quota-only quick glance |
|
|
178
187
|
| `/quota` | Detailed quota report |
|
|
179
|
-
| `/quota_status` | Config, provider, auth, pricing, and
|
|
188
|
+
| `/quota_status` | Config, provider, auth, pricing, `enabled`/`home` announcement config, `source=bundled_only`, `network=false`, and active/future/expired announcement counts |
|
|
189
|
+
| `/quota_announcements` | List active bundled maintainer notices |
|
|
180
190
|
| `/pricing_refresh` | Refresh local runtime pricing from `models.dev` |
|
|
181
191
|
| `/tokens_today` | Tokens used today |
|
|
182
192
|
| `/tokens_daily` | Tokens used in the last 24 hours |
|
|
@@ -191,26 +201,28 @@ For more examples, see [Common configuration](#common-configuration). For every
|
|
|
191
201
|
|
|
192
202
|
Most providers work automatically. If a provider has a “Needs setup” link, open that setup note only if you use that provider.
|
|
193
203
|
|
|
194
|
-
| Provider |
|
|
195
|
-
| --- | --- | --- |
|
|
196
|
-
| Anthropic (Claude) | [Needs setup](#anthropic-claude) | Local CLI
|
|
197
|
-
| GitHub Copilot |
|
|
198
|
-
| OpenAI | Automatic | Remote API |
|
|
199
|
-
| Cursor | [Needs setup](#cursor) | Local
|
|
200
|
-
| Qwen Code | [Needs setup](#qwen-code) | Local
|
|
201
|
-
| Alibaba Coding Plan |
|
|
202
|
-
| MiniMax Coding Plan |
|
|
203
|
-
| MiniMax Coding Plan (CN) |
|
|
204
|
-
| Kimi Code |
|
|
205
|
-
| Chutes AI |
|
|
206
|
-
| Crof.ai | Manual env/config | Remote API |
|
|
207
|
-
| Synthetic | Automatic | Remote API |
|
|
208
|
-
| Google Antigravity | [Needs setup](#google-antigravity) | Remote API |
|
|
209
|
-
| Gemini CLI | [Needs setup](#gemini-cli) | Remote API |
|
|
210
|
-
| Z.ai Coding Plan |
|
|
211
|
-
| Zhipu Coding Plan |
|
|
212
|
-
| NanoGPT |
|
|
213
|
-
|
|
|
204
|
+
| Provider | Auth/setup | Source | Reports |
|
|
205
|
+
| --- | --- | --- | --- |
|
|
206
|
+
| Anthropic (Claude) | [Needs setup](#anthropic-claude) | Local CLI/OAuth | Usage/quota |
|
|
207
|
+
| GitHub Copilot | OpenCode OAuth or PAT | Remote API | Quota/usage |
|
|
208
|
+
| OpenAI | Automatic | Remote API | Usage/quota |
|
|
209
|
+
| Cursor | [Needs setup](#cursor) | Local estimate | Estimated quota |
|
|
210
|
+
| Qwen Code | [Needs setup](#qwen-code) | Local estimate | Estimated quota |
|
|
211
|
+
| Alibaba Coding Plan | OpenCode config | Local estimate | Estimated quota |
|
|
212
|
+
| MiniMax Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
213
|
+
| MiniMax Coding Plan (CN) | OpenCode config | Remote API | Usage/quota |
|
|
214
|
+
| Kimi Code | OpenCode config | Remote API | Usage/quota |
|
|
215
|
+
| Chutes AI | API key/config | Remote API | Usage/quota |
|
|
216
|
+
| Crof.ai | Manual env/config/auth | Remote API | Usage/quota |
|
|
217
|
+
| Synthetic | Automatic | Remote API | Quota |
|
|
218
|
+
| Google Antigravity | [Needs setup](#google-antigravity) | Remote API | Usage/quota |
|
|
219
|
+
| Gemini CLI | [Needs setup](#gemini-cli) | Remote API | Usage/quota |
|
|
220
|
+
| Z.ai Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
221
|
+
| Zhipu Coding Plan | OpenCode config | Remote API | Usage/quota |
|
|
222
|
+
| NanoGPT | API key/config | Remote APIs | Usage + balance |
|
|
223
|
+
| DeepSeek | API key/config | Remote API | Balance/status |
|
|
224
|
+
| Ollama Cloud | [Needs setup](#ollama-cloud) | Dashboard scraping | Dashboard usage |
|
|
225
|
+
| OpenCode Go | [Needs setup](#opencode-go) | Dashboard scraping | Dashboard usage |
|
|
214
226
|
|
|
215
227
|
## Common configuration
|
|
216
228
|
|
|
@@ -224,6 +236,10 @@ Common locations:
|
|
|
224
236
|
|
|
225
237
|
If you are unsure, run `/quota_status`; it prints the config path it loaded.
|
|
226
238
|
|
|
239
|
+
### Maintainer announcements and privacy
|
|
240
|
+
|
|
241
|
+
Announcements are bundled only: no remote fetches, announcement telemetry, or persisted dismiss state. Use `/quota_announcements` to read active notices and `/quota_status` for counts/diagnostics. See **Configure maintainer announcements** below for options.
|
|
242
|
+
|
|
227
243
|
<details>
|
|
228
244
|
<summary><strong>Choose providers explicitly</strong></summary>
|
|
229
245
|
|
|
@@ -270,6 +286,22 @@ Keeps `/quota`, `/quota_status`, terminal checks, and any enabled UI surfaces.
|
|
|
270
286
|
|
|
271
287
|
</details>
|
|
272
288
|
|
|
289
|
+
<details>
|
|
290
|
+
<summary><strong>Configure maintainer announcements</strong></summary>
|
|
291
|
+
|
|
292
|
+
```jsonc
|
|
293
|
+
{
|
|
294
|
+
"maintainerAnnouncements": {
|
|
295
|
+
"enabled": true,
|
|
296
|
+
"home": true,
|
|
297
|
+
},
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
Set `enabled: false` to disable automatic announcement surfaces. `/quota_announcements` lists active bundled notices when announcements are enabled.
|
|
302
|
+
|
|
303
|
+
</details>
|
|
304
|
+
|
|
273
305
|
<details>
|
|
274
306
|
<summary><strong>Turn off the Sidebar panel</strong></summary>
|
|
275
307
|
|
|
@@ -369,13 +401,20 @@ Existing `experimental.quotaToast` settings still work when no sidecar file exis
|
|
|
369
401
|
|
|
370
402
|
| Option | Default | Meaning |
|
|
371
403
|
| --- | --- | --- |
|
|
372
|
-
| `tuiSidebarPanel.enabled` | `true` | Show the Sidebar `Quota` panel when the TUI plugin is installed.
|
|
404
|
+
| `tuiSidebarPanel.enabled` | `true` | Show the Sidebar `Quota` panel when the TUI plugin is installed. Click the panel header to toggle between compact summary and detailed all-windows views; OpenCode remembers the last state. |
|
|
373
405
|
| `tuiCompactStatus.enabled` | `false` | Opt in to Compact status line UI surfaces. |
|
|
374
406
|
| `tuiCompactStatus.homeBottom` | `true` | Show the Compact status line at the home bottom location. |
|
|
375
407
|
| `tuiCompactStatus.sessionPrompt` | `true` | Show the Compact status line by wrapping the TUI session prompt. Disable this if you only want the home-bottom line. |
|
|
376
408
|
| `tuiCompactStatus.suppressWhenNativeProviderQuota` | `true` | Hide the Compact status line when OpenCode exposes native provider-quota support. |
|
|
377
409
|
| `tuiCompactStatus.maxWidth` | `96` | Maximum Compact status line text width. |
|
|
378
410
|
|
|
411
|
+
### Maintainer announcement settings
|
|
412
|
+
|
|
413
|
+
| Option | Default | Meaning |
|
|
414
|
+
| --- | --- | --- |
|
|
415
|
+
| `maintainerAnnouncements.enabled` | `true` | Enable bundled maintainer announcements. |
|
|
416
|
+
| `maintainerAnnouncements.home` | `true` | Show the count-only notice on TUI home when the quota TUI plugin is configured, or as a one-shot toast fallback after a visible quota toast when it is not. |
|
|
417
|
+
|
|
379
418
|
### Provider-specific settings
|
|
380
419
|
|
|
381
420
|
| Option | Default | Meaning |
|
|
@@ -449,6 +488,53 @@ If you use manual provider selection, include `google-gemini-cli` in `enabledPro
|
|
|
449
488
|
|
|
450
489
|
</details>
|
|
451
490
|
|
|
491
|
+
<a id="deepseek"></a>
|
|
492
|
+
<details>
|
|
493
|
+
<summary><strong>DeepSeek</strong></summary>
|
|
494
|
+
|
|
495
|
+
DeepSeek shows the current on-demand account balance from `GET https://api.deepseek.com/user/balance`.
|
|
496
|
+
|
|
497
|
+
Use one of these trusted API-key sources:
|
|
498
|
+
|
|
499
|
+
```bash
|
|
500
|
+
export DEEPSEEK_API_KEY="your-api-key"
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
Or put the key in trusted user/global OpenCode config, not repo-local config:
|
|
504
|
+
|
|
505
|
+
```jsonc
|
|
506
|
+
{
|
|
507
|
+
"provider": {
|
|
508
|
+
"deepseek": {
|
|
509
|
+
"options": { "apiKey": "{env:DEEPSEEK_API_KEY}" },
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
}
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
If you use manual provider selection, include `deepseek` in `enabledProviders`.
|
|
516
|
+
|
|
517
|
+
</details>
|
|
518
|
+
|
|
519
|
+
<a id="ollama-cloud"></a>
|
|
520
|
+
<details>
|
|
521
|
+
<summary><strong>Ollama Cloud</strong></summary>
|
|
522
|
+
|
|
523
|
+
Ollama Cloud quota scrapes the Ollama Cloud settings page and needs a `__Secure-session` cookie:
|
|
524
|
+
|
|
525
|
+
```bash
|
|
526
|
+
export OLLAMA_USAGE_COOKIE="your-session-cookie-value"
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
Or use one of these config files (cookie without the `__Secure-session=` prefix, or with — the plugin normalizes it):
|
|
530
|
+
|
|
531
|
+
- `~/.config/opencode/opencode-quota/ollama-cloud.json`: `{ "cookie": "..." }`
|
|
532
|
+
- `~/.config/ollama-usage/config.yaml`: `cookie: "..."`
|
|
533
|
+
|
|
534
|
+
To find the cookie, open `ollama.com/settings` in your browser, open Developer Tools → Storage → Cookies, and copy the value of `__Secure-session`.
|
|
535
|
+
|
|
536
|
+
</details>
|
|
537
|
+
|
|
452
538
|
<a id="opencode-go"></a>
|
|
453
539
|
<details>
|
|
454
540
|
<summary><strong>OpenCode Go</strong></summary>
|
|
@@ -483,6 +569,7 @@ Start here when quota or token data looks wrong.
|
|
|
483
569
|
| Compact status line does not appear anywhere | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, check `tuiCompactStatus.enabled`, and check whether `tuiCompactStatus.suppressWhenNativeProviderQuota` is hiding it because OpenCode exposes native provider-quota support. |
|
|
484
570
|
| Compact status appears on home but not in chat/session | Check `tuiCompactStatus.sessionPrompt`; set it to `true` to show the chat/session prompt line. |
|
|
485
571
|
| Popup toasts do not appear | Check `enableToast`, `showOnIdle`, `showOnQuestion`, and `showOnCompact`. |
|
|
572
|
+
| Announcement home notice does not appear | Confirm `tui.json` includes `@slkiser/opencode-quota`, restart OpenCode, then check `maintainerAnnouncements.enabled`, `maintainerAnnouncements.home`, and the active count in the `maintainer_announcements` section of `/quota_status`. |
|
|
486
573
|
| Token reports are empty | Start OpenCode once so `opencode.db` exists, then run a session with model usage. |
|
|
487
574
|
| Pricing looks stale | Run `/pricing_refresh`. |
|
|
488
575
|
|
|
@@ -574,23 +661,24 @@ Run `/quota_status` and check the Alibaba auth, resolved tier, state-file path,
|
|
|
574
661
|
</details>
|
|
575
662
|
|
|
576
663
|
<details>
|
|
577
|
-
<summary><strong>MiniMax, Kimi, Chutes AI, Crof.ai, Synthetic, Z.ai, Zhipu, and
|
|
664
|
+
<summary><strong>MiniMax, Kimi, Chutes AI, Crof.ai, Synthetic, Z.ai, Zhipu, NanoGPT, and DeepSeek</strong></summary>
|
|
578
665
|
|
|
579
|
-
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth. Run `/quota_status` and check the provider-specific API-key diagnostics.
|
|
666
|
+
These providers use trusted env vars, trusted user/global OpenCode config, or native OpenCode auth. Run `/quota_status` and check the provider-specific API-key diagnostics.
|
|
580
667
|
|
|
581
668
|
| Provider | Useful checks |
|
|
582
669
|
| --- | --- |
|
|
583
670
|
| MiniMax Coding Plan | Use `MINIMAX_CODING_PLAN_API_KEY` or `MINIMAX_API_KEY` for the international endpoint. Runtime/config ids like `minimax` and `minimax-coding-plan` use this provider. Repo-local provider secrets are ignored. |
|
|
584
671
|
| MiniMax Coding Plan (CN) | Use `MINIMAX_CHINA_CODING_PLAN_API_KEY` or trusted user/global OpenCode config under `minimax-china-coding-plan`, `minimax-cn-coding-plan`, `minimax-cn`, or `minimax-china`. Runtime id `minimax-cn-coding-plan` uses this provider. |
|
|
585
672
|
| Kimi Code | Use `KIMI_API_KEY` or `KIMI_CODE_API_KEY`; repo-local provider secrets are ignored. |
|
|
586
|
-
| Chutes AI | Use `CHUTES_API_KEY
|
|
587
|
-
| Crof.ai | Use `CROF_API_KEY`, `CROFAI_API_KEY`,
|
|
673
|
+
| Chutes AI | Use `CHUTES_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
674
|
+
| Crof.ai | Use `CROF_API_KEY`, `CROFAI_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
588
675
|
| Synthetic | Use `SYNTHETIC_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
589
676
|
| Z.ai Coding Plan | Use `ZAI_API_KEY` or `ZAI_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
590
677
|
| Zhipu Coding Plan | Use `ZHIPU_API_KEY` or `ZHIPU_CODING_PLAN_API_KEY`; malformed fallback auth is surfaced as an auth error. |
|
|
591
678
|
| NanoGPT | Use `NANOGPT_API_KEY`, `NANO_GPT_API_KEY`, trusted user/global config, or OpenCode auth. |
|
|
679
|
+
| DeepSeek | Use `DEEPSEEK_API_KEY`, trusted user/global config under `provider.deepseek.options.apiKey`, or OpenCode auth. This provider shows balance only because DeepSeek does not expose a quota reset window. |
|
|
592
680
|
|
|
593
|
-
For security, repo-local `opencode.json` / `opencode.jsonc` is ignored for provider secrets in these integrations. Put secrets in environment variables or trusted user/global config.
|
|
681
|
+
For security, repo-local `opencode.json` / `opencode.jsonc` is ignored for provider secrets in these integrations. Put secrets in environment variables or trusted user/global config. OpenCode auth fallbacks for API-key providers require `{ "type": "api", "key": "..." }` entries.
|
|
594
682
|
|
|
595
683
|
</details>
|
|
596
684
|
|
package/dist/index.d.ts
CHANGED
|
@@ -11,5 +11,5 @@ declare const pluginModule: {
|
|
|
11
11
|
};
|
|
12
12
|
export default pluginModule;
|
|
13
13
|
export { QuotaToastPlugin } from "./plugin.js";
|
|
14
|
-
export type { QuotaToastConfig, GoogleModelId, PricingSnapshotSource, CopilotEnterpriseUsageResult, CopilotOrganizationUsageResult, CopilotQuotaResult, GoogleQuotaResult, GoogleModelQuota, MiniMaxResult, MiniMaxResultEntry, } from "./lib/types.js";
|
|
14
|
+
export type { QuotaToastConfig, MaintainerAnnouncementsConfig, GoogleModelId, PricingSnapshotSource, CopilotEnterpriseUsageResult, CopilotOrganizationUsageResult, CopilotQuotaResult, GoogleQuotaResult, GoogleModelQuota, MiniMaxResult, MiniMaxResultEntry, } from "./lib/types.js";
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,QAAA,MAAM,YAAY;;;CAGQ,CAAC;AAE3B,eAAe,YAAY,CAAC;AAI5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,qBAAqB,EACrB,4BAA4B,EAC5B,8BAA8B,EAC9B,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,QAAA,MAAM,YAAY;;;CAGQ,CAAC;AAE3B,eAAe,YAAY,CAAC;AAI5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,YAAY,EACV,gBAAgB,EAChB,6BAA6B,EAC7B,aAAa,EACb,qBAAqB,EACrB,4BAA4B,EAC5B,8BAA8B,EAC9B,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,GACnB,MAAM,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alibaba-auth.d.ts","sourceRoot":"","sources":["../../src/lib/alibaba-auth.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAmB,qBAAqB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEnF,eAAO,MAAM,qCAAqC,OAAQ,CAAC;AAM3D,MAAM,MAAM,0BAA0B,GAClC,iCAAiC,GACjC,qBAAqB,GACrB,eAAe,GACf,gBAAgB,GAChB,WAAW,CAAC;AAEhB,MAAM,MAAM,6BAA6B,GACrC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACjB;IAAE,KAAK,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,qBAAqB,CAAA;CAAE,GACpE;IAAE,KAAK,EAAE,SAAS,CAAC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OAAO,CAEzE;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAIxD"}
|
package/dist/lib/alibaba-auth.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { extractProviderOptionsApiKey, getApiKeyCheckedPaths,
|
|
1
|
+
import { extractProviderOptionsApiKey, getApiKeyCheckedPaths, getGlobalOpencodeConfigCandidatePaths, resolveApiKeyFromEnvAndConfig, } from "./api-key-resolver.js";
|
|
2
2
|
import { getAuthPaths, readAuthFileCached } from "./opencode-auth.js";
|
|
3
|
+
import { sanitizeDisplayText } from "./display-sanitize.js";
|
|
3
4
|
export const DEFAULT_ALIBABA_AUTH_CACHE_MAX_AGE_MS = 5_000;
|
|
4
5
|
const ALIBABA_AUTH_KEYS = ["alibaba-coding-plan", "alibaba"];
|
|
5
6
|
const ALIBABA_PROVIDER_KEYS = ["alibaba-coding-plan", "alibaba"];
|
|
@@ -27,32 +28,51 @@ function normalizeAlibabaTier(value) {
|
|
|
27
28
|
return "pro";
|
|
28
29
|
return null;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function asRecord(value) {
|
|
32
|
+
return value !== null && typeof value === "object" ? value : null;
|
|
33
|
+
}
|
|
34
|
+
function getAlibabaAuthEntry(auth) {
|
|
35
|
+
const root = asRecord(auth);
|
|
36
|
+
if (!root)
|
|
37
|
+
return undefined;
|
|
31
38
|
for (const key of ALIBABA_AUTH_KEYS) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
continue;
|
|
35
|
-
const alibaba = entry;
|
|
36
|
-
const credential = typeof alibaba.key === "string" && alibaba.key.trim()
|
|
37
|
-
? alibaba.key.trim()
|
|
38
|
-
: typeof alibaba.access === "string" && alibaba.access.trim()
|
|
39
|
-
? alibaba.access.trim()
|
|
40
|
-
: "";
|
|
41
|
-
if (!credential) {
|
|
42
|
-
continue;
|
|
39
|
+
if (Object.prototype.hasOwnProperty.call(root, key)) {
|
|
40
|
+
return root[key];
|
|
43
41
|
}
|
|
44
|
-
return alibaba;
|
|
45
42
|
}
|
|
46
|
-
return
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
function isAlibabaAuthData(value) {
|
|
46
|
+
return value !== null && typeof value === "object";
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
|
|
48
|
+
function sanitizeAlibabaAuthValue(value) {
|
|
49
|
+
const sanitized = sanitizeDisplayText(value).replace(/\s+/g, " ").trim();
|
|
50
|
+
return (sanitized || "unknown").slice(0, 120);
|
|
50
51
|
}
|
|
51
52
|
export function resolveAlibabaCodingPlanAuth(auth, fallbackTier = DEFAULT_ALIBABA_CODING_PLAN_TIER) {
|
|
52
|
-
const alibaba =
|
|
53
|
-
if (
|
|
53
|
+
const alibaba = getAlibabaAuthEntry(auth);
|
|
54
|
+
if (alibaba === undefined) {
|
|
54
55
|
return { state: "none" };
|
|
55
56
|
}
|
|
57
|
+
if (!isAlibabaAuthData(alibaba)) {
|
|
58
|
+
return { state: "invalid", error: "Alibaba Coding Plan auth entry has invalid shape" };
|
|
59
|
+
}
|
|
60
|
+
if (typeof alibaba.type !== "string") {
|
|
61
|
+
return {
|
|
62
|
+
state: "invalid",
|
|
63
|
+
error: "Alibaba Coding Plan auth entry present but type is missing or invalid",
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
if (alibaba.type !== "api") {
|
|
67
|
+
return {
|
|
68
|
+
state: "invalid",
|
|
69
|
+
error: `Unsupported Alibaba Coding Plan auth type: "${sanitizeAlibabaAuthValue(alibaba.type)}"`,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const apiKey = typeof alibaba.key === "string" ? alibaba.key.trim() : "";
|
|
73
|
+
if (!apiKey) {
|
|
74
|
+
return { state: "invalid", error: "Alibaba Coding Plan auth entry present but key is empty" };
|
|
75
|
+
}
|
|
56
76
|
const rawTier = getFirstString(alibaba, [
|
|
57
77
|
"tier",
|
|
58
78
|
"planTier",
|
|
@@ -63,20 +83,20 @@ export function resolveAlibabaCodingPlanAuth(auth, fallbackTier = DEFAULT_ALIBAB
|
|
|
63
83
|
if (!rawTier) {
|
|
64
84
|
return {
|
|
65
85
|
state: "configured",
|
|
66
|
-
apiKey
|
|
86
|
+
apiKey,
|
|
67
87
|
tier: fallbackTier,
|
|
68
88
|
};
|
|
69
89
|
}
|
|
70
90
|
if (!tier) {
|
|
71
91
|
return {
|
|
72
92
|
state: "invalid",
|
|
73
|
-
error: `Unsupported Alibaba Coding Plan tier: ${rawTier}`,
|
|
93
|
+
error: `Unsupported Alibaba Coding Plan tier: ${sanitizeAlibabaAuthValue(rawTier)}`,
|
|
74
94
|
rawTier,
|
|
75
95
|
};
|
|
76
96
|
}
|
|
77
97
|
return {
|
|
78
98
|
state: "configured",
|
|
79
|
-
apiKey
|
|
99
|
+
apiKey,
|
|
80
100
|
tier,
|
|
81
101
|
};
|
|
82
102
|
}
|
|
@@ -155,7 +175,7 @@ export async function getAlibabaCodingPlanAuthDiagnostics(params) {
|
|
|
155
175
|
};
|
|
156
176
|
}
|
|
157
177
|
export function hasAlibabaAuth(auth) {
|
|
158
|
-
return
|
|
178
|
+
return resolveAlibabaCodingPlanAuth(auth).state === "configured";
|
|
159
179
|
}
|
|
160
180
|
export function isAlibabaModelId(model) {
|
|
161
181
|
if (typeof model !== "string")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alibaba-auth.js","sourceRoot":"","sources":["../../src/lib/alibaba-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"alibaba-auth.js","sourceRoot":"","sources":["../../src/lib/alibaba-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,4BAA4B,EAC5B,qBAAqB,EACrB,qCAAqC,EACrC,6BAA6B,GAC9B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,C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,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;CACzB;AAKD,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,WAAW,CAAC;AAEhB,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAejH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAE9E;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAExD;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"chutes-config.d.ts","sourceRoot":"","sources":["../../src/lib/chutes-config.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,eAAe,CAAC;CACzB;AAKD,MAAM,MAAM,eAAe,GACvB,oBAAoB,GACpB,eAAe,GACf,gBAAgB,GAChB,WAAW,CAAC;AAEhB,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAejH,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,CAE9E;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAExD;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC;IACvD,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC,CAKD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readAuthFile } from "./opencode-auth.js";
|
|
1
|
+
import { getAuthPaths, readAuthFile } from "./opencode-auth.js";
|
|
2
2
|
import { createProviderApiKeyResolver, getGlobalOpencodeConfigCandidatePaths, } from "./api-key-resolver.js";
|
|
3
3
|
const ALLOWED_CHUTES_ENV_VARS = ["CHUTES_API_KEY"];
|
|
4
4
|
const CHUTES_PROVIDER_KEYS = ["chutes"];
|
|
@@ -22,6 +22,9 @@ export async function hasChutesApiKey() {
|
|
|
22
22
|
return chutesApiKeyResolver.has();
|
|
23
23
|
}
|
|
24
24
|
export async function getChutesKeyDiagnostics() {
|
|
25
|
-
return
|
|
25
|
+
return {
|
|
26
|
+
...(await chutesApiKeyResolver.diagnostics()),
|
|
27
|
+
authPaths: getAuthPaths(),
|
|
28
|
+
};
|
|
26
29
|
}
|
|
27
30
|
//# sourceMappingURL=chutes-config.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chutes-config.js","sourceRoot":"","sources":["../../src/lib/chutes-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"chutes-config.js","sourceRoot":"","sources":["../../src/lib/chutes-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EACL,4BAA4B,EAC5B,qCAAqC,GACtC,MAAM,uBAAuB,CAAC;AAO/B,MAAM,uBAAuB,GAAG,CAAC,gBAAgB,CAAU,CAAC;AAC5D,MAAM,oBAAoB,GAAG,CAAC,QAAQ,CAAU,CAAC;AAQjD,OAAO,EAAE,qCAAqC,IAAI,+BAA+B,EAAE,MAAM,uBAAuB,CAAC;AAEjH,MAAM,oBAAoB,GAAG,4BAA4B,CAAkB;IACzE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAC;IACnE,YAAY,EAAE,oBAAoB;IAClC,cAAc,EAAE,uBAAuB;IACvC,gBAAgB,EAAE,eAAe;IACjC,iBAAiB,EAAE,gBAAgB;IACnC,mBAAmB,EAAE,qCAAqC;IAC1D,IAAI,EAAE;QACJ,QAAQ,EAAE,YAAY;QACtB,UAAU,EAAE,WAAW;KACxB;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,mBAAmB;IACvC,OAAO,oBAAoB,CAAC,OAAO,EAAE,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,OAAO,oBAAoB,CAAC,GAAG,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,uBAAuB;IAM3C,OAAO;QACL,GAAG,CAAC,MAAM,oBAAoB,CAAC,WAAW,EAAE,CAAC;QAC7C,SAAS,EAAE,YAAY,EAAE;KAC1B,CAAC;AACJ,CAAC"}
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { QuotaToastConfig } from "./types.js";
|
|
10
10
|
export declare const QUOTA_TOAST_CONFIG_RELATIVE_PATH = "opencode-quota/quota-toast.json";
|
|
11
|
-
export declare const QUOTA_TOAST_SETTING_SOURCE_KEYS: readonly ["enabled", "enableToast", "formatStyle", "percentDisplayMode", "minIntervalMs", "requestTimeoutMs", "debug", "enabledProviders", "anthropicBinaryPath", "googleModels", "alibabaCodingPlanTier", "cursorPlan", "cursorIncludedApiUsd", "cursorBillingCycleStartDay", "opencodeGoWindows", "pricingSnapshot.source", "pricingSnapshot.autoRefresh", "showOnIdle", "showOnQuestion", "showOnCompact", "showOnBothFail", "toastDurationMs", "onlyCurrentModel", "showSessionTokens", "tuiSidebarPanel.enabled", "tuiCompactStatus.enabled", "tuiCompactStatus.homeBottom", "tuiCompactStatus.sessionPrompt", "tuiCompactStatus.suppressWhenNativeProviderQuota", "tuiCompactStatus.maxWidth", "layout.maxWidth", "layout.narrowAt", "layout.tinyAt"];
|
|
11
|
+
export declare const QUOTA_TOAST_SETTING_SOURCE_KEYS: readonly ["enabled", "enableToast", "formatStyle", "percentDisplayMode", "minIntervalMs", "requestTimeoutMs", "debug", "enabledProviders", "anthropicBinaryPath", "googleModels", "alibabaCodingPlanTier", "cursorPlan", "cursorIncludedApiUsd", "cursorBillingCycleStartDay", "opencodeGoWindows", "pricingSnapshot.source", "pricingSnapshot.autoRefresh", "showOnIdle", "showOnQuestion", "showOnCompact", "showOnBothFail", "toastDurationMs", "onlyCurrentModel", "showSessionTokens", "tuiSidebarPanel.enabled", "tuiCompactStatus.enabled", "tuiCompactStatus.homeBottom", "tuiCompactStatus.sessionPrompt", "tuiCompactStatus.suppressWhenNativeProviderQuota", "tuiCompactStatus.maxWidth", "maintainerAnnouncements.enabled", "maintainerAnnouncements.home", "layout.maxWidth", "layout.narrowAt", "layout.tinyAt"];
|
|
12
12
|
export type QuotaToastSettingSourceKey = (typeof QUOTA_TOAST_SETTING_SOURCE_KEYS)[number];
|
|
13
13
|
export type QuotaToastSettingSources = Partial<Record<QuotaToastSettingSourceKey, string>>;
|
|
14
14
|
export interface LoadConfigIssue {
|
package/dist/lib/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAapB,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAElF,eAAO,MAAM,+BAA+B,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EAIjB,MAAM,YAAY,CAAC;AAapB,eAAO,MAAM,gCAAgC,oCAAoC,CAAC;AAElF,eAAO,MAAM,+BAA+B,gyBAoClC,CAAC;AAEX,MAAM,MAAM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|
package/dist/lib/config.js
CHANGED
|
@@ -47,6 +47,8 @@ export const QUOTA_TOAST_SETTING_SOURCE_KEYS = [
|
|
|
47
47
|
"tuiCompactStatus.sessionPrompt",
|
|
48
48
|
"tuiCompactStatus.suppressWhenNativeProviderQuota",
|
|
49
49
|
"tuiCompactStatus.maxWidth",
|
|
50
|
+
"maintainerAnnouncements.enabled",
|
|
51
|
+
"maintainerAnnouncements.home",
|
|
50
52
|
"layout.maxWidth",
|
|
51
53
|
"layout.narrowAt",
|
|
52
54
|
"layout.tinyAt",
|
|
@@ -159,6 +161,7 @@ function cloneConfig(config) {
|
|
|
159
161
|
pricingSnapshot: { ...config.pricingSnapshot },
|
|
160
162
|
tuiSidebarPanel: { ...config.tuiSidebarPanel },
|
|
161
163
|
tuiCompactStatus: { ...config.tuiCompactStatus },
|
|
164
|
+
maintainerAnnouncements: { ...config.maintainerAnnouncements },
|
|
162
165
|
layout: { ...config.layout },
|
|
163
166
|
};
|
|
164
167
|
}
|
|
@@ -257,6 +260,19 @@ function extractTuiCompactStatusPatch(value) {
|
|
|
257
260
|
}
|
|
258
261
|
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
259
262
|
}
|
|
263
|
+
function extractMaintainerAnnouncementsPatch(value) {
|
|
264
|
+
if (!isPlainObject(value)) {
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const patch = {};
|
|
268
|
+
if (hasOwnKey(value, "enabled") && typeof value.enabled === "boolean") {
|
|
269
|
+
patch.enabled = value.enabled;
|
|
270
|
+
}
|
|
271
|
+
if (hasOwnKey(value, "home") && typeof value.home === "boolean") {
|
|
272
|
+
patch.home = value.home;
|
|
273
|
+
}
|
|
274
|
+
return Object.keys(patch).length > 0 ? patch : undefined;
|
|
275
|
+
}
|
|
260
276
|
function extractLayoutPatch(value) {
|
|
261
277
|
if (!isPlainObject(value)) {
|
|
262
278
|
return undefined;
|
|
@@ -388,6 +404,12 @@ function extractValidatedQuotaToastPatch(quotaToastConfig, reportIssue) {
|
|
|
388
404
|
patch.tuiCompactStatus = tuiCompactStatus;
|
|
389
405
|
}
|
|
390
406
|
}
|
|
407
|
+
if (hasOwnKey(quotaToastConfig, "maintainerAnnouncements")) {
|
|
408
|
+
const maintainerAnnouncements = extractMaintainerAnnouncementsPatch(quotaToastConfig.maintainerAnnouncements);
|
|
409
|
+
if (maintainerAnnouncements) {
|
|
410
|
+
patch.maintainerAnnouncements = maintainerAnnouncements;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
391
413
|
if (hasOwnKey(quotaToastConfig, "layout")) {
|
|
392
414
|
const layout = extractLayoutPatch(quotaToastConfig.layout);
|
|
393
415
|
if (layout) {
|
|
@@ -530,6 +552,16 @@ function applyValidatedQuotaToastPatch(config, patch, sourcePath, settingSources
|
|
|
530
552
|
applySettingSource(settingSources, "tuiCompactStatus.maxWidth", sourcePath);
|
|
531
553
|
}
|
|
532
554
|
}
|
|
555
|
+
if (patch.maintainerAnnouncements) {
|
|
556
|
+
if (hasOwnKey(patch.maintainerAnnouncements, "enabled")) {
|
|
557
|
+
config.maintainerAnnouncements.enabled = patch.maintainerAnnouncements.enabled;
|
|
558
|
+
applySettingSource(settingSources, "maintainerAnnouncements.enabled", sourcePath);
|
|
559
|
+
}
|
|
560
|
+
if (hasOwnKey(patch.maintainerAnnouncements, "home")) {
|
|
561
|
+
config.maintainerAnnouncements.home = patch.maintainerAnnouncements.home;
|
|
562
|
+
applySettingSource(settingSources, "maintainerAnnouncements.home", sourcePath);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
533
565
|
if (patch.layout) {
|
|
534
566
|
if (hasOwnKey(patch.layout, "maxWidth")) {
|
|
535
567
|
config.layout.maxWidth = patch.layout.maxWidth;
|