Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test(attachments): compare Show-original paths with native realpath for Windows short names
AdityaUmaleb0be9c6bc878
diff --git a/server/bot-attachment.test.ts b/server/bot-attachment.test.tsindex 76a743e12d..a522c276c9 100644--- a/server/bot-attachment.test.ts+++ b/server/bot-attachment.test.ts@@ -70,7 +70,7 @@ describe("saveBotAttachment", () => {expect(readFileSync(saved.attachment.path)).toEqual(bytes);if (saved.attachment.kind === "file") expect(saved.attachment.name.toLowerCase()).toBe(name.toLowerCase());// The desktop app shows the original in its folder, not the copy.- expect(saved.attachment).toMatchObject({ source: realpathSync(join(WORK, name)) });+ expect(saved.attachment).toMatchObject({ source: realpathSync.native(join(WORK, name)) });});it("reads a file from the VM guest workspace through its host mount", async () => {@@ -82,7 +82,7 @@ describe("saveBotAttachment", () => {guest: { root: "/home/cua/workspace", host: VM_HOME },});expect(saved.attachment).toMatchObject({ kind: "file", mime: "application/pdf", name: "決算書.pdf",- source: realpathSync(join(VM_HOME, "reports", "nekoneko.pdf")) });+ source: realpathSync.native(join(VM_HOME, "reports", "nekoneko.pdf")) });expect(readFileSync(saved.attachment.path, "utf8")).toBe("%PDF-1.4 fake");});@@ -127,7 +127,7 @@ describe("saveBotAttachment for a file a turn saved outside its folders", () =>// Bots on macOS write the URL unencoded; Windows needs a real file URL.const href = process.platform === "win32" ? pathToFileURL(source).href : `file://${source}`;const saved = await saveBotAttachment({ path: href, roots: [WORK], savedThisTurn: { since, refuse } });- expect(saved.attachment).toMatchObject({ kind: "image", mime: "image/jpeg", name: "00_غلاف.jpg", source: realpathSync(source) });+ expect(saved.attachment).toMatchObject({ kind: "image", mime: "image/jpeg", name: "00_غلاف.jpg", source: realpathSync.native(source) });expect(saved.attachment.path.startsWith(ATTACHMENTS_DIR)).toBe(true);expect(readFileSync(saved.attachment.path, "utf8")).toBe("jpeg-bytes");expect(readFileSync(source, "utf8")).toBe("jpeg-bytes");