aidp 0.25.0 → 0.27.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/README.md +45 -6
- data/lib/aidp/analyze/error_handler.rb +11 -0
- data/lib/aidp/cli/checkpoint_command.rb +198 -0
- data/lib/aidp/cli/config_command.rb +71 -0
- data/lib/aidp/cli/enhanced_input.rb +2 -0
- data/lib/aidp/cli/first_run_wizard.rb +8 -7
- data/lib/aidp/cli/harness_command.rb +102 -0
- data/lib/aidp/cli/jobs_command.rb +3 -3
- data/lib/aidp/cli/mcp_dashboard.rb +4 -3
- data/lib/aidp/cli/models_command.rb +662 -0
- data/lib/aidp/cli/providers_command.rb +223 -0
- data/lib/aidp/cli.rb +35 -456
- data/lib/aidp/daemon/runner.rb +2 -2
- data/lib/aidp/debug_mixin.rb +2 -9
- data/lib/aidp/execute/async_work_loop_runner.rb +2 -1
- data/lib/aidp/execute/checkpoint_display.rb +38 -37
- data/lib/aidp/execute/interactive_repl.rb +2 -1
- data/lib/aidp/execute/prompt_manager.rb +4 -4
- data/lib/aidp/execute/work_loop_runner.rb +253 -56
- data/lib/aidp/execute/workflow_selector.rb +2 -2
- data/lib/aidp/harness/config_loader.rb +20 -11
- data/lib/aidp/harness/config_manager.rb +5 -5
- data/lib/aidp/harness/config_schema.rb +30 -8
- data/lib/aidp/harness/configuration.rb +105 -4
- data/lib/aidp/harness/enhanced_runner.rb +24 -15
- data/lib/aidp/harness/error_handler.rb +26 -5
- data/lib/aidp/harness/filter_strategy.rb +45 -0
- data/lib/aidp/harness/generic_filter_strategy.rb +63 -0
- data/lib/aidp/harness/model_cache.rb +269 -0
- data/lib/aidp/harness/model_discovery_service.rb +259 -0
- data/lib/aidp/harness/model_registry.rb +201 -0
- data/lib/aidp/harness/output_filter.rb +136 -0
- data/lib/aidp/harness/provider_manager.rb +18 -3
- data/lib/aidp/harness/rspec_filter_strategy.rb +82 -0
- data/lib/aidp/harness/runner.rb +5 -0
- data/lib/aidp/harness/test_runner.rb +165 -27
- data/lib/aidp/harness/thinking_depth_manager.rb +223 -7
- data/lib/aidp/harness/ui/enhanced_tui.rb +4 -1
- data/lib/aidp/logger.rb +35 -5
- data/lib/aidp/providers/adapter.rb +2 -4
- data/lib/aidp/providers/anthropic.rb +141 -128
- data/lib/aidp/providers/base.rb +98 -2
- data/lib/aidp/providers/capability_registry.rb +0 -1
- data/lib/aidp/providers/codex.rb +49 -67
- data/lib/aidp/providers/cursor.rb +71 -59
- data/lib/aidp/providers/gemini.rb +44 -60
- data/lib/aidp/providers/github_copilot.rb +2 -66
- data/lib/aidp/providers/kilocode.rb +24 -80
- data/lib/aidp/providers/opencode.rb +24 -80
- data/lib/aidp/safe_directory.rb +10 -3
- data/lib/aidp/setup/wizard.rb +345 -8
- data/lib/aidp/storage/csv_storage.rb +9 -3
- data/lib/aidp/storage/file_manager.rb +8 -2
- data/lib/aidp/storage/json_storage.rb +9 -3
- data/lib/aidp/version.rb +1 -1
- data/lib/aidp/watch/build_processor.rb +40 -1
- data/lib/aidp/watch/change_request_processor.rb +659 -0
- data/lib/aidp/watch/plan_generator.rb +93 -14
- data/lib/aidp/watch/plan_processor.rb +71 -8
- data/lib/aidp/watch/repository_client.rb +85 -20
- data/lib/aidp/watch/review_processor.rb +3 -3
- data/lib/aidp/watch/runner.rb +37 -0
- data/lib/aidp/watch/state_store.rb +46 -1
- data/lib/aidp/workflows/guided_agent.rb +3 -3
- data/lib/aidp/workstream_executor.rb +5 -2
- data/lib/aidp.rb +4 -0
- data/templates/aidp-development.yml.example +2 -2
- data/templates/aidp-production.yml.example +3 -3
- data/templates/aidp.yml.example +53 -0
- metadata +14 -1
data/lib/aidp/providers/codex.rb
CHANGED
|
@@ -10,10 +10,35 @@ module Aidp
|
|
|
10
10
|
class Codex < Base
|
|
11
11
|
include Aidp::DebugMixin
|
|
12
12
|
|
|
13
|
+
# Model name pattern for OpenAI models (since Codex uses OpenAI)
|
|
14
|
+
MODEL_PATTERN = /^gpt-[\d.o-]+(?:-turbo)?(?:-mini)?$/i
|
|
15
|
+
LONG_PROMPT_THRESHOLD = 8000
|
|
16
|
+
LONG_PROMPT_TIMEOUT = 900 # 15 minutes for large prompts
|
|
17
|
+
|
|
13
18
|
def self.available?
|
|
14
19
|
!!Aidp::Util.which("codex")
|
|
15
20
|
end
|
|
16
21
|
|
|
22
|
+
# Check if this provider supports a given model family
|
|
23
|
+
#
|
|
24
|
+
# @param family_name [String] The model family name
|
|
25
|
+
# @return [Boolean] True if it matches OpenAI model pattern
|
|
26
|
+
def self.supports_model_family?(family_name)
|
|
27
|
+
MODEL_PATTERN.match?(family_name)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Discover available models from registry
|
|
31
|
+
#
|
|
32
|
+
# Note: Codex CLI doesn't have a standard model listing command
|
|
33
|
+
# Returns registry-based models that match OpenAI patterns
|
|
34
|
+
#
|
|
35
|
+
# @return [Array<Hash>] Array of discovered models
|
|
36
|
+
def self.discover_models
|
|
37
|
+
return [] unless available?
|
|
38
|
+
|
|
39
|
+
discover_models_from_registry(MODEL_PATTERN, "codex")
|
|
40
|
+
end
|
|
41
|
+
|
|
17
42
|
def name
|
|
18
43
|
"codex"
|
|
19
44
|
end
|
|
@@ -37,18 +62,13 @@ module Aidp
|
|
|
37
62
|
def send_message(prompt:, session: nil)
|
|
38
63
|
raise "codex CLI not available" unless self.class.available?
|
|
39
64
|
|
|
40
|
-
# Smart timeout calculation
|
|
65
|
+
# Smart timeout calculation (store prompt length for adaptive logic)
|
|
66
|
+
@current_codex_prompt_length = prompt.length
|
|
41
67
|
timeout_seconds = calculate_timeout
|
|
42
68
|
|
|
43
69
|
debug_provider("codex", "Starting execution", {timeout: timeout_seconds})
|
|
44
70
|
debug_log("📝 Sending prompt to codex (length: #{prompt.length})", level: :info)
|
|
45
71
|
|
|
46
|
-
# Check if streaming mode is enabled
|
|
47
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
48
|
-
if streaming_enabled
|
|
49
|
-
display_message("📺 Streaming mode enabled - output will appear in real-time", type: :info)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
72
|
# Set up activity monitoring
|
|
53
73
|
setup_activity_monitoring("codex", method(:activity_callback))
|
|
54
74
|
record_activity("Starting codex execution")
|
|
@@ -94,7 +114,7 @@ module Aidp
|
|
|
94
114
|
end
|
|
95
115
|
|
|
96
116
|
# Use debug_execute_command for better debugging
|
|
97
|
-
result = debug_execute_command("codex", args: args, timeout: timeout_seconds
|
|
117
|
+
result = debug_execute_command("codex", args: args, timeout: timeout_seconds)
|
|
98
118
|
|
|
99
119
|
# Log the results
|
|
100
120
|
debug_command("codex", args: args, input: prompt, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
@@ -116,6 +136,7 @@ module Aidp
|
|
|
116
136
|
raise
|
|
117
137
|
ensure
|
|
118
138
|
cleanup_activity_display(activity_display_thread, spinner)
|
|
139
|
+
@current_codex_prompt_length = nil
|
|
119
140
|
end
|
|
120
141
|
end
|
|
121
142
|
|
|
@@ -161,22 +182,17 @@ module Aidp
|
|
|
161
182
|
|
|
162
183
|
# Internal helper for send_with_options - executes with custom arguments
|
|
163
184
|
def send_with_custom_args(prompt:, args:)
|
|
185
|
+
@current_codex_prompt_length = prompt.length
|
|
164
186
|
timeout_seconds = calculate_timeout
|
|
165
187
|
|
|
166
188
|
debug_provider("codex", "Starting execution", {timeout: timeout_seconds, args: args})
|
|
167
189
|
debug_log("📝 Sending prompt to codex with custom args", level: :info)
|
|
168
190
|
|
|
169
|
-
# Check if streaming mode is enabled
|
|
170
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
171
|
-
if streaming_enabled
|
|
172
|
-
display_message("📺 Display streaming enabled - output buffering reduced (codex CLI does not support true streaming)", type: :info)
|
|
173
|
-
end
|
|
174
|
-
|
|
175
191
|
setup_activity_monitoring("codex", method(:activity_callback))
|
|
176
192
|
record_activity("Starting codex execution with custom args")
|
|
177
193
|
|
|
178
194
|
begin
|
|
179
|
-
result = debug_execute_command("codex", args: args, timeout: timeout_seconds
|
|
195
|
+
result = debug_execute_command("codex", args: args, timeout: timeout_seconds)
|
|
180
196
|
debug_command("codex", args: args, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
181
197
|
|
|
182
198
|
if result.exit_status == 0
|
|
@@ -191,58 +207,8 @@ module Aidp
|
|
|
191
207
|
mark_failed("codex execution failed: #{e.message}")
|
|
192
208
|
debug_error(e, {provider: "codex", prompt_length: prompt.length})
|
|
193
209
|
raise
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
def calculate_timeout
|
|
198
|
-
# Priority order for timeout calculation:
|
|
199
|
-
# 1. Quick mode (for testing)
|
|
200
|
-
# 2. Environment variable override
|
|
201
|
-
# 3. Adaptive timeout based on step type
|
|
202
|
-
# 4. Default timeout
|
|
203
|
-
|
|
204
|
-
if ENV["AIDP_QUICK_MODE"]
|
|
205
|
-
display_message("⚡ Quick mode enabled - #{TIMEOUT_QUICK_MODE / 60} minute timeout", type: :highlight)
|
|
206
|
-
return TIMEOUT_QUICK_MODE
|
|
207
|
-
end
|
|
208
|
-
|
|
209
|
-
if ENV["AIDP_CODEX_TIMEOUT"]
|
|
210
|
-
return ENV["AIDP_CODEX_TIMEOUT"].to_i
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
if adaptive_timeout
|
|
214
|
-
display_message("🧠 Using adaptive timeout: #{adaptive_timeout} seconds", type: :info)
|
|
215
|
-
return adaptive_timeout
|
|
216
|
-
end
|
|
217
|
-
|
|
218
|
-
# Default timeout
|
|
219
|
-
display_message("📋 Using default timeout: #{TIMEOUT_DEFAULT / 60} minutes", type: :info)
|
|
220
|
-
TIMEOUT_DEFAULT
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
def adaptive_timeout
|
|
224
|
-
@adaptive_timeout ||= begin
|
|
225
|
-
# Timeout recommendations based on step type patterns
|
|
226
|
-
step_name = ENV["AIDP_CURRENT_STEP"] || ""
|
|
227
|
-
|
|
228
|
-
case step_name
|
|
229
|
-
when /REPOSITORY_ANALYSIS/
|
|
230
|
-
TIMEOUT_REPOSITORY_ANALYSIS
|
|
231
|
-
when /ARCHITECTURE_ANALYSIS/
|
|
232
|
-
TIMEOUT_ARCHITECTURE_ANALYSIS
|
|
233
|
-
when /TEST_ANALYSIS/
|
|
234
|
-
TIMEOUT_TEST_ANALYSIS
|
|
235
|
-
when /FUNCTIONALITY_ANALYSIS/
|
|
236
|
-
TIMEOUT_FUNCTIONALITY_ANALYSIS
|
|
237
|
-
when /DOCUMENTATION_ANALYSIS/
|
|
238
|
-
TIMEOUT_DOCUMENTATION_ANALYSIS
|
|
239
|
-
when /STATIC_ANALYSIS/
|
|
240
|
-
TIMEOUT_STATIC_ANALYSIS
|
|
241
|
-
when /REFACTORING_RECOMMENDATIONS/
|
|
242
|
-
TIMEOUT_REFACTORING_RECOMMENDATIONS
|
|
243
|
-
else
|
|
244
|
-
nil # Use default
|
|
245
|
-
end
|
|
210
|
+
ensure
|
|
211
|
+
@current_codex_prompt_length = nil
|
|
246
212
|
end
|
|
247
213
|
end
|
|
248
214
|
|
|
@@ -257,6 +223,22 @@ module Aidp
|
|
|
257
223
|
display_message("\n❌ Codex CLI failed: #{message}", type: :error)
|
|
258
224
|
end
|
|
259
225
|
end
|
|
226
|
+
|
|
227
|
+
def calculate_timeout
|
|
228
|
+
env_override = ENV["AIDP_CODEX_TIMEOUT"]
|
|
229
|
+
return env_override.to_i if env_override&.match?(/^\d+$/)
|
|
230
|
+
|
|
231
|
+
base_timeout = super
|
|
232
|
+
|
|
233
|
+
prompt_length = @current_codex_prompt_length
|
|
234
|
+
return base_timeout unless prompt_length && prompt_length >= LONG_PROMPT_THRESHOLD
|
|
235
|
+
|
|
236
|
+
extended_timeout = [base_timeout, LONG_PROMPT_TIMEOUT].max
|
|
237
|
+
if extended_timeout > base_timeout
|
|
238
|
+
display_message("⏱️ Codex prompt length #{prompt_length} detected - extending timeout to #{extended_timeout} seconds", type: :info)
|
|
239
|
+
end
|
|
240
|
+
extended_timeout
|
|
241
|
+
end
|
|
260
242
|
end
|
|
261
243
|
end
|
|
262
244
|
end
|
|
@@ -14,6 +14,76 @@ module Aidp
|
|
|
14
14
|
!!Aidp::Util.which("cursor-agent")
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Normalize Cursor's model name to family name
|
|
18
|
+
#
|
|
19
|
+
# Cursor may use different naming conventions (e.g., dots vs hyphens)
|
|
20
|
+
#
|
|
21
|
+
# @param provider_model_name [String] Cursor's model name
|
|
22
|
+
# @return [String] The normalized family name
|
|
23
|
+
def self.model_family(provider_model_name)
|
|
24
|
+
# Normalize cursor naming to standard family names
|
|
25
|
+
# cursor uses dots: "claude-3.5-sonnet" -> "claude-3-5-sonnet"
|
|
26
|
+
provider_model_name.gsub(/(\d)\.(\d)/, '\1-\2')
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Convert family name to Cursor's naming convention
|
|
30
|
+
#
|
|
31
|
+
# @param family_name [String] The model family name
|
|
32
|
+
# @return [String] Cursor's model name
|
|
33
|
+
def self.provider_model_name(family_name)
|
|
34
|
+
# Cursor uses dots for version numbers
|
|
35
|
+
# "claude-3-5-sonnet" -> "claude-3.5-sonnet"
|
|
36
|
+
family_name.gsub(/(\d)-(\d)/, '\1.\2')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Check if this provider supports a given model family
|
|
40
|
+
#
|
|
41
|
+
# Cursor supports Claude, GPT, and Cursor-specific models
|
|
42
|
+
#
|
|
43
|
+
# @param family_name [String] The model family name
|
|
44
|
+
# @return [Boolean] True if likely supported
|
|
45
|
+
def self.supports_model_family?(family_name)
|
|
46
|
+
family_name.match?(/^(claude|gpt|cursor)-/)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Discover available models from Cursor
|
|
50
|
+
#
|
|
51
|
+
# Note: Cursor doesn't have a public model listing API
|
|
52
|
+
# Returns registry-based models that match Cursor patterns
|
|
53
|
+
#
|
|
54
|
+
# @return [Array<Hash>] Array of discovered models
|
|
55
|
+
def self.discover_models
|
|
56
|
+
return [] unless available?
|
|
57
|
+
|
|
58
|
+
begin
|
|
59
|
+
require_relative "../harness/model_registry"
|
|
60
|
+
registry = Aidp::Harness::ModelRegistry.new
|
|
61
|
+
|
|
62
|
+
# Get all models from registry that Cursor might support
|
|
63
|
+
models = registry.all_families.filter_map do |family|
|
|
64
|
+
next unless supports_model_family?(family)
|
|
65
|
+
|
|
66
|
+
info = registry.get_model_info(family)
|
|
67
|
+
next unless info
|
|
68
|
+
|
|
69
|
+
{
|
|
70
|
+
name: provider_model_name(family),
|
|
71
|
+
family: family,
|
|
72
|
+
tier: info["tier"],
|
|
73
|
+
capabilities: info["capabilities"] || [],
|
|
74
|
+
context_window: info["context_window"],
|
|
75
|
+
provider: "cursor"
|
|
76
|
+
}
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
Aidp.log_info("cursor_provider", "using registry models", count: models.size)
|
|
80
|
+
models
|
|
81
|
+
rescue => e
|
|
82
|
+
Aidp.log_debug("cursor_provider", "discovery failed", error: e.message)
|
|
83
|
+
[]
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
|
|
17
87
|
def name
|
|
18
88
|
"cursor"
|
|
19
89
|
end
|
|
@@ -40,12 +110,6 @@ module Aidp
|
|
|
40
110
|
debug_provider("cursor", "Starting execution", {timeout: timeout_seconds})
|
|
41
111
|
debug_log("📝 Sending prompt to cursor-agent (length: #{prompt.length})", level: :info)
|
|
42
112
|
|
|
43
|
-
# Check if streaming mode is enabled
|
|
44
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
45
|
-
if streaming_enabled
|
|
46
|
-
display_message("📺 Display streaming enabled - output buffering reduced (cursor-agent does not support true streaming)", type: :info)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
113
|
# Set up activity monitoring
|
|
50
114
|
setup_activity_monitoring("cursor-agent", method(:activity_callback))
|
|
51
115
|
record_activity("Starting cursor-agent execution")
|
|
@@ -71,7 +135,7 @@ module Aidp
|
|
|
71
135
|
# Use debug_execute_command for better debugging
|
|
72
136
|
# Use -p mode (designed for non-interactive/script use)
|
|
73
137
|
# No fallback to interactive modes - they would hang AIDP's automation workflow
|
|
74
|
-
result = debug_execute_command("cursor-agent", args: ["-p"], input: prompt, timeout: timeout_seconds
|
|
138
|
+
result = debug_execute_command("cursor-agent", args: ["-p"], input: prompt, timeout: timeout_seconds)
|
|
75
139
|
|
|
76
140
|
# Log the results
|
|
77
141
|
debug_command("cursor-agent", args: ["-p"], input: prompt, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
@@ -98,58 +162,6 @@ module Aidp
|
|
|
98
162
|
|
|
99
163
|
private
|
|
100
164
|
|
|
101
|
-
def calculate_timeout
|
|
102
|
-
# Priority order for timeout calculation:
|
|
103
|
-
# 1. Quick mode (for testing)
|
|
104
|
-
# 2. Environment variable override
|
|
105
|
-
# 3. Adaptive timeout based on step type
|
|
106
|
-
# 4. Default timeout
|
|
107
|
-
|
|
108
|
-
if ENV["AIDP_QUICK_MODE"]
|
|
109
|
-
display_message("⚡ Quick mode enabled - #{TIMEOUT_QUICK_MODE / 60} minute timeout", type: :highlight)
|
|
110
|
-
return TIMEOUT_QUICK_MODE
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
if ENV["AIDP_CURSOR_TIMEOUT"]
|
|
114
|
-
return ENV["AIDP_CURSOR_TIMEOUT"].to_i
|
|
115
|
-
end
|
|
116
|
-
|
|
117
|
-
if adaptive_timeout
|
|
118
|
-
display_message("🧠 Using adaptive timeout: #{adaptive_timeout} seconds", type: :info)
|
|
119
|
-
return adaptive_timeout
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
# Default timeout
|
|
123
|
-
display_message("📋 Using default timeout: #{TIMEOUT_DEFAULT / 60} minutes", type: :info)
|
|
124
|
-
TIMEOUT_DEFAULT
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
def adaptive_timeout
|
|
128
|
-
@adaptive_timeout ||= begin
|
|
129
|
-
# Timeout recommendations based on step type patterns
|
|
130
|
-
step_name = ENV["AIDP_CURRENT_STEP"] || ""
|
|
131
|
-
|
|
132
|
-
case step_name
|
|
133
|
-
when /REPOSITORY_ANALYSIS/
|
|
134
|
-
TIMEOUT_REPOSITORY_ANALYSIS
|
|
135
|
-
when /ARCHITECTURE_ANALYSIS/
|
|
136
|
-
TIMEOUT_ARCHITECTURE_ANALYSIS
|
|
137
|
-
when /TEST_ANALYSIS/
|
|
138
|
-
TIMEOUT_TEST_ANALYSIS
|
|
139
|
-
when /FUNCTIONALITY_ANALYSIS/
|
|
140
|
-
TIMEOUT_FUNCTIONALITY_ANALYSIS
|
|
141
|
-
when /DOCUMENTATION_ANALYSIS/
|
|
142
|
-
TIMEOUT_DOCUMENTATION_ANALYSIS
|
|
143
|
-
when /STATIC_ANALYSIS/
|
|
144
|
-
TIMEOUT_STATIC_ANALYSIS
|
|
145
|
-
when /REFACTORING_RECOMMENDATIONS/
|
|
146
|
-
TIMEOUT_REFACTORING_RECOMMENDATIONS
|
|
147
|
-
else
|
|
148
|
-
nil # Use default
|
|
149
|
-
end
|
|
150
|
-
end
|
|
151
|
-
end
|
|
152
|
-
|
|
153
165
|
def activity_callback(state, message, provider)
|
|
154
166
|
# This is now handled by the animated display thread
|
|
155
167
|
# Only print static messages for state changes
|
|
@@ -8,10 +8,53 @@ module Aidp
|
|
|
8
8
|
class Gemini < Base
|
|
9
9
|
include Aidp::DebugMixin
|
|
10
10
|
|
|
11
|
+
# Model name pattern for Gemini models
|
|
12
|
+
MODEL_PATTERN = /^gemini-[\d.]+-(?:pro|flash|ultra)(?:-\d+)?$/i
|
|
13
|
+
|
|
11
14
|
def self.available?
|
|
12
15
|
!!Aidp::Util.which("gemini")
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
# Normalize a provider-specific model name to its model family
|
|
19
|
+
#
|
|
20
|
+
# Gemini may use version suffixes (e.g., "gemini-1.5-pro-001").
|
|
21
|
+
# This method strips version suffixes to get the family name.
|
|
22
|
+
#
|
|
23
|
+
# @param provider_model_name [String] The model name
|
|
24
|
+
# @return [String] The model family name
|
|
25
|
+
def self.model_family(provider_model_name)
|
|
26
|
+
# Strip version suffix: "gemini-1.5-pro-001" → "gemini-1.5-pro"
|
|
27
|
+
provider_model_name.sub(/-\d+$/, "")
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Convert a model family name to the provider's preferred model name
|
|
31
|
+
#
|
|
32
|
+
# @param family_name [String] The model family name
|
|
33
|
+
# @return [String] The provider-specific model name (same as family)
|
|
34
|
+
def self.provider_model_name(family_name)
|
|
35
|
+
family_name
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Check if this provider supports a given model family
|
|
39
|
+
#
|
|
40
|
+
# @param family_name [String] The model family name
|
|
41
|
+
# @return [Boolean] True if it matches Gemini model pattern
|
|
42
|
+
def self.supports_model_family?(family_name)
|
|
43
|
+
MODEL_PATTERN.match?(family_name)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Discover available models from Gemini
|
|
47
|
+
#
|
|
48
|
+
# Note: Gemini CLI doesn't have a standard model listing command
|
|
49
|
+
# Returns registry-based models that match Gemini patterns
|
|
50
|
+
#
|
|
51
|
+
# @return [Array<Hash>] Array of discovered models
|
|
52
|
+
def self.discover_models
|
|
53
|
+
return [] unless available?
|
|
54
|
+
|
|
55
|
+
discover_models_from_registry(MODEL_PATTERN, "gemini")
|
|
56
|
+
end
|
|
57
|
+
|
|
15
58
|
def name
|
|
16
59
|
"gemini"
|
|
17
60
|
end
|
|
@@ -29,16 +72,9 @@ module Aidp
|
|
|
29
72
|
debug_provider("gemini", "Starting execution", {timeout: timeout_seconds})
|
|
30
73
|
debug_log("📝 Sending prompt to gemini...", level: :info)
|
|
31
74
|
|
|
32
|
-
# Check if streaming mode is enabled
|
|
33
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
34
|
-
if streaming_enabled
|
|
35
|
-
display_message("📺 Display streaming enabled - output buffering reduced (gemini CLI does not support true streaming)", type: :info)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
75
|
begin
|
|
39
76
|
command_args = ["--prompt", prompt]
|
|
40
|
-
|
|
41
|
-
result = debug_execute_command("gemini", args: command_args, timeout: timeout_seconds, streaming: streaming_enabled)
|
|
77
|
+
result = debug_execute_command("gemini", args: command_args, timeout: timeout_seconds)
|
|
42
78
|
|
|
43
79
|
# Log the results
|
|
44
80
|
debug_command("gemini", args: command_args, input: nil, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
@@ -56,58 +92,6 @@ module Aidp
|
|
|
56
92
|
end
|
|
57
93
|
|
|
58
94
|
private
|
|
59
|
-
|
|
60
|
-
def calculate_timeout
|
|
61
|
-
# Priority order for timeout calculation:
|
|
62
|
-
# 1. Quick mode (for testing)
|
|
63
|
-
# 2. Environment variable override
|
|
64
|
-
# 3. Adaptive timeout based on step type
|
|
65
|
-
# 4. Default timeout
|
|
66
|
-
|
|
67
|
-
if ENV["AIDP_QUICK_MODE"]
|
|
68
|
-
display_message("⚡ Quick mode enabled - #{TIMEOUT_QUICK_MODE / 60} minute timeout", type: :highlight)
|
|
69
|
-
return TIMEOUT_QUICK_MODE
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
if ENV["AIDP_GEMINI_TIMEOUT"]
|
|
73
|
-
return ENV["AIDP_GEMINI_TIMEOUT"].to_i
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Adaptive timeout based on step type
|
|
77
|
-
step_timeout = get_adaptive_timeout
|
|
78
|
-
if step_timeout
|
|
79
|
-
display_message("🧠 Using adaptive timeout: #{step_timeout} seconds", type: :info)
|
|
80
|
-
return step_timeout
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
# Default timeout
|
|
84
|
-
display_message("📋 Using default timeout: #{TIMEOUT_DEFAULT / 60} minutes", type: :info)
|
|
85
|
-
TIMEOUT_DEFAULT
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def get_adaptive_timeout
|
|
89
|
-
# Timeout recommendations based on step type patterns
|
|
90
|
-
step_name = ENV["AIDP_CURRENT_STEP"] || ""
|
|
91
|
-
|
|
92
|
-
case step_name
|
|
93
|
-
when /REPOSITORY_ANALYSIS/
|
|
94
|
-
TIMEOUT_REPOSITORY_ANALYSIS
|
|
95
|
-
when /ARCHITECTURE_ANALYSIS/
|
|
96
|
-
TIMEOUT_ARCHITECTURE_ANALYSIS
|
|
97
|
-
when /TEST_ANALYSIS/
|
|
98
|
-
TIMEOUT_TEST_ANALYSIS
|
|
99
|
-
when /FUNCTIONALITY_ANALYSIS/
|
|
100
|
-
TIMEOUT_FUNCTIONALITY_ANALYSIS
|
|
101
|
-
when /DOCUMENTATION_ANALYSIS/
|
|
102
|
-
TIMEOUT_DOCUMENTATION_ANALYSIS
|
|
103
|
-
when /STATIC_ANALYSIS/
|
|
104
|
-
TIMEOUT_STATIC_ANALYSIS
|
|
105
|
-
when /REFACTORING_RECOMMENDATIONS/
|
|
106
|
-
TIMEOUT_REFACTORING_RECOMMENDATIONS
|
|
107
|
-
else
|
|
108
|
-
nil # Use default
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
95
|
end
|
|
112
96
|
end
|
|
113
97
|
end
|
|
@@ -43,12 +43,6 @@ module Aidp
|
|
|
43
43
|
debug_provider("copilot", "Starting execution", {timeout: timeout_seconds})
|
|
44
44
|
debug_log("📝 Sending prompt to copilot (length: #{prompt.length})", level: :info)
|
|
45
45
|
|
|
46
|
-
# Check if streaming mode is enabled
|
|
47
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
48
|
-
if streaming_enabled
|
|
49
|
-
display_message("📺 Display streaming enabled - output buffering reduced (copilot CLI does not support true streaming)", type: :info)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
46
|
# Set up activity monitoring
|
|
53
47
|
setup_activity_monitoring("copilot", method(:activity_callback))
|
|
54
48
|
record_activity("Starting copilot execution")
|
|
@@ -80,7 +74,7 @@ module Aidp
|
|
|
80
74
|
end
|
|
81
75
|
|
|
82
76
|
# Use debug_execute_command for better debugging (no input since prompt is in args)
|
|
83
|
-
result = debug_execute_command("copilot", args: args, timeout: timeout_seconds
|
|
77
|
+
result = debug_execute_command("copilot", args: args, timeout: timeout_seconds)
|
|
84
78
|
|
|
85
79
|
# Log the results
|
|
86
80
|
debug_command("copilot", args: args, input: prompt, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
@@ -178,17 +172,11 @@ module Aidp
|
|
|
178
172
|
debug_provider("copilot", "Starting execution", {timeout: timeout_seconds, args: args})
|
|
179
173
|
debug_log("📝 Sending prompt to copilot with custom args", level: :info)
|
|
180
174
|
|
|
181
|
-
# Check if streaming mode is enabled
|
|
182
|
-
streaming_enabled = ENV["AIDP_STREAMING"] == "1" || ENV["DEBUG"] == "1"
|
|
183
|
-
if streaming_enabled
|
|
184
|
-
display_message("📺 Display streaming enabled - output buffering reduced (copilot CLI does not support true streaming)", type: :info)
|
|
185
|
-
end
|
|
186
|
-
|
|
187
175
|
setup_activity_monitoring("copilot", method(:activity_callback))
|
|
188
176
|
record_activity("Starting copilot execution with custom args")
|
|
189
177
|
|
|
190
178
|
begin
|
|
191
|
-
result = debug_execute_command("copilot", args: args, timeout: timeout_seconds
|
|
179
|
+
result = debug_execute_command("copilot", args: args, timeout: timeout_seconds)
|
|
192
180
|
debug_command("copilot", args: args, output: result.out, error: result.err, exit_code: result.exit_status)
|
|
193
181
|
|
|
194
182
|
if result.exit_status == 0
|
|
@@ -206,58 +194,6 @@ module Aidp
|
|
|
206
194
|
end
|
|
207
195
|
end
|
|
208
196
|
|
|
209
|
-
def calculate_timeout
|
|
210
|
-
# Priority order for timeout calculation:
|
|
211
|
-
# 1. Quick mode (for testing)
|
|
212
|
-
# 2. Environment variable override
|
|
213
|
-
# 3. Adaptive timeout based on step type
|
|
214
|
-
# 4. Default timeout
|
|
215
|
-
|
|
216
|
-
if ENV["AIDP_QUICK_MODE"]
|
|
217
|
-
display_message("⚡ Quick mode enabled - #{TIMEOUT_QUICK_MODE / 60} minute timeout", type: :highlight)
|
|
218
|
-
return TIMEOUT_QUICK_MODE
|
|
219
|
-
end
|
|
220
|
-
|
|
221
|
-
if ENV["AIDP_GITHUB_COPILOT_TIMEOUT"]
|
|
222
|
-
return ENV["AIDP_GITHUB_COPILOT_TIMEOUT"].to_i
|
|
223
|
-
end
|
|
224
|
-
|
|
225
|
-
if adaptive_timeout
|
|
226
|
-
display_message("🧠 Using adaptive timeout: #{adaptive_timeout} seconds", type: :info)
|
|
227
|
-
return adaptive_timeout
|
|
228
|
-
end
|
|
229
|
-
|
|
230
|
-
# Default timeout
|
|
231
|
-
display_message("📋 Using default timeout: #{TIMEOUT_DEFAULT / 60} minutes", type: :info)
|
|
232
|
-
TIMEOUT_DEFAULT
|
|
233
|
-
end
|
|
234
|
-
|
|
235
|
-
def adaptive_timeout
|
|
236
|
-
@adaptive_timeout ||= begin
|
|
237
|
-
# Timeout recommendations based on step type patterns
|
|
238
|
-
step_name = ENV["AIDP_CURRENT_STEP"] || ""
|
|
239
|
-
|
|
240
|
-
case step_name
|
|
241
|
-
when /REPOSITORY_ANALYSIS/
|
|
242
|
-
TIMEOUT_REPOSITORY_ANALYSIS
|
|
243
|
-
when /ARCHITECTURE_ANALYSIS/
|
|
244
|
-
TIMEOUT_ARCHITECTURE_ANALYSIS
|
|
245
|
-
when /TEST_ANALYSIS/
|
|
246
|
-
TIMEOUT_TEST_ANALYSIS
|
|
247
|
-
when /FUNCTIONALITY_ANALYSIS/
|
|
248
|
-
TIMEOUT_FUNCTIONALITY_ANALYSIS
|
|
249
|
-
when /DOCUMENTATION_ANALYSIS/
|
|
250
|
-
TIMEOUT_DOCUMENTATION_ANALYSIS
|
|
251
|
-
when /STATIC_ANALYSIS/
|
|
252
|
-
TIMEOUT_STATIC_ANALYSIS
|
|
253
|
-
when /REFACTORING_RECOMMENDATIONS/
|
|
254
|
-
TIMEOUT_REFACTORING_RECOMMENDATIONS
|
|
255
|
-
else
|
|
256
|
-
nil # Use default
|
|
257
|
-
end
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
|
|
261
197
|
def activity_callback(state, message, provider)
|
|
262
198
|
# Handle activity state changes
|
|
263
199
|
case state
|