Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
test(memory): anchor relative-date fixtures at local noon
Sebastian Bcb1f4ba07696
diff --git a/server/memory-fact-checks.test.ts b/server/memory-fact-checks.test.tsindex ca3240fba6..f1fd3b62b6 100644--- a/server/memory-fact-checks.test.ts+++ b/server/memory-fact-checks.test.ts@@ -3,8 +3,8 @@ import { checkDreamFacts } from "./memory-fact-checks.ts";import type { DreamConversation } from "./memory-dream.ts";const chats: DreamConversation[] = [- { threadId: "a", lines: [{ by: "person", text: "Anna, my sister, moved yesterday to York. Her budget is 250 in March. Notes: /work/anna.md https://example.test/anna", at: Date.parse("2026-10-20T12:00:00Z") }] },- { threadId: "b", lines: [{ by: "person", text: "Anna likes short replies too.", at: Date.parse("2026-10-21T12:00:00Z") }] },+ { threadId: "a", lines: [{ by: "person", text: "Anna, my sister, moved yesterday to York. Her budget is 250 in March. Notes: /work/anna.md https://example.test/anna", at: Date.parse("2026-10-20T12:00:00") }] },+ { threadId: "b", lines: [{ by: "person", text: "Anna likes short replies too.", at: Date.parse("2026-10-21T12:00:00") }] },];const quotes = [chats[0]!.lines[0]!.text, chats[1]!.lines[0]!.text];const check = (text: string, evidence = quotes) => checkDreamFacts(text, [1, 2], evidence, chats);@@ -31,18 +31,18 @@ describe("dream fact checks", () => {it.each(["dziś", "dzisiaj", "wczoraj", "jutro", "today", "yesterday", "tomorrow"])("resolves %s at a month boundary", (word) => {const text = `Anna ${word}`;const day = ["wczoraj", "yesterday"].includes(word) ? "2026-02-28" : ["jutro", "tomorrow"].includes(word) ? "2026-03-02" : "2026-03-01";- expect(checkDreamFacts(text, [1], [text], [{ threadId: "d", lines: [{ by: "person", text, at: Date.parse("2026-03-01T12:00:00Z") }] }])).toBe(`Anna ${day}`);+ expect(checkDreamFacts(text, [1], [text], [{ threadId: "d", lines: [{ by: "person", text, at: Date.parse("2026-03-01T12:00:00") }] }])).toBe(`Anna ${day}`);});it("refuses relative dates without an anchor or with ambiguous source days", () => {expect(checkDreamFacts("Anna today", [1], ["Anna today"], [{ threadId: "x", lines: [{ by: "person", text: "Anna today" }] }])).toBeNull();- expect(checkDreamFacts("Anna today", [1, 2], ["Anna today", "Anna today"], [0, 1].map((i) => ({ threadId: String(i), lines: [{ by: "person" as const, text: "Anna today", at: Date.parse(`2026-10-2${i}T12:00:00Z`) }] })))).toBeNull();+ expect(checkDreamFacts("Anna today", [1, 2], ["Anna today", "Anna today"], [0, 1].map((i) => ({ threadId: String(i), lines: [{ by: "person" as const, text: "Anna today", at: Date.parse(`2026-10-2${i}T12:00:00`) }] })))).toBeNull();});it("leaves relative-date words inside paths and URLs alone", () => {const text = "Anna keeps notes in /notes/today.md and https://example.test/today";expect(checkDreamFacts(text, [1], [text], [{ threadId: "p", lines: [{ by: "person", text }] }])).toBe(text);const dated = "Anna wrote /notes/today.md today";- expect(checkDreamFacts(dated, [1], [dated], [{ threadId: "p", lines: [{ by: "person", text: dated, at: Date.parse("2026-03-01T12:00:00Z") }] }])).toBe("Anna wrote /notes/today.md 2026-03-01");+ expect(checkDreamFacts(dated, [1], [dated], [{ threadId: "p", lines: [{ by: "person", text: dated, at: Date.parse("2026-03-01T12:00:00") }] }])).toBe("Anna wrote /notes/today.md 2026-03-01");const slashed = "Anna works remotely today/tomorrow";- expect(checkDreamFacts(slashed, [1], [slashed], [{ threadId: "p", lines: [{ by: "person", text: slashed, at: Date.parse("2026-03-01T12:00:00Z") }] }])).toBe("Anna works remotely 2026-03-01/2026-03-02");+ expect(checkDreamFacts(slashed, [1], [slashed], [{ threadId: "p", lines: [{ by: "person", text: slashed, at: Date.parse("2026-03-01T12:00:00") }] }])).toBe("Anna works remotely 2026-03-01/2026-03-02");});});