@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.js CHANGED
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let node_net = require("node:net");
25
25
  node_net = __toESM(node_net);
26
- //#region ../types/dist/event-category-zAv7pMUz.mjs
26
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
27
27
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
28
28
  EventCategory["SystemBoot"] = "system.boot";
29
29
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -218,6 +218,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
218
218
  EventCategory["ProcessCrashed"] = "process.crashed";
219
219
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
220
220
  EventCategory["ProcessRestarted"] = "process.restarted";
221
+ /**
222
+ * The SET of storage locations changed — one was created, edited, enabled,
223
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
224
+ *
225
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
226
+ * it must also converge on its own periodic path, because a dropped event
227
+ * must not leave a node writing to yesterday's disk set forever. It exists
228
+ * because there was NO signal at all — an operator who added a second
229
+ * recordings disk in the admin UI got nothing, and the recorder kept its
230
+ * resolved locations until something else happened to re-resolve them
231
+ * (D387). Payload `StorageLocationsChangedPayload`.
232
+ */
233
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
221
234
  EventCategory["RecordingStarted"] = "recording.started";
222
235
  EventCategory["RecordingStopped"] = "recording.stopped";
223
236
  EventCategory["RecordingError"] = "recording.error";
@@ -8592,6 +8605,21 @@ var StorageCleanupJobSchema = object({
8592
8605
  });
8593
8606
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8594
8607
  /**
8608
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8609
+ * alias below is `z.infer<>` of it, never a second spelling.
8610
+ */
8611
+ var StorageLocationModeSchema = _enum([
8612
+ "active",
8613
+ "readonly",
8614
+ "drain",
8615
+ "disabled"
8616
+ ]);
8617
+ _enum([
8618
+ "normal",
8619
+ "never",
8620
+ "drain"
8621
+ ]);
8622
+ /**
8595
8623
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8596
8624
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8597
8625
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8657,6 +8685,21 @@ var StorageLocationSchema = object({
8657
8685
  * stops existing rather than being re-derived on every read.
8658
8686
  */
8659
8687
  enabled: boolean().optional(),
8688
+ /**
8689
+ * THE state of this location (D385), and the only authority on what may be
8690
+ * written, read or evicted here. Interpreted in exactly one place —
8691
+ * `storage-location-mode.ts` — which also folds the legacy
8692
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8693
+ * ambiguous.
8694
+ *
8695
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8696
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8697
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8698
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8699
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8700
+ * either, so the two cannot disagree.
8701
+ */
8702
+ mode: StorageLocationModeSchema.optional(),
8660
8703
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8661
8704
  * for node-local locations it can reach) — never persisted, absent when the
8662
8705
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8664,11 +8707,46 @@ var StorageLocationSchema = object({
8664
8707
  totalBytes: number(),
8665
8708
  availableBytes: number()
8666
8709
  }).nullable().optional(),
8710
+ /**
8711
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8712
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8713
+ * never persisted, never a filesystem walk.
8714
+ *
8715
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8716
+ * location yet — nobody stores here, the owning addon is down, or the first
8717
+ * refresh has not completed. A UI must omit the segment rather than draw it
8718
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8719
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8720
+ * be spelled out loud instead of appearing by accident.
8721
+ *
8722
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8723
+ * about the whole figure rather than about its freshest part.
8724
+ */
8725
+ owned: object({
8726
+ bytes: number().int().nonnegative(),
8727
+ measuredAtMs: number().int().nonnegative()
8728
+ }).optional(),
8667
8729
  createdAt: number(),
8668
8730
  updatedAt: number()
8669
8731
  });
8670
8732
  object({ isDefault: boolean().optional() });
8671
8733
  /**
8734
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8735
+ *
8736
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8737
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8738
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8739
+ * operator learns not to believe the screen.
8740
+ */
8741
+ var StorageDrainProgressSchema = object({
8742
+ locationId: string(),
8743
+ startedAtMs: number(),
8744
+ startBytes: number(),
8745
+ bytesRemaining: number(),
8746
+ drained: boolean(),
8747
+ estimatedEmptyAtMs: number().nullable()
8748
+ });
8749
+ /**
8672
8750
  * Reference accepted by consumer-facing `api.storage.*` calls.
8673
8751
  * Either:
8674
8752
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22101,7 +22179,7 @@ method(object({
22101
22179
  }), _void(), {
22102
22180
  kind: "mutation",
22103
22181
  auth: "admin"
22104
- }), method(object({ id: string() }), object({
22182
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22105
22183
  ok: boolean(),
22106
22184
  error: string().optional()
22107
22185
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22171,6 +22249,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22171
22249
  kind: "mutation",
22172
22250
  auth: "admin"
22173
22251
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22252
+ /**
22253
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22254
+ * location (D388).
22255
+ *
22256
+ * ## Why this is not `storage-evictable`
22257
+ *
22258
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22259
+ * not, in two ways that both matter and both bite hardest on the locations an
22260
+ * operator most wants a figure for:
22261
+ *
22262
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22263
+ * and `recordingsLow:default` deliberately share one root and evict as one
22264
+ * oldest-first pool, so both answer with the SAME combined total. As an
22265
+ * occupancy figure that double-counts the disk.
22266
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22267
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22268
+ * is retiring and staring at.
22269
+ *
22270
+ * So this is its own contract with its own quantity, and the quantity is
22271
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22272
+ * would ever be willing to delete it. A provider that can only answer
22273
+ * "evictable" must not register here — a number that silently means different
22274
+ * things per class is worse than no number.
22275
+ *
22276
+ * ## Absence is an answer
22277
+ *
22278
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22279
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22280
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22281
+ * consuming side has to be written out loud instead of appearing by accident.
22282
+ *
22283
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22284
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22285
+ */
22286
+ /** One provider's occupancy answer for one location. */
22287
+ var StorageOccupancyReportSchema = object({
22288
+ locationId: string(),
22289
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22290
+ * not net of what it is willing to delete. */
22291
+ ownedBytes: number().int().nonnegative(),
22292
+ /** When the provider last actually measured this. The orchestrator carries it
22293
+ * through so a UI can say how old the figure is instead of implying "now". */
22294
+ measuredAtMs: number().int().nonnegative()
22295
+ });
22296
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22174
22297
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22175
22298
  providerId: string().min(1),
22176
22299
  displayName: string().min(1),
@@ -24006,88 +24129,6 @@ onStatusChanged: { data: object({
24006
24129
  volatileStateFields: ["lastUpdated"]
24007
24130
  };
24008
24131
  /**
24009
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24010
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24011
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24012
- * one Home Assistant projection.
24013
- */
24014
- var NetworkLinkStatusSchema = object({
24015
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24016
- type: _enum([
24017
- "wifi",
24018
- "ethernet",
24019
- "cellular",
24020
- "unknown"
24021
- ]),
24022
- /**
24023
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24024
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24025
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24026
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24027
- * SKIP a null rather than coerce it.
24028
- */
24029
- signalPercent: number().min(0).max(100).nullable(),
24030
- /** Raw received signal strength in dBm, when the firmware reports one. */
24031
- rssiDbm: number().optional(),
24032
- /** Network name of a wireless link, when the firmware reports it. */
24033
- ssid: string().optional(),
24034
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24035
- lastUpdated: number()
24036
- });
24037
- var networkLinkCapability = {
24038
- name: "network-link",
24039
- scope: "device",
24040
- deviceNative: true,
24041
- mode: "singleton",
24042
- deviceTypes: [
24043
- DeviceType.Camera,
24044
- DeviceType.Sensor,
24045
- DeviceType.Button,
24046
- DeviceType.Switch,
24047
- DeviceType.Light,
24048
- DeviceType.Lock,
24049
- DeviceType.Siren
24050
- ],
24051
- methods: {},
24052
- events: {
24053
- /**
24054
- * Emitted whenever the cached status changes (a link switch, a signal
24055
- * reading that moved). Mirrored on the parent chain by the
24056
- * DeviceEventPropagator like `battery.onStatusChanged`.
24057
- */
24058
- onStatusChanged: { data: object({
24059
- deviceId: number(),
24060
- status: NetworkLinkStatusSchema
24061
- }) } },
24062
- status: {
24063
- schema: NetworkLinkStatusSchema,
24064
- kind: "push",
24065
- empty: {
24066
- type: "unknown",
24067
- signalPercent: null,
24068
- lastUpdated: 0
24069
- }
24070
- },
24071
- /**
24072
- * Runtime-state slice — every provider stores the same shape under
24073
- * `device.runtimeState['network-link']`, read once by the badge and the
24074
- * Home Assistant projector regardless of the driver.
24075
- */
24076
- runtimeState: NetworkLinkStatusSchema,
24077
- /**
24078
- * Runtime-state durability: **restored** — a link reading is slow to
24079
- * change and a sleeping battery camera may not report for hours; the
24080
- * restored slice is what the badge shows until the next read.
24081
- *
24082
- * See `RuntimeStateDurability`. Enforced by
24083
- * `scripts/check-runtime-state-durability.ts`.
24084
- */
24085
- durability: "restored",
24086
- /** Clock fields: written, but excluded from the compare that decides
24087
- * whether persisting is worth a SQLite commit. */
24088
- volatileStateFields: ["lastUpdated"]
24089
- };
24090
- /**
24091
24132
  * Generic boolean sensor — last-resort fallback when no domain-
24092
24133
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24093
24134
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27625,6 +27666,369 @@ var nativeObjectDetectionCapability = {
27625
27666
  volatileStateFields: ["lastFetchedAt"]
27626
27667
  };
27627
27668
  /**
27669
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27670
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27671
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27672
+ *
27673
+ * Why a NEW cap rather than overloading `ptz`:
27674
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27675
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27676
+ * The two are different physical models: PTZ is absolute-position + presets,
27677
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27678
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27679
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27680
+ * the reverse:
27681
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27682
+ * / `getOptions`), and
27683
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27684
+ * robot camera shows up in the existing PTZ control path without every
27685
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27686
+ * not here (see the addon design note):
27687
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27688
+ * ptz.stop() → navigation.stop()
27689
+ * ptz.goHome() → navigation.runAction('goHome')
27690
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27691
+ * ptz.goToPreset(id) → navigation.runAction(id)
27692
+ *
27693
+ * ## Continuous drive
27694
+ *
27695
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27696
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27697
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27698
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27699
+ * coalesce them. The UI owns the cadence.
27700
+ *
27701
+ * ## The action dictionary
27702
+ *
27703
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27704
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27705
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27706
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27707
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27708
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27709
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27710
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27711
+ *
27712
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27713
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27714
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27715
+ * every device handle. A future nodedreame publish adds a typed
27716
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27717
+ * provider can then swap the raw calls for the typed methods with no change to
27718
+ * THIS contract.
27719
+ */
27720
+ /**
27721
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27722
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27723
+ * halts it.
27724
+ *
27725
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27726
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27727
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27728
+ * vector by it (drivers without proportional drive ignore it).
27729
+ *
27730
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27731
+ * axis alone; an all-undefined nudge is a no-op.
27732
+ */
27733
+ var NavigationMoveCommandSchema = object({
27734
+ pan: number().min(-1).max(1).optional(),
27735
+ tilt: number().min(-1).max(1).optional(),
27736
+ speed: number().min(0).max(1).optional()
27737
+ });
27738
+ /**
27739
+ * The enumerated discrete actions a navigation-capable robot can perform via
27740
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27741
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27742
+ * `playSound` (see the `sound` dictionary entries).
27743
+ */
27744
+ var NavigationActionIdSchema = _enum([
27745
+ "goHome",
27746
+ "locate",
27747
+ "spotClean",
27748
+ "findPet",
27749
+ "personFollow",
27750
+ "stop",
27751
+ "startClean",
27752
+ "pauseClean",
27753
+ "dockWash",
27754
+ "autoEmpty",
27755
+ "flashOn",
27756
+ "flashOff"
27757
+ ]);
27758
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27759
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27760
+ /**
27761
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27762
+ * native panel and the PTZ mimic render as a button.
27763
+ *
27764
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27765
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27766
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27767
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27768
+ * - `label` — operator-facing English label.
27769
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27770
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27771
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27772
+ * flips it from config, never by editing code.
27773
+ */
27774
+ var NavigationActionEntrySchema = object({
27775
+ id: string(),
27776
+ kind: NavigationEntryKindSchema,
27777
+ label: string(),
27778
+ icon: string(),
27779
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27780
+ soundId: number().int().optional(),
27781
+ /** Per-device feature flag — render this entry only when true. */
27782
+ enabled: boolean()
27783
+ });
27784
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27785
+ var NavigationPointSchema = object({
27786
+ x: number(),
27787
+ y: number()
27788
+ });
27789
+ /**
27790
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27791
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27792
+ * that are turned on for THIS device. Data-driven: the provider derives these
27793
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27794
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27795
+ * that are not dictionary entries.
27796
+ *
27797
+ * - `move` / `stop` — the momentary drive joystick.
27798
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27799
+ * map-coordinate plumbing is wired.
27800
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27801
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27802
+ * - `light` — the on/off fill-light toggle (works anytime).
27803
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27804
+ * camera-service control; needs an active stream).
27805
+ */
27806
+ var NavigationFeaturesSchema = object({
27807
+ move: boolean(),
27808
+ stop: boolean(),
27809
+ goToPoint: boolean(),
27810
+ runAction: boolean(),
27811
+ playSound: boolean(),
27812
+ light: boolean(),
27813
+ lightMode: boolean()
27814
+ });
27815
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27816
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27817
+ /**
27818
+ * Live navigation state so the UI can reflect what the robot is doing:
27819
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27820
+ * - `following` — person/pet follow is currently armed.
27821
+ * - `flash` — the on-camera fill light is on.
27822
+ * - `lightMode` — auto vs manual fill-light mode.
27823
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27824
+ * `lightMode === 'manual'`.
27825
+ */
27826
+ var NavigationStatusSchema = object({
27827
+ mode: _enum([
27828
+ "idle",
27829
+ "cleaning",
27830
+ "spot",
27831
+ "following",
27832
+ "goto",
27833
+ "returning",
27834
+ "paused",
27835
+ "unknown"
27836
+ ]),
27837
+ following: boolean(),
27838
+ flash: boolean(),
27839
+ lightMode: NavigationLightModeSchema,
27840
+ lightLevel: number().min(40).max(100),
27841
+ /** Ms epoch when the slice was last updated. */
27842
+ lastChangedAt: number()
27843
+ });
27844
+ /**
27845
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27846
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27847
+ * convention.
27848
+ */
27849
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27850
+ var navigationCapability = {
27851
+ name: "navigation",
27852
+ scope: "device",
27853
+ deviceNative: true,
27854
+ mode: "singleton",
27855
+ deviceTypes: [DeviceType.Camera],
27856
+ deviceConfig: { ui: {
27857
+ kind: "widget",
27858
+ widgetId: "host/navigation-panel",
27859
+ tab: "navigation",
27860
+ topTab: true,
27861
+ label: "Navigation",
27862
+ order: 0
27863
+ } },
27864
+ methods: {
27865
+ /**
27866
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27867
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27868
+ * path) works for any authenticated user, not admin-only. The UI sends
27869
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27870
+ * a single drive write WITHOUT debouncing.
27871
+ */
27872
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27873
+ /** Halt all motion immediately (zero drive vector). */
27874
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27875
+ /** Send the robot to a point on its live map. */
27876
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27877
+ /**
27878
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27879
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27880
+ */
27881
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27882
+ /**
27883
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27884
+ * unsupported action ids are rejected by the provider.
27885
+ */
27886
+ runAction: method(object({
27887
+ deviceId: number(),
27888
+ actionId: NavigationActionIdSchema
27889
+ }), _void(), { kind: "mutation" }),
27890
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27891
+ playSound: method(object({
27892
+ deviceId: number(),
27893
+ soundId: number().int()
27894
+ }), _void(), { kind: "mutation" }),
27895
+ /**
27896
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27897
+ * works anytime, no active stream required).
27898
+ */
27899
+ setLightOn: method(object({
27900
+ deviceId: number(),
27901
+ on: boolean()
27902
+ }), _void(), { kind: "mutation" }),
27903
+ /**
27904
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27905
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27906
+ * action that generally needs an active camera stream/monitor session — the
27907
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27908
+ */
27909
+ setLightMode: method(object({
27910
+ deviceId: number(),
27911
+ mode: NavigationLightModeSchema,
27912
+ level: number().min(40).max(100).optional()
27913
+ }), _void(), { kind: "mutation" }),
27914
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27915
+ setLightLevel: method(object({
27916
+ deviceId: number(),
27917
+ level: number().min(40).max(100)
27918
+ }), _void(), { kind: "mutation" }),
27919
+ /**
27920
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27921
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27922
+ * `listActions`).
27923
+ */
27924
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27925
+ },
27926
+ events: { onStatusChanged: { data: object({
27927
+ deviceId: number(),
27928
+ status: NavigationStatusSchema
27929
+ }) } },
27930
+ status: {
27931
+ schema: NavigationStatusSchema,
27932
+ kind: "push"
27933
+ },
27934
+ /**
27935
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27936
+ * for live mode / follow / flash changes.
27937
+ */
27938
+ runtimeState: NavigationRuntimeStateSchema,
27939
+ /**
27940
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27941
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27942
+ * that. The live handle re-publishes on connect.
27943
+ *
27944
+ * See `RuntimeStateDurability`. Enforced by
27945
+ * `scripts/check-runtime-state-durability.ts`.
27946
+ */
27947
+ durability: "session"
27948
+ };
27949
+ /**
27950
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27951
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27952
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27953
+ * one Home Assistant projection.
27954
+ */
27955
+ var NetworkLinkStatusSchema = object({
27956
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27957
+ type: _enum([
27958
+ "wifi",
27959
+ "ethernet",
27960
+ "cellular",
27961
+ "unknown"
27962
+ ]),
27963
+ /**
27964
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27965
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27966
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27967
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27968
+ * SKIP a null rather than coerce it.
27969
+ */
27970
+ signalPercent: number().min(0).max(100).nullable(),
27971
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27972
+ rssiDbm: number().optional(),
27973
+ /** Network name of a wireless link, when the firmware reports it. */
27974
+ ssid: string().optional(),
27975
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27976
+ lastUpdated: number()
27977
+ });
27978
+ var networkLinkCapability = {
27979
+ name: "network-link",
27980
+ scope: "device",
27981
+ deviceNative: true,
27982
+ mode: "singleton",
27983
+ deviceTypes: [
27984
+ DeviceType.Camera,
27985
+ DeviceType.Sensor,
27986
+ DeviceType.Button,
27987
+ DeviceType.Switch,
27988
+ DeviceType.Light,
27989
+ DeviceType.Lock,
27990
+ DeviceType.Siren
27991
+ ],
27992
+ methods: {},
27993
+ events: {
27994
+ /**
27995
+ * Emitted whenever the cached status changes (a link switch, a signal
27996
+ * reading that moved). Mirrored on the parent chain by the
27997
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27998
+ */
27999
+ onStatusChanged: { data: object({
28000
+ deviceId: number(),
28001
+ status: NetworkLinkStatusSchema
28002
+ }) } },
28003
+ status: {
28004
+ schema: NetworkLinkStatusSchema,
28005
+ kind: "push",
28006
+ empty: {
28007
+ type: "unknown",
28008
+ signalPercent: null,
28009
+ lastUpdated: 0
28010
+ }
28011
+ },
28012
+ /**
28013
+ * Runtime-state slice — every provider stores the same shape under
28014
+ * `device.runtimeState['network-link']`, read once by the badge and the
28015
+ * Home Assistant projector regardless of the driver.
28016
+ */
28017
+ runtimeState: NetworkLinkStatusSchema,
28018
+ /**
28019
+ * Runtime-state durability: **restored** — a link reading is slow to
28020
+ * change and a sleeping battery camera may not report for hours; the
28021
+ * restored slice is what the badge shows until the next read.
28022
+ *
28023
+ * See `RuntimeStateDurability`. Enforced by
28024
+ * `scripts/check-runtime-state-durability.ts`.
28025
+ */
28026
+ durability: "restored",
28027
+ /** Clock fields: written, but excluded from the compare that decides
28028
+ * whether persisting is worth a SQLite commit. */
28029
+ volatileStateFields: ["lastUpdated"]
28030
+ };
28031
+ /**
27628
28032
  * network-quality — system-scoped singleton capability tracking RTT,
27629
28033
  * jitter, and observed/peak bandwidth per device + per client.
27630
28034
  *
@@ -29205,287 +29609,6 @@ var ptzAutotrackCapability = {
29205
29609
  */
29206
29610
  durability: "session"
29207
29611
  };
29208
- /**
29209
- * `navigation` — a device-scoped capability that natively expresses the FULL
29210
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29211
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29212
- *
29213
- * Why a NEW cap rather than overloading `ptz`:
29214
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29215
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29216
- * The two are different physical models: PTZ is absolute-position + presets,
29217
- * navigation is momentary drive nudges + discrete robot ACTIONS
29218
- * (dock / spot-clean / follow-pet / go-to-point / …).
29219
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29220
- * the reverse:
29221
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29222
- * / `getOptions`), and
29223
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29224
- * robot camera shows up in the existing PTZ control path without every
29225
- * PTZ provider learning about robots. The mapping lives in the adapter,
29226
- * not here (see the addon design note):
29227
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29228
- * ptz.stop() → navigation.stop()
29229
- * ptz.goHome() → navigation.runAction('goHome')
29230
- * ptz.getPresets() → navigation.listActions() (id→preset)
29231
- * ptz.goToPreset(id) → navigation.runAction(id)
29232
- *
29233
- * ## Continuous drive
29234
- *
29235
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29236
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29237
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29238
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29239
- * coalesce them. The UI owns the cadence.
29240
- *
29241
- * ## The action dictionary
29242
- *
29243
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29244
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29245
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29246
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29247
- * vendor-specific list. `kind: 'action'` entries are triggered with
29248
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29249
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29250
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29251
- *
29252
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29253
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29254
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29255
- * every device handle. A future nodedreame publish adds a typed
29256
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29257
- * provider can then swap the raw calls for the typed methods with no change to
29258
- * THIS contract.
29259
- */
29260
- /**
29261
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29262
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29263
- * halts it.
29264
- *
29265
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29266
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29267
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29268
- * vector by it (drivers without proportional drive ignore it).
29269
- *
29270
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29271
- * axis alone; an all-undefined nudge is a no-op.
29272
- */
29273
- var NavigationMoveCommandSchema = object({
29274
- pan: number().min(-1).max(1).optional(),
29275
- tilt: number().min(-1).max(1).optional(),
29276
- speed: number().min(0).max(1).optional()
29277
- });
29278
- /**
29279
- * The enumerated discrete actions a navigation-capable robot can perform via
29280
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29281
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29282
- * `playSound` (see the `sound` dictionary entries).
29283
- */
29284
- var NavigationActionIdSchema = _enum([
29285
- "goHome",
29286
- "locate",
29287
- "spotClean",
29288
- "findPet",
29289
- "personFollow",
29290
- "stop",
29291
- "startClean",
29292
- "pauseClean",
29293
- "dockWash",
29294
- "autoEmpty",
29295
- "flashOn",
29296
- "flashOff"
29297
- ]);
29298
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29299
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29300
- /**
29301
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29302
- * native panel and the PTZ mimic render as a button.
29303
- *
29304
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29305
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29306
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29307
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29308
- * - `label` — operator-facing English label.
29309
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29310
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29311
- * PTZ render ONLY enabled entries. Data-driven: the provider
29312
- * flips it from config, never by editing code.
29313
- */
29314
- var NavigationActionEntrySchema = object({
29315
- id: string(),
29316
- kind: NavigationEntryKindSchema,
29317
- label: string(),
29318
- icon: string(),
29319
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29320
- soundId: number().int().optional(),
29321
- /** Per-device feature flag — render this entry only when true. */
29322
- enabled: boolean()
29323
- });
29324
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29325
- var NavigationPointSchema = object({
29326
- x: number(),
29327
- y: number()
29328
- });
29329
- /**
29330
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29331
- * The cap reports which are enabled so the UI / PTZ render only the controls
29332
- * that are turned on for THIS device. Data-driven: the provider derives these
29333
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29334
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29335
- * that are not dictionary entries.
29336
- *
29337
- * - `move` / `stop` — the momentary drive joystick.
29338
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29339
- * map-coordinate plumbing is wired.
29340
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29341
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29342
- * - `light` — the on/off fill-light toggle (works anytime).
29343
- * - `lightMode` — the auto/manual selector + manual level slider (a
29344
- * camera-service control; needs an active stream).
29345
- */
29346
- var NavigationFeaturesSchema = object({
29347
- move: boolean(),
29348
- stop: boolean(),
29349
- goToPoint: boolean(),
29350
- runAction: boolean(),
29351
- playSound: boolean(),
29352
- light: boolean(),
29353
- lightMode: boolean()
29354
- });
29355
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29356
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29357
- /**
29358
- * Live navigation state so the UI can reflect what the robot is doing:
29359
- * - `mode` — coarse activity (idle / cleaning / following / …).
29360
- * - `following` — person/pet follow is currently armed.
29361
- * - `flash` — the on-camera fill light is on.
29362
- * - `lightMode` — auto vs manual fill-light mode.
29363
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29364
- * `lightMode === 'manual'`.
29365
- */
29366
- var NavigationStatusSchema = object({
29367
- mode: _enum([
29368
- "idle",
29369
- "cleaning",
29370
- "spot",
29371
- "following",
29372
- "goto",
29373
- "returning",
29374
- "paused",
29375
- "unknown"
29376
- ]),
29377
- following: boolean(),
29378
- flash: boolean(),
29379
- lightMode: NavigationLightModeSchema,
29380
- lightLevel: number().min(40).max(100),
29381
- /** Ms epoch when the slice was last updated. */
29382
- lastChangedAt: number()
29383
- });
29384
- /**
29385
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29386
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29387
- * convention.
29388
- */
29389
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29390
- var navigationCapability = {
29391
- name: "navigation",
29392
- scope: "device",
29393
- deviceNative: true,
29394
- mode: "singleton",
29395
- deviceTypes: [DeviceType.Camera],
29396
- deviceConfig: { ui: {
29397
- kind: "widget",
29398
- widgetId: "host/navigation-panel",
29399
- tab: "navigation",
29400
- topTab: true,
29401
- label: "Navigation",
29402
- order: 0
29403
- } },
29404
- methods: {
29405
- /**
29406
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29407
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29408
- * path) works for any authenticated user, not admin-only. The UI sends
29409
- * these at ~1 Hz while a control is held; the provider forwards each one to
29410
- * a single drive write WITHOUT debouncing.
29411
- */
29412
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29413
- /** Halt all motion immediately (zero drive vector). */
29414
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29415
- /** Send the robot to a point on its live map. */
29416
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29417
- /**
29418
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29419
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29420
- */
29421
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29422
- /**
29423
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29424
- * unsupported action ids are rejected by the provider.
29425
- */
29426
- runAction: method(object({
29427
- deviceId: number(),
29428
- actionId: NavigationActionIdSchema
29429
- }), _void(), { kind: "mutation" }),
29430
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29431
- playSound: method(object({
29432
- deviceId: number(),
29433
- soundId: number().int()
29434
- }), _void(), { kind: "mutation" }),
29435
- /**
29436
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29437
- * works anytime, no active stream required).
29438
- */
29439
- setLightOn: method(object({
29440
- deviceId: number(),
29441
- on: boolean()
29442
- }), _void(), { kind: "mutation" }),
29443
- /**
29444
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29445
- * initial `level`. The auto/manual + level control is a CAMERA-service
29446
- * action that generally needs an active camera stream/monitor session — the
29447
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29448
- */
29449
- setLightMode: method(object({
29450
- deviceId: number(),
29451
- mode: NavigationLightModeSchema,
29452
- level: number().min(40).max(100).optional()
29453
- }), _void(), { kind: "mutation" }),
29454
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29455
- setLightLevel: method(object({
29456
- deviceId: number(),
29457
- level: number().min(40).max(100)
29458
- }), _void(), { kind: "mutation" }),
29459
- /**
29460
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29461
- * controls the UI shows (the per-entry flags for the dictionary come back on
29462
- * `listActions`).
29463
- */
29464
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29465
- },
29466
- events: { onStatusChanged: { data: object({
29467
- deviceId: number(),
29468
- status: NavigationStatusSchema
29469
- }) } },
29470
- status: {
29471
- schema: NavigationStatusSchema,
29472
- kind: "push"
29473
- },
29474
- /**
29475
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29476
- * for live mode / follow / flash changes.
29477
- */
29478
- runtimeState: NavigationRuntimeStateSchema,
29479
- /**
29480
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29481
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29482
- * that. The live handle re-publishes on connect.
29483
- *
29484
- * See `RuntimeStateDurability`. Enforced by
29485
- * `scripts/check-runtime-state-durability.ts`.
29486
- */
29487
- durability: "session"
29488
- };
29489
29612
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29490
29613
  kind: "mutation",
29491
29614
  auth: "admin"
@@ -39014,6 +39137,12 @@ Object.freeze({
39014
39137
  addonId: null,
39015
39138
  access: "view"
39016
39139
  },
39140
+ "storage.listDrainProgress": {
39141
+ capName: "storage",
39142
+ capScope: "system",
39143
+ addonId: null,
39144
+ access: "view"
39145
+ },
39017
39146
  "storage.listLocationDeclarations": {
39018
39147
  capName: "storage",
39019
39148
  capScope: "system",
@@ -39158,6 +39287,12 @@ Object.freeze({
39158
39287
  addonId: null,
39159
39288
  access: "view"
39160
39289
  },
39290
+ "storageOccupancy.getOccupancy": {
39291
+ capName: "storage-occupancy",
39292
+ capScope: "system",
39293
+ addonId: null,
39294
+ access: "view"
39295
+ },
39161
39296
  "storageProvider.abortUpload": {
39162
39297
  capName: "storage-provider",
39163
39298
  capScope: "system",