@camstack/addon-provider-amcrest 0.2.81 → 0.2.82

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
@@ -6,7 +6,7 @@ let node_crypto = require("node:crypto");
6
6
  let node_http = require("node:http");
7
7
  let node_https = require("node:https");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-zAv7pMUz.mjs
9
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -201,6 +201,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
201
201
  EventCategory["ProcessCrashed"] = "process.crashed";
202
202
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
203
203
  EventCategory["ProcessRestarted"] = "process.restarted";
204
+ /**
205
+ * The SET of storage locations changed — one was created, edited, enabled,
206
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
207
+ *
208
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
209
+ * it must also converge on its own periodic path, because a dropped event
210
+ * must not leave a node writing to yesterday's disk set forever. It exists
211
+ * because there was NO signal at all — an operator who added a second
212
+ * recordings disk in the admin UI got nothing, and the recorder kept its
213
+ * resolved locations until something else happened to re-resolve them
214
+ * (D387). Payload `StorageLocationsChangedPayload`.
215
+ */
216
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
204
217
  EventCategory["RecordingStarted"] = "recording.started";
205
218
  EventCategory["RecordingStopped"] = "recording.stopped";
206
219
  EventCategory["RecordingError"] = "recording.error";
@@ -8531,6 +8544,21 @@ var StorageCleanupJobSchema = object({
8531
8544
  });
8532
8545
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8533
8546
  /**
8547
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8548
+ * alias below is `z.infer<>` of it, never a second spelling.
8549
+ */
8550
+ var StorageLocationModeSchema = _enum([
8551
+ "active",
8552
+ "readonly",
8553
+ "drain",
8554
+ "disabled"
8555
+ ]);
8556
+ _enum([
8557
+ "normal",
8558
+ "never",
8559
+ "drain"
8560
+ ]);
8561
+ /**
8534
8562
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8535
8563
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8536
8564
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8596,6 +8624,21 @@ var StorageLocationSchema = object({
8596
8624
  * stops existing rather than being re-derived on every read.
8597
8625
  */
8598
8626
  enabled: boolean().optional(),
8627
+ /**
8628
+ * THE state of this location (D385), and the only authority on what may be
8629
+ * written, read or evicted here. Interpreted in exactly one place —
8630
+ * `storage-location-mode.ts` — which also folds the legacy
8631
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8632
+ * ambiguous.
8633
+ *
8634
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8635
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8636
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8637
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8638
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8639
+ * either, so the two cannot disagree.
8640
+ */
8641
+ mode: StorageLocationModeSchema.optional(),
8599
8642
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8600
8643
  * for node-local locations it can reach) — never persisted, absent when the
8601
8644
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8603,11 +8646,46 @@ var StorageLocationSchema = object({
8603
8646
  totalBytes: number(),
8604
8647
  availableBytes: number()
8605
8648
  }).nullable().optional(),
8649
+ /**
8650
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8651
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8652
+ * never persisted, never a filesystem walk.
8653
+ *
8654
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8655
+ * location yet — nobody stores here, the owning addon is down, or the first
8656
+ * refresh has not completed. A UI must omit the segment rather than draw it
8657
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8658
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8659
+ * be spelled out loud instead of appearing by accident.
8660
+ *
8661
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8662
+ * about the whole figure rather than about its freshest part.
8663
+ */
8664
+ owned: object({
8665
+ bytes: number().int().nonnegative(),
8666
+ measuredAtMs: number().int().nonnegative()
8667
+ }).optional(),
8606
8668
  createdAt: number(),
8607
8669
  updatedAt: number()
8608
8670
  });
8609
8671
  object({ isDefault: boolean().optional() });
8610
8672
  /**
8673
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8674
+ *
8675
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8676
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8677
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8678
+ * operator learns not to believe the screen.
8679
+ */
8680
+ var StorageDrainProgressSchema = object({
8681
+ locationId: string(),
8682
+ startedAtMs: number(),
8683
+ startBytes: number(),
8684
+ bytesRemaining: number(),
8685
+ drained: boolean(),
8686
+ estimatedEmptyAtMs: number().nullable()
8687
+ });
8688
+ /**
8611
8689
  * Reference accepted by consumer-facing `api.storage.*` calls.
8612
8690
  * Either:
8613
8691
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22040,7 +22118,7 @@ method(object({
22040
22118
  }), _void(), {
22041
22119
  kind: "mutation",
22042
22120
  auth: "admin"
22043
- }), method(object({ id: string() }), object({
22121
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22044
22122
  ok: boolean(),
22045
22123
  error: string().optional()
22046
22124
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22110,6 +22188,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22110
22188
  kind: "mutation",
22111
22189
  auth: "admin"
22112
22190
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22191
+ /**
22192
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22193
+ * location (D388).
22194
+ *
22195
+ * ## Why this is not `storage-evictable`
22196
+ *
22197
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22198
+ * not, in two ways that both matter and both bite hardest on the locations an
22199
+ * operator most wants a figure for:
22200
+ *
22201
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22202
+ * and `recordingsLow:default` deliberately share one root and evict as one
22203
+ * oldest-first pool, so both answer with the SAME combined total. As an
22204
+ * occupancy figure that double-counts the disk.
22205
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22206
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22207
+ * is retiring and staring at.
22208
+ *
22209
+ * So this is its own contract with its own quantity, and the quantity is
22210
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22211
+ * would ever be willing to delete it. A provider that can only answer
22212
+ * "evictable" must not register here — a number that silently means different
22213
+ * things per class is worse than no number.
22214
+ *
22215
+ * ## Absence is an answer
22216
+ *
22217
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22218
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22219
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22220
+ * consuming side has to be written out loud instead of appearing by accident.
22221
+ *
22222
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22223
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22224
+ */
22225
+ /** One provider's occupancy answer for one location. */
22226
+ var StorageOccupancyReportSchema = object({
22227
+ locationId: string(),
22228
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22229
+ * not net of what it is willing to delete. */
22230
+ ownedBytes: number().int().nonnegative(),
22231
+ /** When the provider last actually measured this. The orchestrator carries it
22232
+ * through so a UI can say how old the figure is instead of implying "now". */
22233
+ measuredAtMs: number().int().nonnegative()
22234
+ });
22235
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22113
22236
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22114
22237
  providerId: string().min(1),
22115
22238
  displayName: string().min(1),
@@ -23945,88 +24068,6 @@ onStatusChanged: { data: object({
23945
24068
  volatileStateFields: ["lastUpdated"]
23946
24069
  };
23947
24070
  /**
23948
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23949
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23950
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23951
- * one Home Assistant projection.
23952
- */
23953
- var NetworkLinkStatusSchema = object({
23954
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23955
- type: _enum([
23956
- "wifi",
23957
- "ethernet",
23958
- "cellular",
23959
- "unknown"
23960
- ]),
23961
- /**
23962
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23963
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23964
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23965
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23966
- * SKIP a null rather than coerce it.
23967
- */
23968
- signalPercent: number().min(0).max(100).nullable(),
23969
- /** Raw received signal strength in dBm, when the firmware reports one. */
23970
- rssiDbm: number().optional(),
23971
- /** Network name of a wireless link, when the firmware reports it. */
23972
- ssid: string().optional(),
23973
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23974
- lastUpdated: number()
23975
- });
23976
- var networkLinkCapability = {
23977
- name: "network-link",
23978
- scope: "device",
23979
- deviceNative: true,
23980
- mode: "singleton",
23981
- deviceTypes: [
23982
- DeviceType.Camera,
23983
- DeviceType.Sensor,
23984
- DeviceType.Button,
23985
- DeviceType.Switch,
23986
- DeviceType.Light,
23987
- DeviceType.Lock,
23988
- DeviceType.Siren
23989
- ],
23990
- methods: {},
23991
- events: {
23992
- /**
23993
- * Emitted whenever the cached status changes (a link switch, a signal
23994
- * reading that moved). Mirrored on the parent chain by the
23995
- * DeviceEventPropagator like `battery.onStatusChanged`.
23996
- */
23997
- onStatusChanged: { data: object({
23998
- deviceId: number(),
23999
- status: NetworkLinkStatusSchema
24000
- }) } },
24001
- status: {
24002
- schema: NetworkLinkStatusSchema,
24003
- kind: "push",
24004
- empty: {
24005
- type: "unknown",
24006
- signalPercent: null,
24007
- lastUpdated: 0
24008
- }
24009
- },
24010
- /**
24011
- * Runtime-state slice — every provider stores the same shape under
24012
- * `device.runtimeState['network-link']`, read once by the badge and the
24013
- * Home Assistant projector regardless of the driver.
24014
- */
24015
- runtimeState: NetworkLinkStatusSchema,
24016
- /**
24017
- * Runtime-state durability: **restored** — a link reading is slow to
24018
- * change and a sleeping battery camera may not report for hours; the
24019
- * restored slice is what the badge shows until the next read.
24020
- *
24021
- * See `RuntimeStateDurability`. Enforced by
24022
- * `scripts/check-runtime-state-durability.ts`.
24023
- */
24024
- durability: "restored",
24025
- /** Clock fields: written, but excluded from the compare that decides
24026
- * whether persisting is worth a SQLite commit. */
24027
- volatileStateFields: ["lastUpdated"]
24028
- };
24029
- /**
24030
24071
  * Generic boolean sensor — last-resort fallback when no domain-
24031
24072
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24032
24073
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27556,6 +27597,369 @@ var nativeObjectDetectionCapability = {
27556
27597
  volatileStateFields: ["lastFetchedAt"]
27557
27598
  };
27558
27599
  /**
27600
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27601
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27602
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27603
+ *
27604
+ * Why a NEW cap rather than overloading `ptz`:
27605
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27606
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27607
+ * The two are different physical models: PTZ is absolute-position + presets,
27608
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27609
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27610
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27611
+ * the reverse:
27612
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27613
+ * / `getOptions`), and
27614
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27615
+ * robot camera shows up in the existing PTZ control path without every
27616
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27617
+ * not here (see the addon design note):
27618
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27619
+ * ptz.stop() → navigation.stop()
27620
+ * ptz.goHome() → navigation.runAction('goHome')
27621
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27622
+ * ptz.goToPreset(id) → navigation.runAction(id)
27623
+ *
27624
+ * ## Continuous drive
27625
+ *
27626
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27627
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27628
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27629
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27630
+ * coalesce them. The UI owns the cadence.
27631
+ *
27632
+ * ## The action dictionary
27633
+ *
27634
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27635
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27636
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27637
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27638
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27639
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27640
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27641
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27642
+ *
27643
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27644
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27645
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27646
+ * every device handle. A future nodedreame publish adds a typed
27647
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27648
+ * provider can then swap the raw calls for the typed methods with no change to
27649
+ * THIS contract.
27650
+ */
27651
+ /**
27652
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27653
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27654
+ * halts it.
27655
+ *
27656
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27657
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27658
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27659
+ * vector by it (drivers without proportional drive ignore it).
27660
+ *
27661
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27662
+ * axis alone; an all-undefined nudge is a no-op.
27663
+ */
27664
+ var NavigationMoveCommandSchema = object({
27665
+ pan: number().min(-1).max(1).optional(),
27666
+ tilt: number().min(-1).max(1).optional(),
27667
+ speed: number().min(0).max(1).optional()
27668
+ });
27669
+ /**
27670
+ * The enumerated discrete actions a navigation-capable robot can perform via
27671
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27672
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27673
+ * `playSound` (see the `sound` dictionary entries).
27674
+ */
27675
+ var NavigationActionIdSchema = _enum([
27676
+ "goHome",
27677
+ "locate",
27678
+ "spotClean",
27679
+ "findPet",
27680
+ "personFollow",
27681
+ "stop",
27682
+ "startClean",
27683
+ "pauseClean",
27684
+ "dockWash",
27685
+ "autoEmpty",
27686
+ "flashOn",
27687
+ "flashOff"
27688
+ ]);
27689
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27690
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27691
+ /**
27692
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27693
+ * native panel and the PTZ mimic render as a button.
27694
+ *
27695
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27696
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27697
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27698
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27699
+ * - `label` — operator-facing English label.
27700
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27701
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27702
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27703
+ * flips it from config, never by editing code.
27704
+ */
27705
+ var NavigationActionEntrySchema = object({
27706
+ id: string(),
27707
+ kind: NavigationEntryKindSchema,
27708
+ label: string(),
27709
+ icon: string(),
27710
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27711
+ soundId: number().int().optional(),
27712
+ /** Per-device feature flag — render this entry only when true. */
27713
+ enabled: boolean()
27714
+ });
27715
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27716
+ var NavigationPointSchema = object({
27717
+ x: number(),
27718
+ y: number()
27719
+ });
27720
+ /**
27721
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27722
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27723
+ * that are turned on for THIS device. Data-driven: the provider derives these
27724
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27725
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27726
+ * that are not dictionary entries.
27727
+ *
27728
+ * - `move` / `stop` — the momentary drive joystick.
27729
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27730
+ * map-coordinate plumbing is wired.
27731
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27732
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27733
+ * - `light` — the on/off fill-light toggle (works anytime).
27734
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27735
+ * camera-service control; needs an active stream).
27736
+ */
27737
+ var NavigationFeaturesSchema = object({
27738
+ move: boolean(),
27739
+ stop: boolean(),
27740
+ goToPoint: boolean(),
27741
+ runAction: boolean(),
27742
+ playSound: boolean(),
27743
+ light: boolean(),
27744
+ lightMode: boolean()
27745
+ });
27746
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27747
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27748
+ /**
27749
+ * Live navigation state so the UI can reflect what the robot is doing:
27750
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27751
+ * - `following` — person/pet follow is currently armed.
27752
+ * - `flash` — the on-camera fill light is on.
27753
+ * - `lightMode` — auto vs manual fill-light mode.
27754
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27755
+ * `lightMode === 'manual'`.
27756
+ */
27757
+ var NavigationStatusSchema = object({
27758
+ mode: _enum([
27759
+ "idle",
27760
+ "cleaning",
27761
+ "spot",
27762
+ "following",
27763
+ "goto",
27764
+ "returning",
27765
+ "paused",
27766
+ "unknown"
27767
+ ]),
27768
+ following: boolean(),
27769
+ flash: boolean(),
27770
+ lightMode: NavigationLightModeSchema,
27771
+ lightLevel: number().min(40).max(100),
27772
+ /** Ms epoch when the slice was last updated. */
27773
+ lastChangedAt: number()
27774
+ });
27775
+ /**
27776
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27777
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27778
+ * convention.
27779
+ */
27780
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27781
+ var navigationCapability = {
27782
+ name: "navigation",
27783
+ scope: "device",
27784
+ deviceNative: true,
27785
+ mode: "singleton",
27786
+ deviceTypes: [DeviceType.Camera],
27787
+ deviceConfig: { ui: {
27788
+ kind: "widget",
27789
+ widgetId: "host/navigation-panel",
27790
+ tab: "navigation",
27791
+ topTab: true,
27792
+ label: "Navigation",
27793
+ order: 0
27794
+ } },
27795
+ methods: {
27796
+ /**
27797
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27798
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27799
+ * path) works for any authenticated user, not admin-only. The UI sends
27800
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27801
+ * a single drive write WITHOUT debouncing.
27802
+ */
27803
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27804
+ /** Halt all motion immediately (zero drive vector). */
27805
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27806
+ /** Send the robot to a point on its live map. */
27807
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27808
+ /**
27809
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27810
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27811
+ */
27812
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27813
+ /**
27814
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27815
+ * unsupported action ids are rejected by the provider.
27816
+ */
27817
+ runAction: method(object({
27818
+ deviceId: number(),
27819
+ actionId: NavigationActionIdSchema
27820
+ }), _void(), { kind: "mutation" }),
27821
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27822
+ playSound: method(object({
27823
+ deviceId: number(),
27824
+ soundId: number().int()
27825
+ }), _void(), { kind: "mutation" }),
27826
+ /**
27827
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27828
+ * works anytime, no active stream required).
27829
+ */
27830
+ setLightOn: method(object({
27831
+ deviceId: number(),
27832
+ on: boolean()
27833
+ }), _void(), { kind: "mutation" }),
27834
+ /**
27835
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27836
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27837
+ * action that generally needs an active camera stream/monitor session — the
27838
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27839
+ */
27840
+ setLightMode: method(object({
27841
+ deviceId: number(),
27842
+ mode: NavigationLightModeSchema,
27843
+ level: number().min(40).max(100).optional()
27844
+ }), _void(), { kind: "mutation" }),
27845
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27846
+ setLightLevel: method(object({
27847
+ deviceId: number(),
27848
+ level: number().min(40).max(100)
27849
+ }), _void(), { kind: "mutation" }),
27850
+ /**
27851
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27852
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27853
+ * `listActions`).
27854
+ */
27855
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27856
+ },
27857
+ events: { onStatusChanged: { data: object({
27858
+ deviceId: number(),
27859
+ status: NavigationStatusSchema
27860
+ }) } },
27861
+ status: {
27862
+ schema: NavigationStatusSchema,
27863
+ kind: "push"
27864
+ },
27865
+ /**
27866
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27867
+ * for live mode / follow / flash changes.
27868
+ */
27869
+ runtimeState: NavigationRuntimeStateSchema,
27870
+ /**
27871
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27872
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27873
+ * that. The live handle re-publishes on connect.
27874
+ *
27875
+ * See `RuntimeStateDurability`. Enforced by
27876
+ * `scripts/check-runtime-state-durability.ts`.
27877
+ */
27878
+ durability: "session"
27879
+ };
27880
+ /**
27881
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27882
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27883
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27884
+ * one Home Assistant projection.
27885
+ */
27886
+ var NetworkLinkStatusSchema = object({
27887
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27888
+ type: _enum([
27889
+ "wifi",
27890
+ "ethernet",
27891
+ "cellular",
27892
+ "unknown"
27893
+ ]),
27894
+ /**
27895
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27896
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27897
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27898
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27899
+ * SKIP a null rather than coerce it.
27900
+ */
27901
+ signalPercent: number().min(0).max(100).nullable(),
27902
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27903
+ rssiDbm: number().optional(),
27904
+ /** Network name of a wireless link, when the firmware reports it. */
27905
+ ssid: string().optional(),
27906
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27907
+ lastUpdated: number()
27908
+ });
27909
+ var networkLinkCapability = {
27910
+ name: "network-link",
27911
+ scope: "device",
27912
+ deviceNative: true,
27913
+ mode: "singleton",
27914
+ deviceTypes: [
27915
+ DeviceType.Camera,
27916
+ DeviceType.Sensor,
27917
+ DeviceType.Button,
27918
+ DeviceType.Switch,
27919
+ DeviceType.Light,
27920
+ DeviceType.Lock,
27921
+ DeviceType.Siren
27922
+ ],
27923
+ methods: {},
27924
+ events: {
27925
+ /**
27926
+ * Emitted whenever the cached status changes (a link switch, a signal
27927
+ * reading that moved). Mirrored on the parent chain by the
27928
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27929
+ */
27930
+ onStatusChanged: { data: object({
27931
+ deviceId: number(),
27932
+ status: NetworkLinkStatusSchema
27933
+ }) } },
27934
+ status: {
27935
+ schema: NetworkLinkStatusSchema,
27936
+ kind: "push",
27937
+ empty: {
27938
+ type: "unknown",
27939
+ signalPercent: null,
27940
+ lastUpdated: 0
27941
+ }
27942
+ },
27943
+ /**
27944
+ * Runtime-state slice — every provider stores the same shape under
27945
+ * `device.runtimeState['network-link']`, read once by the badge and the
27946
+ * Home Assistant projector regardless of the driver.
27947
+ */
27948
+ runtimeState: NetworkLinkStatusSchema,
27949
+ /**
27950
+ * Runtime-state durability: **restored** — a link reading is slow to
27951
+ * change and a sleeping battery camera may not report for hours; the
27952
+ * restored slice is what the badge shows until the next read.
27953
+ *
27954
+ * See `RuntimeStateDurability`. Enforced by
27955
+ * `scripts/check-runtime-state-durability.ts`.
27956
+ */
27957
+ durability: "restored",
27958
+ /** Clock fields: written, but excluded from the compare that decides
27959
+ * whether persisting is worth a SQLite commit. */
27960
+ volatileStateFields: ["lastUpdated"]
27961
+ };
27962
+ /**
27559
27963
  * network-quality — system-scoped singleton capability tracking RTT,
27560
27964
  * jitter, and observed/peak bandwidth per device + per client.
27561
27965
  *
@@ -29244,287 +29648,6 @@ var ptzAutotrackCapability = {
29244
29648
  */
29245
29649
  durability: "session"
29246
29650
  };
29247
- /**
29248
- * `navigation` — a device-scoped capability that natively expresses the FULL
29249
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29250
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29251
- *
29252
- * Why a NEW cap rather than overloading `ptz`:
29253
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29254
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29255
- * The two are different physical models: PTZ is absolute-position + presets,
29256
- * navigation is momentary drive nudges + discrete robot ACTIONS
29257
- * (dock / spot-clean / follow-pet / go-to-point / …).
29258
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29259
- * the reverse:
29260
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29261
- * / `getOptions`), and
29262
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29263
- * robot camera shows up in the existing PTZ control path without every
29264
- * PTZ provider learning about robots. The mapping lives in the adapter,
29265
- * not here (see the addon design note):
29266
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29267
- * ptz.stop() → navigation.stop()
29268
- * ptz.goHome() → navigation.runAction('goHome')
29269
- * ptz.getPresets() → navigation.listActions() (id→preset)
29270
- * ptz.goToPreset(id) → navigation.runAction(id)
29271
- *
29272
- * ## Continuous drive
29273
- *
29274
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29275
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29276
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29277
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29278
- * coalesce them. The UI owns the cadence.
29279
- *
29280
- * ## The action dictionary
29281
- *
29282
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29283
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29284
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29285
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29286
- * vendor-specific list. `kind: 'action'` entries are triggered with
29287
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29288
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29289
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29290
- *
29291
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29292
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29293
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29294
- * every device handle. A future nodedreame publish adds a typed
29295
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29296
- * provider can then swap the raw calls for the typed methods with no change to
29297
- * THIS contract.
29298
- */
29299
- /**
29300
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29301
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29302
- * halts it.
29303
- *
29304
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29305
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29306
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29307
- * vector by it (drivers without proportional drive ignore it).
29308
- *
29309
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29310
- * axis alone; an all-undefined nudge is a no-op.
29311
- */
29312
- var NavigationMoveCommandSchema = object({
29313
- pan: number().min(-1).max(1).optional(),
29314
- tilt: number().min(-1).max(1).optional(),
29315
- speed: number().min(0).max(1).optional()
29316
- });
29317
- /**
29318
- * The enumerated discrete actions a navigation-capable robot can perform via
29319
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29320
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29321
- * `playSound` (see the `sound` dictionary entries).
29322
- */
29323
- var NavigationActionIdSchema = _enum([
29324
- "goHome",
29325
- "locate",
29326
- "spotClean",
29327
- "findPet",
29328
- "personFollow",
29329
- "stop",
29330
- "startClean",
29331
- "pauseClean",
29332
- "dockWash",
29333
- "autoEmpty",
29334
- "flashOn",
29335
- "flashOff"
29336
- ]);
29337
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29338
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29339
- /**
29340
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29341
- * native panel and the PTZ mimic render as a button.
29342
- *
29343
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29344
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29345
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29346
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29347
- * - `label` — operator-facing English label.
29348
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29349
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29350
- * PTZ render ONLY enabled entries. Data-driven: the provider
29351
- * flips it from config, never by editing code.
29352
- */
29353
- var NavigationActionEntrySchema = object({
29354
- id: string(),
29355
- kind: NavigationEntryKindSchema,
29356
- label: string(),
29357
- icon: string(),
29358
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29359
- soundId: number().int().optional(),
29360
- /** Per-device feature flag — render this entry only when true. */
29361
- enabled: boolean()
29362
- });
29363
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29364
- var NavigationPointSchema = object({
29365
- x: number(),
29366
- y: number()
29367
- });
29368
- /**
29369
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29370
- * The cap reports which are enabled so the UI / PTZ render only the controls
29371
- * that are turned on for THIS device. Data-driven: the provider derives these
29372
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29373
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29374
- * that are not dictionary entries.
29375
- *
29376
- * - `move` / `stop` — the momentary drive joystick.
29377
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29378
- * map-coordinate plumbing is wired.
29379
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29380
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29381
- * - `light` — the on/off fill-light toggle (works anytime).
29382
- * - `lightMode` — the auto/manual selector + manual level slider (a
29383
- * camera-service control; needs an active stream).
29384
- */
29385
- var NavigationFeaturesSchema = object({
29386
- move: boolean(),
29387
- stop: boolean(),
29388
- goToPoint: boolean(),
29389
- runAction: boolean(),
29390
- playSound: boolean(),
29391
- light: boolean(),
29392
- lightMode: boolean()
29393
- });
29394
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29395
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29396
- /**
29397
- * Live navigation state so the UI can reflect what the robot is doing:
29398
- * - `mode` — coarse activity (idle / cleaning / following / …).
29399
- * - `following` — person/pet follow is currently armed.
29400
- * - `flash` — the on-camera fill light is on.
29401
- * - `lightMode` — auto vs manual fill-light mode.
29402
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29403
- * `lightMode === 'manual'`.
29404
- */
29405
- var NavigationStatusSchema = object({
29406
- mode: _enum([
29407
- "idle",
29408
- "cleaning",
29409
- "spot",
29410
- "following",
29411
- "goto",
29412
- "returning",
29413
- "paused",
29414
- "unknown"
29415
- ]),
29416
- following: boolean(),
29417
- flash: boolean(),
29418
- lightMode: NavigationLightModeSchema,
29419
- lightLevel: number().min(40).max(100),
29420
- /** Ms epoch when the slice was last updated. */
29421
- lastChangedAt: number()
29422
- });
29423
- /**
29424
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29425
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29426
- * convention.
29427
- */
29428
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29429
- var navigationCapability = {
29430
- name: "navigation",
29431
- scope: "device",
29432
- deviceNative: true,
29433
- mode: "singleton",
29434
- deviceTypes: [DeviceType.Camera],
29435
- deviceConfig: { ui: {
29436
- kind: "widget",
29437
- widgetId: "host/navigation-panel",
29438
- tab: "navigation",
29439
- topTab: true,
29440
- label: "Navigation",
29441
- order: 0
29442
- } },
29443
- methods: {
29444
- /**
29445
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29446
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29447
- * path) works for any authenticated user, not admin-only. The UI sends
29448
- * these at ~1 Hz while a control is held; the provider forwards each one to
29449
- * a single drive write WITHOUT debouncing.
29450
- */
29451
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29452
- /** Halt all motion immediately (zero drive vector). */
29453
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29454
- /** Send the robot to a point on its live map. */
29455
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29456
- /**
29457
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29458
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29459
- */
29460
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29461
- /**
29462
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29463
- * unsupported action ids are rejected by the provider.
29464
- */
29465
- runAction: method(object({
29466
- deviceId: number(),
29467
- actionId: NavigationActionIdSchema
29468
- }), _void(), { kind: "mutation" }),
29469
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29470
- playSound: method(object({
29471
- deviceId: number(),
29472
- soundId: number().int()
29473
- }), _void(), { kind: "mutation" }),
29474
- /**
29475
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29476
- * works anytime, no active stream required).
29477
- */
29478
- setLightOn: method(object({
29479
- deviceId: number(),
29480
- on: boolean()
29481
- }), _void(), { kind: "mutation" }),
29482
- /**
29483
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29484
- * initial `level`. The auto/manual + level control is a CAMERA-service
29485
- * action that generally needs an active camera stream/monitor session — the
29486
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29487
- */
29488
- setLightMode: method(object({
29489
- deviceId: number(),
29490
- mode: NavigationLightModeSchema,
29491
- level: number().min(40).max(100).optional()
29492
- }), _void(), { kind: "mutation" }),
29493
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29494
- setLightLevel: method(object({
29495
- deviceId: number(),
29496
- level: number().min(40).max(100)
29497
- }), _void(), { kind: "mutation" }),
29498
- /**
29499
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29500
- * controls the UI shows (the per-entry flags for the dictionary come back on
29501
- * `listActions`).
29502
- */
29503
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29504
- },
29505
- events: { onStatusChanged: { data: object({
29506
- deviceId: number(),
29507
- status: NavigationStatusSchema
29508
- }) } },
29509
- status: {
29510
- schema: NavigationStatusSchema,
29511
- kind: "push"
29512
- },
29513
- /**
29514
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29515
- * for live mode / follow / flash changes.
29516
- */
29517
- runtimeState: NavigationRuntimeStateSchema,
29518
- /**
29519
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29520
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29521
- * that. The live handle re-publishes on connect.
29522
- *
29523
- * See `RuntimeStateDurability`. Enforced by
29524
- * `scripts/check-runtime-state-durability.ts`.
29525
- */
29526
- durability: "session"
29527
- };
29528
29651
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29529
29652
  kind: "mutation",
29530
29653
  auth: "admin"
@@ -39391,6 +39514,12 @@ Object.freeze({
39391
39514
  addonId: null,
39392
39515
  access: "view"
39393
39516
  },
39517
+ "storage.listDrainProgress": {
39518
+ capName: "storage",
39519
+ capScope: "system",
39520
+ addonId: null,
39521
+ access: "view"
39522
+ },
39394
39523
  "storage.listLocationDeclarations": {
39395
39524
  capName: "storage",
39396
39525
  capScope: "system",
@@ -39535,6 +39664,12 @@ Object.freeze({
39535
39664
  addonId: null,
39536
39665
  access: "view"
39537
39666
  },
39667
+ "storageOccupancy.getOccupancy": {
39668
+ capName: "storage-occupancy",
39669
+ capScope: "system",
39670
+ addonId: null,
39671
+ access: "view"
39672
+ },
39538
39673
  "storageProvider.abortUpload": {
39539
39674
  capName: "storage-provider",
39540
39675
  capScope: "system",