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

Inherits:
Permissions::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 Permissions::Action after submission (and after the auto-approval drain)

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

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



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

def initialize(on_submit: nil, on_status: nil, **kwargs)
   = 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



41
42
43
44
45
# File 'lib/ask/coding_providers/ask_agent/adapter.rb', line 41

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