@camstack/system 1.2.169 → 1.2.171
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-runner.js +1 -1
- package/dist/addon-runner.mjs +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
- package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +1 -1
- package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
- package/dist/builtins/local-network/local-network.addon.js +1 -1
- package/dist/builtins/local-network/local-network.addon.mjs +1 -1
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/platform-probe/index.js +1 -1
- package/dist/builtins/platform-probe/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/data-store-dispatch.d.ts +18 -6
- package/dist/builtins/storage-orchestrator/hub-settings-forward.d.ts +68 -0
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +27 -3
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +235 -57
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +235 -57
- package/dist/builtins/system-config/system-config.addon.js +1 -1
- package/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{dist-digPByP6.mjs → dist-1DEQFmTq.mjs} +165 -6
- package/dist/{dist-D6kBG4fg.js → dist-DsoVfJSR.js} +165 -6
- package/dist/hub-cap-forward-BdT320dq.mjs +53 -0
- package/dist/hub-cap-forward-DmHNjbB0.js +70 -0
- package/dist/index.js +18 -199
- package/dist/index.mjs +22 -203
- package/dist/kernel/capability-registry.d.ts +8 -27
- package/dist/kernel/config-manager.d.ts +0 -33
- package/dist/{manifest-system-deps-onn-Eawl.mjs → manifest-system-deps-Da6sme9C.mjs} +3 -54
- package/dist/{manifest-system-deps-BjMNGEpl.js → manifest-system-deps-ir_XTNpe.js} +2 -71
- package/dist/{retired-settings-keys-B5D2hfoN.mjs → retired-settings-keys-ChS1Q2Kv.mjs} +1 -1
- package/dist/{retired-settings-keys-BywIz4dZ.js → retired-settings-keys-DTE5k4lU.js} +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import { $ as isCollectionArrayMethod, $t as parseJsonObject, Bt as ReadinessRegistry, E as addonSettingsCapability, Ft as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Gt as asString$1, It as DEVICE_STATUS_METHOD, Kt as createEvent, Mt as errMsg$1, Pt as DATAPLANE_SECRET_HEADER$1, Q as isArrayOutputSchema, Ut as asJsonObject$1, Vt as ReadinessTimeoutError, Wt as asNumber, Y as extractNestedAddonId, Yt as expandCapMethods, an as EventCategory$1, at as lifecycleJobSchema, bt as scopesAllowAddon, ct as logLevelAtMost, en as parseJsonUnknown
|
|
2
|
+
import { $ as isCollectionArrayMethod, $t as parseJsonObject, Bt as ReadinessRegistry, E as addonSettingsCapability, Ft as DEVICE_SETTINGS_CONTRIBUTION_METHODS, Gt as asString$1, It as DEVICE_STATUS_METHOD, Kt as createEvent, Mt as errMsg$1, Pt as DATAPLANE_SECRET_HEADER$1, Q as isArrayOutputSchema, Ut as asJsonObject$1, Vt as ReadinessTimeoutError, Wt as asNumber, Y as extractNestedAddonId, Yt as expandCapMethods, an as EventCategory$1, at as lifecycleJobSchema, bt as scopesAllowAddon, ct as logLevelAtMost, en as parseJsonUnknown, et as isObjectInput, f as LOG_LEVEL_RANK, ft as objectInputDeclaresAddonId, h as RUNTIME_DEFAULTS, ht as procedureAuthKey, it as kebabToCamel, lt as looseSchema, nn as resolveCapMount, p as METHOD_ACCESS_MAP, qt as emitDownForOwnedCaps, rn as scopeKey, rt as isVoidInput, t as ALL_CAPABILITY_DEFINITIONS, tn as readinessKey, vt as resolveMethodAuth, xt as scopesAllowDeviceCap } from "./dist-1DEQFmTq.mjs";
|
|
3
3
|
import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
|
|
4
4
|
import "./builtins/alerts/index.mjs";
|
|
5
5
|
import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
|
|
@@ -18,6 +18,7 @@ import NativeMetricsAddon, { t as NativeMetricsProvider } from "./builtins/nativ
|
|
|
18
18
|
import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./builtins/sqlite-storage/filesystem-storage.addon.mjs";
|
|
19
19
|
import { SqliteSettingsAddon, o as SqliteSettingsBackend, s as prefixRange } from "./builtins/sqlite-storage/sqlite-settings.addon.mjs";
|
|
20
20
|
import { ConfigStore, DeviceStore } from "./builtins/sqlite-storage/index.mjs";
|
|
21
|
+
import { n as HUB_CAP_FWD_SERVICE, r as createHubCapForwardService, t as HUB_CAP_FWD_ACTION } from "./hub-cap-forward-BdT320dq.mjs";
|
|
21
22
|
import { StorageOrchestratorAddon, n as buildStorageLocationRegistry, t as StorageOrchestratorService } from "./builtins/storage-orchestrator/storage-orchestrator.addon.mjs";
|
|
22
23
|
import "./builtins/storage-orchestrator/index.mjs";
|
|
23
24
|
import { SystemConfigAddon } from "./builtins/system-config/system-config.addon.mjs";
|
|
@@ -25,7 +26,7 @@ import "./builtins/system-config/index.mjs";
|
|
|
25
26
|
import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
|
|
26
27
|
import { a as parseTokenizedUrl, c as collectModelFiles, d as downloadModel, f as ensureModel, h as isModelDownloaded, i as parseRangeHeader, l as deleteModelFromDisk, m as getModelFilePath, n as contentTypeFor, o as resolveFilePath, p as fetchJson, r as createAuthenticatedFileServer, s as ModelDownloadService, t as createFileDataPlaneHandler, u as downloadFile } from "./file-data-plane-BhKdxJgf.mjs";
|
|
27
28
|
import { C as registerLanHttpHandler, S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, b as bindPendingLanHttp, c as loadTlsCert, d as collectCertIdentity, f as CA_VALIDITY_DAYS, g as evaluateExistingCert, h as SERVER_AUTH_OID, i as writeExtraSans, l as reissueTlsLeaf, m as MAX_LEAF_VALIDITY_DAYS, n as readTlsAccessStatus, o as validateUploadedTls, p as LEAF_RENEWAL_WINDOW_DAYS, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, u as CA_COMMON_NAME, v as allFamiliesListenHost, x as closeLanHttp, y as applyLanHttp } from "./tls-DOTmtLCW.mjs";
|
|
28
|
-
import { $ as
|
|
29
|
+
import { $ as buildUdsNativeCapProxy, $t as emitHeapDiagnosticReport, A as createUdsLoggerWithControl, At as HUB_MAIN_RSS_BUDGET_MB, B as readMoleculerFanoutMode, Bt as createV8Reclaimer, C as ipcParentLink, Ct as createAddonDataPlaneFacility, D as createUdsEventBus, Dt as HEAP_WATCH_INTERVAL_MS, E as createUdsEventBridge, Et as HEAP_RECLAIM_TRIGGER_MB, F as AGENT_CAP_FWD_SERVICE, Ft as RUNNER_RSS_BUDGET_ENV, G as createLocalTransport, Gt as reclaimIntervalMs, H as PARENT_ROUTED_PROVIDER_ADDON_ID, Ht as hubMainRssBudget, I as CapRouteResolver, It as ZERO_LOOP_DELAY, J as SocketChannel, Jt as startRunnerHeapWatch, K as UdsLocalTransportClient, Kt as shouldReclaim, L as CapRouteError, Lt as buildHeapSample, M as LocalChildRegistry, Mt as RSS_BUDGET_REANNOUNCE_MIN_MS, N as UDS_NO_ROUTE_PREFIX, Nt as RSS_BUDGET_RELEASE_RATIO, O as udsChildLogToWorkerEntry, Ot as HEAP_WATCH_WARN_RATIO, P as AGENT_CAP_FWD_ACTION, Pt as RUNNER_HEAP_WATCH_INTERVAL_MS, Q as buildNativeCapProxy, Qt as RUNNER_HEAP_SNAPSHOT_ENV, R as classifyCapRoute, Rt as createDeferredHeapWatchSink, S as buildLinkChain, St as runNpm, T as createParentUnownedCallHandler, Tt as HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS, U as __resetCapUsageRegistryForTests, Ut as nextRssBudgetState, V as CapUsageRegistry, Vt as describeRss, W as getCapUsageRegistry, Wt as parseRssBudgetMb, X as FrameDecoder, Xt as DECISIVE_HEAP_SPACES, Y as localEndpointPath, Yt as strandedMb, Z as encodeFrame, Zt as HEAP_SPACE_REPORT_MIN_MB, _ as AddonDepsManager, _n as EVENT_PLANE_TOP_N, _t as CapabilityUnavailableError, a as createUdsAddonContext, an as EMPTY_SOCKET_PLANE_BASELINE, at as createAddonService, b as brokerCallForCap, bn as diffEventPlane, bt as resolveAddonClass, c as getOrInitReadinessRegistryForClient, cn as createSocketPlaneReader, ct as capActionName, d as clusterEventTopic, dn as EMPTY_SOCKET_DIRECTION, dt as capServiceName, en as formatHeapSpaces, et as createBrokerDeviceManagerApi, f as getBrokerEventBus, fn as createSocketDirectionCounters, ft as parseCapAction, g as subscribePassthrough, gn as socketDirectionMessages, gt as CapabilityHandle, h as setNodeEventInterest, hn as socketDirectionBytes, ht as DeviceRegistry, i as createAddonContext, in as selectReportedSpaces, j as LocalChildClient, jt as HUB_RSS_BUDGET_ENV, k as createUdsLogger, kt as HUB_MAIN_HEAP_WATCH_LABEL, l as setHubConnected, ln as diffSocketPlane, lt as capActionSuffix, m as registerEventBusService, mn as sampleSocketDirection, mt as serializeTypedArrays, n as installManifestPythonDeps, nn as heapSpaceField, o as getWorkerDeviceRegistry, on as SOCKET_PLANE_TOP_N, ot as validateProviderRegistrations, p as getMoleculerEventStats, pn as recordSocketFrame, pt as deserializeTypedArrays, q as UdsLocalTransportServer, qt as startHeapWatch, r as adaptBrokerToCluster, rn as readHeapSpaces, rt as mountNativeCapService, s as getOrInitReadinessRegistry, sn as createSocketPlaneMeter, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestSystemDeps, tn as heapSnapshotAuthorised, u as EVENT_TOPIC_PREFIX, un as formatSocketPlane, ut as capBareAction, v as createKernelHwAccel, vn as createEventPlaneMeter, vt as copyBundledNativeModules, w as localProviderLink, wt as HEAP_RECLAIM_MIN_INTERVAL_MS, x as brokerTransportLink, xn as formatEventPlane, xt as resolveNpmInvocation, y as resolveHwAccel, yn as createEventPlaneReader, yt as installManifestNativeDeps, z as callWithServiceDiscovery, zt as createLoopDelayMeter } from "./manifest-system-deps-Da6sme9C.mjs";
|
|
29
30
|
import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BWmQ5i-o.mjs";
|
|
30
31
|
import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
|
|
31
32
|
import { z } from "zod";
|
|
@@ -42,7 +43,7 @@ import { accessSync, constants, existsSync } from "node:fs";
|
|
|
42
43
|
import * as os$18 from "node:os";
|
|
43
44
|
import { request } from "node:http";
|
|
44
45
|
import * as vm from "node:vm";
|
|
45
|
-
import { asJsonObject, errMsg
|
|
46
|
+
import { asJsonObject, errMsg } from "@camstack/types/addon";
|
|
46
47
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
47
48
|
import { EventEmitter } from "node:events";
|
|
48
49
|
import As from "node:stream";
|
|
@@ -2756,7 +2757,7 @@ function readOwningPackageVersion(entryPath) {
|
|
|
2756
2757
|
let dir = path$39.dirname(entryPath);
|
|
2757
2758
|
for (let hop = 0; hop < PACKAGE_JSON_LOOKUP_DEPTH; hop++) {
|
|
2758
2759
|
try {
|
|
2759
|
-
const version = asJsonObject$1(parseJsonUnknown
|
|
2760
|
+
const version = asJsonObject$1(parseJsonUnknown(fs$17.readFileSync(path$39.join(dir, "package.json"), "utf-8")))?.["version"];
|
|
2760
2761
|
if (typeof version === "string" && version.length > 0) return version;
|
|
2761
2762
|
} catch {}
|
|
2762
2763
|
const parent = path$39.dirname(dir);
|
|
@@ -2946,7 +2947,7 @@ var AddonLoader = class {
|
|
|
2946
2947
|
/** Load addon from a specific directory (package.json + dist/) */
|
|
2947
2948
|
async loadFromAddonDir(addonDir) {
|
|
2948
2949
|
const pkgJsonPath = path$39.join(addonDir, "package.json");
|
|
2949
|
-
const pkgJson = asJsonObject$1(parseJsonUnknown
|
|
2950
|
+
const pkgJson = asJsonObject$1(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8"))) ?? {};
|
|
2950
2951
|
const packageNameRaw = pkgJson["name"];
|
|
2951
2952
|
const packageName = typeof packageNameRaw === "string" ? packageNameRaw : "";
|
|
2952
2953
|
const packageVersionRaw = pkgJson["version"];
|
|
@@ -3383,7 +3384,7 @@ async function installPackageFromNpm(packageName, targetDir) {
|
|
|
3383
3384
|
const distSrc = path$39.join(srcPkgJsonDir, "dist");
|
|
3384
3385
|
if (fs$17.existsSync(distSrc)) await copyDirRecursive(distSrc, path$39.join(targetDir, "dist"));
|
|
3385
3386
|
try {
|
|
3386
|
-
const npmPkg = asJsonObject$1(parseJsonUnknown
|
|
3387
|
+
const npmPkg = asJsonObject$1(parseJsonUnknown(await fs$17.promises.readFile(path$39.join(srcPkgJsonDir, "package.json"), "utf-8")));
|
|
3387
3388
|
if (npmPkg) await copyExtraFileDirs(npmPkg, srcPkgJsonDir, targetDir);
|
|
3388
3389
|
} catch {}
|
|
3389
3390
|
} finally {
|
|
@@ -3684,7 +3685,7 @@ function parseInstallSource(value) {
|
|
|
3684
3685
|
function readPackageJson(pkgJsonPath) {
|
|
3685
3686
|
let raw;
|
|
3686
3687
|
try {
|
|
3687
|
-
raw = asJsonObject$1(parseJsonUnknown
|
|
3688
|
+
raw = asJsonObject$1(parseJsonUnknown(fs$17.readFileSync(pkgJsonPath, "utf-8")));
|
|
3688
3689
|
} catch {
|
|
3689
3690
|
return null;
|
|
3690
3691
|
}
|
|
@@ -4903,7 +4904,7 @@ var AddonInstaller = class AddonInstaller {
|
|
|
4903
4904
|
]) {
|
|
4904
4905
|
const candidate = path$39.join(this.workspaceDir, dirName);
|
|
4905
4906
|
try {
|
|
4906
|
-
const pkg = asJsonObject$1(parseJsonUnknown
|
|
4907
|
+
const pkg = asJsonObject$1(parseJsonUnknown(fs$17.readFileSync(path$39.join(candidate, "package.json"), "utf-8")));
|
|
4907
4908
|
if (pkg && asString$1(pkg["name"]) === packageName) return candidate;
|
|
4908
4909
|
} catch {}
|
|
4909
4910
|
}
|
|
@@ -5230,7 +5231,7 @@ function readPendingRestart(dataDir) {
|
|
|
5230
5231
|
}
|
|
5231
5232
|
let parsed;
|
|
5232
5233
|
try {
|
|
5233
|
-
parsed = asJsonObject$1(parseJsonUnknown
|
|
5234
|
+
parsed = asJsonObject$1(parseJsonUnknown(raw));
|
|
5234
5235
|
} catch (err) {
|
|
5235
5236
|
console.error("[restart-coordinator] Marker JSON invalid — clearing:", err);
|
|
5236
5237
|
clearPendingRestart(dataDir);
|
|
@@ -5308,7 +5309,6 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
5308
5309
|
routerFactory = null;
|
|
5309
5310
|
configReader = null;
|
|
5310
5311
|
collectionConfigReader = null;
|
|
5311
|
-
configManager = null;
|
|
5312
5312
|
_ready = false;
|
|
5313
5313
|
/** Boot-time dependency graph: capability → dependsOn names (from CapabilityDeclaration) */
|
|
5314
5314
|
capabilityDeps = /* @__PURE__ */ new Map();
|
|
@@ -5393,10 +5393,6 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
5393
5393
|
setCollectionConfigReader(reader) {
|
|
5394
5394
|
this.collectionConfigReader = reader;
|
|
5395
5395
|
}
|
|
5396
|
-
/** Set the config manager for persisted device activation state. */
|
|
5397
|
-
setConfigManager(manager) {
|
|
5398
|
-
this.configManager = manager;
|
|
5399
|
-
}
|
|
5400
5396
|
/** Register boot-time dependency edges (from CapabilityDeclaration.dependsOn). */
|
|
5401
5397
|
setDependencies(capabilityName, dependsOn) {
|
|
5402
5398
|
this.capabilityDeps.set(capabilityName, dependsOn);
|
|
@@ -6132,88 +6128,18 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
6132
6128
|
});
|
|
6133
6129
|
}
|
|
6134
6130
|
/**
|
|
6135
|
-
* Check if a specific addon's capability is active
|
|
6131
|
+
* Check if a specific addon's capability is active.
|
|
6136
6132
|
*
|
|
6137
|
-
* Resolution:
|
|
6133
|
+
* Resolution: the manifest's `autoActivate` flag, else active. There is no
|
|
6134
|
+
* persisted override layer — see D334: an activation map keyed by
|
|
6135
|
+
* `{capability}/{addonId}` is a second authority over a function some addon
|
|
6136
|
+
* already owns, which is what D62 forbids.
|
|
6138
6137
|
*/
|
|
6139
6138
|
isActiveForSystem(capability, addonId) {
|
|
6140
|
-
if (this.configManager) {
|
|
6141
|
-
const explicit = this.configManager.getSystemActivation()[`${capability}/${addonId}`];
|
|
6142
|
-
if (explicit !== void 0) return explicit;
|
|
6143
|
-
}
|
|
6144
6139
|
const autoActivate = this.autoActivateFlags.get(`${capability}/${addonId}`);
|
|
6145
6140
|
if (autoActivate !== void 0) return autoActivate;
|
|
6146
6141
|
return true;
|
|
6147
6142
|
}
|
|
6148
|
-
/** Set system-wide activation for a capability/addon pair. */
|
|
6149
|
-
setSystemActivation(capability, addonId, active) {
|
|
6150
|
-
if (!this.configManager) {
|
|
6151
|
-
this.logger.warn("Cannot set system activation: ConfigManager not wired");
|
|
6152
|
-
return;
|
|
6153
|
-
}
|
|
6154
|
-
this.configManager.setSystemActivation(capability, addonId, active);
|
|
6155
|
-
this.logger.info("System activation set", {
|
|
6156
|
-
tags: { addonId },
|
|
6157
|
-
meta: {
|
|
6158
|
-
capability,
|
|
6159
|
-
active
|
|
6160
|
-
}
|
|
6161
|
-
});
|
|
6162
|
-
this.emitEvent("capability:system-activation-changed", {
|
|
6163
|
-
capability,
|
|
6164
|
-
addonId,
|
|
6165
|
-
active
|
|
6166
|
-
});
|
|
6167
|
-
}
|
|
6168
|
-
/**
|
|
6169
|
-
* Check if a specific addon's capability is active for a device.
|
|
6170
|
-
*
|
|
6171
|
-
* Resolution: 1. explicit device override → 2. system activation → 3. autoActivate → 4. default true
|
|
6172
|
-
*/
|
|
6173
|
-
isActiveForDevice(capability, addonId, deviceId) {
|
|
6174
|
-
if (this.configManager) {
|
|
6175
|
-
const explicit = this.configManager.getDeviceActivation(deviceId)[`${capability}/${addonId}`];
|
|
6176
|
-
if (explicit !== void 0) return explicit;
|
|
6177
|
-
}
|
|
6178
|
-
return this.isActiveForSystem(capability, addonId);
|
|
6179
|
-
}
|
|
6180
|
-
/** Set device activation for a capability/addon pair. */
|
|
6181
|
-
setDeviceActivation(deviceId, capability, addonId, active) {
|
|
6182
|
-
if (!this.configManager) {
|
|
6183
|
-
this.logger.warn("Cannot set device activation: ConfigManager not wired");
|
|
6184
|
-
return;
|
|
6185
|
-
}
|
|
6186
|
-
this.configManager.setDeviceActivation(deviceId, capability, addonId, active);
|
|
6187
|
-
this.logger.info("Device activation set", {
|
|
6188
|
-
tags: {
|
|
6189
|
-
deviceId: Number(deviceId),
|
|
6190
|
-
addonId
|
|
6191
|
-
},
|
|
6192
|
-
meta: {
|
|
6193
|
-
capability,
|
|
6194
|
-
active
|
|
6195
|
-
}
|
|
6196
|
-
});
|
|
6197
|
-
this.emitEvent("capability:device-activation-changed", {
|
|
6198
|
-
deviceId,
|
|
6199
|
-
capability,
|
|
6200
|
-
addonId,
|
|
6201
|
-
active
|
|
6202
|
-
});
|
|
6203
|
-
}
|
|
6204
|
-
/**
|
|
6205
|
-
* Get all addon/capability activations for a device.
|
|
6206
|
-
* Returns every registered provider with its resolved active status.
|
|
6207
|
-
*/
|
|
6208
|
-
getDeviceActivations(deviceId) {
|
|
6209
|
-
const result = [];
|
|
6210
|
-
for (const [capName, state] of this.capabilities) for (const addonId of state.providers.keys()) result.push({
|
|
6211
|
-
capability: capName,
|
|
6212
|
-
addonId,
|
|
6213
|
-
active: this.isActiveForDevice(capName, addonId, deviceId)
|
|
6214
|
-
});
|
|
6215
|
-
return result;
|
|
6216
|
-
}
|
|
6217
6143
|
/**
|
|
6218
6144
|
* Get all addon/capability activations at system level.
|
|
6219
6145
|
* Returns every registered provider with its resolved active status.
|
|
@@ -6272,7 +6198,8 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
6272
6198
|
}
|
|
6273
6199
|
/**
|
|
6274
6200
|
* Resolve a singleton provider for a specific device.
|
|
6275
|
-
* Checks activation (
|
|
6201
|
+
* Checks activation (the manifest's autoActivate) then the per-device
|
|
6202
|
+
* singleton override — the in-memory provider pin, not a persisted flag.
|
|
6276
6203
|
*/
|
|
6277
6204
|
resolveForDevice(capability, deviceId) {
|
|
6278
6205
|
const state = this.capabilities.get(capability);
|
|
@@ -6281,7 +6208,7 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
6281
6208
|
if (deviceMap) {
|
|
6282
6209
|
const overrideAddonId = deviceMap.get(capability);
|
|
6283
6210
|
if (overrideAddonId) {
|
|
6284
|
-
if (this.
|
|
6211
|
+
if (this.isActiveForSystem(capability, overrideAddonId)) {
|
|
6285
6212
|
const provider = state.providers.get(overrideAddonId);
|
|
6286
6213
|
if (provider) return asProvider(provider);
|
|
6287
6214
|
}
|
|
@@ -6294,11 +6221,11 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
6294
6221
|
});
|
|
6295
6222
|
}
|
|
6296
6223
|
}
|
|
6297
|
-
if (state.activeAddonId && this.
|
|
6224
|
+
if (state.activeAddonId && this.isActiveForSystem(capability, state.activeAddonId)) {
|
|
6298
6225
|
const active = state.providers.get(state.activeAddonId);
|
|
6299
6226
|
return active !== void 0 ? asProvider(active) : null;
|
|
6300
6227
|
}
|
|
6301
|
-
for (const [addonId, provider] of state.providers) if (this.
|
|
6228
|
+
for (const [addonId, provider] of state.providers) if (this.isActiveForSystem(capability, addonId)) return asProvider(provider);
|
|
6302
6229
|
return null;
|
|
6303
6230
|
}
|
|
6304
6231
|
/** Set a per-device collection filter. */
|
|
@@ -6334,12 +6261,12 @@ var CapabilityRegistry = class CapabilityRegistry {
|
|
|
6334
6261
|
}
|
|
6335
6262
|
/**
|
|
6336
6263
|
* Resolve collection providers for a specific device.
|
|
6337
|
-
* Filters by activation (
|
|
6264
|
+
* Filters by activation (the manifest's autoActivate) and optional collection filter.
|
|
6338
6265
|
*/
|
|
6339
6266
|
resolveCollectionForDevice(capability, deviceId) {
|
|
6340
6267
|
const state = this.capabilities.get(capability);
|
|
6341
6268
|
if (!state || state.definition.mode !== "collection") return [];
|
|
6342
|
-
let entries = [...state.providers.entries()].filter(([addonId]) => !state.disabledProviders.has(addonId)).filter(([addonId]) => this.
|
|
6269
|
+
let entries = [...state.providers.entries()].filter(([addonId]) => !state.disabledProviders.has(addonId)).filter(([addonId]) => this.isActiveForSystem(capability, addonId));
|
|
6343
6270
|
const deviceMap = this.deviceCollectionFilters.get(deviceId);
|
|
6344
6271
|
if (deviceMap) {
|
|
6345
6272
|
const filterAddonIds = deviceMap.get(capability);
|
|
@@ -9477,26 +9404,17 @@ var ENV_VAR_MAP = {
|
|
|
9477
9404
|
CAMSTACK_ADMIN_USER: "auth.adminUsername",
|
|
9478
9405
|
CAMSTACK_ADMIN_PASS: "auth.adminPassword"
|
|
9479
9406
|
};
|
|
9480
|
-
var EMPTY_RUNTIME_STATE = {
|
|
9481
|
-
systemActivation: {},
|
|
9482
|
-
deviceActivation: {}
|
|
9483
|
-
};
|
|
9484
9407
|
var ConfigManager = class ConfigManager {
|
|
9485
9408
|
configPath;
|
|
9486
9409
|
bootstrapConfig;
|
|
9487
9410
|
settingsStore = null;
|
|
9488
9411
|
settingsDoor = null;
|
|
9489
|
-
runtimeState;
|
|
9490
|
-
runtimeStatePath;
|
|
9491
9412
|
constructor(configPath) {
|
|
9492
9413
|
this.configPath = configPath;
|
|
9493
9414
|
const rawYaml = this.loadYaml();
|
|
9494
9415
|
const merged = this.applyEnvOverrides(asJsonObject(rawYaml) ?? {});
|
|
9495
9416
|
this.bootstrapConfig = bootstrapSchema.parse(merged);
|
|
9496
9417
|
this.warnDefaultCredentials();
|
|
9497
|
-
const dataPath = this.bootstrapConfig.server.dataPath ?? "camstack-data";
|
|
9498
|
-
this.runtimeStatePath = path$39.resolve(dataPath, "runtime-state.json");
|
|
9499
|
-
this.runtimeState = this.loadRuntimeState();
|
|
9500
9418
|
}
|
|
9501
9419
|
/**
|
|
9502
9420
|
* Wire the settings-store backend. Called once, after the `settings-store`
|
|
@@ -9781,72 +9699,6 @@ var ConfigManager = class ConfigManager {
|
|
|
9781
9699
|
}
|
|
9782
9700
|
};
|
|
9783
9701
|
}
|
|
9784
|
-
/** Get all system-wide activation overrides. */
|
|
9785
|
-
getSystemActivation() {
|
|
9786
|
-
return this.runtimeState.systemActivation;
|
|
9787
|
-
}
|
|
9788
|
-
/** Set system-wide activation for a capability/addon pair. */
|
|
9789
|
-
setSystemActivation(capability, addonId, active) {
|
|
9790
|
-
const key = `${capability}/${addonId}`;
|
|
9791
|
-
this.runtimeState = {
|
|
9792
|
-
...this.runtimeState,
|
|
9793
|
-
systemActivation: {
|
|
9794
|
-
...this.runtimeState.systemActivation,
|
|
9795
|
-
[key]: active
|
|
9796
|
-
}
|
|
9797
|
-
};
|
|
9798
|
-
this.saveRuntimeState();
|
|
9799
|
-
}
|
|
9800
|
-
/**
|
|
9801
|
-
* Get activation overrides for a device.
|
|
9802
|
-
* Returns a map of `{capability}/{addonId}` → active boolean.
|
|
9803
|
-
* Missing entries mean "use system activation or autoActivate default".
|
|
9804
|
-
*/
|
|
9805
|
-
getDeviceActivation(deviceId) {
|
|
9806
|
-
return this.runtimeState.deviceActivation[deviceId] ?? {};
|
|
9807
|
-
}
|
|
9808
|
-
/**
|
|
9809
|
-
* Get all device activation overrides.
|
|
9810
|
-
* Returns deviceId → (`{capability}/{addonId}` → active).
|
|
9811
|
-
*/
|
|
9812
|
-
getAllDeviceActivation() {
|
|
9813
|
-
return this.runtimeState.deviceActivation;
|
|
9814
|
-
}
|
|
9815
|
-
/**
|
|
9816
|
-
* Set activation for a specific capability/addon on a device.
|
|
9817
|
-
* Persists immediately to runtime-state.json.
|
|
9818
|
-
*
|
|
9819
|
-
* @param deviceId - The device to configure
|
|
9820
|
-
* @param capability - Capability name (e.g., 'motion-detection')
|
|
9821
|
-
* @param addonId - Addon providing the capability (e.g., 'wasm-motion')
|
|
9822
|
-
* @param active - Whether the capability is active on this device
|
|
9823
|
-
*/
|
|
9824
|
-
setDeviceActivation(deviceId, capability, addonId, active) {
|
|
9825
|
-
const key = `${capability}/${addonId}`;
|
|
9826
|
-
const updated = {
|
|
9827
|
-
...this.runtimeState.deviceActivation[deviceId] ?? {},
|
|
9828
|
-
[key]: active
|
|
9829
|
-
};
|
|
9830
|
-
this.runtimeState = {
|
|
9831
|
-
...this.runtimeState,
|
|
9832
|
-
deviceActivation: {
|
|
9833
|
-
...this.runtimeState.deviceActivation,
|
|
9834
|
-
[deviceId]: updated
|
|
9835
|
-
}
|
|
9836
|
-
};
|
|
9837
|
-
this.saveRuntimeState();
|
|
9838
|
-
}
|
|
9839
|
-
/**
|
|
9840
|
-
* Clear all activation overrides for a device (resets to autoActivate defaults).
|
|
9841
|
-
*/
|
|
9842
|
-
clearDeviceActivation(deviceId) {
|
|
9843
|
-
const { [deviceId]: _removed, ...rest } = this.runtimeState.deviceActivation;
|
|
9844
|
-
this.runtimeState = {
|
|
9845
|
-
...this.runtimeState,
|
|
9846
|
-
deviceActivation: rest
|
|
9847
|
-
};
|
|
9848
|
-
this.saveRuntimeState();
|
|
9849
|
-
}
|
|
9850
9702
|
getBootstrap(configPath) {
|
|
9851
9703
|
return this.getFromBootstrap(configPath);
|
|
9852
9704
|
}
|
|
@@ -10016,39 +9868,6 @@ var ConfigManager = class ConfigManager {
|
|
|
10016
9868
|
}
|
|
10017
9869
|
return found ? result : null;
|
|
10018
9870
|
}
|
|
10019
|
-
loadRuntimeState() {
|
|
10020
|
-
if (!fs$17.existsSync(this.runtimeStatePath)) return EMPTY_RUNTIME_STATE;
|
|
10021
|
-
try {
|
|
10022
|
-
const parsed = asJsonObject(parseJsonUnknown(fs$17.readFileSync(this.runtimeStatePath, "utf-8")));
|
|
10023
|
-
if (parsed === null) return EMPTY_RUNTIME_STATE;
|
|
10024
|
-
const systemActivation = asJsonObject(parsed.systemActivation) ?? {};
|
|
10025
|
-
const deviceActivationRaw = asJsonObject(parsed.deviceActivation) ?? {};
|
|
10026
|
-
const deviceActivation = {};
|
|
10027
|
-
for (const [deviceId, entry] of Object.entries(deviceActivationRaw)) {
|
|
10028
|
-
const nested = asJsonObject(entry);
|
|
10029
|
-
if (nested === null) continue;
|
|
10030
|
-
const bools = {};
|
|
10031
|
-
for (const [k, v] of Object.entries(nested)) if (typeof v === "boolean") bools[k] = v;
|
|
10032
|
-
deviceActivation[deviceId] = bools;
|
|
10033
|
-
}
|
|
10034
|
-
const systemBools = {};
|
|
10035
|
-
for (const [k, v] of Object.entries(systemActivation)) if (typeof v === "boolean") systemBools[k] = v;
|
|
10036
|
-
return {
|
|
10037
|
-
systemActivation: systemBools,
|
|
10038
|
-
deviceActivation
|
|
10039
|
-
};
|
|
10040
|
-
} catch {
|
|
10041
|
-
console.warn(`[ConfigManager] Failed to parse runtime state at ${this.runtimeStatePath}, using defaults`);
|
|
10042
|
-
return EMPTY_RUNTIME_STATE;
|
|
10043
|
-
}
|
|
10044
|
-
}
|
|
10045
|
-
saveRuntimeState() {
|
|
10046
|
-
const dir = path$39.dirname(this.runtimeStatePath);
|
|
10047
|
-
if (!fs$17.existsSync(dir)) fs$17.mkdirSync(dir, { recursive: true });
|
|
10048
|
-
const tmpPath = `${this.runtimeStatePath}.tmp`;
|
|
10049
|
-
fs$17.writeFileSync(tmpPath, JSON.stringify(this.runtimeState, null, 2), "utf-8");
|
|
10050
|
-
fs$17.renameSync(tmpPath, this.runtimeStatePath);
|
|
10051
|
-
}
|
|
10052
9871
|
};
|
|
10053
9872
|
//#endregion
|
|
10054
9873
|
//#region ../../node_modules/moleculer/src/constants.js
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CapabilityDeclaration, CapabilityDefinition, CapabilityInfo, CapabilityMode, CapabilityProviderMap, CollectionCapabilityMap, IEventBus, IScopedLogger, SingletonCapabilityMap } from '@camstack/types';
|
|
2
|
-
import { ConfigManager } from './config-manager.js';
|
|
3
2
|
/** Result of creating a capability router (opaque to the kernel). */
|
|
4
3
|
export type CapabilityRouter = unknown;
|
|
5
4
|
/** Factory that creates a tRPC router from a capability definition + provider getter. */
|
|
@@ -38,7 +37,6 @@ export declare class CapabilityRegistry {
|
|
|
38
37
|
private routerFactory;
|
|
39
38
|
private configReader;
|
|
40
39
|
private collectionConfigReader;
|
|
41
|
-
private configManager;
|
|
42
40
|
private _ready;
|
|
43
41
|
/** Boot-time dependency graph: capability → dependsOn names (from CapabilityDeclaration) */
|
|
44
42
|
private readonly capabilityDeps;
|
|
@@ -116,8 +114,6 @@ export declare class CapabilityRegistry {
|
|
|
116
114
|
* in a previous session comes back disabled after a hub reboot.
|
|
117
115
|
*/
|
|
118
116
|
setCollectionConfigReader(reader: CollectionConfigReader): void;
|
|
119
|
-
/** Set the config manager for persisted device activation state. */
|
|
120
|
-
setConfigManager(manager: ConfigManager): void;
|
|
121
117
|
/** Register boot-time dependency edges (from CapabilityDeclaration.dependsOn). */
|
|
122
118
|
setDependencies(capabilityName: string, dependsOn: readonly string[]): void;
|
|
123
119
|
/** Set the router factory — called by the server layer once at boot. */
|
|
@@ -440,30 +436,14 @@ export declare class CapabilityRegistry {
|
|
|
440
436
|
*/
|
|
441
437
|
setActiveSingleton(capability: string, addonId: string, nodeId?: string): Promise<void>;
|
|
442
438
|
/**
|
|
443
|
-
* Check if a specific addon's capability is active
|
|
439
|
+
* Check if a specific addon's capability is active.
|
|
444
440
|
*
|
|
445
|
-
* Resolution:
|
|
441
|
+
* Resolution: the manifest's `autoActivate` flag, else active. There is no
|
|
442
|
+
* persisted override layer — see D334: an activation map keyed by
|
|
443
|
+
* `{capability}/{addonId}` is a second authority over a function some addon
|
|
444
|
+
* already owns, which is what D62 forbids.
|
|
446
445
|
*/
|
|
447
446
|
isActiveForSystem(capability: string, addonId: string): boolean;
|
|
448
|
-
/** Set system-wide activation for a capability/addon pair. */
|
|
449
|
-
setSystemActivation(capability: string, addonId: string, active: boolean): void;
|
|
450
|
-
/**
|
|
451
|
-
* Check if a specific addon's capability is active for a device.
|
|
452
|
-
*
|
|
453
|
-
* Resolution: 1. explicit device override → 2. system activation → 3. autoActivate → 4. default true
|
|
454
|
-
*/
|
|
455
|
-
isActiveForDevice(capability: string, addonId: string, deviceId: string): boolean;
|
|
456
|
-
/** Set device activation for a capability/addon pair. */
|
|
457
|
-
setDeviceActivation(deviceId: string, capability: string, addonId: string, active: boolean): void;
|
|
458
|
-
/**
|
|
459
|
-
* Get all addon/capability activations for a device.
|
|
460
|
-
* Returns every registered provider with its resolved active status.
|
|
461
|
-
*/
|
|
462
|
-
getDeviceActivations(deviceId: string): ReadonlyArray<{
|
|
463
|
-
capability: string;
|
|
464
|
-
addonId: string;
|
|
465
|
-
active: boolean;
|
|
466
|
-
}>;
|
|
467
447
|
/**
|
|
468
448
|
* Get all addon/capability activations at system level.
|
|
469
449
|
* Returns every registered provider with its resolved active status.
|
|
@@ -481,7 +461,8 @@ export declare class CapabilityRegistry {
|
|
|
481
461
|
getDeviceOverrides(deviceId: string): Map<string, string>;
|
|
482
462
|
/**
|
|
483
463
|
* Resolve a singleton provider for a specific device.
|
|
484
|
-
* Checks activation (
|
|
464
|
+
* Checks activation (the manifest's autoActivate) then the per-device
|
|
465
|
+
* singleton override — the in-memory provider pin, not a persisted flag.
|
|
485
466
|
*/
|
|
486
467
|
resolveForDevice<T = unknown>(capability: string, deviceId: string): T | null;
|
|
487
468
|
/** Set a per-device collection filter. */
|
|
@@ -490,7 +471,7 @@ export declare class CapabilityRegistry {
|
|
|
490
471
|
clearDeviceCollectionFilter(deviceId: string, capability: string): void;
|
|
491
472
|
/**
|
|
492
473
|
* Resolve collection providers for a specific device.
|
|
493
|
-
* Filters by activation (
|
|
474
|
+
* Filters by activation (the manifest's autoActivate) and optional collection filter.
|
|
494
475
|
*/
|
|
495
476
|
resolveCollectionForDevice<T = unknown>(capability: string, deviceId: string): readonly T[];
|
|
496
477
|
/** Check if all dependencies for a capability are satisfied. */
|
|
@@ -94,8 +94,6 @@ export declare class ConfigManager {
|
|
|
94
94
|
private bootstrapConfig;
|
|
95
95
|
private settingsStore;
|
|
96
96
|
private settingsDoor;
|
|
97
|
-
private runtimeState;
|
|
98
|
-
private readonly runtimeStatePath;
|
|
99
97
|
constructor(configPath: string);
|
|
100
98
|
/**
|
|
101
99
|
* Wire the settings-store backend. Called once, after the `settings-store`
|
|
@@ -213,35 +211,6 @@ export declare class ConfigManager {
|
|
|
213
211
|
private createDoorBackedSettingsView;
|
|
214
212
|
/** The sync-`ISettingsStore` backend of {@link createSettingsView}. */
|
|
215
213
|
private createStoreSettingsView;
|
|
216
|
-
/** Get all system-wide activation overrides. */
|
|
217
|
-
getSystemActivation(): Readonly<Record<string, boolean>>;
|
|
218
|
-
/** Set system-wide activation for a capability/addon pair. */
|
|
219
|
-
setSystemActivation(capability: string, addonId: string, active: boolean): void;
|
|
220
|
-
/**
|
|
221
|
-
* Get activation overrides for a device.
|
|
222
|
-
* Returns a map of `{capability}/{addonId}` → active boolean.
|
|
223
|
-
* Missing entries mean "use system activation or autoActivate default".
|
|
224
|
-
*/
|
|
225
|
-
getDeviceActivation(deviceId: string): Readonly<Record<string, boolean>>;
|
|
226
|
-
/**
|
|
227
|
-
* Get all device activation overrides.
|
|
228
|
-
* Returns deviceId → (`{capability}/{addonId}` → active).
|
|
229
|
-
*/
|
|
230
|
-
getAllDeviceActivation(): Readonly<Record<string, Record<string, boolean>>>;
|
|
231
|
-
/**
|
|
232
|
-
* Set activation for a specific capability/addon on a device.
|
|
233
|
-
* Persists immediately to runtime-state.json.
|
|
234
|
-
*
|
|
235
|
-
* @param deviceId - The device to configure
|
|
236
|
-
* @param capability - Capability name (e.g., 'motion-detection')
|
|
237
|
-
* @param addonId - Addon providing the capability (e.g., 'wasm-motion')
|
|
238
|
-
* @param active - Whether the capability is active on this device
|
|
239
|
-
*/
|
|
240
|
-
setDeviceActivation(deviceId: string, capability: string, addonId: string, active: boolean): void;
|
|
241
|
-
/**
|
|
242
|
-
* Clear all activation overrides for a device (resets to autoActivate defaults).
|
|
243
|
-
*/
|
|
244
|
-
clearDeviceActivation(deviceId: string): void;
|
|
245
214
|
/** Get a value from the parsed bootstrap config.
|
|
246
215
|
* Generic overload is a documented type-level bridge — callers are responsible
|
|
247
216
|
* for passing a T that matches the config.yaml shape. */
|
|
@@ -281,6 +250,4 @@ export declare class ConfigManager {
|
|
|
281
250
|
* Returns an object keyed by the sub-key, or undefined if nothing is found.
|
|
282
251
|
*/
|
|
283
252
|
private getNestedFromSystemSettings;
|
|
284
|
-
private loadRuntimeState;
|
|
285
|
-
private saveRuntimeState;
|
|
286
253
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import "./dist-
|
|
1
|
+
import "./dist-1DEQFmTq.mjs";
|
|
2
|
+
import "./hub-cap-forward-BdT320dq.mjs";
|
|
2
3
|
import * as crypto$1 from "node:crypto";
|
|
3
4
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
4
5
|
import { ensureBinary, ensureFfmpeg, ensurePython, installPythonPackages, installPythonRequirements } from "@camstack/types/node";
|
|
@@ -7647,58 +7648,6 @@ function createParentUnownedCallHandler(deps) {
|
|
|
7647
7648
|
}
|
|
7648
7649
|
};
|
|
7649
7650
|
}
|
|
7650
|
-
//#endregion
|
|
7651
|
-
//#region src/kernel/transport/hub-cap-forward.ts
|
|
7652
|
-
/** The Moleculer service name the hub registers for agent→hub cap forwarding. */
|
|
7653
|
-
var HUB_CAP_FWD_SERVICE = "$hub-cap-fwd";
|
|
7654
|
-
/** The Moleculer action (service.action) for hub cap forwarding. */
|
|
7655
|
-
var HUB_CAP_FWD_ACTION = `${HUB_CAP_FWD_SERVICE}.forward`;
|
|
7656
|
-
/**
|
|
7657
|
-
* Narrow Moleculer's loosely-typed `ctx.params` to {@link HubCapForwardParams}
|
|
7658
|
-
* without unsafe casts — mirrors `agent-cap-dispatch-service.ts:narrowParams`.
|
|
7659
|
-
*/
|
|
7660
|
-
function narrowParams(raw) {
|
|
7661
|
-
if (raw === null || typeof raw !== "object") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
7662
|
-
const capName = Reflect.get(raw, "capName");
|
|
7663
|
-
const method = Reflect.get(raw, "method");
|
|
7664
|
-
if (typeof capName !== "string" || typeof method !== "string") throw new Error("$hub-cap-fwd.forward: invalid params — capName and method are required strings");
|
|
7665
|
-
const deviceId = Reflect.get(raw, "deviceId");
|
|
7666
|
-
const nodeId = Reflect.get(raw, "nodeId");
|
|
7667
|
-
const native = Reflect.get(raw, "native");
|
|
7668
|
-
return {
|
|
7669
|
-
capName,
|
|
7670
|
-
method,
|
|
7671
|
-
args: Reflect.get(raw, "args"),
|
|
7672
|
-
deviceId: typeof deviceId === "number" ? deviceId : void 0,
|
|
7673
|
-
nodeId: typeof nodeId === "string" && nodeId.length > 0 ? nodeId : void 0,
|
|
7674
|
-
native: native === true ? true : void 0
|
|
7675
|
-
};
|
|
7676
|
-
}
|
|
7677
|
-
/**
|
|
7678
|
-
* Build the `$hub-cap-fwd` Moleculer `ServiceSchema`. The hub registers this on
|
|
7679
|
-
* its broker (only the hub registers it → an agent's `broker.call` for
|
|
7680
|
-
* `$hub-cap-fwd.forward` discovers it on the hub with no explicit nodeID pin).
|
|
7681
|
-
*
|
|
7682
|
-
* @param onUnownedCall The hub's cap routing handler (from
|
|
7683
|
-
* `createParentUnownedCallHandler`). Reused verbatim so
|
|
7684
|
-
* forwarded calls route exactly like a hub-local child's.
|
|
7685
|
-
*/
|
|
7686
|
-
function createHubCapForwardService(onUnownedCall) {
|
|
7687
|
-
return {
|
|
7688
|
-
name: HUB_CAP_FWD_SERVICE,
|
|
7689
|
-
actions: { forward: { handler: async (ctx) => {
|
|
7690
|
-
const { capName, method, args, deviceId, nodeId, native } = narrowParams(ctx.params);
|
|
7691
|
-
return onUnownedCall({
|
|
7692
|
-
capName,
|
|
7693
|
-
method,
|
|
7694
|
-
args,
|
|
7695
|
-
...deviceId !== void 0 ? { deviceId } : {},
|
|
7696
|
-
...nodeId !== void 0 ? { nodeId } : {},
|
|
7697
|
-
...native === true ? { native: true } : {}
|
|
7698
|
-
});
|
|
7699
|
-
} } }
|
|
7700
|
-
};
|
|
7701
|
-
}
|
|
7702
7651
|
/**
|
|
7703
7652
|
* Record one cap call, if an observer is configured. Extracted so the rule —
|
|
7704
7653
|
* an unresolved provider never erases the caller — has ONE place and a test.
|
|
@@ -10019,4 +9968,4 @@ async function defaultRun(command, args) {
|
|
|
10019
9968
|
await execFileAsync(command, [...args], { timeout: INSTALL_TIMEOUT_MS });
|
|
10020
9969
|
}
|
|
10021
9970
|
//#endregion
|
|
10022
|
-
export {
|
|
9971
|
+
export { buildUdsNativeCapProxy as $, emitHeapDiagnosticReport as $t, createUdsLoggerWithControl as A, HUB_MAIN_RSS_BUDGET_MB as At, readMoleculerFanoutMode as B, createV8Reclaimer as Bt, ipcParentLink as C, createAddonDataPlaneFacility as Ct, createUdsEventBus as D, HEAP_WATCH_INTERVAL_MS as Dt, createUdsEventBridge as E, HEAP_RECLAIM_TRIGGER_MB as Et, AGENT_CAP_FWD_SERVICE as F, RUNNER_RSS_BUDGET_ENV as Ft, createLocalTransport as G, reclaimIntervalMs as Gt, PARENT_ROUTED_PROVIDER_ADDON_ID as H, hubMainRssBudget as Ht, CapRouteResolver as I, ZERO_LOOP_DELAY as It, SocketChannel as J, startRunnerHeapWatch as Jt, UdsLocalTransportClient as K, shouldReclaim as Kt, CapRouteError as L, buildHeapSample as Lt, LocalChildRegistry as M, RSS_BUDGET_REANNOUNCE_MIN_MS as Mt, UDS_NO_ROUTE_PREFIX as N, RSS_BUDGET_RELEASE_RATIO as Nt, udsChildLogToWorkerEntry as O, HEAP_WATCH_WARN_RATIO as Ot, AGENT_CAP_FWD_ACTION as P, RUNNER_HEAP_WATCH_INTERVAL_MS as Pt, buildNativeCapProxy as Q, RUNNER_HEAP_SNAPSHOT_ENV as Qt, classifyCapRoute as R, createDeferredHeapWatchSink as Rt, buildLinkChain as S, runNpm as St, createParentUnownedCallHandler as T, HEAP_RECLAIM_STEADY_STATE_INTERVAL_MS as Tt, __resetCapUsageRegistryForTests as U, nextRssBudgetState as Ut, CapUsageRegistry as V, describeRss as Vt, getCapUsageRegistry as W, parseRssBudgetMb as Wt, FrameDecoder as X, DECISIVE_HEAP_SPACES as Xt, localEndpointPath as Y, strandedMb as Yt, encodeFrame as Z, HEAP_SPACE_REPORT_MIN_MB as Zt, AddonDepsManager as _, EVENT_PLANE_TOP_N as _n, CapabilityUnavailableError as _t, createUdsAddonContext as a, EMPTY_SOCKET_PLANE_BASELINE as an, createAddonService as at, brokerCallForCap as b, diffEventPlane as bn, resolveAddonClass as bt, getOrInitReadinessRegistryForClient as c, createSocketPlaneReader as cn, capActionName as ct, clusterEventTopic as d, EMPTY_SOCKET_DIRECTION as dn, capServiceName as dt, formatHeapSpaces as en, createBrokerDeviceManagerApi as et, getBrokerEventBus as f, createSocketDirectionCounters as fn, parseCapAction as ft, subscribePassthrough as g, socketDirectionMessages as gn, CapabilityHandle as gt, setNodeEventInterest as h, socketDirectionBytes as hn, DeviceRegistry as ht, createAddonContext as i, selectReportedSpaces as in, setWorkerNativeCapsChangeListener as it, LocalChildClient as j, HUB_RSS_BUDGET_ENV as jt, createUdsLogger as k, HUB_MAIN_HEAP_WATCH_LABEL as kt, setHubConnected as l, diffSocketPlane as ln, capActionSuffix as lt, registerEventBusService as m, sampleSocketDirection as mn, serializeTypedArrays as mt, installManifestPythonDeps as n, heapSpaceField as nn, getWorkerNativeCapSnapshot as nt, getWorkerDeviceRegistry as o, SOCKET_PLANE_TOP_N as on, validateProviderRegistrations as ot, getMoleculerEventStats as p, recordSocketFrame as pn, deserializeTypedArrays as pt, UdsLocalTransportServer as q, startHeapWatch as qt, adaptBrokerToCluster as r, readHeapSpaces as rn, mountNativeCapService as rt, getOrInitReadinessRegistry as s, createSocketPlaneMeter as sn, NATIVE_PROVIDER_SERVICE_INFIX as st, installManifestSystemDeps as t, heapSnapshotAuthorised as tn, getWorkerNativeCapProvider as tt, EVENT_TOPIC_PREFIX as u, formatSocketPlane as un, capBareAction as ut, createKernelHwAccel as v, createEventPlaneMeter as vn, copyBundledNativeModules as vt, localProviderLink as w, HEAP_RECLAIM_MIN_INTERVAL_MS as wt, brokerTransportLink as x, formatEventPlane as xn, resolveNpmInvocation as xt, resolveHwAccel as y, createEventPlaneReader as yn, installManifestNativeDeps as yt, callWithServiceDiscovery as z, createLoopDelayMeter as zt };
|