@camstack/addon-provider-petkit 0.2.79 → 0.2.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +500 -365
  2. package/dist/addon.mjs +500 -365
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -1100,7 +1100,7 @@ var Nodepetkit = class {
1100
1100
  }
1101
1101
  };
1102
1102
  //#endregion
1103
- //#region ../types/dist/event-category-zAv7pMUz.mjs
1103
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
1104
1104
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1105
1105
  EventCategory["SystemBoot"] = "system.boot";
1106
1106
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1295,6 +1295,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1295
1295
  EventCategory["ProcessCrashed"] = "process.crashed";
1296
1296
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
1297
1297
  EventCategory["ProcessRestarted"] = "process.restarted";
1298
+ /**
1299
+ * The SET of storage locations changed — one was created, edited, enabled,
1300
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
1301
+ *
1302
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
1303
+ * it must also converge on its own periodic path, because a dropped event
1304
+ * must not leave a node writing to yesterday's disk set forever. It exists
1305
+ * because there was NO signal at all — an operator who added a second
1306
+ * recordings disk in the admin UI got nothing, and the recorder kept its
1307
+ * resolved locations until something else happened to re-resolve them
1308
+ * (D387). Payload `StorageLocationsChangedPayload`.
1309
+ */
1310
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
1298
1311
  EventCategory["RecordingStarted"] = "recording.started";
1299
1312
  EventCategory["RecordingStopped"] = "recording.stopped";
1300
1313
  EventCategory["RecordingError"] = "recording.error";
@@ -9637,6 +9650,21 @@ var StorageCleanupJobSchema = object({
9637
9650
  });
9638
9651
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
9639
9652
  /**
9653
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
9654
+ * alias below is `z.infer<>` of it, never a second spelling.
9655
+ */
9656
+ var StorageLocationModeSchema = _enum([
9657
+ "active",
9658
+ "readonly",
9659
+ "drain",
9660
+ "disabled"
9661
+ ]);
9662
+ _enum([
9663
+ "normal",
9664
+ "never",
9665
+ "drain"
9666
+ ]);
9667
+ /**
9640
9668
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9641
9669
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9642
9670
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9702,6 +9730,21 @@ var StorageLocationSchema = object({
9702
9730
  * stops existing rather than being re-derived on every read.
9703
9731
  */
9704
9732
  enabled: boolean().optional(),
9733
+ /**
9734
+ * THE state of this location (D385), and the only authority on what may be
9735
+ * written, read or evicted here. Interpreted in exactly one place —
9736
+ * `storage-location-mode.ts` — which also folds the legacy
9737
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
9738
+ * ambiguous.
9739
+ *
9740
+ * OPTIONAL only for the wire and for rows written before D385: absence is
9741
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
9742
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
9743
+ * re-derived on every read. `enabled` survives one release as a DERIVED
9744
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
9745
+ * either, so the two cannot disagree.
9746
+ */
9747
+ mode: StorageLocationModeSchema.optional(),
9705
9748
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
9706
9749
  * for node-local locations it can reach) — never persisted, absent when the
9707
9750
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9709,11 +9752,46 @@ var StorageLocationSchema = object({
9709
9752
  totalBytes: number(),
9710
9753
  availableBytes: number()
9711
9754
  }).nullable().optional(),
9755
+ /**
9756
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9757
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9758
+ * never persisted, never a filesystem walk.
9759
+ *
9760
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9761
+ * location yet — nobody stores here, the owning addon is down, or the first
9762
+ * refresh has not completed. A UI must omit the segment rather than draw it
9763
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9764
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9765
+ * be spelled out loud instead of appearing by accident.
9766
+ *
9767
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9768
+ * about the whole figure rather than about its freshest part.
9769
+ */
9770
+ owned: object({
9771
+ bytes: number().int().nonnegative(),
9772
+ measuredAtMs: number().int().nonnegative()
9773
+ }).optional(),
9712
9774
  createdAt: number(),
9713
9775
  updatedAt: number()
9714
9776
  });
9715
9777
  object({ isDefault: boolean().optional() });
9716
9778
  /**
9779
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9780
+ *
9781
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9782
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9783
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9784
+ * operator learns not to believe the screen.
9785
+ */
9786
+ var StorageDrainProgressSchema = object({
9787
+ locationId: string(),
9788
+ startedAtMs: number(),
9789
+ startBytes: number(),
9790
+ bytesRemaining: number(),
9791
+ drained: boolean(),
9792
+ estimatedEmptyAtMs: number().nullable()
9793
+ });
9794
+ /**
9717
9795
  * Reference accepted by consumer-facing `api.storage.*` calls.
9718
9796
  * Either:
9719
9797
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -23059,7 +23137,7 @@ method(object({
23059
23137
  }), _void(), {
23060
23138
  kind: "mutation",
23061
23139
  auth: "admin"
23062
- }), method(object({ id: string() }), object({
23140
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
23063
23141
  ok: boolean(),
23064
23142
  error: string().optional()
23065
23143
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -23129,6 +23207,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
23129
23207
  kind: "mutation",
23130
23208
  auth: "admin"
23131
23209
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
23210
+ /**
23211
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23212
+ * location (D388).
23213
+ *
23214
+ * ## Why this is not `storage-evictable`
23215
+ *
23216
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23217
+ * not, in two ways that both matter and both bite hardest on the locations an
23218
+ * operator most wants a figure for:
23219
+ *
23220
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23221
+ * and `recordingsLow:default` deliberately share one root and evict as one
23222
+ * oldest-first pool, so both answer with the SAME combined total. As an
23223
+ * occupancy figure that double-counts the disk.
23224
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23225
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23226
+ * is retiring and staring at.
23227
+ *
23228
+ * So this is its own contract with its own quantity, and the quantity is
23229
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23230
+ * would ever be willing to delete it. A provider that can only answer
23231
+ * "evictable" must not register here — a number that silently means different
23232
+ * things per class is worse than no number.
23233
+ *
23234
+ * ## Absence is an answer
23235
+ *
23236
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23237
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23238
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23239
+ * consuming side has to be written out loud instead of appearing by accident.
23240
+ *
23241
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23242
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23243
+ */
23244
+ /** One provider's occupancy answer for one location. */
23245
+ var StorageOccupancyReportSchema = object({
23246
+ locationId: string(),
23247
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23248
+ * not net of what it is willing to delete. */
23249
+ ownedBytes: number().int().nonnegative(),
23250
+ /** When the provider last actually measured this. The orchestrator carries it
23251
+ * through so a UI can say how old the figure is instead of implying "now". */
23252
+ measuredAtMs: number().int().nonnegative()
23253
+ });
23254
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
23132
23255
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
23133
23256
  providerId: string().min(1),
23134
23257
  displayName: string().min(1),
@@ -24964,88 +25087,6 @@ onStatusChanged: { data: object({
24964
25087
  volatileStateFields: ["lastUpdated"]
24965
25088
  };
24966
25089
  /**
24967
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24968
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24969
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24970
- * one Home Assistant projection.
24971
- */
24972
- var NetworkLinkStatusSchema = object({
24973
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24974
- type: _enum([
24975
- "wifi",
24976
- "ethernet",
24977
- "cellular",
24978
- "unknown"
24979
- ]),
24980
- /**
24981
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24982
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24983
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24984
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24985
- * SKIP a null rather than coerce it.
24986
- */
24987
- signalPercent: number().min(0).max(100).nullable(),
24988
- /** Raw received signal strength in dBm, when the firmware reports one. */
24989
- rssiDbm: number().optional(),
24990
- /** Network name of a wireless link, when the firmware reports it. */
24991
- ssid: string().optional(),
24992
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24993
- lastUpdated: number()
24994
- });
24995
- var networkLinkCapability = {
24996
- name: "network-link",
24997
- scope: "device",
24998
- deviceNative: true,
24999
- mode: "singleton",
25000
- deviceTypes: [
25001
- DeviceType.Camera,
25002
- DeviceType.Sensor,
25003
- DeviceType.Button,
25004
- DeviceType.Switch,
25005
- DeviceType.Light,
25006
- DeviceType.Lock,
25007
- DeviceType.Siren
25008
- ],
25009
- methods: {},
25010
- events: {
25011
- /**
25012
- * Emitted whenever the cached status changes (a link switch, a signal
25013
- * reading that moved). Mirrored on the parent chain by the
25014
- * DeviceEventPropagator like `battery.onStatusChanged`.
25015
- */
25016
- onStatusChanged: { data: object({
25017
- deviceId: number(),
25018
- status: NetworkLinkStatusSchema
25019
- }) } },
25020
- status: {
25021
- schema: NetworkLinkStatusSchema,
25022
- kind: "push",
25023
- empty: {
25024
- type: "unknown",
25025
- signalPercent: null,
25026
- lastUpdated: 0
25027
- }
25028
- },
25029
- /**
25030
- * Runtime-state slice — every provider stores the same shape under
25031
- * `device.runtimeState['network-link']`, read once by the badge and the
25032
- * Home Assistant projector regardless of the driver.
25033
- */
25034
- runtimeState: NetworkLinkStatusSchema,
25035
- /**
25036
- * Runtime-state durability: **restored** — a link reading is slow to
25037
- * change and a sleeping battery camera may not report for hours; the
25038
- * restored slice is what the badge shows until the next read.
25039
- *
25040
- * See `RuntimeStateDurability`. Enforced by
25041
- * `scripts/check-runtime-state-durability.ts`.
25042
- */
25043
- durability: "restored",
25044
- /** Clock fields: written, but excluded from the compare that decides
25045
- * whether persisting is worth a SQLite commit. */
25046
- volatileStateFields: ["lastUpdated"]
25047
- };
25048
- /**
25049
25090
  * Generic boolean sensor — last-resort fallback when no domain-
25050
25091
  * specific binary cap fits (Home Assistant `binary_sensor` without a
25051
25092
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -28583,6 +28624,369 @@ var nativeObjectDetectionCapability = {
28583
28624
  volatileStateFields: ["lastFetchedAt"]
28584
28625
  };
28585
28626
  /**
28627
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28628
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28629
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28630
+ *
28631
+ * Why a NEW cap rather than overloading `ptz`:
28632
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28633
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28634
+ * The two are different physical models: PTZ is absolute-position + presets,
28635
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28636
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28637
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28638
+ * the reverse:
28639
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28640
+ * / `getOptions`), and
28641
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28642
+ * robot camera shows up in the existing PTZ control path without every
28643
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28644
+ * not here (see the addon design note):
28645
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28646
+ * ptz.stop() → navigation.stop()
28647
+ * ptz.goHome() → navigation.runAction('goHome')
28648
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28649
+ * ptz.goToPreset(id) → navigation.runAction(id)
28650
+ *
28651
+ * ## Continuous drive
28652
+ *
28653
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
28654
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
28655
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
28656
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
28657
+ * coalesce them. The UI owns the cadence.
28658
+ *
28659
+ * ## The action dictionary
28660
+ *
28661
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
28662
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
28663
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
28664
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
28665
+ * vendor-specific list. `kind: 'action'` entries are triggered with
28666
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
28667
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
28668
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
28669
+ *
28670
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
28671
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
28672
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
28673
+ * every device handle. A future nodedreame publish adds a typed
28674
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
28675
+ * provider can then swap the raw calls for the typed methods with no change to
28676
+ * THIS contract.
28677
+ */
28678
+ /**
28679
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
28680
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
28681
+ * halts it.
28682
+ *
28683
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
28684
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
28685
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
28686
+ * vector by it (drivers without proportional drive ignore it).
28687
+ *
28688
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
28689
+ * axis alone; an all-undefined nudge is a no-op.
28690
+ */
28691
+ var NavigationMoveCommandSchema = object({
28692
+ pan: number().min(-1).max(1).optional(),
28693
+ tilt: number().min(-1).max(1).optional(),
28694
+ speed: number().min(0).max(1).optional()
28695
+ });
28696
+ /**
28697
+ * The enumerated discrete actions a navigation-capable robot can perform via
28698
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
28699
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
28700
+ * `playSound` (see the `sound` dictionary entries).
28701
+ */
28702
+ var NavigationActionIdSchema = _enum([
28703
+ "goHome",
28704
+ "locate",
28705
+ "spotClean",
28706
+ "findPet",
28707
+ "personFollow",
28708
+ "stop",
28709
+ "startClean",
28710
+ "pauseClean",
28711
+ "dockWash",
28712
+ "autoEmpty",
28713
+ "flashOn",
28714
+ "flashOff"
28715
+ ]);
28716
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28717
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28718
+ /**
28719
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28720
+ * native panel and the PTZ mimic render as a button.
28721
+ *
28722
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28723
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28724
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28725
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28726
+ * - `label` — operator-facing English label.
28727
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28728
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28729
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28730
+ * flips it from config, never by editing code.
28731
+ */
28732
+ var NavigationActionEntrySchema = object({
28733
+ id: string(),
28734
+ kind: NavigationEntryKindSchema,
28735
+ label: string(),
28736
+ icon: string(),
28737
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28738
+ soundId: number().int().optional(),
28739
+ /** Per-device feature flag — render this entry only when true. */
28740
+ enabled: boolean()
28741
+ });
28742
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28743
+ var NavigationPointSchema = object({
28744
+ x: number(),
28745
+ y: number()
28746
+ });
28747
+ /**
28748
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28749
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28750
+ * that are turned on for THIS device. Data-driven: the provider derives these
28751
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28752
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28753
+ * that are not dictionary entries.
28754
+ *
28755
+ * - `move` / `stop` — the momentary drive joystick.
28756
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28757
+ * map-coordinate plumbing is wired.
28758
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28759
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28760
+ * - `light` — the on/off fill-light toggle (works anytime).
28761
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28762
+ * camera-service control; needs an active stream).
28763
+ */
28764
+ var NavigationFeaturesSchema = object({
28765
+ move: boolean(),
28766
+ stop: boolean(),
28767
+ goToPoint: boolean(),
28768
+ runAction: boolean(),
28769
+ playSound: boolean(),
28770
+ light: boolean(),
28771
+ lightMode: boolean()
28772
+ });
28773
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28774
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28775
+ /**
28776
+ * Live navigation state so the UI can reflect what the robot is doing:
28777
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28778
+ * - `following` — person/pet follow is currently armed.
28779
+ * - `flash` — the on-camera fill light is on.
28780
+ * - `lightMode` — auto vs manual fill-light mode.
28781
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28782
+ * `lightMode === 'manual'`.
28783
+ */
28784
+ var NavigationStatusSchema = object({
28785
+ mode: _enum([
28786
+ "idle",
28787
+ "cleaning",
28788
+ "spot",
28789
+ "following",
28790
+ "goto",
28791
+ "returning",
28792
+ "paused",
28793
+ "unknown"
28794
+ ]),
28795
+ following: boolean(),
28796
+ flash: boolean(),
28797
+ lightMode: NavigationLightModeSchema,
28798
+ lightLevel: number().min(40).max(100),
28799
+ /** Ms epoch when the slice was last updated. */
28800
+ lastChangedAt: number()
28801
+ });
28802
+ /**
28803
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28804
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28805
+ * convention.
28806
+ */
28807
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28808
+ var navigationCapability = {
28809
+ name: "navigation",
28810
+ scope: "device",
28811
+ deviceNative: true,
28812
+ mode: "singleton",
28813
+ deviceTypes: [DeviceType.Camera],
28814
+ deviceConfig: { ui: {
28815
+ kind: "widget",
28816
+ widgetId: "host/navigation-panel",
28817
+ tab: "navigation",
28818
+ topTab: true,
28819
+ label: "Navigation",
28820
+ order: 0
28821
+ } },
28822
+ methods: {
28823
+ /**
28824
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28825
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28826
+ * path) works for any authenticated user, not admin-only. The UI sends
28827
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28828
+ * a single drive write WITHOUT debouncing.
28829
+ */
28830
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28831
+ /** Halt all motion immediately (zero drive vector). */
28832
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28833
+ /** Send the robot to a point on its live map. */
28834
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28835
+ /**
28836
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28837
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28838
+ */
28839
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28840
+ /**
28841
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28842
+ * unsupported action ids are rejected by the provider.
28843
+ */
28844
+ runAction: method(object({
28845
+ deviceId: number(),
28846
+ actionId: NavigationActionIdSchema
28847
+ }), _void(), { kind: "mutation" }),
28848
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28849
+ playSound: method(object({
28850
+ deviceId: number(),
28851
+ soundId: number().int()
28852
+ }), _void(), { kind: "mutation" }),
28853
+ /**
28854
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28855
+ * works anytime, no active stream required).
28856
+ */
28857
+ setLightOn: method(object({
28858
+ deviceId: number(),
28859
+ on: boolean()
28860
+ }), _void(), { kind: "mutation" }),
28861
+ /**
28862
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28863
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28864
+ * action that generally needs an active camera stream/monitor session — the
28865
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28866
+ */
28867
+ setLightMode: method(object({
28868
+ deviceId: number(),
28869
+ mode: NavigationLightModeSchema,
28870
+ level: number().min(40).max(100).optional()
28871
+ }), _void(), { kind: "mutation" }),
28872
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28873
+ setLightLevel: method(object({
28874
+ deviceId: number(),
28875
+ level: number().min(40).max(100)
28876
+ }), _void(), { kind: "mutation" }),
28877
+ /**
28878
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28879
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28880
+ * `listActions`).
28881
+ */
28882
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28883
+ },
28884
+ events: { onStatusChanged: { data: object({
28885
+ deviceId: number(),
28886
+ status: NavigationStatusSchema
28887
+ }) } },
28888
+ status: {
28889
+ schema: NavigationStatusSchema,
28890
+ kind: "push"
28891
+ },
28892
+ /**
28893
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28894
+ * for live mode / follow / flash changes.
28895
+ */
28896
+ runtimeState: NavigationRuntimeStateSchema,
28897
+ /**
28898
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28899
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28900
+ * that. The live handle re-publishes on connect.
28901
+ *
28902
+ * See `RuntimeStateDurability`. Enforced by
28903
+ * `scripts/check-runtime-state-durability.ts`.
28904
+ */
28905
+ durability: "session"
28906
+ };
28907
+ /**
28908
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28909
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28910
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28911
+ * one Home Assistant projection.
28912
+ */
28913
+ var NetworkLinkStatusSchema = object({
28914
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28915
+ type: _enum([
28916
+ "wifi",
28917
+ "ethernet",
28918
+ "cellular",
28919
+ "unknown"
28920
+ ]),
28921
+ /**
28922
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28923
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28924
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28925
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28926
+ * SKIP a null rather than coerce it.
28927
+ */
28928
+ signalPercent: number().min(0).max(100).nullable(),
28929
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28930
+ rssiDbm: number().optional(),
28931
+ /** Network name of a wireless link, when the firmware reports it. */
28932
+ ssid: string().optional(),
28933
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28934
+ lastUpdated: number()
28935
+ });
28936
+ var networkLinkCapability = {
28937
+ name: "network-link",
28938
+ scope: "device",
28939
+ deviceNative: true,
28940
+ mode: "singleton",
28941
+ deviceTypes: [
28942
+ DeviceType.Camera,
28943
+ DeviceType.Sensor,
28944
+ DeviceType.Button,
28945
+ DeviceType.Switch,
28946
+ DeviceType.Light,
28947
+ DeviceType.Lock,
28948
+ DeviceType.Siren
28949
+ ],
28950
+ methods: {},
28951
+ events: {
28952
+ /**
28953
+ * Emitted whenever the cached status changes (a link switch, a signal
28954
+ * reading that moved). Mirrored on the parent chain by the
28955
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28956
+ */
28957
+ onStatusChanged: { data: object({
28958
+ deviceId: number(),
28959
+ status: NetworkLinkStatusSchema
28960
+ }) } },
28961
+ status: {
28962
+ schema: NetworkLinkStatusSchema,
28963
+ kind: "push",
28964
+ empty: {
28965
+ type: "unknown",
28966
+ signalPercent: null,
28967
+ lastUpdated: 0
28968
+ }
28969
+ },
28970
+ /**
28971
+ * Runtime-state slice — every provider stores the same shape under
28972
+ * `device.runtimeState['network-link']`, read once by the badge and the
28973
+ * Home Assistant projector regardless of the driver.
28974
+ */
28975
+ runtimeState: NetworkLinkStatusSchema,
28976
+ /**
28977
+ * Runtime-state durability: **restored** — a link reading is slow to
28978
+ * change and a sleeping battery camera may not report for hours; the
28979
+ * restored slice is what the badge shows until the next read.
28980
+ *
28981
+ * See `RuntimeStateDurability`. Enforced by
28982
+ * `scripts/check-runtime-state-durability.ts`.
28983
+ */
28984
+ durability: "restored",
28985
+ /** Clock fields: written, but excluded from the compare that decides
28986
+ * whether persisting is worth a SQLite commit. */
28987
+ volatileStateFields: ["lastUpdated"]
28988
+ };
28989
+ /**
28586
28990
  * network-quality — system-scoped singleton capability tracking RTT,
28587
28991
  * jitter, and observed/peak bandwidth per device + per client.
28588
28992
  *
@@ -30163,287 +30567,6 @@ var ptzAutotrackCapability = {
30163
30567
  */
30164
30568
  durability: "session"
30165
30569
  };
30166
- /**
30167
- * `navigation` — a device-scoped capability that natively expresses the FULL
30168
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
30169
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
30170
- *
30171
- * Why a NEW cap rather than overloading `ptz`:
30172
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30173
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30174
- * The two are different physical models: PTZ is absolute-position + presets,
30175
- * navigation is momentary drive nudges + discrete robot ACTIONS
30176
- * (dock / spot-clean / follow-pet / go-to-point / …).
30177
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30178
- * the reverse:
30179
- * 1. a native CamStack navigation panel (data-driven from `listActions`
30180
- * / `getOptions`), and
30181
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30182
- * robot camera shows up in the existing PTZ control path without every
30183
- * PTZ provider learning about robots. The mapping lives in the adapter,
30184
- * not here (see the addon design note):
30185
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30186
- * ptz.stop() → navigation.stop()
30187
- * ptz.goHome() → navigation.runAction('goHome')
30188
- * ptz.getPresets() → navigation.listActions() (id→preset)
30189
- * ptz.goToPreset(id) → navigation.runAction(id)
30190
- *
30191
- * ## Continuous drive
30192
- *
30193
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30194
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30195
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30196
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30197
- * coalesce them. The UI owns the cadence.
30198
- *
30199
- * ## The action dictionary
30200
- *
30201
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30202
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30203
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30204
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30205
- * vendor-specific list. `kind: 'action'` entries are triggered with
30206
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30207
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
30208
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30209
- *
30210
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30211
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30212
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
30213
- * every device handle. A future nodedreame publish adds a typed
30214
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30215
- * provider can then swap the raw calls for the typed methods with no change to
30216
- * THIS contract.
30217
- */
30218
- /**
30219
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30220
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30221
- * halts it.
30222
- *
30223
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
30224
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30225
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30226
- * vector by it (drivers without proportional drive ignore it).
30227
- *
30228
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30229
- * axis alone; an all-undefined nudge is a no-op.
30230
- */
30231
- var NavigationMoveCommandSchema = object({
30232
- pan: number().min(-1).max(1).optional(),
30233
- tilt: number().min(-1).max(1).optional(),
30234
- speed: number().min(0).max(1).optional()
30235
- });
30236
- /**
30237
- * The enumerated discrete actions a navigation-capable robot can perform via
30238
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30239
- * subset it supports through `listActions`. Sounds are NOT here — they go through
30240
- * `playSound` (see the `sound` dictionary entries).
30241
- */
30242
- var NavigationActionIdSchema = _enum([
30243
- "goHome",
30244
- "locate",
30245
- "spotClean",
30246
- "findPet",
30247
- "personFollow",
30248
- "stop",
30249
- "startClean",
30250
- "pauseClean",
30251
- "dockWash",
30252
- "autoEmpty",
30253
- "flashOn",
30254
- "flashOff"
30255
- ]);
30256
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30257
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
30258
- /**
30259
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30260
- * native panel and the PTZ mimic render as a button.
30261
- *
30262
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30263
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30264
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
30265
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30266
- * - `label` — operator-facing English label.
30267
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30268
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30269
- * PTZ render ONLY enabled entries. Data-driven: the provider
30270
- * flips it from config, never by editing code.
30271
- */
30272
- var NavigationActionEntrySchema = object({
30273
- id: string(),
30274
- kind: NavigationEntryKindSchema,
30275
- label: string(),
30276
- icon: string(),
30277
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30278
- soundId: number().int().optional(),
30279
- /** Per-device feature flag — render this entry only when true. */
30280
- enabled: boolean()
30281
- });
30282
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
30283
- var NavigationPointSchema = object({
30284
- x: number(),
30285
- y: number()
30286
- });
30287
- /**
30288
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30289
- * The cap reports which are enabled so the UI / PTZ render only the controls
30290
- * that are turned on for THIS device. Data-driven: the provider derives these
30291
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30292
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30293
- * that are not dictionary entries.
30294
- *
30295
- * - `move` / `stop` — the momentary drive joystick.
30296
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30297
- * map-coordinate plumbing is wired.
30298
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30299
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30300
- * - `light` — the on/off fill-light toggle (works anytime).
30301
- * - `lightMode` — the auto/manual selector + manual level slider (a
30302
- * camera-service control; needs an active stream).
30303
- */
30304
- var NavigationFeaturesSchema = object({
30305
- move: boolean(),
30306
- stop: boolean(),
30307
- goToPoint: boolean(),
30308
- runAction: boolean(),
30309
- playSound: boolean(),
30310
- light: boolean(),
30311
- lightMode: boolean()
30312
- });
30313
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30314
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30315
- /**
30316
- * Live navigation state so the UI can reflect what the robot is doing:
30317
- * - `mode` — coarse activity (idle / cleaning / following / …).
30318
- * - `following` — person/pet follow is currently armed.
30319
- * - `flash` — the on-camera fill light is on.
30320
- * - `lightMode` — auto vs manual fill-light mode.
30321
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30322
- * `lightMode === 'manual'`.
30323
- */
30324
- var NavigationStatusSchema = object({
30325
- mode: _enum([
30326
- "idle",
30327
- "cleaning",
30328
- "spot",
30329
- "following",
30330
- "goto",
30331
- "returning",
30332
- "paused",
30333
- "unknown"
30334
- ]),
30335
- following: boolean(),
30336
- flash: boolean(),
30337
- lightMode: NavigationLightModeSchema,
30338
- lightLevel: number().min(40).max(100),
30339
- /** Ms epoch when the slice was last updated. */
30340
- lastChangedAt: number()
30341
- });
30342
- /**
30343
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30344
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30345
- * convention.
30346
- */
30347
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30348
- var navigationCapability = {
30349
- name: "navigation",
30350
- scope: "device",
30351
- deviceNative: true,
30352
- mode: "singleton",
30353
- deviceTypes: [DeviceType.Camera],
30354
- deviceConfig: { ui: {
30355
- kind: "widget",
30356
- widgetId: "host/navigation-panel",
30357
- tab: "navigation",
30358
- topTab: true,
30359
- label: "Navigation",
30360
- order: 0
30361
- } },
30362
- methods: {
30363
- /**
30364
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30365
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30366
- * path) works for any authenticated user, not admin-only. The UI sends
30367
- * these at ~1 Hz while a control is held; the provider forwards each one to
30368
- * a single drive write WITHOUT debouncing.
30369
- */
30370
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30371
- /** Halt all motion immediately (zero drive vector). */
30372
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30373
- /** Send the robot to a point on its live map. */
30374
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30375
- /**
30376
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30377
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30378
- */
30379
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30380
- /**
30381
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30382
- * unsupported action ids are rejected by the provider.
30383
- */
30384
- runAction: method(object({
30385
- deviceId: number(),
30386
- actionId: NavigationActionIdSchema
30387
- }), _void(), { kind: "mutation" }),
30388
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30389
- playSound: method(object({
30390
- deviceId: number(),
30391
- soundId: number().int()
30392
- }), _void(), { kind: "mutation" }),
30393
- /**
30394
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30395
- * works anytime, no active stream required).
30396
- */
30397
- setLightOn: method(object({
30398
- deviceId: number(),
30399
- on: boolean()
30400
- }), _void(), { kind: "mutation" }),
30401
- /**
30402
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30403
- * initial `level`. The auto/manual + level control is a CAMERA-service
30404
- * action that generally needs an active camera stream/monitor session — the
30405
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30406
- */
30407
- setLightMode: method(object({
30408
- deviceId: number(),
30409
- mode: NavigationLightModeSchema,
30410
- level: number().min(40).max(100).optional()
30411
- }), _void(), { kind: "mutation" }),
30412
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30413
- setLightLevel: method(object({
30414
- deviceId: number(),
30415
- level: number().min(40).max(100)
30416
- }), _void(), { kind: "mutation" }),
30417
- /**
30418
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30419
- * controls the UI shows (the per-entry flags for the dictionary come back on
30420
- * `listActions`).
30421
- */
30422
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30423
- },
30424
- events: { onStatusChanged: { data: object({
30425
- deviceId: number(),
30426
- status: NavigationStatusSchema
30427
- }) } },
30428
- status: {
30429
- schema: NavigationStatusSchema,
30430
- kind: "push"
30431
- },
30432
- /**
30433
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30434
- * for live mode / follow / flash changes.
30435
- */
30436
- runtimeState: NavigationRuntimeStateSchema,
30437
- /**
30438
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30439
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30440
- * that. The live handle re-publishes on connect.
30441
- *
30442
- * See `RuntimeStateDurability`. Enforced by
30443
- * `scripts/check-runtime-state-durability.ts`.
30444
- */
30445
- durability: "session"
30446
- };
30447
30570
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30448
30571
  kind: "mutation",
30449
30572
  auth: "admin"
@@ -39906,6 +40029,12 @@ Object.freeze({
39906
40029
  addonId: null,
39907
40030
  access: "view"
39908
40031
  },
40032
+ "storage.listDrainProgress": {
40033
+ capName: "storage",
40034
+ capScope: "system",
40035
+ addonId: null,
40036
+ access: "view"
40037
+ },
39909
40038
  "storage.listLocationDeclarations": {
39910
40039
  capName: "storage",
39911
40040
  capScope: "system",
@@ -40050,6 +40179,12 @@ Object.freeze({
40050
40179
  addonId: null,
40051
40180
  access: "view"
40052
40181
  },
40182
+ "storageOccupancy.getOccupancy": {
40183
+ capName: "storage-occupancy",
40184
+ capScope: "system",
40185
+ addonId: null,
40186
+ access: "view"
40187
+ },
40053
40188
  "storageProvider.abortUpload": {
40054
40189
  capName: "storage-provider",
40055
40190
  capScope: "system",