Skip to content

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

Relay quiet work status in Codex Live calls

Thang Le4266490978c2
diff --git a/apps/docs/content/docs/features/voice-and-memory.mdx b/apps/docs/content/docs/features/voice-and-memory.mdx
index da4346bc5d..97df712850 100644
--- a/apps/docs/content/docs/features/voice-and-memory.mdx
+++ b/apps/docs/content/docs/features/voice-and-memory.mdx
@@ -70,7 +70,7 @@ A Live call hangs up after 5 minutes in which nobody speaks and the bot is not w
Live calls through OpenAI work from the desktop app, a web browser or your phone. They use your own OpenAI API key, from a project with GPT-Live access: the OpenAI key in **Settings → API keys**, or a separate key for Live calls set from the call's settings, which wins when both are saved. Without a key, the **Live** button says "Live calls use your own OpenAI key. Add it in Settings → API keys." and offers **Open API keys**; a phone shows the same message, since keys are added on your computer. The key stays where you saved it, on This computer or on My Cloud; phones never receive it. OpenAI bills Live audio at about $0.05 per minute; the bot's own work is billed as usual. Live calls work in any desktop build with a microphone (no speech-to-text needed), and are for one bot at a time. Room calls always take turns.
-**Live calls through Codex on macOS.** On **This computer**, open **Settings → AI → Voice and calls** and choose **Codex (ChatGPT sign-in)** as the **Service**. This uses the ChatGPT account already signed in to Codex CLI. Update Codex CLI if it does not support voice. The call uses that sign-in for audio, and the bot handles spoken requests in the current chat with its selected AI. This service sends your microphone audio and the bot’s spoken replies to OpenAI. Previous chat messages stay out of the voice session at startup. Approve actions in the chat. The Codex service is available in the local macOS app.
+**Live calls through Codex on macOS.** On **This computer**, open **Settings → AI → Voice and calls** and choose **Codex (ChatGPT sign-in)** as the **Service**. This uses the ChatGPT account already signed in to Codex CLI. Update Codex CLI if it does not support voice. The call uses that sign-in for audio, and the bot handles spoken requests in the current chat with its selected AI. This service sends your microphone audio, the bot’s spoken replies, and short work updates to OpenAI. The voice can use those updates when you ask about progress. Previous chat messages stay out of the voice session at startup. Approve actions in the chat. The Codex service is available in the local macOS app.
**Live calls through Azure OpenAI.** If your organisation runs OpenAI models on Azure, a Live call can use a GPT-Live deployment on your own Azure OpenAI or Microsoft Foundry resource instead of OpenAI. Deploy `gpt-live-1` on the resource, then in the call's settings (or the prompt the **Live** button shows when a call is not set up) choose **Azure OpenAI** as the **Service**, paste the resource endpoint (for example `https://my-resource.openai.azure.com`) and the deployment name (empty means `gpt-live-1`), and add a key of that resource. Azure bills the call to that resource. The OpenAI API key is never used for Azure. A saved Live key goes only to the service it was saved for and, on Azure, to that endpoint's host: changing the **Service** or the endpoint's host asks for the key again, even if you change it back. Calls go only to an `https` address on `*.openai.azure.com`, `*.services.ai.azure.com`, `*.cognitiveservices.azure.com`, `*.openai.azure.us`, `*.openai.azure.cn` or `*.azure-api.net` (API Management); any other address is refused, and so is a redirect. On a server you can set the same thing with `OMB_LIVE_PROVIDER=azure`, `OMB_AZURE_OPENAI_LIVE_ENDPOINT`, `OMB_AZURE_OPENAI_LIVE_DEPLOYMENT` and `OMB_OPENAI_LIVE_KEY` (the resource key); set together there, the key belongs to that endpoint. With Azure, everything below that goes to OpenAI goes to your Azure resource instead.
diff --git a/docs/verification/live-calls.md b/docs/verification/live-calls.md
index 74f7075d9a..e3f6d6de07 100644
--- a/docs/verification/live-calls.md
+++ b/docs/verification/live-calls.md
@@ -61,16 +61,19 @@ desktop only. The saved setting leaves the previous service and its key in the
existing configuration fields so an earlier release can read them.
```sh
-pnpm exec vitest run server/live-codex.test.ts server/live-call-controller.test.ts server/live-settings.test.ts server/routes/live.test.ts
+pnpm exec vitest run server/live-codex.test.ts server/live-call-controller.test.ts server/live-settings.test.ts server/routes/live.test.ts server/sse-fanout.test.ts src/lib/live-call-media.test.ts
```
The Codex CLI fixture negotiates WebRTC SDP through a fake app-server. It
checks that API-key sign-in and active tools are refused, the ephemeral thread
has no tool environment or startup chat context, only the call's user
transcript is relayed, and the process stops on hang-up. The controller checks
-that the transcript reaches the requested bot and thread and a spoken
-approval leaves the approval card for the person to handle in chat. These
-checks use a disposable home and synthetic SDP and do not use a microphone.
+that the transcript reaches the requested bot and thread, a spoken approval
+leaves the approval card in chat, and a preconnected socket closes on
+shutdown or cancellation. Progress reaches the current Codex peer through
+its WebRTC commentary channel, which accepts quiet context. Replies still
+use the Codex speech RPC. These checks use a disposable home and synthetic
+SDP.
## Azure OpenAI as the Live provider
diff --git a/packages/phone-protocol/src/live-call-wire.ts b/packages/phone-protocol/src/live-call-wire.ts
index 09eff0877f..c87b5187bc 100644
--- a/packages/phone-protocol/src/live-call-wire.ts
+++ b/packages/phone-protocol/src/live-call-wire.ts
@@ -29,6 +29,12 @@ export interface LiveCallState {
error?: string;
}
+export interface LiveCodexProgressFrame {
+ kind: "live.codex.progress";
+ callId: string;
+ text: string;
+}
+
/** A line the bot said aloud on a Live call: when it began (epoch ms) and its words. */
export interface LiveSpokenLine {
at: number;
diff --git a/packages/phone-protocol/src/wire.ts b/packages/phone-protocol/src/wire.ts
index ac5a800392..d8e4c93f4e 100644
--- a/packages/phone-protocol/src/wire.ts
+++ b/packages/phone-protocol/src/wire.ts
@@ -33,13 +33,13 @@ import type { Routine, RoutineRun } from "./routines.ts";
import type { WebhookAttempt, WebhookTrigger } from "./webhooks.ts";
import type { PublishedPageCard } from "./published-page.ts";
import type { InboxItem, InboxTask } from "./inbox.ts";
-import type { LiveCallRecord, LiveCallState } from "./live-call-wire.ts";
+import type { LiveCallRecord, LiveCallState, LiveCodexProgressFrame } from "./live-call-wire.ts";
import type { ForkOrigin, TaskClosedBy, TaskOpenedBy } from "./task-provenance.ts"; import type { RoomThreadCloser } from "./room-threads.ts";
import type { CompanionEndpointsSnapshot } from "./responses.ts";
/** What a team bot's main chat is called, beside each person's own chats. */
export const SHARED_CHAT_TITLE = "Shared chat";
-export type { LiveCallRecord, LiveCallState, LiveCallStatus, LiveClient, LiveElevenLabsSession, LiveElevenLabsTransport, LiveEndReason, LiveFishRelayCommand, LiveFishRelayEvent, LiveFishSessionToken, LiveFishTransport, LiveGeminiSession, LiveGeminiTransport, LiveKeySource, LiveProvider, LiveSettings, LiveSpokenLine } from "./live-call-wire.ts";
+export type { LiveCallRecord, LiveCallState, LiveCallStatus, LiveClient, LiveCodexProgressFrame, LiveElevenLabsSession, LiveElevenLabsTransport, LiveEndReason, LiveFishRelayCommand, LiveFishRelayEvent, LiveFishSessionToken, LiveFishTransport, LiveGeminiSession, LiveGeminiTransport, LiveKeySource, LiveProvider, LiveSettings, LiveSpokenLine } from "./live-call-wire.ts";
export type { ForkOrigin, TaskClosedBy, TaskOpenedBy } from "./task-provenance.ts";
export type { AuthPairResponse, AuthSessionResponse, BotCreateResponse, BotsResponse, BotUpdateResponse, CompanionE2EDescriptor, CompanionEndpointsSnapshot, InstancesResponse, LoopbackSessionResponse, PairedDevice, PairedSession, PairRequest, PairResponse, RoomCreateResponse, RoomTaskCreateResponse, RoomTaskUpdateResponse, RoomUpdateResponse, SearchHit, SearchResponse, SignedInSessionResponse, TaskResponse, WireComputerControl, WireInstance, WireMessagePage, WireModelOption } from "./responses.ts";
@@ -991,7 +991,7 @@ export type ServerFrame =
| { kind: "bot.deleted"; botId: string }
/** The whole fleet (PUT /api/bots/order) or every room (PUT /api/groups/order) in its new order; a member is sent only the ones they see. */
| { kind: "bots.order"; botIds: string[] } | { kind: "groups.order"; groupIds: string[] } | WindowPrefFrame | { kind: "theme"; skin?: string } | /** The Apps page's catalog changed; the list is read again. */ { kind: "apps-catalog" }
- | { kind: "live.call"; botId: string; threadId: string; call: LiveCallState | null }
+ | { kind: "live.call"; botId: string; threadId: string; call: LiveCallState | null } | LiveCodexProgressFrame
/** A job is waiting for the phone whose registry key this is; it polls now. */
| { kind: "device.job"; phone: string; id: string }
/** Who is here on a Team Cloud (shared/team-presence.ts). */
diff --git a/server/index.ts b/server/index.ts
index b8e6b425f9..68245e986c 100644
--- a/server/index.ts
+++ b/server/index.ts
@@ -568,7 +568,7 @@ import {
type Viewer,
} from "./bot-visibility.ts";
import { describeBrand, loadBrand } from "./brand.ts";
-import { deliverSseFrame, openSseHeartbeat } from "./sse-fanout.ts"; import { createBotFrames, takesFrame, type BotFrameForm } from "./host/bot-frames.ts";
+import { deliverLiveCodexProgress, deliverSseFrame, openSseHeartbeat } 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";
@@ -12319,8 +12319,7 @@ const liveCalls = new LiveCallController({
if (result.status === 401) throw new LiveCallSignedOutError();
return { ok: false, error: result.error };
},
- queued: isSteeredMessageQueued,
- signedIn: liveSignedIn,
+ queued: isSteeredMessageQueued, signedIn: liveSignedIn,
personKey: (auth) => messageSender(auth)?.id,
activity: (botId, threadId) => {
const task = store.taskByThread(botId, threadId);
@@ -12328,6 +12327,7 @@ const liveCalls = new LiveCallController({
return task.activity === "waiting-on-you" ? "waiting" : "working";
},
broadcast: (frame) => broadcast(frame, { adminOnly: true }),
+ codexProgress: (frame) => deliverLiveCodexProgress(sseClients, frame),
settings: () => liveCallSettings(cfg), botVoice: (botId) => store.bot(botId)?.liveVoice,
azureRefusal: (auth) => azureLiveCallRefusal(auth, { othersOnLoopback: adminActivityRecording() }),
...liveWiring.calls,
diff --git a/server/live-call-controller.test.ts b/server/live-call-controller.test.ts
index 207c265aac..290cd7fba7 100644
--- a/server/live-call-controller.test.ts
+++ b/server/live-call-controller.test.ts
@@ -39,6 +39,7 @@ class FakeSocket implements LiveSocket {
const owner: RequestAuth = { kind: "loopback", scopes: ["admin", "client"] };
const BOT = { botId: "bot1", botName: "Ada", threadId: "t1" };
const ENDPOINT: LiveEndpoint = { provider: "openai", apiBase: "https://api.openai.com/v1", model: "gpt-live-1" };
+const CODEX_ENDPOINT: LiveEndpoint = { provider: "codex", apiBase: "", model: "" };
function setup(overrides: Partial<LiveCallDeps> = {}) {
const listeners = new Set<(change: StoreChange) => void>();
@@ -100,26 +101,43 @@ describe("LiveCallController lifecycle", () => {
});
it("uses Codex without an API key and refuses a phone before starting the session", async () => {
- const endpoint: LiveEndpoint = { provider: "codex", apiBase: "", model: "" };
+ const socket = new FakeSocket("", "");
+ const codexProgress = vi.fn();
+ socket.open();
const t = setup({
- settings: () => ({ provider: "codex", key: "", endpoint, voice: "marin", readTypedReplies: true, idleMinutes: 5 }),
+ settings: () => ({ provider: "codex", key: "", endpoint: CODEX_ENDPOINT, voice: "marin", readTypedReplies: true, idleMinutes: 5 }),
codexRefusal: (_auth, client) => client === "desktop" ? null : "Desktop only.",
+ createSession: vi.fn(async () => ({ sessionId: "codex-session", sdp: "answer-sdp", socket })),
+ openSocket: vi.fn(),
+ codexProgress,
});
await expect(t.controller.start({ auth: owner, ...BOT, client: "ios", sdp: "offer-sdp" })).rejects.toMatchObject({ status: 403 });
expect(t.deps.createSession).not.toHaveBeenCalled();
- await t.start();
- expect(t.deps.createSession).toHaveBeenCalledWith({ key: "", endpoint, sdp: "offer-sdp", botId: "bot1", threadId: "t1", voice: "juniper" });
- t.socket().receive({ type: "session.input_transcript.delta", delta: "Calculate 17 times 23", start_ms: 10, end_ms: 20 });
- t.socket().receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-1" }, offset_ms: 20 });
+ const result = await t.controller.start({ auth: owner, ...BOT, client: "desktop", sdp: "offer-sdp" });
+ expect(result.call.status).toBe("live");
+ expect(t.frames.map((frame) => frame?.status)).toEqual(["connecting", "live"]);
+ expect(t.deps.openSocket).not.toHaveBeenCalled();
+ expect(t.deps.createSession).toHaveBeenCalledWith({ key: "", endpoint: CODEX_ENDPOINT, sdp: "offer-sdp", botId: "bot1", threadId: "t1", voice: "juniper" });
+ socket.receive({ type: "session.input_transcript.delta", delta: "Calculate 17 times 23", start_ms: 10, end_ms: 20 });
+ socket.receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-1" }, offset_ms: 20 });
await vi.advanceTimersByTimeAsync(DELEGATION_SETTLE_MS);
expect(t.deps.send).toHaveBeenCalledWith(expect.objectContaining({ botId: BOT.botId, threadId: BOT.threadId, text: "Calculate 17 times 23" }));
+ t.message({ id: "progress", kind: "activity", tool: { name: "Bash", spoken: "Checked the numbers" } });
+ await vi.advanceTimersByTimeAsync(0);
+ expect(codexProgress).toHaveBeenNthCalledWith(1, { kind: "live.codex.progress", callId: result.call.callId, text: `For progress questions only. ${LIVE_COPY.working}` });
+ expect(codexProgress).toHaveBeenNthCalledWith(2, { kind: "live.codex.progress", callId: result.call.callId, text: `For progress questions only. ${LIVE_COPY.progress("Checked the numbers")}` });
+ expect(socket.appends("thinking")).toEqual([]);
t.message({ id: "approval", kind: "options", card: { title: "Approval needed", subtitle: "echo hello", options: ["Allow", "Deny"], requestId: "r1", tool: "Bash" } });
await vi.advanceTimersByTimeAsync(0);
- t.socket().receive({ type: "session.input_transcript.delta", delta: "yes", start_ms: 2000, end_ms: 2100 });
- t.socket().receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-2" }, offset_ms: 2100 });
+ socket.receive({ type: "session.input_transcript.delta", delta: "yes", start_ms: 2000, end_ms: 2100 });
+ socket.receive({ type: "session.delegation.created", delegation: { target: "client", id: "codex-2" }, offset_ms: 2100 });
await vi.advanceTimersByTimeAsync(CONSENT_SETTLE_MS + DELEGATION_SETTLE_MS);
expect(t.deps.respond).not.toHaveBeenCalled();
expect(t.deps.send).toHaveBeenCalledTimes(1);
+ await t.controller.shutdown();
+ expect(socket.sent.at(-1)).toMatchObject({ type: "session.close" });
+ expect(socket.readyState).toBe(3);
+ expect(t.controller.current()).toBeNull();
});
it("speaks in the called bot's own Live voice; a bot without one keeps the app's", async () => {
@@ -738,11 +756,12 @@ describe("LiveCallController lifecycle", () => {
});
});
- describe("a start cancelled while OpenAI creates the session", () => {
- function pendingSession() {
- let resolve!: (value: { sessionId: string; sdp: string }) => void;
- const createSession = vi.fn(() => new Promise<{ sessionId: string; sdp: string }>((done) => { resolve = done; }));
- return { createSession, answer: () => resolve({ sessionId: "sess_9", sdp: "answer-sdp" }) };
+ describe("a start cancelled while the provider creates the session", () => {
+ function pendingSession(socket?: LiveSocket) {
+ type Session = { sessionId: string; sdp: string; socket?: LiveSocket };
+ let resolve!: (value: Session) => void;
+ const createSession = vi.fn(() => new Promise<Session>((done) => { resolve = done; }));
+ return { createSession, answer: () => resolve({ sessionId: "sess_9", sdp: "answer-sdp", socket }) };
}
it("closes the session it created through the sideband", async () => {
@@ -774,6 +793,23 @@ describe("LiveCallController lifecycle", () => {
expect(t.socket().sent).toEqual([]);
expect(vi.getTimerCount()).toBe(0);
});
+
+ it("closes an already-open Codex socket returned after shutdown", async () => {
+ const socket = new FakeSocket("", "");
+ socket.open();
+ const pending = pendingSession(socket);
+ const t = setup({ createSession: pending.createSession, codexRefusal: () => null, openSocket: vi.fn() });
+ t.settings.provider = "codex";
+ t.settings.endpoint = CODEX_ENDPOINT;
+ t.settings.key = "";
+ const starting = t.controller.start({ auth: owner, ...BOT, client: "desktop", sdp: "offer-sdp" });
+ await t.controller.shutdown();
+ pending.answer();
+ await expect(starting).rejects.toMatchObject({ status: 503 });
+ expect(socket.readyState).toBe(3);
+ expect(t.deps.openSocket).not.toHaveBeenCalled();
+ expect(vi.getTimerCount()).toBe(0);
+ });
});
it("frees the slot when setting up the call fails after the session exists", async () => {
diff --git a/server/live-call-controller.ts b/server/live-call-controller.ts
index d82f6460be..ec59df144e 100644
--- a/server/live-call-controller.ts
+++ b/server/live-call-controller.ts
@@ -6,7 +6,7 @@ import {
} from "../shared/live-approval.ts";
import { botCallVoice, clampAppend, commentaryChunks, geminiLiveVoice, LiveTranscript, SpokenLines } from "../shared/live-call.ts";
import { signInWaits } from "../shared/sign-in-request.ts";
-import type { LiveCallRecord, LiveCallState, LiveClient, LiveElevenLabsTransport, LiveEndReason, LiveFishTransport, LiveGeminiTransport, LiveProvider } from "../shared/wire.ts";
+import type { LiveCallRecord, LiveCallState, LiveClient, LiveCodexProgressFrame, LiveElevenLabsTransport, LiveEndReason, LiveFishTransport, LiveGeminiTransport, LiveProvider } from "../shared/wire.ts";
import { FISH_AGENT_VOICE } from "./live-fish.ts";
import { LIVE_NEEDS_KEY, liveAuthHeaders, liveCallSummaryLine, liveProviderName, LiveSessionError, liveVoice, spokenHangUp, type LiveEndpoint } from "./live-call.ts";
import { LIVE_CODEX_REFUSAL, LIVE_CUSTOM_REFUSAL } from "./live-access.ts";
@@ -71,6 +71,7 @@ export interface LiveCallDeps {
personKey?(auth: RequestAuth): string | undefined;
activity(botId: string, threadId: string): LiveActivity;
broadcast(frame: { kind: "live.call"; botId: string; threadId: string; call: LiveCallState | null }): void;
+ codexProgress?(frame: LiveCodexProgressFrame): void;
/** `endpoint` null, or a `setupProblem`, refuses the call with that message (409). */
settings(): { key: string; endpoint: LiveEndpoint | null; setupProblem?: string | null; provider?: LiveProvider; voice: string; geminiVoice?: string; readTypedReplies: boolean; idleMinutes: number };
/** The called bot's own Live call voice, used over the app's when it is the call provider's. */
@@ -863,8 +864,15 @@ export class LiveCallController {
}
- private append(call: Call, kind: AppendKind, content: string, delegationId: string | null = call.activeDelegation): boolean {
- return this.command(call, { type: `session.${kind}.append`, delegation_id: delegationId, content: clampAppend(content) });
+ private append(call: Call, kind: AppendKind, content: string, delegationId: string | null = call.activeDelegation): void {
+ if (kind === "thinking" && call.endpoint.provider === "codex") {
+ if (call.state.status === "live") this.deps.codexProgress?.({
+ kind: "live.codex.progress", callId: call.state.callId,
+ text: clampAppend(`For progress questions only. ${scrubHeldSecrets(content)}`),
+ });
+ return;
+ }
+ this.command(call, { type: `session.${kind}.append`, delegation_id: delegationId, content: clampAppend(content) });
}
private command(call: Call, event: Record<string, unknown>): boolean {
diff --git a/server/live-codex.ts b/server/live-codex.ts
index 89e0fb679e..367e5db0a5 100644
--- a/server/live-codex.ts
+++ b/server/live-codex.ts
@@ -16,7 +16,7 @@ const START_TIMEOUT_MS = 25_000;
const START_FAILED = "Codex could not start Live calls. Update Codex CLI and check its ChatGPT sign-in.";
const AUTH_REQUIRED = "Sign in to Codex with ChatGPT in Settings → AI to use Live calls.";
const THREAD_SCOPE_FAILED = "Codex could not start a Live call with its tools disabled. Update Codex CLI and try again.";
-const VOICE_PROMPT = "You are the voice for a MausBot call. MausBot sends the person's requests to their bot. Briefly acknowledge in the person's language while waiting, and read only the bot's replies when MausBot sends them. Leave work and tool calls to the bot.";
+const VOICE_PROMPT = "You are the voice for a MausBot call. MausBot sends the person's requests to their bot. Briefly acknowledge in the person's language while waiting. Read the bot's replies when MausBot sends them. Use work updates only to answer questions about progress. Leave work and tool calls to the bot.";
const DISABLED_FEATURES = ["apps", "plugins", "hooks", "multi_agent", "multi_agent_v2", "image_generation"] as const;
export interface LiveCodexCli {
diff --git a/server/sse-fanout.test.ts b/server/sse-fanout.test.ts
index b9abcd677c..58d6b5f3f5 100644
--- a/server/sse-fanout.test.ts
+++ b/server/sse-fanout.test.ts
@@ -4,7 +4,7 @@ import { setTimeout as sleep } from "node:timers/promises";
import { afterEach, describe, expect, it, vi } from "vitest";
-import { deliverSseFrame, openSseHeartbeat, SSE_MAX_BUFFERED_BYTES, type SseFanoutClient } from "./sse-fanout.ts";
+import { deliverLiveCodexProgress, deliverSseFrame, openSseHeartbeat, SSE_MAX_BUFFERED_BYTES, type SseFanoutClient } from "./sse-fanout.ts";
type TestClient = SseFanoutClient & { drains: (() => void)[] };
@@ -93,6 +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,
+ });
+ 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();
+});
+
describe("openSseHeartbeat", () => {
const opened: { close(): void }[] = [];
afterEach(() => {
diff --git a/server/sse-fanout.ts b/server/sse-fanout.ts
index 809c30812f..e7381566ed 100644
--- a/server/sse-fanout.ts
+++ b/server/sse-fanout.ts
@@ -1,3 +1,5 @@
+import type { LiveCodexProgressFrame } from "../shared/wire.ts";
+
export interface SseFanoutClient {
res: {
write(chunk: string): boolean;
@@ -35,6 +37,17 @@ export function deliverSseFrame(client: SseFanoutClient, kind: string, frame: st
}
}
+type LiveProgressClient = SseFanoutClient & { 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`;
+ for (const client of clients) {
+ if (!client.admin || !client.appWindow || client.sessionId || client.pushKey) continue;
+ if (deliverSseFrame(client, progress.kind, frame) === "disconnected") client.close();
+ }
+}
+
export interface SseHeartbeatStream {
write(chunk: string): boolean;
end(): void;
diff --git a/src/lib/live-call-media.test.ts b/src/lib/live-call-media.test.ts
index 6b5c36b03e..c9461afa90 100644
--- a/src/lib/live-call-media.test.ts
+++ b/src/lib/live-call-media.test.ts
@@ -1,5 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { currentCall } from "./call";
+import { publishLiveFrame } from "./live-events";
import {
applyCaption, checkLiveSignIn, configureLiveMedia, dismissStartPrompt, endNotice, handleLiveCallKey, hangUpLiveCall, isLiveCallRunning, liveCallShortcut,
liveMedia, onLiveStreamConnected, onServerCall, resetLiveMedia, setLiveMuted, startLiveCall, subscribeLiveMedia, takeLiveCallAction,
@@ -85,6 +86,24 @@ describe("live call media", () => {
expect(currentCall()).toBe("b1");
onServerCall({ ...call, status: "live" });
expect(liveMedia().phase).toBe("live");
+ publishLiveFrame({ kind: "live.codex.progress", callId: call.callId, text: "Progress from another service" });
+ expect(peer.channel.sent).toEqual([]);
+ });
+
+ it("appends progress quietly to the current Codex call", async () => {
+ const frame = { kind: "live.codex.progress", callId: call.callId, text: "Checking the result" } as const;
+ await startLiveCall({ botId: "b1", threadId: "t1", provider: "codex" });
+ publishLiveFrame(frame);
+ onServerCall({ ...call, status: "live" });
+ publishLiveFrame({ ...frame, callId: "different-call" });
+ expect(peer.channel.sent).toEqual([]);
+ publishLiveFrame(frame);
+ expect(peer.channel.sent.map((message) => JSON.parse(message))).toEqual([{
+ type: "session.context.append", channel: "commentary", content: [{ type: "input_text", text: frame.text }],
+ }]);
+ resetLiveMedia();
+ publishLiveFrame(frame);
+ expect(peer.channel.sent).toHaveLength(1);
});
it.each([
diff --git a/src/lib/live-call-media.ts b/src/lib/live-call-media.ts
index 15591aa2e0..5ec9e17955 100644
--- a/src/lib/live-call-media.ts
+++ b/src/lib/live-call-media.ts
@@ -1,4 +1,4 @@
-// Its data channel may only send session.close; everything else about the call runs on the harness.
+// The GPT-Live data channel sends only session.close. Codex's v3 channel also accepts quiet commentary context.
import { useSyncExternalStore } from "react";
import type { LiveCallState, LiveElevenLabsSession, LiveElevenLabsTransport, LiveEndReason, LiveFishTransport, LiveGeminiSession, LiveGeminiTransport, LiveProvider } from "../../shared/wire";
import { api, ApiError } from "@/state/store";
@@ -8,6 +8,7 @@ import { desktopCapabilitiesNow } from "./desktop";
import { FishCall, isFishMicDenied, startFishAgentSession, type FishCallHooks, type FishSessionStarter } from "./live-call-fish";
import { startElevenLabsLiveSession } from "./live-call-elevenlabs";
import { startGeminiLiveSession } from "./live-call-gemini";
+import { listenLiveFrames } from "./live-events";
import { t } from "./i18n";
export type LiveMediaPhase = "idle" | "starting" | "live" | "ending" | "ended" | "failed";
@@ -112,6 +113,7 @@ let noticeTimer: ReturnType<typeof setTimeout> | null = null;
let closeTimer: ReturnType<typeof setTimeout> | null = null;
let connectTimer: ReturnType<typeof setTimeout> | null = null;
let stopGestureWait: (() => void) | null = null;
+let stopCodexProgress: (() => void) | null = null;
let serverCall: LiveCallState | null = null;
let serverAttached = false;
const watchers = new Set<() => void>();
@@ -223,6 +225,17 @@ export async function startLiveCall(target: { botId: string; threadId: string; p
// the event channel must exist before the offer is created
const events = connection.createDataChannel("oai-events");
channel = events;
+ if (target.provider === "codex") stopCodexProgress = listenLiveFrames({
+ onFrame: (frame) => {
+ if (frame.kind !== "live.codex.progress" || frame.callId !== state.callId || state.phase !== "live" ||
+ events.readyState !== "open" || typeof frame.text !== "string") return;
+ try {
+ events.send(JSON.stringify({
+ type: "session.context.append", channel: "commentary", content: [{ type: "input_text", text: frame.text }],
+ }));
+ } catch {}
+ },
+ });
events.onopen = () => {
if (mine === generation) goLiveWhenReady();
};
@@ -549,6 +562,8 @@ function release() {
heardTimer = closeTimer = noticeTimer = connectTimer = null;
stopGestureWait?.();
stopGestureWait = null;
+ stopCodexProgress?.();
+ stopCodexProgress = null;
stopCapturing();
try { channel?.close(); } catch {}
channel = null;
diff --git a/src/locales/en.json b/src/locales/en.json
index 8476d6efb2..6acc916770 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -7126,7 +7126,7 @@
"call.live.provider": "Service",
"call.live.provider.openai": "OpenAI",
"call.live.provider.codex": "Codex (ChatGPT sign-in)",
- "call.live.disclosureCodex": "This desktop call uses your Codex CLI sign-in and sends your microphone audio and the bot’s spoken replies to OpenAI. Approve actions in the chat.",
+ "call.live.disclosureCodex": "This desktop call uses your Codex CLI sign-in and sends your microphone audio, the bot’s spoken replies, and short work updates to OpenAI. Approve actions in the chat.",
"call.live.provider.azure": "Azure OpenAI",
"call.live.azureEndpoint": "Azure resource endpoint",
"call.live.azureDeployment": "GPT-Live deployment name",