squeezr-ai 1.13.1 → 1.14.0
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 +22 -0
- package/bin/squeezr.js +54 -18
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -564,8 +564,30 @@ The installer configures Squeezr to start automatically on login:
|
|
|
564
564
|
| macOS | launchd (`~/Library/LaunchAgents/com.squeezr.plist`) | Shell auto-heal |
|
|
565
565
|
| Linux | systemd user service (`~/.config/systemd/user/squeezr.service`) | Shell auto-heal |
|
|
566
566
|
| Windows | Task Scheduler (runs at login, restarts on failure) | — |
|
|
567
|
+
| Windows (robust) | **NSSM Windows Service** (auto-restart on crash) | — |
|
|
567
568
|
| **WSL2** | systemd → Task Scheduler (cascade) | Shell auto-heal |
|
|
568
569
|
|
|
570
|
+
### Windows: NSSM (recommended over Task Scheduler)
|
|
571
|
+
|
|
572
|
+
The built-in Task Scheduler setup requires admin on every reinstall and does **not** restart Squeezr if it crashes mid-session (e.g. due to `ECONNRESET`). For a more robust setup, use [NSSM](https://nssm.cc) to run Squeezr as a proper Windows service:
|
|
573
|
+
|
|
574
|
+
```powershell
|
|
575
|
+
# Install NSSM
|
|
576
|
+
winget install nssm
|
|
577
|
+
|
|
578
|
+
# Create the service (run as Administrator, adjust paths if needed)
|
|
579
|
+
$node = (where.exe node | Select-Object -First 1)
|
|
580
|
+
$script = "$(npm root -g)\squeezr-ai\bin\squeezr.js"
|
|
581
|
+
nssm install SqueezrProxy $node $script
|
|
582
|
+
nssm set SqueezrProxy AppExit Default Restart
|
|
583
|
+
nssm set SqueezrProxy AppRestartDelay 3000
|
|
584
|
+
nssm start SqueezrProxy
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
NSSM gives you: auto-start on boot, automatic restart on crash, stdout/stderr logs, and control via `services.msc`.
|
|
588
|
+
|
|
589
|
+
See [NSSM_WINDOWS_SERVICE.md](./NSSM_WINDOWS_SERVICE.md) for the full guide including log setup, troubleshooting, and uninstall steps.
|
|
590
|
+
|
|
569
591
|
### WSL2 support
|
|
570
592
|
|
|
571
593
|
`squeezr setup` detects WSL2 automatically and configures both sides:
|
package/bin/squeezr.js
CHANGED
|
@@ -204,29 +204,65 @@ function setupWindows() {
|
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// 2.
|
|
208
|
-
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
const ps = [
|
|
212
|
-
`$e = Get-ScheduledTask -TaskName '${taskName}' -ErrorAction SilentlyContinue`,
|
|
213
|
-
`if ($e) { Unregister-ScheduledTask -TaskName '${taskName}' -Confirm:$false }`,
|
|
214
|
-
`$a = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-WindowStyle Hidden -NonInteractive -Command "${nodeArg}"' -WorkingDirectory '${ROOT}'`,
|
|
215
|
-
`$t = New-ScheduledTaskTrigger -AtLogon`,
|
|
216
|
-
`$s = New-ScheduledTaskSettingsSet -ExecutionTimeLimit 0 -RestartCount 5 -RestartInterval (New-TimeSpan -Minutes 1)`,
|
|
217
|
-
`Register-ScheduledTask -TaskName '${taskName}' -Action $a -Trigger $t -Settings $s -RunLevel Highest -Force | Out-Null`,
|
|
218
|
-
].join('; ')
|
|
207
|
+
// 2. Auto-start: try NSSM (Windows service, survives crashes) → fallback to Task Scheduler
|
|
208
|
+
const logDir = path.join(os.homedir(), '.squeezr')
|
|
209
|
+
const serviceName = 'SqueezrProxy'
|
|
210
|
+
let autoStartOk = false
|
|
219
211
|
|
|
220
|
-
|
|
221
|
-
execSync(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
212
|
+
const nssmAvailable = (() => {
|
|
213
|
+
try { execSync('where nssm', { stdio: 'pipe' }); return true } catch { return false }
|
|
214
|
+
})()
|
|
215
|
+
|
|
216
|
+
if (nssmAvailable) {
|
|
217
|
+
try {
|
|
218
|
+
// Remove existing service if present (ignore errors)
|
|
219
|
+
try { execSync(`nssm stop ${serviceName}`, { stdio: 'pipe' }) } catch {}
|
|
220
|
+
try { execSync(`nssm remove ${serviceName} confirm`, { stdio: 'pipe' }) } catch {}
|
|
221
|
+
|
|
222
|
+
execSync(`nssm install ${serviceName} "${nodeExe}" "${distIndex}"`, { stdio: 'pipe' })
|
|
223
|
+
execSync(`nssm set ${serviceName} AppDirectory "${ROOT}"`, { stdio: 'pipe' })
|
|
224
|
+
execSync(`nssm set ${serviceName} AppStdout "${logDir}\\service-stdout.log"`, { stdio: 'pipe' })
|
|
225
|
+
execSync(`nssm set ${serviceName} AppStderr "${logDir}\\service-stderr.log"`, { stdio: 'pipe' })
|
|
226
|
+
execSync(`nssm set ${serviceName} AppRotateFiles 1`, { stdio: 'pipe' })
|
|
227
|
+
execSync(`nssm set ${serviceName} AppRotateSeconds 86400`, { stdio: 'pipe' })
|
|
228
|
+
execSync(`nssm set ${serviceName} AppExit Default Restart`, { stdio: 'pipe' })
|
|
229
|
+
execSync(`nssm set ${serviceName} AppRestartDelay 3000`, { stdio: 'pipe' })
|
|
230
|
+
execSync(`nssm set ${serviceName} Description "Squeezr AI token compression proxy on port 8080"`, { stdio: 'pipe' })
|
|
231
|
+
execSync(`nssm start ${serviceName}`, { stdio: 'pipe' })
|
|
232
|
+
console.log(` [ok] Auto-start registered as Windows service via NSSM (auto-restart on crash)`)
|
|
233
|
+
autoStartOk = true
|
|
234
|
+
} catch (err) {
|
|
235
|
+
const msg = err.stderr?.toString() || err.message || ''
|
|
236
|
+
if (msg.includes('Access') || msg.includes('admin') || msg.includes('5')) {
|
|
237
|
+
console.log(` [warn] NSSM requires admin — run as Administrator for service install`)
|
|
238
|
+
} else {
|
|
239
|
+
console.log(` [warn] NSSM install failed: ${msg.trim().split('\n')[0]}`)
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
if (!autoStartOk) {
|
|
245
|
+
// Fallback: Task Scheduler (no crash recovery, but no admin needed for user tasks)
|
|
246
|
+
const taskName = 'Squeezr'
|
|
247
|
+
const nodeArg = `${nodeExe} \`"${distIndex}\`"`
|
|
248
|
+
const ps = [
|
|
249
|
+
`$e = Get-ScheduledTask -TaskName '${taskName}' -ErrorAction SilentlyContinue`,
|
|
250
|
+
`if ($e) { Unregister-ScheduledTask -TaskName '${taskName}' -Confirm:$false }`,
|
|
251
|
+
`$a = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-WindowStyle Hidden -NonInteractive -Command "${nodeArg}"' -WorkingDirectory '${ROOT}'`,
|
|
252
|
+
`$t = New-ScheduledTaskTrigger -AtLogon`,
|
|
253
|
+
`$s = New-ScheduledTaskSettingsSet -ExecutionTimeLimit 0 -RestartCount 5 -RestartInterval (New-TimeSpan -Minutes 1)`,
|
|
254
|
+
`Register-ScheduledTask -TaskName '${taskName}' -Action $a -Trigger $t -Settings $s -RunLevel Highest -Force | Out-Null`,
|
|
255
|
+
].join('; ')
|
|
256
|
+
try {
|
|
257
|
+
execSync(`powershell -NoProfile -Command "${ps}"`, { stdio: 'pipe' })
|
|
258
|
+
console.log(` [ok] Auto-start registered in Task Scheduler (install NSSM for crash recovery)`)
|
|
259
|
+
} catch {
|
|
260
|
+
console.log(` [warn] Auto-start failed — install NSSM or run as admin: https://nssm.cc`)
|
|
261
|
+
}
|
|
225
262
|
}
|
|
226
263
|
|
|
227
264
|
// 3. Start Squeezr right now as a detached background process (no window)
|
|
228
265
|
// Logs go to ~/.squeezr/squeezr.log
|
|
229
|
-
const logDir = path.join(os.homedir(), '.squeezr')
|
|
230
266
|
const logFile = path.join(logDir, 'squeezr.log')
|
|
231
267
|
fs.mkdirSync(logDir, { recursive: true })
|
|
232
268
|
const logFd = fs.openSync(logFile, 'a')
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "1.
|
|
1
|
+
export declare const VERSION = "1.14.0";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '1.
|
|
1
|
+
export const VERSION = '1.14.0';
|
package/package.json
CHANGED