safari-mcp 2.22.9 → 2.22.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/index.js +6 -0
- package/node-compat.js +22 -0
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -37,6 +37,12 @@ import {
|
|
|
37
37
|
readProfileIdentities,
|
|
38
38
|
describeProfileIdentities,
|
|
39
39
|
} from "./worker-ledger.js";
|
|
40
|
+
import { Socket } from "node:net";
|
|
41
|
+
import { ignoreTypeOfServiceEinval } from "./node-compat.js";
|
|
42
|
+
|
|
43
|
+
// Before the first fetch: a secondary's /proxy-check to a primary that just went away
|
|
44
|
+
// must reject, not end the process (#140).
|
|
45
|
+
ignoreTypeOfServiceEinval(Socket.prototype);
|
|
40
46
|
|
|
41
47
|
const MAX_BODY_SIZE = 10 * 1024 * 1024; // 10 MB cap on POST body — prevents DoS
|
|
42
48
|
|
package/node-compat.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Node 24's bundled undici (7.x) calls socket.setTypeOfService() on every HTTP/1.1
|
|
2
|
+
// write without a catch. On macOS, a socket whose peer has just reset makes that call
|
|
3
|
+
// throw EINVAL from inside an I/O callback, where no try/catch around fetch() can reach
|
|
4
|
+
// it, so the whole process exits (#140: a secondary died this way exactly when its
|
|
5
|
+
// primary went away, instead of taking the bridge port over). undici 8.8.0 ignores
|
|
6
|
+
// these errors (nodejs/undici#5547, Node 26.5.1+); Node 24 never got the fix.
|
|
7
|
+
// Swallowing only EINVAL leaves the request to fail the ordinary way, as a rejected
|
|
8
|
+
// fetch. Type of service is a QoS hint, so skipping it changes nothing else.
|
|
9
|
+
export function ignoreTypeOfServiceEinval(proto) {
|
|
10
|
+
const original = proto.setTypeOfService;
|
|
11
|
+
if (typeof original !== "function" || original.ignoresEinval) return;
|
|
12
|
+
const wrapped = function (...args) {
|
|
13
|
+
try {
|
|
14
|
+
return original.apply(this, args);
|
|
15
|
+
} catch (err) {
|
|
16
|
+
if (err?.code === "EINVAL") return this;
|
|
17
|
+
throw err;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
wrapped.ignoresEinval = true;
|
|
21
|
+
proto.setTypeOfService = wrapped;
|
|
22
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "safari-mcp",
|
|
3
|
-
"version": "2.22.
|
|
3
|
+
"version": "2.22.10",
|
|
4
4
|
"mcpName": "io.github.achiya-automation/safari-mcp",
|
|
5
5
|
"description": "Safari browser automation for AI agents — native macOS, zero Chrome overhead. 98 tools via AppleScript + JavaScript.",
|
|
6
6
|
"type": "module",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"ownership-state.js",
|
|
72
72
|
"image-size.js",
|
|
73
73
|
"worker-ledger.js",
|
|
74
|
+
"node-compat.js",
|
|
74
75
|
"mcp-helpers.js",
|
|
75
76
|
"injected-validators.js",
|
|
76
77
|
"injected-escape.js",
|