dsh-mobile 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -620,6 +620,8 @@ declare class MobileAccessGateway {
620
620
  private readonly activeRequests;
621
621
  private readonly activeWebSockets;
622
622
  private readonly mobileBootBatches;
623
+ /** Cached upstream bundle byte sizes (HEAD probes), keyed by resource URL. */
624
+ private readonly bootEntrySizeCache;
623
625
  private readonly extensionEventListeners;
624
626
  private extensionEventRevision;
625
627
  private readonly taskEventListeners;
@@ -686,6 +688,20 @@ declare class MobileAccessGateway {
686
688
  private exchangeUpstreamCookie;
687
689
  private proxyMobileIndex;
688
690
  private rememberMobileBootBatch;
691
+ /**
692
+ * Determine which layout-batch entries can share a merged boot batch and which
693
+ * must pass through. An entry at or above the per-entry cap, or one whose size
694
+ * could not be probed, keeps its own upstream `/plugins` row: a merged batch
695
+ * cannot carry it, and an unknown bundle must not risk the whole batch.
696
+ */
697
+ private resolveMobileBootSizes;
698
+ /**
699
+ * Measure one upstream bundle by reading its body. The upstream serves
700
+ * `/plugins` bundles as chunked streams without a Content-Length, so a probe
701
+ * counts bytes; it aborts instantly past the per-entry cap. Measurements are
702
+ * cached for a short window.
703
+ */
704
+ private upstreamBundleSize;
689
705
  private serveMobileBootBatch;
690
706
  private startMobileBootBatchAssembly;
691
707
  private assembleMobileBootBatch;
@@ -703,7 +719,14 @@ declare class MobileAccessGateway {
703
719
  private readUpstreamClientBundleWithRetry;
704
720
  private readUpstreamClientBundle;
705
721
  private allocateRequest;
722
+ /**
723
+ * Proxy one request upstream. Pass-through client bundles (`GET /plugins`)
724
+ * receive bounded transient retries — the upstream resets a fraction of fresh
725
+ * connections — matching the resilience the merged-batch assembly already has.
726
+ * A request is only retried before any byte reached the client.
727
+ */
706
728
  private proxyHttp;
729
+ private proxyHttpOnce;
707
730
  private abortSessionResources;
708
731
  private broadcastExtensionChange;
709
732
  /** Fan a completed task to every phone holding this gateway's event stream. */
@@ -1073,23 +1096,28 @@ declare class OriginController implements RemoteProviderController {
1073
1096
  //#endregion
1074
1097
  //#region src/cloudflared-component.d.ts
1075
1098
  /**
1076
- * Pinned cloudflared Windows component fetched only after an explicit user action.
1099
+ * Pinned cloudflared components fetched only after an explicit user action.
1077
1100
  *
1078
- * Unlike the cpolar archive this artifact IS the executable: there is nothing to
1079
- * unpack, so the download digest and the installed digest are the same pair.
1101
+ * Unlike the cpolar archive each artifact IS the executable: there is nothing
1102
+ * to unpack, so the download digest and the installed digest are the same pair.
1080
1103
  * `--no-autoupdate` is passed at runtime as well, so the pinned bytes stay the
1081
1104
  * bytes that were verified.
1082
1105
  */
1083
- declare const CLOUDFLARED_COMPONENT_RELEASE: Readonly<{
1084
- version: "2026.9.1";
1085
- platform: "win32";
1086
- arch: "x64";
1087
- downloadUrl: "https://github.com/cloudflare/cloudflared/releases/download/2026.9.1/cloudflared-windows-amd64.exe";
1088
- downloadBytes: 54976432;
1089
- downloadSha256: "2837888cc0f5d58f15b6dc478376de90b4d3ba5241c7947455d1e0a0df429712";
1090
- downloadPage: "https://github.com/cloudflare/cloudflared/releases";
1091
- termsUrl: "https://www.cloudflare.com/website-terms/";
1092
- }>;
1106
+ interface CloudflaredArtifact {
1107
+ readonly version: string;
1108
+ readonly platform: NodeJS.Platform;
1109
+ readonly arch: string;
1110
+ readonly downloadUrl: string;
1111
+ readonly downloadBytes: number;
1112
+ readonly downloadSha256: string;
1113
+ readonly executableName: string;
1114
+ }
1115
+ /**
1116
+ * Canonical release metadata. New code should select from
1117
+ * {@link CLOUDFLARED_COMPONENT_RELEASES} by platform and architecture; this
1118
+ * alias preserves the original Windows x64 entry for existing callers.
1119
+ */
1120
+ declare const CLOUDFLARED_COMPONENT_RELEASE: CloudflaredArtifact;
1093
1121
  /**
1094
1122
  * Public, credential-free description of the managed cloudflared component.
1095
1123
  *
@@ -1124,6 +1152,7 @@ declare class CloudflaredComponentManager {
1124
1152
  private readonly stagingRoot;
1125
1153
  private readonly platform;
1126
1154
  private readonly arch;
1155
+ private readonly release;
1127
1156
  private readonly fetchArtifact;
1128
1157
  private installed;
1129
1158
  private errorCode;
@@ -1236,8 +1265,13 @@ interface CloudflaredControllerOptions {
1236
1265
  };
1237
1266
  readonly createGateway: (origin: string, listenPort: number) => Promise<MobileAccessGateway>;
1238
1267
  readonly onStatus?: (status: CloudflaredStatus) => void;
1239
- /** Liveness bound for one quick-tunnel allocation; defaults to the product timeout. */
1268
+ /** Liveness bound for one startup-timeout round; defaults to the product timeout. */
1240
1269
  readonly startupTimeoutMs?: number;
1270
+ /**
1271
+ * Total startup-timeout rounds before a live named connector is given up on;
1272
+ * defaults to NAMED_STARTUP_ROUNDS. Quick tunnels always use a single round.
1273
+ */
1274
+ readonly maxStartupRounds?: number;
1241
1275
  readonly spawnProcess?: (executable: string, args: readonly string[], environment: NodeJS.ProcessEnv) => ChildProcessWithoutNullStreams;
1242
1276
  }
1243
1277
  /**
@@ -1281,6 +1315,7 @@ declare class CloudflaredController implements RemoteProviderController {
1281
1315
  private latest;
1282
1316
  private queue;
1283
1317
  private startupTimer;
1318
+ private startupRounds;
1284
1319
  constructor(options: CloudflaredControllerOptions);
1285
1320
  /** Restore the remembered cloudflared switch independently from LAN and other providers. */
1286
1321
  initialize(): Promise<void>;
@@ -1299,6 +1334,13 @@ declare class CloudflaredController implements RemoteProviderController {
1299
1334
  private enqueue;
1300
1335
  private publish;
1301
1336
  private start;
1337
+ private armStartupTimer;
1338
+ /**
1339
+ * Give a live named connector more time instead of killing it: it retries the
1340
+ * edge on its own and usually registers once the rebooted network is usable.
1341
+ * A dead connector, or an exhausted budget, fails the generation as before.
1342
+ */
1343
+ private checkStartupTimeout;
1302
1344
  private consume;
1303
1345
  /** Mark a named tunnel ready once the connector has registered with the edge. */
1304
1346
  private confirmNamedReady;