Files
microdao-daarion/services/sofiia-console/app/ops.py
Apple 129e4ea1fc feat(platform): add new services, tools, tests and crews modules
New router intelligence modules (26 files): alert_ingest/store, audit_store,
architecture_pressure, backlog_generator/store, cost_analyzer, data_governance,
dependency_scanner, drift_analyzer, incident_* (5 files), llm_enrichment,
platform_priority_digest, provider_budget, release_check_runner, risk_* (6 files),
signature_state_store, sofiia_auto_router, tool_governance

New services:
- sofiia-console: Dockerfile, adapters/, monitor/nodes/ops/voice modules, launchd, react static
- memory-service: integration_endpoints, integrations, voice_endpoints, static UI
- aurora-service: full app suite (analysis, job_store, orchestrator, reporting, schemas, subagents)
- sofiia-supervisor: new supervisor service
- aistalk-bridge-lite: Telegram bridge lite
- calendar-service: CalDAV calendar service with reminders
- mlx-stt-service / mlx-tts-service: Apple Silicon speech services
- binance-bot-monitor: market monitor service
- node-worker: STT/TTS memory providers

New tools (9): agent_email, browser_tool, contract_tool, observability_tool,
oncall_tool, pr_reviewer_tool, repo_tool, safe_code_executor, secure_vault

New crews: agromatrix_crew (10 modules: depth_classifier, doc_facts, doc_focus,
farm_state, light_reply, llm_factory, memory_manager, proactivity, reflection_engine,
session_context, style_adapter, telemetry)

Tests: 85+ test files for all new modules
Made-with: Cursor
2026-03-03 07:14:14 -08:00

62 lines
2.2 KiB
Python

"""Ops: run risk dashboard, pressure dashboard, backlog generate, release_check via router tools."""
import logging
from typing import Any, Dict
from .config import get_router_url
from .router_client import execute_tool
logger = logging.getLogger(__name__)
# Map ops action id -> (tool, action, default params)
OPS_ACTIONS: Dict[str, tuple] = {
"risk_dashboard": ("risk_engine_tool", "dashboard", {"env": "prod"}),
"pressure_dashboard": ("architecture_pressure_tool", "dashboard", {"env": "prod"}),
"backlog_generate_weekly": ("backlog_tool", "auto_generate_weekly", {"env": "prod"}),
"pieces_status": ("pieces_tool", "status", {}),
"notion_status": ("notion_tool", "status", {}),
"notion_create_task": ("notion_tool", "create_task", {}),
"notion_create_page": ("notion_tool", "create_page", {}),
"notion_update_page": ("notion_tool", "update_page", {}),
"notion_create_database": ("notion_tool", "create_database", {}),
"release_check": (
"job_orchestrator_tool",
"start_task",
{"task_id": "release_check", "inputs": {"gate_profile": "staging"}},
),
}
async def run_ops_action(
action_id: str,
node_id: str,
params_override: Dict[str, Any],
*,
agent_id: str = "sofiia",
timeout: float = 90.0,
api_key: str = "",
) -> Dict[str, Any]:
"""Run one ops action against the given node's router. Returns { status, data, error }."""
if action_id not in OPS_ACTIONS:
return {"status": "failed", "data": None, "error": {"message": f"Unknown action: {action_id}"}}
tool, action, default_params = OPS_ACTIONS[action_id]
params = {**default_params, **params_override}
base_url = get_router_url(node_id)
try:
out = await execute_tool(
base_url,
tool,
action,
params=params,
agent_id=agent_id,
timeout=timeout,
api_key=api_key,
)
return out
except Exception as e:
logger.exception("ops run failed: action=%s node=%s", action_id, node_id)
return {
"status": "failed",
"data": None,
"error": {"message": str(e)[:300], "retryable": True},
}