Skip to content

approval_store

diapason.tools.approval_store

ApprovalStore — SQLite-backed store for proactive agent action approvals.

Two tables: - pending_actions: actions proposed by the proactive agent awaiting user decision - permission_memory: remembered user decisions keyed by action pattern

Permission key format: "{action_type}:{fingerprint}" e.g. "email_delete:domain:noreply.github.com" "sms_draft_reply:contact:+15551234567"

ApprovalStore

SQLite store for proactive agent action approvals and permission memory.

expire_stale()

Mark past-TTL pending actions as expired. Returns count.

get_seen_ids()

Return all doc_ids and message_ids previously queued (any status).

Used by ProactiveAgent to skip items it has already proposed so they don't resurface on every run while still unread/unanswered.

list_approved()

Return approved-but-not-yet-executed actions.

list_pending()

Return all non-expired pending actions.

queue_action(action_type, description, payload, permission_key, tier, ttl_hours=24)

Create and persist a new pending action.

set_permission(permission_key, decision, *, approved=False, notes='')

Upsert a permission rule, incrementing the relevant counter.

PendingAction dataclass

An action proposed by the proactive agent.

PermissionRule dataclass

A remembered user decision for a permission pattern.