|
|
@@ -122,12 +122,20 @@ function createFakeAgent() {
|
|
|
messages: async () => {
|
|
|
return { data: [] }
|
|
|
},
|
|
|
- message: async () => {
|
|
|
+ message: async (params?: any) => {
|
|
|
+ // Return a message with parts that can be looked up by partID
|
|
|
return {
|
|
|
data: {
|
|
|
info: {
|
|
|
role: "assistant",
|
|
|
},
|
|
|
+ parts: [
|
|
|
+ {
|
|
|
+ id: params?.messageID ? `${params.messageID}_part` : "part_1",
|
|
|
+ type: "text",
|
|
|
+ text: "",
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
@@ -193,7 +201,7 @@ function createFakeAgent() {
|
|
|
}
|
|
|
|
|
|
describe("acp.agent event subscription", () => {
|
|
|
- test("routes message.part.updated by the event sessionID (no cross-session pollution)", async () => {
|
|
|
+ test("routes message.part.delta by the event sessionID (no cross-session pollution)", async () => {
|
|
|
await using tmp = await tmpdir()
|
|
|
await Instance.provide({
|
|
|
directory: tmp.path,
|
|
|
@@ -207,14 +215,12 @@ describe("acp.agent event subscription", () => {
|
|
|
controller.push({
|
|
|
directory: cwd,
|
|
|
payload: {
|
|
|
- type: "message.part.updated",
|
|
|
+ type: "message.part.delta",
|
|
|
properties: {
|
|
|
- part: {
|
|
|
- sessionID: sessionB,
|
|
|
- messageID: "msg_1",
|
|
|
- type: "text",
|
|
|
- synthetic: false,
|
|
|
- },
|
|
|
+ sessionID: sessionB,
|
|
|
+ messageID: "msg_1",
|
|
|
+ partID: "msg_1_part",
|
|
|
+ field: "text",
|
|
|
delta: "hello",
|
|
|
},
|
|
|
},
|
|
|
@@ -230,7 +236,7 @@ describe("acp.agent event subscription", () => {
|
|
|
})
|
|
|
})
|
|
|
|
|
|
- test("keeps concurrent sessions isolated when message.part.updated events are interleaved", async () => {
|
|
|
+ test("keeps concurrent sessions isolated when message.part.delta events are interleaved", async () => {
|
|
|
await using tmp = await tmpdir()
|
|
|
await Instance.provide({
|
|
|
directory: tmp.path,
|
|
|
@@ -248,14 +254,12 @@ describe("acp.agent event subscription", () => {
|
|
|
controller.push({
|
|
|
directory: cwd,
|
|
|
payload: {
|
|
|
- type: "message.part.updated",
|
|
|
+ type: "message.part.delta",
|
|
|
properties: {
|
|
|
- part: {
|
|
|
- sessionID: sessionId,
|
|
|
- messageID,
|
|
|
- type: "text",
|
|
|
- synthetic: false,
|
|
|
- },
|
|
|
+ sessionID: sessionId,
|
|
|
+ messageID,
|
|
|
+ partID: `${messageID}_part`,
|
|
|
+ field: "text",
|
|
|
delta,
|
|
|
},
|
|
|
},
|
|
|
@@ -402,14 +406,12 @@ describe("acp.agent event subscription", () => {
|
|
|
controller.push({
|
|
|
directory: cwd,
|
|
|
payload: {
|
|
|
- type: "message.part.updated",
|
|
|
+ type: "message.part.delta",
|
|
|
properties: {
|
|
|
- part: {
|
|
|
- sessionID: sessionB,
|
|
|
- messageID: "msg_b",
|
|
|
- type: "text",
|
|
|
- synthetic: false,
|
|
|
- },
|
|
|
+ sessionID: sessionB,
|
|
|
+ messageID: "msg_b",
|
|
|
+ partID: "msg_b_part",
|
|
|
+ field: "text",
|
|
|
delta: "session_b_message",
|
|
|
},
|
|
|
},
|