@devries-cameron20 / t3code-1 / commits / f021c21da2
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): show Codex tool-output images inline (#23284)

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com> Co-authored-by: maria-rcks <maria@kuuro.net>

achose369 committed Oct 31, 2026 at 16:37 UTC f021c21da2f418cfa472b008dff8e4bf6530b4b2
2 files changed +38 -2
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+28
@@ -42,6 +42,7 @@ import * as Effect from "effect/Effect";
42 import * as Predicate from "effect/Predicate";
43 import * as FileSystem from "effect/FileSystem";
44 import { MCP_APP_OUTPUT_KEY, readMcpAppReference } from "@t3tools/shared/mcpApp";
45 +import { toolOutputImages } from "@t3tools/shared/toolOutput";
46 import { resolveAttachmentPathById } from "../../attachmentStore.ts";
47 import * as Fiber from "effect/Fiber";
48 import * as Layer from "effect/Layer";
@@ -8375,3 +8376,30 @@ describe("CodexAdapterV2 post-settle continuation", () => {
8376 );
8377 });
8378 });
8379 +
8380 +describe("codexDynamicToolOutput", () => {
8381 + it("translates inputImage data URLs into image blocks the work log can serve", () => {
8382 + const output = CodexAdapterV2.codexDynamicToolOutput({
8383 + type: "dynamicToolCall",
8384 + id: "exec-image",
8385 + tool: "exec",
8386 + status: "completed",
8387 + arguments: {},
8388 + contentItems: [
8389 + { type: "inputText", text: "Script completed" },
8390 + { type: "inputImage", imageUrl: "data:image/png;base64,iVBORw0KGgo=" },
8391 + { type: "inputImage", imageUrl: "https://example.test/remote.png" },
8392 + { type: "inputImage", imageUrl: "data:image/png;base64," },
8393 + { type: "inputAudio", audioUrl: "data:audio/wav;base64,AAAA" },
8394 + ],
8395 + });
8396 + assert.deepEqual(toolOutputImages(output), [{ mimeType: "image/png", data: "iVBORw0KGgo=" }]);
8397 + assert.deepEqual(output, [
8398 + { type: "inputText", text: "Script completed" },
8399 + { type: "image", mimeType: "image/png", data: "iVBORw0KGgo=" },
8400 + { type: "inputImage", imageUrl: "https://example.test/remote.png" },
8401 + { type: "inputImage", imageUrl: "data:image/png;base64," },
8402 + { type: "inputAudio", audioUrl: "data:audio/wav;base64,AAAA" },
8403 + ]);
8404 + });
8405 +});
apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+10 -2
@@ -491,11 +491,19 @@ function codexMcpAppResourceUri(item: CodexDynamicToolItem): string | undefined
491 return typeof uri === "string" && uri.startsWith(MCP_APP_RESOURCE_SCHEME) ? uri : undefined;
492 }
493
494 -function codexDynamicToolOutput(
494 +const CODEX_IMAGE_DATA_URL = /^data:(image\/[a-z0-9.+-]+);base64,([A-Za-z0-9+/=]+)$/i;
495 +
496 +export function codexDynamicToolOutput(
497 item: Extract<CodexDynamicToolItem, { readonly type: "dynamicToolCall" }>,
498 ): unknown | undefined {
499 if (item.contentItems !== null && item.contentItems !== undefined) {
498 - return item.contentItems;
500 + return item.contentItems.map((content) => {
501 + if (content.type !== "inputImage") return content;
502 + const match = CODEX_IMAGE_DATA_URL.exec(content.imageUrl);
503 + return match?.[1] && match[2]
504 + ? { type: "image", mimeType: match[1].toLowerCase(), data: match[2] }
505 + : content;
506 + });
507 }
508 return item.success === false ? { success: false } : undefined;
509 }