@walkhi/code-relax 0.1.0-beta.66 → 0.1.0-beta.69

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.
@@ -271,7 +271,7 @@ async function main() {
271
271
  const desktopBeforeSetup = desktopHost.desktopIntegration === false ? { running: false, desktop: null } : await desktopHost.inspect();
272
272
  const runtime = await resolveCodexRuntime(physicalStateRoot, { refresh: true });
273
273
  const preserveCodex = options.includes('--preserve-codex');
274
- const desktopNeedsRestart = desktopBeforeSetup.running && !preserveCodex;
274
+ const desktopNeedsRestart = !hadInstalledService && desktopBeforeSetup.running && !preserveCodex;
275
275
  const previous = hadInstalledService ? await service.status() : { processRunning: false };
276
276
  const legacyRelaySession = readRecord(path.join(stateRoot, 'self-relay-session.json'));
277
277
  const previousRelay = legacyRelaySession ? await controlRequest(legacyRelaySession) : await selfRelay('relay-status', stateRoot);
@@ -358,7 +358,8 @@ async function main() {
358
358
  managedAppServerMigration.restarted = true;
359
359
  }
360
360
  const skill = installSkill(path.join(serviceRoot, 'dist/skills/code-relax/SKILL.md'));
361
- if (desktopNeedsRestart) {
361
+ // Kernel migration already reconnects Desktop. Ordinary service updates retain it.
362
+ if (desktopNeedsRestart && !managedAppServerMigrated) {
362
363
  const currentDesktop = await desktopHost.inspect();
363
364
  if (currentDesktop.running) await desktopHost.closeDesktop(currentDesktop.desktop);
364
365
  await launchDesktop({ stateRoot: physicalStateRoot, host: desktopHost });
@@ -382,6 +383,7 @@ async function main() {
382
383
  launcherRevision: bridge.managedAppServer.launcherRevision ?? null };
383
384
  installed.preserveCodex = preserveCodex;
384
385
  installed.desktopRestarted = desktopRestarted;
386
+ installed.desktopWasRunning = desktopBeforeSetup.running;
385
387
  installed.desktopRestartReason = desktopRestarted ? 'setup-reconnect' : null;
386
388
  installed.desktopConnected = desktopRestarted ? true : null;
387
389
  installed.executionReady = bridge.execution.ready;
@@ -1 +1 @@
1
- {"layout":"npm-platform-packages","version":"0.1.0-beta.66"}
1
+ {"layout":"npm-platform-packages","version":"0.1.0-beta.69"}
@@ -237,7 +237,7 @@ export function attachLanSocket(server, { token, dispatch, authorizeDevice = ()
237
237
  if (!['request', 'subscribe'].includes(type) || active.has(id)) { ws.close(1008, 'Invalid request'); return; }
238
238
  const subscription = type === 'subscribe';
239
239
  const path = message.path;
240
- const isStream = typeof path === 'string' && /^\/api\/(?:usage-events|thread-events|turn-events|shared-recovery\/events|threads\/[^/?]+\/(?:events|dots-activity-events))(?:\?|$)/.test(path);
240
+ const isStream = typeof path === 'string' && /^\/api\/(?:usage-events|thread-events|turn-events|health\/events|shared-recovery\/events|threads\/[^/?]+\/(?:events|dots-activity-events))(?:\?|$)/.test(path);
241
241
  // Native recovery, usage, catalog, current chat, and the main Dot's sidebar
242
242
  // share one station connection (including when viewing a delegated task).
243
243
  if (active.size >= 32 || (subscription && [...active.values()].filter(r => r.subscription).length >= 5)) {
@@ -76,7 +76,7 @@ export function connectBridgeRelay({ relayUrl, hostKey, bridgeUrl, bridgeToken,
76
76
  const socket = turnLocal = new WebSocket(connection.url, { maxPayload: 64 * 1024, perMessageDeflate: false });
77
77
  const resyncPending = new Map();
78
78
  const pulsePending = new Map();
79
- let resyncId = 1, resyncQueue = [];
79
+ let resyncId = 2, resyncQueue = [];
80
80
  function resyncNext() {
81
81
  if (!turnObserverReady || turnLocal !== socket) return;
82
82
  while (resyncPending.size < 8 && resyncQueue.length) {
@@ -104,6 +104,7 @@ export function connectBridgeRelay({ relayUrl, hostKey, bridgeUrl, bridgeToken,
104
104
  socket.on('close', () => {
105
105
  if (turnLocal !== socket) return;
106
106
  turnLocal = undefined;
107
+ send(remote, { type: 'workstation-health', health: null });
107
108
  if (turnObserverReady) send(remote, { type: 'usage-observer-lost' });
108
109
  turnObserverReady = false;
109
110
  queueTurnResync = () => {};
@@ -115,7 +116,17 @@ export function connectBridgeRelay({ relayUrl, hostKey, bridgeUrl, bridgeToken,
115
116
  if (binary || turnLocal !== socket) return socket.terminate();
116
117
  try {
117
118
  const message = decode(bytes, false);
118
- if (message.type === 'ready') { send(socket, { type: 'subscribe', id: 1, path: '/api/turn-events' }); return; }
119
+ if (message.type === 'ready') {
120
+ send(socket, { type: 'subscribe', id: 1, path: '/api/turn-events' });
121
+ send(socket, { type: 'subscribe', id: 2, path: '/api/health/events' }); return;
122
+ }
123
+ if (message.type === 'event' && message.id === 2 && message.event === 'health') {
124
+ send(remote, { type: 'workstation-health', health: message.data }); return;
125
+ }
126
+ if (message.type === 'event' && message.id === 2 && message.event === 'health-error') {
127
+ send(remote, { type: 'workstation-health', health: null });
128
+ events.emit('diagnostic', `Workstation health: ${message.data?.error || 'unavailable'}`); return;
129
+ }
119
130
  if (message.type === 'subscribed' && message.id === 1) {
120
131
  turnObserverReady = true; resyncQueue = [...trackedTurns]; resyncNext(); return;
121
132
  }