Class: RailsConsoleAi::Channel::SubAgent

Inherits:
Base
  • Object
show all
Defined in:
lib/rails_console_ai/channel/sub_agent.rb

Instance Method Summary collapse

Methods inherited from Base

#edit_code

Constructor Details

#initialize(parent_channel:, task_label: nil) ⇒ SubAgent

Returns a new instance of SubAgent.



6
7
8
9
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 6

def initialize(parent_channel:, task_label: nil)
  @parent = parent_channel
  @label = task_label
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 63

def cancelled?
  @parent.cancelled?
end

#confirm(text) ⇒ Object



51
52
53
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 51

def confirm(text)
  'y'
end

#display(text) ⇒ Object



11
12
13
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 11

def display(text)
  # Swallowed — sub-agent final text is returned as tool result, not displayed
end

#display_code(code) ⇒ Object



35
36
37
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 35

def display_code(code)
  # Swallowed — sub-agent auto-executes, no need to show code
end

#display_error(text) ⇒ Object



27
28
29
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 27

def display_error(text)
  @parent.display_error(text)
end

#display_result(result) ⇒ Object



43
44
45
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 43

def display_result(result)
  # Swallowed — sub-agent return values aren't useful to show
end

#display_result_output(output) ⇒ Object



39
40
41
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 39

def display_result_output(output)
  @parent.display_result_output(output)
end

#display_status(text) ⇒ Object



19
20
21
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 19

def display_status(text)
  @parent.display_status(text)
end

#display_thinking(text) ⇒ Object



15
16
17
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 15

def display_thinking(text)
  @parent.display_thinking(text)
end

#display_tool_call(text) ⇒ Object



31
32
33
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 31

def display_tool_call(text)
  @parent.display_tool_call(text)
end

#display_warning(text) ⇒ Object



23
24
25
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 23

def display_warning(text)
  @parent.display_warning(text)
end

#modeObject



59
60
61
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 59

def mode
  'sub_agent'
end

#prompt(text) ⇒ Object



47
48
49
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 47

def prompt(text)
  '(sub-agent cannot ask user)'
end

#supports_danger?Boolean

Returns:

  • (Boolean)


67
68
69
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 67

def supports_danger?
  false  # Sub-agents must never silently bypass safety guards
end

#supports_editing?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 71

def supports_editing?
  false
end

#system_instructionsObject



79
80
81
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 79

def system_instructions
  nil
end

#user_identityObject



55
56
57
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 55

def user_identity
  @parent.user_identity
end

#wrap_llm_call(&block) ⇒ Object



75
76
77
# File 'lib/rails_console_ai/channel/sub_agent.rb', line 75

def wrap_llm_call(&block)
  yield
end