feat(acp): Add messageID and emit user_message_chunk on prompt/command (#18625)
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>pull/20634/head
parent
f0a9ebfed4
commit
1989704abe
4
bun.lock
4
bun.lock
|
|
@ -306,7 +306,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.11.1",
|
"@actions/core": "1.11.1",
|
||||||
"@actions/github": "6.0.1",
|
"@actions/github": "6.0.1",
|
||||||
"@agentclientprotocol/sdk": "0.14.1",
|
"@agentclientprotocol/sdk": "0.16.1",
|
||||||
"@ai-sdk/amazon-bedrock": "4.0.83",
|
"@ai-sdk/amazon-bedrock": "4.0.83",
|
||||||
"@ai-sdk/anthropic": "3.0.64",
|
"@ai-sdk/anthropic": "3.0.64",
|
||||||
"@ai-sdk/azure": "3.0.49",
|
"@ai-sdk/azure": "3.0.49",
|
||||||
|
|
@ -680,7 +680,7 @@
|
||||||
|
|
||||||
"@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="],
|
"@adobe/css-tools": ["@adobe/css-tools@4.4.4", "", {}, "sha512-Elp+iwUx5rN5+Y8xLt5/GRoG20WGoDCQ/1Fb+1LiGtvwbDavuSk0jhD/eZdckHAuzcDzccnkv+rEjyWfRx18gg=="],
|
||||||
|
|
||||||
"@agentclientprotocol/sdk": ["@agentclientprotocol/sdk@0.14.1", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-b6r3PS3Nly+Wyw9U+0nOr47bV8tfS476EgyEMhoKvJCZLbgqoDFN7DJwkxL88RR0aiOqOYV1ZnESHqb+RmdH8w=="],
|
"@agentclientprotocol/sdk": ["@agentclientprotocol/sdk@0.16.1", "", { "peerDependencies": { "zod": "^3.25.0 || ^4.0.0" } }, "sha512-1ad+Sc/0sCtZGHthxxvgEUo5Wsbw16I+aF+YwdiLnPwkZG8KAGUEAPK6LM6Pf69lCyJPt1Aomk1d+8oE3C4ZEw=="],
|
||||||
|
|
||||||
"@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@4.0.83", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.64", "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.21", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-DoRpvIWGU/r83UeJAM9L93Lca8Kf/yP5fIhfEOltMPGP/PXrGe0BZaz0maLSRn8djJ6+HzWIsgu5ZI6bZqXEXg=="],
|
"@ai-sdk/amazon-bedrock": ["@ai-sdk/amazon-bedrock@4.0.83", "", { "dependencies": { "@ai-sdk/anthropic": "3.0.64", "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.21", "@smithy/eventstream-codec": "^4.0.1", "@smithy/util-utf8": "^4.0.0", "aws4fetch": "^1.0.20" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-DoRpvIWGU/r83UeJAM9L93Lca8Kf/yP5fIhfEOltMPGP/PXrGe0BZaz0maLSRn8djJ6+HzWIsgu5ZI6bZqXEXg=="],
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.11.1",
|
"@actions/core": "1.11.1",
|
||||||
"@actions/github": "6.0.1",
|
"@actions/github": "6.0.1",
|
||||||
"@agentclientprotocol/sdk": "0.14.1",
|
"@agentclientprotocol/sdk": "0.16.1",
|
||||||
"@ai-sdk/amazon-bedrock": "4.0.83",
|
"@ai-sdk/amazon-bedrock": "4.0.83",
|
||||||
"@ai-sdk/anthropic": "3.0.64",
|
"@ai-sdk/anthropic": "3.0.64",
|
||||||
"@ai-sdk/azure": "3.0.49",
|
"@ai-sdk/azure": "3.0.49",
|
||||||
|
|
|
||||||
|
|
@ -449,6 +449,19 @@ export namespace ACP {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (part.type !== "text" && part.type !== "file") return
|
||||||
|
const msg = await this.sdk.session
|
||||||
|
.message(
|
||||||
|
{ sessionID: part.sessionID, messageID: part.messageID, directory: session.cwd },
|
||||||
|
{ throwOnError: true },
|
||||||
|
)
|
||||||
|
.then((x) => x.data)
|
||||||
|
.catch((err) => {
|
||||||
|
log.error("failed to fetch message for user chunk", { error: err })
|
||||||
|
return undefined
|
||||||
|
})
|
||||||
|
if (!msg || msg.info.role !== "user") return
|
||||||
|
await this.processMessage({ info: msg.info, parts: [part] })
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,6 +497,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: "agent_message_chunk",
|
sessionUpdate: "agent_message_chunk",
|
||||||
|
messageId: props.messageID,
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: props.delta,
|
text: props.delta,
|
||||||
|
|
@ -502,6 +516,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: "agent_thought_chunk",
|
sessionUpdate: "agent_thought_chunk",
|
||||||
|
messageId: props.messageID,
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: props.delta,
|
text: props.delta,
|
||||||
|
|
@ -666,7 +681,7 @@ export namespace ACP {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async unstable_listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse> {
|
async listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse> {
|
||||||
try {
|
try {
|
||||||
const cursor = params.cursor ? Number(params.cursor) : undefined
|
const cursor = params.cursor ? Number(params.cursor) : undefined
|
||||||
const limit = 100
|
const limit = 100
|
||||||
|
|
@ -970,6 +985,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: message.info.role === "user" ? "user_message_chunk" : "agent_message_chunk",
|
sessionUpdate: message.info.role === "user" ? "user_message_chunk" : "agent_message_chunk",
|
||||||
|
messageId: message.info.id,
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: part.text,
|
text: part.text,
|
||||||
|
|
@ -1001,6 +1017,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: messageChunk,
|
sessionUpdate: messageChunk,
|
||||||
|
messageId: message.info.id,
|
||||||
content: { type: "resource_link", uri: url, name: filename, mimeType: mime },
|
content: { type: "resource_link", uri: url, name: filename, mimeType: mime },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
@ -1022,6 +1039,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: messageChunk,
|
sessionUpdate: messageChunk,
|
||||||
|
messageId: message.info.id,
|
||||||
content: {
|
content: {
|
||||||
type: "image",
|
type: "image",
|
||||||
mimeType: effectiveMime,
|
mimeType: effectiveMime,
|
||||||
|
|
@ -1050,6 +1068,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: messageChunk,
|
sessionUpdate: messageChunk,
|
||||||
|
messageId: message.info.id,
|
||||||
content: { type: "resource", resource },
|
content: { type: "resource", resource },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
@ -1066,6 +1085,7 @@ export namespace ACP {
|
||||||
sessionId,
|
sessionId,
|
||||||
update: {
|
update: {
|
||||||
sessionUpdate: "agent_thought_chunk",
|
sessionUpdate: "agent_thought_chunk",
|
||||||
|
messageId: message.info.id,
|
||||||
content: {
|
content: {
|
||||||
type: "text",
|
type: "text",
|
||||||
text: part.text,
|
text: part.text,
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -35,7 +35,7 @@ describe("acp.agent interface compliance", () => {
|
||||||
"setSessionMode",
|
"setSessionMode",
|
||||||
"authenticate",
|
"authenticate",
|
||||||
// Unstable - SDK checks these with unstable_ prefix
|
// Unstable - SDK checks these with unstable_ prefix
|
||||||
"unstable_listSessions",
|
"listSessions",
|
||||||
"unstable_forkSession",
|
"unstable_forkSession",
|
||||||
"unstable_resumeSession",
|
"unstable_resumeSession",
|
||||||
"unstable_setSessionModel",
|
"unstable_setSessionModel",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue