opencode-usage 0.5.8 → 0.5.10
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 +7 -2
- package/dist/commander/services/plugin-adapters.d.ts +0 -5
- package/dist/index.js +16 -2
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -74,11 +74,16 @@ opencode-usage --commander
|
|
|
74
74
|
opencode-usage --commander --commander-port 5000
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+

|
|
78
|
+
|
|
77
79
|
The Commander provides a single-page web UI with:
|
|
78
80
|
|
|
79
|
-
- **Quota Status** - Per-provider account usage with progress bars, thresholds, and stale detection
|
|
80
|
-
- **
|
|
81
|
+
- **Quota Status** - Per-provider account usage with progress bars, configurable thresholds, and stale detection
|
|
82
|
+
- **Multi-Account** - Full multi-account support for Anthropic and Gemini providers
|
|
83
|
+
- **Usage Breakdown** - Daily/monthly token usage table with cost estimates, provider filter, and date range
|
|
81
84
|
- **Account Management** - Add, switch, remove, and re-authenticate accounts
|
|
85
|
+
- **Plugins** - Extensible plugin system for custom providers and integrations
|
|
86
|
+
- **Configuration** - Customizable thresholds, display preferences, and provider settings
|
|
82
87
|
- **Ping** - Verify account connectivity with live PONG/FAIL indicators
|
|
83
88
|
- **Dark mode** toggle
|
|
84
89
|
- Auto-refresh every 5 minutes
|
|
@@ -4,9 +4,4 @@
|
|
|
4
4
|
* Each command is registered via `registerCommand` so the command-runner can
|
|
5
5
|
* execute them as background jobs.
|
|
6
6
|
*/
|
|
7
|
-
/**
|
|
8
|
-
* Proactively refresh Codex tokens that haven't been refreshed in 24+ hours.
|
|
9
|
-
* Keeps tokens fresh so they never silently expire.
|
|
10
|
-
* Safe to call frequently — skips accounts refreshed recently.
|
|
11
|
-
*/
|
|
12
7
|
export declare function proactiveRefreshCodexTokens(): Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -415,6 +415,16 @@ async function refreshSingleCodexToken(alias, account, storePath) {
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
async function proactiveRefreshCodexTokens() {
|
|
418
|
+
if (_proactiveRefreshRunning)
|
|
419
|
+
return;
|
|
420
|
+
_proactiveRefreshRunning = true;
|
|
421
|
+
try {
|
|
422
|
+
await _proactiveRefreshCodexTokensInner();
|
|
423
|
+
} finally {
|
|
424
|
+
_proactiveRefreshRunning = false;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
async function _proactiveRefreshCodexTokensInner() {
|
|
418
428
|
const STORE_PATHS = [
|
|
419
429
|
join8(homedir6(), ".config", "opencode", "codex-multi-account-accounts.json"),
|
|
420
430
|
join8(homedir6(), ".config", "opencode", "codex-multi-accounts.json"),
|
|
@@ -437,6 +447,10 @@ async function proactiveRefreshCodexTokens() {
|
|
|
437
447
|
const now = Date.now();
|
|
438
448
|
let refreshed = 0;
|
|
439
449
|
for (const [alias, account] of Object.entries(accounts)) {
|
|
450
|
+
if (account.authInvalid === true) {
|
|
451
|
+
console.log(`[proactiveRefresh] ${alias}: authInvalid, skipping (needs reauth)`);
|
|
452
|
+
continue;
|
|
453
|
+
}
|
|
440
454
|
const expiresAt = typeof account.expiresAt === "number" ? account.expiresAt : 0;
|
|
441
455
|
const lastRefresh = typeof account.lastRefresh === "string" ? new Date(account.lastRefresh).getTime() : 0;
|
|
442
456
|
const timeSinceRefresh = now - lastRefresh;
|
|
@@ -619,7 +633,7 @@ function reauthCliCommand(provider) {
|
|
|
619
633
|
throw new Error(`Re-auth not supported for provider: ${provider}`);
|
|
620
634
|
return cmd;
|
|
621
635
|
}
|
|
622
|
-
var isBun4, PROVIDER_SOURCE, CODEX_TOKEN_URL = "https://auth.openai.com/oauth/token", CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann", REFRESH_COOLDOWN_MS, bunxQueue, REAUTH_PROVIDERS;
|
|
636
|
+
var isBun4, PROVIDER_SOURCE, CODEX_TOKEN_URL = "https://auth.openai.com/oauth/token", CODEX_CLIENT_ID = "app_EMoamEEZ73f0CkXaXp7hrann", REFRESH_COOLDOWN_MS, _proactiveRefreshRunning = false, bunxQueue, REAUTH_PROVIDERS;
|
|
623
637
|
var init_plugin_adapters = __esm(() => {
|
|
624
638
|
init_command_runner();
|
|
625
639
|
init_config_service();
|
|
@@ -31158,4 +31172,4 @@ async function main2() {
|
|
|
31158
31172
|
var WATCH_INTERVAL_MS = 5 * 60 * 1000;
|
|
31159
31173
|
main2().catch(console.error);
|
|
31160
31174
|
|
|
31161
|
-
//# debugId=
|
|
31175
|
+
//# debugId=8161BB1074E571D664756E2164756E21
|