Skip to content

refactor: centralize tool plugin hooks + add agent to hook input #13524

@ArmirKS

Description

@ArmirKS

Description

prompt.ts has the same before/after plugin hook logic inline in 3 separate places, and none of them pass agent to the hooks. This means plugins can't tell which agent made a tool call — a blocker for any plugin that needs per-agent policy (audit logging, permission enforcement, etc).

Steps to reproduce

  1. Create a plugin that hooks tool.execute.before and logs the input
  2. Trigger tool calls from different agents (primary + subagents via task)
  3. Observe that the hook input has no agent field — the plugin can't distinguish who made the call

Fix

PR #13521 adds Tool.invoke() that centralizes hook wrapping and adds agent to the hook input.

The original batch bypass issue is moot since batch is experimental and being deprecated.

Metadata

Metadata

Assignees

Labels

No labels
No labels

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