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