Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Tests: analytics waits for its sends, and the Cloud fixture says why it gave no code
milind-sonif687ac636170
diff --git a/scripts/testing/cloud-send-fixture.ts b/scripts/testing/cloud-send-fixture.tsindex 68dcb0d1f9..d4eb4da986 100644--- a/scripts/testing/cloud-send-fixture.ts+++ b/scripts/testing/cloud-send-fixture.ts@@ -252,6 +252,8 @@ await import(${JSON.stringify(pathToFileURL(join(SERVER_DIR, "testing", "fake-clconst timestamp = String(Math.floor(Date.now() / 1000)), nonce = randomBytes(16).toString("base64url");const response = await fetch(`${cloudBase}/api/cloud/pairing`, { method: "POST", headers: { ...EDGE, "content-type": "application/json","x-omb-cloud-timestamp": timestamp, "x-omb-cloud-nonce": nonce, "x-omb-cloud-signature": `v1=${cloudPairingSignature(secret, timestamp, nonce, body)}` }, body });+ // A Cloud that turns the request away says why, instead of handing main a code that is not there.+ if (!response.ok) throw new Error(`My Cloud gave no one-time code: HTTP ${response.status} ${await response.text()}`);return ((await response.json()) as { code: string }).code;};const pairOwner = async () => {diff --git a/src/lib/analytics.wire.test.ts b/src/lib/analytics.wire.test.tsindex 4469cbd240..906174d73c 100644--- a/src/lib/analytics.wire.test.ts+++ b/src/lib/analytics.wire.test.ts@@ -106,6 +106,13 @@ it("sends events without any stored or current address, polls nothing, and sendsawait analytics.initAnalytics();analytics.track("app_snapshot", { bots: 3 });await minutes(11);+ // posthog-js gzips each batch with the platform's CompressionStream, which finishes on the real clock, not the fake+ // one: on a busy machine the batches leave after the last tick. Wait for both events to have left, not for ticks.+ await vi.waitFor(async () => {+ const bodies = (await Promise.all(sent.map(({ body }) => bodyText(body)))).join("\n");+ expect(bodies).toContain("app_snapshot");+ expect(bodies).toContain("app_active");+ }, { timeout: 30_000, interval: 20 });const urls = sent.map(({ url }) => new URL(url));expect(urls.length).toBeGreaterThan(0);