@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.
- package/dist/addon-root-inventory.js +11 -50
- package/dist/agent/addon-scan.js +6 -44
- package/dist/agent/agent-addon-runtime.js +3 -8
- package/dist/agent/agent-addon-updates.js +12 -52
- package/dist/agent/agent-cap-dispatch-service.js +3 -5
- package/dist/agent/agent-config.js +7 -42
- package/dist/agent/agent-deploy-swap.js +5 -41
- package/dist/agent/agent-group-runner.js +8 -47
- package/dist/agent/agent-http-auth.js +10 -22
- package/dist/agent/agent-http.js +69 -115
- package/dist/agent/agent-hub-addon-update.js +10 -16
- package/dist/agent/agent-hub-registration.js +4 -7
- package/dist/agent/agent-infra-capabilities.js +5 -9
- package/dist/agent/agent-json-file.js +5 -42
- package/dist/agent/agent-mesh-gate.js +5 -8
- package/dist/agent/agent-node-certificates.js +25 -28
- package/dist/agent/agent-pairing-local.js +10 -47
- package/dist/agent/agent-pairing-routes.js +16 -20
- package/dist/agent/agent-pairing-store.js +18 -58
- package/dist/agent/agent-reconnect.js +1 -4
- package/dist/agent/agent-service.js +42 -78
- package/dist/agent/agent-sniffing-listener.js +11 -48
- package/dist/agent/agent-undeploy.js +5 -41
- package/dist/agent/agent-update-routes.js +14 -19
- package/dist/agent/agent-update-service.js +38 -80
- package/dist/agent/apply-model-distribution.js +1 -4
- package/dist/agent/apply-stage-dev-uploads.js +6 -9
- package/dist/agent/derive-hub-url.js +3 -8
- package/dist/agent/fetch-bundle-from-hub.js +6 -9
- package/dist/agent/hubs-found.js +6 -43
- package/dist/agent/infra-boot-guard.js +1 -4
- package/dist/agent/infra-boot-plan.js +2 -6
- package/dist/agent/main.js +158 -186
- package/dist/agent/register-agent-cap-dispatch.js +3 -6
- package/dist/agent/serial-queue.js +2 -7
- package/dist/agent-status-page.js +1 -4
- package/dist/api/addon-upload.js +22 -61
- package/dist/api/agent-addon-delivery.js +6 -11
- package/dist/api/auth-whoami.js +1 -4
- package/dist/api/backup-download-pump.js +5 -9
- package/dist/api/backup-download.js +7 -10
- package/dist/api/core/addon-settings.router.js +16 -19
- package/dist/api/core/agent-pairing.router.js +76 -79
- package/dist/api/core/agents.router.js +21 -24
- package/dist/api/core/auth-admin-tokens.procedures.js +48 -52
- package/dist/api/core/auth-device-cert.procedures.js +62 -67
- package/dist/api/core/auth-limits.js +16 -25
- package/dist/api/core/auth-reauth.procedures.js +32 -37
- package/dist/api/core/auth-revoke-credentials.procedures.js +22 -26
- package/dist/api/core/auth-sessions.procedures.js +52 -56
- package/dist/api/core/auth.router.js +300 -304
- package/dist/api/core/cap-providers.js +74 -121
- package/dist/api/core/capabilities.router.js +34 -37
- package/dist/api/core/capability-preference-writes.js +10 -17
- package/dist/api/core/certificates.router.js +106 -109
- package/dist/api/core/cluster-nodes.router.js +15 -18
- package/dist/api/core/collection-preference.js +2 -6
- package/dist/api/core/event-bus-proxy.router.js +34 -37
- package/dist/api/core/failure-contributions.js +4 -8
- package/dist/api/core/hwaccel.router.js +17 -20
- package/dist/api/core/integration-secrets.js +8 -12
- package/dist/api/core/lifecycle-job-runner.js +13 -49
- package/dist/api/core/live-events.router.js +29 -32
- package/dist/api/core/load-contributions.js +4 -8
- package/dist/api/core/logging-settings.js +30 -43
- package/dist/api/core/logs.router.js +40 -43
- package/dist/api/core/notifications.router.js +15 -18
- package/dist/api/core/public-event-filter.js +4 -8
- package/dist/api/core/repl.router.js +18 -21
- package/dist/api/core/request-census-settings.js +11 -16
- package/dist/api/core/server-management.provider.js +1 -4
- package/dist/api/core/server-name.js +9 -17
- package/dist/api/core/site-location.js +16 -24
- package/dist/api/core/stream-probe.router.js +21 -24
- package/dist/api/core/system-events.router.js +23 -26
- package/dist/api/cors/cors-policy.js +20 -29
- package/dist/api/cors/register-cors-policy.js +9 -14
- package/dist/api/deploy-stage-registry.js +6 -10
- package/dist/api/dev-uploads-bundle.js +12 -50
- package/dist/api/health/adaptive-probe.routes.js +9 -13
- package/dist/api/health/health.routes.js +8 -13
- package/dist/api/hub-cluster-url.js +3 -9
- package/dist/api/model-distributor.js +12 -50
- package/dist/api/oauth2/consent-page.js +10 -13
- package/dist/api/oauth2/oauth2-routes.js +17 -25
- package/dist/api/oauth2/private-host.js +1 -4
- package/dist/api/server-upload-propagate.js +15 -51
- package/dist/api/server-upload.js +13 -50
- package/dist/api/sse-no-compression.js +1 -4
- package/dist/api/static/frame-policy.js +4 -9
- package/dist/api/static/precompressed-asset.js +15 -57
- package/dist/api/static/spa-mount.js +8 -47
- package/dist/api/static/spa-static.js +5 -12
- package/dist/api/tarball-manifest.js +7 -44
- package/dist/api/trpc/cap-mount-helpers.js +7 -12
- package/dist/api/trpc/cap-route-error-formatter.js +10 -13
- package/dist/api/trpc/cap-router-runtime.js +40 -51
- package/dist/api/trpc/client-ip.js +9 -20
- package/dist/api/trpc/core-cap-bridge.js +32 -42
- package/dist/api/trpc/device-collection-dispatch.js +23 -27
- package/dist/api/trpc/device-config-secret-redaction.js +24 -40
- package/dist/api/trpc/generated-cap-mounts.js +218 -222
- package/dist/api/trpc/generated-cap-routers.js +4688 -4850
- package/dist/api/trpc/http-request-census-hook.js +8 -11
- package/dist/api/trpc/http-request-census.js +34 -41
- package/dist/api/trpc/http-request-census.singleton.js +4 -8
- package/dist/api/trpc/localized-schema-paths.js +1 -4
- package/dist/api/trpc/principal-visibility.js +14 -22
- package/dist/api/trpc/remote-addon-update-grant.js +1 -4
- package/dist/api/trpc/scope-access.js +10 -15
- package/dist/api/trpc/server-provided-caps.js +3 -7
- package/dist/api/trpc/share-view-access.js +6 -14
- package/dist/api/trpc/trpc-error-device-tags.js +3 -6
- package/dist/api/trpc/trpc-error-principal.js +2 -6
- package/dist/api/trpc/trpc.context.js +20 -25
- package/dist/api/trpc/trpc.middleware.js +38 -46
- package/dist/api/trpc/trpc.router.js +58 -99
- package/dist/api/trpc/user-error.js +5 -8
- package/dist/api/trpc/ws-request-census.js +17 -24
- package/dist/api/trpc/ws-slow-consumer-guard.js +11 -16
- package/dist/api/upload-auth.js +5 -9
- package/dist/auth/addon-route-jwt-gate.js +4 -7
- package/dist/auth/addon-route-share-gate.js +7 -12
- package/dist/auth/app-confirm-page.js +17 -22
- package/dist/auth/app-confirm-routes.js +26 -31
- package/dist/auth/app-confirmations.js +7 -44
- package/dist/auth/app-page-shell.js +17 -30
- package/dist/auth/app-page-strings.js +11 -17
- package/dist/auth/app-passkey-page.js +16 -21
- package/dist/auth/app-passkey-routes.js +37 -41
- package/dist/auth/app-refused-route.js +13 -18
- package/dist/auth/auth-network-policy.js +11 -15
- package/dist/auth/auth-provider-gate.js +4 -9
- package/dist/auth/auth-rate-limit.js +3 -7
- package/dist/auth/client-address.js +6 -9
- package/dist/auth/device-enroll-proofs.js +6 -43
- package/dist/auth/external-link-intents.js +3 -7
- package/dist/auth/hub-sessions.js +6 -12
- package/dist/auth/native-link-completions.js +7 -11
- package/dist/auth/native-return.js +9 -13
- package/dist/auth/passkey-provider.js +26 -32
- package/dist/auth/second-factors.js +6 -10
- package/dist/auth/session-connections.js +6 -12
- package/dist/auth/session-cookie.js +12 -23
- package/dist/auth/session-lifetimes.js +8 -12
- package/dist/auth/session-mint.js +4 -11
- package/dist/auth/sso-finish-app.js +13 -16
- package/dist/auth/sso-finish-deps.js +21 -27
- package/dist/auth/sso-finish.js +28 -38
- package/dist/auth/sso-routes.js +22 -25
- package/dist/auth/used-bridge-ids.js +1 -5
- package/dist/boot/boot-config.js +16 -55
- package/dist/boot/init-sequence.js +1 -4
- package/dist/boot/integration-id-backfill.js +3 -8
- package/dist/boot/platform-keychain-key.js +5 -42
- package/dist/boot/post-boot.service.js +14 -18
- package/dist/boot/reconcile-lifecycle-jobs.js +3 -6
- package/dist/boot/retired-public-url-env.js +4 -8
- package/dist/bootstrap-packages.js +1 -4
- package/dist/closure-node-modules.js +2 -38
- package/dist/closure-patches/patch-reach.json +6 -2
- package/dist/core/addon/addon-call-gateway.js +1 -5
- package/dist/core/addon/addon-package.service.js +83 -123
- package/dist/core/addon/addon-process-view.js +2 -6
- package/dist/core/addon/addon-realign-plan.js +1 -4
- package/dist/core/addon/addon-registry.service.js +199 -185
- package/dist/core/addon/addon-row-manifest.js +1 -4
- package/dist/core/addon/addon-search.service.js +3 -7
- package/dist/core/addon/addon-settings-provider.js +1 -3
- package/dist/core/addon/addon-uninstall.js +4 -11
- package/dist/core/addon/addon.tokens.js +2 -5
- package/dist/core/addon/device-meta-mirror.js +8 -13
- package/dist/core/addon/forked-custom-actions.js +6 -11
- package/dist/core/addon/integration-visibility.js +3 -6
- package/dist/core/addon/materialize-route-path.js +1 -4
- package/dist/core/addon/package-dir-utils.js +8 -45
- package/dist/core/addon/prune-misplaced-addons.js +5 -43
- package/dist/core/addon/runner-convergence.js +1 -4
- package/dist/core/addon/runner-serialization.js +1 -4
- package/dist/core/addon/runner-spawn-fanout.js +3 -8
- package/dist/core/addon/settings-door-wiring.js +5 -8
- package/dist/core/addon/single-flight-refresh.js +1 -4
- package/dist/core/addon-bridge/addon-bridge.service.js +7 -44
- package/dist/core/addon-pages/addon-pages.service.js +3 -40
- package/dist/core/addon-widgets/addon-widgets.service.js +4 -42
- package/dist/core/agent/agent-addon-backfill.js +9 -17
- package/dist/core/agent/agent-delivery-ledger.js +3 -7
- package/dist/core/agent/agent-liveness-event.js +2 -6
- package/dist/core/agent/agent-pairing-http.js +41 -45
- package/dist/core/agent/agent-registry.service.js +53 -92
- package/dist/core/agent/cluster-node-history-mirror.js +3 -7
- package/dist/core/agent/cluster-node-history-store.js +113 -58
- package/dist/core/agent/hub-agent-pairing.js +1 -5
- package/dist/core/agent/node-certificates-client.js +3 -6
- package/dist/core/agent/node-directory.js +1 -4
- package/dist/core/app-links/well-known-app-links.js +2 -6
- package/dist/core/auth/auth.service.js +3 -8
- package/dist/core/auth/handoff-code.service.js +11 -49
- package/dist/core/auth/record-kinds.js +35 -0
- package/dist/core/auth/share-token.service.js +174 -122
- package/dist/core/capability/capability.service.js +1 -5
- package/dist/core/config/config.schema.js +1 -6
- package/dist/core/config/config.service.js +2 -6
- package/dist/core/events/event-bus.service.js +3 -7
- package/dist/core/feature/feature.service.js +2 -6
- package/dist/core/lifecycle/lifecycle-runner.singleton.js +5 -10
- package/dist/core/lifecycle/lifecycle-state-machine.js +1 -5
- package/dist/core/logging/log-ring-buffer.js +1 -5
- package/dist/core/logging/logging.service.js +5 -9
- package/dist/core/logging/scoped-logger.js +1 -5
- package/dist/core/moleculer/agent-readiness-pull.js +1 -4
- package/dist/core/moleculer/agent-registration-request.js +3 -7
- package/dist/core/moleculer/cap-call-fn.js +39 -5
- package/dist/core/moleculer/cap-route-authority.js +3 -8
- package/dist/core/moleculer/hub-mesh-guard.js +5 -9
- package/dist/core/moleculer/moleculer.service.js +108 -119
- package/dist/core/network/network-quality.service.js +2 -6
- package/dist/core/notification/notification-wrapper.service.js +3 -7
- package/dist/core/notification/toast-wrapper.service.js +3 -7
- package/dist/core/provider/provider.tokens.js +1 -4
- package/dist/core/repl/repl-engine.service.js +4 -8
- package/dist/core/runner-health/runner-boot-check.js +7 -15
- package/dist/core/runner-health/update-preflight.js +9 -14
- package/dist/core/server-update/server-update.service.js +12 -49
- package/dist/core/server-update/system-apply-closure-patches.js +6 -42
- package/dist/core/server-update/system-ensure-prebuilds.js +3 -6
- package/dist/core/server-update/system-exec-npm.js +2 -5
- package/dist/core/storage/fs-storage-backend.js +1 -5
- package/dist/core/storage/storage-location-manager.js +1 -5
- package/dist/core/storage/storage.service.js +2 -6
- package/dist/core/streaming/ffmpeg-stream-info.js +3 -8
- package/dist/core/streaming/stream-probe.service.js +12 -16
- package/dist/core/streaming/ttl-cache.js +1 -5
- package/dist/core/topology/topology-emitter.service.js +19 -23
- package/dist/core/update-availability-emitter.js +3 -7
- package/dist/core/update-availability-store.js +8 -45
- package/dist/core/updates/agent-installed-packages.js +5 -9
- package/dist/core/updates/restart-marker.js +3 -8
- package/dist/core/updates/update-check-scheduler.js +13 -18
- package/dist/core/updates/wrapper-update-checker.js +3 -7
- package/dist/first-boot-addon-plan.js +2 -6
- package/dist/framework-nodepath.js +2 -38
- package/dist/i18n/request-lang.js +7 -11
- package/dist/launcher.js +30 -65
- package/dist/lifecycle-journal-path.js +2 -38
- package/dist/main.js +287 -324
- package/dist/manual-boot.js +120 -157
- package/dist/node-role.js +1 -4
- package/dist/package-inventory.js +7 -48
- package/dist/pending-restore.js +7 -43
- package/dist/single-copy-cleanup-runner.js +9 -45
- package/dist/single-copy-cleanup.js +7 -15
- package/dist/sqlite-restore.js +9 -48
- package/dist/starter.js +4 -39
- package/dist/ui-serving/lazy-ui-serving.js +3 -39
- package/package.json +13 -13
package/dist/manual-boot.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
49
|
-
|
|
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
|
|
116
|
-
const storageService = new
|
|
117
|
-
const capabilityService = new
|
|
118
|
-
const networkQualityService = new
|
|
119
|
-
const toastWrapper = new
|
|
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
|
|
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
|
|
91
|
+
const bootstrapConsole = new ConsoleDestination();
|
|
131
92
|
void bootstrapConsole.initialize();
|
|
132
93
|
loggingService.attachBootstrapConsole(bootstrapConsole);
|
|
133
|
-
const eventBusService = new
|
|
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
|
|
144
|
-
const authService = new
|
|
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
|
|
149
|
-
const streamProbeService = new
|
|
150
|
-
const addonBridgeService = new
|
|
151
|
-
const addonSearchService = new
|
|
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
|
|
154
|
-
const addonPagesService = new
|
|
155
|
-
const moleculerService = new
|
|
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
|
|
158
|
-
const addonRegistryService = new
|
|
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
|
-
|
|
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
|
|
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
|
|
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 =
|
|
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:
|
|
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:
|
|
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
|
-
|
|
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:
|
|
197
|
+
id: randomUUID(),
|
|
235
198
|
timestamp: new Date(),
|
|
236
199
|
source: { type: 'core', id: 'lifecycle-job-engine' },
|
|
237
|
-
category:
|
|
200
|
+
category: EventCategory.AddonsJobProgress,
|
|
238
201
|
data: { job },
|
|
239
202
|
});
|
|
240
203
|
}
|
|
241
204
|
else {
|
|
242
205
|
eventBusService.emit({
|
|
243
|
-
id:
|
|
206
|
+
id: randomUUID(),
|
|
244
207
|
timestamp: new Date(),
|
|
245
208
|
source: { type: 'core', id: 'lifecycle-job-engine' },
|
|
246
|
-
category:
|
|
209
|
+
category: EventCategory.AddonsJobLog,
|
|
247
210
|
data: { jobId: job.jobId, entry },
|
|
248
211
|
});
|
|
249
212
|
}
|
|
250
213
|
},
|
|
251
214
|
});
|
|
252
|
-
const replEngineService = new
|
|
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
|
|
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:
|
|
234
|
+
id: randomUUID(),
|
|
272
235
|
timestamp: new Date(),
|
|
273
236
|
source: { type: 'core', id: 'runner-boot-check' },
|
|
274
|
-
category:
|
|
237
|
+
category: EventCategory.SystemRunnerCheck,
|
|
275
238
|
data: {
|
|
276
239
|
nodeId: 'hub',
|
|
277
|
-
degraded:
|
|
278
|
-
summary:
|
|
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
|
|
290
|
-
updatePreflight:
|
|
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 :
|
|
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
|
|
265
|
+
updateAvailabilityStore: new FileUpdateAvailabilityStore(availabilityDataDir, 'server-update', loggingService.createLogger('UpdateAvailability')),
|
|
303
266
|
});
|
|
304
|
-
const topologyEmitterService = new
|
|
305
|
-
const postBootService = new
|
|
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
|
|
277
|
+
const wrapperUpdateChecker = new WrapperUpdateChecker({
|
|
315
278
|
logger: updateCheckLogger,
|
|
316
|
-
emitter: new
|
|
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
|
|
290
|
+
return ServerPackageStatusSchema.parse(status);
|
|
328
291
|
},
|
|
329
292
|
});
|
|
330
|
-
const updateCheckScheduler = new
|
|
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
|
|
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(
|
|
364
|
-
container.register(
|
|
365
|
-
container.register(
|
|
366
|
-
container.register(
|
|
367
|
-
container.register(
|
|
368
|
-
container.register(
|
|
369
|
-
container.register(
|
|
370
|
-
container.register(
|
|
371
|
-
container.register(
|
|
372
|
-
container.register(
|
|
373
|
-
container.register(
|
|
374
|
-
container.register(
|
|
375
|
-
container.register(
|
|
376
|
-
container.register(
|
|
377
|
-
container.register(
|
|
378
|
-
container.register(
|
|
379
|
-
container.register(
|
|
380
|
-
container.register(
|
|
381
|
-
container.register(
|
|
382
|
-
container.register(
|
|
383
|
-
container.register(
|
|
384
|
-
container.register(
|
|
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:
|
|
388
|
-
container.register(
|
|
389
|
-
container.register(
|
|
390
|
-
container.register(
|
|
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 = (
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
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) => {
|