Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(keys): don't offer the Grok CLI install for a saved xAI API key
AdityaUmale24bfafa511ae
diff --git a/src/components/keys/KeyRow.test.ts b/src/components/keys/KeyRow.test.tsindex 4173f869c9..3066668c35 100644--- a/src/components/keys/KeyRow.test.ts+++ b/src/components/keys/KeyRow.test.ts@@ -106,15 +106,19 @@ describe("a saved key", () => {expect(render({ id: "deepseek" })).toContain("data-key-engine-missing");fixture.instances = [deepseek("available")];expect(render({ id: "deepseek" })).not.toContain("data-key-engine-missing");- // The xAI key also feeds the xAI API engine, so a missing Grok CLI doesn't leave it unused.+ // The Grok CLI drops XAI_API_KEY (it uses a grok.com sign-in), so its install never makes the xAI key usable.+ const grokCli = { ...deepseek("unavailable"), instanceId: "grok", driverKind: "grokAgent", displayName: "Grok" } as InstanceInfo;fixture.config = { xai: { configured: true, last4: "8y8y" } };- fixture.instances = [{ ...deepseek("unavailable"), instanceId: "grok", displayName: "Grok" }, { ...deepseek("available"), instanceId: "xaiApi", install: undefined }];+ fixture.instances = [grokCli, { ...deepseek("available"), instanceId: "xaiApi", install: undefined }];expect(render({ id: "xai" })).not.toContain("data-key-engine-missing");- fixture.instances = [{ ...deepseek("unavailable"), instanceId: "grok", displayName: "Grok" }];- expect(render({ id: "xai" })).toContain("data-key-engine-missing");- // An unavailable engine with nothing to install (xAI API on a custom URL) doesn't hide the one that has a command.- fixture.instances = [{ ...deepseek("unavailable"), instanceId: "xaiApi", displayName: "xAI API", install: undefined }, { ...deepseek("unavailable"), instanceId: "grok", displayName: "Grok" }];- expect(render({ id: "xai" })).toContain("Saved, but Grok can't run on this computer yet");+ fixture.instances = [grokCli];+ expect(render({ id: "xai" })).not.toContain("data-key-engine-missing");+ fixture.instances = [{ ...deepseek("unavailable"), instanceId: "xaiApi", displayName: "xAI API", install: undefined }, grokCli];+ expect(render({ id: "xai" })).not.toContain("data-key-engine-missing");+ // An unavailable engine with nothing to install doesn't hide one that has a command.+ fixture.config = { deepseek: { configured: true, last4: "9z9z" } };+ fixture.instances = [{ ...deepseek("unavailable"), displayName: "Other", install: undefined }, deepseek("unavailable")];+ expect(render({ id: "deepseek" })).toContain("Saved, but DeepSeek Harness can't run on this computer yet");fixture.config = {};fixture.instances = [deepseek("unavailable")];expect(render({ id: "deepseek" })).not.toContain("data-key-engine-missing");diff --git a/src/components/keys/KeyRow.tsx b/src/components/keys/KeyRow.tsxindex cb02d083be..14cba1d196 100644--- a/src/components/keys/KeyRow.tsx+++ b/src/components/keys/KeyRow.tsx@@ -133,7 +133,10 @@ export function KeyRow({const engineRejected = (state.instances ?? []).some((instance) => instance.access === "api" && keyForInstance(instance.instanceId) === entry.id&& instance.snapshot.state === "available" && instance.snapshot.authenticated === false);// A key engine with its own CLI (DeepSeek Harness) can't use a saved key until that CLI runs here.- const keyEngines = saved.configured ? (state.instances ?? []).filter((instance) => keyForInstance(instance.instanceId) === entry.id) : [];+ // The Grok CLI signs in with a grok.com account and drops XAI_API_KEY, so installing it never puts the xAI key to use.+ const keyEngines = saved.configured+ ? (state.instances ?? []).filter((instance) => instance.driverKind !== "grokAgent" && keyForInstance(instance.instanceId) === entry.id)+ : [];const missingEngine = keyEngines.some((instance) => instance.snapshot.state === "available")? undefined: keyEngines.find((instance) => instance.snapshot.state === "unavailable" && installCommandFor(instance.install) !== null);