@camstack/addon-provider-homeassistant 1.2.642 → 1.2.644

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.
@@ -1,5 +1,5 @@
1
1
  require("node:crypto");
2
- //#region ../types/dist/event-category-DmZDPDf_.mjs
2
+ //#region ../types/dist/event-category-CaURIwQA.mjs
3
3
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4
4
  EventCategory["SystemBoot"] = "system.boot";
5
5
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -715,6 +715,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
715
715
  EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
716
716
  /** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
717
717
  EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
718
+ /** A migration failed or was blocked; the Alert Center re-reads the ledger. */
719
+ EventCategory["MigrationFailed"] = "migration.failed";
720
+ /** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
721
+ EventCategory["MigrationApplied"] = "migration.applied";
718
722
  EventCategory["DeviceUpdated"] = "device.updated";
719
723
  /**
720
724
  * Transport-level connectivity. Emitted by the device driver when
@@ -777,6 +781,378 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
777
781
  return EventCategory;
778
782
  }({});
779
783
  //#endregion
784
+ //#region ../types/dist/device-type-CEqjmUnR.mjs
785
+ /**
786
+ import { errMsg } from '@camstack/types'
787
+ * Extract a human-readable message from an unknown error value.
788
+ * Replaces the ubiquitous `errMsg(err)` pattern.
789
+ */
790
+ function errMsg(err) {
791
+ if (err instanceof Error) return err.message;
792
+ if (typeof err === "string") return err;
793
+ return String(err);
794
+ }
795
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
796
+ DeviceType["Camera"] = "camera";
797
+ DeviceType["Hub"] = "hub";
798
+ DeviceType["Light"] = "light";
799
+ DeviceType["Siren"] = "siren";
800
+ DeviceType["Switch"] = "switch";
801
+ DeviceType["Sensor"] = "sensor";
802
+ DeviceType["Thermostat"] = "thermostat";
803
+ /** Air-conditioner / heat-pump climate device (HVAC) — shares the
804
+ * `climate-control` cap surface with `Thermostat` but renders a
805
+ * dedicated AC-appropriate control UI (mode chips, fan speed,
806
+ * independent vertical/horizontal swing). Sources: native Gree, and
807
+ * reusable by other AC integrations. */
808
+ DeviceType["Climate"] = "climate";
809
+ DeviceType["Button"] = "button";
810
+ /** Generic stateless event emitter — carries a device's EXACT declared
811
+ * event vocabulary verbatim (no normalization). Installed with the
812
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
813
+ * HA bus events (e.g. `zha_event`, generic). */
814
+ DeviceType["EventEmitter"] = "event-emitter";
815
+ /** Firmware/software update entity — current vs available version,
816
+ * updatable flag, update state, and an install action. Installed with
817
+ * the `update` cap. Sources: Homematic firmware-update channels (and
818
+ * reusable by other providers, e.g. HA `update.*` entities). */
819
+ DeviceType["Update"] = "update";
820
+ DeviceType["Generic"] = "generic";
821
+ /** Generic notification delivery target (HA `notify.<service>`, future
822
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
823
+ * endpoint; the `notifier` cap defines the send surface. */
824
+ DeviceType["Notifier"] = "notifier";
825
+ /** Pre-recorded action sequence with optional parameters
826
+ * (HA `script.*`). Runnable via `script-runner` cap. */
827
+ DeviceType["Script"] = "script";
828
+ /** Automation rule (HA `automation.*`) — enable/disable + manual
829
+ * trigger surface exposed via `automation-control` cap. */
830
+ DeviceType["Automation"] = "automation";
831
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
832
+ DeviceType["Lock"] = "lock";
833
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
834
+ * `valve.*`). `cover` cap with sub-roles for variant. */
835
+ DeviceType["Cover"] = "cover";
836
+ /** Pipe / water / gas valve with open/close/stop and optional
837
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
838
+ * modelled on the same open/closed lifecycle. */
839
+ DeviceType["Valve"] = "valve";
840
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
841
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
842
+ * modelled on the same target / mode lifecycle. */
843
+ DeviceType["Humidifier"] = "humidifier";
844
+ /** Water heater / boiler with target temperature + operation mode +
845
+ * away mode (HA `water_heater.*`). `water-heater` cap — a
846
+ * climate-family actuator. */
847
+ DeviceType["WaterHeater"] = "water-heater";
848
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
849
+ DeviceType["Fan"] = "fan";
850
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
851
+ * the camera surface — those use `Camera`. `media-player` cap. */
852
+ DeviceType["MediaPlayer"] = "media-player";
853
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
854
+ * `alarm-panel` cap. */
855
+ DeviceType["AlarmPanel"] = "alarm-panel";
856
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
857
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
858
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
859
+ * TextControl / DateTimeControl. */
860
+ DeviceType["Control"] = "control";
861
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
862
+ * `presence` cap. */
863
+ DeviceType["Presence"] = "presence";
864
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
865
+ * `weather` cap. */
866
+ DeviceType["Weather"] = "weather";
867
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
868
+ DeviceType["Vacuum"] = "vacuum";
869
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
870
+ * `lawn-mower-control` cap. */
871
+ DeviceType["LawnMower"] = "lawn-mower";
872
+ /** Physical HA device group — parent container for entity-children
873
+ * adopted from a single HA device entry. Not renderable as a
874
+ * standalone device; exists only to anchor child entities. */
875
+ DeviceType["Container"] = "container";
876
+ /** Single still-image entity (HA `image.*`). Read-only display of an
877
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
878
+ DeviceType["Image"] = "image";
879
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
880
+ * level, battery, desiccant life, feeding state and manual-feed /
881
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
882
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
883
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
884
+ * integrations sharing the same food/desiccant/hopper surface. */
885
+ DeviceType["PetFeeder"] = "pet-feeder";
886
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
887
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
888
+ * of a container and is BUILT as a composed device (D967). */
889
+ DeviceType["PetFountain"] = "pet-fountain";
890
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
891
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
892
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
893
+ * A plug-built dishwasher carries running-state and power instead. */
894
+ DeviceType["Dishwasher"] = "dishwasher";
895
+ /** Washing machine. A plug-built one is running while its power stays
896
+ * above a threshold. No program cap — that surface is the dishwasher's. */
897
+ DeviceType["Washer"] = "washer";
898
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
899
+ DeviceType["Dryer"] = "dryer";
900
+ /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
901
+ * other radio-to-IP bridges). It carries the box's own facts (firmware,
902
+ * address, connection state) and the actions the box really supports
903
+ * (`reboot`, `device-admin-link`). Products are NOT its children — they are
904
+ * adopted beside it — and its connection settings stay on the integration. */
905
+ DeviceType["Gateway"] = "gateway";
906
+ return DeviceType;
907
+ }({});
908
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
909
+ DeviceFeature["BatteryOperated"] = "battery-operated";
910
+ DeviceFeature["Rebootable"] = "rebootable";
911
+ /**
912
+ * Device supports an on-demand re-sync of its derived spec with its
913
+ * upstream source — drives the generic Re-sync button. The owning
914
+ * provider implements the action via the `device-adoption.resync` cap.
915
+ */
916
+ DeviceFeature["Resyncable"] = "resyncable";
917
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
918
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
919
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
920
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
921
+ /**
922
+ * Camera supports the on-firmware autotrack subsystem (subject-
923
+ * following). Distinct from `PanTiltZoom` because not every PTZ
924
+ * camera ships autotrack — the admin UI uses this flag to gate
925
+ * the autotrack toggle / settings card without re-deriving from
926
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
927
+ * driver sets this feature when probe confirms the firmware
928
+ * surface, and registers the cap in the same code path.
929
+ */
930
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
931
+ /**
932
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
933
+ * motion detection automatically activates this device. Mirrors
934
+ * `motion-trigger` cap registration: drivers set this feature in the
935
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
936
+ *
937
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
938
+ * fast scalar without binding fetch), notifier rules, and `listAll`
939
+ * filters that want "all devices with on-motion behaviour".
940
+ */
941
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
942
+ /** Light supports rgb-triplet color via `color` cap. */
943
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
944
+ /** Light supports HSV color via `color` cap. */
945
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
946
+ /** Light supports color-temperature (mired) via `color` cap. */
947
+ DeviceFeature["LightColorMired"] = "light-color-mired";
948
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
949
+ * targetHigh). Gates the range slider UI. */
950
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
951
+ /** Thermostat exposes target humidity and/or current humidity
952
+ * readings. Gates the humidity controls. */
953
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
954
+ /** Thermostat exposes a fan-mode selector. */
955
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
956
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
957
+ DeviceFeature["ClimatePreset"] = "climate-preset";
958
+ /** Thermostat exposes a vertical louver swing toggle. Gates the
959
+ * vertical-swing switch in the climate UI. Independent of horizontal. */
960
+ DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
961
+ /** Thermostat exposes a horizontal louver swing toggle. Gates the
962
+ * horizontal-swing switch in the climate UI. Independent of vertical. */
963
+ DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
964
+ /** Cover exposes intermediate position control (0..100). Gates the
965
+ * position slider UI. */
966
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
967
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
968
+ DeviceFeature["CoverTilt"] = "cover-tilt";
969
+ /** Valve exposes intermediate position control (0..100). Gates the
970
+ * position slider / drag surface UI. */
971
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
972
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
973
+ DeviceFeature["FanSpeed"] = "fan-speed";
974
+ /** Fan exposes a preset mode selector. */
975
+ DeviceFeature["FanPreset"] = "fan-preset";
976
+ /** Fan exposes blade direction (forward/reverse) — typical of
977
+ * ceiling fans. */
978
+ DeviceFeature["FanDirection"] = "fan-direction";
979
+ /** Fan exposes an oscillation toggle. */
980
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
981
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
982
+ * field on the UI lock-controls panel. */
983
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
984
+ /** Lock supports a latch-release ("open door") action distinct from
985
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
986
+ * `supported_features`. Gates the Open Door button in the UI. */
987
+ DeviceFeature["LockOpen"] = "lock-open";
988
+ /** Media player exposes a seek-to-position surface. */
989
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
990
+ /** Media player exposes a volume-level setter. */
991
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
992
+ /** Media player exposes a mute toggle distinct from volume=0. */
993
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
994
+ /** Media player exposes a shuffle toggle. */
995
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
996
+ /** Media player exposes a repeat mode (off / all / one). */
997
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
998
+ /** Media player exposes a source / input selector. */
999
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
1000
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
1001
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
1002
+ /** Media player exposes next-track. */
1003
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
1004
+ /** Media player exposes previous-track. */
1005
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1006
+ /** Media player exposes stop distinct from pause. */
1007
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1008
+ /** Alarm panel requires a PIN code on arm/disarm. */
1009
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1010
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
1011
+ * addition to a textual location. */
1012
+ DeviceFeature["PresenceGps"] = "presence-gps";
1013
+ /** Notifier accepts an inline / URL image attachment. */
1014
+ DeviceFeature["NotifierImage"] = "notifier-image";
1015
+ /** Notifier accepts a priority hint (high/normal/low). */
1016
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
1017
+ /** Notifier accepts a free-form `data` payload for platform-specific
1018
+ * fields. */
1019
+ DeviceFeature["NotifierData"] = "notifier-data";
1020
+ /** Notifier supports interactive action buttons / callbacks. */
1021
+ DeviceFeature["NotifierActions"] = "notifier-actions";
1022
+ /** Notifier supports per-call recipient targeting (multi-user). */
1023
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
1024
+ /** Script runner accepts a variables map on each run invocation. */
1025
+ DeviceFeature["ScriptVariables"] = "script-variables";
1026
+ /** Automation `trigger` accepts a skipCondition flag — fires the
1027
+ * automation's actions while bypassing its condition block. */
1028
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
1029
+ /** Robot vacuum exposes a live cleaning map (image child). Gates the
1030
+ * map tile in the vacuum UI. */
1031
+ DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
1032
+ /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
1033
+ * switches group. */
1034
+ DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
1035
+ /** Robot mower exposes a live mowing map (SVG image child). Gates the
1036
+ * mower map tile. */
1037
+ DeviceFeature["MowerHasMap"] = "mower-has-map";
1038
+ /** Robot mower exposes targeted mowing (all-area / zones / edges /
1039
+ * spots) — gates the Mow action + map selectors. */
1040
+ DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
1041
+ return DeviceFeature;
1042
+ }({});
1043
+ /**
1044
+ * Semantic role a device plays within its parent. Populated by driver
1045
+ * addons when creating accessory devices (Reolink siren/floodlight/
1046
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
1047
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
1048
+ * `role: Floodlight` renders as a bulb with a brightness slider,
1049
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
1050
+ *
1051
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
1052
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
1053
+ */
1054
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1055
+ DeviceRole["Siren"] = "siren";
1056
+ DeviceRole["Floodlight"] = "floodlight";
1057
+ DeviceRole["Spotlight"] = "spotlight";
1058
+ DeviceRole["PirSensor"] = "pir-sensor";
1059
+ DeviceRole["Chime"] = "chime";
1060
+ DeviceRole["Autotrack"] = "autotrack";
1061
+ DeviceRole["Nightvision"] = "nightvision";
1062
+ DeviceRole["PrivacyMask"] = "privacy-mask";
1063
+ DeviceRole["Doorbell"] = "doorbell";
1064
+ /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
1065
+ DeviceRole["CoverBlind"] = "cover-blind";
1066
+ /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
1067
+ DeviceRole["CoverShutter"] = "cover-shutter";
1068
+ /** Exterior awning. HA `device_class: awning`. */
1069
+ DeviceRole["CoverAwning"] = "cover-awning";
1070
+ /** Curtain / drape. HA `device_class: curtain`. */
1071
+ DeviceRole["CoverCurtain"] = "cover-curtain";
1072
+ /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
1073
+ DeviceRole["CoverGarage"] = "cover-garage";
1074
+ /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
1075
+ DeviceRole["CoverGate"] = "cover-gate";
1076
+ /** Door. HA `device_class: door`. A security actuator: exports gate it. */
1077
+ DeviceRole["CoverDoor"] = "cover-door";
1078
+ /** Window. HA `device_class: window`. */
1079
+ DeviceRole["CoverWindow"] = "cover-window";
1080
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
1081
+ * real Switch device for UI rendering / export adapters. */
1082
+ DeviceRole["BinaryHelper"] = "binary-helper";
1083
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
1084
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
1085
+ DeviceRole["Outlet"] = "outlet";
1086
+ /** Generic motion / occupancy / moving event source. Distinct from
1087
+ * the camera accessory PirSensor role: that one is a camera child;
1088
+ * this is a standalone HA / 3rd-party motion sensor. */
1089
+ DeviceRole["MotionSensor"] = "motion-sensor";
1090
+ DeviceRole["ContactSensor"] = "contact-sensor";
1091
+ DeviceRole["LeakSensor"] = "leak-sensor";
1092
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
1093
+ DeviceRole["COSensor"] = "co-sensor";
1094
+ DeviceRole["GasSensor"] = "gas-sensor";
1095
+ DeviceRole["TamperSensor"] = "tamper-sensor";
1096
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
1097
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
1098
+ DeviceRole["SoundSensor"] = "sound-sensor";
1099
+ /** Fallback for `binary_sensor` without a known `device_class`. */
1100
+ DeviceRole["BinarySensor"] = "binary-sensor";
1101
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
1102
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
1103
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
1104
+ DeviceRole["PressureSensor"] = "pressure-sensor";
1105
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
1106
+ DeviceRole["WindSensor"] = "wind-sensor";
1107
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
1108
+ DeviceRole["RainSensor"] = "rain-sensor";
1109
+ /** UV index (weather-station `uv-sensor` cap). */
1110
+ DeviceRole["UvSensor"] = "uv-sensor";
1111
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
1112
+ * Distinct from AmbientLightSensor (lux). */
1113
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
1114
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
1115
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
1116
+ DeviceRole["PowerSensor"] = "power-sensor";
1117
+ DeviceRole["EnergySensor"] = "energy-sensor";
1118
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
1119
+ DeviceRole["CurrentSensor"] = "current-sensor";
1120
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
1121
+ /** Battery level (numeric % via `sensor` OR low-bool via
1122
+ * `binary_sensor` — the cap distinguishes via the value type). */
1123
+ DeviceRole["BatterySensor"] = "battery-sensor";
1124
+ /** Fallback for `sensor` numeric without a known `device_class`. */
1125
+ DeviceRole["NumericSensor"] = "numeric-sensor";
1126
+ /** String / enum state (HA `sensor` with `state_class: enum` or
1127
+ * `attributes.options`). */
1128
+ DeviceRole["EnumSensor"] = "enum-sensor";
1129
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
1130
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
1131
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
1132
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
1133
+ /** Last-resort fallback when nothing else matches. */
1134
+ DeviceRole["GenericSensor"] = "generic-sensor";
1135
+ DeviceRole["NumericControl"] = "numeric-control";
1136
+ DeviceRole["SelectControl"] = "select-control";
1137
+ DeviceRole["TextControl"] = "text-control";
1138
+ DeviceRole["DateTimeControl"] = "datetime-control";
1139
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
1140
+ * rich features (image, priority, channel routing). */
1141
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
1142
+ /** Chat / messaging service (HA `notify.telegram_*`,
1143
+ * `notify.discord_*`, etc.). */
1144
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
1145
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
1146
+ DeviceRole["EmailNotifier"] = "email-notifier";
1147
+ /** Fallback when the notifier service name doesn't match a known
1148
+ * pattern. */
1149
+ DeviceRole["GenericNotifier"] = "generic-notifier";
1150
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
1151
+ * cap. A `DeviceType.Generic` device. */
1152
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
1153
+ return DeviceRole;
1154
+ }({});
1155
+ //#endregion
780
1156
  //#region ../../node_modules/zod/v4/core/core.js
781
1157
  var _a$1;
782
1158
  function $constructor(name, initializer, params) {
@@ -5588,7 +5964,7 @@ var ZodIssueCode = {
5588
5964
  var ZodFirstPartyTypeKind;
5589
5965
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5590
5966
  //#endregion
5591
- //#region ../types/dist/sleep-SX9bkW3_.mjs
5967
+ //#region ../types/dist/sleep-CSYuxssh.mjs
5592
5968
  /**
5593
5969
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5594
5970
  * window to float samples (D455).
@@ -6104,6 +6480,102 @@ function emitReadiness(bus, params) {
6104
6480
  ts
6105
6481
  }));
6106
6482
  }
6483
+ var NOT_RUN = {
6484
+ declared: false,
6485
+ snapshot: null,
6486
+ applied: [],
6487
+ failed: [],
6488
+ blocked: [],
6489
+ skipped: [],
6490
+ blockOwner: []
6491
+ };
6492
+ /**
6493
+ * Offer `migrations` to the engine and run what it says to run, in its order. Never
6494
+ * throws: an unreachable or refusing engine is logged and reported `declared: false`,
6495
+ * because the hub (and this addon's boot) must not hang on a migration.
6496
+ */
6497
+ async function runAddonMigrations(host, migrations, logger) {
6498
+ const first = migrations[0];
6499
+ if (first === void 0) return NOT_RUN;
6500
+ const owner = first.meta.owner;
6501
+ const log = logger.withTags({ migrationOwner: owner });
6502
+ const byId = new Map(migrations.map((m) => [m.meta.id, m]));
6503
+ let declaration;
6504
+ try {
6505
+ declaration = await host.declareOwner({
6506
+ owner,
6507
+ metas: migrations.map((m) => m.meta)
6508
+ });
6509
+ } catch (err) {
6510
+ log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg(err) } });
6511
+ return {
6512
+ ...NOT_RUN,
6513
+ blockOwner: migrations.filter((m) => m.meta.onFailure === "block-owner").map((m) => m.meta.id)
6514
+ };
6515
+ }
6516
+ const applied = [];
6517
+ const failed = [];
6518
+ const blocked = [];
6519
+ const skipped = [];
6520
+ const settle = (id, status) => {
6521
+ if (status === "applied") applied.push(id);
6522
+ else if (status === "failed") failed.push(id);
6523
+ else if (status === "blocked") blocked.push(id);
6524
+ else skipped.push(id);
6525
+ };
6526
+ for (const step of declaration.steps) {
6527
+ const bound = byId.get(step.id);
6528
+ if (bound === void 0 || step.action === "skip") {
6529
+ skipped.push(step.id);
6530
+ continue;
6531
+ }
6532
+ const tags = { migrationId: step.id };
6533
+ try {
6534
+ const gate = await host.startMigration({ id: step.id });
6535
+ if (!gate.proceed) {
6536
+ log.warn("migration not run", {
6537
+ tags,
6538
+ meta: {
6539
+ state: gate.state,
6540
+ reason: gate.reason
6541
+ }
6542
+ });
6543
+ settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
6544
+ continue;
6545
+ }
6546
+ const result = await bound.execute();
6547
+ const outcome = await host.finishMigration({
6548
+ id: step.id,
6549
+ result
6550
+ });
6551
+ if (outcome.status === "applied") log.info("migration applied", {
6552
+ tags,
6553
+ meta: { rowsChanged: outcome.rowsChanged }
6554
+ });
6555
+ else log.error("migration failed", {
6556
+ tags,
6557
+ meta: { error: outcome.error }
6558
+ });
6559
+ settle(step.id, outcome.status);
6560
+ } catch (err) {
6561
+ log.error("migration could not be completed with the engine", {
6562
+ tags,
6563
+ meta: { error: errMsg(err) }
6564
+ });
6565
+ failed.push(step.id);
6566
+ }
6567
+ }
6568
+ const blockOwner = [...failed, ...blocked].filter((id) => byId.get(id)?.meta.onFailure === "block-owner");
6569
+ return {
6570
+ declared: true,
6571
+ snapshot: declaration.snapshot,
6572
+ applied,
6573
+ failed,
6574
+ blocked,
6575
+ skipped,
6576
+ blockOwner
6577
+ };
6578
+ }
6107
6579
  /**
6108
6580
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
6109
6581
  * `read`/`write` are the addon-store or device-store accessors. The whole
@@ -7159,6 +7631,28 @@ var BaseAddon = class {
7159
7631
  return normalized;
7160
7632
  }
7161
7633
  /**
7634
+ * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7635
+ * engine. Call it at the point of the boot where the data must already have the new
7636
+ * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7637
+ * restored devices — with the catalogue bound to the addon's ports
7638
+ * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7639
+ *
7640
+ * An engine that cannot be reached or refuses the catalogue is logged and runs
7641
+ * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7642
+ * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7643
+ * serve data whose shape it cannot trust; `tolerate` migrations never do.
7644
+ */
7645
+ async runMigrations(migrations) {
7646
+ const api = this.ctx.api.migrations;
7647
+ const report = await runAddonMigrations({
7648
+ declareOwner: (input) => api.declareOwner.mutate(input),
7649
+ startMigration: (input) => api.startMigration.mutate(input),
7650
+ finishMigration: (input) => api.finishMigration.mutate(input)
7651
+ }, migrations, this.ctx.logger);
7652
+ 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`);
7653
+ return report;
7654
+ }
7655
+ /**
7162
7656
  * Called by the isolated-process runner AFTER `broker.start()`.
7163
7657
  * In-process addons never need this because the hub broker is already
7164
7658
  * running when `initialize()` fires. For forked children the broker
@@ -7291,6 +7785,26 @@ var BaseAddon = class {
7291
7785
  * alternative — skip it — turns a rename into a surface that quietly
7292
7786
  * empties, which looks exactly like an addon with nothing to configure.
7293
7787
  */
7788
+ /**
7789
+ * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
7790
+ *
7791
+ * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
7792
+ * needs its connection fields, the default integration the addon's own sections. It is the
7793
+ * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
7794
+ * unchanged (`integrations.setSettings` for an account integration).
7795
+ */
7796
+ async integrationSettingsSchema(_instance) {
7797
+ return null;
7798
+ }
7799
+ /**
7800
+ * What the create wizard and the integration edit page render for one instance: the addon's
7801
+ * per-instance schema when it declares one, else its global schema (what they always showed).
7802
+ */
7803
+ async getIntegrationFormSchema(instance, nodeId) {
7804
+ const scoped = await this.integrationSettingsSchema(instance);
7805
+ if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
7806
+ return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
7807
+ }
7294
7808
  async getIntegrationSettings(nodeId) {
7295
7809
  const declared = this.integrationSettingSections();
7296
7810
  if (declared.length === 0) return null;
@@ -8436,410 +8950,6 @@ function defineEntryKind(name, spec) {
8436
8950
  if (defined === void 0) throw new DeclarationRefusedError(`entry kind "${name}" was not built`);
8437
8951
  return defined;
8438
8952
  }
8439
- var READING_QUANTITIES = [
8440
- "temperature",
8441
- "pressure",
8442
- "speed",
8443
- "precipitation",
8444
- "precipitation-rate",
8445
- "length",
8446
- "area",
8447
- "illuminance",
8448
- "irradiance",
8449
- "power",
8450
- "energy",
8451
- "voltage",
8452
- "current",
8453
- "apparent-power",
8454
- "humidity",
8455
- "percentage",
8456
- "concentration-volume",
8457
- "concentration-mass",
8458
- "concentration-ppb",
8459
- "volume",
8460
- "duration",
8461
- "duration-ms",
8462
- "information",
8463
- "sound-level",
8464
- "signal-level",
8465
- "colour-temperature",
8466
- "angle",
8467
- "bitrate",
8468
- "rate",
8469
- "mass",
8470
- "index",
8471
- "ratio",
8472
- "count",
8473
- "none",
8474
- "device"
8475
- ];
8476
- var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8477
- var QUANTITY_SET = new Set(READING_QUANTITIES);
8478
- function isReadingQuantity(value) {
8479
- return typeof value === "string" && QUANTITY_SET.has(value);
8480
- }
8481
- /**
8482
- * Stored unit symbol for a quantity. `none` means the number is dimensionless
8483
- * (or an index / ratio / count). `device` means the cap has no single unit.
8484
- */
8485
- var QUANTITY_BASE = {
8486
- temperature: "°C",
8487
- pressure: "hPa",
8488
- speed: "m/s",
8489
- precipitation: "mm",
8490
- "precipitation-rate": "mm/h",
8491
- length: "m",
8492
- area: "m²",
8493
- illuminance: "lx",
8494
- irradiance: "W/m²",
8495
- power: "W",
8496
- energy: "kWh",
8497
- voltage: "V",
8498
- current: "A",
8499
- "apparent-power": "VA",
8500
- humidity: "%",
8501
- percentage: "%",
8502
- "concentration-volume": "ppm",
8503
- "concentration-mass": "µg/m³",
8504
- "concentration-ppb": "ppb",
8505
- volume: "L",
8506
- duration: "s",
8507
- "duration-ms": "ms",
8508
- information: "B",
8509
- "sound-level": "dBFS",
8510
- "signal-level": "dBm",
8511
- "colour-temperature": "mired",
8512
- angle: "°",
8513
- bitrate: "kbps",
8514
- rate: "fps",
8515
- mass: "kg",
8516
- index: "none",
8517
- ratio: "none",
8518
- count: "none",
8519
- none: "none",
8520
- device: "device"
8521
- };
8522
- /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8523
- function baseUnitOf(quantity) {
8524
- const symbol = QUANTITY_BASE[quantity];
8525
- if (symbol === "none" || symbol === "device") return void 0;
8526
- return symbol;
8527
- }
8528
- function readingMeta(quantity, extras) {
8529
- return {
8530
- quantity,
8531
- ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8532
- ...extras?.label !== void 0 ? { label: extras.label } : {}
8533
- };
8534
- }
8535
- /** Shared Zod schemas used across streaming capabilities. */
8536
- var CamProfileSchema = _enum([
8537
- "high",
8538
- "mid",
8539
- "low"
8540
- ]);
8541
- /**
8542
- * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
8543
- *
8544
- * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
8545
- * that consumer owns". It lives beside `CamProfile` because a rung is the only
8546
- * operator-facing way to name a stream: a cam-stream id is broker-internal and
8547
- * moves when a slot is reassigned, so a stored id silently stops meaning what
8548
- * the operator picked. Today's one user is the audio analyser, whose rule is
8549
- * "the lowest AVAILABLE native rung" (D537).
8550
- */
8551
- var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
8552
- var CamStreamKindSchema = _enum([
8553
- "pull-rtsp",
8554
- "pull-rtmp",
8555
- "pull-http",
8556
- "pull-flv",
8557
- "pull-rfc4571",
8558
- "push-annexb",
8559
- "derived"
8560
- ]);
8561
- var CamStreamResolutionSchema = object({
8562
- width: number().int().positive().meta(readingMeta("none")),
8563
- height: number().int().positive().meta(readingMeta("none"))
8564
- });
8565
- var CameraStreamSchema = object({
8566
- /** Stable, provider-assigned id unique within the (deviceId) scope. */
8567
- camStreamId: string().min(1),
8568
- deviceId: number().int().nonnegative(),
8569
- kind: CamStreamKindSchema,
8570
- /** Required for pull-* kinds. Ignored for push-annexb. */
8571
- url: string().optional(),
8572
- codec: string().optional(),
8573
- resolution: CamStreamResolutionSchema.optional(),
8574
- fps: number().positive().optional(),
8575
- /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
8576
- label: string().optional(),
8577
- /**
8578
- * Device-level features the publisher advertised (e.g. `battery-operated`).
8579
- * The broker, snapshot orchestrator, and prebuffer manager all consult
8580
- * this list to derive policy — relaxed stall watchdog for battery
8581
- * cams, prebuffer off by default, longer snapshot rate-limit, etc.
8582
- *
8583
- * Single source of truth replacing per-stream flags like the
8584
- * historical `allowStall`: if the publisher knows the camera is
8585
- * battery-powered, every downstream service derives the right policy
8586
- * from this list.
8587
- */
8588
- deviceFeatures: array(string()).optional(),
8589
- /**
8590
- * Whether this stream participates in the broker's automatic profile
8591
- * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
8592
- * use `false` when they want a stream to be SELECTABLE in the UI but not
8593
- * picked by default — e.g. Reolink publishes its native Baichuan streams
8594
- * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
8595
- * mirrors as `autoEligible: false` (still pickable per slot, just not
8596
- * the auto choice). Manual `assignProfile` calls remain valid for
8597
- * non-eligible streams.
8598
- */
8599
- autoEligible: boolean().optional(),
8600
- /**
8601
- * The profile slot the PUBLISHER says this stream is: `low` for a stream
8602
- * whose only sensible role is the low-bandwidth one, `high` for a main
8603
- * stream. Consulted by the broker's automatic ranking
8604
- * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
8605
- * an operator's manual assignment still wins, and an absent hint is the
8606
- * pixel-ranked default every camera had before this field existed.
8607
- *
8608
- * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
8609
- * storage class is written for on its own (`recordings` is high|mid,
8610
- * `recordingsLow` is low) and the one profile scrub does not read. The robot
8611
- * camera's single 720p relay is a `low` in every respect except the slot the
8612
- * heuristic put it in.
8613
- */
8614
- profileHint: CamProfileSchema.optional(),
8615
- /**
8616
- * Transport-specific opaque metadata. The broker passes it through to
8617
- * the source reader without inspecting it. Currently used by
8618
- * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
8619
- * route RTP packets to the right depacketizer without an in-band
8620
- * DESCRIBE phase). Other kinds typically leave it undefined.
8621
- */
8622
- metadata: record(string(), unknown()).optional()
8623
- });
8624
- var ProfileSlotStatusSchema = _enum([
8625
- "unassigned",
8626
- "idle",
8627
- "connecting",
8628
- "streaming",
8629
- "error"
8630
- ]);
8631
- var ProfileSlotSchema = object({
8632
- deviceId: number().int().nonnegative(),
8633
- profile: CamProfileSchema,
8634
- /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
8635
- brokerId: string(),
8636
- /** `null` when the profile is unassigned. */
8637
- sourceCamStreamId: string().nullable(),
8638
- status: ProfileSlotStatusSchema,
8639
- resolution: CamStreamResolutionSchema.optional(),
8640
- codec: string().optional(),
8641
- preBufferSec: number().nonnegative().optional(),
8642
- errorMessage: string().optional()
8643
- });
8644
- /**
8645
- * Zod schema for StreamSourceEntry — the canonical stream descriptor
8646
- * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
8647
- */
8648
- var StreamSourceEntrySchema$1 = object({
8649
- id: string(),
8650
- label: string(),
8651
- protocol: _enum([
8652
- "rtsp",
8653
- "rtmp",
8654
- "annexb",
8655
- "http-mjpeg",
8656
- "webrtc",
8657
- "custom"
8658
- ]),
8659
- url: string().optional(),
8660
- resolution: object({
8661
- width: number(),
8662
- height: number()
8663
- }).readonly().optional(),
8664
- fps: number().optional(),
8665
- bitrate: number().optional(),
8666
- codec: string().optional(),
8667
- profileHint: CamProfileSchema.optional()
8668
- });
8669
- object({
8670
- type: string(),
8671
- url: string(),
8672
- videoCodec: string().optional(),
8673
- audioCodec: string().optional(),
8674
- metadata: record(string(), unknown()).readonly().optional()
8675
- });
8676
- /**
8677
- * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
8678
- * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
8679
- * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
8680
- * (the runner's native-crop and pipeline-executor inputs) can carry handles
8681
- * over tRPC / Moleculer.
8682
- *
8683
- * The `satisfies` assertion below pins this schema to the interface: if a
8684
- * field is added to / removed from `FrameHandle` without a matching schema
8685
- * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
8686
- * `FrameHandle` and the build fails — no silent drift.
8687
- */
8688
- var FrameHandleSchema = object({
8689
- shmId: string(),
8690
- slot: number().int().nonnegative(),
8691
- seq: number().int().nonnegative(),
8692
- width: number().int().positive(),
8693
- height: number().int().positive(),
8694
- format: _enum([
8695
- "jpeg",
8696
- "rgb",
8697
- "bgr",
8698
- "yuv420",
8699
- "gray"
8700
- ]),
8701
- pts: number(),
8702
- byteLength: number().int().nonnegative(),
8703
- nodeId: string(),
8704
- slotCount: number().int().positive()
8705
- });
8706
- /**
8707
- * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
8708
- * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
8709
- * sample bytes plus the track parameters a consumer needs to interpret them.
8710
- *
8711
- * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
8712
- * Float32 PCM), so unlike video frames they ship their bytes INLINE over
8713
- * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
8714
- * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
8715
- * it.
8716
- */
8717
- var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
8718
- var DecodedAudioChunkSchema = object({
8719
- data: _instanceof(Uint8Array),
8720
- sampleRate: number().int().positive(),
8721
- channels: number().int().positive(),
8722
- timestamp: number(),
8723
- /**
8724
- * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
8725
- * byte, for any peer that never heard of this field. A coded window
8726
- * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
8727
- * subscription that DECLARED it accepts one, so absence can never mean
8728
- * "coded bytes a consumer will read as floats" (D455).
8729
- */
8730
- format: AudioChunkFormatSchema.optional()
8731
- });
8732
- /**
8733
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
8734
- * its bytes inline: a consumer asks the broker for the decoded audio-chunk
8735
- * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
8736
- * the consumer drains via `pullAudioChunks`.
8737
- */
8738
- var SubscribeAudioChunksInputSchema = object({
8739
- brokerId: string(),
8740
- /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
8741
- tag: string().optional(),
8742
- /**
8743
- * Byte formats this subscriber can READ, best first. The broker serves the
8744
- * chunk's own format when it is in this list and expands to `f32le`
8745
- * otherwise, so a subscriber is never handed bytes it cannot interpret.
8746
- *
8747
- * Absent (or without the source format) means `f32le` — the behaviour every
8748
- * subscriber had before D455, unchanged. This is the negotiation half of
8749
- * the source-bytes lever: it is what lets the broker and its consumers
8750
- * deploy one at a time across three nodes.
8751
- */
8752
- accept: array(AudioChunkFormatSchema).readonly().optional()
8753
- });
8754
- /** Result of `stream-broker.subscribeAudioChunks`. */
8755
- var SubscribeAudioChunksResultSchema = object({
8756
- /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
8757
- subscriptionId: string() });
8758
- var BrokerStatsSchema = object({
8759
- status: _enum([
8760
- "idle",
8761
- "connecting",
8762
- "streaming",
8763
- "error",
8764
- "stopped"
8765
- ]),
8766
- inputFps: number(),
8767
- encodedSubscribers: number(),
8768
- uptimeMs: number(),
8769
- bitrateKbps: number(),
8770
- idrIntervalMs: number(),
8771
- codec: string().optional(),
8772
- totalBytes: number(),
8773
- packetCount: number(),
8774
- rtspClients: number(),
8775
- pipeClients: number(),
8776
- preBufferSec: number(),
8777
- preBufferMs: number(),
8778
- preBufferPackets: number(),
8779
- /**
8780
- * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
8781
- * when the stream has no audio track or the broker is in cold start.
8782
- * `supported = false` means the codec was detected but the local
8783
- * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
8784
- * AAC pipeline wired). Surfaced in the UI device-overview so operators
8785
- * can pre-pick the audio-analysis model that matches the codec.
8786
- */
8787
- audio: object({
8788
- codec: string(),
8789
- sampleRate: number(),
8790
- channels: number(),
8791
- supported: boolean()
8792
- }).nullable().optional(),
8793
- /**
8794
- * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
8795
- * distributing none of the device's audio, on live or recording.
8796
- *
8797
- * Present so a silent camera can be told apart from a broken one on the
8798
- * stream panel itself, without cross-referencing the switch group: a
8799
- * broker holding an `audio` track descriptor while `audioMuted` is true is
8800
- * working exactly as asked. `audioMutedDropped` counts the audio units
8801
- * thrown away since the current dial — it is how you confirm from stats
8802
- * alone that the mute is on the packet path and not merely persisted.
8803
- */
8804
- audioMuted: boolean().optional(),
8805
- audioMutedDropped: number().optional()
8806
- });
8807
- /**
8808
- * Exporter-facing "profile restream" entry. Returned by
8809
- * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
8810
- * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
8811
- * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
8812
- * RTSP restream that aliases the profile's assigned source broker, so
8813
- * every consumer dialling a profile converges on the same single pull.
8814
- * `codec`/`resolution` describe the assigned SOURCE camStream (for the
8815
- * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
8816
- * (raw per-camStream, live-view only).
8817
- */
8818
- var ProfileRtspEntrySchema = object({
8819
- profile: CamProfileSchema,
8820
- /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
8821
- brokerId: string(),
8822
- url: string(),
8823
- mutedUrl: string(),
8824
- enabled: boolean(),
8825
- codec: string().optional(),
8826
- resolution: CamStreamResolutionSchema.optional()
8827
- });
8828
- /**
8829
- * The model weight formats a catalog entry can ship. Schema-free on purpose:
8830
- * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
8831
- * (the model downloader in `@camstack/system`) needs only the list and must
8832
- * reach it through `@camstack/types/addon` without building the cap schema
8833
- * graph (D28).
8834
- */
8835
- var MODEL_FORMATS = [
8836
- "onnx",
8837
- "coreml",
8838
- "openvino",
8839
- "tflite",
8840
- "pt",
8841
- "gguf"
8842
- ];
8843
8953
  object({
8844
8954
  field: string().min(1),
8845
8955
  on: literal("advance")
@@ -8932,6 +9042,410 @@ function optionalMethod(input, output, options) {
8932
9042
  function event(data) {
8933
9043
  return { data };
8934
9044
  }
9045
+ var READING_QUANTITIES = [
9046
+ "temperature",
9047
+ "pressure",
9048
+ "speed",
9049
+ "precipitation",
9050
+ "precipitation-rate",
9051
+ "length",
9052
+ "area",
9053
+ "illuminance",
9054
+ "irradiance",
9055
+ "power",
9056
+ "energy",
9057
+ "voltage",
9058
+ "current",
9059
+ "apparent-power",
9060
+ "humidity",
9061
+ "percentage",
9062
+ "concentration-volume",
9063
+ "concentration-mass",
9064
+ "concentration-ppb",
9065
+ "volume",
9066
+ "duration",
9067
+ "duration-ms",
9068
+ "information",
9069
+ "sound-level",
9070
+ "signal-level",
9071
+ "colour-temperature",
9072
+ "angle",
9073
+ "bitrate",
9074
+ "rate",
9075
+ "mass",
9076
+ "index",
9077
+ "ratio",
9078
+ "count",
9079
+ "none",
9080
+ "device"
9081
+ ];
9082
+ var ReadingQuantitySchema = _enum(READING_QUANTITIES);
9083
+ var QUANTITY_SET = new Set(READING_QUANTITIES);
9084
+ function isReadingQuantity(value) {
9085
+ return typeof value === "string" && QUANTITY_SET.has(value);
9086
+ }
9087
+ /**
9088
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
9089
+ * (or an index / ratio / count). `device` means the cap has no single unit.
9090
+ */
9091
+ var QUANTITY_BASE = {
9092
+ temperature: "°C",
9093
+ pressure: "hPa",
9094
+ speed: "m/s",
9095
+ precipitation: "mm",
9096
+ "precipitation-rate": "mm/h",
9097
+ length: "m",
9098
+ area: "m²",
9099
+ illuminance: "lx",
9100
+ irradiance: "W/m²",
9101
+ power: "W",
9102
+ energy: "kWh",
9103
+ voltage: "V",
9104
+ current: "A",
9105
+ "apparent-power": "VA",
9106
+ humidity: "%",
9107
+ percentage: "%",
9108
+ "concentration-volume": "ppm",
9109
+ "concentration-mass": "µg/m³",
9110
+ "concentration-ppb": "ppb",
9111
+ volume: "L",
9112
+ duration: "s",
9113
+ "duration-ms": "ms",
9114
+ information: "B",
9115
+ "sound-level": "dBFS",
9116
+ "signal-level": "dBm",
9117
+ "colour-temperature": "mired",
9118
+ angle: "°",
9119
+ bitrate: "kbps",
9120
+ rate: "fps",
9121
+ mass: "kg",
9122
+ index: "none",
9123
+ ratio: "none",
9124
+ count: "none",
9125
+ none: "none",
9126
+ device: "device"
9127
+ };
9128
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
9129
+ function baseUnitOf(quantity) {
9130
+ const symbol = QUANTITY_BASE[quantity];
9131
+ if (symbol === "none" || symbol === "device") return void 0;
9132
+ return symbol;
9133
+ }
9134
+ function readingMeta(quantity, extras) {
9135
+ return {
9136
+ quantity,
9137
+ ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
9138
+ ...extras?.label !== void 0 ? { label: extras.label } : {}
9139
+ };
9140
+ }
9141
+ /** Shared Zod schemas used across streaming capabilities. */
9142
+ var CamProfileSchema = _enum([
9143
+ "high",
9144
+ "mid",
9145
+ "low"
9146
+ ]);
9147
+ /**
9148
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
9149
+ *
9150
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
9151
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
9152
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
9153
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
9154
+ * the operator picked. Today's one user is the audio analyser, whose rule is
9155
+ * "the lowest AVAILABLE native rung" (D537).
9156
+ */
9157
+ var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
9158
+ var CamStreamKindSchema = _enum([
9159
+ "pull-rtsp",
9160
+ "pull-rtmp",
9161
+ "pull-http",
9162
+ "pull-flv",
9163
+ "pull-rfc4571",
9164
+ "push-annexb",
9165
+ "derived"
9166
+ ]);
9167
+ var CamStreamResolutionSchema = object({
9168
+ width: number().int().positive().meta(readingMeta("none")),
9169
+ height: number().int().positive().meta(readingMeta("none"))
9170
+ });
9171
+ var CameraStreamSchema = object({
9172
+ /** Stable, provider-assigned id unique within the (deviceId) scope. */
9173
+ camStreamId: string().min(1),
9174
+ deviceId: number().int().nonnegative(),
9175
+ kind: CamStreamKindSchema,
9176
+ /** Required for pull-* kinds. Ignored for push-annexb. */
9177
+ url: string().optional(),
9178
+ codec: string().optional(),
9179
+ resolution: CamStreamResolutionSchema.optional(),
9180
+ fps: number().positive().optional(),
9181
+ /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
9182
+ label: string().optional(),
9183
+ /**
9184
+ * Device-level features the publisher advertised (e.g. `battery-operated`).
9185
+ * The broker, snapshot orchestrator, and prebuffer manager all consult
9186
+ * this list to derive policy — relaxed stall watchdog for battery
9187
+ * cams, prebuffer off by default, longer snapshot rate-limit, etc.
9188
+ *
9189
+ * Single source of truth replacing per-stream flags like the
9190
+ * historical `allowStall`: if the publisher knows the camera is
9191
+ * battery-powered, every downstream service derives the right policy
9192
+ * from this list.
9193
+ */
9194
+ deviceFeatures: array(string()).optional(),
9195
+ /**
9196
+ * Whether this stream participates in the broker's automatic profile
9197
+ * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
9198
+ * use `false` when they want a stream to be SELECTABLE in the UI but not
9199
+ * picked by default — e.g. Reolink publishes its native Baichuan streams
9200
+ * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
9201
+ * mirrors as `autoEligible: false` (still pickable per slot, just not
9202
+ * the auto choice). Manual `assignProfile` calls remain valid for
9203
+ * non-eligible streams.
9204
+ */
9205
+ autoEligible: boolean().optional(),
9206
+ /**
9207
+ * The profile slot the PUBLISHER says this stream is: `low` for a stream
9208
+ * whose only sensible role is the low-bandwidth one, `high` for a main
9209
+ * stream. Consulted by the broker's automatic ranking
9210
+ * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
9211
+ * an operator's manual assignment still wins, and an absent hint is the
9212
+ * pixel-ranked default every camera had before this field existed.
9213
+ *
9214
+ * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
9215
+ * storage class is written for on its own (`recordings` is high|mid,
9216
+ * `recordingsLow` is low) and the one profile scrub does not read. The robot
9217
+ * camera's single 720p relay is a `low` in every respect except the slot the
9218
+ * heuristic put it in.
9219
+ */
9220
+ profileHint: CamProfileSchema.optional(),
9221
+ /**
9222
+ * Transport-specific opaque metadata. The broker passes it through to
9223
+ * the source reader without inspecting it. Currently used by
9224
+ * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
9225
+ * route RTP packets to the right depacketizer without an in-band
9226
+ * DESCRIBE phase). Other kinds typically leave it undefined.
9227
+ */
9228
+ metadata: record(string(), unknown()).optional()
9229
+ });
9230
+ var ProfileSlotStatusSchema = _enum([
9231
+ "unassigned",
9232
+ "idle",
9233
+ "connecting",
9234
+ "streaming",
9235
+ "error"
9236
+ ]);
9237
+ var ProfileSlotSchema = object({
9238
+ deviceId: number().int().nonnegative(),
9239
+ profile: CamProfileSchema,
9240
+ /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
9241
+ brokerId: string(),
9242
+ /** `null` when the profile is unassigned. */
9243
+ sourceCamStreamId: string().nullable(),
9244
+ status: ProfileSlotStatusSchema,
9245
+ resolution: CamStreamResolutionSchema.optional(),
9246
+ codec: string().optional(),
9247
+ preBufferSec: number().nonnegative().optional(),
9248
+ errorMessage: string().optional()
9249
+ });
9250
+ /**
9251
+ * Zod schema for StreamSourceEntry — the canonical stream descriptor
9252
+ * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
9253
+ */
9254
+ var StreamSourceEntrySchema$1 = object({
9255
+ id: string(),
9256
+ label: string(),
9257
+ protocol: _enum([
9258
+ "rtsp",
9259
+ "rtmp",
9260
+ "annexb",
9261
+ "http-mjpeg",
9262
+ "webrtc",
9263
+ "custom"
9264
+ ]),
9265
+ url: string().optional(),
9266
+ resolution: object({
9267
+ width: number(),
9268
+ height: number()
9269
+ }).readonly().optional(),
9270
+ fps: number().optional(),
9271
+ bitrate: number().optional(),
9272
+ codec: string().optional(),
9273
+ profileHint: CamProfileSchema.optional()
9274
+ });
9275
+ object({
9276
+ type: string(),
9277
+ url: string(),
9278
+ videoCodec: string().optional(),
9279
+ audioCodec: string().optional(),
9280
+ metadata: record(string(), unknown()).readonly().optional()
9281
+ });
9282
+ /**
9283
+ * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
9284
+ * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
9285
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
9286
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
9287
+ * over tRPC / Moleculer.
9288
+ *
9289
+ * The `satisfies` assertion below pins this schema to the interface: if a
9290
+ * field is added to / removed from `FrameHandle` without a matching schema
9291
+ * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
9292
+ * `FrameHandle` and the build fails — no silent drift.
9293
+ */
9294
+ var FrameHandleSchema = object({
9295
+ shmId: string(),
9296
+ slot: number().int().nonnegative(),
9297
+ seq: number().int().nonnegative(),
9298
+ width: number().int().positive(),
9299
+ height: number().int().positive(),
9300
+ format: _enum([
9301
+ "jpeg",
9302
+ "rgb",
9303
+ "bgr",
9304
+ "yuv420",
9305
+ "gray"
9306
+ ]),
9307
+ pts: number(),
9308
+ byteLength: number().int().nonnegative(),
9309
+ nodeId: string(),
9310
+ slotCount: number().int().positive()
9311
+ });
9312
+ /**
9313
+ * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
9314
+ * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
9315
+ * sample bytes plus the track parameters a consumer needs to interpret them.
9316
+ *
9317
+ * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
9318
+ * Float32 PCM), so unlike video frames they ship their bytes INLINE over
9319
+ * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
9320
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
9321
+ * it.
9322
+ */
9323
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
9324
+ var DecodedAudioChunkSchema = object({
9325
+ data: _instanceof(Uint8Array),
9326
+ sampleRate: number().int().positive(),
9327
+ channels: number().int().positive(),
9328
+ timestamp: number(),
9329
+ /**
9330
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
9331
+ * byte, for any peer that never heard of this field. A coded window
9332
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
9333
+ * subscription that DECLARED it accepts one, so absence can never mean
9334
+ * "coded bytes a consumer will read as floats" (D455).
9335
+ */
9336
+ format: AudioChunkFormatSchema.optional()
9337
+ });
9338
+ /**
9339
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
9340
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
9341
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
9342
+ * the consumer drains via `pullAudioChunks`.
9343
+ */
9344
+ var SubscribeAudioChunksInputSchema = object({
9345
+ brokerId: string(),
9346
+ /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
9347
+ tag: string().optional(),
9348
+ /**
9349
+ * Byte formats this subscriber can READ, best first. The broker serves the
9350
+ * chunk's own format when it is in this list and expands to `f32le`
9351
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
9352
+ *
9353
+ * Absent (or without the source format) means `f32le` — the behaviour every
9354
+ * subscriber had before D455, unchanged. This is the negotiation half of
9355
+ * the source-bytes lever: it is what lets the broker and its consumers
9356
+ * deploy one at a time across three nodes.
9357
+ */
9358
+ accept: array(AudioChunkFormatSchema).readonly().optional()
9359
+ });
9360
+ /** Result of `stream-broker.subscribeAudioChunks`. */
9361
+ var SubscribeAudioChunksResultSchema = object({
9362
+ /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
9363
+ subscriptionId: string() });
9364
+ var BrokerStatsSchema = object({
9365
+ status: _enum([
9366
+ "idle",
9367
+ "connecting",
9368
+ "streaming",
9369
+ "error",
9370
+ "stopped"
9371
+ ]),
9372
+ inputFps: number(),
9373
+ encodedSubscribers: number(),
9374
+ uptimeMs: number(),
9375
+ bitrateKbps: number(),
9376
+ idrIntervalMs: number(),
9377
+ codec: string().optional(),
9378
+ totalBytes: number(),
9379
+ packetCount: number(),
9380
+ rtspClients: number(),
9381
+ pipeClients: number(),
9382
+ preBufferSec: number(),
9383
+ preBufferMs: number(),
9384
+ preBufferPackets: number(),
9385
+ /**
9386
+ * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
9387
+ * when the stream has no audio track or the broker is in cold start.
9388
+ * `supported = false` means the codec was detected but the local
9389
+ * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
9390
+ * AAC pipeline wired). Surfaced in the UI device-overview so operators
9391
+ * can pre-pick the audio-analysis model that matches the codec.
9392
+ */
9393
+ audio: object({
9394
+ codec: string(),
9395
+ sampleRate: number(),
9396
+ channels: number(),
9397
+ supported: boolean()
9398
+ }).nullable().optional(),
9399
+ /**
9400
+ * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
9401
+ * distributing none of the device's audio, on live or recording.
9402
+ *
9403
+ * Present so a silent camera can be told apart from a broken one on the
9404
+ * stream panel itself, without cross-referencing the switch group: a
9405
+ * broker holding an `audio` track descriptor while `audioMuted` is true is
9406
+ * working exactly as asked. `audioMutedDropped` counts the audio units
9407
+ * thrown away since the current dial — it is how you confirm from stats
9408
+ * alone that the mute is on the packet path and not merely persisted.
9409
+ */
9410
+ audioMuted: boolean().optional(),
9411
+ audioMutedDropped: number().optional()
9412
+ });
9413
+ /**
9414
+ * Exporter-facing "profile restream" entry. Returned by
9415
+ * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
9416
+ * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
9417
+ * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
9418
+ * RTSP restream that aliases the profile's assigned source broker, so
9419
+ * every consumer dialling a profile converges on the same single pull.
9420
+ * `codec`/`resolution` describe the assigned SOURCE camStream (for the
9421
+ * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
9422
+ * (raw per-camStream, live-view only).
9423
+ */
9424
+ var ProfileRtspEntrySchema = object({
9425
+ profile: CamProfileSchema,
9426
+ /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
9427
+ brokerId: string(),
9428
+ url: string(),
9429
+ mutedUrl: string(),
9430
+ enabled: boolean(),
9431
+ codec: string().optional(),
9432
+ resolution: CamStreamResolutionSchema.optional()
9433
+ });
9434
+ /**
9435
+ * The model weight formats a catalog entry can ship. Schema-free on purpose:
9436
+ * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
9437
+ * (the model downloader in `@camstack/server/system`) needs only the list and must
9438
+ * reach it through `@camstack/types/addon` without building the cap schema
9439
+ * graph (D28).
9440
+ */
9441
+ var MODEL_FORMATS = [
9442
+ "onnx",
9443
+ "coreml",
9444
+ "openvino",
9445
+ "tflite",
9446
+ "pt",
9447
+ "gguf"
9448
+ ];
8935
9449
  /**
8936
9450
  * Per-call node pinning for `ctx.api` capability calls.
8937
9451
  *
@@ -9232,6 +9746,7 @@ var CAP_NAMES = Object.freeze([
9232
9746
  "mesh-network",
9233
9747
  "meter",
9234
9748
  "metrics-provider",
9749
+ "migrations",
9235
9750
  "model-convert",
9236
9751
  "model-distributor",
9237
9752
  "motion",
@@ -9264,6 +9779,7 @@ var CAP_NAMES = Object.freeze([
9264
9779
  "plate-gallery",
9265
9780
  "platform-probe",
9266
9781
  "power-meter",
9782
+ "power-source",
9267
9783
  "presence",
9268
9784
  "pressure-sensor",
9269
9785
  "privacy-mask",
@@ -10615,6 +11131,13 @@ Object.freeze({
10615
11131
  "valueType": "number"
10616
11132
  }
10617
11133
  ],
11134
+ "power-source": [{
11135
+ "path": "switchOn",
11136
+ "valueType": "boolean"
11137
+ }, {
11138
+ "path": "offSeconds",
11139
+ "valueType": "number"
11140
+ }],
10618
11141
  "presence": [
10619
11142
  {
10620
11143
  "path": "state",
@@ -11126,379 +11649,7 @@ object({
11126
11649
  params: record(string(), union([string(), number()])).optional()
11127
11650
  });
11128
11651
  //#endregion
11129
- //#region ../types/dist/err-msg-BD5buxvT.mjs
11130
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
11131
- DeviceType["Camera"] = "camera";
11132
- DeviceType["Hub"] = "hub";
11133
- DeviceType["Light"] = "light";
11134
- DeviceType["Siren"] = "siren";
11135
- DeviceType["Switch"] = "switch";
11136
- DeviceType["Sensor"] = "sensor";
11137
- DeviceType["Thermostat"] = "thermostat";
11138
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
11139
- * `climate-control` cap surface with `Thermostat` but renders a
11140
- * dedicated AC-appropriate control UI (mode chips, fan speed,
11141
- * independent vertical/horizontal swing). Sources: native Gree, and
11142
- * reusable by other AC integrations. */
11143
- DeviceType["Climate"] = "climate";
11144
- DeviceType["Button"] = "button";
11145
- /** Generic stateless event emitter — carries a device's EXACT declared
11146
- * event vocabulary verbatim (no normalization). Installed with the
11147
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
11148
- * HA bus events (e.g. `zha_event`, generic). */
11149
- DeviceType["EventEmitter"] = "event-emitter";
11150
- /** Firmware/software update entity — current vs available version,
11151
- * updatable flag, update state, and an install action. Installed with
11152
- * the `update` cap. Sources: Homematic firmware-update channels (and
11153
- * reusable by other providers, e.g. HA `update.*` entities). */
11154
- DeviceType["Update"] = "update";
11155
- DeviceType["Generic"] = "generic";
11156
- /** Generic notification delivery target (HA `notify.<service>`, future
11157
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
11158
- * endpoint; the `notifier` cap defines the send surface. */
11159
- DeviceType["Notifier"] = "notifier";
11160
- /** Pre-recorded action sequence with optional parameters
11161
- * (HA `script.*`). Runnable via `script-runner` cap. */
11162
- DeviceType["Script"] = "script";
11163
- /** Automation rule (HA `automation.*`) — enable/disable + manual
11164
- * trigger surface exposed via `automation-control` cap. */
11165
- DeviceType["Automation"] = "automation";
11166
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
11167
- DeviceType["Lock"] = "lock";
11168
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
11169
- * `valve.*`). `cover` cap with sub-roles for variant. */
11170
- DeviceType["Cover"] = "cover";
11171
- /** Pipe / water / gas valve with open/close/stop and optional
11172
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
11173
- * modelled on the same open/closed lifecycle. */
11174
- DeviceType["Valve"] = "valve";
11175
- /** Humidifier / dehumidifier with on/off + target humidity + mode
11176
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
11177
- * modelled on the same target / mode lifecycle. */
11178
- DeviceType["Humidifier"] = "humidifier";
11179
- /** Water heater / boiler with target temperature + operation mode +
11180
- * away mode (HA `water_heater.*`). `water-heater` cap — a
11181
- * climate-family actuator. */
11182
- DeviceType["WaterHeater"] = "water-heater";
11183
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
11184
- DeviceType["Fan"] = "fan";
11185
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
11186
- * the camera surface — those use `Camera`. `media-player` cap. */
11187
- DeviceType["MediaPlayer"] = "media-player";
11188
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
11189
- * `alarm-panel` cap. */
11190
- DeviceType["AlarmPanel"] = "alarm-panel";
11191
- /** Generic user-settable input (HA `number` / `input_number` / `select`
11192
- * / `input_select` / `text` / `input_text` / `input_datetime`).
11193
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
11194
- * TextControl / DateTimeControl. */
11195
- DeviceType["Control"] = "control";
11196
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
11197
- * `presence` cap. */
11198
- DeviceType["Presence"] = "presence";
11199
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
11200
- * `weather` cap. */
11201
- DeviceType["Weather"] = "weather";
11202
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
11203
- DeviceType["Vacuum"] = "vacuum";
11204
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
11205
- * `lawn-mower-control` cap. */
11206
- DeviceType["LawnMower"] = "lawn-mower";
11207
- /** Physical HA device group — parent container for entity-children
11208
- * adopted from a single HA device entry. Not renderable as a
11209
- * standalone device; exists only to anchor child entities. */
11210
- DeviceType["Container"] = "container";
11211
- /** Single still-image entity (HA `image.*`). Read-only display of an
11212
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
11213
- DeviceType["Image"] = "image";
11214
- /** Smart pet feeder — cloud-connected food dispenser with a bowl food
11215
- * level, battery, desiccant life, feeding state and manual-feed /
11216
- * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
11217
- * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
11218
- * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
11219
- * integrations sharing the same food/desiccant/hopper surface. */
11220
- DeviceType["PetFeeder"] = "pet-feeder";
11221
- /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
11222
- * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
11223
- * of a container and is BUILT as a composed device (D967). */
11224
- DeviceType["PetFountain"] = "pet-fountain";
11225
- /** Built-in dishwasher — program lifecycle, door / remote-start gates,
11226
- * salt and rinse-aid levels. Installed with the `dishwasher` cap.
11227
- * Sources: native Bosch Home Connect, reusable by similar integrations.
11228
- * A plug-built dishwasher carries running-state and power instead. */
11229
- DeviceType["Dishwasher"] = "dishwasher";
11230
- /** Washing machine. A plug-built one is running while its power stays
11231
- * above a threshold. No program cap — that surface is the dishwasher's. */
11232
- DeviceType["Washer"] = "washer";
11233
- /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
11234
- DeviceType["Dryer"] = "dryer";
11235
- /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
11236
- * other radio-to-IP bridges). It carries the box's own facts (firmware,
11237
- * address, connection state) and the actions the box really supports
11238
- * (`reboot`, `device-admin-link`). Products are NOT its children — they are
11239
- * adopted beside it — and its connection settings stay on the integration. */
11240
- DeviceType["Gateway"] = "gateway";
11241
- return DeviceType;
11242
- }({});
11243
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
11244
- DeviceFeature["BatteryOperated"] = "battery-operated";
11245
- DeviceFeature["Rebootable"] = "rebootable";
11246
- /**
11247
- * Device supports an on-demand re-sync of its derived spec with its
11248
- * upstream source — drives the generic Re-sync button. The owning
11249
- * provider implements the action via the `device-adoption.resync` cap.
11250
- */
11251
- DeviceFeature["Resyncable"] = "resyncable";
11252
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
11253
- DeviceFeature["DoorbellButton"] = "doorbell-button";
11254
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
11255
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
11256
- /**
11257
- * Camera supports the on-firmware autotrack subsystem (subject-
11258
- * following). Distinct from `PanTiltZoom` because not every PTZ
11259
- * camera ships autotrack — the admin UI uses this flag to gate
11260
- * the autotrack toggle / settings card without re-deriving from
11261
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
11262
- * driver sets this feature when probe confirms the firmware
11263
- * surface, and registers the cap in the same code path.
11264
- */
11265
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
11266
- /**
11267
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
11268
- * motion detection automatically activates this device. Mirrors
11269
- * `motion-trigger` cap registration: drivers set this feature in the
11270
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
11271
- *
11272
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
11273
- * fast scalar without binding fetch), notifier rules, and `listAll`
11274
- * filters that want "all devices with on-motion behaviour".
11275
- */
11276
- DeviceFeature["MotionTrigger"] = "motion-trigger";
11277
- /** Light supports rgb-triplet color via `color` cap. */
11278
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
11279
- /** Light supports HSV color via `color` cap. */
11280
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
11281
- /** Light supports color-temperature (mired) via `color` cap. */
11282
- DeviceFeature["LightColorMired"] = "light-color-mired";
11283
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
11284
- * targetHigh). Gates the range slider UI. */
11285
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
11286
- /** Thermostat exposes target humidity and/or current humidity
11287
- * readings. Gates the humidity controls. */
11288
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
11289
- /** Thermostat exposes a fan-mode selector. */
11290
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
11291
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
11292
- DeviceFeature["ClimatePreset"] = "climate-preset";
11293
- /** Thermostat exposes a vertical louver swing toggle. Gates the
11294
- * vertical-swing switch in the climate UI. Independent of horizontal. */
11295
- DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
11296
- /** Thermostat exposes a horizontal louver swing toggle. Gates the
11297
- * horizontal-swing switch in the climate UI. Independent of vertical. */
11298
- DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
11299
- /** Cover exposes intermediate position control (0..100). Gates the
11300
- * position slider UI. */
11301
- DeviceFeature["CoverPositionable"] = "cover-positionable";
11302
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
11303
- DeviceFeature["CoverTilt"] = "cover-tilt";
11304
- /** Valve exposes intermediate position control (0..100). Gates the
11305
- * position slider / drag surface UI. */
11306
- DeviceFeature["ValvePositionable"] = "valve-positionable";
11307
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
11308
- DeviceFeature["FanSpeed"] = "fan-speed";
11309
- /** Fan exposes a preset mode selector. */
11310
- DeviceFeature["FanPreset"] = "fan-preset";
11311
- /** Fan exposes blade direction (forward/reverse) — typical of
11312
- * ceiling fans. */
11313
- DeviceFeature["FanDirection"] = "fan-direction";
11314
- /** Fan exposes an oscillation toggle. */
11315
- DeviceFeature["FanOscillating"] = "fan-oscillating";
11316
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
11317
- * field on the UI lock-controls panel. */
11318
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
11319
- /** Lock supports a latch-release ("open door") action distinct from
11320
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
11321
- * `supported_features`. Gates the Open Door button in the UI. */
11322
- DeviceFeature["LockOpen"] = "lock-open";
11323
- /** Media player exposes a seek-to-position surface. */
11324
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
11325
- /** Media player exposes a volume-level setter. */
11326
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
11327
- /** Media player exposes a mute toggle distinct from volume=0. */
11328
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
11329
- /** Media player exposes a shuffle toggle. */
11330
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
11331
- /** Media player exposes a repeat mode (off / all / one). */
11332
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
11333
- /** Media player exposes a source / input selector. */
11334
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
11335
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
11336
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
11337
- /** Media player exposes next-track. */
11338
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
11339
- /** Media player exposes previous-track. */
11340
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
11341
- /** Media player exposes stop distinct from pause. */
11342
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
11343
- /** Alarm panel requires a PIN code on arm/disarm. */
11344
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
11345
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
11346
- * addition to a textual location. */
11347
- DeviceFeature["PresenceGps"] = "presence-gps";
11348
- /** Notifier accepts an inline / URL image attachment. */
11349
- DeviceFeature["NotifierImage"] = "notifier-image";
11350
- /** Notifier accepts a priority hint (high/normal/low). */
11351
- DeviceFeature["NotifierPriority"] = "notifier-priority";
11352
- /** Notifier accepts a free-form `data` payload for platform-specific
11353
- * fields. */
11354
- DeviceFeature["NotifierData"] = "notifier-data";
11355
- /** Notifier supports interactive action buttons / callbacks. */
11356
- DeviceFeature["NotifierActions"] = "notifier-actions";
11357
- /** Notifier supports per-call recipient targeting (multi-user). */
11358
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
11359
- /** Script runner accepts a variables map on each run invocation. */
11360
- DeviceFeature["ScriptVariables"] = "script-variables";
11361
- /** Automation `trigger` accepts a skipCondition flag — fires the
11362
- * automation's actions while bypassing its condition block. */
11363
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
11364
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
11365
- * map tile in the vacuum UI. */
11366
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
11367
- /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
11368
- * switches group. */
11369
- DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
11370
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
11371
- * mower map tile. */
11372
- DeviceFeature["MowerHasMap"] = "mower-has-map";
11373
- /** Robot mower exposes targeted mowing (all-area / zones / edges /
11374
- * spots) — gates the Mow action + map selectors. */
11375
- DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
11376
- return DeviceFeature;
11377
- }({});
11378
- /**
11379
- * Semantic role a device plays within its parent. Populated by driver
11380
- * addons when creating accessory devices (Reolink siren/floodlight/
11381
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
11382
- * admin UI to pick icons, labels, and widgets — a `Switch` with
11383
- * `role: Floodlight` renders as a bulb with a brightness slider,
11384
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
11385
- *
11386
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
11387
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
11388
- */
11389
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
11390
- DeviceRole["Siren"] = "siren";
11391
- DeviceRole["Floodlight"] = "floodlight";
11392
- DeviceRole["Spotlight"] = "spotlight";
11393
- DeviceRole["PirSensor"] = "pir-sensor";
11394
- DeviceRole["Chime"] = "chime";
11395
- DeviceRole["Autotrack"] = "autotrack";
11396
- DeviceRole["Nightvision"] = "nightvision";
11397
- DeviceRole["PrivacyMask"] = "privacy-mask";
11398
- DeviceRole["Doorbell"] = "doorbell";
11399
- /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
11400
- DeviceRole["CoverBlind"] = "cover-blind";
11401
- /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
11402
- DeviceRole["CoverShutter"] = "cover-shutter";
11403
- /** Exterior awning. HA `device_class: awning`. */
11404
- DeviceRole["CoverAwning"] = "cover-awning";
11405
- /** Curtain / drape. HA `device_class: curtain`. */
11406
- DeviceRole["CoverCurtain"] = "cover-curtain";
11407
- /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
11408
- DeviceRole["CoverGarage"] = "cover-garage";
11409
- /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
11410
- DeviceRole["CoverGate"] = "cover-gate";
11411
- /** Door. HA `device_class: door`. A security actuator: exports gate it. */
11412
- DeviceRole["CoverDoor"] = "cover-door";
11413
- /** Window. HA `device_class: window`. */
11414
- DeviceRole["CoverWindow"] = "cover-window";
11415
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
11416
- * real Switch device for UI rendering / export adapters. */
11417
- DeviceRole["BinaryHelper"] = "binary-helper";
11418
- /** A smart plug: a `switch` whose source says it is an outlet (HA
11419
- * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
11420
- DeviceRole["Outlet"] = "outlet";
11421
- /** Generic motion / occupancy / moving event source. Distinct from
11422
- * the camera accessory PirSensor role: that one is a camera child;
11423
- * this is a standalone HA / 3rd-party motion sensor. */
11424
- DeviceRole["MotionSensor"] = "motion-sensor";
11425
- DeviceRole["ContactSensor"] = "contact-sensor";
11426
- DeviceRole["LeakSensor"] = "leak-sensor";
11427
- DeviceRole["SmokeSensor"] = "smoke-sensor";
11428
- DeviceRole["COSensor"] = "co-sensor";
11429
- DeviceRole["GasSensor"] = "gas-sensor";
11430
- DeviceRole["TamperSensor"] = "tamper-sensor";
11431
- DeviceRole["VibrationSensor"] = "vibration-sensor";
11432
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
11433
- DeviceRole["SoundSensor"] = "sound-sensor";
11434
- /** Fallback for `binary_sensor` without a known `device_class`. */
11435
- DeviceRole["BinarySensor"] = "binary-sensor";
11436
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
11437
- DeviceRole["HumiditySensor"] = "humidity-sensor";
11438
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
11439
- DeviceRole["PressureSensor"] = "pressure-sensor";
11440
- /** Wind speed or direction (weather-station `wind-sensor` cap). */
11441
- DeviceRole["WindSensor"] = "wind-sensor";
11442
- /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
11443
- DeviceRole["RainSensor"] = "rain-sensor";
11444
- /** UV index (weather-station `uv-sensor` cap). */
11445
- DeviceRole["UvSensor"] = "uv-sensor";
11446
- /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
11447
- * Distinct from AmbientLightSensor (lux). */
11448
- DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
11449
- /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
11450
- DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
11451
- DeviceRole["PowerSensor"] = "power-sensor";
11452
- DeviceRole["EnergySensor"] = "energy-sensor";
11453
- DeviceRole["VoltageSensor"] = "voltage-sensor";
11454
- DeviceRole["CurrentSensor"] = "current-sensor";
11455
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
11456
- /** Battery level (numeric % via `sensor` OR low-bool via
11457
- * `binary_sensor` — the cap distinguishes via the value type). */
11458
- DeviceRole["BatterySensor"] = "battery-sensor";
11459
- /** Fallback for `sensor` numeric without a known `device_class`. */
11460
- DeviceRole["NumericSensor"] = "numeric-sensor";
11461
- /** String / enum state (HA `sensor` with `state_class: enum` or
11462
- * `attributes.options`). */
11463
- DeviceRole["EnumSensor"] = "enum-sensor";
11464
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
11465
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
11466
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
11467
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
11468
- /** Last-resort fallback when nothing else matches. */
11469
- DeviceRole["GenericSensor"] = "generic-sensor";
11470
- DeviceRole["NumericControl"] = "numeric-control";
11471
- DeviceRole["SelectControl"] = "select-control";
11472
- DeviceRole["TextControl"] = "text-control";
11473
- DeviceRole["DateTimeControl"] = "datetime-control";
11474
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
11475
- * rich features (image, priority, channel routing). */
11476
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
11477
- /** Chat / messaging service (HA `notify.telegram_*`,
11478
- * `notify.discord_*`, etc.). */
11479
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
11480
- /** Email-based delivery (HA `notify.smtp`, etc.). */
11481
- DeviceRole["EmailNotifier"] = "email-notifier";
11482
- /** Fallback when the notifier service name doesn't match a known
11483
- * pattern. */
11484
- DeviceRole["GenericNotifier"] = "generic-notifier";
11485
- /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
11486
- * cap. A `DeviceType.Generic` device. */
11487
- DeviceRole["IrTransmitter"] = "ir-transmitter";
11488
- return DeviceRole;
11489
- }({});
11490
- /**
11491
- import { errMsg } from '@camstack/types'
11492
- * Extract a human-readable message from an unknown error value.
11493
- * Replaces the ubiquitous `errMsg(err)` pattern.
11494
- */
11495
- function errMsg(err) {
11496
- if (err instanceof Error) return err.message;
11497
- if (typeof err === "string") return err;
11498
- return String(err);
11499
- }
11500
- //#endregion
11501
- //#region ../types/dist/composition-C7WdThmP.mjs
11652
+ //#region ../types/dist/composition-BBzVf2xd.mjs
11502
11653
  /**
11503
11654
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11504
11655
  *
@@ -12717,6 +12868,90 @@ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
12717
12868
  var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
12718
12869
  new Set(EVENT_OWNER_TYPES);
12719
12870
  /**
12871
+ * What a published package needs from the rest of the install (D989).
12872
+ *
12873
+ * One published framework package (`@camstack/server`) carries the kernel, the
12874
+ * builtins and the capability contracts, so "which addon runs on which
12875
+ * framework" is a question of version, and the answer is DECLARED by the
12876
+ * package that knows it:
12877
+ *
12878
+ * - an addon says the oldest server it runs on (`requires.server: ">=X"`);
12879
+ * - the server says the oldest addon it works with
12880
+ * (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
12881
+ * around it (`requires.wrapper: { desktop, image }`);
12882
+ * - a wrapper (the desktop app, the container starter) says which server
12883
+ * range it can host, and reports its own kind and version.
12884
+ *
12885
+ * The publish workflow STAMPS these after the version bump
12886
+ * (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
12887
+ *
12888
+ * A requirement that cannot be checked is NOT met: a shell that reports no
12889
+ * version counts as below the minimum, and an unreadable running version is
12890
+ * named in the result (a failed read is never a pass).
12891
+ */
12892
+ /** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
12893
+ var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
12894
+ object({
12895
+ /** The oldest `@camstack/server` this package runs on. */
12896
+ server: MinVersionSchema.optional(),
12897
+ /** The oldest installed version of each named addon package. */
12898
+ addons: record(string(), MinVersionSchema).optional(),
12899
+ /** The oldest shell around the server, per shell kind. */
12900
+ wrapper: object({
12901
+ desktop: MinVersionSchema.optional(),
12902
+ image: MinVersionSchema.optional()
12903
+ }).optional()
12904
+ });
12905
+ /** One unmet requirement; each names the versions on both sides. */
12906
+ var UnmetRequirementSchema = discriminatedUnion("kind", [
12907
+ object({
12908
+ kind: literal("server-too-old"),
12909
+ required: string(),
12910
+ /** `null` — the running server version could not be read. */
12911
+ running: string().nullable()
12912
+ }),
12913
+ object({
12914
+ kind: literal("addon-too-old"),
12915
+ packageName: string(),
12916
+ required: string(),
12917
+ /** `null` — the addon is not installed (or its version is unreadable). */
12918
+ running: string().nullable()
12919
+ }),
12920
+ object({
12921
+ kind: literal("wrapper-too-old"),
12922
+ wrapper: _enum(["desktop", "image"]),
12923
+ required: string(),
12924
+ /** `null` — the wrapper reported no version. */
12925
+ running: string().nullable()
12926
+ })
12927
+ ]);
12928
+ var RequiredAddonUpdateSchema = object({
12929
+ packageName: string(),
12930
+ /** The minimum the target server declares. */
12931
+ required: string(),
12932
+ /** What this node has; `null` when the addon is not installed. */
12933
+ installed: string().nullable()
12934
+ });
12935
+ /**
12936
+ * Which integration instance a settings form is for. An addon that serves several instances
12937
+ * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
12938
+ * needs its connection, the default integration needs the addon's own sections.
12939
+ *
12940
+ * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
12941
+ * setting up a NEW instance.
12942
+ * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
12943
+ * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
12944
+ */
12945
+ var IntegrationInstanceRefSchema = object({
12946
+ integrationId: string().nullable(),
12947
+ mode: _enum([
12948
+ "standalone",
12949
+ "account",
12950
+ "broker"
12951
+ ]),
12952
+ candidateStableId: string().optional()
12953
+ });
12954
+ /**
12720
12955
  * Build an `IAddonRouteProvider` from a list of routes. Implements
12721
12956
  * both the operator-facing `getRoutes` (returning route descriptors
12722
12957
  * minus the handlers, which can't cross JSON) and the framework-
@@ -13316,6 +13551,613 @@ var CameraSwitchGroupSchema = object({
13316
13551
  fetchedAt: number()
13317
13552
  });
13318
13553
  /**
13554
+ * Query filter for settings-store collections.
13555
+ */
13556
+ var QueryFilterSchema = object({
13557
+ where: record(string(), unknown()).optional(),
13558
+ whereIn: record(string(), array(unknown())).optional(),
13559
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13560
+ /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
13561
+ whereNot: record(string(), unknown()).optional(),
13562
+ /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
13563
+ * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
13564
+ whereNotIn: record(string(), array(unknown())).optional(),
13565
+ orderBy: object({
13566
+ field: string(),
13567
+ direction: _enum(["asc", "desc"])
13568
+ }).optional(),
13569
+ limit: number().optional(),
13570
+ offset: number().optional()
13571
+ });
13572
+ /**
13573
+ * The predicate half of a filter, for BULK MUTATIONS.
13574
+ *
13575
+ * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
13576
+ * meaning for a statement that rewrites a set, and accepting them would invite
13577
+ * a caller to believe `limit` bounds the damage. Every field is optional here
13578
+ * only so the shape stays composable — the implementation REJECTS a filter
13579
+ * that compiles to no predicate, because that is the whole collection.
13580
+ */
13581
+ var MutationFilterSchema = object({
13582
+ where: record(string(), unknown()).optional(),
13583
+ whereIn: record(string(), array(unknown())).optional(),
13584
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13585
+ whereNot: record(string(), unknown()).optional(),
13586
+ whereNotIn: record(string(), array(unknown())).optional()
13587
+ });
13588
+ /**
13589
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
13590
+ *
13591
+ * `as` names the slot in the result, so the SAME column may be asked twice with
13592
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
13593
+ * a `Record<column, op>` shape could not express.
13594
+ */
13595
+ var AggregateFieldSchema = object({
13596
+ /** Result key. */
13597
+ as: string().min(1),
13598
+ /** Column to aggregate. Must be a real column of a declared collection. */
13599
+ field: string().min(1),
13600
+ op: _enum([
13601
+ "sum",
13602
+ "min",
13603
+ "max"
13604
+ ])
13605
+ });
13606
+ /**
13607
+ * `COUNT(*)` plus one number per requested field.
13608
+ *
13609
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
13610
+ * that really is 0 are different facts, and an accounting caller that renders
13611
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
13612
+ */
13613
+ var AggregateResultSchema = object({
13614
+ count: number().int(),
13615
+ values: record(string(), number().nullable())
13616
+ });
13617
+ /** A single stored record: `{ id, data }`. */
13618
+ var SettingsRecordSchema = object({
13619
+ id: string(),
13620
+ data: record(string(), unknown())
13621
+ });
13622
+ /**
13623
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
13624
+ * optional.
13625
+ *
13626
+ * A separate schema rather than loosening the shared one: every other method
13627
+ * on this cap addresses a row BY its id, and making that field optional
13628
+ * everywhere would turn a forgotten key into a silently generated one on
13629
+ * `update` and `delete` as well.
13630
+ */
13631
+ var BulkRecordSchema = object({
13632
+ id: string().optional(),
13633
+ data: record(string(), unknown())
13634
+ });
13635
+ /**
13636
+ * The database FILES one `sqlite-settings` engine process owns (D851).
13637
+ * Closed on purpose: a file is a thing the engine opens, backs up and gives a
13638
+ * serving thread, so a new one is a code change, never a string a caller
13639
+ * invents. `settings` is `camstack.db` and the default for every collection
13640
+ * that names no file.
13641
+ */
13642
+ var DataStoreDatabaseSchema = _enum([
13643
+ "settings",
13644
+ "events",
13645
+ "history"
13646
+ ]);
13647
+ DataStoreDatabaseSchema.options;
13648
+ /**
13649
+ * One write inside a {@link settingsStoreCapability.methods.transact} call.
13650
+ * The three that a "replace this set, bump that revision" write needs, plus
13651
+ * the batched upsert a rollup writer needs.
13652
+ */
13653
+ var TransactOpSchema = discriminatedUnion("op", [
13654
+ object({
13655
+ op: literal("deleteWhere"),
13656
+ collection: string(),
13657
+ filter: MutationFilterSchema
13658
+ }),
13659
+ object({
13660
+ op: literal("insertMany"),
13661
+ collection: string(),
13662
+ records: array(BulkRecordSchema).readonly()
13663
+ }),
13664
+ object({
13665
+ op: literal("update"),
13666
+ collection: string(),
13667
+ id: string(),
13668
+ data: record(string(), unknown())
13669
+ }),
13670
+ object({
13671
+ op: literal("upsertMany"),
13672
+ collection: string(),
13673
+ conflict: array(string()).readonly(),
13674
+ records: array(BulkRecordSchema).readonly()
13675
+ })
13676
+ ]);
13677
+ /**
13678
+ * The precondition of a transaction: the row `key` of `collection` must hold
13679
+ * `equals` in `column`, read INSIDE the transaction.
13680
+ */
13681
+ var TransactGuardSchema = object({
13682
+ collection: string(),
13683
+ key: string(),
13684
+ column: string(),
13685
+ equals: unknown()
13686
+ });
13687
+ /**
13688
+ * Column declaration for a structured (SQL-backed) collection.
13689
+ *
13690
+ * Logical types — the backend translates each to the matching SQLite
13691
+ * storage class and handles per-type marshaling:
13692
+ * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
13693
+ * - `JSON` — TEXT under the hood; serialised on write, parsed on read
13694
+ * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
13695
+ */
13696
+ var CollectionColumnSchema = object({
13697
+ name: string(),
13698
+ type: _enum([
13699
+ "TEXT",
13700
+ "INTEGER",
13701
+ "REAL",
13702
+ "JSON",
13703
+ "BOOLEAN"
13704
+ ]),
13705
+ primaryKey: boolean().optional(),
13706
+ notNull: boolean().optional(),
13707
+ unique: boolean().optional(),
13708
+ /**
13709
+ * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
13710
+ * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
13711
+ * collection surface simply cannot express their existing tables — which is
13712
+ * why they were still on the uncapped `table*` API.
13713
+ */
13714
+ defaultValue: union([
13715
+ string(),
13716
+ number(),
13717
+ boolean()
13718
+ ]).optional()
13719
+ });
13720
+ var CollectionIndexSchema = object({
13721
+ name: string(),
13722
+ columns: array(string()).readonly(),
13723
+ unique: boolean().optional()
13724
+ });
13725
+ /**
13726
+ * The input of `declareCollection` — ONE schema for the door and for the
13727
+ * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
13728
+ * the payload untouched).
13729
+ *
13730
+ * - `database` — the file the collection lives in (D851). Absent means
13731
+ * `settings`. A declaration naming a file other than the one the table is
13732
+ * already in is REFUSED by the engine, never moved.
13733
+ * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
13734
+ * as `primaryKey: true` on that column. A composite-keyed collection has no
13735
+ * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
13736
+ * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
13737
+ * address one row by id are refused.
13738
+ * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
13739
+ */
13740
+ var DeclareCollectionInputSchema = object({
13741
+ namespace: string().optional(),
13742
+ collection: string(),
13743
+ columns: array(CollectionColumnSchema).readonly(),
13744
+ indexes: array(CollectionIndexSchema).readonly().optional(),
13745
+ database: DataStoreDatabaseSchema.optional(),
13746
+ primaryKey: array(string()).readonly().optional(),
13747
+ withoutRowid: boolean().optional()
13748
+ });
13749
+ method(object({
13750
+ namespace: string().optional(),
13751
+ collection: string(),
13752
+ key: string()
13753
+ }), unknown(), { auth: "admin" }), method(object({
13754
+ namespace: string().optional(),
13755
+ collection: string(),
13756
+ key: string(),
13757
+ value: unknown()
13758
+ }), _void(), {
13759
+ kind: "mutation",
13760
+ auth: "admin"
13761
+ }), method(object({
13762
+ namespace: string().optional(),
13763
+ collection: string(),
13764
+ filter: QueryFilterSchema.optional(),
13765
+ columns: array(string()).readonly().optional()
13766
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
13767
+ namespace: string().optional(),
13768
+ collection: string(),
13769
+ /** Declared columns identifying the slot; must be covered by a UNIQUE
13770
+ * index on the collection. Never empty. */
13771
+ conflict: array(string()).readonly(),
13772
+ record: BulkRecordSchema
13773
+ }), object({
13774
+ /** The id the row HAS: assigned by SQLite on an insert, or the existing
13775
+ * row's own id on an update. */
13776
+ id: union([string(), number()]) }), {
13777
+ kind: "mutation",
13778
+ auth: "admin"
13779
+ }), method(object({
13780
+ namespace: string().optional(),
13781
+ collection: string(),
13782
+ conflict: array(string()).readonly(),
13783
+ records: array(BulkRecordSchema).readonly()
13784
+ }), object({ upserted: number().int() }), {
13785
+ kind: "mutation",
13786
+ auth: "admin"
13787
+ }), method(object({
13788
+ namespace: string().optional(),
13789
+ collection: string(),
13790
+ record: object({
13791
+ id: string().optional(),
13792
+ data: record(string(), unknown())
13793
+ })
13794
+ }), object({
13795
+ /**
13796
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13797
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13798
+ * primary key — which is the only place an auto key is knowable.
13799
+ */
13800
+ id: union([string(), number()]) }), {
13801
+ kind: "mutation",
13802
+ auth: "admin"
13803
+ }), method(object({
13804
+ namespace: string().optional(),
13805
+ collection: string(),
13806
+ records: array(BulkRecordSchema).readonly()
13807
+ }), object({ inserted: number().int() }), {
13808
+ kind: "mutation",
13809
+ auth: "admin"
13810
+ }), method(object({
13811
+ namespace: string().optional(),
13812
+ guard: TransactGuardSchema.optional(),
13813
+ ops: array(TransactOpSchema).readonly()
13814
+ }), object({
13815
+ applied: boolean(),
13816
+ current: unknown().optional()
13817
+ }), {
13818
+ kind: "mutation",
13819
+ auth: "admin"
13820
+ }), method(object({
13821
+ namespace: string().optional(),
13822
+ collection: string(),
13823
+ id: string(),
13824
+ data: record(string(), unknown())
13825
+ }), _void(), {
13826
+ kind: "mutation",
13827
+ auth: "admin"
13828
+ }), method(object({
13829
+ namespace: string().optional(),
13830
+ collection: string(),
13831
+ key: string()
13832
+ }), _void(), {
13833
+ kind: "mutation",
13834
+ auth: "admin"
13835
+ }), method(object({
13836
+ namespace: string().optional(),
13837
+ collection: string(),
13838
+ filter: MutationFilterSchema
13839
+ }), object({ deleted: number().int() }), {
13840
+ kind: "mutation",
13841
+ auth: "admin"
13842
+ }), method(object({
13843
+ namespace: string().optional(),
13844
+ collection: string(),
13845
+ filter: MutationFilterSchema,
13846
+ data: record(string(), unknown())
13847
+ }), object({ updated: number().int() }), {
13848
+ kind: "mutation",
13849
+ auth: "admin"
13850
+ }), method(object({
13851
+ namespace: string().optional(),
13852
+ collection: string(),
13853
+ filter: QueryFilterSchema.optional()
13854
+ }), number(), { auth: "admin" }), method(object({
13855
+ namespace: string().optional(),
13856
+ collection: string(),
13857
+ fields: array(AggregateFieldSchema).readonly(),
13858
+ filter: QueryFilterSchema.optional()
13859
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
13860
+ namespace: string().optional(),
13861
+ collection: string(),
13862
+ field: string(),
13863
+ bucketSize: number().int().positive(),
13864
+ origin: number().int(),
13865
+ filter: QueryFilterSchema.optional()
13866
+ }), array(object({
13867
+ bucket: number().int(),
13868
+ count: number().int()
13869
+ })).readonly(), { auth: "admin" }), method(object({
13870
+ namespace: string().optional(),
13871
+ collection: string()
13872
+ }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
13873
+ kind: "mutation",
13874
+ auth: "admin"
13875
+ });
13876
+ 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>\"");
13877
+ var MigrationLevelSchema = _enum([
13878
+ "hub-store",
13879
+ "addon-state",
13880
+ "node-config",
13881
+ "viewer",
13882
+ "addon-internal"
13883
+ ]);
13884
+ var MigrationStoreSchema = _enum([
13885
+ "settings",
13886
+ "events",
13887
+ "history",
13888
+ "node-local",
13889
+ "addon-files"
13890
+ ]);
13891
+ var MigrationScopeSchema = _enum(["cluster", "per-node"]);
13892
+ /** What depends on a migration while it is pending: `block-owner` is the default. */
13893
+ var MigrationOnFailureSchema = _enum(["block-owner", "tolerate"]);
13894
+ /**
13895
+ * `sql` is a hub-only body over the owner's connection. `plan` returns edits the
13896
+ * engine applies inside the migration's own transaction (hub-owned: computed in
13897
+ * that transaction; addon-owned: computed by the owner and shipped to the engine).
13898
+ * `procedure` is addon-owned work that is not SQL (keychain, integration registry,
13899
+ * device tombstones); the ledger records its outcome and it must be idempotent.
13900
+ */
13901
+ var MigrationBodyKindSchema = _enum([
13902
+ "sql",
13903
+ "plan",
13904
+ "procedure"
13905
+ ]);
13906
+ var MigrationMetaSchema = object({
13907
+ id: MigrationIdSchema,
13908
+ /** `hub`, an addon id, `node` or `viewer`. */
13909
+ owner: string().regex(/^[a-z0-9-]+$/),
13910
+ level: MigrationLevelSchema,
13911
+ /** Strictly increasing per owner: the order within an owner. */
13912
+ seq: number().int().positive(),
13913
+ /** Ids of any owner: the order across owners. */
13914
+ dependsOn: array(MigrationIdSchema),
13915
+ store: MigrationStoreSchema,
13916
+ scope: MigrationScopeSchema,
13917
+ onFailure: MigrationOnFailureSchema,
13918
+ bodyKind: MigrationBodyKindSchema,
13919
+ description: string().min(1),
13920
+ /** The marked field the migration's spec must assert survived. */
13921
+ fixtureMark: string().min(1)
13922
+ }).refine((m) => m.id.startsWith(`${m.owner}/`), {
13923
+ message: "the id must start with \"<owner>/\"",
13924
+ path: ["id"]
13925
+ });
13926
+ /** A cycle in the dependency graph, named by the ids on it. */
13927
+ var MigrationCycleError = class extends Error {
13928
+ ids;
13929
+ constructor(ids) {
13930
+ super(`migration dependsOn cycle: ${ids.join(" -> ")}`);
13931
+ this.ids = ids;
13932
+ this.name = "MigrationCycleError";
13933
+ }
13934
+ };
13935
+ /**
13936
+ * Topological order over `dependsOn` plus the implicit edge "a lower `seq` of an
13937
+ * owner runs first". Ties are broken by `(owner, seq)`. Throws
13938
+ * {@link MigrationCycleError} on a cycle. A `dependsOn` id that is not in the list
13939
+ * is ignored here — the catalogue schema is what refuses it.
13940
+ */
13941
+ function orderMigrations(items) {
13942
+ const byId = new Map(items.map((item) => [item.id, item]));
13943
+ const deps = /* @__PURE__ */ new Map();
13944
+ const ownerSorted = /* @__PURE__ */ new Map();
13945
+ for (const item of items) {
13946
+ const list = ownerSorted.get(item.owner) ?? [];
13947
+ list.push(item);
13948
+ ownerSorted.set(item.owner, list);
13949
+ }
13950
+ for (const item of items) deps.set(item.id, new Set(item.dependsOn.filter((id) => byId.has(id))));
13951
+ for (const list of ownerSorted.values()) {
13952
+ list.sort((a, b) => a.seq - b.seq);
13953
+ for (let i = 1; i < list.length; i++) {
13954
+ const previous = list[i - 1];
13955
+ const current = list[i];
13956
+ if (previous !== void 0 && current !== void 0) deps.get(current.id)?.add(previous.id);
13957
+ }
13958
+ }
13959
+ const tie = (a, b) => a.owner < b.owner ? -1 : a.owner > b.owner ? 1 : a.seq - b.seq;
13960
+ const done = /* @__PURE__ */ new Set();
13961
+ const ordered = [];
13962
+ let remaining = [...items];
13963
+ while (remaining.length > 0) {
13964
+ const ready = remaining.filter((item) => [...deps.get(item.id) ?? []].every((dep) => done.has(dep)));
13965
+ if (ready.length === 0) throw new MigrationCycleError(remaining.map((item) => item.id).sort());
13966
+ ready.sort(tie);
13967
+ const next = ready[0];
13968
+ if (next === void 0) break;
13969
+ ordered.push(next);
13970
+ done.add(next.id);
13971
+ remaining = remaining.filter((item) => item.id !== next.id);
13972
+ }
13973
+ return ordered;
13974
+ }
13975
+ /** Every way a list of migrations (in declaration order) is not a catalogue. */
13976
+ function catalogueIssues(items) {
13977
+ const issues = [];
13978
+ const seen = /* @__PURE__ */ new Set();
13979
+ const known = new Set(items.map((item) => item.id));
13980
+ const lastSeq = /* @__PURE__ */ new Map();
13981
+ const seqUsed = /* @__PURE__ */ new Map();
13982
+ for (const item of items) {
13983
+ if (seen.has(item.id)) issues.push({
13984
+ code: "duplicate-id",
13985
+ ids: [item.id],
13986
+ message: `duplicate id ${item.id}`
13987
+ });
13988
+ seen.add(item.id);
13989
+ const used = seqUsed.get(item.owner) ?? /* @__PURE__ */ new Set();
13990
+ if (used.has(item.seq)) issues.push({
13991
+ code: "duplicate-seq",
13992
+ ids: [item.id],
13993
+ message: `owner ${item.owner} has two migrations with seq ${item.seq}`
13994
+ });
13995
+ else if (item.seq < (lastSeq.get(item.owner) ?? 0)) issues.push({
13996
+ code: "seq-order",
13997
+ ids: [item.id],
13998
+ message: `seq ${item.seq} of ${item.id} does not increase in declaration order (owner ${item.owner})`
13999
+ });
14000
+ used.add(item.seq);
14001
+ seqUsed.set(item.owner, used);
14002
+ lastSeq.set(item.owner, Math.max(item.seq, lastSeq.get(item.owner) ?? 0));
14003
+ for (const dep of item.dependsOn) if (!known.has(dep)) issues.push({
14004
+ code: "unknown-dependency",
14005
+ ids: [item.id, dep],
14006
+ message: `${item.id} dependsOn unknown id ${dep}`
14007
+ });
14008
+ }
14009
+ try {
14010
+ orderMigrations(items);
14011
+ } catch (err) {
14012
+ if (err instanceof MigrationCycleError) issues.push({
14013
+ code: "cycle",
14014
+ ids: err.ids,
14015
+ message: err.message
14016
+ });
14017
+ else throw err;
14018
+ }
14019
+ return issues;
14020
+ }
14021
+ array(MigrationMetaSchema).superRefine((items, ctx) => {
14022
+ for (const issue of catalogueIssues(items)) ctx.addIssue({
14023
+ code: "custom",
14024
+ message: `${issue.code}: ${issue.message}`
14025
+ });
14026
+ });
14027
+ /**
14028
+ * The canonical JSON (`preconditionOf`) of the value a plan read; the apply step
14029
+ * re-reads, and a plan whose read no longer matches is refused (the migration is
14030
+ * `failed`, nothing it edited is kept).
14031
+ */
14032
+ var PreconditionSchema = string().min(1).optional();
14033
+ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
14034
+ object({
14035
+ op: literal("setKeys"),
14036
+ scope: string().min(1),
14037
+ values: record(string(), unknown()),
14038
+ precondition: PreconditionSchema
14039
+ }),
14040
+ object({
14041
+ op: literal("deleteKeys"),
14042
+ scope: string().min(1),
14043
+ keys: array(string().min(1)).min(1),
14044
+ precondition: PreconditionSchema
14045
+ }),
14046
+ object({
14047
+ op: literal("putRow"),
14048
+ table: string().min(1),
14049
+ key: record(string(), unknown()),
14050
+ row: record(string(), unknown()),
14051
+ precondition: PreconditionSchema
14052
+ }),
14053
+ object({
14054
+ op: literal("deleteRow"),
14055
+ table: string().min(1),
14056
+ key: record(string(), unknown()),
14057
+ precondition: PreconditionSchema
14058
+ }),
14059
+ object({
14060
+ op: literal("upsertRecord"),
14061
+ kind: string().min(1),
14062
+ recordKey: string().min(1),
14063
+ value: unknown(),
14064
+ precondition: PreconditionSchema
14065
+ }),
14066
+ object({
14067
+ op: literal("deleteRecord"),
14068
+ kind: string().min(1),
14069
+ recordKey: string().min(1),
14070
+ precondition: PreconditionSchema
14071
+ })
14072
+ ])) });
14073
+ /**
14074
+ * What a `procedure` body reports. `already-done` means the rerun observed the
14075
+ * work finished (a crash between the work and the ledger row, or a manual fix)
14076
+ * and did none of it again; the ledger records `applied` either way.
14077
+ */
14078
+ var MigrationProcedureResultSchema = object({
14079
+ outcome: _enum(["done", "already-done"]),
14080
+ summary: record(string(), unknown())
14081
+ });
14082
+ /** What an owner hands the engine when one of its migrations ran. */
14083
+ var MigrationOwnerResultSchema = discriminatedUnion("kind", [
14084
+ object({
14085
+ kind: literal("plan"),
14086
+ plan: MigrationPlanSchema
14087
+ }),
14088
+ object({
14089
+ kind: literal("procedure"),
14090
+ result: MigrationProcedureResultSchema
14091
+ }),
14092
+ object({
14093
+ kind: literal("failed"),
14094
+ error: string().min(1)
14095
+ })
14096
+ ]);
14097
+ /**
14098
+ * `held`: a restore of a pre-migration snapshot undid this id; it does not rerun
14099
+ * until the operator retries or a new code version ships.
14100
+ * `skipped-newer`: the database knows an id this code does not.
14101
+ */
14102
+ var MigrationStatusSchema = _enum([
14103
+ "applied",
14104
+ "failed",
14105
+ "blocked",
14106
+ "running",
14107
+ "held",
14108
+ "skipped-newer"
14109
+ ]);
14110
+ var MigrationLedgerEntrySchema = object({
14111
+ id: string(),
14112
+ database: DataStoreDatabaseSchema,
14113
+ owner: string(),
14114
+ level: MigrationLevelSchema,
14115
+ seq: number().int().nonnegative(),
14116
+ status: MigrationStatusSchema,
14117
+ attempts: number().int().nonnegative(),
14118
+ appliedAt: number().nullable(),
14119
+ codeVersion: string().nullable(),
14120
+ /** What the apply changed: rows per table, as the engine counted them. */
14121
+ planSummary: record(string(), unknown()).nullable(),
14122
+ progress: record(string(), unknown()).nullable(),
14123
+ error: string().nullable(),
14124
+ /** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
14125
+ reason: string().nullable(),
14126
+ nodeId: string().nullable(),
14127
+ bootId: string().nullable()
14128
+ });
14129
+ /** A catalogued migration that is not applied, with where it stands. */
14130
+ var MigrationPendingEntrySchema = object({
14131
+ meta: MigrationMetaSchema,
14132
+ database: DataStoreDatabaseSchema,
14133
+ state: _enum([
14134
+ "pending",
14135
+ "failed",
14136
+ "blocked",
14137
+ "held"
14138
+ ]),
14139
+ reason: string().nullable()
14140
+ });
14141
+ /** Rows per table before and after a dry run, and what it would have changed. */
14142
+ var MigrationDryRunResultSchema = object({
14143
+ id: string(),
14144
+ ok: boolean(),
14145
+ error: string().nullable(),
14146
+ rowsChanged: number().int().nonnegative(),
14147
+ tables: array(object({
14148
+ table: string(),
14149
+ before: number().int().nonnegative(),
14150
+ after: number().int().nonnegative()
14151
+ }))
14152
+ });
14153
+ /** One of an owner's migrations, as the engine tells the owner to treat it this boot. */
14154
+ var MigrationOwnerStepSchema = object({
14155
+ id: MigrationIdSchema,
14156
+ action: _enum(["run", "skip"]),
14157
+ /** The ledger state the engine found: `pending` has no row yet. */
14158
+ state: union([literal("pending"), MigrationStatusSchema])
14159
+ });
14160
+ /**
13319
14161
  * The trainer contract — what the hub hands the cloud trainer and what it
13320
14162
  * gets back (cloud training, D805+).
13321
14163
  *
@@ -16718,6 +17560,41 @@ var ACTUATOR_CAP_VOCABULARY = {
16718
17560
  icon: "droplets"
16719
17561
  }]
16720
17562
  },
17563
+ "power-source": {
17564
+ scope: "device",
17565
+ noun: t("Power source", "Alimentazione"),
17566
+ actions: [
17567
+ {
17568
+ id: "powerSource.on",
17569
+ method: "powerOn",
17570
+ label: t("Power on", "Dai corrente"),
17571
+ phrase: t("Power on {device}", "Dai corrente a {device}"),
17572
+ icon: "power"
17573
+ },
17574
+ {
17575
+ id: "powerSource.off",
17576
+ method: "powerOff",
17577
+ label: t("Power off", "Togli corrente"),
17578
+ phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
17579
+ icon: "power-off"
17580
+ },
17581
+ {
17582
+ id: "powerSource.forceRestart",
17583
+ method: "forceRestart",
17584
+ label: t("Force restart", "Riavvio forzato"),
17585
+ phrase: t("Force restart {device} by cutting its power", "Riavvia {device} togliendo la corrente"),
17586
+ icon: "refresh-cw"
17587
+ }
17588
+ ],
17589
+ state: [{
17590
+ kind: "boolean",
17591
+ field: "switchOn",
17592
+ label: t("Power switch on", "Presa accesa"),
17593
+ whenTrue: t("When the power of {device} comes on", "Quando arriva la corrente a {device}"),
17594
+ whenFalse: t("When the power of {device} is cut", "Quando manca la corrente a {device}"),
17595
+ icon: "power"
17596
+ }]
17597
+ },
16721
17598
  "lock-control": {
16722
17599
  scope: "device",
16723
17600
  noun: t("Lock", "Serratura"),
@@ -17193,7 +18070,7 @@ var ACTUATOR_CAP_VOCABULARY = {
17193
18070
  method: "setDirection",
17194
18071
  label: t("Spin forward", "Rotazione avanti"),
17195
18072
  phrase: t("Spin {device} forward", "Fai girare {device} in avanti"),
17196
- icon: "rotate-cw",
18073
+ icon: "refresh-cw",
17197
18074
  effect: {
17198
18075
  field: "direction",
17199
18076
  value: "forward"
@@ -20271,6 +21148,7 @@ var SYSTEM_CAP_VOCABULARY = {
20271
21148
  "login-method": system(IDENTITY),
20272
21149
  "mesh-network": system(NETWORK),
20273
21150
  "metrics-provider": system(CLUSTER),
21151
+ migrations: system(INTERNAL),
20274
21152
  "model-convert": system(ML),
20275
21153
  "model-distributor": system(ML),
20276
21154
  "mqtt-broker": system(NETWORK),
@@ -40473,7 +41351,8 @@ function normalizeUnit(raw) {
40473
41351
  if (lower === "dbm") return "dBm";
40474
41352
  if (lower === "dbfs") return "dBFS";
40475
41353
  if (lower === "inhg") return "inHg";
40476
- if (lower === "mm/h") return "mm/h";
41354
+ if (lower === "mm/h" || lower === "mm/hr") return "mm/h";
41355
+ if (lower === "in/h" || lower === "in/hr") return "in/h";
40477
41356
  if (lower === "w/m²" || lower === "w/m2") return "W/m²";
40478
41357
  if (lower === "°" || lower === "deg" || lower === "degree" || lower === "degrees") return "°";
40479
41358
  if (lower === "kbps") return "kbps";
@@ -42867,7 +43746,7 @@ function pruneDeletedEntities(selection, live, log, exporter) {
42867
43746
  * rebuilds without manual reload.
42868
43747
  *
42869
43748
  * The hub-local builtin `addon-pages-aggregator` (see
42870
- * `@camstack/system/builtins/addon-pages-aggregator`) registers the
43749
+ * `@camstack/server/system/builtins/addon-pages-aggregator`) registers the
42871
43750
  * provider. Splitting the public aggregator from the raw collection
42872
43751
  * keeps both ends in codegen — there's no hand-written
42873
43752
  * `addon-pages.router.ts` wrapper anymore.
@@ -42957,7 +43836,7 @@ var addonRoutesCapability = {
42957
43836
  */
42958
43837
  invoke: method(InvokeRequestSchema, InvokeReplyEnvelopeSchema, { kind: "mutation" })
42959
43838
  },
42960
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
43839
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
42961
43840
  mount: { kind: "skip" }
42962
43841
  };
42963
43842
  var ConfigTabDeclarationSchema = object({
@@ -43012,6 +43891,10 @@ method(object({
43012
43891
  }), method(object({
43013
43892
  addonId: string(),
43014
43893
  nodeId: string().optional()
43894
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
43895
+ addonId: string(),
43896
+ nodeId: string().optional(),
43897
+ instance: IntegrationInstanceRefSchema
43015
43898
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
43016
43899
  addonId: string(),
43017
43900
  nodeId: string().optional()
@@ -43182,7 +44065,7 @@ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
43182
44065
  * manual reload — same scheme used by `addon-pages`.
43183
44066
  *
43184
44067
  * The hub-local builtin `addon-widgets-aggregator` (see
43185
- * `@camstack/system/builtins/addon-widgets-aggregator`) registers the
44068
+ * `@camstack/server/system/builtins/addon-widgets-aggregator`) registers the
43186
44069
  * provider. Splitting the public aggregator from the raw collection
43187
44070
  * keeps both ends in codegen — there's no hand-written wrapper.
43188
44071
  */
@@ -43543,329 +44426,6 @@ method(object({
43543
44426
  password: string()
43544
44427
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
43545
44428
  /**
43546
- * Query filter for settings-store collections.
43547
- */
43548
- var QueryFilterSchema = object({
43549
- where: record(string(), unknown()).optional(),
43550
- whereIn: record(string(), array(unknown())).optional(),
43551
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
43552
- /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
43553
- whereNot: record(string(), unknown()).optional(),
43554
- /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
43555
- * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
43556
- whereNotIn: record(string(), array(unknown())).optional(),
43557
- orderBy: object({
43558
- field: string(),
43559
- direction: _enum(["asc", "desc"])
43560
- }).optional(),
43561
- limit: number().optional(),
43562
- offset: number().optional()
43563
- });
43564
- /**
43565
- * The predicate half of a filter, for BULK MUTATIONS.
43566
- *
43567
- * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
43568
- * meaning for a statement that rewrites a set, and accepting them would invite
43569
- * a caller to believe `limit` bounds the damage. Every field is optional here
43570
- * only so the shape stays composable — the implementation REJECTS a filter
43571
- * that compiles to no predicate, because that is the whole collection.
43572
- */
43573
- var MutationFilterSchema = object({
43574
- where: record(string(), unknown()).optional(),
43575
- whereIn: record(string(), array(unknown())).optional(),
43576
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
43577
- whereNot: record(string(), unknown()).optional(),
43578
- whereNotIn: record(string(), array(unknown())).optional()
43579
- });
43580
- /**
43581
- * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
43582
- *
43583
- * `as` names the slot in the result, so the SAME column may be asked twice with
43584
- * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
43585
- * a `Record<column, op>` shape could not express.
43586
- */
43587
- var AggregateFieldSchema = object({
43588
- /** Result key. */
43589
- as: string().min(1),
43590
- /** Column to aggregate. Must be a real column of a declared collection. */
43591
- field: string().min(1),
43592
- op: _enum([
43593
- "sum",
43594
- "min",
43595
- "max"
43596
- ])
43597
- });
43598
- /**
43599
- * `COUNT(*)` plus one number per requested field.
43600
- *
43601
- * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
43602
- * that really is 0 are different facts, and an accounting caller that renders
43603
- * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
43604
- */
43605
- var AggregateResultSchema = object({
43606
- count: number().int(),
43607
- values: record(string(), number().nullable())
43608
- });
43609
- /** A single stored record: `{ id, data }`. */
43610
- var SettingsRecordSchema = object({
43611
- id: string(),
43612
- data: record(string(), unknown())
43613
- });
43614
- /**
43615
- * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
43616
- * optional.
43617
- *
43618
- * A separate schema rather than loosening the shared one: every other method
43619
- * on this cap addresses a row BY its id, and making that field optional
43620
- * everywhere would turn a forgotten key into a silently generated one on
43621
- * `update` and `delete` as well.
43622
- */
43623
- var BulkRecordSchema = object({
43624
- id: string().optional(),
43625
- data: record(string(), unknown())
43626
- });
43627
- /**
43628
- * The database FILES one `sqlite-settings` engine process owns (D851).
43629
- * Closed on purpose: a file is a thing the engine opens, backs up and gives a
43630
- * serving thread, so a new one is a code change, never a string a caller
43631
- * invents. `settings` is `camstack.db` and the default for every collection
43632
- * that names no file.
43633
- */
43634
- var DataStoreDatabaseSchema = _enum([
43635
- "settings",
43636
- "events",
43637
- "history"
43638
- ]);
43639
- DataStoreDatabaseSchema.options;
43640
- /**
43641
- * One write inside a {@link settingsStoreCapability.methods.transact} call.
43642
- * The three that a "replace this set, bump that revision" write needs, plus
43643
- * the batched upsert a rollup writer needs.
43644
- */
43645
- var TransactOpSchema = discriminatedUnion("op", [
43646
- object({
43647
- op: literal("deleteWhere"),
43648
- collection: string(),
43649
- filter: MutationFilterSchema
43650
- }),
43651
- object({
43652
- op: literal("insertMany"),
43653
- collection: string(),
43654
- records: array(BulkRecordSchema).readonly()
43655
- }),
43656
- object({
43657
- op: literal("update"),
43658
- collection: string(),
43659
- id: string(),
43660
- data: record(string(), unknown())
43661
- }),
43662
- object({
43663
- op: literal("upsertMany"),
43664
- collection: string(),
43665
- conflict: array(string()).readonly(),
43666
- records: array(BulkRecordSchema).readonly()
43667
- })
43668
- ]);
43669
- /**
43670
- * The precondition of a transaction: the row `key` of `collection` must hold
43671
- * `equals` in `column`, read INSIDE the transaction.
43672
- */
43673
- var TransactGuardSchema = object({
43674
- collection: string(),
43675
- key: string(),
43676
- column: string(),
43677
- equals: unknown()
43678
- });
43679
- /**
43680
- * Column declaration for a structured (SQL-backed) collection.
43681
- *
43682
- * Logical types — the backend translates each to the matching SQLite
43683
- * storage class and handles per-type marshaling:
43684
- * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
43685
- * - `JSON` — TEXT under the hood; serialised on write, parsed on read
43686
- * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
43687
- */
43688
- var CollectionColumnSchema = object({
43689
- name: string(),
43690
- type: _enum([
43691
- "TEXT",
43692
- "INTEGER",
43693
- "REAL",
43694
- "JSON",
43695
- "BOOLEAN"
43696
- ]),
43697
- primaryKey: boolean().optional(),
43698
- notNull: boolean().optional(),
43699
- unique: boolean().optional(),
43700
- /**
43701
- * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
43702
- * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
43703
- * collection surface simply cannot express their existing tables — which is
43704
- * why they were still on the uncapped `table*` API.
43705
- */
43706
- defaultValue: union([
43707
- string(),
43708
- number(),
43709
- boolean()
43710
- ]).optional()
43711
- });
43712
- var CollectionIndexSchema = object({
43713
- name: string(),
43714
- columns: array(string()).readonly(),
43715
- unique: boolean().optional()
43716
- });
43717
- /**
43718
- * The input of `declareCollection` — ONE schema for the door and for the
43719
- * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
43720
- * the payload untouched).
43721
- *
43722
- * - `database` — the file the collection lives in (D851). Absent means
43723
- * `settings`. A declaration naming a file other than the one the table is
43724
- * already in is REFUSED by the engine, never moved.
43725
- * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
43726
- * as `primaryKey: true` on that column. A composite-keyed collection has no
43727
- * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
43728
- * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
43729
- * address one row by id are refused.
43730
- * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
43731
- */
43732
- var DeclareCollectionInputSchema = object({
43733
- namespace: string().optional(),
43734
- collection: string(),
43735
- columns: array(CollectionColumnSchema).readonly(),
43736
- indexes: array(CollectionIndexSchema).readonly().optional(),
43737
- database: DataStoreDatabaseSchema.optional(),
43738
- primaryKey: array(string()).readonly().optional(),
43739
- withoutRowid: boolean().optional()
43740
- });
43741
- method(object({
43742
- namespace: string().optional(),
43743
- collection: string(),
43744
- key: string()
43745
- }), unknown(), { auth: "admin" }), method(object({
43746
- namespace: string().optional(),
43747
- collection: string(),
43748
- key: string(),
43749
- value: unknown()
43750
- }), _void(), {
43751
- kind: "mutation",
43752
- auth: "admin"
43753
- }), method(object({
43754
- namespace: string().optional(),
43755
- collection: string(),
43756
- filter: QueryFilterSchema.optional(),
43757
- columns: array(string()).readonly().optional()
43758
- }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
43759
- namespace: string().optional(),
43760
- collection: string(),
43761
- /** Declared columns identifying the slot; must be covered by a UNIQUE
43762
- * index on the collection. Never empty. */
43763
- conflict: array(string()).readonly(),
43764
- record: BulkRecordSchema
43765
- }), object({
43766
- /** The id the row HAS: assigned by SQLite on an insert, or the existing
43767
- * row's own id on an update. */
43768
- id: union([string(), number()]) }), {
43769
- kind: "mutation",
43770
- auth: "admin"
43771
- }), method(object({
43772
- namespace: string().optional(),
43773
- collection: string(),
43774
- conflict: array(string()).readonly(),
43775
- records: array(BulkRecordSchema).readonly()
43776
- }), object({ upserted: number().int() }), {
43777
- kind: "mutation",
43778
- auth: "admin"
43779
- }), method(object({
43780
- namespace: string().optional(),
43781
- collection: string(),
43782
- record: object({
43783
- id: string().optional(),
43784
- data: record(string(), unknown())
43785
- })
43786
- }), object({
43787
- /**
43788
- * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
43789
- * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
43790
- * primary key — which is the only place an auto key is knowable.
43791
- */
43792
- id: union([string(), number()]) }), {
43793
- kind: "mutation",
43794
- auth: "admin"
43795
- }), method(object({
43796
- namespace: string().optional(),
43797
- collection: string(),
43798
- records: array(BulkRecordSchema).readonly()
43799
- }), object({ inserted: number().int() }), {
43800
- kind: "mutation",
43801
- auth: "admin"
43802
- }), method(object({
43803
- namespace: string().optional(),
43804
- guard: TransactGuardSchema.optional(),
43805
- ops: array(TransactOpSchema).readonly()
43806
- }), object({
43807
- applied: boolean(),
43808
- current: unknown().optional()
43809
- }), {
43810
- kind: "mutation",
43811
- auth: "admin"
43812
- }), method(object({
43813
- namespace: string().optional(),
43814
- collection: string(),
43815
- id: string(),
43816
- data: record(string(), unknown())
43817
- }), _void(), {
43818
- kind: "mutation",
43819
- auth: "admin"
43820
- }), method(object({
43821
- namespace: string().optional(),
43822
- collection: string(),
43823
- key: string()
43824
- }), _void(), {
43825
- kind: "mutation",
43826
- auth: "admin"
43827
- }), method(object({
43828
- namespace: string().optional(),
43829
- collection: string(),
43830
- filter: MutationFilterSchema
43831
- }), object({ deleted: number().int() }), {
43832
- kind: "mutation",
43833
- auth: "admin"
43834
- }), method(object({
43835
- namespace: string().optional(),
43836
- collection: string(),
43837
- filter: MutationFilterSchema,
43838
- data: record(string(), unknown())
43839
- }), object({ updated: number().int() }), {
43840
- kind: "mutation",
43841
- auth: "admin"
43842
- }), method(object({
43843
- namespace: string().optional(),
43844
- collection: string(),
43845
- filter: QueryFilterSchema.optional()
43846
- }), number(), { auth: "admin" }), method(object({
43847
- namespace: string().optional(),
43848
- collection: string(),
43849
- fields: array(AggregateFieldSchema).readonly(),
43850
- filter: QueryFilterSchema.optional()
43851
- }), AggregateResultSchema, { auth: "admin" }), method(object({
43852
- namespace: string().optional(),
43853
- collection: string(),
43854
- field: string(),
43855
- bucketSize: number().int().positive(),
43856
- origin: number().int(),
43857
- filter: QueryFilterSchema.optional()
43858
- }), array(object({
43859
- bucket: number().int(),
43860
- count: number().int()
43861
- })).readonly(), { auth: "admin" }), method(object({
43862
- namespace: string().optional(),
43863
- collection: string()
43864
- }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
43865
- kind: "mutation",
43866
- auth: "admin"
43867
- });
43868
- /**
43869
44429
  * How long one snapshot may take end to end: the pinned copy of the whole
43870
44430
  * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
43871
44431
  * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
@@ -45828,7 +46388,7 @@ method(object({
45828
46388
  kind: "mutation",
45829
46389
  auth: "admin"
45830
46390
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
45831
- 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;
46391
+ 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;
45832
46392
  var NUMBER = {
45833
46393
  kind: "fixed",
45834
46394
  result: ["number"]
@@ -46839,6 +47399,57 @@ id: union([string(), number()]) }), {
46839
47399
  kind: "mutation",
46840
47400
  auth: "admin"
46841
47401
  });
47402
+ 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({
47403
+ id: string().min(1),
47404
+ error: string().min(1)
47405
+ }), MigrationLedgerEntrySchema, {
47406
+ kind: "mutation",
47407
+ auth: "admin"
47408
+ }), method(object({ id: string().min(1) }), object({ entries: array(MigrationLedgerEntrySchema) }), {
47409
+ kind: "mutation",
47410
+ auth: "admin"
47411
+ }), method(object({
47412
+ database: DataStoreDatabaseSchema,
47413
+ snapshotId: string().min(1)
47414
+ }), object({
47415
+ scheduled: boolean(),
47416
+ held: array(string()),
47417
+ restartRequired: boolean()
47418
+ }), {
47419
+ kind: "mutation",
47420
+ auth: "admin"
47421
+ }), method(object({
47422
+ owner: string().min(1),
47423
+ metas: array(MigrationMetaSchema)
47424
+ }), object({
47425
+ bootId: string(),
47426
+ snapshot: _enum([
47427
+ "none",
47428
+ "written",
47429
+ "refused"
47430
+ ]),
47431
+ steps: array(MigrationOwnerStepSchema)
47432
+ }), {
47433
+ kind: "mutation",
47434
+ auth: "admin"
47435
+ }), method(object({ id: string().min(1) }), object({
47436
+ proceed: boolean(),
47437
+ state: union([literal("pending"), MigrationStatusSchema]),
47438
+ reason: string().nullable()
47439
+ }), {
47440
+ kind: "mutation",
47441
+ auth: "admin"
47442
+ }), method(object({
47443
+ id: string().min(1),
47444
+ result: MigrationOwnerResultSchema
47445
+ }), object({
47446
+ status: MigrationStatusSchema,
47447
+ error: string().nullable(),
47448
+ rowsChanged: number().int().nonnegative()
47449
+ }), {
47450
+ kind: "mutation",
47451
+ auth: "admin"
47452
+ });
46842
47453
  /**
46843
47454
  * records - an addon's own facts and documents (D881): ledgers, audit rows,
46844
47455
  * config documents, mirrors. The third storage API next to `ctx.settings`
@@ -61782,7 +62393,18 @@ var ServerUpdateActionResultSchema = object({
61782
62393
  * store (D877), present when the pre-flight refused the update
61783
62394
  * (`reason: 'addon-would-refuse'`). Optional for version skew.
61784
62395
  */
61785
- blockers: array(UpdateBlockerSchema).optional()
62396
+ blockers: array(UpdateBlockerSchema).optional(),
62397
+ /**
62398
+ * The minimums the target server declares and this node does not meet
62399
+ * (D989), present when the update was refused with
62400
+ * `reason: 'requirements-unmet'`. Each names the versions on both sides.
62401
+ */
62402
+ unmet: array(UnmetRequirementSchema).optional(),
62403
+ /**
62404
+ * The addons this node has below the minimum the staged server declares —
62405
+ * the ones to update WITH the server. Present on an accepted update.
62406
+ */
62407
+ requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
61786
62408
  });
61787
62409
  var LaunchOverridesSchema = object({
61788
62410
  /** The persisted heap ceiling in MB, or `null` when none is set. */
@@ -64398,7 +65020,9 @@ var PackageUpdateSchema = object({
64398
65020
  latestVersion: string(),
64399
65021
  category: _enum(["addon", "core"]),
64400
65022
  requiresRestart: boolean(),
64401
- isSystem: boolean()
65023
+ isSystem: boolean(),
65024
+ /** Held: what the newer version needs and this node does not meet (D989). */
65025
+ blockedBy: array(UnmetRequirementSchema).readonly().optional()
64402
65026
  });
64403
65027
  var PackageVersionInfoSchema = object({
64404
65028
  version: string(),
@@ -65854,19 +66478,19 @@ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status:
65854
66478
  reason: _enum(["unknown-template", "not-a-media-player"]),
65855
66479
  detail: string()
65856
66480
  })]);
65857
- var deviceInput = object({ deviceId: number().int().nonnegative() });
66481
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
65858
66482
  DeviceType.MediaPlayer;
65859
- method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
66483
+ method(deviceInput$1, RemoteConfigSchema, { auth: "admin" }), method(deviceInput$1.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
65860
66484
  kind: "mutation",
65861
66485
  auth: "admin"
65862
- }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
66486
+ }), method(deviceInput$1, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput$1.extend({
65863
66487
  role: RemoteRoleSchema,
65864
66488
  /** Sends in a row (volume steps). */
65865
66489
  repeat: number().int().min(1).max(50).default(1)
65866
66490
  }), RemoteSendResultSchema, {
65867
66491
  kind: "mutation",
65868
66492
  auth: "protected"
65869
- }), method(deviceInput.extend({
66493
+ }), method(deviceInput$1.extend({
65870
66494
  command: RemoteMediaCommandSchema,
65871
66495
  muted: boolean().optional(),
65872
66496
  source: string().optional(),
@@ -69732,7 +70356,7 @@ var lawnMowerControlCapability = {
69732
70356
  * clients — they reverse-connect to the hub. Exposing their interfaces
69733
70357
  * via the same surface would leak internal topology with no upside.
69734
70358
  *
69735
- * Implementation in `@camstack/system/builtins/local-network/`.
70359
+ * Implementation in `@camstack/server/system/builtins/local-network/`.
69736
70360
  */
69737
70361
  /** Coarse classification derived from the interface name + IP range. */
69738
70362
  var InterfaceKindEnum = _enum([
@@ -70229,6 +70853,117 @@ var lockControlCapability = {
70229
70853
  * whether persisting is worth a SQLite commit. */
70230
70854
  volatileStateFields: ["lastChangedAt"]
70231
70855
  };
70856
+ var PowerSourceRefusalReasonSchema = _enum([
70857
+ "no-power-source",
70858
+ "switch-missing",
70859
+ "switch-offline",
70860
+ "switch-unknown",
70861
+ "restart-in-progress",
70862
+ "switch-call-failed"
70863
+ ]);
70864
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
70865
+ accepted: literal(false),
70866
+ reason: PowerSourceRefusalReasonSchema,
70867
+ /** One line for the operator, naming the switch. */
70868
+ message: string()
70869
+ })]);
70870
+ var PowerSourceInfoSchema = object({
70871
+ /** False when the device has no power source linked; the rest is then empty. */
70872
+ linked: boolean(),
70873
+ switchDeviceId: number().nullable(),
70874
+ switchName: string().nullable(),
70875
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
70876
+ switchOn: boolean().nullable(),
70877
+ switchOnline: boolean().nullable(),
70878
+ restartInProgress: boolean(),
70879
+ offSeconds: number().int()
70880
+ });
70881
+ /** The composed slice: the switch state the link mirrors, plus the stored off time. */
70882
+ var PowerSourceStateSchema = object({
70883
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
70884
+ switchOn: boolean().nullable(),
70885
+ offSeconds: number().int(),
70886
+ lastFetchedAt: number()
70887
+ });
70888
+ var POWER_SOURCE_DEVICE_TYPES = [
70889
+ DeviceType.Gateway,
70890
+ DeviceType.Hub,
70891
+ DeviceType.Camera,
70892
+ DeviceType.Sensor,
70893
+ DeviceType.MediaPlayer,
70894
+ DeviceType.Vacuum,
70895
+ DeviceType.Generic,
70896
+ DeviceType.Washer,
70897
+ DeviceType.Dryer,
70898
+ DeviceType.Dishwasher,
70899
+ DeviceType.PetFountain,
70900
+ DeviceType.Fan,
70901
+ DeviceType.Humidifier,
70902
+ DeviceType.Climate,
70903
+ DeviceType.WaterHeater
70904
+ ];
70905
+ var powerSourceCustomize = {
70906
+ version: 1,
70907
+ targets: [{
70908
+ id: "switch",
70909
+ cardinality: "scalar",
70910
+ vocabulary: {
70911
+ cap: "power-source",
70912
+ stateField: "switchOn"
70913
+ },
70914
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
70915
+ apply: "add",
70916
+ path: "switchOn",
70917
+ sources: [{
70918
+ kind: "switch",
70919
+ transforms: [{ kind: "identity" }]
70920
+ }],
70921
+ companions: [{
70922
+ kind: "constant",
70923
+ path: "offSeconds",
70924
+ value: 10,
70925
+ when: "add"
70926
+ }, {
70927
+ kind: "clock",
70928
+ path: "lastFetchedAt",
70929
+ when: "always"
70930
+ }],
70931
+ sourceReport: { status: "assignment-status" }
70932
+ }]
70933
+ };
70934
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
70935
+ var powerSourceCapability = {
70936
+ name: "power-source",
70937
+ scope: "device",
70938
+ mode: "singleton",
70939
+ deviceTypes: POWER_SOURCE_DEVICE_TYPES,
70940
+ methods: {
70941
+ getStatus: systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }),
70942
+ powerOn: systemMethod(deviceInput, PowerSourceActionResultSchema, {
70943
+ kind: "mutation",
70944
+ auth: "admin"
70945
+ }),
70946
+ powerOff: systemMethod(deviceInput, PowerSourceActionResultSchema, {
70947
+ kind: "mutation",
70948
+ auth: "admin"
70949
+ }),
70950
+ forceRestart: systemMethod(deviceInput, PowerSourceActionResultSchema, {
70951
+ kind: "mutation",
70952
+ auth: "admin"
70953
+ })
70954
+ },
70955
+ runtimeState: PowerSourceStateSchema,
70956
+ customize: powerSourceCustomize,
70957
+ /**
70958
+ * Runtime-state durability: **session** — mirrored from the linked switch on
70959
+ * its next report; a restored value would outlive the reading it names.
70960
+ *
70961
+ * See `RuntimeStateDurability`. Enforced by
70962
+ * `scripts/check-runtime-state-durability.ts`.
70963
+ */
70964
+ durability: "session",
70965
+ history: "none"
70966
+ };
70232
70967
  /**
70233
70968
  * A monotonic total between resets (D944). Energy uses `power-meter.energy`
70234
70969
  * so dashboards keep one series; every other instantaneous reading lands here.
@@ -71509,7 +72244,7 @@ onStatusChanged: { data: object({
71509
72244
  * jitter, and observed/peak bandwidth per device + per client.
71510
72245
  *
71511
72246
  * Implementation lives in the server's `NetworkQualityService` (thin
71512
- * wrapper over the shared `NetworkQualityTracker` from `@camstack/system`).
72247
+ * wrapper over the shared `NetworkQualityTracker` from `@camstack/server/system`).
71513
72248
  * The provider is registered from `trpc.router.ts` against the existing
71514
72249
  * service instance — no addon owns this state.
71515
72250
  *
@@ -73660,7 +74395,7 @@ var ptzAutotrackCapability = {
73660
74395
  * - **Native**: the camera's own firmware autotrack, registered per device by
73661
74396
  * the driver when the probe says it exists (Reolink: yes; Hikvision:
73662
74397
  * model-dependent).
73663
- * - **Wrapper**: the emulated implementation (`@camstack/system`'s `autotrack` builtin),
74398
+ * - **Wrapper**: the emulated implementation (`@camstack/server/system`'s `autotrack` builtin),
73664
74399
  * which follows a subject with `ptz.move` pulses driven by the detection
73665
74400
  * pipeline. `defaultActive: false` — the operator binds it per camera in
73666
74401
  * the bindings UI.
@@ -79014,6 +79749,7 @@ var DEVICE_LOCAL_STATE_CAPS = {
79014
79749
  petFeeder: petFeederCapability,
79015
79750
  petFountain: petFountainCapability,
79016
79751
  powerMeter: powerMeterCapability,
79752
+ powerSource: powerSourceCapability,
79017
79753
  presence: presenceCapability,
79018
79754
  pressureSensor: pressureSensorCapability,
79019
79755
  privacyMask: privacyMaskCapability,
@@ -80683,6 +81419,13 @@ Object.freeze({
80683
81419
  access: "view",
80684
81420
  role: "admin"
80685
81421
  },
81422
+ "addonSettings.getIntegrationFormSchema": {
81423
+ capName: "addon-settings",
81424
+ capScope: "system",
81425
+ addonId: null,
81426
+ access: "view",
81427
+ role: "admin"
81428
+ },
80686
81429
  "addonSettings.getIntegrationSettings": {
80687
81430
  capName: "addon-settings",
80688
81431
  capScope: "system",
@@ -84771,6 +85514,69 @@ Object.freeze({
84771
85514
  access: "view",
84772
85515
  role: "admin"
84773
85516
  },
85517
+ "migrations.declareOwner": {
85518
+ capName: "migrations",
85519
+ capScope: "system",
85520
+ addonId: null,
85521
+ access: "create",
85522
+ role: "admin"
85523
+ },
85524
+ "migrations.dryRun": {
85525
+ capName: "migrations",
85526
+ capScope: "system",
85527
+ addonId: null,
85528
+ access: "view",
85529
+ role: "admin"
85530
+ },
85531
+ "migrations.finishMigration": {
85532
+ capName: "migrations",
85533
+ capScope: "system",
85534
+ addonId: null,
85535
+ access: "create",
85536
+ role: "admin"
85537
+ },
85538
+ "migrations.listLedger": {
85539
+ capName: "migrations",
85540
+ capScope: "system",
85541
+ addonId: null,
85542
+ access: "view",
85543
+ role: "admin"
85544
+ },
85545
+ "migrations.listPending": {
85546
+ capName: "migrations",
85547
+ capScope: "system",
85548
+ addonId: null,
85549
+ access: "view",
85550
+ role: "admin"
85551
+ },
85552
+ "migrations.markFailed": {
85553
+ capName: "migrations",
85554
+ capScope: "system",
85555
+ addonId: null,
85556
+ access: "create",
85557
+ role: "admin"
85558
+ },
85559
+ "migrations.restorePreMigration": {
85560
+ capName: "migrations",
85561
+ capScope: "system",
85562
+ addonId: null,
85563
+ access: "create",
85564
+ role: "admin"
85565
+ },
85566
+ "migrations.retry": {
85567
+ capName: "migrations",
85568
+ capScope: "system",
85569
+ addonId: null,
85570
+ access: "create",
85571
+ role: "admin"
85572
+ },
85573
+ "migrations.startMigration": {
85574
+ capName: "migrations",
85575
+ capScope: "system",
85576
+ addonId: null,
85577
+ access: "create",
85578
+ role: "admin"
85579
+ },
84774
85580
  "modelConvert.convert": {
84775
85581
  capName: "model-convert",
84776
85582
  capScope: "system",
@@ -87403,6 +88209,34 @@ Object.freeze({
87403
88209
  access: "view",
87404
88210
  role: "viewer"
87405
88211
  },
88212
+ "powerSource.forceRestart": {
88213
+ capName: "power-source",
88214
+ capScope: "device",
88215
+ addonId: null,
88216
+ access: "create",
88217
+ role: "admin"
88218
+ },
88219
+ "powerSource.getStatus": {
88220
+ capName: "power-source",
88221
+ capScope: "device",
88222
+ addonId: null,
88223
+ access: "view",
88224
+ role: "admin"
88225
+ },
88226
+ "powerSource.powerOff": {
88227
+ capName: "power-source",
88228
+ capScope: "device",
88229
+ addonId: null,
88230
+ access: "create",
88231
+ role: "admin"
88232
+ },
88233
+ "powerSource.powerOn": {
88234
+ capName: "power-source",
88235
+ capScope: "device",
88236
+ addonId: null,
88237
+ access: "create",
88238
+ role: "admin"
88239
+ },
87406
88240
  "presence.getStatus": {
87407
88241
  capName: "presence",
87408
88242
  capScope: "device",
@@ -92562,6 +93396,26 @@ Object.freeze({
92562
93396
  form: "single",
92563
93397
  optional: false
92564
93398
  }],
93399
+ "powerSource.forceRestart": [{
93400
+ name: "deviceId",
93401
+ form: "single",
93402
+ optional: false
93403
+ }],
93404
+ "powerSource.getStatus": [{
93405
+ name: "deviceId",
93406
+ form: "single",
93407
+ optional: false
93408
+ }],
93409
+ "powerSource.powerOff": [{
93410
+ name: "deviceId",
93411
+ form: "single",
93412
+ optional: false
93413
+ }],
93414
+ "powerSource.powerOn": [{
93415
+ name: "deviceId",
93416
+ form: "single",
93417
+ optional: false
93418
+ }],
92565
93419
  "presence.getStatus": [{
92566
93420
  name: "deviceId",
92567
93421
  form: "single",