@camstack/addon-matter-broker 0.2.78 → 0.2.79

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
@@ -11,7 +11,7 @@ import { networkInterfaces, tmpdir, uptime } from "node:os";
11
11
  import { finished } from "node:stream/promises";
12
12
  import { createConnection, createServer as createServer$2 } from "node:net";
13
13
  import * as dgram from "node:dgram";
14
- //#region ../types/dist/event-category-zAv7pMUz.mjs
14
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
15
15
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
16
16
  EventCategory["SystemBoot"] = "system.boot";
17
17
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -206,6 +206,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
206
206
  EventCategory["ProcessCrashed"] = "process.crashed";
207
207
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
208
208
  EventCategory["ProcessRestarted"] = "process.restarted";
209
+ /**
210
+ * The SET of storage locations changed — one was created, edited, enabled,
211
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
212
+ *
213
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
214
+ * it must also converge on its own periodic path, because a dropped event
215
+ * must not leave a node writing to yesterday's disk set forever. It exists
216
+ * because there was NO signal at all — an operator who added a second
217
+ * recordings disk in the admin UI got nothing, and the recorder kept its
218
+ * resolved locations until something else happened to re-resolve them
219
+ * (D387). Payload `StorageLocationsChangedPayload`.
220
+ */
221
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
209
222
  EventCategory["RecordingStarted"] = "recording.started";
210
223
  EventCategory["RecordingStopped"] = "recording.stopped";
211
224
  EventCategory["RecordingError"] = "recording.error";
@@ -8548,6 +8561,21 @@ var StorageCleanupJobSchema = object({
8548
8561
  });
8549
8562
  var StorageCleanupStatusInputSchema = object({ jobId: string$2().optional() });
8550
8563
  /**
8564
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8565
+ * alias below is `z.infer<>` of it, never a second spelling.
8566
+ */
8567
+ var StorageLocationModeSchema = _enum([
8568
+ "active",
8569
+ "readonly",
8570
+ "drain",
8571
+ "disabled"
8572
+ ]);
8573
+ _enum([
8574
+ "normal",
8575
+ "never",
8576
+ "drain"
8577
+ ]);
8578
+ /**
8551
8579
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8552
8580
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8553
8581
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8613,6 +8641,21 @@ var StorageLocationSchema = object({
8613
8641
  * stops existing rather than being re-derived on every read.
8614
8642
  */
8615
8643
  enabled: boolean().optional(),
8644
+ /**
8645
+ * THE state of this location (D385), and the only authority on what may be
8646
+ * written, read or evicted here. Interpreted in exactly one place —
8647
+ * `storage-location-mode.ts` — which also folds the legacy
8648
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8649
+ * ambiguous.
8650
+ *
8651
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8652
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8653
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8654
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8655
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8656
+ * either, so the two cannot disagree.
8657
+ */
8658
+ mode: StorageLocationModeSchema.optional(),
8616
8659
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8617
8660
  * for node-local locations it can reach) — never persisted, absent when the
8618
8661
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8620,11 +8663,46 @@ var StorageLocationSchema = object({
8620
8663
  totalBytes: number(),
8621
8664
  availableBytes: number()
8622
8665
  }).nullable().optional(),
8666
+ /**
8667
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8668
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8669
+ * never persisted, never a filesystem walk.
8670
+ *
8671
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8672
+ * location yet — nobody stores here, the owning addon is down, or the first
8673
+ * refresh has not completed. A UI must omit the segment rather than draw it
8674
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8675
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8676
+ * be spelled out loud instead of appearing by accident.
8677
+ *
8678
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8679
+ * about the whole figure rather than about its freshest part.
8680
+ */
8681
+ owned: object({
8682
+ bytes: number().int().nonnegative(),
8683
+ measuredAtMs: number().int().nonnegative()
8684
+ }).optional(),
8623
8685
  createdAt: number(),
8624
8686
  updatedAt: number()
8625
8687
  });
8626
8688
  object({ isDefault: boolean().optional() });
8627
8689
  /**
8690
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8691
+ *
8692
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8693
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8694
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8695
+ * operator learns not to believe the screen.
8696
+ */
8697
+ var StorageDrainProgressSchema = object({
8698
+ locationId: string$2(),
8699
+ startedAtMs: number(),
8700
+ startBytes: number(),
8701
+ bytesRemaining: number(),
8702
+ drained: boolean(),
8703
+ estimatedEmptyAtMs: number().nullable()
8704
+ });
8705
+ /**
8628
8706
  * Reference accepted by consumer-facing `api.storage.*` calls.
8629
8707
  * Either:
8630
8708
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22019,7 +22097,7 @@ method(object({
22019
22097
  }), _void(), {
22020
22098
  kind: "mutation",
22021
22099
  auth: "admin"
22022
- }), method(object({ id: string$2() }), object({
22100
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string$2() }), object({
22023
22101
  ok: boolean(),
22024
22102
  error: string$2().optional()
22025
22103
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22089,6 +22167,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22089
22167
  kind: "mutation",
22090
22168
  auth: "admin"
22091
22169
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22170
+ /**
22171
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22172
+ * location (D388).
22173
+ *
22174
+ * ## Why this is not `storage-evictable`
22175
+ *
22176
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22177
+ * not, in two ways that both matter and both bite hardest on the locations an
22178
+ * operator most wants a figure for:
22179
+ *
22180
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22181
+ * and `recordingsLow:default` deliberately share one root and evict as one
22182
+ * oldest-first pool, so both answer with the SAME combined total. As an
22183
+ * occupancy figure that double-counts the disk.
22184
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22185
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22186
+ * is retiring and staring at.
22187
+ *
22188
+ * So this is its own contract with its own quantity, and the quantity is
22189
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22190
+ * would ever be willing to delete it. A provider that can only answer
22191
+ * "evictable" must not register here — a number that silently means different
22192
+ * things per class is worse than no number.
22193
+ *
22194
+ * ## Absence is an answer
22195
+ *
22196
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22197
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22198
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22199
+ * consuming side has to be written out loud instead of appearing by accident.
22200
+ *
22201
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22202
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22203
+ */
22204
+ /** One provider's occupancy answer for one location. */
22205
+ var StorageOccupancyReportSchema = object({
22206
+ locationId: string$2(),
22207
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22208
+ * not net of what it is willing to delete. */
22209
+ ownedBytes: number().int().nonnegative(),
22210
+ /** When the provider last actually measured this. The orchestrator carries it
22211
+ * through so a UI can say how old the figure is instead of implying "now". */
22212
+ measuredAtMs: number().int().nonnegative()
22213
+ });
22214
+ method(object({ locationIds: array(string$2()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22092
22215
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22093
22216
  providerId: string$2().min(1),
22094
22217
  displayName: string$2().min(1),
@@ -23924,88 +24047,6 @@ onStatusChanged: { data: object({
23924
24047
  volatileStateFields: ["lastUpdated"]
23925
24048
  };
23926
24049
  /**
23927
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23928
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23929
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23930
- * one Home Assistant projection.
23931
- */
23932
- var NetworkLinkStatusSchema = object({
23933
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23934
- type: _enum([
23935
- "wifi",
23936
- "ethernet",
23937
- "cellular",
23938
- "unknown"
23939
- ]),
23940
- /**
23941
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23942
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23943
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23944
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23945
- * SKIP a null rather than coerce it.
23946
- */
23947
- signalPercent: number().min(0).max(100).nullable(),
23948
- /** Raw received signal strength in dBm, when the firmware reports one. */
23949
- rssiDbm: number().optional(),
23950
- /** Network name of a wireless link, when the firmware reports it. */
23951
- ssid: string$2().optional(),
23952
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23953
- lastUpdated: number()
23954
- });
23955
- var networkLinkCapability = {
23956
- name: "network-link",
23957
- scope: "device",
23958
- deviceNative: true,
23959
- mode: "singleton",
23960
- deviceTypes: [
23961
- DeviceType.Camera,
23962
- DeviceType.Sensor,
23963
- DeviceType.Button,
23964
- DeviceType.Switch,
23965
- DeviceType.Light,
23966
- DeviceType.Lock,
23967
- DeviceType.Siren
23968
- ],
23969
- methods: {},
23970
- events: {
23971
- /**
23972
- * Emitted whenever the cached status changes (a link switch, a signal
23973
- * reading that moved). Mirrored on the parent chain by the
23974
- * DeviceEventPropagator like `battery.onStatusChanged`.
23975
- */
23976
- onStatusChanged: { data: object({
23977
- deviceId: number(),
23978
- status: NetworkLinkStatusSchema
23979
- }) } },
23980
- status: {
23981
- schema: NetworkLinkStatusSchema,
23982
- kind: "push",
23983
- empty: {
23984
- type: "unknown",
23985
- signalPercent: null,
23986
- lastUpdated: 0
23987
- }
23988
- },
23989
- /**
23990
- * Runtime-state slice — every provider stores the same shape under
23991
- * `device.runtimeState['network-link']`, read once by the badge and the
23992
- * Home Assistant projector regardless of the driver.
23993
- */
23994
- runtimeState: NetworkLinkStatusSchema,
23995
- /**
23996
- * Runtime-state durability: **restored** — a link reading is slow to
23997
- * change and a sleeping battery camera may not report for hours; the
23998
- * restored slice is what the badge shows until the next read.
23999
- *
24000
- * See `RuntimeStateDurability`. Enforced by
24001
- * `scripts/check-runtime-state-durability.ts`.
24002
- */
24003
- durability: "restored",
24004
- /** Clock fields: written, but excluded from the compare that decides
24005
- * whether persisting is worth a SQLite commit. */
24006
- volatileStateFields: ["lastUpdated"]
24007
- };
24008
- /**
24009
24050
  * Generic boolean sensor — last-resort fallback when no domain-
24010
24051
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24011
24052
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27552,6 +27593,369 @@ var nativeObjectDetectionCapability = {
27552
27593
  volatileStateFields: ["lastFetchedAt"]
27553
27594
  };
27554
27595
  /**
27596
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27597
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27598
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27599
+ *
27600
+ * Why a NEW cap rather than overloading `ptz`:
27601
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27602
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27603
+ * The two are different physical models: PTZ is absolute-position + presets,
27604
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27605
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27606
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27607
+ * the reverse:
27608
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27609
+ * / `getOptions`), and
27610
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27611
+ * robot camera shows up in the existing PTZ control path without every
27612
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27613
+ * not here (see the addon design note):
27614
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27615
+ * ptz.stop() → navigation.stop()
27616
+ * ptz.goHome() → navigation.runAction('goHome')
27617
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27618
+ * ptz.goToPreset(id) → navigation.runAction(id)
27619
+ *
27620
+ * ## Continuous drive
27621
+ *
27622
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27623
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27624
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27625
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27626
+ * coalesce them. The UI owns the cadence.
27627
+ *
27628
+ * ## The action dictionary
27629
+ *
27630
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27631
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27632
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27633
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27634
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27635
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27636
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27637
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27638
+ *
27639
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27640
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27641
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27642
+ * every device handle. A future nodedreame publish adds a typed
27643
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27644
+ * provider can then swap the raw calls for the typed methods with no change to
27645
+ * THIS contract.
27646
+ */
27647
+ /**
27648
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27649
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27650
+ * halts it.
27651
+ *
27652
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27653
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27654
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27655
+ * vector by it (drivers without proportional drive ignore it).
27656
+ *
27657
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27658
+ * axis alone; an all-undefined nudge is a no-op.
27659
+ */
27660
+ var NavigationMoveCommandSchema = object({
27661
+ pan: number().min(-1).max(1).optional(),
27662
+ tilt: number().min(-1).max(1).optional(),
27663
+ speed: number().min(0).max(1).optional()
27664
+ });
27665
+ /**
27666
+ * The enumerated discrete actions a navigation-capable robot can perform via
27667
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27668
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27669
+ * `playSound` (see the `sound` dictionary entries).
27670
+ */
27671
+ var NavigationActionIdSchema = _enum([
27672
+ "goHome",
27673
+ "locate",
27674
+ "spotClean",
27675
+ "findPet",
27676
+ "personFollow",
27677
+ "stop",
27678
+ "startClean",
27679
+ "pauseClean",
27680
+ "dockWash",
27681
+ "autoEmpty",
27682
+ "flashOn",
27683
+ "flashOff"
27684
+ ]);
27685
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27686
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27687
+ /**
27688
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27689
+ * native panel and the PTZ mimic render as a button.
27690
+ *
27691
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27692
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27693
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27694
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27695
+ * - `label` — operator-facing English label.
27696
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27697
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27698
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27699
+ * flips it from config, never by editing code.
27700
+ */
27701
+ var NavigationActionEntrySchema = object({
27702
+ id: string$2(),
27703
+ kind: NavigationEntryKindSchema,
27704
+ label: string$2(),
27705
+ icon: string$2(),
27706
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27707
+ soundId: number().int().optional(),
27708
+ /** Per-device feature flag — render this entry only when true. */
27709
+ enabled: boolean()
27710
+ });
27711
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27712
+ var NavigationPointSchema = object({
27713
+ x: number(),
27714
+ y: number()
27715
+ });
27716
+ /**
27717
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27718
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27719
+ * that are turned on for THIS device. Data-driven: the provider derives these
27720
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27721
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27722
+ * that are not dictionary entries.
27723
+ *
27724
+ * - `move` / `stop` — the momentary drive joystick.
27725
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27726
+ * map-coordinate plumbing is wired.
27727
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27728
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27729
+ * - `light` — the on/off fill-light toggle (works anytime).
27730
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27731
+ * camera-service control; needs an active stream).
27732
+ */
27733
+ var NavigationFeaturesSchema = object({
27734
+ move: boolean(),
27735
+ stop: boolean(),
27736
+ goToPoint: boolean(),
27737
+ runAction: boolean(),
27738
+ playSound: boolean(),
27739
+ light: boolean(),
27740
+ lightMode: boolean()
27741
+ });
27742
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27743
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27744
+ /**
27745
+ * Live navigation state so the UI can reflect what the robot is doing:
27746
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27747
+ * - `following` — person/pet follow is currently armed.
27748
+ * - `flash` — the on-camera fill light is on.
27749
+ * - `lightMode` — auto vs manual fill-light mode.
27750
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27751
+ * `lightMode === 'manual'`.
27752
+ */
27753
+ var NavigationStatusSchema = object({
27754
+ mode: _enum([
27755
+ "idle",
27756
+ "cleaning",
27757
+ "spot",
27758
+ "following",
27759
+ "goto",
27760
+ "returning",
27761
+ "paused",
27762
+ "unknown"
27763
+ ]),
27764
+ following: boolean(),
27765
+ flash: boolean(),
27766
+ lightMode: NavigationLightModeSchema,
27767
+ lightLevel: number().min(40).max(100),
27768
+ /** Ms epoch when the slice was last updated. */
27769
+ lastChangedAt: number()
27770
+ });
27771
+ /**
27772
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27773
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27774
+ * convention.
27775
+ */
27776
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27777
+ var navigationCapability = {
27778
+ name: "navigation",
27779
+ scope: "device",
27780
+ deviceNative: true,
27781
+ mode: "singleton",
27782
+ deviceTypes: [DeviceType.Camera],
27783
+ deviceConfig: { ui: {
27784
+ kind: "widget",
27785
+ widgetId: "host/navigation-panel",
27786
+ tab: "navigation",
27787
+ topTab: true,
27788
+ label: "Navigation",
27789
+ order: 0
27790
+ } },
27791
+ methods: {
27792
+ /**
27793
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27794
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27795
+ * path) works for any authenticated user, not admin-only. The UI sends
27796
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27797
+ * a single drive write WITHOUT debouncing.
27798
+ */
27799
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27800
+ /** Halt all motion immediately (zero drive vector). */
27801
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27802
+ /** Send the robot to a point on its live map. */
27803
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27804
+ /**
27805
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27806
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27807
+ */
27808
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27809
+ /**
27810
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27811
+ * unsupported action ids are rejected by the provider.
27812
+ */
27813
+ runAction: method(object({
27814
+ deviceId: number(),
27815
+ actionId: NavigationActionIdSchema
27816
+ }), _void(), { kind: "mutation" }),
27817
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27818
+ playSound: method(object({
27819
+ deviceId: number(),
27820
+ soundId: number().int()
27821
+ }), _void(), { kind: "mutation" }),
27822
+ /**
27823
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27824
+ * works anytime, no active stream required).
27825
+ */
27826
+ setLightOn: method(object({
27827
+ deviceId: number(),
27828
+ on: boolean()
27829
+ }), _void(), { kind: "mutation" }),
27830
+ /**
27831
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27832
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27833
+ * action that generally needs an active camera stream/monitor session — the
27834
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27835
+ */
27836
+ setLightMode: method(object({
27837
+ deviceId: number(),
27838
+ mode: NavigationLightModeSchema,
27839
+ level: number().min(40).max(100).optional()
27840
+ }), _void(), { kind: "mutation" }),
27841
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27842
+ setLightLevel: method(object({
27843
+ deviceId: number(),
27844
+ level: number().min(40).max(100)
27845
+ }), _void(), { kind: "mutation" }),
27846
+ /**
27847
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27848
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27849
+ * `listActions`).
27850
+ */
27851
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27852
+ },
27853
+ events: { onStatusChanged: { data: object({
27854
+ deviceId: number(),
27855
+ status: NavigationStatusSchema
27856
+ }) } },
27857
+ status: {
27858
+ schema: NavigationStatusSchema,
27859
+ kind: "push"
27860
+ },
27861
+ /**
27862
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27863
+ * for live mode / follow / flash changes.
27864
+ */
27865
+ runtimeState: NavigationRuntimeStateSchema,
27866
+ /**
27867
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27868
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27869
+ * that. The live handle re-publishes on connect.
27870
+ *
27871
+ * See `RuntimeStateDurability`. Enforced by
27872
+ * `scripts/check-runtime-state-durability.ts`.
27873
+ */
27874
+ durability: "session"
27875
+ };
27876
+ /**
27877
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27878
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27879
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27880
+ * one Home Assistant projection.
27881
+ */
27882
+ var NetworkLinkStatusSchema = object({
27883
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27884
+ type: _enum([
27885
+ "wifi",
27886
+ "ethernet",
27887
+ "cellular",
27888
+ "unknown"
27889
+ ]),
27890
+ /**
27891
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27892
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27893
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27894
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27895
+ * SKIP a null rather than coerce it.
27896
+ */
27897
+ signalPercent: number().min(0).max(100).nullable(),
27898
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27899
+ rssiDbm: number().optional(),
27900
+ /** Network name of a wireless link, when the firmware reports it. */
27901
+ ssid: string$2().optional(),
27902
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27903
+ lastUpdated: number()
27904
+ });
27905
+ var networkLinkCapability = {
27906
+ name: "network-link",
27907
+ scope: "device",
27908
+ deviceNative: true,
27909
+ mode: "singleton",
27910
+ deviceTypes: [
27911
+ DeviceType.Camera,
27912
+ DeviceType.Sensor,
27913
+ DeviceType.Button,
27914
+ DeviceType.Switch,
27915
+ DeviceType.Light,
27916
+ DeviceType.Lock,
27917
+ DeviceType.Siren
27918
+ ],
27919
+ methods: {},
27920
+ events: {
27921
+ /**
27922
+ * Emitted whenever the cached status changes (a link switch, a signal
27923
+ * reading that moved). Mirrored on the parent chain by the
27924
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27925
+ */
27926
+ onStatusChanged: { data: object({
27927
+ deviceId: number(),
27928
+ status: NetworkLinkStatusSchema
27929
+ }) } },
27930
+ status: {
27931
+ schema: NetworkLinkStatusSchema,
27932
+ kind: "push",
27933
+ empty: {
27934
+ type: "unknown",
27935
+ signalPercent: null,
27936
+ lastUpdated: 0
27937
+ }
27938
+ },
27939
+ /**
27940
+ * Runtime-state slice — every provider stores the same shape under
27941
+ * `device.runtimeState['network-link']`, read once by the badge and the
27942
+ * Home Assistant projector regardless of the driver.
27943
+ */
27944
+ runtimeState: NetworkLinkStatusSchema,
27945
+ /**
27946
+ * Runtime-state durability: **restored** — a link reading is slow to
27947
+ * change and a sleeping battery camera may not report for hours; the
27948
+ * restored slice is what the badge shows until the next read.
27949
+ *
27950
+ * See `RuntimeStateDurability`. Enforced by
27951
+ * `scripts/check-runtime-state-durability.ts`.
27952
+ */
27953
+ durability: "restored",
27954
+ /** Clock fields: written, but excluded from the compare that decides
27955
+ * whether persisting is worth a SQLite commit. */
27956
+ volatileStateFields: ["lastUpdated"]
27957
+ };
27958
+ /**
27555
27959
  * network-quality — system-scoped singleton capability tracking RTT,
27556
27960
  * jitter, and observed/peak bandwidth per device + per client.
27557
27961
  *
@@ -29132,287 +29536,6 @@ var ptzAutotrackCapability = {
29132
29536
  */
29133
29537
  durability: "session"
29134
29538
  };
29135
- /**
29136
- * `navigation` — a device-scoped capability that natively expresses the FULL
29137
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29138
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29139
- *
29140
- * Why a NEW cap rather than overloading `ptz`:
29141
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29142
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29143
- * The two are different physical models: PTZ is absolute-position + presets,
29144
- * navigation is momentary drive nudges + discrete robot ACTIONS
29145
- * (dock / spot-clean / follow-pet / go-to-point / …).
29146
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29147
- * the reverse:
29148
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29149
- * / `getOptions`), and
29150
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29151
- * robot camera shows up in the existing PTZ control path without every
29152
- * PTZ provider learning about robots. The mapping lives in the adapter,
29153
- * not here (see the addon design note):
29154
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29155
- * ptz.stop() → navigation.stop()
29156
- * ptz.goHome() → navigation.runAction('goHome')
29157
- * ptz.getPresets() → navigation.listActions() (id→preset)
29158
- * ptz.goToPreset(id) → navigation.runAction(id)
29159
- *
29160
- * ## Continuous drive
29161
- *
29162
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29163
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29164
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29165
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29166
- * coalesce them. The UI owns the cadence.
29167
- *
29168
- * ## The action dictionary
29169
- *
29170
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29171
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29172
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29173
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29174
- * vendor-specific list. `kind: 'action'` entries are triggered with
29175
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29176
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29177
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29178
- *
29179
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29180
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29181
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29182
- * every device handle. A future nodedreame publish adds a typed
29183
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29184
- * provider can then swap the raw calls for the typed methods with no change to
29185
- * THIS contract.
29186
- */
29187
- /**
29188
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29189
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29190
- * halts it.
29191
- *
29192
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29193
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29194
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29195
- * vector by it (drivers without proportional drive ignore it).
29196
- *
29197
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29198
- * axis alone; an all-undefined nudge is a no-op.
29199
- */
29200
- var NavigationMoveCommandSchema = object({
29201
- pan: number().min(-1).max(1).optional(),
29202
- tilt: number().min(-1).max(1).optional(),
29203
- speed: number().min(0).max(1).optional()
29204
- });
29205
- /**
29206
- * The enumerated discrete actions a navigation-capable robot can perform via
29207
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29208
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29209
- * `playSound` (see the `sound` dictionary entries).
29210
- */
29211
- var NavigationActionIdSchema = _enum([
29212
- "goHome",
29213
- "locate",
29214
- "spotClean",
29215
- "findPet",
29216
- "personFollow",
29217
- "stop",
29218
- "startClean",
29219
- "pauseClean",
29220
- "dockWash",
29221
- "autoEmpty",
29222
- "flashOn",
29223
- "flashOff"
29224
- ]);
29225
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29226
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29227
- /**
29228
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29229
- * native panel and the PTZ mimic render as a button.
29230
- *
29231
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29232
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29233
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29234
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29235
- * - `label` — operator-facing English label.
29236
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29237
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29238
- * PTZ render ONLY enabled entries. Data-driven: the provider
29239
- * flips it from config, never by editing code.
29240
- */
29241
- var NavigationActionEntrySchema = object({
29242
- id: string$2(),
29243
- kind: NavigationEntryKindSchema,
29244
- label: string$2(),
29245
- icon: string$2(),
29246
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29247
- soundId: number().int().optional(),
29248
- /** Per-device feature flag — render this entry only when true. */
29249
- enabled: boolean()
29250
- });
29251
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29252
- var NavigationPointSchema = object({
29253
- x: number(),
29254
- y: number()
29255
- });
29256
- /**
29257
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29258
- * The cap reports which are enabled so the UI / PTZ render only the controls
29259
- * that are turned on for THIS device. Data-driven: the provider derives these
29260
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29261
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29262
- * that are not dictionary entries.
29263
- *
29264
- * - `move` / `stop` — the momentary drive joystick.
29265
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29266
- * map-coordinate plumbing is wired.
29267
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29268
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29269
- * - `light` — the on/off fill-light toggle (works anytime).
29270
- * - `lightMode` — the auto/manual selector + manual level slider (a
29271
- * camera-service control; needs an active stream).
29272
- */
29273
- var NavigationFeaturesSchema = object({
29274
- move: boolean(),
29275
- stop: boolean(),
29276
- goToPoint: boolean(),
29277
- runAction: boolean(),
29278
- playSound: boolean(),
29279
- light: boolean(),
29280
- lightMode: boolean()
29281
- });
29282
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29283
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29284
- /**
29285
- * Live navigation state so the UI can reflect what the robot is doing:
29286
- * - `mode` — coarse activity (idle / cleaning / following / …).
29287
- * - `following` — person/pet follow is currently armed.
29288
- * - `flash` — the on-camera fill light is on.
29289
- * - `lightMode` — auto vs manual fill-light mode.
29290
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29291
- * `lightMode === 'manual'`.
29292
- */
29293
- var NavigationStatusSchema = object({
29294
- mode: _enum([
29295
- "idle",
29296
- "cleaning",
29297
- "spot",
29298
- "following",
29299
- "goto",
29300
- "returning",
29301
- "paused",
29302
- "unknown"
29303
- ]),
29304
- following: boolean(),
29305
- flash: boolean(),
29306
- lightMode: NavigationLightModeSchema,
29307
- lightLevel: number().min(40).max(100),
29308
- /** Ms epoch when the slice was last updated. */
29309
- lastChangedAt: number()
29310
- });
29311
- /**
29312
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29313
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29314
- * convention.
29315
- */
29316
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29317
- var navigationCapability = {
29318
- name: "navigation",
29319
- scope: "device",
29320
- deviceNative: true,
29321
- mode: "singleton",
29322
- deviceTypes: [DeviceType.Camera],
29323
- deviceConfig: { ui: {
29324
- kind: "widget",
29325
- widgetId: "host/navigation-panel",
29326
- tab: "navigation",
29327
- topTab: true,
29328
- label: "Navigation",
29329
- order: 0
29330
- } },
29331
- methods: {
29332
- /**
29333
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29334
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29335
- * path) works for any authenticated user, not admin-only. The UI sends
29336
- * these at ~1 Hz while a control is held; the provider forwards each one to
29337
- * a single drive write WITHOUT debouncing.
29338
- */
29339
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29340
- /** Halt all motion immediately (zero drive vector). */
29341
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29342
- /** Send the robot to a point on its live map. */
29343
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29344
- /**
29345
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29346
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29347
- */
29348
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29349
- /**
29350
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29351
- * unsupported action ids are rejected by the provider.
29352
- */
29353
- runAction: method(object({
29354
- deviceId: number(),
29355
- actionId: NavigationActionIdSchema
29356
- }), _void(), { kind: "mutation" }),
29357
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29358
- playSound: method(object({
29359
- deviceId: number(),
29360
- soundId: number().int()
29361
- }), _void(), { kind: "mutation" }),
29362
- /**
29363
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29364
- * works anytime, no active stream required).
29365
- */
29366
- setLightOn: method(object({
29367
- deviceId: number(),
29368
- on: boolean()
29369
- }), _void(), { kind: "mutation" }),
29370
- /**
29371
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29372
- * initial `level`. The auto/manual + level control is a CAMERA-service
29373
- * action that generally needs an active camera stream/monitor session — the
29374
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29375
- */
29376
- setLightMode: method(object({
29377
- deviceId: number(),
29378
- mode: NavigationLightModeSchema,
29379
- level: number().min(40).max(100).optional()
29380
- }), _void(), { kind: "mutation" }),
29381
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29382
- setLightLevel: method(object({
29383
- deviceId: number(),
29384
- level: number().min(40).max(100)
29385
- }), _void(), { kind: "mutation" }),
29386
- /**
29387
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29388
- * controls the UI shows (the per-entry flags for the dictionary come back on
29389
- * `listActions`).
29390
- */
29391
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29392
- },
29393
- events: { onStatusChanged: { data: object({
29394
- deviceId: number(),
29395
- status: NavigationStatusSchema
29396
- }) } },
29397
- status: {
29398
- schema: NavigationStatusSchema,
29399
- kind: "push"
29400
- },
29401
- /**
29402
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29403
- * for live mode / follow / flash changes.
29404
- */
29405
- runtimeState: NavigationRuntimeStateSchema,
29406
- /**
29407
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29408
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29409
- * that. The live handle re-publishes on connect.
29410
- *
29411
- * See `RuntimeStateDurability`. Enforced by
29412
- * `scripts/check-runtime-state-durability.ts`.
29413
- */
29414
- durability: "session"
29415
- };
29416
29539
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29417
29540
  kind: "mutation",
29418
29541
  auth: "admin"
@@ -38875,6 +38998,12 @@ Object.freeze({
38875
38998
  addonId: null,
38876
38999
  access: "view"
38877
39000
  },
39001
+ "storage.listDrainProgress": {
39002
+ capName: "storage",
39003
+ capScope: "system",
39004
+ addonId: null,
39005
+ access: "view"
39006
+ },
38878
39007
  "storage.listLocationDeclarations": {
38879
39008
  capName: "storage",
38880
39009
  capScope: "system",
@@ -39019,6 +39148,12 @@ Object.freeze({
39019
39148
  addonId: null,
39020
39149
  access: "view"
39021
39150
  },
39151
+ "storageOccupancy.getOccupancy": {
39152
+ capName: "storage-occupancy",
39153
+ capScope: "system",
39154
+ addonId: null,
39155
+ access: "view"
39156
+ },
39022
39157
  "storageProvider.abortUpload": {
39023
39158
  capName: "storage-provider",
39024
39159
  capScope: "system",