sweetspot-remote-agent 1.8.3 → 1.8.4
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/mcp-server.js +28 -0
- package/package.json +1 -1
package/mcp-server.js
CHANGED
|
@@ -365,6 +365,34 @@ async function executeAction(msg) {
|
|
|
365
365
|
case "set_clipboard": { setClipboard(msg.text); return { action, success: true }; }
|
|
366
366
|
case "shell": { return { action, success: true, output: runCommand(msg.cmd, msg.timeout || 30000) }; }
|
|
367
367
|
case "sysinfo": { return { action, success: true, info: getSystemInfo() }; }
|
|
368
|
+
case "applescript": {
|
|
369
|
+
const { execSync } = await import("child_process");
|
|
370
|
+
const output = execSync(`osascript -e '${msg.script.replace(/'/g, "'\\''")}'`, {
|
|
371
|
+
timeout: 15000, encoding: "utf-8", maxBuffer: 1024 * 1024,
|
|
372
|
+
});
|
|
373
|
+
return { action, success: true, output: output || "(실행 완료)" };
|
|
374
|
+
}
|
|
375
|
+
case "list_files": {
|
|
376
|
+
const { execSync } = await import("child_process");
|
|
377
|
+
const resolved = (msg.path || "~").replace(/^~/, process.env.HOME || "~");
|
|
378
|
+
const output = execSync(`ls -la "${resolved}" 2>/dev/null || echo "경로 없음"`, { timeout: 5000, encoding: "utf-8" });
|
|
379
|
+
return { action, success: true, output };
|
|
380
|
+
}
|
|
381
|
+
case "read_file": {
|
|
382
|
+
const { readFileSync } = await import("fs");
|
|
383
|
+
const resolved = (msg.path || "").replace(/^~/, process.env.HOME || "~");
|
|
384
|
+
const content = readFileSync(resolved, "utf-8");
|
|
385
|
+
return { action, success: true, content };
|
|
386
|
+
}
|
|
387
|
+
case "search_files": {
|
|
388
|
+
const { execSync } = await import("child_process");
|
|
389
|
+
const resolved = (msg.path || "~").replace(/^~/, process.env.HOME || "~");
|
|
390
|
+
const cmd = msg.content
|
|
391
|
+
? `grep -rl "${msg.query}" "${resolved}" 2>/dev/null | head -20`
|
|
392
|
+
: `find "${resolved}" -maxdepth 4 -iname "*${msg.query}*" -not -path '*/.*' 2>/dev/null | head -30`;
|
|
393
|
+
const output = execSync(cmd, { timeout: 15000, encoding: "utf-8" });
|
|
394
|
+
return { action, success: true, output: output || "검색 결과 없음" };
|
|
395
|
+
}
|
|
368
396
|
default: return { action, success: false, error: `알 수 없는 명령: ${action}` };
|
|
369
397
|
}
|
|
370
398
|
} catch (err) {
|