@camstack/addon-import-alexa 0.2.78 → 0.2.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +500 -365
  2. package/dist/addon.mjs +500 -365
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -38,7 +38,7 @@ let node_os = require("node:os");
38
38
  let node_fs = require("node:fs");
39
39
  let node_path = require("node:path");
40
40
  node_path = __toESM(node_path);
41
- //#region ../types/dist/event-category-zAv7pMUz.mjs
41
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
42
42
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
43
43
  EventCategory["SystemBoot"] = "system.boot";
44
44
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -233,6 +233,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
233
233
  EventCategory["ProcessCrashed"] = "process.crashed";
234
234
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
235
235
  EventCategory["ProcessRestarted"] = "process.restarted";
236
+ /**
237
+ * The SET of storage locations changed — one was created, edited, enabled,
238
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
239
+ *
240
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
241
+ * it must also converge on its own periodic path, because a dropped event
242
+ * must not leave a node writing to yesterday's disk set forever. It exists
243
+ * because there was NO signal at all — an operator who added a second
244
+ * recordings disk in the admin UI got nothing, and the recorder kept its
245
+ * resolved locations until something else happened to re-resolve them
246
+ * (D387). Payload `StorageLocationsChangedPayload`.
247
+ */
248
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
236
249
  EventCategory["RecordingStarted"] = "recording.started";
237
250
  EventCategory["RecordingStopped"] = "recording.stopped";
238
251
  EventCategory["RecordingError"] = "recording.error";
@@ -8694,6 +8707,21 @@ var StorageCleanupJobSchema = object({
8694
8707
  });
8695
8708
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8696
8709
  /**
8710
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8711
+ * alias below is `z.infer<>` of it, never a second spelling.
8712
+ */
8713
+ var StorageLocationModeSchema = _enum([
8714
+ "active",
8715
+ "readonly",
8716
+ "drain",
8717
+ "disabled"
8718
+ ]);
8719
+ _enum([
8720
+ "normal",
8721
+ "never",
8722
+ "drain"
8723
+ ]);
8724
+ /**
8697
8725
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8698
8726
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8699
8727
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8759,6 +8787,21 @@ var StorageLocationSchema = object({
8759
8787
  * stops existing rather than being re-derived on every read.
8760
8788
  */
8761
8789
  enabled: boolean().optional(),
8790
+ /**
8791
+ * THE state of this location (D385), and the only authority on what may be
8792
+ * written, read or evicted here. Interpreted in exactly one place —
8793
+ * `storage-location-mode.ts` — which also folds the legacy
8794
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8795
+ * ambiguous.
8796
+ *
8797
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8798
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8799
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8800
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8801
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8802
+ * either, so the two cannot disagree.
8803
+ */
8804
+ mode: StorageLocationModeSchema.optional(),
8762
8805
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8763
8806
  * for node-local locations it can reach) — never persisted, absent when the
8764
8807
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8766,11 +8809,46 @@ var StorageLocationSchema = object({
8766
8809
  totalBytes: number(),
8767
8810
  availableBytes: number()
8768
8811
  }).nullable().optional(),
8812
+ /**
8813
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8814
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8815
+ * never persisted, never a filesystem walk.
8816
+ *
8817
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8818
+ * location yet — nobody stores here, the owning addon is down, or the first
8819
+ * refresh has not completed. A UI must omit the segment rather than draw it
8820
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8821
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8822
+ * be spelled out loud instead of appearing by accident.
8823
+ *
8824
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8825
+ * about the whole figure rather than about its freshest part.
8826
+ */
8827
+ owned: object({
8828
+ bytes: number().int().nonnegative(),
8829
+ measuredAtMs: number().int().nonnegative()
8830
+ }).optional(),
8769
8831
  createdAt: number(),
8770
8832
  updatedAt: number()
8771
8833
  });
8772
8834
  object({ isDefault: boolean().optional() });
8773
8835
  /**
8836
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8837
+ *
8838
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8839
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8840
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8841
+ * operator learns not to believe the screen.
8842
+ */
8843
+ var StorageDrainProgressSchema = object({
8844
+ locationId: string(),
8845
+ startedAtMs: number(),
8846
+ startBytes: number(),
8847
+ bytesRemaining: number(),
8848
+ drained: boolean(),
8849
+ estimatedEmptyAtMs: number().nullable()
8850
+ });
8851
+ /**
8774
8852
  * Reference accepted by consumer-facing `api.storage.*` calls.
8775
8853
  * Either:
8776
8854
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22184,7 +22262,7 @@ method(object({
22184
22262
  }), _void(), {
22185
22263
  kind: "mutation",
22186
22264
  auth: "admin"
22187
- }), method(object({ id: string() }), object({
22265
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22188
22266
  ok: boolean(),
22189
22267
  error: string().optional()
22190
22268
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22254,6 +22332,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22254
22332
  kind: "mutation",
22255
22333
  auth: "admin"
22256
22334
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22335
+ /**
22336
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22337
+ * location (D388).
22338
+ *
22339
+ * ## Why this is not `storage-evictable`
22340
+ *
22341
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22342
+ * not, in two ways that both matter and both bite hardest on the locations an
22343
+ * operator most wants a figure for:
22344
+ *
22345
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22346
+ * and `recordingsLow:default` deliberately share one root and evict as one
22347
+ * oldest-first pool, so both answer with the SAME combined total. As an
22348
+ * occupancy figure that double-counts the disk.
22349
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22350
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22351
+ * is retiring and staring at.
22352
+ *
22353
+ * So this is its own contract with its own quantity, and the quantity is
22354
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22355
+ * would ever be willing to delete it. A provider that can only answer
22356
+ * "evictable" must not register here — a number that silently means different
22357
+ * things per class is worse than no number.
22358
+ *
22359
+ * ## Absence is an answer
22360
+ *
22361
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22362
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22363
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22364
+ * consuming side has to be written out loud instead of appearing by accident.
22365
+ *
22366
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22367
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22368
+ */
22369
+ /** One provider's occupancy answer for one location. */
22370
+ var StorageOccupancyReportSchema = object({
22371
+ locationId: string(),
22372
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22373
+ * not net of what it is willing to delete. */
22374
+ ownedBytes: number().int().nonnegative(),
22375
+ /** When the provider last actually measured this. The orchestrator carries it
22376
+ * through so a UI can say how old the figure is instead of implying "now". */
22377
+ measuredAtMs: number().int().nonnegative()
22378
+ });
22379
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22257
22380
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22258
22381
  providerId: string().min(1),
22259
22382
  displayName: string().min(1),
@@ -24089,88 +24212,6 @@ onStatusChanged: { data: object({
24089
24212
  volatileStateFields: ["lastUpdated"]
24090
24213
  };
24091
24214
  /**
24092
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24093
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24094
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24095
- * one Home Assistant projection.
24096
- */
24097
- var NetworkLinkStatusSchema = object({
24098
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24099
- type: _enum([
24100
- "wifi",
24101
- "ethernet",
24102
- "cellular",
24103
- "unknown"
24104
- ]),
24105
- /**
24106
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24107
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24108
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24109
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24110
- * SKIP a null rather than coerce it.
24111
- */
24112
- signalPercent: number().min(0).max(100).nullable(),
24113
- /** Raw received signal strength in dBm, when the firmware reports one. */
24114
- rssiDbm: number().optional(),
24115
- /** Network name of a wireless link, when the firmware reports it. */
24116
- ssid: string().optional(),
24117
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24118
- lastUpdated: number()
24119
- });
24120
- var networkLinkCapability = {
24121
- name: "network-link",
24122
- scope: "device",
24123
- deviceNative: true,
24124
- mode: "singleton",
24125
- deviceTypes: [
24126
- DeviceType.Camera,
24127
- DeviceType.Sensor,
24128
- DeviceType.Button,
24129
- DeviceType.Switch,
24130
- DeviceType.Light,
24131
- DeviceType.Lock,
24132
- DeviceType.Siren
24133
- ],
24134
- methods: {},
24135
- events: {
24136
- /**
24137
- * Emitted whenever the cached status changes (a link switch, a signal
24138
- * reading that moved). Mirrored on the parent chain by the
24139
- * DeviceEventPropagator like `battery.onStatusChanged`.
24140
- */
24141
- onStatusChanged: { data: object({
24142
- deviceId: number(),
24143
- status: NetworkLinkStatusSchema
24144
- }) } },
24145
- status: {
24146
- schema: NetworkLinkStatusSchema,
24147
- kind: "push",
24148
- empty: {
24149
- type: "unknown",
24150
- signalPercent: null,
24151
- lastUpdated: 0
24152
- }
24153
- },
24154
- /**
24155
- * Runtime-state slice — every provider stores the same shape under
24156
- * `device.runtimeState['network-link']`, read once by the badge and the
24157
- * Home Assistant projector regardless of the driver.
24158
- */
24159
- runtimeState: NetworkLinkStatusSchema,
24160
- /**
24161
- * Runtime-state durability: **restored** — a link reading is slow to
24162
- * change and a sleeping battery camera may not report for hours; the
24163
- * restored slice is what the badge shows until the next read.
24164
- *
24165
- * See `RuntimeStateDurability`. Enforced by
24166
- * `scripts/check-runtime-state-durability.ts`.
24167
- */
24168
- durability: "restored",
24169
- /** Clock fields: written, but excluded from the compare that decides
24170
- * whether persisting is worth a SQLite commit. */
24171
- volatileStateFields: ["lastUpdated"]
24172
- };
24173
- /**
24174
24215
  * Generic boolean sensor — last-resort fallback when no domain-
24175
24216
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24176
24217
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27717,6 +27758,369 @@ var nativeObjectDetectionCapability = {
27717
27758
  volatileStateFields: ["lastFetchedAt"]
27718
27759
  };
27719
27760
  /**
27761
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27762
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27763
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27764
+ *
27765
+ * Why a NEW cap rather than overloading `ptz`:
27766
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27767
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27768
+ * The two are different physical models: PTZ is absolute-position + presets,
27769
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27770
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27771
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27772
+ * the reverse:
27773
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27774
+ * / `getOptions`), and
27775
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27776
+ * robot camera shows up in the existing PTZ control path without every
27777
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27778
+ * not here (see the addon design note):
27779
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27780
+ * ptz.stop() → navigation.stop()
27781
+ * ptz.goHome() → navigation.runAction('goHome')
27782
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27783
+ * ptz.goToPreset(id) → navigation.runAction(id)
27784
+ *
27785
+ * ## Continuous drive
27786
+ *
27787
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27788
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27789
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27790
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27791
+ * coalesce them. The UI owns the cadence.
27792
+ *
27793
+ * ## The action dictionary
27794
+ *
27795
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27796
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27797
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27798
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27799
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27800
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27801
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27802
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27803
+ *
27804
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27805
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27806
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27807
+ * every device handle. A future nodedreame publish adds a typed
27808
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27809
+ * provider can then swap the raw calls for the typed methods with no change to
27810
+ * THIS contract.
27811
+ */
27812
+ /**
27813
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27814
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27815
+ * halts it.
27816
+ *
27817
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27818
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27819
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27820
+ * vector by it (drivers without proportional drive ignore it).
27821
+ *
27822
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27823
+ * axis alone; an all-undefined nudge is a no-op.
27824
+ */
27825
+ var NavigationMoveCommandSchema = object({
27826
+ pan: number().min(-1).max(1).optional(),
27827
+ tilt: number().min(-1).max(1).optional(),
27828
+ speed: number().min(0).max(1).optional()
27829
+ });
27830
+ /**
27831
+ * The enumerated discrete actions a navigation-capable robot can perform via
27832
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27833
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27834
+ * `playSound` (see the `sound` dictionary entries).
27835
+ */
27836
+ var NavigationActionIdSchema = _enum([
27837
+ "goHome",
27838
+ "locate",
27839
+ "spotClean",
27840
+ "findPet",
27841
+ "personFollow",
27842
+ "stop",
27843
+ "startClean",
27844
+ "pauseClean",
27845
+ "dockWash",
27846
+ "autoEmpty",
27847
+ "flashOn",
27848
+ "flashOff"
27849
+ ]);
27850
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27851
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27852
+ /**
27853
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27854
+ * native panel and the PTZ mimic render as a button.
27855
+ *
27856
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27857
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27858
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27859
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27860
+ * - `label` — operator-facing English label.
27861
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27862
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27863
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27864
+ * flips it from config, never by editing code.
27865
+ */
27866
+ var NavigationActionEntrySchema = object({
27867
+ id: string(),
27868
+ kind: NavigationEntryKindSchema,
27869
+ label: string(),
27870
+ icon: string(),
27871
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27872
+ soundId: number().int().optional(),
27873
+ /** Per-device feature flag — render this entry only when true. */
27874
+ enabled: boolean()
27875
+ });
27876
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27877
+ var NavigationPointSchema = object({
27878
+ x: number(),
27879
+ y: number()
27880
+ });
27881
+ /**
27882
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27883
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27884
+ * that are turned on for THIS device. Data-driven: the provider derives these
27885
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27886
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27887
+ * that are not dictionary entries.
27888
+ *
27889
+ * - `move` / `stop` — the momentary drive joystick.
27890
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27891
+ * map-coordinate plumbing is wired.
27892
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27893
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27894
+ * - `light` — the on/off fill-light toggle (works anytime).
27895
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27896
+ * camera-service control; needs an active stream).
27897
+ */
27898
+ var NavigationFeaturesSchema = object({
27899
+ move: boolean(),
27900
+ stop: boolean(),
27901
+ goToPoint: boolean(),
27902
+ runAction: boolean(),
27903
+ playSound: boolean(),
27904
+ light: boolean(),
27905
+ lightMode: boolean()
27906
+ });
27907
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27908
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27909
+ /**
27910
+ * Live navigation state so the UI can reflect what the robot is doing:
27911
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27912
+ * - `following` — person/pet follow is currently armed.
27913
+ * - `flash` — the on-camera fill light is on.
27914
+ * - `lightMode` — auto vs manual fill-light mode.
27915
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27916
+ * `lightMode === 'manual'`.
27917
+ */
27918
+ var NavigationStatusSchema = object({
27919
+ mode: _enum([
27920
+ "idle",
27921
+ "cleaning",
27922
+ "spot",
27923
+ "following",
27924
+ "goto",
27925
+ "returning",
27926
+ "paused",
27927
+ "unknown"
27928
+ ]),
27929
+ following: boolean(),
27930
+ flash: boolean(),
27931
+ lightMode: NavigationLightModeSchema,
27932
+ lightLevel: number().min(40).max(100),
27933
+ /** Ms epoch when the slice was last updated. */
27934
+ lastChangedAt: number()
27935
+ });
27936
+ /**
27937
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27938
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27939
+ * convention.
27940
+ */
27941
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27942
+ var navigationCapability = {
27943
+ name: "navigation",
27944
+ scope: "device",
27945
+ deviceNative: true,
27946
+ mode: "singleton",
27947
+ deviceTypes: [DeviceType.Camera],
27948
+ deviceConfig: { ui: {
27949
+ kind: "widget",
27950
+ widgetId: "host/navigation-panel",
27951
+ tab: "navigation",
27952
+ topTab: true,
27953
+ label: "Navigation",
27954
+ order: 0
27955
+ } },
27956
+ methods: {
27957
+ /**
27958
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27959
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27960
+ * path) works for any authenticated user, not admin-only. The UI sends
27961
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27962
+ * a single drive write WITHOUT debouncing.
27963
+ */
27964
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27965
+ /** Halt all motion immediately (zero drive vector). */
27966
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27967
+ /** Send the robot to a point on its live map. */
27968
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27969
+ /**
27970
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27971
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27972
+ */
27973
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27974
+ /**
27975
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27976
+ * unsupported action ids are rejected by the provider.
27977
+ */
27978
+ runAction: method(object({
27979
+ deviceId: number(),
27980
+ actionId: NavigationActionIdSchema
27981
+ }), _void(), { kind: "mutation" }),
27982
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27983
+ playSound: method(object({
27984
+ deviceId: number(),
27985
+ soundId: number().int()
27986
+ }), _void(), { kind: "mutation" }),
27987
+ /**
27988
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27989
+ * works anytime, no active stream required).
27990
+ */
27991
+ setLightOn: method(object({
27992
+ deviceId: number(),
27993
+ on: boolean()
27994
+ }), _void(), { kind: "mutation" }),
27995
+ /**
27996
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27997
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27998
+ * action that generally needs an active camera stream/monitor session — the
27999
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28000
+ */
28001
+ setLightMode: method(object({
28002
+ deviceId: number(),
28003
+ mode: NavigationLightModeSchema,
28004
+ level: number().min(40).max(100).optional()
28005
+ }), _void(), { kind: "mutation" }),
28006
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28007
+ setLightLevel: method(object({
28008
+ deviceId: number(),
28009
+ level: number().min(40).max(100)
28010
+ }), _void(), { kind: "mutation" }),
28011
+ /**
28012
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28013
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28014
+ * `listActions`).
28015
+ */
28016
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28017
+ },
28018
+ events: { onStatusChanged: { data: object({
28019
+ deviceId: number(),
28020
+ status: NavigationStatusSchema
28021
+ }) } },
28022
+ status: {
28023
+ schema: NavigationStatusSchema,
28024
+ kind: "push"
28025
+ },
28026
+ /**
28027
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28028
+ * for live mode / follow / flash changes.
28029
+ */
28030
+ runtimeState: NavigationRuntimeStateSchema,
28031
+ /**
28032
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28033
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28034
+ * that. The live handle re-publishes on connect.
28035
+ *
28036
+ * See `RuntimeStateDurability`. Enforced by
28037
+ * `scripts/check-runtime-state-durability.ts`.
28038
+ */
28039
+ durability: "session"
28040
+ };
28041
+ /**
28042
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28043
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28044
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28045
+ * one Home Assistant projection.
28046
+ */
28047
+ var NetworkLinkStatusSchema = object({
28048
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28049
+ type: _enum([
28050
+ "wifi",
28051
+ "ethernet",
28052
+ "cellular",
28053
+ "unknown"
28054
+ ]),
28055
+ /**
28056
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28057
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28058
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28059
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28060
+ * SKIP a null rather than coerce it.
28061
+ */
28062
+ signalPercent: number().min(0).max(100).nullable(),
28063
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28064
+ rssiDbm: number().optional(),
28065
+ /** Network name of a wireless link, when the firmware reports it. */
28066
+ ssid: string().optional(),
28067
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28068
+ lastUpdated: number()
28069
+ });
28070
+ var networkLinkCapability = {
28071
+ name: "network-link",
28072
+ scope: "device",
28073
+ deviceNative: true,
28074
+ mode: "singleton",
28075
+ deviceTypes: [
28076
+ DeviceType.Camera,
28077
+ DeviceType.Sensor,
28078
+ DeviceType.Button,
28079
+ DeviceType.Switch,
28080
+ DeviceType.Light,
28081
+ DeviceType.Lock,
28082
+ DeviceType.Siren
28083
+ ],
28084
+ methods: {},
28085
+ events: {
28086
+ /**
28087
+ * Emitted whenever the cached status changes (a link switch, a signal
28088
+ * reading that moved). Mirrored on the parent chain by the
28089
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28090
+ */
28091
+ onStatusChanged: { data: object({
28092
+ deviceId: number(),
28093
+ status: NetworkLinkStatusSchema
28094
+ }) } },
28095
+ status: {
28096
+ schema: NetworkLinkStatusSchema,
28097
+ kind: "push",
28098
+ empty: {
28099
+ type: "unknown",
28100
+ signalPercent: null,
28101
+ lastUpdated: 0
28102
+ }
28103
+ },
28104
+ /**
28105
+ * Runtime-state slice — every provider stores the same shape under
28106
+ * `device.runtimeState['network-link']`, read once by the badge and the
28107
+ * Home Assistant projector regardless of the driver.
28108
+ */
28109
+ runtimeState: NetworkLinkStatusSchema,
28110
+ /**
28111
+ * Runtime-state durability: **restored** — a link reading is slow to
28112
+ * change and a sleeping battery camera may not report for hours; the
28113
+ * restored slice is what the badge shows until the next read.
28114
+ *
28115
+ * See `RuntimeStateDurability`. Enforced by
28116
+ * `scripts/check-runtime-state-durability.ts`.
28117
+ */
28118
+ durability: "restored",
28119
+ /** Clock fields: written, but excluded from the compare that decides
28120
+ * whether persisting is worth a SQLite commit. */
28121
+ volatileStateFields: ["lastUpdated"]
28122
+ };
28123
+ /**
27720
28124
  * network-quality — system-scoped singleton capability tracking RTT,
27721
28125
  * jitter, and observed/peak bandwidth per device + per client.
27722
28126
  *
@@ -29297,287 +29701,6 @@ var ptzAutotrackCapability = {
29297
29701
  */
29298
29702
  durability: "session"
29299
29703
  };
29300
- /**
29301
- * `navigation` — a device-scoped capability that natively expresses the FULL
29302
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29303
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29304
- *
29305
- * Why a NEW cap rather than overloading `ptz`:
29306
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29307
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29308
- * The two are different physical models: PTZ is absolute-position + presets,
29309
- * navigation is momentary drive nudges + discrete robot ACTIONS
29310
- * (dock / spot-clean / follow-pet / go-to-point / …).
29311
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29312
- * the reverse:
29313
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29314
- * / `getOptions`), and
29315
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29316
- * robot camera shows up in the existing PTZ control path without every
29317
- * PTZ provider learning about robots. The mapping lives in the adapter,
29318
- * not here (see the addon design note):
29319
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29320
- * ptz.stop() → navigation.stop()
29321
- * ptz.goHome() → navigation.runAction('goHome')
29322
- * ptz.getPresets() → navigation.listActions() (id→preset)
29323
- * ptz.goToPreset(id) → navigation.runAction(id)
29324
- *
29325
- * ## Continuous drive
29326
- *
29327
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29328
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29329
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29330
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29331
- * coalesce them. The UI owns the cadence.
29332
- *
29333
- * ## The action dictionary
29334
- *
29335
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29336
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29337
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29338
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29339
- * vendor-specific list. `kind: 'action'` entries are triggered with
29340
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29341
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29342
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29343
- *
29344
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29345
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29346
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29347
- * every device handle. A future nodedreame publish adds a typed
29348
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29349
- * provider can then swap the raw calls for the typed methods with no change to
29350
- * THIS contract.
29351
- */
29352
- /**
29353
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29354
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29355
- * halts it.
29356
- *
29357
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29358
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29359
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29360
- * vector by it (drivers without proportional drive ignore it).
29361
- *
29362
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29363
- * axis alone; an all-undefined nudge is a no-op.
29364
- */
29365
- var NavigationMoveCommandSchema = object({
29366
- pan: number().min(-1).max(1).optional(),
29367
- tilt: number().min(-1).max(1).optional(),
29368
- speed: number().min(0).max(1).optional()
29369
- });
29370
- /**
29371
- * The enumerated discrete actions a navigation-capable robot can perform via
29372
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29373
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29374
- * `playSound` (see the `sound` dictionary entries).
29375
- */
29376
- var NavigationActionIdSchema = _enum([
29377
- "goHome",
29378
- "locate",
29379
- "spotClean",
29380
- "findPet",
29381
- "personFollow",
29382
- "stop",
29383
- "startClean",
29384
- "pauseClean",
29385
- "dockWash",
29386
- "autoEmpty",
29387
- "flashOn",
29388
- "flashOff"
29389
- ]);
29390
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29391
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29392
- /**
29393
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29394
- * native panel and the PTZ mimic render as a button.
29395
- *
29396
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29397
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29398
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29399
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29400
- * - `label` — operator-facing English label.
29401
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29402
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29403
- * PTZ render ONLY enabled entries. Data-driven: the provider
29404
- * flips it from config, never by editing code.
29405
- */
29406
- var NavigationActionEntrySchema = object({
29407
- id: string(),
29408
- kind: NavigationEntryKindSchema,
29409
- label: string(),
29410
- icon: string(),
29411
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29412
- soundId: number().int().optional(),
29413
- /** Per-device feature flag — render this entry only when true. */
29414
- enabled: boolean()
29415
- });
29416
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29417
- var NavigationPointSchema = object({
29418
- x: number(),
29419
- y: number()
29420
- });
29421
- /**
29422
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29423
- * The cap reports which are enabled so the UI / PTZ render only the controls
29424
- * that are turned on for THIS device. Data-driven: the provider derives these
29425
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29426
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29427
- * that are not dictionary entries.
29428
- *
29429
- * - `move` / `stop` — the momentary drive joystick.
29430
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29431
- * map-coordinate plumbing is wired.
29432
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29433
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29434
- * - `light` — the on/off fill-light toggle (works anytime).
29435
- * - `lightMode` — the auto/manual selector + manual level slider (a
29436
- * camera-service control; needs an active stream).
29437
- */
29438
- var NavigationFeaturesSchema = object({
29439
- move: boolean(),
29440
- stop: boolean(),
29441
- goToPoint: boolean(),
29442
- runAction: boolean(),
29443
- playSound: boolean(),
29444
- light: boolean(),
29445
- lightMode: boolean()
29446
- });
29447
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29448
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29449
- /**
29450
- * Live navigation state so the UI can reflect what the robot is doing:
29451
- * - `mode` — coarse activity (idle / cleaning / following / …).
29452
- * - `following` — person/pet follow is currently armed.
29453
- * - `flash` — the on-camera fill light is on.
29454
- * - `lightMode` — auto vs manual fill-light mode.
29455
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29456
- * `lightMode === 'manual'`.
29457
- */
29458
- var NavigationStatusSchema = object({
29459
- mode: _enum([
29460
- "idle",
29461
- "cleaning",
29462
- "spot",
29463
- "following",
29464
- "goto",
29465
- "returning",
29466
- "paused",
29467
- "unknown"
29468
- ]),
29469
- following: boolean(),
29470
- flash: boolean(),
29471
- lightMode: NavigationLightModeSchema,
29472
- lightLevel: number().min(40).max(100),
29473
- /** Ms epoch when the slice was last updated. */
29474
- lastChangedAt: number()
29475
- });
29476
- /**
29477
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29478
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29479
- * convention.
29480
- */
29481
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29482
- var navigationCapability = {
29483
- name: "navigation",
29484
- scope: "device",
29485
- deviceNative: true,
29486
- mode: "singleton",
29487
- deviceTypes: [DeviceType.Camera],
29488
- deviceConfig: { ui: {
29489
- kind: "widget",
29490
- widgetId: "host/navigation-panel",
29491
- tab: "navigation",
29492
- topTab: true,
29493
- label: "Navigation",
29494
- order: 0
29495
- } },
29496
- methods: {
29497
- /**
29498
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29499
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29500
- * path) works for any authenticated user, not admin-only. The UI sends
29501
- * these at ~1 Hz while a control is held; the provider forwards each one to
29502
- * a single drive write WITHOUT debouncing.
29503
- */
29504
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29505
- /** Halt all motion immediately (zero drive vector). */
29506
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29507
- /** Send the robot to a point on its live map. */
29508
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29509
- /**
29510
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29511
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29512
- */
29513
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29514
- /**
29515
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29516
- * unsupported action ids are rejected by the provider.
29517
- */
29518
- runAction: method(object({
29519
- deviceId: number(),
29520
- actionId: NavigationActionIdSchema
29521
- }), _void(), { kind: "mutation" }),
29522
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29523
- playSound: method(object({
29524
- deviceId: number(),
29525
- soundId: number().int()
29526
- }), _void(), { kind: "mutation" }),
29527
- /**
29528
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29529
- * works anytime, no active stream required).
29530
- */
29531
- setLightOn: method(object({
29532
- deviceId: number(),
29533
- on: boolean()
29534
- }), _void(), { kind: "mutation" }),
29535
- /**
29536
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29537
- * initial `level`. The auto/manual + level control is a CAMERA-service
29538
- * action that generally needs an active camera stream/monitor session — the
29539
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29540
- */
29541
- setLightMode: method(object({
29542
- deviceId: number(),
29543
- mode: NavigationLightModeSchema,
29544
- level: number().min(40).max(100).optional()
29545
- }), _void(), { kind: "mutation" }),
29546
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29547
- setLightLevel: method(object({
29548
- deviceId: number(),
29549
- level: number().min(40).max(100)
29550
- }), _void(), { kind: "mutation" }),
29551
- /**
29552
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29553
- * controls the UI shows (the per-entry flags for the dictionary come back on
29554
- * `listActions`).
29555
- */
29556
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29557
- },
29558
- events: { onStatusChanged: { data: object({
29559
- deviceId: number(),
29560
- status: NavigationStatusSchema
29561
- }) } },
29562
- status: {
29563
- schema: NavigationStatusSchema,
29564
- kind: "push"
29565
- },
29566
- /**
29567
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29568
- * for live mode / follow / flash changes.
29569
- */
29570
- runtimeState: NavigationRuntimeStateSchema,
29571
- /**
29572
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29573
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29574
- * that. The live handle re-publishes on connect.
29575
- *
29576
- * See `RuntimeStateDurability`. Enforced by
29577
- * `scripts/check-runtime-state-durability.ts`.
29578
- */
29579
- durability: "session"
29580
- };
29581
29704
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29582
29705
  kind: "mutation",
29583
29706
  auth: "admin"
@@ -39040,6 +39163,12 @@ Object.freeze({
39040
39163
  addonId: null,
39041
39164
  access: "view"
39042
39165
  },
39166
+ "storage.listDrainProgress": {
39167
+ capName: "storage",
39168
+ capScope: "system",
39169
+ addonId: null,
39170
+ access: "view"
39171
+ },
39043
39172
  "storage.listLocationDeclarations": {
39044
39173
  capName: "storage",
39045
39174
  capScope: "system",
@@ -39184,6 +39313,12 @@ Object.freeze({
39184
39313
  addonId: null,
39185
39314
  access: "view"
39186
39315
  },
39316
+ "storageOccupancy.getOccupancy": {
39317
+ capName: "storage-occupancy",
39318
+ capScope: "system",
39319
+ addonId: null,
39320
+ access: "view"
39321
+ },
39187
39322
  "storageProvider.abortUpload": {
39188
39323
  capName: "storage-provider",
39189
39324
  capScope: "system",