03dd477899
Check Cross-Plugin Imports / check (push) Has been cancelled
- Scope-Deklarationen: tasks only_mine, kommunikation conversation_ids, wiki category_ids (NEUE contracts.py), report_generator template_ids, automation agent_ids (module_key agents), tags tag_ids, unified_search entity_types dynamisch aus Provider-Registry - Core-Beiträge: navigation default_route (Startseite) + dashboard widget_app_ids (Widget-TYP-Angebot, Layout bleibt Phase M) - Backend-Filter (additive UND): /tasks (only_mine), /comm/conversations, /wiki/articles+/categories (Subtree), /reports/print-templates, /agents, /tags, /search GET+POST (entity_types-Schnitt), /miniapps?host=dashboard - apply_entity_type_scope-Helper (requested ∧ scope) - Frontend: WorkspaceSwitcher default_route-Navigation, Sidebar workspace-menu_order-Sortierung, workspaceStore moduleMenuOrder() - Tests: 18/18 Deklarationen + 11/11 Filter (TDD), Frontend 2/2 + Store 18/18, tsc clean, Build OK - Regression 64 passed (4 Kombi-Failures = Suite-Isolation, solo-bewiesen); Checker 0; Ruff = Vorbestand (Stash-bewiesen)
111 lines
3.1 KiB
Python
111 lines
3.1 KiB
Python
"""Public contract for the automation plugin.
|
|
|
|
Exposes models, services, scheduler, and agent communication for other plugins.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.plugins.builtins.automation.agent_comm import send_agent_message
|
|
from app.plugins.builtins.automation.agent_runner import run_agent
|
|
from app.plugins.builtins.automation.execution_engine import run_automation
|
|
from app.plugins.builtins.automation.models import (
|
|
AgentDefinition,
|
|
AgentRun,
|
|
AgentVersion,
|
|
AutomationCronJob,
|
|
AutomationDefinition,
|
|
AutomationRun,
|
|
AutomationVersion,
|
|
)
|
|
from app.plugins.builtins.automation.scheduler import (
|
|
calculate_next_run,
|
|
scheduler_tick,
|
|
)
|
|
from app.plugins.builtins.automation.services import (
|
|
AgentService,
|
|
AutomationService,
|
|
CronJobService,
|
|
RunLogService,
|
|
)
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
|
|
|
|
class AutomationContract:
|
|
"""Public API surface for the automation plugin."""
|
|
|
|
contract_name = "automation"
|
|
|
|
# ─── models ───
|
|
AgentDefinition = AgentDefinition
|
|
Automation = AutomationDefinition
|
|
CronJob = AutomationCronJob
|
|
AgentRun = AgentRun
|
|
AgentVersion = AgentVersion
|
|
AutomationRun = AutomationRun
|
|
AutomationVersion = AutomationVersion
|
|
|
|
# ─── services ───
|
|
AgentService = AgentService
|
|
AutomationService = AutomationService
|
|
CronJobService = CronJobService
|
|
RunLogService = RunLogService
|
|
|
|
# ─── agent_runner ───
|
|
run_agent = staticmethod(run_agent)
|
|
|
|
# ─── execution_engine ───
|
|
run_automation = staticmethod(run_automation)
|
|
|
|
# ─── scheduler ───
|
|
calculate_next_run = staticmethod(calculate_next_run)
|
|
scheduler_tick = staticmethod(scheduler_tick)
|
|
|
|
# ─── agent_comm ───
|
|
send_agent_message = staticmethod(send_agent_message)
|
|
|
|
# ─── Workspace Scopes contribution (Phase N4) ───
|
|
|
|
@staticmethod
|
|
def workspace_scopes() -> list[dict]:
|
|
"""Scope-Dimensionen des agents-Moduls: Agenten-Teilmengen (N4)."""
|
|
return [
|
|
{
|
|
"module_key": "agents",
|
|
"dimensions": [
|
|
{
|
|
"key": "agent_ids",
|
|
"label": "Agenten",
|
|
"control": "multiselect",
|
|
"options": [],
|
|
"value_source": {
|
|
"endpoint": "/api/v1/agents",
|
|
"items_path": "items",
|
|
"value_key": "id",
|
|
"label_key": "name",
|
|
},
|
|
},
|
|
],
|
|
}
|
|
]
|
|
|
|
@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 ───
|
|
|
|
_contract = AutomationContract()
|
|
get_contract_registry().register("automation", _contract)
|
|
|
|
|
|
__all__ = [
|
|
"AutomationContract",
|
|
"AgentDefinition",
|
|
"AgentService",
|
|
"AutomationService",
|
|
"CronJobService",
|
|
"RunLogService",
|
|
]
|