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
Noam Bressler 2026-04-02 20:56:56 +03:00 committed by GitHub
parent f0a9ebfed4
commit 1989704abe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 27 additions and 5 deletions

View File

@ -306,7 +306,7 @@
"dependencies": {
"@actions/core": "1.11.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/anthropic": "3.0.64",
"@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=="],
"@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=="],

View File

@ -69,7 +69,7 @@
"dependencies": {
"@actions/core": "1.11.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/anthropic": "3.0.64",
"@ai-sdk/azure": "3.0.49",

View File

@ -449,6 +449,19 @@ export namespace ACP {
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
}
@ -484,6 +497,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: "agent_message_chunk",
messageId: props.messageID,
content: {
type: "text",
text: props.delta,
@ -502,6 +516,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: "agent_thought_chunk",
messageId: props.messageID,
content: {
type: "text",
text: props.delta,
@ -666,7 +681,7 @@ export namespace ACP {
}
}
async unstable_listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse> {
async listSessions(params: ListSessionsRequest): Promise<ListSessionsResponse> {
try {
const cursor = params.cursor ? Number(params.cursor) : undefined
const limit = 100
@ -970,6 +985,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: message.info.role === "user" ? "user_message_chunk" : "agent_message_chunk",
messageId: message.info.id,
content: {
type: "text",
text: part.text,
@ -1001,6 +1017,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: messageChunk,
messageId: message.info.id,
content: { type: "resource_link", uri: url, name: filename, mimeType: mime },
},
})
@ -1022,6 +1039,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: messageChunk,
messageId: message.info.id,
content: {
type: "image",
mimeType: effectiveMime,
@ -1050,6 +1068,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: messageChunk,
messageId: message.info.id,
content: { type: "resource", resource },
},
})
@ -1066,6 +1085,7 @@ export namespace ACP {
sessionId,
update: {
sessionUpdate: "agent_thought_chunk",
messageId: message.info.id,
content: {
type: "text",
text: part.text,

File diff suppressed because one or more lines are too long

View File

@ -35,7 +35,7 @@ describe("acp.agent interface compliance", () => {
"setSessionMode",
"authenticate",
// Unstable - SDK checks these with unstable_ prefix
"unstable_listSessions",
"listSessions",
"unstable_forkSession",
"unstable_resumeSession",
"unstable_setSessionModel",