fix(acp): preserve resource text source (#33524)
This commit is contained in:
@@ -99,17 +99,29 @@ describe("acp content conversion", () => {
|
||||
])
|
||||
})
|
||||
|
||||
test("resource with text becomes a text part", () => {
|
||||
test("resource with text becomes a sourced text part", () => {
|
||||
expect(
|
||||
contentBlockToParts({
|
||||
type: "resource",
|
||||
resource: {
|
||||
uri: "file:///tmp/context.txt",
|
||||
uri: "file:///tmp/context.txt#L12-L14",
|
||||
mimeType: "text/plain",
|
||||
text: "context",
|
||||
},
|
||||
}),
|
||||
).toEqual([{ type: "text", text: "context" }])
|
||||
).toEqual([{ type: "text", text: "[/tmp/context.txt:12]\ncontext" }])
|
||||
})
|
||||
|
||||
test("resource with text uses URI fallback for non-file resources", () => {
|
||||
expect(
|
||||
contentBlockToParts({
|
||||
type: "resource",
|
||||
resource: {
|
||||
uri: "mcp://server/context",
|
||||
text: "context",
|
||||
},
|
||||
}),
|
||||
).toEqual([{ type: "text", text: "[mcp://server/context]\ncontext" }])
|
||||
})
|
||||
|
||||
test("resource with blob and mimeType becomes a data URL file part", () => {
|
||||
|
||||
Reference in New Issue
Block a user