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