@camstack/types 1.2.256 → 1.2.257

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -17196,6 +17196,9 @@ var NcSystemEventKindSchema = zod.z.enum([
17196
17196
  "device-battery-normal",
17197
17197
  "device-consumable-low",
17198
17198
  "device-consumable-normal",
17199
+ "device-tank-low",
17200
+ "device-tank-full",
17201
+ "device-tank-normal",
17199
17202
  "stream-online",
17200
17203
  "stream-offline",
17201
17204
  "node-online",
@@ -17276,6 +17279,31 @@ var NC_BATTERY_CONSUMABLE_SYSTEM_EVENT_KINDS = [
17276
17279
  "device-consumable-normal"
17277
17280
  ];
17278
17281
  /**
17282
+ * The two kinds a RULE's consumable threshold speaks about (D642). Named once:
17283
+ * the filter scoping (`systemEventFilterApplies`), the hub's threshold census
17284
+ * and both editors read it.
17285
+ */
17286
+ var NC_CONSUMABLE_SYSTEM_EVENT_KINDS = ["device-consumable-low", "device-consumable-normal"];
17287
+ /** A vacuum's tank alerts (D642) — raised on the provider's own verdict. */
17288
+ var NC_TANK_SYSTEM_EVENT_KINDS = [
17289
+ "device-tank-low",
17290
+ "device-tank-full",
17291
+ "device-tank-normal"
17292
+ ];
17293
+ /**
17294
+ * The consumable threshold a rule that does not state one judges at (D642).
17295
+ * The operator's number ("default 15 %, configurable on the rule"), and the
17296
+ * value the cluster-wide setting it replaces shipped with.
17297
+ */
17298
+ var NC_CONSUMABLE_LOW_PERCENT_DEFAULT = 15;
17299
+ /**
17300
+ * The highest consumable threshold a rule may state (D642 review M1): 100 minus
17301
+ * the band's 5-point recovery hysteresis (`consumable-band.ts`). Above it the
17302
+ * recovery point passes 100 % and an episode could never clear, even for a
17303
+ * part just replaced. A spec in the notification centre pins the sum.
17304
+ */
17305
+ var NC_CONSUMABLE_LOW_PERCENT_MAX = 95;
17306
+ /**
17279
17307
  * One coherent system-event condition. `kinds` is the required opt-in safety
17280
17308
  * gate; the remaining lists are optional narrowing filters relevant to the
17281
17309
  * selected kinds.
@@ -17309,8 +17337,27 @@ var NcSystemEventConditionSchema = zod.z.object({
17309
17337
  */
17310
17338
  excludeDeviceIds: zod.z.array(zod.z.number().int()).min(1).optional(),
17311
17339
  nodeIds: zod.z.array(zod.z.string().min(1)).min(1).optional(),
17312
- packageNames: zod.z.array(zod.z.string().min(1)).min(1).optional()
17313
- });
17340
+ packageNames: zod.z.array(zod.z.string().min(1)).min(1).optional(),
17341
+ /**
17342
+ * At or below this remaining-life %, a consumable is LOW for THIS rule
17343
+ * (D642). Absent = {@link NC_CONSUMABLE_LOW_PERCENT_DEFAULT}; at most
17344
+ * {@link NC_CONSUMABLE_LOW_PERCENT_MAX}, so every episode can recover. Scoped to the
17345
+ * consumable kinds (`systemEventFilterApplies`) and to the device-events
17346
+ * family; ignored on every other kind.
17347
+ *
17348
+ * It is a property of the RULE because the operator decided so: a rule at
17349
+ * 25 must be told about a filter at 20 %, a rule at 10 must not. The hub
17350
+ * keeps one episode per (threshold, device, item) — its own hysteresis, its
17351
+ * own reminder — and a rule hears only the episode judged at ITS threshold,
17352
+ * exactly as an occupancy rule hears only the edge of its own count. A
17353
+ * provider's own `replace` verdict is low at every threshold.
17354
+ */
17355
+ consumableLowPercent: zod.z.number().int().min(1).max(95).optional()
17356
+ });
17357
+ /** The consumable threshold a system-event condition judges at (D642). */
17358
+ function consumableLowPercentOf(condition) {
17359
+ return condition.consumableLowPercent ?? 15;
17360
+ }
17314
17361
  /**
17315
17362
  * `maxPerTrack` for `immediate` rules is FIXED at 1 (D-3): a single track
17316
17363
  * fires an immediate rule at most once, enforced durably by the outbox
@@ -18628,6 +18675,18 @@ var NC_CONDITION_CATALOG = [
18628
18675
  value: "device-consumable-normal",
18629
18676
  label: "Consumable replaced"
18630
18677
  },
18678
+ {
18679
+ value: "device-tank-low",
18680
+ label: "Tank low (water, detergent)"
18681
+ },
18682
+ {
18683
+ value: "device-tank-full",
18684
+ label: "Tank full (dirty water, dust)"
18685
+ },
18686
+ {
18687
+ value: "device-tank-normal",
18688
+ label: "Tank back to normal"
18689
+ },
18631
18690
  {
18632
18691
  value: "export-completed",
18633
18692
  label: "Export completed"
@@ -31774,12 +31833,20 @@ reset: require_sleep.method(zod.z.object({
31774
31833
  },
31775
31834
  runtimeState: ConsumablesStatusSchema.extend({ lastFetchedAt: zod.z.number() }),
31776
31835
  /**
31777
- * Runtime-state durability: **session** — the authority is the appliance; the provider re-reads the whole item array on connect.
31836
+ * Runtime-state durability: **restored** — nothing else holds the value
31837
+ * (D642). A consumable can often be read only in a device's wake window (the
31838
+ * Dreame mower's CMS counters answer only while it charges), so a restart
31839
+ * that wiped the slice left the panel empty and the alerts blind until the
31840
+ * next wake — 2026-09-26, mower 503 idle with `items: []`. A restored item is
31841
+ * the previous observation, not a claim about now; the provider overwrites it
31842
+ * the moment it reads the device again.
31778
31843
  *
31779
31844
  * See `RuntimeStateDurability`. Enforced by
31780
31845
  * `scripts/check-runtime-state-durability.ts`.
31781
31846
  */
31782
- durability: "session"
31847
+ durability: "restored",
31848
+ /** Clocks, not content: a re-read that changed no item costs no commit. */
31849
+ volatileStateFields: ["lastChangedAt", "lastFetchedAt"]
31783
31850
  };
31784
31851
  //#endregion
31785
31852
  //#region src/capabilities/contact.cap.ts
@@ -59039,7 +59106,7 @@ function getCapsByProviderKind(kind) {
59039
59106
  //#region src/generated/runtime-state-durability.ts
59040
59107
  /**
59041
59108
  * Per-cap runtime-state policy, projected from every `*.cap.ts` that declares
59042
- * `runtimeState`. 69 caps: 36 `restored`, 33 `session`.
59109
+ * `runtimeState`. 69 caps: 37 `restored`, 32 `session`.
59043
59110
  *
59044
59111
  * A cap absent from this map has no runtime-state slice at all. A cap PRESENT
59045
59112
  * with `durability: 'session'` has one and has decided not to keep it.
@@ -59098,8 +59165,8 @@ var RUNTIME_STATE_POLICY = {
59098
59165
  volatileFields: ["lastChangedAt"]
59099
59166
  },
59100
59167
  "consumables": {
59101
- durability: "session",
59102
- volatileFields: []
59168
+ durability: "restored",
59169
+ volatileFields: ["lastChangedAt", "lastFetchedAt"]
59103
59170
  },
59104
59171
  "contact": {
59105
59172
  durability: "restored",
@@ -59350,6 +59417,7 @@ var RESTORED_CAP_NAMES = [
59350
59417
  "binary",
59351
59418
  "carbon-monoxide",
59352
59419
  "connectivity",
59420
+ "consumables",
59353
59421
  "contact",
59354
59422
  "cover",
59355
59423
  "day-night",
@@ -60865,12 +60933,55 @@ function prepareNotification(caps, n) {
60865
60933
  }
60866
60934
  //#endregion
60867
60935
  //#region src/notification/system-event-filters.ts
60868
- /** Every filter, for the callers that must cover all four (guards, tests). */
60936
+ /**
60937
+ * WHICH narrowing filter speaks about WHICH system-event kind — one predicate,
60938
+ * consumed by the rule ENGINE and by every rule EDITOR.
60939
+ *
60940
+ * ── The failure this file exists for ───────────────────────────────────────
60941
+ * `NcSystemEventConditionSchema` carries four optional narrowing lists
60942
+ * (`deviceIds`, `deviceTypes`, `nodeIds`, `packageNames`) beside a required
60943
+ * `kinds` gate. They are not four filters over one vocabulary: each belongs to
60944
+ * a FAMILY of kinds and is meaningless outside it. A node going away has no
60945
+ * device type; a completed export has no package; `stream-offline` deliberately
60946
+ * carries no device type at all (a stream belongs to a camera by construction).
60947
+ *
60948
+ * The engine applied all four to every kind, so a filter from one family failed
60949
+ * a kind from another family CLOSED. The operator's live rule "Eventi di
60950
+ * sistema" selected eleven kinds and set `deviceTypes: ['camera']` — the only
60951
+ * way to say "only my cameras" about the two liveness kinds — and NINE of the
60952
+ * eleven silently stopped being deliverable. Four days of history contained
60953
+ * `device-online` and `device-offline` and nothing else, across a window in
60954
+ * which agents were restarted and addons were updated.
60955
+ *
60956
+ * Both editors already computed this scoping, to decide which filter boxes to
60957
+ * render; the cap's own docblock already promised it ("Narrow a `device-*` kind
60958
+ * to these device TYPES"). Only the engine disagreed, and it disagreed in the
60959
+ * destructive direction. So the rule is stated ONCE, here, and the engine and
60960
+ * the editors are readers of it rather than three independent authors.
60961
+ *
60962
+ * ── The direction ─────────────────────────────────────────────────────────
60963
+ * Out of family ⇒ the filter is IGNORED, never fail-closed. An editor that
60964
+ * hides a box has already told the operator this filter does not speak about
60965
+ * these kinds, so honouring it as an exclusion contradicts the only
60966
+ * explanation the operator was ever given. Inside its family the filter still
60967
+ * narrows, and still fails CLOSED on a subject that cannot produce the identity
60968
+ * it tests (a device the mirror cannot name is not evidence of a camera).
60969
+ */
60970
+ /**
60971
+ * Every filter, for the callers that must cover all of them (guards, tests).
60972
+ *
60973
+ * `consumableLowPercent` (D642) is not a list but it is a filter in exactly
60974
+ * this sense: it belongs to a family of kinds (the consumable pair) and the
60975
+ * engine consults it only there. It differs in one way the readers must know —
60976
+ * its ABSENCE is not "no narrowing" but the default threshold, because a
60977
+ * consumable episode is always judged at SOME threshold.
60978
+ */
60869
60979
  var NC_SYSTEM_EVENT_FILTER_KEYS = [
60870
60980
  "deviceIds",
60871
60981
  "deviceTypes",
60872
60982
  "nodeIds",
60873
- "packageNames"
60983
+ "packageNames",
60984
+ "consumableLowPercent"
60874
60985
  ];
60875
60986
  /**
60876
60987
  * Does `filter` say anything about `kind`?
@@ -60884,6 +60995,7 @@ function systemEventFilterApplies(kind, filter) {
60884
60995
  case "deviceTypes": return kind.startsWith("device-") || kind === "detection-blind";
60885
60996
  case "nodeIds": return kind.startsWith("node-") || kind === "addon-crash-loop" || kind === "addon-update-available" || kind === "addon-updated" || kind === "server-update-available" || kind === "wrapper-update-available" || kind === "server-updated";
60886
60997
  case "packageNames": return kind.endsWith("update-available") || kind === "addon-updated" || kind === "server-updated";
60998
+ case "consumableLowPercent": return NC_CONSUMABLE_SYSTEM_EVENT_KINDS.includes(kind);
60887
60999
  }
60888
61000
  }
60889
61001
  /**
@@ -60932,6 +61044,9 @@ var NC_SYSTEM_EVENT_FAMILY = {
60932
61044
  "device-battery-normal": "device-events",
60933
61045
  "device-consumable-low": "device-events",
60934
61046
  "device-consumable-normal": "device-events",
61047
+ "device-tank-low": "device-events",
61048
+ "device-tank-full": "device-events",
61049
+ "device-tank-normal": "device-events",
60935
61050
  "stream-online": "device-events",
60936
61051
  "stream-offline": "device-events",
60937
61052
  "detection-blind": "device-events",
@@ -60964,7 +61079,7 @@ var NC_SYSTEM_EVENT_FAMILY = {
60964
61079
  var FAMILY_BY_NAME = new Map(Object.entries(NC_SYSTEM_EVENT_FAMILY));
60965
61080
  var NC_SYSTEM_EVENT_CONDITION_FILTER_KEYS = [...NC_SYSTEM_EVENT_FILTER_KEYS, "excludeDeviceIds"];
60966
61081
  /**
60967
- * The filters a family may carry. The four base filters are the union of
61082
+ * The filters a family may carry. The base filters are the union of
60968
61083
  * `systemEventFilterApplies` over the family's kinds (the spec pins that
60969
61084
  * equality). `excludeDeviceIds` is a device-events filter only: an alarm is
60970
61085
  * narrowed to the camera that triggered it and excludes nothing.
@@ -60973,7 +61088,8 @@ var NC_SYSTEM_EVENT_FAMILY_FILTERS = {
60973
61088
  "device-events": [
60974
61089
  "deviceIds",
60975
61090
  "excludeDeviceIds",
60976
- "deviceTypes"
61091
+ "deviceTypes",
61092
+ "consumableLowPercent"
60977
61093
  ],
60978
61094
  system: ["nodeIds", "packageNames"],
60979
61095
  alarm: ["deviceIds"]
@@ -61008,6 +61124,16 @@ var NC_SYSTEM_EVENT_KIND_GROUP_SPECS = [
61008
61124
  label: "Consumables",
61009
61125
  kinds: ["device-consumable-low", "device-consumable-normal"]
61010
61126
  },
61127
+ {
61128
+ id: "tanks",
61129
+ family: "device-events",
61130
+ label: "Tanks",
61131
+ kinds: [
61132
+ "device-tank-low",
61133
+ "device-tank-full",
61134
+ "device-tank-normal"
61135
+ ]
61136
+ },
61011
61137
  {
61012
61138
  id: "detection-blind",
61013
61139
  family: "device-events",
@@ -61746,6 +61872,11 @@ var RULE_BODY_ONLY = ["body"];
61746
61872
  var RULE_TEXT = ["title", "body"];
61747
61873
  var BATTERY = ["device-battery-low", "device-battery-normal"];
61748
61874
  var CONSUMABLE = ["device-consumable-low", "device-consumable-normal"];
61875
+ var TANK = [
61876
+ "device-tank-low",
61877
+ "device-tank-full",
61878
+ "device-tank-normal"
61879
+ ];
61749
61880
  var UPDATES = [
61750
61881
  "addon-update-available",
61751
61882
  "server-update-available",
@@ -61771,6 +61902,7 @@ var DEVICE_EVENTS = [
61771
61902
  "device-enabled",
61772
61903
  ...BATTERY,
61773
61904
  ...CONSUMABLE,
61905
+ ...TANK,
61774
61906
  "stream-online",
61775
61907
  "stream-offline",
61776
61908
  "detection-blind",
@@ -62068,6 +62200,17 @@ var NC_TEMPLATE_VARS = [
62068
62200
  kinds: ["system"],
62069
62201
  systemEventKinds: [...CONSUMABLE]
62070
62202
  },
62203
+ {
62204
+ name: "tank",
62205
+ label: "Tank",
62206
+ description: "Which tank: clean water, dirty water, detergent or dust bin.",
62207
+ example: "clean water",
62208
+ group: "system",
62209
+ families: ["rule"],
62210
+ fields: [...RULE_TEXT],
62211
+ kinds: ["system"],
62212
+ systemEventKinds: [...TANK]
62213
+ },
62071
62214
  {
62072
62215
  name: "profile",
62073
62216
  label: "Stream profile",
@@ -62460,6 +62603,38 @@ var NC_TEMPLATE_VARS = [
62460
62603
  fields: [...RULE_TEXT]
62461
62604
  }
62462
62605
  ];
62606
+ /**
62607
+ * System-event kinds the SERVED catalog holds back (D642): the kinds the hub
62608
+ * produces before the installed viewers can parse them.
62609
+ *
62610
+ * The viewer parses `getTemplateCatalog` WHOLE, with its own strict
62611
+ * `NcSystemEventKindSchema` on every descriptor's `systemEventKinds`, so one
62612
+ * kind it does not know — in `{{deviceName}}`, which every device event names —
62613
+ * empties every {{var}} picker on every phone (the same trap
62614
+ * `NcTemplateVarKindSchema` froze the rule kinds for). The in-process catalog
62615
+ * keeps them: the producer parity and the preview render read it.
62616
+ *
62617
+ * SELF-EXPIRING: `scripts/check-nc-mirrors-in-sync.ts` reads this list as the
62618
+ * viewer's allowance and fails the day the viewer mirrors one of these kinds —
62619
+ * delete it from here then, and the served catalog names it again.
62620
+ */
62621
+ var NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = [
62622
+ "device-tank-low",
62623
+ "device-tank-full",
62624
+ "device-tank-normal"
62625
+ ];
62626
+ /**
62627
+ * The catalog as `getTemplateCatalog` SERVES it: every descriptor, with the
62628
+ * held-back kinds removed from its `systemEventKinds`. A descriptor that named
62629
+ * only held-back kinds is served with an empty list — offered to no system
62630
+ * rule an installed viewer can author, which is exactly true.
62631
+ */
62632
+ function servedTemplateVars() {
62633
+ return NC_TEMPLATE_VARS.map((d) => d.systemEventKinds === void 0 ? d : {
62634
+ ...d,
62635
+ systemEventKinds: d.systemEventKinds.filter((kind) => !NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS.includes(kind))
62636
+ });
62637
+ }
62463
62638
  /** The caption fields see a fixed, smaller vocabulary (`timelapsePreviewText`,
62464
62639
  * `summaryCaptionText`). Declared here rather than as `fields` on every
62465
62640
  * descriptor so the whole rule stays in one line of code. */
@@ -66179,6 +66354,9 @@ exports.NC_CONFIRM_DEFAULT_MAX_IMAGE_PX = NC_CONFIRM_DEFAULT_MAX_IMAGE_PX;
66179
66354
  exports.NC_CONFIRM_DEFAULT_TIMEOUT_MS = NC_CONFIRM_DEFAULT_TIMEOUT_MS;
66180
66355
  exports.NC_CONFIRM_MAX_TIMEOUT_MS = NC_CONFIRM_MAX_TIMEOUT_MS;
66181
66356
  exports.NC_CONFIRM_MIN_TIMEOUT_MS = NC_CONFIRM_MIN_TIMEOUT_MS;
66357
+ exports.NC_CONSUMABLE_LOW_PERCENT_DEFAULT = NC_CONSUMABLE_LOW_PERCENT_DEFAULT;
66358
+ exports.NC_CONSUMABLE_LOW_PERCENT_MAX = NC_CONSUMABLE_LOW_PERCENT_MAX;
66359
+ exports.NC_CONSUMABLE_SYSTEM_EVENT_KINDS = NC_CONSUMABLE_SYSTEM_EVENT_KINDS;
66182
66360
  exports.NC_DEFAULT_SNOOZE_MINUTES = NC_DEFAULT_SNOOZE_MINUTES;
66183
66361
  exports.NC_HISTORY_LIMIT_DEFAULT = NC_HISTORY_LIMIT_DEFAULT;
66184
66362
  exports.NC_HISTORY_LIMIT_MAX = NC_HISTORY_LIMIT_MAX;
@@ -66202,7 +66380,9 @@ exports.NC_SYSTEM_EVENT_FAMILY_FILTERS = NC_SYSTEM_EVENT_FAMILY_FILTERS;
66202
66380
  exports.NC_SYSTEM_EVENT_FILTER_KEYS = NC_SYSTEM_EVENT_FILTER_KEYS;
66203
66381
  exports.NC_SYSTEM_EVENT_KIND_GROUP_SPECS = NC_SYSTEM_EVENT_KIND_GROUP_SPECS;
66204
66382
  exports.NC_SYSTEM_RULE_KINDS = NC_SYSTEM_RULE_KINDS;
66383
+ exports.NC_TANK_SYSTEM_EVENT_KINDS = NC_TANK_SYSTEM_EVENT_KINDS;
66205
66384
  exports.NC_TAXONOMY = NC_TAXONOMY;
66385
+ exports.NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS = NC_TEMPLATE_HELD_BACK_SYSTEM_EVENT_KINDS;
66206
66386
  exports.NC_TEMPLATE_VARS = NC_TEMPLATE_VARS;
66207
66387
  exports.NC_UPDATE_EVENT_PACKAGE_NAMES = NC_UPDATE_EVENT_PACKAGE_NAMES;
66208
66388
  exports.NETWORK_LINK_TYPES = NETWORK_LINK_TYPES;
@@ -66851,6 +67031,7 @@ exports.conditionExclusionReason = conditionExclusionReason;
66851
67031
  exports.conditionVisibleForKind = conditionVisibleForKind;
66852
67032
  exports.connectionTestCapability = connectionTestCapability;
66853
67033
  exports.connectivityCapability = connectivityCapability;
67034
+ exports.consumableLowPercentOf = consumableLowPercentOf;
66854
67035
  exports.consumablesCapability = consumablesCapability;
66855
67036
  exports.contactCapability = contactCapability;
66856
67037
  exports.controlCapability = controlCapability;
@@ -67199,6 +67380,7 @@ exports.selectAssignedProfileSlots = require_sleep.selectAssignedProfileSlots;
67199
67380
  exports.sensorRaisedOf = sensorRaisedOf;
67200
67381
  exports.sensorTransitionNeverFires = sensorTransitionNeverFires;
67201
67382
  exports.sensorTransitionOffered = sensorTransitionOffered;
67383
+ exports.servedTemplateVars = servedTemplateVars;
67202
67384
  exports.serverManagementCapability = serverManagementCapability;
67203
67385
  exports.setByPath = setByPath;
67204
67386
  exports.settingsStoreCapability = settingsStoreCapability;