@camstack/server 1.2.592 → 1.2.594

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 (256) hide show
  1. package/dist/addon-root-inventory.js +11 -50
  2. package/dist/agent/addon-scan.js +6 -44
  3. package/dist/agent/agent-addon-runtime.js +3 -8
  4. package/dist/agent/agent-addon-updates.js +12 -52
  5. package/dist/agent/agent-cap-dispatch-service.js +3 -5
  6. package/dist/agent/agent-config.js +7 -42
  7. package/dist/agent/agent-deploy-swap.js +5 -41
  8. package/dist/agent/agent-group-runner.js +8 -47
  9. package/dist/agent/agent-http-auth.js +10 -22
  10. package/dist/agent/agent-http.js +69 -115
  11. package/dist/agent/agent-hub-addon-update.js +10 -16
  12. package/dist/agent/agent-hub-registration.js +4 -7
  13. package/dist/agent/agent-infra-capabilities.js +5 -9
  14. package/dist/agent/agent-json-file.js +5 -42
  15. package/dist/agent/agent-mesh-gate.js +5 -8
  16. package/dist/agent/agent-node-certificates.js +25 -28
  17. package/dist/agent/agent-pairing-local.js +10 -47
  18. package/dist/agent/agent-pairing-routes.js +16 -20
  19. package/dist/agent/agent-pairing-store.js +18 -58
  20. package/dist/agent/agent-reconnect.js +1 -4
  21. package/dist/agent/agent-service.js +42 -78
  22. package/dist/agent/agent-sniffing-listener.js +11 -48
  23. package/dist/agent/agent-undeploy.js +5 -41
  24. package/dist/agent/agent-update-routes.js +14 -19
  25. package/dist/agent/agent-update-service.js +38 -80
  26. package/dist/agent/apply-model-distribution.js +1 -4
  27. package/dist/agent/apply-stage-dev-uploads.js +6 -9
  28. package/dist/agent/derive-hub-url.js +3 -8
  29. package/dist/agent/fetch-bundle-from-hub.js +6 -9
  30. package/dist/agent/hubs-found.js +6 -43
  31. package/dist/agent/infra-boot-guard.js +1 -4
  32. package/dist/agent/infra-boot-plan.js +2 -6
  33. package/dist/agent/main.js +158 -186
  34. package/dist/agent/register-agent-cap-dispatch.js +3 -6
  35. package/dist/agent/serial-queue.js +2 -7
  36. package/dist/agent-status-page.js +1 -4
  37. package/dist/api/addon-upload.js +22 -61
  38. package/dist/api/agent-addon-delivery.js +6 -11
  39. package/dist/api/auth-whoami.js +1 -4
  40. package/dist/api/backup-download-pump.js +5 -9
  41. package/dist/api/backup-download.js +7 -10
  42. package/dist/api/core/addon-settings.router.js +16 -19
  43. package/dist/api/core/agent-pairing.router.js +76 -79
  44. package/dist/api/core/agents.router.js +21 -24
  45. package/dist/api/core/auth-admin-tokens.procedures.js +48 -52
  46. package/dist/api/core/auth-device-cert.procedures.js +62 -67
  47. package/dist/api/core/auth-limits.js +16 -25
  48. package/dist/api/core/auth-reauth.procedures.js +32 -37
  49. package/dist/api/core/auth-revoke-credentials.procedures.js +22 -26
  50. package/dist/api/core/auth-sessions.procedures.js +52 -56
  51. package/dist/api/core/auth.router.js +300 -304
  52. package/dist/api/core/cap-providers.js +74 -121
  53. package/dist/api/core/capabilities.router.js +34 -37
  54. package/dist/api/core/capability-preference-writes.js +10 -17
  55. package/dist/api/core/certificates.router.js +106 -109
  56. package/dist/api/core/cluster-nodes.router.js +15 -18
  57. package/dist/api/core/collection-preference.js +2 -6
  58. package/dist/api/core/event-bus-proxy.router.js +34 -37
  59. package/dist/api/core/failure-contributions.js +4 -8
  60. package/dist/api/core/hwaccel.router.js +17 -20
  61. package/dist/api/core/integration-secrets.js +8 -12
  62. package/dist/api/core/lifecycle-job-runner.js +13 -49
  63. package/dist/api/core/live-events.router.js +29 -32
  64. package/dist/api/core/load-contributions.js +4 -8
  65. package/dist/api/core/logging-settings.js +30 -43
  66. package/dist/api/core/logs.router.js +40 -43
  67. package/dist/api/core/notifications.router.js +15 -18
  68. package/dist/api/core/public-event-filter.js +4 -8
  69. package/dist/api/core/repl.router.js +18 -21
  70. package/dist/api/core/request-census-settings.js +11 -16
  71. package/dist/api/core/server-management.provider.js +1 -4
  72. package/dist/api/core/server-name.js +9 -17
  73. package/dist/api/core/site-location.js +16 -24
  74. package/dist/api/core/stream-probe.router.js +21 -24
  75. package/dist/api/core/system-events.router.js +23 -26
  76. package/dist/api/cors/cors-policy.js +20 -29
  77. package/dist/api/cors/register-cors-policy.js +9 -14
  78. package/dist/api/deploy-stage-registry.js +6 -10
  79. package/dist/api/dev-uploads-bundle.js +12 -50
  80. package/dist/api/health/adaptive-probe.routes.js +9 -13
  81. package/dist/api/health/health.routes.js +8 -13
  82. package/dist/api/hub-cluster-url.js +3 -9
  83. package/dist/api/model-distributor.js +12 -50
  84. package/dist/api/oauth2/consent-page.js +10 -13
  85. package/dist/api/oauth2/oauth2-routes.js +17 -25
  86. package/dist/api/oauth2/private-host.js +1 -4
  87. package/dist/api/server-upload-propagate.js +15 -51
  88. package/dist/api/server-upload.js +13 -50
  89. package/dist/api/sse-no-compression.js +1 -4
  90. package/dist/api/static/frame-policy.js +4 -9
  91. package/dist/api/static/precompressed-asset.js +15 -57
  92. package/dist/api/static/spa-mount.js +8 -47
  93. package/dist/api/static/spa-static.js +5 -12
  94. package/dist/api/tarball-manifest.js +7 -44
  95. package/dist/api/trpc/cap-mount-helpers.js +7 -12
  96. package/dist/api/trpc/cap-route-error-formatter.js +10 -13
  97. package/dist/api/trpc/cap-router-runtime.js +40 -51
  98. package/dist/api/trpc/client-ip.js +9 -20
  99. package/dist/api/trpc/core-cap-bridge.js +32 -42
  100. package/dist/api/trpc/device-collection-dispatch.js +23 -27
  101. package/dist/api/trpc/device-config-secret-redaction.js +24 -40
  102. package/dist/api/trpc/generated-cap-mounts.js +219 -221
  103. package/dist/api/trpc/generated-cap-routers.js +4878 -4726
  104. package/dist/api/trpc/http-request-census-hook.js +8 -11
  105. package/dist/api/trpc/http-request-census.js +34 -41
  106. package/dist/api/trpc/http-request-census.singleton.js +4 -8
  107. package/dist/api/trpc/localized-schema-paths.js +1 -4
  108. package/dist/api/trpc/principal-visibility.js +14 -22
  109. package/dist/api/trpc/remote-addon-update-grant.js +1 -4
  110. package/dist/api/trpc/scope-access.js +10 -15
  111. package/dist/api/trpc/server-provided-caps.js +3 -7
  112. package/dist/api/trpc/share-view-access.js +6 -14
  113. package/dist/api/trpc/trpc-error-device-tags.js +3 -6
  114. package/dist/api/trpc/trpc-error-principal.js +2 -6
  115. package/dist/api/trpc/trpc.context.js +20 -25
  116. package/dist/api/trpc/trpc.middleware.js +38 -46
  117. package/dist/api/trpc/trpc.router.js +58 -99
  118. package/dist/api/trpc/user-error.js +5 -8
  119. package/dist/api/trpc/ws-request-census.js +17 -24
  120. package/dist/api/trpc/ws-slow-consumer-guard.js +11 -16
  121. package/dist/api/upload-auth.js +5 -9
  122. package/dist/auth/addon-route-jwt-gate.js +4 -7
  123. package/dist/auth/addon-route-share-gate.js +7 -12
  124. package/dist/auth/app-confirm-page.js +17 -22
  125. package/dist/auth/app-confirm-routes.js +26 -31
  126. package/dist/auth/app-confirmations.js +7 -44
  127. package/dist/auth/app-page-shell.js +17 -30
  128. package/dist/auth/app-page-strings.js +11 -17
  129. package/dist/auth/app-passkey-page.js +16 -21
  130. package/dist/auth/app-passkey-routes.js +37 -41
  131. package/dist/auth/app-refused-route.js +13 -18
  132. package/dist/auth/auth-network-policy.js +11 -15
  133. package/dist/auth/auth-provider-gate.js +4 -9
  134. package/dist/auth/auth-rate-limit.js +3 -7
  135. package/dist/auth/client-address.js +6 -9
  136. package/dist/auth/device-enroll-proofs.js +6 -43
  137. package/dist/auth/external-link-intents.js +3 -7
  138. package/dist/auth/hub-sessions.js +6 -12
  139. package/dist/auth/native-link-completions.js +7 -11
  140. package/dist/auth/native-return.js +9 -13
  141. package/dist/auth/passkey-provider.js +26 -32
  142. package/dist/auth/second-factors.js +6 -10
  143. package/dist/auth/session-connections.js +6 -12
  144. package/dist/auth/session-cookie.js +12 -23
  145. package/dist/auth/session-lifetimes.js +8 -12
  146. package/dist/auth/session-mint.js +4 -11
  147. package/dist/auth/sso-finish-app.js +13 -16
  148. package/dist/auth/sso-finish-deps.js +21 -27
  149. package/dist/auth/sso-finish.js +28 -38
  150. package/dist/auth/sso-routes.js +22 -25
  151. package/dist/auth/used-bridge-ids.js +1 -5
  152. package/dist/boot/boot-config.js +16 -55
  153. package/dist/boot/init-sequence.js +1 -4
  154. package/dist/boot/integration-id-backfill.js +3 -8
  155. package/dist/boot/platform-keychain-key.js +5 -42
  156. package/dist/boot/post-boot.service.js +14 -18
  157. package/dist/boot/reconcile-lifecycle-jobs.js +3 -6
  158. package/dist/boot/retired-public-url-env.js +4 -8
  159. package/dist/bootstrap-packages.js +1 -4
  160. package/dist/closure-node-modules.js +2 -38
  161. package/dist/closure-patches/patch-reach.json +6 -2
  162. package/dist/core/addon/addon-call-gateway.js +1 -5
  163. package/dist/core/addon/addon-package.service.js +83 -123
  164. package/dist/core/addon/addon-process-view.js +2 -6
  165. package/dist/core/addon/addon-realign-plan.js +1 -4
  166. package/dist/core/addon/addon-registry.service.js +254 -197
  167. package/dist/core/addon/addon-row-manifest.js +1 -4
  168. package/dist/core/addon/addon-search.service.js +3 -7
  169. package/dist/core/addon/addon-settings-provider.js +1 -3
  170. package/dist/core/addon/addon-uninstall.js +4 -11
  171. package/dist/core/addon/addon.tokens.js +2 -5
  172. package/dist/core/addon/device-meta-mirror.js +8 -13
  173. package/dist/core/addon/forked-custom-actions.js +6 -11
  174. package/dist/core/addon/integration-visibility.js +3 -6
  175. package/dist/core/addon/materialize-route-path.js +1 -4
  176. package/dist/core/addon/package-dir-utils.js +8 -45
  177. package/dist/core/addon/prune-misplaced-addons.js +5 -43
  178. package/dist/core/addon/runner-convergence.js +1 -4
  179. package/dist/core/addon/runner-serialization.js +1 -4
  180. package/dist/core/addon/runner-spawn-fanout.js +3 -8
  181. package/dist/core/addon/settings-door-wiring.js +5 -8
  182. package/dist/core/addon/single-flight-refresh.js +1 -4
  183. package/dist/core/addon-bridge/addon-bridge.service.js +7 -44
  184. package/dist/core/addon-pages/addon-pages.service.js +3 -40
  185. package/dist/core/addon-widgets/addon-widgets.service.js +4 -42
  186. package/dist/core/agent/agent-addon-backfill.js +9 -17
  187. package/dist/core/agent/agent-delivery-ledger.js +3 -7
  188. package/dist/core/agent/agent-liveness-event.js +2 -6
  189. package/dist/core/agent/agent-pairing-http.js +41 -45
  190. package/dist/core/agent/agent-registry.service.js +53 -92
  191. package/dist/core/agent/cluster-node-history-mirror.js +3 -7
  192. package/dist/core/agent/cluster-node-history-store.js +113 -58
  193. package/dist/core/agent/hub-agent-pairing.js +1 -5
  194. package/dist/core/agent/node-certificates-client.js +3 -6
  195. package/dist/core/agent/node-directory.js +1 -4
  196. package/dist/core/app-links/well-known-app-links.js +2 -6
  197. package/dist/core/auth/auth.service.js +3 -8
  198. package/dist/core/auth/handoff-code.service.js +11 -49
  199. package/dist/core/auth/record-kinds.js +35 -0
  200. package/dist/core/auth/share-token.service.js +174 -122
  201. package/dist/core/capability/capability.service.js +1 -5
  202. package/dist/core/config/config.schema.js +1 -6
  203. package/dist/core/config/config.service.js +2 -6
  204. package/dist/core/events/event-bus.service.js +3 -7
  205. package/dist/core/feature/feature.service.js +2 -6
  206. package/dist/core/lifecycle/lifecycle-runner.singleton.js +5 -10
  207. package/dist/core/lifecycle/lifecycle-state-machine.js +1 -5
  208. package/dist/core/logging/log-ring-buffer.js +1 -5
  209. package/dist/core/logging/logging.service.js +5 -9
  210. package/dist/core/logging/scoped-logger.js +1 -5
  211. package/dist/core/moleculer/agent-readiness-pull.js +1 -4
  212. package/dist/core/moleculer/agent-registration-request.js +3 -7
  213. package/dist/core/moleculer/cap-call-fn.js +39 -5
  214. package/dist/core/moleculer/cap-route-authority.js +3 -8
  215. package/dist/core/moleculer/hub-mesh-guard.js +5 -9
  216. package/dist/core/moleculer/moleculer.service.js +108 -119
  217. package/dist/core/network/network-quality.service.js +2 -6
  218. package/dist/core/notification/notification-wrapper.service.js +3 -7
  219. package/dist/core/notification/toast-wrapper.service.js +3 -7
  220. package/dist/core/provider/provider.tokens.js +1 -4
  221. package/dist/core/repl/repl-engine.service.js +4 -8
  222. package/dist/core/runner-health/runner-boot-check.js +7 -15
  223. package/dist/core/runner-health/update-preflight.js +9 -14
  224. package/dist/core/server-update/server-update.service.js +12 -49
  225. package/dist/core/server-update/system-apply-closure-patches.js +6 -42
  226. package/dist/core/server-update/system-ensure-prebuilds.js +3 -6
  227. package/dist/core/server-update/system-exec-npm.js +2 -5
  228. package/dist/core/storage/fs-storage-backend.js +1 -5
  229. package/dist/core/storage/storage-location-manager.js +1 -5
  230. package/dist/core/storage/storage.service.js +2 -6
  231. package/dist/core/streaming/ffmpeg-stream-info.js +3 -8
  232. package/dist/core/streaming/stream-probe.service.js +12 -16
  233. package/dist/core/streaming/ttl-cache.js +1 -5
  234. package/dist/core/topology/topology-emitter.service.js +19 -23
  235. package/dist/core/update-availability-emitter.js +3 -7
  236. package/dist/core/update-availability-store.js +8 -45
  237. package/dist/core/updates/agent-installed-packages.js +5 -9
  238. package/dist/core/updates/restart-marker.js +3 -8
  239. package/dist/core/updates/update-check-scheduler.js +13 -18
  240. package/dist/core/updates/wrapper-update-checker.js +3 -7
  241. package/dist/first-boot-addon-plan.js +2 -6
  242. package/dist/framework-nodepath.js +2 -38
  243. package/dist/i18n/request-lang.js +7 -11
  244. package/dist/launcher.js +30 -65
  245. package/dist/lifecycle-journal-path.js +2 -38
  246. package/dist/main.js +287 -324
  247. package/dist/manual-boot.js +120 -157
  248. package/dist/node-role.js +1 -4
  249. package/dist/package-inventory.js +7 -48
  250. package/dist/pending-restore.js +7 -43
  251. package/dist/single-copy-cleanup-runner.js +9 -45
  252. package/dist/single-copy-cleanup.js +7 -15
  253. package/dist/sqlite-restore.js +9 -48
  254. package/dist/starter.js +4 -39
  255. package/dist/ui-serving/lazy-ui-serving.js +3 -39
  256. package/package.json +13 -13
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NetworkQualityService = void 0;
4
- const system_1 = require("@camstack/system");
5
- class NetworkQualityService extends system_1.NetworkQualityTracker {
1
+ import { NetworkQualityTracker } from '@camstack/system';
2
+ export class NetworkQualityService extends NetworkQualityTracker {
6
3
  }
7
- exports.NetworkQualityService = NetworkQualityService;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NotificationServiceWrapper = void 0;
4
- const system_1 = require("@camstack/system");
1
+ import { NotificationService } from '@camstack/system';
5
2
  /**
6
3
  * NestJS-injectable wrapper around the core NotificationService.
7
4
  *
8
5
  * Lazily creates the NotificationService on first use, wiring in the
9
6
  * CapabilityRegistry for proxy-based output resolution.
10
7
  */
11
- class NotificationServiceWrapper {
8
+ export class NotificationServiceWrapper {
12
9
  caps;
13
10
  logging;
14
11
  _service = null;
@@ -18,7 +15,7 @@ class NotificationServiceWrapper {
18
15
  }
19
16
  get service() {
20
17
  if (!this._service) {
21
- this._service = new system_1.NotificationService(this.logging.createLogger('notifications'));
18
+ this._service = new NotificationService(this.logging.createLogger('notifications'));
22
19
  const registry = this.caps.getRegistry();
23
20
  if (registry) {
24
21
  this._service.setRegistry(registry);
@@ -30,4 +27,3 @@ class NotificationServiceWrapper {
30
27
  return this.service.notify(notification);
31
28
  }
32
29
  }
33
- exports.NotificationServiceWrapper = NotificationServiceWrapper;
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ToastServiceWrapper = void 0;
4
- const system_1 = require("@camstack/system");
1
+ import { ToastService } from '@camstack/system';
5
2
  /**
6
3
  * NestJS-injectable wrapper around the core ToastService.
7
4
  *
8
5
  * Provides toast broadcasting to connected UI clients.
9
6
  */
10
- class ToastServiceWrapper {
11
- _service = new system_1.ToastService();
7
+ export class ToastServiceWrapper {
8
+ _service = new ToastService();
12
9
  get service() {
13
10
  return this._service;
14
11
  }
@@ -22,4 +19,3 @@ class ToastServiceWrapper {
22
19
  return this._service.subscribe(connectionId, userId, callback);
23
20
  }
24
21
  }
25
- exports.ToastServiceWrapper = ToastServiceWrapper;
@@ -1,4 +1 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROVIDER_MANAGER = void 0;
4
- exports.PROVIDER_MANAGER = Symbol('PROVIDER_MANAGER');
1
+ export const PROVIDER_MANAGER = Symbol('PROVIDER_MANAGER');
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ReplEngineService = void 0;
4
- const system_1 = require("@camstack/system");
5
- const types_1 = require("@camstack/types");
6
- class ReplEngineService extends system_1.ReplEngine {
1
+ import { ReplEngine } from '@camstack/system';
2
+ import { SystemMirror } from '@camstack/types';
3
+ export class ReplEngineService extends ReplEngine {
7
4
  /**
8
5
  * Lazily-instantiated `SystemMirror` shared across REPL sessions.
9
6
  * Holds a single warm-boot mirror that every `sm.getDeviceById(id)`
@@ -48,7 +45,7 @@ class ReplEngineService extends system_1.ReplEngine {
48
45
  return Promise.resolve(this.systemMirror);
49
46
  if (!this.systemMirrorInit) {
50
47
  const api = this.buildInProcessApi(addonRegistry, eventBus);
51
- const sm = new types_1.SystemMirror(api);
48
+ const sm = new SystemMirror(api);
52
49
  this.systemMirrorInit = sm.init().then(() => {
53
50
  this.systemMirror = sm;
54
51
  return sm;
@@ -137,4 +134,3 @@ class ReplEngineService extends system_1.ReplEngine {
137
134
  super(contextProvider);
138
135
  }
139
136
  }
140
- exports.ReplEngineService = ReplEngineService;
@@ -1,17 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RunnerBootCheckService = exports.RUNNER_BOOT_CHECK_DELAY_MS = void 0;
4
- exports.evaluateRunnerBootCheck = evaluateRunnerBootCheck;
5
- exports.isRunnerBootCheckSettled = isRunnerBootCheckSettled;
6
- exports.isRunnerBootCheckDegraded = isRunnerBootCheckDegraded;
7
- exports.describeRunnerBootCheck = describeRunnerBootCheck;
8
1
  /**
9
2
  * Pure verdict. A planned runner is `running`, `refused` (typed Init refusal),
10
3
  * `missing` (the process service has no entry), or `failed` - which here means
11
4
  * "has an entry and is none of the above": the D6 breaker's terminal state, a
12
5
  * crash waiting on its backoff, a stop, or a start that never reached READY.
13
6
  */
14
- function evaluateRunnerBootCheck(input) {
7
+ export function evaluateRunnerBootCheck(input) {
15
8
  const byName = new Map(input.processes.map((p) => [p.name, p]));
16
9
  const expectedIds = input.planned ?? input.processes.map((p) => p.name);
17
10
  const failed = [];
@@ -55,16 +48,16 @@ function evaluateRunnerBootCheck(input) {
55
48
  };
56
49
  }
57
50
  /** True when no runner is still on its way - only a settled verdict is pushed. */
58
- function isRunnerBootCheckSettled(check) {
51
+ export function isRunnerBootCheckSettled(check) {
59
52
  return (check.pending ?? []).length === 0;
60
53
  }
61
54
  /** True when the check found anything an operator has to act on. */
62
- function isRunnerBootCheckDegraded(check) {
55
+ export function isRunnerBootCheckDegraded(check) {
63
56
  return (check !== undefined &&
64
57
  (check.failed.length > 0 || check.refused.length > 0 || check.missing.length > 0));
65
58
  }
66
59
  /** One sentence naming the findings, for a log line or an alert. */
67
- function describeRunnerBootCheck(check) {
60
+ export function describeRunnerBootCheck(check) {
68
61
  const parts = [];
69
62
  if (check.failed.length > 0)
70
63
  parts.push(`failed: ${check.failed.join(', ')}`);
@@ -77,8 +70,8 @@ function describeRunnerBootCheck(check) {
77
70
  parts.push(`still starting: ${(check.pending ?? []).join(', ')}`);
78
71
  return `${check.running}/${check.expected} runners running${parts.length > 0 ? ` - ${parts.join(' - ')}` : ''}`;
79
72
  }
80
- exports.RUNNER_BOOT_CHECK_DELAY_MS = 60_000;
81
- class RunnerBootCheckService {
73
+ export const RUNNER_BOOT_CHECK_DELAY_MS = 60_000;
74
+ export class RunnerBootCheckService {
82
75
  options;
83
76
  latest;
84
77
  timer = null;
@@ -90,7 +83,7 @@ class RunnerBootCheckService {
90
83
  return this.latest;
91
84
  }
92
85
  /** Arm the one-shot check. A second call while armed is a no-op. */
93
- scheduleAfterBoot(delayMs = exports.RUNNER_BOOT_CHECK_DELAY_MS) {
86
+ scheduleAfterBoot(delayMs = RUNNER_BOOT_CHECK_DELAY_MS) {
94
87
  if (this.timer !== null)
95
88
  return;
96
89
  this.timer = setTimeout(() => {
@@ -172,4 +165,3 @@ class RunnerBootCheckService {
172
165
  return check;
173
166
  }
174
167
  }
175
- exports.RunnerBootCheckService = RunnerBootCheckService;
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.LEGACY_BLOB_GUARD_SINCE = void 0;
4
- exports.buildUpdatePreflight = buildUpdatePreflight;
5
- exports.legacyGuardClientOf = legacyGuardClientOf;
6
1
  /**
7
2
  * The `applyServerUpdate` pre-flight (D877).
8
3
  *
@@ -20,13 +15,13 @@ exports.legacyGuardClientOf = legacyGuardClientOf;
20
15
  * the refusals listed here - a new deterministic Init refusal has to be added
21
16
  * to this module to be pre-checked.
22
17
  */
23
- const system_1 = require("@camstack/system");
24
- const index_js_1 = require("../../server-root/index.js");
18
+ import { assertLegacyBlobsMigrated, UNMIGRATED_SETTINGS_REMEDY, UnmigratedSettingsError, } from '@camstack/system';
19
+ import { compareSemver } from '../../server-root/index.js';
25
20
  /** The first server version whose addons run `assertLegacyBlobsMigrated` at Init. */
26
- exports.LEGACY_BLOB_GUARD_SINCE = '1.2.585';
27
- function buildUpdatePreflight(deps) {
21
+ export const LEGACY_BLOB_GUARD_SINCE = '1.2.585';
22
+ export function buildUpdatePreflight(deps) {
28
23
  return async (targetVersion) => {
29
- if ((0, index_js_1.compareSemver)(targetVersion, exports.LEGACY_BLOB_GUARD_SINCE) < 0)
24
+ if (compareSemver(targetVersion, LEGACY_BLOB_GUARD_SINCE) < 0)
30
25
  return [];
31
26
  const store = deps.store();
32
27
  if (store === null) {
@@ -35,17 +30,17 @@ function buildUpdatePreflight(deps) {
35
30
  const blockers = [];
36
31
  for (const addonId of deps.forkedAddonIds()) {
37
32
  try {
38
- await (0, system_1.assertLegacyBlobsMigrated)(store, addonId, deps.logger);
33
+ await assertLegacyBlobsMigrated(store, addonId, deps.logger);
39
34
  }
40
35
  catch (err) {
41
36
  // A refusal is the finding; any other error is "could not ask" and the
42
37
  // caller treats a throw as exactly that (it never blocks on it).
43
- if (!(err instanceof system_1.UnmigratedSettingsError))
38
+ if (!(err instanceof UnmigratedSettingsError))
44
39
  throw err;
45
40
  blockers.push({
46
41
  addonId,
47
42
  reason: err.message,
48
- remedy: system_1.UNMIGRATED_SETTINGS_REMEDY,
43
+ remedy: UNMIGRATED_SETTINGS_REMEDY,
49
44
  });
50
45
  }
51
46
  }
@@ -53,7 +48,7 @@ function buildUpdatePreflight(deps) {
53
48
  };
54
49
  }
55
50
  /** The three store calls the guard makes, over the hub's `settings-store` provider. */
56
- function legacyGuardClientOf(store) {
51
+ export function legacyGuardClientOf(store) {
57
52
  return {
58
53
  query: { query: (input) => store.query(input) },
59
54
  get: { query: (input) => store.get(input) },
@@ -1,39 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ServerUpdateService = void 0;
37
1
  /**
38
2
  * ServerUpdateService — hub-side adapter over the SHARED `RootUpdateService`
39
3
  * (`@camstack/node-root`, bundled into `dist/server-root/index.js`).
@@ -51,13 +15,13 @@ exports.ServerUpdateService = void 0;
51
15
  *
52
16
  * Spec: docs/superpowers/specs/2026-07-18-single-framework-copy-collapse-design.md
53
17
  */
54
- const path = __importStar(require("node:path"));
55
- const index_js_1 = require("../../server-root/index.js");
56
- const update_availability_emitter_js_1 = require("../update-availability-emitter.js");
57
- const system_ensure_prebuilds_js_1 = require("./system-ensure-prebuilds.js");
58
- const system_apply_closure_patches_js_1 = require("./system-apply-closure-patches.js");
59
- const system_exec_npm_js_1 = require("./system-exec-npm.js");
60
- class ServerUpdateService extends index_js_1.RootUpdateService {
18
+ import * as path from 'node:path';
19
+ import { HUB_ROOT_SPEC, RootUpdateService, } from '../../server-root/index.js';
20
+ import { UpdateAvailabilityEmitter } from '../update-availability-emitter.js';
21
+ import { buildSystemEnsureNativePrebuilds, } from './system-ensure-prebuilds.js';
22
+ import { buildSystemApplyClosurePatches, } from './system-apply-closure-patches.js';
23
+ import { buildSystemExecNpm } from './system-exec-npm.js';
24
+ export class ServerUpdateService extends RootUpdateService {
61
25
  updateAvailability;
62
26
  nodeId;
63
27
  constructor(options) {
@@ -70,7 +34,7 @@ class ServerUpdateService extends index_js_1.RootUpdateService {
70
34
  // the availability emitter.
71
35
  const nodeId = options.nodeId ?? 'hub';
72
36
  super({
73
- spec: index_js_1.HUB_ROOT_SPEC,
37
+ spec: HUB_ROOT_SPEC,
74
38
  nodeId,
75
39
  envNames: {
76
40
  bootMode: 'CAMSTACK_SERVER_BOOT_MODE',
@@ -88,19 +52,19 @@ class ServerUpdateService extends index_js_1.RootUpdateService {
88
52
  // packaged desktop app with a bare bundled Node) can still stage a root
89
53
  // update. `cacheDir` mirrors AddonInstaller's `<dataDir>/addons/.npm-bootstrap`.
90
54
  execNpm: options.execNpm ??
91
- (0, system_exec_npm_js_1.buildSystemExecNpm)({
55
+ buildSystemExecNpm({
92
56
  cacheDir: path.join(dataDir, 'addons', '.npm-bootstrap'),
93
57
  logger: options.logger,
94
58
  }),
95
59
  // Fetch a missing `better-sqlite3` prebuild for the running ABI before the
96
60
  // native-prebuild validator refuses the swap (toolchain-less packaged
97
61
  // desktop). No-op on docker where the install already carried it.
98
- ensureNativePrebuilds: options.ensureNativePrebuilds ?? (0, system_ensure_prebuilds_js_1.buildSystemEnsureNativePrebuilds)(options.logger),
62
+ ensureNativePrebuilds: options.ensureNativePrebuilds ?? buildSystemEnsureNativePrebuilds(options.logger),
99
63
  // Apply the closure patches ourselves. npm 12 blocks the root package's
100
64
  // postinstall by default, and a silently-unpatched closure is refused by
101
65
  // the validator — an update that can never apply. Idempotent, so this
102
66
  // costs nothing where npm did run the lifecycle.
103
- applyClosurePatches: options.applyClosurePatches ?? (0, system_apply_closure_patches_js_1.buildSystemApplyClosurePatches)(options.logger),
67
+ applyClosurePatches: options.applyClosurePatches ?? buildSystemApplyClosurePatches(options.logger),
104
68
  env: options.env,
105
69
  now: options.now,
106
70
  ...(options.updatePreflight !== undefined
@@ -112,7 +76,7 @@ class ServerUpdateService extends index_js_1.RootUpdateService {
112
76
  });
113
77
  this.updateAvailability =
114
78
  options.eventBus !== undefined
115
- ? new update_availability_emitter_js_1.UpdateAvailabilityEmitter(options.eventBus, { type: 'core', id: 'server-update-service' }, options.updateAvailabilityStore)
79
+ ? new UpdateAvailabilityEmitter(options.eventBus, { type: 'core', id: 'server-update-service' }, options.updateAvailabilityStore)
116
80
  : null;
117
81
  this.nodeId = nodeId;
118
82
  }
@@ -135,4 +99,3 @@ class ServerUpdateService extends index_js_1.RootUpdateService {
135
99
  return result;
136
100
  }
137
101
  }
138
- exports.ServerUpdateService = ServerUpdateService;
@@ -1,39 +1,3 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.buildSystemApplyClosurePatches = buildSystemApplyClosurePatches;
37
1
  /**
38
2
  * `buildSystemApplyClosurePatches` — run the root package's OWN shipped patch
39
3
  * applier inside a staged closure, without going through npm.
@@ -69,16 +33,16 @@ exports.buildSystemApplyClosurePatches = buildSystemApplyClosurePatches;
69
33
  * with `PATH=/usr/bin:/bin:/usr/sbin:/sbin`), so resolving `node` by name would
70
34
  * ENOENT on exactly the host this was written for.
71
35
  */
72
- const node_child_process_1 = require("node:child_process");
73
- const fs = __importStar(require("node:fs"));
74
- const path = __importStar(require("node:path"));
75
- const node_util_1 = require("node:util");
76
- const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
36
+ import { execFile } from 'node:child_process';
37
+ import * as fs from 'node:fs';
38
+ import * as path from 'node:path';
39
+ import { promisify } from 'node:util';
40
+ const execFileAsync = promisify(execFile);
77
41
  /** Where the published root package keeps its applier, inside a closure. */
78
42
  const APPLIER_REL = ['node_modules', '@camstack', 'server', 'scripts', 'closure-postinstall.mjs'];
79
43
  /** A patch pass must never be the slow part of an update. */
80
44
  const APPLY_TIMEOUT_MS = 60_000;
81
- function buildSystemApplyClosurePatches(logger) {
45
+ export function buildSystemApplyClosurePatches(logger) {
82
46
  return async (closureDir) => {
83
47
  const applier = path.join(closureDir, ...APPLIER_REL);
84
48
  if (!fs.existsSync(applier)) {
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildSystemEnsureNativePrebuilds = buildSystemEnsureNativePrebuilds;
4
1
  /**
5
2
  * `buildSystemEnsureNativePrebuilds` — the `@camstack/system`-backed
6
3
  * `ensureNativePrebuilds` adapter the shared `RootUpdateService` uses as its
@@ -14,9 +11,9 @@ exports.buildSystemEnsureNativePrebuilds = buildSystemEnsureNativePrebuilds;
14
11
  * already landed → a no-op); it only acts on a toolchain-less packaged desktop
15
12
  * whose `npm install` left `better-sqlite3` source-only.
16
13
  */
17
- const system_1 = require("@camstack/system");
18
- function buildSystemEnsureNativePrebuilds(logger) {
14
+ import { ensureNativePrebuilds } from '@camstack/system';
15
+ export function buildSystemEnsureNativePrebuilds(logger) {
19
16
  return async (closureDir) => {
20
- await (0, system_1.ensureNativePrebuilds)(closureDir, { logger });
17
+ await ensureNativePrebuilds(closureDir, { logger });
21
18
  };
22
19
  }
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildSystemExecNpm = buildSystemExecNpm;
4
1
  /**
5
2
  * `buildSystemExecNpm` — the runNpm-backed `execNpm` the shared
6
3
  * `RootUpdateService` uses to shell out to npm when staging a root-package
@@ -18,8 +15,8 @@ exports.buildSystemExecNpm = buildSystemExecNpm;
18
15
  * `runNpmFn` is a module-level DI seam (defaults to the real `runNpm`) so the
19
16
  * arg/cwd/timeout mapping is unit-testable without touching the network.
20
17
  */
21
- const system_1 = require("@camstack/system");
22
- function buildSystemExecNpm(options, runNpmFn = system_1.runNpm) {
18
+ import { runNpm } from '@camstack/system';
19
+ export function buildSystemExecNpm(options, runNpmFn = runNpm) {
23
20
  return async (args, opts) => {
24
21
  const { stdout } = await runNpmFn(args, {
25
22
  cacheDir: options.cacheDir,
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FsStorageBackend = void 0;
4
1
  // Re-export from @camstack/system
5
- var system_1 = require("@camstack/system");
6
- Object.defineProperty(exports, "FsStorageBackend", { enumerable: true, get: function () { return system_1.FsStorageBackend; } });
2
+ export { FsStorageBackend } from '@camstack/system';
@@ -1,6 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StorageLocationManager = void 0;
4
1
  // Re-export from @camstack/system
5
- var system_1 = require("@camstack/system");
6
- Object.defineProperty(exports, "StorageLocationManager", { enumerable: true, get: function () { return system_1.StorageLocationManager; } });
2
+ export { StorageLocationManager } from '@camstack/system';
@@ -1,7 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StorageService = void 0;
4
- const system_1 = require("@camstack/system");
5
- class StorageService extends system_1.StorageManager {
1
+ import { StorageManager } from '@camstack/system';
2
+ export class StorageService extends StorageManager {
6
3
  }
7
- exports.StorageService = StorageService;
@@ -1,8 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.buildStreamProbeArgs = buildStreamProbeArgs;
4
- exports.probeFoundAStream = probeFoundAStream;
5
- exports.parseFfmpegStreamInfo = parseFfmpegStreamInfo;
6
1
  /** How long the probe waits on a network input, in µs (ffmpeg's unit). */
7
2
  const PROBE_INPUT_TIMEOUT_US = '5000000';
8
3
  /**
@@ -14,7 +9,7 @@ const PROBE_INPUT_TIMEOUT_US = '5000000';
14
9
  * `-timeout` is an http and rtsp option, is unknown to a file, and on rtmp
15
10
  * would mean LISTEN mode. So each scheme gets exactly what it consumes.
16
11
  */
17
- function buildStreamProbeArgs(url) {
12
+ export function buildStreamProbeArgs(url) {
18
13
  const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(url)?.[1]?.toLowerCase() ?? '';
19
14
  const input = [];
20
15
  if (scheme === 'rtsp' || scheme === 'rtsps') {
@@ -26,7 +21,7 @@ function buildStreamProbeArgs(url) {
26
21
  return ['-hide_banner', '-nostdin', ...input, '-i', url];
27
22
  }
28
23
  /** Did the probe find anything at all? An empty result is a failed probe. */
29
- function probeFoundAStream(meta) {
24
+ export function probeFoundAStream(meta) {
30
25
  return meta.codec !== undefined || meta.audio !== undefined;
31
26
  }
32
27
  /** Codec aliases normalised to canonical names. */
@@ -120,7 +115,7 @@ function readAudio(body) {
120
115
  return audio;
121
116
  }
122
117
  /** The FIRST video and FIRST audio stream of `ffmpeg -i`'s report. */
123
- function parseFfmpegStreamInfo(stderr) {
118
+ export function parseFfmpegStreamInfo(stderr) {
124
119
  const meta = {};
125
120
  // CRLF too: `(.*)$` cannot cross a `\r`, and a Windows build or a captured
126
121
  // log hands one over.
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StreamProbeService = void 0;
4
- const child_process_1 = require("child_process");
5
- const ttl_cache_1 = require("./ttl-cache");
6
- const types_1 = require("@camstack/types");
7
- const ffmpeg_stream_info_1 = require("./ffmpeg-stream-info");
1
+ import { execFile } from 'child_process';
2
+ import { TtlCache } from './ttl-cache';
3
+ import { errMsg } from '@camstack/types';
4
+ import { buildStreamProbeArgs, parseFfmpegStreamInfo, probeFoundAStream, } from './ffmpeg-stream-info';
8
5
  const CACHE_TTL_MS = 3_600_000; // 1 hour
9
6
  const PROBE_TIMEOUT_MS = 5_000;
10
7
  /**
@@ -22,7 +19,7 @@ const CACHE_MAX_ENTRIES = 512;
22
19
  function redactUrl(text) {
23
20
  return text.replace(/\/\/[^@/\s]*@/g, '//***@');
24
21
  }
25
- class StreamProbeService {
22
+ export class StreamProbeService {
26
23
  resolveFfmpeg;
27
24
  logger;
28
25
  /**
@@ -32,7 +29,7 @@ class StreamProbeService {
32
29
  * was probed again — so an entry nobody asked about a second time was never
33
30
  * found expired and never removed. See {@link TtlCache}.
34
31
  */
35
- cache = new ttl_cache_1.TtlCache({
32
+ cache = new TtlCache({
36
33
  ttlMs: CACHE_TTL_MS,
37
34
  maxEntries: CACHE_MAX_ENTRIES,
38
35
  });
@@ -57,7 +54,7 @@ class StreamProbeService {
57
54
  // Only an ANSWER is cached. An empty result is a probe that failed (no
58
55
  // binary, a timeout, a refused dial), and caching it for an hour made one
59
56
  // bad moment the answer for an hour.
60
- if ((0, ffmpeg_stream_info_1.probeFoundAStream)(metadata))
57
+ if (probeFoundAStream(metadata))
61
58
  this.cache.set(url, metadata);
62
59
  return metadata;
63
60
  }
@@ -124,7 +121,7 @@ class StreamProbeService {
124
121
  // We aborted intentionally after reading headers — that's success
125
122
  return { status: 'ok', labels: ['Reachable'] };
126
123
  }
127
- const msg = (0, types_1.errMsg)(err);
124
+ const msg = errMsg(err);
128
125
  return { status: 'error', error: `Unreachable: ${msg}` };
129
126
  }
130
127
  }
@@ -149,7 +146,7 @@ class StreamProbeService {
149
146
  }
150
147
  catch (err) {
151
148
  this.logger.error('stream probe refused — no pinned ffmpeg on this node (D540)', {
152
- meta: { url: redactUrl(url), error: (0, types_1.errMsg)(err) },
149
+ meta: { url: redactUrl(url), error: errMsg(err) },
153
150
  });
154
151
  return {};
155
152
  }
@@ -157,10 +154,10 @@ class StreamProbeService {
157
154
  // exits non-zero for want of an output. That exit is the expected one, so
158
155
  // the report is read whatever the code; an empty report is the failure.
159
156
  const stderr = await new Promise((resolve) => {
160
- (0, child_process_1.execFile)(ffmpeg, (0, ffmpeg_stream_info_1.buildStreamProbeArgs)(url), { timeout: PROBE_TIMEOUT_MS, encoding: 'utf8' }, (_err, _stdout, errText) => resolve(errText));
157
+ execFile(ffmpeg, buildStreamProbeArgs(url), { timeout: PROBE_TIMEOUT_MS, encoding: 'utf8' }, (_err, _stdout, errText) => resolve(errText));
161
158
  });
162
- const metadata = (0, ffmpeg_stream_info_1.parseFfmpegStreamInfo)(stderr);
163
- if (!(0, ffmpeg_stream_info_1.probeFoundAStream)(metadata)) {
159
+ const metadata = parseFfmpegStreamInfo(stderr);
160
+ if (!probeFoundAStream(metadata)) {
164
161
  this.logger.error('stream probe found no stream', {
165
162
  meta: { url: redactUrl(url), stderr: redactUrl(stderr.trim().slice(-500)) },
166
163
  });
@@ -168,4 +165,3 @@ class StreamProbeService {
168
165
  return metadata;
169
166
  }
170
167
  }
171
- exports.StreamProbeService = StreamProbeService;
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TtlCache = void 0;
4
- class TtlCache {
1
+ export class TtlCache {
5
2
  entries = new Map();
6
3
  ttlMs;
7
4
  maxEntries;
@@ -69,4 +66,3 @@ class TtlCache {
69
66
  }
70
67
  }
71
68
  }
72
- exports.TtlCache = TtlCache;