@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
|
@@ -1,26 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access -- pre-existing lint debt across this 2200-line orchestration class. The flagged sites (StorageService.setLocationManager / setSettingsBackend, LoggingService.addDestination, RouteRegistry, etc.) are typed as `unknown` by their owning services to break circular construction-order dependencies; runtime contracts are validated structurally. Tracked separately; do not amend in unrelated edits. */
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.AddonRegistryService = void 0;
|
|
38
|
+
exports.shouldEvictMissingOnDisk = shouldEvictMissingOnDisk;
|
|
39
|
+
exports.addonUpdatePayload = addonUpdatePayload;
|
|
40
|
+
exports.parseDataPlaneEndpoints = parseDataPlaneEndpoints;
|
|
41
|
+
exports.shouldEmitProviderRegisteredReady = shouldEmitProviderRegisteredReady;
|
|
42
|
+
const addon_process_view_js_1 = require("./addon-process-view.js");
|
|
43
|
+
const node_crypto_1 = require("node:crypto");
|
|
44
|
+
const fs = __importStar(require("node:fs"));
|
|
45
|
+
const os = __importStar(require("node:os"));
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const system_1 = require("@camstack/system");
|
|
48
|
+
const types_1 = require("@camstack/types");
|
|
49
|
+
const client_1 = require("@trpc/client");
|
|
50
|
+
const addon_call_gateway_js_1 = require("./addon-call-gateway.js");
|
|
51
|
+
const addon_row_manifest_1 = require("./addon-row-manifest");
|
|
52
|
+
const addon_settings_provider_js_1 = require("./addon-settings-provider.js");
|
|
53
|
+
const device_meta_mirror_js_1 = require("./device-meta-mirror.js");
|
|
54
|
+
const forked_custom_actions_js_1 = require("./forked-custom-actions.js");
|
|
55
|
+
const integration_visibility_js_1 = require("./integration-visibility.js");
|
|
56
|
+
const record_kinds_js_1 = require("../auth/record-kinds.js");
|
|
57
|
+
const materialize_route_path_js_1 = require("./materialize-route-path.js");
|
|
58
|
+
const package_dir_utils_1 = require("./package-dir-utils");
|
|
59
|
+
const prune_misplaced_addons_js_1 = require("./prune-misplaced-addons.js");
|
|
60
|
+
const runner_convergence_1 = require("./runner-convergence");
|
|
61
|
+
const runner_serialization_1 = require("./runner-serialization");
|
|
62
|
+
const runner_spawn_fanout_js_1 = require("./runner-spawn-fanout.js");
|
|
63
|
+
const settings_door_wiring_js_1 = require("./settings-door-wiring.js");
|
|
24
64
|
/**
|
|
25
65
|
* Decide whether an in-memory addon entry should be evicted because it is no
|
|
26
66
|
* longer on disk (the uninstall path in `loadNewAddons`).
|
|
@@ -32,7 +72,7 @@ import { wireSettingsDoor } from './settings-door-wiring.js';
|
|
|
32
72
|
* let a deploy of an unrelated addon silently unregister loki-logging on the
|
|
33
73
|
* live hub.
|
|
34
74
|
*/
|
|
35
|
-
|
|
75
|
+
function shouldEvictMissingOnDisk(entry, id, onDiskIds) {
|
|
36
76
|
return (entry.source === 'installed' && entry.packageName !== '@camstack/system' && !onDiskIds.has(id));
|
|
37
77
|
}
|
|
38
78
|
/**
|
|
@@ -51,7 +91,7 @@ export function shouldEvictMissingOnDisk(entry, id, onDiskIds) {
|
|
|
51
91
|
* settings save, which emits the same category carrying no versions at all
|
|
52
92
|
* (`parseAddonUpdateComplete`).
|
|
53
93
|
*/
|
|
54
|
-
|
|
94
|
+
function addonUpdatePayload(fromVersion, toVersion) {
|
|
55
95
|
return {
|
|
56
96
|
...(fromVersion !== null ? { fromVersion } : {}),
|
|
57
97
|
toVersion,
|
|
@@ -158,7 +198,7 @@ function parseSerializableRouteDescriptors(raw) {
|
|
|
158
198
|
* into typed data-plane endpoint descriptors (`prefix/access/baseUrl/secret`).
|
|
159
199
|
* Pure data — the addon's `ctx.dataPlane` facility produced them.
|
|
160
200
|
*/
|
|
161
|
-
|
|
201
|
+
function parseDataPlaneEndpoints(raw) {
|
|
162
202
|
if (!Array.isArray(raw)) {
|
|
163
203
|
throw new Error('data-planes: child returned a non-array endpoint set');
|
|
164
204
|
}
|
|
@@ -199,7 +239,7 @@ function parseDataPlaneShare(value) {
|
|
|
199
239
|
});
|
|
200
240
|
}
|
|
201
241
|
function isShareViewKind(value) {
|
|
202
|
-
return typeof value === 'string' && SHARE_VIEW_KINDS.includes(value);
|
|
242
|
+
return typeof value === 'string' && types_1.SHARE_VIEW_KINDS.includes(value);
|
|
203
243
|
}
|
|
204
244
|
// Phase 11 (settings redesign): `stripValue` helper and the legacy
|
|
205
245
|
// `getAddonConfigSchema / getAddonConfig / updateAddonConfig` adapter
|
|
@@ -216,7 +256,7 @@ function isShareViewKind(value) {
|
|
|
216
256
|
* accelerator-blind results. The addon emits `starting`/`ready`/`down`
|
|
217
257
|
* itself (`autoEmitReadiness=false`, ready on probe-done).
|
|
218
258
|
*/
|
|
219
|
-
|
|
259
|
+
function shouldEmitProviderRegisteredReady(capability) {
|
|
220
260
|
return capability !== 'platform-probe';
|
|
221
261
|
}
|
|
222
262
|
/**
|
|
@@ -227,11 +267,11 @@ export function shouldEmitProviderRegisteredReady(capability) {
|
|
|
227
267
|
* invisible for a week. Built once — `ALL_CAPABILITY_DEFINITIONS` is a frozen
|
|
228
268
|
* generated array.
|
|
229
269
|
*/
|
|
230
|
-
const DEVICE_SCOPED_CAP_NAMES = new Set(ALL_CAPABILITY_DEFINITIONS.filter((def) => def.scope === 'device').map((def) => def.name));
|
|
270
|
+
const DEVICE_SCOPED_CAP_NAMES = new Set(types_1.ALL_CAPABILITY_DEFINITIONS.filter((def) => def.scope === 'device').map((def) => def.name));
|
|
231
271
|
function isDeviceScopedCapName(capName) {
|
|
232
272
|
return DEVICE_SCOPED_CAP_NAMES.has(capName);
|
|
233
273
|
}
|
|
234
|
-
|
|
274
|
+
class AddonRegistryService {
|
|
235
275
|
loggingService;
|
|
236
276
|
eventBusService;
|
|
237
277
|
configService;
|
|
@@ -246,7 +286,7 @@ export class AddonRegistryService {
|
|
|
246
286
|
// Task 7.1: hub-wide registry of addon custom actions. Populated on
|
|
247
287
|
// each addon's initialize() (in-process path); Task 7.2 will dispatch
|
|
248
288
|
// through this from the `api.addons.custom` tRPC procedure.
|
|
249
|
-
customActionRegistry = new CustomActionRegistry();
|
|
289
|
+
customActionRegistry = new system_1.CustomActionRegistry();
|
|
250
290
|
/**
|
|
251
291
|
* Fingerprint of the custom-action catalogs each UDS child last DESCRIBED
|
|
252
292
|
* (keyed by child id), and the addon ids registered from that description.
|
|
@@ -300,9 +340,9 @@ export class AddonRegistryService {
|
|
|
300
340
|
const resolver = {
|
|
301
341
|
getByName: (capName) => reg.getSingleton(capName) ?? reg.getAllProviders(capName)[0] ?? null,
|
|
302
342
|
};
|
|
303
|
-
const client = createTRPCClient({
|
|
343
|
+
const client = (0, client_1.createTRPCClient)({
|
|
304
344
|
links: [
|
|
305
|
-
localProviderLink(resolver),
|
|
345
|
+
(0, system_1.localProviderLink)(resolver),
|
|
306
346
|
// Device-scoped caps go through the hub's CapRouteResolver, which is
|
|
307
347
|
// the only authority that can route `(cap, deviceId)` into a FORKED
|
|
308
348
|
// child — and forked children are broker-less, so the Moleculer
|
|
@@ -311,8 +351,8 @@ export class AddonRegistryService {
|
|
|
311
351
|
// `Service 'ptz.ptz.getOptions' is not found`, which is how the
|
|
312
352
|
// autotrack builtin came up switched on and unable to move a camera
|
|
313
353
|
// (2026-09-18).
|
|
314
|
-
deviceCapResolverLink((capName, method, input) => this.moleculer.callCapabilityOnNode(this.moleculer.broker.nodeID, capName, method, input), isDeviceScopedCapName),
|
|
315
|
-
brokerTransportLink(this.moleculer.broker),
|
|
354
|
+
(0, system_1.deviceCapResolverLink)((capName, method, input) => this.moleculer.callCapabilityOnNode(this.moleculer.broker.nodeID, capName, method, input), isDeviceScopedCapName),
|
|
355
|
+
(0, system_1.brokerTransportLink)(this.moleculer.broker),
|
|
316
356
|
],
|
|
317
357
|
});
|
|
318
358
|
this.brokerApi = client;
|
|
@@ -332,7 +372,7 @@ export class AddonRegistryService {
|
|
|
332
372
|
shareTokenService = null;
|
|
333
373
|
// Device architecture — in-memory registry of live IDevice instances.
|
|
334
374
|
// Persistence is owned by the `device-manager` capability addon.
|
|
335
|
-
deviceRegistry = new DeviceRegistry();
|
|
375
|
+
deviceRegistry = new system_1.DeviceRegistry();
|
|
336
376
|
/**
|
|
337
377
|
* Typed accessor for the Moleculer broker. The Moleculer `index.d.ts`
|
|
338
378
|
* chains through `eventemitter2`, whose package.json has no `types`
|
|
@@ -345,7 +385,7 @@ export class AddonRegistryService {
|
|
|
345
385
|
* `this.broker.call(...)` / `this.broker.nodeID` lint clean.
|
|
346
386
|
*/
|
|
347
387
|
get broker() {
|
|
348
|
-
return asBrokerLike(this.moleculer.broker);
|
|
388
|
+
return (0, system_1.asBrokerLike)(this.moleculer.broker);
|
|
349
389
|
}
|
|
350
390
|
constructor(loggingService, eventBusService, configService, storageService, capabilityService, moleculer, streamProbe) {
|
|
351
391
|
this.loggingService = loggingService;
|
|
@@ -356,8 +396,8 @@ export class AddonRegistryService {
|
|
|
356
396
|
this.moleculer = moleculer;
|
|
357
397
|
this.streamProbe = streamProbe;
|
|
358
398
|
this.logger = this.loggingService.createLogger('AddonRegistry');
|
|
359
|
-
this.addonLoader = new AddonLoader(this.loggingService.createLogger('AddonLoader'));
|
|
360
|
-
this.deviceMirror = new DeviceMetaMirror(async (deviceIds) => this.getBrokerApi().deviceManager.listAll.query({
|
|
399
|
+
this.addonLoader = new system_1.AddonLoader(this.loggingService.createLogger('AddonLoader'));
|
|
400
|
+
this.deviceMirror = new device_meta_mirror_js_1.DeviceMetaMirror(async (deviceIds) => this.getBrokerApi().deviceManager.listAll.query({
|
|
361
401
|
projection: 'slim',
|
|
362
402
|
...(deviceIds === null ? {} : { deviceIds: [...deviceIds] }),
|
|
363
403
|
}), {
|
|
@@ -372,13 +412,13 @@ export class AddonRegistryService {
|
|
|
372
412
|
// reattempt failed addons. Operator visibility comes through
|
|
373
413
|
// AddonLoadFailed / AddonLoadRecovered events consumed by
|
|
374
414
|
// AlertCenter (see addon-health-monitor.ts spec).
|
|
375
|
-
this.healthMonitor = new AddonHealthMonitor({
|
|
415
|
+
this.healthMonitor = new system_1.AddonHealthMonitor({
|
|
376
416
|
eventBus: this.eventBusService,
|
|
377
417
|
logger: this.loggingService.createLogger('AddonHealthMonitor'),
|
|
378
418
|
retryFn: (packageName) => this.tryReloadPackage(packageName),
|
|
379
419
|
});
|
|
380
420
|
// Create capability registry with config reader for singleton preferences
|
|
381
|
-
this.capabilityRegistry = new CapabilityRegistry(this.loggingService.createLogger('CapabilityRegistry'), this.eventBusService);
|
|
421
|
+
this.capabilityRegistry = new system_1.CapabilityRegistry(this.loggingService.createLogger('CapabilityRegistry'), this.eventBusService);
|
|
382
422
|
// The preference readers answer "no preference" while the persisted
|
|
383
423
|
// preferences cannot be read yet — before the settings door exists, or
|
|
384
424
|
// while its one boot read is in flight (D675: `get` then THROWS rather
|
|
@@ -391,7 +431,7 @@ export class AddonRegistryService {
|
|
|
391
431
|
}
|
|
392
432
|
catch (err) {
|
|
393
433
|
this.logger.debug('capability preference not readable yet — default applies until replay', {
|
|
394
|
-
meta: { capability, error: errMsg(err) },
|
|
434
|
+
meta: { capability, error: (0, types_1.errMsg)(err) },
|
|
395
435
|
});
|
|
396
436
|
return undefined;
|
|
397
437
|
}
|
|
@@ -404,7 +444,7 @@ export class AddonRegistryService {
|
|
|
404
444
|
catch (err) {
|
|
405
445
|
this.logger.debug('capability preference not readable yet — default applies', {
|
|
406
446
|
tags: { nodeId },
|
|
407
|
-
meta: { capability, error: errMsg(err) },
|
|
447
|
+
meta: { capability, error: (0, types_1.errMsg)(err) },
|
|
408
448
|
});
|
|
409
449
|
return undefined;
|
|
410
450
|
}
|
|
@@ -430,7 +470,7 @@ export class AddonRegistryService {
|
|
|
430
470
|
}
|
|
431
471
|
catch (err) {
|
|
432
472
|
this.logger.debug('collection preference not readable yet, or malformed', {
|
|
433
|
-
meta: { capability, error: errMsg(err) },
|
|
473
|
+
meta: { capability, error: (0, types_1.errMsg)(err) },
|
|
434
474
|
});
|
|
435
475
|
return undefined;
|
|
436
476
|
}
|
|
@@ -463,7 +503,7 @@ export class AddonRegistryService {
|
|
|
463
503
|
// Register the addon-settings singleton provider — replaces the
|
|
464
504
|
// former `$addonHost` Moleculer service. The provider resolves
|
|
465
505
|
// addonId → local addon instance (hub) or remote Moleculer call.
|
|
466
|
-
this.capabilityRegistry.declareCapability(addonSettingsCapability);
|
|
506
|
+
this.capabilityRegistry.declareCapability(system_1.addonSettingsCapability);
|
|
467
507
|
// The SINGLE router for addon-level calls (routes / custom / settings).
|
|
468
508
|
// It classifies in-process | hub-local-child (UDS) | remote-agent
|
|
469
509
|
// (Moleculer) in ONE place — `resolveNode` reports only the BASE node
|
|
@@ -473,7 +513,7 @@ export class AddonRegistryService {
|
|
|
473
513
|
// down a dead `<addonId>.settings.*` Moleculer path because the old
|
|
474
514
|
// `resolveNode` marked them non-local; now they route over UDS like
|
|
475
515
|
// their routes + custom-actions already do.
|
|
476
|
-
this.addonCallGateway = new AddonCallGateway({
|
|
516
|
+
this.addonCallGateway = new addon_call_gateway_js_1.AddonCallGateway({
|
|
477
517
|
hubNodeId: this.broker.nodeID,
|
|
478
518
|
resolveNode: (addonId) => {
|
|
479
519
|
const entry = this.addonEntries.get(addonId);
|
|
@@ -490,7 +530,7 @@ export class AddonRegistryService {
|
|
|
490
530
|
// active-singleton preference can select a grouped addon (whose child id
|
|
491
531
|
// is its `execution.group`, not its own id). Identity for ungrouped addons.
|
|
492
532
|
this.moleculer.setRunnerIdResolver((addonId) => this.childIdForAddon(addonId));
|
|
493
|
-
const settingsProvider = createAddonSettingsProvider({
|
|
533
|
+
const settingsProvider = (0, addon_settings_provider_js_1.createAddonSettingsProvider)({
|
|
494
534
|
getAddon: (addonId) => {
|
|
495
535
|
const entry = this.addonEntries.get(addonId);
|
|
496
536
|
return entry?.addon ?? null;
|
|
@@ -532,7 +572,7 @@ export class AddonRegistryService {
|
|
|
532
572
|
// `syncSystemAddonsCopy` race. Non-framework addons still load from the
|
|
533
573
|
// addons dir unchanged. The addons-dir `@camstack/system` copy (if present,
|
|
534
574
|
// seeded by the image entrypoint) is SKIPPED to avoid a double-load.
|
|
535
|
-
const closureSystemDir = resolveHubClosurePackageDir('@camstack/system');
|
|
575
|
+
const closureSystemDir = (0, package_dir_utils_1.resolveHubClosurePackageDir)('@camstack/system');
|
|
536
576
|
if (closureSystemDir) {
|
|
537
577
|
try {
|
|
538
578
|
await this.addonLoader.loadFromAddonDir(closureSystemDir);
|
|
@@ -561,10 +601,10 @@ export class AddonRegistryService {
|
|
|
561
601
|
// FAILED forever on a node where it cannot run. Fixing the installer was
|
|
562
602
|
// necessary and not sufficient — nothing removed what was already there,
|
|
563
603
|
// and a permanent red entry teaches people to ignore red entries.
|
|
564
|
-
prunePlacementLeftovers(decidePrune(loadedAddons.map((a) => ({
|
|
604
|
+
(0, prune_misplaced_addons_js_1.prunePlacementLeftovers)((0, prune_misplaced_addons_js_1.decidePrune)(loadedAddons.map((a) => ({
|
|
565
605
|
packageName: a.packageName,
|
|
566
606
|
dir: path.join(addonsDir, a.packageName),
|
|
567
|
-
placement: resolveAddonPlacement(a.declaration),
|
|
607
|
+
placement: (0, types_1.resolveAddonPlacement)(a.declaration),
|
|
568
608
|
})), 'hub'), path.join(addonsDir, '@camstack'), {
|
|
569
609
|
info: (msg, meta) => this.logger.info(msg, { meta }),
|
|
570
610
|
warn: (msg, meta) => this.logger.warn(msg, { meta }),
|
|
@@ -572,7 +612,7 @@ export class AddonRegistryService {
|
|
|
572
612
|
for (const registered of loadedAddons) {
|
|
573
613
|
// Skip agent-only addons — they never run on the hub, only on remote
|
|
574
614
|
// agents that opt in via `execution.placement: 'agent-only'`.
|
|
575
|
-
if (isAgentOnlyPlacement(registered.declaration)) {
|
|
615
|
+
if ((0, types_1.isAgentOnlyPlacement)(registered.declaration)) {
|
|
576
616
|
this.logger.info('Skipping agent-only addon on hub', {
|
|
577
617
|
tags: { addonId: registered.declaration.id },
|
|
578
618
|
meta: { packageName: registered.packageName },
|
|
@@ -612,7 +652,7 @@ export class AddonRegistryService {
|
|
|
612
652
|
this.loadAddonCatalogs(registered.packageName, this.addonEntries.get(registered.declaration.id)?.addonDir);
|
|
613
653
|
}
|
|
614
654
|
catch (err) {
|
|
615
|
-
const msg = errMsg(err);
|
|
655
|
+
const msg = (0, types_1.errMsg)(err);
|
|
616
656
|
this.logger.error('Failed to create instance of addon', {
|
|
617
657
|
tags: { addonId: registered.declaration.id },
|
|
618
658
|
meta: { error: msg },
|
|
@@ -658,7 +698,7 @@ export class AddonRegistryService {
|
|
|
658
698
|
// genuinely has no cross-process provider and the fallback returns null — wrappers
|
|
659
699
|
// cleanly fall through to their own secondary strategy.
|
|
660
700
|
{
|
|
661
|
-
const { buildNativeCapProxy } = await
|
|
701
|
+
const { buildNativeCapProxy } = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
662
702
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- moleculer types unresolvable; see `broker` getter docstring
|
|
663
703
|
const broker = this.moleculer.broker;
|
|
664
704
|
this.capabilityRegistry.setNativeFallback((capName, deviceId) => {
|
|
@@ -756,7 +796,7 @@ export class AddonRegistryService {
|
|
|
756
796
|
// that IS load-bearing is BETWEEN the waves in `runHubAddonBoot`, not
|
|
757
797
|
// inside one.
|
|
758
798
|
const spawnRunnerPlan = async (plan) => {
|
|
759
|
-
await spawnPlanConcurrently(plan, async (runnerId, runnerAddons) => {
|
|
799
|
+
await (0, runner_spawn_fanout_js_1.spawnPlanConcurrently)(plan, async (runnerId, runnerAddons) => {
|
|
760
800
|
try {
|
|
761
801
|
await this.initializeAddonGroup(runnerId, runnerAddons);
|
|
762
802
|
for (const { addonId } of runnerAddons) {
|
|
@@ -764,7 +804,7 @@ export class AddonRegistryService {
|
|
|
764
804
|
}
|
|
765
805
|
}
|
|
766
806
|
catch (error) {
|
|
767
|
-
const msg = errMsg(error);
|
|
807
|
+
const msg = (0, types_1.errMsg)(error);
|
|
768
808
|
for (const { addonId } of runnerAddons) {
|
|
769
809
|
this.emitAddonLifecycleEvent('addon.error', addonId, {
|
|
770
810
|
error: msg,
|
|
@@ -786,10 +826,10 @@ export class AddonRegistryService {
|
|
|
786
826
|
const entry = this.addonEntries.get(id);
|
|
787
827
|
return (entry?.packageName === '@camstack/system' &&
|
|
788
828
|
entry.declaration !== undefined &&
|
|
789
|
-
isIsolatedBuiltin(entry.declaration));
|
|
829
|
+
(0, types_1.isIsolatedBuiltin)(entry.declaration));
|
|
790
830
|
});
|
|
791
831
|
const isolatedBuiltins = new Set(isolatedBuiltinIds);
|
|
792
|
-
const { infra: isolatedInfraIds, consumers: isolatedConsumerIds } = partitionIsolatedBuiltinIds(isolatedBuiltinIds, (id) => {
|
|
832
|
+
const { infra: isolatedInfraIds, consumers: isolatedConsumerIds } = (0, system_1.partitionIsolatedBuiltinIds)(isolatedBuiltinIds, (id) => {
|
|
793
833
|
const entry = this.addonEntries.get(id);
|
|
794
834
|
return entry?.declaredCapabilities ?? [];
|
|
795
835
|
});
|
|
@@ -809,7 +849,7 @@ export class AddonRegistryService {
|
|
|
809
849
|
// still mint the named hostname (Cloudflare 530, 2026-08-25).
|
|
810
850
|
// `runHubAddonBoot` is the only sequence; a timeout on the engine wait
|
|
811
851
|
// must NOT throw (1.2.151 crash-looped the starter).
|
|
812
|
-
await runHubAddonBoot({
|
|
852
|
+
await (0, system_1.runHubAddonBoot)({
|
|
813
853
|
spawnIsolatedInfra: async () => {
|
|
814
854
|
if (isolatedInfraIds.length === 0)
|
|
815
855
|
return;
|
|
@@ -822,7 +862,7 @@ export class AddonRegistryService {
|
|
|
822
862
|
if (isolatedInfraIds.length === 0)
|
|
823
863
|
return;
|
|
824
864
|
try {
|
|
825
|
-
await waitUntilReady(() => this.capabilityRegistry.getCollection('data-store-provider').length > 0, {
|
|
865
|
+
await (0, system_1.waitUntilReady)(() => this.capabilityRegistry.getCollection('data-store-provider').length > 0, {
|
|
826
866
|
timeoutMs: 30_000,
|
|
827
867
|
intervalMs: 50,
|
|
828
868
|
what: 'isolated data-store-provider engine',
|
|
@@ -830,14 +870,14 @@ export class AddonRegistryService {
|
|
|
830
870
|
}
|
|
831
871
|
catch (err) {
|
|
832
872
|
this.logger.error('Isolated data-store-provider engine did not register in time', {
|
|
833
|
-
meta: { error: errMsg(err), addonIds: isolatedInfraIds },
|
|
873
|
+
meta: { error: (0, types_1.errMsg)(err), addonIds: isolatedInfraIds },
|
|
834
874
|
});
|
|
835
875
|
}
|
|
836
876
|
},
|
|
837
877
|
bootInProcessInfra: async () => {
|
|
838
878
|
// Pass 1 — infrastructure builtins. A failed REQUIRED infra cap
|
|
839
879
|
// aborts boot: nothing downstream can run without storage/settings.
|
|
840
|
-
for (const infra of INFRA_CAPABILITIES) {
|
|
880
|
+
for (const infra of system_1.INFRA_CAPABILITIES) {
|
|
841
881
|
const addonId = this.findAddonForCapability(infra.name, allIds);
|
|
842
882
|
if (addonId) {
|
|
843
883
|
const entry = this.addonEntries.get(addonId);
|
|
@@ -851,7 +891,7 @@ export class AddonRegistryService {
|
|
|
851
891
|
this.wireCapabilities(addonId);
|
|
852
892
|
}
|
|
853
893
|
catch (error) {
|
|
854
|
-
const msg = errMsg(error);
|
|
894
|
+
const msg = (0, types_1.errMsg)(error);
|
|
855
895
|
this.emitAddonLifecycleEvent('addon.error', addonId, {
|
|
856
896
|
error: msg,
|
|
857
897
|
phase: 'init',
|
|
@@ -878,7 +918,7 @@ export class AddonRegistryService {
|
|
|
878
918
|
bootInProcessConsumers: async () => {
|
|
879
919
|
// Pass 2 — remaining core builtins, in capability-dependency order.
|
|
880
920
|
const bootOrder = this.capabilityRegistry.getBootOrder();
|
|
881
|
-
const infraNames = new Set(INFRA_CAPABILITIES.map((c) => c.name));
|
|
921
|
+
const infraNames = new Set(system_1.INFRA_CAPABILITIES.map((c) => c.name));
|
|
882
922
|
for (const capName of bootOrder) {
|
|
883
923
|
if (infraNames.has(capName))
|
|
884
924
|
continue; // Handled in pass 1
|
|
@@ -894,7 +934,7 @@ export class AddonRegistryService {
|
|
|
894
934
|
this.wireCapabilities(id);
|
|
895
935
|
}
|
|
896
936
|
catch (error) {
|
|
897
|
-
const msg = errMsg(error);
|
|
937
|
+
const msg = (0, types_1.errMsg)(error);
|
|
898
938
|
this.emitAddonLifecycleEvent('addon.error', id, {
|
|
899
939
|
error: msg,
|
|
900
940
|
phase: 'init',
|
|
@@ -915,7 +955,7 @@ export class AddonRegistryService {
|
|
|
915
955
|
this.wireCapabilities(id);
|
|
916
956
|
}
|
|
917
957
|
catch (error) {
|
|
918
|
-
const msg = errMsg(error);
|
|
958
|
+
const msg = (0, types_1.errMsg)(error);
|
|
919
959
|
this.emitAddonLifecycleEvent('addon.error', id, {
|
|
920
960
|
error: msg,
|
|
921
961
|
phase: 'init',
|
|
@@ -973,7 +1013,7 @@ export class AddonRegistryService {
|
|
|
973
1013
|
for (const [id, entry] of this.addonEntries.entries()) {
|
|
974
1014
|
if (!entry.declaration)
|
|
975
1015
|
continue;
|
|
976
|
-
const runnerId = resolveRunnerId(entry.declaration, id);
|
|
1016
|
+
const runnerId = (0, types_1.resolveRunnerId)(entry.declaration, id);
|
|
977
1017
|
if (`${this.broker.nodeID}/${runnerId}` !== nodeId)
|
|
978
1018
|
continue;
|
|
979
1019
|
// Skip operator-initiated restarts — `restartAddon` already
|
|
@@ -995,7 +1035,7 @@ export class AddonRegistryService {
|
|
|
995
1035
|
for (const [id, entry] of this.addonEntries.entries()) {
|
|
996
1036
|
if (!entry.declaration)
|
|
997
1037
|
continue;
|
|
998
|
-
const runnerId = resolveRunnerId(entry.declaration, id);
|
|
1038
|
+
const runnerId = (0, types_1.resolveRunnerId)(entry.declaration, id);
|
|
999
1039
|
if (`${this.broker.nodeID}/${runnerId}` !== nodeId)
|
|
1000
1040
|
continue;
|
|
1001
1041
|
this.healthMonitor.recordSuccess(entry.packageName, id);
|
|
@@ -1003,10 +1043,10 @@ export class AddonRegistryService {
|
|
|
1003
1043
|
});
|
|
1004
1044
|
}
|
|
1005
1045
|
this.eventBusService.emit({
|
|
1006
|
-
id: randomUUID(),
|
|
1046
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
1007
1047
|
timestamp: new Date(),
|
|
1008
1048
|
source: { type: 'core', id: 'addon-registry' },
|
|
1009
|
-
category: EventCategory.SystemAddonsReady,
|
|
1049
|
+
category: types_1.EventCategory.SystemAddonsReady,
|
|
1010
1050
|
data: { activeAddons: initializedIds },
|
|
1011
1051
|
});
|
|
1012
1052
|
}
|
|
@@ -1051,7 +1091,7 @@ export class AddonRegistryService {
|
|
|
1051
1091
|
this.healthMonitor.recordSuccess(packageName, id);
|
|
1052
1092
|
}
|
|
1053
1093
|
catch (err) {
|
|
1054
|
-
errors.push(`${id}: ${errMsg(err)}`);
|
|
1094
|
+
errors.push(`${id}: ${(0, types_1.errMsg)(err)}`);
|
|
1055
1095
|
this.healthMonitor.recordFailure(packageName, err, id);
|
|
1056
1096
|
}
|
|
1057
1097
|
}
|
|
@@ -1130,7 +1170,7 @@ export class AddonRegistryService {
|
|
|
1130
1170
|
* values (D787). Never handed to an addon.
|
|
1131
1171
|
*/
|
|
1132
1172
|
secretsForOwner(owner) {
|
|
1133
|
-
return createSecretsAccess({
|
|
1173
|
+
return (0, types_1.createSecretsAccess)({
|
|
1134
1174
|
owner,
|
|
1135
1175
|
transport: this.inProcessKeychainTransport(owner),
|
|
1136
1176
|
eventBus: this.eventBusService,
|
|
@@ -1143,7 +1183,7 @@ export class AddonRegistryService {
|
|
|
1143
1183
|
* reaches a different owner.
|
|
1144
1184
|
*/
|
|
1145
1185
|
recordsForOwner(owner, secrets) {
|
|
1146
|
-
return createRecordsAccess({
|
|
1186
|
+
return (0, types_1.createRecordsAccess)({
|
|
1147
1187
|
owner,
|
|
1148
1188
|
transport: this.inProcessRecordsTransport(owner),
|
|
1149
1189
|
transportForOwner: (other) => this.inProcessRecordsTransport(other),
|
|
@@ -1179,7 +1219,7 @@ export class AddonRegistryService {
|
|
|
1179
1219
|
}
|
|
1180
1220
|
childIdForAddon(addonId) {
|
|
1181
1221
|
const decl = this.addonEntries.get(addonId)?.declaration;
|
|
1182
|
-
return decl ? resolveRunnerId(decl, addonId) : addonId;
|
|
1222
|
+
return decl ? (0, types_1.resolveRunnerId)(decl, addonId) : addonId;
|
|
1183
1223
|
}
|
|
1184
1224
|
async mountAddonDataPlanes(addonId) {
|
|
1185
1225
|
const registry = this.dataPlaneRegistry;
|
|
@@ -1202,7 +1242,7 @@ export class AddonRegistryService {
|
|
|
1202
1242
|
// Dropping is the safe direction: a data-plane that is absent from the
|
|
1203
1243
|
// registry falls through to the control-route path, while a stale one
|
|
1204
1244
|
// sends live traffic at a dead socket.
|
|
1205
|
-
if (!canServeDataPlane({
|
|
1245
|
+
if (!(0, system_1.canServeDataPlane)({
|
|
1206
1246
|
hasEntry: entry !== undefined,
|
|
1207
1247
|
isForked: entry !== undefined && this.isForkedAddonEntry(entry),
|
|
1208
1248
|
childKnown: childRegistry !== null && childRegistry.isChildKnown(this.childIdForAddon(addonId)),
|
|
@@ -1287,16 +1327,16 @@ export class AddonRegistryService {
|
|
|
1287
1327
|
*/
|
|
1288
1328
|
wireDeviceParentMirror() {
|
|
1289
1329
|
for (const category of [
|
|
1290
|
-
EventCategory.DeviceMetaChanged,
|
|
1291
|
-
EventCategory.DeviceRegistered,
|
|
1292
|
-
EventCategory.DeviceUnregistered,
|
|
1293
|
-
EventCategory.DeviceProvisioned,
|
|
1330
|
+
types_1.EventCategory.DeviceMetaChanged,
|
|
1331
|
+
types_1.EventCategory.DeviceRegistered,
|
|
1332
|
+
types_1.EventCategory.DeviceUnregistered,
|
|
1333
|
+
types_1.EventCategory.DeviceProvisioned,
|
|
1294
1334
|
]) {
|
|
1295
1335
|
this.eventBusService.subscribe({ category }, (event) => {
|
|
1296
1336
|
this.deviceMirror.onDeviceEvent(event.data);
|
|
1297
1337
|
});
|
|
1298
1338
|
}
|
|
1299
|
-
this.eventBusService.subscribe({ category: EventCategory.SystemAddonsReady }, () => {
|
|
1339
|
+
this.eventBusService.subscribe({ category: types_1.EventCategory.SystemAddonsReady }, () => {
|
|
1300
1340
|
void this.deviceMirror.refreshAll();
|
|
1301
1341
|
});
|
|
1302
1342
|
}
|
|
@@ -1314,7 +1354,7 @@ export class AddonRegistryService {
|
|
|
1314
1354
|
const records = this.clusterAgentRecords;
|
|
1315
1355
|
if (clusterStore === null || records === null)
|
|
1316
1356
|
return;
|
|
1317
|
-
const kind = records.kind(clusterNodeHistoryRecordKind);
|
|
1357
|
+
const kind = records.kind(system_1.clusterNodeHistoryRecordKind);
|
|
1318
1358
|
clusterStore.bindRecordsKind(() => kind);
|
|
1319
1359
|
}
|
|
1320
1360
|
setShareTokenService(service) {
|
|
@@ -1325,19 +1365,19 @@ export class AddonRegistryService {
|
|
|
1325
1365
|
if (recordsCap === null || recordsCap === undefined)
|
|
1326
1366
|
return;
|
|
1327
1367
|
const integrationRecords = this.recordsForOwner('integration-registry', this.secretsForOwner('integration-registry'));
|
|
1328
|
-
await integrationRecords.declare(integrationRegistryRecordKinds);
|
|
1329
|
-
this.integrationRegistry = new IntegrationRegistry(store, IntegrationRegistry.recordStoresOf(integrationRecords));
|
|
1368
|
+
await integrationRecords.declare(system_1.integrationRegistryRecordKinds);
|
|
1369
|
+
this.integrationRegistry = new system_1.IntegrationRegistry(store, system_1.IntegrationRegistry.recordStoresOf(integrationRecords));
|
|
1330
1370
|
await this.integrationRegistry.initialize();
|
|
1331
1371
|
this.logger.info('IntegrationRegistry initialized (records)', { meta: { phase: 'v2' } });
|
|
1332
1372
|
const clusterRecords = this.recordsForOwner('cluster-agent', this.secretsForOwner('cluster-agent'));
|
|
1333
|
-
await clusterRecords.declare(clusterAgentRecordKinds);
|
|
1373
|
+
await clusterRecords.declare(system_1.clusterAgentRecordKinds);
|
|
1334
1374
|
this.clusterAgentRecords = clusterRecords;
|
|
1335
1375
|
this.bindClusterNodeHistoryRecordsKind();
|
|
1336
1376
|
const shareTokens = this.shareTokenService;
|
|
1337
1377
|
if (shareTokens !== null) {
|
|
1338
1378
|
const coreRecords = this.recordsForOwner('core-auth', this.secretsForOwner('core-auth'));
|
|
1339
|
-
await coreRecords.declare(coreAuthRecordKinds);
|
|
1340
|
-
const shareKind = coreRecords.kind(coreAuthRecordKinds['share-view-tokens']);
|
|
1379
|
+
await coreRecords.declare(record_kinds_js_1.coreAuthRecordKinds);
|
|
1380
|
+
const shareKind = coreRecords.kind(record_kinds_js_1.coreAuthRecordKinds['share-view-tokens']);
|
|
1341
1381
|
shareTokens.bindShareTokensKind(() => shareKind);
|
|
1342
1382
|
}
|
|
1343
1383
|
}
|
|
@@ -1372,7 +1412,7 @@ export class AddonRegistryService {
|
|
|
1372
1412
|
* `integration-visibility.ts`, on its own, with its own tests.
|
|
1373
1413
|
*/
|
|
1374
1414
|
createFilteredRegistry(raw) {
|
|
1375
|
-
return createFilteredIntegrationRegistry({
|
|
1415
|
+
return (0, integration_visibility_js_1.createFilteredIntegrationRegistry)({
|
|
1376
1416
|
raw,
|
|
1377
1417
|
// The LIVE map, not a snapshot: an addon registered after this wrapper
|
|
1378
1418
|
// was built is installed, and a stale copy would refuse its first write.
|
|
@@ -1414,8 +1454,8 @@ export class AddonRegistryService {
|
|
|
1414
1454
|
loadAddonCatalogs(packageName, addonDir) {
|
|
1415
1455
|
if (addonDir === undefined)
|
|
1416
1456
|
return;
|
|
1417
|
-
const ns = catalogNamespaceOf(packageName);
|
|
1418
|
-
const catalogs = getCatalogRegistry((message) => this.logger.warn(message, { meta: { ns } }));
|
|
1457
|
+
const ns = (0, system_1.catalogNamespaceOf)(packageName);
|
|
1458
|
+
const catalogs = (0, system_1.getCatalogRegistry)((message) => this.logger.warn(message, { meta: { ns } }));
|
|
1419
1459
|
catalogs.clear(ns);
|
|
1420
1460
|
catalogs.loadAddonDir(ns, addonDir);
|
|
1421
1461
|
}
|
|
@@ -1469,7 +1509,7 @@ export class AddonRegistryService {
|
|
|
1469
1509
|
await this.ensureForkedRunner(id, { restart: false });
|
|
1470
1510
|
}
|
|
1471
1511
|
catch (err) {
|
|
1472
|
-
const msg = errMsg(err);
|
|
1512
|
+
const msg = (0, types_1.errMsg)(err);
|
|
1473
1513
|
this.logger.error('Failed to spawn isolated runner for addon', {
|
|
1474
1514
|
tags: { addonId: id },
|
|
1475
1515
|
meta: { error: msg },
|
|
@@ -1493,7 +1533,7 @@ export class AddonRegistryService {
|
|
|
1493
1533
|
// resolves native addon ids for getBindings, lists registered wrappers,
|
|
1494
1534
|
// etc. Inject before initialize() runs so the addon's onInitialize can
|
|
1495
1535
|
// rely on it.
|
|
1496
|
-
const initResult = normalizeAddonInitResult(await entry.addon.initialize(context));
|
|
1536
|
+
const initResult = (0, types_1.normalizeAddonInitResult)(await entry.addon.initialize(context));
|
|
1497
1537
|
// NOTE: `postBrokerStart()` is deliberately NOT called here. It used to
|
|
1498
1538
|
// fire right after `initialize()` and would emit readiness events whose
|
|
1499
1539
|
// subscribers (remote workers) immediately called `ctx.api.<addon>.*` —
|
|
@@ -1507,7 +1547,7 @@ export class AddonRegistryService {
|
|
|
1507
1547
|
// D4: wrapper behaviour is read from the cap DEFINITION. The runtime
|
|
1508
1548
|
// ProviderRegistration.kind/defaultActive are deprecated hints — if an
|
|
1509
1549
|
// addon still sets them and they disagree, warn (the cap def wins).
|
|
1510
|
-
const kindDrift = describeProviderKindDrift(capName, reg.capability, {
|
|
1550
|
+
const kindDrift = (0, system_1.describeProviderKindDrift)(capName, reg.capability, {
|
|
1511
1551
|
// eslint-disable-next-line @typescript-eslint/no-deprecated -- this IS the drift detector; it reads the deprecated hint on purpose
|
|
1512
1552
|
kind: reg.kind,
|
|
1513
1553
|
// eslint-disable-next-line @typescript-eslint/no-deprecated -- this IS the drift detector; it reads the deprecated hint on purpose
|
|
@@ -1539,7 +1579,7 @@ export class AddonRegistryService {
|
|
|
1539
1579
|
catch (err) {
|
|
1540
1580
|
this.logger.error('Failed to register custom actions for addon', {
|
|
1541
1581
|
tags: { addonId: id },
|
|
1542
|
-
meta: { error: errMsg(err) },
|
|
1582
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
1543
1583
|
});
|
|
1544
1584
|
throw err;
|
|
1545
1585
|
}
|
|
@@ -1559,7 +1599,7 @@ export class AddonRegistryService {
|
|
|
1559
1599
|
if (provider)
|
|
1560
1600
|
capturedProviders.set(capName, provider);
|
|
1561
1601
|
}
|
|
1562
|
-
validateProviderRegistrations(id, entry.declaration, capturedProviders, this.logger);
|
|
1602
|
+
(0, system_1.validateProviderRegistrations)(id, entry.declaration, capturedProviders, this.logger);
|
|
1563
1603
|
}
|
|
1564
1604
|
await this.restoreAddonDevices(id, entry.addon);
|
|
1565
1605
|
entry.initialized = true;
|
|
@@ -1574,7 +1614,7 @@ export class AddonRegistryService {
|
|
|
1574
1614
|
return Object.keys(def.methods);
|
|
1575
1615
|
};
|
|
1576
1616
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- createAddonService return type unresolvable due to upstream eventemitter2/moleculer type chain
|
|
1577
|
-
const schema = createAddonService(entry.addon, entry.declaration, {
|
|
1617
|
+
const schema = (0, system_1.createAddonService)(entry.addon, entry.declaration, {
|
|
1578
1618
|
methodResolver,
|
|
1579
1619
|
providers: capturedProviders,
|
|
1580
1620
|
});
|
|
@@ -1583,7 +1623,7 @@ export class AddonRegistryService {
|
|
|
1583
1623
|
catch (err) {
|
|
1584
1624
|
this.logger.warn('Failed to register Moleculer service', {
|
|
1585
1625
|
tags: { addonId: id },
|
|
1586
|
-
meta: { error: errMsg(err) },
|
|
1626
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
1587
1627
|
});
|
|
1588
1628
|
}
|
|
1589
1629
|
}
|
|
@@ -1642,7 +1682,7 @@ export class AddonRegistryService {
|
|
|
1642
1682
|
catch (err) {
|
|
1643
1683
|
this.logger.error('restoreDevices failed for addon', {
|
|
1644
1684
|
tags: { addonId },
|
|
1645
|
-
meta: { error: errMsg(err) },
|
|
1685
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
1646
1686
|
});
|
|
1647
1687
|
}
|
|
1648
1688
|
}
|
|
@@ -1742,7 +1782,7 @@ export class AddonRegistryService {
|
|
|
1742
1782
|
errors.push(res.error ?? `restart of "${addonId}" reported failure`);
|
|
1743
1783
|
}
|
|
1744
1784
|
catch (err) {
|
|
1745
|
-
errors.push(`restart of "${addonId}" threw: ${errMsg(err)}`);
|
|
1785
|
+
errors.push(`restart of "${addonId}" threw: ${(0, types_1.errMsg)(err)}`);
|
|
1746
1786
|
}
|
|
1747
1787
|
}
|
|
1748
1788
|
return { success: errors.length === 0, restarted, errors };
|
|
@@ -1767,7 +1807,7 @@ export class AddonRegistryService {
|
|
|
1767
1807
|
// suppressing the siblings too, each would flash a spurious "Failed to load".
|
|
1768
1808
|
const suppressed = new Set([addonId]);
|
|
1769
1809
|
if (this.isForkedAddonEntry(entry)) {
|
|
1770
|
-
const runnerId = resolveRunnerId(entry.declaration, addonId);
|
|
1810
|
+
const runnerId = (0, types_1.resolveRunnerId)(entry.declaration, addonId);
|
|
1771
1811
|
for (const { addonId: siblingId } of this.buildAddonGroupPlan([
|
|
1772
1812
|
...this.addonEntries.keys(),
|
|
1773
1813
|
]).get(runnerId) ?? []) {
|
|
@@ -1901,7 +1941,7 @@ export class AddonRegistryService {
|
|
|
1901
1941
|
return { success: true };
|
|
1902
1942
|
}
|
|
1903
1943
|
catch (err) {
|
|
1904
|
-
const msg = errMsg(err);
|
|
1944
|
+
const msg = (0, types_1.errMsg)(err);
|
|
1905
1945
|
this.logger.error('Failed to restart addon', { tags: { addonId }, meta: { error: msg } });
|
|
1906
1946
|
this.emitAddonLifecycleEvent('addon.error', addonId, {
|
|
1907
1947
|
error: msg,
|
|
@@ -2093,10 +2133,10 @@ export class AddonRegistryService {
|
|
|
2093
2133
|
// The real process-service state of each addon's runner (D877) - the last
|
|
2094
2134
|
// `refreshRunnerStates()` answer; `unknown` before the first one.
|
|
2095
2135
|
const runnerStates = this.runnerStates;
|
|
2096
|
-
const processFor = (id, entry) => describeAddonProcess({
|
|
2136
|
+
const processFor = (id, entry) => (0, addon_process_view_js_1.describeAddonProcess)({
|
|
2097
2137
|
forked: this.runsInOwnRunner(entry),
|
|
2098
2138
|
initialized: entry.initialized === true,
|
|
2099
|
-
runnerId: entry.declaration ? resolveRunnerId(entry.declaration, id) : id,
|
|
2139
|
+
runnerId: entry.declaration ? (0, types_1.resolveRunnerId)(entry.declaration, id) : id,
|
|
2100
2140
|
runners: runnerStates,
|
|
2101
2141
|
hubPid: process.pid,
|
|
2102
2142
|
});
|
|
@@ -2118,7 +2158,7 @@ export class AddonRegistryService {
|
|
|
2118
2158
|
}
|
|
2119
2159
|
catch (err) {
|
|
2120
2160
|
this.logger.debug('Failed to read install-source marker for addon', {
|
|
2121
|
-
meta: { error: errMsg(err) },
|
|
2161
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
2122
2162
|
});
|
|
2123
2163
|
}
|
|
2124
2164
|
}
|
|
@@ -2131,7 +2171,7 @@ export class AddonRegistryService {
|
|
|
2131
2171
|
// `overlayDeclaration` — this is what keeps Home Assistant
|
|
2132
2172
|
// (post broker rework: broker + device-adoption) visible in the
|
|
2133
2173
|
// "+ New Integration" picker.
|
|
2134
|
-
...overlayDeclaration(entry.addon.manifest, entry.declaration),
|
|
2174
|
+
...(0, addon_row_manifest_1.overlayDeclaration)(entry.addon.manifest, entry.declaration),
|
|
2135
2175
|
packageName: entry.packageName,
|
|
2136
2176
|
packageVersion: entry.packageVersion,
|
|
2137
2177
|
packageDisplayName: entry.packageDisplayName,
|
|
@@ -2239,7 +2279,7 @@ export class AddonRegistryService {
|
|
|
2239
2279
|
declaration: decl,
|
|
2240
2280
|
source: 'installed',
|
|
2241
2281
|
...(installSource ? { installSource } : {}),
|
|
2242
|
-
process: NEVER_LOADED_PROCESS,
|
|
2282
|
+
process: addon_process_view_js_1.NEVER_LOADED_PROCESS,
|
|
2243
2283
|
});
|
|
2244
2284
|
}
|
|
2245
2285
|
};
|
|
@@ -2291,7 +2331,7 @@ export class AddonRegistryService {
|
|
|
2291
2331
|
const dataDir = path.resolve(process.env.CAMSTACK_DATA ?? 'camstack-data');
|
|
2292
2332
|
const addonsDir = process.env.CAMSTACK_ADDONS_DIR ?? path.resolve(dataDir, 'addons');
|
|
2293
2333
|
// Create a fresh loader to discover what's on disk (for diffing against existing)
|
|
2294
|
-
const freshLoader = new AddonLoader(this.loggingService.createLogger('AddonLoader'));
|
|
2334
|
+
const freshLoader = new system_1.AddonLoader(this.loggingService.createLogger('AddonLoader'));
|
|
2295
2335
|
await freshLoader.loadFromDirectory(addonsDir);
|
|
2296
2336
|
const loaded = [];
|
|
2297
2337
|
const failed = [];
|
|
@@ -2322,7 +2362,7 @@ export class AddonRegistryService {
|
|
|
2322
2362
|
// hub-side every agent-only provider (e.g. `hub-forwarder`),
|
|
2323
2363
|
// and a hub-resident `hub-forwarder` creates a write→ingest→
|
|
2324
2364
|
// write feedback loop because the hub IS the log-receiver.
|
|
2325
|
-
if (isAgentOnlyPlacement(registered.declaration)) {
|
|
2365
|
+
if ((0, types_1.isAgentOnlyPlacement)(registered.declaration)) {
|
|
2326
2366
|
this.logger.debug('loadNewAddons: skipping agent-only addon on hub', {
|
|
2327
2367
|
tags: { addonId: registered.declaration.id },
|
|
2328
2368
|
});
|
|
@@ -2360,7 +2400,7 @@ export class AddonRegistryService {
|
|
|
2360
2400
|
this.emitAddonLifecycleEvent('addon.installed', registered.declaration.id);
|
|
2361
2401
|
}
|
|
2362
2402
|
catch (err) {
|
|
2363
|
-
const msg = errMsg(err);
|
|
2403
|
+
const msg = (0, types_1.errMsg)(err);
|
|
2364
2404
|
const stack = err instanceof Error ? err.stack : undefined;
|
|
2365
2405
|
this.logger.error('Failed to hot-load addon', {
|
|
2366
2406
|
tags: { addonId: registered.declaration.id },
|
|
@@ -2400,7 +2440,7 @@ export class AddonRegistryService {
|
|
|
2400
2440
|
catch (err) {
|
|
2401
2441
|
this.logger.warn('Non-fatal: failed to stop runner for removed addon', {
|
|
2402
2442
|
tags: { addonId: id },
|
|
2403
|
-
meta: { error: errMsg(err) },
|
|
2443
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
2404
2444
|
});
|
|
2405
2445
|
}
|
|
2406
2446
|
}
|
|
@@ -2414,7 +2454,7 @@ export class AddonRegistryService {
|
|
|
2414
2454
|
catch (err) {
|
|
2415
2455
|
this.logger.debug('Non-fatal: shutdown error for removed addon', {
|
|
2416
2456
|
tags: { addonId: id },
|
|
2417
|
-
meta: { error: errMsg(err) },
|
|
2457
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
2418
2458
|
});
|
|
2419
2459
|
}
|
|
2420
2460
|
await this.drainDisposerChain(id);
|
|
@@ -2491,7 +2531,7 @@ export class AddonRegistryService {
|
|
|
2491
2531
|
}
|
|
2492
2532
|
catch (err) {
|
|
2493
2533
|
this.logger.warn('emitReady failed', {
|
|
2494
|
-
meta: { capability, addonId, error: errMsg(err) },
|
|
2534
|
+
meta: { capability, addonId, error: (0, types_1.errMsg)(err) },
|
|
2495
2535
|
});
|
|
2496
2536
|
}
|
|
2497
2537
|
}
|
|
@@ -2553,16 +2593,16 @@ export class AddonRegistryService {
|
|
|
2553
2593
|
const store = this.capabilityRegistry.getProviderByAddon('settings-store', addonId);
|
|
2554
2594
|
if (!store)
|
|
2555
2595
|
return;
|
|
2556
|
-
void wireSettingsDoor({
|
|
2596
|
+
void (0, settings_door_wiring_js_1.wireSettingsDoor)({
|
|
2557
2597
|
configService: this.configService,
|
|
2558
2598
|
registry: this.capabilityRegistry,
|
|
2559
2599
|
logger: this.logger,
|
|
2560
2600
|
}, store);
|
|
2561
2601
|
void this.wireHubMainOrphanRecords(store).catch((err) => {
|
|
2562
2602
|
this.logger.warn('hub-main records wiring failed (best-effort)', {
|
|
2563
|
-
meta: { error: errMsg(err) },
|
|
2603
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
2564
2604
|
});
|
|
2565
|
-
this.integrationRegistry = new IntegrationRegistry(store);
|
|
2605
|
+
this.integrationRegistry = new system_1.IntegrationRegistry(store);
|
|
2566
2606
|
void this.integrationRegistry.initialize().then(() => {
|
|
2567
2607
|
this.logger.info('IntegrationRegistry initialized (legacy)', {
|
|
2568
2608
|
meta: { phase: 'v2' },
|
|
@@ -2604,7 +2644,7 @@ export class AddonRegistryService {
|
|
|
2604
2644
|
// subscriber unobserved.
|
|
2605
2645
|
void this.mountAddonRoutes(addonId).catch((err) => {
|
|
2606
2646
|
this.logger.error('Failed to mount addon routes', {
|
|
2607
|
-
meta: { phase: 'v2', addonId, error: errMsg(err) },
|
|
2647
|
+
meta: { phase: 'v2', addonId, error: (0, types_1.errMsg)(err) },
|
|
2608
2648
|
});
|
|
2609
2649
|
});
|
|
2610
2650
|
break;
|
|
@@ -2618,7 +2658,7 @@ export class AddonRegistryService {
|
|
|
2618
2658
|
// restart (the child re-handshakes → caps re-register → this re-fires).
|
|
2619
2659
|
void this.mountAddonDataPlanes(addonId).catch((err) => {
|
|
2620
2660
|
this.logger.error('Failed to mount addon data-planes', {
|
|
2621
|
-
meta: { phase: 'v2', addonId, error: errMsg(err) },
|
|
2661
|
+
meta: { phase: 'v2', addonId, error: (0, types_1.errMsg)(err) },
|
|
2622
2662
|
});
|
|
2623
2663
|
});
|
|
2624
2664
|
});
|
|
@@ -2729,7 +2769,7 @@ export class AddonRegistryService {
|
|
|
2729
2769
|
method: route.method,
|
|
2730
2770
|
// The CONCRETE path, not the pattern: the child re-matches it and
|
|
2731
2771
|
// would otherwise bind every param to its own `:placeholder`.
|
|
2732
|
-
path: materializeRoutePath(route.path, req.params),
|
|
2772
|
+
path: (0, materialize_route_path_js_1.materializeRoutePath)(route.path, req.params),
|
|
2733
2773
|
params: req.params,
|
|
2734
2774
|
query: req.query,
|
|
2735
2775
|
body: req.body,
|
|
@@ -2768,7 +2808,7 @@ export class AddonRegistryService {
|
|
|
2768
2808
|
emitAddonLifecycleEvent(eventType, addonId, data) {
|
|
2769
2809
|
const entry = this.addonEntries.get(addonId);
|
|
2770
2810
|
this.eventBusService.emit({
|
|
2771
|
-
id: randomUUID(),
|
|
2811
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
2772
2812
|
timestamp: new Date(),
|
|
2773
2813
|
source: {
|
|
2774
2814
|
type: 'addon',
|
|
@@ -2800,10 +2840,10 @@ export class AddonRegistryService {
|
|
|
2800
2840
|
const declaredCaps = entry.declaredCapabilities.map((c) => c.name);
|
|
2801
2841
|
if (declaredCaps.includes('addon-pages-source')) {
|
|
2802
2842
|
this.eventBusService.emit({
|
|
2803
|
-
id: randomUUID(),
|
|
2843
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
2804
2844
|
timestamp: new Date(),
|
|
2805
2845
|
source: { type: 'addon', id: addonId },
|
|
2806
|
-
category: EventCategory.AddonPageReady,
|
|
2846
|
+
category: types_1.EventCategory.AddonPageReady,
|
|
2807
2847
|
data: { addonId, packageName: entry.packageName },
|
|
2808
2848
|
});
|
|
2809
2849
|
}
|
|
@@ -2814,10 +2854,10 @@ export class AddonRegistryService {
|
|
|
2814
2854
|
// reload.
|
|
2815
2855
|
if (declaredCaps.includes('addon-widgets-source')) {
|
|
2816
2856
|
this.eventBusService.emit({
|
|
2817
|
-
id: randomUUID(),
|
|
2857
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
2818
2858
|
timestamp: new Date(),
|
|
2819
2859
|
source: { type: 'addon', id: addonId },
|
|
2820
|
-
category: EventCategory.AddonWidgetReady,
|
|
2860
|
+
category: types_1.EventCategory.AddonWidgetReady,
|
|
2821
2861
|
data: { addonId, packageName: entry.packageName },
|
|
2822
2862
|
});
|
|
2823
2863
|
}
|
|
@@ -2894,7 +2934,7 @@ export class AddonRegistryService {
|
|
|
2894
2934
|
probe: (url, options) => this.streamProbe.probe(url, options),
|
|
2895
2935
|
probeField: (key, value) => this.streamProbe.probeField(key, value),
|
|
2896
2936
|
};
|
|
2897
|
-
const deviceManagerApi = createBrokerDeviceManagerApi({
|
|
2937
|
+
const deviceManagerApi = (0, system_1.createBrokerDeviceManagerApi)({
|
|
2898
2938
|
api: this.getBrokerApi(),
|
|
2899
2939
|
addonId,
|
|
2900
2940
|
nodeId: this.broker.nodeID,
|
|
@@ -2912,11 +2952,11 @@ export class AddonRegistryService {
|
|
|
2912
2952
|
const rr = this.moleculer.readinessRegistry;
|
|
2913
2953
|
const capHandleCache = new Map();
|
|
2914
2954
|
function getOrCreateHandle(capName, scope, timeoutMs) {
|
|
2915
|
-
const key = `${capName}::${scopeKey(scope)}`;
|
|
2955
|
+
const key = `${capName}::${(0, system_1.scopeKey)(scope)}`;
|
|
2916
2956
|
const existing = capHandleCache.get(key);
|
|
2917
2957
|
if (existing)
|
|
2918
2958
|
return existing;
|
|
2919
|
-
const handle = new CapabilityHandle(capName, scope, rr, timeoutMs);
|
|
2959
|
+
const handle = new system_1.CapabilityHandle(capName, scope, rr, timeoutMs);
|
|
2920
2960
|
capHandleCache.set(key, handle);
|
|
2921
2961
|
return handle;
|
|
2922
2962
|
}
|
|
@@ -2933,7 +2973,7 @@ export class AddonRegistryService {
|
|
|
2933
2973
|
registry.dataPlaneRegistry?.registerAddon(id, endpoints);
|
|
2934
2974
|
},
|
|
2935
2975
|
};
|
|
2936
|
-
const dataPlaneFacility = createAddonDataPlaneFacility({
|
|
2976
|
+
const dataPlaneFacility = (0, system_1.createAddonDataPlaneFacility)({
|
|
2937
2977
|
addonId,
|
|
2938
2978
|
logger,
|
|
2939
2979
|
sink: dataPlaneSink,
|
|
@@ -2942,7 +2982,7 @@ export class AddonRegistryService {
|
|
|
2942
2982
|
// Addon→addon byte transport (`ctx.peerBytes`, D613) for a co-located hub
|
|
2943
2983
|
// builtin, on the same terms a forked addon gets it. `broker.nodeID` IS the
|
|
2944
2984
|
// host node here — hub-main has no runner suffix.
|
|
2945
|
-
const peerBytesFacility = createAddonPeerBytesFacility({
|
|
2985
|
+
const peerBytesFacility = (0, system_1.createAddonPeerBytesFacility)({
|
|
2946
2986
|
addonId,
|
|
2947
2987
|
logger,
|
|
2948
2988
|
nodeId: this.broker.nodeID,
|
|
@@ -2952,7 +2992,7 @@ export class AddonRegistryService {
|
|
|
2952
2992
|
// STATED (no wire, no stamp) - the one place the keychain trusts a claim.
|
|
2953
2993
|
// `forOwner` is the door a system builtin (device-manager,
|
|
2954
2994
|
// storage-orchestrator) uses to keep another addon's values.
|
|
2955
|
-
const secrets = createSecretsAccess({
|
|
2995
|
+
const secrets = (0, types_1.createSecretsAccess)({
|
|
2956
2996
|
owner: addonId,
|
|
2957
2997
|
transport: this.inProcessKeychainTransport(addonId),
|
|
2958
2998
|
transportForOwner: (owner) => this.inProcessKeychainTransport(owner),
|
|
@@ -2995,7 +3035,7 @@ export class AddonRegistryService {
|
|
|
2995
3035
|
return registry.capabilityRegistry.getSingleton(capName) ?? undefined;
|
|
2996
3036
|
},
|
|
2997
3037
|
},
|
|
2998
|
-
deps: new AddonDepsManager(dataDir, logger),
|
|
3038
|
+
deps: new system_1.AddonDepsManager(dataDir, logger),
|
|
2999
3039
|
kernel: {
|
|
3000
3040
|
localNodeId: this.broker.nodeID,
|
|
3001
3041
|
// The keychain accepts a grouped runner's stamp (its group id) for the
|
|
@@ -3004,9 +3044,9 @@ export class AddonRegistryService {
|
|
|
3004
3044
|
storage: storageProvider ?? undefined,
|
|
3005
3045
|
deviceRegistry: this.deviceRegistry ?? undefined,
|
|
3006
3046
|
devices: deviceManagerApi,
|
|
3007
|
-
cluster: { broker: adaptBrokerToCluster(this.moleculer.broker) },
|
|
3047
|
+
cluster: { broker: (0, system_1.adaptBrokerToCluster)(this.moleculer.broker) },
|
|
3008
3048
|
streamProbe: kernelStreamProbe,
|
|
3009
|
-
hwaccel: createKernelHwAccel(),
|
|
3049
|
+
hwaccel: (0, system_1.createKernelHwAccel)(),
|
|
3010
3050
|
capabilityRegistry: this.capabilityRegistry,
|
|
3011
3051
|
// Per-addon storage-location declarations across every installed
|
|
3012
3052
|
// addon — surfaced from the kernel's AddonLoader so the
|
|
@@ -3042,7 +3082,7 @@ export class AddonRegistryService {
|
|
|
3042
3082
|
fetchDevice: async (deviceId) => {
|
|
3043
3083
|
const api = registry.getBrokerApi();
|
|
3044
3084
|
const binding = await api.deviceManager.getBindings.query({ deviceId });
|
|
3045
|
-
return createDeviceProxy(api, binding);
|
|
3085
|
+
return (0, types_1.createDeviceProxy)(api, binding);
|
|
3046
3086
|
},
|
|
3047
3087
|
settings: settingsView,
|
|
3048
3088
|
secrets,
|
|
@@ -3115,10 +3155,10 @@ export class AddonRegistryService {
|
|
|
3115
3155
|
let chain = this.disposerChains.get(addonId);
|
|
3116
3156
|
if (chain == null) {
|
|
3117
3157
|
const log = this.loggingService.createLogger().withTags({ addonId });
|
|
3118
|
-
chain = new DisposerChain({
|
|
3158
|
+
chain = new types_1.DisposerChain({
|
|
3119
3159
|
onError: (err, index) => {
|
|
3120
3160
|
log.error(`Disposer #${index} threw during teardown`, {
|
|
3121
|
-
meta: { error: errMsg(err) },
|
|
3161
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
3122
3162
|
});
|
|
3123
3163
|
},
|
|
3124
3164
|
});
|
|
@@ -3177,7 +3217,7 @@ export class AddonRegistryService {
|
|
|
3177
3217
|
continue;
|
|
3178
3218
|
if (!this.runsInOwnRunner(entry))
|
|
3179
3219
|
continue;
|
|
3180
|
-
const runnerId = resolveRunnerId(entry.declaration, id);
|
|
3220
|
+
const runnerId = (0, types_1.resolveRunnerId)(entry.declaration, id);
|
|
3181
3221
|
const bucket = plan.get(runnerId) ?? [];
|
|
3182
3222
|
bucket.push({ addonId: id, addonDir: entry.addonDir });
|
|
3183
3223
|
plan.set(runnerId, bucket);
|
|
@@ -3198,11 +3238,11 @@ export class AddonRegistryService {
|
|
|
3198
3238
|
runsInOwnRunner(entry) {
|
|
3199
3239
|
if (!entry.declaration || !entry.addonDir)
|
|
3200
3240
|
return false;
|
|
3201
|
-
if (resolveAddonPlacement(entry.declaration) === 'agent-only')
|
|
3241
|
+
if ((0, types_1.resolveAddonPlacement)(entry.declaration) === 'agent-only')
|
|
3202
3242
|
return false;
|
|
3203
3243
|
if (entry.packageName !== '@camstack/system')
|
|
3204
3244
|
return true;
|
|
3205
|
-
return isIsolatedBuiltin(entry.declaration);
|
|
3245
|
+
return (0, types_1.isIsolatedBuiltin)(entry.declaration);
|
|
3206
3246
|
}
|
|
3207
3247
|
/**
|
|
3208
3248
|
* Spawn ONE runner subprocess that hosts every addon in `addons` and
|
|
@@ -3240,7 +3280,7 @@ export class AddonRegistryService {
|
|
|
3240
3280
|
// Unserialized the loser almost never got here — it spawned a SECOND
|
|
3241
3281
|
// runner instead, which is the defect. Serializing makes the loser
|
|
3242
3282
|
// reliable, so the promise has to be kept rather than documented.
|
|
3243
|
-
if (!/already running/i.test(errMsg(err)))
|
|
3283
|
+
if (!/already running/i.test((0, types_1.errMsg)(err)))
|
|
3244
3284
|
throw err;
|
|
3245
3285
|
this.logger.info('initializeAddonGroup: runner already running — nothing to spawn', {
|
|
3246
3286
|
meta: { runnerId, addonIds: addons.map((a) => a.addonId) },
|
|
@@ -3249,7 +3289,7 @@ export class AddonRegistryService {
|
|
|
3249
3289
|
});
|
|
3250
3290
|
}
|
|
3251
3291
|
catch (err) {
|
|
3252
|
-
throw new Error(`Failed to spawn runner "${runnerId}" (${addons.length} addons): ${errMsg(err)}`, { cause: err });
|
|
3292
|
+
throw new Error(`Failed to spawn runner "${runnerId}" (${addons.length} addons): ${(0, types_1.errMsg)(err)}`, { cause: err });
|
|
3253
3293
|
}
|
|
3254
3294
|
// Provider registration for cap methods is handled by
|
|
3255
3295
|
// `CapabilityBridge.onProviderConnected` once the runner's INFO heartbeat
|
|
@@ -3290,7 +3330,7 @@ export class AddonRegistryService {
|
|
|
3290
3330
|
}
|
|
3291
3331
|
catch (err) {
|
|
3292
3332
|
this.logger.warn('could not list the runner processes - addon process state is unknown', {
|
|
3293
|
-
meta: { error: errMsg(err) },
|
|
3333
|
+
meta: { error: (0, types_1.errMsg)(err) },
|
|
3294
3334
|
});
|
|
3295
3335
|
return null;
|
|
3296
3336
|
}
|
|
@@ -3354,13 +3394,13 @@ export class AddonRegistryService {
|
|
|
3354
3394
|
* two live episodes this closes and why the lock inside `process-service`
|
|
3355
3395
|
* could not.
|
|
3356
3396
|
*/
|
|
3357
|
-
serializeRunner = createRunnerSerializer();
|
|
3397
|
+
serializeRunner = (0, runner_serialization_1.createRunnerSerializer)();
|
|
3358
3398
|
async ensureForkedRunner(addonId, opts) {
|
|
3359
3399
|
const entry = this.addonEntries.get(addonId);
|
|
3360
3400
|
if (!entry?.declaration || !entry.addonDir) {
|
|
3361
3401
|
throw new Error(`ensureForkedRunner("${addonId}") requires an on-disk forked addon`);
|
|
3362
3402
|
}
|
|
3363
|
-
const runnerId = resolveRunnerId(entry.declaration, addonId);
|
|
3403
|
+
const runnerId = (0, types_1.resolveRunnerId)(entry.declaration, addonId);
|
|
3364
3404
|
const roster = this.buildAddonGroupPlan([...this.addonEntries.keys()]).get(runnerId) ?? [
|
|
3365
3405
|
{ addonId, addonDir: entry.addonDir },
|
|
3366
3406
|
];
|
|
@@ -3383,12 +3423,12 @@ export class AddonRegistryService {
|
|
|
3383
3423
|
// action atomic, and the unit that matters is the sequence.
|
|
3384
3424
|
return this.serializeRunner(runnerId, async () => {
|
|
3385
3425
|
const running = await this.listRunnerProcesses();
|
|
3386
|
-
const plan = planRunnerConvergence(runnerId, roster.map((r) => r.addonId), running, { restart: effectiveRestart });
|
|
3426
|
+
const plan = (0, runner_convergence_1.planRunnerConvergence)(runnerId, roster.map((r) => r.addonId), running, { restart: effectiveRestart });
|
|
3387
3427
|
// 1. Tear down every stale/mismatched runner that hosts a roster member.
|
|
3388
3428
|
for (const name of plan.stop) {
|
|
3389
3429
|
await this.broker.call('$process.stop', { name }).catch((err) => {
|
|
3390
3430
|
this.logger.warn('ensureForkedRunner: failed to stop stale runner (continuing)', {
|
|
3391
|
-
meta: { runnerId, stale: name, error: errMsg(err) },
|
|
3431
|
+
meta: { runnerId, stale: name, error: (0, types_1.errMsg)(err) },
|
|
3392
3432
|
});
|
|
3393
3433
|
});
|
|
3394
3434
|
}
|
|
@@ -3399,7 +3439,7 @@ export class AddonRegistryService {
|
|
|
3399
3439
|
.catch((err) => {
|
|
3400
3440
|
// A concurrent path may have won the spawn race — treat "already
|
|
3401
3441
|
// running" as success (idempotent), rethrow anything else.
|
|
3402
|
-
if (!/already running/i.test(errMsg(err)))
|
|
3442
|
+
if (!/already running/i.test((0, types_1.errMsg)(err)))
|
|
3403
3443
|
throw err;
|
|
3404
3444
|
});
|
|
3405
3445
|
this.recentGroupRespawns.set(runnerId, Date.now());
|
|
@@ -3459,7 +3499,7 @@ export class AddonRegistryService {
|
|
|
3459
3499
|
const catalogs = child.customActions;
|
|
3460
3500
|
if (catalogs === undefined)
|
|
3461
3501
|
return;
|
|
3462
|
-
const fingerprint = childCatalogsFingerprint(catalogs);
|
|
3502
|
+
const fingerprint = (0, forked_custom_actions_js_1.childCatalogsFingerprint)(catalogs);
|
|
3463
3503
|
if (this.childCatalogFingerprints.get(child.childId) === fingerprint)
|
|
3464
3504
|
return;
|
|
3465
3505
|
this.childCatalogFingerprints.set(child.childId, fingerprint);
|
|
@@ -3474,9 +3514,9 @@ export class AddonRegistryService {
|
|
|
3474
3514
|
this.customActionRegistry.unregisterAddon(addonId);
|
|
3475
3515
|
continue;
|
|
3476
3516
|
}
|
|
3477
|
-
this.customActionRegistry.registerAddon(addonId, toForkedCustomActionsSpec(descriptor), (action, input, caller) => this.dispatchForkedCustomAction(addonId, action, input, caller));
|
|
3517
|
+
this.customActionRegistry.registerAddon(addonId, (0, forked_custom_actions_js_1.toForkedCustomActionsSpec)(descriptor), (action, input, caller) => this.dispatchForkedCustomAction(addonId, action, input, caller));
|
|
3478
3518
|
}
|
|
3479
|
-
const summary = summarizeChildCatalogs(catalogs);
|
|
3519
|
+
const summary = (0, forked_custom_actions_js_1.summarizeChildCatalogs)(catalogs);
|
|
3480
3520
|
this.logger.info('UDS child custom-action catalogs applied', {
|
|
3481
3521
|
meta: {
|
|
3482
3522
|
childId: child.childId,
|
|
@@ -3504,3 +3544,4 @@ export class AddonRegistryService {
|
|
|
3504
3544
|
});
|
|
3505
3545
|
}
|
|
3506
3546
|
}
|
|
3547
|
+
exports.AddonRegistryService = AddonRegistryService;
|