SIGN IN SIGN UP

fix(deepagents): merge custom middleware by name (#672)

## Summary

Adds middleware override behavior to replace default middleware by
`.name` instead of always being appended.

## Changes

- Add name-keyed middleware merging so custom middleware replaces
matching default middleware in-place and appends novel middleware after
the core stack.
- Apply default-slot middleware overrides consistently when constructing
main-agent and subagent middleware stacks, while preventing parent-only
middleware from propagating unless it matches a subagent default slot.
- Move harness tool exclusion into a private `_ToolExclusionMiddleware`
helper so excluded tools are stripped after tool-injecting middleware
has run.
- Add coverage for main-agent replacement, subagent/default override
propagation, parent-only middleware isolation, profile exclusions,
tool-exclusion ordering, and merge precedence.
H
Hunter Lovell committed
cc26c41df2851acacc86a743878b5c847a8f5d59
Parent: f09bc61
Committed by GitHub <noreply@github.com> on 7/15/2026, 2:08:52 AM