@camstack/addon-provider-reolink 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1297 -1262
  2. package/dist/addon.mjs +1297 -1262
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -4655,63 +4655,7 @@ function _instanceof(cls, params = {}) {
4655
4655
  return inst;
4656
4656
  }
4657
4657
  //#endregion
4658
- //#region ../types/dist/index.mjs
4659
- /**
4660
- * Deep wiring healthcheck — snapshot of active reachability probes across
4661
- * every declared capability + widget of every installed plugin, on every
4662
- * node. Produced by the backend `WiringHealthService` and surfaced via
4663
- * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
4664
- *
4665
- * Unlike `/health` (process liveness), this reflects whether each cap/widget
4666
- * is actually *reachable* over the real cap-dispatch path. See spec
4667
- * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
4668
- */
4669
- /** What kind of target a probe addressed. */
4670
- var wiringProbeKindSchema = _enum([
4671
- "singleton",
4672
- "device",
4673
- "widget"
4674
- ]);
4675
- /** Result of probing a single (cap|widget [, device]) target. */
4676
- var wiringProbeResultSchema = object({
4677
- capName: string(),
4678
- kind: wiringProbeKindSchema,
4679
- deviceId: number().optional(),
4680
- reachable: boolean(),
4681
- latencyMs: number(),
4682
- error: string().optional()
4683
- });
4684
- /** Per-addon roll-up of cap + widget probe results. */
4685
- var wiringAddonHealthSchema = object({
4686
- addonId: string(),
4687
- caps: array(wiringProbeResultSchema).readonly(),
4688
- widgets: array(wiringProbeResultSchema).readonly()
4689
- });
4690
- /** Per-node roll-up. */
4691
- var wiringNodeHealthSchema = object({
4692
- nodeId: string(),
4693
- addons: array(wiringAddonHealthSchema).readonly()
4694
- });
4695
- object({
4696
- /** True only when every probed target is reachable. */
4697
- ok: boolean(),
4698
- /** True when at least one target is unreachable. */
4699
- degraded: boolean(),
4700
- checkedAt: string(),
4701
- nodes: array(wiringNodeHealthSchema).readonly(),
4702
- summary: object({
4703
- total: number(),
4704
- reachable: number(),
4705
- unreachable: number()
4706
- })
4707
- });
4708
- var MODEL_FORMATS = [
4709
- "onnx",
4710
- "coreml",
4711
- "openvino",
4712
- "tflite",
4713
- "pt"
4714
- ];
4658
+ //#region ../types/dist/sleep-D7JeS58T.mjs
4715
4659
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4716
4660
  EventCategory["SystemBoot"] = "system.boot";
4717
4661
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5948,181 +5892,6 @@ function normalizeAddonInitResult(result) {
5948
5892
  if (Array.isArray(result)) return { providers: result };
5949
5893
  return result;
5950
5894
  }
5951
- var EU_DST = {
5952
- offsetHours: 1,
5953
- startMonth: 3,
5954
- startWeekIndex: 5,
5955
- startWeekday: "Sunday",
5956
- startHour: 2,
5957
- endMonth: 10,
5958
- endWeekIndex: 5,
5959
- endWeekday: "Sunday",
5960
- endHour: 3
5961
- };
5962
- var US_DST = {
5963
- offsetHours: 1,
5964
- startMonth: 3,
5965
- startWeekIndex: 2,
5966
- startWeekday: "Sunday",
5967
- startHour: 2,
5968
- endMonth: 11,
5969
- endWeekIndex: 1,
5970
- endWeekday: "Sunday",
5971
- endHour: 2
5972
- };
5973
- /**
5974
- * Curated catalogue of common world zones, grouped by region. Not
5975
- * exhaustive — covers the everyday zones an operator is likely to pick.
5976
- */
5977
- var TIMEZONES = [
5978
- {
5979
- id: "UTC",
5980
- label: "UTC (UTC+0)",
5981
- region: "Universal",
5982
- stdOffsetMinutes: 0,
5983
- dst: null
5984
- },
5985
- {
5986
- id: "Europe/London",
5987
- label: "Europe/London (UTC+0 / BST)",
5988
- region: "Europe",
5989
- stdOffsetMinutes: 0,
5990
- dst: EU_DST
5991
- },
5992
- {
5993
- id: "Europe/Rome",
5994
- label: "Europe/Rome (UTC+1 / CEST)",
5995
- region: "Europe",
5996
- stdOffsetMinutes: 60,
5997
- dst: EU_DST
5998
- },
5999
- {
6000
- id: "Europe/Paris",
6001
- label: "Europe/Paris (UTC+1 / CEST)",
6002
- region: "Europe",
6003
- stdOffsetMinutes: 60,
6004
- dst: EU_DST
6005
- },
6006
- {
6007
- id: "Europe/Berlin",
6008
- label: "Europe/Berlin (UTC+1 / CEST)",
6009
- region: "Europe",
6010
- stdOffsetMinutes: 60,
6011
- dst: EU_DST
6012
- },
6013
- {
6014
- id: "Europe/Madrid",
6015
- label: "Europe/Madrid (UTC+1 / CEST)",
6016
- region: "Europe",
6017
- stdOffsetMinutes: 60,
6018
- dst: EU_DST
6019
- },
6020
- {
6021
- id: "Europe/Amsterdam",
6022
- label: "Europe/Amsterdam (UTC+1 / CEST)",
6023
- region: "Europe",
6024
- stdOffsetMinutes: 60,
6025
- dst: EU_DST
6026
- },
6027
- {
6028
- id: "Europe/Istanbul",
6029
- label: "Europe/Istanbul (UTC+3)",
6030
- region: "Europe",
6031
- stdOffsetMinutes: 180,
6032
- dst: null
6033
- },
6034
- {
6035
- id: "America/New_York",
6036
- label: "America/New York (UTC−5 / EDT)",
6037
- region: "Americas",
6038
- stdOffsetMinutes: -300,
6039
- dst: US_DST
6040
- },
6041
- {
6042
- id: "America/Chicago",
6043
- label: "America/Chicago (UTC−6 / CDT)",
6044
- region: "Americas",
6045
- stdOffsetMinutes: -360,
6046
- dst: US_DST
6047
- },
6048
- {
6049
- id: "America/Denver",
6050
- label: "America/Denver (UTC−7 / MDT)",
6051
- region: "Americas",
6052
- stdOffsetMinutes: -420,
6053
- dst: US_DST
6054
- },
6055
- {
6056
- id: "America/Los_Angeles",
6057
- label: "America/Los Angeles (UTC−8 / PDT)",
6058
- region: "Americas",
6059
- stdOffsetMinutes: -480,
6060
- dst: US_DST
6061
- },
6062
- {
6063
- id: "America/Sao_Paulo",
6064
- label: "America/Sao Paulo (UTC−3)",
6065
- region: "Americas",
6066
- stdOffsetMinutes: -180,
6067
- dst: null
6068
- },
6069
- {
6070
- id: "Asia/Dubai",
6071
- label: "Asia/Dubai (UTC+4)",
6072
- region: "Asia",
6073
- stdOffsetMinutes: 240,
6074
- dst: null
6075
- },
6076
- {
6077
- id: "Asia/Kolkata",
6078
- label: "Asia/Kolkata (UTC+5:30)",
6079
- region: "Asia",
6080
- stdOffsetMinutes: 330,
6081
- dst: null
6082
- },
6083
- {
6084
- id: "Asia/Singapore",
6085
- label: "Asia/Singapore (UTC+8)",
6086
- region: "Asia",
6087
- stdOffsetMinutes: 480,
6088
- dst: null
6089
- },
6090
- {
6091
- id: "Asia/Shanghai",
6092
- label: "Asia/Shanghai (UTC+8)",
6093
- region: "Asia",
6094
- stdOffsetMinutes: 480,
6095
- dst: null
6096
- },
6097
- {
6098
- id: "Asia/Tokyo",
6099
- label: "Asia/Tokyo (UTC+9)",
6100
- region: "Asia",
6101
- stdOffsetMinutes: 540,
6102
- dst: null
6103
- },
6104
- {
6105
- id: "Australia/Sydney",
6106
- label: "Australia/Sydney (UTC+10 / AEDT)",
6107
- region: "Oceania",
6108
- stdOffsetMinutes: 600,
6109
- dst: {
6110
- offsetHours: 1,
6111
- startMonth: 10,
6112
- startWeekIndex: 1,
6113
- startWeekday: "Sunday",
6114
- startHour: 2,
6115
- endMonth: 4,
6116
- endWeekIndex: 1,
6117
- endWeekday: "Sunday",
6118
- endHour: 3
6119
- }
6120
- }
6121
- ];
6122
- /** Resolve an IANA id to its `Timezone`, or `undefined` if unknown. */
6123
- function findTimezone(id) {
6124
- return TIMEZONES.find((tz) => tz.id === id);
6125
- }
6126
5895
  /** Shared Zod schemas used across streaming capabilities. */
6127
5896
  var CamProfileSchema = _enum([
6128
5897
  "high",
@@ -6209,7 +5978,7 @@ var ProfileSlotSchema = object({
6209
5978
  * Zod schema for StreamSourceEntry — the canonical stream descriptor
6210
5979
  * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
6211
5980
  */
6212
- var StreamSourceEntrySchema = object({
5981
+ var StreamSourceEntrySchema$1 = object({
6213
5982
  id: string(),
6214
5983
  label: string(),
6215
5984
  protocol: _enum([
@@ -6431,894 +6200,1283 @@ var ProfileRtspEntrySchema = object({
6431
6200
  codec: string().optional(),
6432
6201
  resolution: CamStreamResolutionSchema.optional()
6433
6202
  });
6434
- /**
6435
- * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6436
- * Named `RecordingWeekday` to avoid collision with the string-union
6437
- * `Weekday` exported from `interfaces/timezones.ts`.
6438
- */
6439
- var RecordingWeekdaySchema = number().int().min(0).max(6);
6440
- var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6441
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6442
- kind: literal("timeOfDay"),
6443
- start: string().regex(HHMM),
6444
- end: string().regex(HHMM),
6445
- /** Restrict to these weekdays; omit = every day. */
6446
- days: array(RecordingWeekdaySchema).optional()
6447
- })]);
6448
- var RecordingModeSchema = _enum([
6449
- "continuous",
6450
- "onMotion",
6451
- "onAudioThreshold"
6452
- ]);
6453
- /**
6454
- * First-class, authoritative per-camera storage mode the netta choice the UI
6455
- * reads directly (never inferred from `rules`):
6456
- * - `off` not recording.
6457
- * - `events` — record only around triggers (motion / audio threshold),
6458
- * with pre/post-buffer.
6459
- * - `continuous` record 24/7 within the schedule.
6460
- *
6461
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6462
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6463
- */
6464
- var RecordingStorageModeSchema = _enum([
6465
- "off",
6466
- "events",
6467
- "continuous"
6468
- ]);
6469
- /** Which detectors trigger an `events`-mode recording. */
6470
- var RecordingTriggersSchema = object({
6471
- motion: boolean().optional(),
6472
- audioThresholdDbfs: number().optional()
6473
- });
6474
- /**
6475
- * Mode of a single recording band the recorder per-band vocabulary.
6476
- *
6477
- * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6478
- * only ever `continuous` or `events`; "off" is expressed by the absence of a
6479
- * covering band, not by a band value.
6480
- */
6481
- var RecordingBandModeSchema = _enum(["continuous", "events"]);
6482
- /**
6483
- * Triggers for an `events`-mode band. Identical shape to
6484
- * `RecordingTriggersSchema`reuse that schema as the band trigger type so the
6485
- * two never drift.
6486
- */
6487
- var RecordingBandTriggersSchema = RecordingTriggersSchema;
6488
- /**
6489
- * A single mode-per-band window the canonical recorder band shape, the
6490
- * single source of truth re-used by `addon-pipeline/recorder`.
6491
- *
6492
- * `days` lists the weekdays the band covers (empty = every day, matching the
6493
- * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6494
- * span wraps past midnight (handled by the band engine).
6495
- */
6496
- var RecordingBandSchema = object({
6497
- days: array(RecordingWeekdaySchema),
6498
- start: string().regex(HHMM),
6499
- end: string().regex(HHMM),
6500
- mode: RecordingBandModeSchema,
6501
- triggers: RecordingBandTriggersSchema.optional(),
6502
- preBufferSec: number().min(0).optional(),
6503
- postBufferSec: number().min(0).optional()
6504
- });
6505
- var RecordingRuleSchema = object({
6506
- schedule: RecordingScheduleSchema,
6507
- mode: RecordingModeSchema,
6508
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6509
- preBufferSec: number().min(0).default(0),
6510
- /** Keep recording until this many seconds after the last trigger. */
6511
- postBufferSec: number().min(0).default(0),
6512
- /** Each new trigger restarts the post-buffer window. */
6513
- resetTimeoutOnNewEvent: boolean().default(true),
6514
- /** onAudioThreshold only dBFS level that counts as a trigger. */
6515
- thresholdDbfs: number().optional()
6516
- });
6517
- /**
6518
- * Per-device retention overrides. Every field is optional; an unset or `0`
6519
- * value inherits the node-wide recorder default. Only footage-lifetime limits
6520
- * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6521
- * (when the volume is too full to keep recording) is NOT a per-camera concern —
6522
- * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6523
- * shared by every camera writing to that volume.
6524
- */
6525
- var RecordingRetentionSchema = object({
6526
- maxAgeDays: number().min(0).optional(),
6527
- maxSizeGb: number().min(0).optional()
6528
- });
6529
- /**
6530
- * The full per-camera recording intent — the wire shape of a RecordingTarget.
6531
- *
6532
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6533
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6534
- * only for transition + migration (`migrateRulesToMode`); the policy engine
6535
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6536
- */
6537
- var RecordingConfigSchema = object({
6538
- enabled: boolean(),
6539
- /** Authoritative storage mode. Absent on legacy targets → derived once via
6540
- * `migrateRulesToMode`, then persisted. */
6541
- mode: RecordingStorageModeSchema.optional(),
6542
- profiles: array(CamProfileSchema).optional(),
6543
- segmentSeconds: number().int().positive().optional(),
6544
- /** Shared recording time-bands for `events` & `continuous` — record only when
6545
- * the wall-clock falls inside one of these windows. Omit or empty = always.
6546
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
6547
- schedules: array(RecordingScheduleSchema).optional(),
6548
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6549
- * normalized into `schedules` on read and never written going forward. (Not
6550
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6551
- schedule: RecordingScheduleSchema.optional(),
6552
- /** `events`-mode only — which detectors trigger a recording. */
6553
- triggers: RecordingTriggersSchema.optional(),
6554
- /** `events`-mode only — seconds retained before / after a trigger. */
6555
- preBufferSec: number().min(0).optional(),
6556
- postBufferSec: number().min(0).optional(),
6557
- /** DEPRECATED authoring input; retained for migration/transition. */
6558
- rules: array(RecordingRuleSchema).optional(),
6203
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6204
+ DeviceType["Camera"] = "camera";
6205
+ DeviceType["Hub"] = "hub";
6206
+ DeviceType["Light"] = "light";
6207
+ DeviceType["Siren"] = "siren";
6208
+ DeviceType["Switch"] = "switch";
6209
+ DeviceType["Sensor"] = "sensor";
6210
+ DeviceType["Thermostat"] = "thermostat";
6211
+ DeviceType["Button"] = "button";
6212
+ /** Generic stateless event emitter — carries a device's EXACT declared
6213
+ * event vocabulary verbatim (no normalization). Installed with the
6214
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6215
+ * HA bus events (e.g. `zha_event`, generic). */
6216
+ DeviceType["EventEmitter"] = "event-emitter";
6217
+ /** Firmware/software update entity — current vs available version,
6218
+ * updatable flag, update state, and an install action. Installed with
6219
+ * the `update` cap. Sources: Homematic firmware-update channels (and
6220
+ * reusable by other providers, e.g. HA `update.*` entities). */
6221
+ DeviceType["Update"] = "update";
6222
+ DeviceType["Generic"] = "generic";
6223
+ /** Generic notification delivery target (HA `notify.<service>`, future
6224
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6225
+ * endpoint; the `notifier` cap defines the send surface. */
6226
+ DeviceType["Notifier"] = "notifier";
6227
+ /** Pre-recorded action sequence with optional parameters
6228
+ * (HA `script.*`). Runnable via `script-runner` cap. */
6229
+ DeviceType["Script"] = "script";
6230
+ /** Automation rule (HA `automation.*`) enable/disable + manual
6231
+ * trigger surface exposed via `automation-control` cap. */
6232
+ DeviceType["Automation"] = "automation";
6233
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6234
+ DeviceType["Lock"] = "lock";
6235
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6236
+ * `valve.*`). `cover` cap with sub-roles for variant. */
6237
+ DeviceType["Cover"] = "cover";
6238
+ /** Pipe / water / gas valve with open/close/stop and optional
6239
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6240
+ * modelled on the same open/closed lifecycle. */
6241
+ DeviceType["Valve"] = "valve";
6242
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
6243
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6244
+ * modelled on the same target / mode lifecycle. */
6245
+ DeviceType["Humidifier"] = "humidifier";
6246
+ /** Water heater / boiler with target temperature + operation mode +
6247
+ * away mode (HA `water_heater.*`). `water-heater` cap a
6248
+ * climate-family actuator. */
6249
+ DeviceType["WaterHeater"] = "water-heater";
6250
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6251
+ DeviceType["Fan"] = "fan";
6252
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6253
+ * the camera surface those use `Camera`. `media-player` cap. */
6254
+ DeviceType["MediaPlayer"] = "media-player";
6255
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
6256
+ * `alarm-panel` cap. */
6257
+ DeviceType["AlarmPanel"] = "alarm-panel";
6258
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
6259
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
6260
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6261
+ * TextControl / DateTimeControl. */
6262
+ DeviceType["Control"] = "control";
6263
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6264
+ * `presence` cap. */
6265
+ DeviceType["Presence"] = "presence";
6266
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6267
+ * `weather` cap. */
6268
+ DeviceType["Weather"] = "weather";
6269
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6270
+ DeviceType["Vacuum"] = "vacuum";
6271
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6272
+ * `lawn-mower-control` cap. */
6273
+ DeviceType["LawnMower"] = "lawn-mower";
6274
+ /** Physical HA device group — parent container for entity-children
6275
+ * adopted from a single HA device entry. Not renderable as a
6276
+ * standalone device; exists only to anchor child entities. */
6277
+ DeviceType["Container"] = "container";
6278
+ /** Single still-image entity (HA `image.*`). Read-only display of an
6279
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
6280
+ DeviceType["Image"] = "image";
6281
+ return DeviceType;
6282
+ }({});
6283
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6284
+ DeviceFeature["BatteryOperated"] = "battery-operated";
6285
+ DeviceFeature["Rebootable"] = "rebootable";
6559
6286
  /**
6560
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6561
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6562
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6563
- * derived into bands once via `migrateConfigToBands`.
6287
+ * Device supports an on-demand re-sync of its derived spec with its
6288
+ * upstream source drives the generic Re-sync button. The owning
6289
+ * provider implements the action via the `device-adoption.resync` cap.
6564
6290
  */
6565
- bands: array(RecordingBandSchema).optional(),
6566
- retention: RecordingRetentionSchema.optional()
6567
- });
6568
- /**
6569
- * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6570
- * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6571
- * so the persisted record schema and the consumer-facing cap can both consume it
6572
- * without forming a circular import. The `storage` cap re-exports it
6573
- * verbatim for back-compat.
6574
- *
6575
- * This Zod schema is the **authoritative source** for `StorageLocationType`.
6576
- * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6577
- * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6578
- * `IStorageProvider` interface stay in lockstep.
6579
- *
6580
- * The type is now an **open string** (not a closed enum) — addons declare
6581
- * their own location kinds via `StorageLocationDeclaration.id`. The regex
6582
- * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6583
- */
6584
- var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6585
- /**
6586
- * Persisted record for a storage location instance. Operators can register
6587
- * multiple instances for multi-cardinality types (e.g. two `backups`
6588
- * locations with different `providerId`s). Cardinality is now declared per
6589
- * location via `StorageLocationDeclaration.cardinality` — the static
6590
- * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6591
- *
6592
- * `id` is a stable namespaced string of the form `<type>:<slug>`.
6593
- * The default location for a type uses `id === <type>:default` by
6594
- * convention (the bare type ref like `'backups'` resolves to it).
6595
- *
6596
- * `isSystem: true` marks a location as orchestrator-seeded and
6597
- * undeletable. The bootstrap-installed defaults (one per type) carry
6598
- * this flag; operator-added locations don't. Editing the config of
6599
- * a system location is allowed (path migration, provider swap) but
6600
- * deleting it is rejected at the cap level.
6601
- */
6602
- var StorageLocationSchema = object({
6603
- id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6604
- type: string(),
6605
- displayName: string().min(1),
6606
- providerId: string().min(1),
6607
- config: record(string(), unknown()),
6291
+ DeviceFeature["Resyncable"] = "resyncable";
6292
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
6293
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
6294
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
6295
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6608
6296
  /**
6609
- * Cluster node this location physically lives on. REQUIRED for node-local
6610
- * providers (filesystem the path exists on one node's disk), null/absent
6611
- * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6612
- * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6613
- * flag at upsert time, not here (the schema is provider-agnostic).
6297
+ * Camera supports the on-firmware autotrack subsystem (subject-
6298
+ * following). Distinct from `PanTiltZoom` because not every PTZ
6299
+ * camera ships autotrack the admin UI uses this flag to gate
6300
+ * the autotrack toggle / settings card without re-deriving from
6301
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
6302
+ * driver sets this feature when probe confirms the firmware
6303
+ * surface, and registers the cap in the same code path.
6614
6304
  */
6615
- nodeId: string().optional(),
6616
- isDefault: boolean().default(false),
6617
- isSystem: boolean().default(false),
6618
- createdAt: number(),
6619
- updatedAt: number()
6620
- });
6305
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6306
+ /**
6307
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
6308
+ * motion detection automatically activates this device. Mirrors
6309
+ * `motion-trigger` cap registration: drivers set this feature in the
6310
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6311
+ *
6312
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6313
+ * fast scalar without binding fetch), notifier rules, and `listAll`
6314
+ * filters that want "all devices with on-motion behaviour".
6315
+ */
6316
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
6317
+ /** Light supports rgb-triplet color via `color` cap. */
6318
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
6319
+ /** Light supports HSV color via `color` cap. */
6320
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
6321
+ /** Light supports color-temperature (mired) via `color` cap. */
6322
+ DeviceFeature["LightColorMired"] = "light-color-mired";
6323
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6324
+ * targetHigh). Gates the range slider UI. */
6325
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
6326
+ /** Thermostat exposes target humidity and/or current humidity
6327
+ * readings. Gates the humidity controls. */
6328
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
6329
+ /** Thermostat exposes a fan-mode selector. */
6330
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
6331
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
6332
+ DeviceFeature["ClimatePreset"] = "climate-preset";
6333
+ /** Cover exposes intermediate position control (0..100). Gates the
6334
+ * position slider UI. */
6335
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
6336
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
6337
+ DeviceFeature["CoverTilt"] = "cover-tilt";
6338
+ /** Valve exposes intermediate position control (0..100). Gates the
6339
+ * position slider / drag surface UI. */
6340
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
6341
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
6342
+ DeviceFeature["FanSpeed"] = "fan-speed";
6343
+ /** Fan exposes a preset mode selector. */
6344
+ DeviceFeature["FanPreset"] = "fan-preset";
6345
+ /** Fan exposes blade direction (forward/reverse) — typical of
6346
+ * ceiling fans. */
6347
+ DeviceFeature["FanDirection"] = "fan-direction";
6348
+ /** Fan exposes an oscillation toggle. */
6349
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
6350
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
6351
+ * field on the UI lock-controls panel. */
6352
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
6353
+ /** Lock supports a latch-release ("open door") action distinct from
6354
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
6355
+ * `supported_features`. Gates the Open Door button in the UI. */
6356
+ DeviceFeature["LockOpen"] = "lock-open";
6357
+ /** Media player exposes a seek-to-position surface. */
6358
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
6359
+ /** Media player exposes a volume-level setter. */
6360
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
6361
+ /** Media player exposes a mute toggle distinct from volume=0. */
6362
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
6363
+ /** Media player exposes a shuffle toggle. */
6364
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
6365
+ /** Media player exposes a repeat mode (off / all / one). */
6366
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
6367
+ /** Media player exposes a source / input selector. */
6368
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
6369
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
6370
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
6371
+ /** Media player exposes next-track. */
6372
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
6373
+ /** Media player exposes previous-track. */
6374
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
6375
+ /** Media player exposes stop distinct from pause. */
6376
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
6377
+ /** Alarm panel requires a PIN code on arm/disarm. */
6378
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
6379
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
6380
+ * addition to a textual location. */
6381
+ DeviceFeature["PresenceGps"] = "presence-gps";
6382
+ /** Notifier accepts an inline / URL image attachment. */
6383
+ DeviceFeature["NotifierImage"] = "notifier-image";
6384
+ /** Notifier accepts a priority hint (high/normal/low). */
6385
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
6386
+ /** Notifier accepts a free-form `data` payload for platform-specific
6387
+ * fields. */
6388
+ DeviceFeature["NotifierData"] = "notifier-data";
6389
+ /** Notifier supports interactive action buttons / callbacks. */
6390
+ DeviceFeature["NotifierActions"] = "notifier-actions";
6391
+ /** Notifier supports per-call recipient targeting (multi-user). */
6392
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
6393
+ /** Script runner accepts a variables map on each run invocation. */
6394
+ DeviceFeature["ScriptVariables"] = "script-variables";
6395
+ /** Automation `trigger` accepts a skipCondition flag — fires the
6396
+ * automation's actions while bypassing its condition block. */
6397
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
6398
+ return DeviceFeature;
6399
+ }({});
6621
6400
  /**
6622
- * Reference accepted by consumer-facing `api.storage.*` calls.
6623
- * Either:
6624
- * - a `StorageLocationType` (e.g. `'backups'`) orchestrator resolves to the default of that type
6625
- * - a fully-qualified id (e.g. `'backups:nas-01'`) addresses a specific instance
6401
+ * Semantic role a device plays within its parent. Populated by driver
6402
+ * addons when creating accessory devices (Reolink siren/floodlight/
6403
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
6404
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
6405
+ * `role: Floodlight` renders as a bulb with a brightness slider,
6406
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
6626
6407
  *
6627
- * The orchestrator's `resolveRef(ref)` handles both cases.
6408
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
6409
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
6628
6410
  */
6629
- var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6411
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6412
+ DeviceRole["Siren"] = "siren";
6413
+ DeviceRole["Floodlight"] = "floodlight";
6414
+ DeviceRole["Spotlight"] = "spotlight";
6415
+ DeviceRole["PirSensor"] = "pir-sensor";
6416
+ DeviceRole["Chime"] = "chime";
6417
+ DeviceRole["Autotrack"] = "autotrack";
6418
+ DeviceRole["Nightvision"] = "nightvision";
6419
+ DeviceRole["PrivacyMask"] = "privacy-mask";
6420
+ DeviceRole["Doorbell"] = "doorbell";
6421
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
6422
+ * real Switch device for UI rendering / export adapters. */
6423
+ DeviceRole["BinaryHelper"] = "binary-helper";
6424
+ /** Generic motion / occupancy / moving event source. Distinct from
6425
+ * the camera accessory PirSensor role: that one is a camera child;
6426
+ * this is a standalone HA / 3rd-party motion sensor. */
6427
+ DeviceRole["MotionSensor"] = "motion-sensor";
6428
+ DeviceRole["ContactSensor"] = "contact-sensor";
6429
+ DeviceRole["LeakSensor"] = "leak-sensor";
6430
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
6431
+ DeviceRole["COSensor"] = "co-sensor";
6432
+ DeviceRole["GasSensor"] = "gas-sensor";
6433
+ DeviceRole["TamperSensor"] = "tamper-sensor";
6434
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
6435
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
6436
+ DeviceRole["SoundSensor"] = "sound-sensor";
6437
+ /** Fallback for `binary_sensor` without a known `device_class`. */
6438
+ DeviceRole["BinarySensor"] = "binary-sensor";
6439
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
6440
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
6441
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6442
+ DeviceRole["PressureSensor"] = "pressure-sensor";
6443
+ DeviceRole["PowerSensor"] = "power-sensor";
6444
+ DeviceRole["EnergySensor"] = "energy-sensor";
6445
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
6446
+ DeviceRole["CurrentSensor"] = "current-sensor";
6447
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
6448
+ /** Battery level (numeric % via `sensor` OR low-bool via
6449
+ * `binary_sensor` — the cap distinguishes via the value type). */
6450
+ DeviceRole["BatterySensor"] = "battery-sensor";
6451
+ /** Fallback for `sensor` numeric without a known `device_class`. */
6452
+ DeviceRole["NumericSensor"] = "numeric-sensor";
6453
+ /** String / enum state (HA `sensor` with `state_class: enum` or
6454
+ * `attributes.options`). */
6455
+ DeviceRole["EnumSensor"] = "enum-sensor";
6456
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
6457
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
6458
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
6459
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
6460
+ /** Last-resort fallback when nothing else matches. */
6461
+ DeviceRole["GenericSensor"] = "generic-sensor";
6462
+ DeviceRole["NumericControl"] = "numeric-control";
6463
+ DeviceRole["SelectControl"] = "select-control";
6464
+ DeviceRole["TextControl"] = "text-control";
6465
+ DeviceRole["DateTimeControl"] = "datetime-control";
6466
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
6467
+ * rich features (image, priority, channel routing). */
6468
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
6469
+ /** Chat / messaging service (HA `notify.telegram_*`,
6470
+ * `notify.discord_*`, etc.). */
6471
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
6472
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
6473
+ DeviceRole["EmailNotifier"] = "email-notifier";
6474
+ /** Fallback when the notifier service name doesn't match a known
6475
+ * pattern. */
6476
+ DeviceRole["GenericNotifier"] = "generic-notifier";
6477
+ return DeviceRole;
6478
+ }({});
6630
6479
  /**
6631
- * `StorageLocationDeclaration` a single storage-location entry declared by
6632
- * an addon in its `package.json` under `camstack.storageLocations`.
6480
+ * Generic types for capability definitions.
6633
6481
  *
6634
- * Design intent:
6635
- * - **Addon declares its needs**each addon describes the logical storage
6636
- * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6637
- * about the physical path.
6638
- * - **Kernel aggregates** at boot the kernel collects declarations from all
6639
- * installed addons, deduplicates by `id`, and exposes the union via the
6640
- * storage-locations settings surface.
6641
- * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6642
- * at least one instance named `<id>:default` is present, using
6643
- * `defaultsTo` to inherit the resolved root from another location when the
6644
- * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6645
- * `recordings`).
6646
- * - **ids are global** — `id` values are shared across the entire deployment;
6647
- * two addons declaring the same `id` must agree on `cardinality` (validated
6648
- * at kernel aggregation time, not here).
6482
+ * A capability is defined with Zod schemas for methods, events, and settings.
6483
+ * TypeScript types are inferred via z.infer<> zero duplication.
6484
+ *
6485
+ * Pattern:
6486
+ * 1. Define Zod schemas for data, methods, settings
6487
+ * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
6488
+ * 3. Export type IProvider = InferProvider<typeof capabilityDef>
6489
+ * 4. Addon implements IProvider
6490
+ * 5. Registry auto-mounts tRPC router from definition.methods
6649
6491
  */
6650
- var StorageLocationDeclarationSchema = object({
6651
- /**
6652
- * Global location identifier, e.g. `recordings` or `recordingsLow`.
6653
- * Must start with a lowercase letter and may contain letters, digits, and
6654
- * hyphens.
6655
- */
6656
- id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6657
- /** Human-readable name shown in the admin UI. */
6658
- displayName: string().min(1, { message: "displayName must not be empty" }),
6659
- /** Optional longer explanation of what data this location stores. */
6492
+ /**
6493
+ * Output schema shared by the contribution + live methods.
6494
+ *
6495
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
6496
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
6497
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
6498
+ * (using `z.unknown()` here collapses unrelated router branches to
6499
+ * `unknown` when the generator re-inlines the huge AppRouter type).
6500
+ *
6501
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
6502
+ * extensions the caller adds (showWhen, displayScale, …) without
6503
+ * rebuilding every time a new field kind is introduced.
6504
+ */
6505
+ var ContributionSectionSchema = object({
6506
+ id: string(),
6507
+ title: string(),
6660
6508
  description: string().optional(),
6661
- /**
6662
- * `single` — exactly one instance of this location is allowed system-wide
6663
- * (e.g. `logs`, `models`). The operator can edit it but not add more.
6664
- * `multi` — the operator may register several instances (e.g. a second
6665
- * `recordings` on a NAS for disk tiering); one is the default at any time.
6666
- */
6667
- cardinality: _enum(["single", "multi"]),
6668
- /**
6669
- * When set, the default instance for this location inherits its resolved
6670
- * root from the named location's default instance. Useful for derivative
6671
- * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6672
- * configure the primary location.
6673
- */
6674
- defaultsTo: string().optional()
6675
- });
6676
- var DecoderStatsSchema = object({
6677
- inputFps: number(),
6678
- outputFps: number(),
6679
- avgDecodeTimeMs: number(),
6680
- droppedFrames: number()
6681
- });
6682
- var DecoderSessionConfigSchema = object({
6683
- codec: string(),
6684
- maxFps: number().default(0),
6685
- outputFormat: _enum([
6686
- "jpeg",
6687
- "rgb",
6688
- "bgr",
6689
- "yuv420",
6690
- "gray"
6691
- ]).default("jpeg"),
6692
- scale: number().default(1),
6693
- width: number().optional(),
6694
- height: number().optional(),
6695
- /**
6696
- * Identifier of the camera this decoder session serves. Optional
6697
- * because the cap is generic (any caller could request decode), but
6698
- * stream-broker passes it so decoder logs include `deviceId` for
6699
- * per-camera filtering when diagnosing failures (e.g. node-av
6700
- * sendPacket errors on a single hung camera).
6701
- */
6702
- deviceId: number().int().nonnegative().optional(),
6703
- /**
6704
- * Free-form tag for log scoping. Stream-broker uses
6705
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6706
- * on every line so `grep tag=broker:5/high` filters one camera
6707
- * profile cleanly.
6708
- */
6709
- tag: string().optional(),
6710
- /**
6711
- * Where the session delivers decoded frames (Phase 5 / D9):
6712
- *
6713
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
6714
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
6715
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
6716
- * into an OS shared-memory ring and drained as zero-pixel
6717
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
6718
- * other — `pullFrames` returns nothing for an `'shm'` session and
6719
- * `pullHandles` returns nothing for a `'callback'` session.
6720
- */
6721
- frameSink: _enum(["callback", "shm"]).default("callback")
6509
+ style: _enum(["card", "accordion"]).optional(),
6510
+ defaultCollapsed: boolean().optional(),
6511
+ columns: union([
6512
+ literal(1),
6513
+ literal(2),
6514
+ literal(3),
6515
+ literal(4)
6516
+ ]).optional(),
6517
+ tab: string().optional(),
6518
+ location: _enum(["settings", "top-tab"]).optional(),
6519
+ order: number().optional(),
6520
+ fields: array(any())
6722
6521
  });
6723
- var EncodeProfileSchema = object({
6724
- video: object({
6725
- codec: _enum([
6726
- "h264",
6727
- "h265",
6728
- "copy"
6729
- ]),
6730
- profile: _enum([
6731
- "baseline",
6732
- "main",
6733
- "high"
6734
- ]).optional(),
6735
- width: number().int().positive().optional(),
6736
- height: number().int().positive().optional(),
6737
- fps: number().positive().optional(),
6738
- bitrateKbps: number().int().positive().optional(),
6739
- gopFrames: number().int().positive().optional(),
6740
- bf: number().int().min(0).optional(),
6741
- preset: _enum([
6742
- "ultrafast",
6743
- "superfast",
6744
- "veryfast",
6745
- "faster",
6746
- "fast",
6747
- "medium"
6748
- ]).optional(),
6749
- tune: _enum([
6750
- "zerolatency",
6751
- "film",
6752
- "animation"
6753
- ]).optional()
6754
- }),
6755
- audio: union([literal("passthrough"), object({
6756
- codec: _enum([
6757
- "opus",
6758
- "aac",
6759
- "pcmu",
6760
- "pcma",
6761
- "copy"
6762
- ]),
6763
- bitrateKbps: number().int().positive().optional(),
6764
- sampleRateHz: number().int().positive().optional(),
6765
- channels: union([literal(1), literal(2)]).optional()
6766
- })]),
6767
- /**
6768
- * ffmpeg input-side args, inserted between the fixed global flags
6769
- * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6770
- * the widget surfaces a textarea + suggestion chips for the most-
6771
- * used demuxer/format options.
6772
- */
6773
- inputArgs: array(string()).optional(),
6774
- /**
6775
- * ffmpeg output-side args, inserted between the encode block and
6776
- * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6777
- * filters, codec-specific overrides. Free-text array.
6778
- */
6779
- outputArgs: array(string()).optional()
6522
+ object({
6523
+ tabs: array(object({
6524
+ id: string(),
6525
+ label: string(),
6526
+ icon: string(),
6527
+ order: number().optional()
6528
+ })).optional(),
6529
+ sections: array(ContributionSectionSchema)
6530
+ }).nullable();
6531
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
6532
+ deviceId: number(),
6533
+ patch: record(string(), unknown())
6534
+ }), object({ success: literal(true) });
6535
+ object({ deviceId: number() }), unknown().nullable();
6536
+ /** Shorthand to define a method schema */
6537
+ function method(input, output, options) {
6538
+ return {
6539
+ input,
6540
+ output,
6541
+ kind: options?.kind ?? "query",
6542
+ auth: options?.auth ?? "protected",
6543
+ ...options?.access !== void 0 ? { access: options.access } : {},
6544
+ timeoutMs: options?.timeoutMs
6545
+ };
6546
+ }
6547
+ /** Shorthand to define an event schema */
6548
+ function event(data) {
6549
+ return { data };
6550
+ }
6551
+ var StaticDirOutputSchema = object({ staticDir: string() });
6552
+ var VersionOutputSchema = object({ version: string() });
6553
+ method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6554
+ /**
6555
+ * device-ops — device-scoped cap that unifies the per-IDevice operations
6556
+ * previously routed through the `.device-ops` Moleculer bridge service.
6557
+ *
6558
+ * Each worker that hosts live `IDevice` instances auto-registers a native
6559
+ * provider for this cap (per device) backed by its local
6560
+ * `DeviceRegistry`. Hub-side callers reach it transparently through
6561
+ * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
6562
+ * `deviceId` + `nodeId` and dispatches through the standard cap-router,
6563
+ * so there's no parallel bridge path anymore.
6564
+ *
6565
+ * The surface is intentionally small — every method corresponds to a
6566
+ * single action on the live `IDevice` (or `ICameraDevice` for
6567
+ * `getStreamSources`). Richer orchestration (enable/disable with
6568
+ * integration plumbing, bulk updates) stays in the `device-manager` cap;
6569
+ * `device-ops` is the per-device primitive the device-manager routes to.
6570
+ */
6571
+ var StreamSourceEntrySchema = object({
6572
+ id: string(),
6573
+ label: string(),
6574
+ protocol: _enum([
6575
+ "rtsp",
6576
+ "rtmp",
6577
+ "annexb",
6578
+ "http-mjpeg",
6579
+ "webrtc",
6580
+ "custom"
6581
+ ]),
6582
+ url: string().optional(),
6583
+ resolution: object({
6584
+ width: number(),
6585
+ height: number()
6586
+ }).optional(),
6587
+ fps: number().optional(),
6588
+ bitrate: number().optional(),
6589
+ codec: string().optional(),
6590
+ profileHint: CamProfileSchema.optional(),
6591
+ sdp: string().optional()
6780
6592
  });
6781
- var YAMNET_TO_MACRO = {
6782
- mapping: {
6783
- Speech: "speech",
6784
- "Child speech, kid speaking": "speech",
6785
- Conversation: "speech",
6786
- "Narration, monologue": "speech",
6787
- Babbling: "speech",
6788
- Whispering: "speech",
6789
- "Speech synthesizer": "speech",
6790
- Humming: "speech",
6791
- Rapping: "speech",
6792
- Singing: "speech",
6793
- Choir: "speech",
6794
- "Child singing": "speech",
6795
- Shout: "scream",
6796
- Bellow: "scream",
6797
- Yell: "scream",
6798
- Screaming: "scream",
6799
- "Children shouting": "scream",
6800
- Whoop: "scream",
6801
- "Crying, sobbing": "crying",
6802
- "Baby cry, infant cry": "crying",
6803
- Whimper: "crying",
6804
- "Wail, moan": "crying",
6805
- Groan: "crying",
6806
- Laughter: "laughter",
6807
- "Baby laughter": "laughter",
6808
- Giggle: "laughter",
6809
- Snicker: "laughter",
6810
- "Belly laugh": "laughter",
6811
- "Chuckle, chortle": "laughter",
6812
- Music: "music",
6813
- "Musical instrument": "music",
6814
- Guitar: "music",
6815
- Piano: "music",
6816
- Drum: "music",
6817
- "Drum kit": "music",
6818
- "Violin, fiddle": "music",
6819
- Flute: "music",
6820
- Saxophone: "music",
6821
- Trumpet: "music",
6822
- Synthesizer: "music",
6823
- "Pop music": "music",
6824
- "Rock music": "music",
6825
- "Hip hop music": "music",
6826
- "Classical music": "music",
6827
- Jazz: "music",
6828
- "Electronic music": "music",
6829
- "Background music": "music",
6830
- Dog: "dog",
6831
- Bark: "dog",
6832
- Yip: "dog",
6833
- Howl: "dog",
6834
- "Bow-wow": "dog",
6835
- Growling: "dog",
6836
- "Whimper (dog)": "dog",
6837
- Cat: "cat",
6838
- Purr: "cat",
6839
- Meow: "cat",
6840
- Hiss: "cat",
6841
- Caterwaul: "cat",
6842
- Bird: "bird",
6843
- "Bird vocalization, bird call, bird song": "bird",
6844
- "Chirp, tweet": "bird",
6845
- Squawk: "bird",
6846
- Crow: "bird",
6847
- Owl: "bird",
6848
- "Pigeon, dove": "bird",
6849
- Animal: "animal",
6850
- "Domestic animals, pets": "animal",
6851
- "Livestock, farm animals, working animals": "animal",
6852
- Horse: "animal",
6853
- "Cattle, bovinae": "animal",
6854
- Pig: "animal",
6855
- Sheep: "animal",
6856
- Goat: "animal",
6857
- Frog: "animal",
6858
- Insect: "animal",
6859
- Cricket: "animal",
6860
- Alarm: "alarm",
6861
- "Alarm clock": "alarm",
6862
- "Smoke detector, smoke alarm": "alarm",
6863
- "Fire alarm": "alarm",
6864
- Buzzer: "alarm",
6865
- "Civil defense siren": "alarm",
6866
- "Car alarm": "alarm",
6867
- Siren: "siren",
6868
- "Police car (siren)": "siren",
6869
- "Ambulance (siren)": "siren",
6870
- "Fire engine, fire truck (siren)": "siren",
6871
- "Emergency vehicle": "siren",
6872
- Foghorn: "siren",
6873
- Doorbell: "doorbell",
6874
- "Ding-dong": "doorbell",
6875
- Knock: "doorbell",
6876
- Tap: "doorbell",
6877
- Glass: "glass_breaking",
6878
- Shatter: "glass_breaking",
6879
- "Chink, clink": "glass_breaking",
6880
- "Gunshot, gunfire": "gunshot",
6881
- "Machine gun": "gunshot",
6882
- Explosion: "gunshot",
6883
- Fireworks: "gunshot",
6884
- Firecracker: "gunshot",
6885
- "Artillery fire": "gunshot",
6886
- "Cap gun": "gunshot",
6887
- Boom: "gunshot",
6888
- Vehicle: "vehicle",
6889
- Car: "vehicle",
6890
- Truck: "vehicle",
6891
- Bus: "vehicle",
6892
- Motorcycle: "vehicle",
6893
- "Car passing by": "vehicle",
6894
- "Vehicle horn, car horn, honking": "vehicle",
6895
- "Traffic noise, roadway noise": "vehicle",
6896
- Train: "vehicle",
6897
- Aircraft: "vehicle",
6898
- Helicopter: "vehicle",
6899
- Bicycle: "vehicle",
6900
- Skateboard: "vehicle",
6901
- Fire: "fire",
6902
- Crackle: "fire",
6903
- Water: "water",
6904
- Rain: "water",
6905
- Raindrop: "water",
6906
- "Rain on surface": "water",
6907
- Stream: "water",
6908
- Waterfall: "water",
6909
- Ocean: "water",
6910
- "Waves, surf": "water",
6911
- "Splash, splatter": "water",
6912
- Wind: "wind",
6913
- Thunderstorm: "wind",
6914
- Thunder: "wind",
6915
- "Wind noise (microphone)": "wind",
6916
- "Rustling leaves": "wind",
6917
- Door: "door",
6918
- "Sliding door": "door",
6919
- Slam: "door",
6920
- "Cupboard open or close": "door",
6921
- "Walk, footsteps": "footsteps",
6922
- Run: "footsteps",
6923
- Shuffle: "footsteps",
6924
- Crowd: "crowd",
6925
- Chatter: "crowd",
6926
- Cheering: "crowd",
6927
- Applause: "crowd",
6928
- "Children playing": "crowd",
6929
- "Hubbub, speech noise, speech babble": "crowd",
6930
- Telephone: "telephone",
6931
- "Telephone bell ringing": "telephone",
6932
- Ringtone: "telephone",
6933
- "Telephone dialing, DTMF": "telephone",
6934
- "Busy signal": "telephone",
6935
- Engine: "engine",
6936
- "Engine starting": "engine",
6937
- Idling: "engine",
6938
- "Accelerating, revving, vroom": "engine",
6939
- "Light engine (high frequency)": "engine",
6940
- "Medium engine (mid frequency)": "engine",
6941
- "Heavy engine (low frequency)": "engine",
6942
- "Lawn mower": "engine",
6943
- Chainsaw: "engine",
6944
- Hammer: "tools",
6945
- Jackhammer: "tools",
6946
- Sawing: "tools",
6947
- "Power tool": "tools",
6948
- Drill: "tools",
6949
- Sanding: "tools",
6950
- Silence: "silence"
6951
- },
6952
- preserveOriginal: false
6593
+ var ConfigEntrySchema$1 = object({
6594
+ key: string(),
6595
+ value: unknown()
6596
+ });
6597
+ var RawStateResultSchema = object({
6598
+ /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
6599
+ source: string(),
6600
+ /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
6601
+ data: record(string(), unknown())
6602
+ });
6603
+ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
6604
+ deviceId: number(),
6605
+ values: record(string(), unknown())
6606
+ }), _void(), { kind: "mutation" }), method(object({
6607
+ deviceId: number(),
6608
+ action: string().min(1),
6609
+ input: unknown()
6610
+ }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
6611
+ /**
6612
+ * Promise-based timer helpers — used everywhere the codebase needs to
6613
+ * wait, back off, or schedule a retry. Before these helpers landed, each
6614
+ * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
6615
+ * with subtle variations (some swallowing cancellation, some not). Two
6616
+ * shapes cover every observed use case:
6617
+ *
6618
+ * - {@link sleep} for a plain, uncancellable wait — the default choice.
6619
+ * - {@link sleepCancellable} for a wait that wakes early when an
6620
+ * abort signal trips, used by long-running pollers whose teardown
6621
+ * must stop a pending backoff promptly.
6622
+ */
6623
+ /**
6624
+ * Resolve after `ms` milliseconds. Never rejects, never cancels. The
6625
+ * sleep cannot be interrupted; for a wakeable variant use
6626
+ * {@link sleepCancellable}.
6627
+ *
6628
+ * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
6629
+ * still gives the event loop a chance to drain — useful for breaking
6630
+ * up tight async loops without changing call-site semantics.
6631
+ */
6632
+ function sleep$1(ms) {
6633
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
6634
+ }
6635
+ //#endregion
6636
+ //#region ../types/dist/index.mjs
6637
+ /**
6638
+ * Deep wiring healthcheck — snapshot of active reachability probes across
6639
+ * every declared capability + widget of every installed plugin, on every
6640
+ * node. Produced by the backend `WiringHealthService` and surfaced via
6641
+ * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
6642
+ *
6643
+ * Unlike `/health` (process liveness), this reflects whether each cap/widget
6644
+ * is actually *reachable* over the real cap-dispatch path. See spec
6645
+ * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
6646
+ */
6647
+ /** What kind of target a probe addressed. */
6648
+ var wiringProbeKindSchema = _enum([
6649
+ "singleton",
6650
+ "device",
6651
+ "widget"
6652
+ ]);
6653
+ /** Result of probing a single (cap|widget [, device]) target. */
6654
+ var wiringProbeResultSchema = object({
6655
+ capName: string(),
6656
+ kind: wiringProbeKindSchema,
6657
+ deviceId: number().optional(),
6658
+ reachable: boolean(),
6659
+ latencyMs: number(),
6660
+ error: string().optional()
6661
+ });
6662
+ /** Per-addon roll-up of cap + widget probe results. */
6663
+ var wiringAddonHealthSchema = object({
6664
+ addonId: string(),
6665
+ caps: array(wiringProbeResultSchema).readonly(),
6666
+ widgets: array(wiringProbeResultSchema).readonly()
6667
+ });
6668
+ /** Per-node roll-up. */
6669
+ var wiringNodeHealthSchema = object({
6670
+ nodeId: string(),
6671
+ addons: array(wiringAddonHealthSchema).readonly()
6672
+ });
6673
+ object({
6674
+ /** True only when every probed target is reachable. */
6675
+ ok: boolean(),
6676
+ /** True when at least one target is unreachable. */
6677
+ degraded: boolean(),
6678
+ checkedAt: string(),
6679
+ nodes: array(wiringNodeHealthSchema).readonly(),
6680
+ summary: object({
6681
+ total: number(),
6682
+ reachable: number(),
6683
+ unreachable: number()
6684
+ })
6685
+ });
6686
+ var MODEL_FORMATS = [
6687
+ "onnx",
6688
+ "coreml",
6689
+ "openvino",
6690
+ "tflite",
6691
+ "pt"
6692
+ ];
6693
+ var EU_DST = {
6694
+ offsetHours: 1,
6695
+ startMonth: 3,
6696
+ startWeekIndex: 5,
6697
+ startWeekday: "Sunday",
6698
+ startHour: 2,
6699
+ endMonth: 10,
6700
+ endWeekIndex: 5,
6701
+ endWeekday: "Sunday",
6702
+ endHour: 3
6953
6703
  };
6954
- var APPLE_SA_TO_MACRO = {
6955
- mapping: {
6956
- speech: "speech",
6957
- child_speech: "speech",
6958
- conversation: "speech",
6959
- whispering: "speech",
6960
- singing: "speech",
6961
- humming: "speech",
6962
- shout: "scream",
6963
- yell: "scream",
6964
- screaming: "scream",
6965
- crying: "crying",
6966
- baby_crying: "crying",
6967
- sobbing: "crying",
6968
- laughter: "laughter",
6969
- baby_laughter: "laughter",
6970
- giggling: "laughter",
6971
- music: "music",
6972
- guitar: "music",
6973
- piano: "music",
6974
- drums: "music",
6975
- dog_bark: "dog",
6976
- dog_bow_wow: "dog",
6977
- dog_growling: "dog",
6978
- dog_howl: "dog",
6979
- cat_meow: "cat",
6980
- cat_purr: "cat",
6981
- cat_hiss: "cat",
6982
- bird: "bird",
6983
- bird_chirp: "bird",
6984
- bird_squawk: "bird",
6985
- animal: "animal",
6986
- horse: "animal",
6987
- cow_moo: "animal",
6988
- insect: "animal",
6989
- alarm: "alarm",
6990
- smoke_alarm: "alarm",
6991
- fire_alarm: "alarm",
6992
- car_alarm: "alarm",
6993
- siren: "siren",
6994
- police_siren: "siren",
6995
- ambulance_siren: "siren",
6996
- doorbell: "doorbell",
6997
- door_knock: "doorbell",
6998
- knocking: "doorbell",
6999
- glass_breaking: "glass_breaking",
7000
- glass_shatter: "glass_breaking",
7001
- gunshot: "gunshot",
7002
- explosion: "gunshot",
7003
- fireworks: "gunshot",
7004
- car: "vehicle",
7005
- truck: "vehicle",
7006
- motorcycle: "vehicle",
7007
- car_horn: "vehicle",
7008
- vehicle_horn: "vehicle",
7009
- traffic: "vehicle",
7010
- fire: "fire",
7011
- fire_crackle: "fire",
7012
- water: "water",
7013
- rain: "water",
7014
- ocean: "water",
7015
- splash: "water",
7016
- wind: "wind",
7017
- thunder: "wind",
7018
- thunderstorm: "wind",
7019
- door: "door",
7020
- door_slam: "door",
7021
- sliding_door: "door",
7022
- footsteps: "footsteps",
7023
- walking: "footsteps",
7024
- running: "footsteps",
7025
- crowd: "crowd",
7026
- chatter: "crowd",
7027
- cheering: "crowd",
7028
- applause: "crowd",
7029
- telephone_ring: "telephone",
7030
- ringtone: "telephone",
7031
- engine: "engine",
7032
- engine_starting: "engine",
7033
- lawn_mower: "engine",
7034
- chainsaw: "engine",
7035
- hammer: "tools",
7036
- jackhammer: "tools",
7037
- drill: "tools",
7038
- power_tool: "tools",
7039
- silence: "silence"
7040
- },
7041
- preserveOriginal: false
6704
+ var US_DST = {
6705
+ offsetHours: 1,
6706
+ startMonth: 3,
6707
+ startWeekIndex: 2,
6708
+ startWeekday: "Sunday",
6709
+ startHour: 2,
6710
+ endMonth: 11,
6711
+ endWeekIndex: 1,
6712
+ endWeekday: "Sunday",
6713
+ endHour: 2
7042
6714
  };
7043
- var _macroLookup = /* @__PURE__ */ new Map();
7044
- for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7045
- for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7046
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
7047
- DeviceType["Camera"] = "camera";
7048
- DeviceType["Hub"] = "hub";
7049
- DeviceType["Light"] = "light";
7050
- DeviceType["Siren"] = "siren";
7051
- DeviceType["Switch"] = "switch";
7052
- DeviceType["Sensor"] = "sensor";
7053
- DeviceType["Thermostat"] = "thermostat";
7054
- DeviceType["Button"] = "button";
7055
- /** Generic stateless event emitter — carries a device's EXACT declared
7056
- * event vocabulary verbatim (no normalization). Installed with the
7057
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
7058
- * HA bus events (e.g. `zha_event`, generic). */
7059
- DeviceType["EventEmitter"] = "event-emitter";
7060
- /** Firmware/software update entity — current vs available version,
7061
- * updatable flag, update state, and an install action. Installed with
7062
- * the `update` cap. Sources: Homematic firmware-update channels (and
7063
- * reusable by other providers, e.g. HA `update.*` entities). */
7064
- DeviceType["Update"] = "update";
7065
- DeviceType["Generic"] = "generic";
7066
- /** Generic notification delivery target (HA `notify.<service>`, future
7067
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
7068
- * endpoint; the `notifier` cap defines the send surface. */
7069
- DeviceType["Notifier"] = "notifier";
7070
- /** Pre-recorded action sequence with optional parameters
7071
- * (HA `script.*`). Runnable via `script-runner` cap. */
7072
- DeviceType["Script"] = "script";
7073
- /** Automation rule (HA `automation.*`) — enable/disable + manual
7074
- * trigger surface exposed via `automation-control` cap. */
7075
- DeviceType["Automation"] = "automation";
7076
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
7077
- DeviceType["Lock"] = "lock";
7078
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
7079
- * `valve.*`). `cover` cap with sub-roles for variant. */
7080
- DeviceType["Cover"] = "cover";
7081
- /** Pipe / water / gas valve with open/close/stop and optional
7082
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
7083
- * modelled on the same open/closed lifecycle. */
7084
- DeviceType["Valve"] = "valve";
7085
- /** Humidifier / dehumidifier with on/off + target humidity + mode
7086
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
7087
- * modelled on the same target / mode lifecycle. */
7088
- DeviceType["Humidifier"] = "humidifier";
7089
- /** Water heater / boiler with target temperature + operation mode +
7090
- * away mode (HA `water_heater.*`). `water-heater` cap — a
7091
- * climate-family actuator. */
7092
- DeviceType["WaterHeater"] = "water-heater";
7093
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
7094
- DeviceType["Fan"] = "fan";
7095
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
7096
- * the camera surface — those use `Camera`. `media-player` cap. */
7097
- DeviceType["MediaPlayer"] = "media-player";
7098
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
7099
- * `alarm-panel` cap. */
7100
- DeviceType["AlarmPanel"] = "alarm-panel";
7101
- /** Generic user-settable input (HA `number` / `input_number` / `select`
7102
- * / `input_select` / `text` / `input_text` / `input_datetime`).
7103
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
7104
- * TextControl / DateTimeControl. */
7105
- DeviceType["Control"] = "control";
7106
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
7107
- * `presence` cap. */
7108
- DeviceType["Presence"] = "presence";
7109
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
7110
- * `weather` cap. */
7111
- DeviceType["Weather"] = "weather";
7112
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
7113
- DeviceType["Vacuum"] = "vacuum";
7114
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
7115
- * `lawn-mower-control` cap. */
7116
- DeviceType["LawnMower"] = "lawn-mower";
7117
- /** Physical HA device group — parent container for entity-children
7118
- * adopted from a single HA device entry. Not renderable as a
7119
- * standalone device; exists only to anchor child entities. */
7120
- DeviceType["Container"] = "container";
7121
- /** Single still-image entity (HA `image.*`). Read-only display of an
7122
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
7123
- DeviceType["Image"] = "image";
7124
- return DeviceType;
7125
- }({});
7126
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
7127
- DeviceFeature["BatteryOperated"] = "battery-operated";
7128
- DeviceFeature["Rebootable"] = "rebootable";
7129
- /**
7130
- * Device supports an on-demand re-sync of its derived spec with its
7131
- * upstream source — drives the generic Re-sync button. The owning
7132
- * provider implements the action via the `device-adoption.resync` cap.
7133
- */
7134
- DeviceFeature["Resyncable"] = "resyncable";
7135
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
7136
- DeviceFeature["DoorbellButton"] = "doorbell-button";
7137
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
7138
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
7139
- /**
7140
- * Camera supports the on-firmware autotrack subsystem (subject-
7141
- * following). Distinct from `PanTiltZoom` because not every PTZ
7142
- * camera ships autotrack — the admin UI uses this flag to gate
7143
- * the autotrack toggle / settings card without re-deriving from
7144
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
7145
- * driver sets this feature when probe confirms the firmware
7146
- * surface, and registers the cap in the same code path.
7147
- */
7148
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
7149
- /**
7150
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
7151
- * motion detection automatically activates this device. Mirrors
7152
- * `motion-trigger` cap registration: drivers set this feature in the
7153
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
7154
- *
7155
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
7156
- * fast scalar without binding fetch), notifier rules, and `listAll`
7157
- * filters that want "all devices with on-motion behaviour".
7158
- */
7159
- DeviceFeature["MotionTrigger"] = "motion-trigger";
7160
- /** Light supports rgb-triplet color via `color` cap. */
7161
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
7162
- /** Light supports HSV color via `color` cap. */
7163
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
7164
- /** Light supports color-temperature (mired) via `color` cap. */
7165
- DeviceFeature["LightColorMired"] = "light-color-mired";
7166
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
7167
- * targetHigh). Gates the range slider UI. */
7168
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
7169
- /** Thermostat exposes target humidity and/or current humidity
7170
- * readings. Gates the humidity controls. */
7171
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
7172
- /** Thermostat exposes a fan-mode selector. */
7173
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
7174
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
7175
- DeviceFeature["ClimatePreset"] = "climate-preset";
7176
- /** Cover exposes intermediate position control (0..100). Gates the
7177
- * position slider UI. */
7178
- DeviceFeature["CoverPositionable"] = "cover-positionable";
7179
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
7180
- DeviceFeature["CoverTilt"] = "cover-tilt";
7181
- /** Valve exposes intermediate position control (0..100). Gates the
7182
- * position slider / drag surface UI. */
7183
- DeviceFeature["ValvePositionable"] = "valve-positionable";
7184
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
7185
- DeviceFeature["FanSpeed"] = "fan-speed";
7186
- /** Fan exposes a preset mode selector. */
7187
- DeviceFeature["FanPreset"] = "fan-preset";
7188
- /** Fan exposes blade direction (forward/reverse) — typical of
7189
- * ceiling fans. */
7190
- DeviceFeature["FanDirection"] = "fan-direction";
7191
- /** Fan exposes an oscillation toggle. */
7192
- DeviceFeature["FanOscillating"] = "fan-oscillating";
7193
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
7194
- * field on the UI lock-controls panel. */
7195
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
7196
- /** Lock supports a latch-release ("open door") action distinct from
7197
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
7198
- * `supported_features`. Gates the Open Door button in the UI. */
7199
- DeviceFeature["LockOpen"] = "lock-open";
7200
- /** Media player exposes a seek-to-position surface. */
7201
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
7202
- /** Media player exposes a volume-level setter. */
7203
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
7204
- /** Media player exposes a mute toggle distinct from volume=0. */
7205
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
7206
- /** Media player exposes a shuffle toggle. */
7207
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
7208
- /** Media player exposes a repeat mode (off / all / one). */
7209
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
7210
- /** Media player exposes a source / input selector. */
7211
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
7212
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
7213
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
7214
- /** Media player exposes next-track. */
7215
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
7216
- /** Media player exposes previous-track. */
7217
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
7218
- /** Media player exposes stop distinct from pause. */
7219
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
7220
- /** Alarm panel requires a PIN code on arm/disarm. */
7221
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
7222
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
7223
- * addition to a textual location. */
7224
- DeviceFeature["PresenceGps"] = "presence-gps";
7225
- /** Notifier accepts an inline / URL image attachment. */
7226
- DeviceFeature["NotifierImage"] = "notifier-image";
7227
- /** Notifier accepts a priority hint (high/normal/low). */
7228
- DeviceFeature["NotifierPriority"] = "notifier-priority";
7229
- /** Notifier accepts a free-form `data` payload for platform-specific
7230
- * fields. */
7231
- DeviceFeature["NotifierData"] = "notifier-data";
7232
- /** Notifier supports interactive action buttons / callbacks. */
7233
- DeviceFeature["NotifierActions"] = "notifier-actions";
7234
- /** Notifier supports per-call recipient targeting (multi-user). */
7235
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
7236
- /** Script runner accepts a variables map on each run invocation. */
7237
- DeviceFeature["ScriptVariables"] = "script-variables";
7238
- /** Automation `trigger` accepts a skipCondition flag — fires the
7239
- * automation's actions while bypassing its condition block. */
7240
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
7241
- return DeviceFeature;
7242
- }({});
7243
6715
  /**
7244
- * Semantic role a device plays within its parent. Populated by driver
7245
- * addons when creating accessory devices (Reolink siren/floodlight/
7246
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
7247
- * admin UI to pick icons, labels, and widgets — a `Switch` with
7248
- * `role: Floodlight` renders as a bulb with a brightness slider,
7249
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
7250
- *
7251
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
7252
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
6716
+ * Curated catalogue of common world zones, grouped by region. Not
6717
+ * exhaustive covers the everyday zones an operator is likely to pick.
7253
6718
  */
7254
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7255
- DeviceRole["Siren"] = "siren";
7256
- DeviceRole["Floodlight"] = "floodlight";
7257
- DeviceRole["Spotlight"] = "spotlight";
7258
- DeviceRole["PirSensor"] = "pir-sensor";
7259
- DeviceRole["Chime"] = "chime";
7260
- DeviceRole["Autotrack"] = "autotrack";
7261
- DeviceRole["Nightvision"] = "nightvision";
7262
- DeviceRole["PrivacyMask"] = "privacy-mask";
7263
- DeviceRole["Doorbell"] = "doorbell";
7264
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
7265
- * real Switch device for UI rendering / export adapters. */
7266
- DeviceRole["BinaryHelper"] = "binary-helper";
7267
- /** Generic motion / occupancy / moving event source. Distinct from
7268
- * the camera accessory PirSensor role: that one is a camera child;
7269
- * this is a standalone HA / 3rd-party motion sensor. */
7270
- DeviceRole["MotionSensor"] = "motion-sensor";
7271
- DeviceRole["ContactSensor"] = "contact-sensor";
7272
- DeviceRole["LeakSensor"] = "leak-sensor";
7273
- DeviceRole["SmokeSensor"] = "smoke-sensor";
7274
- DeviceRole["COSensor"] = "co-sensor";
7275
- DeviceRole["GasSensor"] = "gas-sensor";
7276
- DeviceRole["TamperSensor"] = "tamper-sensor";
7277
- DeviceRole["VibrationSensor"] = "vibration-sensor";
7278
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
7279
- DeviceRole["SoundSensor"] = "sound-sensor";
7280
- /** Fallback for `binary_sensor` without a known `device_class`. */
7281
- DeviceRole["BinarySensor"] = "binary-sensor";
7282
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
7283
- DeviceRole["HumiditySensor"] = "humidity-sensor";
7284
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
7285
- DeviceRole["PressureSensor"] = "pressure-sensor";
7286
- DeviceRole["PowerSensor"] = "power-sensor";
7287
- DeviceRole["EnergySensor"] = "energy-sensor";
7288
- DeviceRole["VoltageSensor"] = "voltage-sensor";
7289
- DeviceRole["CurrentSensor"] = "current-sensor";
7290
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
7291
- /** Battery level (numeric % via `sensor` OR low-bool via
7292
- * `binary_sensor` the cap distinguishes via the value type). */
7293
- DeviceRole["BatterySensor"] = "battery-sensor";
7294
- /** Fallback for `sensor` numeric without a known `device_class`. */
7295
- DeviceRole["NumericSensor"] = "numeric-sensor";
7296
- /** String / enum state (HA `sensor` with `state_class: enum` or
7297
- * `attributes.options`). */
7298
- DeviceRole["EnumSensor"] = "enum-sensor";
7299
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
7300
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
7301
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
7302
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
7303
- /** Last-resort fallback when nothing else matches. */
7304
- DeviceRole["GenericSensor"] = "generic-sensor";
7305
- DeviceRole["NumericControl"] = "numeric-control";
7306
- DeviceRole["SelectControl"] = "select-control";
7307
- DeviceRole["TextControl"] = "text-control";
7308
- DeviceRole["DateTimeControl"] = "datetime-control";
7309
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
7310
- * rich features (image, priority, channel routing). */
7311
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
7312
- /** Chat / messaging service (HA `notify.telegram_*`,
7313
- * `notify.discord_*`, etc.). */
7314
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
7315
- /** Email-based delivery (HA `notify.smtp`, etc.). */
7316
- DeviceRole["EmailNotifier"] = "email-notifier";
7317
- /** Fallback when the notifier service name doesn't match a known
7318
- * pattern. */
7319
- DeviceRole["GenericNotifier"] = "generic-notifier";
7320
- return DeviceRole;
7321
- }({});
6719
+ var TIMEZONES = [
6720
+ {
6721
+ id: "UTC",
6722
+ label: "UTC (UTC+0)",
6723
+ region: "Universal",
6724
+ stdOffsetMinutes: 0,
6725
+ dst: null
6726
+ },
6727
+ {
6728
+ id: "Europe/London",
6729
+ label: "Europe/London (UTC+0 / BST)",
6730
+ region: "Europe",
6731
+ stdOffsetMinutes: 0,
6732
+ dst: EU_DST
6733
+ },
6734
+ {
6735
+ id: "Europe/Rome",
6736
+ label: "Europe/Rome (UTC+1 / CEST)",
6737
+ region: "Europe",
6738
+ stdOffsetMinutes: 60,
6739
+ dst: EU_DST
6740
+ },
6741
+ {
6742
+ id: "Europe/Paris",
6743
+ label: "Europe/Paris (UTC+1 / CEST)",
6744
+ region: "Europe",
6745
+ stdOffsetMinutes: 60,
6746
+ dst: EU_DST
6747
+ },
6748
+ {
6749
+ id: "Europe/Berlin",
6750
+ label: "Europe/Berlin (UTC+1 / CEST)",
6751
+ region: "Europe",
6752
+ stdOffsetMinutes: 60,
6753
+ dst: EU_DST
6754
+ },
6755
+ {
6756
+ id: "Europe/Madrid",
6757
+ label: "Europe/Madrid (UTC+1 / CEST)",
6758
+ region: "Europe",
6759
+ stdOffsetMinutes: 60,
6760
+ dst: EU_DST
6761
+ },
6762
+ {
6763
+ id: "Europe/Amsterdam",
6764
+ label: "Europe/Amsterdam (UTC+1 / CEST)",
6765
+ region: "Europe",
6766
+ stdOffsetMinutes: 60,
6767
+ dst: EU_DST
6768
+ },
6769
+ {
6770
+ id: "Europe/Istanbul",
6771
+ label: "Europe/Istanbul (UTC+3)",
6772
+ region: "Europe",
6773
+ stdOffsetMinutes: 180,
6774
+ dst: null
6775
+ },
6776
+ {
6777
+ id: "America/New_York",
6778
+ label: "America/New York (UTC−5 / EDT)",
6779
+ region: "Americas",
6780
+ stdOffsetMinutes: -300,
6781
+ dst: US_DST
6782
+ },
6783
+ {
6784
+ id: "America/Chicago",
6785
+ label: "America/Chicago (UTC−6 / CDT)",
6786
+ region: "Americas",
6787
+ stdOffsetMinutes: -360,
6788
+ dst: US_DST
6789
+ },
6790
+ {
6791
+ id: "America/Denver",
6792
+ label: "America/Denver (UTC−7 / MDT)",
6793
+ region: "Americas",
6794
+ stdOffsetMinutes: -420,
6795
+ dst: US_DST
6796
+ },
6797
+ {
6798
+ id: "America/Los_Angeles",
6799
+ label: "America/Los Angeles (UTC−8 / PDT)",
6800
+ region: "Americas",
6801
+ stdOffsetMinutes: -480,
6802
+ dst: US_DST
6803
+ },
6804
+ {
6805
+ id: "America/Sao_Paulo",
6806
+ label: "America/Sao Paulo (UTC−3)",
6807
+ region: "Americas",
6808
+ stdOffsetMinutes: -180,
6809
+ dst: null
6810
+ },
6811
+ {
6812
+ id: "Asia/Dubai",
6813
+ label: "Asia/Dubai (UTC+4)",
6814
+ region: "Asia",
6815
+ stdOffsetMinutes: 240,
6816
+ dst: null
6817
+ },
6818
+ {
6819
+ id: "Asia/Kolkata",
6820
+ label: "Asia/Kolkata (UTC+5:30)",
6821
+ region: "Asia",
6822
+ stdOffsetMinutes: 330,
6823
+ dst: null
6824
+ },
6825
+ {
6826
+ id: "Asia/Singapore",
6827
+ label: "Asia/Singapore (UTC+8)",
6828
+ region: "Asia",
6829
+ stdOffsetMinutes: 480,
6830
+ dst: null
6831
+ },
6832
+ {
6833
+ id: "Asia/Shanghai",
6834
+ label: "Asia/Shanghai (UTC+8)",
6835
+ region: "Asia",
6836
+ stdOffsetMinutes: 480,
6837
+ dst: null
6838
+ },
6839
+ {
6840
+ id: "Asia/Tokyo",
6841
+ label: "Asia/Tokyo (UTC+9)",
6842
+ region: "Asia",
6843
+ stdOffsetMinutes: 540,
6844
+ dst: null
6845
+ },
6846
+ {
6847
+ id: "Australia/Sydney",
6848
+ label: "Australia/Sydney (UTC+10 / AEDT)",
6849
+ region: "Oceania",
6850
+ stdOffsetMinutes: 600,
6851
+ dst: {
6852
+ offsetHours: 1,
6853
+ startMonth: 10,
6854
+ startWeekIndex: 1,
6855
+ startWeekday: "Sunday",
6856
+ startHour: 2,
6857
+ endMonth: 4,
6858
+ endWeekIndex: 1,
6859
+ endWeekday: "Sunday",
6860
+ endHour: 3
6861
+ }
6862
+ }
6863
+ ];
6864
+ /** Resolve an IANA id to its `Timezone`, or `undefined` if unknown. */
6865
+ function findTimezone(id) {
6866
+ return TIMEZONES.find((tz) => tz.id === id);
6867
+ }
6868
+ /**
6869
+ * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6870
+ * Named `RecordingWeekday` to avoid collision with the string-union
6871
+ * `Weekday` exported from `interfaces/timezones.ts`.
6872
+ */
6873
+ var RecordingWeekdaySchema = number().int().min(0).max(6);
6874
+ var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6875
+ var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6876
+ kind: literal("timeOfDay"),
6877
+ start: string().regex(HHMM),
6878
+ end: string().regex(HHMM),
6879
+ /** Restrict to these weekdays; omit = every day. */
6880
+ days: array(RecordingWeekdaySchema).optional()
6881
+ })]);
6882
+ var RecordingModeSchema = _enum([
6883
+ "continuous",
6884
+ "onMotion",
6885
+ "onAudioThreshold"
6886
+ ]);
6887
+ /**
6888
+ * First-class, authoritative per-camera storage mode — the netta choice the UI
6889
+ * reads directly (never inferred from `rules`):
6890
+ * - `off` — not recording.
6891
+ * - `events` — record only around triggers (motion / audio threshold),
6892
+ * with pre/post-buffer.
6893
+ * - `continuous` — record 24/7 within the schedule.
6894
+ *
6895
+ * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6896
+ * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6897
+ */
6898
+ var RecordingStorageModeSchema = _enum([
6899
+ "off",
6900
+ "events",
6901
+ "continuous"
6902
+ ]);
6903
+ /** Which detectors trigger an `events`-mode recording. */
6904
+ var RecordingTriggersSchema = object({
6905
+ motion: boolean().optional(),
6906
+ audioThresholdDbfs: number().optional()
6907
+ });
6908
+ /**
6909
+ * Mode of a single recording band — the recorder per-band vocabulary.
6910
+ *
6911
+ * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6912
+ * only ever `continuous` or `events`; "off" is expressed by the absence of a
6913
+ * covering band, not by a band value.
6914
+ */
6915
+ var RecordingBandModeSchema = _enum(["continuous", "events"]);
6916
+ /**
6917
+ * Triggers for an `events`-mode band. Identical shape to
6918
+ * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6919
+ * two never drift.
6920
+ */
6921
+ var RecordingBandTriggersSchema = RecordingTriggersSchema;
6922
+ /**
6923
+ * A single mode-per-band window — the canonical recorder band shape, the
6924
+ * single source of truth re-used by `addon-pipeline/recorder`.
6925
+ *
6926
+ * `days` lists the weekdays the band covers (empty = every day, matching the
6927
+ * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6928
+ * span wraps past midnight (handled by the band engine).
6929
+ */
6930
+ var RecordingBandSchema = object({
6931
+ days: array(RecordingWeekdaySchema),
6932
+ start: string().regex(HHMM),
6933
+ end: string().regex(HHMM),
6934
+ mode: RecordingBandModeSchema,
6935
+ triggers: RecordingBandTriggersSchema.optional(),
6936
+ preBufferSec: number().min(0).optional(),
6937
+ postBufferSec: number().min(0).optional()
6938
+ });
6939
+ var RecordingRuleSchema = object({
6940
+ schedule: RecordingScheduleSchema,
6941
+ mode: RecordingModeSchema,
6942
+ /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6943
+ preBufferSec: number().min(0).default(0),
6944
+ /** Keep recording until this many seconds after the last trigger. */
6945
+ postBufferSec: number().min(0).default(0),
6946
+ /** Each new trigger restarts the post-buffer window. */
6947
+ resetTimeoutOnNewEvent: boolean().default(true),
6948
+ /** onAudioThreshold only — dBFS level that counts as a trigger. */
6949
+ thresholdDbfs: number().optional()
6950
+ });
6951
+ /**
6952
+ * Per-device retention overrides. Every field is optional; an unset or `0`
6953
+ * value inherits the node-wide recorder default. Only footage-lifetime limits
6954
+ * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6955
+ * (when the volume is too full to keep recording) is NOT a per-camera concern —
6956
+ * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6957
+ * shared by every camera writing to that volume.
6958
+ */
6959
+ var RecordingRetentionSchema = object({
6960
+ maxAgeDays: number().min(0).optional(),
6961
+ maxSizeGb: number().min(0).optional()
6962
+ });
6963
+ /**
6964
+ * The full per-camera recording intent — the wire shape of a RecordingTarget.
6965
+ *
6966
+ * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6967
+ * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6968
+ * only for transition + migration (`migrateRulesToMode`); the policy engine
6969
+ * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6970
+ */
6971
+ var RecordingConfigSchema = object({
6972
+ enabled: boolean(),
6973
+ /** Authoritative storage mode. Absent on legacy targets → derived once via
6974
+ * `migrateRulesToMode`, then persisted. */
6975
+ mode: RecordingStorageModeSchema.optional(),
6976
+ profiles: array(CamProfileSchema).optional(),
6977
+ segmentSeconds: number().int().positive().optional(),
6978
+ /** Shared recording time-bands for `events` & `continuous` — record only when
6979
+ * the wall-clock falls inside one of these windows. Omit or empty = always.
6980
+ * `continuous` compiles to one rule per band; `events` to band × trigger. */
6981
+ schedules: array(RecordingScheduleSchema).optional(),
6982
+ /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6983
+ * normalized into `schedules` on read and never written going forward. (Not
6984
+ * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6985
+ schedule: RecordingScheduleSchema.optional(),
6986
+ /** `events`-mode only — which detectors trigger a recording. */
6987
+ triggers: RecordingTriggersSchema.optional(),
6988
+ /** `events`-mode only — seconds retained before / after a trigger. */
6989
+ preBufferSec: number().min(0).optional(),
6990
+ postBufferSec: number().min(0).optional(),
6991
+ /** DEPRECATED authoring input; retained for migration/transition. */
6992
+ rules: array(RecordingRuleSchema).optional(),
6993
+ /**
6994
+ * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6995
+ * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6996
+ * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6997
+ * derived into bands once via `migrateConfigToBands`.
6998
+ */
6999
+ bands: array(RecordingBandSchema).optional(),
7000
+ retention: RecordingRetentionSchema.optional()
7001
+ });
7002
+ /**
7003
+ * `StorageLocationType` — an addon-declared id that identifies the *kind* of
7004
+ * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7005
+ * so the persisted record schema and the consumer-facing cap can both consume it
7006
+ * without forming a circular import. The `storage` cap re-exports it
7007
+ * verbatim for back-compat.
7008
+ *
7009
+ * This Zod schema is the **authoritative source** for `StorageLocationType`.
7010
+ * The TS alias in `./storage.ts` re-exports `z.infer<typeof
7011
+ * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
7012
+ * `IStorageProvider` interface stay in lockstep.
7013
+ *
7014
+ * The type is now an **open string** (not a closed enum) — addons declare
7015
+ * their own location kinds via `StorageLocationDeclaration.id`. The regex
7016
+ * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
7017
+ */
7018
+ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
7019
+ /**
7020
+ * Persisted record for a storage location instance. Operators can register
7021
+ * multiple instances for multi-cardinality types (e.g. two `backups`
7022
+ * locations with different `providerId`s). Cardinality is now declared per
7023
+ * location via `StorageLocationDeclaration.cardinality` — the static
7024
+ * `STORAGE_LOCATION_CARDINALITY` map has been removed.
7025
+ *
7026
+ * `id` is a stable namespaced string of the form `<type>:<slug>`.
7027
+ * The default location for a type uses `id === <type>:default` by
7028
+ * convention (the bare type ref like `'backups'` resolves to it).
7029
+ *
7030
+ * `isSystem: true` marks a location as orchestrator-seeded and
7031
+ * undeletable. The bootstrap-installed defaults (one per type) carry
7032
+ * this flag; operator-added locations don't. Editing the config of
7033
+ * a system location is allowed (path migration, provider swap) but
7034
+ * deleting it is rejected at the cap level.
7035
+ */
7036
+ var StorageLocationSchema = object({
7037
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
7038
+ type: string(),
7039
+ displayName: string().min(1),
7040
+ providerId: string().min(1),
7041
+ config: record(string(), unknown()),
7042
+ /**
7043
+ * Cluster node this location physically lives on. REQUIRED for node-local
7044
+ * providers (filesystem — the path exists on one node's disk), null/absent
7045
+ * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
7046
+ * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
7047
+ * flag at upsert time, not here (the schema is provider-agnostic).
7048
+ */
7049
+ nodeId: string().optional(),
7050
+ isDefault: boolean().default(false),
7051
+ isSystem: boolean().default(false),
7052
+ createdAt: number(),
7053
+ updatedAt: number()
7054
+ });
7055
+ /**
7056
+ * Reference accepted by consumer-facing `api.storage.*` calls.
7057
+ * Either:
7058
+ * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
7059
+ * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
7060
+ *
7061
+ * The orchestrator's `resolveRef(ref)` handles both cases.
7062
+ */
7063
+ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
7064
+ /**
7065
+ * `StorageLocationDeclaration` — a single storage-location entry declared by
7066
+ * an addon in its `package.json` under `camstack.storageLocations`.
7067
+ *
7068
+ * Design intent:
7069
+ * - **Addon declares its needs** — each addon describes the logical storage
7070
+ * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
7071
+ * about the physical path.
7072
+ * - **Kernel aggregates** — at boot the kernel collects declarations from all
7073
+ * installed addons, deduplicates by `id`, and exposes the union via the
7074
+ * storage-locations settings surface.
7075
+ * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
7076
+ * at least one instance named `<id>:default` is present, using
7077
+ * `defaultsTo` to inherit the resolved root from another location when the
7078
+ * declaration is a derivative slot (e.g. `recordingsLow` defaults to
7079
+ * `recordings`).
7080
+ * - **ids are global** — `id` values are shared across the entire deployment;
7081
+ * two addons declaring the same `id` must agree on `cardinality` (validated
7082
+ * at kernel aggregation time, not here).
7083
+ */
7084
+ var StorageLocationDeclarationSchema = object({
7085
+ /**
7086
+ * Global location identifier, e.g. `recordings` or `recordingsLow`.
7087
+ * Must start with a lowercase letter and may contain letters, digits, and
7088
+ * hyphens.
7089
+ */
7090
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
7091
+ /** Human-readable name shown in the admin UI. */
7092
+ displayName: string().min(1, { message: "displayName must not be empty" }),
7093
+ /** Optional longer explanation of what data this location stores. */
7094
+ description: string().optional(),
7095
+ /**
7096
+ * `single` — exactly one instance of this location is allowed system-wide
7097
+ * (e.g. `logs`, `models`). The operator can edit it but not add more.
7098
+ * `multi` — the operator may register several instances (e.g. a second
7099
+ * `recordings` on a NAS for disk tiering); one is the default at any time.
7100
+ */
7101
+ cardinality: _enum(["single", "multi"]),
7102
+ /**
7103
+ * When set, the default instance for this location inherits its resolved
7104
+ * root from the named location's default instance. Useful for derivative
7105
+ * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
7106
+ * configure the primary location.
7107
+ */
7108
+ defaultsTo: string().optional()
7109
+ });
7110
+ var DecoderStatsSchema = object({
7111
+ inputFps: number(),
7112
+ outputFps: number(),
7113
+ avgDecodeTimeMs: number(),
7114
+ droppedFrames: number()
7115
+ });
7116
+ var DecoderSessionConfigSchema = object({
7117
+ codec: string(),
7118
+ maxFps: number().default(0),
7119
+ outputFormat: _enum([
7120
+ "jpeg",
7121
+ "rgb",
7122
+ "bgr",
7123
+ "yuv420",
7124
+ "gray"
7125
+ ]).default("jpeg"),
7126
+ scale: number().default(1),
7127
+ width: number().optional(),
7128
+ height: number().optional(),
7129
+ /**
7130
+ * Identifier of the camera this decoder session serves. Optional
7131
+ * because the cap is generic (any caller could request decode), but
7132
+ * stream-broker passes it so decoder logs include `deviceId` for
7133
+ * per-camera filtering when diagnosing failures (e.g. node-av
7134
+ * sendPacket errors on a single hung camera).
7135
+ */
7136
+ deviceId: number().int().nonnegative().optional(),
7137
+ /**
7138
+ * Free-form tag for log scoping. Stream-broker uses
7139
+ * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
7140
+ * on every line so `grep tag=broker:5/high` filters one camera
7141
+ * profile cleanly.
7142
+ */
7143
+ tag: string().optional(),
7144
+ /**
7145
+ * Where the session delivers decoded frames (Phase 5 / D9):
7146
+ *
7147
+ * - `'callback'` (default) — the legacy pixel path: decoded frames are
7148
+ * buffered as `DecodedFrame`s and drained via `pullFrames`.
7149
+ * - `'shm'` — the shared-memory frame plane: decoded frames are written
7150
+ * into an OS shared-memory ring and drained as zero-pixel
7151
+ * `FrameHandle`s via `pullHandles`. A session is one mode or the
7152
+ * other — `pullFrames` returns nothing for an `'shm'` session and
7153
+ * `pullHandles` returns nothing for a `'callback'` session.
7154
+ */
7155
+ frameSink: _enum(["callback", "shm"]).default("callback")
7156
+ });
7157
+ var EncodeProfileSchema = object({
7158
+ video: object({
7159
+ codec: _enum([
7160
+ "h264",
7161
+ "h265",
7162
+ "copy"
7163
+ ]),
7164
+ profile: _enum([
7165
+ "baseline",
7166
+ "main",
7167
+ "high"
7168
+ ]).optional(),
7169
+ width: number().int().positive().optional(),
7170
+ height: number().int().positive().optional(),
7171
+ fps: number().positive().optional(),
7172
+ bitrateKbps: number().int().positive().optional(),
7173
+ gopFrames: number().int().positive().optional(),
7174
+ bf: number().int().min(0).optional(),
7175
+ preset: _enum([
7176
+ "ultrafast",
7177
+ "superfast",
7178
+ "veryfast",
7179
+ "faster",
7180
+ "fast",
7181
+ "medium"
7182
+ ]).optional(),
7183
+ tune: _enum([
7184
+ "zerolatency",
7185
+ "film",
7186
+ "animation"
7187
+ ]).optional()
7188
+ }),
7189
+ audio: union([literal("passthrough"), object({
7190
+ codec: _enum([
7191
+ "opus",
7192
+ "aac",
7193
+ "pcmu",
7194
+ "pcma",
7195
+ "copy"
7196
+ ]),
7197
+ bitrateKbps: number().int().positive().optional(),
7198
+ sampleRateHz: number().int().positive().optional(),
7199
+ channels: union([literal(1), literal(2)]).optional()
7200
+ })]),
7201
+ /**
7202
+ * ffmpeg input-side args, inserted between the fixed global flags
7203
+ * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
7204
+ * — the widget surfaces a textarea + suggestion chips for the most-
7205
+ * used demuxer/format options.
7206
+ */
7207
+ inputArgs: array(string()).optional(),
7208
+ /**
7209
+ * ffmpeg output-side args, inserted between the encode block and
7210
+ * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
7211
+ * filters, codec-specific overrides. Free-text array.
7212
+ */
7213
+ outputArgs: array(string()).optional()
7214
+ });
7215
+ var YAMNET_TO_MACRO = {
7216
+ mapping: {
7217
+ Speech: "speech",
7218
+ "Child speech, kid speaking": "speech",
7219
+ Conversation: "speech",
7220
+ "Narration, monologue": "speech",
7221
+ Babbling: "speech",
7222
+ Whispering: "speech",
7223
+ "Speech synthesizer": "speech",
7224
+ Humming: "speech",
7225
+ Rapping: "speech",
7226
+ Singing: "speech",
7227
+ Choir: "speech",
7228
+ "Child singing": "speech",
7229
+ Shout: "scream",
7230
+ Bellow: "scream",
7231
+ Yell: "scream",
7232
+ Screaming: "scream",
7233
+ "Children shouting": "scream",
7234
+ Whoop: "scream",
7235
+ "Crying, sobbing": "crying",
7236
+ "Baby cry, infant cry": "crying",
7237
+ Whimper: "crying",
7238
+ "Wail, moan": "crying",
7239
+ Groan: "crying",
7240
+ Laughter: "laughter",
7241
+ "Baby laughter": "laughter",
7242
+ Giggle: "laughter",
7243
+ Snicker: "laughter",
7244
+ "Belly laugh": "laughter",
7245
+ "Chuckle, chortle": "laughter",
7246
+ Music: "music",
7247
+ "Musical instrument": "music",
7248
+ Guitar: "music",
7249
+ Piano: "music",
7250
+ Drum: "music",
7251
+ "Drum kit": "music",
7252
+ "Violin, fiddle": "music",
7253
+ Flute: "music",
7254
+ Saxophone: "music",
7255
+ Trumpet: "music",
7256
+ Synthesizer: "music",
7257
+ "Pop music": "music",
7258
+ "Rock music": "music",
7259
+ "Hip hop music": "music",
7260
+ "Classical music": "music",
7261
+ Jazz: "music",
7262
+ "Electronic music": "music",
7263
+ "Background music": "music",
7264
+ Dog: "dog",
7265
+ Bark: "dog",
7266
+ Yip: "dog",
7267
+ Howl: "dog",
7268
+ "Bow-wow": "dog",
7269
+ Growling: "dog",
7270
+ "Whimper (dog)": "dog",
7271
+ Cat: "cat",
7272
+ Purr: "cat",
7273
+ Meow: "cat",
7274
+ Hiss: "cat",
7275
+ Caterwaul: "cat",
7276
+ Bird: "bird",
7277
+ "Bird vocalization, bird call, bird song": "bird",
7278
+ "Chirp, tweet": "bird",
7279
+ Squawk: "bird",
7280
+ Crow: "bird",
7281
+ Owl: "bird",
7282
+ "Pigeon, dove": "bird",
7283
+ Animal: "animal",
7284
+ "Domestic animals, pets": "animal",
7285
+ "Livestock, farm animals, working animals": "animal",
7286
+ Horse: "animal",
7287
+ "Cattle, bovinae": "animal",
7288
+ Pig: "animal",
7289
+ Sheep: "animal",
7290
+ Goat: "animal",
7291
+ Frog: "animal",
7292
+ Insect: "animal",
7293
+ Cricket: "animal",
7294
+ Alarm: "alarm",
7295
+ "Alarm clock": "alarm",
7296
+ "Smoke detector, smoke alarm": "alarm",
7297
+ "Fire alarm": "alarm",
7298
+ Buzzer: "alarm",
7299
+ "Civil defense siren": "alarm",
7300
+ "Car alarm": "alarm",
7301
+ Siren: "siren",
7302
+ "Police car (siren)": "siren",
7303
+ "Ambulance (siren)": "siren",
7304
+ "Fire engine, fire truck (siren)": "siren",
7305
+ "Emergency vehicle": "siren",
7306
+ Foghorn: "siren",
7307
+ Doorbell: "doorbell",
7308
+ "Ding-dong": "doorbell",
7309
+ Knock: "doorbell",
7310
+ Tap: "doorbell",
7311
+ Glass: "glass_breaking",
7312
+ Shatter: "glass_breaking",
7313
+ "Chink, clink": "glass_breaking",
7314
+ "Gunshot, gunfire": "gunshot",
7315
+ "Machine gun": "gunshot",
7316
+ Explosion: "gunshot",
7317
+ Fireworks: "gunshot",
7318
+ Firecracker: "gunshot",
7319
+ "Artillery fire": "gunshot",
7320
+ "Cap gun": "gunshot",
7321
+ Boom: "gunshot",
7322
+ Vehicle: "vehicle",
7323
+ Car: "vehicle",
7324
+ Truck: "vehicle",
7325
+ Bus: "vehicle",
7326
+ Motorcycle: "vehicle",
7327
+ "Car passing by": "vehicle",
7328
+ "Vehicle horn, car horn, honking": "vehicle",
7329
+ "Traffic noise, roadway noise": "vehicle",
7330
+ Train: "vehicle",
7331
+ Aircraft: "vehicle",
7332
+ Helicopter: "vehicle",
7333
+ Bicycle: "vehicle",
7334
+ Skateboard: "vehicle",
7335
+ Fire: "fire",
7336
+ Crackle: "fire",
7337
+ Water: "water",
7338
+ Rain: "water",
7339
+ Raindrop: "water",
7340
+ "Rain on surface": "water",
7341
+ Stream: "water",
7342
+ Waterfall: "water",
7343
+ Ocean: "water",
7344
+ "Waves, surf": "water",
7345
+ "Splash, splatter": "water",
7346
+ Wind: "wind",
7347
+ Thunderstorm: "wind",
7348
+ Thunder: "wind",
7349
+ "Wind noise (microphone)": "wind",
7350
+ "Rustling leaves": "wind",
7351
+ Door: "door",
7352
+ "Sliding door": "door",
7353
+ Slam: "door",
7354
+ "Cupboard open or close": "door",
7355
+ "Walk, footsteps": "footsteps",
7356
+ Run: "footsteps",
7357
+ Shuffle: "footsteps",
7358
+ Crowd: "crowd",
7359
+ Chatter: "crowd",
7360
+ Cheering: "crowd",
7361
+ Applause: "crowd",
7362
+ "Children playing": "crowd",
7363
+ "Hubbub, speech noise, speech babble": "crowd",
7364
+ Telephone: "telephone",
7365
+ "Telephone bell ringing": "telephone",
7366
+ Ringtone: "telephone",
7367
+ "Telephone dialing, DTMF": "telephone",
7368
+ "Busy signal": "telephone",
7369
+ Engine: "engine",
7370
+ "Engine starting": "engine",
7371
+ Idling: "engine",
7372
+ "Accelerating, revving, vroom": "engine",
7373
+ "Light engine (high frequency)": "engine",
7374
+ "Medium engine (mid frequency)": "engine",
7375
+ "Heavy engine (low frequency)": "engine",
7376
+ "Lawn mower": "engine",
7377
+ Chainsaw: "engine",
7378
+ Hammer: "tools",
7379
+ Jackhammer: "tools",
7380
+ Sawing: "tools",
7381
+ "Power tool": "tools",
7382
+ Drill: "tools",
7383
+ Sanding: "tools",
7384
+ Silence: "silence"
7385
+ },
7386
+ preserveOriginal: false
7387
+ };
7388
+ var APPLE_SA_TO_MACRO = {
7389
+ mapping: {
7390
+ speech: "speech",
7391
+ child_speech: "speech",
7392
+ conversation: "speech",
7393
+ whispering: "speech",
7394
+ singing: "speech",
7395
+ humming: "speech",
7396
+ shout: "scream",
7397
+ yell: "scream",
7398
+ screaming: "scream",
7399
+ crying: "crying",
7400
+ baby_crying: "crying",
7401
+ sobbing: "crying",
7402
+ laughter: "laughter",
7403
+ baby_laughter: "laughter",
7404
+ giggling: "laughter",
7405
+ music: "music",
7406
+ guitar: "music",
7407
+ piano: "music",
7408
+ drums: "music",
7409
+ dog_bark: "dog",
7410
+ dog_bow_wow: "dog",
7411
+ dog_growling: "dog",
7412
+ dog_howl: "dog",
7413
+ cat_meow: "cat",
7414
+ cat_purr: "cat",
7415
+ cat_hiss: "cat",
7416
+ bird: "bird",
7417
+ bird_chirp: "bird",
7418
+ bird_squawk: "bird",
7419
+ animal: "animal",
7420
+ horse: "animal",
7421
+ cow_moo: "animal",
7422
+ insect: "animal",
7423
+ alarm: "alarm",
7424
+ smoke_alarm: "alarm",
7425
+ fire_alarm: "alarm",
7426
+ car_alarm: "alarm",
7427
+ siren: "siren",
7428
+ police_siren: "siren",
7429
+ ambulance_siren: "siren",
7430
+ doorbell: "doorbell",
7431
+ door_knock: "doorbell",
7432
+ knocking: "doorbell",
7433
+ glass_breaking: "glass_breaking",
7434
+ glass_shatter: "glass_breaking",
7435
+ gunshot: "gunshot",
7436
+ explosion: "gunshot",
7437
+ fireworks: "gunshot",
7438
+ car: "vehicle",
7439
+ truck: "vehicle",
7440
+ motorcycle: "vehicle",
7441
+ car_horn: "vehicle",
7442
+ vehicle_horn: "vehicle",
7443
+ traffic: "vehicle",
7444
+ fire: "fire",
7445
+ fire_crackle: "fire",
7446
+ water: "water",
7447
+ rain: "water",
7448
+ ocean: "water",
7449
+ splash: "water",
7450
+ wind: "wind",
7451
+ thunder: "wind",
7452
+ thunderstorm: "wind",
7453
+ door: "door",
7454
+ door_slam: "door",
7455
+ sliding_door: "door",
7456
+ footsteps: "footsteps",
7457
+ walking: "footsteps",
7458
+ running: "footsteps",
7459
+ crowd: "crowd",
7460
+ chatter: "crowd",
7461
+ cheering: "crowd",
7462
+ applause: "crowd",
7463
+ telephone_ring: "telephone",
7464
+ ringtone: "telephone",
7465
+ engine: "engine",
7466
+ engine_starting: "engine",
7467
+ lawn_mower: "engine",
7468
+ chainsaw: "engine",
7469
+ hammer: "tools",
7470
+ jackhammer: "tools",
7471
+ drill: "tools",
7472
+ power_tool: "tools",
7473
+ silence: "silence"
7474
+ },
7475
+ preserveOriginal: false
7476
+ };
7477
+ var _macroLookup = /* @__PURE__ */ new Map();
7478
+ for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7479
+ for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7322
7480
  /**
7323
7481
  * Accessory device helpers — shared across drivers.
7324
7482
  *
@@ -7811,78 +7969,6 @@ var airQualitySensorCapability = {
7811
7969
  runtimeState: AirQualitySensorStatusSchema
7812
7970
  };
7813
7971
  /**
7814
- * Generic types for capability definitions.
7815
- *
7816
- * A capability is defined with Zod schemas for methods, events, and settings.
7817
- * TypeScript types are inferred via z.infer<> — zero duplication.
7818
- *
7819
- * Pattern:
7820
- * 1. Define Zod schemas for data, methods, settings
7821
- * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
7822
- * 3. Export type IProvider = InferProvider<typeof capabilityDef>
7823
- * 4. Addon implements IProvider
7824
- * 5. Registry auto-mounts tRPC router from definition.methods
7825
- */
7826
- /**
7827
- * Output schema shared by the contribution + live methods.
7828
- *
7829
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
7830
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
7831
- * concrete-but-lenient Zod object keeps tRPC output inference happy
7832
- * (using `z.unknown()` here collapses unrelated router branches to
7833
- * `unknown` when the generator re-inlines the huge AppRouter type).
7834
- *
7835
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
7836
- * extensions the caller adds (showWhen, displayScale, …) without
7837
- * rebuilding every time a new field kind is introduced.
7838
- */
7839
- var ContributionSectionSchema = object({
7840
- id: string(),
7841
- title: string(),
7842
- description: string().optional(),
7843
- style: _enum(["card", "accordion"]).optional(),
7844
- defaultCollapsed: boolean().optional(),
7845
- columns: union([
7846
- literal(1),
7847
- literal(2),
7848
- literal(3),
7849
- literal(4)
7850
- ]).optional(),
7851
- tab: string().optional(),
7852
- location: _enum(["settings", "top-tab"]).optional(),
7853
- order: number().optional(),
7854
- fields: array(any())
7855
- });
7856
- object({
7857
- tabs: array(object({
7858
- id: string(),
7859
- label: string(),
7860
- icon: string(),
7861
- order: number().optional()
7862
- })).optional(),
7863
- sections: array(ContributionSectionSchema)
7864
- }).nullable();
7865
- object({ deviceId: number() }), object({ deviceId: number() }), object({
7866
- deviceId: number(),
7867
- patch: record(string(), unknown())
7868
- }), object({ success: literal(true) });
7869
- object({ deviceId: number() }), unknown().nullable();
7870
- /** Shorthand to define a method schema */
7871
- function method(input, output, options) {
7872
- return {
7873
- input,
7874
- output,
7875
- kind: options?.kind ?? "query",
7876
- auth: options?.auth ?? "protected",
7877
- ...options?.access !== void 0 ? { access: options.access } : {},
7878
- timeoutMs: options?.timeoutMs
7879
- };
7880
- }
7881
- /** Shorthand to define an event schema */
7882
- function event(data) {
7883
- return { data };
7884
- }
7885
- /**
7886
7972
  * Alarm-panel cap. Models HA `alarm_control_panel.*` on
7887
7973
  * `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
7888
7974
  * across disarmed / armed_(home|away|night|vacation|custom_bypass) /
@@ -14366,9 +14452,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14366
14452
  limit: number().optional(),
14367
14453
  tags: record(string(), string()).optional()
14368
14454
  }), array(LogEntrySchema).readonly());
14369
- var StaticDirOutputSchema = object({ staticDir: string() });
14370
- var VersionOutputSchema = object({ version: string() });
14371
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
14372
14455
  /**
14373
14456
  * Zod schemas for persisted record types.
14374
14457
  *
@@ -16669,7 +16752,7 @@ method(object({
16669
16752
  }), _void(), {
16670
16753
  kind: "mutation",
16671
16754
  auth: "admin"
16672
- }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
16755
+ }), method(object({ addonId: string() }), array(SavedDeviceRowSchema)), method(object({ addonId: string().optional() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), DeviceInfoSchema.nullable()), method(object({ parentDeviceId: number() }), array(DeviceInfoSchema)), method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema)), method(object({ deviceId: number() }), ConfigUISchemaOutput), method(object({
16673
16756
  deviceId: number(),
16674
16757
  values: record(string(), unknown())
16675
16758
  }), object({ success: literal(true) }), {
@@ -17394,7 +17477,20 @@ var DiskSpaceInfoSchema = object({
17394
17477
  var PidResourceStatsSchema = object({
17395
17478
  pid: number(),
17396
17479
  cpu: number(),
17397
- memory: number()
17480
+ memory: number(),
17481
+ /**
17482
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
17483
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
17484
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
17485
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
17486
+ * Undefined where /proc is unavailable (e.g. macOS).
17487
+ */
17488
+ privateBytes: number().optional(),
17489
+ /**
17490
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
17491
+ * code shared copy-on-write across runners. Undefined on macOS.
17492
+ */
17493
+ sharedBytes: number().optional()
17398
17494
  });
17399
17495
  var AddonInstanceSchema = object({
17400
17496
  addonId: string(),
@@ -17443,6 +17539,17 @@ var KillProcessResultSchema = object({
17443
17539
  reason: string().optional(),
17444
17540
  signal: _enum(["SIGTERM", "SIGKILL"]).optional()
17445
17541
  });
17542
+ var DumpHeapSnapshotInputSchema = object({
17543
+ /** The addon whose runner should dump a heap snapshot. */
17544
+ addonId: string() });
17545
+ var DumpHeapSnapshotResultSchema = object({
17546
+ success: boolean(),
17547
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
17548
+ path: string().optional(),
17549
+ /** Process pid that was signalled. */
17550
+ pid: number().optional(),
17551
+ reason: string().optional()
17552
+ });
17446
17553
  var SystemMetricsSchema = object({
17447
17554
  cpuPercent: number(),
17448
17555
  memoryPercent: number(),
@@ -17456,6 +17563,9 @@ var SystemMetricsSchema = object({
17456
17563
  method(_void(), SystemResourceSnapshotSchema), method(_void(), SystemResourceSnapshotSchema.nullable()), method(_void(), SystemMetricsSchema), method(object({ dirPath: string() }), DiskSpaceInfoSchema), method(_void(), MetricsGpuInfoSchema.nullable()), method(_void(), number().nullable()), method(object({ pids: array(number()) }), array(PidResourceStatsSchema)), method(_void(), array(AddonInstanceSchema).readonly()), method(object({ addonId: string() }), PidResourceStatsSchema.nullable()), method(_void(), array(NodeProcessSchema).readonly()), method(KillProcessInputSchema, KillProcessResultSchema, {
17457
17564
  kind: "mutation",
17458
17565
  auth: "admin"
17566
+ }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
17567
+ kind: "mutation",
17568
+ auth: "admin"
17459
17569
  });
17460
17570
  var PtzPresetSchema = object({
17461
17571
  id: string(),
@@ -17864,63 +17974,6 @@ method(object({
17864
17974
  auth: "admin"
17865
17975
  });
17866
17976
  /**
17867
- * device-ops — device-scoped cap that unifies the per-IDevice operations
17868
- * previously routed through the `.device-ops` Moleculer bridge service.
17869
- *
17870
- * Each worker that hosts live `IDevice` instances auto-registers a native
17871
- * provider for this cap (per device) backed by its local
17872
- * `DeviceRegistry`. Hub-side callers reach it transparently through
17873
- * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
17874
- * `deviceId` + `nodeId` and dispatches through the standard cap-router,
17875
- * so there's no parallel bridge path anymore.
17876
- *
17877
- * The surface is intentionally small — every method corresponds to a
17878
- * single action on the live `IDevice` (or `ICameraDevice` for
17879
- * `getStreamSources`). Richer orchestration (enable/disable with
17880
- * integration plumbing, bulk updates) stays in the `device-manager` cap;
17881
- * `device-ops` is the per-device primitive the device-manager routes to.
17882
- */
17883
- var StreamSourceEntrySchema$1 = object({
17884
- id: string(),
17885
- label: string(),
17886
- protocol: _enum([
17887
- "rtsp",
17888
- "rtmp",
17889
- "annexb",
17890
- "http-mjpeg",
17891
- "webrtc",
17892
- "custom"
17893
- ]),
17894
- url: string().optional(),
17895
- resolution: object({
17896
- width: number(),
17897
- height: number()
17898
- }).optional(),
17899
- fps: number().optional(),
17900
- bitrate: number().optional(),
17901
- codec: string().optional(),
17902
- profileHint: CamProfileSchema.optional(),
17903
- sdp: string().optional()
17904
- });
17905
- var ConfigEntrySchema$1 = object({
17906
- key: string(),
17907
- value: unknown()
17908
- });
17909
- var RawStateResultSchema = object({
17910
- /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
17911
- source: string(),
17912
- /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
17913
- data: record(string(), unknown())
17914
- });
17915
- method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
17916
- deviceId: number(),
17917
- values: record(string(), unknown())
17918
- }), _void(), { kind: "mutation" }), method(object({
17919
- deviceId: number(),
17920
- action: string().min(1),
17921
- input: unknown()
17922
- }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
17923
- /**
17924
17977
  * camera-credentials — device-scoped cap exposing the camera's network
17925
17978
  * + auth surface in a vendor-neutral shape.
17926
17979
  *
@@ -21890,6 +21943,12 @@ Object.freeze({
21890
21943
  addonId: null,
21891
21944
  access: "view"
21892
21945
  },
21946
+ "metricsProvider.dumpHeapSnapshot": {
21947
+ capName: "metrics-provider",
21948
+ capScope: "system",
21949
+ addonId: null,
21950
+ access: "create"
21951
+ },
21893
21952
  "metricsProvider.getAddonStats": {
21894
21953
  capName: "metrics-provider",
21895
21954
  capScope: "system",
@@ -24157,30 +24216,6 @@ object({
24157
24216
  bootAttempts: number(),
24158
24217
  schemaVersion: literal(1)
24159
24218
  });
24160
- /**
24161
- * Promise-based timer helpers — used everywhere the codebase needs to
24162
- * wait, back off, or schedule a retry. Before these helpers landed, each
24163
- * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
24164
- * with subtle variations (some swallowing cancellation, some not). Two
24165
- * shapes cover every observed use case:
24166
- *
24167
- * - {@link sleep} for a plain, uncancellable wait — the default choice.
24168
- * - {@link sleepCancellable} for a wait that wakes early when an
24169
- * abort signal trips, used by long-running pollers whose teardown
24170
- * must stop a pending backoff promptly.
24171
- */
24172
- /**
24173
- * Resolve after `ms` milliseconds. Never rejects, never cancels. The
24174
- * sleep cannot be interrupted; for a wakeable variant use
24175
- * {@link sleepCancellable}.
24176
- *
24177
- * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
24178
- * still gives the event loop a chance to drain — useful for breaking
24179
- * up tight async loops without changing call-site semantics.
24180
- */
24181
- function sleep$1(ms) {
24182
- return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
24183
- }
24184
24219
  //#endregion
24185
24220
  //#region ../../node_modules/undici/lib/core/symbols.js
24186
24221
  var require_symbols = /* @__PURE__ */ require_chunk.__commonJSMin(((exports, module) => {