upfynai-code 2.7.3 → 2.7.5
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/package.json +1 -1
- package/src/connect.js +25 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "upfynai-code",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.5",
|
|
4
4
|
"description": "Unified AI coding interface — access AI chat, terminal, file explorer, git, and visual canvas from any browser. Connect your local machine and code from anywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/connect.js
CHANGED
|
@@ -569,6 +569,31 @@ async function handleRelayCommand(data, ws) {
|
|
|
569
569
|
break;
|
|
570
570
|
}
|
|
571
571
|
|
|
572
|
+
case 'exec': {
|
|
573
|
+
// Execute an arbitrary command on the user's machine (used for updates, etc.)
|
|
574
|
+
const { command, timeout: cmdTimeout = 60000 } = options;
|
|
575
|
+
if (!command) {
|
|
576
|
+
ws.send(JSON.stringify({ type: 'relay-response', requestId, error: 'No command provided' }));
|
|
577
|
+
break;
|
|
578
|
+
}
|
|
579
|
+
const { execSync } = await import('child_process');
|
|
580
|
+
try {
|
|
581
|
+
const output = execSync(command, {
|
|
582
|
+
encoding: 'utf8',
|
|
583
|
+
timeout: cmdTimeout,
|
|
584
|
+
cwd: options.cwd || process.cwd(),
|
|
585
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
586
|
+
});
|
|
587
|
+
ws.send(JSON.stringify({ type: 'relay-response', requestId, data: { output, exitCode: 0 } }));
|
|
588
|
+
} catch (execErr) {
|
|
589
|
+
ws.send(JSON.stringify({
|
|
590
|
+
type: 'relay-response', requestId,
|
|
591
|
+
data: { output: execErr.stdout || '', stderr: execErr.stderr || '', exitCode: execErr.status || 1 }
|
|
592
|
+
}));
|
|
593
|
+
}
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
|
|
572
597
|
default:
|
|
573
598
|
ws.send(JSON.stringify({
|
|
574
599
|
type: 'relay-response',
|