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