@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,3 +1,42 @@
|
|
|
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.KNOWN_ELECTRON_APP_IDS = exports.ADDON_SCOPE = exports.ADDONS_SUBDIR = void 0;
|
|
37
|
+
exports.candidateDataRoots = candidateDataRoots;
|
|
38
|
+
exports.inventoryAddonRoots = inventoryAddonRoots;
|
|
39
|
+
exports.formatAddonRootReport = formatAddonRootReport;
|
|
1
40
|
/**
|
|
2
41
|
* Boot-time inventory of RIVAL ADDON ROOTS — the addon-shaped companion to
|
|
3
42
|
* `package-inventory.ts` (D45).
|
|
@@ -35,11 +74,11 @@
|
|
|
35
74
|
* Pure by construction: the caller injects every filesystem operation, so the
|
|
36
75
|
* whole thing is asserted against a described layout rather than a real disk.
|
|
37
76
|
*/
|
|
38
|
-
|
|
77
|
+
const path = __importStar(require("node:path"));
|
|
39
78
|
/** The one directory under a data root that holds installed addons. */
|
|
40
|
-
|
|
79
|
+
exports.ADDONS_SUBDIR = 'addons';
|
|
41
80
|
/** The scope every first-party addon package sits under. */
|
|
42
|
-
|
|
81
|
+
exports.ADDON_SCOPE = '@camstack';
|
|
43
82
|
/**
|
|
44
83
|
* Data roots a camstack node has ever been configured to use on this machine.
|
|
45
84
|
*
|
|
@@ -55,8 +94,8 @@ export const ADDON_SCOPE = '@camstack';
|
|
|
55
94
|
* A new app id must be ADDED here when it ships, and an id must never be
|
|
56
95
|
* removed when it is retired — a retired id is exactly what this looks for.
|
|
57
96
|
*/
|
|
58
|
-
|
|
59
|
-
|
|
97
|
+
exports.KNOWN_ELECTRON_APP_IDS = ['electron', 'electron-agent', 'desktop'];
|
|
98
|
+
function candidateDataRoots(input) {
|
|
60
99
|
if (input.homeDir.length === 0)
|
|
61
100
|
return [];
|
|
62
101
|
const appSupport = input.platform === 'darwin'
|
|
@@ -65,8 +104,8 @@ export function candidateDataRoots(input) {
|
|
|
65
104
|
const roots = [
|
|
66
105
|
path.join(input.homeDir, 'camstack-agent-data'),
|
|
67
106
|
path.join(input.homeDir, 'camstack-data'),
|
|
68
|
-
...KNOWN_ELECTRON_APP_IDS.map((id) => path.join(appSupport, ADDON_SCOPE, id, 'data')),
|
|
69
|
-
path.join(appSupport, ADDON_SCOPE, 'electron-agent', 'agent-data'),
|
|
107
|
+
...exports.KNOWN_ELECTRON_APP_IDS.map((id) => path.join(appSupport, exports.ADDON_SCOPE, id, 'data')),
|
|
108
|
+
path.join(appSupport, exports.ADDON_SCOPE, 'electron-agent', 'agent-data'),
|
|
70
109
|
];
|
|
71
110
|
const seen = new Set();
|
|
72
111
|
return roots.filter((r) => {
|
|
@@ -78,13 +117,13 @@ export function candidateDataRoots(input) {
|
|
|
78
117
|
}
|
|
79
118
|
/** Up to this many `name@version` pairs are sampled per rival root. */
|
|
80
119
|
const SAMPLE_SIZE = 4;
|
|
81
|
-
|
|
82
|
-
const activeScopeDir = path.join(input.activeAddonsDir, ADDON_SCOPE);
|
|
120
|
+
function inventoryAddonRoots(input, fs, candidates = candidateDataRoots(input)) {
|
|
121
|
+
const activeScopeDir = path.join(input.activeAddonsDir, exports.ADDON_SCOPE);
|
|
83
122
|
const activeReal = fs.exists(activeScopeDir) ? fs.realPath(activeScopeDir) : activeScopeDir;
|
|
84
123
|
const rivals = [];
|
|
85
124
|
const seenReal = new Set([activeReal]);
|
|
86
125
|
for (const root of candidates) {
|
|
87
|
-
const scopeDir = path.join(root, ADDONS_SUBDIR, ADDON_SCOPE);
|
|
126
|
+
const scopeDir = path.join(root, exports.ADDONS_SUBDIR, exports.ADDON_SCOPE);
|
|
88
127
|
if (!fs.exists(scopeDir))
|
|
89
128
|
continue;
|
|
90
129
|
// A symlink or bind pointing back at the live tree is the SAME root, not a
|
|
@@ -106,7 +145,7 @@ export function inventoryAddonRoots(input, fs, candidates = candidateDataRoots(i
|
|
|
106
145
|
* The loud report. Empty string when this machine has ONE addon root — a clean
|
|
107
146
|
* node says nothing, so the one that isn't stands out instead of scrolling past.
|
|
108
147
|
*/
|
|
109
|
-
|
|
148
|
+
function formatAddonRootReport(inventory) {
|
|
110
149
|
if (inventory.rivals.length === 0)
|
|
111
150
|
return '';
|
|
112
151
|
const lines = [
|
package/dist/agent/addon-scan.js
CHANGED
|
@@ -1,3 +1,41 @@
|
|
|
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.BUILTINS_PACKAGE = void 0;
|
|
37
|
+
exports.resolveAddonPackageDirs = resolveAddonPackageDirs;
|
|
38
|
+
exports.planAgentAddonScan = planAgentAddonScan;
|
|
1
39
|
/**
|
|
2
40
|
* Which directories the agent scans for addons — decided as pure data.
|
|
3
41
|
*
|
|
@@ -32,10 +70,10 @@
|
|
|
32
70
|
* (`assertRequiredInfraResolved`, which names every missing required cap),
|
|
33
71
|
* never through a silent "no addon packages found" early return.
|
|
34
72
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
73
|
+
const fs = __importStar(require("node:fs"));
|
|
74
|
+
const path = __importStar(require("node:path"));
|
|
37
75
|
/** The framework builtins package. Loaded from the closure, never from a copy. */
|
|
38
|
-
|
|
76
|
+
exports.BUILTINS_PACKAGE = '@camstack/system';
|
|
39
77
|
function isDir(p) {
|
|
40
78
|
try {
|
|
41
79
|
return fs.statSync(p).isDirectory();
|
|
@@ -51,7 +89,7 @@ function isDir(p) {
|
|
|
51
89
|
* `<scope>/<name>` for a scoped directory, the bare name for a flat one — so
|
|
52
90
|
* the hub and the agent exclude the same thing given the same list.
|
|
53
91
|
*/
|
|
54
|
-
|
|
92
|
+
function resolveAddonPackageDirs(addonsDir, skipPackages = []) {
|
|
55
93
|
const dirs = [];
|
|
56
94
|
if (!fs.existsSync(addonsDir))
|
|
57
95
|
return dirs;
|
|
@@ -83,11 +121,11 @@ export function resolveAddonPackageDirs(addonsDir, skipPackages = []) {
|
|
|
83
121
|
* `closureSystemDir` is `resolveHubClosurePackageDir(BUILTINS_PACKAGE)` — null
|
|
84
122
|
* only when the builtins are not resolvable from the running closure at all.
|
|
85
123
|
*/
|
|
86
|
-
|
|
124
|
+
function planAgentAddonScan(addonsDir, closureSystemDir) {
|
|
87
125
|
if (closureSystemDir === null) {
|
|
88
126
|
// No closure copy: fall back to whatever is on disk, including the
|
|
89
127
|
// addon-root builtins, rather than booting with no infra at all.
|
|
90
128
|
return resolveAddonPackageDirs(addonsDir);
|
|
91
129
|
}
|
|
92
|
-
return [closureSystemDir, ...resolveAddonPackageDirs(addonsDir, [BUILTINS_PACKAGE])];
|
|
130
|
+
return [closureSystemDir, ...resolveAddonPackageDirs(addonsDir, [exports.BUILTINS_PACKAGE])];
|
|
93
131
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* ONE list for the agent UI: every addon on this node with the runner that
|
|
3
4
|
* hosts it (D841). It used to be two lists — `$agent.status` addons and
|
|
@@ -10,6 +11,10 @@
|
|
|
10
11
|
* `addonIds`. A runner hosting no known addon is still a row, so a stray
|
|
11
12
|
* process stays visible.
|
|
12
13
|
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.joinAddonRuntime = joinAddonRuntime;
|
|
16
|
+
exports.addonsFromStatus = addonsFromStatus;
|
|
17
|
+
exports.processesFromList = processesFromList;
|
|
13
18
|
function toRunner(p) {
|
|
14
19
|
return {
|
|
15
20
|
name: p.name,
|
|
@@ -22,7 +27,7 @@ function toRunner(p) {
|
|
|
22
27
|
addonIds: p.addonIds,
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
|
-
|
|
30
|
+
function joinAddonRuntime(addons, processes) {
|
|
26
31
|
const runnerByAddon = new Map();
|
|
27
32
|
for (const p of processes) {
|
|
28
33
|
for (const id of p.addonIds) {
|
|
@@ -63,7 +68,7 @@ function num(value) {
|
|
|
63
68
|
return typeof value === 'number' && Number.isFinite(value) ? value : 0;
|
|
64
69
|
}
|
|
65
70
|
/** The addon rows of an `$agent.status` answer; unreadable rows are skipped. */
|
|
66
|
-
|
|
71
|
+
function addonsFromStatus(status) {
|
|
67
72
|
const raw = status !== null && typeof status === 'object' ? Reflect.get(status, 'addons') : null;
|
|
68
73
|
if (!Array.isArray(raw))
|
|
69
74
|
return [];
|
|
@@ -86,7 +91,7 @@ export function addonsFromStatus(status) {
|
|
|
86
91
|
return out;
|
|
87
92
|
}
|
|
88
93
|
/** The runners of a `$process.list` answer; unreadable rows are skipped. */
|
|
89
|
-
|
|
94
|
+
function processesFromList(list) {
|
|
90
95
|
if (!Array.isArray(list))
|
|
91
96
|
return [];
|
|
92
97
|
const out = [];
|
|
@@ -1,3 +1,43 @@
|
|
|
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.DEFAULT_NPM_REGISTRY = void 0;
|
|
37
|
+
exports.readInstalledAddonPackages = readInstalledAddonPackages;
|
|
38
|
+
exports.buildAddonUpdateEntries = buildAddonUpdateEntries;
|
|
39
|
+
exports.resolvePublishedVersion = resolvePublishedVersion;
|
|
40
|
+
exports.buildAgentAddonUpdateReport = buildAgentAddonUpdateReport;
|
|
1
41
|
/**
|
|
2
42
|
* Agent-local addon ALIGNMENT report — "is this node behind?", answered
|
|
3
43
|
* WITHOUT the hub.
|
|
@@ -14,12 +54,12 @@
|
|
|
14
54
|
* This module answers the read half: *which of my addons are behind the
|
|
15
55
|
* published release?* The hub-version half is joined in by the routes.
|
|
16
56
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
57
|
+
const fs = __importStar(require("node:fs"));
|
|
58
|
+
const path = __importStar(require("node:path"));
|
|
59
|
+
const index_js_1 = require("../server-root/index.js");
|
|
60
|
+
const addon_scan_js_1 = require("./addon-scan.js");
|
|
21
61
|
/** Default public registry, matching `AddonInstaller.downloadNpmTarball`. */
|
|
22
|
-
|
|
62
|
+
exports.DEFAULT_NPM_REGISTRY = 'https://registry.npmjs.org';
|
|
23
63
|
/** Read `<dir>/package.json`'s `name` + `version`, tolerating a broken file. */
|
|
24
64
|
function readPackageIdentity(dir) {
|
|
25
65
|
try {
|
|
@@ -44,9 +84,9 @@ function readPackageIdentity(dir) {
|
|
|
44
84
|
* is the only copy of the builtin infra (D87), so it is exactly the package an
|
|
45
85
|
* operator needs to see the version of when a node is misaligned.
|
|
46
86
|
*/
|
|
47
|
-
|
|
87
|
+
function readInstalledAddonPackages(addonsDir) {
|
|
48
88
|
const found = [];
|
|
49
|
-
for (const dir of resolveAddonPackageDirs(addonsDir)) {
|
|
89
|
+
for (const dir of (0, addon_scan_js_1.resolveAddonPackageDirs)(addonsDir)) {
|
|
50
90
|
const identity = readPackageIdentity(dir);
|
|
51
91
|
if (identity !== null)
|
|
52
92
|
found.push(identity);
|
|
@@ -60,13 +100,13 @@ export function readInstalledAddonPackages(addonsDir) {
|
|
|
60
100
|
* to be strictly newer. An unknown published version is never "up to date"
|
|
61
101
|
* and never "behind" — it is unknown, and carries its error into the row.
|
|
62
102
|
*/
|
|
63
|
-
|
|
103
|
+
function buildAddonUpdateEntries(installed, published) {
|
|
64
104
|
return installed.map((pkg) => {
|
|
65
105
|
const latest = published.get(pkg.packageName);
|
|
66
106
|
const latestVersion = latest?.latestVersion ?? null;
|
|
67
107
|
const updateAvailable = latestVersion !== null &&
|
|
68
108
|
pkg.installedVersion !== null &&
|
|
69
|
-
compareSemver(latestVersion, pkg.installedVersion) > 0;
|
|
109
|
+
(0, index_js_1.compareSemver)(latestVersion, pkg.installedVersion) > 0;
|
|
70
110
|
return {
|
|
71
111
|
packageName: pkg.packageName,
|
|
72
112
|
installedVersion: pkg.installedVersion,
|
|
@@ -84,7 +124,7 @@ export function buildAddonUpdateEntries(installed, published) {
|
|
|
84
124
|
* Never throws: a failure becomes `{ latestVersion: null, error }` so one
|
|
85
125
|
* unreachable package cannot blank the whole report.
|
|
86
126
|
*/
|
|
87
|
-
|
|
127
|
+
async function resolvePublishedVersion(packageName, registryUrl, fetchFn) {
|
|
88
128
|
const base = registryUrl.replace(/\/+$/, '');
|
|
89
129
|
const url = `${base}/${encodeURIComponent(packageName).replace(/^%40/, '@')}`;
|
|
90
130
|
try {
|
|
@@ -108,9 +148,9 @@ export async function resolvePublishedVersion(packageName, registryUrl, fetchFn)
|
|
|
108
148
|
* distinguishing it from a single 404 is what stops the UI claiming a node is
|
|
109
149
|
* aligned when it simply could not ask.
|
|
110
150
|
*/
|
|
111
|
-
|
|
151
|
+
async function buildAgentAddonUpdateReport(input) {
|
|
112
152
|
const now = input.now ?? Date.now;
|
|
113
|
-
const registryUrl = input.registryUrl ?? DEFAULT_NPM_REGISTRY;
|
|
153
|
+
const registryUrl = input.registryUrl ?? exports.DEFAULT_NPM_REGISTRY;
|
|
114
154
|
const installed = readInstalledAddonPackages(input.addonsDir);
|
|
115
155
|
const published = new Map();
|
|
116
156
|
const resolved = await Promise.all(installed.map(async (pkg) => ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* Slice-5, Task 6 — agent-side Moleculer service for forwarding hub-dispatched
|
|
3
4
|
* cap calls to the agent's forked UDS children.
|
|
@@ -8,7 +9,9 @@
|
|
|
8
9
|
* receives those calls, resolves the child locally via the agent's
|
|
9
10
|
* `LocalChildRegistry`, and forwards the call over UDS.
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.createAgentCapDispatchService = createAgentCapDispatchService;
|
|
14
|
+
const system_1 = require("@camstack/system");
|
|
12
15
|
// ---------------------------------------------------------------------------
|
|
13
16
|
// ctx.params narrowing helpers
|
|
14
17
|
// ---------------------------------------------------------------------------
|
|
@@ -56,7 +59,7 @@ function narrowParams(raw) {
|
|
|
56
59
|
*/
|
|
57
60
|
function createAgentCapDispatchService(agentNodeId, agentUdsRegistry, inProcessLookup, logger) {
|
|
58
61
|
return {
|
|
59
|
-
name: AGENT_CAP_FWD_SERVICE,
|
|
62
|
+
name: system_1.AGENT_CAP_FWD_SERVICE,
|
|
60
63
|
actions: {
|
|
61
64
|
forward: {
|
|
62
65
|
handler: async (ctx) => {
|
|
@@ -96,4 +99,3 @@ function createAgentCapDispatchService(agentNodeId, agentUdsRegistry, inProcessL
|
|
|
96
99
|
},
|
|
97
100
|
};
|
|
98
101
|
}
|
|
99
|
-
export { createAgentCapDispatchService };
|
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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.loadAgentConfig = loadAgentConfig;
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const crypto = __importStar(require("node:crypto"));
|
|
40
|
+
const os = __importStar(require("node:os"));
|
|
41
|
+
const node_1 = require("@camstack/types/node");
|
|
6
42
|
/**
|
|
7
43
|
* Generate a stable nodeId and persist it to the config file.
|
|
8
44
|
*
|
|
@@ -38,7 +74,7 @@ function ensurePersistedNodeId(configPath, dataDir) {
|
|
|
38
74
|
raw.nodeId = id;
|
|
39
75
|
try {
|
|
40
76
|
// Owner-only: the same file holds the agent's private mesh key.
|
|
41
|
-
writeOwnerOnlyFileSync(resolvedPath, JSON.stringify(raw, null, 2));
|
|
77
|
+
(0, node_1.writeOwnerOnlyFileSync)(resolvedPath, JSON.stringify(raw, null, 2));
|
|
42
78
|
}
|
|
43
79
|
catch {
|
|
44
80
|
/* best-effort */
|
|
@@ -103,4 +139,3 @@ function loadAgentConfig(configPath, dataDirOverride) {
|
|
|
103
139
|
statusPort: Number(process.env.CAMSTACK_STATUS_PORT) || 4444,
|
|
104
140
|
};
|
|
105
141
|
}
|
|
106
|
-
export { loadAgentConfig };
|
|
@@ -1,6 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.applyDeployedBundle = applyDeployedBundle;
|
|
37
|
+
const fs = __importStar(require("node:fs"));
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const node_crypto_1 = require("node:crypto");
|
|
4
40
|
/** Recursively remove a path, ignoring a missing target. */
|
|
5
41
|
function rmrf(target) {
|
|
6
42
|
fs.rmSync(target, { recursive: true, force: true });
|
|
@@ -41,7 +77,7 @@ function moveDir(from, to) {
|
|
|
41
77
|
*
|
|
42
78
|
* @returns the live addon directory path (`<addonsDir>/<addonId>`).
|
|
43
79
|
*/
|
|
44
|
-
|
|
80
|
+
async function applyDeployedBundle(input) {
|
|
45
81
|
const { addonsDir, addonId, bundle, extract, logger } = input;
|
|
46
82
|
fs.mkdirSync(addonsDir, { recursive: true });
|
|
47
83
|
const liveDir = path.join(addonsDir, addonId);
|
|
@@ -52,7 +88,7 @@ export async function applyDeployedBundle(input) {
|
|
|
52
88
|
const liveParent = path.dirname(liveDir);
|
|
53
89
|
const liveBase = path.basename(liveDir);
|
|
54
90
|
fs.mkdirSync(liveParent, { recursive: true });
|
|
55
|
-
const token = randomBytes(6).toString('hex');
|
|
91
|
+
const token = (0, node_crypto_1.randomBytes)(6).toString('hex');
|
|
56
92
|
const nextDir = path.join(liveParent, `.${liveBase}.next.${token}`);
|
|
57
93
|
const backupDir = path.join(liveParent, `.${liveBase}.backup.${token}`);
|
|
58
94
|
// 1. Extract into a temp dir. If extraction throws (e.g. a killed untar),
|
|
@@ -1,6 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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.readPackageManifestAddons = readPackageManifestAddons;
|
|
37
|
+
exports.isGroupRunnerAddon = isGroupRunnerAddon;
|
|
38
|
+
exports.registerGroupRunnerProviders = registerGroupRunnerProviders;
|
|
39
|
+
exports.ensureGroupRunner = ensureGroupRunner;
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
41
|
+
const path = __importStar(require("node:path"));
|
|
42
|
+
const types_1 = require("@camstack/types");
|
|
4
43
|
/**
|
|
5
44
|
* Read a package's `camstack.addons[]` declarations directly from its
|
|
6
45
|
* package.json — WITHOUT importing the addon entry module.
|
|
@@ -13,7 +52,7 @@ import { resolveAddonPlacement } from '@camstack/types';
|
|
|
13
52
|
* capabilities, execution) to be (re)dispatched to a runner SUBPROCESS, which
|
|
14
53
|
* loads the real module itself. Returns null on a missing/corrupt manifest.
|
|
15
54
|
*/
|
|
16
|
-
|
|
55
|
+
function readPackageManifestAddons(dir) {
|
|
17
56
|
try {
|
|
18
57
|
const pkgPath = path.join(dir, 'package.json');
|
|
19
58
|
if (!fs.existsSync(pkgPath))
|
|
@@ -50,8 +89,8 @@ export function readPackageManifestAddons(dir) {
|
|
|
50
89
|
* is hub-only and not a group-runner addon — and, being hub-only, is never
|
|
51
90
|
* deployable to an agent in the first place.
|
|
52
91
|
*/
|
|
53
|
-
|
|
54
|
-
return decl.execution !== undefined && resolveAddonPlacement(decl) !== 'hub-only';
|
|
92
|
+
function isGroupRunnerAddon(decl) {
|
|
93
|
+
return decl.execution !== undefined && (0, types_1.resolveAddonPlacement)(decl) !== 'hub-only';
|
|
55
94
|
}
|
|
56
95
|
/**
|
|
57
96
|
* Register the broker-call cap proxies + `loadedAddons` bookkeeping for a group
|
|
@@ -60,7 +99,7 @@ export function isGroupRunnerAddon(decl) {
|
|
|
60
99
|
* ONE implementation — preventing the two from drifting (the original cause of
|
|
61
100
|
* the in-process-reload wedge).
|
|
62
101
|
*/
|
|
63
|
-
|
|
102
|
+
function registerGroupRunnerProviders(deps, addons) {
|
|
64
103
|
for (const a of addons) {
|
|
65
104
|
for (const cap of a.capabilities) {
|
|
66
105
|
const capName = typeof cap === 'string' ? cap : cap.name;
|
|
@@ -111,7 +150,7 @@ export function registerGroupRunnerProviders(deps, addons) {
|
|
|
111
150
|
* On a hard failure of both paths the addons are marked `error` (no providers
|
|
112
151
|
* registered) so `$agent.status` reports the degraded state.
|
|
113
152
|
*/
|
|
114
|
-
|
|
153
|
+
async function ensureGroupRunner(deps, groupId, addons) {
|
|
115
154
|
try {
|
|
116
155
|
const restart = await deps.broker.call('$process.restart', { name: groupId });
|
|
117
156
|
if (!restart.success) {
|