Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Desktop: Open Settings File and Reload Settings in the app menu

milind-sonicf7237a2c157
diff --git a/electron/main.mjs b/electron/main.mjs
index fe61038e20..81be8d9b25 100644
--- a/electron/main.mjs
+++ b/electron/main.mjs
@@ -90,7 +90,7 @@ import capabilitiesModule from "./capabilities.cjs";
import environmentsModule from "./environments.cjs";
import { pairingPageUrl, vouchForPlainHttpServers } from "./server-address.mjs"; import { createServerConnect } from "./server-probe.mjs"; import { createTailnetShare, remotePolicyAllows } from "./tailnet-share.mjs"; import { checkTailscale } from "./tailscale-check.mjs"; import { onTailnet } from "./tailnet.mjs"; import { checkServer, createServerStatus, installServerStatus } from "./server-status.mjs"; import { installUpdateAll } from "./update-all.mjs"; import { createAppWindowSizes, installLocalAppWindows, isLocalAppWindow } from "./local-app-windows.mjs"; import { createDesktopAppInstaller, installAppInstall } from "./app-install/ipc.mjs"; import { createAppLaunches } from "./app-launches.mjs";
import localOriginModule from "./local-origin.cjs";
-import { buildApplicationMenu } from "./menu.mjs";
+import { buildApplicationMenu } from "./menu.mjs"; import { createSettingsFile, localPageShown } from "./settings-file.mjs";
import { createComputerSharing, isHomeFolder, validateSharedFolders } from "./computer-sharing.mjs"; import { isSystemDrive } from "./shared-drives.mjs"; import { installServerLending } from "./server-lending.mjs"; import { ownEnvironmentIds } from "./lent-mcp.mjs";
import { createHostScreenLease } from "./host-screen-lease.mjs";
import { acquireDataDirLease } from "./data-dir-lease.mjs";
@@ -1510,7 +1510,7 @@ function refreshApplicationMenu() {
onAddFromClipboard: () => void addServerFromClipboard(),
onConnect: () => void workspaceMenuAction(openWorkspaceSettings),
onOrganizationSignIn: () => queueOrganizationEntry("openmausbot://organization"),
- onForget: (id) => void workspaceMenuAction(() => forgetEnvironment(id)),
+ onForget: (id) => void workspaceMenuAction(() => forgetEnvironment(id)), settingsFile: { enabled: settingsFile.available(), onOpen: () => void settingsFile.open(), onReload: () => void settingsFile.reload() },
onOpenSettings: () => { if (mainWindow && !mainWindow.isDestroyed()) mainWindow.webContents.send("app:open-settings"); },
openAtLogin: loginItem.available() ? { checked: loginItem.chosen(), onToggle: on => { loginItem.choose(on); refreshApplicationMenu(); } } : null,
...cloudMenuOptions(),
@@ -2038,7 +2038,7 @@ function createWindow({ deferNavigation = false } = {}) {
});
void workspaceMenuAction(() => switchEnvironment(LOCAL_ID));
});
- win.webContents.on("did-navigate", (_event, url) => { homeWindow.navigated(url); placesTogether.navigated(homeOfUrl(url)); });
+ win.webContents.on("did-navigate", (_event, url) => { homeWindow.navigated(url); placesTogether.navigated(homeOfUrl(url)); if (settingsFile.flipped()) refreshApplicationMenu(); });
// Not did-finish-load: Electron still reports the main frame as loading then.
win.webContents.on("did-stop-loading", () => {
deliverPackageInstall(win);
@@ -2569,7 +2569,7 @@ const savedWorkspace = id => {
const cloudLook = createCloudLook({ store: lookFile(() => path.join(app.getPath("userData"), cloudTarget(process.env).look), fs), accountId: () => cloudAccount?.state().account?.id ?? null,
homeEntry: cloudHomeEntry, saveEntry: (origin, look) => persistEnvironments(withEnvironmentLook(environmentsState, origin, look)), listedName: () => homeLook(cloudAccount?.state())?.name ?? null });
const cloudBuy = installCloudBuy({ ipcMain, guard: localWorkspaceOnly, client: ensureCloudAccount, offersReady: cloudOffersReady, clipboard, look: cloudLook });
-const localServerRequest = (route, init = {}) => (serverProc && serverReady ? fetch(`http://127.0.0.1:${SERVER_PORT}${route}`, { ...init, redirect: "error", credentials: "omit", headers: { ...init.headers, [DESKTOP_MUTATION_HEADER]: desktopMutationToken } }) : Promise.reject(new Error("not running"))); launchRecord.deliverWith((part) => localServerRequest("/api/diagnostics/launch", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(part), signal: AbortSignal.timeout(5_000) }).then((res) => res.json()));
+const settingsFile = createSettingsFile({ here: () => localPageShown({ remoteAccess: Boolean(desktopRemoteAccess), pageUrl: mainWindow && !mainWindow.isDestroyed() ? mainWindow.webContents.getURL() : "", localOrigin: rendererOrigin(), homePath: HOME_SCREEN_PATH }), dataDir: () => runningDataDir ?? startupEnvironmentDir(environmentsState, desktopDataDir()), request: (...args) => localServerRequest(...args), shell, dialog, fs, t: nativeT, log: slog }); const localServerRequest = (route, init = {}) => (serverProc && serverReady ? fetch(`http://127.0.0.1:${SERVER_PORT}${route}`, { ...init, redirect: "error", credentials: "omit", headers: { ...init.headers, [DESKTOP_MUTATION_HEADER]: desktopMutationToken } }) : Promise.reject(new Error("not running"))); launchRecord.deliverWith((part) => localServerRequest("/api/diagnostics/launch", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(part), signal: AbortSignal.timeout(5_000) }).then((res) => res.json()));
const teamProfileSeeds = createTeamProfileSeeds({ teamFetch: (...args) => session.defaultSession.fetch(...args), localRequest: localServerRequest, log: slog });
const oneHome = installOneHome({ ipcMain, clean: cleanWorkspace, cloudPage: cloudPageAsking, pageOrigin: activePageOrigin, confirmMove: confirmTeamMove, server: () => serverProc, cookieFetch: (...args) => session.defaultSession.fetch(...args), home: () => (myCloud() && cloudAccount ? { origin: myCloud(), grant: () => cloudAccount.pairHome() } : null), power: cloudPower, file: () => path.join(app.getPath("userData"), "cloud-send.json"), localRequest: localServerRequest, space: { disk: () => cloudPlanDisk(ensureCloudAccount().state()), grow: sizeGb => ensureCloudAccount().growDisk(sizeGb) }, reconnect: origin => signInCloudSession({ origin, mine: myCloud(), pair: () => ensureCloudAccount().pairHome(), fetch: (...args) => session.defaultSession.fetch(...args) }), window: () => (desktopRemoteAccess ? null : mainWindow), localOrigin: rendererOrigin, account: () => cloudAccount, journalFile: () => path.join(app.getPath("userData"), "one-home.json"), tempRoot: () => path.join(app.getPath("temp"), "openmaus-one-home"), lend: projects => sharingController().lendProjects(projects), phone: { paired: () => companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady }), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: () => void showHome({ place: "cloud" }), openTeam: team => void showHome({ place: { team: team.id, name: team.name } }), openLocal: () => void showHome(), restart: () => relaunchAfterDesktopRemoteChange(), version: app.getVersion(), log: slog, other: () => ownHome, accountsHere: () => accountRing()?.count() ?? 1, chooses: true, t: nativeT, moveLending: () => ({ state: sharingController().cloudState(lendingTarget.environment()), paused: sharingController().paused() }), allowCommands: () => lendingDialogs.lendTerminal(true, () => sharingController().lendTerminal(true)) }); ownHome = installOwnHome({ t: nativeT, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, handoff: what => oneHome.handoff(what), cloudJournal: () => oneHome.journal(), journal: jsonFile(path.join(app.getPath("userData"), "own-home.json")), choice: jsonFile(path.join(app.getPath("userData"), "own-home-choice.json")), sendState: jsonFile(path.join(app.getPath("userData"), "own-home-send.json")), lend: (projects, place) => sharingController().lendProjects(projects, place), phone: { paired: () => companionStartsAtLaunch({ remoteClient: Boolean(desktopRemoteAccess), serverReady }), start: () => startDesktopCompanion({ waitForHosted: false, remember: false }).then(() => {}) }, openHome: place => void workspaceMenuAction(() => switchEnvironment(place.id)), lastInput: oneHome.lastInput, version: app.getVersion(), log: slog, onChange: () => { oneHome.publish(); computerSharing?.cloudChanged(); railChanged(); } }); botLink = createBotLinkMain({ wanted: () => placesTogether.on(), switchedOff: () => placesTogether.switchedOff(), chosen: () => placesTogether.chosen(), powerChecked: cloudAwakeNow, napped: () => cloudPower.hold(), proved: () => cloudPower.woke(), quietMs: START_QUIET_MS, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), cloud: () => ({ origin: myCloud(), account: cloudAccount?.state().account?.id ?? null, asleep: cloudPower.asleep(), since: cloudAccount?.power()?.since ?? null, signedOut: cloudAccount?.state().status === "signed-out" }), cloudName: () => nativeT("cloudSetup.myCloud"), changed: () => placesTogether.linkChanged(), log: slog }); twoPlaces = installTwoPlacesMain({ t: nativeT, ipcMain, guard: localWorkspaceOnly, localRequest: localServerRequest, fetch: (...args) => session.defaultSession.fetch(...args), environments: () => environmentsState.environments, cloud: () => ({ origin: myCloud(), asleep: cloudPower.asleep() }), oneHome, ownHome, dismissed: jsonFile(path.join(app.getPath("userData"), "two-places.json")), lastRead: jsonFile(path.join(app.getPath("userData"), "two-places-read.json")), account: () => cloudAccount, teamsRemembered: jsonFile(path.join(app.getPath("userData"), "team-places.json")), together: () => { try { return placesTogether.on(); } catch { return false; } }, awakeNow: async () => (await cloudAwakeNow()) && !cloudPower.asleep(), log: slog, tell: () => { if (mainWindow && !mainWindow.isDestroyed() && senderIsLocal({ sender: mainWindow.webContents })) mainWindow.webContents.send("two-places:changed"); } });
// Teams from the verified session as places this window shows (home-places.mjs): the one to open next time, and its lines.
diff --git a/electron/menu.mjs b/electron/menu.mjs
index fa3718a0bb..5d7d9ab12e 100644
--- a/electron/menu.mjs
+++ b/electron/menu.mjs
@@ -83,8 +83,10 @@ const whereItLives = (environment) => (environment.kind === "local" ? environmen
* @param {(key: string, params?: Record<string, string | number>) => string} [input.t]
* @param {{ checked: boolean, onToggle: (on: boolean) => void } | null} [input.openAtLogin] Open at Login, in the app
* menu on macOS and the File menu elsewhere; absent when this build cannot add a login item.
+ * @param {{ enabled: boolean, onOpen: () => void, onReload: () => void } | null} [input.settingsFile] Open Settings File and
+ * Reload Settings, beside Settings… on macOS and in the File menu elsewhere; off unless This computer is on screen.
*/
-export function buildApplicationMenu({ environments, activeId, onSwitch, onAddFromClipboard, onConnect, onForget, onOpenSettings, onOrganizationSignIn, onAddCloud, sublabels = {}, home = null, localPlace = true, openAtLogin = null, t = nativeText.englishText.t }) {
+export function buildApplicationMenu({ environments, activeId, onSwitch, onAddFromClipboard, onConnect, onForget, onOpenSettings, onOrganizationSignIn, onAddCloud, sublabels = {}, home = null, localPlace = true, openAtLogin = null, settingsFile = null, t = nativeText.englishText.t }) {
const isMac = process.platform === "darwin";
const active = environments.find((e) => e.id === activeId) ?? null;
const others = home ? environments.filter((e) => e.origin !== home.origin && e.kind !== "local") : [];
@@ -125,13 +127,19 @@ export function buildApplicationMenu({ environments, activeId, onSwitch, onAddFr
const atLogin = openAtLogin ? [{ id: "open-at-login", label: t("native.menu.openAtLogin"), type: "checkbox", checked: openAtLogin.checked, click: () => openAtLogin.onToggle(!openAtLogin.checked) }] : [];
const roles = roleMenus(t, isMac);
const settings = { label: t("native.menu.settings"), accelerator: "CmdOrCtrl+,", click: () => onOpenSettings() };
- const file = !isMac && openAtLogin ? { ...roles.file, submenu: [...atLogin, { type: "separator" }, role(t, "quit", "native.role.quit")] } : roles.file;
+ const fileItems = settingsFile ? [
+ { id: "open-settings-file", label: t("native.menu.openSettingsFile"), enabled: settingsFile.enabled, click: () => settingsFile.onOpen() },
+ { id: "reload-settings", label: t("native.menu.reloadSettings"), enabled: settingsFile.enabled, click: () => settingsFile.onReload() },
+ ] : [];
+ const roleFile = !isMac && openAtLogin ? { ...roles.file, submenu: [...atLogin, { type: "separator" }, role(t, "quit", "native.role.quit")] } : roles.file;
+ const file = !isMac && fileItems.length ? { ...roleFile, submenu: [...fileItems, { type: "separator" }, ...roleFile.submenu] } : roleFile;
if (!isMac) file.submenu.push({ ...settings, visible: false });
const appMenu = {
label: app.name,
submenu: [
role(t, "about", "native.role.about", { app: app.name }),
settings,
+ ...fileItems,
...atLogin,
{ type: "separator" },
role(t, "hide", "native.role.hide", { app: app.name }),
diff --git a/electron/menu.test.mjs b/electron/menu.test.mjs
index 4cc7cf3c05..dd423dde89 100644
--- a/electron/menu.test.mjs
+++ b/electron/menu.test.mjs
@@ -83,6 +83,40 @@ describe("buildApplicationMenu", () => {
},
);
+ const settingsFileItems = (template) => template.flatMap((menu) => (menu.submenu ?? []).filter((entry) => entry.id === "open-settings-file" || entry.id === "reload-settings").map((entry) => ({ menu: menu.label, entry })));
+
+ it.each([["darwin", false], ["darwin", true], ["linux", false], ["linux", true], ["win32", false], ["win32", true]])(
+ "offers Open Settings File and Reload Settings on %s (Open at Login: %s), beside Settings… on macOS and in the File menu elsewhere",
+ (platform, loginItem) => {
+ const onOpen = vi.fn(), onReload = vi.fn();
+ const template = build(platform, { settingsFile: { enabled: true, onOpen, onReload }, openAtLogin: loginItem ? { checked: false, onToggle: vi.fn() } : null });
+ const found = settingsFileItems(template);
+ expect(found.map(({ menu, entry }) => [menu, entry.label, entry.enabled, entry.visible])).toEqual([
+ [platform === "darwin" ? "OpenMausBot" : "File", "Open Settings File", true, undefined],
+ [platform === "darwin" ? "OpenMausBot" : "File", "Reload Settings", true, undefined],
+ ]);
+ const submenu = template[0].submenu;
+ if (platform === "darwin") {
+ const at = submenu.findIndex((entry) => entry.label === "Settings…");
+ expect(submenu.slice(at + 1, at + 3).map((entry) => entry.id)).toEqual(["open-settings-file", "reload-settings"]);
+ } else {
+ expect(submenu.slice(0, 3).map((entry) => entry.id ?? entry.type)).toEqual(["open-settings-file", "reload-settings", "separator"]);
+ expect(submenu.filter((entry) => entry.visible !== false).at(-1).role).toBe("quit");
+ expect(submenu.filter((entry) => entry.accelerator === "CmdOrCtrl+,")).toHaveLength(1);
+ }
+ found[0].entry.click();
+ found[1].entry.click();
+ expect(onOpen).toHaveBeenCalledOnce();
+ expect(onReload).toHaveBeenCalledOnce();
+ },
+ );
+
+ it.each(["darwin", "linux", "win32"])("greys both items out on %s while a Cloud, a team or another server is on screen", (platform) => {
+ const template = build(platform, { settingsFile: { enabled: false, onOpen: vi.fn(), onReload: vi.fn() } });
+ expect(settingsFileItems(template).map(({ entry }) => entry.enabled)).toEqual([false, false]);
+ expect(settingsFileItems(build(platform))).toEqual([]);
+ });
+
it.each(["linux", "win32"])("does not add an app menu on %s", (platform) => {
const template = build(platform);
expect(template[0].role).toBe("fileMenu");
diff --git a/electron/settings-file.mjs b/electron/settings-file.mjs
new file mode 100644
index 0000000000..253403fdf6
--- /dev/null
+++ b/electron/settings-file.mjs
@@ -0,0 +1,80 @@
+// Open Settings File and Reload Settings (menu.mjs): This computer's config.json, opened in the app the system picks for
+// it, and read again by the running server (server/routes/config-reload.ts). Nothing here writes the file or shows
+// what is in it: it may hold keys.
+import path from "node:path";
+
+export const CONFIG_RELOAD_PATH = "/api/config/reload";
+
+/** This computer's own page is on screen: not My Cloud, a team's Cloud, another server or the screen shown while one
+ * wakes, and not this app opened as a remote client of another computer. */
+export function localPageShown({ remoteAccess, pageUrl, localOrigin, homePath }) {
+ if (remoteAccess || !pageUrl) return false;
+ try {
+ const page = new URL(pageUrl);
+ return page.origin === localOrigin && page.pathname !== homePath;
+ } catch {
+ return false;
+ }
+}
+
+/**
+ * @param {object} deps
+ * @param {() => boolean} deps.here This computer's own server is the place on screen; the file of a Cloud or another
+ * server is not on this computer.
+ * @param {() => string} deps.dataDir The data folder of the server running here now (a profile's own when one runs).
+ * @param {(route: string, init?: RequestInit) => Promise<Response>} deps.request The app's own request to that server.
+ * @param {{ openPath(file: string): Promise<string>, showItemInFolder(file: string): void }} deps.shell
+ * @param {{ showMessageBox(options: object): Promise<unknown> }} deps.dialog
+ * @param {{ existsSync(file: string): boolean }} deps.fs
+ * @param {(key: string, params?: Record<string, string | number>) => string} deps.t
+ * @param {(line: string) => void} [deps.log]
+ */
+export function createSettingsFile({ here, dataDir, request, shell, dialog, fs, t, log = () => {} }) {
+ const file = () => path.join(dataDir(), "config.json");
+ const tell = (type, message, detail) => dialog.showMessageBox({ type, message, ...(detail ? { detail } : {}) });
+ const notHere = () => tell("info", t("native.dialog.settingsFile.notHere"), t("native.dialog.settingsFile.notHereDetail"));
+ const missing = () => tell("info", t("native.dialog.settingsFile.missing"), t("native.dialog.settingsFile.missingDetail"));
+
+ async function open() {
+ if (!here()) return notHere();
+ const target = file();
+ // Never created here: a file that is not there yet is said so.
+ if (!fs.existsSync(target)) return missing();
+ const failed = await shell.openPath(target).catch((error) => String(error?.message ?? error) || "failed");
+ if (!failed) return;
+ log(`settings file: no app opened it (${failed}); showing it in its folder`);
+ shell.showItemInFolder(target);
+ }
+
+ async function reload() {
+ if (!here()) return notHere();
+ let said = null;
+ try {
+ const res = await request(CONFIG_RELOAD_PATH, { method: "POST", signal: AbortSignal.timeout(15_000) });
+ said = await res.json().catch(() => null);
+ } catch (error) {
+ log(`settings reload: ${error?.message ?? error}`);
+ }
+ if (said?.ok === true) {
+ const applied = Array.isArray(said.applied) ? said.applied : [], restart = Array.isArray(said.restart) ? said.restart : [];
+ const lines = [
+ ...(applied.length ? [t("native.dialog.settingsReload.applied", { sections: applied.join(", ") })] : []),
+ ...(restart.length ? [t("native.dialog.settingsReload.restart", { sections: restart.join(", ") })] : []),
+ ];
+ return tell("info", t("native.dialog.settingsReload.done"), lines.length ? lines.join("\n\n") : t("native.dialog.settingsReload.unchanged"));
+ }
+ if (said?.ok === false && said.code === "missing") return missing();
+ const why = typeof said?.error === "string" ? said.error : t("native.dialog.settingsReload.notRunning");
+ return tell("warning", t("native.dialog.settingsReload.failed"), `${why}\n\n${t("native.dialog.settingsReload.keptLast")}`);
+ }
+
+ let shown = null;
+ return {
+ open,
+ reload,
+ /** Whether the menu items are on; the menu is built with this. */
+ available: () => (shown = here()),
+ /** After the window moved to another page: true when the menu needs building again. */
+ flipped: () => here() !== shown,
+ };
+}
diff --git a/electron/settings-file.node-test.mjs b/electron/settings-file.node-test.mjs
new file mode 100644
index 0000000000..a4fbdabe77
--- /dev/null
+++ b/electron/settings-file.node-test.mjs
@@ -0,0 +1,136 @@
+import assert from "node:assert/strict";
+import path from "node:path";
+import { test } from "node:test";
+
+import nativeText from "./native-text.cjs";
+import { CONFIG_RELOAD_PATH, createSettingsFile, localPageShown } from "./settings-file.mjs";
+
+const DATA = path.join(path.sep, "fake", "profile-data");
+const FILE = path.join(DATA, "config.json");
+const { t } = nativeText.englishText;
+
+/** Every outside effect is a fake: no real file is opened and no server is asked. */
+function harness({ here = true, exists = true, opened = "", answer = null, refuse = false } = {}) {
+ const calls = { openPath: [], shown: [], dialogs: [], requests: [], logs: [] };
+ const settingsFile = createSettingsFile({
+ here: () => (typeof here === "function" ? here() : here),
+ dataDir: () => DATA,
+ request: async (route, init) => {
+ calls.requests.push([route, init.method]);
+ if (refuse) throw new Error("not running");
+ return { json: async () => answer };
+ },
+ shell: {
+ openPath: async (file) => { calls.openPath.push(file); if (opened instanceof Error) throw opened; return opened; },
+ showItemInFolder: (file) => { calls.shown.push(file); },
+ },
+ dialog: { showMessageBox: async (options) => { calls.dialogs.push(options); return { response: 0 }; } },
+ fs: { existsSync: (file) => file === FILE && exists },
+ t,
+ log: (line) => calls.logs.push(line),
+ });
+ return { settingsFile, calls };
+}
+
+test("opens this computer's config.json with the system's app, and nothing else", async () => {
+ const { settingsFile, calls } = harness();
+ await settingsFile.open();
+ assert.deepEqual(calls.openPath, [FILE]);
+ assert.deepEqual(calls.shown, []);
+ assert.deepEqual(calls.dialogs, []);
+});
+
+test("shows the file in its folder when no app opens it", async () => {
+ for (const opened of ["No application knows how to open this file", new Error("spawn failed")]) {
+ const { settingsFile, calls } = harness({ opened });
+ await settingsFile.open();
+ assert.deepEqual(calls.openPath, [FILE]);
+ assert.deepEqual(calls.shown, [FILE]);
+ assert.deepEqual(calls.dialogs, []);
+ }
+});
+
+test("says there is no file yet rather than making one", async () => {
+ const { settingsFile, calls } = harness({ exists: false });
+ await settingsFile.open();
+ assert.deepEqual(calls.openPath, []);
+ assert.deepEqual(calls.shown, []);
+ assert.equal(calls.dialogs.length, 1);
+ assert.equal(calls.dialogs[0].message, "There's no settings file yet");
+ assert.match(calls.dialogs[0].detail, /config\.json/);
+});
+
+test("does nothing to a file while another place is on screen, and says why", async () => {
+ const { settingsFile, calls } = harness({ here: false });
+ await settingsFile.open();
+ await settingsFile.reload();
+ assert.deepEqual(calls.openPath, []);
+ assert.deepEqual(calls.requests, []);
+ assert.deepEqual(calls.dialogs.map((options) => options.message), [
+ "This place's settings file isn't on this computer",
+ "This place's settings file isn't on this computer",
+ ]);
+});
+
+test("a reload that applied settings says which, and which wait for a restart", async () => {
+ const { settingsFile, calls } = harness({ answer: { ok: true, applied: ["features", "rooms"], restart: ["instances"] } });
+ await settingsFile.reload();
+ assert.deepEqual(calls.requests, [[CONFIG_RELOAD_PATH, "POST"]]);
+ assert.equal(calls.dialogs.length, 1);
+ assert.equal(calls.dialogs[0].type, "info");
+ assert.equal(calls.dialogs[0].message, "Settings reloaded");
+ assert.equal(calls.dialogs[0].detail, "Now in use: features, rooms\n\nQuit and reopen the app to use: instances");
+});
+
+test("a reload with nothing changed still says so in one dialog", async () => {
+ const { settingsFile, calls } = harness({ answer: { ok: true, applied: [], restart: [] } });
+ await settingsFile.reload();
+ assert.deepEqual(calls.dialogs.map((options) => [options.message, options.detail]), [["Settings reloaded", "Nothing in the settings file changed."]]);
+});
+
+test("a bad file is reported in plain words with its line, and the last good settings stay", async () => {
+ const error = "config.json line 12, column 5: unexpected } (a comma before it may be extra)";
+ const { settingsFile, calls } = harness({ answer: { ok: false, code: "json", error } });
+ await settingsFile.reload();
+ assert.equal(calls.dialogs.length, 1);
+ assert.equal(calls.dialogs[0].type, "warning");
+ assert.equal(calls.dialogs[0].message, "Settings not reloaded");
+ assert.ok(calls.dialogs[0].detail.startsWith(`${error}\n\n`));
+ assert.match(calls.dialogs[0].detail, /last settings that worked are still in use/);
+});
+
+test("a schema error, a missing file and a server that does not answer each get one dialog", async () => {
+ const schema = harness({ answer: { ok: false, code: "schema", error: "config.json: rooms.turnTimeoutMinutes Too big" } });
+ await schema.settingsFile.reload();
+ assert.match(schema.calls.dialogs[0].detail, /^config\.json: rooms\.turnTimeoutMinutes Too big/);
+ const missing = harness({ answer: { ok: false, code: "missing", error: "There is no config.json on this computer yet." } });
+ await missing.settingsFile.reload();
+ assert.deepEqual(missing.calls.dialogs.map((options) => options.message), ["There's no settings file yet"]);
+ const down = harness({ refuse: true });
+ await down.settingsFile.reload();
+ assert.equal(down.calls.dialogs.length, 1);
+ assert.match(down.calls.dialogs[0].detail, /isn't answering/);
+ assert.equal(down.calls.logs.length, 1);
+});
+
+test("only This computer's own page counts as here", () => {
+ const local = { remoteAccess: false, localOrigin: "http://127.0.0.1:8799", homePath: "/__home" };
+ assert.equal(localPageShown({ ...local, pageUrl: "http://127.0.0.1:8799/chat/abc" }), true);
+ assert.equal(localPageShown({ ...local, pageUrl: "http://127.0.0.1:8799/__home" }), false, "the screen shown while a Cloud wakes");
+ assert.equal(localPageShown({ ...local, pageUrl: "https://omb-u-1.fly.dev/" }), false, "My Cloud");
+ assert.equal(localPageShown({ ...local, pageUrl: "https://team.example.test/" }), false, "a team's Cloud");
+ assert.equal(localPageShown({ ...local, pageUrl: "" }), false, "nothing loaded yet");
+ assert.equal(localPageShown({ ...local, pageUrl: "http://127.0.0.1:8799/", remoteAccess: true }), false, "a remote client");
+});
+
+test("the menu is built again only when here changes", () => {
+ let here = true;
+ const { settingsFile } = harness({ here: () => here });
+ assert.equal(settingsFile.flipped(), true, "not built yet");
+ assert.equal(settingsFile.available(), true);
+ assert.equal(settingsFile.flipped(), false);
+ here = false;
+ assert.equal(settingsFile.flipped(), true);
+ assert.equal(settingsFile.available(), false);
+ assert.equal(settingsFile.flipped(), false);
+});
diff --git a/server/config-reload.e2e.test.ts b/server/config-reload.e2e.test.ts
new file mode 100644
index 0000000000..c570491152
--- /dev/null
+++ b/server/config-reload.e2e.test.ts
@@ -0,0 +1,54 @@
+import { randomBytes } from "node:crypto";
+import { readFileSync, writeFileSync } from "node:fs";
+import { join } from "node:path";
+import { afterAll, beforeAll, describe, expect, it } from "vitest";
+
+import { launchVerificationServer, type VerificationServer } from "../scripts/control-omb.ts";
+
+describe("Reload Settings in the desktop app's menu", () => {
+ let fixture: VerificationServer;
+ const owner = randomBytes(32).toString("base64url");
+ const SECRET = "sk-e2e-never-shown-77";
+ const file = () => join(fixture.info.dataDir, "config.json");
+ const saved = () => { try { return JSON.parse(readFileSync(file(), "utf8")) as Record<string, unknown>; } catch { return {}; } };
+ const call = async (method: string, path: string, headers: Record<string, string> = {}) => {
+ const response = await fetch(`${fixture.info.url}${path}`, { method, headers: { "x-openmausbot-desktop-owner": owner, ...headers } });
+ return { status: response.status, body: await response.json().catch(() => ({})) as Record<string, any> };
+ };
+
+ beforeAll(async () => {
+ const realFetch = globalThis.fetch;
+ globalThis.fetch = (input, init = {}) => realFetch(input, { ...init, headers: { ...Object.fromEntries(new Headers(init.headers)), "x-openmausbot-desktop-owner": owner } });
+ try {
+ fixture = await launchVerificationServer({ ...process.env, OMB_TEST_DESKTOP_OWNER_TOKEN: owner });
+ } finally {
+ globalThis.fetch = realFetch;
+ }
+ });
+ afterAll(async () => {
+ await fixture?.close();
+ });
+
+ it("puts a hand edit in use, keeps the settings on a broken file, and answers only the app's own main process", async () => {
+ writeFileSync(file(), JSON.stringify({ ...saved(), everyBotRules: "Answer in one line.", rooms: { turnTimeoutMinutes: 42 } }, null, 2));
+ const reloaded = await call("POST", "/api/config/reload");
+ expect(reloaded.status).toBe(200);
+ expect(reloaded.body).toMatchObject({ ok: true, restart: [] });
+ expect(reloaded.body.applied).toEqual(expect.arrayContaining(["everyBotRules", "rooms"]));
+ expect((await call("GET", "/api/config")).body).toMatchObject({ everyBotRules: "Answer in one line.", rooms: { turnTimeoutMinutes: 42 } });
+
+ const good = readFileSync(file(), "utf8");
+ writeFileSync(file(), good.replace('"everyBotRules"', `"anthropic": { "key": "${SECRET}" }\n "everyBotRules"`));
+ const broken = await call("POST", "/api/config/reload");
+ expect(broken.status).toBe(422);
+ expect(broken.body).toMatchObject({ ok: false, code: "json" });
+ expect(broken.body.error).toMatch(/^config\.json line \d+, column \d+: /);
+ expect(JSON.stringify(broken.body)).not.toContain(SECRET);
+ expect((await call("GET", "/api/config")).body).toMatchObject({ everyBotRules: "Answer in one line.", rooms: { turnTimeoutMinutes: 42 } });
+
+ writeFileSync(file(), good);
+ // The app's own page sends the owner capability too, but as a browser: a page may not reload.
+ expect((await call("POST", "/api/config/reload", { origin: fixture.info.url, "sec-fetch-site": "same-origin" })).status).toBe(403);
+ expect((await call("POST", "/api/config/reload", { "x-openmausbot-desktop-owner": "" })).status).toBe(403);
+ });
+});
diff --git a/server/config-reload.test.ts b/server/config-reload.test.ts
new file mode 100644
index 0000000000..3c3d0ca667
--- /dev/null
+++ b/server/config-reload.test.ts
@@ -0,0 +1,116 @@
+import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { join } from "node:path";
+import { afterEach, beforeEach, describe, expect, it } from "vitest";
+
+import { DATA_DIR, engineLaunches, instanceConfigs, loadConfig, type AppConfig } from "./config.ts";
+import { jsonErrorMessage, jsonErrorOffset, reloadConfig, RESTART_SECTIONS } from "./config-reload.ts";
+
+const FILE = join(DATA_DIR, "config.json");
+const SECRET = "sk-test-do-not-show-9f2c";
+const write = (value: unknown) => writeFileSync(FILE, typeof value === "string" ? value : `${JSON.stringify(value, null, 2)}\n`);
+const reload = (cfg: AppConfig) => reloadConfig({ cfg, read: () => readFileSync(FILE, "utf8"), load: loadConfig, engines: (config) => engineLaunches(instanceConfigs(config)) });
+
+beforeEach(() => mkdirSync(DATA_DIR, { recursive: true }));
+afterEach(() => rmSync(FILE, { force: true }));
+
+describe("reloadConfig", () => {
+ it("applies a hand edit to the settings every request reads, in place, and drops a section the file no longer has", () => {
+ write({ rooms: { turnTimeoutMinutes: 5 }, everyBotRules: "Be brief.", memory: { tidyHour: 3 } });
+ const cfg = loadConfig();
+ const same = cfg;
+ write({ rooms: { turnTimeoutMinutes: 30 }, memory: { tidyHour: 3 }, threadTitles: { followUp: true } });
+ expect(reload(cfg)).toEqual({ ok: true, applied: ["everyBotRules", "rooms", "threadTitles"], restart: [] });
+ expect(cfg).toBe(same);
+ expect(cfg.rooms?.turnTimeoutMinutes).toBe(30);
+ expect(cfg.threadTitles).toEqual({ followUp: true });
+ expect(Object.hasOwn(cfg, "everyBotRules")).toBe(false);
+ expect(reload(cfg)).toEqual({ ok: true, applied: [], restart: [] });
+ });
+
+ it("keeps the running settings when the JSON is broken, and says where in words that never quote the file", () => {
+ write({ everyBotRules: "Be brief.", anthropic: { key: SECRET } });
+ const cfg = loadConfig();
+ const before = structuredClone(cfg);
+ // Each of V8's messages for these quotes the file or names no line; the reply must do neither.
+ const broken = [
+ `{\n "everyBotRules": "Be brief.",\n "anthropic": { "key": "${SECRET}" },\n}\n`,
+ `{\n "everyBotRules": "Be brief."\n "anthropic": { "key": ${SECRET} }\n}\n`,
+ `{\n "anthropic": { "key": "${SECRET}`,
+ ];
+ const results = broken.map((text) => { write(text); return reload(cfg); });
+ expect(results).toEqual([
+ { ok: false, code: "json", error: "config.json line 4, column 1: unexpected } (a comma before it may be extra)" },
+ { ok: false, code: "json", error: "config.json line 3, column 3: unexpected quote (a comma before it may be missing)" },
+ { ok: false, code: "json", error: "config.json line 2, column 50: the file ends before the settings do (a } or ] may be missing)" },
+ ]);
+ for (const result of results) expect(JSON.stringify(result)).not.toContain(SECRET.slice(3, 10));
+ expect(cfg).toEqual(before);
+ });
+
+ it("keeps the running settings on a setting the schema refuses, and names the field", () => {
+ write({ rooms: { turnTimeoutMinutes: 5 } });
+ const cfg = loadConfig();
+ write({ rooms: { turnTimeoutMinutes: 99_999 }, anthropic: { key: SECRET } });
+ const result = reload(cfg);
+ expect(result).toMatchObject({ ok: false, code: "schema" });
+ expect(result.ok ? "" : result.error).toMatch(/^config\.json: rooms\.turnTimeoutMinutes /);
+ expect(JSON.stringify(result)).not.toContain(SECRET);
+ expect(cfg.rooms?.turnTimeoutMinutes).toBe(5);
+ });
+
+ it("says when there is no file, and makes none", () => {
+ const cfg = loadConfig();
+ expect(reload(cfg)).toEqual({ ok: false, code: "missing", error: "There is no config.json on this computer yet." });
+ expect(() => readFileSync(FILE)).toThrow();
+ });
+
+ it("holds back sections a save changes with more than the value, and the engines, until a restart", () => {
+ write({ everyBotRules: "Be brief." });
+ const cfg = loadConfig();
+ const before = structuredClone(cfg);
+ write({
+ everyBotRules: "Be kind.",
+ signIn: { admins: ["[email protected]"] },
+ features: { browser: false },
+ instances: { claude: { driver: "claude", enabled: true } },
+ });
+ expect(reload(cfg)).toEqual({ ok: true, applied: ["everyBotRules"], restart: ["features", "instances", "signIn"] });
+ expect(cfg.signIn).toEqual(before.signIn);
+ expect(cfg.instances).toEqual(before.instances);
+ expect(cfg.features).toEqual(before.features);
+ expect(cfg.everyBotRules).toBe("Be kind.");
+ });
+
+ it("applies a feature switch that closes nothing", () => {
+ write({ features: { browser: true } });
+ const cfg = loadConfig();
+ write({ features: { browser: true, showToolCalls: true } });
+ expect(reload(cfg)).toMatchObject({ ok: true, applied: ["features"], restart: [] });
+ expect(cfg.features).toMatchObject({ browser: true, showToolCalls: true });
+ });
+
+ it("lists sections the app reads only at start or changes with side effects", () => {
+ for (const section of ["instances", "signIn", "browserEngine", "browserProfiles", "localVm", "box", "customDomain", "cliStartup"]) expect(RESTART_SECTIONS.has(section), section).toBe(true);
+ for (const section of ["rooms", "everyBotRules", "memory", "threadTitles", "mcpServers"]) expect(RESTART_SECTIONS.has(section), section).toBe(false);
+ });
+});
+
+describe("jsonErrorOffset", () => {
+ it("agrees with JSON.parse on what is valid", () => {
+ const samples = [
+ "{}", "[]", '{"a":1}', '{"a": [1, 2.5, -3e2, true, false, null, "x\\u00e9\\n"]}', " \n{ }\n ", "0", '"\\/"',
+ "", "{", '{"a":1,}', "[1,]", '{"a" 1}', "{a:1}", '{"a":01}', '{"a":1.}', '{"a":"\\x"}', '{"a":"\t"}', '{"a":tru}', '{"a":1} x', "[1 2]", "-", "1e", '{"a":"\\u12"}',
+ ];
+ for (const text of samples) {
+ let valid = true;
+ try { JSON.parse(text); } catch { valid = false; }
+ expect(jsonErrorOffset(text) === -1, JSON.stringify(text)).toBe(valid);
+ }
+ });
+
+ it("points at the first character JSON stops at", () => {
+ expect(jsonErrorOffset('{"a":1,}')).toBe(7);
+ expect(jsonErrorOffset("[1 2]")).toBe(3);
+ expect(jsonErrorMessage('{\n "a": 1\n "b": 2\n}')).toBe("config.json line 3, column 3: unexpected quote (a comma before it may be missing)");
+ });
+});
diff --git a/server/config-reload.ts b/server/config-reload.ts
new file mode 100644
index 0000000000..9be0fa4c45
--- /dev/null
+++ b/server/config-reload.ts
@@ -0,0 +1,161 @@
+// Settings → Reload from the desktop menu: config.json, edited by hand, read again into the running server. Nothing is
+// written, a bad file leaves the running settings as they were, and no reply ever carries a value from the file.
+import { isDeepStrictEqual } from "node:util";
+
+import { parseStoredConfig, type AppConfig } from "./config.ts";
+import { parseJson } from "./schema.ts";
+
+export type ConfigReloadResult =
+ | { ok: true; applied: string[]; restart: string[] }
+ | { ok: false; code: "missing" | "unreadable" | "json" | "schema"; error: string };
+
+/** Sections a save changes with more than the new value (closing browsers, ending sign-ins, restarting engines or
+ * timers, server/routes/config.ts after the save and the onConfigSaved listeners) or that only starting reads. A
+ * reload leaves them as they run now; quitting and reopening applies them. */
+export const RESTART_SECTIONS: ReadonlySet<string> = new Set([
+ "instances", "opencodeGo", // engines are started with them
+ "browserEngine", "browserProfiles", // a running browser is closed or moved
+ "localVm", "vpsIdle", "vps", "vpsServers", "box", // computers and their idle timers
+ "signIn", // signed-in people are checked again
+ "cacheKeepWarm", "threads", "postiz", // their own timers and queues
+ "customDomain", "cliStartup", // read when the server starts
+]);
+/** features.* flags whose change closes something that is open (a viewer, a lent computer, a phone being watched). */
+const RESTART_FEATURES = ["browser", "sharedComputers", "usbPhoneTakeover"] as const;
+
+const NAME = "config.json";
+
+/** The offset of the first character strict JSON rejects, or -1. Written out so the error never quotes the file: a
+ * JSON.parse message can carry a piece of it, and config.json holds keys. */
+export function jsonErrorOffset(text: string): number {
+ let at = 0;
+ const fail = (): never => { throw new JsonStop(at); };
+ const space = () => { while (at < text.length && " \t\n\r".includes(text[at]!)) at++; };
+ const expect = (char: string) => { if (text[at] !== char) fail(); at++; };
+ const string = () => {
+ expect('"');
+ while (at < text.length) {
+ const char = text[at]!;
+ if (char === '"') { at++; return; }
+ if (char < " ") fail();
+ if (char === "\\") {
+ const next = text[at + 1];
+ if (next !== undefined && '"\\/bfnrt'.includes(next)) at += 2;
+ else if (next === "u" && /^[0-9a-fA-F]{4}$/.test(text.slice(at + 2, at + 6))) at += 6;
+ else { at++; fail(); }
+ continue;
+ }
+ at++;
+ }
+ fail();
+ };
+ const value = (): void => {
+ space();
+ const char = text[at];
+ if (char === "{" || char === "[") {
+ const close = char === "{" ? "}" : "]";
+ at++; space();
+ if (text[at] === close) { at++; return; }
+ for (;;) {
+ if (close === "}") { space(); string(); space(); expect(":"); }
+ value(); space();
+ if (text[at] === ",") { at++; continue; }
+ expect(close);
+ return;
+ }
+ }
+ if (char === '"') return string();
+ const number = /-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
+ number.lastIndex = at;
+ const matched = number.exec(text)?.[0];
+ if (matched) { at += matched.length; return; }
+ for (const word of ["true", "false", "null"]) if (text.startsWith(word, at)) { at += word.length; return; }
+ fail();
+ };
+ try {
+ value(); space();
+ if (at < text.length) fail();
+ return -1;
+ } catch (error) {
+ if (error instanceof JsonStop) return error.at;
+ throw error;
+ }
+}
+class JsonStop { readonly at: number; constructor(at: number) { this.at = at; } }
+
+/** "config.json line 12, column 5: …", from where the JSON breaks, in words that never quote it. */
+export function jsonErrorMessage(text: string): string {
+ const offset = Math.max(0, jsonErrorOffset(text));
+ const before = text.slice(0, offset);
+ const line = before.split("\n").length;
+ const column = offset - (before.lastIndexOf("\n") + 1) + 1;
+ const reason = offset >= text.length ? "the file ends before the settings do (a } or ] may be missing)"
+ : text[offset] === "}" || text[offset] === "]" ? `unexpected ${text[offset]} (a comma before it may be extra)`
+ : text[offset] === "," ? "unexpected comma"
+ : text[offset] === '"' ? "unexpected quote (a comma before it may be missing)"
+ : "this is not valid JSON here (check for a missing comma, quote or bracket)";
+ return `${NAME} line ${line}, column ${column}: ${reason}`;
+}
+
+export interface ConfigReloadDeps {
+ /** The live settings every request reads; changed in place. */
+ cfg: AppConfig;
+ /** config.json's text; throws ENOENT when there is none. */
+ read(): string;
+ /** The settings as the server builds them from the file and its environment (loadConfig). */
+ load(): AppConfig;
+ /** What the server would launch for each engine under these settings (engineLaunches). */
+ engines(config: AppConfig): Record<string, unknown>;
+}
+
+export function reloadConfig({ cfg, read, load, engines }: ConfigReloadDeps): ConfigReloadResult {
+ let text: string;
+ try {
+ text = read();
+ } catch (error) {
+ const missing = (error as NodeJS.ErrnoException | undefined)?.code === "ENOENT";
+ return missing
+ ? { ok: false, code: "missing", error: `There is no ${NAME} on this computer yet.` }
+ : { ok: false, code: "unreadable", error: `${NAME} could not be read (${(error as NodeJS.ErrnoException | undefined)?.code ?? "unknown error"}).` };
+ }
+ let parsed;
+ try {
+ parsed = parseJson(text);
+ } catch {
+ return { ok: false, code: "json", error: jsonErrorMessage(text.charCodeAt(0) === 0xfeff ? text.slice(1) : text) };
+ }
+ try {
+ parseStoredConfig(parsed);
+ } catch (error) {
+ return { ok: false, code: "schema", error: `${NAME}: ${error instanceof Error ? error.message : "a setting is not valid"}` };
+ }
+ const next = load() as Record<string, unknown>;
+ // load() reads the file again and falls back to defaults on a bad one: only the text checked above is applied.
+ if (readAgain(read) !== text) return { ok: false, code: "unreadable", error: `${NAME} changed while it was being read. Try again.` };
+ const live = cfg as Record<string, unknown>;
+ const enginesBefore = engines(cfg);
+ const applied: string[] = [];
+ const restart: string[] = [];
+ for (const key of [...new Set([...Object.keys(live), ...Object.keys(next)])].sort()) {
+ if (isDeepStrictEqual(live[key], next[key])) continue;
+ const trial = { ...live, [key]: next[key] } as AppConfig;
+ if (RESTART_SECTIONS.has(key) || heldFeature(key, live[key], next[key]) || !isDeepStrictEqual(engines(trial), enginesBefore)) {
+ restart.push(key);
+ continue;
+ }
+ if (Object.hasOwn(next, key)) live[key] = next[key];
+ else delete live[key];
+ applied.push(key);
+ }
+ return { ok: true, applied, restart };
+}
+
+function readAgain(read: () => string): string | null {
+ try { return read(); } catch { return null; }
+}
+
+function heldFeature(key: string, before: unknown, after: unknown): boolean {
+ if (key !== "features") return false;
+ const flag = (features: unknown, name: string) => (typeof features === "object" && features !== null ? (features as Record<string, unknown>)[name] : undefined);
+ return RESTART_FEATURES.some((name) => !isDeepStrictEqual(flag(before, name), flag(after, name)));
+}
diff --git a/server/index.ts b/server/index.ts
index 800c382d07..682ca9b7ae 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -575,7 +575,7 @@ import { PhoneSecretBridge, PhoneSecretSubmissionRegistry } from "./phone-secret
// Keep these two last, so loading the route table leaves module start-up order as is.
import { gzipTunnelReplies, json, onJsonBody, parsedBodyOf, readBody } from "./harness/http.ts";
import { holdBodyDeadline } from "./body-deadline.ts";
-import { isLinkedId } from "./bot-link/protocol.ts"; import { createNoAiNotice } from "./host/no-ai-notice.ts"; import { PASS, ROUTES, dispatchRoutes } from "./routes/table.ts"; import { createBotLinkHost } from "./host/bot-link-host.ts"; import { createLinkLimits, LINK_ACTION_DENIED, LINK_APP_WRITE_REFUSAL, LINK_COMMANDS_OFF, LINK_ENGINE_REFUSAL, LINK_ROUTE_REFUSAL, linkAppWriteRefused, linkHandOnRefusal, linkRouteRefused } from "./bot-link/far-side.ts"; import { followRoomMentions } from "./host/bot-link-rooms.ts"; import { standInAmong, standInWriteRefusal } from "./host/stand-in-guard.ts"; import { isBotLinkHeldPath, linkSessionRefusal } from "./routes/bot-link.ts"; import { createSecretCards } from "./host/secret-cards.ts"; import { createInternalCredentialRequestRoutes, createSecretCardRoutes } from "./routes/secret-cards.ts"; import { applyIncludedPagesMessage, pagesAccess, pagesNotOffered } from "./pages/access.ts"; import { createPublishedPages } from "./pages/service.ts"; import { createInternalToolRoutes } from "./routes/internal-tools.ts"; import { createHelperSuggestionRoutes } from "./routes/helper-suggestion.ts"; import { createXConnectorRoutes } from "./routes/x-connector.ts"; import { createMoveFreeze, switchAutomationsOff } from "./move-freeze.ts"; import { createMoveFreezeRoutes } from "./routes/move-freeze.ts"; import { createMoveWaits } from "./move-waits.ts"; import { assertBotHere, botMoveRefusal, createBotMoves } from "./bot-moves.ts"; import { arrivalsFile, desktopMainMover, mcpServersHere, staysOnCloud, thisComputerOwner } from "./move-back.ts"; import { createBotMoveRoutes } from "./routes/bot-moves.ts"; import { createTeamMoveIn, moveInRefusal } from "./team-move-in.ts";
+import { isLinkedId } from "./bot-link/protocol.ts"; import { createNoAiNotice } from "./host/no-ai-notice.ts"; import { PASS, ROUTES, dispatchRoutes } from "./routes/table.ts"; import { createBotLinkHost } from "./host/bot-link-host.ts"; import { createLinkLimits, LINK_ACTION_DENIED, LINK_APP_WRITE_REFUSAL, LINK_COMMANDS_OFF, LINK_ENGINE_REFUSAL, LINK_ROUTE_REFUSAL, linkAppWriteRefused, linkHandOnRefusal, linkRouteRefused } from "./bot-link/far-side.ts"; import { followRoomMentions } from "./host/bot-link-rooms.ts"; import { standInAmong, standInWriteRefusal } from "./host/stand-in-guard.ts"; import { isBotLinkHeldPath, linkSessionRefusal } from "./routes/bot-link.ts"; import { createSecretCards } from "./host/secret-cards.ts"; import { createInternalCredentialRequestRoutes, createSecretCardRoutes } from "./routes/secret-cards.ts"; import { applyIncludedPagesMessage, pagesAccess, pagesNotOffered } from "./pages/access.ts"; import { createPublishedPages } from "./pages/service.ts"; import { createInternalToolRoutes } from "./routes/internal-tools.ts"; import { createHelperSuggestionRoutes } from "./routes/helper-suggestion.ts"; import { createXConnectorRoutes } from "./routes/x-connector.ts"; import { createMoveFreeze, switchAutomationsOff } from "./move-freeze.ts"; import { createMoveFreezeRoutes } from "./routes/move-freeze.ts"; import { createMoveWaits } from "./move-waits.ts"; import { assertBotHere, botMoveRefusal, createBotMoves } from "./bot-moves.ts"; import { arrivalsFile, desktopMainMover, mcpServersHere, staysOnCloud, thisComputerOwner } from "./move-back.ts"; import { createBotMoveRoutes } from "./routes/bot-moves.ts"; import { createTeamMoveIn, moveInRefusal } from "./team-move-in.ts"; import { createConfigReloadRoutes } from "./routes/config-reload.ts";
import { createHostedSlackRoutes } from "./routes/hosted-slack.ts";
import { createBotPresetRoutes } from "./routes/bot-presets.ts"; import { createWorkspaceBannerRoutes, workspaceBannerStore, workspaceBannerSummary } from "./routes/workspace-banner.ts";
import { createBotMemoryRoutes } from "./routes/bot-memory.ts"; import { createBotLibraryRoutes } from "./routes/bot-library.ts";
@@ -12187,7 +12187,7 @@ const postiz = createPostiz({ cfg: () => cfg, mcpOAuth, persistMcpServers: persi
configForAccess: (status, auth) => configForAccess(status as ReturnType<typeof configStatus>, auth.scopes.includes("admin"), auth.kind === "session" ? auth.session : null),
...(CLOUD_TEAM ? { ownProfile: (auth: RequestAuth, profile: { name?: string; avatarUrl?: string; aboutMe?: string }) => auth.kind === "session" ? (teamHost.saveMemberProfile(auth.session, profile), true) : false, ownHints: (auth: RequestAuth, hints: string[]) => auth.kind === "session" ? (teamWelcome.save(personKey(auth.session), { hints }), true) : false } : {}),
resyncOpenCodeProviderKeys, revokeEngineCapabilities, reloadProviders, broadcast, drainQueuedSends, postiz,
-}); ROUTES.push(createPostizRoutes({ postiz }), configRoutes);
+}); ROUTES.push(createPostizRoutes({ postiz }), configRoutes, createConfigReloadRoutes({ cfg, file: join(DATA_DIR, "config.json"), load: loadConfig, engines: (config) => engineLaunches(hostedModels ? hostedModels.configs() : instanceConfigs(config)), allowed: (auth) => desktopMainMover(auth, { desktopManaged: DESKTOP_MANAGED, managed: Boolean(CLOUD_HOME || HOSTED_WORKSPACE) }), changed: () => { registry.forgetSnapshots(); broadcast({ kind: "config", ...configStatus() }); } }));
const instanceRoutes = createInstanceRoutes({
store, cfg, registry, sessions, providerAuthSessions,
hostedModels: Boolean(hostedModels),
diff --git a/server/routes/config-reload.test.ts b/server/routes/config-reload.test.ts
new file mode 100644
index 0000000000..1074fc26ca
--- /dev/null
+++ b/server/routes/config-reload.test.ts
@@ -0,0 +1,80 @@
+import { mkdirSync, rmSync, writeFileSync } from "node:fs";
+import type { IncomingMessage, ServerResponse } from "node:http";
+import { join } from "node:path";
+import { afterEach, beforeEach, expect, it, vi } from "vitest";
+
+import { DATA_DIR, engineLaunches, instanceConfigs, loadConfig, type AppConfig } from "../config.ts";
+import { desktopMainMover } from "../move-back.ts";
+import type { RequestAuth } from "../request-auth.ts";
+import { CONFIG_RELOAD_PATH, createConfigReloadRoutes } from "./config-reload.ts";
+import { PASS } from "./pass.ts";
+
+const FILE = join(DATA_DIR, "config.json");
+const SECRET = "sk-route-test-hidden-41";
+const desktopMain: RequestAuth = { kind: "loopback", scopes: ["admin"], desktopMain: true };
+const page: RequestAuth = { kind: "loopback", scopes: ["admin"] };
+const phone: RequestAuth = { kind: "loopback", scopes: ["admin"], desktopMain: true, companionDevice: "phone-1" };
+
+beforeEach(() => mkdirSync(DATA_DIR, { recursive: true }));
+afterEach(() => rmSync(FILE, { force: true }));
+
+function route(cfg: AppConfig, place = { desktopManaged: true, managed: false }) {
+ const changed = vi.fn();
+ const handler = createConfigReloadRoutes({
+ cfg, file: FILE, load: loadConfig, engines: (config) => engineLaunches(instanceConfigs(config)),
+ allowed: (auth) => desktopMainMover(auth, place), changed,
+ });
+ const call = async (auth: RequestAuth, method = "POST", path = CONFIG_RELOAD_PATH) => {
+ const json = vi.fn();
+ const out = await handler({ req: {} as IncomingMessage, res: {} as ServerResponse, url: new URL(`http://127.0.0.1${path}`), path, method, auth, json, readBody: vi.fn() });
+ return { out, status: json.mock.calls[0]?.[1], body: json.mock.calls[0]?.[2] };
+ };
+ return { call, changed };
+}
+
+it("reloads for the desktop app's own main process, and tells open pages once something was applied", async () => {
+ writeFileSync(FILE, JSON.stringify({ everyBotRules: "Be brief." }));
+ const cfg = loadConfig();
+ writeFileSync(FILE, JSON.stringify({ everyBotRules: "Be kind." }));
+ const { call, changed } = route(cfg);
+ expect(await call(desktopMain)).toMatchObject({ status: 200, body: { ok: true, applied: ["everyBotRules"], restart: [] } });
+ expect(cfg.everyBotRules).toBe("Be kind.");
+ expect(changed).toHaveBeenCalledOnce();
+ expect(await call(desktopMain)).toMatchObject({ status: 200, body: { ok: true, applied: [], restart: [] } });
+ expect(changed).toHaveBeenCalledOnce();
+});
+
+it("answers a bad file with 422 and its line, keeps the settings, and never echoes the file", async () => {
+ writeFileSync(FILE, JSON.stringify({ everyBotRules: "Be brief." }));
+ const cfg = loadConfig();
+ writeFileSync(FILE, `{\n "everyBotRules": "Be kind.",\n "anthropic": { "key": "${SECRET}" }\n "rooms": {}\n}\n`);
+ const { call, changed } = route(cfg);
+ const { status, body } = await call(desktopMain);
+ expect(status).toBe(422);
+ expect(body).toEqual({ ok: false, code: "json", error: "config.json line 4, column 3: unexpected quote (a comma before it may be missing)" });
+ expect(JSON.stringify(body)).not.toContain(SECRET);
+ expect(cfg.everyBotRules).toBe("Be brief.");
+ expect(changed).not.toHaveBeenCalled();
+});
+
+it("refuses a page, a phone, a shared or hosted server and a server the desktop does not run", async () => {
+ writeFileSync(FILE, JSON.stringify({ everyBotRules: "Be brief." }));
+ const cfg = loadConfig();
+ writeFileSync(FILE, JSON.stringify({ everyBotRules: "Be kind." }));
+ for (const [auth, place] of [
+ [page, { desktopManaged: true, managed: false }],
+ [phone, { desktopManaged: true, managed: false }],
+ [{ ...desktopMain, trust: "service" } as RequestAuth, { desktopManaged: true, managed: false }],
+ [desktopMain, { desktopManaged: true, managed: true }],
+ [desktopMain, { desktopManaged: false, managed: false }],
+ ] as const) {
+ expect((await route(cfg, place).call(auth)).status).toBe(403);
+ }
+ expect(cfg.everyBotRules).toBe("Be brief.");
+});
+
+it("takes only POST on its own path", async () => {
+ const { call } = route(loadConfig());
+ expect((await call(desktopMain, "GET")).status).toBe(405);
+ expect((await call(desktopMain, "POST", "/api/config")).out).toBe(PASS);
+});
diff --git a/server/routes/config-reload.ts b/server/routes/config-reload.ts
new file mode 100644
index 0000000000..88649e4ac3
--- /dev/null
+++ b/server/routes/config-reload.ts
@@ -0,0 +1,29 @@
+// POST /api/config/reload: the desktop app's Reload Settings menu item asks its own server to read config.json again
+// (server/config-reload.ts). The reply names sections only, never a value from the file.
+import { readFileSync } from "node:fs";
+
+import type { RequestAuth } from "../request-auth.ts";
+import { reloadConfig, type ConfigReloadDeps } from "../config-reload.ts";
+import { PASS, type RouteHandler } from "./pass.ts";
+
+export const CONFIG_RELOAD_PATH = "/api/config/reload";
+
+export interface ConfigReloadRouteDeps extends Omit<ConfigReloadDeps, "read"> {
+ /** This server's config.json. */
+ file: string;
+ /** Security: only the app's own main process on this computer (desktopMainMover); never a page, a phone or a bot. */
+ allowed(auth: RequestAuth): boolean;
+ /** After a section was applied: what a save does once the new value is in place (engine status, open Settings pages). */
+ changed(): void;
+}
+
+export function createConfigReloadRoutes(deps: ConfigReloadRouteDeps): RouteHandler {
+ return async ({ res, path, method, auth, json }) => {
+ if (path !== CONFIG_RELOAD_PATH) return PASS;
+ if (method !== "POST") return json(res, 405, { error: "method not allowed" });
+ if (!deps.allowed(auth)) return json(res, 403, { error: "Only the desktop app on this computer can reload its settings file." });
+ const result = reloadConfig({ ...deps, read: () => readFileSync(deps.file, "utf8") });
+ if (result.ok && result.applied.length) deps.changed();
+ return json(res, result.ok ? 200 : 422, result);
+ };
+}
diff --git a/src/locales/de.json b/src/locales/de.json
index be95775b2e..20a59a3ecd 100644
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@ -3980,6 +3980,19 @@
"sidebar.menu.signedInTo": "Angemeldet bei {place}",
"settings.plan.openCloud": "{place} öffnen",
"native.menu.settings": "Einstellungen…",
+ "native.menu.openSettingsFile": "Einstellungsdatei öffnen",
+ "native.menu.reloadSettings": "Einstellungen neu laden",
+ "native.dialog.settingsFile.notHere": "Die Einstellungsdatei dieses Orts liegt nicht auf diesem Computer",
+ "native.dialog.settingsFile.notHereDetail": "Öffne die Einstellungen, um die Einstellungen einer Cloud oder eines anderen Servers zu ändern.",
+ "native.dialog.settingsFile.missing": "Es gibt noch keine Einstellungsdatei",
+ "native.dialog.settingsFile.missingDetail": "Dieser Computer hat noch keine config.json. Sie entsteht, sobald du etwas in den Einstellungen änderst.",
+ "native.dialog.settingsReload.done": "Einstellungen neu geladen",
+ "native.dialog.settingsReload.applied": "Jetzt aktiv: {sections}",
+ "native.dialog.settingsReload.restart": "Beende die App und öffne sie neu, um Folgendes zu nutzen: {sections}",
+ "native.dialog.settingsReload.unchanged": "In der Einstellungsdatei hat sich nichts geändert.",
+ "native.dialog.settingsReload.failed": "Einstellungen nicht neu geladen",
+ "native.dialog.settingsReload.keptLast": "Die letzten funktionierenden Einstellungen bleiben aktiv. Korrigiere die Datei und wähle dann erneut „Einstellungen neu laden“.",
+ "native.dialog.settingsReload.notRunning": "Der Server dieses Computers antwortet nicht. Versuche es gleich noch einmal.",
"settings.search.advancedNote": "Aus der Suche gezeigt. Das ist eine erweiterte Einstellung.",
"settings.search.turnOnAdvanced": "Erweiterten Modus einschalten",
"cloudAccount.storageFailed": "Die gespeicherte Cloud-Anmeldung konnte nicht gelesen oder gelöscht werden. Wähle „Abmelden“ und melde dich dann erneut an.",
diff --git a/src/locales/en.json b/src/locales/en.json
index ce0a57bbff..ee91036fd0 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -11627,6 +11627,19 @@
"sidebar.menu.signedInTo": "Signed in to {place}",
"settings.plan.openCloud": "Open {place}",
"native.menu.settings": "Settings…",
+ "native.menu.openSettingsFile": "Open Settings File",
+ "native.menu.reloadSettings": "Reload Settings",
+ "native.dialog.settingsFile.notHere": "This place's settings file isn't on this computer",
+ "native.dialog.settingsFile.notHereDetail": "Open Settings to change the settings of a Cloud or another server.",
+ "native.dialog.settingsFile.missing": "There's no settings file yet",
+ "native.dialog.settingsFile.missingDetail": "This computer has no config.json yet. It appears once you change something in Settings.",
+ "native.dialog.settingsReload.done": "Settings reloaded",
+ "native.dialog.settingsReload.applied": "Now in use: {sections}",
+ "native.dialog.settingsReload.restart": "Quit and reopen the app to use: {sections}",
+ "native.dialog.settingsReload.unchanged": "Nothing in the settings file changed.",
+ "native.dialog.settingsReload.failed": "Settings not reloaded",
+ "native.dialog.settingsReload.keptLast": "The last settings that worked are still in use. Fix the file, then choose Reload Settings again.",
+ "native.dialog.settingsReload.notRunning": "This computer's server isn't answering. Try again in a moment.",
"settings.search.advancedNote": "Shown from search. This is an Advanced setting.",
"settings.search.turnOnAdvanced": "Turn on Advanced mode",
"settings.learnMore": "Learn more",
diff --git a/src/locales/es.json b/src/locales/es.json
index 30b7f34939..65b9617a59 100644
--- a/src/locales/es.json
+++ b/src/locales/es.json
@@ -6317,6 +6317,19 @@
"sidebar.menu.signedInTo": "Sesión iniciada en {place}",
"settings.plan.openCloud": "Abrir {place}",
"native.menu.settings": "Ajustes…",
+ "native.menu.openSettingsFile": "Abrir archivo de ajustes",
+ "native.menu.reloadSettings": "Recargar ajustes",
+ "native.dialog.settingsFile.notHere": "El archivo de ajustes de este lugar no está en este ordenador",
+ "native.dialog.settingsFile.notHereDetail": "Abre Ajustes para cambiar los ajustes de una Cloud o de otro servidor.",
+ "native.dialog.settingsFile.missing": "Todavía no hay archivo de ajustes",
+ "native.dialog.settingsFile.missingDetail": "Este ordenador aún no tiene config.json. Aparece cuando cambias algo en Ajustes.",
+ "native.dialog.settingsReload.done": "Ajustes recargados",
+ "native.dialog.settingsReload.applied": "En uso ahora: {sections}",
+ "native.dialog.settingsReload.restart": "Cierra y vuelve a abrir la app para usar: {sections}",
+ "native.dialog.settingsReload.unchanged": "No ha cambiado nada en el archivo de ajustes.",
+ "native.dialog.settingsReload.failed": "Ajustes no recargados",
+ "native.dialog.settingsReload.keptLast": "Siguen en uso los últimos ajustes que funcionaron. Corrige el archivo y vuelve a elegir Recargar ajustes.",
+ "native.dialog.settingsReload.notRunning": "El servidor de este ordenador no responde. Inténtalo de nuevo en un momento.",
"settings.search.advancedNote": "Mostrado desde la búsqueda. Es un ajuste del modo avanzado.",
"settings.search.turnOnAdvanced": "Activar el modo avanzado",
"native.dialog.share.detail": "Deja que los bots de este servidor usen las carpetas y funciones que elijas mientras esta app de escritorio esté abierta. No se comparte nada a menos que lo actives. Puedes cambiarlo después en Ajustes → Esta app → Tus ordenadores.",
diff --git a/src/locales/fr.json b/src/locales/fr.json
index 601e261327..634f45b20f 100644
--- a/src/locales/fr.json
+++ b/src/locales/fr.json
@@ -3664,6 +3664,19 @@
"sidebar.menu.signedInTo": "Connecté à {place}",
"settings.plan.openCloud": "Ouvrir {place}",
"native.menu.settings": "Paramètres…",
+ "native.menu.openSettingsFile": "Ouvrir le fichier de paramètres",
+ "native.menu.reloadSettings": "Recharger les paramètres",
+ "native.dialog.settingsFile.notHere": "Le fichier de paramètres de ce lieu n'est pas sur cet ordinateur",
+ "native.dialog.settingsFile.notHereDetail": "Ouvrez Paramètres pour modifier les paramètres d'un Cloud ou d'un autre serveur.",
+ "native.dialog.settingsFile.missing": "Il n'y a pas encore de fichier de paramètres",
+ "native.dialog.settingsFile.missingDetail": "Cet ordinateur n'a pas encore de config.json. Il apparaît dès que vous modifiez quelque chose dans Paramètres.",
+ "native.dialog.settingsReload.done": "Paramètres rechargés",
+ "native.dialog.settingsReload.applied": "Utilisé maintenant : {sections}",
+ "native.dialog.settingsReload.restart": "Quittez et rouvrez l'app pour utiliser : {sections}",
+ "native.dialog.settingsReload.unchanged": "Rien n'a changé dans le fichier de paramètres.",
+ "native.dialog.settingsReload.failed": "Paramètres non rechargés",
+ "native.dialog.settingsReload.keptLast": "Les derniers paramètres qui fonctionnaient restent utilisés. Corrigez le fichier, puis choisissez à nouveau Recharger les paramètres.",
+ "native.dialog.settingsReload.notRunning": "Le serveur de cet ordinateur ne répond pas. Réessayez dans un instant.",
"settings.search.advancedNote": "Affiché depuis la recherche. C'est un réglage du mode avancé.",
"settings.search.turnOnAdvanced": "Activer le mode avancé",
"cloudAccount.storageFailed": "La connexion Cloud enregistrée n'a pas pu être lue ni effacée. Choisissez « Se déconnecter », puis reconnectez-vous.",
diff --git a/src/locales/hi.json b/src/locales/hi.json
index 1869610830..eee380000f 100644
--- a/src/locales/hi.json
+++ b/src/locales/hi.json
@@ -3515,6 +3515,19 @@
"sidebar.menu.signedInTo": "{place} में साइन इन है",
"settings.plan.openCloud": "{place} खोलें",
"native.menu.settings": "सेटिंग्स…",
+ "native.menu.openSettingsFile": "सेटिंग्स फ़ाइल खोलें",
+ "native.menu.reloadSettings": "सेटिंग्स दोबारा लोड करें",
+ "native.dialog.settingsFile.notHere": "इस जगह की सेटिंग्स फ़ाइल इस कंप्यूटर पर नहीं है",
+ "native.dialog.settingsFile.notHereDetail": "किसी Cloud या दूसरे सर्वर की सेटिंग्स बदलने के लिए सेटिंग्स खोलें।",
+ "native.dialog.settingsFile.missing": "अभी कोई सेटिंग्स फ़ाइल नहीं है",
+ "native.dialog.settingsFile.missingDetail": "इस कंप्यूटर पर अभी config.json नहीं है। सेटिंग्स में कुछ बदलते ही यह बन जाती है।",
+ "native.dialog.settingsReload.done": "सेटिंग्स दोबारा लोड हो गईं",
+ "native.dialog.settingsReload.applied": "अब इस्तेमाल में: {sections}",
+ "native.dialog.settingsReload.restart": "इन्हें इस्तेमाल करने के लिए ऐप बंद करके फिर खोलें: {sections}",
+ "native.dialog.settingsReload.unchanged": "सेटिंग्स फ़ाइल में कुछ नहीं बदला।",
+ "native.dialog.settingsReload.failed": "सेटिंग्स दोबारा लोड नहीं हुईं",
+ "native.dialog.settingsReload.keptLast": "आख़िरी चालू सेटिंग्स ही इस्तेमाल हो रही हैं। फ़ाइल ठीक करें, फिर से सेटिंग्स दोबारा लोड करें चुनें।",
+ "native.dialog.settingsReload.notRunning": "इस कंप्यूटर का सर्वर जवाब नहीं दे रहा। थोड़ी देर में फिर कोशिश करें।",
"settings.search.advancedNote": "खोज से दिखाया गया। यह एडवांस्ड मोड की सेटिंग है।",
"settings.search.turnOnAdvanced": "एडवांस्ड मोड चालू करें",
"cloudAccount.storageFailed": "सहेजा गया Cloud साइन-इन पढ़ा या मिटाया नहीं जा सका। \"साइन आउट करें\" चुनें, फिर दोबारा साइन इन करें।",
diff --git a/src/locales/it.json b/src/locales/it.json
index 9ba3c7339a..49f88f4c98 100644
--- a/src/locales/it.json
+++ b/src/locales/it.json
@@ -11509,6 +11509,19 @@
"sidebar.menu.signedInTo": "Accesso effettuato a {place}",
"settings.plan.openCloud": "Apri {place}",
"native.menu.settings": "Impostazioni…",
+ "native.menu.openSettingsFile": "Apri file delle impostazioni",
+ "native.menu.reloadSettings": "Ricarica impostazioni",
+ "native.dialog.settingsFile.notHere": "Il file delle impostazioni di questo luogo non è su questo computer",
+ "native.dialog.settingsFile.notHereDetail": "Apri Impostazioni per cambiare le impostazioni di un Cloud o di un altro server.",
+ "native.dialog.settingsFile.missing": "Non c'è ancora un file delle impostazioni",
+ "native.dialog.settingsFile.missingDetail": "Questo computer non ha ancora un config.json. Compare quando cambi qualcosa in Impostazioni.",
+ "native.dialog.settingsReload.done": "Impostazioni ricaricate",
+ "native.dialog.settingsReload.applied": "Ora in uso: {sections}",
+ "native.dialog.settingsReload.restart": "Chiudi e riapri l'app per usare: {sections}",
+ "native.dialog.settingsReload.unchanged": "Nel file delle impostazioni non è cambiato nulla.",
+ "native.dialog.settingsReload.failed": "Impostazioni non ricaricate",
+ "native.dialog.settingsReload.keptLast": "Restano in uso le ultime impostazioni funzionanti. Correggi il file, poi scegli di nuovo Ricarica impostazioni.",
+ "native.dialog.settingsReload.notRunning": "Il server di questo computer non risponde. Riprova tra poco.",
"settings.search.advancedNote": "Mostrato dalla ricerca. È un'impostazione della modalità avanzata.",
"settings.search.turnOnAdvanced": "Attiva la modalità avanzata",
"settings.learnMore": "Scopri di più",
diff --git a/src/locales/ja.json b/src/locales/ja.json
index bf3148dbf4..166e708ad5 100644
--- a/src/locales/ja.json
+++ b/src/locales/ja.json
@@ -7913,6 +7913,19 @@
"sidebar.menu.signedInTo": "{place} にサインイン済み",
"settings.plan.openCloud": "{place} を開く",
"native.menu.settings": "設定…",
+ "native.menu.openSettingsFile": "設定ファイルを開く",
+ "native.menu.reloadSettings": "設定を再読み込み",
+ "native.dialog.settingsFile.notHere": "この場所の設定ファイルはこのコンピュータにはありません",
+ "native.dialog.settingsFile.notHereDetail": "Cloud やほかのサーバーの設定は「設定」で変更してください。",
+ "native.dialog.settingsFile.missing": "設定ファイルはまだありません",
+ "native.dialog.settingsFile.missingDetail": "このコンピュータにはまだ config.json がありません。「設定」で何かを変更すると作成されます。",
+ "native.dialog.settingsReload.done": "設定を再読み込みしました",
+ "native.dialog.settingsReload.applied": "使用中: {sections}",
+ "native.dialog.settingsReload.restart": "次を使うにはアプリを終了して開き直してください: {sections}",
+ "native.dialog.settingsReload.unchanged": "設定ファイルに変更はありません。",
+ "native.dialog.settingsReload.failed": "設定を再読み込みできませんでした",
+ "native.dialog.settingsReload.keptLast": "最後に動いていた設定をそのまま使っています。ファイルを直してから、もう一度「設定を再読み込み」を選んでください。",
+ "native.dialog.settingsReload.notRunning": "このコンピュータのサーバーが応答しません。少し待ってからもう一度お試しください。",
"settings.search.advancedNote": "検索から表示しています。これは詳細モードの設定です。",
"settings.search.turnOnAdvanced": "詳細モードをオンにする",
"native.dialog.share.detail": "このデスクトップアプリの実行中、このサーバーのボットが選んだフォルダや機能を使えるようにします。オンにしない限り何も共有されません。あとで 設定 → このアプリ → あなたのコンピュータ で変更できます。",
diff --git a/src/locales/ko.json b/src/locales/ko.json
index 5ffb44ad65..13abb31ec8 100644
--- a/src/locales/ko.json
+++ b/src/locales/ko.json
@@ -7588,6 +7588,19 @@
"sidebar.menu.signedInTo": "{place}에 로그인됨",
"settings.plan.openCloud": "{place} 열기",
"native.menu.settings": "설정…",
+ "native.menu.openSettingsFile": "설정 파일 열기",
+ "native.menu.reloadSettings": "설정 다시 불러오기",
+ "native.dialog.settingsFile.notHere": "이 장소의 설정 파일은 이 컴퓨터에 없습니다",
+ "native.dialog.settingsFile.notHereDetail": "Cloud나 다른 서버의 설정은 설정에서 바꾸세요.",
+ "native.dialog.settingsFile.missing": "아직 설정 파일이 없습니다",
+ "native.dialog.settingsFile.missingDetail": "이 컴퓨터에는 아직 config.json이 없습니다. 설정에서 무언가를 바꾸면 생깁니다.",
+ "native.dialog.settingsReload.done": "설정을 다시 불러왔습니다",
+ "native.dialog.settingsReload.applied": "지금 사용 중: {sections}",
+ "native.dialog.settingsReload.restart": "다음을 사용하려면 앱을 종료하고 다시 여세요: {sections}",
+ "native.dialog.settingsReload.unchanged": "설정 파일에서 바뀐 것이 없습니다.",
+ "native.dialog.settingsReload.failed": "설정을 다시 불러오지 못했습니다",
+ "native.dialog.settingsReload.keptLast": "마지막으로 작동한 설정을 계속 사용합니다. 파일을 고친 뒤 설정 다시 불러오기를 다시 선택하세요.",
+ "native.dialog.settingsReload.notRunning": "이 컴퓨터의 서버가 응답하지 않습니다. 잠시 후 다시 시도하세요.",
"settings.search.advancedNote": "검색에서 표시했어요. 고급 모드 설정이에요.",
"settings.search.turnOnAdvanced": "고급 모드 켜기",
"native.dialog.share.detail": "이 데스크톱 앱이 실행되는 동안 이 서버의 봇이 선택한 폴더와 기능을 쓸 수 있게 해요. 켜지 않으면 아무것도 공유되지 않아요. 나중에 설정 → 이 앱 → 내 컴퓨터에서 바꿀 수 있어요.",
diff --git a/src/locales/pl.json b/src/locales/pl.json
index 1ebfc9f51a..022d12ed23 100644
--- a/src/locales/pl.json
+++ b/src/locales/pl.json
@@ -7006,6 +7006,19 @@
"sidebar.menu.signedInTo": "Zalogowano w {place}",
"settings.plan.openCloud": "Otwórz {place}",
"native.menu.settings": "Ustawienia…",
+ "native.menu.openSettingsFile": "Otwórz plik ustawień",
+ "native.menu.reloadSettings": "Wczytaj ustawienia ponownie",
+ "native.dialog.settingsFile.notHere": "Pliku ustawień tego miejsca nie ma na tym komputerze",
+ "native.dialog.settingsFile.notHereDetail": "Otwórz Ustawienia, aby zmienić ustawienia Cloud lub innego serwera.",
+ "native.dialog.settingsFile.missing": "Nie ma jeszcze pliku ustawień",
+ "native.dialog.settingsFile.missingDetail": "Ten komputer nie ma jeszcze pliku config.json. Pojawi się, gdy coś zmienisz w Ustawieniach.",
+ "native.dialog.settingsReload.done": "Ustawienia wczytane ponownie",
+ "native.dialog.settingsReload.applied": "Teraz w użyciu: {sections}",
+ "native.dialog.settingsReload.restart": "Zamknij i otwórz aplikację ponownie, aby użyć: {sections}",
+ "native.dialog.settingsReload.unchanged": "W pliku ustawień nic się nie zmieniło.",
+ "native.dialog.settingsReload.failed": "Nie wczytano ustawień",
+ "native.dialog.settingsReload.keptLast": "Nadal działają ostatnie poprawne ustawienia. Popraw plik i ponownie wybierz Wczytaj ustawienia ponownie.",
+ "native.dialog.settingsReload.notRunning": "Serwer tego komputera nie odpowiada. Spróbuj ponownie za chwilę.",
"settings.search.advancedNote": "Pokazane z wyszukiwania. To ustawienie trybu zaawansowanego.",
"settings.search.turnOnAdvanced": "Włącz tryb zaawansowany",
"native.dialog.share.detail": "Pozwól botom tego serwera używać wybranych folderów i funkcji, gdy działa ta aplikacja na komputer. Nic nie jest udostępniane, dopóki tego nie włączysz. Możesz to później zmienić w Ustawienia → Ta aplikacja → Twoje komputery.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index 059e673acb..724860d1bc 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -11561,6 +11561,19 @@
"sidebar.menu.signedInTo": "Conectado a {place}",
"settings.plan.openCloud": "Abrir {place}",
"native.menu.settings": "Configurações…",
+ "native.menu.openSettingsFile": "Abrir arquivo de configurações",
+ "native.menu.reloadSettings": "Recarregar configurações",
+ "native.dialog.settingsFile.notHere": "O arquivo de configurações deste lugar não está neste computador",
+ "native.dialog.settingsFile.notHereDetail": "Abra Configurações para mudar as configurações de uma Cloud ou de outro servidor.",
+ "native.dialog.settingsFile.missing": "Ainda não há arquivo de configurações",
+ "native.dialog.settingsFile.missingDetail": "Este computador ainda não tem config.json. Ele aparece quando você muda algo em Configurações.",
+ "native.dialog.settingsReload.done": "Configurações recarregadas",
+ "native.dialog.settingsReload.applied": "Em uso agora: {sections}",
+ "native.dialog.settingsReload.restart": "Feche e abra o app de novo para usar: {sections}",
+ "native.dialog.settingsReload.unchanged": "Nada mudou no arquivo de configurações.",
+ "native.dialog.settingsReload.failed": "Configurações não recarregadas",
+ "native.dialog.settingsReload.keptLast": "As últimas configurações que funcionaram continuam em uso. Corrija o arquivo e escolha Recarregar configurações de novo.",
+ "native.dialog.settingsReload.notRunning": "O servidor deste computador não está respondendo. Tente de novo em instantes.",
"settings.search.advancedNote": "Mostrado pela busca. Esta é uma configuração do modo avançado.",
"settings.search.turnOnAdvanced": "Ligar o modo avançado",
"settings.learnMore": "Saiba mais",
diff --git a/src/locales/ru.json b/src/locales/ru.json
index b5744c998d..a299880eac 100644
--- a/src/locales/ru.json
+++ b/src/locales/ru.json
@@ -7067,6 +7067,19 @@
"sidebar.menu.signedInTo": "Вход выполнен на {place}",
"settings.plan.openCloud": "Открыть {place}",
"native.menu.settings": "Настройки…",
+ "native.menu.openSettingsFile": "Открыть файл настроек",
+ "native.menu.reloadSettings": "Перезагрузить настройки",
+ "native.dialog.settingsFile.notHere": "Файла настроек этого места нет на этом компьютере",
+ "native.dialog.settingsFile.notHereDetail": "Откройте Настройки, чтобы изменить настройки Cloud или другого сервера.",
+ "native.dialog.settingsFile.missing": "Файла настроек пока нет",
+ "native.dialog.settingsFile.missingDetail": "На этом компьютере пока нет config.json. Он появится, когда вы что-нибудь измените в Настройках.",
+ "native.dialog.settingsReload.done": "Настройки перезагружены",
+ "native.dialog.settingsReload.applied": "Сейчас используется: {sections}",
+ "native.dialog.settingsReload.restart": "Закройте и снова откройте приложение, чтобы применить: {sections}",
+ "native.dialog.settingsReload.unchanged": "В файле настроек ничего не изменилось.",
+ "native.dialog.settingsReload.failed": "Настройки не перезагружены",
+ "native.dialog.settingsReload.keptLast": "Используются последние работавшие настройки. Исправьте файл и снова выберите «Перезагрузить настройки».",
+ "native.dialog.settingsReload.notRunning": "Сервер этого компьютера не отвечает. Попробуйте ещё раз чуть позже.",
"settings.search.advancedNote": "Показано из поиска. Это настройка расширенного режима.",
"settings.search.turnOnAdvanced": "Включить расширенный режим",
"native.dialog.share.detail": "Разрешите ботам этого сервера пользоваться выбранными папками и возможностями, пока работает это приложение для компьютера. Ничего не передаётся, пока вы это не включите. Изменить это можно позже в Настройки → Это приложение → Ваши компьютеры.",
diff --git a/src/locales/th.json b/src/locales/th.json
index 8dbe9209fe..b90ada2465 100644
--- a/src/locales/th.json
+++ b/src/locales/th.json
@@ -11483,6 +11483,19 @@
"sidebar.menu.signedInTo": "ลงชื่อเข้าใช้ {place} แล้ว",
"settings.plan.openCloud": "เปิด {place}",
"native.menu.settings": "การตั้งค่า…",
+ "native.menu.openSettingsFile": "เปิดไฟล์การตั้งค่า",
+ "native.menu.reloadSettings": "โหลดการตั้งค่าใหม่",
+ "native.dialog.settingsFile.notHere": "ไฟล์การตั้งค่าของที่นี่ไม่ได้อยู่ในคอมพิวเตอร์เครื่องนี้",
+ "native.dialog.settingsFile.notHereDetail": "เปิดการตั้งค่าเพื่อเปลี่ยนการตั้งค่าของ Cloud หรือเซิร์ฟเวอร์อื่น",
+ "native.dialog.settingsFile.missing": "ยังไม่มีไฟล์การตั้งค่า",
+ "native.dialog.settingsFile.missingDetail": "คอมพิวเตอร์เครื่องนี้ยังไม่มี config.json ไฟล์จะถูกสร้างเมื่อคุณเปลี่ยนอะไรสักอย่างในการตั้งค่า",
+ "native.dialog.settingsReload.done": "โหลดการตั้งค่าใหม่แล้ว",
+ "native.dialog.settingsReload.applied": "ใช้งานอยู่ตอนนี้: {sections}",
+ "native.dialog.settingsReload.restart": "ออกจากแอปแล้วเปิดใหม่เพื่อใช้: {sections}",
+ "native.dialog.settingsReload.unchanged": "ไม่มีอะไรเปลี่ยนในไฟล์การตั้งค่า",
+ "native.dialog.settingsReload.failed": "ไม่ได้โหลดการตั้งค่าใหม่",
+ "native.dialog.settingsReload.keptLast": "ยังใช้การตั้งค่าล่าสุดที่ใช้งานได้อยู่ แก้ไฟล์แล้วเลือกโหลดการตั้งค่าใหม่อีกครั้ง",
+ "native.dialog.settingsReload.notRunning": "เซิร์ฟเวอร์ของคอมพิวเตอร์เครื่องนี้ไม่ตอบสนอง ลองอีกครั้งในอีกสักครู่",
"settings.search.advancedNote": "แสดงจากผลการค้นหา นี่คือการตั้งค่าขั้นสูง",
"settings.search.turnOnAdvanced": "เปิดโหมดขั้นสูง",
"settings.learnMore": "ดูเพิ่มเติม",
diff --git a/src/locales/tr.json b/src/locales/tr.json
index eb1b973a62..1f01c7a4ce 100644
--- a/src/locales/tr.json
+++ b/src/locales/tr.json
@@ -5809,6 +5809,19 @@
"sidebar.menu.signedInTo": "{place} üzerinde giriş yapıldı",
"settings.plan.openCloud": "{place} aç",
"native.menu.settings": "Ayarlar…",
+ "native.menu.openSettingsFile": "Ayarlar dosyasını aç",
+ "native.menu.reloadSettings": "Ayarları yeniden yükle",
+ "native.dialog.settingsFile.notHere": "Bu yerin ayarlar dosyası bu bilgisayarda değil",
+ "native.dialog.settingsFile.notHereDetail": "Bir Cloud'un ya da başka bir sunucunun ayarlarını değiştirmek için Ayarlar'ı açın.",
+ "native.dialog.settingsFile.missing": "Henüz ayarlar dosyası yok",
+ "native.dialog.settingsFile.missingDetail": "Bu bilgisayarda henüz config.json yok. Ayarlar'da bir şey değiştirdiğinizde oluşur.",
+ "native.dialog.settingsReload.done": "Ayarlar yeniden yüklendi",
+ "native.dialog.settingsReload.applied": "Şu an kullanımda: {sections}",
+ "native.dialog.settingsReload.restart": "Şunları kullanmak için uygulamayı kapatıp yeniden açın: {sections}",
+ "native.dialog.settingsReload.unchanged": "Ayarlar dosyasında hiçbir şey değişmedi.",
+ "native.dialog.settingsReload.failed": "Ayarlar yeniden yüklenmedi",
+ "native.dialog.settingsReload.keptLast": "Son çalışan ayarlar kullanılmaya devam ediyor. Dosyayı düzeltin, sonra yeniden Ayarları yeniden yükle'yi seçin.",
+ "native.dialog.settingsReload.notRunning": "Bu bilgisayarın sunucusu yanıt vermiyor. Birazdan yeniden deneyin.",
"settings.search.advancedNote": "Aramadan gösterildi. Bu bir gelişmiş mod ayarı.",
"settings.search.turnOnAdvanced": "Gelişmiş modu aç",
"native.dialog.share.detail": "Bu masaüstü uygulaması çalışırken bu sunucunun botlarının seçtiğiniz klasörleri ve özellikleri kullanmasına izin verin. Siz açmadıkça hiçbir şey paylaşılmaz. Bunu daha sonra Ayarlar → Bu uygulama → Bilgisayarlarınız bölümünden değiştirebilirsiniz.",
diff --git a/src/locales/uk.json b/src/locales/uk.json
index 9469f8431c..c9575bea65 100644
--- a/src/locales/uk.json
+++ b/src/locales/uk.json
@@ -3946,6 +3946,19 @@
"sidebar.menu.signedInTo": "Вхід виконано на {place}",
"settings.plan.openCloud": "Відкрити {place}",
"native.menu.settings": "Налаштування…",
+ "native.menu.openSettingsFile": "Відкрити файл налаштувань",
+ "native.menu.reloadSettings": "Перезавантажити налаштування",
+ "native.dialog.settingsFile.notHere": "Файлу налаштувань цього місця немає на цьому комп'ютері",
+ "native.dialog.settingsFile.notHereDetail": "Відкрийте Налаштування, щоб змінити налаштування Cloud або іншого сервера.",
+ "native.dialog.settingsFile.missing": "Файлу налаштувань ще немає",
+ "native.dialog.settingsFile.missingDetail": "На цьому комп'ютері ще немає config.json. Він з'явиться, щойно ви щось зміните в Налаштуваннях.",
+ "native.dialog.settingsReload.done": "Налаштування перезавантажено",
+ "native.dialog.settingsReload.applied": "Зараз використовується: {sections}",
+ "native.dialog.settingsReload.restart": "Закрийте й знову відкрийте застосунок, щоб застосувати: {sections}",
+ "native.dialog.settingsReload.unchanged": "У файлі налаштувань нічого не змінилося.",
+ "native.dialog.settingsReload.failed": "Налаштування не перезавантажено",
+ "native.dialog.settingsReload.keptLast": "Використовуються останні робочі налаштування. Виправте файл і знову виберіть «Перезавантажити налаштування».",
+ "native.dialog.settingsReload.notRunning": "Сервер цього комп'ютера не відповідає. Спробуйте ще раз за мить.",
"settings.search.advancedNote": "Показано з пошуку. Це налаштування розширеного режиму.",
"settings.search.turnOnAdvanced": "Увімкнути розширений режим",
"cloudAccount.storageFailed": "Не вдалося прочитати або очистити збережені дані входу в Cloud. Виберіть «Вийти», потім увійдіть знову.",
diff --git a/src/locales/vi.json b/src/locales/vi.json
index 25909466f7..8f377199e2 100644
--- a/src/locales/vi.json
+++ b/src/locales/vi.json
@@ -5809,6 +5809,19 @@
"sidebar.menu.signedInTo": "Đã đăng nhập vào {place}",
"settings.plan.openCloud": "Mở {place}",
"native.menu.settings": "Cài đặt…",
+ "native.menu.openSettingsFile": "Mở tệp cài đặt",
+ "native.menu.reloadSettings": "Tải lại cài đặt",
+ "native.dialog.settingsFile.notHere": "Tệp cài đặt của nơi này không nằm trên máy tính này",
+ "native.dialog.settingsFile.notHereDetail": "Mở Cài đặt để thay đổi cài đặt của một Cloud hoặc máy chủ khác.",
+ "native.dialog.settingsFile.missing": "Chưa có tệp cài đặt",
+ "native.dialog.settingsFile.missingDetail": "Máy tính này chưa có config.json. Tệp sẽ xuất hiện khi bạn thay đổi điều gì đó trong Cài đặt.",
+ "native.dialog.settingsReload.done": "Đã tải lại cài đặt",
+ "native.dialog.settingsReload.applied": "Đang dùng: {sections}",
+ "native.dialog.settingsReload.restart": "Thoát và mở lại ứng dụng để dùng: {sections}",
+ "native.dialog.settingsReload.unchanged": "Không có gì thay đổi trong tệp cài đặt.",
+ "native.dialog.settingsReload.failed": "Chưa tải lại cài đặt",
+ "native.dialog.settingsReload.keptLast": "Cài đặt hoạt động gần nhất vẫn đang được dùng. Sửa tệp rồi chọn Tải lại cài đặt lần nữa.",
+ "native.dialog.settingsReload.notRunning": "Máy chủ của máy tính này không phản hồi. Hãy thử lại sau giây lát.",
"settings.search.advancedNote": "Hiển thị từ tìm kiếm. Đây là cài đặt của chế độ nâng cao.",
"settings.search.turnOnAdvanced": "Bật chế độ nâng cao",
"native.dialog.share.detail": "Cho phép bot của máy chủ này dùng các thư mục và khả năng bạn chọn trong khi ứng dụng máy tính này đang chạy. Không có gì được chia sẻ trừ khi bạn bật. Bạn có thể đổi điều này sau trong Cài đặt → Ứng dụng này → Máy tính của bạn.",
diff --git a/src/locales/zh-tw.json b/src/locales/zh-tw.json
index 1e02cc259e..d503b63e06 100644
--- a/src/locales/zh-tw.json
+++ b/src/locales/zh-tw.json
@@ -10172,6 +10172,19 @@
"sidebar.menu.signedInTo": "已登入 {place}",
"settings.plan.openCloud": "開啟 {place}",
"native.menu.settings": "設定…",
+ "native.menu.openSettingsFile": "打開設定檔",
+ "native.menu.reloadSettings": "重新載入設定",
+ "native.dialog.settingsFile.notHere": "這個地方的設定檔不在這台電腦上",
+ "native.dialog.settingsFile.notHereDetail": "要變更 Cloud 或其他伺服器的設定,請打開設定。",
+ "native.dialog.settingsFile.missing": "還沒有設定檔",
+ "native.dialog.settingsFile.missingDetail": "這台電腦還沒有 config.json。你在設定中變更任何內容後就會產生。",
+ "native.dialog.settingsReload.done": "設定已重新載入",
+ "native.dialog.settingsReload.applied": "正在使用:{sections}",
+ "native.dialog.settingsReload.restart": "結束並重新打開 App 以使用:{sections}",
+ "native.dialog.settingsReload.unchanged": "設定檔沒有任何變化。",
+ "native.dialog.settingsReload.failed": "設定未重新載入",
+ "native.dialog.settingsReload.keptLast": "仍在使用上次可用的設定。請修正檔案,然後再次選擇「重新載入設定」。",
+ "native.dialog.settingsReload.notRunning": "這台電腦的伺服器沒有回應。請稍後再試。",
"settings.search.advancedNote": "從搜尋中顯示。這是進階模式的設定。",
"settings.search.turnOnAdvanced": "開啟進階模式",
"settings.learnMore": "了解更多",
diff --git a/src/locales/zh.json b/src/locales/zh.json
index 2ac286b6e8..73663cfe45 100644
--- a/src/locales/zh.json
+++ b/src/locales/zh.json
@@ -11436,6 +11436,19 @@
"sidebar.menu.signedInTo": "已登录 {place}",
"settings.plan.openCloud": "打开 {place}",
"native.menu.settings": "设置…",
+ "native.menu.openSettingsFile": "打开设置文件",
+ "native.menu.reloadSettings": "重新载入设置",
+ "native.dialog.settingsFile.notHere": "这个地方的设置文件不在这台电脑上",
+ "native.dialog.settingsFile.notHereDetail": "要更改 Cloud 或其他服务器的设置,请打开设置。",
+ "native.dialog.settingsFile.missing": "还没有设置文件",
+ "native.dialog.settingsFile.missingDetail": "这台电脑还没有 config.json。你在设置中更改任何内容后就会生成。",
+ "native.dialog.settingsReload.done": "设置已重新载入",
+ "native.dialog.settingsReload.applied": "正在使用:{sections}",
+ "native.dialog.settingsReload.restart": "退出并重新打开应用以使用:{sections}",
+ "native.dialog.settingsReload.unchanged": "设置文件没有任何变化。",
+ "native.dialog.settingsReload.failed": "设置未重新载入",
+ "native.dialog.settingsReload.keptLast": "仍在使用上次可用的设置。请修正文件,然后再次选择“重新载入设置”。",
+ "native.dialog.settingsReload.notRunning": "这台电脑的服务器没有响应。请稍后再试。",
"settings.search.advancedNote": "从搜索中显示。这是高级模式的设置。",
"settings.search.turnOnAdvanced": "开启高级模式",
"settings.learnMore": "了解更多",