Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix: keep reactions and app-card wording when replying to the add-a-key card
AdityaUmalefd3410cef2ca
diff --git a/server/replies.test.ts b/server/replies.test.tsindex 201fd85358..8cad62ba7c 100644--- a/server/replies.test.ts+++ b/server/replies.test.ts@@ -34,6 +34,15 @@ describe("the app's own add-a-key suggestion", () => {expect(replied).toContain("a card shown to the person in this chat, which you did not write");expect(replied).not.toContain("from Assistant");});++ it("keeps the person's reaction, and stays a card the bot did not write when it is a widget", () => {+ const card = message({ kind: "widget", text: "Want me to sort your email for free? Add a key.", setupSuggestion: { kind: "helperKey" } });+ const reacted = message({ id: "m2", role: "user", text: "π", replyToId: "m1", reaction: "π" });+ expect(transcriptText(reacted, new Map([["m1", card]]))).toMatch(/^\[reacted π to a card shown in this chat\]\n\[Records from a card shown/);+ const typed = promptWithReply("what is this?", card);+ expect(typed).toContain("a card shown to the person in this chat, which you did not write");+ expect(typed).not.toContain("a widget you showed");+ });});describe("flat replies", () => {diff --git a/server/replies.ts b/server/replies.tsindex a28ee4b8b4..af680d3184 100644--- a/server/replies.ts+++ b/server/replies.ts@@ -76,7 +76,7 @@ const WIDGET_WORDS = {function promptWithWidget(text: string, target: ReplyTarget): string {const press = target.widgetPress;const excerpt = inFence(replyExcerpt(target.text ?? ""));- const words = target.serverCard ? WIDGET_WORDS.server : WIDGET_WORDS.bot;+ const words = appCard(target) ? WIDGET_WORDS.server : WIDGET_WORDS.bot;if (!press) {return [`The current message is a reply to ${words.shown}. The person typed it; they did not press anything on the widget.`,@@ -194,7 +194,7 @@ export function transcriptText(stored: Message, messagesById: ReadonlyMap<stringconst target = quoted ? { ...quoted, text: contextText(quoted) } : undefined;if (!target?.text) return message.text;const excerpt = replyExcerpt(target.text, 220);- if (appCard(target)) return `[answering a card shown in this chat]\n${cardRecords(excerpt)}\n${message.text}`;+ if (appCard(target)) return `[${message.reaction ? `reacted ${message.reaction} to` : "answering"} a card shown in this chat]\n${cardRecords(excerpt)}\n${message.text}`;if (message.reaction) return `[reacted ${message.reaction} to ${replySpeaker(target, userName)}: β${excerpt}β]`;if (target.kind === "app") {return message.fromApp