@camstack/addon-export-alexa 1.2.176 → 1.2.177

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.
@@ -5,7 +5,7 @@ import "node:fs";
5
5
  import "node:path";
6
6
  import "node:child_process";
7
7
  import "node:zlib";
8
- //#region ../types/dist/event-category-DmZDPDf_.mjs
8
+ //#region ../types/dist/event-category-CaURIwQA.mjs
9
9
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
10
10
  EventCategory["SystemBoot"] = "system.boot";
11
11
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -721,6 +721,10 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
721
721
  EventCategory["NotificationRuleBroken"] = "notification.rule-broken";
722
722
  /** The clear of {@link NotificationRuleBroken}: the rule loads and names nothing deleted. */
723
723
  EventCategory["NotificationRuleRepaired"] = "notification.rule-repaired";
724
+ /** A migration failed or was blocked; the Alert Center re-reads the ledger. */
725
+ EventCategory["MigrationFailed"] = "migration.failed";
726
+ /** A migration applied or a failure cleared; the Alert Center re-reads the ledger. */
727
+ EventCategory["MigrationApplied"] = "migration.applied";
724
728
  EventCategory["DeviceUpdated"] = "device.updated";
725
729
  /**
726
730
  * Transport-level connectivity. Emitted by the device driver when
@@ -783,6 +787,378 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
783
787
  return EventCategory;
784
788
  }({});
785
789
  //#endregion
790
+ //#region ../types/dist/device-type-CEqjmUnR.mjs
791
+ /**
792
+ import { errMsg } from '@camstack/types'
793
+ * Extract a human-readable message from an unknown error value.
794
+ * Replaces the ubiquitous `errMsg(err)` pattern.
795
+ */
796
+ function errMsg$1(err) {
797
+ if (err instanceof Error) return err.message;
798
+ if (typeof err === "string") return err;
799
+ return String(err);
800
+ }
801
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
802
+ DeviceType["Camera"] = "camera";
803
+ DeviceType["Hub"] = "hub";
804
+ DeviceType["Light"] = "light";
805
+ DeviceType["Siren"] = "siren";
806
+ DeviceType["Switch"] = "switch";
807
+ DeviceType["Sensor"] = "sensor";
808
+ DeviceType["Thermostat"] = "thermostat";
809
+ /** Air-conditioner / heat-pump climate device (HVAC) — shares the
810
+ * `climate-control` cap surface with `Thermostat` but renders a
811
+ * dedicated AC-appropriate control UI (mode chips, fan speed,
812
+ * independent vertical/horizontal swing). Sources: native Gree, and
813
+ * reusable by other AC integrations. */
814
+ DeviceType["Climate"] = "climate";
815
+ DeviceType["Button"] = "button";
816
+ /** Generic stateless event emitter — carries a device's EXACT declared
817
+ * event vocabulary verbatim (no normalization). Installed with the
818
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
819
+ * HA bus events (e.g. `zha_event`, generic). */
820
+ DeviceType["EventEmitter"] = "event-emitter";
821
+ /** Firmware/software update entity — current vs available version,
822
+ * updatable flag, update state, and an install action. Installed with
823
+ * the `update` cap. Sources: Homematic firmware-update channels (and
824
+ * reusable by other providers, e.g. HA `update.*` entities). */
825
+ DeviceType["Update"] = "update";
826
+ DeviceType["Generic"] = "generic";
827
+ /** Generic notification delivery target (HA `notify.<service>`, future
828
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
829
+ * endpoint; the `notifier` cap defines the send surface. */
830
+ DeviceType["Notifier"] = "notifier";
831
+ /** Pre-recorded action sequence with optional parameters
832
+ * (HA `script.*`). Runnable via `script-runner` cap. */
833
+ DeviceType["Script"] = "script";
834
+ /** Automation rule (HA `automation.*`) — enable/disable + manual
835
+ * trigger surface exposed via `automation-control` cap. */
836
+ DeviceType["Automation"] = "automation";
837
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
838
+ DeviceType["Lock"] = "lock";
839
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
840
+ * `valve.*`). `cover` cap with sub-roles for variant. */
841
+ DeviceType["Cover"] = "cover";
842
+ /** Pipe / water / gas valve with open/close/stop and optional
843
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
844
+ * modelled on the same open/closed lifecycle. */
845
+ DeviceType["Valve"] = "valve";
846
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
847
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
848
+ * modelled on the same target / mode lifecycle. */
849
+ DeviceType["Humidifier"] = "humidifier";
850
+ /** Water heater / boiler with target temperature + operation mode +
851
+ * away mode (HA `water_heater.*`). `water-heater` cap — a
852
+ * climate-family actuator. */
853
+ DeviceType["WaterHeater"] = "water-heater";
854
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
855
+ DeviceType["Fan"] = "fan";
856
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
857
+ * the camera surface — those use `Camera`. `media-player` cap. */
858
+ DeviceType["MediaPlayer"] = "media-player";
859
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
860
+ * `alarm-panel` cap. */
861
+ DeviceType["AlarmPanel"] = "alarm-panel";
862
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
863
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
864
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
865
+ * TextControl / DateTimeControl. */
866
+ DeviceType["Control"] = "control";
867
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
868
+ * `presence` cap. */
869
+ DeviceType["Presence"] = "presence";
870
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
871
+ * `weather` cap. */
872
+ DeviceType["Weather"] = "weather";
873
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
874
+ DeviceType["Vacuum"] = "vacuum";
875
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
876
+ * `lawn-mower-control` cap. */
877
+ DeviceType["LawnMower"] = "lawn-mower";
878
+ /** Physical HA device group — parent container for entity-children
879
+ * adopted from a single HA device entry. Not renderable as a
880
+ * standalone device; exists only to anchor child entities. */
881
+ DeviceType["Container"] = "container";
882
+ /** Single still-image entity (HA `image.*`). Read-only display of an
883
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
884
+ DeviceType["Image"] = "image";
885
+ /** Smart pet feeder — cloud-connected food dispenser with a bowl food
886
+ * level, battery, desiccant life, feeding state and manual-feed /
887
+ * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
888
+ * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
889
+ * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
890
+ * integrations sharing the same food/desiccant/hopper surface. */
891
+ DeviceType["PetFeeder"] = "pet-feeder";
892
+ /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
893
+ * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
894
+ * of a container and is BUILT as a composed device (D967). */
895
+ DeviceType["PetFountain"] = "pet-fountain";
896
+ /** Built-in dishwasher — program lifecycle, door / remote-start gates,
897
+ * salt and rinse-aid levels. Installed with the `dishwasher` cap.
898
+ * Sources: native Bosch Home Connect, reusable by similar integrations.
899
+ * A plug-built dishwasher carries running-state and power instead. */
900
+ DeviceType["Dishwasher"] = "dishwasher";
901
+ /** Washing machine. A plug-built one is running while its power stays
902
+ * above a threshold. No program cap — that surface is the dishwasher's. */
903
+ DeviceType["Washer"] = "washer";
904
+ /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
905
+ DeviceType["Dryer"] = "dryer";
906
+ /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
907
+ * other radio-to-IP bridges). It carries the box's own facts (firmware,
908
+ * address, connection state) and the actions the box really supports
909
+ * (`reboot`, `device-admin-link`). Products are NOT its children — they are
910
+ * adopted beside it — and its connection settings stay on the integration. */
911
+ DeviceType["Gateway"] = "gateway";
912
+ return DeviceType;
913
+ }({});
914
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
915
+ DeviceFeature["BatteryOperated"] = "battery-operated";
916
+ DeviceFeature["Rebootable"] = "rebootable";
917
+ /**
918
+ * Device supports an on-demand re-sync of its derived spec with its
919
+ * upstream source — drives the generic Re-sync button. The owning
920
+ * provider implements the action via the `device-adoption.resync` cap.
921
+ */
922
+ DeviceFeature["Resyncable"] = "resyncable";
923
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
924
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
925
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
926
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
927
+ /**
928
+ * Camera supports the on-firmware autotrack subsystem (subject-
929
+ * following). Distinct from `PanTiltZoom` because not every PTZ
930
+ * camera ships autotrack — the admin UI uses this flag to gate
931
+ * the autotrack toggle / settings card without re-deriving from
932
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
933
+ * driver sets this feature when probe confirms the firmware
934
+ * surface, and registers the cap in the same code path.
935
+ */
936
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
937
+ /**
938
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
939
+ * motion detection automatically activates this device. Mirrors
940
+ * `motion-trigger` cap registration: drivers set this feature in the
941
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
942
+ *
943
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
944
+ * fast scalar without binding fetch), notifier rules, and `listAll`
945
+ * filters that want "all devices with on-motion behaviour".
946
+ */
947
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
948
+ /** Light supports rgb-triplet color via `color` cap. */
949
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
950
+ /** Light supports HSV color via `color` cap. */
951
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
952
+ /** Light supports color-temperature (mired) via `color` cap. */
953
+ DeviceFeature["LightColorMired"] = "light-color-mired";
954
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
955
+ * targetHigh). Gates the range slider UI. */
956
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
957
+ /** Thermostat exposes target humidity and/or current humidity
958
+ * readings. Gates the humidity controls. */
959
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
960
+ /** Thermostat exposes a fan-mode selector. */
961
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
962
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
963
+ DeviceFeature["ClimatePreset"] = "climate-preset";
964
+ /** Thermostat exposes a vertical louver swing toggle. Gates the
965
+ * vertical-swing switch in the climate UI. Independent of horizontal. */
966
+ DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
967
+ /** Thermostat exposes a horizontal louver swing toggle. Gates the
968
+ * horizontal-swing switch in the climate UI. Independent of vertical. */
969
+ DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
970
+ /** Cover exposes intermediate position control (0..100). Gates the
971
+ * position slider UI. */
972
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
973
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
974
+ DeviceFeature["CoverTilt"] = "cover-tilt";
975
+ /** Valve exposes intermediate position control (0..100). Gates the
976
+ * position slider / drag surface UI. */
977
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
978
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
979
+ DeviceFeature["FanSpeed"] = "fan-speed";
980
+ /** Fan exposes a preset mode selector. */
981
+ DeviceFeature["FanPreset"] = "fan-preset";
982
+ /** Fan exposes blade direction (forward/reverse) — typical of
983
+ * ceiling fans. */
984
+ DeviceFeature["FanDirection"] = "fan-direction";
985
+ /** Fan exposes an oscillation toggle. */
986
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
987
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
988
+ * field on the UI lock-controls panel. */
989
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
990
+ /** Lock supports a latch-release ("open door") action distinct from
991
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
992
+ * `supported_features`. Gates the Open Door button in the UI. */
993
+ DeviceFeature["LockOpen"] = "lock-open";
994
+ /** Media player exposes a seek-to-position surface. */
995
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
996
+ /** Media player exposes a volume-level setter. */
997
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
998
+ /** Media player exposes a mute toggle distinct from volume=0. */
999
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
1000
+ /** Media player exposes a shuffle toggle. */
1001
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
1002
+ /** Media player exposes a repeat mode (off / all / one). */
1003
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
1004
+ /** Media player exposes a source / input selector. */
1005
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
1006
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
1007
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
1008
+ /** Media player exposes next-track. */
1009
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
1010
+ /** Media player exposes previous-track. */
1011
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
1012
+ /** Media player exposes stop distinct from pause. */
1013
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
1014
+ /** Alarm panel requires a PIN code on arm/disarm. */
1015
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
1016
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
1017
+ * addition to a textual location. */
1018
+ DeviceFeature["PresenceGps"] = "presence-gps";
1019
+ /** Notifier accepts an inline / URL image attachment. */
1020
+ DeviceFeature["NotifierImage"] = "notifier-image";
1021
+ /** Notifier accepts a priority hint (high/normal/low). */
1022
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
1023
+ /** Notifier accepts a free-form `data` payload for platform-specific
1024
+ * fields. */
1025
+ DeviceFeature["NotifierData"] = "notifier-data";
1026
+ /** Notifier supports interactive action buttons / callbacks. */
1027
+ DeviceFeature["NotifierActions"] = "notifier-actions";
1028
+ /** Notifier supports per-call recipient targeting (multi-user). */
1029
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
1030
+ /** Script runner accepts a variables map on each run invocation. */
1031
+ DeviceFeature["ScriptVariables"] = "script-variables";
1032
+ /** Automation `trigger` accepts a skipCondition flag — fires the
1033
+ * automation's actions while bypassing its condition block. */
1034
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
1035
+ /** Robot vacuum exposes a live cleaning map (image child). Gates the
1036
+ * map tile in the vacuum UI. */
1037
+ DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
1038
+ /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
1039
+ * switches group. */
1040
+ DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
1041
+ /** Robot mower exposes a live mowing map (SVG image child). Gates the
1042
+ * mower map tile. */
1043
+ DeviceFeature["MowerHasMap"] = "mower-has-map";
1044
+ /** Robot mower exposes targeted mowing (all-area / zones / edges /
1045
+ * spots) — gates the Mow action + map selectors. */
1046
+ DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
1047
+ return DeviceFeature;
1048
+ }({});
1049
+ /**
1050
+ * Semantic role a device plays within its parent. Populated by driver
1051
+ * addons when creating accessory devices (Reolink siren/floodlight/
1052
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
1053
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
1054
+ * `role: Floodlight` renders as a bulb with a brightness slider,
1055
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
1056
+ *
1057
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
1058
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
1059
+ */
1060
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
1061
+ DeviceRole["Siren"] = "siren";
1062
+ DeviceRole["Floodlight"] = "floodlight";
1063
+ DeviceRole["Spotlight"] = "spotlight";
1064
+ DeviceRole["PirSensor"] = "pir-sensor";
1065
+ DeviceRole["Chime"] = "chime";
1066
+ DeviceRole["Autotrack"] = "autotrack";
1067
+ DeviceRole["Nightvision"] = "nightvision";
1068
+ DeviceRole["PrivacyMask"] = "privacy-mask";
1069
+ DeviceRole["Doorbell"] = "doorbell";
1070
+ /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
1071
+ DeviceRole["CoverBlind"] = "cover-blind";
1072
+ /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
1073
+ DeviceRole["CoverShutter"] = "cover-shutter";
1074
+ /** Exterior awning. HA `device_class: awning`. */
1075
+ DeviceRole["CoverAwning"] = "cover-awning";
1076
+ /** Curtain / drape. HA `device_class: curtain`. */
1077
+ DeviceRole["CoverCurtain"] = "cover-curtain";
1078
+ /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
1079
+ DeviceRole["CoverGarage"] = "cover-garage";
1080
+ /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
1081
+ DeviceRole["CoverGate"] = "cover-gate";
1082
+ /** Door. HA `device_class: door`. A security actuator: exports gate it. */
1083
+ DeviceRole["CoverDoor"] = "cover-door";
1084
+ /** Window. HA `device_class: window`. */
1085
+ DeviceRole["CoverWindow"] = "cover-window";
1086
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
1087
+ * real Switch device for UI rendering / export adapters. */
1088
+ DeviceRole["BinaryHelper"] = "binary-helper";
1089
+ /** A smart plug: a `switch` whose source says it is an outlet (HA
1090
+ * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
1091
+ DeviceRole["Outlet"] = "outlet";
1092
+ /** Generic motion / occupancy / moving event source. Distinct from
1093
+ * the camera accessory PirSensor role: that one is a camera child;
1094
+ * this is a standalone HA / 3rd-party motion sensor. */
1095
+ DeviceRole["MotionSensor"] = "motion-sensor";
1096
+ DeviceRole["ContactSensor"] = "contact-sensor";
1097
+ DeviceRole["LeakSensor"] = "leak-sensor";
1098
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
1099
+ DeviceRole["COSensor"] = "co-sensor";
1100
+ DeviceRole["GasSensor"] = "gas-sensor";
1101
+ DeviceRole["TamperSensor"] = "tamper-sensor";
1102
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
1103
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
1104
+ DeviceRole["SoundSensor"] = "sound-sensor";
1105
+ /** Fallback for `binary_sensor` without a known `device_class`. */
1106
+ DeviceRole["BinarySensor"] = "binary-sensor";
1107
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
1108
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
1109
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
1110
+ DeviceRole["PressureSensor"] = "pressure-sensor";
1111
+ /** Wind speed or direction (weather-station `wind-sensor` cap). */
1112
+ DeviceRole["WindSensor"] = "wind-sensor";
1113
+ /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
1114
+ DeviceRole["RainSensor"] = "rain-sensor";
1115
+ /** UV index (weather-station `uv-sensor` cap). */
1116
+ DeviceRole["UvSensor"] = "uv-sensor";
1117
+ /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
1118
+ * Distinct from AmbientLightSensor (lux). */
1119
+ DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
1120
+ /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
1121
+ DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
1122
+ DeviceRole["PowerSensor"] = "power-sensor";
1123
+ DeviceRole["EnergySensor"] = "energy-sensor";
1124
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
1125
+ DeviceRole["CurrentSensor"] = "current-sensor";
1126
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
1127
+ /** Battery level (numeric % via `sensor` OR low-bool via
1128
+ * `binary_sensor` — the cap distinguishes via the value type). */
1129
+ DeviceRole["BatterySensor"] = "battery-sensor";
1130
+ /** Fallback for `sensor` numeric without a known `device_class`. */
1131
+ DeviceRole["NumericSensor"] = "numeric-sensor";
1132
+ /** String / enum state (HA `sensor` with `state_class: enum` or
1133
+ * `attributes.options`). */
1134
+ DeviceRole["EnumSensor"] = "enum-sensor";
1135
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
1136
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
1137
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
1138
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
1139
+ /** Last-resort fallback when nothing else matches. */
1140
+ DeviceRole["GenericSensor"] = "generic-sensor";
1141
+ DeviceRole["NumericControl"] = "numeric-control";
1142
+ DeviceRole["SelectControl"] = "select-control";
1143
+ DeviceRole["TextControl"] = "text-control";
1144
+ DeviceRole["DateTimeControl"] = "datetime-control";
1145
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
1146
+ * rich features (image, priority, channel routing). */
1147
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
1148
+ /** Chat / messaging service (HA `notify.telegram_*`,
1149
+ * `notify.discord_*`, etc.). */
1150
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
1151
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
1152
+ DeviceRole["EmailNotifier"] = "email-notifier";
1153
+ /** Fallback when the notifier service name doesn't match a known
1154
+ * pattern. */
1155
+ DeviceRole["GenericNotifier"] = "generic-notifier";
1156
+ /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
1157
+ * cap. A `DeviceType.Generic` device. */
1158
+ DeviceRole["IrTransmitter"] = "ir-transmitter";
1159
+ return DeviceRole;
1160
+ }({});
1161
+ //#endregion
786
1162
  //#region ../../node_modules/zod/v4/core/core.js
787
1163
  var _a$1;
788
1164
  function $constructor(name, initializer, params) {
@@ -5461,7 +5837,7 @@ var ZodIssueCode = {
5461
5837
  var ZodFirstPartyTypeKind;
5462
5838
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5463
5839
  //#endregion
5464
- //#region ../types/dist/sleep-SX9bkW3_.mjs
5840
+ //#region ../types/dist/sleep-CSYuxssh.mjs
5465
5841
  /**
5466
5842
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5467
5843
  * window to float samples (D455).
@@ -5977,6 +6353,102 @@ function emitReadiness(bus, params) {
5977
6353
  ts
5978
6354
  }));
5979
6355
  }
6356
+ var NOT_RUN = {
6357
+ declared: false,
6358
+ snapshot: null,
6359
+ applied: [],
6360
+ failed: [],
6361
+ blocked: [],
6362
+ skipped: [],
6363
+ blockOwner: []
6364
+ };
6365
+ /**
6366
+ * Offer `migrations` to the engine and run what it says to run, in its order. Never
6367
+ * throws: an unreachable or refusing engine is logged and reported `declared: false`,
6368
+ * because the hub (and this addon's boot) must not hang on a migration.
6369
+ */
6370
+ async function runAddonMigrations(host, migrations, logger) {
6371
+ const first = migrations[0];
6372
+ if (first === void 0) return NOT_RUN;
6373
+ const owner = first.meta.owner;
6374
+ const log = logger.withTags({ migrationOwner: owner });
6375
+ const byId = new Map(migrations.map((m) => [m.meta.id, m]));
6376
+ let declaration;
6377
+ try {
6378
+ declaration = await host.declareOwner({
6379
+ owner,
6380
+ metas: migrations.map((m) => m.meta)
6381
+ });
6382
+ } catch (err) {
6383
+ log.error("the migration engine refused or could not take this addon catalogue — none ran", { meta: { error: errMsg$1(err) } });
6384
+ return {
6385
+ ...NOT_RUN,
6386
+ blockOwner: migrations.filter((m) => m.meta.onFailure === "block-owner").map((m) => m.meta.id)
6387
+ };
6388
+ }
6389
+ const applied = [];
6390
+ const failed = [];
6391
+ const blocked = [];
6392
+ const skipped = [];
6393
+ const settle = (id, status) => {
6394
+ if (status === "applied") applied.push(id);
6395
+ else if (status === "failed") failed.push(id);
6396
+ else if (status === "blocked") blocked.push(id);
6397
+ else skipped.push(id);
6398
+ };
6399
+ for (const step of declaration.steps) {
6400
+ const bound = byId.get(step.id);
6401
+ if (bound === void 0 || step.action === "skip") {
6402
+ skipped.push(step.id);
6403
+ continue;
6404
+ }
6405
+ const tags = { migrationId: step.id };
6406
+ try {
6407
+ const gate = await host.startMigration({ id: step.id });
6408
+ if (!gate.proceed) {
6409
+ log.warn("migration not run", {
6410
+ tags,
6411
+ meta: {
6412
+ state: gate.state,
6413
+ reason: gate.reason
6414
+ }
6415
+ });
6416
+ settle(step.id, gate.state === "pending" ? "blocked" : gate.state);
6417
+ continue;
6418
+ }
6419
+ const result = await bound.execute();
6420
+ const outcome = await host.finishMigration({
6421
+ id: step.id,
6422
+ result
6423
+ });
6424
+ if (outcome.status === "applied") log.info("migration applied", {
6425
+ tags,
6426
+ meta: { rowsChanged: outcome.rowsChanged }
6427
+ });
6428
+ else log.error("migration failed", {
6429
+ tags,
6430
+ meta: { error: outcome.error }
6431
+ });
6432
+ settle(step.id, outcome.status);
6433
+ } catch (err) {
6434
+ log.error("migration could not be completed with the engine", {
6435
+ tags,
6436
+ meta: { error: errMsg$1(err) }
6437
+ });
6438
+ failed.push(step.id);
6439
+ }
6440
+ }
6441
+ const blockOwner = [...failed, ...blocked].filter((id) => byId.get(id)?.meta.onFailure === "block-owner");
6442
+ return {
6443
+ declared: true,
6444
+ snapshot: declaration.snapshot,
6445
+ applied,
6446
+ failed,
6447
+ blocked,
6448
+ skipped,
6449
+ blockOwner
6450
+ };
6451
+ }
5980
6452
  /**
5981
6453
  * Build a {@link DurableState} over a single store key. Transport-agnostic:
5982
6454
  * `read`/`write` are the addon-store or device-store accessors. The whole
@@ -7032,6 +7504,28 @@ var BaseAddon = class {
7032
7504
  return normalized;
7033
7505
  }
7034
7506
  /**
7507
+ * Run this addon's migration catalogue (D987 M3) through the hub's `migrations`
7508
+ * engine. Call it at the point of the boot where the data must already have the new
7509
+ * shape — `onInitialize`, or `onRestoreDevices` for a migration that needs the
7510
+ * restored devices — with the catalogue bound to the addon's ports
7511
+ * (`defineAddonMigrations(ADDON_MIGRATIONS, ports)`).
7512
+ *
7513
+ * An engine that cannot be reached or refuses the catalogue is logged and runs
7514
+ * nothing; the boot continues. A migration that FAILED (or was blocked by one)
7515
+ * and declares `onFailure: 'block-owner'` makes this throw, so the addon does not
7516
+ * serve data whose shape it cannot trust; `tolerate` migrations never do.
7517
+ */
7518
+ async runMigrations(migrations) {
7519
+ const api = this.ctx.api.migrations;
7520
+ const report = await runAddonMigrations({
7521
+ declareOwner: (input) => api.declareOwner.mutate(input),
7522
+ startMigration: (input) => api.startMigration.mutate(input),
7523
+ finishMigration: (input) => api.finishMigration.mutate(input)
7524
+ }, migrations, this.ctx.logger);
7525
+ 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`);
7526
+ return report;
7527
+ }
7528
+ /**
7035
7529
  * Called by the isolated-process runner AFTER `broker.start()`.
7036
7530
  * In-process addons never need this because the hub broker is already
7037
7531
  * running when `initialize()` fires. For forked children the broker
@@ -7164,6 +7658,26 @@ var BaseAddon = class {
7164
7658
  * alternative — skip it — turns a rename into a surface that quietly
7165
7659
  * empties, which looks exactly like an addon with nothing to configure.
7166
7660
  */
7661
+ /**
7662
+ * The form schema of ONE integration instance, or `null` to use {@link globalSettingsSchema}.
7663
+ *
7664
+ * Override it only when an `instanceMode: multiple` addon's instances differ: an NVR integration
7665
+ * needs its connection fields, the default integration the addon's own sections. It is the
7666
+ * SHAPE of the form only — the values live in `integrations.getSettings`, and the write path is
7667
+ * unchanged (`integrations.setSettings` for an account integration).
7668
+ */
7669
+ async integrationSettingsSchema(_instance) {
7670
+ return null;
7671
+ }
7672
+ /**
7673
+ * What the create wizard and the integration edit page render for one instance: the addon's
7674
+ * per-instance schema when it declares one, else its global schema (what they always showed).
7675
+ */
7676
+ async getIntegrationFormSchema(instance, nodeId) {
7677
+ const scoped = await this.integrationSettingsSchema(instance);
7678
+ if (scoped === null) return this.getGlobalSettings(void 0, void 0, nodeId);
7679
+ return hydrateSchema(scoped, {}, { inlineSecretsAsViews: true });
7680
+ }
7167
7681
  async getIntegrationSettings(nodeId) {
7168
7682
  const declared = this.integrationSettingSections();
7169
7683
  if (declared.length === 0) return null;
@@ -8054,407 +8568,6 @@ var RecordKindDeclarationSchema = object({
8054
8568
  }).strict();
8055
8569
  /** The kind names: lower-case, dash separated, short enough for an index name. */
8056
8570
  var RecordKindNameSchema = string().regex(/^[a-z][a-z0-9-]{0,47}$/);
8057
- var READING_QUANTITIES = [
8058
- "temperature",
8059
- "pressure",
8060
- "speed",
8061
- "precipitation",
8062
- "precipitation-rate",
8063
- "length",
8064
- "area",
8065
- "illuminance",
8066
- "irradiance",
8067
- "power",
8068
- "energy",
8069
- "voltage",
8070
- "current",
8071
- "apparent-power",
8072
- "humidity",
8073
- "percentage",
8074
- "concentration-volume",
8075
- "concentration-mass",
8076
- "concentration-ppb",
8077
- "volume",
8078
- "duration",
8079
- "duration-ms",
8080
- "information",
8081
- "sound-level",
8082
- "signal-level",
8083
- "colour-temperature",
8084
- "angle",
8085
- "bitrate",
8086
- "rate",
8087
- "mass",
8088
- "index",
8089
- "ratio",
8090
- "count",
8091
- "none",
8092
- "device"
8093
- ];
8094
- var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8095
- new Set(READING_QUANTITIES);
8096
- /**
8097
- * Stored unit symbol for a quantity. `none` means the number is dimensionless
8098
- * (or an index / ratio / count). `device` means the cap has no single unit.
8099
- */
8100
- var QUANTITY_BASE = {
8101
- temperature: "°C",
8102
- pressure: "hPa",
8103
- speed: "m/s",
8104
- precipitation: "mm",
8105
- "precipitation-rate": "mm/h",
8106
- length: "m",
8107
- area: "m²",
8108
- illuminance: "lx",
8109
- irradiance: "W/m²",
8110
- power: "W",
8111
- energy: "kWh",
8112
- voltage: "V",
8113
- current: "A",
8114
- "apparent-power": "VA",
8115
- humidity: "%",
8116
- percentage: "%",
8117
- "concentration-volume": "ppm",
8118
- "concentration-mass": "µg/m³",
8119
- "concentration-ppb": "ppb",
8120
- volume: "L",
8121
- duration: "s",
8122
- "duration-ms": "ms",
8123
- information: "B",
8124
- "sound-level": "dBFS",
8125
- "signal-level": "dBm",
8126
- "colour-temperature": "mired",
8127
- angle: "°",
8128
- bitrate: "kbps",
8129
- rate: "fps",
8130
- mass: "kg",
8131
- index: "none",
8132
- ratio: "none",
8133
- count: "none",
8134
- none: "none",
8135
- device: "device"
8136
- };
8137
- /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8138
- function baseUnitOf(quantity) {
8139
- const symbol = QUANTITY_BASE[quantity];
8140
- if (symbol === "none" || symbol === "device") return void 0;
8141
- return symbol;
8142
- }
8143
- function readingMeta(quantity, extras) {
8144
- return {
8145
- quantity,
8146
- ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8147
- ...extras?.label !== void 0 ? { label: extras.label } : {}
8148
- };
8149
- }
8150
- /** Shared Zod schemas used across streaming capabilities. */
8151
- var CamProfileSchema = _enum([
8152
- "high",
8153
- "mid",
8154
- "low"
8155
- ]);
8156
- /**
8157
- * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
8158
- *
8159
- * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
8160
- * that consumer owns". It lives beside `CamProfile` because a rung is the only
8161
- * operator-facing way to name a stream: a cam-stream id is broker-internal and
8162
- * moves when a slot is reassigned, so a stored id silently stops meaning what
8163
- * the operator picked. Today's one user is the audio analyser, whose rule is
8164
- * "the lowest AVAILABLE native rung" (D537).
8165
- */
8166
- var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
8167
- var CamStreamKindSchema = _enum([
8168
- "pull-rtsp",
8169
- "pull-rtmp",
8170
- "pull-http",
8171
- "pull-flv",
8172
- "pull-rfc4571",
8173
- "push-annexb",
8174
- "derived"
8175
- ]);
8176
- var CamStreamResolutionSchema = object({
8177
- width: number().int().positive().meta(readingMeta("none")),
8178
- height: number().int().positive().meta(readingMeta("none"))
8179
- });
8180
- var CameraStreamSchema = object({
8181
- /** Stable, provider-assigned id unique within the (deviceId) scope. */
8182
- camStreamId: string().min(1),
8183
- deviceId: number().int().nonnegative(),
8184
- kind: CamStreamKindSchema,
8185
- /** Required for pull-* kinds. Ignored for push-annexb. */
8186
- url: string().optional(),
8187
- codec: string().optional(),
8188
- resolution: CamStreamResolutionSchema.optional(),
8189
- fps: number().positive().optional(),
8190
- /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
8191
- label: string().optional(),
8192
- /**
8193
- * Device-level features the publisher advertised (e.g. `battery-operated`).
8194
- * The broker, snapshot orchestrator, and prebuffer manager all consult
8195
- * this list to derive policy — relaxed stall watchdog for battery
8196
- * cams, prebuffer off by default, longer snapshot rate-limit, etc.
8197
- *
8198
- * Single source of truth replacing per-stream flags like the
8199
- * historical `allowStall`: if the publisher knows the camera is
8200
- * battery-powered, every downstream service derives the right policy
8201
- * from this list.
8202
- */
8203
- deviceFeatures: array(string()).optional(),
8204
- /**
8205
- * Whether this stream participates in the broker's automatic profile
8206
- * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
8207
- * use `false` when they want a stream to be SELECTABLE in the UI but not
8208
- * picked by default — e.g. Reolink publishes its native Baichuan streams
8209
- * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
8210
- * mirrors as `autoEligible: false` (still pickable per slot, just not
8211
- * the auto choice). Manual `assignProfile` calls remain valid for
8212
- * non-eligible streams.
8213
- */
8214
- autoEligible: boolean().optional(),
8215
- /**
8216
- * The profile slot the PUBLISHER says this stream is: `low` for a stream
8217
- * whose only sensible role is the low-bandwidth one, `high` for a main
8218
- * stream. Consulted by the broker's automatic ranking
8219
- * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
8220
- * an operator's manual assignment still wins, and an absent hint is the
8221
- * pixel-ranked default every camera had before this field existed.
8222
- *
8223
- * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
8224
- * storage class is written for on its own (`recordings` is high|mid,
8225
- * `recordingsLow` is low) and the one profile scrub does not read. The robot
8226
- * camera's single 720p relay is a `low` in every respect except the slot the
8227
- * heuristic put it in.
8228
- */
8229
- profileHint: CamProfileSchema.optional(),
8230
- /**
8231
- * Transport-specific opaque metadata. The broker passes it through to
8232
- * the source reader without inspecting it. Currently used by
8233
- * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
8234
- * route RTP packets to the right depacketizer without an in-band
8235
- * DESCRIBE phase). Other kinds typically leave it undefined.
8236
- */
8237
- metadata: record(string(), unknown()).optional()
8238
- });
8239
- var ProfileSlotStatusSchema = _enum([
8240
- "unassigned",
8241
- "idle",
8242
- "connecting",
8243
- "streaming",
8244
- "error"
8245
- ]);
8246
- var ProfileSlotSchema = object({
8247
- deviceId: number().int().nonnegative(),
8248
- profile: CamProfileSchema,
8249
- /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
8250
- brokerId: string(),
8251
- /** `null` when the profile is unassigned. */
8252
- sourceCamStreamId: string().nullable(),
8253
- status: ProfileSlotStatusSchema,
8254
- resolution: CamStreamResolutionSchema.optional(),
8255
- codec: string().optional(),
8256
- preBufferSec: number().nonnegative().optional(),
8257
- errorMessage: string().optional()
8258
- });
8259
- /**
8260
- * Zod schema for StreamSourceEntry — the canonical stream descriptor
8261
- * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
8262
- */
8263
- var StreamSourceEntrySchema$1 = object({
8264
- id: string(),
8265
- label: string(),
8266
- protocol: _enum([
8267
- "rtsp",
8268
- "rtmp",
8269
- "annexb",
8270
- "http-mjpeg",
8271
- "webrtc",
8272
- "custom"
8273
- ]),
8274
- url: string().optional(),
8275
- resolution: object({
8276
- width: number(),
8277
- height: number()
8278
- }).readonly().optional(),
8279
- fps: number().optional(),
8280
- bitrate: number().optional(),
8281
- codec: string().optional(),
8282
- profileHint: CamProfileSchema.optional()
8283
- });
8284
- object({
8285
- type: string(),
8286
- url: string(),
8287
- videoCodec: string().optional(),
8288
- audioCodec: string().optional(),
8289
- metadata: record(string(), unknown()).readonly().optional()
8290
- });
8291
- /**
8292
- * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
8293
- * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
8294
- * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
8295
- * (the runner's native-crop and pipeline-executor inputs) can carry handles
8296
- * over tRPC / Moleculer.
8297
- *
8298
- * The `satisfies` assertion below pins this schema to the interface: if a
8299
- * field is added to / removed from `FrameHandle` without a matching schema
8300
- * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
8301
- * `FrameHandle` and the build fails — no silent drift.
8302
- */
8303
- var FrameHandleSchema = object({
8304
- shmId: string(),
8305
- slot: number().int().nonnegative(),
8306
- seq: number().int().nonnegative(),
8307
- width: number().int().positive(),
8308
- height: number().int().positive(),
8309
- format: _enum([
8310
- "jpeg",
8311
- "rgb",
8312
- "bgr",
8313
- "yuv420",
8314
- "gray"
8315
- ]),
8316
- pts: number(),
8317
- byteLength: number().int().nonnegative(),
8318
- nodeId: string(),
8319
- slotCount: number().int().positive()
8320
- });
8321
- /**
8322
- * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
8323
- * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
8324
- * sample bytes plus the track parameters a consumer needs to interpret them.
8325
- *
8326
- * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
8327
- * Float32 PCM), so unlike video frames they ship their bytes INLINE over
8328
- * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
8329
- * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
8330
- * it.
8331
- */
8332
- var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
8333
- var DecodedAudioChunkSchema = object({
8334
- data: _instanceof(Uint8Array),
8335
- sampleRate: number().int().positive(),
8336
- channels: number().int().positive(),
8337
- timestamp: number(),
8338
- /**
8339
- * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
8340
- * byte, for any peer that never heard of this field. A coded window
8341
- * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
8342
- * subscription that DECLARED it accepts one, so absence can never mean
8343
- * "coded bytes a consumer will read as floats" (D455).
8344
- */
8345
- format: AudioChunkFormatSchema.optional()
8346
- });
8347
- /**
8348
- * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
8349
- * its bytes inline: a consumer asks the broker for the decoded audio-chunk
8350
- * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
8351
- * the consumer drains via `pullAudioChunks`.
8352
- */
8353
- var SubscribeAudioChunksInputSchema = object({
8354
- brokerId: string(),
8355
- /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
8356
- tag: string().optional(),
8357
- /**
8358
- * Byte formats this subscriber can READ, best first. The broker serves the
8359
- * chunk's own format when it is in this list and expands to `f32le`
8360
- * otherwise, so a subscriber is never handed bytes it cannot interpret.
8361
- *
8362
- * Absent (or without the source format) means `f32le` — the behaviour every
8363
- * subscriber had before D455, unchanged. This is the negotiation half of
8364
- * the source-bytes lever: it is what lets the broker and its consumers
8365
- * deploy one at a time across three nodes.
8366
- */
8367
- accept: array(AudioChunkFormatSchema).readonly().optional()
8368
- });
8369
- /** Result of `stream-broker.subscribeAudioChunks`. */
8370
- var SubscribeAudioChunksResultSchema = object({
8371
- /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
8372
- subscriptionId: string() });
8373
- var BrokerStatsSchema = object({
8374
- status: _enum([
8375
- "idle",
8376
- "connecting",
8377
- "streaming",
8378
- "error",
8379
- "stopped"
8380
- ]),
8381
- inputFps: number(),
8382
- encodedSubscribers: number(),
8383
- uptimeMs: number(),
8384
- bitrateKbps: number(),
8385
- idrIntervalMs: number(),
8386
- codec: string().optional(),
8387
- totalBytes: number(),
8388
- packetCount: number(),
8389
- rtspClients: number(),
8390
- pipeClients: number(),
8391
- preBufferSec: number(),
8392
- preBufferMs: number(),
8393
- preBufferPackets: number(),
8394
- /**
8395
- * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
8396
- * when the stream has no audio track or the broker is in cold start.
8397
- * `supported = false` means the codec was detected but the local
8398
- * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
8399
- * AAC pipeline wired). Surfaced in the UI device-overview so operators
8400
- * can pre-pick the audio-analysis model that matches the codec.
8401
- */
8402
- audio: object({
8403
- codec: string(),
8404
- sampleRate: number(),
8405
- channels: number(),
8406
- supported: boolean()
8407
- }).nullable().optional(),
8408
- /**
8409
- * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
8410
- * distributing none of the device's audio, on live or recording.
8411
- *
8412
- * Present so a silent camera can be told apart from a broken one on the
8413
- * stream panel itself, without cross-referencing the switch group: a
8414
- * broker holding an `audio` track descriptor while `audioMuted` is true is
8415
- * working exactly as asked. `audioMutedDropped` counts the audio units
8416
- * thrown away since the current dial — it is how you confirm from stats
8417
- * alone that the mute is on the packet path and not merely persisted.
8418
- */
8419
- audioMuted: boolean().optional(),
8420
- audioMutedDropped: number().optional()
8421
- });
8422
- /**
8423
- * Exporter-facing "profile restream" entry. Returned by
8424
- * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
8425
- * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
8426
- * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
8427
- * RTSP restream that aliases the profile's assigned source broker, so
8428
- * every consumer dialling a profile converges on the same single pull.
8429
- * `codec`/`resolution` describe the assigned SOURCE camStream (for the
8430
- * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
8431
- * (raw per-camStream, live-view only).
8432
- */
8433
- var ProfileRtspEntrySchema = object({
8434
- profile: CamProfileSchema,
8435
- /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
8436
- brokerId: string(),
8437
- url: string(),
8438
- mutedUrl: string(),
8439
- enabled: boolean(),
8440
- codec: string().optional(),
8441
- resolution: CamStreamResolutionSchema.optional()
8442
- });
8443
- /**
8444
- * The model weight formats a catalog entry can ship. Schema-free on purpose:
8445
- * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
8446
- * (the model downloader in `@camstack/system`) needs only the list and must
8447
- * reach it through `@camstack/types/addon` without building the cap schema
8448
- * graph (D28).
8449
- */
8450
- var MODEL_FORMATS = [
8451
- "onnx",
8452
- "coreml",
8453
- "openvino",
8454
- "tflite",
8455
- "pt",
8456
- "gguf"
8457
- ];
8458
8571
  object({
8459
8572
  field: string().min(1),
8460
8573
  on: literal("advance")
@@ -8543,6 +8656,407 @@ function optionalMethod(input, output, options) {
8543
8656
  providerOptional: true
8544
8657
  };
8545
8658
  }
8659
+ var READING_QUANTITIES = [
8660
+ "temperature",
8661
+ "pressure",
8662
+ "speed",
8663
+ "precipitation",
8664
+ "precipitation-rate",
8665
+ "length",
8666
+ "area",
8667
+ "illuminance",
8668
+ "irradiance",
8669
+ "power",
8670
+ "energy",
8671
+ "voltage",
8672
+ "current",
8673
+ "apparent-power",
8674
+ "humidity",
8675
+ "percentage",
8676
+ "concentration-volume",
8677
+ "concentration-mass",
8678
+ "concentration-ppb",
8679
+ "volume",
8680
+ "duration",
8681
+ "duration-ms",
8682
+ "information",
8683
+ "sound-level",
8684
+ "signal-level",
8685
+ "colour-temperature",
8686
+ "angle",
8687
+ "bitrate",
8688
+ "rate",
8689
+ "mass",
8690
+ "index",
8691
+ "ratio",
8692
+ "count",
8693
+ "none",
8694
+ "device"
8695
+ ];
8696
+ var ReadingQuantitySchema = _enum(READING_QUANTITIES);
8697
+ new Set(READING_QUANTITIES);
8698
+ /**
8699
+ * Stored unit symbol for a quantity. `none` means the number is dimensionless
8700
+ * (or an index / ratio / count). `device` means the cap has no single unit.
8701
+ */
8702
+ var QUANTITY_BASE = {
8703
+ temperature: "°C",
8704
+ pressure: "hPa",
8705
+ speed: "m/s",
8706
+ precipitation: "mm",
8707
+ "precipitation-rate": "mm/h",
8708
+ length: "m",
8709
+ area: "m²",
8710
+ illuminance: "lx",
8711
+ irradiance: "W/m²",
8712
+ power: "W",
8713
+ energy: "kWh",
8714
+ voltage: "V",
8715
+ current: "A",
8716
+ "apparent-power": "VA",
8717
+ humidity: "%",
8718
+ percentage: "%",
8719
+ "concentration-volume": "ppm",
8720
+ "concentration-mass": "µg/m³",
8721
+ "concentration-ppb": "ppb",
8722
+ volume: "L",
8723
+ duration: "s",
8724
+ "duration-ms": "ms",
8725
+ information: "B",
8726
+ "sound-level": "dBFS",
8727
+ "signal-level": "dBm",
8728
+ "colour-temperature": "mired",
8729
+ angle: "°",
8730
+ bitrate: "kbps",
8731
+ rate: "fps",
8732
+ mass: "kg",
8733
+ index: "none",
8734
+ ratio: "none",
8735
+ count: "none",
8736
+ none: "none",
8737
+ device: "device"
8738
+ };
8739
+ /** The stored unit, or `undefined` when the quantity has no unit symbol. */
8740
+ function baseUnitOf(quantity) {
8741
+ const symbol = QUANTITY_BASE[quantity];
8742
+ if (symbol === "none" || symbol === "device") return void 0;
8743
+ return symbol;
8744
+ }
8745
+ function readingMeta(quantity, extras) {
8746
+ return {
8747
+ quantity,
8748
+ ...extras?.precision !== void 0 ? { precision: extras.precision } : {},
8749
+ ...extras?.label !== void 0 ? { label: extras.label } : {}
8750
+ };
8751
+ }
8752
+ /** Shared Zod schemas used across streaming capabilities. */
8753
+ var CamProfileSchema = _enum([
8754
+ "high",
8755
+ "mid",
8756
+ "low"
8757
+ ]);
8758
+ /**
8759
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
8760
+ *
8761
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
8762
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
8763
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
8764
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
8765
+ * the operator picked. Today's one user is the audio analyser, whose rule is
8766
+ * "the lowest AVAILABLE native rung" (D537).
8767
+ */
8768
+ var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
8769
+ var CamStreamKindSchema = _enum([
8770
+ "pull-rtsp",
8771
+ "pull-rtmp",
8772
+ "pull-http",
8773
+ "pull-flv",
8774
+ "pull-rfc4571",
8775
+ "push-annexb",
8776
+ "derived"
8777
+ ]);
8778
+ var CamStreamResolutionSchema = object({
8779
+ width: number().int().positive().meta(readingMeta("none")),
8780
+ height: number().int().positive().meta(readingMeta("none"))
8781
+ });
8782
+ var CameraStreamSchema = object({
8783
+ /** Stable, provider-assigned id unique within the (deviceId) scope. */
8784
+ camStreamId: string().min(1),
8785
+ deviceId: number().int().nonnegative(),
8786
+ kind: CamStreamKindSchema,
8787
+ /** Required for pull-* kinds. Ignored for push-annexb. */
8788
+ url: string().optional(),
8789
+ codec: string().optional(),
8790
+ resolution: CamStreamResolutionSchema.optional(),
8791
+ fps: number().positive().optional(),
8792
+ /** Human label surfaced in the Admin UI "Camera Stream" dropdown. */
8793
+ label: string().optional(),
8794
+ /**
8795
+ * Device-level features the publisher advertised (e.g. `battery-operated`).
8796
+ * The broker, snapshot orchestrator, and prebuffer manager all consult
8797
+ * this list to derive policy — relaxed stall watchdog for battery
8798
+ * cams, prebuffer off by default, longer snapshot rate-limit, etc.
8799
+ *
8800
+ * Single source of truth replacing per-stream flags like the
8801
+ * historical `allowStall`: if the publisher knows the camera is
8802
+ * battery-powered, every downstream service derives the right policy
8803
+ * from this list.
8804
+ */
8805
+ deviceFeatures: array(string()).optional(),
8806
+ /**
8807
+ * Whether this stream participates in the broker's automatic profile
8808
+ * assignment (`computeInitialAssignment`). Defaults to `true`. Publishers
8809
+ * use `false` when they want a stream to be SELECTABLE in the UI but not
8810
+ * picked by default — e.g. Reolink publishes its native Baichuan streams
8811
+ * as `autoEligible: true` (the recommended path) and its RTSP / RTMP
8812
+ * mirrors as `autoEligible: false` (still pickable per slot, just not
8813
+ * the auto choice). Manual `assignProfile` calls remain valid for
8814
+ * non-eligible streams.
8815
+ */
8816
+ autoEligible: boolean().optional(),
8817
+ /**
8818
+ * The profile slot the PUBLISHER says this stream is: `low` for a stream
8819
+ * whose only sensible role is the low-bandwidth one, `high` for a main
8820
+ * stream. Consulted by the broker's automatic ranking
8821
+ * (`rankInitialAssignment`) BEFORE the pixel-count heuristic, and only there:
8822
+ * an operator's manual assignment still wins, and an absent hint is the
8823
+ * pixel-ranked default every camera had before this field existed.
8824
+ *
8825
+ * Why it exists: a camera with ONE stream ranked to `mid` — the slot no
8826
+ * storage class is written for on its own (`recordings` is high|mid,
8827
+ * `recordingsLow` is low) and the one profile scrub does not read. The robot
8828
+ * camera's single 720p relay is a `low` in every respect except the slot the
8829
+ * heuristic put it in.
8830
+ */
8831
+ profileHint: CamProfileSchema.optional(),
8832
+ /**
8833
+ * Transport-specific opaque metadata. The broker passes it through to
8834
+ * the source reader without inspecting it. Currently used by
8835
+ * `pull-rfc4571` streams to carry the upstream SDP (so the reader can
8836
+ * route RTP packets to the right depacketizer without an in-band
8837
+ * DESCRIBE phase). Other kinds typically leave it undefined.
8838
+ */
8839
+ metadata: record(string(), unknown()).optional()
8840
+ });
8841
+ var ProfileSlotStatusSchema = _enum([
8842
+ "unassigned",
8843
+ "idle",
8844
+ "connecting",
8845
+ "streaming",
8846
+ "error"
8847
+ ]);
8848
+ var ProfileSlotSchema = object({
8849
+ deviceId: number().int().nonnegative(),
8850
+ profile: CamProfileSchema,
8851
+ /** Broker id the rest of the system addresses: `${deviceId}/${profile}`. */
8852
+ brokerId: string(),
8853
+ /** `null` when the profile is unassigned. */
8854
+ sourceCamStreamId: string().nullable(),
8855
+ status: ProfileSlotStatusSchema,
8856
+ resolution: CamStreamResolutionSchema.optional(),
8857
+ codec: string().optional(),
8858
+ preBufferSec: number().nonnegative().optional(),
8859
+ errorMessage: string().optional()
8860
+ });
8861
+ /**
8862
+ * Zod schema for StreamSourceEntry — the canonical stream descriptor
8863
+ * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
8864
+ */
8865
+ var StreamSourceEntrySchema$1 = object({
8866
+ id: string(),
8867
+ label: string(),
8868
+ protocol: _enum([
8869
+ "rtsp",
8870
+ "rtmp",
8871
+ "annexb",
8872
+ "http-mjpeg",
8873
+ "webrtc",
8874
+ "custom"
8875
+ ]),
8876
+ url: string().optional(),
8877
+ resolution: object({
8878
+ width: number(),
8879
+ height: number()
8880
+ }).readonly().optional(),
8881
+ fps: number().optional(),
8882
+ bitrate: number().optional(),
8883
+ codec: string().optional(),
8884
+ profileHint: CamProfileSchema.optional()
8885
+ });
8886
+ object({
8887
+ type: string(),
8888
+ url: string(),
8889
+ videoCodec: string().optional(),
8890
+ audioCodec: string().optional(),
8891
+ metadata: record(string(), unknown()).readonly().optional()
8892
+ });
8893
+ /**
8894
+ * Wire schema for `FrameHandle` — a zero-pixel, serialisable reference to a
8895
+ * frame in a shared-memory ring (Phase 5 / D9). Mirrors the `FrameHandle` TS
8896
+ * interface in `interfaces/frame-handle.ts` field-for-field so a cap method
8897
+ * (the runner's native-crop and pipeline-executor inputs) can carry handles
8898
+ * over tRPC / Moleculer.
8899
+ *
8900
+ * The `satisfies` assertion below pins this schema to the interface: if a
8901
+ * field is added to / removed from `FrameHandle` without a matching schema
8902
+ * edit, `z.infer<typeof FrameHandleSchema>` stops being assignable to
8903
+ * `FrameHandle` and the build fails — no silent drift.
8904
+ */
8905
+ var FrameHandleSchema = object({
8906
+ shmId: string(),
8907
+ slot: number().int().nonnegative(),
8908
+ seq: number().int().nonnegative(),
8909
+ width: number().int().positive(),
8910
+ height: number().int().positive(),
8911
+ format: _enum([
8912
+ "jpeg",
8913
+ "rgb",
8914
+ "bgr",
8915
+ "yuv420",
8916
+ "gray"
8917
+ ]),
8918
+ pts: number(),
8919
+ byteLength: number().int().nonnegative(),
8920
+ nodeId: string(),
8921
+ slotCount: number().int().positive()
8922
+ });
8923
+ /**
8924
+ * Wire schema for a decoded audio chunk (Phase 5 / D9). Mirrors the
8925
+ * `DecodedAudioChunk` TS interface in `interfaces/stream-broker.ts`: PCM
8926
+ * sample bytes plus the track parameters a consumer needs to interpret them.
8927
+ *
8928
+ * Audio chunks are tiny (a ~500ms AudioCodecSession window is a few KB of
8929
+ * Float32 PCM), so unlike video frames they ship their bytes INLINE over
8930
+ * tRPC / Moleculer — no shared-memory plane. `data` is typed `Uint8Array`
8931
+ * (the wire-serialisable supertype of `Buffer`); a `Buffer` is assignable to
8932
+ * it.
8933
+ */
8934
+ var AudioChunkFormatSchema = _enum(AUDIO_CHUNK_FORMATS);
8935
+ var DecodedAudioChunkSchema = object({
8936
+ data: _instanceof(Uint8Array),
8937
+ sampleRate: number().int().positive(),
8938
+ channels: number().int().positive(),
8939
+ timestamp: number(),
8940
+ /**
8941
+ * Byte format of `data`. ABSENT MEANS `f32le` — today's bytes, byte for
8942
+ * byte, for any peer that never heard of this field. A coded window
8943
+ * (`pcmu` / `pcma`, one byte per sample) is only ever emitted to a
8944
+ * subscription that DECLARED it accepts one, so absence can never mean
8945
+ * "coded bytes a consumer will read as floats" (D455).
8946
+ */
8947
+ format: AudioChunkFormatSchema.optional()
8948
+ });
8949
+ /**
8950
+ * Input for `stream-broker.subscribeAudioChunks` (Phase 5 / D9). Audio ships
8951
+ * its bytes inline: a consumer asks the broker for the decoded audio-chunk
8952
+ * stream of one broker; the broker keeps a per-subscription bounded FIFO queue
8953
+ * the consumer drains via `pullAudioChunks`.
8954
+ */
8955
+ var SubscribeAudioChunksInputSchema = object({
8956
+ brokerId: string(),
8957
+ /** Short caller-identity tag (`audio-analyzer`, …) for `listClients`. */
8958
+ tag: string().optional(),
8959
+ /**
8960
+ * Byte formats this subscriber can READ, best first. The broker serves the
8961
+ * chunk's own format when it is in this list and expands to `f32le`
8962
+ * otherwise, so a subscriber is never handed bytes it cannot interpret.
8963
+ *
8964
+ * Absent (or without the source format) means `f32le` — the behaviour every
8965
+ * subscriber had before D455, unchanged. This is the negotiation half of
8966
+ * the source-bytes lever: it is what lets the broker and its consumers
8967
+ * deploy one at a time across three nodes.
8968
+ */
8969
+ accept: array(AudioChunkFormatSchema).readonly().optional()
8970
+ });
8971
+ /** Result of `stream-broker.subscribeAudioChunks`. */
8972
+ var SubscribeAudioChunksResultSchema = object({
8973
+ /** Opaque id passed to `pullAudioChunks` / `unsubscribeAudioChunks`. */
8974
+ subscriptionId: string() });
8975
+ var BrokerStatsSchema = object({
8976
+ status: _enum([
8977
+ "idle",
8978
+ "connecting",
8979
+ "streaming",
8980
+ "error",
8981
+ "stopped"
8982
+ ]),
8983
+ inputFps: number(),
8984
+ encodedSubscribers: number(),
8985
+ uptimeMs: number(),
8986
+ bitrateKbps: number(),
8987
+ idrIntervalMs: number(),
8988
+ codec: string().optional(),
8989
+ totalBytes: number(),
8990
+ packetCount: number(),
8991
+ rtspClients: number(),
8992
+ pipeClients: number(),
8993
+ preBufferSec: number(),
8994
+ preBufferMs: number(),
8995
+ preBufferPackets: number(),
8996
+ /**
8997
+ * Detected audio track parameters from the RTSP DESCRIBE / SDP. `null`
8998
+ * when the stream has no audio track or the broker is in cold start.
8999
+ * `supported = false` means the codec was detected but the local
9000
+ * decoder pipeline cannot produce PCM chunks (e.g. AAC without the
9001
+ * AAC pipeline wired). Surfaced in the UI device-overview so operators
9002
+ * can pre-pick the audio-analysis model that matches the codec.
9003
+ */
9004
+ audio: object({
9005
+ codec: string(),
9006
+ sampleRate: number(),
9007
+ channels: number(),
9008
+ supported: boolean()
9009
+ }).nullable().optional(),
9010
+ /**
9011
+ * BROKER-SIDE AUDIO MUTE (D83). `true` = this broker is deliberately
9012
+ * distributing none of the device's audio, on live or recording.
9013
+ *
9014
+ * Present so a silent camera can be told apart from a broken one on the
9015
+ * stream panel itself, without cross-referencing the switch group: a
9016
+ * broker holding an `audio` track descriptor while `audioMuted` is true is
9017
+ * working exactly as asked. `audioMutedDropped` counts the audio units
9018
+ * thrown away since the current dial — it is how you confirm from stats
9019
+ * alone that the mute is on the packet path and not merely persisted.
9020
+ */
9021
+ audioMuted: boolean().optional(),
9022
+ audioMutedDropped: number().optional()
9023
+ });
9024
+ /**
9025
+ * Exporter-facing "profile restream" entry. Returned by
9026
+ * `cameraStreams.getProfileRtspEntries` — one per ASSIGNED profile slot
9027
+ * (high/mid/low). `brokerId` is the PROFILE-keyed broker id
9028
+ * (`${deviceId}/${profile}`, e.g. `15/high`); its `url` is a broker
9029
+ * RTSP restream that aliases the profile's assigned source broker, so
9030
+ * every consumer dialling a profile converges on the same single pull.
9031
+ * `codec`/`resolution` describe the assigned SOURCE camStream (for the
9032
+ * `auto` resolution-closest pick). Distinct from `RtspRestreamEntry`
9033
+ * (raw per-camStream, live-view only).
9034
+ */
9035
+ var ProfileRtspEntrySchema = object({
9036
+ profile: CamProfileSchema,
9037
+ /** Profile-keyed broker id, format `${deviceId}/${profile}` (e.g. `"15/high"`). */
9038
+ brokerId: string(),
9039
+ url: string(),
9040
+ mutedUrl: string(),
9041
+ enabled: boolean(),
9042
+ codec: string().optional(),
9043
+ resolution: CamStreamResolutionSchema.optional()
9044
+ });
9045
+ /**
9046
+ * The model weight formats a catalog entry can ship. Schema-free on purpose:
9047
+ * `types/models.ts` builds Zod schemas from it, but a runner-closure consumer
9048
+ * (the model downloader in `@camstack/server/system`) needs only the list and must
9049
+ * reach it through `@camstack/types/addon` without building the cap schema
9050
+ * graph (D28).
9051
+ */
9052
+ var MODEL_FORMATS = [
9053
+ "onnx",
9054
+ "coreml",
9055
+ "openvino",
9056
+ "tflite",
9057
+ "pt",
9058
+ "gguf"
9059
+ ];
8546
9060
  /**
8547
9061
  * `addon-pages-source` — collection cap exposing per-provider raw page
8548
9062
  * declarations. Every addon that contributes a UI page registers a
@@ -8806,6 +9320,7 @@ var CAP_NAMES = Object.freeze([
8806
9320
  "mesh-network",
8807
9321
  "meter",
8808
9322
  "metrics-provider",
9323
+ "migrations",
8809
9324
  "model-convert",
8810
9325
  "model-distributor",
8811
9326
  "motion",
@@ -8838,6 +9353,7 @@ var CAP_NAMES = Object.freeze([
8838
9353
  "plate-gallery",
8839
9354
  "platform-probe",
8840
9355
  "power-meter",
9356
+ "power-source",
8841
9357
  "presence",
8842
9358
  "pressure-sensor",
8843
9359
  "privacy-mask",
@@ -10189,6 +10705,13 @@ Object.freeze({
10189
10705
  "valueType": "number"
10190
10706
  }
10191
10707
  ],
10708
+ "power-source": [{
10709
+ "path": "switchOn",
10710
+ "valueType": "boolean"
10711
+ }, {
10712
+ "path": "offSeconds",
10713
+ "valueType": "number"
10714
+ }],
10192
10715
  "presence": [
10193
10716
  {
10194
10717
  "path": "state",
@@ -10700,379 +11223,7 @@ object({
10700
11223
  params: record(string(), union([string(), number()])).optional()
10701
11224
  });
10702
11225
  //#endregion
10703
- //#region ../types/dist/err-msg-BD5buxvT.mjs
10704
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
10705
- DeviceType["Camera"] = "camera";
10706
- DeviceType["Hub"] = "hub";
10707
- DeviceType["Light"] = "light";
10708
- DeviceType["Siren"] = "siren";
10709
- DeviceType["Switch"] = "switch";
10710
- DeviceType["Sensor"] = "sensor";
10711
- DeviceType["Thermostat"] = "thermostat";
10712
- /** Air-conditioner / heat-pump climate device (HVAC) — shares the
10713
- * `climate-control` cap surface with `Thermostat` but renders a
10714
- * dedicated AC-appropriate control UI (mode chips, fan speed,
10715
- * independent vertical/horizontal swing). Sources: native Gree, and
10716
- * reusable by other AC integrations. */
10717
- DeviceType["Climate"] = "climate";
10718
- DeviceType["Button"] = "button";
10719
- /** Generic stateless event emitter — carries a device's EXACT declared
10720
- * event vocabulary verbatim (no normalization). Installed with the
10721
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
10722
- * HA bus events (e.g. `zha_event`, generic). */
10723
- DeviceType["EventEmitter"] = "event-emitter";
10724
- /** Firmware/software update entity — current vs available version,
10725
- * updatable flag, update state, and an install action. Installed with
10726
- * the `update` cap. Sources: Homematic firmware-update channels (and
10727
- * reusable by other providers, e.g. HA `update.*` entities). */
10728
- DeviceType["Update"] = "update";
10729
- DeviceType["Generic"] = "generic";
10730
- /** Generic notification delivery target (HA `notify.<service>`, future
10731
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
10732
- * endpoint; the `notifier` cap defines the send surface. */
10733
- DeviceType["Notifier"] = "notifier";
10734
- /** Pre-recorded action sequence with optional parameters
10735
- * (HA `script.*`). Runnable via `script-runner` cap. */
10736
- DeviceType["Script"] = "script";
10737
- /** Automation rule (HA `automation.*`) — enable/disable + manual
10738
- * trigger surface exposed via `automation-control` cap. */
10739
- DeviceType["Automation"] = "automation";
10740
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
10741
- DeviceType["Lock"] = "lock";
10742
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
10743
- * `valve.*`). `cover` cap with sub-roles for variant. */
10744
- DeviceType["Cover"] = "cover";
10745
- /** Pipe / water / gas valve with open/close/stop and optional
10746
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
10747
- * modelled on the same open/closed lifecycle. */
10748
- DeviceType["Valve"] = "valve";
10749
- /** Humidifier / dehumidifier with on/off + target humidity + mode
10750
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
10751
- * modelled on the same target / mode lifecycle. */
10752
- DeviceType["Humidifier"] = "humidifier";
10753
- /** Water heater / boiler with target temperature + operation mode +
10754
- * away mode (HA `water_heater.*`). `water-heater` cap — a
10755
- * climate-family actuator. */
10756
- DeviceType["WaterHeater"] = "water-heater";
10757
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
10758
- DeviceType["Fan"] = "fan";
10759
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
10760
- * the camera surface — those use `Camera`. `media-player` cap. */
10761
- DeviceType["MediaPlayer"] = "media-player";
10762
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
10763
- * `alarm-panel` cap. */
10764
- DeviceType["AlarmPanel"] = "alarm-panel";
10765
- /** Generic user-settable input (HA `number` / `input_number` / `select`
10766
- * / `input_select` / `text` / `input_text` / `input_datetime`).
10767
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
10768
- * TextControl / DateTimeControl. */
10769
- DeviceType["Control"] = "control";
10770
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
10771
- * `presence` cap. */
10772
- DeviceType["Presence"] = "presence";
10773
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
10774
- * `weather` cap. */
10775
- DeviceType["Weather"] = "weather";
10776
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
10777
- DeviceType["Vacuum"] = "vacuum";
10778
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
10779
- * `lawn-mower-control` cap. */
10780
- DeviceType["LawnMower"] = "lawn-mower";
10781
- /** Physical HA device group — parent container for entity-children
10782
- * adopted from a single HA device entry. Not renderable as a
10783
- * standalone device; exists only to anchor child entities. */
10784
- DeviceType["Container"] = "container";
10785
- /** Single still-image entity (HA `image.*`). Read-only display of an
10786
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
10787
- DeviceType["Image"] = "image";
10788
- /** Smart pet feeder — cloud-connected food dispenser with a bowl food
10789
- * level, battery, desiccant life, feeding state and manual-feed /
10790
- * call-pet / maintenance actions. Installed with the `pet-feeder` cap;
10791
- * dual-hopper models (D4S/D4SH) expose per-hopper portions. Sources:
10792
- * native PetKit (`nodepetkit` `FeederDevice`), reusable by other feeder
10793
- * integrations sharing the same food/desiccant/hopper surface. */
10794
- DeviceType["PetFeeder"] = "pet-feeder";
10795
- /** Pet water fountain — tank level, water drunk, pump and its duty cycle.
10796
- * Installed with the `pet-fountain` cap. Reaches CamStack as loose entities
10797
- * of a container and is BUILT as a composed device (D967). */
10798
- DeviceType["PetFountain"] = "pet-fountain";
10799
- /** Built-in dishwasher — program lifecycle, door / remote-start gates,
10800
- * salt and rinse-aid levels. Installed with the `dishwasher` cap.
10801
- * Sources: native Bosch Home Connect, reusable by similar integrations.
10802
- * A plug-built dishwasher carries running-state and power instead. */
10803
- DeviceType["Dishwasher"] = "dishwasher";
10804
- /** Washing machine. A plug-built one is running while its power stays
10805
- * above a threshold. No program cap — that surface is the dishwasher's. */
10806
- DeviceType["Washer"] = "washer";
10807
- /** Tumble dryer. Same plug-built running surface as {@link Washer}. */
10808
- DeviceType["Dryer"] = "dryer";
10809
- /** The physical bridge box of a vendor ecosystem (Velux KLF-200, and later
10810
- * other radio-to-IP bridges). It carries the box's own facts (firmware,
10811
- * address, connection state) and the actions the box really supports
10812
- * (`reboot`, `device-admin-link`). Products are NOT its children — they are
10813
- * adopted beside it — and its connection settings stay on the integration. */
10814
- DeviceType["Gateway"] = "gateway";
10815
- return DeviceType;
10816
- }({});
10817
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
10818
- DeviceFeature["BatteryOperated"] = "battery-operated";
10819
- DeviceFeature["Rebootable"] = "rebootable";
10820
- /**
10821
- * Device supports an on-demand re-sync of its derived spec with its
10822
- * upstream source — drives the generic Re-sync button. The owning
10823
- * provider implements the action via the `device-adoption.resync` cap.
10824
- */
10825
- DeviceFeature["Resyncable"] = "resyncable";
10826
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
10827
- DeviceFeature["DoorbellButton"] = "doorbell-button";
10828
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
10829
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
10830
- /**
10831
- * Camera supports the on-firmware autotrack subsystem (subject-
10832
- * following). Distinct from `PanTiltZoom` because not every PTZ
10833
- * camera ships autotrack — the admin UI uses this flag to gate
10834
- * the autotrack toggle / settings card without re-deriving from
10835
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
10836
- * driver sets this feature when probe confirms the firmware
10837
- * surface, and registers the cap in the same code path.
10838
- */
10839
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
10840
- /**
10841
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
10842
- * motion detection automatically activates this device. Mirrors
10843
- * `motion-trigger` cap registration: drivers set this feature in the
10844
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
10845
- *
10846
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
10847
- * fast scalar without binding fetch), notifier rules, and `listAll`
10848
- * filters that want "all devices with on-motion behaviour".
10849
- */
10850
- DeviceFeature["MotionTrigger"] = "motion-trigger";
10851
- /** Light supports rgb-triplet color via `color` cap. */
10852
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
10853
- /** Light supports HSV color via `color` cap. */
10854
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
10855
- /** Light supports color-temperature (mired) via `color` cap. */
10856
- DeviceFeature["LightColorMired"] = "light-color-mired";
10857
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
10858
- * targetHigh). Gates the range slider UI. */
10859
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
10860
- /** Thermostat exposes target humidity and/or current humidity
10861
- * readings. Gates the humidity controls. */
10862
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
10863
- /** Thermostat exposes a fan-mode selector. */
10864
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
10865
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
10866
- DeviceFeature["ClimatePreset"] = "climate-preset";
10867
- /** Thermostat exposes a vertical louver swing toggle. Gates the
10868
- * vertical-swing switch in the climate UI. Independent of horizontal. */
10869
- DeviceFeature["ClimateSwingVertical"] = "climate-swing-vertical";
10870
- /** Thermostat exposes a horizontal louver swing toggle. Gates the
10871
- * horizontal-swing switch in the climate UI. Independent of vertical. */
10872
- DeviceFeature["ClimateSwingHorizontal"] = "climate-swing-horizontal";
10873
- /** Cover exposes intermediate position control (0..100). Gates the
10874
- * position slider UI. */
10875
- DeviceFeature["CoverPositionable"] = "cover-positionable";
10876
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
10877
- DeviceFeature["CoverTilt"] = "cover-tilt";
10878
- /** Valve exposes intermediate position control (0..100). Gates the
10879
- * position slider / drag surface UI. */
10880
- DeviceFeature["ValvePositionable"] = "valve-positionable";
10881
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
10882
- DeviceFeature["FanSpeed"] = "fan-speed";
10883
- /** Fan exposes a preset mode selector. */
10884
- DeviceFeature["FanPreset"] = "fan-preset";
10885
- /** Fan exposes blade direction (forward/reverse) — typical of
10886
- * ceiling fans. */
10887
- DeviceFeature["FanDirection"] = "fan-direction";
10888
- /** Fan exposes an oscillation toggle. */
10889
- DeviceFeature["FanOscillating"] = "fan-oscillating";
10890
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
10891
- * field on the UI lock-controls panel. */
10892
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
10893
- /** Lock supports a latch-release ("open door") action distinct from
10894
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
10895
- * `supported_features`. Gates the Open Door button in the UI. */
10896
- DeviceFeature["LockOpen"] = "lock-open";
10897
- /** Media player exposes a seek-to-position surface. */
10898
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
10899
- /** Media player exposes a volume-level setter. */
10900
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
10901
- /** Media player exposes a mute toggle distinct from volume=0. */
10902
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
10903
- /** Media player exposes a shuffle toggle. */
10904
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
10905
- /** Media player exposes a repeat mode (off / all / one). */
10906
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
10907
- /** Media player exposes a source / input selector. */
10908
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
10909
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
10910
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
10911
- /** Media player exposes next-track. */
10912
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
10913
- /** Media player exposes previous-track. */
10914
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
10915
- /** Media player exposes stop distinct from pause. */
10916
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
10917
- /** Alarm panel requires a PIN code on arm/disarm. */
10918
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
10919
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
10920
- * addition to a textual location. */
10921
- DeviceFeature["PresenceGps"] = "presence-gps";
10922
- /** Notifier accepts an inline / URL image attachment. */
10923
- DeviceFeature["NotifierImage"] = "notifier-image";
10924
- /** Notifier accepts a priority hint (high/normal/low). */
10925
- DeviceFeature["NotifierPriority"] = "notifier-priority";
10926
- /** Notifier accepts a free-form `data` payload for platform-specific
10927
- * fields. */
10928
- DeviceFeature["NotifierData"] = "notifier-data";
10929
- /** Notifier supports interactive action buttons / callbacks. */
10930
- DeviceFeature["NotifierActions"] = "notifier-actions";
10931
- /** Notifier supports per-call recipient targeting (multi-user). */
10932
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
10933
- /** Script runner accepts a variables map on each run invocation. */
10934
- DeviceFeature["ScriptVariables"] = "script-variables";
10935
- /** Automation `trigger` accepts a skipCondition flag — fires the
10936
- * automation's actions while bypassing its condition block. */
10937
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
10938
- /** Robot vacuum exposes a live cleaning map (image child). Gates the
10939
- * map tile in the vacuum UI. */
10940
- DeviceFeature["VacuumHasMap"] = "vacuum-has-map";
10941
- /** Robot vacuum exposes AI obstacle-detection toggles. Gates the AI
10942
- * switches group. */
10943
- DeviceFeature["VacuumHasAi"] = "vacuum-has-ai";
10944
- /** Robot mower exposes a live mowing map (SVG image child). Gates the
10945
- * mower map tile. */
10946
- DeviceFeature["MowerHasMap"] = "mower-has-map";
10947
- /** Robot mower exposes targeted mowing (all-area / zones / edges /
10948
- * spots) — gates the Mow action + map selectors. */
10949
- DeviceFeature["MowerHasTargetedMowing"] = "mower-has-targeted-mowing";
10950
- return DeviceFeature;
10951
- }({});
10952
- /**
10953
- * Semantic role a device plays within its parent. Populated by driver
10954
- * addons when creating accessory devices (Reolink siren/floodlight/
10955
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
10956
- * admin UI to pick icons, labels, and widgets — a `Switch` with
10957
- * `role: Floodlight` renders as a bulb with a brightness slider,
10958
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
10959
- *
10960
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
10961
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
10962
- */
10963
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
10964
- DeviceRole["Siren"] = "siren";
10965
- DeviceRole["Floodlight"] = "floodlight";
10966
- DeviceRole["Spotlight"] = "spotlight";
10967
- DeviceRole["PirSensor"] = "pir-sensor";
10968
- DeviceRole["Chime"] = "chime";
10969
- DeviceRole["Autotrack"] = "autotrack";
10970
- DeviceRole["Nightvision"] = "nightvision";
10971
- DeviceRole["PrivacyMask"] = "privacy-mask";
10972
- DeviceRole["Doorbell"] = "doorbell";
10973
- /** Interior blind / shade / roller blind. HA `device_class: blind|shade`. */
10974
- DeviceRole["CoverBlind"] = "cover-blind";
10975
- /** Exterior roller shutter. HA `device_class: shutter`; Homematic BROLL. */
10976
- DeviceRole["CoverShutter"] = "cover-shutter";
10977
- /** Exterior awning. HA `device_class: awning`. */
10978
- DeviceRole["CoverAwning"] = "cover-awning";
10979
- /** Curtain / drape. HA `device_class: curtain`. */
10980
- DeviceRole["CoverCurtain"] = "cover-curtain";
10981
- /** Garage door. HA `device_class: garage`. A security actuator: exports gate it. */
10982
- DeviceRole["CoverGarage"] = "cover-garage";
10983
- /** Gate. HA `device_class: gate`. A security actuator: exports gate it. */
10984
- DeviceRole["CoverGate"] = "cover-gate";
10985
- /** Door. HA `device_class: door`. A security actuator: exports gate it. */
10986
- DeviceRole["CoverDoor"] = "cover-door";
10987
- /** Window. HA `device_class: window`. */
10988
- DeviceRole["CoverWindow"] = "cover-window";
10989
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
10990
- * real Switch device for UI rendering / export adapters. */
10991
- DeviceRole["BinaryHelper"] = "binary-helper";
10992
- /** A smart plug: a `switch` whose source says it is an outlet (HA
10993
- * `device_class: outlet`). The Alexa export shows it as a SMARTPLUG. */
10994
- DeviceRole["Outlet"] = "outlet";
10995
- /** Generic motion / occupancy / moving event source. Distinct from
10996
- * the camera accessory PirSensor role: that one is a camera child;
10997
- * this is a standalone HA / 3rd-party motion sensor. */
10998
- DeviceRole["MotionSensor"] = "motion-sensor";
10999
- DeviceRole["ContactSensor"] = "contact-sensor";
11000
- DeviceRole["LeakSensor"] = "leak-sensor";
11001
- DeviceRole["SmokeSensor"] = "smoke-sensor";
11002
- DeviceRole["COSensor"] = "co-sensor";
11003
- DeviceRole["GasSensor"] = "gas-sensor";
11004
- DeviceRole["TamperSensor"] = "tamper-sensor";
11005
- DeviceRole["VibrationSensor"] = "vibration-sensor";
11006
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
11007
- DeviceRole["SoundSensor"] = "sound-sensor";
11008
- /** Fallback for `binary_sensor` without a known `device_class`. */
11009
- DeviceRole["BinarySensor"] = "binary-sensor";
11010
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
11011
- DeviceRole["HumiditySensor"] = "humidity-sensor";
11012
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
11013
- DeviceRole["PressureSensor"] = "pressure-sensor";
11014
- /** Wind speed or direction (weather-station `wind-sensor` cap). */
11015
- DeviceRole["WindSensor"] = "wind-sensor";
11016
- /** Rain accumulation or rate (weather-station `rain-sensor` cap). */
11017
- DeviceRole["RainSensor"] = "rain-sensor";
11018
- /** UV index (weather-station `uv-sensor` cap). */
11019
- DeviceRole["UvSensor"] = "uv-sensor";
11020
- /** Solar irradiance W/m² (weather-station `solar-radiation-sensor` cap).
11021
- * Distinct from AmbientLightSensor (lux). */
11022
- DeviceRole["SolarRadiationSensor"] = "solar-radiation-sensor";
11023
- /** Soil moisture % (garden/weather `soil-moisture-sensor` cap). */
11024
- DeviceRole["SoilMoistureSensor"] = "soil-moisture-sensor";
11025
- DeviceRole["PowerSensor"] = "power-sensor";
11026
- DeviceRole["EnergySensor"] = "energy-sensor";
11027
- DeviceRole["VoltageSensor"] = "voltage-sensor";
11028
- DeviceRole["CurrentSensor"] = "current-sensor";
11029
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
11030
- /** Battery level (numeric % via `sensor` OR low-bool via
11031
- * `binary_sensor` — the cap distinguishes via the value type). */
11032
- DeviceRole["BatterySensor"] = "battery-sensor";
11033
- /** Fallback for `sensor` numeric without a known `device_class`. */
11034
- DeviceRole["NumericSensor"] = "numeric-sensor";
11035
- /** String / enum state (HA `sensor` with `state_class: enum` or
11036
- * `attributes.options`). */
11037
- DeviceRole["EnumSensor"] = "enum-sensor";
11038
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
11039
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
11040
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
11041
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
11042
- /** Last-resort fallback when nothing else matches. */
11043
- DeviceRole["GenericSensor"] = "generic-sensor";
11044
- DeviceRole["NumericControl"] = "numeric-control";
11045
- DeviceRole["SelectControl"] = "select-control";
11046
- DeviceRole["TextControl"] = "text-control";
11047
- DeviceRole["DateTimeControl"] = "datetime-control";
11048
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
11049
- * rich features (image, priority, channel routing). */
11050
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
11051
- /** Chat / messaging service (HA `notify.telegram_*`,
11052
- * `notify.discord_*`, etc.). */
11053
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
11054
- /** Email-based delivery (HA `notify.smtp`, etc.). */
11055
- DeviceRole["EmailNotifier"] = "email-notifier";
11056
- /** Fallback when the notifier service name doesn't match a known
11057
- * pattern. */
11058
- DeviceRole["GenericNotifier"] = "generic-notifier";
11059
- /** Emits a pulse train (infrared or RF) on request — the `ir-transmitter`
11060
- * cap. A `DeviceType.Generic` device. */
11061
- DeviceRole["IrTransmitter"] = "ir-transmitter";
11062
- return DeviceRole;
11063
- }({});
11064
- /**
11065
- import { errMsg } from '@camstack/types'
11066
- * Extract a human-readable message from an unknown error value.
11067
- * Replaces the ubiquitous `errMsg(err)` pattern.
11068
- */
11069
- function errMsg$1(err) {
11070
- if (err instanceof Error) return err.message;
11071
- if (typeof err === "string") return err;
11072
- return String(err);
11073
- }
11074
- //#endregion
11075
- //#region ../types/dist/composition-C7WdThmP.mjs
11226
+ //#region ../types/dist/composition-BBzVf2xd.mjs
11076
11227
  /**
11077
11228
  * The ffmpeg build every CamStack node downloads, per platform and arch.
11078
11229
  *
@@ -12291,6 +12442,90 @@ var EventOwnerTypeSchema = _enum(EVENT_OWNER_TYPES);
12291
12442
  var MediaPresenceOwnerKindSchema = _enum([...EVENT_OWNER_TYPES, "track"]);
12292
12443
  new Set(EVENT_OWNER_TYPES);
12293
12444
  /**
12445
+ * What a published package needs from the rest of the install (D989).
12446
+ *
12447
+ * One published framework package (`@camstack/server`) carries the kernel, the
12448
+ * builtins and the capability contracts, so "which addon runs on which
12449
+ * framework" is a question of version, and the answer is DECLARED by the
12450
+ * package that knows it:
12451
+ *
12452
+ * - an addon says the oldest server it runs on (`requires.server: ">=X"`);
12453
+ * - the server says the oldest addon it works with
12454
+ * (`requires.addons: { "@camstack/addon-x": ">=Y" }`) and the oldest shell
12455
+ * around it (`requires.wrapper: { desktop, image }`);
12456
+ * - a wrapper (the desktop app, the container starter) says which server
12457
+ * range it can host, and reports its own kind and version.
12458
+ *
12459
+ * The publish workflow STAMPS these after the version bump
12460
+ * (`scripts/ci/stamp-requires.mjs`); nobody types a number by hand.
12461
+ *
12462
+ * A requirement that cannot be checked is NOT met: a shell that reports no
12463
+ * version counts as below the minimum, and an unreadable running version is
12464
+ * named in the result (a failed read is never a pass).
12465
+ */
12466
+ /** `>=MAJOR.MINOR.PATCH[-prerelease]` — the only range shape a requirement uses. */
12467
+ var MinVersionSchema = string().regex(/^>=\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/, "a minimum is written \">=X.Y.Z\"");
12468
+ object({
12469
+ /** The oldest `@camstack/server` this package runs on. */
12470
+ server: MinVersionSchema.optional(),
12471
+ /** The oldest installed version of each named addon package. */
12472
+ addons: record(string(), MinVersionSchema).optional(),
12473
+ /** The oldest shell around the server, per shell kind. */
12474
+ wrapper: object({
12475
+ desktop: MinVersionSchema.optional(),
12476
+ image: MinVersionSchema.optional()
12477
+ }).optional()
12478
+ });
12479
+ /** One unmet requirement; each names the versions on both sides. */
12480
+ var UnmetRequirementSchema = discriminatedUnion("kind", [
12481
+ object({
12482
+ kind: literal("server-too-old"),
12483
+ required: string(),
12484
+ /** `null` — the running server version could not be read. */
12485
+ running: string().nullable()
12486
+ }),
12487
+ object({
12488
+ kind: literal("addon-too-old"),
12489
+ packageName: string(),
12490
+ required: string(),
12491
+ /** `null` — the addon is not installed (or its version is unreadable). */
12492
+ running: string().nullable()
12493
+ }),
12494
+ object({
12495
+ kind: literal("wrapper-too-old"),
12496
+ wrapper: _enum(["desktop", "image"]),
12497
+ required: string(),
12498
+ /** `null` — the wrapper reported no version. */
12499
+ running: string().nullable()
12500
+ })
12501
+ ]);
12502
+ var RequiredAddonUpdateSchema = object({
12503
+ packageName: string(),
12504
+ /** The minimum the target server declares. */
12505
+ required: string(),
12506
+ /** What this node has; `null` when the addon is not installed. */
12507
+ installed: string().nullable()
12508
+ });
12509
+ /**
12510
+ * Which integration instance a settings form is for. An addon that serves several instances
12511
+ * (`instanceMode: multiple`) can show a different form per instance — an NVR integration
12512
+ * needs its connection, the default integration needs the addon's own sections.
12513
+ *
12514
+ * - `integrationId` is `null` in the create wizard: nothing exists yet, the operator is
12515
+ * setting up a NEW instance.
12516
+ * - `mode` is the wizard mode of the integration type (`getAvailableTypes`).
12517
+ * - `candidateStableId` is the discovery candidate a wizard was seeded from, if any.
12518
+ */
12519
+ var IntegrationInstanceRefSchema = object({
12520
+ integrationId: string().nullable(),
12521
+ mode: _enum([
12522
+ "standalone",
12523
+ "account",
12524
+ "broker"
12525
+ ]),
12526
+ candidateStableId: string().optional()
12527
+ });
12528
+ /**
12294
12529
  * Build an `IAddonRouteProvider` from a list of routes. Implements
12295
12530
  * both the operator-facing `getRoutes` (returning route descriptors
12296
12531
  * minus the handlers, which can't cross JSON) and the framework-
@@ -12915,6 +13150,613 @@ var CameraSwitchGroupSchema = object({
12915
13150
  fetchedAt: number()
12916
13151
  });
12917
13152
  /**
13153
+ * Query filter for settings-store collections.
13154
+ */
13155
+ var QueryFilterSchema = object({
13156
+ where: record(string(), unknown()).optional(),
13157
+ whereIn: record(string(), array(unknown())).optional(),
13158
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13159
+ /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
13160
+ whereNot: record(string(), unknown()).optional(),
13161
+ /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
13162
+ * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
13163
+ whereNotIn: record(string(), array(unknown())).optional(),
13164
+ orderBy: object({
13165
+ field: string(),
13166
+ direction: _enum(["asc", "desc"])
13167
+ }).optional(),
13168
+ limit: number().optional(),
13169
+ offset: number().optional()
13170
+ });
13171
+ /**
13172
+ * The predicate half of a filter, for BULK MUTATIONS.
13173
+ *
13174
+ * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
13175
+ * meaning for a statement that rewrites a set, and accepting them would invite
13176
+ * a caller to believe `limit` bounds the damage. Every field is optional here
13177
+ * only so the shape stays composable — the implementation REJECTS a filter
13178
+ * that compiles to no predicate, because that is the whole collection.
13179
+ */
13180
+ var MutationFilterSchema = object({
13181
+ where: record(string(), unknown()).optional(),
13182
+ whereIn: record(string(), array(unknown())).optional(),
13183
+ whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
13184
+ whereNot: record(string(), unknown()).optional(),
13185
+ whereNotIn: record(string(), array(unknown())).optional()
13186
+ });
13187
+ /**
13188
+ * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
13189
+ *
13190
+ * `as` names the slot in the result, so the SAME column may be asked twice with
13191
+ * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
13192
+ * a `Record<column, op>` shape could not express.
13193
+ */
13194
+ var AggregateFieldSchema = object({
13195
+ /** Result key. */
13196
+ as: string().min(1),
13197
+ /** Column to aggregate. Must be a real column of a declared collection. */
13198
+ field: string().min(1),
13199
+ op: _enum([
13200
+ "sum",
13201
+ "min",
13202
+ "max"
13203
+ ])
13204
+ });
13205
+ /**
13206
+ * `COUNT(*)` plus one number per requested field.
13207
+ *
13208
+ * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
13209
+ * that really is 0 are different facts, and an accounting caller that renders
13210
+ * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
13211
+ */
13212
+ var AggregateResultSchema = object({
13213
+ count: number().int(),
13214
+ values: record(string(), number().nullable())
13215
+ });
13216
+ /** A single stored record: `{ id, data }`. */
13217
+ var SettingsRecordSchema = object({
13218
+ id: string(),
13219
+ data: record(string(), unknown())
13220
+ });
13221
+ /**
13222
+ * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
13223
+ * optional.
13224
+ *
13225
+ * A separate schema rather than loosening the shared one: every other method
13226
+ * on this cap addresses a row BY its id, and making that field optional
13227
+ * everywhere would turn a forgotten key into a silently generated one on
13228
+ * `update` and `delete` as well.
13229
+ */
13230
+ var BulkRecordSchema = object({
13231
+ id: string().optional(),
13232
+ data: record(string(), unknown())
13233
+ });
13234
+ /**
13235
+ * The database FILES one `sqlite-settings` engine process owns (D851).
13236
+ * Closed on purpose: a file is a thing the engine opens, backs up and gives a
13237
+ * serving thread, so a new one is a code change, never a string a caller
13238
+ * invents. `settings` is `camstack.db` and the default for every collection
13239
+ * that names no file.
13240
+ */
13241
+ var DataStoreDatabaseSchema = _enum([
13242
+ "settings",
13243
+ "events",
13244
+ "history"
13245
+ ]);
13246
+ DataStoreDatabaseSchema.options;
13247
+ /**
13248
+ * One write inside a {@link settingsStoreCapability.methods.transact} call.
13249
+ * The three that a "replace this set, bump that revision" write needs, plus
13250
+ * the batched upsert a rollup writer needs.
13251
+ */
13252
+ var TransactOpSchema = discriminatedUnion("op", [
13253
+ object({
13254
+ op: literal("deleteWhere"),
13255
+ collection: string(),
13256
+ filter: MutationFilterSchema
13257
+ }),
13258
+ object({
13259
+ op: literal("insertMany"),
13260
+ collection: string(),
13261
+ records: array(BulkRecordSchema).readonly()
13262
+ }),
13263
+ object({
13264
+ op: literal("update"),
13265
+ collection: string(),
13266
+ id: string(),
13267
+ data: record(string(), unknown())
13268
+ }),
13269
+ object({
13270
+ op: literal("upsertMany"),
13271
+ collection: string(),
13272
+ conflict: array(string()).readonly(),
13273
+ records: array(BulkRecordSchema).readonly()
13274
+ })
13275
+ ]);
13276
+ /**
13277
+ * The precondition of a transaction: the row `key` of `collection` must hold
13278
+ * `equals` in `column`, read INSIDE the transaction.
13279
+ */
13280
+ var TransactGuardSchema = object({
13281
+ collection: string(),
13282
+ key: string(),
13283
+ column: string(),
13284
+ equals: unknown()
13285
+ });
13286
+ /**
13287
+ * Column declaration for a structured (SQL-backed) collection.
13288
+ *
13289
+ * Logical types — the backend translates each to the matching SQLite
13290
+ * storage class and handles per-type marshaling:
13291
+ * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
13292
+ * - `JSON` — TEXT under the hood; serialised on write, parsed on read
13293
+ * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
13294
+ */
13295
+ var CollectionColumnSchema = object({
13296
+ name: string(),
13297
+ type: _enum([
13298
+ "TEXT",
13299
+ "INTEGER",
13300
+ "REAL",
13301
+ "JSON",
13302
+ "BOOLEAN"
13303
+ ]),
13304
+ primaryKey: boolean().optional(),
13305
+ notNull: boolean().optional(),
13306
+ unique: boolean().optional(),
13307
+ /**
13308
+ * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
13309
+ * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
13310
+ * collection surface simply cannot express their existing tables — which is
13311
+ * why they were still on the uncapped `table*` API.
13312
+ */
13313
+ defaultValue: union([
13314
+ string(),
13315
+ number(),
13316
+ boolean()
13317
+ ]).optional()
13318
+ });
13319
+ var CollectionIndexSchema = object({
13320
+ name: string(),
13321
+ columns: array(string()).readonly(),
13322
+ unique: boolean().optional()
13323
+ });
13324
+ /**
13325
+ * The input of `declareCollection` — ONE schema for the door and for the
13326
+ * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
13327
+ * the payload untouched).
13328
+ *
13329
+ * - `database` — the file the collection lives in (D851). Absent means
13330
+ * `settings`. A declaration naming a file other than the one the table is
13331
+ * already in is REFUSED by the engine, never moved.
13332
+ * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
13333
+ * as `primaryKey: true` on that column. A composite-keyed collection has no
13334
+ * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
13335
+ * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
13336
+ * address one row by id are refused.
13337
+ * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
13338
+ */
13339
+ var DeclareCollectionInputSchema = object({
13340
+ namespace: string().optional(),
13341
+ collection: string(),
13342
+ columns: array(CollectionColumnSchema).readonly(),
13343
+ indexes: array(CollectionIndexSchema).readonly().optional(),
13344
+ database: DataStoreDatabaseSchema.optional(),
13345
+ primaryKey: array(string()).readonly().optional(),
13346
+ withoutRowid: boolean().optional()
13347
+ });
13348
+ method(object({
13349
+ namespace: string().optional(),
13350
+ collection: string(),
13351
+ key: string()
13352
+ }), unknown(), { auth: "admin" }), method(object({
13353
+ namespace: string().optional(),
13354
+ collection: string(),
13355
+ key: string(),
13356
+ value: unknown()
13357
+ }), _void(), {
13358
+ kind: "mutation",
13359
+ auth: "admin"
13360
+ }), method(object({
13361
+ namespace: string().optional(),
13362
+ collection: string(),
13363
+ filter: QueryFilterSchema.optional(),
13364
+ columns: array(string()).readonly().optional()
13365
+ }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
13366
+ namespace: string().optional(),
13367
+ collection: string(),
13368
+ /** Declared columns identifying the slot; must be covered by a UNIQUE
13369
+ * index on the collection. Never empty. */
13370
+ conflict: array(string()).readonly(),
13371
+ record: BulkRecordSchema
13372
+ }), object({
13373
+ /** The id the row HAS: assigned by SQLite on an insert, or the existing
13374
+ * row's own id on an update. */
13375
+ id: union([string(), number()]) }), {
13376
+ kind: "mutation",
13377
+ auth: "admin"
13378
+ }), method(object({
13379
+ namespace: string().optional(),
13380
+ collection: string(),
13381
+ conflict: array(string()).readonly(),
13382
+ records: array(BulkRecordSchema).readonly()
13383
+ }), object({ upserted: number().int() }), {
13384
+ kind: "mutation",
13385
+ auth: "admin"
13386
+ }), method(object({
13387
+ namespace: string().optional(),
13388
+ collection: string(),
13389
+ record: object({
13390
+ id: string().optional(),
13391
+ data: record(string(), unknown())
13392
+ })
13393
+ }), object({
13394
+ /**
13395
+ * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
13396
+ * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
13397
+ * primary key — which is the only place an auto key is knowable.
13398
+ */
13399
+ id: union([string(), number()]) }), {
13400
+ kind: "mutation",
13401
+ auth: "admin"
13402
+ }), method(object({
13403
+ namespace: string().optional(),
13404
+ collection: string(),
13405
+ records: array(BulkRecordSchema).readonly()
13406
+ }), object({ inserted: number().int() }), {
13407
+ kind: "mutation",
13408
+ auth: "admin"
13409
+ }), method(object({
13410
+ namespace: string().optional(),
13411
+ guard: TransactGuardSchema.optional(),
13412
+ ops: array(TransactOpSchema).readonly()
13413
+ }), object({
13414
+ applied: boolean(),
13415
+ current: unknown().optional()
13416
+ }), {
13417
+ kind: "mutation",
13418
+ auth: "admin"
13419
+ }), method(object({
13420
+ namespace: string().optional(),
13421
+ collection: string(),
13422
+ id: string(),
13423
+ data: record(string(), unknown())
13424
+ }), _void(), {
13425
+ kind: "mutation",
13426
+ auth: "admin"
13427
+ }), method(object({
13428
+ namespace: string().optional(),
13429
+ collection: string(),
13430
+ key: string()
13431
+ }), _void(), {
13432
+ kind: "mutation",
13433
+ auth: "admin"
13434
+ }), method(object({
13435
+ namespace: string().optional(),
13436
+ collection: string(),
13437
+ filter: MutationFilterSchema
13438
+ }), object({ deleted: number().int() }), {
13439
+ kind: "mutation",
13440
+ auth: "admin"
13441
+ }), method(object({
13442
+ namespace: string().optional(),
13443
+ collection: string(),
13444
+ filter: MutationFilterSchema,
13445
+ data: record(string(), unknown())
13446
+ }), object({ updated: number().int() }), {
13447
+ kind: "mutation",
13448
+ auth: "admin"
13449
+ }), method(object({
13450
+ namespace: string().optional(),
13451
+ collection: string(),
13452
+ filter: QueryFilterSchema.optional()
13453
+ }), number(), { auth: "admin" }), method(object({
13454
+ namespace: string().optional(),
13455
+ collection: string(),
13456
+ fields: array(AggregateFieldSchema).readonly(),
13457
+ filter: QueryFilterSchema.optional()
13458
+ }), AggregateResultSchema, { auth: "admin" }), method(object({
13459
+ namespace: string().optional(),
13460
+ collection: string(),
13461
+ field: string(),
13462
+ bucketSize: number().int().positive(),
13463
+ origin: number().int(),
13464
+ filter: QueryFilterSchema.optional()
13465
+ }), array(object({
13466
+ bucket: number().int(),
13467
+ count: number().int()
13468
+ })).readonly(), { auth: "admin" }), method(object({
13469
+ namespace: string().optional(),
13470
+ collection: string()
13471
+ }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
13472
+ kind: "mutation",
13473
+ auth: "admin"
13474
+ });
13475
+ 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>\"");
13476
+ var MigrationLevelSchema = _enum([
13477
+ "hub-store",
13478
+ "addon-state",
13479
+ "node-config",
13480
+ "viewer",
13481
+ "addon-internal"
13482
+ ]);
13483
+ var MigrationStoreSchema = _enum([
13484
+ "settings",
13485
+ "events",
13486
+ "history",
13487
+ "node-local",
13488
+ "addon-files"
13489
+ ]);
13490
+ var MigrationScopeSchema = _enum(["cluster", "per-node"]);
13491
+ /** What depends on a migration while it is pending: `block-owner` is the default. */
13492
+ var MigrationOnFailureSchema = _enum(["block-owner", "tolerate"]);
13493
+ /**
13494
+ * `sql` is a hub-only body over the owner's connection. `plan` returns edits the
13495
+ * engine applies inside the migration's own transaction (hub-owned: computed in
13496
+ * that transaction; addon-owned: computed by the owner and shipped to the engine).
13497
+ * `procedure` is addon-owned work that is not SQL (keychain, integration registry,
13498
+ * device tombstones); the ledger records its outcome and it must be idempotent.
13499
+ */
13500
+ var MigrationBodyKindSchema = _enum([
13501
+ "sql",
13502
+ "plan",
13503
+ "procedure"
13504
+ ]);
13505
+ var MigrationMetaSchema = object({
13506
+ id: MigrationIdSchema,
13507
+ /** `hub`, an addon id, `node` or `viewer`. */
13508
+ owner: string().regex(/^[a-z0-9-]+$/),
13509
+ level: MigrationLevelSchema,
13510
+ /** Strictly increasing per owner: the order within an owner. */
13511
+ seq: number().int().positive(),
13512
+ /** Ids of any owner: the order across owners. */
13513
+ dependsOn: array(MigrationIdSchema),
13514
+ store: MigrationStoreSchema,
13515
+ scope: MigrationScopeSchema,
13516
+ onFailure: MigrationOnFailureSchema,
13517
+ bodyKind: MigrationBodyKindSchema,
13518
+ description: string().min(1),
13519
+ /** The marked field the migration's spec must assert survived. */
13520
+ fixtureMark: string().min(1)
13521
+ }).refine((m) => m.id.startsWith(`${m.owner}/`), {
13522
+ message: "the id must start with \"<owner>/\"",
13523
+ path: ["id"]
13524
+ });
13525
+ /** A cycle in the dependency graph, named by the ids on it. */
13526
+ var MigrationCycleError = class extends Error {
13527
+ ids;
13528
+ constructor(ids) {
13529
+ super(`migration dependsOn cycle: ${ids.join(" -> ")}`);
13530
+ this.ids = ids;
13531
+ this.name = "MigrationCycleError";
13532
+ }
13533
+ };
13534
+ /**
13535
+ * Topological order over `dependsOn` plus the implicit edge "a lower `seq` of an
13536
+ * owner runs first". Ties are broken by `(owner, seq)`. Throws
13537
+ * {@link MigrationCycleError} on a cycle. A `dependsOn` id that is not in the list
13538
+ * is ignored here — the catalogue schema is what refuses it.
13539
+ */
13540
+ function orderMigrations(items) {
13541
+ const byId = new Map(items.map((item) => [item.id, item]));
13542
+ const deps = /* @__PURE__ */ new Map();
13543
+ const ownerSorted = /* @__PURE__ */ new Map();
13544
+ for (const item of items) {
13545
+ const list = ownerSorted.get(item.owner) ?? [];
13546
+ list.push(item);
13547
+ ownerSorted.set(item.owner, list);
13548
+ }
13549
+ for (const item of items) deps.set(item.id, new Set(item.dependsOn.filter((id) => byId.has(id))));
13550
+ for (const list of ownerSorted.values()) {
13551
+ list.sort((a, b) => a.seq - b.seq);
13552
+ for (let i = 1; i < list.length; i++) {
13553
+ const previous = list[i - 1];
13554
+ const current = list[i];
13555
+ if (previous !== void 0 && current !== void 0) deps.get(current.id)?.add(previous.id);
13556
+ }
13557
+ }
13558
+ const tie = (a, b) => a.owner < b.owner ? -1 : a.owner > b.owner ? 1 : a.seq - b.seq;
13559
+ const done = /* @__PURE__ */ new Set();
13560
+ const ordered = [];
13561
+ let remaining = [...items];
13562
+ while (remaining.length > 0) {
13563
+ const ready = remaining.filter((item) => [...deps.get(item.id) ?? []].every((dep) => done.has(dep)));
13564
+ if (ready.length === 0) throw new MigrationCycleError(remaining.map((item) => item.id).sort());
13565
+ ready.sort(tie);
13566
+ const next = ready[0];
13567
+ if (next === void 0) break;
13568
+ ordered.push(next);
13569
+ done.add(next.id);
13570
+ remaining = remaining.filter((item) => item.id !== next.id);
13571
+ }
13572
+ return ordered;
13573
+ }
13574
+ /** Every way a list of migrations (in declaration order) is not a catalogue. */
13575
+ function catalogueIssues(items) {
13576
+ const issues = [];
13577
+ const seen = /* @__PURE__ */ new Set();
13578
+ const known = new Set(items.map((item) => item.id));
13579
+ const lastSeq = /* @__PURE__ */ new Map();
13580
+ const seqUsed = /* @__PURE__ */ new Map();
13581
+ for (const item of items) {
13582
+ if (seen.has(item.id)) issues.push({
13583
+ code: "duplicate-id",
13584
+ ids: [item.id],
13585
+ message: `duplicate id ${item.id}`
13586
+ });
13587
+ seen.add(item.id);
13588
+ const used = seqUsed.get(item.owner) ?? /* @__PURE__ */ new Set();
13589
+ if (used.has(item.seq)) issues.push({
13590
+ code: "duplicate-seq",
13591
+ ids: [item.id],
13592
+ message: `owner ${item.owner} has two migrations with seq ${item.seq}`
13593
+ });
13594
+ else if (item.seq < (lastSeq.get(item.owner) ?? 0)) issues.push({
13595
+ code: "seq-order",
13596
+ ids: [item.id],
13597
+ message: `seq ${item.seq} of ${item.id} does not increase in declaration order (owner ${item.owner})`
13598
+ });
13599
+ used.add(item.seq);
13600
+ seqUsed.set(item.owner, used);
13601
+ lastSeq.set(item.owner, Math.max(item.seq, lastSeq.get(item.owner) ?? 0));
13602
+ for (const dep of item.dependsOn) if (!known.has(dep)) issues.push({
13603
+ code: "unknown-dependency",
13604
+ ids: [item.id, dep],
13605
+ message: `${item.id} dependsOn unknown id ${dep}`
13606
+ });
13607
+ }
13608
+ try {
13609
+ orderMigrations(items);
13610
+ } catch (err) {
13611
+ if (err instanceof MigrationCycleError) issues.push({
13612
+ code: "cycle",
13613
+ ids: err.ids,
13614
+ message: err.message
13615
+ });
13616
+ else throw err;
13617
+ }
13618
+ return issues;
13619
+ }
13620
+ array(MigrationMetaSchema).superRefine((items, ctx) => {
13621
+ for (const issue of catalogueIssues(items)) ctx.addIssue({
13622
+ code: "custom",
13623
+ message: `${issue.code}: ${issue.message}`
13624
+ });
13625
+ });
13626
+ /**
13627
+ * The canonical JSON (`preconditionOf`) of the value a plan read; the apply step
13628
+ * re-reads, and a plan whose read no longer matches is refused (the migration is
13629
+ * `failed`, nothing it edited is kept).
13630
+ */
13631
+ var PreconditionSchema = string().min(1).optional();
13632
+ var MigrationPlanSchema = object({ edits: array(discriminatedUnion("op", [
13633
+ object({
13634
+ op: literal("setKeys"),
13635
+ scope: string().min(1),
13636
+ values: record(string(), unknown()),
13637
+ precondition: PreconditionSchema
13638
+ }),
13639
+ object({
13640
+ op: literal("deleteKeys"),
13641
+ scope: string().min(1),
13642
+ keys: array(string().min(1)).min(1),
13643
+ precondition: PreconditionSchema
13644
+ }),
13645
+ object({
13646
+ op: literal("putRow"),
13647
+ table: string().min(1),
13648
+ key: record(string(), unknown()),
13649
+ row: record(string(), unknown()),
13650
+ precondition: PreconditionSchema
13651
+ }),
13652
+ object({
13653
+ op: literal("deleteRow"),
13654
+ table: string().min(1),
13655
+ key: record(string(), unknown()),
13656
+ precondition: PreconditionSchema
13657
+ }),
13658
+ object({
13659
+ op: literal("upsertRecord"),
13660
+ kind: string().min(1),
13661
+ recordKey: string().min(1),
13662
+ value: unknown(),
13663
+ precondition: PreconditionSchema
13664
+ }),
13665
+ object({
13666
+ op: literal("deleteRecord"),
13667
+ kind: string().min(1),
13668
+ recordKey: string().min(1),
13669
+ precondition: PreconditionSchema
13670
+ })
13671
+ ])) });
13672
+ /**
13673
+ * What a `procedure` body reports. `already-done` means the rerun observed the
13674
+ * work finished (a crash between the work and the ledger row, or a manual fix)
13675
+ * and did none of it again; the ledger records `applied` either way.
13676
+ */
13677
+ var MigrationProcedureResultSchema = object({
13678
+ outcome: _enum(["done", "already-done"]),
13679
+ summary: record(string(), unknown())
13680
+ });
13681
+ /** What an owner hands the engine when one of its migrations ran. */
13682
+ var MigrationOwnerResultSchema = discriminatedUnion("kind", [
13683
+ object({
13684
+ kind: literal("plan"),
13685
+ plan: MigrationPlanSchema
13686
+ }),
13687
+ object({
13688
+ kind: literal("procedure"),
13689
+ result: MigrationProcedureResultSchema
13690
+ }),
13691
+ object({
13692
+ kind: literal("failed"),
13693
+ error: string().min(1)
13694
+ })
13695
+ ]);
13696
+ /**
13697
+ * `held`: a restore of a pre-migration snapshot undid this id; it does not rerun
13698
+ * until the operator retries or a new code version ships.
13699
+ * `skipped-newer`: the database knows an id this code does not.
13700
+ */
13701
+ var MigrationStatusSchema = _enum([
13702
+ "applied",
13703
+ "failed",
13704
+ "blocked",
13705
+ "running",
13706
+ "held",
13707
+ "skipped-newer"
13708
+ ]);
13709
+ var MigrationLedgerEntrySchema = object({
13710
+ id: string(),
13711
+ database: DataStoreDatabaseSchema,
13712
+ owner: string(),
13713
+ level: MigrationLevelSchema,
13714
+ seq: number().int().nonnegative(),
13715
+ status: MigrationStatusSchema,
13716
+ attempts: number().int().nonnegative(),
13717
+ appliedAt: number().nullable(),
13718
+ codeVersion: string().nullable(),
13719
+ /** What the apply changed: rows per table, as the engine counted them. */
13720
+ planSummary: record(string(), unknown()).nullable(),
13721
+ progress: record(string(), unknown()).nullable(),
13722
+ error: string().nullable(),
13723
+ /** Why it is `blocked` or `held` (`dependency-failed`, `snapshot-refused`, …). */
13724
+ reason: string().nullable(),
13725
+ nodeId: string().nullable(),
13726
+ bootId: string().nullable()
13727
+ });
13728
+ /** A catalogued migration that is not applied, with where it stands. */
13729
+ var MigrationPendingEntrySchema = object({
13730
+ meta: MigrationMetaSchema,
13731
+ database: DataStoreDatabaseSchema,
13732
+ state: _enum([
13733
+ "pending",
13734
+ "failed",
13735
+ "blocked",
13736
+ "held"
13737
+ ]),
13738
+ reason: string().nullable()
13739
+ });
13740
+ /** Rows per table before and after a dry run, and what it would have changed. */
13741
+ var MigrationDryRunResultSchema = object({
13742
+ id: string(),
13743
+ ok: boolean(),
13744
+ error: string().nullable(),
13745
+ rowsChanged: number().int().nonnegative(),
13746
+ tables: array(object({
13747
+ table: string(),
13748
+ before: number().int().nonnegative(),
13749
+ after: number().int().nonnegative()
13750
+ }))
13751
+ });
13752
+ /** One of an owner's migrations, as the engine tells the owner to treat it this boot. */
13753
+ var MigrationOwnerStepSchema = object({
13754
+ id: MigrationIdSchema,
13755
+ action: _enum(["run", "skip"]),
13756
+ /** The ledger state the engine found: `pending` has no row yet. */
13757
+ state: union([literal("pending"), MigrationStatusSchema])
13758
+ });
13759
+ /**
12918
13760
  * The trainer contract — what the hub hands the cloud trainer and what it
12919
13761
  * gets back (cloud training, D805+).
12920
13762
  *
@@ -16435,6 +17277,41 @@ var ACTUATOR_CAP_VOCABULARY = {
16435
17277
  icon: "droplets"
16436
17278
  }]
16437
17279
  },
17280
+ "power-source": {
17281
+ scope: "device",
17282
+ noun: t("Power source", "Alimentazione"),
17283
+ actions: [
17284
+ {
17285
+ id: "powerSource.on",
17286
+ method: "powerOn",
17287
+ label: t("Power on", "Dai corrente"),
17288
+ phrase: t("Power on {device}", "Dai corrente a {device}"),
17289
+ icon: "power"
17290
+ },
17291
+ {
17292
+ id: "powerSource.off",
17293
+ method: "powerOff",
17294
+ label: t("Power off", "Togli corrente"),
17295
+ phrase: t("Cut the power of {device}", "Togli la corrente a {device}"),
17296
+ icon: "power-off"
17297
+ },
17298
+ {
17299
+ id: "powerSource.forceRestart",
17300
+ method: "forceRestart",
17301
+ label: t("Force restart", "Riavvio forzato"),
17302
+ phrase: t("Force restart {device} by cutting its power", "Riavvia {device} togliendo la corrente"),
17303
+ icon: "refresh-cw"
17304
+ }
17305
+ ],
17306
+ state: [{
17307
+ kind: "boolean",
17308
+ field: "switchOn",
17309
+ label: t("Power switch on", "Presa accesa"),
17310
+ whenTrue: t("When the power of {device} comes on", "Quando arriva la corrente a {device}"),
17311
+ whenFalse: t("When the power of {device} is cut", "Quando manca la corrente a {device}"),
17312
+ icon: "power"
17313
+ }]
17314
+ },
16438
17315
  "lock-control": {
16439
17316
  scope: "device",
16440
17317
  noun: t("Lock", "Serratura"),
@@ -16910,7 +17787,7 @@ var ACTUATOR_CAP_VOCABULARY = {
16910
17787
  method: "setDirection",
16911
17788
  label: t("Spin forward", "Rotazione avanti"),
16912
17789
  phrase: t("Spin {device} forward", "Fai girare {device} in avanti"),
16913
- icon: "rotate-cw",
17790
+ icon: "refresh-cw",
16914
17791
  effect: {
16915
17792
  field: "direction",
16916
17793
  value: "forward"
@@ -19988,6 +20865,7 @@ var SYSTEM_CAP_VOCABULARY = {
19988
20865
  "login-method": system(IDENTITY),
19989
20866
  "mesh-network": system(NETWORK),
19990
20867
  "metrics-provider": system(CLUSTER),
20868
+ migrations: system(INTERNAL),
19991
20869
  "model-convert": system(ML),
19992
20870
  "model-distributor": system(ML),
19993
20871
  "mqtt-broker": system(NETWORK),
@@ -42354,7 +43232,7 @@ function pruneDeletedEntities(selection, live, log, exporter) {
42354
43232
  * rebuilds without manual reload.
42355
43233
  *
42356
43234
  * The hub-local builtin `addon-pages-aggregator` (see
42357
- * `@camstack/system/builtins/addon-pages-aggregator`) registers the
43235
+ * `@camstack/server/system/builtins/addon-pages-aggregator`) registers the
42358
43236
  * provider. Splitting the public aggregator from the raw collection
42359
43237
  * keeps both ends in codegen — there's no hand-written
42360
43238
  * `addon-pages.router.ts` wrapper anymore.
@@ -42444,7 +43322,7 @@ var addonRoutesCapability = {
42444
43322
  */
42445
43323
  invoke: method(InvokeRequestSchema, InvokeReplyEnvelopeSchema, { kind: "mutation" })
42446
43324
  },
42447
- /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
43325
+ /** BIG PLAN 2: declarative mount hint — read by `@camstack/server/system` `buildCapRouters`. */
42448
43326
  mount: { kind: "skip" }
42449
43327
  };
42450
43328
  var ConfigTabDeclarationSchema = object({
@@ -42499,6 +43377,10 @@ method(object({
42499
43377
  }), method(object({
42500
43378
  addonId: string(),
42501
43379
  nodeId: string().optional()
43380
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
43381
+ addonId: string(),
43382
+ nodeId: string().optional(),
43383
+ instance: IntegrationInstanceRefSchema
42502
43384
  }), SettingsSchemaWithValuesSchema.nullable()), method(object({
42503
43385
  addonId: string(),
42504
43386
  nodeId: string().optional()
@@ -42669,7 +43551,7 @@ method(_void(), array(WidgetMetadataSchema).readonly(), { auth: "admin" });
42669
43551
  * manual reload — same scheme used by `addon-pages`.
42670
43552
  *
42671
43553
  * The hub-local builtin `addon-widgets-aggregator` (see
42672
- * `@camstack/system/builtins/addon-widgets-aggregator`) registers the
43554
+ * `@camstack/server/system/builtins/addon-widgets-aggregator`) registers the
42673
43555
  * provider. Splitting the public aggregator from the raw collection
42674
43556
  * keeps both ends in codegen — there's no hand-written wrapper.
42675
43557
  */
@@ -43030,329 +43912,6 @@ method(object({
43030
43912
  password: string()
43031
43913
  }), AuthResultSchema.nullable(), { kind: "mutation" }), method(object({ state: string() }), string()), method(record(string(), string()), AuthResultSchema, { kind: "mutation" }), method(object({ token: string() }), AuthResultSchema.nullable());
43032
43914
  /**
43033
- * Query filter for settings-store collections.
43034
- */
43035
- var QueryFilterSchema = object({
43036
- where: record(string(), unknown()).optional(),
43037
- whereIn: record(string(), array(unknown())).optional(),
43038
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
43039
- /** NULL-safe exclusion: matches rows whose field is NULL OR != the value. */
43040
- whereNot: record(string(), unknown()).optional(),
43041
- /** NULL-safe exclusion of a SET — `whereNot` for more than one value. An
43042
- * empty list excludes nothing. See `QueryFilter.whereNotIn`. */
43043
- whereNotIn: record(string(), array(unknown())).optional(),
43044
- orderBy: object({
43045
- field: string(),
43046
- direction: _enum(["asc", "desc"])
43047
- }).optional(),
43048
- limit: number().optional(),
43049
- offset: number().optional()
43050
- });
43051
- /**
43052
- * The predicate half of a filter, for BULK MUTATIONS.
43053
- *
43054
- * Deliberately not `QueryFilterSchema`: `orderBy` / `limit` / `offset` have no
43055
- * meaning for a statement that rewrites a set, and accepting them would invite
43056
- * a caller to believe `limit` bounds the damage. Every field is optional here
43057
- * only so the shape stays composable — the implementation REJECTS a filter
43058
- * that compiles to no predicate, because that is the whole collection.
43059
- */
43060
- var MutationFilterSchema = object({
43061
- where: record(string(), unknown()).optional(),
43062
- whereIn: record(string(), array(unknown())).optional(),
43063
- whereBetween: record(string(), tuple([unknown(), unknown()])).optional(),
43064
- whereNot: record(string(), unknown()).optional(),
43065
- whereNotIn: record(string(), array(unknown())).optional()
43066
- });
43067
- /**
43068
- * One scalar an {@link settingsStoreCapability.methods.aggregate} call asks for.
43069
- *
43070
- * `as` names the slot in the result, so the SAME column may be asked twice with
43071
- * two operations (`MIN(startMs)` and `MAX(startMs)` in one round trip) — which
43072
- * a `Record<column, op>` shape could not express.
43073
- */
43074
- var AggregateFieldSchema = object({
43075
- /** Result key. */
43076
- as: string().min(1),
43077
- /** Column to aggregate. Must be a real column of a declared collection. */
43078
- field: string().min(1),
43079
- op: _enum([
43080
- "sum",
43081
- "min",
43082
- "max"
43083
- ])
43084
- });
43085
- /**
43086
- * `COUNT(*)` plus one number per requested field.
43087
- *
43088
- * `null` means NO ROW MATCHED, never zero: a `SUM` over an empty set and a sum
43089
- * that really is 0 are different facts, and an accounting caller that renders
43090
- * "0 bytes, oldest = 0" for "nothing here" reports a lie about a disk.
43091
- */
43092
- var AggregateResultSchema = object({
43093
- count: number().int(),
43094
- values: record(string(), number().nullable())
43095
- });
43096
- /** A single stored record: `{ id, data }`. */
43097
- var SettingsRecordSchema = object({
43098
- id: string(),
43099
- data: record(string(), unknown())
43100
- });
43101
- /**
43102
- * One record of a BULK insert — {@link SettingsRecordSchema} with the id made
43103
- * optional.
43104
- *
43105
- * A separate schema rather than loosening the shared one: every other method
43106
- * on this cap addresses a row BY its id, and making that field optional
43107
- * everywhere would turn a forgotten key into a silently generated one on
43108
- * `update` and `delete` as well.
43109
- */
43110
- var BulkRecordSchema = object({
43111
- id: string().optional(),
43112
- data: record(string(), unknown())
43113
- });
43114
- /**
43115
- * The database FILES one `sqlite-settings` engine process owns (D851).
43116
- * Closed on purpose: a file is a thing the engine opens, backs up and gives a
43117
- * serving thread, so a new one is a code change, never a string a caller
43118
- * invents. `settings` is `camstack.db` and the default for every collection
43119
- * that names no file.
43120
- */
43121
- var DataStoreDatabaseSchema = _enum([
43122
- "settings",
43123
- "events",
43124
- "history"
43125
- ]);
43126
- DataStoreDatabaseSchema.options;
43127
- /**
43128
- * One write inside a {@link settingsStoreCapability.methods.transact} call.
43129
- * The three that a "replace this set, bump that revision" write needs, plus
43130
- * the batched upsert a rollup writer needs.
43131
- */
43132
- var TransactOpSchema = discriminatedUnion("op", [
43133
- object({
43134
- op: literal("deleteWhere"),
43135
- collection: string(),
43136
- filter: MutationFilterSchema
43137
- }),
43138
- object({
43139
- op: literal("insertMany"),
43140
- collection: string(),
43141
- records: array(BulkRecordSchema).readonly()
43142
- }),
43143
- object({
43144
- op: literal("update"),
43145
- collection: string(),
43146
- id: string(),
43147
- data: record(string(), unknown())
43148
- }),
43149
- object({
43150
- op: literal("upsertMany"),
43151
- collection: string(),
43152
- conflict: array(string()).readonly(),
43153
- records: array(BulkRecordSchema).readonly()
43154
- })
43155
- ]);
43156
- /**
43157
- * The precondition of a transaction: the row `key` of `collection` must hold
43158
- * `equals` in `column`, read INSIDE the transaction.
43159
- */
43160
- var TransactGuardSchema = object({
43161
- collection: string(),
43162
- key: string(),
43163
- column: string(),
43164
- equals: unknown()
43165
- });
43166
- /**
43167
- * Column declaration for a structured (SQL-backed) collection.
43168
- *
43169
- * Logical types — the backend translates each to the matching SQLite
43170
- * storage class and handles per-type marshaling:
43171
- * - `TEXT` / `INTEGER` / `REAL` — native SQLite types, pass-through
43172
- * - `JSON` — TEXT under the hood; serialised on write, parsed on read
43173
- * - `BOOLEAN` — INTEGER 0/1 under the hood; coerced both directions
43174
- */
43175
- var CollectionColumnSchema = object({
43176
- name: string(),
43177
- type: _enum([
43178
- "TEXT",
43179
- "INTEGER",
43180
- "REAL",
43181
- "JSON",
43182
- "BOOLEAN"
43183
- ]),
43184
- primaryKey: boolean().optional(),
43185
- notNull: boolean().optional(),
43186
- unique: boolean().optional(),
43187
- /**
43188
- * Column DEFAULT. Required for B2: the four `ensureTable` consumers declare
43189
- * columns like `enabled INTEGER NOT NULL DEFAULT 1`, and without this the
43190
- * collection surface simply cannot express their existing tables — which is
43191
- * why they were still on the uncapped `table*` API.
43192
- */
43193
- defaultValue: union([
43194
- string(),
43195
- number(),
43196
- boolean()
43197
- ]).optional()
43198
- });
43199
- var CollectionIndexSchema = object({
43200
- name: string(),
43201
- columns: array(string()).readonly(),
43202
- unique: boolean().optional()
43203
- });
43204
- /**
43205
- * The input of `declareCollection` — ONE schema for the door and for the
43206
- * engine behind it, so the two surfaces cannot drift (the dispatcher forwards
43207
- * the payload untouched).
43208
- *
43209
- * - `database` — the file the collection lives in (D851). Absent means
43210
- * `settings`. A declaration naming a file other than the one the table is
43211
- * already in is REFUSED by the engine, never moved.
43212
- * - `primaryKey` — a COMPOSITE key, as column names. A single name is the same
43213
- * as `primaryKey: true` on that column. A composite-keyed collection has no
43214
- * `id`: it is written with `insertMany` / `upsertMany` / `transact` and read
43215
- * with `query` / `count` / `aggregate` / `deleteWhere`; the calls that
43216
- * address one row by id are refused.
43217
- * - `withoutRowid` — emit `WITHOUT ROWID`. Requires a primary key.
43218
- */
43219
- var DeclareCollectionInputSchema = object({
43220
- namespace: string().optional(),
43221
- collection: string(),
43222
- columns: array(CollectionColumnSchema).readonly(),
43223
- indexes: array(CollectionIndexSchema).readonly().optional(),
43224
- database: DataStoreDatabaseSchema.optional(),
43225
- primaryKey: array(string()).readonly().optional(),
43226
- withoutRowid: boolean().optional()
43227
- });
43228
- method(object({
43229
- namespace: string().optional(),
43230
- collection: string(),
43231
- key: string()
43232
- }), unknown(), { auth: "admin" }), method(object({
43233
- namespace: string().optional(),
43234
- collection: string(),
43235
- key: string(),
43236
- value: unknown()
43237
- }), _void(), {
43238
- kind: "mutation",
43239
- auth: "admin"
43240
- }), method(object({
43241
- namespace: string().optional(),
43242
- collection: string(),
43243
- filter: QueryFilterSchema.optional(),
43244
- columns: array(string()).readonly().optional()
43245
- }), array(SettingsRecordSchema).readonly(), { auth: "admin" }), method(object({
43246
- namespace: string().optional(),
43247
- collection: string(),
43248
- /** Declared columns identifying the slot; must be covered by a UNIQUE
43249
- * index on the collection. Never empty. */
43250
- conflict: array(string()).readonly(),
43251
- record: BulkRecordSchema
43252
- }), object({
43253
- /** The id the row HAS: assigned by SQLite on an insert, or the existing
43254
- * row's own id on an update. */
43255
- id: union([string(), number()]) }), {
43256
- kind: "mutation",
43257
- auth: "admin"
43258
- }), method(object({
43259
- namespace: string().optional(),
43260
- collection: string(),
43261
- conflict: array(string()).readonly(),
43262
- records: array(BulkRecordSchema).readonly()
43263
- }), object({ upserted: number().int() }), {
43264
- kind: "mutation",
43265
- auth: "admin"
43266
- }), method(object({
43267
- namespace: string().optional(),
43268
- collection: string(),
43269
- record: object({
43270
- id: string().optional(),
43271
- data: record(string(), unknown())
43272
- })
43273
- }), object({
43274
- /**
43275
- * The id the row ACTUALLY got (D473): the one supplied, the UUID minted
43276
- * for an absent one, or the ROWID SQLite assigned on an `INTEGER`
43277
- * primary key — which is the only place an auto key is knowable.
43278
- */
43279
- id: union([string(), number()]) }), {
43280
- kind: "mutation",
43281
- auth: "admin"
43282
- }), method(object({
43283
- namespace: string().optional(),
43284
- collection: string(),
43285
- records: array(BulkRecordSchema).readonly()
43286
- }), object({ inserted: number().int() }), {
43287
- kind: "mutation",
43288
- auth: "admin"
43289
- }), method(object({
43290
- namespace: string().optional(),
43291
- guard: TransactGuardSchema.optional(),
43292
- ops: array(TransactOpSchema).readonly()
43293
- }), object({
43294
- applied: boolean(),
43295
- current: unknown().optional()
43296
- }), {
43297
- kind: "mutation",
43298
- auth: "admin"
43299
- }), method(object({
43300
- namespace: string().optional(),
43301
- collection: string(),
43302
- id: string(),
43303
- data: record(string(), unknown())
43304
- }), _void(), {
43305
- kind: "mutation",
43306
- auth: "admin"
43307
- }), method(object({
43308
- namespace: string().optional(),
43309
- collection: string(),
43310
- key: string()
43311
- }), _void(), {
43312
- kind: "mutation",
43313
- auth: "admin"
43314
- }), method(object({
43315
- namespace: string().optional(),
43316
- collection: string(),
43317
- filter: MutationFilterSchema
43318
- }), object({ deleted: number().int() }), {
43319
- kind: "mutation",
43320
- auth: "admin"
43321
- }), method(object({
43322
- namespace: string().optional(),
43323
- collection: string(),
43324
- filter: MutationFilterSchema,
43325
- data: record(string(), unknown())
43326
- }), object({ updated: number().int() }), {
43327
- kind: "mutation",
43328
- auth: "admin"
43329
- }), method(object({
43330
- namespace: string().optional(),
43331
- collection: string(),
43332
- filter: QueryFilterSchema.optional()
43333
- }), number(), { auth: "admin" }), method(object({
43334
- namespace: string().optional(),
43335
- collection: string(),
43336
- fields: array(AggregateFieldSchema).readonly(),
43337
- filter: QueryFilterSchema.optional()
43338
- }), AggregateResultSchema, { auth: "admin" }), method(object({
43339
- namespace: string().optional(),
43340
- collection: string(),
43341
- field: string(),
43342
- bucketSize: number().int().positive(),
43343
- origin: number().int(),
43344
- filter: QueryFilterSchema.optional()
43345
- }), array(object({
43346
- bucket: number().int(),
43347
- count: number().int()
43348
- })).readonly(), { auth: "admin" }), method(object({
43349
- namespace: string().optional(),
43350
- collection: string()
43351
- }), boolean(), { auth: "admin" }), method(DeclareCollectionInputSchema, _void(), {
43352
- kind: "mutation",
43353
- auth: "admin"
43354
- });
43355
- /**
43356
43915
  * How long one snapshot may take end to end: the pinned copy of the whole
43357
43916
  * database plus `PRAGMA integrity_check` over the copy, on the hub's slowest
43358
43917
  * disk. ~800 MB at a pessimistic 10 MB/s is under 3 minutes; the bound is
@@ -45160,7 +45719,7 @@ method(object({
45160
45719
  kind: "mutation",
45161
45720
  auth: "admin"
45162
45721
  }), method(object({ blockIds: array(string()) }), object({ states: array(CompositionBlockStateSchema) }), { auth: "admin" });
45163
- 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;
45722
+ 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;
45164
45723
  var NUMBER = {
45165
45724
  kind: "fixed",
45166
45725
  result: ["number"]
@@ -46171,6 +46730,57 @@ id: union([string(), number()]) }), {
46171
46730
  kind: "mutation",
46172
46731
  auth: "admin"
46173
46732
  });
46733
+ 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({
46734
+ id: string().min(1),
46735
+ error: string().min(1)
46736
+ }), MigrationLedgerEntrySchema, {
46737
+ kind: "mutation",
46738
+ auth: "admin"
46739
+ }), method(object({ id: string().min(1) }), object({ entries: array(MigrationLedgerEntrySchema) }), {
46740
+ kind: "mutation",
46741
+ auth: "admin"
46742
+ }), method(object({
46743
+ database: DataStoreDatabaseSchema,
46744
+ snapshotId: string().min(1)
46745
+ }), object({
46746
+ scheduled: boolean(),
46747
+ held: array(string()),
46748
+ restartRequired: boolean()
46749
+ }), {
46750
+ kind: "mutation",
46751
+ auth: "admin"
46752
+ }), method(object({
46753
+ owner: string().min(1),
46754
+ metas: array(MigrationMetaSchema)
46755
+ }), object({
46756
+ bootId: string(),
46757
+ snapshot: _enum([
46758
+ "none",
46759
+ "written",
46760
+ "refused"
46761
+ ]),
46762
+ steps: array(MigrationOwnerStepSchema)
46763
+ }), {
46764
+ kind: "mutation",
46765
+ auth: "admin"
46766
+ }), method(object({ id: string().min(1) }), object({
46767
+ proceed: boolean(),
46768
+ state: union([literal("pending"), MigrationStatusSchema]),
46769
+ reason: string().nullable()
46770
+ }), {
46771
+ kind: "mutation",
46772
+ auth: "admin"
46773
+ }), method(object({
46774
+ id: string().min(1),
46775
+ result: MigrationOwnerResultSchema
46776
+ }), object({
46777
+ status: MigrationStatusSchema,
46778
+ error: string().nullable(),
46779
+ rowsChanged: number().int().nonnegative()
46780
+ }), {
46781
+ kind: "mutation",
46782
+ auth: "admin"
46783
+ });
46174
46784
  /**
46175
46785
  * records - an addon's own facts and documents (D881): ledgers, audit rows,
46176
46786
  * config documents, mirrors. The third storage API next to `ctx.settings`
@@ -60718,7 +61328,18 @@ var ServerUpdateActionResultSchema = object({
60718
61328
  * store (D877), present when the pre-flight refused the update
60719
61329
  * (`reason: 'addon-would-refuse'`). Optional for version skew.
60720
61330
  */
60721
- blockers: array(UpdateBlockerSchema).optional()
61331
+ blockers: array(UpdateBlockerSchema).optional(),
61332
+ /**
61333
+ * The minimums the target server declares and this node does not meet
61334
+ * (D989), present when the update was refused with
61335
+ * `reason: 'requirements-unmet'`. Each names the versions on both sides.
61336
+ */
61337
+ unmet: array(UnmetRequirementSchema).optional(),
61338
+ /**
61339
+ * The addons this node has below the minimum the staged server declares —
61340
+ * the ones to update WITH the server. Present on an accepted update.
61341
+ */
61342
+ requiredAddonUpdates: array(RequiredAddonUpdateSchema).optional()
60722
61343
  });
60723
61344
  var LaunchOverridesSchema = object({
60724
61345
  /** The persisted heap ceiling in MB, or `null` when none is set. */
@@ -63229,7 +63850,9 @@ var PackageUpdateSchema = object({
63229
63850
  latestVersion: string(),
63230
63851
  category: _enum(["addon", "core"]),
63231
63852
  requiresRestart: boolean(),
63232
- isSystem: boolean()
63853
+ isSystem: boolean(),
63854
+ /** Held: what the newer version needs and this node does not meet (D989). */
63855
+ blockedBy: array(UnmetRequirementSchema).readonly().optional()
63233
63856
  });
63234
63857
  var PackageVersionInfoSchema = object({
63235
63858
  version: string(),
@@ -64285,19 +64908,19 @@ var RemoteSetConfigResultSchema = discriminatedUnion("status", [object({ status:
64285
64908
  reason: _enum(["unknown-template", "not-a-media-player"]),
64286
64909
  detail: string()
64287
64910
  })]);
64288
- var deviceInput = object({ deviceId: number().int().nonnegative() });
64911
+ var deviceInput$1 = object({ deviceId: number().int().nonnegative() });
64289
64912
  DeviceType.MediaPlayer;
64290
- method(deviceInput, RemoteConfigSchema, { auth: "admin" }), method(deviceInput.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
64913
+ method(deviceInput$1, RemoteConfigSchema, { auth: "admin" }), method(deviceInput$1.extend({ config: RemoteConfigSchema }), RemoteSetConfigResultSchema, {
64291
64914
  kind: "mutation",
64292
64915
  auth: "admin"
64293
- }), method(deviceInput, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput.extend({
64916
+ }), method(deviceInput$1, RemoteCommandListSchema, { auth: "protected" }), method(deviceInput$1.extend({
64294
64917
  role: RemoteRoleSchema,
64295
64918
  /** Sends in a row (volume steps). */
64296
64919
  repeat: number().int().min(1).max(50).default(1)
64297
64920
  }), RemoteSendResultSchema, {
64298
64921
  kind: "mutation",
64299
64922
  auth: "protected"
64300
- }), method(deviceInput.extend({
64923
+ }), method(deviceInput$1.extend({
64301
64924
  command: RemoteMediaCommandSchema,
64302
64925
  muted: boolean().optional(),
64303
64926
  source: string().optional(),
@@ -66800,7 +67423,7 @@ DeviceType.LawnMower, method(object({ deviceId: number().int().nonnegative() }),
66800
67423
  * clients — they reverse-connect to the hub. Exposing their interfaces
66801
67424
  * via the same surface would leak internal topology with no upside.
66802
67425
  *
66803
- * Implementation in `@camstack/system/builtins/local-network/`.
67426
+ * Implementation in `@camstack/server/system/builtins/local-network/`.
66804
67427
  */
66805
67428
  /** Coarse classification derived from the interface name + IP range. */
66806
67429
  var InterfaceKindEnum = _enum([
@@ -67229,6 +67852,49 @@ DeviceType.Lock, method(object({
67229
67852
  kind: "mutation",
67230
67853
  auth: "protected"
67231
67854
  });
67855
+ var PowerSourceRefusalReasonSchema = _enum([
67856
+ "no-power-source",
67857
+ "switch-missing",
67858
+ "switch-offline",
67859
+ "switch-unknown",
67860
+ "restart-in-progress",
67861
+ "switch-call-failed"
67862
+ ]);
67863
+ var PowerSourceActionResultSchema = discriminatedUnion("accepted", [object({ accepted: literal(true) }), object({
67864
+ accepted: literal(false),
67865
+ reason: PowerSourceRefusalReasonSchema,
67866
+ /** One line for the operator, naming the switch. */
67867
+ message: string()
67868
+ })]);
67869
+ var PowerSourceInfoSchema = object({
67870
+ /** False when the device has no power source linked; the rest is then empty. */
67871
+ linked: boolean(),
67872
+ switchDeviceId: number().nullable(),
67873
+ switchName: string().nullable(),
67874
+ /** The switch's on/off state, or null when it is unknown. Never false for unknown (D393). */
67875
+ switchOn: boolean().nullable(),
67876
+ switchOnline: boolean().nullable(),
67877
+ restartInProgress: boolean(),
67878
+ offSeconds: number().int()
67879
+ });
67880
+ object({
67881
+ /** Null while the switch has not reported: unknown is never `false` (D393). */
67882
+ switchOn: boolean().nullable(),
67883
+ offSeconds: number().int(),
67884
+ lastFetchedAt: number()
67885
+ });
67886
+ 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;
67887
+ var deviceInput = object({ deviceId: number().int().nonnegative() });
67888
+ systemMethod(deviceInput, PowerSourceInfoSchema, { auth: "admin" }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67889
+ kind: "mutation",
67890
+ auth: "admin"
67891
+ }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67892
+ kind: "mutation",
67893
+ auth: "admin"
67894
+ }), systemMethod(deviceInput, PowerSourceActionResultSchema, {
67895
+ kind: "mutation",
67896
+ auth: "admin"
67897
+ });
67232
67898
  object({
67233
67899
  value: number().nullable().meta(readingMeta("device", { label: "Total" })),
67234
67900
  lastFetchedAt: number()
@@ -68037,7 +68703,7 @@ DeviceType.Camera, DeviceType.Sensor, DeviceType.Button, DeviceType.Switch, Devi
68037
68703
  * jitter, and observed/peak bandwidth per device + per client.
68038
68704
  *
68039
68705
  * Implementation lives in the server's `NetworkQualityService` (thin
68040
- * wrapper over the shared `NetworkQualityTracker` from `@camstack/system`).
68706
+ * wrapper over the shared `NetworkQualityTracker` from `@camstack/server/system`).
68041
68707
  * The provider is registered from `trpc.router.ts` against the existing
68042
68708
  * service instance — no addon owns this state.
68043
68709
  *
@@ -74073,6 +74739,13 @@ Object.freeze({
74073
74739
  access: "view",
74074
74740
  role: "admin"
74075
74741
  },
74742
+ "addonSettings.getIntegrationFormSchema": {
74743
+ capName: "addon-settings",
74744
+ capScope: "system",
74745
+ addonId: null,
74746
+ access: "view",
74747
+ role: "admin"
74748
+ },
74076
74749
  "addonSettings.getIntegrationSettings": {
74077
74750
  capName: "addon-settings",
74078
74751
  capScope: "system",
@@ -78161,6 +78834,69 @@ Object.freeze({
78161
78834
  access: "view",
78162
78835
  role: "admin"
78163
78836
  },
78837
+ "migrations.declareOwner": {
78838
+ capName: "migrations",
78839
+ capScope: "system",
78840
+ addonId: null,
78841
+ access: "create",
78842
+ role: "admin"
78843
+ },
78844
+ "migrations.dryRun": {
78845
+ capName: "migrations",
78846
+ capScope: "system",
78847
+ addonId: null,
78848
+ access: "view",
78849
+ role: "admin"
78850
+ },
78851
+ "migrations.finishMigration": {
78852
+ capName: "migrations",
78853
+ capScope: "system",
78854
+ addonId: null,
78855
+ access: "create",
78856
+ role: "admin"
78857
+ },
78858
+ "migrations.listLedger": {
78859
+ capName: "migrations",
78860
+ capScope: "system",
78861
+ addonId: null,
78862
+ access: "view",
78863
+ role: "admin"
78864
+ },
78865
+ "migrations.listPending": {
78866
+ capName: "migrations",
78867
+ capScope: "system",
78868
+ addonId: null,
78869
+ access: "view",
78870
+ role: "admin"
78871
+ },
78872
+ "migrations.markFailed": {
78873
+ capName: "migrations",
78874
+ capScope: "system",
78875
+ addonId: null,
78876
+ access: "create",
78877
+ role: "admin"
78878
+ },
78879
+ "migrations.restorePreMigration": {
78880
+ capName: "migrations",
78881
+ capScope: "system",
78882
+ addonId: null,
78883
+ access: "create",
78884
+ role: "admin"
78885
+ },
78886
+ "migrations.retry": {
78887
+ capName: "migrations",
78888
+ capScope: "system",
78889
+ addonId: null,
78890
+ access: "create",
78891
+ role: "admin"
78892
+ },
78893
+ "migrations.startMigration": {
78894
+ capName: "migrations",
78895
+ capScope: "system",
78896
+ addonId: null,
78897
+ access: "create",
78898
+ role: "admin"
78899
+ },
78164
78900
  "modelConvert.convert": {
78165
78901
  capName: "model-convert",
78166
78902
  capScope: "system",
@@ -80793,6 +81529,34 @@ Object.freeze({
80793
81529
  access: "view",
80794
81530
  role: "viewer"
80795
81531
  },
81532
+ "powerSource.forceRestart": {
81533
+ capName: "power-source",
81534
+ capScope: "device",
81535
+ addonId: null,
81536
+ access: "create",
81537
+ role: "admin"
81538
+ },
81539
+ "powerSource.getStatus": {
81540
+ capName: "power-source",
81541
+ capScope: "device",
81542
+ addonId: null,
81543
+ access: "view",
81544
+ role: "admin"
81545
+ },
81546
+ "powerSource.powerOff": {
81547
+ capName: "power-source",
81548
+ capScope: "device",
81549
+ addonId: null,
81550
+ access: "create",
81551
+ role: "admin"
81552
+ },
81553
+ "powerSource.powerOn": {
81554
+ capName: "power-source",
81555
+ capScope: "device",
81556
+ addonId: null,
81557
+ access: "create",
81558
+ role: "admin"
81559
+ },
80796
81560
  "presence.getStatus": {
80797
81561
  capName: "presence",
80798
81562
  capScope: "device",
@@ -85966,6 +86730,26 @@ Object.freeze({
85966
86730
  form: "single",
85967
86731
  optional: false
85968
86732
  }],
86733
+ "powerSource.forceRestart": [{
86734
+ name: "deviceId",
86735
+ form: "single",
86736
+ optional: false
86737
+ }],
86738
+ "powerSource.getStatus": [{
86739
+ name: "deviceId",
86740
+ form: "single",
86741
+ optional: false
86742
+ }],
86743
+ "powerSource.powerOff": [{
86744
+ name: "deviceId",
86745
+ form: "single",
86746
+ optional: false
86747
+ }],
86748
+ "powerSource.powerOn": [{
86749
+ name: "deviceId",
86750
+ form: "single",
86751
+ optional: false
86752
+ }],
85969
86753
  "presence.getStatus": [{
85970
86754
  name: "deviceId",
85971
86755
  form: "single",
@@ -95187,7 +95971,7 @@ async function handleBrokerLinkCallback(request, reply, deps) {
95187
95971
  * Lambda once, regenerating invalidates the old value).
95188
95972
  *
95189
95973
  * Could be unified with the stream-broker primitives into a shared
95190
- * `@camstack/system` util — kept local for now to avoid a system-package rebuild
95974
+ * `@camstack/server/system` util — kept local for now to avoid a system-package rebuild
95191
95975
  * during this batch (see the completion spec).
95192
95976
  */
95193
95977
  /** Generate a fresh high-entropy opaque ingress token (256-bit, base64url). */