Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
926e246
feat(usage): add server usage sync module for /zen/go/v1/usage
Fahad090NP Aug 12, 2026
93feb07
feat(usage): merge server-accurate meters into the tracker summary
Fahad090NP Aug 12, 2026
5edc094
feat(usage): wire server usage sync into activation and per-request r…
Fahad090NP Aug 12, 2026
0d32e26
test(usage): cover server usage mapper and failure classification
Fahad090NP Aug 12, 2026
f4cb6eb
docs(usage): document server-synced Go meters + changelog entry
Fahad090NP Aug 12, 2026
fd50f24
fix(usage): wire the Reset tracked data and Open console quick-pick a…
Fahad090NP Aug 12, 2026
0d46bce
fix(usage): keep the usage card after reset — zeroed local values
Fahad090NP Aug 12, 2026
17d90a7
fix(tooling): resolve always-true/false TS hints flagged in editor
Fahad090NP Aug 12, 2026
2a92daf
fix(usage): stable, consistently spaced usage card
Fahad090NP Aug 12, 2026
d74e77f
feat(usage): usage dialog as a clean 320px HTML card
Fahad090NP Aug 12, 2026
a2ad33d
style(usage): match the hover card to the usage panel design
Fahad090NP Aug 12, 2026
6fc76cf
revert(usage): restore previous hover card styling
Fahad090NP Aug 12, 2026
5b67cac
Merge remote-tracking branch 'upstream/main' into feat/issue-130-go-u…
Fahad090NP Aug 12, 2026
e7e0310
style(usage): uniform card padding in the usage panel
Fahad090NP Aug 12, 2026
a562879
style(usage): transparent hover card, tighter rows, aligned links
Fahad090NP Aug 12, 2026
a7280e5
chore(hooks): lint-staged runs check-only — never rewrites files
Fahad090NP Aug 12, 2026
54b5bcd
style(usage): restore the stats row gap, keep the transparent card
Fahad090NP Aug 12, 2026
7602d8e
style(usage): drop the hover's bottom action section
Fahad090NP Aug 12, 2026
c77d7f3
style(usage): always render all three stats rows in the hover card
Fahad090NP Aug 12, 2026
e82e55d
style(usage): center the usage panel card vertically too
Fahad090NP Aug 12, 2026
172c2e9
fix(usage): never report 'no data' when server meters exist
Fahad090NP Aug 12, 2026
98efb6b
fix(usage): dedupe concurrent server usage syncs
Fahad090NP Aug 12, 2026
0bff8b7
fix(usage): sync the active profile's meters with its own key
Fahad090NP Aug 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ if ! command -v npx >/dev/null 2>&1; then
fi

# Zero-tolerance gate on exactly what this change can affect: the staged
# files plus the files that import them (see scripts/staged-lint.ts). Runs
# BEFORE formatting so the linter sees the file as written. The full-tree
# lint (including tests) runs in CI and on demand via `npm run lint`.
# files plus the files that import them (see scripts/staged-lint.ts). All
# linters run in CHECK mode only — nothing is ever rewritten or renamed at
# commit time; a violation blocks the commit with an error and the user
# fixes it (or runs `npm run format` / `npm run lint:fix`) themselves.
npx tsx scripts/staged-lint.ts

# Format changed files (code + non-code) after linting passes.
npx lint-staged
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ All notable changes to the **OpenCode Go BYOK Provider** extension are documente

### Added

- _Nothing yet._
- **`[Usage]` Server-accurate Go meters via the official `/zen/go/v1/usage` endpoint (#130).** The status bar, tooltip, quick-pick and usage webview previously showed locally estimated Session/Weekly/Monthly percentages that drifted from opencode.ai (issue #23) because they missed CLI, cross-device and pre-install usage. The tracker now pulls the official endpoint (upstream anomalyco/opencode#16513, verified live) with the existing Go key on startup and after each request (60s TTL cache): rolling/weekly/monthly percent + reset times are server-computed and account-wide, `spent` is derived from the authoritative percent, and Today/Yesterday + per-session spend stay device-local. Failures (401/403/404/network) fall back to the existing SQLite → tracked estimates. The key is only ever sent as the Authorization header and never logged or persisted. New pure module `src/goUsageSync.ts` with unit tests.

## [0.5.2] — 2026-08-11

Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,14 @@ Per-model reasoning configuration, dynamically enhanced with `reasoning_options`

- **Go Usage Tracker** — real-time burn-rate of OpenCode Go subscription:
- Tracks **5-hour rolling** ($12), **weekly** ($30), **monthly** ($60) tiers.
- Client-side cost calc: token usage × per-model pricing (input/output/cache_read).
- **Server-synced meters** — on startup and after each request the tracker
pulls the official `/zen/go/v1/usage` endpoint with your Go key, so the
Session/Weekly/Monthly percentages and "resets in" timers are
account-wide and server-accurate (includes CLI, other devices, anything
before the extension was installed). Falls back to local estimates when
the endpoint is unreachable or the key/subscription is invalid.
- Today / Yesterday and per-session spend stay **device-local** (the API
does not return them).
- Status bar: `Go: 27%·62%·75%` — ⚠ warning when any tier exceeds 80%.
- Persisted in VS Code `globalState` — survives restarts.
- **Response usage bar** — latest prompt/output/total/cache summary after each response.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@
"prepare": "husky"
},
"lint-staged": {
"*": "prettier --write --ignore-unknown",
"*.{js,cjs,ts}": "eslint --fix --max-warnings 0",
"*.md": "markdownlint-cli2 --config .markdownlint-cli2.json --fix",
"*": "prettier --check --ignore-unknown",
"*.{js,cjs,ts}": "eslint --max-warnings 0",
"*.md": "markdownlint-cli2 --config .markdownlint-cli2.json",
".husky/*": "shellcheck"
},
"devDependencies": {
Expand Down
Loading
Loading