@ereinha/opencode-enhanced-quotas 1.0.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.
Files changed (98) hide show
  1. package/README.md +333 -0
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +42 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/constants.d.ts +13 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +19 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/defaults.d.ts +3 -0
  11. package/dist/defaults.d.ts.map +1 -0
  12. package/dist/defaults.js +56 -0
  13. package/dist/defaults.js.map +1 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +449 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/interfaces.d.ts +210 -0
  19. package/dist/interfaces.d.ts.map +1 -0
  20. package/dist/interfaces.js +2 -0
  21. package/dist/interfaces.js.map +1 -0
  22. package/dist/logger.d.ts +15 -0
  23. package/dist/logger.d.ts.map +1 -0
  24. package/dist/logger.js +47 -0
  25. package/dist/logger.js.map +1 -0
  26. package/dist/plugin-state.d.ts +32 -0
  27. package/dist/plugin-state.d.ts.map +1 -0
  28. package/dist/plugin-state.js +81 -0
  29. package/dist/plugin-state.js.map +1 -0
  30. package/dist/providers/antigravity/auth.d.ts +12 -0
  31. package/dist/providers/antigravity/auth.d.ts.map +1 -0
  32. package/dist/providers/antigravity/auth.js +109 -0
  33. package/dist/providers/antigravity/auth.js.map +1 -0
  34. package/dist/providers/antigravity/index.d.ts +2 -0
  35. package/dist/providers/antigravity/index.d.ts.map +1 -0
  36. package/dist/providers/antigravity/index.js +2 -0
  37. package/dist/providers/antigravity/index.js.map +1 -0
  38. package/dist/providers/antigravity/provider.d.ts +34 -0
  39. package/dist/providers/antigravity/provider.d.ts.map +1 -0
  40. package/dist/providers/antigravity/provider.js +221 -0
  41. package/dist/providers/antigravity/provider.js.map +1 -0
  42. package/dist/providers/codex.d.ts +4 -0
  43. package/dist/providers/codex.d.ts.map +1 -0
  44. package/dist/providers/codex.js +233 -0
  45. package/dist/providers/codex.js.map +1 -0
  46. package/dist/providers/github.d.ts +4 -0
  47. package/dist/providers/github.d.ts.map +1 -0
  48. package/dist/providers/github.js +139 -0
  49. package/dist/providers/github.js.map +1 -0
  50. package/dist/quota-cache.d.ts +26 -0
  51. package/dist/quota-cache.d.ts.map +1 -0
  52. package/dist/quota-cache.js +107 -0
  53. package/dist/quota-cache.js.map +1 -0
  54. package/dist/registry.d.ts +3 -0
  55. package/dist/registry.d.ts.map +1 -0
  56. package/dist/registry.js +23 -0
  57. package/dist/registry.js.map +1 -0
  58. package/dist/services/aggregation-service.d.ts +34 -0
  59. package/dist/services/aggregation-service.d.ts.map +1 -0
  60. package/dist/services/aggregation-service.js +89 -0
  61. package/dist/services/aggregation-service.js.map +1 -0
  62. package/dist/services/config-loader.d.ts +32 -0
  63. package/dist/services/config-loader.d.ts.map +1 -0
  64. package/dist/services/config-loader.js +168 -0
  65. package/dist/services/config-loader.js.map +1 -0
  66. package/dist/services/history-service.d.ts +39 -0
  67. package/dist/services/history-service.d.ts.map +1 -0
  68. package/dist/services/history-service.js +207 -0
  69. package/dist/services/history-service.js.map +1 -0
  70. package/dist/services/prediction-engine.d.ts +51 -0
  71. package/dist/services/prediction-engine.d.ts.map +1 -0
  72. package/dist/services/prediction-engine.js +108 -0
  73. package/dist/services/prediction-engine.js.map +1 -0
  74. package/dist/services/quota-service.d.ts +42 -0
  75. package/dist/services/quota-service.d.ts.map +1 -0
  76. package/dist/services/quota-service.js +339 -0
  77. package/dist/services/quota-service.js.map +1 -0
  78. package/dist/ui/progress-bar.d.ts +20 -0
  79. package/dist/ui/progress-bar.d.ts.map +1 -0
  80. package/dist/ui/progress-bar.js +150 -0
  81. package/dist/ui/progress-bar.js.map +1 -0
  82. package/dist/ui/quota-table.d.ts +15 -0
  83. package/dist/ui/quota-table.d.ts.map +1 -0
  84. package/dist/ui/quota-table.js +137 -0
  85. package/dist/ui/quota-table.js.map +1 -0
  86. package/dist/utils/paths.d.ts +7 -0
  87. package/dist/utils/paths.d.ts.map +1 -0
  88. package/dist/utils/paths.js +37 -0
  89. package/dist/utils/paths.js.map +1 -0
  90. package/dist/utils/time.d.ts +3 -0
  91. package/dist/utils/time.d.ts.map +1 -0
  92. package/dist/utils/time.js +38 -0
  93. package/dist/utils/time.js.map +1 -0
  94. package/dist/utils/validation.d.ts +6 -0
  95. package/dist/utils/validation.d.ts.map +1 -0
  96. package/dist/utils/validation.js +66 -0
  97. package/dist/utils/validation.js.map +1 -0
  98. package/package.json +42 -0
package/README.md ADDED
@@ -0,0 +1,333 @@
1
+ # OpenCode Quotas Plugin
2
+
3
+ **The ultimate usage dashboard plugin for your AI coding assistants.**
4
+
5
+ **OpenCode Quotas** is an OpenCode.ai plugin that aggregates usage data from Antigravity, Codex, and GitHub Copilot into a single, beautiful dashboard injected directly into your OpenCode chat footer. Never hit a rate limit unexpectedly again.
6
+
7
+ ![OpenCode Quotas](docs/QuotaDisplay.png)
8
+
9
+ > **Note**: This is a community-developed plugin and is not officially affiliated with OpenCode.ai.
10
+
11
+ ## Features
12
+
13
+ - **Unified Dashboard**: See all your AI quotas (Antigravity, Codex, Copilot) in one place.
14
+ - **Smart Predictions**: Uses linear regression on usage history to predict when you'll exhaust your quota.
15
+ - **Visual Progress Bars**: ANSI-colored bars that change from green to yellow to red as you approach limits.
16
+ - **Context Aware**: Optionally filter quotas to show only those relevant to the active model.
17
+ - **Resilient**: Provider failures are isolated and won't break your chat experience.
18
+
19
+ ## Installation
20
+
21
+ ### 1. Clone & Build
22
+ Clone the repository into your OpenCode plugins directory and build it:
23
+
24
+ ```bash
25
+ # Clone into your plugins directory
26
+ git clone https://github.com/your-org/opencode-quotas ~/.opencode/plugins/opencode-quotas
27
+
28
+ # Build the plugin
29
+ cd ~/.opencode/plugins/opencode-quotas
30
+ bun install
31
+ npm run build
32
+ ```
33
+
34
+ ### 2. Register the Plugin
35
+ Add `opencode-quotas` to your OpenCode configuration file (typically `~/.opencode/config.json`) under the `plugins` array:
36
+
37
+ ```json
38
+ {
39
+ "plugin": [
40
+ "opencode-antigravity-auth",
41
+ "opencode-quotas"
42
+ ]
43
+ }
44
+ ```
45
+
46
+ ## Usage
47
+
48
+ Once installed and registered, a live quota summary is automatically appended to the final assistant response footer in OpenCode. The plugin waits for the session to go idle before injecting to avoid duplicate footers during multi-step runs.
49
+
50
+ ### CLI Mode (Optional)
51
+
52
+ You can also use OpenCode Quotas as a standalone CLI tool to check quotas directly from your terminal:
53
+
54
+ ```bash
55
+ # Show all quotas
56
+ opencode-quotas
57
+
58
+ # Filter by model (simulates what the plugin does automatically)
59
+ opencode-quotas --provider google --model antigravity-gemini-3-flash
60
+ ```
61
+
62
+ > **Tip**: During development, use `bun run opencode-quotas` to run without building.
63
+
64
+ ## Supported Providers
65
+
66
+ | Provider | Raw Quota IDs | Aggregated IDs | Description |
67
+ | :--- | :--- | :--- | :--- |
68
+ | **Antigravity** | `ag-raw-*` | `ag-flash`, `ag-pro`, `ag-premium` | Raw model quotas aggregated by pattern into Flash, Pro, and Premium tiers. |
69
+ | **Codex** | `codex-primary`, `codex-secondary` | `codex-smart` | Rate limits aggregated using most-critical strategy. |
70
+ | **GitHub Copilot** | — | — | ⚠️ Experimental (requires `enableExperimentalGithub: true` in config, disabled by default) |
71
+
72
+ > **Note**: Quota IDs are used in configuration options like `disabled`.
73
+
74
+ ## Column Reference
75
+
76
+ | Column | Description |
77
+ | :--- | :--- |
78
+ | `status` | Health indicator: `OK` (normal), `WRN` (warning), `ERR` (at/over limit) |
79
+ | `name` | Display name of the quota (e.g., "Antigravity Flash") |
80
+ | `bar` | Visual progress bar showing utilization |
81
+ | `percent` | Numeric percentage of quota used |
82
+ | `reset` | Time until the quota resets (e.g., "23m", "1h 30m") |
83
+ | `ettl` | **E**stimated **T**ime **T**o **L**imit - predicted time until quota exhaustion based on usage trends |
84
+ | `value` | Raw used/limit values (e.g., "150/500 credits") |
85
+ | `window` | Rate limit window duration (e.g., "5h window") |
86
+ | `info` | Additional info or alerts (e.g., "unlimited", "!!") |
87
+
88
+ ## Configuration
89
+
90
+ All configuration is done via `.opencode/quotas.json` in your project root. Settings apply to both the CLI and plugin.
91
+
92
+ ### Model Filtering
93
+
94
+ By default, `filterByCurrentModel` is disabled (false). Enable it to show only quotas relevant to the active model.
95
+
96
+ ```json
97
+ {
98
+ "filterByCurrentModel": false
99
+ }
100
+ ```
101
+
102
+ **How it works**: The plugin extracts tokens from the model ID (e.g., `antigravity-gemini-3-flash` becomes `["antigravity", "gemini", "3", "flash"]`) and scores each quota by how many tokens match its ID or name. The highest-scoring quotas are displayed.
103
+
104
+ **Before filtering (all quotas):**
105
+ ```text
106
+ ST QUOTA NAME USED UTILIZATION RESET ETTL
107
+ --- ------------------- ---- -------------------- ------ -----
108
+ OK Antigravity Flash 20% ████░░░░░░░░░░░░░░░░ 28m 13m
109
+ OK Antigravity Premium 40% ████████░░░░░░░░░░░░ 56m 1h 0m
110
+ ERR Codex Usage 100% ████████████████████ 13h 9m -
111
+ ```
112
+
113
+ **After filtering (model: `google/antigravity-gemini-3-flash`):**
114
+ ```text
115
+ ST QUOTA NAME USED UTILIZATION RESET ETTL
116
+ --- ----------------- ---- -------------------- ----- ----
117
+ OK Antigravity Flash 20% ████░░░░░░░░░░░░░░░░ 28m 13m
118
+ ```
119
+
120
+ ### Hide Specific Quotas
121
+
122
+ Permanently hide quotas you don't care about:
123
+
124
+ ```json
125
+ {
126
+ "disabled": ["ag-pro", "codex-smart"]
127
+ }
128
+ ```
129
+
130
+ ### Smart Aggregation
131
+
132
+ Combine multiple quotas into a single display row using explicit sources or pattern matching.
133
+
134
+ **Pattern-based aggregation** (matches raw quota IDs/names):
135
+ ```json
136
+ {
137
+ "aggregatedGroups": [
138
+ {
139
+ "id": "ag-flash",
140
+ "name": "Antigravity Flash",
141
+ "patterns": ["flash"],
142
+ "providerId": "antigravity",
143
+ "strategy": "most_critical"
144
+ }
145
+ ]
146
+ }
147
+ ```
148
+
149
+ **Explicit source aggregation** (specify exact quota IDs):
150
+ ```json
151
+ {
152
+ "aggregatedGroups": [
153
+ {
154
+ "id": "codex-unified",
155
+ "name": "Codex Usage",
156
+ "sources": ["codex-primary", "codex-secondary"],
157
+ "strategy": "most_critical"
158
+ }
159
+ ]
160
+ }
161
+ ```
162
+
163
+ **Aggregation options:**
164
+ | Option | Type | Description |
165
+ | :--- | :--- | :--- |
166
+ | `id` | string | Unique identifier for the aggregated quota |
167
+ | `name` | string | Display name |
168
+ | `sources` | string[] | Explicit quota IDs to include |
169
+ | `patterns` | string[] | Patterns to match against raw quota IDs/names |
170
+ | `providerId` | string | Limit pattern matching to a specific provider |
171
+ | `strategy` | string | Aggregation strategy (see below) |
172
+
173
+ **Aggregation strategies:**
174
+ | Strategy | Description |
175
+ | :--- | :--- |
176
+ | `most_critical` | Shows the quota predicted to hit its limit soonest (requires usage history) |
177
+ | `max` | Shows the quota with highest current usage percentage |
178
+ | `min` | Shows the quota with lowest current usage percentage |
179
+ | `mean` | Displays average usage across all sources |
180
+ | `median` | Displays median usage across all sources |
181
+
182
+ ## Output Customization
183
+
184
+ All options below work in both CLI and plugin output. ANSI colors only render in terminal environments.
185
+
186
+ ### Select Columns
187
+
188
+ ```json
189
+ {
190
+ "table": {
191
+ "columns": ["name", "bar", "percent"]
192
+ }
193
+ }
194
+ ```
195
+
196
+ ```text
197
+ QUOTA NAME UTILIZATION USED
198
+ ------------------- -------------------- ----
199
+ Antigravity Flash ████░░░░░░░░░░░░░░░░ 20%
200
+ Antigravity Premium ████████░░░░░░░░░░░░ 40%
201
+ Codex Usage ████████████████████ 100%
202
+ ```
203
+
204
+ ### Progress Bar Style
205
+
206
+ ```json
207
+ {
208
+ "progressBar": {
209
+ "filledChar": "=",
210
+ "emptyChar": "-",
211
+ "width": 10
212
+ }
213
+ }
214
+ ```
215
+
216
+ ```text
217
+ ST QUOTA NAME USED UTILIZATION RESET
218
+ --- ------------------- ---- ----------- ------
219
+ OK Antigravity Flash 20% ==-------- 23m
220
+ OK Antigravity Premium 40% ====------ 51m
221
+ ERR Codex Usage 100% ========== 13h 4m
222
+ ```
223
+
224
+ ### Show Remaining Capacity
225
+
226
+ Switch from "used" (default) to "available" mode. This inverts the display—useful if you prefer seeing how much is left:
227
+
228
+ ```json
229
+ {
230
+ "progressBar": {
231
+ "show": "available"
232
+ }
233
+ }
234
+ ```
235
+
236
+ ```text
237
+ ST QUOTA NAME USED UTILIZATION RESET
238
+ --- ------------------- ---- -------------------- ------
239
+ WRN Antigravity Flash 80% ████████████████░░░░ 23m
240
+ OK Codex Usage 0% ░░░░░░░░░░░░░░░░░░░░ 13h 4m
241
+ ```
242
+
243
+ > **Note**: In "available" mode, the percentage shows remaining capacity, and status thresholds are inverted.
244
+
245
+ ### Hide Table Header
246
+
247
+ ```json
248
+ {
249
+ "table": {
250
+ "header": false
251
+ }
252
+ }
253
+ ```
254
+
255
+ ```text
256
+ OK Antigravity Flash 20% ████░░░░░░░░░░░░░░░░ 23m 5h 52m
257
+ OK Antigravity Premium 40% ████████░░░░░░░░░░░░ 51m 1h 2m
258
+ ERR Codex Usage 100% ████████████████████ 13h 4m -
259
+ ```
260
+
261
+ ### Disable Colors
262
+
263
+ For plain text output (logging, CI, or non-TTY environments):
264
+
265
+ ```json
266
+ {
267
+ "progressBar": {
268
+ "color": false
269
+ }
270
+ }
271
+ ```
272
+
273
+ ### Custom Color Thresholds
274
+
275
+ Define when colors change based on usage percentage:
276
+
277
+ ```json
278
+ {
279
+ "progressBar": {
280
+ "color": true,
281
+ "gradients": [
282
+ { "threshold": 0.5, "color": "green" },
283
+ { "threshold": 0.8, "color": "yellow" },
284
+ { "threshold": 1.0, "color": "red" }
285
+ ]
286
+ }
287
+ }
288
+ ```
289
+
290
+ Available colors: `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, `gray`
291
+
292
+ ## Full Configuration Reference
293
+
294
+ See [schemas/quotas.schema.json](schemas/quotas.schema.json) for the complete JSON Schema.
295
+
296
+ | Option | Type | Default | Description |
297
+ | :--- | :--- | :--- | :--- |
298
+ | `footer` | boolean | `true` | Show quotas in chat footer |
299
+ | `showFooterTitle` | boolean | `true` | Show plugin title/header in footer |
300
+ | `filterByCurrentModel` | boolean | `false` | Filter quotas by active model |
301
+ | `disabled` | string[] | `[]` | Quota IDs to hide |
302
+ | `showUnaggregated` | boolean | `true` | Show quotas that don't match any aggregation group |
303
+ | `progressBar.color` | boolean | `false` | Enable ANSI colors (set `true` for colored terminal output) |
304
+ | `progressBar.width` | number | `20` | Progress bar character width |
305
+ | `progressBar.show` | string | `"used"` | `"used"` or `"available"` |
306
+ | `table.columns` | string[] | (auto) | Columns to display |
307
+ | `table.header` | boolean | `true` | Show column headers |
308
+ | `aggregatedGroups` | array | (see defaults) | Quota aggregation with patterns or sources |
309
+ | `historyMaxAgeHours` | number | `24` | Max history age in hours |
310
+ | `pollingInterval` | number | `60000` | Refresh interval in ms |
311
+ | `predictionWindowMinutes` | number | `60` | Time window for regression analysis (minutes) |
312
+ | `predictionShortWindowMinutes` | number | `5` | Short time window for spike detection (minutes) |
313
+ | `debug` | boolean | `false` | Enable debug logging |
314
+
315
+ ## Security
316
+
317
+ Your credentials remain safe. This plugin uses standard local OAuth flows and stores tokens securely on your machine (`~/.config/opencode/`). No data is sent to third-party servers other than the quota providers themselves.
318
+
319
+ ## Development
320
+
321
+ Built with **Bun** for speed.
322
+
323
+ ```bash
324
+ bun install # Install dependencies
325
+ bun test # Run tests
326
+ OPENCODE_QUOTAS_E2E=1 bun test tests/integration/injection-e2e.test.ts # Run E2E injection test
327
+ npm run build # Build for production
328
+ bun run opencode-quotas # Run CLI in dev mode
329
+ ```
330
+
331
+ ## License
332
+
333
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bun
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,42 @@
1
+ #!/usr/bin/env bun
2
+ import { QuotaService } from "./services/quota-service";
3
+ import { HistoryService } from "./services/history-service";
4
+ import { renderQuotaTable } from "./ui/quota-table";
5
+ async function main() {
6
+ if (process.argv.includes("--no-color")) {
7
+ process.env.OPENCODE_QUOTAS_NO_COLOR = "1";
8
+ }
9
+ const historyService = new HistoryService();
10
+ await historyService.init();
11
+ const quotaService = new QuotaService();
12
+ await quotaService.init(process.cwd(), historyService);
13
+ const config = quotaService.getConfig();
14
+ // Parse arguments for provider and model filtering
15
+ let providerId;
16
+ let modelId;
17
+ const providerIdx = process.argv.indexOf("--provider");
18
+ if (providerIdx !== -1 && providerIdx + 1 < process.argv.length) {
19
+ providerId = process.argv[providerIdx + 1];
20
+ }
21
+ const modelIdx = process.argv.indexOf("--model");
22
+ if (modelIdx !== -1 && modelIdx + 1 < process.argv.length) {
23
+ modelId = process.argv[modelIdx + 1];
24
+ }
25
+ const filteredResults = await quotaService.getQuotas({ providerId, modelId });
26
+ if (filteredResults.length === 0) {
27
+ console.log("No active quotas found.");
28
+ return;
29
+ }
30
+ console.log(""); // Empty line
31
+ console.log("📊 OpenCode Quotas");
32
+ console.log("------------------");
33
+ renderQuotaTable(filteredResults, {
34
+ progressBarConfig: config.progressBar,
35
+ tableConfig: config.table,
36
+ }).forEach((row) => {
37
+ console.log(row.line);
38
+ });
39
+ console.log(""); // Empty line
40
+ }
41
+ main().catch(console.error);
42
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,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,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;QACvC,OAAO;IACX,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;IAC9B,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAClC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;IAElC,gBAAgB,CAAC,eAAe,EAAE;QAC9B,iBAAiB,EAAE,MAAM,CAAC,WAAW;QACrC,WAAW,EAAE,MAAM,CAAC,KAAK;KAC5B,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;QACf,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const PLUGIN_FOOTER_SIGNATURE = "_Opencode Quotas";
2
+ export declare const REASONING_PATTERNS: RegExp[];
3
+ export declare const DEBUG_LOG_FILENAME = "quotas-debug.log";
4
+ export declare const SKIP_REASONS: {
5
+ REASONING: string;
6
+ SUBAGENT: string;
7
+ FOOTER_PRESENT: string;
8
+ NON_TEXT_PART: string;
9
+ THINKING: string;
10
+ STOPPED: string;
11
+ NOT_COMPLETE: string;
12
+ };
13
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAG1D,eAAO,MAAM,kBAAkB,UAI9B,CAAC;AAGF,eAAO,MAAM,kBAAkB,qBAAqB,CAAC;AAErD,eAAO,MAAM,YAAY;;;;;;;;CAQxB,CAAC"}
@@ -0,0 +1,19 @@
1
+ export const PLUGIN_FOOTER_SIGNATURE = "_Opencode Quotas";
2
+ // Heuristic patterns for detecting reasoning/thinking blocks
3
+ export const REASONING_PATTERNS = [
4
+ /^<thinking>/i,
5
+ /^<antThinking>/i,
6
+ /^(Thinking|Reasoning|Analysis):\s*(\n|$)/i
7
+ ];
8
+ // File paths
9
+ export const DEBUG_LOG_FILENAME = "quotas-debug.log";
10
+ export const SKIP_REASONS = {
11
+ REASONING: "skip:reasoning",
12
+ SUBAGENT: "skip:subagent",
13
+ FOOTER_PRESENT: "skip:footer_present",
14
+ NON_TEXT_PART: "skip:non_text_part",
15
+ THINKING: "skip:thinking",
16
+ STOPPED: "skip:stopped",
17
+ NOT_COMPLETE: "skip:not_complete",
18
+ };
19
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,kBAAkB,CAAC;AAE1D,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,cAAc;IACd,iBAAiB;IACjB,2CAA2C;CAC9C,CAAC;AAEF,aAAa;AACb,MAAM,CAAC,MAAM,kBAAkB,GAAG,kBAAkB,CAAC;AAErD,MAAM,CAAC,MAAM,YAAY,GAAG;IACxB,SAAS,EAAE,gBAAgB;IAC3B,QAAQ,EAAE,eAAe;IACzB,cAAc,EAAE,qBAAqB;IACrC,aAAa,EAAE,oBAAoB;IACnC,QAAQ,EAAE,eAAe;IACzB,OAAO,EAAE,cAAc;IACvB,YAAY,EAAE,mBAAmB;CACpC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { type QuotaConfig } from "./interfaces";
2
+ export declare const DEFAULT_CONFIG: QuotaConfig;
3
+ //# sourceMappingURL=defaults.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.d.ts","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,cAAc,EAAE,WAqD5B,CAAC"}
@@ -0,0 +1,56 @@
1
+ // Default configuration for quota rendering and grouping
2
+ export const DEFAULT_CONFIG = {
3
+ displayMode: "simple",
4
+ footer: true,
5
+ showFooterTitle: true,
6
+ debug: false,
7
+ enableExperimentalGithub: false, // Set to true to enable experimental GitHub Copilot support
8
+ progressBar: {
9
+ color: false,
10
+ gradients: [
11
+ { threshold: 0.5, color: "green" },
12
+ { threshold: 0.8, color: "yellow" },
13
+ { threshold: 1.0, color: "red" },
14
+ ],
15
+ },
16
+ table: {
17
+ header: true,
18
+ },
19
+ filterByCurrentModel: false,
20
+ showUnaggregated: false,
21
+ predictionShortWindowMinutes: 5,
22
+ predictionWindowMinutes: 60,
23
+ aggregatedGroups: [
24
+ {
25
+ id: "ag-flash",
26
+ name: "Antigravity Flash",
27
+ patterns: ["flash", "-flash", "gemini-.*-flash"],
28
+ providerId: "antigravity",
29
+ strategy: "most_critical",
30
+ },
31
+ {
32
+ id: "ag-pro",
33
+ name: "Antigravity Pro",
34
+ patterns: ["pro", "gemini.*pro", "gemini-1.5-pro"],
35
+ providerId: "antigravity",
36
+ strategy: "most_critical",
37
+ },
38
+ {
39
+ id: "ag-premium",
40
+ name: "Antigravity Premium",
41
+ patterns: ["claude", "gpt", "o1"],
42
+ providerId: "antigravity",
43
+ strategy: "most_critical",
44
+ },
45
+ {
46
+ id: "codex-smart",
47
+ name: "Codex Usage",
48
+ sources: ["codex-primary", "codex-secondary"],
49
+ strategy: "most_critical",
50
+ },
51
+ ],
52
+ historyMaxAgeHours: 24,
53
+ historyResetThreshold: 20,
54
+ pollingInterval: 60_000,
55
+ };
56
+ //# sourceMappingURL=defaults.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaults.js","sourceRoot":"","sources":["../src/defaults.ts"],"names":[],"mappings":"AAEA,yDAAyD;A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C,QAAQ,EAAE,eAAe;SAC5B;KACJ;IACD,kBAAkB,EAAE,EAAE;IACtB,qBAAqB,EAAE,EAAE;IACzB,eAAe,EAAE,MAAM;CAC1B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Plugin } from "@opencode-ai/plugin";
2
+ /**
3
+ * QuotaHub Plugin for OpenCode.ai
4
+ */
5
+ export declare const QuotaHubPlugin: Plugin;
6
+ export default QuotaHubPlugin;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAoB,MAAM,qBAAqB,CAAC;AAmDpE;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,MA+gB5B,CAAC;AAEF,eAAe,cAAc,CAAC"}