Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
import { describe, expect, it } from "vitest";
import { optimisticMessageId } from "@/state/optimistic-send";
import { transcriptRowKeys } from "./transcript-row-keys";
describe("transcriptRowKeys", () => {
it("keys a send's optimistic stand-in and the server's copy alike", () => {
const sent = transcriptRowKeys([{ id: "a" }, { id: optimisticMessageId("s1"), sendId: "s1" }]);
const echoed = transcriptRowKeys([{ id: "a" }, { id: "server-1", sendId: "s1" }]);
expect(sent.get(optimisticMessageId("s1"))).toBe("send:s1");
expect(echoed.get("server-1")).toBe("send:s1");
expect(sent.has("a")).toBe(false);
});
it("gives no shared key to rows that carry the same sendId", () => {
const keys = transcriptRowKeys([{ id: "x", sendId: "s1" }, { id: "y", sendId: "s1" }, { id: "z", sendId: "s2" }]);
expect(keys.has("x")).toBe(false);
expect(keys.has("y")).toBe(false);
expect(keys.get("z")).toBe("send:s2");
});
});