@camstack/system 1.2.473 → 1.2.475

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.
Files changed (86) hide show
  1. package/dist/{agent-https-B9Q3-IKd.js → agent-https-BsqT0qni.js} +8 -8
  2. package/dist/{agent-https-DOwn4pqL.mjs → agent-https-wA8gGLc1.mjs} +8 -8
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/autotrack/index.js +1 -1
  10. package/dist/builtins/autotrack/index.mjs +1 -1
  11. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  12. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  13. package/dist/builtins/calendars/calendars.addon.js +1 -1
  14. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  15. package/dist/builtins/camera-grid/index.js +1 -1
  16. package/dist/builtins/camera-grid/index.mjs +1 -1
  17. package/dist/builtins/composer/composer.addon.js +2 -2
  18. package/dist/builtins/composer/composer.addon.mjs +2 -2
  19. package/dist/builtins/console-logging/index.js +1 -1
  20. package/dist/builtins/console-logging/index.mjs +1 -1
  21. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  22. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  23. package/dist/builtins/device-history/device-history.addon.js +1 -1
  24. package/dist/builtins/device-history/device-history.addon.mjs +1 -1
  25. package/dist/builtins/device-manager/device-manager.addon.js +71 -1
  26. package/dist/builtins/device-manager/device-manager.addon.mjs +71 -1
  27. package/dist/builtins/device-manager/device-state-mirror.d.ts +4 -0
  28. package/dist/builtins/device-manager/running-flip.d.ts +11 -0
  29. package/dist/builtins/hub-forwarder/index.js +1 -1
  30. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  31. package/dist/builtins/keychain/index.js +3 -3
  32. package/dist/builtins/keychain/index.mjs +3 -3
  33. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  34. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  35. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  36. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  37. package/dist/builtins/local-network/local-network.addon.js +2 -2
  38. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  39. package/dist/builtins/loki-logging/index.js +1 -1
  40. package/dist/builtins/loki-logging/index.mjs +1 -1
  41. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  42. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  43. package/dist/builtins/platform-probe/index.js +1 -1
  44. package/dist/builtins/platform-probe/index.mjs +1 -1
  45. package/dist/builtins/record-entries/index.js +1 -1
  46. package/dist/builtins/record-entries/index.mjs +1 -1
  47. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  48. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  49. package/dist/builtins/snapshot/index.js +1 -1
  50. package/dist/builtins/snapshot/index.mjs +1 -1
  51. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  52. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  53. package/dist/builtins/sqlite-storage/index.js +1 -1
  54. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  55. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  56. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  57. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  58. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  59. package/dist/builtins/system-config/system-config.addon.js +8 -8
  60. package/dist/builtins/system-config/system-config.addon.mjs +8 -8
  61. package/dist/builtins/winston-logging/index.js +1 -1
  62. package/dist/builtins/winston-logging/index.mjs +1 -1
  63. package/dist/{composition-sources-cwD35HB0.mjs → composition-sources-CiFkyAcf.mjs} +1 -1
  64. package/dist/{composition-sources-Dj_nInUQ.js → composition-sources-DeUSUid6.js} +1 -1
  65. package/dist/{constants-XkWSVvgY.js → constants-3Wj5OyEk.js} +1 -1
  66. package/dist/{constants-p5mPM1iL.mjs → constants-DZJAkne8.mjs} +1 -1
  67. package/dist/{device-ca-DyUtcpf4.mjs → device-ca-DiV5xcMz.mjs} +14 -13
  68. package/dist/{device-ca-BXzQ1pYj.js → device-ca-ftrfVdc0.js} +14 -13
  69. package/dist/{dist-Bmah6waF.js → dist-BtDdPdZ7.js} +606 -113
  70. package/dist/{dist-C9lbdBL5.mjs → dist-DygMs3Qc.mjs} +606 -113
  71. package/dist/file-host-worker.js +1 -1
  72. package/dist/file-host-worker.mjs +1 -1
  73. package/dist/{hub-mdns-ciao-CUr6ewsX.js → hub-mdns-ciao-B1VcdfT1.js} +4 -4
  74. package/dist/{hub-mdns-ciao-BemeCNGe.mjs → hub-mdns-ciao-Bc9PnWu3.mjs} +4 -4
  75. package/dist/index.js +13 -7
  76. package/dist/index.mjs +13 -7
  77. package/dist/{lib-8oZrELLm.js → lib-C3U1yluo.js} +1 -1
  78. package/dist/{lib-DK38ompL.mjs → lib-DFZblCIu.mjs} +1 -1
  79. package/dist/{restore-archive-C0aohmAK.mjs → restore-archive-D_Pwryre.mjs} +1 -1
  80. package/dist/{restore-archive-DbPmyjiM.js → restore-archive-TDkQfmLO.js} +1 -1
  81. package/dist/tls/cert-utc-time.d.ts +1 -0
  82. package/dist/{wal-maintenance-BT8Ns0W3.js → wal-maintenance-D3UwIKX5.js} +0 -0
  83. package/dist/{wal-maintenance-BuB731DK.mjs → wal-maintenance-rLv4uOmp.mjs} +0 -0
  84. package/dist/{x509.es-DK__ETIe.mjs → x509.es-BRiJgOvu.mjs} +24 -1
  85. package/dist/{x509.es-C4cOo48M.js → x509.es-WtnRNyYS.js} +29 -0
  86. package/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  let zod = require("zod");
2
2
  require("node:crypto");
3
- //#region ../types/dist/event-category-fDPduoeC.mjs
3
+ //#region ../types/dist/event-category-Ceif8n-v.mjs
4
4
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
5
5
  EventCategory["SystemBoot"] = "system.boot";
6
6
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -472,6 +472,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
472
472
  * on the device detail page.
473
473
  */
474
474
  EventCategory["DoorbellOnPressed"] = "doorbell.onPressed";
475
+ /** Mirrors `runningStateCapability.events.onStarted`. */
476
+ EventCategory["RunningStarted"] = "running.started";
477
+ /** Mirrors `runningStateCapability.events.onFinished`. */
478
+ EventCategory["RunningFinished"] = "running.finished";
475
479
  /**
476
480
  * Cap event fired by every device that registers the `event-emitter`
477
481
  * capability. Mirrors `eventEmitterCapability.events.onEvent`. Carries
@@ -761,7 +765,7 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
761
765
  return EventCategory;
762
766
  }({});
763
767
  //#endregion
764
- //#region ../types/dist/sleep-CHIEEJkY.mjs
768
+ //#region ../types/dist/sleep-CYfIZzGv.mjs
765
769
  /**
766
770
  * The audio chunk plane's byte format, and the ONE expansion from a coded
767
771
  * window to float samples (D455).
@@ -1152,7 +1156,7 @@ var WELL_KNOWN_TAB_MAP = Object.fromEntries([
1152
1156
  * `hydrateSchema` to skip the `value` injection for structural-only fields.
1153
1157
  */
1154
1158
  function isValuelessField(field) {
1155
- return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button";
1159
+ return field.type === "separator" || field.type === "info" || field.type === "qr-code" || field.type === "button" || field.type === "object-array" || field.type === "widget" || field.type === "addon-action-button" || field.type === "device-action-button" || field.type === "account-sign-in" || field.type === "secret-presence";
1156
1160
  }
1157
1161
  function hydrateSchema(schema, values, options = {}) {
1158
1162
  return {
@@ -5480,7 +5484,7 @@ function errMsg(err) {
5480
5484
  return String(err);
5481
5485
  }
5482
5486
  //#endregion
5483
- //#region ../types/dist/composition-CB6PMT9p.mjs
5487
+ //#region ../types/dist/composition-BJ8iAZb3.mjs
5484
5488
  var AUDIO_ENCODER_BY_CODEC = {
5485
5489
  opus: "libopus",
5486
5490
  aac: "aac",
@@ -5932,7 +5936,7 @@ portable("linux64"), portable("linuxarm64"), portable("macarm64"), portable("mac
5932
5936
  * ONE table for everyone who asks "is this device HIGH?": the
5933
5937
  * recorder's `RecordingTriggers.sensorDeviceIds` trigger, the post-analysis
5934
5938
  * sensor markers, the orchestrator's camera-sensors bridge and
5935
- * the sources of a composite doorbell (`doorbellFeatureSources`, D671).
5939
+ * the sources of a pulse (`compilePulseOverride`, D936).
5936
5940
  * A second copy would diverge at the first cap added, and the symptom — "the
5937
5941
  * sensor rings the doorbell but does not record" — is exactly D62.
5938
5942
  *
@@ -6011,7 +6015,7 @@ var ExpressionEvalError = class extends Error {
6011
6015
  }
6012
6016
  };
6013
6017
  function isStatefulBuiltin(name) {
6014
- return name === "rose" || name === "count";
6018
+ return name === "rose" || name === "count" || name === "dwell" || name === "latchedAt";
6015
6019
  }
6016
6020
  function asFiniteNumber(value, name, index) {
6017
6021
  if (typeof value !== "number" || !Number.isFinite(value)) throw new ExpressionEvalError(`${name}: argument ${index + 1} must be a finite number`);
@@ -6102,6 +6106,57 @@ function disarmRoseMemory(memory) {
6102
6106
  * input is its own `lastPressedAt`, which only advances on a `rose` edge that
6103
6107
  * also emits the press — but an external input can overcount by one.
6104
6108
  */
6109
+ function asNonNegativeMs(value, name, index) {
6110
+ const ms = asFiniteNumber(value, name, index);
6111
+ if (ms < 0) throw new ExpressionEvalError(`${name}: delay must be a non-negative finite number`);
6112
+ return ms;
6113
+ }
6114
+ /**
6115
+ * `dwell(active, onForMs, offForMs)`: unknown until a delay elapses, then holds
6116
+ * the latched boolean through gaps shorter than the opposing delay (D933).
6117
+ */
6118
+ function evaluateDwell(activeRaw, onForMsRaw, offForMsRaw, call, nowMs, hooks) {
6119
+ const active = asBoolean(activeRaw, "dwell", 0);
6120
+ const onForMs = asNonNegativeMs(onForMsRaw, "dwell", 1);
6121
+ const offForMs = asNonNegativeMs(offForMsRaw, "dwell", 2);
6122
+ if (call.latched === null) {
6123
+ if (call.seenSince === null) call.seenSince = nowMs;
6124
+ const delay = active ? onForMs : offForMs;
6125
+ if (nowMs - call.seenSince >= delay) {
6126
+ call.latched = active;
6127
+ return call.latched;
6128
+ }
6129
+ hooks?.noteDeadline?.(call.seenSince + delay);
6130
+ return null;
6131
+ }
6132
+ if (active === call.latched) {
6133
+ call.pendingSince = null;
6134
+ return call.latched;
6135
+ }
6136
+ if (call.pendingSince === null) call.pendingSince = nowMs;
6137
+ const delay = active ? onForMs : offForMs;
6138
+ if (nowMs - call.pendingSince >= delay) {
6139
+ call.latched = active;
6140
+ call.pendingSince = null;
6141
+ return call.latched;
6142
+ }
6143
+ hooks?.noteDeadline?.(call.pendingSince + delay);
6144
+ return call.latched;
6145
+ }
6146
+ /** `latchedAt(value)`: epoch ms when `value` last changed; null clears the stamp. */
6147
+ function evaluateLatchedAt(value, call, nowMs) {
6148
+ if (value === null) {
6149
+ call.last = null;
6150
+ call.at = null;
6151
+ return null;
6152
+ }
6153
+ if (typeof value !== "boolean" && typeof value !== "number" && typeof value !== "string") return call.at;
6154
+ if (call.last !== value) {
6155
+ call.last = value;
6156
+ call.at = nowMs;
6157
+ }
6158
+ return call.at;
6159
+ }
6105
6160
  function evaluateCount(input, call, currentOutput) {
6106
6161
  const currentCount = typeof currentOutput === "number" && Number.isFinite(currentOutput) && currentOutput >= 0 ? currentOutput : 0;
6107
6162
  if (input === null) {
@@ -6271,6 +6326,20 @@ var table = {
6271
6326
  apply: () => {
6272
6327
  throw new ExpressionEvalError("count: stateful evaluation context is required");
6273
6328
  }
6329
+ },
6330
+ dwell: {
6331
+ minArgs: 3,
6332
+ maxArgs: 3,
6333
+ apply: () => {
6334
+ throw new ExpressionEvalError("dwell: stateful evaluation context is required");
6335
+ }
6336
+ },
6337
+ latchedAt: {
6338
+ minArgs: 1,
6339
+ maxArgs: 1,
6340
+ apply: () => {
6341
+ throw new ExpressionEvalError("latchedAt: stateful evaluation context is required");
6342
+ }
6274
6343
  }
6275
6344
  };
6276
6345
  /** Frozen, null-prototype builtin table. */
@@ -6816,7 +6885,7 @@ function cloneStatefulExpressionMemory(memory) {
6816
6885
  disarmRoseNext: memory.disarmRoseNext
6817
6886
  };
6818
6887
  }
6819
- function evaluateStatefulExpressionCall(invocation, memory, env) {
6888
+ function evaluateStatefulExpressionCall(invocation, memory, env, hooks) {
6820
6889
  const existing = memory.calls.get(invocation.path);
6821
6890
  switch (invocation.name) {
6822
6891
  case "rose": {
@@ -6838,6 +6907,25 @@ function evaluateStatefulExpressionCall(invocation, memory, env) {
6838
6907
  memory.calls.set(invocation.path, call);
6839
6908
  return evaluateCount(invocation.args[0], call, env.currentOutput);
6840
6909
  }
6910
+ case "dwell": {
6911
+ const call = existing?.kind === "dwell" ? existing : {
6912
+ kind: "dwell",
6913
+ pendingSince: null,
6914
+ latched: null,
6915
+ seenSince: null
6916
+ };
6917
+ memory.calls.set(invocation.path, call);
6918
+ return evaluateDwell(invocation.args[0], invocation.args[1], invocation.args[2], call, env.nowMs, hooks);
6919
+ }
6920
+ case "latchedAt": {
6921
+ const call = existing?.kind === "latchedAt" ? existing : {
6922
+ kind: "latchedAt",
6923
+ last: void 0,
6924
+ at: null
6925
+ };
6926
+ memory.calls.set(invocation.path, call);
6927
+ return evaluateLatchedAt(invocation.args[0], call, env.nowMs);
6928
+ }
6841
6929
  }
6842
6930
  }
6843
6931
  /**
@@ -15531,7 +15619,15 @@ var BUILTIN_RESULT_KINDS = Object.freeze({
15531
15619
  kind: "fixed",
15532
15620
  result: ["number", "null"]
15533
15621
  },
15534
- count: NUMBER
15622
+ count: NUMBER,
15623
+ dwell: {
15624
+ kind: "fixed",
15625
+ result: ["boolean", "null"]
15626
+ },
15627
+ latchedAt: {
15628
+ kind: "fixed",
15629
+ result: ["number", "null"]
15630
+ }
15535
15631
  });
15536
15632
  var KindInferenceError = class extends Error {};
15537
15633
  function kindOfValue(value) {
@@ -45183,9 +45279,6 @@ var NcSystemEventKindSchema = zod.z.enum([
45183
45279
  "device-battery-normal",
45184
45280
  "device-consumable-low",
45185
45281
  "device-consumable-normal",
45186
- "device-tank-low",
45187
- "device-tank-full",
45188
- "device-tank-normal",
45189
45282
  "stream-online",
45190
45283
  "stream-offline",
45191
45284
  "node-online",
@@ -45232,13 +45325,14 @@ var NcSystemEventKindSchema = zod.z.enum([
45232
45325
  "camera-enabled"
45233
45326
  ]);
45234
45327
  /** The legacy tail of {@link NcSystemEventKindSchema} — see its docblock. */
45235
- var NC_LEGACY_SYSTEM_EVENT_KINDS = new Set([
45328
+ var NC_LEGACY_SYSTEM_EVENT_KINDS = [
45236
45329
  "camera-online",
45237
45330
  "camera-offline",
45238
45331
  "camera-disabled",
45239
45332
  "camera-enabled"
45240
- ]);
45241
- NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KINDS.has(kind));
45333
+ ];
45334
+ var NC_LEGACY_SYSTEM_EVENT_KIND_SET = new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
45335
+ NcSystemEventKindSchema.options.filter((kind) => !NC_LEGACY_SYSTEM_EVENT_KIND_SET.has(kind));
45242
45336
  /**
45243
45337
  * The panel's transitions, as ONE list.
45244
45338
  *
@@ -46368,18 +46462,11 @@ var NcRuleSchema = NcRuleInputSchema.extend({
46368
46462
  */
46369
46463
  disabledTargetIds: zod.z.array(zod.z.string()).default([])
46370
46464
  });
46371
- /**
46372
- * The state-summary SECTIONS (D647 / D698 / D708): the D637 kind groups that
46373
- * report a still-true state. `addons` is the crash-looped addons only and
46374
- * `addon-updates` the addons that are behind (D708 split them). `backups-exports` and `alarm` are not sections — a completed
46375
- * job is not an open state, and the alarm stays instant.
46376
- */
46377
46465
  var NcStateSummarySectionIdSchema = zod.z.enum([
46378
46466
  "device-state",
46379
46467
  "streams",
46380
46468
  "battery",
46381
46469
  "consumables",
46382
- "tanks",
46383
46470
  "detection-blind",
46384
46471
  "nodes",
46385
46472
  "addons",
@@ -60064,20 +60151,68 @@ var BatteryStatusSchema = zod.z.object({
60064
60151
  */
60065
60152
  binary: zod.z.boolean().optional()
60066
60153
  });
60154
+ var BATTERY_DEVICE_TYPES = [
60155
+ DeviceType.Camera,
60156
+ DeviceType.Sensor,
60157
+ DeviceType.Button,
60158
+ DeviceType.Switch,
60159
+ DeviceType.PetFeeder,
60160
+ DeviceType.Container,
60161
+ DeviceType.Thermostat
60162
+ ];
60163
+ /** Generic Customize target for the percentage reading (D936). */
60164
+ var batteryCustomize = {
60165
+ version: 1,
60166
+ targets: [{
60167
+ id: "percentage",
60168
+ cardinality: "scalar",
60169
+ vocabulary: {
60170
+ cap: "battery",
60171
+ stateField: "percentage"
60172
+ },
60173
+ deviceTypes: BATTERY_DEVICE_TYPES,
60174
+ apply: "add-or-replace",
60175
+ path: "percentage",
60176
+ sources: [{
60177
+ kind: "field",
60178
+ valueKinds: ["number", "string"],
60179
+ transforms: [{ kind: "identity" }, {
60180
+ kind: "linear",
60181
+ defaultScale: 1,
60182
+ defaultOffset: 0,
60183
+ clampMin: 0,
60184
+ clampMax: 100
60185
+ }]
60186
+ }],
60187
+ companions: [
60188
+ {
60189
+ kind: "constant",
60190
+ path: "charging",
60191
+ value: "unknown",
60192
+ when: "add"
60193
+ },
60194
+ {
60195
+ kind: "constant",
60196
+ path: "sleeping",
60197
+ value: false,
60198
+ when: "add"
60199
+ },
60200
+ {
60201
+ kind: "clock",
60202
+ path: "lastUpdated",
60203
+ when: "add"
60204
+ }
60205
+ ],
60206
+ sourceReport: { status: "assignment-status" },
60207
+ advancedExpression: true
60208
+ }]
60209
+ };
60067
60210
  var batteryCapability = {
60068
60211
  name: "battery",
60069
60212
  scope: "device",
60070
60213
  deviceNative: true,
60071
60214
  mode: "singleton",
60072
- deviceTypes: [
60073
- DeviceType.Camera,
60074
- DeviceType.Sensor,
60075
- DeviceType.Button,
60076
- DeviceType.Switch,
60077
- DeviceType.PetFeeder,
60078
- DeviceType.Container,
60079
- DeviceType.Thermostat
60080
- ],
60215
+ deviceTypes: BATTERY_DEVICE_TYPES,
60081
60216
  methods: {
60082
60217
  /**
60083
60218
  * Explicitly wake the camera from low-power sleep ahead of a
@@ -60161,6 +60296,7 @@ onStatusChanged: { data: zod.z.object({
60161
60296
  kind: "gauge",
60162
60297
  unit: "%"
60163
60298
  } } },
60299
+ customize: batteryCustomize,
60164
60300
  /** Clock fields: written, but excluded from the compare that decides
60165
60301
  * whether persisting is worth a SQLite commit. */
60166
60302
  volatileStateFields: ["lastUpdated"]
@@ -61226,6 +61362,106 @@ var ConsumablesStatusSchema = zod.z.object({
61226
61362
  items: zod.z.array(ConsumableItemSchema),
61227
61363
  lastChangedAt: zod.z.number()
61228
61364
  });
61365
+ /** Synthesize seed for a link-built status (no native provider).
61366
+ *
61367
+ * ⚠ NO LIVE CALLER since 2026-08-08 (device-links deleted; see
61368
+ * `CapabilityStatusSchema.empty`). The wiring guidance below was written for
61369
+ * exactly the case the operator is asking about again — a Dreame's HA
61370
+ * consumable-life sensors — so it is kept for that conversation, not because
61371
+ * anything reads it today. */
61372
+ var EMPTY_STATUS = {
61373
+ items: [],
61374
+ lastChangedAt: 0
61375
+ };
61376
+ /** Seed for a NEW link-built consumable item. `key`/`label` are overwritten
61377
+ * with the link's `itemKey` (see `status.itemArray`), so the placeholder
61378
+ * empty strings never survive into a validated item. Link-built items are
61379
+ * not resettable — there is no native provider to receive `reset()`.
61380
+ *
61381
+ * Wiring guidance (HA vacuum consumable-life sensors):
61382
+ * - a percent-remaining source (`numeric-sensor`, unit '%') → `level` via
61383
+ * `identity` (or `linear` scale 1 offset 0 clamp [0,100] to be safe);
61384
+ * - an hours-remaining source (e.g. Dreame 'Main Brush Time Left', unit 'h')
61385
+ * → `level` via `linear` with scale = 100 / max-hours for that item
61386
+ * (e.g. main brush 300 h → scale 0.3333) + clamp [0,100];
61387
+ * - a discrete source (`enum-sensor`, e.g. mop pad 'installed') → `status`
61388
+ * via `enum-map` (e.g. { installed: 'ok', missing: 'replace' }).
61389
+ * A numeric→'replace' THRESHOLD (level < 10 → 'replace') is NOT expressible
61390
+ * with the current transform kinds — leave `status` null (valid) until the
61391
+ * expression transform lands. */
61392
+ /** Generic Customize target for one consumable item (D936). Native rows stay read-only. */
61393
+ var consumablesCustomize = {
61394
+ version: 1,
61395
+ targets: [{
61396
+ id: "items",
61397
+ cardinality: "keyedArray",
61398
+ vocabulary: { cap: "consumables" },
61399
+ deviceTypes: Object.values(DeviceType),
61400
+ apply: "add",
61401
+ path: "items",
61402
+ keyField: "key",
61403
+ labelField: "label",
61404
+ itemSchema: ConsumableItemSchema,
61405
+ nativeItems: "read-only",
61406
+ sourceReport: { status: "assignment-status" },
61407
+ fields: [
61408
+ {
61409
+ path: "level",
61410
+ sources: [{
61411
+ kind: "numeric",
61412
+ transforms: [{ kind: "identity" }, {
61413
+ kind: "linear",
61414
+ defaultScale: 1,
61415
+ defaultOffset: 0,
61416
+ clampMin: 0,
61417
+ clampMax: 100
61418
+ }]
61419
+ }]
61420
+ },
61421
+ {
61422
+ path: "remaining.value",
61423
+ sources: [{
61424
+ kind: "numeric",
61425
+ transforms: [{ kind: "identity" }]
61426
+ }],
61427
+ literals: [{
61428
+ path: "remaining.unit",
61429
+ values: [...ConsumableRemainingUnitSchema.options]
61430
+ }]
61431
+ },
61432
+ {
61433
+ path: "status",
61434
+ sources: [{
61435
+ kind: "enum",
61436
+ transforms: [{
61437
+ kind: "enum-map",
61438
+ outputValues: [...ConsumableStatusSchema.options],
61439
+ unmapped: null
61440
+ }]
61441
+ }]
61442
+ }
61443
+ ],
61444
+ traits: [{
61445
+ path: "kind",
61446
+ values: [...ConsumableKindSchema.options],
61447
+ defaultValue: "wear"
61448
+ }, {
61449
+ path: "form",
61450
+ values: [...ConsumableFormSchema.options],
61451
+ defaultValue: "part"
61452
+ }],
61453
+ companions: [{
61454
+ kind: "clock",
61455
+ path: "lastChangedAt",
61456
+ when: "add"
61457
+ }, {
61458
+ kind: "clock",
61459
+ path: "lastFetchedAt",
61460
+ when: "add"
61461
+ }],
61462
+ advancedExpression: true
61463
+ }]
61464
+ };
61229
61465
  var consumablesCapability = {
61230
61466
  name: "consumables",
61231
61467
  scope: "device",
@@ -61263,10 +61499,7 @@ reset: method(zod.z.object({
61263
61499
  status: {
61264
61500
  schema: ConsumablesStatusSchema,
61265
61501
  kind: "push",
61266
- empty: {
61267
- items: [],
61268
- lastChangedAt: 0
61269
- },
61502
+ empty: EMPTY_STATUS,
61270
61503
  itemArray: {
61271
61504
  path: "items",
61272
61505
  keyField: "key",
@@ -61302,6 +61535,7 @@ reset: method(zod.z.object({
61302
61535
  * brush's remaining life and a dishwasher's salt are each recorded the moment
61303
61536
  * their provider reports them; an item that appears later gets its series.
61304
61537
  */
61538
+ customize: consumablesCustomize,
61305
61539
  history: {
61306
61540
  fields: {},
61307
61541
  items: {
@@ -62090,6 +62324,36 @@ var dishwasherCapability = {
62090
62324
  powerOn: { kind: "boolean" }
62091
62325
  } }
62092
62326
  };
62327
+ /** Pulse override: a rising edge advances `lastPressedAt` and the press count. */
62328
+ var doorbellCustomize = {
62329
+ version: 1,
62330
+ targets: [{
62331
+ id: "pressed",
62332
+ cardinality: "event",
62333
+ shape: "pulse",
62334
+ vocabulary: {
62335
+ cap: "doorbell",
62336
+ eventName: "onPressed"
62337
+ },
62338
+ deviceTypes: [DeviceType.Camera],
62339
+ apply: "add",
62340
+ applyAuthority: { kind: "composition-claim" },
62341
+ eventName: "onPressed",
62342
+ edges: ["rising"],
62343
+ timestampPath: "lastPressedAt",
62344
+ counterPath: "pressCountSinceStart",
62345
+ highWater: "composer-advance",
62346
+ combine: "any",
62347
+ debounce: {
62348
+ kind: "rising-edge",
62349
+ defaultDebounceMs: 2e3,
62350
+ changedAtRequired: true
62351
+ },
62352
+ sources: [{ kind: "binary" }, { kind: "switch" }],
62353
+ sourceReport: { status: "assignment-status" },
62354
+ advancedExpression: true
62355
+ }]
62356
+ };
62093
62357
  var DoorbellStatusSchema = zod.z.object({
62094
62358
  /** Ms epoch of the last press. null = never observed since this provider started. */
62095
62359
  lastPressedAt: zod.z.number().nullable(),
@@ -62156,7 +62420,8 @@ onPressed: {
62156
62420
  /**
62157
62421
  * History (D850): none — `pressCountSinceStart` resets with the addon, so it is not a monotonic meter; presses live in the events ledger.
62158
62422
  */
62159
- history: "none"
62423
+ history: "none",
62424
+ customize: doorbellCustomize
62160
62425
  };
62161
62426
  /**
62162
62427
  * Enum-state sensor — a string value picked from a finite option set.
@@ -64862,6 +65127,38 @@ authKey: zod.z.string().optional() }), zod.z.object({
64862
65127
  }), { kind: "mutation" })
64863
65128
  }
64864
65129
  };
65130
+ /** Span override: start on a rising edge, end on a fall or this timeout. */
65131
+ var motionCustomize = {
65132
+ version: 1,
65133
+ targets: [{
65134
+ id: "detected",
65135
+ cardinality: "event",
65136
+ shape: "span",
65137
+ vocabulary: {
65138
+ cap: "motion",
65139
+ eventName: "onMotionChanged"
65140
+ },
65141
+ deviceTypes: [DeviceType.Camera],
65142
+ apply: "replace",
65143
+ applyAuthority: {
65144
+ kind: "camera-sensors",
65145
+ timeoutField: "motionCooldownMs"
65146
+ },
65147
+ eventName: "onMotionChanged",
65148
+ start: "rising-edge",
65149
+ end: "falling-edge-or-timeout",
65150
+ timeoutMs: 3e4,
65151
+ combine: "any",
65152
+ sourceModes: [
65153
+ "in-addition",
65154
+ "confirm",
65155
+ "replace"
65156
+ ],
65157
+ sources: [{ kind: "binary" }, { kind: "switch" }],
65158
+ sourceReport: { status: "assignment-status" },
65159
+ advancedExpression: false
65160
+ }]
65161
+ };
64865
65162
  /**
64866
65163
  * Hardware / firmware motion sensor cap — binary detected state plus
64867
65164
  * a timestamp of the last observation. Distinct from
@@ -65026,7 +65323,8 @@ onMotionChanged: { data: MotionOnMotionChangedDataSchema } },
65026
65323
  history: { fields: { detected: {
65027
65324
  kind: "boolean",
65028
65325
  excludeDeviceTypes: [DeviceType.Camera]
65029
- } } }
65326
+ } } },
65327
+ customize: motionCustomize
65030
65328
  };
65031
65329
  /**
65032
65330
  * Motion-trigger toggle for accessory devices.
@@ -68115,6 +68413,125 @@ var ptzAutotrackCapability = {
68115
68413
  */
68116
68414
  history: "none"
68117
68415
  };
68416
+ var RUNNING_POWER_START_DELAY_MS = 3e4;
68417
+ var RUNNING_POWER_STOP_DELAY_MS = 18e4;
68418
+ var RunningStateSourceSchema = zod.z.enum(["native", "assigned"]);
68419
+ var RunningStateStatusSchema = zod.z.object({
68420
+ /** null = unknown — never coerced to false (D393). */
68421
+ running: zod.z.boolean().nullable(),
68422
+ /** Epoch ms the current boolean began; null while `running` is null. */
68423
+ since: zod.z.number().nullable(),
68424
+ source: RunningStateSourceSchema,
68425
+ phase: zod.z.string().nullable(),
68426
+ /** null until a reading has been published (D393). */
68427
+ lastFetchedAt: zod.z.number().nullable()
68428
+ });
68429
+ var RunningFlipEventDataSchema = zod.z.object({
68430
+ deviceId: zod.z.number(),
68431
+ since: zod.z.number().nullable(),
68432
+ phase: zod.z.string().nullable()
68433
+ });
68434
+ var RUNNING_DEVICE_TYPES = Object.values(DeviceType);
68435
+ /** Generic Customize target for the running boolean (D936). */
68436
+ var runningCustomize = {
68437
+ version: 1,
68438
+ targets: [{
68439
+ id: "running",
68440
+ cardinality: "scalar",
68441
+ vocabulary: {
68442
+ cap: "running-state",
68443
+ stateField: "running"
68444
+ },
68445
+ deviceTypes: [
68446
+ DeviceType.Dishwasher,
68447
+ DeviceType.Vacuum,
68448
+ DeviceType.LawnMower,
68449
+ DeviceType.MediaPlayer,
68450
+ DeviceType.WaterHeater,
68451
+ DeviceType.Humidifier,
68452
+ DeviceType.Fan,
68453
+ DeviceType.Climate,
68454
+ DeviceType.Thermostat,
68455
+ DeviceType.PetFeeder
68456
+ ],
68457
+ apply: "add-or-replace",
68458
+ path: "running",
68459
+ sources: [
68460
+ {
68461
+ kind: "switch",
68462
+ transforms: [{ kind: "identity" }]
68463
+ },
68464
+ {
68465
+ kind: "binary",
68466
+ transforms: [{ kind: "identity" }, { kind: "invert" }]
68467
+ },
68468
+ {
68469
+ kind: "numeric",
68470
+ requiredUnit: "W",
68471
+ transforms: [{
68472
+ kind: "threshold",
68473
+ comparison: "gte",
68474
+ defaultThreshold: 5,
68475
+ defaultStartDwellMs: RUNNING_POWER_START_DELAY_MS,
68476
+ defaultStopDwellMs: RUNNING_POWER_STOP_DELAY_MS,
68477
+ thresholdUnit: "W"
68478
+ }]
68479
+ }
68480
+ ],
68481
+ companions: [
68482
+ {
68483
+ kind: "constant",
68484
+ path: "source",
68485
+ value: "assigned",
68486
+ when: "always"
68487
+ },
68488
+ {
68489
+ kind: "constant",
68490
+ path: "phase",
68491
+ value: null,
68492
+ when: "always"
68493
+ },
68494
+ {
68495
+ kind: "clock",
68496
+ path: "lastFetchedAt",
68497
+ when: "always"
68498
+ },
68499
+ {
68500
+ kind: "transition-time",
68501
+ path: "since",
68502
+ sourceChangedAt: "prefer"
68503
+ }
68504
+ ],
68505
+ sourceReport: {
68506
+ status: "assignment-status",
68507
+ runtimeField: "source",
68508
+ nativeValue: "native",
68509
+ assignedValue: "assigned"
68510
+ },
68511
+ advancedExpression: true
68512
+ }]
68513
+ };
68514
+ var runningStateCapability = {
68515
+ name: "running-state",
68516
+ scope: "device",
68517
+ deviceNative: true,
68518
+ mode: "singleton",
68519
+ deviceTypes: RUNNING_DEVICE_TYPES,
68520
+ methods: {},
68521
+ events: {
68522
+ onStarted: { data: RunningFlipEventDataSchema },
68523
+ onFinished: { data: RunningFlipEventDataSchema }
68524
+ },
68525
+ status: {
68526
+ schema: RunningStateStatusSchema,
68527
+ kind: "push"
68528
+ },
68529
+ runtimeState: RunningStateStatusSchema,
68530
+ durability: "restored",
68531
+ history: { fields: { running: { kind: "boolean" } } },
68532
+ volatileStateFields: ["lastFetchedAt"],
68533
+ customize: runningCustomize
68534
+ };
68118
68535
  /**
68119
68536
  * reboot — device-scoped capability for "soft" device reboots (firmware
68120
68537
  * reboot via vendor protocol; cameras, NVRs, doorbells). Surfaces a
@@ -74167,11 +74584,12 @@ function expressionOutcome(source, read, now, stateful) {
74167
74584
  return unavailable;
74168
74585
  }
74169
74586
  const deadlines = [];
74587
+ const hooks = {
74588
+ noteDeadline: (at) => deadlines.push(at),
74589
+ convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
74590
+ };
74170
74591
  const result = evaluateExpressionSource(source.expr, values, now, {
74171
- hooks: {
74172
- noteDeadline: (at) => deadlines.push(at),
74173
- convert: (value, from, to) => tryConvertUnit(value, normalizeUnit(from) ?? from, normalizeUnit(to) ?? to) ?? null
74174
- },
74592
+ hooks,
74175
74593
  ...stateful === void 0 ? {} : { invokeStateful: (invocation) => evaluateStatefulExpressionCall(stateful.callPathPrefix === void 0 ? invocation : {
74176
74594
  ...invocation,
74177
74595
  path: `${stateful.callPathPrefix}@${invocation.path}`
@@ -74179,7 +74597,7 @@ function expressionOutcome(source, read, now, stateful) {
74179
74597
  currentOutput: stateful.currentOutput,
74180
74598
  startedAtMs: stateful.startedAtMs,
74181
74599
  nowMs: now
74182
- }) }
74600
+ }, hooks) }
74183
74601
  });
74184
74602
  if (!result.ok) return {
74185
74603
  state: "unavailable",
@@ -74561,6 +74979,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
74561
74979
  ptzAutotrack: ptzAutotrackCapability,
74562
74980
  recordingOnboard: recordingOnboardCapability,
74563
74981
  recordingSignal: recordingSignalCapability,
74982
+ runningState: runningStateCapability,
74564
74983
  sceneMonitor: sceneMonitorCapability,
74565
74984
  scriptRunner: scriptRunnerCapability,
74566
74985
  smoke: smokeCapability,
@@ -83081,6 +83500,13 @@ var METHOD_ACCESS_MAP = Object.freeze({
83081
83500
  access: "create",
83082
83501
  role: "admin"
83083
83502
  },
83503
+ "runningState.getStatus": {
83504
+ capName: "running-state",
83505
+ capScope: "device",
83506
+ addonId: null,
83507
+ access: "view",
83508
+ role: "viewer"
83509
+ },
83084
83510
  "sceneMonitor.captureReference": {
83085
83511
  capName: "scene-monitor",
83086
83512
  capScope: "device",
@@ -87795,6 +88221,32 @@ var APPLIANCE_CAP_VOCABULARY = {
87795
88221
  }],
87796
88222
  events: { onSent: { notOperatorFacing: "a delivery receipt of a send this system made — not a fact about the world" } }
87797
88223
  },
88224
+ "running-state": {
88225
+ scope: "device",
88226
+ noun: t("Running", "In funzione"),
88227
+ state: [{
88228
+ kind: "boolean",
88229
+ field: "running",
88230
+ label: t("Running", "In funzione"),
88231
+ whenTrue: t("When {device} starts", "Quando {device} inizia"),
88232
+ whenFalse: t("When {device} finishes", "Quando {device} finisce"),
88233
+ icon: "play"
88234
+ }],
88235
+ events: {
88236
+ onStarted: {
88237
+ category: EventCategory.RunningStarted,
88238
+ label: t("Started running", "Ha iniziato a funzionare"),
88239
+ phrase: t("When {device} starts running", "Quando {device} inizia a funzionare"),
88240
+ icon: "play"
88241
+ },
88242
+ onFinished: {
88243
+ category: EventCategory.RunningFinished,
88244
+ label: t("Finished", "Ha finito"),
88245
+ phrase: t("When {device} finishes", "Quando {device} finisce"),
88246
+ icon: "square"
88247
+ }
88248
+ }
88249
+ },
87798
88250
  update: {
87799
88251
  scope: "device",
87800
88252
  noun: t("Firmware update", "Aggiornamento firmware"),
@@ -89130,6 +89582,7 @@ var CAP_NAMES_WITH_STATUS = [
89130
89582
  "recording-archive",
89131
89583
  "recording-onboard",
89132
89584
  "recording-signal",
89585
+ "running-state",
89133
89586
  "scene-monitor",
89134
89587
  "script-runner",
89135
89588
  "smoke",
@@ -89292,6 +89745,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
89292
89745
  recordingOnboardCapability,
89293
89746
  recordingSignalCapability,
89294
89747
  recordsCapability,
89748
+ runningStateCapability,
89295
89749
  sceneMonitorCapability,
89296
89750
  scriptRunnerCapability,
89297
89751
  serverManagementCapability,
@@ -91606,6 +92060,11 @@ Object.freeze({
91606
92060
  form: "single",
91607
92061
  optional: true
91608
92062
  }],
92063
+ "runningState.getStatus": [{
92064
+ name: "deviceId",
92065
+ form: "single",
92066
+ optional: false
92067
+ }],
91609
92068
  "sceneMonitor.captureReference": [{
91610
92069
  name: "deviceId",
91611
92070
  form: "single",
@@ -92105,7 +92564,7 @@ Object.freeze({
92105
92564
  });
92106
92565
  /**
92107
92566
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
92108
- * `runtimeState`. 71 caps: 37 `restored`, 34 `session`.
92567
+ * `runtimeState`. 72 caps: 38 `restored`, 34 `session`.
92109
92568
  *
92110
92569
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
92111
92570
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -92323,6 +92782,10 @@ var RUNTIME_STATE_POLICY = {
92323
92782
  durability: "session",
92324
92783
  volatileFields: []
92325
92784
  },
92785
+ "running-state": {
92786
+ durability: "restored",
92787
+ volatileFields: ["lastFetchedAt"]
92788
+ },
92326
92789
  "scene-monitor": {
92327
92790
  durability: "session",
92328
92791
  volatileFields: []
@@ -92413,7 +92876,7 @@ var SESSION_ONLY_POLICY = {
92413
92876
  };
92414
92877
  /**
92415
92878
  * Cap history catalog, projected from every `*.cap.ts` `history` block.
92416
- * 40 caps with series (73 series), 30 caps answered `'none'`.
92879
+ * 41 caps with series (74 series), 30 caps answered `'none'`.
92417
92880
  * Field keys are `runtimeState` paths (`a.b` into fixed objects only).
92418
92881
  */
92419
92882
  var HISTORY_CATALOG = {
@@ -92690,6 +93153,7 @@ var HISTORY_CATALOG = {
92690
93153
  unit: "hPa",
92691
93154
  deadband: .1
92692
93155
  } },
93156
+ "running-state": { "running": { kind: "boolean" } },
92693
93157
  "smoke": { "detected": { kind: "boolean" } },
92694
93158
  "stream-params": {
92695
93159
  "main.bitrate": {
@@ -92797,6 +93261,103 @@ var HISTORY_ITEM_CATALOG = { "consumables": {
92797
93261
  }
92798
93262
  }
92799
93263
  } };
93264
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.Camera, DeviceType.Hub, DeviceType.Light, DeviceType.Siren, DeviceType.Switch, DeviceType.Sensor, DeviceType.Thermostat, DeviceType.Climate, DeviceType.Button, DeviceType.EventEmitter, DeviceType.Update, DeviceType.Generic, DeviceType.Notifier, DeviceType.Script, DeviceType.Automation, DeviceType.Lock, DeviceType.Cover, DeviceType.Valve, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.Fan, DeviceType.MediaPlayer, DeviceType.AlarmPanel, DeviceType.Control, DeviceType.Presence, DeviceType.Weather, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.Container, DeviceType.Image, DeviceType.PetFeeder, DeviceType.Dishwasher, DeviceType.Camera, DeviceType.Camera, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
93265
+ /**
93266
+ * A saved Customize assignment (D936). The schema is the type: callers use
93267
+ * `z.infer`, they do not restate the shape.
93268
+ */
93269
+ var OverrideSourceSchema = zod.z.object({
93270
+ addonId: zod.z.string().min(1),
93271
+ stableId: zod.z.string().min(1),
93272
+ cap: zod.z.string().min(1),
93273
+ fieldPath: zod.z.string().min(1)
93274
+ });
93275
+ var IdentityTransformDraftSchema = zod.z.object({ kind: zod.z.literal("identity") });
93276
+ var InvertTransformDraftSchema = zod.z.object({ kind: zod.z.literal("invert") });
93277
+ var ThresholdTransformDraftSchema = zod.z.object({
93278
+ kind: zod.z.literal("threshold"),
93279
+ comparison: zod.z.enum(["gte", "lte"]),
93280
+ threshold: zod.z.number(),
93281
+ startDwellMs: zod.z.number().nonnegative(),
93282
+ stopDwellMs: zod.z.number().nonnegative()
93283
+ });
93284
+ var LinearTransformDraftSchema = zod.z.object({
93285
+ kind: zod.z.literal("linear"),
93286
+ scale: zod.z.number(),
93287
+ offset: zod.z.number(),
93288
+ clampMin: zod.z.number().optional(),
93289
+ clampMax: zod.z.number().optional()
93290
+ });
93291
+ var EnumMapTransformDraftSchema = zod.z.object({
93292
+ kind: zod.z.literal("enum-map"),
93293
+ mapping: zod.z.record(zod.z.string(), zod.z.string().nullable())
93294
+ });
93295
+ var NumberBridgeTransformDraftSchema = zod.z.object({ kind: zod.z.literal("number") });
93296
+ var CustomizeTransformDraftSchema = zod.z.discriminatedUnion("kind", [
93297
+ IdentityTransformDraftSchema,
93298
+ InvertTransformDraftSchema,
93299
+ ThresholdTransformDraftSchema,
93300
+ LinearTransformDraftSchema,
93301
+ EnumMapTransformDraftSchema,
93302
+ NumberBridgeTransformDraftSchema
93303
+ ]);
93304
+ var ScalarOverrideDraftSchema = zod.z.object({
93305
+ kind: zod.z.literal("scalar"),
93306
+ cap: zod.z.string().min(1),
93307
+ targetId: zod.z.string().min(1),
93308
+ source: OverrideSourceSchema,
93309
+ transform: CustomizeTransformDraftSchema
93310
+ });
93311
+ var KeyedArrayOverrideDraftSchema = zod.z.object({
93312
+ kind: zod.z.literal("keyedArray"),
93313
+ cap: zod.z.string().min(1),
93314
+ targetId: zod.z.string().min(1),
93315
+ key: zod.z.string().min(1),
93316
+ label: zod.z.string().min(1),
93317
+ fieldPath: zod.z.string().min(1),
93318
+ source: OverrideSourceSchema,
93319
+ transform: CustomizeTransformDraftSchema
93320
+ });
93321
+ var PulseOverrideDraftSchema = zod.z.object({
93322
+ kind: zod.z.literal("pulse"),
93323
+ cap: zod.z.string().min(1),
93324
+ targetId: zod.z.string().min(1),
93325
+ enabled: zod.z.boolean(),
93326
+ debounceMs: zod.z.number().nonnegative(),
93327
+ sources: zod.z.array(OverrideSourceSchema).min(1)
93328
+ });
93329
+ var SpanSourceDraftSchema = OverrideSourceSchema.extend({ mode: zod.z.enum([
93330
+ "in-addition",
93331
+ "confirm",
93332
+ "replace"
93333
+ ]).optional() });
93334
+ var SpanOverrideDraftSchema = zod.z.object({
93335
+ kind: zod.z.literal("span"),
93336
+ cap: zod.z.string().min(1),
93337
+ targetId: zod.z.string().min(1),
93338
+ timeoutMs: zod.z.number().nonnegative(),
93339
+ cooldownMs: zod.z.number().nonnegative().optional(),
93340
+ sources: zod.z.array(SpanSourceDraftSchema)
93341
+ });
93342
+ zod.z.discriminatedUnion("kind", [
93343
+ ScalarOverrideDraftSchema,
93344
+ KeyedArrayOverrideDraftSchema,
93345
+ PulseOverrideDraftSchema,
93346
+ SpanOverrideDraftSchema
93347
+ ]);
93348
+ zod.z.object({
93349
+ targetId: zod.z.string().min(1),
93350
+ configured: zod.z.boolean(),
93351
+ source: zod.z.enum(["native", "assigned"]),
93352
+ state: zod.z.enum([
93353
+ "active",
93354
+ "stale",
93355
+ "released",
93356
+ "unavailable"
93357
+ ]),
93358
+ reason: zod.z.string().nullable()
93359
+ });
93360
+ String.raw`rose\(active(\d+), changed(\d+), (\d+(?:\.\d+)?)\)`;
92800
93361
  var G711_SCALE_CORRECTION_DB = {
92801
93362
  PCMU: 20 * Math.log10(4),
92802
93363
  PCMA: 20 * Math.log10(8)
@@ -92849,40 +93410,7 @@ var NC_AUDIO_DEFAULTS = {
92849
93410
  samplingSeconds: 10
92850
93411
  };
92851
93412
  new Set(["devices", "classes"]);
92852
- /**
92853
- * WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
92854
- * consumed by the rule ENGINE and by every rule EDITOR.
92855
- *
92856
- * ── The failure this file exists for ───────────────────────────────────────
92857
- * `NcSystemEventConditionSchema` carries four optional narrowing lists
92858
- * (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
92859
- * `kinds` gate. They are not four filters over one vocabulary: each belongs to
92860
- * a FAMILY of kinds and is meaningless outside it. A node going away has no
92861
- * device type; a completed export has no package; `stream-offline` deliberately
92862
- * carries no device type at all (a stream belongs to a camera by construction).
92863
- *
92864
- * The engine applied all four to every kind, so a filter from one family failed
92865
- * a kind from another family CLOSED. The operator's live rule "Eventi di
92866
- * sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
92867
- * way to say "only my cameras" about the two liveness kinds — and NINE of the
92868
- * eleven silently stopped being deliverable. Four days of history contained
92869
- * `device-online` and `device-offline` and nothing else, across a window in
92870
- * which agents were restarted and addons were updated.
92871
- *
92872
- * Both editors already computed this scoping, to decide which filter boxes to
92873
- * render; the cap's own docblock already promised it ("Narrow a `device-*` kind
92874
- * to these device TYPES"). Only the engine disagreed, and it disagreed in the
92875
- * destructive direction. So the rule is stated ONCE, here, and the engine and
92876
- * the editors are readers of it rather than three independent authors.
92877
- *
92878
- * ── The direction ─────────────────────────────────────────────────────────
92879
- * Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
92880
- * hides a box has already told the operator this filter does not speak about
92881
- * these kinds, so honouring it as an exclusion contradicts the only
92882
- * explanation the operator was ever given. Inside its family the filter still
92883
- * narrows, and still fails CLOSED on a subject that cannot produce the identity
92884
- * it tests (a device the mirror cannot name is not evidence of a camera).
92885
- */
93413
+ new Set(NC_LEGACY_SYSTEM_EVENT_KINDS);
92886
93414
  /**
92887
93415
  * Every filter, for the callers that must cover all of them (guards, tests).
92888
93416
  *
@@ -92908,9 +93436,6 @@ new Map(Object.entries({
92908
93436
  "device-battery-normal": "device-events",
92909
93437
  "device-consumable-low": "device-events",
92910
93438
  "device-consumable-normal": "device-events",
92911
- "device-tank-low": "device-events",
92912
- "device-tank-full": "device-events",
92913
- "device-tank-normal": "device-events",
92914
93439
  "stream-online": "device-events",
92915
93440
  "stream-offline": "device-events",
92916
93441
  "detection-blind": "device-events",
@@ -92987,16 +93512,6 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
92987
93512
  label: "Consumables",
92988
93513
  kinds: ["device-consumable-low", "device-consumable-normal"]
92989
93514
  },
92990
- {
92991
- id: "tanks",
92992
- family: "device-events",
92993
- label: "Tanks",
92994
- kinds: [
92995
- "device-tank-low",
92996
- "device-tank-full",
92997
- "device-tank-normal"
92998
- ]
92999
- },
93000
93515
  {
93001
93516
  id: "detection-blind",
93002
93517
  family: "device-events",
@@ -93196,11 +93711,6 @@ var RULE_BODY_ONLY = ["body"];
93196
93711
  var RULE_TEXT = ["title", "body"];
93197
93712
  var BATTERY = ["device-battery-low", "device-battery-normal"];
93198
93713
  var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
93199
- var TANK = [
93200
- "device-tank-low",
93201
- "device-tank-full",
93202
- "device-tank-normal"
93203
- ];
93204
93714
  var ALERT_EPISODE = [
93205
93715
  "alert-critical",
93206
93716
  "alert-error",
@@ -93232,7 +93742,6 @@ var DEVICE_EVENTS = [
93232
93742
  "device-enabled",
93233
93743
  ...BATTERY,
93234
93744
  ...CONSUMABLE,
93235
- ...TANK,
93236
93745
  "stream-online",
93237
93746
  "stream-offline",
93238
93747
  "detection-blind",
@@ -93278,12 +93787,6 @@ var STATE_SUMMARY_SECTION_VARS = [
93278
93787
  example: "Robot — filter 10 %",
93279
93788
  kinds: CONSUMABLE
93280
93789
  },
93281
- {
93282
- name: "summaryTanks",
93283
- label: "Summary: tanks",
93284
- example: "Robot — clean water low",
93285
- kinds: TANK
93286
- },
93287
93790
  {
93288
93791
  name: "summaryDetection",
93289
93792
  label: "Summary: cameras detecting nothing",
@@ -93399,8 +93902,7 @@ var STATE_SUMMARY_VARS = [
93399
93902
  ([...RULE_TEXT], [...COMBINED_ALARM]),
93400
93903
  ([...RULE_TEXT], [...DEVICE_EVENTS]),
93401
93904
  ([...RULE_TEXT], [...BATTERY, ...CONSUMABLE]),
93402
- ([...RULE_TEXT], [...CONSUMABLE, ...TANK]),
93403
- ([...RULE_TEXT], [...TANK]),
93905
+ ([...RULE_TEXT], [...CONSUMABLE]),
93404
93906
  [...RULE_TEXT],
93405
93907
  ([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
93406
93908
  ([...RULE_TEXT], [...UPDATES, ...ALERT_EPISODE]),
@@ -93504,15 +94006,6 @@ new Map([
93504
94006
  snapshotLabel: "Consumables low now",
93505
94007
  snapshotSection: "consumables"
93506
94008
  },
93507
- {
93508
- id: "tanks",
93509
- family: "device-events",
93510
- label: "Tanks (low or full / back to normal)",
93511
- bad: ["device-tank-low", "device-tank-full"],
93512
- recovery: ["device-tank-normal"],
93513
- snapshotLabel: "Tanks low or full now",
93514
- snapshotSection: "tanks"
93515
- },
93516
94009
  {
93517
94010
  id: "motion-noise",
93518
94011
  family: "device-events",