@camstack/addon-export-google 0.1.119 → 0.1.120

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.
@@ -77,7 +77,7 @@ function createApiDeviceGateway(deps) {
77
77
  };
78
78
  }
79
79
  //#endregion
80
- //#region ../types/dist/event-category-DmZDPDf_.mjs
80
+ //#region ../types/dist/event-category-CaURIwQA.mjs
81
81
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
82
82
  EventCategory["SystemBoot"] = "system.boot";
83
83
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -793,6 +793,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
793
793
  EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
794
794
  /** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
795
795
  EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
796
+ /** A migration failed or was blocked; the Alert Center re-reads the ledger. */
797
+ EventCategory["MigrationFailed"] = "migration.failed";
798
+ /** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
799
+ EventCategory["MigrationApplied"] = "migration.applied";
796
800
  EventCategory["DeviceUpdated"] = "device.updated";
797
801
  /**
798
802
  * Transport-level connectivity. Emitted by the device driver when
@@ -855,6 +859,378 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
855
859
  return EventCategory;
856
860
  }({});
857
861
  //#endregion
862
+ //#region ../types/dist/device-type-CEqjmUnR.mjs
863
+ /**
864
+ import { errMsg } from '@camstack/types'
865
+ * Extract a human-readable message from an unknown error value.
866
+ * Replaces the ubiquitous `errMsg(err)` pattern.
867
+ */
868
+ function errMsg(err) {
869
+ if (err instanceof Error) return err.message;
870
+ if (typeof err === "string") return err;
871
+ return String(err);
872
+ }
873
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
874
+ DeviceType["Camera"] = "camera";
875
+ DeviceType["Hub"] = "hub";
876
+ DeviceType["Light"] = "light";
877
+ DeviceType["Siren"] = "siren";
878
+ DeviceType["Switch"] = "switch";
879
+ DeviceType["Sensor"] = "sensor";
880
+ DeviceType["Thermostat"] = "thermostat";
881
+ /** Air-conditioner / heat-pump climate device (HVAC) — shares the
882
+ * `climate-control` cap surface with `Thermostat` but renders a
883
+ * dedicated AC-appropriate control UI (mode chips, fan speed,
884
+ * independent vertical/horizontal swing). Sources: native Gree, and
885
+ * reusable by other AC integrations. */
886
+ DeviceType["Climate"] = "climate";
887
+ DeviceType["Button"] = "button";
888
+ /** Generic stateless event emitter — carries a device's EXACT declared
889
+ * event vocabulary verbatim (no normalization). Installed with the
890
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
891
+ * HA bus events (e.g. `zha_event`, generic). */
892
+ DeviceType["EventEmitter"] = "event-emitter";
893
+ /** Firmware/software update entity — current vs available version,
894
+ * updatable flag, update state, and an install action. Installed with
895
+ * the `update` cap. Sources: Homematic firmware-update channels (and
896
+ * reusable by other providers, e.g. HA `update.*` entities). */
897
+ DeviceType["Update"] = "update";
898
+ DeviceType["Generic"] = "generic";
899
+ /** Generic notification delivery target (HA `notify.<service>`, future
900
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
901
+ * endpoint; the `notifier` cap defines the send surface. */
902
+ DeviceType["Notifier"] = "notifier";
903
+ /** Pre-recorded action sequence with optional parameters
904
+ * (HA `script.*`). Runnable via `script-runner` cap. */
905
+ DeviceType["Script"] = "script";
906
+ /** Automation rule (HA `automation.*`) — enable/disable + manual
907
+ * trigger surface exposed via `automation-control` cap. */
908
+ DeviceType["Automation"] = "automation";
909
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
910
+ DeviceType["Lock"] = "lock";
911
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
912
+ * `valve.*`). `cover` cap with sub-roles for variant. */
913
+ DeviceType["Cover"] = "cover";
914
+ /** Pipe / water / gas valve with open/close/stop and optional
915
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
916
+ * modelled on the same open/closed lifecycle. */
917
+ DeviceType["Valve"] = "valve";
918
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
919
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
920
+ * modelled on the same target / mode lifecycle. */
921
+ DeviceType["Humidifier"] = "humidifier";
922
+ /** Water heater / boiler with target temperature + operation mode +
923
+ * away mode (HA `water_heater.*`). `water-heater` cap — a
924
+ * climate-family actuator. */
925
+ DeviceType["WaterHeater"] = "water-heater";
926
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
927
+ DeviceType["Fan"] = "fan";
928
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
929
+ * the camera surface — those use `Camera`. `media-player` cap. */
930
+ DeviceType["MediaPlayer"] = "media-player";
931
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
932
+ * `alarm-panel` cap. */
933
+ DeviceType["AlarmPanel"] = "alarm-panel";
934
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
935
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
936
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
937
+ * TextControl / DateTimeControl. */
938
+ DeviceType["Control"] = "control";
939
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
940
+ * `presence` cap. */
941
+ DeviceType["Presence"] = "presence";
942
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
943
+ * `weather` cap. */
944
+ DeviceType["Weather"] = "weather";
945
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
946
+ DeviceType["Vacuum"] = "vacuum";
947
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
948
+ * `lawn-mower-control` cap. */
949
+ DeviceType["LawnMower"] = "lawn-mower";
950
+ /** Physical HA device group — parent container for entity-children
951
+ * adopted from a single HA device entry. Not renderable as a
952
+ * standalone device; exists only to anchor child entities. */
953
+ DeviceType["Container"] = "container";
954
+ /** Single still-image entity (HA `image.*`). Read-only display of an
955
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
956
+ DeviceType["Image"] = "image";
957
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
958
+ * level, battery, desiccant life, feeding state and manual-feed /
959
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
960
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
961
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
962
+ * integrations sharing the same food/desiccant/hopper surface. */
963
+ DeviceType["PetFeeder"] = "pet-feeder";
964
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
965
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
966
+ * of a container and is BUILT as a composed device (D967). */
967
+ DeviceType["PetFountain"] = "pet-fountain";
968
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
969
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
970
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
971
+ * A plug-built dishwasher carries running-state and power instead. */
972
+ DeviceType["Dishwasher"] = "dishwasher";
973
+ /** Washing machine. A plug-built one is running while its power stays
974
+ * above a threshold. No program cap — that surface is the dishwasher's. */
975
+ DeviceType["Washer"] = "washer";
976
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
977
+ DeviceType["Dryer"] = "dryer";
978
+ /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
979
+ * other radio-to-IP bridges). It carries the box's own facts (firmware,
980
+ * address, connection state) and the actions the box really supports
981
+ * (`reboot`, `device-admin-link`). Products are NOT its children — they are
982
+ * adopted beside it — and its connection settings stay on the integration. */
983
+ DeviceType["Gateway"] = "gateway";
984
+ return DeviceType;
985
+ }({});
986
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
987
+ DeviceFeature["BatteryOperated"] = "battery-operated";
988
+ DeviceFeature["Rebootable"] = "rebootable";
989
+ /**
990
+ * Device supports an on-demand re-sync of its derived spec with its
991
+ * upstream source — drives the generic Re-sync button. The owning
992
+ * provider implements the action via the `device-adoption.resync` cap.
993
+ */
994
+ DeviceFeature["Resyncable"] = "resyncable";
995
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
996
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
997
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
998
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
999
+ /**
1000
+ * Camera supports the on-firmware autotrack subsystem (subject-
1001
+ * following). Distinct from `PanTiltZoom` because not every PTZ
1002
+ * camera ships autotrack — the admin UI uses this flag to gate
1003
+ * the autotrack toggle / settings card without re-deriving from
1004
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
1005
+ * driver sets this feature when probe confirms the firmware
1006
+ * surface, and registers the cap in the same code path.
1007
+ */
1008
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
1009
+ /**
1010
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
1011
+ * motion detection automatically activates this device. Mirrors
1012
+ * `motion-trigger` cap registration: drivers set this feature in the
1013
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
1014
+ *
1015
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
1016
+ * fast scalar without binding fetch), notifier rules, and `listAll`
1017
+ * filters that want "all devices with on-motion behaviour".
1018
+ */
1019
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
1020
+ /** Light supports rgb-triplet color via `color` cap. */
1021
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
1022
+ /** Light supports HSV color via `color` cap. */
1023
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
1024
+ /** Light supports color-temperature (mired) via `color` cap. */
1025
+ DeviceFeature["LightColorMired"] = "light-color-mired";
1026
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
1027
+ * targetHigh). Gates the range slider UI. */
1028
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
1029
+ /** Thermostat exposes target humidity and/or current humidity
1030
+ * readings. Gates the humidity controls. */
1031
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
1032
+ /** Thermostat exposes a fan-mode selector. */
1033
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
1034
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
1035
+ DeviceFeature["ClimatePreset"] = "climate-preset";
1036
+ /** Thermostat exposes a vertical louver swing toggle. Gates the
1037
+ * vertical-swing switch in the climate UI. Independent of horizontal. */
1038
+ DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
1039
+ /** Thermostat exposes a horizontal louver swing toggle. Gates the
1040
+ * horizontal-swing switch in the climate UI. Independent of vertical. */
1041
+ DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
1042
+ /** Cover exposes intermediate position control (0..100). Gates the
1043
+ * position slider UI. */
1044
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
1045
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
1046
+ DeviceFeature["CoverTilt"] = "cover-tilt";
1047
+ /** Valve exposes intermediate position control (0..100). Gates the
1048
+ * position slider / drag surface UI. */
1049
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
1050
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
1051
+ DeviceFeature["FanSpeed"] = "fan-speed";
1052
+ /** Fan exposes a preset mode selector. */
1053
+ DeviceFeature["FanPreset"] = "fan-preset";
1054
+ /** Fan exposes blade direction (forward/reverse) — typical of
1055
+ * ceiling fans. */
1056
+ DeviceFeature["FanDirection"] = "fan-direction";
1057
+ /** Fan exposes an oscillation toggle. */
1058
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
1059
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
1060
+ * field on the UI lock-controls panel. */
1061
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
1062
+ /** Lock supports a latch-release ("open door") action distinct from
1063
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
1064
+ * `supported_features`. Gates the Open Door button in the UI. */
1065
+ DeviceFeature["LockOpen"] = "lock-open";
1066
+ /** Media player exposes a seek-to-position surface. */
1067
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
1068
+ /** Media player exposes a volume-level setter. */
1069
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
1070
+ /** Media player exposes a mute toggle distinct from volume=0. */
1071
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
1072
+ /** Media player exposes a shuffle toggle. */
1073
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
1074
+ /** Media player exposes a repeat mode (off / all / one). */
1075
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
1076
+ /** Media player exposes a source / input selector. */
1077
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
1078
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
1079
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
1080
+ /** Media player exposes next-track. */
1081
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
1082
+ /** Media player exposes previous-track. */
1083
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1084
+ /** Media player exposes stop distinct from pause. */
1085
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1086
+ /** Alarm panel requires a PIN code on arm/disarm. */
1087
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1088
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
1089
+ * addition to a textual location. */
1090
+ DeviceFeature["PresenceGps"] = "presence-gps";
1091
+ /** Notifier accepts an inline / URL image attachment. */
1092
+ DeviceFeature["NotifierImage"] = "notifier-image";
1093
+ /** Notifier accepts a priority hint (high/normal/low). */
1094
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
1095
+ /** Notifier accepts a free-form `data` payload for platform-specific
1096
+ * fields. */
1097
+ DeviceFeature["NotifierData"] = "notifier-data";
1098
+ /** Notifier supports interactive action buttons / callbacks. */
1099
+ DeviceFeature["NotifierActions"] = "notifier-actions";
1100
+ /** Notifier supports per-call recipient targeting (multi-user). */
1101
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
1102
+ /** Script runner accepts a variables map on each run invocation. */
1103
+ DeviceFeature["ScriptVariables"] = "script-variables";
1104
+ /** Automation `trigger` accepts a skipCondition flag — fires the
1105
+ * automation's actions while bypassing its condition block. */
1106
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
1107
+ /** Robot vacuum exposes a live cleaning map (image child). Gates the
1108
+ * map tile in the vacuum UI. */
1109
+ DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
1110
+ /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
1111
+ * switches group. */
1112
+ DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
1113
+ /** Robot mower exposes a live mowing map (SVG image child). Gates the
1114
+ * mower map tile. */
1115
+ DeviceFeature["MowerHasMap"] = "mower-has-map";
1116
+ /** Robot mower exposes targeted mowing (all-area / zones / edges /
1117
+ * spots) — gates the Mow action + map selectors. */
1118
+ DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
1119
+ return DeviceFeature;
1120
+ }({});
1121
+ /**
1122
+ * Semantic role a device plays within its parent. Populated by driver
1123
+ * addons when creating accessory devices (Reolink siren/floodlight/
1124
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
1125
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
1126
+ * `role: Floodlight` renders as a bulb with a brightness slider,
1127
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
1128
+ *
1129
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
1130
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
1131
+ */
1132
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1133
+ DeviceRole["Siren"] = "siren";
1134
+ DeviceRole["Floodlight"] = "floodlight";
1135
+ DeviceRole["Spotlight"] = "spotlight";
1136
+ DeviceRole["PirSensor"] = "pir-sensor";
1137
+ DeviceRole["Chime"] = "chime";
1138
+ DeviceRole["Autotrack"] = "autotrack";
1139
+ DeviceRole["Nightvision"] = "nightvision";
1140
+ DeviceRole["PrivacyMask"] = "privacy-mask";
1141
+ DeviceRole["Doorbell"] = "doorbell";
1142
+ /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
1143
+ DeviceRole["CoverBlind"] = "cover-blind";
1144
+ /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
1145
+ DeviceRole["CoverShutter"] = "cover-shutter";
1146
+ /** Exterior awning. HA `device_class: awning`. */
1147
+ DeviceRole["CoverAwning"] = "cover-awning";
1148
+ /** Curtain / drape. HA `device_class: curtain`. */
1149
+ DeviceRole["CoverCurtain"] = "cover-curtain";
1150
+ /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
1151
+ DeviceRole["CoverGarage"] = "cover-garage";
1152
+ /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
1153
+ DeviceRole["CoverGate"] = "cover-gate";
1154
+ /** Door. HA `device_class: door`. A security actuator: exports gate it. */
1155
+ DeviceRole["CoverDoor"] = "cover-door";
1156
+ /** Window. HA `device_class: window`. */
1157
+ DeviceRole["CoverWindow"] = "cover-window";
1158
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
1159
+ * real Switch device for UI rendering / export adapters. */
1160
+ DeviceRole["BinaryHelper"] = "binary-helper";
1161
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
1162
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
1163
+ DeviceRole["Outlet"] = "outlet";
1164
+ /** Generic motion / occupancy / moving event source. Distinct from
1165
+ * the camera accessory PirSensor role: that one is a camera child;
1166
+ * this is a standalone HA / 3rd-party motion sensor. */
1167
+ DeviceRole["MotionSensor"] = "motion-sensor";
1168
+ DeviceRole["ContactSensor"] = "contact-sensor";
1169
+ DeviceRole["LeakSensor"] = "leak-sensor";
1170
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
1171
+ DeviceRole["COSensor"] = "co-sensor";
1172
+ DeviceRole["GasSensor"] = "gas-sensor";
1173
+ DeviceRole["TamperSensor"] = "tamper-sensor";
1174
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
1175
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
1176
+ DeviceRole["SoundSensor"] = "sound-sensor";
1177
+ /** Fallback for `binary_sensor` without a known `device_class`. */
1178
+ DeviceRole["BinarySensor"] = "binary-sensor";
1179
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
1180
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
1181
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
1182
+ DeviceRole["PressureSensor"] = "pressure-sensor";
1183
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
1184
+ DeviceRole["WindSensor"] = "wind-sensor";
1185
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
1186
+ DeviceRole["RainSensor"] = "rain-sensor";
1187
+ /** UV index (weather-station `uv-sensor` cap). */
1188
+ DeviceRole["UvSensor"] = "uv-sensor";
1189
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
1190
+ * Distinct from AmbientLightSensor (lux). */
1191
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
1192
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
1193
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
1194
+ DeviceRole["PowerSensor"] = "power-sensor";
1195
+ DeviceRole["EnergySensor"] = "energy-sensor";
1196
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
1197
+ DeviceRole["CurrentSensor"] = "current-sensor";
1198
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
1199
+ /** Battery level (numeric % via `sensor` OR low-bool via
1200
+ * `binary_sensor` — the cap distinguishes via the value type). */
1201
+ DeviceRole["BatterySensor"] = "battery-sensor";
1202
+ /** Fallback for `sensor` numeric without a known `device_class`. */
1203
+ DeviceRole["NumericSensor"] = "numeric-sensor";
1204
+ /** String / enum state (HA `sensor` with `state_class: enum` or
1205
+ * `attributes.options`). */
1206
+ DeviceRole["EnumSensor"] = "enum-sensor";
1207
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
1208
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
1209
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
1210
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
1211
+ /** Last-resort fallback when nothing else matches. */
1212
+ DeviceRole["GenericSensor"] = "generic-sensor";
1213
+ DeviceRole["NumericControl"] = "numeric-control";
1214
+ DeviceRole["SelectControl"] = "select-control";
1215
+ DeviceRole["TextControl"] = "text-control";
1216
+ DeviceRole["DateTimeControl"] = "datetime-control";
1217
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
1218
+ * rich features (image, priority, channel routing). */
1219
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
1220
+ /** Chat / messaging service (HA `notify.telegram_*`,
1221
+ * `notify.discord_*`, etc.). */
1222
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
1223
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
1224
+ DeviceRole["EmailNotifier"] = "email-notifier";
1225
+ /** Fallback when the notifier service name doesn't match a known
1226
+ * pattern. */
1227
+ DeviceRole["GenericNotifier"] = "generic-notifier";
1228
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
1229
+ * cap. A `DeviceType.Generic` device. */
1230
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
1231
+ return DeviceRole;
1232
+ }({});
1233
+ //#endregion
858
1234
  //#region ../../node_modules/zod/v4/core/core.js
859
1235
  var _a$1;
860
1236
  function $constructor(name, initializer, params) {
@@ -5533,7 +5909,7 @@ var ZodIssueCode = {
5533
5909
  var ZodFirstPartyTypeKind;
5534
5910
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5535
5911
  //#endregion
5536
- //#region ../types/dist/sleep-SX9bkW3_.mjs
5912
+ //#region ../types/dist/sleep-CSYuxssh.mjs
5537
5913
  /**
5538
5914
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5539
5915
  * window to float samples (D455).
@@ -6049,6 +6425,102 @@ function emitReadiness(bus, params) {
6049
6425
  ts
6050
6426
  }));
6051
6427
  }
6428
+ var NOT_RUN = {
6429
+ declared: false,
6430
+ snapshot: null,
6431
+ applied: [],
6432
+ failed: [],
6433
+ blocked: [],
6434
+ skipped: [],
6435
+ blockOwner: []
6436
+ };
6437
+ /**
6438
+ * Offer `migrations` to the engine and run what it says to run, in its order. Never
6439
+ * throws: an unreachable or refusing engine is logged and reported `declared: false`,
6440
+ * because the hub (and this addon's boot) must not hang on a migration.
6441
+ */
6442
+ async function runAddonMigrations(host, migrations, logger) {
6443
+ const first = migrations[0];
6444
+ if (first === void 0) return NOT_RUN;
6445
+ const owner = first.meta.owner;
6446
+ const log = logger.withTags({ migrationOwner: owner });
6447
+ const byId = new Map(migrations.map((m) => [m.meta.id, m]));
6448
+ let declaration;
6449
+ try {
6450
+ declaration = await host.declareOwner({
6451
+ owner,
6452
+ metas: migrations.map((m) => m.meta)
6453
+ });
6454
+ } catch (err) {
6455
+ log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg(err) } });
6456
+ return {
6457
+ ...NOT_RUN,
6458
+ blockOwner: migrations.filter((m) => m.meta.onFailure === "block-owner").map((m) => m.meta.id)
6459
+ };
6460
+ }
6461
+ const applied = [];
6462
+ const failed = [];
6463
+ const blocked = [];
6464
+ const skipped = [];
6465
+ const settle = (id, status) => {
6466
+ if (status === "applied") applied.push(id);
6467
+ else if (status === "failed") failed.push(id);
6468
+ else if (status === "blocked") blocked.push(id);
6469
+ else skipped.push(id);
6470
+ };
6471
+ for (const step of declaration.steps) {
6472
+ const bound = byId.get(step.id);
6473
+ if (bound === void 0 || step.action === "skip") {
6474
+ skipped.push(step.id);
6475
+ continue;
6476
+ }
6477
+ const tags = { migrationId: step.id };
6478
+ try {
6479
+ const gate = await host.startMigration({ id: step.id });
6480
+ if (!gate.proceed) {
6481
+ log.warn("migration not run", {
6482
+ tags,
6483
+ meta: {
6484
+ state: gate.state,
6485
+ reason: gate.reason
6486
+ }
6487
+ });
6488
+ settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
6489
+ continue;
6490
+ }
6491
+ const result = await bound.execute();
6492
+ const outcome = await host.finishMigration({
6493
+ id: step.id,
6494
+ result
6495
+ });
6496
+ if (outcome.status === "applied") log.info("migration applied", {
6497
+ tags,
6498
+ meta: { rowsChanged: outcome.rowsChanged }
6499
+ });
6500
+ else log.error("migration failed", {
6501
+ tags,
6502
+ meta: { error: outcome.error }
6503
+ });
6504
+ settle(step.id, outcome.status);
6505
+ } catch (err) {
6506
+ log.error("migration could not be completed with the engine", {
6507
+ tags,
6508
+ meta: { error: errMsg(err) }
6509
+ });
6510
+ failed.push(step.id);
6511
+ }
6512
+ }
6513
+ const blockOwner = [...failed, ...blocked].filter((id) => byId.get(id)?.meta.onFailure === "block-owner");
6514
+ return {
6515
+ declared: true,
6516
+ snapshot: declaration.snapshot,
6517
+ applied,
6518
+ failed,
6519
+ blocked,
6520
+ skipped,
6521
+ blockOwner
6522
+ };
6523
+ }
6052
6524
  /**
6053
6525
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
6054
6526
  * `read`/`write` are the addon-store or device-store accessors. The whole
@@ -7104,6 +7576,28 @@ var BaseAddon = class {
7104
7576
  return normalized;
7105
7577
  }
7106
7578
  /**
7579
+ * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7580
+ * engine. Call it at the point of the boot where the data must already have the new
7581
+ * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7582
+ * restored devices — with the catalogue bound to the addon's ports
7583
+ * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7584
+ *
7585
+ * An engine that cannot be reached or refuses the catalogue is logged and runs
7586
+ * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7587
+ * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7588
+ * serve data whose shape it cannot trust; `tolerate` migrations never do.
7589
+ */
7590
+ async runMigrations(migrations) {
7591
+ const api = this.ctx.api.migrations;
7592
+ const report = await runAddonMigrations({
7593
+ declareOwner: (input) => api.declareOwner.mutate(input),
7594
+ startMigration: (input) => api.startMigration.mutate(input),
7595
+ finishMigration: (input) => api.finishMigration.mutate(input)
7596
+ }, migrations, this.ctx.logger);
7597
+ if (report.blockOwner.length > 0) throw new Error(`migration(s) ${report.blockOwner.join(", ")} did not apply and block this addon — fix or retry them (migrations.retry), then restart it`);
7598
+ return report;
7599
+ }
7600
+ /**
7107
7601
  * Called by the isolated-process runner AFTER `broker.start()`.
7108
7602
  * In-process addons never need this because the hub broker is already
7109
7603
  * running when `initialize()` fires. For forked children the broker
@@ -7236,6 +7730,26 @@ var BaseAddon = class {
7236
7730
  * alternative — skip it — turns a rename into a surface that quietly
7237
7731
  * empties, which looks exactly like an addon with nothing to configure.
7238
7732
  */
7733
+ /**
7734
+ * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
7735
+ *
7736
+ * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
7737
+ * needs its connection fields, the default integration the addon's own sections. It is the
7738
+ * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
7739
+ * unchanged (`integrations.setSettings` for an account integration).
7740
+ */
7741
+ async integrationSettingsSchema(_instance) {
7742
+ return null;
7743
+ }
7744
+ /**
7745
+ * What the create wizard and the integration edit page render for one instance: the addon's
7746
+ * per-instance schema when it declares one, else its global schema (what they always showed).
7747
+ */
7748
+ async getIntegrationFormSchema(instance, nodeId) {
7749
+ const scoped = await this.integrationSettingsSchema(instance);
7750
+ if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
7751
+ return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
7752
+ }
7239
7753
  async getIntegrationSettings(nodeId) {
7240
7754
  const declared = this.integrationSettingSections();
7241
7755
  if (declared.length === 0) return null;
@@ -8126,407 +8640,6 @@ var RecordKindDeclarationSchema = object({
8126
8640
  }).strict();
8127
8641
  /** The kind names: lower-case, dash separated, short enough for an index name. */
8128
8642
  var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8129
- var READING_QUANTITIES = [
8130
- "temperature",
8131
- "pressure",
8132
- "speed",
8133
- "precipitation",
8134
- "precipitation-rate",
8135
- "length",
8136
- "area",
8137
- "illuminance",
8138
- "irradiance",
8139
- "power",
8140
- "energy",
8141
- "voltage",
8142
- "current",
8143
- "apparent-power",
8144
- "humidity",
8145
- "percentage",
8146
- "concentration-volume",
8147
- "concentration-mass",
8148
- "concentration-ppb",
8149
- "volume",
8150
- "duration",
8151
- "duration-ms",
8152
- "information",
8153
- "sound-level",
8154
- "signal-level",
8155
- "colour-temperature",
8156
- "angle",
8157
- "bitrate",
8158
- "rate",
8159
- "mass",
8160
- "index",
8161
- "ratio",
8162
- "count",
8163
- "none",
8164
- "device"
8165
- ];
8166
- var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8167
- new Set(READING_QUANTITIES);
8168
- /**
8169
- * Stored unit symbol for a quantity. `none` means the number is dimensionless
8170
- * (or an index / ratio / count). `device` means the cap has no single unit.
8171
- */
8172
- var QUANTITY_BASE = {
8173
- temperature: "°C",
8174
- pressure: "hPa",
8175
- speed: "m/s",
8176
- precipitation: "mm",
8177
- "precipitation-rate": "mm/h",
8178
- length: "m",
8179
- area: "m²",
8180
- illuminance: "lx",
8181
- irradiance: "W/m²",
8182
- power: "W",
8183
- energy: "kWh",
8184
- voltage: "V",
8185
- current: "A",
8186
- "apparent-power": "VA",
8187
- humidity: "%",
8188
- percentage: "%",
8189
- "concentration-volume": "ppm",
8190
- "concentration-mass": "µg/m³",
8191
- "concentration-ppb": "ppb",
8192
- volume: "L",
8193
- duration: "s",
8194
- "duration-ms": "ms",
8195
- information: "B",
8196
- "sound-level": "dBFS",
8197
- "signal-level": "dBm",
8198
- "colour-temperature": "mired",
8199
- angle: "°",
8200
- bitrate: "kbps",
8201
- rate: "fps",
8202
- mass: "kg",
8203
- index: "none",
8204
- ratio: "none",
8205
- count: "none",
8206
- none: "none",
8207
- device: "device"
8208
- };
8209
- /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8210
- function baseUnitOf(quantity) {
8211
- const symbol = QUANTITY_BASE[quantity];
8212
- if (symbol === "none" || symbol === "device") return void 0;
8213
- return symbol;
8214
- }
8215
- function readingMeta(quantity, extras) {
8216
- return {
8217
- quantity,
8218
- ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8219
- ...extras?.label !== void 0 ? { label: extras.label } : {}
8220
- };
8221
- }
8222
- /** Shared Zod schemas used across streaming capabilities. */
8223
- var CamProfileSchema = _enum([
8224
- "high",
8225
- "mid",
8226
- "low"
8227
- ]);
8228
- /**
8229
- * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
8230
- *
8231
- * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
8232
- * that consumer owns". It lives beside `CamProfile` because a rung is the only
8233
- * operator-facing way to name a stream: a cam-stream id is broker-internal and
8234
- * moves when a slot is reassigned, so a stored id silently stops meaning what
8235
- * the operator picked. Today's one user is the audio analyser, whose rule is
8236
- * "the lowest AVAILABLE native rung" (D537).
8237
- */
8238
- var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
8239
- var CamStreamKindSchema = _enum([
8240
- "pull-rtsp",
8241
- "pull-rtmp",
8242
- "pull-http",
8243
- "pull-flv",
8244
- "pull-rfc4571",
8245
- "push-annexb",
8246
- "derived"
8247
- ]);
8248
- var CamStreamResolutionSchema = object({
8249
- width: number().int().positive().meta(readingMeta("none")),
8250
- height: number().int().positive().meta(readingMeta("none"))
8251
- });
8252
- var CameraStreamSchema = object({
8253
- /** Stable, provider-assigned id unique within the (deviceId) scope. */
8254
- camStreamId: string().min(1),
8255
- deviceId: number().int().nonnegative(),
8256
- kind: CamStreamKindSchema,
8257
- /** Required for pull-* kinds. Ignored for push-annexb. */
8258
- url: string().optional(),
8259
- codec: string().optional(),
8260
- resolution: CamStreamResolutionSchema.optional(),
8261
- fps: number().positive().optional(),
8262
- /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
8263
- label: string().optional(),
8264
- /**
8265
- * Device-level features the publisher advertised (e.g. `battery-operated`).
8266
- * The broker, snapshot orchestrator, and prebuffer manager all consult
8267
- * this list to derive policy — relaxed stall watchdog for battery
8268
- * cams, prebuffer off by default, longer snapshot rate-limit, etc.
8269
- *
8270
- * Single source of truth replacing per-stream flags like the
8271
- * historical `allowStall`: if the publisher knows the camera is
8272
- * battery-powered, every downstream service derives the right policy
8273
- * from this list.
8274
- */
8275
- deviceFeatures: array(string()).optional(),
8276
- /**
8277
- * Whether this stream participates in the broker's automatic profile
8278
- * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
8279
- * use `false` when they want a stream to be SELECTABLE in the UI but not
8280
- * picked by default — e.g. Reolink publishes its native Baichuan streams
8281
- * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
8282
- * mirrors as `autoEligible: false` (still pickable per slot, just not
8283
- * the auto choice). Manual `assignProfile` calls remain valid for
8284
- * non-eligible streams.
8285
- */
8286
- autoEligible: boolean().optional(),
8287
- /**
8288
- * The profile slot the PUBLISHER says this stream is: `low` for a stream
8289
- * whose only sensible role is the low-bandwidth one, `high` for a main
8290
- * stream. Consulted by the broker's automatic ranking
8291
- * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
8292
- * an operator's manual assignment still wins, and an absent hint is the
8293
- * pixel-ranked default every camera had before this field existed.
8294
- *
8295
- * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
8296
- * storage class is written for on its own (`recordings` is high|mid,
8297
- * `recordingsLow` is low) and the one profile scrub does not read. The robot
8298
- * camera's single 720p relay is a `low` in every respect except the slot the
8299
- * heuristic put it in.
8300
- */
8301
- profileHint: CamProfileSchema.optional(),
8302
- /**
8303
- * Transport-specific opaque metadata. The broker passes it through to
8304
- * the source reader without inspecting it. Currently used by
8305
- * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
8306
- * route RTP packets to the right depacketizer without an in-band
8307
- * DESCRIBE phase). Other kinds typically leave it undefined.
8308
- */
8309
- metadata: record(string(), unknown()).optional()
8310
- });
8311
- var ProfileSlotStatusSchema = _enum([
8312
- "unassigned",
8313
- "idle",
8314
- "connecting",
8315
- "streaming",
8316
- "error"
8317
- ]);
8318
- var ProfileSlotSchema = object({
8319
- deviceId: number().int().nonnegative(),
8320
- profile: CamProfileSchema,
8321
- /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
8322
- brokerId: string(),
8323
- /** `null` when the profile is unassigned. */
8324
- sourceCamStreamId: string().nullable(),
8325
- status: ProfileSlotStatusSchema,
8326
- resolution: CamStreamResolutionSchema.optional(),
8327
- codec: string().optional(),
8328
- preBufferSec: number().nonnegative().optional(),
8329
- errorMessage: string().optional()
8330
- });
8331
- /**
8332
- * Zod schema for StreamSourceEntry — the canonical stream descriptor
8333
- * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
8334
- */
8335
- var StreamSourceEntrySchema$1 = object({
8336
- id: string(),
8337
- label: string(),
8338
- protocol: _enum([
8339
- "rtsp",
8340
- "rtmp",
8341
- "annexb",
8342
- "http-mjpeg",
8343
- "webrtc",
8344
- "custom"
8345
- ]),
8346
- url: string().optional(),
8347
- resolution: object({
8348
- width: number(),
8349
- height: number()
8350
- }).readonly().optional(),
8351
- fps: number().optional(),
8352
- bitrate: number().optional(),
8353
- codec: string().optional(),
8354
- profileHint: CamProfileSchema.optional()
8355
- });
8356
- object({
8357
- type: string(),
8358
- url: string(),
8359
- videoCodec: string().optional(),
8360
- audioCodec: string().optional(),
8361
- metadata: record(string(), unknown()).readonly().optional()
8362
- });
8363
- /**
8364
- * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
8365
- * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
8366
- * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
8367
- * (the runner's native-crop and pipeline-executor inputs) can carry handles
8368
- * over tRPC / Moleculer.
8369
- *
8370
- * The `satisfies` assertion below pins this schema to the interface: if a
8371
- * field is added to / removed from `FrameHandle` without a matching schema
8372
- * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
8373
- * `FrameHandle` and the build fails — no silent drift.
8374
- */
8375
- var FrameHandleSchema = object({
8376
- shmId: string(),
8377
- slot: number().int().nonnegative(),
8378
- seq: number().int().nonnegative(),
8379
- width: number().int().positive(),
8380
- height: number().int().positive(),
8381
- format: _enum([
8382
- "jpeg",
8383
- "rgb",
8384
- "bgr",
8385
- "yuv420",
8386
- "gray"
8387
- ]),
8388
- pts: number(),
8389
- byteLength: number().int().nonnegative(),
8390
- nodeId: string(),
8391
- slotCount: number().int().positive()
8392
- });
8393
- /**
8394
- * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
8395
- * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
8396
- * sample bytes plus the track parameters a consumer needs to interpret them.
8397
- *
8398
- * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
8399
- * Float32 PCM), so unlike video frames they ship their bytes INLINE over
8400
- * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
8401
- * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
8402
- * it.
8403
- */
8404
- var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
8405
- var DecodedAudioChunkSchema = object({
8406
- data: _instanceof(Uint8Array),
8407
- sampleRate: number().int().positive(),
8408
- channels: number().int().positive(),
8409
- timestamp: number(),
8410
- /**
8411
- * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
8412
- * byte, for any peer that never heard of this field. A coded window
8413
- * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
8414
- * subscription that DECLARED it accepts one, so absence can never mean
8415
- * "coded bytes a consumer will read as floats" (D455).
8416
- */
8417
- format: AudioChunkFormatSchema.optional()
8418
- });
8419
- /**
8420
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
8421
- * its bytes inline: a consumer asks the broker for the decoded audio-chunk
8422
- * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
8423
- * the consumer drains via `pullAudioChunks`.
8424
- */
8425
- var SubscribeAudioChunksInputSchema = object({
8426
- brokerId: string(),
8427
- /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
8428
- tag: string().optional(),
8429
- /**
8430
- * Byte formats this subscriber can READ, best first. The broker serves the
8431
- * chunk's own format when it is in this list and expands to `f32le`
8432
- * otherwise, so a subscriber is never handed bytes it cannot interpret.
8433
- *
8434
- * Absent (or without the source format) means `f32le` — the behaviour every
8435
- * subscriber had before D455, unchanged. This is the negotiation half of
8436
- * the source-bytes lever: it is what lets the broker and its consumers
8437
- * deploy one at a time across three nodes.
8438
- */
8439
- accept: array(AudioChunkFormatSchema).readonly().optional()
8440
- });
8441
- /** Result of `stream-broker.subscribeAudioChunks`. */
8442
- var SubscribeAudioChunksResultSchema = object({
8443
- /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
8444
- subscriptionId: string() });
8445
- var BrokerStatsSchema = object({
8446
- status: _enum([
8447
- "idle",
8448
- "connecting",
8449
- "streaming",
8450
- "error",
8451
- "stopped"
8452
- ]),
8453
- inputFps: number(),
8454
- encodedSubscribers: number(),
8455
- uptimeMs: number(),
8456
- bitrateKbps: number(),
8457
- idrIntervalMs: number(),
8458
- codec: string().optional(),
8459
- totalBytes: number(),
8460
- packetCount: number(),
8461
- rtspClients: number(),
8462
- pipeClients: number(),
8463
- preBufferSec: number(),
8464
- preBufferMs: number(),
8465
- preBufferPackets: number(),
8466
- /**
8467
- * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
8468
- * when the stream has no audio track or the broker is in cold start.
8469
- * `supported = false` means the codec was detected but the local
8470
- * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
8471
- * AAC pipeline wired). Surfaced in the UI device-overview so operators
8472
- * can pre-pick the audio-analysis model that matches the codec.
8473
- */
8474
- audio: object({
8475
- codec: string(),
8476
- sampleRate: number(),
8477
- channels: number(),
8478
- supported: boolean()
8479
- }).nullable().optional(),
8480
- /**
8481
- * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
8482
- * distributing none of the device's audio, on live or recording.
8483
- *
8484
- * Present so a silent camera can be told apart from a broken one on the
8485
- * stream panel itself, without cross-referencing the switch group: a
8486
- * broker holding an `audio` track descriptor while `audioMuted` is true is
8487
- * working exactly as asked. `audioMutedDropped` counts the audio units
8488
- * thrown away since the current dial — it is how you confirm from stats
8489
- * alone that the mute is on the packet path and not merely persisted.
8490
- */
8491
- audioMuted: boolean().optional(),
8492
- audioMutedDropped: number().optional()
8493
- });
8494
- /**
8495
- * Exporter-facing "profile restream" entry. Returned by
8496
- * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
8497
- * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
8498
- * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
8499
- * RTSP restream that aliases the profile's assigned source broker, so
8500
- * every consumer dialling a profile converges on the same single pull.
8501
- * `codec`/`resolution` describe the assigned SOURCE camStream (for the
8502
- * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
8503
- * (raw per-camStream, live-view only).
8504
- */
8505
- var ProfileRtspEntrySchema = object({
8506
- profile: CamProfileSchema,
8507
- /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
8508
- brokerId: string(),
8509
- url: string(),
8510
- mutedUrl: string(),
8511
- enabled: boolean(),
8512
- codec: string().optional(),
8513
- resolution: CamStreamResolutionSchema.optional()
8514
- });
8515
- /**
8516
- * The model weight formats a catalog entry can ship. Schema-free on purpose:
8517
- * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
8518
- * (the model downloader in `@camstack/system`) needs only the list and must
8519
- * reach it through `@camstack/types/addon` without building the cap schema
8520
- * graph (D28).
8521
- */
8522
- var MODEL_FORMATS = [
8523
- "onnx",
8524
- "coreml",
8525
- "openvino",
8526
- "tflite",
8527
- "pt",
8528
- "gguf"
8529
- ];
8530
8643
  object({
8531
8644
  field: string().min(1),
8532
8645
  on: literal("advance")
@@ -8615,6 +8728,407 @@ function optionalMethod(input, output, options) {
8615
8728
  providerOptional: true
8616
8729
  };
8617
8730
  }
8731
+ var READING_QUANTITIES = [
8732
+ "temperature",
8733
+ "pressure",
8734
+ "speed",
8735
+ "precipitation",
8736
+ "precipitation-rate",
8737
+ "length",
8738
+ "area",
8739
+ "illuminance",
8740
+ "irradiance",
8741
+ "power",
8742
+ "energy",
8743
+ "voltage",
8744
+ "current",
8745
+ "apparent-power",
8746
+ "humidity",
8747
+ "percentage",
8748
+ "concentration-volume",
8749
+ "concentration-mass",
8750
+ "concentration-ppb",
8751
+ "volume",
8752
+ "duration",
8753
+ "duration-ms",
8754
+ "information",
8755
+ "sound-level",
8756
+ "signal-level",
8757
+ "colour-temperature",
8758
+ "angle",
8759
+ "bitrate",
8760
+ "rate",
8761
+ "mass",
8762
+ "index",
8763
+ "ratio",
8764
+ "count",
8765
+ "none",
8766
+ "device"
8767
+ ];
8768
+ var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8769
+ new Set(READING_QUANTITIES);
8770
+ /**
8771
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
8772
+ * (or an index / ratio / count). `device` means the cap has no single unit.
8773
+ */
8774
+ var QUANTITY_BASE = {
8775
+ temperature: "°C",
8776
+ pressure: "hPa",
8777
+ speed: "m/s",
8778
+ precipitation: "mm",
8779
+ "precipitation-rate": "mm/h",
8780
+ length: "m",
8781
+ area: "m²",
8782
+ illuminance: "lx",
8783
+ irradiance: "W/m²",
8784
+ power: "W",
8785
+ energy: "kWh",
8786
+ voltage: "V",
8787
+ current: "A",
8788
+ "apparent-power": "VA",
8789
+ humidity: "%",
8790
+ percentage: "%",
8791
+ "concentration-volume": "ppm",
8792
+ "concentration-mass": "µg/m³",
8793
+ "concentration-ppb": "ppb",
8794
+ volume: "L",
8795
+ duration: "s",
8796
+ "duration-ms": "ms",
8797
+ information: "B",
8798
+ "sound-level": "dBFS",
8799
+ "signal-level": "dBm",
8800
+ "colour-temperature": "mired",
8801
+ angle: "°",
8802
+ bitrate: "kbps",
8803
+ rate: "fps",
8804
+ mass: "kg",
8805
+ index: "none",
8806
+ ratio: "none",
8807
+ count: "none",
8808
+ none: "none",
8809
+ device: "device"
8810
+ };
8811
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8812
+ function baseUnitOf(quantity) {
8813
+ const symbol = QUANTITY_BASE[quantity];
8814
+ if (symbol === "none" || symbol === "device") return void 0;
8815
+ return symbol;
8816
+ }
8817
+ function readingMeta(quantity, extras) {
8818
+ return {
8819
+ quantity,
8820
+ ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8821
+ ...extras?.label !== void 0 ? { label: extras.label } : {}
8822
+ };
8823
+ }
8824
+ /** Shared Zod schemas used across streaming capabilities. */
8825
+ var CamProfileSchema = _enum([
8826
+ "high",
8827
+ "mid",
8828
+ "low"
8829
+ ]);
8830
+ /**
8831
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
8832
+ *
8833
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
8834
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
8835
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
8836
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
8837
+ * the operator picked. Today's one user is the audio analyser, whose rule is
8838
+ * "the lowest AVAILABLE native rung" (D537).
8839
+ */
8840
+ var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
8841
+ var CamStreamKindSchema = _enum([
8842
+ "pull-rtsp",
8843
+ "pull-rtmp",
8844
+ "pull-http",
8845
+ "pull-flv",
8846
+ "pull-rfc4571",
8847
+ "push-annexb",
8848
+ "derived"
8849
+ ]);
8850
+ var CamStreamResolutionSchema = object({
8851
+ width: number().int().positive().meta(readingMeta("none")),
8852
+ height: number().int().positive().meta(readingMeta("none"))
8853
+ });
8854
+ var CameraStreamSchema = object({
8855
+ /** Stable, provider-assigned id unique within the (deviceId) scope. */
8856
+ camStreamId: string().min(1),
8857
+ deviceId: number().int().nonnegative(),
8858
+ kind: CamStreamKindSchema,
8859
+ /** Required for pull-* kinds. Ignored for push-annexb. */
8860
+ url: string().optional(),
8861
+ codec: string().optional(),
8862
+ resolution: CamStreamResolutionSchema.optional(),
8863
+ fps: number().positive().optional(),
8864
+ /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
8865
+ label: string().optional(),
8866
+ /**
8867
+ * Device-level features the publisher advertised (e.g. `battery-operated`).
8868
+ * The broker, snapshot orchestrator, and prebuffer manager all consult
8869
+ * this list to derive policy — relaxed stall watchdog for battery
8870
+ * cams, prebuffer off by default, longer snapshot rate-limit, etc.
8871
+ *
8872
+ * Single source of truth replacing per-stream flags like the
8873
+ * historical `allowStall`: if the publisher knows the camera is
8874
+ * battery-powered, every downstream service derives the right policy
8875
+ * from this list.
8876
+ */
8877
+ deviceFeatures: array(string()).optional(),
8878
+ /**
8879
+ * Whether this stream participates in the broker's automatic profile
8880
+ * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
8881
+ * use `false` when they want a stream to be SELECTABLE in the UI but not
8882
+ * picked by default — e.g. Reolink publishes its native Baichuan streams
8883
+ * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
8884
+ * mirrors as `autoEligible: false` (still pickable per slot, just not
8885
+ * the auto choice). Manual `assignProfile` calls remain valid for
8886
+ * non-eligible streams.
8887
+ */
8888
+ autoEligible: boolean().optional(),
8889
+ /**
8890
+ * The profile slot the PUBLISHER says this stream is: `low` for a stream
8891
+ * whose only sensible role is the low-bandwidth one, `high` for a main
8892
+ * stream. Consulted by the broker's automatic ranking
8893
+ * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
8894
+ * an operator's manual assignment still wins, and an absent hint is the
8895
+ * pixel-ranked default every camera had before this field existed.
8896
+ *
8897
+ * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
8898
+ * storage class is written for on its own (`recordings` is high|mid,
8899
+ * `recordingsLow` is low) and the one profile scrub does not read. The robot
8900
+ * camera's single 720p relay is a `low` in every respect except the slot the
8901
+ * heuristic put it in.
8902
+ */
8903
+ profileHint: CamProfileSchema.optional(),
8904
+ /**
8905
+ * Transport-specific opaque metadata. The broker passes it through to
8906
+ * the source reader without inspecting it. Currently used by
8907
+ * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
8908
+ * route RTP packets to the right depacketizer without an in-band
8909
+ * DESCRIBE phase). Other kinds typically leave it undefined.
8910
+ */
8911
+ metadata: record(string(), unknown()).optional()
8912
+ });
8913
+ var ProfileSlotStatusSchema = _enum([
8914
+ "unassigned",
8915
+ "idle",
8916
+ "connecting",
8917
+ "streaming",
8918
+ "error"
8919
+ ]);
8920
+ var ProfileSlotSchema = object({
8921
+ deviceId: number().int().nonnegative(),
8922
+ profile: CamProfileSchema,
8923
+ /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
8924
+ brokerId: string(),
8925
+ /** `null` when the profile is unassigned. */
8926
+ sourceCamStreamId: string().nullable(),
8927
+ status: ProfileSlotStatusSchema,
8928
+ resolution: CamStreamResolutionSchema.optional(),
8929
+ codec: string().optional(),
8930
+ preBufferSec: number().nonnegative().optional(),
8931
+ errorMessage: string().optional()
8932
+ });
8933
+ /**
8934
+ * Zod schema for StreamSourceEntry — the canonical stream descriptor
8935
+ * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
8936
+ */
8937
+ var StreamSourceEntrySchema$1 = object({
8938
+ id: string(),
8939
+ label: string(),
8940
+ protocol: _enum([
8941
+ "rtsp",
8942
+ "rtmp",
8943
+ "annexb",
8944
+ "http-mjpeg",
8945
+ "webrtc",
8946
+ "custom"
8947
+ ]),
8948
+ url: string().optional(),
8949
+ resolution: object({
8950
+ width: number(),
8951
+ height: number()
8952
+ }).readonly().optional(),
8953
+ fps: number().optional(),
8954
+ bitrate: number().optional(),
8955
+ codec: string().optional(),
8956
+ profileHint: CamProfileSchema.optional()
8957
+ });
8958
+ object({
8959
+ type: string(),
8960
+ url: string(),
8961
+ videoCodec: string().optional(),
8962
+ audioCodec: string().optional(),
8963
+ metadata: record(string(), unknown()).readonly().optional()
8964
+ });
8965
+ /**
8966
+ * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
8967
+ * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
8968
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
8969
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
8970
+ * over tRPC / Moleculer.
8971
+ *
8972
+ * The `satisfies` assertion below pins this schema to the interface: if a
8973
+ * field is added to / removed from `FrameHandle` without a matching schema
8974
+ * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
8975
+ * `FrameHandle` and the build fails — no silent drift.
8976
+ */
8977
+ var FrameHandleSchema = object({
8978
+ shmId: string(),
8979
+ slot: number().int().nonnegative(),
8980
+ seq: number().int().nonnegative(),
8981
+ width: number().int().positive(),
8982
+ height: number().int().positive(),
8983
+ format: _enum([
8984
+ "jpeg",
8985
+ "rgb",
8986
+ "bgr",
8987
+ "yuv420",
8988
+ "gray"
8989
+ ]),
8990
+ pts: number(),
8991
+ byteLength: number().int().nonnegative(),
8992
+ nodeId: string(),
8993
+ slotCount: number().int().positive()
8994
+ });
8995
+ /**
8996
+ * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
8997
+ * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
8998
+ * sample bytes plus the track parameters a consumer needs to interpret them.
8999
+ *
9000
+ * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
9001
+ * Float32 PCM), so unlike video frames they ship their bytes INLINE over
9002
+ * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
9003
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
9004
+ * it.
9005
+ */
9006
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
9007
+ var DecodedAudioChunkSchema = object({
9008
+ data: _instanceof(Uint8Array),
9009
+ sampleRate: number().int().positive(),
9010
+ channels: number().int().positive(),
9011
+ timestamp: number(),
9012
+ /**
9013
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
9014
+ * byte, for any peer that never heard of this field. A coded window
9015
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
9016
+ * subscription that DECLARED it accepts one, so absence can never mean
9017
+ * "coded bytes a consumer will read as floats" (D455).
9018
+ */
9019
+ format: AudioChunkFormatSchema.optional()
9020
+ });
9021
+ /**
9022
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
9023
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
9024
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
9025
+ * the consumer drains via `pullAudioChunks`.
9026
+ */
9027
+ var SubscribeAudioChunksInputSchema = object({
9028
+ brokerId: string(),
9029
+ /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
9030
+ tag: string().optional(),
9031
+ /**
9032
+ * Byte formats this subscriber can READ, best first. The broker serves the
9033
+ * chunk's own format when it is in this list and expands to `f32le`
9034
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
9035
+ *
9036
+ * Absent (or without the source format) means `f32le` — the behaviour every
9037
+ * subscriber had before D455, unchanged. This is the negotiation half of
9038
+ * the source-bytes lever: it is what lets the broker and its consumers
9039
+ * deploy one at a time across three nodes.
9040
+ */
9041
+ accept: array(AudioChunkFormatSchema).readonly().optional()
9042
+ });
9043
+ /** Result of `stream-broker.subscribeAudioChunks`. */
9044
+ var SubscribeAudioChunksResultSchema = object({
9045
+ /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
9046
+ subscriptionId: string() });
9047
+ var BrokerStatsSchema = object({
9048
+ status: _enum([
9049
+ "idle",
9050
+ "connecting",
9051
+ "streaming",
9052
+ "error",
9053
+ "stopped"
9054
+ ]),
9055
+ inputFps: number(),
9056
+ encodedSubscribers: number(),
9057
+ uptimeMs: number(),
9058
+ bitrateKbps: number(),
9059
+ idrIntervalMs: number(),
9060
+ codec: string().optional(),
9061
+ totalBytes: number(),
9062
+ packetCount: number(),
9063
+ rtspClients: number(),
9064
+ pipeClients: number(),
9065
+ preBufferSec: number(),
9066
+ preBufferMs: number(),
9067
+ preBufferPackets: number(),
9068
+ /**
9069
+ * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
9070
+ * when the stream has no audio track or the broker is in cold start.
9071
+ * `supported = false` means the codec was detected but the local
9072
+ * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
9073
+ * AAC pipeline wired). Surfaced in the UI device-overview so operators
9074
+ * can pre-pick the audio-analysis model that matches the codec.
9075
+ */
9076
+ audio: object({
9077
+ codec: string(),
9078
+ sampleRate: number(),
9079
+ channels: number(),
9080
+ supported: boolean()
9081
+ }).nullable().optional(),
9082
+ /**
9083
+ * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
9084
+ * distributing none of the device's audio, on live or recording.
9085
+ *
9086
+ * Present so a silent camera can be told apart from a broken one on the
9087
+ * stream panel itself, without cross-referencing the switch group: a
9088
+ * broker holding an `audio` track descriptor while `audioMuted` is true is
9089
+ * working exactly as asked. `audioMutedDropped` counts the audio units
9090
+ * thrown away since the current dial — it is how you confirm from stats
9091
+ * alone that the mute is on the packet path and not merely persisted.
9092
+ */
9093
+ audioMuted: boolean().optional(),
9094
+ audioMutedDropped: number().optional()
9095
+ });
9096
+ /**
9097
+ * Exporter-facing "profile restream" entry. Returned by
9098
+ * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
9099
+ * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
9100
+ * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
9101
+ * RTSP restream that aliases the profile's assigned source broker, so
9102
+ * every consumer dialling a profile converges on the same single pull.
9103
+ * `codec`/`resolution` describe the assigned SOURCE camStream (for the
9104
+ * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
9105
+ * (raw per-camStream, live-view only).
9106
+ */
9107
+ var ProfileRtspEntrySchema = object({
9108
+ profile: CamProfileSchema,
9109
+ /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
9110
+ brokerId: string(),
9111
+ url: string(),
9112
+ mutedUrl: string(),
9113
+ enabled: boolean(),
9114
+ codec: string().optional(),
9115
+ resolution: CamStreamResolutionSchema.optional()
9116
+ });
9117
+ /**
9118
+ * The model weight formats a catalog entry can ship. Schema-free on purpose:
9119
+ * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
9120
+ * (the model downloader in `@camstack/server/system`) needs only the list and must
9121
+ * reach it through `@camstack/types/addon` without building the cap schema
9122
+ * graph (D28).
9123
+ */
9124
+ var MODEL_FORMATS = [
9125
+ "onnx",
9126
+ "coreml",
9127
+ "openvino",
9128
+ "tflite",
9129
+ "pt",
9130
+ "gguf"
9131
+ ];
8618
9132
  /**
8619
9133
  * `addon-pages-source` — collection cap exposing per-provider raw page
8620
9134
  * declarations. Every addon that contributes a UI page registers a
@@ -8878,6 +9392,7 @@ var CAP_NAMES = Object.freeze([
8878
9392
  "mesh-network",
8879
9393
  "meter",
8880
9394
  "metrics-provider",
9395
+ "migrations",
8881
9396
  "model-convert",
8882
9397
  "model-distributor",
8883
9398
  "motion",
@@ -8910,6 +9425,7 @@ var CAP_NAMES = Object.freeze([
8910
9425
  "plate-gallery",
8911
9426
  "platform-probe",
8912
9427
  "power-meter",
9428
+ "power-source",
8913
9429
  "presence",
8914
9430
  "pressure-sensor",
8915
9431
  "privacy-mask",
@@ -10261,6 +10777,13 @@ Object.freeze({
10261
10777
  "valueType": "number"
10262
10778
  }
10263
10779
  ],
10780
+ "power-source": [{
10781
+ "path": "switchOn",
10782
+ "valueType": "boolean"
10783
+ }, {
10784
+ "path": "offSeconds",
10785
+ "valueType": "number"
10786
+ }],
10264
10787
  "presence": [
10265
10788
  {
10266
10789
  "path": "state",
@@ -10772,379 +11295,7 @@ object({
10772
11295
  params: record(string(), union([string(), number()])).optional()
10773
11296
  });
10774
11297
  //#endregion
10775
- //#region ../types/dist/err-msg-BD5buxvT.mjs
10776
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
10777
- DeviceType["Camera"] = "camera";
10778
- DeviceType["Hub"] = "hub";
10779
- DeviceType["Light"] = "light";
10780
- DeviceType["Siren"] = "siren";
10781
- DeviceType["Switch"] = "switch";
10782
- DeviceType["Sensor"] = "sensor";
10783
- DeviceType["Thermostat"] = "thermostat";
10784
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
10785
- * `climate-control` cap surface with `Thermostat` but renders a
10786
- * dedicated AC-appropriate control UI (mode chips, fan speed,
10787
- * independent vertical/horizontal swing). Sources: native Gree, and
10788
- * reusable by other AC integrations. */
10789
- DeviceType["Climate"] = "climate";
10790
- DeviceType["Button"] = "button";
10791
- /** Generic stateless event emitter — carries a device's EXACT declared
10792
- * event vocabulary verbatim (no normalization). Installed with the
10793
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
10794
- * HA bus events (e.g. `zha_event`, generic). */
10795
- DeviceType["EventEmitter"] = "event-emitter";
10796
- /** Firmware/software update entity — current vs available version,
10797
- * updatable flag, update state, and an install action. Installed with
10798
- * the `update` cap. Sources: Homematic firmware-update channels (and
10799
- * reusable by other providers, e.g. HA `update.*` entities). */
10800
- DeviceType["Update"] = "update";
10801
- DeviceType["Generic"] = "generic";
10802
- /** Generic notification delivery target (HA `notify.<service>`, future
10803
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
10804
- * endpoint; the `notifier` cap defines the send surface. */
10805
- DeviceType["Notifier"] = "notifier";
10806
- /** Pre-recorded action sequence with optional parameters
10807
- * (HA `script.*`). Runnable via `script-runner` cap. */
10808
- DeviceType["Script"] = "script";
10809
- /** Automation rule (HA `automation.*`) — enable/disable + manual
10810
- * trigger surface exposed via `automation-control` cap. */
10811
- DeviceType["Automation"] = "automation";
10812
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
10813
- DeviceType["Lock"] = "lock";
10814
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
10815
- * `valve.*`). `cover` cap with sub-roles for variant. */
10816
- DeviceType["Cover"] = "cover";
10817
- /** Pipe / water / gas valve with open/close/stop and optional
10818
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
10819
- * modelled on the same open/closed lifecycle. */
10820
- DeviceType["Valve"] = "valve";
10821
- /** Humidifier / dehumidifier with on/off + target humidity + mode
10822
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
10823
- * modelled on the same target / mode lifecycle. */
10824
- DeviceType["Humidifier"] = "humidifier";
10825
- /** Water heater / boiler with target temperature + operation mode +
10826
- * away mode (HA `water_heater.*`). `water-heater` cap — a
10827
- * climate-family actuator. */
10828
- DeviceType["WaterHeater"] = "water-heater";
10829
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
10830
- DeviceType["Fan"] = "fan";
10831
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
10832
- * the camera surface — those use `Camera`. `media-player` cap. */
10833
- DeviceType["MediaPlayer"] = "media-player";
10834
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
10835
- * `alarm-panel` cap. */
10836
- DeviceType["AlarmPanel"] = "alarm-panel";
10837
- /** Generic user-settable input (HA `number` / `input_number` / `select`
10838
- * / `input_select` / `text` / `input_text` / `input_datetime`).
10839
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
10840
- * TextControl / DateTimeControl. */
10841
- DeviceType["Control"] = "control";
10842
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
10843
- * `presence` cap. */
10844
- DeviceType["Presence"] = "presence";
10845
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
10846
- * `weather` cap. */
10847
- DeviceType["Weather"] = "weather";
10848
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
10849
- DeviceType["Vacuum"] = "vacuum";
10850
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
10851
- * `lawn-mower-control` cap. */
10852
- DeviceType["LawnMower"] = "lawn-mower";
10853
- /** Physical HA device group — parent container for entity-children
10854
- * adopted from a single HA device entry. Not renderable as a
10855
- * standalone device; exists only to anchor child entities. */
10856
- DeviceType["Container"] = "container";
10857
- /** Single still-image entity (HA `image.*`). Read-only display of an
10858
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
10859
- DeviceType["Image"] = "image";
10860
- /** Smart pet feeder — cloud-connected food dispenser with a bowl food
10861
- * level, battery, desiccant life, feeding state and manual-feed /
10862
- * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
10863
- * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
10864
- * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10865
- * integrations sharing the same food/desiccant/hopper surface. */
10866
- DeviceType["PetFeeder"] = "pet-feeder";
10867
- /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10868
- * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10869
- * of a container and is BUILT as a composed device (D967). */
10870
- DeviceType["PetFountain"] = "pet-fountain";
10871
- /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10872
- * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10873
- * Sources: native Bosch Home Connect, reusable by similar integrations.
10874
- * A plug-built dishwasher carries running-state and power instead. */
10875
- DeviceType["Dishwasher"] = "dishwasher";
10876
- /** Washing machine. A plug-built one is running while its power stays
10877
- * above a threshold. No program cap — that surface is the dishwasher's. */
10878
- DeviceType["Washer"] = "washer";
10879
- /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
10880
- DeviceType["Dryer"] = "dryer";
10881
- /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
10882
- * other radio-to-IP bridges). It carries the box's own facts (firmware,
10883
- * address, connection state) and the actions the box really supports
10884
- * (`reboot`, `device-admin-link`). Products are NOT its children — they are
10885
- * adopted beside it — and its connection settings stay on the integration. */
10886
- DeviceType["Gateway"] = "gateway";
10887
- return DeviceType;
10888
- }({});
10889
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
10890
- DeviceFeature["BatteryOperated"] = "battery-operated";
10891
- DeviceFeature["Rebootable"] = "rebootable";
10892
- /**
10893
- * Device supports an on-demand re-sync of its derived spec with its
10894
- * upstream source — drives the generic Re-sync button. The owning
10895
- * provider implements the action via the `device-adoption.resync` cap.
10896
- */
10897
- DeviceFeature["Resyncable"] = "resyncable";
10898
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
10899
- DeviceFeature["DoorbellButton"] = "doorbell-button";
10900
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
10901
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
10902
- /**
10903
- * Camera supports the on-firmware autotrack subsystem (subject-
10904
- * following). Distinct from `PanTiltZoom` because not every PTZ
10905
- * camera ships autotrack — the admin UI uses this flag to gate
10906
- * the autotrack toggle / settings card without re-deriving from
10907
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
10908
- * driver sets this feature when probe confirms the firmware
10909
- * surface, and registers the cap in the same code path.
10910
- */
10911
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
10912
- /**
10913
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
10914
- * motion detection automatically activates this device. Mirrors
10915
- * `motion-trigger` cap registration: drivers set this feature in the
10916
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
10917
- *
10918
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
10919
- * fast scalar without binding fetch), notifier rules, and `listAll`
10920
- * filters that want "all devices with on-motion behaviour".
10921
- */
10922
- DeviceFeature["MotionTrigger"] = "motion-trigger";
10923
- /** Light supports rgb-triplet color via `color` cap. */
10924
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
10925
- /** Light supports HSV color via `color` cap. */
10926
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
10927
- /** Light supports color-temperature (mired) via `color` cap. */
10928
- DeviceFeature["LightColorMired"] = "light-color-mired";
10929
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
10930
- * targetHigh). Gates the range slider UI. */
10931
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
10932
- /** Thermostat exposes target humidity and/or current humidity
10933
- * readings. Gates the humidity controls. */
10934
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
10935
- /** Thermostat exposes a fan-mode selector. */
10936
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
10937
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
10938
- DeviceFeature["ClimatePreset"] = "climate-preset";
10939
- /** Thermostat exposes a vertical louver swing toggle. Gates the
10940
- * vertical-swing switch in the climate UI. Independent of horizontal. */
10941
- DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
10942
- /** Thermostat exposes a horizontal louver swing toggle. Gates the
10943
- * horizontal-swing switch in the climate UI. Independent of vertical. */
10944
- DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
10945
- /** Cover exposes intermediate position control (0..100). Gates the
10946
- * position slider UI. */
10947
- DeviceFeature["CoverPositionable"] = "cover-positionable";
10948
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
10949
- DeviceFeature["CoverTilt"] = "cover-tilt";
10950
- /** Valve exposes intermediate position control (0..100). Gates the
10951
- * position slider / drag surface UI. */
10952
- DeviceFeature["ValvePositionable"] = "valve-positionable";
10953
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
10954
- DeviceFeature["FanSpeed"] = "fan-speed";
10955
- /** Fan exposes a preset mode selector. */
10956
- DeviceFeature["FanPreset"] = "fan-preset";
10957
- /** Fan exposes blade direction (forward/reverse) — typical of
10958
- * ceiling fans. */
10959
- DeviceFeature["FanDirection"] = "fan-direction";
10960
- /** Fan exposes an oscillation toggle. */
10961
- DeviceFeature["FanOscillating"] = "fan-oscillating";
10962
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
10963
- * field on the UI lock-controls panel. */
10964
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
10965
- /** Lock supports a latch-release ("open door") action distinct from
10966
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
10967
- * `supported_features`. Gates the Open Door button in the UI. */
10968
- DeviceFeature["LockOpen"] = "lock-open";
10969
- /** Media player exposes a seek-to-position surface. */
10970
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
10971
- /** Media player exposes a volume-level setter. */
10972
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
10973
- /** Media player exposes a mute toggle distinct from volume=0. */
10974
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
10975
- /** Media player exposes a shuffle toggle. */
10976
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
10977
- /** Media player exposes a repeat mode (off / all / one). */
10978
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
10979
- /** Media player exposes a source / input selector. */
10980
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
10981
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
10982
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
10983
- /** Media player exposes next-track. */
10984
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
10985
- /** Media player exposes previous-track. */
10986
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
10987
- /** Media player exposes stop distinct from pause. */
10988
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
10989
- /** Alarm panel requires a PIN code on arm/disarm. */
10990
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
10991
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
10992
- * addition to a textual location. */
10993
- DeviceFeature["PresenceGps"] = "presence-gps";
10994
- /** Notifier accepts an inline / URL image attachment. */
10995
- DeviceFeature["NotifierImage"] = "notifier-image";
10996
- /** Notifier accepts a priority hint (high/normal/low). */
10997
- DeviceFeature["NotifierPriority"] = "notifier-priority";
10998
- /** Notifier accepts a free-form `data` payload for platform-specific
10999
- * fields. */
11000
- DeviceFeature["NotifierData"] = "notifier-data";
11001
- /** Notifier supports interactive action buttons / callbacks. */
11002
- DeviceFeature["NotifierActions"] = "notifier-actions";
11003
- /** Notifier supports per-call recipient targeting (multi-user). */
11004
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
11005
- /** Script runner accepts a variables map on each run invocation. */
11006
- DeviceFeature["ScriptVariables"] = "script-variables";
11007
- /** Automation `trigger` accepts a skipCondition flag — fires the
11008
- * automation's actions while bypassing its condition block. */
11009
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
11010
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
11011
- * map tile in the vacuum UI. */
11012
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
11013
- /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
11014
- * switches group. */
11015
- DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
11016
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
11017
- * mower map tile. */
11018
- DeviceFeature["MowerHasMap"] = "mower-has-map";
11019
- /** Robot mower exposes targeted mowing (all-area / zones / edges /
11020
- * spots) — gates the Mow action + map selectors. */
11021
- DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
11022
- return DeviceFeature;
11023
- }({});
11024
- /**
11025
- * Semantic role a device plays within its parent. Populated by driver
11026
- * addons when creating accessory devices (Reolink siren/floodlight/
11027
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
11028
- * admin UI to pick icons, labels, and widgets — a `Switch` with
11029
- * `role: Floodlight` renders as a bulb with a brightness slider,
11030
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
11031
- *
11032
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
11033
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
11034
- */
11035
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
11036
- DeviceRole["Siren"] = "siren";
11037
- DeviceRole["Floodlight"] = "floodlight";
11038
- DeviceRole["Spotlight"] = "spotlight";
11039
- DeviceRole["PirSensor"] = "pir-sensor";
11040
- DeviceRole["Chime"] = "chime";
11041
- DeviceRole["Autotrack"] = "autotrack";
11042
- DeviceRole["Nightvision"] = "nightvision";
11043
- DeviceRole["PrivacyMask"] = "privacy-mask";
11044
- DeviceRole["Doorbell"] = "doorbell";
11045
- /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
11046
- DeviceRole["CoverBlind"] = "cover-blind";
11047
- /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
11048
- DeviceRole["CoverShutter"] = "cover-shutter";
11049
- /** Exterior awning. HA `device_class: awning`. */
11050
- DeviceRole["CoverAwning"] = "cover-awning";
11051
- /** Curtain / drape. HA `device_class: curtain`. */
11052
- DeviceRole["CoverCurtain"] = "cover-curtain";
11053
- /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
11054
- DeviceRole["CoverGarage"] = "cover-garage";
11055
- /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
11056
- DeviceRole["CoverGate"] = "cover-gate";
11057
- /** Door. HA `device_class: door`. A security actuator: exports gate it. */
11058
- DeviceRole["CoverDoor"] = "cover-door";
11059
- /** Window. HA `device_class: window`. */
11060
- DeviceRole["CoverWindow"] = "cover-window";
11061
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
11062
- * real Switch device for UI rendering / export adapters. */
11063
- DeviceRole["BinaryHelper"] = "binary-helper";
11064
- /** A smart plug: a `switch` whose source says it is an outlet (HA
11065
- * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
11066
- DeviceRole["Outlet"] = "outlet";
11067
- /** Generic motion / occupancy / moving event source. Distinct from
11068
- * the camera accessory PirSensor role: that one is a camera child;
11069
- * this is a standalone HA / 3rd-party motion sensor. */
11070
- DeviceRole["MotionSensor"] = "motion-sensor";
11071
- DeviceRole["ContactSensor"] = "contact-sensor";
11072
- DeviceRole["LeakSensor"] = "leak-sensor";
11073
- DeviceRole["SmokeSensor"] = "smoke-sensor";
11074
- DeviceRole["COSensor"] = "co-sensor";
11075
- DeviceRole["GasSensor"] = "gas-sensor";
11076
- DeviceRole["TamperSensor"] = "tamper-sensor";
11077
- DeviceRole["VibrationSensor"] = "vibration-sensor";
11078
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
11079
- DeviceRole["SoundSensor"] = "sound-sensor";
11080
- /** Fallback for `binary_sensor` without a known `device_class`. */
11081
- DeviceRole["BinarySensor"] = "binary-sensor";
11082
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
11083
- DeviceRole["HumiditySensor"] = "humidity-sensor";
11084
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
11085
- DeviceRole["PressureSensor"] = "pressure-sensor";
11086
- /** Wind speed or direction (weather-station `wind-sensor` cap). */
11087
- DeviceRole["WindSensor"] = "wind-sensor";
11088
- /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
11089
- DeviceRole["RainSensor"] = "rain-sensor";
11090
- /** UV index (weather-station `uv-sensor` cap). */
11091
- DeviceRole["UvSensor"] = "uv-sensor";
11092
- /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
11093
- * Distinct from AmbientLightSensor (lux). */
11094
- DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
11095
- /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
11096
- DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
11097
- DeviceRole["PowerSensor"] = "power-sensor";
11098
- DeviceRole["EnergySensor"] = "energy-sensor";
11099
- DeviceRole["VoltageSensor"] = "voltage-sensor";
11100
- DeviceRole["CurrentSensor"] = "current-sensor";
11101
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
11102
- /** Battery level (numeric % via `sensor` OR low-bool via
11103
- * `binary_sensor` — the cap distinguishes via the value type). */
11104
- DeviceRole["BatterySensor"] = "battery-sensor";
11105
- /** Fallback for `sensor` numeric without a known `device_class`. */
11106
- DeviceRole["NumericSensor"] = "numeric-sensor";
11107
- /** String / enum state (HA `sensor` with `state_class: enum` or
11108
- * `attributes.options`). */
11109
- DeviceRole["EnumSensor"] = "enum-sensor";
11110
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
11111
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
11112
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
11113
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
11114
- /** Last-resort fallback when nothing else matches. */
11115
- DeviceRole["GenericSensor"] = "generic-sensor";
11116
- DeviceRole["NumericControl"] = "numeric-control";
11117
- DeviceRole["SelectControl"] = "select-control";
11118
- DeviceRole["TextControl"] = "text-control";
11119
- DeviceRole["DateTimeControl"] = "datetime-control";
11120
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
11121
- * rich features (image, priority, channel routing). */
11122
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
11123
- /** Chat / messaging service (HA `notify.telegram_*`,
11124
- * `notify.discord_*`, etc.). */
11125
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
11126
- /** Email-based delivery (HA `notify.smtp`, etc.). */
11127
- DeviceRole["EmailNotifier"] = "email-notifier";
11128
- /** Fallback when the notifier service name doesn't match a known
11129
- * pattern. */
11130
- DeviceRole["GenericNotifier"] = "generic-notifier";
11131
- /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
11132
- * cap. A `DeviceType.Generic` device. */
11133
- DeviceRole["IrTransmitter"] = "ir-transmitter";
11134
- return DeviceRole;
11135
- }({});
11136
- /**
11137
- import { errMsg } from '@camstack/types'
11138
- * Extract a human-readable message from an unknown error value.
11139
- * Replaces the ubiquitous `errMsg(err)` pattern.
11140
- */
11141
- function errMsg(err) {
11142
- if (err instanceof Error) return err.message;
11143
- if (typeof err === "string") return err;
11144
- return String(err);
11145
- }
11146
- //#endregion
11147
- //#region ../types/dist/composition-C7WdThmP.mjs
11298
+ //#region ../types/dist/composition-BBzVf2xd.mjs
11148
11299
  /**
11149
11300
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11150
11301
  *
@@ -12363,6 +12514,90 @@ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
12363
12514
  var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
12364
12515
  new Set(EVENT_OWNER_TYPES);
12365
12516
  /**
12517
+ * What a published package needs from the rest of the install (D989).
12518
+ *
12519
+ * One published framework package (`@camstack/server`) carries the kernel, the
12520
+ * builtins and the capability contracts, so "which addon runs on which
12521
+ * framework" is a question of version, and the answer is DECLARED by the
12522
+ * package that knows it:
12523
+ *
12524
+ * - an addon says the oldest server it runs on (`requires.server: ">=X"`);
12525
+ * - the server says the oldest addon it works with
12526
+ * (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
12527
+ * around it (`requires.wrapper: { desktop, image }`);
12528
+ * - a wrapper (the desktop app, the container starter) says which server
12529
+ * range it can host, and reports its own kind and version.
12530
+ *
12531
+ * The publish workflow STAMPS these after the version bump
12532
+ * (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
12533
+ *
12534
+ * A requirement that cannot be checked is NOT met: a shell that reports no
12535
+ * version counts as below the minimum, and an unreadable running version is
12536
+ * named in the result (a failed read is never a pass).
12537
+ */
12538
+ /** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
12539
+ var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
12540
+ object({
12541
+ /** The oldest `@camstack/server` this package runs on. */
12542
+ server: MinVersionSchema.optional(),
12543
+ /** The oldest installed version of each named addon package. */
12544
+ addons: record(string(), MinVersionSchema).optional(),
12545
+ /** The oldest shell around the server, per shell kind. */
12546
+ wrapper: object({
12547
+ desktop: MinVersionSchema.optional(),
12548
+ image: MinVersionSchema.optional()
12549
+ }).optional()
12550
+ });
12551
+ /** One unmet requirement; each names the versions on both sides. */
12552
+ var UnmetRequirementSchema = discriminatedUnion("kind", [
12553
+ object({
12554
+ kind: literal("server-too-old"),
12555
+ required: string(),
12556
+ /** `null` — the running server version could not be read. */
12557
+ running: string().nullable()
12558
+ }),
12559
+ object({
12560
+ kind: literal("addon-too-old"),
12561
+ packageName: string(),
12562
+ required: string(),
12563
+ /** `null` — the addon is not installed (or its version is unreadable). */
12564
+ running: string().nullable()
12565
+ }),
12566
+ object({
12567
+ kind: literal("wrapper-too-old"),
12568
+ wrapper: _enum(["desktop", "image"]),
12569
+ required: string(),
12570
+ /** `null` — the wrapper reported no version. */
12571
+ running: string().nullable()
12572
+ })
12573
+ ]);
12574
+ var RequiredAddonUpdateSchema = object({
12575
+ packageName: string(),
12576
+ /** The minimum the target server declares. */
12577
+ required: string(),
12578
+ /** What this node has; `null` when the addon is not installed. */
12579
+ installed: string().nullable()
12580
+ });
12581
+ /**
12582
+ * Which integration instance a settings form is for. An addon that serves several instances
12583
+ * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
12584
+ * needs its connection, the default integration needs the addon's own sections.
12585
+ *
12586
+ * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
12587
+ * setting up a NEW instance.
12588
+ * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
12589
+ * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
12590
+ */
12591
+ var IntegrationInstanceRefSchema = object({
12592
+ integrationId: string().nullable(),
12593
+ mode: _enum([
12594
+ "standalone",
12595
+ "account",
12596
+ "broker"
12597
+ ]),
12598
+ candidateStableId: string().optional()
12599
+ });
12600
+ /**
12366
12601
  * Build an `IAddonRouteProvider` from a list of routes. Implements
12367
12602
  * both the operator-facing `getRoutes` (returning route descriptors
12368
12603
  * minus the handlers, which can't cross JSON) and the framework-
@@ -12935,6 +13170,613 @@ var CameraSwitchGroupSchema = object({
12935
13170
  fetchedAt: number()
12936
13171
  });
12937
13172
  /**
13173
+ * Query filter for settings-store collections.
13174
+ */
13175
+ var QueryFilterSchema = object({
13176
+ where: record(string(), unknown()).optional(),
13177
+ whereIn: record(string(), array(unknown())).optional(),
13178
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13179
+ /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
13180
+ whereNot: record(string(), unknown()).optional(),
13181
+ /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
13182
+ * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
13183
+ whereNotIn: record(string(), array(unknown())).optional(),
13184
+ orderBy: object({
13185
+ field: string(),
13186
+ direction: _enum(["asc", "desc"])
13187
+ }).optional(),
13188
+ limit: number().optional(),
13189
+ offset: number().optional()
13190
+ });
13191
+ /**
13192
+ * The predicate half of a filter, for BULK MUTATIONS.
13193
+ *
13194
+ * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
13195
+ * meaning for a statement that rewrites a set, and accepting them would invite
13196
+ * a caller to believe `limit` bounds the damage. Every field is optional here
13197
+ * only so the shape stays composable — the implementation REJECTS a filter
13198
+ * that compiles to no predicate, because that is the whole collection.
13199
+ */
13200
+ var MutationFilterSchema = object({
13201
+ where: record(string(), unknown()).optional(),
13202
+ whereIn: record(string(), array(unknown())).optional(),
13203
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13204
+ whereNot: record(string(), unknown()).optional(),
13205
+ whereNotIn: record(string(), array(unknown())).optional()
13206
+ });
13207
+ /**
13208
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
13209
+ *
13210
+ * `as` names the slot in the result, so the SAME column may be asked twice with
13211
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
13212
+ * a `Record<column, op>` shape could not express.
13213
+ */
13214
+ var AggregateFieldSchema = object({
13215
+ /** Result key. */
13216
+ as: string().min(1),
13217
+ /** Column to aggregate. Must be a real column of a declared collection. */
13218
+ field: string().min(1),
13219
+ op: _enum([
13220
+ "sum",
13221
+ "min",
13222
+ "max"
13223
+ ])
13224
+ });
13225
+ /**
13226
+ * `COUNT(*)` plus one number per requested field.
13227
+ *
13228
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
13229
+ * that really is 0 are different facts, and an accounting caller that renders
13230
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
13231
+ */
13232
+ var AggregateResultSchema = object({
13233
+ count: number().int(),
13234
+ values: record(string(), number().nullable())
13235
+ });
13236
+ /** A single stored record: `{ id, data }`. */
13237
+ var SettingsRecordSchema = object({
13238
+ id: string(),
13239
+ data: record(string(), unknown())
13240
+ });
13241
+ /**
13242
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
13243
+ * optional.
13244
+ *
13245
+ * A separate schema rather than loosening the shared one: every other method
13246
+ * on this cap addresses a row BY its id, and making that field optional
13247
+ * everywhere would turn a forgotten key into a silently generated one on
13248
+ * `update` and `delete` as well.
13249
+ */
13250
+ var BulkRecordSchema = object({
13251
+ id: string().optional(),
13252
+ data: record(string(), unknown())
13253
+ });
13254
+ /**
13255
+ * The database FILES one `sqlite-settings` engine process owns (D851).
13256
+ * Closed on purpose: a file is a thing the engine opens, backs up and gives a
13257
+ * serving thread, so a new one is a code change, never a string a caller
13258
+ * invents. `settings` is `camstack.db` and the default for every collection
13259
+ * that names no file.
13260
+ */
13261
+ var DataStoreDatabaseSchema = _enum([
13262
+ "settings",
13263
+ "events",
13264
+ "history"
13265
+ ]);
13266
+ DataStoreDatabaseSchema.options;
13267
+ /**
13268
+ * One write inside a {@link settingsStoreCapability.methods.transact} call.
13269
+ * The three that a "replace this set, bump that revision" write needs, plus
13270
+ * the batched upsert a rollup writer needs.
13271
+ */
13272
+ var TransactOpSchema = discriminatedUnion("op", [
13273
+ object({
13274
+ op: literal("deleteWhere"),
13275
+ collection: string(),
13276
+ filter: MutationFilterSchema
13277
+ }),
13278
+ object({
13279
+ op: literal("insertMany"),
13280
+ collection: string(),
13281
+ records: array(BulkRecordSchema).readonly()
13282
+ }),
13283
+ object({
13284
+ op: literal("update"),
13285
+ collection: string(),
13286
+ id: string(),
13287
+ data: record(string(), unknown())
13288
+ }),
13289
+ object({
13290
+ op: literal("upsertMany"),
13291
+ collection: string(),
13292
+ conflict: array(string()).readonly(),
13293
+ records: array(BulkRecordSchema).readonly()
13294
+ })
13295
+ ]);
13296
+ /**
13297
+ * The precondition of a transaction: the row `key` of `collection` must hold
13298
+ * `equals` in `column`, read INSIDE the transaction.
13299
+ */
13300
+ var TransactGuardSchema = object({
13301
+ collection: string(),
13302
+ key: string(),
13303
+ column: string(),
13304
+ equals: unknown()
13305
+ });
13306
+ /**
13307
+ * Column declaration for a structured (SQL-backed) collection.
13308
+ *
13309
+ * Logical types — the backend translates each to the matching SQLite
13310
+ * storage class and handles per-type marshaling:
13311
+ * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
13312
+ * - `JSON` — TEXT under the hood; serialised on write, parsed on read
13313
+ * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
13314
+ */
13315
+ var CollectionColumnSchema = object({
13316
+ name: string(),
13317
+ type: _enum([
13318
+ "TEXT",
13319
+ "INTEGER",
13320
+ "REAL",
13321
+ "JSON",
13322
+ "BOOLEAN"
13323
+ ]),
13324
+ primaryKey: boolean().optional(),
13325
+ notNull: boolean().optional(),
13326
+ unique: boolean().optional(),
13327
+ /**
13328
+ * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
13329
+ * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
13330
+ * collection surface simply cannot express their existing tables — which is
13331
+ * why they were still on the uncapped `table*` API.
13332
+ */
13333
+ defaultValue: union([
13334
+ string(),
13335
+ number(),
13336
+ boolean()
13337
+ ]).optional()
13338
+ });
13339
+ var CollectionIndexSchema = object({
13340
+ name: string(),
13341
+ columns: array(string()).readonly(),
13342
+ unique: boolean().optional()
13343
+ });
13344
+ /**
13345
+ * The input of `declareCollection` — ONE schema for the door and for the
13346
+ * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
13347
+ * the payload untouched).
13348
+ *
13349
+ * - `database` — the file the collection lives in (D851). Absent means
13350
+ * `settings`. A declaration naming a file other than the one the table is
13351
+ * already in is REFUSED by the engine, never moved.
13352
+ * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
13353
+ * as `primaryKey: true` on that column. A composite-keyed collection has no
13354
+ * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
13355
+ * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
13356
+ * address one row by id are refused.
13357
+ * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
13358
+ */
13359
+ var DeclareCollectionInputSchema = object({
13360
+ namespace: string().optional(),
13361
+ collection: string(),
13362
+ columns: array(CollectionColumnSchema).readonly(),
13363
+ indexes: array(CollectionIndexSchema).readonly().optional(),
13364
+ database: DataStoreDatabaseSchema.optional(),
13365
+ primaryKey: array(string()).readonly().optional(),
13366
+ withoutRowid: boolean().optional()
13367
+ });
13368
+ method(object({
13369
+ namespace: string().optional(),
13370
+ collection: string(),
13371
+ key: string()
13372
+ }), unknown(), { auth: "admin" }), method(object({
13373
+ namespace: string().optional(),
13374
+ collection: string(),
13375
+ key: string(),
13376
+ value: unknown()
13377
+ }), _void(), {
13378
+ kind: "mutation",
13379
+ auth: "admin"
13380
+ }), method(object({
13381
+ namespace: string().optional(),
13382
+ collection: string(),
13383
+ filter: QueryFilterSchema.optional(),
13384
+ columns: array(string()).readonly().optional()
13385
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
13386
+ namespace: string().optional(),
13387
+ collection: string(),
13388
+ /** Declared columns identifying the slot; must be covered by a UNIQUE
13389
+ * index on the collection. Never empty. */
13390
+ conflict: array(string()).readonly(),
13391
+ record: BulkRecordSchema
13392
+ }), object({
13393
+ /** The id the row HAS: assigned by SQLite on an insert, or the existing
13394
+ * row's own id on an update. */
13395
+ id: union([string(), number()]) }), {
13396
+ kind: "mutation",
13397
+ auth: "admin"
13398
+ }), method(object({
13399
+ namespace: string().optional(),
13400
+ collection: string(),
13401
+ conflict: array(string()).readonly(),
13402
+ records: array(BulkRecordSchema).readonly()
13403
+ }), object({ upserted: number().int() }), {
13404
+ kind: "mutation",
13405
+ auth: "admin"
13406
+ }), method(object({
13407
+ namespace: string().optional(),
13408
+ collection: string(),
13409
+ record: object({
13410
+ id: string().optional(),
13411
+ data: record(string(), unknown())
13412
+ })
13413
+ }), object({
13414
+ /**
13415
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13416
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13417
+ * primary key — which is the only place an auto key is knowable.
13418
+ */
13419
+ id: union([string(), number()]) }), {
13420
+ kind: "mutation",
13421
+ auth: "admin"
13422
+ }), method(object({
13423
+ namespace: string().optional(),
13424
+ collection: string(),
13425
+ records: array(BulkRecordSchema).readonly()
13426
+ }), object({ inserted: number().int() }), {
13427
+ kind: "mutation",
13428
+ auth: "admin"
13429
+ }), method(object({
13430
+ namespace: string().optional(),
13431
+ guard: TransactGuardSchema.optional(),
13432
+ ops: array(TransactOpSchema).readonly()
13433
+ }), object({
13434
+ applied: boolean(),
13435
+ current: unknown().optional()
13436
+ }), {
13437
+ kind: "mutation",
13438
+ auth: "admin"
13439
+ }), method(object({
13440
+ namespace: string().optional(),
13441
+ collection: string(),
13442
+ id: string(),
13443
+ data: record(string(), unknown())
13444
+ }), _void(), {
13445
+ kind: "mutation",
13446
+ auth: "admin"
13447
+ }), method(object({
13448
+ namespace: string().optional(),
13449
+ collection: string(),
13450
+ key: string()
13451
+ }), _void(), {
13452
+ kind: "mutation",
13453
+ auth: "admin"
13454
+ }), method(object({
13455
+ namespace: string().optional(),
13456
+ collection: string(),
13457
+ filter: MutationFilterSchema
13458
+ }), object({ deleted: number().int() }), {
13459
+ kind: "mutation",
13460
+ auth: "admin"
13461
+ }), method(object({
13462
+ namespace: string().optional(),
13463
+ collection: string(),
13464
+ filter: MutationFilterSchema,
13465
+ data: record(string(), unknown())
13466
+ }), object({ updated: number().int() }), {
13467
+ kind: "mutation",
13468
+ auth: "admin"
13469
+ }), method(object({
13470
+ namespace: string().optional(),
13471
+ collection: string(),
13472
+ filter: QueryFilterSchema.optional()
13473
+ }), number(), { auth: "admin" }), method(object({
13474
+ namespace: string().optional(),
13475
+ collection: string(),
13476
+ fields: array(AggregateFieldSchema).readonly(),
13477
+ filter: QueryFilterSchema.optional()
13478
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
13479
+ namespace: string().optional(),
13480
+ collection: string(),
13481
+ field: string(),
13482
+ bucketSize: number().int().positive(),
13483
+ origin: number().int(),
13484
+ filter: QueryFilterSchema.optional()
13485
+ }), array(object({
13486
+ bucket: number().int(),
13487
+ count: number().int()
13488
+ })).readonly(), { auth: "admin" }), method(object({
13489
+ namespace: string().optional(),
13490
+ collection: string()
13491
+ }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
13492
+ kind: "mutation",
13493
+ auth: "admin"
13494
+ });
13495
+ var MigrationIdSchema = string().regex(/^[a-z0-9-]+\/\d{4}-\d{2}-\d{2}-[a-z0-9-]+$/, "a migration id is \"<owner>/<yyyy-mm-dd>-<slug>\"");
13496
+ var MigrationLevelSchema = _enum([
13497
+ "hub-store",
13498
+ "addon-state",
13499
+ "node-config",
13500
+ "viewer",
13501
+ "addon-internal"
13502
+ ]);
13503
+ var MigrationStoreSchema = _enum([
13504
+ "settings",
13505
+ "events",
13506
+ "history",
13507
+ "node-local",
13508
+ "addon-files"
13509
+ ]);
13510
+ var MigrationScopeSchema = _enum(["cluster", "per-node"]);
13511
+ /** What depends on a migration while it is pending: `block-owner` is the default. */
13512
+ var MigrationOnFailureSchema = _enum(["block-owner", "tolerate"]);
13513
+ /**
13514
+ * `sql` is a hub-only body over the owner's connection. `plan` returns edits the
13515
+ * engine applies inside the migration's own transaction (hub-owned: computed in
13516
+ * that transaction; addon-owned: computed by the owner and shipped to the engine).
13517
+ * `procedure` is addon-owned work that is not SQL (keychain, integration registry,
13518
+ * device tombstones); the ledger records its outcome and it must be idempotent.
13519
+ */
13520
+ var MigrationBodyKindSchema = _enum([
13521
+ "sql",
13522
+ "plan",
13523
+ "procedure"
13524
+ ]);
13525
+ var MigrationMetaSchema = object({
13526
+ id: MigrationIdSchema,
13527
+ /** `hub`, an addon id, `node` or `viewer`. */
13528
+ owner: string().regex(/^[a-z0-9-]+$/),
13529
+ level: MigrationLevelSchema,
13530
+ /** Strictly increasing per owner: the order within an owner. */
13531
+ seq: number().int().positive(),
13532
+ /** Ids of any owner: the order across owners. */
13533
+ dependsOn: array(MigrationIdSchema),
13534
+ store: MigrationStoreSchema,
13535
+ scope: MigrationScopeSchema,
13536
+ onFailure: MigrationOnFailureSchema,
13537
+ bodyKind: MigrationBodyKindSchema,
13538
+ description: string().min(1),
13539
+ /** The marked field the migration's spec must assert survived. */
13540
+ fixtureMark: string().min(1)
13541
+ }).refine((m) => m.id.startsWith(`${m.owner}/`), {
13542
+ message: "the id must start with \"<owner>/\"",
13543
+ path: ["id"]
13544
+ });
13545
+ /** A cycle in the dependency graph, named by the ids on it. */
13546
+ var MigrationCycleError = class extends Error {
13547
+ ids;
13548
+ constructor(ids) {
13549
+ super(`migration dependsOn cycle: ${ids.join(" -> ")}`);
13550
+ this.ids = ids;
13551
+ this.name = "MigrationCycleError";
13552
+ }
13553
+ };
13554
+ /**
13555
+ * Topological order over `dependsOn` plus the implicit edge "a lower `seq` of an
13556
+ * owner runs first". Ties are broken by `(owner, seq)`. Throws
13557
+ * {@link MigrationCycleError} on a cycle. A `dependsOn` id that is not in the list
13558
+ * is ignored here — the catalogue schema is what refuses it.
13559
+ */
13560
+ function orderMigrations(items) {
13561
+ const byId = new Map(items.map((item) => [item.id, item]));
13562
+ const deps = /* @__PURE__ */ new Map();
13563
+ const ownerSorted = /* @__PURE__ */ new Map();
13564
+ for (const item of items) {
13565
+ const list = ownerSorted.get(item.owner) ?? [];
13566
+ list.push(item);
13567
+ ownerSorted.set(item.owner, list);
13568
+ }
13569
+ for (const item of items) deps.set(item.id, new Set(item.dependsOn.filter((id) => byId.has(id))));
13570
+ for (const list of ownerSorted.values()) {
13571
+ list.sort((a, b) => a.seq - b.seq);
13572
+ for (let i = 1; i < list.length; i++) {
13573
+ const previous = list[i - 1];
13574
+ const current = list[i];
13575
+ if (previous !== void 0 && current !== void 0) deps.get(current.id)?.add(previous.id);
13576
+ }
13577
+ }
13578
+ const tie = (a, b) => a.owner < b.owner ? -1 : a.owner > b.owner ? 1 : a.seq - b.seq;
13579
+ const done = /* @__PURE__ */ new Set();
13580
+ const ordered = [];
13581
+ let remaining = [...items];
13582
+ while (remaining.length > 0) {
13583
+ const ready = remaining.filter((item) => [...deps.get(item.id) ?? []].every((dep) => done.has(dep)));
13584
+ if (ready.length === 0) throw new MigrationCycleError(remaining.map((item) => item.id).sort());
13585
+ ready.sort(tie);
13586
+ const next = ready[0];
13587
+ if (next === void 0) break;
13588
+ ordered.push(next);
13589
+ done.add(next.id);
13590
+ remaining = remaining.filter((item) => item.id !== next.id);
13591
+ }
13592
+ return ordered;
13593
+ }
13594
+ /** Every way a list of migrations (in declaration order) is not a catalogue. */
13595
+ function catalogueIssues(items) {
13596
+ const issues = [];
13597
+ const seen = /* @__PURE__ */ new Set();
13598
+ const known = new Set(items.map((item) => item.id));
13599
+ const lastSeq = /* @__PURE__ */ new Map();
13600
+ const seqUsed = /* @__PURE__ */ new Map();
13601
+ for (const item of items) {
13602
+ if (seen.has(item.id)) issues.push({
13603
+ code: "duplicate-id",
13604
+ ids: [item.id],
13605
+ message: `duplicate id ${item.id}`
13606
+ });
13607
+ seen.add(item.id);
13608
+ const used = seqUsed.get(item.owner) ?? /* @__PURE__ */ new Set();
13609
+ if (used.has(item.seq)) issues.push({
13610
+ code: "duplicate-seq",
13611
+ ids: [item.id],
13612
+ message: `owner ${item.owner} has two migrations with seq ${item.seq}`
13613
+ });
13614
+ else if (item.seq < (lastSeq.get(item.owner) ?? 0)) issues.push({
13615
+ code: "seq-order",
13616
+ ids: [item.id],
13617
+ message: `seq ${item.seq} of ${item.id} does not increase in declaration order (owner ${item.owner})`
13618
+ });
13619
+ used.add(item.seq);
13620
+ seqUsed.set(item.owner, used);
13621
+ lastSeq.set(item.owner, Math.max(item.seq, lastSeq.get(item.owner) ?? 0));
13622
+ for (const dep of item.dependsOn) if (!known.has(dep)) issues.push({
13623
+ code: "unknown-dependency",
13624
+ ids: [item.id, dep],
13625
+ message: `${item.id} dependsOn unknown id ${dep}`
13626
+ });
13627
+ }
13628
+ try {
13629
+ orderMigrations(items);
13630
+ } catch (err) {
13631
+ if (err instanceof MigrationCycleError) issues.push({
13632
+ code: "cycle",
13633
+ ids: err.ids,
13634
+ message: err.message
13635
+ });
13636
+ else throw err;
13637
+ }
13638
+ return issues;
13639
+ }
13640
+ array(MigrationMetaSchema).superRefine((items, ctx) => {
13641
+ for (const issue of catalogueIssues(items)) ctx.addIssue({
13642
+ code: "custom",
13643
+ message: `${issue.code}: ${issue.message}`
13644
+ });
13645
+ });
13646
+ /**
13647
+ * The canonical JSON (`preconditionOf`) of the value a plan read; the apply step
13648
+ * re-reads, and a plan whose read no longer matches is refused (the migration is
13649
+ * `failed`, nothing it edited is kept).
13650
+ */
13651
+ var PreconditionSchema = string().min(1).optional();
13652
+ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
13653
+ object({
13654
+ op: literal("setKeys"),
13655
+ scope: string().min(1),
13656
+ values: record(string(), unknown()),
13657
+ precondition: PreconditionSchema
13658
+ }),
13659
+ object({
13660
+ op: literal("deleteKeys"),
13661
+ scope: string().min(1),
13662
+ keys: array(string().min(1)).min(1),
13663
+ precondition: PreconditionSchema
13664
+ }),
13665
+ object({
13666
+ op: literal("putRow"),
13667
+ table: string().min(1),
13668
+ key: record(string(), unknown()),
13669
+ row: record(string(), unknown()),
13670
+ precondition: PreconditionSchema
13671
+ }),
13672
+ object({
13673
+ op: literal("deleteRow"),
13674
+ table: string().min(1),
13675
+ key: record(string(), unknown()),
13676
+ precondition: PreconditionSchema
13677
+ }),
13678
+ object({
13679
+ op: literal("upsertRecord"),
13680
+ kind: string().min(1),
13681
+ recordKey: string().min(1),
13682
+ value: unknown(),
13683
+ precondition: PreconditionSchema
13684
+ }),
13685
+ object({
13686
+ op: literal("deleteRecord"),
13687
+ kind: string().min(1),
13688
+ recordKey: string().min(1),
13689
+ precondition: PreconditionSchema
13690
+ })
13691
+ ])) });
13692
+ /**
13693
+ * What a `procedure` body reports. `already-done` means the rerun observed the
13694
+ * work finished (a crash between the work and the ledger row, or a manual fix)
13695
+ * and did none of it again; the ledger records `applied` either way.
13696
+ */
13697
+ var MigrationProcedureResultSchema = object({
13698
+ outcome: _enum(["done", "already-done"]),
13699
+ summary: record(string(), unknown())
13700
+ });
13701
+ /** What an owner hands the engine when one of its migrations ran. */
13702
+ var MigrationOwnerResultSchema = discriminatedUnion("kind", [
13703
+ object({
13704
+ kind: literal("plan"),
13705
+ plan: MigrationPlanSchema
13706
+ }),
13707
+ object({
13708
+ kind: literal("procedure"),
13709
+ result: MigrationProcedureResultSchema
13710
+ }),
13711
+ object({
13712
+ kind: literal("failed"),
13713
+ error: string().min(1)
13714
+ })
13715
+ ]);
13716
+ /**
13717
+ * `held`: a restore of a pre-migration snapshot undid this id; it does not rerun
13718
+ * until the operator retries or a new code version ships.
13719
+ * `skipped-newer`: the database knows an id this code does not.
13720
+ */
13721
+ var MigrationStatusSchema = _enum([
13722
+ "applied",
13723
+ "failed",
13724
+ "blocked",
13725
+ "running",
13726
+ "held",
13727
+ "skipped-newer"
13728
+ ]);
13729
+ var MigrationLedgerEntrySchema = object({
13730
+ id: string(),
13731
+ database: DataStoreDatabaseSchema,
13732
+ owner: string(),
13733
+ level: MigrationLevelSchema,
13734
+ seq: number().int().nonnegative(),
13735
+ status: MigrationStatusSchema,
13736
+ attempts: number().int().nonnegative(),
13737
+ appliedAt: number().nullable(),
13738
+ codeVersion: string().nullable(),
13739
+ /** What the apply changed: rows per table, as the engine counted them. */
13740
+ planSummary: record(string(), unknown()).nullable(),
13741
+ progress: record(string(), unknown()).nullable(),
13742
+ error: string().nullable(),
13743
+ /** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
13744
+ reason: string().nullable(),
13745
+ nodeId: string().nullable(),
13746
+ bootId: string().nullable()
13747
+ });
13748
+ /** A catalogued migration that is not applied, with where it stands. */
13749
+ var MigrationPendingEntrySchema = object({
13750
+ meta: MigrationMetaSchema,
13751
+ database: DataStoreDatabaseSchema,
13752
+ state: _enum([
13753
+ "pending",
13754
+ "failed",
13755
+ "blocked",
13756
+ "held"
13757
+ ]),
13758
+ reason: string().nullable()
13759
+ });
13760
+ /** Rows per table before and after a dry run, and what it would have changed. */
13761
+ var MigrationDryRunResultSchema = object({
13762
+ id: string(),
13763
+ ok: boolean(),
13764
+ error: string().nullable(),
13765
+ rowsChanged: number().int().nonnegative(),
13766
+ tables: array(object({
13767
+ table: string(),
13768
+ before: number().int().nonnegative(),
13769
+ after: number().int().nonnegative()
13770
+ }))
13771
+ });
13772
+ /** One of an owner's migrations, as the engine tells the owner to treat it this boot. */
13773
+ var MigrationOwnerStepSchema = object({
13774
+ id: MigrationIdSchema,
13775
+ action: _enum(["run", "skip"]),
13776
+ /** The ledger state the engine found: `pending` has no row yet. */
13777
+ state: union([literal("pending"), MigrationStatusSchema])
13778
+ });
13779
+ /**
12938
13780
  * The trainer contract — what the hub hands the cloud trainer and what it
12939
13781
  * gets back (cloud training, D805+).
12940
13782
  *
@@ -16344,6 +17186,41 @@ var ACTUATOR_CAP_VOCABULARY = {
16344
17186
  icon: "droplets"
16345
17187
  }]
16346
17188
  },
17189
+ "power-source": {
17190
+ scope: "device",
17191
+ noun: t("Power source", "Alimentazione"),
17192
+ actions: [
17193
+ {
17194
+ id: "powerSource.on",
17195
+ method: "powerOn",
17196
+ label: t("Power on", "Dai corrente"),
17197
+ phrase: t("Power on {device}", "Dai corrente a {device}"),
17198
+ icon: "power"
17199
+ },
17200
+ {
17201
+ id: "powerSource.off",
17202
+ method: "powerOff",
17203
+ label: t("Power off", "Togli corrente"),
17204
+ phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
17205
+ icon: "power-off"
17206
+ },
17207
+ {
17208
+ id: "powerSource.forceRestart",
17209
+ method: "forceRestart",
17210
+ label: t("Force restart", "Riavvio forzato"),
17211
+ phrase: t("Force restart {device} by cutting its power", "Riavvia {device} togliendo la corrente"),
17212
+ icon: "refresh-cw"
17213
+ }
17214
+ ],
17215
+ state: [{
17216
+ kind: "boolean",
17217
+ field: "switchOn",
17218
+ label: t("Power switch on", "Presa accesa"),
17219
+ whenTrue: t("When the power of {device} comes on", "Quando arriva la corrente a {device}"),
17220
+ whenFalse: t("When the power of {device} is cut", "Quando manca la corrente a {device}"),
17221
+ icon: "power"
17222
+ }]
17223
+ },
16347
17224
  "lock-control": {
16348
17225
  scope: "device",
16349
17226
  noun: t("Lock", "Serratura"),
@@ -16819,7 +17696,7 @@ var ACTUATOR_CAP_VOCABULARY = {
16819
17696
  method: "setDirection",
16820
17697
  label: t("Spin forward", "Rotazione avanti"),
16821
17698
  phrase: t("Spin {device} forward", "Fai girare {device} in avanti"),
16822
- icon: "rotate-cw",
17699
+ icon: "refresh-cw",
16823
17700
  effect: {
16824
17701
  field: "direction",
16825
17702
  value: "forward"
@@ -19897,6 +20774,7 @@ var SYSTEM_CAP_VOCABULARY = {
19897
20774
  "login-method": system(IDENTITY),
19898
20775
  "mesh-network": system(NETWORK),
19899
20776
  "metrics-provider": system(CLUSTER),
20777
+ migrations: system(INTERNAL),
19900
20778
  "model-convert": system(ML),
19901
20779
  "model-distributor": system(ML),
19902
20780
  "mqtt-broker": system(NETWORK),
@@ -42180,7 +43058,7 @@ method(object({}), array(TargetKindSchema)), method(object({}), array(TargetSche
42180
43058
  * rebuilds without manual reload.
42181
43059
  *
42182
43060
  * The hub-local builtin `addon-pages-aggregator` (see
42183
- * `@camstack/system/builtins/addon-pages-aggregator`) registers the
43061
+ * `@camstack/server/system/builtins/addon-pages-aggregator`) registers the
42184
43062
  * provider. Splitting the public aggregator from the raw collection
42185
43063
  * keeps both ends in codegen — there's no hand-written
42186
43064
  * `addon-pages.router.ts` wrapper anymore.
@@ -42270,7 +43148,7 @@ var addonRoutesCapability = {
42270
43148
  */
42271
43149
  invoke: method(InvokeRequestSchema, InvokeReplyEnvelopeSchema, { kind: "mutation" })
42272
43150
  },
42273
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
43151
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
42274
43152
  mount: { kind: "skip" }
42275
43153
  };
42276
43154
  var ConfigTabDeclarationSchema = object({
@@ -42325,6 +43203,10 @@ method(object({
42325
43203
  }), method(object({
42326
43204
  addonId: string(),
42327
43205
  nodeId: string().optional()
43206
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
43207
+ addonId: string(),
43208
+ nodeId: string().optional(),
43209
+ instance: IntegrationInstanceRefSchema
42328
43210
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
42329
43211
  addonId: string(),
42330
43212
  nodeId: string().optional()
@@ -42495,7 +43377,7 @@ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
42495
43377
  * manual reload — same scheme used by `addon-pages`.
42496
43378
  *
42497
43379
  * The hub-local builtin `addon-widgets-aggregator` (see
42498
- * `@camstack/system/builtins/addon-widgets-aggregator`) registers the
43380
+ * `@camstack/server/system/builtins/addon-widgets-aggregator`) registers the
42499
43381
  * provider. Splitting the public aggregator from the raw collection
42500
43382
  * keeps both ends in codegen — there's no hand-written wrapper.
42501
43383
  */
@@ -42856,329 +43738,6 @@ method(object({
42856
43738
  password: string()
42857
43739
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
42858
43740
  /**
42859
- * Query filter for settings-store collections.
42860
- */
42861
- var QueryFilterSchema = object({
42862
- where: record(string(), unknown()).optional(),
42863
- whereIn: record(string(), array(unknown())).optional(),
42864
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
42865
- /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
42866
- whereNot: record(string(), unknown()).optional(),
42867
- /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
42868
- * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
42869
- whereNotIn: record(string(), array(unknown())).optional(),
42870
- orderBy: object({
42871
- field: string(),
42872
- direction: _enum(["asc", "desc"])
42873
- }).optional(),
42874
- limit: number().optional(),
42875
- offset: number().optional()
42876
- });
42877
- /**
42878
- * The predicate half of a filter, for BULK MUTATIONS.
42879
- *
42880
- * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
42881
- * meaning for a statement that rewrites a set, and accepting them would invite
42882
- * a caller to believe `limit` bounds the damage. Every field is optional here
42883
- * only so the shape stays composable — the implementation REJECTS a filter
42884
- * that compiles to no predicate, because that is the whole collection.
42885
- */
42886
- var MutationFilterSchema = object({
42887
- where: record(string(), unknown()).optional(),
42888
- whereIn: record(string(), array(unknown())).optional(),
42889
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
42890
- whereNot: record(string(), unknown()).optional(),
42891
- whereNotIn: record(string(), array(unknown())).optional()
42892
- });
42893
- /**
42894
- * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
42895
- *
42896
- * `as` names the slot in the result, so the SAME column may be asked twice with
42897
- * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
42898
- * a `Record<column, op>` shape could not express.
42899
- */
42900
- var AggregateFieldSchema = object({
42901
- /** Result key. */
42902
- as: string().min(1),
42903
- /** Column to aggregate. Must be a real column of a declared collection. */
42904
- field: string().min(1),
42905
- op: _enum([
42906
- "sum",
42907
- "min",
42908
- "max"
42909
- ])
42910
- });
42911
- /**
42912
- * `COUNT(*)` plus one number per requested field.
42913
- *
42914
- * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
42915
- * that really is 0 are different facts, and an accounting caller that renders
42916
- * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
42917
- */
42918
- var AggregateResultSchema = object({
42919
- count: number().int(),
42920
- values: record(string(), number().nullable())
42921
- });
42922
- /** A single stored record: `{ id, data }`. */
42923
- var SettingsRecordSchema = object({
42924
- id: string(),
42925
- data: record(string(), unknown())
42926
- });
42927
- /**
42928
- * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
42929
- * optional.
42930
- *
42931
- * A separate schema rather than loosening the shared one: every other method
42932
- * on this cap addresses a row BY its id, and making that field optional
42933
- * everywhere would turn a forgotten key into a silently generated one on
42934
- * `update` and `delete` as well.
42935
- */
42936
- var BulkRecordSchema = object({
42937
- id: string().optional(),
42938
- data: record(string(), unknown())
42939
- });
42940
- /**
42941
- * The database FILES one `sqlite-settings` engine process owns (D851).
42942
- * Closed on purpose: a file is a thing the engine opens, backs up and gives a
42943
- * serving thread, so a new one is a code change, never a string a caller
42944
- * invents. `settings` is `camstack.db` and the default for every collection
42945
- * that names no file.
42946
- */
42947
- var DataStoreDatabaseSchema = _enum([
42948
- "settings",
42949
- "events",
42950
- "history"
42951
- ]);
42952
- DataStoreDatabaseSchema.options;
42953
- /**
42954
- * One write inside a {@link settingsStoreCapability.methods.transact} call.
42955
- * The three that a "replace this set, bump that revision" write needs, plus
42956
- * the batched upsert a rollup writer needs.
42957
- */
42958
- var TransactOpSchema = discriminatedUnion("op", [
42959
- object({
42960
- op: literal("deleteWhere"),
42961
- collection: string(),
42962
- filter: MutationFilterSchema
42963
- }),
42964
- object({
42965
- op: literal("insertMany"),
42966
- collection: string(),
42967
- records: array(BulkRecordSchema).readonly()
42968
- }),
42969
- object({
42970
- op: literal("update"),
42971
- collection: string(),
42972
- id: string(),
42973
- data: record(string(), unknown())
42974
- }),
42975
- object({
42976
- op: literal("upsertMany"),
42977
- collection: string(),
42978
- conflict: array(string()).readonly(),
42979
- records: array(BulkRecordSchema).readonly()
42980
- })
42981
- ]);
42982
- /**
42983
- * The precondition of a transaction: the row `key` of `collection` must hold
42984
- * `equals` in `column`, read INSIDE the transaction.
42985
- */
42986
- var TransactGuardSchema = object({
42987
- collection: string(),
42988
- key: string(),
42989
- column: string(),
42990
- equals: unknown()
42991
- });
42992
- /**
42993
- * Column declaration for a structured (SQL-backed) collection.
42994
- *
42995
- * Logical types — the backend translates each to the matching SQLite
42996
- * storage class and handles per-type marshaling:
42997
- * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
42998
- * - `JSON` — TEXT under the hood; serialised on write, parsed on read
42999
- * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
43000
- */
43001
- var CollectionColumnSchema = object({
43002
- name: string(),
43003
- type: _enum([
43004
- "TEXT",
43005
- "INTEGER",
43006
- "REAL",
43007
- "JSON",
43008
- "BOOLEAN"
43009
- ]),
43010
- primaryKey: boolean().optional(),
43011
- notNull: boolean().optional(),
43012
- unique: boolean().optional(),
43013
- /**
43014
- * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
43015
- * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
43016
- * collection surface simply cannot express their existing tables — which is
43017
- * why they were still on the uncapped `table*` API.
43018
- */
43019
- defaultValue: union([
43020
- string(),
43021
- number(),
43022
- boolean()
43023
- ]).optional()
43024
- });
43025
- var CollectionIndexSchema = object({
43026
- name: string(),
43027
- columns: array(string()).readonly(),
43028
- unique: boolean().optional()
43029
- });
43030
- /**
43031
- * The input of `declareCollection` — ONE schema for the door and for the
43032
- * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
43033
- * the payload untouched).
43034
- *
43035
- * - `database` — the file the collection lives in (D851). Absent means
43036
- * `settings`. A declaration naming a file other than the one the table is
43037
- * already in is REFUSED by the engine, never moved.
43038
- * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
43039
- * as `primaryKey: true` on that column. A composite-keyed collection has no
43040
- * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
43041
- * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
43042
- * address one row by id are refused.
43043
- * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
43044
- */
43045
- var DeclareCollectionInputSchema = object({
43046
- namespace: string().optional(),
43047
- collection: string(),
43048
- columns: array(CollectionColumnSchema).readonly(),
43049
- indexes: array(CollectionIndexSchema).readonly().optional(),
43050
- database: DataStoreDatabaseSchema.optional(),
43051
- primaryKey: array(string()).readonly().optional(),
43052
- withoutRowid: boolean().optional()
43053
- });
43054
- method(object({
43055
- namespace: string().optional(),
43056
- collection: string(),
43057
- key: string()
43058
- }), unknown(), { auth: "admin" }), method(object({
43059
- namespace: string().optional(),
43060
- collection: string(),
43061
- key: string(),
43062
- value: unknown()
43063
- }), _void(), {
43064
- kind: "mutation",
43065
- auth: "admin"
43066
- }), method(object({
43067
- namespace: string().optional(),
43068
- collection: string(),
43069
- filter: QueryFilterSchema.optional(),
43070
- columns: array(string()).readonly().optional()
43071
- }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
43072
- namespace: string().optional(),
43073
- collection: string(),
43074
- /** Declared columns identifying the slot; must be covered by a UNIQUE
43075
- * index on the collection. Never empty. */
43076
- conflict: array(string()).readonly(),
43077
- record: BulkRecordSchema
43078
- }), object({
43079
- /** The id the row HAS: assigned by SQLite on an insert, or the existing
43080
- * row's own id on an update. */
43081
- id: union([string(), number()]) }), {
43082
- kind: "mutation",
43083
- auth: "admin"
43084
- }), method(object({
43085
- namespace: string().optional(),
43086
- collection: string(),
43087
- conflict: array(string()).readonly(),
43088
- records: array(BulkRecordSchema).readonly()
43089
- }), object({ upserted: number().int() }), {
43090
- kind: "mutation",
43091
- auth: "admin"
43092
- }), method(object({
43093
- namespace: string().optional(),
43094
- collection: string(),
43095
- record: object({
43096
- id: string().optional(),
43097
- data: record(string(), unknown())
43098
- })
43099
- }), object({
43100
- /**
43101
- * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
43102
- * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
43103
- * primary key — which is the only place an auto key is knowable.
43104
- */
43105
- id: union([string(), number()]) }), {
43106
- kind: "mutation",
43107
- auth: "admin"
43108
- }), method(object({
43109
- namespace: string().optional(),
43110
- collection: string(),
43111
- records: array(BulkRecordSchema).readonly()
43112
- }), object({ inserted: number().int() }), {
43113
- kind: "mutation",
43114
- auth: "admin"
43115
- }), method(object({
43116
- namespace: string().optional(),
43117
- guard: TransactGuardSchema.optional(),
43118
- ops: array(TransactOpSchema).readonly()
43119
- }), object({
43120
- applied: boolean(),
43121
- current: unknown().optional()
43122
- }), {
43123
- kind: "mutation",
43124
- auth: "admin"
43125
- }), method(object({
43126
- namespace: string().optional(),
43127
- collection: string(),
43128
- id: string(),
43129
- data: record(string(), unknown())
43130
- }), _void(), {
43131
- kind: "mutation",
43132
- auth: "admin"
43133
- }), method(object({
43134
- namespace: string().optional(),
43135
- collection: string(),
43136
- key: string()
43137
- }), _void(), {
43138
- kind: "mutation",
43139
- auth: "admin"
43140
- }), method(object({
43141
- namespace: string().optional(),
43142
- collection: string(),
43143
- filter: MutationFilterSchema
43144
- }), object({ deleted: number().int() }), {
43145
- kind: "mutation",
43146
- auth: "admin"
43147
- }), method(object({
43148
- namespace: string().optional(),
43149
- collection: string(),
43150
- filter: MutationFilterSchema,
43151
- data: record(string(), unknown())
43152
- }), object({ updated: number().int() }), {
43153
- kind: "mutation",
43154
- auth: "admin"
43155
- }), method(object({
43156
- namespace: string().optional(),
43157
- collection: string(),
43158
- filter: QueryFilterSchema.optional()
43159
- }), number(), { auth: "admin" }), method(object({
43160
- namespace: string().optional(),
43161
- collection: string(),
43162
- fields: array(AggregateFieldSchema).readonly(),
43163
- filter: QueryFilterSchema.optional()
43164
- }), AggregateResultSchema, { auth: "admin" }), method(object({
43165
- namespace: string().optional(),
43166
- collection: string(),
43167
- field: string(),
43168
- bucketSize: number().int().positive(),
43169
- origin: number().int(),
43170
- filter: QueryFilterSchema.optional()
43171
- }), array(object({
43172
- bucket: number().int(),
43173
- count: number().int()
43174
- })).readonly(), { auth: "admin" }), method(object({
43175
- namespace: string().optional(),
43176
- collection: string()
43177
- }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
43178
- kind: "mutation",
43179
- auth: "admin"
43180
- });
43181
- /**
43182
43741
  * How long one snapshot may take end to end: the pinned copy of the whole
43183
43742
  * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
43184
43743
  * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
@@ -44986,7 +45545,7 @@ method(object({
44986
45545
  kind: "mutation",
44987
45546
  auth: "admin"
44988
45547
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
44989
- DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, 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.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
45548
+ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, DeviceType.PetFeeder, DeviceType.Container, DeviceType.Thermostat, DeviceType.EventEmitter, 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.PetFountain, DeviceType.Dishwasher, DeviceType.Washer, DeviceType.Dryer, DeviceType.Gateway, DeviceType.Camera, DeviceType.Lock, DeviceType.Camera, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Switch, DeviceType.Light, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.Humidifier, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.PetFeeder, DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater, DeviceType.MediaPlayer, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.Vacuum, DeviceType.LawnMower, DeviceType.MediaPlayer, DeviceType.WaterHeater, DeviceType.Humidifier, DeviceType.Fan, DeviceType.Climate, DeviceType.Thermostat, DeviceType.PetFeeder;
44990
45549
  var NUMBER = {
44991
45550
  kind: "fixed",
44992
45551
  result: ["number"]
@@ -45997,6 +46556,57 @@ id: union([string(), number()]) }), {
45997
46556
  kind: "mutation",
45998
46557
  auth: "admin"
45999
46558
  });
46559
+ method(object({}), object({ entries: array(MigrationLedgerEntrySchema) }), { auth: "admin" }), method(object({ owner: string().optional() }), object({ pending: array(MigrationPendingEntrySchema) }), { auth: "admin" }), method(object({ id: string().min(1) }), MigrationDryRunResultSchema, { auth: "admin" }), method(object({
46560
+ id: string().min(1),
46561
+ error: string().min(1)
46562
+ }), MigrationLedgerEntrySchema, {
46563
+ kind: "mutation",
46564
+ auth: "admin"
46565
+ }), method(object({ id: string().min(1) }), object({ entries: array(MigrationLedgerEntrySchema) }), {
46566
+ kind: "mutation",
46567
+ auth: "admin"
46568
+ }), method(object({
46569
+ database: DataStoreDatabaseSchema,
46570
+ snapshotId: string().min(1)
46571
+ }), object({
46572
+ scheduled: boolean(),
46573
+ held: array(string()),
46574
+ restartRequired: boolean()
46575
+ }), {
46576
+ kind: "mutation",
46577
+ auth: "admin"
46578
+ }), method(object({
46579
+ owner: string().min(1),
46580
+ metas: array(MigrationMetaSchema)
46581
+ }), object({
46582
+ bootId: string(),
46583
+ snapshot: _enum([
46584
+ "none",
46585
+ "written",
46586
+ "refused"
46587
+ ]),
46588
+ steps: array(MigrationOwnerStepSchema)
46589
+ }), {
46590
+ kind: "mutation",
46591
+ auth: "admin"
46592
+ }), method(object({ id: string().min(1) }), object({
46593
+ proceed: boolean(),
46594
+ state: union([literal("pending"), MigrationStatusSchema]),
46595
+ reason: string().nullable()
46596
+ }), {
46597
+ kind: "mutation",
46598
+ auth: "admin"
46599
+ }), method(object({
46600
+ id: string().min(1),
46601
+ result: MigrationOwnerResultSchema
46602
+ }), object({
46603
+ status: MigrationStatusSchema,
46604
+ error: string().nullable(),
46605
+ rowsChanged: number().int().nonnegative()
46606
+ }), {
46607
+ kind: "mutation",
46608
+ auth: "admin"
46609
+ });
46000
46610
  /**
46001
46611
  * records - an addon's own facts and documents (D881): ledgers, audit rows,
46002
46612
  * config documents, mirrors. The third storage API next to `ctx.settings`
@@ -60544,7 +61154,18 @@ var ServerUpdateActionResultSchema = object({
60544
61154
  * store (D877), present when the pre-flight refused the update
60545
61155
  * (`reason: 'addon-would-refuse'`). Optional for version skew.
60546
61156
  */
60547
- blockers: array(UpdateBlockerSchema).optional()
61157
+ blockers: array(UpdateBlockerSchema).optional(),
61158
+ /**
61159
+ * The minimums the target server declares and this node does not meet
61160
+ * (D989), present when the update was refused with
61161
+ * `reason: 'requirements-unmet'`. Each names the versions on both sides.
61162
+ */
61163
+ unmet: array(UnmetRequirementSchema).optional(),
61164
+ /**
61165
+ * The addons this node has below the minimum the staged server declares —
61166
+ * the ones to update WITH the server. Present on an accepted update.
61167
+ */
61168
+ requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
60548
61169
  });
60549
61170
  var LaunchOverridesSchema = object({
60550
61171
  /** The persisted heap ceiling in MB, or `null` when none is set. */
@@ -63055,7 +63676,9 @@ var PackageUpdateSchema = object({
63055
63676
  latestVersion: string(),
63056
63677
  category: _enum(["addon", "core"]),
63057
63678
  requiresRestart: boolean(),
63058
- isSystem: boolean()
63679
+ isSystem: boolean(),
63680
+ /** Held: what the newer version needs and this node does not meet (D989). */
63681
+ blockedBy: array(UnmetRequirementSchema).readonly().optional()
63059
63682
  });
63060
63683
  var PackageVersionInfoSchema = object({
63061
63684
  version: string(),
@@ -64111,19 +64734,19 @@ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status:
64111
64734
  reason: _enum(["unknown-template", "not-a-media-player"]),
64112
64735
  detail: string()
64113
64736
  })]);
64114
- var deviceInput = object({ deviceId: number().int().nonnegative() });
64737
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
64115
64738
  DeviceType.MediaPlayer;
64116
- method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
64739
+ method(deviceInput$1, RemoteConfigSchema, { auth: "admin" }), method(deviceInput$1.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
64117
64740
  kind: "mutation",
64118
64741
  auth: "admin"
64119
- }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
64742
+ }), method(deviceInput$1, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput$1.extend({
64120
64743
  role: RemoteRoleSchema,
64121
64744
  /** Sends in a row (volume steps). */
64122
64745
  repeat: number().int().min(1).max(50).default(1)
64123
64746
  }), RemoteSendResultSchema, {
64124
64747
  kind: "mutation",
64125
64748
  auth: "protected"
64126
- }), method(deviceInput.extend({
64749
+ }), method(deviceInput$1.extend({
64127
64750
  command: RemoteMediaCommandSchema,
64128
64751
  muted: boolean().optional(),
64129
64752
  source: string().optional(),
@@ -66606,7 +67229,7 @@ DeviceType.LawnMower, method(object({ deviceId: number().int().nonnegative() }),
66606
67229
  * clients — they reverse-connect to the hub. Exposing their interfaces
66607
67230
  * via the same surface would leak internal topology with no upside.
66608
67231
  *
66609
- * Implementation in `@camstack/system/builtins/local-network/`.
67232
+ * Implementation in `@camstack/server/system/builtins/local-network/`.
66610
67233
  */
66611
67234
  /** Coarse classification derived from the interface name + IP range. */
66612
67235
  var InterfaceKindEnum = _enum([
@@ -67035,6 +67658,49 @@ DeviceType.Lock, method(object({
67035
67658
  kind: "mutation",
67036
67659
  auth: "protected"
67037
67660
  });
67661
+ var PowerSourceRefusalReasonSchema = _enum([
67662
+ "no-power-source",
67663
+ "switch-missing",
67664
+ "switch-offline",
67665
+ "switch-unknown",
67666
+ "restart-in-progress",
67667
+ "switch-call-failed"
67668
+ ]);
67669
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67670
+ accepted: literal(false),
67671
+ reason: PowerSourceRefusalReasonSchema,
67672
+ /** One line for the operator, naming the switch. */
67673
+ message: string()
67674
+ })]);
67675
+ var PowerSourceInfoSchema = object({
67676
+ /** False when the device has no power source linked; the rest is then empty. */
67677
+ linked: boolean(),
67678
+ switchDeviceId: number().nullable(),
67679
+ switchName: string().nullable(),
67680
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67681
+ switchOn: boolean().nullable(),
67682
+ switchOnline: boolean().nullable(),
67683
+ restartInProgress: boolean(),
67684
+ offSeconds: number().int()
67685
+ });
67686
+ object({
67687
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67688
+ switchOn: boolean().nullable(),
67689
+ offSeconds: number().int(),
67690
+ lastFetchedAt: number()
67691
+ });
67692
+ DeviceType.Gateway, DeviceType.Hub, DeviceType.Camera, DeviceType.Sensor, DeviceType.MediaPlayer, DeviceType.Vacuum, DeviceType.Generic, DeviceType.Washer, DeviceType.Dryer, DeviceType.Dishwasher, DeviceType.PetFountain, DeviceType.Fan, DeviceType.Humidifier, DeviceType.Climate, DeviceType.WaterHeater;
67693
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
67694
+ systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67695
+ kind: "mutation",
67696
+ auth: "admin"
67697
+ }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67698
+ kind: "mutation",
67699
+ auth: "admin"
67700
+ }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67701
+ kind: "mutation",
67702
+ auth: "admin"
67703
+ });
67038
67704
  object({
67039
67705
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
67040
67706
  lastFetchedAt: number()
@@ -67843,7 +68509,7 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, Devi
67843
68509
  * jitter, and observed/peak bandwidth per device + per client.
67844
68510
  *
67845
68511
  * Implementation lives in the server's `NetworkQualityService` (thin
67846
- * wrapper over the shared `NetworkQualityTracker` from `@camstack/system`).
68512
+ * wrapper over the shared `NetworkQualityTracker` from `@camstack/server/system`).
67847
68513
  * The provider is registered from `trpc.router.ts` against the existing
67848
68514
  * service instance — no addon owns this state.
67849
68515
  *
@@ -73867,6 +74533,13 @@ Object.freeze({
73867
74533
  access: "view",
73868
74534
  role: "admin"
73869
74535
  },
74536
+ "addonSettings.getIntegrationFormSchema": {
74537
+ capName: "addon-settings",
74538
+ capScope: "system",
74539
+ addonId: null,
74540
+ access: "view",
74541
+ role: "admin"
74542
+ },
73870
74543
  "addonSettings.getIntegrationSettings": {
73871
74544
  capName: "addon-settings",
73872
74545
  capScope: "system",
@@ -77955,6 +78628,69 @@ Object.freeze({
77955
78628
  access: "view",
77956
78629
  role: "admin"
77957
78630
  },
78631
+ "migrations.declareOwner": {
78632
+ capName: "migrations",
78633
+ capScope: "system",
78634
+ addonId: null,
78635
+ access: "create",
78636
+ role: "admin"
78637
+ },
78638
+ "migrations.dryRun": {
78639
+ capName: "migrations",
78640
+ capScope: "system",
78641
+ addonId: null,
78642
+ access: "view",
78643
+ role: "admin"
78644
+ },
78645
+ "migrations.finishMigration": {
78646
+ capName: "migrations",
78647
+ capScope: "system",
78648
+ addonId: null,
78649
+ access: "create",
78650
+ role: "admin"
78651
+ },
78652
+ "migrations.listLedger": {
78653
+ capName: "migrations",
78654
+ capScope: "system",
78655
+ addonId: null,
78656
+ access: "view",
78657
+ role: "admin"
78658
+ },
78659
+ "migrations.listPending": {
78660
+ capName: "migrations",
78661
+ capScope: "system",
78662
+ addonId: null,
78663
+ access: "view",
78664
+ role: "admin"
78665
+ },
78666
+ "migrations.markFailed": {
78667
+ capName: "migrations",
78668
+ capScope: "system",
78669
+ addonId: null,
78670
+ access: "create",
78671
+ role: "admin"
78672
+ },
78673
+ "migrations.restorePreMigration": {
78674
+ capName: "migrations",
78675
+ capScope: "system",
78676
+ addonId: null,
78677
+ access: "create",
78678
+ role: "admin"
78679
+ },
78680
+ "migrations.retry": {
78681
+ capName: "migrations",
78682
+ capScope: "system",
78683
+ addonId: null,
78684
+ access: "create",
78685
+ role: "admin"
78686
+ },
78687
+ "migrations.startMigration": {
78688
+ capName: "migrations",
78689
+ capScope: "system",
78690
+ addonId: null,
78691
+ access: "create",
78692
+ role: "admin"
78693
+ },
77958
78694
  "modelConvert.convert": {
77959
78695
  capName: "model-convert",
77960
78696
  capScope: "system",
@@ -80587,6 +81323,34 @@ Object.freeze({
80587
81323
  access: "view",
80588
81324
  role: "viewer"
80589
81325
  },
81326
+ "powerSource.forceRestart": {
81327
+ capName: "power-source",
81328
+ capScope: "device",
81329
+ addonId: null,
81330
+ access: "create",
81331
+ role: "admin"
81332
+ },
81333
+ "powerSource.getStatus": {
81334
+ capName: "power-source",
81335
+ capScope: "device",
81336
+ addonId: null,
81337
+ access: "view",
81338
+ role: "admin"
81339
+ },
81340
+ "powerSource.powerOff": {
81341
+ capName: "power-source",
81342
+ capScope: "device",
81343
+ addonId: null,
81344
+ access: "create",
81345
+ role: "admin"
81346
+ },
81347
+ "powerSource.powerOn": {
81348
+ capName: "power-source",
81349
+ capScope: "device",
81350
+ addonId: null,
81351
+ access: "create",
81352
+ role: "admin"
81353
+ },
80590
81354
  "presence.getStatus": {
80591
81355
  capName: "presence",
80592
81356
  capScope: "device",
@@ -85760,6 +86524,26 @@ Object.freeze({
85760
86524
  form: "single",
85761
86525
  optional: false
85762
86526
  }],
86527
+ "powerSource.forceRestart": [{
86528
+ name: "deviceId",
86529
+ form: "single",
86530
+ optional: false
86531
+ }],
86532
+ "powerSource.getStatus": [{
86533
+ name: "deviceId",
86534
+ form: "single",
86535
+ optional: false
86536
+ }],
86537
+ "powerSource.powerOff": [{
86538
+ name: "deviceId",
86539
+ form: "single",
86540
+ optional: false
86541
+ }],
86542
+ "powerSource.powerOn": [{
86543
+ name: "deviceId",
86544
+ form: "single",
86545
+ optional: false
86546
+ }],
85763
86547
  "presence.getStatus": [{
85764
86548
  name: "deviceId",
85765
86549
  form: "single",
@@ -88780,7 +89564,7 @@ function buildGoogleOauthIntegration() {
88780
89564
  *
88781
89565
  * Alexa's lives in `packages/addon-export-alexa/src/export-alexa.addon.ts` as
88782
89566
  * private methods, and addons never import each other. The only shared home
88783
- * would be `@camstack/types` or `@camstack/system` — both stay host-resolved in
89567
+ * would be `@camstack/types` or `@camstack/server/system` — both stay host-resolved in
88784
89568
  * an addon bundle (`tools/build/vite-lib.preset.ts`), so putting it there would
88785
89569
  * put this addon on the framework publish train and destroy the one property
88786
89570
  * that makes it attractive: `camstack deploy packages/addon-export-google` and