Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
One list: with This computer and My Cloud together on, the other place's bots join the sidebar's own list
milind-soni3dd1cdf42a22
diff --git a/electron/cloud-rail.mjs b/electron/cloud-rail.mjsindex 0fc67107c5..9f444154cc 100644--- a/electron/cloud-rail.mjs+++ b/electron/cloud-rail.mjs@@ -68,16 +68,17 @@ const unlisted = (entry, { clouds, home, mine }) => Array.isArray(clouds) && (en* device, each with its places as they were kept: grouped by account after these (withAccounts). `profiles`: the workspaces* of this computer's own it may open (local-profiles.mjs; `active`: the one on screen, `settling`: it opens once that bot* finishes): first once My Cloud is home, as This computer was, else right after This computer. `computerSettling`: This- * computer opens once that bot finishes.- * @param {{ saved: { environments: any[], activeId: string }, home?: string | null, mine?: string | null, state?: any, offers?: (entry: any) => boolean, waiting?: (id: string) => boolean, accounts?: any[], profiles?: Array<{ id: string, name?: string | null, color?: string | null, swatch?: string | null, active?: boolean, settling?: string }>, computerSettling?: string | null }} input+ * computer opens once that bot finishes. `joined`: "This computer and My Cloud together" is on (places-together.mjs): when+ * This computer and My Cloud are then the only places, one list in the sidebar holds both and there is no rail.+ * @param {{ saved: { environments: any[], activeId: string }, home?: string | null, mine?: string | null, state?: any, offers?: (entry: any) => boolean, waiting?: (id: string) => boolean, accounts?: any[], profiles?: Array<{ id: string, name?: string | null, color?: string | null, swatch?: string | null, active?: boolean, settling?: string }>, computerSettling?: string | null, joined?: boolean }} input*/-export function railPlaces({ saved, home = null, mine = null, state = null, offers = () => false, waiting = () => false, accounts = [], profiles = [], computerSettling = null }) {+export function railPlaces({ saved, home = null, mine = null, state = null, offers = () => false, waiting = () => false, accounts = [], profiles = [], computerSettling = null, joined = false }) {const connected = state?.status === "connected" ? state : null;const clouds = Array.isArray(connected?.clouds) ? connected.clouds : [];const order = entry => { const at = clouds.findIndex(cloud => cloud.origin === entry.origin); return at === -1 ? clouds.length : at; };const rank = entry => (entry.origin === mine || entry.home ? 0 : environments.listedPlace(entry) ? 1 : 2);- const remote = saved.environments.filter(entry => entry.kind !== "local" && entry.origin && !(connected && unlisted(entry, { clouds: connected.clouds, home, mine })))- .map((entry, index) => ({ entry, index }))+ const shownRemote = saved.environments.filter(entry => entry.kind !== "local" && entry.origin && !(connected && unlisted(entry, { clouds: connected.clouds, home, mine })));+ const remote = shownRemote.map((entry, index) => ({ entry, index })).sort((a, b) => rank(a.entry) - rank(b.entry) || order(a.entry) - order(b.entry) || a.index - b.index).map(({ entry }) => circle(entry, { activeId: saved.activeId, mine, state: connected, offers, waiting }));const making = otherOwnClouds(clouds).filter(cloud => !cloud.origin && ["checkout", "setting_up"].includes(cloud.status))@@ -97,6 +98,7 @@ export function railPlaces({ saved, home = null, mine = null, state = null, offe...(saved.activeId === environments.LOCAL_ID && !profileShown ? { active: true } : {}), ...(waiting(computer.id) ? { attention: true } : {}),...(typeof computerSettling === "string" ? { settling: computerSettling } : {}) }, ...own, ...places];if (accounts.length) return withAccounts(all, { saved, accounts, email: state?.account?.email ?? null });+ if (joined && !home && !own.length && !servers.length && !making.length && shownRemote.length === 1 && shownRemote[0].origin === mine) return [];return all.length < (clouds.some(ownCloud) ? 1 : RAIL_MIN_PLACES) ? [] : all;}diff --git a/electron/cloud-rail.node-test.mjs b/electron/cloud-rail.node-test.mjsindex aef0a3730a..2c871c9677 100644--- a/electron/cloud-rail.node-test.mjs+++ b/electron/cloud-rail.node-test.mjs@@ -43,6 +43,22 @@ test("the rail: My Cloud, the person's Clouds and teams' Clouds in the session's"once My Cloud is home, this computer is no circle, whatever its colour");});+test("one list for this computer and My Cloud: no rail while they are the only places; any other place keeps it", () => {+ const pair = { activeId: "local", environments: [{ id: "home", kind: "remote", name: "My Cloud", origin: HOME, home: true }] };+ const mine = session({ teams: [], clouds: parseCloudList([PRIMARY]) });+ assert.deepEqual(railPlaces({ saved: pair, home: null, mine: HOME, state: mine }).map(place => place.id), ["local", "home"], "the switch off: the rail as it was");+ assert.deepEqual(railPlaces({ saved: pair, home: null, mine: HOME, state: mine, joined: true }), [], "on, and only the pair: the one list is the way between them");+ assert.deepEqual(railPlaces({ saved: pair, home: null, mine: HOME, state: null, joined: true }), [], "the same before the Admin answers");+ const keeps = (label, input) => assert.ok(railPlaces({ saved: pair, home: null, mine: HOME, state: mine, joined: true, ...input }).length > 1, label);+ keeps("a team's Cloud", { saved: { ...pair, environments: [...pair.environments, { id: "acme", kind: "remote", name: "Acme", origin: TEAM, team: { id: "team-acme", role: "member" } }] } });+ keeps("a server saved by hand", { saved: { ...pair, environments: [...pair.environments, { id: "vps", kind: "remote", name: "Office", origin: VPS }] } });+ keeps("another Cloud of the person's own", { saved: { ...pair, environments: [...pair.environments, { id: "a", kind: "remote", name: "Client A", origin: CLIENT_A, cloud: { id: "c-a", role: "owner" } }] } });+ keeps("a workspace of this computer's own", { profiles: [{ id: "p1", name: "Side project" }] });+ keeps("a Cloud still being made", { state: session({ teams: [], clouds: parseCloudList([PRIMARY, entry({ id: "c-new", name: "New", origin: null, status: "setting_up" })]) }) });+ assert.ok(railPlaces({ saved: pair, home: null, mine: HOME, state: mine, joined: true, accounts: [{ id: "acct-2", email: "[email protected]", places: [], rows: [] }] }).length > 0, "another account signed in here");+ assert.deepEqual(railPlaces({ saved: pair, home: HOME, mine: HOME, state: mine, joined: true }).map(place => place.id), ["home"], "after a whole move there is no pair to join");+});+test("a Cloud of your own is a rail even alone, for its +; otherwise one place, or none: no rail, the window as it was", () => {const alone = { activeId: "home", environments: [{ id: "home", kind: "remote", name: "My Cloud", origin: HOME, home: true }] };assert.deepEqual(railPlaces({ saved: alone, home: HOME, mine: HOME, state: session({ teams: [], clouds: parseCloudList([PRIMARY]) }) }).map(place => place.id), ["home"],diff --git a/electron/main.mjs b/electron/main.mjsindex 0bb7eec038..0067eb75aa 100644--- a/electron/main.mjs+++ b/electron/main.mjs@@ -2596,8 +2596,8 @@ function showHome(options) {return homeWindow.show(options).catch(error => slog(`home: ${error?.message ?? error}`));}const showStartPlace = () => openStartPlace({ home: homeWindow, places: homePlaces, profiles: localProfiles, log: slog, server: id => { const entry = environmentsState.environments.find(candidate => candidate.id === id && handSaved(candidate)); return entry ? reopenSavedServer(entry, { saved: () => environmentsState.environments.filter(handSaved), fetch: (...args) => session.defaultSession.fetch(...args), opened: async (found) => { if (!mainWindow || mainWindow.isDestroyed()) createWindow({ deferNavigation: true }); persistEnvironments(withActive(environmentsState, found.id)); return navigateMainWindow(activeOrigin()); } }) : Promise.resolve(false); } }).catch(error => slog(`start: ${error?.message ?? error}`)); const openOwnCloud = id => { homeWindow.cancel(); return showHome({ place: { cloud: id, name: environmentsState.environments.find(entry => entry.cloud?.id === id)?.name } }); };-const placeInbox = createPlaceInboxWatch({ places: () => [{ id: LOCAL_ID, local: true }, ...environmentsState.environments.filter(entry => entry.kind !== "local" && entry.origin)], activeId: () => environmentsState.activeId, local: localServerRequest, cloudFetch: (...args) => session.defaultSession.fetch(...args), asleep: origin => homeWindow.asleepAt(origin), shown: () => !desktopRemoteAccess && serverReady && Boolean(mainWindow && !mainWindow.isDestroyed() && mainWindow.isVisible()), changed: () => railChanged() }); const homeOfUrl = url => { let at = null; try { at = new URL(url); } catch { return "other"; } return at.origin === rendererOrigin() ? (at.pathname === HOME_SCREEN_PATH ? "waking" : "computer") : at.origin === myCloud() ? "cloud" : "other"; }; const placeShown = () => { const page = mainWindow && !mainWindow.isDestroyed() ? mainWindow.webContents : null; return page && !page.isLoadingMainFrame() ? homeOfUrl(page.getURL()) ?? "other" : null; }; const shownHome = () => { const place = placeShown(); return place === "computer" || place === "cloud" ? place : null; }; const placesTogether = installPlacesTogether({ ipcMain, asking: cloudPageAsking, together: createPlacesTogether({ pref: jsonFile(path.join(app.getPath("userData"), PLACES_TOGETHER_FILE)), cloud: () => ({ origin: myCloud(), account: cloudAccount?.state().account?.id ?? null, asleep: cloudPower.asleep() }), powerChecked: async () => { const account = cloudAccount; if (!account) return false; await account.refresh(); return Date.now() - (account.state().verifiedAt ?? 0) < 5_000; }, computer: () => !(homeWindow.cloudOrigin() ?? ownHome?.origin()), local: localServerRequest, cloudFetch: (...args) => session.defaultSession.fetch(...args), napped: () => cloudPower.hold(), address: (home, botId) => botLink?.address(home, botId) ?? null, shown: placeShown, focused: () => powerMonitor.getSystemIdleState(60) !== "locked" && Boolean(mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused()), openPlace: home => { const entry = home === "cloud" ? environmentsState.environments.find(candidate => candidate.origin === myCloud()) : null; return home === "cloud" && (!entry || myCloud() === homeWindow.cloudOrigin()) ? showHome({ place: "cloud" }) : workspaceMenuAction(() => switchEnvironment(entry?.id ?? LOCAL_ID)); }, send: (channel, value) => { if (shownHome()) mainWindow.webContents.send(channel, value); }, changed: () => { botLink?.look(); if (shownHome()) mainWindow.webContents.send("places-together:changed"); } }) });-const localProfiles = createLocalProfiles({ registry: createProfileRegistry({ dataDir: desktopDataDir }), clean: cleanWorkspace, dataDir: desktopDataDir, allowed: () => app.isPackaged && !desktopRemoteAccess, home: () => (homeWindow.cloudOrigin() ? "cloud" : ownHome?.origin() || cleanWorkspace.marker().frozen ? null : "local"), window: { openProfile: id => homeWindow.openProfile(id), profile: () => homeWindow.profile(), showCloud: () => showHome({ place: "cloud" }) }, showLocal: () => { homeWindow.cancel(); persistEnvironments(withActive(environmentsState, LOCAL_ID)); return navigateMainWindow(rendererOrigin()); }, onLocal: () => Boolean(mainWindow && !mainWindow.isDestroyed() && senderIsLocal({ sender: mainWindow.webContents })), busy: async () => { const said = await (await localServerRequest("/api/move/freeze", { signal: AbortSignal.timeout(5_000) })).json(); return typeof said?.busy === "string" ? { name: said.busy, what: said.what } : null; }, trash: dir => shell.trashItem(dir), reserved: () => nativeT(process.platform === "darwin" ? "rail.thisMac" : "rail.thisPc"), remember: homePlaces.remember, changed: () => railChanged(), log: slog }); const railList = () => { ownHome?.refresh(); const settling = localProfiles.settling(); return railPlaces({ saved: environmentsState, waiting: placeInbox.waiting, home: homeWindow.cloudOrigin() ?? ownHome?.origin() ?? null, mine: myCloud(), state: desktopRemoteAccess ? null : cloudAccount?.state(), offers: entry => !desktopRemoteAccess && ownHome?.offers(entry) === true, accounts: accountRing.waiting(), profiles: localProfiles.places({ activeLocal: environmentsState.activeId === LOCAL_ID }), computerSettling: settling && settling.id === null ? settling.name : null }); };+const placeInbox = createPlaceInboxWatch({ places: () => [{ id: LOCAL_ID, local: true }, ...environmentsState.environments.filter(entry => entry.kind !== "local" && entry.origin)], activeId: () => environmentsState.activeId, local: localServerRequest, cloudFetch: (...args) => session.defaultSession.fetch(...args), asleep: origin => homeWindow.asleepAt(origin), shown: () => !desktopRemoteAccess && serverReady && Boolean(mainWindow && !mainWindow.isDestroyed() && mainWindow.isVisible()), changed: () => railChanged() }); const homeOfUrl = url => { let at = null; try { at = new URL(url); } catch { return "other"; } return at.origin === rendererOrigin() ? (at.pathname === HOME_SCREEN_PATH ? "waking" : "computer") : at.origin === myCloud() ? "cloud" : "other"; }; const placeShown = () => { const page = mainWindow && !mainWindow.isDestroyed() ? mainWindow.webContents : null; return page && !page.isLoadingMainFrame() ? homeOfUrl(page.getURL()) ?? "other" : null; }; const shownHome = () => { const place = placeShown(); return place === "computer" || place === "cloud" ? place : null; }; const placesTogether = installPlacesTogether({ ipcMain, asking: cloudPageAsking, together: createPlacesTogether({ pref: jsonFile(path.join(app.getPath("userData"), PLACES_TOGETHER_FILE)), onlyPair: () => railList().length === 0, switched: () => railChanged(), cloud: () => ({ origin: myCloud(), account: cloudAccount?.state().account?.id ?? null, asleep: cloudPower.asleep() }), powerChecked: async () => { const account = cloudAccount; if (!account) return false; await account.refresh(); return Date.now() - (account.state().verifiedAt ?? 0) < 5_000; }, computer: () => !(homeWindow.cloudOrigin() ?? ownHome?.origin()), local: localServerRequest, cloudFetch: (...args) => session.defaultSession.fetch(...args), napped: () => cloudPower.hold(), address: (home, botId) => botLink?.address(home, botId) ?? null, shown: placeShown, focused: () => powerMonitor.getSystemIdleState(60) !== "locked" && Boolean(mainWindow && !mainWindow.isDestroyed() && mainWindow.isFocused()), openPlace: home => { const entry = home === "cloud" ? environmentsState.environments.find(candidate => candidate.origin === myCloud()) : null; return home === "cloud" && (!entry || myCloud() === homeWindow.cloudOrigin()) ? showHome({ place: "cloud" }) : workspaceMenuAction(() => switchEnvironment(entry?.id ?? LOCAL_ID)); }, send: (channel, value) => { if (shownHome()) mainWindow.webContents.send(channel, value); }, changed: () => { botLink?.look(); if (shownHome()) mainWindow.webContents.send("places-together:changed"); } }) });+const localProfiles = createLocalProfiles({ registry: createProfileRegistry({ dataDir: desktopDataDir }), clean: cleanWorkspace, dataDir: desktopDataDir, allowed: () => app.isPackaged && !desktopRemoteAccess, home: () => (homeWindow.cloudOrigin() ? "cloud" : ownHome?.origin() || cleanWorkspace.marker().frozen ? null : "local"), window: { openProfile: id => homeWindow.openProfile(id), profile: () => homeWindow.profile(), showCloud: () => showHome({ place: "cloud" }) }, showLocal: () => { homeWindow.cancel(); persistEnvironments(withActive(environmentsState, LOCAL_ID)); return navigateMainWindow(rendererOrigin()); }, onLocal: () => Boolean(mainWindow && !mainWindow.isDestroyed() && senderIsLocal({ sender: mainWindow.webContents })), busy: async () => { const said = await (await localServerRequest("/api/move/freeze", { signal: AbortSignal.timeout(5_000) })).json(); return typeof said?.busy === "string" ? { name: said.busy, what: said.what } : null; }, trash: dir => shell.trashItem(dir), reserved: () => nativeT(process.platform === "darwin" ? "rail.thisMac" : "rail.thisPc"), remember: homePlaces.remember, changed: () => railChanged(), log: slog }); const railList = () => { ownHome?.refresh(); const settling = localProfiles.settling(); return railPlaces({ saved: environmentsState, waiting: placeInbox.waiting, home: homeWindow.cloudOrigin() ?? ownHome?.origin() ?? null, mine: myCloud(), state: desktopRemoteAccess ? null : cloudAccount?.state(), offers: entry => !desktopRemoteAccess && ownHome?.offers(entry) === true, accounts: accountRing.waiting(), profiles: localProfiles.places({ activeLocal: environmentsState.activeId === LOCAL_ID }), computerSettling: settling && settling.id === null ? settling.name : null, joined: placesTogether.on() }); };// The rail as the window's own chrome (chrome-rail.mjs): this app's page beside every place's page, the one that lists.const placeSwitch = createPlaceSwitch({ changed: () => railChanged(), stop: () => homeWindow.stopOpening(), kept: () => homePlaces.remembered(), pageSettled: () => { const page = mainWindow && !mainWindow.isDestroyed() ? mainWindow.webContents : null; if (page?.isLoadingMainFrame()) return new Promise(done => { page.once("did-stop-loading", done); page.once("destroyed", done); }); } }); const openPlace = (id, stale) => workspaceMenuAction(async () => { if (id === LOCAL_ID) await cleanWorkspace.settled(); if (!stale()) await switchEnvironment(id, stale); }); const chromeRail = createChromeRail({ createView: options => new WebContentsView(options), preload: path.join(__dirname, "preload.cjs"), log: slog, prefs: () => desktopPrefs, changed: () => rail.changed(), openComputer: (page) => openComputerSettings({ window: () => mainWindow, onLocal: (win) => senderIsLocal({ sender: win.webContents }), showLocal: () => placeSwitch.ask(LOCAL_ID, stale => { localProfiles.cancel(); return openPlace(LOCAL_ID, stale); }) }, page),args: () => [...desktopCompanionRendererArguments(rendererOrigin(), desktopRemoteAccess), ...(app.isPackaged && !desktopRemoteAccess ? ["--omb-company-desktop=1"] : []), `--omb-app-version=${app.getVersion()}`],diff --git a/electron/places-together.d.mts b/electron/places-together.d.mtsindex 6f941bf31a..454312fba4 100644--- a/electron/places-together.d.mts+++ b/electron/places-together.d.mts@@ -21,6 +21,8 @@ export interface PlaceBotRow {waiting?: true;working?: true;unread?: true;+ /** Epoch ms its conversations last moved there (the newest thread's `updatedAt`): Unread's order across places. */+ lastAt?: number;}export interface PlacesTogetherState {@@ -33,6 +35,10 @@ export interface PlacesTogetherState {/** The other place's bots while the switch is on. `state`: how that place is doing: asleep, waking and offline keep the* bots it gave last; "signin" is a My Cloud this window has not signed in to yet, which lists none. */other: { home: BotHome; state: "ready" | "loading" | "asleep" | "waking" | "offline" | "signin"; bots: PlaceBotRow[]; newBot?: boolean } | null;+ /** On, and this computer and My Cloud are the person's only places: the one list stands for both, so neither the rail+ * of places nor the page's place pill is drawn. Absent while there is a Team Cloud, a server saved by hand, a+ * workspace of this computer's own, another account or a Cloud still being made: those keep the rail and the pill. */+ onlyPair?: true;}/** `window.ogb.placesTogether`: this computer's page and My Cloud's own page. */diff --git a/electron/places-together.mjs b/electron/places-together.mjsindex f6b9675b93..edc6c5dea2 100644--- a/electron/places-together.mjs+++ b/electron/places-together.mjs@@ -45,7 +45,11 @@ function rowState(bot) {const waiting = bot.activity === "waiting-on-you" || tasks.some((task) => task.activity === "waiting-on-you");const working = !waiting && (Boolean(bot.busy) || tasks.some((task) => task.busy || task.activity === "working"));const unread = tasks.length ? tasks.some((task) => task.unread === true) : bot.unread === true;- return { ...(waiting ? { waiting: true } : {}), ...(working ? { working: true } : {}), ...(unread ? { unread: true } : {}) };+ // When its conversations last moved (each thread's own server-derived time, never a word of them): what Unread lists+ // the row by, newest first, beside this place's own rows.+ const times = tasks.map((task) => task.updatedAt).filter((at) => Number.isFinite(at) && at > 0);+ const lastAt = times.length ? Math.max(...times) : null;+ return { ...(waiting ? { waiting: true } : {}), ...(working ? { working: true } : {}), ...(unread ? { unread: true } : {}), ...(lastAt !== null ? { lastAt } : {}) };}/** One bot of the other place as its row: who it is, how it looks and how it is doing. A bot that is archived, hidden@@ -85,6 +89,8 @@ const needsSignIn = (response) => response?.status === 401 || response?.status =/*** @param {{* pref: { read(): unknown, write(value: unknown): void },+ * onlyPair?(): boolean,+ * switched?(): void,* cloud(): { origin: string | null, account: string | null, asleep: boolean },* powerChecked(): Promise<boolean>,* computer(): boolean,@@ -111,13 +117,16 @@ const needsSignIn = (response) => response?.status === 401 || response?.status =* own switch to that place, waking My Cloud as opening it always does. `send`: to the page on screen. `changed()`: the* list or the switch changed, so a page that draws it asks again. `address(home, botId)`: the address the link between* the two places gives that bot (electron/bot-link-main.mjs), or null while no link of this Cloud and account is on.+ * `onlyPair()`: this computer and My Cloud are the person's only places, so with the switch on the one list stands for+ * both and the rail of places is not drawn (cloud-rail.mjs `railPlaces` `joined`); the page hides its place pill too.+ * `switched()`: the switch was turned, so the rail is drawn again.** Security: My Cloud is never asked while it sleeps, since any request would wake it and run up its hours. It is asked* only right after the Admin said it is awake, at most once a minute, and only while the person is using the window. What* remains is a Cloud that fell asleep in the seconds since the Admin answered; one that only agreed to sleep answers so* itself and is left alone. Rows are kept for the Cloud and account they came from, and dropped the moment either changes.*/-export function createPlacesTogether({ pref, cloud, powerChecked, computer, local, cloudFetch, napped = () => {}, address = () => null, shown, focused, openPlace, send, changed, now = Date.now,+export function createPlacesTogether({ pref, onlyPair = () => false, switched = () => {}, cloud, powerChecked, computer, local, cloudFetch, napped = () => {}, address = () => null, shown, focused, openPlace, send, changed, now = Date.now,setTimer = setInterval, clearTimer = clearInterval, later = setTimeout, cancelLater = clearTimeout }) {/** What each place gave last: its rows, when, and how the last read went. */const kept = new Map();@@ -291,13 +300,16 @@ export function createPlacesTogether({ pref, cloud, powerChecked, computer, locaif (!active()) return { v: 1, available: available(), on: isOn(), here, other: null };watch();void refresh(otherHome(here));- return { v: 1, available: true, on: true, here, other: otherOf(here) };+ let pair = false;+ try { pair = onlyPair() === true; } catch {}+ return { v: 1, available: true, on: true, here, other: otherOf(here), ...(pair ? { onlyPair: true } : {}) };},/** The switch. Off forgets every list. */set(asking, value) {on = value === true;pref.write({ v: 1, on });sameScope();+ try { switched(); } catch {}tell();return this.state(asking);},diff --git a/electron/places-together.node-test.mjs b/electron/places-together.node-test.mjsindex e6b6cb092e..6758bd1300 100644--- a/electron/places-together.node-test.mjs+++ b/electron/places-together.node-test.mjs@@ -411,6 +411,32 @@ test("a row is a name, a look and a state: no messages, and no row for an archivassert.deepEqual(botRows(null, "cloud"), []);});+test("a row carries when its conversations last moved there: their own times, never a word of them and never a routine run's", () => {+ const row = botRow(bot("scout", "Scout", { tasks: [{ threadId: "t1", updatedAt: 3_000 }, { threadId: "t2", updatedAt: 9_000 }, { threadId: "t3", updatedAt: 99_000, routineRunId: "r" },+ { threadId: "t4", updatedAt: 50_000, archivedAt: 1 }, { threadId: "t5", updatedAt: "soon" }] }), "cloud");+ assert.equal(row.lastAt, 9_000);+ assert.equal("lastAt" in botRow(bot("new", "New", { tasks: [] }), "cloud"), false);+ assert.equal("lastAt" in botRow(bot("odd", "Odd", { tasks: [{ threadId: "t1", updatedAt: -5 }] }), "cloud"), false);+});++test("with the switch on and this computer and My Cloud the only places, the page is told the one list stands for both; off, never", async () => {+ let pair = true, switched = 0;+ const f = setup({ deps: { onlyPair: () => pair, switched: () => { switched += 1; } } });+ assert.equal(f.together.state("computer").onlyPair, true);+ assert.equal(f.together.state("cloud").onlyPair, true);+ pair = false;+ assert.equal("onlyPair" in f.together.state("computer"), false);+ pair = true;+ f.together.set("computer", false);+ assert.equal(switched, 1, "turning the switch draws the rail again");+ assert.equal("onlyPair" in f.together.state("computer"), false);+ f.together.set("computer", true);+ assert.equal(switched, 2);+ const broken = setup({ deps: { onlyPair: () => { throw new Error("no rail"); }, switched: () => { throw new Error("no rail"); } } });+ assert.equal("onlyPair" in broken.together.state("computer"), false);+ assert.doesNotThrow(() => broken.together.set("computer", false));+});+test("only this computer's page and My Cloud's own page are answered", async () => {const handlers = new Map();const f = setup();diff --git a/src/components/BotPlaceMark.tsx b/src/components/BotPlaceMark.tsxnew file mode 100644index 0000000000..72c1b6c1fa--- /dev/null+++ b/src/components/BotPlaceMark.tsx@@ -0,0 +1,25 @@+// The small device mark after a bot's name in the one list: where the bot lives, shown on hover and keyboard focus, and+// shown at rest only while it says something (working, My Cloud asleep or waking, a place that can't be reached). A screen+// reader hears it on every row, shown or not. Nothing with the switch off.+import { Cloud, CloudMoon, CloudOff, Laptop, MonitorOff, type LucideIcon } from "lucide-react";+import { cn } from "@/lib/cn";+import type { PlaceIcon, PlaceMark } from "@/lib/place-rows";++const ICONS: Record<PlaceIcon, LucideIcon> = {+ computer: Laptop, cloud: Cloud, "cloud-asleep": CloudMoon, "cloud-waking": Cloud, "cloud-off": CloudOff, "computer-off": MonitorOff,+};+/** Asleep and can't-be-reached are drawn quieter than the rest, never in an alarm colour. */+const QUIET = new Set<PlaceIcon>(["cloud-asleep", "cloud-off", "computer-off"]);++export function BotPlaceMark({ mark }: { mark: PlaceMark | null }) {+ if (!mark) return null;+ const Icon = ICONS[mark.icon];+ return (+ <Icon size={13} strokeWidth={2} role="img" aria-label={mark.label} data-bot-home={mark.home} data-bot-place={mark.icon} data-bot-place-shows={mark.shows}+ className={cn("shrink-0", mark.shows === "always"+ ? cn(QUIET.has(mark.icon) ? "text-ink-tertiary" : "text-ink-secondary", mark.icon === "cloud-waking" && "animate-pulse motion-reduce:animate-none")+ : "text-ink-secondary opacity-0 transition-opacity duration-150 motion-reduce:transition-none group-hover:opacity-100 group-focus-within:opacity-100")}>+ <title>{mark.label}</title>+ </Icon>+ );+}diff --git a/src/components/DesktopWorkspaceSwitcher.tsx b/src/components/DesktopWorkspaceSwitcher.tsxindex 1415b91571..f9c6ace115 100644--- a/src/components/DesktopWorkspaceSwitcher.tsx+++ b/src/components/DesktopWorkspaceSwitcher.tsx@@ -7,6 +7,7 @@ import type { CloudPlanSnapshot } from "../../electron/cloud-account.mjs";import { cloudColor } from "@/lib/cloud-look";import { t } from "@/lib/i18n";import { railShown, usePlaces, windowPlaceName } from "@/lib/places";+import { useOnlyPair } from "@/lib/place-rows";import { CloudTile } from "./cloud-buy/parts";import { SIMPLE_RAIL_BUTTON } from "./SidebarSimpleTop";@@ -87,6 +88,8 @@ type SwitcherProps = {* instead: the window's own rail at every width, one drawn on the page on a wide window. */export function DesktopWorkspaceSwitcher(props: SwitcherProps) {const places = usePlaces();+ // The one list holds this computer's bots and My Cloud's, and they are the only places: there is nothing to switch.+ if (useOnlyPair()) return null;const switcher = <Switcher {...props} />;return railShown(places) ? <div data-switcher-beside-rail className={places.beside ? "hidden" : "contents md:hidden"}>{switcher}</div> : switcher;}diff --git a/src/components/MoveToMyCloud.tsx b/src/components/MoveToMyCloud.tsxindex 5b676afcff..c40a09a27c 100644--- a/src/components/MoveToMyCloud.tsx+++ b/src/components/MoveToMyCloud.tsx@@ -7,6 +7,7 @@ import { ArrowRightLeft, Check, Cloud, Loader2, X } from "lucide-react";import type { BotMoveState, BotMoveView } from "../../electron/cloud-send.mjs";import { botMoveLine, filterBots, ipcErrorText, CHOOSER_PAGE, MY_CLOUD_TEAM } from "@/lib/cloud-send";import { t } from "@/lib/i18n";+import { useOneList } from "@/lib/place-rows";import type { Bot } from "@/state/store";import { ConfirmDialog } from "./ConfirmDialog";import { NotNowButton, PRIMARY_BUTTON } from "./NoticeCard";@@ -141,7 +142,9 @@ export function useMoveToMyCloud() {/** The one row the bots that moved to My Cloud leave in the sidebar: however many there are, it opens My Cloud. */export function MovedToMyCloudRow({ bots }: { bots: readonly Bot[] }) {const moved = bots.filter((bot) => bot.movedTo?.state === "moved" && bot.movedTo.team.id === MY_CLOUD_TEAM);- if (!moved.length) return null;+ // With the one list on, a bot that moved is listed where it lives now, among My Cloud's rows.+ const oneList = useOneList();+ if (!moved.length || oneList) return null;const page = bridge();return <div className="flex flex-col px-2 pb-1"><button type="button" data-moved-to-my-cloud={moved.length} disabled={!page?.openMyCloud} onClick={() => { void page?.openMyCloud?.().catch(() => {}); }}diff --git a/src/components/OtherPlaceBots.dom.test.ts b/src/components/OtherPlaceBots.dom.test.tsindex a1bb985227..17a07167fe 100644--- a/src/components/OtherPlaceBots.dom.test.ts+++ b/src/components/OtherPlaceBots.dom.test.ts@@ -5,7 +5,7 @@ import { afterEach, beforeEach, expect, it, vi } from "vitest";import type { PlaceBotRow, PlacesTogetherState } from "@/lib/places-together";import { resetPlacesTogetherForTest } from "@/lib/places-together";-import { OtherPlaceBots, OwnBotHomeMark } from "./OtherPlaceBots";+import { OtherPlaceLine } from "./OtherPlaceBots";import { PlacesTogetherSwitch } from "./PlacesTogetherSwitch";import { SettingsLook } from "./SettingsPrimitives";@@ -20,7 +20,6 @@ const page = {onChanged: vi.fn((cb: () => void) => { changed = cb; return () => {}; }),};const q = (selector: string) => document.body.querySelector<HTMLElement>(selector);-const all = (selector: string) => [...document.body.querySelectorAll<HTMLElement>(selector)];const render = async (...parts: Array<ReturnType<typeof createElement>>) => { await act(async () => root.render(createElement("div", null, ...parts))); await act(async () => {}); };beforeEach(() => {@@ -32,75 +31,61 @@ beforeEach(() => {});afterEach(async () => { await act(async () => root.unmount()); container.remove(); resetPlacesTogetherForTest(); vi.unstubAllGlobals(); delete (window as { ogb?: unknown }).ogb; });-it("draws nothing with the switch off, and nothing in a browser", async () => {+it("draws nothing with the switch off, nothing in a browser, and nothing while the other place has rows: they are in the list", async () => {said = state({ on: false, other: null });- await render(createElement(OtherPlaceBots, { key: "list" }), createElement(OwnBotHomeMark, { key: "mark" }));+ await render(createElement(OtherPlaceLine, { key: "line" }));+ expect(q("[data-other-place]")).toBeNull();+ said = state();+ await act(async () => changed());expect(q("[data-other-place]")).toBeNull();- expect(q("[data-bot-home]")).toBeNull();await act(async () => root.unmount());resetPlacesTogetherForTest();delete (window as { ogb?: unknown }).ogb;root = createRoot(container);- await render(createElement(OtherPlaceBots, { key: "list" }));+ await render(createElement(OtherPlaceLine, { key: "line" }));expect(q("[data-other-place]")).toBeNull();- expect(page.state).toHaveBeenCalledTimes(1);+ expect(page.state).toHaveBeenCalledTimes(2);});-it("lists My Cloud's bots under their own heading, each with the cloud mark, and a click opens that bot on My Cloud", async () => {- await render(createElement(OtherPlaceBots, { key: "list" }));- expect(q("[data-other-place]")!.getAttribute("data-other-place")).toBe("cloud");- expect(q("[data-section]")!.getAttribute("data-section")).toBe("On My Cloud");- expect(all("[data-placed-bot]").map((item) => item.getAttribute("data-placed-bot"))).toEqual(["cloud:scout", "cloud:nova"]);- expect(all("[data-placed-bot] svg[data-bot-home='cloud']").length).toBe(2);- expect(q('[data-placed-bot="cloud:nova"] [data-testid="unread-dot"]')).toBeTruthy();- expect(q('[data-placed-bot="cloud:scout"] [data-testid="unread-dot"]')).toBeNull();- expect(q("[data-other-place-line]")).toBeNull();- await act(async () => q('[data-placed-bot="cloud:nova"]')!.click());- expect(page.open.mock.calls).toEqual([["nova"]]);+it("nothing while the first read is under way: no spinner, the rows come when they come", async () => {+ said = state({ other: { home: "cloud", state: "loading", bots: [] } });+ await render(createElement(OtherPlaceLine, { key: "line" }));+ expect(q("[data-other-place]")).toBeNull();});-it("on My Cloud's page: this computer's bots carry no cloud, and the page's own rows do", async () => {- said = state({ here: "cloud", other: { home: "computer", state: "ready", bots: [row("computer", "scout", "Scout")] } });- await render(createElement(OtherPlaceBots, { key: "list" }), createElement("span", { key: "own", "data-own": "" }, createElement(OwnBotHomeMark)));- expect(q("[data-section]")!.getAttribute("data-section")).toBe("On this computer");- expect(q('[data-placed-bot="computer:scout"] [data-bot-home="cloud"]')).toBeNull();- expect(q("[data-own] [data-bot-home='cloud']")).toBeTruthy();+it("a Cloud this window is not signed in to says so in one quiet line that opens it, never a card or a dialog", async () => {+ const openMyCloud = vi.fn(async () => {});+ window.ogb = { placesTogether: page, cloudSendPage: { openMyCloud } } as never;+ said = state({ other: { home: "cloud", state: "signin", bots: [] } });+ await render(createElement(OtherPlaceLine, { key: "line" }));+ expect(q("[data-other-place-line]")!.textContent).toBe("Open My Cloud once to sign in.");+ expect(q("[data-other-place]")!.getAttribute("data-other-place-state")).toBe("signin");+ await act(async () => q("button[data-other-place-line]")!.click());+ expect(openMyCloud).toHaveBeenCalledTimes(1);+ expect(document.body.querySelector("[role=alert], [role=dialog]")).toBeNull();});-it("a sleeping, waking or unreachable Cloud keeps its bots, dimmed, under one short line, and they still open", async () => {- for (const [power, line] of [["asleep", "My Cloud is asleep. Open a bot to wake it."], ["waking", "My Cloud is waking up…"], ["offline", "My Cloud can't be reached right now."]] as const) {- said = state({ other: { home: "cloud", state: power, bots: [row("cloud", "scout", "Scout")] } });- await render(createElement(OtherPlaceBots, { key: "list" }));+it("a sleeping Cloud with nothing kept says so as normal, and opening it wakes it; one that can't be reached only says so", async () => {+ const openMyCloud = vi.fn(async () => {});+ window.ogb = { placesTogether: page, cloudSendPage: { openMyCloud } } as never;+ said = state({ other: { home: "cloud", state: "asleep", bots: [] } });+ await render(createElement(OtherPlaceLine, { key: "line" }));+ expect(q("[data-other-place-line]")!.textContent).toBe("My Cloud is asleep. Open it to see its bots.");+ expect(q("[data-other-place-line]")!.className).not.toContain("danger");+ await act(async () => q("button[data-other-place-line]")!.click());+ expect(openMyCloud).toHaveBeenCalledTimes(1);+ for (const [home, line] of [["cloud", "My Cloud can't be reached right now."], ["computer", "This computer's bots can't be read right now."]] as const) {+ said = state({ here: home === "cloud" ? "computer" : "cloud", other: { home, state: "offline", bots: [] } });await act(async () => changed());expect(q("[data-other-place-line]")!.textContent).toBe(line);+ expect(q("[data-other-place-line]")!.tagName).toBe("P");expect(q("[data-other-place-line]")!.getAttribute("role")).toBe("status");- expect(q('[data-placed-bot="cloud:scout"]')!.className).toContain("opacity-60");- expect((q('[data-placed-bot="cloud:scout"]') as HTMLButtonElement).disabled).toBe(false);}- expect(document.body.querySelector("[role=alert], [role=dialog]")).toBeNull();-});--it("a bot with the same id as one of this page's own is its own row: it carries the other home, and its click names that home's bot", async () => {- said = state({ other: { home: "cloud", state: "ready", bots: [row("cloud", "scout", "Scout there", { unread: true })] } });- await render(createElement("div", { key: "own", "data-own-bot": "scout" }, "Scout here"), createElement(OtherPlaceBots, { key: "list" }));- expect(q('[data-placed-bot="cloud:scout"]')!.getAttribute("data-bot-home")).toBe("cloud");- expect(q('[data-placed-bot="cloud:scout"]')!.textContent).toContain("Scout there");- expect(q("[data-own-bot] [data-testid='unread-dot']")).toBeNull();- await act(async () => q('[data-placed-bot="cloud:scout"]')!.click());- expect(page.open.mock.calls).toEqual([["scout"]]);});-it("a Cloud this window is not signed in to says so in one line, with no rows", async () => {+it("a line is no search result: hidden while the sidebar is searched", async () => {said = state({ other: { home: "cloud", state: "signin", bots: [] } });- await render(createElement(OtherPlaceBots, { key: "list" }));- expect(q("[data-other-place-line]")!.textContent).toBe("Open My Cloud once to sign in.");- expect(all("[data-placed-bot]")).toEqual([]);-});--it("follows the sidebar's search, and hides the heading when nothing there matches", async () => {- await render(createElement(OtherPlaceBots, { key: "list", query: "research" }));- expect(all("[data-placed-bot]").map((item) => item.getAttribute("data-placed-bot"))).toEqual(["cloud:nova"]);- await render(createElement(OtherPlaceBots, { key: "list", query: "zzz" }));+ await render(createElement(OtherPlaceLine, { key: "line", query: "scout" }));expect(q("[data-other-place]")).toBeNull();});diff --git a/src/components/OtherPlaceBots.tsx b/src/components/OtherPlaceBots.tsxindex 3c571da5c7..7e2f2da457 100644--- a/src/components/OtherPlaceBots.tsx+++ b/src/components/OtherPlaceBots.tsx@@ -1,99 +1,45 @@-// The other place's bots in this sidebar, while "This computer and My Cloud together" is on: a group of their own under-// this place's bots. A row opens its bot where it lives; main switches the window there.-import { useState } from "react";-import { Cloud } from "lucide-react";-import { BOT_BODY_IDS, type BotBodyId } from "../../shared/bot-body";-import { MASCOT_FACE_COLORS, mascotBodyColorSchema, mascotMaterialSchema, type MascotFaceColor } from "../../shared/bot-avatar";+// The end of the one list, while "This computer and My Cloud together" is on: the other place's bots are rows among this+// place's own (src/lib/place-rows.ts), so this says something only when that place has no rows to show: My Cloud not+// signed in to yet, or a place that is asleep or can't be reached with nothing kept from before. One quiet line in the+// list's secondary text, not a card or a banner; it opens My Cloud where there is something to do there. Nothing while+// the first read is under way, and nothing with the switch off.+import { Cloud, CloudMoon, CloudOff, MonitorOff } from "lucide-react";import { cn } from "@/lib/cn";import { t } from "@/lib/i18n";-import { useAdvancedMode } from "@/lib/interface-mode";-import { MAUS_COLOR_NAMES, type MausColor } from "@/lib/mascot";-import { matchingRows, openOtherPlaceBot, placedKey, usePlacesTogether, type BotHome, type PlaceBotRow, type PlacesTogetherState } from "@/lib/places-together";-import { useSidebarDensity } from "@/lib/sidebar-preferences";-import { BotAvatar } from "./Avatar";-import { SidebarSectionHeader } from "./SidebarSectionHeader";-import { SIMPLE_ROW_FOCUS } from "./SidebarSimpleTop";--type OtherState = NonNullable<PlacesTogetherState["other"]>["state"];--const homeLabel = (home: BotHome): string => t(home === "cloud" ? "together.onCloud" : "together.onComputer");--function stateLine(state: OtherState, home: BotHome): string | null {- if (state === "asleep") return t("together.state.asleep");- if (state === "waking") return t("together.state.waking");- if (state === "signin") return t("together.state.signin");- if (state === "offline") return t(home === "cloud" ? "together.state.offlineCloud" : "together.state.offlineComputer");- return null;-}--/** The small cloud a bot that lives on My Cloud carries beside its name. */-export function CloudBotMark({ className }: { className?: string }) {- return <Cloud size={12} role="img" aria-label={t("together.onCloud")} data-bot-home="cloud" className={cn("shrink-0 text-ink-secondary", className)}><title>{t("together.onCloud")}</title></Cloud>;-}--/** The same mark on this page's own rows, when this page is My Cloud's and both places are listed together. */-export function OwnBotHomeMark() {- const together = usePlacesTogether();- return together?.on && together.here === "cloud" ? <CloudBotMark /> : null;-}--function avatarOf(row: PlaceBotRow) {- const color = (MAUS_COLOR_NAMES as readonly string[]).includes(row.color ?? "") ? row.color as MausColor : "green";- const body = (BOT_BODY_IDS as readonly string[]).includes(row.mascotBody ?? "") ? row.mascotBody as BotBodyId : null;- const face = (MASCOT_FACE_COLORS as readonly string[]).includes(row.mascotFaceColor ?? "") ? row.mascotFaceColor as MascotFaceColor : null;- const tint = mascotBodyColorSchema.safeParse(row.mascotBodyColor).data ?? null;- const material = mascotMaterialSchema.safeParse(row.mascotMaterial).data ?? null;- return { name: row.name, color, mascotBody: body, mascotFaceColor: face, mascotBodyColor: tint, mascotMaterial: material };-}--function OtherPlaceBotRow({ row, dim, iconOnly, simple }: { row: PlaceBotRow; dim: boolean; iconOnly: boolean; simple: boolean }) {- const line = row.waiting ? t("sidebar.preview.waiting") : row.working ? t("sidebar.preview.working") : row.title ?? "";- const label = [row.name, homeLabel(row.home), line, row.unread ? t("task.unread") : ""].filter(Boolean).join(" · ");- return (- <button type="button" data-placed-bot={placedKey(row.home, row.id)} data-bot-home={row.home} data-bot-address={row.address} title={iconOnly ? label : undefined} aria-label={label}- onClick={() => openOtherPlaceBot(row.id)}- className={cn("flex w-full items-center rounded-xl text-left transition-colors duration-150 hover:bg-raised/50", SIMPLE_ROW_FOCUS,- iconOnly ? "justify-center px-1 py-1.5" : simple ? "gap-2 rounded-[8px] px-2 py-2" : "gap-3 py-2 pl-2.5 pr-3", dim && "opacity-60")}>- <span className="relative flex shrink-0">- <BotAvatar bot={avatarOf(row)} state="idle" size={iconOnly || !simple ? 44 : 36} motion="none" animated={false} />- {row.home === "cloud" && iconOnly && (- <span className="absolute -bottom-0.5 -left-0.5 flex size-[18px] items-center justify-center rounded-full border-2 border-panel bg-panel"><CloudBotMark /></span>- )}- {(row.waiting || row.working) && <span aria-hidden="true" className={cn("absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-panel", row.waiting ? "bg-warning" : "bg-success")} />}- </span>- {!iconOnly && (- <span className="flex min-w-0 flex-1 flex-col">- <span className="flex min-w-0 items-center gap-1.5">- <span dir="auto" className={cn("truncate text-ink", simple ? "text-[14px] font-medium leading-5" : "text-[15px] font-semibold leading-5")}>{row.name}</span>- {row.home === "cloud" && <CloudBotMark />}- </span>- {line && <span dir="auto" className={cn("truncate text-[13px] leading-[18px]", row.waiting ? "text-warning" : "text-ink-secondary")}>{line}</span>}- </span>- )}- {!iconOnly && row.unread && <span aria-hidden="true" data-testid="unread-dot" className="size-2 shrink-0 rounded-full bg-accent" />}- </button>- );+import { usePlacesTogetherPart, type PlacesTogetherState } from "@/lib/places-together";+import type { LocaleKey } from "@/locales";++type Said = "cloud:signin" | "cloud:asleep" | "cloud:waking" | "cloud:offline" | "computer:offline";++const SAID: Record<Said, { icon: typeof Cloud; words: LocaleKey; opens?: true }> = {+ "cloud:signin": { icon: Cloud, words: "together.state.signin", opens: true },+ "cloud:asleep": { icon: CloudMoon, words: "together.line.asleep", opens: true },+ "cloud:waking": { icon: Cloud, words: "together.state.waking" },+ "cloud:offline": { icon: CloudOff, words: "together.state.offlineCloud" },+ "computer:offline": { icon: MonitorOff, words: "together.state.offlineComputer" },+};++function saidOf(state: PlacesTogetherState | null): Said | null {+ const other = state?.on ? state.other : null;+ if (!other || other.bots.length) return null;+ const said = `${other.home}:${other.state}`;+ return said in SAID ? said as Said : null;}-/** Nothing unless main says the switch is on. */-export function OtherPlaceBots({ query = "" }: { query?: string }) {- const together = usePlacesTogether();- const density = useSidebarDensity();- const simple = !useAdvancedMode();- const [collapsed, setCollapsed] = useState(false);- const other = together?.on ? together.other : null;- if (!other) return null;- const rows = matchingRows(other.bots, query);- const said = stateLine(other.state, other.home);- if (!rows.length && (query.trim() || !said)) return null;- const iconOnly = density === "icons";- const name = homeLabel(other.home);- return (- <div data-other-place={other.home} data-other-place-state={other.state} className={cn("flex flex-col gap-0.5", !iconOnly && "pt-3")}>- {!iconOnly && <SidebarSectionHeader name={name} line={simple} collapsed={collapsed}- onToggle={() => setCollapsed((was) => !was)} reorderable={false} dragging={false} />}- {said && !iconOnly && <p role="status" data-other-place-line="" className="px-2 pb-1 text-[12px] leading-4 text-ink-secondary">{said}</p>}- {!collapsed && rows.map((row) => <OtherPlaceBotRow key={placedKey(row.home, row.id)} row={row} dim={other.state !== "ready" && other.state !== "loading"} iconOnly={iconOnly} simple={simple} />)}- </div>- );+/** My Cloud's page, opened from this computer's page (main's own switch, which wakes it as opening it always does). */+const openMyCloud = () => (window.ogb?.remoteClient?.active ? undefined : window.ogb?.cloudSendPage?.openMyCloud);++export function OtherPlaceLine({ query = "" }: { query?: string }) {+ const said = usePlacesTogetherPart(saidOf);+ if (!said || query.trim()) return null;+ const { icon: Icon, words, opens } = SAID[said];+ const open = opens ? openMyCloud() : undefined;+ const [home, state] = said.split(":");+ const body = <><Icon size={13} aria-hidden="true" className={cn("shrink-0", said === "cloud:waking" && "animate-pulse motion-reduce:animate-none")} /><span className="min-w-0">{t(words)}</span></>;+ const look = "flex w-full items-center gap-2 px-2.5 py-1.5 text-left text-[12px] leading-4 text-ink-secondary";+ return <div data-other-place={home} data-other-place-state={state} className="flex flex-col px-2 pb-1 pt-2">+ {open+ ? <button type="button" data-other-place-line="" onClick={() => { void open().catch(() => {}); }} className={cn(look, "rounded-lg hover:bg-menu-hover hover:text-ink")}>{body}</button>+ : <p role="status" data-other-place-line="" className={look}>{body}</p>}+ </div>;}diff --git a/src/components/Sidebar.one-list.dom.test.ts b/src/components/Sidebar.one-list.dom.test.tsnew file mode 100644index 0000000000..2ded6d4e37--- /dev/null+++ b/src/components/Sidebar.one-list.dom.test.ts@@ -0,0 +1,237 @@+// @vitest-environment happy-dom+// The one list in the real Sidebar: with "This computer and My Cloud together" on, the other place's bots are rows among+// this place's own; with it off, or with main never answering, the sidebar is exactly as it was.+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { Bot } from "@/state/store";+import type { PlaceBotRow, PlacesTogetherState } from "@/lib/places-together";++const mode = vi.hoisted(() => ({ advanced: false }));+vi.mock("@/lib/interface-mode", async (original) => ({+ ...await original<typeof import("@/lib/interface-mode")>(), useAdvancedMode: () => mode.advanced,+}));+vi.mock("@/lib/thread-preferences", async (original) => ({+ ...await original<typeof import("@/lib/thread-preferences")>(), useShowThreads: () => mode.advanced,+}));+vi.mock("./DesktopCapabilities", async (original) => ({+ ...await original<typeof import("./DesktopCapabilities")>(),+ useDesktopCapabilities: () => ({ capabilities: { dictation: { available: false }, host: { packaged: false, platform: "other" }, localComputer: { available: false } }, ready: true }),+}));+vi.mock("@/lib/analytics", () => ({ track: vi.fn() }));+vi.mock("@/lib/cloud-guest", () => ({ useCanWriteIn: () => true }));++const { Sidebar } = await import("./Sidebar");+const { BotEditorStore, initialState } = await import("@/state/store");+const { setLocale } = await import("@/lib/i18n");+const { resetPlacesTogetherForTest } = await import("@/lib/places-together");+const { resetPlaceRowsForTest } = await import("@/lib/place-rows");++const bot = (id: string, extra: Partial<Bot> = {}): Bot => ({+ id, name: id[0]!.toUpperCase() + id.slice(1), threadId: `${id}-t`, title: "", description: "", color: "green", unread: false,+ notifications: true, messages: [], modelSelection: { instanceId: "test", model: "test" },+ tasks: [{ threadId: `${id}-t`, title: "Chat", createdAt: 1 }], ...extra,+});+const row = (id: string, over: Partial<PlaceBotRow> = {}): PlaceBotRow => ({ home: "cloud", id, threadId: `t-${id}`, name: id[0]!.toUpperCase() + id.slice(1), color: "blue", ...over });+const said = (over: Partial<PlacesTogetherState> = {}): PlacesTogetherState => ({ v: 1, available: true, on: true, here: "computer",+ other: { home: "cloud", state: "ready", bots: [row("scout", { title: "Open issues" }), row("tech", { unread: true, title: "Deploy check", lastAt: 9_000 })] }, ...over });+const OWN = [bot("mausbot", { chiefOfStaff: true }), bot("git"), bot("ledger")];++const dispatch = vi.fn();+let host: HTMLDivElement, root: Root, answer: () => Promise<PlacesTogetherState>, changed: () => void;+const page = {+ state: vi.fn(() => answer()),+ set: vi.fn(async () => said()),+ open: vi.fn(async () => true),+ onChanged: vi.fn((callback: () => void) => { changed = callback; return () => {}; }),+};+const tree = (bots: Bot[], icons = false) => createElement(BotEditorStore, {+ value: { state: { ...initialState, connected: true, bots, selectedId: bots[0]!.id }, dispatch,+ flushBotPatches: async () => null, refreshInstances: async () => {}, refreshModels: async () => {} },+ children: createElement(Sidebar, { open: true, onClose: () => {}, collapseToIcons: icons }),+});+async function render(bots = OWN, icons = false) {+ await act(async () => root.render(tree(bots, icons)));+ await act(async () => { await Promise.resolve(); });+}+const q = (selector: string) => host.querySelector<HTMLElement>(selector);+const ids = (selector = "") => [...host.querySelectorAll<HTMLElement>(`${selector} [data-sidebar-bot-row]`)].map((item) => item.dataset.sidebarBotRow);+const mark = (id: string) => q(`[data-sidebar-bot-row="${id}"] [data-bot-place]`);++beforeEach(() => {+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);+ vi.stubGlobal("fetch", () => new Promise(() => {}));+ dispatch.mockReset();+ for (const fn of Object.values(page)) fn.mockClear();+ answer = async () => said();+ localStorage.clear();+ setLocale("en");+ mode.advanced = false;+ host = document.createElement("div");+ document.body.append(host);+ root = createRoot(host);+});+afterEach(async () => {+ await act(async () => root.unmount());+ host.remove();+ resetPlacesTogetherForTest();+ resetPlaceRowsForTest();+ vi.unstubAllGlobals();+ delete (window as { ogb?: unknown }).ogb;+});++async function htmlWith(ogb: unknown, bots = OWN): Promise<string> {+ if (ogb) window.ogb = ogb as never; else delete (window as { ogb?: unknown }).ogb;+ await render(bots);+ // React's generated ids count up across roots; everything else is compared as drawn.+ const html = host.innerHTML.replace(/r[0-9a-z]{1,3}(?=[-"#)])/g, "r#");+ await act(async () => root.unmount());+ resetPlacesTogetherForTest();+ resetPlaceRowsForTest();+ root = createRoot(host);+ return html;+}++describe("switch off: nothing changes", () => {+ for (const advanced of [false, true]) {+ it(`the ${advanced ? "Advanced" : "Simple"} sidebar is the same with the switch off, with main never answering, and in a browser`, async () => {+ mode.advanced = advanced;+ const bots = [...OWN, bot("nova", { unread: true, tasks: [{ threadId: "nova-t", title: "Chat", createdAt: 1, unread: true }] })];+ const browser = await htmlWith(null, bots);+ answer = async () => said({ on: false, other: null });+ const off = await htmlWith({ placesTogether: page }, bots);+ answer = () => new Promise(() => {});+ const silent = await htmlWith({ placesTogether: page }, bots);+ expect(off).toBe(browser);+ expect(silent).toBe(browser);+ expect(browser).not.toContain("data-bot-place");+ expect(page.state).toHaveBeenCalled();+ });+ }+});++describe("switch on: one list", () => {+ it("lists My Cloud's bots in the same list as this computer's, with no group or heading of their own", async () => {+ window.ogb = { placesTogether: page } as never;+ await render();+ expect(ids('[data-sidebar-section-id="builtin:bots"]')).toEqual(["git", "ledger", "cloud:scout"]);+ expect(ids('[data-sidebar-section-id="builtin:unread"]')).toEqual(["cloud:tech"]);+ expect([...host.querySelectorAll("[data-section]")].map((header) => header.getAttribute("data-section"))).not.toContain("On My Cloud");+ expect(q("[data-other-place]")).toBeNull();+ expect(q('[data-sidebar-bot-row="cloud:scout"]')!.textContent).toContain("Open issues");+ });++ it("unread rows of both places share the one Unread group, newest first", async () => {+ window.ogb = { placesTogether: page } as never;+ const nova = bot("nova", { unread: true, tasks: [{ threadId: "nova-t", title: "Chat", createdAt: 1, updatedAt: 5_000, unread: true }] });+ answer = async () => said({ other: { home: "cloud", state: "ready", bots: [row("old", { unread: true, lastAt: 1_000 }), row("tech", { unread: true, lastAt: 9_000 })] } });+ await render([...OWN, nova]);+ expect(ids('[data-sidebar-section-id="builtin:unread"]')).toEqual(["cloud:tech", "nova", "cloud:old"]);+ });++ it("a bot with the same id in both places is two rows, each its own", async () => {+ window.ogb = { placesTogether: page } as never;+ answer = async () => said({ other: { home: "cloud", state: "ready", bots: [row("git", { name: "Git there" })] } });+ await render();+ expect(ids('[data-sidebar-section-id="builtin:bots"]')).toEqual(["git", "ledger", "cloud:git"]);+ expect(q('[data-sidebar-bot-row="cloud:git"]')!.textContent).toContain("Git there");+ });++ it("every row names its place to a screen reader; on screen the mark waits for hover or keyboard focus", async () => {+ window.ogb = { placesTogether: page } as never;+ await render();+ for (const [id, label, home] of [["git", "On this computer", "computer"], ["cloud:scout", "On My Cloud", "cloud"]] as const) {+ const icon = mark(id)!;+ expect(icon.getAttribute("aria-label")).toBe(label);+ expect(icon.getAttribute("role")).toBe("img");+ expect(icon.getAttribute("data-bot-home")).toBe(home);+ expect(icon.getAttribute("data-bot-place-shows")).toBe("hover");+ const classes = icon.getAttribute("class")!.split(/\s+/);+ expect(classes).toEqual(expect.arrayContaining(["opacity-0", "group-hover:opacity-100", "group-focus-within:opacity-100"]));+ // The focusable row is inside the same group, so keyboard focus on it shows the mark as hover does.+ const group = icon.closest(".group")!;+ expect(group.querySelector(`[data-sidebar-bot-row="${id}"]`)!.getAttribute("tabindex")).toBe("0");+ expect(group.contains(icon)).toBe(true);+ }+ });++ it("the mark stays at rest only while it says something: working, asleep, can't be reached", async () => {+ window.ogb = { placesTogether: page } as never;+ answer = async () => said({ other: { home: "cloud", state: "ready", bots: [row("scout", { working: true }), row("atlas")] } });+ await render([...OWN.slice(0, 2), bot("ledger", { busy: true })]);+ expect(mark("cloud:scout")!.getAttribute("data-bot-place-shows")).toBe("always");+ expect(mark("cloud:scout")!.getAttribute("aria-label")).toBe("Working on My Cloud now");+ expect(mark("ledger")!.getAttribute("aria-label")).toBe("Working on this computer now");+ expect(mark("cloud:atlas")!.getAttribute("data-bot-place-shows")).toBe("hover");+ answer = async () => said({ other: { home: "cloud", state: "asleep", bots: [row("atlas")] } });+ await act(async () => changed());+ await act(async () => { await Promise.resolve(); });+ expect(mark("cloud:atlas")!.getAttribute("data-bot-place")).toBe("cloud-asleep");+ expect(mark("cloud:atlas")!.getAttribute("data-bot-place-shows")).toBe("always");+ expect(mark("cloud:atlas")!.getAttribute("class")).toContain("text-ink-tertiary");+ expect(mark("cloud:atlas")!.getAttribute("aria-label")).toBe("My Cloud is asleep. Opening Atlas wakes it.");+ // Asleep is normal: the row is drawn as any other, not dimmed, not an alert.+ expect(q('[data-sidebar-bot-row="cloud:atlas"]')!.closest(".group")!.className).not.toContain("opacity-");+ expect(host.querySelector("[role=alert], [role=dialog]")).toBeNull();+ answer = async () => said({ other: { home: "cloud", state: "offline", bots: [row("atlas")] } });+ await act(async () => changed());+ await act(async () => { await Promise.resolve(); });+ expect(mark("cloud:atlas")!.getAttribute("data-bot-place")).toBe("cloud-off");+ expect(mark("git")!.getAttribute("data-bot-place-shows")).toBe("hover");+ });++ it("clicking a row of the other place opens its bot there, by its own id; this place's store never hears of it", async () => {+ window.ogb = { placesTogether: page } as never;+ await render();+ await act(async () => q('[data-sidebar-bot-row="cloud:scout"]')!.click());+ expect(page.open.mock.calls).toEqual([["scout"]]);+ await act(async () => { q('[data-sidebar-bot-row="cloud:tech"]')!.dispatchEvent(new KeyboardEvent("keydown", { key: "Enter", bubbles: true })); });+ expect(page.open.mock.calls).toEqual([["scout"], ["tech"]]);+ expect(JSON.stringify(dispatch.mock.calls)).not.toContain("cloud:");+ });++ it("a row of the other place has no menu and no rename here: those belong to its own page", async () => {+ window.ogb = { placesTogether: page } as never;+ await render();+ expect(q('[data-bot-actions="git"]')).not.toBeNull();+ expect(q('[data-bot-actions="cloud:scout"]')).toBeNull();+ const name = [...q('[data-sidebar-bot-row="cloud:scout"]')!.querySelectorAll("span")].find((span) => span.textContent === "Scout")!;+ await act(async () => { name.dispatchEvent(new MouseEvent("dblclick", { bubbles: true })); });+ expect(q('[data-sidebar-bot-row="cloud:scout"] input')).toBeNull();+ await act(async () => { q('[data-sidebar-bot-row="cloud:scout"]')!.dispatchEvent(new MouseEvent("contextmenu", { bubbles: true, cancelable: true })); });+ expect(host.querySelector("[role=menu]")).toBeNull();+ expect(JSON.stringify(dispatch.mock.calls)).not.toContain("cloud:");+ });++ it("the sidebar's search finds rows of both places", async () => {+ window.ogb = { placesTogether: page } as never;+ mode.advanced = true;+ await render();+ const search = q('input[aria-label]')!;+ await act(async () => {+ const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")!.set!;+ setter.call(search, "sco");+ search.dispatchEvent(new Event("input", { bubbles: true }));+ });+ expect(ids()).toEqual(["cloud:scout"]);+ });++ it("in the avatars-only sidebar the place joins each row's own label", async () => {+ window.ogb = { placesTogether: page } as never;+ mode.advanced = true;+ await render(OWN, true);+ expect(q('[data-sidebar-bot-row="cloud:scout"]')!.getAttribute("aria-label")).toContain("On My Cloud");+ expect(q('[data-sidebar-bot-row="git"]')!.getAttribute("aria-label")).toContain("On this computer");+ });++ it("a place that never answers leaves this place's list whole, and the first answer adds its rows without a wait", async () => {+ window.ogb = { placesTogether: page } as never;+ let release!: (value: PlacesTogetherState) => void;+ answer = () => new Promise((resolve) => { release = resolve; });+ await render();+ expect(ids()).toEqual(["mausbot", "git", "ledger"].filter((id) => q(`[data-sidebar-bot-row="${id}"]`)));+ expect(ids('[data-sidebar-section-id="builtin:bots"]')).toEqual(["git", "ledger"]);+ await act(async () => release(said()));+ expect(ids('[data-sidebar-section-id="builtin:bots"]')).toEqual(["git", "ledger", "cloud:scout"]);+ });+});diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 302351e7fc..bfa9c6faa9 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -73,7 +73,7 @@ import { SidebarProfileMenu } from "./SidebarProfileMenu";import { PHONE_LAYOUT, useMediaQuery } from "@/lib/use-media-query";import { GlassBar, GlassScrollFrame, GlassScroller } from "./GlassScrollFrame";import { DesktopWorkspaceSwitcher, endCloudHowTo } from "./DesktopWorkspaceSwitcher"; import { PlaceTint } from "./PlaceTint"; import { ChromeRailToggle } from "./ChromeRailToggle";-import { useCloudOwner } from "./CloudOwner"; import { OtherPlaceBots, OwnBotHomeMark } from "./OtherPlaceBots"; import { NewBotOtherPlaceItem, useNewBotHereLabel } from "./NewBotPlaceItems";+import { useCloudOwner } from "./CloudOwner"; import { OtherPlaceLine } from "./OtherPlaceBots"; import { BotPlaceMark } from "./BotPlaceMark"; import { isPlacedBot, NO_MENU, otherPlaceDispatch, ownRows, placedLine, rowPlaceMark, useOneListHere, useOtherPlaceBots, withOtherPlace } from "@/lib/place-rows"; import type { BotHome } from "@/lib/places-together"; import { NewBotOtherPlaceItem, useNewBotHereLabel } from "./NewBotPlaceItems";import { SidebarSectionHeader } from "./SidebarSectionHeader";import { NeedsYouButton, OwnerPickerHost } from "./TeamOwner"; import { SidebarPeople } from "./SidebarPeople"; import { SidebarInboxRow } from "./SidebarInboxRow"; import { TeamSideSwitch, useTeamSideLists } from "./TeamSideSwitch"; import { SidebarActiveThreads } from "./SidebarActiveThreads"; import { setAttentionPinned, useAttentionPinned } from "./inbox/attention-pinned"; import { useInboxSupport } from "@/state/inbox";import { TeamMenuItems } from "./SidebarTeamMenu";@@ -663,14 +663,14 @@ export interface BotRowProps {renameRequest?: number;botDrag?: BotRowDrag;botDrop?: BotDropPlace | null;- botDragging?: boolean;+ botDragging?: boolean; /** With the one list on: this page's place, for each row's device mark (place-rows.ts). */ placeHere?: BotHome | null;}export function botRowProps<State extends Pick<AppState, "activeView" | "selectedId" | "revealThread" | "deletingBots" | "mascotMotion" | "pendingQueued" | "routineRuns" | "instances" | "liveCall" | "config" | "newChat">>(state: State,dispatch: Dispatch<Action>,bot: Bot,- layout: Pick<BotRowProps, "density" | "query" | "onMenu" | "renameRequest" | "botDrag" | "botDrop" | "botDragging">,+ layout: Pick<BotRowProps, "density" | "query" | "onMenu" | "renameRequest" | "botDrag" | "botDrop" | "botDragging" | "placeHere">,): BotRowProps {const selected = state.activeView === "chat" && state.selectedId === bot.id;const reveal = state.revealThread;@@ -700,12 +700,12 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {const { bot, selected, deleting, mascotMotion, reveal, pendingQueued, instances, liveCall, density, query, dispatch, onMenu, renameRequest, botDrag: drag, botDrop: drop, botDragging: dragging } = props;const showThreads = useShowThreads();const liveMedia = useLiveMedia();- const remoteClient = typeof window !== "undefined" && window.ogb?.remoteClient?.active === true;+ const remoteClient = typeof window !== "undefined" && window.ogb?.remoteClient?.active === true, placed = isPlacedBot(bot);const [renaming, setRenaming] = useState(false);const [creatingProject, setCreatingProject] = useState(false);const [threadsOpen, setThreadsOpen] = useSearchDisclosure(`bot:${bot.id}`, showThreads ? query : "", searchMatchesThreads(query, bot.tasks, bot.projects));useEffect(() => { if (reveal && showThreads) setThreadsOpen(true); }, [reveal, showThreads]);- const hasThreadList = (bot.tasks?.filter((task) => !task.routineRunId).length ?? 1) > 1 || (bot.projects?.length ?? 0) > 0 || Boolean(query);+ const hasThreadList = !placed && ((bot.tasks?.filter((task) => !task.routineRunId).length ?? 1) > 1 || (bot.projects?.length ?? 0) > 0 || Boolean(query));const iconOnly = density === "icons";const expanded = showThreads && !iconOnly && threadsOpen && hasThreadList;useEffect(() => { if (iconOnly) setRenaming(false); }, [iconOnly]);@@ -730,7 +730,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {);const { waiting, working, failed, teammateWait, queued } = sidebarBotStatus(bot, pendingQueued, visible);const { unread, noticing } = useBotUnread(bot); const beat = useMotionBeat(mascotMotion?.kind, mascotMotion?.nonce ?? 0);- const onLiveCall = liveBadgeFor(bot.id, liveMedia, liveCall);+ const onLiveCall = liveBadgeFor(bot.id, liveMedia, liveCall), placeMark = rowPlaceMark(bot, working, props.placeHere);const body = (<><span className={cn("relative flex shrink-0", simpleRow && "-m-[3px]")} title={iconOnly || simpleList ? undefined : [bot.name, ...details].join(" · ")}>@@ -776,7 +776,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {<div className={cn("flex items-baseline justify-between gap-2", simpleRow && "pe-7 group-hover:pe-[3.25rem] group-focus-within:pe-[3.25rem] touch:pe-[3.25rem] max-md:touch:pe-7")}><span className={cn("flex min-w-0 grow items-center gap-1.5 truncate text-ink", "text-[14px] font-medium leading-5")}>{!simpleList && bot.pinned && <Pin size={12} className="shrink-0 text-ink-secondary" />}- <RenameTitle+ {placed ? <span className="truncate" title={tooltip}>{bot.name}</span> : <RenameTitlekey={iconOnly ? "icons" : "expanded"}value={bot.name}editRequest={renameRequest}@@ -793,7 +793,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {onEditingChange={setRenaming}className="truncate"inputClassName={cn("w-full rounded bg-inset px-1 py-0.5", "text-[14px] font-medium")}- />+ />}{!simpleList && bot.chiefOfStaff && !renaming && (<Crown size={13} strokeWidth={2.25} className="shrink-0 text-accent" role="img" aria-label={t("sidebar.bot.chiefOfStaff")} data-testid="chief-crown"><title>{t("sidebar.bot.chiefOfStaff")}</title>@@ -804,7 +804,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {<title>{t("call.live.badge")}</title></Phone>)}- {!renaming && <OwnBotHomeMark />}{!simpleList && title && !renaming && <SidebarBotRole role={title} />}+ {!renaming && <BotPlaceMark mark={placeMark} />}{!simpleList && title && !renaming && <SidebarBotRole role={title} />}</span>{last && !renaming && !expanded && (<span className={cn(@@ -829,7 +829,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {{working ? (<SidebarWorkingStep bot={bot} last={last} />) : (- <FadeLine>{waiting ? waitingHandoffPreview(visible) ?? t("sidebar.preview.waiting") : teammateWait ? t("sidebar.preview.waitingOnTeammate") : queued && !failed ? t("task.queued") : failed ? lastLine(bot, visible, instances, advanced) : botPreview(bot, visible, instances, advanced)}</FadeLine>+ <FadeLine>{waiting ? waitingHandoffPreview(visible) ?? t("sidebar.preview.waiting") : teammateWait ? t("sidebar.preview.waitingOnTeammate") : queued && !failed ? t("task.queued") : failed ? lastLine(bot, visible, instances, advanced) : placed ? placedLine(bot, advanced) : botPreview(bot, visible, instances, advanced)}</FadeLine>)}</span>)}@@ -863,7 +863,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {!renaming && iconOnly? deleting? t("sidebar.bot.deletingAria", { name: bot.name })- : `${bot.name}${bot.title?.trim() ? ` · ${bot.title.trim()}` : ""}${bot.chiefOfStaff ? ` · ${t("sidebar.bot.chiefOfStaff")}` : ""}${onLiveCall ? ` · ${t("call.live.badge")}` : ""}${waiting ? ` · ${t("sidebar.preview.waiting")}` : working ? ` · ${t("chat.activity.working")}` : failed ? ` · ${t("sidebar.preview.failed")}` : teammateWait ? ` · ${t("sidebar.preview.waitingOnTeammate")}` : queued ? ` · ${t("task.queued")}` : ""}${unread ? ` · ${t("task.unread")}` : ""}`+ : `${bot.name}${bot.title?.trim() ? ` · ${bot.title.trim()}` : ""}${bot.chiefOfStaff ? ` · ${t("sidebar.bot.chiefOfStaff")}` : ""}${onLiveCall ? ` · ${t("call.live.badge")}` : ""}${waiting ? ` · ${t("sidebar.preview.waiting")}` : working ? ` · ${t("chat.activity.working")}` : failed ? ` · ${t("sidebar.preview.failed")}` : teammateWait ? ` · ${t("sidebar.preview.waitingOnTeammate")}` : queued ? ` · ${t("task.queued")}` : ""}${unread ? ` · ${t("task.unread")}` : ""}${placeMark ? ` · ${placeMark.label}` : ""}`: undefined}aria-busy={deleting || undefined} aria-keyshortcuts={drag ? "Alt+ArrowUp Alt+ArrowDown" : undefined}@@ -894,7 +894,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {{!renaming && iconOnly && unread && (<span className={cn("pointer-events-none absolute size-2 rounded-full border border-panel bg-accent", railTile ? "right-1 top-1" : "bottom-1.5 right-1.5")} />)}- {!renaming && !deleting && !iconOnly && <>+ {!renaming && !deleting && !iconOnly && !placed && <>{showThreads && <button type="button" aria-label={t("task.newShort")} title={t("task.newShort")} onClick={() => { setThreadsOpen(true); dispatch({ type: "newTask", botId: bot.id }); }}className="pointer-events-none absolute right-[3.75rem] 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 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-within:pointer-events-auto group-focus-within:opacity-100 max-md:hidden touch:pointer-events-auto touch:opacity-70"><Plus size={16} /></button>}{showThreads && <button type="button" aria-label={t("folder.newNamed", { name: bot.name })} title={t("folder.new")} onClick={() => { setThreadsOpen(true); setCreatingProject(true); }}@@ -902,7 +902,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {<button type="button" data-bot-actions={bot.id} aria-label={t("sidebar.bot.actions", { name: bot.name })} title={t("sidebar.bot.actions", { name: bot.name })} aria-haspopup="menu" onClick={(event) => { const rect = event.currentTarget.getBoundingClientRect(); onMenu({ botId: bot.id, x: rect.left, y: rect.bottom }); }}className={cn("absolute top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded text-ink-secondary hover:bg-raised hover:text-ink", simpleRow ? "end-[3px] top-1.5 size-6 translate-y-0 rounded-lg" : "right-1",selected && !simpleRow ? "pointer-events-auto opacity-100" : "pointer-events-none opacity-0 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")}><MoreHorizontal size={16} /></button>- </>}{!renaming && !deleting && simpleRow && <ThreadFoldChevron bot={bot} dispatch={dispatch} />}+ </>}{!renaming && !deleting && simpleRow && !placed && <ThreadFoldChevron bot={bot} dispatch={dispatch} />}{deleting && iconOnly && (<span className="pointer-events-none absolute bottom-1 right-1 rounded-full bg-card p-1 text-ink-secondary"><Loader2 size={12} className="animate-spin" />@@ -1093,9 +1093,9 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =b.projects?.some((folder) => folder.name.toLowerCase().includes(q)),);const visibleGroups = sideLists.groups.filter((g) => !q || g.name.toLowerCase().includes(q) || g.tasks?.some((task) => task.title.toLowerCase().includes(q)));- const viewerEmail = useViewerEmail();+ const viewerEmail = useViewerEmail(), placed = useOtherPlaceBots(q), placeHere = useOneListHere();const parts = partitionSidebarBots(botDrag.preview(matchingBots), { universalPins, viewerEmail, welcoming: useWelcomingBot(), searching: Boolean(q) });- const saved = simpleDesk ? withPrimaryTile(parts, myDefaultBot(state.bots, viewerEmail)?.id) : { ...parts, primary: null };+ const saved = withOtherPlace(simpleDesk ? withPrimaryTile(parts, myDefaultBot(state.bots, viewerEmail)?.id) : { ...parts, primary: null }, placed);// Shown order only: a drag or Alt+Up/Down moves a bot among the rows as drawn and saves it into the saved order of the// rows left in place; a row Unread lists is in neither.const floats = (bot: Bot) => { const { waiting, working } = sidebarBotStatus(bot, state.pendingQueued); return waiting || working; };@@ -1105,7 +1105,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =const { botChats, sectionedRooms, unsectionedRooms } = partitionSidebarGroups(visibleGroups);const sectionNames = sectionsInUse([...(state.sections ?? []).filter((name) => !q || name.toLowerCase().includes(q.toLowerCase())), ...botDrag.pending], [...filed, ...sectionedRooms]);- const drops = botDrag.arrange({ enabled: (sections.interactive || density === "icons") && !phone, withinList: density === "icons", main: inPlace.unsectionedBots, sectioned: inPlace.sectionedBots, departments: sectionNames, bots: state.bots, taken: departmentNames(state), floats });+ const drops = botDrag.arrange({ enabled: (sections.interactive || density === "icons") && !phone, withinList: density === "icons", main: ownRows(inPlace.unsectionedBots), sectioned: inPlace.sectionedBots, departments: sectionNames, bots: state.bots, taken: departmentNames(state), floats });const naturalSectionIds = [...(pinnedBots.length > 0 && !universalPins && !simpleDesk ? [PINNED_SECTION_ID] : []),...(unsectionedRooms.length > 0 ? [CHANNELS_SECTION_ID] : []),@@ -1123,7 +1123,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =const showAttention = (advanced && inboxSupport === "no") || (attentionPinned && density !== "icons");const attention = showAttention ? crossBotAttentionThreads(state.bots, state.pendingQueued, undefined, state.groups) : [];const pendingBotUndo = teamFeedback?.restoreBot;- const botRow = (bot: Bot) => botRowProps(state, dispatch, bot, { density, query: q, onMenu: setMenu, renameRequest: renameRequest?.botId === bot.id ? renameRequest.nonce : 0, ...drops.row(bot.id) });+ const botRow = (bot: Bot) => isPlacedBot(bot) ? botRowProps(state, otherPlaceDispatch(bot), bot, { density, query: q, onMenu: NO_MENU, placeHere }) : botRowProps(state, dispatch, bot, { density, query: q, onMenu: setMenu, placeHere, renameRequest: renameRequest?.botId === bot.id ? renameRequest.nonce : 0, ...drops.row(bot.id) });const railSearch = () => {if (collapseToIcons) return openCommandPalette();setSearchOpen(true);@@ -1462,7 +1462,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =</div>);})}- <OtherPlaceBots query={query} /><MovedBotRows bots={state.bots} /><MovedToMyCloudRow bots={state.bots} /><SearchResults query={query} onLanded={() => { setQuery(""); setSearchOpen(false); }} />+ <OtherPlaceLine query={query} /><MovedBotRows bots={state.bots} /><MovedToMyCloudRow bots={state.bots} /><SearchResults query={query} onLanded={() => { setQuery(""); setSearchOpen(false); }} />{showPinnedCircleThreads && (<PinnedCircleThreadSectionbots={pinnedBots}diff --git a/src/components/touch-actions.test.ts b/src/components/touch-actions.test.tsindex 98554e42aa..b6213b0c6d 100644--- a/src/components/touch-actions.test.ts+++ b/src/components/touch-actions.test.ts@@ -30,6 +30,7 @@ const notActions: Array<{ file: string; snippet: string; why: string }> = [{ file: "components/SidebarThreadLabels.tsx", snippet: "pointer-events-none absolute end-1 flex size-6", why: "hiding a thread on a touch screen goes through the bot panel's thread list; a ✕ on every sub-row would crowd the sidebar" },{ file: "components/SidebarThreadLabels.tsx", snippet: "group-hover/label:[mask-image", why: "the title fading under the hover ✕; nothing to tap" },{ file: "components/SidebarThreadLabels.tsx", snippet: "transition-opacity duration-[120ms] group-hover/label:opacity-0", why: "the status mark making room for the hover ✕; nothing to tap" },+ { file: "components/BotPlaceMark.tsx", snippet: "text-ink-secondary opacity-0 transition-opacity duration-150", why: "where a bot lives, not a control: on a touch screen it shows only while it says something (working, asleep, can't be reached), since a device icon on every phone row is noise; a screen reader hears it on every row" },{ file: "components/PlacesRail.tsx", snippet: "h-2 opacity-0 group-hover/tile:opacity-100", why: "decorative pill beside a rail tile on hover; the tile is the tap target and has its own focus ring" },];diff --git a/src/lib/place-rows.test.ts b/src/lib/place-rows.test.tsnew file mode 100644index 0000000000..5f93e5484c--- /dev/null+++ b/src/lib/place-rows.test.ts@@ -0,0 +1,131 @@+// @vitest-environment happy-dom+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import type { Bot } from "@/state/store";+import { setLocale } from "./i18n";+import { isPlacedBot, otherPlaceDispatch, ownRows, placedBot, placedLine, placeMark, resetPlaceRowsForTest, withOtherPlace } from "./place-rows";+import type { PlaceBotRow } from "./places-together";+import { partitionSidebarBots, sidebarBotRows } from "./sidebar-layout";++const row = (home: "computer" | "cloud", id: string, over: Partial<PlaceBotRow> = {}): PlaceBotRow => ({ home, id, threadId: `t-${id}`, name: id, color: "blue", ...over });+const own = (id: string, over: Partial<Bot> = {}): Bot => ({ id, name: id, threadId: `${id}-t`, title: "", description: "", color: "green", unread: false,+ notifications: true, messages: [], modelSelection: { instanceId: "here", model: "m" }, ...over });++beforeEach(() => setLocale("en"));+afterEach(() => { resetPlaceRowsForTest(); vi.unstubAllGlobals(); delete (window as { ogb?: unknown }).ogb; });++describe("a row of the other place as a bot of the one list", () => {+ it("is keyed by its place and its id, so the same id in two places is two bots", () => {+ const there = placedBot(row("cloud", "scout"), "ready"), here = own("scout");+ expect(there.id).toBe("cloud:scout");+ expect(there.threadId).toBe("cloud:t-scout");+ expect(placedBot(row("computer", "scout"), "ready").id).toBe("computer:scout");+ expect(new Set([here.id, there.id]).size).toBe(2);+ expect(isPlacedBot(there)).toBe(true);+ expect(isPlacedBot(here)).toBe(false);+ });++ it("carries a name, a look, a state and a time, and nothing of the other place's engine or settings", () => {+ const bot = placedBot(row("cloud", "nova", { name: "Nova", title: "Research", color: "pink", mascotBody: "classic", unread: true, working: true, chief: true, lastAt: 42 }), "asleep");+ expect(bot).toMatchObject({ name: "Nova", title: "Research", color: "pink", unread: true, busy: true, activity: "working", lastAt: 42, messages: [] });+ expect(bot.placedFrom).toEqual({ home: "cloud", id: "nova", health: "asleep" });+ expect(bot.modelSelection).toEqual({ instanceId: "", model: "" });+ // The Chief stays where it started: the other place's is an ordinary row here.+ expect(bot.chiefOfStaff).toBeUndefined();+ expect(placedBot(row("cloud", "w", { waiting: true }), "ready").activity).toBe("waiting-on-you");+ expect(placedBot(row("cloud", "x", { color: "url(javascript:1)" }), "ready").color).toBe("green");+ });++ it("shows its title as its second line in Simple, and nothing in Advanced, whose row shows it as the role", () => {+ const bot = placedBot(row("cloud", "nova", { title: "Research" }), "ready");+ expect(placedLine(bot, false)).toBe("Research");+ expect(placedLine(bot, true)).toBe("");+ });+});++describe("one list: the other place's rows among this place's own", () => {+ const list = (bots: Bot[], placed: Bot[]) => {+ const parts = withOtherPlace(partitionSidebarBots(bots), placed.filter(isPlacedBot));+ return sidebarBotRows(parts, (bot) => Boolean(bot.busy) || bot.activity === "waiting-on-you");+ };++ it("joins the main list after this place's own, and working bots of either place float to the top together", () => {+ const placed = [placedBot(row("cloud", "scout"), "ready"), placedBot(row("cloud", "atlas", { working: true }), "ready")];+ const rows = list([own("chief", { chiefOfStaff: true }), own("git"), own("ledger", { busy: true })], placed);+ expect(rows.unsectionedBots.map((bot) => bot.id)).toEqual(["ledger", "cloud:atlas", "git", "cloud:scout"]);+ });++ it("this place's Chief keeps its place; the other place's Chief is a row, so both are listed", () => {+ const parts = withOtherPlace(partitionSidebarBots([own("chief", { chiefOfStaff: true }), own("git")]), [placedBot(row("cloud", "maus", { chief: true }), "ready")]);+ expect(parts.unsectionedChief?.id).toBe("chief");+ expect(parts.unsectionedBots.map((bot) => bot.id)).toEqual(["git", "cloud:maus"]);+ });++ it("unread rows of both places go into one Unread group, newest first, by each row's own time", () => {+ const placed = [placedBot(row("cloud", "old", { unread: true, lastAt: 100 }), "ready"), placedBot(row("cloud", "new", { unread: true, lastAt: 900 }), "ready"), placedBot(row("cloud", "read"), "ready")];+ const mid = own("mid", { unread: true, messages: [{ id: "m", role: "bot", kind: "text", text: "hi", at: 500 } as Bot["messages"][number]] });+ const rows = list([mid, own("quiet")], placed);+ expect(rows.unreadBots.map((bot) => bot.id)).toEqual(["cloud:new", "mid", "cloud:old"]);+ expect(rows.unreadCount).toBe(3);+ expect(rows.unsectionedBots.map((bot) => bot.id)).toEqual(["quiet", "cloud:read"]);+ });++ it("a drag or Alt+Up/Down arranges and saves this place's own rows only", () => {+ const placed = placedBot(row("cloud", "scout"), "ready");+ const rows = list([own("a"), own("b")], [placed]);+ expect(rows.inPlace.unsectionedBots.map((bot) => bot.id)).toEqual(["a", "b", "cloud:scout"]);+ expect(ownRows(rows.inPlace.unsectionedBots).map((bot) => bot.id)).toEqual(["a", "b"]);+ const plain = [own("a")];+ expect(ownRows(plain)).toBe(plain);+ });++ it("with no rows of the other place, the parts are handed back as they were", () => {+ const parts = partitionSidebarBots([own("a")]);+ expect(withOtherPlace(parts, [])).toBe(parts);+ });+});++describe("what a row of the other place does", () => {+ it("choosing it opens its bot where it lives, by its own id there, once per click; nothing else is sent anywhere", async () => {+ const open = vi.fn(async () => true);+ window.ogb = { placesTogether: { open } } as never;+ const bot = placedBot(row("cloud", "scout"), "ready");+ const send = otherPlaceDispatch(bot);+ expect(otherPlaceDispatch(bot)).toBe(send);+ send({ type: "select", id: bot.id });+ send({ type: "switchTask", botId: bot.id, threadId: bot.threadId });+ expect(open.mock.calls).toEqual([["scout"]]);+ await Promise.resolve();+ send({ type: "updateBot", botId: bot.id, patch: { name: "Renamed" } } as never);+ send({ type: "newTask", botId: bot.id } as never);+ expect(open).toHaveBeenCalledTimes(1);+ send({ type: "select", id: bot.id });+ expect(open.mock.calls).toEqual([["scout"], ["scout"]]);+ });+});++describe("the device mark", () => {+ it("names where the bot lives, on hover and keyboard focus only, while there is nothing more to say", () => {+ expect(placeMark("computer", "ready", false, "Git")).toEqual({ home: "computer", icon: "computer", label: "On this computer", shows: "hover" });+ expect(placeMark("cloud", "ready", false, "Scout")).toEqual({ home: "cloud", icon: "cloud", label: "On My Cloud", shows: "hover" });+ expect(placeMark("cloud", "loading", false, "Scout").shows).toBe("hover");+ });++ it("stays while the bot works, and says where", () => {+ expect(placeMark("cloud", "ready", true, "Scout")).toEqual({ home: "cloud", icon: "cloud", label: "Working on My Cloud now", shows: "always" });+ expect(placeMark("computer", "ready", true, "Git")).toEqual({ home: "computer", icon: "computer", label: "Working on this computer now", shows: "always" });+ });++ it("stays while My Cloud sleeps, wakes or can't be reached, in quiet words, never as an error", () => {+ expect(placeMark("cloud", "asleep", false, "Atlas")).toEqual({ home: "cloud", icon: "cloud-asleep", label: "My Cloud is asleep. Opening Atlas wakes it.", shows: "always" });+ expect(placeMark("cloud", "asleep", true, "Atlas").icon).toBe("cloud-asleep");+ expect(placeMark("cloud", "waking", false, "Atlas")).toEqual({ home: "cloud", icon: "cloud-waking", label: "My Cloud is waking up…", shows: "always" });+ expect(placeMark("cloud", "offline", false, "Scout")).toEqual({ home: "cloud", icon: "cloud-off", label: "My Cloud can't be reached right now. Scout carries on when it's back.", shows: "always" });+ expect(placeMark("computer", "offline", false, "Git")).toEqual({ home: "computer", icon: "computer-off", label: "This computer's bots can't be read right now.", shows: "always" });+ });++ it("speaks the person's language", () => {+ setLocale("pt-br");+ expect(placeMark("cloud", "ready", false, "Scout").label).toBe("No My Cloud");+ expect(placeMark("cloud", "asleep", false, "Atlas").label).toBe("O My Cloud está em repouso. Abrir Atlas o ativa.");+ });+});diff --git a/src/lib/place-rows.ts b/src/lib/place-rows.tsnew file mode 100644index 0000000000..104a321c2b--- /dev/null+++ b/src/lib/place-rows.ts@@ -0,0 +1,191 @@+// One list of bots: with "This computer and My Cloud together" on (electron/places-together.mjs), the other place's bots+// sit among this page's own, in the same list, Unread and order, instead of in a group of their own. A row of the other+// place becomes a Bot-shaped value the sidebar places and draws like any other. Its id is its place's key and its own id+// (`cloud:scout`), so two bots with one id in two places never meet, and nothing that writes to this place's server is+// ever handed one: what such a row sends is either "open it", which main does where the bot lives, or dropped.+import type { Dispatch } from "react";+import { BOT_BODY_IDS, type BotBodyId } from "../../shared/bot-body";+import { MASCOT_FACE_COLORS, mascotBodyColorSchema, mascotMaterialSchema, type MascotFaceColor } from "../../shared/bot-avatar";+import type { Action, Bot } from "@/state/store";+import { t } from "./i18n";+import { MAUS_COLOR_NAMES, type MausColor } from "./mascot";+import { openOtherPlaceBot, placedKey, usePlacesTogetherPart, type BotHome, type PlaceBotRow, type PlacesTogetherState } from "./places-together";++/** How the other place is doing, as main last said. Asleep and waking are normal for a Cloud, never an error. */+export type PlaceHealth = NonNullable<PlacesTogetherState["other"]>["state"];++/** Where a row of the other place comes from: its place, its own id there, and how that place is doing. */+export interface PlacedFrom {+ home: BotHome;+ id: string;+ health: PlaceHealth;+}++export type PlacedBot = Bot & { placedFrom: PlacedFrom; lastAt?: number };++export function isPlacedBot(bot: object): bot is PlacedBot {+ return "placedFrom" in bot;+}++const known = <T extends string>(list: readonly string[], value: string | undefined): T | null => (value !== undefined && list.includes(value) ? value as T : null);++/** A row of the other place as a bot of this list. It carries only what the row does: a name, a look, a state and a+ * time; never a message, an engine or a setting of the other place. */+export function placedBot(row: PlaceBotRow, health: PlaceHealth): PlacedBot {+ return {+ id: placedKey(row.home, row.id), threadId: placedKey(row.home, row.threadId),+ name: row.name, title: row.title ?? "", description: "", notifications: false,+ color: known<MausColor>(MAUS_COLOR_NAMES, row.color) ?? "green",+ mascotBody: known<BotBodyId>(BOT_BODY_IDS, row.mascotBody),+ mascotFaceColor: known<MascotFaceColor>(MASCOT_FACE_COLORS, row.mascotFaceColor),+ mascotBodyColor: mascotBodyColorSchema.safeParse(row.mascotBodyColor).data ?? null,+ mascotMaterial: mascotMaterialSchema.safeParse(row.mascotMaterial).data ?? null,+ unread: row.unread === true,+ ...(row.waiting ? { activity: "waiting-on-you" as const } : row.working ? { busy: true, activity: "working" as const } : {}),+ // No engine of this place: no model badge, and nothing here runs it.+ modelSelection: { instanceId: "", model: "" },+ messages: [],+ placedFrom: { home: row.home, id: row.id, health },+ ...(row.lastAt !== undefined ? { lastAt: row.lastAt } : {}),+ };+}++const sameRow = (a: PlaceBotRow, b: PlaceBotRow): boolean => {+ const keys = Object.keys(a) as Array<keyof PlaceBotRow>;+ return keys.length === Object.keys(b).length && keys.every((key) => a[key] === b[key]);+};++/** Each row's bot is kept while its row and its place's state stay the same, so a row that did not change keeps its+ * value and is not drawn again (BotListItem is memoized on its props). */+let adapted = new Map<string, { row: PlaceBotRow; health: PlaceHealth; bot: PlacedBot }>();+const NONE: readonly PlacedBot[] = Object.freeze([]);+let lastState: PlacesTogetherState | null | undefined;+let lastList: readonly PlacedBot[] = NONE;++function placedList(state: PlacesTogetherState | null): readonly PlacedBot[] {+ if (state === lastState) return lastList;+ lastState = state;+ const other = state?.on ? state.other : null;+ const kept = new Map<string, { row: PlaceBotRow; health: PlaceHealth; bot: PlacedBot }>();+ const next = (other?.bots ?? []).map((row) => {+ const key = placedKey(row.home, row.id), had = adapted.get(key);+ const entry = had && had.health === other!.state && sameRow(had.row, row) ? had : { row, health: other!.state, bot: placedBot(row, other!.state) };+ kept.set(key, entry);+ return entry.bot;+ });+ adapted = kept;+ if (next.length === lastList.length && next.every((bot, index) => bot === lastList[index])) return lastList;+ lastList = next.length ? next : NONE;+ return lastList;+}++/** The other place's bots for the one list, matching the sidebar's search (`query`, already trimmed and lower case).+ * The same empty list while the switch is off, in a browser, and on any other place's page. */+export function useOtherPlaceBots(query: string): readonly PlacedBot[] {+ const all = usePlacesTogetherPart(placedList);+ if (!query || !all.length) return all;+ if (lastSearch.all !== all || lastSearch.query !== query) {+ lastSearch = { all, query, found: all.filter((bot) => bot.name.toLowerCase().includes(query) || bot.title.toLowerCase().includes(query)) };+ }+ return lastSearch.found;+}+/** The last search's rows, kept while the list and the words stay the same (no hook: the sidebar calls this on every draw). */+let lastSearch: { all: readonly PlacedBot[]; query: string; found: readonly PlacedBot[] } = { all: NONE, query: "", found: NONE };++/** The sidebar's parts with the other place's rows after this place's own in the main list: the busy-first order and+ * Unread then take every row the same way. Departments, pins and tiles stay this place's own. */+export function withOtherPlace<T extends { unsectionedBots: Bot[] }>(parts: T, placed: readonly PlacedBot[]): T {+ return placed.length ? { ...parts, unsectionedBots: [...parts.unsectionedBots, ...placed] } : parts;+}++/** This place's own rows only: what a drag or Alt+Up/Down arranges and saves to this place's server. */+export function ownRows<T extends object>(bots: T[]): T[] {+ return bots.some(isPlacedBot) ? bots.filter((bot) => !isPlacedBot(bot)) : bots;+}++const openers = new Map<string, Dispatch<Action>>();++/** What a row of the other place does with what its row would send this place's store: choosing it opens its bot where+ * it lives (main switches the window there, as a row of the old group did), once per click or key; renaming, a new+ * conversation, a folder or anything else is not for this place and is dropped. */+export function otherPlaceDispatch(bot: PlacedBot): Dispatch<Action> {+ const had = openers.get(bot.id);+ if (had) return had;+ const { id } = bot.placedFrom;+ let opening = false;+ const opener: Dispatch<Action> = (action) => {+ if ((action.type !== "select" && action.type !== "switchTask") || opening) return;+ opening = true;+ queueMicrotask(() => { opening = false; });+ openOtherPlaceBot(id);+ };+ openers.set(bot.id, opener);+ return opener;+}++/** A row of the other place opens no menu here. */+export const NO_MENU = (): void => {};++/** The second line of a row of the other place: its title in the Simple sidebar, where no role is shown, and nothing in+ * Advanced, whose row shows the title as its role already. */+export function placedLine(bot: PlacedBot, advanced: boolean): string {+ return advanced ? "" : bot.title;+}++export type PlaceIcon = "computer" | "cloud" | "cloud-asleep" | "cloud-waking" | "cloud-off" | "computer-off";++export interface PlaceMark {+ home: BotHome;+ icon: PlaceIcon;+ /** The tooltip, and what a screen reader says, shown or not. */+ label: string;+ /** "always" while it says something the row does not (working, asleep, waking, can't be reached); "hover" otherwise:+ * shown on hover and keyboard focus. */+ shows: "always" | "hover";+}++/** The device mark for one row. Pure: the row draws it, and the tests read it. A place that is asleep or can't be+ * reached says so on its rows in quiet words, never as an error. */+export function placeMark(home: BotHome, health: PlaceHealth, working: boolean, name: string): PlaceMark {+ if (home === "cloud" && health === "asleep") return { home, icon: "cloud-asleep", label: t("together.mark.asleep", { name }), shows: "always" };+ if (home === "cloud" && health === "waking") return { home, icon: "cloud-waking", label: t("together.state.waking"), shows: "always" };+ if (health === "offline") return home === "cloud"+ ? { home, icon: "cloud-off", label: t("together.mark.offlineCloud", { name }), shows: "always" }+ : { home, icon: "computer-off", label: t("together.state.offlineComputer"), shows: "always" };+ if (working) return { home, icon: home, label: t(home === "cloud" ? "together.mark.workingCloud" : "together.mark.workingComputer"), shows: "always" };+ return { home, icon: home, label: t(home === "cloud" ? "together.onCloud" : "together.onComputer"), shows: "hover" };+}++/** This page's place while the one list is on; null while it is off, in a browser, and on any other place's page. */+const hereOf = (state: PlacesTogetherState | null): BotHome | null => (state?.on && state.other ? state.here : null);++/** The mark a row draws, given this page's place while the one list is on (`here`, from useOneListHere once for the+ * whole list); none with it off. A row of this place lives here, and here is awake. */+export function rowPlaceMark(bot: Bot, working: boolean, here: BotHome | null | undefined): PlaceMark | null {+ if (!here) return null;+ const from = isPlacedBot(bot) ? bot.placedFrom : null;+ return from ? placeMark(from.home, from.health, working, bot.name) : placeMark(here, "ready", working, bot.name);+}++/** This page's place while the one list is on, for the rows' marks; null while it is off. */+export function useOneListHere(): BotHome | null {+ return usePlacesTogetherPart(hereOf);+}++/** The one list is on: this page's own rows and the other place's share the list. */+export function useOneList(): boolean {+ return usePlacesTogetherPart(hereOf) !== null;+}++/** On, and this computer and My Cloud are the person's only places: no place pill (main draws no rail either). */+export function useOnlyPair(): boolean {+ return usePlacesTogetherPart((state) => state?.on === true && state.other !== null && state.onlyPair === true);+}++export function resetPlaceRowsForTest(): void {+ adapted = new Map();+ lastState = undefined;+ lastList = NONE;+ lastSearch = { all: NONE, query: "", found: NONE };+ openers.clear();+}diff --git a/src/lib/places-together.ts b/src/lib/places-together.tsindex a89c4d847d..9a072dd456 100644--- a/src/lib/places-together.ts+++ b/src/lib/places-together.ts@@ -27,8 +27,8 @@ function subscribe(listener: () => void): () => void {return () => { listeners.delete(listener); };}-/** What main says about the two places: null in a browser, on another place's page, and until main first answers. */-export function usePlacesTogether(): PlacesTogetherState | null {+/** Main is asked while any component that draws its answer is on screen, and told again on focus. */+function useWatchTogether(): void {useEffect(() => {const page = bridge();if (!page) return;@@ -44,9 +44,22 @@ export function usePlacesTogether(): PlacesTogetherState | null {window.removeEventListener("focus", read);};}, []);+}++/** What main says about the two places: null in a browser, on another place's page, and until main first answers. */+export function usePlacesTogether(): PlacesTogetherState | null {+ useWatchTogether();return useSyncExternalStore(subscribe, () => known, () => null);}+/** One part of what main says, for a component that draws only that part: it draws again only when that part changes,+ * not on every answer main gives (one each time the window is focused). `select` returns the same value for the same+ * answer: a string or number, or a value it keeps. */+export function usePlacesTogetherPart<T>(select: (state: PlacesTogetherState | null) => T): T {+ useWatchTogether();+ return useSyncExternalStore(subscribe, () => select(known), () => select(null));+}+/** Turns the switch, and says what main kept. */export async function setPlacesTogether(on: boolean): Promise<void> {const page = bridge();diff --git a/src/lib/sidebar-layout.ts b/src/lib/sidebar-layout.tsindex e585589217..95e9ad680d 100644--- a/src/lib/sidebar-layout.ts+++ b/src/lib/sidebar-layout.ts@@ -165,6 +165,8 @@ type UnreadListBot = {unread?: boolean;tasks?: ReadonlyArray<{ unread?: boolean; routineRunId?: string; archivedAt?: number; updatedAt?: number; createdAt?: number }> | null;messages?: ReadonlyArray<{ at: number }>;+ /** A row of the other place in the one list (place-rows.ts): when its conversations last moved there. */+ lastAt?: number;};/** The bot kept in Unread after it was opened from there, with the time it was listed by and the conversation open then. */@@ -172,7 +174,7 @@ export type UnreadHold = { id: string; since: number; chat?: string };function unreadSince(bot: UnreadListBot): number {const threads = (bot.tasks ?? []).filter((task) => task.unread && !task.routineRunId && task.archivedAt === undefined);- if (threads.length === 0) return bot.messages?.at(-1)?.at ?? 0;+ if (threads.length === 0) return bot.messages?.at(-1)?.at ?? bot.lastAt ?? 0;return Math.max(...threads.map((task) => task.updatedAt ?? task.createdAt ?? 0));}diff --git a/src/locales/de.json b/src/locales/de.jsonindex 36e1e83b97..38ffee8558 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -4185,6 +4185,11 @@"together.switch.title": "Dieser Computer und Meine Cloud zusammen","together.switch.line": "Standardmäßig aus. Die Bots der Cloud und die Bots dieses Computers stehen in einer Liste, und jeder öffnet sich dort, wo er läuft.","together.switch.failed": "Das konnte nicht gespeichert werden. Versuch es noch einmal.",+ "together.mark.workingCloud": "Arbeitet gerade in Meiner Cloud",+ "together.mark.workingComputer": "Arbeitet gerade auf diesem Computer",+ "together.mark.asleep": "Meine Cloud schläft. Wenn du {name} öffnest, wird sie geweckt.",+ "together.mark.offlineCloud": "Meine Cloud ist gerade nicht erreichbar. {name} macht weiter, sobald sie wieder da ist.",+ "together.line.asleep": "Meine Cloud schläft. Öffne sie, um ihre Bots zu sehen.","server.rooms.linkedAway": "{bot} läuft auf {place}, das gerade aus ist oder schläft. Die Antwort kommt hier, sobald {place} wieder da ist.","server.rooms.linkedGone": "{bot} läuft auf {place}. Die Verbindung zu {place} ist gerade aus; eine Antwort kommt hier erst, wenn sie zurück ist.","server.rooms.linkedNotSent": "{bot} konnte auf {place} nicht an die Reihe kommen. Erwähne {bot} noch einmal, um es erneut zu versuchen.",diff --git a/src/locales/en.json b/src/locales/en.jsonindex c8d262ed73..7915cad6a3 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -11430,6 +11430,11 @@"together.switch.title": "This computer and My Cloud together","together.switch.line": "Off by default. The Cloud's bots and this computer's bots show in one list, and each opens where it lives.","together.switch.failed": "That couldn't be saved. Try again.",+ "together.mark.workingCloud": "Working on My Cloud now",+ "together.mark.workingComputer": "Working on this computer now",+ "together.mark.asleep": "My Cloud is asleep. Opening {name} wakes it.",+ "together.mark.offlineCloud": "My Cloud can't be reached right now. {name} carries on when it's back.",+ "together.line.asleep": "My Cloud is asleep. Open it to see its bots.","together.state.signin": "Open My Cloud once to sign in.","sidebar.newBotOn.computer": "New bot on this computer","sidebar.newBotOn.cloud": "New bot on My Cloud",diff --git a/src/locales/es.json b/src/locales/es.jsonindex d3c62ca6c8..d7b514ad36 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -6516,6 +6516,11 @@"together.switch.title": "Este equipo y My Cloud juntos","together.switch.line": "Desactivado de forma predeterminada. Los bots del Cloud y los de este equipo aparecen en una sola lista, y cada uno se abre donde está.","together.switch.failed": "No se pudo guardar. Inténtalo de nuevo.",+ "together.mark.workingCloud": "Trabajando ahora en My Cloud",+ "together.mark.workingComputer": "Trabajando ahora en este equipo",+ "together.mark.asleep": "My Cloud está en reposo. Al abrir {name} se despierta.",+ "together.mark.offlineCloud": "No se puede acceder a My Cloud ahora mismo. {name} seguirá cuando vuelva.",+ "together.line.asleep": "My Cloud está en reposo. Ábrelo para ver sus bots.","imageGen.complexity.label": "Nivel de detalle","imageGen.complexity.help": "Cuánto detalle tienen las imágenes de GPT-Image-2.6. Más bajo es más simple y rápido.","imageGen.complexity.low": "Bajo",diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex 5d060b173f..ee60e35888 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -3921,6 +3921,11 @@"together.switch.title": "Cet ordinateur et Mon Cloud ensemble","together.switch.line": "Désactivé par défaut. Les bots du Cloud et ceux de cet ordinateur s'affichent dans une seule liste, et chacun s'ouvre là où il se trouve.","together.switch.failed": "Impossible d'enregistrer. Réessayez.",+ "together.mark.workingCloud": "Travaille sur Mon Cloud en ce moment",+ "together.mark.workingComputer": "Travaille sur cet ordinateur en ce moment",+ "together.mark.asleep": "Mon Cloud est en veille. Ouvrir {name} le réveille.",+ "together.mark.offlineCloud": "Mon Cloud est injoignable pour le moment. {name} reprendra dès son retour.",+ "together.line.asleep": "Mon Cloud est en veille. Ouvrez-le pour voir ses bots.","imageGen.complexity.label": "Niveau de détail","imageGen.complexity.help": "Le niveau de détail des images GPT-Image-2.6. Plus bas, c'est plus simple et plus rapide.","imageGen.complexity.low": "Faible",diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex f47297a2c5..8fbfc1fcd5 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -3773,6 +3773,11 @@"together.switch.title": "यही कंप्यूटर और मेरा क्लाउड एक साथ","together.switch.line": "डिफ़ॉल्ट रूप से बंद। क्लाउड के बॉट और इस कंप्यूटर के बॉट एक ही सूची में दिखते हैं, और हर बॉट वहीं खुलता है जहाँ वह है।","together.switch.failed": "इसे सहेजा नहीं जा सका। फिर से कोशिश करें।",+ "together.mark.workingCloud": "अभी मेरे क्लाउड पर काम कर रहा है",+ "together.mark.workingComputer": "अभी इस कंप्यूटर पर काम कर रहा है",+ "together.mark.asleep": "मेरा क्लाउड सो रहा है। {name} खोलने पर यह जाग जाएगा।",+ "together.mark.offlineCloud": "मेरे क्लाउड तक अभी पहुँचा नहीं जा सकता। इसके वापस आने पर {name} काम जारी रखेगा।",+ "together.line.asleep": "मेरा क्लाउड सो रहा है। इसके बॉट देखने के लिए इसे खोलें।","imageGen.complexity.label": "विवरण स्तर","imageGen.complexity.help": "GPT-Image-2.6 की छवियाँ कितनी विस्तृत हों। कम का मतलब सरल और तेज़।","imageGen.complexity.low": "कम",diff --git a/src/locales/it.json b/src/locales/it.jsonindex 6cee113ae2..059fe90ff4 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -11389,6 +11389,11 @@"together.switch.title": "Questo computer e Il mio Cloud insieme","together.switch.line": "Disattivato per impostazione predefinita. I bot del Cloud e quelli di questo computer compaiono in un unico elenco, e ognuno si apre dove si trova.","together.switch.failed": "Non è stato possibile salvare. Riprova.",+ "together.mark.workingCloud": "Al lavoro sul mio Cloud ora",+ "together.mark.workingComputer": "Al lavoro su questo computer ora",+ "together.mark.asleep": "Il mio Cloud è in sospensione. Aprire {name} lo riattiva.",+ "together.mark.offlineCloud": "Il mio Cloud non è raggiungibile al momento. {name} riprende quando torna disponibile.",+ "together.line.asleep": "Il mio Cloud è in sospensione. Aprilo per vedere i suoi bot.","together.state.signin": "Aprire il mio cloud una volta per accedere.","sidebar.newBotOn.computer": "Nuovo bot su questo computer","sidebar.newBotOn.cloud": "Nuovo bot su My Cloud",diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex 775e99677f..370e94f93f 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -8054,6 +8054,11 @@"together.switch.title": "このコンピューターと My Cloud をまとめる","together.switch.line": "既定ではオフです。Cloud のボットとこのコンピューターのボットを 1 つの一覧に表示し、それぞれがある場所で開きます。","together.switch.failed": "保存できませんでした。もう一度お試しください。",+ "together.mark.workingCloud": "現在 My Cloud で作業中",+ "together.mark.workingComputer": "現在このコンピューターで作業中",+ "together.mark.asleep": "My Cloud はスリープ中です。{name} を開くと起動します。",+ "together.mark.offlineCloud": "現在 My Cloud に接続できません。復帰すると {name} は作業を続けます。",+ "together.line.asleep": "My Cloud はスリープ中です。開くとボットが表示されます。","imageGen.complexity.label": "詳細レベル","imageGen.complexity.help": "GPT-Image-2.6 の画像の詳細さ。低いほどシンプルで高速です。","imageGen.complexity.low": "低",diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex 60114547cb..26caac0049 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -7744,6 +7744,11 @@"together.switch.title": "이 컴퓨터와 내 클라우드 함께 보기","together.switch.line": "기본값은 꺼짐입니다. 클라우드의 봇과 이 컴퓨터의 봇이 하나의 목록에 표시되며, 각 봇은 자기가 있는 곳에서 열립니다.","together.switch.failed": "저장하지 못했습니다. 다시 시도하세요.",+ "together.mark.workingCloud": "지금 내 클라우드에서 작업 중",+ "together.mark.workingComputer": "지금 이 컴퓨터에서 작업 중",+ "together.mark.asleep": "내 클라우드가 절전 중입니다. {name}을(를) 열면 깨어납니다.",+ "together.mark.offlineCloud": "지금은 내 클라우드에 연결할 수 없습니다. 다시 연결되면 {name}이(가) 이어서 작업합니다.",+ "together.line.asleep": "내 클라우드가 절전 중입니다. 열면 봇을 볼 수 있습니다.","imageGen.complexity.label": "세부 수준","imageGen.complexity.help": "GPT-Image-2.6 이미지의 세부 정도입니다. 낮을수록 단순하고 빠릅니다.","imageGen.complexity.low": "낮음",diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex 8349676c85..c58abf1fc6 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -7215,6 +7215,11 @@"together.switch.title": "Ten komputer i My Cloud razem","together.switch.line": "Domyślnie wyłączone. Boty z Cloud i boty z tego komputera są na jednej liście, a każdy otwiera się tam, gdzie działa.","together.switch.failed": "Nie udało się zapisać. Spróbuj ponownie.",+ "together.mark.workingCloud": "Pracuje teraz w My Cloud",+ "together.mark.workingComputer": "Pracuje teraz na tym komputerze",+ "together.mark.asleep": "My Cloud śpi. Otwarcie {name} go wybudzi.",+ "together.mark.offlineCloud": "My Cloud jest teraz nieosiągalny. {name} będzie kontynuować, gdy wróci.",+ "together.line.asleep": "My Cloud śpi. Otwórz go, aby zobaczyć jego boty.","imageGen.complexity.label": "Poziom szczegółowości","imageGen.complexity.help": "Jak szczegółowe są obrazy GPT-Image-2.6. Niższy poziom jest prostszy i szybszy.","imageGen.complexity.low": "Niski",diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex e8df74fa65..064cb40a1c 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -11394,6 +11394,11 @@"together.switch.title": "Este computador e o My Cloud juntos","together.switch.line": "Desativado por padrão. Os bots do Cloud e os deste computador aparecem em uma só lista, e cada um abre onde está.","together.switch.failed": "Não foi possível salvar. Tente de novo.",+ "together.mark.workingCloud": "Trabalhando no My Cloud agora",+ "together.mark.workingComputer": "Trabalhando neste computador agora",+ "together.mark.asleep": "O My Cloud está em repouso. Abrir {name} o ativa.",+ "together.mark.offlineCloud": "Não é possível acessar o My Cloud agora. {name} continua quando ele voltar.",+ "together.line.asleep": "O My Cloud está em repouso. Abra-o para ver os bots dele.","together.state.signin": "Abra o My Cloud uma vez para entrar.","sidebar.newBotOn.computer": "Novo bot neste computador","sidebar.newBotOn.cloud": "Novo bot no My Cloud",diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex b83c89c439..54940073c6 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -7269,6 +7269,11 @@"together.switch.title": "Этот компьютер и Моё облако вместе","together.switch.line": "По умолчанию выключено. Боты из облака и боты этого компьютера показаны в одном списке, и каждый открывается там, где он находится.","together.switch.failed": "Не удалось сохранить. Попробуйте ещё раз.",+ "together.mark.workingCloud": "Сейчас работает в Моём облаке",+ "together.mark.workingComputer": "Сейчас работает на этом компьютере",+ "together.mark.asleep": "Моё облако спит. Если открыть {name}, оно проснётся.",+ "together.mark.offlineCloud": "Моё облако сейчас недоступно. {name} продолжит, когда оно вернётся.",+ "together.line.asleep": "Моё облако спит. Откройте его, чтобы увидеть его ботов.","imageGen.complexity.label": "Уровень детализации","imageGen.complexity.help": "Насколько детализированы изображения GPT-Image-2.6. Ниже — проще и быстрее.","imageGen.complexity.low": "Низкий",diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex 27f7231e06..637db3ca7b 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -6011,6 +6011,11 @@"together.switch.title": "Bu bilgisayar ve Cloud'um birlikte","together.switch.line": "Varsayılan olarak kapalı. Cloud'daki botlar ile bu bilgisayardaki botlar tek listede görünür ve her biri bulunduğu yerde açılır.","together.switch.failed": "Kaydedilemedi. Yeniden deneyin.",+ "together.mark.workingCloud": "Şu anda Cloud'umda çalışıyor",+ "together.mark.workingComputer": "Şu anda bu bilgisayarda çalışıyor",+ "together.mark.asleep": "Cloud'um uykuda. {name} açıldığında uyanır.",+ "together.mark.offlineCloud": "Cloud'uma şu anda ulaşılamıyor. {name} geri geldiğinde devam eder.",+ "together.line.asleep": "Cloud'um uykuda. Botlarını görmek için açın.","imageGen.complexity.label": "Ayrıntı düzeyi","imageGen.complexity.help": "GPT-Image-2.6 görsellerinin ne kadar ayrıntılı olacağı. Düşük daha basit ve daha hızlıdır.","imageGen.complexity.low": "Düşük",diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex b054fdd2c4..8313e8a969 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -4193,6 +4193,11 @@"together.switch.title": "Цей комп'ютер і Моя хмара разом","together.switch.line": "Типово вимкнено. Боти з хмари й боти цього комп'ютера показані в одному списку, і кожен відкривається там, де він є.","together.switch.failed": "Не вдалося зберегти. Спробуйте ще раз.",+ "together.mark.workingCloud": "Зараз працює в Моїй хмарі",+ "together.mark.workingComputer": "Зараз працює на цьому комп'ютері",+ "together.mark.asleep": "Моя хмара спить. Відкрийте {name}, і вона прокинеться.",+ "together.mark.offlineCloud": "Моя хмара зараз недоступна. {name} продовжить, щойно вона повернеться.",+ "together.line.asleep": "Моя хмара спить. Відкрийте її, щоб побачити її ботів.","imageGen.complexity.label": "Рівень деталізації","imageGen.complexity.help": "Наскільки детальними є зображення GPT-Image-2.6. Нижчий рівень простіший і швидший.","imageGen.complexity.low": "Низький",diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex fabb59ac7c..5373a70b1d 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -6011,6 +6011,11 @@"together.switch.title": "Máy tính này và My Cloud cùng nhau","together.switch.line": "Mặc định là tắt. Bot trên Cloud và bot trên máy tính này hiện trong một danh sách, và mỗi bot mở ở nơi nó đang ở.","together.switch.failed": "Không lưu được. Hãy thử lại.",+ "together.mark.workingCloud": "Đang làm việc trên My Cloud",+ "together.mark.workingComputer": "Đang làm việc trên máy tính này",+ "together.mark.asleep": "My Cloud đang ngủ. Mở {name} sẽ đánh thức nó.",+ "together.mark.offlineCloud": "Hiện không kết nối được với My Cloud. {name} sẽ tiếp tục khi nó trở lại.",+ "together.line.asleep": "My Cloud đang ngủ. Mở nó để xem các bot của nó.","imageGen.complexity.label": "Mức chi tiết","imageGen.complexity.help": "Mức độ chi tiết của ảnh GPT-Image-2.6. Thấp hơn thì đơn giản và nhanh hơn.","imageGen.complexity.low": "Thấp",diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex b1bc78a571..fce2e64c55 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -10334,6 +10334,11 @@"together.switch.title": "這台電腦和 My Cloud 合在一起","together.switch.line": "預設為關閉。Cloud 上的機器人和這台電腦上的機器人顯示在同一個清單中,各自在所在的位置開啟。","together.switch.failed": "無法儲存。請再試一次。",+ "together.mark.workingCloud": "正在 My Cloud 上工作",+ "together.mark.workingComputer": "正在這台電腦上工作",+ "together.mark.asleep": "My Cloud 正在休眠。開啟 {name} 會喚醒它。",+ "together.mark.offlineCloud": "目前無法連線到 My Cloud。它恢復後 {name} 會繼續。",+ "together.line.asleep": "My Cloud 正在休眠。開啟它即可查看其中的機器人。","imageGen.complexity.label": "細節等級","imageGen.complexity.help": "GPT-Image-2.6 圖片的細節程度。越低越簡單、越快。","imageGen.complexity.low": "低",diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex df44ce9bab..956f2ca1bf 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -10218,6 +10218,11 @@"together.switch.title": "这台电脑和 My Cloud 合在一起","together.switch.line": "默认关闭。Cloud 上的机器人和这台电脑上的机器人显示在同一个列表中,各自在所在的位置打开。","together.switch.failed": "未能保存。请重试。",+ "together.mark.workingCloud": "正在 My Cloud 上工作",+ "together.mark.workingComputer": "正在这台电脑上工作",+ "together.mark.asleep": "My Cloud 正在休眠。打开 {name} 会唤醒它。",+ "together.mark.offlineCloud": "暂时无法连接 My Cloud。它恢复后 {name} 会继续。",+ "together.line.asleep": "My Cloud 正在休眠。打开它即可查看其中的机器人。","together.state.signin": "打开一次 My Cloud 以登录。","sidebar.newBotOn.computer": "在这台电脑上新建机器人","sidebar.newBotOn.cloud": "在 My Cloud 上新建机器人",