livedesk 0.1.270 → 0.1.272

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.
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
 
3
3
  export const LIVE_DESK_UPDATE_COMMAND = 'livedesk.client-update';
4
+ export const LIVE_DESK_DEDICATED_CLIENT_UPDATE_MIN_VERSION = '0.1.138';
4
5
  export const LIVE_DESK_UPDATE_TIMEOUT_MS = 120_000;
5
6
  export const LIVE_DESK_UPDATE_CHECK_INTERVAL_MS = 60_000;
6
7
 
@@ -284,7 +285,8 @@ export function createLiveDeskUpdateManager({
284
285
 
285
286
  const dispatchTarget = (target, credentials) => {
286
287
  const device = target.device;
287
- const supportsDedicated = device.capabilities?.clientUpdate === true;
288
+ const supportsDedicated = device.capabilities?.clientUpdate === true
289
+ && isVersionAtLeast(device.agentVersion, LIVE_DESK_DEDICATED_CLIENT_UPDATE_MIN_VERSION);
288
290
  const payload = {
289
291
  targetVersion: run.latestClientVersion,
290
292
  managerVersion: run.latestManagerVersion,
@@ -324,7 +326,23 @@ export function createLiveDeskUpdateManager({
324
326
  if (needsHubRestart && !restartSupported) {
325
327
  return { ok: false, error: 'Hub launcher restart is unavailable. Start LiveDesk through npx livedesk@latest.', ...getStatus() };
326
328
  }
327
- const targets = managerNeedsUpdate || clientPackageNeedsUpdate ? connected : outdatedClients;
329
+ if (managerNeedsUpdate) {
330
+ run = {
331
+ operationId: randomUUID(),
332
+ state: 'dispatching',
333
+ startedAt: new Date(now()).toISOString(),
334
+ updatedAt: new Date(now()).toISOString(),
335
+ latestManagerVersion: release.latestManagerVersion,
336
+ latestClientVersion: release.latestClientVersion,
337
+ needsHubRestart: true,
338
+ error: '',
339
+ targets: []
340
+ };
341
+ requestRestart();
342
+ return { ok: true, ...getStatus() };
343
+ }
344
+
345
+ const targets = outdatedClients;
328
346
  const credentials = remoteHub.getStatus({ includeSecrets: true });
329
347
  run = {
330
348
  operationId: randomUUID(),
@@ -333,7 +351,7 @@ export function createLiveDeskUpdateManager({
333
351
  updatedAt: new Date(now()).toISOString(),
334
352
  latestManagerVersion: release.latestManagerVersion,
335
353
  latestClientVersion: release.latestClientVersion,
336
- needsHubRestart,
354
+ needsHubRestart: false,
337
355
  error: '',
338
356
  targets: targets.map(device => ({
339
357
  deviceId: String(device.deviceId || ''),
@@ -375,13 +393,15 @@ export function createLiveDeskUpdateManager({
375
393
  const deviceId = String(event?.device?.deviceId || '');
376
394
  const commandId = String(event?.commandId || '');
377
395
  const target = run.targets.find(item => item.deviceId === deviceId && item.commandId === commandId);
378
- if (!target || target.method !== 'dedicated') return;
396
+ if (!target || !['dedicated', 'legacy-command-run'].includes(target.method)) return;
379
397
  const result = event?.result;
380
398
  if (event?.error || result?.ok === false || result?.status === 'failed' || result?.status === 'rejected') {
381
399
  target.state = 'failed';
382
400
  target.error = String(event.error || result?.error || result?.message || 'client-update-command-failed').slice(0, 500);
383
401
  touch();
384
- failRun(`Client ${target.deviceName || target.deviceId} rejected the update request: ${target.error}`);
402
+ failRun(target.method === 'dedicated'
403
+ ? `Client ${target.deviceName || target.deviceId} rejected the update request: ${target.error}`
404
+ : `Client ${target.deviceName || target.deviceId} failed the update command: ${target.error}`);
385
405
  }
386
406
  };
387
407
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.270",
3
+ "version": "0.1.272",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@ffmpeg-installer/ffmpeg": "^1.1.0",
34
- "@livedesk/client": "0.1.137",
34
+ "@livedesk/client": "0.1.138",
35
35
  "@openai/codex-sdk": "0.144.5",
36
36
  "cors": "^2.8.5",
37
37
  "express": "^4.21.2",