@camstack/addon-provider-tuya 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
@@ -819,7 +819,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
819
819
  return [...byId.values()];
820
820
  }
821
821
  //#endregion
822
- //#region ../types/dist/event-category-zAv7pMUz.mjs
822
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
823
823
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
824
824
  EventCategory["SystemBoot"] = "system.boot";
825
825
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1014,6 +1014,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1014
1014
  EventCategory["ProcessCrashed"] = "process.crashed";
1015
1015
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
1016
1016
  EventCategory["ProcessRestarted"] = "process.restarted";
1017
+ /**
1018
+ * The SET of storage locations changed — one was created, edited, enabled,
1019
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
1020
+ *
1021
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
1022
+ * it must also converge on its own periodic path, because a dropped event
1023
+ * must not leave a node writing to yesterday's disk set forever. It exists
1024
+ * because there was NO signal at all — an operator who added a second
1025
+ * recordings disk in the admin UI got nothing, and the recorder kept its
1026
+ * resolved locations until something else happened to re-resolve them
1027
+ * (D387). Payload `StorageLocationsChangedPayload`.
1028
+ */
1029
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
1017
1030
  EventCategory["RecordingStarted"] = "recording.started";
1018
1031
  EventCategory["RecordingStopped"] = "recording.stopped";
1019
1032
  EventCategory["RecordingError"] = "recording.error";
@@ -9356,6 +9369,21 @@ var StorageCleanupJobSchema = object({
9356
9369
  });
9357
9370
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
9358
9371
  /**
9372
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
9373
+ * alias below is `z.infer<>` of it, never a second spelling.
9374
+ */
9375
+ var StorageLocationModeSchema = _enum([
9376
+ "active",
9377
+ "readonly",
9378
+ "drain",
9379
+ "disabled"
9380
+ ]);
9381
+ _enum([
9382
+ "normal",
9383
+ "never",
9384
+ "drain"
9385
+ ]);
9386
+ /**
9359
9387
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9360
9388
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9361
9389
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9421,6 +9449,21 @@ var StorageLocationSchema = object({
9421
9449
  * stops existing rather than being re-derived on every read.
9422
9450
  */
9423
9451
  enabled: boolean().optional(),
9452
+ /**
9453
+ * THE state of this location (D385), and the only authority on what may be
9454
+ * written, read or evicted here. Interpreted in exactly one place —
9455
+ * `storage-location-mode.ts` — which also folds the legacy
9456
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
9457
+ * ambiguous.
9458
+ *
9459
+ * OPTIONAL only for the wire and for rows written before D385: absence is
9460
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
9461
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
9462
+ * re-derived on every read. `enabled` survives one release as a DERIVED
9463
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
9464
+ * either, so the two cannot disagree.
9465
+ */
9466
+ mode: StorageLocationModeSchema.optional(),
9424
9467
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
9425
9468
  * for node-local locations it can reach) — never persisted, absent when the
9426
9469
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9428,11 +9471,46 @@ var StorageLocationSchema = object({
9428
9471
  totalBytes: number(),
9429
9472
  availableBytes: number()
9430
9473
  }).nullable().optional(),
9474
+ /**
9475
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9476
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9477
+ * never persisted, never a filesystem walk.
9478
+ *
9479
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9480
+ * location yet — nobody stores here, the owning addon is down, or the first
9481
+ * refresh has not completed. A UI must omit the segment rather than draw it
9482
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9483
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9484
+ * be spelled out loud instead of appearing by accident.
9485
+ *
9486
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9487
+ * about the whole figure rather than about its freshest part.
9488
+ */
9489
+ owned: object({
9490
+ bytes: number().int().nonnegative(),
9491
+ measuredAtMs: number().int().nonnegative()
9492
+ }).optional(),
9431
9493
  createdAt: number(),
9432
9494
  updatedAt: number()
9433
9495
  });
9434
9496
  object({ isDefault: boolean().optional() });
9435
9497
  /**
9498
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9499
+ *
9500
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9501
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9502
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9503
+ * operator learns not to believe the screen.
9504
+ */
9505
+ var StorageDrainProgressSchema = object({
9506
+ locationId: string(),
9507
+ startedAtMs: number(),
9508
+ startBytes: number(),
9509
+ bytesRemaining: number(),
9510
+ drained: boolean(),
9511
+ estimatedEmptyAtMs: number().nullable()
9512
+ });
9513
+ /**
9436
9514
  * Reference accepted by consumer-facing `api.storage.*` calls.
9437
9515
  * Either:
9438
9516
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22778,7 +22856,7 @@ method(object({
22778
22856
  }), _void(), {
22779
22857
  kind: "mutation",
22780
22858
  auth: "admin"
22781
- }), method(object({ id: string() }), object({
22859
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22782
22860
  ok: boolean(),
22783
22861
  error: string().optional()
22784
22862
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22848,6 +22926,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22848
22926
  kind: "mutation",
22849
22927
  auth: "admin"
22850
22928
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22929
+ /**
22930
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22931
+ * location (D388).
22932
+ *
22933
+ * ## Why this is not `storage-evictable`
22934
+ *
22935
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22936
+ * not, in two ways that both matter and both bite hardest on the locations an
22937
+ * operator most wants a figure for:
22938
+ *
22939
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22940
+ * and `recordingsLow:default` deliberately share one root and evict as one
22941
+ * oldest-first pool, so both answer with the SAME combined total. As an
22942
+ * occupancy figure that double-counts the disk.
22943
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22944
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22945
+ * is retiring and staring at.
22946
+ *
22947
+ * So this is its own contract with its own quantity, and the quantity is
22948
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22949
+ * would ever be willing to delete it. A provider that can only answer
22950
+ * "evictable" must not register here — a number that silently means different
22951
+ * things per class is worse than no number.
22952
+ *
22953
+ * ## Absence is an answer
22954
+ *
22955
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22956
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22957
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22958
+ * consuming side has to be written out loud instead of appearing by accident.
22959
+ *
22960
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22961
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22962
+ */
22963
+ /** One provider's occupancy answer for one location. */
22964
+ var StorageOccupancyReportSchema = object({
22965
+ locationId: string(),
22966
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22967
+ * not net of what it is willing to delete. */
22968
+ ownedBytes: number().int().nonnegative(),
22969
+ /** When the provider last actually measured this. The orchestrator carries it
22970
+ * through so a UI can say how old the figure is instead of implying "now". */
22971
+ measuredAtMs: number().int().nonnegative()
22972
+ });
22973
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22851
22974
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22852
22975
  providerId: string().min(1),
22853
22976
  displayName: string().min(1),
@@ -24683,88 +24806,6 @@ onStatusChanged: { data: object({
24683
24806
  volatileStateFields: ["lastUpdated"]
24684
24807
  };
24685
24808
  /**
24686
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24687
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24688
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24689
- * one Home Assistant projection.
24690
- */
24691
- var NetworkLinkStatusSchema = object({
24692
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24693
- type: _enum([
24694
- "wifi",
24695
- "ethernet",
24696
- "cellular",
24697
- "unknown"
24698
- ]),
24699
- /**
24700
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24701
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24702
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24703
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24704
- * SKIP a null rather than coerce it.
24705
- */
24706
- signalPercent: number().min(0).max(100).nullable(),
24707
- /** Raw received signal strength in dBm, when the firmware reports one. */
24708
- rssiDbm: number().optional(),
24709
- /** Network name of a wireless link, when the firmware reports it. */
24710
- ssid: string().optional(),
24711
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24712
- lastUpdated: number()
24713
- });
24714
- var networkLinkCapability = {
24715
- name: "network-link",
24716
- scope: "device",
24717
- deviceNative: true,
24718
- mode: "singleton",
24719
- deviceTypes: [
24720
- DeviceType.Camera,
24721
- DeviceType.Sensor,
24722
- DeviceType.Button,
24723
- DeviceType.Switch,
24724
- DeviceType.Light,
24725
- DeviceType.Lock,
24726
- DeviceType.Siren
24727
- ],
24728
- methods: {},
24729
- events: {
24730
- /**
24731
- * Emitted whenever the cached status changes (a link switch, a signal
24732
- * reading that moved). Mirrored on the parent chain by the
24733
- * DeviceEventPropagator like `battery.onStatusChanged`.
24734
- */
24735
- onStatusChanged: { data: object({
24736
- deviceId: number(),
24737
- status: NetworkLinkStatusSchema
24738
- }) } },
24739
- status: {
24740
- schema: NetworkLinkStatusSchema,
24741
- kind: "push",
24742
- empty: {
24743
- type: "unknown",
24744
- signalPercent: null,
24745
- lastUpdated: 0
24746
- }
24747
- },
24748
- /**
24749
- * Runtime-state slice — every provider stores the same shape under
24750
- * `device.runtimeState['network-link']`, read once by the badge and the
24751
- * Home Assistant projector regardless of the driver.
24752
- */
24753
- runtimeState: NetworkLinkStatusSchema,
24754
- /**
24755
- * Runtime-state durability: **restored** — a link reading is slow to
24756
- * change and a sleeping battery camera may not report for hours; the
24757
- * restored slice is what the badge shows until the next read.
24758
- *
24759
- * See `RuntimeStateDurability`. Enforced by
24760
- * `scripts/check-runtime-state-durability.ts`.
24761
- */
24762
- durability: "restored",
24763
- /** Clock fields: written, but excluded from the compare that decides
24764
- * whether persisting is worth a SQLite commit. */
24765
- volatileStateFields: ["lastUpdated"]
24766
- };
24767
- /**
24768
24809
  * Generic boolean sensor — last-resort fallback when no domain-
24769
24810
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24770
24811
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -28302,6 +28343,369 @@ var nativeObjectDetectionCapability = {
28302
28343
  volatileStateFields: ["lastFetchedAt"]
28303
28344
  };
28304
28345
  /**
28346
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28347
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28348
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28349
+ *
28350
+ * Why a NEW cap rather than overloading `ptz`:
28351
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28352
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28353
+ * The two are different physical models: PTZ is absolute-position + presets,
28354
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28355
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28356
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28357
+ * the reverse:
28358
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28359
+ * / `getOptions`), and
28360
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28361
+ * robot camera shows up in the existing PTZ control path without every
28362
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28363
+ * not here (see the addon design note):
28364
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28365
+ * ptz.stop() → navigation.stop()
28366
+ * ptz.goHome() → navigation.runAction('goHome')
28367
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28368
+ * ptz.goToPreset(id) → navigation.runAction(id)
28369
+ *
28370
+ * ## Continuous drive
28371
+ *
28372
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
28373
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
28374
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
28375
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
28376
+ * coalesce them. The UI owns the cadence.
28377
+ *
28378
+ * ## The action dictionary
28379
+ *
28380
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
28381
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
28382
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
28383
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
28384
+ * vendor-specific list. `kind: 'action'` entries are triggered with
28385
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
28386
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
28387
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
28388
+ *
28389
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
28390
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
28391
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
28392
+ * every device handle. A future nodedreame publish adds a typed
28393
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
28394
+ * provider can then swap the raw calls for the typed methods with no change to
28395
+ * THIS contract.
28396
+ */
28397
+ /**
28398
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
28399
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
28400
+ * halts it.
28401
+ *
28402
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
28403
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
28404
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
28405
+ * vector by it (drivers without proportional drive ignore it).
28406
+ *
28407
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
28408
+ * axis alone; an all-undefined nudge is a no-op.
28409
+ */
28410
+ var NavigationMoveCommandSchema = object({
28411
+ pan: number().min(-1).max(1).optional(),
28412
+ tilt: number().min(-1).max(1).optional(),
28413
+ speed: number().min(0).max(1).optional()
28414
+ });
28415
+ /**
28416
+ * The enumerated discrete actions a navigation-capable robot can perform via
28417
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
28418
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
28419
+ * `playSound` (see the `sound` dictionary entries).
28420
+ */
28421
+ var NavigationActionIdSchema = _enum([
28422
+ "goHome",
28423
+ "locate",
28424
+ "spotClean",
28425
+ "findPet",
28426
+ "personFollow",
28427
+ "stop",
28428
+ "startClean",
28429
+ "pauseClean",
28430
+ "dockWash",
28431
+ "autoEmpty",
28432
+ "flashOn",
28433
+ "flashOff"
28434
+ ]);
28435
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28436
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28437
+ /**
28438
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28439
+ * native panel and the PTZ mimic render as a button.
28440
+ *
28441
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28442
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28443
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28444
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28445
+ * - `label` — operator-facing English label.
28446
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28447
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28448
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28449
+ * flips it from config, never by editing code.
28450
+ */
28451
+ var NavigationActionEntrySchema = object({
28452
+ id: string(),
28453
+ kind: NavigationEntryKindSchema,
28454
+ label: string(),
28455
+ icon: string(),
28456
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28457
+ soundId: number().int().optional(),
28458
+ /** Per-device feature flag — render this entry only when true. */
28459
+ enabled: boolean()
28460
+ });
28461
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28462
+ var NavigationPointSchema = object({
28463
+ x: number(),
28464
+ y: number()
28465
+ });
28466
+ /**
28467
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28468
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28469
+ * that are turned on for THIS device. Data-driven: the provider derives these
28470
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28471
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28472
+ * that are not dictionary entries.
28473
+ *
28474
+ * - `move` / `stop` — the momentary drive joystick.
28475
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28476
+ * map-coordinate plumbing is wired.
28477
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28478
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28479
+ * - `light` — the on/off fill-light toggle (works anytime).
28480
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28481
+ * camera-service control; needs an active stream).
28482
+ */
28483
+ var NavigationFeaturesSchema = object({
28484
+ move: boolean(),
28485
+ stop: boolean(),
28486
+ goToPoint: boolean(),
28487
+ runAction: boolean(),
28488
+ playSound: boolean(),
28489
+ light: boolean(),
28490
+ lightMode: boolean()
28491
+ });
28492
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28493
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28494
+ /**
28495
+ * Live navigation state so the UI can reflect what the robot is doing:
28496
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28497
+ * - `following` — person/pet follow is currently armed.
28498
+ * - `flash` — the on-camera fill light is on.
28499
+ * - `lightMode` — auto vs manual fill-light mode.
28500
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28501
+ * `lightMode === 'manual'`.
28502
+ */
28503
+ var NavigationStatusSchema = object({
28504
+ mode: _enum([
28505
+ "idle",
28506
+ "cleaning",
28507
+ "spot",
28508
+ "following",
28509
+ "goto",
28510
+ "returning",
28511
+ "paused",
28512
+ "unknown"
28513
+ ]),
28514
+ following: boolean(),
28515
+ flash: boolean(),
28516
+ lightMode: NavigationLightModeSchema,
28517
+ lightLevel: number().min(40).max(100),
28518
+ /** Ms epoch when the slice was last updated. */
28519
+ lastChangedAt: number()
28520
+ });
28521
+ /**
28522
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28523
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28524
+ * convention.
28525
+ */
28526
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28527
+ var navigationCapability = {
28528
+ name: "navigation",
28529
+ scope: "device",
28530
+ deviceNative: true,
28531
+ mode: "singleton",
28532
+ deviceTypes: [DeviceType.Camera],
28533
+ deviceConfig: { ui: {
28534
+ kind: "widget",
28535
+ widgetId: "host/navigation-panel",
28536
+ tab: "navigation",
28537
+ topTab: true,
28538
+ label: "Navigation",
28539
+ order: 0
28540
+ } },
28541
+ methods: {
28542
+ /**
28543
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28544
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28545
+ * path) works for any authenticated user, not admin-only. The UI sends
28546
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28547
+ * a single drive write WITHOUT debouncing.
28548
+ */
28549
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28550
+ /** Halt all motion immediately (zero drive vector). */
28551
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28552
+ /** Send the robot to a point on its live map. */
28553
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28554
+ /**
28555
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28556
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28557
+ */
28558
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28559
+ /**
28560
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28561
+ * unsupported action ids are rejected by the provider.
28562
+ */
28563
+ runAction: method(object({
28564
+ deviceId: number(),
28565
+ actionId: NavigationActionIdSchema
28566
+ }), _void(), { kind: "mutation" }),
28567
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28568
+ playSound: method(object({
28569
+ deviceId: number(),
28570
+ soundId: number().int()
28571
+ }), _void(), { kind: "mutation" }),
28572
+ /**
28573
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28574
+ * works anytime, no active stream required).
28575
+ */
28576
+ setLightOn: method(object({
28577
+ deviceId: number(),
28578
+ on: boolean()
28579
+ }), _void(), { kind: "mutation" }),
28580
+ /**
28581
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28582
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28583
+ * action that generally needs an active camera stream/monitor session — the
28584
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28585
+ */
28586
+ setLightMode: method(object({
28587
+ deviceId: number(),
28588
+ mode: NavigationLightModeSchema,
28589
+ level: number().min(40).max(100).optional()
28590
+ }), _void(), { kind: "mutation" }),
28591
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28592
+ setLightLevel: method(object({
28593
+ deviceId: number(),
28594
+ level: number().min(40).max(100)
28595
+ }), _void(), { kind: "mutation" }),
28596
+ /**
28597
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28598
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28599
+ * `listActions`).
28600
+ */
28601
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28602
+ },
28603
+ events: { onStatusChanged: { data: object({
28604
+ deviceId: number(),
28605
+ status: NavigationStatusSchema
28606
+ }) } },
28607
+ status: {
28608
+ schema: NavigationStatusSchema,
28609
+ kind: "push"
28610
+ },
28611
+ /**
28612
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28613
+ * for live mode / follow / flash changes.
28614
+ */
28615
+ runtimeState: NavigationRuntimeStateSchema,
28616
+ /**
28617
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28618
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28619
+ * that. The live handle re-publishes on connect.
28620
+ *
28621
+ * See `RuntimeStateDurability`. Enforced by
28622
+ * `scripts/check-runtime-state-durability.ts`.
28623
+ */
28624
+ durability: "session"
28625
+ };
28626
+ /**
28627
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28628
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28629
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28630
+ * one Home Assistant projection.
28631
+ */
28632
+ var NetworkLinkStatusSchema = object({
28633
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28634
+ type: _enum([
28635
+ "wifi",
28636
+ "ethernet",
28637
+ "cellular",
28638
+ "unknown"
28639
+ ]),
28640
+ /**
28641
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28642
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28643
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28644
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28645
+ * SKIP a null rather than coerce it.
28646
+ */
28647
+ signalPercent: number().min(0).max(100).nullable(),
28648
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28649
+ rssiDbm: number().optional(),
28650
+ /** Network name of a wireless link, when the firmware reports it. */
28651
+ ssid: string().optional(),
28652
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28653
+ lastUpdated: number()
28654
+ });
28655
+ var networkLinkCapability = {
28656
+ name: "network-link",
28657
+ scope: "device",
28658
+ deviceNative: true,
28659
+ mode: "singleton",
28660
+ deviceTypes: [
28661
+ DeviceType.Camera,
28662
+ DeviceType.Sensor,
28663
+ DeviceType.Button,
28664
+ DeviceType.Switch,
28665
+ DeviceType.Light,
28666
+ DeviceType.Lock,
28667
+ DeviceType.Siren
28668
+ ],
28669
+ methods: {},
28670
+ events: {
28671
+ /**
28672
+ * Emitted whenever the cached status changes (a link switch, a signal
28673
+ * reading that moved). Mirrored on the parent chain by the
28674
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28675
+ */
28676
+ onStatusChanged: { data: object({
28677
+ deviceId: number(),
28678
+ status: NetworkLinkStatusSchema
28679
+ }) } },
28680
+ status: {
28681
+ schema: NetworkLinkStatusSchema,
28682
+ kind: "push",
28683
+ empty: {
28684
+ type: "unknown",
28685
+ signalPercent: null,
28686
+ lastUpdated: 0
28687
+ }
28688
+ },
28689
+ /**
28690
+ * Runtime-state slice — every provider stores the same shape under
28691
+ * `device.runtimeState['network-link']`, read once by the badge and the
28692
+ * Home Assistant projector regardless of the driver.
28693
+ */
28694
+ runtimeState: NetworkLinkStatusSchema,
28695
+ /**
28696
+ * Runtime-state durability: **restored** — a link reading is slow to
28697
+ * change and a sleeping battery camera may not report for hours; the
28698
+ * restored slice is what the badge shows until the next read.
28699
+ *
28700
+ * See `RuntimeStateDurability`. Enforced by
28701
+ * `scripts/check-runtime-state-durability.ts`.
28702
+ */
28703
+ durability: "restored",
28704
+ /** Clock fields: written, but excluded from the compare that decides
28705
+ * whether persisting is worth a SQLite commit. */
28706
+ volatileStateFields: ["lastUpdated"]
28707
+ };
28708
+ /**
28305
28709
  * network-quality — system-scoped singleton capability tracking RTT,
28306
28710
  * jitter, and observed/peak bandwidth per device + per client.
28307
28711
  *
@@ -29882,287 +30286,6 @@ var ptzAutotrackCapability = {
29882
30286
  */
29883
30287
  durability: "session"
29884
30288
  };
29885
- /**
29886
- * `navigation` — a device-scoped capability that natively expresses the FULL
29887
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29888
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29889
- *
29890
- * Why a NEW cap rather than overloading `ptz`:
29891
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29892
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29893
- * The two are different physical models: PTZ is absolute-position + presets,
29894
- * navigation is momentary drive nudges + discrete robot ACTIONS
29895
- * (dock / spot-clean / follow-pet / go-to-point / …).
29896
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29897
- * the reverse:
29898
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29899
- * / `getOptions`), and
29900
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29901
- * robot camera shows up in the existing PTZ control path without every
29902
- * PTZ provider learning about robots. The mapping lives in the adapter,
29903
- * not here (see the addon design note):
29904
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29905
- * ptz.stop() → navigation.stop()
29906
- * ptz.goHome() → navigation.runAction('goHome')
29907
- * ptz.getPresets() → navigation.listActions() (id→preset)
29908
- * ptz.goToPreset(id) → navigation.runAction(id)
29909
- *
29910
- * ## Continuous drive
29911
- *
29912
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29913
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29914
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29915
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29916
- * coalesce them. The UI owns the cadence.
29917
- *
29918
- * ## The action dictionary
29919
- *
29920
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29921
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29922
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29923
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29924
- * vendor-specific list. `kind: 'action'` entries are triggered with
29925
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29926
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29927
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29928
- *
29929
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29930
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29931
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29932
- * every device handle. A future nodedreame publish adds a typed
29933
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29934
- * provider can then swap the raw calls for the typed methods with no change to
29935
- * THIS contract.
29936
- */
29937
- /**
29938
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29939
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29940
- * halts it.
29941
- *
29942
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29943
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29944
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29945
- * vector by it (drivers without proportional drive ignore it).
29946
- *
29947
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29948
- * axis alone; an all-undefined nudge is a no-op.
29949
- */
29950
- var NavigationMoveCommandSchema = object({
29951
- pan: number().min(-1).max(1).optional(),
29952
- tilt: number().min(-1).max(1).optional(),
29953
- speed: number().min(0).max(1).optional()
29954
- });
29955
- /**
29956
- * The enumerated discrete actions a navigation-capable robot can perform via
29957
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29958
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29959
- * `playSound` (see the `sound` dictionary entries).
29960
- */
29961
- var NavigationActionIdSchema = _enum([
29962
- "goHome",
29963
- "locate",
29964
- "spotClean",
29965
- "findPet",
29966
- "personFollow",
29967
- "stop",
29968
- "startClean",
29969
- "pauseClean",
29970
- "dockWash",
29971
- "autoEmpty",
29972
- "flashOn",
29973
- "flashOff"
29974
- ]);
29975
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29976
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29977
- /**
29978
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29979
- * native panel and the PTZ mimic render as a button.
29980
- *
29981
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29982
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29983
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29984
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29985
- * - `label` — operator-facing English label.
29986
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29987
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29988
- * PTZ render ONLY enabled entries. Data-driven: the provider
29989
- * flips it from config, never by editing code.
29990
- */
29991
- var NavigationActionEntrySchema = object({
29992
- id: string(),
29993
- kind: NavigationEntryKindSchema,
29994
- label: string(),
29995
- icon: string(),
29996
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29997
- soundId: number().int().optional(),
29998
- /** Per-device feature flag — render this entry only when true. */
29999
- enabled: boolean()
30000
- });
30001
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
30002
- var NavigationPointSchema = object({
30003
- x: number(),
30004
- y: number()
30005
- });
30006
- /**
30007
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30008
- * The cap reports which are enabled so the UI / PTZ render only the controls
30009
- * that are turned on for THIS device. Data-driven: the provider derives these
30010
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30011
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30012
- * that are not dictionary entries.
30013
- *
30014
- * - `move` / `stop` — the momentary drive joystick.
30015
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30016
- * map-coordinate plumbing is wired.
30017
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30018
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30019
- * - `light` — the on/off fill-light toggle (works anytime).
30020
- * - `lightMode` — the auto/manual selector + manual level slider (a
30021
- * camera-service control; needs an active stream).
30022
- */
30023
- var NavigationFeaturesSchema = object({
30024
- move: boolean(),
30025
- stop: boolean(),
30026
- goToPoint: boolean(),
30027
- runAction: boolean(),
30028
- playSound: boolean(),
30029
- light: boolean(),
30030
- lightMode: boolean()
30031
- });
30032
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30033
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30034
- /**
30035
- * Live navigation state so the UI can reflect what the robot is doing:
30036
- * - `mode` — coarse activity (idle / cleaning / following / …).
30037
- * - `following` — person/pet follow is currently armed.
30038
- * - `flash` — the on-camera fill light is on.
30039
- * - `lightMode` — auto vs manual fill-light mode.
30040
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30041
- * `lightMode === 'manual'`.
30042
- */
30043
- var NavigationStatusSchema = object({
30044
- mode: _enum([
30045
- "idle",
30046
- "cleaning",
30047
- "spot",
30048
- "following",
30049
- "goto",
30050
- "returning",
30051
- "paused",
30052
- "unknown"
30053
- ]),
30054
- following: boolean(),
30055
- flash: boolean(),
30056
- lightMode: NavigationLightModeSchema,
30057
- lightLevel: number().min(40).max(100),
30058
- /** Ms epoch when the slice was last updated. */
30059
- lastChangedAt: number()
30060
- });
30061
- /**
30062
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30063
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30064
- * convention.
30065
- */
30066
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30067
- var navigationCapability = {
30068
- name: "navigation",
30069
- scope: "device",
30070
- deviceNative: true,
30071
- mode: "singleton",
30072
- deviceTypes: [DeviceType.Camera],
30073
- deviceConfig: { ui: {
30074
- kind: "widget",
30075
- widgetId: "host/navigation-panel",
30076
- tab: "navigation",
30077
- topTab: true,
30078
- label: "Navigation",
30079
- order: 0
30080
- } },
30081
- methods: {
30082
- /**
30083
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30084
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30085
- * path) works for any authenticated user, not admin-only. The UI sends
30086
- * these at ~1 Hz while a control is held; the provider forwards each one to
30087
- * a single drive write WITHOUT debouncing.
30088
- */
30089
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30090
- /** Halt all motion immediately (zero drive vector). */
30091
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30092
- /** Send the robot to a point on its live map. */
30093
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30094
- /**
30095
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30096
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30097
- */
30098
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30099
- /**
30100
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30101
- * unsupported action ids are rejected by the provider.
30102
- */
30103
- runAction: method(object({
30104
- deviceId: number(),
30105
- actionId: NavigationActionIdSchema
30106
- }), _void(), { kind: "mutation" }),
30107
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30108
- playSound: method(object({
30109
- deviceId: number(),
30110
- soundId: number().int()
30111
- }), _void(), { kind: "mutation" }),
30112
- /**
30113
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30114
- * works anytime, no active stream required).
30115
- */
30116
- setLightOn: method(object({
30117
- deviceId: number(),
30118
- on: boolean()
30119
- }), _void(), { kind: "mutation" }),
30120
- /**
30121
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30122
- * initial `level`. The auto/manual + level control is a CAMERA-service
30123
- * action that generally needs an active camera stream/monitor session — the
30124
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30125
- */
30126
- setLightMode: method(object({
30127
- deviceId: number(),
30128
- mode: NavigationLightModeSchema,
30129
- level: number().min(40).max(100).optional()
30130
- }), _void(), { kind: "mutation" }),
30131
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30132
- setLightLevel: method(object({
30133
- deviceId: number(),
30134
- level: number().min(40).max(100)
30135
- }), _void(), { kind: "mutation" }),
30136
- /**
30137
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30138
- * controls the UI shows (the per-entry flags for the dictionary come back on
30139
- * `listActions`).
30140
- */
30141
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30142
- },
30143
- events: { onStatusChanged: { data: object({
30144
- deviceId: number(),
30145
- status: NavigationStatusSchema
30146
- }) } },
30147
- status: {
30148
- schema: NavigationStatusSchema,
30149
- kind: "push"
30150
- },
30151
- /**
30152
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30153
- * for live mode / follow / flash changes.
30154
- */
30155
- runtimeState: NavigationRuntimeStateSchema,
30156
- /**
30157
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30158
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30159
- * that. The live handle re-publishes on connect.
30160
- *
30161
- * See `RuntimeStateDurability`. Enforced by
30162
- * `scripts/check-runtime-state-durability.ts`.
30163
- */
30164
- durability: "session"
30165
- };
30166
30289
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30167
30290
  kind: "mutation",
30168
30291
  auth: "admin"
@@ -39625,6 +39748,12 @@ Object.freeze({
39625
39748
  addonId: null,
39626
39749
  access: "view"
39627
39750
  },
39751
+ "storage.listDrainProgress": {
39752
+ capName: "storage",
39753
+ capScope: "system",
39754
+ addonId: null,
39755
+ access: "view"
39756
+ },
39628
39757
  "storage.listLocationDeclarations": {
39629
39758
  capName: "storage",
39630
39759
  capScope: "system",
@@ -39769,6 +39898,12 @@ Object.freeze({
39769
39898
  addonId: null,
39770
39899
  access: "view"
39771
39900
  },
39901
+ "storageOccupancy.getOccupancy": {
39902
+ capName: "storage-occupancy",
39903
+ capScope: "system",
39904
+ addonId: null,
39905
+ access: "view"
39906
+ },
39772
39907
  "storageProvider.abortUpload": {
39773
39908
  capName: "storage-provider",
39774
39909
  capScope: "system",