Skip to content

Index

actions

Deterministic, low-latency desktop actions.

The action layer intentionally sits in front of the LLM. It handles only explicit, high-confidence and reversible user requests; everything ambiguous or risky continues through the normal agent and approval pipeline.

Classes

ActionOutcome dataclass

ActionOutcome(
    handled: bool,
    success: bool = False,
    message: str = "",
    action: str = "",
    target: str = "",
    risk: ActionRisk = LOCAL,
    verified: bool = False,
    route_ms: float = 0.0,
    execute_ms: float = 0.0,
    total_ms: float = 0.0,
    error_type: str = "",
    metadata: dict[str, Any] = dict(),
)

Result returned to chat, voice and telemetry consumers.

Methods:
public_metadata
public_metadata() -> dict[str, Any]

Privacy-safe diagnostics: never expose dictated text or file data.

Source code in src/diapason/actions/models.py
def public_metadata(self) -> dict[str, Any]:
    """Privacy-safe diagnostics: never expose dictated text or file data."""
    return {
        "handled": self.handled,
        "success": self.success,
        "action": self.action,
        "risk": self.risk.value,
        "verified": self.verified,
        "route_ms": round(self.route_ms, 2),
        "execute_ms": round(self.execute_ms, 2),
        "total_ms": round(self.total_ms, 2),
        **({"error_type": self.error_type} if self.error_type else {}),
    }

ActionPlan dataclass

ActionPlan(
    kind: str,
    target: str = "",
    text: str = "",
    confidence: float = 0.0,
    risk: ActionRisk = LOCAL,
    arguments: dict[str, Any] = dict(),
    reason: str = "",
)

A high-confidence action parsed directly from the current user turn.

ActionRisk

Bases: str, Enum

Security impact of a deterministic action.

LightningActionService

LightningActionService(
    config: Any = None,
    *,
    router: FastActionRouter | None = None,
)

Parse, authorize, execute and measure a single explicit user command.

Source code in src/diapason/actions/service.py
def __init__(
    self,
    config: Any = None,
    *,
    router: FastActionRouter | None = None,
) -> None:
    self._config = config
    self._router = router or FastActionRouter()
    try:
        from diapason.desktop.app_index import APP_INDEX

        APP_INDEX.ttl_s = max(1.0, float(self._get("app_cache_ttl_s", 300.0)))
    except (ImportError, TypeError, ValueError):
        pass