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