refactor(agents): colocate 8 main-agent-only middleware as per-concept folders

Each main-agent-only middleware now lives in its own folder under
main_agent/middleware/<concept>/ with builder.py (flag-gated construction)
+ middleware.py (the impl), re-exported via __init__.py. This kills the
cross-folder hop into agents/shared/middleware and keeps each middleware's
two responsibilities (build vs behavior) as colocated siblings.

Moved (impl from shared/middleware, builder from main_agent/middleware):
action_log, anonymous_document, context_editing, doom_loop, knowledge_tree,
noop_injection, otel_span, tool_call_repair.

Impls moved verbatim (git rename, no body edits) so behavior is unchanged.
Builders now import from the local .middleware sibling. stack.py import
paths updated for the 3 renamed folders; shared middleware barrel trimmed;
tests repointed (imports + patch targets).
This commit is contained in:
CREDO23 2026-06-05 11:42:58 +02:00
parent fbd5ccc35a
commit 9493519c61
33 changed files with 149 additions and 83 deletions

View file

@ -9,7 +9,9 @@ contract cannot silently regress.
from __future__ import annotations
from app.agents.shared.middleware.knowledge_tree import KnowledgeTreeMiddleware
from app.agents.multi_agent_chat.main_agent.middleware.knowledge_tree.middleware import (
KnowledgeTreeMiddleware,
)
from app.agents.shared.path_resolver import DOCUMENTS_ROOT