@camstack/addon-provider-onvif 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 +1111 -1074
  2. package/dist/addon.mjs +1111 -1074
  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();
@@ -6010,7 +5954,7 @@ var ProfileSlotSchema = object({
6010
5954
  * Zod schema for StreamSourceEntry — the canonical stream descriptor
6011
5955
  * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
6012
5956
  */
6013
- var StreamSourceEntrySchema = object({
5957
+ var StreamSourceEntrySchema$1 = object({
6014
5958
  id: string(),
6015
5959
  label: string(),
6016
5960
  protocol: _enum([
@@ -6232,904 +6176,1092 @@ var ProfileRtspEntrySchema = object({
6232
6176
  codec: string().optional(),
6233
6177
  resolution: CamStreamResolutionSchema.optional()
6234
6178
  });
6235
- /**
6236
- * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6237
- * Named `RecordingWeekday` to avoid collision with the string-union
6238
- * `Weekday` exported from `interfaces/timezones.ts`.
6239
- */
6240
- var RecordingWeekdaySchema = number().int().min(0).max(6);
6241
- var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6242
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6243
- kind: literal("timeOfDay"),
6244
- start: string().regex(HHMM),
6245
- end: string().regex(HHMM),
6246
- /** Restrict to these weekdays; omit = every day. */
6247
- days: array(RecordingWeekdaySchema).optional()
6248
- })]);
6249
- var RecordingModeSchema = _enum([
6250
- "continuous",
6251
- "onMotion",
6252
- "onAudioThreshold"
6253
- ]);
6254
- /**
6255
- * First-class, authoritative per-camera storage mode the netta choice the UI
6256
- * reads directly (never inferred from `rules`):
6257
- * - `off` not recording.
6258
- * - `events` — record only around triggers (motion / audio threshold),
6259
- * with pre/post-buffer.
6260
- * - `continuous` record 24/7 within the schedule.
6261
- *
6262
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6263
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6264
- */
6265
- var RecordingStorageModeSchema = _enum([
6266
- "off",
6267
- "events",
6268
- "continuous"
6269
- ]);
6270
- /** Which detectors trigger an `events`-mode recording. */
6271
- var RecordingTriggersSchema = object({
6272
- motion: boolean().optional(),
6273
- audioThresholdDbfs: number().optional()
6274
- });
6275
- /**
6276
- * Mode of a single recording band the recorder per-band vocabulary.
6277
- *
6278
- * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6279
- * only ever `continuous` or `events`; "off" is expressed by the absence of a
6280
- * covering band, not by a band value.
6281
- */
6282
- var RecordingBandModeSchema = _enum(["continuous", "events"]);
6283
- /**
6284
- * Triggers for an `events`-mode band. Identical shape to
6285
- * `RecordingTriggersSchema`reuse that schema as the band trigger type so the
6286
- * two never drift.
6287
- */
6288
- var RecordingBandTriggersSchema = RecordingTriggersSchema;
6289
- /**
6290
- * A single mode-per-band window the canonical recorder band shape, the
6291
- * single source of truth re-used by `addon-pipeline/recorder`.
6292
- *
6293
- * `days` lists the weekdays the band covers (empty = every day, matching the
6294
- * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6295
- * span wraps past midnight (handled by the band engine).
6296
- */
6297
- var RecordingBandSchema = object({
6298
- days: array(RecordingWeekdaySchema),
6299
- start: string().regex(HHMM),
6300
- end: string().regex(HHMM),
6301
- mode: RecordingBandModeSchema,
6302
- triggers: RecordingBandTriggersSchema.optional(),
6303
- preBufferSec: number().min(0).optional(),
6304
- postBufferSec: number().min(0).optional()
6305
- });
6306
- var RecordingRuleSchema = object({
6307
- schedule: RecordingScheduleSchema,
6308
- mode: RecordingModeSchema,
6309
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6310
- preBufferSec: number().min(0).default(0),
6311
- /** Keep recording until this many seconds after the last trigger. */
6312
- postBufferSec: number().min(0).default(0),
6313
- /** Each new trigger restarts the post-buffer window. */
6314
- resetTimeoutOnNewEvent: boolean().default(true),
6315
- /** onAudioThreshold only dBFS level that counts as a trigger. */
6316
- thresholdDbfs: number().optional()
6317
- });
6318
- /**
6319
- * Per-device retention overrides. Every field is optional; an unset or `0`
6320
- * value inherits the node-wide recorder default. Only footage-lifetime limits
6321
- * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6322
- * (when the volume is too full to keep recording) is NOT a per-camera concern —
6323
- * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6324
- * shared by every camera writing to that volume.
6325
- */
6326
- var RecordingRetentionSchema = object({
6327
- maxAgeDays: number().min(0).optional(),
6328
- maxSizeGb: number().min(0).optional()
6329
- });
6330
- /**
6331
- * The full per-camera recording intent — the wire shape of a RecordingTarget.
6332
- *
6333
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6334
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6335
- * only for transition + migration (`migrateRulesToMode`); the policy engine
6336
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6337
- */
6338
- var RecordingConfigSchema = object({
6339
- enabled: boolean(),
6340
- /** Authoritative storage mode. Absent on legacy targets → derived once via
6341
- * `migrateRulesToMode`, then persisted. */
6342
- mode: RecordingStorageModeSchema.optional(),
6343
- profiles: array(CamProfileSchema).optional(),
6344
- segmentSeconds: number().int().positive().optional(),
6345
- /** Shared recording time-bands for `events` & `continuous` — record only when
6346
- * the wall-clock falls inside one of these windows. Omit or empty = always.
6347
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
6348
- schedules: array(RecordingScheduleSchema).optional(),
6349
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6350
- * normalized into `schedules` on read and never written going forward. (Not
6351
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6352
- schedule: RecordingScheduleSchema.optional(),
6353
- /** `events`-mode only — which detectors trigger a recording. */
6354
- triggers: RecordingTriggersSchema.optional(),
6355
- /** `events`-mode only — seconds retained before / after a trigger. */
6356
- preBufferSec: number().min(0).optional(),
6357
- postBufferSec: number().min(0).optional(),
6358
- /** DEPRECATED authoring input; retained for migration/transition. */
6359
- rules: array(RecordingRuleSchema).optional(),
6360
- /**
6361
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6362
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6363
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6364
- * derived into bands once via `migrateConfigToBands`.
6365
- */
6366
- bands: array(RecordingBandSchema).optional(),
6367
- retention: RecordingRetentionSchema.optional()
6368
- });
6369
- /**
6370
- * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6371
- * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6372
- * so the persisted record schema and the consumer-facing cap can both consume it
6373
- * without forming a circular import. The `storage` cap re-exports it
6374
- * verbatim for back-compat.
6375
- *
6376
- * This Zod schema is the **authoritative source** for `StorageLocationType`.
6377
- * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6378
- * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6379
- * `IStorageProvider` interface stay in lockstep.
6380
- *
6381
- * The type is now an **open string** (not a closed enum) — addons declare
6382
- * their own location kinds via `StorageLocationDeclaration.id`. The regex
6383
- * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6384
- */
6385
- var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6386
- /**
6387
- * Persisted record for a storage location instance. Operators can register
6388
- * multiple instances for multi-cardinality types (e.g. two `backups`
6389
- * locations with different `providerId`s). Cardinality is now declared per
6390
- * location via `StorageLocationDeclaration.cardinality` — the static
6391
- * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6392
- *
6393
- * `id` is a stable namespaced string of the form `<type>:<slug>`.
6394
- * The default location for a type uses `id === <type>:default` by
6395
- * convention (the bare type ref like `'backups'` resolves to it).
6396
- *
6397
- * `isSystem: true` marks a location as orchestrator-seeded and
6398
- * undeletable. The bootstrap-installed defaults (one per type) carry
6399
- * this flag; operator-added locations don't. Editing the config of
6400
- * a system location is allowed (path migration, provider swap) but
6401
- * deleting it is rejected at the cap level.
6402
- */
6403
- var StorageLocationSchema = object({
6404
- id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6405
- type: string(),
6406
- displayName: string().min(1),
6407
- providerId: string().min(1),
6408
- config: record(string(), unknown()),
6409
- /**
6410
- * Cluster node this location physically lives on. REQUIRED for node-local
6411
- * providers (filesystem — the path exists on one node's disk), null/absent
6412
- * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6413
- * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6414
- * flag at upsert time, not here (the schema is provider-agnostic).
6415
- */
6416
- nodeId: string().optional(),
6417
- isDefault: boolean().default(false),
6418
- isSystem: boolean().default(false),
6419
- createdAt: number(),
6420
- updatedAt: number()
6421
- });
6422
- /**
6423
- * Reference accepted by consumer-facing `api.storage.*` calls.
6424
- * Either:
6425
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
6426
- * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
6427
- *
6428
- * The orchestrator's `resolveRef(ref)` handles both cases.
6429
- */
6430
- var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6431
- /**
6432
- * `StorageLocationDeclaration` — a single storage-location entry declared by
6433
- * an addon in its `package.json` under `camstack.storageLocations`.
6434
- *
6435
- * Design intent:
6436
- * - **Addon declares its needs** — each addon describes the logical storage
6437
- * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6438
- * about the physical path.
6439
- * - **Kernel aggregates** — at boot the kernel collects declarations from all
6440
- * installed addons, deduplicates by `id`, and exposes the union via the
6441
- * storage-locations settings surface.
6442
- * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6443
- * at least one instance named `<id>:default` is present, using
6444
- * `defaultsTo` to inherit the resolved root from another location when the
6445
- * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6446
- * `recordings`).
6447
- * - **ids are global** — `id` values are shared across the entire deployment;
6448
- * two addons declaring the same `id` must agree on `cardinality` (validated
6449
- * at kernel aggregation time, not here).
6450
- */
6451
- var StorageLocationDeclarationSchema = object({
6452
- /**
6453
- * Global location identifier, e.g. `recordings` or `recordingsLow`.
6454
- * Must start with a lowercase letter and may contain letters, digits, and
6455
- * hyphens.
6456
- */
6457
- id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6458
- /** Human-readable name shown in the admin UI. */
6459
- displayName: string().min(1, { message: "displayName must not be empty" }),
6460
- /** Optional longer explanation of what data this location stores. */
6461
- description: string().optional(),
6462
- /**
6463
- * `single` — exactly one instance of this location is allowed system-wide
6464
- * (e.g. `logs`, `models`). The operator can edit it but not add more.
6465
- * `multi` — the operator may register several instances (e.g. a second
6466
- * `recordings` on a NAS for disk tiering); one is the default at any time.
6467
- */
6468
- cardinality: _enum(["single", "multi"]),
6469
- /**
6470
- * When set, the default instance for this location inherits its resolved
6471
- * root from the named location's default instance. Useful for derivative
6472
- * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6473
- * configure the primary location.
6474
- */
6475
- defaultsTo: string().optional()
6476
- });
6477
- var DecoderStatsSchema = object({
6478
- inputFps: number(),
6479
- outputFps: number(),
6480
- avgDecodeTimeMs: number(),
6481
- droppedFrames: number()
6482
- });
6483
- var DecoderSessionConfigSchema = object({
6484
- codec: string(),
6485
- maxFps: number().default(0),
6486
- outputFormat: _enum([
6487
- "jpeg",
6488
- "rgb",
6489
- "bgr",
6490
- "yuv420",
6491
- "gray"
6492
- ]).default("jpeg"),
6493
- scale: number().default(1),
6494
- width: number().optional(),
6495
- height: number().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";
6496
6262
  /**
6497
- * Identifier of the camera this decoder session serves. Optional
6498
- * because the cap is generic (any caller could request decode), but
6499
- * stream-broker passes it so decoder logs include `deviceId` for
6500
- * per-camera filtering when diagnosing failures (e.g. node-av
6501
- * sendPacket errors on a single hung camera).
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.
6502
6266
  */
6503
- deviceId: number().int().nonnegative().optional(),
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";
6504
6272
  /**
6505
- * Free-form tag for log scoping. Stream-broker uses
6506
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6507
- * on every line so `grep tag=broker:5/high` filters one camera
6508
- * profile cleanly.
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.
6509
6280
  */
6510
- tag: string().optional(),
6281
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6511
6282
  /**
6512
- * Where the session delivers decoded frames (Phase 5 / D9):
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, ...)`.
6513
6287
  *
6514
- * - `'callback'` (default) the legacy pixel path: decoded frames are
6515
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
6516
- * - `'shm'` the shared-memory frame plane: decoded frames are written
6517
- * into an OS shared-memory ring and drained as zero-pixel
6518
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
6519
- * other — `pullFrames` returns nothing for an `'shm'` session and
6520
- * `pullHandles` returns nothing for a `'callback'` session.
6521
- */
6522
- frameSink: _enum(["callback", "shm"]).default("callback")
6523
- });
6524
- var EncodeProfileSchema = object({
6525
- video: object({
6526
- codec: _enum([
6527
- "h264",
6528
- "h265",
6529
- "copy"
6530
- ]),
6531
- profile: _enum([
6532
- "baseline",
6533
- "main",
6534
- "high"
6535
- ]).optional(),
6536
- width: number().int().positive().optional(),
6537
- height: number().int().positive().optional(),
6538
- fps: number().positive().optional(),
6539
- bitrateKbps: number().int().positive().optional(),
6540
- gopFrames: number().int().positive().optional(),
6541
- bf: number().int().min(0).optional(),
6542
- preset: _enum([
6543
- "ultrafast",
6544
- "superfast",
6545
- "veryfast",
6546
- "faster",
6547
- "fast",
6548
- "medium"
6549
- ]).optional(),
6550
- tune: _enum([
6551
- "zerolatency",
6552
- "film",
6553
- "animation"
6554
- ]).optional()
6555
- }),
6556
- audio: union([literal("passthrough"), object({
6557
- codec: _enum([
6558
- "opus",
6559
- "aac",
6560
- "pcmu",
6561
- "pcma",
6562
- "copy"
6563
- ]),
6564
- bitrateKbps: number().int().positive().optional(),
6565
- sampleRateHz: number().int().positive().optional(),
6566
- channels: union([literal(1), literal(2)]).optional()
6567
- })]),
6568
- /**
6569
- * ffmpeg input-side args, inserted between the fixed global flags
6570
- * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6571
- * — the widget surfaces a textarea + suggestion chips for the most-
6572
- * used demuxer/format options.
6573
- */
6574
- inputArgs: array(string()).optional(),
6575
- /**
6576
- * ffmpeg output-side args, inserted between the encode block and
6577
- * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6578
- * filters, codec-specific overrides. Free-text array.
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".
6579
6291
  */
6580
- outputArgs: array(string()).optional()
6581
- });
6582
- /**
6583
- import { errMsg } from '@camstack/types'
6584
- * Extract a human-readable message from an unknown error value.
6585
- * Replaces the ubiquitous `errMsg(err)` pattern.
6586
- */
6587
- function errMsg(err) {
6588
- if (err instanceof Error) return err.message;
6589
- if (typeof err === "string") return err;
6590
- return String(err);
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
+ }({});
6376
+ /**
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.
6383
+ *
6384
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
6385
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
6386
+ */
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
+ }({});
6455
+ /**
6456
+ * Generic types for capability definitions.
6457
+ *
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
6467
+ */
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(),
6484
+ description: string().optional(),
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())
6497
+ });
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
+ };
6591
6522
  }
6592
- var YAMNET_TO_MACRO = {
6593
- mapping: {
6594
- Speech: "speech",
6595
- "Child speech, kid speaking": "speech",
6596
- Conversation: "speech",
6597
- "Narration, monologue": "speech",
6598
- Babbling: "speech",
6599
- Whispering: "speech",
6600
- "Speech synthesizer": "speech",
6601
- Humming: "speech",
6602
- Rapping: "speech",
6603
- Singing: "speech",
6604
- Choir: "speech",
6605
- "Child singing": "speech",
6606
- Shout: "scream",
6607
- Bellow: "scream",
6608
- Yell: "scream",
6609
- Screaming: "scream",
6610
- "Children shouting": "scream",
6611
- Whoop: "scream",
6612
- "Crying, sobbing": "crying",
6613
- "Baby cry, infant cry": "crying",
6614
- Whimper: "crying",
6615
- "Wail, moan": "crying",
6616
- Groan: "crying",
6617
- Laughter: "laughter",
6618
- "Baby laughter": "laughter",
6619
- Giggle: "laughter",
6620
- Snicker: "laughter",
6621
- "Belly laugh": "laughter",
6622
- "Chuckle, chortle": "laughter",
6623
- Music: "music",
6624
- "Musical instrument": "music",
6625
- Guitar: "music",
6626
- Piano: "music",
6627
- Drum: "music",
6628
- "Drum kit": "music",
6629
- "Violin, fiddle": "music",
6630
- Flute: "music",
6631
- Saxophone: "music",
6632
- Trumpet: "music",
6633
- Synthesizer: "music",
6634
- "Pop music": "music",
6635
- "Rock music": "music",
6636
- "Hip hop music": "music",
6637
- "Classical music": "music",
6638
- Jazz: "music",
6639
- "Electronic music": "music",
6640
- "Background music": "music",
6641
- Dog: "dog",
6642
- Bark: "dog",
6643
- Yip: "dog",
6644
- Howl: "dog",
6645
- "Bow-wow": "dog",
6646
- Growling: "dog",
6647
- "Whimper (dog)": "dog",
6648
- Cat: "cat",
6649
- Purr: "cat",
6650
- Meow: "cat",
6651
- Hiss: "cat",
6652
- Caterwaul: "cat",
6653
- Bird: "bird",
6654
- "Bird vocalization, bird call, bird song": "bird",
6655
- "Chirp, tweet": "bird",
6656
- Squawk: "bird",
6657
- Crow: "bird",
6658
- Owl: "bird",
6659
- "Pigeon, dove": "bird",
6660
- Animal: "animal",
6661
- "Domestic animals, pets": "animal",
6662
- "Livestock, farm animals, working animals": "animal",
6663
- Horse: "animal",
6664
- "Cattle, bovinae": "animal",
6665
- Pig: "animal",
6666
- Sheep: "animal",
6667
- Goat: "animal",
6668
- Frog: "animal",
6669
- Insect: "animal",
6670
- Cricket: "animal",
6671
- Alarm: "alarm",
6672
- "Alarm clock": "alarm",
6673
- "Smoke detector, smoke alarm": "alarm",
6674
- "Fire alarm": "alarm",
6675
- Buzzer: "alarm",
6676
- "Civil defense siren": "alarm",
6677
- "Car alarm": "alarm",
6678
- Siren: "siren",
6679
- "Police car (siren)": "siren",
6680
- "Ambulance (siren)": "siren",
6681
- "Fire engine, fire truck (siren)": "siren",
6682
- "Emergency vehicle": "siren",
6683
- Foghorn: "siren",
6684
- Doorbell: "doorbell",
6685
- "Ding-dong": "doorbell",
6686
- Knock: "doorbell",
6687
- Tap: "doorbell",
6688
- Glass: "glass_breaking",
6689
- Shatter: "glass_breaking",
6690
- "Chink, clink": "glass_breaking",
6691
- "Gunshot, gunfire": "gunshot",
6692
- "Machine gun": "gunshot",
6693
- Explosion: "gunshot",
6694
- Fireworks: "gunshot",
6695
- Firecracker: "gunshot",
6696
- "Artillery fire": "gunshot",
6697
- "Cap gun": "gunshot",
6698
- Boom: "gunshot",
6699
- Vehicle: "vehicle",
6700
- Car: "vehicle",
6701
- Truck: "vehicle",
6702
- Bus: "vehicle",
6703
- Motorcycle: "vehicle",
6704
- "Car passing by": "vehicle",
6705
- "Vehicle horn, car horn, honking": "vehicle",
6706
- "Traffic noise, roadway noise": "vehicle",
6707
- Train: "vehicle",
6708
- Aircraft: "vehicle",
6709
- Helicopter: "vehicle",
6710
- Bicycle: "vehicle",
6711
- Skateboard: "vehicle",
6712
- Fire: "fire",
6713
- Crackle: "fire",
6714
- Water: "water",
6715
- Rain: "water",
6716
- Raindrop: "water",
6717
- "Rain on surface": "water",
6718
- Stream: "water",
6719
- Waterfall: "water",
6720
- Ocean: "water",
6721
- "Waves, surf": "water",
6722
- "Splash, splatter": "water",
6723
- Wind: "wind",
6724
- Thunderstorm: "wind",
6725
- Thunder: "wind",
6726
- "Wind noise (microphone)": "wind",
6727
- "Rustling leaves": "wind",
6728
- Door: "door",
6729
- "Sliding door": "door",
6730
- Slam: "door",
6731
- "Cupboard open or close": "door",
6732
- "Walk, footsteps": "footsteps",
6733
- Run: "footsteps",
6734
- Shuffle: "footsteps",
6735
- Crowd: "crowd",
6736
- Chatter: "crowd",
6737
- Cheering: "crowd",
6738
- Applause: "crowd",
6739
- "Children playing": "crowd",
6740
- "Hubbub, speech noise, speech babble": "crowd",
6741
- Telephone: "telephone",
6742
- "Telephone bell ringing": "telephone",
6743
- Ringtone: "telephone",
6744
- "Telephone dialing, DTMF": "telephone",
6745
- "Busy signal": "telephone",
6746
- Engine: "engine",
6747
- "Engine starting": "engine",
6748
- Idling: "engine",
6749
- "Accelerating, revving, vroom": "engine",
6750
- "Light engine (high frequency)": "engine",
6751
- "Medium engine (mid frequency)": "engine",
6752
- "Heavy engine (low frequency)": "engine",
6753
- "Lawn mower": "engine",
6754
- Chainsaw: "engine",
6755
- Hammer: "tools",
6756
- Jackhammer: "tools",
6757
- Sawing: "tools",
6758
- "Power tool": "tools",
6759
- Drill: "tools",
6760
- Sanding: "tools",
6761
- Silence: "silence"
6762
- },
6763
- preserveOriginal: false
6764
- };
6765
- var APPLE_SA_TO_MACRO = {
6766
- mapping: {
6767
- speech: "speech",
6768
- child_speech: "speech",
6769
- conversation: "speech",
6770
- whispering: "speech",
6771
- singing: "speech",
6772
- humming: "speech",
6773
- shout: "scream",
6774
- yell: "scream",
6775
- screaming: "scream",
6776
- crying: "crying",
6777
- baby_crying: "crying",
6778
- sobbing: "crying",
6779
- laughter: "laughter",
6780
- baby_laughter: "laughter",
6781
- giggling: "laughter",
6782
- music: "music",
6783
- guitar: "music",
6784
- piano: "music",
6785
- drums: "music",
6786
- dog_bark: "dog",
6787
- dog_bow_wow: "dog",
6788
- dog_growling: "dog",
6789
- dog_howl: "dog",
6790
- cat_meow: "cat",
6791
- cat_purr: "cat",
6792
- cat_hiss: "cat",
6793
- bird: "bird",
6794
- bird_chirp: "bird",
6795
- bird_squawk: "bird",
6796
- animal: "animal",
6797
- horse: "animal",
6798
- cow_moo: "animal",
6799
- insect: "animal",
6800
- alarm: "alarm",
6801
- smoke_alarm: "alarm",
6802
- fire_alarm: "alarm",
6803
- car_alarm: "alarm",
6804
- siren: "siren",
6805
- police_siren: "siren",
6806
- ambulance_siren: "siren",
6807
- doorbell: "doorbell",
6808
- door_knock: "doorbell",
6809
- knocking: "doorbell",
6810
- glass_breaking: "glass_breaking",
6811
- glass_shatter: "glass_breaking",
6812
- gunshot: "gunshot",
6813
- explosion: "gunshot",
6814
- fireworks: "gunshot",
6815
- car: "vehicle",
6816
- truck: "vehicle",
6817
- motorcycle: "vehicle",
6818
- car_horn: "vehicle",
6819
- vehicle_horn: "vehicle",
6820
- traffic: "vehicle",
6821
- fire: "fire",
6822
- fire_crackle: "fire",
6823
- water: "water",
6824
- rain: "water",
6825
- ocean: "water",
6826
- splash: "water",
6827
- wind: "wind",
6828
- thunder: "wind",
6829
- thunderstorm: "wind",
6830
- door: "door",
6831
- door_slam: "door",
6832
- sliding_door: "door",
6833
- footsteps: "footsteps",
6834
- walking: "footsteps",
6835
- running: "footsteps",
6836
- crowd: "crowd",
6837
- chatter: "crowd",
6838
- cheering: "crowd",
6839
- applause: "crowd",
6840
- telephone_ring: "telephone",
6841
- ringtone: "telephone",
6842
- engine: "engine",
6843
- engine_starting: "engine",
6844
- lawn_mower: "engine",
6845
- chainsaw: "engine",
6846
- hammer: "tools",
6847
- jackhammer: "tools",
6848
- drill: "tools",
6849
- power_tool: "tools",
6850
- silence: "silence"
6851
- },
6852
- preserveOriginal: false
6853
- };
6854
- var _macroLookup = /* @__PURE__ */ new Map();
6855
- for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
6856
- for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
6857
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
6858
- DeviceType["Camera"] = "camera";
6859
- DeviceType["Hub"] = "hub";
6860
- DeviceType["Light"] = "light";
6861
- DeviceType["Siren"] = "siren";
6862
- DeviceType["Switch"] = "switch";
6863
- DeviceType["Sensor"] = "sensor";
6864
- DeviceType["Thermostat"] = "thermostat";
6865
- DeviceType["Button"] = "button";
6866
- /** Generic stateless event emitter — carries a device's EXACT declared
6867
- * event vocabulary verbatim (no normalization). Installed with the
6868
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6869
- * HA bus events (e.g. `zha_event`, generic). */
6870
- DeviceType["EventEmitter"] = "event-emitter";
6871
- /** Firmware/software update entity — current vs available version,
6872
- * updatable flag, update state, and an install action. Installed with
6873
- * the `update` cap. Sources: Homematic firmware-update channels (and
6874
- * reusable by other providers, e.g. HA `update.*` entities). */
6875
- DeviceType["Update"] = "update";
6876
- DeviceType["Generic"] = "generic";
6877
- /** Generic notification delivery target (HA `notify.<service>`, future
6878
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6879
- * endpoint; the `notifier` cap defines the send surface. */
6880
- DeviceType["Notifier"] = "notifier";
6881
- /** Pre-recorded action sequence with optional parameters
6882
- * (HA `script.*`). Runnable via `script-runner` cap. */
6883
- DeviceType["Script"] = "script";
6884
- /** Automation rule (HA `automation.*`) enable/disable + manual
6885
- * trigger surface exposed via `automation-control` cap. */
6886
- DeviceType["Automation"] = "automation";
6887
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6888
- DeviceType["Lock"] = "lock";
6889
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6890
- * `valve.*`). `cover` cap with sub-roles for variant. */
6891
- DeviceType["Cover"] = "cover";
6892
- /** Pipe / water / gas valve with open/close/stop and optional
6893
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6894
- * modelled on the same open/closed lifecycle. */
6895
- DeviceType["Valve"] = "valve";
6896
- /** Humidifier / dehumidifier with on/off + target humidity + mode
6897
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6898
- * modelled on the same target / mode lifecycle. */
6899
- DeviceType["Humidifier"] = "humidifier";
6900
- /** Water heater / boiler with target temperature + operation mode +
6901
- * away mode (HA `water_heater.*`). `water-heater` cap — a
6902
- * climate-family actuator. */
6903
- DeviceType["WaterHeater"] = "water-heater";
6904
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6905
- DeviceType["Fan"] = "fan";
6906
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6907
- * the camera surface — those use `Camera`. `media-player` cap. */
6908
- DeviceType["MediaPlayer"] = "media-player";
6909
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
6910
- * `alarm-panel` cap. */
6911
- DeviceType["AlarmPanel"] = "alarm-panel";
6912
- /** Generic user-settable input (HA `number` / `input_number` / `select`
6913
- * / `input_select` / `text` / `input_text` / `input_datetime`).
6914
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6915
- * TextControl / DateTimeControl. */
6916
- DeviceType["Control"] = "control";
6917
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6918
- * `presence` cap. */
6919
- DeviceType["Presence"] = "presence";
6920
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6921
- * `weather` cap. */
6922
- DeviceType["Weather"] = "weather";
6923
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6924
- DeviceType["Vacuum"] = "vacuum";
6925
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6926
- * `lawn-mower-control` cap. */
6927
- DeviceType["LawnMower"] = "lawn-mower";
6928
- /** Physical HA device group — parent container for entity-children
6929
- * adopted from a single HA device entry. Not renderable as a
6930
- * standalone device; exists only to anchor child entities. */
6931
- DeviceType["Container"] = "container";
6932
- /** Single still-image entity (HA `image.*`). Read-only display of an
6933
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
6934
- DeviceType["Image"] = "image";
6935
- return DeviceType;
6936
- }({});
6937
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6938
- DeviceFeature["BatteryOperated"] = "battery-operated";
6939
- DeviceFeature["Rebootable"] = "rebootable";
6523
+ var StaticDirOutputSchema = object({ staticDir: string() });
6524
+ var VersionOutputSchema = object({ version: string() });
6525
+ method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6526
+ /**
6527
+ * device-ops — device-scoped cap that unifies the per-IDevice operations
6528
+ * previously routed through the `.device-ops` Moleculer bridge service.
6529
+ *
6530
+ * Each worker that hosts live `IDevice` instances auto-registers a native
6531
+ * provider for this cap (per device) backed by its local
6532
+ * `DeviceRegistry`. Hub-side callers reach it transparently through
6533
+ * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
6534
+ * `deviceId` + `nodeId` and dispatches through the standard cap-router,
6535
+ * so there's no parallel bridge path anymore.
6536
+ *
6537
+ * The surface is intentionally small — every method corresponds to a
6538
+ * single action on the live `IDevice` (or `ICameraDevice` for
6539
+ * `getStreamSources`). Richer orchestration (enable/disable with
6540
+ * integration plumbing, bulk updates) stays in the `device-manager` cap;
6541
+ * `device-ops` is the per-device primitive the device-manager routes to.
6542
+ */
6543
+ var StreamSourceEntrySchema = object({
6544
+ id: string(),
6545
+ label: string(),
6546
+ protocol: _enum([
6547
+ "rtsp",
6548
+ "rtmp",
6549
+ "annexb",
6550
+ "http-mjpeg",
6551
+ "webrtc",
6552
+ "custom"
6553
+ ]),
6554
+ url: string().optional(),
6555
+ resolution: object({
6556
+ width: number(),
6557
+ height: number()
6558
+ }).optional(),
6559
+ fps: number().optional(),
6560
+ bitrate: number().optional(),
6561
+ codec: string().optional(),
6562
+ profileHint: CamProfileSchema.optional(),
6563
+ sdp: string().optional()
6564
+ });
6565
+ var ConfigEntrySchema$1 = object({
6566
+ key: string(),
6567
+ value: unknown()
6568
+ });
6569
+ var RawStateResultSchema = object({
6570
+ /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
6571
+ source: string(),
6572
+ /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
6573
+ data: record(string(), unknown())
6574
+ });
6575
+ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
6576
+ deviceId: number(),
6577
+ values: record(string(), unknown())
6578
+ }), _void(), { kind: "mutation" }), method(object({
6579
+ deviceId: number(),
6580
+ action: string().min(1),
6581
+ input: unknown()
6582
+ }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
6583
+ //#endregion
6584
+ //#region ../types/dist/err-msg-IQTHeDzc.mjs
6585
+ /**
6586
+ import { errMsg } from '@camstack/types'
6587
+ * Extract a human-readable message from an unknown error value.
6588
+ * Replaces the ubiquitous `errMsg(err)` pattern.
6589
+ */
6590
+ function errMsg(err) {
6591
+ if (err instanceof Error) return err.message;
6592
+ if (typeof err === "string") return err;
6593
+ return String(err);
6594
+ }
6595
+ //#endregion
6596
+ //#region ../types/dist/index.mjs
6597
+ /**
6598
+ * Deep wiring healthcheck — snapshot of active reachability probes across
6599
+ * every declared capability + widget of every installed plugin, on every
6600
+ * node. Produced by the backend `WiringHealthService` and surfaced via
6601
+ * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
6602
+ *
6603
+ * Unlike `/health` (process liveness), this reflects whether each cap/widget
6604
+ * is actually *reachable* over the real cap-dispatch path. See spec
6605
+ * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
6606
+ */
6607
+ /** What kind of target a probe addressed. */
6608
+ var wiringProbeKindSchema = _enum([
6609
+ "singleton",
6610
+ "device",
6611
+ "widget"
6612
+ ]);
6613
+ /** Result of probing a single (cap|widget [, device]) target. */
6614
+ var wiringProbeResultSchema = object({
6615
+ capName: string(),
6616
+ kind: wiringProbeKindSchema,
6617
+ deviceId: number().optional(),
6618
+ reachable: boolean(),
6619
+ latencyMs: number(),
6620
+ error: string().optional()
6621
+ });
6622
+ /** Per-addon roll-up of cap + widget probe results. */
6623
+ var wiringAddonHealthSchema = object({
6624
+ addonId: string(),
6625
+ caps: array(wiringProbeResultSchema).readonly(),
6626
+ widgets: array(wiringProbeResultSchema).readonly()
6627
+ });
6628
+ /** Per-node roll-up. */
6629
+ var wiringNodeHealthSchema = object({
6630
+ nodeId: string(),
6631
+ addons: array(wiringAddonHealthSchema).readonly()
6632
+ });
6633
+ object({
6634
+ /** True only when every probed target is reachable. */
6635
+ ok: boolean(),
6636
+ /** True when at least one target is unreachable. */
6637
+ degraded: boolean(),
6638
+ checkedAt: string(),
6639
+ nodes: array(wiringNodeHealthSchema).readonly(),
6640
+ summary: object({
6641
+ total: number(),
6642
+ reachable: number(),
6643
+ unreachable: number()
6644
+ })
6645
+ });
6646
+ var MODEL_FORMATS = [
6647
+ "onnx",
6648
+ "coreml",
6649
+ "openvino",
6650
+ "tflite",
6651
+ "pt"
6652
+ ];
6653
+ /**
6654
+ * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6655
+ * Named `RecordingWeekday` to avoid collision with the string-union
6656
+ * `Weekday` exported from `interfaces/timezones.ts`.
6657
+ */
6658
+ var RecordingWeekdaySchema = number().int().min(0).max(6);
6659
+ var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6660
+ var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6661
+ kind: literal("timeOfDay"),
6662
+ start: string().regex(HHMM),
6663
+ end: string().regex(HHMM),
6664
+ /** Restrict to these weekdays; omit = every day. */
6665
+ days: array(RecordingWeekdaySchema).optional()
6666
+ })]);
6667
+ var RecordingModeSchema = _enum([
6668
+ "continuous",
6669
+ "onMotion",
6670
+ "onAudioThreshold"
6671
+ ]);
6672
+ /**
6673
+ * First-class, authoritative per-camera storage mode — the netta choice the UI
6674
+ * reads directly (never inferred from `rules`):
6675
+ * - `off` — not recording.
6676
+ * - `events` — record only around triggers (motion / audio threshold),
6677
+ * with pre/post-buffer.
6678
+ * - `continuous` — record 24/7 within the schedule.
6679
+ *
6680
+ * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6681
+ * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6682
+ */
6683
+ var RecordingStorageModeSchema = _enum([
6684
+ "off",
6685
+ "events",
6686
+ "continuous"
6687
+ ]);
6688
+ /** Which detectors trigger an `events`-mode recording. */
6689
+ var RecordingTriggersSchema = object({
6690
+ motion: boolean().optional(),
6691
+ audioThresholdDbfs: number().optional()
6692
+ });
6693
+ /**
6694
+ * Mode of a single recording band — the recorder per-band vocabulary.
6695
+ *
6696
+ * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6697
+ * only ever `continuous` or `events`; "off" is expressed by the absence of a
6698
+ * covering band, not by a band value.
6699
+ */
6700
+ var RecordingBandModeSchema = _enum(["continuous", "events"]);
6701
+ /**
6702
+ * Triggers for an `events`-mode band. Identical shape to
6703
+ * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6704
+ * two never drift.
6705
+ */
6706
+ var RecordingBandTriggersSchema = RecordingTriggersSchema;
6707
+ /**
6708
+ * A single mode-per-band window — the canonical recorder band shape, the
6709
+ * single source of truth re-used by `addon-pipeline/recorder`.
6710
+ *
6711
+ * `days` lists the weekdays the band covers (empty = every day, matching the
6712
+ * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6713
+ * span wraps past midnight (handled by the band engine).
6714
+ */
6715
+ var RecordingBandSchema = object({
6716
+ days: array(RecordingWeekdaySchema),
6717
+ start: string().regex(HHMM),
6718
+ end: string().regex(HHMM),
6719
+ mode: RecordingBandModeSchema,
6720
+ triggers: RecordingBandTriggersSchema.optional(),
6721
+ preBufferSec: number().min(0).optional(),
6722
+ postBufferSec: number().min(0).optional()
6723
+ });
6724
+ var RecordingRuleSchema = object({
6725
+ schedule: RecordingScheduleSchema,
6726
+ mode: RecordingModeSchema,
6727
+ /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6728
+ preBufferSec: number().min(0).default(0),
6729
+ /** Keep recording until this many seconds after the last trigger. */
6730
+ postBufferSec: number().min(0).default(0),
6731
+ /** Each new trigger restarts the post-buffer window. */
6732
+ resetTimeoutOnNewEvent: boolean().default(true),
6733
+ /** onAudioThreshold only — dBFS level that counts as a trigger. */
6734
+ thresholdDbfs: number().optional()
6735
+ });
6736
+ /**
6737
+ * Per-device retention overrides. Every field is optional; an unset or `0`
6738
+ * value inherits the node-wide recorder default. Only footage-lifetime limits
6739
+ * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6740
+ * (when the volume is too full to keep recording) is NOT a per-camera concern —
6741
+ * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6742
+ * shared by every camera writing to that volume.
6743
+ */
6744
+ var RecordingRetentionSchema = object({
6745
+ maxAgeDays: number().min(0).optional(),
6746
+ maxSizeGb: number().min(0).optional()
6747
+ });
6748
+ /**
6749
+ * The full per-camera recording intent — the wire shape of a RecordingTarget.
6750
+ *
6751
+ * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6752
+ * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6753
+ * only for transition + migration (`migrateRulesToMode`); the policy engine
6754
+ * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6755
+ */
6756
+ var RecordingConfigSchema = object({
6757
+ enabled: boolean(),
6758
+ /** Authoritative storage mode. Absent on legacy targets → derived once via
6759
+ * `migrateRulesToMode`, then persisted. */
6760
+ mode: RecordingStorageModeSchema.optional(),
6761
+ profiles: array(CamProfileSchema).optional(),
6762
+ segmentSeconds: number().int().positive().optional(),
6763
+ /** Shared recording time-bands for `events` & `continuous` — record only when
6764
+ * the wall-clock falls inside one of these windows. Omit or empty = always.
6765
+ * `continuous` compiles to one rule per band; `events` to band × trigger. */
6766
+ schedules: array(RecordingScheduleSchema).optional(),
6767
+ /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6768
+ * normalized into `schedules` on read and never written going forward. (Not
6769
+ * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6770
+ schedule: RecordingScheduleSchema.optional(),
6771
+ /** `events`-mode only — which detectors trigger a recording. */
6772
+ triggers: RecordingTriggersSchema.optional(),
6773
+ /** `events`-mode only — seconds retained before / after a trigger. */
6774
+ preBufferSec: number().min(0).optional(),
6775
+ postBufferSec: number().min(0).optional(),
6776
+ /** DEPRECATED authoring input; retained for migration/transition. */
6777
+ rules: array(RecordingRuleSchema).optional(),
6778
+ /**
6779
+ * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6780
+ * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6781
+ * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6782
+ * derived into bands once via `migrateConfigToBands`.
6783
+ */
6784
+ bands: array(RecordingBandSchema).optional(),
6785
+ retention: RecordingRetentionSchema.optional()
6786
+ });
6787
+ /**
6788
+ * `StorageLocationType` an addon-declared id that identifies the *kind* of
6789
+ * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6790
+ * so the persisted record schema and the consumer-facing cap can both consume it
6791
+ * without forming a circular import. The `storage` cap re-exports it
6792
+ * verbatim for back-compat.
6793
+ *
6794
+ * This Zod schema is the **authoritative source** for `StorageLocationType`.
6795
+ * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6796
+ * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6797
+ * `IStorageProvider` interface stay in lockstep.
6798
+ *
6799
+ * The type is now an **open string** (not a closed enum) — addons declare
6800
+ * their own location kinds via `StorageLocationDeclaration.id`. The regex
6801
+ * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6802
+ */
6803
+ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6804
+ /**
6805
+ * Persisted record for a storage location instance. Operators can register
6806
+ * multiple instances for multi-cardinality types (e.g. two `backups`
6807
+ * locations with different `providerId`s). Cardinality is now declared per
6808
+ * location via `StorageLocationDeclaration.cardinality` the static
6809
+ * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6810
+ *
6811
+ * `id` is a stable namespaced string of the form `<type>:<slug>`.
6812
+ * The default location for a type uses `id === <type>:default` by
6813
+ * convention (the bare type ref like `'backups'` resolves to it).
6814
+ *
6815
+ * `isSystem: true` marks a location as orchestrator-seeded and
6816
+ * undeletable. The bootstrap-installed defaults (one per type) carry
6817
+ * this flag; operator-added locations don't. Editing the config of
6818
+ * a system location is allowed (path migration, provider swap) but
6819
+ * deleting it is rejected at the cap level.
6820
+ */
6821
+ var StorageLocationSchema = object({
6822
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6823
+ type: string(),
6824
+ displayName: string().min(1),
6825
+ providerId: string().min(1),
6826
+ config: record(string(), unknown()),
6940
6827
  /**
6941
- * Device supports an on-demand re-sync of its derived spec with its
6942
- * upstream sourcedrives the generic Re-sync button. The owning
6943
- * provider implements the action via the `device-adoption.resync` cap.
6828
+ * Cluster node this location physically lives on. REQUIRED for node-local
6829
+ * providers (filesystem — the path exists on one node's disk), null/absent
6830
+ * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6831
+ * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6832
+ * flag at upsert time, not here (the schema is provider-agnostic).
6944
6833
  */
6945
- DeviceFeature["Resyncable"] = "resyncable";
6946
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
6947
- DeviceFeature["DoorbellButton"] = "doorbell-button";
6948
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
6949
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6834
+ nodeId: string().optional(),
6835
+ isDefault: boolean().default(false),
6836
+ isSystem: boolean().default(false),
6837
+ createdAt: number(),
6838
+ updatedAt: number()
6839
+ });
6840
+ /**
6841
+ * Reference accepted by consumer-facing `api.storage.*` calls.
6842
+ * Either:
6843
+ * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
6844
+ * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
6845
+ *
6846
+ * The orchestrator's `resolveRef(ref)` handles both cases.
6847
+ */
6848
+ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6849
+ /**
6850
+ * `StorageLocationDeclaration` — a single storage-location entry declared by
6851
+ * an addon in its `package.json` under `camstack.storageLocations`.
6852
+ *
6853
+ * Design intent:
6854
+ * - **Addon declares its needs** — each addon describes the logical storage
6855
+ * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6856
+ * about the physical path.
6857
+ * - **Kernel aggregates** — at boot the kernel collects declarations from all
6858
+ * installed addons, deduplicates by `id`, and exposes the union via the
6859
+ * storage-locations settings surface.
6860
+ * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6861
+ * at least one instance named `<id>:default` is present, using
6862
+ * `defaultsTo` to inherit the resolved root from another location when the
6863
+ * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6864
+ * `recordings`).
6865
+ * - **ids are global** — `id` values are shared across the entire deployment;
6866
+ * two addons declaring the same `id` must agree on `cardinality` (validated
6867
+ * at kernel aggregation time, not here).
6868
+ */
6869
+ var StorageLocationDeclarationSchema = object({
6950
6870
  /**
6951
- * Camera supports the on-firmware autotrack subsystem (subject-
6952
- * following). Distinct from `PanTiltZoom` because not every PTZ
6953
- * camera ships autotrack — the admin UI uses this flag to gate
6954
- * the autotrack toggle / settings card without re-deriving from
6955
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
6956
- * driver sets this feature when probe confirms the firmware
6957
- * surface, and registers the cap in the same code path.
6871
+ * Global location identifier, e.g. `recordings` or `recordingsLow`.
6872
+ * Must start with a lowercase letter and may contain letters, digits, and
6873
+ * hyphens.
6958
6874
  */
6959
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6875
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6876
+ /** Human-readable name shown in the admin UI. */
6877
+ displayName: string().min(1, { message: "displayName must not be empty" }),
6878
+ /** Optional longer explanation of what data this location stores. */
6879
+ description: string().optional(),
6960
6880
  /**
6961
- * Accessory exposes a "trigger on motion" toggle the parent camera's
6962
- * motion detection automatically activates this device. Mirrors
6963
- * `motion-trigger` cap registration: drivers set this feature in the
6964
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6965
- *
6966
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6967
- * fast scalar without binding fetch), notifier rules, and `listAll`
6968
- * filters that want "all devices with on-motion behaviour".
6881
+ * `single` exactly one instance of this location is allowed system-wide
6882
+ * (e.g. `logs`, `models`). The operator can edit it but not add more.
6883
+ * `multi` the operator may register several instances (e.g. a second
6884
+ * `recordings` on a NAS for disk tiering); one is the default at any time.
6969
6885
  */
6970
- DeviceFeature["MotionTrigger"] = "motion-trigger";
6971
- /** Light supports rgb-triplet color via `color` cap. */
6972
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
6973
- /** Light supports HSV color via `color` cap. */
6974
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
6975
- /** Light supports color-temperature (mired) via `color` cap. */
6976
- DeviceFeature["LightColorMired"] = "light-color-mired";
6977
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6978
- * targetHigh). Gates the range slider UI. */
6979
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
6980
- /** Thermostat exposes target humidity and/or current humidity
6981
- * readings. Gates the humidity controls. */
6982
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
6983
- /** Thermostat exposes a fan-mode selector. */
6984
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
6985
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
6986
- DeviceFeature["ClimatePreset"] = "climate-preset";
6987
- /** Cover exposes intermediate position control (0..100). Gates the
6988
- * position slider UI. */
6989
- DeviceFeature["CoverPositionable"] = "cover-positionable";
6990
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
6991
- DeviceFeature["CoverTilt"] = "cover-tilt";
6992
- /** Valve exposes intermediate position control (0..100). Gates the
6993
- * position slider / drag surface UI. */
6994
- DeviceFeature["ValvePositionable"] = "valve-positionable";
6995
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
6996
- DeviceFeature["FanSpeed"] = "fan-speed";
6997
- /** Fan exposes a preset mode selector. */
6998
- DeviceFeature["FanPreset"] = "fan-preset";
6999
- /** Fan exposes blade direction (forward/reverse) typical of
7000
- * ceiling fans. */
7001
- DeviceFeature["FanDirection"] = "fan-direction";
7002
- /** Fan exposes an oscillation toggle. */
7003
- DeviceFeature["FanOscillating"] = "fan-oscillating";
7004
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
7005
- * field on the UI lock-controls panel. */
7006
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
7007
- /** Lock supports a latch-release ("open door") action distinct from
7008
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
7009
- * `supported_features`. Gates the Open Door button in the UI. */
7010
- DeviceFeature["LockOpen"] = "lock-open";
7011
- /** Media player exposes a seek-to-position surface. */
7012
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
7013
- /** Media player exposes a volume-level setter. */
7014
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
7015
- /** Media player exposes a mute toggle distinct from volume=0. */
7016
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
7017
- /** Media player exposes a shuffle toggle. */
7018
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
7019
- /** Media player exposes a repeat mode (off / all / one). */
7020
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
7021
- /** Media player exposes a source / input selector. */
7022
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
7023
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
7024
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
7025
- /** Media player exposes next-track. */
7026
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
7027
- /** Media player exposes previous-track. */
7028
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
7029
- /** Media player exposes stop distinct from pause. */
7030
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
7031
- /** Alarm panel requires a PIN code on arm/disarm. */
7032
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
7033
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
7034
- * addition to a textual location. */
7035
- DeviceFeature["PresenceGps"] = "presence-gps";
7036
- /** Notifier accepts an inline / URL image attachment. */
7037
- DeviceFeature["NotifierImage"] = "notifier-image";
7038
- /** Notifier accepts a priority hint (high/normal/low). */
7039
- DeviceFeature["NotifierPriority"] = "notifier-priority";
7040
- /** Notifier accepts a free-form `data` payload for platform-specific
7041
- * fields. */
7042
- DeviceFeature["NotifierData"] = "notifier-data";
7043
- /** Notifier supports interactive action buttons / callbacks. */
7044
- DeviceFeature["NotifierActions"] = "notifier-actions";
7045
- /** Notifier supports per-call recipient targeting (multi-user). */
7046
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
7047
- /** Script runner accepts a variables map on each run invocation. */
7048
- DeviceFeature["ScriptVariables"] = "script-variables";
7049
- /** Automation `trigger` accepts a skipCondition flag — fires the
7050
- * automation's actions while bypassing its condition block. */
7051
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
7052
- return DeviceFeature;
7053
- }({});
7054
- /**
7055
- * Semantic role a device plays within its parent. Populated by driver
7056
- * addons when creating accessory devices (Reolink siren/floodlight/
7057
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
7058
- * admin UI to pick icons, labels, and widgets — a `Switch` with
7059
- * `role: Floodlight` renders as a bulb with a brightness slider,
7060
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
7061
- *
7062
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
7063
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
7064
- */
7065
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7066
- DeviceRole["Siren"] = "siren";
7067
- DeviceRole["Floodlight"] = "floodlight";
7068
- DeviceRole["Spotlight"] = "spotlight";
7069
- DeviceRole["PirSensor"] = "pir-sensor";
7070
- DeviceRole["Chime"] = "chime";
7071
- DeviceRole["Autotrack"] = "autotrack";
7072
- DeviceRole["Nightvision"] = "nightvision";
7073
- DeviceRole["PrivacyMask"] = "privacy-mask";
7074
- DeviceRole["Doorbell"] = "doorbell";
7075
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
7076
- * real Switch device for UI rendering / export adapters. */
7077
- DeviceRole["BinaryHelper"] = "binary-helper";
7078
- /** Generic motion / occupancy / moving event source. Distinct from
7079
- * the camera accessory PirSensor role: that one is a camera child;
7080
- * this is a standalone HA / 3rd-party motion sensor. */
7081
- DeviceRole["MotionSensor"] = "motion-sensor";
7082
- DeviceRole["ContactSensor"] = "contact-sensor";
7083
- DeviceRole["LeakSensor"] = "leak-sensor";
7084
- DeviceRole["SmokeSensor"] = "smoke-sensor";
7085
- DeviceRole["COSensor"] = "co-sensor";
7086
- DeviceRole["GasSensor"] = "gas-sensor";
7087
- DeviceRole["TamperSensor"] = "tamper-sensor";
7088
- DeviceRole["VibrationSensor"] = "vibration-sensor";
7089
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
7090
- DeviceRole["SoundSensor"] = "sound-sensor";
7091
- /** Fallback for `binary_sensor` without a known `device_class`. */
7092
- DeviceRole["BinarySensor"] = "binary-sensor";
7093
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
7094
- DeviceRole["HumiditySensor"] = "humidity-sensor";
7095
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
7096
- DeviceRole["PressureSensor"] = "pressure-sensor";
7097
- DeviceRole["PowerSensor"] = "power-sensor";
7098
- DeviceRole["EnergySensor"] = "energy-sensor";
7099
- DeviceRole["VoltageSensor"] = "voltage-sensor";
7100
- DeviceRole["CurrentSensor"] = "current-sensor";
7101
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
7102
- /** Battery level (numeric % via `sensor` OR low-bool via
7103
- * `binary_sensor` — the cap distinguishes via the value type). */
7104
- DeviceRole["BatterySensor"] = "battery-sensor";
7105
- /** Fallback for `sensor` numeric without a known `device_class`. */
7106
- DeviceRole["NumericSensor"] = "numeric-sensor";
7107
- /** String / enum state (HA `sensor` with `state_class: enum` or
7108
- * `attributes.options`). */
7109
- DeviceRole["EnumSensor"] = "enum-sensor";
7110
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
7111
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
7112
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
7113
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
7114
- /** Last-resort fallback when nothing else matches. */
7115
- DeviceRole["GenericSensor"] = "generic-sensor";
7116
- DeviceRole["NumericControl"] = "numeric-control";
7117
- DeviceRole["SelectControl"] = "select-control";
7118
- DeviceRole["TextControl"] = "text-control";
7119
- DeviceRole["DateTimeControl"] = "datetime-control";
7120
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
7121
- * rich features (image, priority, channel routing). */
7122
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
7123
- /** Chat / messaging service (HA `notify.telegram_*`,
7124
- * `notify.discord_*`, etc.). */
7125
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
7126
- /** Email-based delivery (HA `notify.smtp`, etc.). */
7127
- DeviceRole["EmailNotifier"] = "email-notifier";
7128
- /** Fallback when the notifier service name doesn't match a known
7129
- * pattern. */
7130
- DeviceRole["GenericNotifier"] = "generic-notifier";
7131
- return DeviceRole;
7132
- }({});
6886
+ cardinality: _enum(["single", "multi"]),
6887
+ /**
6888
+ * When set, the default instance for this location inherits its resolved
6889
+ * root from the named location's default instance. Useful for derivative
6890
+ * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6891
+ * configure the primary location.
6892
+ */
6893
+ defaultsTo: string().optional()
6894
+ });
6895
+ var DecoderStatsSchema = object({
6896
+ inputFps: number(),
6897
+ outputFps: number(),
6898
+ avgDecodeTimeMs: number(),
6899
+ droppedFrames: number()
6900
+ });
6901
+ var DecoderSessionConfigSchema = object({
6902
+ codec: string(),
6903
+ maxFps: number().default(0),
6904
+ outputFormat: _enum([
6905
+ "jpeg",
6906
+ "rgb",
6907
+ "bgr",
6908
+ "yuv420",
6909
+ "gray"
6910
+ ]).default("jpeg"),
6911
+ scale: number().default(1),
6912
+ width: number().optional(),
6913
+ height: number().optional(),
6914
+ /**
6915
+ * Identifier of the camera this decoder session serves. Optional
6916
+ * because the cap is generic (any caller could request decode), but
6917
+ * stream-broker passes it so decoder logs include `deviceId` for
6918
+ * per-camera filtering when diagnosing failures (e.g. node-av
6919
+ * sendPacket errors on a single hung camera).
6920
+ */
6921
+ deviceId: number().int().nonnegative().optional(),
6922
+ /**
6923
+ * Free-form tag for log scoping. Stream-broker uses
6924
+ * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6925
+ * on every line so `grep tag=broker:5/high` filters one camera
6926
+ * profile cleanly.
6927
+ */
6928
+ tag: string().optional(),
6929
+ /**
6930
+ * Where the session delivers decoded frames (Phase 5 / D9):
6931
+ *
6932
+ * - `'callback'` (default) — the legacy pixel path: decoded frames are
6933
+ * buffered as `DecodedFrame`s and drained via `pullFrames`.
6934
+ * - `'shm'` — the shared-memory frame plane: decoded frames are written
6935
+ * into an OS shared-memory ring and drained as zero-pixel
6936
+ * `FrameHandle`s via `pullHandles`. A session is one mode or the
6937
+ * other `pullFrames` returns nothing for an `'shm'` session and
6938
+ * `pullHandles` returns nothing for a `'callback'` session.
6939
+ */
6940
+ frameSink: _enum(["callback", "shm"]).default("callback")
6941
+ });
6942
+ var EncodeProfileSchema = object({
6943
+ video: object({
6944
+ codec: _enum([
6945
+ "h264",
6946
+ "h265",
6947
+ "copy"
6948
+ ]),
6949
+ profile: _enum([
6950
+ "baseline",
6951
+ "main",
6952
+ "high"
6953
+ ]).optional(),
6954
+ width: number().int().positive().optional(),
6955
+ height: number().int().positive().optional(),
6956
+ fps: number().positive().optional(),
6957
+ bitrateKbps: number().int().positive().optional(),
6958
+ gopFrames: number().int().positive().optional(),
6959
+ bf: number().int().min(0).optional(),
6960
+ preset: _enum([
6961
+ "ultrafast",
6962
+ "superfast",
6963
+ "veryfast",
6964
+ "faster",
6965
+ "fast",
6966
+ "medium"
6967
+ ]).optional(),
6968
+ tune: _enum([
6969
+ "zerolatency",
6970
+ "film",
6971
+ "animation"
6972
+ ]).optional()
6973
+ }),
6974
+ audio: union([literal("passthrough"), object({
6975
+ codec: _enum([
6976
+ "opus",
6977
+ "aac",
6978
+ "pcmu",
6979
+ "pcma",
6980
+ "copy"
6981
+ ]),
6982
+ bitrateKbps: number().int().positive().optional(),
6983
+ sampleRateHz: number().int().positive().optional(),
6984
+ channels: union([literal(1), literal(2)]).optional()
6985
+ })]),
6986
+ /**
6987
+ * ffmpeg input-side args, inserted between the fixed global flags
6988
+ * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6989
+ * the widget surfaces a textarea + suggestion chips for the most-
6990
+ * used demuxer/format options.
6991
+ */
6992
+ inputArgs: array(string()).optional(),
6993
+ /**
6994
+ * ffmpeg output-side args, inserted between the encode block and
6995
+ * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6996
+ * filters, codec-specific overrides. Free-text array.
6997
+ */
6998
+ outputArgs: array(string()).optional()
6999
+ });
7000
+ var YAMNET_TO_MACRO = {
7001
+ mapping: {
7002
+ Speech: "speech",
7003
+ "Child speech, kid speaking": "speech",
7004
+ Conversation: "speech",
7005
+ "Narration, monologue": "speech",
7006
+ Babbling: "speech",
7007
+ Whispering: "speech",
7008
+ "Speech synthesizer": "speech",
7009
+ Humming: "speech",
7010
+ Rapping: "speech",
7011
+ Singing: "speech",
7012
+ Choir: "speech",
7013
+ "Child singing": "speech",
7014
+ Shout: "scream",
7015
+ Bellow: "scream",
7016
+ Yell: "scream",
7017
+ Screaming: "scream",
7018
+ "Children shouting": "scream",
7019
+ Whoop: "scream",
7020
+ "Crying, sobbing": "crying",
7021
+ "Baby cry, infant cry": "crying",
7022
+ Whimper: "crying",
7023
+ "Wail, moan": "crying",
7024
+ Groan: "crying",
7025
+ Laughter: "laughter",
7026
+ "Baby laughter": "laughter",
7027
+ Giggle: "laughter",
7028
+ Snicker: "laughter",
7029
+ "Belly laugh": "laughter",
7030
+ "Chuckle, chortle": "laughter",
7031
+ Music: "music",
7032
+ "Musical instrument": "music",
7033
+ Guitar: "music",
7034
+ Piano: "music",
7035
+ Drum: "music",
7036
+ "Drum kit": "music",
7037
+ "Violin, fiddle": "music",
7038
+ Flute: "music",
7039
+ Saxophone: "music",
7040
+ Trumpet: "music",
7041
+ Synthesizer: "music",
7042
+ "Pop music": "music",
7043
+ "Rock music": "music",
7044
+ "Hip hop music": "music",
7045
+ "Classical music": "music",
7046
+ Jazz: "music",
7047
+ "Electronic music": "music",
7048
+ "Background music": "music",
7049
+ Dog: "dog",
7050
+ Bark: "dog",
7051
+ Yip: "dog",
7052
+ Howl: "dog",
7053
+ "Bow-wow": "dog",
7054
+ Growling: "dog",
7055
+ "Whimper (dog)": "dog",
7056
+ Cat: "cat",
7057
+ Purr: "cat",
7058
+ Meow: "cat",
7059
+ Hiss: "cat",
7060
+ Caterwaul: "cat",
7061
+ Bird: "bird",
7062
+ "Bird vocalization, bird call, bird song": "bird",
7063
+ "Chirp, tweet": "bird",
7064
+ Squawk: "bird",
7065
+ Crow: "bird",
7066
+ Owl: "bird",
7067
+ "Pigeon, dove": "bird",
7068
+ Animal: "animal",
7069
+ "Domestic animals, pets": "animal",
7070
+ "Livestock, farm animals, working animals": "animal",
7071
+ Horse: "animal",
7072
+ "Cattle, bovinae": "animal",
7073
+ Pig: "animal",
7074
+ Sheep: "animal",
7075
+ Goat: "animal",
7076
+ Frog: "animal",
7077
+ Insect: "animal",
7078
+ Cricket: "animal",
7079
+ Alarm: "alarm",
7080
+ "Alarm clock": "alarm",
7081
+ "Smoke detector, smoke alarm": "alarm",
7082
+ "Fire alarm": "alarm",
7083
+ Buzzer: "alarm",
7084
+ "Civil defense siren": "alarm",
7085
+ "Car alarm": "alarm",
7086
+ Siren: "siren",
7087
+ "Police car (siren)": "siren",
7088
+ "Ambulance (siren)": "siren",
7089
+ "Fire engine, fire truck (siren)": "siren",
7090
+ "Emergency vehicle": "siren",
7091
+ Foghorn: "siren",
7092
+ Doorbell: "doorbell",
7093
+ "Ding-dong": "doorbell",
7094
+ Knock: "doorbell",
7095
+ Tap: "doorbell",
7096
+ Glass: "glass_breaking",
7097
+ Shatter: "glass_breaking",
7098
+ "Chink, clink": "glass_breaking",
7099
+ "Gunshot, gunfire": "gunshot",
7100
+ "Machine gun": "gunshot",
7101
+ Explosion: "gunshot",
7102
+ Fireworks: "gunshot",
7103
+ Firecracker: "gunshot",
7104
+ "Artillery fire": "gunshot",
7105
+ "Cap gun": "gunshot",
7106
+ Boom: "gunshot",
7107
+ Vehicle: "vehicle",
7108
+ Car: "vehicle",
7109
+ Truck: "vehicle",
7110
+ Bus: "vehicle",
7111
+ Motorcycle: "vehicle",
7112
+ "Car passing by": "vehicle",
7113
+ "Vehicle horn, car horn, honking": "vehicle",
7114
+ "Traffic noise, roadway noise": "vehicle",
7115
+ Train: "vehicle",
7116
+ Aircraft: "vehicle",
7117
+ Helicopter: "vehicle",
7118
+ Bicycle: "vehicle",
7119
+ Skateboard: "vehicle",
7120
+ Fire: "fire",
7121
+ Crackle: "fire",
7122
+ Water: "water",
7123
+ Rain: "water",
7124
+ Raindrop: "water",
7125
+ "Rain on surface": "water",
7126
+ Stream: "water",
7127
+ Waterfall: "water",
7128
+ Ocean: "water",
7129
+ "Waves, surf": "water",
7130
+ "Splash, splatter": "water",
7131
+ Wind: "wind",
7132
+ Thunderstorm: "wind",
7133
+ Thunder: "wind",
7134
+ "Wind noise (microphone)": "wind",
7135
+ "Rustling leaves": "wind",
7136
+ Door: "door",
7137
+ "Sliding door": "door",
7138
+ Slam: "door",
7139
+ "Cupboard open or close": "door",
7140
+ "Walk, footsteps": "footsteps",
7141
+ Run: "footsteps",
7142
+ Shuffle: "footsteps",
7143
+ Crowd: "crowd",
7144
+ Chatter: "crowd",
7145
+ Cheering: "crowd",
7146
+ Applause: "crowd",
7147
+ "Children playing": "crowd",
7148
+ "Hubbub, speech noise, speech babble": "crowd",
7149
+ Telephone: "telephone",
7150
+ "Telephone bell ringing": "telephone",
7151
+ Ringtone: "telephone",
7152
+ "Telephone dialing, DTMF": "telephone",
7153
+ "Busy signal": "telephone",
7154
+ Engine: "engine",
7155
+ "Engine starting": "engine",
7156
+ Idling: "engine",
7157
+ "Accelerating, revving, vroom": "engine",
7158
+ "Light engine (high frequency)": "engine",
7159
+ "Medium engine (mid frequency)": "engine",
7160
+ "Heavy engine (low frequency)": "engine",
7161
+ "Lawn mower": "engine",
7162
+ Chainsaw: "engine",
7163
+ Hammer: "tools",
7164
+ Jackhammer: "tools",
7165
+ Sawing: "tools",
7166
+ "Power tool": "tools",
7167
+ Drill: "tools",
7168
+ Sanding: "tools",
7169
+ Silence: "silence"
7170
+ },
7171
+ preserveOriginal: false
7172
+ };
7173
+ var APPLE_SA_TO_MACRO = {
7174
+ mapping: {
7175
+ speech: "speech",
7176
+ child_speech: "speech",
7177
+ conversation: "speech",
7178
+ whispering: "speech",
7179
+ singing: "speech",
7180
+ humming: "speech",
7181
+ shout: "scream",
7182
+ yell: "scream",
7183
+ screaming: "scream",
7184
+ crying: "crying",
7185
+ baby_crying: "crying",
7186
+ sobbing: "crying",
7187
+ laughter: "laughter",
7188
+ baby_laughter: "laughter",
7189
+ giggling: "laughter",
7190
+ music: "music",
7191
+ guitar: "music",
7192
+ piano: "music",
7193
+ drums: "music",
7194
+ dog_bark: "dog",
7195
+ dog_bow_wow: "dog",
7196
+ dog_growling: "dog",
7197
+ dog_howl: "dog",
7198
+ cat_meow: "cat",
7199
+ cat_purr: "cat",
7200
+ cat_hiss: "cat",
7201
+ bird: "bird",
7202
+ bird_chirp: "bird",
7203
+ bird_squawk: "bird",
7204
+ animal: "animal",
7205
+ horse: "animal",
7206
+ cow_moo: "animal",
7207
+ insect: "animal",
7208
+ alarm: "alarm",
7209
+ smoke_alarm: "alarm",
7210
+ fire_alarm: "alarm",
7211
+ car_alarm: "alarm",
7212
+ siren: "siren",
7213
+ police_siren: "siren",
7214
+ ambulance_siren: "siren",
7215
+ doorbell: "doorbell",
7216
+ door_knock: "doorbell",
7217
+ knocking: "doorbell",
7218
+ glass_breaking: "glass_breaking",
7219
+ glass_shatter: "glass_breaking",
7220
+ gunshot: "gunshot",
7221
+ explosion: "gunshot",
7222
+ fireworks: "gunshot",
7223
+ car: "vehicle",
7224
+ truck: "vehicle",
7225
+ motorcycle: "vehicle",
7226
+ car_horn: "vehicle",
7227
+ vehicle_horn: "vehicle",
7228
+ traffic: "vehicle",
7229
+ fire: "fire",
7230
+ fire_crackle: "fire",
7231
+ water: "water",
7232
+ rain: "water",
7233
+ ocean: "water",
7234
+ splash: "water",
7235
+ wind: "wind",
7236
+ thunder: "wind",
7237
+ thunderstorm: "wind",
7238
+ door: "door",
7239
+ door_slam: "door",
7240
+ sliding_door: "door",
7241
+ footsteps: "footsteps",
7242
+ walking: "footsteps",
7243
+ running: "footsteps",
7244
+ crowd: "crowd",
7245
+ chatter: "crowd",
7246
+ cheering: "crowd",
7247
+ applause: "crowd",
7248
+ telephone_ring: "telephone",
7249
+ ringtone: "telephone",
7250
+ engine: "engine",
7251
+ engine_starting: "engine",
7252
+ lawn_mower: "engine",
7253
+ chainsaw: "engine",
7254
+ hammer: "tools",
7255
+ jackhammer: "tools",
7256
+ drill: "tools",
7257
+ power_tool: "tools",
7258
+ silence: "silence"
7259
+ },
7260
+ preserveOriginal: false
7261
+ };
7262
+ var _macroLookup = /* @__PURE__ */ new Map();
7263
+ for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7264
+ for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7133
7265
  /**
7134
7266
  * Accessory device helpers — shared across drivers.
7135
7267
  *
@@ -7393,74 +7525,6 @@ object({
7393
7525
  });
7394
7526
  DeviceType.Sensor;
7395
7527
  /**
7396
- * Generic types for capability definitions.
7397
- *
7398
- * A capability is defined with Zod schemas for methods, events, and settings.
7399
- * TypeScript types are inferred via z.infer<> — zero duplication.
7400
- *
7401
- * Pattern:
7402
- * 1. Define Zod schemas for data, methods, settings
7403
- * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
7404
- * 3. Export type IProvider = InferProvider<typeof capabilityDef>
7405
- * 4. Addon implements IProvider
7406
- * 5. Registry auto-mounts tRPC router from definition.methods
7407
- */
7408
- /**
7409
- * Output schema shared by the contribution + live methods.
7410
- *
7411
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
7412
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
7413
- * concrete-but-lenient Zod object keeps tRPC output inference happy
7414
- * (using `z.unknown()` here collapses unrelated router branches to
7415
- * `unknown` when the generator re-inlines the huge AppRouter type).
7416
- *
7417
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
7418
- * extensions the caller adds (showWhen, displayScale, …) without
7419
- * rebuilding every time a new field kind is introduced.
7420
- */
7421
- var ContributionSectionSchema = object({
7422
- id: string(),
7423
- title: string(),
7424
- description: string().optional(),
7425
- style: _enum(["card", "accordion"]).optional(),
7426
- defaultCollapsed: boolean().optional(),
7427
- columns: union([
7428
- literal(1),
7429
- literal(2),
7430
- literal(3),
7431
- literal(4)
7432
- ]).optional(),
7433
- tab: string().optional(),
7434
- location: _enum(["settings", "top-tab"]).optional(),
7435
- order: number().optional(),
7436
- fields: array(any())
7437
- });
7438
- object({
7439
- tabs: array(object({
7440
- id: string(),
7441
- label: string(),
7442
- icon: string(),
7443
- order: number().optional()
7444
- })).optional(),
7445
- sections: array(ContributionSectionSchema)
7446
- }).nullable();
7447
- object({ deviceId: number() }), object({ deviceId: number() }), object({
7448
- deviceId: number(),
7449
- patch: record(string(), unknown())
7450
- }), object({ success: literal(true) });
7451
- object({ deviceId: number() }), unknown().nullable();
7452
- /** Shorthand to define a method schema */
7453
- function method(input, output, options) {
7454
- return {
7455
- input,
7456
- output,
7457
- kind: options?.kind ?? "query",
7458
- auth: options?.auth ?? "protected",
7459
- ...options?.access !== void 0 ? { access: options.access } : {},
7460
- timeoutMs: options?.timeoutMs
7461
- };
7462
- }
7463
- /**
7464
7528
  * Alarm-panel cap. Models HA `alarm_control_panel.*` on
7465
7529
  * `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
7466
7530
  * across disarmed / armed_(home|away|night|vacation|custom_bypass) /
@@ -11722,9 +11786,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
11722
11786
  limit: number().optional(),
11723
11787
  tags: record(string(), string()).optional()
11724
11788
  }), array(LogEntrySchema).readonly());
11725
- var StaticDirOutputSchema = object({ staticDir: string() });
11726
- var VersionOutputSchema = object({ version: string() });
11727
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
11728
11789
  /**
11729
11790
  * Zod schemas for persisted record types.
11730
11791
  *
@@ -14025,7 +14086,7 @@ method(object({
14025
14086
  }), _void(), {
14026
14087
  kind: "mutation",
14027
14088
  auth: "admin"
14028
- }), 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({
14089
+ }), 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({
14029
14090
  deviceId: number(),
14030
14091
  values: record(string(), unknown())
14031
14092
  }), object({ success: literal(true) }), {
@@ -14750,7 +14811,20 @@ var DiskSpaceInfoSchema = object({
14750
14811
  var PidResourceStatsSchema = object({
14751
14812
  pid: number(),
14752
14813
  cpu: number(),
14753
- memory: number()
14814
+ memory: number(),
14815
+ /**
14816
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
14817
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
14818
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
14819
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
14820
+ * Undefined where /proc is unavailable (e.g. macOS).
14821
+ */
14822
+ privateBytes: number().optional(),
14823
+ /**
14824
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
14825
+ * code shared copy-on-write across runners. Undefined on macOS.
14826
+ */
14827
+ sharedBytes: number().optional()
14754
14828
  });
14755
14829
  var AddonInstanceSchema = object({
14756
14830
  addonId: string(),
@@ -14799,6 +14873,17 @@ var KillProcessResultSchema = object({
14799
14873
  reason: string().optional(),
14800
14874
  signal: _enum(["SIGTERM", "SIGKILL"]).optional()
14801
14875
  });
14876
+ var DumpHeapSnapshotInputSchema = object({
14877
+ /** The addon whose runner should dump a heap snapshot. */
14878
+ addonId: string() });
14879
+ var DumpHeapSnapshotResultSchema = object({
14880
+ success: boolean(),
14881
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
14882
+ path: string().optional(),
14883
+ /** Process pid that was signalled. */
14884
+ pid: number().optional(),
14885
+ reason: string().optional()
14886
+ });
14802
14887
  var SystemMetricsSchema = object({
14803
14888
  cpuPercent: number(),
14804
14889
  memoryPercent: number(),
@@ -14812,6 +14897,9 @@ var SystemMetricsSchema = object({
14812
14897
  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, {
14813
14898
  kind: "mutation",
14814
14899
  auth: "admin"
14900
+ }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
14901
+ kind: "mutation",
14902
+ auth: "admin"
14815
14903
  });
14816
14904
  var PtzPresetSchema = object({
14817
14905
  id: string(),
@@ -15220,63 +15308,6 @@ method(object({
15220
15308
  auth: "admin"
15221
15309
  });
15222
15310
  /**
15223
- * device-ops — device-scoped cap that unifies the per-IDevice operations
15224
- * previously routed through the `.device-ops` Moleculer bridge service.
15225
- *
15226
- * Each worker that hosts live `IDevice` instances auto-registers a native
15227
- * provider for this cap (per device) backed by its local
15228
- * `DeviceRegistry`. Hub-side callers reach it transparently through
15229
- * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
15230
- * `deviceId` + `nodeId` and dispatches through the standard cap-router,
15231
- * so there's no parallel bridge path anymore.
15232
- *
15233
- * The surface is intentionally small — every method corresponds to a
15234
- * single action on the live `IDevice` (or `ICameraDevice` for
15235
- * `getStreamSources`). Richer orchestration (enable/disable with
15236
- * integration plumbing, bulk updates) stays in the `device-manager` cap;
15237
- * `device-ops` is the per-device primitive the device-manager routes to.
15238
- */
15239
- var StreamSourceEntrySchema$1 = object({
15240
- id: string(),
15241
- label: string(),
15242
- protocol: _enum([
15243
- "rtsp",
15244
- "rtmp",
15245
- "annexb",
15246
- "http-mjpeg",
15247
- "webrtc",
15248
- "custom"
15249
- ]),
15250
- url: string().optional(),
15251
- resolution: object({
15252
- width: number(),
15253
- height: number()
15254
- }).optional(),
15255
- fps: number().optional(),
15256
- bitrate: number().optional(),
15257
- codec: string().optional(),
15258
- profileHint: CamProfileSchema.optional(),
15259
- sdp: string().optional()
15260
- });
15261
- var ConfigEntrySchema$1 = object({
15262
- key: string(),
15263
- value: unknown()
15264
- });
15265
- var RawStateResultSchema = object({
15266
- /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
15267
- source: string(),
15268
- /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
15269
- data: record(string(), unknown())
15270
- });
15271
- method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
15272
- deviceId: number(),
15273
- values: record(string(), unknown())
15274
- }), _void(), { kind: "mutation" }), method(object({
15275
- deviceId: number(),
15276
- action: string().min(1),
15277
- input: unknown()
15278
- }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
15279
- /**
15280
15311
  * camera-credentials — device-scoped cap exposing the camera's network
15281
15312
  * + auth surface in a vendor-neutral shape.
15282
15313
  *
@@ -18959,6 +18990,12 @@ Object.freeze({
18959
18990
  addonId: null,
18960
18991
  access: "view"
18961
18992
  },
18993
+ "metricsProvider.dumpHeapSnapshot": {
18994
+ capName: "metrics-provider",
18995
+ capScope: "system",
18996
+ addonId: null,
18997
+ access: "create"
18998
+ },
18962
18999
  "metricsProvider.getAddonStats": {
18963
19000
  capName: "metrics-provider",
18964
19001
  capScope: "system",