summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNoam Bressler <[email protected]>2026-01-20 18:11:02 +0200
committerGitHub <[email protected]>2026-01-20 10:11:02 -0600
commite8b0a65c6301903956476e590d9976a33253e138 (patch)
treee0d4353738c75134cfd03d4e272ef265e06b1391
parentcd2125eecdd2a4c9ba80000b79c60364f3b729f6 (diff)
downloadopencode-e8b0a65c6301903956476e590d9976a33253e138.tar.gz
opencode-e8b0a65c6301903956476e590d9976a33253e138.zip
feat: Support ACP audience by mapping to ignore and synthetic (#9593)
Co-authored-by: noam-v <[email protected]>
-rw-r--r--packages/opencode/src/acp/agent.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/packages/opencode/src/acp/agent.ts b/packages/opencode/src/acp/agent.ts
index 6330fae97..9d05a6793 100644
--- a/packages/opencode/src/acp/agent.ts
+++ b/packages/opencode/src/acp/agent.ts
@@ -12,6 +12,7 @@ import {
type PermissionOption,
type PlanEntry,
type PromptRequest,
+ type Role,
type SetSessionModelRequest,
type SetSessionModeRequest,
type SetSessionModeResponse,
@@ -687,7 +688,12 @@ export namespace ACP {
break
}
} else if (part.type === "text") {
- if (part.text && !part.ignored) {
+ if (part.text) {
+ const audience: Role[] | undefined = part.synthetic
+ ? ["assistant"]
+ : part.ignored
+ ? ["user"]
+ : undefined
await this.connection
.sessionUpdate({
sessionId,
@@ -696,6 +702,7 @@ export namespace ACP {
content: {
type: "text",
text: part.text,
+ ...(audience && { annotations: { audience } }),
},
},
})
@@ -968,14 +975,19 @@ export namespace ACP {
const agent = session.modeId ?? (await AgentModule.defaultAgent())
const parts: Array<
- { type: "text"; text: string } | { type: "file"; url: string; filename: string; mime: string }
+ { type: "text"; text: string; synthetic?: boolean; ignored?: boolean } | { type: "file"; url: string; filename: string; mime: string }
> = []
for (const part of params.prompt) {
switch (part.type) {
case "text":
+ const audience = part.annotations?.audience
+ const forAssistant = audience?.length === 1 && audience[0] === "assistant"
+ const forUser = audience?.length === 1 && audience[0] === "user"
parts.push({
type: "text" as const,
text: part.text,
+ ...(forAssistant && { synthetic: true }),
+ ...(forUser && { ignored: true }),
})
break
case "image": {