dsh-mobile 0.6.16 → 0.6.18

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
@@ -323,6 +323,8 @@ interface PluginConfig {
323
323
  upstreamOrigin?: string;
324
324
  publicAuthorities?: string[];
325
325
  allowedCidrs?: string[];
326
+ /** Extra direct management peers; every non-loopback request still requires DSH authentication. */
327
+ adminAllowedCidrs?: string[];
326
328
  stateFile: string;
327
329
  /** Internal persisted on/off preference managed by the DSH plugin card. */
328
330
  controlFile: string;
@@ -384,6 +386,7 @@ interface ResolvedGatewayConfig {
384
386
  readonly upstreamOrigin: URL;
385
387
  readonly authorities: readonly AuthoritySpec[];
386
388
  readonly allowedCidrs: readonly ParsedCidr[];
389
+ readonly adminAllowedCidrs: readonly ParsedCidr[];
387
390
  readonly stateFile: string;
388
391
  /** Local extension root adjacent to the mobile-access state file. */
389
392
  readonly extensionsDir: string;
@@ -432,6 +435,12 @@ interface ClientModuleEntry {
432
435
  readonly id: string;
433
436
  readonly required: boolean;
434
437
  readonly dependencies: readonly string[];
438
+ /** Source bytes of the upstream bundle, when the Gateway could measure them. */
439
+ readonly bytes?: number;
440
+ /** Gzipped bytes the phone would receive, when the Gateway could measure them. */
441
+ readonly gzipBytes?: number;
442
+ /** The plugin package's own one-line description, when it could be read. */
443
+ readonly description?: string;
435
444
  }
436
445
  /** Selection returned to the computer administrator or the authenticated device. */
437
446
  interface ClientModulePreferenceView {
@@ -569,6 +578,18 @@ type HttpFailureEntry = ({
569
578
  readonly suppressed?: number;
570
579
  };
571
580
  //#endregion
581
+ //#region src/api-latency-log.d.ts
582
+ /** One sampled API wait; `durationMs` spans the client's request to response close. */
583
+ type ApiLatencyEntry = {
584
+ readonly kind: 'api';
585
+ readonly method: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OTHER';
586
+ readonly path: string;
587
+ readonly status: number;
588
+ readonly durationMs: number;
589
+ } & {
590
+ readonly suppressed?: number;
591
+ };
592
+ //#endregion
572
593
  //#region src/upstream-auth-log.d.ts
573
594
  /** Fixed outcomes of the Gateway's private DSH launch-token exchange. */
574
595
  type UpstreamAuthOutcome = 'accepted' | 'invalid-target' | 'unexpected-status' | 'invalid-cookie' | 'timeout' | 'transport-error';
@@ -1017,6 +1038,7 @@ export declare class MobileAccessGateway {
1017
1038
  private readonly mobileBootBatches;
1018
1039
  private readonly mobileDocumentViews;
1019
1040
  private readonly mobileGraphTasks;
1041
+ private readonly workspaceDirectoryTasks;
1020
1042
  /** Cached upstream bundle byte sizes (HEAD probes), keyed by resource URL. */
1021
1043
  private readonly bootEntrySizeCache;
1022
1044
  private readonly extensionEventListeners;
@@ -1044,15 +1066,20 @@ export declare class MobileAccessGateway {
1044
1066
  private readonly probeDeviceLimiter;
1045
1067
  private readonly probeInFlight;
1046
1068
  private readonly clientModulePreferences;
1069
+ private readonly clientModuleSizeCache;
1070
+ private readonly clientModuleDescriptionCache;
1071
+ private clientModuleMetadataRevision;
1072
+ private clientModuleMeasurementActive;
1047
1073
  private readonly clientModuleOperations;
1048
1074
  private readonly clientModuleTasks;
1049
1075
  private readonly clientModuleRevocations;
1050
1076
  private readonly authFailures;
1051
1077
  private readonly httpFailures;
1078
+ private readonly apiLatency;
1052
1079
  private readonly upstreamAuthDiagnostics;
1053
1080
  constructor(config: ResolvedGatewayConfig, store: DeviceStore, extensions?: MobileAccessService | undefined, upstreamAuthenticatedUrl?: string | undefined, extraWebSocketPaths?: {
1054
1081
  has(pathname: string): boolean;
1055
- } | undefined, blockedUpgradeLog?: BlockedUpgradePathLog | undefined, onDiscoveryDegraded?: ((source: 'broadcast' | 'mdns', code: string) => void) | undefined, clientModulePreferences?: ClientModulePreferenceStore, authFailureLog?: (entry: AuthFailureEntry) => void, httpFailureLog?: (entry: HttpFailureEntry) => void, upstreamAuthLog?: (entry: UpstreamAuthEntry) => void);
1082
+ } | undefined, blockedUpgradeLog?: BlockedUpgradePathLog | undefined, onDiscoveryDegraded?: ((source: 'broadcast' | 'mdns', code: string) => void) | undefined, clientModulePreferences?: ClientModulePreferenceStore, authFailureLog?: (entry: AuthFailureEntry) => void, httpFailureLog?: (entry: HttpFailureEntry) => void, upstreamAuthLog?: (entry: UpstreamAuthEntry) => void, apiLatencyLog?: (entry: ApiLatencyEntry) => void);
1056
1083
  /** Initialize durable state, validate TLS, and bind the externally reachable listener. */
1057
1084
  start(): Promise<void>;
1058
1085
  /** Install a newly signed provided leaf for future TLS handshakes without dropping sessions. */
@@ -1113,6 +1140,12 @@ export declare class MobileAccessGateway {
1113
1140
  * @returns The installed catalog and effective module selection.
1114
1141
  */
1115
1142
  describeClientModules(deviceId?: string, callerSignal?: AbortSignal): Promise<ClientModulePreferenceView>;
1143
+ /** Measure optional catalog metadata without changing saved module selections.
1144
+ * @param deviceId - Authenticated device identity, or computer defaults when omitted.
1145
+ * @param callerSignal - Cancels measurement and drains its admitted requests.
1146
+ * @returns Current selections with the measurements completed within the budget.
1147
+ */
1148
+ measureClientModules(deviceId?: string, callerSignal?: AbortSignal): Promise<ClientModulePreferenceView>;
1116
1149
  /** Persist a validated device override or computer default.
1117
1150
  * @param excluded - Untrusted module IDs to validate against the current boot graph.
1118
1151
  * @param deviceId - Authenticated device identity; omitted for computer defaults.
@@ -1126,6 +1159,25 @@ export declare class MobileAccessGateway {
1126
1159
  * @returns The catalog and inherited selection.
1127
1160
  */
1128
1161
  resetClientModules(deviceId?: string, callerSignal?: AbortSignal): Promise<ClientModulePreferenceView>;
1162
+ /** Return cached metadata only; catalog reads and saves never start bundle probes. */
1163
+ private describeMobileModulesWithSizes;
1164
+ /** Refresh metadata only after an explicit user action, with bounded concurrency. */
1165
+ private measureMobileModules;
1166
+ /**
1167
+ * Read the installed package description for one catalog module.
1168
+ *
1169
+ * This is best-effort package metadata lookup from the state directory's Node
1170
+ * resolution context and this plugin's dependencies. Unexported or unavailable
1171
+ * package metadata stays unknown; arbitrary paths and subpaths are not read.
1172
+ */
1173
+ private installedModuleDescription;
1174
+ /**
1175
+ * Measure one upstream bundle's source and gzipped size.
1176
+ *
1177
+ * Measurements are cached for ten minutes: the settings panel is opened rarely
1178
+ * and upstream bundle bytes only change on a plugin rebuild or host restart.
1179
+ */
1180
+ private upstreamBundleMeasurement;
1129
1181
  private clientModulePreferenceOperation;
1130
1182
  private fetchAuthenticatedUpstreamIndex;
1131
1183
  private proxyMobileIndex;