squeezr-ai 1.14.11 → 1.14.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 +38 -30
- package/dist/config.js +4 -2
- package/package.json +2 -2
package/bin/squeezr.js
CHANGED
|
@@ -106,43 +106,49 @@ function showLogs() {
|
|
|
106
106
|
|
|
107
107
|
function stopProxy() {
|
|
108
108
|
const port = process.env.SQUEEZR_PORT || 8080
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
109
|
+
const mitmPort = Number(port) + 1
|
|
110
|
+
const ports = [port, mitmPort]
|
|
111
|
+
let killed = false
|
|
112
|
+
|
|
113
|
+
for (const p of ports) {
|
|
114
|
+
try {
|
|
115
|
+
let pids = []
|
|
116
|
+
if (process.platform === 'win32') {
|
|
117
|
+
const out = execSync(`netstat -ano | findstr ":${p} "`, { encoding: 'utf-8', stdio: 'pipe' })
|
|
118
|
+
const matches = [...out.matchAll(/LISTENING\s+(\d+)/g)]
|
|
119
|
+
pids = [...new Set(matches.map(m => m[1]))]
|
|
120
|
+
} else {
|
|
121
|
+
try {
|
|
122
|
+
const out = execSync(`lsof -ti :${p} -sTCP:LISTEN`, { encoding: 'utf-8', stdio: 'pipe' }).trim()
|
|
123
|
+
pids = out.split(/\s+/).filter(Boolean)
|
|
124
|
+
} catch {
|
|
125
|
+
try {
|
|
126
|
+
const out = execSync(`fuser ${p}/tcp 2>/dev/null`, { encoding: 'utf-8', stdio: 'pipe' }).trim()
|
|
127
|
+
pids = out.split(/\s+/).filter(Boolean)
|
|
128
|
+
} catch {}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
for (const pid of pids) {
|
|
122
132
|
try {
|
|
123
|
-
|
|
133
|
+
if (process.platform === 'win32') {
|
|
134
|
+
execSync(`taskkill /F /PID ${pid}`, { stdio: 'pipe' })
|
|
135
|
+
} else {
|
|
136
|
+
execSync(`kill -9 ${pid}`, { stdio: 'pipe' })
|
|
137
|
+
}
|
|
138
|
+
console.log(`Squeezr stopped (pid ${pid} on port ${p})`)
|
|
139
|
+
killed = true
|
|
124
140
|
} catch {}
|
|
125
141
|
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return
|
|
130
|
-
}
|
|
131
|
-
// Take only the first PID in case multiple are returned
|
|
132
|
-
pid = pid.split(/\s+/)[0]
|
|
133
|
-
if (process.platform === 'win32') {
|
|
134
|
-
execSync(`taskkill /F /PID ${pid}`, { stdio: 'pipe' })
|
|
135
|
-
} else {
|
|
136
|
-
execSync(`kill ${pid}`, { stdio: 'pipe' })
|
|
137
|
-
}
|
|
138
|
-
console.log(`Squeezr stopped (pid ${pid})`)
|
|
139
|
-
} catch {
|
|
142
|
+
} catch {}
|
|
143
|
+
}
|
|
144
|
+
if (!killed) {
|
|
140
145
|
console.log(`Squeezr is not running on port ${port}`)
|
|
141
146
|
}
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
async function checkStatus() {
|
|
145
150
|
const port = process.env.SQUEEZR_PORT || 8080
|
|
151
|
+
const mitmPort = Number(port) + 1
|
|
146
152
|
return new Promise(resolve => {
|
|
147
153
|
const req = http.get(`http://localhost:${port}/squeezr/health`, res => {
|
|
148
154
|
let data = ''
|
|
@@ -150,7 +156,9 @@ async function checkStatus() {
|
|
|
150
156
|
res.on('end', () => {
|
|
151
157
|
try {
|
|
152
158
|
const json = JSON.parse(data)
|
|
153
|
-
console.log(`Squeezr is running (v${json.version}
|
|
159
|
+
console.log(`Squeezr is running (v${json.version})`)
|
|
160
|
+
console.log(` HTTP proxy (Claude/Aider/Gemini): http://localhost:${port}`)
|
|
161
|
+
console.log(` MITM proxy (Codex): http://localhost:${mitmPort}`)
|
|
154
162
|
} catch {
|
|
155
163
|
console.log(`Squeezr is running on port ${port}`)
|
|
156
164
|
}
|
|
@@ -158,7 +166,7 @@ async function checkStatus() {
|
|
|
158
166
|
})
|
|
159
167
|
})
|
|
160
168
|
req.on('error', () => {
|
|
161
|
-
console.log(`Squeezr is NOT running
|
|
169
|
+
console.log(`Squeezr is NOT running`)
|
|
162
170
|
console.log('Start it with: squeezr start')
|
|
163
171
|
resolve(false)
|
|
164
172
|
})
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { readFileSync, existsSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
2
|
+
import { join, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
3
4
|
import { parse } from 'smol-toml';
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
4
6
|
function loadTomlFile(path) {
|
|
5
7
|
if (!existsSync(path))
|
|
6
8
|
return {};
|
|
@@ -24,7 +26,7 @@ function deepMerge(base, override) {
|
|
|
24
26
|
return result;
|
|
25
27
|
}
|
|
26
28
|
function loadToml() {
|
|
27
|
-
const globalPath = join(
|
|
29
|
+
const globalPath = join(__dirname, '..', 'squeezr.toml');
|
|
28
30
|
const localPath = join(process.cwd(), '.squeezr.toml');
|
|
29
31
|
const globalCfg = loadTomlFile(globalPath);
|
|
30
32
|
const localCfg = loadTomlFile(localPath);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squeezr-ai",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.13",
|
|
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",
|
|
@@ -55,6 +55,6 @@
|
|
|
55
55
|
"vitest": "^3.1.1"
|
|
56
56
|
},
|
|
57
57
|
"engines": {
|
|
58
|
-
"node": ">=
|
|
58
|
+
"node": ">=18"
|
|
59
59
|
}
|
|
60
60
|
}
|