Skip to content

models

models

Typed contracts shared by the lightning action pipeline.

Classes

ActionRisk

Bases: str, Enum

Security impact of a deterministic action.

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.

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 {}),
    }