@chatpanel/gateway 0.6.93 → 0.6.94

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/gateway",
3
- "version": "0.6.93",
3
+ "version": "0.6.94",
4
4
  "description": "Local privacy gateway — redacts PII out of OpenAI/Anthropic API traffic before it reaches a model, then restores it in the reply. Point opencode, codex, aider, Claude Code, etc. at it.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/server.js CHANGED
@@ -63,7 +63,7 @@ import * as openai from './openai.js';
63
63
  import * as responses from './responses.js';
64
64
  import * as anthropic from './anthropic.js';
65
65
 
66
- export const VERSION = '0.6.93';
66
+ export const VERSION = '0.6.94';
67
67
 
68
68
  // WARM search tier — SQLite + FTS5 record store (falls back to an encrypted-JSON
69
69
  // store if SQLite can't load), fed by the extension's ingest sync + backup-ingest.
package/src/service.js CHANGED
@@ -81,6 +81,19 @@ const WIN_RUN_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
81
81
  const WIN_RUN_NAME = 'ChatPanelGateway';
82
82
  const winVbs = () => path.join(os.homedir(), '.chatpanel', 'gateway-launch.vbs');
83
83
 
84
+ /**
85
+ * Stop every running gateway process — the exe, the npm build under node, and the embedded
86
+ * bridge child (`--bridge`) — except this one. Matched on the command line, because on the
87
+ * npm path the process is `node.exe` and `taskkill /IM chatpanel-gateway.exe` never saw it.
88
+ * launchd restarts the macOS service for us; Windows has no supervisor, so `--install` after an
89
+ * update used to launch a second instance that died on the busy port while the OLD build kept
90
+ * answering /health with its old version.
91
+ */
92
+ function winStopRunning() {
93
+ const ps = `Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -match 'chatpanel-gateway' -and $_.ProcessId -ne ${process.pid} } | ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }`;
94
+ run('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', ps], { timeout: 15000 });
95
+ run('taskkill', ['/IM', 'chatpanel-gateway.exe', '/F']); // belt and braces for the exe
96
+ }
84
97
  function winInstall() {
85
98
  const { program, args } = resolveLaunch();
86
99
  const parts = [program, ...args].map((p) => `""${p}""`).join(' ');
@@ -89,11 +102,14 @@ function winInstall() {
89
102
  writeFileSync(vbs, `CreateObject("WScript.Shell").Run "${parts}", 0, False\r\n`);
90
103
  const r = run('reg', ['add', WIN_RUN_KEY, '/v', WIN_RUN_NAME, '/t', 'REG_SZ', '/d', `wscript.exe "${vbs}"`, '/f']);
91
104
  if (r.status !== 0) throw new Error((r.stderr || '').trim() || 'reg add failed');
105
+ winStopRunning();
106
+ // Give the port a moment to be released before the new instance binds it.
107
+ run('powershell.exe', ['-NoProfile', '-NonInteractive', '-Command', 'Start-Sleep -Milliseconds 800']);
92
108
  run('wscript.exe', [vbs]);
93
109
  }
94
110
  function winUninstall() {
95
111
  run('reg', ['delete', WIN_RUN_KEY, '/v', WIN_RUN_NAME, '/f']);
96
- run('taskkill', ['/IM', 'chatpanel-gateway.exe', '/F']);
112
+ winStopRunning();
97
113
  }
98
114
  function winStatus() {
99
115
  return run('reg', ['query', WIN_RUN_KEY, '/v', WIN_RUN_NAME]).status === 0;