aidp 0.17.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +69 -0
  3. data/lib/aidp/cli.rb +43 -2
  4. data/lib/aidp/config.rb +9 -14
  5. data/lib/aidp/execute/prompt_manager.rb +128 -1
  6. data/lib/aidp/execute/repl_macros.rb +555 -0
  7. data/lib/aidp/execute/work_loop_runner.rb +108 -1
  8. data/lib/aidp/harness/ai_decision_engine.rb +376 -0
  9. data/lib/aidp/harness/capability_registry.rb +273 -0
  10. data/lib/aidp/harness/config_schema.rb +305 -1
  11. data/lib/aidp/harness/configuration.rb +452 -0
  12. data/lib/aidp/harness/enhanced_runner.rb +7 -1
  13. data/lib/aidp/harness/provider_factory.rb +0 -2
  14. data/lib/aidp/harness/runner.rb +7 -1
  15. data/lib/aidp/harness/thinking_depth_manager.rb +335 -0
  16. data/lib/aidp/harness/zfc_condition_detector.rb +395 -0
  17. data/lib/aidp/init/devcontainer_generator.rb +274 -0
  18. data/lib/aidp/init/runner.rb +37 -10
  19. data/lib/aidp/init.rb +1 -0
  20. data/lib/aidp/prompt_optimization/context_composer.rb +286 -0
  21. data/lib/aidp/prompt_optimization/optimizer.rb +335 -0
  22. data/lib/aidp/prompt_optimization/prompt_builder.rb +309 -0
  23. data/lib/aidp/prompt_optimization/relevance_scorer.rb +256 -0
  24. data/lib/aidp/prompt_optimization/source_code_fragmenter.rb +308 -0
  25. data/lib/aidp/prompt_optimization/style_guide_indexer.rb +240 -0
  26. data/lib/aidp/prompt_optimization/template_indexer.rb +250 -0
  27. data/lib/aidp/provider_manager.rb +0 -2
  28. data/lib/aidp/providers/anthropic.rb +19 -0
  29. data/lib/aidp/setup/wizard.rb +299 -4
  30. data/lib/aidp/utils/devcontainer_detector.rb +166 -0
  31. data/lib/aidp/version.rb +1 -1
  32. data/lib/aidp/watch/build_processor.rb +72 -6
  33. data/lib/aidp/watch/repository_client.rb +2 -1
  34. data/lib/aidp.rb +0 -1
  35. data/templates/aidp.yml.example +128 -0
  36. metadata +14 -2
  37. data/lib/aidp/providers/macos_ui.rb +0 -102
@@ -123,6 +123,93 @@ harness:
123
123
  api_key_rotation: false # Enable API key rotation
124
124
  audit_logging: true # Enable audit logging
125
125
 
126
+ # Thinking Depth Configuration
127
+ # Controls model selection based on task complexity
128
+ thinking:
129
+ # Default tier for new requests (mini, standard, thinking, pro, max)
130
+ default_tier: "mini"
131
+
132
+ # Maximum tier allowed (prevents excessive costs)
133
+ max_tier: "max"
134
+
135
+ # Enable automatic tier escalation on failures
136
+ auto_escalate: true
137
+
138
+ # Number of failures before escalating to next tier
139
+ escalation_threshold: 2
140
+
141
+ # Per-operation tier overrides (optional)
142
+ overrides:
143
+ # Example: Use mini tier for simple decisions
144
+ # decision.condition_detection: mini
145
+ # decision.error_classification: mini
146
+ # decision.completion_detection: mini
147
+
148
+ # Zero Framework Cognition (ZFC) Configuration
149
+ # Delegates semantic analysis to AI instead of pattern matching
150
+ zfc:
151
+ # Master toggle for ZFC features
152
+ enabled: false # Set to true to enable (experimental)
153
+
154
+ # Fallback to legacy pattern matching if AI fails
155
+ fallback_to_legacy: true
156
+
157
+ # Individual decision types (can be toggled separately)
158
+ decisions:
159
+ # Condition detection (replaces regex patterns)
160
+ condition_detection:
161
+ enabled: false
162
+ tier: "mini" # AI tier to use
163
+ cache_ttl: null # Cache duration in seconds (null = no cache)
164
+ confidence_threshold: 0.7 # Minimum confidence to accept result
165
+
166
+ # Error classification (determines if retryable)
167
+ error_classification:
168
+ enabled: false
169
+ tier: "mini"
170
+ cache_ttl: null
171
+ confidence_threshold: 0.7
172
+
173
+ # Completion detection (replaces keyword matching)
174
+ completion_detection:
175
+ enabled: false
176
+ tier: "mini"
177
+ cache_ttl: null
178
+ confidence_threshold: 0.8
179
+
180
+ # Provider selection (replaces load calculation formula)
181
+ provider_selection:
182
+ enabled: false
183
+ tier: "mini"
184
+ cache_ttl: 300 # Cache for 5 minutes
185
+ confidence_threshold: 0.7
186
+
187
+ # Tier escalation decision (replaces heuristic thresholds)
188
+ tier_escalation:
189
+ enabled: false
190
+ tier: "mini"
191
+ cache_ttl: null
192
+ confidence_threshold: 0.7
193
+
194
+ # Workflow routing (replaces pattern matching)
195
+ workflow_routing:
196
+ enabled: false
197
+ tier: "mini"
198
+ cache_ttl: 60 # Cache for 1 minute
199
+ confidence_threshold: 0.7
200
+
201
+ # Cost controls for ZFC
202
+ cost_limits:
203
+ max_daily_cost: 5.00 # Maximum daily ZFC cost in USD
204
+ max_cost_per_decision: 0.01 # Maximum cost per decision
205
+ alert_threshold: 0.8 # Alert at 80% of budget
206
+
207
+ # A/B testing configuration
208
+ ab_testing:
209
+ enabled: false # Enable A/B testing
210
+ sample_rate: 0.1 # Test 10% of decisions
211
+ log_comparisons: true # Log ZFC vs legacy comparisons
212
+
126
213
  # Provider configurations
127
214
  providers:
128
215
  # Cursor provider (subscription-based)
@@ -580,6 +667,47 @@ users:
580
667
  cursor:
581
668
  priority: 2
582
669
 
670
+ # Devcontainer configuration (experimental)
671
+ # Controls behavior when running inside a development container
672
+ devcontainer:
673
+ # Enable automatic detection of devcontainer environment
674
+ enabled: true
675
+
676
+ # Run agents with full permissions when in devcontainer
677
+ # This allows more dangerous filesystem operations in the sandboxed environment
678
+ # Only applies when AIDP detects it's running in a container
679
+ full_permissions_when_in_devcontainer: false
680
+
681
+ # Override detection (useful for testing or forcing behavior)
682
+ # Set to true/false to force detection result, or null for auto-detection
683
+ force_detection: null
684
+
685
+ # Permissions to grant when in devcontainer
686
+ permissions:
687
+ # Allow dangerous filesystem operations
688
+ dangerous_filesystem_ops: false
689
+
690
+ # Skip permission checks for specific providers
691
+ # Provider-specific flags will be added automatically
692
+ skip_permission_checks:
693
+ - "claude" # Adds --dangerously-skip-permissions for Claude Code
694
+ # - "cursor"
695
+ # - "gemini"
696
+
697
+ # Container-specific settings
698
+ settings:
699
+ # Increase timeouts in container (may be slower)
700
+ timeout_multiplier: 1.5
701
+
702
+ # Enable more verbose logging in devcontainer
703
+ verbose_logging: true
704
+
705
+ # Network allowlist (for firewall configuration)
706
+ # These will be added to init-firewall.sh if using AIDP's devcontainer
707
+ allowed_domains: []
708
+ # - "api.example.com"
709
+ # - "registry.example.com"
710
+
583
711
  # Configuration tips:
584
712
  # - Set max_tokens based on your API plan limits
585
713
  # - Use default_flags to customize provider behavior
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aidp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.1
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Agapinan
@@ -280,6 +280,8 @@ files:
280
280
  - lib/aidp/execute/work_loop_state.rb
281
281
  - lib/aidp/execute/work_loop_unit_scheduler.rb
282
282
  - lib/aidp/execute/workflow_selector.rb
283
+ - lib/aidp/harness/ai_decision_engine.rb
284
+ - lib/aidp/harness/capability_registry.rb
283
285
  - lib/aidp/harness/completion_checker.rb
284
286
  - lib/aidp/harness/condition_detector.rb
285
287
  - lib/aidp/harness/config_loader.rb
@@ -305,6 +307,7 @@ files:
305
307
  - lib/aidp/harness/state_manager.rb
306
308
  - lib/aidp/harness/status_display.rb
307
309
  - lib/aidp/harness/test_runner.rb
310
+ - lib/aidp/harness/thinking_depth_manager.rb
308
311
  - lib/aidp/harness/ui/base.rb
309
312
  - lib/aidp/harness/ui/enhanced_tui.rb
310
313
  - lib/aidp/harness/ui/enhanced_workflow_selector.rb
@@ -325,13 +328,22 @@ files:
325
328
  - lib/aidp/harness/ui/status_widget.rb
326
329
  - lib/aidp/harness/ui/workflow_controller.rb
327
330
  - lib/aidp/harness/user_interface.rb
331
+ - lib/aidp/harness/zfc_condition_detector.rb
328
332
  - lib/aidp/init.rb
333
+ - lib/aidp/init/devcontainer_generator.rb
329
334
  - lib/aidp/init/doc_generator.rb
330
335
  - lib/aidp/init/project_analyzer.rb
331
336
  - lib/aidp/init/runner.rb
332
337
  - lib/aidp/jobs/background_runner.rb
333
338
  - lib/aidp/logger.rb
334
339
  - lib/aidp/message_display.rb
340
+ - lib/aidp/prompt_optimization/context_composer.rb
341
+ - lib/aidp/prompt_optimization/optimizer.rb
342
+ - lib/aidp/prompt_optimization/prompt_builder.rb
343
+ - lib/aidp/prompt_optimization/relevance_scorer.rb
344
+ - lib/aidp/prompt_optimization/source_code_fragmenter.rb
345
+ - lib/aidp/prompt_optimization/style_guide_indexer.rb
346
+ - lib/aidp/prompt_optimization/template_indexer.rb
335
347
  - lib/aidp/provider_manager.rb
336
348
  - lib/aidp/providers/anthropic.rb
337
349
  - lib/aidp/providers/base.rb
@@ -339,7 +351,6 @@ files:
339
351
  - lib/aidp/providers/cursor.rb
340
352
  - lib/aidp/providers/gemini.rb
341
353
  - lib/aidp/providers/github_copilot.rb
342
- - lib/aidp/providers/macos_ui.rb
343
354
  - lib/aidp/providers/opencode.rb
344
355
  - lib/aidp/rescue_logging.rb
345
356
  - lib/aidp/setup/wizard.rb
@@ -360,6 +371,7 @@ files:
360
371
  - lib/aidp/storage/json_storage.rb
361
372
  - lib/aidp/tooling_detector.rb
362
373
  - lib/aidp/util.rb
374
+ - lib/aidp/utils/devcontainer_detector.rb
363
375
  - lib/aidp/version.rb
364
376
  - lib/aidp/watch.rb
365
377
  - lib/aidp/watch/build_processor.rb
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "base"
4
- require_relative "../debug_mixin"
5
-
6
- module Aidp
7
- module Providers
8
- class MacOSUI < Base
9
- include Aidp::DebugMixin
10
-
11
- def self.available?
12
- RUBY_PLATFORM.include?("darwin")
13
- end
14
-
15
- def name
16
- "macos"
17
- end
18
-
19
- def send_message(prompt:, session: nil)
20
- raise "macOS UI not available on this platform" unless self.class.available?
21
-
22
- debug_provider("macos", "Starting Cursor interaction", {prompt_length: prompt.length})
23
-
24
- # Try to use Cursor's chat interface via AppleScript
25
- result = interact_with_cursor(prompt)
26
-
27
- if result[:success]
28
- debug_log("✅ Successfully sent prompt to Cursor", level: :info)
29
- result[:response]
30
- else
31
- debug_log("❌ Failed to interact with Cursor: #{result[:error]}", level: :warn)
32
- # No interactive fallback - would hang AIDP's automation workflow
33
- raise "Cursor interaction failed and no non-interactive fallback available: #{result[:error]}"
34
- end
35
- end
36
-
37
- private
38
-
39
- def interact_with_cursor(prompt)
40
- # Create a temporary script file for the prompt with proper encoding
41
- temp_file = "/tmp/aidp_cursor_prompt.txt"
42
- File.write(temp_file, prompt, encoding: "UTF-8")
43
-
44
- # AppleScript to interact with Cursor - use properly escaped prompt to avoid injection
45
- escaped_prompt = escape_for_applescript(prompt)
46
- script = <<~APPLESCRIPT
47
- tell application "Cursor"
48
- activate
49
- end tell
50
-
51
- delay 1
52
-
53
- tell application "System Events"
54
- -- Open chat panel (Cmd+L)
55
- keystroke "l" using command down
56
- delay 2
57
-
58
- -- Type the prompt (properly escaped)
59
- keystroke "#{escaped_prompt}"
60
- delay 1
61
-
62
- -- Send the message (Enter)
63
- keystroke (ASCII character 13)
64
- delay 3
65
-
66
- -- Try to get response (this is tricky without accessibility permissions)
67
- -- For now, we'll just return success
68
- return "Prompt sent to Cursor chat"
69
- end tell
70
- APPLESCRIPT
71
-
72
- begin
73
- # Use Open3 to safely execute AppleScript without shell injection
74
- require "open3"
75
-
76
- # Write AppleScript to temporary file to avoid command line issues
77
- script_file = "/tmp/aidp_cursor_script.scpt"
78
- File.write(script_file, script, encoding: "UTF-8")
79
-
80
- stdout, stderr, status = Open3.capture3("osascript", script_file)
81
-
82
- if status.success?
83
- {success: true, response: stdout.strip}
84
- else
85
- {success: false, error: stderr.strip}
86
- end
87
- rescue => e
88
- {success: false, error: e.message}
89
- ensure
90
- File.delete(temp_file) if File.exist?(temp_file)
91
- File.delete(script_file) if File.exist?(script_file)
92
- end
93
- end
94
-
95
- def escape_for_applescript(text)
96
- # Escape special characters for AppleScript
97
- # Must escape backslashes first to avoid double-escaping
98
- text.gsub("\\", "\\\\").gsub('"', '\\"').gsub("'", "\\'").gsub("\n", "\\n")
99
- end
100
- end
101
- end
102
- end