diff --git a/packages/provider-acp/src/server/runtimeModel.test.ts b/packages/provider-acp/src/server/runtimeModel.test.ts index ee4a9ca2aa57a..486c741d6814c 100644 --- a/packages/provider-acp/src/server/runtimeModel.test.ts +++ b/packages/provider-acp/src/server/runtimeModel.test.ts @@ -1488,6 +1488,9 @@ describe("extractMcpToolCallIdentity", () => { "Running delegate_task", "Run mcp_t3-code_delegate_task", "Run mcp_t3-code_delegate_task?", + // Devin: "Calling from " / "Called from ". + "Calling delegate_task from t3-code", + "Called delegate_task from t3-code", ]) { const toolCall = toolCallFromUpdate({ sessionUpdate: "tool_call", @@ -1603,14 +1606,20 @@ describe("extractMcpToolCallIdentity", () => { }); it("does not claim an agent's own tool that shares a T3 tool name", () => { - const toolCall = toolCallFromUpdate({ - sessionUpdate: "tool_call", - toolCallId: "own-delegate-1", - kind: "execute", - title: "delegate_task: 1 tasks: Run the terminal command 'echo child-result-42'", - status: "pending", - }); - expect(extractMcpToolCallIdentity(toolCall)).toBeUndefined(); + for (const title of [ + "delegate_task: 1 tasks: Run the terminal command 'echo child-result-42'", + "Called html_render from linear", + "Called unknown_tool from t3-code", + ]) { + const toolCall = toolCallFromUpdate({ + sessionUpdate: "tool_call", + toolCallId: "own-delegate-1", + kind: "execute", + title, + status: "pending", + }); + expect(extractMcpToolCallIdentity(toolCall), title).toBeUndefined(); + } }); it("recovers T3 identity from goose _meta despite LLM-rewritten titles", () => { diff --git a/packages/provider-acp/src/server/runtimeModel.ts b/packages/provider-acp/src/server/runtimeModel.ts index e01ca47772f9e..889d4017d0042 100644 --- a/packages/provider-acp/src/server/runtimeModel.ts +++ b/packages/provider-acp/src/server/runtimeModel.ts @@ -1125,6 +1125,10 @@ const T3_MCP_BARE_TITLE_CALL = /^(?[A-Za-z0-9_]+)(?::\s*\{|$)/; // Antigravity titles calls "Running " or, from agy 1.5.8, "Run mcp__"; prompts end in "?". const ANTIGRAVITY_TOOL_TITLE = /^Run(?:ning)? (?[^\s?]+)\??$/; +// Devin titles MCP calls "Calling from " / "Called from ". +const T3_MCP_DEVIN_TITLE_CALL = + /^Call(?:ing|ed) (?[A-Za-z0-9][A-Za-z0-9_.-]*) from t3[-_ ]?code$/i; + /** ACP lacks typed MCP calls; recognize provider metadata and terminal fallback commands. */ export function extractMcpToolCallIdentity( toolCall: AcpToolCallState, @@ -1228,6 +1232,7 @@ export function extractMcpToolCallIdentity( const match = T3_MCP_TITLE_CALL.exec(name) ?? T3_MCP_TITLE_SUFFIX_CALL.exec(name) ?? + T3_MCP_DEVIN_TITLE_CALL.exec(name) ?? T3_MCP_BARE_TITLE_CALL.exec(name); const candidateTool = match?.groups?.tool; if (candidateTool !== undefined && T3_MCP_TOOL_NAMES.has(candidateTool)) { diff --git a/packages/shared/src/htmlRender.test.ts b/packages/shared/src/htmlRender.test.ts index 0f46d5487405d..652f0215114ca 100644 --- a/packages/shared/src/htmlRender.test.ts +++ b/packages/shared/src/htmlRender.test.ts @@ -164,6 +164,10 @@ describe("htmlRenderFromToolItem", () => { it("reads the reference from each provider's result envelope", () => { for (const [toolName, output] of [ ["mcp__t3-code__html_render", [{ type: "text", text: JSON.stringify(result) }]], + [ + "t3-code.html_render", + [{ type: "content", content: { type: "text", text: JSON.stringify(result) } }], + ], ["t3-code.html_render", { structuredContent: result, content: [] }], ["t3-code-thread_1_html_render", JSON.stringify(result)], ["html_render", result], diff --git a/packages/shared/src/toolOutput.test.ts b/packages/shared/src/toolOutput.test.ts index 7a5f736624da7..a4dc11fde2cab 100644 --- a/packages/shared/src/toolOutput.test.ts +++ b/packages/shared/src/toolOutput.test.ts @@ -18,6 +18,7 @@ describe("compactDynamicToolOutput", () => { { ...metadata, response: "Private response body" }, { structuredContent: JSON.parse(json), content: "Ignored alternative body" }, [{ type: "text", text: json }], + [{ type: "content", content: { type: "text", text: json } }], { content: [{ text: { text: json } }], isError: false }, json, ]) { @@ -83,6 +84,19 @@ describe("compactDynamicToolOutput", () => { { text: JSON.stringify({ threadId: "second", isError: true, error: "Private error" }) }, ]), ).toEqual({ threadId: "first", isError: true }); + expect( + compactDynamicToolOutput([ + { type: "content", content: { type: "image", data: "ignored" } }, + { type: "content", content: { type: "text", text: JSON.stringify({ threadId: "first" }) } }, + { + type: "content", + content: { + type: "text", + text: JSON.stringify({ threadId: "second", isError: true, error: "Private error" }), + }, + }, + ]), + ).toEqual({ threadId: "first", isError: true }); expect( compactDynamicToolOutput([{ text: "{}" }, { text: JSON.stringify({ threadId: "second" }) }]), ).toBeUndefined(); diff --git a/packages/shared/src/toolOutput.ts b/packages/shared/src/toolOutput.ts index d636e80351bea..38ec092e97bf5 100644 --- a/packages/shared/src/toolOutput.ts +++ b/packages/shared/src/toolOutput.ts @@ -89,7 +89,11 @@ function readResult(value: unknown, budget: ResultReadBudget, depth = 0): Result let data: ResultEnvelope["data"]; let failed = false; for (const block of value) { - const text = Predicate.isObject(block) ? block.text : undefined; + const inner = + Predicate.isObject(block) && block.type === "content" && Predicate.isObject(block.content) + ? block.content + : block; + const text = Predicate.isObject(inner) ? inner.text : undefined; const result = readResult( Predicate.isObject(text) ? (text.text ?? text) : text, budget,