Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Keep pictures-held Steer notices on the displayed conversation
koeriada25c877a196
diff --git a/src/state/store.test.ts b/src/state/store.test.tsindex ab45ffbcd7..b7ef8290ea 100644--- a/src/state/store.test.ts+++ b/src/state/store.test.ts@@ -3017,6 +3017,7 @@ describe("restoring the open conversation", () => {expect(seen.notice).toEqual({ kind: "steer-images", botName: null, threadId: "bot-1-thread" });flushSync(() => dispatch({ type: "notice", notice: null }));+ flushSync(() => dispatch({ type: "select", id: "room-1" }));flushSync(() => dispatch({ type: "steerGroupQueued", groupId: "room-1", queueId: "q-room", onSettled: settled }));await settle();expect(settled).toHaveBeenCalledTimes(3);@@ -3082,6 +3083,37 @@ describe("restoring the open conversation", () => {expect(seen.notice).toEqual({ kind: "thread-gone", botName: "bot-1" });});+ it("clears a pictures notice while the next task snapshot is still pending", async () => {+ const { stream } = await boot();+ stream.send(hello());+ await settle();+ vi.stubGlobal("fetch", () => new Promise<Response>(() => {}));+ flushSync(() => dispatch({ type: "notice", notice: { kind: "steer-images", botName: null, threadId: "bot-1-thread" } }));+ flushSync(() => dispatch({ type: "switchTask", botId: "bot-1", threadId: "task-b" }));+ expect(seen.bots.find((bot) => bot.id === "bot-1")).toMatchObject({ threadId: "bot-1-thread", switchingTo: "task-b" });+ expect(seen.notice).toBeNull();+ flushSync(() => dispatch({ type: "notice", notice: { kind: "steer-images", botName: null, threadId: "task-b" } }));+ expect(seen.notice).toMatchObject({ threadId: "task-b" });+ });++ it("ignores a pictures-held response arriving after navigation without erasing the current notice", async () => {+ const { stream } = await boot();+ stream.send(hello());+ await settle();+ let respond!: (response: Response) => void;+ vi.stubGlobal("fetch", () => new Promise<Response>((resolve) => { respond = resolve; }));+ const settled = vi.fn();+ flushSync(() => dispatch({ type: "steerQueued", botId: "bot-1", queueId: "delayed-image", onSettled: settled }));+ await settle();+ flushSync(() => dispatch({ type: "select", id: "bot-2" }));+ const current = { kind: "steer-images" as const, botName: null, threadId: "bot-2-thread" };+ flushSync(() => dispatch({ type: "notice", notice: current }));+ respond(new Response(JSON.stringify({ ok: true, queued: true, threadId: "bot-1-thread", blockedBy: "images" })));+ await settle();+ expect(settled).toHaveBeenCalledOnce();+ expect(seen.notice).toEqual(current);+ });+it("the provider restores the conversation remembered on this device", async () => {const { stored, stream } = await boot({ [LAST_CONVERSATION_KEY]: "room-1" });stream.send(hello());diff --git a/src/state/store.tsx b/src/state/store.tsxindex 16cdcc6c65..b6a43974e4 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -2247,7 +2247,8 @@ export function StoreProvider({ children }: { children: ReactNode }) {if (action.type !== "send") return undefined;return botBeforeSend ? openOnboardingCard(botBeforeSend) : undefined;})();- const threadOf = (s: AppState) => s.groups.find((g) => g.id === s.selectedId)?.threadId ?? s.bots.find((b) => b.id === s.selectedId)?.threadId, previousOpened = threadOf(store.getState());+ const threadOf = (s: AppState) => { const bot = s.bots.find((b) => b.id === s.selectedId); return s.groups.find((g) => g.id === s.selectedId)?.threadId ?? bot?.switchingTo ?? bot?.threadId; }, previousOpened = threadOf(store.getState());+ if (action.type === "notice" && action.notice?.kind === "steer-images" && action.notice.threadId !== previousOpened) return;if (action.type !== "cancelQueued" &&action.type !== "cancelGroupQueued" &&