Feature hasn't been suggested before.
Describe the enhancement you want to request
The shell.env hook currently receives only { cwd: string } as input. Unlike tool.execute.before and tool.execute.after, which both receive sessionID and callID, shell.env has no way to identify which tool invocation triggered it.
Proposed change: Add optional sessionID and callID fields to the shell.env input:
"shell.env"?: (
input: { cwd: string; sessionID?: string; callID?: string },
output: { env: Record<string, string> },
) => Promise<void>
The fields are optional because the PTY call site (pty/index.ts) has no session context. The two tool-related call sites (bash.ts, prompt.ts) already have both values in scope.
This is the same pattern used when sessionID was added to chat.system.transform (#7718) and args was added to tool.execute.after (56ad2db). Additive, non-breaking, backward-compatible.
Feature hasn't been suggested before.
Describe the enhancement you want to request
The
shell.envhook currently receives only{ cwd: string }as input. Unliketool.execute.beforeandtool.execute.after, which both receivesessionIDandcallID,shell.envhas no way to identify which tool invocation triggered it.Proposed change: Add optional
sessionIDandcallIDfields to theshell.envinput:The fields are optional because the PTY call site (
pty/index.ts) has no session context. The two tool-related call sites (bash.ts,prompt.ts) already have both values in scope.This is the same pattern used when
sessionIDwas added tochat.system.transform(#7718) andargswas added totool.execute.after(56ad2db). Additive, non-breaking, backward-compatible.