@camstack/addon-provider-gree 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
@@ -1,7 +1,7 @@
1
1
  import { createSocket } from "dgram";
2
2
  import { createCipheriv, createDecipheriv } from "crypto";
3
3
  import { EventEmitter } from "events";
4
- //#region ../types/dist/event-category-zAv7pMUz.mjs
4
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -196,6 +196,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
196
196
  EventCategory["ProcessCrashed"] = "process.crashed";
197
197
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
198
198
  EventCategory["ProcessRestarted"] = "process.restarted";
199
+ /**
200
+ * The SET of storage locations changed — one was created, edited, enabled,
201
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
202
+ *
203
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
204
+ * it must also converge on its own periodic path, because a dropped event
205
+ * must not leave a node writing to yesterday's disk set forever. It exists
206
+ * because there was NO signal at all — an operator who added a second
207
+ * recordings disk in the admin UI got nothing, and the recorder kept its
208
+ * resolved locations until something else happened to re-resolve them
209
+ * (D387). Payload `StorageLocationsChangedPayload`.
210
+ */
211
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
199
212
  EventCategory["RecordingStarted"] = "recording.started";
200
213
  EventCategory["RecordingStopped"] = "recording.stopped";
201
214
  EventCategory["RecordingError"] = "recording.error";
@@ -8538,6 +8551,21 @@ var StorageCleanupJobSchema = object({
8538
8551
  });
8539
8552
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8540
8553
  /**
8554
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8555
+ * alias below is `z.infer<>` of it, never a second spelling.
8556
+ */
8557
+ var StorageLocationModeSchema = _enum([
8558
+ "active",
8559
+ "readonly",
8560
+ "drain",
8561
+ "disabled"
8562
+ ]);
8563
+ _enum([
8564
+ "normal",
8565
+ "never",
8566
+ "drain"
8567
+ ]);
8568
+ /**
8541
8569
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8542
8570
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8543
8571
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8603,6 +8631,21 @@ var StorageLocationSchema = object({
8603
8631
  * stops existing rather than being re-derived on every read.
8604
8632
  */
8605
8633
  enabled: boolean().optional(),
8634
+ /**
8635
+ * THE state of this location (D385), and the only authority on what may be
8636
+ * written, read or evicted here. Interpreted in exactly one place —
8637
+ * `storage-location-mode.ts` — which also folds the legacy
8638
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8639
+ * ambiguous.
8640
+ *
8641
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8642
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8643
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8644
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8645
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8646
+ * either, so the two cannot disagree.
8647
+ */
8648
+ mode: StorageLocationModeSchema.optional(),
8606
8649
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8607
8650
  * for node-local locations it can reach) — never persisted, absent when the
8608
8651
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8610,11 +8653,46 @@ var StorageLocationSchema = object({
8610
8653
  totalBytes: number(),
8611
8654
  availableBytes: number()
8612
8655
  }).nullable().optional(),
8656
+ /**
8657
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8658
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8659
+ * never persisted, never a filesystem walk.
8660
+ *
8661
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8662
+ * location yet — nobody stores here, the owning addon is down, or the first
8663
+ * refresh has not completed. A UI must omit the segment rather than draw it
8664
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8665
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8666
+ * be spelled out loud instead of appearing by accident.
8667
+ *
8668
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8669
+ * about the whole figure rather than about its freshest part.
8670
+ */
8671
+ owned: object({
8672
+ bytes: number().int().nonnegative(),
8673
+ measuredAtMs: number().int().nonnegative()
8674
+ }).optional(),
8613
8675
  createdAt: number(),
8614
8676
  updatedAt: number()
8615
8677
  });
8616
8678
  object({ isDefault: boolean().optional() });
8617
8679
  /**
8680
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8681
+ *
8682
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8683
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8684
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8685
+ * operator learns not to believe the screen.
8686
+ */
8687
+ var StorageDrainProgressSchema = object({
8688
+ locationId: string(),
8689
+ startedAtMs: number(),
8690
+ startBytes: number(),
8691
+ bytesRemaining: number(),
8692
+ drained: boolean(),
8693
+ estimatedEmptyAtMs: number().nullable()
8694
+ });
8695
+ /**
8618
8696
  * Reference accepted by consumer-facing `api.storage.*` calls.
8619
8697
  * Either:
8620
8698
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -21943,7 +22021,7 @@ method(object({
21943
22021
  }), _void(), {
21944
22022
  kind: "mutation",
21945
22023
  auth: "admin"
21946
- }), method(object({ id: string() }), object({
22024
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
21947
22025
  ok: boolean(),
21948
22026
  error: string().optional()
21949
22027
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22013,6 +22091,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22013
22091
  kind: "mutation",
22014
22092
  auth: "admin"
22015
22093
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22094
+ /**
22095
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22096
+ * location (D388).
22097
+ *
22098
+ * ## Why this is not `storage-evictable`
22099
+ *
22100
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22101
+ * not, in two ways that both matter and both bite hardest on the locations an
22102
+ * operator most wants a figure for:
22103
+ *
22104
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22105
+ * and `recordingsLow:default` deliberately share one root and evict as one
22106
+ * oldest-first pool, so both answer with the SAME combined total. As an
22107
+ * occupancy figure that double-counts the disk.
22108
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22109
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22110
+ * is retiring and staring at.
22111
+ *
22112
+ * So this is its own contract with its own quantity, and the quantity is
22113
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22114
+ * would ever be willing to delete it. A provider that can only answer
22115
+ * "evictable" must not register here — a number that silently means different
22116
+ * things per class is worse than no number.
22117
+ *
22118
+ * ## Absence is an answer
22119
+ *
22120
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22121
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22122
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22123
+ * consuming side has to be written out loud instead of appearing by accident.
22124
+ *
22125
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22126
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22127
+ */
22128
+ /** One provider's occupancy answer for one location. */
22129
+ var StorageOccupancyReportSchema = object({
22130
+ locationId: string(),
22131
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22132
+ * not net of what it is willing to delete. */
22133
+ ownedBytes: number().int().nonnegative(),
22134
+ /** When the provider last actually measured this. The orchestrator carries it
22135
+ * through so a UI can say how old the figure is instead of implying "now". */
22136
+ measuredAtMs: number().int().nonnegative()
22137
+ });
22138
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22016
22139
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22017
22140
  providerId: string().min(1),
22018
22141
  displayName: string().min(1),
@@ -23848,88 +23971,6 @@ onStatusChanged: { data: object({
23848
23971
  volatileStateFields: ["lastUpdated"]
23849
23972
  };
23850
23973
  /**
23851
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23852
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23853
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23854
- * one Home Assistant projection.
23855
- */
23856
- var NetworkLinkStatusSchema = object({
23857
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23858
- type: _enum([
23859
- "wifi",
23860
- "ethernet",
23861
- "cellular",
23862
- "unknown"
23863
- ]),
23864
- /**
23865
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23866
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23867
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23868
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23869
- * SKIP a null rather than coerce it.
23870
- */
23871
- signalPercent: number().min(0).max(100).nullable(),
23872
- /** Raw received signal strength in dBm, when the firmware reports one. */
23873
- rssiDbm: number().optional(),
23874
- /** Network name of a wireless link, when the firmware reports it. */
23875
- ssid: string().optional(),
23876
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23877
- lastUpdated: number()
23878
- });
23879
- var networkLinkCapability = {
23880
- name: "network-link",
23881
- scope: "device",
23882
- deviceNative: true,
23883
- mode: "singleton",
23884
- deviceTypes: [
23885
- DeviceType.Camera,
23886
- DeviceType.Sensor,
23887
- DeviceType.Button,
23888
- DeviceType.Switch,
23889
- DeviceType.Light,
23890
- DeviceType.Lock,
23891
- DeviceType.Siren
23892
- ],
23893
- methods: {},
23894
- events: {
23895
- /**
23896
- * Emitted whenever the cached status changes (a link switch, a signal
23897
- * reading that moved). Mirrored on the parent chain by the
23898
- * DeviceEventPropagator like `battery.onStatusChanged`.
23899
- */
23900
- onStatusChanged: { data: object({
23901
- deviceId: number(),
23902
- status: NetworkLinkStatusSchema
23903
- }) } },
23904
- status: {
23905
- schema: NetworkLinkStatusSchema,
23906
- kind: "push",
23907
- empty: {
23908
- type: "unknown",
23909
- signalPercent: null,
23910
- lastUpdated: 0
23911
- }
23912
- },
23913
- /**
23914
- * Runtime-state slice — every provider stores the same shape under
23915
- * `device.runtimeState['network-link']`, read once by the badge and the
23916
- * Home Assistant projector regardless of the driver.
23917
- */
23918
- runtimeState: NetworkLinkStatusSchema,
23919
- /**
23920
- * Runtime-state durability: **restored** — a link reading is slow to
23921
- * change and a sleeping battery camera may not report for hours; the
23922
- * restored slice is what the badge shows until the next read.
23923
- *
23924
- * See `RuntimeStateDurability`. Enforced by
23925
- * `scripts/check-runtime-state-durability.ts`.
23926
- */
23927
- durability: "restored",
23928
- /** Clock fields: written, but excluded from the compare that decides
23929
- * whether persisting is worth a SQLite commit. */
23930
- volatileStateFields: ["lastUpdated"]
23931
- };
23932
- /**
23933
23974
  * Generic boolean sensor — last-resort fallback when no domain-
23934
23975
  * specific binary cap fits (Home Assistant `binary_sensor` without a
23935
23976
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27459,6 +27500,369 @@ var nativeObjectDetectionCapability = {
27459
27500
  volatileStateFields: ["lastFetchedAt"]
27460
27501
  };
27461
27502
  /**
27503
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27504
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27505
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27506
+ *
27507
+ * Why a NEW cap rather than overloading `ptz`:
27508
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27509
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27510
+ * The two are different physical models: PTZ is absolute-position + presets,
27511
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27512
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27513
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27514
+ * the reverse:
27515
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27516
+ * / `getOptions`), and
27517
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27518
+ * robot camera shows up in the existing PTZ control path without every
27519
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27520
+ * not here (see the addon design note):
27521
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27522
+ * ptz.stop() → navigation.stop()
27523
+ * ptz.goHome() → navigation.runAction('goHome')
27524
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27525
+ * ptz.goToPreset(id) → navigation.runAction(id)
27526
+ *
27527
+ * ## Continuous drive
27528
+ *
27529
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27530
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27531
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27532
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27533
+ * coalesce them. The UI owns the cadence.
27534
+ *
27535
+ * ## The action dictionary
27536
+ *
27537
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27538
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27539
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27540
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27541
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27542
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27543
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27544
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27545
+ *
27546
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27547
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27548
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27549
+ * every device handle. A future nodedreame publish adds a typed
27550
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27551
+ * provider can then swap the raw calls for the typed methods with no change to
27552
+ * THIS contract.
27553
+ */
27554
+ /**
27555
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27556
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27557
+ * halts it.
27558
+ *
27559
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27560
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27561
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27562
+ * vector by it (drivers without proportional drive ignore it).
27563
+ *
27564
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27565
+ * axis alone; an all-undefined nudge is a no-op.
27566
+ */
27567
+ var NavigationMoveCommandSchema = object({
27568
+ pan: number().min(-1).max(1).optional(),
27569
+ tilt: number().min(-1).max(1).optional(),
27570
+ speed: number().min(0).max(1).optional()
27571
+ });
27572
+ /**
27573
+ * The enumerated discrete actions a navigation-capable robot can perform via
27574
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27575
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27576
+ * `playSound` (see the `sound` dictionary entries).
27577
+ */
27578
+ var NavigationActionIdSchema = _enum([
27579
+ "goHome",
27580
+ "locate",
27581
+ "spotClean",
27582
+ "findPet",
27583
+ "personFollow",
27584
+ "stop",
27585
+ "startClean",
27586
+ "pauseClean",
27587
+ "dockWash",
27588
+ "autoEmpty",
27589
+ "flashOn",
27590
+ "flashOff"
27591
+ ]);
27592
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27593
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27594
+ /**
27595
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27596
+ * native panel and the PTZ mimic render as a button.
27597
+ *
27598
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27599
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27600
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27601
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27602
+ * - `label` — operator-facing English label.
27603
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27604
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27605
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27606
+ * flips it from config, never by editing code.
27607
+ */
27608
+ var NavigationActionEntrySchema = object({
27609
+ id: string(),
27610
+ kind: NavigationEntryKindSchema,
27611
+ label: string(),
27612
+ icon: string(),
27613
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27614
+ soundId: number().int().optional(),
27615
+ /** Per-device feature flag — render this entry only when true. */
27616
+ enabled: boolean()
27617
+ });
27618
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27619
+ var NavigationPointSchema = object({
27620
+ x: number(),
27621
+ y: number()
27622
+ });
27623
+ /**
27624
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27625
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27626
+ * that are turned on for THIS device. Data-driven: the provider derives these
27627
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27628
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27629
+ * that are not dictionary entries.
27630
+ *
27631
+ * - `move` / `stop` — the momentary drive joystick.
27632
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27633
+ * map-coordinate plumbing is wired.
27634
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27635
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27636
+ * - `light` — the on/off fill-light toggle (works anytime).
27637
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27638
+ * camera-service control; needs an active stream).
27639
+ */
27640
+ var NavigationFeaturesSchema = object({
27641
+ move: boolean(),
27642
+ stop: boolean(),
27643
+ goToPoint: boolean(),
27644
+ runAction: boolean(),
27645
+ playSound: boolean(),
27646
+ light: boolean(),
27647
+ lightMode: boolean()
27648
+ });
27649
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27650
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27651
+ /**
27652
+ * Live navigation state so the UI can reflect what the robot is doing:
27653
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27654
+ * - `following` — person/pet follow is currently armed.
27655
+ * - `flash` — the on-camera fill light is on.
27656
+ * - `lightMode` — auto vs manual fill-light mode.
27657
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27658
+ * `lightMode === 'manual'`.
27659
+ */
27660
+ var NavigationStatusSchema = object({
27661
+ mode: _enum([
27662
+ "idle",
27663
+ "cleaning",
27664
+ "spot",
27665
+ "following",
27666
+ "goto",
27667
+ "returning",
27668
+ "paused",
27669
+ "unknown"
27670
+ ]),
27671
+ following: boolean(),
27672
+ flash: boolean(),
27673
+ lightMode: NavigationLightModeSchema,
27674
+ lightLevel: number().min(40).max(100),
27675
+ /** Ms epoch when the slice was last updated. */
27676
+ lastChangedAt: number()
27677
+ });
27678
+ /**
27679
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27680
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27681
+ * convention.
27682
+ */
27683
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27684
+ var navigationCapability = {
27685
+ name: "navigation",
27686
+ scope: "device",
27687
+ deviceNative: true,
27688
+ mode: "singleton",
27689
+ deviceTypes: [DeviceType.Camera],
27690
+ deviceConfig: { ui: {
27691
+ kind: "widget",
27692
+ widgetId: "host/navigation-panel",
27693
+ tab: "navigation",
27694
+ topTab: true,
27695
+ label: "Navigation",
27696
+ order: 0
27697
+ } },
27698
+ methods: {
27699
+ /**
27700
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27701
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27702
+ * path) works for any authenticated user, not admin-only. The UI sends
27703
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27704
+ * a single drive write WITHOUT debouncing.
27705
+ */
27706
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27707
+ /** Halt all motion immediately (zero drive vector). */
27708
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27709
+ /** Send the robot to a point on its live map. */
27710
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27711
+ /**
27712
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27713
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27714
+ */
27715
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27716
+ /**
27717
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27718
+ * unsupported action ids are rejected by the provider.
27719
+ */
27720
+ runAction: method(object({
27721
+ deviceId: number(),
27722
+ actionId: NavigationActionIdSchema
27723
+ }), _void(), { kind: "mutation" }),
27724
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27725
+ playSound: method(object({
27726
+ deviceId: number(),
27727
+ soundId: number().int()
27728
+ }), _void(), { kind: "mutation" }),
27729
+ /**
27730
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27731
+ * works anytime, no active stream required).
27732
+ */
27733
+ setLightOn: method(object({
27734
+ deviceId: number(),
27735
+ on: boolean()
27736
+ }), _void(), { kind: "mutation" }),
27737
+ /**
27738
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27739
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27740
+ * action that generally needs an active camera stream/monitor session — the
27741
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27742
+ */
27743
+ setLightMode: method(object({
27744
+ deviceId: number(),
27745
+ mode: NavigationLightModeSchema,
27746
+ level: number().min(40).max(100).optional()
27747
+ }), _void(), { kind: "mutation" }),
27748
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27749
+ setLightLevel: method(object({
27750
+ deviceId: number(),
27751
+ level: number().min(40).max(100)
27752
+ }), _void(), { kind: "mutation" }),
27753
+ /**
27754
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27755
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27756
+ * `listActions`).
27757
+ */
27758
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27759
+ },
27760
+ events: { onStatusChanged: { data: object({
27761
+ deviceId: number(),
27762
+ status: NavigationStatusSchema
27763
+ }) } },
27764
+ status: {
27765
+ schema: NavigationStatusSchema,
27766
+ kind: "push"
27767
+ },
27768
+ /**
27769
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27770
+ * for live mode / follow / flash changes.
27771
+ */
27772
+ runtimeState: NavigationRuntimeStateSchema,
27773
+ /**
27774
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27775
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27776
+ * that. The live handle re-publishes on connect.
27777
+ *
27778
+ * See `RuntimeStateDurability`. Enforced by
27779
+ * `scripts/check-runtime-state-durability.ts`.
27780
+ */
27781
+ durability: "session"
27782
+ };
27783
+ /**
27784
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27785
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27786
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27787
+ * one Home Assistant projection.
27788
+ */
27789
+ var NetworkLinkStatusSchema = object({
27790
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27791
+ type: _enum([
27792
+ "wifi",
27793
+ "ethernet",
27794
+ "cellular",
27795
+ "unknown"
27796
+ ]),
27797
+ /**
27798
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27799
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27800
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27801
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27802
+ * SKIP a null rather than coerce it.
27803
+ */
27804
+ signalPercent: number().min(0).max(100).nullable(),
27805
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27806
+ rssiDbm: number().optional(),
27807
+ /** Network name of a wireless link, when the firmware reports it. */
27808
+ ssid: string().optional(),
27809
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27810
+ lastUpdated: number()
27811
+ });
27812
+ var networkLinkCapability = {
27813
+ name: "network-link",
27814
+ scope: "device",
27815
+ deviceNative: true,
27816
+ mode: "singleton",
27817
+ deviceTypes: [
27818
+ DeviceType.Camera,
27819
+ DeviceType.Sensor,
27820
+ DeviceType.Button,
27821
+ DeviceType.Switch,
27822
+ DeviceType.Light,
27823
+ DeviceType.Lock,
27824
+ DeviceType.Siren
27825
+ ],
27826
+ methods: {},
27827
+ events: {
27828
+ /**
27829
+ * Emitted whenever the cached status changes (a link switch, a signal
27830
+ * reading that moved). Mirrored on the parent chain by the
27831
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27832
+ */
27833
+ onStatusChanged: { data: object({
27834
+ deviceId: number(),
27835
+ status: NetworkLinkStatusSchema
27836
+ }) } },
27837
+ status: {
27838
+ schema: NetworkLinkStatusSchema,
27839
+ kind: "push",
27840
+ empty: {
27841
+ type: "unknown",
27842
+ signalPercent: null,
27843
+ lastUpdated: 0
27844
+ }
27845
+ },
27846
+ /**
27847
+ * Runtime-state slice — every provider stores the same shape under
27848
+ * `device.runtimeState['network-link']`, read once by the badge and the
27849
+ * Home Assistant projector regardless of the driver.
27850
+ */
27851
+ runtimeState: NetworkLinkStatusSchema,
27852
+ /**
27853
+ * Runtime-state durability: **restored** — a link reading is slow to
27854
+ * change and a sleeping battery camera may not report for hours; the
27855
+ * restored slice is what the badge shows until the next read.
27856
+ *
27857
+ * See `RuntimeStateDurability`. Enforced by
27858
+ * `scripts/check-runtime-state-durability.ts`.
27859
+ */
27860
+ durability: "restored",
27861
+ /** Clock fields: written, but excluded from the compare that decides
27862
+ * whether persisting is worth a SQLite commit. */
27863
+ volatileStateFields: ["lastUpdated"]
27864
+ };
27865
+ /**
27462
27866
  * network-quality — system-scoped singleton capability tracking RTT,
27463
27867
  * jitter, and observed/peak bandwidth per device + per client.
27464
27868
  *
@@ -29039,287 +29443,6 @@ var ptzAutotrackCapability = {
29039
29443
  */
29040
29444
  durability: "session"
29041
29445
  };
29042
- /**
29043
- * `navigation` — a device-scoped capability that natively expresses the FULL
29044
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29045
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29046
- *
29047
- * Why a NEW cap rather than overloading `ptz`:
29048
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29049
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29050
- * The two are different physical models: PTZ is absolute-position + presets,
29051
- * navigation is momentary drive nudges + discrete robot ACTIONS
29052
- * (dock / spot-clean / follow-pet / go-to-point / …).
29053
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29054
- * the reverse:
29055
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29056
- * / `getOptions`), and
29057
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29058
- * robot camera shows up in the existing PTZ control path without every
29059
- * PTZ provider learning about robots. The mapping lives in the adapter,
29060
- * not here (see the addon design note):
29061
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29062
- * ptz.stop() → navigation.stop()
29063
- * ptz.goHome() → navigation.runAction('goHome')
29064
- * ptz.getPresets() → navigation.listActions() (id→preset)
29065
- * ptz.goToPreset(id) → navigation.runAction(id)
29066
- *
29067
- * ## Continuous drive
29068
- *
29069
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29070
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29071
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29072
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29073
- * coalesce them. The UI owns the cadence.
29074
- *
29075
- * ## The action dictionary
29076
- *
29077
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29078
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29079
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29080
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29081
- * vendor-specific list. `kind: 'action'` entries are triggered with
29082
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29083
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29084
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29085
- *
29086
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29087
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29088
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29089
- * every device handle. A future nodedreame publish adds a typed
29090
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29091
- * provider can then swap the raw calls for the typed methods with no change to
29092
- * THIS contract.
29093
- */
29094
- /**
29095
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29096
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29097
- * halts it.
29098
- *
29099
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29100
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29101
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29102
- * vector by it (drivers without proportional drive ignore it).
29103
- *
29104
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29105
- * axis alone; an all-undefined nudge is a no-op.
29106
- */
29107
- var NavigationMoveCommandSchema = object({
29108
- pan: number().min(-1).max(1).optional(),
29109
- tilt: number().min(-1).max(1).optional(),
29110
- speed: number().min(0).max(1).optional()
29111
- });
29112
- /**
29113
- * The enumerated discrete actions a navigation-capable robot can perform via
29114
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29115
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29116
- * `playSound` (see the `sound` dictionary entries).
29117
- */
29118
- var NavigationActionIdSchema = _enum([
29119
- "goHome",
29120
- "locate",
29121
- "spotClean",
29122
- "findPet",
29123
- "personFollow",
29124
- "stop",
29125
- "startClean",
29126
- "pauseClean",
29127
- "dockWash",
29128
- "autoEmpty",
29129
- "flashOn",
29130
- "flashOff"
29131
- ]);
29132
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29133
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29134
- /**
29135
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29136
- * native panel and the PTZ mimic render as a button.
29137
- *
29138
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29139
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29140
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29141
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29142
- * - `label` — operator-facing English label.
29143
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29144
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29145
- * PTZ render ONLY enabled entries. Data-driven: the provider
29146
- * flips it from config, never by editing code.
29147
- */
29148
- var NavigationActionEntrySchema = object({
29149
- id: string(),
29150
- kind: NavigationEntryKindSchema,
29151
- label: string(),
29152
- icon: string(),
29153
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29154
- soundId: number().int().optional(),
29155
- /** Per-device feature flag — render this entry only when true. */
29156
- enabled: boolean()
29157
- });
29158
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29159
- var NavigationPointSchema = object({
29160
- x: number(),
29161
- y: number()
29162
- });
29163
- /**
29164
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29165
- * The cap reports which are enabled so the UI / PTZ render only the controls
29166
- * that are turned on for THIS device. Data-driven: the provider derives these
29167
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29168
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29169
- * that are not dictionary entries.
29170
- *
29171
- * - `move` / `stop` — the momentary drive joystick.
29172
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29173
- * map-coordinate plumbing is wired.
29174
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29175
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29176
- * - `light` — the on/off fill-light toggle (works anytime).
29177
- * - `lightMode` — the auto/manual selector + manual level slider (a
29178
- * camera-service control; needs an active stream).
29179
- */
29180
- var NavigationFeaturesSchema = object({
29181
- move: boolean(),
29182
- stop: boolean(),
29183
- goToPoint: boolean(),
29184
- runAction: boolean(),
29185
- playSound: boolean(),
29186
- light: boolean(),
29187
- lightMode: boolean()
29188
- });
29189
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29190
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29191
- /**
29192
- * Live navigation state so the UI can reflect what the robot is doing:
29193
- * - `mode` — coarse activity (idle / cleaning / following / …).
29194
- * - `following` — person/pet follow is currently armed.
29195
- * - `flash` — the on-camera fill light is on.
29196
- * - `lightMode` — auto vs manual fill-light mode.
29197
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29198
- * `lightMode === 'manual'`.
29199
- */
29200
- var NavigationStatusSchema = object({
29201
- mode: _enum([
29202
- "idle",
29203
- "cleaning",
29204
- "spot",
29205
- "following",
29206
- "goto",
29207
- "returning",
29208
- "paused",
29209
- "unknown"
29210
- ]),
29211
- following: boolean(),
29212
- flash: boolean(),
29213
- lightMode: NavigationLightModeSchema,
29214
- lightLevel: number().min(40).max(100),
29215
- /** Ms epoch when the slice was last updated. */
29216
- lastChangedAt: number()
29217
- });
29218
- /**
29219
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29220
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29221
- * convention.
29222
- */
29223
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29224
- var navigationCapability = {
29225
- name: "navigation",
29226
- scope: "device",
29227
- deviceNative: true,
29228
- mode: "singleton",
29229
- deviceTypes: [DeviceType.Camera],
29230
- deviceConfig: { ui: {
29231
- kind: "widget",
29232
- widgetId: "host/navigation-panel",
29233
- tab: "navigation",
29234
- topTab: true,
29235
- label: "Navigation",
29236
- order: 0
29237
- } },
29238
- methods: {
29239
- /**
29240
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29241
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29242
- * path) works for any authenticated user, not admin-only. The UI sends
29243
- * these at ~1 Hz while a control is held; the provider forwards each one to
29244
- * a single drive write WITHOUT debouncing.
29245
- */
29246
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29247
- /** Halt all motion immediately (zero drive vector). */
29248
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29249
- /** Send the robot to a point on its live map. */
29250
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29251
- /**
29252
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29253
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29254
- */
29255
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29256
- /**
29257
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29258
- * unsupported action ids are rejected by the provider.
29259
- */
29260
- runAction: method(object({
29261
- deviceId: number(),
29262
- actionId: NavigationActionIdSchema
29263
- }), _void(), { kind: "mutation" }),
29264
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29265
- playSound: method(object({
29266
- deviceId: number(),
29267
- soundId: number().int()
29268
- }), _void(), { kind: "mutation" }),
29269
- /**
29270
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29271
- * works anytime, no active stream required).
29272
- */
29273
- setLightOn: method(object({
29274
- deviceId: number(),
29275
- on: boolean()
29276
- }), _void(), { kind: "mutation" }),
29277
- /**
29278
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29279
- * initial `level`. The auto/manual + level control is a CAMERA-service
29280
- * action that generally needs an active camera stream/monitor session — the
29281
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29282
- */
29283
- setLightMode: method(object({
29284
- deviceId: number(),
29285
- mode: NavigationLightModeSchema,
29286
- level: number().min(40).max(100).optional()
29287
- }), _void(), { kind: "mutation" }),
29288
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29289
- setLightLevel: method(object({
29290
- deviceId: number(),
29291
- level: number().min(40).max(100)
29292
- }), _void(), { kind: "mutation" }),
29293
- /**
29294
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29295
- * controls the UI shows (the per-entry flags for the dictionary come back on
29296
- * `listActions`).
29297
- */
29298
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29299
- },
29300
- events: { onStatusChanged: { data: object({
29301
- deviceId: number(),
29302
- status: NavigationStatusSchema
29303
- }) } },
29304
- status: {
29305
- schema: NavigationStatusSchema,
29306
- kind: "push"
29307
- },
29308
- /**
29309
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29310
- * for live mode / follow / flash changes.
29311
- */
29312
- runtimeState: NavigationRuntimeStateSchema,
29313
- /**
29314
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29315
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29316
- * that. The live handle re-publishes on connect.
29317
- *
29318
- * See `RuntimeStateDurability`. Enforced by
29319
- * `scripts/check-runtime-state-durability.ts`.
29320
- */
29321
- durability: "session"
29322
- };
29323
29446
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29324
29447
  kind: "mutation",
29325
29448
  auth: "admin"
@@ -38782,6 +38905,12 @@ Object.freeze({
38782
38905
  addonId: null,
38783
38906
  access: "view"
38784
38907
  },
38908
+ "storage.listDrainProgress": {
38909
+ capName: "storage",
38910
+ capScope: "system",
38911
+ addonId: null,
38912
+ access: "view"
38913
+ },
38785
38914
  "storage.listLocationDeclarations": {
38786
38915
  capName: "storage",
38787
38916
  capScope: "system",
@@ -38926,6 +39055,12 @@ Object.freeze({
38926
39055
  addonId: null,
38927
39056
  access: "view"
38928
39057
  },
39058
+ "storageOccupancy.getOccupancy": {
39059
+ capName: "storage-occupancy",
39060
+ capScope: "system",
39061
+ addonId: null,
39062
+ access: "view"
39063
+ },
38929
39064
  "storageProvider.abortUpload": {
38930
39065
  capName: "storage-provider",
38931
39066
  capScope: "system",