@camstack/addon-terminal 0.1.84 → 0.1.85

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +500 -365
  2. package/dist/addon.mjs +500 -365
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -8,7 +8,7 @@ import { createServer } from "node:http";
8
8
  //#region \0rolldown/runtime.js
9
9
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
10
  //#endregion
11
- //#region ../types/dist/event-category-zAv7pMUz.mjs
11
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -203,6 +203,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
203
203
  EventCategory["ProcessCrashed"] = "process.crashed";
204
204
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
205
205
  EventCategory["ProcessRestarted"] = "process.restarted";
206
+ /**
207
+ * The SET of storage locations changed — one was created, edited, enabled,
208
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
209
+ *
210
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
211
+ * it must also converge on its own periodic path, because a dropped event
212
+ * must not leave a node writing to yesterday's disk set forever. It exists
213
+ * because there was NO signal at all — an operator who added a second
214
+ * recordings disk in the admin UI got nothing, and the recorder kept its
215
+ * resolved locations until something else happened to re-resolve them
216
+ * (D387). Payload `StorageLocationsChangedPayload`.
217
+ */
218
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
206
219
  EventCategory["RecordingStarted"] = "recording.started";
207
220
  EventCategory["RecordingStopped"] = "recording.stopped";
208
221
  EventCategory["RecordingError"] = "recording.error";
@@ -8612,6 +8625,21 @@ var StorageCleanupJobSchema = object({
8612
8625
  });
8613
8626
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8614
8627
  /**
8628
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8629
+ * alias below is `z.infer<>` of it, never a second spelling.
8630
+ */
8631
+ var StorageLocationModeSchema = _enum([
8632
+ "active",
8633
+ "readonly",
8634
+ "drain",
8635
+ "disabled"
8636
+ ]);
8637
+ _enum([
8638
+ "normal",
8639
+ "never",
8640
+ "drain"
8641
+ ]);
8642
+ /**
8615
8643
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8616
8644
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8617
8645
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8677,6 +8705,21 @@ var StorageLocationSchema = object({
8677
8705
  * stops existing rather than being re-derived on every read.
8678
8706
  */
8679
8707
  enabled: boolean().optional(),
8708
+ /**
8709
+ * THE state of this location (D385), and the only authority on what may be
8710
+ * written, read or evicted here. Interpreted in exactly one place —
8711
+ * `storage-location-mode.ts` — which also folds the legacy
8712
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8713
+ * ambiguous.
8714
+ *
8715
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8716
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8717
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8718
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8719
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8720
+ * either, so the two cannot disagree.
8721
+ */
8722
+ mode: StorageLocationModeSchema.optional(),
8680
8723
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8681
8724
  * for node-local locations it can reach) — never persisted, absent when the
8682
8725
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8684,11 +8727,46 @@ var StorageLocationSchema = object({
8684
8727
  totalBytes: number(),
8685
8728
  availableBytes: number()
8686
8729
  }).nullable().optional(),
8730
+ /**
8731
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8732
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8733
+ * never persisted, never a filesystem walk.
8734
+ *
8735
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8736
+ * location yet — nobody stores here, the owning addon is down, or the first
8737
+ * refresh has not completed. A UI must omit the segment rather than draw it
8738
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8739
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8740
+ * be spelled out loud instead of appearing by accident.
8741
+ *
8742
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8743
+ * about the whole figure rather than about its freshest part.
8744
+ */
8745
+ owned: object({
8746
+ bytes: number().int().nonnegative(),
8747
+ measuredAtMs: number().int().nonnegative()
8748
+ }).optional(),
8687
8749
  createdAt: number(),
8688
8750
  updatedAt: number()
8689
8751
  });
8690
8752
  object({ isDefault: boolean().optional() });
8691
8753
  /**
8754
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8755
+ *
8756
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8757
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8758
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8759
+ * operator learns not to believe the screen.
8760
+ */
8761
+ var StorageDrainProgressSchema = object({
8762
+ locationId: string(),
8763
+ startedAtMs: number(),
8764
+ startBytes: number(),
8765
+ bytesRemaining: number(),
8766
+ drained: boolean(),
8767
+ estimatedEmptyAtMs: number().nullable()
8768
+ });
8769
+ /**
8692
8770
  * Reference accepted by consumer-facing `api.storage.*` calls.
8693
8771
  * Either:
8694
8772
  * - 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),
@@ -23989,88 +24112,6 @@ onStatusChanged: { data: object({
23989
24112
  volatileStateFields: ["lastUpdated"]
23990
24113
  };
23991
24114
  /**
23992
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23993
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23994
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23995
- * one Home Assistant projection.
23996
- */
23997
- var NetworkLinkStatusSchema = object({
23998
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23999
- type: _enum([
24000
- "wifi",
24001
- "ethernet",
24002
- "cellular",
24003
- "unknown"
24004
- ]),
24005
- /**
24006
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24007
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24008
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24009
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24010
- * SKIP a null rather than coerce it.
24011
- */
24012
- signalPercent: number().min(0).max(100).nullable(),
24013
- /** Raw received signal strength in dBm, when the firmware reports one. */
24014
- rssiDbm: number().optional(),
24015
- /** Network name of a wireless link, when the firmware reports it. */
24016
- ssid: string().optional(),
24017
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24018
- lastUpdated: number()
24019
- });
24020
- var networkLinkCapability = {
24021
- name: "network-link",
24022
- scope: "device",
24023
- deviceNative: true,
24024
- mode: "singleton",
24025
- deviceTypes: [
24026
- DeviceType.Camera,
24027
- DeviceType.Sensor,
24028
- DeviceType.Button,
24029
- DeviceType.Switch,
24030
- DeviceType.Light,
24031
- DeviceType.Lock,
24032
- DeviceType.Siren
24033
- ],
24034
- methods: {},
24035
- events: {
24036
- /**
24037
- * Emitted whenever the cached status changes (a link switch, a signal
24038
- * reading that moved). Mirrored on the parent chain by the
24039
- * DeviceEventPropagator like `battery.onStatusChanged`.
24040
- */
24041
- onStatusChanged: { data: object({
24042
- deviceId: number(),
24043
- status: NetworkLinkStatusSchema
24044
- }) } },
24045
- status: {
24046
- schema: NetworkLinkStatusSchema,
24047
- kind: "push",
24048
- empty: {
24049
- type: "unknown",
24050
- signalPercent: null,
24051
- lastUpdated: 0
24052
- }
24053
- },
24054
- /**
24055
- * Runtime-state slice — every provider stores the same shape under
24056
- * `device.runtimeState['network-link']`, read once by the badge and the
24057
- * Home Assistant projector regardless of the driver.
24058
- */
24059
- runtimeState: NetworkLinkStatusSchema,
24060
- /**
24061
- * Runtime-state durability: **restored** — a link reading is slow to
24062
- * change and a sleeping battery camera may not report for hours; the
24063
- * restored slice is what the badge shows until the next read.
24064
- *
24065
- * See `RuntimeStateDurability`. Enforced by
24066
- * `scripts/check-runtime-state-durability.ts`.
24067
- */
24068
- durability: "restored",
24069
- /** Clock fields: written, but excluded from the compare that decides
24070
- * whether persisting is worth a SQLite commit. */
24071
- volatileStateFields: ["lastUpdated"]
24072
- };
24073
- /**
24074
24115
  * Generic boolean sensor — last-resort fallback when no domain-
24075
24116
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24076
24117
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27600,6 +27641,369 @@ var nativeObjectDetectionCapability = {
27600
27641
  volatileStateFields: ["lastFetchedAt"]
27601
27642
  };
27602
27643
  /**
27644
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27645
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27646
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27647
+ *
27648
+ * Why a NEW cap rather than overloading `ptz`:
27649
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27650
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27651
+ * The two are different physical models: PTZ is absolute-position + presets,
27652
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27653
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27654
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27655
+ * the reverse:
27656
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27657
+ * / `getOptions`), and
27658
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27659
+ * robot camera shows up in the existing PTZ control path without every
27660
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27661
+ * not here (see the addon design note):
27662
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27663
+ * ptz.stop() → navigation.stop()
27664
+ * ptz.goHome() → navigation.runAction('goHome')
27665
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27666
+ * ptz.goToPreset(id) → navigation.runAction(id)
27667
+ *
27668
+ * ## Continuous drive
27669
+ *
27670
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27671
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27672
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27673
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27674
+ * coalesce them. The UI owns the cadence.
27675
+ *
27676
+ * ## The action dictionary
27677
+ *
27678
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27679
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27680
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27681
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27682
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27683
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27684
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27685
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27686
+ *
27687
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27688
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27689
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27690
+ * every device handle. A future nodedreame publish adds a typed
27691
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27692
+ * provider can then swap the raw calls for the typed methods with no change to
27693
+ * THIS contract.
27694
+ */
27695
+ /**
27696
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27697
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27698
+ * halts it.
27699
+ *
27700
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27701
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27702
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27703
+ * vector by it (drivers without proportional drive ignore it).
27704
+ *
27705
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27706
+ * axis alone; an all-undefined nudge is a no-op.
27707
+ */
27708
+ var NavigationMoveCommandSchema = object({
27709
+ pan: number().min(-1).max(1).optional(),
27710
+ tilt: number().min(-1).max(1).optional(),
27711
+ speed: number().min(0).max(1).optional()
27712
+ });
27713
+ /**
27714
+ * The enumerated discrete actions a navigation-capable robot can perform via
27715
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27716
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27717
+ * `playSound` (see the `sound` dictionary entries).
27718
+ */
27719
+ var NavigationActionIdSchema = _enum([
27720
+ "goHome",
27721
+ "locate",
27722
+ "spotClean",
27723
+ "findPet",
27724
+ "personFollow",
27725
+ "stop",
27726
+ "startClean",
27727
+ "pauseClean",
27728
+ "dockWash",
27729
+ "autoEmpty",
27730
+ "flashOn",
27731
+ "flashOff"
27732
+ ]);
27733
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27734
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27735
+ /**
27736
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27737
+ * native panel and the PTZ mimic render as a button.
27738
+ *
27739
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27740
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27741
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27742
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27743
+ * - `label` — operator-facing English label.
27744
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27745
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27746
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27747
+ * flips it from config, never by editing code.
27748
+ */
27749
+ var NavigationActionEntrySchema = object({
27750
+ id: string(),
27751
+ kind: NavigationEntryKindSchema,
27752
+ label: string(),
27753
+ icon: string(),
27754
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27755
+ soundId: number().int().optional(),
27756
+ /** Per-device feature flag — render this entry only when true. */
27757
+ enabled: boolean()
27758
+ });
27759
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27760
+ var NavigationPointSchema = object({
27761
+ x: number(),
27762
+ y: number()
27763
+ });
27764
+ /**
27765
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27766
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27767
+ * that are turned on for THIS device. Data-driven: the provider derives these
27768
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27769
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27770
+ * that are not dictionary entries.
27771
+ *
27772
+ * - `move` / `stop` — the momentary drive joystick.
27773
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27774
+ * map-coordinate plumbing is wired.
27775
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27776
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27777
+ * - `light` — the on/off fill-light toggle (works anytime).
27778
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27779
+ * camera-service control; needs an active stream).
27780
+ */
27781
+ var NavigationFeaturesSchema = object({
27782
+ move: boolean(),
27783
+ stop: boolean(),
27784
+ goToPoint: boolean(),
27785
+ runAction: boolean(),
27786
+ playSound: boolean(),
27787
+ light: boolean(),
27788
+ lightMode: boolean()
27789
+ });
27790
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27791
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27792
+ /**
27793
+ * Live navigation state so the UI can reflect what the robot is doing:
27794
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27795
+ * - `following` — person/pet follow is currently armed.
27796
+ * - `flash` — the on-camera fill light is on.
27797
+ * - `lightMode` — auto vs manual fill-light mode.
27798
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27799
+ * `lightMode === 'manual'`.
27800
+ */
27801
+ var NavigationStatusSchema = object({
27802
+ mode: _enum([
27803
+ "idle",
27804
+ "cleaning",
27805
+ "spot",
27806
+ "following",
27807
+ "goto",
27808
+ "returning",
27809
+ "paused",
27810
+ "unknown"
27811
+ ]),
27812
+ following: boolean(),
27813
+ flash: boolean(),
27814
+ lightMode: NavigationLightModeSchema,
27815
+ lightLevel: number().min(40).max(100),
27816
+ /** Ms epoch when the slice was last updated. */
27817
+ lastChangedAt: number()
27818
+ });
27819
+ /**
27820
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27821
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27822
+ * convention.
27823
+ */
27824
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27825
+ var navigationCapability = {
27826
+ name: "navigation",
27827
+ scope: "device",
27828
+ deviceNative: true,
27829
+ mode: "singleton",
27830
+ deviceTypes: [DeviceType.Camera],
27831
+ deviceConfig: { ui: {
27832
+ kind: "widget",
27833
+ widgetId: "host/navigation-panel",
27834
+ tab: "navigation",
27835
+ topTab: true,
27836
+ label: "Navigation",
27837
+ order: 0
27838
+ } },
27839
+ methods: {
27840
+ /**
27841
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27842
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27843
+ * path) works for any authenticated user, not admin-only. The UI sends
27844
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27845
+ * a single drive write WITHOUT debouncing.
27846
+ */
27847
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27848
+ /** Halt all motion immediately (zero drive vector). */
27849
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27850
+ /** Send the robot to a point on its live map. */
27851
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27852
+ /**
27853
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27854
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27855
+ */
27856
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27857
+ /**
27858
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27859
+ * unsupported action ids are rejected by the provider.
27860
+ */
27861
+ runAction: method(object({
27862
+ deviceId: number(),
27863
+ actionId: NavigationActionIdSchema
27864
+ }), _void(), { kind: "mutation" }),
27865
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27866
+ playSound: method(object({
27867
+ deviceId: number(),
27868
+ soundId: number().int()
27869
+ }), _void(), { kind: "mutation" }),
27870
+ /**
27871
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27872
+ * works anytime, no active stream required).
27873
+ */
27874
+ setLightOn: method(object({
27875
+ deviceId: number(),
27876
+ on: boolean()
27877
+ }), _void(), { kind: "mutation" }),
27878
+ /**
27879
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27880
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27881
+ * action that generally needs an active camera stream/monitor session — the
27882
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27883
+ */
27884
+ setLightMode: method(object({
27885
+ deviceId: number(),
27886
+ mode: NavigationLightModeSchema,
27887
+ level: number().min(40).max(100).optional()
27888
+ }), _void(), { kind: "mutation" }),
27889
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27890
+ setLightLevel: method(object({
27891
+ deviceId: number(),
27892
+ level: number().min(40).max(100)
27893
+ }), _void(), { kind: "mutation" }),
27894
+ /**
27895
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27896
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27897
+ * `listActions`).
27898
+ */
27899
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27900
+ },
27901
+ events: { onStatusChanged: { data: object({
27902
+ deviceId: number(),
27903
+ status: NavigationStatusSchema
27904
+ }) } },
27905
+ status: {
27906
+ schema: NavigationStatusSchema,
27907
+ kind: "push"
27908
+ },
27909
+ /**
27910
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27911
+ * for live mode / follow / flash changes.
27912
+ */
27913
+ runtimeState: NavigationRuntimeStateSchema,
27914
+ /**
27915
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27916
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27917
+ * that. The live handle re-publishes on connect.
27918
+ *
27919
+ * See `RuntimeStateDurability`. Enforced by
27920
+ * `scripts/check-runtime-state-durability.ts`.
27921
+ */
27922
+ durability: "session"
27923
+ };
27924
+ /**
27925
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27926
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27927
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27928
+ * one Home Assistant projection.
27929
+ */
27930
+ var NetworkLinkStatusSchema = object({
27931
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27932
+ type: _enum([
27933
+ "wifi",
27934
+ "ethernet",
27935
+ "cellular",
27936
+ "unknown"
27937
+ ]),
27938
+ /**
27939
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27940
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27941
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27942
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27943
+ * SKIP a null rather than coerce it.
27944
+ */
27945
+ signalPercent: number().min(0).max(100).nullable(),
27946
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27947
+ rssiDbm: number().optional(),
27948
+ /** Network name of a wireless link, when the firmware reports it. */
27949
+ ssid: string().optional(),
27950
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27951
+ lastUpdated: number()
27952
+ });
27953
+ var networkLinkCapability = {
27954
+ name: "network-link",
27955
+ scope: "device",
27956
+ deviceNative: true,
27957
+ mode: "singleton",
27958
+ deviceTypes: [
27959
+ DeviceType.Camera,
27960
+ DeviceType.Sensor,
27961
+ DeviceType.Button,
27962
+ DeviceType.Switch,
27963
+ DeviceType.Light,
27964
+ DeviceType.Lock,
27965
+ DeviceType.Siren
27966
+ ],
27967
+ methods: {},
27968
+ events: {
27969
+ /**
27970
+ * Emitted whenever the cached status changes (a link switch, a signal
27971
+ * reading that moved). Mirrored on the parent chain by the
27972
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27973
+ */
27974
+ onStatusChanged: { data: object({
27975
+ deviceId: number(),
27976
+ status: NetworkLinkStatusSchema
27977
+ }) } },
27978
+ status: {
27979
+ schema: NetworkLinkStatusSchema,
27980
+ kind: "push",
27981
+ empty: {
27982
+ type: "unknown",
27983
+ signalPercent: null,
27984
+ lastUpdated: 0
27985
+ }
27986
+ },
27987
+ /**
27988
+ * Runtime-state slice — every provider stores the same shape under
27989
+ * `device.runtimeState['network-link']`, read once by the badge and the
27990
+ * Home Assistant projector regardless of the driver.
27991
+ */
27992
+ runtimeState: NetworkLinkStatusSchema,
27993
+ /**
27994
+ * Runtime-state durability: **restored** — a link reading is slow to
27995
+ * change and a sleeping battery camera may not report for hours; the
27996
+ * restored slice is what the badge shows until the next read.
27997
+ *
27998
+ * See `RuntimeStateDurability`. Enforced by
27999
+ * `scripts/check-runtime-state-durability.ts`.
28000
+ */
28001
+ durability: "restored",
28002
+ /** Clock fields: written, but excluded from the compare that decides
28003
+ * whether persisting is worth a SQLite commit. */
28004
+ volatileStateFields: ["lastUpdated"]
28005
+ };
28006
+ /**
27603
28007
  * network-quality — system-scoped singleton capability tracking RTT,
27604
28008
  * jitter, and observed/peak bandwidth per device + per client.
27605
28009
  *
@@ -29180,287 +29584,6 @@ var ptzAutotrackCapability = {
29180
29584
  */
29181
29585
  durability: "session"
29182
29586
  };
29183
- /**
29184
- * `navigation` — a device-scoped capability that natively expresses the FULL
29185
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29186
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29187
- *
29188
- * Why a NEW cap rather than overloading `ptz`:
29189
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29190
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29191
- * The two are different physical models: PTZ is absolute-position + presets,
29192
- * navigation is momentary drive nudges + discrete robot ACTIONS
29193
- * (dock / spot-clean / follow-pet / go-to-point / …).
29194
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29195
- * the reverse:
29196
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29197
- * / `getOptions`), and
29198
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29199
- * robot camera shows up in the existing PTZ control path without every
29200
- * PTZ provider learning about robots. The mapping lives in the adapter,
29201
- * not here (see the addon design note):
29202
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29203
- * ptz.stop() → navigation.stop()
29204
- * ptz.goHome() → navigation.runAction('goHome')
29205
- * ptz.getPresets() → navigation.listActions() (id→preset)
29206
- * ptz.goToPreset(id) → navigation.runAction(id)
29207
- *
29208
- * ## Continuous drive
29209
- *
29210
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29211
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29212
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29213
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29214
- * coalesce them. The UI owns the cadence.
29215
- *
29216
- * ## The action dictionary
29217
- *
29218
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29219
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29220
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29221
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29222
- * vendor-specific list. `kind: 'action'` entries are triggered with
29223
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29224
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29225
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29226
- *
29227
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29228
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29229
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29230
- * every device handle. A future nodedreame publish adds a typed
29231
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29232
- * provider can then swap the raw calls for the typed methods with no change to
29233
- * THIS contract.
29234
- */
29235
- /**
29236
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29237
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29238
- * halts it.
29239
- *
29240
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29241
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29242
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29243
- * vector by it (drivers without proportional drive ignore it).
29244
- *
29245
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29246
- * axis alone; an all-undefined nudge is a no-op.
29247
- */
29248
- var NavigationMoveCommandSchema = object({
29249
- pan: number().min(-1).max(1).optional(),
29250
- tilt: number().min(-1).max(1).optional(),
29251
- speed: number().min(0).max(1).optional()
29252
- });
29253
- /**
29254
- * The enumerated discrete actions a navigation-capable robot can perform via
29255
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29256
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29257
- * `playSound` (see the `sound` dictionary entries).
29258
- */
29259
- var NavigationActionIdSchema = _enum([
29260
- "goHome",
29261
- "locate",
29262
- "spotClean",
29263
- "findPet",
29264
- "personFollow",
29265
- "stop",
29266
- "startClean",
29267
- "pauseClean",
29268
- "dockWash",
29269
- "autoEmpty",
29270
- "flashOn",
29271
- "flashOff"
29272
- ]);
29273
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29274
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29275
- /**
29276
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29277
- * native panel and the PTZ mimic render as a button.
29278
- *
29279
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29280
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29281
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29282
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29283
- * - `label` — operator-facing English label.
29284
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29285
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29286
- * PTZ render ONLY enabled entries. Data-driven: the provider
29287
- * flips it from config, never by editing code.
29288
- */
29289
- var NavigationActionEntrySchema = object({
29290
- id: string(),
29291
- kind: NavigationEntryKindSchema,
29292
- label: string(),
29293
- icon: string(),
29294
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29295
- soundId: number().int().optional(),
29296
- /** Per-device feature flag — render this entry only when true. */
29297
- enabled: boolean()
29298
- });
29299
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29300
- var NavigationPointSchema = object({
29301
- x: number(),
29302
- y: number()
29303
- });
29304
- /**
29305
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29306
- * The cap reports which are enabled so the UI / PTZ render only the controls
29307
- * that are turned on for THIS device. Data-driven: the provider derives these
29308
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29309
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29310
- * that are not dictionary entries.
29311
- *
29312
- * - `move` / `stop` — the momentary drive joystick.
29313
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29314
- * map-coordinate plumbing is wired.
29315
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29316
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29317
- * - `light` — the on/off fill-light toggle (works anytime).
29318
- * - `lightMode` — the auto/manual selector + manual level slider (a
29319
- * camera-service control; needs an active stream).
29320
- */
29321
- var NavigationFeaturesSchema = object({
29322
- move: boolean(),
29323
- stop: boolean(),
29324
- goToPoint: boolean(),
29325
- runAction: boolean(),
29326
- playSound: boolean(),
29327
- light: boolean(),
29328
- lightMode: boolean()
29329
- });
29330
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29331
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29332
- /**
29333
- * Live navigation state so the UI can reflect what the robot is doing:
29334
- * - `mode` — coarse activity (idle / cleaning / following / …).
29335
- * - `following` — person/pet follow is currently armed.
29336
- * - `flash` — the on-camera fill light is on.
29337
- * - `lightMode` — auto vs manual fill-light mode.
29338
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29339
- * `lightMode === 'manual'`.
29340
- */
29341
- var NavigationStatusSchema = object({
29342
- mode: _enum([
29343
- "idle",
29344
- "cleaning",
29345
- "spot",
29346
- "following",
29347
- "goto",
29348
- "returning",
29349
- "paused",
29350
- "unknown"
29351
- ]),
29352
- following: boolean(),
29353
- flash: boolean(),
29354
- lightMode: NavigationLightModeSchema,
29355
- lightLevel: number().min(40).max(100),
29356
- /** Ms epoch when the slice was last updated. */
29357
- lastChangedAt: number()
29358
- });
29359
- /**
29360
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29361
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29362
- * convention.
29363
- */
29364
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29365
- var navigationCapability = {
29366
- name: "navigation",
29367
- scope: "device",
29368
- deviceNative: true,
29369
- mode: "singleton",
29370
- deviceTypes: [DeviceType.Camera],
29371
- deviceConfig: { ui: {
29372
- kind: "widget",
29373
- widgetId: "host/navigation-panel",
29374
- tab: "navigation",
29375
- topTab: true,
29376
- label: "Navigation",
29377
- order: 0
29378
- } },
29379
- methods: {
29380
- /**
29381
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29382
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29383
- * path) works for any authenticated user, not admin-only. The UI sends
29384
- * these at ~1 Hz while a control is held; the provider forwards each one to
29385
- * a single drive write WITHOUT debouncing.
29386
- */
29387
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29388
- /** Halt all motion immediately (zero drive vector). */
29389
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29390
- /** Send the robot to a point on its live map. */
29391
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29392
- /**
29393
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29394
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29395
- */
29396
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29397
- /**
29398
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29399
- * unsupported action ids are rejected by the provider.
29400
- */
29401
- runAction: method(object({
29402
- deviceId: number(),
29403
- actionId: NavigationActionIdSchema
29404
- }), _void(), { kind: "mutation" }),
29405
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29406
- playSound: method(object({
29407
- deviceId: number(),
29408
- soundId: number().int()
29409
- }), _void(), { kind: "mutation" }),
29410
- /**
29411
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29412
- * works anytime, no active stream required).
29413
- */
29414
- setLightOn: method(object({
29415
- deviceId: number(),
29416
- on: boolean()
29417
- }), _void(), { kind: "mutation" }),
29418
- /**
29419
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29420
- * initial `level`. The auto/manual + level control is a CAMERA-service
29421
- * action that generally needs an active camera stream/monitor session — the
29422
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29423
- */
29424
- setLightMode: method(object({
29425
- deviceId: number(),
29426
- mode: NavigationLightModeSchema,
29427
- level: number().min(40).max(100).optional()
29428
- }), _void(), { kind: "mutation" }),
29429
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29430
- setLightLevel: method(object({
29431
- deviceId: number(),
29432
- level: number().min(40).max(100)
29433
- }), _void(), { kind: "mutation" }),
29434
- /**
29435
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29436
- * controls the UI shows (the per-entry flags for the dictionary come back on
29437
- * `listActions`).
29438
- */
29439
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29440
- },
29441
- events: { onStatusChanged: { data: object({
29442
- deviceId: number(),
29443
- status: NavigationStatusSchema
29444
- }) } },
29445
- status: {
29446
- schema: NavigationStatusSchema,
29447
- kind: "push"
29448
- },
29449
- /**
29450
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29451
- * for live mode / follow / flash changes.
29452
- */
29453
- runtimeState: NavigationRuntimeStateSchema,
29454
- /**
29455
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29456
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29457
- * that. The live handle re-publishes on connect.
29458
- *
29459
- * See `RuntimeStateDurability`. Enforced by
29460
- * `scripts/check-runtime-state-durability.ts`.
29461
- */
29462
- durability: "session"
29463
- };
29464
29587
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29465
29588
  kind: "mutation",
29466
29589
  auth: "admin"
@@ -38505,6 +38628,12 @@ Object.freeze({
38505
38628
  addonId: null,
38506
38629
  access: "view"
38507
38630
  },
38631
+ "storage.listDrainProgress": {
38632
+ capName: "storage",
38633
+ capScope: "system",
38634
+ addonId: null,
38635
+ access: "view"
38636
+ },
38508
38637
  "storage.listLocationDeclarations": {
38509
38638
  capName: "storage",
38510
38639
  capScope: "system",
@@ -38649,6 +38778,12 @@ Object.freeze({
38649
38778
  addonId: null,
38650
38779
  access: "view"
38651
38780
  },
38781
+ "storageOccupancy.getOccupancy": {
38782
+ capName: "storage-occupancy",
38783
+ capScope: "system",
38784
+ addonId: null,
38785
+ access: "view"
38786
+ },
38652
38787
  "storageProvider.abortUpload": {
38653
38788
  capName: "storage-provider",
38654
38789
  capScope: "system",