|
|
@@ -266,6 +266,14 @@ const resourceNoLLMServer = testEffect(
|
|
|
blob: Buffer.from("MCP text blob fixture").toString("base64"),
|
|
|
},
|
|
|
]
|
|
|
+ : uri === "opencode-fixture://binary"
|
|
|
+ ? [
|
|
|
+ {
|
|
|
+ uri,
|
|
|
+ mimeType: "application/octet-stream",
|
|
|
+ blob: "AAEC",
|
|
|
+ },
|
|
|
+ ]
|
|
|
: [
|
|
|
{
|
|
|
uri,
|
|
|
@@ -2095,6 +2103,18 @@ resourceNoLLMServer.instance(
|
|
|
text: { value: "@fixture-text-blob", start: 15, end: 33 },
|
|
|
},
|
|
|
},
|
|
|
+ {
|
|
|
+ type: "file",
|
|
|
+ mime: "application/octet-stream",
|
|
|
+ url: "opencode-fixture://binary",
|
|
|
+ filename: "fixture-binary",
|
|
|
+ source: {
|
|
|
+ type: "resource",
|
|
|
+ clientName: "resource-only-fixture",
|
|
|
+ uri: "opencode-fixture://binary",
|
|
|
+ text: { value: "@fixture-binary", start: 34, end: 49 },
|
|
|
+ },
|
|
|
+ },
|
|
|
{
|
|
|
type: "file",
|
|
|
mime: "image/png",
|
|
|
@@ -2112,6 +2132,11 @@ resourceNoLLMServer.instance(
|
|
|
|
|
|
expect(message.parts.some((part) => part.type === "text" && part.text === "# MCP resource fixture")).toBe(true)
|
|
|
expect(message.parts.some((part) => part.type === "text" && part.text === "MCP text blob fixture")).toBe(true)
|
|
|
+ expect(
|
|
|
+ message.parts.some(
|
|
|
+ (part) => part.type === "text" && part.text === "[Binary content: application/octet-stream]",
|
|
|
+ ),
|
|
|
+ ).toBe(true)
|
|
|
expect(
|
|
|
message.parts.some(
|
|
|
(part) =>
|
|
|
@@ -2121,6 +2146,15 @@ resourceNoLLMServer.instance(
|
|
|
part.url.startsWith("data:text/plain; charset=utf-8;base64,"),
|
|
|
),
|
|
|
).toBe(true)
|
|
|
+ expect(
|
|
|
+ message.parts.some(
|
|
|
+ (part) =>
|
|
|
+ part.type === "file" &&
|
|
|
+ part.source?.type === "resource" &&
|
|
|
+ part.mime === "application/octet-stream" &&
|
|
|
+ part.url.startsWith("data:application/octet-stream;base64,"),
|
|
|
+ ),
|
|
|
+ ).toBe(true)
|
|
|
expect(
|
|
|
message.parts.some(
|
|
|
(part) => part.type === "file" && part.source?.type === "resource" && part.url === "opencode-fixture://pixel",
|