Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Place a waiting unread divider when a reload or reselect brings the boundary in
AdityaUmaledaa236b8ad08
diff --git a/src/lib/unread-divider.test.ts b/src/lib/unread-divider.test.tsindex ce2f31d410..0003c9f49e 100644--- a/src/lib/unread-divider.test.ts+++ b/src/lib/unread-divider.test.ts@@ -135,6 +135,17 @@ describe("the divider in the store", () => {}});+ it("places a waiting divider when a reload or reselect brings the boundary in", () => {+ const full = ["b1", "b2", "b3", "b4", "b5"].map((id) => line(id, "bot"));+ const tasks = [{ threadId: "pepper-a", title: "A", createdAt: 1, lastReadMessageId: "b1" }];+ const short = { ...base, bots: [bot("other"), bot("pepper", { unread: true, hasMore: true, messages: full.slice(3), tasks: [{ ...tasks[0]!, unread: true }] })] };+ const opened = reducer(short, { type: "select", id: "pepper" });+ expect(opened.unreadDivider?.messageId ?? null).toBeNull();+ const read = bot("pepper", { messages: full, tasks });+ expect(reducer(opened, { type: "hydrate", bots: [bot("other"), read], groups: [], computerControl: {} }).unreadDivider).toEqual({ threadId: "pepper-a", messageId: "b2" });+ expect(reducer({ ...opened, bots: [bot("other"), read] }, { type: "select", id: "pepper" }).unreadDivider).toEqual({ threadId: "pepper-a", messageId: "b2" });+ });+it("is dropped once done, only for its own conversation", () => {const opened = reducer(base, { type: "select", id: "pepper" });expect(reducer(opened, { type: "unreadDividerDone", threadId: "elsewhere" })).toBe(opened);diff --git a/src/state/store.tsx b/src/state/store.tsxindex e672711638..43e3f3547a 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -400,7 +400,7 @@ function taskPatchFields(patch: TaskUpdatePatch): Partial<Task> {}function openedUnreadDivider(state: AppState, threadId: string, unread: boolean, messages: readonly Message[], lastReadMessageId?: string, hasMore?: boolean): AppState["unreadDivider"] {- return unread ? unreadDividerFor(threadId, messages, lastReadMessageId, hasMore) : state.unreadDivider?.threadId === threadId ? state.unreadDivider : null;+ return unread ? unreadDividerFor(threadId, messages, lastReadMessageId, hasMore) : placeUnreadDivider(state.unreadDivider?.threadId === threadId ? state.unreadDivider : null, threadId, messages, Boolean(hasMore));}import type { BrowserEngineSummary, BrowserProfile, ConfigStatus, ManagedPolicySummary } from "./config-status";@@ -931,6 +931,8 @@ export function reducer(state: AppState, action: Action): AppState {transcriptGeneration: {},modelVariantSessions: {},};+ const held = [...hydrated.bots, ...hydrated.groups].find((owner) => owner.threadId === state.unreadDivider?.threadId);+ if (held) hydrated.unreadDivider = placeUnreadDivider(state.unreadDivider, held.threadId, visibleMessages(held), Boolean(held.hasMore));return reconcileSnapshotQueues(action.botQueuedMessages ? replaceBotQueues(hydrated, action.botQueuedMessages) : hydrated,[...action.bots, ...action.groups],