Skip to content

[FEATURE]: Pass sessionID and callID to shell.env hook input #13661

@tesdal

Description

@tesdal

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request 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.

Metadata

Metadata

Assignees

Labels

discussionUsed for feature requests, proposals, ideas, etc. Open discussion

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions