aia 2.0.0.0.pre.alpha → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.version +1 -1
- data/CHANGELOG.md +151 -228
- data/README.md +42 -19
- data/bin/aia +8 -3
- data/lib/aia/aia_completion.bash +2 -3
- data/lib/aia/aia_completion.fish +6 -5
- data/lib/aia/aia_completion.zsh +2 -3
- data/lib/aia/chat_loop.rb +24 -66
- data/lib/aia/config/cli_parser.rb +164 -123
- data/lib/aia/config/defaults.yml +12 -39
- data/lib/aia/config/mcp_parser.rb +42 -40
- data/lib/aia/config/model_spec.rb +8 -14
- data/lib/aia/config/validator.rb +144 -156
- data/lib/aia/config/value_caster.rb +76 -0
- data/lib/aia/config.rb +72 -54
- data/lib/aia/content_extractor.rb +2 -0
- data/lib/aia/cost_calculator.rb +1 -0
- data/lib/aia/crew.rb +29 -19
- data/lib/aia/debate_handler.rb +45 -20
- data/lib/aia/delegate_handler.rb +7 -3
- data/lib/aia/directive.rb +10 -8
- data/lib/aia/directives/configuration_directives.rb +164 -109
- data/lib/aia/directives/context_directives.rb +55 -40
- data/lib/aia/directives/execution_directives.rb +25 -25
- data/lib/aia/directives/model_directives.rb +112 -195
- data/lib/aia/directives/trakflow_directives.rb +27 -9
- data/lib/aia/directives/utility_directives.rb +86 -87
- data/lib/aia/directives/web_and_file_directives.rb +83 -63
- data/lib/aia/fact_asserter.rb +3 -3
- data/lib/aia/history_transfer.rb +64 -24
- data/lib/aia/layered_orchestrator.rb +66 -43
- data/lib/aia/logger.rb +27 -62
- data/lib/aia/mcp_config_normalizer.rb +27 -14
- data/lib/aia/mcp_connection_manager.rb +193 -186
- data/lib/aia/mcp_discovery.rb +43 -15
- data/lib/aia/mcp_grouper.rb +2 -1
- data/lib/aia/mcp_server_config.rb +48 -0
- data/lib/aia/mcp_utility.rb +28 -20
- data/lib/aia/mention_router.rb +22 -52
- data/lib/aia/modality_query.rb +36 -0
- data/lib/aia/model_alias_registry.rb +11 -11
- data/lib/aia/model_registry.rb +75 -0
- data/lib/aia/network_builder.rb +17 -11
- data/lib/aia/network_memory_manager.rb +6 -6
- data/lib/aia/patches/ruby_llm_streaming_error.rb +21 -4
- data/lib/aia/patches/ruby_llm_tool_param_compat.rb +18 -0
- data/lib/aia/pipeline_orchestrator.rb +88 -45
- data/lib/aia/plugin_monitor.rb +9 -6
- data/lib/aia/prompt_decomposer.rb +6 -4
- data/lib/aia/prompt_handler.rb +90 -69
- data/lib/aia/provider_registry.rb +105 -0
- data/lib/aia/robot_builder.rb +1 -1
- data/lib/aia/robot_factory.rb +77 -69
- data/lib/aia/robot_namer.rb +2 -8
- data/lib/aia/robot_sync.rb +79 -0
- data/lib/aia/role_catalog.rb +89 -0
- data/lib/aia/session.rb +32 -14
- data/lib/aia/session_tracker.rb +39 -41
- data/lib/aia/similarity_scorer.rb +5 -3
- data/lib/aia/skill_utils.rb +60 -19
- data/lib/aia/spawn_handler.rb +16 -4
- data/lib/aia/spawn_spec_parser.rb +6 -7
- data/lib/aia/special_mode_handler.rb +80 -57
- data/lib/aia/speech.rb +103 -0
- data/lib/aia/startup_coordinator.rb +17 -91
- data/lib/aia/streaming_runner.rb +16 -5
- data/lib/aia/system_prompt_assembler.rb +20 -15
- data/lib/aia/task_board.rb +60 -0
- data/lib/aia/task_coordinator.rb +10 -5
- data/lib/aia/timing.rb +15 -0
- data/lib/aia/tool_approver.rb +205 -0
- data/lib/aia/tool_filter.rb +1 -9
- data/lib/aia/tool_filter_strategy.rb +39 -25
- data/lib/aia/tool_introspection.rb +25 -0
- data/lib/aia/tool_loader.rb +71 -31
- data/lib/aia/tool_utility.rb +6 -5
- data/lib/aia/tools/delegate_to_foreman_tool.rb +6 -4
- data/lib/aia/tools/recruit_robot_tool.rb +12 -12
- data/lib/aia/tools/reskill_robot_tool.rb +7 -7
- data/lib/aia/tools/task_board_tool.rb +17 -16
- data/lib/aia/trakflow_bridge.rb +19 -11
- data/lib/aia/turn_state.rb +32 -8
- data/lib/aia/ui_presenter.rb +83 -59
- data/lib/aia/utility.rb +8 -24
- data/lib/aia/variable_input_collector.rb +1 -3
- data/lib/aia/verification_network.rb +10 -12
- data/lib/aia.rb +49 -8
- metadata +27 -162
- data/.better-commits.json +0 -150
- data/.config/tocer/configuration.yml +0 -6
- data/.envrc +0 -15
- data/.loki +0 -231
- data/.quality/flay_baseline.txt +0 -1
- data/.quality/flog_baseline.txt +0 -29
- data/.quality/reek_baseline.txt +0 -80
- data/.rubocop.yml +0 -116
- data/COMMITS.md +0 -196
- data/IMPLEMENTATION_PLAN.md +0 -506
- data/Rakefile +0 -160
- data/architecture_review.md +0 -314
- data/docs/AGENTS.md +0 -40
- data/docs/advanced-prompting.md +0 -814
- data/docs/assets/images/aia.png +0 -0
- data/docs/cli-reference.md +0 -1241
- data/docs/configuration.md +0 -747
- data/docs/contributing.md +0 -386
- data/docs/directives-reference.md +0 -1145
- data/docs/examples/index.md +0 -277
- data/docs/examples/mcp/index.md +0 -475
- data/docs/examples/prompts/analysis/index.md +0 -78
- data/docs/examples/prompts/automation/index.md +0 -109
- data/docs/examples/prompts/development/index.md +0 -125
- data/docs/examples/prompts/index.md +0 -333
- data/docs/examples/prompts/learning/index.md +0 -127
- data/docs/examples/prompts/writing/index.md +0 -62
- data/docs/examples/tools/index.md +0 -282
- data/docs/faq.md +0 -578
- data/docs/guides/available-models.md +0 -366
- data/docs/guides/basic-usage.md +0 -478
- data/docs/guides/chat.md +0 -680
- data/docs/guides/crew.md +0 -239
- data/docs/guides/executable-prompts.md +0 -331
- data/docs/guides/first-prompt.md +0 -454
- data/docs/guides/getting-started.md +0 -455
- data/docs/guides/image-generation.md +0 -507
- data/docs/guides/index.md +0 -48
- data/docs/guides/local-models.md +0 -306
- data/docs/guides/migrate-prompts.md +0 -335
- data/docs/guides/models.md +0 -1017
- data/docs/guides/shared-tools.md +0 -254
- data/docs/guides/tools.md +0 -831
- data/docs/index.md +0 -259
- data/docs/installation.md +0 -274
- data/docs/mcp-integration.md +0 -603
- data/docs/prompt_management.md +0 -665
- data/docs/security.md +0 -674
- data/docs/special_projects_guide.md +0 -386
- data/docs/tools-and-mcp-examples.md +0 -1211
- data/docs/workflows-and-pipelines.md +0 -636
- data/examples/.gitignore +0 -2
- data/examples/00_setup_aia.sh +0 -111
- data/examples/01_basic_usage.sh +0 -23
- data/examples/02_frontmatter.sh +0 -33
- data/examples/03_shell_integration.sh +0 -55
- data/examples/04_erb_templating.sh +0 -56
- data/examples/05_shell_then_erb.sh +0 -38
- data/examples/06_prompt_chaining.sh +0 -59
- data/examples/07_pipeline.sh +0 -46
- data/examples/08_context_files.sh +0 -43
- data/examples/09_roles.sh +0 -67
- data/examples/10_stdin_piping.sh +0 -49
- data/examples/11_multi_model.sh +0 -65
- data/examples/12_token_usage.sh +0 -52
- data/examples/13_cost_tracking.sh +0 -68
- data/examples/14_output_file.sh +0 -91
- data/examples/15_parameters.sh +0 -68
- data/examples/16_directives.sh +0 -113
- data/examples/17_require_and_conditionals.sh +0 -68
- data/examples/18_tools.sh +0 -61
- data/examples/19_local_tools.sh +0 -34
- data/examples/20_mcp_servers.sh +0 -102
- data/examples/21_executable_prompts.sh +0 -78
- data/examples/22_chat_mode.sh +0 -217
- data/examples/23_verify.sh +0 -139
- data/examples/24_decompose.sh +0 -139
- data/examples/25_spawn.sh +0 -139
- data/examples/26_debate.sh +0 -97
- data/examples/27_mention_routing.sh +0 -157
- data/examples/28_model_switching.sh +0 -106
- data/examples/29_agent_harness.sh +0 -177
- data/examples/README.md +0 -321
- data/examples/advanced_multi_robot_capabilities_without_examples.md +0 -106
- data/examples/aia_config.yml +0 -22
- data/examples/aia_config_orchestrator.yml +0 -45
- data/examples/aia_config_with_mcp.yml +0 -21
- data/examples/common.sh +0 -39
- data/examples/context/project_goals.md +0 -6
- data/examples/context/tech_stack.md +0 -7
- data/examples/directives/timestamp_directive.rb +0 -22
- data/examples/mcp/filesystem.json +0 -9
- data/examples/prompts_dir/analyze.md +0 -2
- data/examples/prompts_dir/brainstorm.md +0 -2
- data/examples/prompts_dir/conditional.md +0 -17
- data/examples/prompts_dir/creative.md +0 -4
- data/examples/prompts_dir/erbinfo.md +0 -5
- data/examples/prompts_dir/erbinfo_raw.md +0 -8
- data/examples/prompts_dir/evaluate.md +0 -2
- data/examples/prompts_dir/explain_joke.md +0 -1
- data/examples/prompts_dir/explain_recursion.md +0 -1
- data/examples/prompts_dir/fun_fact +0 -3
- data/examples/prompts_dir/greeting.md +0 -8
- data/examples/prompts_dir/greeting_required.md +0 -7
- data/examples/prompts_dir/hello.md +0 -1
- data/examples/prompts_dir/includes/ruby_facts.md +0 -4
- data/examples/prompts_dir/limerick.md +0 -1
- data/examples/prompts_dir/list_with_mcp.md +0 -3
- data/examples/prompts_dir/pick_best.md +0 -2
- data/examples/prompts_dir/project_summary +0 -12
- data/examples/prompts_dir/quiz_with_include.md +0 -6
- data/examples/prompts_dir/require_demo.md +0 -5
- data/examples/prompts_dir/roles/formal.md +0 -3
- data/examples/prompts_dir/roles/orchestrator.md +0 -21
- data/examples/prompts_dir/roles/pirate.md +0 -3
- data/examples/prompts_dir/shell_then_erb.md +0 -6
- data/examples/prompts_dir/sort_compare.md +0 -2
- data/examples/prompts_dir/summarize_context.md +0 -2
- data/examples/prompts_dir/sysinfo.md +0 -5
- data/examples/prompts_dir/sysinfo_raw.md +0 -8
- data/examples/prompts_dir/tagline.md +0 -1
- data/examples/prompts_dir/tell_joke.md +0 -1
- data/examples/prompts_dir/tell_joke_with_next.md +0 -4
- data/examples/prompts_dir/use_local_tool.md +0 -8
- data/examples/prompts_dir/use_tools.md +0 -8
- data/examples/prompts_dir/weather.md +0 -2
- data/examples/prompts_dir/whats_new.md +0 -2
- data/examples/prompts_dir/with_timestamp.md +0 -5
- data/examples/requirements/sinatra_taskflow_app.md +0 -139
- data/examples/rules/01_classify_ruby.rb +0 -16
- data/examples/rules/02_prefer_claude_for_code.rb +0 -19
- data/examples/rules/03_gate_prompt_length.rb +0 -19
- data/examples/rules/04_tool_selection.rb +0 -41
- data/examples/rules/README.md +0 -30
- data/examples/run_all.sh +0 -294
- data/examples/tools/word_count_tool.rb +0 -30
- data/lib/AGENTS.md +0 -57
- data/lib/aia/model_switch_handler.rb +0 -100
- data/mcp_servers/README.md +0 -110
- data/mcp_servers/apple-mcp.json +0 -8
- data/mcp_servers/filesystem.json +0 -9
- data/mcp_servers/mcp_server_chart.json +0 -11
- data/mcp_servers/playwright_one.json +0 -8
- data/mcp_servers/playwright_server_definition.json +0 -9
- data/mcp_servers/playwright_two.json +0 -8
- data/mcp_servers/tavily_mcp_server.json +0 -8
- data/mkdocs.yml +0 -169
data/lib/aia/streaming_runner.rb
CHANGED
|
@@ -28,6 +28,8 @@ module AIA
|
|
|
28
28
|
# @param spinner_message [String] spinner label
|
|
29
29
|
# @param tools [Array<String>, nil] tool names to allow for this turn (nil = all)
|
|
30
30
|
# @return [Array(Object, String, Float)] [result, streamed_content_or_nil, elapsed_seconds]
|
|
31
|
+
# :reek:TooManyStatements -- one streaming turn: spinner lifecycle, chunk-filter closure, robot run with cleanup, timing
|
|
32
|
+
# :reek:DuplicateMethodCall -- @spinner.stop guards three distinct control paths (first chunk, exception, completion)
|
|
31
33
|
def run(robot, prompt, header: "\nAI:\n ", spinner_message: "Processing...", tools: nil)
|
|
32
34
|
@spinner.reset
|
|
33
35
|
@spinner.update(title: spinner_message)
|
|
@@ -63,7 +65,7 @@ module AIA
|
|
|
63
65
|
tools_param = resolve_tools_param(tools, robot)
|
|
64
66
|
|
|
65
67
|
begin
|
|
66
|
-
result = robot.run(prompt, mcp: :inherit, tools: tools_param, &streaming_block)
|
|
68
|
+
result = with_approval_spinner { robot.run(prompt, mcp: :inherit, tools: tools_param, &streaming_block) }
|
|
67
69
|
rescue Exception # rubocop:disable Lint/RescueException
|
|
68
70
|
@spinner.stop unless header_printed
|
|
69
71
|
raise
|
|
@@ -77,6 +79,14 @@ module AIA
|
|
|
77
79
|
|
|
78
80
|
private
|
|
79
81
|
|
|
82
|
+
# Let ToolApprover pause this turn's spinner while an approval prompt is on screen.
|
|
83
|
+
def with_approval_spinner
|
|
84
|
+
ToolApprover.spinner = @spinner
|
|
85
|
+
yield
|
|
86
|
+
ensure
|
|
87
|
+
ToolApprover.spinner = nil
|
|
88
|
+
end
|
|
89
|
+
|
|
80
90
|
# Translate the resolved tool list into robot_lab's ToolConfig vocabulary,
|
|
81
91
|
# then clamp it to the provider's limit:
|
|
82
92
|
# nil -> :inherit (no filter active / filter errored — use the full set)
|
|
@@ -107,11 +117,12 @@ module AIA
|
|
|
107
117
|
|
|
108
118
|
max = max_tools
|
|
109
119
|
names = tools_param == :inherit ? robot_tool_names(robot) : tools_param
|
|
110
|
-
|
|
120
|
+
size = names.size
|
|
121
|
+
return tools_param if size <= max
|
|
111
122
|
|
|
112
|
-
dropped =
|
|
123
|
+
dropped = size - max
|
|
113
124
|
$stderr.puts(
|
|
114
|
-
"⚠ Tool list (#{
|
|
125
|
+
"⚠ Tool list (#{size}) exceeds the provider limit of #{max}; " \
|
|
115
126
|
"sending #{max}, dropping #{dropped}. Enable --auto-tool-filter or reduce " \
|
|
116
127
|
"the available tools to control which ones are sent."
|
|
117
128
|
)
|
|
@@ -129,7 +140,7 @@ module AIA
|
|
|
129
140
|
def robot_tool_names(robot)
|
|
130
141
|
local = robot.respond_to?(:local_tools) ? Array(robot.local_tools) : []
|
|
131
142
|
mcp = robot.respond_to?(:mcp_tools) ? Array(robot.mcp_tools) : []
|
|
132
|
-
(local + mcp).map { |t|
|
|
143
|
+
(local + mcp).map { |t| ToolIntrospection.tool_name(t) }
|
|
133
144
|
end
|
|
134
145
|
|
|
135
146
|
def show_thinking?
|
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
# Extracted from RobotFactory to isolate the prompt assembly concern.
|
|
7
7
|
# Completely stateless — no module ivars.
|
|
8
8
|
|
|
9
|
+
require 'pm'
|
|
9
10
|
require_relative 'skill_utils'
|
|
11
|
+
require_relative 'role_catalog'
|
|
10
12
|
|
|
11
13
|
module AIA
|
|
12
14
|
module SystemPromptAssembler
|
|
@@ -18,9 +20,10 @@ module AIA
|
|
|
18
20
|
# @param model_spec [ModelSpec, nil] optional model spec with role override
|
|
19
21
|
# @return [String, nil] the assembled system prompt
|
|
20
22
|
def resolve_system_prompt(config, model_spec = nil)
|
|
21
|
-
|
|
23
|
+
prompts_cfg = config.prompts
|
|
24
|
+
system_prompt = prompts_cfg.system_prompt
|
|
22
25
|
|
|
23
|
-
role_id = model_spec&.role ||
|
|
26
|
+
role_id = model_spec&.role || prompts_cfg.role
|
|
24
27
|
if role_id && !role_id.empty?
|
|
25
28
|
role_content = load_role_content(config, role_id)
|
|
26
29
|
if role_content
|
|
@@ -32,7 +35,7 @@ module AIA
|
|
|
32
35
|
# Pipeline mode appends skills to each prompt text instead (pipeline_orchestrator).
|
|
33
36
|
if config.flags&.chat == true
|
|
34
37
|
skill_content = AIA::SkillUtils.load_skills_content(
|
|
35
|
-
Array(
|
|
38
|
+
Array(prompts_cfg&.skills),
|
|
36
39
|
AIA::SkillUtils.skills_base_dir(config)
|
|
37
40
|
)
|
|
38
41
|
system_prompt = [system_prompt, skill_content].compact.join("\n\n") if skill_content
|
|
@@ -48,6 +51,7 @@ module AIA
|
|
|
48
51
|
# @param spec [ModelSpec] this robot's model spec
|
|
49
52
|
# @param roster [Array<Hash>] all robots: [{ name:, spec: }, ...]
|
|
50
53
|
# @return [String]
|
|
54
|
+
# :reek:TooManyStatements -- builds the identity line plus a roster entry per teammate; one cohesive prompt fragment
|
|
51
55
|
def build_identity_prompt(robot_name, spec, roster)
|
|
52
56
|
provider_label = spec.provider ? " (#{spec.provider})" : ""
|
|
53
57
|
lines = ["You are #{robot_name}, powered by #{spec.name}#{provider_label}."]
|
|
@@ -55,9 +59,10 @@ module AIA
|
|
|
55
59
|
if roster.size > 1
|
|
56
60
|
lines << "You are part of a team of AI robots:"
|
|
57
61
|
roster.each do |entry|
|
|
58
|
-
|
|
62
|
+
entry_spec = entry[:spec]
|
|
63
|
+
p = entry_spec.provider ? " (#{entry_spec.provider})" : ""
|
|
59
64
|
marker = entry[:name] == robot_name ? " ← you" : ""
|
|
60
|
-
lines << " - #{entry[:name]}: #{
|
|
65
|
+
lines << " - #{entry[:name]}: #{entry_spec.name}#{p}#{marker}"
|
|
61
66
|
end
|
|
62
67
|
lines << "Users can address a specific robot with @name mentions."
|
|
63
68
|
end
|
|
@@ -65,21 +70,21 @@ module AIA
|
|
|
65
70
|
lines.join("\n")
|
|
66
71
|
end
|
|
67
72
|
|
|
68
|
-
# Load role
|
|
73
|
+
# Load a role for the system prompt. Named roles come from the roles
|
|
74
|
+
# folder of the prompts directory; path-based roles from anywhere. The
|
|
75
|
+
# file is processed like a prompt: front matter removed, shell and ERB
|
|
76
|
+
# expanded.
|
|
69
77
|
#
|
|
70
78
|
# @param config [AIA::Config] the AIA configuration
|
|
71
|
-
# @param role_id [String] the role identifier
|
|
72
|
-
# @return [String, nil] the role
|
|
79
|
+
# @param role_id [String] the role identifier or path
|
|
80
|
+
# @return [String, nil] the rendered role, or nil if it is missing or fails
|
|
73
81
|
def load_role_content(config, role_id)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
role_file = File.join(config.prompts.dir, "#{role_id}#{config.prompts.extname}")
|
|
82
|
+
prompts_cfg = config.prompts
|
|
83
|
+
role_file = AIA::RoleCatalog.role_file(role_id, dir: prompts_cfg.dir, prefix: prompts_cfg.roles_prefix,
|
|
84
|
+
extname: prompts_cfg.extname)
|
|
80
85
|
return nil unless File.exist?(role_file)
|
|
81
86
|
|
|
82
|
-
|
|
87
|
+
PM.parse(Pathname.new(role_file)).to_s
|
|
83
88
|
rescue => e
|
|
84
89
|
$stderr.puts "Warning: Could not load role '#{role_id}': #{e.message}"
|
|
85
90
|
nil
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# lib/aia/task_board.rb
|
|
4
|
+
#
|
|
5
|
+
# The TrakFlow task board, started on first use. Nothing touches the disk
|
|
6
|
+
# until a feature that records tasks (/task, /delegate, /spawn tracking,
|
|
7
|
+
# --track-pipeline, the task-board tools) actually needs it, so a plain
|
|
8
|
+
# session leaves no .trak_flow directory behind.
|
|
9
|
+
|
|
10
|
+
require 'fileutils'
|
|
11
|
+
|
|
12
|
+
module AIA
|
|
13
|
+
module TaskBoard
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
# Whether the trak_flow gem can be loaded.
|
|
17
|
+
#
|
|
18
|
+
# @return [Boolean]
|
|
19
|
+
def gem_available?
|
|
20
|
+
return true if defined?(TrakFlow)
|
|
21
|
+
|
|
22
|
+
require 'trak_flow'
|
|
23
|
+
true
|
|
24
|
+
rescue LoadError
|
|
25
|
+
false
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Make sure a TrakFlow project exists, creating .trak_flow in the current
|
|
29
|
+
# directory when none is found here or in a parent. The tasks themselves
|
|
30
|
+
# live in TrakFlow's database (~/.config/trak_flow/tf.db by default).
|
|
31
|
+
#
|
|
32
|
+
# @return [Boolean] true when the project is ready
|
|
33
|
+
def ensure_project!
|
|
34
|
+
return false unless gem_available?
|
|
35
|
+
return true if TrakFlow.initialized?
|
|
36
|
+
|
|
37
|
+
FileUtils.mkdir_p(TrakFlow.trak_flow_dir)
|
|
38
|
+
TrakFlow::Storage::Database.new.connect
|
|
39
|
+
TrakFlow.reset_root!
|
|
40
|
+
TrakFlow.initialized?
|
|
41
|
+
rescue StandardError => e
|
|
42
|
+
AIA.debug_warn("TrakFlow initialization failed (non-fatal): #{e.message}", exc: e)
|
|
43
|
+
false
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# A TaskCoordinator on a ready project, or nil when TrakFlow can't run.
|
|
47
|
+
#
|
|
48
|
+
# @return [AIA::TaskCoordinator, nil]
|
|
49
|
+
def coordinator
|
|
50
|
+
return nil unless ensure_project!
|
|
51
|
+
|
|
52
|
+
require_relative 'trakflow_bridge'
|
|
53
|
+
require_relative 'task_coordinator'
|
|
54
|
+
TaskCoordinator.new
|
|
55
|
+
rescue StandardError => e
|
|
56
|
+
AIA.debug_warn("TaskCoordinator initialization failed (non-fatal): #{e.message}", exc: e)
|
|
57
|
+
nil
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
data/lib/aia/task_coordinator.rb
CHANGED
|
@@ -33,6 +33,7 @@ module AIA
|
|
|
33
33
|
# @param labels [Array<String>] labels like "robot:alice", "domain:code"
|
|
34
34
|
# @param creator [String] name of the creating robot
|
|
35
35
|
# @return [TrakFlow::Models::Task, nil]
|
|
36
|
+
# :reek:LongParameterList { max_params: 6 } -- one keyword per optional task attribute; callers set only what they need
|
|
36
37
|
def create_task(title, assignee: nil, parent_id: nil,
|
|
37
38
|
blocked_by: [], labels: [], creator: "aia")
|
|
38
39
|
return nil unless available?
|
|
@@ -40,27 +41,28 @@ module AIA
|
|
|
40
41
|
task = TrakFlow::Models::Task.new(
|
|
41
42
|
title: title, assignee: assignee, type: "task"
|
|
42
43
|
)
|
|
43
|
-
task
|
|
44
|
+
task = @db.create_task(task)
|
|
45
|
+
task_id = task.id
|
|
44
46
|
|
|
45
47
|
@db.add_label(TrakFlow::Models::Label.new(
|
|
46
|
-
task_id:
|
|
48
|
+
task_id: task_id, name: "creator:#{creator}"
|
|
47
49
|
))
|
|
48
50
|
|
|
49
51
|
labels.each do |label|
|
|
50
52
|
@db.add_label(TrakFlow::Models::Label.new(
|
|
51
|
-
task_id:
|
|
53
|
+
task_id: task_id, name: label
|
|
52
54
|
))
|
|
53
55
|
end
|
|
54
56
|
|
|
55
57
|
blocked_by.each do |blocker_id|
|
|
56
58
|
@db.add_dependency(TrakFlow::Models::Dependency.new(
|
|
57
|
-
source_id: blocker_id, target_id:
|
|
59
|
+
source_id: blocker_id, target_id: task_id, type: "blocks"
|
|
58
60
|
))
|
|
59
61
|
end
|
|
60
62
|
|
|
61
63
|
if parent_id
|
|
62
64
|
@db.add_dependency(TrakFlow::Models::Dependency.new(
|
|
63
|
-
source_id: parent_id, target_id:
|
|
65
|
+
source_id: parent_id, target_id: task_id, type: "parent-child"
|
|
64
66
|
))
|
|
65
67
|
end
|
|
66
68
|
|
|
@@ -74,6 +76,8 @@ module AIA
|
|
|
74
76
|
# @param creator [String] creating robot name
|
|
75
77
|
# @param ephemeral [Boolean] true for single-session plans (auto-gc)
|
|
76
78
|
# @return [Hash, nil] { plan:, steps: }
|
|
79
|
+
# :reek:BooleanParameter -- ephemeral: tags a plan for auto-gc at session end; a second method would duplicate the whole build
|
|
80
|
+
# :reek:TooManyStatements -- plan build: create the plan task, then per step a child task, labels, and ordering dependency
|
|
77
81
|
def create_plan(title, steps:, creator: "aia", ephemeral: false)
|
|
78
82
|
return nil unless available?
|
|
79
83
|
|
|
@@ -177,6 +181,7 @@ module AIA
|
|
|
177
181
|
# Summary of the current task board state.
|
|
178
182
|
#
|
|
179
183
|
# @return [String, nil]
|
|
184
|
+
# :reek:TooManyStatements -- one board report: totals line, per-assignee open/done counts, unassigned tail
|
|
180
185
|
def status_summary
|
|
181
186
|
return nil unless available?
|
|
182
187
|
|
data/lib/aia/timing.rb
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# lib/aia/timing.rb
|
|
2
|
+
|
|
3
|
+
module AIA
|
|
4
|
+
# Monotonic-clock instrumentation shared by benchmark-reporting code.
|
|
5
|
+
module Timing
|
|
6
|
+
module_function
|
|
7
|
+
|
|
8
|
+
# Run the block and return [result, elapsed_seconds].
|
|
9
|
+
def timed
|
|
10
|
+
t0 = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
11
|
+
result = yield
|
|
12
|
+
[result, Process.clock_gettime(Process::CLOCK_MONOTONIC) - t0]
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# lib/aia/tool_approver.rb
|
|
4
|
+
#
|
|
5
|
+
# Settles what robot_lab pauses a run for: tool calls that require approval
|
|
6
|
+
# (an MCP server's `requires_approval:`, or a RubyLLM::Tool that declares
|
|
7
|
+
# it) and MCP input requests (elicitation: a server asking the user for
|
|
8
|
+
# values, or to visit a URL).
|
|
9
|
+
#
|
|
10
|
+
# The mode comes from `tools.approval` (CLI: --tool-approval, env:
|
|
11
|
+
# AIA_TOOLS__APPROVAL):
|
|
12
|
+
#
|
|
13
|
+
# ask -- prompt on the terminal; deny when there is no terminal (default)
|
|
14
|
+
# approve -- allow every tool call that requires approval
|
|
15
|
+
# deny -- refuse them all and decline every input request
|
|
16
|
+
#
|
|
17
|
+
# Prompts go to $stderr so they never mix with the AI's answer on $stdout,
|
|
18
|
+
# and the turn's spinner is paused while one is shown.
|
|
19
|
+
|
|
20
|
+
module AIA
|
|
21
|
+
class ToolApprover
|
|
22
|
+
MODES = %w[ask approve deny].freeze
|
|
23
|
+
DEFAULT_MODE = 'ask'
|
|
24
|
+
YES = %w[y yes].freeze
|
|
25
|
+
|
|
26
|
+
# One prompt at a time: robots in a parallel network run on their own threads.
|
|
27
|
+
PROMPT_LOCK = Mutex.new
|
|
28
|
+
|
|
29
|
+
class << self
|
|
30
|
+
# The spinner of the turn in progress (set by StreamingRunner), paused
|
|
31
|
+
# while a prompt is on screen.
|
|
32
|
+
attr_accessor :spinner
|
|
33
|
+
|
|
34
|
+
# The approval settings for RobotLab.build / RobotLab::RunConfig.
|
|
35
|
+
#
|
|
36
|
+
# @param config [AIA::Config]
|
|
37
|
+
# @return [Hash] tool_approval:, plus on_tool_approval: / on_input_request: when they apply
|
|
38
|
+
def options(config)
|
|
39
|
+
new(mode: mode_for(config)).options
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# @param config [AIA::Config]
|
|
43
|
+
# @return [String] one of MODES
|
|
44
|
+
def mode_for(config)
|
|
45
|
+
tools = config.tools if config.respond_to?(:tools)
|
|
46
|
+
mode = (tools.approval if tools.respond_to?(:approval)).to_s.strip.downcase
|
|
47
|
+
mode = DEFAULT_MODE if mode.empty?
|
|
48
|
+
return mode if MODES.include?(mode)
|
|
49
|
+
|
|
50
|
+
AIA.debug_warn("Unknown tools.approval '#{mode}' (expected #{MODES.join(', ')}); using '#{DEFAULT_MODE}'")
|
|
51
|
+
DEFAULT_MODE
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
attr_reader :mode
|
|
56
|
+
|
|
57
|
+
# @param mode [String] one of MODES
|
|
58
|
+
# @param input [IO] where answers are read from
|
|
59
|
+
# @param output [IO] where prompts are written
|
|
60
|
+
# @param interactive [Boolean, nil] whether a person can answer; defaults to input.tty?
|
|
61
|
+
def initialize(mode: DEFAULT_MODE, input: $stdin, output: $stderr, interactive: nil)
|
|
62
|
+
@mode = mode.to_s
|
|
63
|
+
@input = input
|
|
64
|
+
@output = output
|
|
65
|
+
@interactive = interactive
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
# @return [Hash] the robot_lab settings for this mode
|
|
69
|
+
def options
|
|
70
|
+
case mode
|
|
71
|
+
when 'approve' then { tool_approval: :approve, on_input_request: method(:answer_input) }
|
|
72
|
+
when 'deny' then { tool_approval: :deny }
|
|
73
|
+
else { tool_approval: :deny, on_tool_approval: method(:approve?), on_input_request: method(:answer_input) }
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Ask whether a tool call that requires approval may run.
|
|
78
|
+
#
|
|
79
|
+
# @param tool_call [RubyLLM::ToolCall]
|
|
80
|
+
# @return [Boolean]
|
|
81
|
+
def approve?(tool_call)
|
|
82
|
+
return refuse("tool '#{tool_call.name}' requires approval and there is no terminal to ask") unless interactive?
|
|
83
|
+
|
|
84
|
+
prompting do
|
|
85
|
+
@output.puts "\nTool '#{tool_call.name}' requires approval."
|
|
86
|
+
@output.puts " arguments: #{format_arguments(tool_call.arguments)}"
|
|
87
|
+
YES.include?(ask(' Allow it? [y/N] ').downcase)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# Answer an MCP server's request for input.
|
|
92
|
+
#
|
|
93
|
+
# @param request [RubyLLM::MCP::InputRequest]
|
|
94
|
+
# @return [Hash, true, nil] field values, true to accept a URL request, nil to decline
|
|
95
|
+
def answer_input(request)
|
|
96
|
+
return refuse("an MCP server asked for input (#{request.message}) and there is no terminal to ask") unless interactive?
|
|
97
|
+
|
|
98
|
+
prompting do
|
|
99
|
+
@output.puts "\nAn MCP server needs your input: #{request.message}"
|
|
100
|
+
request.url? ? answer_url(request) : answer_form(request)
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
private
|
|
105
|
+
|
|
106
|
+
def interactive?
|
|
107
|
+
@interactive.nil? ? @input.respond_to?(:tty?) && @input.tty? : @interactive
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def refuse(reason)
|
|
111
|
+
AIA.logger&.warn("Tool approval: #{reason}; refusing")
|
|
112
|
+
@output.puts "[AIA] Refused: #{reason}. Set tools.approval (--tool-approval) to approve or deny."
|
|
113
|
+
nil
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Pause the spinner and hold the prompt lock while a question is on screen.
|
|
117
|
+
def prompting
|
|
118
|
+
PROMPT_LOCK.synchronize do
|
|
119
|
+
spinner = self.class.spinner
|
|
120
|
+
was_spinning = spinner&.spinning?
|
|
121
|
+
spinner&.pause if was_spinning
|
|
122
|
+
begin
|
|
123
|
+
yield
|
|
124
|
+
ensure
|
|
125
|
+
spinner&.resume if was_spinning
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
def ask(question)
|
|
131
|
+
@output.print question
|
|
132
|
+
@output.flush if @output.respond_to?(:flush)
|
|
133
|
+
@input.gets.to_s.strip
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def answer_url(request)
|
|
137
|
+
@output.puts " Open this page: #{request.url}"
|
|
138
|
+
true if YES.include?(ask(' Continue once you have visited it? [y/N] ').downcase)
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Each field is asked in turn. A blank answer keeps the server's default;
|
|
142
|
+
# a blank answer to a required field without one declines the request.
|
|
143
|
+
def answer_form(request)
|
|
144
|
+
request.fields.each_with_object({}) do |field, values|
|
|
145
|
+
value = ask_field(field)
|
|
146
|
+
return nil if value == :decline
|
|
147
|
+
|
|
148
|
+
values[field.name] = value unless value.nil?
|
|
149
|
+
end
|
|
150
|
+
end
|
|
151
|
+
|
|
152
|
+
# @return [Object, nil, :decline] the typed value, nil to keep the default, :decline to give up
|
|
153
|
+
def ask_field(field)
|
|
154
|
+
loop do
|
|
155
|
+
raw = ask(field_question(field))
|
|
156
|
+
return blank_answer(field) if raw.empty?
|
|
157
|
+
|
|
158
|
+
value = cast(raw, field)
|
|
159
|
+
return value unless value.nil?
|
|
160
|
+
|
|
161
|
+
@output.puts " '#{raw}' is not a valid #{field.choices ? "choice (#{field.choices.join(', ')})" : field.type}."
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def blank_answer(field)
|
|
166
|
+
field.required? && field.default.nil? ? :decline : nil
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def field_question(field)
|
|
170
|
+
label = field.title || field.name.to_s
|
|
171
|
+
parts = [" #{label}"]
|
|
172
|
+
parts << "(#{field.description})" if field.description
|
|
173
|
+
parts << "[#{field.choices.join('/')}]" if field.choices
|
|
174
|
+
parts << "default: #{field.default}" unless field.default.nil?
|
|
175
|
+
parts << '*' if field.required?
|
|
176
|
+
"#{parts.join(' ')}: "
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
# @return [Object, nil] nil when +raw+ does not fit the field
|
|
180
|
+
def cast(raw, field)
|
|
181
|
+
choices = field.choices
|
|
182
|
+
return choices.find { it.to_s == raw } if choices
|
|
183
|
+
|
|
184
|
+
case field.type
|
|
185
|
+
when 'integer' then Integer(raw, exception: false)
|
|
186
|
+
when 'number' then Float(raw, exception: false)
|
|
187
|
+
when 'boolean' then boolean(raw)
|
|
188
|
+
else raw
|
|
189
|
+
end
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
def boolean(raw)
|
|
193
|
+
return true if %w[y yes true 1].include?(raw.downcase)
|
|
194
|
+
return false if %w[n no false 0].include?(raw.downcase)
|
|
195
|
+
|
|
196
|
+
nil
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def format_arguments(arguments)
|
|
200
|
+
text = arguments.to_h.map { |key, value| "#{key}=#{value.inspect}" }.join(', ')
|
|
201
|
+
text = '(none)' if text.empty?
|
|
202
|
+
text.length > 300 ? "#{text[0, 300]}..." : text
|
|
203
|
+
end
|
|
204
|
+
end
|
|
205
|
+
end
|
data/lib/aia/tool_filter.rb
CHANGED
|
@@ -13,11 +13,8 @@ module AIA
|
|
|
13
13
|
class ToolFilter
|
|
14
14
|
attr_reader :tool_count, :prep_ms, :label
|
|
15
15
|
|
|
16
|
-
def initialize(label
|
|
16
|
+
def initialize(label:)
|
|
17
17
|
@label = label
|
|
18
|
-
@db_dir = db_dir
|
|
19
|
-
@load_db = load_db
|
|
20
|
-
@save_db = save_db
|
|
21
18
|
@tool_count = 0
|
|
22
19
|
@prep_ms = 0.0
|
|
23
20
|
end
|
|
@@ -48,11 +45,6 @@ module AIA
|
|
|
48
45
|
@tool_count.positive?
|
|
49
46
|
end
|
|
50
47
|
|
|
51
|
-
# True when this filter supports database persistence (--load / --save).
|
|
52
|
-
def persistable?
|
|
53
|
-
false
|
|
54
|
-
end
|
|
55
|
-
|
|
56
48
|
protected
|
|
57
49
|
|
|
58
50
|
def do_prep
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
# After each resolve(), prints a timing table showing
|
|
9
9
|
# prep and filter times for the active filter.
|
|
10
10
|
|
|
11
|
+
require 'tty-table'
|
|
12
|
+
|
|
11
13
|
module AIA
|
|
12
14
|
class ToolFilterStrategy
|
|
13
15
|
# Maps filter keys to display info.
|
|
@@ -17,6 +19,17 @@ module AIA
|
|
|
17
19
|
|
|
18
20
|
DEFAULT_TIMEOUT_S = 10
|
|
19
21
|
|
|
22
|
+
# The per-filter timeout from config (tool_filter.timeout_s), or the default
|
|
23
|
+
# when it is unset or not a positive number.
|
|
24
|
+
#
|
|
25
|
+
# @param config [#tool_filter]
|
|
26
|
+
# @return [Numeric]
|
|
27
|
+
def self.timeout_from(config)
|
|
28
|
+
section = config.respond_to?(:tool_filter) ? config.tool_filter : nil
|
|
29
|
+
value = section.respond_to?(:timeout_s) ? section.timeout_s : nil
|
|
30
|
+
value.is_a?(Numeric) && value.positive? ? value : DEFAULT_TIMEOUT_S
|
|
31
|
+
end
|
|
32
|
+
|
|
20
33
|
# @param filters [Hash{Symbol => ToolFilter}] e.g. {tfidf: tfidf_filter}
|
|
21
34
|
# @param ui_presenter [UIPresenter, nil] for display (unused currently, reserved)
|
|
22
35
|
# @param timeout_s [Numeric] per-filter wall-clock timeout in seconds
|
|
@@ -88,26 +101,45 @@ module AIA
|
|
|
88
101
|
|
|
89
102
|
# Display single-filter results via logger.
|
|
90
103
|
def display_filter_results(key, scored)
|
|
91
|
-
meta
|
|
104
|
+
meta = meta_for(key)
|
|
105
|
+
label = meta[:label]
|
|
106
|
+
logger = AIA.logger
|
|
92
107
|
|
|
93
108
|
if scored.empty?
|
|
94
|
-
|
|
109
|
+
logger.debug "[#{label}] No tools matched (no tools sent this turn)"
|
|
95
110
|
return
|
|
96
111
|
end
|
|
97
112
|
|
|
98
113
|
names = scored.map { |e| e[:name] }.join(', ')
|
|
99
|
-
|
|
114
|
+
logger.debug "[#{label}] Tools for this turn (#{scored.size}): #{names}"
|
|
100
115
|
|
|
101
116
|
scored.each do |entry|
|
|
102
|
-
|
|
117
|
+
logger.debug "[#{label}] #{entry[:name]} (#{meta[:score_label]}: #{format('%.4f', entry[:score])})"
|
|
103
118
|
end
|
|
104
119
|
end
|
|
105
120
|
|
|
106
121
|
# Print the timing table via logger.
|
|
107
|
-
#
|
|
122
|
+
# :reek:DuplicateMethodCall -- header and each data row map the same columns into different cells
|
|
108
123
|
def display_timing_table(filter_ms_by_key)
|
|
109
|
-
columns =
|
|
110
|
-
|
|
124
|
+
columns = build_timing_columns(filter_ms_by_key)
|
|
125
|
+
return if columns.empty?
|
|
126
|
+
|
|
127
|
+
header = ["Process"] + columns.map { |col| "#{col[:header]}\n#{col[:sub]}" }
|
|
128
|
+
rows = [
|
|
129
|
+
["prep"] + columns.map { |col| col[:prep] },
|
|
130
|
+
["filter"] + columns.map { |col| col[:filter] }
|
|
131
|
+
]
|
|
132
|
+
|
|
133
|
+
alignments = [:left] + Array.new(columns.size, :right)
|
|
134
|
+
rendered = TTY::Table.new(header, rows)
|
|
135
|
+
.render(:unicode, multiline: true, alignments: alignments, padding: [0, 1])
|
|
136
|
+
rendered.each_line { |line| AIA.logger.debug(line.chomp) }
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
# Column data (header, sub-label, prep/filter cells) for each configured filter.
|
|
140
|
+
def build_timing_columns(filter_ms_by_key)
|
|
141
|
+
@filters.map do |key, filter|
|
|
142
|
+
meta = meta_for(key)
|
|
111
143
|
active = filter_ms_by_key.key?(key)
|
|
112
144
|
{
|
|
113
145
|
header: "Option #{meta[:letter]}",
|
|
@@ -116,25 +148,7 @@ module AIA
|
|
|
116
148
|
filter: active ? fmt_ms(filter_ms_by_key[key]) : "--"
|
|
117
149
|
}
|
|
118
150
|
end
|
|
119
|
-
|
|
120
|
-
return if columns.empty?
|
|
121
|
-
|
|
122
|
-
pw = 7 # "Process" column width
|
|
123
|
-
widths = columns.map do |col|
|
|
124
|
-
[10, col[:header].length, col[:sub].length, col[:prep].length, col[:filter].length].max
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
lines = []
|
|
128
|
-
lines << ("┌─#{'─' * pw}─" + columns.each_with_index.map { |_, i| "┬─#{'─' * widths[i]}─" }.join + "┐")
|
|
129
|
-
lines << ("│ #{'Process'.ljust(pw)} " + columns.each_with_index.map { |col, i| "│ #{col[:header].ljust(widths[i])} " }.join + "│")
|
|
130
|
-
lines << ("│ #{' ' * pw} " + columns.each_with_index.map { |col, i| "│ #{col[:sub].ljust(widths[i])} " }.join + "│")
|
|
131
|
-
lines << ("├─#{'─' * pw}─" + columns.each_with_index.map { |_, i| "┼─#{'─' * widths[i]}─" }.join + "┤")
|
|
132
|
-
lines << ("│ #{'prep'.ljust(pw)} " + columns.each_with_index.map { |col, i| "│ #{col[:prep].rjust(widths[i])} " }.join + "│")
|
|
133
|
-
lines << ("│ #{'filter'.ljust(pw)} " + columns.each_with_index.map { |col, i| "│ #{col[:filter].rjust(widths[i])} " }.join + "│")
|
|
134
|
-
lines << ("└─#{'─' * pw}─" + columns.each_with_index.map { |_, i| "┴─#{'─' * widths[i]}─" }.join + "┘")
|
|
135
|
-
lines.each { |line| AIA.logger.debug line }
|
|
136
151
|
end
|
|
137
|
-
# rubocop:enable Metrics/AbcSize
|
|
138
152
|
|
|
139
153
|
def fmt_ms(ms)
|
|
140
154
|
"#{ms.round(1)}ms"
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# lib/aia/tool_introspection.rb
|
|
2
|
+
|
|
3
|
+
module AIA
|
|
4
|
+
# Shared name/description extraction for tool objects, which may be
|
|
5
|
+
# RubyLLM tools, RobotLab tools, or bare tool classes.
|
|
6
|
+
module ToolIntrospection
|
|
7
|
+
module_function
|
|
8
|
+
|
|
9
|
+
# The name the model calls the tool by. A RubyLLM::Tool class answers
|
|
10
|
+
# with its +tool_name+ ("dns"), not its Ruby constant name
|
|
11
|
+
# ("SharedTools::Tools::DnsTool"): robot_lab instantiates tool classes,
|
|
12
|
+
# so allowlists and per-turn tool filters must use that name to match.
|
|
13
|
+
def tool_name(tool)
|
|
14
|
+
if tool.is_a?(Class)
|
|
15
|
+
tool.respond_to?(:tool_name) ? tool.tool_name : tool.name
|
|
16
|
+
else
|
|
17
|
+
tool.respond_to?(:name) ? tool.name : tool.class.name
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def tool_description(tool)
|
|
22
|
+
tool.respond_to?(:description) ? tool.description.to_s : ''
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|