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