@camstack/system 1.2.291 → 1.2.293
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 +20 -62
- package/dist/addon-runner.mjs +4 -46
- 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/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.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/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.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-linked-devices.d.ts +2 -37
- package/dist/builtins/device-manager/device-manager.addon.js +4 -73
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -71
- 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/storage-orchestrator.addon.js +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- 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/{manifest-system-deps-ghRqcy_-.mjs → child-cap-dispatch-CWkcQIRe.mjs} +51 -1
- package/dist/{manifest-system-deps-DTgkfBJy.js → child-cap-dispatch-CzNzGnGm.js} +62 -0
- package/dist/{dist-XnunBp0n.js → dist-CrL3PV53.js} +365 -27
- package/dist/{dist-DiMNxNDh.mjs → dist-tccneRF3.mjs} +354 -22
- package/dist/index.d.ts +4 -0
- package/dist/index.js +167 -166
- package/dist/index.mjs +3 -3
- package/dist/kernel/moleculer/child-cap-dispatch.d.ts +19 -0
- package/dist/{retired-settings-keys-DQn9s_AI.js → retired-settings-keys-BrOWH5-B.js} +1 -1
- package/dist/{retired-settings-keys-DnCcgrCG.mjs → retired-settings-keys-CcNuGSJ0.mjs} +1 -1
- package/package.json +1 -1
package/dist/addon-runner.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const
|
|
2
|
+
const require_child_cap_dispatch = require("./child-cap-dispatch-CzNzGnGm.js");
|
|
3
3
|
const require_custom_action_registry = require("./custom-action-registry-acBY3mHA.js");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -147,49 +147,6 @@ function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
|
147
147
|
});
|
|
148
148
|
return descriptors;
|
|
149
149
|
}
|
|
150
|
-
//#endregion
|
|
151
|
-
//#region src/kernel/moleculer/child-cap-dispatch.ts
|
|
152
|
-
/** Type guard narrowing a dynamically-read provider member to a callable method. */
|
|
153
|
-
function isCapMethod(value) {
|
|
154
|
-
return typeof value === "function";
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Extract a string `addonId` out of arbitrary method args — the fallback
|
|
158
|
-
* provider-selection hint for calls that arrive WITHOUT the out-of-band
|
|
159
|
-
* `CapCallMessage.addonId` (e.g. a sibling child's unowned collection call
|
|
160
|
-
* forwarded by the parent, where the raw input still carries `addonId`).
|
|
161
|
-
*/
|
|
162
|
-
function extractArgsAddonId(args) {
|
|
163
|
-
if (args === null || typeof args !== "object") return void 0;
|
|
164
|
-
const raw = Reflect.get(args, "addonId");
|
|
165
|
-
return typeof raw === "string" ? raw : void 0;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Creates a unified dispatcher that routes a {@link CapCallInput} to either a
|
|
169
|
-
* device-scoped or singleton provider, then invokes the requested method.
|
|
170
|
-
*
|
|
171
|
-
* Pure module — no Moleculer, no broker, no addon-runner dependency.
|
|
172
|
-
*/
|
|
173
|
-
function createChildCapDispatch(deps) {
|
|
174
|
-
return async (call) => {
|
|
175
|
-
const { capName, method, args, deviceId } = call;
|
|
176
|
-
const addonId = call.addonId ?? extractArgsAddonId(args);
|
|
177
|
-
let provider;
|
|
178
|
-
if (deviceId !== void 0) {
|
|
179
|
-
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName, addonId);
|
|
180
|
-
if (provider == null) throw new Error(`child-cap-dispatch: no provider for '${capName}' (device '${String(deviceId)}' or singleton)`);
|
|
181
|
-
} else {
|
|
182
|
-
provider = deps.getSingletonProvider(capName, addonId);
|
|
183
|
-
if (provider == null) throw new Error(`child-cap-dispatch: no singleton provider for '${capName}'`);
|
|
184
|
-
}
|
|
185
|
-
const fn = Reflect.get(provider, method);
|
|
186
|
-
if (!isCapMethod(fn)) {
|
|
187
|
-
if (deps.isCollectionListMethod(capName, method)) return [];
|
|
188
|
-
throw new Error(`child-cap-dispatch: method '${method}' not found on provider '${capName}'`);
|
|
189
|
-
}
|
|
190
|
-
return await fn.call(provider, args);
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
150
|
/**
|
|
194
151
|
* Start warning if `initialize()` has not returned within `firstMs`.
|
|
195
152
|
*
|
|
@@ -423,7 +380,7 @@ async function loadAddonModule(addonId, addonDir) {
|
|
|
423
380
|
if (!node_fs.existsSync(entryPath)) throw new Error(`Entry point not found: ${entryPath}`);
|
|
424
381
|
const modUnknown = await import(entryPath);
|
|
425
382
|
const mod = isRecord(modUnknown) ? modUnknown : {};
|
|
426
|
-
const AddonClass =
|
|
383
|
+
const AddonClass = require_child_cap_dispatch.resolveAddonClass(mod);
|
|
427
384
|
if (!AddonClass) throw new Error(`No addon class exported from ${entryPath}`);
|
|
428
385
|
return {
|
|
429
386
|
declaration,
|
|
@@ -557,14 +514,15 @@ async function main() {
|
|
|
557
514
|
*/
|
|
558
515
|
const customActionRegistry = new require_custom_action_registry.CustomActionRegistry();
|
|
559
516
|
let shuttingDown = false;
|
|
560
|
-
const udsChildClient = new
|
|
517
|
+
const udsChildClient = new require_child_cap_dispatch.LocalChildClient({
|
|
561
518
|
nodeId: parentNodeId,
|
|
562
519
|
childId: runnerId,
|
|
563
|
-
caps: buildChildCapDescriptors(runnerManifest,
|
|
564
|
-
dispatch: createChildCapDispatch({
|
|
520
|
+
caps: buildChildCapDescriptors(runnerManifest, require_child_cap_dispatch.getWorkerNativeCapSnapshot()),
|
|
521
|
+
dispatch: require_child_cap_dispatch.createChildCapDispatch({
|
|
565
522
|
getSingletonProvider: (capName, addonId) => resolveSingletonProvider(capName, addonId),
|
|
566
|
-
getDeviceProvider: (capName, deviceId) =>
|
|
567
|
-
isCollectionListMethod: (capName, method) => (0, _camstack_types_addon.isCollectionArrayMethodName)(capName, method)
|
|
523
|
+
getDeviceProvider: (capName, deviceId) => require_child_cap_dispatch.getWorkerNativeCapProvider(capName, deviceId) ?? null,
|
|
524
|
+
isCollectionListMethod: (capName, method) => (0, _camstack_types_addon.isCollectionArrayMethodName)(capName, method),
|
|
525
|
+
isProviderOptionalMethod: (capName, method) => (0, _camstack_types_addon.isProviderOptionalMethodName)(capName, method)
|
|
568
526
|
})
|
|
569
527
|
});
|
|
570
528
|
udsChildClient.onAddonCall(createChildAddonCallDispatch({
|
|
@@ -573,7 +531,7 @@ async function main() {
|
|
|
573
531
|
getAddonInstance: (addonId) => loadedAddonInstances.get(addonId) ?? null,
|
|
574
532
|
getDataPlanes: (addonId) => addonDataPlanes.get(addonId) ?? []
|
|
575
533
|
}));
|
|
576
|
-
const { logger: runnerLog, control: runnerLogControl } =
|
|
534
|
+
const { logger: runnerLog, control: runnerLogControl } = require_child_cap_dispatch.createUdsLoggerWithControl(udsChildClient, runnerId, nodeId, "addon-runner");
|
|
577
535
|
udsChildClient.onSetLogLevel((level) => {
|
|
578
536
|
runnerLogControl.setLevel(level);
|
|
579
537
|
runnerLog.info(`Log level changed to "${level}" via UDS`);
|
|
@@ -588,13 +546,13 @@ async function main() {
|
|
|
588
546
|
if (storageProvider) runnerLog.info(`"${nodeId}" storage provider rooted at ${dataDir}`);
|
|
589
547
|
else runnerLog.warn(`"${nodeId}" failed to load FilesystemStorageProvider`, { meta: { error: (0, _camstack_types_addon.errMsg)(storageProviderError) } });
|
|
590
548
|
const refreshChildCaps = (reason, customActions) => {
|
|
591
|
-
const freshDescriptors = buildChildCapDescriptors(runnerManifest,
|
|
549
|
+
const freshDescriptors = buildChildCapDescriptors(runnerManifest, require_child_cap_dispatch.getWorkerNativeCapSnapshot());
|
|
592
550
|
udsChildClient.updateCaps(freshDescriptors, customActions).catch((err) => {
|
|
593
551
|
runnerLog.warn(`UDS updateCaps failed (${reason})`, { meta: { error: err instanceof Error ? err.message : String(err) } });
|
|
594
552
|
});
|
|
595
553
|
};
|
|
596
554
|
let capRefreshTimer;
|
|
597
|
-
|
|
555
|
+
require_child_cap_dispatch.setWorkerNativeCapsChangeListener(() => {
|
|
598
556
|
if (capRefreshTimer !== void 0) return;
|
|
599
557
|
capRefreshTimer = setTimeout(() => {
|
|
600
558
|
capRefreshTimer = void 0;
|
|
@@ -606,7 +564,7 @@ async function main() {
|
|
|
606
564
|
const deviceRestorePromises = [];
|
|
607
565
|
for (const { spec, declaration, AddonClass } of loadedModules) try {
|
|
608
566
|
const addon = new AddonClass();
|
|
609
|
-
const context = await
|
|
567
|
+
const context = await require_child_cap_dispatch.createUdsAddonContext(udsChildClient, nodeId, declaration, dataDir, {
|
|
610
568
|
...storageProvider ? { storageProvider } : {},
|
|
611
569
|
dataPlaneSink: { set: (addonId, endpoints) => {
|
|
612
570
|
addonDataPlanes.set(addonId, endpoints);
|
|
@@ -614,13 +572,13 @@ async function main() {
|
|
|
614
572
|
});
|
|
615
573
|
try {
|
|
616
574
|
const pkgRaw = JSON.parse(node_fs.readFileSync(node_path.join(spec.addonDir, "package.json"), "utf-8"));
|
|
617
|
-
await
|
|
575
|
+
await require_child_cap_dispatch.installManifestNativeDeps(spec.addonDir, pkgRaw, context.logger);
|
|
618
576
|
} catch (nativeErr) {
|
|
619
577
|
console.error(`[addon-runner] native deps install failed for "${spec.addonId}": ${(0, _camstack_types_addon.errMsg)(nativeErr)}`);
|
|
620
578
|
process.exit(1);
|
|
621
579
|
}
|
|
622
|
-
await
|
|
623
|
-
await
|
|
580
|
+
await require_child_cap_dispatch.installManifestPythonDeps(declaration, spec.addonDir, context.deps, context.logger);
|
|
581
|
+
await require_child_cap_dispatch.installManifestSystemDeps(declaration, context.logger);
|
|
624
582
|
const registeredProviders = /* @__PURE__ */ new Map();
|
|
625
583
|
const initWatchdog = startInitWatchdog({
|
|
626
584
|
addonId: spec.addonId,
|
|
@@ -655,7 +613,7 @@ async function main() {
|
|
|
655
613
|
return fn(input, caller);
|
|
656
614
|
});
|
|
657
615
|
}
|
|
658
|
-
|
|
616
|
+
require_child_cap_dispatch.validateProviderRegistrations(spec.addonId, declaration, registeredProviders, context.logger);
|
|
659
617
|
const capNames = [...registeredProviders.keys()];
|
|
660
618
|
context.logger.info(`"${spec.addonId}" caps: ${capNames.length > 0 ? capNames.join(", ") : "(none)"}`);
|
|
661
619
|
runnerManifest.push({
|
|
@@ -692,10 +650,10 @@ async function main() {
|
|
|
692
650
|
fireHubReachableOnce();
|
|
693
651
|
runnerLog.info(`"${nodeId}" started — ${loaded.length} addon(s) ready (UDS connected)`);
|
|
694
652
|
process.stdout.write(`READY:${nodeId}\n`);
|
|
695
|
-
const stopHeapWatch =
|
|
653
|
+
const stopHeapWatch = require_child_cap_dispatch.startRunnerHeapWatch({
|
|
696
654
|
heapProfile: process.env["CAMSTACK_RUNNER_HEAP_PROFILE"],
|
|
697
655
|
reclaimSwitch: process.env["CAMSTACK_RUNNER_HEAP_RECLAIM"],
|
|
698
|
-
rssBudgetMb: process.env[
|
|
656
|
+
rssBudgetMb: process.env[require_child_cap_dispatch.RUNNER_RSS_BUDGET_ENV],
|
|
699
657
|
label: nodeId,
|
|
700
658
|
sink: {
|
|
701
659
|
info: (line) => {
|
|
@@ -707,7 +665,7 @@ async function main() {
|
|
|
707
665
|
}
|
|
708
666
|
});
|
|
709
667
|
process.on("SIGUSR2", () => {
|
|
710
|
-
|
|
668
|
+
require_child_cap_dispatch.emitHeapDiagnosticReport({
|
|
711
669
|
label: nodeId,
|
|
712
670
|
addons: loaded.map((e) => e.addonId),
|
|
713
671
|
sink: {
|
|
@@ -723,7 +681,7 @@ async function main() {
|
|
|
723
681
|
const shutdown = async () => {
|
|
724
682
|
shuttingDown = true;
|
|
725
683
|
stopHeapWatch?.();
|
|
726
|
-
|
|
684
|
+
require_child_cap_dispatch.setWorkerNativeCapsChangeListener(null);
|
|
727
685
|
if (capRefreshTimer !== void 0) {
|
|
728
686
|
clearTimeout(capRefreshTimer);
|
|
729
687
|
capRefreshTimer = void 0;
|
package/dist/addon-runner.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { B as LocalChildClient, Ct as resolveAddonClass, N as createUdsLoggerWithControl, St as installManifestNativeDeps, Vt as RUNNER_RSS_BUDGET_ENV, at as getWorkerNativeCapSnapshot, en as startRunnerHeapWatch, fn as emitHeapDiagnosticReport, i as installManifestPythonDeps, it as getWorkerNativeCapProvider, lt as validateProviderRegistrations, n as createChildCapDispatch, r as installManifestSystemDeps, s as createUdsAddonContext, st as setWorkerNativeCapsChangeListener } from "./child-cap-dispatch-CWkcQIRe.mjs";
|
|
2
2
|
import { t as CustomActionRegistry } from "./custom-action-registry-B4Cf4O_X.mjs";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
|
-
import { ReadinessRegistry, ReadinessTimeoutError, errMsg, isCollectionArrayMethodName, normalizeAddonInitResult } from "@camstack/types/addon";
|
|
6
|
+
import { ReadinessRegistry, ReadinessTimeoutError, errMsg, isCollectionArrayMethodName, isProviderOptionalMethodName, normalizeAddonInitResult } from "@camstack/types/addon";
|
|
7
7
|
import { pathToFileURL } from "node:url";
|
|
8
8
|
//#region src/kernel/moleculer/child-addon-call-dispatch.ts
|
|
9
9
|
function isRecord$1(value) {
|
|
@@ -144,49 +144,6 @@ function buildChildCapDescriptors(manifest, nativeCapSnapshot) {
|
|
|
144
144
|
});
|
|
145
145
|
return descriptors;
|
|
146
146
|
}
|
|
147
|
-
//#endregion
|
|
148
|
-
//#region src/kernel/moleculer/child-cap-dispatch.ts
|
|
149
|
-
/** Type guard narrowing a dynamically-read provider member to a callable method. */
|
|
150
|
-
function isCapMethod(value) {
|
|
151
|
-
return typeof value === "function";
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Extract a string `addonId` out of arbitrary method args — the fallback
|
|
155
|
-
* provider-selection hint for calls that arrive WITHOUT the out-of-band
|
|
156
|
-
* `CapCallMessage.addonId` (e.g. a sibling child's unowned collection call
|
|
157
|
-
* forwarded by the parent, where the raw input still carries `addonId`).
|
|
158
|
-
*/
|
|
159
|
-
function extractArgsAddonId(args) {
|
|
160
|
-
if (args === null || typeof args !== "object") return void 0;
|
|
161
|
-
const raw = Reflect.get(args, "addonId");
|
|
162
|
-
return typeof raw === "string" ? raw : void 0;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Creates a unified dispatcher that routes a {@link CapCallInput} to either a
|
|
166
|
-
* device-scoped or singleton provider, then invokes the requested method.
|
|
167
|
-
*
|
|
168
|
-
* Pure module — no Moleculer, no broker, no addon-runner dependency.
|
|
169
|
-
*/
|
|
170
|
-
function createChildCapDispatch(deps) {
|
|
171
|
-
return async (call) => {
|
|
172
|
-
const { capName, method, args, deviceId } = call;
|
|
173
|
-
const addonId = call.addonId ?? extractArgsAddonId(args);
|
|
174
|
-
let provider;
|
|
175
|
-
if (deviceId !== void 0) {
|
|
176
|
-
provider = deps.getDeviceProvider(capName, deviceId) ?? deps.getSingletonProvider(capName, addonId);
|
|
177
|
-
if (provider == null) throw new Error(`child-cap-dispatch: no provider for '${capName}' (device '${String(deviceId)}' or singleton)`);
|
|
178
|
-
} else {
|
|
179
|
-
provider = deps.getSingletonProvider(capName, addonId);
|
|
180
|
-
if (provider == null) throw new Error(`child-cap-dispatch: no singleton provider for '${capName}'`);
|
|
181
|
-
}
|
|
182
|
-
const fn = Reflect.get(provider, method);
|
|
183
|
-
if (!isCapMethod(fn)) {
|
|
184
|
-
if (deps.isCollectionListMethod(capName, method)) return [];
|
|
185
|
-
throw new Error(`child-cap-dispatch: method '${method}' not found on provider '${capName}'`);
|
|
186
|
-
}
|
|
187
|
-
return await fn.call(provider, args);
|
|
188
|
-
};
|
|
189
|
-
}
|
|
190
147
|
/**
|
|
191
148
|
* Start warning if `initialize()` has not returned within `firstMs`.
|
|
192
149
|
*
|
|
@@ -561,7 +518,8 @@ async function main() {
|
|
|
561
518
|
dispatch: createChildCapDispatch({
|
|
562
519
|
getSingletonProvider: (capName, addonId) => resolveSingletonProvider(capName, addonId),
|
|
563
520
|
getDeviceProvider: (capName, deviceId) => getWorkerNativeCapProvider(capName, deviceId) ?? null,
|
|
564
|
-
isCollectionListMethod: (capName, method) => isCollectionArrayMethodName(capName, method)
|
|
521
|
+
isCollectionListMethod: (capName, method) => isCollectionArrayMethodName(capName, method),
|
|
522
|
+
isProviderOptionalMethod: (capName, method) => isProviderOptionalMethodName(capName, method)
|
|
565
523
|
})
|
|
566
524
|
});
|
|
567
525
|
udsChildClient.onAddonCall(createChildAddonCallDispatch({
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as EventCategory, L as addonPagesCapability, dn as errMsg, pn as BaseAddon } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
const require_settle_sources = require("../../settle-sources-Bhsy57y-.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as EventCategory, dn as errMsg, pn as BaseAddon, z as addonWidgetsCapability } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { t as settleSourcesWithTimeout } from "../../settle-sources-CDtNC8ub.mjs";
|
|
3
3
|
import { createHash, randomUUID } from "node:crypto";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
//#region src/builtins/alerts/prune-policy.ts
|
|
8
8
|
/**
|
|
9
9
|
* Ids older than `cutoffMs`, oldest first.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as alertsCapability,
|
|
1
|
+
import { B as alertsCapability, Bn as EventCategory, En as createEvent, dn as errMsg, n as AlertSchema, pn as BaseAddon } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
//#region src/builtins/alerts/prune-policy.ts
|
|
3
3
|
/**
|
|
4
4
|
* Ids older than `cutoffMs`, oldest first.
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
8
8
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
9
9
|
deadZoneFraction: .5,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as EventCategory, Mn as isEvent, U as bareAddonId, Ut as ptzAutotrackCapability, dn as errMsg, g as FIRST_LEVEL_MACRO_CLASSES, pn as BaseAddon } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
//#region src/builtins/autotrack/autotrack-config.ts
|
|
3
3
|
var DEFAULT_AUTOTRACK_LOOP_CONFIG = {
|
|
4
4
|
deadZoneFraction: .5,
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
let node_crypto = require("node:crypto");
|
|
8
8
|
let buffer = require("buffer");
|
|
9
9
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Bn as EventCategory, H as backupCapability, Nt as mayWriteToLocation, pn as BaseAddon, rn as storageOccupancyCapability } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { randomBytes, randomUUID } from "node:crypto";
|
|
3
3
|
import { Buffer as Buffer$1 } from "buffer";
|
|
4
4
|
import * as fsp from "node:fs/promises";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
let zod = require("zod");
|
|
8
8
|
let _camstack_types_node = require("@camstack/types/node");
|
|
9
9
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as hydrateSchema, Bn as EventCategory, En as createEvent, It as motionCapability, K as cameraGridLayoutCapability, Q as declarationOwnerNodeId, S as MOTION_CLOSE_AFTER_MS, _n as DeviceFeature, an as streamCatalogCapability, dn as errMsg, en as snapshotCapability, fn as buildFfmpegArgs, i as BaseDevice, m as DeclaredDevices, p as DERIVED_CAMERA_SILENCED_CAP_NAMES, pn as BaseAddon, yn as DeviceType } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { FfmpegProcess } from "@camstack/types/node";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
7
|
const require_formatter = require("../../formatter-DqAKDlvN.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { kt as logDestinationCapability, pn as BaseAddon } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
3
|
-
const require_dist = require("../../dist-
|
|
3
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
4
4
|
let node_crypto = require("node:crypto");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
6
6
|
node_fs_promises = require_chunk.__toESM(node_fs_promises);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { J as coreBlockAddonId, X as coreBlocksCapability, Y as coreBlockIdFromAddonId, c as CORE_BLOCKS_ADDON_ID,
|
|
1
|
+
import { J as coreBlockAddonId, X as coreBlocksCapability, Y as coreBlockIdFromAddonId, c as CORE_BLOCKS_ADDON_ID, dn as errMsg, l as CORE_BLOCK_ADDON_PREFIX, m as DeclaredDevices, pn as BaseAddon, u as CoreBlockSchema } from "../../dist-tccneRF3.mjs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
3
|
import * as fs from "node:fs/promises";
|
|
4
4
|
import * as path$1 from "node:path";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { ConfigUISchemaWithValues, IDeviceManagerProvider, LinkedDevicesMode,
|
|
1
|
+
import { ConfigUISchemaWithValues, IDeviceManagerProvider, LinkedDevicesMode, legacyAutoLinkIds, LinkCandidate } from '@camstack/types';
|
|
2
2
|
import { ProviderContext } from './device-provider-context.js';
|
|
3
|
+
export { legacyAutoLinkIds, type LinkCandidate };
|
|
3
4
|
/** Reserved device-config keys (cf. `_profileMap`). */
|
|
4
5
|
export declare const LINKED_MODE_CONFIG_KEY = "_linkedDevicesMode";
|
|
5
6
|
export declare const LINKED_IDS_CONFIG_KEY = "_linkedDeviceIds";
|
|
@@ -18,30 +19,6 @@ export interface LinkedDevicesConfig {
|
|
|
18
19
|
* ids may arrive as numbers or numeric strings (the multiselect field
|
|
19
20
|
* stores string option values); anything else is dropped. */
|
|
20
21
|
export declare function parseLinkedDevicesConfig(blob: Record<string, unknown>): LinkedDevicesConfig;
|
|
21
|
-
/** The device fields the pure resolver consumes (subset of `DeviceInfo`). */
|
|
22
|
-
export interface LinkCandidate {
|
|
23
|
-
readonly id: number;
|
|
24
|
-
readonly parentDeviceId: number | null;
|
|
25
|
-
readonly location: string | null;
|
|
26
|
-
readonly type: DeviceType;
|
|
27
|
-
/**
|
|
28
|
-
* The child identity a container's stored pick is matched against. A NOT
|
|
29
|
-
* NULL column, so `slim` carries it — which is the whole reason the pick is
|
|
30
|
-
* keyed on it (see `ContainerChildRef.stableId`).
|
|
31
|
-
*/
|
|
32
|
-
readonly stableId: string;
|
|
33
|
-
/** The container's own operator pick, when one was made. */
|
|
34
|
-
readonly primaryChildEntityId?: string | null;
|
|
35
|
-
/**
|
|
36
|
-
* The child's `DeviceRole`. Ranked ABOVE `type` when a container picks the
|
|
37
|
-
* child it stands for, because `DeviceType` cannot tell a door contact from a
|
|
38
|
-
* battery reading — Home Assistant maps both to `Sensor`. A first-class meta
|
|
39
|
-
* column, so `slim` carries it.
|
|
40
|
-
*/
|
|
41
|
-
readonly role?: string | null | undefined;
|
|
42
|
-
/** Operator-facing name — used for the namesake tiebreak. Also a column. */
|
|
43
|
-
readonly name?: string;
|
|
44
|
-
}
|
|
45
22
|
/**
|
|
46
23
|
* Pure resolution core: children ∪ (auto → same-location | manual → list),
|
|
47
24
|
* minus self, deduped, CONTAINERS expanded to their children (see file
|
|
@@ -52,18 +29,6 @@ export declare function resolveLinkedDeviceIds(params: {
|
|
|
52
29
|
readonly config: LinkedDevicesConfig;
|
|
53
30
|
readonly candidates: readonly LinkCandidate[];
|
|
54
31
|
}): readonly number[];
|
|
55
|
-
/**
|
|
56
|
-
* What the retired `auto` mode (pre-D356) added beyond the device-tree
|
|
57
|
-
* children: every non-container candidate sharing the camera's location, a
|
|
58
|
-
* container child standing in for its container's PRIMARY child. Kept ONLY
|
|
59
|
-
* for the one-shot boot backfill that materialises it into the manual list
|
|
60
|
-
* (`linked-devices-manual-backfill.ts`); nothing on the read path calls it.
|
|
61
|
-
*/
|
|
62
|
-
export declare function legacyAutoLinkIds(params: {
|
|
63
|
-
readonly selfId: number;
|
|
64
|
-
readonly selfLocation: string | null;
|
|
65
|
-
readonly candidates: readonly LinkCandidate[];
|
|
66
|
-
}): readonly number[];
|
|
67
32
|
/**
|
|
68
33
|
* Which linked devices materialize synthetic tracked events on the camera.
|
|
69
34
|
* Absent / non-array config key ⇒ NONE — the operator must explicitly pick
|
|
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_dist = require("../../dist-
|
|
7
|
-
const require_retired_settings_keys = require("../../retired-settings-keys-
|
|
6
|
+
const require_dist = require("../../dist-CrL3PV53.js");
|
|
7
|
+
const require_retired_settings_keys = require("../../retired-settings-keys-BrOWH5-B.js");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
9
9
|
let _camstack_types_node = require("@camstack/types/node");
|
|
10
10
|
//#region src/builtins/device-manager/adoption-job-engine.ts
|
|
@@ -2733,41 +2733,6 @@ function parseLinkedDevicesConfig(blob) {
|
|
|
2733
2733
|
};
|
|
2734
2734
|
}
|
|
2735
2735
|
/**
|
|
2736
|
-
* Resolve one candidate id to the ids it should actually contribute to a
|
|
2737
|
-
* linked set: itself, unless it is a CONTAINER, in which case its own
|
|
2738
|
-
* children (recursively expanded the same way — a container-of-containers
|
|
2739
|
-
* is vanishingly unlikely per `DeviceType.Container`'s contract, but this
|
|
2740
|
-
* costs nothing to handle). `visited` guards a pathological parent-cycle in
|
|
2741
|
-
* persisted data from recursing forever; a candidate already on the current
|
|
2742
|
-
* expansion path is dropped rather than re-expanded.
|
|
2743
|
-
*
|
|
2744
|
-
* This is the STRUCTURAL, location-independent way a container's child
|
|
2745
|
-
* becomes reachable: the device-tree "children of the camera" rule and a
|
|
2746
|
-
* persisted manual pick are parentDeviceId chains, never location-based —
|
|
2747
|
-
* a container named there is excluded by expanding into whatever it
|
|
2748
|
-
* actually contains, regardless of what its (or its children's) `location`
|
|
2749
|
-
* column holds.
|
|
2750
|
-
*/
|
|
2751
|
-
function expandContainer(id, byId, byParent, visited, out) {
|
|
2752
|
-
if (visited.has(id)) return;
|
|
2753
|
-
const candidate = byId.get(id);
|
|
2754
|
-
if (!candidate) return;
|
|
2755
|
-
if (candidate.type !== require_dist.DeviceType.Container) {
|
|
2756
|
-
out.add(id);
|
|
2757
|
-
return;
|
|
2758
|
-
}
|
|
2759
|
-
const nextVisited = new Set(visited);
|
|
2760
|
-
nextVisited.add(id);
|
|
2761
|
-
const primary = require_dist.resolveContainerPrimaryChild((byParent.get(id) ?? []).map((c) => ({
|
|
2762
|
-
id: c.id,
|
|
2763
|
-
stableId: c.stableId,
|
|
2764
|
-
type: c.type,
|
|
2765
|
-
...c.role !== void 0 && c.role !== null ? { role: c.role } : {},
|
|
2766
|
-
...c.name !== void 0 ? { name: c.name } : {}
|
|
2767
|
-
})), byId.get(id)?.primaryChildEntityId, byId.get(id)?.name);
|
|
2768
|
-
if (primary !== null) expandContainer(primary.id, byId, byParent, nextVisited, out);
|
|
2769
|
-
}
|
|
2770
|
-
/**
|
|
2771
2736
|
* Pure resolution core: children ∪ (auto → same-location | manual → list),
|
|
2772
2737
|
* minus self, deduped, CONTAINERS expanded to their children (see file
|
|
2773
2738
|
* header). Order: children first, then mode additions.
|
|
@@ -2783,47 +2748,13 @@ function resolveLinkedDeviceIds(params) {
|
|
|
2783
2748
|
else byParent.set(c.parentDeviceId, [c]);
|
|
2784
2749
|
}
|
|
2785
2750
|
const ids = /* @__PURE__ */ new Set();
|
|
2786
|
-
const expand = (id) => expandContainer(id, byId, byParent, /* @__PURE__ */ new Set(), ids);
|
|
2751
|
+
const expand = (id) => require_dist.expandContainer(id, byId, byParent, /* @__PURE__ */ new Set(), ids);
|
|
2787
2752
|
for (const c of candidates) if (c.parentDeviceId === selfId) expand(c.id);
|
|
2788
2753
|
for (const id of config.manualIds) if (byId.has(id)) expand(id);
|
|
2789
2754
|
ids.delete(selfId);
|
|
2790
2755
|
return [...ids];
|
|
2791
2756
|
}
|
|
2792
2757
|
/**
|
|
2793
|
-
* What the retired `auto` mode (pre-D356) added beyond the device-tree
|
|
2794
|
-
* children: every non-container candidate sharing the camera's location, a
|
|
2795
|
-
* container child standing in for its container's PRIMARY child. Kept ONLY
|
|
2796
|
-
* for the one-shot boot backfill that materialises it into the manual list
|
|
2797
|
-
* (`linked-devices-manual-backfill.ts`); nothing on the read path calls it.
|
|
2798
|
-
*/
|
|
2799
|
-
function legacyAutoLinkIds(params) {
|
|
2800
|
-
const { selfId, selfLocation, candidates } = params;
|
|
2801
|
-
if (selfLocation === null || selfLocation.length === 0) return [];
|
|
2802
|
-
const byId = new Map(candidates.map((c) => [c.id, c]));
|
|
2803
|
-
const byParent = /* @__PURE__ */ new Map();
|
|
2804
|
-
for (const c of candidates) {
|
|
2805
|
-
if (c.parentDeviceId === null) continue;
|
|
2806
|
-
const siblings = byParent.get(c.parentDeviceId);
|
|
2807
|
-
if (siblings) siblings.push(c);
|
|
2808
|
-
else byParent.set(c.parentDeviceId, [c]);
|
|
2809
|
-
}
|
|
2810
|
-
const ids = /* @__PURE__ */ new Set();
|
|
2811
|
-
const expand = (id) => expandContainer(id, byId, byParent, /* @__PURE__ */ new Set(), ids);
|
|
2812
|
-
for (const c of candidates) {
|
|
2813
|
-
if (c.type === require_dist.DeviceType.Container) continue;
|
|
2814
|
-
if (c.location !== selfLocation) continue;
|
|
2815
|
-
if (c.parentDeviceId === selfId) continue;
|
|
2816
|
-
const parent = c.parentDeviceId !== null ? byId.get(c.parentDeviceId) : void 0;
|
|
2817
|
-
if (parent !== void 0 && parent.type === require_dist.DeviceType.Container) {
|
|
2818
|
-
expand(parent.id);
|
|
2819
|
-
continue;
|
|
2820
|
-
}
|
|
2821
|
-
ids.add(c.id);
|
|
2822
|
-
}
|
|
2823
|
-
ids.delete(selfId);
|
|
2824
|
-
return [...ids];
|
|
2825
|
-
}
|
|
2826
|
-
/**
|
|
2827
2758
|
* Which linked devices materialize synthetic tracked events on the camera.
|
|
2828
2759
|
* Absent / non-array config key ⇒ NONE — the operator must explicitly pick
|
|
2829
2760
|
* producers (opt-in; flipped from the legacy absent⇒ALL default, which
|
|
@@ -5954,7 +5885,7 @@ function planManualBackfill(params) {
|
|
|
5954
5885
|
manualIds: current
|
|
5955
5886
|
};
|
|
5956
5887
|
const merged = [...current];
|
|
5957
|
-
for (const id of legacyAutoLinkIds({
|
|
5888
|
+
for (const id of require_dist.legacyAutoLinkIds({
|
|
5958
5889
|
selfId,
|
|
5959
5890
|
selfLocation,
|
|
5960
5891
|
candidates
|