class RubyLLM::Browser::ApprovalStore

Durable store for host-issued, single-use {Approval}s.

The RubyLLM approval resolver may consult the store repeatedly, so reads must be side-effect free. Only {#consume_once} mutates, and it must be atomic so a replayed or duplicated worker cannot dispatch a second action.

Public Instance Methods

consume_once(_id, actor_id:, run_id:, url:, action_digest:, now:, page_revision: nil, operation_id: nil, session_id: nil) click to toggle source

Atomically consumes id exactly once if it is active and bound to this actor/run/url/revision/digest.

@return [Approval] the consumed approval @raise [ApprovalRequired] no such approval @raise [ApprovalStale] consumed, revoked, expired or bound to different details

# File lib/ruby_llm/browser/approval_store.rb, line 27
def consume_once(_id, actor_id:, run_id:, url:, action_digest:, now:, page_revision: nil,
                 operation_id: nil, session_id: nil)
  raise NotImplementedError, "ApprovalStore#consume_once must be implemented"
end
fetch(_id) click to toggle source

Read-only lookup. Returns an {Approval} or nil.

# File lib/ruby_llm/browser/approval_store.rb, line 17
def fetch(_id)
  raise NotImplementedError, "ApprovalStore#fetch must be implemented"
end
issue(_approval) click to toggle source

Stores a freshly issued approval.

# File lib/ruby_llm/browser/approval_store.rb, line 12
def issue(_approval)
  raise NotImplementedError, "ApprovalStore#issue must be implemented"
end
revoke(_id) click to toggle source

Revokes an approval so it can never be consumed.

# File lib/ruby_llm/browser/approval_store.rb, line 33
def revoke(_id)
  raise NotImplementedError, "ApprovalStore#revoke must be implemented"
end