2026-07-26 23:15:34 +02:00
|
|
|
"""Public contract for the automation plugin.
|
|
|
|
|
|
|
|
|
|
Exposes models, services, scheduler, and agent communication for other plugins.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
|
|
2026-08-16 01:17:18 +02:00
|
|
|
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
|
2026-07-26 23:15:34 +02:00
|
|
|
from app.plugins.builtins.automation.models import (
|
|
|
|
|
AgentDefinition,
|
|
|
|
|
AgentRun,
|
|
|
|
|
AgentVersion,
|
|
|
|
|
AutomationCronJob,
|
|
|
|
|
AutomationDefinition,
|
|
|
|
|
AutomationRun,
|
|
|
|
|
AutomationVersion,
|
|
|
|
|
)
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.plugins.builtins.automation.scheduler import (
|
|
|
|
|
calculate_next_run,
|
|
|
|
|
scheduler_tick,
|
|
|
|
|
)
|
2026-07-26 23:15:34 +02:00
|
|
|
from app.plugins.builtins.automation.services import (
|
|
|
|
|
AgentService,
|
|
|
|
|
AutomationService,
|
|
|
|
|
CronJobService,
|
|
|
|
|
RunLogService,
|
|
|
|
|
)
|
2026-08-16 01:17:18 +02:00
|
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
2026-07-26 23:15:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ─── self-registration ───
|
|
|
|
|
|
|
|
|
|
_contract = AutomationContract()
|
|
|
|
|
get_contract_registry().register("automation", _contract)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
__all__ = [
|
|
|
|
|
"AutomationContract",
|
|
|
|
|
"AgentDefinition",
|
|
|
|
|
"AgentService",
|
|
|
|
|
"AutomationService",
|
|
|
|
|
"CronJobService",
|
|
|
|
|
"RunLogService",
|
|
|
|
|
]
|