@solongate/proxy 0.81.0 → 0.81.2
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/dist/global-install.js +5 -3
- package/dist/index.js +5 -3
- package/dist/login.js +5 -3
- package/hooks/audit.mjs +8 -3
- package/hooks/guard.bundled.mjs +8 -3
- package/hooks/guard.mjs +11 -3
- package/package.json +1 -1
package/dist/global-install.js
CHANGED
|
@@ -252,12 +252,14 @@ async function runGlobalInstall(opts = {}) {
|
|
|
252
252
|
const auditAbs = join(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
253
253
|
const stopAbs = join(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
254
254
|
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
255
|
+
const call = process.platform === "win32" ? "& " : "";
|
|
256
|
+
const hookCmd = (script) => `${call}"${nodeBin}" "${script}" claude-code "Claude Code"`;
|
|
255
257
|
const merged = {
|
|
256
258
|
...existing,
|
|
257
259
|
hooks: {
|
|
258
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
259
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
260
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command:
|
|
260
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(guardAbs) }] }],
|
|
261
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(auditAbs) }] }],
|
|
262
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(stopAbs) }] }]
|
|
261
263
|
}
|
|
262
264
|
};
|
|
263
265
|
writeFileSync(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
package/dist/index.js
CHANGED
|
@@ -10596,12 +10596,14 @@ async function runGlobalInstall(opts = {}) {
|
|
|
10596
10596
|
const auditAbs = join9(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
10597
10597
|
const stopAbs = join9(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
10598
10598
|
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
10599
|
+
const call = process.platform === "win32" ? "& " : "";
|
|
10600
|
+
const hookCmd = (script) => `${call}"${nodeBin}" "${script}" claude-code "Claude Code"`;
|
|
10599
10601
|
const merged = {
|
|
10600
10602
|
...existing,
|
|
10601
10603
|
hooks: {
|
|
10602
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
10603
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
10604
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command:
|
|
10604
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(guardAbs) }] }],
|
|
10605
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(auditAbs) }] }],
|
|
10606
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(stopAbs) }] }]
|
|
10605
10607
|
}
|
|
10606
10608
|
};
|
|
10607
10609
|
writeFileSync4(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
package/dist/login.js
CHANGED
|
@@ -217,12 +217,14 @@ async function runGlobalInstall(opts = {}) {
|
|
|
217
217
|
const auditAbs = join(p.hooksDir, "audit.mjs").replace(/\\/g, "/");
|
|
218
218
|
const stopAbs = join(p.hooksDir, "stop.mjs").replace(/\\/g, "/");
|
|
219
219
|
const nodeBin = process.execPath.replace(/\\/g, "/");
|
|
220
|
+
const call = process.platform === "win32" ? "& " : "";
|
|
221
|
+
const hookCmd = (script) => `${call}"${nodeBin}" "${script}" claude-code "Claude Code"`;
|
|
220
222
|
const merged = {
|
|
221
223
|
...existing,
|
|
222
224
|
hooks: {
|
|
223
|
-
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
224
|
-
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command:
|
|
225
|
-
Stop: [{ matcher: "", hooks: [{ type: "command", command:
|
|
225
|
+
PreToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(guardAbs) }] }],
|
|
226
|
+
PostToolUse: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(auditAbs) }] }],
|
|
227
|
+
Stop: [{ matcher: "", hooks: [{ type: "command", command: hookCmd(stopAbs) }] }]
|
|
226
228
|
}
|
|
227
229
|
};
|
|
228
230
|
writeFileSync(p.settingsPath, JSON.stringify(merged, null, 2) + "\n");
|
package/hooks/audit.mjs
CHANGED
|
@@ -392,8 +392,13 @@ const AGENT_NAME = process.argv[3] || 'Claude Code';
|
|
|
392
392
|
if (!API_KEY || !(API_KEY.startsWith('sg_live_') || API_KEY.startsWith('sg_test_'))) process.exit(0);
|
|
393
393
|
|
|
394
394
|
let input = '';
|
|
395
|
-
|
|
396
|
-
process.stdin
|
|
395
|
+
// Read stdin SYNCHRONOUSLY (fd 0). Calling process.exit() from inside the
|
|
396
|
+
// process.stdin stream 'end' callback aborts on Windows + Node 24 with
|
|
397
|
+
// `Assertion failed: !(handle->flags & UV_HANDLE_CLOSING), file src\win\async.c`
|
|
398
|
+
// (libuv double-closes the stdin pipe handle during teardown). Reading fd 0 to
|
|
399
|
+
// EOF avoids creating that handle, so the exits below tear down cleanly.
|
|
400
|
+
try { input += readFileSync(0, 'utf-8'); } catch {}
|
|
401
|
+
;(async () => {
|
|
397
402
|
try {
|
|
398
403
|
const data = JSON.parse(input);
|
|
399
404
|
let EMITTED_PAYLOAD = null;
|
|
@@ -581,4 +586,4 @@ process.stdin.on('end', async () => {
|
|
|
581
586
|
} catch {
|
|
582
587
|
process.exit(0);
|
|
583
588
|
}
|
|
584
|
-
});
|
|
589
|
+
})();
|
package/hooks/guard.bundled.mjs
CHANGED
|
@@ -7654,8 +7654,13 @@ function readReferencedFiles(args, cwd) {
|
|
|
7654
7654
|
}
|
|
7655
7655
|
return out;
|
|
7656
7656
|
}
|
|
7657
|
-
|
|
7658
|
-
|
|
7657
|
+
if (!REFRESH_MODE) {
|
|
7658
|
+
try {
|
|
7659
|
+
input += readFileSync(0, "utf-8");
|
|
7660
|
+
} catch {
|
|
7661
|
+
}
|
|
7662
|
+
}
|
|
7663
|
+
(async () => {
|
|
7659
7664
|
if (REFRESH_MODE)
|
|
7660
7665
|
return;
|
|
7661
7666
|
if (process.env.SOLONGATE_DEBUG) {
|
|
@@ -7898,4 +7903,4 @@ process.stdin.on("end", async () => {
|
|
|
7898
7903
|
}
|
|
7899
7904
|
await maybeSelfUpdate();
|
|
7900
7905
|
allowTool();
|
|
7901
|
-
});
|
|
7906
|
+
})();
|
package/hooks/guard.mjs
CHANGED
|
@@ -1402,8 +1402,16 @@ function readReferencedFiles(args, cwd) {
|
|
|
1402
1402
|
return out;
|
|
1403
1403
|
}
|
|
1404
1404
|
|
|
1405
|
-
|
|
1406
|
-
|
|
1405
|
+
// Read stdin SYNCHRONOUSLY (fd 0) instead of via the process.stdin stream. On
|
|
1406
|
+
// Windows + Node 24, calling process.exit() from inside the stdin stream's 'end'
|
|
1407
|
+
// callback aborts with `Assertion failed: !(handle->flags & UV_HANDLE_CLOSING),
|
|
1408
|
+
// file src\win\async.c` — libuv double-closes the stdin pipe handle mid-teardown,
|
|
1409
|
+
// the hook crashes before its exit code lands, and Claude Code treats the DENY as
|
|
1410
|
+
// a non-blocking hook failure (so the block never applies). Reading fd 0 to EOF
|
|
1411
|
+
// synchronously never creates that pipe handle, and the exit below no longer runs
|
|
1412
|
+
// inside a stream callback, so the loop tears down cleanly.
|
|
1413
|
+
if (!REFRESH_MODE) { try { input += readFileSync(0, 'utf-8'); } catch {} }
|
|
1414
|
+
;(async () => {
|
|
1407
1415
|
// Background-refresh invocation has no tool call to evaluate — it already ran
|
|
1408
1416
|
// refreshPolicyCache() at startup; do nothing on the (empty) stdin.
|
|
1409
1417
|
if (REFRESH_MODE) return;
|
|
@@ -1709,4 +1717,4 @@ process.stdin.on('end', async () => {
|
|
|
1709
1717
|
} catch {}
|
|
1710
1718
|
await maybeSelfUpdate();
|
|
1711
1719
|
allowTool();
|
|
1712
|
-
});
|
|
1720
|
+
})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solongate/proxy",
|
|
3
|
-
"version": "0.81.
|
|
3
|
+
"version": "0.81.2",
|
|
4
4
|
"description": "AI tool security proxy: protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. No code changes required.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|