@node9/proxy 2.47.1 → 2.48.0

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/index.js CHANGED
@@ -22054,19 +22054,30 @@ function recordFromLegacyWait(body, now = Date.now()) {
22054
22054
 
22055
22055
  // src/auth/daemon.ts
22056
22056
  var ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : import_path15.default.join(import_os10.default.tmpdir(), "node9-activity.sock");
22057
- function notifyActivitySocket(data) {
22057
+ var ACTIVITY_SOCKET_TIMEOUT_MS = 500;
22058
+ function notifyActivitySocket(data, opts = {}) {
22058
22059
  if (forecastRun()) return Promise.resolve(false);
22059
22060
  return new Promise((resolve) => {
22061
+ let settled = false;
22062
+ let sock = null;
22063
+ const finish = (ok) => {
22064
+ if (settled) return;
22065
+ settled = true;
22066
+ clearTimeout(timer);
22067
+ if (!ok) sock?.destroy();
22068
+ resolve(ok);
22069
+ };
22070
+ const timer = setTimeout(() => finish(false), opts.timeoutMs ?? ACTIVITY_SOCKET_TIMEOUT_MS);
22060
22071
  try {
22061
22072
  const payload = JSON.stringify(data);
22062
- const sock = import_net4.default.createConnection(ACTIVITY_SOCKET_PATH);
22073
+ sock = import_net4.default.createConnection(opts.socketPath ?? ACTIVITY_SOCKET_PATH);
22063
22074
  sock.on("connect", () => {
22064
- sock.on("close", () => resolve(true));
22075
+ sock.on("close", () => finish(true));
22065
22076
  sock.end(payload);
22066
22077
  });
22067
- sock.on("error", () => resolve(false));
22078
+ sock.on("error", () => finish(false));
22068
22079
  } catch {
22069
- resolve(false);
22080
+ finish(false);
22070
22081
  }
22071
22082
  });
22072
22083
  }
@@ -23897,6 +23908,7 @@ function recordAndCheck(tool, args, threshold = 3, windowMs = 12e4) {
23897
23908
 
23898
23909
  // src/policy/negotiation.ts
23899
23910
  init_cjs_shims();
23911
+ init_dist();
23900
23912
  var BLOCKED_BY = " is blocked by ";
23901
23913
  var DASH_BLOCKED_BY = " \u2014 blocked by ";
23902
23914
  var SHIELD = " shield";
package/dist/index.mjs CHANGED
@@ -22025,19 +22025,30 @@ function recordFromLegacyWait(body, now = Date.now()) {
22025
22025
 
22026
22026
  // src/auth/daemon.ts
22027
22027
  var ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : path16.join(os10.tmpdir(), "node9-activity.sock");
22028
- function notifyActivitySocket(data) {
22028
+ var ACTIVITY_SOCKET_TIMEOUT_MS = 500;
22029
+ function notifyActivitySocket(data, opts = {}) {
22029
22030
  if (forecastRun()) return Promise.resolve(false);
22030
22031
  return new Promise((resolve) => {
22032
+ let settled = false;
22033
+ let sock = null;
22034
+ const finish = (ok) => {
22035
+ if (settled) return;
22036
+ settled = true;
22037
+ clearTimeout(timer);
22038
+ if (!ok) sock?.destroy();
22039
+ resolve(ok);
22040
+ };
22041
+ const timer = setTimeout(() => finish(false), opts.timeoutMs ?? ACTIVITY_SOCKET_TIMEOUT_MS);
22031
22042
  try {
22032
22043
  const payload = JSON.stringify(data);
22033
- const sock = net.createConnection(ACTIVITY_SOCKET_PATH);
22044
+ sock = net.createConnection(opts.socketPath ?? ACTIVITY_SOCKET_PATH);
22034
22045
  sock.on("connect", () => {
22035
- sock.on("close", () => resolve(true));
22046
+ sock.on("close", () => finish(true));
22036
22047
  sock.end(payload);
22037
22048
  });
22038
- sock.on("error", () => resolve(false));
22049
+ sock.on("error", () => finish(false));
22039
22050
  } catch {
22040
- resolve(false);
22051
+ finish(false);
22041
22052
  }
22042
22053
  });
22043
22054
  }
@@ -23868,6 +23879,7 @@ function recordAndCheck(tool, args, threshold = 3, windowMs = 12e4) {
23868
23879
 
23869
23880
  // src/policy/negotiation.ts
23870
23881
  init_esm_shims();
23882
+ init_dist();
23871
23883
  var BLOCKED_BY = " is blocked by ";
23872
23884
  var DASH_BLOCKED_BY = " \u2014 blocked by ";
23873
23885
  var SHIELD = " shield";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/proxy",
3
- "version": "2.47.1",
3
+ "version": "2.48.0",
4
4
  "description": "Access control for AI agents. Set what Claude Code, Codex, Gemini, Cursor and any MCP server are allowed to do, review risky actions before they run, and keep every action on the record.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -1 +0,0 @@
1
- #!/usr/bin/env node
@@ -1 +0,0 @@
1
- #!/usr/bin/env node