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