Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(box): route Command Code fetch through the isolated egress proxy
WolveBrowne2b5e5f9e179
diff --git a/server/bot-box/box.test.ts b/server/bot-box/box.test.tsindex 9ab759c0db..c3b19fdb41 100644--- a/server/bot-box/box.test.ts+++ b/server/bot-box/box.test.ts@@ -66,6 +66,15 @@ describe("BoxRunner.wrap", () => {}});+ it("enables Node's environment proxy for Command Code only on the isolated network", () => {+ const runner = new BoxRunner({ bwrap: "/usr/bin/bwrap", bridge, setup, denyEnv: new Set() });+ const request = { command: "command-code", args: ["acp"], engine: "commandCodeAgent", env: {} };+ expect(runner.wrap(request).env).toMatchObject({+ NODE_USE_ENV_PROXY: "1", HTTPS_PROXY: `http://127.0.0.1:${BOX_EGRESS_PORT}`,+ });+ expect(runner.wrap({ ...request, net: "shared" }).env.NODE_USE_ENV_PROXY).toBeUndefined();+ });+it("a shared-network box gets no proxy and no bridge", () => {const runner = new BoxRunner({ bwrap: "/usr/bin/bwrap", bridge, setup, denyEnv: new Set() });const wrapped = runner.wrap({ command: "/opt/chrome", args: ["--headless"], env: { PATH: "/usr/bin" }, net: "shared" });diff --git a/server/bot-box/box.ts b/server/bot-box/box.tsindex b28c882b52..10918a55f2 100644--- a/server/bot-box/box.ts+++ b/server/bot-box/box.ts@@ -169,6 +169,7 @@ export class BoxRunner {if (plan.net === "isolated") {const proxy = `http://127.0.0.1:${this.options.egressPort ?? BOX_EGRESS_PORT}`;for (const name of BOX_PROXY_ENV) env[name] = proxy;+ if (request.engine === "commandCodeAgent") env.NODE_USE_ENV_PROXY = "1";// Node's env proxy matches an IPv6 host only bracketed; curl and the engines take the plain forms.for (const name of BOX_NO_PROXY_ENV) env[name] = "127.0.0.1,localhost,::1,[::1]";}