Skip to content

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

Live pages stop when their bot loses the folder, and published ones wait during backups and moves (#4804)

Milind Sonicc3c27b5702f
diff --git a/server/chat-apps.test.ts b/server/chat-apps.test.ts
index 27389e7607..3df8b38ec4 100644
--- a/server/chat-apps.test.ts
+++ b/server/chat-apps.test.ts
@@ -672,7 +672,7 @@ describe("createChatApps", () => {
});
describe("a live folder page", () => {
- function liveSetup(maxBytes?: number, paused?: () => boolean) {
+ function liveSetup(maxBytes?: number, paused?: () => boolean, liveRoots?: (threadId: string, botId: string | undefined) => readonly string[] | null) {
const fake = fakeStore();
const base = mkdtempSync(join(tmpdir(), "omb-live-pages-"));
const dash = join(base, "dash");
@@ -681,7 +681,7 @@ describe("a live folder page", () => {
writeFileSync(join(dash, "app.js"), "draw()");
writeFileSync(join(dash, "data.csv"), "day,sales\n1,10\n");
const live = vi.fn((): Array<{ threadId: string; messageId: string }> => []);
- const apps = createChatApps({ store: fake.store, dataDir: mkdtempSync(join(tmpdir(), "omb-chat-apps-")), sweeps: false, liveRows: live, ...(maxBytes ? { maxBytes } : {}), ...(paused ? { paused } : {}) });
+ const apps = createChatApps({ store: fake.store, dataDir: mkdtempSync(join(tmpdir(), "omb-chat-apps-")), sweeps: false, liveRows: live, ...(maxBytes ? { maxBytes } : {}), ...(paused ? { paused } : {}), ...(liveRoots ? { liveRoots } : {}) });
opened.push(apps);
const folders = async () => ({ roots: [base], vmWorkspace: null });
const show = (input: Record<string, unknown>) => apps.createAppCard({ bot: SCOUT, threadId: THREAD, input: { tool: "show_html", title: "Dash", ...input }, folders });
@@ -717,6 +717,44 @@ describe("a live folder page", () => {
expect(row("m1").app!.rev).toBe(1);
});
+ it("stops being live once its bot can no longer read the folder, or is gone", async () => {
+ let roots: readonly string[] | null = null;
+ const { apps, base, dash, show, row } = liveSetup(undefined, undefined, () => roots);
+ roots = [base];
+ await show({ path: "dash", live: true });
+ await apps.refreshLive();
+ writeFileSync(join(dash, "data.csv"), "day,sales\n1,12\n");
+ expect(await apps.refreshLive()).toBe(1);
+ // The conversation's working folder moved elsewhere: the card keeps the page it shows, and is no longer live.
+ roots = [mkdtempSync(join(tmpdir(), "omb-live-elsewhere-"))];
+ writeFileSync(join(dash, "data.csv"), "day,sales\n1,13\n");
+ expect(await apps.refreshLive()).toBe(0);
+ expect(row("m1").app).toMatchObject({ rev: 1 });
+ expect(row("m1").app).not.toHaveProperty("live");
+ // A bot that is gone: same.
+ roots = [base];
+ await show({ path: "dash", live: true });
+ await apps.refreshLive();
+ roots = null;
+ writeFileSync(join(dash, "data.csv"), "day,sales\n1,14\n");
+ expect(await apps.refreshLive()).toBe(0);
+ expect(row("m2").app).not.toHaveProperty("live");
+ });
+
+ it("lists the store's live pages once, after a restart, not on every refresh", async () => {
+ const { apps, live } = liveSetup();
+ vi.useFakeTimers({ toFake: ["Date"] });
+ try {
+ for (let minute = 0; minute < 3; minute++) {
+ await apps.refreshLive();
+ vi.setSystemTime(Date.now() + 61_000);
+ }
+ } finally {
+ vi.useRealTimers();
+ }
+ expect(live).toHaveBeenCalledTimes(1);
+ });
+
it("can be turned off, and a folder that is gone leaves the page as it was", async () => {
const { apps, dash, live, show, row } = liveSetup();
await show({ path: "dash", live: true });
diff --git a/server/chat-apps.ts b/server/chat-apps.ts
index 45e8a4fec9..482ba0a65d 100644
--- a/server/chat-apps.ts
+++ b/server/chat-apps.ts
@@ -12,7 +12,7 @@ import { speakerIn, type AgentCardResult, type AgentCardStore } from "./chat-wid
import { compileJsxPage } from "./jsx-compile.ts";
import { appDocRefs } from "./message-db.ts";
import { createPageFiles, type PageFilesViewer } from "./page-files.ts";
-import { pageSignature, PageBundleError, readBotPageBundle, readPageBundle, skippedNote, type BotFolders, type PageBundle, type PageFile } from "./pages/bundle.ts";
+import { pageSignature, PageBundleError, readBotPageBundle, readPageBundle, skippedNote, stillReadable, type BotFolders, type PageBundle, type PageFile } from "./pages/bundle.ts";
import { redactSecretsInText } from "./redact.ts";
import type { Message, StoreChange } from "./store.ts";
import { userError, type UserError } from "./user-errors.ts";
@@ -478,8 +478,8 @@ export interface ChatApps {
/** How often live pages' folders are checked, and how many pages are watched at most (the newest). */
const LIVE_EVERY_MS = 5_000;
const LIVE_PAGES_MAX = 50;
-/** How often the live pages are listed again from the store, and how long a failed read or store waits to be tried again. */
-const LIVE_RELOAD_MS = 60_000, LIVE_RETRY_MS = 60_000;
+/** How long a failed read or store waits to be tried again. */
+const LIVE_RETRY_MS = 60_000;
export function createChatApps(deps: {
store: ChatAppsStore;
@@ -491,6 +491,8 @@ export function createChatApps(deps: {
liveRows?(limit: number): Array<{ threadId: string; messageId: string }>;
/** True while the workspace is being backed up or restored: live pages wait, so they don't write mid-snapshot. */
paused?(): boolean;
+ /** The folders the page's bot may read in this conversation now; null once the bot is gone. A live page outside them stops being live. */
+ liveRoots?(threadId: string, botId: string | undefined): readonly string[] | null;
}): ChatApps {
const docs = new AppDocs(`${deps.dataDir}/app-docs`, deps.maxBytes ? { maxBytes: deps.maxBytes } : {});
const references = deps.references ?? appDocRefs;
@@ -520,10 +522,10 @@ export function createChatApps(deps: {
return Boolean(row && (row.app.doc === target.doc || row.app.history?.includes(target.doc)));
};
// Live pages, by row: the page's folder (looked up again only when its document changes), the folder's fingerprint
- // when it was last read, and when a failed read or store is tried again. Listed from the store every minute, so a
- // live page that arrived another way (an imported conversation) is picked up too.
+ // when it was last read, and when a failed read or store is tried again. The store is listed once, after a restart;
+ // pages made since are watched as they are made.
const live = new Map<string, { threadId: string; messageId: string; doc?: string; folder?: string; signature?: string; retryAt?: number }>();
- let liveListedAt = -Infinity, refreshing: Promise<number> | null = null;
+ let liveListed = false, refreshing: Promise<number> | null = null;
const watch = (threadId: string, messageId: string) => {
const key = `${threadId}\n${messageId}`;
if (live.has(key)) return;
@@ -537,8 +539,8 @@ export function createChatApps(deps: {
};
const refreshOnce = async (): Promise<number> => {
if (deps.paused?.()) return 0;
- if (Date.now() - liveListedAt >= LIVE_RELOAD_MS) {
- liveListedAt = Date.now();
+ if (!liveListed) {
+ liveListed = true;
try { for (const row of [...(deps.liveRows?.(LIVE_PAGES_MAX) ?? [])].reverse()) watch(row.threadId, row.messageId); } catch (error) {
console.error("chat apps: could not read live pages", error);
}
@@ -555,6 +557,13 @@ export function createChatApps(deps: {
const folder = row?.app.live && row.app.doc ? entry.folder : undefined;
if (!row || !folder) { live.delete(key); continue; }
if (entry.retryAt !== undefined && Date.now() < entry.retryAt) continue;
+ // The bot is gone or no longer has the folder: the card keeps the page it shows and stops being live.
+ if (deps.liveRoots && !(await stillReadable(folder, deps.liveRoots(entry.threadId, row.from?.botId)))) {
+ const { live: _live, ...kept } = row.app;
+ deps.store.patchMessage(entry.threadId, row.id, { app: kept });
+ live.delete(key);
+ continue;
+ }
const retryLater = () => Object.assign(entry, { signature: undefined, retryAt: Date.now() + LIVE_RETRY_MS });
try {
// null too when the folder is no longer where the page was shown from (swapped for a link elsewhere).
diff --git a/server/chat-notices.ts b/server/chat-notices.ts
index 807540d19c..0766d31f9c 100644
--- a/server/chat-notices.ts
+++ b/server/chat-notices.ts
@@ -79,6 +79,8 @@ export const CHAT_NOTICE = {
"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.acpMcpAppsFailed": "Connected apps couldn't be set up, so {provider} couldn't start this reply. Try again, or switch this bot to another AI.",
+ "chat.notice.acpMcpServerFailed": "The \"{server}\" MCP server couldn't be set up, so {provider} couldn't start this reply. Try again, or switch this bot to another AI.",
"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.",
diff --git a/server/drivers/acp/failure-words.test.ts b/server/drivers/acp/failure-words.test.ts
index dfa9681fcd..0a4528ec3c 100644
--- a/server/drivers/acp/failure-words.test.ts
+++ b/server/drivers/acp/failure-words.test.ts
@@ -4,15 +4,18 @@ import { acpRuntimeFailure } from "./failure-words.ts";
describe("acpRuntimeFailure: an MCP server that failed to connect at session start", () => {
it("says the connected apps could not be set up when dsh's composio client fails", () => {
const error = new Error("Internal error: mcp-client(composio): initial connection or tool synchronization failed (session/new)");
- expect(acpRuntimeFailure(error, "DeepSeek Harness")).toEqual({
+ expect(acpRuntimeFailure(error, "DeepSeek Harness")).toMatchObject({
message: "Connected apps couldn't be set up, so DeepSeek Harness couldn't start this reply. Try again, or switch this bot to another AI.",
+ text: { key: "chat.notice.acpMcpAppsFailed", params: { provider: "DeepSeek Harness" } },
});
});
it("names any other MCP server that could not be set up", () => {
const error = new Error("mcp-client(github): initial connection or tool synchronization failed");
- expect(acpRuntimeFailure(error, "DeepSeek Harness").message)
- .toBe("The \"github\" MCP server couldn't be set up, so DeepSeek Harness couldn't start this reply. Try again, or switch this bot to another AI.");
+ expect(acpRuntimeFailure(error, "DeepSeek Harness")).toMatchObject({
+ message: "The \"github\" MCP server couldn't be set up, so DeepSeek Harness couldn't start this reply. Try again, or switch this bot to another AI.",
+ text: { key: "chat.notice.acpMcpServerFailed", params: { server: "github", provider: "DeepSeek Harness" } },
+ });
});
it("leaves other errors as they were", () => {
diff --git a/server/drivers/acp/failure-words.ts b/server/drivers/acp/failure-words.ts
index b67aca4f95..715f071a66 100644
--- a/server/drivers/acp/failure-words.ts
+++ b/server/drivers/acp/failure-words.ts
@@ -19,8 +19,7 @@ const MCP_START_FAILED = /^(?:[^:\n]*: )?mcp-client\(([^)\n]+)\): initial connec
function mcpStartFailure(message: string, provider: string) {
const server = MCP_START_FAILED.exec(message)?.[1];
if (!server) return null;
- const what = server === "composio" ? "Connected apps" : `The "${server}" MCP server`;
- return { message: `${what} couldn't be set up, so ${provider} couldn't start this reply. Try again, or switch this bot to another AI.` };
+ return server === "composio" ? noticeFailure("chat.notice.acpMcpAppsFailed", { provider }) : noticeFailure("chat.notice.acpMcpServerFailed", { server, provider });
}
export function acpRuntimeFailure(error: unknown, provider: string, account?: { message?: string; text?: ServerText }) {
diff --git a/server/index.ts b/server/index.ts
index 6ab8bebbfd..33ca6c1391 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -12137,14 +12137,14 @@ ROUTES.push(createBotMessageRoutes({
relayedReaction: (threadId, messageId, person, emoji) => void store.setReaction(threadId, messageId, relayedPersonKey(person),
{ emoji, name: person.name ?? person.email, at: Date.now() }),
}));
-const chatApps = createChatApps({ store, dataDir: DATA_DIR, liveRows: liveAppRows, paused: () => workspaceMaintenance.active || moveFreeze.frozen() });
+const liveRoots = (threadId: string, botId: string | undefined) => { const bot = botId ? store.bot(botId) : store.botByThread(threadId); return bot ? messageFileRootsForThread(bot.id, threadId).filter((root) => root !== ATTACHMENTS_DIR) : null; }; const chatApps = createChatApps({ store, dataDir: DATA_DIR, liveRows: liveAppRows, liveRoots, paused: () => workspaceMaintenance.active || moveFreeze.frozen() });
const chatAppsMcp = createChatAppsMcp({ store, apps: chatApps, dataDir: DATA_DIR, storedServers: () => cfg.mcpServers ?? {}, mountedServers: engineMcpServers, personMcp: teamConnections.personMcp, oauth: mcpOAuth });
ROUTES.push(createChatAppRoutes({ store, apps: chatApps, threadRefusal: cloudThreadRefusal, mcpRpc: chatAppsMcp.rpc, threadVisible: (auth, threadId) => (auth.kind !== "session" || sessions.isLive(auth.session.id)) && visibleTo(viewerFor(auth)).thread(threadId) }));
const { react } = createReactions({
store, reply: (input) => teamMessages.reactedIn(input.auth, input.threadId, input.target.id, input.answer, { sendId: input.sendId, sender: messageSender(input.auth) }) ?? personReplies.deliver({ ...input, about: "message" }),
answerCard: (input) => respondToCard({ ...input, via: "reaction" }), withdraw: personReplies.withdraw,
});
-const publishedPages = createPublishedPages({ dataDir: DATA_DIR, cloudHome: CLOUD_HOME, selfHosted: !CLOUD_HOME && !HOSTED_WORKSPACE && utilityParentPort === undefined, patch: (threadId, messageId, text, publishedPage) => void store.patchMessage(threadId, messageId, { text, publishedPage }), apps: { chat: chatApps, store } }); ROUTES.push(createReactionRoutes({ react, reactorFor, cloudGuestSendRefusal }), publishedPages.routes, savedSteps.routes, createPlacesElsewhereRoutes({ elsewhere: placesElsewhere, owner: (auth) => !sharedMembership() && !HOSTED_WORKSPACE && (auth.kind === "loopback" || ownHome.owner(auth) || (CLOUD_PERSONAL && cloudOwnerSession(auth))) }));
+const publishedPages = createPublishedPages({ dataDir: DATA_DIR, cloudHome: CLOUD_HOME, selfHosted: !CLOUD_HOME && !HOSTED_WORKSPACE && utilityParentPort === undefined, patch: (threadId, messageId, text, publishedPage) => void store.patchMessage(threadId, messageId, { text, publishedPage }), liveRoots: (botId, threadId) => liveRoots(threadId, botId), paused: () => workspaceMaintenance.active || moveFreeze.frozen(), apps: { chat: chatApps, store } }); ROUTES.push(createReactionRoutes({ react, reactorFor, cloudGuestSendRefusal }), publishedPages.routes, savedSteps.routes, createPlacesElsewhereRoutes({ elsewhere: placesElsewhere, owner: (auth) => !sharedMembership() && !HOSTED_WORKSPACE && (auth.kind === "loopback" || ownHome.owner(auth) || (CLOUD_PERSONAL && cloudOwnerSession(auth))) }));
// `let` slots are read per request.
ROUTES.push(createThreadRoutes({
groupFor: personRooms.groupForAuth,
diff --git a/server/pages/bundle.ts b/server/pages/bundle.ts
index 1845a86248..c61604efac 100644
--- a/server/pages/bundle.ts
+++ b/server/pages/bundle.ts
@@ -103,6 +103,17 @@ export async function pageSource(requested: string, roots: readonly string[]): P
return (await locate(requested, roots)).target;
}
+/** Whether a live page's folder is still one the bot may read: false once the bot is gone (no roots) or the folder is
+ * outside its folders. A folder briefly missing still counts, so the refresh's own retry decides. */
+export async function stillReadable(folder: string, roots: readonly string[] | null): Promise<boolean> {
+ if (!roots?.length) return false;
+ try {
+ return (await pageSource(folder, roots)) === folder;
+ } catch (error) {
+ return error instanceof PageBundleError && error.status === 404;
+ }
+}
+
/** Where the open `handle` really is, as the kernel names it (Linux): no folder swapped around the open can fake it. */
const openedPath = (handle: FileHandle) => readlink(`/proc/self/fd/${handle.fd}`).catch(() => null);
diff --git a/server/pages/published-pages.test.ts b/server/pages/published-pages.test.ts
index 8cf68e8ed2..9c9dce552a 100644
--- a/server/pages/published-pages.test.ts
+++ b/server/pages/published-pages.test.ts
@@ -29,13 +29,14 @@ function writeSite(folder: string, files: Record<string, string> = SITE) {
}
const signIn = () => applyIncludedPagesMessage({ type: "openmausbot:included-pages", access: { url: FAKE_TOKEN_URL, token: FAKE_DESKTOP_TOKEN } });
-function setup(options: { home?: boolean; quota?: number; selfHosted?: boolean } = {}) {
+function setup(options: { home?: boolean; quota?: number; selfHosted?: boolean; liveRoots?: (botId: string, threadId: string) => readonly string[] | null; paused?: () => boolean } = {}) {
const service = fakePagesService({ quota: options.quota });
const work = join(dir, "work"), data = join(dir, "data");
mkdirSync(work, { recursive: true });
const cards: Array<{ threadId: string; id: string; text: string; card: PublishedPageCard }> = [];
let ids = 0;
const pages = createPublishedPages({ dataDir: data, cloudHome: options.home ? FAKE_HOME : null, selfHosted: options.selfHosted, fetch: (input, init) => service.fetch(input, init),
+ ...(options.liveRoots ? { liveRoots: options.liveRoots } : {}), ...(options.paused ? { paused: options.paused } : {}),
patch: (threadId, messageId, text, card) => { const shown = cards.find((each) => each.id === messageId && each.threadId === threadId); if (shown) Object.assign(shown, { text, card }); } });
const post = (threadId: string) => (text: string, card: PublishedPageCard) => { const id = `m${++ids}`; cards.push({ threadId, id, text, card }); return id; };
const publish = (input: { path: string; title?: string; pageId?: string; botId?: string; threadId?: string }) => pages.publisher.publish({
@@ -460,6 +461,40 @@ describe("a live published page", () => {
expect(f.service.pages.get(page!)!.files.get("index.html")).toBe(SITE["index.html"]);
});
+ it("stops being published again once its bot can no longer read the folder, and keeps its link", async () => {
+ let roots: readonly string[] | null = null;
+ const asked: string[] = [];
+ const f = setup({ liveRoots: (botId, threadId) => { asked.push(`${botId} ${threadId}`); return roots; } });
+ roots = [f.work];
+ signIn();
+ const site = writeSite(join(f.work, "site"));
+ await publishLive(f, true);
+ const [page] = [...f.service.pages.keys()];
+ writeFileSync(join(site, "style.css"), "h1{color:blue}");
+ expect(await f.pages.publisher.refreshLive(Date.now() + 61_000)).toBe(1);
+ expect(asked).toContain("bot-1 thread-1");
+ roots = null;
+ writeFileSync(join(site, "style.css"), "h1{color:green}");
+ expect(await f.pages.publisher.refreshLive(Date.now() + 130_000)).toBe(0);
+ expect(f.pages.store.get(page!)).not.toHaveProperty("live");
+ expect(f.pages.store.get(page!)).toMatchObject({ url: expect.any(String) });
+ expect(f.service.pages.get(page!)!.files.get("style.css")).toBe("h1{color:blue}");
+ expect(f.service.minted.map((call) => call.action)).toEqual(["create", "update"]);
+ });
+
+ it("waits while the workspace is backed up, restored or moved", async () => {
+ let paused = false;
+ const f = setup({ paused: () => paused });
+ signIn();
+ const site = writeSite(join(f.work, "site"));
+ await publishLive(f, true);
+ writeFileSync(join(site, "style.css"), "h1{color:blue}");
+ paused = true;
+ expect(await f.pages.publisher.refreshLive(Date.now() + 61_000)).toBe(0);
+ paused = false;
+ expect(await f.pages.publisher.refreshLive(Date.now() + 61_000)).toBe(1);
+ });
+
it("waits ten minutes before trying a folder that can't be published as it is", async () => {
const f = setup();
signIn();
diff --git a/server/pages/publisher.ts b/server/pages/publisher.ts
index 32c07ed314..681991fc24 100644
--- a/server/pages/publisher.ts
+++ b/server/pages/publisher.ts
@@ -1,6 +1,6 @@
import { PAGE_ID, type PublishedPageCard } from "../../shared/published-page.ts";
import { redactSecretsInText } from "../../shared/redact.ts";
-import { PageBundleError, pageSignature, pageSource, readPageBundle, skippedNote, type PageBundle } from "./bundle.ts";
+import { PageBundleError, pageSignature, pageSource, readPageBundle, skippedNote, stillReadable, type PageBundle } from "./bundle.ts";
import { liveFiles } from "./live.ts";
import type { PagesCall, PagesClient, PagesFailure, PageUsage } from "./client.ts";
import type { PublishedPagesStore } from "./store.ts";
@@ -53,6 +53,10 @@ export function createPagePublisher(deps: {
store: PublishedPagesStore;
/** Re-draws a card already in a conversation (an unpublished page's). */
patch: (threadId: string, messageId: string, text: string, card: PublishedPageCard) => void;
+ /** The folders the bot may read in the conversation of the page's latest card; null once the bot is gone. */
+ liveRoots?(botId: string, threadId: string): readonly string[] | null;
+ /** True while the workspace is being backed up, restored or moved: live pages wait. */
+ paused?(): boolean;
}) {
const { client, store } = deps;
@@ -158,24 +162,32 @@ export function createPagePublisher(deps: {
/** Publishes each live page whose folder changed again, to the same link; how many were published. */
async refreshLive(now = Date.now()): Promise<number> {
- if (refreshing) return 0;
+ if (refreshing || deps.paused?.()) return 0;
refreshing = true;
let changed = 0;
try {
for (const record of store.list().filter((each) => each.live)) {
if (now < Math.max(record.updatedAt + LIVE_MIN_MS, nextTry.get(record.pageId) ?? 0)) continue;
+ // The bot is gone or no longer has the folder: the page stays at its link as it is, and stops being republished.
+ const threadId = record.cards.at(-1)?.threadId;
+ if (deps.liveRoots && !(await stillReadable(record.source, threadId ? deps.liveRoots(record.botId, threadId) : null))) {
+ store.published({ ...record, card: null, live: false }, record.updatedAt);
+ continue;
+ }
const signature = await pageSignature(record.source);
if (signature === null || signature === record.signature) continue;
nextTry.set(record.pageId, now + LIVE_MIN_MS);
let bundle;
try {
- bundle = await readPageBundle(record.source, [record.source]);
+ bundle = await readPageBundle(record.source, [record.source], undefined, { exactRoots: true });
} catch (error) {
if (!(error instanceof PageBundleError)) throw error;
nextTry.set(record.pageId, now + LIVE_BROKEN_MS);
continue;
}
if (bundle.source !== record.source) continue;
+ // A backup or move began while the folder was read: nothing is sent; the folder is read again after it.
+ if (deps.paused?.()) { nextTry.delete(record.pageId); break; }
const outcome = await publishBundle({ botId: record.botId, threadId: "", title: record.title, pageId: record.pageId, post: () => null, live: true, signature, refresh: true }, bundle);
if (outcome.status === 200) changed++;
// Taken down elsewhere: its cards say so, and it stops being published.
diff --git a/server/pages/service.ts b/server/pages/service.ts
index 2bb96da60a..49f662a32d 100644
--- a/server/pages/service.ts
+++ b/server/pages/service.ts
@@ -20,6 +20,9 @@ export function createPublishedPages(options: {
/** True for `openmausbot serve`: no desktop app hands over a MausBot sign-in and there is no Cloud home. */
selfHosted?: boolean;
patch: (threadId: string, messageId: string, text: string, card: PublishedPageCard) => void;
+ /** Live pages stop when their bot can no longer read the folder, and wait while the workspace is backed up or moved. */
+ liveRoots?(botId: string, threadId: string): readonly string[] | null;
+ paused?(): boolean;
fetch?: typeof fetch;
apps?: {
chat: Pick<ChatApps, "publishablePage" | "showPublishedPage">;
@@ -37,7 +40,7 @@ export function createPublishedPages(options: {
if (pageRow(threadId, messageId)) apps!.store.patchMessage(threadId, messageId, { publishedPage: card });
else options.patch(threadId, messageId, text, card);
};
- const publisher = createPagePublisher({ client, store, patch });
+ const publisher = createPagePublisher({ client, store, patch, liveRoots: options.liveRoots, paused: options.paused });
// Live pages whose folders changed are published again; each at most once a minute (the publisher's own limit).
const liveTimer = setInterval(() => { void publisher.refreshLive(); }, LIVE_EVERY_MS);
liveTimer.unref?.();
diff --git a/src/locales/en.json b/src/locales/en.json
index 7f7e5fd9c6..9731a7eb9f 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -9191,6 +9191,8 @@
"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.acpMcpAppsFailed": "Connected apps couldn't be set up, so {provider} couldn't start this reply. Try again, or switch this bot to another AI.",
+ "chat.notice.acpMcpServerFailed": "The \"{server}\" MCP server couldn't be set up, so {provider} couldn't start this reply. Try again, or switch this bot to another AI.",
"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.",
diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json
index f9d5671d9b..0aa15f115e 100644
--- a/src/locales/pt-br.json
+++ b/src/locales/pt-br.json
@@ -9163,6 +9163,8 @@
"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.acpMcpAppsFailed": "Não foi possível configurar os apps conectados, então {provider} não conseguiu começar esta resposta. Tente de novo ou troque a IA deste bot.",
+ "chat.notice.acpMcpServerFailed": "Não foi possível configurar o servidor MCP \"{server}\", então {provider} não conseguiu começar esta resposta. Tente de novo ou troque a IA deste bot.",
"chat.notice.stop.refusal": "{provider} se recusou a continuar com este pedido (motivo da parada: {reason}). Tente novamente, reformule o pedido ou mude este bot para outra IA.",
"chat.notice.stop.refusalGeneric": "A IA se recusou a continuar com este pedido (motivo da parada: {reason}). Tente novamente, 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.",