@devries-cameron20 / t3code Mirror · read-only / commits / 0240eac9da
Fork 0

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

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 06:00 UTC

fix(server): images that ACP agents read show a preview (#37468)

Co-authored-by: Julius Marminge <julius0216@outlook.com>

cosier committed Nov 20, 2026 at 06:44 UTC 0240eac9dad58b5e922e96a3093874332d38d707
3 files changed +38 -5
apps/server/scripts/acp-mock-agent.ts
+10
@@ -1322,6 +1322,16 @@ const program = Effect.gen(function* () {
1322 rawInput: { path: "src/env.ts" },
1323 locations: [{ path: "src/env.ts" }],
1324 },
1325 + // Antigravity reports an image read with only a text result, never the image bytes.
1326 + {
1327 + sessionUpdate: "tool_call_update",
1328 + toolCallId: "structured-image-read",
1329 + title: "Read `mockup.png`",
1330 + kind: "read",
1331 + status: "completed",
1332 + rawInput: { file_path: "/workspace/mockup.png", start_line: 0, end_line: 799 },
1333 + rawOutput: "View mockup.png",
1334 + },
1335 {
1336 sessionUpdate: "tool_call_update",
1337 toolCallId: "structured-search",
apps/server/src/orchestration-v2/Adapters/AcpAdapterV2.test.ts
+21 -5
@@ -4645,11 +4645,27 @@ describe("AcpAdapterV2", () => {
4645 item.changes[0]?.oldPath === "/workspace/old.ts",
4646 ),
4647 );
4648 - const read = items.find((item) => item.type === "dynamic_tool" && item.toolName === "Read");
4649 - assert.deepEqual(
4650 - read?.type === "dynamic_tool" ? { title: read.title, input: read.input } : null,
4651 - { title: "Read src/env.ts", input: { path: "src/env.ts" } },
4652 - );
4648 + const readItem = (nativeId: string) => {
4649 + const item = items.findLast(
4650 + (candidate) =>
4651 + candidate.type === "dynamic_tool" &&
4652 + candidate.toolName === "Read" &&
4653 + candidate.nativeItemRef?.nativeId?.endsWith(nativeId) === true,
4654 + );
4655 + return item?.type === "dynamic_tool"
4656 + ? { title: item.title, input: item.input, viewedImagePath: item.viewedImagePath }
4657 + : null;
4658 + };
4659 + assert.deepEqual(readItem("structured-read"), {
4660 + title: "Read src/env.ts",
4661 + input: { path: "src/env.ts" },
4662 + viewedImagePath: undefined,
4663 + });
4664 + assert.deepEqual(readItem("structured-image-read"), {
4665 + title: "Read /workspace/mockup.png",
4666 + input: { file_path: "/workspace/mockup.png", start_line: 0, end_line: 799 },
4667 + viewedImagePath: "/workspace/mockup.png",
4668 + });
4669 const search = items.find((item) => item.type === "file_search");
4670 assert.deepEqual(
4671 search?.type === "file_search" ? { title: search.title, pattern: search.pattern } : null,
packages/provider-acp/src/server/adapter.ts
+7
@@ -70,6 +70,7 @@ import type * as EffectAcpProtocol from "effect-acp/protocol";
70 import type * as EffectAcpSchema from "effect-acp/compat";
71
72 import { formatReadToolLabel, formatSearchToolLabel } from "@t3tools/shared/toolActivity";
73 +import { isWorkspaceImagePreviewPath } from "@t3tools/shared/mediaPreview";
74 import * as ProviderHost from "@t3tools/provider-core/server/ProviderHost";
75 import { makeAcpMcpOverAcpBridge, type AcpMcpOverAcpBridge } from "./mcpOverAcpBridge.ts";
76 import { mcpToolPresentation } from "@t3tools/provider-core/server/mcpToolPresentation";
@@ -4724,6 +4725,12 @@ export const makeAcpAdapterV2 = Effect.fn("makeAcpAdapterV2")(function* (
4725 title: path ? formatReadToolLabel(path) : (title ?? "Read file"),
4726 type: "dynamic_tool",
4727 toolName: "Read",
4728 + ...(path !== undefined &&
4729 + path.length <= 4096 &&
4730 + !/[\r\n]/.test(path) &&
4731 + isWorkspaceImagePreviewPath(path)
4732 + ? { viewedImagePath: path }
4733 + : {}),
4734 input:
4735 path === undefined ||
4736 ["path", "filePath", "file_path"].some((key) => rawInputRecord?.[key] === path)