Class: OllamaAgent::CLI::TuiRepl
- Inherits:
-
Object
- Object
- OllamaAgent::CLI::TuiRepl
- Includes:
- ReplShared
- Defined in:
- lib/ollama_agent/cli/tui_repl.rb
Overview
Interactive REPL using TTY toolkit (box, table, markdown, prompt). rubocop:disable Metrics/ClassLength – session loop + dashboard + agent wiring
Constant Summary
Constants included from ReplShared
Instance Method Summary collapse
-
#initialize(agent:, tui:, stdout: $stdout, stderr: $stderr, memory: nil, budget: nil) ⇒ TuiRepl
constructor
rubocop:disable Metrics/ParameterLists – mirrors Repl IO + optional memory injection.
-
#start ⇒ Object
rubocop:disable Metrics/MethodLength – straight-line session loop.
Constructor Details
#initialize(agent:, tui:, stdout: $stdout, stderr: $stderr, memory: nil, budget: nil) ⇒ TuiRepl
rubocop:disable Metrics/ParameterLists – mirrors Repl IO + optional memory injection
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ollama_agent/cli/tui_repl.rb', line 20 def initialize(agent:, tui:, stdout: $stdout, stderr: $stderr, memory: nil, budget: nil) @agent = agent @tui = tui @stdout = stdout @stderr = stderr @memory = memory @budget = budget @assistant_hook_installed = false @session_runtime = build_session_runtime @dispatcher = build_runtime_dispatcher wire_runtime_events end |
Instance Method Details
#start ⇒ Object
rubocop:disable Metrics/MethodLength – straight-line session loop
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/ollama_agent/cli/tui_repl.rb', line 35 def start show_boot_dashboard @tui.log(:info, "Session ready — type / then Tab to complete slash commands; /help lists all.") loop do line = read_user_line break if line.nil? line = line.to_s.chomp.strip next if line.empty? break if %w[/exit exit].include?(line) if line.start_with?("/") dispatch_slash(line) else run_agent_query(line) end end @tui.goodbye end |