@camstack/server 1.2.592 → 1.2.594
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addon-root-inventory.js +11 -50
- package/dist/agent/addon-scan.js +6 -44
- package/dist/agent/agent-addon-runtime.js +3 -8
- package/dist/agent/agent-addon-updates.js +12 -52
- package/dist/agent/agent-cap-dispatch-service.js +3 -5
- package/dist/agent/agent-config.js +7 -42
- package/dist/agent/agent-deploy-swap.js +5 -41
- package/dist/agent/agent-group-runner.js +8 -47
- package/dist/agent/agent-http-auth.js +10 -22
- package/dist/agent/agent-http.js +69 -115
- package/dist/agent/agent-hub-addon-update.js +10 -16
- package/dist/agent/agent-hub-registration.js +4 -7
- package/dist/agent/agent-infra-capabilities.js +5 -9
- package/dist/agent/agent-json-file.js +5 -42
- package/dist/agent/agent-mesh-gate.js +5 -8
- package/dist/agent/agent-node-certificates.js +25 -28
- package/dist/agent/agent-pairing-local.js +10 -47
- package/dist/agent/agent-pairing-routes.js +16 -20
- package/dist/agent/agent-pairing-store.js +18 -58
- package/dist/agent/agent-reconnect.js +1 -4
- package/dist/agent/agent-service.js +42 -78
- package/dist/agent/agent-sniffing-listener.js +11 -48
- package/dist/agent/agent-undeploy.js +5 -41
- package/dist/agent/agent-update-routes.js +14 -19
- package/dist/agent/agent-update-service.js +38 -80
- package/dist/agent/apply-model-distribution.js +1 -4
- package/dist/agent/apply-stage-dev-uploads.js +6 -9
- package/dist/agent/derive-hub-url.js +3 -8
- package/dist/agent/fetch-bundle-from-hub.js +6 -9
- package/dist/agent/hubs-found.js +6 -43
- package/dist/agent/infra-boot-guard.js +1 -4
- package/dist/agent/infra-boot-plan.js +2 -6
- package/dist/agent/main.js +158 -186
- package/dist/agent/register-agent-cap-dispatch.js +3 -6
- package/dist/agent/serial-queue.js +2 -7
- package/dist/agent-status-page.js +1 -4
- package/dist/api/addon-upload.js +22 -61
- package/dist/api/agent-addon-delivery.js +6 -11
- package/dist/api/auth-whoami.js +1 -4
- package/dist/api/backup-download-pump.js +5 -9
- package/dist/api/backup-download.js +7 -10
- package/dist/api/core/addon-settings.router.js +16 -19
- package/dist/api/core/agent-pairing.router.js +76 -79
- package/dist/api/core/agents.router.js +21 -24
- package/dist/api/core/auth-admin-tokens.procedures.js +48 -52
- package/dist/api/core/auth-device-cert.procedures.js +62 -67
- package/dist/api/core/auth-limits.js +16 -25
- package/dist/api/core/auth-reauth.procedures.js +32 -37
- package/dist/api/core/auth-revoke-credentials.procedures.js +22 -26
- package/dist/api/core/auth-sessions.procedures.js +52 -56
- package/dist/api/core/auth.router.js +300 -304
- package/dist/api/core/cap-providers.js +74 -121
- package/dist/api/core/capabilities.router.js +34 -37
- package/dist/api/core/capability-preference-writes.js +10 -17
- package/dist/api/core/certificates.router.js +106 -109
- package/dist/api/core/cluster-nodes.router.js +15 -18
- package/dist/api/core/collection-preference.js +2 -6
- package/dist/api/core/event-bus-proxy.router.js +34 -37
- package/dist/api/core/failure-contributions.js +4 -8
- package/dist/api/core/hwaccel.router.js +17 -20
- package/dist/api/core/integration-secrets.js +8 -12
- package/dist/api/core/lifecycle-job-runner.js +13 -49
- package/dist/api/core/live-events.router.js +29 -32
- package/dist/api/core/load-contributions.js +4 -8
- package/dist/api/core/logging-settings.js +30 -43
- package/dist/api/core/logs.router.js +40 -43
- package/dist/api/core/notifications.router.js +15 -18
- package/dist/api/core/public-event-filter.js +4 -8
- package/dist/api/core/repl.router.js +18 -21
- package/dist/api/core/request-census-settings.js +11 -16
- package/dist/api/core/server-management.provider.js +1 -4
- package/dist/api/core/server-name.js +9 -17
- package/dist/api/core/site-location.js +16 -24
- package/dist/api/core/stream-probe.router.js +21 -24
- package/dist/api/core/system-events.router.js +23 -26
- package/dist/api/cors/cors-policy.js +20 -29
- package/dist/api/cors/register-cors-policy.js +9 -14
- package/dist/api/deploy-stage-registry.js +6 -10
- package/dist/api/dev-uploads-bundle.js +12 -50
- package/dist/api/health/adaptive-probe.routes.js +9 -13
- package/dist/api/health/health.routes.js +8 -13
- package/dist/api/hub-cluster-url.js +3 -9
- package/dist/api/model-distributor.js +12 -50
- package/dist/api/oauth2/consent-page.js +10 -13
- package/dist/api/oauth2/oauth2-routes.js +17 -25
- package/dist/api/oauth2/private-host.js +1 -4
- package/dist/api/server-upload-propagate.js +15 -51
- package/dist/api/server-upload.js +13 -50
- package/dist/api/sse-no-compression.js +1 -4
- package/dist/api/static/frame-policy.js +4 -9
- package/dist/api/static/precompressed-asset.js +15 -57
- package/dist/api/static/spa-mount.js +8 -47
- package/dist/api/static/spa-static.js +5 -12
- package/dist/api/tarball-manifest.js +7 -44
- package/dist/api/trpc/cap-mount-helpers.js +7 -12
- package/dist/api/trpc/cap-route-error-formatter.js +10 -13
- package/dist/api/trpc/cap-router-runtime.js +40 -51
- package/dist/api/trpc/client-ip.js +9 -20
- package/dist/api/trpc/core-cap-bridge.js +32 -42
- package/dist/api/trpc/device-collection-dispatch.js +23 -27
- package/dist/api/trpc/device-config-secret-redaction.js +24 -40
- package/dist/api/trpc/generated-cap-mounts.js +219 -221
- package/dist/api/trpc/generated-cap-routers.js +4878 -4726
- package/dist/api/trpc/http-request-census-hook.js +8 -11
- package/dist/api/trpc/http-request-census.js +34 -41
- package/dist/api/trpc/http-request-census.singleton.js +4 -8
- package/dist/api/trpc/localized-schema-paths.js +1 -4
- package/dist/api/trpc/principal-visibility.js +14 -22
- package/dist/api/trpc/remote-addon-update-grant.js +1 -4
- package/dist/api/trpc/scope-access.js +10 -15
- package/dist/api/trpc/server-provided-caps.js +3 -7
- package/dist/api/trpc/share-view-access.js +6 -14
- package/dist/api/trpc/trpc-error-device-tags.js +3 -6
- package/dist/api/trpc/trpc-error-principal.js +2 -6
- package/dist/api/trpc/trpc.context.js +20 -25
- package/dist/api/trpc/trpc.middleware.js +38 -46
- package/dist/api/trpc/trpc.router.js +58 -99
- package/dist/api/trpc/user-error.js +5 -8
- package/dist/api/trpc/ws-request-census.js +17 -24
- package/dist/api/trpc/ws-slow-consumer-guard.js +11 -16
- package/dist/api/upload-auth.js +5 -9
- package/dist/auth/addon-route-jwt-gate.js +4 -7
- package/dist/auth/addon-route-share-gate.js +7 -12
- package/dist/auth/app-confirm-page.js +17 -22
- package/dist/auth/app-confirm-routes.js +26 -31
- package/dist/auth/app-confirmations.js +7 -44
- package/dist/auth/app-page-shell.js +17 -30
- package/dist/auth/app-page-strings.js +11 -17
- package/dist/auth/app-passkey-page.js +16 -21
- package/dist/auth/app-passkey-routes.js +37 -41
- package/dist/auth/app-refused-route.js +13 -18
- package/dist/auth/auth-network-policy.js +11 -15
- package/dist/auth/auth-provider-gate.js +4 -9
- package/dist/auth/auth-rate-limit.js +3 -7
- package/dist/auth/client-address.js +6 -9
- package/dist/auth/device-enroll-proofs.js +6 -43
- package/dist/auth/external-link-intents.js +3 -7
- package/dist/auth/hub-sessions.js +6 -12
- package/dist/auth/native-link-completions.js +7 -11
- package/dist/auth/native-return.js +9 -13
- package/dist/auth/passkey-provider.js +26 -32
- package/dist/auth/second-factors.js +6 -10
- package/dist/auth/session-connections.js +6 -12
- package/dist/auth/session-cookie.js +12 -23
- package/dist/auth/session-lifetimes.js +8 -12
- package/dist/auth/session-mint.js +4 -11
- package/dist/auth/sso-finish-app.js +13 -16
- package/dist/auth/sso-finish-deps.js +21 -27
- package/dist/auth/sso-finish.js +28 -38
- package/dist/auth/sso-routes.js +22 -25
- package/dist/auth/used-bridge-ids.js +1 -5
- package/dist/boot/boot-config.js +16 -55
- package/dist/boot/init-sequence.js +1 -4
- package/dist/boot/integration-id-backfill.js +3 -8
- package/dist/boot/platform-keychain-key.js +5 -42
- package/dist/boot/post-boot.service.js +14 -18
- package/dist/boot/reconcile-lifecycle-jobs.js +3 -6
- package/dist/boot/retired-public-url-env.js +4 -8
- package/dist/bootstrap-packages.js +1 -4
- package/dist/closure-node-modules.js +2 -38
- package/dist/closure-patches/patch-reach.json +6 -2
- package/dist/core/addon/addon-call-gateway.js +1 -5
- package/dist/core/addon/addon-package.service.js +83 -123
- package/dist/core/addon/addon-process-view.js +2 -6
- package/dist/core/addon/addon-realign-plan.js +1 -4
- package/dist/core/addon/addon-registry.service.js +254 -197
- package/dist/core/addon/addon-row-manifest.js +1 -4
- package/dist/core/addon/addon-search.service.js +3 -7
- package/dist/core/addon/addon-settings-provider.js +1 -3
- package/dist/core/addon/addon-uninstall.js +4 -11
- package/dist/core/addon/addon.tokens.js +2 -5
- package/dist/core/addon/device-meta-mirror.js +8 -13
- package/dist/core/addon/forked-custom-actions.js +6 -11
- package/dist/core/addon/integration-visibility.js +3 -6
- package/dist/core/addon/materialize-route-path.js +1 -4
- package/dist/core/addon/package-dir-utils.js +8 -45
- package/dist/core/addon/prune-misplaced-addons.js +5 -43
- package/dist/core/addon/runner-convergence.js +1 -4
- package/dist/core/addon/runner-serialization.js +1 -4
- package/dist/core/addon/runner-spawn-fanout.js +3 -8
- package/dist/core/addon/settings-door-wiring.js +5 -8
- package/dist/core/addon/single-flight-refresh.js +1 -4
- package/dist/core/addon-bridge/addon-bridge.service.js +7 -44
- package/dist/core/addon-pages/addon-pages.service.js +3 -40
- package/dist/core/addon-widgets/addon-widgets.service.js +4 -42
- package/dist/core/agent/agent-addon-backfill.js +9 -17
- package/dist/core/agent/agent-delivery-ledger.js +3 -7
- package/dist/core/agent/agent-liveness-event.js +2 -6
- package/dist/core/agent/agent-pairing-http.js +41 -45
- package/dist/core/agent/agent-registry.service.js +53 -92
- package/dist/core/agent/cluster-node-history-mirror.js +3 -7
- package/dist/core/agent/cluster-node-history-store.js +113 -58
- package/dist/core/agent/hub-agent-pairing.js +1 -5
- package/dist/core/agent/node-certificates-client.js +3 -6
- package/dist/core/agent/node-directory.js +1 -4
- package/dist/core/app-links/well-known-app-links.js +2 -6
- package/dist/core/auth/auth.service.js +3 -8
- package/dist/core/auth/handoff-code.service.js +11 -49
- package/dist/core/auth/record-kinds.js +35 -0
- package/dist/core/auth/share-token.service.js +174 -122
- package/dist/core/capability/capability.service.js +1 -5
- package/dist/core/config/config.schema.js +1 -6
- package/dist/core/config/config.service.js +2 -6
- package/dist/core/events/event-bus.service.js +3 -7
- package/dist/core/feature/feature.service.js +2 -6
- package/dist/core/lifecycle/lifecycle-runner.singleton.js +5 -10
- package/dist/core/lifecycle/lifecycle-state-machine.js +1 -5
- package/dist/core/logging/log-ring-buffer.js +1 -5
- package/dist/core/logging/logging.service.js +5 -9
- package/dist/core/logging/scoped-logger.js +1 -5
- package/dist/core/moleculer/agent-readiness-pull.js +1 -4
- package/dist/core/moleculer/agent-registration-request.js +3 -7
- package/dist/core/moleculer/cap-call-fn.js +39 -5
- package/dist/core/moleculer/cap-route-authority.js +3 -8
- package/dist/core/moleculer/hub-mesh-guard.js +5 -9
- package/dist/core/moleculer/moleculer.service.js +108 -119
- package/dist/core/network/network-quality.service.js +2 -6
- package/dist/core/notification/notification-wrapper.service.js +3 -7
- package/dist/core/notification/toast-wrapper.service.js +3 -7
- package/dist/core/provider/provider.tokens.js +1 -4
- package/dist/core/repl/repl-engine.service.js +4 -8
- package/dist/core/runner-health/runner-boot-check.js +7 -15
- package/dist/core/runner-health/update-preflight.js +9 -14
- package/dist/core/server-update/server-update.service.js +12 -49
- package/dist/core/server-update/system-apply-closure-patches.js +6 -42
- package/dist/core/server-update/system-ensure-prebuilds.js +3 -6
- package/dist/core/server-update/system-exec-npm.js +2 -5
- package/dist/core/storage/fs-storage-backend.js +1 -5
- package/dist/core/storage/storage-location-manager.js +1 -5
- package/dist/core/storage/storage.service.js +2 -6
- package/dist/core/streaming/ffmpeg-stream-info.js +3 -8
- package/dist/core/streaming/stream-probe.service.js +12 -16
- package/dist/core/streaming/ttl-cache.js +1 -5
- package/dist/core/topology/topology-emitter.service.js +19 -23
- package/dist/core/update-availability-emitter.js +3 -7
- package/dist/core/update-availability-store.js +8 -45
- package/dist/core/updates/agent-installed-packages.js +5 -9
- package/dist/core/updates/restart-marker.js +3 -8
- package/dist/core/updates/update-check-scheduler.js +13 -18
- package/dist/core/updates/wrapper-update-checker.js +3 -7
- package/dist/first-boot-addon-plan.js +2 -6
- package/dist/framework-nodepath.js +2 -38
- package/dist/i18n/request-lang.js +7 -11
- package/dist/launcher.js +30 -65
- package/dist/lifecycle-journal-path.js +2 -38
- package/dist/main.js +287 -324
- package/dist/manual-boot.js +120 -157
- package/dist/node-role.js +1 -4
- package/dist/package-inventory.js +7 -48
- package/dist/pending-restore.js +7 -43
- package/dist/single-copy-cleanup-runner.js +9 -45
- package/dist/single-copy-cleanup.js +7 -15
- package/dist/sqlite-restore.js +9 -48
- package/dist/starter.js +4 -39
- package/dist/ui-serving/lazy-ui-serving.js +3 -39
- package/package.json +13 -13
|
@@ -1,42 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.KNOWN_ELECTRON_APP_IDS = exports.ADDON_SCOPE = exports.ADDONS_SUBDIR = void 0;
|
|
37
|
-
exports.candidateDataRoots = candidateDataRoots;
|
|
38
|
-
exports.inventoryAddonRoots = inventoryAddonRoots;
|
|
39
|
-
exports.formatAddonRootReport = formatAddonRootReport;
|
|
40
1
|
/**
|
|
41
2
|
* Boot-time inventory of RIVAL ADDON ROOTS — the addon-shaped companion to
|
|
42
3
|
* `package-inventory.ts` (D45).
|
|
@@ -74,11 +35,11 @@ exports.formatAddonRootReport = formatAddonRootReport;
|
|
|
74
35
|
* Pure by construction: the caller injects every filesystem operation, so the
|
|
75
36
|
* whole thing is asserted against a described layout rather than a real disk.
|
|
76
37
|
*/
|
|
77
|
-
|
|
38
|
+
import * as path from 'node:path';
|
|
78
39
|
/** The one directory under a data root that holds installed addons. */
|
|
79
|
-
|
|
40
|
+
export const ADDONS_SUBDIR = 'addons';
|
|
80
41
|
/** The scope every first-party addon package sits under. */
|
|
81
|
-
|
|
42
|
+
export const ADDON_SCOPE = '@camstack';
|
|
82
43
|
/**
|
|
83
44
|
* Data roots a camstack node has ever been configured to use on this machine.
|
|
84
45
|
*
|
|
@@ -94,8 +55,8 @@ exports.ADDON_SCOPE = '@camstack';
|
|
|
94
55
|
* A new app id must be ADDED here when it ships, and an id must never be
|
|
95
56
|
* removed when it is retired — a retired id is exactly what this looks for.
|
|
96
57
|
*/
|
|
97
|
-
|
|
98
|
-
function candidateDataRoots(input) {
|
|
58
|
+
export const KNOWN_ELECTRON_APP_IDS = ['electron', 'electron-agent', 'desktop'];
|
|
59
|
+
export function candidateDataRoots(input) {
|
|
99
60
|
if (input.homeDir.length === 0)
|
|
100
61
|
return [];
|
|
101
62
|
const appSupport = input.platform === 'darwin'
|
|
@@ -104,8 +65,8 @@ function candidateDataRoots(input) {
|
|
|
104
65
|
const roots = [
|
|
105
66
|
path.join(input.homeDir, 'camstack-agent-data'),
|
|
106
67
|
path.join(input.homeDir, 'camstack-data'),
|
|
107
|
-
...
|
|
108
|
-
path.join(appSupport,
|
|
68
|
+
...KNOWN_ELECTRON_APP_IDS.map((id) => path.join(appSupport, ADDON_SCOPE, id, 'data')),
|
|
69
|
+
path.join(appSupport, ADDON_SCOPE, 'electron-agent', 'agent-data'),
|
|
109
70
|
];
|
|
110
71
|
const seen = new Set();
|
|
111
72
|
return roots.filter((r) => {
|
|
@@ -117,13 +78,13 @@ function candidateDataRoots(input) {
|
|
|
117
78
|
}
|
|
118
79
|
/** Up to this many `name@version` pairs are sampled per rival root. */
|
|
119
80
|
const SAMPLE_SIZE = 4;
|
|
120
|
-
function inventoryAddonRoots(input, fs, candidates = candidateDataRoots(input)) {
|
|
121
|
-
const activeScopeDir = path.join(input.activeAddonsDir,
|
|
81
|
+
export function inventoryAddonRoots(input, fs, candidates = candidateDataRoots(input)) {
|
|
82
|
+
const activeScopeDir = path.join(input.activeAddonsDir, ADDON_SCOPE);
|
|
122
83
|
const activeReal = fs.exists(activeScopeDir) ? fs.realPath(activeScopeDir) : activeScopeDir;
|
|
123
84
|
const rivals = [];
|
|
124
85
|
const seenReal = new Set([activeReal]);
|
|
125
86
|
for (const root of candidates) {
|
|
126
|
-
const scopeDir = path.join(root,
|
|
87
|
+
const scopeDir = path.join(root, ADDONS_SUBDIR, ADDON_SCOPE);
|
|
127
88
|
if (!fs.exists(scopeDir))
|
|
128
89
|
continue;
|
|
129
90
|
// A symlink or bind pointing back at the live tree is the SAME root, not a
|
|
@@ -145,7 +106,7 @@ function inventoryAddonRoots(input, fs, candidates = candidateDataRoots(input))
|
|
|
145
106
|
* The loud report. Empty string when this machine has ONE addon root — a clean
|
|
146
107
|
* node says nothing, so the one that isn't stands out instead of scrolling past.
|
|
147
108
|
*/
|
|
148
|
-
function formatAddonRootReport(inventory) {
|
|
109
|
+
export function formatAddonRootReport(inventory) {
|
|
149
110
|
if (inventory.rivals.length === 0)
|
|
150
111
|
return '';
|
|
151
112
|
const lines = [
|
package/dist/agent/addon-scan.js
CHANGED
|
@@ -1,41 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.BUILTINS_PACKAGE = void 0;
|
|
37
|
-
exports.resolveAddonPackageDirs = resolveAddonPackageDirs;
|
|
38
|
-
exports.planAgentAddonScan = planAgentAddonScan;
|
|
39
1
|
/**
|
|
40
2
|
* Which directories the agent scans for addons — decided as pure data.
|
|
41
3
|
*
|
|
@@ -70,10 +32,10 @@ exports.planAgentAddonScan = planAgentAddonScan;
|
|
|
70
32
|
* (`assertRequiredInfraResolved`, which names every missing required cap),
|
|
71
33
|
* never through a silent "no addon packages found" early return.
|
|
72
34
|
*/
|
|
73
|
-
|
|
74
|
-
|
|
35
|
+
import * as fs from 'node:fs';
|
|
36
|
+
import * as path from 'node:path';
|
|
75
37
|
/** The framework builtins package. Loaded from the closure, never from a copy. */
|
|
76
|
-
|
|
38
|
+
export const BUILTINS_PACKAGE = '@camstack/system';
|
|
77
39
|
function isDir(p) {
|
|
78
40
|
try {
|
|
79
41
|
return fs.statSync(p).isDirectory();
|
|
@@ -89,7 +51,7 @@ function isDir(p) {
|
|
|
89
51
|
* `<scope>/<name>` for a scoped directory, the bare name for a flat one — so
|
|
90
52
|
* the hub and the agent exclude the same thing given the same list.
|
|
91
53
|
*/
|
|
92
|
-
function resolveAddonPackageDirs(addonsDir, skipPackages = []) {
|
|
54
|
+
export function resolveAddonPackageDirs(addonsDir, skipPackages = []) {
|
|
93
55
|
const dirs = [];
|
|
94
56
|
if (!fs.existsSync(addonsDir))
|
|
95
57
|
return dirs;
|
|
@@ -121,11 +83,11 @@ function resolveAddonPackageDirs(addonsDir, skipPackages = []) {
|
|
|
121
83
|
* `closureSystemDir` is `resolveHubClosurePackageDir(BUILTINS_PACKAGE)` — null
|
|
122
84
|
* only when the builtins are not resolvable from the running closure at all.
|
|
123
85
|
*/
|
|
124
|
-
function planAgentAddonScan(addonsDir, closureSystemDir) {
|
|
86
|
+
export function planAgentAddonScan(addonsDir, closureSystemDir) {
|
|
125
87
|
if (closureSystemDir === null) {
|
|
126
88
|
// No closure copy: fall back to whatever is on disk, including the
|
|
127
89
|
// addon-root builtins, rather than booting with no infra at all.
|
|
128
90
|
return resolveAddonPackageDirs(addonsDir);
|
|
129
91
|
}
|
|
130
|
-
return [closureSystemDir, ...resolveAddonPackageDirs(addonsDir, [
|
|
92
|
+
return [closureSystemDir, ...resolveAddonPackageDirs(addonsDir, [BUILTINS_PACKAGE])];
|
|
131
93
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* ONE list for the agent UI: every addon on this node with the runner that
|
|
4
3
|
* hosts it (D841). It used to be two lists — `$agent.status` addons and
|
|
@@ -11,10 +10,6 @@
|
|
|
11
10
|
* `addonIds`. A runner hosting no known addon is still a row, so a stray
|
|
12
11
|
* process stays visible.
|
|
13
12
|
*/
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.joinAddonRuntime = joinAddonRuntime;
|
|
16
|
-
exports.addonsFromStatus = addonsFromStatus;
|
|
17
|
-
exports.processesFromList = processesFromList;
|
|
18
13
|
function toRunner(p) {
|
|
19
14
|
return {
|
|
20
15
|
name: p.name,
|
|
@@ -27,7 +22,7 @@ function toRunner(p) {
|
|
|
27
22
|
addonIds: p.addonIds,
|
|
28
23
|
};
|
|
29
24
|
}
|
|
30
|
-
function joinAddonRuntime(addons, processes) {
|
|
25
|
+
export function joinAddonRuntime(addons, processes) {
|
|
31
26
|
const runnerByAddon = new Map();
|
|
32
27
|
for (const p of processes) {
|
|
33
28
|
for (const id of p.addonIds) {
|
|
@@ -68,7 +63,7 @@ function num(value) {
|
|
|
68
63
|
return typeof value === 'number' && Number.isFinite(value) ? value : 0;
|
|
69
64
|
}
|
|
70
65
|
/** The addon rows of an `$agent.status` answer; unreadable rows are skipped. */
|
|
71
|
-
function addonsFromStatus(status) {
|
|
66
|
+
export function addonsFromStatus(status) {
|
|
72
67
|
const raw = status !== null && typeof status === 'object' ? Reflect.get(status, 'addons') : null;
|
|
73
68
|
if (!Array.isArray(raw))
|
|
74
69
|
return [];
|
|
@@ -91,7 +86,7 @@ function addonsFromStatus(status) {
|
|
|
91
86
|
return out;
|
|
92
87
|
}
|
|
93
88
|
/** The runners of a `$process.list` answer; unreadable rows are skipped. */
|
|
94
|
-
function processesFromList(list) {
|
|
89
|
+
export function processesFromList(list) {
|
|
95
90
|
if (!Array.isArray(list))
|
|
96
91
|
return [];
|
|
97
92
|
const out = [];
|
|
@@ -1,43 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.DEFAULT_NPM_REGISTRY = void 0;
|
|
37
|
-
exports.readInstalledAddonPackages = readInstalledAddonPackages;
|
|
38
|
-
exports.buildAddonUpdateEntries = buildAddonUpdateEntries;
|
|
39
|
-
exports.resolvePublishedVersion = resolvePublishedVersion;
|
|
40
|
-
exports.buildAgentAddonUpdateReport = buildAgentAddonUpdateReport;
|
|
41
1
|
/**
|
|
42
2
|
* Agent-local addon ALIGNMENT report — "is this node behind?", answered
|
|
43
3
|
* WITHOUT the hub.
|
|
@@ -54,12 +14,12 @@ exports.buildAgentAddonUpdateReport = buildAgentAddonUpdateReport;
|
|
|
54
14
|
* This module answers the read half: *which of my addons are behind the
|
|
55
15
|
* published release?* The hub-version half is joined in by the routes.
|
|
56
16
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
17
|
+
import * as fs from 'node:fs';
|
|
18
|
+
import * as path from 'node:path';
|
|
19
|
+
import { compareSemver } from '../server-root/index.js';
|
|
20
|
+
import { resolveAddonPackageDirs } from './addon-scan.js';
|
|
61
21
|
/** Default public registry, matching `AddonInstaller.downloadNpmTarball`. */
|
|
62
|
-
|
|
22
|
+
export const DEFAULT_NPM_REGISTRY = 'https://registry.npmjs.org';
|
|
63
23
|
/** Read `<dir>/package.json`'s `name` + `version`, tolerating a broken file. */
|
|
64
24
|
function readPackageIdentity(dir) {
|
|
65
25
|
try {
|
|
@@ -84,9 +44,9 @@ function readPackageIdentity(dir) {
|
|
|
84
44
|
* is the only copy of the builtin infra (D87), so it is exactly the package an
|
|
85
45
|
* operator needs to see the version of when a node is misaligned.
|
|
86
46
|
*/
|
|
87
|
-
function readInstalledAddonPackages(addonsDir) {
|
|
47
|
+
export function readInstalledAddonPackages(addonsDir) {
|
|
88
48
|
const found = [];
|
|
89
|
-
for (const dir of
|
|
49
|
+
for (const dir of resolveAddonPackageDirs(addonsDir)) {
|
|
90
50
|
const identity = readPackageIdentity(dir);
|
|
91
51
|
if (identity !== null)
|
|
92
52
|
found.push(identity);
|
|
@@ -100,13 +60,13 @@ function readInstalledAddonPackages(addonsDir) {
|
|
|
100
60
|
* to be strictly newer. An unknown published version is never "up to date"
|
|
101
61
|
* and never "behind" — it is unknown, and carries its error into the row.
|
|
102
62
|
*/
|
|
103
|
-
function buildAddonUpdateEntries(installed, published) {
|
|
63
|
+
export function buildAddonUpdateEntries(installed, published) {
|
|
104
64
|
return installed.map((pkg) => {
|
|
105
65
|
const latest = published.get(pkg.packageName);
|
|
106
66
|
const latestVersion = latest?.latestVersion ?? null;
|
|
107
67
|
const updateAvailable = latestVersion !== null &&
|
|
108
68
|
pkg.installedVersion !== null &&
|
|
109
|
-
|
|
69
|
+
compareSemver(latestVersion, pkg.installedVersion) > 0;
|
|
110
70
|
return {
|
|
111
71
|
packageName: pkg.packageName,
|
|
112
72
|
installedVersion: pkg.installedVersion,
|
|
@@ -124,7 +84,7 @@ function buildAddonUpdateEntries(installed, published) {
|
|
|
124
84
|
* Never throws: a failure becomes `{ latestVersion: null, error }` so one
|
|
125
85
|
* unreachable package cannot blank the whole report.
|
|
126
86
|
*/
|
|
127
|
-
async function resolvePublishedVersion(packageName, registryUrl, fetchFn) {
|
|
87
|
+
export async function resolvePublishedVersion(packageName, registryUrl, fetchFn) {
|
|
128
88
|
const base = registryUrl.replace(/\/+$/, '');
|
|
129
89
|
const url = `${base}/${encodeURIComponent(packageName).replace(/^%40/, '@')}`;
|
|
130
90
|
try {
|
|
@@ -148,9 +108,9 @@ async function resolvePublishedVersion(packageName, registryUrl, fetchFn) {
|
|
|
148
108
|
* distinguishing it from a single 404 is what stops the UI claiming a node is
|
|
149
109
|
* aligned when it simply could not ask.
|
|
150
110
|
*/
|
|
151
|
-
async function buildAgentAddonUpdateReport(input) {
|
|
111
|
+
export async function buildAgentAddonUpdateReport(input) {
|
|
152
112
|
const now = input.now ?? Date.now;
|
|
153
|
-
const registryUrl = input.registryUrl ??
|
|
113
|
+
const registryUrl = input.registryUrl ?? DEFAULT_NPM_REGISTRY;
|
|
154
114
|
const installed = readInstalledAddonPackages(input.addonsDir);
|
|
155
115
|
const published = new Map();
|
|
156
116
|
const resolved = await Promise.all(installed.map(async (pkg) => ({
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
/**
|
|
3
2
|
* Slice-5, Task 6 — agent-side Moleculer service for forwarding hub-dispatched
|
|
4
3
|
* cap calls to the agent's forked UDS children.
|
|
@@ -9,9 +8,7 @@
|
|
|
9
8
|
* receives those calls, resolves the child locally via the agent's
|
|
10
9
|
* `LocalChildRegistry`, and forwards the call over UDS.
|
|
11
10
|
*/
|
|
12
|
-
|
|
13
|
-
exports.createAgentCapDispatchService = createAgentCapDispatchService;
|
|
14
|
-
const system_1 = require("@camstack/system");
|
|
11
|
+
import { AGENT_CAP_FWD_SERVICE } from '@camstack/system';
|
|
15
12
|
// ---------------------------------------------------------------------------
|
|
16
13
|
// ctx.params narrowing helpers
|
|
17
14
|
// ---------------------------------------------------------------------------
|
|
@@ -59,7 +56,7 @@ function narrowParams(raw) {
|
|
|
59
56
|
*/
|
|
60
57
|
function createAgentCapDispatchService(agentNodeId, agentUdsRegistry, inProcessLookup, logger) {
|
|
61
58
|
return {
|
|
62
|
-
name:
|
|
59
|
+
name: AGENT_CAP_FWD_SERVICE,
|
|
63
60
|
actions: {
|
|
64
61
|
forward: {
|
|
65
62
|
handler: async (ctx) => {
|
|
@@ -99,3 +96,4 @@ function createAgentCapDispatchService(agentNodeId, agentUdsRegistry, inProcessL
|
|
|
99
96
|
},
|
|
100
97
|
};
|
|
101
98
|
}
|
|
99
|
+
export { createAgentCapDispatchService };
|
|
@@ -1,44 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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");
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import * as crypto from 'node:crypto';
|
|
4
|
+
import * as os from 'node:os';
|
|
5
|
+
import { writeOwnerOnlyFileSync } from '@camstack/types/node';
|
|
42
6
|
/**
|
|
43
7
|
* Generate a stable nodeId and persist it to the config file.
|
|
44
8
|
*
|
|
@@ -74,7 +38,7 @@ function ensurePersistedNodeId(configPath, dataDir) {
|
|
|
74
38
|
raw.nodeId = id;
|
|
75
39
|
try {
|
|
76
40
|
// Owner-only: the same file holds the agent's private mesh key.
|
|
77
|
-
|
|
41
|
+
writeOwnerOnlyFileSync(resolvedPath, JSON.stringify(raw, null, 2));
|
|
78
42
|
}
|
|
79
43
|
catch {
|
|
80
44
|
/* best-effort */
|
|
@@ -139,3 +103,4 @@ function loadAgentConfig(configPath, dataDirOverride) {
|
|
|
139
103
|
statusPort: Number(process.env.CAMSTACK_STATUS_PORT) || 4444,
|
|
140
104
|
};
|
|
141
105
|
}
|
|
106
|
+
export { loadAgentConfig };
|
|
@@ -1,42 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { randomBytes } from 'node:crypto';
|
|
40
4
|
/** Recursively remove a path, ignoring a missing target. */
|
|
41
5
|
function rmrf(target) {
|
|
42
6
|
fs.rmSync(target, { recursive: true, force: true });
|
|
@@ -77,7 +41,7 @@ function moveDir(from, to) {
|
|
|
77
41
|
*
|
|
78
42
|
* @returns the live addon directory path (`<addonsDir>/<addonId>`).
|
|
79
43
|
*/
|
|
80
|
-
async function applyDeployedBundle(input) {
|
|
44
|
+
export async function applyDeployedBundle(input) {
|
|
81
45
|
const { addonsDir, addonId, bundle, extract, logger } = input;
|
|
82
46
|
fs.mkdirSync(addonsDir, { recursive: true });
|
|
83
47
|
const liveDir = path.join(addonsDir, addonId);
|
|
@@ -88,7 +52,7 @@ async function applyDeployedBundle(input) {
|
|
|
88
52
|
const liveParent = path.dirname(liveDir);
|
|
89
53
|
const liveBase = path.basename(liveDir);
|
|
90
54
|
fs.mkdirSync(liveParent, { recursive: true });
|
|
91
|
-
const token =
|
|
55
|
+
const token = randomBytes(6).toString('hex');
|
|
92
56
|
const nextDir = path.join(liveParent, `.${liveBase}.next.${token}`);
|
|
93
57
|
const backupDir = path.join(liveParent, `.${liveBase}.backup.${token}`);
|
|
94
58
|
// 1. Extract into a temp dir. If extraction throws (e.g. a killed untar),
|
|
@@ -1,45 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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");
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { resolveAddonPlacement } from '@camstack/types';
|
|
43
4
|
/**
|
|
44
5
|
* Read a package's `camstack.addons[]` declarations directly from its
|
|
45
6
|
* package.json — WITHOUT importing the addon entry module.
|
|
@@ -52,7 +13,7 @@ const types_1 = require("@camstack/types");
|
|
|
52
13
|
* capabilities, execution) to be (re)dispatched to a runner SUBPROCESS, which
|
|
53
14
|
* loads the real module itself. Returns null on a missing/corrupt manifest.
|
|
54
15
|
*/
|
|
55
|
-
function readPackageManifestAddons(dir) {
|
|
16
|
+
export function readPackageManifestAddons(dir) {
|
|
56
17
|
try {
|
|
57
18
|
const pkgPath = path.join(dir, 'package.json');
|
|
58
19
|
if (!fs.existsSync(pkgPath))
|
|
@@ -89,8 +50,8 @@ function readPackageManifestAddons(dir) {
|
|
|
89
50
|
* is hub-only and not a group-runner addon — and, being hub-only, is never
|
|
90
51
|
* deployable to an agent in the first place.
|
|
91
52
|
*/
|
|
92
|
-
function isGroupRunnerAddon(decl) {
|
|
93
|
-
return decl.execution !== undefined &&
|
|
53
|
+
export function isGroupRunnerAddon(decl) {
|
|
54
|
+
return decl.execution !== undefined && resolveAddonPlacement(decl) !== 'hub-only';
|
|
94
55
|
}
|
|
95
56
|
/**
|
|
96
57
|
* Register the broker-call cap proxies + `loadedAddons` bookkeeping for a group
|
|
@@ -99,7 +60,7 @@ function isGroupRunnerAddon(decl) {
|
|
|
99
60
|
* ONE implementation — preventing the two from drifting (the original cause of
|
|
100
61
|
* the in-process-reload wedge).
|
|
101
62
|
*/
|
|
102
|
-
function registerGroupRunnerProviders(deps, addons) {
|
|
63
|
+
export function registerGroupRunnerProviders(deps, addons) {
|
|
103
64
|
for (const a of addons) {
|
|
104
65
|
for (const cap of a.capabilities) {
|
|
105
66
|
const capName = typeof cap === 'string' ? cap : cap.name;
|
|
@@ -150,7 +111,7 @@ function registerGroupRunnerProviders(deps, addons) {
|
|
|
150
111
|
* On a hard failure of both paths the addons are marked `error` (no providers
|
|
151
112
|
* registered) so `$agent.status` reports the degraded state.
|
|
152
113
|
*/
|
|
153
|
-
async function ensureGroupRunner(deps, groupId, addons) {
|
|
114
|
+
export async function ensureGroupRunner(deps, groupId, addons) {
|
|
154
115
|
try {
|
|
155
116
|
const restart = await deps.broker.call('$process.restart', { name: groupId });
|
|
156
117
|
if (!restart.success) {
|