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