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