sweetspot-remote-agent 1.8.5 → 1.8.6
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 +18 -0
- package/package.json +1 -1
package/mcp-server.js
CHANGED
|
@@ -377,6 +377,24 @@ async function executeAction(msg) {
|
|
|
377
377
|
try { unlinkSync(tmpFile); } catch {}
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
+
case "write_note": {
|
|
381
|
+
// 메모 앱 노트 작성 — body를 temp 파일로 전달해 인코딩 문제 방지
|
|
382
|
+
const { execSync } = await import("child_process");
|
|
383
|
+
const { writeFileSync, unlinkSync } = await import("fs");
|
|
384
|
+
const ts = Date.now();
|
|
385
|
+
const contentFile = `/tmp/sweetspot_note_${ts}.txt`;
|
|
386
|
+
const scriptFile = `/tmp/sweetspot_script_${ts}.applescript`;
|
|
387
|
+
const title = (msg.title || "Sophy 노트").replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
388
|
+
writeFileSync(contentFile, msg.body || "", "utf-8");
|
|
389
|
+
const script = `tell application "Notes"\nset noteBody to read POSIX file "${contentFile}" as «class utf8»\nmake new note with properties {name:"${title}", body:noteBody}\nend tell`;
|
|
390
|
+
writeFileSync(scriptFile, script, "utf-8");
|
|
391
|
+
try {
|
|
392
|
+
const output = execSync(`osascript '${scriptFile}'`, { timeout: 15000, encoding: "utf-8" });
|
|
393
|
+
return { action, success: true, output: output || "(노트 작성 완료)" };
|
|
394
|
+
} finally {
|
|
395
|
+
try { unlinkSync(scriptFile); unlinkSync(contentFile); } catch {}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
380
398
|
case "list_files": {
|
|
381
399
|
const { execSync } = await import("child_process");
|
|
382
400
|
const resolved = (msg.path || "~").replace(/^~/, process.env.HOME || "~");
|