Class: Parse::Agent::ApprovalGate

Inherits:
Object
  • Object
show all
Defined in:
lib/parse/agent/approval_gate.rb

Overview

Abstract approval-gate contract. A gate vetoes (or permits) a destructive tool call before it runs. #execute consults the installed gate for any tool whose effective tier is in require_approval_for.

The MCP transport installs an MCPElicitationGate; an embedder on the non-MCP path can install any object responding to #review. The default (NullGate) approves everything, so the gate is a no-op until both an opt-in tier is configured AND a real gate is installed.

Direct Known Subclasses

MCPElicitationGate, NullGate

Constant Summary collapse

ABORT =

Sentinel pushed onto a pending queue to wake a blocked review when the request is aborted (session terminated, stream closed).

Object.new.freeze

Instance Method Summary collapse

Instance Method Details

#review(tool_name:, effective_permission:, preview:, agent:) ⇒ ApprovalDecision

Parameters:

  • tool_name (Symbol)
  • effective_permission (Symbol)

    :readonly/:write/:admin — the effective tier (for call_method, the target method's tier).

  • preview (Hash)

    the preview to show the approver. This is a real before/after only for methods that declare supports_dry_run; for the built-in update_object / delete_object it is the proposed { tool:, args: } call, not a fetched before/after.

  • agent (Parse::Agent)

Returns:

Raises:

  • (NotImplementedError)


70
71
72
# File 'lib/parse/agent/approval_gate.rb', line 70

def review(tool_name:, effective_permission:, preview:, agent:)
  raise NotImplementedError
end