Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Merge remote-tracking branch 'origin/main' into train/nov18-w5
milind-sonifef6a4572c26
diff --cc server/host/place-inbox.tsindex 3b62e620fc,9d2ae0b2a2..daeaa607d1--- a/server/host/place-inbox.ts+++ b/server/host/place-inbox.ts@@@ -184,16 -184,21 +184,23 @@@ export function createPlaceInbox(deps:return [...rows.values()];}- const lineRow = (line: Line): InboxRow => ({- id: line.id, kind: line.kind, tab: lineTab(line), from: { name: line.from, botId: line.botId }, ...(line.workingFor ? { workingFor: line.workingFor } : {}),- origin: { botId: line.botId, threadId: line.threadId, title: titleOf(line.botId, line.threadId), ...(line.groupId ? { groupId: line.groupId } : {}), messageId: line.id },- text: clip(line.text, ROW_TEXT_MAX), at: line.at, unread: !line.seen, ...(line.kind === "message" ? { replies: true as const } : {}),- });+ /** The message a line points at: its own message, or the newest one in the conversation it came from, so a client+ * can put the person at it. */+ const focusOf = (line: Line): string | undefined => line.kind === "message" ? line.id : store.messagesFor(line.threadId).at(-1)?.id;++ const lineRow = (line: Line): InboxRow => {+ const focus = focusOf(line);+ return {+ id: line.id, kind: line.kind, tab: lineTab(line), from: { name: line.from, botId: line.botId }, ...(line.workingFor ? { workingFor: line.workingFor } : {}),+ origin: { botId: line.botId, threadId: line.threadId, title: titleOf(line.botId, line.threadId), ...(line.groupId ? { groupId: line.groupId } : {}), ...(focus ? { messageId: focus } : {}) },+ text: clip(line.text, ROW_TEXT_MAX), at: line.at, unread: !line.seen, ...(line.kind === "message" ? { replies: true as const } : {}),+ };+ };function view(auth: RequestAuth): InboxView {- const rows = [...askRows(auth), ...lines.filter((line) => lineFor(auth, line)).map(lineRow)].sort((a, b) => b.at - a.at).slice(0, VIEW_ROWS);+ const visible = [...askRows(auth), ...lines.filter((line) => lineFor(auth, line)).map(lineRow)].sort((a, b) => b.at - a.at);+ // What is still active comes first, so settled lines never push it out of the view; settled ones fill the rest.+ const rows = [...visible.filter((row) => row.tab !== "done"), ...visible.filter((row) => row.tab === "done")].slice(0, VIEW_ROWS);return { botId: null, threadId: null, rows, anchor: null };}diff --cc src/components/inbox/InboxPanel.dom.test.tsindex 745d5bb441,ebb6ccada2..96aa616966--- a/src/components/inbox/InboxPanel.dom.test.ts+++ b/src/components/inbox/InboxPanel.dom.test.ts@@@ -18,8 -18,8 +18,8 @@@ vi.mock("../../state/api", () => (import { initialState, StoreContext, type AppState, type Bot } from "@/state/store";import { BOT_BUTTON, botButtonTone } from "@/lib/bot-button";import { closeInbox, currentInbox, currentInboxPanel, inboxVersion, openInbox, setInboxView, useInboxLoader } from "@/state/inbox";-import { approvalRow, inboxView, messageRow, questionRow, reportRow, settledRow } from "@/testing/inbox-fixture";+import { approvalRow, INBOX_NOW, inboxView, messageRow, questionRow, reportRow, settledRow } from "@/testing/inbox-fixture";- import type { InboxView } from "../../../shared/inbox";+ import type { InboxRow, InboxView } from "../../../shared/inbox";import { InboxCardSlot } from "./InboxCard";import { InboxPanel } from "./InboxPanel";diff --cc src/components/inbox/InboxPanel.tsxindex 3ad4a46170,a31c6e21c5..5d6dd9d535--- a/src/components/inbox/InboxPanel.tsx+++ b/src/components/inbox/InboxPanel.tsx@@@ -41,11 -36,14 +41,17 @@@ export function InboxPanel()else closeInbox();};const reading = panel.reading ? view?.rows.find((row) => row.id === panel.reading) : undefined;- const open = (row: InboxRow) => { readInboxRow(row); readInboxLine(row.id); };+ /** An ask waits for an answer here and a message waits for a reply, so those open in the panel; finished work opens+ * the conversation it came from, at the message it is about. */+ const open = (row: InboxRow) => {+ readInboxRow(row);+ if (row.tab === "needs-you" || row.replies) { readInboxLine(row.id); return; }+ openInChat(row);+ };- const rows = listedRows(view).filter((row) => matchesSearch(row, query));+ // The notice list is upstream's: a read line stays until the person marks it done. Reading a conversation moves the+ // conversation to Finished; it does not remove the notice it came from.+ const listed = listedRows(view);+ const rows = listed.filter((row) => matchesSearch(row, query));const ids = rows.map((row) => row.id);const at = reading ? ids.indexOf(reading.id) : -1;@@@ -65,11 -63,9 +71,11 @@@const step = (by: -1 | 1) => {const row = rows[at + by];- if (row) open(row);+ if (row) { readInboxRow(row); readInboxLine(row.id); }};- const count = waitingCount(view);+ const pinnedThreads = new Set(pinnedThreadRows(state.bots, state.groups, state.pendingQueued).map((row) => row.task.threadId));+ const count = waitingCount(view) + unreadConversations(inboxAttentionEntries(state, view), view);+ const openThread = inboxOpenThread(state);const body = (<><div className="flex h-[50px] shrink-0 items-start gap-2.5 px-[13px] pt-[13px]">