quota-axi 0.1.7 → 0.1.9
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 +45 -31
- package/dist/src/args.js +1 -1
- package/dist/src/args.js.map +1 -1
- package/dist/src/cache.d.ts +1 -0
- package/dist/src/cache.js +10 -1
- package/dist/src/cache.js.map +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +3 -20
- package/dist/src/cli.js.map +1 -1
- package/dist/src/providers/grok.d.ts +6 -6
- package/dist/src/providers/grok.js +354 -182
- package/dist/src/providers/grok.js.map +1 -1
- package/dist/src/providers/index.js +2 -0
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/kimi.d.ts +26 -0
- package/dist/src/providers/kimi.js +678 -0
- package/dist/src/providers/kimi.js.map +1 -0
- package/dist/src/providers/pi-kimi-credential.d.ts +37 -0
- package/dist/src/providers/pi-kimi-credential.js +48 -0
- package/dist/src/providers/pi-kimi-credential.js.map +1 -0
- package/dist/src/skill.js +4 -3
- package/dist/src/skill.js.map +1 -1
- package/dist/src/types.d.ts +2 -2
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/version.d.ts +1 -0
- package/dist/src/version.js +19 -0
- package/dist/src/version.js.map +1 -0
- package/package.json +6 -4
- package/skills/quota-axi/SKILL.md +6 -6
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ Quota CLI for agents - designed with [AXI](https://axi.md) (Agent eXperience Int
|
|
|
15
15
|
Agents need quota state before they choose where work can safely run.
|
|
16
16
|
Vendor dashboards are not shaped for shell automation, and local CLIs expose different windows, resets, and auth sources.
|
|
17
17
|
|
|
18
|
-
quota-axi reports local Claude, Codex, Cursor, GitHub Copilot, and
|
|
18
|
+
quota-axi reports local Claude, Codex, Cursor, GitHub Copilot, Grok, and Kimi quota windows in one [AXI](https://axi.md)-shaped call.
|
|
19
19
|
It is data only: it never routes, recommends, proxies, intercepts, logs in, imports browser cookies, or mutates provider state.
|
|
20
20
|
|
|
21
21
|
- **Official sources** - quota-axi reads local provider auth sources and calls the first-party quota, usage, billing, or entitlement endpoints used by the local agents, with a read-only Codex app-server probe as fallback.
|
|
@@ -35,13 +35,14 @@ $ npx -y quota-axi
|
|
|
35
35
|
bin: ~/.npm/_npx/.../quota-axi
|
|
36
36
|
description: Report local agent-provider quota windows for routing-aware agents
|
|
37
37
|
generatedAt: "2026-03-15T16:42:00.000Z"
|
|
38
|
-
providers[
|
|
38
|
+
providers[6]{provider,plan,source,status,refreshedAt}:
|
|
39
39
|
claude,pro,oauth,fresh,"2026-03-15T16:41:55.000Z"
|
|
40
40
|
codex,plus,cli-rpc,fresh,"2026-03-15T16:41:58.000Z"
|
|
41
41
|
cursor,pro,api,fresh,"2026-03-15T16:41:59.000Z"
|
|
42
42
|
copilot,individual,api,fresh,"2026-03-15T16:42:00.000Z"
|
|
43
|
-
grok,
|
|
44
|
-
|
|
43
|
+
grok,unknown,web,fresh,"2026-03-15T16:42:00.000Z"
|
|
44
|
+
kimi,unknown,api,fresh,"2026-03-15T16:42:00.000Z"
|
|
45
|
+
windows[15]{provider,id,label,percentRemaining,resetsAt,state}:
|
|
45
46
|
claude,five_hour,session,82,"2026-03-15T21:15:00.000Z",fresh
|
|
46
47
|
claude,seven_day,week,64,"2026-03-19T15:00:00.000Z",fresh
|
|
47
48
|
claude,seven_day_opus,opus week,93,"2026-03-20T09:30:00.000Z",fresh
|
|
@@ -55,6 +56,8 @@ windows[13]{provider,id,label,percentRemaining,resetsAt,state}:
|
|
|
55
56
|
copilot,chat,chat,84,"2026-04-01T00:00:00.000Z",fresh
|
|
56
57
|
copilot,premium_interactions,premium interactions,53,"2026-04-01T00:00:00.000Z",fresh
|
|
57
58
|
grok,credits,credits,67,"2026-04-01T00:00:00.000Z",fresh
|
|
59
|
+
kimi,weekly,week,74,"2026-03-19T09:00:00.000Z",fresh
|
|
60
|
+
kimi,five_hour,session,88,"2026-03-15T21:42:00.000Z",fresh
|
|
58
61
|
help[3]:
|
|
59
62
|
Run `quota-axi --provider claude --json` for JSON output
|
|
60
63
|
Run `quota-axi --full` to include account and source-attempt details
|
|
@@ -107,7 +110,7 @@ $ quota-axi --provider claude --json
|
|
|
107
110
|
$ quota-axi auth
|
|
108
111
|
bin: ~/.npm/_npx/.../quota-axi
|
|
109
112
|
description: Inspect local quota auth sources without printing secret values
|
|
110
|
-
auth[
|
|
113
|
+
auth[8]{provider,source,path,status,error}:
|
|
111
114
|
claude,oauth-file,~/.claude/.credentials.json,available,none
|
|
112
115
|
claude,keychain,none,skipped,keychain_prompt_required
|
|
113
116
|
codex,auth-json,~/.codex/auth.json,available,none
|
|
@@ -115,13 +118,14 @@ auth[7]{provider,source,path,status,error}:
|
|
|
115
118
|
cursor,state-vscdb,~/Library/Application Support/Cursor/User/globalStorage/state.vscdb,available,none
|
|
116
119
|
copilot,apps-json,~/.config/github-copilot/apps.json,available,none
|
|
117
120
|
grok,auth-json,~/.grok/auth.json,available,none
|
|
121
|
+
kimi,pi:kimi-coding,none,available,none
|
|
118
122
|
help[1]:
|
|
119
123
|
Run `quota-axi --allow-keychain-prompt auth` to permit macOS Keychain access
|
|
120
124
|
```
|
|
121
125
|
|
|
122
126
|
## Install
|
|
123
127
|
|
|
124
|
-
quota-axi requires Node.js
|
|
128
|
+
quota-axi requires Node.js 22.19 or newer.
|
|
125
129
|
|
|
126
130
|
**Agent skill (recommended)**
|
|
127
131
|
|
|
@@ -204,14 +208,14 @@ It is generated from `src/skill.ts`; update it with `pnpm run build:skill` and v
|
|
|
204
208
|
|
|
205
209
|
### Flags
|
|
206
210
|
|
|
207
|
-
| Flag
|
|
208
|
-
|
|
|
209
|
-
| `--provider claude,codex,cursor,copilot,grok` | Scope providers |
|
|
210
|
-
| `--json`
|
|
211
|
-
| `--full`
|
|
212
|
-
| `--allow-keychain-prompt`
|
|
213
|
-
| `-h`, `--help`
|
|
214
|
-
| `-v`, `-V`, `--version`
|
|
211
|
+
| Flag | Description |
|
|
212
|
+
| -------------------------------------------------- | ------------------------------------------------------ |
|
|
213
|
+
| `--provider claude,codex,cursor,copilot,grok,kimi` | Scope providers |
|
|
214
|
+
| `--json` | Emit normalized JSON instead of TOON for quota or auth |
|
|
215
|
+
| `--full` | Include quota account identity and source attempts |
|
|
216
|
+
| `--allow-keychain-prompt` | Permit macOS Claude Keychain access that could prompt |
|
|
217
|
+
| `-h`, `--help` | Print terse [AXI](https://axi.md) help |
|
|
218
|
+
| `-v`, `-V`, `--version` | Print version |
|
|
215
219
|
|
|
216
220
|
## Output Model
|
|
217
221
|
|
|
@@ -258,7 +262,7 @@ Default TOON output includes the same condition in an `advice` block with `provi
|
|
|
258
262
|
| -------------------------------- | ---------------------------------------------------------------------------- |
|
|
259
263
|
| Provider statuses | `fresh`, `stale`, `unavailable`, `auth_required`, `rate_limited`, or `error` |
|
|
260
264
|
| Provider sources | `oauth`, `cli-rpc`, `api`, `web`, `cache`, or `unavailable` |
|
|
261
|
-
| Current provider adapter sources | `oauth`, `cli-rpc`, `api`, `cache`, and `unavailable`
|
|
265
|
+
| Current provider adapter sources | `oauth`, `cli-rpc`, `api`, `web`, `cache`, and `unavailable` |
|
|
262
266
|
| Window kinds | `session`, `weekly`, `monthly`, `model`, `credits`, or `unknown` |
|
|
263
267
|
| Source attempt statuses | `success`, `failed`, or `skipped` |
|
|
264
268
|
|
|
@@ -266,15 +270,16 @@ Source attempts can include `credentialPresent` when a non-secret probe confirms
|
|
|
266
270
|
|
|
267
271
|
### Provider windows
|
|
268
272
|
|
|
269
|
-
| Provider
|
|
270
|
-
|
|
|
271
|
-
| Claude
|
|
272
|
-
| Claude scoped `limits`
|
|
273
|
-
| Codex
|
|
274
|
-
| Cursor
|
|
275
|
-
| GitHub Copilot
|
|
276
|
-
| Grok
|
|
277
|
-
| Grok
|
|
273
|
+
| Provider | Windows and capabilities |
|
|
274
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
275
|
+
| Claude | Can report `five_hour`, `seven_day`, optional `seven_day_opus`, and optional `extra_usage` windows. |
|
|
276
|
+
| Claude scoped `limits` | When the account's usage response includes a scoped `limits` list, quota-axi surfaces every active window it describes instead, including model-scoped ones (e.g. Fable) as a `model:<slug>` window. |
|
|
277
|
+
| Codex | Can report `five_hour` and `weekly` windows plus optional credit balance data, plus any additional model- or feature-scoped rate limits the account has as `model:<id>:5h` / `model:<id>:7d` windows, and an optional code-review rate limit as `code_review_five_hour` / `code_review_weekly`. |
|
|
278
|
+
| Cursor | Can report `included_usage`, `auto_usage`, `api_usage`, and optional `spend_limit` windows. |
|
|
279
|
+
| GitHub Copilot | Can report quota snapshot windows such as `chat`, `completions`, and `premium_interactions`; when the first-party endpoint exposes entitlement but no numeric quota windows, quota-axi reports a fresh provider state with an empty `windows` list rather than inventing percentages. |
|
|
280
|
+
| Grok | Reports the shared `credits` window, optional product-scoped `product:<slug>` windows, the current-period reset, and optional prepaid credit balance from the consumer Usage-page operation. |
|
|
281
|
+
| Grok proto3 zero | For the exact consumer operation only, an omitted usage float is the official proto3 zero when a valid weekly or monthly current period proves the config is present; quota-axi reports `0` used and `100` remaining rather than deriving usage from money. |
|
|
282
|
+
| Kimi | Reports the principal `weekly` subscription window plus every valid self-described limit in wire order. Only a limit whose normalized duration is exactly 18,000 seconds is identified as `five_hour`; future limits remain `limit:<index>` unknown windows. |
|
|
278
283
|
|
|
279
284
|
### `auth --json` shape
|
|
280
285
|
|
|
@@ -286,10 +291,10 @@ Source attempts can include `credentialPresent` when a non-secret probe confirms
|
|
|
286
291
|
|
|
287
292
|
Auth source entries can include `credentialPresent` when a non-secret probe confirms a credential item exists.
|
|
288
293
|
|
|
289
|
-
| Name | Values
|
|
290
|
-
| -------------------- |
|
|
291
|
-
| Auth source statuses | `available`, `missing`, `invalid`, `expired`, or `skipped`
|
|
292
|
-
| Auth source names | `oauth-file`, `keychain`, `auth-json`, `auth-env`, `apps-json`, `state-vscdb`,
|
|
294
|
+
| Name | Values |
|
|
295
|
+
| -------------------- | -------------------------------------------------------------------------------------------------------------- |
|
|
296
|
+
| Auth source statuses | `available`, `missing`, `invalid`, `expired`, or `skipped` |
|
|
297
|
+
| Auth source names | `oauth-file`, `keychain`, `auth-json`, `auth-env`, `apps-json`, `state-vscdb`, `cli-rpc`, and `pi:kimi-coding` |
|
|
293
298
|
|
|
294
299
|
## Security Posture
|
|
295
300
|
|
|
@@ -302,6 +307,7 @@ Auth source entries can include `credentialPresent` when a non-secret probe conf
|
|
|
302
307
|
| Cursor | `$CURSOR_STATE_DB` when set or the platform Cursor state database path |
|
|
303
308
|
| GitHub Copilot | `$GITHUB_COPILOT_APPS_JSON` when set or the local Copilot apps auth file |
|
|
304
309
|
| Grok | `$GROK_AUTH_JSON`, inline `$GROK_AUTH`, `$GROK_AUTH_PATH`, or `$GROK_HOME/auth.json` / `~/.grok/auth.json` |
|
|
310
|
+
| Kimi | Pi's supported credential API for the exact `kimi-coding` provider; quota-axi never accepts an auth path or reads Pi credential files or environment variables directly |
|
|
305
311
|
|
|
306
312
|
### Provider notes
|
|
307
313
|
|
|
@@ -330,9 +336,16 @@ Auth source entries can include `credentialPresent` when a non-secret probe conf
|
|
|
330
336
|
|
|
331
337
|
**Grok**
|
|
332
338
|
|
|
333
|
-
- It selects session-scoped auth instead of API-key entries and
|
|
339
|
+
- It selects session-scoped auth instead of API-key entries and sends a read-only gRPC-web request to Grok's consumer `grok_api_v2.GrokBuildBilling.GetGrokCreditsConfig` operation.
|
|
334
340
|
- Session-scoped Grok auth includes web/session scopes and OIDC records scoped to `auth.x.ai` with `auth_mode` or `authMode` set to `oidc`, including scope keys with `::<client id>` suffixes.
|
|
335
|
-
- It
|
|
341
|
+
- It does not send browser cookies, launch the Grok CLI, refresh credentials, perform OAuth, retain raw response bodies, or derive usage from monetary fields.
|
|
342
|
+
|
|
343
|
+
**Kimi**
|
|
344
|
+
|
|
345
|
+
- It asks Pi's supported credential API to resolve only `kimi-coding`, rejects stored non-API-key credential types before resolution, and ignores any resolver-provided origin or headers.
|
|
346
|
+
- It sends one redirect-disabled `GET` to the fixed `https://api.kimi.com/coding/v1/usages` endpoint with a 15 second total deadline and a 262,144-byte decoded-body cap.
|
|
347
|
+
- It never launches Pi or Kimi, makes a model request, refreshes credentials, imports cookies, sends device identity, retains raw responses, or exposes account, plan, token, or fingerprint data.
|
|
348
|
+
- Definitive credential absence or rejection retires Kimi cache data. Transient fallback drops reset-expired windows and applies five-hour or seven-day age bounds to windows without resets.
|
|
336
349
|
|
|
337
350
|
### Safety guarantees
|
|
338
351
|
|
|
@@ -340,7 +353,7 @@ Auth source entries can include `credentialPresent` when a non-secret probe conf
|
|
|
340
353
|
- The user-initiated `update` command is the only non-provider network surface, and it is not part of quota measurement.
|
|
341
354
|
- It sends credential values only to the first-party provider request they authenticate.
|
|
342
355
|
- It never prints, logs, or caches credential values.
|
|
343
|
-
- It never launches the Claude
|
|
356
|
+
- It never launches the Claude, Grok, Pi, or Kimi CLIs, so it cannot spend quota or mutate provider credentials while measuring them.
|
|
344
357
|
|
|
345
358
|
### Cache
|
|
346
359
|
|
|
@@ -353,6 +366,7 @@ Auth source entries can include `credentialPresent` when a non-secret probe conf
|
|
|
353
366
|
| Cached reports | Only fresh provider snapshots with windows are cached. |
|
|
354
367
|
| Fresh provider reports with no windows | Clear any cached snapshot for that provider, so entitlement-only reports do not leave stale quota windows behind. |
|
|
355
368
|
| Reports and details not cached | Failed providers, stale providers, account identity, and source attempts are not cached. |
|
|
369
|
+
| Grok cache provenance | Only snapshots produced by the current `web` consumer operation can be used as Grok stale fallback; legacy `api` billing-proxy snapshots are rejected. |
|
|
356
370
|
|
|
357
371
|
## Development
|
|
358
372
|
|
package/dist/src/args.js
CHANGED
|
@@ -56,7 +56,7 @@ function parseProviderScope(value) {
|
|
|
56
56
|
return parseProviders(value);
|
|
57
57
|
}
|
|
58
58
|
catch (error) {
|
|
59
|
-
throw new AxiError(error instanceof Error ? error.message : "unsupported provider", "VALIDATION_ERROR", ["Supported providers: claude, codex, cursor, copilot, grok"]);
|
|
59
|
+
throw new AxiError(error instanceof Error ? error.message : "unsupported provider", "VALIDATION_ERROR", ["Supported providers: claude, codex, cursor, copilot, grok, kimi"]);
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
//# sourceMappingURL=args.js.map
|
package/dist/src/args.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,IAAI,aAAiC,CAAC;IACtC,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,mBAAmB,GAAG,KAAK,CAAC;IAEhC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QACjD,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YACjB,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrB,IAAI,GAAG,IAAI,CAAC;YACZ,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACrB,IAAI,GAAG,IAAI,CAAC;YACZ,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,yBAAyB,EAAE,CAAC;YACtC,mBAAmB,GAAG,IAAI,CAAC;YAC3B,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,C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AAED,SAAS,kBAAkB,CAAC,KAAyB;IACnD,IAAI,CAAC;QACH,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,QAAQ,CAChB,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,sBAAsB,EAC/D,kBAAkB,EAClB,CAAC,iEAAiE,CAAC,CACpE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/src/cache.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ProviderId, ProviderQuota } from "./types.js";
|
|
2
2
|
export declare function readCachedProvider(provider: ProviderId): ProviderQuota | undefined;
|
|
3
3
|
export declare function writeCachedProviders(providers: ProviderQuota[]): void;
|
|
4
|
+
export declare function deleteCachedProvider(provider: ProviderId): void;
|
package/dist/src/cache.js
CHANGED
|
@@ -50,9 +50,18 @@ export function writeCachedProviders(providers) {
|
|
|
50
50
|
for (const provider of cacheable)
|
|
51
51
|
byProvider.set(provider.provider, provider);
|
|
52
52
|
const merged = PROVIDER_IDS.map((provider) => byProvider.get(provider)).filter((provider) => Boolean(provider));
|
|
53
|
+
writeCacheFile(file, merged);
|
|
54
|
+
}
|
|
55
|
+
export function deleteCachedProvider(provider) {
|
|
56
|
+
const existing = readCacheProviders();
|
|
57
|
+
if (!existing.some((item) => item.provider === provider))
|
|
58
|
+
return;
|
|
59
|
+
writeCacheFile(cacheFilePath(), existing.filter((item) => item.provider !== provider));
|
|
60
|
+
}
|
|
61
|
+
function writeCacheFile(file, providers) {
|
|
53
62
|
ensurePrivateParent(file);
|
|
54
63
|
const temp = `${file}.${process.pid}.tmp`;
|
|
55
|
-
writeFileSync(temp, `${JSON.stringify({ generatedAt: new Date().toISOString(), schemaVersion: 1, providers
|
|
64
|
+
writeFileSync(temp, `${JSON.stringify({ generatedAt: new Date().toISOString(), schemaVersion: 1, providers }, null, 2)}\n`, { mode: 0o600 });
|
|
56
65
|
chmodSync(temp, 0o600);
|
|
57
66
|
renameSync(temp, file);
|
|
58
67
|
chmodSync(file, 0o600);
|
package/dist/src/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ/E,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,gBAAgB,GAAG;IACvB,OAAO;IACP,SAAS;IACT,KAAK;IACL,KAAK;IACL,OAAO;IACP,aAAa;CAC+B,CAAC;AAC/C,MAAM,iBAAiB,GAAG;IACxB,OAAO;IACP,OAAO;IACP,aAAa;IACb,eAAe;IACf,cAAc;IACd,OAAO;CACqC,CAAC;AAC/C,MAAM,YAAY,GAAG;IACnB,SAAS;IACT,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,SAAS;CACwC,CAAC;AAEpD,MAAM,UAAU,kBAAkB,CAChC,QAAoB;IAEpB,OAAO,kBAAkB,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AACzE,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,SAA0B;IAC7D,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,SAAS;SACN,MAAM,CACL,CAAC,QAAQ,EAAE,EAAE,CACX,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,CACrE;SACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CACxC,CAAC;I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Q,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QACxD,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const DESCRIPTION = "Report local agent-provider quota windows for routing-aware agents.";
|
|
2
|
-
export declare const TOP_HELP = "usage: quota-axi [auth] [flags]\ncommands[2]:\n (none)=quota, auth\nflags[6]:\n --provider <claude,codex,cursor,copilot,grok>, --json, --full, --allow-keychain-prompt, --help, -v/--version\nexamples:\n quota-axi\n quota-axi --provider claude\n quota-axi --provider cursor,copilot,grok\n quota-axi --json\n quota-axi --full\n quota-axi auth\n";
|
|
2
|
+
export declare const TOP_HELP = "usage: quota-axi [auth] [flags]\ncommands[2]:\n (none)=quota, auth\nflags[6]:\n --provider <claude,codex,cursor,copilot,grok,kimi>, --json, --full, --allow-keychain-prompt, --help, -v/--version\nexamples:\n quota-axi\n quota-axi --provider claude\n quota-axi --provider cursor,copilot,grok,kimi\n quota-axi --json\n quota-axi --full\n quota-axi auth\n";
|
|
3
3
|
type MainOptions = {
|
|
4
4
|
argv?: string[];
|
|
5
5
|
stdout?: {
|
package/dist/src/cli.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, join } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
1
|
import { runAxiCli } from "axi-sdk-js";
|
|
5
2
|
import { authCommand, quotaCommand } from "./commands.js";
|
|
3
|
+
import { VERSION } from "./version.js";
|
|
6
4
|
export const DESCRIPTION = "Report local agent-provider quota windows for routing-aware agents.";
|
|
7
5
|
export const TOP_HELP = `usage: quota-axi [auth] [flags]
|
|
8
6
|
commands[2]:
|
|
9
7
|
(none)=quota, auth
|
|
10
8
|
flags[6]:
|
|
11
|
-
--provider <claude,codex,cursor,copilot,grok>, --json, --full, --allow-keychain-prompt, --help, -v/--version
|
|
9
|
+
--provider <claude,codex,cursor,copilot,grok,kimi>, --json, --full, --allow-keychain-prompt, --help, -v/--version
|
|
12
10
|
examples:
|
|
13
11
|
quota-axi
|
|
14
12
|
quota-axi --provider claude
|
|
15
|
-
quota-axi --provider cursor,copilot,grok
|
|
13
|
+
quota-axi --provider cursor,copilot,grok,kimi
|
|
16
14
|
quota-axi --json
|
|
17
15
|
quota-axi --full
|
|
18
16
|
quota-axi auth
|
|
19
17
|
`;
|
|
20
|
-
const VERSION = readPackageVersion();
|
|
21
18
|
export async function main(options = {}) {
|
|
22
19
|
const binPath = options.binPath ?? process.argv[1] ?? "quota-axi";
|
|
23
20
|
const argv = normalizeArgv(options.argv ?? process.argv.slice(2));
|
|
@@ -105,18 +102,4 @@ function findCommand(raw) {
|
|
|
105
102
|
}
|
|
106
103
|
return -1;
|
|
107
104
|
}
|
|
108
|
-
function readPackageVersion() {
|
|
109
|
-
const here = dirname(fileURLToPath(import.meta.url));
|
|
110
|
-
for (const candidate of [
|
|
111
|
-
join(here, "..", "package.json"),
|
|
112
|
-
join(here, "..", "..", "package.json"),
|
|
113
|
-
]) {
|
|
114
|
-
if (!existsSync(candidate))
|
|
115
|
-
continue;
|
|
116
|
-
const parsed = JSON.parse(readFileSync(candidate, "utf-8"));
|
|
117
|
-
if (typeof parsed.version === "string" && parsed.version.length > 0)
|
|
118
|
-
return parsed.version;
|
|
119
|
-
}
|
|
120
|
-
return "0.0.0";
|
|
121
|
-
}
|
|
122
105
|
//# sourceMappingURL=cli.js.map
|
package/dist/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO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;IACjC,OAAO,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,WAAW,CAAC;AAChE,CAAC;AAED,SAAS,cAAc,CACrB,GAAa,EACb,SAAmC;IAEnC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YACzB,KAAK,EAAE,CAAC;YACR,SAAS;QACX,CAAC;QACD,IAAI,SAAS,CAAC,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;IACnC,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC;AAED,SAAS,WAAW,CAAC,GAAa;IAChC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC;QAChD,MAAM,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QACvB,IAAI,GAAG,KAAK,YAAY,EAAE,CAAC;YACzB,KAAK,EAAE,CAAC;YACR,SAAS;QACX,CAAC;QACD,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IAC1E,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -5,14 +5,14 @@ type GrokCredentials = {
|
|
|
5
5
|
teamId?: string;
|
|
6
6
|
expiresAt?: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
9
|
-
export declare function fetchQuota(_options: ProviderOptions): Promise<ProviderQuota>;
|
|
10
|
-
export declare function inspectAuth(_options: ProviderOptions): Promise<AuthProviderReport>;
|
|
11
|
-
export declare function normalizeGrokBilling(raw: unknown, credentials?: Pick<GrokCredentials, "email" | "teamId">): {
|
|
12
|
-
plan?: string;
|
|
8
|
+
type NormalizedGrokQuota = {
|
|
13
9
|
account?: ProviderQuota["account"];
|
|
14
10
|
windows: QuotaWindow[];
|
|
15
11
|
credits?: ProviderQuota["credits"];
|
|
16
12
|
refreshedAt: string;
|
|
17
|
-
}
|
|
13
|
+
};
|
|
14
|
+
export declare const grokAdapter: ProviderAdapter;
|
|
15
|
+
export declare function fetchQuota(_options: ProviderOptions): Promise<ProviderQuota>;
|
|
16
|
+
export declare function inspectAuth(_options: ProviderOptions): Promise<AuthProviderReport>;
|
|
17
|
+
export declare function normalizeGrokConsumerPayload(payload: Uint8Array, credentials?: Pick<GrokCredentials, "email" | "teamId">): NormalizedGrokQuota;
|
|
18
18
|
export {};
|