claude-evolve 1.8.25 → 1.8.27
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.
- package/lib/ai-cli.sh +19 -20
- package/package.json +1 -1
package/lib/ai-cli.sh
CHANGED
|
@@ -112,7 +112,7 @@ $prompt"
|
|
|
112
112
|
gemini-pro)
|
|
113
113
|
local ai_output
|
|
114
114
|
# Gemini needs longer timeout as it streams output while working (20 minutes)
|
|
115
|
-
ai_output=$(timeout -k 30 1800 gemini -y -m gemini-
|
|
115
|
+
ai_output=$(timeout -k 30 1800 gemini -y -m gemini-3-pro-preview -p "$prompt" 2>&1)
|
|
116
116
|
local ai_exit_code=$?
|
|
117
117
|
;;
|
|
118
118
|
gemini-flash)
|
|
@@ -285,15 +285,15 @@ get_models_for_command() {
|
|
|
285
285
|
echo "$model_list"
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
# Call AI with
|
|
288
|
+
# Call AI with random selection and fallback support
|
|
289
289
|
# Usage: call_ai_with_round_robin <prompt> <command> <hash_value>
|
|
290
290
|
# command: "run" or "ideate"
|
|
291
|
-
# hash_value:
|
|
291
|
+
# hash_value: unused (kept for backward compatibility)
|
|
292
292
|
call_ai_with_round_robin() {
|
|
293
293
|
local prompt="$1"
|
|
294
294
|
local command="$2"
|
|
295
295
|
local hash_value="${3:-0}"
|
|
296
|
-
|
|
296
|
+
|
|
297
297
|
# Get model list for this command
|
|
298
298
|
local model_list
|
|
299
299
|
model_list=$(get_models_for_command "$command")
|
|
@@ -301,31 +301,30 @@ call_ai_with_round_robin() {
|
|
|
301
301
|
echo "[ERROR] No models configured for command: $command" >&2
|
|
302
302
|
return 1
|
|
303
303
|
fi
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
# Convert to array
|
|
306
306
|
local models=()
|
|
307
307
|
read -ra models <<< "$model_list"
|
|
308
|
-
|
|
308
|
+
|
|
309
309
|
if [[ ${#models[@]} -eq 0 ]]; then
|
|
310
310
|
echo "[ERROR] No models available for $command" >&2
|
|
311
311
|
return 1
|
|
312
312
|
fi
|
|
313
|
-
|
|
314
|
-
#
|
|
315
|
-
# Use a random starting point to avoid always using the same model
|
|
316
|
-
# for a given hash/value. This keeps the selection simple and
|
|
317
|
-
# avoids retrying the same model in the event of failures.
|
|
313
|
+
|
|
314
|
+
# Shuffle the models using Fisher-Yates algorithm for random selection
|
|
318
315
|
local num_models=${#models[@]}
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
ordered_models+=("${models[$idx]}")
|
|
316
|
+
for ((i=num_models-1; i>0; i--)); do
|
|
317
|
+
local j=$((RANDOM % (i+1)))
|
|
318
|
+
# Swap models[i] and models[j]
|
|
319
|
+
local temp="${models[i]}"
|
|
320
|
+
models[i]="${models[j]}"
|
|
321
|
+
models[j]="$temp"
|
|
326
322
|
done
|
|
327
|
-
|
|
328
|
-
|
|
323
|
+
|
|
324
|
+
# Use the shuffled array directly
|
|
325
|
+
local ordered_models=("${models[@]}")
|
|
326
|
+
|
|
327
|
+
echo "[AI] Model order for $command (random): ${ordered_models[*]}" >&2
|
|
329
328
|
|
|
330
329
|
# Track models that hit usage limits
|
|
331
330
|
local limited_models=()
|