@camstack/addon-provider-wyze 0.2.83 → 0.2.84

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
@@ -31,7 +31,7 @@ let net = require("net");
31
31
  net = __toESM(net, 1);
32
32
  let node_child_process = require("node:child_process");
33
33
  let node_tls = require("node:tls");
34
- //#region ../types/dist/event-category-zAv7pMUz.mjs
34
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
35
35
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
36
36
  EventCategory["SystemBoot"] = "system.boot";
37
37
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -226,6 +226,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
226
226
  EventCategory["ProcessCrashed"] = "process.crashed";
227
227
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
228
228
  EventCategory["ProcessRestarted"] = "process.restarted";
229
+ /**
230
+ * The SET of storage locations changed — one was created, edited, enabled,
231
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
232
+ *
233
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
234
+ * it must also converge on its own periodic path, because a dropped event
235
+ * must not leave a node writing to yesterday's disk set forever. It exists
236
+ * because there was NO signal at all — an operator who added a second
237
+ * recordings disk in the admin UI got nothing, and the recorder kept its
238
+ * resolved locations until something else happened to re-resolve them
239
+ * (D387). Payload `StorageLocationsChangedPayload`.
240
+ */
241
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
229
242
  EventCategory["RecordingStarted"] = "recording.started";
230
243
  EventCategory["RecordingStopped"] = "recording.stopped";
231
244
  EventCategory["RecordingError"] = "recording.error";
@@ -8568,6 +8581,21 @@ var StorageCleanupJobSchema = object({
8568
8581
  });
8569
8582
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8570
8583
  /**
8584
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8585
+ * alias below is `z.infer<>` of it, never a second spelling.
8586
+ */
8587
+ var StorageLocationModeSchema = _enum([
8588
+ "active",
8589
+ "readonly",
8590
+ "drain",
8591
+ "disabled"
8592
+ ]);
8593
+ _enum([
8594
+ "normal",
8595
+ "never",
8596
+ "drain"
8597
+ ]);
8598
+ /**
8571
8599
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8572
8600
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8573
8601
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8633,6 +8661,21 @@ var StorageLocationSchema = object({
8633
8661
  * stops existing rather than being re-derived on every read.
8634
8662
  */
8635
8663
  enabled: boolean().optional(),
8664
+ /**
8665
+ * THE state of this location (D385), and the only authority on what may be
8666
+ * written, read or evicted here. Interpreted in exactly one place —
8667
+ * `storage-location-mode.ts` — which also folds the legacy
8668
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8669
+ * ambiguous.
8670
+ *
8671
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8672
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8673
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8674
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8675
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8676
+ * either, so the two cannot disagree.
8677
+ */
8678
+ mode: StorageLocationModeSchema.optional(),
8636
8679
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8637
8680
  * for node-local locations it can reach) — never persisted, absent when the
8638
8681
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8640,11 +8683,46 @@ var StorageLocationSchema = object({
8640
8683
  totalBytes: number(),
8641
8684
  availableBytes: number()
8642
8685
  }).nullable().optional(),
8686
+ /**
8687
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8688
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8689
+ * never persisted, never a filesystem walk.
8690
+ *
8691
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8692
+ * location yet — nobody stores here, the owning addon is down, or the first
8693
+ * refresh has not completed. A UI must omit the segment rather than draw it
8694
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8695
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8696
+ * be spelled out loud instead of appearing by accident.
8697
+ *
8698
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8699
+ * about the whole figure rather than about its freshest part.
8700
+ */
8701
+ owned: object({
8702
+ bytes: number().int().nonnegative(),
8703
+ measuredAtMs: number().int().nonnegative()
8704
+ }).optional(),
8643
8705
  createdAt: number(),
8644
8706
  updatedAt: number()
8645
8707
  });
8646
8708
  object({ isDefault: boolean().optional() });
8647
8709
  /**
8710
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8711
+ *
8712
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8713
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8714
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8715
+ * operator learns not to believe the screen.
8716
+ */
8717
+ var StorageDrainProgressSchema = object({
8718
+ locationId: string(),
8719
+ startedAtMs: number(),
8720
+ startBytes: number(),
8721
+ bytesRemaining: number(),
8722
+ drained: boolean(),
8723
+ estimatedEmptyAtMs: number().nullable()
8724
+ });
8725
+ /**
8648
8726
  * Reference accepted by consumer-facing `api.storage.*` calls.
8649
8727
  * Either:
8650
8728
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22094,7 +22172,7 @@ method(object({
22094
22172
  }), _void(), {
22095
22173
  kind: "mutation",
22096
22174
  auth: "admin"
22097
- }), method(object({ id: string() }), object({
22175
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22098
22176
  ok: boolean(),
22099
22177
  error: string().optional()
22100
22178
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22164,6 +22242,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22164
22242
  kind: "mutation",
22165
22243
  auth: "admin"
22166
22244
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22245
+ /**
22246
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22247
+ * location (D388).
22248
+ *
22249
+ * ## Why this is not `storage-evictable`
22250
+ *
22251
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22252
+ * not, in two ways that both matter and both bite hardest on the locations an
22253
+ * operator most wants a figure for:
22254
+ *
22255
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22256
+ * and `recordingsLow:default` deliberately share one root and evict as one
22257
+ * oldest-first pool, so both answer with the SAME combined total. As an
22258
+ * occupancy figure that double-counts the disk.
22259
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22260
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22261
+ * is retiring and staring at.
22262
+ *
22263
+ * So this is its own contract with its own quantity, and the quantity is
22264
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22265
+ * would ever be willing to delete it. A provider that can only answer
22266
+ * "evictable" must not register here — a number that silently means different
22267
+ * things per class is worse than no number.
22268
+ *
22269
+ * ## Absence is an answer
22270
+ *
22271
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22272
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22273
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22274
+ * consuming side has to be written out loud instead of appearing by accident.
22275
+ *
22276
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22277
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22278
+ */
22279
+ /** One provider's occupancy answer for one location. */
22280
+ var StorageOccupancyReportSchema = object({
22281
+ locationId: string(),
22282
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22283
+ * not net of what it is willing to delete. */
22284
+ ownedBytes: number().int().nonnegative(),
22285
+ /** When the provider last actually measured this. The orchestrator carries it
22286
+ * through so a UI can say how old the figure is instead of implying "now". */
22287
+ measuredAtMs: number().int().nonnegative()
22288
+ });
22289
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22167
22290
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22168
22291
  providerId: string().min(1),
22169
22292
  displayName: string().min(1),
@@ -23999,88 +24122,6 @@ onStatusChanged: { data: object({
23999
24122
  volatileStateFields: ["lastUpdated"]
24000
24123
  };
24001
24124
  /**
24002
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24003
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24004
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24005
- * one Home Assistant projection.
24006
- */
24007
- var NetworkLinkStatusSchema = object({
24008
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24009
- type: _enum([
24010
- "wifi",
24011
- "ethernet",
24012
- "cellular",
24013
- "unknown"
24014
- ]),
24015
- /**
24016
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24017
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24018
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24019
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24020
- * SKIP a null rather than coerce it.
24021
- */
24022
- signalPercent: number().min(0).max(100).nullable(),
24023
- /** Raw received signal strength in dBm, when the firmware reports one. */
24024
- rssiDbm: number().optional(),
24025
- /** Network name of a wireless link, when the firmware reports it. */
24026
- ssid: string().optional(),
24027
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24028
- lastUpdated: number()
24029
- });
24030
- var networkLinkCapability = {
24031
- name: "network-link",
24032
- scope: "device",
24033
- deviceNative: true,
24034
- mode: "singleton",
24035
- deviceTypes: [
24036
- DeviceType.Camera,
24037
- DeviceType.Sensor,
24038
- DeviceType.Button,
24039
- DeviceType.Switch,
24040
- DeviceType.Light,
24041
- DeviceType.Lock,
24042
- DeviceType.Siren
24043
- ],
24044
- methods: {},
24045
- events: {
24046
- /**
24047
- * Emitted whenever the cached status changes (a link switch, a signal
24048
- * reading that moved). Mirrored on the parent chain by the
24049
- * DeviceEventPropagator like `battery.onStatusChanged`.
24050
- */
24051
- onStatusChanged: { data: object({
24052
- deviceId: number(),
24053
- status: NetworkLinkStatusSchema
24054
- }) } },
24055
- status: {
24056
- schema: NetworkLinkStatusSchema,
24057
- kind: "push",
24058
- empty: {
24059
- type: "unknown",
24060
- signalPercent: null,
24061
- lastUpdated: 0
24062
- }
24063
- },
24064
- /**
24065
- * Runtime-state slice — every provider stores the same shape under
24066
- * `device.runtimeState['network-link']`, read once by the badge and the
24067
- * Home Assistant projector regardless of the driver.
24068
- */
24069
- runtimeState: NetworkLinkStatusSchema,
24070
- /**
24071
- * Runtime-state durability: **restored** — a link reading is slow to
24072
- * change and a sleeping battery camera may not report for hours; the
24073
- * restored slice is what the badge shows until the next read.
24074
- *
24075
- * See `RuntimeStateDurability`. Enforced by
24076
- * `scripts/check-runtime-state-durability.ts`.
24077
- */
24078
- durability: "restored",
24079
- /** Clock fields: written, but excluded from the compare that decides
24080
- * whether persisting is worth a SQLite commit. */
24081
- volatileStateFields: ["lastUpdated"]
24082
- };
24083
- /**
24084
24125
  * Generic boolean sensor — last-resort fallback when no domain-
24085
24126
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24086
24127
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27618,6 +27659,369 @@ var nativeObjectDetectionCapability = {
27618
27659
  volatileStateFields: ["lastFetchedAt"]
27619
27660
  };
27620
27661
  /**
27662
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27663
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27664
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27665
+ *
27666
+ * Why a NEW cap rather than overloading `ptz`:
27667
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27668
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27669
+ * The two are different physical models: PTZ is absolute-position + presets,
27670
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27671
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27672
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27673
+ * the reverse:
27674
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27675
+ * / `getOptions`), and
27676
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27677
+ * robot camera shows up in the existing PTZ control path without every
27678
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27679
+ * not here (see the addon design note):
27680
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27681
+ * ptz.stop() → navigation.stop()
27682
+ * ptz.goHome() → navigation.runAction('goHome')
27683
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27684
+ * ptz.goToPreset(id) → navigation.runAction(id)
27685
+ *
27686
+ * ## Continuous drive
27687
+ *
27688
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27689
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27690
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27691
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27692
+ * coalesce them. The UI owns the cadence.
27693
+ *
27694
+ * ## The action dictionary
27695
+ *
27696
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27697
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27698
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27699
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27700
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27701
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27702
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27703
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27704
+ *
27705
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27706
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27707
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27708
+ * every device handle. A future nodedreame publish adds a typed
27709
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27710
+ * provider can then swap the raw calls for the typed methods with no change to
27711
+ * THIS contract.
27712
+ */
27713
+ /**
27714
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27715
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27716
+ * halts it.
27717
+ *
27718
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27719
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27720
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27721
+ * vector by it (drivers without proportional drive ignore it).
27722
+ *
27723
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27724
+ * axis alone; an all-undefined nudge is a no-op.
27725
+ */
27726
+ var NavigationMoveCommandSchema = object({
27727
+ pan: number().min(-1).max(1).optional(),
27728
+ tilt: number().min(-1).max(1).optional(),
27729
+ speed: number().min(0).max(1).optional()
27730
+ });
27731
+ /**
27732
+ * The enumerated discrete actions a navigation-capable robot can perform via
27733
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27734
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27735
+ * `playSound` (see the `sound` dictionary entries).
27736
+ */
27737
+ var NavigationActionIdSchema = _enum([
27738
+ "goHome",
27739
+ "locate",
27740
+ "spotClean",
27741
+ "findPet",
27742
+ "personFollow",
27743
+ "stop",
27744
+ "startClean",
27745
+ "pauseClean",
27746
+ "dockWash",
27747
+ "autoEmpty",
27748
+ "flashOn",
27749
+ "flashOff"
27750
+ ]);
27751
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27752
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27753
+ /**
27754
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27755
+ * native panel and the PTZ mimic render as a button.
27756
+ *
27757
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27758
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27759
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27760
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27761
+ * - `label` — operator-facing English label.
27762
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27763
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27764
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27765
+ * flips it from config, never by editing code.
27766
+ */
27767
+ var NavigationActionEntrySchema = object({
27768
+ id: string(),
27769
+ kind: NavigationEntryKindSchema,
27770
+ label: string(),
27771
+ icon: string(),
27772
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27773
+ soundId: number().int().optional(),
27774
+ /** Per-device feature flag — render this entry only when true. */
27775
+ enabled: boolean()
27776
+ });
27777
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27778
+ var NavigationPointSchema = object({
27779
+ x: number(),
27780
+ y: number()
27781
+ });
27782
+ /**
27783
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27784
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27785
+ * that are turned on for THIS device. Data-driven: the provider derives these
27786
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27787
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27788
+ * that are not dictionary entries.
27789
+ *
27790
+ * - `move` / `stop` — the momentary drive joystick.
27791
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27792
+ * map-coordinate plumbing is wired.
27793
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27794
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27795
+ * - `light` — the on/off fill-light toggle (works anytime).
27796
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27797
+ * camera-service control; needs an active stream).
27798
+ */
27799
+ var NavigationFeaturesSchema = object({
27800
+ move: boolean(),
27801
+ stop: boolean(),
27802
+ goToPoint: boolean(),
27803
+ runAction: boolean(),
27804
+ playSound: boolean(),
27805
+ light: boolean(),
27806
+ lightMode: boolean()
27807
+ });
27808
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27809
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27810
+ /**
27811
+ * Live navigation state so the UI can reflect what the robot is doing:
27812
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27813
+ * - `following` — person/pet follow is currently armed.
27814
+ * - `flash` — the on-camera fill light is on.
27815
+ * - `lightMode` — auto vs manual fill-light mode.
27816
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27817
+ * `lightMode === 'manual'`.
27818
+ */
27819
+ var NavigationStatusSchema = object({
27820
+ mode: _enum([
27821
+ "idle",
27822
+ "cleaning",
27823
+ "spot",
27824
+ "following",
27825
+ "goto",
27826
+ "returning",
27827
+ "paused",
27828
+ "unknown"
27829
+ ]),
27830
+ following: boolean(),
27831
+ flash: boolean(),
27832
+ lightMode: NavigationLightModeSchema,
27833
+ lightLevel: number().min(40).max(100),
27834
+ /** Ms epoch when the slice was last updated. */
27835
+ lastChangedAt: number()
27836
+ });
27837
+ /**
27838
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27839
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27840
+ * convention.
27841
+ */
27842
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27843
+ var navigationCapability = {
27844
+ name: "navigation",
27845
+ scope: "device",
27846
+ deviceNative: true,
27847
+ mode: "singleton",
27848
+ deviceTypes: [DeviceType.Camera],
27849
+ deviceConfig: { ui: {
27850
+ kind: "widget",
27851
+ widgetId: "host/navigation-panel",
27852
+ tab: "navigation",
27853
+ topTab: true,
27854
+ label: "Navigation",
27855
+ order: 0
27856
+ } },
27857
+ methods: {
27858
+ /**
27859
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27860
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27861
+ * path) works for any authenticated user, not admin-only. The UI sends
27862
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27863
+ * a single drive write WITHOUT debouncing.
27864
+ */
27865
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27866
+ /** Halt all motion immediately (zero drive vector). */
27867
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27868
+ /** Send the robot to a point on its live map. */
27869
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27870
+ /**
27871
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27872
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27873
+ */
27874
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27875
+ /**
27876
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27877
+ * unsupported action ids are rejected by the provider.
27878
+ */
27879
+ runAction: method(object({
27880
+ deviceId: number(),
27881
+ actionId: NavigationActionIdSchema
27882
+ }), _void(), { kind: "mutation" }),
27883
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27884
+ playSound: method(object({
27885
+ deviceId: number(),
27886
+ soundId: number().int()
27887
+ }), _void(), { kind: "mutation" }),
27888
+ /**
27889
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27890
+ * works anytime, no active stream required).
27891
+ */
27892
+ setLightOn: method(object({
27893
+ deviceId: number(),
27894
+ on: boolean()
27895
+ }), _void(), { kind: "mutation" }),
27896
+ /**
27897
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27898
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27899
+ * action that generally needs an active camera stream/monitor session — the
27900
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27901
+ */
27902
+ setLightMode: method(object({
27903
+ deviceId: number(),
27904
+ mode: NavigationLightModeSchema,
27905
+ level: number().min(40).max(100).optional()
27906
+ }), _void(), { kind: "mutation" }),
27907
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27908
+ setLightLevel: method(object({
27909
+ deviceId: number(),
27910
+ level: number().min(40).max(100)
27911
+ }), _void(), { kind: "mutation" }),
27912
+ /**
27913
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27914
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27915
+ * `listActions`).
27916
+ */
27917
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27918
+ },
27919
+ events: { onStatusChanged: { data: object({
27920
+ deviceId: number(),
27921
+ status: NavigationStatusSchema
27922
+ }) } },
27923
+ status: {
27924
+ schema: NavigationStatusSchema,
27925
+ kind: "push"
27926
+ },
27927
+ /**
27928
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27929
+ * for live mode / follow / flash changes.
27930
+ */
27931
+ runtimeState: NavigationRuntimeStateSchema,
27932
+ /**
27933
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27934
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27935
+ * that. The live handle re-publishes on connect.
27936
+ *
27937
+ * See `RuntimeStateDurability`. Enforced by
27938
+ * `scripts/check-runtime-state-durability.ts`.
27939
+ */
27940
+ durability: "session"
27941
+ };
27942
+ /**
27943
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27944
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27945
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27946
+ * one Home Assistant projection.
27947
+ */
27948
+ var NetworkLinkStatusSchema = object({
27949
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27950
+ type: _enum([
27951
+ "wifi",
27952
+ "ethernet",
27953
+ "cellular",
27954
+ "unknown"
27955
+ ]),
27956
+ /**
27957
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27958
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27959
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27960
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27961
+ * SKIP a null rather than coerce it.
27962
+ */
27963
+ signalPercent: number().min(0).max(100).nullable(),
27964
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27965
+ rssiDbm: number().optional(),
27966
+ /** Network name of a wireless link, when the firmware reports it. */
27967
+ ssid: string().optional(),
27968
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27969
+ lastUpdated: number()
27970
+ });
27971
+ var networkLinkCapability = {
27972
+ name: "network-link",
27973
+ scope: "device",
27974
+ deviceNative: true,
27975
+ mode: "singleton",
27976
+ deviceTypes: [
27977
+ DeviceType.Camera,
27978
+ DeviceType.Sensor,
27979
+ DeviceType.Button,
27980
+ DeviceType.Switch,
27981
+ DeviceType.Light,
27982
+ DeviceType.Lock,
27983
+ DeviceType.Siren
27984
+ ],
27985
+ methods: {},
27986
+ events: {
27987
+ /**
27988
+ * Emitted whenever the cached status changes (a link switch, a signal
27989
+ * reading that moved). Mirrored on the parent chain by the
27990
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27991
+ */
27992
+ onStatusChanged: { data: object({
27993
+ deviceId: number(),
27994
+ status: NetworkLinkStatusSchema
27995
+ }) } },
27996
+ status: {
27997
+ schema: NetworkLinkStatusSchema,
27998
+ kind: "push",
27999
+ empty: {
28000
+ type: "unknown",
28001
+ signalPercent: null,
28002
+ lastUpdated: 0
28003
+ }
28004
+ },
28005
+ /**
28006
+ * Runtime-state slice — every provider stores the same shape under
28007
+ * `device.runtimeState['network-link']`, read once by the badge and the
28008
+ * Home Assistant projector regardless of the driver.
28009
+ */
28010
+ runtimeState: NetworkLinkStatusSchema,
28011
+ /**
28012
+ * Runtime-state durability: **restored** — a link reading is slow to
28013
+ * change and a sleeping battery camera may not report for hours; the
28014
+ * restored slice is what the badge shows until the next read.
28015
+ *
28016
+ * See `RuntimeStateDurability`. Enforced by
28017
+ * `scripts/check-runtime-state-durability.ts`.
28018
+ */
28019
+ durability: "restored",
28020
+ /** Clock fields: written, but excluded from the compare that decides
28021
+ * whether persisting is worth a SQLite commit. */
28022
+ volatileStateFields: ["lastUpdated"]
28023
+ };
28024
+ /**
27621
28025
  * network-quality — system-scoped singleton capability tracking RTT,
27622
28026
  * jitter, and observed/peak bandwidth per device + per client.
27623
28027
  *
@@ -29198,287 +29602,6 @@ var ptzAutotrackCapability = {
29198
29602
  */
29199
29603
  durability: "session"
29200
29604
  };
29201
- /**
29202
- * `navigation` — a device-scoped capability that natively expresses the FULL
29203
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29204
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29205
- *
29206
- * Why a NEW cap rather than overloading `ptz`:
29207
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29208
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29209
- * The two are different physical models: PTZ is absolute-position + presets,
29210
- * navigation is momentary drive nudges + discrete robot ACTIONS
29211
- * (dock / spot-clean / follow-pet / go-to-point / …).
29212
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29213
- * the reverse:
29214
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29215
- * / `getOptions`), and
29216
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29217
- * robot camera shows up in the existing PTZ control path without every
29218
- * PTZ provider learning about robots. The mapping lives in the adapter,
29219
- * not here (see the addon design note):
29220
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29221
- * ptz.stop() → navigation.stop()
29222
- * ptz.goHome() → navigation.runAction('goHome')
29223
- * ptz.getPresets() → navigation.listActions() (id→preset)
29224
- * ptz.goToPreset(id) → navigation.runAction(id)
29225
- *
29226
- * ## Continuous drive
29227
- *
29228
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29229
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29230
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29231
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29232
- * coalesce them. The UI owns the cadence.
29233
- *
29234
- * ## The action dictionary
29235
- *
29236
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29237
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29238
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29239
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29240
- * vendor-specific list. `kind: 'action'` entries are triggered with
29241
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29242
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29243
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29244
- *
29245
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29246
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29247
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29248
- * every device handle. A future nodedreame publish adds a typed
29249
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29250
- * provider can then swap the raw calls for the typed methods with no change to
29251
- * THIS contract.
29252
- */
29253
- /**
29254
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29255
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29256
- * halts it.
29257
- *
29258
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29259
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29260
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29261
- * vector by it (drivers without proportional drive ignore it).
29262
- *
29263
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29264
- * axis alone; an all-undefined nudge is a no-op.
29265
- */
29266
- var NavigationMoveCommandSchema = object({
29267
- pan: number().min(-1).max(1).optional(),
29268
- tilt: number().min(-1).max(1).optional(),
29269
- speed: number().min(0).max(1).optional()
29270
- });
29271
- /**
29272
- * The enumerated discrete actions a navigation-capable robot can perform via
29273
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29274
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29275
- * `playSound` (see the `sound` dictionary entries).
29276
- */
29277
- var NavigationActionIdSchema = _enum([
29278
- "goHome",
29279
- "locate",
29280
- "spotClean",
29281
- "findPet",
29282
- "personFollow",
29283
- "stop",
29284
- "startClean",
29285
- "pauseClean",
29286
- "dockWash",
29287
- "autoEmpty",
29288
- "flashOn",
29289
- "flashOff"
29290
- ]);
29291
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29292
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29293
- /**
29294
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29295
- * native panel and the PTZ mimic render as a button.
29296
- *
29297
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29298
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29299
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29300
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29301
- * - `label` — operator-facing English label.
29302
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29303
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29304
- * PTZ render ONLY enabled entries. Data-driven: the provider
29305
- * flips it from config, never by editing code.
29306
- */
29307
- var NavigationActionEntrySchema = object({
29308
- id: string(),
29309
- kind: NavigationEntryKindSchema,
29310
- label: string(),
29311
- icon: string(),
29312
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29313
- soundId: number().int().optional(),
29314
- /** Per-device feature flag — render this entry only when true. */
29315
- enabled: boolean()
29316
- });
29317
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29318
- var NavigationPointSchema = object({
29319
- x: number(),
29320
- y: number()
29321
- });
29322
- /**
29323
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29324
- * The cap reports which are enabled so the UI / PTZ render only the controls
29325
- * that are turned on for THIS device. Data-driven: the provider derives these
29326
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29327
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29328
- * that are not dictionary entries.
29329
- *
29330
- * - `move` / `stop` — the momentary drive joystick.
29331
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29332
- * map-coordinate plumbing is wired.
29333
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29334
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29335
- * - `light` — the on/off fill-light toggle (works anytime).
29336
- * - `lightMode` — the auto/manual selector + manual level slider (a
29337
- * camera-service control; needs an active stream).
29338
- */
29339
- var NavigationFeaturesSchema = object({
29340
- move: boolean(),
29341
- stop: boolean(),
29342
- goToPoint: boolean(),
29343
- runAction: boolean(),
29344
- playSound: boolean(),
29345
- light: boolean(),
29346
- lightMode: boolean()
29347
- });
29348
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29349
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29350
- /**
29351
- * Live navigation state so the UI can reflect what the robot is doing:
29352
- * - `mode` — coarse activity (idle / cleaning / following / …).
29353
- * - `following` — person/pet follow is currently armed.
29354
- * - `flash` — the on-camera fill light is on.
29355
- * - `lightMode` — auto vs manual fill-light mode.
29356
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29357
- * `lightMode === 'manual'`.
29358
- */
29359
- var NavigationStatusSchema = object({
29360
- mode: _enum([
29361
- "idle",
29362
- "cleaning",
29363
- "spot",
29364
- "following",
29365
- "goto",
29366
- "returning",
29367
- "paused",
29368
- "unknown"
29369
- ]),
29370
- following: boolean(),
29371
- flash: boolean(),
29372
- lightMode: NavigationLightModeSchema,
29373
- lightLevel: number().min(40).max(100),
29374
- /** Ms epoch when the slice was last updated. */
29375
- lastChangedAt: number()
29376
- });
29377
- /**
29378
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29379
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29380
- * convention.
29381
- */
29382
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29383
- var navigationCapability = {
29384
- name: "navigation",
29385
- scope: "device",
29386
- deviceNative: true,
29387
- mode: "singleton",
29388
- deviceTypes: [DeviceType.Camera],
29389
- deviceConfig: { ui: {
29390
- kind: "widget",
29391
- widgetId: "host/navigation-panel",
29392
- tab: "navigation",
29393
- topTab: true,
29394
- label: "Navigation",
29395
- order: 0
29396
- } },
29397
- methods: {
29398
- /**
29399
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29400
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29401
- * path) works for any authenticated user, not admin-only. The UI sends
29402
- * these at ~1 Hz while a control is held; the provider forwards each one to
29403
- * a single drive write WITHOUT debouncing.
29404
- */
29405
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29406
- /** Halt all motion immediately (zero drive vector). */
29407
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29408
- /** Send the robot to a point on its live map. */
29409
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29410
- /**
29411
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29412
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29413
- */
29414
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29415
- /**
29416
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29417
- * unsupported action ids are rejected by the provider.
29418
- */
29419
- runAction: method(object({
29420
- deviceId: number(),
29421
- actionId: NavigationActionIdSchema
29422
- }), _void(), { kind: "mutation" }),
29423
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29424
- playSound: method(object({
29425
- deviceId: number(),
29426
- soundId: number().int()
29427
- }), _void(), { kind: "mutation" }),
29428
- /**
29429
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29430
- * works anytime, no active stream required).
29431
- */
29432
- setLightOn: method(object({
29433
- deviceId: number(),
29434
- on: boolean()
29435
- }), _void(), { kind: "mutation" }),
29436
- /**
29437
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29438
- * initial `level`. The auto/manual + level control is a CAMERA-service
29439
- * action that generally needs an active camera stream/monitor session — the
29440
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29441
- */
29442
- setLightMode: method(object({
29443
- deviceId: number(),
29444
- mode: NavigationLightModeSchema,
29445
- level: number().min(40).max(100).optional()
29446
- }), _void(), { kind: "mutation" }),
29447
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29448
- setLightLevel: method(object({
29449
- deviceId: number(),
29450
- level: number().min(40).max(100)
29451
- }), _void(), { kind: "mutation" }),
29452
- /**
29453
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29454
- * controls the UI shows (the per-entry flags for the dictionary come back on
29455
- * `listActions`).
29456
- */
29457
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29458
- },
29459
- events: { onStatusChanged: { data: object({
29460
- deviceId: number(),
29461
- status: NavigationStatusSchema
29462
- }) } },
29463
- status: {
29464
- schema: NavigationStatusSchema,
29465
- kind: "push"
29466
- },
29467
- /**
29468
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29469
- * for live mode / follow / flash changes.
29470
- */
29471
- runtimeState: NavigationRuntimeStateSchema,
29472
- /**
29473
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29474
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29475
- * that. The live handle re-publishes on connect.
29476
- *
29477
- * See `RuntimeStateDurability`. Enforced by
29478
- * `scripts/check-runtime-state-durability.ts`.
29479
- */
29480
- durability: "session"
29481
- };
29482
29605
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29483
29606
  kind: "mutation",
29484
29607
  auth: "admin"
@@ -38941,6 +39064,12 @@ Object.freeze({
38941
39064
  addonId: null,
38942
39065
  access: "view"
38943
39066
  },
39067
+ "storage.listDrainProgress": {
39068
+ capName: "storage",
39069
+ capScope: "system",
39070
+ addonId: null,
39071
+ access: "view"
39072
+ },
38944
39073
  "storage.listLocationDeclarations": {
38945
39074
  capName: "storage",
38946
39075
  capScope: "system",
@@ -39085,6 +39214,12 @@ Object.freeze({
39085
39214
  addonId: null,
39086
39215
  access: "view"
39087
39216
  },
39217
+ "storageOccupancy.getOccupancy": {
39218
+ capName: "storage-occupancy",
39219
+ capScope: "system",
39220
+ addonId: null,
39221
+ access: "view"
39222
+ },
39088
39223
  "storageProvider.abortUpload": {
39089
39224
  capName: "storage-provider",
39090
39225
  capScope: "system",