@camstack/server 1.2.896 → 1.2.898
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 +12 -0
- package/package.json +17 -23
- package/system/dist/addon-runner.js +103 -12
- package/system/dist/addon-runner.mjs +103 -12
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/system/dist/builtins/alerts/alerts.addon.js +1 -1
- package/system/dist/builtins/alerts/alerts.addon.mjs +1 -1
- package/system/dist/builtins/autotrack/index.js +1 -1
- package/system/dist/builtins/autotrack/index.mjs +1 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/system/dist/builtins/calendars/calendars.addon.js +1 -1
- package/system/dist/builtins/calendars/calendars.addon.mjs +1 -1
- package/system/dist/builtins/camera-grid/index.js +1 -1
- package/system/dist/builtins/camera-grid/index.mjs +1 -1
- package/system/dist/builtins/composer/composer.addon.js +14 -11
- package/system/dist/builtins/composer/composer.addon.mjs +11 -8
- package/system/dist/builtins/console-logging/index.js +1 -1
- package/system/dist/builtins/console-logging/index.mjs +1 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +170 -14
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +169 -13
- package/system/dist/builtins/core-blocks/migrations/automation-confirmed-view.d.ts +23 -0
- package/system/dist/builtins/core-blocks/migrations/index.d.ts +1 -0
- package/system/dist/builtins/core-blocks/migrations/pump-cycle-split.d.ts +1 -0
- package/system/dist/builtins/device-history/device-history.addon.js +10 -9
- package/system/dist/builtins/device-history/device-history.addon.mjs +10 -9
- package/system/dist/builtins/device-manager/command-holds-wiring.d.ts +22 -0
- package/system/dist/builtins/device-manager/command-holds.d.ts +75 -0
- package/system/dist/builtins/device-manager/device-manager.addon.d.ts +2 -0
- package/system/dist/builtins/device-manager/device-manager.addon.js +383 -27
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +380 -28
- package/system/dist/builtins/device-manager/device-state-mirror.d.ts +35 -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 +4 -4
- package/system/dist/builtins/keychain/index.mjs +4 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +2 -2
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
- package/system/dist/builtins/local-network/local-network.addon.js +3 -3
- package/system/dist/builtins/local-network/local-network.addon.mjs +3 -3
- 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/shared/device-state-changed.d.ts +8 -0
- package/system/dist/builtins/snapshot/index.js +1 -1
- package/system/dist/builtins/snapshot/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +3 -3
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +3 -3
- package/system/dist/builtins/storage-orchestrator/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 +3 -3
- package/system/dist/builtins/system-config/system-config.addon.mjs +3 -3
- 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-BgIjQWh6.js → capture-engine-BWS0KTbm.js} +48 -1
- package/system/dist/{capture-engine-DPn6JaPc.mjs → capture-engine-DBQDaDxJ.mjs} +37 -2
- package/system/dist/{composition-sources-Bec_hQMM.js → composition-sources-CDOW1dnY.js} +1 -32
- package/system/dist/{composition-sources-B0rdPm85.mjs → composition-sources-CGUWmf-T.mjs} +2 -21
- package/system/dist/{constants-DsQsO8PD.mjs → constants-BmrLkwZs.mjs} +1 -1
- package/system/dist/{constants-CsYMak6g.js → constants-BwrRoq-j.js} +1 -1
- package/system/dist/{device-ca-BuDqRFZd.mjs → device-ca-BGgZXEto.mjs} +1 -1
- package/system/dist/{device-ca-BeK8EI_7.js → device-ca-DiuwWyZY.js} +1 -1
- package/system/dist/{dist-CHC8tlB1.js → dist-CCd8IeIU.js} +705 -54
- package/system/dist/{dist-DiknL6UU.mjs → dist-D7t8wLTF.mjs} +694 -55
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/{hub-identity-Dt-mbtkY.mjs → hub-identity-BohJeqdO.mjs} +1 -1
- package/system/dist/{hub-identity-BM26oLpK.js → hub-identity-G_ZdyPpc.js} +1 -1
- package/system/dist/{hub-mdns-ciao-BDgSHCPM.js → hub-mdns-ciao-CKD4EgkG.js} +2 -2
- package/system/dist/{hub-mdns-ciao-CHq7b1FX.mjs → hub-mdns-ciao-D5RxSMrH.mjs} +2 -2
- package/system/dist/index.js +45 -13
- package/system/dist/index.mjs +46 -14
- package/system/dist/kernel/command-hold-overrides.d.ts +42 -0
- package/system/dist/kernel/moleculer/child-cap-descriptors.d.ts +3 -0
- package/system/dist/kernel/moleculer/device-cap-proxy.d.ts +2 -1
- package/system/dist/kernel/transport/child-cap-protocol.d.ts +6 -1
- package/system/dist/{legacy-integration-rows-door-BYJa0xPI.js → legacy-integration-rows-door-BgCl68ek.js} +1 -1
- package/system/dist/{legacy-integration-rows-door-1WauJNCy.mjs → legacy-integration-rows-door-Rm9JmIsl.mjs} +1 -1
- package/system/dist/{rename-composition-block-fMaUic9d.js → rename-composition-block-2Z2ED7Og.js} +1 -1
- package/system/dist/{rename-composition-block-BOoAElGp.mjs → rename-composition-block-DNO3mNEO.mjs} +1 -1
- package/system/dist/{restore-archive-DNLe1z5A.mjs → restore-archive-2L5TymvF.mjs} +1 -1
- package/system/dist/{restore-archive-CeZV08vh.js → restore-archive-CZkQO8t3.js} +1 -1
- package/system/dist/{wal-maintenance-CekT_qH6.mjs → wal-maintenance-BMYe_n18.mjs} +0 -0
- package/system/dist/{wal-maintenance-CmCCUKZO.js → wal-maintenance-YjDJ73Qd.js} +0 -0
- package/system/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
1
|
+
import { $r as evaluateCompositionField, $s as evaluateStatistic, As as COMPOSER_ADDON_ID, Bo as sharedActuatorFeatures, C as COMPOSED_ITEM_FIXED_FIELDS, Eo as runFanOut, Er as coverCapability, Et as HvacModeSchema, Fa as petFountainWaterItem, Fs as HISTORY_SLOW_MS, Gs as composedDeviceStableId, Ho as sharedColorModes, Is as HOUR_MS, Jn as buildCapabilityLookup, Js as compositionSliceKey, Jt as PetFountainStatusSchema, Ka as processTimeZoneOr, Kn as brightnessCapability, Ks as compositionFeatureEnabled, La as planComposition, Ma as parseColorInput, Mr as declaredSeriesKind, Nl as isReadingQuantity, Ns as DEFAULT_HISTORY_RETENTION, Pa as petFountainCapability, Ps as HISTORY_FAST_MS, Qs as evaluateDerivative, Rs as MINUTE_MS, Ts as withDefaultRunning, Us as cloneStatefulExpressionMemory, Vo as sharedActuatorMethods, Ws as composedDeviceRef, Xs as createStatefulExpressionMemory, Ys as compositionSourceKey, Zs as disarmRoseMemory, _r as compositionFieldKey, _u as EventCategory, ac as isForwardInputRef, ba as motionCapability, bi as groupCommandsCapability, bo as resolveMutate, br as consumablesCapability, bs as valveCapability, bt as GroupCommandResultSchema, cc as openReset, ci as fanControlCapability, da as mediaPlayerCapability, dc as planStatisticTier, di as featureForwards, fa as mediaPlayerFeaturesOfRoles, fc as statisticCadenceMs, fl as createEvent, fr as colorCapability, gr as composerCapability, gt as FanDirectionSchema, gu as featuresOfBoundCaps, ha as methodRefusal, hc as BaseAddon, hu as errMsg, i as ACTUATOR_TEMPLATE_IDS, ic as isEngineHostedHelper, ii as expressionContainsBuiltinCall, is as switchCapability, j as ConsumableItemSchema, lc as openStatistic, li as fanOutTargets, lr as climateControlCapability, mu as DeviceType, oc as isHistoryHelper, pc as toExpressionValue, qi as kebabToCamel, qs as compositionItemFieldPath, r as ACTUATOR_METHODS, ra as lockControlCapability, rc as integrateReading, s as ALL_CAPABILITY_DEFINITIONS, sc as nextLocalMidnight, tc as historyRetentionFromSettings, tt as DeclaredDevices, uc as planResetTier, v as BaseDevice, xi as groupTemplate } from "../../dist-D7t8wLTF.mjs";
|
|
2
|
+
import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$4 } from "../../capture-engine-DBQDaDxJ.mjs";
|
|
3
|
+
import { n as normalizedNativeOwner } from "../../composition-sources-CGUWmf-T.mjs";
|
|
4
4
|
import { i as DAY_MS, t as DEFAULT_RETENTION } from "../../retention-CUOVI1p7.mjs";
|
|
5
|
-
import { n as renameCompositionBlock } from "../../rename-composition-block-
|
|
5
|
+
import { n as renameCompositionBlock } from "../../rename-composition-block-DNO3mNEO.mjs";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
//#region src/builtins/composer/actuator-invoke.ts
|
|
8
8
|
/**
|
|
@@ -6138,7 +6138,8 @@ var ComposerAddon = class extends BaseAddon {
|
|
|
6138
6138
|
capName
|
|
6139
6139
|
}) : await api.deviceState.getCapSlice.query({
|
|
6140
6140
|
deviceId,
|
|
6141
|
-
capName
|
|
6141
|
+
capName,
|
|
6142
|
+
confirmed: true
|
|
6142
6143
|
});
|
|
6143
6144
|
return slice === null || slice === void 0 ? { kind: "none" } : {
|
|
6144
6145
|
kind: "slice",
|
|
@@ -6177,7 +6178,8 @@ var ComposerAddon = class extends BaseAddon {
|
|
|
6177
6178
|
logger: logger.child("graft")
|
|
6178
6179
|
}, lookupCap, async (deviceId, capName) => await api.deviceState.getCapSlice.query({
|
|
6179
6180
|
deviceId,
|
|
6180
|
-
capName
|
|
6181
|
+
capName,
|
|
6182
|
+
confirmed: true
|
|
6181
6183
|
}) ?? null);
|
|
6182
6184
|
this.composer = new Composer({
|
|
6183
6185
|
logger: logger.child("composer"),
|
|
@@ -6215,7 +6217,8 @@ var ComposerAddon = class extends BaseAddon {
|
|
|
6215
6217
|
events: this.ctx.eventBus,
|
|
6216
6218
|
readExistingTargetCap: async (deviceId, capName) => await api.deviceState.getCapSlice.query({
|
|
6217
6219
|
deviceId,
|
|
6218
|
-
capName
|
|
6220
|
+
capName,
|
|
6221
|
+
confirmed: true
|
|
6219
6222
|
}) ?? null,
|
|
6220
6223
|
readPulseHistory: async (deviceId, cap, fieldPath, fromMs, toMs) => {
|
|
6221
6224
|
try {
|
|
@@ -6436,7 +6439,7 @@ var ComposerAddon = class extends BaseAddon {
|
|
|
6436
6439
|
}, call)
|
|
6437
6440
|
});
|
|
6438
6441
|
this.subscribe({ category: EventCategory.DeviceStateChanged }, (event) => {
|
|
6439
|
-
const data =
|
|
6442
|
+
const data = parseConfirmedStateChanged(event.data);
|
|
6440
6443
|
if (data !== null) this.composer?.onStateChanged(data).catch((err) => {
|
|
6441
6444
|
this.logEventFailure("device.state-changed", data.deviceId, err);
|
|
6442
6445
|
});
|
|
@@ -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-CCd8IeIU.js");
|
|
7
7
|
const require_formatter = require("../../formatter-xbxeV4GD.js");
|
|
8
8
|
//#region src/builtins/console-logging/console-destination.ts
|
|
9
9
|
var LEVEL_RANK = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { aa as logDestinationCapability, hc as BaseAddon } from "../../dist-D7t8wLTF.mjs";
|
|
2
2
|
import { t as formatLogLine } from "../../formatter-DkYZ4LXp.mjs";
|
|
3
3
|
//#region src/builtins/console-logging/console-destination.ts
|
|
4
4
|
var LEVEL_RANK = {
|
|
@@ -1,9 +1,9 @@
|
|
|
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-CCd8IeIU.js");
|
|
4
4
|
const require_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
5
|
+
const require_capture_engine = require("../../capture-engine-BWS0KTbm.js");
|
|
6
|
+
const require_composition_sources = require("../../composition-sources-CDOW1dnY.js");
|
|
7
7
|
const require_prefix_range = require("../../prefix-range-D_KueXbQ.js");
|
|
8
8
|
const require_prefix_walk = require("../../prefix-walk-Dv6MLZlM.js");
|
|
9
9
|
const require_cap_call_scope = require("../../cap-call-scope-8eiugfLl.js");
|
|
@@ -1905,6 +1905,137 @@ var CoreBlockStore = class CoreBlockStore {
|
|
|
1905
1905
|
}
|
|
1906
1906
|
};
|
|
1907
1907
|
//#endregion
|
|
1908
|
+
//#region src/builtins/core-blocks/migrations/automation-confirmed-view.ts
|
|
1909
|
+
/**
|
|
1910
|
+
* Stored generated automations move to the CONFIRMED view (D1061).
|
|
1911
|
+
*
|
|
1912
|
+
* An automation generated before D1061 read a device's slice in the effective
|
|
1913
|
+
* view: a command the hub still holds read as already done, so a condition on
|
|
1914
|
+
* it could pass before the device acted. The generator now asks for the
|
|
1915
|
+
* device's word. This regenerates each stored automation from the recipe its
|
|
1916
|
+
* code embeds (`AUTOMATION_RECIPE`), exactly as saving it in the editor would.
|
|
1917
|
+
*
|
|
1918
|
+
* Only code that is still what the generator writes is regenerated: its body
|
|
1919
|
+
* (the recipe literal blanked, as `instanceCodeHash` reads it) must equal what
|
|
1920
|
+
* the generator wrote before D1061 for that same recipe. Code edited by hand,
|
|
1921
|
+
* or written by a generator older than the one before D1061, is left exactly
|
|
1922
|
+
* as it is and logged per automation: regenerating it would lose what it does
|
|
1923
|
+
* differently. A hand-written script (no recipe) is not an automation here.
|
|
1924
|
+
* A rerun finds every regenerated automation already current and edits nothing.
|
|
1925
|
+
*/
|
|
1926
|
+
var AUTOMATION_CONFIRMED_VIEW_ID = "core-blocks/2026-11-17-automation-confirmed-view";
|
|
1927
|
+
/** What D1061 changed in the generated code: [before, after]. */
|
|
1928
|
+
var D1061_EDITS = [["ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap })", "ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true })"], [" mirror.apply(deviceId, capName, data['slice'])\n guardMirror.apply(deviceId, capName, data['slice'])", " // what the device reported: a held command is never a condition (D1061)\n const slice = data['confirmed'] ?? data['slice']\n mirror.apply(deviceId, capName, slice)\n guardMirror.apply(deviceId, capName, slice)"]];
|
|
1929
|
+
/** The code the generator wrote for the same recipe before D1061. */
|
|
1930
|
+
function beforeConfirmedView(current) {
|
|
1931
|
+
return D1061_EDITS.reduce((code, [before, after]) => code.split(after).join(before), current);
|
|
1932
|
+
}
|
|
1933
|
+
function verdictOf(block) {
|
|
1934
|
+
const read = require_dist.readRecipeLiteral(block.code);
|
|
1935
|
+
if (read.status === "none") return { kind: "skip" };
|
|
1936
|
+
if (read.status === "invalid") return {
|
|
1937
|
+
kind: "leave",
|
|
1938
|
+
reason: `its recipe does not read: ${read.detail}`
|
|
1939
|
+
};
|
|
1940
|
+
const fresh = require_dist.generateAutomationBlock({
|
|
1941
|
+
name: block.name,
|
|
1942
|
+
recipe: read.recipe
|
|
1943
|
+
});
|
|
1944
|
+
const stored = require_dist.instanceCodeHash(block.code);
|
|
1945
|
+
if (stored === require_dist.instanceCodeHash(fresh)) return { kind: "skip" };
|
|
1946
|
+
if (stored !== require_dist.instanceCodeHash(beforeConfirmedView(fresh))) return {
|
|
1947
|
+
kind: "leave",
|
|
1948
|
+
reason: "the code is not what its recipe generates (edited by hand, or written by an older version); saving it in the editor moves it"
|
|
1949
|
+
};
|
|
1950
|
+
return {
|
|
1951
|
+
kind: "regenerate",
|
|
1952
|
+
code: fresh
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
/** The block with its code (and, multi-file, its entry file) replaced. */
|
|
1956
|
+
function withCode(block, code, updatedAt) {
|
|
1957
|
+
if (block.files === void 0) return {
|
|
1958
|
+
...block,
|
|
1959
|
+
code,
|
|
1960
|
+
updatedAt
|
|
1961
|
+
};
|
|
1962
|
+
const entry = require_dist.resolveCoreBlockEntry(block.entry);
|
|
1963
|
+
return {
|
|
1964
|
+
...block,
|
|
1965
|
+
code,
|
|
1966
|
+
files: {
|
|
1967
|
+
...block.files,
|
|
1968
|
+
[entry]: code
|
|
1969
|
+
},
|
|
1970
|
+
updatedAt
|
|
1971
|
+
};
|
|
1972
|
+
}
|
|
1973
|
+
function rewriteOf$3(row, ports) {
|
|
1974
|
+
const parsed = require_dist.CoreBlockSchema.safeParse(row.data.block);
|
|
1975
|
+
if (!parsed.success) return null;
|
|
1976
|
+
const block = parsed.data;
|
|
1977
|
+
const verdict = verdictOf(block);
|
|
1978
|
+
if (verdict.kind === "skip") return null;
|
|
1979
|
+
if (verdict.kind === "leave") {
|
|
1980
|
+
ports.warn("automation left as it was: not moved to the confirmed view", {
|
|
1981
|
+
blockId: row.id,
|
|
1982
|
+
name: block.name,
|
|
1983
|
+
reason: verdict.reason
|
|
1984
|
+
});
|
|
1985
|
+
return null;
|
|
1986
|
+
}
|
|
1987
|
+
const updatedAt = Math.max(block.updatedAt + 1, ports.now());
|
|
1988
|
+
const next = require_dist.CoreBlockSchema.safeParse(withCode(block, verdict.code, updatedAt));
|
|
1989
|
+
if (!next.success) {
|
|
1990
|
+
ports.warn("automation left as it was: the regenerated block does not validate", {
|
|
1991
|
+
blockId: row.id,
|
|
1992
|
+
name: block.name,
|
|
1993
|
+
reason: next.error.message
|
|
1994
|
+
});
|
|
1995
|
+
return null;
|
|
1996
|
+
}
|
|
1997
|
+
return {
|
|
1998
|
+
row,
|
|
1999
|
+
data: {
|
|
2000
|
+
...row.data,
|
|
2001
|
+
updatedAt,
|
|
2002
|
+
block: next.data
|
|
2003
|
+
}
|
|
2004
|
+
};
|
|
2005
|
+
}
|
|
2006
|
+
async function regenerateAutomationsConfirmedView(ports) {
|
|
2007
|
+
const rewrites = (await ports.listBlockRows()).flatMap((row) => {
|
|
2008
|
+
const rewrite = rewriteOf$3(row, ports);
|
|
2009
|
+
return rewrite === null ? [] : [rewrite];
|
|
2010
|
+
});
|
|
2011
|
+
if (rewrites.length === 0) return {
|
|
2012
|
+
outcome: "already-done",
|
|
2013
|
+
summary: { automations: 0 }
|
|
2014
|
+
};
|
|
2015
|
+
let regenerated = 0;
|
|
2016
|
+
for (const { row, data } of rewrites) {
|
|
2017
|
+
try {
|
|
2018
|
+
await ports.replaceBlockRow(row.id, data, row.rev);
|
|
2019
|
+
} catch (error) {
|
|
2020
|
+
ports.warn("automation left as it was: the regenerated code could not be saved", {
|
|
2021
|
+
blockId: row.id,
|
|
2022
|
+
name: data.name,
|
|
2023
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
2024
|
+
});
|
|
2025
|
+
continue;
|
|
2026
|
+
}
|
|
2027
|
+
regenerated += 1;
|
|
2028
|
+
ports.info("automation regenerated: it reads the confirmed view (D1061)", {
|
|
2029
|
+
blockId: row.id,
|
|
2030
|
+
name: data.name
|
|
2031
|
+
});
|
|
2032
|
+
}
|
|
2033
|
+
return {
|
|
2034
|
+
outcome: "done",
|
|
2035
|
+
summary: { automations: regenerated }
|
|
2036
|
+
};
|
|
2037
|
+
}
|
|
2038
|
+
//#endregion
|
|
1908
2039
|
//#region src/builtins/core-blocks/migrations/fountain-drink-drop.ts
|
|
1909
2040
|
/**
|
|
1910
2041
|
* The drink counters leave the `pet-fountain` feature of a stored composition.
|
|
@@ -2352,6 +2483,9 @@ function coreBlocksMigrationPorts(blocks, logger, now) {
|
|
|
2352
2483
|
}, { ifRev });
|
|
2353
2484
|
},
|
|
2354
2485
|
now,
|
|
2486
|
+
info: (message, meta) => {
|
|
2487
|
+
logger.info(message, { meta });
|
|
2488
|
+
},
|
|
2355
2489
|
warn: (message, meta) => {
|
|
2356
2490
|
logger.warn(message, { meta });
|
|
2357
2491
|
}
|
|
@@ -2835,6 +2969,22 @@ var ADDON_MIGRATIONS = [
|
|
|
2835
2969
|
fixtureMark: "the binding action of each lettered key and the label of each layout button"
|
|
2836
2970
|
},
|
|
2837
2971
|
procedure: renameRemoteColourRoles
|
|
2972
|
+
},
|
|
2973
|
+
{
|
|
2974
|
+
meta: {
|
|
2975
|
+
id: AUTOMATION_CONFIRMED_VIEW_ID,
|
|
2976
|
+
owner: "core-blocks",
|
|
2977
|
+
level: "addon-state",
|
|
2978
|
+
seq: 6,
|
|
2979
|
+
dependsOn: [],
|
|
2980
|
+
store: "settings",
|
|
2981
|
+
scope: "cluster",
|
|
2982
|
+
onFailure: "tolerate",
|
|
2983
|
+
bodyKind: "procedure",
|
|
2984
|
+
description: "Regenerate each stored generated automation from its embedded recipe so it reads what the device reported, never a command the hub still holds; code edited by hand is left as it is and logged",
|
|
2985
|
+
fixtureMark: "the block createdBy and name, which the migration does not know"
|
|
2986
|
+
},
|
|
2987
|
+
procedure: regenerateAutomationsConfirmedView
|
|
2838
2988
|
}
|
|
2839
2989
|
];
|
|
2840
2990
|
//#endregion
|
|
@@ -2906,7 +3056,8 @@ function conditionDoorOver(api) {
|
|
|
2906
3056
|
return require_dist.evaluateStepCondition(when, {
|
|
2907
3057
|
fetchSlice: (deviceId, cap) => current.deviceState.getCapSlice.query({
|
|
2908
3058
|
deviceId,
|
|
2909
|
-
capName: cap
|
|
3059
|
+
capName: cap,
|
|
3060
|
+
confirmed: true
|
|
2910
3061
|
}),
|
|
2911
3062
|
fetchStableIds: async () => require_dist.stableIdMapOf(await current.deviceManager.listAll.query({}))
|
|
2912
3063
|
}, () => Date.now(), void 0, site);
|
|
@@ -6182,7 +6333,8 @@ function hostOver(api) {
|
|
|
6182
6333
|
readSite: async () => need().system.getSiteLocation.query(),
|
|
6183
6334
|
fetchSlice: (deviceId, cap) => need().deviceState.getCapSlice.query({
|
|
6184
6335
|
deviceId,
|
|
6185
|
-
capName: cap
|
|
6336
|
+
capName: cap,
|
|
6337
|
+
confirmed: true
|
|
6186
6338
|
}),
|
|
6187
6339
|
fetchStableIds: async () => {
|
|
6188
6340
|
return require_dist.stableIdMapOf(await need().deviceManager.listAll.query({ projection: "slim" }));
|
|
@@ -6221,7 +6373,7 @@ function buildSchedulersRuntime(deps) {
|
|
|
6221
6373
|
logger: deps.logger.child("schedulers")
|
|
6222
6374
|
});
|
|
6223
6375
|
const unsubscribers = [...require_dist.ACTION_TARGET_INVALIDATION_EVENTS.map((category) => deps.eventBus.subscribe({ category }, () => engine.invalidateTargets())), deps.eventBus.subscribe({ category: require_dist.EventCategory.DeviceStateChanged }, (event) => {
|
|
6224
|
-
const data =
|
|
6376
|
+
const data = require_capture_engine.parseConfirmedStateChanged(event.data);
|
|
6225
6377
|
if (data !== null) engine.onDeviceState(data.deviceId, data.capName, data.slice);
|
|
6226
6378
|
})];
|
|
6227
6379
|
return {
|
|
@@ -7923,7 +8075,8 @@ function remoteSliceWriterOver(settings, api) {
|
|
|
7923
8075
|
if (current === void 0) throw new Error("no ctx.api on this node");
|
|
7924
8076
|
const kept = require_dist.MediaPlayerStatusSchema.safeParse(await current.deviceState.getCapSlice.query({
|
|
7925
8077
|
deviceId,
|
|
7926
|
-
capName: MEDIA_PLAYER_CAP
|
|
8078
|
+
capName: MEDIA_PLAYER_CAP,
|
|
8079
|
+
confirmed: true
|
|
7927
8080
|
}));
|
|
7928
8081
|
if (kept.success && sameStatus(kept.data, status)) return;
|
|
7929
8082
|
await current.deviceState.setCapSlice.mutate({
|
|
@@ -9955,7 +10108,7 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
9955
10108
|
});
|
|
9956
10109
|
this.timedRun = timedRun;
|
|
9957
10110
|
this.subscribe({ category: require_dist.EventCategory.DeviceStateChanged }, (event) => {
|
|
9958
|
-
const data =
|
|
10111
|
+
const data = require_capture_engine.parseConfirmedStateChanged(event.data);
|
|
9959
10112
|
if (data !== null) timedRun.onDeviceState(data);
|
|
9960
10113
|
});
|
|
9961
10114
|
armTimedRuns(timedRun, this.ctx.logger.child("timed-run"), { isDisposed: () => this.disposed });
|
|
@@ -10060,7 +10213,8 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
10060
10213
|
caps: async (deviceId) => (await requireApi().deviceManager.getBindings.query({ deviceId })).entries.map((e) => e.capName),
|
|
10061
10214
|
slice: (deviceId, capName) => requireApi().deviceState.getCapSlice.query({
|
|
10062
10215
|
deviceId,
|
|
10063
|
-
capName
|
|
10216
|
+
capName,
|
|
10217
|
+
confirmed: true
|
|
10064
10218
|
}),
|
|
10065
10219
|
remoteCommands: async (deviceId) => (await requireApi().remote.listCommands.query({ deviceId })).commands.length,
|
|
10066
10220
|
switchOptions: (deviceId) => switchOptionsOf(requireApi(), deviceId),
|
|
@@ -10143,7 +10297,7 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
10143
10297
|
logger: this.ctx.logger.child("lock-door")
|
|
10144
10298
|
});
|
|
10145
10299
|
this.subscribe({ category: require_dist.EventCategory.DeviceStateChanged }, (event) => {
|
|
10146
|
-
const data =
|
|
10300
|
+
const data = require_capture_engine.parseConfirmedStateChanged(event.data);
|
|
10147
10301
|
if (data !== null) gate.onStateChanged(data);
|
|
10148
10302
|
});
|
|
10149
10303
|
this.seedLockDoorGate = () => this.seedGate(gate);
|
|
@@ -10172,7 +10326,8 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
10172
10326
|
readControl: async (deviceId) => {
|
|
10173
10327
|
const slice = await requireApi().deviceState.getCapSlice.query({
|
|
10174
10328
|
deviceId,
|
|
10175
|
-
capName: "control"
|
|
10329
|
+
capName: "control",
|
|
10330
|
+
confirmed: true
|
|
10176
10331
|
});
|
|
10177
10332
|
if (slice === null) return null;
|
|
10178
10333
|
const kind = slice["kind"];
|
|
@@ -10213,11 +10368,11 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
10213
10368
|
if (remote === void 0) return;
|
|
10214
10369
|
seedRemoteSlices(remote, this.ctx.logger.child("remote"));
|
|
10215
10370
|
this.subscribe({ category: require_dist.EventCategory.DeviceRegistered }, (event) => {
|
|
10216
|
-
const deviceId =
|
|
10371
|
+
const deviceId = require_capture_engine.isRecord(event.data) ? event.data["deviceId"] : void 0;
|
|
10217
10372
|
if (typeof deviceId === "number") remote.refreshSlice(deviceId);
|
|
10218
10373
|
});
|
|
10219
10374
|
this.subscribe({ category: require_dist.EventCategory.DeviceStateChanged }, (event) => {
|
|
10220
|
-
const data =
|
|
10375
|
+
const data = require_capture_engine.parseConfirmedStateChanged(event.data);
|
|
10221
10376
|
if (data !== null && REMOTE_SLICE_INPUT_CAPS.has(data.capName)) remote.onInputChanged(data.deviceId);
|
|
10222
10377
|
});
|
|
10223
10378
|
}
|
|
@@ -10653,7 +10808,8 @@ var CoreBlocksAddon = class extends require_dist.BaseAddon {
|
|
|
10653
10808
|
readField: async (deviceId, cap, fieldPath) => {
|
|
10654
10809
|
const slice = await requireApi().deviceState.getCapSlice.query({
|
|
10655
10810
|
deviceId,
|
|
10656
|
-
capName: cap
|
|
10811
|
+
capName: cap,
|
|
10812
|
+
confirmed: true
|
|
10657
10813
|
});
|
|
10658
10814
|
return slice === null ? void 0 : slice[fieldPath];
|
|
10659
10815
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $
|
|
1
|
+
import { $n as builtinAutomationTemplate, $t as QuantityUnitError, A as ConditionMirror, An as actionSourceCapability, As as COMPOSER_ADDON_ID, Ba as powerSourceCapability, Bi as isInternalActionId, Bn as appendTrace, Bs as canonicalStoredBlockTarget, Ca as normalizeActionUnits, Ci as heroLayoutCapability, Cn as TagsFieldSchema, Cr as coreBlockIdFromAddonId, Di as integrationInstancesCapability, Do as runSteps, Dt as IDLE_ACTION_STATUS, E as CORE_BLOCK_ADDON_PREFIX, Ei as instanceCodeHash, El as hydrateSchema, Fi as isBuiltinTemplateId, Gs as composedDeviceStableId, Hn as assertStepsOffered, Il as isSecretMarker, Io as seedInstanceOnce, Ja as proposeRunningThreshold, Jn as buildCapabilityLookup, Jo as stableIdMapOf, Ks as compositionFeatureEnabled, La as planComposition, Lr as describeComposableCaps, Ls as HelperMemberSchema, M as CoreBlockSchema, Mn as actionsCapability, Ms as DAY_MS, Nn as addonIdOfActionId, Oi as internalActionId, Or as customKeyOfRole, Ot as INTERNAL_ACTION_PREFIX, Pr as defaultTagColorId, Qc as actionEffect, Ql as ruleFireOfClaim, Rl as isSecretRefOwnedBy, Rt as MediaPlayerStatusSchema, Sa as nextTimeBoundaryInMs, Si as hasTimeLeaves, Sn as TagStyleSchema, So as resolveRemoteSource, Sr as coreBlockComposition, T as CORE_BLOCKS_ADDON_ID, Ta as normalizeTags, Tr as coreBlocksCapability, Ua as prepareRecipeUnits, Va as powerSourceLinkOfComposition, Vt as NcTaggedRuleKindSchema, Wa as problemsBlockSave, Wo as siteFor, Ws as composedDeviceRef, Xa as readRecipeLiteral, Xc as VocabActionError, Ys as compositionSourceKey, Yt as PowerSourceInfoSchema, Za as readStoredRemoteConfig, Zl as resolveSecretMarkers, Zn as buildHeroModel, _ as BUILTIN_REMOTE_COMPONENTS, _l as defineRecordKinds, _s as validateComposition, _t as FanPresetSchema, _u as EventCategory$1, an as RemoteLayoutPayloadSchema, ao as remoteSourceSteps, bl as entryBody, c as ActionError, cl as collectSecretMarkerRefs, co as replaceRecipeLiteral, cr as checkTemplatePayload, cs as templateCapability, ct as EMPTY_REMOTE_ASSUMED_STATE, cu as vocabActionIdFor, d as ActionTargetResolver, dl as commandOrigin$1, dn as SchedulerError, dr as collectWhenMirrorSources, ds as timedRunMaxIn, dt as FAN_CAPTURE_FIELDS, ea as localDateOf, ec as helperMembers, ei as evaluateStepCondition, f as ActionVariableSchema, fn as SchedulerSchema, fs as timedRunQuickRun, ft as FAN_OSCILLATION_AXES, g as BUILTIN_AUTOMATION_TEMPLATES, gl as defineEntryKind, go as resolveHeroLayout, h as AutomationTemplatePayloadSchema, hc as BaseAddon, hn as SetOscillationAxisInputSchema, ho as resolveCoreBlockFiles, hr as compileScalarOverride, ht as FanControlStatusSchema, hu as errMsg$1, ia as lockDoorLinkOfComposition, in as RemoteAssumedStateSchema, io as remoteLayoutComponentsCapability, ir as capUnitResolver, jn as actionWaitTotalMs, jo as schedulersCapability, js as CompositionSchema, ka as occurrenceOn, ks as zoneOnlySite, l as ActionMinDelaySecSchema, lo as replacedFieldKeys, ls as timedRunCapability, lt as EMPTY_REMOTE_CONFIG, lu as vocabCall, m as AutomationStateDocSchema, ml as defineAddonMigrations, mo as resolveCoreBlockEntry, ms as toTimings, mu as DeviceType$1, n as ACTION_TARGET_INVALIDATION_EVENTS, no as reexpandAutomationInstance, on as RunningStateStatusSchema, oo as removeFromTags, os as tagKey, ou as transformSecretWrite, pi as findChannelSource, ps as timedRunSeconds, pt as FAN_OSCILLATION_AXIS_SETTABLE, pu as DeviceRole, qa as projectDeviceRow, qi as kebabToCamel, qn as buildActionSteps, ro as remoteCapability, rr as canonicalStoredStepTargets, s as ALL_CAPABILITY_DEFINITIONS, si as fanAxisPath, so as renameInTags, ss as tagsCapability, st as EMPTY_AUTOMATION_STATE, tc as historyRetentionFromSettings, ti as evaluateWhenTree, tn as REMOTE_MEDIA_COMMANDS, tt as DeclaredDevices, tu as secretTreeFromSchema, u as ActionStepSchema, ui as fanPresetsCapability, un as SWITCH_DEFAULT_OPTIONS, uo as resolveActionVariables, ur as collectDeviceTemplates, us as timedRunLimitOf, vi as generateAutomationBlock, vr as compositionSourceRefs, w as COMPOSER_RUNNER_ID, wa as normalizeCoreBlockWrite, wn as TemplateKindSchema, wo as resolveStepArgs, wr as coreBlockSourceKind, ws as weekdayOfLocalDate, xa as nextOccurrence, xn as TagNameSchema, xr as coreBlockAddonId, yr as compositionUnionReads, ys as validateSchedulerInput, z as DEFAULT_HOLD_OVERRIDE, za as powerSourceActuatorConflicts, zc as RecordIntegrationInstances } from "../../dist-D7t8wLTF.mjs";
|
|
2
2
|
import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
3
|
+
import { i as capSeriesKey, m as parseConfirmedStateChanged, p as isRecord$1 } from "../../capture-engine-DBQDaDxJ.mjs";
|
|
4
|
+
import { t as describeCompositionSources } from "../../composition-sources-CGUWmf-T.mjs";
|
|
5
5
|
import { t as prefixRange } from "../../prefix-range-Dl0znowN.mjs";
|
|
6
6
|
import { n as unwrapStoredValue, t as loadPrefixed } from "../../prefix-walk-DAOBSyH1.mjs";
|
|
7
7
|
import { n as readCurrentCommandOrigin } from "../../cap-call-scope-Bic6Ekfw.mjs";
|
|
@@ -1899,6 +1899,137 @@ var CoreBlockStore = class CoreBlockStore {
|
|
|
1899
1899
|
}
|
|
1900
1900
|
};
|
|
1901
1901
|
//#endregion
|
|
1902
|
+
//#region src/builtins/core-blocks/migrations/automation-confirmed-view.ts
|
|
1903
|
+
/**
|
|
1904
|
+
* Stored generated automations move to the CONFIRMED view (D1061).
|
|
1905
|
+
*
|
|
1906
|
+
* An automation generated before D1061 read a device's slice in the effective
|
|
1907
|
+
* view: a command the hub still holds read as already done, so a condition on
|
|
1908
|
+
* it could pass before the device acted. The generator now asks for the
|
|
1909
|
+
* device's word. This regenerates each stored automation from the recipe its
|
|
1910
|
+
* code embeds (`AUTOMATION_RECIPE`), exactly as saving it in the editor would.
|
|
1911
|
+
*
|
|
1912
|
+
* Only code that is still what the generator writes is regenerated: its body
|
|
1913
|
+
* (the recipe literal blanked, as `instanceCodeHash` reads it) must equal what
|
|
1914
|
+
* the generator wrote before D1061 for that same recipe. Code edited by hand,
|
|
1915
|
+
* or written by a generator older than the one before D1061, is left exactly
|
|
1916
|
+
* as it is and logged per automation: regenerating it would lose what it does
|
|
1917
|
+
* differently. A hand-written script (no recipe) is not an automation here.
|
|
1918
|
+
* A rerun finds every regenerated automation already current and edits nothing.
|
|
1919
|
+
*/
|
|
1920
|
+
var AUTOMATION_CONFIRMED_VIEW_ID = "core-blocks/2026-11-17-automation-confirmed-view";
|
|
1921
|
+
/** What D1061 changed in the generated code: [before, after]. */
|
|
1922
|
+
var D1061_EDITS = [["ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap })", "ctx.api.deviceState.getCapSlice.query({ deviceId, capName: cap, confirmed: true })"], [" mirror.apply(deviceId, capName, data['slice'])\n guardMirror.apply(deviceId, capName, data['slice'])", " // what the device reported: a held command is never a condition (D1061)\n const slice = data['confirmed'] ?? data['slice']\n mirror.apply(deviceId, capName, slice)\n guardMirror.apply(deviceId, capName, slice)"]];
|
|
1923
|
+
/** The code the generator wrote for the same recipe before D1061. */
|
|
1924
|
+
function beforeConfirmedView(current) {
|
|
1925
|
+
return D1061_EDITS.reduce((code, [before, after]) => code.split(after).join(before), current);
|
|
1926
|
+
}
|
|
1927
|
+
function verdictOf(block) {
|
|
1928
|
+
const read = readRecipeLiteral(block.code);
|
|
1929
|
+
if (read.status === "none") return { kind: "skip" };
|
|
1930
|
+
if (read.status === "invalid") return {
|
|
1931
|
+
kind: "leave",
|
|
1932
|
+
reason: `its recipe does not read: ${read.detail}`
|
|
1933
|
+
};
|
|
1934
|
+
const fresh = generateAutomationBlock({
|
|
1935
|
+
name: block.name,
|
|
1936
|
+
recipe: read.recipe
|
|
1937
|
+
});
|
|
1938
|
+
const stored = instanceCodeHash(block.code);
|
|
1939
|
+
if (stored === instanceCodeHash(fresh)) return { kind: "skip" };
|
|
1940
|
+
if (stored !== instanceCodeHash(beforeConfirmedView(fresh))) return {
|
|
1941
|
+
kind: "leave",
|
|
1942
|
+
reason: "the code is not what its recipe generates (edited by hand, or written by an older version); saving it in the editor moves it"
|
|
1943
|
+
};
|
|
1944
|
+
return {
|
|
1945
|
+
kind: "regenerate",
|
|
1946
|
+
code: fresh
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
/** The block with its code (and, multi-file, its entry file) replaced. */
|
|
1950
|
+
function withCode(block, code, updatedAt) {
|
|
1951
|
+
if (block.files === void 0) return {
|
|
1952
|
+
...block,
|
|
1953
|
+
code,
|
|
1954
|
+
updatedAt
|
|
1955
|
+
};
|
|
1956
|
+
const entry = resolveCoreBlockEntry(block.entry);
|
|
1957
|
+
return {
|
|
1958
|
+
...block,
|
|
1959
|
+
code,
|
|
1960
|
+
files: {
|
|
1961
|
+
...block.files,
|
|
1962
|
+
[entry]: code
|
|
1963
|
+
},
|
|
1964
|
+
updatedAt
|
|
1965
|
+
};
|
|
1966
|
+
}
|
|
1967
|
+
function rewriteOf$3(row, ports) {
|
|
1968
|
+
const parsed = CoreBlockSchema.safeParse(row.data.block);
|
|
1969
|
+
if (!parsed.success) return null;
|
|
1970
|
+
const block = parsed.data;
|
|
1971
|
+
const verdict = verdictOf(block);
|
|
1972
|
+
if (verdict.kind === "skip") return null;
|
|
1973
|
+
if (verdict.kind === "leave") {
|
|
1974
|
+
ports.warn("automation left as it was: not moved to the confirmed view", {
|
|
1975
|
+
blockId: row.id,
|
|
1976
|
+
name: block.name,
|
|
1977
|
+
reason: verdict.reason
|
|
1978
|
+
});
|
|
1979
|
+
return null;
|
|
1980
|
+
}
|
|
1981
|
+
const updatedAt = Math.max(block.updatedAt + 1, ports.now());
|
|
1982
|
+
const next = CoreBlockSchema.safeParse(withCode(block, verdict.code, updatedAt));
|
|
1983
|
+
if (!next.success) {
|
|
1984
|
+
ports.warn("automation left as it was: the regenerated block does not validate", {
|
|
1985
|
+
blockId: row.id,
|
|
1986
|
+
name: block.name,
|
|
1987
|
+
reason: next.error.message
|
|
1988
|
+
});
|
|
1989
|
+
return null;
|
|
1990
|
+
}
|
|
1991
|
+
return {
|
|
1992
|
+
row,
|
|
1993
|
+
data: {
|
|
1994
|
+
...row.data,
|
|
1995
|
+
updatedAt,
|
|
1996
|
+
block: next.data
|
|
1997
|
+
}
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
async function regenerateAutomationsConfirmedView(ports) {
|
|
2001
|
+
const rewrites = (await ports.listBlockRows()).flatMap((row) => {
|
|
2002
|
+
const rewrite = rewriteOf$3(row, ports);
|
|
2003
|
+
return rewrite === null ? [] : [rewrite];
|
|
2004
|
+
});
|
|
2005
|
+
if (rewrites.length === 0) return {
|
|
2006
|
+
outcome: "already-done",
|
|
2007
|
+
summary: { automations: 0 }
|
|
2008
|
+
};
|
|
2009
|
+
let regenerated = 0;
|
|
2010
|
+
for (const { row, data } of rewrites) {
|
|
2011
|
+
try {
|
|
2012
|
+
await ports.replaceBlockRow(row.id, data, row.rev);
|
|
2013
|
+
} catch (error) {
|
|
2014
|
+
ports.warn("automation left as it was: the regenerated code could not be saved", {
|
|
2015
|
+
blockId: row.id,
|
|
2016
|
+
name: data.name,
|
|
2017
|
+
reason: error instanceof Error ? error.message : String(error)
|
|
2018
|
+
});
|
|
2019
|
+
continue;
|
|
2020
|
+
}
|
|
2021
|
+
regenerated += 1;
|
|
2022
|
+
ports.info("automation regenerated: it reads the confirmed view (D1061)", {
|
|
2023
|
+
blockId: row.id,
|
|
2024
|
+
name: data.name
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
return {
|
|
2028
|
+
outcome: "done",
|
|
2029
|
+
summary: { automations: regenerated }
|
|
2030
|
+
};
|
|
2031
|
+
}
|
|
2032
|
+
//#endregion
|
|
1902
2033
|
//#region src/builtins/core-blocks/migrations/fountain-drink-drop.ts
|
|
1903
2034
|
/**
|
|
1904
2035
|
* The drink counters leave the `pet-fountain` feature of a stored composition.
|
|
@@ -2346,6 +2477,9 @@ function coreBlocksMigrationPorts(blocks, logger, now) {
|
|
|
2346
2477
|
}, { ifRev });
|
|
2347
2478
|
},
|
|
2348
2479
|
now,
|
|
2480
|
+
info: (message, meta) => {
|
|
2481
|
+
logger.info(message, { meta });
|
|
2482
|
+
},
|
|
2349
2483
|
warn: (message, meta) => {
|
|
2350
2484
|
logger.warn(message, { meta });
|
|
2351
2485
|
}
|
|
@@ -2829,6 +2963,22 @@ var ADDON_MIGRATIONS = [
|
|
|
2829
2963
|
fixtureMark: "the binding action of each lettered key and the label of each layout button"
|
|
2830
2964
|
},
|
|
2831
2965
|
procedure: renameRemoteColourRoles
|
|
2966
|
+
},
|
|
2967
|
+
{
|
|
2968
|
+
meta: {
|
|
2969
|
+
id: AUTOMATION_CONFIRMED_VIEW_ID,
|
|
2970
|
+
owner: "core-blocks",
|
|
2971
|
+
level: "addon-state",
|
|
2972
|
+
seq: 6,
|
|
2973
|
+
dependsOn: [],
|
|
2974
|
+
store: "settings",
|
|
2975
|
+
scope: "cluster",
|
|
2976
|
+
onFailure: "tolerate",
|
|
2977
|
+
bodyKind: "procedure",
|
|
2978
|
+
description: "Regenerate each stored generated automation from its embedded recipe so it reads what the device reported, never a command the hub still holds; code edited by hand is left as it is and logged",
|
|
2979
|
+
fixtureMark: "the block createdBy and name, which the migration does not know"
|
|
2980
|
+
},
|
|
2981
|
+
procedure: regenerateAutomationsConfirmedView
|
|
2832
2982
|
}
|
|
2833
2983
|
];
|
|
2834
2984
|
//#endregion
|
|
@@ -2900,7 +3050,8 @@ function conditionDoorOver(api) {
|
|
|
2900
3050
|
return evaluateStepCondition(when, {
|
|
2901
3051
|
fetchSlice: (deviceId, cap) => current.deviceState.getCapSlice.query({
|
|
2902
3052
|
deviceId,
|
|
2903
|
-
capName: cap
|
|
3053
|
+
capName: cap,
|
|
3054
|
+
confirmed: true
|
|
2904
3055
|
}),
|
|
2905
3056
|
fetchStableIds: async () => stableIdMapOf(await current.deviceManager.listAll.query({}))
|
|
2906
3057
|
}, () => Date.now(), void 0, site);
|
|
@@ -6176,7 +6327,8 @@ function hostOver(api) {
|
|
|
6176
6327
|
readSite: async () => need().system.getSiteLocation.query(),
|
|
6177
6328
|
fetchSlice: (deviceId, cap) => need().deviceState.getCapSlice.query({
|
|
6178
6329
|
deviceId,
|
|
6179
|
-
capName: cap
|
|
6330
|
+
capName: cap,
|
|
6331
|
+
confirmed: true
|
|
6180
6332
|
}),
|
|
6181
6333
|
fetchStableIds: async () => {
|
|
6182
6334
|
return stableIdMapOf(await need().deviceManager.listAll.query({ projection: "slim" }));
|
|
@@ -6215,7 +6367,7 @@ function buildSchedulersRuntime(deps) {
|
|
|
6215
6367
|
logger: deps.logger.child("schedulers")
|
|
6216
6368
|
});
|
|
6217
6369
|
const unsubscribers = [...ACTION_TARGET_INVALIDATION_EVENTS.map((category) => deps.eventBus.subscribe({ category }, () => engine.invalidateTargets())), deps.eventBus.subscribe({ category: EventCategory$1.DeviceStateChanged }, (event) => {
|
|
6218
|
-
const data =
|
|
6370
|
+
const data = parseConfirmedStateChanged(event.data);
|
|
6219
6371
|
if (data !== null) engine.onDeviceState(data.deviceId, data.capName, data.slice);
|
|
6220
6372
|
})];
|
|
6221
6373
|
return {
|
|
@@ -7917,7 +8069,8 @@ function remoteSliceWriterOver(settings, api) {
|
|
|
7917
8069
|
if (current === void 0) throw new Error("no ctx.api on this node");
|
|
7918
8070
|
const kept = MediaPlayerStatusSchema.safeParse(await current.deviceState.getCapSlice.query({
|
|
7919
8071
|
deviceId,
|
|
7920
|
-
capName: MEDIA_PLAYER_CAP
|
|
8072
|
+
capName: MEDIA_PLAYER_CAP,
|
|
8073
|
+
confirmed: true
|
|
7921
8074
|
}));
|
|
7922
8075
|
if (kept.success && sameStatus(kept.data, status)) return;
|
|
7923
8076
|
await current.deviceState.setCapSlice.mutate({
|
|
@@ -9939,7 +10092,7 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
9939
10092
|
});
|
|
9940
10093
|
this.timedRun = timedRun;
|
|
9941
10094
|
this.subscribe({ category: EventCategory$1.DeviceStateChanged }, (event) => {
|
|
9942
|
-
const data =
|
|
10095
|
+
const data = parseConfirmedStateChanged(event.data);
|
|
9943
10096
|
if (data !== null) timedRun.onDeviceState(data);
|
|
9944
10097
|
});
|
|
9945
10098
|
armTimedRuns(timedRun, this.ctx.logger.child("timed-run"), { isDisposed: () => this.disposed });
|
|
@@ -10044,7 +10197,8 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
10044
10197
|
caps: async (deviceId) => (await requireApi().deviceManager.getBindings.query({ deviceId })).entries.map((e) => e.capName),
|
|
10045
10198
|
slice: (deviceId, capName) => requireApi().deviceState.getCapSlice.query({
|
|
10046
10199
|
deviceId,
|
|
10047
|
-
capName
|
|
10200
|
+
capName,
|
|
10201
|
+
confirmed: true
|
|
10048
10202
|
}),
|
|
10049
10203
|
remoteCommands: async (deviceId) => (await requireApi().remote.listCommands.query({ deviceId })).commands.length,
|
|
10050
10204
|
switchOptions: (deviceId) => switchOptionsOf(requireApi(), deviceId),
|
|
@@ -10127,7 +10281,7 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
10127
10281
|
logger: this.ctx.logger.child("lock-door")
|
|
10128
10282
|
});
|
|
10129
10283
|
this.subscribe({ category: EventCategory$1.DeviceStateChanged }, (event) => {
|
|
10130
|
-
const data =
|
|
10284
|
+
const data = parseConfirmedStateChanged(event.data);
|
|
10131
10285
|
if (data !== null) gate.onStateChanged(data);
|
|
10132
10286
|
});
|
|
10133
10287
|
this.seedLockDoorGate = () => this.seedGate(gate);
|
|
@@ -10156,7 +10310,8 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
10156
10310
|
readControl: async (deviceId) => {
|
|
10157
10311
|
const slice = await requireApi().deviceState.getCapSlice.query({
|
|
10158
10312
|
deviceId,
|
|
10159
|
-
capName: "control"
|
|
10313
|
+
capName: "control",
|
|
10314
|
+
confirmed: true
|
|
10160
10315
|
});
|
|
10161
10316
|
if (slice === null) return null;
|
|
10162
10317
|
const kind = slice["kind"];
|
|
@@ -10201,7 +10356,7 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
10201
10356
|
if (typeof deviceId === "number") remote.refreshSlice(deviceId);
|
|
10202
10357
|
});
|
|
10203
10358
|
this.subscribe({ category: EventCategory$1.DeviceStateChanged }, (event) => {
|
|
10204
|
-
const data =
|
|
10359
|
+
const data = parseConfirmedStateChanged(event.data);
|
|
10205
10360
|
if (data !== null && REMOTE_SLICE_INPUT_CAPS.has(data.capName)) remote.onInputChanged(data.deviceId);
|
|
10206
10361
|
});
|
|
10207
10362
|
}
|
|
@@ -10637,7 +10792,8 @@ var CoreBlocksAddon = class extends BaseAddon {
|
|
|
10637
10792
|
readField: async (deviceId, cap, fieldPath) => {
|
|
10638
10793
|
const slice = await requireApi().deviceState.getCapSlice.query({
|
|
10639
10794
|
deviceId,
|
|
10640
|
-
capName: cap
|
|
10795
|
+
capName: cap,
|
|
10796
|
+
confirmed: true
|
|
10641
10797
|
});
|
|
10642
10798
|
return slice === null ? void 0 : slice[fieldPath];
|
|
10643
10799
|
}
|