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/logger.rb
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
# Provides loggers for three systems:
|
|
7
7
|
# - aia: Used within the AIA codebase for application-level logging
|
|
8
8
|
# - llm: Passed to RubyLLM gem's configuration (RubyLLM.logger)
|
|
9
|
-
# - mcp:
|
|
9
|
+
# - mcp: MCP connection logging (MCPConnectionManager) and RobotLab.config.logger;
|
|
10
|
+
# ruby_llm's own MCP client logs through RubyLLM.logger (llm)
|
|
10
11
|
#
|
|
11
12
|
# Configuration is read from AIA.config.logger section:
|
|
12
13
|
# logger:
|
|
@@ -17,8 +18,9 @@
|
|
|
17
18
|
# file: STDOUT
|
|
18
19
|
# level: warn
|
|
19
20
|
# mcp:
|
|
20
|
-
# file:
|
|
21
|
+
# file: ~/.config/aia/logs/mcp.log
|
|
21
22
|
# level: warn
|
|
23
|
+
# server_stderr: ~/.config/aia/logs/mcp_servers.log # stdio server stderr
|
|
22
24
|
#
|
|
23
25
|
# Lumberjack provides structured logging, context isolation,
|
|
24
26
|
# automatic log file rolling, and multi-process safe file writes.
|
|
@@ -29,6 +31,7 @@
|
|
|
29
31
|
# AIA::LoggerManager.clear_test_logs! # between tests
|
|
30
32
|
# entries = AIA::LoggerManager.aia_logger.device.entries # inspect logs
|
|
31
33
|
|
|
34
|
+
require 'fileutils'
|
|
32
35
|
require 'lumberjack'
|
|
33
36
|
|
|
34
37
|
module AIA
|
|
@@ -92,7 +95,7 @@ module AIA
|
|
|
92
95
|
|
|
93
96
|
if llm_config.respond_to?(:log_level=)
|
|
94
97
|
level = effective_log_level(logger_config_for(:llm))
|
|
95
|
-
llm_config.log_level = LOG_LEVELS.fetch(level
|
|
98
|
+
llm_config.log_level = LOG_LEVELS.fetch(level) { Lumberjack::Severity::WARN }
|
|
96
99
|
end
|
|
97
100
|
|
|
98
101
|
# Reset the memoized @logger on RubyLLM module so next call uses our config
|
|
@@ -100,38 +103,8 @@ module AIA
|
|
|
100
103
|
RubyLLM.instance_variable_set(:@logger, nil) if RubyLLM.instance_variable_defined?(:@logger)
|
|
101
104
|
end
|
|
102
105
|
|
|
103
|
-
# Configure RubyLLM::MCP's logger
|
|
104
|
-
# RubyLLM::MCP.config has attr_writer :logger and a memoized getter.
|
|
105
|
-
# We need to set both the config.logger and reset any memoization.
|
|
106
|
-
def configure_mcp_logger
|
|
107
|
-
return unless defined?(RubyLLM::MCP)
|
|
108
|
-
|
|
109
|
-
logger = mcp_logger
|
|
110
|
-
|
|
111
|
-
# First reset the memoized @logger so our settings take effect
|
|
112
|
-
# RubyLLM::MCP.config.logger does: @logger ||= Logger.new(...)
|
|
113
|
-
config = RubyLLM::MCP.config
|
|
114
|
-
config.instance_variable_set(:@logger, nil) if config.instance_variable_defined?(:@logger)
|
|
115
|
-
|
|
116
|
-
# Set our logger on the MCP config object
|
|
117
|
-
# RubyLLM::MCP.config has attr_writer :logger (which sets @logger directly)
|
|
118
|
-
if config.respond_to?(:logger=)
|
|
119
|
-
config.logger = logger
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# Also set log_file and log_level in case the logger gets recreated
|
|
123
|
-
if config.respond_to?(:log_file=)
|
|
124
|
-
file = effective_log_file(logger_config_for(:mcp))
|
|
125
|
-
config.log_file = resolve_log_file_io(file)
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
return unless config.respond_to?(:log_level=)
|
|
129
|
-
level = effective_log_level(logger_config_for(:mcp))
|
|
130
|
-
config.log_level = LOG_LEVELS.fetch(level, Lumberjack::Severity::WARN)
|
|
131
|
-
end
|
|
132
|
-
|
|
133
106
|
# Convert log file specification to IO object or file path
|
|
134
|
-
# RubyLLM
|
|
107
|
+
# RubyLLM expects an IO object or file path for log_file config
|
|
135
108
|
def resolve_log_file_io(file)
|
|
136
109
|
case file.to_s.upcase
|
|
137
110
|
when 'STDOUT'
|
|
@@ -172,13 +145,12 @@ module AIA
|
|
|
172
145
|
|
|
173
146
|
config = logger_config_for(system)
|
|
174
147
|
level = effective_log_level(config, system)
|
|
175
|
-
numeric = LOG_LEVELS.fetch(level
|
|
148
|
+
numeric = LOG_LEVELS.fetch(level) { Lumberjack::Severity::WARN }
|
|
176
149
|
logger.level = numeric
|
|
177
150
|
end
|
|
178
151
|
|
|
179
|
-
# Keep RubyLLM
|
|
152
|
+
# Keep the RubyLLM config in sync so it doesn't override us
|
|
180
153
|
configure_llm_logger
|
|
181
|
-
configure_mcp_logger
|
|
182
154
|
end
|
|
183
155
|
|
|
184
156
|
# =======================================================================
|
|
@@ -194,7 +166,7 @@ module AIA
|
|
|
194
166
|
def test_mode!(level: :debug)
|
|
195
167
|
reset!
|
|
196
168
|
@test_mode = true
|
|
197
|
-
@test_level = LOG_LEVELS.fetch(level.to_s
|
|
169
|
+
@test_level = LOG_LEVELS.fetch(level.to_s) { Lumberjack::Severity::DEBUG }
|
|
198
170
|
|
|
199
171
|
# Pre-create loggers with test devices
|
|
200
172
|
@aia_logger = create_test_logger(:aia)
|
|
@@ -274,7 +246,7 @@ module AIA
|
|
|
274
246
|
device = create_device(file, flush: flush)
|
|
275
247
|
Lumberjack::Logger.new(
|
|
276
248
|
device,
|
|
277
|
-
level: LOG_LEVELS.fetch(level
|
|
249
|
+
level: LOG_LEVELS.fetch(level) { Lumberjack::Severity::WARN },
|
|
278
250
|
progname: system.to_s.upcase
|
|
279
251
|
)
|
|
280
252
|
end
|
|
@@ -317,6 +289,7 @@ module AIA
|
|
|
317
289
|
Lumberjack::Device::Writer.new($stderr, autoflush: flush)
|
|
318
290
|
else
|
|
319
291
|
path = File.expand_path(file)
|
|
292
|
+
FileUtils.mkdir_p(File.dirname(path))
|
|
320
293
|
# Daily date rolling via Logger::LogDevice, which also makes the
|
|
321
294
|
# file safe for multiple loggers to write to
|
|
322
295
|
Lumberjack::Device::LogFile.new(
|
|
@@ -334,14 +307,9 @@ module AIA
|
|
|
334
307
|
def logger_config_for(system)
|
|
335
308
|
logger_cfg = AIA.config&.logger
|
|
336
309
|
return nil unless logger_cfg
|
|
310
|
+
return nil unless %i[aia llm mcp].include?(system)
|
|
337
311
|
|
|
338
|
-
|
|
339
|
-
when :aia then logger_cfg.aia
|
|
340
|
-
when :llm then logger_cfg.llm
|
|
341
|
-
when :mcp then logger_cfg.mcp
|
|
342
|
-
end
|
|
343
|
-
rescue NoMethodError
|
|
344
|
-
nil
|
|
312
|
+
logger_cfg.public_send(system) if logger_cfg.respond_to?(system)
|
|
345
313
|
end
|
|
346
314
|
end
|
|
347
315
|
end
|
|
@@ -3,32 +3,45 @@
|
|
|
3
3
|
# lib/aia/mcp_config_normalizer.rb
|
|
4
4
|
#
|
|
5
5
|
# Normalizes a single MCP server config from AIA flat format to the nested
|
|
6
|
-
# transport format expected by robot_lab. Server
|
|
7
|
-
# the responsibility of MCPDiscovery — this class
|
|
6
|
+
# transport format expected by robot_lab (RobotLab::MCP.build). Server
|
|
7
|
+
# selection/filtering is the responsibility of MCPDiscovery — this class
|
|
8
|
+
# only transforms shape.
|
|
8
9
|
|
|
9
10
|
module AIA
|
|
10
11
|
class MCPConfigNormalizer
|
|
12
|
+
# Flat keys that describe how to reach the server; folded into :transport.
|
|
13
|
+
TRANSPORT_KEYS = %i[type command args env url headers bearer_token oauth cwd directory].freeze
|
|
14
|
+
|
|
11
15
|
class << self
|
|
12
16
|
# Normalize a single MCP server config to robot_lab's nested transport format.
|
|
17
|
+
# Settings robot_lab understands (timeout, prefix, only, except,
|
|
18
|
+
# requires_approval, description, ...) are carried through unchanged.
|
|
19
|
+
#
|
|
20
|
+
# A RubyLLM::MCP subclass or instance, or the constant name of one,
|
|
21
|
+
# already describes its own transport and is returned unchanged
|
|
22
|
+
# (RobotLab::MCP.build resolves the name).
|
|
13
23
|
#
|
|
14
|
-
# @param server [Hash]
|
|
15
|
-
# @return [Hash]
|
|
24
|
+
# @param server [Hash, Class<RubyLLM::MCP>, RubyLLM::MCP, String]
|
|
25
|
+
# @return [Hash, Class<RubyLLM::MCP>, RubyLLM::MCP, String]
|
|
16
26
|
def normalize(server)
|
|
17
|
-
server
|
|
27
|
+
return server if mcp_object?(server) || AIA::Utility.mcp_class_name?(server)
|
|
28
|
+
|
|
29
|
+
server = server.to_h.transform_keys(&:to_sym)
|
|
18
30
|
|
|
19
31
|
# Already in robot_lab format — pass through
|
|
20
32
|
return server if server[:transport]
|
|
21
33
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
transport
|
|
25
|
-
|
|
26
|
-
transport
|
|
27
|
-
|
|
34
|
+
transport = server.slice(*TRANSPORT_KEYS).compact
|
|
35
|
+
transport[:type] ||= server[:url] ? 'streamable-http' : 'stdio'
|
|
36
|
+
transport[:args] = Array(transport[:args]) if transport.key?(:args)
|
|
37
|
+
|
|
38
|
+
server.except(*TRANSPORT_KEYS).merge(transport: transport)
|
|
39
|
+
end
|
|
28
40
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
41
|
+
# @param server [Object]
|
|
42
|
+
# @return [Boolean] true for a RubyLLM::MCP instance or subclass
|
|
43
|
+
def mcp_object?(server)
|
|
44
|
+
server.is_a?(RubyLLM::MCP) || (server.is_a?(Class) && server <= RubyLLM::MCP)
|
|
32
45
|
end
|
|
33
46
|
end
|
|
34
47
|
end
|