pinggy 0.6.7 → 0.6.9

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.
@@ -11,14 +11,14 @@ import {
11
11
  } from "./chunk-HTIWY3O5.js";
12
12
  import {
13
13
  logger
14
- } from "./chunk-LWCVB42S.js";
14
+ } from "./chunk-DGAH7UVX.js";
15
15
  import {
16
16
  ensurePinggyConfigDir,
17
17
  getDaemonInfoPath,
18
18
  getDaemonLogPath,
19
19
  getPinggyConfigDir,
20
20
  getUpdateStatePath
21
- } from "./chunk-MAK5R4WQ.js";
21
+ } from "./chunk-WFHMERT3.js";
22
22
 
23
23
  // src/update/updateState.ts
24
24
  import fs from "fs";
@@ -29,7 +29,9 @@ var NUMBER_FIELDS = [
29
29
  "latestSeenEpochSeconds",
30
30
  "lastCheckFailureNoticeEpochSeconds",
31
31
  "failedAttempts",
32
- "deferredIpcVersion"
32
+ "deferredIpcVersion",
33
+ "cachedVersionSizeBytes",
34
+ "cachedVersionModifiedMillis"
33
35
  ];
34
36
  var STRING_FIELDS = [
35
37
  "latestVersion",
@@ -39,7 +41,11 @@ var STRING_FIELDS = [
39
41
  "updatedFromVersion",
40
42
  "updatedToVersion",
41
43
  "failedVersion",
42
- "deferredVersion"
44
+ "deferredVersion",
45
+ "declinedInstallPath",
46
+ "declinedInstallVersion",
47
+ "cachedVersionPath",
48
+ "cachedVersion"
43
49
  ];
44
50
  function nowEpochSeconds() {
45
51
  return Math.floor(Date.now() / 1e3);
@@ -82,6 +88,11 @@ function recordLatestVersion(version) {
82
88
  const changed = readUpdateState().latestVersion !== version;
83
89
  return writeUpdateState(changed ? { latestVersion: version, latestSeenEpochSeconds: nowEpochSeconds() } : { latestVersion: version });
84
90
  }
91
+ function moveDeclinedInstallToVersion(execPath, newVersion) {
92
+ if (readUpdateState().declinedInstallPath?.toLowerCase() === execPath.toLowerCase()) {
93
+ writeUpdateState({ declinedInstallVersion: newVersion });
94
+ }
95
+ }
85
96
 
86
97
  // src/devices/terminal/nodePtyRuntime.ts
87
98
  import crypto from "crypto";
@@ -223,6 +234,7 @@ var NODE_MODULES_SEGMENT = "node_modules";
223
234
  var WINDOWS_INSTALL_COMMAND = "irm https://pinggy.io/install.ps1 | iex";
224
235
  var UNIX_INSTALL_COMMAND = "curl -fsSL https://pinggy.io/install.sh | sh";
225
236
  var NPM_INSTALL_COMMAND = "npm i -g pinggy";
237
+ var NPM_UNINSTALL_COMMAND = "npm uninstall -g pinggy";
226
238
  function hasPathSegment(candidate, segment) {
227
239
  return candidate !== null && candidate.split(/[\\/]/).includes(segment);
228
240
  }
@@ -290,16 +302,71 @@ function createInstallProbe() {
290
302
  };
291
303
  }
292
304
 
305
+ // src/daemon/lifecycle/bootId.ts
306
+ import fs4 from "fs";
307
+ import os2 from "os";
308
+ import { execFileSync } from "child_process";
309
+ var LINUX_BOOT_ID_PATH = "/proc/sys/kernel/random/boot_id";
310
+ var MACOS_SYSCTL_PATH = "/usr/sbin/sysctl";
311
+ var MACOS_BOOT_ID_KEY = "kern.bootsessionuuid";
312
+ var SYSCTL_TIMEOUT_MILLIS = 2e3;
313
+ var BOOT_TIME_TOLERANCE_MILLIS = 6e4;
314
+ var machineBootIdSources = {
315
+ platform: process.platform,
316
+ readFile: (filePath) => fs4.readFileSync(filePath, "utf-8"),
317
+ runCommand: (command, args) => execFileSync(command, args, {
318
+ encoding: "utf-8",
319
+ stdio: ["ignore", "pipe", "ignore"],
320
+ timeout: SYSCTL_TIMEOUT_MILLIS
321
+ })
322
+ };
323
+ var cachedBootId;
324
+ function readBootId(sources) {
325
+ try {
326
+ switch (sources.platform) {
327
+ case "linux":
328
+ return nonEmpty(sources.readFile(LINUX_BOOT_ID_PATH));
329
+ case "darwin":
330
+ return nonEmpty(sources.runCommand(MACOS_SYSCTL_PATH, ["-n", MACOS_BOOT_ID_KEY]));
331
+ default:
332
+ return null;
333
+ }
334
+ } catch {
335
+ return null;
336
+ }
337
+ }
338
+ function currentBootId() {
339
+ if (cachedBootId === void 0) {
340
+ cachedBootId = readBootId(machineBootIdSources);
341
+ }
342
+ return cachedBootId;
343
+ }
344
+ function startedInEarlierBoot(recordedBootId, startedAt, bootId = currentBootId()) {
345
+ if (typeof recordedBootId === "string" && recordedBootId.length > 0 && bootId) {
346
+ return recordedBootId !== bootId;
347
+ }
348
+ return startedBeforeBoot(startedAt);
349
+ }
350
+ function startedBeforeBoot(startedAt) {
351
+ const startedAtMillis = Date.parse(startedAt);
352
+ const bootMillis = Date.now() - os2.uptime() * 1e3;
353
+ return Number.isNaN(startedAtMillis) || startedAtMillis < bootMillis - BOOT_TIME_TOLERANCE_MILLIS;
354
+ }
355
+ function nonEmpty(text) {
356
+ const trimmed = text.trim();
357
+ return trimmed.length > 0 ? trimmed : null;
358
+ }
359
+
293
360
  // src/daemon/lifecycle/daemonManager.ts
294
- import os3 from "os";
295
- import fs5 from "fs";
361
+ import os4 from "os";
362
+ import fs6 from "fs";
296
363
  import { spawn } from "child_process";
297
364
 
298
365
  // src/daemon/lifecycle/serviceInstaller.ts
299
- import os2 from "os";
300
- import fs4 from "fs";
366
+ import os3 from "os";
367
+ import fs5 from "fs";
301
368
  import path4 from "path";
302
- import { execSync, execFileSync } from "child_process";
369
+ import { execSync, execFileSync as execFileSync2 } from "child_process";
303
370
  var SERVICE_LABEL = "io.pinggy.agent";
304
371
  var SYSTEMD_SERVICE_NAME = "pinggy";
305
372
  var SERVICE_ANY_LOCATION_ENV = "PINGGY_SERVICE_ANY_LOCATION";
@@ -312,7 +379,7 @@ function installerBinaryPath(platform, home, env) {
312
379
  }
313
380
  function realPath(p) {
314
381
  try {
315
- return fs4.realpathSync(p);
382
+ return fs5.realpathSync(p);
316
383
  } catch {
317
384
  return p;
318
385
  }
@@ -338,18 +405,33 @@ function isInstallerBinary(ctx) {
338
405
  return actual === expected;
339
406
  }
340
407
  function installerFix(platform) {
341
- const installCommand = platform === "win32" ? "irm https://pinggy.io/install.ps1 | iex" : "curl -fsSL https://pinggy.io/install.sh | sh";
342
408
  return [
343
409
  "pinggy can only run as a service when it is installed with the Pinggy installer.",
344
410
  "Install it, then run this command again:",
345
- ` ${installCommand}`,
411
+ ` ${installCommandFor(platform)}`,
412
+ " pinggy daemon service-install"
413
+ ].join("\n");
414
+ }
415
+ function npmInstallerFix(platform) {
416
+ return [
417
+ "The npm version of pinggy cannot run as a service.",
418
+ "Remove it, install pinggy with the Pinggy installer, then run this command again:",
419
+ ` ${NPM_UNINSTALL_COMMAND}`,
420
+ ` ${installCommandFor(platform)}`,
346
421
  " pinggy daemon service-install"
347
422
  ].join("\n");
348
423
  }
349
- function serviceInstallRefusal(ctx) {
350
- if (!ctx.isPkg) return `The npm version of pinggy cannot run as a service.
351
- ${installerFix(ctx.platform)}`;
424
+ function installedCopyFix(installedPath) {
425
+ return [
426
+ "This pinggy is not the installed one. Run this command with the installed copy:",
427
+ ` ${installedPath} daemon service-install`
428
+ ].join("\n");
429
+ }
430
+ function serviceInstallRefusal(ctx, fileExists = fs5.existsSync) {
431
+ if (!ctx.isPkg) return npmInstallerFix(ctx.platform);
352
432
  if (ctx.env[SERVICE_ANY_LOCATION_ENV] === "1" || isInstallerBinary(ctx)) return null;
433
+ const installedPath = installerBinaryPath(ctx.platform, ctx.home, ctx.env);
434
+ if (fileExists(installedPath)) return installedCopyFix(installedPath);
353
435
  return installerFix(ctx.platform);
354
436
  }
355
437
  function printInstalled() {
@@ -367,7 +449,7 @@ function toolError(err) {
367
449
  return stderr ? stderr.replace(/^ERROR:\s*/i, "") : errorMessage(err);
368
450
  }
369
451
  function getSystemdServicePath() {
370
- const dir = path4.join(os2.homedir(), ".config", "systemd", "user");
452
+ const dir = path4.join(os3.homedir(), ".config", "systemd", "user");
371
453
  return path4.join(dir, `${SYSTEMD_SERVICE_NAME}.service`);
372
454
  }
373
455
  function generateSystemdUnit(program) {
@@ -390,18 +472,18 @@ WantedBy=default.target
390
472
  function installSystemd(program) {
391
473
  const servicePath = getSystemdServicePath();
392
474
  const dir = path4.dirname(servicePath);
393
- fs4.mkdirSync(dir, { recursive: true });
394
- fs4.writeFileSync(servicePath, generateSystemdUnit(program), "utf-8");
475
+ fs5.mkdirSync(dir, { recursive: true });
476
+ fs5.writeFileSync(servicePath, generateSystemdUnit(program), "utf-8");
395
477
  execSync("systemctl --user daemon-reload", QUIET);
396
478
  execSync(`systemctl --user enable ${SYSTEMD_SERVICE_NAME}`, QUIET);
397
479
  execSync(`systemctl --user start ${SYSTEMD_SERVICE_NAME}`, QUIET);
398
480
  logger.info("systemd user service installed", { servicePath });
399
481
  printInstalled();
400
- enableLinger(os2.userInfo().username);
482
+ enableLinger(os3.userInfo().username);
401
483
  }
402
484
  function lingerEnabled(username) {
403
485
  try {
404
- const output = execFileSync("loginctl", ["show-user", username, "--property=Linger"], {
486
+ const output = execFileSync2("loginctl", ["show-user", username, "--property=Linger"], {
405
487
  encoding: "utf-8",
406
488
  stdio: ["ignore", "pipe", "ignore"]
407
489
  });
@@ -413,7 +495,7 @@ function lingerEnabled(username) {
413
495
  function enableLinger(username) {
414
496
  if (lingerEnabled(username)) return;
415
497
  try {
416
- execFileSync("loginctl", ["--no-ask-password", "enable-linger", username], QUIET);
498
+ execFileSync2("loginctl", ["--no-ask-password", "enable-linger", username], QUIET);
417
499
  logger.info("systemd lingering enabled", { username });
418
500
  } catch (err) {
419
501
  logger.warn("loginctl enable-linger failed", { error: errorMessage(err) });
@@ -427,8 +509,8 @@ function uninstallSystemd() {
427
509
  execSync(`systemctl --user disable ${SYSTEMD_SERVICE_NAME} 2>/dev/null || true`);
428
510
  } catch {
429
511
  }
430
- if (fs4.existsSync(servicePath)) {
431
- fs4.unlinkSync(servicePath);
512
+ if (fs5.existsSync(servicePath)) {
513
+ fs5.unlinkSync(servicePath);
432
514
  execSync("systemctl --user daemon-reload", QUIET);
433
515
  logger.info("systemd user service removed", { servicePath });
434
516
  printUninstalled();
@@ -437,7 +519,7 @@ function uninstallSystemd() {
437
519
  }
438
520
  }
439
521
  function getLaunchdPlistPath() {
440
- return path4.join(os2.homedir(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`);
522
+ return path4.join(os3.homedir(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`);
441
523
  }
442
524
  function generateLaunchdPlist(program) {
443
525
  const allArgs = [program, "--_daemon-child"];
@@ -464,8 +546,8 @@ ${programArgs}
464
546
  function installLaunchd(program) {
465
547
  const plistPath = getLaunchdPlistPath();
466
548
  const dir = path4.dirname(plistPath);
467
- fs4.mkdirSync(dir, { recursive: true });
468
- fs4.writeFileSync(plistPath, generateLaunchdPlist(program), "utf-8");
549
+ fs5.mkdirSync(dir, { recursive: true });
550
+ fs5.writeFileSync(plistPath, generateLaunchdPlist(program), "utf-8");
469
551
  const uid = process.getuid?.() ?? 501;
470
552
  try {
471
553
  execSync(`launchctl bootout gui/${uid}/${SERVICE_LABEL} 2>/dev/null || true`);
@@ -496,8 +578,8 @@ function uninstallLaunchd() {
496
578
  } catch {
497
579
  }
498
580
  }
499
- if (fs4.existsSync(plistPath)) {
500
- fs4.unlinkSync(plistPath);
581
+ if (fs5.existsSync(plistPath)) {
582
+ fs5.unlinkSync(plistPath);
501
583
  logger.info("launchd agent removed", { plistPath });
502
584
  printUninstalled();
503
585
  } else {
@@ -509,7 +591,7 @@ function escapeXml(value) {
509
591
  return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
510
592
  }
511
593
  function getWindowsUserId() {
512
- const user = process.env.USERNAME || os2.userInfo().username;
594
+ const user = process.env.USERNAME || os3.userInfo().username;
513
595
  const domain = process.env.USERDOMAIN;
514
596
  return domain ? `${domain}\\${user}` : user;
515
597
  }
@@ -551,20 +633,20 @@ function generateTaskXml(program, userId) {
551
633
  }
552
634
  function createWindowsTask(program) {
553
635
  const xml = generateTaskXml(program, getWindowsUserId());
554
- const tmpPath = path4.join(os2.tmpdir(), `${WINDOWS_TASK_NAME}.xml`);
555
- fs4.writeFileSync(tmpPath, "\uFEFF" + xml, "utf16le");
636
+ const tmpPath = path4.join(os3.tmpdir(), `${WINDOWS_TASK_NAME}.xml`);
637
+ fs5.writeFileSync(tmpPath, "\uFEFF" + xml, "utf16le");
556
638
  try {
557
- execFileSync("schtasks", ["/Create", "/TN", WINDOWS_TASK_NAME, "/XML", tmpPath, "/F"], QUIET);
639
+ execFileSync2("schtasks", ["/Create", "/TN", WINDOWS_TASK_NAME, "/XML", tmpPath, "/F"], QUIET);
558
640
  } finally {
559
641
  try {
560
- fs4.unlinkSync(tmpPath);
642
+ fs5.unlinkSync(tmpPath);
561
643
  } catch {
562
644
  }
563
645
  }
564
646
  }
565
647
  function windowsTaskExists() {
566
648
  try {
567
- execFileSync("schtasks", ["/Query", "/TN", WINDOWS_TASK_NAME], QUIET);
649
+ execFileSync2("schtasks", ["/Query", "/TN", WINDOWS_TASK_NAME], QUIET);
568
650
  return true;
569
651
  } catch {
570
652
  return false;
@@ -572,7 +654,7 @@ function windowsTaskExists() {
572
654
  }
573
655
  function isElevated() {
574
656
  try {
575
- return /S-1-16-(12288|16384)\b/.test(execFileSync("whoami", ["/groups"], { encoding: "utf-8" }));
657
+ return /S-1-16-(12288|16384)\b/.test(execFileSync2("whoami", ["/groups"], { encoding: "utf-8" }));
576
658
  } catch {
577
659
  return false;
578
660
  }
@@ -586,7 +668,7 @@ function windowsTaskError(action, undo, err) {
586
668
  function installWindows(program) {
587
669
  try {
588
670
  createWindowsTask(program);
589
- execFileSync("schtasks", ["/Run", "/TN", WINDOWS_TASK_NAME], QUIET);
671
+ execFileSync2("schtasks", ["/Run", "/TN", WINDOWS_TASK_NAME], QUIET);
590
672
  } catch (err) {
591
673
  printer_default.error(windowsTaskError("set pinggy to start automatically", "change it", err));
592
674
  process.exit(1);
@@ -600,7 +682,7 @@ async function uninstallWindows() {
600
682
  return;
601
683
  }
602
684
  try {
603
- execFileSync("schtasks", ["/Delete", "/TN", WINDOWS_TASK_NAME, "/F"], QUIET);
685
+ execFileSync2("schtasks", ["/Delete", "/TN", WINDOWS_TASK_NAME, "/F"], QUIET);
604
686
  } catch (err) {
605
687
  printer_default.error(windowsTaskError("stop pinggy from starting automatically", "turn it off", err));
606
688
  process.exit(1);
@@ -613,19 +695,19 @@ async function uninstallWindows() {
613
695
  printUninstalled();
614
696
  }
615
697
  function readServiceEntryText() {
616
- const platform = os2.platform();
698
+ const platform = os3.platform();
617
699
  if (platform !== "linux" && platform !== "darwin") return "";
618
700
  try {
619
- return fs4.readFileSync(platform === "linux" ? getSystemdServicePath() : getLaunchdPlistPath(), "utf-8");
701
+ return fs5.readFileSync(platform === "linux" ? getSystemdServicePath() : getLaunchdPlistPath(), "utf-8");
620
702
  } catch {
621
703
  return "";
622
704
  }
623
705
  }
624
706
  var SERVICE_QUERY_TIMEOUT_MILLIS = 2e3;
625
707
  function runServiceQuery(command, args) {
626
- return execFileSync(command, args, { encoding: "utf-8", timeout: SERVICE_QUERY_TIMEOUT_MILLIS, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
708
+ return execFileSync2(command, args, { encoding: "utf-8", timeout: SERVICE_QUERY_TIMEOUT_MILLIS, stdio: ["ignore", "pipe", "ignore"], windowsHide: true });
627
709
  }
628
- function serviceRestartInstruction(info, platform = os2.platform(), query = runServiceQuery, uid = process.getuid?.() ?? 501) {
710
+ function serviceRestartInstruction(info, platform = os3.platform(), query = runServiceQuery, uid = process.getuid?.() ?? 501) {
629
711
  try {
630
712
  if (platform === "linux") {
631
713
  const mainPid = query("systemctl", ["--user", "show", "-p", "MainPID", "--value", SYSTEMD_SERVICE_NAME]).trim();
@@ -642,12 +724,12 @@ function serviceRestartInstruction(info, platform = os2.platform(), query = runS
642
724
  return null;
643
725
  }
644
726
  function installService() {
645
- const platform = os2.platform();
727
+ const platform = os3.platform();
646
728
  const context = {
647
729
  platform,
648
730
  isPkg: "pkg" in process,
649
731
  execPath: process.execPath,
650
- home: os2.homedir(),
732
+ home: os3.homedir(),
651
733
  env: process.env
652
734
  };
653
735
  const refusal = serviceInstallRefusal(context);
@@ -672,7 +754,7 @@ function installService() {
672
754
  }
673
755
  }
674
756
  async function uninstallService() {
675
- const platform = os2.platform();
757
+ const platform = os3.platform();
676
758
  switch (platform) {
677
759
  case "linux":
678
760
  uninstallSystemd();
@@ -695,7 +777,6 @@ var DAEMON_SPAWN_TIMEOUT_MS = 8e3;
695
777
  var DAEMON_POLL_INTERVAL_MS = 200;
696
778
  var SPAWN_FAILED_EXIT_CODE = -1;
697
779
  var DAEMON_STOP_INSTRUCTION = '"pinggy daemon stop"';
698
- var BOOT_TIME_TOLERANCE_MILLIS = 6e4;
699
780
  function isProcessAlive(pid) {
700
781
  try {
701
782
  process.kill(pid, 0);
@@ -704,21 +785,16 @@ function isProcessAlive(pid) {
704
785
  return err.code === "EPERM";
705
786
  }
706
787
  }
707
- function startedBeforeBoot(startedAt) {
708
- const startedAtMillis = Date.parse(startedAt);
709
- const bootMillis = Date.now() - os3.uptime() * 1e3;
710
- return Number.isNaN(startedAtMillis) || startedAtMillis < bootMillis - BOOT_TIME_TOLERANCE_MILLIS;
711
- }
712
788
  function getDaemonInfo() {
713
789
  const infoPath = getDaemonInfoPath();
714
- if (!fs5.existsSync(infoPath)) return null;
790
+ if (!fs6.existsSync(infoPath)) return null;
715
791
  try {
716
- const data = JSON.parse(fs5.readFileSync(infoPath, "utf-8"));
792
+ const data = JSON.parse(fs6.readFileSync(infoPath, "utf-8"));
717
793
  if (!data.pid || !data.port) return null;
718
- if (startedBeforeBoot(data.startedAt) || !isProcessAlive(data.pid)) {
794
+ if (startedInEarlierBoot(data.bootId, data.startedAt) || !isProcessAlive(data.pid)) {
719
795
  logger.info("Stale daemon.json found, cleaning up", { stalePid: data.pid });
720
796
  try {
721
- fs5.unlinkSync(infoPath);
797
+ fs6.unlinkSync(infoPath);
722
798
  } catch {
723
799
  }
724
800
  return null;
@@ -753,7 +829,14 @@ function printDaemonVersionNoticeOnce(info, restartInstruction = serviceRestartI
753
829
  printer_default.print(`${runs} Run ${instruction} to start ${running}. This stops all running tunnels.`);
754
830
  }
755
831
  }
756
- function getDaemonSpawnArgs(isPackaged = isPackagedBinary(), executableExists = fs5.existsSync(process.execPath), linkPath = unixLayoutPaths(os3.homedir()).link) {
832
+ var installedBinaryForDaemon = null;
833
+ function startDaemonFromInstalledBinary(binaryPath) {
834
+ installedBinaryForDaemon = binaryPath;
835
+ }
836
+ function getDaemonSpawnArgs(isPackaged = isPackagedBinary(), executableExists = fs6.existsSync(process.execPath), linkPath = unixLayoutPaths(os4.homedir()).link, installedBinary = installedBinaryForDaemon) {
837
+ if (isPackaged && installedBinary) {
838
+ return { command: installedBinary, args: ["--_daemon-child"], env: { ...process.env } };
839
+ }
757
840
  if (isPackaged && !executableExists) {
758
841
  return { command: linkPath, args: ["--_daemon-child"], env: { ...process.env } };
759
842
  }
@@ -777,7 +860,7 @@ async function startDaemon() {
777
860
  detached: true,
778
861
  stdio: ["ignore", "ignore", "pipe"],
779
862
  env,
780
- ...os3.platform() === "win32" ? { windowsHide: true } : {}
863
+ ...os4.platform() === "win32" ? { windowsHide: true } : {}
781
864
  });
782
865
  child.stderr?.on("data", (chunk) => {
783
866
  stderrOutput += chunk.toString("utf-8");
@@ -812,7 +895,7 @@ async function ensureDaemonRunning() {
812
895
  return existing;
813
896
  }
814
897
  if (process.versions.electron) {
815
- const { runDaemonChild } = await import("./daemonChild-24Y3AKII.js");
898
+ const { runDaemonChild } = await import("./daemonChild-WTZ7X6SZ.js");
816
899
  const handle = await runDaemonChild({
817
900
  installSignalHandlers: false,
818
901
  exitOnFailure: false,
@@ -921,6 +1004,7 @@ export {
921
1004
  readUpdateState,
922
1005
  writeUpdateState,
923
1006
  recordLatestVersion,
1007
+ moveDeclinedInstallToVersion,
924
1008
  isPackagedBinary,
925
1009
  resolveNodePtyRoot,
926
1010
  requireNodePty,
@@ -935,17 +1019,20 @@ export {
935
1019
  backgroundInstallKind,
936
1020
  installCommandFor,
937
1021
  createInstallProbe,
1022
+ installerBinaryPath,
938
1023
  readServiceEntryText,
939
1024
  installService,
940
1025
  uninstallService,
1026
+ currentBootId,
1027
+ startedInEarlierBoot,
941
1028
  isProcessAlive,
942
- startedBeforeBoot,
943
1029
  getDaemonInfo,
944
1030
  isDaemonRunning,
945
1031
  daemonIpcVersion,
946
1032
  isIpcCompatible,
947
1033
  ipcMismatchMessage,
948
1034
  printDaemonVersionNoticeOnce,
1035
+ startDaemonFromInstalledBinary,
949
1036
  startDaemon,
950
1037
  ensureDaemonRunning,
951
1038
  getInProcessDaemonHandle,
@@ -5,7 +5,7 @@ import {
5
5
  TunnelAlreadyRunningError,
6
6
  TunnelManager,
7
7
  TunnelRebuildInProgressError
8
- } from "./chunk-3WMTTJHI.js";
8
+ } from "./chunk-5HBGVJSW.js";
9
9
  import {
10
10
  ensureDaemonRunning,
11
11
  getDaemonInfo,
@@ -13,7 +13,7 @@ import {
13
13
  ipcMismatchMessage,
14
14
  isIpcCompatible,
15
15
  printDaemonVersionNoticeOnce
16
- } from "./chunk-3KCXR33Y.js";
16
+ } from "./chunk-OQVFQ5VG.js";
17
17
  import {
18
18
  SessionMode
19
19
  } from "./chunk-MKGD2QAI.js";
@@ -33,7 +33,7 @@ import {
33
33
  } from "./chunk-HTIWY3O5.js";
34
34
  import {
35
35
  logger
36
- } from "./chunk-LWCVB42S.js";
36
+ } from "./chunk-DGAH7UVX.js";
37
37
 
38
38
  // src/remote_management/remote_schema.ts
39
39
  import { HaProxyVersion, TunnelType } from "@pinggy/pinggy";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  ensurePinggyConfigDir,
3
3
  getDaemonConfigPath
4
- } from "./chunk-MAK5R4WQ.js";
4
+ } from "./chunk-WFHMERT3.js";
5
5
 
6
6
  // src/daemon/lifecycle/daemonConfig.ts
7
7
  import fs from "fs";
@@ -58,6 +58,17 @@ function ensurePinggyLogDir() {
58
58
  function getTunnelLogDir() {
59
59
  return path.join(getPinggyLogDir(), "tunnels");
60
60
  }
61
+ function getLibpinggyLogDir() {
62
+ return path.join(getPinggyLogDir(), "libpinggy");
63
+ }
64
+ function ensureLibpinggyLogDir() {
65
+ const dir = getLibpinggyLogDir();
66
+ fs.mkdirSync(dir, { recursive: true });
67
+ return dir;
68
+ }
69
+ function getLibpinggyLogPath() {
70
+ return path.join(getLibpinggyLogDir(), "libpinggy.log");
71
+ }
61
72
  function getTunnelLogPath(tunnelId, origin, name) {
62
73
  const dir = getTunnelLogDir();
63
74
  if (name) {
@@ -93,6 +104,8 @@ export {
93
104
  getDaemonConfigPath,
94
105
  ensurePinggyLogDir,
95
106
  getTunnelLogDir,
107
+ ensureLibpinggyLogDir,
108
+ getLibpinggyLogPath,
96
109
  getTunnelLogPath,
97
110
  getDaemonLogPath,
98
111
  getDeviceConfigPath,
@@ -22,9 +22,9 @@ import {
22
22
  validateName,
23
23
  validateNameForStorage,
24
24
  validateNameStrict
25
- } from "./chunk-2GIJXE4K.js";
26
- import "./chunk-LWCVB42S.js";
27
- import "./chunk-MAK5R4WQ.js";
25
+ } from "./chunk-3IPMFCEF.js";
26
+ import "./chunk-DGAH7UVX.js";
27
+ import "./chunk-WFHMERT3.js";
28
28
  export {
29
29
  CONFIG_VERBS,
30
30
  ConfigVerb,
@@ -6,22 +6,22 @@ import {
6
6
  trackIPCTunnelStart,
7
7
  trackTunnelStart,
8
8
  trackTunnelStop
9
- } from "./chunk-FWTQF6AB.js";
10
- import "./chunk-H527WMTF.js";
11
- import "./chunk-CZOKR73F.js";
9
+ } from "./chunk-LF6WMFWT.js";
10
+ import "./chunk-Q5RYSWFK.js";
11
+ import "./chunk-VD5ZFCZW.js";
12
12
  import "./chunk-MHQ3CVEB.js";
13
- import "./chunk-2GIJXE4K.js";
13
+ import "./chunk-3IPMFCEF.js";
14
14
  import "./chunk-XZ64ZAGO.js";
15
- import "./chunk-3WMTTJHI.js";
15
+ import "./chunk-5HBGVJSW.js";
16
16
  import "./chunk-UB26QJ4T.js";
17
- import "./chunk-PMZJ6HFH.js";
18
- import "./chunk-3KCXR33Y.js";
17
+ import "./chunk-HJECJ7LC.js";
18
+ import "./chunk-OQVFQ5VG.js";
19
19
  import {
20
20
  DaemonHost
21
21
  } from "./chunk-MKGD2QAI.js";
22
22
  import "./chunk-HTIWY3O5.js";
23
- import "./chunk-LWCVB42S.js";
24
- import "./chunk-MAK5R4WQ.js";
23
+ import "./chunk-DGAH7UVX.js";
24
+ import "./chunk-WFHMERT3.js";
25
25
  export {
26
26
  DaemonHost,
27
27
  getDaemonHost,
@@ -5,8 +5,8 @@ import {
5
5
  saveDeviceAgent,
6
6
  savedDeviceAgent,
7
7
  writeDaemonConfig
8
- } from "./chunk-CZOKR73F.js";
9
- import "./chunk-MAK5R4WQ.js";
8
+ } from "./chunk-VD5ZFCZW.js";
9
+ import "./chunk-WFHMERT3.js";
10
10
  export {
11
11
  configuredLogLevel,
12
12
  forgetDeviceAgent,