@camstack/addon-provider-gree 0.2.78 → 0.2.80
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.
- package/dist/addon.js +519 -367
- package/dist/addon.mjs +519 -367
- package/package.json +1 -1
package/dist/addon.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createSocket } from "dgram";
|
|
2
2
|
import { createCipheriv, createDecipheriv } from "crypto";
|
|
3
3
|
import { EventEmitter } from "events";
|
|
4
|
-
//#region ../types/dist/event-category-
|
|
4
|
+
//#region ../types/dist/event-category-CnLqLOKs.mjs
|
|
5
5
|
var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
6
6
|
EventCategory["SystemBoot"] = "system.boot";
|
|
7
7
|
EventCategory["SystemAddonsReady"] = "system.addons-ready";
|
|
@@ -196,6 +196,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
|
|
|
196
196
|
EventCategory["ProcessCrashed"] = "process.crashed";
|
|
197
197
|
EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
|
|
198
198
|
EventCategory["ProcessRestarted"] = "process.restarted";
|
|
199
|
+
/**
|
|
200
|
+
* The SET of storage locations changed — one was created, edited, enabled,
|
|
201
|
+
* disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
|
|
202
|
+
*
|
|
203
|
+
* Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
|
|
204
|
+
* it must also converge on its own periodic path, because a dropped event
|
|
205
|
+
* must not leave a node writing to yesterday's disk set forever. It exists
|
|
206
|
+
* because there was NO signal at all — an operator who added a second
|
|
207
|
+
* recordings disk in the admin UI got nothing, and the recorder kept its
|
|
208
|
+
* resolved locations until something else happened to re-resolve them
|
|
209
|
+
* (D387). Payload `StorageLocationsChangedPayload`.
|
|
210
|
+
*/
|
|
211
|
+
EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
|
|
199
212
|
EventCategory["RecordingStarted"] = "recording.started";
|
|
200
213
|
EventCategory["RecordingStopped"] = "recording.stopped";
|
|
201
214
|
EventCategory["RecordingError"] = "recording.error";
|
|
@@ -8538,6 +8551,21 @@ var StorageCleanupJobSchema = object({
|
|
|
8538
8551
|
});
|
|
8539
8552
|
var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
|
|
8540
8553
|
/**
|
|
8554
|
+
* The one typed state of a storage location. Authoritative Zod schema — the TS
|
|
8555
|
+
* alias below is `z.infer<>` of it, never a second spelling.
|
|
8556
|
+
*/
|
|
8557
|
+
var StorageLocationModeSchema = _enum([
|
|
8558
|
+
"active",
|
|
8559
|
+
"readonly",
|
|
8560
|
+
"drain",
|
|
8561
|
+
"disabled"
|
|
8562
|
+
]);
|
|
8563
|
+
_enum([
|
|
8564
|
+
"normal",
|
|
8565
|
+
"never",
|
|
8566
|
+
"drain"
|
|
8567
|
+
]);
|
|
8568
|
+
/**
|
|
8541
8569
|
* `StorageLocationType` — an addon-declared id that identifies the *kind* of
|
|
8542
8570
|
* storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
|
|
8543
8571
|
* so the persisted record schema and the consumer-facing cap can both consume it
|
|
@@ -8603,6 +8631,21 @@ var StorageLocationSchema = object({
|
|
|
8603
8631
|
* stops existing rather than being re-derived on every read.
|
|
8604
8632
|
*/
|
|
8605
8633
|
enabled: boolean().optional(),
|
|
8634
|
+
/**
|
|
8635
|
+
* THE state of this location (D385), and the only authority on what may be
|
|
8636
|
+
* written, read or evicted here. Interpreted in exactly one place —
|
|
8637
|
+
* `storage-location-mode.ts` — which also folds the legacy
|
|
8638
|
+
* `enabled` / `config.readOnly` pair into a mode so an old row is never
|
|
8639
|
+
* ambiguous.
|
|
8640
|
+
*
|
|
8641
|
+
* OPTIONAL only for the wire and for rows written before D385: absence is
|
|
8642
|
+
* resolved by `resolveLocationMode`, and the orchestrator stamps every
|
|
8643
|
+
* unstamped row ONCE at hydrate so absence stops existing rather than being
|
|
8644
|
+
* re-derived on every read. `enabled` survives one release as a DERIVED
|
|
8645
|
+
* mirror (`mode === 'active'`); `withLocationMode` is the only writer of
|
|
8646
|
+
* either, so the two cannot disagree.
|
|
8647
|
+
*/
|
|
8648
|
+
mode: StorageLocationModeSchema.optional(),
|
|
8606
8649
|
/** COMPUTED at read time by the orchestrator (statfs of the backing volume
|
|
8607
8650
|
* for node-local locations it can reach) — never persisted, absent when the
|
|
8608
8651
|
* volume is remote/unreachable. The single capacity truth every UI reads. */
|
|
@@ -8610,11 +8653,46 @@ var StorageLocationSchema = object({
|
|
|
8610
8653
|
totalBytes: number(),
|
|
8611
8654
|
availableBytes: number()
|
|
8612
8655
|
}).nullable().optional(),
|
|
8656
|
+
/**
|
|
8657
|
+
* How much of that volume CamStack ITSELF holds on this location (D388) —
|
|
8658
|
+
* COMPUTED at read time from the `storage-occupancy` providers' own figures,
|
|
8659
|
+
* never persisted, never a filesystem walk.
|
|
8660
|
+
*
|
|
8661
|
+
* **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
|
|
8662
|
+
* location yet — nobody stores here, the owning addon is down, or the first
|
|
8663
|
+
* refresh has not completed. A UI must omit the segment rather than draw it
|
|
8664
|
+
* at zero, which would claim we occupy nothing (D315). It is an OBJECT and
|
|
8665
|
+
* not a bare number precisely so that a `?? 0` on the consuming side has to
|
|
8666
|
+
* be spelled out loud instead of appearing by accident.
|
|
8667
|
+
*
|
|
8668
|
+
* `measuredAtMs` is the OLDEST contributing measurement, so it is honest
|
|
8669
|
+
* about the whole figure rather than about its freshest part.
|
|
8670
|
+
*/
|
|
8671
|
+
owned: object({
|
|
8672
|
+
bytes: number().int().nonnegative(),
|
|
8673
|
+
measuredAtMs: number().int().nonnegative()
|
|
8674
|
+
}).optional(),
|
|
8613
8675
|
createdAt: number(),
|
|
8614
8676
|
updatedAt: number()
|
|
8615
8677
|
});
|
|
8616
8678
|
object({ isDefault: boolean().optional() });
|
|
8617
8679
|
/**
|
|
8680
|
+
* How far a `drain` has got (D386) — the read a UI renders, and nothing more.
|
|
8681
|
+
*
|
|
8682
|
+
* `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
|
|
8683
|
+
* OBSERVED and is `null` when it has observed none. Never a fabricated date: a
|
|
8684
|
+
* drain with no observed growth has no honest ETA, and inventing one is how an
|
|
8685
|
+
* operator learns not to believe the screen.
|
|
8686
|
+
*/
|
|
8687
|
+
var StorageDrainProgressSchema = object({
|
|
8688
|
+
locationId: string(),
|
|
8689
|
+
startedAtMs: number(),
|
|
8690
|
+
startBytes: number(),
|
|
8691
|
+
bytesRemaining: number(),
|
|
8692
|
+
drained: boolean(),
|
|
8693
|
+
estimatedEmptyAtMs: number().nullable()
|
|
8694
|
+
});
|
|
8695
|
+
/**
|
|
8618
8696
|
* Reference accepted by consumer-facing `api.storage.*` calls.
|
|
8619
8697
|
* Either:
|
|
8620
8698
|
* - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
|
|
@@ -20423,8 +20501,25 @@ var occupancyRecheckFramesField = {
|
|
|
20423
20501
|
* (analyzer attaches detected `regions[]`; onboard does not — the
|
|
20424
20502
|
* camera typically only reports a binary signal plus an optional
|
|
20425
20503
|
* channel/AI class which lives in dedicated event channels).
|
|
20426
|
-
|
|
20427
|
-
|
|
20504
|
+
*
|
|
20505
|
+
* - `onboard` — the camera's firmware said something moved.
|
|
20506
|
+
* - `analyzer` — this runner's frame-diff said so, and attaches `regions[]`.
|
|
20507
|
+
* - `device-activity` — the DEVICE said it is doing its job: the
|
|
20508
|
+
* `recording-signal` LEVEL the same device raises for the recorder
|
|
20509
|
+
* ([D380](../../../../docs/decisions/adr-0380-a-device-decided-recording-is-a-mode-with-no-schedule-seeded-once.md)),
|
|
20510
|
+
* republished as a motion source. It attaches **nothing** — no regions, no
|
|
20511
|
+
* class: the only fact it carries is that the device is active, and a robot
|
|
20512
|
+
* vacuum that is itself the moving object has no region worth sending. It is
|
|
20513
|
+
* a LEVEL, so unlike `onboard` it has a real falling edge, and unlike
|
|
20514
|
+
* `analyzer` it must not open the frame-diff side-channel — the runner's
|
|
20515
|
+
* `handleOnboardMotionAnalyzer` gate is `source === 'onboard'` and stays that
|
|
20516
|
+
* way ([D392](../../../../docs/decisions/adr-0392-a-device-that-says-it-is-working-is-a-motion-source-of-its-own.md)).
|
|
20517
|
+
*/
|
|
20518
|
+
var MotionSourceEnum = _enum([
|
|
20519
|
+
"onboard",
|
|
20520
|
+
"analyzer",
|
|
20521
|
+
"device-activity"
|
|
20522
|
+
]);
|
|
20428
20523
|
/**
|
|
20429
20524
|
* List of motion sources active on a camera. Empty array is valid:
|
|
20430
20525
|
* "no source" — happens for battery cams without firmware motion when
|
|
@@ -21943,7 +22038,7 @@ method(object({
|
|
|
21943
22038
|
}), _void(), {
|
|
21944
22039
|
kind: "mutation",
|
|
21945
22040
|
auth: "admin"
|
|
21946
|
-
}), method(object({ id: string() }), object({
|
|
22041
|
+
}), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
|
|
21947
22042
|
ok: boolean(),
|
|
21948
22043
|
error: string().optional()
|
|
21949
22044
|
}), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
|
|
@@ -22013,6 +22108,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
|
|
|
22013
22108
|
kind: "mutation",
|
|
22014
22109
|
auth: "admin"
|
|
22015
22110
|
}), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
|
|
22111
|
+
/**
|
|
22112
|
+
* `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
|
|
22113
|
+
* location (D388).
|
|
22114
|
+
*
|
|
22115
|
+
* ## Why this is not `storage-evictable`
|
|
22116
|
+
*
|
|
22117
|
+
* `storage-evictable.getEvictableUsage` looks like the same question and is
|
|
22118
|
+
* not, in two ways that both matter and both bite hardest on the locations an
|
|
22119
|
+
* operator most wants a figure for:
|
|
22120
|
+
*
|
|
22121
|
+
* - it reports the whole eviction DOMAIN, not the location. `recordings:default`
|
|
22122
|
+
* and `recordingsLow:default` deliberately share one root and evict as one
|
|
22123
|
+
* oldest-first pool, so both answer with the SAME combined total. As an
|
|
22124
|
+
* occupancy figure that double-counts the disk.
|
|
22125
|
+
* - it reports ZERO for a location whose eviction policy is `never` (D385) —
|
|
22126
|
+
* a `readonly` or `disabled` disk. Those are exactly the disks an operator
|
|
22127
|
+
* is retiring and staring at.
|
|
22128
|
+
*
|
|
22129
|
+
* So this is its own contract with its own quantity, and the quantity is
|
|
22130
|
+
* OCCUPIED: every byte the addon holds on that location, whether or not it
|
|
22131
|
+
* would ever be willing to delete it. A provider that can only answer
|
|
22132
|
+
* "evictable" must not register here — a number that silently means different
|
|
22133
|
+
* things per class is worse than no number.
|
|
22134
|
+
*
|
|
22135
|
+
* ## Absence is an answer
|
|
22136
|
+
*
|
|
22137
|
+
* A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
|
|
22138
|
+
* stamps `StorageLocation.owned` only for locations it has a report for, and
|
|
22139
|
+
* the field is an OBJECT rather than a bare number so that a `?? 0` on the
|
|
22140
|
+
* consuming side has to be written out loud instead of appearing by accident.
|
|
22141
|
+
*
|
|
22142
|
+
* `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
|
|
22143
|
+
* a public client surface. Clients read the stamped `StorageLocation.owned`.
|
|
22144
|
+
*/
|
|
22145
|
+
/** One provider's occupancy answer for one location. */
|
|
22146
|
+
var StorageOccupancyReportSchema = object({
|
|
22147
|
+
locationId: string(),
|
|
22148
|
+
/** Bytes this provider holds on THAT location — not its eviction domain, and
|
|
22149
|
+
* not net of what it is willing to delete. */
|
|
22150
|
+
ownedBytes: number().int().nonnegative(),
|
|
22151
|
+
/** When the provider last actually measured this. The orchestrator carries it
|
|
22152
|
+
* through so a UI can say how old the figure is instead of implying "now". */
|
|
22153
|
+
measuredAtMs: number().int().nonnegative()
|
|
22154
|
+
});
|
|
22155
|
+
method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
|
|
22016
22156
|
var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
|
|
22017
22157
|
providerId: string().min(1),
|
|
22018
22158
|
displayName: string().min(1),
|
|
@@ -23848,88 +23988,6 @@ onStatusChanged: { data: object({
|
|
|
23848
23988
|
volatileStateFields: ["lastUpdated"]
|
|
23849
23989
|
};
|
|
23850
23990
|
/**
|
|
23851
|
-
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
23852
|
-
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
23853
|
-
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
23854
|
-
* one Home Assistant projection.
|
|
23855
|
-
*/
|
|
23856
|
-
var NetworkLinkStatusSchema = object({
|
|
23857
|
-
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
23858
|
-
type: _enum([
|
|
23859
|
-
"wifi",
|
|
23860
|
-
"ethernet",
|
|
23861
|
-
"cellular",
|
|
23862
|
-
"unknown"
|
|
23863
|
-
]),
|
|
23864
|
-
/**
|
|
23865
|
-
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
23866
|
-
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
23867
|
-
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
23868
|
-
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
23869
|
-
* SKIP a null rather than coerce it.
|
|
23870
|
-
*/
|
|
23871
|
-
signalPercent: number().min(0).max(100).nullable(),
|
|
23872
|
-
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
23873
|
-
rssiDbm: number().optional(),
|
|
23874
|
-
/** Network name of a wireless link, when the firmware reports it. */
|
|
23875
|
-
ssid: string().optional(),
|
|
23876
|
-
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
23877
|
-
lastUpdated: number()
|
|
23878
|
-
});
|
|
23879
|
-
var networkLinkCapability = {
|
|
23880
|
-
name: "network-link",
|
|
23881
|
-
scope: "device",
|
|
23882
|
-
deviceNative: true,
|
|
23883
|
-
mode: "singleton",
|
|
23884
|
-
deviceTypes: [
|
|
23885
|
-
DeviceType.Camera,
|
|
23886
|
-
DeviceType.Sensor,
|
|
23887
|
-
DeviceType.Button,
|
|
23888
|
-
DeviceType.Switch,
|
|
23889
|
-
DeviceType.Light,
|
|
23890
|
-
DeviceType.Lock,
|
|
23891
|
-
DeviceType.Siren
|
|
23892
|
-
],
|
|
23893
|
-
methods: {},
|
|
23894
|
-
events: {
|
|
23895
|
-
/**
|
|
23896
|
-
* Emitted whenever the cached status changes (a link switch, a signal
|
|
23897
|
-
* reading that moved). Mirrored on the parent chain by the
|
|
23898
|
-
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
23899
|
-
*/
|
|
23900
|
-
onStatusChanged: { data: object({
|
|
23901
|
-
deviceId: number(),
|
|
23902
|
-
status: NetworkLinkStatusSchema
|
|
23903
|
-
}) } },
|
|
23904
|
-
status: {
|
|
23905
|
-
schema: NetworkLinkStatusSchema,
|
|
23906
|
-
kind: "push",
|
|
23907
|
-
empty: {
|
|
23908
|
-
type: "unknown",
|
|
23909
|
-
signalPercent: null,
|
|
23910
|
-
lastUpdated: 0
|
|
23911
|
-
}
|
|
23912
|
-
},
|
|
23913
|
-
/**
|
|
23914
|
-
* Runtime-state slice — every provider stores the same shape under
|
|
23915
|
-
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
23916
|
-
* Home Assistant projector regardless of the driver.
|
|
23917
|
-
*/
|
|
23918
|
-
runtimeState: NetworkLinkStatusSchema,
|
|
23919
|
-
/**
|
|
23920
|
-
* Runtime-state durability: **restored** — a link reading is slow to
|
|
23921
|
-
* change and a sleeping battery camera may not report for hours; the
|
|
23922
|
-
* restored slice is what the badge shows until the next read.
|
|
23923
|
-
*
|
|
23924
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
23925
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
23926
|
-
*/
|
|
23927
|
-
durability: "restored",
|
|
23928
|
-
/** Clock fields: written, but excluded from the compare that decides
|
|
23929
|
-
* whether persisting is worth a SQLite commit. */
|
|
23930
|
-
volatileStateFields: ["lastUpdated"]
|
|
23931
|
-
};
|
|
23932
|
-
/**
|
|
23933
23991
|
* Generic boolean sensor — last-resort fallback when no domain-
|
|
23934
23992
|
* specific binary cap fits (Home Assistant `binary_sensor` without a
|
|
23935
23993
|
* known `device_class`, or a domain we haven't typed yet). Pure
|
|
@@ -27459,6 +27517,369 @@ var nativeObjectDetectionCapability = {
|
|
|
27459
27517
|
volatileStateFields: ["lastFetchedAt"]
|
|
27460
27518
|
};
|
|
27461
27519
|
/**
|
|
27520
|
+
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
27521
|
+
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
27522
|
+
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
27523
|
+
*
|
|
27524
|
+
* Why a NEW cap rather than overloading `ptz`:
|
|
27525
|
+
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
27526
|
+
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
27527
|
+
* The two are different physical models: PTZ is absolute-position + presets,
|
|
27528
|
+
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
27529
|
+
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
27530
|
+
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
27531
|
+
* the reverse:
|
|
27532
|
+
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
27533
|
+
* / `getOptions`), and
|
|
27534
|
+
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
27535
|
+
* robot camera shows up in the existing PTZ control path without every
|
|
27536
|
+
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
27537
|
+
* not here (see the addon design note):
|
|
27538
|
+
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
27539
|
+
* ptz.stop() → navigation.stop()
|
|
27540
|
+
* ptz.goHome() → navigation.runAction('goHome')
|
|
27541
|
+
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
27542
|
+
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
27543
|
+
*
|
|
27544
|
+
* ## Continuous drive
|
|
27545
|
+
*
|
|
27546
|
+
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
27547
|
+
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
27548
|
+
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
27549
|
+
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
27550
|
+
* coalesce them. The UI owns the cadence.
|
|
27551
|
+
*
|
|
27552
|
+
* ## The action dictionary
|
|
27553
|
+
*
|
|
27554
|
+
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
27555
|
+
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
27556
|
+
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
27557
|
+
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
27558
|
+
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
27559
|
+
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
27560
|
+
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
27561
|
+
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
27562
|
+
*
|
|
27563
|
+
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
27564
|
+
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
27565
|
+
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
27566
|
+
* every device handle. A future nodedreame publish adds a typed
|
|
27567
|
+
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
27568
|
+
* provider can then swap the raw calls for the typed methods with no change to
|
|
27569
|
+
* THIS contract.
|
|
27570
|
+
*/
|
|
27571
|
+
/**
|
|
27572
|
+
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
27573
|
+
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
27574
|
+
* halts it.
|
|
27575
|
+
*
|
|
27576
|
+
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
27577
|
+
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
27578
|
+
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
27579
|
+
* vector by it (drivers without proportional drive ignore it).
|
|
27580
|
+
*
|
|
27581
|
+
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
27582
|
+
* axis alone; an all-undefined nudge is a no-op.
|
|
27583
|
+
*/
|
|
27584
|
+
var NavigationMoveCommandSchema = object({
|
|
27585
|
+
pan: number().min(-1).max(1).optional(),
|
|
27586
|
+
tilt: number().min(-1).max(1).optional(),
|
|
27587
|
+
speed: number().min(0).max(1).optional()
|
|
27588
|
+
});
|
|
27589
|
+
/**
|
|
27590
|
+
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
27591
|
+
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
27592
|
+
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
27593
|
+
* `playSound` (see the `sound` dictionary entries).
|
|
27594
|
+
*/
|
|
27595
|
+
var NavigationActionIdSchema = _enum([
|
|
27596
|
+
"goHome",
|
|
27597
|
+
"locate",
|
|
27598
|
+
"spotClean",
|
|
27599
|
+
"findPet",
|
|
27600
|
+
"personFollow",
|
|
27601
|
+
"stop",
|
|
27602
|
+
"startClean",
|
|
27603
|
+
"pauseClean",
|
|
27604
|
+
"dockWash",
|
|
27605
|
+
"autoEmpty",
|
|
27606
|
+
"flashOn",
|
|
27607
|
+
"flashOff"
|
|
27608
|
+
]);
|
|
27609
|
+
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
27610
|
+
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
27611
|
+
/**
|
|
27612
|
+
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
27613
|
+
* native panel and the PTZ mimic render as a button.
|
|
27614
|
+
*
|
|
27615
|
+
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
27616
|
+
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
27617
|
+
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
27618
|
+
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
27619
|
+
* - `label` — operator-facing English label.
|
|
27620
|
+
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
27621
|
+
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
27622
|
+
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
27623
|
+
* flips it from config, never by editing code.
|
|
27624
|
+
*/
|
|
27625
|
+
var NavigationActionEntrySchema = object({
|
|
27626
|
+
id: string(),
|
|
27627
|
+
kind: NavigationEntryKindSchema,
|
|
27628
|
+
label: string(),
|
|
27629
|
+
icon: string(),
|
|
27630
|
+
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
27631
|
+
soundId: number().int().optional(),
|
|
27632
|
+
/** Per-device feature flag — render this entry only when true. */
|
|
27633
|
+
enabled: boolean()
|
|
27634
|
+
});
|
|
27635
|
+
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
27636
|
+
var NavigationPointSchema = object({
|
|
27637
|
+
x: number(),
|
|
27638
|
+
y: number()
|
|
27639
|
+
});
|
|
27640
|
+
/**
|
|
27641
|
+
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
27642
|
+
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
27643
|
+
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
27644
|
+
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
27645
|
+
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
27646
|
+
* that are not dictionary entries.
|
|
27647
|
+
*
|
|
27648
|
+
* - `move` / `stop` — the momentary drive joystick.
|
|
27649
|
+
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
27650
|
+
* map-coordinate plumbing is wired.
|
|
27651
|
+
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
27652
|
+
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
27653
|
+
* - `light` — the on/off fill-light toggle (works anytime).
|
|
27654
|
+
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
27655
|
+
* camera-service control; needs an active stream).
|
|
27656
|
+
*/
|
|
27657
|
+
var NavigationFeaturesSchema = object({
|
|
27658
|
+
move: boolean(),
|
|
27659
|
+
stop: boolean(),
|
|
27660
|
+
goToPoint: boolean(),
|
|
27661
|
+
runAction: boolean(),
|
|
27662
|
+
playSound: boolean(),
|
|
27663
|
+
light: boolean(),
|
|
27664
|
+
lightMode: boolean()
|
|
27665
|
+
});
|
|
27666
|
+
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
27667
|
+
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
27668
|
+
/**
|
|
27669
|
+
* Live navigation state so the UI can reflect what the robot is doing:
|
|
27670
|
+
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
27671
|
+
* - `following` — person/pet follow is currently armed.
|
|
27672
|
+
* - `flash` — the on-camera fill light is on.
|
|
27673
|
+
* - `lightMode` — auto vs manual fill-light mode.
|
|
27674
|
+
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
27675
|
+
* `lightMode === 'manual'`.
|
|
27676
|
+
*/
|
|
27677
|
+
var NavigationStatusSchema = object({
|
|
27678
|
+
mode: _enum([
|
|
27679
|
+
"idle",
|
|
27680
|
+
"cleaning",
|
|
27681
|
+
"spot",
|
|
27682
|
+
"following",
|
|
27683
|
+
"goto",
|
|
27684
|
+
"returning",
|
|
27685
|
+
"paused",
|
|
27686
|
+
"unknown"
|
|
27687
|
+
]),
|
|
27688
|
+
following: boolean(),
|
|
27689
|
+
flash: boolean(),
|
|
27690
|
+
lightMode: NavigationLightModeSchema,
|
|
27691
|
+
lightLevel: number().min(40).max(100),
|
|
27692
|
+
/** Ms epoch when the slice was last updated. */
|
|
27693
|
+
lastChangedAt: number()
|
|
27694
|
+
});
|
|
27695
|
+
/**
|
|
27696
|
+
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
27697
|
+
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
27698
|
+
* convention.
|
|
27699
|
+
*/
|
|
27700
|
+
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
27701
|
+
var navigationCapability = {
|
|
27702
|
+
name: "navigation",
|
|
27703
|
+
scope: "device",
|
|
27704
|
+
deviceNative: true,
|
|
27705
|
+
mode: "singleton",
|
|
27706
|
+
deviceTypes: [DeviceType.Camera],
|
|
27707
|
+
deviceConfig: { ui: {
|
|
27708
|
+
kind: "widget",
|
|
27709
|
+
widgetId: "host/navigation-panel",
|
|
27710
|
+
tab: "navigation",
|
|
27711
|
+
topTab: true,
|
|
27712
|
+
label: "Navigation",
|
|
27713
|
+
order: 0
|
|
27714
|
+
} },
|
|
27715
|
+
methods: {
|
|
27716
|
+
/**
|
|
27717
|
+
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
27718
|
+
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
27719
|
+
* path) works for any authenticated user, not admin-only. The UI sends
|
|
27720
|
+
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
27721
|
+
* a single drive write WITHOUT debouncing.
|
|
27722
|
+
*/
|
|
27723
|
+
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
27724
|
+
/** Halt all motion immediately (zero drive vector). */
|
|
27725
|
+
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
27726
|
+
/** Send the robot to a point on its live map. */
|
|
27727
|
+
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
27728
|
+
/**
|
|
27729
|
+
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
27730
|
+
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
27731
|
+
*/
|
|
27732
|
+
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
27733
|
+
/**
|
|
27734
|
+
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
27735
|
+
* unsupported action ids are rejected by the provider.
|
|
27736
|
+
*/
|
|
27737
|
+
runAction: method(object({
|
|
27738
|
+
deviceId: number(),
|
|
27739
|
+
actionId: NavigationActionIdSchema
|
|
27740
|
+
}), _void(), { kind: "mutation" }),
|
|
27741
|
+
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
27742
|
+
playSound: method(object({
|
|
27743
|
+
deviceId: number(),
|
|
27744
|
+
soundId: number().int()
|
|
27745
|
+
}), _void(), { kind: "mutation" }),
|
|
27746
|
+
/**
|
|
27747
|
+
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
27748
|
+
* works anytime, no active stream required).
|
|
27749
|
+
*/
|
|
27750
|
+
setLightOn: method(object({
|
|
27751
|
+
deviceId: number(),
|
|
27752
|
+
on: boolean()
|
|
27753
|
+
}), _void(), { kind: "mutation" }),
|
|
27754
|
+
/**
|
|
27755
|
+
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
27756
|
+
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
27757
|
+
* action that generally needs an active camera stream/monitor session — the
|
|
27758
|
+
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
27759
|
+
*/
|
|
27760
|
+
setLightMode: method(object({
|
|
27761
|
+
deviceId: number(),
|
|
27762
|
+
mode: NavigationLightModeSchema,
|
|
27763
|
+
level: number().min(40).max(100).optional()
|
|
27764
|
+
}), _void(), { kind: "mutation" }),
|
|
27765
|
+
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
27766
|
+
setLightLevel: method(object({
|
|
27767
|
+
deviceId: number(),
|
|
27768
|
+
level: number().min(40).max(100)
|
|
27769
|
+
}), _void(), { kind: "mutation" }),
|
|
27770
|
+
/**
|
|
27771
|
+
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
27772
|
+
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
27773
|
+
* `listActions`).
|
|
27774
|
+
*/
|
|
27775
|
+
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
27776
|
+
},
|
|
27777
|
+
events: { onStatusChanged: { data: object({
|
|
27778
|
+
deviceId: number(),
|
|
27779
|
+
status: NavigationStatusSchema
|
|
27780
|
+
}) } },
|
|
27781
|
+
status: {
|
|
27782
|
+
schema: NavigationStatusSchema,
|
|
27783
|
+
kind: "push"
|
|
27784
|
+
},
|
|
27785
|
+
/**
|
|
27786
|
+
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
27787
|
+
* for live mode / follow / flash changes.
|
|
27788
|
+
*/
|
|
27789
|
+
runtimeState: NavigationRuntimeStateSchema,
|
|
27790
|
+
/**
|
|
27791
|
+
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
27792
|
+
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
27793
|
+
* that. The live handle re-publishes on connect.
|
|
27794
|
+
*
|
|
27795
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
27796
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
27797
|
+
*/
|
|
27798
|
+
durability: "session"
|
|
27799
|
+
};
|
|
27800
|
+
/**
|
|
27801
|
+
* Network-link snapshot. Same shape for every provider (a Reolink wifi
|
|
27802
|
+
* camera, a Home Assistant device with a signal-strength sensor, a Tapo
|
|
27803
|
+
* plug): one slice under `device.runtimeState['network-link']`, one badge,
|
|
27804
|
+
* one Home Assistant projection.
|
|
27805
|
+
*/
|
|
27806
|
+
var NetworkLinkStatusSchema = object({
|
|
27807
|
+
/** The link the device is on. `'unknown'` = not read yet, not "no link". */
|
|
27808
|
+
type: _enum([
|
|
27809
|
+
"wifi",
|
|
27810
|
+
"ethernet",
|
|
27811
|
+
"cellular",
|
|
27812
|
+
"unknown"
|
|
27813
|
+
]),
|
|
27814
|
+
/**
|
|
27815
|
+
* Link quality, 0..100 inclusive, normalised by the provider from whatever
|
|
27816
|
+
* the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
|
|
27817
|
+
* KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
|
|
27818
|
+
* one whose reading has not landed must not be drawn at 0 %. Consumers
|
|
27819
|
+
* SKIP a null rather than coerce it.
|
|
27820
|
+
*/
|
|
27821
|
+
signalPercent: number().min(0).max(100).nullable(),
|
|
27822
|
+
/** Raw received signal strength in dBm, when the firmware reports one. */
|
|
27823
|
+
rssiDbm: number().optional(),
|
|
27824
|
+
/** Network name of a wireless link, when the firmware reports it. */
|
|
27825
|
+
ssid: string().optional(),
|
|
27826
|
+
/** Ms epoch of the last observation. Lets consumers reason about freshness. */
|
|
27827
|
+
lastUpdated: number()
|
|
27828
|
+
});
|
|
27829
|
+
var networkLinkCapability = {
|
|
27830
|
+
name: "network-link",
|
|
27831
|
+
scope: "device",
|
|
27832
|
+
deviceNative: true,
|
|
27833
|
+
mode: "singleton",
|
|
27834
|
+
deviceTypes: [
|
|
27835
|
+
DeviceType.Camera,
|
|
27836
|
+
DeviceType.Sensor,
|
|
27837
|
+
DeviceType.Button,
|
|
27838
|
+
DeviceType.Switch,
|
|
27839
|
+
DeviceType.Light,
|
|
27840
|
+
DeviceType.Lock,
|
|
27841
|
+
DeviceType.Siren
|
|
27842
|
+
],
|
|
27843
|
+
methods: {},
|
|
27844
|
+
events: {
|
|
27845
|
+
/**
|
|
27846
|
+
* Emitted whenever the cached status changes (a link switch, a signal
|
|
27847
|
+
* reading that moved). Mirrored on the parent chain by the
|
|
27848
|
+
* DeviceEventPropagator like `battery.onStatusChanged`.
|
|
27849
|
+
*/
|
|
27850
|
+
onStatusChanged: { data: object({
|
|
27851
|
+
deviceId: number(),
|
|
27852
|
+
status: NetworkLinkStatusSchema
|
|
27853
|
+
}) } },
|
|
27854
|
+
status: {
|
|
27855
|
+
schema: NetworkLinkStatusSchema,
|
|
27856
|
+
kind: "push",
|
|
27857
|
+
empty: {
|
|
27858
|
+
type: "unknown",
|
|
27859
|
+
signalPercent: null,
|
|
27860
|
+
lastUpdated: 0
|
|
27861
|
+
}
|
|
27862
|
+
},
|
|
27863
|
+
/**
|
|
27864
|
+
* Runtime-state slice — every provider stores the same shape under
|
|
27865
|
+
* `device.runtimeState['network-link']`, read once by the badge and the
|
|
27866
|
+
* Home Assistant projector regardless of the driver.
|
|
27867
|
+
*/
|
|
27868
|
+
runtimeState: NetworkLinkStatusSchema,
|
|
27869
|
+
/**
|
|
27870
|
+
* Runtime-state durability: **restored** — a link reading is slow to
|
|
27871
|
+
* change and a sleeping battery camera may not report for hours; the
|
|
27872
|
+
* restored slice is what the badge shows until the next read.
|
|
27873
|
+
*
|
|
27874
|
+
* See `RuntimeStateDurability`. Enforced by
|
|
27875
|
+
* `scripts/check-runtime-state-durability.ts`.
|
|
27876
|
+
*/
|
|
27877
|
+
durability: "restored",
|
|
27878
|
+
/** Clock fields: written, but excluded from the compare that decides
|
|
27879
|
+
* whether persisting is worth a SQLite commit. */
|
|
27880
|
+
volatileStateFields: ["lastUpdated"]
|
|
27881
|
+
};
|
|
27882
|
+
/**
|
|
27462
27883
|
* network-quality — system-scoped singleton capability tracking RTT,
|
|
27463
27884
|
* jitter, and observed/peak bandwidth per device + per client.
|
|
27464
27885
|
*
|
|
@@ -29039,287 +29460,6 @@ var ptzAutotrackCapability = {
|
|
|
29039
29460
|
*/
|
|
29040
29461
|
durability: "session"
|
|
29041
29462
|
};
|
|
29042
|
-
/**
|
|
29043
|
-
* `navigation` — a device-scoped capability that natively expresses the FULL
|
|
29044
|
-
* navigation / action surface of a robot that DRIVES ITSELF and carries an
|
|
29045
|
-
* on-board camera (the Dreame robot-vacuum camera is the first provider).
|
|
29046
|
-
*
|
|
29047
|
-
* Why a NEW cap rather than overloading `ptz`:
|
|
29048
|
-
* - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
|
|
29049
|
-
* robot vacuum has no gimbal — the whole chassis drives, turns and spins.
|
|
29050
|
-
* The two are different physical models: PTZ is absolute-position + presets,
|
|
29051
|
-
* navigation is momentary drive nudges + discrete robot ACTIONS
|
|
29052
|
-
* (dock / spot-clean / follow-pet / go-to-point / …).
|
|
29053
|
-
* - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
|
|
29054
|
-
* the reverse:
|
|
29055
|
-
* 1. a native CamStack navigation panel (data-driven from `listActions`
|
|
29056
|
-
* / `getOptions`), and
|
|
29057
|
-
* 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
|
|
29058
|
-
* robot camera shows up in the existing PTZ control path without every
|
|
29059
|
-
* PTZ provider learning about robots. The mapping lives in the adapter,
|
|
29060
|
-
* not here (see the addon design note):
|
|
29061
|
-
* ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
|
|
29062
|
-
* ptz.stop() → navigation.stop()
|
|
29063
|
-
* ptz.goHome() → navigation.runAction('goHome')
|
|
29064
|
-
* ptz.getPresets() → navigation.listActions() (id→preset)
|
|
29065
|
-
* ptz.goToPreset(id) → navigation.runAction(id)
|
|
29066
|
-
*
|
|
29067
|
-
* ## Continuous drive
|
|
29068
|
-
*
|
|
29069
|
-
* `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
|
|
29070
|
-
* sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
|
|
29071
|
-
* one `stop()` on release — exactly like the robot app's remote-drive joystick.
|
|
29072
|
-
* The provider forwards EACH `move` to one drive write; it must NOT debounce or
|
|
29073
|
-
* coalesce them. The UI owns the cadence.
|
|
29074
|
-
*
|
|
29075
|
-
* ## The action dictionary
|
|
29076
|
-
*
|
|
29077
|
-
* The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
|
|
29078
|
-
* are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
|
|
29079
|
-
* carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
|
|
29080
|
-
* native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
|
|
29081
|
-
* vendor-specific list. `kind: 'action'` entries are triggered with
|
|
29082
|
-
* `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
|
|
29083
|
-
* (the entry carries the `soundId` to pass). The general primitives — `move`,
|
|
29084
|
-
* `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
|
|
29085
|
-
*
|
|
29086
|
-
* NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
|
|
29087
|
-
* `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
|
|
29088
|
-
* that the currently-published `@apocaliss92/nodedreame` already exposes on
|
|
29089
|
-
* every device handle. A future nodedreame publish adds a typed
|
|
29090
|
-
* `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
|
|
29091
|
-
* provider can then swap the raw calls for the typed methods with no change to
|
|
29092
|
-
* THIS contract.
|
|
29093
|
-
*/
|
|
29094
|
-
/**
|
|
29095
|
-
* A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
|
|
29096
|
-
* keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
|
|
29097
|
-
* halts it.
|
|
29098
|
-
*
|
|
29099
|
-
* - `pan` — turn: negative = left, positive = right, 0 = straight.
|
|
29100
|
-
* - `tilt` — throttle: positive = forward, negative = spin / turn-around.
|
|
29101
|
-
* - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
|
|
29102
|
-
* vector by it (drivers without proportional drive ignore it).
|
|
29103
|
-
*
|
|
29104
|
-
* `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
|
|
29105
|
-
* axis alone; an all-undefined nudge is a no-op.
|
|
29106
|
-
*/
|
|
29107
|
-
var NavigationMoveCommandSchema = object({
|
|
29108
|
-
pan: number().min(-1).max(1).optional(),
|
|
29109
|
-
tilt: number().min(-1).max(1).optional(),
|
|
29110
|
-
speed: number().min(0).max(1).optional()
|
|
29111
|
-
});
|
|
29112
|
-
/**
|
|
29113
|
-
* The enumerated discrete actions a navigation-capable robot can perform via
|
|
29114
|
-
* `runAction`. This is the CLOSED vocabulary; a given device advertises the
|
|
29115
|
-
* subset it supports through `listActions`. Sounds are NOT here — they go through
|
|
29116
|
-
* `playSound` (see the `sound` dictionary entries).
|
|
29117
|
-
*/
|
|
29118
|
-
var NavigationActionIdSchema = _enum([
|
|
29119
|
-
"goHome",
|
|
29120
|
-
"locate",
|
|
29121
|
-
"spotClean",
|
|
29122
|
-
"findPet",
|
|
29123
|
-
"personFollow",
|
|
29124
|
-
"stop",
|
|
29125
|
-
"startClean",
|
|
29126
|
-
"pauseClean",
|
|
29127
|
-
"dockWash",
|
|
29128
|
-
"autoEmpty",
|
|
29129
|
-
"flashOn",
|
|
29130
|
-
"flashOff"
|
|
29131
|
-
]);
|
|
29132
|
-
/** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
|
|
29133
|
-
var NavigationEntryKindSchema = _enum(["action", "sound"]);
|
|
29134
|
-
/**
|
|
29135
|
-
* One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
|
|
29136
|
-
* native panel and the PTZ mimic render as a button.
|
|
29137
|
-
*
|
|
29138
|
-
* - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
|
|
29139
|
-
* (pass to `runAction`); for `kind:'sound'` it is a namespaced id
|
|
29140
|
-
* (`sound:meow`) whose `soundId` is passed to `playSound`.
|
|
29141
|
-
* - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
|
|
29142
|
-
* - `label` — operator-facing English label.
|
|
29143
|
-
* - `soundId` — wire sound id, present only on `kind:'sound'` entries.
|
|
29144
|
-
* - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
|
|
29145
|
-
* PTZ render ONLY enabled entries. Data-driven: the provider
|
|
29146
|
-
* flips it from config, never by editing code.
|
|
29147
|
-
*/
|
|
29148
|
-
var NavigationActionEntrySchema = object({
|
|
29149
|
-
id: string(),
|
|
29150
|
-
kind: NavigationEntryKindSchema,
|
|
29151
|
-
label: string(),
|
|
29152
|
-
icon: string(),
|
|
29153
|
-
/** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
|
|
29154
|
-
soundId: number().int().optional(),
|
|
29155
|
-
/** Per-device feature flag — render this entry only when true. */
|
|
29156
|
-
enabled: boolean()
|
|
29157
|
-
});
|
|
29158
|
-
/** Coordinates for `goToPoint` — a point on the robot's live map. */
|
|
29159
|
-
var NavigationPointSchema = object({
|
|
29160
|
-
x: number(),
|
|
29161
|
-
y: number()
|
|
29162
|
-
});
|
|
29163
|
-
/**
|
|
29164
|
-
* Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
|
|
29165
|
-
* The cap reports which are enabled so the UI / PTZ render only the controls
|
|
29166
|
-
* that are turned on for THIS device. Data-driven: the provider derives these
|
|
29167
|
-
* from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
|
|
29168
|
-
* live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
|
|
29169
|
-
* that are not dictionary entries.
|
|
29170
|
-
*
|
|
29171
|
-
* - `move` / `stop` — the momentary drive joystick.
|
|
29172
|
-
* - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
|
|
29173
|
-
* map-coordinate plumbing is wired.
|
|
29174
|
-
* - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
|
|
29175
|
-
* - `playSound` — the sound buttons (dictionary `kind:'sound'`).
|
|
29176
|
-
* - `light` — the on/off fill-light toggle (works anytime).
|
|
29177
|
-
* - `lightMode` — the auto/manual selector + manual level slider (a
|
|
29178
|
-
* camera-service control; needs an active stream).
|
|
29179
|
-
*/
|
|
29180
|
-
var NavigationFeaturesSchema = object({
|
|
29181
|
-
move: boolean(),
|
|
29182
|
-
stop: boolean(),
|
|
29183
|
-
goToPoint: boolean(),
|
|
29184
|
-
runAction: boolean(),
|
|
29185
|
-
playSound: boolean(),
|
|
29186
|
-
light: boolean(),
|
|
29187
|
-
lightMode: boolean()
|
|
29188
|
-
});
|
|
29189
|
-
/** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
|
|
29190
|
-
var NavigationLightModeSchema = _enum(["auto", "manual"]);
|
|
29191
|
-
/**
|
|
29192
|
-
* Live navigation state so the UI can reflect what the robot is doing:
|
|
29193
|
-
* - `mode` — coarse activity (idle / cleaning / following / …).
|
|
29194
|
-
* - `following` — person/pet follow is currently armed.
|
|
29195
|
-
* - `flash` — the on-camera fill light is on.
|
|
29196
|
-
* - `lightMode` — auto vs manual fill-light mode.
|
|
29197
|
-
* - `lightLevel` — manual fill-light level (40..100); meaningful when
|
|
29198
|
-
* `lightMode === 'manual'`.
|
|
29199
|
-
*/
|
|
29200
|
-
var NavigationStatusSchema = object({
|
|
29201
|
-
mode: _enum([
|
|
29202
|
-
"idle",
|
|
29203
|
-
"cleaning",
|
|
29204
|
-
"spot",
|
|
29205
|
-
"following",
|
|
29206
|
-
"goto",
|
|
29207
|
-
"returning",
|
|
29208
|
-
"paused",
|
|
29209
|
-
"unknown"
|
|
29210
|
-
]),
|
|
29211
|
-
following: boolean(),
|
|
29212
|
-
flash: boolean(),
|
|
29213
|
-
lightMode: NavigationLightModeSchema,
|
|
29214
|
-
lightLevel: number().min(40).max(100),
|
|
29215
|
-
/** Ms epoch when the slice was last updated. */
|
|
29216
|
-
lastChangedAt: number()
|
|
29217
|
-
});
|
|
29218
|
-
/**
|
|
29219
|
-
* Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
|
|
29220
|
-
* observable). Adds `lastFetchedAt` on top of the status shape per the
|
|
29221
|
-
* convention.
|
|
29222
|
-
*/
|
|
29223
|
-
var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
|
|
29224
|
-
var navigationCapability = {
|
|
29225
|
-
name: "navigation",
|
|
29226
|
-
scope: "device",
|
|
29227
|
-
deviceNative: true,
|
|
29228
|
-
mode: "singleton",
|
|
29229
|
-
deviceTypes: [DeviceType.Camera],
|
|
29230
|
-
deviceConfig: { ui: {
|
|
29231
|
-
kind: "widget",
|
|
29232
|
-
widgetId: "host/navigation-panel",
|
|
29233
|
-
tab: "navigation",
|
|
29234
|
-
topTab: true,
|
|
29235
|
-
label: "Navigation",
|
|
29236
|
-
order: 0
|
|
29237
|
-
} },
|
|
29238
|
-
methods: {
|
|
29239
|
-
/**
|
|
29240
|
-
* Momentary drive nudge (the robot moves). `protected` — mirrors
|
|
29241
|
-
* `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
|
|
29242
|
-
* path) works for any authenticated user, not admin-only. The UI sends
|
|
29243
|
-
* these at ~1 Hz while a control is held; the provider forwards each one to
|
|
29244
|
-
* a single drive write WITHOUT debouncing.
|
|
29245
|
-
*/
|
|
29246
|
-
move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29247
|
-
/** Halt all motion immediately (zero drive vector). */
|
|
29248
|
-
stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29249
|
-
/** Send the robot to a point on its live map. */
|
|
29250
|
-
goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
|
|
29251
|
-
/**
|
|
29252
|
-
* Enumerate the discrete controls THIS device supports (data-driven UI +
|
|
29253
|
-
* PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
|
|
29254
|
-
*/
|
|
29255
|
-
listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
|
|
29256
|
-
/**
|
|
29257
|
-
* Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
|
|
29258
|
-
* unsupported action ids are rejected by the provider.
|
|
29259
|
-
*/
|
|
29260
|
-
runAction: method(object({
|
|
29261
|
-
deviceId: number(),
|
|
29262
|
-
actionId: NavigationActionIdSchema
|
|
29263
|
-
}), _void(), { kind: "mutation" }),
|
|
29264
|
-
/** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
|
|
29265
|
-
playSound: method(object({
|
|
29266
|
-
deviceId: number(),
|
|
29267
|
-
soundId: number().int()
|
|
29268
|
-
}), _void(), { kind: "mutation" }),
|
|
29269
|
-
/**
|
|
29270
|
-
* Turn the on-camera fill light on / off (the `OpenFullLight` control —
|
|
29271
|
-
* works anytime, no active stream required).
|
|
29272
|
-
*/
|
|
29273
|
-
setLightOn: method(object({
|
|
29274
|
-
deviceId: number(),
|
|
29275
|
-
on: boolean()
|
|
29276
|
-
}), _void(), { kind: "mutation" }),
|
|
29277
|
-
/**
|
|
29278
|
-
* Set the fill-light mode (auto vs manual). `manual` optionally carries the
|
|
29279
|
-
* initial `level`. The auto/manual + level control is a CAMERA-service
|
|
29280
|
-
* action that generally needs an active camera stream/monitor session — the
|
|
29281
|
-
* UI shows the manual level slider ONLY when `mode === 'manual'`.
|
|
29282
|
-
*/
|
|
29283
|
-
setLightMode: method(object({
|
|
29284
|
-
deviceId: number(),
|
|
29285
|
-
mode: NavigationLightModeSchema,
|
|
29286
|
-
level: number().min(40).max(100).optional()
|
|
29287
|
-
}), _void(), { kind: "mutation" }),
|
|
29288
|
-
/** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
|
|
29289
|
-
setLightLevel: method(object({
|
|
29290
|
-
deviceId: number(),
|
|
29291
|
-
level: number().min(40).max(100)
|
|
29292
|
-
}), _void(), { kind: "mutation" }),
|
|
29293
|
-
/**
|
|
29294
|
-
* Per-device FEATURE-FLAG report for the general primitives — drives which
|
|
29295
|
-
* controls the UI shows (the per-entry flags for the dictionary come back on
|
|
29296
|
-
* `listActions`).
|
|
29297
|
-
*/
|
|
29298
|
-
getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
|
|
29299
|
-
},
|
|
29300
|
-
events: { onStatusChanged: { data: object({
|
|
29301
|
-
deviceId: number(),
|
|
29302
|
-
status: NavigationStatusSchema
|
|
29303
|
-
}) } },
|
|
29304
|
-
status: {
|
|
29305
|
-
schema: NavigationStatusSchema,
|
|
29306
|
-
kind: "push"
|
|
29307
|
-
},
|
|
29308
|
-
/**
|
|
29309
|
-
* Runtime-state slice mirrored by the kernel. The navigation panel watches it
|
|
29310
|
-
* for live mode / follow / flash changes.
|
|
29311
|
-
*/
|
|
29312
|
-
runtimeState: NavigationRuntimeStateSchema,
|
|
29313
|
-
/**
|
|
29314
|
-
* Runtime-state durability: **session** — like `vacuum-control`, a restored
|
|
29315
|
-
* `mode: cleaning` / `following: true` is a robot that is not actually doing
|
|
29316
|
-
* that. The live handle re-publishes on connect.
|
|
29317
|
-
*
|
|
29318
|
-
* See `RuntimeStateDurability`. Enforced by
|
|
29319
|
-
* `scripts/check-runtime-state-durability.ts`.
|
|
29320
|
-
*/
|
|
29321
|
-
durability: "session"
|
|
29322
|
-
};
|
|
29323
29463
|
DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
|
|
29324
29464
|
kind: "mutation",
|
|
29325
29465
|
auth: "admin"
|
|
@@ -38782,6 +38922,12 @@ Object.freeze({
|
|
|
38782
38922
|
addonId: null,
|
|
38783
38923
|
access: "view"
|
|
38784
38924
|
},
|
|
38925
|
+
"storage.listDrainProgress": {
|
|
38926
|
+
capName: "storage",
|
|
38927
|
+
capScope: "system",
|
|
38928
|
+
addonId: null,
|
|
38929
|
+
access: "view"
|
|
38930
|
+
},
|
|
38785
38931
|
"storage.listLocationDeclarations": {
|
|
38786
38932
|
capName: "storage",
|
|
38787
38933
|
capScope: "system",
|
|
@@ -38926,6 +39072,12 @@ Object.freeze({
|
|
|
38926
39072
|
addonId: null,
|
|
38927
39073
|
access: "view"
|
|
38928
39074
|
},
|
|
39075
|
+
"storageOccupancy.getOccupancy": {
|
|
39076
|
+
capName: "storage-occupancy",
|
|
39077
|
+
capScope: "system",
|
|
39078
|
+
addonId: null,
|
|
39079
|
+
access: "view"
|
|
39080
|
+
},
|
|
38929
39081
|
"storageProvider.abortUpload": {
|
|
38930
39082
|
capName: "storage-provider",
|
|
38931
39083
|
capScope: "system",
|