Class: OllamaAgent::TuiUserPrompt
- Inherits:
-
Object
- Object
- OllamaAgent::TuiUserPrompt
- Defined in:
- lib/ollama_agent/tui_user_prompt.rb
Overview
UserPrompt compatible confirmations using TTY::Prompt (arrow-friendly yes/no). rubocop:disable Naming/PredicateMethod – confirm_* mirror UserPrompt API
Instance Method Summary collapse
- #confirm_delegate(agent_id, task) ⇒ Object
- #confirm_patch(path, diff) ⇒ Object
- #confirm_write_file(path, content_preview) ⇒ Object
-
#initialize(prompt:, stdout: $stdout) ⇒ TuiUserPrompt
constructor
A new instance of TuiUserPrompt.
Constructor Details
#initialize(prompt:, stdout: $stdout) ⇒ TuiUserPrompt
Returns a new instance of TuiUserPrompt.
10 11 12 13 |
# File 'lib/ollama_agent/tui_user_prompt.rb', line 10 def initialize(prompt:, stdout: $stdout) @prompt = prompt @stdout = stdout end |
Instance Method Details
#confirm_delegate(agent_id, task) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/ollama_agent/tui_user_prompt.rb', line 25 def confirm_delegate(agent_id, task) body = task.to_s body = "#{body[0, 2000]}\n..." if body.length > 2000 show_block("Delegate to #{agent_id}:", body) @prompt.yes?(apply_question("Run external agent?")) end |
#confirm_patch(path, diff) ⇒ Object
15 16 17 18 |
# File 'lib/ollama_agent/tui_user_prompt.rb', line 15 def confirm_patch(path, diff) show_block("Proposed diff for #{path}:", diff) @prompt.yes?(apply_question("Apply this patch?")) end |
#confirm_write_file(path, content_preview) ⇒ Object
20 21 22 23 |
# File 'lib/ollama_agent/tui_user_prompt.rb', line 20 def confirm_write_file(path, content_preview) show_block("Proposed write_file for #{path}:", content_preview) @prompt.yes?(apply_question("Write this file?")) end |