Class: PWN::Plugins::REPL::AIConsole::Control

Inherits:
AI::Agent::Loop::Steering show all
Defined in:
lib/pwn/plugins/repl/ai_console.rb

Overview

Reuse the model-window interrupt protection and evidence checkpoints. Cancellation never raises asynchronously into a tool.

Defined Under Namespace

Classes: Stopped

Constant Summary

Constants inherited from AI::Agent::Loop::Steering

AI::Agent::Loop::Steering::INPUT_LOCK, AI::Agent::Loop::Steering::INPUT_OWNERS

Instance Attribute Summary

Attributes inherited from AI::Agent::Loop::Steering

#reader

Instance Method Summary collapse

Methods inherited from AI::Agent::Loop::Steering

#initialize, #model, #submit, #with_reader

Constructor Details

This class inherits a constructor from PWN::AI::Agent::Loop::Steering

Instance Method Details

#checkpoint(messages:, phase: :boundary, &block) ⇒ Object



92
93
94
95
96
97
98
# File 'lib/pwn/plugins/repl/ai_console.rb', line 92

def checkpoint(messages:, phase: :boundary, &block)
  if @stopping
    block&.call
    raise Stopped, 'Request cancelled at a safe boundary; completed work is not undone.'
  end
  super
end

#phase ⇒ Object



100
101
102
# File 'lib/pwn/plugins/repl/ai_console.rb', line 100

def phase
  @mutex.synchronize { @pending.empty? ? @phase : "steering queued · #{@phase}" }
end

#stop ⇒ Object



87
88
89
90
# File 'lib/pwn/plugins/repl/ai_console.rb', line 87

def stop
  @stopping = true
  submit('Stop the active request.')
end