@camstack/server 1.2.789 → 1.2.791
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/CHANGELOG.md +15 -0
- package/dist/agent/agent-child-manifest.js +39 -0
- package/dist/agent/agent-hub-registration.js +11 -1
- package/dist/agent/forward-to-hub.js +43 -0
- package/dist/agent/main.js +31 -81
- package/dist/agent/stale-addon-gate.js +70 -34
- package/dist/api/trpc/device-config-secret-redaction.js +14 -1
- package/dist/api/trpc/generated-cap-mounts.js +1 -6
- package/dist/api/trpc/generated-cap-routers.js +1245 -1417
- package/dist/api/trpc/localized-schema-paths.js +1 -0
- package/dist/core/addon/addon-registry.service.js +25 -33
- package/dist/core/addon/addon-settings-provider.js +57 -0
- package/dist/core/addon/boot-health-snapshot.js +0 -28
- package/dist/core/addon/{hub-spawn-gate.js → hub-addon-support.js} +12 -35
- package/dist/core/moleculer/moleculer.service.js +2 -13
- package/dist/core/moleculer/runner-hosted-on-node.js +23 -0
- package/dist/core/updates/required-addon-update.js +1 -1
- package/package.json +20 -11
- package/system/dist/addon-runner.js +22 -0
- package/system/dist/addon-runner.mjs +22 -0
- package/system/dist/{agent-https-szf2FU49.mjs → agent-https-BmVaVskH.mjs} +1 -1
- package/system/dist/{agent-https-jJDe-XNl.js → agent-https-DOs15BCJ.js} +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.d.ts +8 -0
- package/system/dist/builtins/alerts/alerts.addon.js +72 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +72 -1
- package/system/dist/builtins/autotrack/autotrack.addon.d.ts +7 -7
- package/system/dist/builtins/autotrack/index.js +15 -8
- package/system/dist/builtins/autotrack/index.mjs +15 -8
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +3 -3
- package/system/dist/builtins/composer/composer.addon.mjs +3 -3
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +11 -5
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +11 -5
- package/system/dist/builtins/device-history/device-history.addon.js +2 -2
- package/system/dist/builtins/device-history/device-history.addon.mjs +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +1 -1
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +1 -1
- package/system/dist/builtins/hub-forwarder/index.js +1 -1
- package/system/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/system/dist/builtins/keychain/index.js +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +2 -2
- package/system/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/system/dist/builtins/loki-logging/index.js +1 -1
- package/system/dist/builtins/loki-logging/index.mjs +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/system/dist/builtins/platform-probe/index.js +1 -1
- package/system/dist/builtins/platform-probe/index.mjs +1 -1
- package/system/dist/builtins/record-entries/index.js +1 -1
- package/system/dist/builtins/record-entries/index.mjs +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.d.ts +4 -10
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +16 -9
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +16 -9
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/access-guards.d.ts +1 -1
- package/system/dist/builtins/storage-orchestrator/custom-actions.d.ts +11 -0
- package/system/dist/builtins/storage-orchestrator/index.d.ts +1 -0
- package/system/dist/builtins/storage-orchestrator/index.js +2 -0
- package/system/dist/builtins/storage-orchestrator/index.mjs +2 -2
- package/system/dist/builtins/storage-orchestrator/location-instances.d.ts +72 -0
- package/system/dist/builtins/storage-orchestrator/location-repoint-move.d.ts +1 -1
- package/system/dist/builtins/storage-orchestrator/location-secret-refs.d.ts +26 -0
- package/system/dist/builtins/storage-orchestrator/location-store.d.ts +28 -2
- package/system/dist/builtins/storage-orchestrator/migrations/index.d.ts +9 -2
- package/system/dist/builtins/storage-orchestrator/migrations/legacy-location-secret-refs.d.ts +13 -0
- package/system/dist/builtins/storage-orchestrator/migrations/location-secret-ports.d.ts +15 -0
- package/system/dist/builtins/storage-orchestrator/migrations/location-secrets-to-record.d.ts +57 -0
- package/system/dist/builtins/storage-orchestrator/provider-discovery.d.ts +10 -13
- package/system/dist/builtins/storage-orchestrator/record-kinds.d.ts +6 -0
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +39 -8
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +954 -131
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +954 -132
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.service.d.ts +8 -0
- package/system/dist/builtins/system-config/system-config.addon.js +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +284 -284
- package/system/dist/builtins/winston-logging/index.js +112 -3
- package/system/dist/builtins/winston-logging/index.mjs +112 -3
- package/system/dist/builtins/winston-logging/migrations/index.d.ts +8 -0
- package/system/dist/builtins/winston-logging/migrations/node-fields.d.ts +43 -0
- package/system/dist/builtins/winston-logging/winston-logging.addon.d.ts +10 -2
- package/system/dist/{capture-engine-DNHgjQot.js → capture-engine-BVpkq9Mv.js} +1 -1
- package/system/dist/{capture-engine-BsKY_3xa.mjs → capture-engine-D-oUDtX5.mjs} +1 -1
- package/system/dist/{composition-sources-BRdGsbVT.mjs → composition-sources-Br7JhpbD.mjs} +1 -1
- package/system/dist/{composition-sources-BgO0GQYW.js → composition-sources-DKCbVA67.js} +1 -1
- package/system/dist/{constants-CQeMrR4f.mjs → constants-Bl0Qxbek.mjs} +1 -1
- package/system/dist/{constants-C3jGKQSQ.js → constants-CJVY-mUq.js} +1 -1
- package/system/dist/{device-ca-ByVi5eUC.mjs → device-ca-BeDGy8NK.mjs} +1 -1
- package/system/dist/{device-ca-D3y6wGmn.js → device-ca-i8EbKp3q.js} +1 -1
- package/system/dist/{dist-BsQA6-0i.mjs → dist-CPUbgRkb.mjs} +395 -425
- package/system/dist/{dist-BRI-Mwx0.js → dist-Ddkk4Dqq.js} +412 -424
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-mdns-ciao-8dJTW2LI.mjs → hub-mdns-ciao-DgF4SifE.mjs} +2 -2
- package/system/dist/{hub-mdns-ciao-Ry_Jpljx.js → hub-mdns-ciao-lHRHbXqV.js} +2 -2
- package/system/dist/index.js +151 -53
- package/system/dist/index.mjs +151 -55
- package/system/dist/kernel/addon-health-monitor.d.ts +0 -21
- package/system/dist/kernel/index.d.ts +2 -0
- package/system/dist/kernel/transport/child-cap-protocol.d.ts +1 -1
- package/system/dist/kernel/transport/runner-of-addon.d.ts +2 -0
- package/system/dist/kernel/unsupported-addon-tracker.d.ts +74 -0
- package/system/dist/{legacy-integration-rows-door-CjXTbmvH.mjs → legacy-integration-rows-door-9JSt493H.mjs} +1 -1
- package/system/dist/{legacy-integration-rows-door-D5BdSNla.js → legacy-integration-rows-door-n9GIUxgq.js} +1 -1
- package/system/dist/{restore-archive-GoWJMdHy.js → restore-archive-BDvLSZtj.js} +1 -1
- package/system/dist/{restore-archive-vn4co_kf.mjs → restore-archive-Dh3XnCR1.mjs} +82 -82
- package/system/dist/{wal-maintenance-CadfiGWy.mjs → wal-maintenance-BQJAmAwS.mjs} +0 -0
- package/system/dist/{wal-maintenance-sSlXJm4k.js → wal-maintenance-CWlz_qRq.js} +0 -0
- package/system/package.json +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.2.791] - 2026-11-07
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- The addon-settings capability answers scoped settings reads and writes for in-process and forked addons.
|
|
15
|
+
- A non-admin cannot read secrets through the scoped settings read, and its schema text is localized like the global one
|
|
16
|
+
|
|
17
|
+
## [1.2.790] - 2026-11-07
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- A grouped addon on an agent (for example the pipeline runner) is now recognised by the hub from its first call, so its migrations are no longer refused with "no caller identity" at boot.
|
|
22
|
+
- An addon running below the version the server requires now always starts, and raises an alert naming the installed and required versions until its package is updated.
|
|
23
|
+
- Storage locations are now integration instances, with credentials kept per location in the keychain.
|
|
24
|
+
|
|
10
25
|
## [1.2.789] - 2026-11-06
|
|
11
26
|
|
|
12
27
|
### Changed
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildAgentChildUdsManifest = buildAgentChildUdsManifest;
|
|
4
|
+
/**
|
|
5
|
+
* Adapt a child's UDS `ChildCapDescriptor[]` into a `RegisterNodeParams` for the agent's subtree
|
|
6
|
+
* HubNodeRegistry.
|
|
7
|
+
*
|
|
8
|
+
* Multi-addon manifest support (co-location): descriptors are grouped by the `addonId` each one
|
|
9
|
+
* carries, producing one manifest entry per hosted addon, so a GROUPED runner (`execution.group`)
|
|
10
|
+
* registers each addon's caps under its REAL addon id. A legacy child that omits `addonId` falls
|
|
11
|
+
* back to `childId`.
|
|
12
|
+
*
|
|
13
|
+
* `hostedAddons` are the addons the agent's spawn plan put in this runner. They get an entry even
|
|
14
|
+
* with no caps: the PRE-INIT register carries none, yet the hub verifies a caller stamp (a member
|
|
15
|
+
* addon id, for the caps keyed by the addon) against this manifest, and a grouped addon's first
|
|
16
|
+
* calls (its migrations) happen during init, before the post-init register.
|
|
17
|
+
*
|
|
18
|
+
* Only system (non-device-scoped) caps go into `addons`; device-scoped native caps arrive on a
|
|
19
|
+
* later re-handshake via the Moleculer path.
|
|
20
|
+
*/
|
|
21
|
+
function buildAgentChildUdsManifest(nodeId, childId, caps, hostedAddons = []) {
|
|
22
|
+
const capsByAddon = new Map();
|
|
23
|
+
for (const addonId of hostedAddons)
|
|
24
|
+
capsByAddon.set(addonId, new Set());
|
|
25
|
+
for (const cap of caps) {
|
|
26
|
+
if (cap.deviceId !== undefined)
|
|
27
|
+
continue;
|
|
28
|
+
const addonId = cap.addonId ?? childId;
|
|
29
|
+
const set = capsByAddon.get(addonId) ?? new Set();
|
|
30
|
+
set.add(cap.capName);
|
|
31
|
+
capsByAddon.set(addonId, set);
|
|
32
|
+
}
|
|
33
|
+
// A register that declared no system cap keeps the runner's own entry (pre-init, as before).
|
|
34
|
+
if (!capsByAddon.has(childId) && !caps.some((cap) => cap.deviceId === undefined)) {
|
|
35
|
+
capsByAddon.set(childId, new Set());
|
|
36
|
+
}
|
|
37
|
+
const addons = [...capsByAddon.entries()].map(([addonId, capNames]) => ({ addonId, capabilities: [...capNames] }));
|
|
38
|
+
return { nodeId, addons };
|
|
39
|
+
}
|
|
@@ -32,6 +32,7 @@ const system_1 = require("@camstack/server/system");
|
|
|
32
32
|
function createAgentHubRegistration(opts) {
|
|
33
33
|
let sending = false;
|
|
34
34
|
let queuedReason = null;
|
|
35
|
+
let waiters = [];
|
|
35
36
|
const send = (reason) => {
|
|
36
37
|
sending = true;
|
|
37
38
|
const manifest = opts.buildManifest();
|
|
@@ -61,8 +62,14 @@ function createAgentHubRegistration(opts) {
|
|
|
61
62
|
sending = false;
|
|
62
63
|
const next = queuedReason;
|
|
63
64
|
queuedReason = null;
|
|
64
|
-
if (next !== null)
|
|
65
|
+
if (next !== null) {
|
|
65
66
|
trigger(next);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const done = waiters;
|
|
70
|
+
waiters = [];
|
|
71
|
+
for (const resolve of done)
|
|
72
|
+
resolve();
|
|
66
73
|
});
|
|
67
74
|
};
|
|
68
75
|
const trigger = (reason) => {
|
|
@@ -74,6 +81,9 @@ function createAgentHubRegistration(opts) {
|
|
|
74
81
|
};
|
|
75
82
|
return {
|
|
76
83
|
trigger,
|
|
84
|
+
settled: () => sending || queuedReason !== null
|
|
85
|
+
? new Promise((resolve) => waiters.push(resolve))
|
|
86
|
+
: Promise.resolve(),
|
|
77
87
|
onHubConnected() {
|
|
78
88
|
trigger('hub connected');
|
|
79
89
|
},
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORWARD_TO_HUB_TIMEOUT_MS = void 0;
|
|
4
|
+
exports.createForwardToHub = createForwardToHub;
|
|
5
|
+
/** The budget one agent -> hub cap call has, registration wait included. */
|
|
6
|
+
exports.FORWARD_TO_HUB_TIMEOUT_MS = 60_000;
|
|
7
|
+
/**
|
|
8
|
+
* Agent -> hub forward of a child's cap call. A stamped call is believed by the hub only against
|
|
9
|
+
* the manifest it holds for this node, so it goes after the registration in flight landed - but
|
|
10
|
+
* never later than the call's own budget: with the hub unreachable the registration retries
|
|
11
|
+
* forever, and the call must still fail at its deadline as it always did. On expiry the call
|
|
12
|
+
* goes out anyway (the hub drops an unverified stamp) with only the remaining budget.
|
|
13
|
+
*/
|
|
14
|
+
function createForwardToHub(deps) {
|
|
15
|
+
const budget = deps.timeoutMs ?? exports.FORWARD_TO_HUB_TIMEOUT_MS;
|
|
16
|
+
return async (input) => {
|
|
17
|
+
const startedAt = Date.now();
|
|
18
|
+
if (input.callerAddonId !== undefined) {
|
|
19
|
+
const deadline = AbortSignal.timeout(budget);
|
|
20
|
+
const expired = new Promise((resolve) => deadline.addEventListener('abort', () => resolve('expired'), {
|
|
21
|
+
once: true,
|
|
22
|
+
}));
|
|
23
|
+
const outcome = await Promise.race([deps.settled().then(() => 'settled'), expired]);
|
|
24
|
+
if (outcome === 'expired') {
|
|
25
|
+
deps.log.warn('a stamped cap call went out before the registration settled', {
|
|
26
|
+
tags: { addonId: input.callerAddonId },
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const remaining = Math.max(1, budget - (Date.now() - startedAt));
|
|
31
|
+
return deps.call({
|
|
32
|
+
capName: input.capName,
|
|
33
|
+
method: input.method,
|
|
34
|
+
args: input.args,
|
|
35
|
+
...(input.deviceId !== undefined ? { deviceId: input.deviceId } : {}),
|
|
36
|
+
...(input.nodeId !== undefined ? { nodeId: input.nodeId } : {}),
|
|
37
|
+
// The native-only hint must survive the forward: the agent has no native authority.
|
|
38
|
+
...(input.native === true ? { native: true } : {}),
|
|
39
|
+
// WHO is calling: stamped by this agent's registry off the child connection (D787).
|
|
40
|
+
...(input.callerAddonId !== undefined ? { callerAddonId: input.callerAddonId } : {}),
|
|
41
|
+
}, remaining);
|
|
42
|
+
};
|
|
43
|
+
}
|
package/dist/agent/main.js
CHANGED
|
@@ -82,6 +82,8 @@ const register_agent_cap_dispatch_js_1 = require("./register-agent-cap-dispatch.
|
|
|
82
82
|
// entries flow through it (console output + hub forwarding).
|
|
83
83
|
// ---------------------------------------------------------------------------
|
|
84
84
|
const system_2 = require("@camstack/server/system");
|
|
85
|
+
const forward_to_hub_js_1 = require("./forward-to-hub.js");
|
|
86
|
+
const agent_child_manifest_js_1 = require("./agent-child-manifest.js");
|
|
85
87
|
const agent_heap_watch_js_1 = require("./agent-heap-watch.js");
|
|
86
88
|
/** A reconnect (stop + rebuild + start) that takes longer than this is abandoned. */
|
|
87
89
|
const RECONNECT_DEADLINE_MS = 90_000;
|
|
@@ -667,23 +669,13 @@ async function startAgent(configPath) {
|
|
|
667
669
|
// makes an agent's forked addon reach a hub-hosted cap (`stream-broker`,
|
|
668
670
|
// `settings-store`, …) instead of 30s-deadlining on raw `${cap}.*`
|
|
669
671
|
// discovery (hub-local addon runners expose no Moleculer service).
|
|
670
|
-
forwardToHub: (
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
// native authority of its own (no CapRouteResolver, no cluster
|
|
678
|
-
// CapabilityRegistry), so the hub answers "native or nothing" on
|
|
679
|
-
// its behalf. Dropping it here would let the hub resolve the cap
|
|
680
|
-
// NAME instead — i.e. the wrapper the caller is trying to skip.
|
|
681
|
-
...(input.native === true ? { native: true } : {}),
|
|
682
|
-
// WHO is calling: this agent's registry stamped it off the child
|
|
683
|
-
// connection the call arrived on. The hub checks it against this
|
|
684
|
-
// node and hands it to owner-checked caps (the keychain, D787).
|
|
685
|
-
...(input.callerAddonId !== undefined ? { callerAddonId: input.callerAddonId } : {}),
|
|
686
|
-
}, { timeout: 60_000 }),
|
|
672
|
+
forwardToHub: (0, forward_to_hub_js_1.createForwardToHub)({
|
|
673
|
+
settled: () => registration.settled(),
|
|
674
|
+
call: (envelope, timeoutMs) => broker.call(system_1.HUB_CAP_FWD_ACTION, envelope, { timeout: timeoutMs }),
|
|
675
|
+
log: {
|
|
676
|
+
warn: (msg, extras) => consoleLogger.warn(`[uds-fallback] ${msg}`, extras),
|
|
677
|
+
},
|
|
678
|
+
}),
|
|
687
679
|
logger: { warn: (msg) => consoleLogger.warn(`[uds-fallback] ${msg}`) },
|
|
688
680
|
});
|
|
689
681
|
agentUdsRegistry = new system_1.LocalChildRegistry({
|
|
@@ -729,7 +721,7 @@ async function startAgent(configPath) {
|
|
|
729
721
|
// fires first, the subtree's atomic-replace handles the re-registration safely.
|
|
730
722
|
agentUdsRegistry.onChildRegistered((child) => {
|
|
731
723
|
const childNodeId = `${agentNodeId}/${child.childId}`;
|
|
732
|
-
const childParams = buildAgentChildUdsManifest(childNodeId, child.childId, child.caps);
|
|
724
|
+
const childParams = (0, agent_child_manifest_js_1.buildAgentChildUdsManifest)(childNodeId, child.childId, child.caps, agentRunnerOfAddon.addonsOf(child.childId));
|
|
733
725
|
subtree.registerNode(childParams);
|
|
734
726
|
registration.trigger(`child ${childNodeId} connected`);
|
|
735
727
|
consoleLogger.info(`UDS child registered — subtree updated: ${childNodeId}`);
|
|
@@ -1078,6 +1070,7 @@ async function startAgent(configPath) {
|
|
|
1078
1070
|
run: async () => {
|
|
1079
1071
|
// Abort any in-flight upward hub registration retry loop.
|
|
1080
1072
|
registerAbortController.abort();
|
|
1073
|
+
unsupportedAddonTracker?.stop();
|
|
1081
1074
|
// Dispose the UDS event bridge to remove the parent-bus subscriber and
|
|
1082
1075
|
// clear the child-event handler, preventing subscriber leaks on shutdown.
|
|
1083
1076
|
udsEventBridgeDispose?.();
|
|
@@ -1105,7 +1098,10 @@ async function startAgent(configPath) {
|
|
|
1105
1098
|
// Withdraw the mDNS advertisement, then stop accepting new HTTP/HTTPS connections before
|
|
1106
1099
|
// the broker goes away.
|
|
1107
1100
|
{ name: 'mdns', run: () => agentMdns.stop() },
|
|
1108
|
-
{
|
|
1101
|
+
{
|
|
1102
|
+
name: 'http-listener',
|
|
1103
|
+
run: async () => void (await agentHttpListener?.close()),
|
|
1104
|
+
},
|
|
1109
1105
|
{ name: 'broker', run: () => broker.stop() },
|
|
1110
1106
|
],
|
|
1111
1107
|
});
|
|
@@ -1297,24 +1293,24 @@ async function bootCoreAddons(broker, config, registry, loadedAddons, loggerFact
|
|
|
1297
1293
|
// Phase 1.5: Load cluster-capable addon packages
|
|
1298
1294
|
// ---------------------------------------------------------------------------
|
|
1299
1295
|
/**
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1296
|
+
* Judge the candidates whose package may be below what THIS server requires
|
|
1297
|
+
* (#346) and report it. Every candidate is spawned: an unsupported addon runs
|
|
1298
|
+
* and raises the operator alert (D1017); the hub's registration reconcile
|
|
1299
|
+
* delivers the right version and the deploy's reload re-judges it.
|
|
1303
1300
|
*/
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1301
|
+
let unsupportedAddonTracker = null;
|
|
1302
|
+
function groupForSpawn(broker, candidates, addonsDir, installed) {
|
|
1303
|
+
unsupportedAddonTracker ??= new system_1.UnsupportedAddonTracker({
|
|
1304
|
+
eventBus: (0, system_1.getBrokerEventBus)(broker),
|
|
1305
|
+
nodeId: broker.nodeID,
|
|
1306
|
+
log: (line) => console.warn(`[Agent] ${line}`),
|
|
1307
|
+
});
|
|
1308
|
+
return (0, stale_addon_gate_js_1.groupCandidatesForSpawn)(candidates, {
|
|
1308
1309
|
serverVersion: (0, addon_requirements_js_1.readRunningServerVersion)(),
|
|
1309
1310
|
serverRequiresAddons: (0, addon_requirements_js_1.readRunningServerAddonMinimums)(),
|
|
1310
1311
|
installedVersions: (0, installed_addon_versions_js_1.readInstalledAddonVersions)(addonsDir),
|
|
1311
1312
|
requiresOfDir: stale_addon_gate_js_1.readPackageRequires,
|
|
1312
|
-
});
|
|
1313
|
-
for (const d of deferred)
|
|
1314
|
-
log(`[Agent] ${d.reason}`);
|
|
1315
|
-
for (const line of unjudged)
|
|
1316
|
-
log(`[Agent] ${line}`);
|
|
1317
|
-
return ready;
|
|
1313
|
+
}, unsupportedAddonTracker, installed);
|
|
1318
1314
|
}
|
|
1319
1315
|
async function loadClusterCapableAddons(broker, config, capabilityRegistry, loadedAddons) {
|
|
1320
1316
|
// Builtins are in-process infra, never group-spawned, and they come from the
|
|
@@ -1365,14 +1361,8 @@ async function loadClusterCapableAddons(broker, config, capabilityRegistry, load
|
|
|
1365
1361
|
});
|
|
1366
1362
|
}
|
|
1367
1363
|
}
|
|
1368
|
-
const
|
|
1369
|
-
if (
|
|
1370
|
-
const grouped = new Map();
|
|
1371
|
-
for (const c of spawnableGroupCandidates) {
|
|
1372
|
-
const arr = grouped.get(c.groupId) ?? [];
|
|
1373
|
-
arr.push(c);
|
|
1374
|
-
grouped.set(c.groupId, arr);
|
|
1375
|
-
}
|
|
1364
|
+
const grouped = groupForSpawn(broker, allGroupCandidates, config.addonsDir, allGroupCandidates.map((c) => c.packageName));
|
|
1365
|
+
if (allGroupCandidates.length > 0) {
|
|
1376
1366
|
for (const [groupId, addons] of grouped) {
|
|
1377
1367
|
try {
|
|
1378
1368
|
await broker.call('$process.spawnRunner', {
|
|
@@ -1472,12 +1462,7 @@ async function loadDeployedAddons(broker, addonsDir, dataDir, loadedAddons, stor
|
|
|
1472
1462
|
console.warn(`[Agent] ${groupCandidates.length} deployed group addon(s) skipped — no capabilityRegistry passed`);
|
|
1473
1463
|
return;
|
|
1474
1464
|
}
|
|
1475
|
-
const grouped =
|
|
1476
|
-
for (const c of spawnableCandidates(groupCandidates, addonsDir, (l) => console.warn(l))) {
|
|
1477
|
-
const arr = grouped.get(c.groupId) ?? [];
|
|
1478
|
-
arr.push(c);
|
|
1479
|
-
grouped.set(c.groupId, arr);
|
|
1480
|
-
}
|
|
1465
|
+
const grouped = groupForSpawn(broker, groupCandidates, addonsDir);
|
|
1481
1466
|
const deployLogger = loggerFactory('agent-group-runner');
|
|
1482
1467
|
for (const [groupId, addons] of grouped) {
|
|
1483
1468
|
await (0, agent_group_runner_js_1.ensureGroupRunner)({ broker, capabilityRegistry, loadedAddons, logger: deployLogger }, groupId, addons);
|
|
@@ -1580,38 +1565,3 @@ function readAgentVersion() {
|
|
|
1580
1565
|
function systemSkipList() {
|
|
1581
1566
|
return (0, package_dir_utils_js_1.resolveBuiltinsDir)() === null ? [] : [addon_scan_js_1.BUILTINS_PACKAGE];
|
|
1582
1567
|
}
|
|
1583
|
-
// ---------------------------------------------------------------------------
|
|
1584
|
-
// E1 helper — agent-local UDS child manifest adaptation
|
|
1585
|
-
// ---------------------------------------------------------------------------
|
|
1586
|
-
/**
|
|
1587
|
-
* Adapt a child's UDS `ChildCapDescriptor[]` into a `RegisterNodeParams`
|
|
1588
|
-
* for the agent's subtree HubNodeRegistry.
|
|
1589
|
-
*
|
|
1590
|
-
* Multi-addon manifest support (co-location): descriptors are grouped by the
|
|
1591
|
-
* `addonId` each one carries, producing one manifest entry per hosted addon —
|
|
1592
|
-
* a GROUPED runner (`execution.group`) registers each addon's caps under its
|
|
1593
|
-
* REAL addon id instead of collapsing them under a synthetic
|
|
1594
|
-
* `addonId = childId` (the group name). A legacy child that omits `addonId`
|
|
1595
|
-
* falls back to `childId` — identical to the historical single-addon
|
|
1596
|
-
* behaviour (childId = runnerId = addonId when no group is declared).
|
|
1597
|
-
* Mirrors the hub's `buildChildUdsManifest`.
|
|
1598
|
-
*
|
|
1599
|
-
* Only system (non-device-scoped) caps go into `addons`; device-scoped native
|
|
1600
|
-
* caps arrive on a later re-handshake via the Moleculer path.
|
|
1601
|
-
*/
|
|
1602
|
-
function buildAgentChildUdsManifest(nodeId, childId, caps) {
|
|
1603
|
-
const capsByAddon = new Map();
|
|
1604
|
-
for (const cap of caps) {
|
|
1605
|
-
if (cap.deviceId !== undefined)
|
|
1606
|
-
continue;
|
|
1607
|
-
const addonId = cap.addonId ?? childId;
|
|
1608
|
-
const set = capsByAddon.get(addonId) ?? new Set();
|
|
1609
|
-
set.add(cap.capName);
|
|
1610
|
-
capsByAddon.set(addonId, set);
|
|
1611
|
-
}
|
|
1612
|
-
if (capsByAddon.size === 0) {
|
|
1613
|
-
capsByAddon.set(childId, new Set());
|
|
1614
|
-
}
|
|
1615
|
-
const addons = [...capsByAddon.entries()].map(([addonId, capNames]) => ({ addonId, capabilities: [...capNames] }));
|
|
1616
|
-
return { nodeId, addons };
|
|
1617
|
-
}
|
|
@@ -34,30 +34,33 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.isUnreadableRequires = isUnreadableRequires;
|
|
37
|
-
exports.
|
|
37
|
+
exports.judgeSupport = judgeSupport;
|
|
38
|
+
exports.supportFactsOf = supportFactsOf;
|
|
39
|
+
exports.reportSupport = reportSupport;
|
|
40
|
+
exports.groupCandidatesForSpawn = groupCandidatesForSpawn;
|
|
38
41
|
exports.readPackageRequires = readPackageRequires;
|
|
39
42
|
/**
|
|
40
|
-
* The
|
|
43
|
+
* The support judgement for an addon whose package may be stale (#346, D989).
|
|
41
44
|
*
|
|
42
|
-
* After `applyServerUpdate`
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
45
|
+
* After `applyServerUpdate` a node restarts with the addons already on disk. An
|
|
46
|
+
* addon built for the previous framework may be BELOW what the new server
|
|
47
|
+
* requires. It is still started - a held-back addon is invisible and loses its
|
|
48
|
+
* function silently, and the `CrashSupervisor` (D6) bounds a crash loop - but
|
|
49
|
+
* the operator is told: `judgeSupport` produces the facts of the alert (addon,
|
|
50
|
+
* installed version, required minimum, server version) and the caller hands them
|
|
51
|
+
* to the `UnsupportedAddonTracker`. The reconcile (D982) still moves the package
|
|
52
|
+
* toward the required version.
|
|
49
53
|
*
|
|
50
|
-
*
|
|
54
|
+
* Unsupported means either:
|
|
51
55
|
* - the RUNNING server requires a newer version of this addon's package
|
|
52
56
|
* (`requires.addons` of the server), or
|
|
53
57
|
* - the addon's own `requires.server` is above the running server.
|
|
54
58
|
*
|
|
55
|
-
* A fact that cannot be read is UNKNOWN,
|
|
59
|
+
* A fact that cannot be read is UNKNOWN: no alert, the addon runs, and it is
|
|
60
|
+
* reported in `unjudged` so the caller logs it. That covers a package whose own
|
|
56
61
|
* `requires` cannot be read (missing, malformed or schema-invalid package.json)
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* held would leave the node empty) but reported in `unjudged`, so the caller
|
|
60
|
-
* logs it. The addon-minimum check does not need the version and still runs.
|
|
62
|
+
* and a running server version that cannot be read (the addon's own
|
|
63
|
+
* `requires.server` is then unjudged; the addon-minimum check still runs).
|
|
61
64
|
*/
|
|
62
65
|
const fs = __importStar(require("node:fs"));
|
|
63
66
|
const path = __importStar(require("node:path"));
|
|
@@ -65,9 +68,8 @@ const types_1 = require("@camstack/types");
|
|
|
65
68
|
function isUnreadableRequires(value) {
|
|
66
69
|
return value !== undefined && 'unreadable' in value;
|
|
67
70
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
const deferred = [];
|
|
71
|
+
function judgeSupport(candidates, context) {
|
|
72
|
+
const unsupported = [];
|
|
71
73
|
const unjudged = [];
|
|
72
74
|
for (const candidate of candidates) {
|
|
73
75
|
const minimum = context.serverRequiresAddons[candidate.packageName];
|
|
@@ -75,16 +77,12 @@ function gateStaleCandidates(candidates, context) {
|
|
|
75
77
|
const read = context.requiresOfDir(candidate.addonDir);
|
|
76
78
|
const label = `addon "${candidate.addonId}" (${candidate.packageName}@${candidate.packageVersion})`;
|
|
77
79
|
if (isUnreadableRequires(read)) {
|
|
78
|
-
|
|
79
|
-
candidate,
|
|
80
|
-
unmet: fromServer,
|
|
81
|
-
reason: `${label} deferred: its package requirements could not be read (${read.unreadable})`,
|
|
82
|
-
});
|
|
80
|
+
unjudged.push(`${label} runs unjudged: its package requirements could not be read (${read.unreadable})`);
|
|
83
81
|
continue;
|
|
84
82
|
}
|
|
85
83
|
const own = read;
|
|
86
84
|
if (context.serverVersion === null && own?.server !== undefined) {
|
|
87
|
-
unjudged.push(`${label}
|
|
85
|
+
unjudged.push(`${label} runs unjudged: it requires server ${own.server} and the running server version is unknown`);
|
|
88
86
|
}
|
|
89
87
|
const fromAddon = context.serverVersion === null
|
|
90
88
|
? []
|
|
@@ -94,17 +92,55 @@ function gateStaleCandidates(candidates, context) {
|
|
|
94
92
|
wrapper: null,
|
|
95
93
|
});
|
|
96
94
|
const unmet = [...fromServer, ...fromAddon];
|
|
97
|
-
if (unmet.length
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
95
|
+
if (unmet.length > 0)
|
|
96
|
+
unsupported.push(unsupportedOf(candidate, label, unmet));
|
|
97
|
+
}
|
|
98
|
+
return { unsupported, unjudged };
|
|
99
|
+
}
|
|
100
|
+
function unsupportedOf(candidate, label, unmet) {
|
|
101
|
+
return {
|
|
102
|
+
candidate,
|
|
103
|
+
unmet,
|
|
104
|
+
reason: `${label} runs below what this server requires: ${unmet.map(types_1.describeUnmet).join('; ')}`,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** The tracker's facts for one unsupported candidate. */
|
|
108
|
+
function supportFactsOf(entry, serverVersion) {
|
|
109
|
+
const addonMinimum = entry.unmet.find((u) => u.kind === 'addon-too-old');
|
|
110
|
+
return {
|
|
111
|
+
packageName: entry.candidate.packageName,
|
|
112
|
+
addonId: entry.candidate.addonId,
|
|
113
|
+
installedVersion: entry.candidate.packageVersion,
|
|
114
|
+
serverVersion,
|
|
115
|
+
requiredMinimum: addonMinimum === undefined ? null : addonMinimum.required,
|
|
116
|
+
unmet: entry.unmet.map(types_1.describeUnmet),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Judge `candidates` and hand the verdict to the tracker, which logs each
|
|
121
|
+
* unsupported streak and each unjudged line once. EVERY candidate is spawned by
|
|
122
|
+
* the caller. `installed` is the node's full package set when the caller has it
|
|
123
|
+
* (it lets the tracker clear the alert of an uninstalled package).
|
|
124
|
+
*/
|
|
125
|
+
function reportSupport(candidates, context, tracker, installed) {
|
|
126
|
+
const { unsupported, unjudged } = judgeSupport(candidates, context);
|
|
127
|
+
for (const line of unjudged)
|
|
128
|
+
tracker.logOnce(line);
|
|
129
|
+
tracker.observe(candidates.map((c) => c.packageName), unsupported.map((entry) => supportFactsOf(entry, context.serverVersion)), installed);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* The agent's spawn set: EVERY candidate, grouped by runner, after the support
|
|
133
|
+
* judgement (D1017). An unsupported addon is in its group like any other.
|
|
134
|
+
*/
|
|
135
|
+
function groupCandidatesForSpawn(candidates, context, tracker, installed) {
|
|
136
|
+
reportSupport(candidates, context, tracker, installed);
|
|
137
|
+
const grouped = new Map();
|
|
138
|
+
for (const c of candidates) {
|
|
139
|
+
const arr = grouped.get(c.groupId) ?? [];
|
|
140
|
+
arr.push(c);
|
|
141
|
+
grouped.set(c.groupId, arr);
|
|
106
142
|
}
|
|
107
|
-
return
|
|
143
|
+
return grouped;
|
|
108
144
|
}
|
|
109
145
|
/**
|
|
110
146
|
* `camstack.requires` of the package.json in `dir`: `undefined` when the package
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
* pattern as `scope-access.ts` and `share-view-access.ts`).
|
|
41
41
|
*/
|
|
42
42
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
-
exports.NON_ADMIN_CONFIG_REDACTED_METHODS = exports.REDACTED_SECRET = void 0;
|
|
43
|
+
exports.NON_ADMIN_CONFIG_REDACTED_METHODS = exports.NON_ADMIN_SECRET_FREE_BY_CONTRACT = exports.REDACTED_SECRET = void 0;
|
|
44
44
|
exports.isSecretConfigKey = isSecretConfigKey;
|
|
45
45
|
exports.redactDeviceInfoSecrets = redactDeviceInfoSecrets;
|
|
46
46
|
exports.redactDeviceInfoRecordSecrets = redactDeviceInfoRecordSecrets;
|
|
@@ -463,6 +463,18 @@ function maskUrlCredentialsDeep(data) {
|
|
|
463
463
|
out[key] = maskUrlCredentialsDeep(value);
|
|
464
464
|
return out;
|
|
465
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* Non-admin reads that return settings VALUES yet are deliberately NOT in
|
|
468
|
+
* {@link NON_ADMIN_CONFIG_REDACTED_METHODS}: their payload is secret-free by contract, so a
|
|
469
|
+
* redactor would only guess at it.
|
|
470
|
+
*
|
|
471
|
+
* `addonSettings.readScopedValues` answers a flat `key -> effective value` map built with
|
|
472
|
+
* `inlineSecretsAsViews`: a secret field is its `set` view (`{ set: boolean }`), never the value
|
|
473
|
+
* (`base-addon-scoped-value-api.spec.ts` pins it). Adding a method here needs the same proof.
|
|
474
|
+
*/
|
|
475
|
+
exports.NON_ADMIN_SECRET_FREE_BY_CONTRACT = new Set([
|
|
476
|
+
'addonSettings.readScopedValues',
|
|
477
|
+
]);
|
|
466
478
|
/**
|
|
467
479
|
* Every device-manager read whose response carries a device `config` blob, and
|
|
468
480
|
* the projection that cuts it.
|
|
@@ -483,6 +495,7 @@ function maskUrlCredentialsDeep(data) {
|
|
|
483
495
|
exports.NON_ADMIN_CONFIG_REDACTED_METHODS = new Map([
|
|
484
496
|
// ── Addon settings forms (D634) — hydrated with the STORED secret ──
|
|
485
497
|
['addonSettings.getGlobalSettings', redactSettingsForm],
|
|
498
|
+
['addonSettings.getScopedSettings', redactSettingsForm],
|
|
486
499
|
['addonSettings.getIntegrationSettings', redactSettingsForm],
|
|
487
500
|
['addonSettings.getIntegrationFormSchema', redactSettingsForm],
|
|
488
501
|
['addonSettings.getDeviceSettings', redactSettingsForm],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// AUTO-GENERATED by scripts/generate-cap-mounts.ts — DO NOT EDIT
|
|
3
3
|
// Re-run: npx tsx scripts/generate-cap-mounts.ts
|
|
4
4
|
//
|
|
5
|
-
// Mounted:
|
|
5
|
+
// Mounted: 198 Skipped (legacy): 3
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.LEGACY_SHAPE_SKIP = void 0;
|
|
8
8
|
exports.mountAllCaps = mountAllCaps;
|
|
@@ -360,8 +360,6 @@ function mountAllCaps(services) {
|
|
|
360
360
|
const first = providers[0];
|
|
361
361
|
return {
|
|
362
362
|
...first,
|
|
363
|
-
listProfileKinds: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listProfileKinds'),
|
|
364
|
-
listProfiles: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listProfiles'),
|
|
365
363
|
getDefaults: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'getDefaults'),
|
|
366
364
|
getUsage: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'getUsage'),
|
|
367
365
|
listModelCatalog: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listModelCatalog'),
|
|
@@ -504,7 +502,6 @@ function mountAllCaps(services) {
|
|
|
504
502
|
return {
|
|
505
503
|
...first,
|
|
506
504
|
listTargetKinds: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listTargetKinds'),
|
|
507
|
-
listTargets: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'listTargets'),
|
|
508
505
|
discoverTargets: (0, cap_mount_helpers_js_1.concatCollection)(providers, 'discoverTargets'),
|
|
509
506
|
};
|
|
510
507
|
}, remoteCapProxy),
|
|
@@ -520,8 +517,6 @@ function mountAllCaps(services) {
|
|
|
520
517
|
const entries = reg.getCollectionEntries('oauth-integration');
|
|
521
518
|
return entries[0]?.[1] ?? null;
|
|
522
519
|
}, remoteCapProxy),
|
|
523
|
-
oidcConnections: (0, generated_cap_routers_js_1.createCapRouter_oidcConnections)((_ctx) => reg?.getSingleton('oidc-connections') ??
|
|
524
|
-
null, remoteCapProxy),
|
|
525
520
|
osd: (0, generated_cap_routers_js_1.createCapRouter_osd)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'osd'), remoteCapProxy),
|
|
526
521
|
osdManager: (0, generated_cap_routers_js_1.createCapRouter_osdManager)((_ctx) => reg?.getSingleton('osd-manager') ?? null, remoteCapProxy),
|
|
527
522
|
petFeeder: (0, generated_cap_routers_js_1.createCapRouter_petFeeder)((_ctx) => (0, cap_mount_helpers_js_1.requireDeviceScoped)(reg, 'pet-feeder'), remoteCapProxy),
|