fix(deepagents): scope composite route search fanout by path (#572)
## Summary
Fixes #241.
This updates `CompositeBackend` search routing so scoped `grep`/`glob`
requests only fan out to routed backends mounted under the requested
path. Previously, non-route paths (for example `/workspace`) still
queried all routes, which could trigger unrelated backend errors.
## Changes
### `libs/deepagents/src/backends/composite.ts`
- Added route/path helper predicates to distinguish:
- when a search path is inside a route,
- when a route is a descendant of the requested search path.
- Updated `grep` fallback behavior to query the default backend plus
only descendant routes (instead of unconditional all-route fanout).
- Updated `glob` fallback behavior to use the same descendant-route
filtering.
- Normalized `grep` path handling to accept `null` and treat it as root
(`/`).
- Reused the same route-matching helper in `ls` for consistent prefix
matching semantics.
### `libs/deepagents/src/backends/composite.test.ts`
- Added regression test to ensure `grep("...", "/workspace")` does not
call unrelated routes (for example `/skills/`) while still searching
relevant descendant routes.
- Added regression test for equivalent `glob` behavior.
Co-authored-by: Christian Bromann <731337+christian-bromann@users.noreply.github.com> H
Hunter Lovell committed
03df237385fbdfefd862076c5588eb39cb6e43c3
Parent: 92ddef1
Committed by GitHub <noreply@github.com>
on 6/2/2026, 5:12:26 PM