squeezr-ai 1.11.0 → 1.11.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/bin/squeezr.js CHANGED
@@ -47,6 +47,46 @@ function runNode(script, extraArgs = []) {
47
47
  child.on('exit', code => process.exit(code ?? 0))
48
48
  }
49
49
 
50
+ async function startDaemon() {
51
+ const distIndex = path.join(ROOT, 'dist', 'index.js')
52
+ if (!fs.existsSync(distIndex)) {
53
+ console.error(`Error: ${distIndex} not found. Run 'npm run build' first.`)
54
+ process.exit(1)
55
+ }
56
+
57
+ // Check if already running
58
+ const port = process.env.SQUEEZR_PORT || 8080
59
+ const running = await new Promise(resolve => {
60
+ const req = http.get(`http://localhost:${port}/squeezr/health`, res => {
61
+ resolve(res.statusCode === 200)
62
+ res.destroy()
63
+ })
64
+ req.on('error', () => resolve(false))
65
+ req.setTimeout(2000, () => { req.destroy(); resolve(false) })
66
+ })
67
+ if (running) {
68
+ console.log(`Squeezr is already running on port ${port}`)
69
+ return
70
+ }
71
+
72
+ // Launch detached background process
73
+ const logDir = path.join(os.homedir(), '.squeezr')
74
+ const logFile = path.join(logDir, 'squeezr.log')
75
+ fs.mkdirSync(logDir, { recursive: true })
76
+ const logFd = fs.openSync(logFile, 'a')
77
+ const child = spawn(process.execPath, [distIndex], {
78
+ detached: true,
79
+ stdio: ['ignore', logFd, logFd],
80
+ windowsHide: true,
81
+ cwd: ROOT,
82
+ env: { ...process.env, SQUEEZR_DAEMON: '1' },
83
+ })
84
+ child.unref()
85
+ fs.closeSync(logFd)
86
+ console.log(`Squeezr started in background (pid ${child.pid})`)
87
+ console.log(`Logs → ${logFile}`)
88
+ }
89
+
50
90
  function showLogs() {
51
91
  const logFile = path.join(os.homedir(), '.squeezr', 'squeezr.log')
52
92
  if (!fs.existsSync(logFile)) {
@@ -489,7 +529,7 @@ Done!
489
529
  switch (command) {
490
530
  case undefined:
491
531
  case 'start':
492
- runNode('index.js')
532
+ startDaemon()
493
533
  break
494
534
 
495
535
  case 'setup':
package/dist/index.js CHANGED
@@ -11,9 +11,19 @@ serve({ fetch: app.fetch, port: PORT }, () => {
11
11
  console.log(`Backends: Anthropic → Haiku | OpenAI → GPT-4o-mini | Gemini → Flash-8B | Local → ${config.localCompressionModel}`);
12
12
  console.log(`Stats: http://localhost:${PORT}/squeezr/stats`);
13
13
  });
14
- process.on('SIGINT', () => {
15
- const s = stats.summary();
16
- console.log(`\n[squeezr] Session summary: ${s.requests} requests | -${s.total_saved_chars.toLocaleString()} chars (~${s.total_saved_tokens.toLocaleString()} tokens, ${s.savings_pct}% saved)`);
17
- process.exit(0);
18
- });
14
+ const isDaemon = !!process.env.SQUEEZR_DAEMON;
15
+ if (isDaemon) {
16
+ // Daemon mode: ignore SIGINT (Ctrl+C) and SIGHUP (terminal close)
17
+ // Only stop via `squeezr stop` which sends SIGTERM
18
+ process.on('SIGINT', () => { });
19
+ process.on('SIGHUP', () => { });
20
+ }
21
+ else {
22
+ // Dev mode (npm run dev): allow Ctrl+C to stop
23
+ process.on('SIGINT', () => {
24
+ const s = stats.summary();
25
+ console.log(`\n[squeezr] Session summary: ${s.requests} requests | -${s.total_saved_chars.toLocaleString()} chars (~${s.total_saved_tokens.toLocaleString()} tokens, ${s.savings_pct}% saved)`);
26
+ process.exit(0);
27
+ });
28
+ }
19
29
  process.on('SIGTERM', () => process.exit(0));
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.11.0";
1
+ export declare const VERSION = "1.11.1";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '1.11.0';
1
+ export const VERSION = '1.11.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squeezr-ai",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
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",