@livedesk/client 0.1.245 → 0.1.246

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.
@@ -5277,10 +5277,11 @@ export async function runClientRuntime(argv = process.argv.slice(2), runtimeOpti
5277
5277
  console.log(`[LiveDesk Client] Restarting Agent after ${restart.reason}.`);
5278
5278
  continue;
5279
5279
  }
5280
- if (result?.signal) {
5281
- connectionPage?.close?.();
5282
- process.kill(process.pid, result.signal);
5283
- return;
5280
+ const terminalShutdownRequested = disposeAgentTerminationHandlers.isTerminating?.() === true;
5281
+ if (result?.signal && terminalShutdownRequested) {
5282
+ connectionPage?.close?.();
5283
+ process.kill(process.pid, result.signal);
5284
+ return;
5284
5285
  }
5285
5286
  if (result?.code === EXIT_CLIENT_UPDATE) {
5286
5287
  connectionPage?.close?.();
@@ -5293,9 +5294,11 @@ export async function runClientRuntime(argv = process.argv.slice(2), runtimeOpti
5293
5294
  if (pairChanged || cachedHandshakeFailed) {
5294
5295
  clearCachedHubTarget();
5295
5296
  }
5296
- console.error(pairChanged
5297
- ? 'LiveDesk Hub pair token changed. Refreshing Hub discovery now.'
5298
- : 'LiveDesk Hub connection ended. Looking for the current Hub now.');
5297
+ console.error(pairChanged
5298
+ ? 'LiveDesk Hub pair token changed. Refreshing Hub discovery now.'
5299
+ : result?.signal
5300
+ ? `LiveDesk Agent ended unexpectedly with signal ${result.signal}. Keeping the Client alive and reconnecting to the Hub now.`
5301
+ : 'LiveDesk Hub connection ended. Looking for the current Hub now.');
5299
5302
  connectionPage?.update({
5300
5303
  agent: {
5301
5304
  requestedEngine: prepared.engine,
@@ -5304,10 +5307,15 @@ export async function runClientRuntime(argv = process.argv.slice(2), runtimeOpti
5304
5307
  },
5305
5308
  manager: '',
5306
5309
  message: 'The previous Hub is unavailable. LiveDesk is finding the current Hub automatically.'
5307
- });
5308
- continue;
5309
- }
5310
- connectionPage?.close?.();
5310
+ });
5311
+ continue;
5312
+ }
5313
+ if (result?.signal) {
5314
+ connectionPage?.close?.();
5315
+ process.kill(process.pid, result.signal);
5316
+ return;
5317
+ }
5318
+ connectionPage?.close?.();
5311
5319
  process.exit(result?.code ?? 0);
5312
5320
  }
5313
5321
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livedesk/client",
3
- "version": "0.1.245",
3
+ "version": "0.1.246",
4
4
  "description": "LiveDesk local remote client",
5
5
  "type": "module",
6
6
  "bin": {
@@ -852,9 +852,10 @@ export function installAgentTerminationHandlers({
852
852
  // dispatching its JavaScript SIGTERM listener. Replacement startup must
853
853
  // enter this exact cleanup state machine directly instead of simulating an
854
854
  // operating-system signal.
855
- dispose.requestTermination = (signal = 'SIGTERM') => {
856
- const normalizedSignal = signal === 'SIGINT' ? 'SIGINT' : 'SIGTERM';
857
- handlers.get(normalizedSignal)?.();
858
- };
859
- return dispose;
860
- }
855
+ dispose.requestTermination = (signal = 'SIGTERM') => {
856
+ const normalizedSignal = signal === 'SIGINT' ? 'SIGINT' : 'SIGTERM';
857
+ handlers.get(normalizedSignal)?.();
858
+ };
859
+ dispose.isTerminating = () => terminating;
860
+ return dispose;
861
+ }