Skip to content

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

i18n(pt-br): upstream chat, setup and desktop notices follow the app language

KesleyDEV54f8a309f5e8
diff --git a/electron/approval-trusted-mode.cjs b/electron/approval-trusted-mode.cjs
index 8de845dcba..da7a13acf7 100644
--- a/electron/approval-trusted-mode.cjs
+++ b/electron/approval-trusted-mode.cjs
@@ -1,5 +1,12 @@
"use strict";
+const { englishText } = require("./native-text.cjs");
+const ERROR_KEYS = Object.freeze({
+ "serverError.approval.allThreads": "native.approval.allThreads",
+ "serverError.approval.pending": "native.approval.pending",
+ "serverError.approval.provider": "native.approval.provider",
+});
+
const BOT_ID = /^[A-Za-z0-9_-]{1,120}$/;
const REQUEST_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
const APPROVAL_MODES = new Set(["ask", "edits", "auto", "full", "custom"]);
@@ -112,11 +119,12 @@ function decodeTrustedApprovalModeResult(rawMessage) {
requestId: message.requestId,
ok: false,
error: (error || "The approval mode could not be enabled").slice(0, 300),
+ ...(Object.hasOwn(ERROR_KEYS, message.errorKey) ? { errorKey: message.errorKey } : {}),
};
}
/** The process object is part of the correlation key, so a stale or replacement child cannot answer another child's grant. */
-function createTrustedApprovalModeCoordinator({ randomId, timeoutMs = 10_000 } = {}) {
+function createTrustedApprovalModeCoordinator({ randomId, timeoutMs = 10_000, t = englishText.t } = {}) {
if (typeof randomId !== "function") throw new Error("trusted approval-mode request id generator is unavailable");
if (!Number.isSafeInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 60_000) {
throw new Error("invalid trusted approval-mode request timeout");
@@ -316,7 +324,9 @@ function createTrustedApprovalModeCoordinator({ randomId, timeoutMs = 10_000 } =
// Consume late, duplicated or foreign answers, but never let one cross processes.
if (!waiting || waiting.proc !== proc || waiting.phase !== "setting") return true;
if (!result.ok) {
- settle(result.requestId, ({ reject }) => reject(new Error(result.error)));
+ const key = ERROR_KEYS[result.errorKey];
+ const text = key && result.error === englishText.t(key) ? t(key) : result.error;
+ settle(result.requestId, ({ reject }) => reject(new Error(text)));
return true;
}
const resultMode = waiting.threadOnly && (waiting.mode === "full" || waiting.mode === "custom")
diff --git a/electron/approval-trusted-mode.node-test.mjs b/electron/approval-trusted-mode.node-test.mjs
index f57589ed77..db80411360 100644
--- a/electron/approval-trusted-mode.node-test.mjs
+++ b/electron/approval-trusted-mode.node-test.mjs
@@ -2,6 +2,39 @@ import assert from "node:assert/strict";
import { test } from "node:test";
import approvalModule from "./approval-trusted-mode.cjs";
+import nativeText from "./native-text.cjs";
+
+test("trusted refusals translate only canonical whitelisted errors from the matching process", async () => {
+ const text = nativeText.createNativeText({ saved: "pt-br" });
+ for (const [errorKey, nativeKey] of [
+ ["serverError.approval.allThreads", "native.approval.allThreads"],
+ ["serverError.approval.pending", "native.approval.pending"],
+ ["serverError.approval.provider", "native.approval.provider"],
+ ]) {
+ const english = nativeText.englishText.t(nativeKey);
+ for (const [key, error, expected] of [
+ [errorKey, english, text.t(nativeKey)],
+ [errorKey, "Changed server wording", "Changed server wording"],
+ ["native.update.installing", english, english],
+ ["constructor", english, english],
+ [undefined, english, english],
+ ]) {
+ const proc = fakeProcess();
+ const coordinator = createTrustedApprovalModeCoordinator({ randomId: () => REQUEST_ID, t: text.t });
+ const pending = coordinator.request(proc, "bot-1", "ask");
+ const result = { type: "approval-trusted-mode-result", requestId: REQUEST_ID, ok: false, error, errorKey: key };
+ coordinator.receive(fakeProcess(), result);
+ coordinator.receive(proc, result);
+ await assert.rejects(pending, { message: expected });
+ assert.equal(proc.messages.length, 1);
+ }
+ const proc = fakeProcess();
+ const coordinator = createTrustedApprovalModeCoordinator({ randomId: () => REQUEST_ID });
+ const pending = coordinator.request(proc, "bot-1", "ask");
+ coordinator.receive(proc, { type: "approval-trusted-mode-result", requestId: REQUEST_ID, ok: false, error: english, errorKey });
+ await assert.rejects(pending, { message: english });
+ }
+});
const {
createTrustedApprovalModeCoordinator,
diff --git a/electron/cloud-lending.node-test.mjs b/electron/cloud-lending.node-test.mjs
index 751b728f8a..28fb1fae54 100644
--- a/electron/cloud-lending.node-test.mjs
+++ b/electron/cloud-lending.node-test.mjs
@@ -13,6 +13,15 @@ const ORIGIN = "https://omb-u-fixture.fly.dev";
const binding = { accountId: "acct_1", origin: ORIGIN };
const env = { id: "my-cloud", name: "My Cloud", origin: ORIGIN };
+test("an empty Cloud grant follows the current native language without changing its English", async t => {
+ const text = nativeText.createNativeText({ saved: "en" });
+ const { sharing } = await lendingFixture(t, { t: text.t });
+ for (const language of ["en", "pt-br"]) {
+ text.set(language);
+ await assert.rejects(sharing.saveCloud(env, { folders: [], screen: false }), { message: text.t("native.lend.chooseCapability") });
+ }
+});
+
test("the Cloud verdict: same account and machine run, anything else ends or pauses", () => {
const connected = { status: "connected", accountId: "acct_1", origin: ORIGIN };
assert.deepEqual(cloudLendingVerdict(binding, connected, env), { allow: true });
@@ -91,6 +100,7 @@ async function lendingFixture(t, options = {}) {
const sharing = createComputerSharing({
file: path.join(dir, "profile", "computer-sharing.json"), fetch: home.fetch, environments: () => [env],
...(options.reconnect ? { reconnect: options.reconnect } : {}), ...(options.now ? { now: options.now } : {}),
+ ...(options.t ? { t: options.t } : {}),
// The maintainer flag is off, as for every Cloud Pro user.
enabled: async () => { maintainerChecks++; return false; },
cloud: () => cloud, home: path.join(dir, "home"),
diff --git a/electron/computer-sharing.mjs b/electron/computer-sharing.mjs
index bdd91a1add..3b3f1fe792 100644
--- a/electron/computer-sharing.mjs
+++ b/electron/computer-sharing.mjs
@@ -14,6 +14,7 @@ import { linkUrl, runDeviceLink } from "./device-link.mjs";
import { LINK_ASLEEP, linkPath } from "./device-link-protocol.mjs";
import { existingFolders } from "./cloud-lending-ipc.mjs";
import { shareableDrive } from "./shared-drives.mjs";
+import nativeText from "./native-text.cjs";
const uuid = value => typeof value === "string" && /^[a-f0-9]{8}-[a-f0-9]{4}-[1-8][a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$/i.test(value);
const DATA_VOLUME = "/System/Volumes/Data";
@@ -152,7 +153,7 @@ const BROWSE_NOTE_MS = 10 * 60_000;
* carries it (the session cookie). `myCloud()`: the saved server that is the person's own My Cloud, which gets this
* computer's internet connection by default (internetByDefault). */
export function createComputerSharing({ file, fetch: fetchImpl, environments, cuaConnection, hostControl, screenLocked = () => false, protectedPaths = [], enabled = async () => false, home = os.homedir(), activityFile, cloud = () => null, onChange = () => {}, reconnect = null, now = Date.now, power = createCloudPowerGate(),
- linkHeaders = () => ({}), WebSocket: linkSocket = globalThis.WebSocket, egress = {}, chrome = {}, myCloud = () => null }) {
+ linkHeaders = () => ({}), WebSocket: linkSocket = globalThis.WebSocket, egress = {}, chrome = {}, myCloud = () => null, t = nativeText.englishText.t }) {
const protectedRoots = [path.dirname(file), ...protectedPaths.filter(entry => typeof entry === "string" && entry), ...personalSecretPaths(home)];
const activity = createLendingActivity(activityFile ?? path.join(path.dirname(file), "lending-activity.jsonl"));
let records = {};
@@ -541,7 +542,7 @@ export function createComputerSharing({ file, fetch: fetchImpl, environments, cu
const current = verifiedCloud(env);
if (!current) throw Object.assign(new Error("Open My Cloud first."), { problem: "connect-first" });
const folders = await validateSharedFolders(input?.folders);
- if (!folders.length && input?.screen !== true && input?.internet !== true && input?.chrome !== true && input?.terminal !== true) throw new Error("Choose at least one folder, apps and screen, the internet connection, your Chrome, or the terminal.");
+ if (!folders.length && input?.screen !== true && input?.internet !== true && input?.chrome !== true && input?.terminal !== true) throw new Error(t("native.lend.chooseCapability"));
let info = { sessionId: null, environmentId: null };
try { info = await cloudIdentity(env); } catch (error) { if (error.problem !== "connect-first") throw error; }
const grant = cloudGrant(env, current, info, { ...input, folders });
diff --git a/electron/elevated-install.mjs b/electron/elevated-install.mjs
index fffb5483b9..caecf746b5 100644
--- a/electron/elevated-install.mjs
+++ b/electron/elevated-install.mjs
@@ -1,6 +1,7 @@
import { execFile } from "node:child_process";
import { accessSync, constants, lstatSync } from "node:fs";
import { isAbsolute } from "node:path";
+import { installDetail } from "./update-words.mjs";
// Installs a downloaded .deb behind one polkit prompt. Root copies the file to a root-only dir and checks the feed's SHA-512 before apt-get sees it,
// so a file swapped in the user-writable cache after the download is refused. Only this fixed script runs as root, never renderer text.
@@ -85,14 +86,14 @@ export function installPackageElevated({
return Promise.resolve({
ok: false,
reason: "unverifiable",
- detail: "The downloaded package is no longer available. Try the update again.",
+ ...installDetail("native.update.packageMissing"),
});
}
if (!expected) {
return Promise.resolve({
ok: false,
reason: "unverifiable",
- detail: "The update feed gave no checksum to verify the package against.",
+ ...installDetail("native.update.noChecksum"),
});
}
@@ -106,23 +107,24 @@ export function installPackageElevated({
(error, _stdout, stderr) => {
if (!error) return resolve({ ok: true });
if (error.code === "ENOENT") {
- return resolve({ ok: false, reason: "unavailable", detail: "pkexec is not installed." });
+ return resolve({ ok: false, reason: "unavailable", ...installDetail("native.update.noPkexec") });
}
if (error.code === PKEXEC_DISMISSED) {
- return resolve({ ok: false, reason: "declined", detail: "The password prompt was closed." });
+ return resolve({ ok: false, reason: "declined", ...installDetail("native.update.promptClosed") });
}
if (error.code === PKEXEC_NOT_AUTHORIZED) {
- return resolve({ ok: false, reason: "refused", detail: "This session could not ask for administrator rights." });
+ return resolve({ ok: false, reason: "refused", ...installDetail("native.update.noAdmin") });
}
if (error.code === CHECKSUM_MISMATCH) {
return resolve({
ok: false,
reason: "checksum",
- detail: "The downloaded update did not match its checksum. Check again to download it fresh.",
+ ...installDetail("native.update.checksumMismatch"),
});
}
- const reason = error.killed ? "The install took too long." : lastLine(stderr) || error.message;
- resolve({ ok: false, reason: "failed", detail: `The install did not finish: ${reason}`.slice(0, 240) });
+ const reason = error.killed ? installDetail("native.update.installTimedOut").detail : lastLine(stderr) || error.message;
+ const words = installDetail("native.update.installFailed", { reason, ...(error.killed ? { timedOut: "true" } : {}) });
+ resolve({ ok: false, reason: "failed", ...words, detail: words.detail.slice(0, 240) });
},
);
} catch (error) {
diff --git a/electron/elevated-install.node-test.mjs b/electron/elevated-install.node-test.mjs
index f6c1b2e186..d8f514d17e 100644
--- a/electron/elevated-install.node-test.mjs
+++ b/electron/elevated-install.node-test.mjs
@@ -86,10 +86,14 @@ test("each way the install can end maps to a reason the card can act on", async
});
const coded = (code, extra = {}) => Object.assign(new Error(`exit ${code}`), { code, ...extra });
- assert.equal((await outcome(coded(126))).reason, "declined");
- assert.equal((await outcome(coded(127))).reason, "refused");
- assert.equal((await outcome(coded(65))).reason, "checksum");
- assert.equal((await outcome(coded("ENOENT"))).reason, "unavailable");
+ for (const [code, reason, key, detail] of [
+ [126, "declined", "native.update.promptClosed", "The password prompt was closed."],
+ [127, "refused", "native.update.noAdmin", "This session could not ask for administrator rights."],
+ [65, "checksum", "native.update.checksumMismatch", "The downloaded update did not match its checksum. Check again to download it fresh."],
+ ["ENOENT", "unavailable", "native.update.noPkexec", "pkexec is not installed."],
+ ]) assert.deepEqual(await outcome(coded(code)), { ok: false, reason, detail, detailKey: key });
+ const timedOut = await outcome(coded(null, { killed: true }));
+ assert.deepEqual(timedOut, { ok: false, reason: "failed", detail: "The install did not finish: The install took too long.", detailKey: "native.update.installFailed", detailParams: { reason: "The install took too long.", timedOut: "true" } });
const failed = await outcome(coded(100), "W: noise\nE: Unable to acquire the dpkg frontend lock\n");
assert.equal(failed.reason, "failed");
diff --git a/electron/lending-dialogs.mjs b/electron/lending-dialogs.mjs
index f7e8380784..8727f71b52 100644
--- a/electron/lending-dialogs.mjs
+++ b/electron/lending-dialogs.mjs
@@ -83,9 +83,9 @@ export function createLendingDialogs({ dialog, window, validate, isHome = async
const parent = window();
if (!parent || parent.isDestroyed()) return false;
const { response } = await dialog.showMessageBox(parent, {
- type: "warning", message: "Let My Cloud's bots run commands on this computer as you?",
- detail: "There is no limit on what a command can do: they can read, change or delete anything you can, and install software. Only continue if you trust them with this computer. It turns off again whenever lending is turned off.",
- buttons: ["Allow the terminal", "Cancel"], defaultId: 1, cancelId: 1,
+ type: "warning", message: t("native.lend.terminal.title"),
+ detail: t("native.lend.terminal.detail"),
+ buttons: [t("native.lend.terminal.button"), t("native.common.cancel")], defaultId: 1, cancelId: 1,
});
return response === 0;
},
diff --git a/electron/lending-dialogs.node-test.mjs b/electron/lending-dialogs.node-test.mjs
index 52b459fda9..e00c272972 100644
--- a/electron/lending-dialogs.node-test.mjs
+++ b/electron/lending-dialogs.node-test.mjs
@@ -21,6 +21,24 @@ function fakeDialog({ response = 1, picked = { canceled: true, filePaths: [] } }
const liveWindow = () => ({ isDestroyed: () => false });
const named = async (folders) => folders.map((folder) => ({ ...folder, name: folder.path.split("/").pop() }));
+test("the unrestricted terminal warning follows language changes and keeps Cancel as the default", async () => {
+ const text = nativeText.createNativeText({ saved: "en" });
+ for (const language of ["en", "pt-br"]) {
+ text.set(language);
+ for (const response of [0, 1, -1]) {
+ const { dialog, calls } = fakeDialog({ response });
+ const dialogs = createLendingDialogs({ dialog, window: liveWindow, validate: named, t: text.t });
+ assert.equal(await dialogs.confirmTerminal(), response === 0);
+ const options = calls[0][2];
+ assert.equal(options.message, text.t("native.lend.terminal.title"));
+ assert.equal(options.detail, text.t("native.lend.terminal.detail"));
+ assert.deepEqual(options.buttons, [text.t("native.lend.terminal.button"), text.t("native.common.cancel")]);
+ assert.deepEqual([options.defaultId, options.cancelId], [1, 1]);
+ assert.match(options.detail, language === "en" ? /read, change or delete anything/ : /ler, alterar ou excluir tudo/);
+ }
+ }
+});
+
test("a picked folder is checked and lent read only; a cancelled picker lends nothing", async () => {
const win = liveWindow(), checked = [];
const validate = async (folders) => { checked.push(folders); return named(folders); };
diff --git a/electron/main.mjs b/electron/main.mjs
index da6b7d7367..55b35ba7a0 100644
--- a/electron/main.mjs
+++ b/electron/main.mjs
@@ -338,7 +338,7 @@ const includedX = createDesktopIncludedX({ account: () => cloudAccount, server:
const cloudPower = createCloudPowerGate({ power: () => cloudAccount?.power() ?? null, wanted: () => Boolean(cloudSync?.running() || computerSharing?.lendingToCloud()) });
const utilityServerExits = new WeakMap();
const UTILITY_SERVER_STOP_TIMEOUT_MS = 6_500;
-const trustedApprovalMode = createTrustedApprovalModeCoordinator({ randomId: randomUUID });
+const trustedApprovalMode = createTrustedApprovalModeCoordinator({ randomId: randomUUID, t: (...args) => nativeT(...args) });
const desktopMutationToken = randomBytes(32).toString("base64url");
const desktopLaunchId = randomUUID();
const companionMutationToken = randomBytes(32).toString("base64url");
@@ -1507,7 +1507,7 @@ function sharingController() {
protectedPaths: [desktopDataDir()],
fetch: (...args) => session.defaultSession.fetch(...args),
environments: () => environmentsState.environments,
- enabled: refreshSharedComputersAllowed,
+ enabled: refreshSharedComputersAllowed, t: nativeT,
cloud: lendingTarget.cloud, myCloud: lendingTarget.environment, power: cloudPower, reconnect: origin => signInCloudSession({ origin, mine: myCloud(), pair: () => ensureCloudAccount().pairHome(), fetch: (...args) => session.defaultSession.fetch(...args) }),
linkHeaders: async env => ({ cookie: (await session.defaultSession.cookies.get({ url: env.origin })).map(cookie => `${cookie.name}=${cookie.value}`).join("; ") }),
onChange: summary => { lendingIndicator().update({ lending: summary.lending.length > 0, internetOnly: summary.internetOnly, terminal: summary.terminal, busy: Boolean(summary.busy && summary.lending.includes(summary.busy.env)) }); loginItem.follow(summary.lending.length > 0); },
diff --git a/electron/update-words.mjs b/electron/update-words.mjs
new file mode 100644
index 0000000000..ea7dde1054
--- /dev/null
+++ b/electron/update-words.mjs
@@ -0,0 +1,14 @@
+import nativeText from "./native-text.cjs";
+
+export function updateWords(key, params) {
+ return { message: nativeText.englishText.t(key, params), messageKey: key, ...(params ? { messageParams: params } : {}) };
+}
+
+export function installDetail(key, params) {
+ const words = updateWords(key, params);
+ return { detail: words.message, detailKey: key, ...(params ? { detailParams: params } : {}) };
+}
+
+export function detailFields(result) {
+ return result?.detailKey ? { messageKey: result.detailKey, ...(result.detailParams ? { messageParams: result.detailParams } : {}) } : {};
+}
diff --git a/electron/updater-coordinator.mjs b/electron/updater-coordinator.mjs
index a9c074c40e..d672d3dbe6 100644
--- a/electron/updater-coordinator.mjs
+++ b/electron/updater-coordinator.mjs
@@ -1,8 +1,9 @@
import { UPDATE_TEXT, updateErrorCode, updateErrorMessage, updateErrorNeedsPerson } from "./update-errors.mjs";
+import { detailFields, updateWords } from "./update-words.mjs";
const said = (error) => {
const code = updateErrorCode(error);
- return code ? { messageCode: code } : {};
+ return code ? { messageCode: code } : error?.messageKey ? { messageKey: error.messageKey, ...(error.messageParams ? { messageParams: error.messageParams } : {}) } : {};
};
/** electron-updater's GitHub provider gives the release body (HTML); a multi-release feed gives [{ version, note }]. */
@@ -97,7 +98,7 @@ export function createUpdaterCoordinator(
quietFailures += 1;
if (quietFailures >= QUIET_FAILURES_BEFORE_NOTICE) {
// The notice does not own the state: hourly checks go on, and the first one that reaches the feed clears it.
- setState({ status: "error", message: `Couldn't check for updates. ${updateErrorMessage(error)}` });
+ setState({ status: "error", ...updateWords("native.update.checkFailed", { error: updateErrorMessage(error) }), ...said(error) });
return;
}
setState({ status: "idle" });
@@ -273,7 +274,7 @@ export function createUpdaterCoordinator(
function elevate() {
const operation = { failed: false, timer: null };
installOperation = operation;
- setState({ status: "installing", message: "Installing the update. Enter your password if asked." });
+ setState({ status: "installing", ...updateWords("native.update.installing") });
Promise.resolve()
.then(() => elevatedInstall(downloadedFiles, { sha512: updater.downloadedUpdateHelper?.downloadedFileInfo?.sha512 }))
.then((result) => {
@@ -297,10 +298,11 @@ export function createUpdaterCoordinator(
return;
}
if (result?.reason === "checksum" || !handOffInstall) {
- routeError(true, new Error(result?.detail || "The update could not be installed."));
+ const words = result?.detail ? { message: result.detail, ...detailFields(result) } : updateWords("native.update.installFailedPlain");
+ routeError(true, Object.assign(new Error(words.message), words));
return;
}
- handOff(result?.detail);
+ handOff(result?.detail, detailFields(result));
})
.catch((error) => {
if (installOperation !== operation) return;
@@ -309,7 +311,7 @@ export function createUpdaterCoordinator(
}
// `note` says why the automatic install did not run, when that is why.
- function handOff(note) {
+ function handOff(note, words = {}) {
const operation = { failed: false, timer: null };
installOperation = operation;
setState({ status: "installing", message: undefined });
@@ -318,8 +320,8 @@ export function createUpdaterCoordinator(
.then((patch) => {
if (installOperation !== operation) return;
installOperation = null;
- if (staged) staged = { version: staged.version, patch: { status: "handed-off", version: staged.version, message: note, ...patch } };
- setState({ status: "handed-off", message: note, ...patch });
+ if (staged) staged = { version: staged.version, patch: { status: "handed-off", version: staged.version, message: note, ...words, ...patch } };
+ setState({ status: "handed-off", message: note, ...words, ...patch });
})
.catch((error) => {
if (installOperation !== operation) return;
diff --git a/electron/updater-coordinator.node-test.mjs b/electron/updater-coordinator.node-test.mjs
index bce4e2c99f..2ae4ca44fb 100644
--- a/electron/updater-coordinator.node-test.mjs
+++ b/electron/updater-coordinator.node-test.mjs
@@ -3,6 +3,40 @@ import { EventEmitter } from "node:events";
import test from "node:test";
import { createUpdaterCoordinator } from "./updater-coordinator.mjs";
+import { installDetail } from "./update-words.mjs";
+
+test("elevated-install wording survives terminal handoff and its staged card", async () => {
+ const { h } = elevatedHarness(async () => ({ ok: false, reason: "refused", ...installDetail("native.update.noAdmin") }));
+ await downloadInto(h);
+ h.coordinator.install();
+ assert.equal(h.getState().messageKey, "native.update.installing");
+ assert.equal(h.getState().message, "Installing the update. Enter your password if asked.");
+ await settle();
+ assert.equal(h.getState().status, "handed-off");
+ assert.equal(h.getState().messageKey, "native.update.noAdmin");
+ assert.equal(h.getState().message, "This session could not ask for administrator rights.");
+ await h.coordinator.check();
+ assert.equal(h.getState().messageKey, "native.update.noAdmin");
+});
+
+test("unclassified install details carry their words, while checksum classification still wins", async () => {
+ for (const [reason, key] of [["failed", "native.update.installFailed"], ["checksum", "native.update.checksumMismatch"]]) {
+ const { h, calls } = elevatedHarness(async () => ({ ok: false, reason, ...installDetail(key, reason === "failed" ? { reason: "E: lock." } : undefined) }), { handOffInstall: null });
+ await downloadInto(h);
+ h.coordinator.install();
+ await settle();
+ assert.equal(h.getState().status, "error");
+ if (reason === "checksum") {
+ assert.equal(h.getState().messageCode, "integrity");
+ assert.match(h.getState().message, /failed verification/);
+ } else {
+ assert.equal(h.getState().messageKey, key);
+ assert.equal(h.getState().message, "The install did not finish: E: lock.");
+ assert.deepEqual(h.getState().messageParams, { reason: "E: lock." });
+ }
+ assert.deepEqual(calls.handOff, []);
+ }
+});
function deferred() {
let resolve;
diff --git a/electron/updater.mjs b/electron/updater.mjs
index a225970760..5f0044e372 100644
--- a/electron/updater.mjs
+++ b/electron/updater.mjs
@@ -110,7 +110,7 @@ function relaunchAfterInstall() {
}
function setState(patch) {
- const { messageCode: _stale, ...kept } = state;
+ const { messageCode: _stale, messageKey: _key, messageParams: _params, ...kept } = state;
state = { ...(Object.hasOwn(patch, "message") ? kept : state), ...patch };
if (quiet && patch.status === "error") installFailed(quietRecord());
try {
diff --git a/server/chat-notices.ts b/server/chat-notices.ts
index a5aaaac333..b0f0197baa 100644
--- a/server/chat-notices.ts
+++ b/server/chat-notices.ts
@@ -90,6 +90,35 @@ export const CHAT_NOTICE = {
"chat.notice.phone.write.PHONE_RUN_SCENE": "Run scene on {phone}",
"chat.notice.phone.write.PHONE_SEND_MESSAGE": "Send message on {phone}",
"chat.notice.phone.write.PHONE_SEND_WHATSAPP": "Send whatsapp on {phone}",
+ "chat.notice.acpEmpty": "{provider} finished without replying.",
+ "chat.notice.acpNoReason": "{provider} stopped without saying why.",
+ "chat.notice.stop.refusal": "{provider} refused to go on with this request (stop reason: {reason}). Try again, reword the request, or switch this bot to another AI.",
+ "chat.notice.stop.refusalGeneric": "The AI refused to go on with this request (stop reason: {reason}). Try again, reword the request, or switch this bot to another AI.",
+ "chat.notice.stop.maxTokens": "{provider}'s reply reached its maximum length before it finished (stop reason: {reason}). Ask it to continue, or ask for a shorter answer.",
+ "chat.notice.stop.maxTokensGeneric": "The AI's reply reached its maximum length before it finished (stop reason: {reason}). Ask it to continue, or ask for a shorter answer.",
+ "chat.notice.stop.maxRequests": "The turn made as many model requests as one turn may before it finished (stop reason: {reason}). Ask it to carry on from where it stopped, or split the task.",
+ "chat.notice.unaskedStop": "The AI's request was cut off before it finished, and nobody stopped it (it said only \"{said}\"). Send the message again to try once more.",
+ "chat.notice.piSessionSlow": "Pi is taking longer than usual to start this conversation's session. The turn goes on when Pi answers. Press Stop to cancel it.",
+ "chat.notice.unreadMessage": "This turn ended before the model read a message sent while it ran. Send that message again.",
+ "chat.notice.codexUnsupportedOne": "Codex could not run the tool {tools} (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.codexUnsupportedMany": "Codex could not run the tools {tools} (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.codexUnsupportedMore": "Codex could not run the tools {tools} and {count} more (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.handoffSent": "Sent to {name}",
+ "chat.notice.handoffSentRoom": "Sent to {name} · {room}",
+ "chat.notice.relayReply": "{name} replied: {message}",
+ "chat.notice.relayFrom": "{name} asked me to pass this on: {message}",
+ "chat.notice.relayMessage": "A message for you from {name}: {message}",
+ "chat.notice.reportSent": "Sent to the MausBot team (report {id}). Milind and Omkar get it by email.",
+ "chat.notice.reportSentContact": "Sent to the MausBot team (report {id}). Milind and Omkar get it by email and will reply to {contact}.",
+ "chat.notice.reportLater": "Sent to the MausBot team (report {id}) after an earlier try did not go through. Milind and Omkar get it by email.",
+ "chat.notice.reportLaterContact": "Sent to the MausBot team (report {id}) after an earlier try did not go through. Milind and Omkar get it by email and will reply to {contact}.",
+ "chat.notice.part.reportLimited": "the MausBot team takes only a few reports an hour from each app",
+ "chat.notice.reportWaiting": "Not sent yet: {why}. The report is saved and goes on its own as soon as it can, so there is no need to send it again.",
+ "chat.notice.reportWaitingOne": "Not sent yet: {why}. The report is saved and goes on its own in about {minutes} minute, so there is no need to send it again.",
+ "chat.notice.reportWaitingMany": "Not sent yet: {why}. The report is saved and goes on its own in about {minutes} minutes, so there is no need to send it again.",
+ "chat.notice.reportFull": "Not sent: {count} bug reports are already waiting to go to the MausBot team. Type @devs again once they have gone.",
+ "chat.notice.reportDropped": "A bug report from this conversation could not reach the MausBot team for a week, so it was dropped. Type @devs again to send a new one.",
+
} as const;
export type ChatNoticeKey = keyof typeof CHAT_NOTICE;
@@ -105,6 +134,11 @@ export function noticeLine<Key extends ChatNoticeKey>(key: Key, params?: Record<
return { text: chatNotice(key, safe), textCode: key, ...(safe ? { textParams: safe } : {}) };
}
+export function runtimeNoticeTool(event: { message: string; text?: ServerText }) {
+ return { name: `notice: ${event.message.slice(0, 240)}`, ok: true,
+ ...(event.text ? { nameCode: event.text.key, ...(event.text.params ? { nameParams: redactParams(event.text.params) } : {}) } : {}) };
+}
+
export function noticeSummary(key: ChatNoticeKey, params?: Record<string, string>) {
const line = noticeLine(key, params);
return { summary: line.text, summaryCode: key, ...(line.textParams ? { summaryParams: line.textParams } : {}) };
diff --git a/server/drivers/acp/core.ts b/server/drivers/acp/core.ts
index 27fd952090..2dd586d8b7 100644
--- a/server/drivers/acp/core.ts
+++ b/server/drivers/acp/core.ts
@@ -64,7 +64,8 @@ import { recoveryPromptFor } from "../../resume-recovery.ts";
import { noticeFailure } from "../../chat-notices.ts";
import { engineIdleMs, sessionIdlePolicy } from "../session-idle.ts";
import { classifyError } from "../retry.ts";
-import { engineFailure, engineFailureKind, stopCause } from "../engine-errors.ts";
+import { engineFailure, engineFailureKind } from "../engine-errors.ts";
+import { acpStopFailure } from "./failure-words.ts";
import { narrowsNativeTools, parseToolScope } from "../../../shared/tool-scope.ts";
import { acpMcpServers, type AcpMcpServer } from "../turn-mcp.ts"; import { acpToolProgress } from "../tool-progress.ts";
import { learnedToolCountLimit, mcpToolBudget, retryUnderToolLimit } from "../../tool-count-limit.ts"; import { instanceEnvNames } from "../../bot-box/env.ts";
@@ -622,7 +623,7 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
emit({
...base(threadId, current.turnId),
type: "runtime.error",
- message: `${support.displayName} finished without replying.`,
+ ...noticeFailure("chat.notice.acpEmpty", { provider: support.displayName }),
});
}
emit({ ...base(threadId, current.turnId), type: "turn.completed", ok: finalOk, stopReason: finalStopReason, cost: null });
@@ -1546,15 +1547,10 @@ export function createAcpDriver(support: AcpSupport): ProviderDriver<AcpConfig>
if (reason === "end_turn") settle(threadId, session, true, null);
else if (reason === "cancelled" || state.stopped) settle(threadId, session, true, "cancelled");
else {
- const errorMessage = typeof result?.error === "string" && result.error
- ? result.error
- : typeof result?.message === "string" && result.message
- ? result.message
- : stopCause(reason, support.displayName) ?? `${support.displayName} stopped without saying why.`;
emit({
...base(threadId, turnId),
type: "runtime.error",
- ...(engineFailure(support.displayName, errorMessage) ?? { message: errorMessage }),
+ ...acpStopFailure(result, support.displayName),
});
settle(threadId, session, false, reason ?? "failed");
}
diff --git a/server/drivers/acp/failure-words.ts b/server/drivers/acp/failure-words.ts
new file mode 100644
index 0000000000..2feaecb6de
--- /dev/null
+++ b/server/drivers/acp/failure-words.ts
@@ -0,0 +1,10 @@
+import { noticeFailure } from "../../chat-notices.ts";
+import { engineFailure, stopFailure } from "../engine-errors.ts";
+
+export function acpStopFailure(result: { error?: unknown; message?: unknown; stopReason?: string | null }, provider: string) {
+ const message = typeof result?.error === "string" && result.error ? result.error
+ : typeof result?.message === "string" && result.message ? result.message : undefined;
+ if (message) return engineFailure(provider, message) ?? { message };
+ const failure = stopFailure(result?.stopReason, provider) ?? noticeFailure("chat.notice.acpNoReason", { provider });
+ return engineFailure(provider, failure.message) ?? failure;
+}
diff --git a/server/drivers/acp/opencode-go.test.ts b/server/drivers/acp/opencode-go.test.ts
index cc11151792..2c974c6d3c 100644
--- a/server/drivers/acp/opencode-go.test.ts
+++ b/server/drivers/acp/opencode-go.test.ts
@@ -6,6 +6,7 @@ import { dirname, isAbsolute, join, relative } from "node:path";
import { fileURLToPath } from "node:url";
import { removeTempDir } from "../../testing/cleanup.ts";
+import { runtimeNoticeTool } from "../../chat-notices.ts";
import { recordEvents, type EventRecorder } from "../../testing/events.ts";
import {
canRunOpenCode,
@@ -1209,7 +1210,9 @@ describe("OpenCode session variants", () => {
it("is stored as a status row the person always sees", () => {
const source = readFileSync(new URL("../../index.ts", import.meta.url), "utf8");
const handler = source.slice(source.indexOf('case "runtime.notice":'), source.indexOf('case "runtime.error":'));
- expect(handler).toContain("name: `notice: ${event.message.slice(0, 240)}`");
+ expect(handler).toContain('role: "bot", kind: "activity", tool: runtimeNoticeTool(event)');
+ const message = "Retired model ".repeat(30);
+ expect(runtimeNoticeTool({ message })).toEqual({ name: `notice: ${message.slice(0, 240)}`, ok: true });
});
it("still switches to a model the session offers", async () => {
diff --git a/server/drivers/codex-unsupported-calls.ts b/server/drivers/codex-unsupported-calls.ts
index 55fa058f94..1022afdf69 100644
--- a/server/drivers/codex-unsupported-calls.ts
+++ b/server/drivers/codex-unsupported-calls.ts
@@ -3,6 +3,8 @@
// MCP tool's function_call without the `namespace` codex sent it under (seen with non-OpenAI models behind an
// OpenAI-compatible gateway). The only trace is the thread's rollout file, so the turn reads what it appended there.
import { closeSync, fstatSync, openSync, readSync, statSync } from "node:fs";
+import { noticeFailure } from "../chat-notices.ts";
+import type { ServerText } from "../../shared/server-text.ts";
/** Where the thread's rollout file ended when the turn started. */
export interface RolloutMark {
@@ -78,16 +80,20 @@ export function unsupportedCallsSince(mark: RolloutMark | null, maxBytes = ROLLO
}
}
+export function unsupportedCallsFailure(tools: readonly string[]) {
+ const key = tools.length > 6 ? "chat.notice.codexUnsupportedMore" : tools.length === 1 ? "chat.notice.codexUnsupportedOne" : "chat.notice.codexUnsupportedMany";
+ return noticeFailure(key, { tools: tools.slice(0, 6).join(", "), ...(tools.length > 6 ? { count: String(tools.length - 6) } : {}) });
+}
+
export function unsupportedCallsNotice(tools: readonly string[]): string {
- const named = tools.slice(0, 6).join(", ") + (tools.length > 6 ? ` and ${tools.length - 6} more` : "");
- return `Codex could not run ${tools.length === 1 ? "the tool" : "the tools"} ${named} ("unsupported call"): the AI provider sent ` +
- "the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.";
+ return unsupportedCallsFailure(tools).message;
}
/** Logs and tells the thread about every call codex refused since `mark`, so a dropped namespace is never silent. */
-export function reportUnsupportedCalls(mark: RolloutMark | null, notice: (message: string) => void): void {
+export function reportUnsupportedCalls(mark: RolloutMark | null, notice: (message: string, text?: ServerText) => void): void {
const tools = unsupportedCallsSince(mark);
if (!tools.length) return;
console.warn(`[codex] unsupported tool call (provider dropped the MCP namespace): ${tools.join(", ")}`);
- notice(unsupportedCallsNotice(tools));
+ const failure = unsupportedCallsFailure(tools);
+ notice(failure.message, failure.text);
}
diff --git a/server/drivers/codex.ts b/server/drivers/codex.ts
index 572f15c660..10e7bdcfc0 100644
--- a/server/drivers/codex.ts
+++ b/server/drivers/codex.ts
@@ -1329,7 +1329,7 @@ export const CodexDriver: ProviderDriver<CodexConfig> = {
turnError({ message: state.retryError });
}
if (abandoned) break;
- reportUnsupportedCalls(rolloutAt, (message) => emit({ ...base(threadId, turnId), type: "runtime.notice", message }));
+ reportUnsupportedCalls(rolloutAt, (message, text) => emit({ ...base(threadId, turnId), type: "runtime.notice", message, ...(text ? { text } : {}) }));
void settle(t.status === "completed", t.status === "completed" ? null :
(classifyError({ text: state.lastError }).reason === "provider_safety" ? "provider_safety" : (state.lastError || t.status || "failed")));
break;
diff --git a/server/drivers/engine-errors.ts b/server/drivers/engine-errors.ts
index 5d316de1e2..7f022b456a 100644
--- a/server/drivers/engine-errors.ts
+++ b/server/drivers/engine-errors.ts
@@ -136,29 +136,21 @@ export function plainFailure(provider: string, text: string): { message: string;
return kind === "credits" || kind === "tool_schema" || kind === "tool_count" ? engineFailure(provider, text, { kind })! : { message: text };
}
-/** ACP's StopReason values (protocol v1) that do say why a turn ended early, naming the AI when the caller knows it;
- * each carries the advice that fits it. */
-const STOP_REASON_WORDS: Record<string, { words: (ai: string) => string; hint: string }> = {
- refusal: {
- words: (ai) => `${ai} refused to go on with this request`,
- hint: "Try again, reword the request, or switch this bot to another AI.",
- },
- max_tokens: {
- words: (ai) => `${ai}'s reply reached its maximum length before it finished`,
- hint: "Ask it to continue, or ask for a shorter answer.",
- },
- max_turn_requests: {
- words: () => "The turn made as many model requests as one turn may before it finished",
- hint: "Ask it to carry on from where it stopped, or split the task.",
- },
-};
+/** ACP protocol v1's StopReason values that explain why a turn ended early. */
+export function stopFailure(stopReason: string | null | undefined, provider?: string): { message: string; text?: ServerText } | undefined {
+ const reason = stopReason?.trim();
+ if (!reason) return undefined;
+ const name = provider?.trim();
+ if (reason === "refusal") return name ? noticeFailure("chat.notice.stop.refusal", { provider: name, reason })
+ : noticeFailure("chat.notice.stop.refusalGeneric", { reason });
+ if (reason === "max_tokens") return name ? noticeFailure("chat.notice.stop.maxTokens", { provider: name, reason })
+ : noticeFailure("chat.notice.stop.maxTokensGeneric", { reason });
+ if (reason === "max_turn_requests") return noticeFailure("chat.notice.stop.maxRequests", { reason });
+ return { message: /^[a-z][a-z0-9_]*$/i.test(reason) ? `The engine stopped without saying why (stop reason: ${reason}).` : reason };
+}
/** A failed turn's stop reason as its cause: a bare provider token ("stop_sequence", "rpc_error") is never the whole
* message, and the token stays in it so its class still reads. */
export function stopCause(stopReason: string | null | undefined, provider?: string): string | undefined {
- const reason = stopReason?.trim();
- if (!reason) return undefined;
- const entry = Object.hasOwn(STOP_REASON_WORDS, reason) ? STOP_REASON_WORDS[reason] : undefined;
- if (entry) return `${entry.words(provider?.trim() || "The AI")} (stop reason: ${reason}). ${entry.hint}`;
- return /^[a-z][a-z0-9_]*$/i.test(reason) ? `The engine stopped without saying why (stop reason: ${reason}).` : reason;
+ return stopFailure(stopReason, provider)?.message;
}
diff --git a/server/drivers/openai-chat.ts b/server/drivers/openai-chat.ts
index a1411b80ef..6ff9e6ba04 100644
--- a/server/drivers/openai-chat.ts
+++ b/server/drivers/openai-chat.ts
@@ -21,6 +21,7 @@ import { ChatProtocolError, ChatReasoningDetails, ChatToolCalls, object, type Ch
import { appendNative } from "./native.ts";
import { classifyError, computeBackoff, interruptibleDelay, RETRY_MAX_ATTEMPTS } from "./retry.ts";
import { plainFailure } from "./engine-errors.ts";
+import { noticeFailure } from "../chat-notices.ts";
import { refusesRequestSize, RequestTooLargeError, sizeChange, smallerResend } from "./chat-size-limit.ts";
import { requestTooLargeMessage } from "../../shared/request-too-large.ts";
import { toolSchemaProfileFor } from "../tool-schema-profile.ts";
@@ -867,7 +868,7 @@ export function createOpenAIChatRuntime<Config>(options: RuntimeOptions<Config>)
failure = "Tool processes could not be stopped; their execution state is uncertain.";
}
if (abort.signal.aborted) { ok = false; stopReason = "interrupted"; }
- if (!ok && (unread.length || turnEntry.asides.length)) emit({ ...base(turn.threadId, turnId), type: "runtime.notice", message: "This turn ended before the model read a message sent while it ran. Send that message again." });
+ if (!ok && (unread.length || turnEntry.asides.length)) emit({ ...base(turn.threadId, turnId), type: "runtime.notice", ...noticeFailure("chat.notice.unreadMessage") });
if (failure && (!abort.signal.aborted || cleanupFailed)) {
// "upstream" (an OpenAI-compatible URL) names no provider, and the Cloud trial credit reads its raw line.
const words = options.httpErrorLabel === "upstream" ? { message: failure } : plainFailure(options.httpErrorLabel, failure);
diff --git a/server/drivers/pi.ts b/server/drivers/pi.ts
index 4932b1f630..c259dd1499 100644
--- a/server/drivers/pi.ts
+++ b/server/drivers/pi.ts
@@ -46,6 +46,7 @@ import {
import { appendNative } from "./native.ts";
import { allowsTool, parseToolScope } from "../../shared/tool-scope.ts";
import { buildMcpServers } from "./pi-mcp-servers.ts";
+import { noticeFailure } from "../chat-notices.ts";
const DRIVER_KIND = "piAgent";
const PI_ARGS = ["--mode", "rpc", "--no-session"];
@@ -59,7 +60,6 @@ const PI_AGENT_END_GRACE_MS = 60_000;
/** A prompt sent before pi answers new_session or switch_session runs on a session pi then replaces, so the turn waits
* for that answer however long it takes, and says so in the chat after this long. */
const PI_SESSION_SLOW_MS = 20_000;
-const PI_SESSION_SLOW = "Pi is taking longer than usual to start this conversation's session. The turn goes on when Pi answers. Press Stop to cancel it.";
/** pi answered success:false: an explicit refusal from a live runtime, not a transport failure. */
class PiRpcRefusalError extends Error {}
@@ -912,7 +912,7 @@ export const PiDriver: ProviderDriver<PiConfig> = {
const command = sessionPath ? "switch_session" : "new_session";
const hsPromise = awaitResponse(command, Infinity);
send(sessionPath ? { type: "switch_session", sessionPath } : { type: "new_session" });
- const slow = setTimeout(() => emit({ ...base(threadId, turnId), type: "runtime.notice", message: PI_SESSION_SLOW }), PI_SESSION_SLOW_MS);
+ const slow = setTimeout(() => emit({ ...base(threadId, turnId), type: "runtime.notice", ...noticeFailure("chat.notice.piSessionSlow") }), PI_SESSION_SLOW_MS);
const hs = (await hsPromise.finally(() => clearTimeout(slow))) as { sessionFile?: string; sessionId?: string } | undefined;
if (hs?.sessionFile) sessionFile = hs.sessionFile;
sessionReady = true;
diff --git a/server/engine-check.test.ts b/server/engine-check.test.ts
index e8beff8f63..409f109ec3 100644
--- a/server/engine-check.test.ts
+++ b/server/engine-check.test.ts
@@ -52,7 +52,7 @@ describe("checking a just-connected engine with one tiny real message", () => {
const hanging = { instanceId: "hanging", displayName: "Grok", driverKind: "grokAgent", generateText };
const pending = checkEngine(hanging, { timeoutMs: 5_000 });
await vi.advanceTimersByTimeAsync(5_000);
- expect(await pending).toEqual({ ok: false, error: "Grok didn't answer within 5 seconds." });
+ expect(await pending).toEqual({ ok: false, error: "Grok didn't answer within 5 seconds.", errorKey: "serverError.engineCheck.timeout", errorParams: { name: "Grok", seconds: "5" } });
expect(signal?.aborted).toBe(true);
expect(vi.getTimerCount()).toBe(0);
// The engine is free for the next check.
diff --git a/server/engine-check.ts b/server/engine-check.ts
index ec95413a30..cfe81dfbcb 100644
--- a/server/engine-check.ts
+++ b/server/engine-check.ts
@@ -2,8 +2,10 @@
import type { ProviderInstance } from "./contracts.ts";
import { engineFailureMessage } from "./drivers/engine-errors.ts";
import { redactSecretsInText } from "./redact.ts";
+import { userError } from "./user-errors.ts";
+import type { ServerErrorBody } from "../shared/server-text.ts";
-export type EngineCheck = { ok: true } | { ok: false; error: string } | { ok: null };
+export type EngineCheck = { ok: true } | ({ ok: false } & ServerErrorBody) | { ok: null };
const PROMPT = "This is a connection check. Reply with the single word OK.";
const TIMEOUT_MS = 90_000;
@@ -36,7 +38,7 @@ export function checkEngine(instance: CheckableEngine, options: { timeoutMs?: nu
const stop = new AbortController();
const timer = setTimeout(() => {
stop.abort();
- resolve({ ok: false, error: `${name} didn't answer within ${Math.round(timeoutMs / 1000)} seconds.` });
+ resolve({ ok: false, ...userError("serverError.engineCheck.timeout", { name, seconds: String(Math.round(timeoutMs / 1000)) }) });
}, timeoutMs);
timer.unref?.();
// Wrapped so a call that throws synchronously fails the check too.
diff --git a/server/harness/unasked-stop.test.ts b/server/harness/unasked-stop.test.ts
index f940eab530..088dc6d62c 100644
--- a/server/harness/unasked-stop.test.ts
+++ b/server/harness/unasked-stop.test.ts
@@ -27,14 +27,15 @@ function engine() {
for (const listener of listeners) listener({ eventId: "e", provider: "claude", createdAt: "", threadId, turnId: "turn-1", ...event } as RuntimeEvent);
};
const lastError = () => (seen.findLast((event) => event.type === "runtime.error") as { message: string } | undefined)?.message;
- return { decorated, interrupted, emit, lastError };
+ return { decorated, interrupted, emit, lastError, seen };
}
describe("an engine that ends a turn saying only that its request was aborted", () => {
it("reads as a failure in words when nothing asked it to stop", () => {
- const { emit, lastError } = engine();
+ const { emit, lastError, seen } = engine();
emit("t1", { type: "turn.started" });
emit("t1", { type: "runtime.error", message: "Request was aborted." });
+ expect(seen.at(-1)).toMatchObject({ text: { key: "chat.notice.unaskedStop", params: { said: "Request was aborted." } } });
expect(lastError()).toBe(unaskedStopMessage("Request was aborted."));
expect(errorTranscript(lastError()!).kind).toBe("error");
expect(lastError()).toContain("nobody stopped it");
diff --git a/server/harness/unasked-stop.ts b/server/harness/unasked-stop.ts
index 3ee5cf1703..8f7e021330 100644
--- a/server/harness/unasked-stop.ts
+++ b/server/harness/unasked-stop.ts
@@ -3,12 +3,17 @@
// this engine to stop, it is a failure, and the person must read that in words, not see "Stopped" as if they had.
import { clientCancellation } from "../../shared/client-cancel.ts";
import type { ProviderInstance, RuntimeEvent } from "../contracts.ts";
+import { noticeFailure } from "../chat-notices.ts";
const SAID_CHARS = 120;
-export function unaskedStopMessage(said: string): string {
+export function unaskedStopFailure(said: string) {
const quoted = said.replace(/\s+/g, " ").trim().slice(0, SAID_CHARS).replaceAll('"', "'");
- return `The AI's request was cut off before it finished, and nobody stopped it (it said only "${quoted}"). Send the message again to try once more.`;
+ return noticeFailure("chat.notice.unaskedStop", { said: quoted });
+}
+
+export function unaskedStopMessage(said: string): string {
+ return unaskedStopFailure(said).message;
}
export function withUnaskedStops(instance: ProviderInstance): ProviderInstance {
@@ -23,7 +28,7 @@ export function withUnaskedStops(instance: ProviderInstance): ProviderInstance {
}
if (item.type !== "runtime.error" || asked.has(item.threadId)) return item;
const said = clientCancellation(item.message);
- return said === null ? item : { ...item, message: unaskedStopMessage(said) };
+ return said === null ? item : { ...item, ...unaskedStopFailure(said) };
};
(instance as { adapter: ProviderInstance["adapter"] }).adapter = {
...adapter,
diff --git a/server/host/devs-report-words.ts b/server/host/devs-report-words.ts
new file mode 100644
index 0000000000..d164ad341d
--- /dev/null
+++ b/server/host/devs-report-words.ts
@@ -0,0 +1,27 @@
+import { noticeFailure, type ChatNoticeKey } from "../chat-notices.ts";
+import type { SendOutcome } from "../devs-report-send.ts";
+
+function reportLine(key: ChatNoticeKey, params?: Record<string, string>) {
+ const { message: line, text } = noticeFailure(key, params);
+ return { line, text };
+}
+
+export function sentReportLine(id: string, contact?: string, later = false) {
+ const key = later ? contact ? "chat.notice.reportLaterContact" : "chat.notice.reportLater"
+ : contact ? "chat.notice.reportSentContact" : "chat.notice.reportSent";
+ return reportLine(key, { id, ...(contact ? { contact } : {}) });
+}
+
+export function notYetReportLine(outcome: Extract<SendOutcome, { retry: true }>) {
+ const minutes = outcome.retryAfterMs ? Math.max(1, Math.ceil(outcome.retryAfterMs / 60_000)) : 0;
+ if (outcome.why !== "limited") {
+ const why = outcome.why === "offline" ? "the MausBot team's server could not be reached" : "the MausBot team's server could not take it right now";
+ return { line: `Not sent yet: ${why}. The report is saved and goes on its own${minutes ? ` in about ${minutes} minute${minutes === 1 ? "" : "s"}` : " as soon as it can"}, so there is no need to send it again.`, text: undefined };
+ }
+ return reportLine(minutes ? minutes === 1 ? "chat.notice.reportWaitingOne" : "chat.notice.reportWaitingMany" : "chat.notice.reportWaiting",
+ { why: "chat.notice.part.reportLimited", ...(minutes ? { minutes: String(minutes) } : {}) });
+}
+
+export const refusedReportLine = (detail: string) => ({ line: `The MausBot team's server refused this bug report, so nothing was sent: ${detail.replace(/[.\s]+$/, "")}.`, text: undefined });
+export const fullReportLine = (count: number) => reportLine("chat.notice.reportFull", { count: String(count) });
+export const droppedReportLine = () => reportLine("chat.notice.reportDropped");
diff --git a/server/host/devs-reports.test.ts b/server/host/devs-reports.test.ts
index a94bb80251..a15b399b58 100644
--- a/server/host/devs-reports.test.ts
+++ b/server/host/devs-reports.test.ts
@@ -120,6 +120,7 @@ describe("a message that tags @devs", () => {
expect(fx.sent).toHaveLength(1);
expect(fx.sent[0]!.description).toContain("No summary from a bot: the bot did not call report_bug.");
expect(fx.notices("scout-main")).toEqual([`notice: ${sentLine("report-1", "[email protected]")}`]);
+ expect(fx.store.activePath("scout-main").at(-1)?.tool).toMatchObject({ nameCode: "chat.notice.reportSentContact", nameParams: { id: "report-1", contact: "[email protected]" } });
fx.stop();
});
diff --git a/server/host/devs-reports.ts b/server/host/devs-reports.ts
index eefdfb4227..2b046de075 100644
--- a/server/host/devs-reports.ts
+++ b/server/host/devs-reports.ts
@@ -24,6 +24,8 @@ import { PASS } from "../routes/table.ts";
import type { PublicSession } from "../sessions.ts";
import type { BotRecord, Message, Store, StoreChange } from "../store.ts";
import { clip } from "./text-clip.ts";
+import type { ServerText } from "../../shared/server-text.ts";
+import { droppedReportLine, fullReportLine, notYetReportLine, refusedReportLine, sentReportLine } from "./devs-report-words.ts";
export const DEVS_REPORTS_FILE = "devs-reports.json";
const TICK_MS = 2_000;
@@ -54,7 +56,7 @@ const bodySchema = z.object({
type Waiting = z.infer<typeof waitingSchema> & { answered?: boolean; offered?: boolean; restored?: boolean };
type Queued = z.infer<typeof queuedSchema>;
/** What the person is told, and the words in a bot's reply that show it already told them. */
-type Told = { ok: boolean; line: string; marker: string };
+type Told = { ok: boolean; line: string; marker: string; text?: ServerText };
type Author = { bot: BotRecord; summary: BotSummary } | { why: string };
export interface DevsReportsDeps {
@@ -94,19 +96,7 @@ export interface DevsReportContext {
readBody: () => Promise<unknown>;
}
-export const sentLine = (reportId: string, contact?: string) =>
- `Sent to the MausBot team (report ${reportId}). Milind and Omkar get it by email${contact ? ` and will reply to ${contact}` : ""}.`;
-const laterLine = (reportId: string, contact?: string) =>
- `Sent to the MausBot team (report ${reportId}) after an earlier try did not go through. Milind and Omkar get it by email${contact ? ` and will reply to ${contact}` : ""}.`;
-function notYetLine(outcome: Extract<SendOutcome, { retry: true }>): string {
- const minutes = outcome.retryAfterMs ? Math.max(1, Math.ceil(outcome.retryAfterMs / 60_000)) : 0;
- const why = outcome.why === "limited" ? "the MausBot team takes only a few reports an hour from each app"
- : outcome.why === "offline" ? "the MausBot team's server could not be reached" : "the MausBot team's server could not take it right now";
- return `Not sent yet: ${why}. The report is saved and goes on its own${minutes ? ` in about ${minutes} minute${minutes === 1 ? "" : "s"}` : " as soon as it can"}, so there is no need to send it again.`;
-}
-const refusedLine = (detail: string) => `The MausBot team's server refused this bug report, so nothing was sent: ${detail.replace(/[.\s]+$/, "")}.`;
-const fullLine = `Not sent: ${MAX_OUTBOX} bug reports are already waiting to go to the MausBot team. Type @devs again once they have gone.`;
-const droppedLine = "A bug report from this conversation could not reach the MausBot team for a week, so it was dropped. Type @devs again to send a new one.";
+export const sentLine = (reportId: string, contact?: string) => sentReportLine(reportId, contact).line;
/** Rides on the turn that answers a @devs message. */
const TURN_NOTE = "\n\n[From OpenMausBot, not the person: this message tags @devs, so it is a bug report for the MausBot team, OpenMausBot's developers. Call report_bug once, first: what the person says went wrong; what you saw yourself in this conversation (errors, failed tools, stuck steps), or that you saw nothing unusual; and steps to reproduce. Leave out passwords, keys, tokens and file contents; OpenMausBot adds the app's own diagnostics. Then tell the person, word for word, the line report_bug returns, and help with the problem if you can.]";
@@ -172,7 +162,7 @@ export function createDevsReports(deps: DevsReportsDeps) {
}
};
const notice = (threadId: string, said: Told) => {
- try { store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: `notice: ${said.line}`, ok: said.ok } }); }
+ try { store.appendMessage(threadId, { role: "bot", kind: "activity", tool: { name: `notice: ${said.line}`, ok: said.ok, ...(said.text ? { nameCode: said.text.key, nameParams: said.text.params } : {}) } }); }
catch { /* the conversation is gone; the report still went */ }
};
const botNames = () => store.bots.map((bot) => bot.name);
@@ -231,13 +221,13 @@ export function createDevsReports(deps: DevsReportsDeps) {
function settle(entry: { messageId: string; threadId: string }, payload: DevsReportPayload, outcome: SendOutcome, contact?: string): Told {
if (outcome.ok) {
lastSent.set(entry.threadId, { reportId: outcome.id, at: now() });
- return { ok: true, line: sentLine(outcome.id, contact), marker: outcome.id };
+ return { ok: true, ...sentReportLine(outcome.id, contact), marker: outcome.id };
}
- if (!outcome.retry) return { ok: false, line: refusedLine(outcome.detail), marker: "MausBot team" };
- if (outbox.length >= MAX_OUTBOX) return { ok: false, line: fullLine, marker: "MausBot team" };
+ if (!outcome.retry) return { ok: false, ...refusedReportLine(outcome.detail), marker: "MausBot team" };
+ if (outbox.length >= MAX_OUTBOX) return { ok: false, ...fullReportLine(MAX_OUTBOX), marker: "MausBot team" };
outbox.push({ messageId: entry.messageId, threadId: entry.threadId, payload, firstAt: now(), attempts: 1,
nextAt: now() + (outcome.retryAfterMs ?? RETRY_MS[0]) });
- return { ok: false, line: notYetLine(outcome), marker: "MausBot team" };
+ return { ok: false, ...notYetReportLine(outcome), marker: "MausBot team" };
}
function deliver(entry: Waiting, author: Author): Promise<Told> {
@@ -273,13 +263,13 @@ export function createDevsReports(deps: DevsReportsDeps) {
if (outcome.ok) {
outbox = outbox.filter((one) => one !== queued);
lastSent.set(queued.threadId, { reportId: outcome.id, at: now() });
- notice(queued.threadId, { ok: true, line: laterLine(outcome.id, contact), marker: outcome.id });
+ notice(queued.threadId, { ok: true, ...sentReportLine(outcome.id, contact, true), marker: outcome.id });
} else if (!outcome.retry) {
outbox = outbox.filter((one) => one !== queued);
- notice(queued.threadId, { ok: false, line: refusedLine(outcome.detail), marker: "" });
+ notice(queued.threadId, { ok: false, ...refusedReportLine(outcome.detail), marker: "" });
} else if (now() - queued.firstAt > KEPT_MS) {
outbox = outbox.filter((one) => one !== queued);
- notice(queued.threadId, { ok: false, line: droppedLine, marker: "" });
+ notice(queued.threadId, { ok: false, ...droppedReportLine(), marker: "" });
} else {
queued.attempts += 1;
queued.nextAt = now() + (outcome.retryAfterMs ?? RETRY_MS[Math.min(queued.attempts - 1, RETRY_MS.length - 1)]!);
@@ -330,7 +320,7 @@ export function createDevsReports(deps: DevsReportsDeps) {
if (!tagsDevs(line.text, botNames())) return;
seen.add(line.id);
if (seen.size > 1_000) seen.delete(seen.values().next().value!);
- if (waiting.length >= MAX_WAITING) return notice(threadId, { ok: false, line: fullLine, marker: "" });
+ if (waiting.length >= MAX_WAITING) return notice(threadId, { ok: false, ...fullReportLine(MAX_OUTBOX), marker: "" });
const redact = (text: string) => clip(redactReportText(text, secrets()), 3_000);
waiting.push({ messageId: line.id, threadId, at: line.at, text: redact(line.text), words: redact(withoutDevsTags(line.text, botNames())),
...(line.sender ? { sender: { name: line.sender.name, ...(line.sender.id ? { id: line.sender.id } : {}) } } : {}) });
diff --git a/server/host/handoff-sent.ts b/server/host/handoff-sent.ts
index 27e4e307da..cc56fce288 100644
--- a/server/host/handoff-sent.ts
+++ b/server/host/handoff-sent.ts
@@ -1,4 +1,5 @@
import type { Message } from "../store.ts";
+import { noticeTool } from "../chat-notices.ts";
type Who = { id: string; name: string; color: string };
@@ -21,10 +22,12 @@ export function sentRow(input: { sender: Who; recipient: Who; threadId: string;
return {
role: "bot", kind: "activity",
from: { botId: sender.id, name: sender.name, color: sender.color },
- tool: {
- name: outside ? `Sent to ${recipient.name} directly: it isn't in ${roomWords(outside)}.` : `Sent to ${recipient.name}${room && !room.here ? ` · ${room.name}` : ""}`,
+ tool: outside ? {
+ name: `Sent to ${recipient.name} directly: it isn't in ${roomWords(outside)}.`,
ok: true, ...(input.reason ? { output: input.reason } : {}),
- },
+ } : noticeTool(room && !room.here ? "chat.notice.handoffSentRoom" : "chat.notice.handoffSent",
+ { name: recipient.name, ...(room && !room.here ? { room: room.name } : {}) },
+ { ok: true, ...(input.reason ? { output: input.reason } : {}) }),
...(input.doneWhen ? { doneWhen: input.doneWhen } : {}),
...(outside ? { sentDirectly: { name: recipient.name, ...(outside.here ? {} : { room: outside.name }) } } : {}),
...(room && via === "room"
diff --git a/server/host/team-messages.test.ts b/server/host/team-messages.test.ts
index 151fc43db1..d1accc7c27 100644
--- a/server/host/team-messages.test.ts
+++ b/server/host/team-messages.test.ts
@@ -100,6 +100,7 @@ describe("message_person", () => {
expect(f.audiences.get("made-1")).toBe(memberAudience(key(BOB.email)));
expect(f.lines("made-1").map((row) => row.text)).toEqual(["Ada asked me to pass this on: The launch moved to Friday."]);
expect(f.lines("made-1")[0]!.relay).toEqual({ kind: "from", email: ADA.email, name: "Ada" });
+ expect(f.lines("made-1")[0]).toMatchObject({ textCode: "chat.notice.relayFrom", textParams: { name: "Ada", message: "The launch moved to Friday." } });
expect(JSON.stringify(f.lines("made-1"))).not.toContain("salary");
expect(f.lines("ada-private").at(-1)).toMatchObject({ kind: "activity", tool: { name: "Told Bob Stone", ok: true, output: "The launch moved to Friday." }, relay: { kind: "told", email: BOB.email } });
expect(f.notified).toEqual([expect.objectContaining({ kind: "mention", threadId: "made-1", forPerson: key(BOB.email), title: "Message from Ada via Scout" })]);
@@ -125,7 +126,7 @@ describe("message_person", () => {
f.said("made-1", "Yes, tell Ada I'll do it tonight", "Bob");
const back = f.team.pass("scout", "made-1", "Ada", "Bob will review the deck tonight.");
expect(back).toMatchObject({ status: 200, text: expect.stringContaining("Passed back to Ada") });
- expect(f.lines("ada-private").at(-1)).toMatchObject({ role: "bot", kind: "text", text: "Bob Stone replied: Bob will review the deck tonight.", relay: { kind: "reply", email: BOB.email } });
+ expect(f.lines("ada-private").at(-1)).toMatchObject({ role: "bot", kind: "text", text: "Bob Stone replied: Bob will review the deck tonight.", textCode: "chat.notice.relayReply", textParams: { name: "Bob Stone", message: "Bob will review the deck tonight." }, relay: { kind: "reply", email: BOB.email } });
expect(f.notified).toEqual([expect.objectContaining({ threadId: "ada-private", forPerson: key(ADA.email), title: "Bob Stone replied via Scout" })]);
expect(f.lines("made-1").at(-1)).toMatchObject({ kind: "activity", relay: { kind: "told", email: ADA.email } });
expect(f.bots[0]!.tasks.filter((task) => task.threadId.startsWith("made-"))).toHaveLength(1);
diff --git a/server/host/team-messages.ts b/server/host/team-messages.ts
index 66d347bb73..47ba575d4d 100644
--- a/server/host/team-messages.ts
+++ b/server/host/team-messages.ts
@@ -24,6 +24,7 @@ import { PASS } from "../routes/table.ts";
import type { BotRecord, GroupRecord, Message, Store, StoreChange } from "../store.ts";
import type { TeamPeople } from "../team-people.ts";
import { oneLine } from "./text-clip.ts";
+import { noticeLine } from "../chat-notices.ts";
export const TEAM_MESSAGES_FILE = "team-messages.json";
export const MESSAGE_PERSON_PATH = "/api/internal/people/message";
@@ -196,7 +197,7 @@ export function createTeamMessages(deps: TeamMessagesDeps) {
const back = where(at.bot.id, origin);
if (!back || !deps.sees(to).thread(origin)) return null;
const posted = store.appendMessage(origin, {
- role: "bot", kind: "text", text: `${replier.name} replied: ${message}`, relay: { kind: "reply", email: replier.email, name: replier.name },
+ role: "bot", kind: "text", ...noticeLine("chat.notice.relayReply", { name: replier.name, message }), relay: { kind: "reply", email: replier.email, name: replier.name },
...(back.group ? { from: from(at.bot) } : {}),
});
markUnread(at.bot.id, origin, back.group);
@@ -229,8 +230,8 @@ export function createTeamMessages(deps: TeamMessagesDeps) {
relays.push({ threadId: target, botId: bot.id, originThreadId: threadId, from: asker?.key ?? null, fromName: sender.slice(0, 200), to: to.key, at: now() });
}
const posted = store.appendMessage(target, asker
- ? { role: "bot", kind: "text", text: `${asker.name} asked me to pass this on: ${message}`, relay: { kind: "from", email: asker.email, name: asker.name } }
- : { role: "bot", kind: "text", text: `A message for you from ${sender}: ${message}` });
+ ? { role: "bot", kind: "text", ...noticeLine("chat.notice.relayFrom", { name: asker.name, message }), relay: { kind: "from", email: asker.email, name: asker.name } }
+ : { role: "bot", kind: "text", ...noticeLine("chat.notice.relayMessage", { name: sender, message }) });
store.patchTask(bot.id, target, { unread: true });
tell(to, { where: { bot }, threadId: target, messageId: posted.id, title: `Message from ${sender} via ${bot.name}`, from: sender, fromPerson: asker, text: message });
chip(threadId, at, to, message);
diff --git a/server/index.ts b/server/index.ts
index 587308e526..6f4d4678d0 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -91,7 +91,7 @@ import { RoomTurnDeadline, RoomTurnStallRegistry, effectiveRoomTurnTimeoutMinute
import { roomTurnEnd, type RoomClaimEnd } from "./room-turn-end.ts";
import { applyHoldDirective, classifyHoldDirective, heldMemberLine, rememberHeldMessage, stopWordPlacement } from "./room-holds.ts";
import { refusalBody, userError, userErrorFields } from "./user-errors.ts";
-import { chatNotice, failedNoticeTool, noticeTool, resumedTool } from "./chat-notices.ts";
+import { chatNotice, failedNoticeTool, noticeTool, resumedTool, runtimeNoticeTool } from "./chat-notices.ts";
import type { ServerErrorBody } from "../shared/server-text.ts";
import { emailSignInRoute } from "./routes/email-sign-in.ts";
import { createPersonStop } from "./host/person-stop.ts";
@@ -3446,7 +3446,7 @@ function handleDesktopTrustedApprovalMessage(raw: unknown): boolean {
}
if (message.allThreads === true && (existing.approvalGrant || store.tasks(botId).some(task =>
!supportsApprovalMode(task.modelSelection ?? existing.modelSelection, mode)))) {
- respond({ ok: false, error: "Finish this bot's approval change first. Every thread's provider must support this approval level." });
+ respond({ ok: false, ...userError("serverError.approval.allThreads") });
return true;
}
// Edits and Auto are not elevated: one write, no two-phase grant. Only this channel may move a team off Custom.
@@ -3480,7 +3480,7 @@ function handleDesktopTrustedApprovalMessage(raw: unknown): boolean {
return true;
}
if (existing.approvalGrant) {
- respond({ ok: false, error: "Finish this bot's pending approval change first" });
+ respond({ ok: false, ...userError("serverError.approval.pending") });
return true;
}
if (!supportsApprovalMode(target.modelSelection, mode)) {
@@ -3509,7 +3509,7 @@ function handleDesktopTrustedApprovalMessage(raw: unknown): boolean {
// An ambiguous scoped grant may be cleared, but never a different grant.
const clearsOwnGrant = mode === "ask" && existing.approvalGrant?.threadOnly && existing.approvalGrant.threadId === threadId;
if (existing.approvalGrant && !clearsOwnGrant) {
- respond({ ok: false, error: "Finish this bot's pending approval change first" });
+ respond({ ok: false, ...userError("serverError.approval.pending") });
return true;
}
if (!supportsApprovalMode(target.modelSelection, mode)) {
@@ -3556,7 +3556,7 @@ function handleDesktopTrustedApprovalMessage(raw: unknown): boolean {
return true;
}
if (registry.cliTarget(target.modelSelection.instanceId)?.driverKind !== registry.cliTarget(existing.modelSelection.instanceId)?.driverKind) {
- respond({ ok: false, error: "Use the bot's provider on this thread before applying its approval level" });
+ respond({ ok: false, ...userError("serverError.approval.provider") });
return true;
}
}
@@ -6823,7 +6823,7 @@ bus.subscribe((event: RuntimeEvent) => {
});
break;
case "runtime.notice":
- pushMessage({ role: "bot", kind: "activity", tool: { name: `notice: ${event.message.slice(0, 240)}`, ok: true } });
+ pushMessage({ role: "bot", kind: "activity", tool: runtimeNoticeTool(event) });
break;
case "runtime.error":
// A turn the person stopped ends quietly, whatever error the stop cut it short with.
diff --git a/server/routes/setup-request.test.ts b/server/routes/setup-request.test.ts
index 9092ae5f11..4aa082293e 100644
--- a/server/routes/setup-request.test.ts
+++ b/server/routes/setup-request.test.ts
@@ -73,7 +73,7 @@ describe("the Set me up route", () => {
expect(s.waiting()).toMatchObject({ by: "member-a" });
s.as("member-b");
expect(await s.call("DELETE", { threadId: s.bot.threadId })).toEqual({
- status: 403, body: { error: "Only the person who pressed Set me up, or an owner or admin, can stop it." },
+ status: 403, body: { error: "Only the person who pressed Set me up, or an owner or admin, can stop it.", errorKey: "serverError.setup.stopOwner" },
});
expect(s.waiting()).toBeDefined();
s.as("member-a");
@@ -86,7 +86,7 @@ describe("the Set me up route", () => {
s.as("member-a");
expect(await s.call("POST", { threadId: s.bot.threadId })).toMatchObject({ status: 200 });
s.as("owner", admin);
- expect(await s.call("POST", { threadId: s.bot.threadId })).toEqual({ status: 409, body: { error: "Someone else is setting this bot up." } });
+ expect(await s.call("POST", { threadId: s.bot.threadId })).toEqual({ status: 409, body: { error: "Someone else is setting this bot up.", errorKey: "serverError.setup.someoneElse" } });
expect(await s.call("DELETE", { threadId: s.bot.threadId })).toEqual({ status: 200, body: { ok: true } });
expect(s.waiting()).toBeUndefined();
});
@@ -94,7 +94,7 @@ describe("the Set me up route", () => {
it("refuses the press, in plain words, when the bot's AI cannot set it up", async () => {
const s = setup(null, { canSetUp: false });
expect(await s.call("POST", { threadId: s.bot.threadId })).toEqual({
- status: 409, body: { error: "This bot's AI can't set it up by itself. Tell the bot what you'd like it to do instead." },
+ status: 409, body: { error: "This bot's AI can't set it up by itself. Tell the bot what you'd like it to do instead.", errorKey: "serverError.setup.noTools" },
});
expect(s.store.messagesFor(s.bot.threadId)).toHaveLength(1);
expect(s.waiting()).toBeUndefined();
diff --git a/server/routes/setup-request.ts b/server/routes/setup-request.ts
index e01f31775c..67e0f733b7 100644
--- a/server/routes/setup-request.ts
+++ b/server/routes/setup-request.ts
@@ -4,6 +4,7 @@
import { ownerOrAdmin, type RequestAuth } from "../request-auth.ts";
import { askForSetup, cancelSetupRequest, type SetupRequestStore } from "../setup-request.ts";
import { PASS, type RouteHandler } from "./table.ts";
+import { refusalBody, userError } from "../user-errors.ts";
export interface SetupRequestRouteDeps {
store: SetupRequestStore;
@@ -19,7 +20,6 @@ export interface SetupRequestRouteDeps {
const PATH = /^\/api\/bots\/([\w-]+)\/setup-request$/;
const ID = /^[\w-]{1,128}$/;
-const NO_TOOLS = "This bot's AI can't set it up by itself. Tell the bot what you'd like it to do instead.";
export function createSetupRequestRoutes(deps: SetupRequestRouteDeps): RouteHandler {
return async ({ req, res, path, method, auth, json, readBody }) => {
@@ -35,13 +35,13 @@ export function createSetupRequestRoutes(deps: SetupRequestRouteDeps): RouteHand
if (method === "DELETE") {
// An owner or admin may clear someone else's, so one never strands the chat.
const outcome = cancelSetupRequest(deps.store, botId, threadId, deps.presser(auth), { admin: ownerOrAdmin(auth) });
- if (outcome === "unknown") return json(res, 404, { error: "There is no such conversation." });
- if (outcome === "refused") return json(res, 403, { error: "Only the person who pressed Set me up, or an owner or admin, can stop it." });
+ if (outcome === "unknown") return json(res, 404, userError("serverError.setup.missingConversation"));
+ if (outcome === "refused") return json(res, 403, userError("serverError.setup.stopOwner"));
return json(res, 200, { ok: true });
}
- if (deps.store.taskByThread(botId, threadId) && !deps.canSetUp(botId, threadId)) return json(res, 409, { error: NO_TOOLS });
+ if (deps.store.taskByThread(botId, threadId) && !deps.canSetUp(botId, threadId)) return json(res, 409, userError("serverError.setup.noTools"));
const asked = askForSetup(deps.store, botId, threadId, deps.language(), deps.presser(auth));
- if (!asked.ok) return json(res, asked.status, { error: asked.error });
+ if (!asked.ok) return json(res, asked.status, refusalBody(asked));
return json(res, 200, asked);
};
}
diff --git a/server/setup-request.test.ts b/server/setup-request.test.ts
index c29bbe5ca8..bdca698916 100644
--- a/server/setup-request.test.ts
+++ b/server/setup-request.test.ts
@@ -56,7 +56,7 @@ describe("the Set me up offer", () => {
peer.take(peer.say("A teammate asked you to review this", peer.threadId, { peerAsk: { botId: "b2", name: "Kit" } }));
expect(openSetupOffer(peer.store, peer.bot.id, peer.threadId)).toBeNull();
expect(askForSetup(peer.store, peer.bot.id, peer.threadId, "en")).toEqual({
- ok: false, status: 409, error: "This chat has already started. Type /setup and what you'd like this bot to do.",
+ ok: false, status: 409, error: "This chat has already started. Type /setup and what you'd like this bot to do.", errorKey: "serverError.setup.started",
});
});
});
@@ -93,7 +93,7 @@ describe("pressing Set me up", () => {
const s = setup();
s.store.patchBot(s.bot.id, { soul: "Only water the garden." });
expect(askForSetup(s.store, s.bot.id, s.threadId, "en")).toEqual({
- ok: false, status: 409, error: "This bot already has instructions. To change its job, type /setup and what you'd like it to do.",
+ ok: false, status: 409, error: "This bot already has instructions. To change its job, type /setup and what you'd like it to do.", errorKey: "serverError.setup.hasInstructions",
});
const fresh = setup();
fresh.take(fresh.say("hello"));
@@ -165,7 +165,7 @@ describe("the line after the press", () => {
it("refuses someone else's press while another person's request waits; an owner or admin may clear it", () => {
const s = setup();
askForSetup(s.store, s.bot.id, s.threadId, "en", "member-a");
- const refused = { ok: false, status: 409, error: "Someone else is setting this bot up." };
+ const refused = { ok: false, status: 409, error: "Someone else is setting this bot up.", errorKey: "serverError.setup.someoneElse" };
expect(askForSetup(s.store, s.bot.id, s.threadId, "en", "member-b")).toEqual(refused);
expect(askForSetup(s.store, s.bot.id, s.threadId, "en")).toEqual(refused);
expect(askForSetup(s.store, s.bot.id, s.threadId, "en", "member-a")).toEqual({ ok: true, already: true });
diff --git a/server/setup-request.ts b/server/setup-request.ts
index 8ec6e217e2..858b76ff5e 100644
--- a/server/setup-request.ts
+++ b/server/setup-request.ts
@@ -10,6 +10,7 @@ import type { RequestAuth } from "./request-auth.ts";
import { parseSetupCommand } from "./setup-mode.ts";
import type { BotRecord, Message, Store } from "./store.ts";
import { extractTurnImages } from "./turn-images.ts";
+import { userError, type UserError } from "./user-errors.ts";
export type SetupRequestStore = Pick<Store, "bots" | "bot" | "taskByThread" | "messagesFor" | "patchMessage" | "appendMessage" | "patchTask">;
@@ -32,11 +33,7 @@ export function openSetupOffer(store: SetupRequestStore, botId: string, threadId
export type SetupAsk =
| { ok: true; message: Message }
| { ok: true; already: true }
- | { ok: false; status: 404 | 409; error: string };
-
-const HAS_INSTRUCTIONS = "This bot already has instructions. To change its job, type /setup and what you'd like it to do.";
-const STARTED = "This chat has already started. Type /setup and what you'd like this bot to do.";
-const SOMEONE_ELSE = "Someone else is setting this bot up.";
+ | ({ ok: false; status: 404 | 409 } & UserError);
/** Who presses, recorded only where several people share the place, and only for a signed-in person whose lines carry
* them as their sender (`sender`, as the send route stores it): anyone else could never take their own mark. */
@@ -49,12 +46,12 @@ export function setupPresser(shared: boolean, auth: RequestAuth, sender: Resolve
export function askForSetup(store: SetupRequestStore, botId: string, threadId: string, language: string | undefined, by?: string): SetupAsk {
const bot = store.bot(botId);
const task = bot ? store.taskByThread(botId, threadId) : null;
- if (!bot || !task) return { ok: false, status: 404, error: "There is no such conversation." };
+ if (!bot || !task) return { ok: false, status: 404, ...userError("serverError.setup.missingConversation") };
if (task.setupRequest) {
- return task.setupRequest.by && task.setupRequest.by !== by ? { ok: false, status: 409, error: SOMEONE_ELSE } : { ok: true, already: true };
+ return task.setupRequest.by && task.setupRequest.by !== by ? { ok: false, status: 409, ...userError("serverError.setup.someoneElse") } : { ok: true, already: true };
}
const offer = openSetupOffer(store, botId, threadId);
- if (!offer) return { ok: false, status: 409, error: blankBot(bot) ? STARTED : HAS_INSTRUCTIONS };
+ if (!offer) return { ok: false, status: 409, ...userError(blankBot(bot) ? "serverError.setup.started" : "serverError.setup.hasInstructions") };
store.patchMessage(threadId, offer.id, { setupOffer: undefined });
const message = store.appendMessage(threadId, { role: "bot", kind: "text", text: setupRequestLine(language) });
store.patchTask(botId, threadId, { setupRequest: { at: message.at, ...(by ? { by } : {}) } });
diff --git a/server/user-errors.ts b/server/user-errors.ts
index 00b0529414..cb9b39c9f2 100644
--- a/server/user-errors.ts
+++ b/server/user-errors.ts
@@ -94,6 +94,16 @@ export const USER_ERROR = {
"serverError.department.deleteBusy": "Stop this department's active work before deleting it",
"serverError.department.generalChief": "General already has a Chief of Staff. Move or change this department's Chief before deleting it",
"serverError.backup.recursiveLink": "Cannot back up a symbolic link to the folder that contains it: {path}",
+ "serverError.setup.noTools": "This bot's AI can't set it up by itself. Tell the bot what you'd like it to do instead.",
+ "serverError.setup.missingConversation": "There is no such conversation.",
+ "serverError.setup.stopOwner": "Only the person who pressed Set me up, or an owner or admin, can stop it.",
+ "serverError.setup.hasInstructions": "This bot already has instructions. To change its job, type /setup and what you'd like it to do.",
+ "serverError.setup.started": "This chat has already started. Type /setup and what you'd like this bot to do.",
+ "serverError.setup.someoneElse": "Someone else is setting this bot up.",
+ "serverError.approval.allThreads": "Finish this bot's approval change first. Every thread's provider must support this approval level.",
+ "serverError.approval.pending": "Finish this bot's pending approval change first",
+ "serverError.approval.provider": "Use the bot's provider on this thread before applying its approval level",
+ "serverError.engineCheck.timeout": "{name} didn't answer within {seconds} seconds.",
} as const;
export type UserErrorKey = keyof typeof USER_ERROR;
diff --git a/shared/runtime-events.ts b/shared/runtime-events.ts
index 8628e1ad7c..215426a7b7 100644
--- a/shared/runtime-events.ts
+++ b/shared/runtime-events.ts
@@ -186,7 +186,7 @@ export type RuntimeEvent = RuntimeEventBase &
text?: ServerText }
/** Something the person should know that did not fail the turn — for
* example, a saved model the engine no longer offers was replaced. */
- | { type: "runtime.notice"; message: string }
+ | { type: "runtime.notice"; message: string; text?: ServerText }
);
export type RuntimeEventListener = (event: RuntimeEvent) => void;
diff --git a/src/components/EngineLiveCheck.tsx b/src/components/EngineLiveCheck.tsx
index c4517994a5..2d77e600ae 100644
--- a/src/components/EngineLiveCheck.tsx
+++ b/src/components/EngineLiveCheck.tsx
@@ -3,9 +3,11 @@ import { Check, CircleAlert, LoaderCircle, RefreshCw } from "lucide-react";
import { engineReady } from "@/components/EngineLibrary";
import { t } from "@/lib/i18n";
import { api, type InstanceInfo } from "@/state/store";
+import { serverErrorText } from "@/lib/server-error";
+import type { ServerErrorBody } from "../../shared/server-text";
-export type EngineLiveCheck = { state: "checking" } | { state: "working" } | { state: "failed"; error: string };
-type Answer = { ok: true } | { ok: false; error: string } | { ok: null };
+export type EngineLiveCheck = { state: "checking" } | { state: "working" } | ({ state: "failed" } & ServerErrorBody);
+type Answer = { ok: true } | ({ ok: false } & ServerErrorBody) | { ok: null };
/** Right after one of these engines is connected here, one tiny real message checks that it answers. An engine already
* connected when this first renders is left alone. */
@@ -17,7 +19,7 @@ export function useEngineLiveCheck(engines: readonly InstanceInfo[]) {
let next: EngineLiveCheck | null;
try {
const answer = await api<Answer>(`/api/instances/${encodeURIComponent(instanceId)}/check`, { method: "POST", body: "{}", timeoutMs: 120_000 });
- next = answer.ok === true ? { state: "working" } : answer.ok === false ? { state: "failed", error: answer.error } : null;
+ next = answer.ok === true ? { state: "working" } : answer.ok === false ? { state: "failed", error: answer.error, errorKey: answer.errorKey, errorParams: answer.errorParams } : null;
} catch (error) {
next = { state: "failed", error: error instanceof Error ? error.message : String(error) };
}
@@ -43,7 +45,7 @@ export function EngineCheckLine({ name, check, onRetry }: { name: string; check:
return <div role="alert" data-engine-check="failed" className="mt-3 rounded-xl bg-warning/10 px-3.5 py-3 text-[13px] leading-relaxed text-ink">
<p className="flex items-start gap-2">
<CircleAlert size={15} aria-hidden="true" className="mt-0.5 shrink-0 text-warning" />
- <span><span className="font-medium">{t("engineCheck.failed", { name })}</span> {check.error}</span>
+ <span><span className="font-medium">{t("engineCheck.failed", { name })}</span> {serverErrorText(check, check.error)}</span>
</p>
<button type="button" onClick={onRetry} className="mt-2 flex items-center gap-1.5 rounded-md px-2 py-1 text-[13px] font-medium text-ink transition-colors hover:bg-raised">
<RefreshCw size={12} aria-hidden="true" />{t("engineCheck.retry")}
diff --git a/src/components/McpServersPanel.embedded.test.ts b/src/components/McpServersPanel.embedded.test.ts
index 3b1c7fd8ec..4e93ef63fe 100644
--- a/src/components/McpServersPanel.embedded.test.ts
+++ b/src/components/McpServersPanel.embedded.test.ts
@@ -23,6 +23,22 @@ vi.mock("@/state/store", () => ({
useStore: () => ({ state: { config: null }, dispatch: vi.fn() }),
}));
import { McpServersPanel } from "./McpServersPanel";
+import { setLocale } from "@/lib/i18n";
+
+afterEach(() => setLocale("en"));
+
+it("renders key refusals without an HTTP status in the current language, but keeps HTTP technical", () => {
+ fixture.servers = [{ name: "docs", type: "http", url: "https://mcp.example.com/mcp", headerKeys: ["X-Token"], enabled: true }];
+ fixture.seeded[5] = { docs: { ok: false, reason: "keys", error: "Raw server diagnostic" } };
+ expect(render(true)).toContain("unauthorized");
+ setLocale("pt-br");
+ expect(render(true)).toContain("acesso não autorizado");
+ expect(render(true)).toContain("X-Token");
+ expect(render(true)).not.toContain("Raw server diagnostic");
+ fixture.seeded[5] = { docs: { ok: false, reason: "keys", status: 401 } };
+ expect(render(true)).toContain("HTTP 401");
+ expect(render(true)).not.toContain("acesso não autorizado");
+});
function render(embedded: boolean, whopCard = false) {
function Capture() {
diff --git a/src/components/McpServersPanel.tsx b/src/components/McpServersPanel.tsx
index 6d9619ed25..f85044c3a4 100644
--- a/src/components/McpServersPanel.tsx
+++ b/src/components/McpServersPanel.tsx
@@ -70,7 +70,7 @@ export async function signedInToolsCheck(
/** Security: names the headers, never their values. */
function failureReason(server: McpServerListing, result: ProbeResult): string {
if (result.reason !== "keys" || !isRemoteMcpListing(server)) return result.error ?? "";
- const reason = result.status ? `HTTP ${result.status}` : "unauthorized";
+ const reason = result.status ? `HTTP ${result.status}` : t("mcp.check.unauthorized");
if (!server.headerKeys.length) return t("mcp.check.keysNeeded", { reason });
return t("mcp.check.keysRefused", { reason, names: new Intl.ListFormat(activeLocale(), { style: "long", type: "conjunction" }).format(server.headerKeys) });
}
diff --git a/src/lib/fixed-runtime-lines.test.ts b/src/lib/fixed-runtime-lines.test.ts
new file mode 100644
index 0000000000..2339a5fc60
--- /dev/null
+++ b/src/lib/fixed-runtime-lines.test.ts
@@ -0,0 +1,166 @@
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { afterEach, describe, expect, it } from "vitest";
+
+import { noticeFailure, noticeLine, runtimeNoticeTool } from "../../server/chat-notices";
+import { acpStopFailure } from "../../server/drivers/acp/failure-words";
+import { stopCause, stopFailure } from "../../server/drivers/engine-errors";
+import { unsupportedCallsFailure, unsupportedCallsNotice } from "../../server/drivers/codex-unsupported-calls";
+import { unaskedStopFailure, unaskedStopMessage } from "../../server/harness/unasked-stop";
+import { droppedReportLine, fullReportLine, notYetReportLine, refusedReportLine, sentReportLine } from "../../server/host/devs-report-words";
+import { sentRow } from "../../server/host/handoff-sent";
+import { userError } from "../../server/user-errors";
+import { EngineCheckLine } from "../components/EngineLiveCheck";
+import { activityText, noticeText } from "./activity-text";
+import { setLocale } from "./i18n";
+import { serverErrorText } from "./server-error";
+
+afterEach(() => setLocale("en"));
+const secret = `sk-ant-${"Ab1c".repeat(9)}`;
+const words = (line: { line: string; text?: ReturnType<typeof sentReportLine>["text"] }) => noticeText(line.text?.key, line.line, line.text?.params);
+
+describe("fixed runtime notices", () => {
+ it.each([
+ ["refusal", "chat.notice.stop.refusal", "Grok refused to go on with this request (stop reason: refusal). Try again, reword the request, or switch this bot to another AI.", "se recusou a continuar"],
+ ["max_tokens", "chat.notice.stop.maxTokens", "Grok's reply reached its maximum length before it finished (stop reason: max_tokens). Ask it to continue, or ask for a shorter answer.", "atingiu o tamanho máximo"],
+ ["max_turn_requests", "chat.notice.stop.maxRequests", "The turn made as many model requests as one turn may before it finished (stop reason: max_turn_requests). Ask it to carry on from where it stopped, or split the task.", "limite de pedidos"],
+ ])("keeps the complete English and codes ACP stop %s", (reason, key, english, portuguese) => {
+ const failed = acpStopFailure({ stopReason: reason }, "Grok");
+ expect(failed.message).toBe(english);
+ expect(failed.text?.key).toBe(key);
+ expect(stopCause(reason, "Grok")).toBe(english);
+ const tool = runtimeNoticeTool(failed);
+ expect(tool.name).toBe(`notice: ${english.slice(0, 240)}`);
+ expect(activityText(tool, tool.name)).toBe(tool.name);
+ setLocale("pt-br");
+ expect(activityText(tool, tool.name)).toContain(portuguese);
+ expect(activityText(tool, tool.name)).toContain(reason);
+ });
+
+ it("uses generic complete sentences, while unknown diagnostics and vendor messages stay untouched", () => {
+ expect(stopFailure("refusal")?.text?.key).toBe("chat.notice.stop.refusalGeneric");
+ expect(stopCause("max_tokens")).toBe("The AI's reply reached its maximum length before it finished (stop reason: max_tokens). Ask it to continue, or ask for a shorter answer.");
+ expect(acpStopFailure({}, "Grok")).toEqual(noticeFailure("chat.notice.acpNoReason", { provider: "Grok" }));
+ expect(acpStopFailure({ error: "vendor detail", stopReason: "refusal" }, "Grok")).toEqual({ message: "vendor detail" });
+ expect(acpStopFailure({ message: "vendor message" }, "Grok")).toEqual({ message: "vendor message" });
+ expect(stopCause("rpc_error")).toBe("The engine stopped without saying why (stop reason: rpc_error).");
+ expect(stopFailure(" ")).toBeUndefined();
+ setLocale("pt-br");
+ expect(noticeText("chat.notice.future", "Future English")).toBe("Future English");
+ expect(noticeText("native.update.installing", "Wrong namespace")).toBe("Wrong namespace");
+ expect(noticeText("chat.notice.relayReply", "Missing params")).toBe("Missing params");
+ expect(runtimeNoticeTool({ message: "Old engine" })).toEqual({ name: "notice: Old engine", ok: true });
+ });
+
+ it.each([1, 2, 7])("preserves Codex's exact plural and six-name cap for %s tools", (count) => {
+ const tools = Array.from({ length: count }, (_, i) => `app.TOOL_${i}`);
+ const named = tools.slice(0, 6).join(", ") + (count > 6 ? ` and ${count - 6} more` : "");
+ const english = `Codex could not run ${count === 1 ? "the tool" : "the tools"} ${named} ("unsupported call"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.`;
+ const failed = unsupportedCallsFailure(tools);
+ expect(failed.message).toBe(english);
+ expect(unsupportedCallsNotice(tools)).toBe(english);
+ expect(failed.text.key).toBe(count > 6 ? "chat.notice.codexUnsupportedMore" : count === 1 ? "chat.notice.codexUnsupportedOne" : "chat.notice.codexUnsupportedMany");
+ setLocale("pt-br");
+ const tool = runtimeNoticeTool(failed);
+ expect(activityText(tool, tool.name)).toContain(count === 1 ? "a ferramenta app.TOOL_0" : "as ferramentas app.TOOL_0");
+ expect(activityText(tool, tool.name)).not.toContain("app.TOOL_6");
+ if (count > 6) expect(activityText(tool, tool.name)).toContain("e mais 1");
+ });
+
+ it("keeps cancellation quotes and redacts parameters before they reach the transcript", () => {
+ expect(unaskedStopMessage(' Request\nwas "aborted". ')).toBe('The AI\'s request was cut off before it finished, and nobody stopped it (it said only "Request was \'aborted\'."). Send the message again to try once more.');
+ const failed = unaskedStopFailure(`Request was aborted. ${secret}`);
+ expect(JSON.stringify(failed)).not.toContain(secret);
+ setLocale("pt-br");
+ expect(noticeText(failed.text.key, failed.message, failed.text.params)).toContain("sem que ninguém o parasse");
+ expect(JSON.stringify(runtimeNoticeTool(noticeFailure("chat.notice.acpEmpty", { provider: secret })))).not.toContain(secret);
+ });
+
+ it.each([
+ ["chat.notice.acpEmpty", { provider: "Grok" }, "Grok finished without replying.", "Grok terminou sem responder."],
+ ["chat.notice.piSessionSlow", undefined, "Pi is taking longer than usual to start this conversation's session. The turn goes on when Pi answers. Press Stop to cancel it.", "Clique em “Parar” para cancelar."],
+ ["chat.notice.unreadMessage", undefined, "This turn ended before the model read a message sent while it ran. Send that message again.", "Envie essa mensagem de novo."],
+ ] as const)("persists and renders %s", (key, params, english, portuguese) => {
+ const failed = noticeFailure(key, params);
+ expect(failed.message).toBe(english);
+ setLocale("pt-br");
+ const tool = runtimeNoticeTool(failed);
+ expect(activityText(tool, tool.name)).toContain(portuguese);
+ });
+});
+
+describe("report receipts", () => {
+ it.each([false, true])("preserves the contact and earlier-try variants (later=%s)", (later) => {
+ for (const contact of [undefined, "[email protected]"]) {
+ const line = sentReportLine("report-42", contact, later);
+ expect(line.line).toBe(`Sent to the MausBot team (report report-42)${later ? " after an earlier try did not go through" : ""}. Milind and Omkar get it by email${contact ? ` and will reply to ${contact}` : ""}.`);
+ expect(words(line)).toBe(line.line);
+ setLocale("pt-br");
+ expect(words(line)).toContain("Enviado à equipe do MausBot (relatório report-42)");
+ if (contact) expect(words(line)).toContain(contact);
+ setLocale("en");
+ }
+ });
+
+ it.each([undefined, 1, 120_000])("preserves complete wait lines and string minute params (%s)", (retryAfterMs) => {
+ const line = notYetReportLine({ ok: false, retry: true, why: "limited", ...(retryAfterMs ? { retryAfterMs } : {}) });
+ const minutes = retryAfterMs ? Math.ceil(retryAfterMs / 60_000) : 0;
+ expect(line.line).toBe(`Not sent yet: the MausBot team takes only a few reports an hour from each app. The report is saved and goes on its own${minutes ? ` in about ${minutes} minute${minutes === 1 ? "" : "s"}` : " as soon as it can"}, so there is no need to send it again.`);
+ expect(Object.values(line.text!.params!).every(value => typeof value === "string")).toBe(true);
+ setLocale("pt-br");
+ expect(words(line)).toContain(minutes ? `em cerca de ${minutes} minuto${minutes === 1 ? "" : "s"}` : "assim que possível");
+ });
+
+ it("keeps vocabulary-blocked server diagnostics English, without a misleading code", () => {
+ setLocale("pt-br");
+ for (const why of ["offline", "server"] as const) {
+ const line = notYetReportLine({ ok: false, retry: true, why });
+ expect(line.text).toBeUndefined();
+ expect(words(line)).toBe(line.line);
+ expect(line.line).toContain("the MausBot team's server");
+ }
+ expect(refusedReportLine("too large. \n")).toEqual({ line: "The MausBot team's server refused this bug report, so nothing was sent: too large.", text: undefined });
+ expect(words(fullReportLine(40))).toContain("40 relatórios de problemas");
+ expect(words(droppedReportLine())).toContain("durante uma semana");
+ expect(JSON.stringify(sentReportLine("r", secret))).not.toContain(secret);
+ });
+});
+
+describe("handoffs and team relay bodies", () => {
+ it.each([
+ ["chat.notice.relayReply", "Ana replied: Keep English", "Ana respondeu: Keep English"],
+ ["chat.notice.relayFrom", "Ana asked me to pass this on: Keep English", "Ana pediu para eu repassar esta mensagem: Keep English"],
+ ["chat.notice.relayMessage", "A message for you from Ana: Keep English", "Uma mensagem de Ana para você: Keep English"],
+ ] as const)("keeps the message and name verbatim in %s", (key, english, portuguese) => {
+ const line = noticeLine(key, { name: "Ana", message: "Keep English" });
+ expect(line.text).toBe(english);
+ setLocale("pt-br");
+ expect(noticeText(line.textCode, line.text, line.textParams)).toBe(portuguese);
+ });
+
+ it("codes normal handoffs and retains the direct-outside-room sentinel", () => {
+ const sender = { id: "a", name: "Ana", color: "blue" }, recipient = { id: "b", name: "Scout", color: "green" };
+ const row = sentRow({ sender, recipient, threadId: "t", via: "room", room: { id: "r", name: "Sales", here: false } });
+ expect(row.tool).toMatchObject({ name: "Sent to Scout · Sales", nameCode: "chat.notice.handoffSentRoom", nameParams: { name: "Scout", room: "Sales" } });
+ setLocale("pt-br");
+ expect(activityText(row.tool!, row.tool!.name)).toBe("Enviado a Scout · Sales");
+ const direct = sentRow({ sender, recipient, threadId: "t", via: "direct", room: { id: "r", name: "Sales", here: false } });
+ expect(direct.tool?.nameCode).toBeUndefined();
+ expect(direct.sentDirectly).toEqual({ name: "Scout", room: "Sales" });
+ });
+});
+
+it("rerenders an engine-check timeout and setup/approval refusals from the stored English", () => {
+ const body = userError("serverError.engineCheck.timeout", { name: "Grok", seconds: "90" });
+ const render = () => renderToStaticMarkup(createElement(EngineCheckLine, { name: "Grok", check: { state: "failed", ...body }, onRetry() {} }));
+ expect(render()).toContain("Grok didn&#x27;t answer within 90 seconds.");
+ setLocale("pt-br");
+ expect(render()).toContain("Grok não respondeu em 90 segundos.");
+ for (const key of ["serverError.setup.noTools", "serverError.setup.missingConversation", "serverError.setup.stopOwner", "serverError.setup.hasInstructions", "serverError.setup.started", "serverError.setup.someoneElse", "serverError.approval.allThreads", "serverError.approval.pending", "serverError.approval.provider"] as const) {
+ const refusal = userError(key);
+ expect(serverErrorText(refusal, refusal.error)).not.toBe(refusal.error);
+ setLocale("en");
+ expect(serverErrorText(refusal, refusal.error)).toBe(refusal.error);
+ setLocale("pt-br");
+ }
+});
diff --git a/src/lib/updater.test.ts b/src/lib/updater.test.ts
index bea7a8a3df..821f424e4c 100644
--- a/src/lib/updater.test.ts
+++ b/src/lib/updater.test.ts
@@ -5,6 +5,24 @@ import { connectionMessage } from "@/components/OrganizationSettings";
afterEach(() => setLocale("en"));
+it("translates fixed native update words at render time, retaining raw diagnostics and exact English", () => {
+ const state = { status: "handed-off", message: "The install did not finish: The install took too long.", messageKey: "native.update.installFailed", messageParams: { reason: "The install took too long.", timedOut: "true" } } as const;
+ expect(updaterMessage(state)).toBe(state.message);
+ setLocale("pt-br");
+ expect(updaterMessage(state)).toBe("A instalação não terminou. Motivo: A instalação demorou demais.");
+ expect(updaterMessage({ ...state, messageParams: { reason: "E: dpkg lock" } })).toBe("A instalação não terminou. Motivo: E: dpkg lock");
+ expect(updaterMessage({ ...state, messageParams: {} })).toBe(state.message);
+ expect(updaterMessage({ ...state, messageKey: "native.update.future" })).toBe(state.message);
+ expect(updaterMessage({ ...state, messageKey: "native.lend.terminal.title" })).toBe(state.message);
+ expect(updaterMessage({ status: "installing", message: "Installing the update. Enter your password if asked.", messageKey: "native.update.installing" })).toBe("Instalando a atualização. Digite a senha se ela for solicitada.");
+ const failed = { status: "error", message: "Couldn't check for updates. Offline detail", messageKey: "native.update.checkFailed", messageParams: { error: "Offline detail" } } as const;
+ expect(updaterMessage(failed)).toBe("Não foi possível buscar atualizações. Offline detail");
+ expect(updaterMessage({ ...failed, messageCode: "network" })).toContain("Não foi possível buscar atualizações.");
+ expect(updaterMessage({ ...failed, messageCode: "network" })).not.toContain("Offline detail");
+ setLocale("en");
+ expect(updaterMessage({ ...failed, messageCode: "network" })).toBe(failed.message);
+});
+
it("says the updater's own words in the app's language, and keeps a message main could not classify", () => {
setLocale("pt-br");
expect(updaterMessage({ status: "error", message: "Not enough disk space to prepare the update. Free some space, then try again.", messageCode: "disk" }))
diff --git a/src/lib/updater.ts b/src/lib/updater.ts
index 0cdba226ec..66e691ea1d 100644
--- a/src/lib/updater.ts
+++ b/src/lib/updater.ts
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
-import { t } from "@/lib/i18n";
-import type { LocaleKey } from "@/locales";
+import { activeLocale, t } from "@/lib/i18n";
+import { en, type LocaleKey } from "@/locales";
import type { UpdaterState } from "@/types/ogb";
export type { UpdaterState };
@@ -25,7 +25,14 @@ const UPDATE_TEXT: Record<NonNullable<UpdaterState["messageCode"]>, LocaleKey> =
};
export function updaterMessage(state: UpdaterState | null | undefined, { restart = true } = {}): string | undefined {
- if (!state?.messageCode || !Object.hasOwn(UPDATE_TEXT, state.messageCode)) return state?.message;
- const text = t(UPDATE_TEXT[state.messageCode]);
- return restart && state.status === "error" && state.retryable === false ? `${text} ${t("update.error.restartFirst")}` : text;
+ if (!state) return undefined;
+ const code = state.messageCode && Object.hasOwn(UPDATE_TEXT, state.messageCode) ? UPDATE_TEXT[state.messageCode] : undefined;
+ const key = state.messageKey?.startsWith("native.update.") && Object.hasOwn(en, state.messageKey) ? state.messageKey : undefined;
+ if (key && activeLocale() === "en") return state.message;
+ const params = { ...state.messageParams };
+ if (key === "native.update.checkFailed" && code) params.error = t(code);
+ if (key === "native.update.installFailed" && params.timedOut === "true") params.reason = t("native.update.installTimedOut");
+ const missing = key && [...t(key as LocaleKey).matchAll(/\{(\w+)\}/g)].some(([, name]) => !Object.hasOwn(params, name!));
+ const text = key ? missing ? state.message : t(key as LocaleKey, params) : code ? t(code) : state.message;
+ return text && (key || code) && restart && state.status === "error" && state.retryable === false ? `${text} ${t("update.error.restartFirst")}` : text;
}
diff --git a/src/locales/en.json b/src/locales/en.json
index 573e2e19a7..f7229847f1 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7952,5 +7952,62 @@
"native.lendTray.busyInternet": "Your bots are using this {device}'s internet connection now",
"native.lendTray.idleInternet": "Your bots can use this {device}'s internet connection",
"native.lendTray.tipIdleInternet": "OpenMausBot: your bots can use this {device}'s internet connection",
- "native.lendTray.terminal": "Terminal"
+ "native.lendTray.terminal": "Terminal",
+ "serverError.setup.noTools": "This bot's AI can't set it up by itself. Tell the bot what you'd like it to do instead.",
+ "serverError.setup.missingConversation": "There is no such conversation.",
+ "serverError.setup.stopOwner": "Only the person who pressed Set me up, or an owner or admin, can stop it.",
+ "serverError.setup.hasInstructions": "This bot already has instructions. To change its job, type /setup and what you'd like it to do.",
+ "serverError.setup.started": "This chat has already started. Type /setup and what you'd like this bot to do.",
+ "serverError.setup.someoneElse": "Someone else is setting this bot up.",
+ "serverError.approval.allThreads": "Finish this bot's approval change first. Every thread's provider must support this approval level.",
+ "serverError.approval.pending": "Finish this bot's pending approval change first",
+ "serverError.approval.provider": "Use the bot's provider on this thread before applying its approval level",
+ "serverError.engineCheck.timeout": "{name} didn't answer within {seconds} seconds.",
+ "chat.notice.acpEmpty": "{provider} finished without replying.",
+ "chat.notice.acpNoReason": "{provider} stopped without saying why.",
+ "chat.notice.stop.refusal": "{provider} refused to go on with this request (stop reason: {reason}). Try again, reword the request, or switch this bot to another AI.",
+ "chat.notice.stop.refusalGeneric": "The AI refused to go on with this request (stop reason: {reason}). Try again, reword the request, or switch this bot to another AI.",
+ "chat.notice.stop.maxTokens": "{provider}'s reply reached its maximum length before it finished (stop reason: {reason}). Ask it to continue, or ask for a shorter answer.",
+ "chat.notice.stop.maxTokensGeneric": "The AI's reply reached its maximum length before it finished (stop reason: {reason}). Ask it to continue, or ask for a shorter answer.",
+ "chat.notice.stop.maxRequests": "The turn made as many model requests as one turn may before it finished (stop reason: {reason}). Ask it to carry on from where it stopped, or split the task.",
+ "chat.notice.unaskedStop": "The AI's request was cut off before it finished, and nobody stopped it (it said only \"{said}\"). Send the message again to try once more.",
+ "chat.notice.piSessionSlow": "Pi is taking longer than usual to start this conversation's session. The turn goes on when Pi answers. Press Stop to cancel it.",
+ "chat.notice.unreadMessage": "This turn ended before the model read a message sent while it ran. Send that message again.",
+ "chat.notice.codexUnsupportedOne": "Codex could not run the tool {tools} (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.codexUnsupportedMany": "Codex could not run the tools {tools} (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.codexUnsupportedMore": "Codex could not run the tools {tools} and {count} more (\"unsupported call\"): the AI provider sent the call back without the tool's app name, so it never reached the tool. Pick a model for this bot whose provider handles tool calls fully.",
+ "chat.notice.handoffSent": "Sent to {name}",
+ "chat.notice.handoffSentRoom": "Sent to {name} · {room}",
+ "chat.notice.relayReply": "{name} replied: {message}",
+ "chat.notice.relayFrom": "{name} asked me to pass this on: {message}",
+ "chat.notice.relayMessage": "A message for you from {name}: {message}",
+ "chat.notice.reportSent": "Sent to the MausBot team (report {id}). Milind and Omkar get it by email.",
+ "chat.notice.reportSentContact": "Sent to the MausBot team (report {id}). Milind and Omkar get it by email and will reply to {contact}.",
+ "chat.notice.reportLater": "Sent to the MausBot team (report {id}) after an earlier try did not go through. Milind and Omkar get it by email.",
+ "chat.notice.reportLaterContact": "Sent to the MausBot team (report {id}) after an earlier try did not go through. Milind and Omkar get it by email and will reply to {contact}.",
+ "chat.notice.part.reportLimited": "the MausBot team takes only a few reports an hour from each app",
+ "chat.notice.reportWaiting": "Not sent yet: {why}. The report is saved and goes on its own as soon as it can, so there is no need to send it again.",
+ "chat.notice.reportWaitingOne": "Not sent yet: {why}. The report is saved and goes on its own in about {minutes} minute, so there is no need to send it again.",
+ "chat.notice.reportWaitingMany": "Not sent yet: {why}. The report is saved and goes on its own in about {minutes} minutes, so there is no need to send it again.",
+ "chat.notice.reportFull": "Not sent: {count} bug reports are already waiting to go to the MausBot team. Type @devs again once they have gone.",
+ "chat.notice.reportDropped": "A bug report from this conversation could not reach the MausBot team for a week, so it was dropped. Type @devs again to send a new one.",
+ "native.approval.allThreads": "Finish this bot's approval change first. Every thread's provider must support this approval level.",
+ "native.approval.pending": "Finish this bot's pending approval change first",
+ "native.approval.provider": "Use the bot's provider on this thread before applying its approval level",
+ "native.lend.terminal.title": "Let My Cloud's bots run commands on this computer as you?",
+ "native.lend.terminal.detail": "There is no limit on what a command can do: they can read, change or delete anything you can, and install software. Only continue if you trust them with this computer. It turns off again whenever lending is turned off.",
+ "native.lend.terminal.button": "Allow the terminal",
+ "native.lend.chooseCapability": "Choose at least one folder, apps and screen, the internet connection, your Chrome, or the terminal.",
+ "native.update.packageMissing": "The downloaded package is no longer available. Try the update again.",
+ "native.update.noChecksum": "The update feed gave no checksum to verify the package against.",
+ "native.update.noPkexec": "pkexec is not installed.",
+ "native.update.promptClosed": "The password prompt was closed.",
+ "native.update.noAdmin": "This session could not ask for administrator rights.",
+ "native.update.checksumMismatch": "The downloaded update did not match its checksum. Check again to download it fresh.",
+ "native.update.installTimedOut": "The install took too long.",
+ "native.update.installFailed": "The install did not finish: {reason}",
+ "native.update.checkFailed": "Couldn't check for updates. {error}",
+ "native.update.installing": "Installing the update. Enter your password if asked.",
+ "native.update.installFailedPlain": "The update could not be installed.",
+ "mcp.check.unauthorized": "unauthorized"
}
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index f0327e31cc..7956e44748 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -7952,5 +7952,62 @@
"native.lendTray.busyInternet": "Seus bots estão usando a conexão de internet deste {device} agora",
"native.lendTray.idleInternet": "Seus bots podem usar a conexão de internet deste {device}",
"native.lendTray.tipIdleInternet": "OpenMausBot: seus bots podem usar a conexão de internet deste {device}",
- "native.lendTray.terminal": "Terminal"
+ "native.lendTray.terminal": "Terminal",
+ "serverError.setup.noTools": "A IA deste bot não consegue configurá-lo sozinha. Diga ao bot o que você gostaria que ele fizesse.",
+ "serverError.setup.missingConversation": "Essa conversa não existe.",
+ "serverError.setup.stopOwner": "Só a pessoa que clicou em “Configurar meu bot”, o proprietário ou um administrador pode interromper a configuração.",
+ "serverError.setup.hasInstructions": "Este bot já tem instruções. Para mudar o trabalho dele, digite /setup e o que você gostaria que ele fizesse.",
+ "serverError.setup.started": "Esta conversa já começou. Digite /setup e o que você gostaria que este bot fizesse.",
+ "serverError.setup.someoneElse": "Outra pessoa está configurando este bot.",
+ "serverError.approval.allThreads": "Conclua primeiro a alteração de aprovação deste bot. O provedor de cada conversa precisa aceitar esse nível de aprovação.",
+ "serverError.approval.pending": "Conclua primeiro a alteração de aprovação pendente deste bot",
+ "serverError.approval.provider": "Use o provedor do bot nesta conversa antes de aplicar o nível de aprovação dele",
+ "serverError.engineCheck.timeout": "{name} não respondeu em {seconds} segundos.",
+ "chat.notice.acpEmpty": "{provider} terminou sem responder.",
+ "chat.notice.acpNoReason": "{provider} parou sem informar o motivo.",
+ "chat.notice.stop.refusal": "{provider} se recusou a continuar este pedido (motivo da parada: {reason}). Tente de novo, reformule o pedido ou mude este bot para outra IA.",
+ "chat.notice.stop.refusalGeneric": "A IA se recusou a continuar este pedido (motivo da parada: {reason}). Tente de novo, reformule o pedido ou mude este bot para outra IA.",
+ "chat.notice.stop.maxTokens": "A resposta de {provider} atingiu o tamanho máximo antes de terminar (motivo da parada: {reason}). Peça para continuar ou dar uma resposta mais curta.",
+ "chat.notice.stop.maxTokensGeneric": "A resposta da IA atingiu o tamanho máximo antes de terminar (motivo da parada: {reason}). Peça para continuar ou dar uma resposta mais curta.",
+ "chat.notice.stop.maxRequests": "O turno atingiu o limite de pedidos ao modelo antes de terminar (motivo da parada: {reason}). Peça para continuar de onde parou ou divida a tarefa.",
+ "chat.notice.unaskedStop": "O pedido da IA foi interrompido antes de terminar, sem que ninguém o parasse (ela disse apenas “{said}”). Envie a mensagem de novo para tentar mais uma vez.",
+ "chat.notice.piSessionSlow": "O Pi está demorando mais que o normal para iniciar a sessão desta conversa. O turno continua quando o Pi responder. Clique em “Parar” para cancelar.",
+ "chat.notice.unreadMessage": "Este turno terminou antes de o modelo ler uma mensagem enviada enquanto ele rodava. Envie essa mensagem de novo.",
+ "chat.notice.codexUnsupportedOne": "O Codex não conseguiu executar a ferramenta {tools} (“unsupported call”). O provedor de IA devolveu a chamada sem o nome do app da ferramenta, e ela nunca chegou à ferramenta. Escolha um modelo para este bot cujo provedor aceite chamadas de ferramentas por completo.",
+ "chat.notice.codexUnsupportedMany": "O Codex não conseguiu executar as ferramentas {tools} (“unsupported call”). O provedor de IA devolveu a chamada sem o nome do app da ferramenta, e ela nunca chegou à ferramenta. Escolha um modelo para este bot cujo provedor aceite chamadas de ferramentas por completo.",
+ "chat.notice.codexUnsupportedMore": "O Codex não conseguiu executar as ferramentas {tools} e mais {count} (“unsupported call”). O provedor de IA devolveu a chamada sem o nome do app da ferramenta, e ela nunca chegou à ferramenta. Escolha um modelo para este bot cujo provedor aceite chamadas de ferramentas por completo.",
+ "chat.notice.handoffSent": "Enviado a {name}",
+ "chat.notice.handoffSentRoom": "Enviado a {name} · {room}",
+ "chat.notice.relayReply": "{name} respondeu: {message}",
+ "chat.notice.relayFrom": "{name} pediu para eu repassar esta mensagem: {message}",
+ "chat.notice.relayMessage": "Uma mensagem de {name} para você: {message}",
+ "chat.notice.reportSent": "Enviado à equipe do MausBot (relatório {id}). Milind e Omkar recebem por e-mail.",
+ "chat.notice.reportSentContact": "Enviado à equipe do MausBot (relatório {id}). Milind e Omkar recebem por e-mail e responderão para {contact}.",
+ "chat.notice.reportLater": "Enviado à equipe do MausBot (relatório {id}) depois de uma tentativa anterior não ter dado certo. Milind e Omkar recebem por e-mail.",
+ "chat.notice.reportLaterContact": "Enviado à equipe do MausBot (relatório {id}) depois de uma tentativa anterior não ter dado certo. Milind e Omkar recebem por e-mail e responderão para {contact}.",
+ "chat.notice.part.reportLimited": "a equipe do MausBot aceita poucos relatórios por hora de cada app",
+ "chat.notice.reportWaiting": "Ainda não foi enviado: {why}. O relatório está salvo e será enviado automaticamente assim que possível. Não é preciso enviar de novo.",
+ "chat.notice.reportWaitingOne": "Ainda não foi enviado: {why}. O relatório está salvo e será enviado automaticamente em cerca de {minutes} minuto. Não é preciso enviar de novo.",
+ "chat.notice.reportWaitingMany": "Ainda não foi enviado: {why}. O relatório está salvo e será enviado automaticamente em cerca de {minutes} minutos. Não é preciso enviar de novo.",
+ "chat.notice.reportFull": "Não foi enviado: já há {count} relatórios de problemas aguardando envio à equipe do MausBot. Digite @devs de novo depois que eles forem enviados.",
+ "chat.notice.reportDropped": "Um relatório de problema desta conversa não chegou à equipe do MausBot durante uma semana e foi descartado. Digite @devs de novo para enviar outro.",
+ "native.approval.allThreads": "Conclua primeiro a alteração de aprovação deste bot. O provedor de cada conversa precisa aceitar esse nível de aprovação.",
+ "native.approval.pending": "Conclua primeiro a alteração de aprovação pendente deste bot",
+ "native.approval.provider": "Use o provedor do bot nesta conversa antes de aplicar o nível de aprovação dele",
+ "native.lend.terminal.title": "Permitir que os bots do Cloud executem comandos neste computador como você?",
+ "native.lend.terminal.detail": "Não há limite para o que um comando pode fazer: os bots podem ler, alterar ou excluir tudo a que você tem acesso e instalar programas. Continue apenas se você confiar neles para usar este computador. O acesso ao terminal é desligado sempre que você desliga o compartilhamento.",
+ "native.lend.terminal.button": "Permitir o terminal",
+ "native.lend.chooseCapability": "Escolha pelo menos uma pasta, apps e tela, a conexão de internet, seu Chrome ou o terminal.",
+ "native.update.packageMissing": "O pacote baixado não está mais disponível. Tente atualizar de novo.",
+ "native.update.noChecksum": "A fonte de atualizações não forneceu uma soma de verificação para conferir o pacote.",
+ "native.update.noPkexec": "O pkexec não está instalado.",
+ "native.update.promptClosed": "O pedido de senha foi fechado.",
+ "native.update.noAdmin": "Esta sessão não conseguiu pedir permissão de administrador.",
+ "native.update.checksumMismatch": "A atualização baixada não corresponde à soma de verificação. Busque atualizações de novo para baixá-la novamente.",
+ "native.update.installTimedOut": "A instalação demorou demais.",
+ "native.update.installFailed": "A instalação não terminou. Motivo: {reason}",
+ "native.update.checkFailed": "Não foi possível buscar atualizações. {error}",
+ "native.update.installing": "Instalando a atualização. Digite a senha se ela for solicitada.",
+ "native.update.installFailedPlain": "Não foi possível instalar a atualização.",
+ "mcp.check.unauthorized": "acesso não autorizado"
}
diff --git a/src/locales/source-hashes.json b/src/locales/source-hashes.json
index 2f02154d6b..03f72e370c 100644
--- a/src/locales/source-hashes.json
+++ b/src/locales/source-hashes.json
@@ -27073,7 +27073,64 @@
"native.lendTray.busyInternet": "cb3fd25e75581986d96962d693f8ccd3a967688e6ceec2ed18080a27ba23a6e8",
"native.lendTray.idleInternet": "a694c48b199bd8eceec7236437fb61467522c12b37ecd39d5eafd9b492a9ee71",
"native.lendTray.tipIdleInternet": "5f3861160ce110d1946347b5df4c1fe25d811bf7b6e221ce0e38e5166238dbfa",
- "native.lendTray.terminal": "e0926fdac700b09497b5f0218ea3dd54fa13c0bdeaee6caa7b85e50b852aa05f"
+ "native.lendTray.terminal": "e0926fdac700b09497b5f0218ea3dd54fa13c0bdeaee6caa7b85e50b852aa05f",
+ "serverError.setup.noTools": "069ee4aefed4e4fbb3d83f19700813b1e3ae0f2ebd4b878eb4095b32e86b54d3",
+ "serverError.setup.missingConversation": "55be507ebe0a3cbf410d57c5205b57f776f2dfc653f5529b79add21b51b9e25a",
+ "serverError.setup.stopOwner": "1da43c31ba38e143835748c612f6ebf50b42cdd0c05656792aacf3bf0d5f2fd1",
+ "serverError.setup.hasInstructions": "f64d8ca8f2046cd62aaf6b33f14cbc300d30c6f69ed2d3150238bb0b88ca9659",
+ "serverError.setup.started": "9ef3e6753100c1088c74802aec6dcd2ff01a2591d5b9db8c1eb28e79b96af406",
+ "serverError.setup.someoneElse": "d2cfd5fa63b95acf8d96c72071861107256543148b34e7e827599ecb346382c0",
+ "serverError.approval.allThreads": "58ae3ed631b88332b70a56e4716e0a26a955744cfcbf5d13bede9366876738fa",
+ "serverError.approval.pending": "421015c563cb3f60187dd71a570b9e5d978d4fa1bee5c62340c2aeef4a2123dd",
+ "serverError.approval.provider": "e6602cb6781141ce66f60cf03e190b27f3bbc6b813b564a9936ab00fb1091584",
+ "serverError.engineCheck.timeout": "f17e369abea442ca56935ceb01cb6e294fb63f0b6163f37ed5a124324e18dd22",
+ "chat.notice.acpEmpty": "de7c4057f59f1718ae03751eff5077f89bf4fc9fad9701138ae6e9c83abf06e4",
+ "chat.notice.acpNoReason": "edef9c30801dafe6bbe97c461b7eaf77b65b63c62867b5345e4e48fd4a31e425",
+ "chat.notice.stop.refusal": "4b6edcc3337785726c43f8f0378104693c2b449e322e1119187812f6db4144e0",
+ "chat.notice.stop.refusalGeneric": "1c6fa4615d012859f5594af161b7811bdbb72d30352c52601e9a614520761773",
+ "chat.notice.stop.maxTokens": "ea58d6c6421efbbf6fe1c2f315392cc658119a027fd7bb35708a9426f6e6e4c8",
+ "chat.notice.stop.maxTokensGeneric": "57b369ab10aa179cb12dae244938d426958b6ff35873da4f0c49d3a2713057cc",
+ "chat.notice.stop.maxRequests": "cf3ae818a97cad6b041083a3a9e40310106cff5bbdff461b244cd1b675ab4ac8",
+ "chat.notice.unaskedStop": "0dc664d5eada83c4e6a3cda28a24d1e91429084ead7ba4e5596c9cdd5e5d1123",
+ "chat.notice.piSessionSlow": "4c8053f3080fa9a98dc9aed7c831bfe36357726a529b325188e1a625ba028c29",
+ "chat.notice.unreadMessage": "194e50595da5aaa552196b5de1415c549deb5b8374754e6470725c2f85c4497c",
+ "chat.notice.codexUnsupportedOne": "849c6f35bc1e97c6790cb3c6b8c88694f0c7d785bbf8d96bb65434cf596e07c6",
+ "chat.notice.codexUnsupportedMany": "f83e13dac6a2df7d1386b5f26c6fc720d87a1d6db7dfa7c49759e42d93523fca",
+ "chat.notice.codexUnsupportedMore": "c540368a3242e0ec1e17589dbac5c32c5d6c3f8ce88ecbc7795aa3895ff3278c",
+ "chat.notice.handoffSent": "9bbf3006995ead3f98cea1b86aa764bba883d5d518dc98853d5de835e29291bd",
+ "chat.notice.handoffSentRoom": "03aea1863e517b660f02d13e476544c361e15d3943a6e755e2ec3e82c21e7273",
+ "chat.notice.relayReply": "893ecd8525971e19c31f5abbc8adf74d3b53d0d3a0393f4ecd9e29742c070c9f",
+ "chat.notice.relayFrom": "a5b444f042148016d17ca38ca518876144782685ddc0212f47b191bb4a8c29ac",
+ "chat.notice.relayMessage": "d53d1dd85cdd9abfc066003a6797504e15d00b8d2b0c4117d367fad30abe19f0",
+ "chat.notice.reportSent": "b2a0ba420ca52c7c1222644df3569dd248928a14e44d850ae390c79409d50463",
+ "chat.notice.reportSentContact": "98bcb2dcd1b115fa05f685cadf78c19bc4808cde0a8f757ee0e0b768c2f19407",
+ "chat.notice.reportLater": "030d4bb5aaf2eb6deb0beffb0ac2e525350393cd359fe2898f669ed90d15331f",
+ "chat.notice.reportLaterContact": "055d5ffccb038ab6e43441c1d78f1fb869c54b76c599dca12d4a8a0a77b669aa",
+ "chat.notice.part.reportLimited": "320584921b5fc13fbfaa247bb3dba960bc01b9bf9a8980eebcbdcb1660a9abbe",
+ "chat.notice.reportWaiting": "47e780ef529508e5491146d79ec270826733d7844e78d76bf44e04b9041a8ce7",
+ "chat.notice.reportWaitingOne": "986c77bf4e1aba4dd75513fba30e24537d6425bc8a214d29ed57babd06c2d682",
+ "chat.notice.reportWaitingMany": "6bb10e0ad56601b402a73f5baff3de2123418e614db3002e9e67a010fc63af4c",
+ "chat.notice.reportFull": "7c727c344bcbc48cd69b005228b47200033a7f069ba2736de904269f8dd8358c",
+ "chat.notice.reportDropped": "6ae8afc04807285487b6cdafee1ee4cb891601e1e8553bc24b0d779fb6809c20",
+ "native.approval.allThreads": "58ae3ed631b88332b70a56e4716e0a26a955744cfcbf5d13bede9366876738fa",
+ "native.approval.pending": "421015c563cb3f60187dd71a570b9e5d978d4fa1bee5c62340c2aeef4a2123dd",
+ "native.approval.provider": "e6602cb6781141ce66f60cf03e190b27f3bbc6b813b564a9936ab00fb1091584",
+ "native.lend.terminal.title": "38394cd58a539b85e79ef04fae825be4208adb19ec3806bc8419d95ebed2731d",
+ "native.lend.terminal.detail": "e9e38d5de366c700b497485d43456e0c6dc519ea305dd5d97947a37366238943",
+ "native.lend.terminal.button": "138c280500b4d6c9166750c6943857559dbfeb8a7fac3b777e4bb54f22584e11",
+ "native.lend.chooseCapability": "ec684a47e5b2e5d1e192515682d12e122719b9c2666d13267e8bf925f47a0e7d",
+ "native.update.packageMissing": "8e87f1d9dd2b2efd7e6164894491727118ecfa07da0fb2ac09d9e194cffb1e33",
+ "native.update.noChecksum": "160be3c8e1b7c9e4f67bd9630781f424be7e1ca143f392ce291bf76a7d7d5d99",
+ "native.update.noPkexec": "34c46d43e763706d5348b7893be02333ceb45709e685710d64b4bde73102a307",
+ "native.update.promptClosed": "057e0039ca11cabf15066d87f1e64c1ff10aa62ab901dc06a12f75ff5cc6e8bf",
+ "native.update.noAdmin": "d942f8cb8cc879727606a004c0883389be003763a0dec1b3efc046ef882bb827",
+ "native.update.checksumMismatch": "e50f0953c7008e1a3a855818051b375db10c666024c441e553872918fa269c9e",
+ "native.update.installTimedOut": "6bc5b785212cb80f6fe6a7e2d3f826687e036c8176edf69cf3f06a56c7664373",
+ "native.update.installFailed": "e5dcb9629dee9271179305b37cfb15f98c860563914f01faf364f210079055ff",
+ "native.update.checkFailed": "8e5453aca31c5dae9f51629b6beae4008a3edf665764414c6f6cd6a869750882",
+ "native.update.installing": "d4c2786de1c7bbed0fa0f010fb037527cece9f42ebc3861f985dc1c498703f3c",
+ "native.update.installFailedPlain": "3c9928b6a20133c3fcff626c5a99e0db83ddced0685a9c30f169be94b1b80e74",
+ "mcp.check.unauthorized": "e9d83f01c9aff03af6380e341aad90a5547d378ef54582383c6c9a35c53181af"
},
"zh": {
"highlevel.unavailable": "87b8ac7f7610e6dd69f520bc59058fd92f307b9f4bcf804075f25d08bcaa7533",
diff --git a/src/types/ogb.d.ts b/src/types/ogb.d.ts
index cec321bd86..cafa86c825 100644
--- a/src/types/ogb.d.ts
+++ b/src/types/ogb.d.ts
@@ -409,6 +409,9 @@ export interface UpdaterState {
message?: string;
/** `message` as a code the window words in its own language; absent when main has only the updater's own words */
messageCode?: "tls" | "integrity" | "disk" | "permission" | "busy" | "feed" | "network" | "prepareTimeout" | "slowRestart" | "unavailable";
+ /** Fixed native.update.* wording beside its English fallback, including elevated-install details. */
+ messageKey?: string;
+ messageParams?: Record<string, string>;
/** native work may still be running; recovery requires an app restart */
retryable?: boolean;
/**