@narumitw/pi-usage 0.51.0 β†’ 0.52.1

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 CHANGED
@@ -40,6 +40,10 @@ Try this package locally from the repository root:
40
40
  pi -e ./packages/pi-usage
41
41
  ```
42
42
 
43
+ The package declares `dist/index.ts`, so an unbuilt local checkout must run `npm --workspace @narumitw/pi-usage run build` before Pi loads the package directory.
44
+
45
+ `just try usage` runs that build automatically.
46
+
43
47
  ## πŸš€ Usage
44
48
 
45
49
  Run:
@@ -134,6 +138,16 @@ GitHub's quota endpoint requires the original GitHub OAuth token rather than the
134
138
 
135
139
  The extension does not call OpenRouter's account-level `/credits` endpoint because that operation requires a separate management key. OpenRouter documents the distinction between credit and rate limits in its [API limits guide](https://openrouter.ai/docs/api_reference/limits).
136
140
 
141
+ ### OpenCode Go (Zen)
142
+
143
+ - Provider ID: `opencode-go`
144
+ - Semantics: OpenCode Zen plan usage windowsβ€”rolling, weekly, and monthly
145
+ - Source: `GET {model base URL}/usage` on the configured `opencode.ai` gateway using Pi's resolved inference API key
146
+ - Displayed data: used percentage and reset time for each window; `rate-limited` windows remain visible at their reported usage, while unknown statuses are reported as unavailable notes
147
+ - Statusline examples: `zen 0% r 4% w 2% m`
148
+
149
+ The usage endpoint is derived from the model's base URL (`…/zen/go/v1/usage`) and is only queried when the resolved origin is `https://opencode.ai`; other origins fail before sending the credential.
150
+
137
151
  ## 🧭 Current and configured accounts
138
152
 
139
153
  `Current` means the provider and credential used by Pi's selected model. `Configured` means Pi reports runtime auth for another supported provider; it does not mean that provider is active.
@@ -181,6 +195,9 @@ Behavior changes:
181
195
 
182
196
  ```txt
183
197
  packages/pi-usage/
198
+ β”œβ”€β”€ dist/ # Generated TypeScript runtime loaded by Jiti
199
+ β”œβ”€β”€ scripts/
200
+ β”‚ └── build-runtime.mjs # Deterministic runtime builder and boundary validator
184
201
  β”œβ”€β”€ src/
185
202
  β”‚ β”œβ”€β”€ index.ts # Pi package entrypoint and helper export barrel
186
203
  β”‚ β”œβ”€β”€ usage.ts # Menu, cache, and usage lifecycle orchestration
@@ -203,6 +220,8 @@ packages/pi-usage/
203
220
 
204
221
  `index.ts` is the Pi entrypoint and forwards the default factory from `usage.ts` while retaining the package's named helper exports; other source modules are internal.
205
222
 
223
+ The generated runtime is built from the authoritative `src/index.ts` graph and does not import back into `src`.
224
+
206
225
  ## πŸ”Ž Keywords
207
226
 
208
227
  Pi extension, Pi coding agent, usage, quota, OpenAI Codex usage, ChatGPT subscription limits, GitHub Copilot AI credits, GitHub Copilot premium requests, OpenRouter credits, API-key spend limits, TypeScript Pi package, npm Pi extension.