webhelm 1.0.15 → 1.0.16

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/runtime/cli.mjs +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webhelm",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "description": "Agent browser automation in a visible managed Chrome with persistent JavaScript sessions",
5
5
  "type": "module",
6
6
  "bin": {
package/runtime/cli.mjs CHANGED
@@ -136,7 +136,20 @@ async function main(args = process.argv.slice(2)) {
136
136
  const login_guard=installLoginGuard({cliPath,nodePath:process.execPath,sourceMode});
137
137
  return emit({status:'ready',...repo,daemon_pid:chrome.pid,managed_chrome:chrome.managed_chrome,login_guard});
138
138
  }
139
- if (group === 'ensure') return emit(await request({op:'guard-check'}));
139
+ if (group === 'ensure') {
140
+ try { return emit(await request({op:'guard-check'})); }
141
+ catch(error) {
142
+ // An older, still-busy daemon can hold the same socket during a
143
+ // rolling source upgrade. Preserve its Sessions; never hot-swap it.
144
+ if (!String(error.message).includes('unknown op: guard-check')) throw error;
145
+ const legacy=await request({op:'ping'});
146
+ if (legacy.session_count>0)
147
+ return emit({ok:true,deferred_upgrade:true,reason:'legacy_daemon_has_active_sessions',
148
+ session_count:legacy.session_count,daemon_version:legacy.version||'unknown',
149
+ chrome_health:'not_verified'});
150
+ throw Error('Legacy WebHelm daemon lacks health guard; drain and migrate it before activating the new source Runtime');
151
+ }
152
+ }
140
153
  if (group === 'status') {
141
154
  const daemon = await ensureDaemon();
142
155
  return emit({version:daemon.version, platform_dir:PLATFORMS, root:ROOT,