feat(xai): prefilled OAuth device link, SuperGrok login label, trimmed model list (#6734)

- Use verification_uri_complete from the xAI device-code response so the
  login link opens with the user code prefilled (https-validated)
- Add OAuthAuth.loginLabel and show "Sign in with SuperGrok or X Premium"
  in the xAI auth-type selector (threaded through lazyOAuth)
- Remove grok-3, grok-3-fast, grok-4.20 variants and grok-code-fast-1
  from the built-in xAI catalog and default to grok-4.5

Co-authored-by: Jaaneek <Jaaneek@users.noreply.github.com>
This commit is contained in:
Milosz Jankiewicz
2026-07-16 17:59:54 +01:00
committed by GitHub
parent c2c32febb0
commit a01baaaea7
15 changed files with 75 additions and 102 deletions
+45
View File
@@ -173,6 +173,51 @@ describe("xAI OAuth device flow", () => {
expect(pollTimes).toEqual([startTime.getTime() + 5000]);
});
it("prefers verification_uri_complete when the server provides it", async () => {
vi.useFakeTimers();
vi.stubGlobal(
"fetch",
vi.fn(async (input: unknown) => {
if (requestUrl(input) === "https://auth.x.ai/oauth2/device/code") {
return jsonResponse(
deviceCodeResponse({
verification_uri_complete: "https://accounts.x.ai/oauth2/device?user_code=ABCD-1234",
}),
);
}
return jsonResponse(tokenResponse());
}),
);
const deviceCodes: DeviceCodeInfo[] = [];
const loginPromise = loginXaiForTest({ onDeviceCode: (info) => deviceCodes.push(info) });
await vi.advanceTimersByTimeAsync(5000);
await loginPromise;
expect(deviceCodes).toEqual([
{
userCode: "ABCD-1234",
verificationUri: "https://accounts.x.ai/oauth2/device?user_code=ABCD-1234",
intervalSeconds: 5,
expiresInSeconds: 900,
},
]);
});
it("rejects a non-https verification_uri_complete", async () => {
vi.stubGlobal(
"fetch",
vi.fn(async () =>
jsonResponse(
deviceCodeResponse({
verification_uri_complete: "http://accounts.x.ai/oauth2/device?user_code=ABCD-1234",
}),
),
),
);
await expect(loginXaiForTest({ onDeviceCode: () => {} })).rejects.toThrow("Untrusted verification URI");
});
it.each(["http://accounts.x.ai/oauth2/device", "file:///etc/passwd", "not a url"])(
"rejects a non-https verification URI: %s",
async (verificationUri) => {