Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Rooms: a feed of threads with the thread beside it, behind a switch (#7397)
Milind Soni680499b67e0f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 5dbe889a94..ba58fea04d 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -607,7 +607,7 @@ jobs:env:OMB_UI_E2E: "1"OMB_UI_EVIDENCE_DIR: .omb-scratch/verify-evidence- run: pnpm exec vitest run scripts/testing/control-omb-ui.e2e.test.ts scripts/testing/bot-tools-ui.e2e.test.ts scripts/testing/thinking-timer-ui.e2e.test.ts scripts/testing/team-share-ui.e2e.test.ts scripts/testing/org-library-ui.e2e.test.ts scripts/testing/browser-evidence.e2e.test.ts scripts/testing/browser-fill.e2e.test.ts scripts/testing/browser-input.e2e.test.ts scripts/testing/rich-table-composer-ui.e2e.test.ts scripts/testing/computer-panel-focus-ui.e2e.test.ts scripts/testing/mobile-code-blocks-ui.e2e.test.ts scripts/testing/inline-page-height-ui.e2e.test.ts scripts/testing/room-pages-ui.e2e.test.ts+ run: pnpm exec vitest run scripts/testing/control-omb-ui.e2e.test.ts scripts/testing/bot-tools-ui.e2e.test.ts scripts/testing/thinking-timer-ui.e2e.test.ts scripts/testing/team-share-ui.e2e.test.ts scripts/testing/org-library-ui.e2e.test.ts scripts/testing/browser-evidence.e2e.test.ts scripts/testing/browser-fill.e2e.test.ts scripts/testing/browser-input.e2e.test.ts scripts/testing/rich-table-composer-ui.e2e.test.ts scripts/testing/computer-panel-focus-ui.e2e.test.ts scripts/testing/mobile-code-blocks-ui.e2e.test.ts scripts/testing/inline-page-height-ui.e2e.test.ts scripts/testing/room-pages-ui.e2e.test.ts scripts/testing/room-feed-ui.e2e.test.ts- name: Upload the renderer screenshotuses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1if: always()diff --git a/DESIGN.md b/DESIGN.mdindex 1a876552f7..a4822fdcc1 100644--- a/DESIGN.md+++ b/DESIGN.md@@ -57,7 +57,7 @@ where they belong instead of adding new places.the behaviour automatic with a good default. An optional field on somethingthe person sets up is fine. One exception: **Settings → Features**, a shortlist of plain on/off switches for whole features some people don't want- (Skill Burger, thread tabs). It's there so+ (Skill Burger, thread tabs, room feed). It's there soSimple mode can turn off one feature at a time without switching toAdvanced. A switch goes there only when its off state is clean: the featureis hidden whole, and nothing the person made is lost.@@ -194,6 +194,12 @@ element's job and never a pixel value:36px avatar; every row hovers at `bg-ink/[0.06]`. The sidebar is 280px widein both modes; pinned bots are 95 × 92px tiles with a 60px avatar. Pinnedpages never join them: a bot's pages are in its bot panel's Library tab.+- **With Room feed on, a room is a feed of its threads.** Each row is a+ thread's first line, its reply count, who replied and when; a row, a room+ thread opened from anywhere, and an Inbox line open their thread in a panel+ beside the chat (`ForkPanel`), never by moving the room's current thread,+ which is everyone's. The feed's composer starts a new thread. Below 768px the+ room is today's single transcript.- **The sidebar stays open beside a side panel** while the chat keeps 440px:from 1040px with a 320px panel (a room, Simple's inbox, Notifications), from1280px with a wider one. Narrower, it folds to its avatars.diff --git a/packages/phone-protocol/src/room-threads.ts b/packages/phone-protocol/src/room-threads.tsnew file mode 100644index 0000000000..e6aec524b8--- /dev/null+++ b/packages/phone-protocol/src/room-threads.ts@@ -0,0 +1,23 @@+/** Who said a line in a room: one of its bots, or a person (`id` and `name` from their `sender`; neither for the+ * server's own profile person). */+export type RoomThreadSpeaker = { botId: string } | { person: { id?: string; name?: string } };++/** One of a room's threads as its feed shows it. `first` is the thread's first conversation line, its text clamped to+ * ROOM_THREAD_FIRST_CHARS (`clipped` when cut); null while the thread has no line yet. `replies` counts the conversation+ * lines after it, on every branch of the thread; `repliers` are the latest distinct speakers of those, newest first, at+ * most ROOM_THREAD_REPLIERS. */+export interface RoomThreadSummary {+ threadId: string;+ first: { text: string; clipped?: true; speaker: RoomThreadSpeaker; at: number } | null;+ replies: number;+ lastReplyAt: number | null;+ repliers: RoomThreadSpeaker[];+}++/** GET /api/groups/:id/threads/summary: the room's threads that are not archived. */+export interface RoomThreadSummariesResponse {+ threads: RoomThreadSummary[];+}++export const ROOM_THREAD_FIRST_CHARS = 400;+export const ROOM_THREAD_REPLIERS = 5;diff --git a/scripts/ci-scope.mjs b/scripts/ci-scope.mjsindex 99ff822fd4..b18263a8fe 100644--- a/scripts/ci-scope.mjs+++ b/scripts/ci-scope.mjs@@ -162,6 +162,7 @@ export const VITEST_SUBSETS = {"server/routine-requests.test.ts","server/cloud-send-arrived.test.ts","server/cloud-team-bot-access.e2e.test.ts",+ "server/room-thread-summaries.e2e.test.ts","server/cloud-team-one-answer.e2e.test.ts","server/cloud-team-preference.e2e.test.ts","server/cloud-team-rules.e2e.test.ts",diff --git a/scripts/ci-scope.test.ts b/scripts/ci-scope.test.tsindex f82d13afbb..f03d388d63 100644--- a/scripts/ci-scope.test.ts+++ b/scripts/ci-scope.test.ts@@ -302,6 +302,7 @@ describe("CI outputs", () => {"server/routine-requests.test.ts","server/cloud-send-arrived.test.ts","server/cloud-team-bot-access.e2e.test.ts",+ "server/room-thread-summaries.e2e.test.ts","server/cloud-team-one-answer.e2e.test.ts","server/cloud-team-preference.e2e.test.ts","server/cloud-team-rules.e2e.test.ts",diff --git a/scripts/testing/room-feed-ui.e2e.test.ts b/scripts/testing/room-feed-ui.e2e.test.tsnew file mode 100644index 0000000000..2fe1db5533--- /dev/null+++ b/scripts/testing/room-feed-ui.e2e.test.ts@@ -0,0 +1,116 @@+// A room as a feed of its threads, in the real renderer: with Settings → Features → Room feed on, a room of two bots+// shows each thread's first line and its replies, a row opens its thread beside the feed, and a line sent from the+// feed's composer starts a thread of its own there while the room's current thread stays where it was. With the switch+// off the room is its single transcript again. Needs the pinned agent-browser binary: runs when one resolves (tools+// directory, OMB_AGENT_BROWSER_PATH or PATH) or OMB_UI_E2E=1 asks for the verified download; otherwise skipped.+import { spawn } from "node:child_process";+import { existsSync, mkdtempSync, readFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join, resolve } from "node:path";+import { fileURLToPath } from "node:url";+import { afterAll, expect, it } from "vitest";++import { resolveAgentBrowserBinary } from "../../server/browser-engine.ts";+import { removeTempDir, waitForExit } from "../../server/testing/cleanup.ts";+import { runControlOmb } from "../control-omb.ts";+import { agentBrowser, sessionEnv, UI_TOOLS_DIR, type UiHandle } from "./control-omb-ui.ts";+import { fixtureApi } from "./preview-fixture.ts";++const ROOT = fileURLToPath(new URL("../..", import.meta.url));+const forced = process.env.OMB_UI_E2E === "1";+const enabled = forced || Boolean(resolveAgentBrowserBinary({ dataDir: UI_TOOLS_DIR, env: process.env }));+if (!enabled) console.log("skipping room feed ui e2e: no agent-browser binary resolves; set OMB_UI_E2E=1 to install the pinned release");+const LAUNCH_TIMEOUT_MS = forced ? 600_000 : 180_000;++const evidenceDir = process.env.OMB_UI_EVIDENCE_DIR ? resolve(ROOT, process.env.OMB_UI_EVIDENCE_DIR) : mkdtempSync(join(tmpdir(), "omb-ui-evidence-"));+afterAll(async () => { if (!process.env.OMB_UI_EVIDENCE_DIR) await removeTempDir(evidenceDir); });++async function launch(): Promise<{ child: ReturnType<typeof spawn>; info: { ui: string; url: string; botId: string; dataDir: string } }> {+ const child = spawn(process.execPath, ["--experimental-strip-types", join(ROOT, "scripts", "control-omb.ts"), "ui", "launch"], {+ cwd: ROOT, env: process.env, stdio: ["ignore", "pipe", "pipe"], detached: process.platform !== "win32",+ });+ let stdout = "", stderr = "";+ child.stdout!.on("data", (chunk) => { stdout += String(chunk); });+ child.stderr!.on("data", (chunk) => { stderr += String(chunk); });+ const deadline = Date.now() + LAUNCH_TIMEOUT_MS;+ for (;;) {+ if (child.exitCode !== null) throw new Error(`ui launch exited ${child.exitCode}: ${stderr}`);+ const start = stdout.indexOf("{");+ if (start !== -1) {+ try { return { child, info: JSON.parse(stdout.slice(start)) }; } catch { /* not all of it yet */ }+ }+ if (Date.now() > deadline) throw new Error(`ui launch printed no handle: ${stderr}`);+ await new Promise((done) => setTimeout(done, 250));+ }+}++async function until<T>(probe: () => Promise<T> | T, what: string, timeoutMs = 30_000): Promise<NonNullable<T>> {+ const deadline = Date.now() + timeoutMs;+ for (;;) {+ const value = await probe();+ if (value) return value as NonNullable<T>;+ if (Date.now() > deadline) throw new Error(`${what} did not happen within ${timeoutMs}ms`);+ await new Promise((done) => setTimeout(done, 250));+ }+}++(enabled ? it : it.skip)("shows a room's threads as a feed, opens one beside it, and starts a new one without moving the room's current thread", async () => {+ const { child, info } = await launch();+ try {+ const api = fixtureApi(info.url, { headers: { origin: info.url } });+ const ui = (verb: string, ...args: string[]) => runControlOmb(["ui", verb, "--ui", info.ui, ...args]) as Promise<Record<string, any>>;+ const evaluate = async (js: string) => (await ui("eval", "--js", js)).result;+ const browser = JSON.parse(readFileSync(info.ui, "utf8")) as UiHandle;+ const browse = (...args: string[]) => agentBrowser(browser.binary, sessionEnv(browser), args);+ await browse("set", "viewport", "1440", "900");+ const idle = () => until(async () => ((await api("GET", "/api/bots")).bots as Array<{ busy?: boolean }>).every((bot) => !bot.busy), "the bots to settle");++ const basil = (await api("POST", "/api/bots", { name: "Basil" })).bot;+ const room = (await api("POST", "/api/groups", {+ memberIds: [info.botId, basil.id], name: "Launch room", setup: { bulletin: "", defaultResponder: { kind: "member", botId: info.botId } },+ })).group;+ const lines = ["Plan the launch checklist", "Who has the logo files?", "Book the demo room"];+ for (const [index, text] of lines.entries()) {+ const threadId = index === 0 ? room.threadId : (await api("POST", `/api/groups/${room.id}/tasks`, { activate: false })).task.threadId;+ await api("POST", `/api/groups/${room.id}/messages`, { text, threadId });+ await idle();+ }+ const current = async () => ((await api("GET", "/api/bots")).groups as Array<{ id: string; threadId: string }>).find((group) => group.id === room.id)!.threadId;+ expect(await current()).toBe(room.threadId);++ await ui("flag", "--set", "features.roomFeed=true");+ await evaluate(`document.querySelector('[data-sidebar-group-row="${room.id}"]').click(); true`);+ await until(() => evaluate("document.querySelectorAll('[data-feed-thread]').length === 3"), "the feed to list the room's three threads");+ expect(await evaluate("[...document.querySelectorAll('[data-feed-thread]')].map((row) => row.textContent.includes('1 reply'))")).toEqual([true, true, true]);+ expect(await evaluate(`Boolean(document.querySelector('[aria-expanded][aria-label*="Launch room"]'))`)).toBe(false);+ await ui("screenshot", "--out", join(evidenceDir, "room-feed.png"));++ await evaluate("document.querySelectorAll('[data-feed-thread] button')[1].click(); true");+ const opened = await until(() => evaluate("document.querySelector('[data-thread-panel]')?.getAttribute('data-thread-panel')"), "the thread to open beside the feed");+ await until(() => evaluate("document.querySelector('[data-thread-panel]').textContent.includes('Who has the logo files?')"), "the thread's lines in the panel");+ expect(await current()).toBe(room.threadId);+ await ui("screenshot", "--out", join(evidenceDir, "room-feed-thread.png"));++ await browse("click", "[data-room-feed-composer] textarea");+ await browse("type", "[data-room-feed-composer] textarea", "Draft the outage email");+ await browse("press", "Enter");+ await until(() => evaluate("document.querySelectorAll('[data-feed-thread]').length === 4"), "the new thread's row in the feed");+ const started = await until(async () => {+ const panel = await evaluate("document.querySelector('[data-thread-panel]')?.getAttribute('data-thread-panel')");+ return panel && panel !== opened ? panel as string : null;+ }, "the new thread to open beside the feed");+ await idle();+ const transcript = (await api("GET", `/api/threads/${started}/messages`)).messages as Array<{ role: string; text?: string }>;+ expect(transcript.find((message) => message.role === "user")?.text).toBe("Draft the outage email");+ expect(await current()).toBe(room.threadId);+ await ui("screenshot", "--out", join(evidenceDir, "room-feed-new-thread.png"));++ await ui("flag", "--set", "features.roomFeed=false");+ await until(() => evaluate("!document.querySelector('[data-room-feed]') && Boolean(document.querySelector('[data-look=\"chat\"] [role=\"log\"]'))"), "the room's transcript to come back");+ const logs = await ui("console");+ expect((logs.messages as Array<{ type: string; text: string }>).filter((message) => message.type === "error")).toEqual([]);+ } finally {+ await waitForExit(child, { signal: "SIGINT", graceMs: 30_000 });+ expect(existsSync(info.dataDir)).toBe(false);+ }+}, LAUNCH_TIMEOUT_MS + 240_000);diff --git a/server/config.ts b/server/config.tsindex 08ed3234a7..7d3696224a 100644--- a/server/config.ts+++ b/server/config.ts@@ -226,7 +226,7 @@ const featureConfigSchema = z.object({/** Room jobs to several members run side by side, each in a thread of its own. On unless false. */parallelRoomJobs: z.boolean().optional(),acpPlanLines: z.boolean().optional(), // An ACP agent's plan as activity lines. Off unless true.-}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional(), skillBurger: z.boolean().optional(), threadTabs: z.boolean().optional() }); // skillBurger: Skill Burgers in chat, the side menu and the bot panel, and the tools that run them, on unless false; threadTabs: a bot's threads as tabs above its chat, off unless true; cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, off unless true (OMB_PHONE_PUSH wins)+}).extend({ agentsToolBridge: z.boolean().optional(), savedSteps: z.boolean().optional(), usbPhoneTakeover: z.boolean().optional(), cloudComputerAutoReplace: z.boolean().optional(), phonePush: z.boolean().optional(), skillBurger: z.boolean().optional(), threadTabs: z.boolean().optional(), roomFeed: z.boolean().optional() }); // skillBurger: Skill Burgers in chat, the side menu and the bot panel, and the tools that run them, on unless false; threadTabs: a bot's threads as tabs above its chat, off unless true; roomFeed: a room's threads as one feed with the open thread beside it, off unless true; cloudComputerAutoReplace: set a dead or silent cloud computer aside (kept seven days with its files) and give its bot a new one by itself, on unless false (OMB_CLOUD_COMPUTER_AUTO_REPLACE wins); agentsToolBridge: the find_tool / use_tool bridge, off unless true; savedSteps: repeat a computer task from its saved steps, on unless false; usbPhoneTakeover: watch and take over the bots' USB phone, off unless true; phonePush: wake a paired phone whose app is closed through the hosted push relay, off unless true (OMB_PHONE_PUSH wins)const onboardingConfigSchema = z.object({completedAt: z.string().trim().max(40).optional(),version: z.number().int().min(0).max(1000).optional(),@@ -467,7 +467,7 @@ export interface AppConfig extends HelperConfig {context?: { rebuildBytes?: number; compactAt?: number; autoCompact?: boolean; roomCompactAt?: number; roomSessions?: boolean; replayToolHistory?: boolean };memory?: { captureQuietMs?: number; tidyHour?: number };localVm?: { mode?: "shared" | "per-bot" | "pool"; maxInstances?: number; idleTimeoutMinutes?: number; preserveInstalledApps?: boolean; memoryGb?: number; cpus?: number };- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean; skillBurger?: boolean; threadTabs?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; llmThreadTitles?: boolean; smartSetupChoices?: boolean; autoRecall?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; parallelRoomJobs?: boolean; acpPlanLines?: boolean; agentsToolBridge?: boolean; savedSteps?: boolean; usbPhoneTakeover?: boolean; cloudComputerAutoReplace?: boolean; phonePush?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean };onboarding?: { completedAt?: string; version?: number; reelSeen?: boolean; hintsSeen?: string[]; firstTurnAt?: string };browserProfiles?: BrowserProfile[];browserEngine?: BrowserEngineConfig;diff --git a/server/index.test.ts b/server/index.test.tsindex 0d1961bb46..a0683cffd4 100644--- a/server/index.test.ts+++ b/server/index.test.ts@@ -9970,7 +9970,7 @@ describe("harness HTTP API", () => {it("keeps skill authoring on by default and persists an explicit opt-out", async () => {const before = await api("GET", "/api/config");expect(before.status).toBe(200);- expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, usbPhoneTakeover: false });+ expect(before.body.features).toEqual({ browser: false, skillAuthoring: true, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: false, usbPhoneTakeover: false });const untouched = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));expect(untouched.features?.skillAuthoring).toBeUndefined();expect(untouched.features?.skillReview).toBeUndefined();@@ -9980,20 +9980,20 @@ describe("harness HTTP API", () => {features: { skillAuthoring: false },});expect(saved.status).toBe(200);- expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, usbPhoneTakeover: false });+ expect(saved.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: false, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: false, usbPhoneTakeover: false });const disk = JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8"));// Earlier browser coverage may have persisted its own toggle: opting out must preserve sibling settings.expect(disk.features).toEqual({ ...untouched.features, skillAuthoring: false });- const burger = await api("PATCH", "/api/config", { features: { skillBurger: false, threadTabs: true } });- expect(burger.body.features).toMatchObject({ skillBurger: false, threadTabs: true });- expect(JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8")).features).toMatchObject({ skillBurger: false, threadTabs: true });- await api("PATCH", "/api/config", { features: { skillBurger: true, threadTabs: false } });+ const burger = await api("PATCH", "/api/config", { features: { skillBurger: false, threadTabs: true, roomFeed: true } });+ expect(burger.body.features).toMatchObject({ skillBurger: false, threadTabs: true, roomFeed: true });+ expect(JSON.parse(readFileSync(join(home, ".openmausbot", "config.json"), "utf8")).features).toMatchObject({ skillBurger: false, threadTabs: true, roomFeed: true });+ await api("PATCH", "/api/config", { features: { skillBurger: true, threadTabs: false, roomFeed: false } });const tools = await api("PATCH", "/api/config", { features: { showToolCalls: true } });expect(tools.status).toBe(200);- expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, usbPhoneTakeover: false });+ expect(tools.body.features).toEqual({ browser: false, skillAuthoring: false, skillReview: false, skillReviewSteps: 10, skillsLibrary: false, shareLearnedSkills: "off", showToolCalls: true, sharedComputers: false, claudeUserMcp: false, claudeUserSkills: false, autoRecall: true, roomMemoryCapture: false, parallelRoomJobs: true, savedSteps: true, savedStepsHere: process.platform === "darwin", skillBurger: true, threadTabs: false, roomFeed: false, usbPhoneTakeover: false });const bot = (await api("POST", "/api/bots", {})).body.bot;try {diff --git a/server/index.ts b/server/index.tsindex adffe7d40b..486f9b0a77 100644--- a/server/index.ts+++ b/server/index.ts@@ -11626,7 +11626,7 @@ function configStatus() {autoRecall: autoRecallEnabled(cfg),roomMemoryCapture: roomMemoryCaptureEnabled(cfg),parallelRoomJobs: parallelRoomJobsEnabled(cfg),- savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(), skillBurger: skillBurgerEnabled(cfg), threadTabs: cfg.features?.threadTabs === true,+ savedSteps: savedStepsEnabled(cfg), savedStepsHere: savedSteps.here(), skillBurger: skillBurgerEnabled(cfg), threadTabs: cfg.features?.threadTabs === true, roomFeed: cfg.features?.roomFeed === true,usbPhoneTakeover: HAS_USB_PORT ? usbPhoneTakeoverEnabled(cfg) : undefined,},onboarding: {@@ -12064,7 +12064,7 @@ ROUTES.push(createGroupRoutes({ROUTES.push(createChannelRoutes({store, threadRead: teamMessages.seen, runOwners, runActor,personMarkRoom: personRooms.personMarkRoom,- groupFor: personRooms.groupForAuth,+ groupFor: personRooms.groupForAuth, threadShown: (auth: RequestAuth, threadId: string) => visibleTo(viewerFor(auth)).thread(threadId),cfg,userName: userNameFor,desktopManaged: DESKTOP_MANAGED,diff --git a/server/message-db-thread-summaries.test.ts b/server/message-db-thread-summaries.test.tsnew file mode 100644index 0000000000..ae2708373a--- /dev/null+++ b/server/message-db-thread-summaries.test.ts@@ -0,0 +1,92 @@+import { mkdtempSync, rmSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { Message } from "./store.ts";++let home: string;+let mdb: typeof import("./message-db.ts");+let roomThreadSummaries: typeof import("./message-db-thread-summaries.ts").roomThreadSummaries;+let at = 1_000;++beforeEach(async () => {+ home = mkdtempSync(join(tmpdir(), "omb-thread-summaries-"));+ vi.resetModules();+ vi.stubEnv("HOME", home);+ vi.stubEnv("USERPROFILE", home);+ vi.stubEnv("OMB_DATA_DIR", join(home, "data"));+ mdb = await import("./message-db.ts");+ ({ roomThreadSummaries } = await import("./message-db-thread-summaries.ts"));+});++afterEach(() => {+ mdb.closeMessageDb();+ vi.unstubAllEnvs();+ rmSync(home, { recursive: true, force: true });+});++let next = 0;+function add(threadId: string, message: Partial<Message> & Pick<Message, "role" | "kind">): Message {+ at += 1_000;+ const full = { id: `m${++next}`, at, ...message } as Message;+ mdb.appendMessage(threadId, full);+ return full;+}+const person = (text: string, extra: Partial<Message> = {}) => ({ role: "user" as const, kind: "text" as const, text, ...extra });+const answer = (botId: string, text: string, extra: Partial<Message> = {}) =>+ ({ role: "bot" as const, kind: "text" as const, text, from: { botId, name: botId, color: "blue" }, turnId: `t${next}`, turnTerminal: true, ...extra });++describe("room thread summaries", () => {+ it("reads each thread's first line, its reply count, its last reply and who replied", () => {+ const first = add("a", person("Plan the launch", { sender: { id: "[email protected]", name: "Ana" } }));+ add("a", answer("kiwi", "On it"));+ add("a", { role: "bot", kind: "text", text: "thinking out loud", from: { botId: "kiwi", name: "Kiwi", color: "blue" }, turnId: "t-mid" });+ add("a", { role: "bot", kind: "activity", tool: { name: "Bash", ok: true } } as Partial<Message> & Pick<Message, "role" | "kind">);+ add("a", person("asked for Ana", { peerAsk: { botId: "kiwi", name: "Kiwi" } }));+ add("a", person("[peer context]", { aside: true }));+ add("a", answer("pip", "Here is the plan"));+ add("a", person("Thanks", { sender: { id: "[email protected]", name: "Ana" } }));+ const last = add("a", answer("kiwi", "Done"));++ const [summary] = roomThreadSummaries(["a"]);+ expect(summary).toEqual({+ threadId: "a",+ first: { text: "Plan the launch", speaker: { person: { id: "[email protected]", name: "Ana" } }, at: first.at },+ replies: 4,+ lastReplyAt: last.at,+ repliers: [{ botId: "kiwi" }, { person: { id: "[email protected]", name: "Ana" } }, { botId: "pip" }],+ });+ });++ it("keeps the threads in the order asked, with an empty one and a bot-first one", () => {+ add("b", answer("kiwi", "Good morning, here is the brief"));+ const summaries = roomThreadSummaries(["empty", "b"]);+ expect(summaries.map((row) => row.threadId)).toEqual(["empty", "b"]);+ expect(summaries[0]).toEqual({ threadId: "empty", first: null, replies: 0, lastReplyAt: null, repliers: [] });+ expect(summaries[1]).toMatchObject({ first: { text: "Good morning, here is the brief", speaker: { botId: "kiwi" } }, replies: 0, lastReplyAt: null, repliers: [] });+ });++ it("clips a long first line and names the person with no sender by nothing", () => {+ add("c", person("x".repeat(900)));+ const [summary] = roomThreadSummaries(["c"]);+ expect(summary.first?.text).toHaveLength(400);+ expect(summary.first?.clipped).toBe(true);+ expect(summary.first?.speaker).toEqual({ person: {} });+ });++ it("caps repliers at five, newest first", () => {+ add("d", person("Who is here?"));+ for (const bot of ["b1", "b2", "b3", "b4", "b5", "b6"]) add("d", answer(bot, `I am ${bot}`));+ const [summary] = roomThreadSummaries(["d"]);+ expect(summary.replies).toBe(6);+ expect(summary.repliers).toEqual(["b6", "b5", "b4", "b3", "b2"].map((botId) => ({ botId })));+ });++ it("counts a person's own follow-up as a reply but not their first line", () => {+ add("e", person("one"));+ add("e", person("two"));+ const [summary] = roomThreadSummaries(["e"]);+ expect(summary.replies).toBe(1);+ expect(summary.repliers).toEqual([{ person: {} }]);+ });+});diff --git a/server/message-db-thread-summaries.ts b/server/message-db-thread-summaries.tsnew file mode 100644index 0000000000..7b6a7078e0--- /dev/null+++ b/server/message-db-thread-summaries.ts@@ -0,0 +1,54 @@+import { ORDERING_ROW, prepared } from "./message-db.ts";+import { ROOM_THREAD_FIRST_CHARS, ROOM_THREAD_REPLIERS, type RoomThreadSpeaker, type RoomThreadSummary } from "../shared/room-threads.ts";++/** A thread's conversation lines: a person's text that no bot asked or slipped into a running turn for them, and each+ * bot turn's final answer.+ * ORDERING_ROW is repeated verbatim so SQLite can read messages_thread_order, whose partial WHERE it is. */+const LINES = `FROM messages INDEXED BY messages_thread_order WHERE thread_id IN (SELECT value FROM json_each(?)) AND ${ORDERING_ROW} AND (role = 'bot' OR (kind = 'text' AND json_extract(json, '$.aside') IS NULL))`;+const BOT = "json_extract(json, '$.from.botId')";+const SENDER_ID = "json_extract(json, '$.sender.id')";+const SENDER_NAME = "json_extract(json, '$.sender.name')";++/** SQLite takes the bare columns of a MIN() aggregate from the row that holds the minimum. */+const FIRSTS = `SELECT thread_id AS threadId, MIN(rowid) AS row, at, role, substr(text, 1, ${ROOM_THREAD_FIRST_CHARS + 1}) AS text, ` ++ `${BOT} AS botId, ${SENDER_ID} AS senderId, ${SENDER_NAME} AS senderName ${LINES} GROUP BY thread_id`;+const SPEAKERS = `SELECT thread_id AS threadId, role, ${BOT} AS botId, ${SENDER_ID} AS senderId, ${SENDER_NAME} AS senderName, ` ++ `COUNT(*) AS lines, MAX(rowid) AS lastRow, MAX(at) AS lastAt ${LINES} GROUP BY thread_id, role, botId, senderId, senderName`;++type Who = { role: string; botId: string | null; senderId: string | null; senderName: string | null };+type FirstRow = Who & { threadId: string; row: number; at: number; text: string | null };+type SpeakerRow = Who & { threadId: string; lines: number; lastRow: number; lastAt: number };++function speakerOf(who: Who): RoomThreadSpeaker {+ if (who.role === "bot" && who.botId) return { botId: who.botId };+ return { person: { ...(who.senderId ? { id: who.senderId } : {}), ...(who.senderName ? { name: who.senderName } : {}) } };+}++const sameSpeaker = (a: Who, b: Who) => a.role === b.role && a.botId === b.botId && a.senderId === b.senderId && a.senderName === b.senderName;++/** Each listed thread's first line, how many lines came after it and from whom, in two statements for all of them.+ * Every branch of a thread counts: a line an edit or a retry left on an older branch is still counted as a reply. */+export function roomThreadSummaries(threadIds: readonly string[]): RoomThreadSummary[] {+ const ids = [...new Set(threadIds.filter((id) => id.length > 0))];+ if (ids.length === 0) return [];+ const list = JSON.stringify(ids);+ const firsts = new Map((prepared(FIRSTS).all(list) as FirstRow[]).map((row) => [row.threadId, row]));+ const speakers = new Map<string, SpeakerRow[]>();+ for (const row of prepared(SPEAKERS).all(list) as SpeakerRow[]) speakers.set(row.threadId, [...(speakers.get(row.threadId) ?? []), row]);+ return ids.map((threadId) => {+ const first = firsts.get(threadId);+ if (!first) return { threadId, first: null, replies: 0, lastReplyAt: null, repliers: [] };+ const after = (speakers.get(threadId) ?? []).flatMap((row) => {+ const lines = sameSpeaker(row, first) ? Number(row.lines) - 1 : Number(row.lines);+ return lines > 0 ? [{ ...row, lines }] : [];+ }).sort((a, b) => Number(b.lastRow) - Number(a.lastRow));+ const text = first.text ?? "";+ return {+ threadId,+ first: { text: text.slice(0, ROOM_THREAD_FIRST_CHARS), ...(text.length > ROOM_THREAD_FIRST_CHARS ? { clipped: true as const } : {}), speaker: speakerOf(first), at: Number(first.at) },+ replies: after.reduce((sum, row) => sum + row.lines, 0),+ lastReplyAt: after.length > 0 ? Math.max(...after.map((row) => Number(row.lastAt))) : null,+ repliers: after.slice(0, ROOM_THREAD_REPLIERS).map(speakerOf),+ };+ });+}diff --git a/server/message-db.ts b/server/message-db.tsindex aab59dec8d..d46d8ec643 100644--- a/server/message-db.ts+++ b/server/message-db.ts@@ -25,7 +25,7 @@ const CARD_KINDS = "kind IN ('secret', 'signin', 'connector')";const FAILED_CALL = "kind = 'activity' AND instr(json, '\"ok\":false') > 0";/** The rows that order the thread list and the time each one counts at. SQLite uses messages_thread_order only for a* statement whose WHERE and MAX repeat these texts exactly. */-const ORDERING_ROW = "((role = 'user' AND json_extract(json, '$.peerAsk') IS NULL) OR (role = 'bot' AND kind = 'text' AND (json_extract(json, '$.turnTerminal') = 1 OR json_extract(json, '$.turnId') IS NULL)))";+export const ORDERING_ROW = "((role = 'user' AND json_extract(json, '$.peerAsk') IS NULL) OR (role = 'bot' AND kind = 'text' AND (json_extract(json, '$.turnTerminal') = 1 OR json_extract(json, '$.turnId') IS NULL)))";const ORDERING_AT = "COALESCE(json_extract(json, '$.turnCompletedAt'), at)";let handle: DatabaseSync | null = null;diff --git a/server/request-auth.ts b/server/request-auth.tsindex 5d9bb7661b..69691a652c 100644--- a/server/request-auth.ts+++ b/server/request-auth.ts@@ -422,6 +422,7 @@ export const CLIENT_ALLOW: ReadonlyArray<{ methods: readonly string[]; path: Reg{ methods: ["DELETE"], path: /^\/api\/groups\/[\w-]+\/queue\/[\w-]+$/ },{ methods: ["POST"], path: /^\/api\/groups\/[\w-]+\/queue\/[\w-]+\/steer$/ },{ methods: ["POST"], path: /^\/api\/groups\/[\w-]+\/tasks$/ },+ { methods: ["GET"], path: /^\/api\/groups\/[\w-]+\/threads\/summary$/ },{ methods: ["POST"], path: /^\/api\/groups\/[\w-]+\/tasks\/[\w-]+\/forks$/ },{ methods: ["POST", "PATCH", "DELETE"], path: /^\/api\/groups\/[\w-]+\/tasks\/[\w-]+$/ },{ methods: ["PATCH"], path: /^\/api\/groups\/[\w-]+$/ }, // display fields only: see clientGroupPatchViolationdiff --git a/server/room-thread-summaries.e2e.test.ts b/server/room-thread-summaries.e2e.test.tsnew file mode 100644index 0000000000..c85fa771b5--- /dev/null+++ b/server/room-thread-summaries.e2e.test.ts@@ -0,0 +1,91 @@+// A room's feed on a real Team Cloud: Ada (an Admin) makes a room of two bots shared with Bob, and Eve, who is not+// added to either bot, cannot see it. A thread made for the feed leaves the room's current thread where it was, and+// the summaries answer each person who can see the room and nobody else. The engine is the synthetic Claude CLI.+import { randomBytes } from "node:crypto";+import { afterAll, beforeAll, describe, expect, it } from "vitest";+import { launchCloudSendFixture, type CloudSendFixture, type CloudTeamFixture } from "../scripts/testing/cloud-send-fixture.ts";+import type { RoomThreadSummary } from "../shared/room-threads.ts";+import { hostTimeout } from "./testing/host-timeout.ts";++const ADA = { email: "[email protected]", role: "admin" as const };+const BOB = { email: "[email protected]", role: "member" as const };+const EVE = { email: "[email protected]", role: "member" as const };++let fx: CloudSendFixture, team: CloudTeamFixture;+const token: Record<string, string> = {};+let room = "", roomThread = "";++const as = (who: string, method: string, path: string, body?: unknown) => team.as(token[who]!, method, path, body);++async function until(done: () => Promise<boolean> | boolean, timeoutMs = 60_000): Promise<void> {+ const end = Date.now() + timeoutMs;+ while (!(await done())) {+ if (Date.now() > end) throw new Error("timed out waiting");+ await new Promise((resolve) => setTimeout(resolve, 100));+ }+}++beforeAll(async () => {+ fx = await launchCloudSendFixture({ onePasswordToken: `ops_fake-team-${randomBytes(8).toString("hex")}`, team: { id: "team-acme-1", name: "Acme" } });+ team = fx.team!;+ for (const [who, member] of Object.entries({ ada: ADA, bob: BOB, eve: EVE })) {+ const paired = await team.pair(member);+ expect(paired.token, JSON.stringify(paired.body)).toBeTruthy();+ token[who] = paired.token!;+ }+ const levels = { everyone: "none", people: { [BOB.email]: "chat" } };+ const ids: string[] = [];+ for (const name of ["Kiwi", "Pip"]) {+ const created = await as("ada", "POST", "/api/bots", { name });+ expect(created.status, JSON.stringify(created.body)).toBe(201);+ ids.push(created.body.bot.id);+ expect((await as("ada", "PUT", `/api/bots/${created.body.bot.id}/access`, levels)).status).toBe(200);+ }+ const made = await as("ada", "POST", "/api/groups", { memberIds: ids, name: "Launch", setup: { bulletin: "", defaultResponder: { kind: "everyone" } } });+ expect(made.status, JSON.stringify(made.body)).toBe(201);+ room = made.body.group.id;+ roomThread = made.body.group.threadId;+}, hostTimeout(180_000));++afterAll(async () => {+ await fx?.close();+});++describe("a room's thread summaries", () => {+ it("starts a thread without moving the room's current one, and summarises it once a line lands there", async () => {+ const created = await as("bob", "POST", `/api/groups/${room}/tasks`, { activate: false });+ expect(created.status, JSON.stringify(created.body)).toBe(201);+ const thread = created.body.task.threadId as string;+ expect(thread).not.toBe(roomThread);+ expect(created.body.group.threadId).toBe(roomThread);++ const sent = await as("bob", "POST", `/api/groups/${room}/messages`, { text: "Where are we on the launch?", threadId: thread });+ expect(sent.status, JSON.stringify(sent.body)).toBeLessThan(300);+ await until(async () => {+ const summary = await as("bob", "GET", `/api/groups/${room}/threads/summary`);+ return (summary.body.threads as RoomThreadSummary[]).some((row) => row.threadId === thread && row.replies > 0);+ });+ const after = await as("ada", "GET", `/api/groups/${room}/threads/summary`);+ expect(after.status).toBe(200);+ const row = (after.body.threads as RoomThreadSummary[]).find((candidate) => candidate.threadId === thread)!;+ expect(row.first).toMatchObject({ text: "Where are we on the launch?", speaker: { person: { name: expect.any(String) } } });+ expect(row.repliers.length).toBeGreaterThan(0);+ expect((await as("ada", "POST", `/api/groups/${room}/read`, { threadId: thread })).body.group.threadId).toBe(roomThread);+ });++ it("leaves out an archived thread", async () => {+ const created = await as("ada", "POST", `/api/groups/${room}/tasks`, { activate: false });+ const thread = created.body.task.threadId as string;+ expect((await as("ada", "POST", `/api/groups/${room}/messages`, { text: "Old idea", threadId: thread })).status).toBeLessThan(300);+ await until(async () => ((await as("ada", "GET", `/api/groups/${room}/threads/summary`)).body.threads as RoomThreadSummary[]).some((row) => row.threadId === thread && row.first));+ expect((await as("ada", "PATCH", `/api/groups/${room}/tasks/${thread}`, { archivedAt: Date.now() })).status).toBe(200);+ const after = (await as("ada", "GET", `/api/groups/${room}/threads/summary`)).body.threads as RoomThreadSummary[];+ expect(after.map((row) => row.threadId)).not.toContain(thread);+ expect(after.map((row) => row.threadId)).toContain(roomThread);+ });++ it("answers someone who cannot see the room as if it did not exist", async () => {+ expect((await as("eve", "GET", `/api/groups/${room}/threads/summary`)).status).toBe(404);+ expect((await as("bob", "GET", "/api/groups/no-such-room/threads/summary")).status).toBe(404);+ });+});diff --git a/server/routes/channels.ts b/server/routes/channels.tsindex 7054f8ad23..f7597ef168 100644--- a/server/routes/channels.ts+++ b/server/routes/channels.ts@@ -16,6 +16,8 @@ import {import { DATA_DIR, type AppConfig } from "../config.ts";import type { ProviderInstance, SteerOutcome } from "../contracts.ts";import { cancelledChatFollowup } from "../message-db.ts";+import { roomThreadSummaries } from "../message-db-thread-summaries.ts";+import type { RoomThreadSummariesResponse } from "../../shared/room-threads.ts";import { messageTextRefusal } from "../message-text.ts";import { prepareRoomPointed, roomPickBots, type RoomPick } from "../room-pointed.ts";import { refusalBody } from "../user-errors.ts";@@ -84,6 +86,8 @@ export interface ChannelRouteDeps {personMarkRoom?(auth: RequestAuth, room: GroupRecord, unread: boolean, threadId?: string): WireGroup | null;/** A room as this person has read it (a Team Cloud); the room itself anywhere else. */groupFor?(auth: RequestAuth, group: WireGroup): WireGroup;+ /** Whether this person may read the conversation; a room's threads all show where nobody's reading is narrowed. */+ threadShown?(auth: RequestAuth, threadId: string): boolean;pageSize(raw: string | null): number | null | undefined;messagePage(threadId: string, limit: number | undefined): MessagePage;resolveReplyTarget(threadId: string, value: unknown): Message | undefined;@@ -110,7 +114,7 @@ export interface ChannelRouteDeps {rejectDeletedThreadSkillStages(cleanups: Array<{ botId: string; stagedId: string }>): void;}-const createGroupTaskRequestSchema = z.object({ title: z.string().optional() });+const createGroupTaskRequestSchema = z.object({ title: z.string().optional(), activate: z.boolean().optional() });type StopAnswer = { status: 200 | 403 | 409; body: { ok: true } | { error: string; code?: "stop_not_yours" } };@@ -180,13 +184,22 @@ export function createChannelRoutes(deps: ChannelRouteDeps): RouteHandler {}const request = createGroupTaskRequestSchema.safeParse(body);if (!request.success) return json(res, 400, { error: "title must be text" });- const task = store.createGroupTask(group.id, request.data.title);+ const task = store.createGroupTask(group.id, request.data.title, request.data.activate !== false);if (!task) return json(res, 500, { error: "couldn't create that task" });// Who opened it decides who may answer its cards on a shared workspace.if (auth.kind === "session") threadStarters.set(task.threadId, actorKey(auth));return json(res, 201, { group: own(groupWithThread(store.group(group.id)!)), task } satisfies RoomTaskCreateResponse);}+ m = path.match(/^\/api\/groups\/([\w-]+)\/threads\/summary$/);+ if (m && method === "GET") {+ const group = store.group(m[1]);+ if (!group || group.dm) return json(res, 404, { error: "no such room" });+ const threadIds = (group.tasks ?? [{ threadId: group.threadId, archivedAt: undefined }]).filter((task) => task.archivedAt === undefined && (deps.threadShown?.(auth, task.threadId) ?? true))+ .map((task) => task.threadId);+ return json(res, 200, { threads: roomThreadSummaries(threadIds) } satisfies RoomThreadSummariesResponse);+ }+m = path.match(/^\/api\/groups\/([\w-]+)\/tasks\/delete$/);if (m && method === "POST") {const parsed = bulkDeleteThreadIds(await readBody(req));diff --git a/server/skill-burger/switch.test.ts b/server/skill-burger/switch.test.tsindex 13c486bdc0..ab7c8fd307 100644--- a/server/skill-burger/switch.test.ts+++ b/server/skill-burger/switch.test.ts@@ -23,7 +23,7 @@ describe("the Skill Burger switch on the server", () => {});it("is a config.json field Settings can patch, with thread tabs beside it", () => {- expect(parseConfigPatch({ features: { skillBurger: false, threadTabs: true } })).toMatchObject({ features: { skillBurger: false, threadTabs: true } });+ expect(parseConfigPatch({ features: { skillBurger: false, threadTabs: true, roomFeed: true } })).toMatchObject({ features: { skillBurger: false, threadTabs: true, roomFeed: true } });});it("offers the run and edit tools while on, and neither once off", () => {diff --git a/shared/room-threads.ts b/shared/room-threads.tsnew file mode 100644index 0000000000..a777310c0b--- /dev/null+++ b/shared/room-threads.ts@@ -0,0 +1 @@+export * from "../packages/phone-protocol/src/room-threads.ts";diff --git a/shared/settings-places.ts b/shared/settings-places.tsindex f2b7300a3b..fb9c22aa5c 100644--- a/shared/settings-places.ts+++ b/shared/settings-places.ts@@ -101,6 +101,7 @@ export const SETTINGS_PLACES = [{"id":"layout","path":"Settings → Appearance → Layout","words":["show your computers","rail","window frame","title bar","threads","tools layout","pinned","circles","universal pins","pinned panels"],"advanced":true},{"id":"skill-burger-switch","path":"Settings → Features → Skill Burger","words":["skill burger","skill burgers","burger","saved runs","workflows"]},{"id":"thread-tabs","path":"Settings → Features → Thread tabs","words":["tabs","threads"]},+ {"id":"room-feed","path":"Settings → Features → Room feed","words":["feed","room threads","rooms"]},{"id":"apps","path":"the Apps panel (Connect apps, at the bottom of the sidebar)","words":["apps","gmail","slack","calendar","notion","connect app","integrations"]},{"id":"bot-settings","path":"a bot's own Settings (click the bot's name at the top of its chat)","words":["a bot's own settings","approvals","safety","routines","memory","bot's notifications"]},{"id":"shortcuts","path":"the keyboard shortcut list (the menu under the person's name → Keyboard shortcuts)","words":["keyboard shortcuts","hotkeys","cheat sheet"]},diff --git a/src/App.tsx b/src/App.tsxindex 838c27cfa9..aebe7dd40b 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -23,6 +23,8 @@ import { ChatView } from "@/components/ChatView";import { HandoffExchangeHost } from "@/components/HandoffExchange";import { GroupView } from "@/components/GroupView";import { ForkPanel } from "@/components/ForkPanel";+import { RoomFeedView } from "@/components/room-feed/RoomFeedView";+import { useRoomFeed } from "@/components/room-feed/use-room-feed";import { PHONE_LAYOUT, SIDEBAR_AND_BOT_PANEL_FIT, SIDEBAR_AND_NARROW_PANEL_FIT, SIDEBAR_AND_PANEL_FIT, SIDEBAR_INLINE, TWO_SIDE_PANELS_FIT, useMediaQuery } from "@/lib/use-media-query";import { anySidePanel, botPanelFloats, panelsMovingSidebar, sidebarFoldsForPanel, type OpenSidePanels } from "@/lib/sidebar-fold";import { preloadConnectedApps } from "@/lib/connected-apps";@@ -187,7 +189,7 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {view: state.activeView, pluginsOpen: state.pluginsOpen, settingsOpen: state.settingsOpen });const closeDrawer = useCallback(() => { hideDrawer(); menuButtonRef.current?.focus(); }, [hideDrawer]);const notificationFeed = useNotificationFeed() && !remoteClient;- const advanced = useAdvancedMode(), skillBurger = useFeature("skillBurger");+ const advanced = useAdvancedMode(), skillBurger = useFeature("skillBurger"), roomFeed = useRoomFeed(group);const roomPanelOpen = useRoomPanelShown({ group, state, simple: !advanced && !remoteClient });const sidePanels: OpenSidePanels = {simple: !advanced, remoteClient, bot: Boolean(bot) && state.settingsOpen, room: roomPanelOpen, inbox: inboxShown, inboxWide: inboxPanel.wide === true,@@ -465,6 +467,8 @@ function Shell({ viewer }: { viewer: WelcomeViewer | null }) {<CloudEngineSignIn />) : chiefStep ? (<EmptyChatShell />+ ) : group && roomFeed ? (+ <RoomFeedView key={group.id} group={group} />) : group ? (<GroupView key={group.id} group={group} />) : bot ? (diff --git a/src/components/Composer.tsx b/src/components/Composer.tsxindex 43dbf4012d..27ae7d0a24 100644--- a/src/components/Composer.tsx+++ b/src/components/Composer.tsx@@ -5,7 +5,7 @@ import { ComposerForkError, useComposerFork } from "./ComposerFork";import { useCallback, useEffect, useMemo, useRef, useState, type SetStateAction } from "react";import { Mic, Square } from "lucide-react";import { sameFields, useStoreDispatch, useStoreSelector } from "@/state/store-select"; import { useStoreRef } from "@/state/store-ref"; import { sameDrawnBots } from "@/lib/drawn-bots";-import { visibleMessages, currentTaskBot, type Bot, type Group, type InstanceInfo, type Message } from "@/state/store";+import { visibleMessages, currentTaskBot, type Action, type Bot, type Group, type InstanceInfo, type Message } from "@/state/store";import { cn } from "@/lib/cn";import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";import { useMenuMotion } from "./MenuMotion";@@ -119,7 +119,7 @@ export function Composer({onClearReply,onConsumeReply,onRestoreReply,- locked: setupLocked = false,+ locked: setupLocked = false, onSendGroup,}: {bot?: Bot;group?: Group;@@ -130,6 +130,8 @@ export function Composer({onConsumeReply?: () => void;onRestoreReply?: (message: Message, threadId: string) => void;locked?: boolean;+ /** Takes a room's send instead of the store: the room feed starts a new thread with it. */+ onSendGroup?: (action: Extract<Action, { type: "sendGroup" }>) => void;}) {const bot = profile ? currentTaskBot(profile) : undefined;const locked = setupLocked || Boolean(bot?.awaitingThreadSnapshot);@@ -557,7 +559,7 @@ export function Composer({},};if (group) {- dispatch({ type: "sendGroup", groupId: group.id, mode: failedMode, ...(failed.followUp ? { followUp: failed.followUp } : {}), ...retry });+ (onSendGroup ?? dispatch)({ type: "sendGroup", groupId: group.id, mode: failedMode, ...(failed.followUp ? { followUp: failed.followUp } : {}), ...retry });} else if (bot) {dispatch({ type: "send", botId: bot.id, mode: failedMode, followUp: failed.followUp, ...retry });}@@ -595,7 +597,7 @@ export function Composer({};if (group) {const points = effectiveChannelMode === "goal" ? null : takePointedChips(threadId);- dispatch({+ (onSendGroup ?? dispatch)({type: "sendGroup",groupId: group.id,text: body,@@ -910,7 +912,7 @@ export function Composer({simple: !advanced, locked: setupLocked, approval: blocking, attaching: attachmentPending, listening: recording,replying: Boolean(replyTo), busy, canSteer: steersNow, queued: pendingCount > 0, busyName, sendLabel, group, members: members ?? [],jevOn: jevRoomRoutingOn(state.config), goal: channelMode === "goal", botName: bot?.name ?? "",- setupHint: group ? null : setupRequestPlaceholder(bot, threadId),+ setupHint: group ? null : setupRequestPlaceholder(bot, threadId), startsThread: Boolean(onSendGroup),})}aria-label={t("composer.placeholder.bot", { name: group ? group.name : (bot?.name ?? "") })}className={cn(diff --git a/src/components/ForkPanel.tsx b/src/components/ForkPanel.tsxindex 57a4279a3f..b7667e4021 100644--- a/src/components/ForkPanel.tsx+++ b/src/components/ForkPanel.tsx@@ -1,15 +1,26 @@import { X } from "lucide-react";import { useLayoutEffect, useRef } from "react";+import { cn } from "@/lib/cn";+import { useFeature } from "@/lib/use-feature";+import { useInboxPanel } from "@/state/inbox";import { currentTaskBot, useStore } from "@/state/store";import { t } from "@/lib/i18n";import { ChatView } from "./ChatView";import { GroupView } from "./GroupView";+import { PANEL_MIN_WIDTH, useComputerPanelResize } from "./computer-panel-resize";+const BESIDE_INBOX_MAX = 400;++/** Any thread beside the chat: a fork, and with the room feed on, the thread a feed row or the Inbox opened. */export function ForkPanel() {const { state, dispatch } = useStore();const panel = state.forkPanel;const asideRef = useRef<HTMLElement>(null);const focusedLoad = useRef<string | undefined>(undefined);+ const beside = useFeature("roomFeed");+ const resize = useComputerPanelResize({ key: "omb-thread-panel-width", defaultWidth: 440 });+ // Beside the Inbox the chat keeps the 440 it has beside any other side panel.+ const width = useInboxPanel().open ? Math.min(resize.panelWidth, BESIDE_INBOX_MAX) : resize.panelWidth;useLayoutEffect(() => {const aside = asideRef.current;if (!panel?.focusComposer || !aside) return;@@ -27,14 +38,48 @@ export function ForkPanel() {const openedGroup = group && groupTask ? { ...group, threadId: panel.threadId, messages: panel.messages, hasMore: false,working: groupTask.working ?? false, busyBotId: groupTask.busyBotId ?? null,turnStartedAt: null, pinnedCwd: groupTask.pinnedCwd, pinnedMessageId: groupTask.pinnedMessageId } : null;+ const fork = !beside || Boolean(task?.origin);+ const label = fork ? t("chat.forkPanel") : t("room.thread.panel");+ const close = () => dispatch({ type: "closeForkPanel" });return (- <aside ref={asideRef} tabIndex={panel.focusComposer ? -1 : undefined} aria-label={t("chat.forkPanel")} className="relative flex h-full w-[min(48vw,640px)] min-w-[360px] flex-col border-l border-hairline bg-app">- <div className="flex items-center justify-between border-b border-hairline px-4 py-2 text-sm font-medium text-ink">- <span className="truncate">{task?.title ?? t("chat.forkPanel")}</span>- <button type="button" aria-label={t("chat.closeForkPanel")} className="rounded p-1 text-ink-secondary hover:bg-raised hover:text-ink"- onClick={() => dispatch({ type: "closeForkPanel" })}><X size={16} /></button>- </div>+ <aside ref={asideRef} tabIndex={panel.focusComposer ? -1 : undefined} aria-label={label} data-thread-panel={panel.threadId}+ style={beside ? { width, ["--side-panel-w" as string]: `${width}px` } : undefined}+ className={cn("relative flex h-full flex-col bg-app", beside+ ? "shrink-0 border-s-[0.5px] border-edge md:animate-panel-beside-in motion-reduce:animate-none"+ : "w-[min(48vw,640px)] min-w-[360px] border-s border-hairline")}>+ {beside && <div+ ref={resize.separatorRef}+ role="separator"+ aria-orientation="vertical"+ aria-label={t("room.thread.resize")}+ aria-valuemin={PANEL_MIN_WIDTH}+ aria-valuemax={resize.maxWidth}+ aria-valuenow={resize.separatorWidth ?? undefined}+ tabIndex={0}+ onKeyDown={resize.onSeparatorKeyDown}+ onPointerDown={resize.onResizeStart}+ onPointerMove={resize.onResizeMove}+ onPointerUp={resize.onResizeEnd}+ onPointerCancel={resize.onResizeEnd}+ className="absolute inset-y-0 start-0 z-30 w-1.5 cursor-col-resize hover:bg-accent/40 focus-visible:bg-accent/60"+ />}+ {beside ? (+ <header className="flex shrink-0 items-center gap-2 py-2.5 ps-4 pe-3">+ <div className="min-w-0 flex-1">+ <h2 dir="auto" title={task?.title} className="truncate text-[15px] font-semibold leading-5 text-ink">{fork ? task?.title ?? label : label}</h2>+ <p dir="auto" className="truncate text-[12px] leading-4 text-ink-secondary">{group?.name ?? bot?.name}</p>+ </div>+ <button type="button" aria-label={fork ? t("chat.closeForkPanel") : t("room.thread.close")} title={fork ? t("chat.closeForkPanel") : t("room.thread.close")}+ className="ui-icon-button shrink-0" onClick={close}><X size={16} aria-hidden="true" /></button>+ </header>+ ) : (+ <div className="flex items-center justify-between border-b border-hairline px-4 py-2 text-sm font-medium text-ink">+ <span className="truncate">{task?.title ?? t("chat.forkPanel")}</span>+ <button type="button" aria-label={t("chat.closeForkPanel")} className="rounded p-1 text-ink-secondary hover:bg-raised hover:text-ink"+ onClick={close}><X size={16} /></button>+ </div>+ )}<div className="min-h-0 flex-1">{panel.loading ? <p className="p-4 text-sm text-ink-secondary">{t("chat.loadingFork")}</p>: panel.loadFailed ? <div className="flex items-center gap-3 p-4 text-sm text-ink-secondary">@@ -45,7 +90,7 @@ export function ForkPanel() {</button></div>: openedBot ? <ChatView key={panel.threadId} bot={openedBot} inForkPanel />- : openedGroup ? <GroupView key={panel.threadId} group={openedGroup} inForkPanel />+ : openedGroup ? <GroupView key={panel.threadId} group={openedGroup} inForkPanel bare={beside} />: <p className="p-4 text-sm text-ink-secondary">{t("chat.forkUnavailable")}</p>}</div></aside>diff --git a/src/components/GroupView.tsx b/src/components/GroupView.tsxindex 2b90621d8c..3d4a34b18a 100644--- a/src/components/GroupView.tsx+++ b/src/components/GroupView.tsx@@ -676,7 +676,7 @@ function RoomSetup({ group, members }: { group: Group; members: Bot[] }) {</section>);}-export function GroupView({ group, inForkPanel = false }: { group: Group; inForkPanel?: boolean }) {+export function GroupView({ group, inForkPanel = false, bare = false }: { group: Group; inForkPanel?: boolean; /** Beside the room's feed: no header or bulletin of its own. */ bare?: boolean }) {const { state, dispatch } = useStore();const remoteClient = window.ogb?.remoteClient?.active === true;const composerDockRef = useRef<HTMLDivElement>(null);@@ -803,7 +803,7 @@ export function GroupView({ group, inForkPanel = false }: { group: Group; inFork<GlassScrollFrame className="flex-1 [--glass-tint:var(--color-app)]">{/* z-[25]: above the room set-up card (z-20), below the GroupCallOverlay (z-30). */}<GlassBar edge="top" fade={!advancedMode && !remoteClient} className="z-[25]">- <RoomHeader+ {!bare && <RoomHeadergroup={group}members={members}simple={simpleHeader}@@ -814,14 +814,14 @@ export function GroupView({ group, inForkPanel = false }: { group: Group; inForkonToggleFolder={() => setFolderOpen((open) => !open)}onOpenMembers={() => setMembersOpen(true)}membersTriggerRef={membersTriggerRef}- />+ />}{findOpen && <ChatFindBar threadId={group.threadId} inForkPanel={inForkPanel} onClose={() => setFindOpen(false)} />}<ChatErrorBanner message={state.error} onDismiss={() => dispatch({ type: "error", message: null })} /><ChatNotice notice={state.notice} />- {!setupPending && <RoomContextWarnings group={group} members={members} />}{!setupPending && !remoteClient && <RoomChiefAbsent group={group} />}+ {!setupPending && <RoomContextWarnings group={group} members={members} />}{!setupPending && !remoteClient && !bare && <RoomChiefAbsent group={group} />}- {!setupPending && !group.dm && !remoteClient && state.config && group.defaultResponder.kind === "auto" && !jevRoomRoutingOn(state.config) && (+ {!setupPending && !bare && !group.dm && !remoteClient && state.config && group.defaultResponder.kind === "auto" && !jevRoomRoutingOn(state.config) && (<div className="w-full px-5"><p data-testid="room-jev-off" className="mb-1 px-2 text-[12px] text-ink-secondary">{t("room.responder.jevOffHint", { name: defaultResponderName(group, members) ?? t("room.responder.leadFallback") })}{" "}@@ -838,7 +838,7 @@ export function GroupView({ group, inForkPanel = false }: { group: Group; inFork{!setupPending && !group.dm && <RoomHoldsBanner group={group} members={members} />}- {!setupPending && !simpleHeader && <RoomBulletin group={group} remoteClient={remoteClient} />}+ {!setupPending && !simpleHeader && !bare && <RoomBulletin group={group} remoteClient={remoteClient} />}{!setupPending && folderOpen && !group.dm && (<div className="w-full px-5">diff --git a/src/components/RoomHeader.tsx b/src/components/RoomHeader.tsxindex a41a0f3f57..8dd5b04853 100644--- a/src/components/RoomHeader.tsx+++ b/src/components/RoomHeader.tsx@@ -137,6 +137,7 @@ export function RoomHeader({onToggleFolder,onOpenMembers,membersTriggerRef,+ feed = false,}: {group: Group;members: Bot[];@@ -148,6 +149,9 @@ export function RoomHeader({onToggleFolder: () => void;onOpenMembers: () => void;membersTriggerRef: RefObject<HTMLButtonElement | null>;+ /** Above the room's feed of threads: what belongs to one thread (who has it open, its pin, find, its export and the+ * thread picker) is in that thread's own view beside it. */+ feed?: boolean;}) {const { dragProps: headerDragProps, noDragStyle: headerNoDragStyle } = useCaptionChrome();const { state, dispatch } = useStore();@@ -185,8 +189,8 @@ export function RoomHeader({{group.description && <p className="max-w-full truncate text-[12px] leading-4 text-ink-secondary">{group.description}</p>}</div><div data-roomhead-controls className="flex shrink-0 items-center gap-1.5">- <ThreadPresenceFaces threadId={group.threadId} />- {pinned}+ {!feed && <ThreadPresenceFaces threadId={group.threadId} />}+ {!feed && pinned}<buttonref={membersTriggerRef}type="button"@@ -225,7 +229,7 @@ export function RoomHeader({<div className="min-w-0"><div className="flex items-center gap-2"><span className="truncate text-[15px] font-semibold text-ink">{group.name}</span>- {!setupPending && !group.dm && <GroupTaskPicker group={group} />}+ {!setupPending && !group.dm && !feed && <GroupTaskPicker group={group} />}</div>{group.description && <p className="truncate text-[12px] leading-4 text-ink-secondary">{group.description}</p>}</div>@@ -234,9 +238,9 @@ export function RoomHeader({data-roomhead-controlsclassName="flex items-center gap-1.5 @max-3xl/roomhead:ml-auto @max-3xl/roomhead:flex-wrap @max-3xl/roomhead:justify-end">- <ThreadPresenceFaces threadId={group.threadId} />- {pinned}- <button+ {!feed && <ThreadPresenceFaces threadId={group.threadId} />}+ {!feed && pinned}+ {!feed && <buttontype="button"onClick={onToggleFind}aria-label={t("chat.find")}@@ -248,13 +252,13 @@ export function RoomHeader({title={t("chat.findShortcut")}><Search size={16} />- </button>- <ExportTranscriptMenu+ </button>}+ {!feed && <ExportTranscriptMenutitle={group.name}messages={group.messages}isGroup- />- {!setupPending && <ConversationTurnLimit group={group} />}+ />}+ {!setupPending && !feed && <ConversationTurnLimit group={group} />}<RoomHeaderCallButton group={group} members={members} /><GroupUsageChip usage={group.usage} />{!remoteClient && !setupPending && !group.dm && <RoomWorkingFolderChip group={group} onToggle={onToggleFolder} />}diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 302351e7fc..708c48b416 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -98,7 +98,7 @@ import { useLiveMedia } from "@/lib/live-call-media";import { LiveCallPill, liveBadgeFor } from "./LiveCallPill";import { ShortcutHint } from "./ShortcutHint";import { usePopoverDismiss } from "@/hooks/use-popover-dismiss";-import { useAdvancedMode } from "@/lib/interface-mode";+import { useAdvancedMode } from "@/lib/interface-mode"; import { useRoomFeed } from "./room-feed/use-room-feed"; import { feedPreview } from "@/lib/room-feed";import { myDefaultBot, useViewerEmail, useWelcomingBot } from "@/lib/default-bot";import { PinnedBotRoster, PinnedCircleThreadSection } from "./PinnedCircleThreads";import { archiveBotWithNotice, onArchiveNotice } from "./bot-archive";@@ -149,7 +149,7 @@ export const GroupListItem = memo(function GroupListItem({onMenu: (menu: { groupId: string; x: number; y: number }) => void;}) {const dispatch = useStoreDispatch(), bots = useStoreSelector((s) => s.bots, sameDrawnBots), instances = useStoreSelector((s) => s.instances);- const advanced = useAdvancedMode();+ const advanced = useAdvancedMode(), feed = useRoomFeed(group);const selected = useStoreSelector((s) => s.activeView === "chat" && s.selectedId === group.id);const [threadsOpen, setThreadsOpen] = useSearchDisclosure(`group:${group.id}`, query ?? "", searchMatchesThreads(query ?? "", group.tasks), selected);const wasSelected = useRef(selected);@@ -157,7 +157,7 @@ export const GroupListItem = memo(function GroupListItem({if (selected && !wasSelected.current) setThreadsOpen(true);wasSelected.current = selected;}, [selected]);- const hasThreadList = (group.tasks?.length ?? 1) > 1 || Boolean(query);+ const hasThreadList = !feed && ((group.tasks?.length ?? 1) > 1 || Boolean(query));const expanded = !group.dm && threadsOpen && density !== "icons" && hasThreadList;const simpleRow = !advanced && density === "comfortable";const railTile = !advanced && density === "icons";@@ -202,7 +202,7 @@ export const GroupListItem = memo(function GroupListItem({{simpleRow && !expanded && group.unread && <RowDot />}</div>{!expanded && <div className="flex items-center justify-between gap-2">- <span className="truncate text-[13px] leading-[18px] text-ink-secondary">{group.description || groupPreview(group, bots, instances, advanced)}</span>+ <span className="truncate text-[13px] leading-[18px] text-ink-secondary">{group.description || (feed && feedPreview(group)) || groupPreview(group, bots, instances, advanced)}</span>{!simpleRow && group.unread && <span className="size-2 shrink-0 rounded-full bg-accent" />}</div>}{simpleRow && <RowStatusText unread={group.unread} />}@@ -215,7 +215,7 @@ export const GroupListItem = memo(function GroupListItem({onClick={() => setThreadsOpen((open) => !open)} className="absolute left-0.5 top-1/2 flex size-5 -translate-y-1/2 items-center justify-center rounded text-ink-secondary outline-none hover:text-ink focus-visible:ring-1 focus-visible:ring-accent/60"><ChevronRight aria-hidden="true" size={12} className={cn("transition-transform", expanded && "rotate-90")} /></button>}- {!group.dm && density !== "icons" && <button type="button" disabled={roomBusy} aria-label={t("task.newShort")} title={t(roomBusy ? "task.newBusy" : "task.newShort")}+ {!group.dm && !feed && density !== "icons" && <button type="button" disabled={roomBusy} aria-label={t("task.newShort")} title={t(roomBusy ? "task.newBusy" : "task.newShort")}onClick={() => { setThreadsOpen(true); dispatch({ type: "newGroupTask", groupId: group.id }); }}className="pointer-events-none absolute right-1 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded text-ink-secondary opacity-0 hover:bg-raised hover:text-ink disabled:opacity-40 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 max-md:pointer-events-auto max-md:opacity-70 touch:pointer-events-auto touch:opacity-70 touch:disabled:opacity-40"><Plus size={16} /></button>}</div>diff --git a/src/components/composer-simple.ts b/src/components/composer-simple.tsindex 9e1fa9fa26..7e39a12daf 100644--- a/src/components/composer-simple.ts+++ b/src/components/composer-simple.ts@@ -22,7 +22,7 @@ export function slotColors(color: Bot["color"] | undefined, room: boolean): { fireturn { fill: tone.fill, ink: tone.ink, button: { className: BOT_BUTTON, style: botButtonStyle(own) } };}-export function composerPlaceholder({ simple, locked, approval, attaching, listening, replying, busy, canSteer, queued, busyName, sendLabel, group, members, jevOn, goal, botName, setupHint }: {+export function composerPlaceholder({ simple, locked, approval, attaching, listening, replying, busy, canSteer, queued, busyName, sendLabel, group, members, jevOn, goal, botName, setupHint, startsThread = false }: {simple: boolean;locked: boolean;approval: boolean;@@ -40,12 +40,15 @@ export function composerPlaceholder({ simple, locked, approval, attaching, listegoal: boolean;botName: string;setupHint: string | null | undefined;+ /** The room feed's composer: every line starts a thread. */+ startsThread?: boolean;}): string {if (locked) return t("composer.placeholder.locked");if (approval) return t("composer.placeholder.approval");if (attaching) return t("composer.placeholder.attaching");if (listening) return t("composer.placeholder.listening");if (replying && !busy) return t("composer.placeholder.reply");+ if (startsThread && group && !goal) return t("composer.placeholder.newThread", { name: group.name });if (simple) {if (!busy && goal) return group ? t("composer.placeholder.goal", { name: group.name }) : t("composer.placeholder.goalSolo", { name: botName });if (!busy && !group && setupHint) return setupHint;diff --git a/src/components/computer-panel-resize.ts b/src/components/computer-panel-resize.tsindex 4681fd8d22..36183a7103 100644--- a/src/components/computer-panel-resize.ts+++ b/src/components/computer-panel-resize.ts@@ -9,13 +9,13 @@ export const CHAT_MIN_WIDTH = 360;const PANEL_DEFAULT_WIDTH = 400;const PANEL_RESIZE_STEP = 40;-function readPanelWidth(): number {+function readPanelWidth(key: string, fallback: number): number {try {- const stored = Number(localStorage.getItem(PANEL_WIDTH_KEY));+ const stored = Number(localStorage.getItem(key));if (Number.isFinite(stored) && stored >= PANEL_MIN_WIDTH) return stored;} catch {}- return PANEL_DEFAULT_WIDTH;+ return fallback;}/** The panel and the chat beside it share the room in the window's row, so the@@ -26,16 +26,17 @@ function measureMaxWidth(panel: HTMLElement, chat: HTMLElement | null): number {}/** The computer panel's drag edge: a pointer drag or the arrow keys resize the- * panel up to the room the chat leaves, and the width is remembered across opens. */-export function useComputerPanelResize() {- const [chosenWidth, setChosenWidth] = useState(readPanelWidth);+ * panel up to the room the chat leaves, and the width is remembered across opens+ * (under `key`, for a panel that keeps its own). */+export function useComputerPanelResize({ key = PANEL_WIDTH_KEY, defaultWidth = PANEL_DEFAULT_WIDTH }: { key?: string; defaultWidth?: number } = {}) {+ const [chosenWidth, setChosenWidth] = useState(() => readPanelWidth(key, defaultWidth));const [maxWidth, setMaxWidth] = useState(PANEL_MAX_WIDTH);const panelWidth = Math.min(chosenWidth, maxWidth);const clamp = (width: number) => Math.min(maxWidth, Math.max(PANEL_MIN_WIDTH, width));const resizeFrom = useRef<{ x: number; width: number } | null>(null);const persistPanelWidth = (width: number) => {try {- localStorage.setItem(PANEL_WIDTH_KEY, String(width));+ localStorage.setItem(key, String(width));} catch {}};diff --git a/src/components/inbox/InboxActive.tsx b/src/components/inbox/InboxActive.tsxindex 4b7ddf7313..39d8c6956a 100644--- a/src/components/inbox/InboxActive.tsx+++ b/src/components/inbox/InboxActive.tsx@@ -3,15 +3,18 @@import { Pin, PinOff } from "lucide-react";import type { InboxView } from "../../../shared/inbox";import { t } from "@/lib/i18n";+import { roomFeedEnabled } from "@/lib/feature-flags";+import { roomFeedShows } from "@/lib/room-feed";import { type AppState } from "@/state/store";import { sameJson } from "@/state/same-json";-import { useStoreDispatch, useStoreSelector } from "@/state/store-select";+import { useStoreSelector } from "@/state/store-select";import { useTeamPeople } from "@/state/team-people";-import { AttentionThreadRows, attentionJumpAction, crossBotAttentionThreads, type AttentionThread, type OpenThread } from "../SidebarBotActivity";+import { AttentionThreadRows, crossBotAttentionThreads, type AttentionThread, type OpenThread } from "../SidebarBotActivity";import { NeedsYouLine } from "../TeamOwner";import { setAttentionPinned, useAttentionPinned } from "./attention-pinned";import { closeInbox } from "@/state/inbox";import { inboxFixes } from "./inbox-view";+import { useInboxJump } from "./use-inbox-actions";/** The conversations this list shows: the work in progress — at work, waiting on a teammate or on the person, or* finished but still unread. A conversation the person has read leaves for the finished list below, so the two lists@@ -28,13 +31,16 @@ export function inboxAttentionEntries(state: Pick<AppState, "bots" | "pendingQue.filter((entry) => !asked.has(entry.task.threadId) && inProgress(entry.task));}-/** The conversation the chat window has open, if it shows one: a bot's current thread, or the room's. */-export function inboxOpenThread(state: Pick<AppState, "activeView" | "selectedId" | "bots" | "groups">): OpenThread | undefined {+/** The conversation open beside the chat, or else the one the chat window shows: a bot's current thread, or the room's+ * (none for a room's feed). */+export function inboxOpenThread(state: Pick<AppState, "activeView" | "selectedId" | "bots" | "groups"> & Partial<Pick<AppState, "forkPanel" | "config">>): OpenThread | undefined {+ const panel = roomFeedEnabled(state.config) ? state.forkPanel : null;+ if (panel) return panel.kind === "bot" ? { kind: "bot", botId: panel.ownerId, threadId: panel.threadId } : { kind: "group", groupId: panel.ownerId, threadId: panel.threadId };if (state.activeView !== "chat") return undefined;const bot = state.bots.find((one) => one.id === state.selectedId);if (bot) return { kind: "bot", botId: bot.id, threadId: bot.threadId };const group = state.groups.find((one) => one.id === state.selectedId);- return group ? { kind: "group", groupId: group.id, threadId: group.threadId } : undefined;+ return group && !roomFeedShows(state.config, group) ? { kind: "group", groupId: group.id, threadId: group.threadId } : undefined;}/** The conversations whose news lines have all been read: reading in the Inbox counts as reading them. Finished work@@ -64,7 +70,7 @@ export function InboxActive({ view, current, exclude }: {/** Conversations the pinned section at the top already shows: these lists leave them out so none appears twice. */exclude?: ReadonlySet<string>;}) {- const dispatch = useStoreDispatch();+ const jump = useInboxJump();const team = useTeamPeople();const pinned = useAttentionPinned();const entries = useStoreSelector((state) => inboxAttentionEntries(state, view).filter((entry) => !exclude?.has(entry.task.threadId)), sameJson);@@ -85,7 +91,7 @@ export function InboxActive({ view, current, exclude }: {{pinned ? <PinOff size={14} aria-hidden="true" /> : <Pin size={14} aria-hidden="true" />}</button></div>- <AttentionThreadRows inset entries={entries} unreadDot current={current} onJump={(entry) => dispatch(attentionJumpAction(entry))} />+ <AttentionThreadRows inset entries={entries} unreadDot current={current} onJump={jump} /></section>)}</>diff --git a/src/components/inbox/InboxPanel.tsx b/src/components/inbox/InboxPanel.tsxindex 1b24a19942..749022140e 100644--- a/src/components/inbox/InboxPanel.tsx+++ b/src/components/inbox/InboxPanel.tsx@@ -11,14 +11,14 @@ import { sameJson } from "@/state/same-json";import { useStoreDispatch, useStoreSelector } from "@/state/store-select";import { useActiveLocale } from "@/lib/use-active-locale";import { InboxActive, inboxAttentionEntries, inboxOpenThread, readNewsThreads, unreadConversations } from "./InboxActive";-import { attentionJumpAction, attentionUnpinAction } from "../SidebarBotActivity";+import { attentionUnpinAction } from "../SidebarBotActivity";import { InboxReading } from "./InboxReading";import { InboxRowItem } from "./InboxRow";import { FinishedThreads, finishedThreads } from "./FinishedThreads";import { PinnedThreads, pinnedThreadRows } from "./PinnedThreads";import { matchesSearch, nextAfter } from "./inbox-answer";import { listedRows, rowsIn, waitingCount } from "./inbox-view";-import { useInboxActions } from "./use-inbox-actions";+import { useInboxActions, useInboxJump } from "./use-inbox-actions";import { roundButtonCls } from "../bot-panel/rows";@@ -30,7 +30,7 @@ export const InboxPanel = memo(function InboxPanel() {const markingAll = useInboxMarkingAll();const phone = useMediaQuery(PHONE_LAYOUT);const simple = !useAdvancedMode();- const { run, openInChat } = useInboxActions(view);+ const { run, openInChat } = useInboxActions(view), jump = useInboxJump();const [now, setNow] = useState(() => Date.now());const [query, setQuery] = useState("");const [showDone, setShowDone] = useState(false);@@ -114,7 +114,7 @@ export const InboxPanel = memo(function InboxPanel() {<><div className="min-h-0 flex-1 overflow-y-auto">{/* The conversations each bot and room pinned, at the top of the list. */}- {!query.trim() && <PinnedThreads rows={pinnedRows} now={now} current={openThread} onOpen={(row) => dispatch(attentionJumpAction(row))} onUnpin={(row) => dispatch(attentionUnpinAction(row))} />}+ {!query.trim() && <PinnedThreads rows={pinnedRows} now={now} current={openThread} onOpen={jump} onUnpin={(row) => dispatch(attentionUnpinAction(row))} />}{listed.length > 0 && <label className="mx-[13px] my-2.5 flex h-8 items-center gap-2 rounded-lg bg-ink/[0.045] px-2.5 ring-[0.5px] ring-ink/[0.12] focus-within:ring-ink/30"><Search size={14} aria-hidden="true" className="shrink-0 text-ink-tertiary" /><input type="search" value={query} onChange={(event) => setQuery(event.target.value)} placeholder={t("inbox.search")} aria-label={t("inbox.search")}@@ -135,7 +135,7 @@ export const InboxPanel = memo(function InboxPanel() {</div>{!query.trim() && <InboxActive view={view} current={openThread} exclude={pinnedThreads} />}{/* The finished, already-read conversations. */}- {!query.trim() && <FinishedThreads rows={finishedRows} now={now} current={openThread} onOpen={(row) => dispatch(attentionJumpAction(row))} />}+ {!query.trim() && <FinishedThreads rows={finishedRows} now={now} current={openThread} onOpen={jump} />}{done.length > 0 && (<section data-inbox-done className="px-1.5 pb-1.5"><button type="button" data-inbox-done-toggle aria-expanded={showDone} onClick={() => setShowDone(!showDone)}diff --git a/src/components/inbox/use-inbox-actions.ts b/src/components/inbox/use-inbox-actions.tsindex 172c9d3792..fdd205d899 100644--- a/src/components/inbox/use-inbox-actions.ts+++ b/src/components/inbox/use-inbox-actions.ts@@ -2,12 +2,14 @@ import { useCallback } from "react";import type { InboxRow, InboxView } from "../../../shared/inbox";import { useShowThreads } from "@/lib/thread-preferences";import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";+import { openThreadBeside } from "@/lib/room-feed";import { openThread } from "@/state/store";import { useStoreRef } from "@/state/store-ref";import { useStoreSelector } from "@/state/store-select";import { closeInbox, doneInboxRow, openInbox, readInboxRow, refreshInbox } from "@/state/inbox";import type { CardResponse } from "@/lib/card-answer";import { answerThread, closeResponse, type QuickAction } from "./inbox-view";+import { attentionJumpAction, type AttentionThread } from "../SidebarBotActivity";/** What a row's buttons do. An ask is answered through its copy's card here, which answers the card where it was asked,* as its buttons in the chat do; a line of news is done, or opened where it came from. */@@ -29,7 +31,7 @@ export function useInboxActions(view: InboxView | null) {const target = row.origin ? { botId: row.origin.botId, threadId: row.origin.threadId, messageId: row.origin.messageId }: view?.threadId && view.botId ? { botId: view.botId, threadId: view.threadId, messageId: row.id } : null;if (!target) return;- openThread(dispatch, { botId: target.botId, threadId: target.threadId }, store.state(), showThreads);+ if (phone || !openThreadBeside(dispatch, target.threadId, store.state())) openThread(dispatch, { botId: target.botId, threadId: target.threadId }, store.state(), showThreads);if (target.messageId) dispatch({ type: "focusMessage", threadId: target.threadId, messageId: target.messageId });// The conversation is in the main window; on a phone the inbox is a sheet over it.if (phone) closeInbox();@@ -46,6 +48,15 @@ export function useInboxActions(view: InboxView | null) {return { run, answer, openInChat };}+/** A conversation listed in the Inbox opens beside the chat with the room feed on, and in the chat otherwise. */+export function useInboxJump() {+ const store = useStoreRef(), dispatch = store.dispatch;+ const phone = useMediaQuery(PHONE_LAYOUT);+ return useCallback((entry: AttentionThread) => {+ if (phone || !openThreadBeside(dispatch, entry.task.threadId, store.state())) dispatch(attentionJumpAction(entry));+ }, [store, dispatch, phone]);+}+/** The bot a line is from: its face leads the line's card and its colour is on the card's answer. None for a teammate's line. */export function useInboxAsker(row: InboxRow) {return useStoreSelector((state) => (row.from.botId ? state.bots.find((bot) => bot.id === row.from.botId) : undefined));diff --git a/src/components/room-feed/FeedComposer.tsx b/src/components/room-feed/FeedComposer.tsxnew file mode 100644index 0000000000..8fd865cae3--- /dev/null+++ b/src/components/room-feed/FeedComposer.tsx@@ -0,0 +1,29 @@+import { useCallback, useMemo } from "react";+import type { Bot, Group } from "@/state/store";+import { useStoreDispatch } from "@/state/store-select";+import { RoomComposer } from "../bot-access/RoomComposer";+import { feedDraftThread, startFeedThread } from "./start-thread";++/** The composer under a room's feed: every line sent here starts a new thread. Its draft is the feed's own, never tied+ * to a thread that is working. */+export function FeedComposer({ group, members, onPending, onStarted }: {+ group: Group;+ members: Bot[];+ /** The line on its way, or null once it can't be: the draft is back in the composer. */+ onPending: (text: string | null) => void;+ onStarted: (threadId: string) => void;+}) {+ const dispatch = useStoreDispatch();+ const draft = useMemo<Group>(() => ({ ...group, threadId: feedDraftThread(group.id), messages: [], hasMore: false, working: false, busyBotId: null,+ turnStartedAt: null, pinnedMessageId: undefined, queue: [] }), [group]);+ const send = useCallback((action: Parameters<NonNullable<Parameters<typeof RoomComposer>[0]["onSendGroup"]>>[0]) => {+ onPending(action.text);+ const failed = () => { action.onError?.(); onPending(null); };+ void startFeedThread({ ...action, onError: failed }, dispatch).then((threadId) => { if (threadId) onStarted(threadId); });+ }, [dispatch, onPending, onStarted]);+ return (+ <div data-room-feed-composer="">+ <RoomComposer group={draft} members={members} onSendGroup={send} />+ </div>+ );+}diff --git a/src/components/room-feed/RoomFeedRow.dom.test.ts b/src/components/room-feed/RoomFeedRow.dom.test.tsnew file mode 100644index 0000000000..adf0e54074--- /dev/null+++ b/src/components/room-feed/RoomFeedRow.dom.test.ts@@ -0,0 +1,86 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, describe, expect, it, vi } from "vitest";+import type { Bot } from "@/state/store";+import { RoomFeedRow, type FeedRowData } from "./RoomFeedRow";++(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }).IS_REACT_ACT_ENVIRONMENT = true;++const NOW = Date.UTC(2026, 10, 24, 12, 0, 0);+const bot = (id: string, name: string, color: Bot["color"]) => ({ id, name, color, threadId: `${id}-main`, messages: [] } as unknown as Bot);+const BOTS = [bot("kiwi", "Kiwi", "green"), bot("pip", "Pip", "purple")];+const row = (extra: Partial<FeedRowData> = {}): FeedRowData => ({+ threadId: "t1", speaker: { person: { name: "Ana" } }, text: "Plan the launch", at: NOW - 3_600_000,+ replies: 0, lastReplyAt: null, repliers: [], mark: null, working: false, workingBotId: null, ...extra,+});++let root: Root | null = null;+const render = (data: FeedRowData, onOpen = vi.fn(), open = false) => {+ root = createRoot(document.body.appendChild(document.createElement("ol")));+ act(() => root!.render(createElement(RoomFeedRow, { row: data, bots: BOTS, you: "Sam", now: NOW, open, onOpen })));+ return onOpen;+};+const item = () => document.querySelector<HTMLElement>("[data-feed-thread]")!;+afterEach(() => { act(() => root?.unmount()); root = null; document.body.innerHTML = ""; });++describe("a room feed row", () => {+ it("shows the first line, who said it and when, and opens its thread from anywhere on the row", () => {+ const onOpen = render(row());+ expect(item().textContent).toContain("Ana");+ expect(item().textContent).toContain("Plan the launch");+ expect(item().textContent).toContain("1 h ago");+ expect(item().textContent).toContain("No replies yet");+ const button = item().querySelector("button")!;+ expect(button.getAttribute("aria-label")).toBe("Ana, Plan the launch, No replies yet");+ act(() => button.click());+ expect(onOpen).toHaveBeenCalledWith("t1");+ });++ it("counts the replies, shows who wrote them and when the last came", () => {+ render(row({ replies: 4, lastReplyAt: NOW - 5 * 60_000, repliers: [{ botId: "kiwi" }, { person: { name: "Ana" } }, { botId: "pip" }, { botId: "kiwi" }] }));+ expect(item().textContent).toContain("4 replies");+ expect(item().textContent).toContain("Last reply 5 min ago");+ expect(item().querySelector("[data-feed-repliers]")!.children).toHaveLength(3);+ act(() => root!.unmount());+ render(row({ replies: 1, lastReplyAt: NOW - 30_000, repliers: [{ botId: "kiwi" }] }));+ expect(item().textContent).toContain("1 reply");+ expect(item().textContent).toContain("Last reply just now");+ });++ it("names a bot in its colour, and a person with no name by the profile's", () => {+ render(row({ speaker: { botId: "pip" }, text: "**Morning** brief" }));+ expect(item().querySelector('[data-bot-color="purple"]')?.textContent).toBe("Pip");+ expect(item().querySelector("strong")?.textContent).toBe("Morning");+ act(() => root!.unmount());+ render(row({ speaker: { person: {} } }));+ expect(item().textContent).toContain("Sam");+ });++ it("marks a thread waiting on the person over unread, and says a bot is answering", () => {+ render(row({ mark: "waiting" }));+ expect(item().querySelector("[data-feed-mark]")?.getAttribute("data-feed-mark")).toBe("waiting");+ expect(item().querySelector("button")!.getAttribute("aria-label")).toContain("Waiting for you…");+ act(() => root!.unmount());+ render(row({ mark: "unread", working: true, workingBotId: "kiwi", replies: 2 }));+ expect(item().querySelector("[data-feed-mark]")?.getAttribute("data-feed-mark")).toBe("unread");+ expect(item().textContent).toContain("Kiwi is working…");+ expect(item().textContent).not.toContain("2 replies");+ });++ it("fades a long line, ends a clipped one with an ellipsis, and names an attachment-only line", () => {+ render(row({ text: "word ".repeat(80), clipped: true }));+ const body = item().querySelector<HTMLElement>(".chat-text")!;+ expect(body.className).toContain("mask-image");+ expect(body.textContent?.endsWith("…")).toBe(true);+ act(() => root!.unmount());+ render(row({ text: '<attached-image path="/tmp/omb-uploads/a.png" name="a.png" />' }));+ expect(item().textContent).toContain("An attachment");+ });++ it("shows the row whose thread is open beside the feed as current", () => {+ render(row(), vi.fn(), true);+ expect(item().querySelector("button")!.getAttribute("aria-current")).toBe("true");+ expect(item().className).toContain("bg-raised");+ });+});diff --git a/src/components/room-feed/RoomFeedRow.tsx b/src/components/room-feed/RoomFeedRow.tsxnew file mode 100644index 0000000000..9ebda775d3--- /dev/null+++ b/src/components/room-feed/RoomFeedRow.tsx@@ -0,0 +1,131 @@+import { memo, useMemo } from "react";+import type { RoomThreadSpeaker } from "../../../shared/room-threads";+import { splitTranscriptCitations } from "@/lib/citations";+import { cn } from "@/lib/cn";+import { splitTranscriptAttachments } from "@/lib/composer-attachments";+import { intlLocale, t } from "@/lib/i18n";+import { MAUS_COLOR_NAMES } from "@/lib/mascot";+import type { Bot } from "@/state/store";+import { stripLeakedSystemHarnessMessages } from "../../../shared/system-message-guard.ts";+import { BotAvatar } from "../Avatar";+import { ChatMarkdown } from "../ChatMarkdown";+import { threadUpdatedLabel } from "../SidebarThreadRow";+import { PersonFace } from "../TeamOwner";+import { ThreadRefText } from "../ThreadRefs";++export interface FeedRowData {+ threadId: string;+ speaker: RoomThreadSpeaker;+ text: string;+ clipped?: boolean;+ at: number;+ replies: number;+ lastReplyAt: number | null;+ repliers: RoomThreadSpeaker[];+ /** Waiting for the person wins over unread. */+ mark: "waiting" | "unread" | null;+ /** The bot answering in it now. */+ workingBotId: string | null;+ working: boolean;+}++const FACES = 3;+const LONG_CHARS = 280;+const LONG_LINES = 4;++interface Who { key: string; name: string; bot?: Bot; personId?: string }++function who(speaker: RoomThreadSpeaker, bots: readonly Bot[], you: string): Who {+ if ("botId" in speaker) {+ const bot = bots.find((candidate) => candidate.id === speaker.botId);+ return { key: `bot:${speaker.botId}`, name: bot?.name ?? t("room.aBot"), bot };+ }+ const name = speaker.person.name?.trim() || you;+ return { key: `person:${speaker.person.id ?? name}`, name, personId: speaker.person.id };+}++function Face({ who: speaker, size }: { who: Who; size: number }) {+ if (speaker.key.startsWith("bot:")) {+ return <BotAvatar bot={speaker.bot ?? { name: speaker.name, color: "blue" }} state="happy" size={size} motion="none" motionKey={0} animated={false} />;+ }+ return <PersonFace person={{ email: speaker.personId ?? speaker.name, name: speaker.name, role: "member" }} size={size} />;+}++function Name({ who: speaker }: { who: Who }) {+ const color = speaker.bot?.color;+ const known = (MAUS_COLOR_NAMES as readonly string[]).includes(color ?? "");+ return <span dir="auto" data-bot-color={known ? color : undefined}+ className={cn("min-w-0 truncate text-[13px] font-semibold leading-[18px]", known ? "bot-identity" : "text-ink-secondary")}>{speaker.name}</span>;+}++/** What the first line says, without the markers an attachment or a quote leaves in a person's text. */+function previewText(row: FeedRowData, bot: boolean): string {+ const text = bot ? stripLeakedSystemHarnessMessages(row.text) : splitTranscriptAttachments(splitTranscriptCitations(row.text).display).display;+ const trimmed = text.trim();+ if (!trimmed) return "";+ return row.clipped ? `${trimmed.trimEnd()}…` : trimmed;+}++/** One thread in a room's feed: its first line and who said it, then how many replies it has, who wrote them and when+ * the last came. The whole row opens the thread beside the feed. */+export const RoomFeedRow = memo(function RoomFeedRow({ row, bots, you, now, open, onOpen }: {+ row: FeedRowData;+ bots: readonly Bot[];+ /** What a person whose lines carry no name is called: the profile's name. */+ you: string;+ now: number;+ open: boolean;+ onOpen: (threadId: string) => void;+}) {+ const speaker = who(row.speaker, bots, you);+ const fromBot = "botId" in row.speaker;+ const text = useMemo(() => previewText(row, fromBot), [row, fromBot]);+ const long = text.length > LONG_CHARS || text.split("\n").length > LONG_LINES;+ const repliers = useMemo(() => {+ const seen = new Set<string>();+ return row.repliers.map((one) => who(one, bots, you)).filter((one) => !seen.has(one.key) && Boolean(seen.add(one.key))).slice(0, FACES);+ }, [row.repliers, bots, you]);+ const workingBot = row.workingBotId ? bots.find((bot) => bot.id === row.workingBotId) : undefined;+ const replies = row.replies === 1 ? t("room.feed.replyOne") : t("room.feed.replyMany", { count: row.replies });+ const markLabel = row.mark === "waiting" ? t("sidebar.preview.waiting") : row.mark === "unread" ? t("task.unread") : null;+ const label = [speaker.name, text || t("room.feed.attachment"), row.replies > 0 ? replies : t("room.feed.noReplies"), markLabel].filter(Boolean).join(", ");+ return (+ <li data-feed-thread={row.threadId} className={cn("group relative flex gap-3 rounded-xl px-3 py-2.5 transition-colors duration-[120ms] motion-reduce:transition-none",+ open ? "bg-raised" : "hover:bg-ink/[0.06] active:bg-ink/[0.08]")}>+ <button type="button" aria-label={label} aria-current={open ? "true" : undefined} onClick={() => onOpen(row.threadId)}+ className="absolute inset-0 z-[1] rounded-xl" />+ <span className="mt-0.5 flex shrink-0"><Face who={speaker} size={32} /></span>+ <div inert className="min-w-0 flex-1">+ <div className="flex min-w-0 items-baseline gap-2 pe-5">+ <Name who={speaker} />+ <time dateTime={new Date(row.at).toISOString()} title={new Date(row.at).toLocaleString(intlLocale())}+ className="shrink-0 text-[12px] font-medium leading-4 text-ink-tertiary tabular-nums">{threadUpdatedLabel(row.at, now)}</time>+ </div>+ <div dir="auto" className={cn("chat-text mt-0.5 max-h-[110px] overflow-hidden text-[15px] leading-[22px] text-ink [overflow-wrap:anywhere]",+ long && "[mask-image:linear-gradient(to_bottom,black_60%,transparent)]", !text && "text-ink-secondary")}>+ {!text ? t("room.feed.attachment")+ : fromBot ? <ChatMarkdown text={text} mentionPeers={bots} everyone />+ : <div className="whitespace-pre-wrap"><ThreadRefText text={text} peers={bots} everyone /></div>}+ </div>+ <div className="mt-1.5 flex min-w-0 items-center gap-2 text-[12px] leading-4">+ {row.working ? (+ <span className="flex min-w-0 items-center gap-1.5 text-ink-secondary">+ {workingBot && <BotAvatar bot={workingBot} state="working" size={16} motion="none" motionKey={0} animated={false} />}+ <span className="truncate">{workingBot ? t("sidebar.preview.botWorking", { name: workingBot.name }) : t("sidebar.preview.working")}</span>+ </span>+ ) : row.replies > 0 ? (+ <>+ <span aria-hidden="true" data-feed-repliers="" className="flex shrink-0 items-center gap-0.5">+ {repliers.map((one) => <span key={one.key} className="inline-flex"><Face who={one} size={18} /></span>)}+ </span>+ <span className="shrink-0 font-medium text-ink-secondary tabular-nums">{replies}</span>+ {row.lastReplyAt !== null && <span className="min-w-0 truncate text-ink-tertiary">{t("room.feed.lastReply", { when: threadUpdatedLabel(row.lastReplyAt, now) })}</span>}+ </>+ ) : <span className="text-ink-tertiary">{t("room.feed.noReplies")}</span>}+ </div>+ </div>+ {markLabel && <span aria-hidden="true" data-feed-mark={row.mark} title={markLabel}+ className={cn("absolute end-3 top-3.5 size-2 rounded-full", row.mark === "waiting" ? "bg-warning" : "bg-accent")} />}+ </li>+ );+});diff --git a/src/components/room-feed/RoomFeedView.tsx b/src/components/room-feed/RoomFeedView.tsxnew file mode 100644index 0000000000..936dc042c0--- /dev/null+++ b/src/components/room-feed/RoomFeedView.tsx@@ -0,0 +1,144 @@+import { useCallback, useLayoutEffect, useMemo, useRef, useState } from "react";+import { useAdvancedMode } from "@/lib/interface-mode";+import { t } from "@/lib/i18n";+import { openFeedThread } from "@/lib/room-feed";+import { simpleRoomHeader } from "@/lib/room-panel";+import { roomThreadSpeakerId, roomThreadWorking } from "@/lib/room-threads";+import { useComposerDockPad } from "@/lib/composer-dock";+import { sameDrawnBots } from "@/lib/drawn-bots";+import type { Bot, Group } from "@/state/store";+import { useStoreDispatch, useStoreSelector } from "@/state/store-select";+import { ChatErrorBanner, ChatNotice } from "../ChatErrorBanner";+import { ChatBackdrop, GlassBar, GlassScrollFrame } from "../GlassScrollFrame";+import { ManageMembersPanel } from "../ManageMembersPanel";+import { RoomBulletin } from "../RoomBulletin";+import { RoomChiefAbsent } from "../RoomChiefAbsent";+import { RoomHeader } from "../RoomHeader";+import { RoomHoldsBanner } from "../RoomHoldsBanner";+import { RoomWorkingFolder } from "../RoomWorkingFolder";+import { useRelativeNow } from "../SidebarThreadRow";+import { FeedComposer } from "./FeedComposer";+import { RoomFeedRow, type FeedRowData } from "./RoomFeedRow";+import { useRoomThreads, type FeedThread } from "./use-room-threads";++/** How near the foot the feed counts as being read there, so a new thread keeps it at the foot. */+const FOOT_PX = 48;+/** Only the person scrolling takes the feed off its foot; a row opening beside it or a window resize never does. */+const INTENT_MS = 1_000;++const toRow = (group: Group, { task, summary }: FeedThread): FeedRowData => ({+ threadId: task.threadId,+ speaker: summary.first.speaker,+ text: summary.first.text,+ clipped: summary.first.clipped,+ at: summary.first.at,+ replies: summary.replies,+ lastReplyAt: summary.lastReplyAt,+ repliers: summary.repliers,+ mark: task.activity === "waiting-on-you" ? "waiting" : task.unread ? "unread" : null,+ working: roomThreadWorking(group, task.threadId),+ workingBotId: roomThreadSpeakerId(group, task.threadId),+});++/** A room as one feed of its threads, oldest at the top and the newest just above the composer, where a line starts a+ * new thread. A row opens its thread beside the feed; the room's current thread, which is everyone's, never moves. */+export function RoomFeedView({ group }: { group: Group }) {+ const dispatch = useStoreDispatch();+ const bots = useStoreSelector((state) => state.bots, sameDrawnBots);+ const you = useStoreSelector((state) => state.config?.profile?.name?.trim()) || t("room.feed.you");+ const error = useStoreSelector((state) => state.error);+ const notice = useStoreSelector((state) => state.notice);+ const openThread = useStoreSelector((state) => (state.forkPanel?.kind === "group" && state.forkPanel.ownerId === group.id ? state.forkPanel.threadId : null));+ const advanced = useAdvancedMode();+ const remoteClient = window.ogb?.remoteClient?.active === true;+ const simpleHeader = simpleRoomHeader({ advanced, remoteClient, group, setupPending: false });+ const members = useMemo(() => group.memberIds.map((id) => bots.find((bot) => bot.id === id)).filter((bot): bot is Bot => Boolean(bot)), [group.memberIds, bots]);+ const [membersOpen, setMembersOpen] = useState(false);+ const [folderOpen, setFolderOpen] = useState(false);+ const membersTriggerRef = useRef<HTMLButtonElement>(null);+ const closeMembers = useCallback(() => setMembersOpen(false), []);+ const composerDockRef = useRef<HTMLDivElement>(null);+ const composerDock = useComposerDockPad(composerDockRef);+ const now = useRelativeNow();+ const { threads, failed, retry } = useRoomThreads(group);+ const [pending, setPending] = useState<{ text: string; at: number; threadId: string | null } | null>(null);++ const rows = useMemo(() => {+ if (!threads) return null;+ const listed = threads.map((thread) => toRow(group, thread));+ if (!pending || (pending.threadId && listed.some((row) => row.threadId === pending.threadId))) return listed;+ return [...listed, { threadId: pending.threadId ?? "", speaker: { person: {} }, text: pending.text, at: pending.at, replies: 0, lastReplyAt: null,+ repliers: [], mark: null, working: false, workingBotId: null } satisfies FeedRowData];+ }, [threads, pending, group]);++ const waiting = useCallback((text: string | null) => {+ setPending(text === null ? null : { text, at: Date.now(), threadId: null });+ atFoot.current = true;+ }, []);+ const started = useCallback((threadId: string) => setPending((current) => current && { ...current, threadId }), []);+ const open = useCallback((threadId: string) => { if (threadId) dispatch(openFeedThread(group.id, threadId, true)); }, [dispatch, group.id]);++ const scrollRef = useRef<HTMLDivElement>(null);+ const contentRef = useRef<HTMLDivElement>(null);+ const atFoot = useRef(true);+ const scrolledAt = useRef(0);+ const moved = useCallback(() => { scrolledAt.current = Date.now(); }, []);+ useLayoutEffect(() => {+ const scroller = scrollRef.current, content = contentRef.current;+ if (!scroller || !content) return;+ const keep = () => { if (atFoot.current) scroller.scrollTop = scroller.scrollHeight; };+ keep();+ const sizes = new ResizeObserver(keep);+ sizes.observe(content);+ sizes.observe(scroller);+ return () => sizes.disconnect();+ }, [group.id]);++ return (+ <main data-look="chat" data-room-feed={group.id} className="relative flex h-full min-w-0 flex-1 flex-col bg-app">+ <ChatBackdrop />+ {membersOpen && !remoteClient && <ManageMembersPanel group={group} onClose={closeMembers} triggerRef={membersTriggerRef} />}+ <GlassScrollFrame className="flex-1 [--glass-tint:var(--color-app)]">+ <GlassBar edge="top" fade={!advanced && !remoteClient} className="z-[25]">+ <RoomHeader group={group} members={members} simple={simpleHeader} setupPending={false} remoteClient={remoteClient} feed+ findOpen={false} onToggleFind={() => {}} onToggleFolder={() => setFolderOpen((shown) => !shown)} onOpenMembers={() => setMembersOpen(true)}+ membersTriggerRef={membersTriggerRef} />+ <ChatErrorBanner message={error} onDismiss={() => dispatch({ type: "error", message: null })} />+ <ChatNotice notice={notice} />+ {!remoteClient && <RoomChiefAbsent group={group} />}+ <RoomHoldsBanner group={group} members={members} />+ {!simpleHeader && <RoomBulletin group={group} remoteClient={remoteClient} />}+ {folderOpen && <div className="w-full px-5"><div className="mb-1"><RoomWorkingFolder group={group} /></div></div>}+ </GlassBar>+ <div ref={scrollRef} className="glass-scroller h-full overflow-x-hidden overflow-y-auto px-4 [overflow-anchor:none]"+ onWheel={moved} onTouchMove={moved} onKeyDown={moved} onPointerDown={moved}+ onScroll={(event) => {+ const el = event.currentTarget, foot = el.scrollHeight - el.scrollTop - el.clientHeight < FOOT_PX;+ if (foot || Date.now() - scrolledAt.current < INTENT_MS) atFoot.current = foot;+ }}>+ <div ref={contentRef} className="glass-scroller-content chat-column flex min-h-full w-full flex-col justify-end" style={{ paddingBottom: composerDock.pad }}>+ {rows === null ? (+ failed && (+ <p role="alert" className="flex items-center justify-center gap-2 py-6 text-[13px] text-ink-secondary">+ {t("room.feed.loadFailed")}+ <button type="button" className="ui-button ui-button-sm" onClick={retry}>{t("chat.retry")}</button>+ </p>+ )+ ) : rows.length === 0 ? (+ <p className="py-6 text-center text-[13px] text-ink-secondary">{t("room.feed.empty")}</p>+ ) : (+ <ol aria-label={t("room.feed.aria", { name: group.name })} className="flex flex-col gap-0.5 py-2">+ {rows.map((row) => (+ <RoomFeedRow key={row.threadId || "pending"} row={row} bots={bots} you={you} now={now} open={row.threadId !== "" && row.threadId === openThread} onOpen={open} />+ ))}+ </ol>+ )}+ </div>+ </div>+ <div ref={composerDockRef} className="absolute inset-x-0 bottom-0 z-[2] chat-column-dock">+ <FeedComposer group={group} members={members} onPending={waiting} onStarted={started} />+ </div>+ </GlassScrollFrame>+ </main>+ );+}diff --git a/src/components/room-feed/start-thread.test.ts b/src/components/room-feed/start-thread.test.tsnew file mode 100644index 0000000000..1e216f2b4d--- /dev/null+++ b/src/components/room-feed/start-thread.test.ts@@ -0,0 +1,41 @@+import { describe, expect, it, vi } from "vitest";+import type { Action } from "@/state/store";+import { startFeedThread } from "./start-thread";++type SendGroup = Extract<Action, { type: "sendGroup" }>;+const send = (extra: Partial<SendGroup> = {}): SendGroup => ({ type: "sendGroup", groupId: "room", text: "Plan the launch", sendId: `s-${Math.random()}`, threadId: "feed-room", mode: "chat", ...extra });++describe("a line sent from the room feed", () => {+ it("makes a thread without making it the room's current one, opens it beside the feed, then sends there", async () => {+ const request = vi.fn(async () => ({ group: { id: "room", threadId: "current" }, task: { threadId: "new" } }));+ const dispatch = vi.fn();+ const line = send();+ expect(await startFeedThread(line, dispatch, request as never)).toBe("new");+ expect(request).toHaveBeenCalledWith("/api/groups/room/tasks", { method: "POST", body: JSON.stringify({ activate: false }) });+ expect(dispatch.mock.calls.map(([action]) => action)).toEqual([+ { type: "groupPatched", group: { id: "room", threadId: "current" } },+ { type: "openForkPanel", kind: "group", ownerId: "room", threadId: "new" },+ { ...line, threadId: "new" },+ ]);+ expect(dispatch.mock.calls.some(([action]) => action.type === "switchGroupTask" || action.type === "newGroupTask")).toBe(false);+ });++ it("writes a retried send to the thread it already started", async () => {+ const request = vi.fn(async () => ({ task: { threadId: "made-once" } }));+ const line = send();+ await startFeedThread(line, vi.fn(), request as never);+ const dispatch = vi.fn();+ expect(await startFeedThread(line, dispatch, request as never)).toBe("made-once");+ expect(request).toHaveBeenCalledTimes(1);+ expect(dispatch).toHaveBeenLastCalledWith({ ...line, threadId: "made-once" });+ });++ it("gives the draft back and says so when the thread can't be made", async () => {+ const onError = vi.fn();+ const dispatch = vi.fn();+ expect(await startFeedThread(send({ onError }), dispatch, (async () => { throw new Error("offline"); }) as never)).toBeNull();+ expect(onError).toHaveBeenCalledOnce();+ expect(dispatch).toHaveBeenCalledWith({ type: "error", message: "Couldn't start a thread. Check your connection and try again." });+ expect(dispatch.mock.calls.some(([action]) => action.type === "sendGroup")).toBe(false);+ });+});diff --git a/src/components/room-feed/start-thread.ts b/src/components/room-feed/start-thread.tsnew file mode 100644index 0000000000..d1e9d67103--- /dev/null+++ b/src/components/room-feed/start-thread.ts@@ -0,0 +1,34 @@+import { t } from "@/lib/i18n";+import { openFeedThread } from "@/lib/room-feed";+import { api, type Action, type Group } from "@/state/store";++type SendGroup = Extract<Action, { type: "sendGroup" }>;+type Created = { group?: Partial<Group> & { id: string }; task: { threadId: string } };++/** The thread each send started, so sending it again after a failure writes there instead of starting another. */+const started = new Map<string, string>();++/** The composer's id for a room feed's line that has no thread yet. */+export const feedDraftThread = (groupId: string) => `feed-${groupId}`;++/** A line written in the feed starts a thread of its own, made without becoming the room's current thread (that is+ * everyone's), opens it beside the feed, and is sent there; the room's usual responder answers it. Resolves to the new+ * thread, or null when it couldn't be made. */+export async function startFeedThread(send: SendGroup, dispatch: (action: Action) => void, request: typeof api = api): Promise<string | null> {+ let threadId = send.sendId ? started.get(send.sendId) : undefined;+ if (!threadId) {+ try {+ const made = await request<Created>(`/api/groups/${send.groupId}/tasks`, { method: "POST", body: JSON.stringify({ activate: false }) });+ if (made.group) dispatch({ type: "groupPatched", group: made.group });+ threadId = made.task.threadId;+ if (send.sendId) started.set(send.sendId, threadId);+ } catch {+ send.onError?.();+ dispatch({ type: "error", message: t("room.feed.startFailed") });+ return null;+ }+ }+ dispatch(openFeedThread(send.groupId, threadId));+ dispatch({ ...send, threadId });+ return threadId;+}diff --git a/src/components/room-feed/use-room-feed.ts b/src/components/room-feed/use-room-feed.tsnew file mode 100644index 0000000000..5da8bbf80d--- /dev/null+++ b/src/components/room-feed/use-room-feed.ts@@ -0,0 +1,10 @@+import { settingUp, type FeedRoom } from "@/lib/room-feed";+import { useFeature } from "@/lib/use-feature";+import { SIDEBAR_INLINE, useMediaQuery } from "@/lib/use-media-query";++/** Whether this room shows as its feed of threads (roomFeedShows), following the switch and the window as they change. */+export function useRoomFeed(group: FeedRoom | undefined): boolean {+ const on = useFeature("roomFeed");+ const wide = useMediaQuery(SIDEBAR_INLINE, true);+ return Boolean(group) && on && !group!.dm && wide && !settingUp(group!);+}diff --git a/src/components/room-feed/use-room-threads.ts b/src/components/room-feed/use-room-threads.tsnew file mode 100644index 0000000000..f83907ea20--- /dev/null+++ b/src/components/room-feed/use-room-threads.ts@@ -0,0 +1,47 @@+import { useEffect, useMemo, useRef, useState } from "react";+import type { RoomThreadSummariesResponse, RoomThreadSummary } from "../../../shared/room-threads";+import { api, type Group, type GroupTask } from "@/state/store";++/** A live line in a thread that is not on screen only moves its task's stamps, so the feed asks again once they settle. */+const SETTLE_MS = 400;++export interface FeedThread {+ task: GroupTask;+ summary: RoomThreadSummary & { first: NonNullable<RoomThreadSummary["first"]> };+}++/** The room's threads that have a first line, oldest first, so the newest sits at the foot of the feed and a thread+ * stays in its place when a reply comes in. */+export function feedThreads(tasks: readonly GroupTask[], summaries: readonly RoomThreadSummary[]): FeedThread[] {+ const byThread = new Map(tasks.filter((task) => task.archivedAt === undefined).map((task) => [task.threadId, task]));+ return summaries.flatMap((summary) => {+ const task = byThread.get(summary.threadId);+ return task && summary.first ? [{ task, summary: summary as FeedThread["summary"] }] : [];+ }).sort((a, b) => a.summary.first.at - b.summary.first.at || a.task.createdAt - b.task.createdAt);+}++const stamps = (tasks: readonly GroupTask[] | undefined) =>+ (tasks ?? []).map((task) => `${task.threadId}:${task.updatedAt ?? ""}:${task.lastThreadOrderAt ?? ""}:${task.archivedAt ?? ""}`).join("|");++/** The room's thread summaries, asked again whenever one of its threads moves; the last answer stays on screen while+ * the next is on its way, and an answer for an older ask is dropped. */+export function useRoomThreads(group: Pick<Group, "id" | "tasks">) {+ const [answer, setAnswer] = useState<{ groupId: string; threads: RoomThreadSummary[] } | null>(null);+ const [failed, setFailed] = useState(false);+ const [attempt, setAttempt] = useState(0);+ const signature = stamps(group.tasks);+ const loaded = answer?.groupId === group.id;+ const settled = useRef(loaded);+ settled.current = loaded;+ useEffect(() => {+ let current = true;+ const timer = setTimeout(() => {+ api<RoomThreadSummariesResponse>(`/api/groups/${group.id}/threads/summary`)+ .then((response) => { if (current) { setAnswer({ groupId: group.id, threads: response.threads }); setFailed(false); } })+ .catch(() => { if (current) setFailed(true); });+ }, settled.current ? SETTLE_MS : 0);+ return () => { current = false; clearTimeout(timer); };+ }, [group.id, signature, attempt]);+ const threads = useMemo(() => (loaded ? feedThreads(group.tasks ?? [], answer.threads) : null), [loaded, group.tasks, answer]);+ return { threads, failed: failed && !loaded, retry: () => setAttempt((count) => count + 1) };+}diff --git a/src/components/settings/SettingsWindow.test.ts b/src/components/settings/SettingsWindow.test.tsindex 305684ed68..1ac9afffc3 100644--- a/src/components/settings/SettingsWindow.test.ts+++ b/src/components/settings/SettingsWindow.test.ts@@ -284,14 +284,14 @@ describe("the outer menu", () => {describe("Settings → Features", () => {const featureSwitches = () => Object.fromEntries(fixture.switches.map((props) => [(props as { "data-feature-switch"?: string })["data-feature-switch"], props.checked]).filter(([name]) => name));- it("is in Simple mode's list, with Skill Burger on and thread tabs off by default", () => {- fixture.config = { features: { skillBurger: true, threadTabs: false } };+ it("is in Simple mode's list, with Skill Burger on and thread tabs and the room feed off by default", () => {+ fixture.config = { features: { skillBurger: true, threadTabs: false, roomFeed: false } };const html = render("features");expect(navPages(html)).toContain("features");expect(html).toContain("Skill Burger");expect(html).toContain("Save a bot's run as steps you can run again");expect(html).not.toContain("Saved in");- expect(featureSwitches()).toEqual({ skillBurger: true, threadTabs: false });+ expect(featureSwitches()).toEqual({ skillBurger: true, threadTabs: false, roomFeed: false });});it("saves Skill Burger off in the place's config.json", async () => {diff --git a/src/components/settings/pages/FeaturesPage.tsx b/src/components/settings/pages/FeaturesPage.tsxindex c63f597ab2..c9dc805fb1 100644--- a/src/components/settings/pages/FeaturesPage.tsx+++ b/src/components/settings/pages/FeaturesPage.tsx@@ -9,6 +9,7 @@ import { SettingRow, SettingsGroup, SettingsRows, Switch } from "../../SettingsPconst COPY: Record<Feature, { title: LocaleKey; line: LocaleKey }> = {skillBurger: { title: "settings.features.skillBurger", line: "settings.features.skillBurgerLine" },threadTabs: { title: "settings.features.threadTabs", line: "settings.features.threadTabsLine" },+ roomFeed: { title: "settings.features.roomFeed", line: "settings.features.roomFeedLine" },};/** One switch kept in this place's config.json; shown once its server says it knows the switch. */@@ -47,6 +48,7 @@ export function FeaturesPage() {<SettingsRows><FeatureRow name="skillBurger" /><FeatureRow name="threadTabs" />+ <FeatureRow name="roomFeed" /></SettingsRows></SettingsGroup>);diff --git a/src/components/settings/settings-index.ts b/src/components/settings/settings-index.tsindex c97ca9bfd9..154e26db09 100644--- a/src/components/settings/settings-index.ts+++ b/src/components/settings/settings-index.ts@@ -261,6 +261,7 @@ export const SETTINGS_INDEX: readonly SettingsIndexEntry[] = [{ id: "layout", page: "appearance", anchor: "appearance", labelKey: "settings.appearance.layout", advanced: true, synonyms: ["show your computers", "rail", "window frame", "title bar", "threads", "tools layout", "pinned", "circles", "universal pins", "pinned panels"] },{ id: "skill-burger-switch", page: "features", anchor: "features", labelKey: "settings.features.skillBurger", topFor: ["skill burger", "skill burgers"], synonyms: ["burger", "saved runs", "workflows"] },{ id: "thread-tabs", page: "features", anchor: "features", labelKey: "settings.features.threadTabs", synonyms: ["tabs", "threads"] },+ { id: "room-feed", page: "features", anchor: "features", labelKey: "settings.features.roomFeed", synonyms: ["feed", "room threads", "rooms"] },{ id: "apps", page: "overview", labelKey: "settings.search.apps", jump: "apps", synonyms: ["apps", "gmail", "slack", "calendar", "notion", "connect app", "integrations"] },{ id: "bot-settings", page: "overview", labelKey: "settings.search.bot", jump: "bot", synonyms: ["approvals", "safety", "routines", "memory", "bot's notifications"] },{ id: "shortcuts", page: "app", labelKey: "sidebar.menu.shortcuts", jump: "shortcuts", synonyms: ["keyboard shortcuts", "hotkeys", "cheat sheet"] },diff --git a/src/lib/feature-flags.ts b/src/lib/feature-flags.tsindex bcaa38e47a..ac30e161cf 100644--- a/src/lib/feature-flags.ts+++ b/src/lib/feature-flags.ts@@ -1,7 +1,7 @@import { t } from "./i18n";export interface FeatureFlagConfig {- features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean };+ features?: { skillAuthoring?: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; claudeUserSkills?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean };browserEngine?: { kind: "engine" | "unavailable"; reason?: string; installable?: boolean; installing?: boolean; installError?: string };}@@ -105,3 +105,7 @@ export function skillBurgerEnabled(config: FeatureFlagConfig | null | undefined)export function threadTabsEnabled(config: FeatureFlagConfig | null | undefined): boolean {return config?.features?.threadTabs === true;}++export function roomFeedEnabled(config: FeatureFlagConfig | null | undefined): boolean {+ return config?.features?.roomFeed === true;+}diff --git a/src/lib/room-feed.test.ts b/src/lib/room-feed.test.tsnew file mode 100644index 0000000000..3ad00107ec--- /dev/null+++ b/src/lib/room-feed.test.ts@@ -0,0 +1,104 @@+import { afterEach, describe, expect, it, vi } from "vitest";+import type { AppState, Group } from "@/state/store";+import { markVisibleGroupThreadsRead } from "@/state/read-visible";+import { openThread, visibleNotificationThread } from "@/state/thread-navigation";+import { feedPreview, feedThreadAction, openThreadBeside, roomFeedShows } from "./room-feed";++const on = { features: { roomFeed: true } } as AppState["config"];+const off = { features: { roomFeed: false } } as AppState["config"];+const room = (extra: Partial<Group> = {}) => ({ id: "room", name: "Launch", threadId: "current", memberIds: ["kiwi"], messages: [{ id: "m" }],+ tasks: [{ threadId: "current", title: "", createdAt: 1, unread: true }, { threadId: "other", title: "", createdAt: 2, unread: true }], ...extra } as unknown as Group);+const kiwi = { id: "kiwi", name: "Kiwi", threadId: "kiwi-main", tasks: [{ threadId: "kiwi-main" }, { threadId: "kiwi-side" }] };+const state = (config: AppState["config"], extra: Partial<AppState> = {}) =>+ ({ config, groups: [room()], bots: [kiwi], activeView: "chat", selectedId: "room", forkPanel: null, ...extra } as unknown as AppState);+const narrow = () => vi.stubGlobal("window", { matchMedia: () => ({ matches: false }) });++afterEach(() => vi.unstubAllGlobals());++describe("the room feed switch", () => {+ it("shows a room's feed only with the switch on, never for a bot-to-bot room, and not on a phone", () => {+ expect(roomFeedShows(on, room())).toBe(true);+ expect(roomFeedShows(off, room())).toBe(false);+ expect(roomFeedShows(undefined, room())).toBe(false);+ expect(roomFeedShows(on, room({ dm: true }))).toBe(false);+ expect(roomFeedShows(on, room(), false)).toBe(false);+ });++ it("opens a room's thread beside the feed instead of moving the room's current thread, and leaves it alone with the switch off", () => {+ expect(feedThreadAction({ type: "switchGroupTask", groupId: "room", threadId: "other" }, state(on)))+ .toEqual({ type: "openForkPanel", kind: "group", ownerId: "room", threadId: "other" });+ const switching = { type: "switchGroupTask" as const, groupId: "room", threadId: "other" };+ expect(feedThreadAction(switching, state(off))).toBe(switching);+ const fresh = { type: "newGroupTask" as const, groupId: "room" };+ expect(feedThreadAction(fresh, state(off))).toBe(fresh);+ });++ it("opens a notification's room thread beside the feed, the room's current one too", () => {+ const sent: unknown[] = [];+ openThread((action) => sent.push(action), { botId: "kiwi", threadId: "current" }, state(on), true);+ expect(sent).toEqual([{ type: "select", id: "room" }, { type: "openForkPanel", kind: "group", ownerId: "room", threadId: "current" }, { type: "revealThread", threadId: "current" }]);+ sent.length = 0;+ openThread((action) => sent.push(action), { botId: "kiwi", threadId: "other" }, state(off), true);+ expect(sent).toContainEqual({ type: "switchGroupTask", groupId: "room", threadId: "other" });+ });+});++describe("an Inbox line with the room feed on", () => {+ it("opens a room's thread or a bot's beside the chat", () => {+ const dispatch = vi.fn();+ expect(openThreadBeside(dispatch, "other", state(on, { selectedId: "kiwi" }))).toBe(true);+ expect(dispatch).toHaveBeenLastCalledWith({ type: "openForkPanel", kind: "group", ownerId: "room", threadId: "other" });+ expect(openThreadBeside(dispatch, "kiwi-side", state(on))).toBe(true);+ expect(dispatch).toHaveBeenLastCalledWith({ type: "openForkPanel", kind: "bot", ownerId: "kiwi", threadId: "kiwi-side" });+ });++ it("goes the usual way with the switch off, on a phone, for an unknown thread, or for the chat already on screen", () => {+ const dispatch = vi.fn();+ expect(openThreadBeside(dispatch, "other", state(off))).toBe(false);+ expect(openThreadBeside(dispatch, "gone", state(on))).toBe(false);+ expect(openThreadBeside(dispatch, "kiwi-main", state(on, { selectedId: "kiwi" }))).toBe(false);+ narrow();+ expect(openThreadBeside(dispatch, "other", state(on))).toBe(false);+ expect(dispatch).not.toHaveBeenCalled();+ });+});++describe("what the feed counts as read and on screen", () => {+ it("never reads the room's current thread for the feed, and reads the thread open beside it", () => {+ const posted: string[] = [];+ const post = (_path: string, threadId: string) => { posted.push(threadId); };+ markVisibleGroupThreadsRead(state(on), room(), true, post);+ expect(posted).toEqual([]);+ markVisibleGroupThreadsRead(state(on, { forkPanel: { kind: "group", ownerId: "room", threadId: "other" } as AppState["forkPanel"] }), room(), true, post);+ expect(posted).toEqual(["other"]);+ posted.length = 0;+ markVisibleGroupThreadsRead(state(off), room(), true, post);+ expect(posted).toEqual(["current"]);+ });++ it("reads a thread opened beside another chat", () => {+ const posted: string[] = [];+ markVisibleGroupThreadsRead(state(on, { selectedId: "kiwi", forkPanel: { kind: "group", ownerId: "room", threadId: "other" } as AppState["forkPanel"] }),+ room(), true, (_path, threadId) => { posted.push(threadId); });+ expect(posted).toEqual(["other"]);+ });++ it("lets a notification through for the feed's room, and holds one for the thread beside it", () => {+ expect(visibleNotificationThread(state(on), "current")).toBeNull();+ expect(visibleNotificationThread(state(off), "current")).toBe("current");+ expect(visibleNotificationThread(state(on, { selectedId: "kiwi", forkPanel: { kind: "group", ownerId: "room", threadId: "other" } as AppState["forkPanel"] }), "other")).toBe("other");+ });+});++describe("a feed room's sidebar line", () => {+ it("is the title of the thread that moved last, never an empty or archived one", () => {+ const tasks = [+ { threadId: "a", title: "Launch checklist", createdAt: 1, lastThreadOrderAt: 5 },+ { threadId: "b", title: "Old idea", createdAt: 2, lastThreadOrderAt: 9, archivedAt: 10 },+ { threadId: "c", title: "New task", createdAt: 3 },+ { threadId: "d", title: "Logo files", createdAt: 4, lastThreadOrderAt: 7 },+ ];+ expect(feedPreview({ tasks })).toBe("Logo files");+ expect(feedPreview({ tasks: [tasks[2]!] })).toBeUndefined();+ });+});diff --git a/src/lib/room-feed.ts b/src/lib/room-feed.tsnew file mode 100644index 0000000000..c5ca6d0a66--- /dev/null+++ b/src/lib/room-feed.ts@@ -0,0 +1,53 @@+import { roomFeedEnabled } from "@/lib/feature-flags";+import { roomNeedsSetup } from "@/lib/room-setup";+import { SIDEBAR_INLINE } from "@/lib/use-media-query";+import type { Action, AppState, Group } from "@/state/store";++export type FeedRoom = Pick<Group, "dm"> & { messages?: readonly unknown[] };+type ThreadOwner = { id: string; threadId: string; dm?: boolean; tasks?: ReadonlyArray<{ threadId: string }> };++const wideWindow = () => typeof window === "undefined" || typeof window.matchMedia !== "function" || window.matchMedia(SIDEBAR_INLINE).matches;+const remoteClient = () => typeof window !== "undefined" && window.ogb?.remoteClient?.active === true;+export const settingUp = (group: FeedRoom) => !remoteClient() && Array.isArray(group.messages) && roomNeedsSetup(group as Group);++/** A room shows its threads as one feed, with the open one beside it, while Settings → Features → Room feed is on and+ * the window is wide enough for the thread beside it. A bot-to-bot room keeps its one conversation, and a new room+ * its setup. */+export function roomFeedShows(config: AppState["config"] | undefined, group: FeedRoom | undefined, wide = wideWindow()): boolean {+ return Boolean(group) && roomFeedEnabled(config) && !group!.dm && wide && !settingUp(group!);+}++export const openFeedThread = (groupId: string, threadId: string, focusComposer = false): Action =>+ ({ type: "openForkPanel", kind: "group", ownerId: groupId, threadId, ...(focusComposer ? { focusComposer } : {}) });++/** A room's thread asked for from anywhere in the app opens beside its feed rather than becoming the room's current+ * thread, which is everyone's. A new thread there starts from the feed's composer. Null: nothing more to do. */+export function feedThreadAction(action: Action, state: Pick<AppState, "config" | "groups">): Action | null {+ if (action.type !== "switchGroupTask" && action.type !== "newGroupTask") return action;+ if (!roomFeedShows(state.config, state.groups.find((group) => group.id === action.groupId))) return action;+ if (action.type === "switchGroupTask") return openFeedThread(action.groupId, action.threadId);+ document.querySelector<HTMLTextAreaElement>("[data-room-feed-composer] textarea:not([disabled])")?.focus();+ return null;+}++/** With the room feed on, a thread opened from the Inbox opens beside whatever is on screen, and the Inbox stays.+ * False where today's way applies: a phone, a room's bot-to-bot chat, a thread no room or bot here holds, or the one+ * already shown in the chat. */+export function openThreadBeside(dispatch: (action: Action) => void, threadId: string,+ state: Pick<AppState, "config" | "activeView" | "selectedId"> & { bots: readonly ThreadOwner[]; groups: readonly (ThreadOwner & FeedRoom)[] }): boolean {+ if (!roomFeedEnabled(state.config) || !wideWindow()) return false;+ const owns = (owner: ThreadOwner) => (owner.tasks ?? []).some((task) => task.threadId === threadId);+ const group = state.groups.find(owns), bot = group ? undefined : state.bots.find(owns);+ const owner = group ?? bot;+ if (!owner || group?.dm) return false;+ const inChat = state.activeView === "chat" && state.selectedId === owner.id && owner.threadId === threadId;+ if (inChat && !(group && roomFeedShows(state.config, group))) return false;+ dispatch({ type: "openForkPanel", kind: group ? "group" : "bot", ownerId: owner.id, threadId });+ return true;+}++/** A feed room's line in the sidebar: the title of its thread that moved last, since its current thread need not be. */+export function feedPreview(group: Pick<Group, "tasks">): string | undefined {+ const said = (group.tasks ?? []).filter((task) => task.archivedAt === undefined && task.lastThreadOrderAt !== undefined);+ return said.sort((a, b) => (b.lastThreadOrderAt ?? 0) - (a.lastThreadOrderAt ?? 0))[0]?.title;+}diff --git a/src/lib/use-feature.ts b/src/lib/use-feature.tsindex 2f1bc38a17..6d2cb494a2 100644--- a/src/lib/use-feature.ts+++ b/src/lib/use-feature.ts@@ -1,13 +1,14 @@-import { skillBurgerEnabled, threadTabsEnabled } from "@/lib/feature-flags";+import { roomFeedEnabled, skillBurgerEnabled, threadTabsEnabled } from "@/lib/feature-flags";import type { ConfigStatus } from "@/state/store";import { useStoreSelector } from "@/state/store-select";/** Switches on Settings → Features, kept in the place's config.json (`features.<name>`), so its server reads them too. */-export type Feature = "skillBurger" | "threadTabs";+export type Feature = "skillBurger" | "threadTabs" | "roomFeed";const FEATURES: Record<Feature, (config: ConfigStatus | null | undefined) => boolean> = {skillBurger: skillBurgerEnabled,threadTabs: threadTabsEnabled,+ roomFeed: roomFeedEnabled,};/** Whether a switch on Settings → Features is on. */diff --git a/src/locales/de.json b/src/locales/de.jsonindex db7c0af9fd..cf26339c16 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -4374,6 +4374,22 @@"settings.features.skillBurgerLine": "Speichert den Lauf eines Bots als Schritte, die du erneut ausführen kannst","settings.features.threadTabs": "Thread-Tabs","settings.features.threadTabsLine": "Zeigt die Threads eines Bots als Tabs über dem Chat",+ "settings.features.roomFeed": "Raum-Feed",+ "settings.features.roomFeedLine": "Zeigt die Threads eines Raums als einen Feed, mit dem geöffneten Thread daneben",+ "composer.placeholder.newThread": "Einen Thread in {name} beginnen",+ "room.feed.aria": "Threads in {name}",+ "room.feed.replyOne": "1 Antwort",+ "room.feed.replyMany": "{count} Antworten",+ "room.feed.lastReply": "Letzte Antwort {when}",+ "room.feed.noReplies": "Noch keine Antworten",+ "room.feed.attachment": "Ein Anhang",+ "room.feed.you": "Du",+ "room.feed.empty": "Noch keine Threads. Schreib unten, um einen zu beginnen.",+ "room.feed.loadFailed": "Die Threads dieses Raums konnten nicht geladen werden.",+ "room.feed.startFailed": "Der Thread konnte nicht begonnen werden. Prüfe deine Verbindung und versuche es erneut.",+ "room.thread.panel": "Thread",+ "room.thread.close": "Thread schließen",+ "room.thread.resize": "Thread-Breite ändern","settings.features.error": "Das konnte nicht gespeichert werden. Prüfe deine Verbindung und versuche es erneut.","skillBurger.pill.cooking": "Wird gekocht… {count}","skillBurger.pill.add": "Hinzufügen",diff --git a/src/locales/en.json b/src/locales/en.jsonindex 2109ffb4ab..f0ae80479c 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -11994,6 +11994,22 @@"settings.features.skillBurgerLine": "Save a bot's run as steps you can run again","settings.features.threadTabs": "Thread tabs","settings.features.threadTabsLine": "Show a bot's threads as tabs above the chat",+ "settings.features.roomFeed": "Room feed",+ "settings.features.roomFeedLine": "Show a room's threads as one feed, with the open thread beside it",+ "composer.placeholder.newThread": "Start a thread in {name}",+ "room.feed.aria": "Threads in {name}",+ "room.feed.replyOne": "1 reply",+ "room.feed.replyMany": "{count} replies",+ "room.feed.lastReply": "Last reply {when}",+ "room.feed.noReplies": "No replies yet",+ "room.feed.attachment": "An attachment",+ "room.feed.you": "You",+ "room.feed.empty": "No threads yet. Write below to start one.",+ "room.feed.loadFailed": "Couldn't load this room's threads.",+ "room.feed.startFailed": "Couldn't start a thread. Check your connection and try again.",+ "room.thread.panel": "Thread",+ "room.thread.close": "Close thread",+ "room.thread.resize": "Resize thread","settings.features.error": "Couldn't save that. Check your connection and try again.","skillBurger.pill.cooking": "Cooking… {count}","skillBurger.pill.add": "Add",diff --git a/src/locales/es.json b/src/locales/es.jsonindex 3c11d96d68..b1e57ecb36 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -6616,6 +6616,8 @@"settings.features.skillBurgerLine": "Guarda la ejecución de un bot como pasos que puedes volver a ejecutar","settings.features.threadTabs": "Pestañas de hilos","settings.features.threadTabsLine": "Muestra los hilos de un bot como pestañas sobre el chat",+ "settings.features.roomFeed": "Feed de la sala",+ "settings.features.roomFeedLine": "Muestra los hilos de una sala como un solo feed, con el hilo abierto al lado","settings.features.error": "No se pudo guardar. Revisa tu conexión e inténtalo de nuevo.","chat.botExchange.open": "Abrir el intercambio entre {asker} y {helper}","chat.botExchange.teammate": "Un compañero",diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex ea35d2ac7d..478ce1693c 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -4024,6 +4024,8 @@"settings.features.skillBurgerLine": "Enregistre l'exécution d'un bot en étapes que tu peux relancer","settings.features.threadTabs": "Onglets de fils","settings.features.threadTabsLine": "Affiche les fils d'un bot en onglets au-dessus du chat",+ "settings.features.roomFeed": "Fil du salon",+ "settings.features.roomFeedLine": "Affiche les fils d'un salon en un seul fil d'actualité, avec le fil ouvert à côté","settings.features.error": "Impossible d'enregistrer. Vérifie ta connexion et réessaie.","chat.botExchange.open": "Ouvrir l’échange entre {asker} et {helper}","chat.botExchange.teammate": "Un coéquipier",diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex 2e2fe114ba..5f754c8e10 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -3876,6 +3876,8 @@"settings.features.skillBurgerLine": "किसी बॉट के रन को ऐसे चरणों के रूप में सहेजें जिन्हें आप फिर से चला सकें","settings.features.threadTabs": "थ्रेड टैब","settings.features.threadTabsLine": "चैट के ऊपर बॉट के थ्रेड टैब के रूप में दिखाएँ",+ "settings.features.roomFeed": "रूम फ़ीड",+ "settings.features.roomFeedLine": "रूम के थ्रेड एक फ़ीड में दिखाएँ, खुला थ्रेड उसके बगल में","settings.features.error": "इसे सहेजा नहीं जा सका। अपना कनेक्शन जाँचें और फिर से कोशिश करें।","chat.botExchange.open": "{asker} और {helper} की बातचीत खोलें","chat.botExchange.teammate": "एक साथी",diff --git a/src/locales/it.json b/src/locales/it.jsonindex bbf788aab5..b0d12a1624 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -11762,6 +11762,8 @@"settings.features.skillBurgerLine": "Salva l'esecuzione di un bot come passaggi da rieseguire","settings.features.threadTabs": "Schede dei thread","settings.features.threadTabsLine": "Mostra i thread di un bot come schede sopra la chat",+ "settings.features.roomFeed": "Feed della stanza",+ "settings.features.roomFeedLine": "Mostra i thread di una stanza in un unico feed, con il thread aperto accanto","settings.features.error": "Impossibile salvare. Controlla la connessione e riprova.","chat.botExchange.open": "Apri lo scambio tra {asker} e {helper}","chat.botExchange.teammate": "Un collega",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex 82128bc605..ad70d74ca7 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -8150,6 +8150,8 @@"settings.features.skillBurgerLine": "ボットの実行を、もう一度実行できる手順として保存します","settings.features.threadTabs": "スレッドのタブ","settings.features.threadTabsLine": "ボットのスレッドをチャットの上にタブで表示します",+ "settings.features.roomFeed": "ルームのフィード",+ "settings.features.roomFeedLine": "ルームのスレッドを1つのフィードに並べ、開いたスレッドを横に表示します","settings.features.error": "保存できませんでした。接続を確認して、もう一度お試しください。","chat.botExchange.open": "{asker} と {helper} のやり取りを開く","chat.botExchange.teammate": "チームメイト",diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex f932b5f7f3..771ca24923 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -7840,6 +7840,8 @@"settings.features.skillBurgerLine": "봇의 실행을 다시 실행할 수 있는 단계로 저장해요","settings.features.threadTabs": "스레드 탭","settings.features.threadTabsLine": "봇의 스레드를 채팅 위에 탭으로 보여줘요",+ "settings.features.roomFeed": "대화방 피드",+ "settings.features.roomFeedLine": "대화방의 스레드를 하나의 피드로 보여주고, 연 스레드는 옆에 보여줘요","settings.features.error": "저장하지 못했어요. 연결을 확인하고 다시 시도해 주세요.","chat.botExchange.open": "{asker}와 {helper}의 대화 열기","chat.botExchange.teammate": "팀원",diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex 8e3d418923..77a368374c 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -7312,6 +7312,8 @@"settings.features.skillBurgerLine": "Zapisuje przebieg pracy bota jako kroki, które można uruchomić ponownie","settings.features.threadTabs": "Karty wątków","settings.features.threadTabsLine": "Pokazuje wątki bota jako karty nad czatem",+ "settings.features.roomFeed": "Kanał pokoju",+ "settings.features.roomFeedLine": "Pokazuje wątki pokoju w jednym kanale, z otwartym wątkiem obok","settings.features.error": "Nie udało się zapisać. Sprawdź połączenie i spróbuj ponownie.","chat.botExchange.open": "Otwórz wymianę między {asker} a {helper}","chat.botExchange.teammate": "Członek zespołu",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex 91267e44c8..641873c87d 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -11994,6 +11994,22 @@"settings.features.skillBurgerLine": "Salva a execução de um bot como etapas que você pode executar de novo","settings.features.threadTabs": "Abas de conversas","settings.features.threadTabsLine": "Mostra as conversas de um bot como abas acima do chat",+ "settings.features.roomFeed": "Feed do grupo",+ "settings.features.roomFeedLine": "Mostra as conversas de um grupo em um só feed, com a conversa aberta ao lado",+ "composer.placeholder.newThread": "Comece uma conversa em {name}",+ "room.feed.aria": "Conversas em {name}",+ "room.feed.replyOne": "1 resposta",+ "room.feed.replyMany": "{count} respostas",+ "room.feed.lastReply": "Última resposta {when}",+ "room.feed.noReplies": "Nenhuma resposta ainda",+ "room.feed.attachment": "Um anexo",+ "room.feed.you": "Você",+ "room.feed.empty": "Nenhuma conversa ainda. Escreva abaixo para começar uma.",+ "room.feed.loadFailed": "Não foi possível carregar as conversas deste grupo.",+ "room.feed.startFailed": "Não foi possível começar a conversa. Verifique sua conexão e tente de novo.",+ "room.thread.panel": "Conversa",+ "room.thread.close": "Fechar conversa",+ "room.thread.resize": "Redimensionar conversa","settings.features.error": "Não foi possível salvar. Verifique sua conexão e tente de novo.","skillBurger.pill.cooking": "Cozinhando… {count}","skillBurger.pill.add": "Adicionar",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex d15df65b67..0e48b42b5c 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -7366,6 +7366,8 @@"settings.features.skillBurgerLine": "Сохраняет работу бота как шаги, которые можно запустить снова","settings.features.threadTabs": "Вкладки веток","settings.features.threadTabsLine": "Показывает ветки бота вкладками над чатом",+ "settings.features.roomFeed": "Лента комнаты",+ "settings.features.roomFeedLine": "Показывает ветки комнаты одной лентой, а открытую ветку — рядом","settings.features.error": "Не удалось сохранить. Проверьте подключение и попробуйте ещё раз.","chat.botExchange.open": "Открыть обмен между {asker} и {helper}","chat.botExchange.teammate": "Коллега",diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex 2d8f74e8b8..7aebda673f 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -6111,6 +6111,8 @@"settings.features.skillBurgerLine": "Bir botun çalışmasını yeniden çalıştırabileceğin adımlar olarak kaydeder","settings.features.threadTabs": "Konuşma sekmeleri","settings.features.threadTabsLine": "Bir botun konuşmalarını sohbetin üstünde sekmeler olarak gösterir",+ "settings.features.roomFeed": "Oda akışı",+ "settings.features.roomFeedLine": "Bir odanın konuşmalarını tek bir akışta, açık konuşmayı yanında gösterir","settings.features.error": "Kaydedilemedi. Bağlantını kontrol edip tekrar dene.","chat.botExchange.open": "{asker} ile {helper} arasındaki konuşmayı aç","chat.botExchange.teammate": "Bir ekip arkadaşı",diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex 40b5247c75..0f8ecd827f 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -4296,6 +4296,8 @@"settings.features.skillBurgerLine": "Зберігає роботу бота як кроки, які можна запустити знову","settings.features.threadTabs": "Вкладки гілок","settings.features.threadTabsLine": "Показує гілки бота вкладками над чатом",+ "settings.features.roomFeed": "Стрічка кімнати",+ "settings.features.roomFeedLine": "Показує гілки кімнати однією стрічкою, а відкриту гілку поруч","settings.features.error": "Не вдалося зберегти. Перевірте з'єднання і спробуйте ще раз.","chat.botExchange.open": "Відкрити обмін між {asker} і {helper}","chat.botExchange.teammate": "Колега",diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex 5012233cb6..da02b22203 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -6111,6 +6111,8 @@"settings.features.skillBurgerLine": "Lưu một lần chạy của bot thành các bước bạn có thể chạy lại","settings.features.threadTabs": "Thẻ luồng","settings.features.threadTabsLine": "Hiển thị các luồng của bot thành thẻ phía trên khung chat",+ "settings.features.roomFeed": "Bảng tin phòng",+ "settings.features.roomFeedLine": "Hiển thị các luồng của phòng thành một bảng tin, luồng đang mở nằm bên cạnh","settings.features.error": "Không thể lưu. Hãy kiểm tra kết nối rồi thử lại.","chat.botExchange.open": "Mở cuộc trao đổi giữa {asker} và {helper}","chat.botExchange.teammate": "Một đồng đội",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 3634846d9d..59a5ea0527 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -10429,6 +10429,8 @@"settings.features.skillBurgerLine": "把機器人的一次執行儲存為可再次執行的步驟","settings.features.threadTabs": "對話分頁","settings.features.threadTabsLine": "在聊天上方以分頁顯示機器人的對話",+ "settings.features.roomFeed": "房間動態",+ "settings.features.roomFeedLine": "將房間的對話列成一個動態,開啟的對話顯示在旁邊","settings.features.error": "無法儲存。請檢查連線後再試一次。","chat.botExchange.open": "開啟 {asker} 與 {helper} 的交流","chat.botExchange.teammate": "一位隊友",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex 1632d091ef..860bc043fa 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -10340,6 +10340,8 @@"settings.features.skillBurgerLine": "把机器人的一次运行保存为可再次运行的步骤","settings.features.threadTabs": "对话标签页","settings.features.threadTabsLine": "在聊天上方以标签页显示机器人的对话",+ "settings.features.roomFeed": "群组动态",+ "settings.features.roomFeedLine": "将群组聊天的对话列成一个动态,打开的对话显示在旁边","settings.features.error": "无法保存。请检查网络连接后重试。","chat.botExchange.open": "打开 {asker} 与 {helper} 的交流","chat.botExchange.teammate": "一位队友",diff --git a/src/state/config-status.ts b/src/state/config-status.tsindex 0c597e8acf..4fcc9c524f 100644--- a/src/state/config-status.ts+++ b/src/state/config-status.ts@@ -169,7 +169,7 @@ export interface ConfigStatus {/** What a paired phone calls this computer; "" uses the default. */computerName?: string;/** Opt-in flags. Absent means off. */- features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean };+ features?: { skillAuthoring: boolean; skillReview?: boolean; skillReviewSteps?: number; showToolCalls?: boolean; browser?: boolean; sharedComputers?: boolean; claudeUserMcp?: boolean; skillsLibrary?: boolean; shareLearnedSkills?: "off" | "ask" | "auto"; roomMemoryCapture?: boolean; savedSteps?: boolean; savedStepsHere?: boolean; usbPhoneTakeover?: boolean; skillBurger?: boolean; threadTabs?: boolean; roomFeed?: boolean };/** First-run progress: whether the welcome tour was finished and which* one-time hints were dismissed. Server-owned so it follows the workspace. */onboarding?: OnboardingStatus;diff --git a/src/state/read-visible.ts b/src/state/read-visible.tsindex 4348287bf6..9d8d1deb31 100644--- a/src/state/read-visible.ts+++ b/src/state/read-visible.ts@@ -1,6 +1,7 @@import { botShowsUnread } from "@/lib/bot-unread";import type { Action, AppState, BotAnnouncement, Group } from "./store";import { serverFetch } from "@/lib/relay-server";+import { roomFeedShows } from "@/lib/room-feed";/** "seen": only on screen, which a conversation the person marked unread with it open holds against; "open": the person* opened it again, which ends that mark. */@@ -59,6 +60,10 @@ export function shownChatHeldUnread(state: AppState): boolean {return marked === undefined || newest === undefined || newest <= marked;}+/** Whether the thread panel holds one of this owner's threads: it is on screen beside whatever the chat shows. */+const panelHolds = (state: AppState, kind: "bot" | "group", ownerId: string) => state.forkPanel?.kind === kind && state.forkPanel.ownerId === ownerId;+const chatShows = (state: AppState, id: string) => id === state.selectedId && state.activeView === "chat";+function visibleThreadIds(state: AppState, kind: "bot" | "group", ownerId: string, shown?: string): string[] {const panel = state.forkPanel;return [...new Set([shown, panel?.kind === kind && panel.ownerId === ownerId ? panel.threadId : undefined])]@@ -66,15 +71,16 @@ function visibleThreadIds(state: AppState, kind: "bot" | "group", ownerId: strin}export function markVisibleBotThreadsRead(state: AppState, bot: BotAnnouncement, focused: boolean, post: SendRead = sendRead): void {- if (bot.id !== state.selectedId || state.activeView !== "chat" || !focused) return;- const selected = state.bots.find((candidate) => candidate.id === bot.id);+ if (!focused || !(chatShows(state, bot.id) || panelHolds(state, "bot", bot.id))) return;+ const selected = chatShows(state, bot.id) ? state.bots.find((candidate) => candidate.id === bot.id) : undefined;const shown = selected?.switchingTo ?? selected?.threadId;const visibleThreads = visibleThreadIds(state, "bot", bot.id, shown);+ if (visibleThreads.length === 0) return;let held = false;for (const threadId of visibleThreads) {const task = bot.tasks?.find((candidate) => candidate.threadId === threadId);if (task && task.heldUnread === undefined) reopened.delete(threadId);- if (!task?.unread && (bot.tasks || !bot.unread)) continue;+ if (!task?.unread && (bot.tasks || !bot.unread || threadId !== shown)) continue;if (serverHolds(task)) {held = true;continue;@@ -92,19 +98,22 @@ export function markVisibleBotThreadsRead(state: AppState, bot: BotAnnouncement,post(`/api/bots/${bot.id}/read`, threadId, task?.updatedAt ?? 0, task?.heldUnread !== undefined ? "open" : "seen");}if (bot.tasks) bot.unread = botShowsUnread(bot);- else if (!held) bot.unread = false;+ else if (!held && shown) bot.unread = false;}export function markVisibleGroupThreadsRead(state: AppState, group: Partial<Group> & { id: string }, focused: boolean,post: SendRead = sendRead): void {- if (group.id !== state.selectedId || state.activeView !== "chat" || !focused) return;- const shown = state.groups.find((candidate) => candidate.id === group.id)?.threadId;+ if (!focused || !(chatShows(state, group.id) || panelHolds(state, "group", group.id))) return;+ const room = chatShows(state, group.id) ? state.groups.find((candidate) => candidate.id === group.id) : undefined;+ const shown = room && !roomFeedShows(state.config, room) ? room.threadId : undefined;const visibleThreads = visibleThreadIds(state, "group", group.id, shown);+ if (visibleThreads.length === 0) return;for (const threadId of visibleThreads) {const task = group.tasks?.find((candidate) => candidate.threadId === threadId);- if (!task?.unread && (group.tasks || !group.unread)) continue;+ if (!task?.unread && (group.tasks || !group.unread || threadId !== shown)) continue;if (task) task.unread = false;post(`/api/groups/${group.id}/read`, threadId, task?.updatedAt ?? 0, "seen");}- group.unread = group.tasks ? group.tasks.some((task) => task.unread) : false;+ if (group.tasks) group.unread = group.tasks.some((task) => task.unread);+ else if (shown) group.unread = false;}diff --git a/src/state/store.tsx b/src/state/store.tsxindex 6263b27865..99e99a286c 100644--- a/src/state/store.tsx+++ b/src/state/store.tsx@@ -51,7 +51,7 @@ import {import type { Routine, RoutineInput, RoutineRun, RoutineRunLimits, RoutineRunStatusFilter } from "@/lib/routines";import type { WebhookAttempt, WebhookIngressStatus, WebhookTrigger } from "@/lib/webhooks";import { duplicateBotProfile, restrictedCopyRequest } from "@/lib/bot-duplicate";-import { holdMarkedUnread, markVisibleBotThreadsRead, markVisibleGroupThreadsRead, type ReadReason } from "./read-visible";+import { holdMarkedUnread, markVisibleBotThreadsRead, markVisibleGroupThreadsRead, type ReadReason } from "./read-visible"; import { feedThreadAction, roomFeedShows } from "@/lib/room-feed";import { applyWindowPref } from "@/lib/window-prefs"; import { applyThemeFrame } from "@/lib/theme/runtime"; import { appCatalogAnnounced } from "@/lib/app-catalog-signal";import { placeUnreadDivider, threadOpensUnread, threadReadCursor, unreadDividerFor, type UnreadDivider } from "@/lib/unread-divider";import type { ComputerStart } from "@/lib/computer-start";@@ -1044,7 +1044,7 @@ function reduceApp(state: AppState, action: Action): AppState {forkPanel: null,groups: state.groups.map((g) => {if (g.id !== action.id) return g;- const tasks = g.tasks?.map((task) => task.threadId === g.threadId ? { ...task, unread: false } : task);+ const tasks = g.tasks?.map((task) => task.threadId === g.threadId && !roomFeedShows(state.config, g) ? { ...task, unread: false } : task);return { ...g, tasks, unread: tasks ? tasks.some((task) => task.unread) : false };}),};@@ -2194,7 +2194,7 @@ export function StoreProvider({ children }: { children: ReactNode }) {const wrapped: React.Dispatch<Action> = (action) => {store.flushFrames(); if (["select", "newTask", "switchTask", "newGroupTask", "switchGroupTask", "showChat", "showRoutines", "showTeamMap", "showFiles", "showWebPanel", "showPublishedApps", "showSkillBurgers", "showTeamFiles", "showAnnouncements"].includes(action.type)) selectionRevision.current++;// Pin before any await or optimistic state change.- action = pinBotThreadAction(action, stateRef.current.bots); holdMarkedUnread(action, stateRef.current);+ action = pinBotThreadAction(action, stateRef.current.bots); holdMarkedUnread(action, stateRef.current); const fed = feedThreadAction(action, stateRef.current); if (!fed) return; action = fed;if (runNewChat(action)) return;if (action.type === "taskSwitched") action = { ...action, bot: withTaskWrites(action.bot) as Bot };if (action.type === "botPatched") action = { ...action, bot: withTaskWrites(action.bot) };@@ -2543,7 +2543,7 @@ export function StoreProvider({ children }: { children: ReactNode }) {const group = stateRef.current.groups.find((g) => g.id === id);if (bot?.unread) {api(`/api/bots/${id}/read`, { method: "POST", body: JSON.stringify({ threadId: bot.threadId }) }).catch(() => {});- } else if (group?.tasks?.find((task) => task.threadId === group.threadId)?.unread ?? group?.unread) {+ } else if (!roomFeedShows(stateRef.current.config, group) && (group?.tasks?.find((task) => task.threadId === group.threadId)?.unread ?? group?.unread)) {api(`/api/groups/${id}/read`, { method: "POST" }).catch(() => {});}break;diff --git a/src/state/thread-navigation.ts b/src/state/thread-navigation.tsindex eb503b72d4..1dbb8312b6 100644--- a/src/state/thread-navigation.ts+++ b/src/state/thread-navigation.ts@@ -2,8 +2,9 @@ import { notificationTrayPinned } from "@/lib/notification-preferences";import type { Action, AppState } from "./store";import { openOwnTeamChat, teamChats } from "./team-chats";import { teamThreadToOpen } from "./team-side";+import { openFeedThread, roomFeedShows, type FeedRoom } from "@/lib/room-feed";-interface NotificationThreadOwner {+interface NotificationThreadOwner extends Partial<FeedRoom> {id: string;threadId: string;mainThreadId?: string;@@ -18,16 +19,14 @@ interface NotificationRoutingState {}export function visibleNotificationThread(- state: NotificationRoutingState & Pick<AppState, "activeView" | "selectedId" | "forkPanel">,+ state: NotificationRoutingState & Pick<AppState, "activeView" | "selectedId" | "forkPanel"> & Partial<Pick<AppState, "config">>,threadId?: string,): string | null {+ if (threadId && state.forkPanel?.threadId === threadId) return threadId;if (state.activeView !== "chat") return null;- if (threadId && state.forkPanel?.threadId === threadId && state.forkPanel.ownerId === state.selectedId) return threadId;- return (- state.bots.find((candidate) => candidate.id === state.selectedId)?.threadId ??- state.groups.find((candidate) => candidate.id === state.selectedId)?.threadId ??- null- );+ const room = state.groups.find((candidate) => candidate.id === state.selectedId);+ if (room && roomFeedShows(state.config, room)) return null;+ return state.bots.find((candidate) => candidate.id === state.selectedId)?.threadId ?? room?.threadId ?? null;}export function botOpensTo(bot: Pick<NotificationThreadOwner, "threadId" | "mainThreadId" | "tasks">, threadsShown: boolean): string {@@ -108,7 +107,7 @@ export interface ThreadTarget {threadId: string;}-interface ThreadOpeningState extends NotificationRoutingState {+interface ThreadOpeningState extends NotificationRoutingState, Partial<Pick<AppState, "config">> {bots: Array<NotificationThreadOwner & { name: string }>;}@@ -127,7 +126,8 @@ export function openThread(const named = state.bots.find((candidate) => candidate.id === target.botId);if (group) {dispatch({ type: "select", id: group.id });- if (group.threadId !== target.threadId) dispatch({ type: "switchGroupTask", groupId: group.id, threadId: target.threadId });+ if (roomFeedShows(state.config, group)) dispatch(openFeedThread(group.id, target.threadId));+ else if (group.threadId !== target.threadId) dispatch({ type: "switchGroupTask", groupId: group.id, threadId: target.threadId });} else if (owner) openBotThread(dispatch, owner, target.threadId, threadsShown);else if (named) openBot(dispatch, named, threadsShown);dispatch({ type: "revealThread", threadId: target.threadId });