fix(acp): preserve resource text source (#33524)
This commit is contained in:
parent
a3825286cf
commit
8e2d422ffe
2 changed files with 29 additions and 5 deletions
|
|
@ -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", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue