@node9/proxy 2.47.1 → 2.47.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/cli-main.js CHANGED
@@ -24007,19 +24007,29 @@ var init_decision_record = __esm({
24007
24007
  });
24008
24008
 
24009
24009
  // src/auth/daemon.ts
24010
- function notifyActivitySocket(data) {
24010
+ function notifyActivitySocket(data, opts = {}) {
24011
24011
  if (forecastRun()) return Promise.resolve(false);
24012
24012
  return new Promise((resolve2) => {
24013
+ let settled = false;
24014
+ let sock = null;
24015
+ const finish = (ok2) => {
24016
+ if (settled) return;
24017
+ settled = true;
24018
+ clearTimeout(timer);
24019
+ if (!ok2) sock?.destroy();
24020
+ resolve2(ok2);
24021
+ };
24022
+ const timer = setTimeout(() => finish(false), opts.timeoutMs ?? ACTIVITY_SOCKET_TIMEOUT_MS);
24013
24023
  try {
24014
24024
  const payload = JSON.stringify(data);
24015
- const sock = import_net4.default.createConnection(ACTIVITY_SOCKET_PATH);
24025
+ sock = import_net4.default.createConnection(opts.socketPath ?? ACTIVITY_SOCKET_PATH);
24016
24026
  sock.on("connect", () => {
24017
- sock.on("close", () => resolve2(true));
24027
+ sock.on("close", () => finish(true));
24018
24028
  sock.end(payload);
24019
24029
  });
24020
- sock.on("error", () => resolve2(false));
24030
+ sock.on("error", () => finish(false));
24021
24031
  } catch {
24022
- resolve2(false);
24032
+ finish(false);
24023
24033
  }
24024
24034
  });
24025
24035
  }
@@ -24554,7 +24564,7 @@ async function resolveViaDaemon(id, decision, internalToken, source, record2) {
24554
24564
  const winner = parseDecisionRecord(body?.record);
24555
24565
  return winner && typeof body?.won === "boolean" ? { won: body.won, record: winner } : null;
24556
24566
  }
24557
- var import_fs15, import_http, import_net4, import_path15, import_os11, ACTIVITY_SOCKET_PATH, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
24567
+ var import_fs15, import_http, import_net4, import_path15, import_os11, ACTIVITY_SOCKET_PATH, ACTIVITY_SOCKET_TIMEOUT_MS, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
24558
24568
  var init_daemon = __esm({
24559
24569
  "src/auth/daemon.ts"() {
24560
24570
  "use strict";
@@ -24567,6 +24577,7 @@ var init_daemon = __esm({
24567
24577
  init_forecast_context();
24568
24578
  init_decision_record();
24569
24579
  ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : import_path15.default.join(import_os11.default.tmpdir(), "node9-activity.sock");
24580
+ ACTIVITY_SOCKET_TIMEOUT_MS = 500;
24570
24581
  DEFAULT_DAEMON_PORT = 7391;
24571
24582
  DAEMON_PORT = resolveDaemonPort();
24572
24583
  DAEMON_HOST = "127.0.0.1";
package/dist/cli-main.mjs CHANGED
@@ -24016,19 +24016,29 @@ import http from "http";
24016
24016
  import net from "net";
24017
24017
  import path16 from "path";
24018
24018
  import os11 from "os";
24019
- function notifyActivitySocket(data) {
24019
+ function notifyActivitySocket(data, opts = {}) {
24020
24020
  if (forecastRun()) return Promise.resolve(false);
24021
24021
  return new Promise((resolve2) => {
24022
+ let settled = false;
24023
+ let sock = null;
24024
+ const finish = (ok2) => {
24025
+ if (settled) return;
24026
+ settled = true;
24027
+ clearTimeout(timer);
24028
+ if (!ok2) sock?.destroy();
24029
+ resolve2(ok2);
24030
+ };
24031
+ const timer = setTimeout(() => finish(false), opts.timeoutMs ?? ACTIVITY_SOCKET_TIMEOUT_MS);
24022
24032
  try {
24023
24033
  const payload = JSON.stringify(data);
24024
- const sock = net.createConnection(ACTIVITY_SOCKET_PATH);
24034
+ sock = net.createConnection(opts.socketPath ?? ACTIVITY_SOCKET_PATH);
24025
24035
  sock.on("connect", () => {
24026
- sock.on("close", () => resolve2(true));
24036
+ sock.on("close", () => finish(true));
24027
24037
  sock.end(payload);
24028
24038
  });
24029
- sock.on("error", () => resolve2(false));
24039
+ sock.on("error", () => finish(false));
24030
24040
  } catch {
24031
- resolve2(false);
24041
+ finish(false);
24032
24042
  }
24033
24043
  });
24034
24044
  }
@@ -24563,7 +24573,7 @@ async function resolveViaDaemon(id, decision, internalToken, source, record2) {
24563
24573
  const winner = parseDecisionRecord(body?.record);
24564
24574
  return winner && typeof body?.won === "boolean" ? { won: body.won, record: winner } : null;
24565
24575
  }
24566
- var ACTIVITY_SOCKET_PATH, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
24576
+ var ACTIVITY_SOCKET_PATH, ACTIVITY_SOCKET_TIMEOUT_MS, DEFAULT_DAEMON_PORT, DAEMON_PORT, DAEMON_HOST;
24567
24577
  var init_daemon = __esm({
24568
24578
  "src/auth/daemon.ts"() {
24569
24579
  "use strict";
@@ -24571,6 +24581,7 @@ var init_daemon = __esm({
24571
24581
  init_forecast_context();
24572
24582
  init_decision_record();
24573
24583
  ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : path16.join(os11.tmpdir(), "node9-activity.sock");
24584
+ ACTIVITY_SOCKET_TIMEOUT_MS = 500;
24574
24585
  DEFAULT_DAEMON_PORT = 7391;
24575
24586
  DAEMON_PORT = resolveDaemonPort();
24576
24587
  DAEMON_HOST = "127.0.0.1";
package/dist/hook.js CHANGED
@@ -19662,19 +19662,30 @@ function recordFromLegacyWait(body, now = Date.now()) {
19662
19662
 
19663
19663
  // src/auth/daemon.ts
19664
19664
  var ACTIVITY_SOCKET_PATH = process.platform === "win32" ? "\\\\.\\pipe\\node9-activity" : import_path11.default.join(import_os8.default.tmpdir(), "node9-activity.sock");
19665
- function notifyActivitySocket(data) {
19665
+ var ACTIVITY_SOCKET_TIMEOUT_MS = 500;
19666
+ function notifyActivitySocket(data, opts = {}) {
19666
19667
  if (forecastRun()) return Promise.resolve(false);
19667
19668
  return new Promise((resolve) => {
19669
+ let settled = false;
19670
+ let sock = null;
19671
+ const finish = (ok) => {
19672
+ if (settled) return;
19673
+ settled = true;
19674
+ clearTimeout(timer);
19675
+ if (!ok) sock?.destroy();
19676
+ resolve(ok);
19677
+ };
19678
+ const timer = setTimeout(() => finish(false), opts.timeoutMs ?? ACTIVITY_SOCKET_TIMEOUT_MS);
19668
19679
  try {
19669
19680
  const payload = JSON.stringify(data);
19670
- const sock = import_net.default.createConnection(ACTIVITY_SOCKET_PATH);
19681
+ sock = import_net.default.createConnection(opts.socketPath ?? ACTIVITY_SOCKET_PATH);
19671
19682
  sock.on("connect", () => {
19672
- sock.on("close", () => resolve(true));
19683
+ sock.on("close", () => finish(true));
19673
19684
  sock.end(payload);
19674
19685
  });
19675
- sock.on("error", () => resolve(false));
19686
+ sock.on("error", () => finish(false));
19676
19687
  } catch {
19677
- resolve(false);
19688
+ finish(false);
19678
19689
  }
19679
19690
  });
19680
19691
  }
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
  }
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/proxy",
3
- "version": "2.47.1",
3
+ "version": "2.47.2",
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",