@socketsecurity/mcp 0.0.16 → 0.0.18
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/CHANGELOG.md +19 -0
- package/README.md +221 -184
- package/dist/index.cjs +58128 -0
- package/dist/index.d.ts +4 -0
- package/hooks/socket-gate/README.md +117 -0
- package/hooks/socket-gate/index.mts +289 -0
- package/hooks/socket-gate/socket-gate.cjs +1047 -0
- package/package.json +91 -56
- package/index.d.ts +0 -3
- package/index.d.ts.map +0 -1
- package/index.js +0 -353
- package/mock-client/debug-client.d.ts +0 -3
- package/mock-client/debug-client.d.ts.map +0 -1
- package/mock-client/debug-client.js +0 -134
- package/mock-client/http-client.d.ts +0 -3
- package/mock-client/http-client.d.ts.map +0 -1
- package/mock-client/http-client.js +0 -123
- package/mock-client/stdio-client.d.ts +0 -3
- package/mock-client/stdio-client.d.ts.map +0 -1
- package/mock-client/stdio-client.js +0 -52
|
@@ -0,0 +1,1047 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/* Socket gate hook — bundled with rolldown */
|
|
4
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
5
|
+
//#region \0rolldown/runtime.js
|
|
6
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
let node_fs = require("node:fs");
|
|
10
|
+
let node_process = require("node:process");
|
|
11
|
+
let node_url = require("node:url");
|
|
12
|
+
|
|
13
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/constants/sentinels.js
|
|
14
|
+
var require_sentinels = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
15
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
16
|
+
/**
|
|
17
|
+
* @file Core primitives and fundamental constants. Holds sentinels,
|
|
18
|
+
* unknown/empty tokens, the internals symbol, and a few shared env-var name
|
|
19
|
+
* strings. Intentionally kept small - prefer moving constants to a more
|
|
20
|
+
* specific `src/constants/*` module when possible.
|
|
21
|
+
*/
|
|
22
|
+
const kInternalsSymbol = Symbol("@socketregistry.constants.internals");
|
|
23
|
+
const LOOP_SENTINEL = 1e6;
|
|
24
|
+
const UNKNOWN_ERROR = "Unknown error";
|
|
25
|
+
const UNKNOWN_VALUE = "<unknown>";
|
|
26
|
+
const EMPTY_FILE = "/* empty */\n";
|
|
27
|
+
const EMPTY_VALUE = "<value>";
|
|
28
|
+
const UNDEFINED_TOKEN = void 0;
|
|
29
|
+
const COLUMN_LIMIT = 80;
|
|
30
|
+
const V = "v";
|
|
31
|
+
const NODE_AUTH_TOKEN = "NODE_AUTH_TOKEN";
|
|
32
|
+
const NODE_ENV = "NODE_ENV";
|
|
33
|
+
exports.COLUMN_LIMIT = COLUMN_LIMIT;
|
|
34
|
+
exports.EMPTY_FILE = EMPTY_FILE;
|
|
35
|
+
exports.EMPTY_VALUE = EMPTY_VALUE;
|
|
36
|
+
exports.LOOP_SENTINEL = LOOP_SENTINEL;
|
|
37
|
+
exports.NODE_AUTH_TOKEN = NODE_AUTH_TOKEN;
|
|
38
|
+
exports.NODE_ENV = NODE_ENV;
|
|
39
|
+
exports.UNDEFINED_TOKEN = UNDEFINED_TOKEN;
|
|
40
|
+
exports.UNKNOWN_ERROR = UNKNOWN_ERROR;
|
|
41
|
+
exports.UNKNOWN_VALUE = UNKNOWN_VALUE;
|
|
42
|
+
exports.V = V;
|
|
43
|
+
exports.kInternalsSymbol = kInternalsSymbol;
|
|
44
|
+
}));
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/constants/runtime.js
|
|
48
|
+
var require_runtime = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
49
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
50
|
+
/**
|
|
51
|
+
* @file Runtime environment detection constants. All checks use only
|
|
52
|
+
* `typeof`-safe global probes so this module is safe to import in browser,
|
|
53
|
+
* Node.js, Deno, Bun, and bundled contexts alike.
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* True when running inside a Node.js process. Detected via
|
|
57
|
+
* `process.versions.node` — present in Node, absent in browsers and Deno/Bun
|
|
58
|
+
* which expose a different `process.versions` shape (or no `process` at all).
|
|
59
|
+
*/
|
|
60
|
+
const IS_NODE = typeof process !== "undefined" && typeof process.versions !== "undefined" && typeof process.versions.node === "string";
|
|
61
|
+
/**
|
|
62
|
+
* True when running in a browser context (window + document both defined).
|
|
63
|
+
* Note: Chrome extensions have `window` in popup contexts but not in service
|
|
64
|
+
* workers — check `IS_SERVICE_WORKER` for that case.
|
|
65
|
+
*/
|
|
66
|
+
const IS_BROWSER = typeof window !== "undefined" && typeof document !== "undefined";
|
|
67
|
+
/**
|
|
68
|
+
* True when running inside a Web Worker / Chrome MV3 service worker. `self` is
|
|
69
|
+
* defined without `window` in worker contexts.
|
|
70
|
+
*/
|
|
71
|
+
const IS_WORKER = typeof self !== "undefined" && typeof window === "undefined" && typeof document === "undefined";
|
|
72
|
+
exports.IS_BROWSER = IS_BROWSER;
|
|
73
|
+
exports.IS_NODE = IS_NODE;
|
|
74
|
+
exports.IS_WORKER = IS_WORKER;
|
|
75
|
+
}));
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/node/module.js
|
|
79
|
+
var require_module = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
80
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
81
|
+
const require_constants_runtime = require_runtime();
|
|
82
|
+
let cachedModule;
|
|
83
|
+
function getNodeModule() {
|
|
84
|
+
if (!require_constants_runtime.IS_NODE) return;
|
|
85
|
+
return cachedModule ??= /*@__PURE__*/ require("node:module");
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Lazy + cached reference to `node:module`'s `isBuiltin(name)`. First call
|
|
89
|
+
* resolves the binding; subsequent calls dispatch through the cached function
|
|
90
|
+
* reference. Safe to detach — `isBuiltin` is `this`-free.
|
|
91
|
+
*
|
|
92
|
+
* Returns `false` in browser / non-CJS environments where `require` is
|
|
93
|
+
* undefined — no `node:` modules are built-in there.
|
|
94
|
+
*
|
|
95
|
+
* Single source of truth for "is this a Node builtin?" probes across socket-lib
|
|
96
|
+
* (used by the smol-binding loaders to gate `require('node:smol-*')`).
|
|
97
|
+
*/
|
|
98
|
+
let cachedIsBuiltin;
|
|
99
|
+
function isNodeBuiltin(name) {
|
|
100
|
+
if (!require_constants_runtime.IS_NODE) return false;
|
|
101
|
+
return (cachedIsBuiltin ??= getNodeModule().isBuiltin)(name);
|
|
102
|
+
}
|
|
103
|
+
exports.getNodeModule = getNodeModule;
|
|
104
|
+
exports.isNodeBuiltin = isNodeBuiltin;
|
|
105
|
+
}));
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/smol/detect.js
|
|
109
|
+
var require_detect = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
110
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
111
|
+
const require_node_module = require_module();
|
|
112
|
+
/**
|
|
113
|
+
* @file Smol detection + lazy-loader for `node:smol-util`. Two
|
|
114
|
+
* responsibilities:
|
|
115
|
+
*
|
|
116
|
+
* 1. `isSmol()` — memoized boolean detector for socket-btm's smol Node binary.
|
|
117
|
+
* Mirrors `isSeaBinary()` from `src/sea.ts`. Probes via
|
|
118
|
+
* `node:module.isBuiltin('node:smol-util')` since only the smol binary
|
|
119
|
+
* registers any `node:smol-*` builtins.
|
|
120
|
+
* 2. `getSmolUtil()` — lazy-loader for the `node:smol-util` binding, which
|
|
121
|
+
* provides native `uncurryThis` and `applyBind` (single V8 dispatch via
|
|
122
|
+
* `args.Data()` + `v8::Function::Call`, skipping the BoundFunction adapter
|
|
123
|
+
* + `Function.prototype.call` trampoline that the JS form
|
|
124
|
+
* `bind.bind(call)(fn)` hits twice per invocation). ~2x faster on hot
|
|
125
|
+
* uncurried-call sites. `getSmolUtil()` returns `undefined` on stock Node
|
|
126
|
+
* + non-Node runtimes. Result is cached across calls; the lazy-loader
|
|
127
|
+
* follows the same shape as `src/node/fs.ts` etc.
|
|
128
|
+
*
|
|
129
|
+
* @see https://github.com/SocketDev/socket-btm — socket-btm builds
|
|
130
|
+
* the smol binary that exposes the `node:smol-util` binding.
|
|
131
|
+
*/
|
|
132
|
+
/**
|
|
133
|
+
* Cached smol-binary detection result.
|
|
134
|
+
*/
|
|
135
|
+
let isSmolCache;
|
|
136
|
+
/**
|
|
137
|
+
* Cached `node:smol-util` binding. `null` = probed and unavailable; `undefined`
|
|
138
|
+
* = not yet probed. JS truthiness collapses both to "no binding" at the call
|
|
139
|
+
* site.
|
|
140
|
+
*/
|
|
141
|
+
let smolUtilCache;
|
|
142
|
+
let smolUtilProbed = false;
|
|
143
|
+
/**
|
|
144
|
+
* Returns `node:smol-util` when running on the smol Node binary, otherwise
|
|
145
|
+
* `undefined`. Result is cached across calls.
|
|
146
|
+
*/
|
|
147
|
+
function getSmolUtil() {
|
|
148
|
+
if (!smolUtilProbed) {
|
|
149
|
+
smolUtilProbed = true;
|
|
150
|
+
/* c8 ignore start - smol Node binary only. */
|
|
151
|
+
if (require_node_module.isNodeBuiltin("node:smol-util")) smolUtilCache = require("node:smol-util");
|
|
152
|
+
}
|
|
153
|
+
return smolUtilCache;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Detect if the current process is running on socket-btm's smol Node binary.
|
|
157
|
+
* Memoized on first call.
|
|
158
|
+
*
|
|
159
|
+
* Defensive across runtimes: returns `false` on stock Node, browsers (no
|
|
160
|
+
* `node:module`), Deno / Bun (different module resolution), and worker threads
|
|
161
|
+
* (each has its own builtin table).
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ;```ts
|
|
165
|
+
* import { isSmol } from '@socketsecurity/lib/smol/detect'
|
|
166
|
+
*
|
|
167
|
+
* if (isSmol()) {
|
|
168
|
+
* // running on the smol binary; native fast paths available
|
|
169
|
+
* }
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
function isSmol() {
|
|
173
|
+
if (isSmolCache === void 0) isSmolCache = require_node_module.isNodeBuiltin("node:smol-util");
|
|
174
|
+
return isSmolCache;
|
|
175
|
+
}
|
|
176
|
+
exports.getSmolUtil = getSmolUtil;
|
|
177
|
+
exports.isSmol = isSmol;
|
|
178
|
+
}));
|
|
179
|
+
|
|
180
|
+
//#endregion
|
|
181
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/primordials/uncurry.js
|
|
182
|
+
var require_uncurry = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
183
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
184
|
+
/**
|
|
185
|
+
* @file `uncurryThis` and the cluster of helpers built atop it. Mirrors
|
|
186
|
+
* Node.js's internal/per_context/primordials.js. Every other primordials leaf
|
|
187
|
+
* depends on `uncurryThis` to expose prototype-method primordials, so this
|
|
188
|
+
* file must be import-safe before any of them. Smol fast paths
|
|
189
|
+
* (`node:smol-util`) replace the JS forms when running on socket-btm's smol
|
|
190
|
+
* Node binary; stock Node and other runtimes fall back to the standard
|
|
191
|
+
* `bind.bind(call)` shape. **IMPORTANT**: do not destructure on `globalThis`
|
|
192
|
+
* or `Reflect` here. tsgo has a bug that mis-transpiles destructured exports.
|
|
193
|
+
* See: https://github.com/SocketDev/socket-packageurl-js/issues/3.
|
|
194
|
+
*/
|
|
195
|
+
const smolUtil = require_detect().getSmolUtil();
|
|
196
|
+
const { apply, bind, call } = Function.prototype;
|
|
197
|
+
const uncurryThis = smolUtil?.uncurryThis ?? bind.bind(call);
|
|
198
|
+
const applyBind = smolUtil?.applyBind ?? bind.bind(apply);
|
|
199
|
+
const applyBoundForSafe = applyBind;
|
|
200
|
+
const applySafe = smolUtil?.applySafe ?? ((fn) => {
|
|
201
|
+
const apply2 = applyBoundForSafe(fn);
|
|
202
|
+
return (self, args) => {
|
|
203
|
+
try {
|
|
204
|
+
return apply2(self, args);
|
|
205
|
+
} catch {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
});
|
|
210
|
+
const bindCallFallback = ((fn, thisArg, ...presetArgs) => Function.prototype.bind.apply(fn, [thisArg, ...presetArgs]));
|
|
211
|
+
const bindCall = smolUtil?.bindCall ?? bindCallFallback;
|
|
212
|
+
const weakRefSafe = smolUtil?.weakRefSafe ?? ((target) => {
|
|
213
|
+
try {
|
|
214
|
+
return new WeakRef(target);
|
|
215
|
+
} catch {
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
exports.applyBind = applyBind;
|
|
220
|
+
exports.applySafe = applySafe;
|
|
221
|
+
exports.bindCall = bindCall;
|
|
222
|
+
exports.uncurryThis = uncurryThis;
|
|
223
|
+
exports.weakRefSafe = weakRefSafe;
|
|
224
|
+
}));
|
|
225
|
+
|
|
226
|
+
//#endregion
|
|
227
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/smol/primordial.js
|
|
228
|
+
var require_primordial = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
229
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
230
|
+
const require_node_module = require_module();
|
|
231
|
+
/**
|
|
232
|
+
* @file Lazy-loader for socket-btm's `node:smol-primordial` binding.
|
|
233
|
+
* `node:smol-primordial` provides V8 Fast API typed implementations of Math.*
|
|
234
|
+
* and Number.is* primordials, registered with `CFunction::Make()` so TurboFan
|
|
235
|
+
* inlines them directly into JIT- compiled JS callers. Bypasses the
|
|
236
|
+
* FunctionCallbackInfo trampoline entirely — ~30-50% gain on hot loops where
|
|
237
|
+
* V8 doesn't already auto-inline. Returns `undefined` on stock Node +
|
|
238
|
+
* non-Node runtimes. Result is cached across calls.
|
|
239
|
+
*
|
|
240
|
+
* @internal — used by `src/primordials.ts` to resolve smol-aware
|
|
241
|
+
* Math.* / Number.is* fast paths. Most callers should use the
|
|
242
|
+
* standard `primordials` exports, which already route through this
|
|
243
|
+
* when smol is present.
|
|
244
|
+
*
|
|
245
|
+
* @see https://v8.dev/blog/v8-release-99 — V8 Fast API Calls overview
|
|
246
|
+
*/
|
|
247
|
+
let smolPrimordial;
|
|
248
|
+
let smolPrimordialProbed = false;
|
|
249
|
+
/**
|
|
250
|
+
* Returns `node:smol-primordial` when running on the smol Node binary,
|
|
251
|
+
* otherwise `undefined`. Result is cached across calls.
|
|
252
|
+
*/
|
|
253
|
+
function getSmolPrimordial() {
|
|
254
|
+
if (!smolPrimordialProbed) {
|
|
255
|
+
smolPrimordialProbed = true;
|
|
256
|
+
/* c8 ignore start - smol Node binary only. */
|
|
257
|
+
if (require_node_module.isNodeBuiltin("node:smol-primordial")) smolPrimordial = require("node:smol-primordial");
|
|
258
|
+
}
|
|
259
|
+
return smolPrimordial;
|
|
260
|
+
}
|
|
261
|
+
exports.getSmolPrimordial = getSmolPrimordial;
|
|
262
|
+
}));
|
|
263
|
+
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/primordials/string.js
|
|
266
|
+
var require_string = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
267
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
268
|
+
const require_primordials_uncurry = require_uncurry();
|
|
269
|
+
/**
|
|
270
|
+
* @file Safe references to `String` static methods and prototype methods.
|
|
271
|
+
* `StringPrototypeCharCodeAt` prefers the smol Fast API binding for ASCII
|
|
272
|
+
* inputs (single byte load) and translates the `-1` Fast API sentinel back to
|
|
273
|
+
* `NaN` to preserve spec parity. Two-byte strings fall back to the uncurried
|
|
274
|
+
* `String.prototype.charCodeAt`.
|
|
275
|
+
*
|
|
276
|
+
* ## Fast API surface — and why it's small
|
|
277
|
+
*
|
|
278
|
+
* Mirrors the design rationale from socket-btm's `primordial_binding.cc`
|
|
279
|
+
* (lines 41-72). The smol Fast API exposes exactly one string op
|
|
280
|
+
* (`stringCharCodeAt`) because that's the one shape where the C++ trampoline
|
|
281
|
+
* genuinely beats V8's existing hot path: a single ASCII byte load, no
|
|
282
|
+
* encoding dispatch, no HandleScope, returns a primitive. String **searches**
|
|
283
|
+
* (`startsWith` / `endsWith` / `includes` / `indexOf` / `lastIndexOf`) are
|
|
284
|
+
* intentionally NOT exposed. V8's existing hot path dispatches on encoding
|
|
285
|
+
* and runs native SIMD memcmp — a Fast API binding would add overhead without
|
|
286
|
+
* winning. Same for `Map.has` / `Set.has` / `Array.includes`. Fast API also
|
|
287
|
+
* has a hard constraint: a fast-path function cannot return a new V8 object —
|
|
288
|
+
* only primitives, Local<Value/Object/Array>, or FastOneByteString. That
|
|
289
|
+
* rules out anything that produces a new string (`slice`, `substring`,
|
|
290
|
+
* `toUpperCase`, `concat`, `repeat`, `padStart`/`padEnd`, formatted-number)
|
|
291
|
+
* from ever being a Fast API win on the return path. Net: the current surface
|
|
292
|
+
* is approximately the ceiling. Adding more Fast API string ops without a
|
|
293
|
+
* flamegraph showing the cost is a regression risk, not a perf win. See
|
|
294
|
+
* `socket-btm/packages/node-smol-builder/additions/source-patched/`
|
|
295
|
+
* `src/socketsecurity/primordial/primordial_binding.cc:41-72` for the
|
|
296
|
+
* canonical design statement.
|
|
297
|
+
*/
|
|
298
|
+
const smolPrimordial = require_primordial().getSmolPrimordial();
|
|
299
|
+
const StringCtor = String;
|
|
300
|
+
const StringFromCharCode = String.fromCharCode;
|
|
301
|
+
const StringFromCodePoint = String.fromCodePoint;
|
|
302
|
+
const StringRaw = String.raw;
|
|
303
|
+
const StringPrototypeAt = require_primordials_uncurry.uncurryThis(String.prototype.at);
|
|
304
|
+
const StringPrototypeCharAt = require_primordials_uncurry.uncurryThis(String.prototype.charAt);
|
|
305
|
+
const smolCharCodeAt = smolPrimordial?.stringCharCodeAt;
|
|
306
|
+
/* c8 ignore start - smol Node fast path unreachable on stock Node test runner */
|
|
307
|
+
const StringPrototypeCharCodeAt = smolCharCodeAt ? (s, i) => {
|
|
308
|
+
const code = smolCharCodeAt(s, i);
|
|
309
|
+
return code === -1 ? NaN : code;
|
|
310
|
+
} : require_primordials_uncurry.uncurryThis(String.prototype.charCodeAt);
|
|
311
|
+
/* c8 ignore stop */
|
|
312
|
+
const StringPrototypeCodePointAt = require_primordials_uncurry.uncurryThis(String.prototype.codePointAt);
|
|
313
|
+
const StringPrototypeConcat = require_primordials_uncurry.uncurryThis(String.prototype.concat);
|
|
314
|
+
const StringPrototypeEndsWith = require_primordials_uncurry.uncurryThis(String.prototype.endsWith);
|
|
315
|
+
const StringPrototypeIncludes = require_primordials_uncurry.uncurryThis(String.prototype.includes);
|
|
316
|
+
const StringPrototypeIndexOf = require_primordials_uncurry.uncurryThis(String.prototype.indexOf);
|
|
317
|
+
const StringPrototypeIsWellFormed = smolPrimordial?.stringIsWellFormed ?? require_primordials_uncurry.uncurryThis(String.prototype.isWellFormed);
|
|
318
|
+
const StringPrototypeLastIndexOf = require_primordials_uncurry.uncurryThis(String.prototype.lastIndexOf);
|
|
319
|
+
const StringPrototypeLocaleCompare = require_primordials_uncurry.uncurryThis(String.prototype.localeCompare);
|
|
320
|
+
const StringPrototypeMatch = require_primordials_uncurry.uncurryThis(String.prototype.match);
|
|
321
|
+
const StringPrototypeMatchAll = require_primordials_uncurry.uncurryThis(String.prototype.matchAll);
|
|
322
|
+
const StringPrototypeNormalize = require_primordials_uncurry.uncurryThis(String.prototype.normalize);
|
|
323
|
+
const StringPrototypePadEnd = require_primordials_uncurry.uncurryThis(String.prototype.padEnd);
|
|
324
|
+
const StringPrototypePadStart = require_primordials_uncurry.uncurryThis(String.prototype.padStart);
|
|
325
|
+
const StringPrototypeRepeat = require_primordials_uncurry.uncurryThis(String.prototype.repeat);
|
|
326
|
+
const StringPrototypeReplace = require_primordials_uncurry.uncurryThis(String.prototype.replace);
|
|
327
|
+
const StringPrototypeReplaceAll = require_primordials_uncurry.uncurryThis(String.prototype.replaceAll);
|
|
328
|
+
const StringPrototypeSearch = require_primordials_uncurry.uncurryThis(String.prototype.search);
|
|
329
|
+
const StringPrototypeSlice = require_primordials_uncurry.uncurryThis(String.prototype.slice);
|
|
330
|
+
const StringPrototypeSplit = require_primordials_uncurry.uncurryThis(String.prototype.split);
|
|
331
|
+
const StringPrototypeStartsWith = require_primordials_uncurry.uncurryThis(String.prototype.startsWith);
|
|
332
|
+
const StringPrototypeSubstring = require_primordials_uncurry.uncurryThis(String.prototype.substring);
|
|
333
|
+
const StringPrototypeToLocaleLowerCase = require_primordials_uncurry.uncurryThis(String.prototype.toLocaleLowerCase);
|
|
334
|
+
const StringPrototypeToLocaleUpperCase = require_primordials_uncurry.uncurryThis(String.prototype.toLocaleUpperCase);
|
|
335
|
+
const StringPrototypeToLowerCase = require_primordials_uncurry.uncurryThis(String.prototype.toLowerCase);
|
|
336
|
+
const StringPrototypeToString = require_primordials_uncurry.uncurryThis(String.prototype.toString);
|
|
337
|
+
const StringPrototypeToUpperCase = require_primordials_uncurry.uncurryThis(String.prototype.toUpperCase);
|
|
338
|
+
const StringPrototypeToWellFormed = require_primordials_uncurry.uncurryThis(String.prototype.toWellFormed);
|
|
339
|
+
const StringPrototypeTrim = require_primordials_uncurry.uncurryThis(String.prototype.trim);
|
|
340
|
+
const StringPrototypeTrimEnd = require_primordials_uncurry.uncurryThis(String.prototype.trimEnd);
|
|
341
|
+
const StringPrototypeTrimStart = require_primordials_uncurry.uncurryThis(String.prototype.trimStart);
|
|
342
|
+
const StringPrototypeValueOf = require_primordials_uncurry.uncurryThis(String.prototype.valueOf);
|
|
343
|
+
exports.StringCtor = StringCtor;
|
|
344
|
+
exports.StringFromCharCode = StringFromCharCode;
|
|
345
|
+
exports.StringFromCodePoint = StringFromCodePoint;
|
|
346
|
+
exports.StringPrototypeAt = StringPrototypeAt;
|
|
347
|
+
exports.StringPrototypeCharAt = StringPrototypeCharAt;
|
|
348
|
+
exports.StringPrototypeCharCodeAt = StringPrototypeCharCodeAt;
|
|
349
|
+
exports.StringPrototypeCodePointAt = StringPrototypeCodePointAt;
|
|
350
|
+
exports.StringPrototypeConcat = StringPrototypeConcat;
|
|
351
|
+
exports.StringPrototypeEndsWith = StringPrototypeEndsWith;
|
|
352
|
+
exports.StringPrototypeIncludes = StringPrototypeIncludes;
|
|
353
|
+
exports.StringPrototypeIndexOf = StringPrototypeIndexOf;
|
|
354
|
+
exports.StringPrototypeIsWellFormed = StringPrototypeIsWellFormed;
|
|
355
|
+
exports.StringPrototypeLastIndexOf = StringPrototypeLastIndexOf;
|
|
356
|
+
exports.StringPrototypeLocaleCompare = StringPrototypeLocaleCompare;
|
|
357
|
+
exports.StringPrototypeMatch = StringPrototypeMatch;
|
|
358
|
+
exports.StringPrototypeMatchAll = StringPrototypeMatchAll;
|
|
359
|
+
exports.StringPrototypeNormalize = StringPrototypeNormalize;
|
|
360
|
+
exports.StringPrototypePadEnd = StringPrototypePadEnd;
|
|
361
|
+
exports.StringPrototypePadStart = StringPrototypePadStart;
|
|
362
|
+
exports.StringPrototypeRepeat = StringPrototypeRepeat;
|
|
363
|
+
exports.StringPrototypeReplace = StringPrototypeReplace;
|
|
364
|
+
exports.StringPrototypeReplaceAll = StringPrototypeReplaceAll;
|
|
365
|
+
exports.StringPrototypeSearch = StringPrototypeSearch;
|
|
366
|
+
exports.StringPrototypeSlice = StringPrototypeSlice;
|
|
367
|
+
exports.StringPrototypeSplit = StringPrototypeSplit;
|
|
368
|
+
exports.StringPrototypeStartsWith = StringPrototypeStartsWith;
|
|
369
|
+
exports.StringPrototypeSubstring = StringPrototypeSubstring;
|
|
370
|
+
exports.StringPrototypeToLocaleLowerCase = StringPrototypeToLocaleLowerCase;
|
|
371
|
+
exports.StringPrototypeToLocaleUpperCase = StringPrototypeToLocaleUpperCase;
|
|
372
|
+
exports.StringPrototypeToLowerCase = StringPrototypeToLowerCase;
|
|
373
|
+
exports.StringPrototypeToString = StringPrototypeToString;
|
|
374
|
+
exports.StringPrototypeToUpperCase = StringPrototypeToUpperCase;
|
|
375
|
+
exports.StringPrototypeToWellFormed = StringPrototypeToWellFormed;
|
|
376
|
+
exports.StringPrototypeTrim = StringPrototypeTrim;
|
|
377
|
+
exports.StringPrototypeTrimEnd = StringPrototypeTrimEnd;
|
|
378
|
+
exports.StringPrototypeTrimStart = StringPrototypeTrimStart;
|
|
379
|
+
exports.StringPrototypeValueOf = StringPrototypeValueOf;
|
|
380
|
+
exports.StringRaw = StringRaw;
|
|
381
|
+
}));
|
|
382
|
+
|
|
383
|
+
//#endregion
|
|
384
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/primordials/object.js
|
|
385
|
+
var require_object = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
386
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
387
|
+
const require_primordials_uncurry = require_uncurry();
|
|
388
|
+
/**
|
|
389
|
+
* @file Safe references to `Object` static methods and prototype methods. Annex
|
|
390
|
+
* B legacy accessor methods (`__defineGetter__`, `__lookupGetter__`, etc.)
|
|
391
|
+
* are exposed alongside the canonical static methods — implementations exist
|
|
392
|
+
* in V8, SpiderMonkey, and JavaScriptCore even though the spec calls them
|
|
393
|
+
* "normative optional".
|
|
394
|
+
*/
|
|
395
|
+
const ObjectCtor = Object;
|
|
396
|
+
const ObjectAssign = Object.assign;
|
|
397
|
+
const ObjectCreate = Object.create;
|
|
398
|
+
const ObjectDefineProperties = Object.defineProperties;
|
|
399
|
+
const ObjectDefineProperty = Object.defineProperty;
|
|
400
|
+
const ObjectEntries = Object.entries;
|
|
401
|
+
const ObjectFreeze = Object.freeze;
|
|
402
|
+
const ObjectFromEntries = Object.fromEntries;
|
|
403
|
+
const ObjectGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
404
|
+
const ObjectGetOwnPropertyDescriptors = Object.getOwnPropertyDescriptors;
|
|
405
|
+
const ObjectGetOwnPropertyNames = Object.getOwnPropertyNames;
|
|
406
|
+
const ObjectGetOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
407
|
+
const ObjectGetPrototypeOf = Object.getPrototypeOf;
|
|
408
|
+
const ObjectHasOwn = Object.hasOwn;
|
|
409
|
+
const ObjectIs = Object.is;
|
|
410
|
+
const ObjectIsExtensible = Object.isExtensible;
|
|
411
|
+
const ObjectIsFrozen = Object.isFrozen;
|
|
412
|
+
const ObjectIsSealed = Object.isSealed;
|
|
413
|
+
const ObjectKeys = Object.keys;
|
|
414
|
+
const ObjectPreventExtensions = Object.preventExtensions;
|
|
415
|
+
const ObjectSeal = Object.seal;
|
|
416
|
+
const ObjectSetPrototypeOf = Object.setPrototypeOf;
|
|
417
|
+
const ObjectValues = Object.values;
|
|
418
|
+
const ObjectPrototype = Object.prototype;
|
|
419
|
+
const ObjectPrototypeHasOwnProperty = require_primordials_uncurry.uncurryThis(Object.prototype.hasOwnProperty);
|
|
420
|
+
const ObjectPrototypeIsPrototypeOf = require_primordials_uncurry.uncurryThis(Object.prototype.isPrototypeOf);
|
|
421
|
+
const ObjectPrototypePropertyIsEnumerable = require_primordials_uncurry.uncurryThis(Object.prototype.propertyIsEnumerable);
|
|
422
|
+
const ObjectPrototypeToString = require_primordials_uncurry.uncurryThis(Object.prototype.toString);
|
|
423
|
+
const ObjectPrototypeValueOf = require_primordials_uncurry.uncurryThis(Object.prototype.valueOf);
|
|
424
|
+
const objectProto = Object.prototype;
|
|
425
|
+
const ObjectPrototypeDefineGetter = require_primordials_uncurry.uncurryThis(objectProto.__defineGetter__);
|
|
426
|
+
const ObjectPrototypeDefineSetter = require_primordials_uncurry.uncurryThis(objectProto.__defineSetter__);
|
|
427
|
+
const ObjectPrototypeLookupGetter = require_primordials_uncurry.uncurryThis(objectProto.__lookupGetter__);
|
|
428
|
+
const ObjectPrototypeLookupSetter = require_primordials_uncurry.uncurryThis(objectProto.__lookupSetter__);
|
|
429
|
+
exports.ObjectAssign = ObjectAssign;
|
|
430
|
+
exports.ObjectCreate = ObjectCreate;
|
|
431
|
+
exports.ObjectCtor = ObjectCtor;
|
|
432
|
+
exports.ObjectDefineProperties = ObjectDefineProperties;
|
|
433
|
+
exports.ObjectDefineProperty = ObjectDefineProperty;
|
|
434
|
+
exports.ObjectEntries = ObjectEntries;
|
|
435
|
+
exports.ObjectFreeze = ObjectFreeze;
|
|
436
|
+
exports.ObjectFromEntries = ObjectFromEntries;
|
|
437
|
+
exports.ObjectGetOwnPropertyDescriptor = ObjectGetOwnPropertyDescriptor;
|
|
438
|
+
exports.ObjectGetOwnPropertyDescriptors = ObjectGetOwnPropertyDescriptors;
|
|
439
|
+
exports.ObjectGetOwnPropertyNames = ObjectGetOwnPropertyNames;
|
|
440
|
+
exports.ObjectGetOwnPropertySymbols = ObjectGetOwnPropertySymbols;
|
|
441
|
+
exports.ObjectGetPrototypeOf = ObjectGetPrototypeOf;
|
|
442
|
+
exports.ObjectHasOwn = ObjectHasOwn;
|
|
443
|
+
exports.ObjectIs = ObjectIs;
|
|
444
|
+
exports.ObjectIsExtensible = ObjectIsExtensible;
|
|
445
|
+
exports.ObjectIsFrozen = ObjectIsFrozen;
|
|
446
|
+
exports.ObjectIsSealed = ObjectIsSealed;
|
|
447
|
+
exports.ObjectKeys = ObjectKeys;
|
|
448
|
+
exports.ObjectPreventExtensions = ObjectPreventExtensions;
|
|
449
|
+
exports.ObjectPrototype = ObjectPrototype;
|
|
450
|
+
exports.ObjectPrototypeDefineGetter = ObjectPrototypeDefineGetter;
|
|
451
|
+
exports.ObjectPrototypeDefineSetter = ObjectPrototypeDefineSetter;
|
|
452
|
+
exports.ObjectPrototypeHasOwnProperty = ObjectPrototypeHasOwnProperty;
|
|
453
|
+
exports.ObjectPrototypeIsPrototypeOf = ObjectPrototypeIsPrototypeOf;
|
|
454
|
+
exports.ObjectPrototypeLookupGetter = ObjectPrototypeLookupGetter;
|
|
455
|
+
exports.ObjectPrototypeLookupSetter = ObjectPrototypeLookupSetter;
|
|
456
|
+
exports.ObjectPrototypePropertyIsEnumerable = ObjectPrototypePropertyIsEnumerable;
|
|
457
|
+
exports.ObjectPrototypeToString = ObjectPrototypeToString;
|
|
458
|
+
exports.ObjectPrototypeValueOf = ObjectPrototypeValueOf;
|
|
459
|
+
exports.ObjectSeal = ObjectSeal;
|
|
460
|
+
exports.ObjectSetPrototypeOf = ObjectSetPrototypeOf;
|
|
461
|
+
exports.ObjectValues = ObjectValues;
|
|
462
|
+
}));
|
|
463
|
+
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/errors/predicates.js
|
|
466
|
+
var require_predicates = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
467
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
468
|
+
const require_primordials_string = require_string();
|
|
469
|
+
const require_primordials_object = require_object();
|
|
470
|
+
/**
|
|
471
|
+
* @file Error type-guard predicates — `isError` (with the `isErrorBuiltin` /
|
|
472
|
+
* `isErrorShim` building blocks) and the libuv errno-code narrower
|
|
473
|
+
* `isErrnoException`. Both are cross-realm-safe (they use `[[ErrorData]]`
|
|
474
|
+
* slot semantics rather than `instanceof Error`).
|
|
475
|
+
*/
|
|
476
|
+
/**
|
|
477
|
+
* Reference to the native ES2025 `Error.isError` when the running engine ships
|
|
478
|
+
* it, otherwise `undefined`. Exposed separately so tests and callers can detect
|
|
479
|
+
* the fast-path without re-probing.
|
|
480
|
+
*/
|
|
481
|
+
const isErrorBuiltin = Error.isError;
|
|
482
|
+
/**
|
|
483
|
+
* Narrow a caught value to a Node.js `ErrnoException` — an Error with a `.code`
|
|
484
|
+
* string set by libuv/syscall failures (e.g. `'ENOENT'`, `'EACCES'`, `'EBUSY'`,
|
|
485
|
+
* `'EPERM'`). Cross-realm safe (builds on {@link isError}), and checks that
|
|
486
|
+
* `code` is a string so a merely branded Error without a real errno code
|
|
487
|
+
* returns `false`.
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* try {
|
|
491
|
+
* await fsPromises.readFile(path)
|
|
492
|
+
* } catch (e) {
|
|
493
|
+
* if (isErrnoException(e) && e.code === 'ENOENT') {
|
|
494
|
+
* // … retry, or return default …
|
|
495
|
+
* } else {
|
|
496
|
+
* throw e
|
|
497
|
+
* }
|
|
498
|
+
* }
|
|
499
|
+
*/
|
|
500
|
+
function isErrnoException(value) {
|
|
501
|
+
if (!isError(value)) return false;
|
|
502
|
+
const code = value.code;
|
|
503
|
+
if (typeof code !== "string" || code.length === 0) return false;
|
|
504
|
+
const first = require_primordials_string.StringPrototypeCharCodeAt(code, 0);
|
|
505
|
+
return first >= 65 && first <= 90;
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* `Error.isError` fallback shim — the in-language approximation used when the
|
|
509
|
+
* native ES2025 method isn't available.
|
|
510
|
+
*
|
|
511
|
+
* Exported separately so test suites on engines that ship the native method can
|
|
512
|
+
* still exercise the shim branch directly. Consumers should prefer
|
|
513
|
+
* {@link isError}, which picks the native method when present.
|
|
514
|
+
*/
|
|
515
|
+
function isErrorShim(value) {
|
|
516
|
+
if (value === null || typeof value !== "object") return false;
|
|
517
|
+
return require_primordials_object.ObjectPrototypeToString(value) === "[object Error]";
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Prefer the native ES2025 `Error.isError` when available (exact
|
|
521
|
+
* `[[ErrorData]]` slot check, cross-realm-safe); fall back to
|
|
522
|
+
* {@link isErrorShim} otherwise.
|
|
523
|
+
*/
|
|
524
|
+
const isError = isErrorBuiltin ?? isErrorShim;
|
|
525
|
+
exports.isErrnoException = isErrnoException;
|
|
526
|
+
exports.isError = isError;
|
|
527
|
+
exports.isErrorBuiltin = isErrorBuiltin;
|
|
528
|
+
exports.isErrorShim = isErrorShim;
|
|
529
|
+
}));
|
|
530
|
+
|
|
531
|
+
//#endregion
|
|
532
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/primordials/map-set.js
|
|
533
|
+
var require_map_set = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
534
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
535
|
+
const require_primordials_uncurry = require_uncurry();
|
|
536
|
+
/**
|
|
537
|
+
* @file Safe references to `Map`, `Set`, `WeakMap`, `WeakSet`, and `WeakRef`.
|
|
538
|
+
* Constructors plus uncurried prototype methods. `WeakRef` exposes only its
|
|
539
|
+
* constructor — there's a separate `weakRefSafe` wrapper in `./uncurry` for
|
|
540
|
+
* the throws-on-non-Object case.
|
|
541
|
+
*/
|
|
542
|
+
const MapCtor = Map;
|
|
543
|
+
const SetCtor = Set;
|
|
544
|
+
const WeakMapCtor = WeakMap;
|
|
545
|
+
const WeakRefCtor = WeakRef;
|
|
546
|
+
const WeakSetCtor = WeakSet;
|
|
547
|
+
const MapPrototypeClear = require_primordials_uncurry.uncurryThis(Map.prototype.clear);
|
|
548
|
+
const MapPrototypeDelete = require_primordials_uncurry.uncurryThis(Map.prototype.delete);
|
|
549
|
+
const MapPrototypeEntries = require_primordials_uncurry.uncurryThis(Map.prototype.entries);
|
|
550
|
+
const MapPrototypeForEach = require_primordials_uncurry.uncurryThis(Map.prototype.forEach);
|
|
551
|
+
const MapPrototypeGet = require_primordials_uncurry.uncurryThis(Map.prototype.get);
|
|
552
|
+
const MapPrototypeGetOrInsert = require_primordials_uncurry.uncurryThis(Map.prototype.getOrInsert);
|
|
553
|
+
const MapPrototypeGetOrInsertComputed = require_primordials_uncurry.uncurryThis(Map.prototype.getOrInsertComputed);
|
|
554
|
+
const MapPrototypeHas = require_primordials_uncurry.uncurryThis(Map.prototype.has);
|
|
555
|
+
const MapPrototypeKeys = require_primordials_uncurry.uncurryThis(Map.prototype.keys);
|
|
556
|
+
const MapPrototypeSet = require_primordials_uncurry.uncurryThis(Map.prototype.set);
|
|
557
|
+
const MapPrototypeValues = require_primordials_uncurry.uncurryThis(Map.prototype.values);
|
|
558
|
+
const SetPrototypeAdd = require_primordials_uncurry.uncurryThis(Set.prototype.add);
|
|
559
|
+
const SetPrototypeClear = require_primordials_uncurry.uncurryThis(Set.prototype.clear);
|
|
560
|
+
const SetPrototypeDelete = require_primordials_uncurry.uncurryThis(Set.prototype.delete);
|
|
561
|
+
const SetPrototypeDifference = require_primordials_uncurry.uncurryThis(Set.prototype.difference);
|
|
562
|
+
const SetPrototypeEntries = require_primordials_uncurry.uncurryThis(Set.prototype.entries);
|
|
563
|
+
const SetPrototypeForEach = require_primordials_uncurry.uncurryThis(Set.prototype.forEach);
|
|
564
|
+
const SetPrototypeHas = require_primordials_uncurry.uncurryThis(Set.prototype.has);
|
|
565
|
+
const SetPrototypeIntersection = require_primordials_uncurry.uncurryThis(Set.prototype.intersection);
|
|
566
|
+
const SetPrototypeIsDisjointFrom = require_primordials_uncurry.uncurryThis(Set.prototype.isDisjointFrom);
|
|
567
|
+
const SetPrototypeIsSubsetOf = require_primordials_uncurry.uncurryThis(Set.prototype.isSubsetOf);
|
|
568
|
+
const SetPrototypeIsSupersetOf = require_primordials_uncurry.uncurryThis(Set.prototype.isSupersetOf);
|
|
569
|
+
const SetPrototypeKeys = require_primordials_uncurry.uncurryThis(Set.prototype.keys);
|
|
570
|
+
const SetPrototypeSymmetricDifference = require_primordials_uncurry.uncurryThis(Set.prototype.symmetricDifference);
|
|
571
|
+
const SetPrototypeUnion = require_primordials_uncurry.uncurryThis(Set.prototype.union);
|
|
572
|
+
const SetPrototypeValues = require_primordials_uncurry.uncurryThis(Set.prototype.values);
|
|
573
|
+
const WeakMapPrototypeDelete = require_primordials_uncurry.uncurryThis(WeakMap.prototype.delete);
|
|
574
|
+
const WeakMapPrototypeGet = require_primordials_uncurry.uncurryThis(WeakMap.prototype.get);
|
|
575
|
+
const WeakMapPrototypeGetOrInsert = require_primordials_uncurry.uncurryThis(WeakMap.prototype.getOrInsert);
|
|
576
|
+
const WeakMapPrototypeGetOrInsertComputed = require_primordials_uncurry.uncurryThis(WeakMap.prototype.getOrInsertComputed);
|
|
577
|
+
const WeakMapPrototypeHas = require_primordials_uncurry.uncurryThis(WeakMap.prototype.has);
|
|
578
|
+
const WeakMapPrototypeSet = require_primordials_uncurry.uncurryThis(WeakMap.prototype.set);
|
|
579
|
+
const WeakSetPrototypeAdd = require_primordials_uncurry.uncurryThis(WeakSet.prototype.add);
|
|
580
|
+
const WeakSetPrototypeDelete = require_primordials_uncurry.uncurryThis(WeakSet.prototype.delete);
|
|
581
|
+
const WeakSetPrototypeHas = require_primordials_uncurry.uncurryThis(WeakSet.prototype.has);
|
|
582
|
+
exports.MapCtor = MapCtor;
|
|
583
|
+
exports.MapPrototypeClear = MapPrototypeClear;
|
|
584
|
+
exports.MapPrototypeDelete = MapPrototypeDelete;
|
|
585
|
+
exports.MapPrototypeEntries = MapPrototypeEntries;
|
|
586
|
+
exports.MapPrototypeForEach = MapPrototypeForEach;
|
|
587
|
+
exports.MapPrototypeGet = MapPrototypeGet;
|
|
588
|
+
exports.MapPrototypeGetOrInsert = MapPrototypeGetOrInsert;
|
|
589
|
+
exports.MapPrototypeGetOrInsertComputed = MapPrototypeGetOrInsertComputed;
|
|
590
|
+
exports.MapPrototypeHas = MapPrototypeHas;
|
|
591
|
+
exports.MapPrototypeKeys = MapPrototypeKeys;
|
|
592
|
+
exports.MapPrototypeSet = MapPrototypeSet;
|
|
593
|
+
exports.MapPrototypeValues = MapPrototypeValues;
|
|
594
|
+
exports.SetCtor = SetCtor;
|
|
595
|
+
exports.SetPrototypeAdd = SetPrototypeAdd;
|
|
596
|
+
exports.SetPrototypeClear = SetPrototypeClear;
|
|
597
|
+
exports.SetPrototypeDelete = SetPrototypeDelete;
|
|
598
|
+
exports.SetPrototypeDifference = SetPrototypeDifference;
|
|
599
|
+
exports.SetPrototypeEntries = SetPrototypeEntries;
|
|
600
|
+
exports.SetPrototypeForEach = SetPrototypeForEach;
|
|
601
|
+
exports.SetPrototypeHas = SetPrototypeHas;
|
|
602
|
+
exports.SetPrototypeIntersection = SetPrototypeIntersection;
|
|
603
|
+
exports.SetPrototypeIsDisjointFrom = SetPrototypeIsDisjointFrom;
|
|
604
|
+
exports.SetPrototypeIsSubsetOf = SetPrototypeIsSubsetOf;
|
|
605
|
+
exports.SetPrototypeIsSupersetOf = SetPrototypeIsSupersetOf;
|
|
606
|
+
exports.SetPrototypeKeys = SetPrototypeKeys;
|
|
607
|
+
exports.SetPrototypeSymmetricDifference = SetPrototypeSymmetricDifference;
|
|
608
|
+
exports.SetPrototypeUnion = SetPrototypeUnion;
|
|
609
|
+
exports.SetPrototypeValues = SetPrototypeValues;
|
|
610
|
+
exports.WeakMapCtor = WeakMapCtor;
|
|
611
|
+
exports.WeakMapPrototypeDelete = WeakMapPrototypeDelete;
|
|
612
|
+
exports.WeakMapPrototypeGet = WeakMapPrototypeGet;
|
|
613
|
+
exports.WeakMapPrototypeGetOrInsert = WeakMapPrototypeGetOrInsert;
|
|
614
|
+
exports.WeakMapPrototypeGetOrInsertComputed = WeakMapPrototypeGetOrInsertComputed;
|
|
615
|
+
exports.WeakMapPrototypeHas = WeakMapPrototypeHas;
|
|
616
|
+
exports.WeakMapPrototypeSet = WeakMapPrototypeSet;
|
|
617
|
+
exports.WeakRefCtor = WeakRefCtor;
|
|
618
|
+
exports.WeakSetCtor = WeakSetCtor;
|
|
619
|
+
exports.WeakSetPrototypeAdd = WeakSetPrototypeAdd;
|
|
620
|
+
exports.WeakSetPrototypeDelete = WeakSetPrototypeDelete;
|
|
621
|
+
exports.WeakSetPrototypeHas = WeakSetPrototypeHas;
|
|
622
|
+
}));
|
|
623
|
+
|
|
624
|
+
//#endregion
|
|
625
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/external/pony-cause.js
|
|
626
|
+
var require_pony_cause$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
627
|
+
const { SetCtor: _p_SetCtor } = require_map_set();
|
|
628
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
629
|
+
var require_error_with_cause = /* @__PURE__ */ __commonJSMin(((exports$1, module$1) => {
|
|
630
|
+
module$1.exports = { ErrorWithCause: class ErrorWithCause extends Error {
|
|
631
|
+
/**
|
|
632
|
+
* @param {string} message
|
|
633
|
+
* @param {{ cause?: T }} options
|
|
634
|
+
*/
|
|
635
|
+
constructor(message, { cause } = {}) {
|
|
636
|
+
super(message);
|
|
637
|
+
/** @type {string} */
|
|
638
|
+
this.name = ErrorWithCause.name;
|
|
639
|
+
if (cause)
|
|
640
|
+
/** @type {T} */
|
|
641
|
+
this.cause = cause;
|
|
642
|
+
/** @type {string} */
|
|
643
|
+
this.message = message;
|
|
644
|
+
}
|
|
645
|
+
} };
|
|
646
|
+
}));
|
|
647
|
+
var require_helpers = /* @__PURE__ */ __commonJSMin(((exports$2, module$2) => {
|
|
648
|
+
const isError = typeof Error.isError === "function" ? Error.isError : (v) => v !== null && typeof v === "object" && Object.prototype.toString.call(v) === "[object Error]";
|
|
649
|
+
/**
|
|
650
|
+
* @template {Error} T
|
|
651
|
+
* @param {unknown} err
|
|
652
|
+
* @param {new(...args: any[]) => T} reference
|
|
653
|
+
* @returns {T|undefined}
|
|
654
|
+
*/
|
|
655
|
+
const findCauseByReference = (err, reference) => {
|
|
656
|
+
if (!err || !reference) return;
|
|
657
|
+
if (!isError(err)) return;
|
|
658
|
+
if (!(reference.prototype instanceof Error) && reference !== Error) return;
|
|
659
|
+
/**
|
|
660
|
+
* Ensures we don't go circular
|
|
661
|
+
*
|
|
662
|
+
* @type {Set<Error>}
|
|
663
|
+
*/
|
|
664
|
+
const seen = /* @__PURE__ */ new _p_SetCtor();
|
|
665
|
+
/** @type {Error|undefined} */
|
|
666
|
+
let currentErr = err;
|
|
667
|
+
while (currentErr && !seen.has(currentErr)) {
|
|
668
|
+
seen.add(currentErr);
|
|
669
|
+
if (currentErr instanceof reference) return currentErr;
|
|
670
|
+
currentErr = getErrorCause(currentErr);
|
|
671
|
+
}
|
|
672
|
+
};
|
|
673
|
+
/**
|
|
674
|
+
* @param {Error|{ cause?: unknown|(()=>err)}} err
|
|
675
|
+
* @returns {Error|undefined}
|
|
676
|
+
*/
|
|
677
|
+
const getErrorCause = (err) => {
|
|
678
|
+
if (!err || typeof err !== "object" || !("cause" in err)) return;
|
|
679
|
+
if (typeof err.cause === "function") {
|
|
680
|
+
const causeResult = err.cause();
|
|
681
|
+
return isError(causeResult) ? causeResult : void 0;
|
|
682
|
+
} else return isError(err.cause) ? err.cause : void 0;
|
|
683
|
+
};
|
|
684
|
+
/**
|
|
685
|
+
* Internal method that keeps a track of which error we have already added, to avoid circular recursion
|
|
686
|
+
*
|
|
687
|
+
* @private
|
|
688
|
+
* @param {Error} err
|
|
689
|
+
* @param {Set<Error>} seen
|
|
690
|
+
* @returns {string}
|
|
691
|
+
*/
|
|
692
|
+
const _stackWithCauses = (err, seen) => {
|
|
693
|
+
if (!isError(err)) return "";
|
|
694
|
+
const stack = err.stack || "";
|
|
695
|
+
if (seen.has(err)) return stack + "\ncauses have become circular...";
|
|
696
|
+
const cause = getErrorCause(err);
|
|
697
|
+
if (cause) {
|
|
698
|
+
seen.add(err);
|
|
699
|
+
return stack + "\ncaused by: " + _stackWithCauses(cause, seen);
|
|
700
|
+
} else return stack;
|
|
701
|
+
};
|
|
702
|
+
/**
|
|
703
|
+
* @param {Error} err
|
|
704
|
+
* @returns {string}
|
|
705
|
+
*/
|
|
706
|
+
const stackWithCauses = (err) => _stackWithCauses(err, /* @__PURE__ */ new Set());
|
|
707
|
+
/**
|
|
708
|
+
* Internal method that keeps a track of which error we have already added, to avoid circular recursion
|
|
709
|
+
*
|
|
710
|
+
* @private
|
|
711
|
+
* @param {Error} err
|
|
712
|
+
* @param {Set<Error>} seen
|
|
713
|
+
* @param {boolean} [skip]
|
|
714
|
+
* @returns {string}
|
|
715
|
+
*/
|
|
716
|
+
const _messageWithCauses = (err, seen, skip) => {
|
|
717
|
+
if (!isError(err)) return "";
|
|
718
|
+
const message = skip ? "" : err.message || "";
|
|
719
|
+
if (seen.has(err)) return message + ": ...";
|
|
720
|
+
const cause = getErrorCause(err);
|
|
721
|
+
if (cause) {
|
|
722
|
+
seen.add(err);
|
|
723
|
+
const skipIfVErrorStyleCause = "cause" in err && typeof err.cause === "function";
|
|
724
|
+
return message + (skipIfVErrorStyleCause ? "" : ": ") + _messageWithCauses(cause, seen, skipIfVErrorStyleCause);
|
|
725
|
+
} else return message;
|
|
726
|
+
};
|
|
727
|
+
/**
|
|
728
|
+
* @param {Error} err
|
|
729
|
+
* @returns {string}
|
|
730
|
+
*/
|
|
731
|
+
const messageWithCauses = (err) => _messageWithCauses(err, /* @__PURE__ */ new Set());
|
|
732
|
+
module$2.exports = {
|
|
733
|
+
findCauseByReference,
|
|
734
|
+
getErrorCause,
|
|
735
|
+
stackWithCauses,
|
|
736
|
+
messageWithCauses
|
|
737
|
+
};
|
|
738
|
+
}));
|
|
739
|
+
var require_pony_cause = /* @__PURE__ */ __commonJSMin(((exports$3, module$3) => {
|
|
740
|
+
const { ErrorWithCause } = require_error_with_cause();
|
|
741
|
+
const { findCauseByReference, getErrorCause, messageWithCauses, stackWithCauses } = require_helpers();
|
|
742
|
+
module$3.exports = {
|
|
743
|
+
ErrorWithCause,
|
|
744
|
+
findCauseByReference,
|
|
745
|
+
getErrorCause,
|
|
746
|
+
stackWithCauses,
|
|
747
|
+
messageWithCauses
|
|
748
|
+
};
|
|
749
|
+
}));
|
|
750
|
+
module.exports = require_pony_cause();
|
|
751
|
+
}));
|
|
752
|
+
|
|
753
|
+
//#endregion
|
|
754
|
+
//#region node_modules/.pnpm/@socketsecurity+lib@6.0.7/node_modules/@socketsecurity/lib/dist/errors/message.js
|
|
755
|
+
var require_message = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
756
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
757
|
+
const require_constants_sentinels = require_sentinels();
|
|
758
|
+
const require_errors_predicates = require_predicates();
|
|
759
|
+
let src_external_pony_cause = require_pony_cause$1();
|
|
760
|
+
/**
|
|
761
|
+
* @file Human-readable error-message extractor. `errorMessage` walks the
|
|
762
|
+
* `cause` chain via pony-cause's `messageWithCauses` for Errors and falls
|
|
763
|
+
* back to the shared `UNKNOWN_ERROR` sentinel for everything else.
|
|
764
|
+
* `messageWithCauses` and `UNKNOWN_ERROR` are re-exported for callers that
|
|
765
|
+
* need them directly.
|
|
766
|
+
*/
|
|
767
|
+
/**
|
|
768
|
+
* Extract a human-readable message from any caught value.
|
|
769
|
+
*
|
|
770
|
+
* Walks the `cause` chain for Errors (via {@link messageWithCauses}); coerces
|
|
771
|
+
* primitives and objects to string; returns {@link UNKNOWN_ERROR} for `null`,
|
|
772
|
+
* `undefined`, empty strings, `[object Object]`, or Errors with no message.
|
|
773
|
+
*
|
|
774
|
+
* @example
|
|
775
|
+
* try {
|
|
776
|
+
* await readConfig(path)
|
|
777
|
+
* } catch (e) {
|
|
778
|
+
* throw new ErrorCtor(`Failed to read ${path}: ${errorMessage(e)}`, {
|
|
779
|
+
* cause: e,
|
|
780
|
+
* })
|
|
781
|
+
* }
|
|
782
|
+
*/
|
|
783
|
+
function errorMessage(value) {
|
|
784
|
+
if (require_errors_predicates.isError(value)) return (0, src_external_pony_cause.messageWithCauses)(value) || "Unknown error";
|
|
785
|
+
if (value === null || value === void 0) return require_constants_sentinels.UNKNOWN_ERROR;
|
|
786
|
+
const s = String(value);
|
|
787
|
+
if (s === "" || s === "[object Object]") return require_constants_sentinels.UNKNOWN_ERROR;
|
|
788
|
+
return s;
|
|
789
|
+
}
|
|
790
|
+
exports.UNKNOWN_ERROR = require_constants_sentinels.UNKNOWN_ERROR;
|
|
791
|
+
exports.errorMessage = errorMessage;
|
|
792
|
+
exports.messageWithCauses = src_external_pony_cause.messageWithCauses;
|
|
793
|
+
}));
|
|
794
|
+
|
|
795
|
+
//#endregion
|
|
796
|
+
//#region hooks/socket-gate/index.mts
|
|
797
|
+
/**
|
|
798
|
+
* Socket-gate — Claude Code PreToolUse hook (source for the bundled
|
|
799
|
+
* socket-gate.cjs).
|
|
800
|
+
*
|
|
801
|
+
* Intercepts package install commands across npm, PyPI, Cargo, RubyGems, Go,
|
|
802
|
+
* and NuGet, and checks the target package against the public Socket MCP
|
|
803
|
+
* server. Blocks installs when the supply chain score is below 20 (known
|
|
804
|
+
* malware, typosquats, high-risk supply chain signals).
|
|
805
|
+
*
|
|
806
|
+
* No API key, no CLI, no registration beyond copying the bundled directory.
|
|
807
|
+
*
|
|
808
|
+
* Setup (see README.md):
|
|
809
|
+
*
|
|
810
|
+
* 1. Copy the whole hooks/socket-gate/ directory to ~/.claude/hooks/ (from a
|
|
811
|
+
* published @socketsecurity/mcp install, or build it here with `pnpm run
|
|
812
|
+
* build`).
|
|
813
|
+
* 2. Point a PreToolUse Bash hook at ~/.claude/hooks/socket-gate/socket-gate.cjs
|
|
814
|
+
* in ~/.claude/settings.json.
|
|
815
|
+
*
|
|
816
|
+
* This source imports @socketsecurity/lib-stable; rolldown inlines it into the
|
|
817
|
+
* bundled socket-gate.cjs so the copied-out hook stays self-contained (a Claude
|
|
818
|
+
* Code hook has no package.json and no node_modules — it can only run what is
|
|
819
|
+
* physically present in the file).
|
|
820
|
+
*
|
|
821
|
+
* Fails open on network, parse, and timeout errors so a Socket outage does not
|
|
822
|
+
* block legitimate work.
|
|
823
|
+
*/
|
|
824
|
+
var import_message = require_message();
|
|
825
|
+
const MCP_URL = "https://mcp.socket.dev/";
|
|
826
|
+
const SUPPLY_CHAIN_THRESHOLD = 20;
|
|
827
|
+
const REQUEST_TIMEOUT_MS = 1e4;
|
|
828
|
+
const INSTALL_PATTERNS = [
|
|
829
|
+
{
|
|
830
|
+
ecosystem: "npm",
|
|
831
|
+
pattern: /\bnpm\s+(?:add|i|install)\s+([^\s-][^\s]*)/i
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
ecosystem: "npm",
|
|
835
|
+
pattern: /\byarn\s+add\s+([^\s-][^\s]*)/i
|
|
836
|
+
},
|
|
837
|
+
{
|
|
838
|
+
ecosystem: "npm",
|
|
839
|
+
pattern: /\bpnpm\s+add\s+([^\s-][^\s]*)/i
|
|
840
|
+
},
|
|
841
|
+
{
|
|
842
|
+
ecosystem: "npm",
|
|
843
|
+
pattern: /\bbun\s+add\s+([^\s-][^\s]*)/i
|
|
844
|
+
},
|
|
845
|
+
{
|
|
846
|
+
ecosystem: "pypi",
|
|
847
|
+
pattern: /(?:\bpython3?\s+-m\s+)?\bpip3?\s+install\s+([^\s-][^\s]*)/i
|
|
848
|
+
},
|
|
849
|
+
{
|
|
850
|
+
ecosystem: "pypi",
|
|
851
|
+
pattern: /\buv\s+add\s+([^\s-][^\s]*)/i
|
|
852
|
+
},
|
|
853
|
+
{
|
|
854
|
+
ecosystem: "pypi",
|
|
855
|
+
pattern: /\buv\s+pip\s+install\s+([^\s-][^\s]*)/i
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
ecosystem: "pypi",
|
|
859
|
+
pattern: /\bpoetry\s+add\s+([^\s-][^\s]*)/i
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
ecosystem: "pypi",
|
|
863
|
+
pattern: /\bpipenv\s+install\s+([^\s-][^\s]*)/i
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
ecosystem: "cargo",
|
|
867
|
+
pattern: /\bcargo\s+(?:add|install)\s+([^\s-][^\s]*)/i
|
|
868
|
+
},
|
|
869
|
+
{
|
|
870
|
+
ecosystem: "gem",
|
|
871
|
+
pattern: /\bgem\s+install\s+([^\s-][^\s]*)/i
|
|
872
|
+
},
|
|
873
|
+
{
|
|
874
|
+
ecosystem: "gem",
|
|
875
|
+
pattern: /\bbundle\s+add\s+([^\s-][^\s]*)/i
|
|
876
|
+
},
|
|
877
|
+
{
|
|
878
|
+
ecosystem: "golang",
|
|
879
|
+
pattern: /\bgo\s+(?:get|install)\s+([^\s-][^\s]*)/i
|
|
880
|
+
},
|
|
881
|
+
{
|
|
882
|
+
ecosystem: "nuget",
|
|
883
|
+
pattern: /\bdotnet\s+add\s+package\s+([^\s-][^\s]*)/i
|
|
884
|
+
},
|
|
885
|
+
{
|
|
886
|
+
ecosystem: "nuget",
|
|
887
|
+
pattern: /\bnuget\s+install\s+([^\s-][^\s]*)/i
|
|
888
|
+
}
|
|
889
|
+
];
|
|
890
|
+
async function checkPackage(ecosystem, packageName, fetchImpl = fetch) {
|
|
891
|
+
const signal = AbortSignal.timeout(REQUEST_TIMEOUT_MS);
|
|
892
|
+
const commonHeaders = {
|
|
893
|
+
"Content-Type": "application/json",
|
|
894
|
+
Accept: "application/json, text/event-stream"
|
|
895
|
+
};
|
|
896
|
+
const initRes = await fetchImpl(MCP_URL, {
|
|
897
|
+
method: "POST",
|
|
898
|
+
headers: commonHeaders,
|
|
899
|
+
body: JSON.stringify({
|
|
900
|
+
jsonrpc: "2.0",
|
|
901
|
+
id: 1,
|
|
902
|
+
method: "initialize",
|
|
903
|
+
params: {
|
|
904
|
+
protocolVersion: "2024-11-05",
|
|
905
|
+
capabilities: {},
|
|
906
|
+
clientInfo: {
|
|
907
|
+
name: "socket-gate",
|
|
908
|
+
version: "1.0"
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}),
|
|
912
|
+
signal
|
|
913
|
+
});
|
|
914
|
+
if (!initRes.ok) throw new Error(`Socket MCP initialize returned ${initRes.status}`);
|
|
915
|
+
const sessionId = initRes.headers.get("mcp-session-id");
|
|
916
|
+
if (!sessionId) throw new Error("Socket MCP did not return a session id");
|
|
917
|
+
await initRes.text();
|
|
918
|
+
const callRes = await fetchImpl(MCP_URL, {
|
|
919
|
+
method: "POST",
|
|
920
|
+
headers: {
|
|
921
|
+
...commonHeaders,
|
|
922
|
+
"Mcp-Session-Id": sessionId
|
|
923
|
+
},
|
|
924
|
+
body: JSON.stringify({
|
|
925
|
+
jsonrpc: "2.0",
|
|
926
|
+
id: 2,
|
|
927
|
+
method: "tools/call",
|
|
928
|
+
params: {
|
|
929
|
+
name: "depscore",
|
|
930
|
+
arguments: { packages: [{
|
|
931
|
+
ecosystem,
|
|
932
|
+
depname: packageName
|
|
933
|
+
}] }
|
|
934
|
+
}
|
|
935
|
+
}),
|
|
936
|
+
signal
|
|
937
|
+
});
|
|
938
|
+
if (!callRes.ok) throw new Error(`Socket MCP depscore returned ${callRes.status}`);
|
|
939
|
+
const payload = await callRes.json();
|
|
940
|
+
if (payload.result?.isError) throw new Error("Socket MCP reported a tool error (package likely not found)");
|
|
941
|
+
const score = parseSupplyChainScore(payload.result?.content?.[0]?.text ?? "");
|
|
942
|
+
if (score === void 0) throw new Error("Could not parse supplyChain score from MCP response");
|
|
943
|
+
if (score < SUPPLY_CHAIN_THRESHOLD) return {
|
|
944
|
+
decision: "deny",
|
|
945
|
+
reason: `Socket blocked "${packageName}" (${ecosystem}): supply chain score is ${score} (threshold ${SUPPLY_CHAIN_THRESHOLD}).\n\nReview: https://socket.dev/${ecosystem}/package/${packageName}`
|
|
946
|
+
};
|
|
947
|
+
return {
|
|
948
|
+
decision: "allow",
|
|
949
|
+
reason: ""
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
function extractPackage(command) {
|
|
953
|
+
for (const { ecosystem, pattern } of INSTALL_PATTERNS) {
|
|
954
|
+
const match = command.match(pattern);
|
|
955
|
+
if (match?.[1]) {
|
|
956
|
+
const name = stripVersion(match[1], ecosystem);
|
|
957
|
+
if (!name) continue;
|
|
958
|
+
return {
|
|
959
|
+
ecosystem,
|
|
960
|
+
name
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
function outputAllow() {
|
|
966
|
+
const payload = JSON.stringify({ hookSpecificOutput: {
|
|
967
|
+
hookEventName: "PreToolUse",
|
|
968
|
+
permissionDecision: "allow"
|
|
969
|
+
} });
|
|
970
|
+
process.stdout.write(payload);
|
|
971
|
+
}
|
|
972
|
+
function outputDeny(reason) {
|
|
973
|
+
const payload = JSON.stringify({ hookSpecificOutput: {
|
|
974
|
+
hookEventName: "PreToolUse",
|
|
975
|
+
permissionDecision: "deny",
|
|
976
|
+
permissionDecisionReason: reason
|
|
977
|
+
} });
|
|
978
|
+
process.stdout.write(payload);
|
|
979
|
+
}
|
|
980
|
+
function parseSupplyChainScore(text) {
|
|
981
|
+
const match = text.match(/supplyChain:\s*(\d+(?:\.\d+)?)/i);
|
|
982
|
+
return match ? Number(match[1]) : void 0;
|
|
983
|
+
}
|
|
984
|
+
function stripVersion(pkg, ecosystem) {
|
|
985
|
+
switch (ecosystem) {
|
|
986
|
+
case "npm": return pkg.replace(/@[\d^~].*/u, "").replace(/@latest$/u, "");
|
|
987
|
+
case "pypi": return pkg.split(/[=<>!~[]/)[0] ?? pkg;
|
|
988
|
+
case "cargo":
|
|
989
|
+
case "golang":
|
|
990
|
+
case "nuget": return pkg.replace(/@.*$/u, "");
|
|
991
|
+
default: return pkg;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
async function main() {
|
|
995
|
+
let raw;
|
|
996
|
+
try {
|
|
997
|
+
raw = (0, node_fs.readFileSync)(0, "utf-8");
|
|
998
|
+
} catch {
|
|
999
|
+
outputAllow();
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
if (!raw.trim()) {
|
|
1003
|
+
outputAllow();
|
|
1004
|
+
return;
|
|
1005
|
+
}
|
|
1006
|
+
let input;
|
|
1007
|
+
try {
|
|
1008
|
+
input = JSON.parse(raw);
|
|
1009
|
+
} catch {
|
|
1010
|
+
outputAllow();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (input.tool_name !== "Bash") {
|
|
1014
|
+
outputAllow();
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
const command = typeof input.tool_input === "string" ? input.tool_input : input.tool_input?.["command"] || "";
|
|
1018
|
+
if (!command) {
|
|
1019
|
+
outputAllow();
|
|
1020
|
+
return;
|
|
1021
|
+
}
|
|
1022
|
+
const target = extractPackage(command);
|
|
1023
|
+
if (!target) {
|
|
1024
|
+
outputAllow();
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
try {
|
|
1028
|
+
const result = await checkPackage(target.ecosystem, target.name);
|
|
1029
|
+
if (result.decision === "deny") outputDeny(result.reason);
|
|
1030
|
+
else outputAllow();
|
|
1031
|
+
} catch (e) {
|
|
1032
|
+
const errLine = `socket-gate: check failed for ${target.ecosystem}/${target.name}, failing open: ${(0, import_message.errorMessage)(e)}\n`;
|
|
1033
|
+
process.stderr.write(errLine);
|
|
1034
|
+
outputAllow();
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
if (node_process.argv[1] !== void 0 && (0, node_url.fileURLToPath)(require("url").pathToFileURL(__filename).href) === node_process.argv[1]) main().catch(() => {
|
|
1038
|
+
outputAllow();
|
|
1039
|
+
});
|
|
1040
|
+
|
|
1041
|
+
//#endregion
|
|
1042
|
+
exports.checkPackage = checkPackage;
|
|
1043
|
+
exports.extractPackage = extractPackage;
|
|
1044
|
+
exports.outputAllow = outputAllow;
|
|
1045
|
+
exports.outputDeny = outputDeny;
|
|
1046
|
+
exports.parseSupplyChainScore = parseSupplyChainScore;
|
|
1047
|
+
exports.stripVersion = stripVersion;
|