Module: AIA::Utility

Extended by:
MCPUtility, ToolUtility
Defined in:
lib/aia/utility.rb

Class Method Summary collapse

Methods included from ToolUtility

supports_tools?, tools?, total_tool_count, user_tools?

Methods included from MCPUtility

connected_mcp_servers?, effective_mcp_server_names, failed_mcp_servers, mcp_server_names, mcp_servers?, server_name

Class Method Details

.build_crew_lineObject



31
32
33
34
35
# File 'lib/aia/utility.rb', line 31

def build_crew_line
  names = robot_names
  return '' if names.empty?
  "Today's crew: #{format_crew_mentions(names)}"
end

.models_last_refreshObject



22
23
24
25
26
27
28
29
# File 'lib/aia/utility.rb', line 22

def models_last_refresh
  aia_dir = AIA.config&.paths&.aia_dir
  return nil if aia_dir.nil?
  models_file = File.join(File.expand_path(aia_dir), 'models.json')
  File.mtime(models_file).strftime('%Y-%m-%d %H:%M')
rescue Errno::ENOENT
  nil
end

.robotObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/aia/utility.rb', line 37

def robot
  art = [
    '       ,      ,',
    '       (\____/)',
    '        (_oo_)',
    '         (O)',
    '       __|||__    \)',
    '     [/ Tobor \]  /',
    '    / \_______/ \/',
    '   /    /___\\',
    '  (\   /_____\\',
    '     :::     :::',
    '     :::     :::'
  ].join("\n")

  art_width   = art.lines.map(&:length).max
  info_width  = [TTY::Screen.width - art_width - 4, 30].max
  label_width = 7  # "Models:" is the widest label
  value_width = [info_width - label_width - 1, 20].max

  header = "AIA v#{AIA::VERSION} is Online"

  inner = TTY::Table.new(banner_detail_rows)
  details = inner.render(:basic, multiline: true,
                         column_widths: [label_width, value_width],
                         alignments: %i[right left])

  outer = TTY::Table.new([[art, "#{header}\n\n#{details}"]])
  puts "\n#{outer.render(:basic, multiline: true, column_widths: [art_width, info_width], padding: [0, 1, 0, 0])}"
end