From ad8ea82611ff4db6c671f896c9dd127f49bbea2a Mon Sep 17 00:00:00 2001 From: Aiden Cline <63023139+rekram1-node@users.noreply.github.com> Date: Wed, 27 Aug 2025 17:41:24 -0500 Subject: [PATCH] add synthetic user message before bash execution (when using !) (#2283) --- packages/opencode/src/session/index.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 4a9a6785..41f85b6e 100644 --- a/packages/opencode/src/session/index.ts +++ b/packages/opencode/src/session/index.ts @@ -1035,6 +1035,25 @@ export namespace Session { export type ShellInput = z.infer export async function shell(input: ShellInput) { using abort = lock(input.sessionID) + const userMsg: MessageV2.User = { + id: Identifier.ascending("message"), + sessionID: input.sessionID, + time: { + created: Date.now(), + }, + role: "user", + } + await updateMessage(userMsg) + const userPart: MessageV2.Part = { + type: "text", + id: Identifier.ascending("part"), + messageID: userMsg.id, + sessionID: input.sessionID, + text: "The following tool was executed by the user", + synthetic: true, + } + await updatePart(userPart) + const msg: MessageV2.Assistant = { id: Identifier.ascending("message"), sessionID: input.sessionID,