@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,39 @@
|
|
|
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.FileUpdateAvailabilityStore = exports.UPDATE_AVAILABILITY_DIR = void 0;
|
|
1
37
|
/**
|
|
2
38
|
* Durable backing for {@link UpdateAvailabilityEmitter}'s dedup state.
|
|
3
39
|
*
|
|
@@ -12,24 +48,24 @@
|
|
|
12
48
|
* database, no settings-store dependency (the emitter runs on the AGENT too,
|
|
13
49
|
* where the hub's SQLite settings store does not exist).
|
|
14
50
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
51
|
+
const fs = __importStar(require("node:fs"));
|
|
52
|
+
const path = __importStar(require("node:path"));
|
|
53
|
+
const types_1 = require("@camstack/types");
|
|
18
54
|
/** Directory under the data dir that holds one file per emitter scope. */
|
|
19
|
-
|
|
55
|
+
exports.UPDATE_AVAILABILITY_DIR = 'update-availability';
|
|
20
56
|
/**
|
|
21
57
|
* One file per emitter scope (`addon-packages`, `server-update`,
|
|
22
58
|
* `agent-update`) so two emitters in the same process never overwrite each
|
|
23
59
|
* other's dedup state.
|
|
24
60
|
*/
|
|
25
|
-
|
|
61
|
+
class FileUpdateAvailabilityStore {
|
|
26
62
|
scopeId;
|
|
27
63
|
logger;
|
|
28
64
|
filePath;
|
|
29
65
|
constructor(dataDir, scopeId, logger) {
|
|
30
66
|
this.scopeId = scopeId;
|
|
31
67
|
this.logger = logger;
|
|
32
|
-
this.filePath = path.join(dataDir, UPDATE_AVAILABILITY_DIR, `${scopeId}.json`);
|
|
68
|
+
this.filePath = path.join(dataDir, exports.UPDATE_AVAILABILITY_DIR, `${scopeId}.json`);
|
|
33
69
|
}
|
|
34
70
|
load() {
|
|
35
71
|
try {
|
|
@@ -42,7 +78,7 @@ export class FileUpdateAvailabilityStore {
|
|
|
42
78
|
// A corrupt file must not look like "nothing was ever announced" AND
|
|
43
79
|
// must not crash boot. It re-announces once, then heals on the next save.
|
|
44
80
|
this.logger.warn('Update-availability state unreadable; starting from empty', {
|
|
45
|
-
meta: { scopeId: this.scopeId, path: this.filePath, error: errMsg(error) },
|
|
81
|
+
meta: { scopeId: this.scopeId, path: this.filePath, error: (0, types_1.errMsg)(error) },
|
|
46
82
|
});
|
|
47
83
|
return null;
|
|
48
84
|
}
|
|
@@ -58,11 +94,12 @@ export class FileUpdateAvailabilityStore {
|
|
|
58
94
|
// Losing a write degrades to the old RAM-only behaviour (a re-announce
|
|
59
95
|
// after restart) — never a failed update check.
|
|
60
96
|
this.logger.warn('Failed to persist update-availability state', {
|
|
61
|
-
meta: { scopeId: this.scopeId, path: this.filePath, error: errMsg(error) },
|
|
97
|
+
meta: { scopeId: this.scopeId, path: this.filePath, error: (0, types_1.errMsg)(error) },
|
|
62
98
|
});
|
|
63
99
|
}
|
|
64
100
|
}
|
|
65
101
|
}
|
|
102
|
+
exports.FileUpdateAvailabilityStore = FileUpdateAvailabilityStore;
|
|
66
103
|
function parseState(raw) {
|
|
67
104
|
if (raw === null || typeof raw !== 'object')
|
|
68
105
|
return null;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AGENT_STATUS_TIMEOUT_MS = void 0;
|
|
4
|
+
exports.fetchAgentInstalledPackages = fetchAgentInstalledPackages;
|
|
1
5
|
/**
|
|
2
6
|
* The agent addon roster, as the hub sees it.
|
|
3
7
|
*
|
|
@@ -9,16 +13,16 @@
|
|
|
9
13
|
* the framework filter and make the two surfaces disagree about what is
|
|
10
14
|
* installed on a node.
|
|
11
15
|
*/
|
|
12
|
-
|
|
16
|
+
const addon_package_service_js_1 = require("../addon/addon-package.service.js");
|
|
13
17
|
/** Timeout for `$agent.status`; a node that cannot answer this fast is unwell. */
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const status = await broker.call('$agent.status', {}, { nodeID: nodeId, timeout: AGENT_STATUS_TIMEOUT_MS });
|
|
18
|
+
exports.AGENT_STATUS_TIMEOUT_MS = 5_000;
|
|
19
|
+
async function fetchAgentInstalledPackages(broker, nodeId) {
|
|
20
|
+
const status = await broker.call('$agent.status', {}, { nodeID: nodeId, timeout: exports.AGENT_STATUS_TIMEOUT_MS });
|
|
17
21
|
const out = [];
|
|
18
22
|
for (const addon of status.addons ?? []) {
|
|
19
23
|
if (typeof addon.packageName !== 'string' || typeof addon.version !== 'string')
|
|
20
24
|
continue;
|
|
21
|
-
if (isFrameworkPackage(addon.packageName))
|
|
25
|
+
if ((0, addon_package_service_js_1.isFrameworkPackage)(addon.packageName))
|
|
22
26
|
continue;
|
|
23
27
|
out.push({ name: addon.packageName, version: addon.version });
|
|
24
28
|
}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildRestartMarker = buildRestartMarker;
|
|
4
|
+
exports.isServerUpdateReason = isServerUpdateReason;
|
|
5
|
+
exports.versionFromReason = versionFromReason;
|
|
1
6
|
/** Reason-string prefix every `RootUpdateService`-driven restart carries. */
|
|
2
7
|
const SERVER_UPDATE_PREFIX = 'server-update:';
|
|
3
8
|
/** The root package a version-less `server-update:` reason is about. */
|
|
4
9
|
const ROOT_PACKAGE_NAME = '@camstack/server';
|
|
5
|
-
|
|
10
|
+
function buildRestartMarker(input) {
|
|
6
11
|
const { requestedBy, update, requestedAt } = input;
|
|
7
12
|
const toVersion = update?.toVersion ?? versionFromReason(requestedBy);
|
|
8
13
|
const isUpdate = update !== undefined || (isServerUpdateReason(requestedBy) && toVersion !== undefined);
|
|
@@ -22,11 +27,11 @@ export function buildRestartMarker(input) {
|
|
|
22
27
|
...(toVersion !== undefined ? { toVersion } : {}),
|
|
23
28
|
};
|
|
24
29
|
}
|
|
25
|
-
|
|
30
|
+
function isServerUpdateReason(requestedBy) {
|
|
26
31
|
return requestedBy !== undefined && requestedBy.startsWith(SERVER_UPDATE_PREFIX);
|
|
27
32
|
}
|
|
28
33
|
/** `server-update: @camstack/server@1.2.138` → `1.2.138`; `… manual restart` → none. */
|
|
29
|
-
|
|
34
|
+
function versionFromReason(requestedBy) {
|
|
30
35
|
if (requestedBy === undefined)
|
|
31
36
|
return undefined;
|
|
32
37
|
return /@([^@\s]+)$/.exec(requestedBy)?.[1];
|
|
@@ -1,39 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UpdateCheckScheduler = exports.MAX_UPDATE_CHECK_INTERVAL_SECONDS = exports.MIN_UPDATE_CHECK_INTERVAL_SECONDS = exports.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS = void 0;
|
|
4
|
+
exports.clampUpdateCheckInterval = clampUpdateCheckInterval;
|
|
5
|
+
const types_1 = require("@camstack/types");
|
|
2
6
|
/**
|
|
3
7
|
* Default poll cadence: 6 hours. Registry lookups are cheap but not free, and
|
|
4
8
|
* an operator who is told about a publish within a quarter-day is told in time.
|
|
5
9
|
*/
|
|
6
|
-
|
|
10
|
+
exports.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS = 6 * 60 * 60;
|
|
7
11
|
/**
|
|
8
12
|
* Floor: 15 minutes. Below this the sweep starts overlapping its own npm
|
|
9
13
|
* lookups on a cluster of any size, and the notification stops being a
|
|
10
14
|
* notification. `setAutoUpdateSettings` clamps to this rather than refusing,
|
|
11
15
|
* so a bad value degrades to "poll briskly" instead of "poll never".
|
|
12
16
|
*/
|
|
13
|
-
|
|
17
|
+
exports.MIN_UPDATE_CHECK_INTERVAL_SECONDS = 15 * 60;
|
|
14
18
|
/** Ceiling: 7 days. Anything longer is indistinguishable from disabled. */
|
|
15
|
-
|
|
19
|
+
exports.MAX_UPDATE_CHECK_INTERVAL_SECONDS = 7 * 24 * 60 * 60;
|
|
16
20
|
/** Grace after boot before the first sweep, so registry I/O never races boot. */
|
|
17
21
|
const DEFAULT_INITIAL_DELAY_MS = 90_000;
|
|
18
22
|
/** Clamp an operator-supplied interval into the supported window. */
|
|
19
|
-
|
|
23
|
+
function clampUpdateCheckInterval(seconds) {
|
|
20
24
|
if (!Number.isFinite(seconds))
|
|
21
|
-
return DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
25
|
+
return exports.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
22
26
|
const whole = Math.floor(seconds);
|
|
23
|
-
if (whole < MIN_UPDATE_CHECK_INTERVAL_SECONDS)
|
|
24
|
-
return MIN_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
25
|
-
if (whole > MAX_UPDATE_CHECK_INTERVAL_SECONDS)
|
|
26
|
-
return MAX_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
27
|
+
if (whole < exports.MIN_UPDATE_CHECK_INTERVAL_SECONDS)
|
|
28
|
+
return exports.MIN_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
29
|
+
if (whole > exports.MAX_UPDATE_CHECK_INTERVAL_SECONDS)
|
|
30
|
+
return exports.MAX_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
27
31
|
return whole;
|
|
28
32
|
}
|
|
29
|
-
|
|
33
|
+
class UpdateCheckScheduler {
|
|
30
34
|
logger;
|
|
31
35
|
targets;
|
|
32
36
|
getIntervalSeconds;
|
|
33
37
|
initialDelayMs;
|
|
34
38
|
timer = null;
|
|
35
39
|
bootTimer = null;
|
|
36
|
-
intervalSeconds = DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
40
|
+
intervalSeconds = exports.DEFAULT_UPDATE_CHECK_INTERVAL_SECONDS;
|
|
37
41
|
sweeping = false;
|
|
38
42
|
constructor(options) {
|
|
39
43
|
this.logger = options.logger;
|
|
@@ -127,8 +131,9 @@ export class UpdateCheckScheduler {
|
|
|
127
131
|
// and destroy the dedup state the operator's notifications rely on.
|
|
128
132
|
this.logger.warn(`Update check failed — ${what}`, {
|
|
129
133
|
tags: { nodeId },
|
|
130
|
-
meta: { error: errMsg(error) },
|
|
134
|
+
meta: { error: (0, types_1.errMsg)(error) },
|
|
131
135
|
});
|
|
132
136
|
}
|
|
133
137
|
}
|
|
134
138
|
}
|
|
139
|
+
exports.UpdateCheckScheduler = UpdateCheckScheduler;
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WrapperUpdateChecker = exports.WRAPPER_PACKAGE_NAME = void 0;
|
|
1
4
|
/**
|
|
2
5
|
* The availability row's package name. A shell is not an npm package, but the
|
|
3
6
|
* emitter keys dedup on `(target, node, packageName)` and a stable literal is
|
|
4
7
|
* what makes "one shell per node" the dedup slot. Never rendered: the
|
|
5
8
|
* notification body is chosen from the wrapper KIND.
|
|
6
9
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
10
|
+
exports.WRAPPER_PACKAGE_NAME = 'camstack-wrapper';
|
|
11
|
+
class WrapperUpdateChecker {
|
|
9
12
|
emitter;
|
|
10
13
|
logger;
|
|
11
14
|
readStatus;
|
|
@@ -44,7 +47,7 @@ export class WrapperUpdateChecker {
|
|
|
44
47
|
}
|
|
45
48
|
const candidate = {
|
|
46
49
|
target: 'wrapper',
|
|
47
|
-
packageName: WRAPPER_PACKAGE_NAME,
|
|
50
|
+
packageName: exports.WRAPPER_PACKAGE_NAME,
|
|
48
51
|
// The SHELL's versions, not the running code's. `wrapper.currentVersion`
|
|
49
52
|
// is what the shell says about ITSELF (an Electron app version), which
|
|
50
53
|
// is not on the same scale as a release; the seed is, and the seed is
|
|
@@ -57,3 +60,4 @@ export class WrapperUpdateChecker {
|
|
|
57
60
|
this.emitter.publishSnapshot('wrapper', [candidate], nodeId);
|
|
58
61
|
}
|
|
59
62
|
}
|
|
63
|
+
exports.WrapperUpdateChecker = WrapperUpdateChecker;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/**
|
|
2
3
|
* What a node installs at first boot once the image stops carrying a
|
|
3
4
|
* NON-system addon seed tree — [D45](../../../docs/decisions/adr-0045.md),
|
|
@@ -25,8 +26,11 @@
|
|
|
25
26
|
* Pure: the caller supplies the roster, what is on disk and what the closure
|
|
26
27
|
* carries. It installs nothing and can never end a boot.
|
|
27
28
|
*/
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.planFirstBootAddons = planFirstBootAddons;
|
|
31
|
+
exports.formatFirstBootPlan = formatFirstBootPlan;
|
|
28
32
|
/** The plan. Pure; installs nothing. */
|
|
29
|
-
|
|
33
|
+
function planFirstBootAddons(input) {
|
|
30
34
|
const provided = new Set(input.closureProvided);
|
|
31
35
|
const decisions = input.required.map((pkg) => decide(pkg, input.installed, input.closureVersions, provided));
|
|
32
36
|
const wouldInstall = decisions.filter((d) => d.action === 'install-npm').map((d) => d.pkg);
|
|
@@ -87,7 +91,7 @@ function decide(pkg, installed, closureVersions, closureProvided) {
|
|
|
87
91
|
* `observe` the lines say so explicitly — an observe line that reads like an
|
|
88
92
|
* install is worse than no line at all.
|
|
89
93
|
*/
|
|
90
|
-
|
|
94
|
+
function formatFirstBootPlan(plan, mode) {
|
|
91
95
|
const header = `first-boot addon plan (${mode}) — ${plan.decisions.length} package(s), ` +
|
|
92
96
|
`${plan.wouldInstall.length} to install`;
|
|
93
97
|
const lines = [
|
|
@@ -1,11 +1,47 @@
|
|
|
1
|
-
|
|
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.frameworkNodePaths = frameworkNodePaths;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
2
38
|
/**
|
|
3
39
|
* The framework's node_modules path to prepend to NODE_PATH so the CJS hub
|
|
4
40
|
* resolves @camstack/system (+ hoisted server deps) from /data/framework.
|
|
5
41
|
* CJS honors NODE_PATH (unlike ESM `import`, which is why addons use the
|
|
6
42
|
* resolver hook instead). Empty when unset or absent.
|
|
7
43
|
*/
|
|
8
|
-
|
|
44
|
+
function frameworkNodePaths(frameworkDir, exists) {
|
|
9
45
|
if (!frameworkDir)
|
|
10
46
|
return [];
|
|
11
47
|
const nm = path.join(frameworkDir, 'node_modules');
|
|
@@ -1,20 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolveRequestLang = resolveRequestLang;
|
|
4
|
+
exports.requestLangInputFrom = requestLangInputFrom;
|
|
5
|
+
const types_1 = require("@camstack/types");
|
|
6
|
+
const app_page_strings_js_1 = require("../auth/app-page-strings.js");
|
|
3
7
|
function parseLang(value) {
|
|
4
|
-
const parsed = CatalogLangSchema.safeParse(typeof value === 'string' ? value.toLowerCase() : value);
|
|
8
|
+
const parsed = types_1.CatalogLangSchema.safeParse(typeof value === 'string' ? value.toLowerCase() : value);
|
|
5
9
|
return parsed.success ? parsed.data : undefined;
|
|
6
10
|
}
|
|
7
|
-
|
|
11
|
+
function resolveRequestLang(input) {
|
|
8
12
|
return (parseLang(input.profileLanguage) ??
|
|
9
13
|
parseLang(input.explicitLang) ??
|
|
10
|
-
langFromAcceptLanguage(input.acceptLanguage) ??
|
|
11
|
-
DEFAULT_CATALOG_LANG);
|
|
14
|
+
(0, app_page_strings_js_1.langFromAcceptLanguage)(input.acceptLanguage) ??
|
|
15
|
+
types_1.DEFAULT_CATALOG_LANG);
|
|
12
16
|
}
|
|
13
17
|
function firstHeader(value) {
|
|
14
18
|
return Array.isArray(value) ? value[0] : value;
|
|
15
19
|
}
|
|
16
20
|
/** Reads the request-borne inputs; `query` is the parsed query object when there is one. */
|
|
17
|
-
|
|
21
|
+
function requestLangInputFrom(headers, query, connectionLang) {
|
|
18
22
|
const acceptLanguage = headers['accept-language'];
|
|
19
23
|
return {
|
|
20
24
|
explicitLang: firstHeader(headers['x-camstack-lang']) ?? query?.['lang'] ?? connectionLang,
|
package/dist/launcher.js
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
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 });
|
|
1
36
|
/**
|
|
2
37
|
* Launcher -- entry point that ensures required addons are installed
|
|
3
38
|
* before main.ts loads. This solves the chicken-and-egg problem:
|
|
@@ -16,18 +51,18 @@
|
|
|
16
51
|
* framework dir + NODE_PATH are set up. Framework/cap updates ship via the
|
|
17
52
|
* node-root `applyServerUpdate` flow, not an in-launcher package swap.
|
|
18
53
|
*/
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
54
|
+
const fs = __importStar(require("node:fs"));
|
|
55
|
+
const os = __importStar(require("node:os"));
|
|
56
|
+
const path = __importStar(require("node:path"));
|
|
57
|
+
const yaml = __importStar(require("js-yaml"));
|
|
58
|
+
const addon_root_inventory_js_1 = require("./addon-root-inventory.js");
|
|
59
|
+
const bootstrap_packages_js_1 = require("./bootstrap-packages.js");
|
|
60
|
+
const first_boot_addon_plan_js_1 = require("./first-boot-addon-plan.js");
|
|
61
|
+
const addon_realign_plan_js_1 = require("./core/addon/addon-realign-plan.js");
|
|
62
|
+
const closure_node_modules_js_1 = require("./closure-node-modules.js");
|
|
63
|
+
const framework_nodepath_js_1 = require("./framework-nodepath.js");
|
|
64
|
+
const package_inventory_js_1 = require("./package-inventory.js");
|
|
65
|
+
const pending_restore_js_1 = require("./pending-restore.js");
|
|
31
66
|
/** Resolve the data directory from env or default */
|
|
32
67
|
const DATA_DIR = process.env['CAMSTACK_DATA'] ?? 'camstack-data';
|
|
33
68
|
/** Narrow `CAMSTACK_INSTALL_SOURCE` env into the typed union. */
|
|
@@ -99,7 +134,7 @@ function readBootstrapInstallSource(dataDir, bootstrapSchema) {
|
|
|
99
134
|
*/
|
|
100
135
|
function deriveBootstrapFromSelf() {
|
|
101
136
|
const pkg = readOwnManifest();
|
|
102
|
-
return pkg === null ? [] : selectHubBootstrapPackages(pkg);
|
|
137
|
+
return pkg === null ? [] : (0, bootstrap_packages_js_1.selectHubBootstrapPackages)(pkg);
|
|
103
138
|
}
|
|
104
139
|
/**
|
|
105
140
|
* THIS server closure's own `package.json` — the roster's source and, when
|
|
@@ -184,7 +219,7 @@ async function launch() {
|
|
|
184
219
|
// `node-role.ts` imports no @camstack/* itself. The role selects both the
|
|
185
220
|
// bootstrap package set (hub → all addons; agent → AGENT_PACKAGES) and,
|
|
186
221
|
// at the very end of launch(), which runtime entry is loaded.
|
|
187
|
-
const { resolveNodeRole } = await
|
|
222
|
+
const { resolveNodeRole } = await Promise.resolve().then(() => __importStar(require('./node-role.js')));
|
|
188
223
|
const role = resolveNodeRole(process.env);
|
|
189
224
|
console.log(`[launcher] Node role: ${role}`);
|
|
190
225
|
// Addons live in a real `node_modules`-shaped dir so ESM `import` resolves
|
|
@@ -210,11 +245,11 @@ async function launch() {
|
|
|
210
245
|
// Restore must happen first so the snapshot's `addons/` is what the
|
|
211
246
|
// installer + symlink step pick up — otherwise we'd install a stale
|
|
212
247
|
// set and overwrite it a step later.
|
|
213
|
-
await applyPendingRestore(dataDir, (line) => console.log(line));
|
|
248
|
+
await (0, pending_restore_js_1.applyPendingRestore)(dataDir, (line) => console.log(line));
|
|
214
249
|
// @camstack/system is imported DYNAMICALLY here — AFTER the active framework
|
|
215
250
|
// dir + NODE_PATH are resolved above — so the correct framework copy is what
|
|
216
251
|
// gets loaded. Never import it at module top.
|
|
217
|
-
const { AddonInstaller, bootstrapSchema, detectWorkspacePackagesDir, quarantineAddonResidue } = await
|
|
252
|
+
const { AddonInstaller, bootstrapSchema, detectWorkspacePackagesDir, quarantineAddonResidue } = await Promise.resolve().then(() => __importStar(require('@camstack/system')));
|
|
218
253
|
// Residue quarantine — FIRST thing that touches the addon root, before the
|
|
219
254
|
// bootstrap seed writes into it and long before any loader scans it.
|
|
220
255
|
//
|
|
@@ -316,8 +351,8 @@ async function launch() {
|
|
|
316
351
|
//
|
|
317
352
|
// Diagnostics, so it can never end a boot: same policy as the inventories.
|
|
318
353
|
try {
|
|
319
|
-
const closureNodeModules = resolveClosureNodeModules(__dirname);
|
|
320
|
-
const plan = planFirstBootAddons({
|
|
354
|
+
const closureNodeModules = (0, closure_node_modules_js_1.resolveClosureNodeModules)(__dirname);
|
|
355
|
+
const plan = (0, first_boot_addon_plan_js_1.planFirstBootAddons)({
|
|
321
356
|
required: bootstrapRequired,
|
|
322
357
|
installed: readInstalledAddonVersions(addonsDir, bootstrapRequired),
|
|
323
358
|
closureVersions: readInstalledAddonVersions(closureNodeModules, bootstrapRequired),
|
|
@@ -333,7 +368,7 @@ async function launch() {
|
|
|
333
368
|
}
|
|
334
369
|
})(),
|
|
335
370
|
});
|
|
336
|
-
for (const line of formatFirstBootPlan(plan, 'observe')) {
|
|
371
|
+
for (const line of (0, first_boot_addon_plan_js_1.formatFirstBootPlan)(plan, 'observe')) {
|
|
337
372
|
console.log(`[launcher] ${line}`);
|
|
338
373
|
}
|
|
339
374
|
}
|
|
@@ -355,8 +390,8 @@ async function launch() {
|
|
|
355
390
|
// re-alignment that throws must never end a boot. An addon that stays behind
|
|
356
391
|
// is the status quo; a node that will not start is not.
|
|
357
392
|
try {
|
|
358
|
-
const closureNodeModules = resolveClosureNodeModules(__dirname);
|
|
359
|
-
const decisions = planAddonRealignment(bootstrapRequired.flatMap((pkg) => {
|
|
393
|
+
const closureNodeModules = (0, closure_node_modules_js_1.resolveClosureNodeModules)(__dirname);
|
|
394
|
+
const decisions = (0, addon_realign_plan_js_1.planAddonRealignment)(bootstrapRequired.flatMap((pkg) => {
|
|
360
395
|
const installedVersion = readInstalledAddonVersions(addonsDir, [pkg])[pkg];
|
|
361
396
|
if (typeof installedVersion !== 'string')
|
|
362
397
|
return [];
|
|
@@ -474,7 +509,7 @@ async function launch() {
|
|
|
474
509
|
// etc); the server-local node_modules has direct deps. Listing
|
|
475
510
|
// both covers every realistic resolution.
|
|
476
511
|
const workspaceRootNodeModules = path.resolve(serverDir, '..', '..', 'node_modules');
|
|
477
|
-
const frameworkPaths = frameworkNodePaths(process.env['CAMSTACK_FRAMEWORK_DIR'], fs.existsSync);
|
|
512
|
+
const frameworkPaths = (0, framework_nodepath_js_1.frameworkNodePaths)(process.env['CAMSTACK_FRAMEWORK_DIR'], fs.existsSync);
|
|
478
513
|
const extraNodePaths = [...frameworkPaths, nodeModulesDir, workspaceRootNodeModules].filter((p) => fs.existsSync(p));
|
|
479
514
|
if (frameworkPaths.length > 0) {
|
|
480
515
|
console.log(`[launcher] Framework dir on NODE_PATH: ${frameworkPaths[0]}`);
|
|
@@ -537,13 +572,13 @@ async function launch() {
|
|
|
537
572
|
//
|
|
538
573
|
// [inventory-diagnostics-begin] enforced by scripts/check-inventory-never-fatal.ts
|
|
539
574
|
try {
|
|
540
|
-
const inventory = inventoryHostProvided(hostProvidedSearchRoots({
|
|
575
|
+
const inventory = (0, package_inventory_js_1.inventoryHostProvided)((0, package_inventory_js_1.hostProvidedSearchRoots)({
|
|
541
576
|
nodePath: process.env['NODE_PATH'],
|
|
542
577
|
pathSeparator: process.platform === 'win32' ? ';' : ':',
|
|
543
578
|
dataDir: DATA_DIR,
|
|
544
579
|
serverNodeModules: nodeModulesDir,
|
|
545
580
|
frameworkRoots: frameworkPaths,
|
|
546
|
-
seedRoots: seedNodeModulesRoots(fs),
|
|
581
|
+
seedRoots: (0, package_inventory_js_1.seedNodeModulesRoots)(fs),
|
|
547
582
|
}), {
|
|
548
583
|
exists: (dir) => fs.existsSync(path.join(dir, 'package.json')),
|
|
549
584
|
readVersion: (dir) => {
|
|
@@ -567,10 +602,10 @@ async function launch() {
|
|
|
567
602
|
}
|
|
568
603
|
},
|
|
569
604
|
});
|
|
570
|
-
for (const note of formatShadowingNotes(inventory)) {
|
|
605
|
+
for (const note of (0, package_inventory_js_1.formatShadowingNotes)(inventory)) {
|
|
571
606
|
console.log(`[launcher] ${note}`);
|
|
572
607
|
}
|
|
573
|
-
const report = formatInventoryReport(inventory);
|
|
608
|
+
const report = (0, package_inventory_js_1.formatInventoryReport)(inventory);
|
|
574
609
|
if (report !== '') {
|
|
575
610
|
console.error(`[launcher] ${report}`);
|
|
576
611
|
}
|
|
@@ -594,7 +629,7 @@ async function launch() {
|
|
|
594
629
|
// no flag changes it. Making the second location LOUD is the whole job;
|
|
595
630
|
// removing it stays an operator decision.
|
|
596
631
|
try {
|
|
597
|
-
const addonRoots = inventoryAddonRoots({
|
|
632
|
+
const addonRoots = (0, addon_root_inventory_js_1.inventoryAddonRoots)({
|
|
598
633
|
dataDir: DATA_DIR,
|
|
599
634
|
activeAddonsDir: addonsDir,
|
|
600
635
|
homeDir: os.homedir(),
|
|
@@ -633,7 +668,7 @@ async function launch() {
|
|
|
633
668
|
}
|
|
634
669
|
},
|
|
635
670
|
});
|
|
636
|
-
const addonRootReport = formatAddonRootReport(addonRoots);
|
|
671
|
+
const addonRootReport = (0, addon_root_inventory_js_1.formatAddonRootReport)(addonRoots);
|
|
637
672
|
if (addonRootReport !== '') {
|
|
638
673
|
console.error(`[launcher] ${addonRootReport}`);
|
|
639
674
|
}
|
|
@@ -648,12 +683,12 @@ async function launch() {
|
|
|
648
683
|
// no separate agent root package.
|
|
649
684
|
if (role === 'agent') {
|
|
650
685
|
console.log('[launcher] Starting agent runtime...');
|
|
651
|
-
const { startAgent } = await
|
|
686
|
+
const { startAgent } = await Promise.resolve().then(() => __importStar(require('./agent/main.js')));
|
|
652
687
|
await startAgent();
|
|
653
688
|
}
|
|
654
689
|
else {
|
|
655
690
|
console.log('[launcher] Starting server...');
|
|
656
|
-
await
|
|
691
|
+
await Promise.resolve().then(() => __importStar(require('./main')));
|
|
657
692
|
}
|
|
658
693
|
// The role runtime has installed its own SIGTERM/SIGINT handlers now. Stop
|
|
659
694
|
// intercepting those signals here: calling process.exit() first prevented the
|
|
@@ -1,5 +1,41 @@
|
|
|
1
|
-
|
|
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.lifecycleJobsDir = lifecycleJobsDir;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
2
38
|
/** Single source of truth for the lifecycle job journal directory. */
|
|
3
|
-
|
|
39
|
+
function lifecycleJobsDir(dataDir) {
|
|
4
40
|
return path.join(dataDir, 'lifecycle', 'jobs');
|
|
5
41
|
}
|