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/examples/run_all.sh
DELETED
|
@@ -1,294 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
# examples/run_all.sh
|
|
3
|
-
#
|
|
4
|
-
# Runs all example demo scripts in order and captures output.
|
|
5
|
-
#
|
|
6
|
-
# The output is saved to a timestamped file for comparison against
|
|
7
|
-
# future runs — a super-meta integration test. Since LLM responses
|
|
8
|
-
# are non-deterministic, exact diffs won't match; look for structural
|
|
9
|
-
# differences (missing sections, crashes, changed command output).
|
|
10
|
-
#
|
|
11
|
-
# What it skips:
|
|
12
|
-
# - 00_setup_aia.sh — run manually first (pulls models, writes config)
|
|
13
|
-
# - 15_parameters.sh — Part 2 prompts interactively for a required param
|
|
14
|
-
# - 20_mcp_servers.sh — requires Node.js/npx + MCP filesystem server
|
|
15
|
-
# - 22_chat_mode.sh — interactive chat (Parts 1-4 use expect; Part 5
|
|
16
|
-
# opens a live session)
|
|
17
|
-
# - 29_agent_harness.sh — 3-tier orchestration (10-20 min runtime)
|
|
18
|
-
#
|
|
19
|
-
# Scripts 23-28 run with BATCH_MODE=true, which skips their interactive
|
|
20
|
-
# "your turn" sections but still executes the automated expect-based parts.
|
|
21
|
-
#
|
|
22
|
-
# Prerequisites:
|
|
23
|
-
# - Run 00_setup_aia.sh first (OPENAI_API_KEY must be set)
|
|
24
|
-
#
|
|
25
|
-
# Usage:
|
|
26
|
-
# cd examples
|
|
27
|
-
# bash run_all.sh # run and save output
|
|
28
|
-
# bash run_all.sh --no-save # run without saving (just print)
|
|
29
|
-
# diff output/run_PREV.log output/run_LATEST.log # compare runs
|
|
30
|
-
#
|
|
31
|
-
# Exit codes:
|
|
32
|
-
# 0 — all scripts completed (some may have non-fatal warnings)
|
|
33
|
-
# 1 — setup not done or a script failed fatally
|
|
34
|
-
|
|
35
|
-
set -uo pipefail
|
|
36
|
-
|
|
37
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
38
|
-
cd "${SCRIPT_DIR}"
|
|
39
|
-
|
|
40
|
-
# --- Usage ---
|
|
41
|
-
|
|
42
|
-
usage() {
|
|
43
|
-
cat <<'USAGE'
|
|
44
|
-
Usage: bash run_all.sh [OPTIONS]
|
|
45
|
-
|
|
46
|
-
Run all non-interactive AIA example scripts and capture output.
|
|
47
|
-
|
|
48
|
-
Options:
|
|
49
|
-
-h, --help Show this help message and exit
|
|
50
|
-
--no-save Print output to the terminal only (do not save a log file)
|
|
51
|
-
|
|
52
|
-
By default the output is saved to examples/output/run_YYYYMMDD_HHMMSS.log.
|
|
53
|
-
Since LLM responses are non-deterministic, exact diffs between runs won't
|
|
54
|
-
match; look for structural differences (missing sections, crashes, changed
|
|
55
|
-
command output).
|
|
56
|
-
|
|
57
|
-
Saving output with tee:
|
|
58
|
-
bash run_all.sh --no-save 2>&1 | tee my_run.log
|
|
59
|
-
|
|
60
|
-
Use --no-save so the script does not write its own log file, then pipe
|
|
61
|
-
through tee to send output to both the terminal and your chosen file.
|
|
62
|
-
|
|
63
|
-
Comparing runs:
|
|
64
|
-
diff output/run_PREV.log output/run_LATEST.log
|
|
65
|
-
|
|
66
|
-
Skipped scripts (require manual or interactive setup):
|
|
67
|
-
00_setup_aia.sh — run manually first (pulls models, writes config)
|
|
68
|
-
15_parameters.sh — Part 2 prompts interactively for a required param
|
|
69
|
-
20_mcp_servers.sh — requires Node.js/npx + MCP filesystem server
|
|
70
|
-
22_chat_mode.sh — interactive chat session
|
|
71
|
-
29_agent_harness.sh — 3-tier orchestration (10-20 min runtime)
|
|
72
|
-
|
|
73
|
-
Scripts 23-28 run with BATCH_MODE=true, which skips their interactive
|
|
74
|
-
"your turn" sections but still runs the automated expect-based parts.
|
|
75
|
-
|
|
76
|
-
Prerequisites:
|
|
77
|
-
1. Run 00_setup_aia.sh first (OPENAI_API_KEY must be set)
|
|
78
|
-
|
|
79
|
-
Exit codes:
|
|
80
|
-
0 All scripts completed (some may have non-fatal warnings)
|
|
81
|
-
1 Setup not done or a script failed fatally
|
|
82
|
-
USAGE
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
# --- Parse flags ---
|
|
86
|
-
|
|
87
|
-
SAVE_OUTPUT=true
|
|
88
|
-
case "${1:-}" in
|
|
89
|
-
-h|--help)
|
|
90
|
-
usage
|
|
91
|
-
exit 0
|
|
92
|
-
;;
|
|
93
|
-
--no-save)
|
|
94
|
-
SAVE_OUTPUT=false
|
|
95
|
-
;;
|
|
96
|
-
esac
|
|
97
|
-
|
|
98
|
-
# --- Pre-flight checks ---
|
|
99
|
-
|
|
100
|
-
if [[ ! -f "aia_config.yml" ]]; then
|
|
101
|
-
echo "ERROR: aia_config.yml not found."
|
|
102
|
-
echo " Run 00_setup_aia.sh first."
|
|
103
|
-
exit 1
|
|
104
|
-
fi
|
|
105
|
-
|
|
106
|
-
if ! command -v aia &>/dev/null; then
|
|
107
|
-
echo "ERROR: aia is not installed."
|
|
108
|
-
exit 1
|
|
109
|
-
fi
|
|
110
|
-
|
|
111
|
-
# --- Scripts to run ---
|
|
112
|
-
# Order matters: numbered scripts build on each other conceptually.
|
|
113
|
-
# Scripts are listed explicitly so we can annotate skips.
|
|
114
|
-
|
|
115
|
-
SCRIPTS=(
|
|
116
|
-
01_basic_usage.sh
|
|
117
|
-
02_frontmatter.sh
|
|
118
|
-
03_shell_integration.sh
|
|
119
|
-
04_erb_templating.sh
|
|
120
|
-
05_shell_then_erb.sh
|
|
121
|
-
06_prompt_chaining.sh
|
|
122
|
-
07_pipeline.sh
|
|
123
|
-
08_context_files.sh
|
|
124
|
-
09_roles.sh
|
|
125
|
-
10_stdin_piping.sh
|
|
126
|
-
11_multi_model.sh
|
|
127
|
-
12_token_usage.sh
|
|
128
|
-
13_cost_tracking.sh
|
|
129
|
-
14_output_file.sh
|
|
130
|
-
# 15_parameters.sh — skipped: Part 2 blocks on interactive input
|
|
131
|
-
16_directives.sh
|
|
132
|
-
17_require_and_conditionals.sh
|
|
133
|
-
18_tools.sh
|
|
134
|
-
19_local_tools.sh
|
|
135
|
-
# 20_mcp_servers.sh — skipped: requires npx + MCP server
|
|
136
|
-
21_executable_prompts.sh
|
|
137
|
-
# 22_chat_mode.sh — skipped: interactive chat session
|
|
138
|
-
23_verify.sh
|
|
139
|
-
24_decompose.sh
|
|
140
|
-
25_spawn.sh
|
|
141
|
-
26_debate.sh
|
|
142
|
-
27_mention_routing.sh
|
|
143
|
-
28_model_switching.sh
|
|
144
|
-
# 29_agent_harness.sh — skipped: 3-tier orchestration, 10-20 min runtime
|
|
145
|
-
)
|
|
146
|
-
|
|
147
|
-
SKIPPED=(
|
|
148
|
-
"15_parameters.sh (interactive parameter input)"
|
|
149
|
-
"20_mcp_servers.sh (requires Node.js/npx + MCP server)"
|
|
150
|
-
"22_chat_mode.sh (interactive chat session)"
|
|
151
|
-
"29_agent_harness.sh (3-tier orchestration, 10-20 min runtime)"
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
# --- Set up output ---
|
|
155
|
-
|
|
156
|
-
TIMESTAMP="$(date +%Y%m%d_%H%M%S)"
|
|
157
|
-
OUTPUT_DIR="${SCRIPT_DIR}/output"
|
|
158
|
-
OUTPUT_FILE="${OUTPUT_DIR}/run_${TIMESTAMP}.log"
|
|
159
|
-
|
|
160
|
-
if [[ "${SAVE_OUTPUT}" == true ]]; then
|
|
161
|
-
mkdir -p "${OUTPUT_DIR}"
|
|
162
|
-
fi
|
|
163
|
-
|
|
164
|
-
# --- Banner ---
|
|
165
|
-
|
|
166
|
-
banner() {
|
|
167
|
-
cat <<EOF
|
|
168
|
-
================================================================================
|
|
169
|
-
AIA Examples — Full Run
|
|
170
|
-
Date: $(date '+%Y-%m-%d %H:%M:%S')
|
|
171
|
-
AIA: $(aia --version 2>/dev/null || echo "unknown")
|
|
172
|
-
Ruby: $(ruby --version 2>/dev/null | head -1)
|
|
173
|
-
Model: $(grep 'name:' aia_config.yml | head -1 | sed 's/.*name: *//')
|
|
174
|
-
================================================================================
|
|
175
|
-
|
|
176
|
-
Skipped scripts:
|
|
177
|
-
$(printf ' - %s\n' "${SKIPPED[@]}")
|
|
178
|
-
|
|
179
|
-
Running ${#SCRIPTS[@]} scripts ...
|
|
180
|
-
|
|
181
|
-
EOF
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
# --- Run a single script ---
|
|
185
|
-
|
|
186
|
-
run_script() {
|
|
187
|
-
local script="$1"
|
|
188
|
-
local index="$2"
|
|
189
|
-
local total="$3"
|
|
190
|
-
local status
|
|
191
|
-
|
|
192
|
-
echo "──────────────────────────────────────────────────────────────"
|
|
193
|
-
echo " [${index}/${total}] ${script}"
|
|
194
|
-
echo "──────────────────────────────────────────────────────────────"
|
|
195
|
-
echo
|
|
196
|
-
|
|
197
|
-
if [[ ! -f "${script}" ]]; then
|
|
198
|
-
echo " SKIP: file not found"
|
|
199
|
-
echo
|
|
200
|
-
return 0
|
|
201
|
-
fi
|
|
202
|
-
|
|
203
|
-
bash "${script}" 2>&1
|
|
204
|
-
status=$?
|
|
205
|
-
|
|
206
|
-
echo
|
|
207
|
-
if [[ ${status} -eq 0 ]]; then
|
|
208
|
-
echo " ✓ ${script} completed (exit ${status})"
|
|
209
|
-
else
|
|
210
|
-
echo " ✗ ${script} FAILED (exit ${status})"
|
|
211
|
-
fi
|
|
212
|
-
echo
|
|
213
|
-
|
|
214
|
-
return ${status}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
# Scripts that require BATCH_MODE=true to skip their interactive sessions
|
|
218
|
-
BATCH_MODE_SCRIPTS=(
|
|
219
|
-
23_verify.sh
|
|
220
|
-
24_decompose.sh
|
|
221
|
-
25_spawn.sh
|
|
222
|
-
26_debate.sh
|
|
223
|
-
27_mention_routing.sh
|
|
224
|
-
28_model_switching.sh
|
|
225
|
-
)
|
|
226
|
-
|
|
227
|
-
# --- Main ---
|
|
228
|
-
|
|
229
|
-
main() {
|
|
230
|
-
banner
|
|
231
|
-
|
|
232
|
-
local total=${#SCRIPTS[@]}
|
|
233
|
-
local passed=0
|
|
234
|
-
local failed=0
|
|
235
|
-
local failures=()
|
|
236
|
-
|
|
237
|
-
for i in "${!SCRIPTS[@]}"; do
|
|
238
|
-
local script="${SCRIPTS[$i]}"
|
|
239
|
-
local index=$((i + 1))
|
|
240
|
-
|
|
241
|
-
# Enable batch mode for scripts with interactive "your turn" sessions
|
|
242
|
-
if printf '%s\n' "${BATCH_MODE_SCRIPTS[@]}" | grep -qx "${script}"; then
|
|
243
|
-
export BATCH_MODE=true
|
|
244
|
-
else
|
|
245
|
-
unset BATCH_MODE
|
|
246
|
-
fi
|
|
247
|
-
|
|
248
|
-
if run_script "${script}" "${index}" "${total}"; then
|
|
249
|
-
((passed++))
|
|
250
|
-
else
|
|
251
|
-
((failed++))
|
|
252
|
-
failures+=("${script}")
|
|
253
|
-
fi
|
|
254
|
-
done
|
|
255
|
-
|
|
256
|
-
unset BATCH_MODE
|
|
257
|
-
|
|
258
|
-
echo "================================================================================"
|
|
259
|
-
echo " Summary"
|
|
260
|
-
echo "================================================================================"
|
|
261
|
-
echo
|
|
262
|
-
echo " Total: ${total}"
|
|
263
|
-
echo " Passed: ${passed}"
|
|
264
|
-
echo " Failed: ${failed}"
|
|
265
|
-
echo " Skipped: ${#SKIPPED[@]}"
|
|
266
|
-
echo
|
|
267
|
-
|
|
268
|
-
if [[ ${failed} -gt 0 ]]; then
|
|
269
|
-
echo " Failed scripts:"
|
|
270
|
-
printf ' - %s\n' "${failures[@]}"
|
|
271
|
-
echo
|
|
272
|
-
fi
|
|
273
|
-
|
|
274
|
-
if [[ "${SAVE_OUTPUT}" == true ]]; then
|
|
275
|
-
echo " Output saved to: ${OUTPUT_FILE}"
|
|
276
|
-
echo
|
|
277
|
-
fi
|
|
278
|
-
|
|
279
|
-
echo " To compare against a future run:"
|
|
280
|
-
echo " diff output/run_PREV.log output/run_LATEST.log"
|
|
281
|
-
echo
|
|
282
|
-
echo "================================================================================"
|
|
283
|
-
|
|
284
|
-
return ${failed}
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
# --- Execute ---
|
|
288
|
-
|
|
289
|
-
if [[ "${SAVE_OUTPUT}" == true ]]; then
|
|
290
|
-
main 2>&1 | tee "${OUTPUT_FILE}"
|
|
291
|
-
exit ${PIPESTATUS[0]}
|
|
292
|
-
else
|
|
293
|
-
main
|
|
294
|
-
fi
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'ruby_llm/tool'
|
|
4
|
-
|
|
5
|
-
# A simple tool that counts words, characters, and lines in text.
|
|
6
|
-
class WordCountTool < RubyLLM::Tool
|
|
7
|
-
def self.name = 'word_count'
|
|
8
|
-
|
|
9
|
-
description <<~DESC
|
|
10
|
-
Count words, characters, lines, and sentences in a given text.
|
|
11
|
-
Useful for text analysis and content length checks.
|
|
12
|
-
DESC
|
|
13
|
-
|
|
14
|
-
params do
|
|
15
|
-
string :text, description: 'The text to analyze', required: true
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def execute(text:)
|
|
19
|
-
words = text.split(/\s+/).reject(&:empty?)
|
|
20
|
-
sentences = text.split(/[.!?]+/).reject { |s| s.strip.empty? }
|
|
21
|
-
|
|
22
|
-
{
|
|
23
|
-
success: true,
|
|
24
|
-
words: words.size,
|
|
25
|
-
characters: text.length,
|
|
26
|
-
lines: text.lines.size,
|
|
27
|
-
sentences: sentences.size
|
|
28
|
-
}
|
|
29
|
-
end
|
|
30
|
-
end
|
data/lib/AGENTS.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
### Local Agent Context: lib
|
|
2
|
-
|
|
3
|
-
## Setup & Commands
|
|
4
|
-
|
|
5
|
-
- To run the AIA application, use: `ruby lib/aia.rb`
|
|
6
|
-
- Set up configurations by editing `lib/aia/config/defaults.yml` or using environment variables prefixed with `AIA_`.
|
|
7
|
-
|
|
8
|
-
## Code Style & Patterns
|
|
9
|
-
|
|
10
|
-
- Use single source of truth for configs: defined in `lib/aia/config/defaults.yml`
|
|
11
|
-
- CLI flags are mapped to nested config locations using the `CLI_TO_NESTED_MAP` hash within `aia/config.rb`.
|
|
12
|
-
- Initialize new components within the AIA module using `AIA` namespace, e.g., `AIA::ChatLoop`.
|
|
13
|
-
|
|
14
|
-
## Implementation Details
|
|
15
|
-
|
|
16
|
-
### Entry Point - `lib/aia.rb`
|
|
17
|
-
- Main application entry starts by loading essential modules and patches.
|
|
18
|
-
- Use `AIA.run` as the entrypoint method which initializes configuration, validates it, and starts the session.
|
|
19
|
-
|
|
20
|
-
### Configuring AIA - `lib/aia/config.rb`
|
|
21
|
-
- Configurations are merged from sources in priority: defaults => user config => ENV => CLI.
|
|
22
|
-
- Use `Config.setup(cli_overrides)` to initialize configuration with CLI argument overrides.
|
|
23
|
-
- Ensure `lib/aia/config/model_spec.rb` is loaded for model specification handling.
|
|
24
|
-
- Top-level config sections include: `service`, `llm`, `prompts`, `roles`, `skills`, `output`, `audio`, `image`, `embedding`, `tools`, `flags`, `registry`, `paths`, `logger`, `rules`, `concurrency`, `tool_filter`.
|
|
25
|
-
- `roles` and `skills` are proper config sections; `AIA.config.skills.dir` returns the resolved skills directory.
|
|
26
|
-
|
|
27
|
-
### Directive System - `lib/aia/directive.rb` and `lib/aia/directives/`
|
|
28
|
-
- `AIA::Directive` (base class) inherits from `PM::Directive` and adds AIA-specific concerns.
|
|
29
|
-
- `DIRECTIVE_PREFIX = '/'` — all chat directives use a single slash, not `//`.
|
|
30
|
-
- The base class provides `parse_search_terms(args)` as a private instance method available to all directive subclasses. It splits args into `[positive_terms, negative_terms]`: bare terms and `+prefix` are positive (AND); `-`, `~`, or `!` prefix marks AND NOT terms.
|
|
31
|
-
- Directive subclasses live in `lib/aia/directives/`:
|
|
32
|
-
- `web_and_file_directives.rb` — `/skill`, `/skills`, `/webpage`, `/paste`
|
|
33
|
-
- `model_directives.rb` — `/llms` (and aliases), `/compare`
|
|
34
|
-
- `context_directives.rb`, `execution_directives.rb`, `navigation_directives.rb`, `special_mode_directives.rb`, `config_directives.rb`
|
|
35
|
-
|
|
36
|
-
### `/skill` and `/skills` Directives - `lib/aia/directives/web_and_file_directives.rb`
|
|
37
|
-
- Skills directory resolves via `aia_skills_dir`: `AIA.config.skills.dir` → `$AIA_SKILLS__DIR` → `~/.prompts/skills`.
|
|
38
|
-
- A skill is a subdirectory containing a `SKILL.md` file with YAML front matter (`name`, `description`).
|
|
39
|
-
- `/skill <id>` reads and returns the full `SKILL.md` content. On error, prints to stdout and returns `nil` (nothing injected into the AI prompt).
|
|
40
|
-
- `/skills [terms...]` prints `skill_id: name\n description\n\n` to stdout for each matching skill; returns `nil`. Supports AND logic for positive terms and AND NOT for `-`/`~`/`!`-prefixed terms.
|
|
41
|
-
|
|
42
|
-
### `/llms` Directive - `lib/aia/directives/model_directives.rb`
|
|
43
|
-
- `available_models` (aliased as `/llms`, `/models`, etc.) parses args with `parse_search_terms` into `positive_terms` and `negative_terms`.
|
|
44
|
-
- Passes both to `show_rubyllm_models(positive_terms, negative_terms)`, `show_ollama_models(api_base, positive_terms, negative_terms)`, and `show_lms_models(api_base, positive_terms, negative_terms)`.
|
|
45
|
-
- Negative terms apply AND NOT filtering: models whose entry string contains any negative term are excluded.
|
|
46
|
-
|
|
47
|
-
### Chat Loop Operation - `lib/aia/chat_loop.rb`
|
|
48
|
-
- `AIA::ChatLoop` handles the interactive chat REPL loop.
|
|
49
|
-
- Initialize the chat loop with components: `robot`, `ui_presenter`, `directive_processor`.
|
|
50
|
-
- Start the chat loop with `ChatLoop#start`, which sets up the session, processes context, and runs the interactive loop.
|
|
51
|
-
|
|
52
|
-
### Error Handling
|
|
53
|
-
- Use `AIA.debug_warn(msg, exc: nil)` to log warnings with optional debug backtrace.
|
|
54
|
-
- Catch `AIA::ConfigurationError` and `AIA::Error` in the run method to handle config and general errors gracefully.
|
|
55
|
-
|
|
56
|
-
### Resetting State
|
|
57
|
-
- `AIA.reset!` reinitializes key components, suitable for stateful parts (e.g., `config`, `client`).
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# lib/aia/model_switch_handler.rb
|
|
4
|
-
#
|
|
5
|
-
# Handles natural language model-change intent detection.
|
|
6
|
-
# When a model-change intent is detected by the classification KB,
|
|
7
|
-
# extracts model names, confirms with the user, and reconfigures.
|
|
8
|
-
|
|
9
|
-
module AIA
|
|
10
|
-
class ModelSwitchHandler
|
|
11
|
-
include HandlerProtocol
|
|
12
|
-
|
|
13
|
-
def initialize(alias_registry, ui_presenter)
|
|
14
|
-
@aliases = alias_registry
|
|
15
|
-
@ui = ui_presenter
|
|
16
|
-
@model_exists_cache = {}
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Natural language model switching via KBS intent detection has been removed.
|
|
20
|
-
# Use the /model directive for model changes.
|
|
21
|
-
#
|
|
22
|
-
# @param context [HandlerContext]
|
|
23
|
-
# @return [Boolean] always false
|
|
24
|
-
def handle(context) # rubocop:disable Naming/PredicateMethod
|
|
25
|
-
false
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
private
|
|
29
|
-
|
|
30
|
-
def handle_switch(intent, config)
|
|
31
|
-
models = extract_model_names(intent[:raw_text])
|
|
32
|
-
return false if models.empty?
|
|
33
|
-
|
|
34
|
-
resolved = models.map { |m| @aliases.resolve(m) }
|
|
35
|
-
confirm_and_apply(config, resolved)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def handle_compare(intent, config) # rubocop:disable Naming/PredicateMethod
|
|
39
|
-
models = extract_model_names(intent[:raw_text])
|
|
40
|
-
return false if models.size < 2
|
|
41
|
-
|
|
42
|
-
resolved = models.map { |m| @aliases.resolve(m) }
|
|
43
|
-
|
|
44
|
-
@ui.display_info("Interpreted as: compare #{resolved.join(', ')}")
|
|
45
|
-
@ui.display_info("Proceed? (y/n)")
|
|
46
|
-
|
|
47
|
-
response = @ui.ask_question
|
|
48
|
-
return false unless response&.strip&.downcase == 'y'
|
|
49
|
-
|
|
50
|
-
config.flags.consensus = true
|
|
51
|
-
apply_model_change(config, resolved)
|
|
52
|
-
true
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def handle_capability_switch(intent, config)
|
|
56
|
-
capability = intent[:capability]
|
|
57
|
-
resolved = [@aliases.resolve(capability)]
|
|
58
|
-
confirm_and_apply(config, resolved)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def confirm_and_apply(config, resolved) # rubocop:disable Naming/PredicateMethod
|
|
62
|
-
@ui.display_info("Interpreted as: /model #{resolved.join(', ')}")
|
|
63
|
-
@ui.display_info("Proceed? (y/n)")
|
|
64
|
-
|
|
65
|
-
response = @ui.ask_question
|
|
66
|
-
return false unless response&.strip&.downcase == 'y'
|
|
67
|
-
|
|
68
|
-
apply_model_change(config, resolved)
|
|
69
|
-
true
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def extract_model_names(text)
|
|
73
|
-
return [] unless text
|
|
74
|
-
|
|
75
|
-
# Check each word against known aliases and model names
|
|
76
|
-
words = text.downcase.scan(/[\w.-]+/)
|
|
77
|
-
words.select { |w| @aliases.known?(w) || model_exists?(w) }.uniq
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def model_exists?(name)
|
|
81
|
-
return @model_exists_cache[name] if @model_exists_cache.key?(name)
|
|
82
|
-
@model_exists_cache[name] = begin
|
|
83
|
-
return false unless defined?(RubyLLM) && RubyLLM.respond_to?(:models)
|
|
84
|
-
!!RubyLLM.models.find(name)
|
|
85
|
-
rescue StandardError
|
|
86
|
-
false
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
def apply_model_change(config, model_names)
|
|
91
|
-
config.models = model_names.map { |name| AIA::ModelSpec.new(name: name) }
|
|
92
|
-
|
|
93
|
-
history_mode = config.respond_to?(:model_switch_history) ?
|
|
94
|
-
config.model_switch_history&.to_sym : :clean
|
|
95
|
-
|
|
96
|
-
AIA.client = RobotFactory.rebuild(config, history_mode: history_mode)
|
|
97
|
-
@ui.display_info("Model switched to: #{model_names.join(', ')}")
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
data/mcp_servers/README.md
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# MCP Servers
|
|
2
|
-
|
|
3
|
-
The Model Context Protocol (MCP) enables tools from different server implementations to be defined in a common consistent way, allowing LLMs that support callback functions (aka tools) to access data that enhances the context of a prompt.
|
|
4
|
-
|
|
5
|
-
You can find additional MCP servers at https://mcpindex.net
|
|
6
|
-
|
|
7
|
-
## Overview
|
|
8
|
-
|
|
9
|
-
This directory contains configuration files for various MCP servers that provide different capabilities to LLMs:
|
|
10
|
-
|
|
11
|
-
| Server | Purpose | Configuration File |
|
|
12
|
-
|--------|---------|--------------------|
|
|
13
|
-
| Filesystem | Provides access to the local filesystem | `filesystem.json` |
|
|
14
|
-
| iMCP | macOS-specific MCP server for system integration | `imcp.json` |
|
|
15
|
-
| Playwright | Enables web automation and scraping capabilities | `playwright_server_definition.json` |
|
|
16
|
-
|
|
17
|
-
## Configuration Details
|
|
18
|
-
|
|
19
|
-
### Filesystem Server
|
|
20
|
-
|
|
21
|
-
The filesystem server allows LLMs to read and interact with the local filesystem:
|
|
22
|
-
|
|
23
|
-
TODO: fix this JSON file to use a generic directory; maybe $HOME
|
|
24
|
-
|
|
25
|
-
```json
|
|
26
|
-
{
|
|
27
|
-
"type": "stdio",
|
|
28
|
-
"command": [
|
|
29
|
-
"npx",
|
|
30
|
-
"-y",
|
|
31
|
-
"@modelcontextprotocol/server-filesystem",
|
|
32
|
-
"/Users/dewayne/sandbox/git_repos/madbomber/aia/develop"
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The server is configured to access files within the project's development directory.
|
|
38
|
-
|
|
39
|
-
### iMCP Server
|
|
40
|
-
|
|
41
|
-
See: https://github.com/loopwork-ai/iMCP
|
|
42
|
-
|
|
43
|
-
The iMCP server provides macOS-specific functionality:
|
|
44
|
-
|
|
45
|
-
```json
|
|
46
|
-
{
|
|
47
|
-
"mcpServers" : {
|
|
48
|
-
"iMCP" : {
|
|
49
|
-
"command" : "/Applications/iMCP.app/Contents/MacOS/imcp-server"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
### Playwright Server
|
|
56
|
-
|
|
57
|
-
The Playwright server enables web automation and browser interaction capabilities:
|
|
58
|
-
|
|
59
|
-
```json
|
|
60
|
-
{
|
|
61
|
-
"mcpServers": {
|
|
62
|
-
"playwright": {
|
|
63
|
-
"url": "http://localhost:8931/sse",
|
|
64
|
-
"headers": {},
|
|
65
|
-
"comment": "Local Playwright MCP Server running on port 8931"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
## Usage
|
|
72
|
-
|
|
73
|
-
These MCP servers can be utilized by LLM applications to extend their capabilities beyond text generation. The configuration files in this directory are used to define how to connect to each server and what capabilities they provide.
|
|
74
|
-
|
|
75
|
-
## Getting Started
|
|
76
|
-
|
|
77
|
-
Use the --mcp option with aia to specify which MCP servers to use. You may use the --mcp option multiple times to select more than one server. For example:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
aia prompt_id --mcp filesystem.json --mcp imcp.json --mcp playwright_server_definition.json
|
|
81
|
-
# or
|
|
82
|
-
aia --chat --mcp filesystem.json --mcp imcp.json --mcp playwright_server_definition.json
|
|
83
|
-
# or
|
|
84
|
-
aia prompt_id --chat --mcp filesystem.json --mcp imcp.json --mcp playwright_server_definition.json
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Filtering Servers
|
|
88
|
-
|
|
89
|
-
You can control which servers are connected using `--mcp-use` (whitelist) and `--mcp-skip` (blacklist):
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# Only connect to the filesystem server
|
|
93
|
-
aia --chat --mcp filesystem.json --mcp imcp.json --mcp-use filesystem
|
|
94
|
-
|
|
95
|
-
# Connect to all servers except playwright
|
|
96
|
-
aia --chat --mcp filesystem.json --mcp playwright_server_definition.json --mcp-skip playwright
|
|
97
|
-
|
|
98
|
-
# List configured servers without connecting
|
|
99
|
-
aia --mcp filesystem.json --mcp imcp.json --mcp-list
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
Precedence order:
|
|
103
|
-
1. `--no-mcp` disables all MCP (highest priority)
|
|
104
|
-
2. `--mcp-use` connects only to named servers
|
|
105
|
-
3. `--mcp-skip` connects to all except named servers
|
|
106
|
-
|
|
107
|
-
## Additional Resources
|
|
108
|
-
|
|
109
|
-
- [Model Context Protocol Documentation](https://github.com/anthropics/anthropic-cookbook/tree/main/model_context_protocol)
|
|
110
|
-
- [MCP Server Implementation Guidelines](https://modelcontextprotocol.github.io/)
|
data/mcp_servers/apple-mcp.json
DELETED
data/mcp_servers/filesystem.json
DELETED