qonto-assistant/src/qonto_assistant/contracts.py
tegwick b9349782f4 feat(audit): publish sequenced heartbeat and reconciliation evidence
Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a06ec5-7e2b-7743-ac08-719e1b0f42e2
2026-09-05 01:39:48 +02:00

59 lines
1.3 KiB
Python

from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any, Literal
ProtocolName = Literal["rest", "mcp"]
@dataclass(frozen=True, slots=True)
class ActorClaims:
actor_id: str
tenant_id: str
lane: str = "green"
scopes: frozenset[str] = field(default_factory=frozenset)
identity_binding: str = "self_asserted"
@dataclass(frozen=True, slots=True)
class CapabilityRequest:
capability_id: str
tenant_id: str
actor_claims: ActorClaims
resource_scope: str
request_args: dict[str, Any]
protocol: ProtocolName
response_class: str = "operational_summary"
@dataclass(frozen=True, slots=True)
class PolicyDecision:
allowed: bool
capability_id: str
policy_version: int
reason: str
request_args: dict[str, Any] = field(default_factory=dict)
@dataclass(frozen=True, slots=True)
class QontoCredentials:
api_user: str
api_key: str
@dataclass(frozen=True, slots=True)
class AuditEvent:
request_id: str
timestamp: str
actor: str
tenant_id: str
capability: str
protocol: ProtocolName
decision: str
deny_reason: str | None
policy_version: int
latency_ms: int
identity_binding: str
egress_destination: str
qonto_http_status: int | None = None
result_count: int | None = None