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