squeezr-ai 1.16.24 → 1.17.1
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/README.md +5 -6
- package/bin/squeezr.js +32 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -23,13 +23,12 @@ squeezr setup # configures env vars, auto-start, and CA trust
|
|
|
23
23
|
squeezr start
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
> **WSL users:** After `squeezr setup` or `squeezr update`, close the terminal and open a new one so the environment variables take effect.
|
|
27
|
-
|
|
28
26
|
`squeezr setup` handles everything automatically:
|
|
29
|
-
- Sets `ANTHROPIC_BASE_URL`, `GEMINI_API_BASE_URL`, `
|
|
27
|
+
- Sets `ANTHROPIC_BASE_URL`, `GEMINI_API_BASE_URL`, `NODE_EXTRA_CA_CERTS`
|
|
28
|
+
- Installs a shell wrapper (PowerShell on Windows, bash/zsh on Linux/macOS/WSL) that auto-refreshes env vars after `squeezr start/setup/update` — no need to restart the terminal
|
|
30
29
|
- Registers auto-start (launchd on macOS, systemd on Linux, Task Scheduler/NSSM on Windows)
|
|
31
30
|
- **Windows:** imports the MITM CA into the Windows Certificate Store (user-level, no admin required) so Rust-based CLIs like Codex trust the proxy's TLS certificates
|
|
32
|
-
- **macOS/Linux:** generates a CA bundle at `~/.squeezr/mitm-ca/bundle.crt` for `SSL_CERT_FILE`
|
|
31
|
+
- **macOS/Linux/WSL:** generates a CA bundle at `~/.squeezr/mitm-ca/bundle.crt` for `SSL_CERT_FILE`
|
|
33
32
|
|
|
34
33
|
## How it works
|
|
35
34
|
|
|
@@ -188,8 +187,8 @@ squeezr version # print version
|
|
|
188
187
|
|
|
189
188
|
## Requirements
|
|
190
189
|
|
|
191
|
-
- Node.js 18+
|
|
192
|
-
- For Codex MITM: `HTTPS_PROXY=http://localhost:8081` (set
|
|
190
|
+
- Node.js 18+ (compatible with Node.js 24)
|
|
191
|
+
- For Codex MITM: set `HTTPS_PROXY=http://localhost:8081` in the terminal where you run Codex (not set globally to avoid interfering with other tools)
|
|
193
192
|
- For local compression: [Ollama](https://ollama.ai) with `qwen2.5-coder:1.5b`
|
|
194
193
|
|
|
195
194
|
## License
|
package/bin/squeezr.js
CHANGED
|
@@ -100,7 +100,6 @@ function installShellWrapper() {
|
|
|
100
100
|
|
|
101
101
|
function installBashWrapper() {
|
|
102
102
|
const port = getPort()
|
|
103
|
-
const mitmPort = getMitmPort(port)
|
|
104
103
|
const bundlePath = path.join(os.homedir(), '.squeezr', 'mitm-ca', 'bundle.crt')
|
|
105
104
|
const marker = '# squeezr shell wrapper'
|
|
106
105
|
const endMarker = '# end squeezr shell wrapper'
|
|
@@ -111,11 +110,7 @@ squeezr() {
|
|
|
111
110
|
start|setup|update)
|
|
112
111
|
export ANTHROPIC_BASE_URL=http://localhost:${port}
|
|
113
112
|
export GEMINI_API_BASE_URL=http://localhost:${port}
|
|
114
|
-
export
|
|
115
|
-
export SSL_CERT_FILE=${bundlePath}
|
|
116
|
-
;;
|
|
117
|
-
stop)
|
|
118
|
-
unset HTTPS_PROXY
|
|
113
|
+
export NODE_EXTRA_CA_CERTS=${bundlePath}
|
|
119
114
|
;;
|
|
120
115
|
esac
|
|
121
116
|
}
|
|
@@ -469,7 +464,6 @@ async function configurePorts() {
|
|
|
469
464
|
`export SQUEEZR_MITM_PORT=${finalMitm}`,
|
|
470
465
|
`export ANTHROPIC_BASE_URL=http://localhost:${finalPort}`,
|
|
471
466
|
`export GEMINI_API_BASE_URL=http://localhost:${finalPort}`,
|
|
472
|
-
`export HTTPS_PROXY=http://localhost:${finalMitm}`,
|
|
473
467
|
].join('\n')
|
|
474
468
|
for (const p of profiles) {
|
|
475
469
|
try {
|
|
@@ -494,7 +488,6 @@ async function configurePorts() {
|
|
|
494
488
|
try { execSync(`"${setx}" SQUEEZR_MITM_PORT "${finalMitm}"`, { stdio: 'pipe' }) } catch {}
|
|
495
489
|
try { execSync(`"${setx}" ANTHROPIC_BASE_URL "http://localhost:${finalPort}"`, { stdio: 'pipe' }) } catch {}
|
|
496
490
|
try { execSync(`"${setx}" GEMINI_API_BASE_URL "http://localhost:${finalPort}"`, { stdio: 'pipe' }) } catch {}
|
|
497
|
-
try { execSync(`"${setx}" HTTPS_PROXY "http://localhost:${finalMitm}"`, { stdio: 'pipe' }) } catch {}
|
|
498
491
|
}
|
|
499
492
|
} catch {}
|
|
500
493
|
}
|
|
@@ -503,7 +496,6 @@ async function configurePorts() {
|
|
|
503
496
|
process.env.SQUEEZR_PORT = String(finalPort)
|
|
504
497
|
process.env.SQUEEZR_MITM_PORT = String(finalMitm)
|
|
505
498
|
process.env.ANTHROPIC_BASE_URL = `http://localhost:${finalPort}`
|
|
506
|
-
process.env.HTTPS_PROXY = `http://localhost:${finalMitm}`
|
|
507
499
|
|
|
508
500
|
// Auto stop + start
|
|
509
501
|
console.log('')
|
|
@@ -822,9 +814,10 @@ function setupUnix() {
|
|
|
822
814
|
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
823
815
|
`export openai_base_url=http://localhost:${port}`,
|
|
824
816
|
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
817
|
+
`export NODE_EXTRA_CA_CERTS=${bundlePath}`,
|
|
818
|
+
`# NOTE: HTTPS_PROXY is intentionally NOT set globally — it would route ALL HTTPS`,
|
|
819
|
+
`# (including Claude Code) through the MITM proxy and cause 502 errors.`,
|
|
820
|
+
`# For Codex, set it per-session only: HTTPS_PROXY=http://localhost:${mitmPort} codex`,
|
|
828
821
|
`# squeezr auto-heal: start proxy if not running`,
|
|
829
822
|
`if ! curl -sf http://localhost:${port}/squeezr/health >/dev/null 2>&1; then`,
|
|
830
823
|
` nohup ${nodeExe} ${distIndex} >> "${os.homedir()}/.squeezr/squeezr.log" 2>&1 &`,
|
|
@@ -840,8 +833,7 @@ function setupUnix() {
|
|
|
840
833
|
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
841
834
|
`export openai_base_url=http://localhost:${port}`,
|
|
842
835
|
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
843
|
-
`export
|
|
844
|
-
`export SSL_CERT_FILE=${bundlePath}`,
|
|
836
|
+
`export NODE_EXTRA_CA_CERTS=${bundlePath}`,
|
|
845
837
|
].join('\n')
|
|
846
838
|
|
|
847
839
|
// Write env vars to ~/.profile (login shell — always loaded)
|
|
@@ -905,6 +897,28 @@ function setupUnix() {
|
|
|
905
897
|
spawn(nodeExe, [squeezrBin], { detached: true, stdio: 'ignore' }).unref()
|
|
906
898
|
}
|
|
907
899
|
|
|
900
|
+
// Trust MITM CA in macOS Keychain (for Codex TLS interception)
|
|
901
|
+
// CA is generated on first proxy start — wait briefly for it to appear
|
|
902
|
+
const caPath = path.join(os.homedir(), '.squeezr', 'mitm-ca', 'ca.crt')
|
|
903
|
+
const waitForCa = (retries = 10, interval = 500) => new Promise(resolve => {
|
|
904
|
+
const check = (n) => {
|
|
905
|
+
if (fs.existsSync(caPath)) return resolve(true)
|
|
906
|
+
if (n <= 0) return resolve(false)
|
|
907
|
+
setTimeout(() => check(n - 1), interval)
|
|
908
|
+
}
|
|
909
|
+
check(retries)
|
|
910
|
+
})
|
|
911
|
+
waitForCa().then(found => {
|
|
912
|
+
if (found) {
|
|
913
|
+
try {
|
|
914
|
+
execSync(`security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain-db "${caPath}" 2>/dev/null`, { stdio: 'pipe' })
|
|
915
|
+
console.log(` [ok] MITM CA trusted in macOS Keychain`)
|
|
916
|
+
} catch {
|
|
917
|
+
console.log(` [info] To trust MITM CA for Codex: security add-trusted-cert -d -r trustRoot -k ~/Library/Keychains/login.keychain-db "${caPath}"`)
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
})
|
|
921
|
+
|
|
908
922
|
// 2b. Linux — systemd
|
|
909
923
|
} else {
|
|
910
924
|
const serviceDir = path.join(os.homedir(), '.config', 'systemd', 'user')
|
|
@@ -978,8 +992,9 @@ function setupWSL() {
|
|
|
978
992
|
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
979
993
|
`export openai_base_url=http://localhost:${port}`,
|
|
980
994
|
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
981
|
-
`export
|
|
982
|
-
|
|
995
|
+
`export NODE_EXTRA_CA_CERTS=${bundlePath}`,
|
|
996
|
+
`# NOTE: HTTPS_PROXY is intentionally NOT set globally — set per-session for Codex only:`,
|
|
997
|
+
`# HTTPS_PROXY=http://localhost:${mitmPort} codex`,
|
|
983
998
|
`# squeezr auto-heal: start proxy if not running`,
|
|
984
999
|
`if ! curl -sf http://localhost:${port}/squeezr/health >/dev/null 2>&1; then`,
|
|
985
1000
|
` nohup ${nodeExe} ${distIndex} >> "${os.homedir()}/.squeezr/squeezr.log" 2>&1 &`,
|
|
@@ -994,8 +1009,7 @@ function setupWSL() {
|
|
|
994
1009
|
`export ANTHROPIC_BASE_URL=http://localhost:${port}`,
|
|
995
1010
|
`export openai_base_url=http://localhost:${port}`,
|
|
996
1011
|
`export GEMINI_API_BASE_URL=http://localhost:${port}`,
|
|
997
|
-
`export
|
|
998
|
-
`export SSL_CERT_FILE=${bundlePath}`,
|
|
1012
|
+
`export NODE_EXTRA_CA_CERTS=${bundlePath}`,
|
|
999
1013
|
].join('\n')
|
|
1000
1014
|
|
|
1001
1015
|
const profilePath = path.join(os.homedir(), '.profile')
|
package/package.json
CHANGED