Class: Ask::CodingProviders::AskAgent::EmittingApprovalQueue

Inherits:
Agent::ApprovalQueue
  • Object
show all
Defined in:
lib/ask/coding_providers/ask_agent/adapter.rb

Overview

Approval queue that notifies callbacks when actions are submitted or change status, so clients can stream approval state in real time.

The session wires its own apply/reject/submit callbacks onto the queue (see Session#build_approval); this subclass only adds observation hooks on top, using its own listeners so the session's on_submit (pending-tool registration) is never clobbered.

Instance Method Summary collapse

Constructor Details

#initialize(on_submit: nil, on_status: nil, **kwargs) ⇒ EmittingApprovalQueue

Returns a new instance of EmittingApprovalQueue.

Parameters:

  • on_submit (Proc, nil) (defaults to: nil)

    called with the new Action after submission (and after the auto-approval drain)

  • on_status (Proc, nil) (defaults to: nil)

    called with an Action whose status changed to :approved or :rejected



27
28
29
30
31
# File 'lib/ask/coding_providers/ask_agent/adapter.rb', line 27

def initialize(on_submit: nil, on_status: nil, **kwargs)
  @on_action_submitted = on_submit
  @on_status = on_status
  super(**kwargs)
end

Instance Method Details

#submit(tool_call_id:, tool_name:, args: {}, auto_approvable: false, message: nil) ⇒ Object



33
34
35
36
37
# File 'lib/ask/coding_providers/ask_agent/adapter.rb', line 33

def submit(tool_call_id:, tool_name:, args: {}, auto_approvable: false, message: nil)
  id = super
  @on_action_submitted&.call(self[id])
  id
end