opencode-copilot-usage-detector 0.1.3 → 0.1.4
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/CHANGELOG.md +15 -0
- package/README.md +27 -17
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.4 (2026-03-21)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
- Toast notifications — rate limit, model blocked, and budget threshold alerts now use non-intrusive TUI toasts instead of conversation messages
|
|
7
|
+
- Subagent session skip — system prompt injection is suppressed for subagent sessions (saves tokens)
|
|
8
|
+
- Config validation — validates types on startup, warns on unknown keys, falls back to defaults for invalid values
|
|
9
|
+
- `/budget clean fake_hits` — removes limit_hit entries from models with no usage (blocked models misrecorded as rate limits)
|
|
10
|
+
- Retroactive blocked detection — old limit_hit entries from models with no usage are rerouted to blocked models on recovery
|
|
11
|
+
|
|
12
|
+
### Improvements
|
|
13
|
+
- Extract `handled()` sentinel helper (ecosystem standard pattern from opencode-quota/DCP)
|
|
14
|
+
- Add `predicate` filter support to `removeObservations()`
|
|
15
|
+
- Add `exports` and `engines` fields to package.json
|
|
16
|
+
- Subagent detection result is cached per session (avoids repeated API calls)
|
|
17
|
+
|
|
3
18
|
## 0.1.1 (2026-03-21)
|
|
4
19
|
|
|
5
20
|
### Features
|
package/README.md
CHANGED
|
@@ -23,10 +23,13 @@ This plugin learns these limits from your own usage patterns and warns you as yo
|
|
|
23
23
|
- **Token & request tracking** — Per-day, per-model usage with RPM monitoring
|
|
24
24
|
- **Adaptive limit learning** — Weighted averages with exponential recency decay and confidence scoring
|
|
25
25
|
- **Multi-dimensional hypothesis tracking** — Learns whether limits are token-based, request-based, or RPM-based
|
|
26
|
+
- **Blocked model detection** — Identifies models not available on your plan (403, access denied, etc.) and separates them from real rate limits
|
|
26
27
|
- **Preview model detection** — Automatically identifies models with separate, stricter limits
|
|
27
28
|
- **Rate-limit classification** — 5-stage classifier distinguishing burst, preview, and daily limits
|
|
28
|
-
- **
|
|
29
|
+
- **Toast notifications** — Non-intrusive TUI toasts for rate limits, blocked models, and budget thresholds (doesn't pollute conversation)
|
|
30
|
+
- **System prompt injection** — Budget status in every LLM context (zero tool-call overhead, skipped for subagent sessions)
|
|
29
31
|
- **Threshold notifications** — Configurable alerts at 60%, 80%, 95% of estimated limits
|
|
32
|
+
- **Config validation** — Validates config types on startup, warns on unknown keys
|
|
30
33
|
- **Temporal patterns** — Learns what time of day you typically hit limits and how model choice affects runway
|
|
31
34
|
- **Model fallback detection** — Detects when Copilot silently downgrades your model
|
|
32
35
|
- **GitHub billing API integration** — Fetches real premium request usage when auth is available
|
|
@@ -96,6 +99,19 @@ The plugin works automatically -- no action needed. It:
|
|
|
96
99
|
| `/budget insights` | Learned patterns, limit estimates, temporal analysis |
|
|
97
100
|
| `/budget errors` | Rate limit events and error catalog |
|
|
98
101
|
| `/budget recompute` | Force recompute all estimates from observations |
|
|
102
|
+
| `/budget reset` | Wipe today's data and start fresh |
|
|
103
|
+
| `/budget clean [target]` | Remove specific entries from the observation log |
|
|
104
|
+
|
|
105
|
+
#### Clean targets
|
|
106
|
+
|
|
107
|
+
| Target | Description |
|
|
108
|
+
|--------|-------------|
|
|
109
|
+
| `errors` | Remove all logged errors |
|
|
110
|
+
| `blocked` | Remove all blocked model entries |
|
|
111
|
+
| `limit_hits` | Remove all rate limit entries |
|
|
112
|
+
| `fake_hits` | Remove limit_hits from models with no usage (misrecorded blocked models) |
|
|
113
|
+
| `model <name>` | Remove all entries for a specific model |
|
|
114
|
+
| `before <date>` | Remove entries before a date (YYYY-MM-DD) |
|
|
99
115
|
|
|
100
116
|
### Example: `/budget status`
|
|
101
117
|
|
|
@@ -144,21 +160,13 @@ Model breakdown:
|
|
|
144
160
|
</copilot-budget>
|
|
145
161
|
```
|
|
146
162
|
|
|
147
|
-
###
|
|
148
|
-
|
|
149
|
-
When approaching a learned limit, you'll see a chat message like:
|
|
150
|
-
|
|
151
|
-
```
|
|
152
|
-
⚡ 80% of daily Copilot budget used (2.3M / ~2.9M est.)
|
|
153
|
-
```
|
|
163
|
+
### Toast Notifications
|
|
154
164
|
|
|
155
|
-
|
|
165
|
+
Alerts appear as non-intrusive TUI toasts that don't pollute the conversation:
|
|
156
166
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
Run `/budget errors` for details.
|
|
161
|
-
```
|
|
167
|
+
- **Budget warning** — `80% of daily budget used (2.3M / ~2.9M est.)`
|
|
168
|
+
- **Rate limited** — `2.8M tokens, 142 req | claude-opus-4.5 | hard_daily_limit`
|
|
169
|
+
- **Model blocked** — `claude-opus-4.6 is not available on your plan (status: 403)`
|
|
162
170
|
|
|
163
171
|
### Example: `/budget insights`
|
|
164
172
|
|
|
@@ -259,10 +267,12 @@ The JSONL file auto-rotates at 50MB or when entries are older than 90 days. No d
|
|
|
259
267
|
```
|
|
260
268
|
Plugin Entry (copilot-budget.ts)
|
|
261
269
|
+-- Config Hook (registers /budget command)
|
|
262
|
-
+-- Command Handler (/budget subcommands)
|
|
270
|
+
+-- Command Handler (/budget subcommands, sentinel pattern)
|
|
263
271
|
+-- Event Handler (message.updated, session.error)
|
|
272
|
+
+-- Blocked Model Detection (early filter before rate-limit path)
|
|
273
|
+
+-- Toast Notifications (rate limit, blocked, threshold)
|
|
264
274
|
+-- chat.params Hook (per-session model/provider capture)
|
|
265
|
-
+-- System Prompt Injection
|
|
275
|
+
+-- System Prompt Injection (skipped for subagents)
|
|
266
276
|
+-- Session Compaction Context
|
|
267
277
|
+-- Budget Tool (for LLM tool-calling)
|
|
268
278
|
|
|
@@ -298,7 +308,7 @@ Persistence (persistence.ts)
|
|
|
298
308
|
+-- JSONL append + filtered read
|
|
299
309
|
+-- Atomic rotation (size/age)
|
|
300
310
|
+-- Estimates read/write
|
|
301
|
-
+-- Config management
|
|
311
|
+
+-- Config management + validation
|
|
302
312
|
```
|
|
303
313
|
|
|
304
314
|
## Development
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-copilot-usage-detector",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin that tracks GitHub Copilot token usage, learns rate limits empirically, and proactively informs the user",
|
|
6
6
|
"main": "./dist/copilot-budget.js",
|