fix(arch-030,arch-047): workflow steps resolve plugins via contracts at runtime

This commit is contained in:
Agent Zero
2026-08-23 12:50:53 +02:00
parent 44511a8fd7
commit d87fc4e55c
6 changed files with 89 additions and 27 deletions
@@ -63,6 +63,11 @@ class AutomationContract:
# ─── agent_comm ───
send_agent_message = staticmethod(send_agent_message)
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───
@@ -15,6 +15,11 @@ class CalendarContract:
CalendarEntry = CalendarEntry
CalendarEntryLink = CalendarEntryLink
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───
+5
View File
@@ -15,6 +15,11 @@ class DmsContract:
DmsFile = DmsFile
Folder = Folder
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───
+5
View File
@@ -32,6 +32,11 @@ class MailContract:
# ─── models ───
Mail = Mail
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───
@@ -10,6 +10,33 @@ from app.plugins.builtins.unified_search.query_understanding import llm_analyze_
from app.plugins.builtins.unified_search.search_engine import find_similar_all_types, hybrid_search
async def simple_search(
db: Any,
query: str,
tenant_id: Any,
entity_types: list[str] | None = None,
limit: int = 20,
user_id: Any | None = None,
is_system_admin: bool = False,
) -> list[dict[str, Any]]:
"""Convenience search entry point: analyze a raw query string and run
the hybrid search over all registered providers.
Falls back to a plain normalized-query analysis when the LLM is
unavailable.
"""
analysis = await llm_analyze_query(query, db=db, tenant_id=tenant_id)
return await hybrid_search(
db=db,
query_analysis=analysis,
tenant_id=tenant_id,
entity_types=entity_types,
limit=limit,
user_id=user_id,
is_system_admin=is_system_admin,
)
class UnifiedSearchContract:
"""Public contract for the unified_search plugin."""
@@ -20,8 +47,14 @@ class UnifiedSearchContract:
find_similar_all_types = staticmethod(find_similar_all_types)
get_search_registry = staticmethod(get_search_registry)
llm_analyze_query = staticmethod(llm_analyze_query)
simple_search = staticmethod(simple_search)
BaseSearchProvider = BaseSearchProvider
@classmethod
def get_function(cls, name: str):
"""Return a callable exposed by this contract, or None if absent."""
return getattr(cls, name, None)
# ─── self-registration ───