squeezr-ai 1.17.11 → 1.17.13
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 +33 -23
- package/dist/codexMitm.js +29 -27
- package/package.json +1 -1
package/bin/squeezr.js
CHANGED
|
@@ -248,6 +248,7 @@ async function startDaemon() {
|
|
|
248
248
|
console.log(`Squeezr is already running (v${pkg.version})`)
|
|
249
249
|
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${port}`)
|
|
250
250
|
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
251
|
+
console.log(` Dashboard: http://localhost:${port}/squeezr/dashboard`)
|
|
251
252
|
return
|
|
252
253
|
}
|
|
253
254
|
// Version mismatch — old process from before npm update. Kill and restart.
|
|
@@ -275,6 +276,7 @@ async function startDaemon() {
|
|
|
275
276
|
console.log(`Squeezr started (pid ${child.pid})`)
|
|
276
277
|
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${port}`)
|
|
277
278
|
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
279
|
+
console.log(` Dashboard: http://localhost:${port}/squeezr/dashboard`)
|
|
278
280
|
console.log(` Logs: ${logFile}`)
|
|
279
281
|
|
|
280
282
|
}
|
|
@@ -296,6 +298,20 @@ function showLogs() {
|
|
|
296
298
|
console.log(tail.join('\n'))
|
|
297
299
|
}
|
|
298
300
|
|
|
301
|
+
function killMcpProcesses() {
|
|
302
|
+
if (process.platform === 'win32') {
|
|
303
|
+
try {
|
|
304
|
+
execSync(
|
|
305
|
+
`powershell -NoProfile -Command "Get-CimInstance Win32_Process -Filter \\"name='node.exe'\\" | Where-Object { $_.CommandLine -like '*squeezr*mcp*' -or $_.CommandLine -like '*mcp.js*' } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force }"`,
|
|
306
|
+
{ stdio: 'pipe' }
|
|
307
|
+
)
|
|
308
|
+
} catch {}
|
|
309
|
+
} else {
|
|
310
|
+
try { execSync(`pkill -f 'squeezr.*mcp' 2>/dev/null`, { stdio: 'pipe' }) } catch {}
|
|
311
|
+
try { execSync(`pkill -f 'mcp\\.js' 2>/dev/null`, { stdio: 'pipe' }) } catch {}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
299
315
|
function stopProxy() {
|
|
300
316
|
const port = getPort()
|
|
301
317
|
const mitmPort = getMitmPort(port)
|
|
@@ -332,6 +348,10 @@ function stopProxy() {
|
|
|
332
348
|
}
|
|
333
349
|
} catch {}
|
|
334
350
|
}
|
|
351
|
+
|
|
352
|
+
// Also stop the MCP server process
|
|
353
|
+
killMcpProcesses()
|
|
354
|
+
|
|
335
355
|
// Clear HTTPS_PROXY so npm and other tools don't try to use the dead proxy
|
|
336
356
|
if (process.platform === 'win32') {
|
|
337
357
|
try { execSync('setx HTTPS_PROXY ""', { stdio: 'pipe' }) } catch {}
|
|
@@ -344,8 +364,6 @@ function stopProxy() {
|
|
|
344
364
|
|
|
345
365
|
if (killed) {
|
|
346
366
|
console.log(`Squeezr stopped`)
|
|
347
|
-
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${port}`)
|
|
348
|
-
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
349
367
|
} else {
|
|
350
368
|
console.log(`Squeezr is not running`)
|
|
351
369
|
}
|
|
@@ -364,6 +382,7 @@ async function checkStatus() {
|
|
|
364
382
|
console.log(`Squeezr is running (v${json.version})`)
|
|
365
383
|
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${port}`)
|
|
366
384
|
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
385
|
+
console.log(` Dashboard: http://localhost:${port}/squeezr/dashboard`)
|
|
367
386
|
} catch {
|
|
368
387
|
console.log(`Squeezr is running on port ${port}`)
|
|
369
388
|
}
|
|
@@ -507,7 +526,8 @@ async function configurePorts() {
|
|
|
507
526
|
|
|
508
527
|
console.log(`\nCurrent ports:`)
|
|
509
528
|
console.log(` HTTP proxy (Claude/Aider/Gemini): ${currentPort}`)
|
|
510
|
-
console.log(` MITM proxy (Codex): ${currentMitm}
|
|
529
|
+
console.log(` MITM proxy (Codex): ${currentMitm}`)
|
|
530
|
+
console.log(` Dashboard: ${currentPort}/squeezr/dashboard (same port as proxy)\n`)
|
|
511
531
|
|
|
512
532
|
const newPort = await ask(`HTTP proxy port [${currentPort}]: `)
|
|
513
533
|
const newMitm = await ask(`MITM proxy port [${currentMitm}]: `)
|
|
@@ -720,7 +740,11 @@ async function uninstall() {
|
|
|
720
740
|
} catch {}
|
|
721
741
|
}
|
|
722
742
|
|
|
723
|
-
// 8.
|
|
743
|
+
// 8. Remove MCP registrations
|
|
744
|
+
console.log(' [..] Removing MCP registrations...')
|
|
745
|
+
try { await mcpUninstall() } catch {}
|
|
746
|
+
|
|
747
|
+
// 9. npm uninstall -g (clear HTTPS_PROXY first so npm doesn't hit dead proxy)
|
|
724
748
|
console.log(' [..] Uninstalling npm package...')
|
|
725
749
|
const cleanEnv = { ...process.env, HTTPS_PROXY: '', https_proxy: '', HTTP_PROXY: '', http_proxy: '' }
|
|
726
750
|
try {
|
|
@@ -1369,22 +1393,9 @@ switch (command) {
|
|
|
1369
1393
|
case 'update':
|
|
1370
1394
|
await (async () => {
|
|
1371
1395
|
console.log('Stopping Squeezr...')
|
|
1372
|
-
stopProxy()
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
const uMitmPort = getMitmPort(uPort)
|
|
1376
|
-
if (process.platform === 'win32') {
|
|
1377
|
-
try { execSync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr ":${uPort} " ^| findstr LISTENING') do taskkill /F /PID %a`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1378
|
-
try { execSync(`for /f "tokens=5" %a in ('netstat -ano ^| findstr ":${uMitmPort} " ^| findstr LISTENING') do taskkill /F /PID %a`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1379
|
-
// Kill squeezr-mcp (Claude Code MCP server) — it holds dist/mcp.js locked on Windows
|
|
1380
|
-
console.log('Releasing file locks...')
|
|
1381
|
-
try { execSync(`wmic process where "commandline like '%squeezr-ai%dist%mcp%'" call terminate`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1382
|
-
try { execSync(`wmic process where "commandline like '%-mcp.js%'" call terminate`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1383
|
-
try { execSync(`wmic process where "commandline like '%squeezr-mcp%'" call terminate`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1384
|
-
} else {
|
|
1385
|
-
try { execSync(`kill -9 $(lsof -ti:${uPort}) 2>/dev/null`, { stdio: 'pipe' }) } catch {}
|
|
1386
|
-
try { execSync(`kill -9 $(lsof -ti:${uMitmPort}) 2>/dev/null`, { stdio: 'pipe' }) } catch {}
|
|
1387
|
-
}
|
|
1396
|
+
stopProxy() // also kills MCP via killMcpProcesses()
|
|
1397
|
+
console.log('Releasing file locks...')
|
|
1398
|
+
killMcpProcesses() // double-kill in case stopProxy was too fast
|
|
1388
1399
|
await new Promise(r => setTimeout(r, 2000))
|
|
1389
1400
|
|
|
1390
1401
|
console.log('Installing latest version...')
|
|
@@ -1400,9 +1411,7 @@ switch (command) {
|
|
|
1400
1411
|
if ((msg.includes('EBUSY') || msg.includes('EPERM')) && attempt < 4) {
|
|
1401
1412
|
console.log(` Files still locked, retrying in 3s (attempt ${attempt}/4)...`)
|
|
1402
1413
|
// Try harder to release locks on retry
|
|
1403
|
-
|
|
1404
|
-
try { execSync(`wmic process where "commandline like '%squeezr-ai%'" call terminate`, { stdio: 'pipe', shell: 'cmd.exe' }) } catch {}
|
|
1405
|
-
}
|
|
1414
|
+
killMcpProcesses()
|
|
1406
1415
|
await new Promise(r => setTimeout(r, 3000))
|
|
1407
1416
|
} else if (!msg.includes('EBUSY') && !msg.includes('EPERM') && process.platform !== 'win32') {
|
|
1408
1417
|
// On Unix, try sudo as fallback (not useful on Windows)
|
|
@@ -1462,6 +1471,7 @@ switch (command) {
|
|
|
1462
1471
|
console.log(`Squeezr started (pid ${child.pid})`)
|
|
1463
1472
|
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${startPort}`)
|
|
1464
1473
|
console.log(` MITM proxy (Codex): http://localhost:${startMitmPort}`)
|
|
1474
|
+
console.log(` Dashboard: http://localhost:${startPort}/squeezr/dashboard`)
|
|
1465
1475
|
console.log(` Logs: ${logFile}`)
|
|
1466
1476
|
|
|
1467
1477
|
// Ensure PowerShell wrapper is installed (so env vars refresh automatically)
|
package/dist/codexMitm.js
CHANGED
|
@@ -16,33 +16,35 @@ export const BUNDLE_PATH = join(CA_DIR, 'bundle.crt');
|
|
|
16
16
|
export const MITM_PORT = config.mitmPort;
|
|
17
17
|
// ── CA generation ─────────────────────────────────────────────────────────────
|
|
18
18
|
function ensureCA() {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
19
|
+
const certsExist = fs.existsSync(CA_KEY_PATH) && fs.existsSync(CA_CERT_PATH);
|
|
20
|
+
if (!certsExist) {
|
|
21
|
+
fs.mkdirSync(CA_DIR, { recursive: true, mode: 0o700 });
|
|
22
|
+
const keys = forge.pki.rsa.generateKeyPair(2048);
|
|
23
|
+
const cert = forge.pki.createCertificate();
|
|
24
|
+
cert.publicKey = keys.publicKey;
|
|
25
|
+
cert.serialNumber = '01';
|
|
26
|
+
cert.validity.notBefore = new Date();
|
|
27
|
+
cert.validity.notAfter = new Date();
|
|
28
|
+
cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 10);
|
|
29
|
+
const attrs = [{ name: 'commonName', value: 'Squeezr-MITM-CA' }];
|
|
30
|
+
cert.setSubject(attrs);
|
|
31
|
+
cert.setIssuer(attrs);
|
|
32
|
+
cert.setExtensions([
|
|
33
|
+
{ name: 'basicConstraints', cA: true },
|
|
34
|
+
{ name: 'keyUsage', keyCertSign: true, cRLSign: true },
|
|
35
|
+
]);
|
|
36
|
+
cert.sign(keys.privateKey, forge.md.sha256.create());
|
|
37
|
+
fs.writeFileSync(CA_KEY_PATH, forge.pki.privateKeyToPem(keys.privateKey), { mode: 0o600 });
|
|
38
|
+
fs.writeFileSync(CA_CERT_PATH, forge.pki.certificateToPem(cert), { mode: 0o644 });
|
|
39
|
+
console.log(`[squeezr/mitm] CA generated → ${CA_CERT_PATH}`);
|
|
40
|
+
}
|
|
41
|
+
// Always regenerate bundle.crt from the CA cert only.
|
|
42
|
+
// Avoid concatenating system CA bundles — they can contain certs that
|
|
43
|
+
// BoringSSL/Node.js rejects (e.g. on WSL), causing NODE_EXTRA_CA_CERTS to fail.
|
|
44
|
+
// Node.js already trusts its own built-in root CAs, so only the squeezr CA
|
|
45
|
+
// cert is needed here.
|
|
46
|
+
const caCertPem = fs.readFileSync(CA_CERT_PATH, 'utf-8');
|
|
47
|
+
fs.writeFileSync(BUNDLE_PATH, caCertPem, { mode: 0o644 });
|
|
46
48
|
}
|
|
47
49
|
// ── Per-host cert (cached) ────────────────────────────────────────────────────
|
|
48
50
|
const certCache = new Map();
|
package/package.json
CHANGED