@camstack/addon-provider-rtsp 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +1319 -1094
  2. package/dist/addon.mjs +1319 -1094
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -4642,63 +4642,7 @@ function preprocess(fn, schema) {
4642
4642
  });
4643
4643
  }
4644
4644
  //#endregion
4645
- //#region ../types/dist/index.mjs
4646
- /**
4647
- * Deep wiring healthcheck — snapshot of active reachability probes across
4648
- * every declared capability + widget of every installed plugin, on every
4649
- * node. Produced by the backend `WiringHealthService` and surfaced via
4650
- * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
4651
- *
4652
- * Unlike `/health` (process liveness), this reflects whether each cap/widget
4653
- * is actually *reachable* over the real cap-dispatch path. See spec
4654
- * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
4655
- */
4656
- /** What kind of target a probe addressed. */
4657
- var wiringProbeKindSchema = _enum([
4658
- "singleton",
4659
- "device",
4660
- "widget"
4661
- ]);
4662
- /** Result of probing a single (cap|widget [, device]) target. */
4663
- var wiringProbeResultSchema = object({
4664
- capName: string(),
4665
- kind: wiringProbeKindSchema,
4666
- deviceId: number().optional(),
4667
- reachable: boolean(),
4668
- latencyMs: number(),
4669
- error: string().optional()
4670
- });
4671
- /** Per-addon roll-up of cap + widget probe results. */
4672
- var wiringAddonHealthSchema = object({
4673
- addonId: string(),
4674
- caps: array(wiringProbeResultSchema).readonly(),
4675
- widgets: array(wiringProbeResultSchema).readonly()
4676
- });
4677
- /** Per-node roll-up. */
4678
- var wiringNodeHealthSchema = object({
4679
- nodeId: string(),
4680
- addons: array(wiringAddonHealthSchema).readonly()
4681
- });
4682
- object({
4683
- /** True only when every probed target is reachable. */
4684
- ok: boolean(),
4685
- /** True when at least one target is unreachable. */
4686
- degraded: boolean(),
4687
- checkedAt: string(),
4688
- nodes: array(wiringNodeHealthSchema).readonly(),
4689
- summary: object({
4690
- total: number(),
4691
- reachable: number(),
4692
- unreachable: number()
4693
- })
4694
- });
4695
- var MODEL_FORMATS = [
4696
- "onnx",
4697
- "coreml",
4698
- "openvino",
4699
- "tflite",
4700
- "pt"
4701
- ];
4645
+ //#region ../types/dist/sleep-D7JeS58T.mjs
4702
4646
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4703
4647
  EventCategory["SystemBoot"] = "system.boot";
4704
4648
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -4996,6 +4940,18 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
4996
4940
  */
4997
4941
  EventCategory["PipelineEngineMetricsSnapshot"] = "pipeline.engine-metrics-snapshot";
4998
4942
  /**
4943
+ * Per-node detection-engine runtime-provisioning transition. Emitted by
4944
+ * the detection-pipeline provider on every state change of its lazy
4945
+ * engine-provisioning machine (idle → installing → verifying → ready,
4946
+ * or → failed with a `nextRetryAt`). Payload is the
4947
+ * `EngineProvisioningState` snapshot; `event.source.nodeId` carries the
4948
+ * node. The Pipeline page subscribes to drive a live "installing
4949
+ * OpenVINO… / ready" indicator per node without polling
4950
+ * `pipelineExecutor.getEngineProvisioning`. Telemetry-grade (D8): the UI
4951
+ * also reads the cap snapshot on mount / reconnect. Phase 2.
4952
+ */
4953
+ EventCategory["PipelineEngineProvisioning"] = "pipeline.engine-provisioning";
4954
+ /**
4999
4955
  * Cluster topology snapshot. Carries the same payload returned by
5000
4956
  * `nodes.topology` (every reachable node + addons + processes).
5001
4957
  * Emitted by the hub on any agent / addon lifecycle change
@@ -6009,7 +5965,7 @@ var ProfileSlotSchema = object({
6009
5965
  * Zod schema for StreamSourceEntry — the canonical stream descriptor
6010
5966
  * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
6011
5967
  */
6012
- var StreamSourceEntrySchema = object({
5968
+ var StreamSourceEntrySchema$1 = object({
6013
5969
  id: string(),
6014
5970
  label: string(),
6015
5971
  protocol: _enum([
@@ -6231,926 +6187,1116 @@ var ProfileRtspEntrySchema = object({
6231
6187
  codec: string().optional(),
6232
6188
  resolution: CamStreamResolutionSchema.optional()
6233
6189
  });
6234
- /**
6235
- * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6236
- * Named `RecordingWeekday` to avoid collision with the string-union
6237
- * `Weekday` exported from `interfaces/timezones.ts`.
6238
- */
6239
- var RecordingWeekdaySchema = number().int().min(0).max(6);
6240
- var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6241
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6242
- kind: literal("timeOfDay"),
6243
- start: string().regex(HHMM),
6244
- end: string().regex(HHMM),
6245
- /** Restrict to these weekdays; omit = every day. */
6246
- days: array(RecordingWeekdaySchema).optional()
6247
- })]);
6248
- var RecordingModeSchema = _enum([
6249
- "continuous",
6250
- "onMotion",
6251
- "onAudioThreshold"
6252
- ]);
6253
- /**
6254
- * First-class, authoritative per-camera storage mode the netta choice the UI
6255
- * reads directly (never inferred from `rules`):
6256
- * - `off` not recording.
6257
- * - `events` — record only around triggers (motion / audio threshold),
6258
- * with pre/post-buffer.
6259
- * - `continuous` record 24/7 within the schedule.
6260
- *
6261
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6262
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6263
- */
6264
- var RecordingStorageModeSchema = _enum([
6265
- "off",
6266
- "events",
6267
- "continuous"
6268
- ]);
6269
- /** Which detectors trigger an `events`-mode recording. */
6270
- var RecordingTriggersSchema = object({
6271
- motion: boolean().optional(),
6272
- audioThresholdDbfs: number().optional()
6273
- });
6274
- /**
6275
- * Mode of a single recording band the recorder per-band vocabulary.
6276
- *
6277
- * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6278
- * only ever `continuous` or `events`; "off" is expressed by the absence of a
6279
- * covering band, not by a band value.
6280
- */
6281
- var RecordingBandModeSchema = _enum(["continuous", "events"]);
6282
- /**
6283
- * Triggers for an `events`-mode band. Identical shape to
6284
- * `RecordingTriggersSchema`reuse that schema as the band trigger type so the
6285
- * two never drift.
6286
- */
6287
- var RecordingBandTriggersSchema = RecordingTriggersSchema;
6288
- /**
6289
- * A single mode-per-band window the canonical recorder band shape, the
6290
- * single source of truth re-used by `addon-pipeline/recorder`.
6291
- *
6292
- * `days` lists the weekdays the band covers (empty = every day, matching the
6293
- * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6294
- * span wraps past midnight (handled by the band engine).
6295
- */
6296
- var RecordingBandSchema = object({
6297
- days: array(RecordingWeekdaySchema),
6298
- start: string().regex(HHMM),
6299
- end: string().regex(HHMM),
6300
- mode: RecordingBandModeSchema,
6301
- triggers: RecordingBandTriggersSchema.optional(),
6302
- preBufferSec: number().min(0).optional(),
6303
- postBufferSec: number().min(0).optional()
6304
- });
6305
- var RecordingRuleSchema = object({
6306
- schedule: RecordingScheduleSchema,
6307
- mode: RecordingModeSchema,
6308
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6309
- preBufferSec: number().min(0).default(0),
6310
- /** Keep recording until this many seconds after the last trigger. */
6311
- postBufferSec: number().min(0).default(0),
6312
- /** Each new trigger restarts the post-buffer window. */
6313
- resetTimeoutOnNewEvent: boolean().default(true),
6314
- /** onAudioThreshold only dBFS level that counts as a trigger. */
6315
- thresholdDbfs: number().optional()
6316
- });
6317
- /**
6318
- * Per-device retention overrides. Every field is optional; an unset or `0`
6319
- * value inherits the node-wide recorder default. Only footage-lifetime limits
6320
- * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6321
- * (when the volume is too full to keep recording) is NOT a per-camera concern —
6322
- * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6323
- * shared by every camera writing to that volume.
6324
- */
6325
- var RecordingRetentionSchema = object({
6326
- maxAgeDays: number().min(0).optional(),
6327
- maxSizeGb: number().min(0).optional()
6328
- });
6329
- /**
6330
- * The full per-camera recording intent — the wire shape of a RecordingTarget.
6331
- *
6332
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6333
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6334
- * only for transition + migration (`migrateRulesToMode`); the policy engine
6335
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6336
- */
6337
- var RecordingConfigSchema = object({
6338
- enabled: boolean(),
6339
- /** Authoritative storage mode. Absent on legacy targets → derived once via
6340
- * `migrateRulesToMode`, then persisted. */
6341
- mode: RecordingStorageModeSchema.optional(),
6342
- profiles: array(CamProfileSchema).optional(),
6343
- segmentSeconds: number().int().positive().optional(),
6344
- /** Shared recording time-bands for `events` & `continuous` — record only when
6345
- * the wall-clock falls inside one of these windows. Omit or empty = always.
6346
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
6347
- schedules: array(RecordingScheduleSchema).optional(),
6348
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6349
- * normalized into `schedules` on read and never written going forward. (Not
6350
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6351
- schedule: RecordingScheduleSchema.optional(),
6352
- /** `events`-mode only — which detectors trigger a recording. */
6353
- triggers: RecordingTriggersSchema.optional(),
6354
- /** `events`-mode only — seconds retained before / after a trigger. */
6355
- preBufferSec: number().min(0).optional(),
6356
- postBufferSec: number().min(0).optional(),
6357
- /** DEPRECATED authoring input; retained for migration/transition. */
6358
- rules: array(RecordingRuleSchema).optional(),
6359
- /**
6360
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6361
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6362
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6363
- * derived into bands once via `migrateConfigToBands`.
6364
- */
6365
- bands: array(RecordingBandSchema).optional(),
6366
- retention: RecordingRetentionSchema.optional()
6367
- });
6368
- /**
6369
- * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6370
- * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6371
- * so the persisted record schema and the consumer-facing cap can both consume it
6372
- * without forming a circular import. The `storage` cap re-exports it
6373
- * verbatim for back-compat.
6374
- *
6375
- * This Zod schema is the **authoritative source** for `StorageLocationType`.
6376
- * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6377
- * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6378
- * `IStorageProvider` interface stay in lockstep.
6379
- *
6380
- * The type is now an **open string** (not a closed enum) — addons declare
6381
- * their own location kinds via `StorageLocationDeclaration.id`. The regex
6382
- * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6383
- */
6384
- var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6385
- /**
6386
- * Persisted record for a storage location instance. Operators can register
6387
- * multiple instances for multi-cardinality types (e.g. two `backups`
6388
- * locations with different `providerId`s). Cardinality is now declared per
6389
- * location via `StorageLocationDeclaration.cardinality` — the static
6390
- * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6391
- *
6392
- * `id` is a stable namespaced string of the form `<type>:<slug>`.
6393
- * The default location for a type uses `id === <type>:default` by
6394
- * convention (the bare type ref like `'backups'` resolves to it).
6395
- *
6396
- * `isSystem: true` marks a location as orchestrator-seeded and
6397
- * undeletable. The bootstrap-installed defaults (one per type) carry
6398
- * this flag; operator-added locations don't. Editing the config of
6399
- * a system location is allowed (path migration, provider swap) but
6400
- * deleting it is rejected at the cap level.
6401
- */
6402
- var StorageLocationSchema = object({
6403
- id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6404
- type: string(),
6405
- displayName: string().min(1),
6406
- providerId: string().min(1),
6407
- config: record(string(), unknown()),
6408
- /**
6409
- * Cluster node this location physically lives on. REQUIRED for node-local
6410
- * providers (filesystem — the path exists on one node's disk), null/absent
6411
- * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6412
- * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6413
- * flag at upsert time, not here (the schema is provider-agnostic).
6414
- */
6415
- nodeId: string().optional(),
6416
- isDefault: boolean().default(false),
6417
- isSystem: boolean().default(false),
6418
- createdAt: number(),
6419
- updatedAt: number()
6420
- });
6421
- /**
6422
- * Reference accepted by consumer-facing `api.storage.*` calls.
6423
- * Either:
6424
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
6425
- * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
6426
- *
6427
- * The orchestrator's `resolveRef(ref)` handles both cases.
6428
- */
6429
- var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6430
- /**
6431
- * `StorageLocationDeclaration` — a single storage-location entry declared by
6432
- * an addon in its `package.json` under `camstack.storageLocations`.
6433
- *
6434
- * Design intent:
6435
- * - **Addon declares its needs** — each addon describes the logical storage
6436
- * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6437
- * about the physical path.
6438
- * - **Kernel aggregates** — at boot the kernel collects declarations from all
6439
- * installed addons, deduplicates by `id`, and exposes the union via the
6440
- * storage-locations settings surface.
6441
- * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6442
- * at least one instance named `<id>:default` is present, using
6443
- * `defaultsTo` to inherit the resolved root from another location when the
6444
- * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6445
- * `recordings`).
6446
- * - **ids are global** — `id` values are shared across the entire deployment;
6447
- * two addons declaring the same `id` must agree on `cardinality` (validated
6448
- * at kernel aggregation time, not here).
6449
- */
6450
- var StorageLocationDeclarationSchema = object({
6190
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6191
+ DeviceType["Camera"] = "camera";
6192
+ DeviceType["Hub"] = "hub";
6193
+ DeviceType["Light"] = "light";
6194
+ DeviceType["Siren"] = "siren";
6195
+ DeviceType["Switch"] = "switch";
6196
+ DeviceType["Sensor"] = "sensor";
6197
+ DeviceType["Thermostat"] = "thermostat";
6198
+ DeviceType["Button"] = "button";
6199
+ /** Generic stateless event emitter — carries a device's EXACT declared
6200
+ * event vocabulary verbatim (no normalization). Installed with the
6201
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6202
+ * HA bus events (e.g. `zha_event`, generic). */
6203
+ DeviceType["EventEmitter"] = "event-emitter";
6204
+ /** Firmware/software update entity — current vs available version,
6205
+ * updatable flag, update state, and an install action. Installed with
6206
+ * the `update` cap. Sources: Homematic firmware-update channels (and
6207
+ * reusable by other providers, e.g. HA `update.*` entities). */
6208
+ DeviceType["Update"] = "update";
6209
+ DeviceType["Generic"] = "generic";
6210
+ /** Generic notification delivery target (HA `notify.<service>`, future
6211
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6212
+ * endpoint; the `notifier` cap defines the send surface. */
6213
+ DeviceType["Notifier"] = "notifier";
6214
+ /** Pre-recorded action sequence with optional parameters
6215
+ * (HA `script.*`). Runnable via `script-runner` cap. */
6216
+ DeviceType["Script"] = "script";
6217
+ /** Automation rule (HA `automation.*`) enable/disable + manual
6218
+ * trigger surface exposed via `automation-control` cap. */
6219
+ DeviceType["Automation"] = "automation";
6220
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6221
+ DeviceType["Lock"] = "lock";
6222
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6223
+ * `valve.*`). `cover` cap with sub-roles for variant. */
6224
+ DeviceType["Cover"] = "cover";
6225
+ /** Pipe / water / gas valve with open/close/stop and optional
6226
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6227
+ * modelled on the same open/closed lifecycle. */
6228
+ DeviceType["Valve"] = "valve";
6229
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
6230
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6231
+ * modelled on the same target / mode lifecycle. */
6232
+ DeviceType["Humidifier"] = "humidifier";
6233
+ /** Water heater / boiler with target temperature + operation mode +
6234
+ * away mode (HA `water_heater.*`). `water-heater` cap a
6235
+ * climate-family actuator. */
6236
+ DeviceType["WaterHeater"] = "water-heater";
6237
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6238
+ DeviceType["Fan"] = "fan";
6239
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6240
+ * the camera surface those use `Camera`. `media-player` cap. */
6241
+ DeviceType["MediaPlayer"] = "media-player";
6242
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
6243
+ * `alarm-panel` cap. */
6244
+ DeviceType["AlarmPanel"] = "alarm-panel";
6245
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
6246
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
6247
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6248
+ * TextControl / DateTimeControl. */
6249
+ DeviceType["Control"] = "control";
6250
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6251
+ * `presence` cap. */
6252
+ DeviceType["Presence"] = "presence";
6253
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6254
+ * `weather` cap. */
6255
+ DeviceType["Weather"] = "weather";
6256
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6257
+ DeviceType["Vacuum"] = "vacuum";
6258
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6259
+ * `lawn-mower-control` cap. */
6260
+ DeviceType["LawnMower"] = "lawn-mower";
6261
+ /** Physical HA device group — parent container for entity-children
6262
+ * adopted from a single HA device entry. Not renderable as a
6263
+ * standalone device; exists only to anchor child entities. */
6264
+ DeviceType["Container"] = "container";
6265
+ /** Single still-image entity (HA `image.*`). Read-only display of an
6266
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
6267
+ DeviceType["Image"] = "image";
6268
+ return DeviceType;
6269
+ }({});
6270
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6271
+ DeviceFeature["BatteryOperated"] = "battery-operated";
6272
+ DeviceFeature["Rebootable"] = "rebootable";
6451
6273
  /**
6452
- * Global location identifier, e.g. `recordings` or `recordingsLow`.
6453
- * Must start with a lowercase letter and may contain letters, digits, and
6454
- * hyphens.
6274
+ * Device supports an on-demand re-sync of its derived spec with its
6275
+ * upstream source drives the generic Re-sync button. The owning
6276
+ * provider implements the action via the `device-adoption.resync` cap.
6455
6277
  */
6456
- id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6457
- /** Human-readable name shown in the admin UI. */
6458
- displayName: string().min(1, { message: "displayName must not be empty" }),
6459
- /** Optional longer explanation of what data this location stores. */
6460
- description: string().optional(),
6278
+ DeviceFeature["Resyncable"] = "resyncable";
6279
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
6280
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
6281
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
6282
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6461
6283
  /**
6462
- * `single` exactly one instance of this location is allowed system-wide
6463
- * (e.g. `logs`, `models`). The operator can edit it but not add more.
6464
- * `multi` — the operator may register several instances (e.g. a second
6465
- * `recordings` on a NAS for disk tiering); one is the default at any time.
6284
+ * Camera supports the on-firmware autotrack subsystem (subject-
6285
+ * following). Distinct from `PanTiltZoom` because not every PTZ
6286
+ * camera ships autotrack — the admin UI uses this flag to gate
6287
+ * the autotrack toggle / settings card without re-deriving from
6288
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
6289
+ * driver sets this feature when probe confirms the firmware
6290
+ * surface, and registers the cap in the same code path.
6466
6291
  */
6467
- cardinality: _enum(["single", "multi"]),
6292
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6468
6293
  /**
6469
- * When set, the default instance for this location inherits its resolved
6470
- * root from the named location's default instance. Useful for derivative
6471
- * slots (e.g. `recordingsLow` `recordings`) so operators only need to
6472
- * configure the primary location.
6294
+ * Accessory exposes a "trigger on motion" toggle the parent camera's
6295
+ * motion detection automatically activates this device. Mirrors
6296
+ * `motion-trigger` cap registration: drivers set this feature in the
6297
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6298
+ *
6299
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6300
+ * fast scalar without binding fetch), notifier rules, and `listAll`
6301
+ * filters that want "all devices with on-motion behaviour".
6473
6302
  */
6474
- defaultsTo: string().optional()
6475
- });
6476
- /**
6477
- * Compute pixel count for sorting. Returns w*h, or 0 if unknown.
6478
- */
6479
- function streamPixels(meta) {
6480
- return (meta.width ?? 0) * (meta.height ?? 0);
6481
- }
6303
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
6304
+ /** Light supports rgb-triplet color via `color` cap. */
6305
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
6306
+ /** Light supports HSV color via `color` cap. */
6307
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
6308
+ /** Light supports color-temperature (mired) via `color` cap. */
6309
+ DeviceFeature["LightColorMired"] = "light-color-mired";
6310
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6311
+ * targetHigh). Gates the range slider UI. */
6312
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
6313
+ /** Thermostat exposes target humidity and/or current humidity
6314
+ * readings. Gates the humidity controls. */
6315
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
6316
+ /** Thermostat exposes a fan-mode selector. */
6317
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
6318
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
6319
+ DeviceFeature["ClimatePreset"] = "climate-preset";
6320
+ /** Cover exposes intermediate position control (0..100). Gates the
6321
+ * position slider UI. */
6322
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
6323
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
6324
+ DeviceFeature["CoverTilt"] = "cover-tilt";
6325
+ /** Valve exposes intermediate position control (0..100). Gates the
6326
+ * position slider / drag surface UI. */
6327
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
6328
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
6329
+ DeviceFeature["FanSpeed"] = "fan-speed";
6330
+ /** Fan exposes a preset mode selector. */
6331
+ DeviceFeature["FanPreset"] = "fan-preset";
6332
+ /** Fan exposes blade direction (forward/reverse) — typical of
6333
+ * ceiling fans. */
6334
+ DeviceFeature["FanDirection"] = "fan-direction";
6335
+ /** Fan exposes an oscillation toggle. */
6336
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
6337
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
6338
+ * field on the UI lock-controls panel. */
6339
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
6340
+ /** Lock supports a latch-release ("open door") action distinct from
6341
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
6342
+ * `supported_features`. Gates the Open Door button in the UI. */
6343
+ DeviceFeature["LockOpen"] = "lock-open";
6344
+ /** Media player exposes a seek-to-position surface. */
6345
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
6346
+ /** Media player exposes a volume-level setter. */
6347
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
6348
+ /** Media player exposes a mute toggle distinct from volume=0. */
6349
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
6350
+ /** Media player exposes a shuffle toggle. */
6351
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
6352
+ /** Media player exposes a repeat mode (off / all / one). */
6353
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
6354
+ /** Media player exposes a source / input selector. */
6355
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
6356
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
6357
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
6358
+ /** Media player exposes next-track. */
6359
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
6360
+ /** Media player exposes previous-track. */
6361
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
6362
+ /** Media player exposes stop distinct from pause. */
6363
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
6364
+ /** Alarm panel requires a PIN code on arm/disarm. */
6365
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
6366
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
6367
+ * addition to a textual location. */
6368
+ DeviceFeature["PresenceGps"] = "presence-gps";
6369
+ /** Notifier accepts an inline / URL image attachment. */
6370
+ DeviceFeature["NotifierImage"] = "notifier-image";
6371
+ /** Notifier accepts a priority hint (high/normal/low). */
6372
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
6373
+ /** Notifier accepts a free-form `data` payload for platform-specific
6374
+ * fields. */
6375
+ DeviceFeature["NotifierData"] = "notifier-data";
6376
+ /** Notifier supports interactive action buttons / callbacks. */
6377
+ DeviceFeature["NotifierActions"] = "notifier-actions";
6378
+ /** Notifier supports per-call recipient targeting (multi-user). */
6379
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
6380
+ /** Script runner accepts a variables map on each run invocation. */
6381
+ DeviceFeature["ScriptVariables"] = "script-variables";
6382
+ /** Automation `trigger` accepts a skipCondition flag — fires the
6383
+ * automation's actions while bypassing its condition block. */
6384
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
6385
+ return DeviceFeature;
6386
+ }({});
6482
6387
  /**
6483
- * Classify streams relative to each other.
6484
- * Highest resolution high, lowest low, everything else → mid.
6485
- * With 1 stream: high. With 2: high + low.
6388
+ * Semantic role a device plays within its parent. Populated by driver
6389
+ * addons when creating accessory devices (Reolink siren/floodlight/
6390
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
6391
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
6392
+ * `role: Floodlight` renders as a bulb with a brightness slider,
6393
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
6394
+ *
6395
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
6396
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
6486
6397
  */
6487
- function classifyStreams(streams) {
6488
- if (streams.length === 0) return [];
6489
- const sorted = streams.map((s, i) => ({
6490
- s,
6491
- i,
6492
- px: streamPixels(s.metadata ?? {})
6493
- })).toSorted((a, b) => b.px - a.px);
6494
- const result = Array.from({ length: streams.length });
6495
- for (let rank = 0; rank < sorted.length; rank++) {
6496
- const { s, i } = sorted[rank];
6497
- let quality;
6498
- if (rank === 0) quality = "high";
6499
- else if (rank === sorted.length - 1) quality = "low";
6500
- else quality = "mid";
6501
- result[i] = {
6502
- ...s,
6503
- quality
6504
- };
6505
- }
6506
- return result;
6398
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6399
+ DeviceRole["Siren"] = "siren";
6400
+ DeviceRole["Floodlight"] = "floodlight";
6401
+ DeviceRole["Spotlight"] = "spotlight";
6402
+ DeviceRole["PirSensor"] = "pir-sensor";
6403
+ DeviceRole["Chime"] = "chime";
6404
+ DeviceRole["Autotrack"] = "autotrack";
6405
+ DeviceRole["Nightvision"] = "nightvision";
6406
+ DeviceRole["PrivacyMask"] = "privacy-mask";
6407
+ DeviceRole["Doorbell"] = "doorbell";
6408
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
6409
+ * real Switch device for UI rendering / export adapters. */
6410
+ DeviceRole["BinaryHelper"] = "binary-helper";
6411
+ /** Generic motion / occupancy / moving event source. Distinct from
6412
+ * the camera accessory PirSensor role: that one is a camera child;
6413
+ * this is a standalone HA / 3rd-party motion sensor. */
6414
+ DeviceRole["MotionSensor"] = "motion-sensor";
6415
+ DeviceRole["ContactSensor"] = "contact-sensor";
6416
+ DeviceRole["LeakSensor"] = "leak-sensor";
6417
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
6418
+ DeviceRole["COSensor"] = "co-sensor";
6419
+ DeviceRole["GasSensor"] = "gas-sensor";
6420
+ DeviceRole["TamperSensor"] = "tamper-sensor";
6421
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
6422
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
6423
+ DeviceRole["SoundSensor"] = "sound-sensor";
6424
+ /** Fallback for `binary_sensor` without a known `device_class`. */
6425
+ DeviceRole["BinarySensor"] = "binary-sensor";
6426
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
6427
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
6428
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6429
+ DeviceRole["PressureSensor"] = "pressure-sensor";
6430
+ DeviceRole["PowerSensor"] = "power-sensor";
6431
+ DeviceRole["EnergySensor"] = "energy-sensor";
6432
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
6433
+ DeviceRole["CurrentSensor"] = "current-sensor";
6434
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
6435
+ /** Battery level (numeric % via `sensor` OR low-bool via
6436
+ * `binary_sensor` — the cap distinguishes via the value type). */
6437
+ DeviceRole["BatterySensor"] = "battery-sensor";
6438
+ /** Fallback for `sensor` numeric without a known `device_class`. */
6439
+ DeviceRole["NumericSensor"] = "numeric-sensor";
6440
+ /** String / enum state (HA `sensor` with `state_class: enum` or
6441
+ * `attributes.options`). */
6442
+ DeviceRole["EnumSensor"] = "enum-sensor";
6443
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
6444
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
6445
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
6446
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
6447
+ /** Last-resort fallback when nothing else matches. */
6448
+ DeviceRole["GenericSensor"] = "generic-sensor";
6449
+ DeviceRole["NumericControl"] = "numeric-control";
6450
+ DeviceRole["SelectControl"] = "select-control";
6451
+ DeviceRole["TextControl"] = "text-control";
6452
+ DeviceRole["DateTimeControl"] = "datetime-control";
6453
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
6454
+ * rich features (image, priority, channel routing). */
6455
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
6456
+ /** Chat / messaging service (HA `notify.telegram_*`,
6457
+ * `notify.discord_*`, etc.). */
6458
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
6459
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
6460
+ DeviceRole["EmailNotifier"] = "email-notifier";
6461
+ /** Fallback when the notifier service name doesn't match a known
6462
+ * pattern. */
6463
+ DeviceRole["GenericNotifier"] = "generic-notifier";
6464
+ return DeviceRole;
6465
+ }({});
6466
+ /**
6467
+ * Generic types for capability definitions.
6468
+ *
6469
+ * A capability is defined with Zod schemas for methods, events, and settings.
6470
+ * TypeScript types are inferred via z.infer<> — zero duplication.
6471
+ *
6472
+ * Pattern:
6473
+ * 1. Define Zod schemas for data, methods, settings
6474
+ * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
6475
+ * 3. Export type IProvider = InferProvider<typeof capabilityDef>
6476
+ * 4. Addon implements IProvider
6477
+ * 5. Registry auto-mounts tRPC router from definition.methods
6478
+ */
6479
+ /**
6480
+ * Output schema shared by the contribution + live methods.
6481
+ *
6482
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
6483
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
6484
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
6485
+ * (using `z.unknown()` here collapses unrelated router branches to
6486
+ * `unknown` when the generator re-inlines the huge AppRouter type).
6487
+ *
6488
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
6489
+ * extensions the caller adds (showWhen, displayScale, …) without
6490
+ * rebuilding every time a new field kind is introduced.
6491
+ */
6492
+ var ContributionSectionSchema = object({
6493
+ id: string(),
6494
+ title: string(),
6495
+ description: string().optional(),
6496
+ style: _enum(["card", "accordion"]).optional(),
6497
+ defaultCollapsed: boolean().optional(),
6498
+ columns: union([
6499
+ literal(1),
6500
+ literal(2),
6501
+ literal(3),
6502
+ literal(4)
6503
+ ]).optional(),
6504
+ tab: string().optional(),
6505
+ location: _enum(["settings", "top-tab"]).optional(),
6506
+ order: number().optional(),
6507
+ fields: array(any())
6508
+ });
6509
+ object({
6510
+ tabs: array(object({
6511
+ id: string(),
6512
+ label: string(),
6513
+ icon: string(),
6514
+ order: number().optional()
6515
+ })).optional(),
6516
+ sections: array(ContributionSectionSchema)
6517
+ }).nullable();
6518
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
6519
+ deviceId: number(),
6520
+ patch: record(string(), unknown())
6521
+ }), object({ success: literal(true) });
6522
+ object({ deviceId: number() }), unknown().nullable();
6523
+ /** Shorthand to define a method schema */
6524
+ function method(input, output, options) {
6525
+ return {
6526
+ input,
6527
+ output,
6528
+ kind: options?.kind ?? "query",
6529
+ auth: options?.auth ?? "protected",
6530
+ ...options?.access !== void 0 ? { access: options.access } : {},
6531
+ timeoutMs: options?.timeoutMs
6532
+ };
6507
6533
  }
6508
- var DecoderStatsSchema = object({
6509
- inputFps: number(),
6510
- outputFps: number(),
6511
- avgDecodeTimeMs: number(),
6512
- droppedFrames: number()
6534
+ /** Shorthand to define an event schema */
6535
+ function event(data) {
6536
+ return { data };
6537
+ }
6538
+ var StaticDirOutputSchema = object({ staticDir: string() });
6539
+ var VersionOutputSchema = object({ version: string() });
6540
+ method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6541
+ /**
6542
+ * device-ops — device-scoped cap that unifies the per-IDevice operations
6543
+ * previously routed through the `.device-ops` Moleculer bridge service.
6544
+ *
6545
+ * Each worker that hosts live `IDevice` instances auto-registers a native
6546
+ * provider for this cap (per device) backed by its local
6547
+ * `DeviceRegistry`. Hub-side callers reach it transparently through
6548
+ * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
6549
+ * `deviceId` + `nodeId` and dispatches through the standard cap-router,
6550
+ * so there's no parallel bridge path anymore.
6551
+ *
6552
+ * The surface is intentionally small — every method corresponds to a
6553
+ * single action on the live `IDevice` (or `ICameraDevice` for
6554
+ * `getStreamSources`). Richer orchestration (enable/disable with
6555
+ * integration plumbing, bulk updates) stays in the `device-manager` cap;
6556
+ * `device-ops` is the per-device primitive the device-manager routes to.
6557
+ */
6558
+ var StreamSourceEntrySchema = object({
6559
+ id: string(),
6560
+ label: string(),
6561
+ protocol: _enum([
6562
+ "rtsp",
6563
+ "rtmp",
6564
+ "annexb",
6565
+ "http-mjpeg",
6566
+ "webrtc",
6567
+ "custom"
6568
+ ]),
6569
+ url: string().optional(),
6570
+ resolution: object({
6571
+ width: number(),
6572
+ height: number()
6573
+ }).optional(),
6574
+ fps: number().optional(),
6575
+ bitrate: number().optional(),
6576
+ codec: string().optional(),
6577
+ profileHint: CamProfileSchema.optional(),
6578
+ sdp: string().optional()
6513
6579
  });
6514
- var DecoderSessionConfigSchema = object({
6515
- codec: string(),
6516
- maxFps: number().default(0),
6517
- outputFormat: _enum([
6518
- "jpeg",
6519
- "rgb",
6520
- "bgr",
6521
- "yuv420",
6522
- "gray"
6523
- ]).default("jpeg"),
6524
- scale: number().default(1),
6525
- width: number().optional(),
6526
- height: number().optional(),
6527
- /**
6528
- * Identifier of the camera this decoder session serves. Optional
6529
- * because the cap is generic (any caller could request decode), but
6530
- * stream-broker passes it so decoder logs include `deviceId` for
6531
- * per-camera filtering when diagnosing failures (e.g. node-av
6532
- * sendPacket errors on a single hung camera).
6533
- */
6534
- deviceId: number().int().nonnegative().optional(),
6535
- /**
6536
- * Free-form tag for log scoping. Stream-broker uses
6537
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6538
- * on every line so `grep tag=broker:5/high` filters one camera
6539
- * profile cleanly.
6540
- */
6541
- tag: string().optional(),
6542
- /**
6543
- * Where the session delivers decoded frames (Phase 5 / D9):
6544
- *
6545
- * - `'callback'` (default) — the legacy pixel path: decoded frames are
6546
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
6547
- * - `'shm'` — the shared-memory frame plane: decoded frames are written
6548
- * into an OS shared-memory ring and drained as zero-pixel
6549
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
6550
- * other — `pullFrames` returns nothing for an `'shm'` session and
6551
- * `pullHandles` returns nothing for a `'callback'` session.
6552
- */
6553
- frameSink: _enum(["callback", "shm"]).default("callback")
6580
+ var ConfigEntrySchema$1 = object({
6581
+ key: string(),
6582
+ value: unknown()
6554
6583
  });
6555
- var EncodeProfileSchema = object({
6556
- video: object({
6557
- codec: _enum([
6558
- "h264",
6559
- "h265",
6560
- "copy"
6561
- ]),
6562
- profile: _enum([
6563
- "baseline",
6564
- "main",
6565
- "high"
6566
- ]).optional(),
6567
- width: number().int().positive().optional(),
6568
- height: number().int().positive().optional(),
6569
- fps: number().positive().optional(),
6570
- bitrateKbps: number().int().positive().optional(),
6571
- gopFrames: number().int().positive().optional(),
6572
- bf: number().int().min(0).optional(),
6573
- preset: _enum([
6574
- "ultrafast",
6575
- "superfast",
6576
- "veryfast",
6577
- "faster",
6578
- "fast",
6579
- "medium"
6580
- ]).optional(),
6581
- tune: _enum([
6582
- "zerolatency",
6583
- "film",
6584
- "animation"
6585
- ]).optional()
6586
- }),
6587
- audio: union([literal("passthrough"), object({
6588
- codec: _enum([
6589
- "opus",
6590
- "aac",
6591
- "pcmu",
6592
- "pcma",
6593
- "copy"
6594
- ]),
6595
- bitrateKbps: number().int().positive().optional(),
6596
- sampleRateHz: number().int().positive().optional(),
6597
- channels: union([literal(1), literal(2)]).optional()
6598
- })]),
6599
- /**
6600
- * ffmpeg input-side args, inserted between the fixed global flags
6601
- * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6602
- * the widget surfaces a textarea + suggestion chips for the most-
6603
- * used demuxer/format options.
6604
- */
6605
- inputArgs: array(string()).optional(),
6584
+ var RawStateResultSchema = object({
6585
+ /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
6586
+ source: string(),
6587
+ /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
6588
+ data: record(string(), unknown())
6589
+ });
6590
+ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
6591
+ deviceId: number(),
6592
+ values: record(string(), unknown())
6593
+ }), _void(), { kind: "mutation" }), method(object({
6594
+ deviceId: number(),
6595
+ action: string().min(1),
6596
+ input: unknown()
6597
+ }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
6598
+ //#endregion
6599
+ //#region ../types/dist/index.mjs
6600
+ /**
6601
+ * Deep wiring healthcheck — snapshot of active reachability probes across
6602
+ * every declared capability + widget of every installed plugin, on every
6603
+ * node. Produced by the backend `WiringHealthService` and surfaced via
6604
+ * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
6605
+ *
6606
+ * Unlike `/health` (process liveness), this reflects whether each cap/widget
6607
+ * is actually *reachable* over the real cap-dispatch path. See spec
6608
+ * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
6609
+ */
6610
+ /** What kind of target a probe addressed. */
6611
+ var wiringProbeKindSchema = _enum([
6612
+ "singleton",
6613
+ "device",
6614
+ "widget"
6615
+ ]);
6616
+ /** Result of probing a single (cap|widget [, device]) target. */
6617
+ var wiringProbeResultSchema = object({
6618
+ capName: string(),
6619
+ kind: wiringProbeKindSchema,
6620
+ deviceId: number().optional(),
6621
+ reachable: boolean(),
6622
+ latencyMs: number(),
6623
+ error: string().optional()
6624
+ });
6625
+ /** Per-addon roll-up of cap + widget probe results. */
6626
+ var wiringAddonHealthSchema = object({
6627
+ addonId: string(),
6628
+ caps: array(wiringProbeResultSchema).readonly(),
6629
+ widgets: array(wiringProbeResultSchema).readonly()
6630
+ });
6631
+ /** Per-node roll-up. */
6632
+ var wiringNodeHealthSchema = object({
6633
+ nodeId: string(),
6634
+ addons: array(wiringAddonHealthSchema).readonly()
6635
+ });
6636
+ object({
6637
+ /** True only when every probed target is reachable. */
6638
+ ok: boolean(),
6639
+ /** True when at least one target is unreachable. */
6640
+ degraded: boolean(),
6641
+ checkedAt: string(),
6642
+ nodes: array(wiringNodeHealthSchema).readonly(),
6643
+ summary: object({
6644
+ total: number(),
6645
+ reachable: number(),
6646
+ unreachable: number()
6647
+ })
6648
+ });
6649
+ var MODEL_FORMATS = [
6650
+ "onnx",
6651
+ "coreml",
6652
+ "openvino",
6653
+ "tflite",
6654
+ "pt"
6655
+ ];
6656
+ /**
6657
+ * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6658
+ * Named `RecordingWeekday` to avoid collision with the string-union
6659
+ * `Weekday` exported from `interfaces/timezones.ts`.
6660
+ */
6661
+ var RecordingWeekdaySchema = number().int().min(0).max(6);
6662
+ var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6663
+ var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6664
+ kind: literal("timeOfDay"),
6665
+ start: string().regex(HHMM),
6666
+ end: string().regex(HHMM),
6667
+ /** Restrict to these weekdays; omit = every day. */
6668
+ days: array(RecordingWeekdaySchema).optional()
6669
+ })]);
6670
+ var RecordingModeSchema = _enum([
6671
+ "continuous",
6672
+ "onMotion",
6673
+ "onAudioThreshold"
6674
+ ]);
6675
+ /**
6676
+ * First-class, authoritative per-camera storage mode — the netta choice the UI
6677
+ * reads directly (never inferred from `rules`):
6678
+ * - `off` — not recording.
6679
+ * - `events` — record only around triggers (motion / audio threshold),
6680
+ * with pre/post-buffer.
6681
+ * - `continuous` — record 24/7 within the schedule.
6682
+ *
6683
+ * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6684
+ * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6685
+ */
6686
+ var RecordingStorageModeSchema = _enum([
6687
+ "off",
6688
+ "events",
6689
+ "continuous"
6690
+ ]);
6691
+ /** Which detectors trigger an `events`-mode recording. */
6692
+ var RecordingTriggersSchema = object({
6693
+ motion: boolean().optional(),
6694
+ audioThresholdDbfs: number().optional()
6695
+ });
6696
+ /**
6697
+ * Mode of a single recording band — the recorder per-band vocabulary.
6698
+ *
6699
+ * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6700
+ * only ever `continuous` or `events`; "off" is expressed by the absence of a
6701
+ * covering band, not by a band value.
6702
+ */
6703
+ var RecordingBandModeSchema = _enum(["continuous", "events"]);
6704
+ /**
6705
+ * Triggers for an `events`-mode band. Identical shape to
6706
+ * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6707
+ * two never drift.
6708
+ */
6709
+ var RecordingBandTriggersSchema = RecordingTriggersSchema;
6710
+ /**
6711
+ * A single mode-per-band window — the canonical recorder band shape, the
6712
+ * single source of truth re-used by `addon-pipeline/recorder`.
6713
+ *
6714
+ * `days` lists the weekdays the band covers (empty = every day, matching the
6715
+ * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6716
+ * span wraps past midnight (handled by the band engine).
6717
+ */
6718
+ var RecordingBandSchema = object({
6719
+ days: array(RecordingWeekdaySchema),
6720
+ start: string().regex(HHMM),
6721
+ end: string().regex(HHMM),
6722
+ mode: RecordingBandModeSchema,
6723
+ triggers: RecordingBandTriggersSchema.optional(),
6724
+ preBufferSec: number().min(0).optional(),
6725
+ postBufferSec: number().min(0).optional()
6726
+ });
6727
+ var RecordingRuleSchema = object({
6728
+ schedule: RecordingScheduleSchema,
6729
+ mode: RecordingModeSchema,
6730
+ /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6731
+ preBufferSec: number().min(0).default(0),
6732
+ /** Keep recording until this many seconds after the last trigger. */
6733
+ postBufferSec: number().min(0).default(0),
6734
+ /** Each new trigger restarts the post-buffer window. */
6735
+ resetTimeoutOnNewEvent: boolean().default(true),
6736
+ /** onAudioThreshold only — dBFS level that counts as a trigger. */
6737
+ thresholdDbfs: number().optional()
6738
+ });
6739
+ /**
6740
+ * Per-device retention overrides. Every field is optional; an unset or `0`
6741
+ * value inherits the node-wide recorder default. Only footage-lifetime limits
6742
+ * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6743
+ * (when the volume is too full to keep recording) is NOT a per-camera concern —
6744
+ * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6745
+ * shared by every camera writing to that volume.
6746
+ */
6747
+ var RecordingRetentionSchema = object({
6748
+ maxAgeDays: number().min(0).optional(),
6749
+ maxSizeGb: number().min(0).optional()
6750
+ });
6751
+ /**
6752
+ * The full per-camera recording intent — the wire shape of a RecordingTarget.
6753
+ *
6754
+ * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6755
+ * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6756
+ * only for transition + migration (`migrateRulesToMode`); the policy engine
6757
+ * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6758
+ */
6759
+ var RecordingConfigSchema = object({
6760
+ enabled: boolean(),
6761
+ /** Authoritative storage mode. Absent on legacy targets → derived once via
6762
+ * `migrateRulesToMode`, then persisted. */
6763
+ mode: RecordingStorageModeSchema.optional(),
6764
+ profiles: array(CamProfileSchema).optional(),
6765
+ segmentSeconds: number().int().positive().optional(),
6766
+ /** Shared recording time-bands for `events` & `continuous` — record only when
6767
+ * the wall-clock falls inside one of these windows. Omit or empty = always.
6768
+ * `continuous` compiles to one rule per band; `events` to band × trigger. */
6769
+ schedules: array(RecordingScheduleSchema).optional(),
6770
+ /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6771
+ * normalized into `schedules` on read and never written going forward. (Not
6772
+ * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6773
+ schedule: RecordingScheduleSchema.optional(),
6774
+ /** `events`-mode only — which detectors trigger a recording. */
6775
+ triggers: RecordingTriggersSchema.optional(),
6776
+ /** `events`-mode only — seconds retained before / after a trigger. */
6777
+ preBufferSec: number().min(0).optional(),
6778
+ postBufferSec: number().min(0).optional(),
6779
+ /** DEPRECATED authoring input; retained for migration/transition. */
6780
+ rules: array(RecordingRuleSchema).optional(),
6606
6781
  /**
6607
- * ffmpeg output-side args, inserted between the encode block and
6608
- * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6609
- * filters, codec-specific overrides. Free-text array.
6782
+ * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6783
+ * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6784
+ * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6785
+ * derived into bands once via `migrateConfigToBands`.
6610
6786
  */
6611
- outputArgs: array(string()).optional()
6787
+ bands: array(RecordingBandSchema).optional(),
6788
+ retention: RecordingRetentionSchema.optional()
6612
6789
  });
6613
- var YAMNET_TO_MACRO = {
6614
- mapping: {
6615
- Speech: "speech",
6616
- "Child speech, kid speaking": "speech",
6617
- Conversation: "speech",
6618
- "Narration, monologue": "speech",
6619
- Babbling: "speech",
6620
- Whispering: "speech",
6621
- "Speech synthesizer": "speech",
6622
- Humming: "speech",
6623
- Rapping: "speech",
6624
- Singing: "speech",
6625
- Choir: "speech",
6626
- "Child singing": "speech",
6627
- Shout: "scream",
6628
- Bellow: "scream",
6629
- Yell: "scream",
6630
- Screaming: "scream",
6631
- "Children shouting": "scream",
6632
- Whoop: "scream",
6633
- "Crying, sobbing": "crying",
6634
- "Baby cry, infant cry": "crying",
6635
- Whimper: "crying",
6636
- "Wail, moan": "crying",
6637
- Groan: "crying",
6638
- Laughter: "laughter",
6639
- "Baby laughter": "laughter",
6640
- Giggle: "laughter",
6641
- Snicker: "laughter",
6642
- "Belly laugh": "laughter",
6643
- "Chuckle, chortle": "laughter",
6644
- Music: "music",
6645
- "Musical instrument": "music",
6646
- Guitar: "music",
6647
- Piano: "music",
6648
- Drum: "music",
6649
- "Drum kit": "music",
6650
- "Violin, fiddle": "music",
6651
- Flute: "music",
6652
- Saxophone: "music",
6653
- Trumpet: "music",
6654
- Synthesizer: "music",
6655
- "Pop music": "music",
6656
- "Rock music": "music",
6657
- "Hip hop music": "music",
6658
- "Classical music": "music",
6659
- Jazz: "music",
6660
- "Electronic music": "music",
6661
- "Background music": "music",
6662
- Dog: "dog",
6663
- Bark: "dog",
6664
- Yip: "dog",
6665
- Howl: "dog",
6666
- "Bow-wow": "dog",
6667
- Growling: "dog",
6668
- "Whimper (dog)": "dog",
6669
- Cat: "cat",
6670
- Purr: "cat",
6671
- Meow: "cat",
6672
- Hiss: "cat",
6673
- Caterwaul: "cat",
6674
- Bird: "bird",
6675
- "Bird vocalization, bird call, bird song": "bird",
6676
- "Chirp, tweet": "bird",
6677
- Squawk: "bird",
6678
- Crow: "bird",
6679
- Owl: "bird",
6680
- "Pigeon, dove": "bird",
6681
- Animal: "animal",
6682
- "Domestic animals, pets": "animal",
6683
- "Livestock, farm animals, working animals": "animal",
6684
- Horse: "animal",
6685
- "Cattle, bovinae": "animal",
6686
- Pig: "animal",
6687
- Sheep: "animal",
6688
- Goat: "animal",
6689
- Frog: "animal",
6690
- Insect: "animal",
6691
- Cricket: "animal",
6692
- Alarm: "alarm",
6693
- "Alarm clock": "alarm",
6694
- "Smoke detector, smoke alarm": "alarm",
6695
- "Fire alarm": "alarm",
6696
- Buzzer: "alarm",
6697
- "Civil defense siren": "alarm",
6698
- "Car alarm": "alarm",
6699
- Siren: "siren",
6700
- "Police car (siren)": "siren",
6701
- "Ambulance (siren)": "siren",
6702
- "Fire engine, fire truck (siren)": "siren",
6703
- "Emergency vehicle": "siren",
6704
- Foghorn: "siren",
6705
- Doorbell: "doorbell",
6706
- "Ding-dong": "doorbell",
6707
- Knock: "doorbell",
6708
- Tap: "doorbell",
6709
- Glass: "glass_breaking",
6710
- Shatter: "glass_breaking",
6711
- "Chink, clink": "glass_breaking",
6712
- "Gunshot, gunfire": "gunshot",
6713
- "Machine gun": "gunshot",
6714
- Explosion: "gunshot",
6715
- Fireworks: "gunshot",
6716
- Firecracker: "gunshot",
6717
- "Artillery fire": "gunshot",
6718
- "Cap gun": "gunshot",
6719
- Boom: "gunshot",
6720
- Vehicle: "vehicle",
6721
- Car: "vehicle",
6722
- Truck: "vehicle",
6723
- Bus: "vehicle",
6724
- Motorcycle: "vehicle",
6725
- "Car passing by": "vehicle",
6726
- "Vehicle horn, car horn, honking": "vehicle",
6727
- "Traffic noise, roadway noise": "vehicle",
6728
- Train: "vehicle",
6729
- Aircraft: "vehicle",
6730
- Helicopter: "vehicle",
6731
- Bicycle: "vehicle",
6732
- Skateboard: "vehicle",
6733
- Fire: "fire",
6734
- Crackle: "fire",
6735
- Water: "water",
6736
- Rain: "water",
6737
- Raindrop: "water",
6738
- "Rain on surface": "water",
6739
- Stream: "water",
6740
- Waterfall: "water",
6741
- Ocean: "water",
6742
- "Waves, surf": "water",
6743
- "Splash, splatter": "water",
6744
- Wind: "wind",
6745
- Thunderstorm: "wind",
6746
- Thunder: "wind",
6747
- "Wind noise (microphone)": "wind",
6748
- "Rustling leaves": "wind",
6749
- Door: "door",
6750
- "Sliding door": "door",
6751
- Slam: "door",
6752
- "Cupboard open or close": "door",
6753
- "Walk, footsteps": "footsteps",
6754
- Run: "footsteps",
6755
- Shuffle: "footsteps",
6756
- Crowd: "crowd",
6757
- Chatter: "crowd",
6758
- Cheering: "crowd",
6759
- Applause: "crowd",
6760
- "Children playing": "crowd",
6761
- "Hubbub, speech noise, speech babble": "crowd",
6762
- Telephone: "telephone",
6763
- "Telephone bell ringing": "telephone",
6764
- Ringtone: "telephone",
6765
- "Telephone dialing, DTMF": "telephone",
6766
- "Busy signal": "telephone",
6767
- Engine: "engine",
6768
- "Engine starting": "engine",
6769
- Idling: "engine",
6770
- "Accelerating, revving, vroom": "engine",
6771
- "Light engine (high frequency)": "engine",
6772
- "Medium engine (mid frequency)": "engine",
6773
- "Heavy engine (low frequency)": "engine",
6774
- "Lawn mower": "engine",
6775
- Chainsaw: "engine",
6776
- Hammer: "tools",
6777
- Jackhammer: "tools",
6778
- Sawing: "tools",
6779
- "Power tool": "tools",
6780
- Drill: "tools",
6781
- Sanding: "tools",
6782
- Silence: "silence"
6783
- },
6784
- preserveOriginal: false
6785
- };
6786
- var APPLE_SA_TO_MACRO = {
6787
- mapping: {
6788
- speech: "speech",
6789
- child_speech: "speech",
6790
- conversation: "speech",
6791
- whispering: "speech",
6792
- singing: "speech",
6793
- humming: "speech",
6794
- shout: "scream",
6795
- yell: "scream",
6796
- screaming: "scream",
6797
- crying: "crying",
6798
- baby_crying: "crying",
6799
- sobbing: "crying",
6800
- laughter: "laughter",
6801
- baby_laughter: "laughter",
6802
- giggling: "laughter",
6803
- music: "music",
6804
- guitar: "music",
6805
- piano: "music",
6806
- drums: "music",
6807
- dog_bark: "dog",
6808
- dog_bow_wow: "dog",
6809
- dog_growling: "dog",
6810
- dog_howl: "dog",
6811
- cat_meow: "cat",
6812
- cat_purr: "cat",
6813
- cat_hiss: "cat",
6814
- bird: "bird",
6815
- bird_chirp: "bird",
6816
- bird_squawk: "bird",
6817
- animal: "animal",
6818
- horse: "animal",
6819
- cow_moo: "animal",
6820
- insect: "animal",
6821
- alarm: "alarm",
6822
- smoke_alarm: "alarm",
6823
- fire_alarm: "alarm",
6824
- car_alarm: "alarm",
6825
- siren: "siren",
6826
- police_siren: "siren",
6827
- ambulance_siren: "siren",
6828
- doorbell: "doorbell",
6829
- door_knock: "doorbell",
6830
- knocking: "doorbell",
6831
- glass_breaking: "glass_breaking",
6832
- glass_shatter: "glass_breaking",
6833
- gunshot: "gunshot",
6834
- explosion: "gunshot",
6835
- fireworks: "gunshot",
6836
- car: "vehicle",
6837
- truck: "vehicle",
6838
- motorcycle: "vehicle",
6839
- car_horn: "vehicle",
6840
- vehicle_horn: "vehicle",
6841
- traffic: "vehicle",
6842
- fire: "fire",
6843
- fire_crackle: "fire",
6844
- water: "water",
6845
- rain: "water",
6846
- ocean: "water",
6847
- splash: "water",
6848
- wind: "wind",
6849
- thunder: "wind",
6850
- thunderstorm: "wind",
6851
- door: "door",
6852
- door_slam: "door",
6853
- sliding_door: "door",
6854
- footsteps: "footsteps",
6855
- walking: "footsteps",
6856
- running: "footsteps",
6857
- crowd: "crowd",
6858
- chatter: "crowd",
6859
- cheering: "crowd",
6860
- applause: "crowd",
6861
- telephone_ring: "telephone",
6862
- ringtone: "telephone",
6863
- engine: "engine",
6864
- engine_starting: "engine",
6865
- lawn_mower: "engine",
6866
- chainsaw: "engine",
6867
- hammer: "tools",
6868
- jackhammer: "tools",
6869
- drill: "tools",
6870
- power_tool: "tools",
6871
- silence: "silence"
6872
- },
6873
- preserveOriginal: false
6874
- };
6875
- var _macroLookup = /* @__PURE__ */ new Map();
6876
- for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
6877
- for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
6878
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
6879
- DeviceType["Camera"] = "camera";
6880
- DeviceType["Hub"] = "hub";
6881
- DeviceType["Light"] = "light";
6882
- DeviceType["Siren"] = "siren";
6883
- DeviceType["Switch"] = "switch";
6884
- DeviceType["Sensor"] = "sensor";
6885
- DeviceType["Thermostat"] = "thermostat";
6886
- DeviceType["Button"] = "button";
6887
- /** Generic stateless event emitter — carries a device's EXACT declared
6888
- * event vocabulary verbatim (no normalization). Installed with the
6889
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6890
- * HA bus events (e.g. `zha_event`, generic). */
6891
- DeviceType["EventEmitter"] = "event-emitter";
6892
- /** Firmware/software update entity — current vs available version,
6893
- * updatable flag, update state, and an install action. Installed with
6894
- * the `update` cap. Sources: Homematic firmware-update channels (and
6895
- * reusable by other providers, e.g. HA `update.*` entities). */
6896
- DeviceType["Update"] = "update";
6897
- DeviceType["Generic"] = "generic";
6898
- /** Generic notification delivery target (HA `notify.<service>`, future
6899
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6900
- * endpoint; the `notifier` cap defines the send surface. */
6901
- DeviceType["Notifier"] = "notifier";
6902
- /** Pre-recorded action sequence with optional parameters
6903
- * (HA `script.*`). Runnable via `script-runner` cap. */
6904
- DeviceType["Script"] = "script";
6905
- /** Automation rule (HA `automation.*`) — enable/disable + manual
6906
- * trigger surface exposed via `automation-control` cap. */
6907
- DeviceType["Automation"] = "automation";
6908
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6909
- DeviceType["Lock"] = "lock";
6910
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6911
- * `valve.*`). `cover` cap with sub-roles for variant. */
6912
- DeviceType["Cover"] = "cover";
6913
- /** Pipe / water / gas valve with open/close/stop and optional
6914
- * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6915
- * modelled on the same open/closed lifecycle. */
6916
- DeviceType["Valve"] = "valve";
6917
- /** Humidifier / dehumidifier with on/off + target humidity + mode
6918
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6919
- * modelled on the same target / mode lifecycle. */
6920
- DeviceType["Humidifier"] = "humidifier";
6921
- /** Water heater / boiler with target temperature + operation mode +
6922
- * away mode (HA `water_heater.*`). `water-heater` cap — a
6923
- * climate-family actuator. */
6924
- DeviceType["WaterHeater"] = "water-heater";
6925
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6926
- DeviceType["Fan"] = "fan";
6927
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6928
- * the camera surface — those use `Camera`. `media-player` cap. */
6929
- DeviceType["MediaPlayer"] = "media-player";
6930
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
6931
- * `alarm-panel` cap. */
6932
- DeviceType["AlarmPanel"] = "alarm-panel";
6933
- /** Generic user-settable input (HA `number` / `input_number` / `select`
6934
- * / `input_select` / `text` / `input_text` / `input_datetime`).
6935
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6936
- * TextControl / DateTimeControl. */
6937
- DeviceType["Control"] = "control";
6938
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6939
- * `presence` cap. */
6940
- DeviceType["Presence"] = "presence";
6941
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6942
- * `weather` cap. */
6943
- DeviceType["Weather"] = "weather";
6944
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6945
- DeviceType["Vacuum"] = "vacuum";
6946
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6947
- * `lawn-mower-control` cap. */
6948
- DeviceType["LawnMower"] = "lawn-mower";
6949
- /** Physical HA device group — parent container for entity-children
6950
- * adopted from a single HA device entry. Not renderable as a
6951
- * standalone device; exists only to anchor child entities. */
6952
- DeviceType["Container"] = "container";
6953
- /** Single still-image entity (HA `image.*`). Read-only display of an
6954
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
6955
- DeviceType["Image"] = "image";
6956
- return DeviceType;
6957
- }({});
6958
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6959
- DeviceFeature["BatteryOperated"] = "battery-operated";
6960
- DeviceFeature["Rebootable"] = "rebootable";
6790
+ /**
6791
+ * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6792
+ * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6793
+ * so the persisted record schema and the consumer-facing cap can both consume it
6794
+ * without forming a circular import. The `storage` cap re-exports it
6795
+ * verbatim for back-compat.
6796
+ *
6797
+ * This Zod schema is the **authoritative source** for `StorageLocationType`.
6798
+ * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6799
+ * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6800
+ * `IStorageProvider` interface stay in lockstep.
6801
+ *
6802
+ * The type is now an **open string** (not a closed enum) — addons declare
6803
+ * their own location kinds via `StorageLocationDeclaration.id`. The regex
6804
+ * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6805
+ */
6806
+ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6807
+ /**
6808
+ * Persisted record for a storage location instance. Operators can register
6809
+ * multiple instances for multi-cardinality types (e.g. two `backups`
6810
+ * locations with different `providerId`s). Cardinality is now declared per
6811
+ * location via `StorageLocationDeclaration.cardinality` — the static
6812
+ * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6813
+ *
6814
+ * `id` is a stable namespaced string of the form `<type>:<slug>`.
6815
+ * The default location for a type uses `id === <type>:default` by
6816
+ * convention (the bare type ref like `'backups'` resolves to it).
6817
+ *
6818
+ * `isSystem: true` marks a location as orchestrator-seeded and
6819
+ * undeletable. The bootstrap-installed defaults (one per type) carry
6820
+ * this flag; operator-added locations don't. Editing the config of
6821
+ * a system location is allowed (path migration, provider swap) but
6822
+ * deleting it is rejected at the cap level.
6823
+ */
6824
+ var StorageLocationSchema = object({
6825
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6826
+ type: string(),
6827
+ displayName: string().min(1),
6828
+ providerId: string().min(1),
6829
+ config: record(string(), unknown()),
6830
+ /**
6831
+ * Cluster node this location physically lives on. REQUIRED for node-local
6832
+ * providers (filesystem — the path exists on one node's disk), null/absent
6833
+ * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6834
+ * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6835
+ * flag at upsert time, not here (the schema is provider-agnostic).
6836
+ */
6837
+ nodeId: string().optional(),
6838
+ isDefault: boolean().default(false),
6839
+ isSystem: boolean().default(false),
6840
+ createdAt: number(),
6841
+ updatedAt: number()
6842
+ });
6843
+ /**
6844
+ * Reference accepted by consumer-facing `api.storage.*` calls.
6845
+ * Either:
6846
+ * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
6847
+ * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
6848
+ *
6849
+ * The orchestrator's `resolveRef(ref)` handles both cases.
6850
+ */
6851
+ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6852
+ /**
6853
+ * `StorageLocationDeclaration` — a single storage-location entry declared by
6854
+ * an addon in its `package.json` under `camstack.storageLocations`.
6855
+ *
6856
+ * Design intent:
6857
+ * - **Addon declares its needs** — each addon describes the logical storage
6858
+ * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6859
+ * about the physical path.
6860
+ * - **Kernel aggregates** at boot the kernel collects declarations from all
6861
+ * installed addons, deduplicates by `id`, and exposes the union via the
6862
+ * storage-locations settings surface.
6863
+ * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
6864
+ * at least one instance named `<id>:default` is present, using
6865
+ * `defaultsTo` to inherit the resolved root from another location when the
6866
+ * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6867
+ * `recordings`).
6868
+ * - **ids are global** — `id` values are shared across the entire deployment;
6869
+ * two addons declaring the same `id` must agree on `cardinality` (validated
6870
+ * at kernel aggregation time, not here).
6871
+ */
6872
+ var StorageLocationDeclarationSchema = object({
6873
+ /**
6874
+ * Global location identifier, e.g. `recordings` or `recordingsLow`.
6875
+ * Must start with a lowercase letter and may contain letters, digits, and
6876
+ * hyphens.
6877
+ */
6878
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6879
+ /** Human-readable name shown in the admin UI. */
6880
+ displayName: string().min(1, { message: "displayName must not be empty" }),
6881
+ /** Optional longer explanation of what data this location stores. */
6882
+ description: string().optional(),
6883
+ /**
6884
+ * `single` — exactly one instance of this location is allowed system-wide
6885
+ * (e.g. `logs`, `models`). The operator can edit it but not add more.
6886
+ * `multi` — the operator may register several instances (e.g. a second
6887
+ * `recordings` on a NAS for disk tiering); one is the default at any time.
6888
+ */
6889
+ cardinality: _enum(["single", "multi"]),
6890
+ /**
6891
+ * When set, the default instance for this location inherits its resolved
6892
+ * root from the named location's default instance. Useful for derivative
6893
+ * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6894
+ * configure the primary location.
6895
+ */
6896
+ defaultsTo: string().optional()
6897
+ });
6898
+ /**
6899
+ * Compute pixel count for sorting. Returns w*h, or 0 if unknown.
6900
+ */
6901
+ function streamPixels(meta) {
6902
+ return (meta.width ?? 0) * (meta.height ?? 0);
6903
+ }
6904
+ /**
6905
+ * Classify streams relative to each other.
6906
+ * Highest resolution → high, lowest → low, everything else → mid.
6907
+ * With 1 stream: high. With 2: high + low.
6908
+ */
6909
+ function classifyStreams(streams) {
6910
+ if (streams.length === 0) return [];
6911
+ const sorted = streams.map((s, i) => ({
6912
+ s,
6913
+ i,
6914
+ px: streamPixels(s.metadata ?? {})
6915
+ })).toSorted((a, b) => b.px - a.px);
6916
+ const result = Array.from({ length: streams.length });
6917
+ for (let rank = 0; rank < sorted.length; rank++) {
6918
+ const { s, i } = sorted[rank];
6919
+ let quality;
6920
+ if (rank === 0) quality = "high";
6921
+ else if (rank === sorted.length - 1) quality = "low";
6922
+ else quality = "mid";
6923
+ result[i] = {
6924
+ ...s,
6925
+ quality
6926
+ };
6927
+ }
6928
+ return result;
6929
+ }
6930
+ var DecoderStatsSchema = object({
6931
+ inputFps: number(),
6932
+ outputFps: number(),
6933
+ avgDecodeTimeMs: number(),
6934
+ droppedFrames: number()
6935
+ });
6936
+ var DecoderSessionConfigSchema = object({
6937
+ codec: string(),
6938
+ maxFps: number().default(0),
6939
+ outputFormat: _enum([
6940
+ "jpeg",
6941
+ "rgb",
6942
+ "bgr",
6943
+ "yuv420",
6944
+ "gray"
6945
+ ]).default("jpeg"),
6946
+ scale: number().default(1),
6947
+ width: number().optional(),
6948
+ height: number().optional(),
6961
6949
  /**
6962
- * Device supports an on-demand re-sync of its derived spec with its
6963
- * upstream source drives the generic Re-sync button. The owning
6964
- * provider implements the action via the `device-adoption.resync` cap.
6950
+ * Identifier of the camera this decoder session serves. Optional
6951
+ * because the cap is generic (any caller could request decode), but
6952
+ * stream-broker passes it so decoder logs include `deviceId` for
6953
+ * per-camera filtering when diagnosing failures (e.g. node-av
6954
+ * sendPacket errors on a single hung camera).
6965
6955
  */
6966
- DeviceFeature["Resyncable"] = "resyncable";
6967
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
6968
- DeviceFeature["DoorbellButton"] = "doorbell-button";
6969
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
6970
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6956
+ deviceId: number().int().nonnegative().optional(),
6971
6957
  /**
6972
- * Camera supports the on-firmware autotrack subsystem (subject-
6973
- * following). Distinct from `PanTiltZoom` because not every PTZ
6974
- * camera ships autotrack the admin UI uses this flag to gate
6975
- * the autotrack toggle / settings card without re-deriving from
6976
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
6977
- * driver sets this feature when probe confirms the firmware
6978
- * surface, and registers the cap in the same code path.
6958
+ * Free-form tag for log scoping. Stream-broker uses
6959
+ * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6960
+ * on every line so `grep tag=broker:5/high` filters one camera
6961
+ * profile cleanly.
6979
6962
  */
6980
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6963
+ tag: string().optional(),
6981
6964
  /**
6982
- * Accessory exposes a "trigger on motion" toggle the parent camera's
6983
- * motion detection automatically activates this device. Mirrors
6984
- * `motion-trigger` cap registration: drivers set this feature in the
6985
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6965
+ * Where the session delivers decoded frames (Phase 5 / D9):
6986
6966
  *
6987
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6988
- * fast scalar without binding fetch), notifier rules, and `listAll`
6989
- * filters that want "all devices with on-motion behaviour".
6967
+ * - `'callback'` (default) the legacy pixel path: decoded frames are
6968
+ * buffered as `DecodedFrame`s and drained via `pullFrames`.
6969
+ * - `'shm'` the shared-memory frame plane: decoded frames are written
6970
+ * into an OS shared-memory ring and drained as zero-pixel
6971
+ * `FrameHandle`s via `pullHandles`. A session is one mode or the
6972
+ * other — `pullFrames` returns nothing for an `'shm'` session and
6973
+ * `pullHandles` returns nothing for a `'callback'` session.
6990
6974
  */
6991
- DeviceFeature["MotionTrigger"] = "motion-trigger";
6992
- /** Light supports rgb-triplet color via `color` cap. */
6993
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
6994
- /** Light supports HSV color via `color` cap. */
6995
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
6996
- /** Light supports color-temperature (mired) via `color` cap. */
6997
- DeviceFeature["LightColorMired"] = "light-color-mired";
6998
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6999
- * targetHigh). Gates the range slider UI. */
7000
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
7001
- /** Thermostat exposes target humidity and/or current humidity
7002
- * readings. Gates the humidity controls. */
7003
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
7004
- /** Thermostat exposes a fan-mode selector. */
7005
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
7006
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
7007
- DeviceFeature["ClimatePreset"] = "climate-preset";
7008
- /** Cover exposes intermediate position control (0..100). Gates the
7009
- * position slider UI. */
7010
- DeviceFeature["CoverPositionable"] = "cover-positionable";
7011
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
7012
- DeviceFeature["CoverTilt"] = "cover-tilt";
7013
- /** Valve exposes intermediate position control (0..100). Gates the
7014
- * position slider / drag surface UI. */
7015
- DeviceFeature["ValvePositionable"] = "valve-positionable";
7016
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
7017
- DeviceFeature["FanSpeed"] = "fan-speed";
7018
- /** Fan exposes a preset mode selector. */
7019
- DeviceFeature["FanPreset"] = "fan-preset";
7020
- /** Fan exposes blade direction (forward/reverse) — typical of
7021
- * ceiling fans. */
7022
- DeviceFeature["FanDirection"] = "fan-direction";
7023
- /** Fan exposes an oscillation toggle. */
7024
- DeviceFeature["FanOscillating"] = "fan-oscillating";
7025
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
7026
- * field on the UI lock-controls panel. */
7027
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
7028
- /** Lock supports a latch-release ("open door") action distinct from
7029
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
7030
- * `supported_features`. Gates the Open Door button in the UI. */
7031
- DeviceFeature["LockOpen"] = "lock-open";
7032
- /** Media player exposes a seek-to-position surface. */
7033
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
7034
- /** Media player exposes a volume-level setter. */
7035
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
7036
- /** Media player exposes a mute toggle distinct from volume=0. */
7037
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
7038
- /** Media player exposes a shuffle toggle. */
7039
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
7040
- /** Media player exposes a repeat mode (off / all / one). */
7041
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
7042
- /** Media player exposes a source / input selector. */
7043
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
7044
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
7045
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
7046
- /** Media player exposes next-track. */
7047
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
7048
- /** Media player exposes previous-track. */
7049
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
7050
- /** Media player exposes stop distinct from pause. */
7051
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
7052
- /** Alarm panel requires a PIN code on arm/disarm. */
7053
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
7054
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
7055
- * addition to a textual location. */
7056
- DeviceFeature["PresenceGps"] = "presence-gps";
7057
- /** Notifier accepts an inline / URL image attachment. */
7058
- DeviceFeature["NotifierImage"] = "notifier-image";
7059
- /** Notifier accepts a priority hint (high/normal/low). */
7060
- DeviceFeature["NotifierPriority"] = "notifier-priority";
7061
- /** Notifier accepts a free-form `data` payload for platform-specific
7062
- * fields. */
7063
- DeviceFeature["NotifierData"] = "notifier-data";
7064
- /** Notifier supports interactive action buttons / callbacks. */
7065
- DeviceFeature["NotifierActions"] = "notifier-actions";
7066
- /** Notifier supports per-call recipient targeting (multi-user). */
7067
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
7068
- /** Script runner accepts a variables map on each run invocation. */
7069
- DeviceFeature["ScriptVariables"] = "script-variables";
7070
- /** Automation `trigger` accepts a skipCondition flag — fires the
7071
- * automation's actions while bypassing its condition block. */
7072
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
7073
- return DeviceFeature;
7074
- }({});
7075
- /**
7076
- * Semantic role a device plays within its parent. Populated by driver
7077
- * addons when creating accessory devices (Reolink siren/floodlight/
7078
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
7079
- * admin UI to pick icons, labels, and widgets — a `Switch` with
7080
- * `role: Floodlight` renders as a bulb with a brightness slider,
7081
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
7082
- *
7083
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
7084
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
7085
- */
7086
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7087
- DeviceRole["Siren"] = "siren";
7088
- DeviceRole["Floodlight"] = "floodlight";
7089
- DeviceRole["Spotlight"] = "spotlight";
7090
- DeviceRole["PirSensor"] = "pir-sensor";
7091
- DeviceRole["Chime"] = "chime";
7092
- DeviceRole["Autotrack"] = "autotrack";
7093
- DeviceRole["Nightvision"] = "nightvision";
7094
- DeviceRole["PrivacyMask"] = "privacy-mask";
7095
- DeviceRole["Doorbell"] = "doorbell";
7096
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
7097
- * real Switch device for UI rendering / export adapters. */
7098
- DeviceRole["BinaryHelper"] = "binary-helper";
7099
- /** Generic motion / occupancy / moving event source. Distinct from
7100
- * the camera accessory PirSensor role: that one is a camera child;
7101
- * this is a standalone HA / 3rd-party motion sensor. */
7102
- DeviceRole["MotionSensor"] = "motion-sensor";
7103
- DeviceRole["ContactSensor"] = "contact-sensor";
7104
- DeviceRole["LeakSensor"] = "leak-sensor";
7105
- DeviceRole["SmokeSensor"] = "smoke-sensor";
7106
- DeviceRole["COSensor"] = "co-sensor";
7107
- DeviceRole["GasSensor"] = "gas-sensor";
7108
- DeviceRole["TamperSensor"] = "tamper-sensor";
7109
- DeviceRole["VibrationSensor"] = "vibration-sensor";
7110
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
7111
- DeviceRole["SoundSensor"] = "sound-sensor";
7112
- /** Fallback for `binary_sensor` without a known `device_class`. */
7113
- DeviceRole["BinarySensor"] = "binary-sensor";
7114
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
7115
- DeviceRole["HumiditySensor"] = "humidity-sensor";
7116
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
7117
- DeviceRole["PressureSensor"] = "pressure-sensor";
7118
- DeviceRole["PowerSensor"] = "power-sensor";
7119
- DeviceRole["EnergySensor"] = "energy-sensor";
7120
- DeviceRole["VoltageSensor"] = "voltage-sensor";
7121
- DeviceRole["CurrentSensor"] = "current-sensor";
7122
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
7123
- /** Battery level (numeric % via `sensor` OR low-bool via
7124
- * `binary_sensor` — the cap distinguishes via the value type). */
7125
- DeviceRole["BatterySensor"] = "battery-sensor";
7126
- /** Fallback for `sensor` numeric without a known `device_class`. */
7127
- DeviceRole["NumericSensor"] = "numeric-sensor";
7128
- /** String / enum state (HA `sensor` with `state_class: enum` or
7129
- * `attributes.options`). */
7130
- DeviceRole["EnumSensor"] = "enum-sensor";
7131
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
7132
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
7133
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
7134
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
7135
- /** Last-resort fallback when nothing else matches. */
7136
- DeviceRole["GenericSensor"] = "generic-sensor";
7137
- DeviceRole["NumericControl"] = "numeric-control";
7138
- DeviceRole["SelectControl"] = "select-control";
7139
- DeviceRole["TextControl"] = "text-control";
7140
- DeviceRole["DateTimeControl"] = "datetime-control";
7141
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
7142
- * rich features (image, priority, channel routing). */
7143
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
7144
- /** Chat / messaging service (HA `notify.telegram_*`,
7145
- * `notify.discord_*`, etc.). */
7146
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
7147
- /** Email-based delivery (HA `notify.smtp`, etc.). */
7148
- DeviceRole["EmailNotifier"] = "email-notifier";
7149
- /** Fallback when the notifier service name doesn't match a known
7150
- * pattern. */
7151
- DeviceRole["GenericNotifier"] = "generic-notifier";
7152
- return DeviceRole;
7153
- }({});
6975
+ frameSink: _enum(["callback", "shm"]).default("callback")
6976
+ });
6977
+ var EncodeProfileSchema = object({
6978
+ video: object({
6979
+ codec: _enum([
6980
+ "h264",
6981
+ "h265",
6982
+ "copy"
6983
+ ]),
6984
+ profile: _enum([
6985
+ "baseline",
6986
+ "main",
6987
+ "high"
6988
+ ]).optional(),
6989
+ width: number().int().positive().optional(),
6990
+ height: number().int().positive().optional(),
6991
+ fps: number().positive().optional(),
6992
+ bitrateKbps: number().int().positive().optional(),
6993
+ gopFrames: number().int().positive().optional(),
6994
+ bf: number().int().min(0).optional(),
6995
+ preset: _enum([
6996
+ "ultrafast",
6997
+ "superfast",
6998
+ "veryfast",
6999
+ "faster",
7000
+ "fast",
7001
+ "medium"
7002
+ ]).optional(),
7003
+ tune: _enum([
7004
+ "zerolatency",
7005
+ "film",
7006
+ "animation"
7007
+ ]).optional()
7008
+ }),
7009
+ audio: union([literal("passthrough"), object({
7010
+ codec: _enum([
7011
+ "opus",
7012
+ "aac",
7013
+ "pcmu",
7014
+ "pcma",
7015
+ "copy"
7016
+ ]),
7017
+ bitrateKbps: number().int().positive().optional(),
7018
+ sampleRateHz: number().int().positive().optional(),
7019
+ channels: union([literal(1), literal(2)]).optional()
7020
+ })]),
7021
+ /**
7022
+ * ffmpeg input-side args, inserted between the fixed global flags
7023
+ * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
7024
+ * the widget surfaces a textarea + suggestion chips for the most-
7025
+ * used demuxer/format options.
7026
+ */
7027
+ inputArgs: array(string()).optional(),
7028
+ /**
7029
+ * ffmpeg output-side args, inserted between the encode block and
7030
+ * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
7031
+ * filters, codec-specific overrides. Free-text array.
7032
+ */
7033
+ outputArgs: array(string()).optional()
7034
+ });
7035
+ var YAMNET_TO_MACRO = {
7036
+ mapping: {
7037
+ Speech: "speech",
7038
+ "Child speech, kid speaking": "speech",
7039
+ Conversation: "speech",
7040
+ "Narration, monologue": "speech",
7041
+ Babbling: "speech",
7042
+ Whispering: "speech",
7043
+ "Speech synthesizer": "speech",
7044
+ Humming: "speech",
7045
+ Rapping: "speech",
7046
+ Singing: "speech",
7047
+ Choir: "speech",
7048
+ "Child singing": "speech",
7049
+ Shout: "scream",
7050
+ Bellow: "scream",
7051
+ Yell: "scream",
7052
+ Screaming: "scream",
7053
+ "Children shouting": "scream",
7054
+ Whoop: "scream",
7055
+ "Crying, sobbing": "crying",
7056
+ "Baby cry, infant cry": "crying",
7057
+ Whimper: "crying",
7058
+ "Wail, moan": "crying",
7059
+ Groan: "crying",
7060
+ Laughter: "laughter",
7061
+ "Baby laughter": "laughter",
7062
+ Giggle: "laughter",
7063
+ Snicker: "laughter",
7064
+ "Belly laugh": "laughter",
7065
+ "Chuckle, chortle": "laughter",
7066
+ Music: "music",
7067
+ "Musical instrument": "music",
7068
+ Guitar: "music",
7069
+ Piano: "music",
7070
+ Drum: "music",
7071
+ "Drum kit": "music",
7072
+ "Violin, fiddle": "music",
7073
+ Flute: "music",
7074
+ Saxophone: "music",
7075
+ Trumpet: "music",
7076
+ Synthesizer: "music",
7077
+ "Pop music": "music",
7078
+ "Rock music": "music",
7079
+ "Hip hop music": "music",
7080
+ "Classical music": "music",
7081
+ Jazz: "music",
7082
+ "Electronic music": "music",
7083
+ "Background music": "music",
7084
+ Dog: "dog",
7085
+ Bark: "dog",
7086
+ Yip: "dog",
7087
+ Howl: "dog",
7088
+ "Bow-wow": "dog",
7089
+ Growling: "dog",
7090
+ "Whimper (dog)": "dog",
7091
+ Cat: "cat",
7092
+ Purr: "cat",
7093
+ Meow: "cat",
7094
+ Hiss: "cat",
7095
+ Caterwaul: "cat",
7096
+ Bird: "bird",
7097
+ "Bird vocalization, bird call, bird song": "bird",
7098
+ "Chirp, tweet": "bird",
7099
+ Squawk: "bird",
7100
+ Crow: "bird",
7101
+ Owl: "bird",
7102
+ "Pigeon, dove": "bird",
7103
+ Animal: "animal",
7104
+ "Domestic animals, pets": "animal",
7105
+ "Livestock, farm animals, working animals": "animal",
7106
+ Horse: "animal",
7107
+ "Cattle, bovinae": "animal",
7108
+ Pig: "animal",
7109
+ Sheep: "animal",
7110
+ Goat: "animal",
7111
+ Frog: "animal",
7112
+ Insect: "animal",
7113
+ Cricket: "animal",
7114
+ Alarm: "alarm",
7115
+ "Alarm clock": "alarm",
7116
+ "Smoke detector, smoke alarm": "alarm",
7117
+ "Fire alarm": "alarm",
7118
+ Buzzer: "alarm",
7119
+ "Civil defense siren": "alarm",
7120
+ "Car alarm": "alarm",
7121
+ Siren: "siren",
7122
+ "Police car (siren)": "siren",
7123
+ "Ambulance (siren)": "siren",
7124
+ "Fire engine, fire truck (siren)": "siren",
7125
+ "Emergency vehicle": "siren",
7126
+ Foghorn: "siren",
7127
+ Doorbell: "doorbell",
7128
+ "Ding-dong": "doorbell",
7129
+ Knock: "doorbell",
7130
+ Tap: "doorbell",
7131
+ Glass: "glass_breaking",
7132
+ Shatter: "glass_breaking",
7133
+ "Chink, clink": "glass_breaking",
7134
+ "Gunshot, gunfire": "gunshot",
7135
+ "Machine gun": "gunshot",
7136
+ Explosion: "gunshot",
7137
+ Fireworks: "gunshot",
7138
+ Firecracker: "gunshot",
7139
+ "Artillery fire": "gunshot",
7140
+ "Cap gun": "gunshot",
7141
+ Boom: "gunshot",
7142
+ Vehicle: "vehicle",
7143
+ Car: "vehicle",
7144
+ Truck: "vehicle",
7145
+ Bus: "vehicle",
7146
+ Motorcycle: "vehicle",
7147
+ "Car passing by": "vehicle",
7148
+ "Vehicle horn, car horn, honking": "vehicle",
7149
+ "Traffic noise, roadway noise": "vehicle",
7150
+ Train: "vehicle",
7151
+ Aircraft: "vehicle",
7152
+ Helicopter: "vehicle",
7153
+ Bicycle: "vehicle",
7154
+ Skateboard: "vehicle",
7155
+ Fire: "fire",
7156
+ Crackle: "fire",
7157
+ Water: "water",
7158
+ Rain: "water",
7159
+ Raindrop: "water",
7160
+ "Rain on surface": "water",
7161
+ Stream: "water",
7162
+ Waterfall: "water",
7163
+ Ocean: "water",
7164
+ "Waves, surf": "water",
7165
+ "Splash, splatter": "water",
7166
+ Wind: "wind",
7167
+ Thunderstorm: "wind",
7168
+ Thunder: "wind",
7169
+ "Wind noise (microphone)": "wind",
7170
+ "Rustling leaves": "wind",
7171
+ Door: "door",
7172
+ "Sliding door": "door",
7173
+ Slam: "door",
7174
+ "Cupboard open or close": "door",
7175
+ "Walk, footsteps": "footsteps",
7176
+ Run: "footsteps",
7177
+ Shuffle: "footsteps",
7178
+ Crowd: "crowd",
7179
+ Chatter: "crowd",
7180
+ Cheering: "crowd",
7181
+ Applause: "crowd",
7182
+ "Children playing": "crowd",
7183
+ "Hubbub, speech noise, speech babble": "crowd",
7184
+ Telephone: "telephone",
7185
+ "Telephone bell ringing": "telephone",
7186
+ Ringtone: "telephone",
7187
+ "Telephone dialing, DTMF": "telephone",
7188
+ "Busy signal": "telephone",
7189
+ Engine: "engine",
7190
+ "Engine starting": "engine",
7191
+ Idling: "engine",
7192
+ "Accelerating, revving, vroom": "engine",
7193
+ "Light engine (high frequency)": "engine",
7194
+ "Medium engine (mid frequency)": "engine",
7195
+ "Heavy engine (low frequency)": "engine",
7196
+ "Lawn mower": "engine",
7197
+ Chainsaw: "engine",
7198
+ Hammer: "tools",
7199
+ Jackhammer: "tools",
7200
+ Sawing: "tools",
7201
+ "Power tool": "tools",
7202
+ Drill: "tools",
7203
+ Sanding: "tools",
7204
+ Silence: "silence"
7205
+ },
7206
+ preserveOriginal: false
7207
+ };
7208
+ var APPLE_SA_TO_MACRO = {
7209
+ mapping: {
7210
+ speech: "speech",
7211
+ child_speech: "speech",
7212
+ conversation: "speech",
7213
+ whispering: "speech",
7214
+ singing: "speech",
7215
+ humming: "speech",
7216
+ shout: "scream",
7217
+ yell: "scream",
7218
+ screaming: "scream",
7219
+ crying: "crying",
7220
+ baby_crying: "crying",
7221
+ sobbing: "crying",
7222
+ laughter: "laughter",
7223
+ baby_laughter: "laughter",
7224
+ giggling: "laughter",
7225
+ music: "music",
7226
+ guitar: "music",
7227
+ piano: "music",
7228
+ drums: "music",
7229
+ dog_bark: "dog",
7230
+ dog_bow_wow: "dog",
7231
+ dog_growling: "dog",
7232
+ dog_howl: "dog",
7233
+ cat_meow: "cat",
7234
+ cat_purr: "cat",
7235
+ cat_hiss: "cat",
7236
+ bird: "bird",
7237
+ bird_chirp: "bird",
7238
+ bird_squawk: "bird",
7239
+ animal: "animal",
7240
+ horse: "animal",
7241
+ cow_moo: "animal",
7242
+ insect: "animal",
7243
+ alarm: "alarm",
7244
+ smoke_alarm: "alarm",
7245
+ fire_alarm: "alarm",
7246
+ car_alarm: "alarm",
7247
+ siren: "siren",
7248
+ police_siren: "siren",
7249
+ ambulance_siren: "siren",
7250
+ doorbell: "doorbell",
7251
+ door_knock: "doorbell",
7252
+ knocking: "doorbell",
7253
+ glass_breaking: "glass_breaking",
7254
+ glass_shatter: "glass_breaking",
7255
+ gunshot: "gunshot",
7256
+ explosion: "gunshot",
7257
+ fireworks: "gunshot",
7258
+ car: "vehicle",
7259
+ truck: "vehicle",
7260
+ motorcycle: "vehicle",
7261
+ car_horn: "vehicle",
7262
+ vehicle_horn: "vehicle",
7263
+ traffic: "vehicle",
7264
+ fire: "fire",
7265
+ fire_crackle: "fire",
7266
+ water: "water",
7267
+ rain: "water",
7268
+ ocean: "water",
7269
+ splash: "water",
7270
+ wind: "wind",
7271
+ thunder: "wind",
7272
+ thunderstorm: "wind",
7273
+ door: "door",
7274
+ door_slam: "door",
7275
+ sliding_door: "door",
7276
+ footsteps: "footsteps",
7277
+ walking: "footsteps",
7278
+ running: "footsteps",
7279
+ crowd: "crowd",
7280
+ chatter: "crowd",
7281
+ cheering: "crowd",
7282
+ applause: "crowd",
7283
+ telephone_ring: "telephone",
7284
+ ringtone: "telephone",
7285
+ engine: "engine",
7286
+ engine_starting: "engine",
7287
+ lawn_mower: "engine",
7288
+ chainsaw: "engine",
7289
+ hammer: "tools",
7290
+ jackhammer: "tools",
7291
+ drill: "tools",
7292
+ power_tool: "tools",
7293
+ silence: "silence"
7294
+ },
7295
+ preserveOriginal: false
7296
+ };
7297
+ var _macroLookup = /* @__PURE__ */ new Map();
7298
+ for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7299
+ for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7154
7300
  /**
7155
7301
  * Accessory device helpers — shared across drivers.
7156
7302
  *
@@ -7604,78 +7750,6 @@ var airQualitySensorCapability = {
7604
7750
  runtimeState: AirQualitySensorStatusSchema
7605
7751
  };
7606
7752
  /**
7607
- * Generic types for capability definitions.
7608
- *
7609
- * A capability is defined with Zod schemas for methods, events, and settings.
7610
- * TypeScript types are inferred via z.infer<> — zero duplication.
7611
- *
7612
- * Pattern:
7613
- * 1. Define Zod schemas for data, methods, settings
7614
- * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
7615
- * 3. Export type IProvider = InferProvider<typeof capabilityDef>
7616
- * 4. Addon implements IProvider
7617
- * 5. Registry auto-mounts tRPC router from definition.methods
7618
- */
7619
- /**
7620
- * Output schema shared by the contribution + live methods.
7621
- *
7622
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
7623
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
7624
- * concrete-but-lenient Zod object keeps tRPC output inference happy
7625
- * (using `z.unknown()` here collapses unrelated router branches to
7626
- * `unknown` when the generator re-inlines the huge AppRouter type).
7627
- *
7628
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
7629
- * extensions the caller adds (showWhen, displayScale, …) without
7630
- * rebuilding every time a new field kind is introduced.
7631
- */
7632
- var ContributionSectionSchema = object({
7633
- id: string(),
7634
- title: string(),
7635
- description: string().optional(),
7636
- style: _enum(["card", "accordion"]).optional(),
7637
- defaultCollapsed: boolean().optional(),
7638
- columns: union([
7639
- literal(1),
7640
- literal(2),
7641
- literal(3),
7642
- literal(4)
7643
- ]).optional(),
7644
- tab: string().optional(),
7645
- location: _enum(["settings", "top-tab"]).optional(),
7646
- order: number().optional(),
7647
- fields: array(any())
7648
- });
7649
- object({
7650
- tabs: array(object({
7651
- id: string(),
7652
- label: string(),
7653
- icon: string(),
7654
- order: number().optional()
7655
- })).optional(),
7656
- sections: array(ContributionSectionSchema)
7657
- }).nullable();
7658
- object({ deviceId: number() }), object({ deviceId: number() }), object({
7659
- deviceId: number(),
7660
- patch: record(string(), unknown())
7661
- }), object({ success: literal(true) });
7662
- object({ deviceId: number() }), unknown().nullable();
7663
- /** Shorthand to define a method schema */
7664
- function method(input, output, options) {
7665
- return {
7666
- input,
7667
- output,
7668
- kind: options?.kind ?? "query",
7669
- auth: options?.auth ?? "protected",
7670
- ...options?.access !== void 0 ? { access: options.access } : {},
7671
- timeoutMs: options?.timeoutMs
7672
- };
7673
- }
7674
- /** Shorthand to define an event schema */
7675
- function event(data) {
7676
- return { data };
7677
- }
7678
- /**
7679
7753
  * Alarm-panel cap. Models HA `alarm_control_panel.*` on
7680
7754
  * `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
7681
7755
  * across disarmed / armed_(home|away|night|vacation|custom_bypass) /
@@ -10391,6 +10465,24 @@ var DetectorOutputSchema = object({
10391
10465
  inferenceMs: number(),
10392
10466
  modelId: string()
10393
10467
  });
10468
+ var EngineProvisioningSchema = object({
10469
+ runtimeId: _enum([
10470
+ "onnx",
10471
+ "openvino",
10472
+ "coreml"
10473
+ ]).nullable(),
10474
+ device: string().nullable(),
10475
+ state: _enum([
10476
+ "idle",
10477
+ "installing",
10478
+ "verifying",
10479
+ "ready",
10480
+ "failed"
10481
+ ]),
10482
+ progress: number().optional(),
10483
+ error: string().optional(),
10484
+ nextRetryAt: number().optional()
10485
+ });
10394
10486
  var PipelineStepInputSchema = lazy(() => object({
10395
10487
  addonId: string(),
10396
10488
  modelId: string(),
@@ -10459,7 +10551,7 @@ var PipelineRunResultBridge = custom();
10459
10551
  method(_void(), array(PipelineEngineChoiceSchema)), method(_void(), PipelineEngineChoiceSchema), method(PipelineEngineChoiceSchema, array(PipelineDefaultStepSchema)), method(_void(), PipelineEngineChoiceSchema, {
10460
10552
  kind: "mutation",
10461
10553
  auth: "admin"
10462
- }), method(_void(), record(string(), object({
10554
+ }), method(object({ nodeId: string() }), EngineProvisioningSchema), method(_void(), record(string(), object({
10463
10555
  modelId: string(),
10464
10556
  settings: record(string(), unknown()).readonly()
10465
10557
  }))), method(object({ steps: record(string(), object({
@@ -14129,9 +14221,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14129
14221
  limit: number().optional(),
14130
14222
  tags: record(string(), string()).optional()
14131
14223
  }), array(LogEntrySchema).readonly());
14132
- var StaticDirOutputSchema = object({ staticDir: string() });
14133
- var VersionOutputSchema = object({ version: string() });
14134
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
14135
14224
  /**
14136
14225
  * Zod schemas for persisted record types.
14137
14226
  *
@@ -15615,7 +15704,10 @@ var AgentAddonConfigSchema = object({
15615
15704
  modelId: string(),
15616
15705
  settings: record(string(), unknown()).readonly()
15617
15706
  });
15618
- var AgentPipelineSettingsSchema = object({ addonDefaults: record(string(), AgentAddonConfigSchema).readonly() });
15707
+ var AgentPipelineSettingsSchema = object({
15708
+ addonDefaults: record(string(), AgentAddonConfigSchema).readonly(),
15709
+ maxCameras: number().int().nonnegative().nullable().default(null)
15710
+ });
15619
15711
  var CameraPipelineForAgentSchema = object({
15620
15712
  steps: array(PipelineStepInputSchema).readonly(),
15621
15713
  audio: object({
@@ -15717,6 +15809,133 @@ var GlobalMetricsSchema = object({
15717
15809
  * capability providers.
15718
15810
  */
15719
15811
  var CapabilityBindingsSchema = record(string(), string());
15812
+ /** Source block — always present; derives from the stream catalog. */
15813
+ var CameraSourceStatusSchema = object({ streams: array(object({
15814
+ camStreamId: string(),
15815
+ codec: string(),
15816
+ width: number(),
15817
+ height: number(),
15818
+ fps: number(),
15819
+ kind: string()
15820
+ })).readonly() });
15821
+ /** Assignment block — always present (orchestrator-local, no remote call). */
15822
+ var CameraAssignmentStatusSchema = object({
15823
+ detectionNodeId: string().nullable(),
15824
+ decoderNodeId: string().nullable(),
15825
+ audioNodeId: string().nullable(),
15826
+ pinned: object({
15827
+ detection: boolean(),
15828
+ decoder: boolean(),
15829
+ audio: boolean()
15830
+ }),
15831
+ reasons: object({
15832
+ detection: string().optional(),
15833
+ decoder: string().optional(),
15834
+ audio: string().optional()
15835
+ })
15836
+ });
15837
+ /** Broker block — null when the broker stage is unreachable or inactive. */
15838
+ var CameraBrokerStatusSchema = object({
15839
+ profiles: array(object({
15840
+ profile: string(),
15841
+ status: string(),
15842
+ codec: string(),
15843
+ width: number(),
15844
+ height: number(),
15845
+ subscribers: number(),
15846
+ inFps: number(),
15847
+ outFps: number()
15848
+ })).readonly(),
15849
+ webrtcSessions: number(),
15850
+ rtspRestream: boolean()
15851
+ });
15852
+ /** Shared-memory ring statistics within the decoder block. */
15853
+ var CameraDecoderShmSchema = object({
15854
+ framesWritten: number(),
15855
+ getFrameHits: number(),
15856
+ getFrameMisses: number(),
15857
+ budgetMb: number()
15858
+ });
15859
+ /** Decoder block — null when the decoder stage is unreachable or inactive. */
15860
+ var CameraDecoderStatusSchema = object({
15861
+ nodeId: string(),
15862
+ formats: array(string()).readonly(),
15863
+ sessionCount: number(),
15864
+ shm: CameraDecoderShmSchema
15865
+ });
15866
+ /** Motion block — null when motion detection is not active for this device. */
15867
+ var CameraMotionStatusSchema = object({
15868
+ enabled: boolean(),
15869
+ fps: number()
15870
+ });
15871
+ /** Detection provisioning sub-block. */
15872
+ var CameraDetectionProvisioningSchema = object({
15873
+ state: _enum([
15874
+ "idle",
15875
+ "installing",
15876
+ "verifying",
15877
+ "ready",
15878
+ "failed"
15879
+ ]),
15880
+ error: string().optional()
15881
+ });
15882
+ /** Detection phase — derived from the runner's engine phase. */
15883
+ var CameraDetectionPhaseSchema = _enum([
15884
+ "idle",
15885
+ "watching",
15886
+ "active"
15887
+ ]);
15888
+ /** Detection block — null when no detection node is assigned or reachable. */
15889
+ var CameraDetectionStatusSchema = object({
15890
+ nodeId: string(),
15891
+ engine: object({
15892
+ backend: string(),
15893
+ device: string()
15894
+ }),
15895
+ phase: CameraDetectionPhaseSchema,
15896
+ configuredFps: number(),
15897
+ actualFps: number(),
15898
+ queueDepth: number(),
15899
+ avgInferenceMs: number(),
15900
+ provisioning: CameraDetectionProvisioningSchema
15901
+ });
15902
+ /** Audio block — null when no audio node is assigned or reachable. */
15903
+ var CameraAudioStatusSchema = object({
15904
+ nodeId: string(),
15905
+ enabled: boolean()
15906
+ });
15907
+ /** Recording block — null when no recording cap is active for this device. */
15908
+ var CameraRecordingStatusSchema = object({
15909
+ mode: _enum([
15910
+ "off",
15911
+ "continuous",
15912
+ "events"
15913
+ ]),
15914
+ active: boolean(),
15915
+ storageBytes: number()
15916
+ });
15917
+ /**
15918
+ * Aggregated per-camera pipeline status — server-composed, single call.
15919
+ *
15920
+ * The `assignment` and `source` blocks are always present.
15921
+ * Every other block is `null` when the stage is inactive or unreachable
15922
+ * during the bounded parallel fan-out in the orchestrator implementation.
15923
+ *
15924
+ * See spec: `docs/superpowers/specs/2026-06-24-camera-status-aggregator-cap.md`
15925
+ */
15926
+ var CameraStatusSchema = object({
15927
+ deviceId: number(),
15928
+ assignment: CameraAssignmentStatusSchema,
15929
+ source: CameraSourceStatusSchema,
15930
+ broker: CameraBrokerStatusSchema.nullable(),
15931
+ decoder: CameraDecoderStatusSchema.nullable(),
15932
+ motion: CameraMotionStatusSchema.nullable(),
15933
+ detection: CameraDetectionStatusSchema.nullable(),
15934
+ audio: CameraAudioStatusSchema.nullable(),
15935
+ recording: CameraRecordingStatusSchema.nullable(),
15936
+ /** Unix timestamp (ms) when this snapshot was composed server-side. */
15937
+ fetchedAt: number()
15938
+ });
15720
15939
  method(object({
15721
15940
  deviceId: number(),
15722
15941
  agentNodeId: string()
@@ -15784,6 +16003,12 @@ method(object({
15784
16003
  }), {
15785
16004
  kind: "mutation",
15786
16005
  auth: "admin"
16006
+ }), method(object({
16007
+ agentNodeId: string(),
16008
+ maxCameras: number().int().nonnegative().nullable()
16009
+ }), object({ success: literal(true) }), {
16010
+ kind: "mutation",
16011
+ auth: "admin"
15787
16012
  }), method(object({ deviceId: number() }), CameraPipelineSettingsSchema.nullable()), method(object({
15788
16013
  deviceId: number(),
15789
16014
  addonId: string(),
@@ -15809,7 +16034,7 @@ method(object({
15809
16034
  }), method(object({
15810
16035
  deviceId: number(),
15811
16036
  agentNodeId: string().optional()
15812
- }), CameraPipelineConfigSchema), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
16037
+ }), CameraPipelineConfigSchema), method(object({ deviceId: number() }), CameraStatusSchema), method(object({ deviceIds: array(number()).optional() }), array(CameraStatusSchema).readonly()), method(_void(), array(PipelineTemplateSchema).readonly()), method(object({
15813
16038
  name: string(),
15814
16039
  description: string().optional(),
15815
16040
  config: CameraPipelineConfigSchema
@@ -16296,7 +16521,7 @@ method(object({
16296
16521
  }), _void(), {
16297
16522
  kind: "mutation",
16298
16523
  auth: "admin"
16299
- }), 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({
16524
+ }), 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({
16300
16525
  deviceId: number(),
16301
16526
  values: record(string(), unknown())
16302
16527
  }), object({ success: literal(true) }), {
@@ -17021,7 +17246,20 @@ var DiskSpaceInfoSchema = object({
17021
17246
  var PidResourceStatsSchema = object({
17022
17247
  pid: number(),
17023
17248
  cpu: number(),
17024
- memory: number()
17249
+ memory: number(),
17250
+ /**
17251
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
17252
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
17253
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
17254
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
17255
+ * Undefined where /proc is unavailable (e.g. macOS).
17256
+ */
17257
+ privateBytes: number().optional(),
17258
+ /**
17259
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
17260
+ * code shared copy-on-write across runners. Undefined on macOS.
17261
+ */
17262
+ sharedBytes: number().optional()
17025
17263
  });
17026
17264
  var AddonInstanceSchema = object({
17027
17265
  addonId: string(),
@@ -17070,6 +17308,17 @@ var KillProcessResultSchema = object({
17070
17308
  reason: string().optional(),
17071
17309
  signal: _enum(["SIGTERM", "SIGKILL"]).optional()
17072
17310
  });
17311
+ var DumpHeapSnapshotInputSchema = object({
17312
+ /** The addon whose runner should dump a heap snapshot. */
17313
+ addonId: string() });
17314
+ var DumpHeapSnapshotResultSchema = object({
17315
+ success: boolean(),
17316
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
17317
+ path: string().optional(),
17318
+ /** Process pid that was signalled. */
17319
+ pid: number().optional(),
17320
+ reason: string().optional()
17321
+ });
17073
17322
  var SystemMetricsSchema = object({
17074
17323
  cpuPercent: number(),
17075
17324
  memoryPercent: number(),
@@ -17083,6 +17332,9 @@ var SystemMetricsSchema = object({
17083
17332
  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, {
17084
17333
  kind: "mutation",
17085
17334
  auth: "admin"
17335
+ }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
17336
+ kind: "mutation",
17337
+ auth: "admin"
17086
17338
  });
17087
17339
  var PtzPresetSchema = object({
17088
17340
  id: string(),
@@ -17449,63 +17701,6 @@ method(object({
17449
17701
  auth: "admin"
17450
17702
  });
17451
17703
  /**
17452
- * device-ops — device-scoped cap that unifies the per-IDevice operations
17453
- * previously routed through the `.device-ops` Moleculer bridge service.
17454
- *
17455
- * Each worker that hosts live `IDevice` instances auto-registers a native
17456
- * provider for this cap (per device) backed by its local
17457
- * `DeviceRegistry`. Hub-side callers reach it transparently through
17458
- * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
17459
- * `deviceId` + `nodeId` and dispatches through the standard cap-router,
17460
- * so there's no parallel bridge path anymore.
17461
- *
17462
- * The surface is intentionally small — every method corresponds to a
17463
- * single action on the live `IDevice` (or `ICameraDevice` for
17464
- * `getStreamSources`). Richer orchestration (enable/disable with
17465
- * integration plumbing, bulk updates) stays in the `device-manager` cap;
17466
- * `device-ops` is the per-device primitive the device-manager routes to.
17467
- */
17468
- var StreamSourceEntrySchema$1 = object({
17469
- id: string(),
17470
- label: string(),
17471
- protocol: _enum([
17472
- "rtsp",
17473
- "rtmp",
17474
- "annexb",
17475
- "http-mjpeg",
17476
- "webrtc",
17477
- "custom"
17478
- ]),
17479
- url: string().optional(),
17480
- resolution: object({
17481
- width: number(),
17482
- height: number()
17483
- }).optional(),
17484
- fps: number().optional(),
17485
- bitrate: number().optional(),
17486
- codec: string().optional(),
17487
- profileHint: CamProfileSchema.optional(),
17488
- sdp: string().optional()
17489
- });
17490
- var ConfigEntrySchema$1 = object({
17491
- key: string(),
17492
- value: unknown()
17493
- });
17494
- var RawStateResultSchema = object({
17495
- /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
17496
- source: string(),
17497
- /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
17498
- data: record(string(), unknown())
17499
- });
17500
- method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
17501
- deviceId: number(),
17502
- values: record(string(), unknown())
17503
- }), _void(), { kind: "mutation" }), method(object({
17504
- deviceId: number(),
17505
- action: string().min(1),
17506
- input: unknown()
17507
- }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
17508
- /**
17509
17704
  * camera-credentials — device-scoped cap exposing the camera's network
17510
17705
  * + auth surface in a vendor-neutral shape.
17511
17706
  *
@@ -21201,6 +21396,12 @@ Object.freeze({
21201
21396
  addonId: null,
21202
21397
  access: "view"
21203
21398
  },
21399
+ "metricsProvider.dumpHeapSnapshot": {
21400
+ capName: "metrics-provider",
21401
+ capScope: "system",
21402
+ addonId: null,
21403
+ access: "create"
21404
+ },
21204
21405
  "metricsProvider.getAddonStats": {
21205
21406
  capName: "metrics-provider",
21206
21407
  capScope: "system",
@@ -21657,6 +21858,12 @@ Object.freeze({
21657
21858
  addonId: null,
21658
21859
  access: "view"
21659
21860
  },
21861
+ "pipelineExecutor.getEngineProvisioning": {
21862
+ capName: "pipeline-executor",
21863
+ capScope: "system",
21864
+ addonId: null,
21865
+ access: "view"
21866
+ },
21660
21867
  "pipelineExecutor.getGlobalPipelineConfig": {
21661
21868
  capName: "pipeline-executor",
21662
21869
  capScope: "system",
@@ -21861,6 +22068,18 @@ Object.freeze({
21861
22068
  addonId: null,
21862
22069
  access: "view"
21863
22070
  },
22071
+ "pipelineOrchestrator.getCameraStatus": {
22072
+ capName: "pipeline-orchestrator",
22073
+ capScope: "system",
22074
+ addonId: null,
22075
+ access: "view"
22076
+ },
22077
+ "pipelineOrchestrator.getCameraStatuses": {
22078
+ capName: "pipeline-orchestrator",
22079
+ capScope: "system",
22080
+ addonId: null,
22081
+ access: "view"
22082
+ },
21864
22083
  "pipelineOrchestrator.getCameraStepOverrides": {
21865
22084
  capName: "pipeline-orchestrator",
21866
22085
  capScope: "system",
@@ -21945,6 +22164,12 @@ Object.freeze({
21945
22164
  addonId: null,
21946
22165
  access: "create"
21947
22166
  },
22167
+ "pipelineOrchestrator.setAgentMaxCameras": {
22168
+ capName: "pipeline-orchestrator",
22169
+ capScope: "system",
22170
+ addonId: null,
22171
+ access: "create"
22172
+ },
21948
22173
  "pipelineOrchestrator.setCameraPipelineForAgent": {
21949
22174
  capName: "pipeline-orchestrator",
21950
22175
  capScope: "system",