Skip to content

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

Merge remote-tracking branch 'gh/main' into train/nov30-b2

milind-sonibbcb375d0925
diff --cc server/index.ts
index 947e1ba7ae,eeb0a7ff1e..1740f372dd
--- a/server/index.ts
+++ b/server/index.ts
@@@ -569,8 -569,7 +569,8 @@@ import
type Viewer,
} from "./bot-visibility.ts";
import { describeBrand, loadBrand } from "./brand.ts";
- import { createEventFeed, type EventWriter } from "./routes/event-feed.ts";
-import { deliverLiveCodexProgress, deliverSseFrame, openSseHeartbeat } from "./sse-fanout.ts"; import { createBotFrames, takesFrame, type BotFrameForm } from "./host/bot-frames.ts";
++import { createEventFeed, type EventWriter } from "./routes/event-feed.ts"; import { deliverLiveCodexProgress } from "./sse-fanout.ts";
+import { createBotFrames, takesFrame, type BotFrameForm } from "./host/bot-frames.ts";
import { PhoneSecretBridge, PhoneSecretSubmissionRegistry } from "./phone-secret.ts";
// Keep these two last, so loading the route table leaves module start-up order as is.
import { gzipTunnelReplies, json, onJsonBody, parsedBodyOf, readBody } from "./harness/http.ts";
diff --cc server/sse-fanout.test.ts
index b9abcd677c,58d6b5f3f5..36e5aa7f49
--- a/server/sse-fanout.test.ts
+++ b/server/sse-fanout.test.ts
@@@ -93,6 -93,18 +93,18 @@@ describe("deliverSseFrame", () =>
});
});
+ it("delivers ephemeral Codex progress to local admin windows", () => {
+ const window = (overrides: Partial<{ admin: boolean; appWindow: boolean; sessionId: string; pushKey: string }> = {}) => ({
- ...fakeClient({ write: vi.fn(() => true) }), admin: true, appWindow: true, ...overrides,
++ send: vi.fn(() => true), admin: true, appWindow: true, ...overrides,
+ });
+ const local = window();
+ const other = [window({ admin: false }), window({ appWindow: false }), window({ sessionId: "remote" }), window({ pushKey: "companion:phone" })];
+ const frame = { kind: "live.codex.progress", callId: "call", text: "Checking the result" } as const;
+ deliverLiveCodexProgress([local, ...other], frame);
- expect(local.res.write).toHaveBeenCalledWith(`data: ${JSON.stringify(frame)}\n\n`);
- for (const client of other) expect(client.res.write).not.toHaveBeenCalled();
++ expect(local.send).toHaveBeenCalledWith("live.codex.progress", JSON.stringify(frame));
++ for (const client of other) expect(client.send).not.toHaveBeenCalled();
+ });
+
describe("openSseHeartbeat", () => {
const opened: { close(): void }[] = [];
afterEach(() => {
diff --cc server/sse-fanout.ts
index 809c30812f,e7381566ed..7a7e6eb311
--- a/server/sse-fanout.ts
+++ b/server/sse-fanout.ts
@@@ -35,6 -37,17 +37,17 @@@ export function deliverSseFrame(client
}
}
-type LiveProgressClient = SseFanoutClient & { admin: boolean; appWindow: boolean; sessionId?: string; pushKey?: string };
++type LiveProgressClient = { send(kind: string, json: string): boolean; admin: boolean; appWindow: boolean; sessionId?: string; pushKey?: string };
+
+ /** Only the local app streams receive this frame. Status is ephemeral and has no replay cursor. */
+ export function deliverLiveCodexProgress(clients: Iterable<LiveProgressClient>, progress: LiveCodexProgressFrame): void {
- const frame = `data: ${JSON.stringify(progress)}\n\n`;
++ const json = JSON.stringify(progress);
+ for (const client of clients) {
+ if (!client.admin || !client.appWindow || client.sessionId || client.pushKey) continue;
- if (deliverSseFrame(client, progress.kind, frame) === "disconnected") client.close();
++ client.send(progress.kind, json);
+ }
+ }
+
export interface SseHeartbeatStream {
write(chunk: string): boolean;
end(): void;
diff --cc server/testing/setup.ts
index 4ca53e1ab5,e9ebc17da6..16452e8839
--- a/server/testing/setup.ts
+++ b/server/testing/setup.ts
@@@ -34,8 -34,6 +34,8 @@@ process.env.OMB_COMPANION_DIR = join(ho
// Product code follows navigator.language; pin it so English assertions do not depend on the host locale.
Object.defineProperty(globalThis.navigator, "language", { value: "en", configurable: true });
+// Page tests drive the live feed through a fake EventSource; without this a direct page would open a real socket first.
- if (typeof window !== "undefined") Reflect.deleteProperty(globalThis, "WebSocket");
++if ("window" in globalThis) Reflect.deleteProperty(globalThis, "WebSocket");
// Windows will not remove a directory holding an open SQLite database: close it before the reset.
const { closeMessageDb } = await import("../message-db.ts");
diff --cc src/locales/de.json
index ca208ebe6a,12abaac458..5e1719291e
--- a/src/locales/de.json
+++ b/src/locales/de.json
@@@ -4573,5 -4568,8 +4573,9 @@@
"approval.status.teammateSkills": "Team-Skills geändert",
"approval.applied.skill.teammates": "{name} hat Skills im Team geändert: {title}",
"skills.request.reviewTeammates": "Prüfe jede Änderung, bevor du sie anwendest",
- "publishedApps.access.owner": "Nur du"
++ "publishedApps.access.owner": "Nur du",
+ "automations.pauseAll": "Alle pausieren",
+ "automations.resumeAll": "Alle fortsetzen",
+ "automations.pausedAll.one": "1 Automatisierung pausiert.",
+ "automations.pausedAll.other": "{count} Automatisierungen pausiert."
}