@camstack/addon-provider-dreo 0.2.79 → 0.2.80

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
@@ -35,7 +35,7 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
35
35
  //#endregion
36
36
  let crypto$1 = require("crypto");
37
37
  let events = require("events");
38
- //#region ../types/dist/event-category-zAv7pMUz.mjs
38
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -230,6 +230,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
230
230
  EventCategory["ProcessCrashed"] = "process.crashed";
231
231
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
232
232
  EventCategory["ProcessRestarted"] = "process.restarted";
233
+ /**
234
+ * The SET of storage locations changed — one was created, edited, enabled,
235
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
236
+ *
237
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
238
+ * it must also converge on its own periodic path, because a dropped event
239
+ * must not leave a node writing to yesterday's disk set forever. It exists
240
+ * because there was NO signal at all — an operator who added a second
241
+ * recordings disk in the admin UI got nothing, and the recorder kept its
242
+ * resolved locations until something else happened to re-resolve them
243
+ * (D387). Payload `StorageLocationsChangedPayload`.
244
+ */
245
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
233
246
  EventCategory["RecordingStarted"] = "recording.started";
234
247
  EventCategory["RecordingStopped"] = "recording.stopped";
235
248
  EventCategory["RecordingError"] = "recording.error";
@@ -8572,6 +8585,21 @@ var StorageCleanupJobSchema = object({
8572
8585
  });
8573
8586
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8574
8587
  /**
8588
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8589
+ * alias below is `z.infer<>` of it, never a second spelling.
8590
+ */
8591
+ var StorageLocationModeSchema = _enum([
8592
+ "active",
8593
+ "readonly",
8594
+ "drain",
8595
+ "disabled"
8596
+ ]);
8597
+ _enum([
8598
+ "normal",
8599
+ "never",
8600
+ "drain"
8601
+ ]);
8602
+ /**
8575
8603
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8576
8604
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8577
8605
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8637,6 +8665,21 @@ var StorageLocationSchema = object({
8637
8665
  * stops existing rather than being re-derived on every read.
8638
8666
  */
8639
8667
  enabled: boolean().optional(),
8668
+ /**
8669
+ * THE state of this location (D385), and the only authority on what may be
8670
+ * written, read or evicted here. Interpreted in exactly one place —
8671
+ * `storage-location-mode.ts` — which also folds the legacy
8672
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8673
+ * ambiguous.
8674
+ *
8675
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8676
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8677
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8678
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8679
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8680
+ * either, so the two cannot disagree.
8681
+ */
8682
+ mode: StorageLocationModeSchema.optional(),
8640
8683
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8641
8684
  * for node-local locations it can reach) — never persisted, absent when the
8642
8685
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8644,11 +8687,46 @@ var StorageLocationSchema = object({
8644
8687
  totalBytes: number(),
8645
8688
  availableBytes: number()
8646
8689
  }).nullable().optional(),
8690
+ /**
8691
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8692
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8693
+ * never persisted, never a filesystem walk.
8694
+ *
8695
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8696
+ * location yet — nobody stores here, the owning addon is down, or the first
8697
+ * refresh has not completed. A UI must omit the segment rather than draw it
8698
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8699
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8700
+ * be spelled out loud instead of appearing by accident.
8701
+ *
8702
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8703
+ * about the whole figure rather than about its freshest part.
8704
+ */
8705
+ owned: object({
8706
+ bytes: number().int().nonnegative(),
8707
+ measuredAtMs: number().int().nonnegative()
8708
+ }).optional(),
8647
8709
  createdAt: number(),
8648
8710
  updatedAt: number()
8649
8711
  });
8650
8712
  object({ isDefault: boolean().optional() });
8651
8713
  /**
8714
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8715
+ *
8716
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8717
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8718
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8719
+ * operator learns not to believe the screen.
8720
+ */
8721
+ var StorageDrainProgressSchema = object({
8722
+ locationId: string(),
8723
+ startedAtMs: number(),
8724
+ startBytes: number(),
8725
+ bytesRemaining: number(),
8726
+ drained: boolean(),
8727
+ estimatedEmptyAtMs: number().nullable()
8728
+ });
8729
+ /**
8652
8730
  * Reference accepted by consumer-facing `api.storage.*` calls.
8653
8731
  * Either:
8654
8732
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -21994,7 +22072,7 @@ method(object({
21994
22072
  }), _void(), {
21995
22073
  kind: "mutation",
21996
22074
  auth: "admin"
21997
- }), method(object({ id: string() }), object({
22075
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
21998
22076
  ok: boolean(),
21999
22077
  error: string().optional()
22000
22078
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22064,6 +22142,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22064
22142
  kind: "mutation",
22065
22143
  auth: "admin"
22066
22144
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22145
+ /**
22146
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22147
+ * location (D388).
22148
+ *
22149
+ * ## Why this is not `storage-evictable`
22150
+ *
22151
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22152
+ * not, in two ways that both matter and both bite hardest on the locations an
22153
+ * operator most wants a figure for:
22154
+ *
22155
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22156
+ * and `recordingsLow:default` deliberately share one root and evict as one
22157
+ * oldest-first pool, so both answer with the SAME combined total. As an
22158
+ * occupancy figure that double-counts the disk.
22159
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22160
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22161
+ * is retiring and staring at.
22162
+ *
22163
+ * So this is its own contract with its own quantity, and the quantity is
22164
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22165
+ * would ever be willing to delete it. A provider that can only answer
22166
+ * "evictable" must not register here — a number that silently means different
22167
+ * things per class is worse than no number.
22168
+ *
22169
+ * ## Absence is an answer
22170
+ *
22171
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22172
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22173
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22174
+ * consuming side has to be written out loud instead of appearing by accident.
22175
+ *
22176
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22177
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22178
+ */
22179
+ /** One provider's occupancy answer for one location. */
22180
+ var StorageOccupancyReportSchema = object({
22181
+ locationId: string(),
22182
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22183
+ * not net of what it is willing to delete. */
22184
+ ownedBytes: number().int().nonnegative(),
22185
+ /** When the provider last actually measured this. The orchestrator carries it
22186
+ * through so a UI can say how old the figure is instead of implying "now". */
22187
+ measuredAtMs: number().int().nonnegative()
22188
+ });
22189
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22067
22190
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22068
22191
  providerId: string().min(1),
22069
22192
  displayName: string().min(1),
@@ -23899,88 +24022,6 @@ onStatusChanged: { data: object({
23899
24022
  volatileStateFields: ["lastUpdated"]
23900
24023
  };
23901
24024
  /**
23902
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23903
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23904
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23905
- * one Home Assistant projection.
23906
- */
23907
- var NetworkLinkStatusSchema = object({
23908
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23909
- type: _enum([
23910
- "wifi",
23911
- "ethernet",
23912
- "cellular",
23913
- "unknown"
23914
- ]),
23915
- /**
23916
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23917
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23918
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23919
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23920
- * SKIP a null rather than coerce it.
23921
- */
23922
- signalPercent: number().min(0).max(100).nullable(),
23923
- /** Raw received signal strength in dBm, when the firmware reports one. */
23924
- rssiDbm: number().optional(),
23925
- /** Network name of a wireless link, when the firmware reports it. */
23926
- ssid: string().optional(),
23927
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23928
- lastUpdated: number()
23929
- });
23930
- var networkLinkCapability = {
23931
- name: "network-link",
23932
- scope: "device",
23933
- deviceNative: true,
23934
- mode: "singleton",
23935
- deviceTypes: [
23936
- DeviceType.Camera,
23937
- DeviceType.Sensor,
23938
- DeviceType.Button,
23939
- DeviceType.Switch,
23940
- DeviceType.Light,
23941
- DeviceType.Lock,
23942
- DeviceType.Siren
23943
- ],
23944
- methods: {},
23945
- events: {
23946
- /**
23947
- * Emitted whenever the cached status changes (a link switch, a signal
23948
- * reading that moved). Mirrored on the parent chain by the
23949
- * DeviceEventPropagator like `battery.onStatusChanged`.
23950
- */
23951
- onStatusChanged: { data: object({
23952
- deviceId: number(),
23953
- status: NetworkLinkStatusSchema
23954
- }) } },
23955
- status: {
23956
- schema: NetworkLinkStatusSchema,
23957
- kind: "push",
23958
- empty: {
23959
- type: "unknown",
23960
- signalPercent: null,
23961
- lastUpdated: 0
23962
- }
23963
- },
23964
- /**
23965
- * Runtime-state slice — every provider stores the same shape under
23966
- * `device.runtimeState['network-link']`, read once by the badge and the
23967
- * Home Assistant projector regardless of the driver.
23968
- */
23969
- runtimeState: NetworkLinkStatusSchema,
23970
- /**
23971
- * Runtime-state durability: **restored** — a link reading is slow to
23972
- * change and a sleeping battery camera may not report for hours; the
23973
- * restored slice is what the badge shows until the next read.
23974
- *
23975
- * See `RuntimeStateDurability`. Enforced by
23976
- * `scripts/check-runtime-state-durability.ts`.
23977
- */
23978
- durability: "restored",
23979
- /** Clock fields: written, but excluded from the compare that decides
23980
- * whether persisting is worth a SQLite commit. */
23981
- volatileStateFields: ["lastUpdated"]
23982
- };
23983
- /**
23984
24025
  * Generic boolean sensor — last-resort fallback when no domain-
23985
24026
  * specific binary cap fits (Home Assistant `binary_sensor` without a
23986
24027
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27518,6 +27559,369 @@ var nativeObjectDetectionCapability = {
27518
27559
  volatileStateFields: ["lastFetchedAt"]
27519
27560
  };
27520
27561
  /**
27562
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27563
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27564
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27565
+ *
27566
+ * Why a NEW cap rather than overloading `ptz`:
27567
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27568
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27569
+ * The two are different physical models: PTZ is absolute-position + presets,
27570
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27571
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27572
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27573
+ * the reverse:
27574
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27575
+ * / `getOptions`), and
27576
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27577
+ * robot camera shows up in the existing PTZ control path without every
27578
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27579
+ * not here (see the addon design note):
27580
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27581
+ * ptz.stop() → navigation.stop()
27582
+ * ptz.goHome() → navigation.runAction('goHome')
27583
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27584
+ * ptz.goToPreset(id) → navigation.runAction(id)
27585
+ *
27586
+ * ## Continuous drive
27587
+ *
27588
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27589
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27590
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27591
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27592
+ * coalesce them. The UI owns the cadence.
27593
+ *
27594
+ * ## The action dictionary
27595
+ *
27596
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27597
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27598
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27599
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27600
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27601
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27602
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27603
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27604
+ *
27605
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27606
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27607
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27608
+ * every device handle. A future nodedreame publish adds a typed
27609
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27610
+ * provider can then swap the raw calls for the typed methods with no change to
27611
+ * THIS contract.
27612
+ */
27613
+ /**
27614
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27615
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27616
+ * halts it.
27617
+ *
27618
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27619
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27620
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27621
+ * vector by it (drivers without proportional drive ignore it).
27622
+ *
27623
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27624
+ * axis alone; an all-undefined nudge is a no-op.
27625
+ */
27626
+ var NavigationMoveCommandSchema = object({
27627
+ pan: number().min(-1).max(1).optional(),
27628
+ tilt: number().min(-1).max(1).optional(),
27629
+ speed: number().min(0).max(1).optional()
27630
+ });
27631
+ /**
27632
+ * The enumerated discrete actions a navigation-capable robot can perform via
27633
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27634
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27635
+ * `playSound` (see the `sound` dictionary entries).
27636
+ */
27637
+ var NavigationActionIdSchema = _enum([
27638
+ "goHome",
27639
+ "locate",
27640
+ "spotClean",
27641
+ "findPet",
27642
+ "personFollow",
27643
+ "stop",
27644
+ "startClean",
27645
+ "pauseClean",
27646
+ "dockWash",
27647
+ "autoEmpty",
27648
+ "flashOn",
27649
+ "flashOff"
27650
+ ]);
27651
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27652
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27653
+ /**
27654
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27655
+ * native panel and the PTZ mimic render as a button.
27656
+ *
27657
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27658
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27659
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27660
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27661
+ * - `label` — operator-facing English label.
27662
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27663
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27664
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27665
+ * flips it from config, never by editing code.
27666
+ */
27667
+ var NavigationActionEntrySchema = object({
27668
+ id: string(),
27669
+ kind: NavigationEntryKindSchema,
27670
+ label: string(),
27671
+ icon: string(),
27672
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27673
+ soundId: number().int().optional(),
27674
+ /** Per-device feature flag — render this entry only when true. */
27675
+ enabled: boolean()
27676
+ });
27677
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27678
+ var NavigationPointSchema = object({
27679
+ x: number(),
27680
+ y: number()
27681
+ });
27682
+ /**
27683
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27684
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27685
+ * that are turned on for THIS device. Data-driven: the provider derives these
27686
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27687
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27688
+ * that are not dictionary entries.
27689
+ *
27690
+ * - `move` / `stop` — the momentary drive joystick.
27691
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27692
+ * map-coordinate plumbing is wired.
27693
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27694
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27695
+ * - `light` — the on/off fill-light toggle (works anytime).
27696
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27697
+ * camera-service control; needs an active stream).
27698
+ */
27699
+ var NavigationFeaturesSchema = object({
27700
+ move: boolean(),
27701
+ stop: boolean(),
27702
+ goToPoint: boolean(),
27703
+ runAction: boolean(),
27704
+ playSound: boolean(),
27705
+ light: boolean(),
27706
+ lightMode: boolean()
27707
+ });
27708
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27709
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27710
+ /**
27711
+ * Live navigation state so the UI can reflect what the robot is doing:
27712
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27713
+ * - `following` — person/pet follow is currently armed.
27714
+ * - `flash` — the on-camera fill light is on.
27715
+ * - `lightMode` — auto vs manual fill-light mode.
27716
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27717
+ * `lightMode === 'manual'`.
27718
+ */
27719
+ var NavigationStatusSchema = object({
27720
+ mode: _enum([
27721
+ "idle",
27722
+ "cleaning",
27723
+ "spot",
27724
+ "following",
27725
+ "goto",
27726
+ "returning",
27727
+ "paused",
27728
+ "unknown"
27729
+ ]),
27730
+ following: boolean(),
27731
+ flash: boolean(),
27732
+ lightMode: NavigationLightModeSchema,
27733
+ lightLevel: number().min(40).max(100),
27734
+ /** Ms epoch when the slice was last updated. */
27735
+ lastChangedAt: number()
27736
+ });
27737
+ /**
27738
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27739
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27740
+ * convention.
27741
+ */
27742
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27743
+ var navigationCapability = {
27744
+ name: "navigation",
27745
+ scope: "device",
27746
+ deviceNative: true,
27747
+ mode: "singleton",
27748
+ deviceTypes: [DeviceType.Camera],
27749
+ deviceConfig: { ui: {
27750
+ kind: "widget",
27751
+ widgetId: "host/navigation-panel",
27752
+ tab: "navigation",
27753
+ topTab: true,
27754
+ label: "Navigation",
27755
+ order: 0
27756
+ } },
27757
+ methods: {
27758
+ /**
27759
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27760
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27761
+ * path) works for any authenticated user, not admin-only. The UI sends
27762
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27763
+ * a single drive write WITHOUT debouncing.
27764
+ */
27765
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27766
+ /** Halt all motion immediately (zero drive vector). */
27767
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27768
+ /** Send the robot to a point on its live map. */
27769
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27770
+ /**
27771
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27772
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27773
+ */
27774
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27775
+ /**
27776
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27777
+ * unsupported action ids are rejected by the provider.
27778
+ */
27779
+ runAction: method(object({
27780
+ deviceId: number(),
27781
+ actionId: NavigationActionIdSchema
27782
+ }), _void(), { kind: "mutation" }),
27783
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27784
+ playSound: method(object({
27785
+ deviceId: number(),
27786
+ soundId: number().int()
27787
+ }), _void(), { kind: "mutation" }),
27788
+ /**
27789
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27790
+ * works anytime, no active stream required).
27791
+ */
27792
+ setLightOn: method(object({
27793
+ deviceId: number(),
27794
+ on: boolean()
27795
+ }), _void(), { kind: "mutation" }),
27796
+ /**
27797
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27798
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27799
+ * action that generally needs an active camera stream/monitor session — the
27800
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27801
+ */
27802
+ setLightMode: method(object({
27803
+ deviceId: number(),
27804
+ mode: NavigationLightModeSchema,
27805
+ level: number().min(40).max(100).optional()
27806
+ }), _void(), { kind: "mutation" }),
27807
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27808
+ setLightLevel: method(object({
27809
+ deviceId: number(),
27810
+ level: number().min(40).max(100)
27811
+ }), _void(), { kind: "mutation" }),
27812
+ /**
27813
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27814
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27815
+ * `listActions`).
27816
+ */
27817
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27818
+ },
27819
+ events: { onStatusChanged: { data: object({
27820
+ deviceId: number(),
27821
+ status: NavigationStatusSchema
27822
+ }) } },
27823
+ status: {
27824
+ schema: NavigationStatusSchema,
27825
+ kind: "push"
27826
+ },
27827
+ /**
27828
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27829
+ * for live mode / follow / flash changes.
27830
+ */
27831
+ runtimeState: NavigationRuntimeStateSchema,
27832
+ /**
27833
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27834
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27835
+ * that. The live handle re-publishes on connect.
27836
+ *
27837
+ * See `RuntimeStateDurability`. Enforced by
27838
+ * `scripts/check-runtime-state-durability.ts`.
27839
+ */
27840
+ durability: "session"
27841
+ };
27842
+ /**
27843
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27844
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27845
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27846
+ * one Home Assistant projection.
27847
+ */
27848
+ var NetworkLinkStatusSchema = object({
27849
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27850
+ type: _enum([
27851
+ "wifi",
27852
+ "ethernet",
27853
+ "cellular",
27854
+ "unknown"
27855
+ ]),
27856
+ /**
27857
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27858
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27859
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27860
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27861
+ * SKIP a null rather than coerce it.
27862
+ */
27863
+ signalPercent: number().min(0).max(100).nullable(),
27864
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27865
+ rssiDbm: number().optional(),
27866
+ /** Network name of a wireless link, when the firmware reports it. */
27867
+ ssid: string().optional(),
27868
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27869
+ lastUpdated: number()
27870
+ });
27871
+ var networkLinkCapability = {
27872
+ name: "network-link",
27873
+ scope: "device",
27874
+ deviceNative: true,
27875
+ mode: "singleton",
27876
+ deviceTypes: [
27877
+ DeviceType.Camera,
27878
+ DeviceType.Sensor,
27879
+ DeviceType.Button,
27880
+ DeviceType.Switch,
27881
+ DeviceType.Light,
27882
+ DeviceType.Lock,
27883
+ DeviceType.Siren
27884
+ ],
27885
+ methods: {},
27886
+ events: {
27887
+ /**
27888
+ * Emitted whenever the cached status changes (a link switch, a signal
27889
+ * reading that moved). Mirrored on the parent chain by the
27890
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27891
+ */
27892
+ onStatusChanged: { data: object({
27893
+ deviceId: number(),
27894
+ status: NetworkLinkStatusSchema
27895
+ }) } },
27896
+ status: {
27897
+ schema: NetworkLinkStatusSchema,
27898
+ kind: "push",
27899
+ empty: {
27900
+ type: "unknown",
27901
+ signalPercent: null,
27902
+ lastUpdated: 0
27903
+ }
27904
+ },
27905
+ /**
27906
+ * Runtime-state slice — every provider stores the same shape under
27907
+ * `device.runtimeState['network-link']`, read once by the badge and the
27908
+ * Home Assistant projector regardless of the driver.
27909
+ */
27910
+ runtimeState: NetworkLinkStatusSchema,
27911
+ /**
27912
+ * Runtime-state durability: **restored** — a link reading is slow to
27913
+ * change and a sleeping battery camera may not report for hours; the
27914
+ * restored slice is what the badge shows until the next read.
27915
+ *
27916
+ * See `RuntimeStateDurability`. Enforced by
27917
+ * `scripts/check-runtime-state-durability.ts`.
27918
+ */
27919
+ durability: "restored",
27920
+ /** Clock fields: written, but excluded from the compare that decides
27921
+ * whether persisting is worth a SQLite commit. */
27922
+ volatileStateFields: ["lastUpdated"]
27923
+ };
27924
+ /**
27521
27925
  * network-quality — system-scoped singleton capability tracking RTT,
27522
27926
  * jitter, and observed/peak bandwidth per device + per client.
27523
27927
  *
@@ -29098,287 +29502,6 @@ var ptzAutotrackCapability = {
29098
29502
  */
29099
29503
  durability: "session"
29100
29504
  };
29101
- /**
29102
- * `navigation` — a device-scoped capability that natively expresses the FULL
29103
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29104
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29105
- *
29106
- * Why a NEW cap rather than overloading `ptz`:
29107
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29108
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29109
- * The two are different physical models: PTZ is absolute-position + presets,
29110
- * navigation is momentary drive nudges + discrete robot ACTIONS
29111
- * (dock / spot-clean / follow-pet / go-to-point / …).
29112
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29113
- * the reverse:
29114
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29115
- * / `getOptions`), and
29116
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29117
- * robot camera shows up in the existing PTZ control path without every
29118
- * PTZ provider learning about robots. The mapping lives in the adapter,
29119
- * not here (see the addon design note):
29120
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29121
- * ptz.stop() → navigation.stop()
29122
- * ptz.goHome() → navigation.runAction('goHome')
29123
- * ptz.getPresets() → navigation.listActions() (id→preset)
29124
- * ptz.goToPreset(id) → navigation.runAction(id)
29125
- *
29126
- * ## Continuous drive
29127
- *
29128
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29129
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29130
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29131
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29132
- * coalesce them. The UI owns the cadence.
29133
- *
29134
- * ## The action dictionary
29135
- *
29136
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29137
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29138
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29139
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29140
- * vendor-specific list. `kind: 'action'` entries are triggered with
29141
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29142
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29143
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29144
- *
29145
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29146
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29147
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29148
- * every device handle. A future nodedreame publish adds a typed
29149
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29150
- * provider can then swap the raw calls for the typed methods with no change to
29151
- * THIS contract.
29152
- */
29153
- /**
29154
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29155
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29156
- * halts it.
29157
- *
29158
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29159
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29160
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29161
- * vector by it (drivers without proportional drive ignore it).
29162
- *
29163
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29164
- * axis alone; an all-undefined nudge is a no-op.
29165
- */
29166
- var NavigationMoveCommandSchema = object({
29167
- pan: number().min(-1).max(1).optional(),
29168
- tilt: number().min(-1).max(1).optional(),
29169
- speed: number().min(0).max(1).optional()
29170
- });
29171
- /**
29172
- * The enumerated discrete actions a navigation-capable robot can perform via
29173
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29174
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29175
- * `playSound` (see the `sound` dictionary entries).
29176
- */
29177
- var NavigationActionIdSchema = _enum([
29178
- "goHome",
29179
- "locate",
29180
- "spotClean",
29181
- "findPet",
29182
- "personFollow",
29183
- "stop",
29184
- "startClean",
29185
- "pauseClean",
29186
- "dockWash",
29187
- "autoEmpty",
29188
- "flashOn",
29189
- "flashOff"
29190
- ]);
29191
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29192
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29193
- /**
29194
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29195
- * native panel and the PTZ mimic render as a button.
29196
- *
29197
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29198
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29199
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29200
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29201
- * - `label` — operator-facing English label.
29202
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29203
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29204
- * PTZ render ONLY enabled entries. Data-driven: the provider
29205
- * flips it from config, never by editing code.
29206
- */
29207
- var NavigationActionEntrySchema = object({
29208
- id: string(),
29209
- kind: NavigationEntryKindSchema,
29210
- label: string(),
29211
- icon: string(),
29212
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29213
- soundId: number().int().optional(),
29214
- /** Per-device feature flag — render this entry only when true. */
29215
- enabled: boolean()
29216
- });
29217
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29218
- var NavigationPointSchema = object({
29219
- x: number(),
29220
- y: number()
29221
- });
29222
- /**
29223
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29224
- * The cap reports which are enabled so the UI / PTZ render only the controls
29225
- * that are turned on for THIS device. Data-driven: the provider derives these
29226
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29227
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29228
- * that are not dictionary entries.
29229
- *
29230
- * - `move` / `stop` — the momentary drive joystick.
29231
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29232
- * map-coordinate plumbing is wired.
29233
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29234
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29235
- * - `light` — the on/off fill-light toggle (works anytime).
29236
- * - `lightMode` — the auto/manual selector + manual level slider (a
29237
- * camera-service control; needs an active stream).
29238
- */
29239
- var NavigationFeaturesSchema = object({
29240
- move: boolean(),
29241
- stop: boolean(),
29242
- goToPoint: boolean(),
29243
- runAction: boolean(),
29244
- playSound: boolean(),
29245
- light: boolean(),
29246
- lightMode: boolean()
29247
- });
29248
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29249
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29250
- /**
29251
- * Live navigation state so the UI can reflect what the robot is doing:
29252
- * - `mode` — coarse activity (idle / cleaning / following / …).
29253
- * - `following` — person/pet follow is currently armed.
29254
- * - `flash` — the on-camera fill light is on.
29255
- * - `lightMode` — auto vs manual fill-light mode.
29256
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29257
- * `lightMode === 'manual'`.
29258
- */
29259
- var NavigationStatusSchema = object({
29260
- mode: _enum([
29261
- "idle",
29262
- "cleaning",
29263
- "spot",
29264
- "following",
29265
- "goto",
29266
- "returning",
29267
- "paused",
29268
- "unknown"
29269
- ]),
29270
- following: boolean(),
29271
- flash: boolean(),
29272
- lightMode: NavigationLightModeSchema,
29273
- lightLevel: number().min(40).max(100),
29274
- /** Ms epoch when the slice was last updated. */
29275
- lastChangedAt: number()
29276
- });
29277
- /**
29278
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29279
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29280
- * convention.
29281
- */
29282
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29283
- var navigationCapability = {
29284
- name: "navigation",
29285
- scope: "device",
29286
- deviceNative: true,
29287
- mode: "singleton",
29288
- deviceTypes: [DeviceType.Camera],
29289
- deviceConfig: { ui: {
29290
- kind: "widget",
29291
- widgetId: "host/navigation-panel",
29292
- tab: "navigation",
29293
- topTab: true,
29294
- label: "Navigation",
29295
- order: 0
29296
- } },
29297
- methods: {
29298
- /**
29299
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29300
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29301
- * path) works for any authenticated user, not admin-only. The UI sends
29302
- * these at ~1 Hz while a control is held; the provider forwards each one to
29303
- * a single drive write WITHOUT debouncing.
29304
- */
29305
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29306
- /** Halt all motion immediately (zero drive vector). */
29307
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29308
- /** Send the robot to a point on its live map. */
29309
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29310
- /**
29311
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29312
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29313
- */
29314
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29315
- /**
29316
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29317
- * unsupported action ids are rejected by the provider.
29318
- */
29319
- runAction: method(object({
29320
- deviceId: number(),
29321
- actionId: NavigationActionIdSchema
29322
- }), _void(), { kind: "mutation" }),
29323
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29324
- playSound: method(object({
29325
- deviceId: number(),
29326
- soundId: number().int()
29327
- }), _void(), { kind: "mutation" }),
29328
- /**
29329
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29330
- * works anytime, no active stream required).
29331
- */
29332
- setLightOn: method(object({
29333
- deviceId: number(),
29334
- on: boolean()
29335
- }), _void(), { kind: "mutation" }),
29336
- /**
29337
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29338
- * initial `level`. The auto/manual + level control is a CAMERA-service
29339
- * action that generally needs an active camera stream/monitor session — the
29340
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29341
- */
29342
- setLightMode: method(object({
29343
- deviceId: number(),
29344
- mode: NavigationLightModeSchema,
29345
- level: number().min(40).max(100).optional()
29346
- }), _void(), { kind: "mutation" }),
29347
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29348
- setLightLevel: method(object({
29349
- deviceId: number(),
29350
- level: number().min(40).max(100)
29351
- }), _void(), { kind: "mutation" }),
29352
- /**
29353
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29354
- * controls the UI shows (the per-entry flags for the dictionary come back on
29355
- * `listActions`).
29356
- */
29357
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29358
- },
29359
- events: { onStatusChanged: { data: object({
29360
- deviceId: number(),
29361
- status: NavigationStatusSchema
29362
- }) } },
29363
- status: {
29364
- schema: NavigationStatusSchema,
29365
- kind: "push"
29366
- },
29367
- /**
29368
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29369
- * for live mode / follow / flash changes.
29370
- */
29371
- runtimeState: NavigationRuntimeStateSchema,
29372
- /**
29373
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29374
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29375
- * that. The live handle re-publishes on connect.
29376
- *
29377
- * See `RuntimeStateDurability`. Enforced by
29378
- * `scripts/check-runtime-state-durability.ts`.
29379
- */
29380
- durability: "session"
29381
- };
29382
29505
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29383
29506
  kind: "mutation",
29384
29507
  auth: "admin"
@@ -38841,6 +38964,12 @@ Object.freeze({
38841
38964
  addonId: null,
38842
38965
  access: "view"
38843
38966
  },
38967
+ "storage.listDrainProgress": {
38968
+ capName: "storage",
38969
+ capScope: "system",
38970
+ addonId: null,
38971
+ access: "view"
38972
+ },
38844
38973
  "storage.listLocationDeclarations": {
38845
38974
  capName: "storage",
38846
38975
  capScope: "system",
@@ -38985,6 +39114,12 @@ Object.freeze({
38985
39114
  addonId: null,
38986
39115
  access: "view"
38987
39116
  },
39117
+ "storageOccupancy.getOccupancy": {
39118
+ capName: "storage-occupancy",
39119
+ capScope: "system",
39120
+ addonId: null,
39121
+ access: "view"
39122
+ },
38988
39123
  "storageProvider.abortUpload": {
38989
39124
  capName: "storage-provider",
38990
39125
  capScope: "system",