@camstack/server 1.2.593 → 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 +218 -222
  103. package/dist/api/trpc/generated-cap-routers.js +4688 -4850
  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 +199 -185
  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,4 +1,3 @@
1
- "use strict";
2
1
  /**
3
2
  * Boot — constructs every service by hand in dependency order, runs
4
3
  * `onModuleInit` hooks in sequence, and exposes a `BootedApp` facade
@@ -6,85 +5,47 @@
6
5
  * removed to drop the accidental DI layer on top of an already-explicit
7
6
  * dependency graph.
8
7
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || (function () {
26
- var ownKeys = function(o) {
27
- ownKeys = Object.getOwnPropertyNames || function (o) {
28
- var ar = [];
29
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
- return ar;
31
- };
32
- return ownKeys(o);
33
- };
34
- return function (mod) {
35
- if (mod && mod.__esModule) return mod;
36
- var result = {};
37
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
- __setModuleDefault(result, mod);
39
- return result;
40
- };
41
- })();
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- exports.bootManual = bootManual;
47
- const node_crypto_1 = require("node:crypto");
48
- const path = __importStar(require("node:path"));
49
- const system_1 = require("@camstack/system");
50
- const types_1 = require("@camstack/types");
51
- const fastify_1 = __importDefault(require("fastify"));
52
- const addon_upload_1 = require("./api/addon-upload");
53
- const cap_providers_1 = require("./api/core/cap-providers");
54
- const hub_cluster_url_1 = require("./api/hub-cluster-url");
55
- const init_sequence_1 = require("./boot/init-sequence");
56
- const post_boot_service_1 = require("./boot/post-boot.service");
57
- const addon_package_service_1 = require("./core/addon/addon-package.service");
58
- const addon_registry_service_1 = require("./core/addon/addon-registry.service");
59
- const addon_search_service_1 = require("./core/addon/addon-search.service");
60
- const addon_bridge_service_1 = require("./core/addon-bridge/addon-bridge.service");
61
- const addon_pages_service_1 = require("./core/addon-pages/addon-pages.service");
62
- const addon_widgets_service_1 = require("./core/addon-widgets/addon-widgets.service");
63
- const agent_registry_service_1 = require("./core/agent/agent-registry.service");
64
- const cluster_node_history_store_1 = require("./core/agent/cluster-node-history-store");
65
- const auth_service_1 = require("./core/auth/auth.service");
66
- const capability_service_1 = require("./core/capability/capability.service");
67
- const config_service_1 = require("./core/config/config.service");
68
- const event_bus_service_1 = require("./core/events/event-bus.service");
69
- const feature_service_1 = require("./core/feature/feature.service");
70
- const lifecycle_runner_singleton_1 = require("./core/lifecycle/lifecycle-runner.singleton");
71
- const logging_service_1 = require("./core/logging/logging.service");
72
- const moleculer_service_1 = require("./core/moleculer/moleculer.service");
73
- const network_quality_service_1 = require("./core/network/network-quality.service");
74
- const notification_wrapper_service_1 = require("./core/notification/notification-wrapper.service");
75
- const toast_wrapper_service_1 = require("./core/notification/toast-wrapper.service");
76
- const repl_engine_service_1 = require("./core/repl/repl-engine.service");
77
- const server_update_service_1 = require("./core/server-update/server-update.service");
78
- const runner_boot_check_1 = require("./core/runner-health/runner-boot-check");
79
- const update_preflight_1 = require("./core/runner-health/update-preflight");
80
- const storage_service_1 = require("./core/storage/storage.service");
81
- const stream_probe_service_1 = require("./core/streaming/stream-probe.service");
82
- const topology_emitter_service_1 = require("./core/topology/topology-emitter.service");
83
- const update_availability_emitter_js_1 = require("./core/update-availability-emitter.js");
84
- const update_availability_store_js_1 = require("./core/update-availability-store.js");
85
- const agent_installed_packages_js_1 = require("./core/updates/agent-installed-packages.js");
86
- const update_check_scheduler_js_1 = require("./core/updates/update-check-scheduler.js");
87
- const wrapper_update_checker_js_1 = require("./core/updates/wrapper-update-checker.js");
8
+ import { randomUUID } from 'node:crypto';
9
+ import * as path from 'node:path';
10
+ import { AddonDepsManager, ConsoleDestination } from '@camstack/system';
11
+ import { EventCategory, memoizePinnedFfmpeg, ServerPackageStatusSchema } from '@camstack/types';
12
+ import Fastify from 'fastify';
13
+ import { buildHubHttpSource } from './api/addon-upload';
14
+ import { createNodeRootPackageLookup } from './api/core/cap-providers';
15
+ import { clusterBaseUrlResolver } from './api/hub-cluster-url';
16
+ import { runBootInitSequence } from './boot/init-sequence';
17
+ import { PostBootService } from './boot/post-boot.service';
18
+ import { AddonPackageService } from './core/addon/addon-package.service';
19
+ import { AddonRegistryService } from './core/addon/addon-registry.service';
20
+ import { AddonSearchService } from './core/addon/addon-search.service';
21
+ import { AddonBridgeService } from './core/addon-bridge/addon-bridge.service';
22
+ import { AddonPagesService } from './core/addon-pages/addon-pages.service';
23
+ import { AddonWidgetsService } from './core/addon-widgets/addon-widgets.service';
24
+ import { AGENT_BACKFILL_RPC_TIMEOUT_MS, AgentRegistryService, } from './core/agent/agent-registry.service';
25
+ import { ClusterNodeHistoryStore } from './core/agent/cluster-node-history-store';
26
+ import { AuthService } from './core/auth/auth.service';
27
+ import { CapabilityService } from './core/capability/capability.service';
28
+ import { ConfigService } from './core/config/config.service';
29
+ import { EventBusService } from './core/events/event-bus.service';
30
+ import { FeatureService } from './core/feature/feature.service';
31
+ import { initLifecycleRunner } from './core/lifecycle/lifecycle-runner.singleton';
32
+ import { LoggingService } from './core/logging/logging.service';
33
+ import { MoleculerService } from './core/moleculer/moleculer.service';
34
+ import { NetworkQualityService } from './core/network/network-quality.service';
35
+ import { NotificationServiceWrapper } from './core/notification/notification-wrapper.service';
36
+ import { ToastServiceWrapper } from './core/notification/toast-wrapper.service';
37
+ import { ReplEngineService } from './core/repl/repl-engine.service';
38
+ import { ServerUpdateService } from './core/server-update/server-update.service';
39
+ import { describeRunnerBootCheck, isRunnerBootCheckDegraded, RunnerBootCheckService, } from './core/runner-health/runner-boot-check';
40
+ import { buildUpdatePreflight, legacyGuardClientOf } from './core/runner-health/update-preflight';
41
+ import { StorageService } from './core/storage/storage.service';
42
+ import { StreamProbeService } from './core/streaming/stream-probe.service';
43
+ import { TopologyEmitterService } from './core/topology/topology-emitter.service';
44
+ import { UpdateAvailabilityEmitter } from './core/update-availability-emitter.js';
45
+ import { FileUpdateAvailabilityStore } from './core/update-availability-store.js';
46
+ import { fetchAgentInstalledPackages, } from './core/updates/agent-installed-packages.js';
47
+ import { UpdateCheckScheduler } from './core/updates/update-check-scheduler.js';
48
+ import { WrapperUpdateChecker } from './core/updates/wrapper-update-checker.js';
88
49
  // ---------------------------------------------------------------------------
89
50
  // Service container — narrowing via `instanceof`, no casts.
90
51
  // ---------------------------------------------------------------------------
@@ -107,18 +68,18 @@ class ServiceContainer {
107
68
  // ---------------------------------------------------------------------------
108
69
  // Manual boot
109
70
  // ---------------------------------------------------------------------------
110
- async function bootManual(opts) {
71
+ export async function bootManual(opts) {
111
72
  const { infra, fastifyOpts } = opts;
112
73
  void infra; // infraContext is consumed by main.ts directly (locationManager, etc.)
113
74
  const configPath = process.env.CONFIG_PATH ?? 'camstack-data/config.yaml';
114
75
  // ---- Layer 0: services with no service deps -----------------------------
115
- const configService = new config_service_1.ConfigService(configPath);
116
- const storageService = new storage_service_1.StorageService();
117
- const capabilityService = new capability_service_1.CapabilityService();
118
- const networkQualityService = new network_quality_service_1.NetworkQualityService();
119
- const toastWrapper = new toast_wrapper_service_1.ToastServiceWrapper();
76
+ const configService = new ConfigService(configPath);
77
+ const storageService = new StorageService();
78
+ const capabilityService = new CapabilityService();
79
+ const networkQualityService = new NetworkQualityService();
80
+ const toastWrapper = new ToastServiceWrapper();
120
81
  // ---- Layer 1: need ConfigService / LoggingService -----------------------
121
- const loggingService = new logging_service_1.LoggingService(configService);
82
+ const loggingService = new LoggingService(configService);
122
83
  // Bootstrap stdout, attached at the FIRST moment a LogManager exists.
123
84
  //
124
85
  // The real console destination is a core builtin that boots in pass 3, after
@@ -127,10 +88,10 @@ async function bootManual(opts) {
127
88
  // investigation needed a parser (docs/design/boot-to-usable-camera.md, F).
128
89
  // This sink carries the window and is detached — without a second flush —
129
90
  // the moment `console-logging` registers.
130
- const bootstrapConsole = new system_1.ConsoleDestination();
91
+ const bootstrapConsole = new ConsoleDestination();
131
92
  void bootstrapConsole.initialize();
132
93
  loggingService.attachBootstrapConsole(bootstrapConsole);
133
- const eventBusService = new event_bus_service_1.EventBusService(configService);
94
+ const eventBusService = new EventBusService(configService);
134
95
  // Wire device-name cache for log formatter — subscribes here so the
135
96
  // very first DeviceRegistered event populates the cache before any
136
97
  // log line needing `deviceName` is emitted.
@@ -140,22 +101,22 @@ async function bootManual(opts) {
140
101
  // the disabled set), so console/winston could not be turned off at all while
141
102
  // Loki appeared to work only through a second, private `enabled` setting.
142
103
  loggingService.setDestinationEnabledCheck((addonId) => capabilityService.getRegistry()?.isProviderDisabled('log-destination', addonId) !== true);
143
- const featureService = new feature_service_1.FeatureService(configService);
144
- const authService = new auth_service_1.AuthService(configService);
104
+ const featureService = new FeatureService(configService);
105
+ const authService = new AuthService(configService);
145
106
  // The probe runs the node's PINNED ffmpeg (D540) — resolved through the same
146
107
  // deps manager every addon is given, once, and never looked up on PATH.
147
108
  // (The manager roots binaries at the NODE's data dir whatever it is given.)
148
- const probeDeps = new system_1.AddonDepsManager(path.resolve(process.env['CAMSTACK_DATA'] ?? 'camstack-data'), loggingService.createLogger('StreamProbeDeps'));
149
- const streamProbeService = new stream_probe_service_1.StreamProbeService(loggingService, (0, types_1.memoizePinnedFfmpeg)(() => probeDeps.ensureFfmpeg()));
150
- const addonBridgeService = new addon_bridge_service_1.AddonBridgeService(loggingService);
151
- const addonSearchService = new addon_search_service_1.AddonSearchService(loggingService);
109
+ const probeDeps = new AddonDepsManager(path.resolve(process.env['CAMSTACK_DATA'] ?? 'camstack-data'), loggingService.createLogger('StreamProbeDeps'));
110
+ const streamProbeService = new StreamProbeService(loggingService, memoizePinnedFfmpeg(() => probeDeps.ensureFfmpeg()));
111
+ const addonBridgeService = new AddonBridgeService(loggingService);
112
+ const addonSearchService = new AddonSearchService(loggingService);
152
113
  // ---- Layer 2: need Layer 0/1 -------------------------------------------
153
- const notificationWrapper = new notification_wrapper_service_1.NotificationServiceWrapper(capabilityService, loggingService);
154
- const addonPagesService = new addon_pages_service_1.AddonPagesService(loggingService, configService, capabilityService);
155
- const moleculerService = new moleculer_service_1.MoleculerService(eventBusService, configService, loggingService, capabilityService, streamProbeService);
114
+ const notificationWrapper = new NotificationServiceWrapper(capabilityService, loggingService);
115
+ const addonPagesService = new AddonPagesService(loggingService, configService, capabilityService);
116
+ const moleculerService = new MoleculerService(eventBusService, configService, loggingService, capabilityService, streamProbeService);
156
117
  // ---- Layer 3: need Moleculer / AddonRegistry ---------------------------
157
- const agentRegistryService = new agent_registry_service_1.AgentRegistryService(eventBusService, moleculerService, capabilityService);
158
- const addonRegistryService = new addon_registry_service_1.AddonRegistryService(loggingService, eventBusService, configService, storageService, capabilityService, moleculerService, streamProbeService);
118
+ const agentRegistryService = new AgentRegistryService(eventBusService, moleculerService, capabilityService);
119
+ const addonRegistryService = new AddonRegistryService(loggingService, eventBusService, configService, storageService, capabilityService, moleculerService, streamProbeService);
159
120
  // AgentRegistryService needs the hub addon registry for placement-based
160
121
  // reconciliation, but is constructed first (it has no other dependency
161
122
  // on AddonRegistryService) — wire it post-construction.
@@ -166,16 +127,18 @@ async function bootManual(opts) {
166
127
  // A1: durable, routing-blind offline-node history — persisted through the
167
128
  // hub-resident `settings-store` cap (resolved lazily; null until it boots).
168
129
  // Wired post-construction so the service's 3-arg constructor stays intact.
169
- agentRegistryService.setClusterNodeHistoryStore(new cluster_node_history_store_1.ClusterNodeHistoryStore(() => capabilityService.getRegistry()?.getSingleton('settings-store') ??
170
- null, loggingService.createLogger('cluster-node-history')));
130
+ const clusterNodeHistoryStore = new ClusterNodeHistoryStore(() => capabilityService.getRegistry()?.getSingleton('settings-store') ??
131
+ null, loggingService.createLogger('cluster-node-history'));
132
+ agentRegistryService.setClusterNodeHistoryStore(clusterNodeHistoryStore);
133
+ addonRegistryService.setClusterNodeHistoryStore(clusterNodeHistoryStore);
171
134
  // ---- Layer 4: need AddonRegistry ---------------------------------------
172
135
  // AddonWidgetsService — needs AddonRegistryService for the bundled-addon
173
136
  // dist sub-folder lookup (see service docstring).
174
- const addonWidgetsService = new addon_widgets_service_1.AddonWidgetsService(loggingService, capabilityService, addonRegistryService);
137
+ const addonWidgetsService = new AddonWidgetsService(loggingService, capabilityService, addonRegistryService);
175
138
  // Durable `update.available` dedup lives next to `auto-update.json`, so a
176
139
  // hub restart never re-announces what the operator already saw.
177
140
  const availabilityDataDir = path.resolve(process.env['CAMSTACK_DATA'] ?? 'camstack-data');
178
- const addonPackageService = new addon_package_service_1.AddonPackageService(loggingService, eventBusService, configService, addonRegistryService, notificationWrapper, toastWrapper, new update_availability_store_js_1.FileUpdateAvailabilityStore(availabilityDataDir, 'addon-packages', loggingService.createLogger('UpdateAvailability')));
141
+ const addonPackageService = new AddonPackageService(loggingService, eventBusService, configService, addonRegistryService, notificationWrapper, toastWrapper, new FileUpdateAvailabilityStore(availabilityDataDir, 'addon-packages', loggingService.createLogger('UpdateAvailability')));
179
142
  // Addon back-fill delivery seam. Wired here (not in the AgentRegistryService
180
143
  // constructor) because it needs AddonPackageService, which is a later layer.
181
144
  // Bytes come from THE HUB'S OWN INSTALLED COPY whenever it has one, and only
@@ -189,7 +152,7 @@ async function bootManual(opts) {
189
152
  const backfillLogger = loggingService.createLogger('agent-backfill');
190
153
  // Where the agent pulls the bundle from: the hub's own cluster address, from
191
154
  // the `local-network` cap — never an env var, never loopback.
192
- const resolveClusterBaseUrl = (0, hub_cluster_url_1.clusterBaseUrlResolver)(() => addonRegistryService
155
+ const resolveClusterBaseUrl = clusterBaseUrlResolver(() => addonRegistryService
193
156
  .getCapabilityRegistry()
194
157
  .getSingleton('local-network'));
195
158
  agentRegistryService.setAddonBackfill({
@@ -208,10 +171,10 @@ async function bootManual(opts) {
208
171
  return (installed ?? (await addonPackageService.packPackage(name, version))).buffer;
209
172
  },
210
173
  deploy: async (nodeId, packageName, bundle) => {
211
- await moleculerService.broker.call('$agent.deploy', { addonId: packageName, source: (0, addon_upload_1.buildHubHttpSource)(bundle, await resolveClusterBaseUrl()) }, { nodeID: nodeId, timeout: agent_registry_service_1.AGENT_BACKFILL_RPC_TIMEOUT_MS });
174
+ await moleculerService.broker.call('$agent.deploy', { addonId: packageName, source: buildHubHttpSource(bundle, await resolveClusterBaseUrl()) }, { nodeID: nodeId, timeout: AGENT_BACKFILL_RPC_TIMEOUT_MS });
212
175
  },
213
176
  reload: async (nodeId) => {
214
- await moleculerService.broker.call('$agent.reload', {}, { nodeID: nodeId, timeout: agent_registry_service_1.AGENT_BACKFILL_RPC_TIMEOUT_MS });
177
+ await moleculerService.broker.call('$agent.reload', {}, { nodeID: nodeId, timeout: AGENT_BACKFILL_RPC_TIMEOUT_MS });
215
178
  },
216
179
  });
217
180
  // ---- Lifecycle job runner (boot singleton) -----------------------------
@@ -221,7 +184,7 @@ async function bootManual(opts) {
221
184
  // it ONCE here from the addon-package service + event bus. `createdBy` is no
222
185
  // longer a construction dep — it travels on each `startJob` call.
223
186
  const lifecycleDataDir = path.resolve(process.env['CAMSTACK_DATA'] ?? 'camstack-data');
224
- (0, lifecycle_runner_singleton_1.initLifecycleRunner)({
187
+ initLifecycleRunner({
225
188
  dataDir: lifecycleDataDir,
226
189
  fetchTarball: (name, version, signal) => addonPackageService.fetchAddonTarball(name, version, signal),
227
190
  extract: (tgz, destDir) => addonPackageService.extractTarball(tgz, destDir),
@@ -231,31 +194,31 @@ async function bootManual(opts) {
231
194
  emit: (kind, job, entry) => {
232
195
  if (kind === 'progress') {
233
196
  eventBusService.emit({
234
- id: (0, node_crypto_1.randomUUID)(),
197
+ id: randomUUID(),
235
198
  timestamp: new Date(),
236
199
  source: { type: 'core', id: 'lifecycle-job-engine' },
237
- category: types_1.EventCategory.AddonsJobProgress,
200
+ category: EventCategory.AddonsJobProgress,
238
201
  data: { job },
239
202
  });
240
203
  }
241
204
  else {
242
205
  eventBusService.emit({
243
- id: (0, node_crypto_1.randomUUID)(),
206
+ id: randomUUID(),
244
207
  timestamp: new Date(),
245
208
  source: { type: 'core', id: 'lifecycle-job-engine' },
246
- category: types_1.EventCategory.AddonsJobLog,
209
+ category: EventCategory.AddonsJobLog,
247
210
  data: { jobId: job.jobId, entry },
248
211
  });
249
212
  }
250
213
  },
251
214
  });
252
- const replEngineService = new repl_engine_service_1.ReplEngineService(addonRegistryService, eventBusService, loggingService);
215
+ const replEngineService = new ReplEngineService(addonRegistryService, eventBusService, loggingService);
253
216
  // Runtime-updatable root package (phase 1: hub only). The service owns the
254
217
  // data-dir server-root staging/rollback lifecycle; restarts route through
255
218
  // AddonPackageService.restartServer for the marker + reconnect toast.
256
219
  // D877: the runner boot check (one-shot after boot, scheduled by main.ts) and
257
220
  // the update pre-flight (would the target refuse addons on the live store?).
258
- const hubRunnerBootCheck = new runner_boot_check_1.RunnerBootCheckService({
221
+ const hubRunnerBootCheck = new RunnerBootCheckService({
259
222
  logger: loggingService.createLogger('RunnerBootCheck'),
260
223
  nodeId: 'hub',
261
224
  planned: () => addonRegistryService.plannedRunnerIds(),
@@ -268,14 +231,14 @@ async function bootManual(opts) {
268
231
  // The verdict reaches the alert centre (one alert + the direct critical push).
269
232
  onResult: (check) => {
270
233
  eventBusService.emit({
271
- id: (0, node_crypto_1.randomUUID)(),
234
+ id: randomUUID(),
272
235
  timestamp: new Date(),
273
236
  source: { type: 'core', id: 'runner-boot-check' },
274
- category: types_1.EventCategory.SystemRunnerCheck,
237
+ category: EventCategory.SystemRunnerCheck,
275
238
  data: {
276
239
  nodeId: 'hub',
277
- degraded: (0, runner_boot_check_1.isRunnerBootCheckDegraded)(check),
278
- summary: (0, runner_boot_check_1.describeRunnerBootCheck)(check),
240
+ degraded: isRunnerBootCheckDegraded(check),
241
+ summary: describeRunnerBootCheck(check),
279
242
  expected: check.expected,
280
243
  running: check.running,
281
244
  failed: [...check.failed],
@@ -286,23 +249,23 @@ async function bootManual(opts) {
286
249
  },
287
250
  });
288
251
  const settingsStoreOrNull = () => capabilityService.getRegistry()?.getSingleton('settings-store') ?? null;
289
- const serverUpdateService = new server_update_service_1.ServerUpdateService({
290
- updatePreflight: (0, update_preflight_1.buildUpdatePreflight)({
252
+ const serverUpdateService = new ServerUpdateService({
253
+ updatePreflight: buildUpdatePreflight({
291
254
  logger: loggingService.createLogger('UpdatePreflight'),
292
255
  forkedAddonIds: () => addonRegistryService.forkedAddonIds(),
293
256
  store: () => {
294
257
  const store = settingsStoreOrNull();
295
- return store === null ? null : (0, update_preflight_1.legacyGuardClientOf)(store);
258
+ return store === null ? null : legacyGuardClientOf(store);
296
259
  },
297
260
  }),
298
261
  runnerBootCheck: () => hubRunnerBootCheck.current(),
299
262
  logger: loggingService.createLogger('ServerUpdate'),
300
263
  restartServer: (requestedBy, update) => addonPackageService.restartServer(requestedBy, update),
301
264
  eventBus: eventBusService,
302
- updateAvailabilityStore: new update_availability_store_js_1.FileUpdateAvailabilityStore(availabilityDataDir, 'server-update', loggingService.createLogger('UpdateAvailability')),
265
+ updateAvailabilityStore: new FileUpdateAvailabilityStore(availabilityDataDir, 'server-update', loggingService.createLogger('UpdateAvailability')),
303
266
  });
304
- const topologyEmitterService = new topology_emitter_service_1.TopologyEmitterService(eventBusService, agentRegistryService, addonRegistryService, (0, cap_providers_1.createNodeRootPackageLookup)(moleculerService, serverUpdateService), (nodeId) => moleculerService.isNodeRegistered(nodeId));
305
- const postBootService = new post_boot_service_1.PostBootService(addonRegistryService, eventBusService, loggingService);
267
+ const topologyEmitterService = new TopologyEmitterService(eventBusService, agentRegistryService, addonRegistryService, createNodeRootPackageLookup(moleculerService, serverUpdateService), (nodeId) => moleculerService.isNodeRegistered(nodeId));
268
+ const postBootService = new PostBootService(addonRegistryService, eventBusService, loggingService);
306
269
  // ---- Update availability poller ---------------------------------------
307
270
  // "Tell me, don't install." Deliberately NOT gated on the auto-update
308
271
  // channel — that gate is why the only periodic publisher was dead on every
@@ -311,9 +274,9 @@ async function bootManual(opts) {
311
274
  // The fifth target: the SHELL each node runs inside. Its own emitter scope,
312
275
  // so a shell announcement and a code announcement never overwrite each
313
276
  // other's dedup state — they are different facts about the same node (D437).
314
- const wrapperUpdateChecker = new wrapper_update_checker_js_1.WrapperUpdateChecker({
277
+ const wrapperUpdateChecker = new WrapperUpdateChecker({
315
278
  logger: updateCheckLogger,
316
- emitter: new update_availability_emitter_js_1.UpdateAvailabilityEmitter(eventBusService, { type: 'core', id: 'wrapper-update-check' }, new update_availability_store_js_1.FileUpdateAvailabilityStore(availabilityDataDir, 'wrapper-update', loggingService.createLogger('UpdateAvailability'))),
279
+ emitter: new UpdateAvailabilityEmitter(eventBusService, { type: 'core', id: 'wrapper-update-check' }, new FileUpdateAvailabilityStore(availabilityDataDir, 'wrapper-update', loggingService.createLogger('UpdateAvailability'))),
317
280
  readStatus: async (nodeId, isHub) => {
318
281
  if (isHub)
319
282
  return serverUpdateService.getServerPackageStatus();
@@ -324,10 +287,10 @@ async function bootManual(opts) {
324
287
  throw new Error(`server-management unreachable on ${nodeId}`);
325
288
  }
326
289
  const status = await proxy['getServerPackageStatus']?.({});
327
- return types_1.ServerPackageStatusSchema.parse(status);
290
+ return ServerPackageStatusSchema.parse(status);
328
291
  },
329
292
  });
330
- const updateCheckScheduler = new update_check_scheduler_js_1.UpdateCheckScheduler({
293
+ const updateCheckScheduler = new UpdateCheckScheduler({
331
294
  logger: updateCheckLogger,
332
295
  getIntervalSeconds: () => addonPackageService.getAutoUpdateSettings().updateCheckIntervalSeconds,
333
296
  targets: {
@@ -336,7 +299,7 @@ async function bootManual(opts) {
336
299
  checkFrameworkPackages: () => addonPackageService.listFrameworkPackages(),
337
300
  checkAgentAddons: async (nodeId) => {
338
301
  const broker = moleculerService.broker;
339
- const installed = await (0, agent_installed_packages_js_1.fetchAgentInstalledPackages)(broker, nodeId);
302
+ const installed = await fetchAgentInstalledPackages(broker, nodeId);
340
303
  return addonPackageService.checkUpdatesForInstalled(installed, nodeId);
341
304
  },
342
305
  checkNodeServerUpdate: async (nodeId, isHub) => {
@@ -360,36 +323,36 @@ async function bootManual(opts) {
360
323
  updateCheckScheduler.start();
361
324
  // ---- Container ---------------------------------------------------------
362
325
  const container = new ServiceContainer();
363
- container.register(config_service_1.ConfigService, configService);
364
- container.register(logging_service_1.LoggingService, loggingService);
365
- container.register(event_bus_service_1.EventBusService, eventBusService);
366
- container.register(storage_service_1.StorageService, storageService);
367
- container.register(capability_service_1.CapabilityService, capabilityService);
368
- container.register(feature_service_1.FeatureService, featureService);
369
- container.register(auth_service_1.AuthService, authService);
370
- container.register(stream_probe_service_1.StreamProbeService, streamProbeService);
371
- container.register(network_quality_service_1.NetworkQualityService, networkQualityService);
372
- container.register(toast_wrapper_service_1.ToastServiceWrapper, toastWrapper);
373
- container.register(notification_wrapper_service_1.NotificationServiceWrapper, notificationWrapper);
374
- container.register(addon_pages_service_1.AddonPagesService, addonPagesService);
375
- container.register(addon_widgets_service_1.AddonWidgetsService, addonWidgetsService);
376
- container.register(addon_bridge_service_1.AddonBridgeService, addonBridgeService);
377
- container.register(moleculer_service_1.MoleculerService, moleculerService);
378
- container.register(agent_registry_service_1.AgentRegistryService, agentRegistryService);
379
- container.register(addon_registry_service_1.AddonRegistryService, addonRegistryService);
380
- container.register(addon_search_service_1.AddonSearchService, addonSearchService);
381
- container.register(addon_package_service_1.AddonPackageService, addonPackageService);
382
- container.register(repl_engine_service_1.ReplEngineService, replEngineService);
383
- container.register(server_update_service_1.ServerUpdateService, serverUpdateService);
384
- container.register(runner_boot_check_1.RunnerBootCheckService, hubRunnerBootCheck);
326
+ container.register(ConfigService, configService);
327
+ container.register(LoggingService, loggingService);
328
+ container.register(EventBusService, eventBusService);
329
+ container.register(StorageService, storageService);
330
+ container.register(CapabilityService, capabilityService);
331
+ container.register(FeatureService, featureService);
332
+ container.register(AuthService, authService);
333
+ container.register(StreamProbeService, streamProbeService);
334
+ container.register(NetworkQualityService, networkQualityService);
335
+ container.register(ToastServiceWrapper, toastWrapper);
336
+ container.register(NotificationServiceWrapper, notificationWrapper);
337
+ container.register(AddonPagesService, addonPagesService);
338
+ container.register(AddonWidgetsService, addonWidgetsService);
339
+ container.register(AddonBridgeService, addonBridgeService);
340
+ container.register(MoleculerService, moleculerService);
341
+ container.register(AgentRegistryService, agentRegistryService);
342
+ container.register(AddonRegistryService, addonRegistryService);
343
+ container.register(AddonSearchService, addonSearchService);
344
+ container.register(AddonPackageService, addonPackageService);
345
+ container.register(ReplEngineService, replEngineService);
346
+ container.register(ServerUpdateService, serverUpdateService);
347
+ container.register(RunnerBootCheckService, hubRunnerBootCheck);
385
348
  // A runner settling (READY / crashed / failed / refused) re-evaluates a verdict
386
349
  // that still had runners on their way (D877).
387
- eventBusService.subscribe({ category: types_1.EventCategory.ProcessStateChanged }, () => hubRunnerBootCheck.noteRunnerChange());
388
- container.register(topology_emitter_service_1.TopologyEmitterService, topologyEmitterService);
389
- container.register(post_boot_service_1.PostBootService, postBootService);
390
- container.register(update_check_scheduler_js_1.UpdateCheckScheduler, updateCheckScheduler);
350
+ eventBusService.subscribe({ category: EventCategory.ProcessStateChanged }, () => hubRunnerBootCheck.noteRunnerChange());
351
+ container.register(TopologyEmitterService, topologyEmitterService);
352
+ container.register(PostBootService, postBootService);
353
+ container.register(UpdateCheckScheduler, updateCheckScheduler);
391
354
  // ---- Fastify instance --------------------------------------------------
392
- const fastify = (0, fastify_1.default)(fastifyOpts);
355
+ const fastify = Fastify(fastifyOpts);
393
356
  // /health and /health/* — registered in `main.ts` via
394
357
  // `registerHealthRoutes` once MoleculerService + AgentRegistryService are
395
358
  // available. The detailed shape is shared with each agent's `/health`
@@ -463,7 +426,7 @@ async function bootManual(opts) {
463
426
  async init(hooks = {}) {
464
427
  // The order and the `beforeAddonBoot` seam live in `runBootInitSequence`
465
428
  // — see `boot/init-sequence.ts` for why that seam is load-bearing.
466
- await (0, init_sequence_1.runBootInitSequence)({
429
+ await runBootInitSequence({
467
430
  moleculer: () => moleculerService.onModuleInit(),
468
431
  addonBridge: () => addonBridgeService.onModuleInit(),
469
432
  agentRegistry: () => {
package/dist/node-role.js CHANGED
@@ -1,7 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveNodeRole = resolveNodeRole;
4
- function resolveNodeRole(env) {
1
+ export function resolveNodeRole(env) {
5
2
  const raw = (env['CAMSTACK_ROLE'] ?? '').trim().toLowerCase();
6
3
  if (raw === '' || raw === 'hub')
7
4
  return 'hub';
@@ -1,44 +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.HOST_PROVIDED_PACKAGES = void 0;
37
- exports.hostProvidedSearchRoots = hostProvidedSearchRoots;
38
- exports.seedNodeModulesRoots = seedNodeModulesRoots;
39
- exports.inventoryHostProvided = inventoryHostProvided;
40
- exports.formatInventoryReport = formatInventoryReport;
41
- exports.formatShadowingNotes = formatShadowingNotes;
42
1
  /**
43
2
  * Boot-time inventory of host-provided packages — enforcement step 2 of
44
3
  * [D45](../../../docs/decisions/adr-0045.md).
@@ -69,13 +28,13 @@ exports.formatShadowingNotes = formatShadowingNotes;
69
28
  * so the whole inventory is testable against a described layout rather than a
70
29
  * real disk.
71
30
  */
72
- const path = __importStar(require("node:path"));
31
+ import * as path from 'node:path';
73
32
  /**
74
33
  * Packages the closure provides to everything on the node. Addons never bundle
75
34
  * these ([D15](../../../docs/decisions/adr-0015.md)); a second copy on disk is
76
35
  * a resolution race waiting for a boot order to change.
77
36
  */
78
- exports.HOST_PROVIDED_PACKAGES = [
37
+ export const HOST_PROVIDED_PACKAGES = [
79
38
  '@camstack/system',
80
39
  '@camstack/types',
81
40
  '@camstack/sdk',
@@ -94,7 +53,7 @@ exports.HOST_PROVIDED_PACKAGES = [
94
53
  * on `NODE_PATH`: the launcher puts the deposit and the seeds there itself, so
95
54
  * "it is on NODE_PATH" would mark the whole fleet unexpected.
96
55
  */
97
- function hostProvidedSearchRoots(input) {
56
+ export function hostProvidedSearchRoots(input) {
98
57
  const fromNodePath = (input.nodePath ?? '')
99
58
  .split(input.pathSeparator)
100
59
  .map((p) => p.trim())
@@ -153,7 +112,7 @@ function hostProvidedSearchRoots(input) {
153
112
  * list would quietly stop finding the copy it was written for. Returns empty
154
113
  * when `/opt` does not exist, which is every dev machine.
155
114
  */
156
- function seedNodeModulesRoots(fs, optDir = '/opt') {
115
+ export function seedNodeModulesRoots(fs, optDir = '/opt') {
157
116
  if (!fs.existsSync(optDir))
158
117
  return [];
159
118
  try {
@@ -174,7 +133,7 @@ function seedNodeModulesRoots(fs, optDir = '/opt') {
174
133
  * count — and an unreadable copy is exactly the kind that has been sitting
175
134
  * somewhere since an interrupted install.
176
135
  */
177
- function inventoryHostProvided(roots, fs, packages = exports.HOST_PROVIDED_PACKAGES) {
136
+ export function inventoryHostProvided(roots, fs, packages = HOST_PROVIDED_PACKAGES) {
178
137
  const copies = [];
179
138
  for (const pkg of packages) {
180
139
  // Keyed by canonical path: two roots that are the same directory (a
@@ -234,7 +193,7 @@ function classifyPackage(pkg, found) {
234
193
  * under the deposit is the fleet's normal shape and reports nothing here, or
235
194
  * the banner would print on every boot of every node and be read on none.
236
195
  */
237
- function formatInventoryReport(result) {
196
+ export function formatInventoryReport(result) {
238
197
  const violating = result.packages.filter((p) => p.violation);
239
198
  if (violating.length === 0)
240
199
  return '';
@@ -271,7 +230,7 @@ function describeLocation(copy, inv) {
271
230
  * already named in {@link formatInventoryReport} is skipped: the banner lists
272
231
  * all of its copies, and a reassuring line beside it would read as verification.
273
232
  */
274
- function formatShadowingNotes(result) {
233
+ export function formatShadowingNotes(result) {
275
234
  return result.packages
276
235
  .filter((p) => !p.violation && p.shadowedSeeds.length > 0)
277
236
  .map((p) => {