opencode-openai-codex-auth-multi 4.3.0-multiaccount.1 → 4.5.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.
- package/LICENSE +37 -37
- package/README.md +463 -80
- package/assets/opencode-logo-ornate-dark.svg +18 -18
- package/assets/readme-hero.svg +31 -31
- package/config/README.md +98 -98
- package/config/minimal-opencode.json +11 -11
- package/config/opencode-legacy.json +568 -568
- package/config/opencode-modern.json +236 -236
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +391 -135
- package/dist/index.js.map +1 -1
- package/dist/lib/accounts.d.ts +85 -11
- package/dist/lib/accounts.d.ts.map +1 -1
- package/dist/lib/accounts.js +352 -62
- package/dist/lib/accounts.js.map +1 -1
- package/dist/lib/auth/auth.d.ts +9 -1
- package/dist/lib/auth/auth.d.ts.map +1 -1
- package/dist/lib/auth/auth.js +26 -13
- package/dist/lib/auth/auth.js.map +1 -1
- package/dist/lib/auth/browser.d.ts.map +1 -1
- package/dist/lib/auth/browser.js +9 -2
- package/dist/lib/auth/browser.js.map +1 -1
- package/dist/lib/auth/server.d.ts.map +1 -1
- package/dist/lib/auth/server.js +11 -4
- package/dist/lib/auth/server.js.map +1 -1
- package/dist/lib/auto-update-checker.d.ts +10 -0
- package/dist/lib/auto-update-checker.d.ts.map +1 -0
- package/dist/lib/auto-update-checker.js +129 -0
- package/dist/lib/auto-update-checker.js.map +1 -0
- package/dist/lib/cli.d.ts +1 -0
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +11 -6
- package/dist/lib/cli.js.map +1 -1
- package/dist/lib/config.d.ts +5 -7
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +49 -6
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/constants.d.ts +7 -0
- package/dist/lib/constants.d.ts.map +1 -1
- package/dist/lib/constants.js +7 -0
- package/dist/lib/constants.js.map +1 -1
- package/dist/lib/index.d.ts +13 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +13 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/logger.d.ts +13 -17
- package/dist/lib/logger.d.ts.map +1 -1
- package/dist/lib/logger.js +89 -24
- package/dist/lib/logger.js.map +1 -1
- package/dist/lib/oauth-success.html +712 -712
- package/dist/lib/prompts/codex-opencode-bridge.js +121 -121
- package/dist/lib/prompts/codex.d.ts +5 -0
- package/dist/lib/prompts/codex.d.ts.map +1 -1
- package/dist/lib/prompts/codex.js +114 -93
- package/dist/lib/prompts/codex.js.map +1 -1
- package/dist/lib/refresh-queue.d.ts +100 -0
- package/dist/lib/refresh-queue.d.ts.map +1 -0
- package/dist/lib/refresh-queue.js +196 -0
- package/dist/lib/refresh-queue.js.map +1 -0
- package/dist/lib/request/fetch-helpers.d.ts +2 -3
- package/dist/lib/request/fetch-helpers.d.ts.map +1 -1
- package/dist/lib/request/fetch-helpers.js +26 -29
- package/dist/lib/request/fetch-helpers.js.map +1 -1
- package/dist/lib/request/rate-limit-backoff.d.ts +17 -0
- package/dist/lib/request/rate-limit-backoff.d.ts.map +1 -0
- package/dist/lib/request/rate-limit-backoff.js +74 -0
- package/dist/lib/request/rate-limit-backoff.js.map +1 -0
- package/dist/lib/request/request-transformer.d.ts.map +1 -1
- package/dist/lib/request/request-transformer.js +3 -2
- package/dist/lib/request/request-transformer.js.map +1 -1
- package/dist/lib/request/response-handler.js +1 -1
- package/dist/lib/request/response-handler.js.map +1 -1
- package/dist/lib/rotation.d.ts +121 -0
- package/dist/lib/rotation.d.ts.map +1 -0
- package/dist/lib/rotation.js +248 -0
- package/dist/lib/rotation.js.map +1 -0
- package/dist/lib/storage.d.ts +72 -4
- package/dist/lib/storage.d.ts.map +1 -1
- package/dist/lib/storage.js +189 -19
- package/dist/lib/storage.js.map +1 -1
- package/dist/lib/types.d.ts +37 -1
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +85 -71
- package/scripts/install-opencode-codex-auth.js +191 -191
- package/scripts/test-all-models.sh +258 -258
- package/scripts/validate-model-map.sh +97 -97
|
@@ -1,260 +1,260 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Test All Models - Verify API Configuration
|
|
4
|
-
# This script tests all model configurations and verifies the actual API requests
|
|
5
|
-
|
|
6
|
-
set -e
|
|
7
|
-
|
|
8
|
-
# Colors for output
|
|
9
|
-
RED='\033[0;31m'
|
|
10
|
-
GREEN='\033[0;32m'
|
|
11
|
-
YELLOW='\033[1;33m'
|
|
12
|
-
BLUE='\033[0;34m'
|
|
13
|
-
NC='\033[0m' # No Color
|
|
14
|
-
|
|
15
|
-
# Paths
|
|
16
|
-
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
17
|
-
OPENCODE_JSON="${REPO_DIR}/opencode.json"
|
|
18
|
-
LOG_DIR="${HOME}/.opencode/logs/codex-plugin"
|
|
19
|
-
RESULTS_FILE="${REPO_DIR}/test-results.md"
|
|
20
|
-
|
|
21
|
-
# Test counter
|
|
22
|
-
TOTAL_TESTS=0
|
|
23
|
-
PASSED_TESTS=0
|
|
24
|
-
FAILED_TESTS=0
|
|
25
|
-
|
|
26
|
-
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
27
|
-
echo -e "${BLUE} Model Configuration Verification Test Suite${NC}"
|
|
28
|
-
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
29
|
-
echo ""
|
|
30
|
-
|
|
31
|
-
# Kill any running OpenCode server processes to force fresh plugin load
|
|
32
|
-
echo "Killing OpenCode server processes..."
|
|
33
|
-
pkill -f "opencode" 2>/dev/null || true
|
|
34
|
-
sleep 2
|
|
35
|
-
echo "✓ OpenCode servers stopped"
|
|
36
|
-
echo ""
|
|
37
|
-
|
|
38
|
-
# Initialize results file
|
|
39
|
-
cat > "${RESULTS_FILE}" << 'EOF'
|
|
40
|
-
# Model Configuration Verification Results
|
|
41
|
-
|
|
42
|
-
**Test Date:** $(date)
|
|
43
|
-
**Test Directory:** Repository local config
|
|
44
|
-
|
|
45
|
-
## Results Summary
|
|
46
|
-
|
|
47
|
-
| Model | Normalized | Family | Effort | Summary | Verbosity | Include | Status |
|
|
48
|
-
|-------|------------|--------|--------|---------|-----------|---------|--------|
|
|
49
|
-
EOF
|
|
50
|
-
|
|
51
|
-
# Function: Run a test for a specific model
|
|
52
|
-
test_model() {
|
|
53
|
-
local model_name="$1"
|
|
54
|
-
local expected_normalized="$2"
|
|
55
|
-
local expected_family="$3"
|
|
56
|
-
local expected_effort="$4"
|
|
57
|
-
local expected_summary="$5"
|
|
58
|
-
local expected_verbosity="$6"
|
|
59
|
-
|
|
60
|
-
((TOTAL_TESTS++))
|
|
61
|
-
|
|
62
|
-
echo -e "${YELLOW}Testing model: ${model_name}${NC}"
|
|
63
|
-
|
|
64
|
-
# Clear previous logs
|
|
65
|
-
rm -rf "${LOG_DIR}"/*
|
|
66
|
-
|
|
67
|
-
# Run opencode
|
|
68
|
-
cd "${REPO_DIR}"
|
|
69
|
-
if ENABLE_PLUGIN_REQUEST_LOGGING=1 DEBUG_CODEX_PLUGIN=1 opencode run "write hello to test-${TOTAL_TESTS}.txt" --model="openai/${model_name}" > /dev/null 2>&1; then
|
|
70
|
-
echo -e "${GREEN} ✓ Command executed successfully${NC}"
|
|
71
|
-
else
|
|
72
|
-
echo -e "${RED} ✗ Command failed${NC}"
|
|
73
|
-
echo "| ${model_name} | N/A | N/A | N/A | N/A | N/A | ❌ FAILED |" >> "${RESULTS_FILE}"
|
|
74
|
-
((FAILED_TESTS++))
|
|
75
|
-
return 1
|
|
76
|
-
fi
|
|
77
|
-
|
|
78
|
-
# Find the after-transform log file that matches the expected model
|
|
79
|
-
# (opencode may use multiple models per session - e.g., nano for titles)
|
|
80
|
-
local log_file=""
|
|
81
|
-
for f in $(find "${LOG_DIR}" -name "*-after-transform.json" -type f -print0 | xargs -0 ls -t); do
|
|
82
|
-
local orig_model=$(jq -r '.originalModel // ""' "$f" 2>/dev/null)
|
|
83
|
-
if [ "${orig_model}" = "${model_name}" ]; then
|
|
84
|
-
log_file="$f"
|
|
85
|
-
break
|
|
86
|
-
fi
|
|
87
|
-
done
|
|
88
|
-
|
|
89
|
-
if [ -z "${log_file}" ] || [ ! -f "${log_file}" ]; then
|
|
90
|
-
echo -e "${RED} ✗ Log file not found for model ${model_name}${NC}"
|
|
91
|
-
echo "| ${model_name} | N/A | N/A | N/A | N/A | N/A | ❌ NO LOG |" >> "${RESULTS_FILE}"
|
|
92
|
-
((FAILED_TESTS++))
|
|
93
|
-
return 1
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
# Parse log file with jq
|
|
97
|
-
local actual_normalized=$(jq -r '.normalizedModel // "N/A"' "${log_file}")
|
|
98
|
-
local actual_family=$(jq -r '.modelFamily // "N/A"' "${log_file}")
|
|
99
|
-
local actual_effort=$(jq -r '.reasoning.effort // "N/A"' "${log_file}")
|
|
100
|
-
local actual_summary=$(jq -r '.reasoning.summary // "N/A"' "${log_file}")
|
|
101
|
-
local actual_verbosity=$(jq -r '.body.text.verbosity // "N/A"' "${log_file}")
|
|
102
|
-
local actual_include=$(jq -r '.include[0] // "N/A"' "${log_file}")
|
|
103
|
-
|
|
104
|
-
echo " Actual: model=${actual_normalized}, family=${actual_family}, effort=${actual_effort}, summary=${actual_summary}, verbosity=${actual_verbosity}"
|
|
105
|
-
echo " Expected: model=${expected_normalized}, family=${expected_family}, effort=${expected_effort}, summary=${expected_summary}, verbosity=${expected_verbosity}"
|
|
106
|
-
|
|
107
|
-
# Verify values
|
|
108
|
-
local status="✅ PASS"
|
|
109
|
-
if [ "${actual_normalized}" != "${expected_normalized}" ] || \
|
|
110
|
-
[ "${actual_family}" != "${expected_family}" ] || \
|
|
111
|
-
[ "${actual_effort}" != "${expected_effort}" ] || \
|
|
112
|
-
[ "${actual_summary}" != "${expected_summary}" ] || \
|
|
113
|
-
[ "${actual_verbosity}" != "${expected_verbosity}" ]; then
|
|
114
|
-
status="❌ FAIL"
|
|
115
|
-
((FAILED_TESTS++))
|
|
116
|
-
echo -e "${RED} ✗ Verification failed${NC}"
|
|
117
|
-
else
|
|
118
|
-
((PASSED_TESTS++))
|
|
119
|
-
echo -e "${GREEN} ✓ Verification passed${NC}"
|
|
120
|
-
fi
|
|
121
|
-
|
|
122
|
-
# Add to results
|
|
123
|
-
echo "| ${model_name} | ${actual_normalized} | ${actual_family} | ${actual_effort} | ${actual_summary} | ${actual_verbosity} | ${actual_include} | ${status} |" >> "${RESULTS_FILE}"
|
|
124
|
-
|
|
125
|
-
# Cleanup
|
|
126
|
-
rm -f "${REPO_DIR}/test-${TOTAL_TESTS}.txt"
|
|
127
|
-
|
|
128
|
-
echo ""
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
# Function: Update opencode.json with config
|
|
132
|
-
update_config() {
|
|
133
|
-
local config_type="$1"
|
|
134
|
-
|
|
135
|
-
echo -e "${BLUE}─────────────────────────────────────────────────────────────────${NC}"
|
|
136
|
-
echo -e "${BLUE}Scenario: ${config_type}${NC}"
|
|
137
|
-
echo -e "${BLUE}─────────────────────────────────────────────────────────────────${NC}"
|
|
138
|
-
echo ""
|
|
139
|
-
|
|
140
|
-
case "${config_type}" in
|
|
141
|
-
"legacy")
|
|
142
|
-
cat "${REPO_DIR}/config/opencode-legacy.json" > "${OPENCODE_JSON}"
|
|
143
|
-
echo "✓ Updated opencode.json with legacy config (GPT 5.x)"
|
|
144
|
-
;;
|
|
145
|
-
"minimal")
|
|
146
|
-
cat "${REPO_DIR}/config/minimal-opencode.json" > "${OPENCODE_JSON}"
|
|
147
|
-
echo "✓ Updated opencode.json with minimal config"
|
|
148
|
-
;;
|
|
149
|
-
esac
|
|
150
|
-
|
|
151
|
-
# Replace npm package with local dist for testing
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Test All Models - Verify API Configuration
|
|
4
|
+
# This script tests all model configurations and verifies the actual API requests
|
|
5
|
+
|
|
6
|
+
set -e
|
|
7
|
+
|
|
8
|
+
# Colors for output
|
|
9
|
+
RED='\033[0;31m'
|
|
10
|
+
GREEN='\033[0;32m'
|
|
11
|
+
YELLOW='\033[1;33m'
|
|
12
|
+
BLUE='\033[0;34m'
|
|
13
|
+
NC='\033[0m' # No Color
|
|
14
|
+
|
|
15
|
+
# Paths
|
|
16
|
+
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
17
|
+
OPENCODE_JSON="${REPO_DIR}/opencode.json"
|
|
18
|
+
LOG_DIR="${HOME}/.opencode/logs/codex-plugin"
|
|
19
|
+
RESULTS_FILE="${REPO_DIR}/test-results.md"
|
|
20
|
+
|
|
21
|
+
# Test counter
|
|
22
|
+
TOTAL_TESTS=0
|
|
23
|
+
PASSED_TESTS=0
|
|
24
|
+
FAILED_TESTS=0
|
|
25
|
+
|
|
26
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
27
|
+
echo -e "${BLUE} Model Configuration Verification Test Suite${NC}"
|
|
28
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
29
|
+
echo ""
|
|
30
|
+
|
|
31
|
+
# Kill any running OpenCode server processes to force fresh plugin load
|
|
32
|
+
echo "Killing OpenCode server processes..."
|
|
33
|
+
pkill -f "opencode" 2>/dev/null || true
|
|
34
|
+
sleep 2
|
|
35
|
+
echo "✓ OpenCode servers stopped"
|
|
36
|
+
echo ""
|
|
37
|
+
|
|
38
|
+
# Initialize results file
|
|
39
|
+
cat > "${RESULTS_FILE}" << 'EOF'
|
|
40
|
+
# Model Configuration Verification Results
|
|
41
|
+
|
|
42
|
+
**Test Date:** $(date)
|
|
43
|
+
**Test Directory:** Repository local config
|
|
44
|
+
|
|
45
|
+
## Results Summary
|
|
46
|
+
|
|
47
|
+
| Model | Normalized | Family | Effort | Summary | Verbosity | Include | Status |
|
|
48
|
+
|-------|------------|--------|--------|---------|-----------|---------|--------|
|
|
49
|
+
EOF
|
|
50
|
+
|
|
51
|
+
# Function: Run a test for a specific model
|
|
52
|
+
test_model() {
|
|
53
|
+
local model_name="$1"
|
|
54
|
+
local expected_normalized="$2"
|
|
55
|
+
local expected_family="$3"
|
|
56
|
+
local expected_effort="$4"
|
|
57
|
+
local expected_summary="$5"
|
|
58
|
+
local expected_verbosity="$6"
|
|
59
|
+
|
|
60
|
+
((TOTAL_TESTS++))
|
|
61
|
+
|
|
62
|
+
echo -e "${YELLOW}Testing model: ${model_name}${NC}"
|
|
63
|
+
|
|
64
|
+
# Clear previous logs
|
|
65
|
+
rm -rf "${LOG_DIR}"/*
|
|
66
|
+
|
|
67
|
+
# Run opencode
|
|
68
|
+
cd "${REPO_DIR}"
|
|
69
|
+
if ENABLE_PLUGIN_REQUEST_LOGGING=1 DEBUG_CODEX_PLUGIN=1 opencode run "write hello to test-${TOTAL_TESTS}.txt" --model="openai/${model_name}" > /dev/null 2>&1; then
|
|
70
|
+
echo -e "${GREEN} ✓ Command executed successfully${NC}"
|
|
71
|
+
else
|
|
72
|
+
echo -e "${RED} ✗ Command failed${NC}"
|
|
73
|
+
echo "| ${model_name} | N/A | N/A | N/A | N/A | N/A | ❌ FAILED |" >> "${RESULTS_FILE}"
|
|
74
|
+
((FAILED_TESTS++))
|
|
75
|
+
return 1
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Find the after-transform log file that matches the expected model
|
|
79
|
+
# (opencode may use multiple models per session - e.g., nano for titles)
|
|
80
|
+
local log_file=""
|
|
81
|
+
for f in $(find "${LOG_DIR}" -name "*-after-transform.json" -type f -print0 | xargs -0 ls -t); do
|
|
82
|
+
local orig_model=$(jq -r '.originalModel // ""' "$f" 2>/dev/null)
|
|
83
|
+
if [ "${orig_model}" = "${model_name}" ]; then
|
|
84
|
+
log_file="$f"
|
|
85
|
+
break
|
|
86
|
+
fi
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
if [ -z "${log_file}" ] || [ ! -f "${log_file}" ]; then
|
|
90
|
+
echo -e "${RED} ✗ Log file not found for model ${model_name}${NC}"
|
|
91
|
+
echo "| ${model_name} | N/A | N/A | N/A | N/A | N/A | ❌ NO LOG |" >> "${RESULTS_FILE}"
|
|
92
|
+
((FAILED_TESTS++))
|
|
93
|
+
return 1
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Parse log file with jq
|
|
97
|
+
local actual_normalized=$(jq -r '.normalizedModel // "N/A"' "${log_file}")
|
|
98
|
+
local actual_family=$(jq -r '.modelFamily // "N/A"' "${log_file}")
|
|
99
|
+
local actual_effort=$(jq -r '.reasoning.effort // "N/A"' "${log_file}")
|
|
100
|
+
local actual_summary=$(jq -r '.reasoning.summary // "N/A"' "${log_file}")
|
|
101
|
+
local actual_verbosity=$(jq -r '.body.text.verbosity // "N/A"' "${log_file}")
|
|
102
|
+
local actual_include=$(jq -r '.include[0] // "N/A"' "${log_file}")
|
|
103
|
+
|
|
104
|
+
echo " Actual: model=${actual_normalized}, family=${actual_family}, effort=${actual_effort}, summary=${actual_summary}, verbosity=${actual_verbosity}"
|
|
105
|
+
echo " Expected: model=${expected_normalized}, family=${expected_family}, effort=${expected_effort}, summary=${expected_summary}, verbosity=${expected_verbosity}"
|
|
106
|
+
|
|
107
|
+
# Verify values
|
|
108
|
+
local status="✅ PASS"
|
|
109
|
+
if [ "${actual_normalized}" != "${expected_normalized}" ] || \
|
|
110
|
+
[ "${actual_family}" != "${expected_family}" ] || \
|
|
111
|
+
[ "${actual_effort}" != "${expected_effort}" ] || \
|
|
112
|
+
[ "${actual_summary}" != "${expected_summary}" ] || \
|
|
113
|
+
[ "${actual_verbosity}" != "${expected_verbosity}" ]; then
|
|
114
|
+
status="❌ FAIL"
|
|
115
|
+
((FAILED_TESTS++))
|
|
116
|
+
echo -e "${RED} ✗ Verification failed${NC}"
|
|
117
|
+
else
|
|
118
|
+
((PASSED_TESTS++))
|
|
119
|
+
echo -e "${GREEN} ✓ Verification passed${NC}"
|
|
120
|
+
fi
|
|
121
|
+
|
|
122
|
+
# Add to results
|
|
123
|
+
echo "| ${model_name} | ${actual_normalized} | ${actual_family} | ${actual_effort} | ${actual_summary} | ${actual_verbosity} | ${actual_include} | ${status} |" >> "${RESULTS_FILE}"
|
|
124
|
+
|
|
125
|
+
# Cleanup
|
|
126
|
+
rm -f "${REPO_DIR}/test-${TOTAL_TESTS}.txt"
|
|
127
|
+
|
|
128
|
+
echo ""
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# Function: Update opencode.json with config
|
|
132
|
+
update_config() {
|
|
133
|
+
local config_type="$1"
|
|
134
|
+
|
|
135
|
+
echo -e "${BLUE}─────────────────────────────────────────────────────────────────${NC}"
|
|
136
|
+
echo -e "${BLUE}Scenario: ${config_type}${NC}"
|
|
137
|
+
echo -e "${BLUE}─────────────────────────────────────────────────────────────────${NC}"
|
|
138
|
+
echo ""
|
|
139
|
+
|
|
140
|
+
case "${config_type}" in
|
|
141
|
+
"legacy")
|
|
142
|
+
cat "${REPO_DIR}/config/opencode-legacy.json" > "${OPENCODE_JSON}"
|
|
143
|
+
echo "✓ Updated opencode.json with legacy config (GPT 5.x)"
|
|
144
|
+
;;
|
|
145
|
+
"minimal")
|
|
146
|
+
cat "${REPO_DIR}/config/minimal-opencode.json" > "${OPENCODE_JSON}"
|
|
147
|
+
echo "✓ Updated opencode.json with minimal config"
|
|
148
|
+
;;
|
|
149
|
+
esac
|
|
150
|
+
|
|
151
|
+
# Replace npm package with local dist for testing
|
|
152
152
|
sed -i.bak -E 's|"opencode-openai-codex-auth-multi(@[^"]*)?"|"file://'"${REPO_DIR}"'/dist"|' "${OPENCODE_JSON}"
|
|
153
153
|
|
|
154
|
-
rm -f "${OPENCODE_JSON}.bak"
|
|
155
|
-
echo "✓ Using local dist for plugin"
|
|
156
|
-
|
|
157
|
-
echo ""
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
# ============================================================================
|
|
161
|
-
# Scenario 1: Legacy Config - GPT 5.x Model Family
|
|
162
|
-
# ============================================================================
|
|
163
|
-
update_config "legacy"
|
|
164
|
-
|
|
165
|
-
# GPT 5.1 Codex presets
|
|
166
|
-
test_model "gpt-5.1-codex-low" "gpt-5.1-codex" "codex" "low" "auto" "medium"
|
|
167
|
-
test_model "gpt-5.1-codex-medium" "gpt-5.1-codex" "codex" "medium" "auto" "medium"
|
|
168
|
-
test_model "gpt-5.1-codex-high" "gpt-5.1-codex" "codex" "high" "detailed" "medium"
|
|
169
|
-
test_model "gpt-5.1-codex-max-low" "gpt-5.1-codex-max" "codex-max" "low" "detailed" "medium"
|
|
170
|
-
test_model "gpt-5.1-codex-max-medium" "gpt-5.1-codex-max" "codex-max" "medium" "detailed" "medium"
|
|
171
|
-
test_model "gpt-5.1-codex-max-high" "gpt-5.1-codex-max" "codex-max" "high" "detailed" "medium"
|
|
172
|
-
test_model "gpt-5.1-codex-max-xhigh" "gpt-5.1-codex-max" "codex-max" "xhigh" "detailed" "medium"
|
|
173
|
-
|
|
174
|
-
# GPT 5.2 presets (supports none/low/medium/high/xhigh per OpenAI API docs)
|
|
175
|
-
test_model "gpt-5.2-none" "gpt-5.2" "gpt-5.2" "none" "auto" "medium"
|
|
176
|
-
test_model "gpt-5.2-low" "gpt-5.2" "gpt-5.2" "low" "auto" "medium"
|
|
177
|
-
test_model "gpt-5.2-medium" "gpt-5.2" "gpt-5.2" "medium" "auto" "medium"
|
|
178
|
-
test_model "gpt-5.2-high" "gpt-5.2" "gpt-5.2" "high" "detailed" "medium"
|
|
179
|
-
test_model "gpt-5.2-xhigh" "gpt-5.2" "gpt-5.2" "xhigh" "detailed" "medium"
|
|
180
|
-
|
|
181
|
-
# GPT 5.2 Codex presets
|
|
182
|
-
test_model "gpt-5.2-codex-low" "gpt-5.2-codex" "gpt-5.2-codex" "low" "auto" "medium"
|
|
183
|
-
test_model "gpt-5.2-codex-medium" "gpt-5.2-codex" "gpt-5.2-codex" "medium" "auto" "medium"
|
|
184
|
-
test_model "gpt-5.2-codex-high" "gpt-5.2-codex" "gpt-5.2-codex" "high" "detailed" "medium"
|
|
185
|
-
test_model "gpt-5.2-codex-xhigh" "gpt-5.2-codex" "gpt-5.2-codex" "xhigh" "detailed" "medium"
|
|
186
|
-
|
|
187
|
-
# GPT 5.1 Codex Mini presets (medium/high only)
|
|
188
|
-
test_model "gpt-5.1-codex-mini-medium" "gpt-5.1-codex-mini" "codex" "medium" "auto" "medium"
|
|
189
|
-
test_model "gpt-5.1-codex-mini-high" "gpt-5.1-codex-mini" "codex" "high" "detailed" "medium"
|
|
190
|
-
|
|
191
|
-
# GPT 5.1 general-purpose presets (supports none/low/medium/high per OpenAI API docs)
|
|
192
|
-
test_model "gpt-5.1-none" "gpt-5.1" "gpt-5.1" "none" "auto" "medium"
|
|
193
|
-
test_model "gpt-5.1-low" "gpt-5.1" "gpt-5.1" "low" "auto" "low"
|
|
194
|
-
test_model "gpt-5.1-medium" "gpt-5.1" "gpt-5.1" "medium" "auto" "medium"
|
|
195
|
-
test_model "gpt-5.1-high" "gpt-5.1" "gpt-5.1" "high" "detailed" "high"
|
|
196
|
-
|
|
197
|
-
# # ============================================================================
|
|
198
|
-
# # Scenario 2: Minimal Config - Default Models (No Custom Config)
|
|
199
|
-
# # ============================================================================
|
|
200
|
-
# update_config "minimal"
|
|
201
|
-
|
|
202
|
-
# test_model "gpt-5" "gpt-5" "medium" "auto" "medium"
|
|
203
|
-
# test_model "gpt-5-codex" "gpt-5-codex" "medium" "auto" "medium"
|
|
204
|
-
# test_model "gpt-5-mini" "gpt-5" "minimal" "auto" "medium"
|
|
205
|
-
# test_model "gpt-5-nano" "gpt-5" "minimal" "auto" "medium"
|
|
206
|
-
|
|
207
|
-
# ============================================================================
|
|
208
|
-
# Scenario 3: Backwards Compatibility
|
|
209
|
-
# ============================================================================
|
|
210
|
-
# update_config "backwards-compat"
|
|
211
|
-
|
|
212
|
-
# # GPT 5 Codex presets
|
|
213
|
-
# test_model "gpt-5-codex-low" "gpt-5-codex" "low" "auto" "medium"
|
|
214
|
-
# test_model "gpt-5-codex-medium" "gpt-5-codex" "medium" "auto" "medium"
|
|
215
|
-
# test_model "gpt-5-codex-high" "gpt-5-codex" "high" "detailed" "medium"
|
|
216
|
-
|
|
217
|
-
# GPT 5 Codex Mini presets
|
|
218
|
-
# test_model "gpt-5-codex-mini" "codex-mini-latest" "medium" "auto" "medium"
|
|
219
|
-
# test_model "gpt-5-codex-mini-medium" "codex-mini-latest" "medium" "auto" "medium"
|
|
220
|
-
# test_model "gpt-5-codex-mini-high" "codex-mini-latest" "high" "detailed" "medium"
|
|
221
|
-
|
|
222
|
-
# GPT 5 general-purpose presets
|
|
223
|
-
# test_model "gpt-5" "gpt-5" "medium" "auto" "medium"
|
|
224
|
-
# test_model "gpt-5-medium" "gpt-5" "medium" "auto" "medium"
|
|
225
|
-
# test_model "gpt-5-high" "gpt-5" "high" "detailed" "high"
|
|
226
|
-
# test_model "gpt-5-mini" "gpt-5" "minimal" "auto" "medium"
|
|
227
|
-
|
|
228
|
-
# ============================================================================
|
|
229
|
-
# Summary
|
|
230
|
-
# ============================================================================
|
|
231
|
-
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
232
|
-
echo -e "${BLUE} Test Results Summary${NC}"
|
|
233
|
-
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
234
|
-
echo ""
|
|
235
|
-
echo -e "Total Tests: ${TOTAL_TESTS}"
|
|
236
|
-
echo -e "${GREEN}Passed: ${PASSED_TESTS}${NC}"
|
|
237
|
-
if [ ${FAILED_TESTS} -gt 0 ]; then
|
|
238
|
-
echo -e "${RED}Failed: ${FAILED_TESTS}${NC}"
|
|
239
|
-
else
|
|
240
|
-
echo -e "Failed: ${FAILED_TESTS}"
|
|
241
|
-
fi
|
|
242
|
-
echo ""
|
|
243
|
-
echo -e "Results saved to: ${RESULTS_FILE} (will be removed)"
|
|
244
|
-
echo ""
|
|
245
|
-
|
|
246
|
-
# Restore original config
|
|
247
|
-
if [ -f "${REPO_DIR}/config/opencode-legacy.json" ]; then
|
|
248
|
-
cat "${REPO_DIR}/config/opencode-legacy.json" > "${OPENCODE_JSON}"
|
|
249
|
-
echo "✓ Restored original legacy config to opencode.json"
|
|
250
|
-
fi
|
|
251
|
-
|
|
252
|
-
# Cleanup results file to avoid polluting the repo
|
|
253
|
-
rm -f "${RESULTS_FILE}"
|
|
254
|
-
|
|
255
|
-
# Exit with appropriate code
|
|
256
|
-
if [ ${FAILED_TESTS} -gt 0 ]; then
|
|
257
|
-
exit 1
|
|
258
|
-
else
|
|
259
|
-
exit 0
|
|
260
|
-
fi
|
|
154
|
+
rm -f "${OPENCODE_JSON}.bak"
|
|
155
|
+
echo "✓ Using local dist for plugin"
|
|
156
|
+
|
|
157
|
+
echo ""
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
# ============================================================================
|
|
161
|
+
# Scenario 1: Legacy Config - GPT 5.x Model Family
|
|
162
|
+
# ============================================================================
|
|
163
|
+
update_config "legacy"
|
|
164
|
+
|
|
165
|
+
# GPT 5.1 Codex presets
|
|
166
|
+
test_model "gpt-5.1-codex-low" "gpt-5.1-codex" "codex" "low" "auto" "medium"
|
|
167
|
+
test_model "gpt-5.1-codex-medium" "gpt-5.1-codex" "codex" "medium" "auto" "medium"
|
|
168
|
+
test_model "gpt-5.1-codex-high" "gpt-5.1-codex" "codex" "high" "detailed" "medium"
|
|
169
|
+
test_model "gpt-5.1-codex-max-low" "gpt-5.1-codex-max" "codex-max" "low" "detailed" "medium"
|
|
170
|
+
test_model "gpt-5.1-codex-max-medium" "gpt-5.1-codex-max" "codex-max" "medium" "detailed" "medium"
|
|
171
|
+
test_model "gpt-5.1-codex-max-high" "gpt-5.1-codex-max" "codex-max" "high" "detailed" "medium"
|
|
172
|
+
test_model "gpt-5.1-codex-max-xhigh" "gpt-5.1-codex-max" "codex-max" "xhigh" "detailed" "medium"
|
|
173
|
+
|
|
174
|
+
# GPT 5.2 presets (supports none/low/medium/high/xhigh per OpenAI API docs)
|
|
175
|
+
test_model "gpt-5.2-none" "gpt-5.2" "gpt-5.2" "none" "auto" "medium"
|
|
176
|
+
test_model "gpt-5.2-low" "gpt-5.2" "gpt-5.2" "low" "auto" "medium"
|
|
177
|
+
test_model "gpt-5.2-medium" "gpt-5.2" "gpt-5.2" "medium" "auto" "medium"
|
|
178
|
+
test_model "gpt-5.2-high" "gpt-5.2" "gpt-5.2" "high" "detailed" "medium"
|
|
179
|
+
test_model "gpt-5.2-xhigh" "gpt-5.2" "gpt-5.2" "xhigh" "detailed" "medium"
|
|
180
|
+
|
|
181
|
+
# GPT 5.2 Codex presets
|
|
182
|
+
test_model "gpt-5.2-codex-low" "gpt-5.2-codex" "gpt-5.2-codex" "low" "auto" "medium"
|
|
183
|
+
test_model "gpt-5.2-codex-medium" "gpt-5.2-codex" "gpt-5.2-codex" "medium" "auto" "medium"
|
|
184
|
+
test_model "gpt-5.2-codex-high" "gpt-5.2-codex" "gpt-5.2-codex" "high" "detailed" "medium"
|
|
185
|
+
test_model "gpt-5.2-codex-xhigh" "gpt-5.2-codex" "gpt-5.2-codex" "xhigh" "detailed" "medium"
|
|
186
|
+
|
|
187
|
+
# GPT 5.1 Codex Mini presets (medium/high only)
|
|
188
|
+
test_model "gpt-5.1-codex-mini-medium" "gpt-5.1-codex-mini" "codex" "medium" "auto" "medium"
|
|
189
|
+
test_model "gpt-5.1-codex-mini-high" "gpt-5.1-codex-mini" "codex" "high" "detailed" "medium"
|
|
190
|
+
|
|
191
|
+
# GPT 5.1 general-purpose presets (supports none/low/medium/high per OpenAI API docs)
|
|
192
|
+
test_model "gpt-5.1-none" "gpt-5.1" "gpt-5.1" "none" "auto" "medium"
|
|
193
|
+
test_model "gpt-5.1-low" "gpt-5.1" "gpt-5.1" "low" "auto" "low"
|
|
194
|
+
test_model "gpt-5.1-medium" "gpt-5.1" "gpt-5.1" "medium" "auto" "medium"
|
|
195
|
+
test_model "gpt-5.1-high" "gpt-5.1" "gpt-5.1" "high" "detailed" "high"
|
|
196
|
+
|
|
197
|
+
# # ============================================================================
|
|
198
|
+
# # Scenario 2: Minimal Config - Default Models (No Custom Config)
|
|
199
|
+
# # ============================================================================
|
|
200
|
+
# update_config "minimal"
|
|
201
|
+
|
|
202
|
+
# test_model "gpt-5" "gpt-5" "medium" "auto" "medium"
|
|
203
|
+
# test_model "gpt-5-codex" "gpt-5-codex" "medium" "auto" "medium"
|
|
204
|
+
# test_model "gpt-5-mini" "gpt-5" "minimal" "auto" "medium"
|
|
205
|
+
# test_model "gpt-5-nano" "gpt-5" "minimal" "auto" "medium"
|
|
206
|
+
|
|
207
|
+
# ============================================================================
|
|
208
|
+
# Scenario 3: Backwards Compatibility
|
|
209
|
+
# ============================================================================
|
|
210
|
+
# update_config "backwards-compat"
|
|
211
|
+
|
|
212
|
+
# # GPT 5 Codex presets
|
|
213
|
+
# test_model "gpt-5-codex-low" "gpt-5-codex" "low" "auto" "medium"
|
|
214
|
+
# test_model "gpt-5-codex-medium" "gpt-5-codex" "medium" "auto" "medium"
|
|
215
|
+
# test_model "gpt-5-codex-high" "gpt-5-codex" "high" "detailed" "medium"
|
|
216
|
+
|
|
217
|
+
# GPT 5 Codex Mini presets
|
|
218
|
+
# test_model "gpt-5-codex-mini" "codex-mini-latest" "medium" "auto" "medium"
|
|
219
|
+
# test_model "gpt-5-codex-mini-medium" "codex-mini-latest" "medium" "auto" "medium"
|
|
220
|
+
# test_model "gpt-5-codex-mini-high" "codex-mini-latest" "high" "detailed" "medium"
|
|
221
|
+
|
|
222
|
+
# GPT 5 general-purpose presets
|
|
223
|
+
# test_model "gpt-5" "gpt-5" "medium" "auto" "medium"
|
|
224
|
+
# test_model "gpt-5-medium" "gpt-5" "medium" "auto" "medium"
|
|
225
|
+
# test_model "gpt-5-high" "gpt-5" "high" "detailed" "high"
|
|
226
|
+
# test_model "gpt-5-mini" "gpt-5" "minimal" "auto" "medium"
|
|
227
|
+
|
|
228
|
+
# ============================================================================
|
|
229
|
+
# Summary
|
|
230
|
+
# ============================================================================
|
|
231
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
232
|
+
echo -e "${BLUE} Test Results Summary${NC}"
|
|
233
|
+
echo -e "${BLUE}════════════════════════════════════════════════════════════════${NC}"
|
|
234
|
+
echo ""
|
|
235
|
+
echo -e "Total Tests: ${TOTAL_TESTS}"
|
|
236
|
+
echo -e "${GREEN}Passed: ${PASSED_TESTS}${NC}"
|
|
237
|
+
if [ ${FAILED_TESTS} -gt 0 ]; then
|
|
238
|
+
echo -e "${RED}Failed: ${FAILED_TESTS}${NC}"
|
|
239
|
+
else
|
|
240
|
+
echo -e "Failed: ${FAILED_TESTS}"
|
|
241
|
+
fi
|
|
242
|
+
echo ""
|
|
243
|
+
echo -e "Results saved to: ${RESULTS_FILE} (will be removed)"
|
|
244
|
+
echo ""
|
|
245
|
+
|
|
246
|
+
# Restore original config
|
|
247
|
+
if [ -f "${REPO_DIR}/config/opencode-legacy.json" ]; then
|
|
248
|
+
cat "${REPO_DIR}/config/opencode-legacy.json" > "${OPENCODE_JSON}"
|
|
249
|
+
echo "✓ Restored original legacy config to opencode.json"
|
|
250
|
+
fi
|
|
251
|
+
|
|
252
|
+
# Cleanup results file to avoid polluting the repo
|
|
253
|
+
rm -f "${RESULTS_FILE}"
|
|
254
|
+
|
|
255
|
+
# Exit with appropriate code
|
|
256
|
+
if [ ${FAILED_TESTS} -gt 0 ]; then
|
|
257
|
+
exit 1
|
|
258
|
+
else
|
|
259
|
+
exit 0
|
|
260
|
+
fi
|