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