@monotykamary/pi-better-grok 0.2.1 → 0.2.2
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 +2 -0
- package/package.json +1 -1
- package/src/resets.ts +15 -1
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ SuperGrok plans earn banked rate-limit reset tokens: redeeming one restores the
|
|
|
36
36
|
|
|
37
37
|
The inventory and redeem calls use the grok.com consumer billing gRPC-Web service (`prod_mc_billing.ConsumerUiSvc/GetRemainingResets` and `RedeemReset`) that the web usage page itself calls, authenticated with the same xAI OAuth token as the usage meter. This surface is undocumented; request shapes are pinned in `src/resets.ts` and schema drift is expected.
|
|
38
38
|
|
|
39
|
+
**Known limitation:** grok.com fronts this RPC with a Cloudflare managed challenge, which browser-fingerprinted clients (Electron apps) pass but plain CLI runtimes cannot — the edge answers with `403 · cf-mitigated: challenge` regardless of headers or credentials. When that happens the widget hides the count and `/grok-resets` explains the challenge instead of misreporting it as an auth failure. The wiring is live end to end, so the count appears in any environment where the fetch can succeed.
|
|
40
|
+
|
|
39
41
|
## pi-multiprovider
|
|
40
42
|
|
|
41
43
|
When [pi-multiprovider](https://github.com/monotykamary/pi-multiprovider) pools several `xai` accounts, the session's active account (chosen with `/switch-account`) is resolved first for usage display and banked resets, and the usage widget refreshes on every switch. Without that extension, credential resolution is unchanged: pi's native `xai` OAuth, then `xai-oauth`/`xai-auth` auth-file entries, then the Grok CLI store.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monotykamary/pi-better-grok",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Improve Grok/xAI in pi with fast mode, subscription usage stats, banked reset redemption, multiprovider pools, footer polish, and settings — mirroring pi-better-openai.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"footer",
|
package/src/resets.ts
CHANGED
|
@@ -42,7 +42,14 @@ export type GrokRedeemCode = "reset" | "no_credit" | "already_redeemed";
|
|
|
42
42
|
|
|
43
43
|
export type GrokRedeemResult = { code: GrokRedeemCode };
|
|
44
44
|
|
|
45
|
-
export type ResetErrorCode =
|
|
45
|
+
export type ResetErrorCode =
|
|
46
|
+
| "auth"
|
|
47
|
+
| "challenge"
|
|
48
|
+
| "http"
|
|
49
|
+
| "grpc"
|
|
50
|
+
| "invalid"
|
|
51
|
+
| "oversize"
|
|
52
|
+
| "transport";
|
|
46
53
|
|
|
47
54
|
export class ResetError extends Error {
|
|
48
55
|
readonly code: ResetErrorCode;
|
|
@@ -383,6 +390,13 @@ async function postGrokRpc(
|
|
|
383
390
|
throw new ResetError("transport", `Grok reset request failed: ${message}`);
|
|
384
391
|
}
|
|
385
392
|
if (!response.ok) {
|
|
393
|
+
if (response.headers.get("cf-mitigated") === "challenge") {
|
|
394
|
+
throw new ResetError(
|
|
395
|
+
"challenge",
|
|
396
|
+
`grok.com is serving a Cloudflare browser challenge (HTTP ${response.status}); banked reset data cannot be fetched from a non-browser client.`,
|
|
397
|
+
response.status,
|
|
398
|
+
);
|
|
399
|
+
}
|
|
386
400
|
if (response.status === 401 || response.status === 403) {
|
|
387
401
|
throw new ResetError(
|
|
388
402
|
"auth",
|