pinggy 0.6.11 → 0.7.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.
@@ -28,7 +28,7 @@ import {
28
28
  upsertConfig,
29
29
  validateName,
30
30
  validateNameStrict
31
- } from "./chunk-3IPMFCEF.js";
31
+ } from "./chunk-QUVQ7ODD.js";
32
32
  import {
33
33
  createQrCodes
34
34
  } from "./chunk-XZ64ZAGO.js";
@@ -42,6 +42,8 @@ import {
42
42
  setTunnelLoggingEnabled
43
43
  } from "./chunk-5HBGVJSW.js";
44
44
  import {
45
+ AUTOSTART_OFF_COMMAND,
46
+ AUTOSTART_ON_COMMAND,
45
47
  InstallKind,
46
48
  NPM_INSTALL_COMMAND,
47
49
  UpdateError,
@@ -62,8 +64,8 @@ import {
62
64
  getInProcessDaemonHandle,
63
65
  hasExecutableSpawnHelper,
64
66
  hasPathSegment,
67
+ installBootEntry,
65
68
  installCommandFor,
66
- installService,
67
69
  installerBinaryPath,
68
70
  ipcMismatchMessage,
69
71
  isDaemonRunning,
@@ -73,6 +75,7 @@ import {
73
75
  isProcessAlive,
74
76
  isReleaseComplete,
75
77
  isUpdateLockHeld,
78
+ machineServiceInstallContext,
76
79
  makeSpawnHelperExecutable,
77
80
  nowEpochSeconds,
78
81
  parseVersion,
@@ -80,26 +83,31 @@ import {
80
83
  printDaemonVersionNoticeOnce,
81
84
  readBinaryIpcVersion,
82
85
  readBinaryVersion,
86
+ readBootEntry,
83
87
  readLinkVersion,
84
88
  readUpdateState,
85
89
  recordLatestVersion,
86
90
  releaseUpdateLock,
91
+ removeBootEntry,
87
92
  removeQuietly,
88
93
  removeStaleUpdateFiles,
89
94
  requireNodePty,
90
95
  resolveLatestTag,
91
96
  resolveNodePtyRoot,
92
97
  runPinggyBinary,
98
+ sameProgram,
99
+ serviceInstallRefusal,
100
+ serviceProgramPath,
93
101
  startDaemon,
94
102
  startDaemonFromInstalledBinary,
95
103
  startedInEarlierBoot,
104
+ startsBeforeSignIn,
96
105
  stopDaemon,
97
- uninstallService,
98
106
  unixLayoutPaths,
99
107
  versionFromTag,
100
108
  windowsInstallPaths,
101
109
  writeUpdateState
102
- } from "./chunk-RYO5T2JT.js";
110
+ } from "./chunk-2IPBK3RG.js";
103
111
  import {
104
112
  DaemonHost,
105
113
  DeviceAgentState,
@@ -278,6 +286,7 @@ function printHelpMessage() {
278
286
  console.log(" pinggy device login --foreground # Same, with the agent in this terminal");
279
287
  console.log(" pinggy device status # Show this device and its agent");
280
288
  console.log(" pinggy device stop # Stop the background agent");
289
+ console.log(" pinggy autostart on # Bring this device online each time this computer starts");
281
290
  console.log("\nUpdates:");
282
291
  console.log(" pinggy update --check # Print the latest version");
283
292
  console.log(" pinggy update # Update to the latest version now");
@@ -287,8 +296,6 @@ function printHelpMessage() {
287
296
  console.log(" pinggy daemon start # Start the background daemon");
288
297
  console.log(" pinggy daemon stop # Stop the daemon (stops all tunnels)");
289
298
  console.log(" pinggy daemon status # Show daemon PID and uptime");
290
- console.log(" pinggy daemon service-install # Run the daemon at login as a system service");
291
- console.log(" pinggy daemon service-uninstall # Stop the daemon and remove the system service");
292
299
  }
293
300
 
294
301
  // src/utils/parseArgs.ts
@@ -4249,7 +4256,7 @@ async function startBackgroundTunnels(configs, values, positionals) {
4249
4256
  client.close();
4250
4257
  }
4251
4258
  async function startAutoStartTunnels() {
4252
- const { getAutoStartConfigs: getAutoStartConfigs2 } = await import("./configStore-6LCHFPQX.js");
4259
+ const { getAutoStartConfigs: getAutoStartConfigs2 } = await import("./configStore-VDPOPFLJ.js");
4253
4260
  const configs = getAutoStartConfigs2();
4254
4261
  if (configs.length === 0) {
4255
4262
  printer_default.warn("No configs marked for auto-start. Use: pinggy config auto <name>");
@@ -4380,8 +4387,6 @@ function printDaemonHelp() {
4380
4387
  console.log(" start Start the daemon process");
4381
4388
  console.log(" stop Stop the daemon (stops all tunnels)");
4382
4389
  console.log(" status Show daemon PID and uptime");
4383
- console.log(" service-install Run the daemon at login as a system service");
4384
- console.log(" service-uninstall Stop the daemon and remove the system service");
4385
4390
  console.log("Tunnel operations:");
4386
4391
  console.log(" pinggy ps List running tunnels");
4387
4392
  console.log(" pinggy stop <name|id> Stop a specific tunnel");
@@ -4431,6 +4436,11 @@ function printDeviceHelp() {
4431
4436
  console.log(" The device stays in the dashboard\n");
4432
4437
  console.log("By default the agent runs in the daemon, and stays connected after this terminal closes.");
4433
4438
  console.log("Each time the daemon starts, it starts the agent again, until remove.\n");
4439
+ console.log("Start on boot:");
4440
+ console.log(" pinggy autostart on Bring this device online each time this computer starts");
4441
+ console.log(" pinggy autostart off Stop that. The device stays online until the next restart");
4442
+ console.log(" pinggy autostart status Show whether it is on");
4443
+ console.log("On macOS and Windows it starts when you sign in. On Linux it starts at boot.\n");
4434
4444
  console.log("Options:");
4435
4445
  console.log(" --foreground login, connect and start: run the agent in this terminal until Ctrl+C");
4436
4446
  console.log(" -b login, connect and start: run the agent in the background. The default");
@@ -4444,6 +4454,16 @@ function printDeviceHelp() {
4444
4454
  console.log(" DEVICE_AGENT_TOKEN connect and start: the device token, when --token is not given.");
4445
4455
  console.log(" With no --manage, it dials dashboard.pinggy.io. Removed once read\n");
4446
4456
  }
4457
+ function printAutostartHelp() {
4458
+ console.log("\nUsage: pinggy autostart [on | off | status]\n");
4459
+ console.log("Bring this device online each time this computer starts.");
4460
+ console.log("On macOS and Windows it starts when you sign in. On Linux it starts at boot.\n");
4461
+ console.log("Commands:");
4462
+ console.log(" on Turn it on. Asks first when the device agent does not run in the");
4463
+ console.log(" background");
4464
+ console.log(" off Turn it off. The device stays online until the next restart");
4465
+ console.log(" status Show whether it is on. The default\n");
4466
+ }
4447
4467
  function printUpdateHelp() {
4448
4468
  console.log("\nUsage: pinggy update [--check | --rollback]\n");
4449
4469
  console.log("Commands:");
@@ -10176,6 +10196,14 @@ function printRunning(status, daemon, options, dependencies) {
10176
10196
  }
10177
10197
 
10178
10198
  // src/cli/subcommand/handlers/daemonCommandsHandler.ts
10199
+ var RENAMED_DAEMON_VERBS = /* @__PURE__ */ new Map([
10200
+ ["service-install", AUTOSTART_ON_COMMAND],
10201
+ ["service-uninstall", AUTOSTART_OFF_COMMAND]
10202
+ ]);
10203
+ function renamedDaemonVerbMessage(verb) {
10204
+ const replacement = RENAMED_DAEMON_VERBS.get(verb);
10205
+ return replacement ? `"pinggy daemon ${verb}" is now "${replacement}".` : null;
10206
+ }
10179
10207
  async function handleDaemon(args) {
10180
10208
  if (args.length === 0) {
10181
10209
  printDaemonHelp();
@@ -10192,16 +10220,21 @@ async function handleDaemon(args) {
10192
10220
  case "status":
10193
10221
  await handleDaemonStatus();
10194
10222
  return;
10195
- case "service-install":
10196
- installService();
10197
- return;
10198
- case "service-uninstall":
10199
- await uninstallService();
10223
+ case "help":
10224
+ case "--help":
10225
+ case "-h":
10226
+ printDaemonHelp();
10200
10227
  return;
10201
- default:
10228
+ default: {
10229
+ const renamed = renamedDaemonVerbMessage(verb);
10230
+ if (renamed) {
10231
+ printer_default.error(renamed);
10232
+ process.exit(1);
10233
+ }
10202
10234
  printer_default.error(`Unknown daemon command: "${verb}"`);
10203
10235
  printDaemonHelp();
10204
10236
  return;
10237
+ }
10205
10238
  }
10206
10239
  }
10207
10240
  async function handleDaemonStart() {
@@ -10769,16 +10802,17 @@ async function handleRestart(args) {
10769
10802
  }
10770
10803
 
10771
10804
  // src/cli/subcommand/handlers/deviceCommand.ts
10772
- import pico11 from "picocolors";
10805
+ import pico12 from "picocolors";
10773
10806
 
10774
10807
  // src/devices/removeDevice.ts
10775
10808
  import pico10 from "picocolors";
10776
10809
  var YES_ANSWER2 = /^y(es)?$/i;
10777
10810
  var NO_TERMINAL_MESSAGE2 = "pinggy device remove asks before it removes the device. Run it in a terminal, or add -f to remove without asking.";
10778
- function machineDeviceRemoveDependencies(background) {
10811
+ function machineDeviceRemoveDependencies(background, bootEntry) {
10779
10812
  return {
10780
10813
  background,
10781
10814
  foreground: machineForegroundStopDependencies(),
10815
+ bootEntry,
10782
10816
  clearIdentity: clearDeviceIdentity,
10783
10817
  isInteractive: isInteractiveTerminal,
10784
10818
  prompter: terminalPrompter,
@@ -10792,11 +10826,12 @@ async function readActivity(dependencies) {
10792
10826
  return {
10793
10827
  identity: dependencies.background.readIdentity(),
10794
10828
  background: reading && isAgentRunning(reading.status) ? reading : null,
10795
- foreground: dependencies.background.readForegroundAgent()
10829
+ foreground: dependencies.background.readForegroundAgent(),
10830
+ autostart: dependencies.bootEntry.read().present
10796
10831
  };
10797
10832
  }
10798
10833
  function describeActivity(activity) {
10799
- const { identity, background, foreground } = activity;
10834
+ const { identity, background, foreground, autostart } = activity;
10800
10835
  const lines = [];
10801
10836
  if (identity) {
10802
10837
  const deviceAgentId = identity.device_agent_id ?? "(id not yet assigned)";
@@ -10813,6 +10848,9 @@ function describeActivity(activity) {
10813
10848
  } else {
10814
10849
  lines.push("The device is not connected now.");
10815
10850
  }
10851
+ if (autostart) {
10852
+ lines.push("Removing it also turns off autostart.");
10853
+ }
10816
10854
  return lines;
10817
10855
  }
10818
10856
  async function confirmed(options, dependencies) {
@@ -10848,6 +10886,175 @@ async function runDeviceRemove(options, dependencies) {
10848
10886
  dependencies.printSuccess("Local device credential removed.");
10849
10887
  dependencies.print(pico10.gray("The device still exists in the dashboard. Delete it there to revoke it."));
10850
10888
  }
10889
+ if (activity.autostart) {
10890
+ try {
10891
+ dependencies.bootEntry.remove();
10892
+ } catch (err) {
10893
+ dependencies.printError(errorMessage(err));
10894
+ return EXIT_FAILED;
10895
+ }
10896
+ dependencies.printSuccess("Autostart is off.");
10897
+ }
10898
+ return EXIT_OK;
10899
+ }
10900
+
10901
+ // src/devices/autostart.ts
10902
+ import os13 from "os";
10903
+ import pico11 from "picocolors";
10904
+ var AutostartVerb = {
10905
+ On: "on",
10906
+ Off: "off",
10907
+ Status: "status"
10908
+ };
10909
+ var NOT_ENROLLED_MESSAGE = "This machine is not enrolled. Sign it in first: pinggy device login";
10910
+ var NO_SAVED_AGENT_MESSAGE = "The device agent does not run in the background, so a restart would leave this device offline.";
10911
+ var START_AGENT_QUESTION = "Start it now, and each time this computer starts? [Y/n] ";
10912
+ var NO_ANSWER3 = /^n/i;
10913
+ function machineBootEntryDependencies() {
10914
+ const context = machineServiceInstallContext();
10915
+ return {
10916
+ platform: context.platform,
10917
+ read: () => readBootEntry(context.platform),
10918
+ program: () => serviceProgramPath(context),
10919
+ refusal: () => serviceInstallRefusal(context),
10920
+ startsBeforeSignIn: () => startsBeforeSignIn(context.platform),
10921
+ username: () => os13.userInfo().username,
10922
+ install: (program) => installBootEntry(program, context.platform),
10923
+ remove: () => removeBootEntry(context.platform)
10924
+ };
10925
+ }
10926
+ function machineAutostartDependencies(background, bootEntry, startAgent) {
10927
+ return {
10928
+ background,
10929
+ bootEntry,
10930
+ startAgent,
10931
+ isInteractive: isInteractiveTerminal,
10932
+ prompter: terminalPrompter,
10933
+ print: (message) => printer_default.print(message),
10934
+ printSuccess: (message) => printer_default.success(message),
10935
+ printError: (message) => printer_default.error(message)
10936
+ };
10937
+ }
10938
+ function describeBootStart(bootEntry) {
10939
+ return bootEntry.startsBeforeSignIn() ? "each time this computer starts" : "each time you sign in to this computer";
10940
+ }
10941
+ function isAutostartOn(background, bootEntry) {
10942
+ return background.hasSavedAgent() && bootEntry.read().present;
10943
+ }
10944
+ function describeAutostartRow(on, bootEntry) {
10945
+ if (on) {
10946
+ return `on, comes online ${describeBootStart(bootEntry)}`;
10947
+ }
10948
+ return `${pico11.gray("off")}. To turn it on, run: ${AUTOSTART_ON_COMMAND}`;
10949
+ }
10950
+ function printLingerHint(dependencies) {
10951
+ const { bootEntry } = dependencies;
10952
+ if (bootEntry.platform === "linux" && !bootEntry.startsBeforeSignIn()) {
10953
+ dependencies.print(`To bring it online before anyone signs in, run: loginctl enable-linger ${bootEntry.username()}`);
10954
+ }
10955
+ }
10956
+ async function startAgentAfterAsking(dependencies) {
10957
+ const foreground = dependencies.background.readForegroundAgent();
10958
+ if (foreground) {
10959
+ dependencies.printError(`${foregroundAgentRefusal(foreground)} Then run: ${AUTOSTART_ON_COMMAND}`);
10960
+ return EXIT_FAILED;
10961
+ }
10962
+ if (!dependencies.isInteractive()) {
10963
+ dependencies.printError([
10964
+ NO_SAVED_AGENT_MESSAGE,
10965
+ "Start it first, then run this command again:",
10966
+ " pinggy device start",
10967
+ ` ${AUTOSTART_ON_COMMAND}`
10968
+ ].join("\n"));
10969
+ return EXIT_FAILED;
10970
+ }
10971
+ dependencies.print(NO_SAVED_AGENT_MESSAGE);
10972
+ let answer;
10973
+ try {
10974
+ answer = await dependencies.prompter.ask(START_AGENT_QUESTION);
10975
+ } catch (err) {
10976
+ if (!isCtrlCAtPrompt(err)) throw err;
10977
+ dependencies.print(pico11.yellow("Cancelled. Nothing changed."));
10978
+ return EXIT_FAILED;
10979
+ }
10980
+ if (NO_ANSWER3.test(answer.trim())) {
10981
+ dependencies.print("Nothing changed.");
10982
+ return EXIT_OK;
10983
+ }
10984
+ const exitCode = await dependencies.startAgent();
10985
+ return exitCode === EXIT_OK ? null : exitCode;
10986
+ }
10987
+ async function runAutostartOn(dependencies) {
10988
+ const { background, bootEntry } = dependencies;
10989
+ if (!background.readIdentity()?.token) {
10990
+ dependencies.printError(NOT_ENROLLED_MESSAGE);
10991
+ return EXIT_FAILED;
10992
+ }
10993
+ const refusal = bootEntry.refusal();
10994
+ if (refusal) {
10995
+ dependencies.printError(refusal);
10996
+ return EXIT_FAILED;
10997
+ }
10998
+ let agentStarted = false;
10999
+ if (!background.hasSavedAgent()) {
11000
+ const stopped = await startAgentAfterAsking(dependencies);
11001
+ if (stopped !== null) {
11002
+ return stopped;
11003
+ }
11004
+ agentStarted = true;
11005
+ }
11006
+ const program = bootEntry.program();
11007
+ const reading = bootEntry.read();
11008
+ if (reading.present && reading.program !== null && sameProgram(bootEntry.platform, reading.program, program)) {
11009
+ const state = agentStarted ? "on" : "already on";
11010
+ dependencies.print(`Autostart is ${state}. This device comes online ${describeBootStart(bootEntry)}.`);
11011
+ printLingerHint(dependencies);
11012
+ return EXIT_OK;
11013
+ }
11014
+ try {
11015
+ bootEntry.install(program);
11016
+ } catch (err) {
11017
+ dependencies.printError(errorMessage(err));
11018
+ return EXIT_FAILED;
11019
+ }
11020
+ dependencies.printSuccess(`Autostart is on. This device comes online ${describeBootStart(bootEntry)}.`);
11021
+ printLingerHint(dependencies);
11022
+ return EXIT_OK;
11023
+ }
11024
+ async function runAutostartOff(dependencies) {
11025
+ if (!dependencies.bootEntry.read().present) {
11026
+ dependencies.print("Autostart is already off.");
11027
+ return EXIT_OK;
11028
+ }
11029
+ try {
11030
+ dependencies.bootEntry.remove();
11031
+ } catch (err) {
11032
+ dependencies.printError(errorMessage(err));
11033
+ return EXIT_FAILED;
11034
+ }
11035
+ dependencies.printSuccess("Autostart is off.");
11036
+ const reading = await readBackgroundAgent(dependencies.background);
11037
+ if (reading && isAgentRunning(reading.status)) {
11038
+ dependencies.print("This device stays online until this computer restarts. To take it offline now, run: pinggy device stop");
11039
+ }
11040
+ return EXIT_OK;
11041
+ }
11042
+ function runAutostartStatus(dependencies) {
11043
+ const { background, bootEntry } = dependencies;
11044
+ if (!background.readIdentity()?.token) {
11045
+ dependencies.print(pico11.yellow("This machine is not enrolled. Run: pinggy device login"));
11046
+ if (bootEntry.read().present) {
11047
+ dependencies.print(`pinggy still starts ${describeBootStart(bootEntry)}. To stop that, run: ${AUTOSTART_OFF_COMMAND}`);
11048
+ }
11049
+ return EXIT_OK;
11050
+ }
11051
+ if (isAutostartOn(background, bootEntry)) {
11052
+ dependencies.print(`Autostart is on. This device comes online ${describeBootStart(bootEntry)}.`);
11053
+ printLingerHint(dependencies);
11054
+ return EXIT_OK;
11055
+ }
11056
+ dependencies.print("Autostart is off. After a restart, this device stays offline.");
11057
+ dependencies.print(`To turn it on, run: ${AUTOSTART_ON_COMMAND}`);
10851
11058
  return EXIT_OK;
10852
11059
  }
10853
11060
 
@@ -10878,7 +11085,7 @@ function resolveConnectTarget(flagToken, environmentToken, manage, stored) {
10878
11085
  }
10879
11086
  return null;
10880
11087
  }
10881
- async function handleDevice(args, background = machineBackgroundAgentDependencies(), fileAccess = machineFileAccessDependencies()) {
11088
+ async function handleDevice(args, background = machineBackgroundAgentDependencies(), fileAccess = machineFileAccessDependencies(), bootEntry = machineBootEntryDependencies()) {
10882
11089
  const environmentToken = takeEnvironmentToken();
10883
11090
  if (args.length === 0) {
10884
11091
  printDeviceHelp();
@@ -10920,12 +11127,12 @@ async function handleDevice(args, background = machineBackgroundAgentDependencie
10920
11127
  exitUnlessOk(await stopAgentInBackground(background));
10921
11128
  return;
10922
11129
  case DeviceVerb.Status:
10923
- await handleDeviceStatus(background);
11130
+ await handleDeviceStatus(background, bootEntry);
10924
11131
  return;
10925
11132
  case DeviceVerb.Remove:
10926
11133
  exitUnlessOk(await runDeviceRemove(
10927
11134
  { skipConfirmation: Boolean(values.force) },
10928
- machineDeviceRemoveDependencies(background)
11135
+ machineDeviceRemoveDependencies(background, bootEntry)
10929
11136
  ));
10930
11137
  return;
10931
11138
  default:
@@ -10933,10 +11140,43 @@ async function handleDevice(args, background = machineBackgroundAgentDependencie
10933
11140
  printDeviceHelp();
10934
11141
  return;
10935
11142
  }
10936
- printer_default.error(`Unknown command "${verb}". Valid commands: login, connect, start, stop, status, remove.`);
11143
+ printer_default.error(`Unknown command "${verb}". Valid commands: ${Object.values(DeviceVerb).join(", ")}.`);
10937
11144
  process.exit(1);
10938
11145
  }
10939
11146
  }
11147
+ async function handleAutostart(args, background = machineBackgroundAgentDependencies(), fileAccess = machineFileAccessDependencies(), bootEntry = machineBootEntryDependencies()) {
11148
+ takeEnvironmentToken();
11149
+ const { values, positionals } = parseCliArgs(cliOptions, args);
11150
+ configureLogger(values);
11151
+ if (values.help || positionals[0] === "help") {
11152
+ printAutostartHelp();
11153
+ return;
11154
+ }
11155
+ const startAgent = () => handleDeviceConnect({
11156
+ flagToken: void 0,
11157
+ environmentToken: void 0,
11158
+ manage: void 0,
11159
+ inBackground: true,
11160
+ fileManager: void 0
11161
+ }, background, fileAccess);
11162
+ exitUnlessOk(await runAutostartVerb(
11163
+ positionals[0],
11164
+ machineAutostartDependencies(background, bootEntry, startAgent)
11165
+ ));
11166
+ }
11167
+ async function runAutostartVerb(word, dependencies) {
11168
+ switch (word ?? AutostartVerb.Status) {
11169
+ case AutostartVerb.On:
11170
+ return runAutostartOn(dependencies);
11171
+ case AutostartVerb.Off:
11172
+ return runAutostartOff(dependencies);
11173
+ case AutostartVerb.Status:
11174
+ return runAutostartStatus(dependencies);
11175
+ default:
11176
+ dependencies.printError(`Unknown autostart command "${word}". Valid commands: ${Object.values(AutostartVerb).join(", ")}.`);
11177
+ return EXIT_FAILED;
11178
+ }
11179
+ }
10940
11180
  function exitUnlessOk(exitCode) {
10941
11181
  if (exitCode !== EXIT_OK) {
10942
11182
  process.exit(exitCode);
@@ -10992,7 +11232,7 @@ async function handleDeviceConnect(request2, background, fileAccess) {
10992
11232
  fileManager = await settleFileAccess(request2.fileManager, target.token, stored, fileAccess);
10993
11233
  } catch (err) {
10994
11234
  if (!isCtrlCAtPrompt(err)) throw err;
10995
- fileAccess.print(pico11.yellow("Cancelled. Nothing changed."));
11235
+ fileAccess.print(pico12.yellow("Cancelled. Nothing changed."));
10996
11236
  return EXIT_FAILED;
10997
11237
  }
10998
11238
  if (request2.inBackground) {
@@ -11001,21 +11241,21 @@ async function handleDeviceConnect(request2, background, fileAccess) {
11001
11241
  await runDeviceAgent(target.token, target.manage, { fileManager });
11002
11242
  return EXIT_OK;
11003
11243
  }
11004
- async function handleDeviceStatus(background) {
11244
+ async function handleDeviceStatus(background, bootEntry) {
11005
11245
  const identity = background.readIdentity();
11006
11246
  if (!identity) {
11007
- printer_default.print(pico11.yellow("This machine is not enrolled. Run: pinggy device login"));
11247
+ printer_default.print(pico12.yellow("This machine is not enrolled. Run: pinggy device login"));
11008
11248
  return;
11009
11249
  }
11010
11250
  const reading = await readBackgroundAgent(background);
11011
11251
  const foreground = background.readForegroundAgent();
11012
11252
  const daemonFound = background.findDaemon() !== null;
11013
11253
  printer_default.print(` State ${describeDeviceState(reading, daemonFound, foreground)}`);
11014
- printer_default.print(` Device id ${identity.device_agent_id ?? pico11.gray("not yet assigned")}`);
11254
+ printer_default.print(` Device id ${identity.device_agent_id ?? pico12.gray("not yet assigned")}`);
11015
11255
  printer_default.print(` Server ${identity.server}`);
11016
11256
  printer_default.print(` Token ${maskToken(identity.token)}`);
11017
- printer_default.print(` Enrolled ${identity.enrolled_at ?? pico11.gray("never")}`);
11018
- printer_default.print(` Autostart ${background.hasSavedAgent() ? "on, starts with the daemon" : pico11.gray("off")}`);
11257
+ printer_default.print(` Enrolled ${identity.enrolled_at ?? pico12.gray("never")}`);
11258
+ printer_default.print(` Autostart ${describeAutostartRow(isAutostartOn(background, bootEntry), bootEntry)}`);
11019
11259
  printer_default.print(` Files ${describeFileAccess(identity)}`);
11020
11260
  if (foreground) {
11021
11261
  printer_default.print(` Foreground running in another terminal, PID ${foreground.pid}`);
@@ -11239,6 +11479,9 @@ async function handleSubcommand(rawArgs) {
11239
11479
  case Subcommand.Update:
11240
11480
  await handleUpdate(rest);
11241
11481
  return;
11482
+ case Subcommand.Autostart:
11483
+ await handleAutostart(rest);
11484
+ return;
11242
11485
  }
11243
11486
  }
11244
11487
  function handleConfig(args) {
@@ -12163,7 +12406,7 @@ var SessionTracker = class {
12163
12406
  };
12164
12407
 
12165
12408
  // src/daemon/deviceAgentHost.ts
12166
- var NOT_ENROLLED_MESSAGE = "This machine is not enrolled. Sign it in first: pinggy device login";
12409
+ var NOT_ENROLLED_MESSAGE2 = "This machine is not enrolled. Sign it in first: pinggy device login";
12167
12410
  function stoppedStatus() {
12168
12411
  return {
12169
12412
  state: DeviceAgentState.Stopped,
@@ -12203,7 +12446,7 @@ var DeviceAgentHost = class {
12203
12446
  }
12204
12447
  const identity = this.dependencies.readIdentity();
12205
12448
  if (!identity?.token) {
12206
- return newErrorResponse(ErrorCode.DeviceNotEnrolled, NOT_ENROLLED_MESSAGE);
12449
+ return newErrorResponse(ErrorCode.DeviceNotEnrolled, NOT_ENROLLED_MESSAGE2);
12207
12450
  }
12208
12451
  const current = this.current;
12209
12452
  if (current && current.token === identity.token && current.server === identity.server) {
@@ -12737,7 +12980,7 @@ async function main() {
12737
12980
  const { values, positionals, hasAnyArgs } = parseCliArgs(cliOptions);
12738
12981
  configureLogger(values);
12739
12982
  if (values["_daemon-child"]) {
12740
- const { runDaemonChild: runDaemonChild2 } = await import("./daemonChild-GGG34AOT.js");
12983
+ const { runDaemonChild: runDaemonChild2 } = await import("./daemonChild-5HZFQLQR.js");
12741
12984
  await runDaemonChild2();
12742
12985
  return;
12743
12986
  }
@@ -12746,7 +12989,7 @@ async function main() {
12746
12989
  return;
12747
12990
  }
12748
12991
  if (values["_update-child"]) {
12749
- const { runUpdateChild } = await import("./updateChild-RNCLN24C.js");
12992
+ const { runUpdateChild } = await import("./updateChild-CEVYCBED.js");
12750
12993
  await runUpdateChild();
12751
12994
  process.exit(0);
12752
12995
  }
@@ -22,7 +22,7 @@ import {
22
22
  validateName,
23
23
  validateNameForStorage,
24
24
  validateNameStrict
25
- } from "./chunk-3IPMFCEF.js";
25
+ } from "./chunk-QUVQ7ODD.js";
26
26
  import "./chunk-DGAH7UVX.js";
27
27
  import "./chunk-WFHMERT3.js";
28
28
  export {
@@ -8,14 +8,14 @@ import {
8
8
  trackIPCTunnelStart,
9
9
  trackTunnelStart,
10
10
  trackTunnelStop
11
- } from "./chunk-W47AYOH2.js";
11
+ } from "./chunk-ZSED6OIR.js";
12
12
  import "./chunk-VD5ZFCZW.js";
13
13
  import "./chunk-P54K7NPF.js";
14
- import "./chunk-3IPMFCEF.js";
14
+ import "./chunk-QUVQ7ODD.js";
15
15
  import "./chunk-XZ64ZAGO.js";
16
16
  import "./chunk-5HBGVJSW.js";
17
17
  import "./chunk-UB26QJ4T.js";
18
- import "./chunk-RYO5T2JT.js";
18
+ import "./chunk-2IPBK3RG.js";
19
19
  import {
20
20
  DaemonHost
21
21
  } from "./chunk-MKGD2QAI.js";