GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): show Codex tool-output images inline (#23284) · pingdotgg/t3code@f021c21

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/orchestration-v2/Adapters
    • CodexAdapterV2.test.ts
    • CodexAdapterV2.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import * as Effect from "effect/Effect";
4242
import * as Predicate from "effect/Predicate";
4343
import * as FileSystem from "effect/FileSystem";
4444
import { MCP_APP_OUTPUT_KEY, readMcpAppReference } from "@t3tools/shared/mcpApp";
45+
import { toolOutputImages } from "@t3tools/shared/toolOutput";
4546
import { resolveAttachmentPathById } from "../../attachmentStore.ts";
4647
import * as Fiber from "effect/Fiber";
4748
import * as Layer from "effect/Layer";
@@ -8375,3 +8376,30 @@ describe("CodexAdapterV2 post-settle continuation", () => {
83758376
);
83768377
});
83778378
});
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+
});
Collapse file

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.ts
+10-2Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,19 @@ function codexMcpAppResourceUri(item: CodexDynamicToolItem): string | undefined
491491
return typeof uri === "string" && uri.startsWith(MCP_APP_RESOURCE_SCHEME) ? uri : undefined;
492492
}
493493

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(
495497
item: Extract<CodexDynamicToolItem, { readonly type: "dynamicToolCall" }>,
496498
): unknown | undefined {
497499
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+
});
499507
}
500508
return item.success === false ? { success: false } : undefined;
501509
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.