Skip to main content

Module conversation

Module conversation 

Source
Expand description

Conversation typestate: “ask before acting” as a compile-time obligation.

Multi-turn agent protocols routinely require consent before sensitive actions — and routinely forget to check it on some code path. This module extends the SecureAgent<S> idea to conversations: the state of the consent handshake is part of the type, and consent itself is not a boolean but a minted Capability<CanDelegate, GenericResource> over the resource conversation/<peer> — unforgeable, policy-checked, audited, and expiring like every other capability.

Conversation<Proposed> ──request_consent(scopes)──▶ Conversation<AwaitingConsent>
                                                         │ grant_via(engine, subject)
                                                         ▼   (policy check mints the proof)
                                               Conversation<Consented>
                                                         └─ consent() / consented_scopes()

Conversation<Proposed> has no consent(); Conversation<AwaitingConsent> has no way to become consented except through a policy engine. Skipping the handshake is a type error, not a code-review finding.

Structs§

AwaitingConsent
Consent has been requested for specific scopes but not yet granted.
Consented
Consent is held as a minted capability; scoped actions may proceed.
Conversation
A conversation with peer, parameterized by its consent state.
Proposed
Initial state: a peer has been named, nothing has been asked.

Traits§

ConversationState
Sealed state trait for the conversation typestate machine.