Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Brief cards: number the email buttons only when two emails share a sender
milind-soni7ecd7e147281
diff --git a/server/host/brief-cards.test.ts b/server/host/brief-cards.test.tsindex 1087161747..02f9473425 100644--- a/server/host/brief-cards.test.ts+++ b/server/host/brief-cards.test.ts@@ -99,6 +99,18 @@ describe("the brief's cards", () => {expect(english["brief.card.numberedEmailAction"]).toBe("{number}. {action}");});+ it("leaves the buttons unnumbered when every email has its own sender", () => {+ const emails = [+ { messageId: "m1", threadId: "t1", from: "Ada <[email protected]>", subject: "Q3 numbers", needsReply: true },+ { messageId: "m2", threadId: "t2", from: "Grace <[email protected]>", subject: "Friday agenda", needsReply: false },+ ];+ const parsed = parseWidgetInput(briefCard({ now: NOW, timeZone: "UTC", intro: false, meetings: null, emails, needs: [], routines: [] }).card);+ expect(parsed.ok, parsed.ok ? "" : parsed.error).toBe(true);+ if (!parsed.ok) return;+ expect(widgetActions(parsed.value).filter((entry) => entry.action.type === DRAFT_ACTION || entry.action.type === DISMISS_ACTION).map((entry) => entry.label))+ .toEqual(["Draft a reply to Ada", "Dismiss Ada's email", "Draft a reply to Grace", "Dismiss Grace's email"]);+ });+it("name a routine's Open page button", () => {const card = briefCard({ ...facts, routines: [{ text: "Digest", note: "Done", page: "https://pages.example.com/p/1" }] }).card;const json = JSON.stringify(card);diff --git a/server/host/brief-cards.ts b/server/host/brief-cards.tsindex e88efa38e4..467c85e6bc 100644--- a/server/host/brief-cards.ts+++ b/server/host/brief-cards.ts@@ -218,7 +218,9 @@ export function briefCard(facts: BriefFacts): BuiltCard {const w = briefWords(language);const replies = facts.emails.filter((email) => email.needsReply);const important = facts.emails.filter((email) => !email.needsReply);- const place = (index: number): number | undefined => (facts.emails.length > 1 ? index + 1 : undefined);+ // Numbered only when two emails share a sender, whose buttons would otherwise read the same.+ const senders = facts.emails.map((email) => sender(email, BRIEF_TEXT.label, w));+ const place = (index: number): number | undefined => (new Set(senders).size < senders.length ? index + 1 : undefined);const needRows = [...replies.map((email, index) => emailRow(email, w, place(index))), ...facts.needs.map((row) => rowBeside(row.text, row.note, openButton(row.open, w), row.said))];const meetings = [...(facts.meetings ?? [])].sort((a, b) => a.start - b.start);const meetingRows = meetings.map((meeting) => rowBeside(`${clockTime(meeting.start, zone, language)} · ${meeting.title}`, "", joinButton(meeting, w.join),