Python Core API Reference (dmint)
This page documents the public API exposed by the dmint v1.0.1 Python package.
Dmint
The primary authorization and execution orchestrator.
Constructor
Methods
@dmint.protected(capability: str)
Decorator that intercepts a Python function. Halts execution if the capability evaluates to DENY or APPROVAL_REQUIRED.
dmint.authorize(request: ToolRequest | tuple[str, str, str]) -> Decision
Evaluates a request against the active policy without executing code.
Returns a Decision object with properties:
decision.is_allowed: booldecision.requires_approval: booldecision.is_denied: booldecision.effect: str
Policy
Represents an immutable, validated authorization policy.
Static Methods
Properties
policy.rules: List ofRuleobjects.policy.digest: SHA-256 hex string representing the canonical digest of this policy.
SQLiteApprovalStore
The Core-owned SQLite database client managing approval lifecycles.
Constructor
Public Methods
store.list_pending(limit: int = 50, offset: int = 0) -> list[ApprovalRecord]
Returns pending approval records ordered chronologically.
store.list_records(state: str | None = None, limit: int = 50, offset: int = 0) -> list[ApprovalRecord]
Lists approval records filtered by state ("pending", "approved", "consumed", "rejected", "expired").
store.get(id: str) -> ApprovalRecord | None
Retrieves a record by its request_id or approval_id.
store.approve_pending(request_id: str, authority: LocalApprovalAuthority, approver_id: str) -> ApprovalRecord
Transitions a pending record to APPROVED and generates an Ed25519 cryptographic assertion.
store.reject_pending(request_id: str, reason: str | None = None) -> ApprovalRecord
Transitions a pending record to REJECTED.
store.consume_approved(approval_id: str, request_fingerprint: str, policy_digest: str) -> ApprovalRecord
Atomically marks an approved assertion as CONSUMED during execution. Raises DMT_APPROVAL_CONSUMED if already used.
Error Codes & Exceptions
All authorization exceptions derive fromdmint.errors.AuthorizationError: