Skip to content

Commit b33e3f9

Browse files
committed
docs: document UBB support and pooled exhaustion state
- README: mention auto-adapt to billing mode in the tagline; tooltip bullet describes title switch; status-bar table adds the `100%` red pooled-exhaustion row. - CHANGELOG: 0.5.0 entry covering UBB title switch, new plans, reset priority, precise `used` via quota_remaining, pooled exhaustion, and the entitlement parse change. - DEVELOPMENT: add an "Upstream Reference (vscode)" section pointing at parseQuotas, the dashboard, defaultAccount, and their tests, so future field-shape audits know where to diff.
1 parent 64f3ce4 commit b33e3f9

3 files changed

Lines changed: 45 additions & 15 deletions

File tree

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
## [0.5.0] - 2026-05-27
8+
9+
### Added
10+
11+
- **Token-based billing (UBB) support**: auto-detects GitHub's new credit-based billing mode via the `token_based_billing` field. The tooltip title switches between **Copilot Premium Requests** (legacy) and **Copilot Credits** (UBB), so the count line stays a familiar `Used: 90 / 300 (30%)`. Overage line still labels its unit (`Overage: 5 requests` vs `Additional credits: 5`).
12+
- **`individual_max` (Max) and `individual_edu` (Student) plans** in the plan-name map.
13+
- **Per-snapshot `quota_reset_at`** (Unix seconds) read with top priority under UBB; falls back to `quota_reset_date_utc` then `quota_reset_date`. Shared by all return paths so pooled-exhausted users still see real reset times.
14+
- **Precise `used` calculation** via `quota_remaining` when present (avoids float precision loss from percentage-based reverse calculation).
15+
- **Pooled entitlement exhaustion**: enterprise unlimited plans signaling `has_quota=false` (without overage) now display `100%` red instead of misleadingly showing ``. Tooltip surfaces "Quota: Unlimited · pool exhausted" with the reset date.
16+
17+
### Changed
18+
19+
- `entitlement` parse handles string values (`'300'`) emitted under UBB; `entitlement: '0'` (not unlimited) now correctly routes to the no-data state, matching upstream `parseQuotas` behavior. Missing `entitlement` (`undefined`) is preserved as a distinct case and stays on the normal path.
20+
721
## [0.4.4] - 2026-04-30
822

923
### Changed

DEVELOPMENT.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,18 @@ Tests mock `fetch` globally — no network calls are made.
6666
- **Auth**: VS Code `authentication.getSession('github', ...)` — uses the user's existing GitHub session; cancellation handled gracefully via inner try/catch
6767
- **Auto-refresh**: Configurable interval (1–60 min, default 5 min) via `githubCopilotUsage.refreshIntervalMinutes`
6868
- **Status bar position**: Priority `100.099999` — places the indicator just to the right of the Copilot icon (`chat.statusBarEntry` at `100.1`)
69+
70+
### Upstream Reference (vscode)
71+
72+
This extension parses the same `copilot_internal/user` payload the VS Code Copilot UI consumes. When the API or field semantics change, these are the upstream files worth diffing — clone [microsoft/vscode](https://github.com/microsoft/vscode) alongside this repo and check them periodically.
73+
74+
| Path | What to watch for |
75+
| -------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
76+
| `src/vs/workbench/services/chat/common/chatEntitlementService.ts` | `parseQuotas` — source of truth for field priority, types, and edge cases (entitlement string→number, `quota_reset_at`, Free CFI shape, etc.). |
77+
| `src/vs/workbench/contrib/chat/test/common/chatEntitlementService.test.ts` | Upstream test cases for `parseQuotas` — the canonical fixture set; new payload shapes usually land here first. |
78+
| `src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.ts` | How the dashboard renders unlimited / pooled-exhausted / overage / UBB states — useful when deciding what our single-value status bar shows. |
79+
| `src/vs/workbench/contrib/chat/test/browser/chatStatusDashboard.test.ts` | Dashboard render expectations — mirrors what end users see in VS Code. |
80+
| `src/vs/platform/defaultAccount/common/defaultAccount.ts` | `IDefaultAccount` field types — confirms shape of `chat_*`, `quota_*`, and `token_based_billing` flags. |
81+
| `src/vs/base/common/defaultAccount.ts` | Plan ID enum (`free` / `individual` / `individual_pro` / `individual_max` / `individual_edu` / `business` / `enterprise`) — keep `PLAN_MAP` in [src/api.js](src/api.js) in sync. |
82+
83+
Quick check: `git -C ../vscode log --since=<last-check> -- src/vs/workbench/services/chat/common/chatEntitlementService.ts src/vs/platform/defaultAccount/common/defaultAccount.ts` surfaces relevant changes without scanning the whole tree.

README.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# GitHub Copilot Usage
22

33
<div>
4-
<p>Shows Copilot Premium request quota usage in the VS Code status bar, right next to the Copilot icon.</p>
4+
<p>Shows Copilot Premium request / Credit usage in the VS Code status bar, right next to the Copilot icon. Adapts to legacy or token-based billing.</p>
55
<p>e.g., <code>25%</code> normal · <code>75%</code> yellow warning · <code>95%</code> red critical.</p>
66
</div>
77

@@ -10,7 +10,7 @@
1010
## Features
1111

1212
- **Status bar**: shows used percentage (`15%`), turns yellow/red near threshold
13-
- **Hover tooltip**: plan, used / quota, overage (if any), reset date, last-updated timestamp — with a refresh button and a link to [Premium request analytics](https://github.com/settings/billing/premium_requests_usage)
13+
- **Hover tooltip**: titled **Copilot Premium Requests** or **Copilot Credits** depending on the billing mode; shows plan, `Used: X / Y (Z%)`, overage, reset date, last-updated timestamp — with refresh button and link to [Premium request analytics](https://github.com/settings/billing/premium_requests_usage)
1414
- **Auto-refresh**: configurable interval (default 5 min)
1515
- **Zero config**: uses your existing VS Code GitHub account sign-in
1616

@@ -22,19 +22,20 @@
2222

2323
## Status bar states
2424

25-
| Display | Meaning |
26-
| -------------- | -------------------------------------------------- |
27-
| `25%` | Normal usage |
28-
| `75%` (yellow) | Warning threshold reached |
29-
| `90%` (red) | Critical threshold reached |
30-
| `111%` (red) | Overage — actual usage exceeds |
31-
| `` | Unlimited plan |
32-
| `` | No premium quota data (plan has no tracked limit) |
33-
| `` | Loading |
34-
| `` | Server error or access denied |
35-
| `` | Offline or rate limited — no cached data available |
36-
| `25% ⚠` | Last known data — offline for > 1 hour |
37-
| `Sign in` | Not signed in — click to sign in |
25+
| Display | Meaning |
26+
| -------------- | --------------------------------------------------------------- |
27+
| `25%` | Normal usage |
28+
| `75%` (yellow) | Warning threshold reached |
29+
| `90%` (red) | Critical threshold reached |
30+
| `100%` (red) | Pooled entitlement exhausted (enterprise unlimited, no overage) |
31+
| `111%` (red) | Overage — actual usage exceeds |
32+
| `` | Unlimited plan |
33+
| `` | No premium quota data (plan has no tracked limit) |
34+
| `` | Loading |
35+
| `` | Server error or access denied |
36+
| `` | Offline or rate limited — no cached data available |
37+
| `25% ⚠` | Last known data — offline for > 1 hour |
38+
| `Sign in` | Not signed in — click to sign in |
3839

3940
## You may also like
4041

0 commit comments

Comments
 (0)