@camstack/addon-matter-broker 0.2.77 → 0.2.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +621 -488
  2. package/dist/addon.mjs +621 -488
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13,7 +13,7 @@ let node_stream_promises = require("node:stream/promises");
13
13
  let node_net = require("node:net");
14
14
  let node_dgram = require("node:dgram");
15
15
  node_dgram = require_esm.__toESM(node_dgram, 1);
16
- //#region ../types/dist/event-category-zAv7pMUz.mjs
16
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
17
17
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
18
18
  EventCategory["SystemBoot"] = "system.boot";
19
19
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -208,6 +208,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
208
208
  EventCategory["ProcessCrashed"] = "process.crashed";
209
209
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
210
210
  EventCategory["ProcessRestarted"] = "process.restarted";
211
+ /**
212
+ * The SET of storage locations changed — one was created, edited, enabled,
213
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
214
+ *
215
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
216
+ * it must also converge on its own periodic path, because a dropped event
217
+ * must not leave a node writing to yesterday's disk set forever. It exists
218
+ * because there was NO signal at all — an operator who added a second
219
+ * recordings disk in the admin UI got nothing, and the recorder kept its
220
+ * resolved locations until something else happened to re-resolve them
221
+ * (D387). Payload `StorageLocationsChangedPayload`.
222
+ */
223
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
211
224
  EventCategory["RecordingStarted"] = "recording.started";
212
225
  EventCategory["RecordingStopped"] = "recording.stopped";
213
226
  EventCategory["RecordingError"] = "recording.error";
@@ -7629,111 +7642,6 @@ var CameraSwitchGroupSchema = object({
7629
7642
  fetchedAt: number()
7630
7643
  });
7631
7644
  /**
7632
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7633
- * an addon declares its channels in.
7634
- *
7635
- * ## Two axes, deliberately separated
7636
- *
7637
- * - **DECLARATION** — which channels exist. Only the addon knows:
7638
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7639
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7640
- * and rots silently. So a channel is declared where it is consulted, and the
7641
- * `log-channels` capability enumerates the declarations.
7642
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7643
- * thing: the logging settings document on the `system` cap. Two authorities
7644
- * over the values is the exact defect
7645
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7646
- * remove; re-introducing it from the cure side would be grotesque.
7647
- *
7648
- * Nothing in this file reads a clock, an env var or a store. The registry is
7649
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7650
- * the hot path with a value somebody actually read, and by
7651
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7652
- * never reaches here, so it can neither disarm an armed channel nor arm a
7653
- * disarmed one (D49).
7654
- *
7655
- * ## The canonical call shape
7656
- *
7657
- * ```ts
7658
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7659
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7660
- * }
7661
- * ```
7662
- *
7663
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7664
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7665
- * object literal is never constructed because it lives inside the branch. It
7666
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7667
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7668
- * destination floor (measured at 1.93 ns/call when off).
7669
- *
7670
- * ## Why a channel emits at `info`
7671
- *
7672
- * `loki-logging.addon.ts` pins the destination default at `info` and
7673
- * `loki-destination.ts` drops everything below it, so a line emitted at
7674
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7675
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7676
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7677
- * emits at the channel's declared level, whose schema floor is `info`.
7678
- */
7679
- /**
7680
- * The level a channel writes at once armed.
7681
- *
7682
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7683
- * not leave the process for Loki, and the whole point of arming a channel is
7684
- * to read it later.
7685
- */
7686
- var LogChannelLevelSchema = _enum([
7687
- "info",
7688
- "warn",
7689
- "error"
7690
- ]);
7691
- /**
7692
- * What an addon declares about one channel. No value, no state — a
7693
- * declaration is inert.
7694
- */
7695
- var LogChannelDescriptorSchema = object({
7696
- /**
7697
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7698
- * the addon's short name so an operator reading a channel list can tell who
7699
- * owns it without a second lookup.
7700
- */
7701
- name: string$2().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7702
- /** One sentence: what the operator will SEE after arming it. */
7703
- description: string$2().min(1),
7704
- /** The level its lines are emitted at. Never below `info`. */
7705
- defaultLevel: LogChannelLevelSchema,
7706
- /**
7707
- * Whether this channel can be narrowed to a camera.
7708
- *
7709
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7710
- * consulted with the numeric device id, AND every line the channel admits
7711
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7712
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7713
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7714
- * the body is the only way to filter.
7715
- *
7716
- * A channel whose lines carry the device only in `meta` (or not at all) is
7717
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7718
- * the operator narrows to one camera, sees nothing, and concludes the code
7719
- * path was never taken.
7720
- */
7721
- perDevice: boolean()
7722
- });
7723
- /**
7724
- * An armed window over one channel, as the document hands it to a mirror.
7725
- *
7726
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7727
- * expires by itself, which is the one failure a boolean cannot avoid.
7728
- */
7729
- var LogChannelWindowSchema = object({
7730
- channel: string$2().min(1),
7731
- /** Epoch ms the window closes at. */
7732
- armedUntilMs: number(),
7733
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7734
- deviceIds: array(number().int()).readonly().nullable()
7735
- });
7736
- /**
7737
7645
  * Ops-log — the durable, append-only operations audit shared by the
7738
7646
  * recordings and events management surfaces.
7739
7647
  *
@@ -8655,6 +8563,21 @@ var StorageCleanupJobSchema = object({
8655
8563
  });
8656
8564
  var StorageCleanupStatusInputSchema = object({ jobId: string$2().optional() });
8657
8565
  /**
8566
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8567
+ * alias below is `z.infer<>` of it, never a second spelling.
8568
+ */
8569
+ var StorageLocationModeSchema = _enum([
8570
+ "active",
8571
+ "readonly",
8572
+ "drain",
8573
+ "disabled"
8574
+ ]);
8575
+ _enum([
8576
+ "normal",
8577
+ "never",
8578
+ "drain"
8579
+ ]);
8580
+ /**
8658
8581
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8659
8582
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8660
8583
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8679,8 +8602,11 @@ var StorageLocationTypeSchema = string$2().regex(/^[a-z][a-zA-Z0-9-]*$/);
8679
8602
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8680
8603
  *
8681
8604
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8682
- * The default location for a type uses `id === <type>:default` by
8683
- * convention (the bare type ref like `'backups'` resolves to it).
8605
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8606
+ * There is no default location any more (D383): `enabled` is the whole write
8607
+ * model, and a bare type ref resolves to the sole location of the type, or —
8608
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8609
+ * slug is `default`.
8684
8610
  *
8685
8611
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8686
8612
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8701,23 +8627,37 @@ var StorageLocationSchema = object({
8701
8627
  * flag at upsert time, not here (the schema is provider-agnostic).
8702
8628
  */
8703
8629
  nodeId: string$2().optional(),
8704
- isDefault: boolean().default(false),
8705
8630
  isSystem: boolean().default(false),
8706
8631
  /**
8707
- * Operator opt-in: whether consumers that BALANCE across several locations
8708
- * of a type may write here. Recordings reads it today; event media and
8709
- * backups are the next consumers, which is why the flag lives on the
8710
- * location rather than in any one addon's store — nothing has to be
8711
- * extended to add the next consumer.
8632
+ * THE write switch, and the only one (D383). `enabled: true` means every
8633
+ * consumer that chooses a write target for this type may write here, and all
8634
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8635
+ * still read, still played back, still age-swept, still drained, never
8636
+ * written.
8712
8637
  *
8713
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8714
- * flag existed reads back with no flag and keeps working exactly as before;
8715
- * that is the whole compat story, and it is why no migration ships with it.
8716
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8717
- * disk must not silently start writing to it); the default of a type is
8718
- * always stamped `true`.
8638
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8639
+ * stored" on an update and "born inert unless it is the first location of its
8640
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8641
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8642
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8643
+ * stops existing rather than being re-derived on every read.
8719
8644
  */
8720
8645
  enabled: boolean().optional(),
8646
+ /**
8647
+ * THE state of this location (D385), and the only authority on what may be
8648
+ * written, read or evicted here. Interpreted in exactly one place —
8649
+ * `storage-location-mode.ts` — which also folds the legacy
8650
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8651
+ * ambiguous.
8652
+ *
8653
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8654
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8655
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8656
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8657
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8658
+ * either, so the two cannot disagree.
8659
+ */
8660
+ mode: StorageLocationModeSchema.optional(),
8721
8661
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8722
8662
  * for node-local locations it can reach) — never persisted, absent when the
8723
8663
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8725,13 +8665,50 @@ var StorageLocationSchema = object({
8725
8665
  totalBytes: number(),
8726
8666
  availableBytes: number()
8727
8667
  }).nullable().optional(),
8668
+ /**
8669
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8670
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8671
+ * never persisted, never a filesystem walk.
8672
+ *
8673
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8674
+ * location yet — nobody stores here, the owning addon is down, or the first
8675
+ * refresh has not completed. A UI must omit the segment rather than draw it
8676
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8677
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8678
+ * be spelled out loud instead of appearing by accident.
8679
+ *
8680
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8681
+ * about the whole figure rather than about its freshest part.
8682
+ */
8683
+ owned: object({
8684
+ bytes: number().int().nonnegative(),
8685
+ measuredAtMs: number().int().nonnegative()
8686
+ }).optional(),
8728
8687
  createdAt: number(),
8729
8688
  updatedAt: number()
8730
8689
  });
8690
+ object({ isDefault: boolean().optional() });
8691
+ /**
8692
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8693
+ *
8694
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8695
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8696
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8697
+ * operator learns not to believe the screen.
8698
+ */
8699
+ var StorageDrainProgressSchema = object({
8700
+ locationId: string$2(),
8701
+ startedAtMs: number(),
8702
+ startBytes: number(),
8703
+ bytesRemaining: number(),
8704
+ drained: boolean(),
8705
+ estimatedEmptyAtMs: number().nullable()
8706
+ });
8731
8707
  /**
8732
8708
  * Reference accepted by consumer-facing `api.storage.*` calls.
8733
8709
  * Either:
8734
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8710
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8711
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8735
8712
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8736
8713
  *
8737
8714
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8907,6 +8884,111 @@ var DecoderSessionConfigSchema = object({
8907
8884
  */
8908
8885
  debug: boolean().optional()
8909
8886
  });
8887
+ /**
8888
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8889
+ * an addon declares its channels in.
8890
+ *
8891
+ * ## Two axes, deliberately separated
8892
+ *
8893
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8894
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8895
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8896
+ * and rots silently. So a channel is declared where it is consulted, and the
8897
+ * `log-channels` capability enumerates the declarations.
8898
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8899
+ * thing: the logging settings document on the `system` cap. Two authorities
8900
+ * over the values is the exact defect
8901
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8902
+ * remove; re-introducing it from the cure side would be grotesque.
8903
+ *
8904
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8905
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8906
+ * the hot path with a value somebody actually read, and by
8907
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8908
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8909
+ * disarmed one (D49).
8910
+ *
8911
+ * ## The canonical call shape
8912
+ *
8913
+ * ```ts
8914
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8915
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8916
+ * }
8917
+ * ```
8918
+ *
8919
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8920
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8921
+ * object literal is never constructed because it lives inside the branch. It
8922
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8923
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8924
+ * destination floor (measured at 1.93 ns/call when off).
8925
+ *
8926
+ * ## Why a channel emits at `info`
8927
+ *
8928
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8929
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8930
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8931
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8932
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8933
+ * emits at the channel's declared level, whose schema floor is `info`.
8934
+ */
8935
+ /**
8936
+ * The level a channel writes at once armed.
8937
+ *
8938
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8939
+ * not leave the process for Loki, and the whole point of arming a channel is
8940
+ * to read it later.
8941
+ */
8942
+ var LogChannelLevelSchema = _enum([
8943
+ "info",
8944
+ "warn",
8945
+ "error"
8946
+ ]);
8947
+ /**
8948
+ * What an addon declares about one channel. No value, no state — a
8949
+ * declaration is inert.
8950
+ */
8951
+ var LogChannelDescriptorSchema = object({
8952
+ /**
8953
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8954
+ * the addon's short name so an operator reading a channel list can tell who
8955
+ * owns it without a second lookup.
8956
+ */
8957
+ name: string$2().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8958
+ /** One sentence: what the operator will SEE after arming it. */
8959
+ description: string$2().min(1),
8960
+ /** The level its lines are emitted at. Never below `info`. */
8961
+ defaultLevel: LogChannelLevelSchema,
8962
+ /**
8963
+ * Whether this channel can be narrowed to a camera.
8964
+ *
8965
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8966
+ * consulted with the numeric device id, AND every line the channel admits
8967
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8968
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8969
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8970
+ * the body is the only way to filter.
8971
+ *
8972
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8973
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8974
+ * the operator narrows to one camera, sees nothing, and concludes the code
8975
+ * path was never taken.
8976
+ */
8977
+ perDevice: boolean()
8978
+ });
8979
+ /**
8980
+ * An armed window over one channel, as the document hands it to a mirror.
8981
+ *
8982
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8983
+ * expires by itself, which is the one failure a boolean cannot avoid.
8984
+ */
8985
+ var LogChannelWindowSchema = object({
8986
+ channel: string$2().min(1),
8987
+ /** Epoch ms the window closes at. */
8988
+ armedUntilMs: number(),
8989
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8990
+ deviceIds: array(number().int()).readonly().nullable()
8991
+ });
8910
8992
  var MODEL_FORMATS = [
8911
8993
  "onnx",
8912
8994
  "coreml",
@@ -22005,7 +22087,7 @@ method(object({
22005
22087
  downloadId: string$2(),
22006
22088
  offset: number(),
22007
22089
  length: number()
22008
- }), _instanceof(Uint8Array)), method(object({ downloadId: string$2() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(object({ type: StorageLocationTypeSchema }), StorageLocationSchema.nullable()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22090
+ }), _instanceof(Uint8Array)), method(object({ downloadId: string$2() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22009
22091
  createdAt: true,
22010
22092
  updatedAt: true
22011
22093
  }), StorageLocationSchema, {
@@ -22017,7 +22099,7 @@ method(object({
22017
22099
  }), _void(), {
22018
22100
  kind: "mutation",
22019
22101
  auth: "admin"
22020
- }), method(object({ id: string$2() }), object({
22102
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string$2() }), object({
22021
22103
  ok: boolean(),
22022
22104
  error: string$2().optional()
22023
22105
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22087,6 +22169,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22087
22169
  kind: "mutation",
22088
22170
  auth: "admin"
22089
22171
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22172
+ /**
22173
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22174
+ * location (D388).
22175
+ *
22176
+ * ## Why this is not `storage-evictable`
22177
+ *
22178
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22179
+ * not, in two ways that both matter and both bite hardest on the locations an
22180
+ * operator most wants a figure for:
22181
+ *
22182
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22183
+ * and `recordingsLow:default` deliberately share one root and evict as one
22184
+ * oldest-first pool, so both answer with the SAME combined total. As an
22185
+ * occupancy figure that double-counts the disk.
22186
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22187
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22188
+ * is retiring and staring at.
22189
+ *
22190
+ * So this is its own contract with its own quantity, and the quantity is
22191
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22192
+ * would ever be willing to delete it. A provider that can only answer
22193
+ * "evictable" must not register here — a number that silently means different
22194
+ * things per class is worse than no number.
22195
+ *
22196
+ * ## Absence is an answer
22197
+ *
22198
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22199
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22200
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22201
+ * consuming side has to be written out loud instead of appearing by accident.
22202
+ *
22203
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22204
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22205
+ */
22206
+ /** One provider's occupancy answer for one location. */
22207
+ var StorageOccupancyReportSchema = object({
22208
+ locationId: string$2(),
22209
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22210
+ * not net of what it is willing to delete. */
22211
+ ownedBytes: number().int().nonnegative(),
22212
+ /** When the provider last actually measured this. The orchestrator carries it
22213
+ * through so a UI can say how old the figure is instead of implying "now". */
22214
+ measuredAtMs: number().int().nonnegative()
22215
+ });
22216
+ method(object({ locationIds: array(string$2()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22090
22217
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22091
22218
  providerId: string$2().min(1),
22092
22219
  displayName: string$2().min(1),
@@ -23922,88 +24049,6 @@ onStatusChanged: { data: object({
23922
24049
  volatileStateFields: ["lastUpdated"]
23923
24050
  };
23924
24051
  /**
23925
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23926
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23927
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23928
- * one Home Assistant projection.
23929
- */
23930
- var NetworkLinkStatusSchema = object({
23931
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23932
- type: _enum([
23933
- "wifi",
23934
- "ethernet",
23935
- "cellular",
23936
- "unknown"
23937
- ]),
23938
- /**
23939
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23940
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23941
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23942
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23943
- * SKIP a null rather than coerce it.
23944
- */
23945
- signalPercent: number().min(0).max(100).nullable(),
23946
- /** Raw received signal strength in dBm, when the firmware reports one. */
23947
- rssiDbm: number().optional(),
23948
- /** Network name of a wireless link, when the firmware reports it. */
23949
- ssid: string$2().optional(),
23950
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23951
- lastUpdated: number()
23952
- });
23953
- var networkLinkCapability = {
23954
- name: "network-link",
23955
- scope: "device",
23956
- deviceNative: true,
23957
- mode: "singleton",
23958
- deviceTypes: [
23959
- DeviceType.Camera,
23960
- DeviceType.Sensor,
23961
- DeviceType.Button,
23962
- DeviceType.Switch,
23963
- DeviceType.Light,
23964
- DeviceType.Lock,
23965
- DeviceType.Siren
23966
- ],
23967
- methods: {},
23968
- events: {
23969
- /**
23970
- * Emitted whenever the cached status changes (a link switch, a signal
23971
- * reading that moved). Mirrored on the parent chain by the
23972
- * DeviceEventPropagator like `battery.onStatusChanged`.
23973
- */
23974
- onStatusChanged: { data: object({
23975
- deviceId: number(),
23976
- status: NetworkLinkStatusSchema
23977
- }) } },
23978
- status: {
23979
- schema: NetworkLinkStatusSchema,
23980
- kind: "push",
23981
- empty: {
23982
- type: "unknown",
23983
- signalPercent: null,
23984
- lastUpdated: 0
23985
- }
23986
- },
23987
- /**
23988
- * Runtime-state slice — every provider stores the same shape under
23989
- * `device.runtimeState['network-link']`, read once by the badge and the
23990
- * Home Assistant projector regardless of the driver.
23991
- */
23992
- runtimeState: NetworkLinkStatusSchema,
23993
- /**
23994
- * Runtime-state durability: **restored** — a link reading is slow to
23995
- * change and a sleeping battery camera may not report for hours; the
23996
- * restored slice is what the badge shows until the next read.
23997
- *
23998
- * See `RuntimeStateDurability`. Enforced by
23999
- * `scripts/check-runtime-state-durability.ts`.
24000
- */
24001
- durability: "restored",
24002
- /** Clock fields: written, but excluded from the compare that decides
24003
- * whether persisting is worth a SQLite commit. */
24004
- volatileStateFields: ["lastUpdated"]
24005
- };
24006
- /**
24007
24052
  * Generic boolean sensor — last-resort fallback when no domain-
24008
24053
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24009
24054
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27550,6 +27595,369 @@ var nativeObjectDetectionCapability = {
27550
27595
  volatileStateFields: ["lastFetchedAt"]
27551
27596
  };
27552
27597
  /**
27598
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27599
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27600
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27601
+ *
27602
+ * Why a NEW cap rather than overloading `ptz`:
27603
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27604
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27605
+ * The two are different physical models: PTZ is absolute-position + presets,
27606
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27607
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27608
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27609
+ * the reverse:
27610
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27611
+ * / `getOptions`), and
27612
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27613
+ * robot camera shows up in the existing PTZ control path without every
27614
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27615
+ * not here (see the addon design note):
27616
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27617
+ * ptz.stop() → navigation.stop()
27618
+ * ptz.goHome() → navigation.runAction('goHome')
27619
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27620
+ * ptz.goToPreset(id) → navigation.runAction(id)
27621
+ *
27622
+ * ## Continuous drive
27623
+ *
27624
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27625
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27626
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27627
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27628
+ * coalesce them. The UI owns the cadence.
27629
+ *
27630
+ * ## The action dictionary
27631
+ *
27632
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27633
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27634
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27635
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27636
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27637
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27638
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27639
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27640
+ *
27641
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27642
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27643
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27644
+ * every device handle. A future nodedreame publish adds a typed
27645
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27646
+ * provider can then swap the raw calls for the typed methods with no change to
27647
+ * THIS contract.
27648
+ */
27649
+ /**
27650
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27651
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27652
+ * halts it.
27653
+ *
27654
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27655
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27656
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27657
+ * vector by it (drivers without proportional drive ignore it).
27658
+ *
27659
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27660
+ * axis alone; an all-undefined nudge is a no-op.
27661
+ */
27662
+ var NavigationMoveCommandSchema = object({
27663
+ pan: number().min(-1).max(1).optional(),
27664
+ tilt: number().min(-1).max(1).optional(),
27665
+ speed: number().min(0).max(1).optional()
27666
+ });
27667
+ /**
27668
+ * The enumerated discrete actions a navigation-capable robot can perform via
27669
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27670
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27671
+ * `playSound` (see the `sound` dictionary entries).
27672
+ */
27673
+ var NavigationActionIdSchema = _enum([
27674
+ "goHome",
27675
+ "locate",
27676
+ "spotClean",
27677
+ "findPet",
27678
+ "personFollow",
27679
+ "stop",
27680
+ "startClean",
27681
+ "pauseClean",
27682
+ "dockWash",
27683
+ "autoEmpty",
27684
+ "flashOn",
27685
+ "flashOff"
27686
+ ]);
27687
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27688
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27689
+ /**
27690
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27691
+ * native panel and the PTZ mimic render as a button.
27692
+ *
27693
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27694
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27695
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27696
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27697
+ * - `label` — operator-facing English label.
27698
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27699
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27700
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27701
+ * flips it from config, never by editing code.
27702
+ */
27703
+ var NavigationActionEntrySchema = object({
27704
+ id: string$2(),
27705
+ kind: NavigationEntryKindSchema,
27706
+ label: string$2(),
27707
+ icon: string$2(),
27708
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27709
+ soundId: number().int().optional(),
27710
+ /** Per-device feature flag — render this entry only when true. */
27711
+ enabled: boolean()
27712
+ });
27713
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27714
+ var NavigationPointSchema = object({
27715
+ x: number(),
27716
+ y: number()
27717
+ });
27718
+ /**
27719
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27720
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27721
+ * that are turned on for THIS device. Data-driven: the provider derives these
27722
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27723
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27724
+ * that are not dictionary entries.
27725
+ *
27726
+ * - `move` / `stop` — the momentary drive joystick.
27727
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27728
+ * map-coordinate plumbing is wired.
27729
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27730
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27731
+ * - `light` — the on/off fill-light toggle (works anytime).
27732
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27733
+ * camera-service control; needs an active stream).
27734
+ */
27735
+ var NavigationFeaturesSchema = object({
27736
+ move: boolean(),
27737
+ stop: boolean(),
27738
+ goToPoint: boolean(),
27739
+ runAction: boolean(),
27740
+ playSound: boolean(),
27741
+ light: boolean(),
27742
+ lightMode: boolean()
27743
+ });
27744
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27745
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27746
+ /**
27747
+ * Live navigation state so the UI can reflect what the robot is doing:
27748
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27749
+ * - `following` — person/pet follow is currently armed.
27750
+ * - `flash` — the on-camera fill light is on.
27751
+ * - `lightMode` — auto vs manual fill-light mode.
27752
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27753
+ * `lightMode === 'manual'`.
27754
+ */
27755
+ var NavigationStatusSchema = object({
27756
+ mode: _enum([
27757
+ "idle",
27758
+ "cleaning",
27759
+ "spot",
27760
+ "following",
27761
+ "goto",
27762
+ "returning",
27763
+ "paused",
27764
+ "unknown"
27765
+ ]),
27766
+ following: boolean(),
27767
+ flash: boolean(),
27768
+ lightMode: NavigationLightModeSchema,
27769
+ lightLevel: number().min(40).max(100),
27770
+ /** Ms epoch when the slice was last updated. */
27771
+ lastChangedAt: number()
27772
+ });
27773
+ /**
27774
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27775
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27776
+ * convention.
27777
+ */
27778
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27779
+ var navigationCapability = {
27780
+ name: "navigation",
27781
+ scope: "device",
27782
+ deviceNative: true,
27783
+ mode: "singleton",
27784
+ deviceTypes: [DeviceType.Camera],
27785
+ deviceConfig: { ui: {
27786
+ kind: "widget",
27787
+ widgetId: "host/navigation-panel",
27788
+ tab: "navigation",
27789
+ topTab: true,
27790
+ label: "Navigation",
27791
+ order: 0
27792
+ } },
27793
+ methods: {
27794
+ /**
27795
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27796
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27797
+ * path) works for any authenticated user, not admin-only. The UI sends
27798
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27799
+ * a single drive write WITHOUT debouncing.
27800
+ */
27801
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27802
+ /** Halt all motion immediately (zero drive vector). */
27803
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27804
+ /** Send the robot to a point on its live map. */
27805
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27806
+ /**
27807
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27808
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27809
+ */
27810
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27811
+ /**
27812
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27813
+ * unsupported action ids are rejected by the provider.
27814
+ */
27815
+ runAction: method(object({
27816
+ deviceId: number(),
27817
+ actionId: NavigationActionIdSchema
27818
+ }), _void(), { kind: "mutation" }),
27819
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27820
+ playSound: method(object({
27821
+ deviceId: number(),
27822
+ soundId: number().int()
27823
+ }), _void(), { kind: "mutation" }),
27824
+ /**
27825
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27826
+ * works anytime, no active stream required).
27827
+ */
27828
+ setLightOn: method(object({
27829
+ deviceId: number(),
27830
+ on: boolean()
27831
+ }), _void(), { kind: "mutation" }),
27832
+ /**
27833
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27834
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27835
+ * action that generally needs an active camera stream/monitor session — the
27836
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27837
+ */
27838
+ setLightMode: method(object({
27839
+ deviceId: number(),
27840
+ mode: NavigationLightModeSchema,
27841
+ level: number().min(40).max(100).optional()
27842
+ }), _void(), { kind: "mutation" }),
27843
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27844
+ setLightLevel: method(object({
27845
+ deviceId: number(),
27846
+ level: number().min(40).max(100)
27847
+ }), _void(), { kind: "mutation" }),
27848
+ /**
27849
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27850
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27851
+ * `listActions`).
27852
+ */
27853
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27854
+ },
27855
+ events: { onStatusChanged: { data: object({
27856
+ deviceId: number(),
27857
+ status: NavigationStatusSchema
27858
+ }) } },
27859
+ status: {
27860
+ schema: NavigationStatusSchema,
27861
+ kind: "push"
27862
+ },
27863
+ /**
27864
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27865
+ * for live mode / follow / flash changes.
27866
+ */
27867
+ runtimeState: NavigationRuntimeStateSchema,
27868
+ /**
27869
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27870
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27871
+ * that. The live handle re-publishes on connect.
27872
+ *
27873
+ * See `RuntimeStateDurability`. Enforced by
27874
+ * `scripts/check-runtime-state-durability.ts`.
27875
+ */
27876
+ durability: "session"
27877
+ };
27878
+ /**
27879
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27880
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27881
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27882
+ * one Home Assistant projection.
27883
+ */
27884
+ var NetworkLinkStatusSchema = object({
27885
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27886
+ type: _enum([
27887
+ "wifi",
27888
+ "ethernet",
27889
+ "cellular",
27890
+ "unknown"
27891
+ ]),
27892
+ /**
27893
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27894
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27895
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27896
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27897
+ * SKIP a null rather than coerce it.
27898
+ */
27899
+ signalPercent: number().min(0).max(100).nullable(),
27900
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27901
+ rssiDbm: number().optional(),
27902
+ /** Network name of a wireless link, when the firmware reports it. */
27903
+ ssid: string$2().optional(),
27904
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27905
+ lastUpdated: number()
27906
+ });
27907
+ var networkLinkCapability = {
27908
+ name: "network-link",
27909
+ scope: "device",
27910
+ deviceNative: true,
27911
+ mode: "singleton",
27912
+ deviceTypes: [
27913
+ DeviceType.Camera,
27914
+ DeviceType.Sensor,
27915
+ DeviceType.Button,
27916
+ DeviceType.Switch,
27917
+ DeviceType.Light,
27918
+ DeviceType.Lock,
27919
+ DeviceType.Siren
27920
+ ],
27921
+ methods: {},
27922
+ events: {
27923
+ /**
27924
+ * Emitted whenever the cached status changes (a link switch, a signal
27925
+ * reading that moved). Mirrored on the parent chain by the
27926
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27927
+ */
27928
+ onStatusChanged: { data: object({
27929
+ deviceId: number(),
27930
+ status: NetworkLinkStatusSchema
27931
+ }) } },
27932
+ status: {
27933
+ schema: NetworkLinkStatusSchema,
27934
+ kind: "push",
27935
+ empty: {
27936
+ type: "unknown",
27937
+ signalPercent: null,
27938
+ lastUpdated: 0
27939
+ }
27940
+ },
27941
+ /**
27942
+ * Runtime-state slice — every provider stores the same shape under
27943
+ * `device.runtimeState['network-link']`, read once by the badge and the
27944
+ * Home Assistant projector regardless of the driver.
27945
+ */
27946
+ runtimeState: NetworkLinkStatusSchema,
27947
+ /**
27948
+ * Runtime-state durability: **restored** — a link reading is slow to
27949
+ * change and a sleeping battery camera may not report for hours; the
27950
+ * restored slice is what the badge shows until the next read.
27951
+ *
27952
+ * See `RuntimeStateDurability`. Enforced by
27953
+ * `scripts/check-runtime-state-durability.ts`.
27954
+ */
27955
+ durability: "restored",
27956
+ /** Clock fields: written, but excluded from the compare that decides
27957
+ * whether persisting is worth a SQLite commit. */
27958
+ volatileStateFields: ["lastUpdated"]
27959
+ };
27960
+ /**
27553
27961
  * network-quality — system-scoped singleton capability tracking RTT,
27554
27962
  * jitter, and observed/peak bandwidth per device + per client.
27555
27963
  *
@@ -29130,287 +29538,6 @@ var ptzAutotrackCapability = {
29130
29538
  */
29131
29539
  durability: "session"
29132
29540
  };
29133
- /**
29134
- * `navigation` — a device-scoped capability that natively expresses the FULL
29135
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29136
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29137
- *
29138
- * Why a NEW cap rather than overloading `ptz`:
29139
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29140
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29141
- * The two are different physical models: PTZ is absolute-position + presets,
29142
- * navigation is momentary drive nudges + discrete robot ACTIONS
29143
- * (dock / spot-clean / follow-pet / go-to-point / …).
29144
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29145
- * the reverse:
29146
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29147
- * / `getOptions`), and
29148
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29149
- * robot camera shows up in the existing PTZ control path without every
29150
- * PTZ provider learning about robots. The mapping lives in the adapter,
29151
- * not here (see the addon design note):
29152
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29153
- * ptz.stop() → navigation.stop()
29154
- * ptz.goHome() → navigation.runAction('goHome')
29155
- * ptz.getPresets() → navigation.listActions() (id→preset)
29156
- * ptz.goToPreset(id) → navigation.runAction(id)
29157
- *
29158
- * ## Continuous drive
29159
- *
29160
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29161
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29162
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29163
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29164
- * coalesce them. The UI owns the cadence.
29165
- *
29166
- * ## The action dictionary
29167
- *
29168
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29169
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29170
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29171
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29172
- * vendor-specific list. `kind: 'action'` entries are triggered with
29173
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29174
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29175
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29176
- *
29177
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29178
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29179
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29180
- * every device handle. A future nodedreame publish adds a typed
29181
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29182
- * provider can then swap the raw calls for the typed methods with no change to
29183
- * THIS contract.
29184
- */
29185
- /**
29186
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29187
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29188
- * halts it.
29189
- *
29190
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29191
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29192
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29193
- * vector by it (drivers without proportional drive ignore it).
29194
- *
29195
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29196
- * axis alone; an all-undefined nudge is a no-op.
29197
- */
29198
- var NavigationMoveCommandSchema = object({
29199
- pan: number().min(-1).max(1).optional(),
29200
- tilt: number().min(-1).max(1).optional(),
29201
- speed: number().min(0).max(1).optional()
29202
- });
29203
- /**
29204
- * The enumerated discrete actions a navigation-capable robot can perform via
29205
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29206
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29207
- * `playSound` (see the `sound` dictionary entries).
29208
- */
29209
- var NavigationActionIdSchema = _enum([
29210
- "goHome",
29211
- "locate",
29212
- "spotClean",
29213
- "findPet",
29214
- "personFollow",
29215
- "stop",
29216
- "startClean",
29217
- "pauseClean",
29218
- "dockWash",
29219
- "autoEmpty",
29220
- "flashOn",
29221
- "flashOff"
29222
- ]);
29223
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29224
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29225
- /**
29226
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29227
- * native panel and the PTZ mimic render as a button.
29228
- *
29229
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29230
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29231
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29232
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29233
- * - `label` — operator-facing English label.
29234
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29235
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29236
- * PTZ render ONLY enabled entries. Data-driven: the provider
29237
- * flips it from config, never by editing code.
29238
- */
29239
- var NavigationActionEntrySchema = object({
29240
- id: string$2(),
29241
- kind: NavigationEntryKindSchema,
29242
- label: string$2(),
29243
- icon: string$2(),
29244
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29245
- soundId: number().int().optional(),
29246
- /** Per-device feature flag — render this entry only when true. */
29247
- enabled: boolean()
29248
- });
29249
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29250
- var NavigationPointSchema = object({
29251
- x: number(),
29252
- y: number()
29253
- });
29254
- /**
29255
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29256
- * The cap reports which are enabled so the UI / PTZ render only the controls
29257
- * that are turned on for THIS device. Data-driven: the provider derives these
29258
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29259
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29260
- * that are not dictionary entries.
29261
- *
29262
- * - `move` / `stop` — the momentary drive joystick.
29263
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29264
- * map-coordinate plumbing is wired.
29265
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29266
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29267
- * - `light` — the on/off fill-light toggle (works anytime).
29268
- * - `lightMode` — the auto/manual selector + manual level slider (a
29269
- * camera-service control; needs an active stream).
29270
- */
29271
- var NavigationFeaturesSchema = object({
29272
- move: boolean(),
29273
- stop: boolean(),
29274
- goToPoint: boolean(),
29275
- runAction: boolean(),
29276
- playSound: boolean(),
29277
- light: boolean(),
29278
- lightMode: boolean()
29279
- });
29280
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29281
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29282
- /**
29283
- * Live navigation state so the UI can reflect what the robot is doing:
29284
- * - `mode` — coarse activity (idle / cleaning / following / …).
29285
- * - `following` — person/pet follow is currently armed.
29286
- * - `flash` — the on-camera fill light is on.
29287
- * - `lightMode` — auto vs manual fill-light mode.
29288
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29289
- * `lightMode === 'manual'`.
29290
- */
29291
- var NavigationStatusSchema = object({
29292
- mode: _enum([
29293
- "idle",
29294
- "cleaning",
29295
- "spot",
29296
- "following",
29297
- "goto",
29298
- "returning",
29299
- "paused",
29300
- "unknown"
29301
- ]),
29302
- following: boolean(),
29303
- flash: boolean(),
29304
- lightMode: NavigationLightModeSchema,
29305
- lightLevel: number().min(40).max(100),
29306
- /** Ms epoch when the slice was last updated. */
29307
- lastChangedAt: number()
29308
- });
29309
- /**
29310
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29311
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29312
- * convention.
29313
- */
29314
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29315
- var navigationCapability = {
29316
- name: "navigation",
29317
- scope: "device",
29318
- deviceNative: true,
29319
- mode: "singleton",
29320
- deviceTypes: [DeviceType.Camera],
29321
- deviceConfig: { ui: {
29322
- kind: "widget",
29323
- widgetId: "host/navigation-panel",
29324
- tab: "navigation",
29325
- topTab: true,
29326
- label: "Navigation",
29327
- order: 0
29328
- } },
29329
- methods: {
29330
- /**
29331
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29332
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29333
- * path) works for any authenticated user, not admin-only. The UI sends
29334
- * these at ~1 Hz while a control is held; the provider forwards each one to
29335
- * a single drive write WITHOUT debouncing.
29336
- */
29337
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29338
- /** Halt all motion immediately (zero drive vector). */
29339
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29340
- /** Send the robot to a point on its live map. */
29341
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29342
- /**
29343
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29344
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29345
- */
29346
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29347
- /**
29348
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29349
- * unsupported action ids are rejected by the provider.
29350
- */
29351
- runAction: method(object({
29352
- deviceId: number(),
29353
- actionId: NavigationActionIdSchema
29354
- }), _void(), { kind: "mutation" }),
29355
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29356
- playSound: method(object({
29357
- deviceId: number(),
29358
- soundId: number().int()
29359
- }), _void(), { kind: "mutation" }),
29360
- /**
29361
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29362
- * works anytime, no active stream required).
29363
- */
29364
- setLightOn: method(object({
29365
- deviceId: number(),
29366
- on: boolean()
29367
- }), _void(), { kind: "mutation" }),
29368
- /**
29369
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29370
- * initial `level`. The auto/manual + level control is a CAMERA-service
29371
- * action that generally needs an active camera stream/monitor session — the
29372
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29373
- */
29374
- setLightMode: method(object({
29375
- deviceId: number(),
29376
- mode: NavigationLightModeSchema,
29377
- level: number().min(40).max(100).optional()
29378
- }), _void(), { kind: "mutation" }),
29379
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29380
- setLightLevel: method(object({
29381
- deviceId: number(),
29382
- level: number().min(40).max(100)
29383
- }), _void(), { kind: "mutation" }),
29384
- /**
29385
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29386
- * controls the UI shows (the per-entry flags for the dictionary come back on
29387
- * `listActions`).
29388
- */
29389
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29390
- },
29391
- events: { onStatusChanged: { data: object({
29392
- deviceId: number(),
29393
- status: NavigationStatusSchema
29394
- }) } },
29395
- status: {
29396
- schema: NavigationStatusSchema,
29397
- kind: "push"
29398
- },
29399
- /**
29400
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29401
- * for live mode / follow / flash changes.
29402
- */
29403
- runtimeState: NavigationRuntimeStateSchema,
29404
- /**
29405
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29406
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29407
- * that. The live handle re-publishes on connect.
29408
- *
29409
- * See `RuntimeStateDurability`. Enforced by
29410
- * `scripts/check-runtime-state-durability.ts`.
29411
- */
29412
- durability: "session"
29413
- };
29414
29541
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29415
29542
  kind: "mutation",
29416
29543
  auth: "admin"
@@ -38867,13 +38994,13 @@ Object.freeze({
38867
38994
  addonId: null,
38868
38995
  access: "view"
38869
38996
  },
38870
- "storage.getDefaultLocation": {
38997
+ "storage.list": {
38871
38998
  capName: "storage",
38872
38999
  capScope: "system",
38873
39000
  addonId: null,
38874
39001
  access: "view"
38875
39002
  },
38876
- "storage.list": {
39003
+ "storage.listDrainProgress": {
38877
39004
  capName: "storage",
38878
39005
  capScope: "system",
38879
39006
  addonId: null,
@@ -39023,6 +39150,12 @@ Object.freeze({
39023
39150
  addonId: null,
39024
39151
  access: "view"
39025
39152
  },
39153
+ "storageOccupancy.getOccupancy": {
39154
+ capName: "storage-occupancy",
39155
+ capScope: "system",
39156
+ addonId: null,
39157
+ access: "view"
39158
+ },
39026
39159
  "storageProvider.abortUpload": {
39027
39160
  capName: "storage-provider",
39028
39161
  capScope: "system",