@node9/proxy 2.3.0 → 2.3.1

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.
Files changed (3) hide show
  1. package/dist/cli.js +28 -70
  2. package/dist/cli.mjs +28 -70
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -9810,7 +9810,7 @@ function claudeDesktopConfigPath(homeDir2 = import_os14.default.homedir()) {
9810
9810
  return import_path17.default.join(homeDir2, ".config", "Claude", "claude_desktop_config.json");
9811
9811
  }
9812
9812
  if (process.platform === "win32") {
9813
- const appData = process.env.APPDATA ?? import_path17.default.join(homeDir2, "AppData", "Roaming");
9813
+ const appData = process.env.APPDATA || import_path17.default.join(homeDir2, "AppData", "Roaming");
9814
9814
  return import_path17.default.join(appData, "Claude", "claude_desktop_config.json");
9815
9815
  }
9816
9816
  return null;
@@ -21561,74 +21561,36 @@ function uninstallSystemd() {
21561
21561
  function isSystemdInstalled() {
21562
21562
  return import_fs43.default.existsSync(SYSTEMD_UNIT);
21563
21563
  }
21564
+ function windowsStartupDir(homeDir2 = import_os39.default.homedir()) {
21565
+ const appData = process.env.APPDATA || import_path42.default.join(homeDir2, "AppData", "Roaming");
21566
+ return import_path42.default.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
21567
+ }
21564
21568
  function windowsLauncherVbs(nodePath, scriptPath) {
21565
21569
  for (const p of [nodePath, scriptPath]) {
21566
21570
  if (p.includes('"')) throw new Error(`Illegal quote in path: ${p}`);
21567
21571
  }
21568
21572
  return [
21569
- "' Auto-generated by node9 \u2014 starts the approval daemon with no console window.",
21570
- "' Recreated on every `node9 daemon install`; safe to delete (uninstall does).",
21573
+ "' Auto-generated by node9 - starts the approval daemon with no console window.",
21574
+ "' Recreated by `node9 daemon install`; removed by `node9 daemon uninstall`.",
21571
21575
  'Set sh = CreateObject("Wscript.Shell")',
21572
21576
  'sh.Environment("PROCESS")("NODE9_AUTO_STARTED") = "1"',
21573
21577
  `sh.Run """${nodePath}"" ""${scriptPath}"" daemon", 0, False`,
21574
21578
  ""
21575
21579
  ].join("\r\n");
21576
21580
  }
21577
- function schtasksCreateArgs(launcherPath) {
21578
- return [
21579
- "/Create",
21580
- "/TN",
21581
- SCHTASKS_TASK,
21582
- "/TR",
21583
- `wscript.exe //B "${launcherPath}"`,
21584
- "/SC",
21585
- "ONLOGON",
21586
- "/F"
21587
- ];
21588
- }
21589
- function installSchtasks(binaryPath) {
21590
- const launcher = WIN_LAUNCHER();
21591
- const dir = import_path42.default.dirname(launcher);
21581
+ function installWindowsStartup(binaryPath) {
21582
+ const target = WIN_LAUNCHER();
21583
+ const dir = import_path42.default.dirname(target);
21592
21584
  if (!import_fs43.default.existsSync(dir)) import_fs43.default.mkdirSync(dir, { recursive: true });
21593
- import_fs43.default.writeFileSync(launcher, windowsLauncherVbs(process.execPath, binaryPath), "utf-8");
21594
- const create = (0, import_child_process3.spawnSync)("schtasks", schtasksCreateArgs(launcher), {
21595
- encoding: "utf8",
21596
- timeout: 1e4
21597
- });
21598
- if (create.status !== 0) {
21599
- throw new Error(
21600
- `schtasks /Create failed: ${create.stderr || create.stdout || "unknown error"}`
21601
- );
21602
- }
21603
- (0, import_child_process3.spawnSync)("schtasks", ["/Run", "/TN", SCHTASKS_TASK], { encoding: "utf8", timeout: 1e4 });
21585
+ import_fs43.default.writeFileSync(target, windowsLauncherVbs(process.execPath, binaryPath), "utf-8");
21586
+ (0, import_child_process3.spawnSync)("wscript.exe", ["//B", target], { encoding: "utf8", timeout: 1e4 });
21604
21587
  }
21605
- function uninstallSchtasks() {
21606
- (0, import_child_process3.spawnSync)("schtasks", ["/Delete", "/TN", SCHTASKS_TASK, "/F"], {
21607
- encoding: "utf8",
21608
- timeout: 1e4
21609
- });
21610
- const launcher = WIN_LAUNCHER();
21611
- if (import_fs43.default.existsSync(launcher)) {
21612
- try {
21613
- import_fs43.default.unlinkSync(launcher);
21614
- } catch {
21615
- }
21616
- }
21617
- }
21618
- function isSchtasksInstalled() {
21619
- const r = (0, import_child_process3.spawnSync)("schtasks", ["/Query", "/TN", SCHTASKS_TASK], {
21620
- encoding: "utf8",
21621
- timeout: 5e3
21622
- });
21623
- return r.status === 0;
21588
+ function uninstallWindowsStartup() {
21589
+ const target = WIN_LAUNCHER();
21590
+ if (import_fs43.default.existsSync(target)) import_fs43.default.unlinkSync(target);
21624
21591
  }
21625
- function isSchtasksEnabled() {
21626
- const r = (0, import_child_process3.spawnSync)("schtasks", ["/Query", "/TN", SCHTASKS_TASK, "/XML"], {
21627
- encoding: "utf8",
21628
- timeout: 5e3
21629
- });
21630
- if (r.status !== 0) return false;
21631
- return !/<Enabled>\s*false\s*<\/Enabled>/i.test(r.stdout ?? "");
21592
+ function isWindowsStartupInstalled() {
21593
+ return import_fs43.default.existsSync(WIN_LAUNCHER());
21632
21594
  }
21633
21595
  function stopRunningDaemon() {
21634
21596
  const pidFile = import_path42.default.join(import_os39.default.homedir(), ".node9", "daemon.pid");
@@ -21688,9 +21650,9 @@ function installDaemonService() {
21688
21650
  return { ok: true, platform: "systemd", alreadyInstalled };
21689
21651
  }
21690
21652
  if (process.platform === "win32") {
21691
- const alreadyInstalled = isSchtasksInstalled();
21692
- installSchtasks(binary);
21693
- return { ok: true, platform: "schtasks", alreadyInstalled };
21653
+ const alreadyInstalled = isWindowsStartupInstalled();
21654
+ installWindowsStartup(binary);
21655
+ return { ok: true, platform: "startup-folder", alreadyInstalled };
21694
21656
  }
21695
21657
  return {
21696
21658
  ok: false,
@@ -21714,8 +21676,8 @@ function uninstallDaemonService() {
21714
21676
  return { ok: true, platform: "systemd", alreadyInstalled: false };
21715
21677
  }
21716
21678
  if (process.platform === "win32") {
21717
- uninstallSchtasks();
21718
- return { ok: true, platform: "schtasks", alreadyInstalled: false };
21679
+ uninstallWindowsStartup();
21680
+ return { ok: true, platform: "startup-folder", alreadyInstalled: false };
21719
21681
  }
21720
21682
  return {
21721
21683
  ok: false,
@@ -21731,7 +21693,7 @@ function uninstallDaemonService() {
21731
21693
  function isDaemonServiceInstalled() {
21732
21694
  if (process.platform === "darwin") return isLaunchdInstalled();
21733
21695
  if (process.platform === "linux") return isSystemdInstalled();
21734
- if (process.platform === "win32") return isSchtasksInstalled();
21696
+ if (process.platform === "win32") return isWindowsStartupInstalled();
21735
21697
  return false;
21736
21698
  }
21737
21699
  function autostartRepairDecision(opts) {
@@ -21752,11 +21714,7 @@ function enableDaemonServiceQuiet() {
21752
21714
  return r.status === 0;
21753
21715
  }
21754
21716
  if (process.platform === "win32") {
21755
- const r = (0, import_child_process3.spawnSync)("schtasks", ["/Change", "/TN", SCHTASKS_TASK, "/ENABLE"], {
21756
- encoding: "utf8",
21757
- timeout: 5e3
21758
- });
21759
- return r.status === 0;
21717
+ return isWindowsStartupInstalled();
21760
21718
  }
21761
21719
  return process.platform === "darwin";
21762
21720
  } catch {
@@ -21812,13 +21770,13 @@ function isDaemonServiceEnabled() {
21812
21770
  return r.status === 0;
21813
21771
  }
21814
21772
  if (process.platform === "win32") {
21815
- return isSchtasksEnabled();
21773
+ return isWindowsStartupInstalled();
21816
21774
  }
21817
21775
  } catch {
21818
21776
  }
21819
21777
  return false;
21820
21778
  }
21821
- var import_fs43, import_path42, import_os39, import_child_process3, LAUNCHD_LABEL, LAUNCHD_PLIST, SYSTEMD_UNIT_DIR, SYSTEMD_UNIT, SCHTASKS_TASK, WIN_LAUNCHER;
21779
+ var import_fs43, import_path42, import_os39, import_child_process3, LAUNCHD_LABEL, LAUNCHD_PLIST, SYSTEMD_UNIT_DIR, SYSTEMD_UNIT, STARTUP_FILE, WIN_LAUNCHER;
21822
21780
  var init_service = __esm({
21823
21781
  "src/daemon/service.ts"() {
21824
21782
  "use strict";
@@ -21830,8 +21788,8 @@ var init_service = __esm({
21830
21788
  LAUNCHD_PLIST = import_path42.default.join(import_os39.default.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
21831
21789
  SYSTEMD_UNIT_DIR = import_path42.default.join(import_os39.default.homedir(), ".config", "systemd", "user");
21832
21790
  SYSTEMD_UNIT = import_path42.default.join(SYSTEMD_UNIT_DIR, "node9-daemon.service");
21833
- SCHTASKS_TASK = "Node9Daemon";
21834
- WIN_LAUNCHER = () => import_path42.default.join(import_os39.default.homedir(), ".node9", "daemon-launcher.vbs");
21791
+ STARTUP_FILE = "node9-daemon.vbs";
21792
+ WIN_LAUNCHER = () => import_path42.default.join(windowsStartupDir(), STARTUP_FILE);
21835
21793
  }
21836
21794
  });
21837
21795
 
package/dist/cli.mjs CHANGED
@@ -9818,7 +9818,7 @@ function claudeDesktopConfigPath(homeDir2 = os14.homedir()) {
9818
9818
  return path17.join(homeDir2, ".config", "Claude", "claude_desktop_config.json");
9819
9819
  }
9820
9820
  if (process.platform === "win32") {
9821
- const appData = process.env.APPDATA ?? path17.join(homeDir2, "AppData", "Roaming");
9821
+ const appData = process.env.APPDATA || path17.join(homeDir2, "AppData", "Roaming");
9822
9822
  return path17.join(appData, "Claude", "claude_desktop_config.json");
9823
9823
  }
9824
9824
  return null;
@@ -21558,74 +21558,36 @@ function uninstallSystemd() {
21558
21558
  function isSystemdInstalled() {
21559
21559
  return fs44.existsSync(SYSTEMD_UNIT);
21560
21560
  }
21561
+ function windowsStartupDir(homeDir2 = os40.homedir()) {
21562
+ const appData = process.env.APPDATA || path43.join(homeDir2, "AppData", "Roaming");
21563
+ return path43.join(appData, "Microsoft", "Windows", "Start Menu", "Programs", "Startup");
21564
+ }
21561
21565
  function windowsLauncherVbs(nodePath, scriptPath) {
21562
21566
  for (const p of [nodePath, scriptPath]) {
21563
21567
  if (p.includes('"')) throw new Error(`Illegal quote in path: ${p}`);
21564
21568
  }
21565
21569
  return [
21566
- "' Auto-generated by node9 \u2014 starts the approval daemon with no console window.",
21567
- "' Recreated on every `node9 daemon install`; safe to delete (uninstall does).",
21570
+ "' Auto-generated by node9 - starts the approval daemon with no console window.",
21571
+ "' Recreated by `node9 daemon install`; removed by `node9 daemon uninstall`.",
21568
21572
  'Set sh = CreateObject("Wscript.Shell")',
21569
21573
  'sh.Environment("PROCESS")("NODE9_AUTO_STARTED") = "1"',
21570
21574
  `sh.Run """${nodePath}"" ""${scriptPath}"" daemon", 0, False`,
21571
21575
  ""
21572
21576
  ].join("\r\n");
21573
21577
  }
21574
- function schtasksCreateArgs(launcherPath) {
21575
- return [
21576
- "/Create",
21577
- "/TN",
21578
- SCHTASKS_TASK,
21579
- "/TR",
21580
- `wscript.exe //B "${launcherPath}"`,
21581
- "/SC",
21582
- "ONLOGON",
21583
- "/F"
21584
- ];
21585
- }
21586
- function installSchtasks(binaryPath) {
21587
- const launcher = WIN_LAUNCHER();
21588
- const dir = path43.dirname(launcher);
21578
+ function installWindowsStartup(binaryPath) {
21579
+ const target = WIN_LAUNCHER();
21580
+ const dir = path43.dirname(target);
21589
21581
  if (!fs44.existsSync(dir)) fs44.mkdirSync(dir, { recursive: true });
21590
- fs44.writeFileSync(launcher, windowsLauncherVbs(process.execPath, binaryPath), "utf-8");
21591
- const create = spawnSync2("schtasks", schtasksCreateArgs(launcher), {
21592
- encoding: "utf8",
21593
- timeout: 1e4
21594
- });
21595
- if (create.status !== 0) {
21596
- throw new Error(
21597
- `schtasks /Create failed: ${create.stderr || create.stdout || "unknown error"}`
21598
- );
21599
- }
21600
- spawnSync2("schtasks", ["/Run", "/TN", SCHTASKS_TASK], { encoding: "utf8", timeout: 1e4 });
21582
+ fs44.writeFileSync(target, windowsLauncherVbs(process.execPath, binaryPath), "utf-8");
21583
+ spawnSync2("wscript.exe", ["//B", target], { encoding: "utf8", timeout: 1e4 });
21601
21584
  }
21602
- function uninstallSchtasks() {
21603
- spawnSync2("schtasks", ["/Delete", "/TN", SCHTASKS_TASK, "/F"], {
21604
- encoding: "utf8",
21605
- timeout: 1e4
21606
- });
21607
- const launcher = WIN_LAUNCHER();
21608
- if (fs44.existsSync(launcher)) {
21609
- try {
21610
- fs44.unlinkSync(launcher);
21611
- } catch {
21612
- }
21613
- }
21614
- }
21615
- function isSchtasksInstalled() {
21616
- const r = spawnSync2("schtasks", ["/Query", "/TN", SCHTASKS_TASK], {
21617
- encoding: "utf8",
21618
- timeout: 5e3
21619
- });
21620
- return r.status === 0;
21585
+ function uninstallWindowsStartup() {
21586
+ const target = WIN_LAUNCHER();
21587
+ if (fs44.existsSync(target)) fs44.unlinkSync(target);
21621
21588
  }
21622
- function isSchtasksEnabled() {
21623
- const r = spawnSync2("schtasks", ["/Query", "/TN", SCHTASKS_TASK, "/XML"], {
21624
- encoding: "utf8",
21625
- timeout: 5e3
21626
- });
21627
- if (r.status !== 0) return false;
21628
- return !/<Enabled>\s*false\s*<\/Enabled>/i.test(r.stdout ?? "");
21589
+ function isWindowsStartupInstalled() {
21590
+ return fs44.existsSync(WIN_LAUNCHER());
21629
21591
  }
21630
21592
  function stopRunningDaemon() {
21631
21593
  const pidFile = path43.join(os40.homedir(), ".node9", "daemon.pid");
@@ -21685,9 +21647,9 @@ function installDaemonService() {
21685
21647
  return { ok: true, platform: "systemd", alreadyInstalled };
21686
21648
  }
21687
21649
  if (process.platform === "win32") {
21688
- const alreadyInstalled = isSchtasksInstalled();
21689
- installSchtasks(binary);
21690
- return { ok: true, platform: "schtasks", alreadyInstalled };
21650
+ const alreadyInstalled = isWindowsStartupInstalled();
21651
+ installWindowsStartup(binary);
21652
+ return { ok: true, platform: "startup-folder", alreadyInstalled };
21691
21653
  }
21692
21654
  return {
21693
21655
  ok: false,
@@ -21711,8 +21673,8 @@ function uninstallDaemonService() {
21711
21673
  return { ok: true, platform: "systemd", alreadyInstalled: false };
21712
21674
  }
21713
21675
  if (process.platform === "win32") {
21714
- uninstallSchtasks();
21715
- return { ok: true, platform: "schtasks", alreadyInstalled: false };
21676
+ uninstallWindowsStartup();
21677
+ return { ok: true, platform: "startup-folder", alreadyInstalled: false };
21716
21678
  }
21717
21679
  return {
21718
21680
  ok: false,
@@ -21728,7 +21690,7 @@ function uninstallDaemonService() {
21728
21690
  function isDaemonServiceInstalled() {
21729
21691
  if (process.platform === "darwin") return isLaunchdInstalled();
21730
21692
  if (process.platform === "linux") return isSystemdInstalled();
21731
- if (process.platform === "win32") return isSchtasksInstalled();
21693
+ if (process.platform === "win32") return isWindowsStartupInstalled();
21732
21694
  return false;
21733
21695
  }
21734
21696
  function autostartRepairDecision(opts) {
@@ -21749,11 +21711,7 @@ function enableDaemonServiceQuiet() {
21749
21711
  return r.status === 0;
21750
21712
  }
21751
21713
  if (process.platform === "win32") {
21752
- const r = spawnSync2("schtasks", ["/Change", "/TN", SCHTASKS_TASK, "/ENABLE"], {
21753
- encoding: "utf8",
21754
- timeout: 5e3
21755
- });
21756
- return r.status === 0;
21714
+ return isWindowsStartupInstalled();
21757
21715
  }
21758
21716
  return process.platform === "darwin";
21759
21717
  } catch {
@@ -21809,13 +21767,13 @@ function isDaemonServiceEnabled() {
21809
21767
  return r.status === 0;
21810
21768
  }
21811
21769
  if (process.platform === "win32") {
21812
- return isSchtasksEnabled();
21770
+ return isWindowsStartupInstalled();
21813
21771
  }
21814
21772
  } catch {
21815
21773
  }
21816
21774
  return false;
21817
21775
  }
21818
- var LAUNCHD_LABEL, LAUNCHD_PLIST, SYSTEMD_UNIT_DIR, SYSTEMD_UNIT, SCHTASKS_TASK, WIN_LAUNCHER;
21776
+ var LAUNCHD_LABEL, LAUNCHD_PLIST, SYSTEMD_UNIT_DIR, SYSTEMD_UNIT, STARTUP_FILE, WIN_LAUNCHER;
21819
21777
  var init_service = __esm({
21820
21778
  "src/daemon/service.ts"() {
21821
21779
  "use strict";
@@ -21823,8 +21781,8 @@ var init_service = __esm({
21823
21781
  LAUNCHD_PLIST = path43.join(os40.homedir(), "Library", "LaunchAgents", `${LAUNCHD_LABEL}.plist`);
21824
21782
  SYSTEMD_UNIT_DIR = path43.join(os40.homedir(), ".config", "systemd", "user");
21825
21783
  SYSTEMD_UNIT = path43.join(SYSTEMD_UNIT_DIR, "node9-daemon.service");
21826
- SCHTASKS_TASK = "Node9Daemon";
21827
- WIN_LAUNCHER = () => path43.join(os40.homedir(), ".node9", "daemon-launcher.vbs");
21784
+ STARTUP_FILE = "node9-daemon.vbs";
21785
+ WIN_LAUNCHER = () => path43.join(windowsStartupDir(), STARTUP_FILE);
21828
21786
  }
21829
21787
  });
21830
21788
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@node9/proxy",
3
- "version": "2.3.0",
3
+ "version": "2.3.1",
4
4
  "description": "The Sudo Command for AI Agents. Execution Security for Claude Code, Codex, Gemini, Cursor, Opencode, Pi, and any MCP server.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",