Exception: Nexo::ApprovalRequired
- Inherits:
-
StandardError
- Object
- StandardError
- Nexo::ApprovalRequired
- 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
-
#args ⇒ Object
readonly
The pending call's capability (e.g.
:write), itsdetail(the tool/path), and the toolargs— enough for a host to render the approval prompt. -
#capability ⇒ Object
readonly
The pending call's capability (e.g.
:write), itsdetail(the tool/path), and the toolargs— enough for a host to render the approval prompt. -
#detail ⇒ Object
readonly
The pending call's capability (e.g.
:write), itsdetail(the tool/path), and the toolargs— enough for a host to render the approval prompt.
Instance Method Summary collapse
-
#initialize(capability, detail = nil, args = nil) ⇒ ApprovalRequired
constructor
Builds the signal for
capabilityacting ondetailwithargs; the message reads "approval required for( )".
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
51 52 53 54 55 56 |
# File 'lib/nexo.rb', line 51 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.
47 48 49 |
# File 'lib/nexo.rb', line 47 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.
47 48 49 |
# File 'lib/nexo.rb', line 47 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.
47 48 49 |
# File 'lib/nexo.rb', line 47 def detail @detail end |