Exception: Nexo::ApprovalRequired

Inherits:
StandardError
  • Object
show all
Defined in:
lib/nexo.rb

Overview

Control-flow signal raised by the :approve permission gate (Spec 16) when a capability needs a human decision and none has been threaded in yet. Unlike Permissions::Denied ("no, adapt" — tools rescue it into {error:}), ApprovalRequired means "pause and ask a human": tools must not rescue it, so it propagates out of the ruby_llm tool loop and out of Agent#prompt, where Workflow#run_agent catches it and turns it into a durable Workflow#suspend!. It subclasses StandardError directly (not Error), mirroring Permissions::Denied's base — it is a signal, not a library-misuse error. Carries the pending call's capability, detail (the tool/path), and args so a host can render the approval prompt from run.state["__approval__"].

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(capability, detail = nil, args = nil) ⇒ ApprovalRequired

Builds the signal for capability acting on detail with args; the message reads "approval required for ()".



57
58
59
60
61
62
# File 'lib/nexo.rb', line 57

def initialize(capability, detail = nil, args = nil)
  @capability = capability
  @detail = detail
  @args = args
  super("approval required for #{capability} (#{detail})")
end

Instance Attribute Details

#args ⇒ Object (readonly)

The pending call's capability (e.g. :write), its detail (the tool/path), and the tool args — enough for a host to render the approval prompt.



53
54
55
# File 'lib/nexo.rb', line 53

def args
  @args
end

#capability ⇒ Object (readonly)

The pending call's capability (e.g. :write), its detail (the tool/path), and the tool args — enough for a host to render the approval prompt.



53
54
55
# File 'lib/nexo.rb', line 53

def capability
  @capability
end

#detail ⇒ Object (readonly)

The pending call's capability (e.g. :write), its detail (the tool/path), and the tool args — enough for a host to render the approval prompt.



53
54
55
# File 'lib/nexo.rb', line 53

def detail
  @detail
end