livedesk 0.1.448 → 0.1.450
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/bootstrap/legacy-client-update.js +1 -7
- package/client/bin/livedesk-client-node.js +66 -187
- package/client/bin/livedesk-client.js +383 -136
- package/client/package.json +5 -6
- package/hub/package.json +1 -1
- package/hub/src/agents/agent-manager.js +0 -9
- package/hub/src/agents/agent-settings.js +4 -34
- package/hub/src/agents/codex-agent-runtime.js +12 -14
- package/hub/src/remote-hub.js +19 -6
- package/hub/src/server.js +13 -11
- package/hub/src/transport/udp-hub-transport.js +22 -22
- package/hub/src/transport/udp-protocol.js +51 -26
- package/package.json +8 -9
- package/web/dist/assets/icons-CCS0Avce.js +1 -0
- package/web/dist/assets/index-vBxXkd_R.js +25 -0
- package/web/dist/assets/{react-BOnb-QRJ.js → react-Cg5haagh.js} +1 -1
- package/web/dist/index.html +3 -3
- package/web/dist/assets/icons-CTHUbfAT.js +0 -1
- package/web/dist/assets/index-DKPdDVYW.js +0 -25
|
@@ -47,9 +47,6 @@ const PRESERVED_SINGLE_FLAGS = new Set([
|
|
|
47
47
|
'--no-audio',
|
|
48
48
|
'--tasks',
|
|
49
49
|
'--no-tasks',
|
|
50
|
-
'--ai',
|
|
51
|
-
'--no-ai',
|
|
52
|
-
'--fake-ai',
|
|
53
50
|
'--fake-thumbnail',
|
|
54
51
|
'--trace-frames'
|
|
55
52
|
]);
|
|
@@ -57,7 +54,6 @@ const PRESERVED_VALUE_FLAGS = new Set([
|
|
|
57
54
|
'--name',
|
|
58
55
|
'--heartbeat',
|
|
59
56
|
'--files-dir',
|
|
60
|
-
'--ai-model',
|
|
61
57
|
'--transport'
|
|
62
58
|
]);
|
|
63
59
|
const JOINED_VALUE_FLAGS = new Set(['--name', '--files-dir']);
|
|
@@ -71,9 +67,7 @@ const SETTING_GROUPS = new Map([
|
|
|
71
67
|
['--audio', 'audio'],
|
|
72
68
|
['--no-audio', 'audio'],
|
|
73
69
|
['--tasks', 'tasks'],
|
|
74
|
-
['--no-tasks', 'tasks']
|
|
75
|
-
['--ai', 'ai'],
|
|
76
|
-
['--no-ai', 'ai']
|
|
70
|
+
['--no-tasks', 'tasks']
|
|
77
71
|
]);
|
|
78
72
|
|
|
79
73
|
function cleanVersion(value) {
|
|
@@ -19,15 +19,13 @@ const AGENT_VERSION = (() => {
|
|
|
19
19
|
const PRODUCT_VERSION = String(process.env.LIVEDESK_NPM_LAUNCHER_VERSION || AGENT_VERSION).trim() || AGENT_VERSION;
|
|
20
20
|
const DEFAULT_MANAGER = '127.0.0.1:5197';
|
|
21
21
|
const DEFAULT_HEARTBEAT_MS = 5000;
|
|
22
|
-
const DEFAULT_RECONNECT_MS = 5000;
|
|
23
|
-
const EXIT_INVALID_PAIR_TOKEN = 23;
|
|
24
|
-
const EXIT_CLIENT_UPDATE = 42;
|
|
25
|
-
const
|
|
26
|
-
const
|
|
27
|
-
const
|
|
28
|
-
const
|
|
29
|
-
const MAX_AI_OUTPUT_CHARS = 6000;
|
|
30
|
-
const MAX_FILE_TRANSFER_FILES = 24;
|
|
22
|
+
const DEFAULT_RECONNECT_MS = 5000;
|
|
23
|
+
const EXIT_INVALID_PAIR_TOKEN = 23;
|
|
24
|
+
const EXIT_CLIENT_UPDATE = 42;
|
|
25
|
+
const DEFAULT_LIVE_FPS = 30;
|
|
26
|
+
const MAX_LIVE_FPS = 30;
|
|
27
|
+
const MAX_FRAME_BASE64_CHARS = 3 * 1024 * 1024;
|
|
28
|
+
const MAX_FILE_TRANSFER_FILES = 24;
|
|
31
29
|
const MAX_FILE_TRANSFER_BYTES = 24 * 1024 * 1024;
|
|
32
30
|
const MAX_AGENT_OUTPUT_CHARS = 32000;
|
|
33
31
|
const launchedProcessRegistry = new Map();
|
|
@@ -281,14 +279,10 @@ Options:
|
|
|
281
279
|
--no-thumbnail Disable thumbnail capture capability.
|
|
282
280
|
--live Enable focused live screen streaming. Default on.
|
|
283
281
|
--no-live Disable focused live screen streaming.
|
|
284
|
-
--tasks Enable safe remote task inbox. Default on.
|
|
285
|
-
--no-tasks Disable remote task dispatch capability.
|
|
286
|
-
--files-dir <path> Default folder for received files. Default: ~/Desktop/LiveDeskFiles.
|
|
287
|
-
--
|
|
288
|
-
--no-ai Disable OpenAI-backed remote AI assist tasks.
|
|
289
|
-
--ai-model <model> OpenAI model for AI assist. Default: ${DEFAULT_AI_MODEL}
|
|
290
|
-
--fake-ai Use deterministic AI assist responses for smoke tests.
|
|
291
|
-
--fake-thumbnail Use generated thumbnail frames for smoke tests.
|
|
282
|
+
--tasks Enable safe remote task inbox. Default on.
|
|
283
|
+
--no-tasks Disable remote task dispatch capability.
|
|
284
|
+
--files-dir <path> Default folder for received files. Default: ~/Desktop/LiveDeskFiles.
|
|
285
|
+
--fake-thumbnail Use generated thumbnail frames for smoke tests.
|
|
292
286
|
--exit-on-disconnect Exit after Hub disconnect. Useful for tests.
|
|
293
287
|
--exit-on-invalid-pair Exit when the Hub rejects the pair token.
|
|
294
288
|
--once Connect, send one status packet, and exit after welcome.
|
|
@@ -328,14 +322,10 @@ function parseArgs(argv) {
|
|
|
328
322
|
heartbeatMs: DEFAULT_HEARTBEAT_MS,
|
|
329
323
|
deviceId: '',
|
|
330
324
|
thumbnailEnabled: defaultDesktopCaptureEnabled && !isFalsy(process.env.LIVEDESK_CLIENT_THUMBNAIL ?? process.env.MINDEXEC_REMOTE_THUMBNAIL),
|
|
331
|
-
liveEnabled: defaultDesktopCaptureEnabled && !isFalsy(process.env.LIVEDESK_CLIENT_LIVE ?? process.env.MINDEXEC_REMOTE_LIVE),
|
|
332
|
-
taskEnabled: !isFalsy(process.env.LIVEDESK_CLIENT_TASKS ?? process.env.MINDEXEC_REMOTE_TASKS),
|
|
333
|
-
filesDir: process.env.LIVEDESK_CLIENT_FILES_DIR || process.env.MINDEXEC_REMOTE_FILES_DIR || '',
|
|
334
|
-
|
|
335
|
-
aiModel: process.env.LIVEDESK_CLIENT_AI_MODEL || process.env.MINDEXEC_REMOTE_AI_MODEL || process.env.OPENAI_MODEL || DEFAULT_AI_MODEL,
|
|
336
|
-
openAiApiKey: process.env.OPENAI_API_KEY || '',
|
|
337
|
-
fakeAi: isTruthy(process.env.LIVEDESK_CLIENT_FAKE_AI || process.env.MINDEXEC_REMOTE_FAKE_AI),
|
|
338
|
-
fakeThumbnail: isTruthy(process.env.LIVEDESK_CLIENT_FAKE_THUMBNAIL || process.env.MINDEXEC_REMOTE_FAKE_THUMBNAIL),
|
|
325
|
+
liveEnabled: defaultDesktopCaptureEnabled && !isFalsy(process.env.LIVEDESK_CLIENT_LIVE ?? process.env.MINDEXEC_REMOTE_LIVE),
|
|
326
|
+
taskEnabled: !isFalsy(process.env.LIVEDESK_CLIENT_TASKS ?? process.env.MINDEXEC_REMOTE_TASKS),
|
|
327
|
+
filesDir: process.env.LIVEDESK_CLIENT_FILES_DIR || process.env.MINDEXEC_REMOTE_FILES_DIR || '',
|
|
328
|
+
fakeThumbnail: isTruthy(process.env.LIVEDESK_CLIENT_FAKE_THUMBNAIL || process.env.MINDEXEC_REMOTE_FAKE_THUMBNAIL),
|
|
339
329
|
exitOnDisconnect: false,
|
|
340
330
|
exitOnInvalidPair: false,
|
|
341
331
|
once: false,
|
|
@@ -387,26 +377,11 @@ function parseArgs(argv) {
|
|
|
387
377
|
case '--no-tasks':
|
|
388
378
|
result.taskEnabled = false;
|
|
389
379
|
break;
|
|
390
|
-
case '--files-dir':
|
|
391
|
-
result.filesDir = args[++index] || result.filesDir;
|
|
392
|
-
break;
|
|
393
|
-
case '--
|
|
394
|
-
result.
|
|
395
|
-
result.taskEnabled = true;
|
|
396
|
-
break;
|
|
397
|
-
case '--no-ai':
|
|
398
|
-
result.aiEnabled = false;
|
|
399
|
-
break;
|
|
400
|
-
case '--ai-model':
|
|
401
|
-
result.aiModel = args[++index] || result.aiModel;
|
|
402
|
-
break;
|
|
403
|
-
case '--fake-ai':
|
|
404
|
-
result.fakeAi = true;
|
|
405
|
-
result.aiEnabled = true;
|
|
406
|
-
result.taskEnabled = true;
|
|
407
|
-
break;
|
|
408
|
-
case '--fake-thumbnail':
|
|
409
|
-
result.fakeThumbnail = true;
|
|
380
|
+
case '--files-dir':
|
|
381
|
+
result.filesDir = args[++index] || result.filesDir;
|
|
382
|
+
break;
|
|
383
|
+
case '--fake-thumbnail':
|
|
384
|
+
result.fakeThumbnail = true;
|
|
410
385
|
result.thumbnailEnabled = true;
|
|
411
386
|
break;
|
|
412
387
|
case '--exit-on-disconnect':
|
|
@@ -586,7 +561,7 @@ function getStatus(options = {}) {
|
|
|
586
561
|
usedMemRatio,
|
|
587
562
|
platform: os.platform(),
|
|
588
563
|
release: os.release(),
|
|
589
|
-
role: options.
|
|
564
|
+
role: options.taskEnabled ? 'Command-ready Client' : 'Local machine',
|
|
590
565
|
cpu: {
|
|
591
566
|
cores: cpuCores,
|
|
592
567
|
model: cpus[0]?.model || '',
|
|
@@ -609,9 +584,9 @@ function getStatus(options = {}) {
|
|
|
609
584
|
gpu: acceleratorStatus.gpu,
|
|
610
585
|
npu: acceleratorStatus.npu,
|
|
611
586
|
network: getNetworkStatus(),
|
|
612
|
-
workload: {
|
|
613
|
-
role: options.
|
|
614
|
-
status: 'idle',
|
|
587
|
+
workload: {
|
|
588
|
+
role: options.taskEnabled ? 'Command-ready Client' : 'Local machine',
|
|
589
|
+
status: 'idle',
|
|
615
590
|
title: 'idle'
|
|
616
591
|
},
|
|
617
592
|
timestamp: new Date().toISOString()
|
|
@@ -941,95 +916,17 @@ async function captureThumbnailFrame(options, payload, frameSeq) {
|
|
|
941
916
|
return await captureScreenFrame(options, payload, frameSeq, 'thumbnail');
|
|
942
917
|
}
|
|
943
918
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
}
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
return
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
'If the task requires external side effects, explain what would be needed and stop.',
|
|
956
|
-
'',
|
|
957
|
-
`Device: ${options.name} (${os.hostname()}, ${os.platform()} ${os.release()}, ${os.arch()})`,
|
|
958
|
-
`Task title: ${title}`,
|
|
959
|
-
'',
|
|
960
|
-
'Hub instruction:',
|
|
961
|
-
instruction
|
|
962
|
-
].join('\n');
|
|
963
|
-
}
|
|
964
|
-
|
|
965
|
-
function extractResponseText(response) {
|
|
966
|
-
if (typeof response?.output_text === 'string' && response.output_text.trim()) {
|
|
967
|
-
return response.output_text.trim();
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
const parts = [];
|
|
971
|
-
if (Array.isArray(response?.output)) {
|
|
972
|
-
for (const item of response.output) {
|
|
973
|
-
if (!Array.isArray(item?.content)) {
|
|
974
|
-
continue;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
for (const content of item.content) {
|
|
978
|
-
if (typeof content?.text === 'string') {
|
|
979
|
-
parts.push(content.text);
|
|
980
|
-
}
|
|
981
|
-
if (typeof content?.output_text === 'string') {
|
|
982
|
-
parts.push(content.output_text);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
return parts.join('\n').trim();
|
|
989
|
-
}
|
|
990
|
-
|
|
991
|
-
async function runAiAssistTask(options, payload, instruction) {
|
|
992
|
-
if (!options.aiEnabled) {
|
|
993
|
-
throw new Error('AI assist capability is disabled. Start the agent with --ai to enable it.');
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
if (options.fakeAi) {
|
|
997
|
-
return {
|
|
998
|
-
text: [
|
|
999
|
-
`Fake AI assist completed on ${options.name}.`,
|
|
1000
|
-
'',
|
|
1001
|
-
`Instruction: ${instruction.slice(0, 500)}`,
|
|
1002
|
-
'',
|
|
1003
|
-
'No shell, file, input, browser, or persistent side effects were performed.'
|
|
1004
|
-
].join('\n'),
|
|
1005
|
-
model: 'fake-ai',
|
|
1006
|
-
responseId: `fake-ai-${String(payload?.taskId || crypto.randomUUID()).slice(0, 96)}`
|
|
1007
|
-
};
|
|
1008
|
-
}
|
|
1009
|
-
|
|
1010
|
-
if (!options.openAiApiKey) {
|
|
1011
|
-
throw new Error('OPENAI_API_KEY is required for --ai remote tasks.');
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
const openaiModule = await import('openai');
|
|
1015
|
-
const OpenAI = openaiModule.default || openaiModule.OpenAI;
|
|
1016
|
-
const client = new OpenAI({ apiKey: options.openAiApiKey });
|
|
1017
|
-
const model = String(payload?.model || options.aiModel || DEFAULT_AI_MODEL).trim() || DEFAULT_AI_MODEL;
|
|
1018
|
-
const response = await client.responses.create({
|
|
1019
|
-
model,
|
|
1020
|
-
input: buildAiPrompt(options, payload, instruction)
|
|
1021
|
-
});
|
|
1022
|
-
const text = extractResponseText(response);
|
|
1023
|
-
if (!text) {
|
|
1024
|
-
throw new Error('AI assist returned no text output.');
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
return {
|
|
1028
|
-
text: text.slice(0, MAX_AI_OUTPUT_CHARS),
|
|
1029
|
-
model,
|
|
1030
|
-
responseId: response?.id || ''
|
|
1031
|
-
};
|
|
1032
|
-
}
|
|
919
|
+
const RETIRED_CLIENT_AGENT_TASK_ERROR = 'agent-ai-assist-retired';
|
|
920
|
+
|
|
921
|
+
function getRetiredClientAgentTaskError(payload = {}) {
|
|
922
|
+
const source = payload && typeof payload === 'object' ? payload : {};
|
|
923
|
+
const approvalLevel = String(source.approvalLevel || '').trim().toLowerCase();
|
|
924
|
+
const hasModelSelection = ['model', 'aiModel', 'aiProvider', 'provider']
|
|
925
|
+
.some(key => Object.prototype.hasOwnProperty.call(source, key));
|
|
926
|
+
return approvalLevel === 'ai-assist' || hasModelSelection
|
|
927
|
+
? RETIRED_CLIENT_AGENT_TASK_ERROR
|
|
928
|
+
: '';
|
|
929
|
+
}
|
|
1033
930
|
|
|
1034
931
|
function clampInteger(value, min, max, fallback) {
|
|
1035
932
|
const number = Number(value);
|
|
@@ -1846,10 +1743,25 @@ async function handleRemoteCommand(socket, options, message, nextFrameSeq, activ
|
|
|
1846
1743
|
error: 'remote task capability is disabled'
|
|
1847
1744
|
});
|
|
1848
1745
|
return;
|
|
1849
|
-
}
|
|
1850
|
-
|
|
1851
|
-
const payload = message.payload || {};
|
|
1852
|
-
const
|
|
1746
|
+
}
|
|
1747
|
+
|
|
1748
|
+
const payload = message.payload || {};
|
|
1749
|
+
const retiredTaskError = getRetiredClientAgentTaskError(payload);
|
|
1750
|
+
if (retiredTaskError) {
|
|
1751
|
+
writeJsonLine(socket, {
|
|
1752
|
+
type: 'command.result',
|
|
1753
|
+
commandId: message.commandId,
|
|
1754
|
+
error: retiredTaskError,
|
|
1755
|
+
result: {
|
|
1756
|
+
ok: false,
|
|
1757
|
+
status: 'failed',
|
|
1758
|
+
error: retiredTaskError,
|
|
1759
|
+
completedAt: new Date().toISOString()
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
return;
|
|
1763
|
+
}
|
|
1764
|
+
const instruction = String(payload.instruction || '').replace(/\0/g, '').trim().slice(0, 4000);
|
|
1853
1765
|
if (!instruction) {
|
|
1854
1766
|
writeJsonLine(socket, {
|
|
1855
1767
|
type: 'command.result',
|
|
@@ -1859,43 +1771,13 @@ async function handleRemoteCommand(socket, options, message, nextFrameSeq, activ
|
|
|
1859
1771
|
return;
|
|
1860
1772
|
}
|
|
1861
1773
|
|
|
1862
|
-
const
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
.
|
|
1866
|
-
.
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
try {
|
|
1870
|
-
const aiResult = await runAiAssistTask(options, payload, instruction);
|
|
1871
|
-
writeJsonLine(socket, {
|
|
1872
|
-
type: 'command.result',
|
|
1873
|
-
commandId: message.commandId,
|
|
1874
|
-
result: {
|
|
1875
|
-
kind: 'agent.task',
|
|
1876
|
-
mode: 'ai-assist',
|
|
1877
|
-
taskId: String(payload.taskId || '').slice(0, 128),
|
|
1878
|
-
title,
|
|
1879
|
-
status: 'completed',
|
|
1880
|
-
summary: aiResult.text,
|
|
1881
|
-
sideEffects: 'none',
|
|
1882
|
-
model: aiResult.model,
|
|
1883
|
-
responseId: aiResult.responseId,
|
|
1884
|
-
instructionPreview: instruction.slice(0, 320),
|
|
1885
|
-
completedAt: new Date().toISOString()
|
|
1886
|
-
}
|
|
1887
|
-
});
|
|
1888
|
-
} catch (error) {
|
|
1889
|
-
writeJsonLine(socket, {
|
|
1890
|
-
type: 'command.result',
|
|
1891
|
-
commandId: message.commandId,
|
|
1892
|
-
error: error?.message || String(error)
|
|
1893
|
-
});
|
|
1894
|
-
}
|
|
1895
|
-
return;
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
writeJsonLine(socket, {
|
|
1774
|
+
const completedAt = new Date().toISOString();
|
|
1775
|
+
const title = String(payload.title || instruction.split(/\r?\n/)[0] || 'Remote task')
|
|
1776
|
+
.replace(/[\r\n\t]/g, ' ')
|
|
1777
|
+
.trim()
|
|
1778
|
+
.slice(0, 120);
|
|
1779
|
+
|
|
1780
|
+
writeJsonLine(socket, {
|
|
1899
1781
|
type: 'command.result',
|
|
1900
1782
|
commandId: message.commandId,
|
|
1901
1783
|
result: {
|
|
@@ -2140,14 +2022,11 @@ function connectOnce(options, deviceId) {
|
|
|
2140
2022
|
taskDispatch: options.taskEnabled,
|
|
2141
2023
|
clientUpdate: true,
|
|
2142
2024
|
productVersion: PRODUCT_VERSION,
|
|
2143
|
-
agentApproval: options.taskEnabled,
|
|
2144
|
-
agentAudit: options.taskEnabled,
|
|
2145
|
-
agentTools: [...NODE_AGENT_OPERATIONS],
|
|
2146
|
-
elevation: typeof process.getuid === 'function' ? process.getuid() === 0 : false,
|
|
2147
|
-
|
|
2148
|
-
aiModel: options.aiModel,
|
|
2149
|
-
aiProvider: options.fakeAi ? 'fake' : (options.openAiApiKey ? 'openai' : ''),
|
|
2150
|
-
externalEffects: options.taskEnabled
|
|
2025
|
+
agentApproval: options.taskEnabled,
|
|
2026
|
+
agentAudit: options.taskEnabled,
|
|
2027
|
+
agentTools: [...NODE_AGENT_OPERATIONS],
|
|
2028
|
+
elevation: typeof process.getuid === 'function' ? process.getuid() === 0 : false,
|
|
2029
|
+
externalEffects: options.taskEnabled
|
|
2151
2030
|
}
|
|
2152
2031
|
});
|
|
2153
2032
|
});
|