aia 2.0.0.0.pre.beta2 → 2.0.1
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/CHANGELOG.md +152 -223
- data/README.md +41 -18
- 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 +16 -14
- data/lib/aia/config/cli_parser.rb +123 -91
- data/lib/aia/config/defaults.yml +18 -40
- data/lib/aia/config/mcp_parser.rb +30 -36
- data/lib/aia/config/model_spec.rb +8 -14
- data/lib/aia/config/validator.rb +102 -103
- data/lib/aia/config/value_caster.rb +76 -0
- data/lib/aia/config.rb +70 -53
- data/lib/aia/crew.rb +29 -19
- data/lib/aia/debate_handler.rb +27 -10
- data/lib/aia/directives/configuration_directives.rb +55 -14
- data/lib/aia/directives/context_directives.rb +24 -12
- data/lib/aia/directives/execution_directives.rb +18 -23
- data/lib/aia/directives/model_directives.rb +41 -104
- data/lib/aia/directives/utility_directives.rb +16 -17
- data/lib/aia/directives/web_and_file_directives.rb +21 -14
- data/lib/aia/fact_asserter.rb +3 -3
- data/lib/aia/history_transfer.rb +64 -24
- data/lib/aia/logger.rb +14 -46
- data/lib/aia/mcp_config_normalizer.rb +27 -14
- data/lib/aia/mcp_connection_manager.rb +181 -184
- data/lib/aia/mcp_discovery.rb +43 -15
- data/lib/aia/mcp_grouper.rb +2 -1
- data/lib/aia/mcp_server_config.rb +20 -2
- data/lib/aia/mcp_utility.rb +24 -19
- data/lib/aia/mention_router.rb +15 -2
- 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 +8 -7
- data/lib/aia/patches/mcp_stdio_stderr.rb +102 -0
- 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 +71 -38
- data/lib/aia/prompt_decomposer.rb +1 -1
- data/lib/aia/prompt_handler.rb +56 -29
- data/lib/aia/provider_registry.rb +105 -0
- data/lib/aia/robot_builder.rb +1 -1
- data/lib/aia/robot_factory.rb +67 -63
- data/lib/aia/robot_sync.rb +79 -0
- data/lib/aia/role_catalog.rb +89 -0
- data/lib/aia/session.rb +25 -11
- 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 +28 -25
- data/lib/aia/speech.rb +70 -34
- data/lib/aia/startup_coordinator.rb +17 -92
- data/lib/aia/streaming_runner.rb +10 -2
- data/lib/aia/system_prompt_assembler.rb +12 -11
- data/lib/aia/task_board.rb +60 -0
- data/lib/aia/tool_approver.rb +205 -0
- data/lib/aia/tool_filter.rb +1 -10
- data/lib/aia/tool_filter_strategy.rb +12 -1
- data/lib/aia/tool_introspection.rb +9 -1
- data/lib/aia/tool_loader.rb +67 -33
- 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 +16 -16
- data/lib/aia/trakflow_bridge.rb +14 -8
- data/lib/aia/turn_state.rb +31 -8
- data/lib/aia/ui_presenter.rb +16 -0
- data/lib/aia/utility.rb +6 -24
- data/lib/aia/variable_input_collector.rb +0 -3
- data/lib/aia/verification_network.rb +9 -10
- data/lib/aia/version.rb +1 -9
- data/lib/aia.rb +34 -8
- metadata +20 -161
- data/.better-commits.json +0 -150
- data/.config/tocer/configuration.yml +0 -6
- data/.envrc +0 -19
- data/.loki +0 -11
- data/.reek.yml +0 -160
- data/.rubocop.yml +0 -116
- data/.rubocop_strict.yml +0 -15
- data/.version +0 -1
- data/COMMITS.md +0 -196
- data/IMPLEMENTATION_PLAN.md +0 -506
- data/Rakefile +0 -47
- data/_typos.toml +0 -10
- data/aia.gemspec +0 -92
- data/architecture_review.md +0 -314
- data/config/aia.yml +0 -13
- 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/mcp_utility.rb
CHANGED
|
@@ -14,7 +14,6 @@ module AIA
|
|
|
14
14
|
def mcp_server_names
|
|
15
15
|
connected = AIA.config&.connected_mcp_servers
|
|
16
16
|
return connected unless connected.nil?
|
|
17
|
-
return RubyLLM::MCP.clients.keys if defined?(RubyLLM::MCP) && RubyLLM::MCP.clients.any?
|
|
18
17
|
effective_mcp_server_names
|
|
19
18
|
end
|
|
20
19
|
|
|
@@ -26,7 +25,6 @@ module AIA
|
|
|
26
25
|
AIA.config&.failed_mcp_servers || []
|
|
27
26
|
end
|
|
28
27
|
|
|
29
|
-
# :reek:TooManyStatements -- server-name resolution applying no_mcp, use-list, and skip-list filters in precedence order
|
|
30
28
|
def effective_mcp_server_names
|
|
31
29
|
cfg = AIA.config
|
|
32
30
|
return [] if cfg&.flags&.no_mcp
|
|
@@ -34,27 +32,34 @@ module AIA
|
|
|
34
32
|
servers = cfg&.mcp_servers || []
|
|
35
33
|
return [] if servers.empty?
|
|
36
34
|
|
|
37
|
-
|
|
38
|
-
use_list = Array(cfg.mcp_use)
|
|
39
|
-
skip_list = Array(cfg.mcp_skip)
|
|
40
|
-
|
|
41
|
-
if use_list.any?
|
|
42
|
-
names.select { |n| use_list.include?(n) }
|
|
43
|
-
elsif skip_list.any?
|
|
44
|
-
names.reject { |n| skip_list.include?(n) }
|
|
45
|
-
else
|
|
46
|
-
names
|
|
47
|
-
end
|
|
35
|
+
MCPDiscovery.select(servers, use: cfg.mcp_use, skip: cfg.mcp_skip).map { server_name(it) }.compact
|
|
48
36
|
end
|
|
49
37
|
|
|
38
|
+
# The name a configured server is known by: a Hash's :name, a server
|
|
39
|
+
# instance's #name, or for a RubyLLM::MCP subclass (or its constant name,
|
|
40
|
+
# e.g. "SharedTools::MCP::GitHub") the server's default name ("github").
|
|
41
|
+
# A constant name whose class is not loaded yet is returned as given.
|
|
50
42
|
def server_name(s)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
else
|
|
56
|
-
s.to_s
|
|
43
|
+
case s
|
|
44
|
+
when Hash then s[:name] || s['name']
|
|
45
|
+
when Class then s.respond_to?(:default_name) ? s.default_name : s.name
|
|
46
|
+
when String then mcp_class_name?(s) ? class_server_name(s) : s
|
|
47
|
+
else s.respond_to?(:name) ? s.name : s.to_s
|
|
57
48
|
end
|
|
58
49
|
end
|
|
50
|
+
|
|
51
|
+
# True when +value+ is shaped like a Ruby constant path ("Foo::Bar"),
|
|
52
|
+
# the form an mcp_servers: entry takes to name a RubyLLM::MCP subclass.
|
|
53
|
+
def mcp_class_name?(value)
|
|
54
|
+
value.is_a?(String) && value.match?(/\A(::)?[A-Z]\w*(::[A-Z]\w*)*\z/)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
private
|
|
58
|
+
|
|
59
|
+
def class_server_name(constant_name)
|
|
60
|
+
RobotLab::MCP.name_of(constant_name)
|
|
61
|
+
rescue RobotLab::MCPError
|
|
62
|
+
constant_name
|
|
63
|
+
end
|
|
59
64
|
end
|
|
60
65
|
end
|
data/lib/aia/mention_router.rb
CHANGED
|
@@ -15,6 +15,10 @@ module AIA
|
|
|
15
15
|
# Reserved @mention that broadcasts the message to every crew member.
|
|
16
16
|
BROADCAST_TOKEN = 'crew'
|
|
17
17
|
|
|
18
|
+
# An @name at the start of a word. The look-behind leaves e-mail
|
|
19
|
+
# addresses (bob@example.com) and dotted names alone.
|
|
20
|
+
MENTION = /(?<![\w.@])@(\w+)/
|
|
21
|
+
|
|
18
22
|
def initialize(ui_presenter:, tracker:, streaming_runner:)
|
|
19
23
|
@ui_presenter = ui_presenter
|
|
20
24
|
@tracker = tracker
|
|
@@ -32,13 +36,17 @@ module AIA
|
|
|
32
36
|
prompt = context.prompt
|
|
33
37
|
return false unless robot.network?
|
|
34
38
|
|
|
35
|
-
mention_tokens = prompt.scan(
|
|
39
|
+
mention_tokens = prompt.scan(MENTION).flatten
|
|
36
40
|
return false if mention_tokens.empty?
|
|
37
41
|
|
|
38
42
|
all_robots = robot.crew
|
|
39
43
|
matched = resolve_mentions(mention_tokens, all_robots)
|
|
40
44
|
|
|
45
|
+
# No crew member named: ordinary text for the model, unless the message
|
|
46
|
+
# opens with an @address -- most likely a mistyped name.
|
|
41
47
|
if matched.empty?
|
|
48
|
+
return false unless addressed?(prompt)
|
|
49
|
+
|
|
42
50
|
report_unknown_mentions(mention_tokens, all_robots)
|
|
43
51
|
return true
|
|
44
52
|
end
|
|
@@ -60,11 +68,16 @@ module AIA
|
|
|
60
68
|
prompt.sub(/\A(?:\s*@\w+)+\s*/i, '').strip
|
|
61
69
|
end
|
|
62
70
|
|
|
71
|
+
# True when the message opens with an @address.
|
|
72
|
+
def addressed?(prompt)
|
|
73
|
+
prompt.match?(/\A\s*@\w/)
|
|
74
|
+
end
|
|
75
|
+
|
|
63
76
|
# True when every @mention is part of the leading address — i.e. nothing but
|
|
64
77
|
# @mentions before the message — so it's a broadcast to its addressees and
|
|
65
78
|
# runs concurrently. A @mention woven into the body makes it sequential.
|
|
66
79
|
def leading_address_only?(prompt)
|
|
67
|
-
!strip_addressing_prefix(prompt).match?(
|
|
80
|
+
!strip_addressing_prefix(prompt).match?(MENTION)
|
|
68
81
|
end
|
|
69
82
|
|
|
70
83
|
# Resolve @mention tokens to robots. The reserved @crew token broadcasts to
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# lib/aia/modality_query.rb
|
|
4
|
+
#
|
|
5
|
+
# Matches a model's input/output modalities against an "INPUT_to_OUTPUT"
|
|
6
|
+
# search term such as "text_to_image" (as used by --available-models and
|
|
7
|
+
# /available_models). RubyLLM 2.x exposes modalities as plain input/output
|
|
8
|
+
# lists, so the term is split and each side is looked up in its list.
|
|
9
|
+
|
|
10
|
+
module AIA
|
|
11
|
+
module ModalityQuery
|
|
12
|
+
SEPARATOR = '_to_'
|
|
13
|
+
|
|
14
|
+
module_function
|
|
15
|
+
|
|
16
|
+
# @param term [String]
|
|
17
|
+
# @return [Boolean] true when +term+ has the INPUT_to_OUTPUT form
|
|
18
|
+
def modality_term?(term)
|
|
19
|
+
term.to_s.include?(SEPARATOR)
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# @param modalities [#input, #output] a model's modalities
|
|
23
|
+
# @param term [String] e.g. "text_to_image" or ":image_to_text"
|
|
24
|
+
# @return [Boolean]
|
|
25
|
+
def matches?(modalities, term)
|
|
26
|
+
input, output = term.to_s.delete_prefix(':').downcase.split(SEPARATOR, 2)
|
|
27
|
+
return false if input.to_s.empty? || output.to_s.empty?
|
|
28
|
+
|
|
29
|
+
names(modalities.input).include?(input) && names(modalities.output).include?(output)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def names(list)
|
|
33
|
+
Array(list).map { it.to_s.downcase }
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -9,28 +9,28 @@ module AIA
|
|
|
9
9
|
class ModelAliasRegistry
|
|
10
10
|
DEFAULT_ALIASES = {
|
|
11
11
|
# Short names
|
|
12
|
-
"claude" => "claude-sonnet-4-
|
|
13
|
-
"sonnet" => "claude-sonnet-4-
|
|
14
|
-
"opus" => "claude-opus-
|
|
12
|
+
"claude" => "claude-sonnet-4-5",
|
|
13
|
+
"sonnet" => "claude-sonnet-4-5",
|
|
14
|
+
"opus" => "claude-opus-5",
|
|
15
15
|
"haiku" => "claude-haiku-4-5-20251001",
|
|
16
16
|
"gpt4" => "gpt-4o",
|
|
17
17
|
"gpt4o" => "gpt-4o",
|
|
18
18
|
"gpt4mini" => "gpt-4o-mini",
|
|
19
|
-
"gemini" => "gemini-
|
|
20
|
-
"flash" => "gemini-
|
|
21
|
-
"llama" => "llama-
|
|
19
|
+
"gemini" => "gemini-3.8-flash",
|
|
20
|
+
"flash" => "gemini-3.8-flash",
|
|
21
|
+
"llama" => "meta-llama/llama-4-maverick",
|
|
22
22
|
|
|
23
23
|
# Provider names (resolve to default model for provider)
|
|
24
|
-
"anthropic" => "claude-sonnet-4-
|
|
24
|
+
"anthropic" => "claude-sonnet-4-5",
|
|
25
25
|
"openai" => "gpt-4o",
|
|
26
|
-
"google" => "gemini-
|
|
27
|
-
"meta" => "llama-
|
|
26
|
+
"google" => "gemini-3.8-flash",
|
|
27
|
+
"meta" => "meta-llama/llama-4-maverick",
|
|
28
28
|
|
|
29
29
|
# Capability descriptors
|
|
30
30
|
"fast" => "claude-haiku-4-5-20251001",
|
|
31
31
|
"cheap" => "gpt-4o-mini",
|
|
32
|
-
"best" => "claude-opus-
|
|
33
|
-
"coding" => "claude-sonnet-4-
|
|
32
|
+
"best" => "claude-opus-5",
|
|
33
|
+
"coding" => "claude-sonnet-4-5",
|
|
34
34
|
"vision" => "gpt-4o"
|
|
35
35
|
}.freeze
|
|
36
36
|
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# lib/aia/model_registry.rb
|
|
4
|
+
#
|
|
5
|
+
# AIA's local copy of the RubyLLM model list, kept at
|
|
6
|
+
# <paths.aia_dir>/models.json and refreshed from the provider APIs every
|
|
7
|
+
# registry.refresh days (--refresh DAYS; 0 turns refreshing off).
|
|
8
|
+
|
|
9
|
+
require 'date'
|
|
10
|
+
require 'fileutils'
|
|
11
|
+
|
|
12
|
+
module AIA
|
|
13
|
+
module ModelRegistry
|
|
14
|
+
DEFAULT_REFRESH_DAYS = 7
|
|
15
|
+
|
|
16
|
+
module_function
|
|
17
|
+
|
|
18
|
+
# Point RubyLLM at AIA's models.json, refreshing it first when it is due.
|
|
19
|
+
#
|
|
20
|
+
# @param config [AIA::Config]
|
|
21
|
+
def prepare(config)
|
|
22
|
+
path = registry_path(config.paths&.aia_dir)
|
|
23
|
+
return unless path
|
|
24
|
+
|
|
25
|
+
days = refresh_days(config.registry&.refresh)
|
|
26
|
+
if refresh_due?(path, days)
|
|
27
|
+
refresh(path)
|
|
28
|
+
elsif File.exist?(path)
|
|
29
|
+
use(path)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# @return [String, nil] the models.json path, or nil without an aia_dir
|
|
34
|
+
def registry_path(aia_dir)
|
|
35
|
+
return nil if aia_dir.to_s.strip.empty?
|
|
36
|
+
|
|
37
|
+
File.join(File.expand_path(aia_dir), 'models.json')
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# The refresh interval as a whole number of days; nil means the default.
|
|
41
|
+
def refresh_days(value)
|
|
42
|
+
return DEFAULT_REFRESH_DAYS if value.nil?
|
|
43
|
+
|
|
44
|
+
[Integer(value.to_s, exception: false) || DEFAULT_REFRESH_DAYS, 0].max
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
# Whether +path+ is missing or more than +days+ days old. Never due when
|
|
48
|
+
# +days+ is 0.
|
|
49
|
+
def refresh_due?(path, days, today: Date.today)
|
|
50
|
+
return false if days.zero?
|
|
51
|
+
return true unless File.exist?(path)
|
|
52
|
+
|
|
53
|
+
today > File.mtime(path).to_date + days
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Load the model list from +path+.
|
|
57
|
+
def use(path)
|
|
58
|
+
RubyLLM.config.model_registry_file = path
|
|
59
|
+
RubyLLM.models.load_from_json(path)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Refresh the model list from the provider APIs and save it to +path+.
|
|
63
|
+
# On failure RubyLLM keeps the list it already had.
|
|
64
|
+
def refresh(path)
|
|
65
|
+
llm_config = RubyLLM.config
|
|
66
|
+
previous = llm_config.model_registry_file
|
|
67
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
68
|
+
llm_config.model_registry_file = path
|
|
69
|
+
Speech.run_with_spinner("Refreshing the model list...") { RubyLLM.models.refresh }
|
|
70
|
+
rescue StandardError => e
|
|
71
|
+
llm_config&.model_registry_file = previous
|
|
72
|
+
$stderr.puts "Warning: Could not refresh the model list (#{e.message}). Using the existing list."
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
data/lib/aia/network_builder.rb
CHANGED
|
@@ -20,7 +20,7 @@ module AIA
|
|
|
20
20
|
prompts = config.pipeline
|
|
21
21
|
run_config = RobotFactory.build_run_config(config)
|
|
22
22
|
tools = ToolLoader.filtered_tools(config)
|
|
23
|
-
mcp = RobotFactory.
|
|
23
|
+
mcp = RobotFactory.mcp_servers(config)
|
|
24
24
|
model_spec = config.models.first
|
|
25
25
|
|
|
26
26
|
RobotLab.create_network(name: "aia-pipeline") do
|
|
@@ -32,7 +32,7 @@ module AIA
|
|
|
32
32
|
name: "#{namer.name_for(model_spec.name)}-s#{i}",
|
|
33
33
|
system_prompt: nil,
|
|
34
34
|
local_tools: tools,
|
|
35
|
-
|
|
35
|
+
mcp: mcp,
|
|
36
36
|
config: run_config
|
|
37
37
|
)
|
|
38
38
|
task task_name, robot, depends_on: prev ? [prev] : :none
|
|
@@ -49,7 +49,7 @@ module AIA
|
|
|
49
49
|
def build_parallel_network(config, namer)
|
|
50
50
|
run_config = RobotFactory.build_run_config(config)
|
|
51
51
|
tools = ToolLoader.filtered_tools(config)
|
|
52
|
-
mcp = RobotFactory.
|
|
52
|
+
mcp = RobotFactory.mcp_servers(config)
|
|
53
53
|
aia_config = config
|
|
54
54
|
roster = config.models.map { |spec| { name: namer.name_for(spec.name), spec: spec } }
|
|
55
55
|
build_robot = ->(entry) { build_roster_robot(entry, roster, tools, mcp, run_config, aia_config) }
|
|
@@ -71,7 +71,7 @@ module AIA
|
|
|
71
71
|
def build_consensus_network(config, namer)
|
|
72
72
|
run_config = RobotFactory.build_run_config(config)
|
|
73
73
|
tools = ToolLoader.filtered_tools(config)
|
|
74
|
-
mcp = RobotFactory.
|
|
74
|
+
mcp = RobotFactory.mcp_servers(config)
|
|
75
75
|
models = config.models
|
|
76
76
|
primary = models.first
|
|
77
77
|
aia_config = config
|
|
@@ -108,7 +108,7 @@ module AIA
|
|
|
108
108
|
name: entry[:name],
|
|
109
109
|
system_prompt: system_prompt,
|
|
110
110
|
local_tools: tools,
|
|
111
|
-
|
|
111
|
+
mcp: mcp,
|
|
112
112
|
config: run_config
|
|
113
113
|
)
|
|
114
114
|
end
|
|
@@ -126,15 +126,16 @@ module AIA
|
|
|
126
126
|
tools = ToolLoader.filtered_tools(config)
|
|
127
127
|
model_spec = config.models.first
|
|
128
128
|
system_prompt = SystemPromptAssembler.resolve_system_prompt(config, model_spec)
|
|
129
|
+
group_servers = server_groups.map { RobotFactory.mcp_servers(config, it) }
|
|
129
130
|
|
|
130
131
|
network = RobotLab.create_network(name: "aia-concurrent-mcp") do
|
|
131
|
-
|
|
132
|
+
group_servers.each_with_index do |servers, i|
|
|
132
133
|
robot = RobotFactory.build_robot(
|
|
133
134
|
model_spec,
|
|
134
135
|
name: "#{namer.name_for(model_spec.name)}-w#{i}",
|
|
135
136
|
system_prompt: system_prompt,
|
|
136
137
|
local_tools: tools,
|
|
137
|
-
|
|
138
|
+
mcp: servers,
|
|
138
139
|
config: run_config
|
|
139
140
|
)
|
|
140
141
|
task :"mcp_worker_#{i}", robot, depends_on: :none
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# lib/aia/patches/mcp_stdio_stderr.rb
|
|
2
|
+
#
|
|
3
|
+
# Redirect the stderr of stdio MCP server processes away from the terminal.
|
|
4
|
+
#
|
|
5
|
+
# ruby_llm 2.1's RubyLLM::MCP::Stdio#start launches each server with
|
|
6
|
+
# Open3.popen2, so the child inherits aia's stderr ("Its stderr is the
|
|
7
|
+
# parent's"). Every server banner, npm notice, stack trace and Python
|
|
8
|
+
# validation dump then lands on the terminal, interleaved with the
|
|
9
|
+
# TTY::Spinner::Multi "Connecting MCP servers" display, which corrupts it.
|
|
10
|
+
# (ruby_llm-mcp 1.x used popen3 and drained stderr, so aia 1.x was quiet.)
|
|
11
|
+
#
|
|
12
|
+
# The destination comes from AIA.config.logger.mcp.server_stderr:
|
|
13
|
+
# a file path - appended to (default: ~/.config/aia/logs/mcp_servers.log)
|
|
14
|
+
# STDERR - the old passthrough behavior
|
|
15
|
+
# null - discard (also: none, /dev/null)
|
|
16
|
+
#
|
|
17
|
+
# Stdio#start has no hook for spawn options, so this re-implements its
|
|
18
|
+
# three-line body. It is guarded against drift: if a future ruby_llm drops
|
|
19
|
+
# Stdio#start, the patch is skipped with a warning instead of breaking MCP.
|
|
20
|
+
|
|
21
|
+
require 'fileutils'
|
|
22
|
+
require 'open3'
|
|
23
|
+
|
|
24
|
+
module AIA
|
|
25
|
+
module MCPStdioStderr
|
|
26
|
+
DEFAULT_PATH = '~/.config/aia/logs/mcp_servers.log'.freeze
|
|
27
|
+
DISCARD = %w[NULL NONE /DEV/NULL].freeze
|
|
28
|
+
|
|
29
|
+
class << self
|
|
30
|
+
# The spawn option value for a server's stderr.
|
|
31
|
+
#
|
|
32
|
+
# @param setting [String, nil] logger.mcp.server_stderr
|
|
33
|
+
# @return [Array(String, String), nil] [path, mode] for Process.spawn's
|
|
34
|
+
# err: option, or nil to inherit the parent's stderr
|
|
35
|
+
def spawn_target(setting = configured_setting)
|
|
36
|
+
value = setting.to_s.strip
|
|
37
|
+
value = DEFAULT_PATH if value.empty?
|
|
38
|
+
|
|
39
|
+
case value.upcase
|
|
40
|
+
when 'STDERR' then nil
|
|
41
|
+
when *DISCARD then [File::NULL, 'w']
|
|
42
|
+
else log_file_target(value)
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Spawn options for Open3 with the stderr redirect added.
|
|
47
|
+
#
|
|
48
|
+
# @param options [Hash] options ruby_llm would pass (e.g. chdir:)
|
|
49
|
+
# @param target [Array, nil] from .spawn_target
|
|
50
|
+
# @return [Hash]
|
|
51
|
+
def spawn_options(options, target = spawn_target)
|
|
52
|
+
target ? options.merge(err: target) : options
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Install the patch onto RubyLLM::MCP::Stdio (idempotent).
|
|
56
|
+
#
|
|
57
|
+
# @return [Class, nil] the patched class, or nil when it can't be patched
|
|
58
|
+
def install!(stdio = stdio_class)
|
|
59
|
+
return unless stdio&.private_method_defined?(:start)
|
|
60
|
+
|
|
61
|
+
stdio.prepend(StdioPatch) unless stdio.ancestors.include?(StdioPatch)
|
|
62
|
+
stdio
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
private
|
|
66
|
+
|
|
67
|
+
def configured_setting
|
|
68
|
+
AIA.config&.logger&.mcp&.server_stderr
|
|
69
|
+
rescue StandardError
|
|
70
|
+
nil # config not loaded yet (or malformed): fall back to the default file
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def log_file_target(value)
|
|
74
|
+
path = File.expand_path(value)
|
|
75
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
76
|
+
[path, 'a']
|
|
77
|
+
rescue SystemCallError
|
|
78
|
+
[File::NULL, 'w'] # unwritable location: still keep the terminal clean
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
def stdio_class
|
|
82
|
+
RubyLLM::MCP::Stdio if defined?(RubyLLM::MCP::Stdio)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# Prepended onto RubyLLM::MCP::Stdio.
|
|
87
|
+
module StdioPatch
|
|
88
|
+
private
|
|
89
|
+
|
|
90
|
+
def start
|
|
91
|
+
options = @directory ? { chdir: @directory } : {}
|
|
92
|
+
options = MCPStdioStderr.spawn_options(options)
|
|
93
|
+
@stdin, @stdout, @process = Open3.popen2(@env, *@command, **options)
|
|
94
|
+
@buffer = +''
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
unless AIA::MCPStdioStderr.install!
|
|
101
|
+
warn 'AIA: RubyLLM::MCP::Stdio#start not found; MCP server stderr will reach the terminal'
|
|
102
|
+
end
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
# ruby_llm's own private parse_error_from_json. Guarded against API drift: if
|
|
21
21
|
# parse_error_from_json is renamed/removed the patch is skipped with a warning.
|
|
22
22
|
#
|
|
23
|
-
#
|
|
24
|
-
#
|
|
23
|
+
# ruby_llm >= 2.0 moved the module to RubyLLM::Protocol::Streaming and fixed
|
|
24
|
+
# the bug upstream (nil-safe data-line access plus SSE event buffering), so on
|
|
25
|
+
# 2.0+ this patch deliberately does not apply. It stays for the 1.x line only.
|
|
25
26
|
|
|
26
27
|
module AIA
|
|
27
28
|
module RubyLLMStreamingError
|
|
@@ -35,8 +36,24 @@ module AIA
|
|
|
35
36
|
end
|
|
36
37
|
end
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
# ruby_llm is Zeitwerk-managed, so the constants must be referenced (not
|
|
40
|
+
# defined?-probed) to trigger their autoload; NameError means "not this version".
|
|
41
|
+
streaming =
|
|
42
|
+
begin
|
|
43
|
+
RubyLLM::Streaming # ruby_llm 1.x
|
|
44
|
+
rescue NameError
|
|
45
|
+
nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
if streaming.nil?
|
|
49
|
+
begin
|
|
50
|
+
RubyLLM::Protocol::Streaming # ruby_llm >= 2.0: fixed upstream, no patch needed
|
|
51
|
+
rescue NameError
|
|
52
|
+
$stderr.puts "WARNING: [AIA] ruby_llm patch skipped: no streaming module found " \
|
|
53
|
+
"(ruby_llm #{RubyLLM::VERSION}). Streaming error messages may be cryptic."
|
|
54
|
+
end
|
|
55
|
+
elsif streaming.private_method_defined?(:parse_error_from_json)
|
|
56
|
+
streaming.prepend(AIA::RubyLLMStreamingError)
|
|
40
57
|
else
|
|
41
58
|
$stderr.puts "WARNING: [AIA] ruby_llm patch skipped: RubyLLM::Streaming#parse_error_from_json " \
|
|
42
59
|
"not found (ruby_llm #{RubyLLM::VERSION}). Streaming error messages may be cryptic."
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# lib/aia/patches/ruby_llm_tool_param_compat.rb
|
|
2
|
+
#
|
|
3
|
+
# ruby_llm 1.x tools declare arguments with `param ... desc:`; ruby_llm 2.0
|
|
4
|
+
# renamed the DSL to `parameter ... description:`. AIA's tool classes are
|
|
5
|
+
# written in the 2.0 style. On a 1.x runtime this shim translates the 2.0
|
|
6
|
+
# declaration back onto the 1.x `param` DSL so the same tool classes load on
|
|
7
|
+
# both lines. Retire together with ruby_llm 1.x support.
|
|
8
|
+
|
|
9
|
+
module AIA
|
|
10
|
+
module RubyLLMToolParamCompat
|
|
11
|
+
def parameter(name, **options)
|
|
12
|
+
options[:desc] = options.delete(:description) if options.key?(:description)
|
|
13
|
+
param(name, **options)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
RubyLLM::Tool.extend(AIA::RubyLLMToolParamCompat) unless RubyLLM::Tool.respond_to?(:parameter)
|
|
@@ -12,10 +12,13 @@ require_relative 'skill_utils'
|
|
|
12
12
|
module AIA
|
|
13
13
|
class PipelineOrchestrator
|
|
14
14
|
include ContentExtractor
|
|
15
|
+
include Speech
|
|
15
16
|
include SkillUtils
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
# :reek:LongParameterList -- collaborators injected for isolated testing
|
|
19
|
+
def initialize(robot:, prompt_handler:, input_collector:, ui_presenter:, session_tracker:, robot_sync: nil)
|
|
18
20
|
@robot = robot
|
|
21
|
+
@robot_sync = robot_sync
|
|
19
22
|
@prompt_handler = prompt_handler
|
|
20
23
|
@input_collector = input_collector
|
|
21
24
|
@ui = ui_presenter
|
|
@@ -24,54 +27,70 @@ module AIA
|
|
|
24
27
|
|
|
25
28
|
# Process all prompts in the pipeline.
|
|
26
29
|
#
|
|
30
|
+
# Shift-based loop: prompt front matter that sets config.pipeline
|
|
31
|
+
# (`next:` or `pipeline:`) is picked up on the next iteration.
|
|
32
|
+
#
|
|
27
33
|
# @param config [AIA::Config]
|
|
28
|
-
# :reek:TooManyStatements -- shift-based loop so front-matter pipeline edits take effect; tracking interleaved
|
|
29
34
|
# :reek:DuplicateMethodCall -- config.pipeline is deliberately re-read each iteration because prompt front matter mutates it mid-loop
|
|
30
35
|
def process(config)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
bridge
|
|
36
|
+
# Only --track-pipeline starts TrakFlow for a pipeline run. The bridge
|
|
37
|
+
# does nothing when TrakFlow isn't available.
|
|
38
|
+
bridge = config.flags.track_pipeline ? TrakFlowBridge.new : nil
|
|
39
|
+
bridge&.create_plan_from_pipeline(config.pipeline)
|
|
35
40
|
|
|
36
|
-
# Use shift-based loop so that prompt front matter which sets
|
|
37
|
-
# config.pipeline (via `next:` or `pipeline:`) is picked up on
|
|
38
|
-
# the next iteration rather than being silently ignored.
|
|
39
41
|
until config.pipeline.empty?
|
|
40
42
|
prompt_id = config.pipeline.shift
|
|
41
43
|
next if prompt_id.nil? || prompt_id.empty?
|
|
42
44
|
|
|
43
|
-
|
|
44
|
-
bridge.update_step_status(prompt_id, :started) if tracking
|
|
45
|
-
|
|
46
|
-
prompt_text = build_prompt_text(prompt_id, config)
|
|
47
|
-
next if prompt_text.nil? || prompt_text.strip.empty?
|
|
48
|
-
|
|
49
|
-
result, content = compute_result(prompt_text, config)
|
|
50
|
-
|
|
51
|
-
bridge.update_step_status(prompt_id, :completed) if tracking
|
|
52
|
-
|
|
53
|
-
@tracker.record_turn(
|
|
54
|
-
model: config.models.first.name,
|
|
55
|
-
input: prompt_text,
|
|
56
|
-
result: result
|
|
57
|
-
)
|
|
58
|
-
|
|
59
|
-
@ui.display_ai_response(content)
|
|
60
|
-
output_to_file(content, config)
|
|
61
|
-
display_metrics(result, config)
|
|
62
|
-
@ui.display_separator
|
|
63
|
-
rescue StandardError => e
|
|
64
|
-
bridge.update_step_status(prompt_id, :failed, reason: e.message) if tracking
|
|
65
|
-
raise
|
|
66
|
-
end
|
|
45
|
+
run_step(prompt_id, config, bridge)
|
|
67
46
|
end
|
|
68
47
|
end
|
|
69
48
|
|
|
70
49
|
# Allow robot to be updated (after model switch)
|
|
71
50
|
attr_writer :robot
|
|
72
51
|
|
|
52
|
+
# The parameter names in a PM "Missing required parameters: a, b" message.
|
|
53
|
+
def self.missing_parameter_names(message)
|
|
54
|
+
message.to_s.sub(/\AMissing required parameters:/, '').split(',').map(&:strip).reject(&:empty?)
|
|
55
|
+
end
|
|
56
|
+
|
|
73
57
|
private
|
|
74
58
|
|
|
59
|
+
# Run one pipeline prompt, recording its progress on +bridge+ (a
|
|
60
|
+
# TrakFlowBridge, or nil when the run isn't tracked).
|
|
61
|
+
#
|
|
62
|
+
# :reek:TooManyStatements -- build, sync, run, record and present one step, with its tracking interleaved
|
|
63
|
+
def run_step(prompt_id, config, bridge)
|
|
64
|
+
bridge&.update_step_status(prompt_id, :started)
|
|
65
|
+
|
|
66
|
+
prompt_text = build_prompt_text(prompt_id, config)
|
|
67
|
+
return if prompt_text.nil? || prompt_text.strip.empty?
|
|
68
|
+
|
|
69
|
+
# Front matter may have changed the model or its settings
|
|
70
|
+
@robot = @robot_sync.call(@robot) if @robot_sync
|
|
71
|
+
|
|
72
|
+
result, content = compute_result(prompt_text, config)
|
|
73
|
+
bridge&.update_step_status(prompt_id, :completed)
|
|
74
|
+
|
|
75
|
+
@tracker.record_turn(model: config.models.first.name, input: prompt_text, result: result)
|
|
76
|
+
present_result(content, result, config)
|
|
77
|
+
rescue StandardError => e
|
|
78
|
+
bridge&.update_step_status(prompt_id, :failed, reason: e.message)
|
|
79
|
+
raise
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Show a step's response, then save and speak it. A --paint step saved
|
|
83
|
+
# an image next to the output file, so there is no text to keep or speak.
|
|
84
|
+
def present_result(content, result, config)
|
|
85
|
+
@ui.display_ai_response(content)
|
|
86
|
+
unless AIA.paint?
|
|
87
|
+
output_to_file(content, config)
|
|
88
|
+
speak(content)
|
|
89
|
+
end
|
|
90
|
+
display_metrics(result, config)
|
|
91
|
+
@ui.display_separator
|
|
92
|
+
end
|
|
93
|
+
|
|
75
94
|
# Returns [result, displayable_content] for one prompt — image when in paint
|
|
76
95
|
# mode, otherwise the LLM text response.
|
|
77
96
|
def compute_result(prompt_text, config)
|
|
@@ -96,7 +115,7 @@ module AIA
|
|
|
96
115
|
image = @ui.with_spinner("Generating image") do
|
|
97
116
|
RubyLLM.paint(
|
|
98
117
|
prompt_text,
|
|
99
|
-
model: img_cfg.model || '
|
|
118
|
+
model: img_cfg.model || 'gpt-image-1',
|
|
100
119
|
size: img_cfg.size || '1024x1024',
|
|
101
120
|
params: params
|
|
102
121
|
)
|
|
@@ -137,9 +156,7 @@ module AIA
|
|
|
137
156
|
concurrency = config.respond_to?(:concurrency) ? config.concurrency : nil
|
|
138
157
|
return nil unless concurrency&.auto || turn_state.force_concurrent_mcp
|
|
139
158
|
|
|
140
|
-
|
|
141
|
-
turn_state.force_concurrent_mcp = false
|
|
142
|
-
end
|
|
159
|
+
turn_state.clear_mode(:concurrent_mcp)
|
|
143
160
|
|
|
144
161
|
discovery = MCPDiscovery.new
|
|
145
162
|
relevant_servers = discovery.discover(config)
|
|
@@ -169,7 +186,7 @@ module AIA
|
|
|
169
186
|
values.each { |k, v| parameters[k] = v }
|
|
170
187
|
end
|
|
171
188
|
|
|
172
|
-
prompt_text = parsed
|
|
189
|
+
prompt_text = render_prompt(parsed)
|
|
173
190
|
|
|
174
191
|
role = config.prompts.role
|
|
175
192
|
if role && !role.empty?
|
|
@@ -198,6 +215,22 @@ module AIA
|
|
|
198
215
|
add_context_files(prompt_text, config)
|
|
199
216
|
end
|
|
200
217
|
|
|
218
|
+
# Render +parsed+, asking for any required parameter that only an
|
|
219
|
+
# included file declares. Such a parameter is not known until the
|
|
220
|
+
# include runs, so each MissingParameterError names more to ask for;
|
|
221
|
+
# rendering stops retrying once it names nothing new.
|
|
222
|
+
def render_prompt(parsed)
|
|
223
|
+
extra = {}
|
|
224
|
+
loop do
|
|
225
|
+
return parsed.to_s(extra)
|
|
226
|
+
rescue PM::MissingParameterError => e
|
|
227
|
+
names = self.class.missing_parameter_names(e.message) - extra.keys
|
|
228
|
+
raise if names.empty?
|
|
229
|
+
|
|
230
|
+
extra.merge!(@input_collector.collect(names.to_h { [it, nil] }))
|
|
231
|
+
end
|
|
232
|
+
end
|
|
233
|
+
|
|
201
234
|
# Append context file contents to prompt
|
|
202
235
|
def add_context_files(prompt_text, config)
|
|
203
236
|
context_files = config.context_files
|
|
@@ -118,7 +118,7 @@ module AIA
|
|
|
118
118
|
private
|
|
119
119
|
|
|
120
120
|
def structured_output?
|
|
121
|
-
RubyLLM.models.find(AIA.config.models.first.internal_id).structured_output
|
|
121
|
+
RubyLLM.models.find(AIA.config.models.first.internal_id).supports?(:structured_output)
|
|
122
122
|
rescue StandardError
|
|
123
123
|
false
|
|
124
124
|
end
|