@camstack/types 1.2.267 → 1.2.269

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 (69) hide show
  1. package/dist/addon.js +4 -4
  2. package/dist/addon.mjs +3 -3
  3. package/dist/capabilities/battery.cap.d.ts +17 -2
  4. package/dist/capabilities/capability-definition.d.ts +30 -1
  5. package/dist/capabilities/composer.cap.d.ts +105 -0
  6. package/dist/capabilities/consumables.cap.d.ts +79 -0
  7. package/dist/capabilities/core-blocks.cap.d.ts +1213 -104
  8. package/dist/capabilities/device-extension.cap.d.ts +12 -13
  9. package/dist/capabilities/device-manager.cap.d.ts +4 -4
  10. package/dist/capabilities/device-state.cap.d.ts +186 -2
  11. package/dist/capabilities/doorbell.cap.d.ts +4 -0
  12. package/dist/capabilities/index.d.ts +3 -3
  13. package/dist/capabilities/media-player.cap.d.ts +4 -4
  14. package/dist/capabilities/recording-archive.cap.d.ts +3 -3
  15. package/dist/catalogs/sensor-active-state.d.ts +25 -1
  16. package/dist/composition/composition-events.d.ts +42 -0
  17. package/dist/composition/composition-graph.d.ts +42 -9
  18. package/dist/composition/composition-items.d.ts +25 -0
  19. package/dist/composition/composition-report.d.ts +115 -12
  20. package/dist/composition/composition.d.ts +162 -3
  21. package/dist/composition/customization-name.d.ts +6 -0
  22. package/dist/composition/evaluate-field.d.ts +20 -0
  23. package/dist/composition/examples.d.ts +33 -0
  24. package/dist/composition/expression-kinds.d.ts +1 -0
  25. package/dist/composition/field-kinds.d.ts +42 -0
  26. package/dist/composition/index.d.ts +2 -0
  27. package/dist/composition/plan-result.d.ts +18 -0
  28. package/dist/composition/state-fields.d.ts +6 -0
  29. package/dist/composition/validate-composition.d.ts +44 -9
  30. package/dist/composition-BAH3n-zq.js +2582 -0
  31. package/dist/composition-D5BQywfe.mjs +2055 -0
  32. package/dist/device/device-context.d.ts +9 -0
  33. package/dist/device/device-runtime-state.d.ts +15 -1
  34. package/dist/device/index.d.ts +1 -1
  35. package/dist/device-extension/slot-descriptor.d.ts +8 -11
  36. package/dist/device-extension/slot-provider.d.ts +0 -2
  37. package/dist/enums/event-category.d.ts +25 -0
  38. package/dist/enums.js +1 -1
  39. package/dist/enums.mjs +1 -1
  40. package/dist/err-msg-DX6i_MY4.mjs +339 -0
  41. package/dist/err-msg-Dx2Kor0g.js +368 -0
  42. package/dist/{event-category-BVDXG4tB.mjs → event-category-C5xZWqz6.mjs} +31 -1
  43. package/dist/{event-category-BVfsrBYA.js → event-category-MbnB-6AN.js} +48 -0
  44. package/dist/expression/ast.d.ts +2 -0
  45. package/dist/expression/builtins.d.ts +9 -0
  46. package/dist/expression/evaluator.d.ts +8 -2
  47. package/dist/expression/expression-source.d.ts +26 -4
  48. package/dist/expression/index.d.ts +6 -6
  49. package/dist/generated/addon-api.d.ts +42 -0
  50. package/dist/generated/device-proxy.d.ts +1 -1
  51. package/dist/generated/method-access-map.d.ts +1 -1
  52. package/dist/generated/method-device-selectors.d.ts +2 -2
  53. package/dist/generated/system-proxy.d.ts +2 -2
  54. package/dist/index.d.ts +7 -6
  55. package/dist/index.js +1687 -1833
  56. package/dist/index.mjs +1359 -1550
  57. package/dist/interfaces/kernel-abstractions.d.ts +16 -0
  58. package/dist/interfaces/recording-config.d.ts +3 -3
  59. package/dist/interfaces/status-overlay.d.ts +42 -0
  60. package/dist/node.d.ts +1 -0
  61. package/dist/node.js +29 -8
  62. package/dist/node.mjs +23 -3
  63. package/dist/{sleep-8K9gue-H.js → sleep-Bg0IB7gg.js} +10 -367
  64. package/dist/{sleep-DC-wdyeS.mjs → sleep-E6eD4yQS.mjs} +11 -344
  65. package/package.json +1 -1
  66. package/dist/canonical-hash-CPK2Dy60.mjs +0 -715
  67. package/dist/canonical-hash-CSE4ioRi.js +0 -792
  68. package/dist/err-msg-COpsHMw2.js +0 -18
  69. package/dist/err-msg-IQTHeDzc.mjs +0 -13
@@ -0,0 +1,368 @@
1
+ //#region src/device/device-type.ts
2
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
3
+ DeviceType["Camera"] = "camera";
4
+ DeviceType["Hub"] = "hub";
5
+ DeviceType["Light"] = "light";
6
+ DeviceType["Siren"] = "siren";
7
+ DeviceType["Switch"] = "switch";
8
+ DeviceType["Sensor"] = "sensor";
9
+ DeviceType["Thermostat"] = "thermostat";
10
+ /** Air-conditioner / heat-pump climate device (HVAC) — shares the
11
+ * `climate-control` cap surface with `Thermostat` but renders a
12
+ * dedicated AC-appropriate control UI (mode chips, fan speed,
13
+ * independent vertical/horizontal swing). Sources: native Gree, and
14
+ * reusable by other AC integrations. */
15
+ DeviceType["Climate"] = "climate";
16
+ DeviceType["Button"] = "button";
17
+ /** Generic stateless event emitter — carries a device's EXACT declared
18
+ * event vocabulary verbatim (no normalization). Installed with the
19
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
20
+ * HA bus events (e.g. `zha_event`, generic). */
21
+ DeviceType["EventEmitter"] = "event-emitter";
22
+ /** Firmware/software update entity — current vs available version,
23
+ * updatable flag, update state, and an install action. Installed with
24
+ * the `update` cap. Sources: Homematic firmware-update channels (and
25
+ * reusable by other providers, e.g. HA `update.*` entities). */
26
+ DeviceType["Update"] = "update";
27
+ DeviceType["Generic"] = "generic";
28
+ /** Generic notification delivery target (HA `notify.<service>`, future
29
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
30
+ * endpoint; the `notifier` cap defines the send surface. */
31
+ DeviceType["Notifier"] = "notifier";
32
+ /** Pre-recorded action sequence with optional parameters
33
+ * (HA `script.*`). Runnable via `script-runner` cap. */
34
+ DeviceType["Script"] = "script";
35
+ /** Automation rule (HA `automation.*`) — enable/disable + manual
36
+ * trigger surface exposed via `automation-control` cap. */
37
+ DeviceType["Automation"] = "automation";
38
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
39
+ DeviceType["Lock"] = "lock";
40
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
41
+ * `valve.*`). `cover` cap with sub-roles for variant. */
42
+ DeviceType["Cover"] = "cover";
43
+ /** Pipe / water / gas valve with open/close/stop and optional
44
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
45
+ * modelled on the same open/closed lifecycle. */
46
+ DeviceType["Valve"] = "valve";
47
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
48
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
49
+ * modelled on the same target / mode lifecycle. */
50
+ DeviceType["Humidifier"] = "humidifier";
51
+ /** Water heater / boiler with target temperature + operation mode +
52
+ * away mode (HA `water_heater.*`). `water-heater` cap — a
53
+ * climate-family actuator. */
54
+ DeviceType["WaterHeater"] = "water-heater";
55
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
56
+ DeviceType["Fan"] = "fan";
57
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
58
+ * the camera surface — those use `Camera`. `media-player` cap. */
59
+ DeviceType["MediaPlayer"] = "media-player";
60
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
61
+ * `alarm-panel` cap. */
62
+ DeviceType["AlarmPanel"] = "alarm-panel";
63
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
64
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
65
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
66
+ * TextControl / DateTimeControl. */
67
+ DeviceType["Control"] = "control";
68
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
69
+ * `presence` cap. */
70
+ DeviceType["Presence"] = "presence";
71
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
72
+ * `weather` cap. */
73
+ DeviceType["Weather"] = "weather";
74
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
75
+ DeviceType["Vacuum"] = "vacuum";
76
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
77
+ * `lawn-mower-control` cap. */
78
+ DeviceType["LawnMower"] = "lawn-mower";
79
+ /** Physical HA device group — parent container for entity-children
80
+ * adopted from a single HA device entry. Not renderable as a
81
+ * standalone device; exists only to anchor child entities. */
82
+ DeviceType["Container"] = "container";
83
+ /** Single still-image entity (HA `image.*`). Read-only display of an
84
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
85
+ DeviceType["Image"] = "image";
86
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
87
+ * level, battery, desiccant life, feeding state and manual-feed /
88
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
89
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
90
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
91
+ * integrations sharing the same food/desiccant/hopper surface. */
92
+ DeviceType["PetFeeder"] = "pet-feeder";
93
+ return DeviceType;
94
+ }({});
95
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
96
+ DeviceFeature["BatteryOperated"] = "battery-operated";
97
+ DeviceFeature["Rebootable"] = "rebootable";
98
+ /**
99
+ * Device supports an on-demand re-sync of its derived spec with its
100
+ * upstream source — drives the generic Re-sync button. The owning
101
+ * provider implements the action via the `device-adoption.resync` cap.
102
+ */
103
+ DeviceFeature["Resyncable"] = "resyncable";
104
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
105
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
106
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
107
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
108
+ /**
109
+ * Camera supports the on-firmware autotrack subsystem (subject-
110
+ * following). Distinct from `PanTiltZoom` because not every PTZ
111
+ * camera ships autotrack — the admin UI uses this flag to gate
112
+ * the autotrack toggle / settings card without re-deriving from
113
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
114
+ * driver sets this feature when probe confirms the firmware
115
+ * surface, and registers the cap in the same code path.
116
+ */
117
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
118
+ /**
119
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
120
+ * motion detection automatically activates this device. Mirrors
121
+ * `motion-trigger` cap registration: drivers set this feature in the
122
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
123
+ *
124
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
125
+ * fast scalar without binding fetch), notifier rules, and `listAll`
126
+ * filters that want "all devices with on-motion behaviour".
127
+ */
128
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
129
+ /** Light supports rgb-triplet color via `color` cap. */
130
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
131
+ /** Light supports HSV color via `color` cap. */
132
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
133
+ /** Light supports color-temperature (mired) via `color` cap. */
134
+ DeviceFeature["LightColorMired"] = "light-color-mired";
135
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
136
+ * targetHigh). Gates the range slider UI. */
137
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
138
+ /** Thermostat exposes target humidity and/or current humidity
139
+ * readings. Gates the humidity controls. */
140
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
141
+ /** Thermostat exposes a fan-mode selector. */
142
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
143
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
144
+ DeviceFeature["ClimatePreset"] = "climate-preset";
145
+ /** Thermostat exposes a vertical louver swing toggle. Gates the
146
+ * vertical-swing switch in the climate UI. Independent of horizontal. */
147
+ DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
148
+ /** Thermostat exposes a horizontal louver swing toggle. Gates the
149
+ * horizontal-swing switch in the climate UI. Independent of vertical. */
150
+ DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
151
+ /** Cover exposes intermediate position control (0..100). Gates the
152
+ * position slider UI. */
153
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
154
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
155
+ DeviceFeature["CoverTilt"] = "cover-tilt";
156
+ /** Valve exposes intermediate position control (0..100). Gates the
157
+ * position slider / drag surface UI. */
158
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
159
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
160
+ DeviceFeature["FanSpeed"] = "fan-speed";
161
+ /** Fan exposes a preset mode selector. */
162
+ DeviceFeature["FanPreset"] = "fan-preset";
163
+ /** Fan exposes blade direction (forward/reverse) — typical of
164
+ * ceiling fans. */
165
+ DeviceFeature["FanDirection"] = "fan-direction";
166
+ /** Fan exposes an oscillation toggle. */
167
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
168
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
169
+ * field on the UI lock-controls panel. */
170
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
171
+ /** Lock supports a latch-release ("open door") action distinct from
172
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
173
+ * `supported_features`. Gates the Open Door button in the UI. */
174
+ DeviceFeature["LockOpen"] = "lock-open";
175
+ /** Media player exposes a seek-to-position surface. */
176
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
177
+ /** Media player exposes a volume-level setter. */
178
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
179
+ /** Media player exposes a mute toggle distinct from volume=0. */
180
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
181
+ /** Media player exposes a shuffle toggle. */
182
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
183
+ /** Media player exposes a repeat mode (off / all / one). */
184
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
185
+ /** Media player exposes a source / input selector. */
186
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
187
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
188
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
189
+ /** Media player exposes next-track. */
190
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
191
+ /** Media player exposes previous-track. */
192
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
193
+ /** Media player exposes stop distinct from pause. */
194
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
195
+ /** Alarm panel requires a PIN code on arm/disarm. */
196
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
197
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
198
+ * addition to a textual location. */
199
+ DeviceFeature["PresenceGps"] = "presence-gps";
200
+ /** Notifier accepts an inline / URL image attachment. */
201
+ DeviceFeature["NotifierImage"] = "notifier-image";
202
+ /** Notifier accepts a priority hint (high/normal/low). */
203
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
204
+ /** Notifier accepts a free-form `data` payload for platform-specific
205
+ * fields. */
206
+ DeviceFeature["NotifierData"] = "notifier-data";
207
+ /** Notifier supports interactive action buttons / callbacks. */
208
+ DeviceFeature["NotifierActions"] = "notifier-actions";
209
+ /** Notifier supports per-call recipient targeting (multi-user). */
210
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
211
+ /** Script runner accepts a variables map on each run invocation. */
212
+ DeviceFeature["ScriptVariables"] = "script-variables";
213
+ /** Automation `trigger` accepts a skipCondition flag — fires the
214
+ * automation's actions while bypassing its condition block. */
215
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
216
+ /** Robot vacuum exposes a live cleaning map (image child). Gates the
217
+ * map tile in the vacuum UI. */
218
+ DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
219
+ /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
220
+ * switches group. */
221
+ DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
222
+ /** Robot mower exposes a live mowing map (SVG image child). Gates the
223
+ * mower map tile. */
224
+ DeviceFeature["MowerHasMap"] = "mower-has-map";
225
+ /** Robot mower exposes targeted mowing (all-area / zones / edges /
226
+ * spots) — gates the Mow action + map selectors. */
227
+ DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
228
+ return DeviceFeature;
229
+ }({});
230
+ var ChargingStatus = /* @__PURE__ */ function(ChargingStatus) {
231
+ ChargingStatus["ChargingDC"] = "charging-dc";
232
+ ChargingStatus["ChargingSolar"] = "charging-solar";
233
+ ChargingStatus["NotCharging"] = "not-charging";
234
+ return ChargingStatus;
235
+ }({});
236
+ /**
237
+ * Semantic role a device plays within its parent. Populated by driver
238
+ * addons when creating accessory devices (Reolink siren/floodlight/
239
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
240
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
241
+ * `role: Floodlight` renders as a bulb with a brightness slider,
242
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
243
+ *
244
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
245
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
246
+ */
247
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
248
+ DeviceRole["Siren"] = "siren";
249
+ DeviceRole["Floodlight"] = "floodlight";
250
+ DeviceRole["Spotlight"] = "spotlight";
251
+ DeviceRole["PirSensor"] = "pir-sensor";
252
+ DeviceRole["Chime"] = "chime";
253
+ DeviceRole["Autotrack"] = "autotrack";
254
+ DeviceRole["Nightvision"] = "nightvision";
255
+ DeviceRole["PrivacyMask"] = "privacy-mask";
256
+ DeviceRole["Doorbell"] = "doorbell";
257
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
258
+ * real Switch device for UI rendering / export adapters. */
259
+ DeviceRole["BinaryHelper"] = "binary-helper";
260
+ /** Generic motion / occupancy / moving event source. Distinct from
261
+ * the camera accessory PirSensor role: that one is a camera child;
262
+ * this is a standalone HA / 3rd-party motion sensor. */
263
+ DeviceRole["MotionSensor"] = "motion-sensor";
264
+ DeviceRole["ContactSensor"] = "contact-sensor";
265
+ DeviceRole["LeakSensor"] = "leak-sensor";
266
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
267
+ DeviceRole["COSensor"] = "co-sensor";
268
+ DeviceRole["GasSensor"] = "gas-sensor";
269
+ DeviceRole["TamperSensor"] = "tamper-sensor";
270
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
271
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
272
+ DeviceRole["SoundSensor"] = "sound-sensor";
273
+ /** Fallback for `binary_sensor` without a known `device_class`. */
274
+ DeviceRole["BinarySensor"] = "binary-sensor";
275
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
276
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
277
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
278
+ DeviceRole["PressureSensor"] = "pressure-sensor";
279
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
280
+ DeviceRole["WindSensor"] = "wind-sensor";
281
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
282
+ DeviceRole["RainSensor"] = "rain-sensor";
283
+ /** UV index (weather-station `uv-sensor` cap). */
284
+ DeviceRole["UvSensor"] = "uv-sensor";
285
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
286
+ * Distinct from AmbientLightSensor (lux). */
287
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
288
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
289
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
290
+ DeviceRole["PowerSensor"] = "power-sensor";
291
+ DeviceRole["EnergySensor"] = "energy-sensor";
292
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
293
+ DeviceRole["CurrentSensor"] = "current-sensor";
294
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
295
+ /** Battery level (numeric % via `sensor` OR low-bool via
296
+ * `binary_sensor` — the cap distinguishes via the value type). */
297
+ DeviceRole["BatterySensor"] = "battery-sensor";
298
+ /** Fallback for `sensor` numeric without a known `device_class`. */
299
+ DeviceRole["NumericSensor"] = "numeric-sensor";
300
+ /** String / enum state (HA `sensor` with `state_class: enum` or
301
+ * `attributes.options`). */
302
+ DeviceRole["EnumSensor"] = "enum-sensor";
303
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
304
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
305
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
306
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
307
+ /** Last-resort fallback when nothing else matches. */
308
+ DeviceRole["GenericSensor"] = "generic-sensor";
309
+ DeviceRole["NumericControl"] = "numeric-control";
310
+ DeviceRole["SelectControl"] = "select-control";
311
+ DeviceRole["TextControl"] = "text-control";
312
+ DeviceRole["DateTimeControl"] = "datetime-control";
313
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
314
+ * rich features (image, priority, channel routing). */
315
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
316
+ /** Chat / messaging service (HA `notify.telegram_*`,
317
+ * `notify.discord_*`, etc.). */
318
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
319
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
320
+ DeviceRole["EmailNotifier"] = "email-notifier";
321
+ /** Fallback when the notifier service name doesn't match a known
322
+ * pattern. */
323
+ DeviceRole["GenericNotifier"] = "generic-notifier";
324
+ return DeviceRole;
325
+ }({});
326
+ //#endregion
327
+ //#region src/utils/err-msg.ts
328
+ /**
329
+ import { errMsg } from '@camstack/types'
330
+ * Extract a human-readable message from an unknown error value.
331
+ * Replaces the ubiquitous `errMsg(err)` pattern.
332
+ */
333
+ function errMsg(err) {
334
+ if (err instanceof Error) return err.message;
335
+ if (typeof err === "string") return err;
336
+ return String(err);
337
+ }
338
+ //#endregion
339
+ Object.defineProperty(exports, "ChargingStatus", {
340
+ enumerable: true,
341
+ get: function() {
342
+ return ChargingStatus;
343
+ }
344
+ });
345
+ Object.defineProperty(exports, "DeviceFeature", {
346
+ enumerable: true,
347
+ get: function() {
348
+ return DeviceFeature;
349
+ }
350
+ });
351
+ Object.defineProperty(exports, "DeviceRole", {
352
+ enumerable: true,
353
+ get: function() {
354
+ return DeviceRole;
355
+ }
356
+ });
357
+ Object.defineProperty(exports, "DeviceType", {
358
+ enumerable: true,
359
+ get: function() {
360
+ return DeviceType;
361
+ }
362
+ });
363
+ Object.defineProperty(exports, "errMsg", {
364
+ enumerable: true,
365
+ get: function() {
366
+ return errMsg;
367
+ }
368
+ });
@@ -362,6 +362,16 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
362
362
  */
363
363
  EventCategory["DeviceStateChanged"] = "device.state-changed";
364
364
  /**
365
+ * The NATIVE shadow of a cap a composition has claimed fields of moved
366
+ * (D663). Payload: `{ deviceId, capName, native }` — what the provider
367
+ * wrote, BEFORE the owned fields are overlaid. Owner-only (D224): it is for
368
+ * the composer's native self-reads, and the public event routers refuse it
369
+ * (`isOwnerOnlyEventCategory`) so no consumer surface ever shows a second
370
+ * truth beside the merged `DeviceStateChanged.slice`. Emitted only under a
371
+ * `replace` claim, one per native write of that cap.
372
+ */
373
+ EventCategory["DeviceNativeShadowChanged"] = "device.native-shadow-changed";
374
+ /**
365
375
  * Frame occupancy for a camera CHANGED — a tracked object was gained or
366
376
  * lost. Carries `{ deviceId, totalObjects, byClass, zones }`.
367
377
  *
@@ -688,5 +698,25 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
688
698
  EventCategory["ModelConvertProgress"] = "model-convert.progress";
689
699
  return EventCategory;
690
700
  }({});
701
+ /**
702
+ * Categories that never leave the hub's trusted addon closure: the public
703
+ * event routers (`systemEvents.*`, `live.*`) refuse them in every path, so a
704
+ * UI or a share-scope subscriber cannot receive them by omitting the category
705
+ * filter. Add a category here when its payload is a truth only one owner may
706
+ * read (D224).
707
+ */
708
+ var OWNER_ONLY_EVENT_CATEGORIES = new Set(["device.native-shadow-changed"]);
709
+ function isOwnerOnlyEventCategory(category) {
710
+ return OWNER_ONLY_EVENT_CATEGORIES.has(category);
711
+ }
712
+ /**
713
+ * Every category a PUBLIC surface may offer or show — the enum minus the
714
+ * owner-only set, unique, sorted. A picker built from the raw enum would offer
715
+ * a filter that can never match, because the routers refuse that category.
716
+ */
717
+ function publicEventCategories() {
718
+ const all = Object.values(EventCategory).filter((value) => typeof value === "string");
719
+ return [...new Set(all)].filter((c) => !isOwnerOnlyEventCategory(c)).toSorted();
720
+ }
691
721
  //#endregion
692
- export { EventCategory as t };
722
+ export { publicEventCategories as i, OWNER_ONLY_EVENT_CATEGORIES as n, isOwnerOnlyEventCategory as r, EventCategory as t };
@@ -362,6 +362,16 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
362
362
  */
363
363
  EventCategory["DeviceStateChanged"] = "device.state-changed";
364
364
  /**
365
+ * The NATIVE shadow of a cap a composition has claimed fields of moved
366
+ * (D663). Payload: `{ deviceId, capName, native }` — what the provider
367
+ * wrote, BEFORE the owned fields are overlaid. Owner-only (D224): it is for
368
+ * the composer's native self-reads, and the public event routers refuse it
369
+ * (`isOwnerOnlyEventCategory`) so no consumer surface ever shows a second
370
+ * truth beside the merged `DeviceStateChanged.slice`. Emitted only under a
371
+ * `replace` claim, one per native write of that cap.
372
+ */
373
+ EventCategory["DeviceNativeShadowChanged"] = "device.native-shadow-changed";
374
+ /**
365
375
  * Frame occupancy for a camera CHANGED — a tracked object was gained or
366
376
  * lost. Carries `{ deviceId, totalObjects, byClass, zones }`.
367
377
  *
@@ -688,6 +698,26 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
688
698
  EventCategory["ModelConvertProgress"] = "model-convert.progress";
689
699
  return EventCategory;
690
700
  }({});
701
+ /**
702
+ * Categories that never leave the hub's trusted addon closure: the public
703
+ * event routers (`systemEvents.*`, `live.*`) refuse them in every path, so a
704
+ * UI or a share-scope subscriber cannot receive them by omitting the category
705
+ * filter. Add a category here when its payload is a truth only one owner may
706
+ * read (D224).
707
+ */
708
+ var OWNER_ONLY_EVENT_CATEGORIES = new Set(["device.native-shadow-changed"]);
709
+ function isOwnerOnlyEventCategory(category) {
710
+ return OWNER_ONLY_EVENT_CATEGORIES.has(category);
711
+ }
712
+ /**
713
+ * Every category a PUBLIC surface may offer or show — the enum minus the
714
+ * owner-only set, unique, sorted. A picker built from the raw enum would offer
715
+ * a filter that can never match, because the routers refuse that category.
716
+ */
717
+ function publicEventCategories() {
718
+ const all = Object.values(EventCategory).filter((value) => typeof value === "string");
719
+ return [...new Set(all)].filter((c) => !isOwnerOnlyEventCategory(c)).toSorted();
720
+ }
691
721
  //#endregion
692
722
  Object.defineProperty(exports, "EventCategory", {
693
723
  enumerable: true,
@@ -695,3 +725,21 @@ Object.defineProperty(exports, "EventCategory", {
695
725
  return EventCategory;
696
726
  }
697
727
  });
728
+ Object.defineProperty(exports, "OWNER_ONLY_EVENT_CATEGORIES", {
729
+ enumerable: true,
730
+ get: function() {
731
+ return OWNER_ONLY_EVENT_CATEGORIES;
732
+ }
733
+ });
734
+ Object.defineProperty(exports, "isOwnerOnlyEventCategory", {
735
+ enumerable: true,
736
+ get: function() {
737
+ return isOwnerOnlyEventCategory;
738
+ }
739
+ });
740
+ Object.defineProperty(exports, "publicEventCategories", {
741
+ enumerable: true,
742
+ get: function() {
743
+ return publicEventCategories;
744
+ }
745
+ });
@@ -14,6 +14,8 @@
14
14
  */
15
15
  /** The only value types the engine produces or consumes. */
16
16
  export type ExpressionValue = number | string | boolean | null;
17
+ /** Stable structural address of a node within one parsed expression AST. */
18
+ export type ExpressionNodePath = string;
17
19
  export type ExpressionBinaryOperator = '+' | '-' | '*' | '/' | '%' | '==' | '!=' | '<' | '<=' | '>' | '>=';
18
20
  export type ExpressionLogicalOperator = '&&' | '||';
19
21
  export type ExpressionUnaryOperator = '-' | '!';
@@ -16,6 +16,7 @@
16
16
  * closed rather than emitting a garbage value.
17
17
  */
18
18
  import type { ExpressionValue } from './ast.js';
19
+ import type { CountCallState, RoseCallState, StatefulExpressionMemory } from './expression-source.js';
19
20
  /** Optional runtime hooks the evaluator threads through to builtins. */
20
21
  export interface ExpressionEvalHooks {
21
22
  /** Convert `value` from unit `from` to unit `to`; `null` when the pair is
@@ -40,6 +41,14 @@ export interface ExpressionBuiltin {
40
41
  readonly maxArgs: number;
41
42
  readonly apply: (args: readonly ExpressionValue[], hooks: ExpressionEvalHooks) => ExpressionValue;
42
43
  }
44
+ export type StatefulExpressionBuiltin = 'rose' | 'count';
45
+ export declare function isStatefulBuiltin(name: string): name is StatefulExpressionBuiltin;
46
+ export declare function evaluateRose(level: unknown, changedAt: unknown, debounceMs: unknown, call: RoseCallState, field: StatefulExpressionMemory, env: {
47
+ readonly currentOutput: number | null;
48
+ readonly startedAtMs: number;
49
+ readonly nowMs: number;
50
+ }): number | null;
51
+ export declare function evaluateCount(input: unknown, call: CountCallState, currentOutput: unknown): number;
43
52
  /** Frozen, null-prototype builtin table. */
44
53
  export declare const EXPRESSION_BUILTINS: Readonly<Record<string, ExpressionBuiltin>>;
45
54
  /** The set of valid builtin names — used by the parser to reject unknown
@@ -1,8 +1,14 @@
1
- import { type ExpressionEvalHooks } from './builtins.js';
2
- import type { ExpressionNode, ExpressionValue } from './ast.js';
1
+ import { type ExpressionEvalHooks, type StatefulExpressionBuiltin } from './builtins.js';
2
+ import type { ExpressionNode, ExpressionNodePath, ExpressionValue } from './ast.js';
3
+ export interface StatefulCallInvocation {
4
+ readonly name: StatefulExpressionBuiltin;
5
+ readonly path: ExpressionNodePath;
6
+ readonly args: readonly ExpressionValue[];
7
+ }
3
8
  export interface ExpressionEvalOptions {
4
9
  readonly hooks?: ExpressionEvalHooks;
5
10
  readonly maxSteps?: number;
11
+ readonly invokeStateful?: (call: StatefulCallInvocation) => ExpressionValue;
6
12
  }
7
13
  /** Build a null-prototype scope from own-enumerable binding entries. Inherited
8
14
  * keys of the input (e.g. from a `{__proto__: {...}}` payload) are NOT copied,
@@ -9,7 +9,28 @@
9
9
  * positions (derive a value, gate a trigger, compute an argument).
10
10
  */
11
11
  import type { ExpressionValue } from './ast.js';
12
- import { type ExpressionEvalOptions } from './evaluator.js';
12
+ import { type ExpressionEvalOptions, type StatefulCallInvocation } from './evaluator.js';
13
+ export interface RoseCallState {
14
+ readonly kind: 'rose';
15
+ priorLevel?: boolean;
16
+ }
17
+ export interface CountCallState {
18
+ readonly kind: 'count';
19
+ highWater: number | null;
20
+ }
21
+ export type StatefulCallState = RoseCallState | CountCallState;
22
+ export interface StatefulExpressionMemory {
23
+ readonly calls: Map<string, StatefulCallState>;
24
+ acceptedEdgeAt: number | null;
25
+ }
26
+ export declare function createStatefulExpressionMemory(): StatefulExpressionMemory;
27
+ export declare function cloneStatefulExpressionMemory(memory: StatefulExpressionMemory): StatefulExpressionMemory;
28
+ export interface StatefulExpressionEnvironment {
29
+ readonly currentOutput: unknown;
30
+ readonly startedAtMs: number;
31
+ readonly nowMs: number;
32
+ }
33
+ export declare function evaluateStatefulExpressionCall(invocation: StatefulCallInvocation, memory: StatefulExpressionMemory, env: StatefulExpressionEnvironment): ExpressionValue;
13
34
  /** The `now` epoch-ms binding is auto-injected into every evaluation and is a
14
35
  * reserved binding name (authors may not rebind it). */
15
36
  export declare const EXPRESSION_INJECTED_NOW = "now";
@@ -46,8 +67,9 @@ export type EvaluateExpressionSourceResult = {
46
67
  /**
47
68
  * Shared read-path evaluation. Builds a null-proto scope from `bindingValues`
48
69
  * plus the injected `now` (supplied by the caller for determinism and
49
- * testability), compiles via the LRU, and evaluates. Any failure (parse or
50
- * eval) returns `{ ok: false }` — the caller treats that as "skip this
51
- * derivation", never as a throw that takes the pass down.
70
+ * testability), compiles via the LRU, and evaluates. Stateful calls are
71
+ * delegated through `opts.invokeStateful` with their stable AST path. Any
72
+ * failure (parse or eval) returns `{ ok: false }` — the caller treats that as
73
+ * "skip this derivation", never as a throw that takes the pass down.
52
74
  */
53
75
  export declare function evaluateExpressionSource(expr: string, bindingValues: Readonly<Record<string, ExpressionValue>>, now: number, opts?: ExpressionEvalOptions): EvaluateExpressionSourceResult;
@@ -9,18 +9,18 @@
9
9
  * the deep modules (e.g. `../expression/compile.js`), never through this file
10
10
  * OR the root barrel (see biome-plugins/no-types-barrel-leaf-import.grit).
11
11
  */
12
- export type { ExpressionBinaryNode, ExpressionBinaryOperator, ExpressionCallNode, ExpressionConditionalNode, ExpressionIdentifierNode, ExpressionLiteralNode, ExpressionLogicalNode, ExpressionLogicalOperator, ExpressionNode, ExpressionUnaryNode, ExpressionUnaryOperator, ExpressionValue, } from './ast.js';
12
+ export type { ExpressionBinaryNode, ExpressionBinaryOperator, ExpressionCallNode, ExpressionConditionalNode, ExpressionIdentifierNode, ExpressionLiteralNode, ExpressionLogicalNode, ExpressionLogicalOperator, ExpressionNode, ExpressionNodePath, ExpressionUnaryNode, ExpressionUnaryOperator, ExpressionValue, } from './ast.js';
13
13
  export type { ExpressionBindingSource, ExpressionFieldBinding, ExpressionGlobalBinding, ExpressionLiteralBinding, ExpressionSource, } from './binding-source.js';
14
14
  export { ExpressionBindingSourceSchema, ExpressionFieldBindingSchema, ExpressionGlobalBindingSchema, ExpressionLiteralBindingSchema, ExpressionSourceSchema, } from './binding-source.js';
15
- export type { ExpressionBuiltin, ExpressionEvalHooks } from './builtins.js';
16
- export { EXPRESSION_BUILTIN_NAMES, EXPRESSION_BUILTINS, } from './builtins.js';
15
+ export type { ExpressionBuiltin, ExpressionEvalHooks, StatefulExpressionBuiltin, } from './builtins.js';
16
+ export { evaluateCount, evaluateRose, EXPRESSION_BUILTIN_NAMES, EXPRESSION_BUILTINS, isStatefulBuiltin, } from './builtins.js';
17
17
  export type { CompileResult } from './compile.js';
18
18
  export { compileExpression, compileExpressionSafe } from './compile.js';
19
19
  export { ExpressionEvalError, ExpressionParseError } from './errors.js';
20
- export type { ExpressionEvalOptions } from './evaluator.js';
20
+ export type { ExpressionEvalOptions, StatefulCallInvocation } from './evaluator.js';
21
21
  export { createExpressionScope, evaluateAst } from './evaluator.js';
22
- export type { EvaluateExpressionSourceResult, ExpressionSourceInput, } from './expression-source.js';
23
- export { EXPRESSION_INJECTED_NOW, evaluateExpressionSource, toExpressionValue, validateExpressionSource, } from './expression-source.js';
22
+ export type { CountCallState, EvaluateExpressionSourceResult, ExpressionSourceInput, RoseCallState, StatefulCallState, StatefulExpressionEnvironment, StatefulExpressionMemory, } from './expression-source.js';
23
+ export { cloneStatefulExpressionMemory, createStatefulExpressionMemory, EXPRESSION_INJECTED_NOW, evaluateExpressionSource, evaluateStatefulExpressionCall, toExpressionValue, validateExpressionSource, } from './expression-source.js';
24
24
  export { EXPRESSION_COMPILE_CACHE_CAPACITY, EXPRESSION_IDENTIFIER_RE, MAX_EXPRESSION_AST_NODES, MAX_EXPRESSION_BINDINGS, MAX_EXPRESSION_CALL_ARGS, MAX_EXPRESSION_EVAL_STEPS, MAX_EXPRESSION_SOURCE_LENGTH, RESERVED_BINDING_NAMES, } from './limits.js';
25
25
  export type { ParsedExpression } from './parser.js';
26
26
  export { parseExpression } from './parser.js';
@@ -1624,6 +1624,13 @@ export type AppRouter = TrpcCoreRouter<{
1624
1624
  output: z.infer<typeof coreBlocksCapability.methods.listCompositions.output>;
1625
1625
  meta: object;
1626
1626
  }>;
1627
+ getCustomization: TRPCQueryProcedure<{
1628
+ input: {
1629
+ [x: string]: unknown;
1630
+ } & z.input<typeof coreBlocksCapability.methods.getCustomization.input>;
1631
+ output: z.infer<typeof coreBlocksCapability.methods.getCustomization.output>;
1632
+ meta: object;
1633
+ }>;
1627
1634
  validateComposition: TRPCMutationProcedure<{
1628
1635
  input: {
1629
1636
  [x: string]: unknown;
@@ -3026,6 +3033,41 @@ export type AppRouter = TrpcCoreRouter<{
3026
3033
  output: z.infer<typeof deviceStateCapability.methods.setCapSlice.output>;
3027
3034
  meta: object;
3028
3035
  }>;
3036
+ claimFields: TRPCMutationProcedure<{
3037
+ input: {
3038
+ [x: string]: unknown;
3039
+ } & z.input<typeof deviceStateCapability.methods.claimFields.input>;
3040
+ output: z.infer<typeof deviceStateCapability.methods.claimFields.output>;
3041
+ meta: object;
3042
+ }>;
3043
+ patchOwnedFields: TRPCMutationProcedure<{
3044
+ input: {
3045
+ [x: string]: unknown;
3046
+ } & z.input<typeof deviceStateCapability.methods.patchOwnedFields.input>;
3047
+ output: z.infer<typeof deviceStateCapability.methods.patchOwnedFields.output>;
3048
+ meta: object;
3049
+ }>;
3050
+ releaseClaim: TRPCMutationProcedure<{
3051
+ input: {
3052
+ [x: string]: unknown;
3053
+ } & z.input<typeof deviceStateCapability.methods.releaseClaim.input>;
3054
+ output: z.infer<typeof deviceStateCapability.methods.releaseClaim.output>;
3055
+ meta: object;
3056
+ }>;
3057
+ listClaims: TRPCQueryProcedure<{
3058
+ input: {
3059
+ [x: string]: unknown;
3060
+ } & z.input<typeof deviceStateCapability.methods.listClaims.input>;
3061
+ output: z.infer<typeof deviceStateCapability.methods.listClaims.output>;
3062
+ meta: object;
3063
+ }>;
3064
+ getNativeCapSlice: TRPCQueryProcedure<{
3065
+ input: {
3066
+ [x: string]: unknown;
3067
+ } & z.input<typeof deviceStateCapability.methods.getNativeCapSlice.input>;
3068
+ output: z.infer<typeof deviceStateCapability.methods.getNativeCapSlice.output>;
3069
+ meta: object;
3070
+ }>;
3029
3071
  }>>;
3030
3072
  deviceStatus: TRPCBuiltRouter<{
3031
3073
  ctx: TrpcContext;