aia 0.9.24 → 0.10.2
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 +84 -3
- data/README.md +179 -59
- data/bin/aia +6 -0
- data/docs/cli-reference.md +145 -72
- data/docs/configuration.md +156 -19
- data/docs/examples/tools/index.md +2 -2
- data/docs/faq.md +11 -11
- data/docs/guides/available-models.md +11 -11
- data/docs/guides/basic-usage.md +18 -17
- data/docs/guides/chat.md +57 -11
- data/docs/guides/executable-prompts.md +15 -15
- data/docs/guides/first-prompt.md +2 -2
- data/docs/guides/getting-started.md +6 -6
- data/docs/guides/image-generation.md +24 -24
- data/docs/guides/local-models.md +2 -2
- data/docs/guides/models.md +96 -18
- data/docs/guides/tools.md +4 -4
- data/docs/installation.md +2 -2
- data/docs/prompt_management.md +11 -11
- data/docs/security.md +3 -3
- data/docs/workflows-and-pipelines.md +1 -1
- data/examples/README.md +6 -6
- data/examples/headlines +3 -3
- data/lib/aia/aia_completion.bash +2 -2
- data/lib/aia/aia_completion.fish +4 -4
- data/lib/aia/aia_completion.zsh +2 -2
- data/lib/aia/chat_processor_service.rb +31 -21
- data/lib/aia/config/cli_parser.rb +403 -403
- data/lib/aia/config/config_section.rb +87 -0
- data/lib/aia/config/defaults.yml +219 -0
- data/lib/aia/config/defaults_loader.rb +147 -0
- data/lib/aia/config/mcp_parser.rb +151 -0
- data/lib/aia/config/model_spec.rb +67 -0
- data/lib/aia/config/validator.rb +185 -136
- data/lib/aia/config.rb +336 -17
- data/lib/aia/directive_processor.rb +14 -6
- data/lib/aia/directives/configuration.rb +24 -10
- data/lib/aia/directives/models.rb +3 -4
- data/lib/aia/directives/utility.rb +3 -2
- data/lib/aia/directives/web_and_file.rb +50 -47
- data/lib/aia/logger.rb +328 -0
- data/lib/aia/prompt_handler.rb +18 -22
- data/lib/aia/ruby_llm_adapter.rb +572 -69
- data/lib/aia/session.rb +9 -8
- data/lib/aia/ui_presenter.rb +20 -16
- data/lib/aia/utility.rb +50 -18
- data/lib/aia.rb +91 -66
- data/lib/extensions/ruby_llm/modalities.rb +2 -0
- data/mcp_servers/apple-mcp.json +8 -0
- data/mcp_servers/mcp_server_chart.json +11 -0
- data/mcp_servers/playwright_one.json +8 -0
- data/mcp_servers/playwright_two.json +8 -0
- data/mcp_servers/tavily_mcp_server.json +8 -0
- metadata +83 -25
- data/lib/aia/config/base.rb +0 -308
- data/lib/aia/config/defaults.rb +0 -91
- data/lib/aia/config/file_loader.rb +0 -163
- data/mcp_servers/imcp.json +0 -7
- data/mcp_servers/launcher.json +0 -11
- data/mcp_servers/timeserver.json +0 -8
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: aia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dewayne VanHoozer
|
|
@@ -10,7 +10,21 @@ cert_chain: []
|
|
|
10
10
|
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
|
-
name:
|
|
13
|
+
name: anyway_config
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '2.6'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - "~>"
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '2.6'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: amazing_print
|
|
14
28
|
requirement: !ruby/object:Gem::Requirement
|
|
15
29
|
requirements:
|
|
16
30
|
- - ">="
|
|
@@ -24,7 +38,7 @@ dependencies:
|
|
|
24
38
|
- !ruby/object:Gem::Version
|
|
25
39
|
version: '0'
|
|
26
40
|
- !ruby/object:Gem::Dependency
|
|
27
|
-
name:
|
|
41
|
+
name: async
|
|
28
42
|
requirement: !ruby/object:Gem::Requirement
|
|
29
43
|
requirements:
|
|
30
44
|
- - ">="
|
|
@@ -38,7 +52,7 @@ dependencies:
|
|
|
38
52
|
- !ruby/object:Gem::Version
|
|
39
53
|
version: '0'
|
|
40
54
|
- !ruby/object:Gem::Dependency
|
|
41
|
-
name:
|
|
55
|
+
name: clipboard
|
|
42
56
|
requirement: !ruby/object:Gem::Requirement
|
|
43
57
|
requirements:
|
|
44
58
|
- - ">="
|
|
@@ -52,7 +66,7 @@ dependencies:
|
|
|
52
66
|
- !ruby/object:Gem::Version
|
|
53
67
|
version: '0'
|
|
54
68
|
- !ruby/object:Gem::Dependency
|
|
55
|
-
name:
|
|
69
|
+
name: simple_flow
|
|
56
70
|
requirement: !ruby/object:Gem::Requirement
|
|
57
71
|
requirements:
|
|
58
72
|
- - ">="
|
|
@@ -66,7 +80,7 @@ dependencies:
|
|
|
66
80
|
- !ruby/object:Gem::Version
|
|
67
81
|
version: '0'
|
|
68
82
|
- !ruby/object:Gem::Dependency
|
|
69
|
-
name:
|
|
83
|
+
name: lumberjack
|
|
70
84
|
requirement: !ruby/object:Gem::Requirement
|
|
71
85
|
requirements:
|
|
72
86
|
- - ">="
|
|
@@ -80,49 +94,49 @@ dependencies:
|
|
|
80
94
|
- !ruby/object:Gem::Version
|
|
81
95
|
version: '0'
|
|
82
96
|
- !ruby/object:Gem::Dependency
|
|
83
|
-
name:
|
|
97
|
+
name: faraday
|
|
84
98
|
requirement: !ruby/object:Gem::Requirement
|
|
85
99
|
requirements:
|
|
86
100
|
- - ">="
|
|
87
101
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 0
|
|
102
|
+
version: '0'
|
|
89
103
|
type: :runtime
|
|
90
104
|
prerelease: false
|
|
91
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
106
|
requirements:
|
|
93
107
|
- - ">="
|
|
94
108
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0
|
|
109
|
+
version: '0'
|
|
96
110
|
- !ruby/object:Gem::Dependency
|
|
97
|
-
name:
|
|
111
|
+
name: prompt_manager
|
|
98
112
|
requirement: !ruby/object:Gem::Requirement
|
|
99
113
|
requirements:
|
|
100
114
|
- - ">="
|
|
101
115
|
- !ruby/object:Gem::Version
|
|
102
|
-
version:
|
|
116
|
+
version: '0'
|
|
103
117
|
type: :runtime
|
|
104
118
|
prerelease: false
|
|
105
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
106
120
|
requirements:
|
|
107
121
|
- - ">="
|
|
108
122
|
- !ruby/object:Gem::Version
|
|
109
|
-
version:
|
|
123
|
+
version: '0'
|
|
110
124
|
- !ruby/object:Gem::Dependency
|
|
111
|
-
name: ruby_llm
|
|
125
|
+
name: ruby_llm
|
|
112
126
|
requirement: !ruby/object:Gem::Requirement
|
|
113
127
|
requirements:
|
|
114
128
|
- - ">="
|
|
115
129
|
- !ruby/object:Gem::Version
|
|
116
|
-
version: 0
|
|
130
|
+
version: '0'
|
|
117
131
|
type: :runtime
|
|
118
132
|
prerelease: false
|
|
119
133
|
version_requirements: !ruby/object:Gem::Requirement
|
|
120
134
|
requirements:
|
|
121
135
|
- - ">="
|
|
122
136
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 0
|
|
137
|
+
version: '0'
|
|
124
138
|
- !ruby/object:Gem::Dependency
|
|
125
|
-
name:
|
|
139
|
+
name: ruby_llm-mcp
|
|
126
140
|
requirement: !ruby/object:Gem::Requirement
|
|
127
141
|
requirements:
|
|
128
142
|
- - ">="
|
|
@@ -136,7 +150,7 @@ dependencies:
|
|
|
136
150
|
- !ruby/object:Gem::Version
|
|
137
151
|
version: '0'
|
|
138
152
|
- !ruby/object:Gem::Dependency
|
|
139
|
-
name:
|
|
153
|
+
name: reline
|
|
140
154
|
requirement: !ruby/object:Gem::Requirement
|
|
141
155
|
requirements:
|
|
142
156
|
- - ">="
|
|
@@ -150,7 +164,7 @@ dependencies:
|
|
|
150
164
|
- !ruby/object:Gem::Version
|
|
151
165
|
version: '0'
|
|
152
166
|
- !ruby/object:Gem::Dependency
|
|
153
|
-
name:
|
|
167
|
+
name: shellwords
|
|
154
168
|
requirement: !ruby/object:Gem::Requirement
|
|
155
169
|
requirements:
|
|
156
170
|
- - ">="
|
|
@@ -421,10 +435,12 @@ files:
|
|
|
421
435
|
- lib/aia/aia_completion.zsh
|
|
422
436
|
- lib/aia/chat_processor_service.rb
|
|
423
437
|
- lib/aia/config.rb
|
|
424
|
-
- lib/aia/config/base.rb
|
|
425
438
|
- lib/aia/config/cli_parser.rb
|
|
426
|
-
- lib/aia/config/
|
|
427
|
-
- lib/aia/config/
|
|
439
|
+
- lib/aia/config/config_section.rb
|
|
440
|
+
- lib/aia/config/defaults.yml
|
|
441
|
+
- lib/aia/config/defaults_loader.rb
|
|
442
|
+
- lib/aia/config/mcp_parser.rb
|
|
443
|
+
- lib/aia/config/model_spec.rb
|
|
428
444
|
- lib/aia/config/validator.rb
|
|
429
445
|
- lib/aia/directive_processor.rb
|
|
430
446
|
- lib/aia/directives/checkpoint.rb
|
|
@@ -436,6 +452,7 @@ files:
|
|
|
436
452
|
- lib/aia/directives/web_and_file.rb
|
|
437
453
|
- lib/aia/fzf.rb
|
|
438
454
|
- lib/aia/history_manager.rb
|
|
455
|
+
- lib/aia/logger.rb
|
|
439
456
|
- lib/aia/prompt_handler.rb
|
|
440
457
|
- lib/aia/ruby_llm_adapter.rb
|
|
441
458
|
- lib/aia/session.rb
|
|
@@ -450,11 +467,13 @@ files:
|
|
|
450
467
|
- lib/refinements/string.rb
|
|
451
468
|
- main.just
|
|
452
469
|
- mcp_servers/README.md
|
|
470
|
+
- mcp_servers/apple-mcp.json
|
|
453
471
|
- mcp_servers/filesystem.json
|
|
454
|
-
- mcp_servers/
|
|
455
|
-
- mcp_servers/
|
|
472
|
+
- mcp_servers/mcp_server_chart.json
|
|
473
|
+
- mcp_servers/playwright_one.json
|
|
456
474
|
- mcp_servers/playwright_server_definition.json
|
|
457
|
-
- mcp_servers/
|
|
475
|
+
- mcp_servers/playwright_two.json
|
|
476
|
+
- mcp_servers/tavily_mcp_server.json
|
|
458
477
|
- mkdocs.yml
|
|
459
478
|
homepage: https://github.com/MadBomber/aia
|
|
460
479
|
licenses:
|
|
@@ -464,6 +483,44 @@ metadata:
|
|
|
464
483
|
homepage_uri: https://github.com/MadBomber/aia
|
|
465
484
|
source_code_uri: https://github.com/MadBomber/aia
|
|
466
485
|
changelog_uri: https://github.com/MadBomber/aia
|
|
486
|
+
post_install_message: |2+
|
|
487
|
+
|
|
488
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
489
|
+
║ AIA — AI Assistant Installed! ║
|
|
490
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
491
|
+
|
|
492
|
+
⚠ Note: v0.10+ has breaking changes in config file format and
|
|
493
|
+
environment variable names. See docs for details.
|
|
494
|
+
|
|
495
|
+
Multi-model AI from your command line. 20+ providers supported.
|
|
496
|
+
|
|
497
|
+
Quick Start:
|
|
498
|
+
aia --help Show all options
|
|
499
|
+
aia --chat Start an interactive chat session
|
|
500
|
+
aia --fuzzy Select a prompt with fuzzy finder
|
|
501
|
+
aia my_prompt_file Run saved prompt(s) in batch mode
|
|
502
|
+
|
|
503
|
+
Setup:
|
|
504
|
+
1. Set your API key(s): export OPENAI_API_KEY=your_key
|
|
505
|
+
export ANTHROPIC_API_KEY=your_key
|
|
506
|
+
... etc.
|
|
507
|
+
2. Create prompts dir: mkdir -p ~/.prompts
|
|
508
|
+
3. Initialize config: aia --dump ~/.config/aia/aia.yml
|
|
509
|
+
|
|
510
|
+
Key Features:
|
|
511
|
+
• Dynamic prompts with embedded directives (//include, //shell)
|
|
512
|
+
• Consensus mode: run multiple models, get unified responses
|
|
513
|
+
• Shell & Ruby (ERB) integration in prompts
|
|
514
|
+
• Tool callbacks via RubyLLM::Tool
|
|
515
|
+
• MCP Integration via RubyLLM::MCP
|
|
516
|
+
• Session history and checkpoints
|
|
517
|
+
• Pipeline workflows
|
|
518
|
+
• Concurrently run the same prompt against multiple models
|
|
519
|
+
• Get cost estimates for prompts against multiple models
|
|
520
|
+
|
|
521
|
+
Documentation: https://madbomber.github.io/aia
|
|
522
|
+
Source Code: https://github.com/MadBomber/aia
|
|
523
|
+
|
|
467
524
|
rdoc_options: []
|
|
468
525
|
require_paths:
|
|
469
526
|
- lib
|
|
@@ -478,8 +535,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
478
535
|
- !ruby/object:Gem::Version
|
|
479
536
|
version: '0'
|
|
480
537
|
requirements: []
|
|
481
|
-
rubygems_version: 4.0.
|
|
538
|
+
rubygems_version: 4.0.3
|
|
482
539
|
specification_version: 4
|
|
483
540
|
summary: Multi-model AI CLI with dynamic prompts, consensus responses, shell & Ruby
|
|
484
541
|
integration, and seamless chat workflows.
|
|
485
542
|
test_files: []
|
|
543
|
+
...
|
data/lib/aia/config/base.rb
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
# lib/aia/config/base.rb
|
|
2
|
-
|
|
3
|
-
require 'ostruct'
|
|
4
|
-
require 'date'
|
|
5
|
-
require_relative 'defaults'
|
|
6
|
-
require_relative 'cli_parser'
|
|
7
|
-
require_relative 'file_loader'
|
|
8
|
-
require_relative 'validator'
|
|
9
|
-
|
|
10
|
-
module AIA
|
|
11
|
-
module ConfigModules
|
|
12
|
-
module Base
|
|
13
|
-
class << self
|
|
14
|
-
# Delegate to other config modules
|
|
15
|
-
def cli_options
|
|
16
|
-
CLIParser.cli_options
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def cf_options(file)
|
|
20
|
-
FileLoader.cf_options(file)
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
def dump_config(config, file)
|
|
24
|
-
FileLoader.dump_config(config, file)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def generate_completion_script(shell)
|
|
28
|
-
FileLoader.generate_completion_script(shell)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def tailor_the_config(config)
|
|
32
|
-
Validator.tailor_the_config(config)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def validate_pipeline_prompts(config)
|
|
36
|
-
Validator.validate_pipeline_prompts(config)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def normalize_boolean_flag(config, flag)
|
|
40
|
-
Validator.normalize_boolean_flag(config, flag)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def process_tools_option(path_list, config)
|
|
44
|
-
CLIParser.process_tools_option(path_list, config)
|
|
45
|
-
end
|
|
46
|
-
|
|
47
|
-
def validate_and_set_context_files(config, remaining_args)
|
|
48
|
-
Validator.validate_and_set_context_files(config, remaining_args)
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
def setup_mode_options(opts, config)
|
|
52
|
-
CLIParser.setup_mode_options(opts, config)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def parse_config_content(content, ext)
|
|
56
|
-
FileLoader.parse_config_content(content, ext)
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
def normalize_last_refresh_date(config)
|
|
60
|
-
FileLoader.normalize_last_refresh_date(config)
|
|
61
|
-
end
|
|
62
|
-
|
|
63
|
-
def process_prompt_id_from_args(config, remaining_args)
|
|
64
|
-
Validator.process_prompt_id_from_args(config, remaining_args)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
def process_role_configuration(config)
|
|
68
|
-
Validator.process_role_configuration(config)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
def prepare_pipeline(config)
|
|
72
|
-
Validator.prepare_pipeline(config)
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def setup_model_options(opts, config)
|
|
76
|
-
CLIParser.setup_model_options(opts, config)
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def setup_ai_parameters(opts, config)
|
|
80
|
-
CLIParser.setup_ai_parameters(opts, config)
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
def read_and_process_config_file(file)
|
|
84
|
-
FileLoader.read_and_process_config_file(file)
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def process_stdin_content
|
|
88
|
-
Validator.process_stdin_content
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
def process_allowed_tools_option(tools_list, config)
|
|
92
|
-
CLIParser.process_allowed_tools_option(tools_list, config)
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
def process_rejected_tools_option(tools_list, config)
|
|
96
|
-
CLIParser.process_rejected_tools_option(tools_list, config)
|
|
97
|
-
end
|
|
98
|
-
|
|
99
|
-
def normalize_boolean_flags(config)
|
|
100
|
-
Validator.normalize_boolean_flags(config)
|
|
101
|
-
end
|
|
102
|
-
|
|
103
|
-
def handle_executable_prompt(config)
|
|
104
|
-
Validator.handle_executable_prompt(config)
|
|
105
|
-
end
|
|
106
|
-
|
|
107
|
-
def handle_fuzzy_search_prompt_id(config)
|
|
108
|
-
Validator.handle_fuzzy_search_prompt_id(config)
|
|
109
|
-
end
|
|
110
|
-
|
|
111
|
-
def create_option_parser(config)
|
|
112
|
-
CLIParser.create_option_parser(config)
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
def apply_file_config_to_struct(config, file_config)
|
|
116
|
-
FileLoader.apply_file_config_to_struct(config, file_config)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
def configure_prompt_manager(config)
|
|
120
|
-
Validator.configure_prompt_manager(config)
|
|
121
|
-
end
|
|
122
|
-
|
|
123
|
-
def setup
|
|
124
|
-
default_config = Defaults::DEFAULT_CONFIG.dup
|
|
125
|
-
cli_config = cli_options
|
|
126
|
-
envar_config = envar_options(default_config, cli_config)
|
|
127
|
-
|
|
128
|
-
file = envar_config.config_file unless envar_config.config_file.nil?
|
|
129
|
-
file = cli_config.config_file unless cli_config.config_file.nil?
|
|
130
|
-
|
|
131
|
-
cf_config = cf_options(file)
|
|
132
|
-
|
|
133
|
-
config = OpenStruct.merge(
|
|
134
|
-
default_config,
|
|
135
|
-
cf_config || {},
|
|
136
|
-
envar_config || {},
|
|
137
|
-
cli_config || {}
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
config = tailor_the_config(config)
|
|
141
|
-
load_libraries(config)
|
|
142
|
-
load_tools(config)
|
|
143
|
-
load_mcp_servers(config)
|
|
144
|
-
|
|
145
|
-
if config.dump_file
|
|
146
|
-
dump_config(config, config.dump_file)
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
config
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def load_libraries(config)
|
|
153
|
-
return if config.require_libs.empty?
|
|
154
|
-
|
|
155
|
-
exit_on_error = false
|
|
156
|
-
|
|
157
|
-
config.require_libs.each do |library|
|
|
158
|
-
begin
|
|
159
|
-
require(library)
|
|
160
|
-
# Check if the library provides tools that need eager loading
|
|
161
|
-
# Convert library name to module constant (e.g., 'shared_tools' -> 'SharedTools')
|
|
162
|
-
eager_load_tools_from_library(library)
|
|
163
|
-
rescue => e
|
|
164
|
-
STDERR.puts "Error loading library '#{library}' #{e.message}"
|
|
165
|
-
exit_on_error = true
|
|
166
|
-
end
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
exit(1) if exit_on_error
|
|
170
|
-
|
|
171
|
-
config
|
|
172
|
-
end
|
|
173
|
-
|
|
174
|
-
# Attempt to eager load tools from a required library
|
|
175
|
-
# Libraries that use Zeitwerk need their tools eager loaded so they
|
|
176
|
-
# appear in ObjectSpace for AIA's tool discovery
|
|
177
|
-
def eager_load_tools_from_library(library)
|
|
178
|
-
# Convert library name to module constant (e.g., 'shared_tools' -> 'SharedTools')
|
|
179
|
-
module_name = library.split('/').first.split('_').map(&:capitalize).join
|
|
180
|
-
|
|
181
|
-
begin
|
|
182
|
-
mod = Object.const_get(module_name)
|
|
183
|
-
if mod.respond_to?(:load_all_tools)
|
|
184
|
-
mod.load_all_tools
|
|
185
|
-
end
|
|
186
|
-
rescue NameError
|
|
187
|
-
# Module doesn't exist with expected name, skip
|
|
188
|
-
end
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
def load_tools(config)
|
|
192
|
-
return if config.tool_paths.empty?
|
|
193
|
-
|
|
194
|
-
require_all_tools(config)
|
|
195
|
-
|
|
196
|
-
config
|
|
197
|
-
end
|
|
198
|
-
|
|
199
|
-
def require_all_tools(config)
|
|
200
|
-
exit_on_error = false
|
|
201
|
-
|
|
202
|
-
config.tool_paths.each do |tool_path|
|
|
203
|
-
begin
|
|
204
|
-
# expands path based on PWD
|
|
205
|
-
absolute_tool_path = File.expand_path(tool_path)
|
|
206
|
-
require(absolute_tool_path)
|
|
207
|
-
rescue => e
|
|
208
|
-
STDERR.puts "Error loading tool '#{tool_path}' #{e.message}"
|
|
209
|
-
exit_on_error = true
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
exit(1) if exit_on_error
|
|
214
|
-
end
|
|
215
|
-
|
|
216
|
-
def load_mcp_servers(config)
|
|
217
|
-
servers = config.mcp_servers
|
|
218
|
-
|
|
219
|
-
return config if servers.nil? || (servers.respond_to?(:empty?) && servers.empty?)
|
|
220
|
-
|
|
221
|
-
servers.each do |server|
|
|
222
|
-
name = server[:name] || server["name"]
|
|
223
|
-
command = server[:command] || server["command"]
|
|
224
|
-
args = server[:args] || server["args"] || []
|
|
225
|
-
env = server[:env] || server["env"] || {}
|
|
226
|
-
timeout = server[:timeout] || server["timeout"] || 8000 # default 8 seconds in ms
|
|
227
|
-
|
|
228
|
-
unless name && command
|
|
229
|
-
STDERR.puts "WARNING: MCP server entry missing name or command: #{server.inspect}"
|
|
230
|
-
next
|
|
231
|
-
end
|
|
232
|
-
|
|
233
|
-
# Resolve command path if not absolute
|
|
234
|
-
resolved_command = resolve_command_path(command)
|
|
235
|
-
unless resolved_command
|
|
236
|
-
STDERR.puts "WARNING: MCP server '#{name}' command not found: #{command}"
|
|
237
|
-
next
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
begin
|
|
241
|
-
RubyLLM::MCP.add_client(
|
|
242
|
-
name: name,
|
|
243
|
-
transport_type: :stdio,
|
|
244
|
-
request_timeout: timeout,
|
|
245
|
-
config: {
|
|
246
|
-
command: resolved_command,
|
|
247
|
-
args: args,
|
|
248
|
-
env: env
|
|
249
|
-
}
|
|
250
|
-
)
|
|
251
|
-
rescue => e
|
|
252
|
-
STDERR.puts "ERROR: Failed to load MCP server '#{name}': #{e.message}"
|
|
253
|
-
end
|
|
254
|
-
end
|
|
255
|
-
|
|
256
|
-
config
|
|
257
|
-
end
|
|
258
|
-
|
|
259
|
-
def resolve_command_path(command)
|
|
260
|
-
# If already absolute path, verify it exists
|
|
261
|
-
if command.start_with?('/')
|
|
262
|
-
return File.executable?(command) ? command : nil
|
|
263
|
-
end
|
|
264
|
-
|
|
265
|
-
# Search in PATH
|
|
266
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |dir|
|
|
267
|
-
full_path = File.join(dir, command)
|
|
268
|
-
return full_path if File.executable?(full_path)
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
nil
|
|
272
|
-
end
|
|
273
|
-
|
|
274
|
-
# envar values are always String object so need other config
|
|
275
|
-
# layers to know the prompter type for each key's value
|
|
276
|
-
def envar_options(default, cli_config)
|
|
277
|
-
config = OpenStruct.merge(default, cli_config)
|
|
278
|
-
envars = ENV.keys.select { |key, _| key.start_with?('AIA_') }
|
|
279
|
-
envars.each do |envar|
|
|
280
|
-
key = envar.sub(/^AIA_/, '').downcase.to_sym
|
|
281
|
-
value = ENV[envar]
|
|
282
|
-
|
|
283
|
-
value = case config[key]
|
|
284
|
-
when TrueClass, FalseClass
|
|
285
|
-
value.downcase == 'true'
|
|
286
|
-
when Integer
|
|
287
|
-
value.to_i
|
|
288
|
-
when Float
|
|
289
|
-
value.to_f
|
|
290
|
-
when Array
|
|
291
|
-
# Special handling for :model to support inline role syntax (ADR-005 v2)
|
|
292
|
-
if key == :model && value.include?('=')
|
|
293
|
-
CLIParser.parse_models_with_roles(value)
|
|
294
|
-
else
|
|
295
|
-
value.split(',').map(&:strip)
|
|
296
|
-
end
|
|
297
|
-
else
|
|
298
|
-
value # defaults to String
|
|
299
|
-
end
|
|
300
|
-
config[key] = value
|
|
301
|
-
end
|
|
302
|
-
|
|
303
|
-
config
|
|
304
|
-
end
|
|
305
|
-
end
|
|
306
|
-
end
|
|
307
|
-
end
|
|
308
|
-
end
|
data/lib/aia/config/defaults.rb
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# lib/aia/config/defaults.rb
|
|
2
|
-
|
|
3
|
-
require 'yaml'
|
|
4
|
-
require 'toml-rb'
|
|
5
|
-
require 'date'
|
|
6
|
-
require 'prompt_manager'
|
|
7
|
-
|
|
8
|
-
module AIA
|
|
9
|
-
module ConfigModules
|
|
10
|
-
module Defaults
|
|
11
|
-
DEFAULT_CONFIG = OpenStruct.new({
|
|
12
|
-
adapter: 'ruby_llm', # 'ruby_llm' or ???
|
|
13
|
-
#
|
|
14
|
-
aia_dir: File.join(ENV['HOME'], '.aia'),
|
|
15
|
-
config_file: File.join(ENV['HOME'], '.aia', 'config.yml'),
|
|
16
|
-
out_file: 'temp.md',
|
|
17
|
-
log_file: File.join(ENV['HOME'], '.prompts', '_prompts.log'),
|
|
18
|
-
context_files: [],
|
|
19
|
-
#
|
|
20
|
-
prompts_dir: File.join(ENV['HOME'], '.prompts'),
|
|
21
|
-
prompt_extname: PromptManager::Storage::FileSystemAdapter::PROMPT_EXTENSION,
|
|
22
|
-
#
|
|
23
|
-
roles_prefix: 'roles',
|
|
24
|
-
roles_dir: File.join(ENV['HOME'], '.prompts', 'roles'),
|
|
25
|
-
role: '',
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
system_prompt: '',
|
|
29
|
-
|
|
30
|
-
# Tools
|
|
31
|
-
tools: '', # Comma-separated string of loaded tool names (set by adapter)
|
|
32
|
-
allowed_tools: nil, # nil means all tools are allowed; otherwise an Array of Strings which are the tool names
|
|
33
|
-
rejected_tools: nil, # nil means no tools are rejected
|
|
34
|
-
tool_paths: [], # Strings - absolute and relative to tools
|
|
35
|
-
|
|
36
|
-
# Flags
|
|
37
|
-
markdown: true,
|
|
38
|
-
shell: true,
|
|
39
|
-
erb: true,
|
|
40
|
-
chat: false,
|
|
41
|
-
clear: false,
|
|
42
|
-
terse: false,
|
|
43
|
-
verbose: false,
|
|
44
|
-
debug: $DEBUG_ME,
|
|
45
|
-
fuzzy: false,
|
|
46
|
-
speak: false,
|
|
47
|
-
append: false, # Default to not append to existing out_file
|
|
48
|
-
|
|
49
|
-
# workflow
|
|
50
|
-
pipeline: [],
|
|
51
|
-
|
|
52
|
-
# PromptManager::Prompt Tailoring
|
|
53
|
-
parameter_regex: PromptManager::Prompt.parameter_regex.to_s,
|
|
54
|
-
|
|
55
|
-
# LLM tuning parameters
|
|
56
|
-
temperature: 0.7,
|
|
57
|
-
max_tokens: 2048,
|
|
58
|
-
top_p: 1.0,
|
|
59
|
-
frequency_penalty: 0.0,
|
|
60
|
-
presence_penalty: 0.0,
|
|
61
|
-
|
|
62
|
-
# Audio Parameters
|
|
63
|
-
voice: 'alloy',
|
|
64
|
-
speak_command: 'afplay', # 'afplay' for audio files on MacOS
|
|
65
|
-
|
|
66
|
-
# Image Parameters
|
|
67
|
-
image_size: '1024x1024',
|
|
68
|
-
image_quality: 'standard',
|
|
69
|
-
image_style: 'vivid',
|
|
70
|
-
|
|
71
|
-
# Models
|
|
72
|
-
model: ['gpt-4o-mini'],
|
|
73
|
-
consensus: nil, # nil/false = individual responses; true = consensus response
|
|
74
|
-
speech_model: 'tts-1',
|
|
75
|
-
transcription_model: 'whisper-1',
|
|
76
|
-
embedding_model: 'text-embedding-ada-002',
|
|
77
|
-
image_model: 'dall-e-3',
|
|
78
|
-
|
|
79
|
-
# Model Regristery
|
|
80
|
-
refresh: 7, # days between refreshes of model info; 0 means every startup
|
|
81
|
-
last_refresh: Date.today - 1,
|
|
82
|
-
|
|
83
|
-
# Ruby libraries to require for Ruby binding
|
|
84
|
-
require_libs: [],
|
|
85
|
-
|
|
86
|
-
# MCP Servers (nil means not configured, set in config file)
|
|
87
|
-
mcp_servers: nil,
|
|
88
|
-
}).freeze
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
end
|