aidp 0.12.0 → 0.13.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.
- checksums.yaml +4 -4
- data/lib/aidp/analyze/json_file_storage.rb +21 -21
- data/lib/aidp/cli/enhanced_input.rb +114 -0
- data/lib/aidp/cli/first_run_wizard.rb +12 -14
- data/lib/aidp/cli/mcp_dashboard.rb +3 -3
- data/lib/aidp/cli/terminal_io.rb +26 -0
- data/lib/aidp/cli.rb +4 -4
- data/lib/aidp/config/paths.rb +131 -0
- data/lib/aidp/config.rb +18 -4
- data/lib/aidp/harness/condition_detector.rb +6 -6
- data/lib/aidp/harness/config_loader.rb +23 -23
- data/lib/aidp/harness/config_manager.rb +61 -61
- data/lib/aidp/harness/config_validator.rb +13 -12
- data/lib/aidp/harness/configuration.rb +30 -29
- data/lib/aidp/harness/error_handler.rb +13 -13
- data/lib/aidp/harness/provider_config.rb +79 -79
- data/lib/aidp/harness/provider_factory.rb +40 -40
- data/lib/aidp/harness/provider_info.rb +37 -20
- data/lib/aidp/harness/provider_manager.rb +58 -53
- data/lib/aidp/harness/provider_type_checker.rb +6 -6
- data/lib/aidp/harness/runner.rb +7 -7
- data/lib/aidp/harness/status_display.rb +33 -46
- data/lib/aidp/harness/ui/enhanced_workflow_selector.rb +2 -1
- data/lib/aidp/harness/ui/job_monitor.rb +7 -7
- data/lib/aidp/harness/user_interface.rb +43 -43
- data/lib/aidp/providers/anthropic.rb +100 -26
- data/lib/aidp/providers/base.rb +13 -0
- data/lib/aidp/providers/codex.rb +28 -27
- data/lib/aidp/providers/cursor.rb +141 -34
- data/lib/aidp/providers/github_copilot.rb +26 -26
- data/lib/aidp/providers/macos_ui.rb +2 -18
- data/lib/aidp/providers/opencode.rb +26 -26
- data/lib/aidp/version.rb +1 -1
- data/lib/aidp/workflows/guided_agent.rb +344 -23
- metadata +3 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "../config"
|
|
4
|
+
require_relative "../config/paths"
|
|
4
5
|
|
|
5
6
|
module Aidp
|
|
6
7
|
module Harness
|
|
@@ -64,13 +65,13 @@ module Aidp
|
|
|
64
65
|
|
|
65
66
|
# Get provider models configuration
|
|
66
67
|
def provider_models(provider_name)
|
|
67
|
-
provider_config(provider_name)[:models] ||
|
|
68
|
+
provider_config(provider_name)[:models] || default_models_for_provider(provider_name)
|
|
68
69
|
end
|
|
69
70
|
|
|
70
71
|
# Get default model for provider
|
|
71
72
|
def default_model(provider_name)
|
|
72
73
|
models = provider_models(provider_name)
|
|
73
|
-
models.first ||
|
|
74
|
+
models.first || default_model_for_provider(provider_name)
|
|
74
75
|
end
|
|
75
76
|
|
|
76
77
|
# Get model configuration for provider
|
|
@@ -91,7 +92,7 @@ module Aidp
|
|
|
91
92
|
|
|
92
93
|
# Get model-specific timeout
|
|
93
94
|
def model_timeout(provider_name, model_name)
|
|
94
|
-
model_config(provider_name, model_name)[:timeout] ||
|
|
95
|
+
model_config(provider_name, model_name)[:timeout] || default_timeout_for_provider(provider_name)
|
|
95
96
|
end
|
|
96
97
|
|
|
97
98
|
# Get provider weights for load balancing
|
|
@@ -106,47 +107,47 @@ module Aidp
|
|
|
106
107
|
|
|
107
108
|
# Get circuit breaker configuration
|
|
108
109
|
def circuit_breaker_config
|
|
109
|
-
harness_config[:circuit_breaker] ||
|
|
110
|
+
harness_config[:circuit_breaker] || default_circuit_breaker_config
|
|
110
111
|
end
|
|
111
112
|
|
|
112
113
|
# Get retry configuration
|
|
113
114
|
def retry_config
|
|
114
|
-
harness_config[:retry] ||
|
|
115
|
+
harness_config[:retry] || default_retry_config
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
# Get rate limit configuration
|
|
118
119
|
def rate_limit_config
|
|
119
|
-
harness_config[:rate_limit] ||
|
|
120
|
+
harness_config[:rate_limit] || default_rate_limit_config
|
|
120
121
|
end
|
|
121
122
|
|
|
122
123
|
# Get load balancing configuration
|
|
123
124
|
def load_balancing_config
|
|
124
|
-
harness_config[:load_balancing] ||
|
|
125
|
+
harness_config[:load_balancing] || default_load_balancing_config
|
|
125
126
|
end
|
|
126
127
|
|
|
127
128
|
# Get model switching configuration
|
|
128
129
|
def model_switching_config
|
|
129
|
-
harness_config[:model_switching] ||
|
|
130
|
+
harness_config[:model_switching] || default_model_switching_config
|
|
130
131
|
end
|
|
131
132
|
|
|
132
133
|
# Get provider health check configuration
|
|
133
134
|
def health_check_config
|
|
134
|
-
harness_config[:health_check] ||
|
|
135
|
+
harness_config[:health_check] || default_health_check_config
|
|
135
136
|
end
|
|
136
137
|
|
|
137
138
|
# Get metrics configuration
|
|
138
139
|
def metrics_config
|
|
139
|
-
harness_config[:metrics] ||
|
|
140
|
+
harness_config[:metrics] || default_metrics_config
|
|
140
141
|
end
|
|
141
142
|
|
|
142
143
|
# Get session configuration
|
|
143
144
|
def session_config
|
|
144
|
-
harness_config[:session] ||
|
|
145
|
+
harness_config[:session] || default_session_config
|
|
145
146
|
end
|
|
146
147
|
|
|
147
148
|
# Get work loop configuration
|
|
148
149
|
def work_loop_config
|
|
149
|
-
harness_config[:work_loop] ||
|
|
150
|
+
harness_config[:work_loop] || default_work_loop_config
|
|
150
151
|
end
|
|
151
152
|
|
|
152
153
|
# Check if work loops are enabled
|
|
@@ -211,17 +212,17 @@ module Aidp
|
|
|
211
212
|
|
|
212
213
|
# Get configuration path
|
|
213
214
|
def config_path
|
|
214
|
-
|
|
215
|
+
Aidp::ConfigPaths.config_file(@project_dir)
|
|
215
216
|
end
|
|
216
217
|
|
|
217
218
|
# Get logging configuration
|
|
218
219
|
def logging_config
|
|
219
|
-
harness_config[:logging] ||
|
|
220
|
+
harness_config[:logging] || default_logging_config
|
|
220
221
|
end
|
|
221
222
|
|
|
222
223
|
# Get fallback configuration
|
|
223
224
|
def fallback_config
|
|
224
|
-
harness_config[:fallback] ||
|
|
225
|
+
harness_config[:fallback] || default_fallback_config
|
|
225
226
|
end
|
|
226
227
|
|
|
227
228
|
# Check if configuration file exists
|
|
@@ -340,7 +341,7 @@ module Aidp
|
|
|
340
341
|
end
|
|
341
342
|
|
|
342
343
|
# Default configuration methods
|
|
343
|
-
def
|
|
344
|
+
def default_models_for_provider(provider_name)
|
|
344
345
|
case provider_name
|
|
345
346
|
when "anthropic"
|
|
346
347
|
["anthropic-3-5-sonnet-20241022", "anthropic-3-5-haiku-20241022", "anthropic-3-opus-20240229"]
|
|
@@ -351,7 +352,7 @@ module Aidp
|
|
|
351
352
|
end
|
|
352
353
|
end
|
|
353
354
|
|
|
354
|
-
def
|
|
355
|
+
def default_model_for_provider(provider_name)
|
|
355
356
|
case provider_name
|
|
356
357
|
when "anthropic"
|
|
357
358
|
"anthropic-3-5-sonnet-20241022"
|
|
@@ -362,11 +363,11 @@ module Aidp
|
|
|
362
363
|
end
|
|
363
364
|
end
|
|
364
365
|
|
|
365
|
-
def
|
|
366
|
+
def default_timeout_for_provider(provider_name)
|
|
366
367
|
300 # 5 minutes - default timeout for all providers
|
|
367
368
|
end
|
|
368
369
|
|
|
369
|
-
def
|
|
370
|
+
def default_circuit_breaker_config
|
|
370
371
|
{
|
|
371
372
|
enabled: true,
|
|
372
373
|
failure_threshold: 5,
|
|
@@ -375,7 +376,7 @@ module Aidp
|
|
|
375
376
|
}
|
|
376
377
|
end
|
|
377
378
|
|
|
378
|
-
def
|
|
379
|
+
def default_retry_config
|
|
379
380
|
{
|
|
380
381
|
enabled: true,
|
|
381
382
|
max_attempts: 3,
|
|
@@ -386,7 +387,7 @@ module Aidp
|
|
|
386
387
|
}
|
|
387
388
|
end
|
|
388
389
|
|
|
389
|
-
def
|
|
390
|
+
def default_rate_limit_config
|
|
390
391
|
{
|
|
391
392
|
enabled: true,
|
|
392
393
|
default_reset_time: 3600, # 1 hour
|
|
@@ -395,7 +396,7 @@ module Aidp
|
|
|
395
396
|
}
|
|
396
397
|
end
|
|
397
398
|
|
|
398
|
-
def
|
|
399
|
+
def default_load_balancing_config
|
|
399
400
|
{
|
|
400
401
|
enabled: true,
|
|
401
402
|
strategy: "weighted_round_robin", # weighted_round_robin, least_connections, random
|
|
@@ -404,7 +405,7 @@ module Aidp
|
|
|
404
405
|
}
|
|
405
406
|
end
|
|
406
407
|
|
|
407
|
-
def
|
|
408
|
+
def default_model_switching_config
|
|
408
409
|
{
|
|
409
410
|
enabled: true,
|
|
410
411
|
auto_switch_on_error: true,
|
|
@@ -413,7 +414,7 @@ module Aidp
|
|
|
413
414
|
}
|
|
414
415
|
end
|
|
415
416
|
|
|
416
|
-
def
|
|
417
|
+
def default_health_check_config
|
|
417
418
|
{
|
|
418
419
|
enabled: true,
|
|
419
420
|
interval: 60, # 1 minute
|
|
@@ -423,7 +424,7 @@ module Aidp
|
|
|
423
424
|
}
|
|
424
425
|
end
|
|
425
426
|
|
|
426
|
-
def
|
|
427
|
+
def default_metrics_config
|
|
427
428
|
{
|
|
428
429
|
enabled: true,
|
|
429
430
|
retention_days: 30,
|
|
@@ -432,7 +433,7 @@ module Aidp
|
|
|
432
433
|
}
|
|
433
434
|
end
|
|
434
435
|
|
|
435
|
-
def
|
|
436
|
+
def default_session_config
|
|
436
437
|
{
|
|
437
438
|
enabled: true,
|
|
438
439
|
timeout: 1800, # 30 minutes
|
|
@@ -441,7 +442,7 @@ module Aidp
|
|
|
441
442
|
}
|
|
442
443
|
end
|
|
443
444
|
|
|
444
|
-
def
|
|
445
|
+
def default_work_loop_config
|
|
445
446
|
{
|
|
446
447
|
enabled: true,
|
|
447
448
|
max_iterations: 50,
|
|
@@ -450,7 +451,7 @@ module Aidp
|
|
|
450
451
|
}
|
|
451
452
|
end
|
|
452
453
|
|
|
453
|
-
def
|
|
454
|
+
def default_logging_config
|
|
454
455
|
{
|
|
455
456
|
log_level: :info,
|
|
456
457
|
retention_days: 30,
|
|
@@ -462,7 +463,7 @@ module Aidp
|
|
|
462
463
|
}
|
|
463
464
|
end
|
|
464
465
|
|
|
465
|
-
def
|
|
466
|
+
def default_fallback_config
|
|
466
467
|
{
|
|
467
468
|
strategies: {
|
|
468
469
|
rate_limit: {
|
|
@@ -53,7 +53,7 @@ module Aidp
|
|
|
53
53
|
@error_history << error_info
|
|
54
54
|
|
|
55
55
|
# Get retry strategy for this error type
|
|
56
|
-
strategy =
|
|
56
|
+
strategy = retry_strategy(error_info[:error_type])
|
|
57
57
|
|
|
58
58
|
# Check if we should retry
|
|
59
59
|
if should_retry?(error_info, strategy)
|
|
@@ -97,17 +97,17 @@ module Aidp
|
|
|
97
97
|
attempt += 1
|
|
98
98
|
return yield
|
|
99
99
|
rescue => error
|
|
100
|
-
current_provider =
|
|
100
|
+
current_provider = current_provider_safely
|
|
101
101
|
|
|
102
102
|
if attempt < max_attempts
|
|
103
103
|
error_info = {
|
|
104
104
|
error: error,
|
|
105
105
|
provider: current_provider,
|
|
106
|
-
model:
|
|
106
|
+
model: current_model_safely,
|
|
107
107
|
error_type: @error_classifier.classify_error(error)
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
strategy =
|
|
110
|
+
strategy = retry_strategy(error_info[:error_type])
|
|
111
111
|
if should_retry?(error_info, strategy)
|
|
112
112
|
delay = @backoff_calculator.calculate_delay(attempt, strategy[:backoff_strategy] || :exponential, 1, 10)
|
|
113
113
|
debug_log("🔁 Retry attempt #{attempt} for #{current_provider}", level: :info, data: {delay: delay, error_type: error_info[:error_type]})
|
|
@@ -120,11 +120,11 @@ module Aidp
|
|
|
120
120
|
debug_log("🚫 Exhausted retries for provider, attempting recovery", level: :warn, data: {provider: current_provider, attempt: attempt, max_attempts: max_attempts})
|
|
121
121
|
handle_error(error, {
|
|
122
122
|
provider: current_provider,
|
|
123
|
-
model:
|
|
123
|
+
model: current_model_safely,
|
|
124
124
|
exhausted_retries: true
|
|
125
125
|
})
|
|
126
126
|
|
|
127
|
-
new_provider =
|
|
127
|
+
new_provider = current_provider_safely
|
|
128
128
|
if new_provider != current_provider && !providers_tried.include?(new_provider)
|
|
129
129
|
providers_tried << current_provider
|
|
130
130
|
# Reset retry counts for the new provider
|
|
@@ -233,7 +233,7 @@ module Aidp
|
|
|
233
233
|
end
|
|
234
234
|
|
|
235
235
|
# Get retry strategy for error type
|
|
236
|
-
def
|
|
236
|
+
def retry_strategy(error_type)
|
|
237
237
|
@retry_strategies[error_type] || @retry_strategies[:default]
|
|
238
238
|
end
|
|
239
239
|
|
|
@@ -270,7 +270,7 @@ module Aidp
|
|
|
270
270
|
end
|
|
271
271
|
|
|
272
272
|
# Get retry status for a provider/model
|
|
273
|
-
def
|
|
273
|
+
def retry_status(provider, model = nil)
|
|
274
274
|
keys = if model
|
|
275
275
|
@retry_counts.keys.select { |k| k.start_with?("#{provider}:#{model}:") }
|
|
276
276
|
else
|
|
@@ -282,7 +282,7 @@ module Aidp
|
|
|
282
282
|
error_type = key.split(":").last
|
|
283
283
|
status[error_type] = {
|
|
284
284
|
retry_count: @retry_counts[key],
|
|
285
|
-
max_retries:
|
|
285
|
+
max_retries: retry_strategy(error_type.to_sym)[:max_retries]
|
|
286
286
|
}
|
|
287
287
|
end
|
|
288
288
|
|
|
@@ -290,7 +290,7 @@ module Aidp
|
|
|
290
290
|
end
|
|
291
291
|
|
|
292
292
|
# Get error history
|
|
293
|
-
def
|
|
293
|
+
def error_history(time_range = nil)
|
|
294
294
|
if time_range
|
|
295
295
|
@error_history.select { |e| time_range.include?(e[:timestamp]) }
|
|
296
296
|
else
|
|
@@ -304,7 +304,7 @@ module Aidp
|
|
|
304
304
|
end
|
|
305
305
|
|
|
306
306
|
# Get circuit breaker status
|
|
307
|
-
def
|
|
307
|
+
def circuit_breaker_status
|
|
308
308
|
@circuit_breakers.transform_values do |cb|
|
|
309
309
|
{
|
|
310
310
|
open: cb[:open],
|
|
@@ -667,7 +667,7 @@ module Aidp
|
|
|
667
667
|
end
|
|
668
668
|
|
|
669
669
|
# Safe access to provider manager methods that may not exist
|
|
670
|
-
def
|
|
670
|
+
def current_provider_safely
|
|
671
671
|
return "unknown" unless @provider_manager
|
|
672
672
|
return "unknown" unless @provider_manager.respond_to?(:current_provider)
|
|
673
673
|
|
|
@@ -677,7 +677,7 @@ module Aidp
|
|
|
677
677
|
"unknown"
|
|
678
678
|
end
|
|
679
679
|
|
|
680
|
-
def
|
|
680
|
+
def current_model_safely
|
|
681
681
|
return "unknown" unless @provider_manager
|
|
682
682
|
return "unknown" unless @provider_manager.respond_to?(:current_model)
|
|
683
683
|
|