diff options
| author | Aiden Cline <[email protected]> | 2025-08-27 17:41:24 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-27 17:41:24 -0500 |
| commit | ad8ea82611ff4db6c671f896c9dd127f49bbea2a (patch) | |
| tree | 4c01113584e7acb57481f8b56b953b2308fcc2f3 | |
| parent | d984dbd8768d30f46e7206c86a202d7acb2c1bc3 (diff) | |
| download | opencode-ad8ea82611ff4db6c671f896c9dd127f49bbea2a.tar.gz opencode-ad8ea82611ff4db6c671f896c9dd127f49bbea2a.zip | |
add synthetic user message before bash execution (when using !) (#2283)
| -rw-r--r-- | packages/opencode/src/session/index.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/packages/opencode/src/session/index.ts b/packages/opencode/src/session/index.ts index 4a9a6785d..41f85b6ea 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<typeof ShellInput> 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, |
