Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,11 @@ describe("AntigravityAdapterV2 html_render pages", () => {
const report = { html: `<table>${rows.join("")}</table>`, title: "Revenue", height: 240 };
const failed = { ...report, html: "<p>Revenue</p>" };
const errored = { ...report, html: "<p>Revenue error</p>" };
const telemetry = {
html: `<ul>${rows.join("").replaceAll("tr", "li")}</ul>`,
title: "Telemetry",
height: 411,
};
const adapter = yield* makeAntigravityAdapterV2({
instanceId,
selfInvocation: yield* resolveSelfInvocation(),
Expand Down Expand Up @@ -730,6 +735,21 @@ describe("AntigravityAdapterV2 html_render pages", () => {
status: "completed",
rawOutput: "Summary of published",
});
// agy 1.5.8 titles the call with its MCP name and completes without any output.
yield* send({
sessionUpdate: "tool_call",
toolCallId: "agy-1.5.8",
title: "Run mcp_t3-code_html_render",
kind: "other",
status: "in_progress",
rawInput: { ...telemetry, toolSummary: "Render telemetry" },
});
yield* mcpSessions.recordHtmlRender(threadId, telemetry, page("agy-1.5.8"));
yield* send({
sessionUpdate: "tool_call_update",
toolCallId: "agy-1.5.8",
status: "completed",
});
return { stopReason: "end_turn" as const };
}),
})),
Expand Down Expand Up @@ -855,7 +875,7 @@ describe("AntigravityAdapterV2 html_render pages", () => {
),
[page("report"), page("report"), page("replacement"), page("replacement")],
);
for (const name of ["failed-retry", "error-retry"]) {
for (const name of ["failed-retry", "error-retry", "agy-1.5.8"]) {
assert.deepEqual(tool(name), {
status: "completed",
toolName: "t3-code.html_render",
Expand All @@ -866,6 +886,7 @@ describe("AntigravityAdapterV2 html_render pages", () => {
assert.strictEqual(yield* mcpSessions.takeHtmlRender(threadId, report), undefined);
assert.strictEqual(yield* mcpSessions.takeHtmlRender(threadId, failed), undefined);
assert.strictEqual(yield* mcpSessions.takeHtmlRender(threadId, errored), undefined);
assert.strictEqual(yield* mcpSessions.takeHtmlRender(threadId, telemetry), undefined);
}).pipe(Effect.provide(layerSession)),
);
});
Expand Down
11 changes: 10 additions & 1 deletion packages/provider-acp/src/server/runtimeModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1395,6 +1395,10 @@ describe("extractMcpToolCallIdentity", () => {
// Kimi retitles with partial JSON and middle-truncates args over 50 characters.
'delegate_task: {"mode":"async","task":"Ru',
'delegate_task: {"mode":"async","task":"Ru...cho child-result-42\'"}',
// Antigravity: "Running <tool>" before agy 1.5.8, "Run mcp_<server>_<tool>" since, "?" on prompts.
"Running delegate_task",
"Run mcp_t3-code_delegate_task",
"Run mcp_t3-code_delegate_task?",
]) {
const toolCall = toolCallFromUpdate({
sessionUpdate: "tool_call",
Expand Down Expand Up @@ -1612,7 +1616,12 @@ describe("extractMcpToolCallIdentity", () => {
});

it("does not brand path-like or unknown-tool titles", () => {
for (const title of ["t3-code/README.md", "t3-code_not_a_real_tool"]) {
for (const title of [
"t3-code/README.md",
"t3-code_not_a_real_tool",
"Run mcp_t3-code_not_a_real_tool",
"Run manage_task",
]) {
const toolCall = toolCallFromUpdate({
sessionUpdate: "tool_call",
toolCallId: "path-1",
Expand Down
18 changes: 11 additions & 7 deletions packages/provider-acp/src/server/runtimeModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1088,11 +1088,14 @@ const T3_MCP_TITLE_SUFFIX_CALL =
/^(?<tool>[A-Za-z0-9][A-Za-z0-9_.-]*?)(?: \(t3[-_ ]?code MCP Server\)(?::|$)|[-_.]t3[-_ ]?code$)/i;

/**
* glm and Kimi use bare names; Antigravity uses "Running <tool>". Kimi appends
* streamed JSON arguments. Require a name or JSON opening brace so built-ins
* titled "<tool>: <description>" cannot impersonate an inventory entry.
* glm and Kimi use bare names. Kimi appends streamed JSON arguments. Require a
* name or JSON opening brace so built-ins titled "<tool>: <description>" cannot
* impersonate an inventory entry.
*/
const T3_MCP_BARE_TITLE_CALL = /^(?:Running )?(?<tool>[A-Za-z0-9_]+)(?::\s*\{|$)/;
const T3_MCP_BARE_TITLE_CALL = /^(?<tool>[A-Za-z0-9_]+)(?::\s*\{|$)/;

// Antigravity titles calls "Running <tool>" or, from agy 1.5.8, "Run mcp_<server>_<tool>"; prompts end in "?".
const ANTIGRAVITY_TOOL_TITLE = /^Run(?:ning)? (?<name>[^\s?]+)\??$/;

/** ACP lacks typed MCP calls; recognize provider metadata and terminal fallback commands. */
export function extractMcpToolCallIdentity(
Expand Down Expand Up @@ -1185,10 +1188,11 @@ export function extractMcpToolCallIdentity(
}
if (qualified?.[1] && qualified[2] && !/^t3[-_ ]?code$/i.test(qualified[1]))
return { server: qualified[1], tool: qualified[2] };
const name = ANTIGRAVITY_TOOL_TITLE.exec(trimmed)?.groups?.name ?? trimmed;
const match =
T3_MCP_TITLE_CALL.exec(trimmed) ??
T3_MCP_TITLE_SUFFIX_CALL.exec(trimmed) ??
T3_MCP_BARE_TITLE_CALL.exec(trimmed);
T3_MCP_TITLE_CALL.exec(name) ??
T3_MCP_TITLE_SUFFIX_CALL.exec(name) ??
T3_MCP_BARE_TITLE_CALL.exec(name);
const candidateTool = match?.groups?.tool;
if (candidateTool !== undefined && T3_MCP_TOOL_NAMES.has(candidateTool)) {
return { server: "t3-code", tool: candidateTool };
Expand Down
Loading