@camstack/addon-provider-hikvision 1.0.4 → 1.0.6

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