@camstack/addon-pipeline 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/audio-analyzer/index.js +6 -7
  2. package/dist/audio-analyzer/index.mjs +2 -2
  3. package/dist/audio-codec-nodeav/index.js +1 -1
  4. package/dist/audio-codec-nodeav/index.mjs +1 -1
  5. package/dist/decoder-nodeav/index.js +1 -1
  6. package/dist/decoder-nodeav/index.mjs +1 -1
  7. package/dist/detection-pipeline/index.js +14 -15
  8. package/dist/detection-pipeline/index.mjs +2 -2
  9. package/dist/{dist-DsDFrG0I.mjs → dist-CjrjeaDd.mjs} +1681 -1644
  10. package/dist/{dist-BiUtYscO.js → dist-G45MVm6i.js} +1680 -1643
  11. package/dist/model-download-service-C7AjBsX9-B0ekM6dF.mjs +301 -0
  12. package/dist/model-download-service-C7AjBsX9-rXY-VFDk.js +358 -0
  13. package/dist/motion-wasm/index.js +1 -1
  14. package/dist/motion-wasm/index.mjs +1 -1
  15. package/dist/pipeline-runner/index.js +1 -1
  16. package/dist/pipeline-runner/index.mjs +1 -1
  17. package/dist/recorder/index.js +4 -5
  18. package/dist/recorder/index.mjs +2 -2
  19. package/dist/stream-broker/_stub.js +2 -2
  20. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CbTGCEnd.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-Tbqpu0v3.mjs} +3 -3
  21. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-3STWM0yI.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DCsgcqTa.mjs} +1 -1
  22. package/dist/stream-broker/{_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-Dsz9DmNr.mjs → _virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CHcXI1Wf.mjs} +1 -1
  23. package/dist/stream-broker/{hostInit-BJ3QDdFs.mjs → hostInit-tIev5Gd9.mjs} +3 -3
  24. package/dist/stream-broker/index.js +9 -10
  25. package/dist/stream-broker/index.mjs +3 -3
  26. package/dist/stream-broker/remoteEntry.js +1 -1
  27. package/embed-dist/assets/{MaskShapeCanvas-DI4BY7W2-B4oJIlgF.js → MaskShapeCanvas-DI4BY7W2-C0kKwNX_.js} +1 -1
  28. package/embed-dist/assets/{MotionZonesSettings-C1EEbk2V-CUopGB1R.js → MotionZonesSettings-C1EEbk2V-CYtJc892.js} +1 -1
  29. package/embed-dist/assets/{PrivacyMaskSettings-APgPLF7p-CyTsHaor.js → PrivacyMaskSettings-APgPLF7p-C2SRtNe6.js} +1 -1
  30. package/embed-dist/assets/index-B2LRyXWh.js +80 -0
  31. package/embed-dist/index.html +1 -1
  32. package/package.json +1 -1
  33. package/dist/chunk-D6vf50IK.js +0 -28
  34. package/embed-dist/assets/index-hwJEVIPM.js +0 -80
@@ -4627,63 +4627,7 @@ function _instanceof(cls, params = {}) {
4627
4627
  return inst;
4628
4628
  }
4629
4629
  //#endregion
4630
- //#region ../types/dist/index.mjs
4631
- /**
4632
- * Deep wiring healthcheck — snapshot of active reachability probes across
4633
- * every declared capability + widget of every installed plugin, on every
4634
- * node. Produced by the backend `WiringHealthService` and surfaced via
4635
- * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
4636
- *
4637
- * Unlike `/health` (process liveness), this reflects whether each cap/widget
4638
- * is actually *reachable* over the real cap-dispatch path. See spec
4639
- * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
4640
- */
4641
- /** What kind of target a probe addressed. */
4642
- var wiringProbeKindSchema = _enum([
4643
- "singleton",
4644
- "device",
4645
- "widget"
4646
- ]);
4647
- /** Result of probing a single (cap|widget [, device]) target. */
4648
- var wiringProbeResultSchema = object({
4649
- capName: string(),
4650
- kind: wiringProbeKindSchema,
4651
- deviceId: number().optional(),
4652
- reachable: boolean(),
4653
- latencyMs: number(),
4654
- error: string().optional()
4655
- });
4656
- /** Per-addon roll-up of cap + widget probe results. */
4657
- var wiringAddonHealthSchema = object({
4658
- addonId: string(),
4659
- caps: array(wiringProbeResultSchema).readonly(),
4660
- widgets: array(wiringProbeResultSchema).readonly()
4661
- });
4662
- /** Per-node roll-up. */
4663
- var wiringNodeHealthSchema = object({
4664
- nodeId: string(),
4665
- addons: array(wiringAddonHealthSchema).readonly()
4666
- });
4667
- object({
4668
- /** True only when every probed target is reachable. */
4669
- ok: boolean(),
4670
- /** True when at least one target is unreachable. */
4671
- degraded: boolean(),
4672
- checkedAt: string(),
4673
- nodes: array(wiringNodeHealthSchema).readonly(),
4674
- summary: object({
4675
- total: number(),
4676
- reachable: number(),
4677
- unreachable: number()
4678
- })
4679
- });
4680
- var MODEL_FORMATS = [
4681
- "onnx",
4682
- "coreml",
4683
- "openvino",
4684
- "tflite",
4685
- "pt"
4686
- ];
4630
+ //#region ../types/dist/sleep-D7JeS58T.mjs
4687
4631
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
4688
4632
  EventCategory["SystemBoot"] = "system.boot";
4689
4633
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -6070,7 +6014,7 @@ function selectAssignedProfileSlots(slots, deviceId) {
6070
6014
  * Zod schema for StreamSourceEntry — the canonical stream descriptor
6071
6015
  * exposed by ICameraDevice.getStreamSources() and consumed by the broker.
6072
6016
  */
6073
- var StreamSourceEntrySchema = object({
6017
+ var StreamSourceEntrySchema$1 = object({
6074
6018
  id: string(),
6075
6019
  label: string(),
6076
6020
  protocol: _enum([
@@ -6293,1462 +6237,1678 @@ var ProfileRtspEntrySchema = object({
6293
6237
  resolution: CamStreamResolutionSchema.optional()
6294
6238
  });
6295
6239
  /**
6296
- * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6297
- * Named `RecordingWeekday` to avoid collision with the string-union
6298
- * `Weekday` exported from `interfaces/timezones.ts`.
6299
- */
6300
- var RecordingWeekdaySchema = number().int().min(0).max(6);
6301
- var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6302
- var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6303
- kind: literal("timeOfDay"),
6304
- start: string().regex(HHMM),
6305
- end: string().regex(HHMM),
6306
- /** Restrict to these weekdays; omit = every day. */
6307
- days: array(RecordingWeekdaySchema).optional()
6308
- })]);
6309
- var RecordingModeSchema = _enum([
6310
- "continuous",
6311
- "onMotion",
6312
- "onAudioThreshold"
6313
- ]);
6314
- /**
6315
- * First-class, authoritative per-camera storage mode — the netta choice the UI
6316
- * reads directly (never inferred from `rules`):
6317
- * - `off` — not recording.
6318
- * - `events` — record only around triggers (motion / audio threshold),
6319
- * with pre/post-buffer.
6320
- * - `continuous` — record 24/7 within the schedule.
6321
- *
6322
- * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6323
- * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6324
- */
6325
- var RecordingStorageModeSchema = _enum([
6326
- "off",
6327
- "events",
6328
- "continuous"
6329
- ]);
6330
- /** Which detectors trigger an `events`-mode recording. */
6331
- var RecordingTriggersSchema = object({
6332
- motion: boolean().optional(),
6333
- audioThresholdDbfs: number().optional()
6334
- });
6335
- /**
6336
- * Mode of a single recording band — the recorder per-band vocabulary.
6337
- *
6338
- * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6339
- * only ever `continuous` or `events`; "off" is expressed by the absence of a
6340
- * covering band, not by a band value.
6341
- */
6342
- var RecordingBandModeSchema = _enum(["continuous", "events"]);
6343
- /**
6344
- * Triggers for an `events`-mode band. Identical shape to
6345
- * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6346
- * two never drift.
6347
- */
6348
- var RecordingBandTriggersSchema = RecordingTriggersSchema;
6349
- /**
6350
- * A single mode-per-band window — the canonical recorder band shape, the
6351
- * single source of truth re-used by `addon-pipeline/recorder`.
6240
+ * Type-safe JSON parsing helpers.
6352
6241
  *
6353
- * `days` lists the weekdays the band covers (empty = every day, matching the
6354
- * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6355
- * span wraps past midnight (handled by the band engine).
6356
- */
6357
- var RecordingBandSchema = object({
6358
- days: array(RecordingWeekdaySchema),
6359
- start: string().regex(HHMM),
6360
- end: string().regex(HHMM),
6361
- mode: RecordingBandModeSchema,
6362
- triggers: RecordingBandTriggersSchema.optional(),
6363
- preBufferSec: number().min(0).optional(),
6364
- postBufferSec: number().min(0).optional()
6365
- });
6366
- var RecordingRuleSchema = object({
6367
- schedule: RecordingScheduleSchema,
6368
- mode: RecordingModeSchema,
6369
- /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6370
- preBufferSec: number().min(0).default(0),
6371
- /** Keep recording until this many seconds after the last trigger. */
6372
- postBufferSec: number().min(0).default(0),
6373
- /** Each new trigger restarts the post-buffer window. */
6374
- resetTimeoutOnNewEvent: boolean().default(true),
6375
- /** onAudioThreshold only — dBFS level that counts as a trigger. */
6376
- thresholdDbfs: number().optional()
6377
- });
6378
- /**
6379
- * Per-device retention overrides. Every field is optional; an unset or `0`
6380
- * value inherits the node-wide recorder default. Only footage-lifetime limits
6381
- * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6382
- * (when the volume is too full to keep recording) is NOT a per-camera concern —
6383
- * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6384
- * shared by every camera writing to that volume.
6242
+ * `JSON.parse` is typed as `any` in lib.es5.d.ts, which triggers
6243
+ * `no-unsafe-*` ESLint rules and destroys downstream inference. These
6244
+ * wrappers return `unknown` callers narrow structurally via type
6245
+ * guards, `typeof` checks, or helpers like `asRecord`/`asString`.
6385
6246
  */
6386
- var RecordingRetentionSchema = object({
6387
- maxAgeDays: number().min(0).optional(),
6388
- maxSizeGb: number().min(0).optional()
6389
- });
6390
6247
  /**
6391
- * The full per-camera recording intent — the wire shape of a RecordingTarget.
6248
+ * Parse JSON and return it as `unknown` — the only entry point for untrusted JSON.
6392
6249
  *
6393
- * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6394
- * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6395
- * only for transition + migration (`migrateRulesToMode`); the policy engine
6396
- * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6250
+ * The optional generic overload `parseJsonUnknown<T>(text)` returns `T` for
6251
+ * call sites that know the shape at parse time (e.g. MQTT payloads with a
6252
+ * known protocol schema). This is a **type-level bridge only** — no runtime
6253
+ * validation is performed. Callers that need runtime validation should parse
6254
+ * as `unknown` and narrow via Zod or structural guards.
6397
6255
  */
6398
- var RecordingConfigSchema = object({
6399
- enabled: boolean(),
6400
- /** Authoritative storage mode. Absent on legacy targets → derived once via
6401
- * `migrateRulesToMode`, then persisted. */
6402
- mode: RecordingStorageModeSchema.optional(),
6403
- profiles: array(CamProfileSchema).optional(),
6404
- segmentSeconds: number().int().positive().optional(),
6405
- /** Shared recording time-bands for `events` & `continuous` — record only when
6406
- * the wall-clock falls inside one of these windows. Omit or empty = always.
6407
- * `continuous` compiles to one rule per band; `events` to band × trigger. */
6408
- schedules: array(RecordingScheduleSchema).optional(),
6409
- /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6410
- * normalized into `schedules` on read and never written going forward. (Not
6411
- * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6412
- schedule: RecordingScheduleSchema.optional(),
6413
- /** `events`-mode only — which detectors trigger a recording. */
6414
- triggers: RecordingTriggersSchema.optional(),
6415
- /** `events`-mode only — seconds retained before / after a trigger. */
6416
- preBufferSec: number().min(0).optional(),
6417
- postBufferSec: number().min(0).optional(),
6418
- /** DEPRECATED authoring input; retained for migration/transition. */
6419
- rules: array(RecordingRuleSchema).optional(),
6420
- /**
6421
- * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6422
- * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6423
- * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6424
- * derived into bands once via `migrateConfigToBands`.
6425
- */
6426
- bands: array(RecordingBandSchema).optional(),
6427
- retention: RecordingRetentionSchema.optional()
6428
- });
6429
- /** All seven weekdays (0 = Sunday … 6 = Saturday), used when a schedule omits a
6430
- * weekday filter. */
6431
- var ALL_DAYS = [
6432
- 0,
6433
- 1,
6434
- 2,
6435
- 3,
6436
- 4,
6437
- 5,
6438
- 6
6439
- ];
6440
- /** Full-day span used to represent an `always` schedule as a band. The `HHMM`
6441
- * regex maxes out at 23:59, so a 00:00–23:59 same-day span ≈ all-day (the band
6442
- * engine treats `end > start` as a normal, non-wrapping span). */
6443
- var ALL_DAY_START = "00:00";
6444
- var ALL_DAY_END = "23:59";
6445
- function bandFromSchedule(schedule, mode, config) {
6446
- const days = schedule.kind === "timeOfDay" && schedule.days ? schedule.days : [...ALL_DAYS];
6447
- const start = schedule.kind === "timeOfDay" ? schedule.start : ALL_DAY_START;
6448
- const end = schedule.kind === "timeOfDay" ? schedule.end : ALL_DAY_END;
6449
- if (mode === "continuous") return {
6450
- days,
6451
- start,
6452
- end,
6453
- mode
6454
- };
6455
- return {
6456
- days,
6457
- start,
6458
- end,
6459
- mode,
6460
- ...config.triggers ? { triggers: config.triggers } : {},
6461
- ...config.preBufferSec !== void 0 ? { preBufferSec: config.preBufferSec } : {},
6462
- ...config.postBufferSec !== void 0 ? { postBufferSec: config.postBufferSec } : {}
6463
- };
6256
+ function parseJsonUnknown(text) {
6257
+ return JSON.parse(text);
6464
6258
  }
6465
- /**
6466
- * One-way migration from the legacy recording-config shape to the authoritative
6467
- * mode-per-band model. Pure (no clock access).
6468
- *
6469
- * - If `config.bands` is present, it is authoritative and returned as-is.
6470
- * - Otherwise the result is derived from the legacy fields: a disabled config or
6471
- * `mode: 'off'` yields no bands; every legacy schedule maps to one band whose
6472
- * mode is `continuous` when `config.mode === 'continuous'`, else `events`
6473
- * (carrying `triggers`/`preBufferSec`/`postBufferSec`).
6474
- */
6475
- function migrateConfigToBands(config) {
6476
- if (config.bands) return config.bands;
6477
- if (!config.enabled || config.mode === "off") return [];
6478
- const schedules = config.schedules ?? (config.schedule ? [config.schedule] : [{ kind: "always" }]);
6479
- const bandMode = config.mode === "continuous" ? "continuous" : "events";
6480
- return schedules.map((schedule) => bandFromSchedule(schedule, bandMode, config));
6259
+ /** Narrow an unknown value to a plain `Record<string, unknown>` or return null. */
6260
+ function asJsonObject(value) {
6261
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
6262
+ return { ...value };
6481
6263
  }
6482
- /**
6483
- * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6484
- * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6485
- * so the persisted record schema and the consumer-facing cap can both consume it
6486
- * without forming a circular import. The `storage` cap re-exports it
6487
- * verbatim for back-compat.
6488
- *
6489
- * This Zod schema is the **authoritative source** for `StorageLocationType`.
6490
- * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6491
- * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6492
- * `IStorageProvider` interface stay in lockstep.
6493
- *
6494
- * The type is now an **open string** (not a closed enum) — addons declare
6495
- * their own location kinds via `StorageLocationDeclaration.id`. The regex
6496
- * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6497
- */
6498
- var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6499
- /**
6500
- * Persisted record for a storage location instance. Operators can register
6501
- * multiple instances for multi-cardinality types (e.g. two `backups`
6502
- * locations with different `providerId`s). Cardinality is now declared per
6503
- * location via `StorageLocationDeclaration.cardinality` the static
6504
- * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6505
- *
6506
- * `id` is a stable namespaced string of the form `<type>:<slug>`.
6507
- * The default location for a type uses `id === <type>:default` by
6508
- * convention (the bare type ref like `'backups'` resolves to it).
6509
- *
6510
- * `isSystem: true` marks a location as orchestrator-seeded and
6511
- * undeletable. The bootstrap-installed defaults (one per type) carry
6512
- * this flag; operator-added locations don't. Editing the config of
6513
- * a system location is allowed (path migration, provider swap) but
6514
- * deleting it is rejected at the cap level.
6515
- */
6516
- var StorageLocationSchema = object({
6517
- id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6518
- type: string(),
6519
- displayName: string().min(1),
6520
- providerId: string().min(1),
6521
- config: record(string(), unknown()),
6522
- /**
6523
- * Cluster node this location physically lives on. REQUIRED for node-local
6524
- * providers (filesystem — the path exists on one node's disk), null/absent
6525
- * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6526
- * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6527
- * flag at upsert time, not here (the schema is provider-agnostic).
6528
- */
6529
- nodeId: string().optional(),
6530
- isDefault: boolean().default(false),
6531
- isSystem: boolean().default(false),
6532
- createdAt: number(),
6533
- updatedAt: number()
6534
- });
6535
- /**
6536
- * Reference accepted by consumer-facing `api.storage.*` calls.
6537
- * Either:
6538
- * - a `StorageLocationType` (e.g. `'backups'`) orchestrator resolves to the default of that type
6539
- * - a fully-qualified id (e.g. `'backups:nas-01'`) addresses a specific instance
6540
- *
6541
- * The orchestrator's `resolveRef(ref)` handles both cases.
6542
- */
6543
- var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
6544
- /**
6545
- * `StorageLocationDeclaration` a single storage-location entry declared by
6546
- * an addon in its `package.json` under `camstack.storageLocations`.
6547
- *
6548
- * Design intent:
6549
- * - **Addon declares its needs** — each addon describes the logical storage
6550
- * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
6551
- * about the physical path.
6552
- * - **Kernel aggregates** — at boot the kernel collects declarations from all
6553
- * installed addons, deduplicates by `id`, and exposes the union via the
6554
- * storage-locations settings surface.
6555
- * - **Orchestrator seeds** for every declared `id` the orchestrator ensures
6556
- * at least one instance named `<id>:default` is present, using
6557
- * `defaultsTo` to inherit the resolved root from another location when the
6558
- * declaration is a derivative slot (e.g. `recordingsLow` defaults to
6559
- * `recordings`).
6560
- * - **ids are global** — `id` values are shared across the entire deployment;
6561
- * two addons declaring the same `id` must agree on `cardinality` (validated
6562
- * at kernel aggregation time, not here).
6563
- */
6564
- var StorageLocationDeclarationSchema = object({
6565
- /**
6566
- * Global location identifier, e.g. `recordings` or `recordingsLow`.
6567
- * Must start with a lowercase letter and may contain letters, digits, and
6568
- * hyphens.
6569
- */
6570
- id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
6571
- /** Human-readable name shown in the admin UI. */
6572
- displayName: string().min(1, { message: "displayName must not be empty" }),
6573
- /** Optional longer explanation of what data this location stores. */
6574
- description: string().optional(),
6575
- /**
6576
- * `single` — exactly one instance of this location is allowed system-wide
6577
- * (e.g. `logs`, `models`). The operator can edit it but not add more.
6578
- * `multi` — the operator may register several instances (e.g. a second
6579
- * `recordings` on a NAS for disk tiering); one is the default at any time.
6580
- */
6581
- cardinality: _enum(["single", "multi"]),
6582
- /**
6583
- * When set, the default instance for this location inherits its resolved
6584
- * root from the named location's default instance. Useful for derivative
6585
- * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
6586
- * configure the primary location.
6587
- */
6588
- defaultsTo: string().optional()
6589
- });
6590
- var DecoderStatsSchema = object({
6591
- inputFps: number(),
6592
- outputFps: number(),
6593
- avgDecodeTimeMs: number(),
6594
- droppedFrames: number()
6595
- });
6596
- var DecoderSessionConfigSchema = object({
6597
- codec: string(),
6598
- maxFps: number().default(0),
6599
- outputFormat: _enum([
6600
- "jpeg",
6601
- "rgb",
6602
- "bgr",
6603
- "yuv420",
6604
- "gray"
6605
- ]).default("jpeg"),
6606
- scale: number().default(1),
6607
- width: number().optional(),
6608
- height: number().optional(),
6264
+ var DeviceType = /* @__PURE__ */ function(DeviceType) {
6265
+ DeviceType["Camera"] = "camera";
6266
+ DeviceType["Hub"] = "hub";
6267
+ DeviceType["Light"] = "light";
6268
+ DeviceType["Siren"] = "siren";
6269
+ DeviceType["Switch"] = "switch";
6270
+ DeviceType["Sensor"] = "sensor";
6271
+ DeviceType["Thermostat"] = "thermostat";
6272
+ DeviceType["Button"] = "button";
6273
+ /** Generic stateless event emitter carries a device's EXACT declared
6274
+ * event vocabulary verbatim (no normalization). Installed with the
6275
+ * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
6276
+ * HA bus events (e.g. `zha_event`, generic). */
6277
+ DeviceType["EventEmitter"] = "event-emitter";
6278
+ /** Firmware/software update entity current vs available version,
6279
+ * updatable flag, update state, and an install action. Installed with
6280
+ * the `update` cap. Sources: Homematic firmware-update channels (and
6281
+ * reusable by other providers, e.g. HA `update.*` entities). */
6282
+ DeviceType["Update"] = "update";
6283
+ DeviceType["Generic"] = "generic";
6284
+ /** Generic notification delivery target (HA `notify.<service>`, future
6285
+ * Telegram / Discord / ntfy / SMTP, …). One device per delivery
6286
+ * endpoint; the `notifier` cap defines the send surface. */
6287
+ DeviceType["Notifier"] = "notifier";
6288
+ /** Pre-recorded action sequence with optional parameters
6289
+ * (HA `script.*`). Runnable via `script-runner` cap. */
6290
+ DeviceType["Script"] = "script";
6291
+ /** Automation rule (HA `automation.*`) — enable/disable + manual
6292
+ * trigger surface exposed via `automation-control` cap. */
6293
+ DeviceType["Automation"] = "automation";
6294
+ /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
6295
+ DeviceType["Lock"] = "lock";
6296
+ /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
6297
+ * `valve.*`). `cover` cap with sub-roles for variant. */
6298
+ DeviceType["Cover"] = "cover";
6299
+ /** Pipe / water / gas valve with open/close/stop and optional
6300
+ * position (HA `valve.*`). `valve` cap — a cover-sibling actuator
6301
+ * modelled on the same open/closed lifecycle. */
6302
+ DeviceType["Valve"] = "valve";
6303
+ /** Humidifier / dehumidifier with on/off + target humidity + mode
6304
+ * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
6305
+ * modelled on the same target / mode lifecycle. */
6306
+ DeviceType["Humidifier"] = "humidifier";
6307
+ /** Water heater / boiler with target temperature + operation mode +
6308
+ * away mode (HA `water_heater.*`). `water-heater` cap a
6309
+ * climate-family actuator. */
6310
+ DeviceType["WaterHeater"] = "water-heater";
6311
+ /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
6312
+ DeviceType["Fan"] = "fan";
6313
+ /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
6314
+ * the camera surface — those use `Camera`. `media-player` cap. */
6315
+ DeviceType["MediaPlayer"] = "media-player";
6316
+ /** Security panel / alarm system (HA `alarm_control_panel.*`).
6317
+ * `alarm-panel` cap. */
6318
+ DeviceType["AlarmPanel"] = "alarm-panel";
6319
+ /** Generic user-settable input (HA `number` / `input_number` / `select`
6320
+ * / `input_select` / `text` / `input_text` / `input_datetime`).
6321
+ * Sub-type via `DeviceRole`: NumericControl / SelectControl /
6322
+ * TextControl / DateTimeControl. */
6323
+ DeviceType["Control"] = "control";
6324
+ /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
6325
+ * `presence` cap. */
6326
+ DeviceType["Presence"] = "presence";
6327
+ /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
6328
+ * `weather` cap. */
6329
+ DeviceType["Weather"] = "weather";
6330
+ /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
6331
+ DeviceType["Vacuum"] = "vacuum";
6332
+ /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
6333
+ * `lawn-mower-control` cap. */
6334
+ DeviceType["LawnMower"] = "lawn-mower";
6335
+ /** Physical HA device group parent container for entity-children
6336
+ * adopted from a single HA device entry. Not renderable as a
6337
+ * standalone device; exists only to anchor child entities. */
6338
+ DeviceType["Container"] = "container";
6339
+ /** Single still-image entity (HA `image.*`). Read-only display of an
6340
+ * `entity_picture` signed URL the browser loads directly. `image` cap. */
6341
+ DeviceType["Image"] = "image";
6342
+ return DeviceType;
6343
+ }({});
6344
+ var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
6345
+ DeviceFeature["BatteryOperated"] = "battery-operated";
6346
+ DeviceFeature["Rebootable"] = "rebootable";
6609
6347
  /**
6610
- * Identifier of the camera this decoder session serves. Optional
6611
- * because the cap is generic (any caller could request decode), but
6612
- * stream-broker passes it so decoder logs include `deviceId` for
6613
- * per-camera filtering when diagnosing failures (e.g. node-av
6614
- * sendPacket errors on a single hung camera).
6348
+ * Device supports an on-demand re-sync of its derived spec with its
6349
+ * upstream source drives the generic Re-sync button. The owning
6350
+ * provider implements the action via the `device-adoption.resync` cap.
6615
6351
  */
6616
- deviceId: number().int().nonnegative().optional(),
6352
+ DeviceFeature["Resyncable"] = "resyncable";
6353
+ DeviceFeature["NativeSnapshot"] = "native-snapshot";
6354
+ DeviceFeature["DoorbellButton"] = "doorbell-button";
6355
+ DeviceFeature["TwoWayAudio"] = "two-way-audio";
6356
+ DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
6617
6357
  /**
6618
- * Free-form tag for log scoping. Stream-broker uses
6619
- * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
6620
- * on every line so `grep tag=broker:5/high` filters one camera
6621
- * profile cleanly.
6358
+ * Camera supports the on-firmware autotrack subsystem (subject-
6359
+ * following). Distinct from `PanTiltZoom` because not every PTZ
6360
+ * camera ships autotrack the admin UI uses this flag to gate
6361
+ * the autotrack toggle / settings card without re-deriving from
6362
+ * the cap registry. Mirrors `ptz-autotrack` cap registration:
6363
+ * driver sets this feature when probe confirms the firmware
6364
+ * surface, and registers the cap in the same code path.
6622
6365
  */
6623
- tag: string().optional(),
6366
+ DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
6624
6367
  /**
6625
- * Where the session delivers decoded frames (Phase 5 / D9):
6368
+ * Accessory exposes a "trigger on motion" toggle the parent camera's
6369
+ * motion detection automatically activates this device. Mirrors
6370
+ * `motion-trigger` cap registration: drivers set this feature in the
6371
+ * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
6626
6372
  *
6627
- * - `'callback'` (default) the legacy pixel path: decoded frames are
6628
- * buffered as `DecodedFrame`s and drained via `pullFrames`.
6629
- * - `'shm'` the shared-memory frame plane: decoded frames are written
6630
- * into an OS shared-memory ring and drained as zero-pixel
6631
- * `FrameHandle`s via `pullHandles`. A session is one mode or the
6632
- * other — `pullFrames` returns nothing for an `'shm'` session and
6633
- * `pullHandles` returns nothing for a `'callback'` session.
6373
+ * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
6374
+ * fast scalar without binding fetch), notifier rules, and `listAll`
6375
+ * filters that want "all devices with on-motion behaviour".
6634
6376
  */
6635
- frameSink: _enum(["callback", "shm"]).default("callback")
6636
- });
6637
- var EncodeProfileSchema = object({
6638
- video: object({
6639
- codec: _enum([
6640
- "h264",
6641
- "h265",
6642
- "copy"
6643
- ]),
6644
- profile: _enum([
6645
- "baseline",
6646
- "main",
6647
- "high"
6648
- ]).optional(),
6649
- width: number().int().positive().optional(),
6650
- height: number().int().positive().optional(),
6651
- fps: number().positive().optional(),
6652
- bitrateKbps: number().int().positive().optional(),
6653
- gopFrames: number().int().positive().optional(),
6654
- bf: number().int().min(0).optional(),
6655
- preset: _enum([
6656
- "ultrafast",
6657
- "superfast",
6658
- "veryfast",
6659
- "faster",
6660
- "fast",
6661
- "medium"
6662
- ]).optional(),
6663
- tune: _enum([
6664
- "zerolatency",
6665
- "film",
6666
- "animation"
6667
- ]).optional()
6668
- }),
6669
- audio: union([literal("passthrough"), object({
6670
- codec: _enum([
6671
- "opus",
6672
- "aac",
6673
- "pcmu",
6674
- "pcma",
6675
- "copy"
6676
- ]),
6677
- bitrateKbps: number().int().positive().optional(),
6678
- sampleRateHz: number().int().positive().optional(),
6679
- channels: union([literal(1), literal(2)]).optional()
6680
- })]),
6681
- /**
6682
- * ffmpeg input-side args, inserted between the fixed global flags
6683
- * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
6684
- * the widget surfaces a textarea + suggestion chips for the most-
6685
- * used demuxer/format options.
6686
- */
6687
- inputArgs: array(string()).optional(),
6688
- /**
6689
- * ffmpeg output-side args, inserted between the encode block and
6690
- * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
6691
- * filters, codec-specific overrides. Free-text array.
6692
- */
6693
- outputArgs: array(string()).optional()
6694
- });
6695
- var HF_BASE_URL = `https://huggingface.co/camstack/camstack-models/resolve/main`;
6377
+ DeviceFeature["MotionTrigger"] = "motion-trigger";
6378
+ /** Light supports rgb-triplet color via `color` cap. */
6379
+ DeviceFeature["LightColorRgb"] = "light-color-rgb";
6380
+ /** Light supports HSV color via `color` cap. */
6381
+ DeviceFeature["LightColorHsv"] = "light-color-hsv";
6382
+ /** Light supports color-temperature (mired) via `color` cap. */
6383
+ DeviceFeature["LightColorMired"] = "light-color-mired";
6384
+ /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
6385
+ * targetHigh). Gates the range slider UI. */
6386
+ DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
6387
+ /** Thermostat exposes target humidity and/or current humidity
6388
+ * readings. Gates the humidity controls. */
6389
+ DeviceFeature["ClimateHumidity"] = "climate-humidity";
6390
+ /** Thermostat exposes a fan-mode selector. */
6391
+ DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
6392
+ /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
6393
+ DeviceFeature["ClimatePreset"] = "climate-preset";
6394
+ /** Cover exposes intermediate position control (0..100). Gates the
6395
+ * position slider UI. */
6396
+ DeviceFeature["CoverPositionable"] = "cover-positionable";
6397
+ /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
6398
+ DeviceFeature["CoverTilt"] = "cover-tilt";
6399
+ /** Valve exposes intermediate position control (0..100). Gates the
6400
+ * position slider / drag surface UI. */
6401
+ DeviceFeature["ValvePositionable"] = "valve-positionable";
6402
+ /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
6403
+ DeviceFeature["FanSpeed"] = "fan-speed";
6404
+ /** Fan exposes a preset mode selector. */
6405
+ DeviceFeature["FanPreset"] = "fan-preset";
6406
+ /** Fan exposes blade direction (forward/reverse) — typical of
6407
+ * ceiling fans. */
6408
+ DeviceFeature["FanDirection"] = "fan-direction";
6409
+ /** Fan exposes an oscillation toggle. */
6410
+ DeviceFeature["FanOscillating"] = "fan-oscillating";
6411
+ /** Lock requires a PIN code on lock/unlock. Gates the code-entry
6412
+ * field on the UI lock-controls panel. */
6413
+ DeviceFeature["LockPinRequired"] = "lock-pin-required";
6414
+ /** Lock supports a latch-release ("open door") action distinct from
6415
+ * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
6416
+ * `supported_features`. Gates the Open Door button in the UI. */
6417
+ DeviceFeature["LockOpen"] = "lock-open";
6418
+ /** Media player exposes a seek-to-position surface. */
6419
+ DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
6420
+ /** Media player exposes a volume-level setter. */
6421
+ DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
6422
+ /** Media player exposes a mute toggle distinct from volume=0. */
6423
+ DeviceFeature["MediaPlayerMute"] = "media-player-mute";
6424
+ /** Media player exposes a shuffle toggle. */
6425
+ DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
6426
+ /** Media player exposes a repeat mode (off / all / one). */
6427
+ DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
6428
+ /** Media player exposes a source / input selector. */
6429
+ DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
6430
+ /** Media player exposes a play-arbitrary-media surface (URL / id). */
6431
+ DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
6432
+ /** Media player exposes next-track. */
6433
+ DeviceFeature["MediaPlayerNext"] = "media-player-next";
6434
+ /** Media player exposes previous-track. */
6435
+ DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
6436
+ /** Media player exposes stop distinct from pause. */
6437
+ DeviceFeature["MediaPlayerStop"] = "media-player-stop";
6438
+ /** Alarm panel requires a PIN code on arm/disarm. */
6439
+ DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
6440
+ /** Presence device carries GPS coordinates (lat/lng/accuracy) in
6441
+ * addition to a textual location. */
6442
+ DeviceFeature["PresenceGps"] = "presence-gps";
6443
+ /** Notifier accepts an inline / URL image attachment. */
6444
+ DeviceFeature["NotifierImage"] = "notifier-image";
6445
+ /** Notifier accepts a priority hint (high/normal/low). */
6446
+ DeviceFeature["NotifierPriority"] = "notifier-priority";
6447
+ /** Notifier accepts a free-form `data` payload for platform-specific
6448
+ * fields. */
6449
+ DeviceFeature["NotifierData"] = "notifier-data";
6450
+ /** Notifier supports interactive action buttons / callbacks. */
6451
+ DeviceFeature["NotifierActions"] = "notifier-actions";
6452
+ /** Notifier supports per-call recipient targeting (multi-user). */
6453
+ DeviceFeature["NotifierRecipients"] = "notifier-recipients";
6454
+ /** Script runner accepts a variables map on each run invocation. */
6455
+ DeviceFeature["ScriptVariables"] = "script-variables";
6456
+ /** Automation `trigger` accepts a skipCondition flag — fires the
6457
+ * automation's actions while bypassing its condition block. */
6458
+ DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
6459
+ return DeviceFeature;
6460
+ }({});
6696
6461
  /**
6697
- * Type-safe JSON parsing helpers.
6462
+ * Semantic role a device plays within its parent. Populated by driver
6463
+ * addons when creating accessory devices (Reolink siren/floodlight/
6464
+ * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
6465
+ * admin UI to pick icons, labels, and widgets — a `Switch` with
6466
+ * `role: Floodlight` renders as a bulb with a brightness slider,
6467
+ * whereas a `Switch` with `role: Siren` renders as a klaxon.
6698
6468
  *
6699
- * `JSON.parse` is typed as `any` in lib.es5.d.ts, which triggers
6700
- * `no-unsafe-*` ESLint rules and destroys downstream inference. These
6701
- * wrappers return `unknown` — callers narrow structurally via type
6702
- * guards, `typeof` checks, or helpers like `asRecord`/`asString`.
6469
+ * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
6470
+ * sqlite as a nullable TEXT column — old rows keep working unchanged.
6703
6471
  */
6472
+ var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
6473
+ DeviceRole["Siren"] = "siren";
6474
+ DeviceRole["Floodlight"] = "floodlight";
6475
+ DeviceRole["Spotlight"] = "spotlight";
6476
+ DeviceRole["PirSensor"] = "pir-sensor";
6477
+ DeviceRole["Chime"] = "chime";
6478
+ DeviceRole["Autotrack"] = "autotrack";
6479
+ DeviceRole["Nightvision"] = "nightvision";
6480
+ DeviceRole["PrivacyMask"] = "privacy-mask";
6481
+ DeviceRole["Doorbell"] = "doorbell";
6482
+ /** Virtual HA toggle (input_boolean.*) — distinguishable from a
6483
+ * real Switch device for UI rendering / export adapters. */
6484
+ DeviceRole["BinaryHelper"] = "binary-helper";
6485
+ /** Generic motion / occupancy / moving event source. Distinct from
6486
+ * the camera accessory PirSensor role: that one is a camera child;
6487
+ * this is a standalone HA / 3rd-party motion sensor. */
6488
+ DeviceRole["MotionSensor"] = "motion-sensor";
6489
+ DeviceRole["ContactSensor"] = "contact-sensor";
6490
+ DeviceRole["LeakSensor"] = "leak-sensor";
6491
+ DeviceRole["SmokeSensor"] = "smoke-sensor";
6492
+ DeviceRole["COSensor"] = "co-sensor";
6493
+ DeviceRole["GasSensor"] = "gas-sensor";
6494
+ DeviceRole["TamperSensor"] = "tamper-sensor";
6495
+ DeviceRole["VibrationSensor"] = "vibration-sensor";
6496
+ DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
6497
+ DeviceRole["SoundSensor"] = "sound-sensor";
6498
+ /** Fallback for `binary_sensor` without a known `device_class`. */
6499
+ DeviceRole["BinarySensor"] = "binary-sensor";
6500
+ DeviceRole["TemperatureSensor"] = "temperature-sensor";
6501
+ DeviceRole["HumiditySensor"] = "humidity-sensor";
6502
+ DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
6503
+ DeviceRole["PressureSensor"] = "pressure-sensor";
6504
+ DeviceRole["PowerSensor"] = "power-sensor";
6505
+ DeviceRole["EnergySensor"] = "energy-sensor";
6506
+ DeviceRole["VoltageSensor"] = "voltage-sensor";
6507
+ DeviceRole["CurrentSensor"] = "current-sensor";
6508
+ DeviceRole["AirQualitySensor"] = "air-quality-sensor";
6509
+ /** Battery level (numeric % via `sensor` OR low-bool via
6510
+ * `binary_sensor` — the cap distinguishes via the value type). */
6511
+ DeviceRole["BatterySensor"] = "battery-sensor";
6512
+ /** Fallback for `sensor` numeric without a known `device_class`. */
6513
+ DeviceRole["NumericSensor"] = "numeric-sensor";
6514
+ /** String / enum state (HA `sensor` with `state_class: enum` or
6515
+ * `attributes.options`). */
6516
+ DeviceRole["EnumSensor"] = "enum-sensor";
6517
+ /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
6518
+ * or `date`). The slice carries the raw ISO string verbatim (hosted on
6519
+ * the `enum-sensor` cap); the UI renders it locale-formatted. */
6520
+ DeviceRole["DateTimeSensor"] = "datetime-sensor";
6521
+ /** Last-resort fallback when nothing else matches. */
6522
+ DeviceRole["GenericSensor"] = "generic-sensor";
6523
+ DeviceRole["NumericControl"] = "numeric-control";
6524
+ DeviceRole["SelectControl"] = "select-control";
6525
+ DeviceRole["TextControl"] = "text-control";
6526
+ DeviceRole["DateTimeControl"] = "datetime-control";
6527
+ /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
6528
+ * rich features (image, priority, channel routing). */
6529
+ DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
6530
+ /** Chat / messaging service (HA `notify.telegram_*`,
6531
+ * `notify.discord_*`, etc.). */
6532
+ DeviceRole["MessagingNotifier"] = "messaging-notifier";
6533
+ /** Email-based delivery (HA `notify.smtp`, etc.). */
6534
+ DeviceRole["EmailNotifier"] = "email-notifier";
6535
+ /** Fallback when the notifier service name doesn't match a known
6536
+ * pattern. */
6537
+ DeviceRole["GenericNotifier"] = "generic-notifier";
6538
+ return DeviceRole;
6539
+ }({});
6704
6540
  /**
6705
- * Parse JSON and return it as `unknown` — the only entry point for untrusted JSON.
6541
+ * Generic types for capability definitions.
6706
6542
  *
6707
- * The optional generic overload `parseJsonUnknown<T>(text)` returns `T` for
6708
- * call sites that know the shape at parse time (e.g. MQTT payloads with a
6709
- * known protocol schema). This is a **type-level bridge only** — no runtime
6710
- * validation is performed. Callers that need runtime validation should parse
6711
- * as `unknown` and narrow via Zod or structural guards.
6543
+ * A capability is defined with Zod schemas for methods, events, and settings.
6544
+ * TypeScript types are inferred via z.infer<> zero duplication.
6545
+ *
6546
+ * Pattern:
6547
+ * 1. Define Zod schemas for data, methods, settings
6548
+ * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
6549
+ * 3. Export type IProvider = InferProvider<typeof capabilityDef>
6550
+ * 4. Addon implements IProvider
6551
+ * 5. Registry auto-mounts tRPC router from definition.methods
6712
6552
  */
6713
- function parseJsonUnknown(text) {
6714
- return JSON.parse(text);
6715
- }
6716
- /** Narrow an unknown value to a plain `Record<string, unknown>` or return null. */
6717
- function asJsonObject(value) {
6718
- if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
6719
- return { ...value };
6720
- }
6721
- function hfModelUrl(repo, path) {
6722
- return `https://huggingface.co/${repo}/resolve/main/${path}`;
6723
- }
6724
6553
  /**
6725
- import { errMsg } from '@camstack/types'
6726
- * Extract a human-readable message from an unknown error value.
6727
- * Replaces the ubiquitous `errMsg(err)` pattern.
6728
- */
6729
- function errMsg(err) {
6730
- if (err instanceof Error) return err.message;
6731
- if (typeof err === "string") return err;
6732
- return String(err);
6554
+ * Output schema shared by the contribution + live methods.
6555
+ *
6556
+ * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
6557
+ * tabs[]) without importing from `../interfaces/config-ui.js` — a
6558
+ * concrete-but-lenient Zod object keeps tRPC output inference happy
6559
+ * (using `z.unknown()` here collapses unrelated router branches to
6560
+ * `unknown` when the generator re-inlines the huge AppRouter type).
6561
+ *
6562
+ * `.passthrough()` on sections/fields accepts whatever FormBuilder
6563
+ * extensions the caller adds (showWhen, displayScale, …) without
6564
+ * rebuilding every time a new field kind is introduced.
6565
+ */
6566
+ var ContributionSectionSchema = object({
6567
+ id: string(),
6568
+ title: string(),
6569
+ description: string().optional(),
6570
+ style: _enum(["card", "accordion"]).optional(),
6571
+ defaultCollapsed: boolean().optional(),
6572
+ columns: union([
6573
+ literal(1),
6574
+ literal(2),
6575
+ literal(3),
6576
+ literal(4)
6577
+ ]).optional(),
6578
+ tab: string().optional(),
6579
+ location: _enum(["settings", "top-tab"]).optional(),
6580
+ order: number().optional(),
6581
+ fields: array(any())
6582
+ });
6583
+ object({
6584
+ tabs: array(object({
6585
+ id: string(),
6586
+ label: string(),
6587
+ icon: string(),
6588
+ order: number().optional()
6589
+ })).optional(),
6590
+ sections: array(ContributionSectionSchema)
6591
+ }).nullable();
6592
+ object({ deviceId: number() }), object({ deviceId: number() }), object({
6593
+ deviceId: number(),
6594
+ patch: record(string(), unknown())
6595
+ }), object({ success: literal(true) });
6596
+ object({ deviceId: number() }), unknown().nullable();
6597
+ /** Shorthand to define a method schema */
6598
+ function method(input, output, options) {
6599
+ return {
6600
+ input,
6601
+ output,
6602
+ kind: options?.kind ?? "query",
6603
+ auth: options?.auth ?? "protected",
6604
+ ...options?.access !== void 0 ? { access: options.access } : {},
6605
+ timeoutMs: options?.timeoutMs
6606
+ };
6733
6607
  }
6734
- var COCO_80_LABELS = [
6735
- {
6736
- id: "person",
6737
- name: "Person"
6738
- },
6739
- {
6740
- id: "bicycle",
6741
- name: "Bicycle"
6742
- },
6743
- {
6744
- id: "car",
6745
- name: "Car"
6746
- },
6747
- {
6748
- id: "motorcycle",
6749
- name: "Motorcycle"
6750
- },
6751
- {
6752
- id: "airplane",
6753
- name: "Airplane"
6754
- },
6755
- {
6756
- id: "bus",
6757
- name: "Bus"
6758
- },
6759
- {
6760
- id: "train",
6761
- name: "Train"
6762
- },
6763
- {
6764
- id: "truck",
6765
- name: "Truck"
6766
- },
6767
- {
6768
- id: "boat",
6769
- name: "Boat"
6770
- },
6771
- {
6772
- id: "traffic light",
6773
- name: "Traffic Light"
6774
- },
6775
- {
6776
- id: "fire hydrant",
6777
- name: "Fire Hydrant"
6778
- },
6779
- {
6780
- id: "stop sign",
6781
- name: "Stop Sign"
6782
- },
6783
- {
6784
- id: "parking meter",
6785
- name: "Parking Meter"
6786
- },
6787
- {
6788
- id: "bench",
6789
- name: "Bench"
6790
- },
6791
- {
6792
- id: "bird",
6793
- name: "Bird"
6794
- },
6795
- {
6796
- id: "cat",
6797
- name: "Cat"
6798
- },
6799
- {
6800
- id: "dog",
6801
- name: "Dog"
6802
- },
6803
- {
6804
- id: "horse",
6805
- name: "Horse"
6806
- },
6807
- {
6808
- id: "sheep",
6809
- name: "Sheep"
6810
- },
6811
- {
6812
- id: "cow",
6813
- name: "Cow"
6814
- },
6815
- {
6816
- id: "elephant",
6817
- name: "Elephant"
6818
- },
6819
- {
6820
- id: "bear",
6821
- name: "Bear"
6822
- },
6823
- {
6824
- id: "zebra",
6825
- name: "Zebra"
6826
- },
6827
- {
6828
- id: "giraffe",
6829
- name: "Giraffe"
6830
- },
6831
- {
6832
- id: "backpack",
6833
- name: "Backpack"
6834
- },
6835
- {
6836
- id: "umbrella",
6837
- name: "Umbrella"
6838
- },
6839
- {
6840
- id: "handbag",
6841
- name: "Handbag"
6842
- },
6843
- {
6844
- id: "tie",
6845
- name: "Tie"
6846
- },
6847
- {
6848
- id: "suitcase",
6849
- name: "Suitcase"
6850
- },
6851
- {
6852
- id: "frisbee",
6853
- name: "Frisbee"
6854
- },
6855
- {
6856
- id: "skis",
6857
- name: "Skis"
6858
- },
6859
- {
6860
- id: "snowboard",
6861
- name: "Snowboard"
6862
- },
6863
- {
6864
- id: "sports ball",
6865
- name: "Sports Ball"
6866
- },
6867
- {
6868
- id: "kite",
6869
- name: "Kite"
6870
- },
6871
- {
6872
- id: "baseball bat",
6873
- name: "Baseball Bat"
6874
- },
6875
- {
6876
- id: "baseball glove",
6877
- name: "Baseball Glove"
6878
- },
6879
- {
6880
- id: "skateboard",
6881
- name: "Skateboard"
6882
- },
6883
- {
6884
- id: "surfboard",
6885
- name: "Surfboard"
6886
- },
6887
- {
6888
- id: "tennis racket",
6889
- name: "Tennis Racket"
6890
- },
6891
- {
6892
- id: "bottle",
6893
- name: "Bottle"
6894
- },
6895
- {
6896
- id: "wine glass",
6897
- name: "Wine Glass"
6898
- },
6899
- {
6900
- id: "cup",
6901
- name: "Cup"
6902
- },
6903
- {
6904
- id: "fork",
6905
- name: "Fork"
6906
- },
6907
- {
6908
- id: "knife",
6909
- name: "Knife"
6910
- },
6911
- {
6912
- id: "spoon",
6913
- name: "Spoon"
6914
- },
6915
- {
6916
- id: "bowl",
6917
- name: "Bowl"
6918
- },
6919
- {
6920
- id: "banana",
6921
- name: "Banana"
6922
- },
6923
- {
6924
- id: "apple",
6925
- name: "Apple"
6926
- },
6927
- {
6928
- id: "sandwich",
6929
- name: "Sandwich"
6930
- },
6931
- {
6932
- id: "orange",
6933
- name: "Orange"
6934
- },
6935
- {
6936
- id: "broccoli",
6937
- name: "Broccoli"
6938
- },
6939
- {
6940
- id: "carrot",
6941
- name: "Carrot"
6942
- },
6943
- {
6944
- id: "hot dog",
6945
- name: "Hot Dog"
6946
- },
6947
- {
6948
- id: "pizza",
6949
- name: "Pizza"
6950
- },
6951
- {
6952
- id: "donut",
6953
- name: "Donut"
6954
- },
6955
- {
6956
- id: "cake",
6957
- name: "Cake"
6958
- },
6959
- {
6960
- id: "chair",
6961
- name: "Chair"
6962
- },
6963
- {
6964
- id: "couch",
6965
- name: "Couch"
6966
- },
6967
- {
6968
- id: "potted plant",
6969
- name: "Potted Plant"
6970
- },
6971
- {
6972
- id: "bed",
6973
- name: "Bed"
6974
- },
6975
- {
6976
- id: "dining table",
6977
- name: "Dining Table"
6978
- },
6979
- {
6980
- id: "toilet",
6981
- name: "Toilet"
6982
- },
6983
- {
6984
- id: "tv",
6985
- name: "TV"
6986
- },
6987
- {
6988
- id: "laptop",
6989
- name: "Laptop"
6990
- },
6991
- {
6992
- id: "mouse",
6993
- name: "Mouse"
6994
- },
6995
- {
6996
- id: "remote",
6997
- name: "Remote"
6998
- },
6999
- {
7000
- id: "keyboard",
7001
- name: "Keyboard"
7002
- },
7003
- {
7004
- id: "cell phone",
7005
- name: "Cell Phone"
7006
- },
7007
- {
7008
- id: "microwave",
7009
- name: "Microwave"
7010
- },
7011
- {
7012
- id: "oven",
7013
- name: "Oven"
7014
- },
7015
- {
7016
- id: "toaster",
7017
- name: "Toaster"
7018
- },
7019
- {
7020
- id: "sink",
7021
- name: "Sink"
7022
- },
7023
- {
7024
- id: "refrigerator",
7025
- name: "Refrigerator"
7026
- },
7027
- {
7028
- id: "book",
7029
- name: "Book"
7030
- },
7031
- {
7032
- id: "clock",
7033
- name: "Clock"
7034
- },
7035
- {
7036
- id: "vase",
7037
- name: "Vase"
7038
- },
7039
- {
7040
- id: "scissors",
7041
- name: "Scissors"
7042
- },
7043
- {
7044
- id: "teddy bear",
7045
- name: "Teddy Bear"
7046
- },
7047
- {
7048
- id: "hair drier",
7049
- name: "Hair Drier"
7050
- },
7051
- {
7052
- id: "toothbrush",
7053
- name: "Toothbrush"
7054
- }
7055
- ];
7056
- var COCO_TO_MACRO = {
7057
- mapping: {
7058
- person: "person",
7059
- bicycle: "vehicle",
7060
- car: "vehicle",
7061
- motorcycle: "vehicle",
7062
- airplane: "vehicle",
7063
- bus: "vehicle",
7064
- train: "vehicle",
7065
- truck: "vehicle",
7066
- boat: "vehicle",
7067
- bird: "animal",
7068
- cat: "animal",
7069
- dog: "animal",
7070
- horse: "animal",
7071
- sheep: "animal",
7072
- cow: "animal",
7073
- elephant: "animal",
7074
- bear: "animal",
7075
- zebra: "animal",
7076
- giraffe: "animal"
7077
- },
7078
- preserveOriginal: false
7079
- };
7080
- var AUDIO_MACRO_LABELS = [
7081
- {
7082
- id: "speech",
7083
- name: "Speech",
7084
- icon: "🗣️"
7085
- },
7086
- {
7087
- id: "scream",
7088
- name: "Scream / Shout",
7089
- icon: "😱"
7090
- },
7091
- {
7092
- id: "crying",
7093
- name: "Crying / Baby",
7094
- icon: "😢"
7095
- },
7096
- {
7097
- id: "laughter",
7098
- name: "Laughter",
7099
- icon: "😂"
7100
- },
7101
- {
7102
- id: "music",
7103
- name: "Music",
7104
- icon: "🎵"
7105
- },
7106
- {
7107
- id: "dog",
7108
- name: "Dog",
7109
- icon: "🐕"
7110
- },
7111
- {
7112
- id: "cat",
7113
- name: "Cat",
7114
- icon: "🐈"
7115
- },
7116
- {
7117
- id: "bird",
7118
- name: "Bird",
7119
- icon: "🐦"
7120
- },
7121
- {
7122
- id: "animal",
7123
- name: "Animal (other)",
7124
- icon: "🐾"
7125
- },
7126
- {
7127
- id: "alarm",
7128
- name: "Alarm / Siren",
7129
- icon: "🚨"
7130
- },
7131
- {
7132
- id: "doorbell",
7133
- name: "Doorbell / Knock",
7134
- icon: "🔔"
7135
- },
7136
- {
7137
- id: "glass_breaking",
7138
- name: "Glass Breaking",
7139
- icon: "💥"
7140
- },
7141
- {
7142
- id: "gunshot",
7143
- name: "Gunshot / Explosion",
7144
- icon: "💣"
7145
- },
7146
- {
7147
- id: "vehicle",
7148
- name: "Vehicle",
7149
- icon: "🚗"
7150
- },
7151
- {
7152
- id: "siren",
7153
- name: "Emergency Siren",
7154
- icon: "🚑"
7155
- },
7156
- {
7157
- id: "fire",
7158
- name: "Fire / Smoke",
7159
- icon: "🔥"
7160
- },
7161
- {
7162
- id: "water",
7163
- name: "Water",
7164
- icon: "💧"
7165
- },
7166
- {
7167
- id: "wind",
7168
- name: "Wind / Weather",
7169
- icon: "🌬️"
7170
- },
7171
- {
7172
- id: "door",
7173
- name: "Door",
7174
- icon: "🚪"
7175
- },
7176
- {
7177
- id: "footsteps",
7178
- name: "Footsteps",
7179
- icon: "👣"
7180
- },
7181
- {
7182
- id: "crowd",
7183
- name: "Crowd / Chatter",
7184
- icon: "👥"
7185
- },
7186
- {
7187
- id: "telephone",
7188
- name: "Telephone",
7189
- icon: "📞"
7190
- },
7191
- {
7192
- id: "engine",
7193
- name: "Engine / Motor",
7194
- icon: "⚙️"
7195
- },
7196
- {
7197
- id: "tools",
7198
- name: "Tools / Construction",
7199
- icon: "🔨"
7200
- },
7201
- {
7202
- id: "silence",
7203
- name: "Silence",
7204
- icon: "🤫"
7205
- }
7206
- ];
7207
- var YAMNET_TO_MACRO = {
7208
- mapping: {
7209
- Speech: "speech",
7210
- "Child speech, kid speaking": "speech",
7211
- Conversation: "speech",
7212
- "Narration, monologue": "speech",
7213
- Babbling: "speech",
7214
- Whispering: "speech",
7215
- "Speech synthesizer": "speech",
7216
- Humming: "speech",
7217
- Rapping: "speech",
7218
- Singing: "speech",
7219
- Choir: "speech",
7220
- "Child singing": "speech",
7221
- Shout: "scream",
7222
- Bellow: "scream",
7223
- Yell: "scream",
7224
- Screaming: "scream",
7225
- "Children shouting": "scream",
7226
- Whoop: "scream",
7227
- "Crying, sobbing": "crying",
7228
- "Baby cry, infant cry": "crying",
7229
- Whimper: "crying",
7230
- "Wail, moan": "crying",
7231
- Groan: "crying",
7232
- Laughter: "laughter",
7233
- "Baby laughter": "laughter",
7234
- Giggle: "laughter",
7235
- Snicker: "laughter",
7236
- "Belly laugh": "laughter",
7237
- "Chuckle, chortle": "laughter",
7238
- Music: "music",
7239
- "Musical instrument": "music",
7240
- Guitar: "music",
7241
- Piano: "music",
7242
- Drum: "music",
7243
- "Drum kit": "music",
7244
- "Violin, fiddle": "music",
7245
- Flute: "music",
7246
- Saxophone: "music",
7247
- Trumpet: "music",
7248
- Synthesizer: "music",
7249
- "Pop music": "music",
7250
- "Rock music": "music",
7251
- "Hip hop music": "music",
7252
- "Classical music": "music",
7253
- Jazz: "music",
7254
- "Electronic music": "music",
7255
- "Background music": "music",
7256
- Dog: "dog",
7257
- Bark: "dog",
7258
- Yip: "dog",
7259
- Howl: "dog",
7260
- "Bow-wow": "dog",
7261
- Growling: "dog",
7262
- "Whimper (dog)": "dog",
7263
- Cat: "cat",
7264
- Purr: "cat",
7265
- Meow: "cat",
7266
- Hiss: "cat",
7267
- Caterwaul: "cat",
7268
- Bird: "bird",
7269
- "Bird vocalization, bird call, bird song": "bird",
7270
- "Chirp, tweet": "bird",
7271
- Squawk: "bird",
7272
- Crow: "bird",
7273
- Owl: "bird",
7274
- "Pigeon, dove": "bird",
7275
- Animal: "animal",
7276
- "Domestic animals, pets": "animal",
7277
- "Livestock, farm animals, working animals": "animal",
7278
- Horse: "animal",
7279
- "Cattle, bovinae": "animal",
7280
- Pig: "animal",
7281
- Sheep: "animal",
7282
- Goat: "animal",
7283
- Frog: "animal",
7284
- Insect: "animal",
7285
- Cricket: "animal",
7286
- Alarm: "alarm",
7287
- "Alarm clock": "alarm",
7288
- "Smoke detector, smoke alarm": "alarm",
7289
- "Fire alarm": "alarm",
7290
- Buzzer: "alarm",
7291
- "Civil defense siren": "alarm",
7292
- "Car alarm": "alarm",
7293
- Siren: "siren",
7294
- "Police car (siren)": "siren",
7295
- "Ambulance (siren)": "siren",
7296
- "Fire engine, fire truck (siren)": "siren",
7297
- "Emergency vehicle": "siren",
7298
- Foghorn: "siren",
7299
- Doorbell: "doorbell",
7300
- "Ding-dong": "doorbell",
7301
- Knock: "doorbell",
7302
- Tap: "doorbell",
7303
- Glass: "glass_breaking",
7304
- Shatter: "glass_breaking",
7305
- "Chink, clink": "glass_breaking",
7306
- "Gunshot, gunfire": "gunshot",
7307
- "Machine gun": "gunshot",
7308
- Explosion: "gunshot",
7309
- Fireworks: "gunshot",
7310
- Firecracker: "gunshot",
7311
- "Artillery fire": "gunshot",
7312
- "Cap gun": "gunshot",
7313
- Boom: "gunshot",
7314
- Vehicle: "vehicle",
7315
- Car: "vehicle",
7316
- Truck: "vehicle",
7317
- Bus: "vehicle",
7318
- Motorcycle: "vehicle",
7319
- "Car passing by": "vehicle",
7320
- "Vehicle horn, car horn, honking": "vehicle",
7321
- "Traffic noise, roadway noise": "vehicle",
7322
- Train: "vehicle",
7323
- Aircraft: "vehicle",
7324
- Helicopter: "vehicle",
7325
- Bicycle: "vehicle",
7326
- Skateboard: "vehicle",
7327
- Fire: "fire",
7328
- Crackle: "fire",
7329
- Water: "water",
7330
- Rain: "water",
7331
- Raindrop: "water",
7332
- "Rain on surface": "water",
7333
- Stream: "water",
7334
- Waterfall: "water",
7335
- Ocean: "water",
7336
- "Waves, surf": "water",
7337
- "Splash, splatter": "water",
7338
- Wind: "wind",
7339
- Thunderstorm: "wind",
7340
- Thunder: "wind",
7341
- "Wind noise (microphone)": "wind",
7342
- "Rustling leaves": "wind",
7343
- Door: "door",
7344
- "Sliding door": "door",
7345
- Slam: "door",
7346
- "Cupboard open or close": "door",
7347
- "Walk, footsteps": "footsteps",
7348
- Run: "footsteps",
7349
- Shuffle: "footsteps",
7350
- Crowd: "crowd",
7351
- Chatter: "crowd",
7352
- Cheering: "crowd",
7353
- Applause: "crowd",
7354
- "Children playing": "crowd",
7355
- "Hubbub, speech noise, speech babble": "crowd",
7356
- Telephone: "telephone",
7357
- "Telephone bell ringing": "telephone",
7358
- Ringtone: "telephone",
7359
- "Telephone dialing, DTMF": "telephone",
7360
- "Busy signal": "telephone",
7361
- Engine: "engine",
7362
- "Engine starting": "engine",
7363
- Idling: "engine",
7364
- "Accelerating, revving, vroom": "engine",
7365
- "Light engine (high frequency)": "engine",
7366
- "Medium engine (mid frequency)": "engine",
7367
- "Heavy engine (low frequency)": "engine",
7368
- "Lawn mower": "engine",
7369
- Chainsaw: "engine",
7370
- Hammer: "tools",
7371
- Jackhammer: "tools",
7372
- Sawing: "tools",
7373
- "Power tool": "tools",
7374
- Drill: "tools",
7375
- Sanding: "tools",
7376
- Silence: "silence"
7377
- },
7378
- preserveOriginal: false
7379
- };
7380
- var APPLE_SA_TO_MACRO = {
7381
- mapping: {
7382
- speech: "speech",
7383
- child_speech: "speech",
7384
- conversation: "speech",
7385
- whispering: "speech",
7386
- singing: "speech",
7387
- humming: "speech",
7388
- shout: "scream",
7389
- yell: "scream",
7390
- screaming: "scream",
7391
- crying: "crying",
7392
- baby_crying: "crying",
7393
- sobbing: "crying",
7394
- laughter: "laughter",
7395
- baby_laughter: "laughter",
7396
- giggling: "laughter",
7397
- music: "music",
7398
- guitar: "music",
7399
- piano: "music",
7400
- drums: "music",
7401
- dog_bark: "dog",
7402
- dog_bow_wow: "dog",
7403
- dog_growling: "dog",
7404
- dog_howl: "dog",
7405
- cat_meow: "cat",
7406
- cat_purr: "cat",
7407
- cat_hiss: "cat",
7408
- bird: "bird",
7409
- bird_chirp: "bird",
7410
- bird_squawk: "bird",
7411
- animal: "animal",
7412
- horse: "animal",
7413
- cow_moo: "animal",
7414
- insect: "animal",
7415
- alarm: "alarm",
7416
- smoke_alarm: "alarm",
7417
- fire_alarm: "alarm",
7418
- car_alarm: "alarm",
7419
- siren: "siren",
7420
- police_siren: "siren",
7421
- ambulance_siren: "siren",
7422
- doorbell: "doorbell",
7423
- door_knock: "doorbell",
7424
- knocking: "doorbell",
7425
- glass_breaking: "glass_breaking",
7426
- glass_shatter: "glass_breaking",
7427
- gunshot: "gunshot",
7428
- explosion: "gunshot",
7429
- fireworks: "gunshot",
7430
- car: "vehicle",
7431
- truck: "vehicle",
7432
- motorcycle: "vehicle",
7433
- car_horn: "vehicle",
7434
- vehicle_horn: "vehicle",
7435
- traffic: "vehicle",
7436
- fire: "fire",
7437
- fire_crackle: "fire",
7438
- water: "water",
7439
- rain: "water",
7440
- ocean: "water",
7441
- splash: "water",
7442
- wind: "wind",
7443
- thunder: "wind",
7444
- thunderstorm: "wind",
7445
- door: "door",
7446
- door_slam: "door",
7447
- sliding_door: "door",
7448
- footsteps: "footsteps",
7449
- walking: "footsteps",
7450
- running: "footsteps",
7451
- crowd: "crowd",
7452
- chatter: "crowd",
7453
- cheering: "crowd",
7454
- applause: "crowd",
7455
- telephone_ring: "telephone",
7456
- ringtone: "telephone",
7457
- engine: "engine",
7458
- engine_starting: "engine",
7459
- lawn_mower: "engine",
7460
- chainsaw: "engine",
7461
- hammer: "tools",
7462
- jackhammer: "tools",
7463
- drill: "tools",
7464
- power_tool: "tools",
7465
- silence: "silence"
7466
- },
7467
- preserveOriginal: false
7468
- };
7469
- var _macroLookup = /* @__PURE__ */ new Map();
7470
- for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7471
- for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7472
- /** Map a raw audio label (YAMNet or Apple SoundAnalysis) to its macro class. Returns null if unmapped. */
7473
- function mapAudioLabelToMacro(label) {
7474
- return _macroLookup.get(label.toLowerCase()) ?? null;
6608
+ /** Shorthand to define an event schema */
6609
+ function event(data) {
6610
+ return { data };
6611
+ }
6612
+ var StaticDirOutputSchema = object({ staticDir: string() });
6613
+ var VersionOutputSchema = object({ version: string() });
6614
+ method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
6615
+ /**
6616
+ * device-ops — device-scoped cap that unifies the per-IDevice operations
6617
+ * previously routed through the `.device-ops` Moleculer bridge service.
6618
+ *
6619
+ * Each worker that hosts live `IDevice` instances auto-registers a native
6620
+ * provider for this cap (per device) backed by its local
6621
+ * `DeviceRegistry`. Hub-side callers reach it transparently through
6622
+ * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
6623
+ * `deviceId` + `nodeId` and dispatches through the standard cap-router,
6624
+ * so there's no parallel bridge path anymore.
6625
+ *
6626
+ * The surface is intentionally small — every method corresponds to a
6627
+ * single action on the live `IDevice` (or `ICameraDevice` for
6628
+ * `getStreamSources`). Richer orchestration (enable/disable with
6629
+ * integration plumbing, bulk updates) stays in the `device-manager` cap;
6630
+ * `device-ops` is the per-device primitive the device-manager routes to.
6631
+ */
6632
+ var StreamSourceEntrySchema = object({
6633
+ id: string(),
6634
+ label: string(),
6635
+ protocol: _enum([
6636
+ "rtsp",
6637
+ "rtmp",
6638
+ "annexb",
6639
+ "http-mjpeg",
6640
+ "webrtc",
6641
+ "custom"
6642
+ ]),
6643
+ url: string().optional(),
6644
+ resolution: object({
6645
+ width: number(),
6646
+ height: number()
6647
+ }).optional(),
6648
+ fps: number().optional(),
6649
+ bitrate: number().optional(),
6650
+ codec: string().optional(),
6651
+ profileHint: CamProfileSchema.optional(),
6652
+ sdp: string().optional()
6653
+ });
6654
+ var ConfigEntrySchema$1 = object({
6655
+ key: string(),
6656
+ value: unknown()
6657
+ });
6658
+ var RawStateResultSchema = object({
6659
+ /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
6660
+ source: string(),
6661
+ /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
6662
+ data: record(string(), unknown())
6663
+ });
6664
+ method(object({ deviceId: number() }), array(StreamSourceEntrySchema)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
6665
+ deviceId: number(),
6666
+ values: record(string(), unknown())
6667
+ }), _void(), { kind: "mutation" }), method(object({
6668
+ deviceId: number(),
6669
+ action: string().min(1),
6670
+ input: unknown()
6671
+ }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
6672
+ /**
6673
+ * Promise-based timer helpers — used everywhere the codebase needs to
6674
+ * wait, back off, or schedule a retry. Before these helpers landed, each
6675
+ * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
6676
+ * with subtle variations (some swallowing cancellation, some not). Two
6677
+ * shapes cover every observed use case:
6678
+ *
6679
+ * - {@link sleep} for a plain, uncancellable wait — the default choice.
6680
+ * - {@link sleepCancellable} for a wait that wakes early when an
6681
+ * abort signal trips, used by long-running pollers whose teardown
6682
+ * must stop a pending backoff promptly.
6683
+ */
6684
+ /**
6685
+ * Resolve after `ms` milliseconds. Never rejects, never cancels. The
6686
+ * sleep cannot be interrupted; for a wakeable variant use
6687
+ * {@link sleepCancellable}.
6688
+ *
6689
+ * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
6690
+ * still gives the event loop a chance to drain — useful for breaking
6691
+ * up tight async loops without changing call-site semantics.
6692
+ */
6693
+ function sleep(ms) {
6694
+ return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
6695
+ }
6696
+ //#endregion
6697
+ //#region ../types/dist/err-msg-IQTHeDzc.mjs
6698
+ /**
6699
+ import { errMsg } from '@camstack/types'
6700
+ * Extract a human-readable message from an unknown error value.
6701
+ * Replaces the ubiquitous `errMsg(err)` pattern.
6702
+ */
6703
+ function errMsg(err) {
6704
+ if (err instanceof Error) return err.message;
6705
+ if (typeof err === "string") return err;
6706
+ return String(err);
6707
+ }
6708
+ //#endregion
6709
+ //#region ../types/dist/index.mjs
6710
+ /**
6711
+ * Deep wiring healthcheck — snapshot of active reachability probes across
6712
+ * every declared capability + widget of every installed plugin, on every
6713
+ * node. Produced by the backend `WiringHealthService` and surfaced via
6714
+ * `GET /health/wiring`, the tRPC `health.wiring` query, and the boot-gate.
6715
+ *
6716
+ * Unlike `/health` (process liveness), this reflects whether each cap/widget
6717
+ * is actually *reachable* over the real cap-dispatch path. See spec
6718
+ * `docs/superpowers/specs/2026-05-23-deep-healthcheck-design.md`.
6719
+ */
6720
+ /** What kind of target a probe addressed. */
6721
+ var wiringProbeKindSchema = _enum([
6722
+ "singleton",
6723
+ "device",
6724
+ "widget"
6725
+ ]);
6726
+ /** Result of probing a single (cap|widget [, device]) target. */
6727
+ var wiringProbeResultSchema = object({
6728
+ capName: string(),
6729
+ kind: wiringProbeKindSchema,
6730
+ deviceId: number().optional(),
6731
+ reachable: boolean(),
6732
+ latencyMs: number(),
6733
+ error: string().optional()
6734
+ });
6735
+ /** Per-addon roll-up of cap + widget probe results. */
6736
+ var wiringAddonHealthSchema = object({
6737
+ addonId: string(),
6738
+ caps: array(wiringProbeResultSchema).readonly(),
6739
+ widgets: array(wiringProbeResultSchema).readonly()
6740
+ });
6741
+ /** Per-node roll-up. */
6742
+ var wiringNodeHealthSchema = object({
6743
+ nodeId: string(),
6744
+ addons: array(wiringAddonHealthSchema).readonly()
6745
+ });
6746
+ object({
6747
+ /** True only when every probed target is reachable. */
6748
+ ok: boolean(),
6749
+ /** True when at least one target is unreachable. */
6750
+ degraded: boolean(),
6751
+ checkedAt: string(),
6752
+ nodes: array(wiringNodeHealthSchema).readonly(),
6753
+ summary: object({
6754
+ total: number(),
6755
+ reachable: number(),
6756
+ unreachable: number()
6757
+ })
6758
+ });
6759
+ var MODEL_FORMATS = [
6760
+ "onnx",
6761
+ "coreml",
6762
+ "openvino",
6763
+ "tflite",
6764
+ "pt"
6765
+ ];
6766
+ /**
6767
+ * Numeric day-of-week: 0 = Sunday … 6 = Saturday (matches `Date.getDay`).
6768
+ * Named `RecordingWeekday` to avoid collision with the string-union
6769
+ * `Weekday` exported from `interfaces/timezones.ts`.
6770
+ */
6771
+ var RecordingWeekdaySchema = number().int().min(0).max(6);
6772
+ var HHMM = /^([01]\d|2[0-3]):[0-5]\d$/;
6773
+ var RecordingScheduleSchema = discriminatedUnion("kind", [object({ kind: literal("always") }), object({
6774
+ kind: literal("timeOfDay"),
6775
+ start: string().regex(HHMM),
6776
+ end: string().regex(HHMM),
6777
+ /** Restrict to these weekdays; omit = every day. */
6778
+ days: array(RecordingWeekdaySchema).optional()
6779
+ })]);
6780
+ var RecordingModeSchema = _enum([
6781
+ "continuous",
6782
+ "onMotion",
6783
+ "onAudioThreshold"
6784
+ ]);
6785
+ /**
6786
+ * First-class, authoritative per-camera storage mode — the netta choice the UI
6787
+ * reads directly (never inferred from `rules`):
6788
+ * - `off` — not recording.
6789
+ * - `events` — record only around triggers (motion / audio threshold),
6790
+ * with pre/post-buffer.
6791
+ * - `continuous` — record 24/7 within the schedule.
6792
+ *
6793
+ * `mode` compiles one-way to the internal `rules[]` consumed by the policy
6794
+ * engine (see `compileRules`); `rules[]` is never authored directly anymore.
6795
+ */
6796
+ var RecordingStorageModeSchema = _enum([
6797
+ "off",
6798
+ "events",
6799
+ "continuous"
6800
+ ]);
6801
+ /** Which detectors trigger an `events`-mode recording. */
6802
+ var RecordingTriggersSchema = object({
6803
+ motion: boolean().optional(),
6804
+ audioThresholdDbfs: number().optional()
6805
+ });
6806
+ /**
6807
+ * Mode of a single recording band — the recorder per-band vocabulary.
6808
+ *
6809
+ * Distinct from `RecordingStorageModeSchema` (which carries `off`): a band is
6810
+ * only ever `continuous` or `events`; "off" is expressed by the absence of a
6811
+ * covering band, not by a band value.
6812
+ */
6813
+ var RecordingBandModeSchema = _enum(["continuous", "events"]);
6814
+ /**
6815
+ * Triggers for an `events`-mode band. Identical shape to
6816
+ * `RecordingTriggersSchema` — reuse that schema as the band trigger type so the
6817
+ * two never drift.
6818
+ */
6819
+ var RecordingBandTriggersSchema = RecordingTriggersSchema;
6820
+ /**
6821
+ * A single mode-per-band window — the canonical recorder band shape, the
6822
+ * single source of truth re-used by `addon-pipeline/recorder`.
6823
+ *
6824
+ * `days` lists the weekdays the band covers (empty = every day, matching the
6825
+ * band engine's `applies` rule). `start`/`end` are `HH:MM`; an `end <= start`
6826
+ * span wraps past midnight (handled by the band engine).
6827
+ */
6828
+ var RecordingBandSchema = object({
6829
+ days: array(RecordingWeekdaySchema),
6830
+ start: string().regex(HHMM),
6831
+ end: string().regex(HHMM),
6832
+ mode: RecordingBandModeSchema,
6833
+ triggers: RecordingBandTriggersSchema.optional(),
6834
+ preBufferSec: number().min(0).optional(),
6835
+ postBufferSec: number().min(0).optional()
6836
+ });
6837
+ var RecordingRuleSchema = object({
6838
+ schedule: RecordingScheduleSchema,
6839
+ mode: RecordingModeSchema,
6840
+ /** Seconds of footage to retain BEFORE a trigger (applied at keep/discard). */
6841
+ preBufferSec: number().min(0).default(0),
6842
+ /** Keep recording until this many seconds after the last trigger. */
6843
+ postBufferSec: number().min(0).default(0),
6844
+ /** Each new trigger restarts the post-buffer window. */
6845
+ resetTimeoutOnNewEvent: boolean().default(true),
6846
+ /** onAudioThreshold only — dBFS level that counts as a trigger. */
6847
+ thresholdDbfs: number().optional()
6848
+ });
6849
+ /**
6850
+ * Per-device retention overrides. Every field is optional; an unset or `0`
6851
+ * value inherits the node-wide recorder default. Only footage-lifetime limits
6852
+ * live per-camera: `maxAgeDays` and `maxSizeGb`. The disk-occupancy threshold
6853
+ * (when the volume is too full to keep recording) is NOT a per-camera concern —
6854
+ * it belongs to the StorageLocation (`StorageLocation.config.minFreePercent`),
6855
+ * shared by every camera writing to that volume.
6856
+ */
6857
+ var RecordingRetentionSchema = object({
6858
+ maxAgeDays: number().min(0).optional(),
6859
+ maxSizeGb: number().min(0).optional()
6860
+ });
6861
+ /**
6862
+ * The full per-camera recording intent — the wire shape of a RecordingTarget.
6863
+ *
6864
+ * `mode` is the authoritative storage choice; `schedule`/`triggers`/`pre`/`post`
6865
+ * are its mode-specific parameters. `rules` is a DEPRECATED authoring input kept
6866
+ * only for transition + migration (`migrateRulesToMode`); the policy engine
6867
+ * consumes the compiled output of `compileRules(config)`, never `rules` directly.
6868
+ */
6869
+ var RecordingConfigSchema = object({
6870
+ enabled: boolean(),
6871
+ /** Authoritative storage mode. Absent on legacy targets → derived once via
6872
+ * `migrateRulesToMode`, then persisted. */
6873
+ mode: RecordingStorageModeSchema.optional(),
6874
+ profiles: array(CamProfileSchema).optional(),
6875
+ segmentSeconds: number().int().positive().optional(),
6876
+ /** Shared recording time-bands for `events` & `continuous` — record only when
6877
+ * the wall-clock falls inside one of these windows. Omit or empty = always.
6878
+ * `continuous` compiles to one rule per band; `events` to band × trigger. */
6879
+ schedules: array(RecordingScheduleSchema).optional(),
6880
+ /** Legacy single-band predecessor of `schedules`. Read-compat only — it is
6881
+ * normalized into `schedules` on read and never written going forward. (Not
6882
+ * tagged `@deprecated`: the normalization paths must read it cast-free.) */
6883
+ schedule: RecordingScheduleSchema.optional(),
6884
+ /** `events`-mode only — which detectors trigger a recording. */
6885
+ triggers: RecordingTriggersSchema.optional(),
6886
+ /** `events`-mode only — seconds retained before / after a trigger. */
6887
+ preBufferSec: number().min(0).optional(),
6888
+ postBufferSec: number().min(0).optional(),
6889
+ /** DEPRECATED authoring input; retained for migration/transition. */
6890
+ rules: array(RecordingRuleSchema).optional(),
6891
+ /**
6892
+ * AUTHORITATIVE mode-per-band recording model (recorder). When present it
6893
+ * is the single source of truth; the legacy `mode`/`schedules`/`schedule`/
6894
+ * `triggers`/`rules` fields above are kept for READ-COMPAT only and are
6895
+ * derived into bands once via `migrateConfigToBands`.
6896
+ */
6897
+ bands: array(RecordingBandSchema).optional(),
6898
+ retention: RecordingRetentionSchema.optional()
6899
+ });
6900
+ /** All seven weekdays (0 = Sunday … 6 = Saturday), used when a schedule omits a
6901
+ * weekday filter. */
6902
+ var ALL_DAYS = [
6903
+ 0,
6904
+ 1,
6905
+ 2,
6906
+ 3,
6907
+ 4,
6908
+ 5,
6909
+ 6
6910
+ ];
6911
+ /** Full-day span used to represent an `always` schedule as a band. The `HHMM`
6912
+ * regex maxes out at 23:59, so a 00:00–23:59 same-day span ≈ all-day (the band
6913
+ * engine treats `end > start` as a normal, non-wrapping span). */
6914
+ var ALL_DAY_START = "00:00";
6915
+ var ALL_DAY_END = "23:59";
6916
+ function bandFromSchedule(schedule, mode, config) {
6917
+ const days = schedule.kind === "timeOfDay" && schedule.days ? schedule.days : [...ALL_DAYS];
6918
+ const start = schedule.kind === "timeOfDay" ? schedule.start : ALL_DAY_START;
6919
+ const end = schedule.kind === "timeOfDay" ? schedule.end : ALL_DAY_END;
6920
+ if (mode === "continuous") return {
6921
+ days,
6922
+ start,
6923
+ end,
6924
+ mode
6925
+ };
6926
+ return {
6927
+ days,
6928
+ start,
6929
+ end,
6930
+ mode,
6931
+ ...config.triggers ? { triggers: config.triggers } : {},
6932
+ ...config.preBufferSec !== void 0 ? { preBufferSec: config.preBufferSec } : {},
6933
+ ...config.postBufferSec !== void 0 ? { postBufferSec: config.postBufferSec } : {}
6934
+ };
7475
6935
  }
7476
- var DeviceType = /* @__PURE__ */ function(DeviceType) {
7477
- DeviceType["Camera"] = "camera";
7478
- DeviceType["Hub"] = "hub";
7479
- DeviceType["Light"] = "light";
7480
- DeviceType["Siren"] = "siren";
7481
- DeviceType["Switch"] = "switch";
7482
- DeviceType["Sensor"] = "sensor";
7483
- DeviceType["Thermostat"] = "thermostat";
7484
- DeviceType["Button"] = "button";
7485
- /** Generic stateless event emitter — carries a device's EXACT declared
7486
- * event vocabulary verbatim (no normalization). Installed with the
7487
- * `event-emitter` cap. Sources: HA `event.*` entities (structured) and
7488
- * HA bus events (e.g. `zha_event`, generic). */
7489
- DeviceType["EventEmitter"] = "event-emitter";
7490
- /** Firmware/software update entity current vs available version,
7491
- * updatable flag, update state, and an install action. Installed with
7492
- * the `update` cap. Sources: Homematic firmware-update channels (and
7493
- * reusable by other providers, e.g. HA `update.*` entities). */
7494
- DeviceType["Update"] = "update";
7495
- DeviceType["Generic"] = "generic";
7496
- /** Generic notification delivery target (HA `notify.<service>`, future
7497
- * Telegram / Discord / ntfy / SMTP, …). One device per delivery
7498
- * endpoint; the `notifier` cap defines the send surface. */
7499
- DeviceType["Notifier"] = "notifier";
7500
- /** Pre-recorded action sequence with optional parameters
7501
- * (HA `script.*`). Runnable via `script-runner` cap. */
7502
- DeviceType["Script"] = "script";
7503
- /** Automation rule (HA `automation.*`) enable/disable + manual
7504
- * trigger surface exposed via `automation-control` cap. */
7505
- DeviceType["Automation"] = "automation";
7506
- /** Door / smart lock device (HA `lock.*`). `lock-control` cap. */
7507
- DeviceType["Lock"] = "lock";
7508
- /** Window covering, blinds, garage door, valve, etc. (HA `cover.*`,
7509
- * `valve.*`). `cover` cap with sub-roles for variant. */
7510
- DeviceType["Cover"] = "cover";
7511
- /** Pipe / water / gas valve with open/close/stop and optional
7512
- * position (HA `valve.*`). `valve` cap a cover-sibling actuator
7513
- * modelled on the same open/closed lifecycle. */
7514
- DeviceType["Valve"] = "valve";
7515
- /** Humidifier / dehumidifier with on/off + target humidity + mode
7516
- * (HA `humidifier.*`). `humidifier` cap — a climate-family actuator
7517
- * modelled on the same target / mode lifecycle. */
7518
- DeviceType["Humidifier"] = "humidifier";
7519
- /** Water heater / boiler with target temperature + operation mode +
7520
- * away mode (HA `water_heater.*`). `water-heater` cap — a
7521
- * climate-family actuator. */
7522
- DeviceType["WaterHeater"] = "water-heater";
7523
- /** Ceiling / standing / exhaust fan (HA `fan.*`). `fan-control` cap. */
7524
- DeviceType["Fan"] = "fan";
7525
- /** Audio / video playback endpoint (HA `media_player.*`). Disjoint from
7526
- * the camera surface — those use `Camera`. `media-player` cap. */
7527
- DeviceType["MediaPlayer"] = "media-player";
7528
- /** Security panel / alarm system (HA `alarm_control_panel.*`).
7529
- * `alarm-panel` cap. */
7530
- DeviceType["AlarmPanel"] = "alarm-panel";
7531
- /** Generic user-settable input (HA `number` / `input_number` / `select`
7532
- * / `input_select` / `text` / `input_text` / `input_datetime`).
7533
- * Sub-type via `DeviceRole`: NumericControl / SelectControl /
7534
- * TextControl / DateTimeControl. */
7535
- DeviceType["Control"] = "control";
7536
- /** Person / device-tracker presence (HA `person.*`, `device_tracker.*`).
7537
- * `presence` cap. */
7538
- DeviceType["Presence"] = "presence";
7539
- /** Weather provider (HA `weather.*`). Tier-3, low MVP priority.
7540
- * `weather` cap. */
7541
- DeviceType["Weather"] = "weather";
7542
- /** Robot vacuum (HA `vacuum.*`). Tier-3. `vacuum-control` cap. */
7543
- DeviceType["Vacuum"] = "vacuum";
7544
- /** Robotic lawn mower (HA `lawn_mower.*`). Tier-3.
7545
- * `lawn-mower-control` cap. */
7546
- DeviceType["LawnMower"] = "lawn-mower";
7547
- /** Physical HA device group — parent container for entity-children
7548
- * adopted from a single HA device entry. Not renderable as a
7549
- * standalone device; exists only to anchor child entities. */
7550
- DeviceType["Container"] = "container";
7551
- /** Single still-image entity (HA `image.*`). Read-only display of an
7552
- * `entity_picture` signed URL the browser loads directly. `image` cap. */
7553
- DeviceType["Image"] = "image";
7554
- return DeviceType;
7555
- }({});
7556
- var DeviceFeature = /* @__PURE__ */ function(DeviceFeature) {
7557
- DeviceFeature["BatteryOperated"] = "battery-operated";
7558
- DeviceFeature["Rebootable"] = "rebootable";
6936
+ /**
6937
+ * One-way migration from the legacy recording-config shape to the authoritative
6938
+ * mode-per-band model. Pure (no clock access).
6939
+ *
6940
+ * - If `config.bands` is present, it is authoritative and returned as-is.
6941
+ * - Otherwise the result is derived from the legacy fields: a disabled config or
6942
+ * `mode: 'off'` yields no bands; every legacy schedule maps to one band whose
6943
+ * mode is `continuous` when `config.mode === 'continuous'`, else `events`
6944
+ * (carrying `triggers`/`preBufferSec`/`postBufferSec`).
6945
+ */
6946
+ function migrateConfigToBands(config) {
6947
+ if (config.bands) return config.bands;
6948
+ if (!config.enabled || config.mode === "off") return [];
6949
+ const schedules = config.schedules ?? (config.schedule ? [config.schedule] : [{ kind: "always" }]);
6950
+ const bandMode = config.mode === "continuous" ? "continuous" : "events";
6951
+ return schedules.map((schedule) => bandFromSchedule(schedule, bandMode, config));
6952
+ }
6953
+ /**
6954
+ * `StorageLocationType` — an addon-declared id that identifies the *kind* of
6955
+ * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
6956
+ * so the persisted record schema and the consumer-facing cap can both consume it
6957
+ * without forming a circular import. The `storage` cap re-exports it
6958
+ * verbatim for back-compat.
6959
+ *
6960
+ * This Zod schema is the **authoritative source** for `StorageLocationType`.
6961
+ * The TS alias in `./storage.ts` re-exports `z.infer<typeof
6962
+ * StorageLocationTypeSchema>` so the wire surface (cap) and the legacy
6963
+ * `IStorageProvider` interface stay in lockstep.
6964
+ *
6965
+ * The type is now an **open string** (not a closed enum) — addons declare
6966
+ * their own location kinds via `StorageLocationDeclaration.id`. The regex
6967
+ * enforces a safe id format: lowercase-start, alphanumeric + hyphens.
6968
+ */
6969
+ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
6970
+ /**
6971
+ * Persisted record for a storage location instance. Operators can register
6972
+ * multiple instances for multi-cardinality types (e.g. two `backups`
6973
+ * locations with different `providerId`s). Cardinality is now declared per
6974
+ * location via `StorageLocationDeclaration.cardinality` — the static
6975
+ * `STORAGE_LOCATION_CARDINALITY` map has been removed.
6976
+ *
6977
+ * `id` is a stable namespaced string of the form `<type>:<slug>`.
6978
+ * The default location for a type uses `id === <type>:default` by
6979
+ * convention (the bare type ref like `'backups'` resolves to it).
6980
+ *
6981
+ * `isSystem: true` marks a location as orchestrator-seeded and
6982
+ * undeletable. The bootstrap-installed defaults (one per type) carry
6983
+ * this flag; operator-added locations don't. Editing the config of
6984
+ * a system location is allowed (path migration, provider swap) but
6985
+ * deleting it is rejected at the cap level.
6986
+ */
6987
+ var StorageLocationSchema = object({
6988
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/),
6989
+ type: string(),
6990
+ displayName: string().min(1),
6991
+ providerId: string().min(1),
6992
+ config: record(string(), unknown()),
7559
6993
  /**
7560
- * Device supports an on-demand re-sync of its derived spec with its
7561
- * upstream sourcedrives the generic Re-sync button. The owning
7562
- * provider implements the action via the `device-adoption.resync` cap.
6994
+ * Cluster node this location physically lives on. REQUIRED for node-local
6995
+ * providers (filesystem — the path exists on one node's disk), null/absent
6996
+ * for node-agnostic providers (S3/SFTP/WebDAV, reachable from any node).
6997
+ * `'hub'` is the hub node. Validated against the provider's `nodeLocal`
6998
+ * flag at upsert time, not here (the schema is provider-agnostic).
7563
6999
  */
7564
- DeviceFeature["Resyncable"] = "resyncable";
7565
- DeviceFeature["NativeSnapshot"] = "native-snapshot";
7566
- DeviceFeature["DoorbellButton"] = "doorbell-button";
7567
- DeviceFeature["TwoWayAudio"] = "two-way-audio";
7568
- DeviceFeature["PanTiltZoom"] = "pan-tilt-zoom";
7000
+ nodeId: string().optional(),
7001
+ isDefault: boolean().default(false),
7002
+ isSystem: boolean().default(false),
7003
+ createdAt: number(),
7004
+ updatedAt: number()
7005
+ });
7006
+ /**
7007
+ * Reference accepted by consumer-facing `api.storage.*` calls.
7008
+ * Either:
7009
+ * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
7010
+ * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
7011
+ *
7012
+ * The orchestrator's `resolveRef(ref)` handles both cases.
7013
+ */
7014
+ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(/^[a-z][a-zA-Z0-9-]*:[a-zA-Z0-9-]+$/)]);
7015
+ /**
7016
+ * `StorageLocationDeclaration` — a single storage-location entry declared by
7017
+ * an addon in its `package.json` under `camstack.storageLocations`.
7018
+ *
7019
+ * Design intent:
7020
+ * - **Addon declares its needs** — each addon describes the logical storage
7021
+ * slots it requires (e.g. `recordings`, `recordingsLow`) without caring
7022
+ * about the physical path.
7023
+ * - **Kernel aggregates** — at boot the kernel collects declarations from all
7024
+ * installed addons, deduplicates by `id`, and exposes the union via the
7025
+ * storage-locations settings surface.
7026
+ * - **Orchestrator seeds** — for every declared `id` the orchestrator ensures
7027
+ * at least one instance named `<id>:default` is present, using
7028
+ * `defaultsTo` to inherit the resolved root from another location when the
7029
+ * declaration is a derivative slot (e.g. `recordingsLow` defaults to
7030
+ * `recordings`).
7031
+ * - **ids are global** — `id` values are shared across the entire deployment;
7032
+ * two addons declaring the same `id` must agree on `cardinality` (validated
7033
+ * at kernel aggregation time, not here).
7034
+ */
7035
+ var StorageLocationDeclarationSchema = object({
7569
7036
  /**
7570
- * Camera supports the on-firmware autotrack subsystem (subject-
7571
- * following). Distinct from `PanTiltZoom` because not every PTZ
7572
- * camera ships autotrack — the admin UI uses this flag to gate
7573
- * the autotrack toggle / settings card without re-deriving from
7574
- * the cap registry. Mirrors `ptz-autotrack` cap registration:
7575
- * driver sets this feature when probe confirms the firmware
7576
- * surface, and registers the cap in the same code path.
7037
+ * Global location identifier, e.g. `recordings` or `recordingsLow`.
7038
+ * Must start with a lowercase letter and may contain letters, digits, and
7039
+ * hyphens.
7577
7040
  */
7578
- DeviceFeature["PtzAutotrack"] = "ptz-autotrack";
7041
+ id: string().regex(/^[a-z][a-zA-Z0-9-]*$/, { message: "id must start with a lowercase letter and contain only letters, digits, or hyphens" }),
7042
+ /** Human-readable name shown in the admin UI. */
7043
+ displayName: string().min(1, { message: "displayName must not be empty" }),
7044
+ /** Optional longer explanation of what data this location stores. */
7045
+ description: string().optional(),
7579
7046
  /**
7580
- * Accessory exposes a "trigger on motion" toggle the parent camera's
7581
- * motion detection automatically activates this device. Mirrors
7582
- * `motion-trigger` cap registration: drivers set this feature in the
7583
- * same code path that calls `ctx.registerNativeCap(motionTriggerCapability, ...)`.
7584
- *
7585
- * Used by admin UI (gate the in-hero `MotionTriggerToggle` against a
7586
- * fast scalar without binding fetch), notifier rules, and `listAll`
7587
- * filters that want "all devices with on-motion behaviour".
7047
+ * `single` exactly one instance of this location is allowed system-wide
7048
+ * (e.g. `logs`, `models`). The operator can edit it but not add more.
7049
+ * `multi` the operator may register several instances (e.g. a second
7050
+ * `recordings` on a NAS for disk tiering); one is the default at any time.
7588
7051
  */
7589
- DeviceFeature["MotionTrigger"] = "motion-trigger";
7590
- /** Light supports rgb-triplet color via `color` cap. */
7591
- DeviceFeature["LightColorRgb"] = "light-color-rgb";
7592
- /** Light supports HSV color via `color` cap. */
7593
- DeviceFeature["LightColorHsv"] = "light-color-hsv";
7594
- /** Light supports color-temperature (mired) via `color` cap. */
7595
- DeviceFeature["LightColorMired"] = "light-color-mired";
7596
- /** Thermostat supports a `heat_cool` dual setpoint (targetLow +
7597
- * targetHigh). Gates the range slider UI. */
7598
- DeviceFeature["ClimateDualSetpoint"] = "climate-dual-setpoint";
7599
- /** Thermostat exposes target humidity and/or current humidity
7600
- * readings. Gates the humidity controls. */
7601
- DeviceFeature["ClimateHumidity"] = "climate-humidity";
7602
- /** Thermostat exposes a fan-mode selector. */
7603
- DeviceFeature["ClimateFanMode"] = "climate-fan-mode";
7604
- /** Thermostat exposes preset modes (eco / away / sleep / vendor). */
7605
- DeviceFeature["ClimatePreset"] = "climate-preset";
7606
- /** Cover exposes intermediate position control (0..100). Gates the
7607
- * position slider UI. */
7608
- DeviceFeature["CoverPositionable"] = "cover-positionable";
7609
- /** Cover exposes slat-tilt control. Gates the tilt slider UI. */
7610
- DeviceFeature["CoverTilt"] = "cover-tilt";
7611
- /** Valve exposes intermediate position control (0..100). Gates the
7612
- * position slider / drag surface UI. */
7613
- DeviceFeature["ValvePositionable"] = "valve-positionable";
7614
- /** Fan exposes a speed-percentage setter. Gates the speed slider UI. */
7615
- DeviceFeature["FanSpeed"] = "fan-speed";
7616
- /** Fan exposes a preset mode selector. */
7617
- DeviceFeature["FanPreset"] = "fan-preset";
7618
- /** Fan exposes blade direction (forward/reverse) typical of
7619
- * ceiling fans. */
7620
- DeviceFeature["FanDirection"] = "fan-direction";
7621
- /** Fan exposes an oscillation toggle. */
7622
- DeviceFeature["FanOscillating"] = "fan-oscillating";
7623
- /** Lock requires a PIN code on lock/unlock. Gates the code-entry
7624
- * field on the UI lock-controls panel. */
7625
- DeviceFeature["LockPinRequired"] = "lock-pin-required";
7626
- /** Lock supports a latch-release ("open door") action distinct from
7627
- * unlock. Mirrors HA `LockEntityFeature.OPEN` (bit 1) in
7628
- * `supported_features`. Gates the Open Door button in the UI. */
7629
- DeviceFeature["LockOpen"] = "lock-open";
7630
- /** Media player exposes a seek-to-position surface. */
7631
- DeviceFeature["MediaPlayerSeek"] = "media-player-seek";
7632
- /** Media player exposes a volume-level setter. */
7633
- DeviceFeature["MediaPlayerVolume"] = "media-player-volume";
7634
- /** Media player exposes a mute toggle distinct from volume=0. */
7635
- DeviceFeature["MediaPlayerMute"] = "media-player-mute";
7636
- /** Media player exposes a shuffle toggle. */
7637
- DeviceFeature["MediaPlayerShuffle"] = "media-player-shuffle";
7638
- /** Media player exposes a repeat mode (off / all / one). */
7639
- DeviceFeature["MediaPlayerRepeat"] = "media-player-repeat";
7640
- /** Media player exposes a source / input selector. */
7641
- DeviceFeature["MediaPlayerSelectSource"] = "media-player-select-source";
7642
- /** Media player exposes a play-arbitrary-media surface (URL / id). */
7643
- DeviceFeature["MediaPlayerPlayMedia"] = "media-player-play-media";
7644
- /** Media player exposes next-track. */
7645
- DeviceFeature["MediaPlayerNext"] = "media-player-next";
7646
- /** Media player exposes previous-track. */
7647
- DeviceFeature["MediaPlayerPrevious"] = "media-player-previous";
7648
- /** Media player exposes stop distinct from pause. */
7649
- DeviceFeature["MediaPlayerStop"] = "media-player-stop";
7650
- /** Alarm panel requires a PIN code on arm/disarm. */
7651
- DeviceFeature["AlarmPinRequired"] = "alarm-pin-required";
7652
- /** Presence device carries GPS coordinates (lat/lng/accuracy) in
7653
- * addition to a textual location. */
7654
- DeviceFeature["PresenceGps"] = "presence-gps";
7655
- /** Notifier accepts an inline / URL image attachment. */
7656
- DeviceFeature["NotifierImage"] = "notifier-image";
7657
- /** Notifier accepts a priority hint (high/normal/low). */
7658
- DeviceFeature["NotifierPriority"] = "notifier-priority";
7659
- /** Notifier accepts a free-form `data` payload for platform-specific
7660
- * fields. */
7661
- DeviceFeature["NotifierData"] = "notifier-data";
7662
- /** Notifier supports interactive action buttons / callbacks. */
7663
- DeviceFeature["NotifierActions"] = "notifier-actions";
7664
- /** Notifier supports per-call recipient targeting (multi-user). */
7665
- DeviceFeature["NotifierRecipients"] = "notifier-recipients";
7666
- /** Script runner accepts a variables map on each run invocation. */
7667
- DeviceFeature["ScriptVariables"] = "script-variables";
7668
- /** Automation `trigger` accepts a skipCondition flag — fires the
7669
- * automation's actions while bypassing its condition block. */
7670
- DeviceFeature["AutomationSkipCondition"] = "automation-skip-condition";
7671
- return DeviceFeature;
7672
- }({});
7673
- /**
7674
- * Semantic role a device plays within its parent. Populated by driver
7675
- * addons when creating accessory devices (Reolink siren/floodlight/
7676
- * PIR/chime/autotrack/doorbell, ONVIF relay outputs, …). Used by the
7677
- * admin UI to pick icons, labels, and widgets — a `Switch` with
7678
- * `role: Floodlight` renders as a bulb with a brightness slider,
7679
- * whereas a `Switch` with `role: Siren` renders as a klaxon.
7680
- *
7681
- * Undefined for top-level devices (cameras, NVRs, hubs). Persisted in
7682
- * sqlite as a nullable TEXT column — old rows keep working unchanged.
7683
- */
7684
- var DeviceRole = /* @__PURE__ */ function(DeviceRole) {
7685
- DeviceRole["Siren"] = "siren";
7686
- DeviceRole["Floodlight"] = "floodlight";
7687
- DeviceRole["Spotlight"] = "spotlight";
7688
- DeviceRole["PirSensor"] = "pir-sensor";
7689
- DeviceRole["Chime"] = "chime";
7690
- DeviceRole["Autotrack"] = "autotrack";
7691
- DeviceRole["Nightvision"] = "nightvision";
7692
- DeviceRole["PrivacyMask"] = "privacy-mask";
7693
- DeviceRole["Doorbell"] = "doorbell";
7694
- /** Virtual HA toggle (input_boolean.*) — distinguishable from a
7695
- * real Switch device for UI rendering / export adapters. */
7696
- DeviceRole["BinaryHelper"] = "binary-helper";
7697
- /** Generic motion / occupancy / moving event source. Distinct from
7698
- * the camera accessory PirSensor role: that one is a camera child;
7699
- * this is a standalone HA / 3rd-party motion sensor. */
7700
- DeviceRole["MotionSensor"] = "motion-sensor";
7701
- DeviceRole["ContactSensor"] = "contact-sensor";
7702
- DeviceRole["LeakSensor"] = "leak-sensor";
7703
- DeviceRole["SmokeSensor"] = "smoke-sensor";
7704
- DeviceRole["COSensor"] = "co-sensor";
7705
- DeviceRole["GasSensor"] = "gas-sensor";
7706
- DeviceRole["TamperSensor"] = "tamper-sensor";
7707
- DeviceRole["VibrationSensor"] = "vibration-sensor";
7708
- DeviceRole["ConnectivitySensor"] = "connectivity-sensor";
7709
- DeviceRole["SoundSensor"] = "sound-sensor";
7710
- /** Fallback for `binary_sensor` without a known `device_class`. */
7711
- DeviceRole["BinarySensor"] = "binary-sensor";
7712
- DeviceRole["TemperatureSensor"] = "temperature-sensor";
7713
- DeviceRole["HumiditySensor"] = "humidity-sensor";
7714
- DeviceRole["AmbientLightSensor"] = "ambient-light-sensor";
7715
- DeviceRole["PressureSensor"] = "pressure-sensor";
7716
- DeviceRole["PowerSensor"] = "power-sensor";
7717
- DeviceRole["EnergySensor"] = "energy-sensor";
7718
- DeviceRole["VoltageSensor"] = "voltage-sensor";
7719
- DeviceRole["CurrentSensor"] = "current-sensor";
7720
- DeviceRole["AirQualitySensor"] = "air-quality-sensor";
7721
- /** Battery level (numeric % via `sensor` OR low-bool via
7722
- * `binary_sensor` — the cap distinguishes via the value type). */
7723
- DeviceRole["BatterySensor"] = "battery-sensor";
7724
- /** Fallback for `sensor` numeric without a known `device_class`. */
7725
- DeviceRole["NumericSensor"] = "numeric-sensor";
7726
- /** String / enum state (HA `sensor` with `state_class: enum` or
7727
- * `attributes.options`). */
7728
- DeviceRole["EnumSensor"] = "enum-sensor";
7729
- /** Date / timestamp state (HA `sensor` with `device_class: timestamp`
7730
- * or `date`). The slice carries the raw ISO string verbatim (hosted on
7731
- * the `enum-sensor` cap); the UI renders it locale-formatted. */
7732
- DeviceRole["DateTimeSensor"] = "datetime-sensor";
7733
- /** Last-resort fallback when nothing else matches. */
7734
- DeviceRole["GenericSensor"] = "generic-sensor";
7735
- DeviceRole["NumericControl"] = "numeric-control";
7736
- DeviceRole["SelectControl"] = "select-control";
7737
- DeviceRole["TextControl"] = "text-control";
7738
- DeviceRole["DateTimeControl"] = "datetime-control";
7739
- /** Mobile push notifier (HA `notify.mobile_app_*`) — supports
7740
- * rich features (image, priority, channel routing). */
7741
- DeviceRole["MobilePushNotifier"] = "mobile-push-notifier";
7742
- /** Chat / messaging service (HA `notify.telegram_*`,
7743
- * `notify.discord_*`, etc.). */
7744
- DeviceRole["MessagingNotifier"] = "messaging-notifier";
7745
- /** Email-based delivery (HA `notify.smtp`, etc.). */
7746
- DeviceRole["EmailNotifier"] = "email-notifier";
7747
- /** Fallback when the notifier service name doesn't match a known
7748
- * pattern. */
7749
- DeviceRole["GenericNotifier"] = "generic-notifier";
7750
- return DeviceRole;
7751
- }({});
7052
+ cardinality: _enum(["single", "multi"]),
7053
+ /**
7054
+ * When set, the default instance for this location inherits its resolved
7055
+ * root from the named location's default instance. Useful for derivative
7056
+ * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
7057
+ * configure the primary location.
7058
+ */
7059
+ defaultsTo: string().optional()
7060
+ });
7061
+ var DecoderStatsSchema = object({
7062
+ inputFps: number(),
7063
+ outputFps: number(),
7064
+ avgDecodeTimeMs: number(),
7065
+ droppedFrames: number()
7066
+ });
7067
+ var DecoderSessionConfigSchema = object({
7068
+ codec: string(),
7069
+ maxFps: number().default(0),
7070
+ outputFormat: _enum([
7071
+ "jpeg",
7072
+ "rgb",
7073
+ "bgr",
7074
+ "yuv420",
7075
+ "gray"
7076
+ ]).default("jpeg"),
7077
+ scale: number().default(1),
7078
+ width: number().optional(),
7079
+ height: number().optional(),
7080
+ /**
7081
+ * Identifier of the camera this decoder session serves. Optional
7082
+ * because the cap is generic (any caller could request decode), but
7083
+ * stream-broker passes it so decoder logs include `deviceId` for
7084
+ * per-camera filtering when diagnosing failures (e.g. node-av
7085
+ * sendPacket errors on a single hung camera).
7086
+ */
7087
+ deviceId: number().int().nonnegative().optional(),
7088
+ /**
7089
+ * Free-form tag for log scoping. Stream-broker uses
7090
+ * `broker:<deviceId>/<profile>`. Decoder session logger surfaces it
7091
+ * on every line so `grep tag=broker:5/high` filters one camera
7092
+ * profile cleanly.
7093
+ */
7094
+ tag: string().optional(),
7095
+ /**
7096
+ * Where the session delivers decoded frames (Phase 5 / D9):
7097
+ *
7098
+ * - `'callback'` (default) — the legacy pixel path: decoded frames are
7099
+ * buffered as `DecodedFrame`s and drained via `pullFrames`.
7100
+ * - `'shm'` — the shared-memory frame plane: decoded frames are written
7101
+ * into an OS shared-memory ring and drained as zero-pixel
7102
+ * `FrameHandle`s via `pullHandles`. A session is one mode or the
7103
+ * other `pullFrames` returns nothing for an `'shm'` session and
7104
+ * `pullHandles` returns nothing for a `'callback'` session.
7105
+ */
7106
+ frameSink: _enum(["callback", "shm"]).default("callback")
7107
+ });
7108
+ var EncodeProfileSchema = object({
7109
+ video: object({
7110
+ codec: _enum([
7111
+ "h264",
7112
+ "h265",
7113
+ "copy"
7114
+ ]),
7115
+ profile: _enum([
7116
+ "baseline",
7117
+ "main",
7118
+ "high"
7119
+ ]).optional(),
7120
+ width: number().int().positive().optional(),
7121
+ height: number().int().positive().optional(),
7122
+ fps: number().positive().optional(),
7123
+ bitrateKbps: number().int().positive().optional(),
7124
+ gopFrames: number().int().positive().optional(),
7125
+ bf: number().int().min(0).optional(),
7126
+ preset: _enum([
7127
+ "ultrafast",
7128
+ "superfast",
7129
+ "veryfast",
7130
+ "faster",
7131
+ "fast",
7132
+ "medium"
7133
+ ]).optional(),
7134
+ tune: _enum([
7135
+ "zerolatency",
7136
+ "film",
7137
+ "animation"
7138
+ ]).optional()
7139
+ }),
7140
+ audio: union([literal("passthrough"), object({
7141
+ codec: _enum([
7142
+ "opus",
7143
+ "aac",
7144
+ "pcmu",
7145
+ "pcma",
7146
+ "copy"
7147
+ ]),
7148
+ bitrateKbps: number().int().positive().optional(),
7149
+ sampleRateHz: number().int().positive().optional(),
7150
+ channels: union([literal(1), literal(2)]).optional()
7151
+ })]),
7152
+ /**
7153
+ * ffmpeg input-side args, inserted between the fixed global flags
7154
+ * (`-hide_banner -loglevel error`) and `-i pipe:0`. Free-text array
7155
+ * the widget surfaces a textarea + suggestion chips for the most-
7156
+ * used demuxer/format options.
7157
+ */
7158
+ inputArgs: array(string()).optional(),
7159
+ /**
7160
+ * ffmpeg output-side args, inserted between the encode block and
7161
+ * the final `-f <muxer> pipe:1`. Use for muxer options, bitstream
7162
+ * filters, codec-specific overrides. Free-text array.
7163
+ */
7164
+ outputArgs: array(string()).optional()
7165
+ });
7166
+ var HF_BASE_URL = `https://huggingface.co/camstack/camstack-models/resolve/main`;
7167
+ function hfModelUrl(repo, path) {
7168
+ return `https://huggingface.co/${repo}/resolve/main/${path}`;
7169
+ }
7170
+ var COCO_80_LABELS = [
7171
+ {
7172
+ id: "person",
7173
+ name: "Person"
7174
+ },
7175
+ {
7176
+ id: "bicycle",
7177
+ name: "Bicycle"
7178
+ },
7179
+ {
7180
+ id: "car",
7181
+ name: "Car"
7182
+ },
7183
+ {
7184
+ id: "motorcycle",
7185
+ name: "Motorcycle"
7186
+ },
7187
+ {
7188
+ id: "airplane",
7189
+ name: "Airplane"
7190
+ },
7191
+ {
7192
+ id: "bus",
7193
+ name: "Bus"
7194
+ },
7195
+ {
7196
+ id: "train",
7197
+ name: "Train"
7198
+ },
7199
+ {
7200
+ id: "truck",
7201
+ name: "Truck"
7202
+ },
7203
+ {
7204
+ id: "boat",
7205
+ name: "Boat"
7206
+ },
7207
+ {
7208
+ id: "traffic light",
7209
+ name: "Traffic Light"
7210
+ },
7211
+ {
7212
+ id: "fire hydrant",
7213
+ name: "Fire Hydrant"
7214
+ },
7215
+ {
7216
+ id: "stop sign",
7217
+ name: "Stop Sign"
7218
+ },
7219
+ {
7220
+ id: "parking meter",
7221
+ name: "Parking Meter"
7222
+ },
7223
+ {
7224
+ id: "bench",
7225
+ name: "Bench"
7226
+ },
7227
+ {
7228
+ id: "bird",
7229
+ name: "Bird"
7230
+ },
7231
+ {
7232
+ id: "cat",
7233
+ name: "Cat"
7234
+ },
7235
+ {
7236
+ id: "dog",
7237
+ name: "Dog"
7238
+ },
7239
+ {
7240
+ id: "horse",
7241
+ name: "Horse"
7242
+ },
7243
+ {
7244
+ id: "sheep",
7245
+ name: "Sheep"
7246
+ },
7247
+ {
7248
+ id: "cow",
7249
+ name: "Cow"
7250
+ },
7251
+ {
7252
+ id: "elephant",
7253
+ name: "Elephant"
7254
+ },
7255
+ {
7256
+ id: "bear",
7257
+ name: "Bear"
7258
+ },
7259
+ {
7260
+ id: "zebra",
7261
+ name: "Zebra"
7262
+ },
7263
+ {
7264
+ id: "giraffe",
7265
+ name: "Giraffe"
7266
+ },
7267
+ {
7268
+ id: "backpack",
7269
+ name: "Backpack"
7270
+ },
7271
+ {
7272
+ id: "umbrella",
7273
+ name: "Umbrella"
7274
+ },
7275
+ {
7276
+ id: "handbag",
7277
+ name: "Handbag"
7278
+ },
7279
+ {
7280
+ id: "tie",
7281
+ name: "Tie"
7282
+ },
7283
+ {
7284
+ id: "suitcase",
7285
+ name: "Suitcase"
7286
+ },
7287
+ {
7288
+ id: "frisbee",
7289
+ name: "Frisbee"
7290
+ },
7291
+ {
7292
+ id: "skis",
7293
+ name: "Skis"
7294
+ },
7295
+ {
7296
+ id: "snowboard",
7297
+ name: "Snowboard"
7298
+ },
7299
+ {
7300
+ id: "sports ball",
7301
+ name: "Sports Ball"
7302
+ },
7303
+ {
7304
+ id: "kite",
7305
+ name: "Kite"
7306
+ },
7307
+ {
7308
+ id: "baseball bat",
7309
+ name: "Baseball Bat"
7310
+ },
7311
+ {
7312
+ id: "baseball glove",
7313
+ name: "Baseball Glove"
7314
+ },
7315
+ {
7316
+ id: "skateboard",
7317
+ name: "Skateboard"
7318
+ },
7319
+ {
7320
+ id: "surfboard",
7321
+ name: "Surfboard"
7322
+ },
7323
+ {
7324
+ id: "tennis racket",
7325
+ name: "Tennis Racket"
7326
+ },
7327
+ {
7328
+ id: "bottle",
7329
+ name: "Bottle"
7330
+ },
7331
+ {
7332
+ id: "wine glass",
7333
+ name: "Wine Glass"
7334
+ },
7335
+ {
7336
+ id: "cup",
7337
+ name: "Cup"
7338
+ },
7339
+ {
7340
+ id: "fork",
7341
+ name: "Fork"
7342
+ },
7343
+ {
7344
+ id: "knife",
7345
+ name: "Knife"
7346
+ },
7347
+ {
7348
+ id: "spoon",
7349
+ name: "Spoon"
7350
+ },
7351
+ {
7352
+ id: "bowl",
7353
+ name: "Bowl"
7354
+ },
7355
+ {
7356
+ id: "banana",
7357
+ name: "Banana"
7358
+ },
7359
+ {
7360
+ id: "apple",
7361
+ name: "Apple"
7362
+ },
7363
+ {
7364
+ id: "sandwich",
7365
+ name: "Sandwich"
7366
+ },
7367
+ {
7368
+ id: "orange",
7369
+ name: "Orange"
7370
+ },
7371
+ {
7372
+ id: "broccoli",
7373
+ name: "Broccoli"
7374
+ },
7375
+ {
7376
+ id: "carrot",
7377
+ name: "Carrot"
7378
+ },
7379
+ {
7380
+ id: "hot dog",
7381
+ name: "Hot Dog"
7382
+ },
7383
+ {
7384
+ id: "pizza",
7385
+ name: "Pizza"
7386
+ },
7387
+ {
7388
+ id: "donut",
7389
+ name: "Donut"
7390
+ },
7391
+ {
7392
+ id: "cake",
7393
+ name: "Cake"
7394
+ },
7395
+ {
7396
+ id: "chair",
7397
+ name: "Chair"
7398
+ },
7399
+ {
7400
+ id: "couch",
7401
+ name: "Couch"
7402
+ },
7403
+ {
7404
+ id: "potted plant",
7405
+ name: "Potted Plant"
7406
+ },
7407
+ {
7408
+ id: "bed",
7409
+ name: "Bed"
7410
+ },
7411
+ {
7412
+ id: "dining table",
7413
+ name: "Dining Table"
7414
+ },
7415
+ {
7416
+ id: "toilet",
7417
+ name: "Toilet"
7418
+ },
7419
+ {
7420
+ id: "tv",
7421
+ name: "TV"
7422
+ },
7423
+ {
7424
+ id: "laptop",
7425
+ name: "Laptop"
7426
+ },
7427
+ {
7428
+ id: "mouse",
7429
+ name: "Mouse"
7430
+ },
7431
+ {
7432
+ id: "remote",
7433
+ name: "Remote"
7434
+ },
7435
+ {
7436
+ id: "keyboard",
7437
+ name: "Keyboard"
7438
+ },
7439
+ {
7440
+ id: "cell phone",
7441
+ name: "Cell Phone"
7442
+ },
7443
+ {
7444
+ id: "microwave",
7445
+ name: "Microwave"
7446
+ },
7447
+ {
7448
+ id: "oven",
7449
+ name: "Oven"
7450
+ },
7451
+ {
7452
+ id: "toaster",
7453
+ name: "Toaster"
7454
+ },
7455
+ {
7456
+ id: "sink",
7457
+ name: "Sink"
7458
+ },
7459
+ {
7460
+ id: "refrigerator",
7461
+ name: "Refrigerator"
7462
+ },
7463
+ {
7464
+ id: "book",
7465
+ name: "Book"
7466
+ },
7467
+ {
7468
+ id: "clock",
7469
+ name: "Clock"
7470
+ },
7471
+ {
7472
+ id: "vase",
7473
+ name: "Vase"
7474
+ },
7475
+ {
7476
+ id: "scissors",
7477
+ name: "Scissors"
7478
+ },
7479
+ {
7480
+ id: "teddy bear",
7481
+ name: "Teddy Bear"
7482
+ },
7483
+ {
7484
+ id: "hair drier",
7485
+ name: "Hair Drier"
7486
+ },
7487
+ {
7488
+ id: "toothbrush",
7489
+ name: "Toothbrush"
7490
+ }
7491
+ ];
7492
+ var COCO_TO_MACRO = {
7493
+ mapping: {
7494
+ person: "person",
7495
+ bicycle: "vehicle",
7496
+ car: "vehicle",
7497
+ motorcycle: "vehicle",
7498
+ airplane: "vehicle",
7499
+ bus: "vehicle",
7500
+ train: "vehicle",
7501
+ truck: "vehicle",
7502
+ boat: "vehicle",
7503
+ bird: "animal",
7504
+ cat: "animal",
7505
+ dog: "animal",
7506
+ horse: "animal",
7507
+ sheep: "animal",
7508
+ cow: "animal",
7509
+ elephant: "animal",
7510
+ bear: "animal",
7511
+ zebra: "animal",
7512
+ giraffe: "animal"
7513
+ },
7514
+ preserveOriginal: false
7515
+ };
7516
+ var AUDIO_MACRO_LABELS = [
7517
+ {
7518
+ id: "speech",
7519
+ name: "Speech",
7520
+ icon: "🗣️"
7521
+ },
7522
+ {
7523
+ id: "scream",
7524
+ name: "Scream / Shout",
7525
+ icon: "😱"
7526
+ },
7527
+ {
7528
+ id: "crying",
7529
+ name: "Crying / Baby",
7530
+ icon: "😢"
7531
+ },
7532
+ {
7533
+ id: "laughter",
7534
+ name: "Laughter",
7535
+ icon: "😂"
7536
+ },
7537
+ {
7538
+ id: "music",
7539
+ name: "Music",
7540
+ icon: "🎵"
7541
+ },
7542
+ {
7543
+ id: "dog",
7544
+ name: "Dog",
7545
+ icon: "🐕"
7546
+ },
7547
+ {
7548
+ id: "cat",
7549
+ name: "Cat",
7550
+ icon: "🐈"
7551
+ },
7552
+ {
7553
+ id: "bird",
7554
+ name: "Bird",
7555
+ icon: "🐦"
7556
+ },
7557
+ {
7558
+ id: "animal",
7559
+ name: "Animal (other)",
7560
+ icon: "🐾"
7561
+ },
7562
+ {
7563
+ id: "alarm",
7564
+ name: "Alarm / Siren",
7565
+ icon: "🚨"
7566
+ },
7567
+ {
7568
+ id: "doorbell",
7569
+ name: "Doorbell / Knock",
7570
+ icon: "🔔"
7571
+ },
7572
+ {
7573
+ id: "glass_breaking",
7574
+ name: "Glass Breaking",
7575
+ icon: "💥"
7576
+ },
7577
+ {
7578
+ id: "gunshot",
7579
+ name: "Gunshot / Explosion",
7580
+ icon: "💣"
7581
+ },
7582
+ {
7583
+ id: "vehicle",
7584
+ name: "Vehicle",
7585
+ icon: "🚗"
7586
+ },
7587
+ {
7588
+ id: "siren",
7589
+ name: "Emergency Siren",
7590
+ icon: "🚑"
7591
+ },
7592
+ {
7593
+ id: "fire",
7594
+ name: "Fire / Smoke",
7595
+ icon: "🔥"
7596
+ },
7597
+ {
7598
+ id: "water",
7599
+ name: "Water",
7600
+ icon: "💧"
7601
+ },
7602
+ {
7603
+ id: "wind",
7604
+ name: "Wind / Weather",
7605
+ icon: "🌬️"
7606
+ },
7607
+ {
7608
+ id: "door",
7609
+ name: "Door",
7610
+ icon: "🚪"
7611
+ },
7612
+ {
7613
+ id: "footsteps",
7614
+ name: "Footsteps",
7615
+ icon: "👣"
7616
+ },
7617
+ {
7618
+ id: "crowd",
7619
+ name: "Crowd / Chatter",
7620
+ icon: "👥"
7621
+ },
7622
+ {
7623
+ id: "telephone",
7624
+ name: "Telephone",
7625
+ icon: "📞"
7626
+ },
7627
+ {
7628
+ id: "engine",
7629
+ name: "Engine / Motor",
7630
+ icon: "⚙️"
7631
+ },
7632
+ {
7633
+ id: "tools",
7634
+ name: "Tools / Construction",
7635
+ icon: "🔨"
7636
+ },
7637
+ {
7638
+ id: "silence",
7639
+ name: "Silence",
7640
+ icon: "🤫"
7641
+ }
7642
+ ];
7643
+ var YAMNET_TO_MACRO = {
7644
+ mapping: {
7645
+ Speech: "speech",
7646
+ "Child speech, kid speaking": "speech",
7647
+ Conversation: "speech",
7648
+ "Narration, monologue": "speech",
7649
+ Babbling: "speech",
7650
+ Whispering: "speech",
7651
+ "Speech synthesizer": "speech",
7652
+ Humming: "speech",
7653
+ Rapping: "speech",
7654
+ Singing: "speech",
7655
+ Choir: "speech",
7656
+ "Child singing": "speech",
7657
+ Shout: "scream",
7658
+ Bellow: "scream",
7659
+ Yell: "scream",
7660
+ Screaming: "scream",
7661
+ "Children shouting": "scream",
7662
+ Whoop: "scream",
7663
+ "Crying, sobbing": "crying",
7664
+ "Baby cry, infant cry": "crying",
7665
+ Whimper: "crying",
7666
+ "Wail, moan": "crying",
7667
+ Groan: "crying",
7668
+ Laughter: "laughter",
7669
+ "Baby laughter": "laughter",
7670
+ Giggle: "laughter",
7671
+ Snicker: "laughter",
7672
+ "Belly laugh": "laughter",
7673
+ "Chuckle, chortle": "laughter",
7674
+ Music: "music",
7675
+ "Musical instrument": "music",
7676
+ Guitar: "music",
7677
+ Piano: "music",
7678
+ Drum: "music",
7679
+ "Drum kit": "music",
7680
+ "Violin, fiddle": "music",
7681
+ Flute: "music",
7682
+ Saxophone: "music",
7683
+ Trumpet: "music",
7684
+ Synthesizer: "music",
7685
+ "Pop music": "music",
7686
+ "Rock music": "music",
7687
+ "Hip hop music": "music",
7688
+ "Classical music": "music",
7689
+ Jazz: "music",
7690
+ "Electronic music": "music",
7691
+ "Background music": "music",
7692
+ Dog: "dog",
7693
+ Bark: "dog",
7694
+ Yip: "dog",
7695
+ Howl: "dog",
7696
+ "Bow-wow": "dog",
7697
+ Growling: "dog",
7698
+ "Whimper (dog)": "dog",
7699
+ Cat: "cat",
7700
+ Purr: "cat",
7701
+ Meow: "cat",
7702
+ Hiss: "cat",
7703
+ Caterwaul: "cat",
7704
+ Bird: "bird",
7705
+ "Bird vocalization, bird call, bird song": "bird",
7706
+ "Chirp, tweet": "bird",
7707
+ Squawk: "bird",
7708
+ Crow: "bird",
7709
+ Owl: "bird",
7710
+ "Pigeon, dove": "bird",
7711
+ Animal: "animal",
7712
+ "Domestic animals, pets": "animal",
7713
+ "Livestock, farm animals, working animals": "animal",
7714
+ Horse: "animal",
7715
+ "Cattle, bovinae": "animal",
7716
+ Pig: "animal",
7717
+ Sheep: "animal",
7718
+ Goat: "animal",
7719
+ Frog: "animal",
7720
+ Insect: "animal",
7721
+ Cricket: "animal",
7722
+ Alarm: "alarm",
7723
+ "Alarm clock": "alarm",
7724
+ "Smoke detector, smoke alarm": "alarm",
7725
+ "Fire alarm": "alarm",
7726
+ Buzzer: "alarm",
7727
+ "Civil defense siren": "alarm",
7728
+ "Car alarm": "alarm",
7729
+ Siren: "siren",
7730
+ "Police car (siren)": "siren",
7731
+ "Ambulance (siren)": "siren",
7732
+ "Fire engine, fire truck (siren)": "siren",
7733
+ "Emergency vehicle": "siren",
7734
+ Foghorn: "siren",
7735
+ Doorbell: "doorbell",
7736
+ "Ding-dong": "doorbell",
7737
+ Knock: "doorbell",
7738
+ Tap: "doorbell",
7739
+ Glass: "glass_breaking",
7740
+ Shatter: "glass_breaking",
7741
+ "Chink, clink": "glass_breaking",
7742
+ "Gunshot, gunfire": "gunshot",
7743
+ "Machine gun": "gunshot",
7744
+ Explosion: "gunshot",
7745
+ Fireworks: "gunshot",
7746
+ Firecracker: "gunshot",
7747
+ "Artillery fire": "gunshot",
7748
+ "Cap gun": "gunshot",
7749
+ Boom: "gunshot",
7750
+ Vehicle: "vehicle",
7751
+ Car: "vehicle",
7752
+ Truck: "vehicle",
7753
+ Bus: "vehicle",
7754
+ Motorcycle: "vehicle",
7755
+ "Car passing by": "vehicle",
7756
+ "Vehicle horn, car horn, honking": "vehicle",
7757
+ "Traffic noise, roadway noise": "vehicle",
7758
+ Train: "vehicle",
7759
+ Aircraft: "vehicle",
7760
+ Helicopter: "vehicle",
7761
+ Bicycle: "vehicle",
7762
+ Skateboard: "vehicle",
7763
+ Fire: "fire",
7764
+ Crackle: "fire",
7765
+ Water: "water",
7766
+ Rain: "water",
7767
+ Raindrop: "water",
7768
+ "Rain on surface": "water",
7769
+ Stream: "water",
7770
+ Waterfall: "water",
7771
+ Ocean: "water",
7772
+ "Waves, surf": "water",
7773
+ "Splash, splatter": "water",
7774
+ Wind: "wind",
7775
+ Thunderstorm: "wind",
7776
+ Thunder: "wind",
7777
+ "Wind noise (microphone)": "wind",
7778
+ "Rustling leaves": "wind",
7779
+ Door: "door",
7780
+ "Sliding door": "door",
7781
+ Slam: "door",
7782
+ "Cupboard open or close": "door",
7783
+ "Walk, footsteps": "footsteps",
7784
+ Run: "footsteps",
7785
+ Shuffle: "footsteps",
7786
+ Crowd: "crowd",
7787
+ Chatter: "crowd",
7788
+ Cheering: "crowd",
7789
+ Applause: "crowd",
7790
+ "Children playing": "crowd",
7791
+ "Hubbub, speech noise, speech babble": "crowd",
7792
+ Telephone: "telephone",
7793
+ "Telephone bell ringing": "telephone",
7794
+ Ringtone: "telephone",
7795
+ "Telephone dialing, DTMF": "telephone",
7796
+ "Busy signal": "telephone",
7797
+ Engine: "engine",
7798
+ "Engine starting": "engine",
7799
+ Idling: "engine",
7800
+ "Accelerating, revving, vroom": "engine",
7801
+ "Light engine (high frequency)": "engine",
7802
+ "Medium engine (mid frequency)": "engine",
7803
+ "Heavy engine (low frequency)": "engine",
7804
+ "Lawn mower": "engine",
7805
+ Chainsaw: "engine",
7806
+ Hammer: "tools",
7807
+ Jackhammer: "tools",
7808
+ Sawing: "tools",
7809
+ "Power tool": "tools",
7810
+ Drill: "tools",
7811
+ Sanding: "tools",
7812
+ Silence: "silence"
7813
+ },
7814
+ preserveOriginal: false
7815
+ };
7816
+ var APPLE_SA_TO_MACRO = {
7817
+ mapping: {
7818
+ speech: "speech",
7819
+ child_speech: "speech",
7820
+ conversation: "speech",
7821
+ whispering: "speech",
7822
+ singing: "speech",
7823
+ humming: "speech",
7824
+ shout: "scream",
7825
+ yell: "scream",
7826
+ screaming: "scream",
7827
+ crying: "crying",
7828
+ baby_crying: "crying",
7829
+ sobbing: "crying",
7830
+ laughter: "laughter",
7831
+ baby_laughter: "laughter",
7832
+ giggling: "laughter",
7833
+ music: "music",
7834
+ guitar: "music",
7835
+ piano: "music",
7836
+ drums: "music",
7837
+ dog_bark: "dog",
7838
+ dog_bow_wow: "dog",
7839
+ dog_growling: "dog",
7840
+ dog_howl: "dog",
7841
+ cat_meow: "cat",
7842
+ cat_purr: "cat",
7843
+ cat_hiss: "cat",
7844
+ bird: "bird",
7845
+ bird_chirp: "bird",
7846
+ bird_squawk: "bird",
7847
+ animal: "animal",
7848
+ horse: "animal",
7849
+ cow_moo: "animal",
7850
+ insect: "animal",
7851
+ alarm: "alarm",
7852
+ smoke_alarm: "alarm",
7853
+ fire_alarm: "alarm",
7854
+ car_alarm: "alarm",
7855
+ siren: "siren",
7856
+ police_siren: "siren",
7857
+ ambulance_siren: "siren",
7858
+ doorbell: "doorbell",
7859
+ door_knock: "doorbell",
7860
+ knocking: "doorbell",
7861
+ glass_breaking: "glass_breaking",
7862
+ glass_shatter: "glass_breaking",
7863
+ gunshot: "gunshot",
7864
+ explosion: "gunshot",
7865
+ fireworks: "gunshot",
7866
+ car: "vehicle",
7867
+ truck: "vehicle",
7868
+ motorcycle: "vehicle",
7869
+ car_horn: "vehicle",
7870
+ vehicle_horn: "vehicle",
7871
+ traffic: "vehicle",
7872
+ fire: "fire",
7873
+ fire_crackle: "fire",
7874
+ water: "water",
7875
+ rain: "water",
7876
+ ocean: "water",
7877
+ splash: "water",
7878
+ wind: "wind",
7879
+ thunder: "wind",
7880
+ thunderstorm: "wind",
7881
+ door: "door",
7882
+ door_slam: "door",
7883
+ sliding_door: "door",
7884
+ footsteps: "footsteps",
7885
+ walking: "footsteps",
7886
+ running: "footsteps",
7887
+ crowd: "crowd",
7888
+ chatter: "crowd",
7889
+ cheering: "crowd",
7890
+ applause: "crowd",
7891
+ telephone_ring: "telephone",
7892
+ ringtone: "telephone",
7893
+ engine: "engine",
7894
+ engine_starting: "engine",
7895
+ lawn_mower: "engine",
7896
+ chainsaw: "engine",
7897
+ hammer: "tools",
7898
+ jackhammer: "tools",
7899
+ drill: "tools",
7900
+ power_tool: "tools",
7901
+ silence: "silence"
7902
+ },
7903
+ preserveOriginal: false
7904
+ };
7905
+ var _macroLookup = /* @__PURE__ */ new Map();
7906
+ for (const [k, v] of Object.entries(YAMNET_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7907
+ for (const [k, v] of Object.entries(APPLE_SA_TO_MACRO.mapping)) _macroLookup.set(k.toLowerCase(), v);
7908
+ /** Map a raw audio label (YAMNet or Apple SoundAnalysis) to its macro class. Returns null if unmapped. */
7909
+ function mapAudioLabelToMacro(label) {
7910
+ return _macroLookup.get(label.toLowerCase()) ?? null;
7911
+ }
7752
7912
  /**
7753
7913
  * Accessory device helpers — shared across drivers.
7754
7914
  *
@@ -7908,78 +8068,6 @@ object({
7908
8068
  });
7909
8069
  DeviceType.Sensor;
7910
8070
  /**
7911
- * Generic types for capability definitions.
7912
- *
7913
- * A capability is defined with Zod schemas for methods, events, and settings.
7914
- * TypeScript types are inferred via z.infer<> — zero duplication.
7915
- *
7916
- * Pattern:
7917
- * 1. Define Zod schemas for data, methods, settings
7918
- * 2. Export const capabilityDef = { ... } satisfies CapabilityDefinition
7919
- * 3. Export type IProvider = InferProvider<typeof capabilityDef>
7920
- * 4. Addon implements IProvider
7921
- * 5. Registry auto-mounts tRPC router from definition.methods
7922
- */
7923
- /**
7924
- * Output schema shared by the contribution + live methods.
7925
- *
7926
- * Mirrors the `ConfigUISchemaWithValues` shape (sections[] + optional
7927
- * tabs[]) without importing from `../interfaces/config-ui.js` — a
7928
- * concrete-but-lenient Zod object keeps tRPC output inference happy
7929
- * (using `z.unknown()` here collapses unrelated router branches to
7930
- * `unknown` when the generator re-inlines the huge AppRouter type).
7931
- *
7932
- * `.passthrough()` on sections/fields accepts whatever FormBuilder
7933
- * extensions the caller adds (showWhen, displayScale, …) without
7934
- * rebuilding every time a new field kind is introduced.
7935
- */
7936
- var ContributionSectionSchema = object({
7937
- id: string(),
7938
- title: string(),
7939
- description: string().optional(),
7940
- style: _enum(["card", "accordion"]).optional(),
7941
- defaultCollapsed: boolean().optional(),
7942
- columns: union([
7943
- literal(1),
7944
- literal(2),
7945
- literal(3),
7946
- literal(4)
7947
- ]).optional(),
7948
- tab: string().optional(),
7949
- location: _enum(["settings", "top-tab"]).optional(),
7950
- order: number().optional(),
7951
- fields: array(any())
7952
- });
7953
- object({
7954
- tabs: array(object({
7955
- id: string(),
7956
- label: string(),
7957
- icon: string(),
7958
- order: number().optional()
7959
- })).optional(),
7960
- sections: array(ContributionSectionSchema)
7961
- }).nullable();
7962
- object({ deviceId: number() }), object({ deviceId: number() }), object({
7963
- deviceId: number(),
7964
- patch: record(string(), unknown())
7965
- }), object({ success: literal(true) });
7966
- object({ deviceId: number() }), unknown().nullable();
7967
- /** Shorthand to define a method schema */
7968
- function method(input, output, options) {
7969
- return {
7970
- input,
7971
- output,
7972
- kind: options?.kind ?? "query",
7973
- auth: options?.auth ?? "protected",
7974
- ...options?.access !== void 0 ? { access: options.access } : {},
7975
- timeoutMs: options?.timeoutMs
7976
- };
7977
- }
7978
- /** Shorthand to define an event schema */
7979
- function event(data) {
7980
- return { data };
7981
- }
7982
- /**
7983
8071
  * Alarm-panel cap. Models HA `alarm_control_panel.*` on
7984
8072
  * `DeviceType.AlarmPanel`. State follows HA's canonical lifecycle
7985
8073
  * across disarmed / armed_(home|away|night|vacation|custom_bypass) /
@@ -12476,9 +12564,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
12476
12564
  limit: number().optional(),
12477
12565
  tags: record(string(), string()).optional()
12478
12566
  }), array(LogEntrySchema).readonly());
12479
- var StaticDirOutputSchema = object({ staticDir: string() });
12480
- var VersionOutputSchema = object({ version: string() });
12481
- method(_void(), StaticDirOutputSchema), method(_void(), VersionOutputSchema);
12482
12567
  /**
12483
12568
  * Zod schemas for persisted record types.
12484
12569
  *
@@ -15076,7 +15161,7 @@ method(object({
15076
15161
  }), _void(), {
15077
15162
  kind: "mutation",
15078
15163
  auth: "admin"
15079
- }), 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({
15164
+ }), 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({
15080
15165
  deviceId: number(),
15081
15166
  values: record(string(), unknown())
15082
15167
  }), object({ success: literal(true) }), {
@@ -15789,7 +15874,20 @@ var DiskSpaceInfoSchema = object({
15789
15874
  var PidResourceStatsSchema = object({
15790
15875
  pid: number(),
15791
15876
  cpu: number(),
15792
- memory: number()
15877
+ memory: number(),
15878
+ /**
15879
+ * Private (anonymous) resident bytes — the per-process V8 heap + native
15880
+ * allocations NOT shared with other processes (Linux RssAnon). This is the
15881
+ * "real" per-runner cost; summing it across runners is meaningful, unlike
15882
+ * `memory` (RSS), which double-counts the shared mmap'd framework code.
15883
+ * Undefined where /proc is unavailable (e.g. macOS).
15884
+ */
15885
+ privateBytes: number().optional(),
15886
+ /**
15887
+ * Shared file-backed resident bytes (Linux RssFile) — mmap'd framework/lib
15888
+ * code shared copy-on-write across runners. Undefined on macOS.
15889
+ */
15890
+ sharedBytes: number().optional()
15793
15891
  });
15794
15892
  var AddonInstanceSchema = object({
15795
15893
  addonId: string(),
@@ -15838,6 +15936,17 @@ var KillProcessResultSchema = object({
15838
15936
  reason: string().optional(),
15839
15937
  signal: _enum(["SIGTERM", "SIGKILL"]).optional()
15840
15938
  });
15939
+ var DumpHeapSnapshotInputSchema = object({
15940
+ /** The addon whose runner should dump a heap snapshot. */
15941
+ addonId: string() });
15942
+ var DumpHeapSnapshotResultSchema = object({
15943
+ success: boolean(),
15944
+ /** Path of the written .heapsnapshot inside the runner's container/host. */
15945
+ path: string().optional(),
15946
+ /** Process pid that was signalled. */
15947
+ pid: number().optional(),
15948
+ reason: string().optional()
15949
+ });
15841
15950
  var SystemMetricsSchema = object({
15842
15951
  cpuPercent: number(),
15843
15952
  memoryPercent: number(),
@@ -15851,6 +15960,9 @@ var SystemMetricsSchema = object({
15851
15960
  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, {
15852
15961
  kind: "mutation",
15853
15962
  auth: "admin"
15963
+ }), method(DumpHeapSnapshotInputSchema, DumpHeapSnapshotResultSchema, {
15964
+ kind: "mutation",
15965
+ auth: "admin"
15854
15966
  });
15855
15967
  var PtzPresetSchema = object({
15856
15968
  id: string(),
@@ -16250,63 +16362,6 @@ var recordingCapability = {
16250
16362
  }
16251
16363
  };
16252
16364
  /**
16253
- * device-ops — device-scoped cap that unifies the per-IDevice operations
16254
- * previously routed through the `.device-ops` Moleculer bridge service.
16255
- *
16256
- * Each worker that hosts live `IDevice` instances auto-registers a native
16257
- * provider for this cap (per device) backed by its local
16258
- * `DeviceRegistry`. Hub-side callers reach it transparently through
16259
- * `ctx.fetchDevice(id).deviceOps.*` — the DeviceProxy injects
16260
- * `deviceId` + `nodeId` and dispatches through the standard cap-router,
16261
- * so there's no parallel bridge path anymore.
16262
- *
16263
- * The surface is intentionally small — every method corresponds to a
16264
- * single action on the live `IDevice` (or `ICameraDevice` for
16265
- * `getStreamSources`). Richer orchestration (enable/disable with
16266
- * integration plumbing, bulk updates) stays in the `device-manager` cap;
16267
- * `device-ops` is the per-device primitive the device-manager routes to.
16268
- */
16269
- var StreamSourceEntrySchema$1 = object({
16270
- id: string(),
16271
- label: string(),
16272
- protocol: _enum([
16273
- "rtsp",
16274
- "rtmp",
16275
- "annexb",
16276
- "http-mjpeg",
16277
- "webrtc",
16278
- "custom"
16279
- ]),
16280
- url: string().optional(),
16281
- resolution: object({
16282
- width: number(),
16283
- height: number()
16284
- }).optional(),
16285
- fps: number().optional(),
16286
- bitrate: number().optional(),
16287
- codec: string().optional(),
16288
- profileHint: CamProfileSchema.optional(),
16289
- sdp: string().optional()
16290
- });
16291
- var ConfigEntrySchema$1 = object({
16292
- key: string(),
16293
- value: unknown()
16294
- });
16295
- var RawStateResultSchema = object({
16296
- /** Originating provider id, e.g. 'homeassistant' | 'reolink' | 'hikvision'. */
16297
- source: string(),
16298
- /** Opaque, DISPLAY-SAFE upstream blob (no secrets/PII). */
16299
- data: record(string(), unknown())
16300
- });
16301
- method(object({ deviceId: number() }), array(StreamSourceEntrySchema$1)), method(object({ deviceId: number() }), array(ConfigEntrySchema$1)), method(object({
16302
- deviceId: number(),
16303
- values: record(string(), unknown())
16304
- }), _void(), { kind: "mutation" }), method(object({
16305
- deviceId: number(),
16306
- action: string().min(1),
16307
- input: unknown()
16308
- }), unknown(), { kind: "mutation" }), method(object({ deviceId: number() }), _void(), { kind: "mutation" }), method(object({ deviceId: number() }), unknown().nullable()), method(object({ deviceId: number() }), RawStateResultSchema.nullable(), { auth: "protected" });
16309
- /**
16310
16365
  * camera-credentials — device-scoped cap exposing the camera's network
16311
16366
  * + auth surface in a vendor-neutral shape.
16312
16367
  *
@@ -19989,6 +20044,12 @@ Object.freeze({
19989
20044
  addonId: null,
19990
20045
  access: "view"
19991
20046
  },
20047
+ "metricsProvider.dumpHeapSnapshot": {
20048
+ capName: "metrics-provider",
20049
+ capScope: "system",
20050
+ addonId: null,
20051
+ access: "create"
20052
+ },
19992
20053
  "metricsProvider.getAddonStats": {
19993
20054
  capName: "metrics-provider",
19994
20055
  capScope: "system",
@@ -22355,30 +22416,6 @@ var RingBuffer = class {
22355
22416
  return result;
22356
22417
  }
22357
22418
  };
22358
- /**
22359
- * Promise-based timer helpers — used everywhere the codebase needs to
22360
- * wait, back off, or schedule a retry. Before these helpers landed, each
22361
- * call site re-implemented `new Promise(r => setTimeout(r, ms))` inline,
22362
- * with subtle variations (some swallowing cancellation, some not). Two
22363
- * shapes cover every observed use case:
22364
- *
22365
- * - {@link sleep} for a plain, uncancellable wait — the default choice.
22366
- * - {@link sleepCancellable} for a wait that wakes early when an
22367
- * abort signal trips, used by long-running pollers whose teardown
22368
- * must stop a pending backoff promptly.
22369
- */
22370
- /**
22371
- * Resolve after `ms` milliseconds. Never rejects, never cancels. The
22372
- * sleep cannot be interrupted; for a wakeable variant use
22373
- * {@link sleepCancellable}.
22374
- *
22375
- * `ms <= 0` resolves on the next microtask via `setTimeout(0)`, which
22376
- * still gives the event loop a chance to drain — useful for breaking
22377
- * up tight async loops without changing call-site semantics.
22378
- */
22379
- function sleep(ms) {
22380
- return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
22381
- }
22382
22419
  //#endregion
22383
22420
  Object.defineProperty(exports, "APPLE_SA_TO_MACRO", {
22384
22421
  enumerable: true,