Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Sidebar: this computer's bots and My Cloud's in one list (early, off by default) (#6093)
Milind Soni779d05dfa43c
diff --git a/electron/desktop-notifications.node-test.mjs b/electron/desktop-notifications.node-test.mjsindex 02380a52ee..8e2ec413e7 100644--- a/electron/desktop-notifications.node-test.mjs+++ b/electron/desktop-notifications.node-test.mjs@@ -140,6 +140,24 @@ test("one banner per tag, as a page's tag does; the one replaced no longer opensassert.equal(w.log.at(-1), "open scout/newer-thread");});+test("the same bot and thread id in two places are two banners, and each click opens its own place", async () => {+ const w = world({ shown: COMPUTER });+ await w.show();+ w.at.shown = CLOUD;+ w.webContents.mainFrame.url = `${CLOUD}/`;+ await w.show();+ assert.deepEqual(w.banners.map((banner) => banner.closed), [false, false], "one place's banner never replaces the other's");+ w.log.length = 0;+ w.banners[0].emit("click");+ assert.deepEqual(w.log, ["reveal", `place ${COMPUTER}`]);+ w.at.shown = COMPUTER;+ w.arrived();+ assert.deepEqual(w.log.slice(2), ["open scout/work-thread"]);+ w.log.length = 0;+ w.banners[1].emit("click");+ assert.deepEqual(w.log, ["reveal", `place ${CLOUD}`]);+});+test("a bot's picture comes only from the page's own origin, and a failed one still shows the banner", async () => {const w = world({ picture: async (url) => { if (url.includes("broken")) throw new Error("nope"); return url.includes("missing") ? null : "png-bytes"; } });await w.show({ ...NOTE, picture: "/api/attachments/face.png" });diff --git a/electron/main.mjs b/electron/main.mjsindex 3667db3793..6c70770ca3 100644--- a/electron/main.mjs+++ b/electron/main.mjs@@ -107,9 +107,9 @@ import { createCloudEntry } from "./cloud-entry.mjs"; import { installTeamJoin }import { createLendingTarget } from "./lending-target.mjs"; import { createOpenAtLogin, installOpenAtLogin } from "./open-at-login.mjs";import { cleanWorkspaceDir, createCleanWorkspace, profilesDir } from "./clean-workspace.mjs"; import { createLocalProfiles, createProfileRegistry } from "./local-profiles.mjs"; import { createPlaceSwitch } from "./place-switch.mjs"; import { installOneHome } from "./one-home-main.mjs"; import { handSaved, installOwnHome } from "./own-home-main.mjs"; import { reopenSavedServer, serverOpens } from "./saved-server.mjs"; import { installTwoPlacesMain } from "./two-places-main.mjs";import { askForMicrophone, openPrivacySettings } from "./privacy-settings.mjs";-import { createHomeWindow, installHomeWindowIpc } from "./home-window.mjs";+import { createHomeWindow, installHomeWindowIpc, HOME_SCREEN_PATH } from "./home-window.mjs";import { createTeamProfileSeeds } from "./team-profile-seed.mjs";-import { createHomePlaces } from "./home-places.mjs"; import { openStartPlace } from "./start-place.mjs"; import { createDesktopRing, installAccounts } from "./accounts-main.mjs"; import { createAddedCloudNotice, installCloudRail, railPlaces } from "./cloud-rail.mjs"; import { createPlaceInboxWatch } from "./place-inbox-watch.mjs"; import { homeLook, otherOwnClouds, withoutOldCloudHome } from "./cloud-list.mjs"; import { installPlaceLook } from "./place-look.mjs"; import { CHROME_RAIL_PATH, createChromeRail } from "./chrome-rail.mjs"; import { openComputerSettings } from "./open-computer-settings.mjs";+import { createHomePlaces } from "./home-places.mjs"; import { openStartPlace } from "./start-place.mjs"; import { createDesktopRing, installAccounts } from "./accounts-main.mjs"; import { createAddedCloudNotice, installCloudRail, railPlaces } from "./cloud-rail.mjs"; import { createPlaceInboxWatch } from "./place-inbox-watch.mjs"; import { homeLook, otherOwnClouds, withoutOldCloudHome } from "./cloud-list.mjs"; import { installPlaceLook } from "./place-look.mjs"; import { CHROME_RAIL_PATH, createChromeRail } from "./chrome-rail.mjs"; import { openComputerSettings } from "./open-computer-settings.mjs"; import { createPlacesTogether, installPlacesTogether, PLACES_TOGETHER_FILE } from "./places-together.mjs";import { createWindowStateFile } from "./window-state-file.mjs";import { createEnvironmentsFile, ENVIRONMENTS_SAVE_FAILED } from "./environments-file.mjs";import { createOrgLibrary } from "./org-library.mjs";@@ -806,7 +806,7 @@ function ensureCloudAccount() {cloudSync.accountChanged(state.account?.id ?? null); rememberCloudHome(state);rememberedHome = rememberedCloudHome(rememberedHome, state);sendUpdaterState();- cloudPower.changed(); computerSharing?.cloudChanged(); try { void oneHome.kick(); void homeWindow.changed(); announceAddedCloud(state); railChanged(); } catch {}+ cloudPower.changed(); computerSharing?.cloudChanged(); try { placesTogether.scopeChanged(); } catch {} try { void oneHome.kick(); void homeWindow.changed(); announceAddedCloud(state); railChanged(); } catch {}void includedX.onState(state); void includedPages.onState(state); updatesConsent?.accountChanged(state); accounts.tell();refreshCloudMenus();announceCloudReady(state);@@ -2063,11 +2063,11 @@ function createWindow({ deferNavigation = false } = {}) {});void workspaceMenuAction(() => switchEnvironment(LOCAL_ID));});- win.webContents.on("did-navigate", (_event, url) => homeWindow.navigated(url));+ win.webContents.on("did-navigate", (_event, url) => { homeWindow.navigated(url); placesTogether.navigated(homeOfUrl(url)); });// Not did-finish-load: Electron still reports the main frame as loading then.win.webContents.on("did-stop-loading", () => {deliverPackageInstall(win);- deliverChatLink(win); desktopNotifications.arrived();+ deliverChatLink(win); desktopNotifications.arrived(); placesTogether.arrived();});win.webContents.on("did-finish-load", () => void serverLending.offer(win));@@ -2622,7 +2622,7 @@ 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 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 null; } return at.origin === rendererOrigin() ? (at.pathname === HOME_SCREEN_PATH ? null : "computer") : at.origin === myCloud() ? "cloud" : null; }; const shownHome = () => { const page = mainWindow && !mainWindow.isDestroyed() ? mainWindow.webContents : null; return page && !page.isLoadingMainFrame() ? homeOfUrl(page.getURL()) : 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(), shown: shownHome, 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: () => { 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 }); };// 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),@@ -3109,7 +3109,7 @@ app.on("before-quit", (e) => {companyBackupSchedule?.close();orgLibrary?.close();managedDesktop?.close();- accountRing.close(); cloudAccount?.close(); oneHome.close(); ownHome?.close(); twoPlaces?.close(); homeWindow.close();+ accountRing.close(); cloudAccount?.close(); oneHome.close(); ownHome?.close(); twoPlaces?.close(); homeWindow.close(); placesTogether.close();companyBackupController?.abort();computerSharing?.close();cloudSync.close();diff --git a/electron/places-together.d.mts b/electron/places-together.d.mtsnew file mode 100644index 0000000000..b0cbbf5980--- /dev/null+++ b/electron/places-together.d.mts@@ -0,0 +1,43 @@+/** Where a bot lives: this computer, or the person's My Cloud. */+export type BotHome = "computer" | "cloud";++/** A bot of the other place, as the sidebar draws it. */+export interface PlaceBotRow {+ home: BotHome;+ id: string;+ threadId: string;+ name: string;+ title?: string;+ color?: string;+ mascotBody?: string;+ mascotFaceColor?: string;+ chief?: true;+ waiting?: true;+ working?: true;+ unread?: true;+}++export interface PlacesTogetherState {+ v: 1;+ /** The person has a My Cloud and this computer is a place of its own: the switch is offered. */+ available: boolean;+ on: boolean;+ /** The place whose page asked. */+ here: BotHome;+ /** 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[] } | null;+}++/** `window.ogb.placesTogether`: this computer's page and My Cloud's own page. */+export interface PlacesTogetherBridge {+ state(): Promise<PlacesTogetherState>;+ /** Turning it on is this computer's page's alone; main refuses it from My Cloud's page. */+ set(on: boolean): Promise<PlacesTogetherState>;+ /** Opens the other place at one of its listed bots. False when main does not list that bot. */+ open(botId: string): Promise<boolean>;+ onChanged(callback: () => void): () => void;+}++export const PLACES_TOGETHER_FILE: string;+export function otherHome(asking: "local" | "cloud" | BotHome): BotHome;diff --git a/electron/places-together.mjs b/electron/places-together.mjsnew file mode 100644index 0000000000..f38c8b6026--- /dev/null+++ b/electron/places-together.mjs@@ -0,0 +1,301 @@+// "This computer and My Cloud together" (Settings → MausBot Cloud, an early feature that starts off): the sidebar of this+// computer's page and of My Cloud's page lists the other one's bots too. A page can only talk to its own place, so main+// reads the other place's bots as the signed-in person, keeps the list, and opens that place at a bot when its row is+// clicked. With the switch off nothing here reads, keeps or sends anything.+//+// Security: the list goes only to this computer's own page and to My Cloud's own page (`asking`, which main works out from+// the sender), never to a team's Cloud or a server saved by hand. A row is a name, a look and a state: no message, address+// or token. A page names a bot by an id main listed itself; main opens only such an id, in a place of its own choosing.+// A sleeping Cloud is never asked, since any request would wake it; it keeps the list it gave last.+import { asleepAnswer, BACKGROUND_HEADERS } from "./cloud-power.mjs";++/** The switch, kept in `places-together.json` as `{ v: 1, on }`. Everything that joins the two places reads this one key. */+export const PLACES_TOGETHER_FILE = "places-together.json";+/** How often the list on screen is looked at again. This computer answers each time; My Cloud at most every CLOUD_EVERY_MS. */+export const LOOK_EVERY_MS = 20_000;+/** This computer's bots are read again for a page that asks once they are older than this. */+export const FRESH_MS = 4_000;+/** My Cloud is asked at most this often, and only while the window is the one the person is using. */+export const CLOUD_EVERY_MS = 60_000;+/** A row's click waits this long for its place to open (a Cloud may have to wake), and no longer. */+export const OPEN_WAIT_MS = 2 * 60_000;+const TIMEOUT_MS = 10_000;+const MAX_BOTS = 500;+const ID = /^[\w-]{1,128}$/;+const COLOR = /^[\w#(),.% -]{1,64}$/;++const record = (value) => value !== null && typeof value === "object" && !Array.isArray(value);+const text = (value, limit) => (typeof value === "string" ? value.trim().slice(0, limit) : "");+const look = (value) => (typeof value === "string" && COLOR.test(value) ? value : null);++/** The other side of a page: This computer's page lists My Cloud's bots, My Cloud's page this computer's. */+export const otherHome = (asking) => (asking === "cloud" ? "computer" : "cloud");++/** Whether the switch is on, read back from its file. */+export function parseTogether(value) {+ return record(value) && value.v === 1 && value.on === true;+}++function rowState(bot) {+ const tasks = Array.isArray(bot.tasks) ? bot.tasks.filter((task) => record(task) && !task.routineRunId && task.archivedAt === undefined) : [];+ 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 } : {}) };+}++/** 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+ * from the sidebar, or only the pointer a move left behind, has no row. */+export function botRow(bot, home) {+ if (!record(bot) || !ID.test(String(bot.id)) || !ID.test(String(bot.threadId)) || bot.hidden || bot.sidebarHidden || bot.movedTo) return null;+ const name = text(bot.name, 80);+ if (!name) return null;+ const title = text(bot.title, 80), color = look(bot.color), body = look(bot.mascotBody), face = look(bot.mascotFaceColor);+ return { home, id: bot.id, threadId: bot.threadId, name, ...(title ? { title } : {}), ...(color ? { color } : {}),+ ...(body ? { mascotBody: body } : {}), ...(face ? { mascotFaceColor: face } : {}), ...(bot.chiefOfStaff === true ? { chief: true } : {}), ...rowState(bot) };+}++/** A place's `GET /api/bots` answer as rows, in that place's own order. */+export function botRows(body, home) {+ const bots = record(body) && Array.isArray(body.bots) ? body.bots : [];+ return bots.map((bot) => botRow(bot, home)).filter(Boolean).slice(0, MAX_BOTS);+}++/** My Cloud answered that this session may not read it: nobody signed this window in there yet, or the sign-in ended. */+const needsSignIn = (response) => response?.status === 401 || response?.status === 403;++/**+ * @param {{+ * pref: { read(): unknown, write(value: unknown): void },+ * cloud(): { origin: string | null, account: string | null, asleep: boolean },+ * powerChecked(): Promise<boolean>,+ * computer(): boolean,+ * local(route: string, init?: RequestInit): Promise<Response>,+ * cloudFetch(url: string, init?: RequestInit): Promise<Response>,+ * napped?(): void,+ * shown(): "computer" | "cloud" | null,+ * focused(): boolean,+ * openPlace(home: "computer" | "cloud"): unknown,+ * send(channel: string, value: unknown): void,+ * changed(): void,+ * now?(): number,+ * setTimer?: typeof setInterval,+ * clearTimer?: typeof clearInterval,+ * later?: typeof setTimeout,+ * cancelLater?: typeof clearTimeout,+ * }} deps `cloud()`: My Cloud's address and the signed-in account while the person has one, and whether the Admin last+ * said it sleeps. `powerChecked()`: asks the Admin again whether My Cloud sleeps, true once it answered just now.+ * `computer()`: this computer is a place of its own (its bots did not move away). `napped()`: My Cloud answered that it+ * is going to sleep. `shown()`: the place whose page the window shows, null while one loads or another screen is up.+ * `focused()`: the window is the one the person is using: in front, and the screen not locked. `openPlace(home)`: main's+ * 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.+ *+ * 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 = () => {}, 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();+ const reading = new Map();+ /** Moves whenever the lists are dropped; a read that started before it moved is thrown away. */+ let epoch = 0;+ let on = null, timer = null, pending = null, scope = null, cloudAskedAt = -Infinity, signIn = false;++ const isOn = () => { if (on === null) { try { on = parseTogether(pref.read()); } catch { on = false; } } return on; };+ const available = () => Boolean(cloud().origin) && computer();+ const active = () => isOn() && available();+ const tell = () => { try { changed(); } catch {} };++ function forget() {+ epoch += 1;+ kept.clear();+ reading.clear();+ cloudAskedAt = -Infinity;+ signIn = false;+ drop();+ }+ function drop() {+ if (!pending) return false;+ cancelLater(pending.timer);+ pending = null;+ return true;+ }++ /** The Cloud and account the lists belong to. Another one, or none, and they are gone at once. */+ function sameScope() {+ const { origin, account } = cloud();+ const next = origin && isOn() && computer() ? `${origin}\n${account ?? ""}` : null;+ if (next === scope) return;+ const had = kept.size > 0 || pending !== null;+ scope = next;+ forget();+ if (next === null) stopWatch();+ if (had) tell();+ }++ async function ask(home) {+ const signal = AbortSignal.timeout(TIMEOUT_MS);+ if (home === "computer") return local("/api/bots?messages=0", { signal, headers: { accept: "application/json" } });+ const { origin } = cloud();+ return cloudFetch(`${origin}/api/bots?messages=0`, { credentials: "include", cache: "no-store", redirect: "error", signal, headers: { accept: "application/json", ...BACKGROUND_HEADERS } });+ }++ /** Whether My Cloud may be asked now, and what its list says when it may not. */+ async function cloudMayBeAsked(mine) {+ if (cloud().asleep) return "asleep";+ const answered = await powerChecked().catch(() => false);+ if (mine !== epoch) return null;+ if (!answered) return "offline";+ return cloud().asleep ? "asleep" : "ask";+ }++ async function read(home) {+ const mine = epoch, last = kept.get(home), before = JSON.stringify([last?.state, last?.bots]);+ const held = (state) => ({ bots: last?.bots ?? [], state });+ let next;+ try {+ const may = home === "cloud" ? await cloudMayBeAsked(mine) : "ask";+ if (may === null) return;+ if (may !== "ask") next = held(may);+ else {+ const response = await ask(home);+ if (home === "cloud" && asleepAnswer(response)) { napped(); next = held("asleep"); }+ else if (home === "cloud" && needsSignIn(response)) { await response.body?.cancel?.(); signIn = true; next = { bots: [], state: "signin" }; }+ else if (!response?.ok) { await response?.body?.cancel?.(); next = held("offline"); }+ else next = { bots: botRows(await response.json(), home), state: "ready" };+ }+ } catch { next = held("offline"); }+ if (mine !== epoch || !active()) return;+ kept.set(home, { ...next, at: now() });+ if (JSON.stringify([next.state, next.bots]) !== before) tell();+ }++ /** Reads `home`'s bots again when it is due. My Cloud is due at most once a minute, never while the person is not+ * using the window, and not again once it asked for a sign-in until the person has opened it. */+ function refresh(home) {+ sameScope();+ if (!active()) return Promise.resolve();+ if (reading.has(home)) return reading.get(home);+ if (home === "cloud") {+ if (signIn || !focused() || now() - cloudAskedAt < CLOUD_EVERY_MS) return Promise.resolve();+ cloudAskedAt = now();+ } else if (kept.has(home) && now() - kept.get(home).at < FRESH_MS) return Promise.resolve();+ const mine = epoch;+ const work = read(home).finally(() => { if (mine === epoch && reading.get(home) === work) reading.delete(home); });+ reading.set(home, work);+ return work;+ }++ function watch() {+ if (timer !== null || !active()) return;+ timer = setTimer(() => {+ sameScope();+ const place = shown();+ if (active() && place && focused()) void refresh(otherHome(place));+ }, LOOK_EVERY_MS);+ timer?.unref?.();+ }+ function stopWatch() {+ if (timer !== null) clearTimer(timer);+ timer = null;+ }++ /** `home` opens, and its page is sent `channel` once it has loaded. A wait that ends any other way sends nothing:+ * it ran out, the switch ended with the window still on another page, or the person went back to the page they left. */+ function go(home, channel, value) {+ drop();+ const mine = { home, channel, value, at: now(), timer: null };+ mine.timer = later(() => { if (pending === mine) { pending = null; tell(); } }, OPEN_WAIT_MS);+ mine.timer?.unref?.();+ pending = mine;+ tell();+ void Promise.resolve().then(() => openPlace(home)).catch(() => {}).then(() => {+ const place = shown();+ if (pending === mine && place !== null && place !== home && drop()) tell();+ });+ }++ function otherOf(asking) {+ const home = otherHome(asking), known = kept.get(home);+ const state = home === "cloud" && pending?.home === home && (cloud().asleep || known?.state !== "ready") ? "waking"+ : home === "cloud" && cloud().asleep ? "asleep" : known?.state ?? "loading";+ return { home, state, bots: known?.bots ?? [] };+ }++ return {+ /** Whether the switch is on and both places exist: what anything else that joins the two places asks. */+ on: active,+ /** What `asking`'s page draws: the switch, and the other place's bots while it is on. */+ state(asking) {+ sameScope();+ const here = asking === "cloud" ? "cloud" : "computer";+ if (!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) };+ },+ /** The switch. Off forgets every list. */+ set(asking, value) {+ on = value === true;+ pref.write({ v: 1, on });+ sameScope();+ tell();+ return this.state(asking);+ },+ refresh,+ /** The signed-in account or My Cloud's address may have changed: lists that belong to another are dropped now. */+ scopeChanged: sameScope,+ /** A row's click: the other place opens at that bot. Only a bot main listed itself, for this Cloud and account, opens. */+ open(asking, botId) {+ sameScope();+ if (!active()) return false;+ const home = otherHome(asking), row = kept.get(home)?.bots.find((bot) => bot.id === botId);+ if (!row) return false;+ go(home, "desktop-notifications:open", { botId: row.id, threadId: row.threadId });+ return true;+ },+ /** The window finished loading a page: a click that was waiting for this place lands now. My Cloud on screen is+ * signed in, so it may be asked again. */+ arrived() {+ sameScope();+ const place = shown();+ if (place === "cloud" && signIn) { signIn = false; cloudAskedAt = -Infinity; }+ if (!pending || place !== pending.home) return;+ const { channel, value } = pending;+ drop();+ if (active()) send(channel, value);+ tell();+ },+ /** The window's page moved to `place` (null for any other screen). Back on the place the click left, the click is+ * over, so opening the other place later by another route opens it as it is. */+ navigated(place) {+ if (pending && place !== null && place !== pending.home && drop()) tell();+ },+ close() { stopWatch(); forget(); },+ };+}++/** The bridge's channels. `asking(event)`: "local" for this computer's own page, "cloud" for My Cloud's own page, null for+ * anything else, which gets nothing.+ *+ * Security: only this computer's own page turns the switch on. My Cloud's page is served by the Cloud, so it may turn the+ * joining off but never start it. */+export function installPlacesTogether({ ipcMain, asking, together }) {+ const side = (event) => {+ const page = asking(event);+ if (!page) throw new Error("Only this computer's page and My Cloud's page list each other's bots.");+ return page === "cloud" ? "cloud" : "computer";+ };+ ipcMain.handle("places-together:state", (event) => together.state(side(event)));+ ipcMain.handle("places-together:set", (event, value) => {+ const page = side(event);+ if (value === true && page !== "computer") throw new Error("Turn this on from this computer's page.");+ return together.set(page, value === true);+ });+ ipcMain.handle("places-together:open", (event, botId) => together.open(side(event), String(botId)));+ return together;+}diff --git a/electron/places-together.node-test.mjs b/electron/places-together.node-test.mjsnew file mode 100644index 0000000000..cd69ace363--- /dev/null+++ b/electron/places-together.node-test.mjs@@ -0,0 +1,416 @@+import assert from "node:assert/strict";+import { readFileSync } from "node:fs";+import { dirname, join } from "node:path";+import test from "node:test";+import { fileURLToPath } from "node:url";++import { botRow, botRows, CLOUD_EVERY_MS, createPlacesTogether, FRESH_MS, installPlacesTogether, LOOK_EVERY_MS, OPEN_WAIT_MS, otherHome, parseTogether } from "./places-together.mjs";++const HERE = dirname(fileURLToPath(import.meta.url));+const CLOUD = "https://mine.cloud.test";+const answer = (status, body, headers = {}) => ({ ok: status < 400, status, headers: { get: (name) => headers[name] ?? null }, json: async () => body, body: { cancel: async () => {} } });+const bot = (id, name, over = {}) => ({ id, threadId: `t-${id}`, name, title: "", color: "blue", mascotBody: "classic", ...over });+const settle = () => new Promise((done) => setImmediate(done));++function setup(over = {}) {+ const f = {+ saved: "saved" in over ? over.saved : { v: 1, on: true }, asked: [], sent: [], opened: [], changes: 0, tick: null, cleared: 0, clock: 1_000,+ cloud: { origin: CLOUD, account: "acct-a", asleep: false }, computer: true, shown: "computer", focused: true, napped: 0, checks: 0, admin: true, timeouts: [], opening: new Promise(() => {}),+ bots: { computer: [bot("scout", "Scout")], cloud: [bot("scout", "Scout"), bot("nova", "Nova", { unread: true })] },+ reply: { computer: null, cloud: null },+ };+ f.together = createPlacesTogether({+ pref: { read: () => f.saved, write: (value) => { f.saved = value; } },+ cloud: () => f.cloud, computer: () => f.computer,+ powerChecked: async () => { f.checks += 1; f.asked.push(["admin"]); return typeof f.admin === "function" ? f.admin() : f.admin; },+ local: async (route, init) => { f.asked.push(["computer", route, init]); return f.reply.computer ?? answer(200, { bots: f.bots.computer }); },+ cloudFetch: async (url, init) => { f.asked.push(["cloud", url, init]); return typeof f.reply.cloud === "function" ? f.reply.cloud() : f.reply.cloud ?? answer(200, { bots: f.bots.cloud }); },+ napped: () => { f.napped += 1; },+ shown: () => f.shown, focused: () => f.focused, openPlace: (home) => { f.opened.push(home); return f.opening; },+ send: (channel, value) => { f.sent.push([channel, value]); },+ changed: () => { f.changes += 1; },+ now: () => f.clock,+ setTimer: (run, ms) => { f.tick = { run, ms }; return {}; }, clearTimer: () => { f.cleared += 1; },+ later: (run, ms) => { const timer = { run, ms, cancelled: false }; f.timeouts.push(timer); return timer; }, cancelLater: (timer) => { if (timer) timer.cancelled = true; },+ ...over.deps,+ });+ /** The next read of My Cloud is due: a minute has passed. */+ f.later = () => { f.clock += CLOUD_EVERY_MS; };+ f.cloudAsked = () => f.asked.filter(([side]) => side === "cloud").length;+ return f;+}++test("the switch starts off, and off reads nothing, keeps nothing and starts no timer", async () => {+ const f = setup({ saved: null });+ assert.equal(parseTogether(null), false);+ assert.equal(parseTogether({ v: 1, on: "yes" }), false);+ assert.deepEqual(f.together.state("computer"), { v: 1, available: true, on: false, here: "computer", other: null });+ await f.together.refresh("cloud");+ assert.equal(f.together.open("computer", "nova"), false);+ f.together.arrived();+ await settle();+ assert.deepEqual([f.asked, f.sent, f.opened, f.tick, f.changes], [[], [], [], null, 0]);+ assert.equal(f.together.on(), false);+});++test("on: this computer's page lists My Cloud's bots, asked as background work with the person's own session", async () => {+ const f = setup();+ assert.equal(f.together.state("computer").other.state, "loading");+ await f.together.refresh("cloud");+ const state = f.together.state("computer");+ assert.deepEqual(state.other, { home: "cloud", state: "ready", bots: [+ { home: "cloud", id: "scout", threadId: "t-scout", name: "Scout", color: "blue", mascotBody: "classic" },+ { home: "cloud", id: "nova", threadId: "t-nova", name: "Nova", color: "blue", mascotBody: "classic", unread: true },+ ] });+ assert.deepEqual(f.asked.map(([side]) => side), ["admin", "cloud"], "the Admin is asked whether it sleeps first, then My Cloud, once");+ const [, url, init] = f.asked[1];+ assert.deepEqual([url, init.headers["x-omb-background"], init.credentials, init.redirect], [`${CLOUD}/api/bots?messages=0`, "1", "include", "error"]);+ assert.equal(f.changes, 1);+});++test("My Cloud's page lists this computer's bots the same way", async () => {+ const f = setup();+ f.shown = "cloud";+ f.together.state("cloud");+ await f.together.refresh("computer");+ assert.deepEqual(f.together.state("cloud").other.bots.map((row) => [row.home, row.id]), [["computer", "scout"]]);+ assert.deepEqual(f.asked.map(([side, route]) => [side, route]), [["computer", "/api/bots?messages=0"]]);+ assert.equal(otherHome("cloud"), "computer");+ assert.equal(otherHome("local"), "cloud");+});++test("two bots with one id, one in each place, stay two: each list keeps its own and a click opens its own place", async () => {+ const f = setup();+ f.bots.computer = [bot("scout", "Scout here")];+ f.bots.cloud = [bot("scout", "Scout there")];+ await Promise.all([f.together.refresh("cloud"), f.together.refresh("computer")]);+ assert.equal(f.together.state("computer").other.bots[0].name, "Scout there");+ assert.equal(f.together.state("cloud").other.bots[0].name, "Scout here");+ assert.equal(f.together.open("computer", "scout"), true);+ await settle();+ assert.deepEqual(f.opened, ["cloud"]);+ f.shown = "cloud";+ f.together.arrived();+ assert.deepEqual(f.sent, [["desktop-notifications:open", { botId: "scout", threadId: "t-scout" }]]);+ assert.equal(f.together.open("cloud", "scout"), true);+ await settle();+ assert.deepEqual(f.opened, ["cloud", "computer"]);+});++test("a click opens only a bot main listed, and lands once that place's page has loaded", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ assert.equal(f.together.open("computer", "ghost"), false);+ assert.equal(f.together.open("computer", "nova"), true);+ await settle();+ f.shown = null;+ f.together.arrived();+ f.shown = "computer";+ f.together.arrived();+ assert.deepEqual(f.sent, [], "nothing lands while the window still shows the old place or loads");+ f.shown = "cloud";+ f.together.arrived();+ f.together.arrived();+ assert.deepEqual(f.sent, [["desktop-notifications:open", { botId: "nova", threadId: "t-nova" }]]);+});++test("a click that waited too long for its place is dropped", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.together.open("computer", "nova");+ f.timeouts.at(-1).run();+ f.shown = "cloud";+ f.together.arrived();+ assert.deepEqual(f.sent, []);+});++test("a sleeping Cloud is never asked; its bots stay listed and a click wakes it by opening it", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.cloud = { ...f.cloud, asleep: true };+ f.asked.length = 0;+ f.later();+ await f.together.refresh("cloud");+ assert.equal(f.asked.length, 0);+ let other = f.together.state("computer").other;+ assert.deepEqual([other.state, other.bots.length], ["asleep", 2]);+ assert.equal(f.together.open("computer", "nova"), true);+ await settle();+ other = f.together.state("computer").other;+ assert.deepEqual([other.state, other.bots.length, f.opened], ["waking", 2, ["cloud"]]);+ assert.equal(f.cloudAsked(), 0, "main's own switch wakes it, as opening My Cloud always does");+});++test("a Cloud that answers it is going to sleep is held like a sleeping one", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.reply.cloud = answer(503, { error: "asleep" }, { "x-omb-cloud-power": "asleep" });+ f.later();+ await f.together.refresh("cloud");+ assert.equal(f.napped, 1);+ assert.deepEqual([f.together.state("computer").other.state, f.together.state("computer").other.bots.length], ["asleep", 2]);+});++test("a place that can't be reached keeps its last list, and nothing is thrown at the page", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.reply.cloud = answer(502, {});+ f.later();+ await f.together.refresh("cloud");+ assert.deepEqual([f.together.state("computer").other.state, f.together.state("computer").other.bots.length], ["offline", 2]);+ const g = setup({ deps: { cloudFetch: async () => { throw new Error("offline"); } } });+ await g.together.refresh("cloud");+ assert.deepEqual(g.together.state("computer").other, { home: "cloud", state: "offline", bots: [] });+});++test("this computer's bots are read again on the timer while the window shows one of the two places and is in use", async () => {+ const f = setup();+ f.shown = "cloud";+ f.together.state("cloud");+ await settle();+ assert.equal(f.tick.ms, LOOK_EVERY_MS);+ f.asked.length = 0;+ f.clock += LOOK_EVERY_MS;+ f.shown = null;+ f.tick.run();+ f.shown = "cloud";+ f.focused = false;+ f.tick.run();+ await settle();+ assert.equal(f.asked.length, 0);+ f.focused = true;+ f.tick.run();+ await settle();+ assert.deepEqual(f.asked.map(([side]) => side), ["computer"]);+ f.clock += FRESH_MS - 1;+ f.together.state("cloud");+ await settle();+ assert.equal(f.asked.length, 1, "a page that asks again at once gets the list just read");+});++test("My Cloud is asked at most once a minute however often a page or the timer asks", async () => {+ const f = setup();+ f.together.state("computer");+ await settle();+ assert.equal(f.cloudAsked(), 1);+ for (let i = 0; i < 5; i += 1) { f.clock += 9_000; f.together.state("computer"); f.tick.run(); await settle(); }+ assert.equal(f.cloudAsked(), 1);+ assert.equal(f.checks, 1, "nor is the Admin asked more often for it");+ f.clock += CLOUD_EVERY_MS;+ f.tick.run();+ await settle();+ assert.equal(f.cloudAsked(), 2);+});++test("My Cloud is never asked while the person is not using the window: behind other apps, or with the screen locked", async () => {+ const f = setup();+ f.focused = false;+ f.together.state("computer");+ f.tick.run();+ f.later();+ await f.together.refresh("cloud");+ await settle();+ assert.deepEqual(f.asked, []);+ assert.equal(f.together.state("computer").other.state, "loading");+ f.focused = true;+ f.together.state("computer");+ await settle();+ assert.equal(f.cloudAsked(), 1, "back in front, it is read at once");+});++test("My Cloud is asked only right after the Admin said it is awake: a Cloud that fell asleep since the last word is left asleep", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.asked.length = 0;+ f.later();+ f.admin = () => { f.cloud = { ...f.cloud, asleep: true }; return true; };+ await f.together.refresh("cloud");+ assert.deepEqual(f.asked, [["admin"]], "the Admin's fresh word stopped the read");+ assert.deepEqual([f.together.state("computer").other.state, f.together.state("computer").other.bots.length], ["asleep", 2]);+});++test("when the Admin can't say whether My Cloud sleeps, My Cloud is not asked", async () => {+ const f = setup();+ f.admin = false;+ await f.together.refresh("cloud");+ assert.equal(f.cloudAsked(), 0);+ assert.equal(f.together.state("computer").other.state, "offline");+ const g = setup({ deps: { powerChecked: async () => { throw new Error("offline"); } } });+ await g.together.refresh("cloud");+ assert.equal(g.cloudAsked(), 0);+});++test("another account's Cloud never shows the last account's bots: asleep, it lists none and opens none", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ assert.equal(f.together.state("computer").other.bots.length, 2);+ f.cloud = { origin: "https://other.cloud.test", account: "acct-b", asleep: true };+ f.together.scopeChanged();+ const other = f.together.state("computer").other;+ assert.deepEqual([other.state, other.bots], ["asleep", []]);+ assert.equal(f.together.open("computer", "nova"), false);+ await settle();+ assert.deepEqual(f.opened, []);+});++test("the same holds without being told: the same address under another account, and a sign-out, drop the list on the next ask", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.cloud = { origin: CLOUD, account: "acct-b", asleep: true };+ assert.equal(f.together.open("computer", "nova"), false);+ assert.deepEqual(f.together.state("computer").other.bots, []);+ const g = setup();+ await g.together.refresh("cloud");+ g.together.open("computer", "nova");+ g.cloud = { origin: null, account: null, asleep: false };+ g.together.scopeChanged();+ assert.deepEqual(g.together.state("computer"), { v: 1, available: false, on: true, here: "computer", other: null });+ g.cloud = { origin: CLOUD, account: "acct-a", asleep: true };+ assert.deepEqual(g.together.state("computer").other.bots, [], "signed in again, nothing from before comes back");+ g.shown = "cloud";+ g.together.arrived();+ assert.deepEqual(g.sent, [], "the click from before the sign-out opens nothing");+});++test("a read still under way when the account changes is thrown away", async () => {+ let release;+ const f = setup();+ f.reply.cloud = () => new Promise((done) => { release = () => done(answer(200, { bots: [bot("old", "Old account's bot")] })); });+ const reading = f.together.refresh("cloud");+ await settle();+ f.cloud = { origin: "https://other.cloud.test", account: "acct-b", asleep: false };+ f.together.scopeChanged();+ release();+ await reading;+ f.reply.cloud = () => new Promise(() => {});+ assert.deepEqual(f.together.state("computer").other.bots, []);+ assert.equal(f.together.open("computer", "old"), false);+});++test("a Cloud this window is not signed in to says so once, lists nothing, and is not asked again until it has been opened", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.reply.cloud = answer(401, { error: "unauthorized" });+ f.later();+ await f.together.refresh("cloud");+ assert.deepEqual(f.together.state("computer").other, { home: "cloud", state: "signin", bots: [] });+ const asked = f.cloudAsked();+ for (let i = 0; i < 3; i += 1) { f.later(); f.tick.run(); f.together.state("computer"); await settle(); }+ assert.equal(f.cloudAsked(), asked);+ f.reply.cloud = null;+ f.shown = "cloud";+ f.together.arrived();+ f.shown = "computer";+ await f.together.refresh("cloud");+ assert.equal(f.together.state("computer").other.state, "ready");+});++test("a wake that never comes stops saying it is waking: the wait ends on its own, and when the switch ends on the page it left", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.cloud = { ...f.cloud, asleep: true };+ f.together.open("computer", "nova");+ assert.equal(f.together.state("computer").other.state, "waking");+ assert.equal(f.timeouts.at(-1).ms, OPEN_WAIT_MS);+ f.timeouts.at(-1).run();+ assert.equal(f.together.state("computer").other.state, "asleep");+ f.shown = "cloud";+ f.together.arrived();+ assert.deepEqual(f.sent, []);++ const g = setup();+ await g.together.refresh("cloud");+ g.cloud = { ...g.cloud, asleep: true };+ g.opening = Promise.resolve();+ g.together.open("computer", "nova");+ await settle();+ assert.equal(g.together.state("computer").other.state, "asleep", "main's switch ended and the window still shows this computer");+ assert.equal(g.timeouts.at(-1).cancelled, true);+});++test("going back to the page the click left ends the wait, so My Cloud opened later by another route opens as it is", async () => {+ const f = setup();+ await f.together.refresh("cloud");+ f.shown = null;+ f.together.open("computer", "nova");+ await settle();+ f.together.navigated(null);+ assert.equal(f.timeouts.at(-1).cancelled, false, "another screen on the way, such as the one shown while it wakes, changes nothing");+ f.together.navigated("computer");+ assert.equal(f.timeouts.at(-1).cancelled, true);+ f.shown = "cloud";+ f.together.navigated("cloud");+ f.together.arrived();+ assert.deepEqual(f.sent, []);+});++test("turning it off forgets every list and stops the timer; the choice is kept", async () => {+ const f = setup();+ f.together.state("computer");+ await f.together.refresh("cloud");+ f.together.open("computer", "nova");+ const off = f.together.set("computer", false);+ assert.deepEqual([off.on, off.other, f.saved, f.cleared], [false, null, { v: 1, on: false }, 1]);+ f.shown = "cloud";+ f.together.arrived();+ assert.deepEqual(f.sent, []);+ assert.equal(f.together.open("computer", "nova"), false);+ const on = f.together.set("computer", true);+ assert.deepEqual([on.on, on.other.bots, f.saved], [true, [], { v: 1, on: true }]);+});++test("without a My Cloud, or once this computer's bots moved away, there is nothing to join", async () => {+ const f = setup();+ f.cloud = { origin: null, account: null, asleep: false };+ assert.deepEqual(f.together.state("computer"), { v: 1, available: false, on: true, here: "computer", other: null });+ f.cloud = { origin: CLOUD, account: "acct-a", asleep: false };+ f.computer = false;+ assert.equal(f.together.state("cloud").available, false);+ assert.equal(f.together.on(), false);+ await f.together.refresh("cloud");+ assert.equal(f.asked.length, 0);+});++test("a row is a name, a look and a state: no messages, and no row for an archived bot or a move's pointer", () => {+ const full = bot("scout", " Scout ", { title: "Research", messages: [{ text: "secret" }], soul: "secret", modelSelection: { instanceId: "x" }, chiefOfStaff: true,+ tasks: [{ threadId: "t1", unread: true }, { threadId: "t2", activity: "waiting-on-you" }, { threadId: "t3", busy: true, routineRunId: "r" }] });+ assert.deepEqual(botRow(full, "cloud"), { home: "cloud", id: "scout", threadId: "t-scout", name: "Scout", title: "Research", color: "blue", mascotBody: "classic", chief: true, waiting: true, unread: true });+ assert.deepEqual(botRow(bot("w", "Worker", { busy: true }), "computer").working, true);+ assert.equal(botRow(bot("a", "Archived", { hidden: true }), "cloud"), null);+ assert.equal(botRow(bot("h", "Hidden from the sidebar", { sidebarHidden: true }), "cloud"), null);+ assert.equal(botRow(bot("m", "Moved", { hidden: true, movedTo: { state: "moved" } }), "computer"), null);+ assert.equal(botRow(bot("bad id", "X"), "cloud"), null);+ assert.equal(botRow(bot("x", "X", { color: "url(javascript:1)<" }), "cloud").color, undefined);+ assert.deepEqual(botRows({ bots: "no" }, "cloud"), []);+ assert.deepEqual(botRows(null, "cloud"), []);+});++test("only this computer's page and My Cloud's own page are answered", async () => {+ const handlers = new Map();+ const f = setup();+ installPlacesTogether({ ipcMain: { handle: (channel, handler) => handlers.set(channel, handler) }, asking: (event) => event.page, together: f.together });+ assert.deepEqual([...handlers.keys()], ["places-together:state", "places-together:set", "places-together:open"]);+ for (const handler of handlers.values()) assert.throws(() => handler({ page: null }, "nova"), /Only this computer's page and My Cloud's page/);+ assert.equal(handlers.get("places-together:state")({ page: "local" }).here, "computer");+ assert.equal(handlers.get("places-together:state")({ page: "cloud" }).here, "cloud");+ assert.equal(handlers.get("places-together:set")({ page: "local" }, "yes").on, false, "only true turns it on");+ assert.throws(() => handlers.get("places-together:set")({ page: "cloud" }, true), /from this computer's page/);+ assert.equal(f.saved.on, false, "My Cloud's page cannot start the joining");+ assert.equal(handlers.get("places-together:set")({ page: "local" }, true).on, true);+ assert.equal(handlers.get("places-together:set")({ page: "cloud" }, false).on, false, "either page may turn it off");+});++test("main wires it to the one rule for this app's own pages, and the preload offers it to those pages only through main", () => {+ const main = readFileSync(join(HERE, "main.mjs"), "utf8");+ assert.match(main, /installPlacesTogether\(\{ ipcMain, asking: cloudPageAsking, /);+ assert.match(main, /desktopNotifications\.arrived\(\); placesTogether\.arrived\(\);/);+ assert.match(main, /try \{ placesTogether\.scopeChanged\(\); \} catch \{\}/, "an account change or sign-out drops the lists at once");+ assert.match(main, /placesTogether\.navigated\(homeOfUrl\(url\)\)/);+ assert.match(main, /powerChecked: async \(\) => \{ const account = cloudAccount; if \(!account\) return false; await account\.refresh\(\); return Date\.now\(\) - \(account\.state\(\)\.verifiedAt \?\? 0\) < 5_000; \}/);+ assert.match(main, /focused: \(\) => powerMonitor\.getSystemIdleState\(60\) !== "locked" && Boolean\(mainWindow && !mainWindow\.isDestroyed\(\) && mainWindow\.isFocused\(\)\)/);+ assert.equal(main.match(/places-together:/g).length, 1, "main sends only that the list changed, never the list");+ const preload = readFileSync(join(HERE, "preload.cjs"), "utf8");+ assert.match(preload.match(/const REMOTE_SAFE = new Set\(\[([^\]]*)\]\)/)[1], /"placesTogether"/);+ const bridge = preload.slice(preload.indexOf(" placesTogether: "), preload.indexOf(" twoPlaces: {"));+ assert.deepEqual(bridge.match(/"places-together:[a-z]+"/g), ['"places-together:state"', '"places-together:set"', '"places-together:open"', '"places-together:changed"', '"places-together:changed"']);+});diff --git a/electron/preload.cjs b/electron/preload.cjsindex bc6dc847d2..e1cb47db55 100644--- a/electron/preload.cjs+++ b/electron/preload.cjs@@ -75,7 +75,7 @@ function railKeepsItsSize() {if (typeof window !== "undefined") {for (const type of ["resize", "DOMContentLoaded"]) window.addEventListener(type, () => { leaveRailRoom(); railKeepsItsSize(); });}-const REMOTE_SAFE = new Set(["platform", "app", "getCapabilities", "onCapabilitiesChanged", "applySkin", "setUnreadCount", "permStatus", "workspaces", "rail", "cloudAdd", "cloudPlan", "cloudSendPage", "accountSheet", "desktopNotices", "desktopNotifications", "desktopAnalytics", "desktopLanguage", "updatesConsent", "windowControls", "onOpenAppSettings", "windowFrame", "softwareRendering", "appUpdate"]);+const REMOTE_SAFE = new Set(["platform", "app", "getCapabilities", "onCapabilitiesChanged", "applySkin", "setUnreadCount", "permStatus", "workspaces", "rail", "cloudAdd", "cloudPlan", "cloudSendPage", "placesTogether", "accountSheet", "desktopNotices", "desktopNotifications", "desktopAnalytics", "desktopLanguage", "updatesConsent", "windowControls", "onOpenAppSettings", "windowFrame", "softwareRendering", "appUpdate"]);/** My Cloud's own page once it is the person's home (main checks the sender again): it is this app's page then. */const HOME_PAGE = ["home", "onChatLink", "onPackageInstall", "exportDiagnostics", "openLogsFolder", "openAtLogin", "callActive"];function updaterOffered() {@@ -567,6 +567,19 @@ const bridge = {return () => ipcRenderer.removeListener("cloud-send:notice-changed", handler);},} : undefined,+ // This computer's page and My Cloud's own page (main refuses any other): the other one's bots, listed beside this one's.+ placesTogether: process.argv.includes("--omb-company-desktop=1") ? {+ state: () => ipcRenderer.invoke("places-together:state"),+ set: on => isLocalPage || navigator.userActivation?.isActive === true+ ? ipcRenderer.invoke("places-together:set", on === true) : Promise.reject(new Error("Turn the switch to list both places' bots.")),+ open: botId => isLocalPage || navigator.userActivation?.isActive === true+ ? ipcRenderer.invoke("places-together:open", String(botId)) : Promise.reject(new Error("Choose a bot to open it.")),+ onChanged: cb => {+ const handler = () => cb();+ ipcRenderer.on("places-together:changed", handler);+ return () => ipcRenderer.removeListener("places-together:changed", handler);+ },+ } : undefined,// This computer's page only (never in REMOTE_SAFE, and main refuses any other): bots in two places, brought together on one.twoPlaces: {state: () => ipcRenderer.invoke("two-places:state"),diff --git a/server/background-asleep.test.ts b/server/background-asleep.test.tsnew file mode 100644index 0000000000..cf541d90f0--- /dev/null+++ b/server/background-asleep.test.ts@@ -0,0 +1,39 @@+import { readFileSync } from "node:fs";+import type { ServerResponse } from "node:http";+import { afterEach, describe, expect, it } from "vitest";++import { asleepAnswer, BACKGROUND_HEADERS } from "../electron/cloud-power.mjs";+import { answerAsleep, backgroundWhileAsleep, registerCloudPower } from "./cloud-power.ts";++const power = (sleeping: boolean) => ({ sleeping: () => sleeping, sleepSignal: () => new AbortController().signal, sleptUntil: () => null }) as unknown as Parameters<typeof registerCloudPower>[0];++afterEach(() => registerCloudPower(null));++describe("a background read of the bots on a home that agreed to sleep", () => {+ it("is told the home sleeps, in the words the desktop app listens for", () => {+ registerCloudPower(power(true));+ expect(backgroundWhileAsleep("/api/bots", { ...BACKGROUND_HEADERS })).toBe(true);+ const headers = new Map<string, string>();+ let sent: { status: number; body: unknown } | null = null;+ const res = { setHeader: (name: string, value: string) => headers.set(name, value) } as unknown as ServerResponse;+ answerAsleep(res, (_res, status, body) => { sent = { status, body }; });+ expect(sent).toEqual({ status: 503, body: { error: "asleep" } });+ expect(asleepAnswer({ status: sent!.status, headers: { get: (name: string) => headers.get(name) ?? null } })).toBe(true);+ });++ it("leaves a person's own request, an awake home and a server that never sleeps alone", () => {+ registerCloudPower(power(true));+ expect(backgroundWhileAsleep("/api/bots", {})).toBe(false);+ registerCloudPower(power(false));+ expect(backgroundWhileAsleep("/api/bots", { ...BACKGROUND_HEADERS })).toBe(false);+ registerCloudPower(null);+ expect(backgroundWhileAsleep("/api/bots", { ...BACKGROUND_HEADERS })).toBe(false);+ });++ it("is answered before the bots are read", () => {+ const route = readFileSync(new URL("./routes/threads.ts", import.meta.url), "utf8");+ const list = route.slice(route.indexOf('if (method === "GET" && path === "/api/bots") {'));+ expect(list.indexOf("if (backgroundWhileAsleep(path, req.headers)) return answerAsleep(res, json);")).toBeLessThan(list.indexOf("store.bots"));+ expect(list.indexOf("if (backgroundWhileAsleep(path, req.headers)) return answerAsleep(res, json);")).toBeGreaterThan(0);+ });+});diff --git a/server/boat-auto-sleep.test.ts b/server/boat-auto-sleep.test.tsindex 383671cbf5..2cbda41d65 100644--- a/server/boat-auto-sleep.test.ts+++ b/server/boat-auto-sleep.test.ts@@ -164,8 +164,8 @@ describe("a cloud computer goes to sleep after its idle window", () => {await background.startInBackground(cfg, boxId, "python3 job.py", new AbortController().signal);power.used(botId);await new Promise(resolve => setTimeout(resolve, 3_500));+ await waitFor(() => requests.filter(request => request.path === `${root}/${boxId}/commands/7`).length >= 2);expect(stops()).toEqual([]);- expect(requests.filter(request => request.path === `${root}/${boxId}/commands/7`).length).toBeGreaterThanOrEqual(2);expect(power.awake()).toBe(true);jobRunning = false;await asleep();diff --git a/server/cloud-power.ts b/server/cloud-power.tsindex 2048e0b8bc..f1fae37b7f 100644--- a/server/cloud-power.ts+++ b/server/cloud-power.ts@@ -248,3 +248,9 @@ export type CloudPower = ReturnType<typeof createCloudPower>;let registered: Pick<CloudPower, "sleeping" | "sleepSignal" | "sleptUntil"> | null = null;export function registerCloudPower(power: Pick<CloudPower, "sleeping" | "sleepSignal" | "sleptUntil"> | null) { registered = power; }export const cloudPowerNow = () => registered;++/** A read the client marked as background, on a home that agreed to sleep: it gets `answerAsleep` and nothing more, so a+ * list kept fresh in the background never holds the home awake or finds it half asleep. A person's own request never does. */+export function backgroundWhileAsleep(path: string, headers: Record<string, string | string[] | undefined>): boolean {+ return Boolean(registered?.sleeping()) && !countsAsActivity(path, headers);+}diff --git a/server/routes/threads.ts b/server/routes/threads.tsindex 8b66c218e6..c32ae0e832 100644--- a/server/routes/threads.ts+++ b/server/routes/threads.ts@@ -24,6 +24,7 @@ import {import { resolveRequestAuth, type RequestAuth, type ResolveOptions } from "../request-auth.ts";import type { queuedSteerSnapshot } from "../steer-queue.ts";import type { BotRecord, GroupRecord, Message, Store } from "../store.ts";+import { answerAsleep, backgroundWhileAsleep } from "../cloud-power.ts";import { createJobRoutes } from "./jobs.ts";import { PASS, type RouteContext, type RouteHandler } from "./table.ts";@@ -102,6 +103,7 @@ export function createThreadRoutes(deps: ThreadRouteDeps): RouteHandler {const companionMutationToken = deps.companionMutationToken();const cliOwnerToken = deps.cliOwnerToken();if (method === "GET" && path === "/api/bots") {+ if (backgroundWhileAsleep(path, req.headers)) return answerAsleep(res, json);try { groupUsageReader.refresh(); } catch { }const limit = pageSize(url.searchParams.get("messages"));if (limit === null) return json(res, 400, { error: "messages must be a non-negative whole number" });diff --git a/src/components/OtherPlaceBots.dom.test.ts b/src/components/OtherPlaceBots.dom.test.tsnew file mode 100644index 0000000000..a1bb985227--- /dev/null+++ b/src/components/OtherPlaceBots.dom.test.ts@@ -0,0 +1,130 @@+// @vitest-environment happy-dom+import { act, createElement } from "react";+import { createRoot, type Root } from "react-dom/client";+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 { PlacesTogetherSwitch } from "./PlacesTogetherSwitch";+import { SettingsLook } from "./SettingsPrimitives";++let container: HTMLDivElement, root: Root, said: PlacesTogetherState, changed: () => void;+const row = (home: "computer" | "cloud", id: string, name: string, over: Partial<PlaceBotRow> = {}): PlaceBotRow => ({ home, id, threadId: `t-${id}`, name, color: "blue", ...over });+const state = (over: Partial<PlacesTogetherState> = {}): PlacesTogetherState => ({ v: 1, available: true, on: true, here: "computer",+ other: { home: "cloud", state: "ready", bots: [row("cloud", "scout", "Scout"), row("cloud", "nova", "Nova", { unread: true, title: "Research" })] }, ...over });+const page = {+ state: vi.fn(async () => said),+ set: vi.fn(async (on: boolean) => { said = on ? state() : state({ on: false, other: null }); return said; }),+ open: vi.fn(async () => true),+ 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(() => {+ vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);+ said = state();+ window.ogb = { placesTogether: page } as never;+ for (const fn of Object.values(page)) fn.mockClear();+ container = document.createElement("div"); document.body.append(container); root = createRoot(container);+});+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 () => {+ said = state({ on: false, other: null });+ await render(createElement(OtherPlaceBots, { key: "list" }), createElement(OwnBotHomeMark, { key: "mark" }));+ 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" }));+ expect(q("[data-other-place]")).toBeNull();+ expect(page.state).toHaveBeenCalledTimes(1);+});++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("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 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" }));+ await act(async () => changed());+ expect(q("[data-other-place-line]")!.textContent).toBe(line);+ 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 () => {+ 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" }));+ expect(q("[data-other-place]")).toBeNull();+});++it("the switch: marked Early, off until turned on, and hidden where main does not offer it", async () => {+ said = state({ on: false, other: null });+ await render(createElement(SettingsLook.Provider, { key: "switch", value: true }, createElement(PlacesTogetherSwitch)));+ expect(q("[data-places-together]")!.getAttribute("data-places-together")).toBe("off");+ expect(q("[data-places-together]")!.textContent).toContain("This computer and My Cloud together");+ expect(q("[data-places-together] [data-settings-tag]")!.textContent).toBe("Early");+ await act(async () => q("[data-places-together] [role=switch]")!.click());+ expect(page.set.mock.calls).toEqual([[true]]);+ expect(q("[data-places-together]")!.getAttribute("data-places-together")).toBe("on");+ said = state({ available: false, on: false, other: null });+ await act(async () => changed());+ expect(q("[data-places-together]")).toBeNull();+});++it("My Cloud's page shows the switch only to turn it off: turning it on is this computer's", async () => {+ said = state({ here: "cloud", on: false, other: null });+ await render(createElement(SettingsLook.Provider, { key: "switch", value: true }, createElement(PlacesTogetherSwitch)));+ expect(q("[data-places-together]")).toBeNull();+ said = state({ here: "cloud", other: { home: "computer", state: "ready", bots: [] } });+ await act(async () => changed());+ expect(q("[data-places-together]")!.getAttribute("data-places-together")).toBe("on");+ await act(async () => q("[data-places-together] [role=switch]")!.click());+ expect(page.set.mock.calls).toEqual([[false]]);+});diff --git a/src/components/OtherPlaceBots.tsx b/src/components/OtherPlaceBots.tsxnew file mode 100644index 0000000000..4bd1c66273--- /dev/null+++ b/src/components/OtherPlaceBots.tsx@@ -0,0 +1,97 @@+// 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, type MascotFaceColor } from "../../shared/bot-avatar";+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;+ return { name: row.name, color, mascotBody: body, mascotFaceColor: face };+}++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} 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>+ );+}++/** 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} count={simple ? rows.length : undefined} 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>+ );+}diff --git a/src/components/PlacesTogetherSwitch.tsx b/src/components/PlacesTogetherSwitch.tsxnew file mode 100644index 0000000000..7f7efb1c23--- /dev/null+++ b/src/components/PlacesTogetherSwitch.tsx@@ -0,0 +1,26 @@+import { useState } from "react";+import { t } from "@/lib/i18n";+import { setPlacesTogether, usePlacesTogether } from "@/lib/places-together";+import { SettingRow, SettingsGroup, SettingsRows, Switch } from "./SettingsPrimitives";++/** Settings → MausBot Cloud: this computer's bots and My Cloud's in one sidebar. Shown only where main offers it;+ * My Cloud's page can turn it off, and only this computer's page turns it on. */+export function PlacesTogetherSwitch() {+ const together = usePlacesTogether();+ const [busy, setBusy] = useState(false), [failed, setFailed] = useState(false);+ if (!together?.available || (!together.on && together.here !== "computer")) return null;+ const turn = () => {+ setBusy(true); setFailed(false);+ void setPlacesTogether(!together.on).catch(() => setFailed(true)).finally(() => setBusy(false));+ };+ return <SettingsGroup block="together">+ <SettingsRows>+ <div data-places-together={together.on ? "on" : "off"} className="contents">+ <SettingRow title={t("together.switch.title")} tag={t("settings.early.tag")} subtitle={t("together.switch.line")}+ message={failed ? <span role="alert" className="block text-danger">{t("together.switch.failed")}</span> : undefined}>+ <Switch checked={together.on} disabled={busy} aria-label={t("together.switch.title")} onClick={turn} />+ </SettingRow>+ </div>+ </SettingsRows>+ </SettingsGroup>;+}diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex 0136d8d057..1a3ab11863 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -74,7 +74,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 { useCloudOwner } from "./CloudOwner"; import { OtherPlaceBots, OwnBotHomeMark } from "./OtherPlaceBots";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";@@ -807,7 +807,7 @@ export const BotListItem = memo(function BotListItem(props: BotRowProps) {<title>{t("call.live.badge")}</title></Phone>)}- {!simpleList && title && !renaming && <SidebarBotRole role={title} />}+ {!renaming && <OwnBotHomeMark />}{!simpleList && title && !renaming && <SidebarBotRole role={title} />}</span>{last && !renaming && !expanded && (<span className={cn(@@ -1489,7 +1489,7 @@ export const Sidebar = memo(function Sidebar({ open, onClose, collapseToIcons =</div>);})}- <MovedBotRows bots={state.bots} /><MovedToMyCloudRow bots={state.bots} /><SearchResults query={query} onLanded={() => { setQuery(""); setSearchOpen(false); }} />+ <OtherPlaceBots 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/settings/pages/AccountPages.tsx b/src/components/settings/pages/AccountPages.tsxindex c9d38d7829..b05fbdd455 100644--- a/src/components/settings/pages/AccountPages.tsx+++ b/src/components/settings/pages/AccountPages.tsx@@ -10,6 +10,7 @@ import { SignOutConfirm } from "../SignOutConfirm";import { CloudAccountSettings } from "../../CloudAccountSettings";import { useCloudUsageSettings } from "../../CloudUsageMeter";import { OrganizationSettings } from "../../OrganizationSettings";+import { PlacesTogetherSwitch } from "../../PlacesTogetherSwitch";import { SettingRow, SettingsGroup, SettingsLinkRow, SettingsRows } from "../../SettingsPrimitives";import { UpdatesConsentRow } from "../../UpdatesConsent";import { useAccountSummary, useYou } from "../account-summary";@@ -106,6 +107,7 @@ export function PlanPage() {extra={!ctx.advanced && !ctx.client && !(ctx.team && !ctx.admin) && (place.kind === "computer" || place.kind === "server") ? <SpentRow place={place.name} /> : undefined}onAddCloud={() => dispatch({ type: "openCloudAdd", source: "app_settings" })}onSignIn={() => dispatch({ type: "openCloudAdd", source: "app_settings", signIn: true })} />+ <PlacesTogetherSwitch />{dialog}</>;}diff --git a/src/components/settings/settings-index.ts b/src/components/settings/settings-index.tsindex 89d3fd6d34..ce3dd9ab1d 100644--- a/src/components/settings/settings-index.ts+++ b/src/components/settings/settings-index.ts@@ -220,6 +220,7 @@ export const SETTINGS_INDEX: readonly SettingsIndexEntry[] = [{ id: "organization", page: "account", anchor: "organization", labelKey: "settings.section.organization", when: (ctx) => ctx.organization, synonyms: ["company", "organisation", "managed"] },{ id: "emails", page: "account", anchor: "emails", labelKey: "settings.account.emails", when: desk, synonyms: ["newsletter", "product updates", "email updates"] },{ id: "plan", page: "plan", anchor: "plan", labelKey: "settings.page.plan", topFor: ["billing", "subscription", "invoice", "receipt", "payment", "card", "upgrade", "plan", "trial", "cancel", "cancel plan", "cancel subscription", "cancel trial", "unsubscribe", "refund"], synonyms: ["usage & billing", "manage subscription"] },+ { id: "together", page: "plan", anchor: "together", labelKey: "together.switch.title", sectionKey: "settings.page.plan", synonyms: ["together", "one list", "both places", "cloud bots", "sidebar"] },{ id: "this-week", page: "plan", anchor: "this-week", labelKey: "settings.plan.thisWeek", sectionKey: "settings.page.plan", synonyms: ["usage", "weekly", "limits", "cloud desktop hours", "voice replies"] },{ id: "updates", page: "app", anchor: "updates", labelKey: "settings.updates.title", when: desk, synonyms: ["update", "version", "check for updates", "release"] },{ id: "your-computers", page: "app", anchor: "your-computers", labelKey: "settings.app.computers", when: desk, synonyms: ["servers", "connect to a server", "environments", "switch"] },diff --git a/src/lib/places-together.test.ts b/src/lib/places-together.test.tsnew file mode 100644index 0000000000..76b6300227--- /dev/null+++ b/src/lib/places-together.test.ts@@ -0,0 +1,20 @@+import { describe, expect, it } from "vitest";++import { matchingRows, placedKey, type PlaceBotRow } from "./places-together";++const row = (home: "computer" | "cloud", id: string, name: string, over: Partial<PlaceBotRow> = {}): PlaceBotRow => ({ home, id, threadId: `t-${id}`, name, ...over });++describe("the other place's bots beside this page's own", () => {+ it("keys a bot by its home and its id, so the same id in two places is two keys", () => {+ expect(placedKey("cloud", "scout")).toBe("cloud:scout");+ expect(placedKey("cloud", "scout")).not.toBe(placedKey("computer", "scout"));+ });++ it("finds the other place's bots by name or role as the person types", () => {+ const rows = [row("cloud", "a", "Scout", { title: "Research" }), row("cloud", "b", "Nova")];+ expect(matchingRows(rows, " ").length).toBe(2);+ expect(matchingRows(rows, "nov").map((bot) => bot.id)).toEqual(["b"]);+ expect(matchingRows(rows, "RESEARCH").map((bot) => bot.id)).toEqual(["a"]);+ expect(matchingRows(rows, "zzz")).toEqual([]);+ });+});diff --git a/src/lib/places-together.ts b/src/lib/places-together.tsnew file mode 100644index 0000000000..15108eefa8--- /dev/null+++ b/src/lib/places-together.ts@@ -0,0 +1,64 @@+// This computer and My Cloud together (electron/places-together.mjs), as a page sees it: the other place's bots, listed+// beside its own. Every row carries its `home`, and ids are unique only within a place, so rows are keyed by home and id.+import { useEffect, useSyncExternalStore } from "react";+import type { BotHome, PlaceBotRow, PlacesTogetherState } from "../../electron/places-together.mjs";++export type { BotHome, PlaceBotRow, PlacesTogetherState };++/** A bot's key in a list that holds both places: ids are unique only within one. */+export const placedKey = (home: BotHome, id: string): string => `${home}:${id}`;++/** The other place's rows that match what the person typed in the sidebar's search. */+export function matchingRows(rows: readonly PlaceBotRow[], query: string): PlaceBotRow[] {+ const wanted = query.trim().toLowerCase();+ return wanted ? rows.filter((row) => row.name.toLowerCase().includes(wanted) || (row.title ?? "").toLowerCase().includes(wanted)) : [...rows];+}++const bridge = () => (typeof window === "undefined" || window.ogb?.remoteClient?.active ? undefined : window.ogb?.placesTogether);++let known: PlacesTogetherState | null = null;+let watching = 0, unsubscribe: (() => void) | null = null;+const listeners = new Set<() => void>();+const publish = (next: PlacesTogetherState | null) => { known = next; for (const listener of listeners) listener(); };+const read = () => { void bridge()?.state().then(publish, () => publish(null)); };++function subscribe(listener: () => void): () => void {+ listeners.add(listener);+ 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 {+ useEffect(() => {+ const page = bridge();+ if (!page) return;+ if (watching++ === 0) {+ unsubscribe = page.onChanged(read);+ window.addEventListener("focus", read);+ read();+ }+ return () => {+ if (--watching > 0) return;+ unsubscribe?.();+ unsubscribe = null;+ window.removeEventListener("focus", read);+ };+ }, []);+ return useSyncExternalStore(subscribe, () => known, () => null);+}++/** Turns the switch, and says what main kept. */+export async function setPlacesTogether(on: boolean): Promise<void> {+ const page = bridge();+ if (page) publish(await page.set(on));+}++/** Opens one of the other place's bots there. */+export function openOtherPlaceBot(id: string): void {+ void bridge()?.open(id).catch(() => {});+}++export function resetPlacesTogetherForTest(): void {+ known = null;+ listeners.clear();+}diff --git a/src/locales/de.json b/src/locales/de.jsonindex ac19605b35..e248273afa 100644--- a/src/locales/de.json+++ b/src/locales/de.json@@ -3993,5 +3993,8 @@"devices.computers.pairButton": "Computer koppeln","devices.computers.title": "Deine anderen Computer","devices.computers.pairTitle": "Anderen Computer koppeln",- "remote.tailscale.needsApproval": "Dieser Computer wartet auf die Genehmigung in Ihrem Tailscale-Netzwerk. Genehmigen Sie ihn in der Tailscale-Admin-Konsole und versuchen Sie es dann erneut."+ "remote.tailscale.needsApproval": "Dieser Computer wartet auf die Genehmigung in Ihrem Tailscale-Netzwerk. Genehmigen Sie ihn in der Tailscale-Admin-Konsole und versuchen Sie es dann erneut.",+ "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."}diff --git a/src/locales/en.json b/src/locales/en.jsonindex be28cba792..dce198c09e 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -10931,5 +10931,15 @@"settings.browser.proxyConfigured": "New built-in browser connections use this SOCKS5 proxy. My Chrome keeps its own settings; private and local destinations stay protected.","settings.browser.proxyInactive": "Saved, but active only with the built-in browser on supported hosts.","settings.browser.proxySave": "Save",- "settings.browser.proxyClear": "Remove"+ "settings.browser.proxyClear": "Remove",+ "together.onCloud": "On My Cloud",+ "together.onComputer": "On this computer",+ "together.state.asleep": "My Cloud is asleep. Open a bot to wake it.",+ "together.state.waking": "My Cloud is waking up…",+ "together.state.offlineCloud": "My Cloud can't be reached right now.",+ "together.state.offlineComputer": "This computer's bots can't be read right now.",+ "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.state.signin": "Open My Cloud once to sign in."}diff --git a/src/locales/es.json b/src/locales/es.jsonindex cd6ba6f9cf..b4a215c11f 100644--- a/src/locales/es.json+++ b/src/locales/es.json@@ -6507,5 +6507,8 @@"devices.computers.pairButton": "Vincular un ordenador","devices.computers.title": "Tus otros ordenadores","devices.computers.pairTitle": "Vincular otro ordenador",- "remote.tailscale.needsApproval": "Este ordenador espera la aprobación en tu red de Tailscale. Apruébalo en la consola de administración de Tailscale y vuelve a intentarlo."+ "remote.tailscale.needsApproval": "Este ordenador espera la aprobación en tu red de Tailscale. Apruébalo en la consola de administración de Tailscale y vuelve a intentarlo.",+ "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."}diff --git a/src/locales/fr.json b/src/locales/fr.jsonindex c0bb68e932..504b47cddd 100644--- a/src/locales/fr.json+++ b/src/locales/fr.json@@ -3809,5 +3809,8 @@"devices.computers.pairButton": "Associer un ordinateur","devices.computers.title": "Vos autres ordinateurs","devices.computers.pairTitle": "Associer un autre ordinateur",- "remote.tailscale.needsApproval": "Cet ordinateur attend d'être approuvé sur votre réseau Tailscale. Approuvez-le dans la console d'administration Tailscale, puis réessayez."+ "remote.tailscale.needsApproval": "Cet ordinateur attend d'être approuvé sur votre réseau Tailscale. Approuvez-le dans la console d'administration Tailscale, puis réessayez.",+ "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."}diff --git a/src/locales/hi.json b/src/locales/hi.jsonindex 5f066adb9e..3d97e05c8f 100644--- a/src/locales/hi.json+++ b/src/locales/hi.json@@ -3663,5 +3663,8 @@"devices.computers.pairButton": "कंप्यूटर जोड़ें","devices.computers.title": "आपके दूसरे कंप्यूटर","devices.computers.pairTitle": "दूसरा कंप्यूटर जोड़ें",- "remote.tailscale.needsApproval": "यह कंप्यूटर आपके Tailscale नेटवर्क पर मंज़ूरी का इंतज़ार कर रहा है। Tailscale एडमिन कंसोल में इसे मंज़ूर करें, फिर दोबारा कोशिश करें।"+ "remote.tailscale.needsApproval": "यह कंप्यूटर आपके Tailscale नेटवर्क पर मंज़ूरी का इंतज़ार कर रहा है। Tailscale एडमिन कंसोल में इसे मंज़ूर करें, फिर दोबारा कोशिश करें।",+ "together.switch.title": "यही कंप्यूटर और मेरा क्लाउड एक साथ",+ "together.switch.line": "डिफ़ॉल्ट रूप से बंद। क्लाउड के बॉट और इस कंप्यूटर के बॉट एक ही सूची में दिखते हैं, और हर बॉट वहीं खुलता है जहाँ वह है।",+ "together.switch.failed": "इसे सहेजा नहीं जा सका। फिर से कोशिश करें।"}diff --git a/src/locales/it.json b/src/locales/it.jsonindex a9a6ba5f02..79d3618270 100644--- a/src/locales/it.json+++ b/src/locales/it.json@@ -7131,5 +7131,8 @@"devices.computers.pairButton": "Associa un computer","devices.computers.title": "I tuoi altri computer","devices.computers.pairTitle": "Associa un altro computer",- "remote.tailscale.needsApproval": "Questo computer è in attesa di approvazione sulla tua rete Tailscale. Approvalo nella console di amministrazione di Tailscale, poi riprova."+ "remote.tailscale.needsApproval": "Questo computer è in attesa di approvazione sulla tua rete Tailscale. Approvalo nella console di amministrazione di Tailscale, poi riprova.",+ "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."}diff --git a/src/locales/ja.json b/src/locales/ja.jsonindex b344c966e0..3af739ee11 100644--- a/src/locales/ja.json+++ b/src/locales/ja.json@@ -8102,5 +8102,8 @@"devices.computers.pairButton": "コンピュータをペアリング","devices.computers.title": "お使いの他のコンピューター","devices.computers.pairTitle": "別のコンピュータをペアリング",- "remote.tailscale.needsApproval": "このコンピューターは Tailscale ネットワークでの承認を待っています。Tailscale の管理コンソールで承認してから、もう一度お試しください。"+ "remote.tailscale.needsApproval": "このコンピューターは Tailscale ネットワークでの承認を待っています。Tailscale の管理コンソールで承認してから、もう一度お試しください。",+ "together.switch.title": "このコンピューターと My Cloud をまとめる",+ "together.switch.line": "既定ではオフです。Cloud のボットとこのコンピューターのボットを 1 つの一覧に表示し、それぞれがある場所で開きます。",+ "together.switch.failed": "保存できませんでした。もう一度お試しください。"}diff --git a/src/locales/ko.json b/src/locales/ko.jsonindex 56b9f5c9dd..24df64be19 100644--- a/src/locales/ko.json+++ b/src/locales/ko.json@@ -7792,5 +7792,8 @@"devices.computers.pairButton": "컴퓨터 페어링","devices.computers.title": "내 다른 컴퓨터","devices.computers.pairTitle": "다른 컴퓨터 페어링",- "remote.tailscale.needsApproval": "이 컴퓨터는 Tailscale 네트워크에서 승인을 기다리고 있습니다. Tailscale 관리 콘솔에서 승인한 다음 다시 시도하세요."+ "remote.tailscale.needsApproval": "이 컴퓨터는 Tailscale 네트워크에서 승인을 기다리고 있습니다. Tailscale 관리 콘솔에서 승인한 다음 다시 시도하세요.",+ "together.switch.title": "이 컴퓨터와 내 클라우드 함께 보기",+ "together.switch.line": "기본값은 꺼짐입니다. 클라우드의 봇과 이 컴퓨터의 봇이 하나의 목록에 표시되며, 각 봇은 자기가 있는 곳에서 열립니다.",+ "together.switch.failed": "저장하지 못했습니다. 다시 시도하세요."}diff --git a/src/locales/pl.json b/src/locales/pl.jsonindex 21d4385303..a35505343d 100644--- a/src/locales/pl.json+++ b/src/locales/pl.json@@ -7272,5 +7272,8 @@"devices.computers.pairButton": "Sparuj komputer","devices.computers.title": "Twoje inne komputery","devices.computers.pairTitle": "Sparuj inny komputer",- "remote.tailscale.needsApproval": "Ten komputer czeka na zatwierdzenie w Twojej sieci Tailscale. Zatwierdź go w konsoli administracyjnej Tailscale, a potem spróbuj ponownie."+ "remote.tailscale.needsApproval": "Ten komputer czeka na zatwierdzenie w Twojej sieci Tailscale. Zatwierdź go w konsoli administracyjnej Tailscale, a potem spróbuj ponownie.",+ "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."}diff --git a/src/locales/pt-br.json b/src/locales/pt-br.jsonindex ef9af45ee0..1ccc5ad788 100644--- a/src/locales/pt-br.json+++ b/src/locales/pt-br.json@@ -10931,5 +10931,15 @@"devices.computers.typeCode": "No outro computador, abra Conectar a um servidor no {app} e cole o link que você copiar aqui. Ou digite lá este endereço e este código.","devices.computers.address": "Endereço","devices.computers.pairLine": "Cria um link que seu outro computador abre. Funciona uma vez.",- "chat.settingsCard.elsewhere": "Isso é definido no próprio computador: abra o MausBot lá, depois Configurações → Celular e dispositivos → Seus outros computadores."+ "chat.settingsCard.elsewhere": "Isso é definido no próprio computador: abra o MausBot lá, depois Configurações → Celular e dispositivos → Seus outros computadores.",+ "together.onCloud": "No My Cloud",+ "together.onComputer": "Neste computador",+ "together.state.asleep": "O My Cloud está em repouso. Abra um bot para ativá-lo.",+ "together.state.waking": "O My Cloud está sendo ativado…",+ "together.state.offlineCloud": "Não é possível acessar o My Cloud agora.",+ "together.state.offlineComputer": "Não é possível ler os bots deste computador agora.",+ "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.state.signin": "Abra o My Cloud uma vez para entrar."}diff --git a/src/locales/ru.json b/src/locales/ru.jsonindex 0f6d6a5b44..7008571a90 100644--- a/src/locales/ru.json+++ b/src/locales/ru.json@@ -7325,5 +7325,8 @@"devices.computers.pairButton": "Подключить компьютер","devices.computers.title": "Ваши другие компьютеры","devices.computers.pairTitle": "Подключить другой компьютер",- "remote.tailscale.needsApproval": "Этот компьютер ждёт одобрения в вашей сети Tailscale. Одобрите его в консоли администратора Tailscale, затем попробуйте снова."+ "remote.tailscale.needsApproval": "Этот компьютер ждёт одобрения в вашей сети Tailscale. Одобрите его в консоли администратора Tailscale, затем попробуйте снова.",+ "together.switch.title": "Этот компьютер и Моё облако вместе",+ "together.switch.line": "По умолчанию выключено. Боты из облака и боты этого компьютера показаны в одном списке, и каждый открывается там, где он находится.",+ "together.switch.failed": "Не удалось сохранить. Попробуйте ещё раз."}diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.jsonindex 966dfb8bf7..8ef3cf2950 100644--- a/src/locales/source-hashes.json+++ b/src/locales/source-hashes.json@@ -3994,7 +3994,10 @@"devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8","devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174","server.routines.turnedBackOn": "e091ee76b804f84c0ac8a9b0f40adefd1661708a4b933be334c4a398f6917b6d",- "server.routines.turnedBackOnMany": "b9b1f8055114f9a1b59fc53167a4d2d3be904e945cbe33f829142a8195a1ec4f"+ "server.routines.turnedBackOnMany": "b9b1f8055114f9a1b59fc53167a4d2d3be904e945cbe33f829142a8195a1ec4f",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"es": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -10503,7 +10506,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"fr": {"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",@@ -14314,7 +14320,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"hi": {"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",@@ -17979,7 +17988,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"ja": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -26083,7 +26095,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"pt-br": {"voice.gemini.keyPlaceholder": "8c87ba2043a4a89d63c90cae8a6dafd5cbd193652e923b97988e381a74773e10",@@ -37006,7 +37021,17 @@"grokMove.connect.addBot": "ffee88c88f8243f57dc33b2fca984b64706d6100ed5e891cf03fb11ea2efbeb1","grokMove.connect.arrived": "1885ff17c85883f753a51d1839159ea84c69f96218afae4126a5be85c522a01c","grokMove.connect.failed": "3a7ca59425083c7483f7b2acdff85e6a2789f8de218b8563750ccd03058396c6",- "settings.ai.hiddenStatus": "cdcd49ccafe7bb5dd24259d6f44022e07a18dfb7654a6d36aff5c0de1ea7c23f"+ "settings.ai.hiddenStatus": "cdcd49ccafe7bb5dd24259d6f44022e07a18dfb7654a6d36aff5c0de1ea7c23f",+ "together.onCloud": "3e863af396d37b7e49f002cb51c62decbf6570f15181b91cc09bd3955f6f484a",+ "together.onComputer": "e6af7ee2bde2d5b5d9fd1441db828be287079871bc7d14aebab3ee6a73579a9e",+ "together.state.asleep": "706cc68e2ae8b1d45175e7da7fdf031201030d725764dffa4ed0aeaac95ee5dd",+ "together.state.waking": "a3d3562bfff4e14a3d0278540318e4948dc2eae6a34497112975d23c143cab4b",+ "together.state.offlineCloud": "5197d3d5dfa091deab2ed965ef02f829c81a2672402df657cacc82635d8da982",+ "together.state.offlineComputer": "6674e486fc361c62e6b2a88db89ca9fa42e8a85b6948cb1ad1c62fd54d0dea2c",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8",+ "together.state.signin": "010c70e3503b8907767eb9dd465788bb7698d05ccddc383e0685031935a70db2"},"zh": {"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",@@ -47234,7 +47259,17 @@"engines.unhideAria": "69da7203caed81388e25e663947d80d80a2f54c62d5c4b49800c7225e539a9e8","accounts.signOutCliBody": "dec35f25acc8211621523f7a2d962b28a9a3e91a3aa4864e9c4e87894d40b0a2","accounts.signOutAria": "2986263f26f5e9fe9d5e4722b51d0c989a02d3ff6875adf711e66ed3ef50f4b6",- "settings.ai.hiddenStatus": "cdcd49ccafe7bb5dd24259d6f44022e07a18dfb7654a6d36aff5c0de1ea7c23f"+ "settings.ai.hiddenStatus": "cdcd49ccafe7bb5dd24259d6f44022e07a18dfb7654a6d36aff5c0de1ea7c23f",+ "together.onCloud": "3e863af396d37b7e49f002cb51c62decbf6570f15181b91cc09bd3955f6f484a",+ "together.onComputer": "e6af7ee2bde2d5b5d9fd1441db828be287079871bc7d14aebab3ee6a73579a9e",+ "together.state.asleep": "706cc68e2ae8b1d45175e7da7fdf031201030d725764dffa4ed0aeaac95ee5dd",+ "together.state.waking": "a3d3562bfff4e14a3d0278540318e4948dc2eae6a34497112975d23c143cab4b",+ "together.state.offlineCloud": "5197d3d5dfa091deab2ed965ef02f829c81a2672402df657cacc82635d8da982",+ "together.state.offlineComputer": "6674e486fc361c62e6b2a88db89ca9fa42e8a85b6948cb1ad1c62fd54d0dea2c",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8",+ "together.state.signin": "010c70e3503b8907767eb9dd465788bb7698d05ccddc383e0685031935a70db2"},"zh-tw": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -57588,7 +57623,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"uk": {"pro.fromPrice": "a48a04a457d60b08b54fc83e7a6c4584ffedb1e23621859084900c8521a3af7b",@@ -61674,7 +61712,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"vi": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -67687,7 +67728,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"tr": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -73700,7 +73744,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"pl": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -80974,7 +81021,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"ru": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -88301,7 +88351,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"it": {"whop.description": "1a07cf04ef17029448d3781415cbac16d54e66b821907a40d94e0e6349710e70",@@ -95434,7 +95487,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"},"ko": {"connectedWorkspaces.localTitle": "7d6deafeab011d734c3fdd1bfd6f69544fbb746a004019269bdb48544b01164b",@@ -103228,7 +103284,10 @@"chat.notice.devinAccountRefused": "6f12d9c4c2912bc75bfbc26d0b43a2da3b02c1e4e16a807a9162670fcdab80fc","devices.computers.pairButton": "60f8288e33f9f57d2b51409fdb540b47a89c25447061bd354122442818a36ee0","devices.computers.pairTitle": "b7cda6a11ab410daa4b8977624ca72261c0168e7c3d83ae0eed93ac4e3540bc8",- "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174"+ "devices.computers.typeCode": "2a528dfe78f6b331e8cca951872961169ca6f340a886e40e84cc0b53d441c174",+ "together.switch.title": "2829f92e4a9012d2265d7a82806d5750743ca14c0600d688485825dd4272938a",+ "together.switch.line": "f1da9a3fe37ffcb0273f52889240d8e3d13709220eca9c08b5b923f9def19409",+ "together.switch.failed": "ad8287436402edb5c91ee0cc4bfe88f3301bac459a7d49e4cd2c564fa20aa1b8"}}}diff --git a/src/locales/tr.json b/src/locales/tr.jsonindex aa61ac5ec2..514d6c2d05 100644--- a/src/locales/tr.json+++ b/src/locales/tr.json@@ -6011,5 +6011,8 @@"devices.computers.pairButton": "Bilgisayar eşle","devices.computers.title": "Diğer bilgisayarlarınız","devices.computers.pairTitle": "Başka bir bilgisayar eşle",- "remote.tailscale.needsApproval": "Bu bilgisayar Tailscale ağınızda onay bekliyor. Tailscale yönetici konsolunda onaylayın, ardından tekrar deneyin."+ "remote.tailscale.needsApproval": "Bu bilgisayar Tailscale ağınızda onay bekliyor. Tailscale yönetici konsolunda onaylayın, ardından tekrar deneyin.",+ "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."}diff --git a/src/locales/uk.json b/src/locales/uk.jsonindex e576a1865a..c47a8a54ae 100644--- a/src/locales/uk.json+++ b/src/locales/uk.json@@ -4084,5 +4084,8 @@"devices.computers.pairButton": "Підключити комп’ютер","devices.computers.title": "Ваші інші комп’ютери","devices.computers.pairTitle": "Підключити інший комп’ютер",- "remote.tailscale.needsApproval": "Цей комп’ютер чекає на схвалення у вашій мережі Tailscale. Схваліть його в консолі адміністратора Tailscale, потім спробуйте ще раз."+ "remote.tailscale.needsApproval": "Цей комп’ютер чекає на схвалення у вашій мережі Tailscale. Схваліть його в консолі адміністратора Tailscale, потім спробуйте ще раз.",+ "together.switch.title": "Цей комп'ютер і Моя хмара разом",+ "together.switch.line": "Типово вимкнено. Боти з хмари й боти цього комп'ютера показані в одному списку, і кожен відкривається там, де він є.",+ "together.switch.failed": "Не вдалося зберегти. Спробуйте ще раз."}diff --git a/src/locales/vi.json b/src/locales/vi.jsonindex 621b3efe05..99310ec2bf 100644--- a/src/locales/vi.json+++ b/src/locales/vi.json@@ -6011,5 +6011,8 @@"devices.computers.pairButton": "Ghép nối máy tính","devices.computers.title": "Các máy tính khác của bạn","devices.computers.pairTitle": "Ghép nối máy tính khác",- "remote.tailscale.needsApproval": "Máy tính này đang chờ được phê duyệt trên mạng Tailscale của bạn. Hãy phê duyệt trong bảng điều khiển quản trị Tailscale, rồi thử lại."+ "remote.tailscale.needsApproval": "Máy tính này đang chờ được phê duyệt trên mạng Tailscale của bạn. Hãy phê duyệt trong bảng điều khiển quản trị Tailscale, rồi thử lại.",+ "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."}diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.jsonindex 120ccb6c56..750c360e69 100644--- a/src/locales/zh-tw.json+++ b/src/locales/zh-tw.json@@ -10350,5 +10350,8 @@"devices.computers.pairButton": "配對電腦","devices.computers.title": "你的其他電腦","devices.computers.pairTitle": "配對另一台電腦",- "remote.tailscale.needsApproval": "這台電腦正在等待你的 Tailscale 網路核准。請在 Tailscale 管理主控台中核准它,然後再試一次。"+ "remote.tailscale.needsApproval": "這台電腦正在等待你的 Tailscale 網路核准。請在 Tailscale 管理主控台中核准它,然後再試一次。",+ "together.switch.title": "這台電腦和 My Cloud 合在一起",+ "together.switch.line": "預設為關閉。Cloud 上的機器人和這台電腦上的機器人顯示在同一個清單中,各自在所在的位置開啟。",+ "together.switch.failed": "無法儲存。請再試一次。"}diff --git a/src/locales/zh.json b/src/locales/zh.jsonindex bb629010ce..7bae4de3b7 100644--- a/src/locales/zh.json+++ b/src/locales/zh.json@@ -10224,5 +10224,15 @@"devices.computers.pairButton": "配对电脑","devices.computers.title": "你的其他电脑","devices.computers.pairTitle": "配对另一台电脑",- "remote.tailscale.needsApproval": "这台电脑正在等待你的 Tailscale 网络批准。请在 Tailscale 管理控制台中批准它,然后重试。"+ "remote.tailscale.needsApproval": "这台电脑正在等待你的 Tailscale 网络批准。请在 Tailscale 管理控制台中批准它,然后重试。",+ "together.onCloud": "在 My Cloud 上",+ "together.onComputer": "在这台电脑上",+ "together.state.asleep": "My Cloud 已休眠。打开一个机器人即可唤醒。",+ "together.state.waking": "My Cloud 正在唤醒…",+ "together.state.offlineCloud": "现在无法连接 My Cloud。",+ "together.state.offlineComputer": "现在无法读取这台电脑上的机器人。",+ "together.switch.title": "这台电脑和 My Cloud 合在一起",+ "together.switch.line": "默认关闭。Cloud 上的机器人和这台电脑上的机器人显示在同一个列表中,各自在所在的位置打开。",+ "together.switch.failed": "未能保存。请重试。",+ "together.state.signin": "打开一次 My Cloud 以登录。"}diff --git a/src/types/ogb.d.ts b/src/types/ogb.d.tsindex 371daebab1..686380e4b2 100644--- a/src/types/ogb.d.ts+++ b/src/types/ogb.d.ts@@ -134,6 +134,8 @@ const __APP_VERSION__: string;dismiss(key: string): Promise<{ suggest: import("../lib/two-places").TwoPlacesSuggestion | null }>;onChanged(callback: () => void): () => void;};+ /** This computer's page and My Cloud's own page: the other one's bots in this sidebar (electron/places-together.mjs). */+ placesTogether?: import("../../electron/places-together.mjs").PlacesTogetherBridge;/** Settings on the person's own Cloud: the plan, read only. */cloudPlan?: import("../../electron/cloud-account.mjs").CloudPlanBridge;/** This computer's page, and My Cloud's own page once it is the person's home: the window onto My Cloud. */