squeezr-ai 1.16.20 → 1.16.23

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.
Files changed (2) hide show
  1. package/bin/squeezr.js +9 -49
  2. package/package.json +1 -1
package/bin/squeezr.js CHANGED
@@ -89,24 +89,6 @@ function getPort() {
89
89
  return process.env.SQUEEZR_PORT || getPortFromToml() || 8080
90
90
  }
91
91
 
92
- /**
93
- * Print a PowerShell/bash one-liner to refresh env vars in the current session.
94
- * Copies it to the clipboard on Windows so the user can just Ctrl+V, Enter.
95
- */
96
- function printEnvRefreshHint(port, mitmPort) {
97
- const bundlePath = path.join(os.homedir(), '.squeezr', 'mitm-ca', 'bundle.crt')
98
- if (process.platform === 'win32') {
99
- const cmd = `$env:ANTHROPIC_BASE_URL="http://localhost:${port}"; $env:GEMINI_API_BASE_URL="http://localhost:${port}"; $env:HTTPS_PROXY="http://localhost:${mitmPort}"`
100
- try { execSync(`powershell -NoProfile -Command "Set-Clipboard '${cmd.replace(/'/g, "''")}';"`, { stdio: 'pipe' }) } catch {}
101
- console.log(`\n Run this to activate in the current terminal (already copied to clipboard):\n`)
102
- console.log(` ${cmd}\n`)
103
- } else if (isWSL()) {
104
- const cmd = `export ANTHROPIC_BASE_URL=http://localhost:${port} GEMINI_API_BASE_URL=http://localhost:${port} HTTPS_PROXY=http://localhost:${mitmPort} SSL_CERT_FILE=${bundlePath}`
105
- console.log(`\n Run this to activate in the current terminal:\n`)
106
- console.log(` ${cmd}\n`)
107
- }
108
- }
109
-
110
92
  /**
111
93
  * Install/update shell wrapper functions so env vars are auto-refreshed
112
94
  * after squeezr start/setup/update (child processes can't modify parent env).
@@ -180,14 +162,11 @@ function installPowerShellWrapper() {
180
162
  'function squeezr {',
181
163
  ' & squeezr.cmd @args',
182
164
  " if ($args[0] -match '^(start|setup|update)$') {",
183
- " @('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','HTTPS_PROXY','NODE_EXTRA_CA_CERTS') | ForEach-Object {",
165
+ " @('ANTHROPIC_BASE_URL','GEMINI_API_BASE_URL','NODE_EXTRA_CA_CERTS') | ForEach-Object {",
184
166
  " $v = [Environment]::GetEnvironmentVariable($_, 'User')",
185
167
  " if ($v) { [Environment]::SetEnvironmentVariable($_, $v, 'Process') }",
186
168
  ' }',
187
169
  ' }',
188
- " if ($args[0] -eq 'stop') {",
189
- " [Environment]::SetEnvironmentVariable('HTTPS_PROXY', $null, 'Process')",
190
- ' }',
191
170
  '}',
192
171
  '# end squeezr wrapper',
193
172
  ].join('\n')
@@ -300,16 +279,6 @@ async function startDaemon() {
300
279
  console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
301
280
  console.log(` Logs: ${logFile}`)
302
281
 
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
- printEnvRefreshHint(port, mitmPort)
313
282
  }
314
283
 
315
284
  function showLogs() {
@@ -487,7 +456,6 @@ async function configurePorts() {
487
456
  try { execSync(`setx SQUEEZR_MITM_PORT "${finalMitm}"`, { stdio: 'pipe' }) } catch {}
488
457
  try { execSync(`setx ANTHROPIC_BASE_URL "http://localhost:${finalPort}"`, { stdio: 'pipe' }) } catch {}
489
458
  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
459
  console.log('Environment variables updated. Restart your terminal for changes to take effect.')
492
460
  } else {
493
461
  // Update shell profiles directly
@@ -697,11 +665,13 @@ function setupWindows() {
697
665
  // openai_base_url NOT set — Codex uses WebSocket and must go via HTTPS_PROXY/MITM,
698
666
  // not through the HTTP proxy. Setting it breaks Codex's ws:// connections.
699
667
  GEMINI_API_BASE_URL: `http://localhost:${port}`,
700
- HTTPS_PROXY: `http://localhost:${mitmPort}`,
668
+ // HTTPS_PROXY intentionally NOT set globally — it routes ALL HTTPS traffic through
669
+ // the MITM proxy which breaks Claude Code, npm, and other tools. Only Codex needs it.
670
+ // Users who need Codex MITM can set it per-session: $env:HTTPS_PROXY="http://localhost:8081"
701
671
  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
672
  }
673
+ // Clean up HTTPS_PROXY from registry if set by older versions
674
+ try { execSync('reg delete "HKCU\\Environment" /v HTTPS_PROXY /f', { stdio: 'pipe' }) } catch {}
705
675
  for (const [key, value] of Object.entries(vars)) {
706
676
  try {
707
677
  execSync(`setx ${key} "${value}"`, { stdio: 'pipe' })
@@ -832,8 +802,7 @@ Done!
832
802
  squeezr status — check it's running
833
803
  squeezr gain — see token savings
834
804
  `)
835
- printEnvRefreshHint(port, mitmPort)
836
- }
805
+ }
837
806
  }
838
807
 
839
808
  function setupUnix() {
@@ -975,6 +944,7 @@ Done!
975
944
  squeezr status — check it's running
976
945
  squeezr gain — see token savings
977
946
  `)
947
+ installShellWrapper()
978
948
  }
979
949
 
980
950
  // ── WSL2 detection ───────────────────────────────────────────────────────────
@@ -1163,7 +1133,7 @@ Done!
1163
1133
  squeezr status — check it's running
1164
1134
  squeezr gain — see token savings
1165
1135
  `)
1166
- printEnvRefreshHint(setupPort, setupMitmPort)
1136
+ installShellWrapper()
1167
1137
  }
1168
1138
 
1169
1139
  // ── CLI router ────────────────────────────────────────────────────────────────
@@ -1251,18 +1221,8 @@ switch (command) {
1251
1221
  console.log(` MITM proxy (Codex): http://localhost:${startMitmPort}`)
1252
1222
  console.log(` Logs: ${logFile}`)
1253
1223
 
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
1224
  // Ensure PowerShell wrapper is installed (so env vars refresh automatically)
1264
1225
  installShellWrapper()
1265
- printEnvRefreshHint(startPort, startMitmPort)
1266
1226
  })()
1267
1227
  break
1268
1228
  case 'stop':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.16.20",
3
+ "version": "1.16.23",
4
4
  "description": "AI proxy that compresses Claude Code, Codex, Aider, Gemini CLI and Ollama context windows to save thousands of tokens per session",
5
5
  "keywords": [
6
6
  "claude",