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