@camstack/addon-provider-hikvision 1.2.87 → 1.2.88

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 +500 -365
  2. package/dist/addon.mjs +500 -365
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6,7 +6,7 @@ let node_crypto = require("node:crypto");
6
6
  let node_http = require("node:http");
7
7
  let node_https = require("node:https");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-zAv7pMUz.mjs
9
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -201,6 +201,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
201
201
  EventCategory["ProcessCrashed"] = "process.crashed";
202
202
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
203
203
  EventCategory["ProcessRestarted"] = "process.restarted";
204
+ /**
205
+ * The SET of storage locations changed — one was created, edited, enabled,
206
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
207
+ *
208
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
209
+ * it must also converge on its own periodic path, because a dropped event
210
+ * must not leave a node writing to yesterday's disk set forever. It exists
211
+ * because there was NO signal at all — an operator who added a second
212
+ * recordings disk in the admin UI got nothing, and the recorder kept its
213
+ * resolved locations until something else happened to re-resolve them
214
+ * (D387). Payload `StorageLocationsChangedPayload`.
215
+ */
216
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
204
217
  EventCategory["RecordingStarted"] = "recording.started";
205
218
  EventCategory["RecordingStopped"] = "recording.stopped";
206
219
  EventCategory["RecordingError"] = "recording.error";
@@ -8531,6 +8544,21 @@ var StorageCleanupJobSchema = object({
8531
8544
  });
8532
8545
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8533
8546
  /**
8547
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8548
+ * alias below is `z.infer<>` of it, never a second spelling.
8549
+ */
8550
+ var StorageLocationModeSchema = _enum([
8551
+ "active",
8552
+ "readonly",
8553
+ "drain",
8554
+ "disabled"
8555
+ ]);
8556
+ _enum([
8557
+ "normal",
8558
+ "never",
8559
+ "drain"
8560
+ ]);
8561
+ /**
8534
8562
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8535
8563
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8536
8564
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8596,6 +8624,21 @@ var StorageLocationSchema = object({
8596
8624
  * stops existing rather than being re-derived on every read.
8597
8625
  */
8598
8626
  enabled: boolean().optional(),
8627
+ /**
8628
+ * THE state of this location (D385), and the only authority on what may be
8629
+ * written, read or evicted here. Interpreted in exactly one place —
8630
+ * `storage-location-mode.ts` — which also folds the legacy
8631
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8632
+ * ambiguous.
8633
+ *
8634
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8635
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8636
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8637
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8638
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8639
+ * either, so the two cannot disagree.
8640
+ */
8641
+ mode: StorageLocationModeSchema.optional(),
8599
8642
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8600
8643
  * for node-local locations it can reach) — never persisted, absent when the
8601
8644
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8603,11 +8646,46 @@ var StorageLocationSchema = object({
8603
8646
  totalBytes: number(),
8604
8647
  availableBytes: number()
8605
8648
  }).nullable().optional(),
8649
+ /**
8650
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8651
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8652
+ * never persisted, never a filesystem walk.
8653
+ *
8654
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8655
+ * location yet — nobody stores here, the owning addon is down, or the first
8656
+ * refresh has not completed. A UI must omit the segment rather than draw it
8657
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8658
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8659
+ * be spelled out loud instead of appearing by accident.
8660
+ *
8661
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8662
+ * about the whole figure rather than about its freshest part.
8663
+ */
8664
+ owned: object({
8665
+ bytes: number().int().nonnegative(),
8666
+ measuredAtMs: number().int().nonnegative()
8667
+ }).optional(),
8606
8668
  createdAt: number(),
8607
8669
  updatedAt: number()
8608
8670
  });
8609
8671
  object({ isDefault: boolean().optional() });
8610
8672
  /**
8673
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8674
+ *
8675
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8676
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8677
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8678
+ * operator learns not to believe the screen.
8679
+ */
8680
+ var StorageDrainProgressSchema = object({
8681
+ locationId: string(),
8682
+ startedAtMs: number(),
8683
+ startBytes: number(),
8684
+ bytesRemaining: number(),
8685
+ drained: boolean(),
8686
+ estimatedEmptyAtMs: number().nullable()
8687
+ });
8688
+ /**
8611
8689
  * Reference accepted by consumer-facing `api.storage.*` calls.
8612
8690
  * Either:
8613
8691
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22352,7 +22430,7 @@ method(object({
22352
22430
  }), _void(), {
22353
22431
  kind: "mutation",
22354
22432
  auth: "admin"
22355
- }), method(object({ id: string() }), object({
22433
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22356
22434
  ok: boolean(),
22357
22435
  error: string().optional()
22358
22436
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22422,6 +22500,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22422
22500
  kind: "mutation",
22423
22501
  auth: "admin"
22424
22502
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22503
+ /**
22504
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22505
+ * location (D388).
22506
+ *
22507
+ * ## Why this is not `storage-evictable`
22508
+ *
22509
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22510
+ * not, in two ways that both matter and both bite hardest on the locations an
22511
+ * operator most wants a figure for:
22512
+ *
22513
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22514
+ * and `recordingsLow:default` deliberately share one root and evict as one
22515
+ * oldest-first pool, so both answer with the SAME combined total. As an
22516
+ * occupancy figure that double-counts the disk.
22517
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22518
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22519
+ * is retiring and staring at.
22520
+ *
22521
+ * So this is its own contract with its own quantity, and the quantity is
22522
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22523
+ * would ever be willing to delete it. A provider that can only answer
22524
+ * "evictable" must not register here — a number that silently means different
22525
+ * things per class is worse than no number.
22526
+ *
22527
+ * ## Absence is an answer
22528
+ *
22529
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22530
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22531
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22532
+ * consuming side has to be written out loud instead of appearing by accident.
22533
+ *
22534
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22535
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22536
+ */
22537
+ /** One provider's occupancy answer for one location. */
22538
+ var StorageOccupancyReportSchema = object({
22539
+ locationId: string(),
22540
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22541
+ * not net of what it is willing to delete. */
22542
+ ownedBytes: number().int().nonnegative(),
22543
+ /** When the provider last actually measured this. The orchestrator carries it
22544
+ * through so a UI can say how old the figure is instead of implying "now". */
22545
+ measuredAtMs: number().int().nonnegative()
22546
+ });
22547
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22425
22548
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22426
22549
  providerId: string().min(1),
22427
22550
  displayName: string().min(1),
@@ -24257,88 +24380,6 @@ onStatusChanged: { data: object({
24257
24380
  volatileStateFields: ["lastUpdated"]
24258
24381
  };
24259
24382
  /**
24260
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24261
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24262
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24263
- * one Home Assistant projection.
24264
- */
24265
- var NetworkLinkStatusSchema = object({
24266
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24267
- type: _enum([
24268
- "wifi",
24269
- "ethernet",
24270
- "cellular",
24271
- "unknown"
24272
- ]),
24273
- /**
24274
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24275
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24276
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24277
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24278
- * SKIP a null rather than coerce it.
24279
- */
24280
- signalPercent: number().min(0).max(100).nullable(),
24281
- /** Raw received signal strength in dBm, when the firmware reports one. */
24282
- rssiDbm: number().optional(),
24283
- /** Network name of a wireless link, when the firmware reports it. */
24284
- ssid: string().optional(),
24285
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24286
- lastUpdated: number()
24287
- });
24288
- var networkLinkCapability = {
24289
- name: "network-link",
24290
- scope: "device",
24291
- deviceNative: true,
24292
- mode: "singleton",
24293
- deviceTypes: [
24294
- DeviceType.Camera,
24295
- DeviceType.Sensor,
24296
- DeviceType.Button,
24297
- DeviceType.Switch,
24298
- DeviceType.Light,
24299
- DeviceType.Lock,
24300
- DeviceType.Siren
24301
- ],
24302
- methods: {},
24303
- events: {
24304
- /**
24305
- * Emitted whenever the cached status changes (a link switch, a signal
24306
- * reading that moved). Mirrored on the parent chain by the
24307
- * DeviceEventPropagator like `battery.onStatusChanged`.
24308
- */
24309
- onStatusChanged: { data: object({
24310
- deviceId: number(),
24311
- status: NetworkLinkStatusSchema
24312
- }) } },
24313
- status: {
24314
- schema: NetworkLinkStatusSchema,
24315
- kind: "push",
24316
- empty: {
24317
- type: "unknown",
24318
- signalPercent: null,
24319
- lastUpdated: 0
24320
- }
24321
- },
24322
- /**
24323
- * Runtime-state slice — every provider stores the same shape under
24324
- * `device.runtimeState['network-link']`, read once by the badge and the
24325
- * Home Assistant projector regardless of the driver.
24326
- */
24327
- runtimeState: NetworkLinkStatusSchema,
24328
- /**
24329
- * Runtime-state durability: **restored** — a link reading is slow to
24330
- * change and a sleeping battery camera may not report for hours; the
24331
- * restored slice is what the badge shows until the next read.
24332
- *
24333
- * See `RuntimeStateDurability`. Enforced by
24334
- * `scripts/check-runtime-state-durability.ts`.
24335
- */
24336
- durability: "restored",
24337
- /** Clock fields: written, but excluded from the compare that decides
24338
- * whether persisting is worth a SQLite commit. */
24339
- volatileStateFields: ["lastUpdated"]
24340
- };
24341
- /**
24342
24383
  * Generic boolean sensor — last-resort fallback when no domain-
24343
24384
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24344
24385
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27868,6 +27909,369 @@ var nativeObjectDetectionCapability = {
27868
27909
  volatileStateFields: ["lastFetchedAt"]
27869
27910
  };
27870
27911
  /**
27912
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27913
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27914
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27915
+ *
27916
+ * Why a NEW cap rather than overloading `ptz`:
27917
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27918
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27919
+ * The two are different physical models: PTZ is absolute-position + presets,
27920
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27921
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27922
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27923
+ * the reverse:
27924
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27925
+ * / `getOptions`), and
27926
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27927
+ * robot camera shows up in the existing PTZ control path without every
27928
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27929
+ * not here (see the addon design note):
27930
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27931
+ * ptz.stop() → navigation.stop()
27932
+ * ptz.goHome() → navigation.runAction('goHome')
27933
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27934
+ * ptz.goToPreset(id) → navigation.runAction(id)
27935
+ *
27936
+ * ## Continuous drive
27937
+ *
27938
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27939
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27940
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27941
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27942
+ * coalesce them. The UI owns the cadence.
27943
+ *
27944
+ * ## The action dictionary
27945
+ *
27946
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27947
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27948
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27949
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27950
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27951
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27952
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27953
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27954
+ *
27955
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27956
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27957
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27958
+ * every device handle. A future nodedreame publish adds a typed
27959
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27960
+ * provider can then swap the raw calls for the typed methods with no change to
27961
+ * THIS contract.
27962
+ */
27963
+ /**
27964
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27965
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27966
+ * halts it.
27967
+ *
27968
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27969
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27970
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27971
+ * vector by it (drivers without proportional drive ignore it).
27972
+ *
27973
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27974
+ * axis alone; an all-undefined nudge is a no-op.
27975
+ */
27976
+ var NavigationMoveCommandSchema = object({
27977
+ pan: number().min(-1).max(1).optional(),
27978
+ tilt: number().min(-1).max(1).optional(),
27979
+ speed: number().min(0).max(1).optional()
27980
+ });
27981
+ /**
27982
+ * The enumerated discrete actions a navigation-capable robot can perform via
27983
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27984
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27985
+ * `playSound` (see the `sound` dictionary entries).
27986
+ */
27987
+ var NavigationActionIdSchema = _enum([
27988
+ "goHome",
27989
+ "locate",
27990
+ "spotClean",
27991
+ "findPet",
27992
+ "personFollow",
27993
+ "stop",
27994
+ "startClean",
27995
+ "pauseClean",
27996
+ "dockWash",
27997
+ "autoEmpty",
27998
+ "flashOn",
27999
+ "flashOff"
28000
+ ]);
28001
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28002
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28003
+ /**
28004
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28005
+ * native panel and the PTZ mimic render as a button.
28006
+ *
28007
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28008
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28009
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28010
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28011
+ * - `label` — operator-facing English label.
28012
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28013
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28014
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28015
+ * flips it from config, never by editing code.
28016
+ */
28017
+ var NavigationActionEntrySchema = object({
28018
+ id: string(),
28019
+ kind: NavigationEntryKindSchema,
28020
+ label: string(),
28021
+ icon: string(),
28022
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28023
+ soundId: number().int().optional(),
28024
+ /** Per-device feature flag — render this entry only when true. */
28025
+ enabled: boolean()
28026
+ });
28027
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28028
+ var NavigationPointSchema = object({
28029
+ x: number(),
28030
+ y: number()
28031
+ });
28032
+ /**
28033
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28034
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28035
+ * that are turned on for THIS device. Data-driven: the provider derives these
28036
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28037
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28038
+ * that are not dictionary entries.
28039
+ *
28040
+ * - `move` / `stop` — the momentary drive joystick.
28041
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28042
+ * map-coordinate plumbing is wired.
28043
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28044
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28045
+ * - `light` — the on/off fill-light toggle (works anytime).
28046
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28047
+ * camera-service control; needs an active stream).
28048
+ */
28049
+ var NavigationFeaturesSchema = object({
28050
+ move: boolean(),
28051
+ stop: boolean(),
28052
+ goToPoint: boolean(),
28053
+ runAction: boolean(),
28054
+ playSound: boolean(),
28055
+ light: boolean(),
28056
+ lightMode: boolean()
28057
+ });
28058
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28059
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28060
+ /**
28061
+ * Live navigation state so the UI can reflect what the robot is doing:
28062
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28063
+ * - `following` — person/pet follow is currently armed.
28064
+ * - `flash` — the on-camera fill light is on.
28065
+ * - `lightMode` — auto vs manual fill-light mode.
28066
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28067
+ * `lightMode === 'manual'`.
28068
+ */
28069
+ var NavigationStatusSchema = object({
28070
+ mode: _enum([
28071
+ "idle",
28072
+ "cleaning",
28073
+ "spot",
28074
+ "following",
28075
+ "goto",
28076
+ "returning",
28077
+ "paused",
28078
+ "unknown"
28079
+ ]),
28080
+ following: boolean(),
28081
+ flash: boolean(),
28082
+ lightMode: NavigationLightModeSchema,
28083
+ lightLevel: number().min(40).max(100),
28084
+ /** Ms epoch when the slice was last updated. */
28085
+ lastChangedAt: number()
28086
+ });
28087
+ /**
28088
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28089
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28090
+ * convention.
28091
+ */
28092
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28093
+ var navigationCapability = {
28094
+ name: "navigation",
28095
+ scope: "device",
28096
+ deviceNative: true,
28097
+ mode: "singleton",
28098
+ deviceTypes: [DeviceType.Camera],
28099
+ deviceConfig: { ui: {
28100
+ kind: "widget",
28101
+ widgetId: "host/navigation-panel",
28102
+ tab: "navigation",
28103
+ topTab: true,
28104
+ label: "Navigation",
28105
+ order: 0
28106
+ } },
28107
+ methods: {
28108
+ /**
28109
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28110
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28111
+ * path) works for any authenticated user, not admin-only. The UI sends
28112
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28113
+ * a single drive write WITHOUT debouncing.
28114
+ */
28115
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28116
+ /** Halt all motion immediately (zero drive vector). */
28117
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28118
+ /** Send the robot to a point on its live map. */
28119
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28120
+ /**
28121
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28122
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28123
+ */
28124
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28125
+ /**
28126
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28127
+ * unsupported action ids are rejected by the provider.
28128
+ */
28129
+ runAction: method(object({
28130
+ deviceId: number(),
28131
+ actionId: NavigationActionIdSchema
28132
+ }), _void(), { kind: "mutation" }),
28133
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28134
+ playSound: method(object({
28135
+ deviceId: number(),
28136
+ soundId: number().int()
28137
+ }), _void(), { kind: "mutation" }),
28138
+ /**
28139
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28140
+ * works anytime, no active stream required).
28141
+ */
28142
+ setLightOn: method(object({
28143
+ deviceId: number(),
28144
+ on: boolean()
28145
+ }), _void(), { kind: "mutation" }),
28146
+ /**
28147
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28148
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28149
+ * action that generally needs an active camera stream/monitor session — the
28150
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28151
+ */
28152
+ setLightMode: method(object({
28153
+ deviceId: number(),
28154
+ mode: NavigationLightModeSchema,
28155
+ level: number().min(40).max(100).optional()
28156
+ }), _void(), { kind: "mutation" }),
28157
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28158
+ setLightLevel: method(object({
28159
+ deviceId: number(),
28160
+ level: number().min(40).max(100)
28161
+ }), _void(), { kind: "mutation" }),
28162
+ /**
28163
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28164
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28165
+ * `listActions`).
28166
+ */
28167
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28168
+ },
28169
+ events: { onStatusChanged: { data: object({
28170
+ deviceId: number(),
28171
+ status: NavigationStatusSchema
28172
+ }) } },
28173
+ status: {
28174
+ schema: NavigationStatusSchema,
28175
+ kind: "push"
28176
+ },
28177
+ /**
28178
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28179
+ * for live mode / follow / flash changes.
28180
+ */
28181
+ runtimeState: NavigationRuntimeStateSchema,
28182
+ /**
28183
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28184
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28185
+ * that. The live handle re-publishes on connect.
28186
+ *
28187
+ * See `RuntimeStateDurability`. Enforced by
28188
+ * `scripts/check-runtime-state-durability.ts`.
28189
+ */
28190
+ durability: "session"
28191
+ };
28192
+ /**
28193
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28194
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28195
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28196
+ * one Home Assistant projection.
28197
+ */
28198
+ var NetworkLinkStatusSchema = object({
28199
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28200
+ type: _enum([
28201
+ "wifi",
28202
+ "ethernet",
28203
+ "cellular",
28204
+ "unknown"
28205
+ ]),
28206
+ /**
28207
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28208
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28209
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28210
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28211
+ * SKIP a null rather than coerce it.
28212
+ */
28213
+ signalPercent: number().min(0).max(100).nullable(),
28214
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28215
+ rssiDbm: number().optional(),
28216
+ /** Network name of a wireless link, when the firmware reports it. */
28217
+ ssid: string().optional(),
28218
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28219
+ lastUpdated: number()
28220
+ });
28221
+ var networkLinkCapability = {
28222
+ name: "network-link",
28223
+ scope: "device",
28224
+ deviceNative: true,
28225
+ mode: "singleton",
28226
+ deviceTypes: [
28227
+ DeviceType.Camera,
28228
+ DeviceType.Sensor,
28229
+ DeviceType.Button,
28230
+ DeviceType.Switch,
28231
+ DeviceType.Light,
28232
+ DeviceType.Lock,
28233
+ DeviceType.Siren
28234
+ ],
28235
+ methods: {},
28236
+ events: {
28237
+ /**
28238
+ * Emitted whenever the cached status changes (a link switch, a signal
28239
+ * reading that moved). Mirrored on the parent chain by the
28240
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28241
+ */
28242
+ onStatusChanged: { data: object({
28243
+ deviceId: number(),
28244
+ status: NetworkLinkStatusSchema
28245
+ }) } },
28246
+ status: {
28247
+ schema: NetworkLinkStatusSchema,
28248
+ kind: "push",
28249
+ empty: {
28250
+ type: "unknown",
28251
+ signalPercent: null,
28252
+ lastUpdated: 0
28253
+ }
28254
+ },
28255
+ /**
28256
+ * Runtime-state slice — every provider stores the same shape under
28257
+ * `device.runtimeState['network-link']`, read once by the badge and the
28258
+ * Home Assistant projector regardless of the driver.
28259
+ */
28260
+ runtimeState: NetworkLinkStatusSchema,
28261
+ /**
28262
+ * Runtime-state durability: **restored** — a link reading is slow to
28263
+ * change and a sleeping battery camera may not report for hours; the
28264
+ * restored slice is what the badge shows until the next read.
28265
+ *
28266
+ * See `RuntimeStateDurability`. Enforced by
28267
+ * `scripts/check-runtime-state-durability.ts`.
28268
+ */
28269
+ durability: "restored",
28270
+ /** Clock fields: written, but excluded from the compare that decides
28271
+ * whether persisting is worth a SQLite commit. */
28272
+ volatileStateFields: ["lastUpdated"]
28273
+ };
28274
+ /**
27871
28275
  * network-quality — system-scoped singleton capability tracking RTT,
27872
28276
  * jitter, and observed/peak bandwidth per device + per client.
27873
28277
  *
@@ -29557,287 +29961,6 @@ var ptzAutotrackCapability = {
29557
29961
  durability: "session"
29558
29962
  };
29559
29963
  /**
29560
- * `navigation` — a device-scoped capability that natively expresses the FULL
29561
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29562
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29563
- *
29564
- * Why a NEW cap rather than overloading `ptz`:
29565
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29566
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29567
- * The two are different physical models: PTZ is absolute-position + presets,
29568
- * navigation is momentary drive nudges + discrete robot ACTIONS
29569
- * (dock / spot-clean / follow-pet / go-to-point / …).
29570
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29571
- * the reverse:
29572
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29573
- * / `getOptions`), and
29574
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29575
- * robot camera shows up in the existing PTZ control path without every
29576
- * PTZ provider learning about robots. The mapping lives in the adapter,
29577
- * not here (see the addon design note):
29578
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29579
- * ptz.stop() → navigation.stop()
29580
- * ptz.goHome() → navigation.runAction('goHome')
29581
- * ptz.getPresets() → navigation.listActions() (id→preset)
29582
- * ptz.goToPreset(id) → navigation.runAction(id)
29583
- *
29584
- * ## Continuous drive
29585
- *
29586
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29587
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29588
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29589
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29590
- * coalesce them. The UI owns the cadence.
29591
- *
29592
- * ## The action dictionary
29593
- *
29594
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29595
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29596
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29597
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29598
- * vendor-specific list. `kind: 'action'` entries are triggered with
29599
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29600
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29601
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29602
- *
29603
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29604
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29605
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29606
- * every device handle. A future nodedreame publish adds a typed
29607
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29608
- * provider can then swap the raw calls for the typed methods with no change to
29609
- * THIS contract.
29610
- */
29611
- /**
29612
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29613
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29614
- * halts it.
29615
- *
29616
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29617
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29618
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29619
- * vector by it (drivers without proportional drive ignore it).
29620
- *
29621
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29622
- * axis alone; an all-undefined nudge is a no-op.
29623
- */
29624
- var NavigationMoveCommandSchema = object({
29625
- pan: number().min(-1).max(1).optional(),
29626
- tilt: number().min(-1).max(1).optional(),
29627
- speed: number().min(0).max(1).optional()
29628
- });
29629
- /**
29630
- * The enumerated discrete actions a navigation-capable robot can perform via
29631
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29632
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29633
- * `playSound` (see the `sound` dictionary entries).
29634
- */
29635
- var NavigationActionIdSchema = _enum([
29636
- "goHome",
29637
- "locate",
29638
- "spotClean",
29639
- "findPet",
29640
- "personFollow",
29641
- "stop",
29642
- "startClean",
29643
- "pauseClean",
29644
- "dockWash",
29645
- "autoEmpty",
29646
- "flashOn",
29647
- "flashOff"
29648
- ]);
29649
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29650
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29651
- /**
29652
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29653
- * native panel and the PTZ mimic render as a button.
29654
- *
29655
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29656
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29657
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29658
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29659
- * - `label` — operator-facing English label.
29660
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29661
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29662
- * PTZ render ONLY enabled entries. Data-driven: the provider
29663
- * flips it from config, never by editing code.
29664
- */
29665
- var NavigationActionEntrySchema = object({
29666
- id: string(),
29667
- kind: NavigationEntryKindSchema,
29668
- label: string(),
29669
- icon: string(),
29670
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29671
- soundId: number().int().optional(),
29672
- /** Per-device feature flag — render this entry only when true. */
29673
- enabled: boolean()
29674
- });
29675
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29676
- var NavigationPointSchema = object({
29677
- x: number(),
29678
- y: number()
29679
- });
29680
- /**
29681
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29682
- * The cap reports which are enabled so the UI / PTZ render only the controls
29683
- * that are turned on for THIS device. Data-driven: the provider derives these
29684
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29685
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29686
- * that are not dictionary entries.
29687
- *
29688
- * - `move` / `stop` — the momentary drive joystick.
29689
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29690
- * map-coordinate plumbing is wired.
29691
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29692
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29693
- * - `light` — the on/off fill-light toggle (works anytime).
29694
- * - `lightMode` — the auto/manual selector + manual level slider (a
29695
- * camera-service control; needs an active stream).
29696
- */
29697
- var NavigationFeaturesSchema = object({
29698
- move: boolean(),
29699
- stop: boolean(),
29700
- goToPoint: boolean(),
29701
- runAction: boolean(),
29702
- playSound: boolean(),
29703
- light: boolean(),
29704
- lightMode: boolean()
29705
- });
29706
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29707
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29708
- /**
29709
- * Live navigation state so the UI can reflect what the robot is doing:
29710
- * - `mode` — coarse activity (idle / cleaning / following / …).
29711
- * - `following` — person/pet follow is currently armed.
29712
- * - `flash` — the on-camera fill light is on.
29713
- * - `lightMode` — auto vs manual fill-light mode.
29714
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29715
- * `lightMode === 'manual'`.
29716
- */
29717
- var NavigationStatusSchema = object({
29718
- mode: _enum([
29719
- "idle",
29720
- "cleaning",
29721
- "spot",
29722
- "following",
29723
- "goto",
29724
- "returning",
29725
- "paused",
29726
- "unknown"
29727
- ]),
29728
- following: boolean(),
29729
- flash: boolean(),
29730
- lightMode: NavigationLightModeSchema,
29731
- lightLevel: number().min(40).max(100),
29732
- /** Ms epoch when the slice was last updated. */
29733
- lastChangedAt: number()
29734
- });
29735
- /**
29736
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29737
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29738
- * convention.
29739
- */
29740
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29741
- var navigationCapability = {
29742
- name: "navigation",
29743
- scope: "device",
29744
- deviceNative: true,
29745
- mode: "singleton",
29746
- deviceTypes: [DeviceType.Camera],
29747
- deviceConfig: { ui: {
29748
- kind: "widget",
29749
- widgetId: "host/navigation-panel",
29750
- tab: "navigation",
29751
- topTab: true,
29752
- label: "Navigation",
29753
- order: 0
29754
- } },
29755
- methods: {
29756
- /**
29757
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29758
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29759
- * path) works for any authenticated user, not admin-only. The UI sends
29760
- * these at ~1 Hz while a control is held; the provider forwards each one to
29761
- * a single drive write WITHOUT debouncing.
29762
- */
29763
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29764
- /** Halt all motion immediately (zero drive vector). */
29765
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29766
- /** Send the robot to a point on its live map. */
29767
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29768
- /**
29769
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29770
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29771
- */
29772
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29773
- /**
29774
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29775
- * unsupported action ids are rejected by the provider.
29776
- */
29777
- runAction: method(object({
29778
- deviceId: number(),
29779
- actionId: NavigationActionIdSchema
29780
- }), _void(), { kind: "mutation" }),
29781
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29782
- playSound: method(object({
29783
- deviceId: number(),
29784
- soundId: number().int()
29785
- }), _void(), { kind: "mutation" }),
29786
- /**
29787
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29788
- * works anytime, no active stream required).
29789
- */
29790
- setLightOn: method(object({
29791
- deviceId: number(),
29792
- on: boolean()
29793
- }), _void(), { kind: "mutation" }),
29794
- /**
29795
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29796
- * initial `level`. The auto/manual + level control is a CAMERA-service
29797
- * action that generally needs an active camera stream/monitor session — the
29798
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29799
- */
29800
- setLightMode: method(object({
29801
- deviceId: number(),
29802
- mode: NavigationLightModeSchema,
29803
- level: number().min(40).max(100).optional()
29804
- }), _void(), { kind: "mutation" }),
29805
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29806
- setLightLevel: method(object({
29807
- deviceId: number(),
29808
- level: number().min(40).max(100)
29809
- }), _void(), { kind: "mutation" }),
29810
- /**
29811
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29812
- * controls the UI shows (the per-entry flags for the dictionary come back on
29813
- * `listActions`).
29814
- */
29815
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29816
- },
29817
- events: { onStatusChanged: { data: object({
29818
- deviceId: number(),
29819
- status: NavigationStatusSchema
29820
- }) } },
29821
- status: {
29822
- schema: NavigationStatusSchema,
29823
- kind: "push"
29824
- },
29825
- /**
29826
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29827
- * for live mode / follow / flash changes.
29828
- */
29829
- runtimeState: NavigationRuntimeStateSchema,
29830
- /**
29831
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29832
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29833
- * that. The live handle re-publishes on connect.
29834
- *
29835
- * See `RuntimeStateDurability`. Enforced by
29836
- * `scripts/check-runtime-state-durability.ts`.
29837
- */
29838
- durability: "session"
29839
- };
29840
- /**
29841
29964
  * reboot — device-scoped capability for "soft" device reboots (firmware
29842
29965
  * reboot via vendor protocol; cameras, NVRs, doorbells). Surfaces a
29843
29966
  * single mutation so the UI can offer a confirm-and-reboot button for
@@ -39755,6 +39878,12 @@ Object.freeze({
39755
39878
  addonId: null,
39756
39879
  access: "view"
39757
39880
  },
39881
+ "storage.listDrainProgress": {
39882
+ capName: "storage",
39883
+ capScope: "system",
39884
+ addonId: null,
39885
+ access: "view"
39886
+ },
39758
39887
  "storage.listLocationDeclarations": {
39759
39888
  capName: "storage",
39760
39889
  capScope: "system",
@@ -39899,6 +40028,12 @@ Object.freeze({
39899
40028
  addonId: null,
39900
40029
  access: "view"
39901
40030
  },
40031
+ "storageOccupancy.getOccupancy": {
40032
+ capName: "storage-occupancy",
40033
+ capScope: "system",
40034
+ addonId: null,
40035
+ access: "view"
40036
+ },
39902
40037
  "storageProvider.abortUpload": {
39903
40038
  capName: "storage-provider",
39904
40039
  capScope: "system",