livedesk 0.1.271 → 0.1.273
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/bin/livedesk.js
CHANGED
|
@@ -578,6 +578,10 @@ async function runManager(args) {
|
|
|
578
578
|
try {
|
|
579
579
|
const request = JSON.parse(readFileSync(updateRequestPath, 'utf8'));
|
|
580
580
|
rmSync(updateRequestPath, { force: true });
|
|
581
|
+
if (request?.continueClientUpdate === true) {
|
|
582
|
+
process.env.LIVEDESK_UPDATE_CONTINUE = '1';
|
|
583
|
+
process.env.LIVEDESK_UPDATE_CONTINUE_TARGET_VERSION = String(request.latestClientVersion || '');
|
|
584
|
+
}
|
|
581
585
|
if (request?.pid && Number(request.pid) !== Number(activeChild?.pid || 0)) {
|
|
582
586
|
restartRequested = true;
|
|
583
587
|
console.log(`[LiveDesk Hub] Restart requested for update ${request.operationId || 'unknown'}.`);
|
|
@@ -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,
|
|
@@ -391,13 +393,15 @@ export function createLiveDeskUpdateManager({
|
|
|
391
393
|
const deviceId = String(event?.device?.deviceId || '');
|
|
392
394
|
const commandId = String(event?.commandId || '');
|
|
393
395
|
const target = run.targets.find(item => item.deviceId === deviceId && item.commandId === commandId);
|
|
394
|
-
if (!target || target.method
|
|
396
|
+
if (!target || !['dedicated', 'legacy-command-run'].includes(target.method)) return;
|
|
395
397
|
const result = event?.result;
|
|
396
398
|
if (event?.error || result?.ok === false || result?.status === 'failed' || result?.status === 'rejected') {
|
|
397
399
|
target.state = 'failed';
|
|
398
400
|
target.error = String(event.error || result?.error || result?.message || 'client-update-command-failed').slice(0, 500);
|
|
399
401
|
touch();
|
|
400
|
-
failRun(
|
|
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}`);
|
|
401
405
|
}
|
|
402
406
|
};
|
|
403
407
|
|
package/hub/src/server.js
CHANGED
|
@@ -285,6 +285,7 @@ function requestHubRestart(request = {}) {
|
|
|
285
285
|
const temporaryPath = `${requestPath}.${process.pid}.tmp`;
|
|
286
286
|
writeFileSync(temporaryPath, JSON.stringify({
|
|
287
287
|
...request,
|
|
288
|
+
continueClientUpdate: true,
|
|
288
289
|
pid: process.pid,
|
|
289
290
|
requestedAt: new Date().toISOString()
|
|
290
291
|
}), 'utf8');
|
|
@@ -302,7 +303,45 @@ liveDeskUpdateManager = createLiveDeskUpdateManager({
|
|
|
302
303
|
restartSupported: !!String(process.env.LIVEDESK_HUB_UPDATE_REQUEST_PATH || '').trim(),
|
|
303
304
|
requestHubRestart
|
|
304
305
|
});
|
|
305
|
-
|
|
306
|
+
|
|
307
|
+
if (process.env.LIVEDESK_UPDATE_CONTINUE === '1') {
|
|
308
|
+
let continueUpdateInFlight = false;
|
|
309
|
+
let continueUpdateAttempts = 0;
|
|
310
|
+
const continueUpdateTimer = setInterval(async () => {
|
|
311
|
+
if (continueUpdateInFlight || continueUpdateAttempts >= 90) {
|
|
312
|
+
if (continueUpdateAttempts >= 90) clearInterval(continueUpdateTimer);
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const connectedDevices = remoteHub.listDevices({ includeDataUrl: false })
|
|
316
|
+
.filter(device => device.connected === true && device.synthetic !== true);
|
|
317
|
+
if (connectedDevices.length === 0) return;
|
|
318
|
+
continueUpdateAttempts += 1;
|
|
319
|
+
continueUpdateInFlight = true;
|
|
320
|
+
try {
|
|
321
|
+
await liveDeskUpdateManager.checkLatest();
|
|
322
|
+
const updateStatus = liveDeskUpdateManager.getStatus();
|
|
323
|
+
if (!updateStatus.updateAvailable) {
|
|
324
|
+
clearInterval(continueUpdateTimer);
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
if (updateStatus.outdatedClientCount <= 0 && !updateStatus.clientPackageUpdateAvailable) {
|
|
328
|
+
clearInterval(continueUpdateTimer);
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
const result = await liveDeskUpdateManager.startUpdate();
|
|
332
|
+
if (result?.ok === false || ['waiting-for-clients', 'clients-updated', 'hub-restart-requested'].includes(String(result?.state || ''))) {
|
|
333
|
+
clearInterval(continueUpdateTimer);
|
|
334
|
+
}
|
|
335
|
+
} catch (error) {
|
|
336
|
+
console.warn(`[LiveDesk Hub] automatic client update continuation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
337
|
+
clearInterval(continueUpdateTimer);
|
|
338
|
+
} finally {
|
|
339
|
+
continueUpdateInFlight = false;
|
|
340
|
+
}
|
|
341
|
+
}, 1000);
|
|
342
|
+
continueUpdateTimer.unref?.();
|
|
343
|
+
}
|
|
344
|
+
const agentMcpSessions = new Map();
|
|
306
345
|
const agentMcpRunBatches = new Map();
|
|
307
346
|
const agentMcpRunCleanupTimers = new Map();
|
|
308
347
|
const AGENT_MCP_RUN_TTL_MS = 60 * 60 * 1000;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "livedesk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.273",
|
|
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.
|
|
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",
|