Skip to content

[FEATURE]: expand shell.env hook context with messageID and agent #21767

@micuintus

Description

@micuintus
  • I've checked that this feature hasn't been suggested before.

TL;DR

Expand the shell.env plugin hook trigger in bash.ts to include messageID and agent in the context, so plugins know which message and agent triggered a bash command.

More detail

The Plugin.trigger("shell.env", ...) call in bash.ts currently passes minimal context. Plugins that need to set environment variables conditionally (e.g. only for agent-initiated commands, or per-message) have no way to know which message or agent triggered the shell invocation.

This change adds messageID and agent to the trigger context for the bash.ts call site only (the other call sites in prompt.ts and pty/index.ts are for user-initiated commands and are a separate concern).

Part of the plugin primitives work tracked in #20018 (split from #21687).

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

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