summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorHelge Tesdal <[email protected]>2026-02-18 21:14:18 +0100
committerGitHub <[email protected]>2026-02-18 14:14:18 -0600
commit1aa18c6cd64412db89ccfb58c2641ab3e49233e4 (patch)
tree986296ee868076a65cbbb2a9f546ab94039a3fca
parentde25703e9dd33df4dff6b5b8ae9a722f6ca2aa81 (diff)
downloadopencode-1aa18c6cd64412db89ccfb58c2641ab3e49233e4.tar.gz
opencode-1aa18c6cd64412db89ccfb58c2641ab3e49233e4.zip
feat(plugin): pass sessionID and callID to shell.env hook input (#13662)
-rw-r--r--packages/opencode/src/session/prompt.ts2
-rw-r--r--packages/opencode/src/tool/bash.ts2
-rw-r--r--packages/plugin/src/index.ts5
3 files changed, 6 insertions, 3 deletions
diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts
index 43ad9a09d..c99eb72a7 100644
--- a/packages/opencode/src/session/prompt.ts
+++ b/packages/opencode/src/session/prompt.ts
@@ -1618,7 +1618,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
const args = matchingInvocation?.args
const cwd = Instance.directory
- const shellEnv = await Plugin.trigger("shell.env", { cwd }, { env: {} })
+ const shellEnv = await Plugin.trigger("shell.env", { cwd, sessionID: input.sessionID, callID: part.callID }, { env: {} })
const proc = spawn(shell, args, {
cwd,
detached: process.platform !== "win32",
diff --git a/packages/opencode/src/tool/bash.ts b/packages/opencode/src/tool/bash.ts
index 67559b78c..2b692db6e 100644
--- a/packages/opencode/src/tool/bash.ts
+++ b/packages/opencode/src/tool/bash.ts
@@ -163,7 +163,7 @@ export const BashTool = Tool.define("bash", async () => {
})
}
- const shellEnv = await Plugin.trigger("shell.env", { cwd }, { env: {} })
+ const shellEnv = await Plugin.trigger("shell.env", { cwd, sessionID: ctx.sessionID, callID: ctx.callID }, { env: {} })
const proc = spawn(params.command, {
shell,
cwd,
diff --git a/packages/plugin/src/index.ts b/packages/plugin/src/index.ts
index bd4ba5304..76370d1d5 100644
--- a/packages/plugin/src/index.ts
+++ b/packages/plugin/src/index.ts
@@ -185,7 +185,10 @@ export interface Hooks {
input: { tool: string; sessionID: string; callID: string },
output: { args: any },
) => Promise<void>
- "shell.env"?: (input: { cwd: string }, output: { env: Record<string, string> }) => Promise<void>
+ "shell.env"?: (
+ input: { cwd: string; sessionID?: string; callID?: string },
+ output: { env: Record<string, string> },
+ ) => Promise<void>
"tool.execute.after"?: (
input: { tool: string; sessionID: string; callID: string; args: any },
output: {