@camstack/addon-provider-rademacher 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
@@ -984,7 +984,7 @@ var Rademacher = class {
984
984
  }
985
985
  };
986
986
  //#endregion
987
- //#region ../types/dist/event-category-zAv7pMUz.mjs
987
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
988
988
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
989
989
  EventCategory["SystemBoot"] = "system.boot";
990
990
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1179,6 +1179,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1179
1179
  EventCategory["ProcessCrashed"] = "process.crashed";
1180
1180
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
1181
1181
  EventCategory["ProcessRestarted"] = "process.restarted";
1182
+ /**
1183
+ * The SET of storage locations changed — one was created, edited, enabled,
1184
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
1185
+ *
1186
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
1187
+ * it must also converge on its own periodic path, because a dropped event
1188
+ * must not leave a node writing to yesterday's disk set forever. It exists
1189
+ * because there was NO signal at all — an operator who added a second
1190
+ * recordings disk in the admin UI got nothing, and the recorder kept its
1191
+ * resolved locations until something else happened to re-resolve them
1192
+ * (D387). Payload `StorageLocationsChangedPayload`.
1193
+ */
1194
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
1182
1195
  EventCategory["RecordingStarted"] = "recording.started";
1183
1196
  EventCategory["RecordingStopped"] = "recording.stopped";
1184
1197
  EventCategory["RecordingError"] = "recording.error";
@@ -9521,6 +9534,21 @@ var StorageCleanupJobSchema = object({
9521
9534
  });
9522
9535
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
9523
9536
  /**
9537
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
9538
+ * alias below is `z.infer<>` of it, never a second spelling.
9539
+ */
9540
+ var StorageLocationModeSchema = _enum([
9541
+ "active",
9542
+ "readonly",
9543
+ "drain",
9544
+ "disabled"
9545
+ ]);
9546
+ _enum([
9547
+ "normal",
9548
+ "never",
9549
+ "drain"
9550
+ ]);
9551
+ /**
9524
9552
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9525
9553
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9526
9554
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9586,6 +9614,21 @@ var StorageLocationSchema = object({
9586
9614
  * stops existing rather than being re-derived on every read.
9587
9615
  */
9588
9616
  enabled: boolean().optional(),
9617
+ /**
9618
+ * THE state of this location (D385), and the only authority on what may be
9619
+ * written, read or evicted here. Interpreted in exactly one place —
9620
+ * `storage-location-mode.ts` — which also folds the legacy
9621
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
9622
+ * ambiguous.
9623
+ *
9624
+ * OPTIONAL only for the wire and for rows written before D385: absence is
9625
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
9626
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
9627
+ * re-derived on every read. `enabled` survives one release as a DERIVED
9628
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
9629
+ * either, so the two cannot disagree.
9630
+ */
9631
+ mode: StorageLocationModeSchema.optional(),
9589
9632
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
9590
9633
  * for node-local locations it can reach) — never persisted, absent when the
9591
9634
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9593,11 +9636,46 @@ var StorageLocationSchema = object({
9593
9636
  totalBytes: number(),
9594
9637
  availableBytes: number()
9595
9638
  }).nullable().optional(),
9639
+ /**
9640
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9641
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9642
+ * never persisted, never a filesystem walk.
9643
+ *
9644
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9645
+ * location yet — nobody stores here, the owning addon is down, or the first
9646
+ * refresh has not completed. A UI must omit the segment rather than draw it
9647
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9648
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9649
+ * be spelled out loud instead of appearing by accident.
9650
+ *
9651
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9652
+ * about the whole figure rather than about its freshest part.
9653
+ */
9654
+ owned: object({
9655
+ bytes: number().int().nonnegative(),
9656
+ measuredAtMs: number().int().nonnegative()
9657
+ }).optional(),
9596
9658
  createdAt: number(),
9597
9659
  updatedAt: number()
9598
9660
  });
9599
9661
  object({ isDefault: boolean().optional() });
9600
9662
  /**
9663
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9664
+ *
9665
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9666
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9667
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9668
+ * operator learns not to believe the screen.
9669
+ */
9670
+ var StorageDrainProgressSchema = object({
9671
+ locationId: string(),
9672
+ startedAtMs: number(),
9673
+ startBytes: number(),
9674
+ bytesRemaining: number(),
9675
+ drained: boolean(),
9676
+ estimatedEmptyAtMs: number().nullable()
9677
+ });
9678
+ /**
9601
9679
  * Reference accepted by consumer-facing `api.storage.*` calls.
9602
9680
  * Either:
9603
9681
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -22926,7 +23004,7 @@ method(object({
22926
23004
  }), _void(), {
22927
23005
  kind: "mutation",
22928
23006
  auth: "admin"
22929
- }), method(object({ id: string() }), object({
23007
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22930
23008
  ok: boolean(),
22931
23009
  error: string().optional()
22932
23010
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22996,6 +23074,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22996
23074
  kind: "mutation",
22997
23075
  auth: "admin"
22998
23076
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
23077
+ /**
23078
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23079
+ * location (D388).
23080
+ *
23081
+ * ## Why this is not `storage-evictable`
23082
+ *
23083
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23084
+ * not, in two ways that both matter and both bite hardest on the locations an
23085
+ * operator most wants a figure for:
23086
+ *
23087
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23088
+ * and `recordingsLow:default` deliberately share one root and evict as one
23089
+ * oldest-first pool, so both answer with the SAME combined total. As an
23090
+ * occupancy figure that double-counts the disk.
23091
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23092
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23093
+ * is retiring and staring at.
23094
+ *
23095
+ * So this is its own contract with its own quantity, and the quantity is
23096
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23097
+ * would ever be willing to delete it. A provider that can only answer
23098
+ * "evictable" must not register here — a number that silently means different
23099
+ * things per class is worse than no number.
23100
+ *
23101
+ * ## Absence is an answer
23102
+ *
23103
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23104
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23105
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23106
+ * consuming side has to be written out loud instead of appearing by accident.
23107
+ *
23108
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23109
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23110
+ */
23111
+ /** One provider's occupancy answer for one location. */
23112
+ var StorageOccupancyReportSchema = object({
23113
+ locationId: string(),
23114
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23115
+ * not net of what it is willing to delete. */
23116
+ ownedBytes: number().int().nonnegative(),
23117
+ /** When the provider last actually measured this. The orchestrator carries it
23118
+ * through so a UI can say how old the figure is instead of implying "now". */
23119
+ measuredAtMs: number().int().nonnegative()
23120
+ });
23121
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22999
23122
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
23000
23123
  providerId: string().min(1),
23001
23124
  displayName: string().min(1),
@@ -24831,88 +24954,6 @@ onStatusChanged: { data: object({
24831
24954
  volatileStateFields: ["lastUpdated"]
24832
24955
  };
24833
24956
  /**
24834
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24835
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24836
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24837
- * one Home Assistant projection.
24838
- */
24839
- var NetworkLinkStatusSchema = object({
24840
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24841
- type: _enum([
24842
- "wifi",
24843
- "ethernet",
24844
- "cellular",
24845
- "unknown"
24846
- ]),
24847
- /**
24848
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24849
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24850
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24851
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24852
- * SKIP a null rather than coerce it.
24853
- */
24854
- signalPercent: number().min(0).max(100).nullable(),
24855
- /** Raw received signal strength in dBm, when the firmware reports one. */
24856
- rssiDbm: number().optional(),
24857
- /** Network name of a wireless link, when the firmware reports it. */
24858
- ssid: string().optional(),
24859
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24860
- lastUpdated: number()
24861
- });
24862
- var networkLinkCapability = {
24863
- name: "network-link",
24864
- scope: "device",
24865
- deviceNative: true,
24866
- mode: "singleton",
24867
- deviceTypes: [
24868
- DeviceType.Camera,
24869
- DeviceType.Sensor,
24870
- DeviceType.Button,
24871
- DeviceType.Switch,
24872
- DeviceType.Light,
24873
- DeviceType.Lock,
24874
- DeviceType.Siren
24875
- ],
24876
- methods: {},
24877
- events: {
24878
- /**
24879
- * Emitted whenever the cached status changes (a link switch, a signal
24880
- * reading that moved). Mirrored on the parent chain by the
24881
- * DeviceEventPropagator like `battery.onStatusChanged`.
24882
- */
24883
- onStatusChanged: { data: object({
24884
- deviceId: number(),
24885
- status: NetworkLinkStatusSchema
24886
- }) } },
24887
- status: {
24888
- schema: NetworkLinkStatusSchema,
24889
- kind: "push",
24890
- empty: {
24891
- type: "unknown",
24892
- signalPercent: null,
24893
- lastUpdated: 0
24894
- }
24895
- },
24896
- /**
24897
- * Runtime-state slice — every provider stores the same shape under
24898
- * `device.runtimeState['network-link']`, read once by the badge and the
24899
- * Home Assistant projector regardless of the driver.
24900
- */
24901
- runtimeState: NetworkLinkStatusSchema,
24902
- /**
24903
- * Runtime-state durability: **restored** — a link reading is slow to
24904
- * change and a sleeping battery camera may not report for hours; the
24905
- * restored slice is what the badge shows until the next read.
24906
- *
24907
- * See `RuntimeStateDurability`. Enforced by
24908
- * `scripts/check-runtime-state-durability.ts`.
24909
- */
24910
- durability: "restored",
24911
- /** Clock fields: written, but excluded from the compare that decides
24912
- * whether persisting is worth a SQLite commit. */
24913
- volatileStateFields: ["lastUpdated"]
24914
- };
24915
- /**
24916
24957
  * Generic boolean sensor — last-resort fallback when no domain-
24917
24958
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24918
24959
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -28442,6 +28483,369 @@ var nativeObjectDetectionCapability = {
28442
28483
  volatileStateFields: ["lastFetchedAt"]
28443
28484
  };
28444
28485
  /**
28486
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28487
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28488
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28489
+ *
28490
+ * Why a NEW cap rather than overloading `ptz`:
28491
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28492
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28493
+ * The two are different physical models: PTZ is absolute-position + presets,
28494
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28495
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28496
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28497
+ * the reverse:
28498
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28499
+ * / `getOptions`), and
28500
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28501
+ * robot camera shows up in the existing PTZ control path without every
28502
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28503
+ * not here (see the addon design note):
28504
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28505
+ * ptz.stop() → navigation.stop()
28506
+ * ptz.goHome() → navigation.runAction('goHome')
28507
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28508
+ * ptz.goToPreset(id) → navigation.runAction(id)
28509
+ *
28510
+ * ## Continuous drive
28511
+ *
28512
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
28513
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
28514
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
28515
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
28516
+ * coalesce them. The UI owns the cadence.
28517
+ *
28518
+ * ## The action dictionary
28519
+ *
28520
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
28521
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
28522
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
28523
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
28524
+ * vendor-specific list. `kind: 'action'` entries are triggered with
28525
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
28526
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
28527
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
28528
+ *
28529
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
28530
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
28531
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
28532
+ * every device handle. A future nodedreame publish adds a typed
28533
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
28534
+ * provider can then swap the raw calls for the typed methods with no change to
28535
+ * THIS contract.
28536
+ */
28537
+ /**
28538
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
28539
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
28540
+ * halts it.
28541
+ *
28542
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
28543
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
28544
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
28545
+ * vector by it (drivers without proportional drive ignore it).
28546
+ *
28547
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
28548
+ * axis alone; an all-undefined nudge is a no-op.
28549
+ */
28550
+ var NavigationMoveCommandSchema = object({
28551
+ pan: number().min(-1).max(1).optional(),
28552
+ tilt: number().min(-1).max(1).optional(),
28553
+ speed: number().min(0).max(1).optional()
28554
+ });
28555
+ /**
28556
+ * The enumerated discrete actions a navigation-capable robot can perform via
28557
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
28558
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
28559
+ * `playSound` (see the `sound` dictionary entries).
28560
+ */
28561
+ var NavigationActionIdSchema = _enum([
28562
+ "goHome",
28563
+ "locate",
28564
+ "spotClean",
28565
+ "findPet",
28566
+ "personFollow",
28567
+ "stop",
28568
+ "startClean",
28569
+ "pauseClean",
28570
+ "dockWash",
28571
+ "autoEmpty",
28572
+ "flashOn",
28573
+ "flashOff"
28574
+ ]);
28575
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28576
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28577
+ /**
28578
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28579
+ * native panel and the PTZ mimic render as a button.
28580
+ *
28581
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28582
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28583
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28584
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28585
+ * - `label` — operator-facing English label.
28586
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28587
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28588
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28589
+ * flips it from config, never by editing code.
28590
+ */
28591
+ var NavigationActionEntrySchema = object({
28592
+ id: string(),
28593
+ kind: NavigationEntryKindSchema,
28594
+ label: string(),
28595
+ icon: string(),
28596
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28597
+ soundId: number().int().optional(),
28598
+ /** Per-device feature flag — render this entry only when true. */
28599
+ enabled: boolean()
28600
+ });
28601
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28602
+ var NavigationPointSchema = object({
28603
+ x: number(),
28604
+ y: number()
28605
+ });
28606
+ /**
28607
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28608
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28609
+ * that are turned on for THIS device. Data-driven: the provider derives these
28610
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28611
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28612
+ * that are not dictionary entries.
28613
+ *
28614
+ * - `move` / `stop` — the momentary drive joystick.
28615
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28616
+ * map-coordinate plumbing is wired.
28617
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28618
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28619
+ * - `light` — the on/off fill-light toggle (works anytime).
28620
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28621
+ * camera-service control; needs an active stream).
28622
+ */
28623
+ var NavigationFeaturesSchema = object({
28624
+ move: boolean(),
28625
+ stop: boolean(),
28626
+ goToPoint: boolean(),
28627
+ runAction: boolean(),
28628
+ playSound: boolean(),
28629
+ light: boolean(),
28630
+ lightMode: boolean()
28631
+ });
28632
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28633
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28634
+ /**
28635
+ * Live navigation state so the UI can reflect what the robot is doing:
28636
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28637
+ * - `following` — person/pet follow is currently armed.
28638
+ * - `flash` — the on-camera fill light is on.
28639
+ * - `lightMode` — auto vs manual fill-light mode.
28640
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28641
+ * `lightMode === 'manual'`.
28642
+ */
28643
+ var NavigationStatusSchema = object({
28644
+ mode: _enum([
28645
+ "idle",
28646
+ "cleaning",
28647
+ "spot",
28648
+ "following",
28649
+ "goto",
28650
+ "returning",
28651
+ "paused",
28652
+ "unknown"
28653
+ ]),
28654
+ following: boolean(),
28655
+ flash: boolean(),
28656
+ lightMode: NavigationLightModeSchema,
28657
+ lightLevel: number().min(40).max(100),
28658
+ /** Ms epoch when the slice was last updated. */
28659
+ lastChangedAt: number()
28660
+ });
28661
+ /**
28662
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28663
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28664
+ * convention.
28665
+ */
28666
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28667
+ var navigationCapability = {
28668
+ name: "navigation",
28669
+ scope: "device",
28670
+ deviceNative: true,
28671
+ mode: "singleton",
28672
+ deviceTypes: [DeviceType.Camera],
28673
+ deviceConfig: { ui: {
28674
+ kind: "widget",
28675
+ widgetId: "host/navigation-panel",
28676
+ tab: "navigation",
28677
+ topTab: true,
28678
+ label: "Navigation",
28679
+ order: 0
28680
+ } },
28681
+ methods: {
28682
+ /**
28683
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28684
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28685
+ * path) works for any authenticated user, not admin-only. The UI sends
28686
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28687
+ * a single drive write WITHOUT debouncing.
28688
+ */
28689
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28690
+ /** Halt all motion immediately (zero drive vector). */
28691
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28692
+ /** Send the robot to a point on its live map. */
28693
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28694
+ /**
28695
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28696
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28697
+ */
28698
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28699
+ /**
28700
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28701
+ * unsupported action ids are rejected by the provider.
28702
+ */
28703
+ runAction: method(object({
28704
+ deviceId: number(),
28705
+ actionId: NavigationActionIdSchema
28706
+ }), _void(), { kind: "mutation" }),
28707
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28708
+ playSound: method(object({
28709
+ deviceId: number(),
28710
+ soundId: number().int()
28711
+ }), _void(), { kind: "mutation" }),
28712
+ /**
28713
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28714
+ * works anytime, no active stream required).
28715
+ */
28716
+ setLightOn: method(object({
28717
+ deviceId: number(),
28718
+ on: boolean()
28719
+ }), _void(), { kind: "mutation" }),
28720
+ /**
28721
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28722
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28723
+ * action that generally needs an active camera stream/monitor session — the
28724
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28725
+ */
28726
+ setLightMode: method(object({
28727
+ deviceId: number(),
28728
+ mode: NavigationLightModeSchema,
28729
+ level: number().min(40).max(100).optional()
28730
+ }), _void(), { kind: "mutation" }),
28731
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28732
+ setLightLevel: method(object({
28733
+ deviceId: number(),
28734
+ level: number().min(40).max(100)
28735
+ }), _void(), { kind: "mutation" }),
28736
+ /**
28737
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28738
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28739
+ * `listActions`).
28740
+ */
28741
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28742
+ },
28743
+ events: { onStatusChanged: { data: object({
28744
+ deviceId: number(),
28745
+ status: NavigationStatusSchema
28746
+ }) } },
28747
+ status: {
28748
+ schema: NavigationStatusSchema,
28749
+ kind: "push"
28750
+ },
28751
+ /**
28752
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28753
+ * for live mode / follow / flash changes.
28754
+ */
28755
+ runtimeState: NavigationRuntimeStateSchema,
28756
+ /**
28757
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28758
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28759
+ * that. The live handle re-publishes on connect.
28760
+ *
28761
+ * See `RuntimeStateDurability`. Enforced by
28762
+ * `scripts/check-runtime-state-durability.ts`.
28763
+ */
28764
+ durability: "session"
28765
+ };
28766
+ /**
28767
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28768
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28769
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28770
+ * one Home Assistant projection.
28771
+ */
28772
+ var NetworkLinkStatusSchema = object({
28773
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28774
+ type: _enum([
28775
+ "wifi",
28776
+ "ethernet",
28777
+ "cellular",
28778
+ "unknown"
28779
+ ]),
28780
+ /**
28781
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28782
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28783
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28784
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28785
+ * SKIP a null rather than coerce it.
28786
+ */
28787
+ signalPercent: number().min(0).max(100).nullable(),
28788
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28789
+ rssiDbm: number().optional(),
28790
+ /** Network name of a wireless link, when the firmware reports it. */
28791
+ ssid: string().optional(),
28792
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28793
+ lastUpdated: number()
28794
+ });
28795
+ var networkLinkCapability = {
28796
+ name: "network-link",
28797
+ scope: "device",
28798
+ deviceNative: true,
28799
+ mode: "singleton",
28800
+ deviceTypes: [
28801
+ DeviceType.Camera,
28802
+ DeviceType.Sensor,
28803
+ DeviceType.Button,
28804
+ DeviceType.Switch,
28805
+ DeviceType.Light,
28806
+ DeviceType.Lock,
28807
+ DeviceType.Siren
28808
+ ],
28809
+ methods: {},
28810
+ events: {
28811
+ /**
28812
+ * Emitted whenever the cached status changes (a link switch, a signal
28813
+ * reading that moved). Mirrored on the parent chain by the
28814
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28815
+ */
28816
+ onStatusChanged: { data: object({
28817
+ deviceId: number(),
28818
+ status: NetworkLinkStatusSchema
28819
+ }) } },
28820
+ status: {
28821
+ schema: NetworkLinkStatusSchema,
28822
+ kind: "push",
28823
+ empty: {
28824
+ type: "unknown",
28825
+ signalPercent: null,
28826
+ lastUpdated: 0
28827
+ }
28828
+ },
28829
+ /**
28830
+ * Runtime-state slice — every provider stores the same shape under
28831
+ * `device.runtimeState['network-link']`, read once by the badge and the
28832
+ * Home Assistant projector regardless of the driver.
28833
+ */
28834
+ runtimeState: NetworkLinkStatusSchema,
28835
+ /**
28836
+ * Runtime-state durability: **restored** — a link reading is slow to
28837
+ * change and a sleeping battery camera may not report for hours; the
28838
+ * restored slice is what the badge shows until the next read.
28839
+ *
28840
+ * See `RuntimeStateDurability`. Enforced by
28841
+ * `scripts/check-runtime-state-durability.ts`.
28842
+ */
28843
+ durability: "restored",
28844
+ /** Clock fields: written, but excluded from the compare that decides
28845
+ * whether persisting is worth a SQLite commit. */
28846
+ volatileStateFields: ["lastUpdated"]
28847
+ };
28848
+ /**
28445
28849
  * network-quality — system-scoped singleton capability tracking RTT,
28446
28850
  * jitter, and observed/peak bandwidth per device + per client.
28447
28851
  *
@@ -30022,287 +30426,6 @@ var ptzAutotrackCapability = {
30022
30426
  */
30023
30427
  durability: "session"
30024
30428
  };
30025
- /**
30026
- * `navigation` — a device-scoped capability that natively expresses the FULL
30027
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
30028
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
30029
- *
30030
- * Why a NEW cap rather than overloading `ptz`:
30031
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30032
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30033
- * The two are different physical models: PTZ is absolute-position + presets,
30034
- * navigation is momentary drive nudges + discrete robot ACTIONS
30035
- * (dock / spot-clean / follow-pet / go-to-point / …).
30036
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30037
- * the reverse:
30038
- * 1. a native CamStack navigation panel (data-driven from `listActions`
30039
- * / `getOptions`), and
30040
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30041
- * robot camera shows up in the existing PTZ control path without every
30042
- * PTZ provider learning about robots. The mapping lives in the adapter,
30043
- * not here (see the addon design note):
30044
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30045
- * ptz.stop() → navigation.stop()
30046
- * ptz.goHome() → navigation.runAction('goHome')
30047
- * ptz.getPresets() → navigation.listActions() (id→preset)
30048
- * ptz.goToPreset(id) → navigation.runAction(id)
30049
- *
30050
- * ## Continuous drive
30051
- *
30052
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30053
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30054
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30055
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30056
- * coalesce them. The UI owns the cadence.
30057
- *
30058
- * ## The action dictionary
30059
- *
30060
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30061
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30062
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30063
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30064
- * vendor-specific list. `kind: 'action'` entries are triggered with
30065
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30066
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
30067
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30068
- *
30069
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30070
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30071
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
30072
- * every device handle. A future nodedreame publish adds a typed
30073
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30074
- * provider can then swap the raw calls for the typed methods with no change to
30075
- * THIS contract.
30076
- */
30077
- /**
30078
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30079
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30080
- * halts it.
30081
- *
30082
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
30083
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30084
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30085
- * vector by it (drivers without proportional drive ignore it).
30086
- *
30087
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30088
- * axis alone; an all-undefined nudge is a no-op.
30089
- */
30090
- var NavigationMoveCommandSchema = object({
30091
- pan: number().min(-1).max(1).optional(),
30092
- tilt: number().min(-1).max(1).optional(),
30093
- speed: number().min(0).max(1).optional()
30094
- });
30095
- /**
30096
- * The enumerated discrete actions a navigation-capable robot can perform via
30097
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30098
- * subset it supports through `listActions`. Sounds are NOT here — they go through
30099
- * `playSound` (see the `sound` dictionary entries).
30100
- */
30101
- var NavigationActionIdSchema = _enum([
30102
- "goHome",
30103
- "locate",
30104
- "spotClean",
30105
- "findPet",
30106
- "personFollow",
30107
- "stop",
30108
- "startClean",
30109
- "pauseClean",
30110
- "dockWash",
30111
- "autoEmpty",
30112
- "flashOn",
30113
- "flashOff"
30114
- ]);
30115
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30116
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
30117
- /**
30118
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30119
- * native panel and the PTZ mimic render as a button.
30120
- *
30121
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30122
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30123
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
30124
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30125
- * - `label` — operator-facing English label.
30126
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30127
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30128
- * PTZ render ONLY enabled entries. Data-driven: the provider
30129
- * flips it from config, never by editing code.
30130
- */
30131
- var NavigationActionEntrySchema = object({
30132
- id: string(),
30133
- kind: NavigationEntryKindSchema,
30134
- label: string(),
30135
- icon: string(),
30136
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30137
- soundId: number().int().optional(),
30138
- /** Per-device feature flag — render this entry only when true. */
30139
- enabled: boolean()
30140
- });
30141
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
30142
- var NavigationPointSchema = object({
30143
- x: number(),
30144
- y: number()
30145
- });
30146
- /**
30147
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30148
- * The cap reports which are enabled so the UI / PTZ render only the controls
30149
- * that are turned on for THIS device. Data-driven: the provider derives these
30150
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30151
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30152
- * that are not dictionary entries.
30153
- *
30154
- * - `move` / `stop` — the momentary drive joystick.
30155
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30156
- * map-coordinate plumbing is wired.
30157
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30158
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30159
- * - `light` — the on/off fill-light toggle (works anytime).
30160
- * - `lightMode` — the auto/manual selector + manual level slider (a
30161
- * camera-service control; needs an active stream).
30162
- */
30163
- var NavigationFeaturesSchema = object({
30164
- move: boolean(),
30165
- stop: boolean(),
30166
- goToPoint: boolean(),
30167
- runAction: boolean(),
30168
- playSound: boolean(),
30169
- light: boolean(),
30170
- lightMode: boolean()
30171
- });
30172
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30173
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30174
- /**
30175
- * Live navigation state so the UI can reflect what the robot is doing:
30176
- * - `mode` — coarse activity (idle / cleaning / following / …).
30177
- * - `following` — person/pet follow is currently armed.
30178
- * - `flash` — the on-camera fill light is on.
30179
- * - `lightMode` — auto vs manual fill-light mode.
30180
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30181
- * `lightMode === 'manual'`.
30182
- */
30183
- var NavigationStatusSchema = object({
30184
- mode: _enum([
30185
- "idle",
30186
- "cleaning",
30187
- "spot",
30188
- "following",
30189
- "goto",
30190
- "returning",
30191
- "paused",
30192
- "unknown"
30193
- ]),
30194
- following: boolean(),
30195
- flash: boolean(),
30196
- lightMode: NavigationLightModeSchema,
30197
- lightLevel: number().min(40).max(100),
30198
- /** Ms epoch when the slice was last updated. */
30199
- lastChangedAt: number()
30200
- });
30201
- /**
30202
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30203
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30204
- * convention.
30205
- */
30206
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30207
- var navigationCapability = {
30208
- name: "navigation",
30209
- scope: "device",
30210
- deviceNative: true,
30211
- mode: "singleton",
30212
- deviceTypes: [DeviceType.Camera],
30213
- deviceConfig: { ui: {
30214
- kind: "widget",
30215
- widgetId: "host/navigation-panel",
30216
- tab: "navigation",
30217
- topTab: true,
30218
- label: "Navigation",
30219
- order: 0
30220
- } },
30221
- methods: {
30222
- /**
30223
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30224
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30225
- * path) works for any authenticated user, not admin-only. The UI sends
30226
- * these at ~1 Hz while a control is held; the provider forwards each one to
30227
- * a single drive write WITHOUT debouncing.
30228
- */
30229
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30230
- /** Halt all motion immediately (zero drive vector). */
30231
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30232
- /** Send the robot to a point on its live map. */
30233
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30234
- /**
30235
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30236
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30237
- */
30238
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30239
- /**
30240
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30241
- * unsupported action ids are rejected by the provider.
30242
- */
30243
- runAction: method(object({
30244
- deviceId: number(),
30245
- actionId: NavigationActionIdSchema
30246
- }), _void(), { kind: "mutation" }),
30247
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30248
- playSound: method(object({
30249
- deviceId: number(),
30250
- soundId: number().int()
30251
- }), _void(), { kind: "mutation" }),
30252
- /**
30253
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30254
- * works anytime, no active stream required).
30255
- */
30256
- setLightOn: method(object({
30257
- deviceId: number(),
30258
- on: boolean()
30259
- }), _void(), { kind: "mutation" }),
30260
- /**
30261
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30262
- * initial `level`. The auto/manual + level control is a CAMERA-service
30263
- * action that generally needs an active camera stream/monitor session — the
30264
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30265
- */
30266
- setLightMode: method(object({
30267
- deviceId: number(),
30268
- mode: NavigationLightModeSchema,
30269
- level: number().min(40).max(100).optional()
30270
- }), _void(), { kind: "mutation" }),
30271
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30272
- setLightLevel: method(object({
30273
- deviceId: number(),
30274
- level: number().min(40).max(100)
30275
- }), _void(), { kind: "mutation" }),
30276
- /**
30277
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30278
- * controls the UI shows (the per-entry flags for the dictionary come back on
30279
- * `listActions`).
30280
- */
30281
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30282
- },
30283
- events: { onStatusChanged: { data: object({
30284
- deviceId: number(),
30285
- status: NavigationStatusSchema
30286
- }) } },
30287
- status: {
30288
- schema: NavigationStatusSchema,
30289
- kind: "push"
30290
- },
30291
- /**
30292
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30293
- * for live mode / follow / flash changes.
30294
- */
30295
- runtimeState: NavigationRuntimeStateSchema,
30296
- /**
30297
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30298
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30299
- * that. The live handle re-publishes on connect.
30300
- *
30301
- * See `RuntimeStateDurability`. Enforced by
30302
- * `scripts/check-runtime-state-durability.ts`.
30303
- */
30304
- durability: "session"
30305
- };
30306
30429
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30307
30430
  kind: "mutation",
30308
30431
  auth: "admin"
@@ -39765,6 +39888,12 @@ Object.freeze({
39765
39888
  addonId: null,
39766
39889
  access: "view"
39767
39890
  },
39891
+ "storage.listDrainProgress": {
39892
+ capName: "storage",
39893
+ capScope: "system",
39894
+ addonId: null,
39895
+ access: "view"
39896
+ },
39768
39897
  "storage.listLocationDeclarations": {
39769
39898
  capName: "storage",
39770
39899
  capScope: "system",
@@ -39909,6 +40038,12 @@ Object.freeze({
39909
40038
  addonId: null,
39910
40039
  access: "view"
39911
40040
  },
40041
+ "storageOccupancy.getOccupancy": {
40042
+ capName: "storage-occupancy",
40043
+ capScope: "system",
40044
+ addonId: null,
40045
+ access: "view"
40046
+ },
39912
40047
  "storageProvider.abortUpload": {
39913
40048
  capName: "storage-provider",
39914
40049
  capScope: "system",