Skip to content

Commit 1aa18c6

Browse files
authored
feat(plugin): pass sessionID and callID to shell.env hook input (anomalyco#13662)
1 parent de25703 commit 1aa18c6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

packages/opencode/src/session/prompt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1618,7 +1618,7 @@ NOTE: At any point in time through this workflow you should feel free to ask the
16181618
const args = matchingInvocation?.args
16191619

16201620
const cwd = Instance.directory
1621-
const shellEnv = await Plugin.trigger("shell.env", { cwd }, { env: {} })
1621+
const shellEnv = await Plugin.trigger("shell.env", { cwd, sessionID: input.sessionID, callID: part.callID }, { env: {} })
16221622
const proc = spawn(shell, args, {
16231623
cwd,
16241624
detached: process.platform !== "win32",

packages/opencode/src/tool/bash.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ export const BashTool = Tool.define("bash", async () => {
163163
})
164164
}
165165

166-
const shellEnv = await Plugin.trigger("shell.env", { cwd }, { env: {} })
166+
const shellEnv = await Plugin.trigger("shell.env", { cwd, sessionID: ctx.sessionID, callID: ctx.callID }, { env: {} })
167167
const proc = spawn(params.command, {
168168
shell,
169169
cwd,

packages/plugin/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ export interface Hooks {
185185
input: { tool: string; sessionID: string; callID: string },
186186
output: { args: any },
187187
) => Promise<void>
188-
"shell.env"?: (input: { cwd: string }, output: { env: Record<string, string> }) => Promise<void>
188+
"shell.env"?: (
189+
input: { cwd: string; sessionID?: string; callID?: string },
190+
output: { env: Record<string, string> },
191+
) => Promise<void>
189192
"tool.execute.after"?: (
190193
input: { tool: string; sessionID: string; callID: string; args: any },
191194
output: {

0 commit comments

Comments
 (0)