@camstack/addon-provider-hikvision 1.0.5 → 1.0.7

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