@camstack/server 1.2.941 → 1.2.942
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 +14 -0
- package/dist/api/trpc/generated-cap-mounts.js +19 -1
- package/dist/api/trpc/generated-cap-routers.js +676 -596
- package/package.json +27 -11
- package/system/dist/action-index-B1fgpQBt.mjs +9925 -0
- package/system/dist/action-index-B_cLRwXJ.js +9972 -0
- package/system/dist/alert-episode-Be--PngO.mjs +64 -0
- package/system/dist/alert-episode-Bqktmt-i.js +93 -0
- package/system/dist/{base-addon-Md14i7pe.mjs → base-addon-BcS6r1cT.mjs} +20 -7
- package/system/dist/{base-addon-DD5dIfcZ.js → base-addon-CRsXtYFG.js} +20 -7
- package/system/dist/{base-device-CH8rfD9j.js → base-device-DAdWzDOl.js} +138 -34
- package/system/dist/{base-device-BcGO6LTT.mjs → base-device-DJXF5eDN.mjs} +138 -34
- 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/alert-episode-policy.d.ts +9 -5
- package/system/dist/builtins/alerts/alerts.addon.js +30 -80
- package/system/dist/builtins/alerts/alerts.addon.mjs +18 -68
- package/system/dist/builtins/autotrack/index.js +2 -2
- package/system/dist/builtins/autotrack/index.mjs +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
- 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 +9 -9
- package/system/dist/builtins/camera-grid/index.mjs +6 -6
- package/system/dist/builtins/composer/composer.addon.js +99 -99
- package/system/dist/builtins/composer/composer.addon.mjs +11 -11
- 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/automation-template-instances.d.ts +14 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.d.ts +6 -0
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +296 -193
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +237 -134
- package/system/dist/builtins/core-blocks/link-contributions.d.ts +2 -0
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +91 -18
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +91 -18
- package/system/dist/builtins/core-notifier/group-notification-output.d.ts +8 -16
- package/system/dist/builtins/device-history/device-history.addon.d.ts +8 -0
- package/system/dist/builtins/device-history/device-history.addon.js +580 -60
- package/system/dist/builtins/device-history/device-history.addon.mjs +569 -49
- package/system/dist/builtins/device-history/retention/device-raw-overrides.d.ts +16 -0
- package/system/dist/builtins/device-history/retention/retention-knobs.d.ts +14 -0
- package/system/dist/builtins/device-history/retention/retention.d.ts +21 -1
- package/system/dist/builtins/device-history/transitions/change-coalescing.d.ts +48 -0
- package/system/dist/builtins/device-history/transitions/derived-changes.d.ts +49 -0
- package/system/dist/builtins/device-history/transitions/history-change-port.d.ts +20 -0
- package/system/dist/builtins/device-history/transitions/transitions-service.d.ts +18 -3
- package/system/dist/builtins/device-manager/device-identity-index.d.ts +2 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +177 -479
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +169 -471
- package/system/dist/builtins/device-manager/device-state-mirror.d.ts +0 -5
- package/system/dist/builtins/device-manager/identity-link-reconciler.d.ts +5 -0
- package/system/dist/builtins/device-manager/transitions/command-recorder.d.ts +38 -0
- package/system/dist/builtins/device-manager/transitions/transitions-wiring.d.ts +8 -9
- 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 +2 -2
- package/system/dist/builtins/keychain/index.mjs +2 -2
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +2 -2
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +2 -2
- 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/address-book.d.ts +3 -1
- package/system/dist/builtins/local-network/local-network.addon.d.ts +26 -1
- package/system/dist/builtins/local-network/local-network.addon.js +66 -11
- package/system/dist/builtins/local-network/local-network.addon.mjs +66 -11
- 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.js +1 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +4 -4
- package/system/dist/builtins/snapshot/index.mjs +4 -4
- 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/storage-orchestrator.addon.js +1 -1
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/system-config/system-config.addon.js +1 -1
- package/system/dist/builtins/system-config/system-config.addon.mjs +1 -1
- package/system/dist/builtins/winston-logging/index.js +1 -1
- package/system/dist/builtins/winston-logging/index.mjs +1 -1
- package/system/dist/{capture-engine-CUZ3W0oZ.mjs → capture-engine-B2MmoNND.mjs} +1 -1
- package/system/dist/{capture-engine-mtDXEBAq.js → capture-engine-D_1IJmMs.js} +1 -1
- package/system/dist/command-catalog-C29hVOOg.js +210 -0
- package/system/dist/command-catalog-xAeqxbZk.mjs +169 -0
- package/system/dist/{error.cap-DCwbIGEF.mjs → compile-OBMHlqD-.mjs} +97 -100
- package/system/dist/{error.cap-BxLEHP6z.js → compile-SpeAhaZ6.js} +107 -116
- package/system/dist/{composition-sources-B56CU8hi.mjs → composition-sources-C327LGFn.mjs} +2 -2
- package/system/dist/{composition-sources-D_Bfwji0.js → composition-sources-Do5qM6EB.js} +17 -17
- package/system/dist/{core-blocks.cap-xt5_fK5Z.js → core-blocks.cap-CdTGUKtr.js} +194 -10110
- package/system/dist/{core-blocks.cap-DDECcMeI.mjs → core-blocks.cap-DLkEfV5b.mjs} +54 -9910
- package/system/dist/{device-kind-BJ2pfsjw.mjs → device-kind-C37Ra2wd.mjs} +4 -2
- package/system/dist/{device-kind-CsSiv_YF.js → device-kind-FMhJg8uC.js} +4 -2
- package/system/dist/{device-manager.cap-DyHOIh5T.js → device-manager.cap-DJs8izI6.js} +13 -4
- package/system/dist/{device-manager.cap-DIBK62-r.mjs → device-manager.cap-eYrj1Ezp.mjs} +13 -4
- package/system/dist/{device-provider.cap-BKUGJSo0.js → device-provider.cap-CNlYBQ5D.js} +1 -1
- package/system/dist/{device-provider.cap-DU6HMUXH.mjs → device-provider.cap-D8mJllVM.mjs} +1 -1
- package/system/dist/{device-row-store-O4mNbp5q.js → device-row-store-C0P2H18h.js} +2 -2
- package/system/dist/{device-row-store-C-_R-h1Z.mjs → device-row-store-CTocYKqC.mjs} +2 -2
- package/system/dist/{device-type-CbQsnFdC.js → device-type-Cnc0NiSX.js} +13 -0
- package/system/dist/{device-type-DgEvK3ch.mjs → device-type-TUGqGmaI.mjs} +13 -0
- package/system/dist/error.cap-BuKbL3Ac.js +125 -0
- package/system/dist/error.cap-CU1FB6uE.mjs +102 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{history-catalog-BwTeQ4Mr.mjs → history-catalog-A_dzXNpv.mjs} +98 -3
- package/system/dist/{history-catalog-BKRarIL_.js → history-catalog-CiTMP3-E.js} +98 -3
- package/system/dist/index.js +28 -6
- package/system/dist/index.mjs +28 -6
- package/system/dist/kernel/addon-version-policy.d.ts +10 -0
- package/system/dist/{legacy-integration-rows-door-B1nzxxr5.js → legacy-integration-rows-door-CdqYAj-o.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-nTvo_6jQ.mjs → legacy-integration-rows-door-LSgpClpX.mjs} +1 -1
- package/system/dist/{low-power-sleep.cap-B6mz6ojP.js → low-power-sleep.cap-BJWyAuUQ.js} +1 -1
- package/system/dist/{low-power-sleep.cap-C3Vi8Vxj.mjs → low-power-sleep.cap-D9Orx3LS.mjs} +1 -1
- package/system/dist/migrations/hub/2026-11-22-device-transitions-commands-only.d.ts +10 -0
- package/system/dist/{network-access.cap-BEN_uRVb.js → network-access.cap-CTQ2WQoi.js} +38 -12
- package/system/dist/{network-access.cap-Dy8FNNVs.mjs → network-access.cap-Dx5K0I5i.mjs} +33 -13
- package/system/dist/{notification-rules.cap-Drwz-A4n.js → notification-rules.cap-BJKUjizS.js} +45 -9
- package/system/dist/{notification-rules.cap-0vVvsxQ1.mjs → notification-rules.cap-BUIuYPlQ.mjs} +45 -9
- package/system/dist/{notification-targets-DR-D-vIt.mjs → notification-targets-4bGYH5J7.mjs} +2 -2
- package/system/dist/{notification-targets-Cc_3OBH9.js → notification-targets-DMW7xgR2.js} +2 -2
- package/system/dist/{prefix-walk-CCO_VZVo.js → prefix-walk-BFnw8NBu.js} +5 -5
- package/system/dist/{prefix-walk-BhT0ZoKl.mjs → prefix-walk-Mtij0NNT.mjs} +2 -2
- package/system/dist/{ptz-autotrack.cap-DOz0xL0O.js → ptz-autotrack.cap-B9eyZU8w.js} +1 -1
- package/system/dist/{ptz-autotrack.cap-CDF6FeTK.mjs → ptz-autotrack.cap-Dw2k-po9.mjs} +1 -1
- package/system/dist/{recording-archive.cap-RHAN45fa.mjs → recording-archive.cap-CTlm86R8.mjs} +1 -1
- package/system/dist/{recording-archive.cap-BPJ7kvnd.js → recording-archive.cap-Wo-hEZhz.js} +1 -1
- package/system/dist/{rename-composition-block-DWUkrazx.mjs → rename-composition-block-Cdh-dRmY.mjs} +395 -20
- package/system/dist/{rename-composition-block-CH2vRIW7.js → rename-composition-block-D9Uc1AF7.js} +406 -31
- package/system/dist/{retention-CUOVI1p7.mjs → retention-CQs8QR1B.mjs} +33 -3
- package/system/dist/{device-transitions.cap-DCXP3zwY.mjs → retention-source.cap-550kkyp5.mjs} +98 -21
- package/system/dist/{device-transitions.cap-zOGvAIHz.js → retention-source.cap-C6Hy0hlM.js} +103 -20
- package/system/dist/{retention-BcOSL6b9.js → retention-xcjk_k1w.js} +33 -3
- package/system/dist/{snapshot.cap-Cis6JRwn.js → snapshot.cap-CHm29hBs.js} +1 -1
- package/system/dist/{snapshot.cap-BkfHpJVO.mjs → snapshot.cap-CO68YvJU.mjs} +1 -1
- package/system/dist/{stream-catalog.cap-D8Y-uXcy.js → stream-catalog.cap-CjEQFknc.js} +2 -2
- package/system/dist/{stream-catalog.cap-D1Hy19Yc.mjs → stream-catalog.cap-DVniDdRD.mjs} +2 -2
- package/system/dist/{user-management.cap-Ctd4c_im.mjs → user-management.cap-4IEUCSdL.mjs} +2 -2
- package/system/dist/{user-management.cap-DyVb68rY.js → user-management.cap-DV9Jfsj3.js} +2 -2
- package/system/dist/{wal-maintenance-CjpslZUL.mjs → wal-maintenance-Bey5ChBb.mjs} +0 -0
- package/system/dist/{wal-maintenance-DKTXQ7UF.js → wal-maintenance-BgYiAy5b.js} +0 -0
- package/system/package.json +4 -1
- package/system/dist/builtins/device-manager/transitions/transition-correlator.d.ts +0 -81
|
@@ -3,21 +3,21 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const require_stream_catalog_cap = require("../../stream-catalog.cap-
|
|
7
|
-
const require_base_addon = require("../../base-addon-
|
|
6
|
+
const require_stream_catalog_cap = require("../../stream-catalog.cap-CjEQFknc.js");
|
|
7
|
+
const require_base_addon = require("../../base-addon-CRsXtYFG.js");
|
|
8
8
|
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
9
|
-
const require_rename_composition_block = require("../../rename-composition-block-
|
|
9
|
+
const require_rename_composition_block = require("../../rename-composition-block-D9Uc1AF7.js");
|
|
10
10
|
const require_quantity = require("../../quantity-lY1KiTSZ.js");
|
|
11
|
-
const require_device_type = require("../../device-type-
|
|
12
|
-
const require_core_blocks_cap = require("../../core-blocks.cap-xt5_fK5Z.js");
|
|
11
|
+
const require_device_type = require("../../device-type-Cnc0NiSX.js");
|
|
13
12
|
const require_addon_settings_cap = require("../../addon-settings.cap-DrLdMFIe.js");
|
|
14
|
-
const
|
|
13
|
+
const require_core_blocks_cap = require("../../core-blocks.cap-CdTGUKtr.js");
|
|
14
|
+
const require_compile = require("../../compile-SpeAhaZ6.js");
|
|
15
15
|
const require_source_info = require("../../source-info-DtWf4k2j.js");
|
|
16
|
-
const require_composition_sources = require("../../composition-sources-
|
|
16
|
+
const require_composition_sources = require("../../composition-sources-Do5qM6EB.js");
|
|
17
17
|
const require_declared_device = require("../../declared-device-BWphj9WE.js");
|
|
18
|
-
const require_base_device = require("../../base-device-
|
|
19
|
-
const require_capture_engine = require("../../capture-engine-
|
|
20
|
-
const require_retention = require("../../retention-
|
|
18
|
+
const require_base_device = require("../../base-device-DAdWzDOl.js");
|
|
19
|
+
const require_capture_engine = require("../../capture-engine-D_1IJmMs.js");
|
|
20
|
+
const require_retention = require("../../retention-xcjk_k1w.js");
|
|
21
21
|
let zod = require("zod");
|
|
22
22
|
//#region ../types/dist/esm/remote/remote-media-features.mjs
|
|
23
23
|
/**
|
|
@@ -274,7 +274,7 @@ function fieldsFeatureOf(composition, cap) {
|
|
|
274
274
|
/** The device switch the composed `switch.on` reads, when it is one plain `from` of a switch. */
|
|
275
275
|
function actuatorSwitchRead(composition) {
|
|
276
276
|
const feature = fieldsFeatureOf(composition, SWITCH_CAP);
|
|
277
|
-
if (feature === null || !
|
|
277
|
+
if (feature === null || !require_compile.compositionFeatureEnabled(feature)) return null;
|
|
278
278
|
const field = feature.fields[ON_FIELD];
|
|
279
279
|
if (field === void 0 || field.kind !== "from" || field.cap !== SWITCH_CAP) return null;
|
|
280
280
|
return {
|
|
@@ -285,7 +285,7 @@ function actuatorSwitchRead(composition) {
|
|
|
285
285
|
}
|
|
286
286
|
function hasSupplyRelation(composition) {
|
|
287
287
|
const feature = fieldsFeatureOf(composition, "power-source");
|
|
288
|
-
return feature !== null &&
|
|
288
|
+
return feature !== null && require_compile.compositionFeatureEnabled(feature) && feature.fields["switchOn"] !== void 0;
|
|
289
289
|
}
|
|
290
290
|
/** Anything stored for running - a rule, or the opt-out - is the operator's, and the default stays out of it. */
|
|
291
291
|
function hasAuthoredRunning(composition) {
|
|
@@ -329,7 +329,7 @@ function followSwitchRunningFeature(composition, host) {
|
|
|
329
329
|
*/
|
|
330
330
|
function withDefaultRunning(composition, blockId) {
|
|
331
331
|
if (hasAuthoredRunning(composition) || !actuatorSwitchDrivesRunning(composition)) return composition;
|
|
332
|
-
const feature = followSwitchRunningFeature(composition,
|
|
332
|
+
const feature = followSwitchRunningFeature(composition, require_compile.composedDeviceRef(blockId));
|
|
333
333
|
return feature === null ? composition : {
|
|
334
334
|
...composition,
|
|
335
335
|
features: [...composition.features, feature]
|
|
@@ -369,7 +369,7 @@ function withDefaultRunning(composition, blockId) {
|
|
|
369
369
|
* source) behind an early return.
|
|
370
370
|
*/
|
|
371
371
|
function describeRead(read) {
|
|
372
|
-
return `${
|
|
372
|
+
return `${require_compile.compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
|
|
373
373
|
}
|
|
374
374
|
function isConfirmed(reading) {
|
|
375
375
|
return reading.fatal || reading.confirmed === true;
|
|
@@ -435,7 +435,7 @@ function expressionOutcome(source, read, now, stateful) {
|
|
|
435
435
|
if (unavailable !== null) {
|
|
436
436
|
if (stateful !== void 0 && stateful.currentOutput !== void 0 && require_core_blocks_cap.expressionContainsBuiltinCall(source.expr, "count")) return {
|
|
437
437
|
state: "stale",
|
|
438
|
-
value:
|
|
438
|
+
value: require_compile.evaluateCount(null, {
|
|
439
439
|
kind: "count",
|
|
440
440
|
highWater: null,
|
|
441
441
|
primed: false
|
|
@@ -451,9 +451,9 @@ function expressionOutcome(source, read, now, stateful) {
|
|
|
451
451
|
...stateful?.timerDriven === true ? { timerDriven: true } : {},
|
|
452
452
|
convert: (value, from, to) => require_addon_settings_cap.tryConvertUnit(value, require_source_info.normalizeUnit(from) ?? from, require_source_info.normalizeUnit(to) ?? to) ?? null
|
|
453
453
|
};
|
|
454
|
-
const result =
|
|
454
|
+
const result = require_compile.evaluateExpressionSource(source.expr, values, now, {
|
|
455
455
|
hooks,
|
|
456
|
-
...stateful === void 0 ? {} : { invokeStateful: (invocation) =>
|
|
456
|
+
...stateful === void 0 ? {} : { invokeStateful: (invocation) => require_compile.evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
|
|
457
457
|
...invocation,
|
|
458
458
|
path: `${stateful.callPathPrefix}@${invocation.path}`
|
|
459
459
|
}, stateful.expressionMemory, {
|
|
@@ -536,7 +536,7 @@ function evaluateCompositionField(input) {
|
|
|
536
536
|
};
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
require_device_type.DeviceType.Cover, require_device_type.DeviceType.Valve, require_device_type.DeviceType.Humidifier, require_device_type.DeviceType.WaterHeater, require_device_type.DeviceType.HeatPump, require_device_type.DeviceType.EnergySystem, require_device_type.DeviceType.Workload, require_device_type.DeviceType.Camera, require_device_type.DeviceType.Switch, require_device_type.DeviceType.Siren, require_device_type.DeviceType.Light, require_device_type.DeviceType.Fan, require_device_type.DeviceType.Sensor, require_device_type.DeviceType.Climate, require_device_type.DeviceType.Button, require_device_type.DeviceType.EventEmitter, require_device_type.DeviceType.Update, require_device_type.DeviceType.Generic, require_device_type.DeviceType.Notifier, require_device_type.DeviceType.Script, require_device_type.DeviceType.Automation, require_device_type.DeviceType.Lock, require_device_type.DeviceType.MediaPlayer, require_device_type.DeviceType.AlarmPanel, require_device_type.DeviceType.Control, require_device_type.DeviceType.Presence, require_device_type.DeviceType.Weather, require_device_type.DeviceType.WeatherStation, require_device_type.DeviceType.Vacuum, require_device_type.DeviceType.LawnMower, require_device_type.DeviceType.Container, require_device_type.DeviceType.Image, require_device_type.DeviceType.PetFeeder, require_device_type.DeviceType.PetFountain, require_device_type.DeviceType.Dishwasher, require_device_type.DeviceType.Washer, require_device_type.DeviceType.Dryer, require_device_type.DeviceType.Gateway;
|
|
539
|
+
require_device_type.DeviceType.Cover, require_device_type.DeviceType.Valve, require_device_type.DeviceType.Humidifier, require_device_type.DeviceType.WaterHeater, require_device_type.DeviceType.HeatPump, require_device_type.DeviceType.Vehicle, require_device_type.DeviceType.EnergySystem, require_device_type.DeviceType.Workload, require_device_type.DeviceType.Camera, require_device_type.DeviceType.Switch, require_device_type.DeviceType.Siren, require_device_type.DeviceType.Light, require_device_type.DeviceType.Fan, require_device_type.DeviceType.Sensor, require_device_type.DeviceType.Climate, require_device_type.DeviceType.Button, require_device_type.DeviceType.EventEmitter, require_device_type.DeviceType.Update, require_device_type.DeviceType.Generic, require_device_type.DeviceType.Notifier, require_device_type.DeviceType.Script, require_device_type.DeviceType.Automation, require_device_type.DeviceType.Lock, require_device_type.DeviceType.MediaPlayer, require_device_type.DeviceType.AlarmPanel, require_device_type.DeviceType.Control, require_device_type.DeviceType.Presence, require_device_type.DeviceType.Weather, require_device_type.DeviceType.WeatherStation, require_device_type.DeviceType.Vacuum, require_device_type.DeviceType.LawnMower, require_device_type.DeviceType.Container, require_device_type.DeviceType.Image, require_device_type.DeviceType.PetFeeder, require_device_type.DeviceType.PetFountain, require_device_type.DeviceType.Dishwasher, require_device_type.DeviceType.Washer, require_device_type.DeviceType.Dryer, require_device_type.DeviceType.Gateway;
|
|
540
540
|
/** True when a value is a navigable node: a plain object OR a tRPC v11 client
|
|
541
541
|
* proxy node (a callable `Proxy(noop)` → `typeof === 'function'`, NOT an
|
|
542
542
|
* object). A `typeof === 'object'`-only check REJECTS every real client proxy,
|
|
@@ -1263,7 +1263,7 @@ var ActuatorGroups = class {
|
|
|
1263
1263
|
async remember(block) {
|
|
1264
1264
|
const spec = block.helper;
|
|
1265
1265
|
if (spec === void 0 || spec.kind !== "group") return null;
|
|
1266
|
-
const template =
|
|
1266
|
+
const template = require_compile.groupTemplate(spec.templateId);
|
|
1267
1267
|
if (template === null || template.family !== "actuator") return null;
|
|
1268
1268
|
const templateId = actuatorTemplateId(template.id);
|
|
1269
1269
|
if (templateId === null) return null;
|
|
@@ -1274,7 +1274,7 @@ var ActuatorGroups = class {
|
|
|
1274
1274
|
const shared = capsOf(methods);
|
|
1275
1275
|
const previous = this.groups.get(block.id)?.shared;
|
|
1276
1276
|
if (previous !== void 0) this.logCapChange(templateId, device.id, previous, shared, viewed);
|
|
1277
|
-
const modes = templateId === "light" && shared.includes("color") ?
|
|
1277
|
+
const modes = templateId === "light" && shared.includes("color") ? require_compile.sharedColorModes(viewed.featureLists) : sharedActuatorFeatures(templateId, viewed.featureLists);
|
|
1278
1278
|
device.syncShared(shared, modes);
|
|
1279
1279
|
return {
|
|
1280
1280
|
blockId: block.id,
|
|
@@ -1409,7 +1409,7 @@ var ActuatorGroups = class {
|
|
|
1409
1409
|
});
|
|
1410
1410
|
throw new Error(refusal);
|
|
1411
1411
|
}
|
|
1412
|
-
const results = await
|
|
1412
|
+
const results = await require_compile.runFanOut(require_compile.fanOutTargets(group.fanOut, input.cap, input.method, memberArgs(input.args)), (call) => this.deps.invoke(call));
|
|
1413
1413
|
const failed = results.flatMap((result) => result.ok ? [] : [result]);
|
|
1414
1414
|
for (const result of failed) this.deps.logger.warn("actuator group command failed on a member — the others were still attempted", {
|
|
1415
1415
|
tags: { deviceId: result.deviceId },
|
|
@@ -1537,7 +1537,7 @@ var ComposedDeviceSet = class {
|
|
|
1537
1537
|
});
|
|
1538
1538
|
if (p.spec !== null) await this.deps.devices.applyDerivedSpec(device.id, p.spec);
|
|
1539
1539
|
await this.deps.devices.decommission(device.id);
|
|
1540
|
-
const stableId =
|
|
1540
|
+
const stableId = require_compile.composedDeviceStableId(p.block.id);
|
|
1541
1541
|
this.devices = new Map([...this.devices].filter(([s]) => s !== stableId));
|
|
1542
1542
|
this.declaredFingerprint = null;
|
|
1543
1543
|
} catch (err) {
|
|
@@ -1629,7 +1629,7 @@ function isRecord$2(value) {
|
|
|
1629
1629
|
/** The template with every `$input` replaced; an undefined replacement drops its key. */
|
|
1630
1630
|
function substitute(arg, input) {
|
|
1631
1631
|
if (typeof arg !== "object") return arg;
|
|
1632
|
-
if (
|
|
1632
|
+
if (require_compile.isForwardInputRef(arg)) return input[arg.$input];
|
|
1633
1633
|
return Object.fromEntries(Object.entries(arg).map(([key, value]) => [key, substitute(value, input)]).filter(([, value]) => value !== void 0));
|
|
1634
1634
|
}
|
|
1635
1635
|
/** The arguments a forward sends: the template, or the caller's input minus the device id. */
|
|
@@ -1700,7 +1700,7 @@ var ForwardCommands = class {
|
|
|
1700
1700
|
});
|
|
1701
1701
|
throw new ForwardRefusedError("no-command", `${input.cap}.${input.method}`, "the composition gives this method no command");
|
|
1702
1702
|
}
|
|
1703
|
-
const source =
|
|
1703
|
+
const source = require_compile.compositionSourceKey(command.source);
|
|
1704
1704
|
const sent = forwardArguments(command, this.callerInput(input));
|
|
1705
1705
|
const resolved = await this.resolveOrRefuse(input, command, source);
|
|
1706
1706
|
try {
|
|
@@ -1873,7 +1873,7 @@ function ungraftGoneTarget(input) {
|
|
|
1873
1873
|
tags: { deviceId },
|
|
1874
1874
|
meta: {
|
|
1875
1875
|
blockId: input.blockId,
|
|
1876
|
-
target:
|
|
1876
|
+
target: require_compile.compositionSourceKey(input.ref),
|
|
1877
1877
|
ungrafted: added,
|
|
1878
1878
|
graftHost: grafts !== void 0
|
|
1879
1879
|
}
|
|
@@ -1898,7 +1898,7 @@ var TargetDescriptions = class {
|
|
|
1898
1898
|
* null when there is none: the caller waits, and claims nothing.
|
|
1899
1899
|
*/
|
|
1900
1900
|
async describe(ref, deviceId, type, force) {
|
|
1901
|
-
const key =
|
|
1901
|
+
const key = require_compile.compositionSourceKey(ref);
|
|
1902
1902
|
const cached = this.cache.get(key);
|
|
1903
1903
|
const previous = cached !== void 0 && cached.deviceId === deviceId ? cached : null;
|
|
1904
1904
|
if (!force && previous !== null) return previous;
|
|
@@ -1936,8 +1936,8 @@ function addedCapsOf(features) {
|
|
|
1936
1936
|
return features.filter((f) => f.mode === "add").map((f) => f.cap);
|
|
1937
1937
|
}
|
|
1938
1938
|
function selfReadCaps(fields, target, features) {
|
|
1939
|
-
const targetKey =
|
|
1940
|
-
const read = new Set(fields.flatMap((f) => f.reads.filter((r) =>
|
|
1939
|
+
const targetKey = require_compile.compositionSourceKey(target);
|
|
1940
|
+
const read = new Set(fields.flatMap((f) => f.reads.filter((r) => require_compile.compositionSourceKey(r.source) === targetKey).map((r) => r.cap)));
|
|
1941
1941
|
const added = new Set(addedCapsOf(features));
|
|
1942
1942
|
return {
|
|
1943
1943
|
effective: [...read].filter((cap) => added.has(cap)),
|
|
@@ -1947,14 +1947,14 @@ function selfReadCaps(fields, target, features) {
|
|
|
1947
1947
|
/** The `degraded` reason (rule 8): one entry per released field, the source's own reason after the dash. */
|
|
1948
1948
|
function degradedReason(released) {
|
|
1949
1949
|
return released.map((r) => {
|
|
1950
|
-
const path = r.item === void 0 ? r.path :
|
|
1950
|
+
const path = r.item === void 0 ? r.path : require_compile.compositionItemFieldPath(r.item.arrayPath, r.item.key, r.path);
|
|
1951
1951
|
return `released to the native provider: ${r.cap}.${path} — ${r.reason}`;
|
|
1952
1952
|
}).join("; ");
|
|
1953
1953
|
}
|
|
1954
1954
|
/** The `starting` reason of a block with HELD fields: each keeps its last value and claim until its source answers (D49). */
|
|
1955
1955
|
function heldReason(held) {
|
|
1956
1956
|
return held.map((r) => {
|
|
1957
|
-
const path = r.item === void 0 ? r.path :
|
|
1957
|
+
const path = r.item === void 0 ? r.path : require_compile.compositionItemFieldPath(r.item.arrayPath, r.item.key, r.path);
|
|
1958
1958
|
return `held on its last value until its source answers: ${r.cap}.${path} — ${r.reason}`;
|
|
1959
1959
|
}).join("; ");
|
|
1960
1960
|
}
|
|
@@ -2042,7 +2042,7 @@ var ComposerGrafts = class {
|
|
|
2042
2042
|
if (ports === void 0) return;
|
|
2043
2043
|
const { deviceId } = input;
|
|
2044
2044
|
const added = input.enabled && input.settled ? addedCapsOf(input.features) : [];
|
|
2045
|
-
const nativeNow = new Set([...input.nativeCaps.entries()].filter(([, owner]) => owner !==
|
|
2045
|
+
const nativeNow = new Set([...input.nativeCaps.entries()].filter(([, owner]) => owner !== require_compile.COMPOSER_ADDON_ID).map(([cap]) => cap));
|
|
2046
2046
|
const replaced = new Set(input.features.filter((f) => f.mode === "replace").map((f) => f.cap));
|
|
2047
2047
|
for (const cap of ports.grafted(deviceId)) {
|
|
2048
2048
|
if (!nativeNow.has(cap) && !replaced.has(cap)) continue;
|
|
@@ -2166,10 +2166,10 @@ var RELEASE_SETTLED_CODES = new Set([
|
|
|
2166
2166
|
* twice).
|
|
2167
2167
|
*/
|
|
2168
2168
|
function operatorResetKeys(p) {
|
|
2169
|
-
const targetKey = p.target.kind === "existing" ?
|
|
2169
|
+
const targetKey = p.target.kind === "existing" ? require_compile.compositionSourceKey(p.target.ref) : null;
|
|
2170
2170
|
const keys = [];
|
|
2171
2171
|
for (const f of p.fields) for (const r of f.reads) {
|
|
2172
|
-
const key =
|
|
2172
|
+
const key = require_compile.compositionSourceKey(r.source);
|
|
2173
2173
|
if (key !== targetKey) keys.push(key);
|
|
2174
2174
|
}
|
|
2175
2175
|
return keys;
|
|
@@ -2182,7 +2182,7 @@ function trackedSourceRequests(live) {
|
|
|
2182
2182
|
const running = e.runtime !== null && e.planned.block.enabled;
|
|
2183
2183
|
let targetKey = null;
|
|
2184
2184
|
if (target.kind === "existing") {
|
|
2185
|
-
targetKey =
|
|
2185
|
+
targetKey = require_compile.compositionSourceKey(target.ref);
|
|
2186
2186
|
const self = running ? selfReadCaps(e.planned.fields, target.ref, target.features) : null;
|
|
2187
2187
|
requests.push({
|
|
2188
2188
|
ref: target.ref,
|
|
@@ -2192,7 +2192,7 @@ function trackedSourceRequests(live) {
|
|
|
2192
2192
|
});
|
|
2193
2193
|
}
|
|
2194
2194
|
if (!running) continue;
|
|
2195
|
-
for (const f of e.planned.fields) for (const r of f.reads) if (
|
|
2195
|
+
for (const f of e.planned.fields) for (const r of f.reads) if (require_compile.compositionSourceKey(r.source) !== targetKey) requests.push({
|
|
2196
2196
|
ref: r.source,
|
|
2197
2197
|
caps: [r.cap]
|
|
2198
2198
|
});
|
|
@@ -2277,7 +2277,7 @@ function planStillWantsClaim(planned, key) {
|
|
|
2277
2277
|
*/
|
|
2278
2278
|
function declarationFor(input) {
|
|
2279
2279
|
return {
|
|
2280
|
-
stableId:
|
|
2280
|
+
stableId: require_compile.composedDeviceStableId(input.blockId),
|
|
2281
2281
|
name: input.name,
|
|
2282
2282
|
type: input.target.type,
|
|
2283
2283
|
DeviceClass: input.hosted ? EngineHostedComposedDevice : composedDeviceClass(input.target.type, input.caps),
|
|
@@ -2408,7 +2408,7 @@ var NO_PLAN = {
|
|
|
2408
2408
|
* it (D49).
|
|
2409
2409
|
*/
|
|
2410
2410
|
function planUnreadable(block, rows) {
|
|
2411
|
-
const stableId =
|
|
2411
|
+
const stableId = require_compile.composedDeviceStableId(block.id);
|
|
2412
2412
|
const hasRow = rows.has(stableId);
|
|
2413
2413
|
return {
|
|
2414
2414
|
...NO_PLAN,
|
|
@@ -2430,7 +2430,7 @@ function planNew(block, target, lookupCap, rows) {
|
|
|
2430
2430
|
const plan = require_core_blocks_cap.planComposition(composition, lookupCap);
|
|
2431
2431
|
const planned = { kind: "new" };
|
|
2432
2432
|
if (plan.problems.length > 0) {
|
|
2433
|
-
const stableId =
|
|
2433
|
+
const stableId = require_compile.composedDeviceStableId(block.id);
|
|
2434
2434
|
const hasRow = rows.has(stableId);
|
|
2435
2435
|
return {
|
|
2436
2436
|
...NO_PLAN,
|
|
@@ -2442,11 +2442,11 @@ function planNew(block, target, lookupCap, rows) {
|
|
|
2442
2442
|
};
|
|
2443
2443
|
}
|
|
2444
2444
|
const caps = composition.features.flatMap((f) => {
|
|
2445
|
-
if (!
|
|
2445
|
+
if (!require_compile.compositionFeatureEnabled(f)) return [];
|
|
2446
2446
|
const def = lookupCap(f.cap);
|
|
2447
2447
|
return def === null ? [] : [def];
|
|
2448
2448
|
});
|
|
2449
|
-
const hosted = composition.helper !== void 0 &&
|
|
2449
|
+
const hosted = composition.helper !== void 0 && require_compile.isEngineHostedHelper(composition.helper);
|
|
2450
2450
|
const declarationInput = {
|
|
2451
2451
|
blockId: block.id,
|
|
2452
2452
|
name: block.name,
|
|
@@ -2476,7 +2476,7 @@ async function planExisting(input) {
|
|
|
2476
2476
|
block
|
|
2477
2477
|
};
|
|
2478
2478
|
const ref = input.target.device;
|
|
2479
|
-
const key =
|
|
2479
|
+
const key = require_compile.compositionSourceKey(ref);
|
|
2480
2480
|
const knownId = prior?.kind === "existing" ? prior.deviceId : null;
|
|
2481
2481
|
if (input.claimsWait !== null) return waitingPlan(block, ref, knownId, input.claimsWait);
|
|
2482
2482
|
const resolution = await input.tracker.resolve(ref, operatorAction);
|
|
@@ -2530,7 +2530,7 @@ function unboundNativeCaps(composition, lookupCap, description, plan) {
|
|
|
2530
2530
|
if (plan.problems.length === 0) return [];
|
|
2531
2531
|
const unbound = [...new Set(composition.features.flatMap((feature) => {
|
|
2532
2532
|
const def = lookupCap(feature.cap);
|
|
2533
|
-
return
|
|
2533
|
+
return require_compile.compositionFeatureEnabled(feature) && def !== null && require_core_blocks_cap.commandedMethods(def).length > 0 && !description.nativeCaps.has(feature.cap) ? [feature.cap] : [];
|
|
2534
2534
|
}))];
|
|
2535
2535
|
if (unbound.length === 0) return [];
|
|
2536
2536
|
return require_core_blocks_cap.planComposition(composition, lookupCap, {
|
|
@@ -2613,7 +2613,7 @@ function logPlanTransition(logger, previous, p, liveTags) {
|
|
|
2613
2613
|
...extras,
|
|
2614
2614
|
meta: {
|
|
2615
2615
|
...extras.meta,
|
|
2616
|
-
target:
|
|
2616
|
+
target: require_compile.compositionSourceKey(target.ref)
|
|
2617
2617
|
}
|
|
2618
2618
|
});
|
|
2619
2619
|
else if (target.kind === "existing" && target.waiting !== null) logger.warn("customization waits — nothing is claimed or released until it plans", {
|
|
@@ -2671,7 +2671,7 @@ function createFieldRecord(plan, byCap, lookupCap) {
|
|
|
2671
2671
|
initial,
|
|
2672
2672
|
hasWritten: false,
|
|
2673
2673
|
written: void 0,
|
|
2674
|
-
expressionMemory:
|
|
2674
|
+
expressionMemory: require_compile.createStatefulExpressionMemory(),
|
|
2675
2675
|
eventHighWater: typeof initial === "number" && Number.isFinite(initial) ? initial : null,
|
|
2676
2676
|
pulseHold: false
|
|
2677
2677
|
};
|
|
@@ -2708,7 +2708,7 @@ function topLevelField(plan) {
|
|
|
2708
2708
|
}
|
|
2709
2709
|
/** The field as a report or a log line names it: `items[desiccant].status` for an item leaf. */
|
|
2710
2710
|
function fieldPath(plan) {
|
|
2711
|
-
return plan.item === void 0 ? plan.path :
|
|
2711
|
+
return plan.item === void 0 ? plan.path : require_compile.compositionItemFieldPath(plan.item.arrayPath, plan.item.key, plan.path);
|
|
2712
2712
|
}
|
|
2713
2713
|
function itemOf(plan) {
|
|
2714
2714
|
return plan.item === void 0 ? {} : { item: plan.item };
|
|
@@ -2939,8 +2939,8 @@ function evaluateFields(host, keys, now, timerDriven = false) {
|
|
|
2939
2939
|
const record = next.get(key);
|
|
2940
2940
|
if (record === void 0) continue;
|
|
2941
2941
|
if (record.plan.source.kind === "series") continue;
|
|
2942
|
-
const candidateMemory =
|
|
2943
|
-
if (wasDown(record.outcome))
|
|
2942
|
+
const candidateMemory = require_compile.cloneStatefulExpressionMemory(record.expressionMemory);
|
|
2943
|
+
if (wasDown(record.outcome)) require_compile.disarmRoseMemory(candidateMemory);
|
|
2944
2944
|
const evaluatedOutcome = evaluateCompositionField({
|
|
2945
2945
|
source: record.plan.source,
|
|
2946
2946
|
read,
|
|
@@ -3057,7 +3057,7 @@ function setPath(record, segments, value) {
|
|
|
3057
3057
|
}
|
|
3058
3058
|
function itemArrayOf(group, lookupCap) {
|
|
3059
3059
|
const itemArray = lookupCap(group.cap)?.status?.itemArray;
|
|
3060
|
-
if (itemArray === void 0 || itemArray.path !== group.arrayPath) throw new Error(`\`${group.cap}\` has no item array at \`${group.arrayPath}\` — \`${
|
|
3060
|
+
if (itemArray === void 0 || itemArray.path !== group.arrayPath) throw new Error(`\`${group.cap}\` has no item array at \`${group.arrayPath}\` — \`${require_compile.compositionItemFieldPath(group.arrayPath, group.key, "*")}\` cannot be assembled`);
|
|
3061
3061
|
return itemArray;
|
|
3062
3062
|
}
|
|
3063
3063
|
function assembleItem(group, lookupCap) {
|
|
@@ -3257,7 +3257,7 @@ var CompositionRuntime = class {
|
|
|
3257
3257
|
onSourcesChanged(sliceKeys) {
|
|
3258
3258
|
if (this.disabledReason !== null) return;
|
|
3259
3259
|
this.guarded("source", true, () => {
|
|
3260
|
-
const affected = [...this.records.values()].filter((r) => r.plan.reads.some((read) => ownKeyOf(this.evaluation, read) === null && sliceKeys.has(
|
|
3260
|
+
const affected = [...this.records.values()].filter((r) => r.plan.reads.some((read) => ownKeyOf(this.evaluation, read) === null && sliceKeys.has(require_compile.compositionSliceKey(read.source, read.cap)))).map((r) => fieldKey(r.plan));
|
|
3261
3261
|
if (affected.length > 0) this.pass(affected, "source");
|
|
3262
3262
|
});
|
|
3263
3263
|
}
|
|
@@ -4091,9 +4091,9 @@ function writerFor(deps, p, device, onClaimEvent) {
|
|
|
4091
4091
|
}
|
|
4092
4092
|
function newCompositionRuntime(deps, p, target, seed, pulseSeeds) {
|
|
4093
4093
|
const self = p.target.kind === "existing" ? selfReadCaps(p.fields, p.target.ref, p.target.features) : null;
|
|
4094
|
-
const targetKey = p.target.kind === "existing" ?
|
|
4094
|
+
const targetKey = p.target.kind === "existing" ? require_compile.compositionSourceKey(p.target.ref) : null;
|
|
4095
4095
|
const nativeCaps = new Set(self?.native ?? []);
|
|
4096
|
-
const ownKey = targetKey ??
|
|
4096
|
+
const ownKey = targetKey ?? require_compile.compositionSourceKey(require_compile.composedDeviceRef(p.block.id));
|
|
4097
4097
|
return new CompositionRuntime({
|
|
4098
4098
|
blockId: p.block.id,
|
|
4099
4099
|
fields: p.fields,
|
|
@@ -4103,8 +4103,8 @@ function newCompositionRuntime(deps, p, target, seed, pulseSeeds) {
|
|
|
4103
4103
|
lookupCap: deps.lookupCap,
|
|
4104
4104
|
...seed === void 0 ? {} : { initialByCap: seed.byCap },
|
|
4105
4105
|
...pulseSeeds === void 0 ? {} : { pulseSeeds },
|
|
4106
|
-
read: (read) => deps.tracker.read(read,
|
|
4107
|
-
isOwnRead: (read) =>
|
|
4106
|
+
read: (read) => deps.tracker.read(read, require_compile.compositionSourceKey(read.source) === targetKey && nativeCaps.has(read.cap) ? "native" : "effective"),
|
|
4107
|
+
isOwnRead: (read) => require_compile.compositionSourceKey(read.source) === ownKey && !nativeCaps.has(read.cap),
|
|
4108
4108
|
now: deps.now,
|
|
4109
4109
|
timer: deps.newTimer(),
|
|
4110
4110
|
logger: deps.logger.child("runtime")
|
|
@@ -4357,7 +4357,7 @@ var HistoryHelpers = class {
|
|
|
4357
4357
|
for (const block of this.ports.blocks()) {
|
|
4358
4358
|
if (block.helper.kind === "integral" || block.helper.window.kind !== "rolling") continue;
|
|
4359
4359
|
if (this.ports.sourceDeviceId(block.helper.source.source) !== deviceId) continue;
|
|
4360
|
-
const next = Math.max(now, (this.lastRun.get(block.blockId) ?? 0) +
|
|
4360
|
+
const next = Math.max(now, (this.lastRun.get(block.blockId) ?? 0) + require_compile.statisticCadenceMs(block.helper.window));
|
|
4361
4361
|
if (due === null || next < due) due = next;
|
|
4362
4362
|
}
|
|
4363
4363
|
if (due !== null) this.ports.timer.arm(due, () => void this.pass());
|
|
@@ -4392,22 +4392,22 @@ var HistoryHelpers = class {
|
|
|
4392
4392
|
return await this.ports.retention();
|
|
4393
4393
|
} catch (err) {
|
|
4394
4394
|
this.ports.logger.warn("history retention could not be read — the defaults stand", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
4395
|
-
return
|
|
4395
|
+
return require_compile.DEFAULT_HISTORY_RETENTION;
|
|
4396
4396
|
}
|
|
4397
4397
|
}
|
|
4398
4398
|
async one(block, retention) {
|
|
4399
4399
|
const helper = block.helper;
|
|
4400
|
-
const kind =
|
|
4400
|
+
const kind = require_compile.declaredSeriesKind(helper.source);
|
|
4401
4401
|
if (kind === null || kind === "enum") {
|
|
4402
4402
|
this.note(block, `${helper.source.cap}.${helper.source.fieldPath} has no numeric history`);
|
|
4403
4403
|
return;
|
|
4404
4404
|
}
|
|
4405
|
-
const tierPlan = helper.kind === "integral" ?
|
|
4405
|
+
const tierPlan = helper.kind === "integral" ? require_compile.planResetTier(helper.reset, retention) : require_compile.planStatisticTier(helper.window, retention);
|
|
4406
4406
|
if (!tierPlan.ok) {
|
|
4407
4407
|
this.note(block, tierPlan.reason);
|
|
4408
4408
|
return;
|
|
4409
4409
|
}
|
|
4410
|
-
const range = helper.kind === "integral" ?
|
|
4410
|
+
const range = helper.kind === "integral" ? require_compile.openReset(helper.reset, this.ports.now(), this.ports.timeZone) : require_compile.openStatistic(helper.window, this.ports.now(), this.ports.timeZone);
|
|
4411
4411
|
if (range === null) {
|
|
4412
4412
|
this.note(block, `the hub timezone \`${this.ports.timeZone}\` is not a calendar`);
|
|
4413
4413
|
return;
|
|
@@ -4497,31 +4497,31 @@ var HistoryHelpers = class {
|
|
|
4497
4497
|
}
|
|
4498
4498
|
const now = this.ports.now();
|
|
4499
4499
|
let at = now + cadenceFloor(this.ports.blocks());
|
|
4500
|
-
const midnight =
|
|
4500
|
+
const midnight = require_compile.nextLocalMidnight(now, this.ports.timeZone);
|
|
4501
4501
|
if (midnight !== null && midnight < at) at = midnight;
|
|
4502
4502
|
this.ports.timer.arm(Math.max(at, now), () => void this.pass());
|
|
4503
4503
|
}
|
|
4504
4504
|
};
|
|
4505
4505
|
function answerOf(helper, read) {
|
|
4506
4506
|
switch (helper.kind) {
|
|
4507
|
-
case "statistic": return
|
|
4508
|
-
case "derivative": return
|
|
4509
|
-
case "integral": return
|
|
4507
|
+
case "statistic": return require_compile.evaluateStatistic(helper.stat, read);
|
|
4508
|
+
case "derivative": return require_compile.evaluateDerivative(read, PER_MS[helper.per]);
|
|
4509
|
+
case "integral": return require_compile.integrateReading(read, helper.output === "energy" ? "energy-kwh" : "per-second");
|
|
4510
4510
|
}
|
|
4511
4511
|
}
|
|
4512
4512
|
var PER_MS = {
|
|
4513
4513
|
second: 1e3,
|
|
4514
|
-
minute:
|
|
4515
|
-
hour:
|
|
4514
|
+
minute: require_compile.MINUTE_MS,
|
|
4515
|
+
hour: require_compile.HOUR_MS
|
|
4516
4516
|
};
|
|
4517
4517
|
/** A rate of a temperature is not a temperature: only a statistic and a meter keep the unit. */
|
|
4518
4518
|
function inheritsSourceQuantity(helper) {
|
|
4519
4519
|
return helper.kind === "statistic" || helper.kind === "integral" && helper.output === "meter";
|
|
4520
4520
|
}
|
|
4521
4521
|
function cadenceFloor(blocks) {
|
|
4522
|
-
let ms =
|
|
4522
|
+
let ms = require_compile.HISTORY_SLOW_MS;
|
|
4523
4523
|
for (const block of blocks) {
|
|
4524
|
-
const cadence = block.helper.kind === "integral" ? block.helper.reset === "daily" ?
|
|
4524
|
+
const cadence = block.helper.kind === "integral" ? block.helper.reset === "daily" ? require_compile.HISTORY_FAST_MS : require_compile.HISTORY_SLOW_MS : require_compile.statisticCadenceMs(block.helper.window);
|
|
4525
4525
|
if (cadence < ms) ms = cadence;
|
|
4526
4526
|
}
|
|
4527
4527
|
return ms;
|
|
@@ -4588,7 +4588,7 @@ function toPoint(point, tier, to, timeZone) {
|
|
|
4588
4588
|
};
|
|
4589
4589
|
}
|
|
4590
4590
|
function bucketMs(tier, t, to, timeZone) {
|
|
4591
|
-
const end = tier === "1d" ?
|
|
4591
|
+
const end = tier === "1d" ? require_compile.nextLocalMidnight(t, timeZone) : t + (tier === "5m" ? 5 * require_compile.MINUTE_MS : require_compile.HOUR_MS);
|
|
4592
4592
|
if (end === null) return 0;
|
|
4593
4593
|
return Math.max(0, Math.min(end, to) - t);
|
|
4594
4594
|
}
|
|
@@ -5161,7 +5161,7 @@ var Composer = class {
|
|
|
5161
5161
|
this.dispatch(await this.deps.tracker.onBindingsChanged(data.deviceId, data.capName, data.reason));
|
|
5162
5162
|
await this.chained(() => this.actuators?.onMemberBindings(data.deviceId));
|
|
5163
5163
|
await this.chained(() => this.replanWaitingOn(data.deviceId));
|
|
5164
|
-
await this.syncBoundFeatures([...this.live.keys()].filter((blockId) => this.composed.idOf(
|
|
5164
|
+
await this.syncBoundFeatures([...this.live.keys()].filter((blockId) => this.composed.idOf(require_compile.composedDeviceStableId(blockId)) === data.deviceId));
|
|
5165
5165
|
}
|
|
5166
5166
|
/**
|
|
5167
5167
|
* A composed device carries the features its BOUND caps stand for — the same
|
|
@@ -5172,7 +5172,7 @@ var Composer = class {
|
|
|
5172
5172
|
const read = this.deps.boundCapNames;
|
|
5173
5173
|
if (read === void 0) return;
|
|
5174
5174
|
for (const blockId of blockIds) {
|
|
5175
|
-
const device = this.composed.get(
|
|
5175
|
+
const device = this.composed.get(require_compile.composedDeviceStableId(blockId));
|
|
5176
5176
|
if (device === null || device.syncBoundFeatures === void 0) continue;
|
|
5177
5177
|
const caps = await read(device.id);
|
|
5178
5178
|
if (caps !== null) device.syncBoundFeatures(require_device_type.featuresOfBoundCaps(caps));
|
|
@@ -5193,7 +5193,7 @@ var Composer = class {
|
|
|
5193
5193
|
if (read === void 0) return;
|
|
5194
5194
|
for (const block of blocks) {
|
|
5195
5195
|
const served = block.features.some((feature) => Object.values(feature.commands ?? {}).some((target) => target.kind === "extension"));
|
|
5196
|
-
const device = this.composed.get(
|
|
5196
|
+
const device = this.composed.get(require_compile.composedDeviceStableId(block.id));
|
|
5197
5197
|
if (!served || device === null || !isActuatorGroupDevice(device)) continue;
|
|
5198
5198
|
const features = await read(device.id);
|
|
5199
5199
|
if (features !== null) device.syncShared([], features);
|
|
@@ -5206,7 +5206,7 @@ var Composer = class {
|
|
|
5206
5206
|
logger: deps.logger.child("forward"),
|
|
5207
5207
|
resolve: (ref) => deps.tracker.resolve(ref, true),
|
|
5208
5208
|
callCapMethod,
|
|
5209
|
-
deviceIdOf: (blockId) => this.composed.idOf(
|
|
5209
|
+
deviceIdOf: (blockId) => this.composed.idOf(require_compile.composedDeviceStableId(blockId))
|
|
5210
5210
|
});
|
|
5211
5211
|
}
|
|
5212
5212
|
/**
|
|
@@ -5230,7 +5230,7 @@ var Composer = class {
|
|
|
5230
5230
|
},
|
|
5231
5231
|
readMember: read,
|
|
5232
5232
|
deviceOf: (blockId) => {
|
|
5233
|
-
const device = this.composed.get(
|
|
5233
|
+
const device = this.composed.get(require_compile.composedDeviceStableId(blockId));
|
|
5234
5234
|
return device !== null && isActuatorGroupDevice(device) ? device : null;
|
|
5235
5235
|
},
|
|
5236
5236
|
invoke,
|
|
@@ -5261,7 +5261,7 @@ var Composer = class {
|
|
|
5261
5261
|
});
|
|
5262
5262
|
}
|
|
5263
5263
|
async adoptQuantityOf(blockId, quantity) {
|
|
5264
|
-
const device = this.composed.get(
|
|
5264
|
+
const device = this.composed.get(require_compile.composedDeviceStableId(blockId));
|
|
5265
5265
|
if (device?.adoptQuantity === void 0) throw new Error(`composed device for ${blockId} cannot store a quantity`);
|
|
5266
5266
|
await device.adoptQuantity(quantity);
|
|
5267
5267
|
}
|
|
@@ -5385,7 +5385,7 @@ var Composer = class {
|
|
|
5385
5385
|
});
|
|
5386
5386
|
continue;
|
|
5387
5387
|
}
|
|
5388
|
-
const device = p.target.kind === "existing" ? null : this.composed.get(
|
|
5388
|
+
const device = p.target.kind === "existing" ? null : this.composed.get(require_compile.composedDeviceStableId(p.block.id));
|
|
5389
5389
|
const appliedName = device === null ? null : p.block.name === null ? previous?.appliedName ?? device.name : await this.applyName(device, p.block.id, p.block.name, previous === void 0 ? null : {
|
|
5390
5390
|
appliedName: previous.appliedName,
|
|
5391
5391
|
blockName: previous.planned.block.name,
|
|
@@ -5487,7 +5487,7 @@ var Composer = class {
|
|
|
5487
5487
|
const held = new Set(declarations.map((d) => d.stableId));
|
|
5488
5488
|
for (const [blockId, entry] of this.live) {
|
|
5489
5489
|
if (next.has(blockId)) continue;
|
|
5490
|
-
if (held.has(
|
|
5490
|
+
if (held.has(require_compile.composedDeviceStableId(blockId))) next.set(blockId, entry);
|
|
5491
5491
|
else halt(entry.runtime);
|
|
5492
5492
|
}
|
|
5493
5493
|
this.live = next;
|
|
@@ -5714,7 +5714,7 @@ var Composer = class {
|
|
|
5714
5714
|
}
|
|
5715
5715
|
tagsOf(blockId) {
|
|
5716
5716
|
const entry = this.live.get(blockId);
|
|
5717
|
-
const deviceId = this.composed.idOf(
|
|
5717
|
+
const deviceId = this.composed.idOf(require_compile.composedDeviceStableId(blockId)) ?? (entry === void 0 ? null : this.deviceIdOf(entry));
|
|
5718
5718
|
return deviceId === null ? {} : { deviceId };
|
|
5719
5719
|
}
|
|
5720
5720
|
verdict(blockId) {
|
|
@@ -5729,7 +5729,7 @@ function historySpecsOf(blocks) {
|
|
|
5729
5729
|
const specs = /* @__PURE__ */ new Map();
|
|
5730
5730
|
for (const block of blocks) {
|
|
5731
5731
|
const helper = block.composition.helper;
|
|
5732
|
-
if (helper === void 0 || !
|
|
5732
|
+
if (helper === void 0 || !require_compile.isHistoryHelper(helper)) continue;
|
|
5733
5733
|
specs.set(block.id, helper);
|
|
5734
5734
|
}
|
|
5735
5735
|
return specs;
|
|
@@ -5746,7 +5746,7 @@ var unattachedInvoke = async () => {
|
|
|
5746
5746
|
function forwardBlocksOf(blocks) {
|
|
5747
5747
|
return blocks.flatMap((block) => {
|
|
5748
5748
|
if (!block.enabled || block.composition.target.kind !== "new") return [];
|
|
5749
|
-
const features = block.composition.features.flatMap((feature) => feature.kind === "fields" &&
|
|
5749
|
+
const features = block.composition.features.flatMap((feature) => feature.kind === "fields" && require_compile.compositionFeatureEnabled(feature) ? [feature] : []);
|
|
5750
5750
|
return [{
|
|
5751
5751
|
id: block.id,
|
|
5752
5752
|
features
|
|
@@ -6171,7 +6171,7 @@ var SourceTracker = class {
|
|
|
6171
6171
|
*/
|
|
6172
6172
|
resolve(ref, reset) {
|
|
6173
6173
|
return this.serialized(async () => {
|
|
6174
|
-
const k =
|
|
6174
|
+
const k = require_compile.compositionSourceKey(ref);
|
|
6175
6175
|
const prior = this.sources.get(k);
|
|
6176
6176
|
const before = reset ? void 0 : prior;
|
|
6177
6177
|
if (before !== void 0 && (before.deviceId !== null || before.missingReason !== null)) return resolutionOf(before);
|
|
@@ -6209,10 +6209,10 @@ var SourceTracker = class {
|
|
|
6209
6209
|
}
|
|
6210
6210
|
/** The last settled resolution of a ref; `unknown` when it was never resolved. Synchronous, from memory. */
|
|
6211
6211
|
resolution(ref) {
|
|
6212
|
-
const source = this.sources.get(
|
|
6212
|
+
const source = this.sources.get(require_compile.compositionSourceKey(ref));
|
|
6213
6213
|
return source === void 0 ? {
|
|
6214
6214
|
kind: "unknown",
|
|
6215
|
-
error: `source \`${
|
|
6215
|
+
error: `source \`${require_compile.compositionSourceKey(ref)}\` is not tracked`
|
|
6216
6216
|
} : resolutionOf(source);
|
|
6217
6217
|
}
|
|
6218
6218
|
onStateChanged(deviceId, capName, slice) {
|
|
@@ -6237,7 +6237,7 @@ var SourceTracker = class {
|
|
|
6237
6237
|
async syncNow(requests, reset) {
|
|
6238
6238
|
const merged = /* @__PURE__ */ new Map();
|
|
6239
6239
|
for (const request of requests) {
|
|
6240
|
-
const k =
|
|
6240
|
+
const k = require_compile.compositionSourceKey(request.ref);
|
|
6241
6241
|
const prior = merged.get(k);
|
|
6242
6242
|
merged.set(k, {
|
|
6243
6243
|
ref: request.ref,
|
|
@@ -6255,15 +6255,15 @@ var SourceTracker = class {
|
|
|
6255
6255
|
next.set(k, after);
|
|
6256
6256
|
for (const entry of entriesOf(request)) {
|
|
6257
6257
|
const key = entryKey(entry);
|
|
6258
|
-
if (before?.caps.get(key) !== after.caps.get(key) || before?.missingReason !== after.missingReason) changed.add(
|
|
6258
|
+
if (before?.caps.get(key) !== after.caps.get(key) || before?.missingReason !== after.missingReason) changed.add(require_compile.compositionSliceKey(request.ref, entry.cap));
|
|
6259
6259
|
}
|
|
6260
6260
|
}
|
|
6261
6261
|
this.sources = next;
|
|
6262
6262
|
return changed;
|
|
6263
6263
|
}
|
|
6264
6264
|
read(read, view = "effective") {
|
|
6265
|
-
const label = `${
|
|
6266
|
-
const tracked = this.sources.get(
|
|
6265
|
+
const label = `${require_compile.compositionSourceKey(read.source)} ${read.cap}.${read.fieldPath}`;
|
|
6266
|
+
const tracked = this.sources.get(require_compile.compositionSourceKey(read.source));
|
|
6267
6267
|
if (tracked === void 0) return {
|
|
6268
6268
|
state: "unavailable",
|
|
6269
6269
|
reason: `${label}: not tracked yet`,
|
|
@@ -6292,7 +6292,7 @@ var SourceTracker = class {
|
|
|
6292
6292
|
confirmed
|
|
6293
6293
|
};
|
|
6294
6294
|
}
|
|
6295
|
-
const value =
|
|
6295
|
+
const value = require_compile.toExpressionValue(valueAtPath(cap.slice, read.fieldPath));
|
|
6296
6296
|
if (value === void 0) return {
|
|
6297
6297
|
state: "unavailable",
|
|
6298
6298
|
reason: `${label}: the field is absent or not a scalar`,
|
|
@@ -6327,7 +6327,7 @@ var SourceTracker = class {
|
|
|
6327
6327
|
...updated,
|
|
6328
6328
|
online
|
|
6329
6329
|
};
|
|
6330
|
-
for (const key of source.caps.keys()) changed.add(
|
|
6330
|
+
for (const key of source.caps.keys()) changed.add(require_compile.compositionSliceKey(source.ref, entryOf(key).cap));
|
|
6331
6331
|
}
|
|
6332
6332
|
}
|
|
6333
6333
|
const views = source.nativeOwner !== null && this.held.shadowsNative(deviceId, capName, source.nativeOwner) ? ["effective"] : ["effective", "native"];
|
|
@@ -6347,7 +6347,7 @@ var SourceTracker = class {
|
|
|
6347
6347
|
staleReason: null
|
|
6348
6348
|
}]])
|
|
6349
6349
|
};
|
|
6350
|
-
changed.add(
|
|
6350
|
+
changed.add(require_compile.compositionSliceKey(source.ref, capName));
|
|
6351
6351
|
}
|
|
6352
6352
|
if (updated !== source) next.set(k, updated);
|
|
6353
6353
|
}
|
|
@@ -6374,7 +6374,7 @@ var SourceTracker = class {
|
|
|
6374
6374
|
staleReason: null
|
|
6375
6375
|
}]])
|
|
6376
6376
|
});
|
|
6377
|
-
changed.add(
|
|
6377
|
+
changed.add(require_compile.compositionSliceKey(source.ref, capName));
|
|
6378
6378
|
}
|
|
6379
6379
|
this.sources = next;
|
|
6380
6380
|
return changed;
|
|
@@ -6409,7 +6409,7 @@ var SourceTracker = class {
|
|
|
6409
6409
|
}
|
|
6410
6410
|
});
|
|
6411
6411
|
this.sources = new Map([...this.sources, [k, next]]);
|
|
6412
|
-
for (const key of source.caps.keys()) changed.add(
|
|
6412
|
+
for (const key of source.caps.keys()) changed.add(require_compile.compositionSliceKey(source.ref, entryOf(key).cap));
|
|
6413
6413
|
}
|
|
6414
6414
|
return changed;
|
|
6415
6415
|
}
|
|
@@ -6463,12 +6463,12 @@ var SourceTracker = class {
|
|
|
6463
6463
|
...updated,
|
|
6464
6464
|
online
|
|
6465
6465
|
};
|
|
6466
|
-
for (const key of source.caps.keys()) changed.add(
|
|
6466
|
+
for (const key of source.caps.keys()) changed.add(require_compile.compositionSliceKey(source.ref, entryOf(key).cap));
|
|
6467
6467
|
}
|
|
6468
6468
|
}
|
|
6469
6469
|
if (updated === source) continue;
|
|
6470
6470
|
this.sources = new Map([...this.sources, [k, updated]]);
|
|
6471
|
-
if (updated.caps !== source.caps) changed.add(
|
|
6471
|
+
if (updated.caps !== source.caps) changed.add(require_compile.compositionSliceKey(source.ref, capName));
|
|
6472
6472
|
}
|
|
6473
6473
|
return changed;
|
|
6474
6474
|
}
|
|
@@ -6502,7 +6502,7 @@ var SourceTracker = class {
|
|
|
6502
6502
|
nativeOwner
|
|
6503
6503
|
};
|
|
6504
6504
|
}
|
|
6505
|
-
const k =
|
|
6505
|
+
const k = require_compile.compositionSourceKey(request.ref);
|
|
6506
6506
|
const first = lists.get(request.ref.addonId) ?? await this.ports.listDevicesOf(request.ref.addonId);
|
|
6507
6507
|
lists.set(request.ref.addonId, first);
|
|
6508
6508
|
const resolution = await this.resolveConfirmed(request.ref, first);
|
|
@@ -6572,13 +6572,13 @@ var SourceTracker = class {
|
|
|
6572
6572
|
if (second.kind === "found") {
|
|
6573
6573
|
this.ports.logger.warn("composition source: the device index disagreed with itself — keeping the source", {
|
|
6574
6574
|
tags: { deviceId: second.deviceId },
|
|
6575
|
-
meta: { source:
|
|
6575
|
+
meta: { source: require_compile.compositionSourceKey(ref) }
|
|
6576
6576
|
});
|
|
6577
6577
|
return second;
|
|
6578
6578
|
}
|
|
6579
6579
|
return second.kind === "absent" ? {
|
|
6580
6580
|
kind: "missing",
|
|
6581
|
-
reason: `source \`${
|
|
6581
|
+
reason: `source \`${require_compile.compositionSourceKey(ref)}\` does not exist`
|
|
6582
6582
|
} : second;
|
|
6583
6583
|
}
|
|
6584
6584
|
/**
|
|
@@ -6667,7 +6667,7 @@ var SourceTracker = class {
|
|
|
6667
6667
|
...latest,
|
|
6668
6668
|
caps: new Map([...latest.caps, [key, reading]])
|
|
6669
6669
|
}]]);
|
|
6670
|
-
changed.add(
|
|
6670
|
+
changed.add(require_compile.compositionSliceKey(source.ref, cap));
|
|
6671
6671
|
}
|
|
6672
6672
|
return changed;
|
|
6673
6673
|
}
|
|
@@ -6794,10 +6794,10 @@ var ComposerAddon = class extends require_base_addon.BaseAddon {
|
|
|
6794
6794
|
},
|
|
6795
6795
|
readBoundCaps
|
|
6796
6796
|
});
|
|
6797
|
-
const listOwnDevices = async () => api.deviceManager.listAll.query({ addonId:
|
|
6797
|
+
const listOwnDevices = async () => api.deviceManager.listAll.query({ addonId: require_compile.COMPOSER_ADDON_ID });
|
|
6798
6798
|
const declared = new require_declared_device.DeclaredDevices({
|
|
6799
6799
|
logger: logger.child("declaration"),
|
|
6800
|
-
addonId:
|
|
6800
|
+
addonId: require_compile.COMPOSER_ADDON_ID,
|
|
6801
6801
|
devices: this.ctx.kernel.devices,
|
|
6802
6802
|
localNodeId: this.ctx.kernel.localNodeId,
|
|
6803
6803
|
getIntegration: async () => {
|
|
@@ -6889,7 +6889,7 @@ var ComposerAddon = class extends require_base_addon.BaseAddon {
|
|
|
6889
6889
|
maxPoints: input.maxPoints
|
|
6890
6890
|
}),
|
|
6891
6891
|
readHistoryRetention: async () => {
|
|
6892
|
-
return
|
|
6892
|
+
return require_compile.historyRetentionFromSettings(await api.addonSettingsRaw.getGlobal.query({ addonId: "device-history" }));
|
|
6893
6893
|
},
|
|
6894
6894
|
readSourceQuantity: async (deviceId) => {
|
|
6895
6895
|
const quantity = (await api.deviceManager.getDevice.query({ deviceId }))?.sourceInfo?.quantity;
|