pinggy 0.6.5 → 0.6.6

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 (30) hide show
  1. package/ARCHITECTURE.md +90 -36
  2. package/CLAUDE.md +18 -8
  3. package/dist/{TunnelManager-DXNXIH5W.js → TunnelManager-JRVEADS4.js} +4 -3
  4. package/dist/{TunnelTui-K7KESRTQ.js → TunnelTui-6H4NPUNF.js} +4 -3
  5. package/dist/{chunk-QZJGTQZC.js → chunk-2GIJXE4K.js} +3 -2
  6. package/dist/{chunk-EMCDDH3B.js → chunk-3WMTTJHI.js} +11 -299
  7. package/dist/chunk-4XXAHYCJ.js +927 -0
  8. package/dist/{chunk-X6TZN5CT.js → chunk-CZOKR73F.js} +1 -1
  9. package/dist/chunk-FQ22KFVV.js +882 -0
  10. package/dist/{chunk-K5QHR5KU.js → chunk-HAFTH5MX.js} +498 -551
  11. package/dist/chunk-HTIWY3O5.js +293 -0
  12. package/dist/{chunk-IRKMUV37.js → chunk-LWCVB42S.js} +2 -2
  13. package/dist/{chunk-N5WE4DYD.js → chunk-MAK5R4WQ.js} +12 -0
  14. package/dist/{chunk-7EQKHVQX.js → chunk-MHQ3CVEB.js} +4 -51
  15. package/dist/chunk-MKGD2QAI.js +51 -0
  16. package/dist/{chunk-3PTLHLFL.js → chunk-Q5NCTGNS.js} +33 -240
  17. package/dist/{configStore-DXC6WMYO.js → configStore-JJUWT2YO.js} +3 -3
  18. package/dist/{daemonChild-HZ27YJKQ.js → daemonChild-Q6WGYKYX.js} +14 -10
  19. package/dist/{daemonConfig-MCAKZHY2.js → daemonConfig-VWK4TXVS.js} +2 -2
  20. package/dist/index.cjs +3555 -1791
  21. package/dist/index.d.cts +142 -129
  22. package/dist/index.d.ts +142 -129
  23. package/dist/index.js +18 -13
  24. package/dist/{ipcClient-XGF2KCQO.js → ipcClient-IZ5R6TPN.js} +2 -1
  25. package/dist/{main-TDQB5ZB4.js → main-BI7ACRHS.js} +19 -14
  26. package/dist/updateChild-Z3SIRYO5.js +237 -0
  27. package/dist/workers/file_serve_worker.js +1 -1
  28. package/package.json +2 -1
  29. package/scripts/install/install.ps1 +3 -1
  30. package/scripts/install/install.sh +34 -6
package/dist/index.d.cts CHANGED
@@ -1032,6 +1032,136 @@ declare class IPCClient {
1032
1032
  private request;
1033
1033
  }
1034
1034
 
1035
+ interface SavedTunnelConfig {
1036
+ name: string;
1037
+ configId: string;
1038
+ autoStart: boolean;
1039
+ createdAt: string;
1040
+ updatedAt: string;
1041
+ tunnelConfig: TunnelConfigurationV1;
1042
+ /**
1043
+ * App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
1044
+ * and daemon never read this;
1045
+ */
1046
+ uiMetadata?: Record<string, unknown>;
1047
+ }
1048
+ /**
1049
+ * Minimal logger interface for the storage module. Defaults to the cli-js
1050
+ * winston logger (silent unless the CLI configures it). Non-CLI consumers
1051
+ * (e.g. the Electron app) override it via {@link configureStorageLogger} to
1052
+ * route storage logs into their own logging pipeline
1053
+ */
1054
+ interface StorageLogger {
1055
+ info: (message: string, ...meta: unknown[]) => void;
1056
+ warn: (message: string, ...meta: unknown[]) => void;
1057
+ error: (message: string, ...meta: unknown[]) => void;
1058
+ }
1059
+ declare function configureStorageLogger(l: StorageLogger): void;
1060
+ /**
1061
+ * Sanitizes a tunnel name to be filesystem-safe.
1062
+ * Allows alphanumeric, hyphens, underscores only.
1063
+ */
1064
+ declare function sanitizeName(name: string): string;
1065
+ /**
1066
+ * Strict name validation used by the CLI's own save path: alphanumeric +
1067
+ * `_`/`-`, ≤128 chars, no reserved subcommand names.
1068
+ */
1069
+ declare function validateNameStrict(name: string): Error | null;
1070
+ /**
1071
+ * Relaxed name validation used by app-driven writes (`{ strict: false }`). The
1072
+ * app allows spaces/unicode in display names, so this only rejects what would
1073
+ * break the filesystem layout or collide with a CLI subcommand: path
1074
+ * separators, NUL/control characters, empty/whitespace-only names, and reserved
1075
+ * subcommand names. The JSON `name` keeps the original; the filename is always
1076
+ * sanitized via {@link sanitizeName}.
1077
+ */
1078
+ declare function validateNameForStorage(name: string): Error | null;
1079
+ /**
1080
+ * Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
1081
+ * callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
1082
+ */
1083
+ declare const validateName: typeof validateNameStrict;
1084
+ /**
1085
+ * List all saved tunnel configs from the config directory.
1086
+ */
1087
+ declare function listSavedConfigs(): SavedTunnelConfig[];
1088
+ /**
1089
+ * Find a config by its exact display name (the JSON `name`). Exact on purpose:
1090
+ * `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
1091
+ * it builds filenames, never decides identity. Narrows by sanitized prefix then
1092
+ * confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
1093
+ */
1094
+ declare function findConfigByName(name: string): SavedTunnelConfig | null;
1095
+ /**
1096
+ * Find a config by name or configId (supports partial configId match).
1097
+ */
1098
+ declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
1099
+ /**
1100
+ * Save a tunnel config to the config store.
1101
+ * Rejects duplicate names.
1102
+ *
1103
+ * @param options.strict When `true` (default) names are validated with
1104
+ * {@link validateNameStrict}; when `false` (app-driven writes) with the
1105
+ * relaxed {@link validateNameForStorage}.
1106
+ */
1107
+ declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
1108
+ strict?: boolean;
1109
+ }): SavedTunnelConfig;
1110
+ /**
1111
+ * Insert or update a full saved record, keyed by `configId` (the stable
1112
+ * identity). If a record with the same `configId` exists under a different
1113
+ * filename — because its `name` changed — the old file is deleted before the
1114
+ * new one is written, so there is never a stale duplicate on disk. Only
1115
+ * validates the name when creating a brand-new record;
1116
+ */
1117
+ declare function upsertConfig(saved: SavedTunnelConfig, options?: {
1118
+ strict?: boolean;
1119
+ }): SavedTunnelConfig;
1120
+ /**
1121
+ * Replace a *bounded* set of configs in one pass. Every config in `configs` is
1122
+ * upserted;
1123
+ */
1124
+ declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
1125
+ strict?: boolean;
1126
+ }): {
1127
+ written: string[];
1128
+ deleted: string[];
1129
+ };
1130
+ /**
1131
+ * Load a saved tunnel config by name.
1132
+ */
1133
+ declare function loadConfigByName(name: string): SavedTunnelConfig | null;
1134
+ /**
1135
+ * Delete a saved tunnel config by name or configId.
1136
+ * Returns the deleted config's name if found, null otherwise.
1137
+ */
1138
+ declare function deleteConfig(nameOrId: string): string | null;
1139
+ /**
1140
+ * Update the autoStart flag on a saved config.
1141
+ * Returns the updated config, or null if not found.
1142
+ */
1143
+ declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
1144
+ /**
1145
+ * Update the tunnel configuration of a saved config.
1146
+ * Returns the updated config, or null if not found.
1147
+ */
1148
+ declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
1149
+ /**
1150
+ * Get all configs marked for auto-start.
1151
+ */
1152
+ declare function getAutoStartConfigs(): SavedTunnelConfig[];
1153
+
1154
+ interface DaemonInfo {
1155
+ pid: number;
1156
+ port: number;
1157
+ startedAt: string;
1158
+ host?: DaemonHost;
1159
+ /** IPC protocol version the daemon speaks. Absent in daemon.json written by older builds. */
1160
+ ipcVersion?: number;
1161
+ /** The version this daemon started with. It never follows the installed binary. Absent in older builds. */
1162
+ cliVersion?: string;
1163
+ }
1164
+
1035
1165
  type StatsCallback = (tunnelId: string, stats: TunnelUsageType) => void;
1036
1166
  type DisconnectCallback = (tunnelId: string, error: string, messages: string[]) => void;
1037
1167
  type ReconnectingCallback = (tunnelId: string, retryCnt: number) => void;
@@ -1155,6 +1285,8 @@ declare class DaemonHealth {
1155
1285
 
1156
1286
  interface TunnelClientOptions {
1157
1287
  origin?: ClientOrigin;
1288
+ /** Replaces the "daemon runs an older version" line. */
1289
+ printVersionNotice?: (info: DaemonInfo) => void;
1158
1290
  }
1159
1291
  declare class TunnelClient {
1160
1292
  private ipc;
@@ -1165,8 +1297,17 @@ declare class TunnelClient {
1165
1297
  private shimDisconnectListeners;
1166
1298
  private shimSubscribedTunnels;
1167
1299
  private shimListenerSeq;
1300
+ private boundDaemon;
1301
+ private readonly printVersionNotice;
1168
1302
  constructor(options?: TunnelClientOptions);
1169
- ensureDaemon(): Promise<void>;
1303
+ /**
1304
+ * @param options.holdVersionNotice leaves the "daemon runs an older version" line for `printHeldVersionNotice()`.
1305
+ * A caller with a spinner running uses this, so the line does not land on the spinner.
1306
+ */
1307
+ ensureDaemon(options?: {
1308
+ holdVersionNotice?: boolean;
1309
+ }): Promise<void>;
1310
+ printHeldVersionNotice(): void;
1170
1311
  /**
1171
1312
  * Connects to the daemon that runs now, and never starts one. For commands that only read state.
1172
1313
  * Throws when that daemon speaks another IPC version, as ensureDaemon() does.
@@ -1238,134 +1379,6 @@ declare class TunnelClient {
1238
1379
  private assertClient;
1239
1380
  }
1240
1381
 
1241
- interface SavedTunnelConfig {
1242
- name: string;
1243
- configId: string;
1244
- autoStart: boolean;
1245
- createdAt: string;
1246
- updatedAt: string;
1247
- tunnelConfig: TunnelConfigurationV1;
1248
- /**
1249
- * App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
1250
- * and daemon never read this;
1251
- */
1252
- uiMetadata?: Record<string, unknown>;
1253
- }
1254
- /**
1255
- * Minimal logger interface for the storage module. Defaults to the cli-js
1256
- * winston logger (silent unless the CLI configures it). Non-CLI consumers
1257
- * (e.g. the Electron app) override it via {@link configureStorageLogger} to
1258
- * route storage logs into their own logging pipeline
1259
- */
1260
- interface StorageLogger {
1261
- info: (message: string, ...meta: unknown[]) => void;
1262
- warn: (message: string, ...meta: unknown[]) => void;
1263
- error: (message: string, ...meta: unknown[]) => void;
1264
- }
1265
- declare function configureStorageLogger(l: StorageLogger): void;
1266
- /**
1267
- * Sanitizes a tunnel name to be filesystem-safe.
1268
- * Allows alphanumeric, hyphens, underscores only.
1269
- */
1270
- declare function sanitizeName(name: string): string;
1271
- /**
1272
- * Strict name validation used by the CLI's own save path: alphanumeric +
1273
- * `_`/`-`, ≤128 chars, no reserved subcommand names.
1274
- */
1275
- declare function validateNameStrict(name: string): Error | null;
1276
- /**
1277
- * Relaxed name validation used by app-driven writes (`{ strict: false }`). The
1278
- * app allows spaces/unicode in display names, so this only rejects what would
1279
- * break the filesystem layout or collide with a CLI subcommand: path
1280
- * separators, NUL/control characters, empty/whitespace-only names, and reserved
1281
- * subcommand names. The JSON `name` keeps the original; the filename is always
1282
- * sanitized via {@link sanitizeName}.
1283
- */
1284
- declare function validateNameForStorage(name: string): Error | null;
1285
- /**
1286
- * Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
1287
- * callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
1288
- */
1289
- declare const validateName: typeof validateNameStrict;
1290
- /**
1291
- * List all saved tunnel configs from the config directory.
1292
- */
1293
- declare function listSavedConfigs(): SavedTunnelConfig[];
1294
- /**
1295
- * Find a config by its exact display name (the JSON `name`). Exact on purpose:
1296
- * `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
1297
- * it builds filenames, never decides identity. Narrows by sanitized prefix then
1298
- * confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
1299
- */
1300
- declare function findConfigByName(name: string): SavedTunnelConfig | null;
1301
- /**
1302
- * Find a config by name or configId (supports partial configId match).
1303
- */
1304
- declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
1305
- /**
1306
- * Save a tunnel config to the config store.
1307
- * Rejects duplicate names.
1308
- *
1309
- * @param options.strict When `true` (default) names are validated with
1310
- * {@link validateNameStrict}; when `false` (app-driven writes) with the
1311
- * relaxed {@link validateNameForStorage}.
1312
- */
1313
- declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
1314
- strict?: boolean;
1315
- }): SavedTunnelConfig;
1316
- /**
1317
- * Insert or update a full saved record, keyed by `configId` (the stable
1318
- * identity). If a record with the same `configId` exists under a different
1319
- * filename — because its `name` changed — the old file is deleted before the
1320
- * new one is written, so there is never a stale duplicate on disk. Only
1321
- * validates the name when creating a brand-new record;
1322
- */
1323
- declare function upsertConfig(saved: SavedTunnelConfig, options?: {
1324
- strict?: boolean;
1325
- }): SavedTunnelConfig;
1326
- /**
1327
- * Replace a *bounded* set of configs in one pass. Every config in `configs` is
1328
- * upserted;
1329
- */
1330
- declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
1331
- strict?: boolean;
1332
- }): {
1333
- written: string[];
1334
- deleted: string[];
1335
- };
1336
- /**
1337
- * Load a saved tunnel config by name.
1338
- */
1339
- declare function loadConfigByName(name: string): SavedTunnelConfig | null;
1340
- /**
1341
- * Delete a saved tunnel config by name or configId.
1342
- * Returns the deleted config's name if found, null otherwise.
1343
- */
1344
- declare function deleteConfig(nameOrId: string): string | null;
1345
- /**
1346
- * Update the autoStart flag on a saved config.
1347
- * Returns the updated config, or null if not found.
1348
- */
1349
- declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
1350
- /**
1351
- * Update the tunnel configuration of a saved config.
1352
- * Returns the updated config, or null if not found.
1353
- */
1354
- declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
1355
- /**
1356
- * Get all configs marked for auto-start.
1357
- */
1358
- declare function getAutoStartConfigs(): SavedTunnelConfig[];
1359
-
1360
- interface DaemonInfo {
1361
- pid: number;
1362
- port: number;
1363
- startedAt: string;
1364
- host?: DaemonHost;
1365
- /** IPC protocol version the daemon speaks. Absent in daemon.json written by older builds. */
1366
- ipcVersion?: number;
1367
- }
1368
-
1369
1382
  /**
1370
1383
  * Read and validate daemon.json.
1371
1384
  * Returns null if file doesn't exist, is malformed, or PID is stale.
package/dist/index.d.ts CHANGED
@@ -1032,6 +1032,136 @@ declare class IPCClient {
1032
1032
  private request;
1033
1033
  }
1034
1034
 
1035
+ interface SavedTunnelConfig {
1036
+ name: string;
1037
+ configId: string;
1038
+ autoStart: boolean;
1039
+ createdAt: string;
1040
+ updatedAt: string;
1041
+ tunnelConfig: TunnelConfigurationV1;
1042
+ /**
1043
+ * App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
1044
+ * and daemon never read this;
1045
+ */
1046
+ uiMetadata?: Record<string, unknown>;
1047
+ }
1048
+ /**
1049
+ * Minimal logger interface for the storage module. Defaults to the cli-js
1050
+ * winston logger (silent unless the CLI configures it). Non-CLI consumers
1051
+ * (e.g. the Electron app) override it via {@link configureStorageLogger} to
1052
+ * route storage logs into their own logging pipeline
1053
+ */
1054
+ interface StorageLogger {
1055
+ info: (message: string, ...meta: unknown[]) => void;
1056
+ warn: (message: string, ...meta: unknown[]) => void;
1057
+ error: (message: string, ...meta: unknown[]) => void;
1058
+ }
1059
+ declare function configureStorageLogger(l: StorageLogger): void;
1060
+ /**
1061
+ * Sanitizes a tunnel name to be filesystem-safe.
1062
+ * Allows alphanumeric, hyphens, underscores only.
1063
+ */
1064
+ declare function sanitizeName(name: string): string;
1065
+ /**
1066
+ * Strict name validation used by the CLI's own save path: alphanumeric +
1067
+ * `_`/`-`, ≤128 chars, no reserved subcommand names.
1068
+ */
1069
+ declare function validateNameStrict(name: string): Error | null;
1070
+ /**
1071
+ * Relaxed name validation used by app-driven writes (`{ strict: false }`). The
1072
+ * app allows spaces/unicode in display names, so this only rejects what would
1073
+ * break the filesystem layout or collide with a CLI subcommand: path
1074
+ * separators, NUL/control characters, empty/whitespace-only names, and reserved
1075
+ * subcommand names. The JSON `name` keeps the original; the filename is always
1076
+ * sanitized via {@link sanitizeName}.
1077
+ */
1078
+ declare function validateNameForStorage(name: string): Error | null;
1079
+ /**
1080
+ * Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
1081
+ * callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
1082
+ */
1083
+ declare const validateName: typeof validateNameStrict;
1084
+ /**
1085
+ * List all saved tunnel configs from the config directory.
1086
+ */
1087
+ declare function listSavedConfigs(): SavedTunnelConfig[];
1088
+ /**
1089
+ * Find a config by its exact display name (the JSON `name`). Exact on purpose:
1090
+ * `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
1091
+ * it builds filenames, never decides identity. Narrows by sanitized prefix then
1092
+ * confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
1093
+ */
1094
+ declare function findConfigByName(name: string): SavedTunnelConfig | null;
1095
+ /**
1096
+ * Find a config by name or configId (supports partial configId match).
1097
+ */
1098
+ declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
1099
+ /**
1100
+ * Save a tunnel config to the config store.
1101
+ * Rejects duplicate names.
1102
+ *
1103
+ * @param options.strict When `true` (default) names are validated with
1104
+ * {@link validateNameStrict}; when `false` (app-driven writes) with the
1105
+ * relaxed {@link validateNameForStorage}.
1106
+ */
1107
+ declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
1108
+ strict?: boolean;
1109
+ }): SavedTunnelConfig;
1110
+ /**
1111
+ * Insert or update a full saved record, keyed by `configId` (the stable
1112
+ * identity). If a record with the same `configId` exists under a different
1113
+ * filename — because its `name` changed — the old file is deleted before the
1114
+ * new one is written, so there is never a stale duplicate on disk. Only
1115
+ * validates the name when creating a brand-new record;
1116
+ */
1117
+ declare function upsertConfig(saved: SavedTunnelConfig, options?: {
1118
+ strict?: boolean;
1119
+ }): SavedTunnelConfig;
1120
+ /**
1121
+ * Replace a *bounded* set of configs in one pass. Every config in `configs` is
1122
+ * upserted;
1123
+ */
1124
+ declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
1125
+ strict?: boolean;
1126
+ }): {
1127
+ written: string[];
1128
+ deleted: string[];
1129
+ };
1130
+ /**
1131
+ * Load a saved tunnel config by name.
1132
+ */
1133
+ declare function loadConfigByName(name: string): SavedTunnelConfig | null;
1134
+ /**
1135
+ * Delete a saved tunnel config by name or configId.
1136
+ * Returns the deleted config's name if found, null otherwise.
1137
+ */
1138
+ declare function deleteConfig(nameOrId: string): string | null;
1139
+ /**
1140
+ * Update the autoStart flag on a saved config.
1141
+ * Returns the updated config, or null if not found.
1142
+ */
1143
+ declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
1144
+ /**
1145
+ * Update the tunnel configuration of a saved config.
1146
+ * Returns the updated config, or null if not found.
1147
+ */
1148
+ declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
1149
+ /**
1150
+ * Get all configs marked for auto-start.
1151
+ */
1152
+ declare function getAutoStartConfigs(): SavedTunnelConfig[];
1153
+
1154
+ interface DaemonInfo {
1155
+ pid: number;
1156
+ port: number;
1157
+ startedAt: string;
1158
+ host?: DaemonHost;
1159
+ /** IPC protocol version the daemon speaks. Absent in daemon.json written by older builds. */
1160
+ ipcVersion?: number;
1161
+ /** The version this daemon started with. It never follows the installed binary. Absent in older builds. */
1162
+ cliVersion?: string;
1163
+ }
1164
+
1035
1165
  type StatsCallback = (tunnelId: string, stats: TunnelUsageType) => void;
1036
1166
  type DisconnectCallback = (tunnelId: string, error: string, messages: string[]) => void;
1037
1167
  type ReconnectingCallback = (tunnelId: string, retryCnt: number) => void;
@@ -1155,6 +1285,8 @@ declare class DaemonHealth {
1155
1285
 
1156
1286
  interface TunnelClientOptions {
1157
1287
  origin?: ClientOrigin;
1288
+ /** Replaces the "daemon runs an older version" line. */
1289
+ printVersionNotice?: (info: DaemonInfo) => void;
1158
1290
  }
1159
1291
  declare class TunnelClient {
1160
1292
  private ipc;
@@ -1165,8 +1297,17 @@ declare class TunnelClient {
1165
1297
  private shimDisconnectListeners;
1166
1298
  private shimSubscribedTunnels;
1167
1299
  private shimListenerSeq;
1300
+ private boundDaemon;
1301
+ private readonly printVersionNotice;
1168
1302
  constructor(options?: TunnelClientOptions);
1169
- ensureDaemon(): Promise<void>;
1303
+ /**
1304
+ * @param options.holdVersionNotice leaves the "daemon runs an older version" line for `printHeldVersionNotice()`.
1305
+ * A caller with a spinner running uses this, so the line does not land on the spinner.
1306
+ */
1307
+ ensureDaemon(options?: {
1308
+ holdVersionNotice?: boolean;
1309
+ }): Promise<void>;
1310
+ printHeldVersionNotice(): void;
1170
1311
  /**
1171
1312
  * Connects to the daemon that runs now, and never starts one. For commands that only read state.
1172
1313
  * Throws when that daemon speaks another IPC version, as ensureDaemon() does.
@@ -1238,134 +1379,6 @@ declare class TunnelClient {
1238
1379
  private assertClient;
1239
1380
  }
1240
1381
 
1241
- interface SavedTunnelConfig {
1242
- name: string;
1243
- configId: string;
1244
- autoStart: boolean;
1245
- createdAt: string;
1246
- updatedAt: string;
1247
- tunnelConfig: TunnelConfigurationV1;
1248
- /**
1249
- * App-owned UI state (e.g. `regioncode`, `isServerAddress`). The CLI
1250
- * and daemon never read this;
1251
- */
1252
- uiMetadata?: Record<string, unknown>;
1253
- }
1254
- /**
1255
- * Minimal logger interface for the storage module. Defaults to the cli-js
1256
- * winston logger (silent unless the CLI configures it). Non-CLI consumers
1257
- * (e.g. the Electron app) override it via {@link configureStorageLogger} to
1258
- * route storage logs into their own logging pipeline
1259
- */
1260
- interface StorageLogger {
1261
- info: (message: string, ...meta: unknown[]) => void;
1262
- warn: (message: string, ...meta: unknown[]) => void;
1263
- error: (message: string, ...meta: unknown[]) => void;
1264
- }
1265
- declare function configureStorageLogger(l: StorageLogger): void;
1266
- /**
1267
- * Sanitizes a tunnel name to be filesystem-safe.
1268
- * Allows alphanumeric, hyphens, underscores only.
1269
- */
1270
- declare function sanitizeName(name: string): string;
1271
- /**
1272
- * Strict name validation used by the CLI's own save path: alphanumeric +
1273
- * `_`/`-`, ≤128 chars, no reserved subcommand names.
1274
- */
1275
- declare function validateNameStrict(name: string): Error | null;
1276
- /**
1277
- * Relaxed name validation used by app-driven writes (`{ strict: false }`). The
1278
- * app allows spaces/unicode in display names, so this only rejects what would
1279
- * break the filesystem layout or collide with a CLI subcommand: path
1280
- * separators, NUL/control characters, empty/whitespace-only names, and reserved
1281
- * subcommand names. The JSON `name` keeps the original; the filename is always
1282
- * sanitized via {@link sanitizeName}.
1283
- */
1284
- declare function validateNameForStorage(name: string): Error | null;
1285
- /**
1286
- * Backwards-compatible alias for {@link validateNameStrict}. Existing CLI
1287
- * callers (`subcommands.ts`, `buildAndStartTunnel.ts`) import `validateName`.
1288
- */
1289
- declare const validateName: typeof validateNameStrict;
1290
- /**
1291
- * List all saved tunnel configs from the config directory.
1292
- */
1293
- declare function listSavedConfigs(): SavedTunnelConfig[];
1294
- /**
1295
- * Find a config by its exact display name (the JSON `name`). Exact on purpose:
1296
- * `sanitizeName` is many-to-one (`"My Tunnel"`/`"My_Tunnel"` → `My_Tunnel`), so
1297
- * it builds filenames, never decides identity. Narrows by sanitized prefix then
1298
- * confirms the exact `name`; on a same-name/different-`configId` tie, newest wins.
1299
- */
1300
- declare function findConfigByName(name: string): SavedTunnelConfig | null;
1301
- /**
1302
- * Find a config by name or configId (supports partial configId match).
1303
- */
1304
- declare function findConfig(nameOrId: string): SavedTunnelConfig | null;
1305
- /**
1306
- * Save a tunnel config to the config store.
1307
- * Rejects duplicate names.
1308
- *
1309
- * @param options.strict When `true` (default) names are validated with
1310
- * {@link validateNameStrict}; when `false` (app-driven writes) with the
1311
- * relaxed {@link validateNameForStorage}.
1312
- */
1313
- declare function saveConfig(name: string, configId: string, tunnelConfig: TunnelConfigurationV1, autoStart?: boolean, options?: {
1314
- strict?: boolean;
1315
- }): SavedTunnelConfig;
1316
- /**
1317
- * Insert or update a full saved record, keyed by `configId` (the stable
1318
- * identity). If a record with the same `configId` exists under a different
1319
- * filename — because its `name` changed — the old file is deleted before the
1320
- * new one is written, so there is never a stale duplicate on disk. Only
1321
- * validates the name when creating a brand-new record;
1322
- */
1323
- declare function upsertConfig(saved: SavedTunnelConfig, options?: {
1324
- strict?: boolean;
1325
- }): SavedTunnelConfig;
1326
- /**
1327
- * Replace a *bounded* set of configs in one pass. Every config in `configs` is
1328
- * upserted;
1329
- */
1330
- declare function bulkReplace(configs: SavedTunnelConfig[], knownConfigIds: Set<string>, options?: {
1331
- strict?: boolean;
1332
- }): {
1333
- written: string[];
1334
- deleted: string[];
1335
- };
1336
- /**
1337
- * Load a saved tunnel config by name.
1338
- */
1339
- declare function loadConfigByName(name: string): SavedTunnelConfig | null;
1340
- /**
1341
- * Delete a saved tunnel config by name or configId.
1342
- * Returns the deleted config's name if found, null otherwise.
1343
- */
1344
- declare function deleteConfig(nameOrId: string): string | null;
1345
- /**
1346
- * Update the autoStart flag on a saved config.
1347
- * Returns the updated config, or null if not found.
1348
- */
1349
- declare function updateConfigAutoStart(nameOrId: string, autoStart: boolean): SavedTunnelConfig | null;
1350
- /**
1351
- * Update the tunnel configuration of a saved config.
1352
- * Returns the updated config, or null if not found.
1353
- */
1354
- declare function updateTunnelConfig(nameOrId: string, tunnelConfig: TunnelConfigurationV1): SavedTunnelConfig | null;
1355
- /**
1356
- * Get all configs marked for auto-start.
1357
- */
1358
- declare function getAutoStartConfigs(): SavedTunnelConfig[];
1359
-
1360
- interface DaemonInfo {
1361
- pid: number;
1362
- port: number;
1363
- startedAt: string;
1364
- host?: DaemonHost;
1365
- /** IPC protocol version the daemon speaks. Absent in daemon.json written by older builds. */
1366
- ipcVersion?: number;
1367
- }
1368
-
1369
1382
  /**
1370
1383
  * Read and validate daemon.json.
1371
1384
  * Returns null if file doesn't exist, is malformed, or PID is stale.
package/dist/index.js CHANGED
@@ -6,15 +6,11 @@ import {
6
6
  TunnelConfigV1Schema,
7
7
  TunnelOperations,
8
8
  closeRemoteManagement,
9
- getDaemonInfo,
10
9
  getRemoteManagementState,
11
10
  initiateRemoteManagement,
12
- isDaemonRunning,
13
11
  startRemoteManagement
14
- } from "./chunk-3PTLHLFL.js";
15
- import {
16
- DeviceAgentState
17
- } from "./chunk-7EQKHVQX.js";
12
+ } from "./chunk-Q5NCTGNS.js";
13
+ import "./chunk-MHQ3CVEB.js";
18
14
  import {
19
15
  bulkReplace,
20
16
  configureStorageLogger,
@@ -32,24 +28,33 @@ import {
32
28
  validateName,
33
29
  validateNameForStorage,
34
30
  validateNameStrict
35
- } from "./chunk-QZJGTQZC.js";
31
+ } from "./chunk-2GIJXE4K.js";
32
+ import {
33
+ TunnelManager
34
+ } from "./chunk-3WMTTJHI.js";
35
+ import "./chunk-UB26QJ4T.js";
36
+ import {
37
+ getDaemonInfo,
38
+ isDaemonRunning
39
+ } from "./chunk-4XXAHYCJ.js";
40
+ import {
41
+ DeviceAgentState
42
+ } from "./chunk-MKGD2QAI.js";
36
43
  import {
37
44
  TunnelErrorCodeType,
38
- TunnelManager,
39
45
  TunnelStateType,
40
46
  TunnelWarningCode,
41
47
  printer_default
42
- } from "./chunk-EMCDDH3B.js";
43
- import "./chunk-UB26QJ4T.js";
48
+ } from "./chunk-HTIWY3O5.js";
44
49
  import {
45
50
  enablePackageLogging
46
- } from "./chunk-IRKMUV37.js";
51
+ } from "./chunk-LWCVB42S.js";
47
52
  import {
48
53
  ensureTunnelConfigDir,
49
54
  getDaemonInfoPath,
50
55
  getPinggyConfigDir,
51
56
  getTunnelConfigDir
52
- } from "./chunk-N5WE4DYD.js";
57
+ } from "./chunk-MAK5R4WQ.js";
53
58
 
54
59
  // src/utils/detect_vc_redist_on_windows.ts
55
60
  import fs from "fs";
@@ -141,7 +146,7 @@ async function verifyAndLoad() {
141
146
  process.exit(1);
142
147
  }
143
148
  }
144
- await import("./main-TDQB5ZB4.js");
149
+ await import("./main-BI7ACRHS.js");
145
150
  }
146
151
  verifyAndLoad().catch((err) => {
147
152
  printer_default.fatal(`Failed to start CLI:, ${err}`);
@@ -2,7 +2,8 @@ import {
2
2
  HTTP_NOT_FOUND,
3
3
  IPCClient,
4
4
  IPCHttpError
5
- } from "./chunk-7EQKHVQX.js";
5
+ } from "./chunk-MHQ3CVEB.js";
6
+ import "./chunk-MKGD2QAI.js";
6
7
  export {
7
8
  HTTP_NOT_FOUND,
8
9
  IPCClient,