@camstack/types 1.2.162 → 1.2.164

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 (38) hide show
  1. package/dist/addon.js +4 -3
  2. package/dist/addon.mjs +4 -3
  3. package/dist/capabilities/alerts.cap.d.ts +5 -5
  4. package/dist/capabilities/index.d.ts +7 -5
  5. package/dist/capabilities/motion.cap.d.ts +2 -0
  6. package/dist/capabilities/notifier.cap.d.ts +3 -3
  7. package/dist/capabilities/pet-feeder.cap.d.ts +4 -4
  8. package/dist/capabilities/pipeline-runner.cap.d.ts +19 -0
  9. package/dist/capabilities/snapshot.cap.d.ts +2 -2
  10. package/dist/capabilities/storage-occupancy.cap.d.ts +72 -0
  11. package/dist/capabilities/storage-provider.cap.d.ts +110 -0
  12. package/dist/capabilities/storage.cap.d.ts +43 -0
  13. package/dist/capabilities/stream-broker.cap.d.ts +1 -1
  14. package/dist/device/device-profile.d.ts +1 -1
  15. package/dist/enums/event-category.d.ts +13 -0
  16. package/dist/enums.js +1 -1
  17. package/dist/enums.mjs +1 -1
  18. package/dist/{event-category-b8kBSOTT.js → event-category-BVo6ta6_.js} +13 -0
  19. package/dist/{event-category-zAv7pMUz.mjs → event-category-CnLqLOKs.mjs} +13 -0
  20. package/dist/generated/addon-api.d.ts +22 -0
  21. package/dist/generated/capability-router-map.d.ts +5 -2
  22. package/dist/generated/collection-array-methods.d.ts +1 -1
  23. package/dist/generated/method-access-map.d.ts +1 -1
  24. package/dist/generated/system-proxy.d.ts +1 -1
  25. package/dist/index.d.ts +4 -2
  26. package/dist/index.js +914 -561
  27. package/dist/index.mjs +895 -562
  28. package/dist/interfaces/event-bus.d.ts +23 -2
  29. package/dist/interfaces/storage-location-mode.d.ts +135 -0
  30. package/dist/interfaces/storage-location.d.ts +54 -6
  31. package/dist/interfaces/stream-broker.d.ts +15 -0
  32. package/dist/node.d.ts +13 -11
  33. package/dist/node.js +935 -876
  34. package/dist/node.mjs +936 -879
  35. package/dist/{sleep-DDIFZGbc.js → sleep-BZtO-eFY.js} +1 -1
  36. package/dist/{sleep-Cfij6Jj9.mjs → sleep-Bd-Y4RUt.mjs} +1 -1
  37. package/dist/storage/physical-root.d.ts +25 -0
  38. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_event_category = require("./event-category-b8kBSOTT.js");
3
- const require_sleep = require("./sleep-DDIFZGbc.js");
2
+ const require_event_category = require("./event-category-BVo6ta6_.js");
3
+ const require_sleep = require("./sleep-BZtO-eFY.js");
4
4
  const require_canonical_hash = require("./canonical-hash-DNV8S5ET.js");
5
5
  const require_enums = require("./enums.js");
6
6
  const require_err_msg = require("./err-msg-COpsHMw2.js");
@@ -2643,6 +2643,158 @@ var RECOGNITION_TYPES = [
2643
2643
  "custom"
2644
2644
  ];
2645
2645
  //#endregion
2646
+ //#region src/interfaces/storage-location-mode.ts
2647
+ /**
2648
+ * The storage-location STATE MODEL (D385) — one typed state, one policy module.
2649
+ *
2650
+ * A location's state used to be split across two authorities: the typed
2651
+ * `enabled` field (THE write switch since D383) and an untyped `config.readOnly`
2652
+ * key. They did not mean the same thing — `enabled: false` was still evicted
2653
+ * under disk pressure while `config.readOnly` was deliberately excluded — and
2654
+ * neither name said which. Every consumer re-derived the difference, and the
2655
+ * three questions that actually matter were answered in six places.
2656
+ *
2657
+ * This module is the ONLY place in the repo allowed to interpret the state. It
2658
+ * answers three questions and nothing else:
2659
+ *
2660
+ * - may this location be WRITTEN to? {@link modeMayWrite}
2661
+ * - may this location be READ? {@link modeMayRead}
2662
+ * - what is its eviction policy? {@link evictionPolicyForMode}
2663
+ *
2664
+ * | mode | write | read | eviction |
2665
+ * | ---------- | ----- | ---- | ------------------------------ |
2666
+ * | `active` | yes | yes | `normal` (pressure + usage cap) |
2667
+ * | `readonly` | no | yes | `never` |
2668
+ * | `drain` | no | yes | `drain` (paced, until empty) |
2669
+ * | `disabled` | no | no | `never` |
2670
+ *
2671
+ * `scripts/check-storage-location-mode-single-owner.ts` fails the build when
2672
+ * anything outside this module reads `config['readOnly']` or compares `enabled`
2673
+ * directly. A rule nothing checks has already been broken somewhere.
2674
+ */
2675
+ var STORAGE_LOCATION_MODES = [
2676
+ "active",
2677
+ "readonly",
2678
+ "drain",
2679
+ "disabled"
2680
+ ];
2681
+ /**
2682
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
2683
+ * alias below is `z.infer<>` of it, never a second spelling.
2684
+ */
2685
+ var StorageLocationModeSchema = zod.z.enum(STORAGE_LOCATION_MODES);
2686
+ /**
2687
+ * What disk-pressure and usage-cap relief may do to a location.
2688
+ *
2689
+ * - `normal` — the existing behaviour: free-percent guard plus `maxUsedGb`.
2690
+ * - `never` — excluded entirely. A retiring disk the operator is copying off
2691
+ * must not race the relocate mover, and a disabled one is not the
2692
+ * system's to erase.
2693
+ * - `drain` — a monotonically descending effective usage cap, paced to what
2694
+ * the ACTIVE locations of the same class gained (D386). This is
2695
+ * the only policy that shrinks a location the system is not
2696
+ * writing to.
2697
+ */
2698
+ var StorageEvictionPolicySchema = zod.z.enum([
2699
+ "normal",
2700
+ "never",
2701
+ "drain"
2702
+ ]);
2703
+ /**
2704
+ * The legacy untyped drain key. Named ONCE, here, so the guard has exactly one
2705
+ * sanctioned reader and the string never appears anywhere else.
2706
+ */
2707
+ var LEGACY_READ_ONLY_CONFIG_KEY = "readOnly";
2708
+ /** Is this mode a write target? Only `active` is. */
2709
+ function modeMayWrite(mode) {
2710
+ return mode === "active";
2711
+ }
2712
+ /** May this mode be read (playback, timeline, scrub, relocate source)? */
2713
+ function modeMayRead(mode) {
2714
+ return mode !== "disabled";
2715
+ }
2716
+ /** What eviction may do here. See {@link StorageEvictionPolicy}. */
2717
+ function evictionPolicyForMode(mode) {
2718
+ switch (mode) {
2719
+ case "active": return "normal";
2720
+ case "drain": return "drain";
2721
+ case "readonly":
2722
+ case "disabled": return "never";
2723
+ }
2724
+ }
2725
+ /**
2726
+ * The mode a LEGACY row implies, or `null` when it implies nothing — the row is
2727
+ * already stamped, or it carried neither flag.
2728
+ *
2729
+ * Both legacy flags fold to `readonly`, which is the CONSERVATIVE direction: a
2730
+ * state change must never start deleting footage on its own, and it must never
2731
+ * make footage that was still being served disappear. `enabled: false` used to
2732
+ * leave the location evictable under pressure; folding it to `readonly` stops
2733
+ * that, which is a strictly safer answer than the one it replaces.
2734
+ */
2735
+ function legacyModeOf(location) {
2736
+ if (location.mode !== void 0) return null;
2737
+ if (location.config["readOnly"] === true) return "readonly";
2738
+ if (location.enabled === false) return "readonly";
2739
+ return null;
2740
+ }
2741
+ /**
2742
+ * The state of a location, stamped or folded. THE one interpretation: a row
2743
+ * that predates D385 is never ambiguous, and a stamped `mode` always wins over
2744
+ * whatever the legacy pair still says.
2745
+ */
2746
+ function resolveLocationMode(location) {
2747
+ return (isStorageLocationMode(location.mode) ? location.mode : void 0) ?? legacyModeOf(location) ?? "active";
2748
+ }
2749
+ /** Is this one of the four states? The stamped value crosses a wire, and a
2750
+ * value nobody defined must not be rendered as if it were a state. */
2751
+ function isStorageLocationMode(value) {
2752
+ return STORAGE_LOCATION_MODES.some((mode) => mode === value);
2753
+ }
2754
+ /** May this location be written to? */
2755
+ function mayWriteToLocation(location) {
2756
+ return modeMayWrite(resolveLocationMode(location));
2757
+ }
2758
+ /** May this location be read? A `disabled` one may not — and that is an
2759
+ * operator CHOICE, which callers must report as unavailable rather than as an
2760
+ * unknown-location fault. */
2761
+ function mayReadLocation(location) {
2762
+ return modeMayRead(resolveLocationMode(location));
2763
+ }
2764
+ /** What eviction may do to this location. */
2765
+ function evictionPolicyOfLocation(location) {
2766
+ return evictionPolicyForMode(resolveLocationMode(location));
2767
+ }
2768
+ /**
2769
+ * The config blob with the retired drain key removed. Returns the SAME object
2770
+ * when there was nothing to strip, so a caller can tell "changed" from
2771
+ * "unchanged" by identity and skip a pointless persist.
2772
+ */
2773
+ function strippedOfLegacyReadOnly(config) {
2774
+ if (!("readOnly" in config)) return config;
2775
+ const next = { ...config };
2776
+ delete next[LEGACY_READ_ONLY_CONFIG_KEY];
2777
+ return next;
2778
+ }
2779
+ /**
2780
+ * Set a location's mode, and with it everything that must agree with it.
2781
+ *
2782
+ * `enabled` stays readable for one release as a DERIVED value (`mode ===
2783
+ * 'active'`) so consumers that have not moved yet keep working, and the legacy
2784
+ * `config.readOnly` key is DELETED. This function is the only way to write
2785
+ * either, which is what makes it impossible for the two to disagree.
2786
+ *
2787
+ * Returns a new object — the input is never mutated.
2788
+ */
2789
+ function withLocationMode(location, mode) {
2790
+ return {
2791
+ ...location,
2792
+ mode,
2793
+ enabled: modeMayWrite(mode),
2794
+ config: strippedOfLegacyReadOnly(location.config)
2795
+ };
2796
+ }
2797
+ //#endregion
2646
2798
  //#region src/interfaces/storage-location.ts
2647
2799
  /**
2648
2800
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -2710,6 +2862,21 @@ var StorageLocationSchema = zod.z.object({
2710
2862
  * stops existing rather than being re-derived on every read.
2711
2863
  */
2712
2864
  enabled: zod.z.boolean().optional(),
2865
+ /**
2866
+ * THE state of this location (D385), and the only authority on what may be
2867
+ * written, read or evicted here. Interpreted in exactly one place —
2868
+ * `storage-location-mode.ts` — which also folds the legacy
2869
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
2870
+ * ambiguous.
2871
+ *
2872
+ * OPTIONAL only for the wire and for rows written before D385: absence is
2873
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
2874
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
2875
+ * re-derived on every read. `enabled` survives one release as a DERIVED
2876
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
2877
+ * either, so the two cannot disagree.
2878
+ */
2879
+ mode: StorageLocationModeSchema.optional(),
2713
2880
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
2714
2881
  * for node-local locations it can reach) — never persisted, absent when the
2715
2882
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -2717,6 +2884,25 @@ var StorageLocationSchema = zod.z.object({
2717
2884
  totalBytes: zod.z.number(),
2718
2885
  availableBytes: zod.z.number()
2719
2886
  }).nullable().optional(),
2887
+ /**
2888
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
2889
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
2890
+ * never persisted, never a filesystem walk.
2891
+ *
2892
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
2893
+ * location yet — nobody stores here, the owning addon is down, or the first
2894
+ * refresh has not completed. A UI must omit the segment rather than draw it
2895
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
2896
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
2897
+ * be spelled out loud instead of appearing by accident.
2898
+ *
2899
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
2900
+ * about the whole figure rather than about its freshest part.
2901
+ */
2902
+ owned: zod.z.object({
2903
+ bytes: zod.z.number().int().nonnegative(),
2904
+ measuredAtMs: zod.z.number().int().nonnegative()
2905
+ }).optional(),
2720
2906
  createdAt: zod.z.number(),
2721
2907
  updatedAt: zod.z.number()
2722
2908
  });
@@ -2732,16 +2918,45 @@ var StorageLocationSchema = zod.z.object({
2732
2918
  * the repo may read it; `scripts/check-no-storage-default.ts` enforces that.
2733
2919
  */
2734
2920
  var LegacyStorageLocationDefaultSchema = zod.z.object({ isDefault: zod.z.boolean().optional() });
2921
+ function isLocationEnabled(location) {
2922
+ return mayWriteToLocation({
2923
+ ...location,
2924
+ config: location.config ?? {}
2925
+ });
2926
+ }
2735
2927
  /**
2736
- * Is this location a write target? THE one place that decides what an absent
2737
- * `enabled` means on a persisted row — legacy rows predate the flag and were
2738
- * active, so absence is enabled. Every consumer asks here rather than spelling
2739
- * `enabled !== false` again, so the tri-state has exactly one interpretation.
2928
+ * Bytes in one GB, for every storage figure an operator types.
2929
+ *
2930
+ * BINARY (1024³), everywhere. The repo had both: the orchestrator's
2931
+ * `maxUsedGb` → bytes conversion used 1024³ while the recorder's placement
2932
+ * headroom used 10⁹ for the SAME stored key, so a location with a cap set was
2933
+ * silently 7.4% off depending on which side of the pipe asked. The persisted
2934
+ * values were entered against the binary unit and the admin UI reads it, so
2935
+ * that is the one that stays. Every GB knob — `maxUsedGb`, `minFreeGb` —
2936
+ * converts through {@link gbToBytes} and nowhere else.
2740
2937
  */
2741
- function isLocationEnabled(location) {
2742
- return location.enabled !== false;
2938
+ var STORAGE_BYTES_PER_GB = 1024 ** 3;
2939
+ /** GB → bytes, binary. Fractional GB is admitted and floored. */
2940
+ function gbToBytes(gb) {
2941
+ return Math.floor(gb * STORAGE_BYTES_PER_GB);
2743
2942
  }
2744
2943
  /**
2944
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
2945
+ *
2946
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
2947
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
2948
+ * drain with no observed growth has no honest ETA, and inventing one is how an
2949
+ * operator learns not to believe the screen.
2950
+ */
2951
+ var StorageDrainProgressSchema = zod.z.object({
2952
+ locationId: zod.z.string(),
2953
+ startedAtMs: zod.z.number(),
2954
+ startBytes: zod.z.number(),
2955
+ bytesRemaining: zod.z.number(),
2956
+ drained: zod.z.boolean(),
2957
+ estimatedEmptyAtMs: zod.z.number().nullable()
2958
+ });
2959
+ /**
2745
2960
  * Reference accepted by consumer-facing `api.storage.*` calls.
2746
2961
  * Either:
2747
2962
  * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
@@ -20724,8 +20939,25 @@ var occupancyRecheckFramesField = {
20724
20939
  * (analyzer attaches detected `regions[]`; onboard does not — the
20725
20940
  * camera typically only reports a binary signal plus an optional
20726
20941
  * channel/AI class which lives in dedicated event channels).
20727
- */
20728
- var MotionSourceEnum = zod.z.enum(["onboard", "analyzer"]);
20942
+ *
20943
+ * - `onboard` — the camera's firmware said something moved.
20944
+ * - `analyzer` — this runner's frame-diff said so, and attaches `regions[]`.
20945
+ * - `device-activity` — the DEVICE said it is doing its job: the
20946
+ * `recording-signal` LEVEL the same device raises for the recorder
20947
+ * ([D380](../../../../docs/decisions/adr-0380-a-device-decided-recording-is-a-mode-with-no-schedule-seeded-once.md)),
20948
+ * republished as a motion source. It attaches **nothing** — no regions, no
20949
+ * class: the only fact it carries is that the device is active, and a robot
20950
+ * vacuum that is itself the moving object has no region worth sending. It is
20951
+ * a LEVEL, so unlike `onboard` it has a real falling edge, and unlike
20952
+ * `analyzer` it must not open the frame-diff side-channel — the runner's
20953
+ * `handleOnboardMotionAnalyzer` gate is `source === 'onboard'` and stays that
20954
+ * way ([D392](../../../../docs/decisions/adr-0392-a-device-that-says-it-is-working-is-a-motion-source-of-its-own.md)).
20955
+ */
20956
+ var MotionSourceEnum = zod.z.enum([
20957
+ "onboard",
20958
+ "analyzer",
20959
+ "device-activity"
20960
+ ]);
20729
20961
  /**
20730
20962
  * List of motion sources active on a camera. Empty array is valid:
20731
20963
  * "no source" — happens for battery cams without firmware motion when
@@ -20989,13 +21221,20 @@ var RunnerCameraDeviceUIFields = [
20989
21221
  type: "multiselect",
20990
21222
  label: "Motion Sources",
20991
21223
  default: ["analyzer"],
20992
- options: [{
20993
- value: "analyzer",
20994
- label: "Frame-diff Analyzer (motion addon)"
20995
- }, {
20996
- value: "onboard",
20997
- label: "Camera Onboard Sensor"
20998
- }]
21224
+ options: [
21225
+ {
21226
+ value: "analyzer",
21227
+ label: "Frame-diff Analyzer (motion addon)"
21228
+ },
21229
+ {
21230
+ value: "onboard",
21231
+ label: "Camera Onboard Sensor"
21232
+ },
21233
+ {
21234
+ value: "device-activity",
21235
+ label: "Device activity (the device says it is working)"
21236
+ }
21237
+ ]
20999
21238
  },
21000
21239
  {
21001
21240
  key: "motionFps",
@@ -23201,6 +23440,12 @@ var storageCapability = {
23201
23440
  kind: "mutation",
23202
23441
  auth: "admin"
23203
23442
  }),
23443
+ /**
23444
+ * How far each draining location has got (D386). A pure READ of what the
23445
+ * last pressure sweep computed — it starts no work, and a location that is
23446
+ * not draining simply does not appear.
23447
+ */
23448
+ listDrainProgress: require_sleep.method(zod.z.void(), zod.z.array(StorageDrainProgressSchema).readonly()),
23204
23449
  testLocation: require_sleep.method(zod.z.object({ id: zod.z.string() }), zod.z.object({
23205
23450
  ok: zod.z.boolean(),
23206
23451
  error: zod.z.string().optional()
@@ -23353,6 +23598,73 @@ var storageMigrationCapability = {
23353
23598
  }
23354
23599
  };
23355
23600
  //#endregion
23601
+ //#region src/capabilities/storage-occupancy.cap.ts
23602
+ /**
23603
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23604
+ * location (D388).
23605
+ *
23606
+ * ## Why this is not `storage-evictable`
23607
+ *
23608
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23609
+ * not, in two ways that both matter and both bite hardest on the locations an
23610
+ * operator most wants a figure for:
23611
+ *
23612
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23613
+ * and `recordingsLow:default` deliberately share one root and evict as one
23614
+ * oldest-first pool, so both answer with the SAME combined total. As an
23615
+ * occupancy figure that double-counts the disk.
23616
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23617
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23618
+ * is retiring and staring at.
23619
+ *
23620
+ * So this is its own contract with its own quantity, and the quantity is
23621
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23622
+ * would ever be willing to delete it. A provider that can only answer
23623
+ * "evictable" must not register here — a number that silently means different
23624
+ * things per class is worse than no number.
23625
+ *
23626
+ * ## Absence is an answer
23627
+ *
23628
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23629
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23630
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23631
+ * consuming side has to be written out loud instead of appearing by accident.
23632
+ *
23633
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23634
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23635
+ */
23636
+ /** One provider's occupancy answer for one location. */
23637
+ var StorageOccupancyReportSchema = zod.z.object({
23638
+ locationId: zod.z.string(),
23639
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23640
+ * not net of what it is willing to delete. */
23641
+ ownedBytes: zod.z.number().int().nonnegative(),
23642
+ /** When the provider last actually measured this. The orchestrator carries it
23643
+ * through so a UI can say how old the figure is instead of implying "now". */
23644
+ measuredAtMs: zod.z.number().int().nonnegative()
23645
+ });
23646
+ var storageOccupancyCapability = {
23647
+ name: "storage-occupancy",
23648
+ scope: "system",
23649
+ mode: "collection",
23650
+ internal: true,
23651
+ methods: {
23652
+ /**
23653
+ * Occupancy for the given locations, in ONE round trip.
23654
+ *
23655
+ * A provider answers only for the locations it actually holds bytes on and
23656
+ * OMITS the rest — an omitted location is "I hold nothing measurable here",
23657
+ * which the orchestrator merges as a contribution of nothing rather than as
23658
+ * a claim that the location is empty. Only a location no provider reports
23659
+ * at all stays unknown.
23660
+ *
23661
+ * This must be CHEAP and must never walk a filesystem: it is on the admin
23662
+ * UI's `listLocations` path. The owner keeps its own figure fresh (D224) and
23663
+ * answers from what it already has.
23664
+ */
23665
+ getOccupancy: require_sleep.method(zod.z.object({ locationIds: zod.z.array(zod.z.string()).readonly() }), zod.z.array(StorageOccupancyReportSchema).readonly(), { auth: "admin" }) }
23666
+ };
23667
+ //#endregion
23356
23668
  //#region src/capabilities/storage-provider.cap.ts
23357
23669
  var ProviderInfoSchema = zod.z.discriminatedUnion("shouldSaveDiskSpace", [zod.z.object({
23358
23670
  providerId: zod.z.string().min(1),
@@ -25769,125 +26081,6 @@ onStatusChanged: { data: zod.z.object({
25769
26081
  volatileStateFields: ["lastUpdated"]
25770
26082
  };
25771
26083
  //#endregion
25772
- //#region src/capabilities/network-link.cap.ts
25773
- /**
25774
- * How a device reaches the network, and how well.
25775
- *
25776
- * NOT `connectivity`: that cap is an UPSTREAM system's binary view of whether
25777
- * an entity is reachable (a Home Assistant `binary_sensor` with
25778
- * `device_class: connectivity`). This one is the device's OWN link — the
25779
- * medium it is on and the signal it sees — the way `battery` is the device's
25780
- * own charge.
25781
- *
25782
- * `'wifi'`, `'ethernet'` and `'cellular'` are links the firmware actually
25783
- * reported. `'unknown'` is the ABSENCE of an answer — the provider has
25784
- * registered the capability but has not read the link yet (D315: unknown is
25785
- * not empty). Consumers skip it rather than draw a wire or a bar.
25786
- */
25787
- var NETWORK_LINK_TYPES = [
25788
- "wifi",
25789
- "ethernet",
25790
- "cellular",
25791
- "unknown"
25792
- ];
25793
- /**
25794
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
25795
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
25796
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
25797
- * one Home Assistant projection.
25798
- */
25799
- var NetworkLinkStatusSchema = zod.z.object({
25800
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
25801
- type: zod.z.enum(NETWORK_LINK_TYPES),
25802
- /**
25803
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
25804
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
25805
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
25806
- * one whose reading has not landed must not be drawn at 0 %. Consumers
25807
- * SKIP a null rather than coerce it.
25808
- */
25809
- signalPercent: zod.z.number().min(0).max(100).nullable(),
25810
- /** Raw received signal strength in dBm, when the firmware reports one. */
25811
- rssiDbm: zod.z.number().optional(),
25812
- /** Network name of a wireless link, when the firmware reports it. */
25813
- ssid: zod.z.string().optional(),
25814
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
25815
- lastUpdated: zod.z.number()
25816
- });
25817
- /** The slice a provider seeds before its first read: nothing is known yet. */
25818
- var NETWORK_LINK_UNKNOWN = {
25819
- type: "unknown",
25820
- signalPercent: null,
25821
- lastUpdated: 0
25822
- };
25823
- /**
25824
- * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
25825
- * Out-of-range or non-finite input is not a reading: `null`.
25826
- */
25827
- function signalPercentFromBars(bars, maxBars) {
25828
- if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
25829
- if (bars < 0 || bars > maxBars) return null;
25830
- return Math.round(bars / maxBars * 100);
25831
- }
25832
- /**
25833
- * Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
25834
- * below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
25835
- * positive input is not an RSSI: `null`.
25836
- */
25837
- function signalPercentFromRssi(rssiDbm) {
25838
- if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
25839
- return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
25840
- }
25841
- var networkLinkCapability = {
25842
- name: "network-link",
25843
- scope: "device",
25844
- deviceNative: true,
25845
- mode: "singleton",
25846
- deviceTypes: [
25847
- require_sleep.DeviceType.Camera,
25848
- require_sleep.DeviceType.Sensor,
25849
- require_sleep.DeviceType.Button,
25850
- require_sleep.DeviceType.Switch,
25851
- require_sleep.DeviceType.Light,
25852
- require_sleep.DeviceType.Lock,
25853
- require_sleep.DeviceType.Siren
25854
- ],
25855
- methods: {},
25856
- events: {
25857
- /**
25858
- * Emitted whenever the cached status changes (a link switch, a signal
25859
- * reading that moved). Mirrored on the parent chain by the
25860
- * DeviceEventPropagator like `battery.onStatusChanged`.
25861
- */
25862
- onStatusChanged: { data: zod.z.object({
25863
- deviceId: zod.z.number(),
25864
- status: NetworkLinkStatusSchema
25865
- }) } },
25866
- status: {
25867
- schema: NetworkLinkStatusSchema,
25868
- kind: "push",
25869
- empty: NETWORK_LINK_UNKNOWN
25870
- },
25871
- /**
25872
- * Runtime-state slice — every provider stores the same shape under
25873
- * `device.runtimeState['network-link']`, read once by the badge and the
25874
- * Home Assistant projector regardless of the driver.
25875
- */
25876
- runtimeState: NetworkLinkStatusSchema,
25877
- /**
25878
- * Runtime-state durability: **restored** — a link reading is slow to
25879
- * change and a sleeping battery camera may not report for hours; the
25880
- * restored slice is what the badge shows until the next read.
25881
- *
25882
- * See `RuntimeStateDurability`. Enforced by
25883
- * `scripts/check-runtime-state-durability.ts`.
25884
- */
25885
- durability: "restored",
25886
- /** Clock fields: written, but excluded from the compare that decides
25887
- * whether persisting is worth a SQLite commit. */
25888
- volatileStateFields: ["lastUpdated"]
25889
- };
25890
- //#endregion
25891
26084
  //#region src/capabilities/binary.cap.ts
25892
26085
  /**
25893
26086
  * Generic boolean sensor — last-resort fallback when no domain-
@@ -29897,6 +30090,550 @@ var nativeObjectDetectionCapability = {
29897
30090
  volatileStateFields: ["lastFetchedAt"]
29898
30091
  };
29899
30092
  //#endregion
30093
+ //#region src/capabilities/navigation.cap.ts
30094
+ /**
30095
+ * `navigation` — a device-scoped capability that natively expresses the FULL
30096
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
30097
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
30098
+ *
30099
+ * Why a NEW cap rather than overloading `ptz`:
30100
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30101
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30102
+ * The two are different physical models: PTZ is absolute-position + presets,
30103
+ * navigation is momentary drive nudges + discrete robot ACTIONS
30104
+ * (dock / spot-clean / follow-pet / go-to-point / …).
30105
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30106
+ * the reverse:
30107
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
30108
+ * / `getOptions`), and
30109
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30110
+ * robot camera shows up in the existing PTZ control path without every
30111
+ * PTZ provider learning about robots. The mapping lives in the adapter,
30112
+ * not here (see the addon design note):
30113
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30114
+ * ptz.stop() → navigation.stop()
30115
+ * ptz.goHome() → navigation.runAction('goHome')
30116
+ * ptz.getPresets() → navigation.listActions() (id→preset)
30117
+ * ptz.goToPreset(id) → navigation.runAction(id)
30118
+ *
30119
+ * ## Continuous drive
30120
+ *
30121
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30122
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30123
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30124
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30125
+ * coalesce them. The UI owns the cadence.
30126
+ *
30127
+ * ## The action dictionary
30128
+ *
30129
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30130
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30131
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30132
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30133
+ * vendor-specific list. `kind: 'action'` entries are triggered with
30134
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30135
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
30136
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30137
+ *
30138
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30139
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30140
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
30141
+ * every device handle. A future nodedreame publish adds a typed
30142
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30143
+ * provider can then swap the raw calls for the typed methods with no change to
30144
+ * THIS contract.
30145
+ */
30146
+ /**
30147
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30148
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30149
+ * halts it.
30150
+ *
30151
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
30152
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30153
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30154
+ * vector by it (drivers without proportional drive ignore it).
30155
+ *
30156
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30157
+ * axis alone; an all-undefined nudge is a no-op.
30158
+ */
30159
+ var NavigationMoveCommandSchema = zod.z.object({
30160
+ pan: zod.z.number().min(-1).max(1).optional(),
30161
+ tilt: zod.z.number().min(-1).max(1).optional(),
30162
+ speed: zod.z.number().min(0).max(1).optional()
30163
+ });
30164
+ /**
30165
+ * The enumerated discrete actions a navigation-capable robot can perform via
30166
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30167
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
30168
+ * `playSound` (see the `sound` dictionary entries).
30169
+ */
30170
+ var NavigationActionIdSchema = zod.z.enum([
30171
+ "goHome",
30172
+ "locate",
30173
+ "spotClean",
30174
+ "findPet",
30175
+ "personFollow",
30176
+ "stop",
30177
+ "startClean",
30178
+ "pauseClean",
30179
+ "dockWash",
30180
+ "autoEmpty",
30181
+ "flashOn",
30182
+ "flashOff"
30183
+ ]);
30184
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30185
+ var NavigationEntryKindSchema = zod.z.enum(["action", "sound"]);
30186
+ /**
30187
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30188
+ * native panel and the PTZ mimic render as a button.
30189
+ *
30190
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30191
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30192
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
30193
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30194
+ * - `label` — operator-facing English label.
30195
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30196
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30197
+ * PTZ render ONLY enabled entries. Data-driven: the provider
30198
+ * flips it from config, never by editing code.
30199
+ */
30200
+ var NavigationActionEntrySchema = zod.z.object({
30201
+ id: zod.z.string(),
30202
+ kind: NavigationEntryKindSchema,
30203
+ label: zod.z.string(),
30204
+ icon: zod.z.string(),
30205
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30206
+ soundId: zod.z.number().int().optional(),
30207
+ /** Per-device feature flag — render this entry only when true. */
30208
+ enabled: zod.z.boolean()
30209
+ });
30210
+ /**
30211
+ * Canonical dictionary of every navigation control (discrete actions + sounds)
30212
+ * with its default label + icon hint. A provider filters this to the subset a
30213
+ * device supports (and may override a label). Exported so the provider AND the
30214
+ * UI share ONE list instead of re-deriving labels / ids independently.
30215
+ *
30216
+ * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
30217
+ * catalog default is `enabled: true`; a provider overrides per-device from
30218
+ * config (data-driven — enabling / disabling one later is a config change, not a
30219
+ * code change).
30220
+ */
30221
+ var NAVIGATION_ACTION_CATALOG = [
30222
+ {
30223
+ id: "startClean",
30224
+ kind: "action",
30225
+ label: "Start cleaning",
30226
+ icon: "play",
30227
+ enabled: true
30228
+ },
30229
+ {
30230
+ id: "pauseClean",
30231
+ kind: "action",
30232
+ label: "Pause cleaning",
30233
+ icon: "pause",
30234
+ enabled: true
30235
+ },
30236
+ {
30237
+ id: "stop",
30238
+ kind: "action",
30239
+ label: "Stop",
30240
+ icon: "hand",
30241
+ enabled: true
30242
+ },
30243
+ {
30244
+ id: "goHome",
30245
+ kind: "action",
30246
+ label: "Return to dock",
30247
+ icon: "home",
30248
+ enabled: true
30249
+ },
30250
+ {
30251
+ id: "locate",
30252
+ kind: "action",
30253
+ label: "Locate",
30254
+ icon: "bell",
30255
+ enabled: true
30256
+ },
30257
+ {
30258
+ id: "spotClean",
30259
+ kind: "action",
30260
+ label: "Spot clean here",
30261
+ icon: "crosshair",
30262
+ enabled: true
30263
+ },
30264
+ {
30265
+ id: "findPet",
30266
+ kind: "action",
30267
+ label: "Find pet",
30268
+ icon: "paw-print",
30269
+ enabled: true
30270
+ },
30271
+ {
30272
+ id: "personFollow",
30273
+ kind: "action",
30274
+ label: "Follow me",
30275
+ icon: "footprints",
30276
+ enabled: true
30277
+ },
30278
+ {
30279
+ id: "dockWash",
30280
+ kind: "action",
30281
+ label: "Wash mop",
30282
+ icon: "droplets",
30283
+ enabled: true
30284
+ },
30285
+ {
30286
+ id: "autoEmpty",
30287
+ kind: "action",
30288
+ label: "Empty dustbin",
30289
+ icon: "trash-2",
30290
+ enabled: true
30291
+ },
30292
+ {
30293
+ id: "flashOn",
30294
+ kind: "action",
30295
+ label: "Flash on",
30296
+ icon: "flashlight",
30297
+ enabled: true
30298
+ },
30299
+ {
30300
+ id: "flashOff",
30301
+ kind: "action",
30302
+ label: "Flash off",
30303
+ icon: "flashlight-off",
30304
+ enabled: true
30305
+ },
30306
+ {
30307
+ id: "sound:meow",
30308
+ kind: "sound",
30309
+ label: "Meow",
30310
+ icon: "cat",
30311
+ soundId: 684,
30312
+ enabled: true
30313
+ },
30314
+ {
30315
+ id: "sound:bark",
30316
+ kind: "sound",
30317
+ label: "Woof",
30318
+ icon: "dog",
30319
+ soundId: 685,
30320
+ enabled: true
30321
+ },
30322
+ {
30323
+ id: "sound:footsteps",
30324
+ kind: "sound",
30325
+ label: "Footsteps",
30326
+ icon: "footprints",
30327
+ soundId: 686,
30328
+ enabled: true
30329
+ },
30330
+ {
30331
+ id: "sound:purring",
30332
+ kind: "sound",
30333
+ label: "Purring",
30334
+ icon: "cat",
30335
+ soundId: 687,
30336
+ enabled: true
30337
+ },
30338
+ {
30339
+ id: "sound:tickTock",
30340
+ kind: "sound",
30341
+ label: "Tick-tock",
30342
+ icon: "clock",
30343
+ soundId: 688,
30344
+ enabled: true
30345
+ }
30346
+ ];
30347
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
30348
+ var NavigationPointSchema = zod.z.object({
30349
+ x: zod.z.number(),
30350
+ y: zod.z.number()
30351
+ });
30352
+ /**
30353
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30354
+ * The cap reports which are enabled so the UI / PTZ render only the controls
30355
+ * that are turned on for THIS device. Data-driven: the provider derives these
30356
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30357
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30358
+ * that are not dictionary entries.
30359
+ *
30360
+ * - `move` / `stop` — the momentary drive joystick.
30361
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30362
+ * map-coordinate plumbing is wired.
30363
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30364
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30365
+ * - `light` — the on/off fill-light toggle (works anytime).
30366
+ * - `lightMode` — the auto/manual selector + manual level slider (a
30367
+ * camera-service control; needs an active stream).
30368
+ */
30369
+ var NavigationFeaturesSchema = zod.z.object({
30370
+ move: zod.z.boolean(),
30371
+ stop: zod.z.boolean(),
30372
+ goToPoint: zod.z.boolean(),
30373
+ runAction: zod.z.boolean(),
30374
+ playSound: zod.z.boolean(),
30375
+ light: zod.z.boolean(),
30376
+ lightMode: zod.z.boolean()
30377
+ });
30378
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30379
+ var NavigationLightModeSchema = zod.z.enum(["auto", "manual"]);
30380
+ /** Manual fill-light level bounds (the camera-service accepts 40..100). */
30381
+ var NAVIGATION_LIGHT_LEVEL_MIN = 40;
30382
+ var NAVIGATION_LIGHT_LEVEL_MAX = 100;
30383
+ /** Coarse work mode the robot reports — drives the UI's active-state chips. */
30384
+ var NavigationModeSchema = zod.z.enum([
30385
+ "idle",
30386
+ "cleaning",
30387
+ "spot",
30388
+ "following",
30389
+ "goto",
30390
+ "returning",
30391
+ "paused",
30392
+ "unknown"
30393
+ ]);
30394
+ /**
30395
+ * Live navigation state so the UI can reflect what the robot is doing:
30396
+ * - `mode` — coarse activity (idle / cleaning / following / …).
30397
+ * - `following` — person/pet follow is currently armed.
30398
+ * - `flash` — the on-camera fill light is on.
30399
+ * - `lightMode` — auto vs manual fill-light mode.
30400
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
30401
+ * `lightMode === 'manual'`.
30402
+ */
30403
+ var NavigationStatusSchema = zod.z.object({
30404
+ mode: NavigationModeSchema,
30405
+ following: zod.z.boolean(),
30406
+ flash: zod.z.boolean(),
30407
+ lightMode: NavigationLightModeSchema,
30408
+ lightLevel: zod.z.number().min(40).max(100),
30409
+ /** Ms epoch when the slice was last updated. */
30410
+ lastChangedAt: zod.z.number()
30411
+ });
30412
+ /**
30413
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30414
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
30415
+ * convention.
30416
+ */
30417
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: zod.z.number() });
30418
+ var navigationCapability = {
30419
+ name: "navigation",
30420
+ scope: "device",
30421
+ deviceNative: true,
30422
+ mode: "singleton",
30423
+ deviceTypes: [require_sleep.DeviceType.Camera],
30424
+ deviceConfig: { ui: {
30425
+ kind: "widget",
30426
+ widgetId: "host/navigation-panel",
30427
+ tab: "navigation",
30428
+ topTab: true,
30429
+ label: "Navigation",
30430
+ order: 0
30431
+ } },
30432
+ methods: {
30433
+ /**
30434
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
30435
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30436
+ * path) works for any authenticated user, not admin-only. The UI sends
30437
+ * these at ~1 Hz while a control is held; the provider forwards each one to
30438
+ * a single drive write WITHOUT debouncing.
30439
+ */
30440
+ move: require_sleep.method(NavigationMoveCommandSchema.extend({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
30441
+ /** Halt all motion immediately (zero drive vector). */
30442
+ stop: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
30443
+ /** Send the robot to a point on its live map. */
30444
+ goToPoint: require_sleep.method(NavigationPointSchema.extend({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
30445
+ /**
30446
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
30447
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30448
+ */
30449
+ listActions: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.array(NavigationActionEntrySchema)),
30450
+ /**
30451
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30452
+ * unsupported action ids are rejected by the provider.
30453
+ */
30454
+ runAction: require_sleep.method(zod.z.object({
30455
+ deviceId: zod.z.number(),
30456
+ actionId: NavigationActionIdSchema
30457
+ }), zod.z.void(), { kind: "mutation" }),
30458
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30459
+ playSound: require_sleep.method(zod.z.object({
30460
+ deviceId: zod.z.number(),
30461
+ soundId: zod.z.number().int()
30462
+ }), zod.z.void(), { kind: "mutation" }),
30463
+ /**
30464
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30465
+ * works anytime, no active stream required).
30466
+ */
30467
+ setLightOn: require_sleep.method(zod.z.object({
30468
+ deviceId: zod.z.number(),
30469
+ on: zod.z.boolean()
30470
+ }), zod.z.void(), { kind: "mutation" }),
30471
+ /**
30472
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30473
+ * initial `level`. The auto/manual + level control is a CAMERA-service
30474
+ * action that generally needs an active camera stream/monitor session — the
30475
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
30476
+ */
30477
+ setLightMode: require_sleep.method(zod.z.object({
30478
+ deviceId: zod.z.number(),
30479
+ mode: NavigationLightModeSchema,
30480
+ level: zod.z.number().min(40).max(100).optional()
30481
+ }), zod.z.void(), { kind: "mutation" }),
30482
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30483
+ setLightLevel: require_sleep.method(zod.z.object({
30484
+ deviceId: zod.z.number(),
30485
+ level: zod.z.number().min(40).max(100)
30486
+ }), zod.z.void(), { kind: "mutation" }),
30487
+ /**
30488
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
30489
+ * controls the UI shows (the per-entry flags for the dictionary come back on
30490
+ * `listActions`).
30491
+ */
30492
+ getFeatures: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), NavigationFeaturesSchema)
30493
+ },
30494
+ events: { onStatusChanged: { data: zod.z.object({
30495
+ deviceId: zod.z.number(),
30496
+ status: NavigationStatusSchema
30497
+ }) } },
30498
+ status: {
30499
+ schema: NavigationStatusSchema,
30500
+ kind: "push"
30501
+ },
30502
+ /**
30503
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30504
+ * for live mode / follow / flash changes.
30505
+ */
30506
+ runtimeState: NavigationRuntimeStateSchema,
30507
+ /**
30508
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
30509
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
30510
+ * that. The live handle re-publishes on connect.
30511
+ *
30512
+ * See `RuntimeStateDurability`. Enforced by
30513
+ * `scripts/check-runtime-state-durability.ts`.
30514
+ */
30515
+ durability: "session"
30516
+ };
30517
+ //#endregion
30518
+ //#region src/capabilities/network-link.cap.ts
30519
+ /**
30520
+ * How a device reaches the network, and how well.
30521
+ *
30522
+ * NOT `connectivity`: that cap is an UPSTREAM system's binary view of whether
30523
+ * an entity is reachable (a Home Assistant `binary_sensor` with
30524
+ * `device_class: connectivity`). This one is the device's OWN link — the
30525
+ * medium it is on and the signal it sees — the way `battery` is the device's
30526
+ * own charge.
30527
+ *
30528
+ * `'wifi'`, `'ethernet'` and `'cellular'` are links the firmware actually
30529
+ * reported. `'unknown'` is the ABSENCE of an answer — the provider has
30530
+ * registered the capability but has not read the link yet (D315: unknown is
30531
+ * not empty). Consumers skip it rather than draw a wire or a bar.
30532
+ */
30533
+ var NETWORK_LINK_TYPES = [
30534
+ "wifi",
30535
+ "ethernet",
30536
+ "cellular",
30537
+ "unknown"
30538
+ ];
30539
+ /**
30540
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
30541
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
30542
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
30543
+ * one Home Assistant projection.
30544
+ */
30545
+ var NetworkLinkStatusSchema = zod.z.object({
30546
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
30547
+ type: zod.z.enum(NETWORK_LINK_TYPES),
30548
+ /**
30549
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
30550
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
30551
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
30552
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
30553
+ * SKIP a null rather than coerce it.
30554
+ */
30555
+ signalPercent: zod.z.number().min(0).max(100).nullable(),
30556
+ /** Raw received signal strength in dBm, when the firmware reports one. */
30557
+ rssiDbm: zod.z.number().optional(),
30558
+ /** Network name of a wireless link, when the firmware reports it. */
30559
+ ssid: zod.z.string().optional(),
30560
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
30561
+ lastUpdated: zod.z.number()
30562
+ });
30563
+ /** The slice a provider seeds before its first read: nothing is known yet. */
30564
+ var NETWORK_LINK_UNKNOWN = {
30565
+ type: "unknown",
30566
+ signalPercent: null,
30567
+ lastUpdated: 0
30568
+ };
30569
+ /**
30570
+ * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
30571
+ * Out-of-range or non-finite input is not a reading: `null`.
30572
+ */
30573
+ function signalPercentFromBars(bars, maxBars) {
30574
+ if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
30575
+ if (bars < 0 || bars > maxBars) return null;
30576
+ return Math.round(bars / maxBars * 100);
30577
+ }
30578
+ /**
30579
+ * Normalise an RSSI in dBm to 0..100 on the usual wifi scale: -100 dBm and
30580
+ * below is 0 %, -50 dBm and above is 100 %, linear between. Non-finite or
30581
+ * positive input is not an RSSI: `null`.
30582
+ */
30583
+ function signalPercentFromRssi(rssiDbm) {
30584
+ if (rssiDbm === void 0 || !Number.isFinite(rssiDbm) || rssiDbm > 0) return null;
30585
+ return Math.round((Math.min(-50, Math.max(-100, rssiDbm)) + 100) * 2);
30586
+ }
30587
+ var networkLinkCapability = {
30588
+ name: "network-link",
30589
+ scope: "device",
30590
+ deviceNative: true,
30591
+ mode: "singleton",
30592
+ deviceTypes: [
30593
+ require_sleep.DeviceType.Camera,
30594
+ require_sleep.DeviceType.Sensor,
30595
+ require_sleep.DeviceType.Button,
30596
+ require_sleep.DeviceType.Switch,
30597
+ require_sleep.DeviceType.Light,
30598
+ require_sleep.DeviceType.Lock,
30599
+ require_sleep.DeviceType.Siren
30600
+ ],
30601
+ methods: {},
30602
+ events: {
30603
+ /**
30604
+ * Emitted whenever the cached status changes (a link switch, a signal
30605
+ * reading that moved). Mirrored on the parent chain by the
30606
+ * DeviceEventPropagator like `battery.onStatusChanged`.
30607
+ */
30608
+ onStatusChanged: { data: zod.z.object({
30609
+ deviceId: zod.z.number(),
30610
+ status: NetworkLinkStatusSchema
30611
+ }) } },
30612
+ status: {
30613
+ schema: NetworkLinkStatusSchema,
30614
+ kind: "push",
30615
+ empty: NETWORK_LINK_UNKNOWN
30616
+ },
30617
+ /**
30618
+ * Runtime-state slice — every provider stores the same shape under
30619
+ * `device.runtimeState['network-link']`, read once by the badge and the
30620
+ * Home Assistant projector regardless of the driver.
30621
+ */
30622
+ runtimeState: NetworkLinkStatusSchema,
30623
+ /**
30624
+ * Runtime-state durability: **restored** — a link reading is slow to
30625
+ * change and a sleeping battery camera may not report for hours; the
30626
+ * restored slice is what the badge shows until the next read.
30627
+ *
30628
+ * See `RuntimeStateDurability`. Enforced by
30629
+ * `scripts/check-runtime-state-durability.ts`.
30630
+ */
30631
+ durability: "restored",
30632
+ /** Clock fields: written, but excluded from the compare that decides
30633
+ * whether persisting is worth a SQLite commit. */
30634
+ volatileStateFields: ["lastUpdated"]
30635
+ };
30636
+ //#endregion
29900
30637
  //#region src/capabilities/network-quality.cap.ts
29901
30638
  /**
29902
30639
  * network-quality — system-scoped singleton capability tracking RTT,
@@ -31829,431 +32566,6 @@ var ptzAutotrackCapability = {
31829
32566
  durability: "session"
31830
32567
  };
31831
32568
  //#endregion
31832
- //#region src/capabilities/navigation.cap.ts
31833
- /**
31834
- * `navigation` — a device-scoped capability that natively expresses the FULL
31835
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
31836
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
31837
- *
31838
- * Why a NEW cap rather than overloading `ptz`:
31839
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
31840
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
31841
- * The two are different physical models: PTZ is absolute-position + presets,
31842
- * navigation is momentary drive nudges + discrete robot ACTIONS
31843
- * (dock / spot-clean / follow-pet / go-to-point / …).
31844
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
31845
- * the reverse:
31846
- * 1. a native CamStack navigation panel (data-driven from `listActions`
31847
- * / `getOptions`), and
31848
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
31849
- * robot camera shows up in the existing PTZ control path without every
31850
- * PTZ provider learning about robots. The mapping lives in the adapter,
31851
- * not here (see the addon design note):
31852
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
31853
- * ptz.stop() → navigation.stop()
31854
- * ptz.goHome() → navigation.runAction('goHome')
31855
- * ptz.getPresets() → navigation.listActions() (id→preset)
31856
- * ptz.goToPreset(id) → navigation.runAction(id)
31857
- *
31858
- * ## Continuous drive
31859
- *
31860
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
31861
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
31862
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
31863
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
31864
- * coalesce them. The UI owns the cadence.
31865
- *
31866
- * ## The action dictionary
31867
- *
31868
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
31869
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
31870
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
31871
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
31872
- * vendor-specific list. `kind: 'action'` entries are triggered with
31873
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
31874
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
31875
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
31876
- *
31877
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
31878
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
31879
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
31880
- * every device handle. A future nodedreame publish adds a typed
31881
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
31882
- * provider can then swap the raw calls for the typed methods with no change to
31883
- * THIS contract.
31884
- */
31885
- /**
31886
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
31887
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
31888
- * halts it.
31889
- *
31890
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
31891
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
31892
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
31893
- * vector by it (drivers without proportional drive ignore it).
31894
- *
31895
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
31896
- * axis alone; an all-undefined nudge is a no-op.
31897
- */
31898
- var NavigationMoveCommandSchema = zod.z.object({
31899
- pan: zod.z.number().min(-1).max(1).optional(),
31900
- tilt: zod.z.number().min(-1).max(1).optional(),
31901
- speed: zod.z.number().min(0).max(1).optional()
31902
- });
31903
- /**
31904
- * The enumerated discrete actions a navigation-capable robot can perform via
31905
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
31906
- * subset it supports through `listActions`. Sounds are NOT here — they go through
31907
- * `playSound` (see the `sound` dictionary entries).
31908
- */
31909
- var NavigationActionIdSchema = zod.z.enum([
31910
- "goHome",
31911
- "locate",
31912
- "spotClean",
31913
- "findPet",
31914
- "personFollow",
31915
- "stop",
31916
- "startClean",
31917
- "pauseClean",
31918
- "dockWash",
31919
- "autoEmpty",
31920
- "flashOn",
31921
- "flashOff"
31922
- ]);
31923
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
31924
- var NavigationEntryKindSchema = zod.z.enum(["action", "sound"]);
31925
- /**
31926
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
31927
- * native panel and the PTZ mimic render as a button.
31928
- *
31929
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
31930
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
31931
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
31932
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
31933
- * - `label` — operator-facing English label.
31934
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
31935
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
31936
- * PTZ render ONLY enabled entries. Data-driven: the provider
31937
- * flips it from config, never by editing code.
31938
- */
31939
- var NavigationActionEntrySchema = zod.z.object({
31940
- id: zod.z.string(),
31941
- kind: NavigationEntryKindSchema,
31942
- label: zod.z.string(),
31943
- icon: zod.z.string(),
31944
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
31945
- soundId: zod.z.number().int().optional(),
31946
- /** Per-device feature flag — render this entry only when true. */
31947
- enabled: zod.z.boolean()
31948
- });
31949
- /**
31950
- * Canonical dictionary of every navigation control (discrete actions + sounds)
31951
- * with its default label + icon hint. A provider filters this to the subset a
31952
- * device supports (and may override a label). Exported so the provider AND the
31953
- * UI share ONE list instead of re-deriving labels / ids independently.
31954
- *
31955
- * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
31956
- * catalog default is `enabled: true`; a provider overrides per-device from
31957
- * config (data-driven — enabling / disabling one later is a config change, not a
31958
- * code change).
31959
- */
31960
- var NAVIGATION_ACTION_CATALOG = [
31961
- {
31962
- id: "startClean",
31963
- kind: "action",
31964
- label: "Start cleaning",
31965
- icon: "play",
31966
- enabled: true
31967
- },
31968
- {
31969
- id: "pauseClean",
31970
- kind: "action",
31971
- label: "Pause cleaning",
31972
- icon: "pause",
31973
- enabled: true
31974
- },
31975
- {
31976
- id: "stop",
31977
- kind: "action",
31978
- label: "Stop",
31979
- icon: "hand",
31980
- enabled: true
31981
- },
31982
- {
31983
- id: "goHome",
31984
- kind: "action",
31985
- label: "Return to dock",
31986
- icon: "home",
31987
- enabled: true
31988
- },
31989
- {
31990
- id: "locate",
31991
- kind: "action",
31992
- label: "Locate",
31993
- icon: "bell",
31994
- enabled: true
31995
- },
31996
- {
31997
- id: "spotClean",
31998
- kind: "action",
31999
- label: "Spot clean here",
32000
- icon: "crosshair",
32001
- enabled: true
32002
- },
32003
- {
32004
- id: "findPet",
32005
- kind: "action",
32006
- label: "Find pet",
32007
- icon: "paw-print",
32008
- enabled: true
32009
- },
32010
- {
32011
- id: "personFollow",
32012
- kind: "action",
32013
- label: "Follow me",
32014
- icon: "footprints",
32015
- enabled: true
32016
- },
32017
- {
32018
- id: "dockWash",
32019
- kind: "action",
32020
- label: "Wash mop",
32021
- icon: "droplets",
32022
- enabled: true
32023
- },
32024
- {
32025
- id: "autoEmpty",
32026
- kind: "action",
32027
- label: "Empty dustbin",
32028
- icon: "trash-2",
32029
- enabled: true
32030
- },
32031
- {
32032
- id: "flashOn",
32033
- kind: "action",
32034
- label: "Flash on",
32035
- icon: "flashlight",
32036
- enabled: true
32037
- },
32038
- {
32039
- id: "flashOff",
32040
- kind: "action",
32041
- label: "Flash off",
32042
- icon: "flashlight-off",
32043
- enabled: true
32044
- },
32045
- {
32046
- id: "sound:meow",
32047
- kind: "sound",
32048
- label: "Meow",
32049
- icon: "cat",
32050
- soundId: 684,
32051
- enabled: true
32052
- },
32053
- {
32054
- id: "sound:bark",
32055
- kind: "sound",
32056
- label: "Woof",
32057
- icon: "dog",
32058
- soundId: 685,
32059
- enabled: true
32060
- },
32061
- {
32062
- id: "sound:footsteps",
32063
- kind: "sound",
32064
- label: "Footsteps",
32065
- icon: "footprints",
32066
- soundId: 686,
32067
- enabled: true
32068
- },
32069
- {
32070
- id: "sound:purring",
32071
- kind: "sound",
32072
- label: "Purring",
32073
- icon: "cat",
32074
- soundId: 687,
32075
- enabled: true
32076
- },
32077
- {
32078
- id: "sound:tickTock",
32079
- kind: "sound",
32080
- label: "Tick-tock",
32081
- icon: "clock",
32082
- soundId: 688,
32083
- enabled: true
32084
- }
32085
- ];
32086
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
32087
- var NavigationPointSchema = zod.z.object({
32088
- x: zod.z.number(),
32089
- y: zod.z.number()
32090
- });
32091
- /**
32092
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
32093
- * The cap reports which are enabled so the UI / PTZ render only the controls
32094
- * that are turned on for THIS device. Data-driven: the provider derives these
32095
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
32096
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
32097
- * that are not dictionary entries.
32098
- *
32099
- * - `move` / `stop` — the momentary drive joystick.
32100
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
32101
- * map-coordinate plumbing is wired.
32102
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
32103
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
32104
- * - `light` — the on/off fill-light toggle (works anytime).
32105
- * - `lightMode` — the auto/manual selector + manual level slider (a
32106
- * camera-service control; needs an active stream).
32107
- */
32108
- var NavigationFeaturesSchema = zod.z.object({
32109
- move: zod.z.boolean(),
32110
- stop: zod.z.boolean(),
32111
- goToPoint: zod.z.boolean(),
32112
- runAction: zod.z.boolean(),
32113
- playSound: zod.z.boolean(),
32114
- light: zod.z.boolean(),
32115
- lightMode: zod.z.boolean()
32116
- });
32117
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
32118
- var NavigationLightModeSchema = zod.z.enum(["auto", "manual"]);
32119
- /** Manual fill-light level bounds (the camera-service accepts 40..100). */
32120
- var NAVIGATION_LIGHT_LEVEL_MIN = 40;
32121
- var NAVIGATION_LIGHT_LEVEL_MAX = 100;
32122
- /** Coarse work mode the robot reports — drives the UI's active-state chips. */
32123
- var NavigationModeSchema = zod.z.enum([
32124
- "idle",
32125
- "cleaning",
32126
- "spot",
32127
- "following",
32128
- "goto",
32129
- "returning",
32130
- "paused",
32131
- "unknown"
32132
- ]);
32133
- /**
32134
- * Live navigation state so the UI can reflect what the robot is doing:
32135
- * - `mode` — coarse activity (idle / cleaning / following / …).
32136
- * - `following` — person/pet follow is currently armed.
32137
- * - `flash` — the on-camera fill light is on.
32138
- * - `lightMode` — auto vs manual fill-light mode.
32139
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
32140
- * `lightMode === 'manual'`.
32141
- */
32142
- var NavigationStatusSchema = zod.z.object({
32143
- mode: NavigationModeSchema,
32144
- following: zod.z.boolean(),
32145
- flash: zod.z.boolean(),
32146
- lightMode: NavigationLightModeSchema,
32147
- lightLevel: zod.z.number().min(40).max(100),
32148
- /** Ms epoch when the slice was last updated. */
32149
- lastChangedAt: zod.z.number()
32150
- });
32151
- /**
32152
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
32153
- * observable). Adds `lastFetchedAt` on top of the status shape per the
32154
- * convention.
32155
- */
32156
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: zod.z.number() });
32157
- var navigationCapability = {
32158
- name: "navigation",
32159
- scope: "device",
32160
- deviceNative: true,
32161
- mode: "singleton",
32162
- deviceTypes: [require_sleep.DeviceType.Camera],
32163
- deviceConfig: { ui: {
32164
- kind: "widget",
32165
- widgetId: "host/navigation-panel",
32166
- tab: "navigation",
32167
- topTab: true,
32168
- label: "Navigation",
32169
- order: 0
32170
- } },
32171
- methods: {
32172
- /**
32173
- * Momentary drive nudge (the robot moves). `protected` — mirrors
32174
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
32175
- * path) works for any authenticated user, not admin-only. The UI sends
32176
- * these at ~1 Hz while a control is held; the provider forwards each one to
32177
- * a single drive write WITHOUT debouncing.
32178
- */
32179
- move: require_sleep.method(NavigationMoveCommandSchema.extend({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
32180
- /** Halt all motion immediately (zero drive vector). */
32181
- stop: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
32182
- /** Send the robot to a point on its live map. */
32183
- goToPoint: require_sleep.method(NavigationPointSchema.extend({ deviceId: zod.z.number() }), zod.z.void(), { kind: "mutation" }),
32184
- /**
32185
- * Enumerate the discrete controls THIS device supports (data-driven UI +
32186
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
32187
- */
32188
- listActions: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), zod.z.array(NavigationActionEntrySchema)),
32189
- /**
32190
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
32191
- * unsupported action ids are rejected by the provider.
32192
- */
32193
- runAction: require_sleep.method(zod.z.object({
32194
- deviceId: zod.z.number(),
32195
- actionId: NavigationActionIdSchema
32196
- }), zod.z.void(), { kind: "mutation" }),
32197
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
32198
- playSound: require_sleep.method(zod.z.object({
32199
- deviceId: zod.z.number(),
32200
- soundId: zod.z.number().int()
32201
- }), zod.z.void(), { kind: "mutation" }),
32202
- /**
32203
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
32204
- * works anytime, no active stream required).
32205
- */
32206
- setLightOn: require_sleep.method(zod.z.object({
32207
- deviceId: zod.z.number(),
32208
- on: zod.z.boolean()
32209
- }), zod.z.void(), { kind: "mutation" }),
32210
- /**
32211
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
32212
- * initial `level`. The auto/manual + level control is a CAMERA-service
32213
- * action that generally needs an active camera stream/monitor session — the
32214
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
32215
- */
32216
- setLightMode: require_sleep.method(zod.z.object({
32217
- deviceId: zod.z.number(),
32218
- mode: NavigationLightModeSchema,
32219
- level: zod.z.number().min(40).max(100).optional()
32220
- }), zod.z.void(), { kind: "mutation" }),
32221
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
32222
- setLightLevel: require_sleep.method(zod.z.object({
32223
- deviceId: zod.z.number(),
32224
- level: zod.z.number().min(40).max(100)
32225
- }), zod.z.void(), { kind: "mutation" }),
32226
- /**
32227
- * Per-device FEATURE-FLAG report for the general primitives — drives which
32228
- * controls the UI shows (the per-entry flags for the dictionary come back on
32229
- * `listActions`).
32230
- */
32231
- getFeatures: require_sleep.method(zod.z.object({ deviceId: zod.z.number() }), NavigationFeaturesSchema)
32232
- },
32233
- events: { onStatusChanged: { data: zod.z.object({
32234
- deviceId: zod.z.number(),
32235
- status: NavigationStatusSchema
32236
- }) } },
32237
- status: {
32238
- schema: NavigationStatusSchema,
32239
- kind: "push"
32240
- },
32241
- /**
32242
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
32243
- * for live mode / follow / flash changes.
32244
- */
32245
- runtimeState: NavigationRuntimeStateSchema,
32246
- /**
32247
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
32248
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
32249
- * that. The live handle re-publishes on connect.
32250
- *
32251
- * See `RuntimeStateDurability`. Enforced by
32252
- * `scripts/check-runtime-state-durability.ts`.
32253
- */
32254
- durability: "session"
32255
- };
32256
- //#endregion
32257
32569
  //#region src/capabilities/reboot.cap.ts
32258
32570
  /**
32259
32571
  * reboot — device-scoped capability for "soft" device reboots (firmware
@@ -39914,6 +40226,7 @@ var CAPABILITY_NAMES = {
39914
40226
  storage: "storage",
39915
40227
  storageEvictable: "storage-evictable",
39916
40228
  storageMigration: "storage-migration",
40229
+ storageOccupancy: "storage-occupancy",
39917
40230
  storageProvider: "storage-provider",
39918
40231
  streamBroker: "stream-broker",
39919
40232
  streamCatalog: "stream-catalog",
@@ -40459,6 +40772,10 @@ var CAPABILITY_ROUTER_KEYS = [
40459
40772
  key: "storageMigration",
40460
40773
  name: "storage-migration"
40461
40774
  },
40775
+ {
40776
+ key: "storageOccupancy",
40777
+ name: "storage-occupancy"
40778
+ },
40462
40779
  {
40463
40780
  key: "storageProvider",
40464
40781
  name: "storage-provider"
@@ -40703,6 +41020,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
40703
41020
  storageCapability,
40704
41021
  storageEvictableCapability,
40705
41022
  storageMigrationCapability,
41023
+ storageOccupancyCapability,
40706
41024
  storageProviderCapability,
40707
41025
  streamBrokerCapability,
40708
41026
  streamCatalogCapability,
@@ -45677,6 +45995,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
45677
45995
  addonId: null,
45678
45996
  access: "view"
45679
45997
  },
45998
+ "storage.listDrainProgress": {
45999
+ capName: "storage",
46000
+ capScope: "system",
46001
+ addonId: null,
46002
+ access: "view"
46003
+ },
45680
46004
  "storage.listLocationDeclarations": {
45681
46005
  capName: "storage",
45682
46006
  capScope: "system",
@@ -45821,6 +46145,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
45821
46145
  addonId: null,
45822
46146
  access: "view"
45823
46147
  },
46148
+ "storageOccupancy.getOccupancy": {
46149
+ capName: "storage-occupancy",
46150
+ capScope: "system",
46151
+ addonId: null,
46152
+ access: "view"
46153
+ },
45824
46154
  "storageProvider.abortUpload": {
45825
46155
  capName: "storage-provider",
45826
46156
  capScope: "system",
@@ -46956,6 +47286,7 @@ var KNOWN_CAP_NAMES = [
46956
47286
  "storage",
46957
47287
  "storage-evictable",
46958
47288
  "storage-migration",
47289
+ "storage-occupancy",
46959
47290
  "storage-provider",
46960
47291
  "stream-broker",
46961
47292
  "stream-catalog",
@@ -47102,6 +47433,7 @@ var SYSTEM_CAP_NAMES = [
47102
47433
  "storage",
47103
47434
  "storage-evictable",
47104
47435
  "storage-migration",
47436
+ "storage-occupancy",
47105
47437
  "storage-provider",
47106
47438
  "stream-broker",
47107
47439
  "system",
@@ -50101,6 +50433,7 @@ function createSystemProxy(api) {
50101
50433
  listLocationDeclarations: (input) => dispatch("storage", "listLocationDeclarations", "query", input),
50102
50434
  upsertLocation: (input) => dispatch("storage", "upsertLocation", "mutation", input),
50103
50435
  deleteLocation: (input) => dispatch("storage", "deleteLocation", "mutation", input),
50436
+ listDrainProgress: (input) => dispatch("storage", "listDrainProgress", "query", input),
50104
50437
  testLocation: (input) => dispatch("storage", "testLocation", "query", input),
50105
50438
  listProviders: (input) => dispatch("storage", "listProviders", "query", input),
50106
50439
  testConfig: (input) => dispatch("storage", "testConfig", "query", input)
@@ -54550,6 +54883,7 @@ exports.IntercomAbilitySchema = IntercomAbilitySchema;
54550
54883
  exports.IntercomStatusSchema = IntercomStatusSchema;
54551
54884
  exports.KNOWN_CAP_NAMES = KNOWN_CAP_NAMES;
54552
54885
  exports.KeyEventSchema = KeyEventSchema;
54886
+ exports.LEGACY_READ_ONLY_CONFIG_KEY = LEGACY_READ_ONLY_CONFIG_KEY;
54553
54887
  exports.LOAD_CONTRIBUTION_ATTRIBUTIONS = LOAD_CONTRIBUTION_ATTRIBUTIONS;
54554
54888
  exports.LOAD_CONTRIBUTION_ROLES = LOAD_CONTRIBUTION_ROLES;
54555
54889
  exports.LOG_CHANNEL_TICK_MS = LOG_CHANNEL_TICK_MS;
@@ -55001,6 +55335,8 @@ exports.SOURCE_CAP_CHANGED_AT_FIELD = SOURCE_CAP_CHANGED_AT_FIELD;
55001
55335
  exports.SOURCE_DEVICE_TYPES = SOURCE_DEVICE_TYPES;
55002
55336
  exports.SOURCE_INFO_METADATA_KEY = SOURCE_INFO_METADATA_KEY;
55003
55337
  exports.STORAGE_ACCESS_FALLBACK = STORAGE_ACCESS_FALLBACK;
55338
+ exports.STORAGE_BYTES_PER_GB = STORAGE_BYTES_PER_GB;
55339
+ exports.STORAGE_LOCATION_MODES = STORAGE_LOCATION_MODES;
55004
55340
  exports.STREAM_PROFILE_META = STREAM_PROFILE_META;
55005
55341
  exports.STREAM_QUALITY_LABELS = STREAM_QUALITY_LABELS;
55006
55342
  exports.SUB_DETECTION_TYPES = SUB_DETECTION_TYPES;
@@ -55062,9 +55398,12 @@ exports.StorageCleanupInputSchema = StorageCleanupInputSchema;
55062
55398
  exports.StorageCleanupJobSchema = StorageCleanupJobSchema;
55063
55399
  exports.StorageCleanupPhaseSchema = StorageCleanupPhaseSchema;
55064
55400
  exports.StorageCleanupStatusInputSchema = StorageCleanupStatusInputSchema;
55401
+ exports.StorageDrainProgressSchema = StorageDrainProgressSchema;
55065
55402
  exports.StorageEndDownloadInputSchema = EndDownloadInputSchema;
55403
+ exports.StorageEvictionPolicySchema = StorageEvictionPolicySchema;
55066
55404
  exports.StorageFinalizeUploadInputSchema = FinalizeUploadInputSchema;
55067
55405
  exports.StorageLocationDeclarationSchema = StorageLocationDeclarationSchema;
55406
+ exports.StorageLocationModeSchema = StorageLocationModeSchema;
55068
55407
  exports.StorageLocationRefSchema = StorageLocationRefSchema;
55069
55408
  exports.StorageLocationSchema = StorageLocationSchema;
55070
55409
  exports.StorageLocationTypeSchema = StorageLocationTypeSchema;
@@ -55088,6 +55427,7 @@ exports.StorageMigrationPhaseSchema = StorageMigrationPhaseSchema;
55088
55427
  exports.StorageMigrationPlanSchema = StorageMigrationPlanSchema;
55089
55428
  exports.StorageMigrationResidueSchema = StorageMigrationResidueSchema;
55090
55429
  exports.StorageMigrationSourcesSchema = StorageMigrationSourcesSchema;
55430
+ exports.StorageOccupancyReportSchema = StorageOccupancyReportSchema;
55091
55431
  exports.StorageProviderInfoSchema = ProviderInfoSchema;
55092
55432
  exports.StorageReadChunkInputSchema = ReadChunkInputSchema;
55093
55433
  exports.StorageTestLocationResultSchema = TestLocationResultSchema;
@@ -55369,6 +55709,8 @@ exports.evaluateZoneRules = evaluateZoneRules;
55369
55709
  exports.event = require_sleep.event;
55370
55710
  exports.eventEmitterCapability = eventEmitterCapability;
55371
55711
  exports.eventsCapability = eventsCapability;
55712
+ exports.evictionPolicyForMode = evictionPolicyForMode;
55713
+ exports.evictionPolicyOfLocation = evictionPolicyOfLocation;
55372
55714
  exports.expandCapMethods = require_sleep.expandCapMethods;
55373
55715
  exports.extractNestedAddonId = extractNestedAddonId;
55374
55716
  exports.extractSourceInfoFromMetadata = extractSourceInfoFromMetadata;
@@ -55384,6 +55726,7 @@ exports.foldSnapshotByFunction = foldSnapshotByFunction;
55384
55726
  exports.formatForBackend = formatForBackend;
55385
55727
  exports.formatForRuntime = formatForRuntime;
55386
55728
  exports.gasCapability = gasCapability;
55729
+ exports.gbToBytes = gbToBytes;
55387
55730
  exports.generateAutomationBlock = generateAutomationBlock;
55388
55731
  exports.getAudioMacroClassIds = getAudioMacroClassIds;
55389
55732
  exports.getByPath = getByPath;
@@ -55428,12 +55771,14 @@ exports.isScheduleActive = isScheduleActive;
55428
55771
  exports.isSecretConfigField = isSecretConfigField;
55429
55772
  exports.isSoftwareDecode = require_canonical_hash.isSoftwareDecode;
55430
55773
  exports.isSourceCap = isSourceCap;
55774
+ exports.isStorageLocationMode = isStorageLocationMode;
55431
55775
  exports.isSystemDelivery = isSystemDelivery;
55432
55776
  exports.isVoidInput = isVoidInput;
55433
55777
  exports.jobKindSchema = jobKindSchema;
55434
55778
  exports.kebabToCamel = kebabToCamel;
55435
55779
  exports.knownValues = knownValues;
55436
55780
  exports.lawnMowerControlCapability = lawnMowerControlCapability;
55781
+ exports.legacyModeOf = legacyModeOf;
55437
55782
  exports.lifecycleJobSchema = lifecycleJobSchema;
55438
55783
  exports.lifecycleJobScopeSchema = lifecycleJobScopeSchema;
55439
55784
  exports.lifecycleJobStateSchema = lifecycleJobStateSchema;
@@ -55456,6 +55801,8 @@ exports.mapAudioLabelToMacro = mapAudioLabelToMacro;
55456
55801
  exports.markdownToHtmlLite = markdownToHtmlLite;
55457
55802
  exports.markdownToText = markdownToText;
55458
55803
  exports.maskUrlCredentials = maskUrlCredentials;
55804
+ exports.mayReadLocation = mayReadLocation;
55805
+ exports.mayWriteToLocation = mayWriteToLocation;
55459
55806
  exports.mediaPlayerCapability = mediaPlayerCapability;
55460
55807
  exports.mergeSourceInfo = mergeSourceInfo;
55461
55808
  exports.meshNetworkCapability = meshNetworkCapability;
@@ -55463,6 +55810,8 @@ exports.method = require_sleep.method;
55463
55810
  exports.methodAccessForHttpMethod = methodAccessForHttpMethod;
55464
55811
  exports.metricsProviderCapability = metricsProviderCapability;
55465
55812
  exports.migrateLegacyDeviceSignalConfig = migrateLegacyDeviceSignalConfig;
55813
+ exports.modeMayRead = modeMayRead;
55814
+ exports.modeMayWrite = modeMayWrite;
55466
55815
  exports.modelConvertCapability = modelConvertCapability;
55467
55816
  exports.modelDistributorCapability = modelDistributorCapability;
55468
55817
  exports.modelFormatForRuntime = modelFormatForRuntime;
@@ -55558,6 +55907,7 @@ exports.resolveDeviceProfile = resolveDeviceProfile;
55558
55907
  exports.resolveEgressDecodeHwAccel = resolveEgressDecodeHwAccel;
55559
55908
  exports.resolveFormat = resolveFormat;
55560
55909
  exports.resolveHydratedFieldValue = require_sleep.resolveHydratedFieldValue;
55910
+ exports.resolveLocationMode = resolveLocationMode;
55561
55911
  exports.resolveMethodAuth = resolveMethodAuth;
55562
55912
  exports.resolveModelFormat = resolveModelFormat;
55563
55913
  exports.resolveMutate = resolveMutate;
@@ -55604,6 +55954,7 @@ exports.stateVocabularyFor = stateVocabularyFor;
55604
55954
  exports.storageCapability = storageCapability;
55605
55955
  exports.storageEvictableCapability = storageEvictableCapability;
55606
55956
  exports.storageMigrationCapability = storageMigrationCapability;
55957
+ exports.storageOccupancyCapability = storageOccupancyCapability;
55607
55958
  exports.storageProviderCapability = storageProviderCapability;
55608
55959
  exports.streamBrokerCapability = streamBrokerCapability;
55609
55960
  exports.streamCatalogCapability = streamCatalogCapability;
@@ -55611,6 +55962,7 @@ exports.streamParamsCapability = streamParamsCapability;
55611
55962
  exports.streamPixels = streamPixels;
55612
55963
  exports.streamQualityLabel = streamQualityLabel;
55613
55964
  exports.stripRetiredBandPreBufferSec = stripRetiredBandPreBufferSec;
55965
+ exports.strippedOfLegacyReadOnly = strippedOfLegacyReadOnly;
55614
55966
  exports.subKindsOf = subKindsOf;
55615
55967
  exports.summarisePrivacyAudio = summarisePrivacyAudio;
55616
55968
  exports.summarizeEffectiveScope = summarizeEffectiveScope;
@@ -55661,6 +56013,7 @@ exports.wiringHealthSnapshotSchema = wiringHealthSnapshotSchema;
55661
56013
  exports.wiringNodeHealthSchema = wiringNodeHealthSchema;
55662
56014
  exports.wiringProbeKindSchema = wiringProbeKindSchema;
55663
56015
  exports.wiringProbeResultSchema = wiringProbeResultSchema;
56016
+ exports.withLocationMode = withLocationMode;
55664
56017
  exports.zodEntriesToConfigUI = zodEntriesToConfigUI;
55665
56018
  exports.zoneAnalyticsCapability = zoneAnalyticsCapability;
55666
56019
  exports.zoneRulesCapability = zoneRulesCapability;