squeezr-ai 1.16.19 → 1.16.21
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/bin/squeezr.js +9 -29
- package/package.json +1 -1
package/bin/squeezr.js
CHANGED
|
@@ -96,7 +96,7 @@ function getPort() {
|
|
|
96
96
|
function printEnvRefreshHint(port, mitmPort) {
|
|
97
97
|
const bundlePath = path.join(os.homedir(), '.squeezr', 'mitm-ca', 'bundle.crt')
|
|
98
98
|
if (process.platform === 'win32') {
|
|
99
|
-
const cmd = `$env:ANTHROPIC_BASE_URL="http://localhost:${port}"; $env:GEMINI_API_BASE_URL="http://localhost:${port}"
|
|
99
|
+
const cmd = `$env:ANTHROPIC_BASE_URL="http://localhost:${port}"; $env:GEMINI_API_BASE_URL="http://localhost:${port}"`
|
|
100
100
|
try { execSync(`powershell -NoProfile -Command "Set-Clipboard '${cmd.replace(/'/g, "''")}';"`, { stdio: 'pipe' }) } catch {}
|
|
101
101
|
console.log(`\n Run this to activate in the current terminal (already copied to clipboard):\n`)
|
|
102
102
|
console.log(` ${cmd}\n`)
|
|
@@ -112,7 +112,7 @@ function printEnvRefreshHint(port, mitmPort) {
|
|
|
112
112
|
* after squeezr start/setup/update (child processes can't modify parent env).
|
|
113
113
|
*/
|
|
114
114
|
function installShellWrapper() {
|
|
115
|
-
if (process.platform === 'win32') return
|
|
115
|
+
if (process.platform === 'win32') return installPowerShellWrapper()
|
|
116
116
|
if (isWSL() || process.platform === 'linux' || process.platform === 'darwin') return installBashWrapper()
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -169,7 +169,7 @@ ${endMarker}`
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
function
|
|
172
|
+
function installPowerShellWrapper() {
|
|
173
173
|
try {
|
|
174
174
|
const psProfilePath = execSync('powershell -NoProfile -Command "[Environment]::GetFolderPath(\'MyDocuments\') + \'\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1\'"', { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'] }).trim()
|
|
175
175
|
const psProfileDir = path.dirname(psProfilePath)
|
|
@@ -180,14 +180,11 @@ function installShellWrapper() {
|
|
|
180
180
|
'function squeezr {',
|
|
181
181
|
' & squeezr.cmd @args',
|
|
182
182
|
" if ($args[0] -match '^(start|setup|update)$') {",
|
|
183
|
-
" @('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','
|
|
183
|
+
" @('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','NODE_EXTRA_CA_CERTS') | ForEach-Object {",
|
|
184
184
|
" $v = [Environment]::GetEnvironmentVariable($_, 'User')",
|
|
185
185
|
" if ($v) { [Environment]::SetEnvironmentVariable($_, $v, 'Process') }",
|
|
186
186
|
' }',
|
|
187
187
|
' }',
|
|
188
|
-
" if ($args[0] -eq 'stop') {",
|
|
189
|
-
" [Environment]::SetEnvironmentVariable('HTTPS_PROXY', $null, 'Process')",
|
|
190
|
-
' }',
|
|
191
188
|
'}',
|
|
192
189
|
'# end squeezr wrapper',
|
|
193
190
|
].join('\n')
|
|
@@ -300,15 +297,6 @@ async function startDaemon() {
|
|
|
300
297
|
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
301
298
|
console.log(` Logs: ${logFile}`)
|
|
302
299
|
|
|
303
|
-
// Restore HTTPS_PROXY in Windows registry now that the proxy is alive
|
|
304
|
-
if (process.platform === 'win32') {
|
|
305
|
-
try { execSync(`setx HTTPS_PROXY "http://localhost:${mitmPort}"`, { stdio: 'pipe' }) } catch {}
|
|
306
|
-
} else if (isWSL()) {
|
|
307
|
-
try {
|
|
308
|
-
const setxExe = '/mnt/c/Windows/System32/setx.exe'
|
|
309
|
-
if (fs.existsSync(setxExe)) execSync(`"${setxExe}" HTTPS_PROXY "http://localhost:${mitmPort}"`, { stdio: 'pipe' })
|
|
310
|
-
} catch {}
|
|
311
|
-
}
|
|
312
300
|
printEnvRefreshHint(port, mitmPort)
|
|
313
301
|
}
|
|
314
302
|
|
|
@@ -487,7 +475,6 @@ async function configurePorts() {
|
|
|
487
475
|
try { execSync(`setx SQUEEZR_MITM_PORT "${finalMitm}"`, { stdio: 'pipe' }) } catch {}
|
|
488
476
|
try { execSync(`setx ANTHROPIC_BASE_URL "http://localhost:${finalPort}"`, { stdio: 'pipe' }) } catch {}
|
|
489
477
|
try { execSync(`setx GEMINI_API_BASE_URL "http://localhost:${finalPort}"`, { stdio: 'pipe' }) } catch {}
|
|
490
|
-
try { execSync(`setx HTTPS_PROXY "http://localhost:${finalMitm}"`, { stdio: 'pipe' }) } catch {}
|
|
491
478
|
console.log('Environment variables updated. Restart your terminal for changes to take effect.')
|
|
492
479
|
} else {
|
|
493
480
|
// Update shell profiles directly
|
|
@@ -697,11 +684,13 @@ function setupWindows() {
|
|
|
697
684
|
// openai_base_url NOT set — Codex uses WebSocket and must go via HTTPS_PROXY/MITM,
|
|
698
685
|
// not through the HTTP proxy. Setting it breaks Codex's ws:// connections.
|
|
699
686
|
GEMINI_API_BASE_URL: `http://localhost:${port}`,
|
|
700
|
-
HTTPS_PROXY
|
|
687
|
+
// HTTPS_PROXY intentionally NOT set globally — it routes ALL HTTPS traffic through
|
|
688
|
+
// the MITM proxy which breaks Claude Code, npm, and other tools. Only Codex needs it.
|
|
689
|
+
// Users who need Codex MITM can set it per-session: $env:HTTPS_PROXY="http://localhost:8081"
|
|
701
690
|
NODE_EXTRA_CA_CERTS: caPath,
|
|
702
|
-
// NO_PROXY not needed — the MITM proxy only intercepts chatgpt.com,
|
|
703
|
-
// all other domains get a transparent TCP tunnel (no TLS termination).
|
|
704
691
|
}
|
|
692
|
+
// Clean up HTTPS_PROXY from registry if set by older versions
|
|
693
|
+
try { execSync('reg delete "HKCU\\Environment" /v HTTPS_PROXY /f', { stdio: 'pipe' }) } catch {}
|
|
705
694
|
for (const [key, value] of Object.entries(vars)) {
|
|
706
695
|
try {
|
|
707
696
|
execSync(`setx ${key} "${value}"`, { stdio: 'pipe' })
|
|
@@ -1251,15 +1240,6 @@ switch (command) {
|
|
|
1251
1240
|
console.log(` MITM proxy (Codex): http://localhost:${startMitmPort}`)
|
|
1252
1241
|
console.log(` Logs: ${logFile}`)
|
|
1253
1242
|
|
|
1254
|
-
// Restore HTTPS_PROXY now that the proxy is alive
|
|
1255
|
-
if (process.platform === 'win32') {
|
|
1256
|
-
try { execSync(`setx HTTPS_PROXY "http://localhost:${startMitmPort}"`, { stdio: 'pipe' }) } catch {}
|
|
1257
|
-
} else if (isWSL()) {
|
|
1258
|
-
try {
|
|
1259
|
-
const setxExe = '/mnt/c/Windows/System32/setx.exe'
|
|
1260
|
-
if (fs.existsSync(setxExe)) execSync(`"${setxExe}" HTTPS_PROXY "http://localhost:${startMitmPort}"`, { stdio: 'pipe' })
|
|
1261
|
-
} catch {}
|
|
1262
|
-
}
|
|
1263
1243
|
// Ensure PowerShell wrapper is installed (so env vars refresh automatically)
|
|
1264
1244
|
installShellWrapper()
|
|
1265
1245
|
printEnvRefreshHint(startPort, startMitmPort)
|
package/package.json
CHANGED