Skip to content

Commit da38dd1

Browse files
fix(mcp): support Antigravity image attachments
1 parent 46d328d commit da38dd1

3 files changed

Lines changed: 100 additions & 0 deletions

File tree

‎apps/server/src/mcp/OrchestratorMcpService.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ function providerAttachmentKinds(provider: ServerProvider): ReadonlyArray<"image
175175
case "claudeAgent":
176176
case "cursor":
177177
case "grok":
178+
case "antigravity":
178179
return ["image"];
179180
case "opencode":
180181
return ["image", "file"];

‎apps/server/src/mcp/OrchestratorMcpToolkit.integration.test.ts‎

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ import { HttpBody, HttpClient, HttpRouter } from "effect/unstable/http";
5454

5555
import * as ServerSecretStore from "../auth/ServerSecretStore.ts";
5656
import { attachmentUploadRouteLayer } from "../http.ts";
57+
import { AntigravityProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/AntigravityAdapterV2.ts";
5758
import { ClaudeProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/ClaudeAdapterV2.ts";
5859
import { CodexProviderCapabilitiesV2 } from "../orchestration-v2/Adapters/CodexAdapterV2.ts";
5960
import { CodexOrchestratorReplayHarness } from "../orchestration-v2/Adapters/CodexAdapterV2.testkit.ts";
@@ -94,8 +95,10 @@ const parentThreadId = ThreadId.make("thread:mcp-orchestrator-parent");
9495
const projectId = ProjectId.make("project:mcp-orchestrator");
9596
const codexInstanceId = ProviderInstanceId.make("codex");
9697
const claudeInstanceId = ProviderInstanceId.make("claudeAgent");
98+
const antigravityInstanceId = ProviderInstanceId.make("antigravity");
9799
const codexModel = "gpt-5.4";
98100
const claudeModel = "claude-sonnet-4-6";
101+
const antigravityModel = "gemini-3-pro";
99102
const parentPrompt = "Keep this parent turn active while orchestration tools are tested.";
100103
const delegatedPrompt = "Inspect the delegated API boundary and return the result.";
101104
const delegatedResult = "Delegated API boundary inspected.";
@@ -522,6 +525,14 @@ describe("orchestrator MCP toolkit", () => {
522525
? delegatedResult
523526
: `Claude completed: ${turn.message.text}`,
524527
}),
528+
makeDeterministicAdapter({
529+
instanceId: antigravityInstanceId,
530+
driver: ProviderDriverKind.make("antigravity"),
531+
capabilities: AntigravityProviderCapabilitiesV2,
532+
capturedTurns,
533+
shouldComplete: () => true,
534+
response: (turn) => `Antigravity completed: ${turn.message.text}`,
535+
}),
525536
]);
526537
// Captures parent-wake offers made when a delegated child
527538
// terminalizes after the parent run settled.
@@ -602,6 +613,11 @@ describe("orchestrator MCP toolkit", () => {
602613
driver: ProviderDriverKind.make("opencode"),
603614
model: "opencode/test",
604615
}),
616+
makeProviderSnapshot({
617+
instanceId: antigravityInstanceId,
618+
driver: ProviderDriverKind.make("antigravity"),
619+
model: antigravityModel,
620+
}),
605621
]);
606622
// In-memory ScheduledTaskService stub so the schedule/list/update/
607623
// delete tools can be exercised without SQL/launch wiring.
@@ -1257,6 +1273,10 @@ describe("orchestrator MCP toolkit", () => {
12571273
canRunChildTask: true,
12581274
attachmentKinds: ["image", "file"],
12591275
}),
1276+
expect.objectContaining({
1277+
providerInstanceId: antigravityInstanceId,
1278+
attachmentKinds: ["image"],
1279+
}),
12601280
// Models advertise their option descriptors so agents can
12611281
// discover valid target.options ids and values.
12621282
expect.objectContaining({
@@ -1829,6 +1849,62 @@ describe("orchestrator MCP toolkit", () => {
18291849
).toHaveLength(2);
18301850

18311851
const serverConfig = yield* ServerConfig.ServerConfig;
1852+
const antigravityThreadId = ThreadId.make("thread:mcp-antigravity-attachments");
1853+
yield* orchestrator.dispatch({
1854+
type: "thread.create",
1855+
createdBy: "user",
1856+
creationSource: "web",
1857+
commandId: CommandId.make("command:mcp-antigravity-attachments:create"),
1858+
threadId: antigravityThreadId,
1859+
projectId,
1860+
title: "Antigravity attachment thread",
1861+
modelSelection: {
1862+
instanceId: antigravityInstanceId,
1863+
model: antigravityModel,
1864+
},
1865+
runtimeMode: "full-access",
1866+
interactionMode: "default",
1867+
branch: null,
1868+
worktreePath: cwd,
1869+
});
1870+
const antigravityPendingId = createPendingAttachmentId();
1871+
if (antigravityPendingId === null) {
1872+
return yield* Effect.die("Expected an Antigravity pending attachment id.");
1873+
}
1874+
const antigravityImage = {
1875+
type: "image",
1876+
id: ChatAttachmentId.make(antigravityPendingId),
1877+
name: "prompt.gif",
1878+
mimeType: "image/gif",
1879+
sizeBytes: 4,
1880+
} as const;
1881+
NodeFS.writeFileSync(
1882+
NodePath.join(serverConfig.attachmentsDir, `${antigravityPendingId}.gif`),
1883+
Buffer.from("test"),
1884+
);
1885+
const antigravitySend = yield* decodeThreadSendResult(
1886+
(yield* invoke("t3_thread_send", {
1887+
threadId: antigravityThreadId,
1888+
message: "Inspect this image.",
1889+
attachments: [antigravityImage],
1890+
clientRequestId: "attachment-antigravity-image-1",
1891+
})).structuredContent,
1892+
).pipe(Effect.orDie);
1893+
const antigravityWait = yield* decodeThreadWaitResult(
1894+
(yield* invoke("t3_thread_wait", {
1895+
threadId: antigravityThreadId,
1896+
runId: antigravitySend.runId,
1897+
timeoutMs: 5_000,
1898+
})).structuredContent,
1899+
).pipe(Effect.orDie);
1900+
expect(antigravityWait.timedOut).toBe(false);
1901+
expect(
1902+
(yield* Ref.get(capturedTurns)).find((turn) => turn.threadId === antigravityThreadId),
1903+
).toMatchObject({
1904+
instanceId: antigravityInstanceId,
1905+
attachments: [expect.objectContaining({ type: "image", mimeType: "image/gif" })],
1906+
});
1907+
18321908
const unsupportedPendingId = createPendingAttachmentId();
18331909
if (unsupportedPendingId === null) {
18341910
return yield* Effect.die("Expected a pending attachment id.");
@@ -1847,6 +1923,24 @@ describe("orchestrator MCP toolkit", () => {
18471923
const claimedBeforeUnsupported = NodeFS.readdirSync(serverConfig.attachmentsDir).filter(
18481924
(entry) => !entry.startsWith("pending-"),
18491925
);
1926+
const unsupportedAntigravitySend = yield* invoke("t3_thread_send", {
1927+
threadId: antigravityThreadId,
1928+
attachments: [unsupportedFile],
1929+
clientRequestId: "attachment-antigravity-file-rejected-1",
1930+
});
1931+
expect(unsupportedAntigravitySend.structuredContent).toMatchObject({
1932+
code: "invalid_request",
1933+
});
1934+
expect(
1935+
NodeFS.existsSync(
1936+
NodePath.join(serverConfig.attachmentsDir, `${unsupportedPendingId}.txt`),
1937+
),
1938+
).toBe(true);
1939+
expect(
1940+
NodeFS.readdirSync(serverConfig.attachmentsDir).filter(
1941+
(entry) => !entry.startsWith("pending-"),
1942+
),
1943+
).toEqual(claimedBeforeUnsupported);
18501944
const unsupportedSend = yield* invoke("t3_thread_send", {
18511945
threadId: emptyThread.threadId,
18521946
attachments: [unsupportedFile],
@@ -3084,11 +3178,15 @@ describe("orchestrator MCP toolkit", () => {
30843178
model: codexModel,
30853179
}),
30863180
]);
3181+
const serverConfigLayer = ServerConfig.layerTest(cwd, {
3182+
prefix: "t3-mcp-delegated-task-status-",
3183+
}).pipe(Layer.provide(NodeServices.layer));
30873184
const testLayer = McpHttpServer.OrchestratorToolkitRegistrationLive.pipe(
30883185
Layer.provideMerge(McpServer.McpServer.layer),
30893186
Layer.provideMerge(orchestrationLayer),
30903187
Layer.provide(providerRegistryLayer),
30913188
Layer.provide(unusedScheduledTaskStubLayer),
3189+
Layer.provideMerge(serverConfigLayer),
30923190
Layer.provide(NodeServices.layer),
30933191
);
30943192

‎apps/server/src/relay/AgentAwarenessRelay.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ const makeTestRelay = Effect.fnUntraced(function* (
126126
getShellSnapshot: unused,
127127
ensureLegacyTranscript: unused,
128128
dispatch: unused,
129+
getCommandReceipt: unused,
129130
getThreadProjection: unused,
130131
getCheckpointContext: unused,
131132
getThreadSnapshot: unused,

0 commit comments

Comments
 (0)