Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Merge upstream/main into fix2/6898-hermes-gateway-kill

Bugfixer 297b7c49a8f3f
diff --cc server/testing/fake-acp-cli.ts
index e93d9fbcd7,77745b8f97..0555cdeb4e
--- a/server/testing/fake-acp-cli.ts
+++ b/server/testing/fake-acp-cli.ts
@@@ -395,16 -425,21 +427,31 @@@ if (argv[0] === "status" || argv[0] ==
console.log(JSON.stringify({ isAuthenticated: authenticated }));
process.exit(0);
}
+const gatewayPidFile = process.env.FAKE_ACP_GATEWAY_PID_FILE;
+if (gatewayPidFile && argv[0] === "acp" && !existsSync(gatewayPidFile)) {
+ const gateway = spawn(process.execPath, ["-e", "setInterval(() => {}, 1 << 30)", "gateway", "run", "--quiet"], {
+ detached: true,
+ stdio: "ignore",
+ env: { ...process.env, HERMES_GATEWAY_DETACHED: "1" },
+ });
+ gateway.unref();
+ writeFileSync(gatewayPidFile, String(gateway.pid));
+}
+ const grokLogin = process.env.FAKE_ACP_GROK_LOGIN;
+ if (argv[0] === "models" && grokLogin) {
+ const countFile = process.env.FAKE_ACP_GROK_LOGIN_COUNT;
+ const calls = countFile && existsSync(countFile) ? Number(readFileSync(countFile, "utf8")) || 0 : 0;
+ if (countFile) writeFileSync(countFile, String(calls + 1));
+ if (grokLogin === "hang" || grokLogin === "signed-out-hang") {
+ if (grokLogin === "signed-out-hang") console.log("You are not authenticated.");
+ setInterval(() => {}, 1_000);
+ await new Promise(() => {});
+ }
+ const signedIn = grokLogin === "signed-in" || (grokLogin === "refreshes" && calls > 0);
+ console.log([signedIn ? "You are logged in with grok.com." : "You are not authenticated.",
+ "Default model: grok-4.5", "Available models:", " - grok-4.5 (default)"].join("\n"));
+ process.exit(0);
+ }
const catalogLock = process.env.FAKE_ACP_MODELS_LOCK;
if (catalogLock && (argv[0] === "models" || argv[0] === "acp") && !argv.includes("--refresh") && process.env.OPENCODE_DISABLE_MODELS_FETCH !== "1") {
writeFileSync(catalogLock, String(process.pid));