Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(first-hour): say the day-two recap's sorting was for the morning brief
AdityaUmale2d27f776dcab
diff --git a/docs/verification/first-hour.md b/docs/verification/first-hour.mdindex 0918c897e2..85acc78af4 100644--- a/docs/verification/first-hour.md+++ b/docs/verification/first-hour.md@@ -52,8 +52,9 @@ pnpm exec vitest run server/host/first-hour.test.ts server/host/brief-morning.tedecline carries on to the phone with no brief line; a first look that couldnot run says so; the first look's three-draft fence; the push to a phonepaired after the first look; the day-two recap ("So far I've sorted 40- emails, drafted 6 replies and prepped 4 meetings: about 2 hours back.") only- after 8:00 on day two, once, and never when nothing was done.+ emails for your morning brief, drafted 6 replies and prepped 4 meetings:+ about 2 hours back.") only after 8:00 on day two, once, and never when+ nothing was done.- `server/host/brief-morning.test.ts`: the brief posted and pushed at 8:00 in the person'szone and not a minute before, once a day; its first line from the counts sincethe person was last here, left out when they just were; a running watch rundiff --git a/server/host/first-hour-words.test.ts b/server/host/first-hour-words.test.tsindex 73376f35ac..6fa9d93433 100644--- a/server/host/first-hour-words.test.ts+++ b/server/host/first-hour-words.test.ts@@ -25,6 +25,8 @@ describe("the first hour's words", () => {for (const n of ["40", "6", "4"]) expect(done, language).toContain(n);expect(w.recap(done, w.time(110)), language).toContain("2");expect(w.overnight(w.list([w.sorted(1)])), language).toContain("1");+ expect(w.briefSorted(40), language).toContain("40");+ expect(w.briefSorted(40), language).not.toBe(w.sorted(40));expect(w.routines(3), language).toContain("3");}});@@ -32,13 +34,15 @@ describe("the first hour's words", () => {it("count in English the way a person does", () => {const w = firstHourWords("en");expect(w.list([w.sorted(1), w.drafted(1), w.prepped(1)])).toBe("sorted 1 email, drafted 1 reply and prepped 1 meeting");- expect(w.recap(w.list([w.sorted(40), w.drafted(6), w.prepped(4)]), w.time(110))).toBe("So far I've sorted 40 emails, drafted 6 replies and prepped 4 meetings: about 2 hours back.");+ expect(w.recap(w.list([w.briefSorted(40), w.drafted(6), w.prepped(4)]), w.time(110))).toBe("So far I've sorted 40 emails for your morning brief, drafted 6 replies and prepped 4 meetings: about 2 hours back.");expect(w.overnight(w.list([w.sorted(23), w.drafted(2)]))).toBe("While you slept, I sorted 23 emails and drafted 2 replies.");+ expect([1, 14].map((n) => w.briefSorted(n))).toEqual(["sorted 1 email for your morning brief", "sorted 14 emails for your morning brief"]);expect([12, 47, 60, 89, 90, 151].map((minutes) => w.time(minutes))).toEqual(["about 10 minutes", "about 45 minutes", "about an hour", "about an hour", "about 2 hours", "about 3 hours"]);});it("use the plural forms of Russian, Ukrainian and Polish", () => {expect([1, 3, 5, 21].map((n) => firstHourWords("ru").sorted(n))).toEqual(["разобрано 1 письмо", "разобрано 3 письма", "разобрано 5 писем", "разобрано 21 письмо"]);+ expect([1, 3, 5].map((n) => firstHourWords("pl").briefSorted(n))).toEqual(["posortowano 1 e-mail do porannego podsumowania", "posortowano 3 e-maile do porannego podsumowania", "posortowano 5 e-maili do porannego podsumowania"]);expect([1, 2, 5].map((n) => firstHourWords("uk").prepped(n))).toEqual(["підготовлено 1 зустріч", "підготовлено 2 зустрічі", "підготовлено 5 зустрічей"]);expect([1, 4, 12].map((n) => firstHourWords("pl").drafted(n))).toEqual(["napisano 1 szkic odpowiedzi", "napisano 4 szkice odpowiedzi", "napisano 12 szkiców odpowiedzi"]);});diff --git a/server/host/first-hour-words.ts b/server/host/first-hour-words.tsindex ff7442f0bf..db562e8baa 100644--- a/server/host/first-hour-words.ts+++ b/server/host/first-hour-words.ts@@ -17,6 +17,8 @@ export interface FirstHourWords {firstLookReady: string;firstBriefReady: string;sorted: Count;+ /** "sorted" in the day-two recap, naming the morning brief the sorting was for. */+ briefSorted: Count;drafted: Count;prepped: Count;routines: Count;@@ -51,6 +53,7 @@ const en: FirstHourWords = {firstLookReady: "Your first look is ready",firstBriefReady: "Your first brief is ready",sorted: (n) => `sorted ${n} email${n === 1 ? "" : "s"}`,+ briefSorted: (n) => `sorted ${n} email${n === 1 ? "" : "s"} for your morning brief`,drafted: (n) => `drafted ${n} repl${n === 1 ? "y" : "ies"}`,prepped: (n) => `prepped ${n} meeting${n === 1 ? "" : "s"}`,routines: (n) => `ran ${n} routine${n === 1 ? "" : "s"}`,@@ -71,6 +74,7 @@ const de: FirstHourWords = {firstLookReady: "Dein erster Überblick ist fertig",firstBriefReady: "Dein erster Morgenüberblick ist fertig",sorted: (n) => `${n} E-Mail${n === 1 ? "" : "s"} sortiert`,+ briefSorted: (n) => `${n} E-Mail${n === 1 ? "" : "s"} für deinen Morgenüberblick sortiert`,drafted: (n) => `${n} Antwort${n === 1 ? "" : "en"} entworfen`,prepped: (n) => `${n} Termin${n === 1 ? "" : "e"} vorbereitet`,routines: (n) => `${n} Routine${n === 1 ? "" : "n"} ausgeführt`,@@ -91,6 +95,7 @@ const es: FirstHourWords = {firstLookReady: "Tu primer vistazo está listo",firstBriefReady: "Tu primer resumen está listo",sorted: (n) => `ordenado ${n} correo${n === 1 ? "" : "s"}`,+ briefSorted: (n) => `ordenado ${n} correo${n === 1 ? "" : "s"} para tu resumen de la mañana`,drafted: (n) => `redactado ${n} respuesta${n === 1 ? "" : "s"}`,prepped: (n) => `preparado ${n} ${n === 1 ? "reunión" : "reuniones"}`,routines: (n) => `ejecutado ${n} rutina${n === 1 ? "" : "s"}`,@@ -111,6 +116,7 @@ const fr: FirstHourWords = {firstLookReady: "Votre premier tour d’horizon est prêt",firstBriefReady: "Votre premier point du matin est prêt",sorted: (n) => `trié ${n} e-mail${n === 1 ? "" : "s"}`,+ briefSorted: (n) => `trié ${n} e-mail${n === 1 ? "" : "s"} pour votre point du matin`,drafted: (n) => `rédigé ${n} réponse${n === 1 ? "" : "s"}`,prepped: (n) => `préparé ${n} réunion${n === 1 ? "" : "s"}`,routines: (n) => `lancé ${n} routine${n === 1 ? "" : "s"}`,@@ -131,6 +137,7 @@ const it: FirstHourWords = {firstLookReady: "Il tuo primo sguardo d’insieme è pronto",firstBriefReady: "Il tuo primo riepilogo è pronto",sorted: (n) => `smistato ${n} email`,+ briefSorted: (n) => `smistato ${n} email per il riepilogo del mattino`,drafted: (n) => `scritto ${n} bozz${n === 1 ? "a" : "e"} di risposta`,prepped: (n) => `preparato ${n} riunion${n === 1 ? "e" : "i"}`,routines: (n) => `eseguito ${n} routine`,@@ -151,6 +158,7 @@ const ptBr: FirstHourWords = {firstLookReady: "Sua primeira visão geral está pronta",firstBriefReady: "Seu primeiro resumo está pronto",sorted: (n) => `organizei ${n} e-mail${n === 1 ? "" : "s"}`,+ briefSorted: (n) => `organizei ${n} e-mail${n === 1 ? "" : "s"} para o seu resumo da manhã`,drafted: (n) => `rascunhei ${n} resposta${n === 1 ? "" : "s"}`,prepped: (n) => `preparei ${n} reuni${n === 1 ? "ão" : "ões"}`,routines: (n) => `rodei ${n} rotina${n === 1 ? "" : "s"}`,@@ -171,6 +179,7 @@ const ja: FirstHourWords = {firstLookReady: "最初のまとめができました",firstBriefReady: "最初の朝のまとめができました",sorted: (n) => `メール${n}件の仕分け`,+ briefSorted: (n) => `朝のまとめ用のメール${n}件の仕分け`,drafted: (n) => `返信の下書き${n}件`,prepped: (n) => `会議${n}件の準備`,routines: (n) => `ルーティン${n}件の実行`,@@ -191,6 +200,7 @@ const ko: FirstHourWords = {firstLookReady: "첫 살펴보기가 준비됐어요",firstBriefReady: "첫 브리핑이 준비됐어요",sorted: (n) => `이메일 ${n}개 정리`,+ briefSorted: (n) => `아침 브리핑용 이메일 ${n}개 정리`,drafted: (n) => `답장 초안 ${n}개 작성`,prepped: (n) => `회의 ${n}개 준비`,routines: (n) => `루틴 ${n}개 실행`,@@ -211,6 +221,7 @@ const zh: FirstHourWords = {firstLookReady: "你的第一份概览已准备好",firstBriefReady: "你的第一份简报已准备好",sorted: (n) => `整理了 ${n} 封邮件`,+ briefSorted: (n) => `为早间简报整理了 ${n} 封邮件`,drafted: (n) => `起草了 ${n} 封回复`,prepped: (n) => `准备了 ${n} 场会议`,routines: (n) => `运行了 ${n} 个例行任务`,@@ -231,6 +242,7 @@ const zhTw: FirstHourWords = {firstLookReady: "你的第一份概覽已準備好",firstBriefReady: "你的第一份簡報已準備好",sorted: (n) => `整理了 ${n} 封郵件`,+ briefSorted: (n) => `為早晨簡報整理了 ${n} 封郵件`,drafted: (n) => `擬好了 ${n} 封回覆`,prepped: (n) => `準備了 ${n} 場會議`,routines: (n) => `執行了 ${n} 個例行工作`,@@ -251,6 +263,7 @@ const hi: FirstHourWords = {firstLookReady: "आपका पहला जायज़ा तैयार है",firstBriefReady: "आपका पहला सुबह का सार तैयार है",sorted: (n) => `${n} ईमेल छाँटे`,+ briefSorted: (n) => `सुबह के सार के लिए ${n} ईमेल छाँटे`,drafted: (n) => `${n} ${n === 1 ? "जवाब का ड्राफ़्ट" : "जवाबों के ड्राफ़्ट"} लिखे`,prepped: (n) => `${n} ${n === 1 ? "मीटिंग" : "मीटिंगों"} की तैयारी की`,routines: (n) => `${n} रूटीन चलाए`,@@ -272,6 +285,7 @@ const ru: FirstHourWords = {firstLookReady: "Ваш первый обзор готов",firstBriefReady: "Ваша первая утренняя сводка готова",sorted: (n) => `разобрано ${n} ${ruCount(n, { one: "письмо", few: "письма", other: "писем" })}`,+ briefSorted: (n) => `разобрано ${n} ${ruCount(n, { one: "письмо", few: "письма", other: "писем" })} для утренней сводки`,drafted: (n) => `написано ${n} ${ruCount(n, { one: "черновик", few: "черновика", other: "черновиков" })} ответов`,prepped: (n) => `подготовлено ${n} ${ruCount(n, { one: "встреча", few: "встречи", other: "встреч" })}`,routines: (n) => `выполнено ${n} ${ruCount(n, { one: "рутина", few: "рутины", other: "рутин" })}`,@@ -293,6 +307,7 @@ const uk: FirstHourWords = {firstLookReady: "Ваш перший огляд готовий",firstBriefReady: "Ваше перше ранкове зведення готове",sorted: (n) => `розібрано ${n} ${ukCount(n, { one: "лист", few: "листи", other: "листів" })}`,+ briefSorted: (n) => `розібрано ${n} ${ukCount(n, { one: "лист", few: "листи", other: "листів" })} для ранкового зведення`,drafted: (n) => `написано ${n} ${ukCount(n, { one: "чернетку", few: "чернетки", other: "чернеток" })} відповідей`,prepped: (n) => `підготовлено ${n} ${ukCount(n, { one: "зустріч", few: "зустрічі", other: "зустрічей" })}`,routines: (n) => `виконано ${n} ${ukCount(n, { one: "рутину", few: "рутини", other: "рутин" })}`,@@ -314,6 +329,7 @@ const pl: FirstHourWords = {firstLookReady: "Twój pierwszy przegląd jest gotowy",firstBriefReady: "Twoje pierwsze podsumowanie jest gotowe",sorted: (n) => `posortowano ${n} ${plCount(n, { one: "e-mail", few: "e-maile", other: "e-maili" })}`,+ briefSorted: (n) => `posortowano ${n} ${plCount(n, { one: "e-mail", few: "e-maile", other: "e-maili" })} do porannego podsumowania`,drafted: (n) => `napisano ${n} ${plCount(n, { one: "szkic", few: "szkice", other: "szkiców" })} odpowiedzi`,prepped: (n) => `przygotowano ${n} ${plCount(n, { one: "spotkanie", few: "spotkania", other: "spotkań" })}`,routines: (n) => `uruchomiono ${n} ${plCount(n, { one: "rutynę", few: "rutyny", other: "rutyn" })}`,@@ -334,6 +350,7 @@ const vi: FirstHourWords = {firstLookReady: "Bản tổng quan đầu tiên của bạn đã sẵn sàng",firstBriefReady: "Bản tóm tắt đầu tiên của bạn đã sẵn sàng",sorted: (n) => `phân loại ${n} email`,+ briefSorted: (n) => `phân loại ${n} email cho bản tóm tắt buổi sáng`,drafted: (n) => `soạn ${n} bản nháp trả lời`,prepped: (n) => `chuẩn bị cho ${n} cuộc họp`,routines: (n) => `chạy ${n} quy trình`,@@ -354,6 +371,7 @@ const tr: FirstHourWords = {firstLookReady: "İlk genel bakışın hazır",firstBriefReady: "İlk sabah özetin hazır",sorted: (n) => `${n} e-postayı ayıkladım`,+ briefSorted: (n) => `sabah özetin için ${n} e-postayı ayıkladım`,drafted: (n) => `${n} yanıt taslağı yazdım`,prepped: (n) => `${n} toplantıya hazırlık yaptım`,routines: (n) => `${n} rutini çalıştırdım`,diff --git a/server/host/first-hour.test.ts b/server/host/first-hour.test.tsindex 0b68618398..1b9cd2700f 100644--- a/server/host/first-hour.test.ts+++ b/server/host/first-hour.test.ts@@ -247,7 +247,7 @@ describe("a new Cloud's first hour", () => {s.set("2026-10-28T12:00:00Z");fh.tick();fh.tick();- expect(s.texts().filter((text) => text?.startsWith("So far"))).toEqual(["So far I've sorted 40 emails, drafted 6 replies and prepped 4 meetings: about 2 hours back."]);+ expect(s.texts().filter((text) => text?.startsWith("So far"))).toEqual(["So far I've sorted 40 emails for your morning brief, drafted 6 replies and prepped 4 meetings: about 2 hours back."]);expect(fh.tally()).toEqual({ sorted: 40, drafted: 6, prepped: 4, routines: 0 });});@@ -265,7 +265,7 @@ describe("a new Cloud's first hour", () => {expect(s.texts().filter((text) => text?.startsWith("So far"))).toEqual([]);s.store.appendMessage(s.thread(), { role: "bot", kind: "widget", text: "Pick one", turnId: "turn-1" });fh.tick();- expect(s.texts().at(-1)).toBe("So far I've sorted 29 emails: about 30 minutes back.");+ expect(s.texts().at(-1)).toBe("So far I've sorted 29 emails for your morning brief: about 30 minutes back.");});it("counts a routine's posted results in the recap, and says nothing at all when nothing was done", () => {diff --git a/server/host/first-hour.ts b/server/host/first-hour.tsindex bf431e3099..6414cbb73f 100644--- a/server/host/first-hour.ts+++ b/server/host/first-hour.ts@@ -368,9 +368,9 @@ export function createFirstHour(deps: FirstHourDeps) {}/** What was done, in the person's words, or undefined when nothing was. */- function doneLine(counts: Partial<ValueTally>, w: FirstHourWords): string | undefined {+ function doneLine(counts: Partial<ValueTally>, w: FirstHourWords, sorted = w.sorted): string | undefined {const items = [- counts.sorted ? w.sorted(counts.sorted) : "",+ counts.sorted ? sorted(counts.sorted) : "",counts.drafted ? w.drafted(counts.drafted) : "",counts.prepped ? w.prepped(counts.prepped) : "",counts.routines ? w.routines(counts.routines) : "",@@ -391,7 +391,7 @@ export function createFirstHour(deps: FirstHourDeps) {return;}const w = words();- say(place.bot, place.threadId, w.recap(doneLine(counts, w)!, w.time(minutesSaved(counts))));+ say(place.bot, place.threadId, w.recap(doneLine(counts, w, w.briefSorted)!, w.time(minutesSaved(counts))));mark({ recapAt: at });}