@chatpanel/bridge 0.2.8 → 0.2.9

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/bridge",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "type": "module",
5
5
  "description": "Local bridge that exposes the AI coding agents installed on your machine — Claude Code (Agent SDK), Codex (CLI), and Gemini CLI — to the ChatPanel Chrome extension over a localhost SSE endpoint. Bring your own agent.",
6
6
  "keywords": [
@@ -1,8 +1,11 @@
1
1
  # ChatPanel Bridge installer (Windows) - no Node.js required.
2
2
  #
3
3
  # irm https://dl.chatpanel.net/bridge/install.ps1 | iex
4
- $ErrorActionPreference = 'Stop'
5
- $ProgressPreference = 'SilentlyContinue' # IWR fallback: skip the slow progress bar
4
+ #
5
+ # Note: no `$ErrorActionPreference = 'Stop'` here, because native tools (schtasks,
6
+ # curl) write progress/notices to stderr and that would be treated as fatal. We
7
+ # check exit codes explicitly instead.
8
+ $ProgressPreference = 'SilentlyContinue'
6
9
 
7
10
  $url = 'https://dl.chatpanel.net/bridge/windows-x64.exe'
8
11
  $dir = Join-Path $env:LOCALAPPDATA 'ChatPanel'
@@ -12,28 +15,40 @@ $tmp = "$bin.new"
12
15
  Write-Host ""
13
16
  Write-Host "Installing ChatPanel Bridge" -ForegroundColor Cyan
14
17
 
15
- # Stop any running bridge + its scheduled task so the .exe isn't locked (clean
16
- # in-place upgrade, no duplicate installs).
17
- schtasks /End /TN ChatPanelBridge *> $null
18
+ # Stop any running bridge + its scheduled task for a clean in-place upgrade.
19
+ # Run schtasks inside cmd so its "not found" stderr never reaches PowerShell.
20
+ cmd /c "schtasks /End /TN ChatPanelBridge >nul 2>&1"
18
21
  Get-Process -Name 'chatpanel-bridge' -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
19
22
  Start-Sleep -Milliseconds 600
20
23
 
21
24
  New-Item -ItemType Directory -Force -Path $dir | Out-Null
22
25
 
23
26
  Write-Host " Downloading the bridge (~60 MB)..." -ForegroundColor Gray
24
- $curl = Get-Command curl.exe -ErrorAction SilentlyContinue
25
- if ($curl) {
26
- & curl.exe -fL --progress-bar -o $tmp $url # fast, with a real progress bar
27
+ $ok = $false
28
+ if (Get-Command curl.exe -ErrorAction SilentlyContinue) {
29
+ & curl.exe -fL --progress-bar -o "$tmp" "$url" # fast, real progress bar
30
+ $ok = ($LASTEXITCODE -eq 0)
27
31
  } else {
28
- Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing
32
+ try { Invoke-WebRequest -Uri $url -OutFile $tmp -UseBasicParsing; $ok = $true } catch { $ok = $false }
33
+ }
34
+ if (-not $ok -or -not (Test-Path "$tmp")) {
35
+ Write-Host "Download failed - check your connection and re-run." -ForegroundColor Red
36
+ return
29
37
  }
30
- Unblock-File -Path $tmp -ErrorAction SilentlyContinue # no SmartScreen mark-of-the-web
31
- Move-Item -Force $tmp $bin
38
+
39
+ Unblock-File -Path "$tmp" -ErrorAction SilentlyContinue # no SmartScreen mark-of-the-web
40
+ Move-Item -Force "$tmp" "$bin"
32
41
 
33
42
  Write-Host " Setting it to start at login..." -ForegroundColor Gray
34
- & $bin --install
43
+ & "$bin" --install
44
+ $installed = ($LASTEXITCODE -eq 0)
35
45
 
36
46
  Write-Host ""
37
- Write-Host "Done. ChatPanel Bridge is running and starts at login." -ForegroundColor Green
38
- Write-Host "Open the ChatPanel side panel - your agents appear automatically."
47
+ if ($installed) {
48
+ Write-Host "Done. ChatPanel Bridge is running and starts at login." -ForegroundColor Green
49
+ Write-Host "Open the ChatPanel side panel - your agents appear automatically."
50
+ } else {
51
+ Write-Host "Installed, but auto-start setup hit an issue. Start it manually with:" -ForegroundColor Yellow
52
+ Write-Host " `"$bin`""
53
+ }
39
54
  Write-Host "Manage it: `"$bin`" --status | --uninstall"
package/src/server.js CHANGED
@@ -22,7 +22,7 @@ import * as gemini from './engines/gemini.js';
22
22
  import { installService, uninstallService, serviceStatus } from './service.js';
23
23
  import { enrichPath, findAgentBin } from './env.js';
24
24
 
25
- const VERSION = '0.2.8';
25
+ const VERSION = '0.2.9';
26
26
  const HOST = process.env.CHATPANEL_BRIDGE_HOST || '127.0.0.1';
27
27
  const PORT = Number(process.env.CHATPANEL_BRIDGE_PORT) || 4319;
28
28
 
package/src/service.js CHANGED
@@ -79,20 +79,30 @@ function macStatus() {
79
79
  }
80
80
 
81
81
  // ---------------------------------------------------------------- Windows
82
- const WIN_TASK = 'ChatPanelBridge';
82
+ // Per-user auto-start via the HKCU Run key — works without admin (a scheduled
83
+ // task can be blocked by policy: "Access is denied"). A tiny .vbs launcher runs
84
+ // the bridge with NO console window.
85
+ const WIN_RUN_KEY = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run';
86
+ const WIN_RUN_NAME = 'ChatPanelBridge';
87
+ const winVbs = () => path.join(path.dirname(resolveLaunch().program), 'launch.vbs');
83
88
 
84
89
  function winInstall() {
85
90
  const { program, args } = resolveLaunch();
86
- const tr = [`"${program}"`, ...args.map((a) => `"${a}"`)].join(' ');
87
- const r = run('schtasks', ['/Create', '/TN', WIN_TASK, '/TR', tr, '/SC', 'ONLOGON', '/RL', 'LIMITED', '/F']);
88
- if (r.status !== 0) throw new Error((r.stderr || '').trim() || 'schtasks create failed');
89
- run('schtasks', ['/Run', '/TN', WIN_TASK]); // start now
91
+ // VBS quoting: "" is a literal quote inside a string. Run(cmd, 0=hidden, False).
92
+ const parts = [program, ...args].map((p) => `""${p}""`).join(' ');
93
+ const vbs = winVbs();
94
+ mkdirSync(path.dirname(vbs), { recursive: true });
95
+ writeFileSync(vbs, `CreateObject("WScript.Shell").Run "${parts}", 0, False\r\n`);
96
+ const r = run('reg', ['add', WIN_RUN_KEY, '/v', WIN_RUN_NAME, '/t', 'REG_SZ', '/d', `wscript.exe "${vbs}"`, '/f']);
97
+ if (r.status !== 0) throw new Error((r.stderr || '').trim() || 'reg add failed');
98
+ run('wscript.exe', [vbs]); // start now, hidden
90
99
  }
91
100
  function winUninstall() {
92
- run('schtasks', ['/Delete', '/TN', WIN_TASK, '/F']);
101
+ run('reg', ['delete', WIN_RUN_KEY, '/v', WIN_RUN_NAME, '/f']);
102
+ run('taskkill', ['/IM', 'chatpanel-bridge.exe', '/F']);
93
103
  }
94
104
  function winStatus() {
95
- return run('schtasks', ['/Query', '/TN', WIN_TASK]).status === 0;
105
+ return run('reg', ['query', WIN_RUN_KEY, '/v', WIN_RUN_NAME]).status === 0;
96
106
  }
97
107
 
98
108
  // ---------------------------------------------------------------- Linux (systemd user)