@camstack/addon-provider-reolink 1.0.4 → 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 +1491 -1266
  2. package/dist/addon.mjs +1491 -1266
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -4650,63 +4650,7 @@ function _instanceof(cls, params = {}) {
4650
4650
  return inst;
4651
4651
  }
4652
4652
  //#endregion
4653
- //#region ../types/dist/index.mjs
4654
- /**
4655
- * Deep wiring healthcheck — snapshot of active reachability probes across
4656
- * every declared capability + widget of every installed plugin, on every
4657
- * node. Produced by the backend `WiringHealthService` and surfaced via
4658
- * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
4659
- *
4660
- * Unlike `/health` (process liveness), this reflects whether each cap/widget
4661
- * is actually *reachable* over the real cap-dispatch path. See spec
4662
- * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
4663
- */
4664
- /** What kind of target a probe addressed. */
4665
- var wiringProbeKindSchema = _enum([
4666
- "singleton",
4667
- "device",
4668
- "widget"
4669
- ]);
4670
- /** Result of probing a single (cap|widget [, device]) target. */
4671
- var wiringProbeResultSchema = object({
4672
- capName: string(),
4673
- kind: wiringProbeKindSchema,
4674
- deviceId: number().optional(),
4675
- reachable: boolean(),
4676
- latencyMs: number(),
4677
- error: string().optional()
4678
- });
4679
- /** Per-addon roll-up of cap + widget probe results. */
4680
- var wiringAddonHealthSchema = object({
4681
- addonId: string(),
4682
- caps: array(wiringProbeResultSchema).readonly(),
4683
- widgets: array(wiringProbeResultSchema).readonly()
4684
- });
4685
- /** Per-node roll-up. */
4686
- var wiringNodeHealthSchema = object({
4687
- nodeId: string(),
4688
- addons: array(wiringAddonHealthSchema).readonly()
4689
- });
4690
- object({
4691
- /** True only when every probed target is reachable. */
4692
- ok: boolean(),
4693
- /** True when at least one target is unreachable. */
4694
- degraded: boolean(),
4695
- checkedAt: string(),
4696
- nodes: array(wiringNodeHealthSchema).readonly(),
4697
- summary: object({
4698
- total: number(),
4699
- reachable: number(),
4700
- unreachable: number()
4701
- })
4702
- });
4703
- var MODEL_FORMATS = [
4704
- "onnx",
4705
- "coreml",
4706
- "openvino",
4707
- "tflite",
4708
- "pt"
4709
- ];
4653
+ //#region ../types/dist/sleep-D7JeS58T.mjs
4710
4654
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4711
4655
  EventCategory["SystemBoot"] = "system.boot";
4712
4656
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -5004,6 +4948,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
5004
4948
  */
5005
4949
  EventCategory["PipelineEngineMetricsSnapshot"] = "pipeline.engine-metrics-snapshot";
5006
4950
  /**
4951
+ * Per-node detection-engine runtime-provisioning transition. Emitted by
4952
+ * the detection-pipeline provider on every state change of its lazy
4953
+ * engine-provisioning machine (idle → installing → verifying → ready,
4954
+ * or → failed with a `nextRetryAt`). Payload is the
4955
+ * `EngineProvisioningState` snapshot; `event.source.nodeId` carries the
4956
+ * node. The Pipeline page subscribes to drive a live "installing
4957
+ * OpenVINO… / ready" indicator per node without polling
4958
+ * `pipelineExecutor.getEngineProvisioning`. Telemetry-grade (D8): the UI
4959
+ * also reads the cap snapshot on mount / reconnect. Phase 2.
4960
+ */
4961
+ EventCategory["PipelineEngineProvisioning"] = "pipeline.engine-provisioning";
4962
+ /**
5007
4963
  * Cluster topology snapshot. Carries the same payload returned by
5008
4964
  * `nodes.topology` (every reachable node + addons + processes).
5009
4965
  * Emitted by the hub on any agent / addon lifecycle change
@@ -5931,181 +5887,6 @@ function normalizeAddonInitResult(result) {
5931
5887
  if (Array.isArray(result)) return { providers: result };
5932
5888
  return result;
5933
5889
  }
5934
- var EU_DST = {
5935
- offsetHours: 1,
5936
- startMonth: 3,
5937
- startWeekIndex: 5,
5938
- startWeekday: "Sunday",
5939
- startHour: 2,
5940
- endMonth: 10,
5941
- endWeekIndex: 5,
5942
- endWeekday: "Sunday",
5943
- endHour: 3
5944
- };
5945
- var US_DST = {
5946
- offsetHours: 1,
5947
- startMonth: 3,
5948
- startWeekIndex: 2,
5949
- startWeekday: "Sunday",
5950
- startHour: 2,
5951
- endMonth: 11,
5952
- endWeekIndex: 1,
5953
- endWeekday: "Sunday",
5954
- endHour: 2
5955
- };
5956
- /**
5957
- * Curated catalogue of common world zones, grouped by region. Not
5958
- * exhaustive — covers the everyday zones an operator is likely to pick.
5959
- */
5960
- var TIMEZONES = [
5961
- {
5962
- id: "UTC",
5963
- label: "UTC (UTC+0)",
5964
- region: "Universal",
5965
- stdOffsetMinutes: 0,
5966
- dst: null
5967
- },
5968
- {
5969
- id: "Europe/London",
5970
- label: "Europe/London (UTC+0 / BST)",
5971
- region: "Europe",
5972
- stdOffsetMinutes: 0,
5973
- dst: EU_DST
5974
- },
5975
- {
5976
- id: "Europe/Rome",
5977
- label: "Europe/Rome (UTC+1 / CEST)",
5978
- region: "Europe",
5979
- stdOffsetMinutes: 60,
5980
- dst: EU_DST
5981
- },
5982
- {
5983
- id: "Europe/Paris",
5984
- label: "Europe/Paris (UTC+1 / CEST)",
5985
- region: "Europe",
5986
- stdOffsetMinutes: 60,
5987
- dst: EU_DST
5988
- },
5989
- {
5990
- id: "Europe/Berlin",
5991
- label: "Europe/Berlin (UTC+1 / CEST)",
5992
- region: "Europe",
5993
- stdOffsetMinutes: 60,
5994
- dst: EU_DST
5995
- },
5996
- {
5997
- id: "Europe/Madrid",
5998
- label: "Europe/Madrid (UTC+1 / CEST)",
5999
- region: "Europe",
6000
- stdOffsetMinutes: 60,
6001
- dst: EU_DST
6002
- },
6003
- {
6004
- id: "Europe/Amsterdam",
6005
- label: "Europe/Amsterdam (UTC+1 / CEST)",
6006
- region: "Europe",
6007
- stdOffsetMinutes: 60,
6008
- dst: EU_DST
6009
- },
6010
- {
6011
- id: "Europe/Istanbul",
6012
- label: "Europe/Istanbul (UTC+3)",
6013
- region: "Europe",
6014
- stdOffsetMinutes: 180,
6015
- dst: null
6016
- },
6017
- {
6018
- id: "America/New_York",
6019
- label: "America/New York (UTC−5 / EDT)",
6020
- region: "Americas",
6021
- stdOffsetMinutes: -300,
6022
- dst: US_DST
6023
- },
6024
- {
6025
- id: "America/Chicago",
6026
- label: "America/Chicago (UTC−6 / CDT)",
6027
- region: "Americas",
6028
- stdOffsetMinutes: -360,
6029
- dst: US_DST
6030
- },
6031
- {
6032
- id: "America/Denver",
6033
- label: "America/Denver (UTC−7 / MDT)",
6034
- region: "Americas",
6035
- stdOffsetMinutes: -420,
6036
- dst: US_DST
6037
- },
6038
- {
6039
- id: "America/Los_Angeles",
6040
- label: "America/Los Angeles (UTC−8 / PDT)",
6041
- region: "Americas",
6042
- stdOffsetMinutes: -480,
6043
- dst: US_DST
6044
- },
6045
- {
6046
- id: "America/Sao_Paulo",
6047
- label: "America/Sao Paulo (UTC−3)",
6048
- region: "Americas",
6049
- stdOffsetMinutes: -180,
6050
- dst: null
6051
- },
6052
- {
6053
- id: "Asia/Dubai",
6054
- label: "Asia/Dubai (UTC+4)",
6055
- region: "Asia",
6056
- stdOffsetMinutes: 240,
6057
- dst: null
6058
- },
6059
- {
6060
- id: "Asia/Kolkata",
6061
- label: "Asia/Kolkata (UTC+5:30)",
6062
- region: "Asia",
6063
- stdOffsetMinutes: 330,
6064
- dst: null
6065
- },
6066
- {
6067
- id: "Asia/Singapore",
6068
- label: "Asia/Singapore (UTC+8)",
6069
- region: "Asia",
6070
- stdOffsetMinutes: 480,
6071
- dst: null
6072
- },
6073
- {
6074
- id: "Asia/Shanghai",
6075
- label: "Asia/Shanghai (UTC+8)",
6076
- region: "Asia",
6077
- stdOffsetMinutes: 480,
6078
- dst: null
6079
- },
6080
- {
6081
- id: "Asia/Tokyo",
6082
- label: "Asia/Tokyo (UTC+9)",
6083
- region: "Asia",
6084
- stdOffsetMinutes: 540,
6085
- dst: null
6086
- },
6087
- {
6088
- id: "Australia/Sydney",
6089
- label: "Australia/Sydney (UTC+10 / AEDT)",
6090
- region: "Oceania",
6091
- stdOffsetMinutes: 600,
6092
- dst: {
6093
- offsetHours: 1,
6094
- startMonth: 10,
6095
- startWeekIndex: 1,
6096
- startWeekday: "Sunday",
6097
- startHour: 2,
6098
- endMonth: 4,
6099
- endWeekIndex: 1,
6100
- endWeekday: "Sunday",
6101
- endHour: 3
6102
- }
6103
- }
6104
- ];
6105
- /** Resolve an IANA id to its `Timezone`, or `undefined` if unknown. */
6106
- function findTimezone(id) {
6107
- return TIMEZONES.find((tz) => tz.id === id);
6108
- }
6109
5890
  /** Shared Zod schemas used across streaming capabilities. */
6110
5891
  var CamProfileSchema = _enum([
6111
5892
  "high",
@@ -6192,7 +5973,7 @@ var ProfileSlotSchema = object({
6192
5973
  * Zod schema for StreamSourceEntry — the canonical stream descriptor
6193
5974
  * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
6194
5975
  */
6195
- var StreamSourceEntrySchema = object({
5976
+ var StreamSourceEntrySchema$1 = object({
6196
5977
  id: string(),
6197
5978
  label: string(),
6198
5979
  protocol: _enum([
@@ -6414,894 +6195,1283 @@ var ProfileRtspEntrySchema = object({
6414
6195
  codec: string().optional(),
6415
6196
  resolution: CamStreamResolutionSchema.optional()
6416
6197
  });
6417
- /**
6418
- * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6419
- * Named `RecordingWeekday` to avoid collision with the string-union
6420
- * `Weekday` exported from `interfaces/timezones.ts`.
6421
- */
6422
- var RecordingWeekdaySchema = number().int().min(0).max(6);
6423
- var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6424
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6425
- kind: literal("timeOfDay"),
6426
- start: string().regex(HHMM),
6427
- end: string().regex(HHMM),
6428
- /** Restrict to these weekdays; omit = every day. */
6429
- days: array(RecordingWeekdaySchema).optional()
6430
- })]);
6431
- var RecordingModeSchema = _enum([
6432
- "continuous",
6433
- "onMotion",
6434
- "onAudioThreshold"
6435
- ]);
6436
- /**
6437
- * First-class, authoritative per-camera storage mode the netta choice the UI
6438
- * reads directly (never inferred from `rules`):
6439
- * - `off` not recording.
6440
- * - `events` — record only around triggers (motion / audio threshold),
6441
- * with pre/post-buffer.
6442
- * - `continuous` record 24/7 within the schedule.
6443
- *
6444
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6445
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6446
- */
6447
- var RecordingStorageModeSchema = _enum([
6448
- "off",
6449
- "events",
6450
- "continuous"
6451
- ]);
6452
- /** Which detectors trigger an `events`-mode recording. */
6453
- var RecordingTriggersSchema = object({
6454
- motion: boolean().optional(),
6455
- audioThresholdDbfs: number().optional()
6456
- });
6457
- /**
6458
- * Mode of a single recording band the recorder per-band vocabulary.
6459
- *
6460
- * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6461
- * only ever `continuous` or `events`; "off" is expressed by the absence of a
6462
- * covering band, not by a band value.
6463
- */
6464
- var RecordingBandModeSchema = _enum(["continuous", "events"]);
6465
- /**
6466
- * Triggers for an `events`-mode band. Identical shape to
6467
- * `RecordingTriggersSchema`reuse that schema as the band trigger type so the
6468
- * two never drift.
6469
- */
6470
- var RecordingBandTriggersSchema = RecordingTriggersSchema;
6471
- /**
6472
- * A single mode-per-band window the canonical recorder band shape, the
6473
- * single source of truth re-used by `addon-pipeline/recorder`.
6474
- *
6475
- * `days` lists the weekdays the band covers (empty = every day, matching the
6476
- * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6477
- * span wraps past midnight (handled by the band engine).
6478
- */
6479
- var RecordingBandSchema = object({
6480
- days: array(RecordingWeekdaySchema),
6481
- start: string().regex(HHMM),
6482
- end: string().regex(HHMM),
6483
- mode: RecordingBandModeSchema,
6484
- triggers: RecordingBandTriggersSchema.optional(),
6485
- preBufferSec: number().min(0).optional(),
6486
- postBufferSec: number().min(0).optional()
6487
- });
6488
- var RecordingRuleSchema = object({
6489
- schedule: RecordingScheduleSchema,
6490
- mode: RecordingModeSchema,
6491
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6492
- preBufferSec: number().min(0).default(0),
6493
- /** Keep recording until this many seconds after the last trigger. */
6494
- postBufferSec: number().min(0).default(0),
6495
- /** Each new trigger restarts the post-buffer window. */
6496
- resetTimeoutOnNewEvent: boolean().default(true),
6497
- /** onAudioThreshold only dBFS level that counts as a trigger. */
6498
- thresholdDbfs: number().optional()
6499
- });
6500
- /**
6501
- * Per-device retention overrides. Every field is optional; an unset or `0`
6502
- * value inherits the node-wide recorder default. Only footage-lifetime limits
6503
- * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6504
- * (when the volume is too full to keep recording) is NOT a per-camera concern —
6505
- * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6506
- * shared by every camera writing to that volume.
6507
- */
6508
- var RecordingRetentionSchema = object({
6509
- maxAgeDays: number().min(0).optional(),
6510
- maxSizeGb: number().min(0).optional()
6511
- });
6512
- /**
6513
- * The full per-camera recording intent — the wire shape of a RecordingTarget.
6514
- *
6515
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6516
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6517
- * only for transition + migration (`migrateRulesToMode`); the policy engine
6518
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6519
- */
6520
- var RecordingConfigSchema = object({
6521
- enabled: boolean(),
6522
- /** Authoritative storage mode. Absent on legacy targets → derived once via
6523
- * `migrateRulesToMode`, then persisted. */
6524
- mode: RecordingStorageModeSchema.optional(),
6525
- profiles: array(CamProfileSchema).optional(),
6526
- segmentSeconds: number().int().positive().optional(),
6527
- /** Shared recording time-bands for `events` & `continuous` — record only when
6528
- * the wall-clock falls inside one of these windows. Omit or empty = always.
6529
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
6530
- schedules: array(RecordingScheduleSchema).optional(),
6531
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6532
- * normalized into `schedules` on read and never written going forward. (Not
6533
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6534
- schedule: RecordingScheduleSchema.optional(),
6535
- /** `events`-mode only — which detectors trigger a recording. */
6536
- triggers: RecordingTriggersSchema.optional(),
6537
- /** `events`-mode only — seconds retained before / after a trigger. */
6538
- preBufferSec: number().min(0).optional(),
6539
- postBufferSec: number().min(0).optional(),
6540
- /** DEPRECATED authoring input; retained for migration/transition. */
6541
- rules: array(RecordingRuleSchema).optional(),
6198
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6199
+ DeviceType["Camera"] = "camera";
6200
+ DeviceType["Hub"] = "hub";
6201
+ DeviceType["Light"] = "light";
6202
+ DeviceType["Siren"] = "siren";
6203
+ DeviceType["Switch"] = "switch";
6204
+ DeviceType["Sensor"] = "sensor";
6205
+ DeviceType["Thermostat"] = "thermostat";
6206
+ DeviceType["Button"] = "button";
6207
+ /** Generic stateless event emitter — carries a device's EXACT declared
6208
+ * event vocabulary verbatim (no normalization). Installed with the
6209
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6210
+ * HA bus events (e.g. `zha_event`, generic). */
6211
+ DeviceType["EventEmitter"] = "event-emitter";
6212
+ /** Firmware/software update entity — current vs available version,
6213
+ * updatable flag, update state, and an install action. Installed with
6214
+ * the `update` cap. Sources: Homematic firmware-update channels (and
6215
+ * reusable by other providers, e.g. HA `update.*` entities). */
6216
+ DeviceType["Update"] = "update";
6217
+ DeviceType["Generic"] = "generic";
6218
+ /** Generic notification delivery target (HA `notify.<service>`, future
6219
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6220
+ * endpoint; the `notifier` cap defines the send surface. */
6221
+ DeviceType["Notifier"] = "notifier";
6222
+ /** Pre-recorded action sequence with optional parameters
6223
+ * (HA `script.*`). Runnable via `script-runner` cap. */
6224
+ DeviceType["Script"] = "script";
6225
+ /** Automation rule (HA `automation.*`) enable/disable + manual
6226
+ * trigger surface exposed via `automation-control` cap. */
6227
+ DeviceType["Automation"] = "automation";
6228
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6229
+ DeviceType["Lock"] = "lock";
6230
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6231
+ * `valve.*`). `cover` cap with sub-roles for variant. */
6232
+ DeviceType["Cover"] = "cover";
6233
+ /** Pipe / water / gas valve with open/close/stop and optional
6234
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6235
+ * modelled on the same open/closed lifecycle. */
6236
+ DeviceType["Valve"] = "valve";
6237
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
6238
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6239
+ * modelled on the same target / mode lifecycle. */
6240
+ DeviceType["Humidifier"] = "humidifier";
6241
+ /** Water heater / boiler with target temperature + operation mode +
6242
+ * away mode (HA `water_heater.*`). `water-heater` cap a
6243
+ * climate-family actuator. */
6244
+ DeviceType["WaterHeater"] = "water-heater";
6245
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6246
+ DeviceType["Fan"] = "fan";
6247
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6248
+ * the camera surface those use `Camera`. `media-player` cap. */
6249
+ DeviceType["MediaPlayer"] = "media-player";
6250
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
6251
+ * `alarm-panel` cap. */
6252
+ DeviceType["AlarmPanel"] = "alarm-panel";
6253
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
6254
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
6255
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6256
+ * TextControl / DateTimeControl. */
6257
+ DeviceType["Control"] = "control";
6258
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6259
+ * `presence` cap. */
6260
+ DeviceType["Presence"] = "presence";
6261
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6262
+ * `weather` cap. */
6263
+ DeviceType["Weather"] = "weather";
6264
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6265
+ DeviceType["Vacuum"] = "vacuum";
6266
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6267
+ * `lawn-mower-control` cap. */
6268
+ DeviceType["LawnMower"] = "lawn-mower";
6269
+ /** Physical HA device group — parent container for entity-children
6270
+ * adopted from a single HA device entry. Not renderable as a
6271
+ * standalone device; exists only to anchor child entities. */
6272
+ DeviceType["Container"] = "container";
6273
+ /** Single still-image entity (HA `image.*`). Read-only display of an
6274
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
6275
+ DeviceType["Image"] = "image";
6276
+ return DeviceType;
6277
+ }({});
6278
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6279
+ DeviceFeature["BatteryOperated"] = "battery-operated";
6280
+ DeviceFeature["Rebootable"] = "rebootable";
6542
6281
  /**
6543
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6544
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6545
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6546
- * derived into bands once via `migrateConfigToBands`.
6282
+ * Device supports an on-demand re-sync of its derived spec with its
6283
+ * upstream source drives the generic Re-sync button. The owning
6284
+ * provider implements the action via the `device-adoption.resync` cap.
6547
6285
  */
6548
- bands: array(RecordingBandSchema).optional(),
6549
- retention: RecordingRetentionSchema.optional()
6550
- });
6551
- /**
6552
- * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6553
- * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6554
- * so the persisted record schema and the consumer-facing cap can both consume it
6555
- * without forming a circular import. The `storage` cap re-exports it
6556
- * verbatim for back-compat.
6557
- *
6558
- * This Zod schema is the **authoritative source** for `StorageLocationType`.
6559
- * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6560
- * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6561
- * `IStorageProvider` interface stay in lockstep.
6562
- *
6563
- * The type is now an **open string** (not a closed enum) — addons declare
6564
- * their own location kinds via `StorageLocationDeclaration.id`. The regex
6565
- * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6566
- */
6567
- var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6568
- /**
6569
- * Persisted record for a storage location instance. Operators can register
6570
- * multiple instances for multi-cardinality types (e.g. two `backups`
6571
- * locations with different `providerId`s). Cardinality is now declared per
6572
- * location via `StorageLocationDeclaration.cardinality` — the static
6573
- * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6574
- *
6575
- * `id` is a stable namespaced string of the form `<type>:<slug>`.
6576
- * The default location for a type uses `id === <type>:default` by
6577
- * convention (the bare type ref like `'backups'` resolves to it).
6578
- *
6579
- * `isSystem: true` marks a location as orchestrator-seeded and
6580
- * undeletable. The bootstrap-installed defaults (one per type) carry
6581
- * this flag; operator-added locations don't. Editing the config of
6582
- * a system location is allowed (path migration, provider swap) but
6583
- * deleting it is rejected at the cap level.
6584
- */
6585
- var StorageLocationSchema = object({
6586
- id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6587
- type: string(),
6588
- displayName: string().min(1),
6589
- providerId: string().min(1),
6590
- config: record(string(), unknown()),
6286
+ DeviceFeature["Resyncable"] = "resyncable";
6287
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
6288
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
6289
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
6290
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6591
6291
  /**
6592
- * Cluster node this location physically lives on. REQUIRED for node-local
6593
- * providers (filesystem the path exists on one node's disk), null/absent
6594
- * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6595
- * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6596
- * flag at upsert time, not here (the schema is provider-agnostic).
6292
+ * Camera supports the on-firmware autotrack subsystem (subject-
6293
+ * following). Distinct from `PanTiltZoom` because not every PTZ
6294
+ * camera ships autotrack the admin UI uses this flag to gate
6295
+ * the autotrack toggle / settings card without re-deriving from
6296
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
6297
+ * driver sets this feature when probe confirms the firmware
6298
+ * surface, and registers the cap in the same code path.
6597
6299
  */
6598
- nodeId: string().optional(),
6599
- isDefault: boolean().default(false),
6600
- isSystem: boolean().default(false),
6601
- createdAt: number(),
6602
- updatedAt: number()
6603
- });
6300
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6301
+ /**
6302
+ * Accessory exposes a "trigger on motion" toggle — the parent camera's
6303
+ * motion detection automatically activates this device. Mirrors
6304
+ * `motion-trigger` cap registration: drivers set this feature in the
6305
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6306
+ *
6307
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6308
+ * fast scalar without binding fetch), notifier rules, and `listAll`
6309
+ * filters that want "all devices with on-motion behaviour".
6310
+ */
6311
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
6312
+ /** Light supports rgb-triplet color via `color` cap. */
6313
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
6314
+ /** Light supports HSV color via `color` cap. */
6315
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
6316
+ /** Light supports color-temperature (mired) via `color` cap. */
6317
+ DeviceFeature["LightColorMired"] = "light-color-mired";
6318
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6319
+ * targetHigh). Gates the range slider UI. */
6320
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
6321
+ /** Thermostat exposes target humidity and/or current humidity
6322
+ * readings. Gates the humidity controls. */
6323
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
6324
+ /** Thermostat exposes a fan-mode selector. */
6325
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
6326
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
6327
+ DeviceFeature["ClimatePreset"] = "climate-preset";
6328
+ /** Cover exposes intermediate position control (0..100). Gates the
6329
+ * position slider UI. */
6330
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
6331
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
6332
+ DeviceFeature["CoverTilt"] = "cover-tilt";
6333
+ /** Valve exposes intermediate position control (0..100). Gates the
6334
+ * position slider / drag surface UI. */
6335
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
6336
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
6337
+ DeviceFeature["FanSpeed"] = "fan-speed";
6338
+ /** Fan exposes a preset mode selector. */
6339
+ DeviceFeature["FanPreset"] = "fan-preset";
6340
+ /** Fan exposes blade direction (forward/reverse) — typical of
6341
+ * ceiling fans. */
6342
+ DeviceFeature["FanDirection"] = "fan-direction";
6343
+ /** Fan exposes an oscillation toggle. */
6344
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
6345
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
6346
+ * field on the UI lock-controls panel. */
6347
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
6348
+ /** Lock supports a latch-release ("open door") action distinct from
6349
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
6350
+ * `supported_features`. Gates the Open Door button in the UI. */
6351
+ DeviceFeature["LockOpen"] = "lock-open";
6352
+ /** Media player exposes a seek-to-position surface. */
6353
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
6354
+ /** Media player exposes a volume-level setter. */
6355
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
6356
+ /** Media player exposes a mute toggle distinct from volume=0. */
6357
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
6358
+ /** Media player exposes a shuffle toggle. */
6359
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
6360
+ /** Media player exposes a repeat mode (off / all / one). */
6361
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
6362
+ /** Media player exposes a source / input selector. */
6363
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
6364
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
6365
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
6366
+ /** Media player exposes next-track. */
6367
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
6368
+ /** Media player exposes previous-track. */
6369
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
6370
+ /** Media player exposes stop distinct from pause. */
6371
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
6372
+ /** Alarm panel requires a PIN code on arm/disarm. */
6373
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
6374
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
6375
+ * addition to a textual location. */
6376
+ DeviceFeature["PresenceGps"] = "presence-gps";
6377
+ /** Notifier accepts an inline / URL image attachment. */
6378
+ DeviceFeature["NotifierImage"] = "notifier-image";
6379
+ /** Notifier accepts a priority hint (high/normal/low). */
6380
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
6381
+ /** Notifier accepts a free-form `data` payload for platform-specific
6382
+ * fields. */
6383
+ DeviceFeature["NotifierData"] = "notifier-data";
6384
+ /** Notifier supports interactive action buttons / callbacks. */
6385
+ DeviceFeature["NotifierActions"] = "notifier-actions";
6386
+ /** Notifier supports per-call recipient targeting (multi-user). */
6387
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
6388
+ /** Script runner accepts a variables map on each run invocation. */
6389
+ DeviceFeature["ScriptVariables"] = "script-variables";
6390
+ /** Automation `trigger` accepts a skipCondition flag — fires the
6391
+ * automation's actions while bypassing its condition block. */
6392
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
6393
+ return DeviceFeature;
6394
+ }({});
6604
6395
  /**
6605
- * Reference accepted by consumer-facing `api.storage.*` calls.
6606
- * Either:
6607
- * - a `StorageLocationType` (e.g. `'backups'`) orchestrator resolves to the default of that type
6608
- * - a fully-qualified id (e.g. `'backups:nas-01'`) addresses a specific instance
6396
+ * Semantic role a device plays within its parent. Populated by driver
6397
+ * addons when creating accessory devices (Reolink siren/floodlight/
6398
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
6399
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
6400
+ * `role: Floodlight` renders as a bulb with a brightness slider,
6401
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
6609
6402
  *
6610
- * The orchestrator's `resolveRef(ref)` handles both cases.
6403
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
6404
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
6611
6405
  */
6612
- var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6406
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6407
+ DeviceRole["Siren"] = "siren";
6408
+ DeviceRole["Floodlight"] = "floodlight";
6409
+ DeviceRole["Spotlight"] = "spotlight";
6410
+ DeviceRole["PirSensor"] = "pir-sensor";
6411
+ DeviceRole["Chime"] = "chime";
6412
+ DeviceRole["Autotrack"] = "autotrack";
6413
+ DeviceRole["Nightvision"] = "nightvision";
6414
+ DeviceRole["PrivacyMask"] = "privacy-mask";
6415
+ DeviceRole["Doorbell"] = "doorbell";
6416
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
6417
+ * real Switch device for UI rendering / export adapters. */
6418
+ DeviceRole["BinaryHelper"] = "binary-helper";
6419
+ /** Generic motion / occupancy / moving event source. Distinct from
6420
+ * the camera accessory PirSensor role: that one is a camera child;
6421
+ * this is a standalone HA / 3rd-party motion sensor. */
6422
+ DeviceRole["MotionSensor"] = "motion-sensor";
6423
+ DeviceRole["ContactSensor"] = "contact-sensor";
6424
+ DeviceRole["LeakSensor"] = "leak-sensor";
6425
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
6426
+ DeviceRole["COSensor"] = "co-sensor";
6427
+ DeviceRole["GasSensor"] = "gas-sensor";
6428
+ DeviceRole["TamperSensor"] = "tamper-sensor";
6429
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
6430
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
6431
+ DeviceRole["SoundSensor"] = "sound-sensor";
6432
+ /** Fallback for `binary_sensor` without a known `device_class`. */
6433
+ DeviceRole["BinarySensor"] = "binary-sensor";
6434
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
6435
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
6436
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6437
+ DeviceRole["PressureSensor"] = "pressure-sensor";
6438
+ DeviceRole["PowerSensor"] = "power-sensor";
6439
+ DeviceRole["EnergySensor"] = "energy-sensor";
6440
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
6441
+ DeviceRole["CurrentSensor"] = "current-sensor";
6442
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
6443
+ /** Battery level (numeric % via `sensor` OR low-bool via
6444
+ * `binary_sensor` — the cap distinguishes via the value type). */
6445
+ DeviceRole["BatterySensor"] = "battery-sensor";
6446
+ /** Fallback for `sensor` numeric without a known `device_class`. */
6447
+ DeviceRole["NumericSensor"] = "numeric-sensor";
6448
+ /** String / enum state (HA `sensor` with `state_class: enum` or
6449
+ * `attributes.options`). */
6450
+ DeviceRole["EnumSensor"] = "enum-sensor";
6451
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
6452
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
6453
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
6454
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
6455
+ /** Last-resort fallback when nothing else matches. */
6456
+ DeviceRole["GenericSensor"] = "generic-sensor";
6457
+ DeviceRole["NumericControl"] = "numeric-control";
6458
+ DeviceRole["SelectControl"] = "select-control";
6459
+ DeviceRole["TextControl"] = "text-control";
6460
+ DeviceRole["DateTimeControl"] = "datetime-control";
6461
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
6462
+ * rich features (image, priority, channel routing). */
6463
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
6464
+ /** Chat / messaging service (HA `notify.telegram_*`,
6465
+ * `notify.discord_*`, etc.). */
6466
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
6467
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
6468
+ DeviceRole["EmailNotifier"] = "email-notifier";
6469
+ /** Fallback when the notifier service name doesn't match a known
6470
+ * pattern. */
6471
+ DeviceRole["GenericNotifier"] = "generic-notifier";
6472
+ return DeviceRole;
6473
+ }({});
6613
6474
  /**
6614
- * `StorageLocationDeclaration` a single storage-location entry declared by
6615
- * an addon in its `package.json` under `camstack.storageLocations`.
6475
+ * Generic types for capability definitions.
6616
6476
  *
6617
- * Design intent:
6618
- * - **Addon declares its needs**each addon describes the logical storage
6619
- * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6620
- * about the physical path.
6621
- * - **Kernel aggregates** at boot the kernel collects declarations from all
6622
- * installed addons, deduplicates by `id`, and exposes the union via the
6623
- * storage-locations settings surface.
6624
- * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6625
- * at least one instance named `<id>:default` is present, using
6626
- * `defaultsTo` to inherit the resolved root from another location when the
6627
- * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6628
- * `recordings`).
6629
- * - **ids are global** — `id` values are shared across the entire deployment;
6630
- * two addons declaring the same `id` must agree on `cardinality` (validated
6631
- * at kernel aggregation time, not here).
6477
+ * A capability is defined with Zod schemas for methods, events, and settings.
6478
+ * TypeScript types are inferred via z.infer<> zero duplication.
6479
+ *
6480
+ * Pattern:
6481
+ * 1. Define Zod schemas for data, methods, settings
6482
+ * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
6483
+ * 3. Export type IProvider = InferProvider<typeof capabilityDef>
6484
+ * 4. Addon implements IProvider
6485
+ * 5. Registry auto-mounts tRPC router from definition.methods
6632
6486
  */
6633
- var StorageLocationDeclarationSchema = object({
6634
- /**
6635
- * Global location identifier, e.g. `recordings` or `recordingsLow`.
6636
- * Must start with a lowercase letter and may contain letters, digits, and
6637
- * hyphens.
6638
- */
6639
- id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6640
- /** Human-readable name shown in the admin UI. */
6641
- displayName: string().min(1, { message: "displayName must not be empty" }),
6642
- /** Optional longer explanation of what data this location stores. */
6487
+ /**
6488
+ * Output schema shared by the contribution + live methods.
6489
+ *
6490
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
6491
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
6492
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
6493
+ * (using `z.unknown()` here collapses unrelated router branches to
6494
+ * `unknown` when the generator re-inlines the huge AppRouter type).
6495
+ *
6496
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
6497
+ * extensions the caller adds (showWhen, displayScale, …) without
6498
+ * rebuilding every time a new field kind is introduced.
6499
+ */
6500
+ var ContributionSectionSchema = object({
6501
+ id: string(),
6502
+ title: string(),
6643
6503
  description: string().optional(),
6644
- /**
6645
- * `single` — exactly one instance of this location is allowed system-wide
6646
- * (e.g. `logs`, `models`). The operator can edit it but not add more.
6647
- * `multi` — the operator may register several instances (e.g. a second
6648
- * `recordings` on a NAS for disk tiering); one is the default at any time.
6649
- */
6650
- cardinality: _enum(["single", "multi"]),
6651
- /**
6652
- * When set, the default instance for this location inherits its resolved
6653
- * root from the named location's default instance. Useful for derivative
6654
- * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6655
- * configure the primary location.
6656
- */
6657
- defaultsTo: string().optional()
6658
- });
6659
- var DecoderStatsSchema = object({
6660
- inputFps: number(),
6661
- outputFps: number(),
6662
- avgDecodeTimeMs: number(),
6663
- droppedFrames: number()
6664
- });
6665
- var DecoderSessionConfigSchema = object({
6666
- codec: string(),
6667
- maxFps: number().default(0),
6668
- outputFormat: _enum([
6669
- "jpeg",
6670
- "rgb",
6671
- "bgr",
6672
- "yuv420",
6673
- "gray"
6674
- ]).default("jpeg"),
6675
- scale: number().default(1),
6676
- width: number().optional(),
6677
- height: number().optional(),
6678
- /**
6679
- * Identifier of the camera this decoder session serves. Optional
6680
- * because the cap is generic (any caller could request decode), but
6681
- * stream-broker passes it so decoder logs include `deviceId` for
6682
- * per-camera filtering when diagnosing failures (e.g. node-av
6683
- * sendPacket errors on a single hung camera).
6684
- */
6685
- deviceId: number().int().nonnegative().optional(),
6686
- /**
6687
- * Free-form tag for log scoping. Stream-broker uses
6688
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6689
- * on every line so `grep tag=broker:5/high` filters one camera
6690
- * profile cleanly.
6691
- */
6692
- tag: string().optional(),
6693
- /**
6694
- * Where the session delivers decoded frames (Phase 5 / D9):
6695
- *
6696
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
6697
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
6698
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
6699
- * into an OS shared-memory ring and drained as zero-pixel
6700
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
6701
- * other — `pullFrames` returns nothing for an `'shm'` session and
6702
- * `pullHandles` returns nothing for a `'callback'` session.
6703
- */
6704
- frameSink: _enum(["callback", "shm"]).default("callback")
6504
+ style: _enum(["card", "accordion"]).optional(),
6505
+ defaultCollapsed: boolean().optional(),
6506
+ columns: union([
6507
+ literal(1),
6508
+ literal(2),
6509
+ literal(3),
6510
+ literal(4)
6511
+ ]).optional(),
6512
+ tab: string().optional(),
6513
+ location: _enum(["settings", "top-tab"]).optional(),
6514
+ order: number().optional(),
6515
+ fields: array(any())
6705
6516
  });
6706
- var EncodeProfileSchema = object({
6707
- video: object({
6708
- codec: _enum([
6709
- "h264",
6710
- "h265",
6711
- "copy"
6712
- ]),
6713
- profile: _enum([
6714
- "baseline",
6715
- "main",
6716
- "high"
6717
- ]).optional(),
6718
- width: number().int().positive().optional(),
6719
- height: number().int().positive().optional(),
6720
- fps: number().positive().optional(),
6721
- bitrateKbps: number().int().positive().optional(),
6722
- gopFrames: number().int().positive().optional(),
6723
- bf: number().int().min(0).optional(),
6724
- preset: _enum([
6725
- "ultrafast",
6726
- "superfast",
6727
- "veryfast",
6728
- "faster",
6729
- "fast",
6730
- "medium"
6731
- ]).optional(),
6732
- tune: _enum([
6733
- "zerolatency",
6734
- "film",
6735
- "animation"
6736
- ]).optional()
6737
- }),
6738
- audio: union([literal("passthrough"), object({
6739
- codec: _enum([
6740
- "opus",
6741
- "aac",
6742
- "pcmu",
6743
- "pcma",
6744
- "copy"
6745
- ]),
6746
- bitrateKbps: number().int().positive().optional(),
6747
- sampleRateHz: number().int().positive().optional(),
6748
- channels: union([literal(1), literal(2)]).optional()
6749
- })]),
6750
- /**
6751
- * ffmpeg input-side args, inserted between the fixed global flags
6752
- * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6753
- * the widget surfaces a textarea + suggestion chips for the most-
6754
- * used demuxer/format options.
6755
- */
6756
- inputArgs: array(string()).optional(),
6757
- /**
6758
- * ffmpeg output-side args, inserted between the encode block and
6759
- * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6760
- * filters, codec-specific overrides. Free-text array.
6761
- */
6762
- outputArgs: array(string()).optional()
6517
+ object({
6518
+ tabs: array(object({
6519
+ id: string(),
6520
+ label: string(),
6521
+ icon: string(),
6522
+ order: number().optional()
6523
+ })).optional(),
6524
+ sections: array(ContributionSectionSchema)
6525
+ }).nullable();
6526
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
6527
+ deviceId: number(),
6528
+ patch: record(string(), unknown())
6529
+ }), object({ success: literal(true) });
6530
+ object({ deviceId: number() }), unknown().nullable();
6531
+ /** Shorthand to define a method schema */
6532
+ function method(input, output, options) {
6533
+ return {
6534
+ input,
6535
+ output,
6536
+ kind: options?.kind ?? "query",
6537
+ auth: options?.auth ?? "protected",
6538
+ ...options?.access !== void 0 ? { access: options.access } : {},
6539
+ timeoutMs: options?.timeoutMs
6540
+ };
6541
+ }
6542
+ /** Shorthand to define an event schema */
6543
+ function event(data) {
6544
+ return { data };
6545
+ }
6546
+ var StaticDirOutputSchema = object({ staticDir: string() });
6547
+ var VersionOutputSchema = object({ version: string() });
6548
+ method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6549
+ /**
6550
+ * device-ops — device-scoped cap that unifies the per-IDevice operations
6551
+ * previously routed through the `.device-ops` Moleculer bridge service.
6552
+ *
6553
+ * Each worker that hosts live `IDevice` instances auto-registers a native
6554
+ * provider for this cap (per device) backed by its local
6555
+ * `DeviceRegistry`. Hub-side callers reach it transparently through
6556
+ * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
6557
+ * `deviceId` + `nodeId` and dispatches through the standard cap-router,
6558
+ * so there's no parallel bridge path anymore.
6559
+ *
6560
+ * The surface is intentionally small — every method corresponds to a
6561
+ * single action on the live `IDevice` (or `ICameraDevice` for
6562
+ * `getStreamSources`). Richer orchestration (enable/disable with
6563
+ * integration plumbing, bulk updates) stays in the `device-manager` cap;
6564
+ * `device-ops` is the per-device primitive the device-manager routes to.
6565
+ */
6566
+ var StreamSourceEntrySchema = object({
6567
+ id: string(),
6568
+ label: string(),
6569
+ protocol: _enum([
6570
+ "rtsp",
6571
+ "rtmp",
6572
+ "annexb",
6573
+ "http-mjpeg",
6574
+ "webrtc",
6575
+ "custom"
6576
+ ]),
6577
+ url: string().optional(),
6578
+ resolution: object({
6579
+ width: number(),
6580
+ height: number()
6581
+ }).optional(),
6582
+ fps: number().optional(),
6583
+ bitrate: number().optional(),
6584
+ codec: string().optional(),
6585
+ profileHint: CamProfileSchema.optional(),
6586
+ sdp: string().optional()
6763
6587
  });
6764
- var YAMNET_TO_MACRO = {
6765
- mapping: {
6766
- Speech: "speech",
6767
- "Child speech, kid speaking": "speech",
6768
- Conversation: "speech",
6769
- "Narration, monologue": "speech",
6770
- Babbling: "speech",
6771
- Whispering: "speech",
6772
- "Speech synthesizer": "speech",
6773
- Humming: "speech",
6774
- Rapping: "speech",
6775
- Singing: "speech",
6776
- Choir: "speech",
6777
- "Child singing": "speech",
6778
- Shout: "scream",
6779
- Bellow: "scream",
6780
- Yell: "scream",
6781
- Screaming: "scream",
6782
- "Children shouting": "scream",
6783
- Whoop: "scream",
6784
- "Crying, sobbing": "crying",
6785
- "Baby cry, infant cry": "crying",
6786
- Whimper: "crying",
6787
- "Wail, moan": "crying",
6788
- Groan: "crying",
6789
- Laughter: "laughter",
6790
- "Baby laughter": "laughter",
6791
- Giggle: "laughter",
6792
- Snicker: "laughter",
6793
- "Belly laugh": "laughter",
6794
- "Chuckle, chortle": "laughter",
6795
- Music: "music",
6796
- "Musical instrument": "music",
6797
- Guitar: "music",
6798
- Piano: "music",
6799
- Drum: "music",
6800
- "Drum kit": "music",
6801
- "Violin, fiddle": "music",
6802
- Flute: "music",
6803
- Saxophone: "music",
6804
- Trumpet: "music",
6805
- Synthesizer: "music",
6806
- "Pop music": "music",
6807
- "Rock music": "music",
6808
- "Hip hop music": "music",
6809
- "Classical music": "music",
6810
- Jazz: "music",
6811
- "Electronic music": "music",
6812
- "Background music": "music",
6813
- Dog: "dog",
6814
- Bark: "dog",
6815
- Yip: "dog",
6816
- Howl: "dog",
6817
- "Bow-wow": "dog",
6818
- Growling: "dog",
6819
- "Whimper (dog)": "dog",
6820
- Cat: "cat",
6821
- Purr: "cat",
6822
- Meow: "cat",
6823
- Hiss: "cat",
6824
- Caterwaul: "cat",
6825
- Bird: "bird",
6826
- "Bird vocalization, bird call, bird song": "bird",
6827
- "Chirp, tweet": "bird",
6828
- Squawk: "bird",
6829
- Crow: "bird",
6830
- Owl: "bird",
6831
- "Pigeon, dove": "bird",
6832
- Animal: "animal",
6833
- "Domestic animals, pets": "animal",
6834
- "Livestock, farm animals, working animals": "animal",
6835
- Horse: "animal",
6836
- "Cattle, bovinae": "animal",
6837
- Pig: "animal",
6838
- Sheep: "animal",
6839
- Goat: "animal",
6840
- Frog: "animal",
6841
- Insect: "animal",
6842
- Cricket: "animal",
6843
- Alarm: "alarm",
6844
- "Alarm clock": "alarm",
6845
- "Smoke detector, smoke alarm": "alarm",
6846
- "Fire alarm": "alarm",
6847
- Buzzer: "alarm",
6848
- "Civil defense siren": "alarm",
6849
- "Car alarm": "alarm",
6850
- Siren: "siren",
6851
- "Police car (siren)": "siren",
6852
- "Ambulance (siren)": "siren",
6853
- "Fire engine, fire truck (siren)": "siren",
6854
- "Emergency vehicle": "siren",
6855
- Foghorn: "siren",
6856
- Doorbell: "doorbell",
6857
- "Ding-dong": "doorbell",
6858
- Knock: "doorbell",
6859
- Tap: "doorbell",
6860
- Glass: "glass_breaking",
6861
- Shatter: "glass_breaking",
6862
- "Chink, clink": "glass_breaking",
6863
- "Gunshot, gunfire": "gunshot",
6864
- "Machine gun": "gunshot",
6865
- Explosion: "gunshot",
6866
- Fireworks: "gunshot",
6867
- Firecracker: "gunshot",
6868
- "Artillery fire": "gunshot",
6869
- "Cap gun": "gunshot",
6870
- Boom: "gunshot",
6871
- Vehicle: "vehicle",
6872
- Car: "vehicle",
6873
- Truck: "vehicle",
6874
- Bus: "vehicle",
6875
- Motorcycle: "vehicle",
6876
- "Car passing by": "vehicle",
6877
- "Vehicle horn, car horn, honking": "vehicle",
6878
- "Traffic noise, roadway noise": "vehicle",
6879
- Train: "vehicle",
6880
- Aircraft: "vehicle",
6881
- Helicopter: "vehicle",
6882
- Bicycle: "vehicle",
6883
- Skateboard: "vehicle",
6884
- Fire: "fire",
6885
- Crackle: "fire",
6886
- Water: "water",
6887
- Rain: "water",
6888
- Raindrop: "water",
6889
- "Rain on surface": "water",
6890
- Stream: "water",
6891
- Waterfall: "water",
6892
- Ocean: "water",
6893
- "Waves, surf": "water",
6894
- "Splash, splatter": "water",
6895
- Wind: "wind",
6896
- Thunderstorm: "wind",
6897
- Thunder: "wind",
6898
- "Wind noise (microphone)": "wind",
6899
- "Rustling leaves": "wind",
6900
- Door: "door",
6901
- "Sliding door": "door",
6902
- Slam: "door",
6903
- "Cupboard open or close": "door",
6904
- "Walk, footsteps": "footsteps",
6905
- Run: "footsteps",
6906
- Shuffle: "footsteps",
6907
- Crowd: "crowd",
6908
- Chatter: "crowd",
6909
- Cheering: "crowd",
6910
- Applause: "crowd",
6911
- "Children playing": "crowd",
6912
- "Hubbub, speech noise, speech babble": "crowd",
6913
- Telephone: "telephone",
6914
- "Telephone bell ringing": "telephone",
6915
- Ringtone: "telephone",
6916
- "Telephone dialing, DTMF": "telephone",
6917
- "Busy signal": "telephone",
6918
- Engine: "engine",
6919
- "Engine starting": "engine",
6920
- Idling: "engine",
6921
- "Accelerating, revving, vroom": "engine",
6922
- "Light engine (high frequency)": "engine",
6923
- "Medium engine (mid frequency)": "engine",
6924
- "Heavy engine (low frequency)": "engine",
6925
- "Lawn mower": "engine",
6926
- Chainsaw: "engine",
6927
- Hammer: "tools",
6928
- Jackhammer: "tools",
6929
- Sawing: "tools",
6930
- "Power tool": "tools",
6931
- Drill: "tools",
6932
- Sanding: "tools",
6933
- Silence: "silence"
6934
- },
6935
- preserveOriginal: false
6588
+ var ConfigEntrySchema$1 = object({
6589
+ key: string(),
6590
+ value: unknown()
6591
+ });
6592
+ var RawStateResultSchema = object({
6593
+ /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
6594
+ source: string(),
6595
+ /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
6596
+ data: record(string(), unknown())
6597
+ });
6598
+ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
6599
+ deviceId: number(),
6600
+ values: record(string(), unknown())
6601
+ }), _void(), { kind: "mutation" }), method(object({
6602
+ deviceId: number(),
6603
+ action: string().min(1),
6604
+ input: unknown()
6605
+ }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
6606
+ /**
6607
+ * Promise-based timer helpers — used everywhere the codebase needs to
6608
+ * wait, back off, or schedule a retry. Before these helpers landed, each
6609
+ * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
6610
+ * with subtle variations (some swallowing cancellation, some not). Two
6611
+ * shapes cover every observed use case:
6612
+ *
6613
+ * - {@link sleep} for a plain, uncancellable wait — the default choice.
6614
+ * - {@link sleepCancellable} for a wait that wakes early when an
6615
+ * abort signal trips, used by long-running pollers whose teardown
6616
+ * must stop a pending backoff promptly.
6617
+ */
6618
+ /**
6619
+ * Resolve after `ms` milliseconds. Never rejects, never cancels. The
6620
+ * sleep cannot be interrupted; for a wakeable variant use
6621
+ * {@link sleepCancellable}.
6622
+ *
6623
+ * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
6624
+ * still gives the event loop a chance to drain — useful for breaking
6625
+ * up tight async loops without changing call-site semantics.
6626
+ */
6627
+ function sleep$1(ms) {
6628
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
6629
+ }
6630
+ //#endregion
6631
+ //#region ../types/dist/index.mjs
6632
+ /**
6633
+ * Deep wiring healthcheck — snapshot of active reachability probes across
6634
+ * every declared capability + widget of every installed plugin, on every
6635
+ * node. Produced by the backend `WiringHealthService` and surfaced via
6636
+ * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
6637
+ *
6638
+ * Unlike `/health` (process liveness), this reflects whether each cap/widget
6639
+ * is actually *reachable* over the real cap-dispatch path. See spec
6640
+ * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
6641
+ */
6642
+ /** What kind of target a probe addressed. */
6643
+ var wiringProbeKindSchema = _enum([
6644
+ "singleton",
6645
+ "device",
6646
+ "widget"
6647
+ ]);
6648
+ /** Result of probing a single (cap|widget [, device]) target. */
6649
+ var wiringProbeResultSchema = object({
6650
+ capName: string(),
6651
+ kind: wiringProbeKindSchema,
6652
+ deviceId: number().optional(),
6653
+ reachable: boolean(),
6654
+ latencyMs: number(),
6655
+ error: string().optional()
6656
+ });
6657
+ /** Per-addon roll-up of cap + widget probe results. */
6658
+ var wiringAddonHealthSchema = object({
6659
+ addonId: string(),
6660
+ caps: array(wiringProbeResultSchema).readonly(),
6661
+ widgets: array(wiringProbeResultSchema).readonly()
6662
+ });
6663
+ /** Per-node roll-up. */
6664
+ var wiringNodeHealthSchema = object({
6665
+ nodeId: string(),
6666
+ addons: array(wiringAddonHealthSchema).readonly()
6667
+ });
6668
+ object({
6669
+ /** True only when every probed target is reachable. */
6670
+ ok: boolean(),
6671
+ /** True when at least one target is unreachable. */
6672
+ degraded: boolean(),
6673
+ checkedAt: string(),
6674
+ nodes: array(wiringNodeHealthSchema).readonly(),
6675
+ summary: object({
6676
+ total: number(),
6677
+ reachable: number(),
6678
+ unreachable: number()
6679
+ })
6680
+ });
6681
+ var MODEL_FORMATS = [
6682
+ "onnx",
6683
+ "coreml",
6684
+ "openvino",
6685
+ "tflite",
6686
+ "pt"
6687
+ ];
6688
+ var EU_DST = {
6689
+ offsetHours: 1,
6690
+ startMonth: 3,
6691
+ startWeekIndex: 5,
6692
+ startWeekday: "Sunday",
6693
+ startHour: 2,
6694
+ endMonth: 10,
6695
+ endWeekIndex: 5,
6696
+ endWeekday: "Sunday",
6697
+ endHour: 3
6936
6698
  };
6937
- var APPLE_SA_TO_MACRO = {
6938
- mapping: {
6939
- speech: "speech",
6940
- child_speech: "speech",
6941
- conversation: "speech",
6942
- whispering: "speech",
6943
- singing: "speech",
6944
- humming: "speech",
6945
- shout: "scream",
6946
- yell: "scream",
6947
- screaming: "scream",
6948
- crying: "crying",
6949
- baby_crying: "crying",
6950
- sobbing: "crying",
6951
- laughter: "laughter",
6952
- baby_laughter: "laughter",
6953
- giggling: "laughter",
6954
- music: "music",
6955
- guitar: "music",
6956
- piano: "music",
6957
- drums: "music",
6958
- dog_bark: "dog",
6959
- dog_bow_wow: "dog",
6960
- dog_growling: "dog",
6961
- dog_howl: "dog",
6962
- cat_meow: "cat",
6963
- cat_purr: "cat",
6964
- cat_hiss: "cat",
6965
- bird: "bird",
6966
- bird_chirp: "bird",
6967
- bird_squawk: "bird",
6968
- animal: "animal",
6969
- horse: "animal",
6970
- cow_moo: "animal",
6971
- insect: "animal",
6972
- alarm: "alarm",
6973
- smoke_alarm: "alarm",
6974
- fire_alarm: "alarm",
6975
- car_alarm: "alarm",
6976
- siren: "siren",
6977
- police_siren: "siren",
6978
- ambulance_siren: "siren",
6979
- doorbell: "doorbell",
6980
- door_knock: "doorbell",
6981
- knocking: "doorbell",
6982
- glass_breaking: "glass_breaking",
6983
- glass_shatter: "glass_breaking",
6984
- gunshot: "gunshot",
6985
- explosion: "gunshot",
6986
- fireworks: "gunshot",
6987
- car: "vehicle",
6988
- truck: "vehicle",
6989
- motorcycle: "vehicle",
6990
- car_horn: "vehicle",
6991
- vehicle_horn: "vehicle",
6992
- traffic: "vehicle",
6993
- fire: "fire",
6994
- fire_crackle: "fire",
6995
- water: "water",
6996
- rain: "water",
6997
- ocean: "water",
6998
- splash: "water",
6999
- wind: "wind",
7000
- thunder: "wind",
7001
- thunderstorm: "wind",
7002
- door: "door",
7003
- door_slam: "door",
7004
- sliding_door: "door",
7005
- footsteps: "footsteps",
7006
- walking: "footsteps",
7007
- running: "footsteps",
7008
- crowd: "crowd",
7009
- chatter: "crowd",
7010
- cheering: "crowd",
7011
- applause: "crowd",
7012
- telephone_ring: "telephone",
7013
- ringtone: "telephone",
7014
- engine: "engine",
7015
- engine_starting: "engine",
7016
- lawn_mower: "engine",
7017
- chainsaw: "engine",
7018
- hammer: "tools",
7019
- jackhammer: "tools",
7020
- drill: "tools",
7021
- power_tool: "tools",
7022
- silence: "silence"
7023
- },
7024
- preserveOriginal: false
6699
+ var US_DST = {
6700
+ offsetHours: 1,
6701
+ startMonth: 3,
6702
+ startWeekIndex: 2,
6703
+ startWeekday: "Sunday",
6704
+ startHour: 2,
6705
+ endMonth: 11,
6706
+ endWeekIndex: 1,
6707
+ endWeekday: "Sunday",
6708
+ endHour: 2
7025
6709
  };
7026
- var _macroLookup = /* @__PURE__ */ new Map();
7027
- for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7028
- for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7029
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
7030
- DeviceType["Camera"] = "camera";
7031
- DeviceType["Hub"] = "hub";
7032
- DeviceType["Light"] = "light";
7033
- DeviceType["Siren"] = "siren";
7034
- DeviceType["Switch"] = "switch";
7035
- DeviceType["Sensor"] = "sensor";
7036
- DeviceType["Thermostat"] = "thermostat";
7037
- DeviceType["Button"] = "button";
7038
- /** Generic stateless event emitter — carries a device's EXACT declared
7039
- * event vocabulary verbatim (no normalization). Installed with the
7040
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
7041
- * HA bus events (e.g. `zha_event`, generic). */
7042
- DeviceType["EventEmitter"] = "event-emitter";
7043
- /** Firmware/software update entity — current vs available version,
7044
- * updatable flag, update state, and an install action. Installed with
7045
- * the `update` cap. Sources: Homematic firmware-update channels (and
7046
- * reusable by other providers, e.g. HA `update.*` entities). */
7047
- DeviceType["Update"] = "update";
7048
- DeviceType["Generic"] = "generic";
7049
- /** Generic notification delivery target (HA `notify.<service>`, future
7050
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
7051
- * endpoint; the `notifier` cap defines the send surface. */
7052
- DeviceType["Notifier"] = "notifier";
7053
- /** Pre-recorded action sequence with optional parameters
7054
- * (HA `script.*`). Runnable via `script-runner` cap. */
7055
- DeviceType["Script"] = "script";
7056
- /** Automation rule (HA `automation.*`) — enable/disable + manual
7057
- * trigger surface exposed via `automation-control` cap. */
7058
- DeviceType["Automation"] = "automation";
7059
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
7060
- DeviceType["Lock"] = "lock";
7061
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
7062
- * `valve.*`). `cover` cap with sub-roles for variant. */
7063
- DeviceType["Cover"] = "cover";
7064
- /** Pipe / water / gas valve with open/close/stop and optional
7065
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
7066
- * modelled on the same open/closed lifecycle. */
7067
- DeviceType["Valve"] = "valve";
7068
- /** Humidifier / dehumidifier with on/off + target humidity + mode
7069
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
7070
- * modelled on the same target / mode lifecycle. */
7071
- DeviceType["Humidifier"] = "humidifier";
7072
- /** Water heater / boiler with target temperature + operation mode +
7073
- * away mode (HA `water_heater.*`). `water-heater` cap — a
7074
- * climate-family actuator. */
7075
- DeviceType["WaterHeater"] = "water-heater";
7076
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
7077
- DeviceType["Fan"] = "fan";
7078
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
7079
- * the camera surface — those use `Camera`. `media-player` cap. */
7080
- DeviceType["MediaPlayer"] = "media-player";
7081
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
7082
- * `alarm-panel` cap. */
7083
- DeviceType["AlarmPanel"] = "alarm-panel";
7084
- /** Generic user-settable input (HA `number` / `input_number` / `select`
7085
- * / `input_select` / `text` / `input_text` / `input_datetime`).
7086
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
7087
- * TextControl / DateTimeControl. */
7088
- DeviceType["Control"] = "control";
7089
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
7090
- * `presence` cap. */
7091
- DeviceType["Presence"] = "presence";
7092
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
7093
- * `weather` cap. */
7094
- DeviceType["Weather"] = "weather";
7095
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
7096
- DeviceType["Vacuum"] = "vacuum";
7097
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
7098
- * `lawn-mower-control` cap. */
7099
- DeviceType["LawnMower"] = "lawn-mower";
7100
- /** Physical HA device group — parent container for entity-children
7101
- * adopted from a single HA device entry. Not renderable as a
7102
- * standalone device; exists only to anchor child entities. */
7103
- DeviceType["Container"] = "container";
7104
- /** Single still-image entity (HA `image.*`). Read-only display of an
7105
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
7106
- DeviceType["Image"] = "image";
7107
- return DeviceType;
7108
- }({});
7109
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
7110
- DeviceFeature["BatteryOperated"] = "battery-operated";
7111
- DeviceFeature["Rebootable"] = "rebootable";
7112
- /**
7113
- * Device supports an on-demand re-sync of its derived spec with its
7114
- * upstream source — drives the generic Re-sync button. The owning
7115
- * provider implements the action via the `device-adoption.resync` cap.
7116
- */
7117
- DeviceFeature["Resyncable"] = "resyncable";
7118
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
7119
- DeviceFeature["DoorbellButton"] = "doorbell-button";
7120
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
7121
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
7122
- /**
7123
- * Camera supports the on-firmware autotrack subsystem (subject-
7124
- * following). Distinct from `PanTiltZoom` because not every PTZ
7125
- * camera ships autotrack — the admin UI uses this flag to gate
7126
- * the autotrack toggle / settings card without re-deriving from
7127
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
7128
- * driver sets this feature when probe confirms the firmware
7129
- * surface, and registers the cap in the same code path.
7130
- */
7131
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
7132
- /**
7133
- * Accessory exposes a "trigger on motion" toggle — the parent camera's
7134
- * motion detection automatically activates this device. Mirrors
7135
- * `motion-trigger` cap registration: drivers set this feature in the
7136
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
7137
- *
7138
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
7139
- * fast scalar without binding fetch), notifier rules, and `listAll`
7140
- * filters that want "all devices with on-motion behaviour".
7141
- */
7142
- DeviceFeature["MotionTrigger"] = "motion-trigger";
7143
- /** Light supports rgb-triplet color via `color` cap. */
7144
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
7145
- /** Light supports HSV color via `color` cap. */
7146
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
7147
- /** Light supports color-temperature (mired) via `color` cap. */
7148
- DeviceFeature["LightColorMired"] = "light-color-mired";
7149
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
7150
- * targetHigh). Gates the range slider UI. */
7151
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
7152
- /** Thermostat exposes target humidity and/or current humidity
7153
- * readings. Gates the humidity controls. */
7154
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
7155
- /** Thermostat exposes a fan-mode selector. */
7156
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
7157
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
7158
- DeviceFeature["ClimatePreset"] = "climate-preset";
7159
- /** Cover exposes intermediate position control (0..100). Gates the
7160
- * position slider UI. */
7161
- DeviceFeature["CoverPositionable"] = "cover-positionable";
7162
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
7163
- DeviceFeature["CoverTilt"] = "cover-tilt";
7164
- /** Valve exposes intermediate position control (0..100). Gates the
7165
- * position slider / drag surface UI. */
7166
- DeviceFeature["ValvePositionable"] = "valve-positionable";
7167
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
7168
- DeviceFeature["FanSpeed"] = "fan-speed";
7169
- /** Fan exposes a preset mode selector. */
7170
- DeviceFeature["FanPreset"] = "fan-preset";
7171
- /** Fan exposes blade direction (forward/reverse) — typical of
7172
- * ceiling fans. */
7173
- DeviceFeature["FanDirection"] = "fan-direction";
7174
- /** Fan exposes an oscillation toggle. */
7175
- DeviceFeature["FanOscillating"] = "fan-oscillating";
7176
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
7177
- * field on the UI lock-controls panel. */
7178
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
7179
- /** Lock supports a latch-release ("open door") action distinct from
7180
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
7181
- * `supported_features`. Gates the Open Door button in the UI. */
7182
- DeviceFeature["LockOpen"] = "lock-open";
7183
- /** Media player exposes a seek-to-position surface. */
7184
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
7185
- /** Media player exposes a volume-level setter. */
7186
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
7187
- /** Media player exposes a mute toggle distinct from volume=0. */
7188
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
7189
- /** Media player exposes a shuffle toggle. */
7190
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
7191
- /** Media player exposes a repeat mode (off / all / one). */
7192
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
7193
- /** Media player exposes a source / input selector. */
7194
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
7195
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
7196
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
7197
- /** Media player exposes next-track. */
7198
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
7199
- /** Media player exposes previous-track. */
7200
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
7201
- /** Media player exposes stop distinct from pause. */
7202
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
7203
- /** Alarm panel requires a PIN code on arm/disarm. */
7204
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
7205
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
7206
- * addition to a textual location. */
7207
- DeviceFeature["PresenceGps"] = "presence-gps";
7208
- /** Notifier accepts an inline / URL image attachment. */
7209
- DeviceFeature["NotifierImage"] = "notifier-image";
7210
- /** Notifier accepts a priority hint (high/normal/low). */
7211
- DeviceFeature["NotifierPriority"] = "notifier-priority";
7212
- /** Notifier accepts a free-form `data` payload for platform-specific
7213
- * fields. */
7214
- DeviceFeature["NotifierData"] = "notifier-data";
7215
- /** Notifier supports interactive action buttons / callbacks. */
7216
- DeviceFeature["NotifierActions"] = "notifier-actions";
7217
- /** Notifier supports per-call recipient targeting (multi-user). */
7218
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
7219
- /** Script runner accepts a variables map on each run invocation. */
7220
- DeviceFeature["ScriptVariables"] = "script-variables";
7221
- /** Automation `trigger` accepts a skipCondition flag — fires the
7222
- * automation's actions while bypassing its condition block. */
7223
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
7224
- return DeviceFeature;
7225
- }({});
7226
6710
  /**
7227
- * Semantic role a device plays within its parent. Populated by driver
7228
- * addons when creating accessory devices (Reolink siren/floodlight/
7229
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
7230
- * admin UI to pick icons, labels, and widgets — a `Switch` with
7231
- * `role: Floodlight` renders as a bulb with a brightness slider,
7232
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
7233
- *
7234
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
7235
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
7236
- */
7237
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7238
- DeviceRole["Siren"] = "siren";
7239
- DeviceRole["Floodlight"] = "floodlight";
7240
- DeviceRole["Spotlight"] = "spotlight";
7241
- DeviceRole["PirSensor"] = "pir-sensor";
7242
- DeviceRole["Chime"] = "chime";
7243
- DeviceRole["Autotrack"] = "autotrack";
7244
- DeviceRole["Nightvision"] = "nightvision";
7245
- DeviceRole["PrivacyMask"] = "privacy-mask";
7246
- DeviceRole["Doorbell"] = "doorbell";
7247
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
7248
- * real Switch device for UI rendering / export adapters. */
7249
- DeviceRole["BinaryHelper"] = "binary-helper";
7250
- /** Generic motion / occupancy / moving event source. Distinct from
7251
- * the camera accessory PirSensor role: that one is a camera child;
7252
- * this is a standalone HA / 3rd-party motion sensor. */
7253
- DeviceRole["MotionSensor"] = "motion-sensor";
7254
- DeviceRole["ContactSensor"] = "contact-sensor";
7255
- DeviceRole["LeakSensor"] = "leak-sensor";
7256
- DeviceRole["SmokeSensor"] = "smoke-sensor";
7257
- DeviceRole["COSensor"] = "co-sensor";
7258
- DeviceRole["GasSensor"] = "gas-sensor";
7259
- DeviceRole["TamperSensor"] = "tamper-sensor";
7260
- DeviceRole["VibrationSensor"] = "vibration-sensor";
7261
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
7262
- DeviceRole["SoundSensor"] = "sound-sensor";
7263
- /** Fallback for `binary_sensor` without a known `device_class`. */
7264
- DeviceRole["BinarySensor"] = "binary-sensor";
7265
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
7266
- DeviceRole["HumiditySensor"] = "humidity-sensor";
7267
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
7268
- DeviceRole["PressureSensor"] = "pressure-sensor";
7269
- DeviceRole["PowerSensor"] = "power-sensor";
7270
- DeviceRole["EnergySensor"] = "energy-sensor";
7271
- DeviceRole["VoltageSensor"] = "voltage-sensor";
7272
- DeviceRole["CurrentSensor"] = "current-sensor";
7273
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
7274
- /** Battery level (numeric % via `sensor` OR low-bool via
7275
- * `binary_sensor` the cap distinguishes via the value type). */
7276
- DeviceRole["BatterySensor"] = "battery-sensor";
7277
- /** Fallback for `sensor` numeric without a known `device_class`. */
7278
- DeviceRole["NumericSensor"] = "numeric-sensor";
7279
- /** String / enum state (HA `sensor` with `state_class: enum` or
7280
- * `attributes.options`). */
7281
- DeviceRole["EnumSensor"] = "enum-sensor";
7282
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
7283
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
7284
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
7285
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
7286
- /** Last-resort fallback when nothing else matches. */
7287
- DeviceRole["GenericSensor"] = "generic-sensor";
7288
- DeviceRole["NumericControl"] = "numeric-control";
7289
- DeviceRole["SelectControl"] = "select-control";
7290
- DeviceRole["TextControl"] = "text-control";
7291
- DeviceRole["DateTimeControl"] = "datetime-control";
7292
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
7293
- * rich features (image, priority, channel routing). */
7294
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
7295
- /** Chat / messaging service (HA `notify.telegram_*`,
7296
- * `notify.discord_*`, etc.). */
7297
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
7298
- /** Email-based delivery (HA `notify.smtp`, etc.). */
7299
- DeviceRole["EmailNotifier"] = "email-notifier";
7300
- /** Fallback when the notifier service name doesn't match a known
7301
- * pattern. */
7302
- DeviceRole["GenericNotifier"] = "generic-notifier";
7303
- return DeviceRole;
7304
- }({});
6711
+ * Curated catalogue of common world zones, grouped by region. Not
6712
+ * exhaustive covers the everyday zones an operator is likely to pick.
6713
+ */
6714
+ var TIMEZONES = [
6715
+ {
6716
+ id: "UTC",
6717
+ label: "UTC (UTC+0)",
6718
+ region: "Universal",
6719
+ stdOffsetMinutes: 0,
6720
+ dst: null
6721
+ },
6722
+ {
6723
+ id: "Europe/London",
6724
+ label: "Europe/London (UTC+0 / BST)",
6725
+ region: "Europe",
6726
+ stdOffsetMinutes: 0,
6727
+ dst: EU_DST
6728
+ },
6729
+ {
6730
+ id: "Europe/Rome",
6731
+ label: "Europe/Rome (UTC+1 / CEST)",
6732
+ region: "Europe",
6733
+ stdOffsetMinutes: 60,
6734
+ dst: EU_DST
6735
+ },
6736
+ {
6737
+ id: "Europe/Paris",
6738
+ label: "Europe/Paris (UTC+1 / CEST)",
6739
+ region: "Europe",
6740
+ stdOffsetMinutes: 60,
6741
+ dst: EU_DST
6742
+ },
6743
+ {
6744
+ id: "Europe/Berlin",
6745
+ label: "Europe/Berlin (UTC+1 / CEST)",
6746
+ region: "Europe",
6747
+ stdOffsetMinutes: 60,
6748
+ dst: EU_DST
6749
+ },
6750
+ {
6751
+ id: "Europe/Madrid",
6752
+ label: "Europe/Madrid (UTC+1 / CEST)",
6753
+ region: "Europe",
6754
+ stdOffsetMinutes: 60,
6755
+ dst: EU_DST
6756
+ },
6757
+ {
6758
+ id: "Europe/Amsterdam",
6759
+ label: "Europe/Amsterdam (UTC+1 / CEST)",
6760
+ region: "Europe",
6761
+ stdOffsetMinutes: 60,
6762
+ dst: EU_DST
6763
+ },
6764
+ {
6765
+ id: "Europe/Istanbul",
6766
+ label: "Europe/Istanbul (UTC+3)",
6767
+ region: "Europe",
6768
+ stdOffsetMinutes: 180,
6769
+ dst: null
6770
+ },
6771
+ {
6772
+ id: "America/New_York",
6773
+ label: "America/New York (UTC−5 / EDT)",
6774
+ region: "Americas",
6775
+ stdOffsetMinutes: -300,
6776
+ dst: US_DST
6777
+ },
6778
+ {
6779
+ id: "America/Chicago",
6780
+ label: "America/Chicago (UTC−6 / CDT)",
6781
+ region: "Americas",
6782
+ stdOffsetMinutes: -360,
6783
+ dst: US_DST
6784
+ },
6785
+ {
6786
+ id: "America/Denver",
6787
+ label: "America/Denver (UTC−7 / MDT)",
6788
+ region: "Americas",
6789
+ stdOffsetMinutes: -420,
6790
+ dst: US_DST
6791
+ },
6792
+ {
6793
+ id: "America/Los_Angeles",
6794
+ label: "America/Los Angeles (UTC−8 / PDT)",
6795
+ region: "Americas",
6796
+ stdOffsetMinutes: -480,
6797
+ dst: US_DST
6798
+ },
6799
+ {
6800
+ id: "America/Sao_Paulo",
6801
+ label: "America/Sao Paulo (UTC−3)",
6802
+ region: "Americas",
6803
+ stdOffsetMinutes: -180,
6804
+ dst: null
6805
+ },
6806
+ {
6807
+ id: "Asia/Dubai",
6808
+ label: "Asia/Dubai (UTC+4)",
6809
+ region: "Asia",
6810
+ stdOffsetMinutes: 240,
6811
+ dst: null
6812
+ },
6813
+ {
6814
+ id: "Asia/Kolkata",
6815
+ label: "Asia/Kolkata (UTC+5:30)",
6816
+ region: "Asia",
6817
+ stdOffsetMinutes: 330,
6818
+ dst: null
6819
+ },
6820
+ {
6821
+ id: "Asia/Singapore",
6822
+ label: "Asia/Singapore (UTC+8)",
6823
+ region: "Asia",
6824
+ stdOffsetMinutes: 480,
6825
+ dst: null
6826
+ },
6827
+ {
6828
+ id: "Asia/Shanghai",
6829
+ label: "Asia/Shanghai (UTC+8)",
6830
+ region: "Asia",
6831
+ stdOffsetMinutes: 480,
6832
+ dst: null
6833
+ },
6834
+ {
6835
+ id: "Asia/Tokyo",
6836
+ label: "Asia/Tokyo (UTC+9)",
6837
+ region: "Asia",
6838
+ stdOffsetMinutes: 540,
6839
+ dst: null
6840
+ },
6841
+ {
6842
+ id: "Australia/Sydney",
6843
+ label: "Australia/Sydney (UTC+10 / AEDT)",
6844
+ region: "Oceania",
6845
+ stdOffsetMinutes: 600,
6846
+ dst: {
6847
+ offsetHours: 1,
6848
+ startMonth: 10,
6849
+ startWeekIndex: 1,
6850
+ startWeekday: "Sunday",
6851
+ startHour: 2,
6852
+ endMonth: 4,
6853
+ endWeekIndex: 1,
6854
+ endWeekday: "Sunday",
6855
+ endHour: 3
6856
+ }
6857
+ }
6858
+ ];
6859
+ /** Resolve an IANA id to its `Timezone`, or `undefined` if unknown. */
6860
+ function findTimezone(id) {
6861
+ return TIMEZONES.find((tz) => tz.id === id);
6862
+ }
6863
+ /**
6864
+ * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6865
+ * Named `RecordingWeekday` to avoid collision with the string-union
6866
+ * `Weekday` exported from `interfaces/timezones.ts`.
6867
+ */
6868
+ var RecordingWeekdaySchema = number().int().min(0).max(6);
6869
+ var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6870
+ var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6871
+ kind: literal("timeOfDay"),
6872
+ start: string().regex(HHMM),
6873
+ end: string().regex(HHMM),
6874
+ /** Restrict to these weekdays; omit = every day. */
6875
+ days: array(RecordingWeekdaySchema).optional()
6876
+ })]);
6877
+ var RecordingModeSchema = _enum([
6878
+ "continuous",
6879
+ "onMotion",
6880
+ "onAudioThreshold"
6881
+ ]);
6882
+ /**
6883
+ * First-class, authoritative per-camera storage mode — the netta choice the UI
6884
+ * reads directly (never inferred from `rules`):
6885
+ * - `off` — not recording.
6886
+ * - `events` — record only around triggers (motion / audio threshold),
6887
+ * with pre/post-buffer.
6888
+ * - `continuous` — record 24/7 within the schedule.
6889
+ *
6890
+ * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6891
+ * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6892
+ */
6893
+ var RecordingStorageModeSchema = _enum([
6894
+ "off",
6895
+ "events",
6896
+ "continuous"
6897
+ ]);
6898
+ /** Which detectors trigger an `events`-mode recording. */
6899
+ var RecordingTriggersSchema = object({
6900
+ motion: boolean().optional(),
6901
+ audioThresholdDbfs: number().optional()
6902
+ });
6903
+ /**
6904
+ * Mode of a single recording band — the recorder per-band vocabulary.
6905
+ *
6906
+ * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6907
+ * only ever `continuous` or `events`; "off" is expressed by the absence of a
6908
+ * covering band, not by a band value.
6909
+ */
6910
+ var RecordingBandModeSchema = _enum(["continuous", "events"]);
6911
+ /**
6912
+ * Triggers for an `events`-mode band. Identical shape to
6913
+ * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6914
+ * two never drift.
6915
+ */
6916
+ var RecordingBandTriggersSchema = RecordingTriggersSchema;
6917
+ /**
6918
+ * A single mode-per-band window — the canonical recorder band shape, the
6919
+ * single source of truth re-used by `addon-pipeline/recorder`.
6920
+ *
6921
+ * `days` lists the weekdays the band covers (empty = every day, matching the
6922
+ * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6923
+ * span wraps past midnight (handled by the band engine).
6924
+ */
6925
+ var RecordingBandSchema = object({
6926
+ days: array(RecordingWeekdaySchema),
6927
+ start: string().regex(HHMM),
6928
+ end: string().regex(HHMM),
6929
+ mode: RecordingBandModeSchema,
6930
+ triggers: RecordingBandTriggersSchema.optional(),
6931
+ preBufferSec: number().min(0).optional(),
6932
+ postBufferSec: number().min(0).optional()
6933
+ });
6934
+ var RecordingRuleSchema = object({
6935
+ schedule: RecordingScheduleSchema,
6936
+ mode: RecordingModeSchema,
6937
+ /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6938
+ preBufferSec: number().min(0).default(0),
6939
+ /** Keep recording until this many seconds after the last trigger. */
6940
+ postBufferSec: number().min(0).default(0),
6941
+ /** Each new trigger restarts the post-buffer window. */
6942
+ resetTimeoutOnNewEvent: boolean().default(true),
6943
+ /** onAudioThreshold only — dBFS level that counts as a trigger. */
6944
+ thresholdDbfs: number().optional()
6945
+ });
6946
+ /**
6947
+ * Per-device retention overrides. Every field is optional; an unset or `0`
6948
+ * value inherits the node-wide recorder default. Only footage-lifetime limits
6949
+ * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6950
+ * (when the volume is too full to keep recording) is NOT a per-camera concern —
6951
+ * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6952
+ * shared by every camera writing to that volume.
6953
+ */
6954
+ var RecordingRetentionSchema = object({
6955
+ maxAgeDays: number().min(0).optional(),
6956
+ maxSizeGb: number().min(0).optional()
6957
+ });
6958
+ /**
6959
+ * The full per-camera recording intent — the wire shape of a RecordingTarget.
6960
+ *
6961
+ * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6962
+ * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6963
+ * only for transition + migration (`migrateRulesToMode`); the policy engine
6964
+ * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6965
+ */
6966
+ var RecordingConfigSchema = object({
6967
+ enabled: boolean(),
6968
+ /** Authoritative storage mode. Absent on legacy targets → derived once via
6969
+ * `migrateRulesToMode`, then persisted. */
6970
+ mode: RecordingStorageModeSchema.optional(),
6971
+ profiles: array(CamProfileSchema).optional(),
6972
+ segmentSeconds: number().int().positive().optional(),
6973
+ /** Shared recording time-bands for `events` & `continuous` — record only when
6974
+ * the wall-clock falls inside one of these windows. Omit or empty = always.
6975
+ * `continuous` compiles to one rule per band; `events` to band × trigger. */
6976
+ schedules: array(RecordingScheduleSchema).optional(),
6977
+ /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6978
+ * normalized into `schedules` on read and never written going forward. (Not
6979
+ * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6980
+ schedule: RecordingScheduleSchema.optional(),
6981
+ /** `events`-mode only — which detectors trigger a recording. */
6982
+ triggers: RecordingTriggersSchema.optional(),
6983
+ /** `events`-mode only — seconds retained before / after a trigger. */
6984
+ preBufferSec: number().min(0).optional(),
6985
+ postBufferSec: number().min(0).optional(),
6986
+ /** DEPRECATED authoring input; retained for migration/transition. */
6987
+ rules: array(RecordingRuleSchema).optional(),
6988
+ /**
6989
+ * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6990
+ * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6991
+ * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6992
+ * derived into bands once via `migrateConfigToBands`.
6993
+ */
6994
+ bands: array(RecordingBandSchema).optional(),
6995
+ retention: RecordingRetentionSchema.optional()
6996
+ });
6997
+ /**
6998
+ * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6999
+ * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
7000
+ * so the persisted record schema and the consumer-facing cap can both consume it
7001
+ * without forming a circular import. The `storage` cap re-exports it
7002
+ * verbatim for back-compat.
7003
+ *
7004
+ * This Zod schema is the **authoritative source** for `StorageLocationType`.
7005
+ * The TS alias in `./storage.ts` re-exports `z.infer<typeof
7006
+ * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
7007
+ * `IStorageProvider` interface stay in lockstep.
7008
+ *
7009
+ * The type is now an **open string** (not a closed enum) — addons declare
7010
+ * their own location kinds via `StorageLocationDeclaration.id`. The regex
7011
+ * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
7012
+ */
7013
+ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
7014
+ /**
7015
+ * Persisted record for a storage location instance. Operators can register
7016
+ * multiple instances for multi-cardinality types (e.g. two `backups`
7017
+ * locations with different `providerId`s). Cardinality is now declared per
7018
+ * location via `StorageLocationDeclaration.cardinality` — the static
7019
+ * `STORAGE_LOCATION_CARDINALITY` map has been removed.
7020
+ *
7021
+ * `id` is a stable namespaced string of the form `<type>:<slug>`.
7022
+ * The default location for a type uses `id === <type>:default` by
7023
+ * convention (the bare type ref like `'backups'` resolves to it).
7024
+ *
7025
+ * `isSystem: true` marks a location as orchestrator-seeded and
7026
+ * undeletable. The bootstrap-installed defaults (one per type) carry
7027
+ * this flag; operator-added locations don't. Editing the config of
7028
+ * a system location is allowed (path migration, provider swap) but
7029
+ * deleting it is rejected at the cap level.
7030
+ */
7031
+ var StorageLocationSchema = object({
7032
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
7033
+ type: string(),
7034
+ displayName: string().min(1),
7035
+ providerId: string().min(1),
7036
+ config: record(string(), unknown()),
7037
+ /**
7038
+ * Cluster node this location physically lives on. REQUIRED for node-local
7039
+ * providers (filesystem — the path exists on one node's disk), null/absent
7040
+ * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
7041
+ * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
7042
+ * flag at upsert time, not here (the schema is provider-agnostic).
7043
+ */
7044
+ nodeId: string().optional(),
7045
+ isDefault: boolean().default(false),
7046
+ isSystem: boolean().default(false),
7047
+ createdAt: number(),
7048
+ updatedAt: number()
7049
+ });
7050
+ /**
7051
+ * Reference accepted by consumer-facing `api.storage.*` calls.
7052
+ * Either:
7053
+ * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
7054
+ * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
7055
+ *
7056
+ * The orchestrator's `resolveRef(ref)` handles both cases.
7057
+ */
7058
+ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
7059
+ /**
7060
+ * `StorageLocationDeclaration` — a single storage-location entry declared by
7061
+ * an addon in its `package.json` under `camstack.storageLocations`.
7062
+ *
7063
+ * Design intent:
7064
+ * - **Addon declares its needs** — each addon describes the logical storage
7065
+ * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
7066
+ * about the physical path.
7067
+ * - **Kernel aggregates** — at boot the kernel collects declarations from all
7068
+ * installed addons, deduplicates by `id`, and exposes the union via the
7069
+ * storage-locations settings surface.
7070
+ * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
7071
+ * at least one instance named `<id>:default` is present, using
7072
+ * `defaultsTo` to inherit the resolved root from another location when the
7073
+ * declaration is a derivative slot (e.g. `recordingsLow` defaults to
7074
+ * `recordings`).
7075
+ * - **ids are global** — `id` values are shared across the entire deployment;
7076
+ * two addons declaring the same `id` must agree on `cardinality` (validated
7077
+ * at kernel aggregation time, not here).
7078
+ */
7079
+ var StorageLocationDeclarationSchema = object({
7080
+ /**
7081
+ * Global location identifier, e.g. `recordings` or `recordingsLow`.
7082
+ * Must start with a lowercase letter and may contain letters, digits, and
7083
+ * hyphens.
7084
+ */
7085
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
7086
+ /** Human-readable name shown in the admin UI. */
7087
+ displayName: string().min(1, { message: "displayName must not be empty" }),
7088
+ /** Optional longer explanation of what data this location stores. */
7089
+ description: string().optional(),
7090
+ /**
7091
+ * `single` — exactly one instance of this location is allowed system-wide
7092
+ * (e.g. `logs`, `models`). The operator can edit it but not add more.
7093
+ * `multi` — the operator may register several instances (e.g. a second
7094
+ * `recordings` on a NAS for disk tiering); one is the default at any time.
7095
+ */
7096
+ cardinality: _enum(["single", "multi"]),
7097
+ /**
7098
+ * When set, the default instance for this location inherits its resolved
7099
+ * root from the named location's default instance. Useful for derivative
7100
+ * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
7101
+ * configure the primary location.
7102
+ */
7103
+ defaultsTo: string().optional()
7104
+ });
7105
+ var DecoderStatsSchema = object({
7106
+ inputFps: number(),
7107
+ outputFps: number(),
7108
+ avgDecodeTimeMs: number(),
7109
+ droppedFrames: number()
7110
+ });
7111
+ var DecoderSessionConfigSchema = object({
7112
+ codec: string(),
7113
+ maxFps: number().default(0),
7114
+ outputFormat: _enum([
7115
+ "jpeg",
7116
+ "rgb",
7117
+ "bgr",
7118
+ "yuv420",
7119
+ "gray"
7120
+ ]).default("jpeg"),
7121
+ scale: number().default(1),
7122
+ width: number().optional(),
7123
+ height: number().optional(),
7124
+ /**
7125
+ * Identifier of the camera this decoder session serves. Optional
7126
+ * because the cap is generic (any caller could request decode), but
7127
+ * stream-broker passes it so decoder logs include `deviceId` for
7128
+ * per-camera filtering when diagnosing failures (e.g. node-av
7129
+ * sendPacket errors on a single hung camera).
7130
+ */
7131
+ deviceId: number().int().nonnegative().optional(),
7132
+ /**
7133
+ * Free-form tag for log scoping. Stream-broker uses
7134
+ * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
7135
+ * on every line so `grep tag=broker:5/high` filters one camera
7136
+ * profile cleanly.
7137
+ */
7138
+ tag: string().optional(),
7139
+ /**
7140
+ * Where the session delivers decoded frames (Phase 5 / D9):
7141
+ *
7142
+ * - `'callback'` (default) — the legacy pixel path: decoded frames are
7143
+ * buffered as `DecodedFrame`s and drained via `pullFrames`.
7144
+ * - `'shm'` — the shared-memory frame plane: decoded frames are written
7145
+ * into an OS shared-memory ring and drained as zero-pixel
7146
+ * `FrameHandle`s via `pullHandles`. A session is one mode or the
7147
+ * other — `pullFrames` returns nothing for an `'shm'` session and
7148
+ * `pullHandles` returns nothing for a `'callback'` session.
7149
+ */
7150
+ frameSink: _enum(["callback", "shm"]).default("callback")
7151
+ });
7152
+ var EncodeProfileSchema = object({
7153
+ video: object({
7154
+ codec: _enum([
7155
+ "h264",
7156
+ "h265",
7157
+ "copy"
7158
+ ]),
7159
+ profile: _enum([
7160
+ "baseline",
7161
+ "main",
7162
+ "high"
7163
+ ]).optional(),
7164
+ width: number().int().positive().optional(),
7165
+ height: number().int().positive().optional(),
7166
+ fps: number().positive().optional(),
7167
+ bitrateKbps: number().int().positive().optional(),
7168
+ gopFrames: number().int().positive().optional(),
7169
+ bf: number().int().min(0).optional(),
7170
+ preset: _enum([
7171
+ "ultrafast",
7172
+ "superfast",
7173
+ "veryfast",
7174
+ "faster",
7175
+ "fast",
7176
+ "medium"
7177
+ ]).optional(),
7178
+ tune: _enum([
7179
+ "zerolatency",
7180
+ "film",
7181
+ "animation"
7182
+ ]).optional()
7183
+ }),
7184
+ audio: union([literal("passthrough"), object({
7185
+ codec: _enum([
7186
+ "opus",
7187
+ "aac",
7188
+ "pcmu",
7189
+ "pcma",
7190
+ "copy"
7191
+ ]),
7192
+ bitrateKbps: number().int().positive().optional(),
7193
+ sampleRateHz: number().int().positive().optional(),
7194
+ channels: union([literal(1), literal(2)]).optional()
7195
+ })]),
7196
+ /**
7197
+ * ffmpeg input-side args, inserted between the fixed global flags
7198
+ * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
7199
+ * — the widget surfaces a textarea + suggestion chips for the most-
7200
+ * used demuxer/format options.
7201
+ */
7202
+ inputArgs: array(string()).optional(),
7203
+ /**
7204
+ * ffmpeg output-side args, inserted between the encode block and
7205
+ * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
7206
+ * filters, codec-specific overrides. Free-text array.
7207
+ */
7208
+ outputArgs: array(string()).optional()
7209
+ });
7210
+ var YAMNET_TO_MACRO = {
7211
+ mapping: {
7212
+ Speech: "speech",
7213
+ "Child speech, kid speaking": "speech",
7214
+ Conversation: "speech",
7215
+ "Narration, monologue": "speech",
7216
+ Babbling: "speech",
7217
+ Whispering: "speech",
7218
+ "Speech synthesizer": "speech",
7219
+ Humming: "speech",
7220
+ Rapping: "speech",
7221
+ Singing: "speech",
7222
+ Choir: "speech",
7223
+ "Child singing": "speech",
7224
+ Shout: "scream",
7225
+ Bellow: "scream",
7226
+ Yell: "scream",
7227
+ Screaming: "scream",
7228
+ "Children shouting": "scream",
7229
+ Whoop: "scream",
7230
+ "Crying, sobbing": "crying",
7231
+ "Baby cry, infant cry": "crying",
7232
+ Whimper: "crying",
7233
+ "Wail, moan": "crying",
7234
+ Groan: "crying",
7235
+ Laughter: "laughter",
7236
+ "Baby laughter": "laughter",
7237
+ Giggle: "laughter",
7238
+ Snicker: "laughter",
7239
+ "Belly laugh": "laughter",
7240
+ "Chuckle, chortle": "laughter",
7241
+ Music: "music",
7242
+ "Musical instrument": "music",
7243
+ Guitar: "music",
7244
+ Piano: "music",
7245
+ Drum: "music",
7246
+ "Drum kit": "music",
7247
+ "Violin, fiddle": "music",
7248
+ Flute: "music",
7249
+ Saxophone: "music",
7250
+ Trumpet: "music",
7251
+ Synthesizer: "music",
7252
+ "Pop music": "music",
7253
+ "Rock music": "music",
7254
+ "Hip hop music": "music",
7255
+ "Classical music": "music",
7256
+ Jazz: "music",
7257
+ "Electronic music": "music",
7258
+ "Background music": "music",
7259
+ Dog: "dog",
7260
+ Bark: "dog",
7261
+ Yip: "dog",
7262
+ Howl: "dog",
7263
+ "Bow-wow": "dog",
7264
+ Growling: "dog",
7265
+ "Whimper (dog)": "dog",
7266
+ Cat: "cat",
7267
+ Purr: "cat",
7268
+ Meow: "cat",
7269
+ Hiss: "cat",
7270
+ Caterwaul: "cat",
7271
+ Bird: "bird",
7272
+ "Bird vocalization, bird call, bird song": "bird",
7273
+ "Chirp, tweet": "bird",
7274
+ Squawk: "bird",
7275
+ Crow: "bird",
7276
+ Owl: "bird",
7277
+ "Pigeon, dove": "bird",
7278
+ Animal: "animal",
7279
+ "Domestic animals, pets": "animal",
7280
+ "Livestock, farm animals, working animals": "animal",
7281
+ Horse: "animal",
7282
+ "Cattle, bovinae": "animal",
7283
+ Pig: "animal",
7284
+ Sheep: "animal",
7285
+ Goat: "animal",
7286
+ Frog: "animal",
7287
+ Insect: "animal",
7288
+ Cricket: "animal",
7289
+ Alarm: "alarm",
7290
+ "Alarm clock": "alarm",
7291
+ "Smoke detector, smoke alarm": "alarm",
7292
+ "Fire alarm": "alarm",
7293
+ Buzzer: "alarm",
7294
+ "Civil defense siren": "alarm",
7295
+ "Car alarm": "alarm",
7296
+ Siren: "siren",
7297
+ "Police car (siren)": "siren",
7298
+ "Ambulance (siren)": "siren",
7299
+ "Fire engine, fire truck (siren)": "siren",
7300
+ "Emergency vehicle": "siren",
7301
+ Foghorn: "siren",
7302
+ Doorbell: "doorbell",
7303
+ "Ding-dong": "doorbell",
7304
+ Knock: "doorbell",
7305
+ Tap: "doorbell",
7306
+ Glass: "glass_breaking",
7307
+ Shatter: "glass_breaking",
7308
+ "Chink, clink": "glass_breaking",
7309
+ "Gunshot, gunfire": "gunshot",
7310
+ "Machine gun": "gunshot",
7311
+ Explosion: "gunshot",
7312
+ Fireworks: "gunshot",
7313
+ Firecracker: "gunshot",
7314
+ "Artillery fire": "gunshot",
7315
+ "Cap gun": "gunshot",
7316
+ Boom: "gunshot",
7317
+ Vehicle: "vehicle",
7318
+ Car: "vehicle",
7319
+ Truck: "vehicle",
7320
+ Bus: "vehicle",
7321
+ Motorcycle: "vehicle",
7322
+ "Car passing by": "vehicle",
7323
+ "Vehicle horn, car horn, honking": "vehicle",
7324
+ "Traffic noise, roadway noise": "vehicle",
7325
+ Train: "vehicle",
7326
+ Aircraft: "vehicle",
7327
+ Helicopter: "vehicle",
7328
+ Bicycle: "vehicle",
7329
+ Skateboard: "vehicle",
7330
+ Fire: "fire",
7331
+ Crackle: "fire",
7332
+ Water: "water",
7333
+ Rain: "water",
7334
+ Raindrop: "water",
7335
+ "Rain on surface": "water",
7336
+ Stream: "water",
7337
+ Waterfall: "water",
7338
+ Ocean: "water",
7339
+ "Waves, surf": "water",
7340
+ "Splash, splatter": "water",
7341
+ Wind: "wind",
7342
+ Thunderstorm: "wind",
7343
+ Thunder: "wind",
7344
+ "Wind noise (microphone)": "wind",
7345
+ "Rustling leaves": "wind",
7346
+ Door: "door",
7347
+ "Sliding door": "door",
7348
+ Slam: "door",
7349
+ "Cupboard open or close": "door",
7350
+ "Walk, footsteps": "footsteps",
7351
+ Run: "footsteps",
7352
+ Shuffle: "footsteps",
7353
+ Crowd: "crowd",
7354
+ Chatter: "crowd",
7355
+ Cheering: "crowd",
7356
+ Applause: "crowd",
7357
+ "Children playing": "crowd",
7358
+ "Hubbub, speech noise, speech babble": "crowd",
7359
+ Telephone: "telephone",
7360
+ "Telephone bell ringing": "telephone",
7361
+ Ringtone: "telephone",
7362
+ "Telephone dialing, DTMF": "telephone",
7363
+ "Busy signal": "telephone",
7364
+ Engine: "engine",
7365
+ "Engine starting": "engine",
7366
+ Idling: "engine",
7367
+ "Accelerating, revving, vroom": "engine",
7368
+ "Light engine (high frequency)": "engine",
7369
+ "Medium engine (mid frequency)": "engine",
7370
+ "Heavy engine (low frequency)": "engine",
7371
+ "Lawn mower": "engine",
7372
+ Chainsaw: "engine",
7373
+ Hammer: "tools",
7374
+ Jackhammer: "tools",
7375
+ Sawing: "tools",
7376
+ "Power tool": "tools",
7377
+ Drill: "tools",
7378
+ Sanding: "tools",
7379
+ Silence: "silence"
7380
+ },
7381
+ preserveOriginal: false
7382
+ };
7383
+ var APPLE_SA_TO_MACRO = {
7384
+ mapping: {
7385
+ speech: "speech",
7386
+ child_speech: "speech",
7387
+ conversation: "speech",
7388
+ whispering: "speech",
7389
+ singing: "speech",
7390
+ humming: "speech",
7391
+ shout: "scream",
7392
+ yell: "scream",
7393
+ screaming: "scream",
7394
+ crying: "crying",
7395
+ baby_crying: "crying",
7396
+ sobbing: "crying",
7397
+ laughter: "laughter",
7398
+ baby_laughter: "laughter",
7399
+ giggling: "laughter",
7400
+ music: "music",
7401
+ guitar: "music",
7402
+ piano: "music",
7403
+ drums: "music",
7404
+ dog_bark: "dog",
7405
+ dog_bow_wow: "dog",
7406
+ dog_growling: "dog",
7407
+ dog_howl: "dog",
7408
+ cat_meow: "cat",
7409
+ cat_purr: "cat",
7410
+ cat_hiss: "cat",
7411
+ bird: "bird",
7412
+ bird_chirp: "bird",
7413
+ bird_squawk: "bird",
7414
+ animal: "animal",
7415
+ horse: "animal",
7416
+ cow_moo: "animal",
7417
+ insect: "animal",
7418
+ alarm: "alarm",
7419
+ smoke_alarm: "alarm",
7420
+ fire_alarm: "alarm",
7421
+ car_alarm: "alarm",
7422
+ siren: "siren",
7423
+ police_siren: "siren",
7424
+ ambulance_siren: "siren",
7425
+ doorbell: "doorbell",
7426
+ door_knock: "doorbell",
7427
+ knocking: "doorbell",
7428
+ glass_breaking: "glass_breaking",
7429
+ glass_shatter: "glass_breaking",
7430
+ gunshot: "gunshot",
7431
+ explosion: "gunshot",
7432
+ fireworks: "gunshot",
7433
+ car: "vehicle",
7434
+ truck: "vehicle",
7435
+ motorcycle: "vehicle",
7436
+ car_horn: "vehicle",
7437
+ vehicle_horn: "vehicle",
7438
+ traffic: "vehicle",
7439
+ fire: "fire",
7440
+ fire_crackle: "fire",
7441
+ water: "water",
7442
+ rain: "water",
7443
+ ocean: "water",
7444
+ splash: "water",
7445
+ wind: "wind",
7446
+ thunder: "wind",
7447
+ thunderstorm: "wind",
7448
+ door: "door",
7449
+ door_slam: "door",
7450
+ sliding_door: "door",
7451
+ footsteps: "footsteps",
7452
+ walking: "footsteps",
7453
+ running: "footsteps",
7454
+ crowd: "crowd",
7455
+ chatter: "crowd",
7456
+ cheering: "crowd",
7457
+ applause: "crowd",
7458
+ telephone_ring: "telephone",
7459
+ ringtone: "telephone",
7460
+ engine: "engine",
7461
+ engine_starting: "engine",
7462
+ lawn_mower: "engine",
7463
+ chainsaw: "engine",
7464
+ hammer: "tools",
7465
+ jackhammer: "tools",
7466
+ drill: "tools",
7467
+ power_tool: "tools",
7468
+ silence: "silence"
7469
+ },
7470
+ preserveOriginal: false
7471
+ };
7472
+ var _macroLookup = /* @__PURE__ */ new Map();
7473
+ for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7474
+ for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7305
7475
  /**
7306
7476
  * Accessory device helpers — shared across drivers.
7307
7477
  *
@@ -7794,78 +7964,6 @@ var airQualitySensorCapability = {
7794
7964
  runtimeState: AirQualitySensorStatusSchema
7795
7965
  };
7796
7966
  /**
7797
- * Generic types for capability definitions.
7798
- *
7799
- * A capability is defined with Zod schemas for methods, events, and settings.
7800
- * TypeScript types are inferred via z.infer<> — zero duplication.
7801
- *
7802
- * Pattern:
7803
- * 1. Define Zod schemas for data, methods, settings
7804
- * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
7805
- * 3. Export type IProvider = InferProvider<typeof capabilityDef>
7806
- * 4. Addon implements IProvider
7807
- * 5. Registry auto-mounts tRPC router from definition.methods
7808
- */
7809
- /**
7810
- * Output schema shared by the contribution + live methods.
7811
- *
7812
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
7813
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
7814
- * concrete-but-lenient Zod object keeps tRPC output inference happy
7815
- * (using `z.unknown()` here collapses unrelated router branches to
7816
- * `unknown` when the generator re-inlines the huge AppRouter type).
7817
- *
7818
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
7819
- * extensions the caller adds (showWhen, displayScale, …) without
7820
- * rebuilding every time a new field kind is introduced.
7821
- */
7822
- var ContributionSectionSchema = object({
7823
- id: string(),
7824
- title: string(),
7825
- description: string().optional(),
7826
- style: _enum(["card", "accordion"]).optional(),
7827
- defaultCollapsed: boolean().optional(),
7828
- columns: union([
7829
- literal(1),
7830
- literal(2),
7831
- literal(3),
7832
- literal(4)
7833
- ]).optional(),
7834
- tab: string().optional(),
7835
- location: _enum(["settings", "top-tab"]).optional(),
7836
- order: number().optional(),
7837
- fields: array(any())
7838
- });
7839
- object({
7840
- tabs: array(object({
7841
- id: string(),
7842
- label: string(),
7843
- icon: string(),
7844
- order: number().optional()
7845
- })).optional(),
7846
- sections: array(ContributionSectionSchema)
7847
- }).nullable();
7848
- object({ deviceId: number() }), object({ deviceId: number() }), object({
7849
- deviceId: number(),
7850
- patch: record(string(), unknown())
7851
- }), object({ success: literal(true) });
7852
- object({ deviceId: number() }), unknown().nullable();
7853
- /** Shorthand to define a method schema */
7854
- function method(input, output, options) {
7855
- return {
7856
- input,
7857
- output,
7858
- kind: options?.kind ?? "query",
7859
- auth: options?.auth ?? "protected",
7860
- ...options?.access !== void 0 ? { access: options.access } : {},
7861
- timeoutMs: options?.timeoutMs
7862
- };
7863
- }
7864
- /** Shorthand to define an event schema */
7865
- function event(data) {
7866
- return { data };
7867
- }
7868
- /**
7869
7967
  * Alarm-panel cap. Models HA `alarm_control_panel.*` on
7870
7968
  * `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
7871
7969
  * across disarmed / armed_(home|away|night|vacation|custom_bypass) /
@@ -10581,6 +10679,24 @@ var DetectorOutputSchema = object({
10581
10679
  inferenceMs: number(),
10582
10680
  modelId: string()
10583
10681
  });
10682
+ var EngineProvisioningSchema = object({
10683
+ runtimeId: _enum([
10684
+ "onnx",
10685
+ "openvino",
10686
+ "coreml"
10687
+ ]).nullable(),
10688
+ device: string().nullable(),
10689
+ state: _enum([
10690
+ "idle",
10691
+ "installing",
10692
+ "verifying",
10693
+ "ready",
10694
+ "failed"
10695
+ ]),
10696
+ progress: number().optional(),
10697
+ error: string().optional(),
10698
+ nextRetryAt: number().optional()
10699
+ });
10584
10700
  var PipelineStepInputSchema = lazy(() => object({
10585
10701
  addonId: string(),
10586
10702
  modelId: string(),
@@ -10649,7 +10765,7 @@ var PipelineRunResultBridge = custom$2();
10649
10765
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10650
10766
  kind: "mutation",
10651
10767
  auth: "admin"
10652
- }), method(_void(), record(string(), object({
10768
+ }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10653
10769
  modelId: string(),
10654
10770
  settings: record(string(), unknown()).readonly()
10655
10771
  }))), method(object({ steps: record(string(), object({
@@ -14331,9 +14447,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14331
14447
  limit: number().optional(),
14332
14448
  tags: record(string(), string()).optional()
14333
14449
  }), array(LogEntrySchema).readonly());
14334
- var StaticDirOutputSchema = object({ staticDir: string() });
14335
- var VersionOutputSchema = object({ version: string() });
14336
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
14337
14450
  /**
14338
14451
  * Zod schemas for persisted record types.
14339
14452
  *
@@ -15817,7 +15930,10 @@ var AgentAddonConfigSchema = object({
15817
15930
  modelId: string(),
15818
15931
  settings: record(string(), unknown()).readonly()
15819
15932
  });
15820
- var AgentPipelineSettingsSchema = object({ addonDefaults: record(string(), AgentAddonConfigSchema).readonly() });
15933
+ var AgentPipelineSettingsSchema = object({
15934
+ addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
15935
+ maxCameras: number().int().nonnegative().nullable().default(null)
15936
+ });
15821
15937
  var CameraPipelineForAgentSchema = object({
15822
15938
  steps: array(PipelineStepInputSchema).readonly(),
15823
15939
  audio: object({
@@ -15919,6 +16035,133 @@ var GlobalMetricsSchema = object({
15919
16035
  * capability providers.
15920
16036
  */
15921
16037
  var CapabilityBindingsSchema = record(string(), string());
16038
+ /** Source block — always present; derives from the stream catalog. */
16039
+ var CameraSourceStatusSchema = object({ streams: array(object({
16040
+ camStreamId: string(),
16041
+ codec: string(),
16042
+ width: number(),
16043
+ height: number(),
16044
+ fps: number(),
16045
+ kind: string()
16046
+ })).readonly() });
16047
+ /** Assignment block — always present (orchestrator-local, no remote call). */
16048
+ var CameraAssignmentStatusSchema = object({
16049
+ detectionNodeId: string().nullable(),
16050
+ decoderNodeId: string().nullable(),
16051
+ audioNodeId: string().nullable(),
16052
+ pinned: object({
16053
+ detection: boolean(),
16054
+ decoder: boolean(),
16055
+ audio: boolean()
16056
+ }),
16057
+ reasons: object({
16058
+ detection: string().optional(),
16059
+ decoder: string().optional(),
16060
+ audio: string().optional()
16061
+ })
16062
+ });
16063
+ /** Broker block — null when the broker stage is unreachable or inactive. */
16064
+ var CameraBrokerStatusSchema = object({
16065
+ profiles: array(object({
16066
+ profile: string(),
16067
+ status: string(),
16068
+ codec: string(),
16069
+ width: number(),
16070
+ height: number(),
16071
+ subscribers: number(),
16072
+ inFps: number(),
16073
+ outFps: number()
16074
+ })).readonly(),
16075
+ webrtcSessions: number(),
16076
+ rtspRestream: boolean()
16077
+ });
16078
+ /** Shared-memory ring statistics within the decoder block. */
16079
+ var CameraDecoderShmSchema = object({
16080
+ framesWritten: number(),
16081
+ getFrameHits: number(),
16082
+ getFrameMisses: number(),
16083
+ budgetMb: number()
16084
+ });
16085
+ /** Decoder block — null when the decoder stage is unreachable or inactive. */
16086
+ var CameraDecoderStatusSchema = object({
16087
+ nodeId: string(),
16088
+ formats: array(string()).readonly(),
16089
+ sessionCount: number(),
16090
+ shm: CameraDecoderShmSchema
16091
+ });
16092
+ /** Motion block — null when motion detection is not active for this device. */
16093
+ var CameraMotionStatusSchema = object({
16094
+ enabled: boolean(),
16095
+ fps: number()
16096
+ });
16097
+ /** Detection provisioning sub-block. */
16098
+ var CameraDetectionProvisioningSchema = object({
16099
+ state: _enum([
16100
+ "idle",
16101
+ "installing",
16102
+ "verifying",
16103
+ "ready",
16104
+ "failed"
16105
+ ]),
16106
+ error: string().optional()
16107
+ });
16108
+ /** Detection phase — derived from the runner's engine phase. */
16109
+ var CameraDetectionPhaseSchema = _enum([
16110
+ "idle",
16111
+ "watching",
16112
+ "active"
16113
+ ]);
16114
+ /** Detection block — null when no detection node is assigned or reachable. */
16115
+ var CameraDetectionStatusSchema = object({
16116
+ nodeId: string(),
16117
+ engine: object({
16118
+ backend: string(),
16119
+ device: string()
16120
+ }),
16121
+ phase: CameraDetectionPhaseSchema,
16122
+ configuredFps: number(),
16123
+ actualFps: number(),
16124
+ queueDepth: number(),
16125
+ avgInferenceMs: number(),
16126
+ provisioning: CameraDetectionProvisioningSchema
16127
+ });
16128
+ /** Audio block — null when no audio node is assigned or reachable. */
16129
+ var CameraAudioStatusSchema = object({
16130
+ nodeId: string(),
16131
+ enabled: boolean()
16132
+ });
16133
+ /** Recording block — null when no recording cap is active for this device. */
16134
+ var CameraRecordingStatusSchema = object({
16135
+ mode: _enum([
16136
+ "off",
16137
+ "continuous",
16138
+ "events"
16139
+ ]),
16140
+ active: boolean(),
16141
+ storageBytes: number()
16142
+ });
16143
+ /**
16144
+ * Aggregated per-camera pipeline status — server-composed, single call.
16145
+ *
16146
+ * The `assignment` and `source` blocks are always present.
16147
+ * Every other block is `null` when the stage is inactive or unreachable
16148
+ * during the bounded parallel fan-out in the orchestrator implementation.
16149
+ *
16150
+ * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
16151
+ */
16152
+ var CameraStatusSchema = object({
16153
+ deviceId: number(),
16154
+ assignment: CameraAssignmentStatusSchema,
16155
+ source: CameraSourceStatusSchema,
16156
+ broker: CameraBrokerStatusSchema.nullable(),
16157
+ decoder: CameraDecoderStatusSchema.nullable(),
16158
+ motion: CameraMotionStatusSchema.nullable(),
16159
+ detection: CameraDetectionStatusSchema.nullable(),
16160
+ audio: CameraAudioStatusSchema.nullable(),
16161
+ recording: CameraRecordingStatusSchema.nullable(),
16162
+ /** Unix timestamp (ms) when this snapshot was composed server-side. */
16163
+ fetchedAt: number()
16164
+ });
15922
16165
  method(object({
15923
16166
  deviceId: number(),
15924
16167
  agentNodeId: string()
@@ -15986,6 +16229,12 @@ method(object({
15986
16229
  }), {
15987
16230
  kind: "mutation",
15988
16231
  auth: "admin"
16232
+ }), method(object({
16233
+ agentNodeId: string(),
16234
+ maxCameras: number().int().nonnegative().nullable()
16235
+ }), object({ success: literal(true) }), {
16236
+ kind: "mutation",
16237
+ auth: "admin"
15989
16238
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
15990
16239
  deviceId: number(),
15991
16240
  addonId: string(),
@@ -16011,7 +16260,7 @@ method(object({
16011
16260
  }), method(object({
16012
16261
  deviceId: number(),
16013
16262
  agentNodeId: string().optional()
16014
- }), CameraPipelineConfigSchema), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
16263
+ }), CameraPipelineConfigSchema), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
16015
16264
  name: string(),
16016
16265
  description: string().optional(),
16017
16266
  config: CameraPipelineConfigSchema
@@ -16498,7 +16747,7 @@ method(object({
16498
16747
  }), _void(), {
16499
16748
  kind: "mutation",
16500
16749
  auth: "admin"
16501
- }), 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({
16750
+ }), 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({
16502
16751
  deviceId: number(),
16503
16752
  values: record(string(), unknown())
16504
16753
  }), object({ success: literal(true) }), {
@@ -17223,7 +17472,20 @@ var DiskSpaceInfoSchema = object({
17223
17472
  var PidResourceStatsSchema = object({
17224
17473
  pid: number(),
17225
17474
  cpu: number(),
17226
- memory: number()
17475
+ memory: number(),
17476
+ /**
17477
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
17478
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
17479
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
17480
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
17481
+ * Undefined where /proc is unavailable (e.g. macOS).
17482
+ */
17483
+ privateBytes: number().optional(),
17484
+ /**
17485
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
17486
+ * code shared copy-on-write across runners. Undefined on macOS.
17487
+ */
17488
+ sharedBytes: number().optional()
17227
17489
  });
17228
17490
  var AddonInstanceSchema = object({
17229
17491
  addonId: string(),
@@ -17272,6 +17534,17 @@ var KillProcessResultSchema = object({
17272
17534
  reason: string().optional(),
17273
17535
  signal: _enum(["SIGTERM", "SIGKILL"]).optional()
17274
17536
  });
17537
+ var DumpHeapSnapshotInputSchema = object({
17538
+ /** The addon whose runner should dump a heap snapshot. */
17539
+ addonId: string() });
17540
+ var DumpHeapSnapshotResultSchema = object({
17541
+ success: boolean(),
17542
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
17543
+ path: string().optional(),
17544
+ /** Process pid that was signalled. */
17545
+ pid: number().optional(),
17546
+ reason: string().optional()
17547
+ });
17275
17548
  var SystemMetricsSchema = object({
17276
17549
  cpuPercent: number(),
17277
17550
  memoryPercent: number(),
@@ -17285,6 +17558,9 @@ var SystemMetricsSchema = object({
17285
17558
  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, {
17286
17559
  kind: "mutation",
17287
17560
  auth: "admin"
17561
+ }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
17562
+ kind: "mutation",
17563
+ auth: "admin"
17288
17564
  });
17289
17565
  var PtzPresetSchema = object({
17290
17566
  id: string(),
@@ -17693,63 +17969,6 @@ method(object({
17693
17969
  auth: "admin"
17694
17970
  });
17695
17971
  /**
17696
- * device-ops — device-scoped cap that unifies the per-IDevice operations
17697
- * previously routed through the `.device-ops` Moleculer bridge service.
17698
- *
17699
- * Each worker that hosts live `IDevice` instances auto-registers a native
17700
- * provider for this cap (per device) backed by its local
17701
- * `DeviceRegistry`. Hub-side callers reach it transparently through
17702
- * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
17703
- * `deviceId` + `nodeId` and dispatches through the standard cap-router,
17704
- * so there's no parallel bridge path anymore.
17705
- *
17706
- * The surface is intentionally small — every method corresponds to a
17707
- * single action on the live `IDevice` (or `ICameraDevice` for
17708
- * `getStreamSources`). Richer orchestration (enable/disable with
17709
- * integration plumbing, bulk updates) stays in the `device-manager` cap;
17710
- * `device-ops` is the per-device primitive the device-manager routes to.
17711
- */
17712
- var StreamSourceEntrySchema$1 = object({
17713
- id: string(),
17714
- label: string(),
17715
- protocol: _enum([
17716
- "rtsp",
17717
- "rtmp",
17718
- "annexb",
17719
- "http-mjpeg",
17720
- "webrtc",
17721
- "custom"
17722
- ]),
17723
- url: string().optional(),
17724
- resolution: object({
17725
- width: number(),
17726
- height: number()
17727
- }).optional(),
17728
- fps: number().optional(),
17729
- bitrate: number().optional(),
17730
- codec: string().optional(),
17731
- profileHint: CamProfileSchema.optional(),
17732
- sdp: string().optional()
17733
- });
17734
- var ConfigEntrySchema$1 = object({
17735
- key: string(),
17736
- value: unknown()
17737
- });
17738
- var RawStateResultSchema = object({
17739
- /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
17740
- source: string(),
17741
- /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
17742
- data: record(string(), unknown())
17743
- });
17744
- method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
17745
- deviceId: number(),
17746
- values: record(string(), unknown())
17747
- }), _void(), { kind: "mutation" }), method(object({
17748
- deviceId: number(),
17749
- action: string().min(1),
17750
- input: unknown()
17751
- }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
17752
- /**
17753
17972
  * camera-credentials — device-scoped cap exposing the camera's network
17754
17973
  * + auth surface in a vendor-neutral shape.
17755
17974
  *
@@ -21719,6 +21938,12 @@ Object.freeze({
21719
21938
  addonId: null,
21720
21939
  access: "view"
21721
21940
  },
21941
+ "metricsProvider.dumpHeapSnapshot": {
21942
+ capName: "metrics-provider",
21943
+ capScope: "system",
21944
+ addonId: null,
21945
+ access: "create"
21946
+ },
21722
21947
  "metricsProvider.getAddonStats": {
21723
21948
  capName: "metrics-provider",
21724
21949
  capScope: "system",
@@ -22175,6 +22400,12 @@ Object.freeze({
22175
22400
  addonId: null,
22176
22401
  access: "view"
22177
22402
  },
22403
+ "pipelineExecutor.getEngineProvisioning": {
22404
+ capName: "pipeline-executor",
22405
+ capScope: "system",
22406
+ addonId: null,
22407
+ access: "view"
22408
+ },
22178
22409
  "pipelineExecutor.getGlobalPipelineConfig": {
22179
22410
  capName: "pipeline-executor",
22180
22411
  capScope: "system",
@@ -22379,6 +22610,18 @@ Object.freeze({
22379
22610
  addonId: null,
22380
22611
  access: "view"
22381
22612
  },
22613
+ "pipelineOrchestrator.getCameraStatus": {
22614
+ capName: "pipeline-orchestrator",
22615
+ capScope: "system",
22616
+ addonId: null,
22617
+ access: "view"
22618
+ },
22619
+ "pipelineOrchestrator.getCameraStatuses": {
22620
+ capName: "pipeline-orchestrator",
22621
+ capScope: "system",
22622
+ addonId: null,
22623
+ access: "view"
22624
+ },
22382
22625
  "pipelineOrchestrator.getCameraStepOverrides": {
22383
22626
  capName: "pipeline-orchestrator",
22384
22627
  capScope: "system",
@@ -22463,6 +22706,12 @@ Object.freeze({
22463
22706
  addonId: null,
22464
22707
  access: "create"
22465
22708
  },
22709
+ "pipelineOrchestrator.setAgentMaxCameras": {
22710
+ capName: "pipeline-orchestrator",
22711
+ capScope: "system",
22712
+ addonId: null,
22713
+ access: "create"
22714
+ },
22466
22715
  "pipelineOrchestrator.setCameraPipelineForAgent": {
22467
22716
  capName: "pipeline-orchestrator",
22468
22717
  capScope: "system",
@@ -23962,30 +24211,6 @@ object({
23962
24211
  bootAttempts: number(),
23963
24212
  schemaVersion: literal(1)
23964
24213
  });
23965
- /**
23966
- * Promise-based timer helpers — used everywhere the codebase needs to
23967
- * wait, back off, or schedule a retry. Before these helpers landed, each
23968
- * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
23969
- * with subtle variations (some swallowing cancellation, some not). Two
23970
- * shapes cover every observed use case:
23971
- *
23972
- * - {@link sleep} for a plain, uncancellable wait — the default choice.
23973
- * - {@link sleepCancellable} for a wait that wakes early when an
23974
- * abort signal trips, used by long-running pollers whose teardown
23975
- * must stop a pending backoff promptly.
23976
- */
23977
- /**
23978
- * Resolve after `ms` milliseconds. Never rejects, never cancels. The
23979
- * sleep cannot be interrupted; for a wakeable variant use
23980
- * {@link sleepCancellable}.
23981
- *
23982
- * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
23983
- * still gives the event loop a chance to drain — useful for breaking
23984
- * up tight async loops without changing call-site semantics.
23985
- */
23986
- function sleep$1(ms) {
23987
- return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
23988
- }
23989
24214
  //#endregion
23990
24215
  //#region ../../node_modules/undici/lib/core/symbols.js
23991
24216
  var require_symbols = /* @__PURE__ */ __commonJSMin(((exports, module) => {