Files
leocrm/app/plugins/builtins/ai_proactive/contracts.py
T

81 lines
2.1 KiB
Python
Raw Normal View History

"""Public contract for the ai_proactive plugin.
Exposes models, services, and job functions that other builtins plugins may need.
"""
from __future__ import annotations
from app.plugins.builtins.contracts import get_contract_registry
from app.plugins.builtins.ai_proactive.models import (
ContextLog,
ProactiveSettings,
ProactiveSuggestion,
)
from app.plugins.builtins.ai_proactive.services import (
get_active_suggestions,
get_sse_queue,
get_stats,
get_user_settings,
handle_context_change,
mark_dismissed,
push_suggestion,
)
from app.plugins.builtins.ai_proactive.context_tools import (
register_context_tools,
)
from app.plugins.builtins.ai_proactive.jobs import (
deep_analysis,
heartbeat,
)
class AiProactiveContract:
"""Public API surface for the ai_proactive plugin."""
contract_name = "ai_proactive"
# ─── models ───
ProactiveSuggestion = ProactiveSuggestion
ContextLog = ContextLog
ProactiveSettings = ProactiveSettings
# ─── services ───
handle_context_change = staticmethod(handle_context_change)
get_active_suggestions = staticmethod(get_active_suggestions)
get_sse_queue = staticmethod(get_sse_queue)
get_stats = staticmethod(get_stats)
get_user_settings = staticmethod(get_user_settings)
mark_dismissed = staticmethod(mark_dismissed)
push_suggestion = staticmethod(push_suggestion)
# ─── context_tools ───
register_context_tools = staticmethod(register_context_tools)
# ─── jobs ───
deep_analysis = staticmethod(deep_analysis)
heartbeat = staticmethod(heartbeat)
# ─── self-registration ───
_contract = AiProactiveContract()
get_contract_registry().register("ai_proactive", _contract)
__all__ = [
"AiProactiveContract",
"ProactiveSuggestion",
"ContextLog",
"ProactiveSettings",
"handle_context_change",
"get_active_suggestions",
"get_sse_queue",
"get_stats",
"get_user_settings",
"mark_dismissed",
"push_suggestion",
"register_context_tools",
"deep_analysis",
"heartbeat",
]