@camstack/addon-provider-dreame 0.2.79 → 0.2.81

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 +667 -515
  2. package/dist/addon.mjs +667 -515
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -52669,7 +52669,7 @@ var DreameCameraStream = class extends TypedEmitter {
52669
52669
  }
52670
52670
  };
52671
52671
  //#endregion
52672
- //#region ../types/dist/event-category-zAv7pMUz.mjs
52672
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
52673
52673
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
52674
52674
  EventCategory["SystemBoot"] = "system.boot";
52675
52675
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -52864,6 +52864,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
52864
52864
  EventCategory["ProcessCrashed"] = "process.crashed";
52865
52865
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
52866
52866
  EventCategory["ProcessRestarted"] = "process.restarted";
52867
+ /**
52868
+ * The SET of storage locations changed — one was created, edited, enabled,
52869
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
52870
+ *
52871
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
52872
+ * it must also converge on its own periodic path, because a dropped event
52873
+ * must not leave a node writing to yesterday's disk set forever. It exists
52874
+ * because there was NO signal at all — an operator who added a second
52875
+ * recordings disk in the admin UI got nothing, and the recorder kept its
52876
+ * resolved locations until something else happened to re-resolve them
52877
+ * (D387). Payload `StorageLocationsChangedPayload`.
52878
+ */
52879
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
52867
52880
  EventCategory["RecordingStarted"] = "recording.started";
52868
52881
  EventCategory["RecordingStopped"] = "recording.stopped";
52869
52882
  EventCategory["RecordingError"] = "recording.error";
@@ -61206,6 +61219,21 @@ var StorageCleanupJobSchema = object({
61206
61219
  });
61207
61220
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
61208
61221
  /**
61222
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
61223
+ * alias below is `z.infer<>` of it, never a second spelling.
61224
+ */
61225
+ var StorageLocationModeSchema = _enum([
61226
+ "active",
61227
+ "readonly",
61228
+ "drain",
61229
+ "disabled"
61230
+ ]);
61231
+ _enum([
61232
+ "normal",
61233
+ "never",
61234
+ "drain"
61235
+ ]);
61236
+ /**
61209
61237
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
61210
61238
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
61211
61239
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -61271,6 +61299,21 @@ var StorageLocationSchema = object({
61271
61299
  * stops existing rather than being re-derived on every read.
61272
61300
  */
61273
61301
  enabled: boolean().optional(),
61302
+ /**
61303
+ * THE state of this location (D385), and the only authority on what may be
61304
+ * written, read or evicted here. Interpreted in exactly one place —
61305
+ * `storage-location-mode.ts` — which also folds the legacy
61306
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
61307
+ * ambiguous.
61308
+ *
61309
+ * OPTIONAL only for the wire and for rows written before D385: absence is
61310
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
61311
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
61312
+ * re-derived on every read. `enabled` survives one release as a DERIVED
61313
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
61314
+ * either, so the two cannot disagree.
61315
+ */
61316
+ mode: StorageLocationModeSchema.optional(),
61274
61317
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
61275
61318
  * for node-local locations it can reach) — never persisted, absent when the
61276
61319
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -61278,11 +61321,46 @@ var StorageLocationSchema = object({
61278
61321
  totalBytes: number(),
61279
61322
  availableBytes: number()
61280
61323
  }).nullable().optional(),
61324
+ /**
61325
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
61326
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
61327
+ * never persisted, never a filesystem walk.
61328
+ *
61329
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
61330
+ * location yet — nobody stores here, the owning addon is down, or the first
61331
+ * refresh has not completed. A UI must omit the segment rather than draw it
61332
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
61333
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
61334
+ * be spelled out loud instead of appearing by accident.
61335
+ *
61336
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
61337
+ * about the whole figure rather than about its freshest part.
61338
+ */
61339
+ owned: object({
61340
+ bytes: number().int().nonnegative(),
61341
+ measuredAtMs: number().int().nonnegative()
61342
+ }).optional(),
61281
61343
  createdAt: number(),
61282
61344
  updatedAt: number()
61283
61345
  });
61284
61346
  object({ isDefault: boolean().optional() });
61285
61347
  /**
61348
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
61349
+ *
61350
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
61351
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
61352
+ * drain with no observed growth has no honest ETA, and inventing one is how an
61353
+ * operator learns not to believe the screen.
61354
+ */
61355
+ var StorageDrainProgressSchema = object({
61356
+ locationId: string(),
61357
+ startedAtMs: number(),
61358
+ startBytes: number(),
61359
+ bytesRemaining: number(),
61360
+ drained: boolean(),
61361
+ estimatedEmptyAtMs: number().nullable()
61362
+ });
61363
+ /**
61286
61364
  * Reference accepted by consumer-facing `api.storage.*` calls.
61287
61365
  * Either:
61288
61366
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -73108,8 +73186,25 @@ var occupancyRecheckFramesField = {
73108
73186
  * (analyzer attaches detected `regions[]`; onboard does not — the
73109
73187
  * camera typically only reports a binary signal plus an optional
73110
73188
  * channel/AI class which lives in dedicated event channels).
73111
- */
73112
- var MotionSourceEnum = _enum(["onboard", "analyzer"]);
73189
+ *
73190
+ * - `onboard` — the camera's firmware said something moved.
73191
+ * - `analyzer` — this runner's frame-diff said so, and attaches `regions[]`.
73192
+ * - `device-activity` — the DEVICE said it is doing its job: the
73193
+ * `recording-signal` LEVEL the same device raises for the recorder
73194
+ * ([D380](../../../../docs/decisions/adr-0380-a-device-decided-recording-is-a-mode-with-no-schedule-seeded-once.md)),
73195
+ * republished as a motion source. It attaches **nothing** — no regions, no
73196
+ * class: the only fact it carries is that the device is active, and a robot
73197
+ * vacuum that is itself the moving object has no region worth sending. It is
73198
+ * a LEVEL, so unlike `onboard` it has a real falling edge, and unlike
73199
+ * `analyzer` it must not open the frame-diff side-channel — the runner's
73200
+ * `handleOnboardMotionAnalyzer` gate is `source === 'onboard'` and stays that
73201
+ * way ([D392](../../../../docs/decisions/adr-0392-a-device-that-says-it-is-working-is-a-motion-source-of-its-own.md)).
73202
+ */
73203
+ var MotionSourceEnum = _enum([
73204
+ "onboard",
73205
+ "analyzer",
73206
+ "device-activity"
73207
+ ]);
73113
73208
  /**
73114
73209
  * List of motion sources active on a camera. Empty array is valid:
73115
73210
  * "no source" — happens for battery cams without firmware motion when
@@ -74628,7 +74723,7 @@ method(object({
74628
74723
  }), _void(), {
74629
74724
  kind: "mutation",
74630
74725
  auth: "admin"
74631
- }), method(object({ id: string() }), object({
74726
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
74632
74727
  ok: boolean(),
74633
74728
  error: string().optional()
74634
74729
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -74698,6 +74793,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
74698
74793
  kind: "mutation",
74699
74794
  auth: "admin"
74700
74795
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
74796
+ /**
74797
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
74798
+ * location (D388).
74799
+ *
74800
+ * ## Why this is not `storage-evictable`
74801
+ *
74802
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
74803
+ * not, in two ways that both matter and both bite hardest on the locations an
74804
+ * operator most wants a figure for:
74805
+ *
74806
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
74807
+ * and `recordingsLow:default` deliberately share one root and evict as one
74808
+ * oldest-first pool, so both answer with the SAME combined total. As an
74809
+ * occupancy figure that double-counts the disk.
74810
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
74811
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
74812
+ * is retiring and staring at.
74813
+ *
74814
+ * So this is its own contract with its own quantity, and the quantity is
74815
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
74816
+ * would ever be willing to delete it. A provider that can only answer
74817
+ * "evictable" must not register here — a number that silently means different
74818
+ * things per class is worse than no number.
74819
+ *
74820
+ * ## Absence is an answer
74821
+ *
74822
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
74823
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
74824
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
74825
+ * consuming side has to be written out loud instead of appearing by accident.
74826
+ *
74827
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
74828
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
74829
+ */
74830
+ /** One provider's occupancy answer for one location. */
74831
+ var StorageOccupancyReportSchema = object({
74832
+ locationId: string(),
74833
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
74834
+ * not net of what it is willing to delete. */
74835
+ ownedBytes: number().int().nonnegative(),
74836
+ /** When the provider last actually measured this. The orchestrator carries it
74837
+ * through so a UI can say how old the figure is instead of implying "now". */
74838
+ measuredAtMs: number().int().nonnegative()
74839
+ });
74840
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
74701
74841
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
74702
74842
  providerId: string().min(1),
74703
74843
  displayName: string().min(1),
@@ -76533,99 +76673,6 @@ onStatusChanged: { data: object({
76533
76673
  volatileStateFields: ["lastUpdated"]
76534
76674
  };
76535
76675
  /**
76536
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
76537
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
76538
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
76539
- * one Home Assistant projection.
76540
- */
76541
- var NetworkLinkStatusSchema = object({
76542
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
76543
- type: _enum([
76544
- "wifi",
76545
- "ethernet",
76546
- "cellular",
76547
- "unknown"
76548
- ]),
76549
- /**
76550
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
76551
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
76552
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
76553
- * one whose reading has not landed must not be drawn at 0 %. Consumers
76554
- * SKIP a null rather than coerce it.
76555
- */
76556
- signalPercent: number().min(0).max(100).nullable(),
76557
- /** Raw received signal strength in dBm, when the firmware reports one. */
76558
- rssiDbm: number().optional(),
76559
- /** Network name of a wireless link, when the firmware reports it. */
76560
- ssid: string().optional(),
76561
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
76562
- lastUpdated: number()
76563
- });
76564
- /** The slice a provider seeds before its first read: nothing is known yet. */
76565
- var NETWORK_LINK_UNKNOWN = {
76566
- type: "unknown",
76567
- signalPercent: null,
76568
- lastUpdated: 0
76569
- };
76570
- /**
76571
- * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
76572
- * Out-of-range or non-finite input is not a reading: `null`.
76573
- */
76574
- function signalPercentFromBars(bars, maxBars) {
76575
- if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
76576
- if (bars < 0 || bars > maxBars) return null;
76577
- return Math.round(bars / maxBars * 100);
76578
- }
76579
- var networkLinkCapability = {
76580
- name: "network-link",
76581
- scope: "device",
76582
- deviceNative: true,
76583
- mode: "singleton",
76584
- deviceTypes: [
76585
- DeviceType.Camera,
76586
- DeviceType.Sensor,
76587
- DeviceType.Button,
76588
- DeviceType.Switch,
76589
- DeviceType.Light,
76590
- DeviceType.Lock,
76591
- DeviceType.Siren
76592
- ],
76593
- methods: {},
76594
- events: {
76595
- /**
76596
- * Emitted whenever the cached status changes (a link switch, a signal
76597
- * reading that moved). Mirrored on the parent chain by the
76598
- * DeviceEventPropagator like `battery.onStatusChanged`.
76599
- */
76600
- onStatusChanged: { data: object({
76601
- deviceId: number(),
76602
- status: NetworkLinkStatusSchema
76603
- }) } },
76604
- status: {
76605
- schema: NetworkLinkStatusSchema,
76606
- kind: "push",
76607
- empty: NETWORK_LINK_UNKNOWN
76608
- },
76609
- /**
76610
- * Runtime-state slice — every provider stores the same shape under
76611
- * `device.runtimeState['network-link']`, read once by the badge and the
76612
- * Home Assistant projector regardless of the driver.
76613
- */
76614
- runtimeState: NetworkLinkStatusSchema,
76615
- /**
76616
- * Runtime-state durability: **restored** — a link reading is slow to
76617
- * change and a sleeping battery camera may not report for hours; the
76618
- * restored slice is what the badge shows until the next read.
76619
- *
76620
- * See `RuntimeStateDurability`. Enforced by
76621
- * `scripts/check-runtime-state-durability.ts`.
76622
- */
76623
- durability: "restored",
76624
- /** Clock fields: written, but excluded from the compare that decides
76625
- * whether persisting is worth a SQLite commit. */
76626
- volatileStateFields: ["lastUpdated"]
76627
- };
76628
- /**
76629
76676
  * Generic boolean sensor — last-resort fallback when no domain-
76630
76677
  * specific binary cap fits (Home Assistant `binary_sensor` without a
76631
76678
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -80180,6 +80227,517 @@ var nativeObjectDetectionCapability = {
80180
80227
  volatileStateFields: ["lastFetchedAt"]
80181
80228
  };
80182
80229
  /**
80230
+ * `navigation` — a device-scoped capability that natively expresses the FULL
80231
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
80232
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
80233
+ *
80234
+ * Why a NEW cap rather than overloading `ptz`:
80235
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
80236
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
80237
+ * The two are different physical models: PTZ is absolute-position + presets,
80238
+ * navigation is momentary drive nudges + discrete robot ACTIONS
80239
+ * (dock / spot-clean / follow-pet / go-to-point / …).
80240
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
80241
+ * the reverse:
80242
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
80243
+ * / `getOptions`), and
80244
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
80245
+ * robot camera shows up in the existing PTZ control path without every
80246
+ * PTZ provider learning about robots. The mapping lives in the adapter,
80247
+ * not here (see the addon design note):
80248
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
80249
+ * ptz.stop() → navigation.stop()
80250
+ * ptz.goHome() → navigation.runAction('goHome')
80251
+ * ptz.getPresets() → navigation.listActions() (id→preset)
80252
+ * ptz.goToPreset(id) → navigation.runAction(id)
80253
+ *
80254
+ * ## Continuous drive
80255
+ *
80256
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
80257
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
80258
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
80259
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
80260
+ * coalesce them. The UI owns the cadence.
80261
+ *
80262
+ * ## The action dictionary
80263
+ *
80264
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
80265
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
80266
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
80267
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
80268
+ * vendor-specific list. `kind: 'action'` entries are triggered with
80269
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
80270
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
80271
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
80272
+ *
80273
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
80274
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
80275
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
80276
+ * every device handle. A future nodedreame publish adds a typed
80277
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
80278
+ * provider can then swap the raw calls for the typed methods with no change to
80279
+ * THIS contract.
80280
+ */
80281
+ /**
80282
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
80283
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
80284
+ * halts it.
80285
+ *
80286
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
80287
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
80288
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
80289
+ * vector by it (drivers without proportional drive ignore it).
80290
+ *
80291
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
80292
+ * axis alone; an all-undefined nudge is a no-op.
80293
+ */
80294
+ var NavigationMoveCommandSchema = object({
80295
+ pan: number().min(-1).max(1).optional(),
80296
+ tilt: number().min(-1).max(1).optional(),
80297
+ speed: number().min(0).max(1).optional()
80298
+ });
80299
+ /**
80300
+ * The enumerated discrete actions a navigation-capable robot can perform via
80301
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
80302
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
80303
+ * `playSound` (see the `sound` dictionary entries).
80304
+ */
80305
+ var NavigationActionIdSchema = _enum([
80306
+ "goHome",
80307
+ "locate",
80308
+ "spotClean",
80309
+ "findPet",
80310
+ "personFollow",
80311
+ "stop",
80312
+ "startClean",
80313
+ "pauseClean",
80314
+ "dockWash",
80315
+ "autoEmpty",
80316
+ "flashOn",
80317
+ "flashOff"
80318
+ ]);
80319
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
80320
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
80321
+ /**
80322
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
80323
+ * native panel and the PTZ mimic render as a button.
80324
+ *
80325
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
80326
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
80327
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
80328
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
80329
+ * - `label` — operator-facing English label.
80330
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
80331
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
80332
+ * PTZ render ONLY enabled entries. Data-driven: the provider
80333
+ * flips it from config, never by editing code.
80334
+ */
80335
+ var NavigationActionEntrySchema = object({
80336
+ id: string(),
80337
+ kind: NavigationEntryKindSchema,
80338
+ label: string(),
80339
+ icon: string(),
80340
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
80341
+ soundId: number().int().optional(),
80342
+ /** Per-device feature flag — render this entry only when true. */
80343
+ enabled: boolean()
80344
+ });
80345
+ /**
80346
+ * Canonical dictionary of every navigation control (discrete actions + sounds)
80347
+ * with its default label + icon hint. A provider filters this to the subset a
80348
+ * device supports (and may override a label). Exported so the provider AND the
80349
+ * UI share ONE list instead of re-deriving labels / ids independently.
80350
+ *
80351
+ * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
80352
+ * catalog default is `enabled: true`; a provider overrides per-device from
80353
+ * config (data-driven — enabling / disabling one later is a config change, not a
80354
+ * code change).
80355
+ */
80356
+ var NAVIGATION_ACTION_CATALOG = [
80357
+ {
80358
+ id: "startClean",
80359
+ kind: "action",
80360
+ label: "Start cleaning",
80361
+ icon: "play",
80362
+ enabled: true
80363
+ },
80364
+ {
80365
+ id: "pauseClean",
80366
+ kind: "action",
80367
+ label: "Pause cleaning",
80368
+ icon: "pause",
80369
+ enabled: true
80370
+ },
80371
+ {
80372
+ id: "stop",
80373
+ kind: "action",
80374
+ label: "Stop",
80375
+ icon: "hand",
80376
+ enabled: true
80377
+ },
80378
+ {
80379
+ id: "goHome",
80380
+ kind: "action",
80381
+ label: "Return to dock",
80382
+ icon: "home",
80383
+ enabled: true
80384
+ },
80385
+ {
80386
+ id: "locate",
80387
+ kind: "action",
80388
+ label: "Locate",
80389
+ icon: "bell",
80390
+ enabled: true
80391
+ },
80392
+ {
80393
+ id: "spotClean",
80394
+ kind: "action",
80395
+ label: "Spot clean here",
80396
+ icon: "crosshair",
80397
+ enabled: true
80398
+ },
80399
+ {
80400
+ id: "findPet",
80401
+ kind: "action",
80402
+ label: "Find pet",
80403
+ icon: "paw-print",
80404
+ enabled: true
80405
+ },
80406
+ {
80407
+ id: "personFollow",
80408
+ kind: "action",
80409
+ label: "Follow me",
80410
+ icon: "footprints",
80411
+ enabled: true
80412
+ },
80413
+ {
80414
+ id: "dockWash",
80415
+ kind: "action",
80416
+ label: "Wash mop",
80417
+ icon: "droplets",
80418
+ enabled: true
80419
+ },
80420
+ {
80421
+ id: "autoEmpty",
80422
+ kind: "action",
80423
+ label: "Empty dustbin",
80424
+ icon: "trash-2",
80425
+ enabled: true
80426
+ },
80427
+ {
80428
+ id: "flashOn",
80429
+ kind: "action",
80430
+ label: "Flash on",
80431
+ icon: "flashlight",
80432
+ enabled: true
80433
+ },
80434
+ {
80435
+ id: "flashOff",
80436
+ kind: "action",
80437
+ label: "Flash off",
80438
+ icon: "flashlight-off",
80439
+ enabled: true
80440
+ },
80441
+ {
80442
+ id: "sound:meow",
80443
+ kind: "sound",
80444
+ label: "Meow",
80445
+ icon: "cat",
80446
+ soundId: 684,
80447
+ enabled: true
80448
+ },
80449
+ {
80450
+ id: "sound:bark",
80451
+ kind: "sound",
80452
+ label: "Woof",
80453
+ icon: "dog",
80454
+ soundId: 685,
80455
+ enabled: true
80456
+ },
80457
+ {
80458
+ id: "sound:footsteps",
80459
+ kind: "sound",
80460
+ label: "Footsteps",
80461
+ icon: "footprints",
80462
+ soundId: 686,
80463
+ enabled: true
80464
+ },
80465
+ {
80466
+ id: "sound:purring",
80467
+ kind: "sound",
80468
+ label: "Purring",
80469
+ icon: "cat",
80470
+ soundId: 687,
80471
+ enabled: true
80472
+ },
80473
+ {
80474
+ id: "sound:tickTock",
80475
+ kind: "sound",
80476
+ label: "Tick-tock",
80477
+ icon: "clock",
80478
+ soundId: 688,
80479
+ enabled: true
80480
+ }
80481
+ ];
80482
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
80483
+ var NavigationPointSchema = object({
80484
+ x: number(),
80485
+ y: number()
80486
+ });
80487
+ /**
80488
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
80489
+ * The cap reports which are enabled so the UI / PTZ render only the controls
80490
+ * that are turned on for THIS device. Data-driven: the provider derives these
80491
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
80492
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
80493
+ * that are not dictionary entries.
80494
+ *
80495
+ * - `move` / `stop` — the momentary drive joystick.
80496
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
80497
+ * map-coordinate plumbing is wired.
80498
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
80499
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
80500
+ * - `light` — the on/off fill-light toggle (works anytime).
80501
+ * - `lightMode` — the auto/manual selector + manual level slider (a
80502
+ * camera-service control; needs an active stream).
80503
+ */
80504
+ var NavigationFeaturesSchema = object({
80505
+ move: boolean(),
80506
+ stop: boolean(),
80507
+ goToPoint: boolean(),
80508
+ runAction: boolean(),
80509
+ playSound: boolean(),
80510
+ light: boolean(),
80511
+ lightMode: boolean()
80512
+ });
80513
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
80514
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
80515
+ /**
80516
+ * Live navigation state so the UI can reflect what the robot is doing:
80517
+ * - `mode` — coarse activity (idle / cleaning / following / …).
80518
+ * - `following` — person/pet follow is currently armed.
80519
+ * - `flash` — the on-camera fill light is on.
80520
+ * - `lightMode` — auto vs manual fill-light mode.
80521
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
80522
+ * `lightMode === 'manual'`.
80523
+ */
80524
+ var NavigationStatusSchema = object({
80525
+ mode: _enum([
80526
+ "idle",
80527
+ "cleaning",
80528
+ "spot",
80529
+ "following",
80530
+ "goto",
80531
+ "returning",
80532
+ "paused",
80533
+ "unknown"
80534
+ ]),
80535
+ following: boolean(),
80536
+ flash: boolean(),
80537
+ lightMode: NavigationLightModeSchema,
80538
+ lightLevel: number().min(40).max(100),
80539
+ /** Ms epoch when the slice was last updated. */
80540
+ lastChangedAt: number()
80541
+ });
80542
+ /**
80543
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
80544
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
80545
+ * convention.
80546
+ */
80547
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
80548
+ var navigationCapability = {
80549
+ name: "navigation",
80550
+ scope: "device",
80551
+ deviceNative: true,
80552
+ mode: "singleton",
80553
+ deviceTypes: [DeviceType.Camera],
80554
+ deviceConfig: { ui: {
80555
+ kind: "widget",
80556
+ widgetId: "host/navigation-panel",
80557
+ tab: "navigation",
80558
+ topTab: true,
80559
+ label: "Navigation",
80560
+ order: 0
80561
+ } },
80562
+ methods: {
80563
+ /**
80564
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
80565
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
80566
+ * path) works for any authenticated user, not admin-only. The UI sends
80567
+ * these at ~1 Hz while a control is held; the provider forwards each one to
80568
+ * a single drive write WITHOUT debouncing.
80569
+ */
80570
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
80571
+ /** Halt all motion immediately (zero drive vector). */
80572
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
80573
+ /** Send the robot to a point on its live map. */
80574
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
80575
+ /**
80576
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
80577
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
80578
+ */
80579
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
80580
+ /**
80581
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
80582
+ * unsupported action ids are rejected by the provider.
80583
+ */
80584
+ runAction: method(object({
80585
+ deviceId: number(),
80586
+ actionId: NavigationActionIdSchema
80587
+ }), _void(), { kind: "mutation" }),
80588
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
80589
+ playSound: method(object({
80590
+ deviceId: number(),
80591
+ soundId: number().int()
80592
+ }), _void(), { kind: "mutation" }),
80593
+ /**
80594
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
80595
+ * works anytime, no active stream required).
80596
+ */
80597
+ setLightOn: method(object({
80598
+ deviceId: number(),
80599
+ on: boolean()
80600
+ }), _void(), { kind: "mutation" }),
80601
+ /**
80602
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
80603
+ * initial `level`. The auto/manual + level control is a CAMERA-service
80604
+ * action that generally needs an active camera stream/monitor session — the
80605
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
80606
+ */
80607
+ setLightMode: method(object({
80608
+ deviceId: number(),
80609
+ mode: NavigationLightModeSchema,
80610
+ level: number().min(40).max(100).optional()
80611
+ }), _void(), { kind: "mutation" }),
80612
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
80613
+ setLightLevel: method(object({
80614
+ deviceId: number(),
80615
+ level: number().min(40).max(100)
80616
+ }), _void(), { kind: "mutation" }),
80617
+ /**
80618
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
80619
+ * controls the UI shows (the per-entry flags for the dictionary come back on
80620
+ * `listActions`).
80621
+ */
80622
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
80623
+ },
80624
+ events: { onStatusChanged: { data: object({
80625
+ deviceId: number(),
80626
+ status: NavigationStatusSchema
80627
+ }) } },
80628
+ status: {
80629
+ schema: NavigationStatusSchema,
80630
+ kind: "push"
80631
+ },
80632
+ /**
80633
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
80634
+ * for live mode / follow / flash changes.
80635
+ */
80636
+ runtimeState: NavigationRuntimeStateSchema,
80637
+ /**
80638
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
80639
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
80640
+ * that. The live handle re-publishes on connect.
80641
+ *
80642
+ * See `RuntimeStateDurability`. Enforced by
80643
+ * `scripts/check-runtime-state-durability.ts`.
80644
+ */
80645
+ durability: "session"
80646
+ };
80647
+ /**
80648
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
80649
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
80650
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
80651
+ * one Home Assistant projection.
80652
+ */
80653
+ var NetworkLinkStatusSchema = object({
80654
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
80655
+ type: _enum([
80656
+ "wifi",
80657
+ "ethernet",
80658
+ "cellular",
80659
+ "unknown"
80660
+ ]),
80661
+ /**
80662
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
80663
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
80664
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
80665
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
80666
+ * SKIP a null rather than coerce it.
80667
+ */
80668
+ signalPercent: number().min(0).max(100).nullable(),
80669
+ /** Raw received signal strength in dBm, when the firmware reports one. */
80670
+ rssiDbm: number().optional(),
80671
+ /** Network name of a wireless link, when the firmware reports it. */
80672
+ ssid: string().optional(),
80673
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
80674
+ lastUpdated: number()
80675
+ });
80676
+ /** The slice a provider seeds before its first read: nothing is known yet. */
80677
+ var NETWORK_LINK_UNKNOWN = {
80678
+ type: "unknown",
80679
+ signalPercent: null,
80680
+ lastUpdated: 0
80681
+ };
80682
+ /**
80683
+ * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
80684
+ * Out-of-range or non-finite input is not a reading: `null`.
80685
+ */
80686
+ function signalPercentFromBars(bars, maxBars) {
80687
+ if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
80688
+ if (bars < 0 || bars > maxBars) return null;
80689
+ return Math.round(bars / maxBars * 100);
80690
+ }
80691
+ var networkLinkCapability = {
80692
+ name: "network-link",
80693
+ scope: "device",
80694
+ deviceNative: true,
80695
+ mode: "singleton",
80696
+ deviceTypes: [
80697
+ DeviceType.Camera,
80698
+ DeviceType.Sensor,
80699
+ DeviceType.Button,
80700
+ DeviceType.Switch,
80701
+ DeviceType.Light,
80702
+ DeviceType.Lock,
80703
+ DeviceType.Siren
80704
+ ],
80705
+ methods: {},
80706
+ events: {
80707
+ /**
80708
+ * Emitted whenever the cached status changes (a link switch, a signal
80709
+ * reading that moved). Mirrored on the parent chain by the
80710
+ * DeviceEventPropagator like `battery.onStatusChanged`.
80711
+ */
80712
+ onStatusChanged: { data: object({
80713
+ deviceId: number(),
80714
+ status: NetworkLinkStatusSchema
80715
+ }) } },
80716
+ status: {
80717
+ schema: NetworkLinkStatusSchema,
80718
+ kind: "push",
80719
+ empty: NETWORK_LINK_UNKNOWN
80720
+ },
80721
+ /**
80722
+ * Runtime-state slice — every provider stores the same shape under
80723
+ * `device.runtimeState['network-link']`, read once by the badge and the
80724
+ * Home Assistant projector regardless of the driver.
80725
+ */
80726
+ runtimeState: NetworkLinkStatusSchema,
80727
+ /**
80728
+ * Runtime-state durability: **restored** — a link reading is slow to
80729
+ * change and a sleeping battery camera may not report for hours; the
80730
+ * restored slice is what the badge shows until the next read.
80731
+ *
80732
+ * See `RuntimeStateDurability`. Enforced by
80733
+ * `scripts/check-runtime-state-durability.ts`.
80734
+ */
80735
+ durability: "restored",
80736
+ /** Clock fields: written, but excluded from the compare that decides
80737
+ * whether persisting is worth a SQLite commit. */
80738
+ volatileStateFields: ["lastUpdated"]
80739
+ };
80740
+ /**
80183
80741
  * network-quality — system-scoped singleton capability tracking RTT,
80184
80742
  * jitter, and observed/peak bandwidth per device + per client.
80185
80743
  *
@@ -81760,424 +82318,6 @@ var ptzAutotrackCapability = {
81760
82318
  */
81761
82319
  durability: "session"
81762
82320
  };
81763
- /**
81764
- * `navigation` — a device-scoped capability that natively expresses the FULL
81765
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
81766
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
81767
- *
81768
- * Why a NEW cap rather than overloading `ptz`:
81769
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
81770
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
81771
- * The two are different physical models: PTZ is absolute-position + presets,
81772
- * navigation is momentary drive nudges + discrete robot ACTIONS
81773
- * (dock / spot-clean / follow-pet / go-to-point / …).
81774
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
81775
- * the reverse:
81776
- * 1. a native CamStack navigation panel (data-driven from `listActions`
81777
- * / `getOptions`), and
81778
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
81779
- * robot camera shows up in the existing PTZ control path without every
81780
- * PTZ provider learning about robots. The mapping lives in the adapter,
81781
- * not here (see the addon design note):
81782
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
81783
- * ptz.stop() → navigation.stop()
81784
- * ptz.goHome() → navigation.runAction('goHome')
81785
- * ptz.getPresets() → navigation.listActions() (id→preset)
81786
- * ptz.goToPreset(id) → navigation.runAction(id)
81787
- *
81788
- * ## Continuous drive
81789
- *
81790
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
81791
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
81792
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
81793
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
81794
- * coalesce them. The UI owns the cadence.
81795
- *
81796
- * ## The action dictionary
81797
- *
81798
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
81799
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
81800
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
81801
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
81802
- * vendor-specific list. `kind: 'action'` entries are triggered with
81803
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
81804
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
81805
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
81806
- *
81807
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
81808
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
81809
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
81810
- * every device handle. A future nodedreame publish adds a typed
81811
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
81812
- * provider can then swap the raw calls for the typed methods with no change to
81813
- * THIS contract.
81814
- */
81815
- /**
81816
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
81817
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
81818
- * halts it.
81819
- *
81820
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
81821
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
81822
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
81823
- * vector by it (drivers without proportional drive ignore it).
81824
- *
81825
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
81826
- * axis alone; an all-undefined nudge is a no-op.
81827
- */
81828
- var NavigationMoveCommandSchema = object({
81829
- pan: number().min(-1).max(1).optional(),
81830
- tilt: number().min(-1).max(1).optional(),
81831
- speed: number().min(0).max(1).optional()
81832
- });
81833
- /**
81834
- * The enumerated discrete actions a navigation-capable robot can perform via
81835
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
81836
- * subset it supports through `listActions`. Sounds are NOT here — they go through
81837
- * `playSound` (see the `sound` dictionary entries).
81838
- */
81839
- var NavigationActionIdSchema = _enum([
81840
- "goHome",
81841
- "locate",
81842
- "spotClean",
81843
- "findPet",
81844
- "personFollow",
81845
- "stop",
81846
- "startClean",
81847
- "pauseClean",
81848
- "dockWash",
81849
- "autoEmpty",
81850
- "flashOn",
81851
- "flashOff"
81852
- ]);
81853
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
81854
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
81855
- /**
81856
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
81857
- * native panel and the PTZ mimic render as a button.
81858
- *
81859
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
81860
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
81861
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
81862
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
81863
- * - `label` — operator-facing English label.
81864
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
81865
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
81866
- * PTZ render ONLY enabled entries. Data-driven: the provider
81867
- * flips it from config, never by editing code.
81868
- */
81869
- var NavigationActionEntrySchema = object({
81870
- id: string(),
81871
- kind: NavigationEntryKindSchema,
81872
- label: string(),
81873
- icon: string(),
81874
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
81875
- soundId: number().int().optional(),
81876
- /** Per-device feature flag — render this entry only when true. */
81877
- enabled: boolean()
81878
- });
81879
- /**
81880
- * Canonical dictionary of every navigation control (discrete actions + sounds)
81881
- * with its default label + icon hint. A provider filters this to the subset a
81882
- * device supports (and may override a label). Exported so the provider AND the
81883
- * UI share ONE list instead of re-deriving labels / ids independently.
81884
- *
81885
- * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
81886
- * catalog default is `enabled: true`; a provider overrides per-device from
81887
- * config (data-driven — enabling / disabling one later is a config change, not a
81888
- * code change).
81889
- */
81890
- var NAVIGATION_ACTION_CATALOG = [
81891
- {
81892
- id: "startClean",
81893
- kind: "action",
81894
- label: "Start cleaning",
81895
- icon: "play",
81896
- enabled: true
81897
- },
81898
- {
81899
- id: "pauseClean",
81900
- kind: "action",
81901
- label: "Pause cleaning",
81902
- icon: "pause",
81903
- enabled: true
81904
- },
81905
- {
81906
- id: "stop",
81907
- kind: "action",
81908
- label: "Stop",
81909
- icon: "hand",
81910
- enabled: true
81911
- },
81912
- {
81913
- id: "goHome",
81914
- kind: "action",
81915
- label: "Return to dock",
81916
- icon: "home",
81917
- enabled: true
81918
- },
81919
- {
81920
- id: "locate",
81921
- kind: "action",
81922
- label: "Locate",
81923
- icon: "bell",
81924
- enabled: true
81925
- },
81926
- {
81927
- id: "spotClean",
81928
- kind: "action",
81929
- label: "Spot clean here",
81930
- icon: "crosshair",
81931
- enabled: true
81932
- },
81933
- {
81934
- id: "findPet",
81935
- kind: "action",
81936
- label: "Find pet",
81937
- icon: "paw-print",
81938
- enabled: true
81939
- },
81940
- {
81941
- id: "personFollow",
81942
- kind: "action",
81943
- label: "Follow me",
81944
- icon: "footprints",
81945
- enabled: true
81946
- },
81947
- {
81948
- id: "dockWash",
81949
- kind: "action",
81950
- label: "Wash mop",
81951
- icon: "droplets",
81952
- enabled: true
81953
- },
81954
- {
81955
- id: "autoEmpty",
81956
- kind: "action",
81957
- label: "Empty dustbin",
81958
- icon: "trash-2",
81959
- enabled: true
81960
- },
81961
- {
81962
- id: "flashOn",
81963
- kind: "action",
81964
- label: "Flash on",
81965
- icon: "flashlight",
81966
- enabled: true
81967
- },
81968
- {
81969
- id: "flashOff",
81970
- kind: "action",
81971
- label: "Flash off",
81972
- icon: "flashlight-off",
81973
- enabled: true
81974
- },
81975
- {
81976
- id: "sound:meow",
81977
- kind: "sound",
81978
- label: "Meow",
81979
- icon: "cat",
81980
- soundId: 684,
81981
- enabled: true
81982
- },
81983
- {
81984
- id: "sound:bark",
81985
- kind: "sound",
81986
- label: "Woof",
81987
- icon: "dog",
81988
- soundId: 685,
81989
- enabled: true
81990
- },
81991
- {
81992
- id: "sound:footsteps",
81993
- kind: "sound",
81994
- label: "Footsteps",
81995
- icon: "footprints",
81996
- soundId: 686,
81997
- enabled: true
81998
- },
81999
- {
82000
- id: "sound:purring",
82001
- kind: "sound",
82002
- label: "Purring",
82003
- icon: "cat",
82004
- soundId: 687,
82005
- enabled: true
82006
- },
82007
- {
82008
- id: "sound:tickTock",
82009
- kind: "sound",
82010
- label: "Tick-tock",
82011
- icon: "clock",
82012
- soundId: 688,
82013
- enabled: true
82014
- }
82015
- ];
82016
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
82017
- var NavigationPointSchema = object({
82018
- x: number(),
82019
- y: number()
82020
- });
82021
- /**
82022
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
82023
- * The cap reports which are enabled so the UI / PTZ render only the controls
82024
- * that are turned on for THIS device. Data-driven: the provider derives these
82025
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
82026
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
82027
- * that are not dictionary entries.
82028
- *
82029
- * - `move` / `stop` — the momentary drive joystick.
82030
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
82031
- * map-coordinate plumbing is wired.
82032
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
82033
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
82034
- * - `light` — the on/off fill-light toggle (works anytime).
82035
- * - `lightMode` — the auto/manual selector + manual level slider (a
82036
- * camera-service control; needs an active stream).
82037
- */
82038
- var NavigationFeaturesSchema = object({
82039
- move: boolean(),
82040
- stop: boolean(),
82041
- goToPoint: boolean(),
82042
- runAction: boolean(),
82043
- playSound: boolean(),
82044
- light: boolean(),
82045
- lightMode: boolean()
82046
- });
82047
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
82048
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
82049
- /**
82050
- * Live navigation state so the UI can reflect what the robot is doing:
82051
- * - `mode` — coarse activity (idle / cleaning / following / …).
82052
- * - `following` — person/pet follow is currently armed.
82053
- * - `flash` — the on-camera fill light is on.
82054
- * - `lightMode` — auto vs manual fill-light mode.
82055
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
82056
- * `lightMode === 'manual'`.
82057
- */
82058
- var NavigationStatusSchema = object({
82059
- mode: _enum([
82060
- "idle",
82061
- "cleaning",
82062
- "spot",
82063
- "following",
82064
- "goto",
82065
- "returning",
82066
- "paused",
82067
- "unknown"
82068
- ]),
82069
- following: boolean(),
82070
- flash: boolean(),
82071
- lightMode: NavigationLightModeSchema,
82072
- lightLevel: number().min(40).max(100),
82073
- /** Ms epoch when the slice was last updated. */
82074
- lastChangedAt: number()
82075
- });
82076
- /**
82077
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
82078
- * observable). Adds `lastFetchedAt` on top of the status shape per the
82079
- * convention.
82080
- */
82081
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
82082
- var navigationCapability = {
82083
- name: "navigation",
82084
- scope: "device",
82085
- deviceNative: true,
82086
- mode: "singleton",
82087
- deviceTypes: [DeviceType.Camera],
82088
- deviceConfig: { ui: {
82089
- kind: "widget",
82090
- widgetId: "host/navigation-panel",
82091
- tab: "navigation",
82092
- topTab: true,
82093
- label: "Navigation",
82094
- order: 0
82095
- } },
82096
- methods: {
82097
- /**
82098
- * Momentary drive nudge (the robot moves). `protected` — mirrors
82099
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
82100
- * path) works for any authenticated user, not admin-only. The UI sends
82101
- * these at ~1 Hz while a control is held; the provider forwards each one to
82102
- * a single drive write WITHOUT debouncing.
82103
- */
82104
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
82105
- /** Halt all motion immediately (zero drive vector). */
82106
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
82107
- /** Send the robot to a point on its live map. */
82108
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
82109
- /**
82110
- * Enumerate the discrete controls THIS device supports (data-driven UI +
82111
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
82112
- */
82113
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
82114
- /**
82115
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
82116
- * unsupported action ids are rejected by the provider.
82117
- */
82118
- runAction: method(object({
82119
- deviceId: number(),
82120
- actionId: NavigationActionIdSchema
82121
- }), _void(), { kind: "mutation" }),
82122
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
82123
- playSound: method(object({
82124
- deviceId: number(),
82125
- soundId: number().int()
82126
- }), _void(), { kind: "mutation" }),
82127
- /**
82128
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
82129
- * works anytime, no active stream required).
82130
- */
82131
- setLightOn: method(object({
82132
- deviceId: number(),
82133
- on: boolean()
82134
- }), _void(), { kind: "mutation" }),
82135
- /**
82136
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
82137
- * initial `level`. The auto/manual + level control is a CAMERA-service
82138
- * action that generally needs an active camera stream/monitor session — the
82139
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
82140
- */
82141
- setLightMode: method(object({
82142
- deviceId: number(),
82143
- mode: NavigationLightModeSchema,
82144
- level: number().min(40).max(100).optional()
82145
- }), _void(), { kind: "mutation" }),
82146
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
82147
- setLightLevel: method(object({
82148
- deviceId: number(),
82149
- level: number().min(40).max(100)
82150
- }), _void(), { kind: "mutation" }),
82151
- /**
82152
- * Per-device FEATURE-FLAG report for the general primitives — drives which
82153
- * controls the UI shows (the per-entry flags for the dictionary come back on
82154
- * `listActions`).
82155
- */
82156
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
82157
- },
82158
- events: { onStatusChanged: { data: object({
82159
- deviceId: number(),
82160
- status: NavigationStatusSchema
82161
- }) } },
82162
- status: {
82163
- schema: NavigationStatusSchema,
82164
- kind: "push"
82165
- },
82166
- /**
82167
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
82168
- * for live mode / follow / flash changes.
82169
- */
82170
- runtimeState: NavigationRuntimeStateSchema,
82171
- /**
82172
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
82173
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
82174
- * that. The live handle re-publishes on connect.
82175
- *
82176
- * See `RuntimeStateDurability`. Enforced by
82177
- * `scripts/check-runtime-state-durability.ts`.
82178
- */
82179
- durability: "session"
82180
- };
82181
82321
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
82182
82322
  kind: "mutation",
82183
82323
  auth: "admin"
@@ -91640,6 +91780,12 @@ Object.freeze({
91640
91780
  addonId: null,
91641
91781
  access: "view"
91642
91782
  },
91783
+ "storage.listDrainProgress": {
91784
+ capName: "storage",
91785
+ capScope: "system",
91786
+ addonId: null,
91787
+ access: "view"
91788
+ },
91643
91789
  "storage.listLocationDeclarations": {
91644
91790
  capName: "storage",
91645
91791
  capScope: "system",
@@ -91784,6 +91930,12 @@ Object.freeze({
91784
91930
  addonId: null,
91785
91931
  access: "view"
91786
91932
  },
91933
+ "storageOccupancy.getOccupancy": {
91934
+ capName: "storage-occupancy",
91935
+ capScope: "system",
91936
+ addonId: null,
91937
+ access: "view"
91938
+ },
91787
91939
  "storageProvider.abortUpload": {
91788
91940
  capName: "storage-provider",
91789
91941
  capScope: "system",