apple-notes-mcp 2.5.9 → 2.5.10
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/build/index.js +16 -27
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -38656,7 +38656,7 @@ var StdioServerTransport = class {
|
|
|
38656
38656
|
};
|
|
38657
38657
|
|
|
38658
38658
|
// src/utils/applescript.ts
|
|
38659
|
-
import {
|
|
38659
|
+
import { execFileSync } from "child_process";
|
|
38660
38660
|
var DEFAULT_TIMEOUT_MS = 3e4;
|
|
38661
38661
|
var DEFAULT_MAX_BUFFER_BYTES = 64 * 1024 * 1024;
|
|
38662
38662
|
function envPositiveNumber(name) {
|
|
@@ -38693,13 +38693,10 @@ function debugLog(message, data) {
|
|
|
38693
38693
|
console.error(`[DEBUG ${timestamp}] ${message}`);
|
|
38694
38694
|
}
|
|
38695
38695
|
}
|
|
38696
|
-
function escapeForShell(script) {
|
|
38697
|
-
return script.replace(/'/g, "'\\''");
|
|
38698
|
-
}
|
|
38699
38696
|
function isTimeoutError(error2) {
|
|
38700
38697
|
if (error2 instanceof Error) {
|
|
38701
38698
|
const execError = error2;
|
|
38702
|
-
return execError.killed === true || execError.signal === "SIGTERM";
|
|
38699
|
+
return execError.code === "ETIMEDOUT" || execError.killed === true || execError.signal === "SIGKILL" || execError.signal === "SIGTERM";
|
|
38703
38700
|
}
|
|
38704
38701
|
return false;
|
|
38705
38702
|
}
|
|
@@ -38714,13 +38711,7 @@ function isRetryableError(errorMessage) {
|
|
|
38714
38711
|
return RETRYABLE_ERROR_PATTERNS.some((pattern) => pattern.test(errorMessage));
|
|
38715
38712
|
}
|
|
38716
38713
|
function sleep(ms) {
|
|
38717
|
-
|
|
38718
|
-
const result = spawnSync("sleep", [seconds.toString()], { stdio: "ignore" });
|
|
38719
|
-
if (result.error) {
|
|
38720
|
-
const end = Date.now() + ms;
|
|
38721
|
-
while (Date.now() < end) {
|
|
38722
|
-
}
|
|
38723
|
-
}
|
|
38714
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
38724
38715
|
}
|
|
38725
38716
|
var ERROR_MAPPINGS = [
|
|
38726
38717
|
// Permission errors
|
|
@@ -38812,8 +38803,7 @@ function executeAppleScript(script, options = {}) {
|
|
|
38812
38803
|
error: "Cannot execute empty AppleScript"
|
|
38813
38804
|
};
|
|
38814
38805
|
}
|
|
38815
|
-
const preparedScript =
|
|
38816
|
-
const command = `osascript -e '${preparedScript}'`;
|
|
38806
|
+
const preparedScript = wrapWithTimeout(script.trim(), timeoutMs);
|
|
38817
38807
|
debugLog("Executing AppleScript", {
|
|
38818
38808
|
scriptPreview: script.trim().substring(0, 200) + (script.length > 200 ? "..." : ""),
|
|
38819
38809
|
timeout: timeoutMs,
|
|
@@ -38824,7 +38814,8 @@ function executeAppleScript(script, options = {}) {
|
|
|
38824
38814
|
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
38825
38815
|
const attemptStart = Date.now();
|
|
38826
38816
|
try {
|
|
38827
|
-
const output =
|
|
38817
|
+
const output = execFileSync("osascript", ["-"], {
|
|
38818
|
+
input: preparedScript,
|
|
38828
38819
|
encoding: "utf8",
|
|
38829
38820
|
timeout: timeoutMs,
|
|
38830
38821
|
// SIGKILL (not the default SIGTERM): a wedged osascript blocked on an
|
|
@@ -38833,9 +38824,7 @@ function executeAppleScript(script, options = {}) {
|
|
|
38833
38824
|
killSignal: "SIGKILL",
|
|
38834
38825
|
// Raise the output cap above Node's 1 MB default so large exports /
|
|
38835
38826
|
// long notes aren't truncated into an ENOBUFS failure. (#16)
|
|
38836
|
-
maxBuffer: getMaxBuffer()
|
|
38837
|
-
// Capture stderr separately to get error details
|
|
38838
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
38827
|
+
maxBuffer: getMaxBuffer()
|
|
38839
38828
|
});
|
|
38840
38829
|
const duration3 = Date.now() - attemptStart;
|
|
38841
38830
|
debugLog("AppleScript succeeded", {
|
|
@@ -38901,7 +38890,7 @@ function executeAppleScript(script, options = {}) {
|
|
|
38901
38890
|
}
|
|
38902
38891
|
|
|
38903
38892
|
// src/utils/checklistParser.ts
|
|
38904
|
-
import { execFileSync } from "child_process";
|
|
38893
|
+
import { execFileSync as execFileSync2 } from "child_process";
|
|
38905
38894
|
import * as zlib from "zlib";
|
|
38906
38895
|
import * as fs from "fs";
|
|
38907
38896
|
import * as path from "path";
|
|
@@ -38995,7 +38984,7 @@ var NOTES_DB_PATH = path.join(
|
|
|
38995
38984
|
function hasFullDiskAccess() {
|
|
38996
38985
|
try {
|
|
38997
38986
|
if (!fs.existsSync(NOTES_DB_PATH)) return false;
|
|
38998
|
-
|
|
38987
|
+
execFileSync2("sqlite3", ["-readonly", NOTES_DB_PATH, "SELECT 1;"], {
|
|
38999
38988
|
encoding: "utf8",
|
|
39000
38989
|
timeout: 3e3,
|
|
39001
38990
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -39014,7 +39003,7 @@ function queryNoteData(noteId) {
|
|
|
39014
39003
|
const pk = pkMatch[1];
|
|
39015
39004
|
const query = `SELECT hex(nd.ZDATA) FROM ZICNOTEDATA nd JOIN ZICCLOUDSYNCINGOBJECT n ON nd.ZNOTE = n.Z_PK WHERE n.Z_PK = ${pk};`;
|
|
39016
39005
|
try {
|
|
39017
|
-
const result =
|
|
39006
|
+
const result = execFileSync2("sqlite3", ["-readonly", NOTES_DB_PATH, query], {
|
|
39018
39007
|
encoding: "utf8",
|
|
39019
39008
|
timeout: 5e3,
|
|
39020
39009
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41366,7 +41355,7 @@ var AppleNotesManager = class {
|
|
|
41366
41355
|
};
|
|
41367
41356
|
|
|
41368
41357
|
// src/utils/syncDetection.ts
|
|
41369
|
-
import { execFileSync as
|
|
41358
|
+
import { execFileSync as execFileSync3 } from "child_process";
|
|
41370
41359
|
import * as fs2 from "fs";
|
|
41371
41360
|
import * as path2 from "path";
|
|
41372
41361
|
import * as os2 from "os";
|
|
@@ -41407,7 +41396,7 @@ function getSyncStatus(useCache = true) {
|
|
|
41407
41396
|
WHERE ZCURRENTLOCALVERSION > ZLATESTVERSIONSYNCEDTOCLOUD
|
|
41408
41397
|
AND ZLATESTVERSIONSYNCEDTOCLOUD IS NOT NULL;
|
|
41409
41398
|
`;
|
|
41410
|
-
const result =
|
|
41399
|
+
const result = execFileSync3(
|
|
41411
41400
|
"sqlite3",
|
|
41412
41401
|
["-readonly", NOTES_DB_PATH2, query.replace(/\n/g, " ")],
|
|
41413
41402
|
{
|
|
@@ -41466,7 +41455,7 @@ function withSyncAwarenessSync(operation, fn) {
|
|
|
41466
41455
|
}
|
|
41467
41456
|
|
|
41468
41457
|
// src/utils/noteMetadata.ts
|
|
41469
|
-
import { execFileSync as
|
|
41458
|
+
import { execFileSync as execFileSync4 } from "child_process";
|
|
41470
41459
|
import * as fs3 from "fs";
|
|
41471
41460
|
import * as path3 from "path";
|
|
41472
41461
|
import * as os3 from "os";
|
|
@@ -41487,7 +41476,7 @@ var COLUMN_MAP = [
|
|
|
41487
41476
|
{ key: "smartFolderQuery", column: "ZSMARTFOLDERQUERYJSON", type: "text" }
|
|
41488
41477
|
];
|
|
41489
41478
|
function runSqlite(query) {
|
|
41490
|
-
return
|
|
41479
|
+
return execFileSync4("sqlite3", ["-readonly", NOTES_DB_PATH3, query], {
|
|
41491
41480
|
encoding: "utf8",
|
|
41492
41481
|
timeout: 5e3,
|
|
41493
41482
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -41626,7 +41615,7 @@ function strippedImagesWarning(stripped) {
|
|
|
41626
41615
|
}
|
|
41627
41616
|
|
|
41628
41617
|
// src/tools/doctor.ts
|
|
41629
|
-
import { spawnSync
|
|
41618
|
+
import { spawnSync } from "child_process";
|
|
41630
41619
|
function runDoctor(manager) {
|
|
41631
41620
|
const checks = [];
|
|
41632
41621
|
const hc = manager.healthCheck();
|
|
@@ -41664,7 +41653,7 @@ function runDoctor(manager) {
|
|
|
41664
41653
|
function checkNodeRuntimeSignature() {
|
|
41665
41654
|
const name = "Node runtime signature";
|
|
41666
41655
|
try {
|
|
41667
|
-
const r =
|
|
41656
|
+
const r = spawnSync("codesign", ["-dvvv", process.execPath], { encoding: "utf8" });
|
|
41668
41657
|
const out = `${r.stdout ?? ""}${r.stderr ?? ""}`;
|
|
41669
41658
|
if (r.error || !out.trim()) {
|
|
41670
41659
|
return {
|
package/package.json
CHANGED