Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

#6433: the open row gets the plain grey fill, and the inbox view keeps its settled lines

milind-soni7616670cbac1
diff --git a/server/host/place-inbox.ts b/server/host/place-inbox.ts
index 1d8442e26c..3b62e620fc 100644
--- a/server/host/place-inbox.ts
+++ b/server/host/place-inbox.ts
@@ -25,8 +25,6 @@ const MAX_LINES = 2_000;
const MAX_SEEN_ASKS = 2_000;
const KEEP_MS = 30 * 24 * 60 * 60_000;
const VIEW_ROWS = 200;
-/** How many finished, already-read lines the inbox keeps under its active list. */
-const SETTLED_ROWS = 5;
const ROW_TEXT_MAX = 4_000;
const NOTICE_TEXT_MAX = 2_000;
const HOUR_MS = 60 * 60_000;
@@ -194,11 +192,8 @@ export function createPlaceInbox(deps: PlaceInboxDeps) {
function view(auth: RequestAuth): InboxView {
const visible = [...askRows(auth), ...lines.filter((line) => lineFor(auth, line)).map(lineRow)].sort((a, b) => b.at - a.at);
- // The finished lines the list would otherwise drop follow the active ones, so the panel can show them in its
- // own Finished list instead of losing them the moment they are read.
- const listed = visible.filter((row) => row.tab !== "done");
- const settled = visible.filter((row) => row.tab === "done" && row.kind !== "ask").slice(0, SETTLED_ROWS);
- const rows = [...listed, ...settled].slice(0, VIEW_ROWS + SETTLED_ROWS);
+ // 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 --git a/src/components/SidebarBotActivity.tsx b/src/components/SidebarBotActivity.tsx
index 6193483f4f..5e6bb8639b 100644
--- a/src/components/SidebarBotActivity.tsx
+++ b/src/components/SidebarBotActivity.tsx
@@ -8,6 +8,7 @@ import { isArchived, orderedSidebarThreads, orderedThreadList, threadRecency, th
import type { SidebarDensity } from "@/lib/sidebar-preferences";
import { localizedTaskTitle } from "@/lib/task-title";
import { endedOnFailure } from "@/lib/mascot";
+import { rowSelectedSurface } from "./SidebarRowMarkers";
export function sidebarBotActivityTasks(bot: Bot, queued: Record<string, unknown[]>, archivedApprovals = false): Array<Task & { queued: boolean }> {
const tasks = bot.tasks ?? [{
@@ -87,8 +88,8 @@ export function isOpenThread(entry: AttentionThread, open: OpenThread | undefine
return open.kind === "group" && entry.groupId === open.groupId;
}
-/** The row of the conversation the chat window has open: a tint, a left accent bar and an inset outline read as one mark at a glance. */
-export const openThreadRow = "bg-accent/15 shadow-[inset_3px_0_0_0_var(--color-accent)] ring-1 ring-inset ring-accent/30 hover:bg-accent/20";
+/** The row of the conversation the chat window has open: the plain fill a selected sidebar row has. */
+export const openThreadRow = rowSelectedSurface;
export function attentionOwnerName(entry: AttentionThread): string {
return entry.kind === "bot" ? entry.botName : entry.groupName;
@@ -178,7 +179,7 @@ export function AttentionThreadRows({ entries, onJump, inset = false, unreadDot
entries: AttentionThread[]; onJump: (entry: AttentionThread) => void; inset?: boolean;
/** Mark an unread conversation with a dot and a heavier title, the way the Inbox's own rows are marked. */
unreadDot?: boolean;
- /** The conversation the chat window has open, tinted like a selected sidebar row. */
+ /** The conversation the chat window has open, marked like a selected sidebar row. */
current?: OpenThread;
}) {
return <>
diff --git a/src/components/inbox/FinishedThreads.tsx b/src/components/inbox/FinishedThreads.tsx
index e9a58519ab..7b26d4b2ed 100644
--- a/src/components/inbox/FinishedThreads.tsx
+++ b/src/components/inbox/FinishedThreads.tsx
@@ -64,7 +64,7 @@ export function FinishedThreads({ bots, groups, queued, readThreads, exclude, no
exclude?: ReadonlySet<string>;
/** The clock the row's last-activity label is relative to. */
now: number;
- /** The conversation the chat window has open, tinted like a selected sidebar row. */
+ /** The conversation the chat window has open, marked like a selected sidebar row. */
current?: OpenThread;
onOpen(row: FinishedThread): void;
}) {
diff --git a/src/components/inbox/PinnedThreads.tsx b/src/components/inbox/PinnedThreads.tsx
index e9692208b7..f1a8289b21 100644
--- a/src/components/inbox/PinnedThreads.tsx
+++ b/src/components/inbox/PinnedThreads.tsx
@@ -24,7 +24,7 @@ export function PinnedThreads({ bots, groups, queued, now, current, onOpen, onUn
queued: Record<string, unknown[]>;
/** The clock each row's last-activity label is relative to. */
now: number;
- /** The conversation the chat window has open, tinted like a selected sidebar row. */
+ /** The conversation the chat window has open, marked like a selected sidebar row. */
current?: OpenThread;
onOpen(row: AttentionThread): void;
onUnpin(row: AttentionThread): void;
diff --git a/src/components/inbox/attention-read.test.ts b/src/components/inbox/attention-read.test.ts
index 504e8e2cae..079a4c7283 100644
--- a/src/components/inbox/attention-read.test.ts
+++ b/src/components/inbox/attention-read.test.ts
@@ -44,7 +44,7 @@ const open = (selectedId: string, activeView = "chat") =>
Pick<AppState, "activeView" | "selectedId" | "bots" | "groups">);
describe("inboxOpenThread", () => {
- it("names the open bot thread or room thread so both lists can tint that row", () => {
+ it("names the open bot thread or room thread so both lists can mark that row", () => {
expect(inboxOpenThread(open("eli"))).toEqual({ kind: "bot", botId: "eli", threadId: "eli-main" });
expect(inboxOpenThread(open("room"))).toEqual({ kind: "group", groupId: "room", threadId: "room-thread" });
});
diff --git a/src/components/inbox/finished.dom.test.ts b/src/components/inbox/finished.dom.test.ts
index 06bf14ed82..441456bc4e 100644
--- a/src/components/inbox/finished.dom.test.ts
+++ b/src/components/inbox/finished.dom.test.ts
@@ -38,12 +38,12 @@ describe("the finished list", () => {
expect(stamps[0]!.getAttribute("dateTime")).toBe(new Date(NOW - 5 * 60_000).toISOString());
});
- it("tints the conversation the chat window has open, and only that one", async () => {
+ it("marks the conversation the chat window has open, and only that one", async () => {
const bots = [bot("eli", [task("open", { updatedAt: NOW }), task("elsewhere", { updatedAt: NOW - 60_000 })])];
await mount(bots, [], { kind: "bot", botId: "eli", threadId: "open" });
const rows = [...document.querySelectorAll<HTMLElement>("[data-inbox-finished] button")];
expect(rows.map((row) => row.getAttribute("aria-current"))).toEqual(["page", null]);
expect(rows.map((row) => row.hasAttribute("data-open-thread"))).toEqual([true, false]);
- expect(rows[0]!.className).toContain("bg-accent/15");
+ expect(rows[0]!.className.split(" ")).toContain("bg-raised");
});
});
diff --git a/src/components/inbox/pinned.dom.test.ts b/src/components/inbox/pinned.dom.test.ts
index 180c2b3320..35a4ea48eb 100644
--- a/src/components/inbox/pinned.dom.test.ts
+++ b/src/components/inbox/pinned.dom.test.ts
@@ -55,12 +55,12 @@ describe("the pinned section", () => {
expect(stamp?.getAttribute("dateTime")).toBe(new Date(NOW - 5 * 60_000).toISOString());
});
- it("tints the conversation the chat window has open, and only that one", async () => {
+ it("marks the conversation the chat window has open, and only that one", async () => {
await mount([bot("eli", [task("open", { pinned: true }), task("elsewhere", { pinned: true, updatedAt: NOW - 60_000 })])],
[], { kind: "bot", botId: "eli", threadId: "open" });
const rows = [...document.querySelectorAll<HTMLElement>("[data-pinned-row]")];
expect(rows.map((row) => row.getAttribute("aria-current"))).toEqual(["page", null]);
- expect(rows[0]!.className).toContain("bg-accent/15");
+ expect(rows[0]!.className.split(" ")).toContain("bg-raised");
});
it("gathers a room's pinned conversation too", async () => {