@camstack/types 1.2.267 → 1.2.268

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 (56) 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 +22 -0
  5. package/dist/capabilities/composer.cap.d.ts +99 -0
  6. package/dist/capabilities/consumables.cap.d.ts +79 -0
  7. package/dist/capabilities/core-blocks.cap.d.ts +1149 -91
  8. package/dist/capabilities/device-extension.cap.d.ts +12 -13
  9. package/dist/capabilities/device-state.cap.d.ts +186 -2
  10. package/dist/capabilities/index.d.ts +3 -3
  11. package/dist/composition/composition-graph.d.ts +42 -9
  12. package/dist/composition/composition-items.d.ts +25 -0
  13. package/dist/composition/composition-report.d.ts +93 -2
  14. package/dist/composition/composition.d.ts +154 -3
  15. package/dist/composition/customization-name.d.ts +6 -0
  16. package/dist/composition/evaluate-field.d.ts +12 -0
  17. package/dist/composition/examples.d.ts +33 -0
  18. package/dist/composition/field-kinds.d.ts +42 -0
  19. package/dist/composition/index.d.ts +1 -0
  20. package/dist/composition/plan-result.d.ts +16 -0
  21. package/dist/composition/state-fields.d.ts +6 -0
  22. package/dist/composition/validate-composition.d.ts +44 -9
  23. package/dist/composition-CPFIlFfw.mjs +1759 -0
  24. package/dist/composition-QlOB7QTG.js +2184 -0
  25. package/dist/device/device-context.d.ts +9 -0
  26. package/dist/device/device-runtime-state.d.ts +15 -1
  27. package/dist/device/index.d.ts +1 -1
  28. package/dist/device-extension/slot-descriptor.d.ts +8 -11
  29. package/dist/device-extension/slot-provider.d.ts +0 -2
  30. package/dist/enums/event-category.d.ts +25 -0
  31. package/dist/enums.js +1 -1
  32. package/dist/enums.mjs +1 -1
  33. package/dist/err-msg-DX6i_MY4.mjs +339 -0
  34. package/dist/err-msg-Dx2Kor0g.js +368 -0
  35. package/dist/{event-category-BVDXG4tB.mjs → event-category-C5xZWqz6.mjs} +31 -1
  36. package/dist/{event-category-BVfsrBYA.js → event-category-MbnB-6AN.js} +48 -0
  37. package/dist/generated/addon-api.d.ts +42 -0
  38. package/dist/generated/device-proxy.d.ts +1 -1
  39. package/dist/generated/method-access-map.d.ts +1 -1
  40. package/dist/generated/method-device-selectors.d.ts +2 -2
  41. package/dist/generated/system-proxy.d.ts +2 -2
  42. package/dist/index.d.ts +4 -3
  43. package/dist/index.js +1513 -1656
  44. package/dist/index.mjs +1208 -1384
  45. package/dist/interfaces/kernel-abstractions.d.ts +16 -0
  46. package/dist/interfaces/status-overlay.d.ts +42 -0
  47. package/dist/node.d.ts +1 -0
  48. package/dist/node.js +29 -8
  49. package/dist/node.mjs +23 -3
  50. package/dist/{sleep-8K9gue-H.js → sleep-BSzia-xT.js} +6 -352
  51. package/dist/{sleep-DC-wdyeS.mjs → sleep-jkRQgtSc.mjs} +7 -329
  52. package/package.json +1 -1
  53. package/dist/canonical-hash-CPK2Dy60.mjs +0 -715
  54. package/dist/canonical-hash-CSE4ioRi.js +0 -792
  55. package/dist/err-msg-COpsHMw2.js +0 -18
  56. package/dist/err-msg-IQTHeDzc.mjs +0 -13
@@ -97,6 +97,15 @@ export interface DeviceContext {
97
97
  /** Register a native provider for `cap` on the device this context belongs to.
98
98
  * Multiple calls for the same cap throw. */
99
99
  registerNativeCap<TCap extends CapabilityDefinition>(cap: TCap, provider: InferNativeProvider<TCap>): void;
100
+ /**
101
+ * Remove the native provider THIS context registered for `capName` (D663: the composer ungrafts an added cap when a
102
+ * foreign native appears or the target is gone). OPTIONAL on the published interface: every `DeviceContext` fake in the
103
+ * repo keeps compiling, and an older hub that lacks it leaves the graft routable until the composer respawns — a
104
+ * tolerable degradation, recorded in D663's rollback note. No-op when another addon registered the cap. In a worker
105
+ * process that holds nothing for the cap, it retracts a binding a PREVIOUS incarnation of this addon left (a respawn):
106
+ * the hub drops only an entry this addon registered.
107
+ */
108
+ unregisterNativeCap?(capName: string): void;
100
109
  }
101
110
  /** Constructor type for BaseDevice subclasses.
102
111
  *
@@ -92,10 +92,24 @@ export type Snapshot = Readonly<Record<string, Readonly<Record<string, unknown>>
92
92
  * whose schema hasn't been installed yet are kept in-memory verbatim
93
93
  * and validated when the cap registers later.
94
94
  */
95
+ export type RuntimeStateWriter = (capName: string, slice: Record<string, unknown>) => Promise<void>;
96
+ /**
97
+ * Called when the hub REFUSES a write (the slice is not mirrored). The device
98
+ * logs it; the state re-sends the cap's next write even when the value is
99
+ * unchanged, so a refusal is never final (D391, ruling S6).
100
+ */
101
+ export type RuntimeStateWriteFailed = (capName: string, error: string) => void;
95
102
  export declare class DeviceRuntimeState implements IDeviceRuntimeState {
96
103
  private readonly writer;
104
+ private readonly onWriteFailed;
97
105
  /** In-flight writer promises tracked so `flush()` can await them. */
98
106
  private readonly pendingWrites;
107
+ /**
108
+ * Caps whose last write the hub refused. The equality gate in
109
+ * `applyCapWrite` is bypassed for these, so the SAME value is re-sent on the
110
+ * next write instead of being swallowed forever; a landing write clears it.
111
+ */
112
+ private readonly failedWrites;
99
113
  /** Per-cap committed slice — after schema validation when known. */
100
114
  private slices;
101
115
  /** Per-cap registered schema (set by `installCapSchema`). */
@@ -103,7 +117,7 @@ export declare class DeviceRuntimeState implements IDeviceRuntimeState {
103
117
  private readonly listeners;
104
118
  private readonly capListeners;
105
119
  private constructor();
106
- static fromInitial(initial: Record<string, unknown>, writer: (capName: string, slice: Record<string, unknown>) => Promise<void>): DeviceRuntimeState;
120
+ static fromInitial(initial: Record<string, unknown>, writer: RuntimeStateWriter, onWriteFailed?: RuntimeStateWriteFailed): DeviceRuntimeState;
107
121
  installCapSchema(capName: string, schema: z.ZodObject<z.core.$ZodLooseShape>): void;
108
122
  getCapState<T extends Record<string, unknown> = Record<string, unknown>>(capName: string): Readonly<T> | undefined;
109
123
  getCapField(capName: string, key: string): unknown;
@@ -25,7 +25,7 @@ export { REACHABILITY_FAILURES_TO_OFFLINE, REACHABILITY_POLL_INTERVAL_MS, REACHA
25
25
  export type { RuntimeStateBridge, RuntimeStateStaleReadPolicy, } from './runtime-state-helpers.js';
26
26
  export { createRuntimeStateBridge, OPERATOR_WRITTEN_STALE_MS, RUNTIME_STATE_REFRESH_MISS_COOLDOWN_MS, } from './runtime-state-helpers.js';
27
27
  export type { WireableField } from './schema-fields.js';
28
- export { enumerateItemArrayFields, enumerateSchemaFields } from './schema-fields.js';
28
+ export { enumerateItemArrayFields, enumerateSchemaFields, unwrapSchema } from './schema-fields.js';
29
29
  export type { DeviceConfigEntry } from './zod-to-config-ui.js';
30
30
  export { zodEntriesToConfigUI } from './zod-to-config-ui.js';
31
31
  export type { SiteZone } from './site-zone.js';
@@ -10,20 +10,19 @@
10
10
  * collection contract that lists and writes them. The contract persists
11
11
  * NOTHING: each slot is served by the addon that owns its store (D62).
12
12
  *
13
- * Two shapes:
13
+ * One shape, `association` — the host LISTS other devices (a camera's linked
14
+ * devices, its doorbell trigger sources). Removing every source is "off";
15
+ * there is no separate switch.
14
16
  *
15
- * - `association` — the host LISTS other devices (a camera's linked devices,
16
- * its doorbell trigger sources). Removing every source is "off"; there is
17
- * no separate switch.
18
- * - `graft` — the host GAINS a whole capability (`projects`), registered
19
- * natively by the host's own provider from sources it owns. Declared here
20
- * so the contract has room for it; the first graft (HA consumables) is
21
- * slice 2, and a graft carries its own `enabled` switch.
17
+ * A host that GAINS a whole capability from other devices is not a slot: that
18
+ * is a COMPOSITION (D663, amends D648). D648 reserved a `graft` shape for it
19
+ * (with a `projects` cap and an `enabled` switch); none was ever implemented,
20
+ * and it was retired in favour of composed devices and device customization.
22
21
  */
23
22
  import type { z } from 'zod';
24
23
  import type { DeviceType } from '../device/device-type.js';
25
24
  /** How a slot extends its host. See the module docblock. */
26
- export type ExtensionSlotShape = 'association' | 'graft';
25
+ export type ExtensionSlotShape = 'association';
27
26
  /** How many sources a slot takes. */
28
27
  export type ExtensionSlotCardinality = 'one' | 'many';
29
28
  /**
@@ -55,8 +54,6 @@ export interface ExtensionSlotDescriptor<TValue extends z.ZodObject = z.ZodObjec
55
54
  */
56
55
  readonly sourceCaps: readonly string[] | 'any';
57
56
  readonly cardinality: ExtensionSlotCardinality;
58
- /** graft only — MUST equal the declaring cap's `name` (guarded). */
59
- readonly projects?: string;
60
57
  /** The slot's editable value. See the interface docblock. */
61
58
  readonly value: TValue;
62
59
  }
@@ -24,8 +24,6 @@ export type ExtensionSlotValueOf<Id extends ExtensionSlotId> = Extract<Extension
24
24
  export interface ExtensionSlotListing<Id extends ExtensionSlotId> {
25
25
  /** The store written (D62), `<addon>:<key>`. */
26
26
  readonly authority: string;
27
- /** graft: its switch; association: null. */
28
- readonly enabled: boolean | null;
29
27
  readonly activation: ExtensionSlotActivation | null;
30
28
  readonly value: ExtensionSlotValueOf<Id>;
31
29
  readonly sources: readonly ExtensionSlotSource[];
@@ -360,6 +360,16 @@ export declare enum EventCategory {
360
360
  * without filtering on `capName`.
361
361
  */
362
362
  DeviceStateChanged = "device.state-changed",
363
+ /**
364
+ * The NATIVE shadow of a cap a composition has claimed fields of moved
365
+ * (D663). Payload: `{ deviceId, capName, native }` — what the provider
366
+ * wrote, BEFORE the owned fields are overlaid. Owner-only (D224): it is for
367
+ * the composer's native self-reads, and the public event routers refuse it
368
+ * (`isOwnerOnlyEventCategory`) so no consumer surface ever shows a second
369
+ * truth beside the merged `DeviceStateChanged.slice`. Emitted only under a
370
+ * `replace` claim, one per native write of that cap.
371
+ */
372
+ DeviceNativeShadowChanged = "device.native-shadow-changed",
363
373
  /**
364
374
  * Frame occupancy for a camera CHANGED — a tracked object was gained or
365
375
  * lost. Carries `{ deviceId, totalObjects, byClass, zones }`.
@@ -686,3 +696,18 @@ export declare enum EventCategory {
686
696
  */
687
697
  ModelConvertProgress = "model-convert.progress"
688
698
  }
699
+ /**
700
+ * Categories that never leave the hub's trusted addon closure: the public
701
+ * event routers (`systemEvents.*`, `live.*`) refuse them in every path, so a
702
+ * UI or a share-scope subscriber cannot receive them by omitting the category
703
+ * filter. Add a category here when its payload is a truth only one owner may
704
+ * read (D224).
705
+ */
706
+ export declare const OWNER_ONLY_EVENT_CATEGORIES: ReadonlySet<string>;
707
+ export declare function isOwnerOnlyEventCategory(category: string): boolean;
708
+ /**
709
+ * Every category a PUBLIC surface may offer or show — the enum minus the
710
+ * owner-only set, unique, sorted. A picker built from the raw enum would offer
711
+ * a filter that can never match, because the routers refuse that category.
712
+ */
713
+ export declare function publicEventCategories(): readonly string[];
package/dist/enums.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_category = require("./event-category-BVfsrBYA.js");
2
+ const require_event_category = require("./event-category-MbnB-6AN.js");
3
3
  //#region src/enums/event-source-type.ts
4
4
  var EventSourceType = /* @__PURE__ */ function(EventSourceType) {
5
5
  EventSourceType["Addon"] = "addon";
package/dist/enums.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as EventCategory } from "./event-category-BVDXG4tB.mjs";
1
+ import { t as EventCategory } from "./event-category-C5xZWqz6.mjs";
2
2
  //#region src/enums/event-source-type.ts
3
3
  var EventSourceType = /* @__PURE__ */ function(EventSourceType) {
4
4
  EventSourceType["Addon"] = "addon";
@@ -0,0 +1,339 @@
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
+ export { DeviceType as a, DeviceRole as i, ChargingStatus as n, DeviceFeature as r, errMsg as t };