@camstack/addon-provider-wyze 0.2.82 → 0.2.84

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
@@ -10,7 +10,7 @@ import { getCACertificates, setDefaultCACertificates } from "node:tls";
10
10
  //#region \0rolldown/runtime.js
11
11
  var __require$1 = /* @__PURE__ */ createRequire(import.meta.url);
12
12
  //#endregion
13
- //#region ../types/dist/event-category-zAv7pMUz.mjs
13
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
14
14
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
15
15
  EventCategory["SystemBoot"] = "system.boot";
16
16
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -205,6 +205,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
205
205
  EventCategory["ProcessCrashed"] = "process.crashed";
206
206
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
207
207
  EventCategory["ProcessRestarted"] = "process.restarted";
208
+ /**
209
+ * The SET of storage locations changed — one was created, edited, enabled,
210
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
211
+ *
212
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
213
+ * it must also converge on its own periodic path, because a dropped event
214
+ * must not leave a node writing to yesterday's disk set forever. It exists
215
+ * because there was NO signal at all — an operator who added a second
216
+ * recordings disk in the admin UI got nothing, and the recorder kept its
217
+ * resolved locations until something else happened to re-resolve them
218
+ * (D387). Payload `StorageLocationsChangedPayload`.
219
+ */
220
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
208
221
  EventCategory["RecordingStarted"] = "recording.started";
209
222
  EventCategory["RecordingStopped"] = "recording.stopped";
210
223
  EventCategory["RecordingError"] = "recording.error";
@@ -7626,111 +7639,6 @@ var CameraSwitchGroupSchema = object({
7626
7639
  fetchedAt: number()
7627
7640
  });
7628
7641
  /**
7629
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7630
- * an addon declares its channels in.
7631
- *
7632
- * ## Two axes, deliberately separated
7633
- *
7634
- * - **DECLARATION** — which channels exist. Only the addon knows:
7635
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7636
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7637
- * and rots silently. So a channel is declared where it is consulted, and the
7638
- * `log-channels` capability enumerates the declarations.
7639
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7640
- * thing: the logging settings document on the `system` cap. Two authorities
7641
- * over the values is the exact defect
7642
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7643
- * remove; re-introducing it from the cure side would be grotesque.
7644
- *
7645
- * Nothing in this file reads a clock, an env var or a store. The registry is
7646
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7647
- * the hot path with a value somebody actually read, and by
7648
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7649
- * never reaches here, so it can neither disarm an armed channel nor arm a
7650
- * disarmed one (D49).
7651
- *
7652
- * ## The canonical call shape
7653
- *
7654
- * ```ts
7655
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7656
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7657
- * }
7658
- * ```
7659
- *
7660
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7661
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7662
- * object literal is never constructed because it lives inside the branch. It
7663
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7664
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7665
- * destination floor (measured at 1.93 ns/call when off).
7666
- *
7667
- * ## Why a channel emits at `info`
7668
- *
7669
- * `loki-logging.addon.ts` pins the destination default at `info` and
7670
- * `loki-destination.ts` drops everything below it, so a line emitted at
7671
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7672
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7673
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7674
- * emits at the channel's declared level, whose schema floor is `info`.
7675
- */
7676
- /**
7677
- * The level a channel writes at once armed.
7678
- *
7679
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7680
- * not leave the process for Loki, and the whole point of arming a channel is
7681
- * to read it later.
7682
- */
7683
- var LogChannelLevelSchema = _enum([
7684
- "info",
7685
- "warn",
7686
- "error"
7687
- ]);
7688
- /**
7689
- * What an addon declares about one channel. No value, no state — a
7690
- * declaration is inert.
7691
- */
7692
- var LogChannelDescriptorSchema = object({
7693
- /**
7694
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7695
- * the addon's short name so an operator reading a channel list can tell who
7696
- * owns it without a second lookup.
7697
- */
7698
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7699
- /** One sentence: what the operator will SEE after arming it. */
7700
- description: string().min(1),
7701
- /** The level its lines are emitted at. Never below `info`. */
7702
- defaultLevel: LogChannelLevelSchema,
7703
- /**
7704
- * Whether this channel can be narrowed to a camera.
7705
- *
7706
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7707
- * consulted with the numeric device id, AND every line the channel admits
7708
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7709
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7710
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7711
- * the body is the only way to filter.
7712
- *
7713
- * A channel whose lines carry the device only in `meta` (or not at all) is
7714
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7715
- * the operator narrows to one camera, sees nothing, and concludes the code
7716
- * path was never taken.
7717
- */
7718
- perDevice: boolean()
7719
- });
7720
- /**
7721
- * An armed window over one channel, as the document hands it to a mirror.
7722
- *
7723
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7724
- * expires by itself, which is the one failure a boolean cannot avoid.
7725
- */
7726
- var LogChannelWindowSchema = object({
7727
- channel: string().min(1),
7728
- /** Epoch ms the window closes at. */
7729
- armedUntilMs: number(),
7730
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7731
- deviceIds: array(number().int()).readonly().nullable()
7732
- });
7733
- /**
7734
7642
  * Ops-log — the durable, append-only operations audit shared by the
7735
7643
  * recordings and events management surfaces.
7736
7644
  *
@@ -8652,6 +8560,21 @@ var StorageCleanupJobSchema = object({
8652
8560
  });
8653
8561
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8654
8562
  /**
8563
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8564
+ * alias below is `z.infer<>` of it, never a second spelling.
8565
+ */
8566
+ var StorageLocationModeSchema = _enum([
8567
+ "active",
8568
+ "readonly",
8569
+ "drain",
8570
+ "disabled"
8571
+ ]);
8572
+ _enum([
8573
+ "normal",
8574
+ "never",
8575
+ "drain"
8576
+ ]);
8577
+ /**
8655
8578
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8656
8579
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8657
8580
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8676,8 +8599,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8676
8599
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8677
8600
  *
8678
8601
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8679
- * The default location for a type uses `id === <type>:default` by
8680
- * convention (the bare type ref like `'backups'` resolves to it).
8602
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8603
+ * There is no default location any more (D383): `enabled` is the whole write
8604
+ * model, and a bare type ref resolves to the sole location of the type, or —
8605
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8606
+ * slug is `default`.
8681
8607
  *
8682
8608
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8683
8609
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8698,23 +8624,37 @@ var StorageLocationSchema = object({
8698
8624
  * flag at upsert time, not here (the schema is provider-agnostic).
8699
8625
  */
8700
8626
  nodeId: string().optional(),
8701
- isDefault: boolean().default(false),
8702
8627
  isSystem: boolean().default(false),
8703
8628
  /**
8704
- * Operator opt-in: whether consumers that BALANCE across several locations
8705
- * of a type may write here. Recordings reads it today; event media and
8706
- * backups are the next consumers, which is why the flag lives on the
8707
- * location rather than in any one addon's store — nothing has to be
8708
- * extended to add the next consumer.
8629
+ * THE write switch, and the only one (D383). `enabled: true` means every
8630
+ * consumer that chooses a write target for this type may write here, and all
8631
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8632
+ * still read, still played back, still age-swept, still drained, never
8633
+ * written.
8709
8634
  *
8710
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8711
- * flag existed reads back with no flag and keeps working exactly as before;
8712
- * that is the whole compat story, and it is why no migration ships with it.
8713
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8714
- * disk must not silently start writing to it); the default of a type is
8715
- * always stamped `true`.
8635
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8636
+ * stored" on an update and "born inert unless it is the first location of its
8637
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8638
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8639
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8640
+ * stops existing rather than being re-derived on every read.
8716
8641
  */
8717
8642
  enabled: boolean().optional(),
8643
+ /**
8644
+ * THE state of this location (D385), and the only authority on what may be
8645
+ * written, read or evicted here. Interpreted in exactly one place —
8646
+ * `storage-location-mode.ts` — which also folds the legacy
8647
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8648
+ * ambiguous.
8649
+ *
8650
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8651
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8652
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8653
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8654
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8655
+ * either, so the two cannot disagree.
8656
+ */
8657
+ mode: StorageLocationModeSchema.optional(),
8718
8658
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8719
8659
  * for node-local locations it can reach) — never persisted, absent when the
8720
8660
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8722,13 +8662,50 @@ var StorageLocationSchema = object({
8722
8662
  totalBytes: number(),
8723
8663
  availableBytes: number()
8724
8664
  }).nullable().optional(),
8665
+ /**
8666
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8667
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8668
+ * never persisted, never a filesystem walk.
8669
+ *
8670
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8671
+ * location yet — nobody stores here, the owning addon is down, or the first
8672
+ * refresh has not completed. A UI must omit the segment rather than draw it
8673
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8674
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8675
+ * be spelled out loud instead of appearing by accident.
8676
+ *
8677
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8678
+ * about the whole figure rather than about its freshest part.
8679
+ */
8680
+ owned: object({
8681
+ bytes: number().int().nonnegative(),
8682
+ measuredAtMs: number().int().nonnegative()
8683
+ }).optional(),
8725
8684
  createdAt: number(),
8726
8685
  updatedAt: number()
8727
8686
  });
8687
+ object({ isDefault: boolean().optional() });
8688
+ /**
8689
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8690
+ *
8691
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8692
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8693
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8694
+ * operator learns not to believe the screen.
8695
+ */
8696
+ var StorageDrainProgressSchema = object({
8697
+ locationId: string(),
8698
+ startedAtMs: number(),
8699
+ startBytes: number(),
8700
+ bytesRemaining: number(),
8701
+ drained: boolean(),
8702
+ estimatedEmptyAtMs: number().nullable()
8703
+ });
8728
8704
  /**
8729
8705
  * Reference accepted by consumer-facing `api.storage.*` calls.
8730
8706
  * Either:
8731
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8707
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8708
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8732
8709
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8733
8710
  *
8734
8711
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8904,6 +8881,111 @@ var DecoderSessionConfigSchema = object({
8904
8881
  */
8905
8882
  debug: boolean().optional()
8906
8883
  });
8884
+ /**
8885
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8886
+ * an addon declares its channels in.
8887
+ *
8888
+ * ## Two axes, deliberately separated
8889
+ *
8890
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8891
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8892
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8893
+ * and rots silently. So a channel is declared where it is consulted, and the
8894
+ * `log-channels` capability enumerates the declarations.
8895
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8896
+ * thing: the logging settings document on the `system` cap. Two authorities
8897
+ * over the values is the exact defect
8898
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8899
+ * remove; re-introducing it from the cure side would be grotesque.
8900
+ *
8901
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8902
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8903
+ * the hot path with a value somebody actually read, and by
8904
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8905
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8906
+ * disarmed one (D49).
8907
+ *
8908
+ * ## The canonical call shape
8909
+ *
8910
+ * ```ts
8911
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8912
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8913
+ * }
8914
+ * ```
8915
+ *
8916
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8917
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8918
+ * object literal is never constructed because it lives inside the branch. It
8919
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8920
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8921
+ * destination floor (measured at 1.93 ns/call when off).
8922
+ *
8923
+ * ## Why a channel emits at `info`
8924
+ *
8925
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8926
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8927
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8928
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8929
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8930
+ * emits at the channel's declared level, whose schema floor is `info`.
8931
+ */
8932
+ /**
8933
+ * The level a channel writes at once armed.
8934
+ *
8935
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8936
+ * not leave the process for Loki, and the whole point of arming a channel is
8937
+ * to read it later.
8938
+ */
8939
+ var LogChannelLevelSchema = _enum([
8940
+ "info",
8941
+ "warn",
8942
+ "error"
8943
+ ]);
8944
+ /**
8945
+ * What an addon declares about one channel. No value, no state — a
8946
+ * declaration is inert.
8947
+ */
8948
+ var LogChannelDescriptorSchema = object({
8949
+ /**
8950
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8951
+ * the addon's short name so an operator reading a channel list can tell who
8952
+ * owns it without a second lookup.
8953
+ */
8954
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8955
+ /** One sentence: what the operator will SEE after arming it. */
8956
+ description: string().min(1),
8957
+ /** The level its lines are emitted at. Never below `info`. */
8958
+ defaultLevel: LogChannelLevelSchema,
8959
+ /**
8960
+ * Whether this channel can be narrowed to a camera.
8961
+ *
8962
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8963
+ * consulted with the numeric device id, AND every line the channel admits
8964
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8965
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8966
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8967
+ * the body is the only way to filter.
8968
+ *
8969
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8970
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8971
+ * the operator narrows to one camera, sees nothing, and concludes the code
8972
+ * path was never taken.
8973
+ */
8974
+ perDevice: boolean()
8975
+ });
8976
+ /**
8977
+ * An armed window over one channel, as the document hands it to a mirror.
8978
+ *
8979
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8980
+ * expires by itself, which is the one failure a boolean cannot avoid.
8981
+ */
8982
+ var LogChannelWindowSchema = object({
8983
+ channel: string().min(1),
8984
+ /** Epoch ms the window closes at. */
8985
+ armedUntilMs: number(),
8986
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8987
+ deviceIds: array(number().int()).readonly().nullable()
8988
+ });
8907
8989
  var MODEL_FORMATS = [
8908
8990
  "onnx",
8909
8991
  "coreml",
@@ -22057,7 +22139,7 @@ method(object({
22057
22139
  downloadId: string(),
22058
22140
  offset: number(),
22059
22141
  length: number()
22060
- }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _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({
22142
+ }), _instanceof(Uint8Array)), method(object({ downloadId: string() }), _void(), { kind: "mutation" }), method(object({ type: StorageLocationTypeSchema.optional() }), array(StorageLocationSchema).readonly()), method(_void(), array(StorageLocationDeclarationSchema).readonly()), method(StorageLocationSchema.omit({
22061
22143
  createdAt: true,
22062
22144
  updatedAt: true
22063
22145
  }), StorageLocationSchema, {
@@ -22069,7 +22151,7 @@ method(object({
22069
22151
  }), _void(), {
22070
22152
  kind: "mutation",
22071
22153
  auth: "admin"
22072
- }), method(object({ id: string() }), object({
22154
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22073
22155
  ok: boolean(),
22074
22156
  error: string().optional()
22075
22157
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22139,6 +22221,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22139
22221
  kind: "mutation",
22140
22222
  auth: "admin"
22141
22223
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22224
+ /**
22225
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22226
+ * location (D388).
22227
+ *
22228
+ * ## Why this is not `storage-evictable`
22229
+ *
22230
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22231
+ * not, in two ways that both matter and both bite hardest on the locations an
22232
+ * operator most wants a figure for:
22233
+ *
22234
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22235
+ * and `recordingsLow:default` deliberately share one root and evict as one
22236
+ * oldest-first pool, so both answer with the SAME combined total. As an
22237
+ * occupancy figure that double-counts the disk.
22238
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22239
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22240
+ * is retiring and staring at.
22241
+ *
22242
+ * So this is its own contract with its own quantity, and the quantity is
22243
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22244
+ * would ever be willing to delete it. A provider that can only answer
22245
+ * "evictable" must not register here — a number that silently means different
22246
+ * things per class is worse than no number.
22247
+ *
22248
+ * ## Absence is an answer
22249
+ *
22250
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22251
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22252
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22253
+ * consuming side has to be written out loud instead of appearing by accident.
22254
+ *
22255
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22256
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22257
+ */
22258
+ /** One provider's occupancy answer for one location. */
22259
+ var StorageOccupancyReportSchema = object({
22260
+ locationId: string(),
22261
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22262
+ * not net of what it is willing to delete. */
22263
+ ownedBytes: number().int().nonnegative(),
22264
+ /** When the provider last actually measured this. The orchestrator carries it
22265
+ * through so a UI can say how old the figure is instead of implying "now". */
22266
+ measuredAtMs: number().int().nonnegative()
22267
+ });
22268
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22142
22269
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22143
22270
  providerId: string().min(1),
22144
22271
  displayName: string().min(1),
@@ -23974,88 +24101,6 @@ onStatusChanged: { data: object({
23974
24101
  volatileStateFields: ["lastUpdated"]
23975
24102
  };
23976
24103
  /**
23977
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23978
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23979
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23980
- * one Home Assistant projection.
23981
- */
23982
- var NetworkLinkStatusSchema = object({
23983
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23984
- type: _enum([
23985
- "wifi",
23986
- "ethernet",
23987
- "cellular",
23988
- "unknown"
23989
- ]),
23990
- /**
23991
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23992
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23993
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23994
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23995
- * SKIP a null rather than coerce it.
23996
- */
23997
- signalPercent: number().min(0).max(100).nullable(),
23998
- /** Raw received signal strength in dBm, when the firmware reports one. */
23999
- rssiDbm: number().optional(),
24000
- /** Network name of a wireless link, when the firmware reports it. */
24001
- ssid: string().optional(),
24002
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24003
- lastUpdated: number()
24004
- });
24005
- var networkLinkCapability = {
24006
- name: "network-link",
24007
- scope: "device",
24008
- deviceNative: true,
24009
- mode: "singleton",
24010
- deviceTypes: [
24011
- DeviceType.Camera,
24012
- DeviceType.Sensor,
24013
- DeviceType.Button,
24014
- DeviceType.Switch,
24015
- DeviceType.Light,
24016
- DeviceType.Lock,
24017
- DeviceType.Siren
24018
- ],
24019
- methods: {},
24020
- events: {
24021
- /**
24022
- * Emitted whenever the cached status changes (a link switch, a signal
24023
- * reading that moved). Mirrored on the parent chain by the
24024
- * DeviceEventPropagator like `battery.onStatusChanged`.
24025
- */
24026
- onStatusChanged: { data: object({
24027
- deviceId: number(),
24028
- status: NetworkLinkStatusSchema
24029
- }) } },
24030
- status: {
24031
- schema: NetworkLinkStatusSchema,
24032
- kind: "push",
24033
- empty: {
24034
- type: "unknown",
24035
- signalPercent: null,
24036
- lastUpdated: 0
24037
- }
24038
- },
24039
- /**
24040
- * Runtime-state slice — every provider stores the same shape under
24041
- * `device.runtimeState['network-link']`, read once by the badge and the
24042
- * Home Assistant projector regardless of the driver.
24043
- */
24044
- runtimeState: NetworkLinkStatusSchema,
24045
- /**
24046
- * Runtime-state durability: **restored** — a link reading is slow to
24047
- * change and a sleeping battery camera may not report for hours; the
24048
- * restored slice is what the badge shows until the next read.
24049
- *
24050
- * See `RuntimeStateDurability`. Enforced by
24051
- * `scripts/check-runtime-state-durability.ts`.
24052
- */
24053
- durability: "restored",
24054
- /** Clock fields: written, but excluded from the compare that decides
24055
- * whether persisting is worth a SQLite commit. */
24056
- volatileStateFields: ["lastUpdated"]
24057
- };
24058
- /**
24059
24104
  * Generic boolean sensor — last-resort fallback when no domain-
24060
24105
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24061
24106
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27593,6 +27638,369 @@ var nativeObjectDetectionCapability = {
27593
27638
  volatileStateFields: ["lastFetchedAt"]
27594
27639
  };
27595
27640
  /**
27641
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27642
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27643
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27644
+ *
27645
+ * Why a NEW cap rather than overloading `ptz`:
27646
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27647
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27648
+ * The two are different physical models: PTZ is absolute-position + presets,
27649
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27650
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27651
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27652
+ * the reverse:
27653
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27654
+ * / `getOptions`), and
27655
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27656
+ * robot camera shows up in the existing PTZ control path without every
27657
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27658
+ * not here (see the addon design note):
27659
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27660
+ * ptz.stop() → navigation.stop()
27661
+ * ptz.goHome() → navigation.runAction('goHome')
27662
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27663
+ * ptz.goToPreset(id) → navigation.runAction(id)
27664
+ *
27665
+ * ## Continuous drive
27666
+ *
27667
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27668
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27669
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27670
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27671
+ * coalesce them. The UI owns the cadence.
27672
+ *
27673
+ * ## The action dictionary
27674
+ *
27675
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27676
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27677
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27678
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27679
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27680
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27681
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27682
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27683
+ *
27684
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27685
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27686
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27687
+ * every device handle. A future nodedreame publish adds a typed
27688
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27689
+ * provider can then swap the raw calls for the typed methods with no change to
27690
+ * THIS contract.
27691
+ */
27692
+ /**
27693
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27694
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27695
+ * halts it.
27696
+ *
27697
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27698
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27699
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27700
+ * vector by it (drivers without proportional drive ignore it).
27701
+ *
27702
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27703
+ * axis alone; an all-undefined nudge is a no-op.
27704
+ */
27705
+ var NavigationMoveCommandSchema = object({
27706
+ pan: number().min(-1).max(1).optional(),
27707
+ tilt: number().min(-1).max(1).optional(),
27708
+ speed: number().min(0).max(1).optional()
27709
+ });
27710
+ /**
27711
+ * The enumerated discrete actions a navigation-capable robot can perform via
27712
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27713
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27714
+ * `playSound` (see the `sound` dictionary entries).
27715
+ */
27716
+ var NavigationActionIdSchema = _enum([
27717
+ "goHome",
27718
+ "locate",
27719
+ "spotClean",
27720
+ "findPet",
27721
+ "personFollow",
27722
+ "stop",
27723
+ "startClean",
27724
+ "pauseClean",
27725
+ "dockWash",
27726
+ "autoEmpty",
27727
+ "flashOn",
27728
+ "flashOff"
27729
+ ]);
27730
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27731
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27732
+ /**
27733
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27734
+ * native panel and the PTZ mimic render as a button.
27735
+ *
27736
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27737
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27738
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27739
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27740
+ * - `label` — operator-facing English label.
27741
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27742
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27743
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27744
+ * flips it from config, never by editing code.
27745
+ */
27746
+ var NavigationActionEntrySchema = object({
27747
+ id: string(),
27748
+ kind: NavigationEntryKindSchema,
27749
+ label: string(),
27750
+ icon: string(),
27751
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27752
+ soundId: number().int().optional(),
27753
+ /** Per-device feature flag — render this entry only when true. */
27754
+ enabled: boolean()
27755
+ });
27756
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27757
+ var NavigationPointSchema = object({
27758
+ x: number(),
27759
+ y: number()
27760
+ });
27761
+ /**
27762
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27763
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27764
+ * that are turned on for THIS device. Data-driven: the provider derives these
27765
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27766
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27767
+ * that are not dictionary entries.
27768
+ *
27769
+ * - `move` / `stop` — the momentary drive joystick.
27770
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27771
+ * map-coordinate plumbing is wired.
27772
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27773
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27774
+ * - `light` — the on/off fill-light toggle (works anytime).
27775
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27776
+ * camera-service control; needs an active stream).
27777
+ */
27778
+ var NavigationFeaturesSchema = object({
27779
+ move: boolean(),
27780
+ stop: boolean(),
27781
+ goToPoint: boolean(),
27782
+ runAction: boolean(),
27783
+ playSound: boolean(),
27784
+ light: boolean(),
27785
+ lightMode: boolean()
27786
+ });
27787
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27788
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27789
+ /**
27790
+ * Live navigation state so the UI can reflect what the robot is doing:
27791
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27792
+ * - `following` — person/pet follow is currently armed.
27793
+ * - `flash` — the on-camera fill light is on.
27794
+ * - `lightMode` — auto vs manual fill-light mode.
27795
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27796
+ * `lightMode === 'manual'`.
27797
+ */
27798
+ var NavigationStatusSchema = object({
27799
+ mode: _enum([
27800
+ "idle",
27801
+ "cleaning",
27802
+ "spot",
27803
+ "following",
27804
+ "goto",
27805
+ "returning",
27806
+ "paused",
27807
+ "unknown"
27808
+ ]),
27809
+ following: boolean(),
27810
+ flash: boolean(),
27811
+ lightMode: NavigationLightModeSchema,
27812
+ lightLevel: number().min(40).max(100),
27813
+ /** Ms epoch when the slice was last updated. */
27814
+ lastChangedAt: number()
27815
+ });
27816
+ /**
27817
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27818
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27819
+ * convention.
27820
+ */
27821
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27822
+ var navigationCapability = {
27823
+ name: "navigation",
27824
+ scope: "device",
27825
+ deviceNative: true,
27826
+ mode: "singleton",
27827
+ deviceTypes: [DeviceType.Camera],
27828
+ deviceConfig: { ui: {
27829
+ kind: "widget",
27830
+ widgetId: "host/navigation-panel",
27831
+ tab: "navigation",
27832
+ topTab: true,
27833
+ label: "Navigation",
27834
+ order: 0
27835
+ } },
27836
+ methods: {
27837
+ /**
27838
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27839
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27840
+ * path) works for any authenticated user, not admin-only. The UI sends
27841
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27842
+ * a single drive write WITHOUT debouncing.
27843
+ */
27844
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27845
+ /** Halt all motion immediately (zero drive vector). */
27846
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27847
+ /** Send the robot to a point on its live map. */
27848
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27849
+ /**
27850
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27851
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27852
+ */
27853
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27854
+ /**
27855
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27856
+ * unsupported action ids are rejected by the provider.
27857
+ */
27858
+ runAction: method(object({
27859
+ deviceId: number(),
27860
+ actionId: NavigationActionIdSchema
27861
+ }), _void(), { kind: "mutation" }),
27862
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27863
+ playSound: method(object({
27864
+ deviceId: number(),
27865
+ soundId: number().int()
27866
+ }), _void(), { kind: "mutation" }),
27867
+ /**
27868
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27869
+ * works anytime, no active stream required).
27870
+ */
27871
+ setLightOn: method(object({
27872
+ deviceId: number(),
27873
+ on: boolean()
27874
+ }), _void(), { kind: "mutation" }),
27875
+ /**
27876
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27877
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27878
+ * action that generally needs an active camera stream/monitor session — the
27879
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27880
+ */
27881
+ setLightMode: method(object({
27882
+ deviceId: number(),
27883
+ mode: NavigationLightModeSchema,
27884
+ level: number().min(40).max(100).optional()
27885
+ }), _void(), { kind: "mutation" }),
27886
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27887
+ setLightLevel: method(object({
27888
+ deviceId: number(),
27889
+ level: number().min(40).max(100)
27890
+ }), _void(), { kind: "mutation" }),
27891
+ /**
27892
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27893
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27894
+ * `listActions`).
27895
+ */
27896
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27897
+ },
27898
+ events: { onStatusChanged: { data: object({
27899
+ deviceId: number(),
27900
+ status: NavigationStatusSchema
27901
+ }) } },
27902
+ status: {
27903
+ schema: NavigationStatusSchema,
27904
+ kind: "push"
27905
+ },
27906
+ /**
27907
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27908
+ * for live mode / follow / flash changes.
27909
+ */
27910
+ runtimeState: NavigationRuntimeStateSchema,
27911
+ /**
27912
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27913
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27914
+ * that. The live handle re-publishes on connect.
27915
+ *
27916
+ * See `RuntimeStateDurability`. Enforced by
27917
+ * `scripts/check-runtime-state-durability.ts`.
27918
+ */
27919
+ durability: "session"
27920
+ };
27921
+ /**
27922
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27923
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27924
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27925
+ * one Home Assistant projection.
27926
+ */
27927
+ var NetworkLinkStatusSchema = object({
27928
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27929
+ type: _enum([
27930
+ "wifi",
27931
+ "ethernet",
27932
+ "cellular",
27933
+ "unknown"
27934
+ ]),
27935
+ /**
27936
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27937
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27938
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27939
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27940
+ * SKIP a null rather than coerce it.
27941
+ */
27942
+ signalPercent: number().min(0).max(100).nullable(),
27943
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27944
+ rssiDbm: number().optional(),
27945
+ /** Network name of a wireless link, when the firmware reports it. */
27946
+ ssid: string().optional(),
27947
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27948
+ lastUpdated: number()
27949
+ });
27950
+ var networkLinkCapability = {
27951
+ name: "network-link",
27952
+ scope: "device",
27953
+ deviceNative: true,
27954
+ mode: "singleton",
27955
+ deviceTypes: [
27956
+ DeviceType.Camera,
27957
+ DeviceType.Sensor,
27958
+ DeviceType.Button,
27959
+ DeviceType.Switch,
27960
+ DeviceType.Light,
27961
+ DeviceType.Lock,
27962
+ DeviceType.Siren
27963
+ ],
27964
+ methods: {},
27965
+ events: {
27966
+ /**
27967
+ * Emitted whenever the cached status changes (a link switch, a signal
27968
+ * reading that moved). Mirrored on the parent chain by the
27969
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27970
+ */
27971
+ onStatusChanged: { data: object({
27972
+ deviceId: number(),
27973
+ status: NetworkLinkStatusSchema
27974
+ }) } },
27975
+ status: {
27976
+ schema: NetworkLinkStatusSchema,
27977
+ kind: "push",
27978
+ empty: {
27979
+ type: "unknown",
27980
+ signalPercent: null,
27981
+ lastUpdated: 0
27982
+ }
27983
+ },
27984
+ /**
27985
+ * Runtime-state slice — every provider stores the same shape under
27986
+ * `device.runtimeState['network-link']`, read once by the badge and the
27987
+ * Home Assistant projector regardless of the driver.
27988
+ */
27989
+ runtimeState: NetworkLinkStatusSchema,
27990
+ /**
27991
+ * Runtime-state durability: **restored** — a link reading is slow to
27992
+ * change and a sleeping battery camera may not report for hours; the
27993
+ * restored slice is what the badge shows until the next read.
27994
+ *
27995
+ * See `RuntimeStateDurability`. Enforced by
27996
+ * `scripts/check-runtime-state-durability.ts`.
27997
+ */
27998
+ durability: "restored",
27999
+ /** Clock fields: written, but excluded from the compare that decides
28000
+ * whether persisting is worth a SQLite commit. */
28001
+ volatileStateFields: ["lastUpdated"]
28002
+ };
28003
+ /**
27596
28004
  * network-quality — system-scoped singleton capability tracking RTT,
27597
28005
  * jitter, and observed/peak bandwidth per device + per client.
27598
28006
  *
@@ -29173,287 +29581,6 @@ var ptzAutotrackCapability = {
29173
29581
  */
29174
29582
  durability: "session"
29175
29583
  };
29176
- /**
29177
- * `navigation` — a device-scoped capability that natively expresses the FULL
29178
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29179
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29180
- *
29181
- * Why a NEW cap rather than overloading `ptz`:
29182
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29183
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29184
- * The two are different physical models: PTZ is absolute-position + presets,
29185
- * navigation is momentary drive nudges + discrete robot ACTIONS
29186
- * (dock / spot-clean / follow-pet / go-to-point / …).
29187
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29188
- * the reverse:
29189
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29190
- * / `getOptions`), and
29191
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29192
- * robot camera shows up in the existing PTZ control path without every
29193
- * PTZ provider learning about robots. The mapping lives in the adapter,
29194
- * not here (see the addon design note):
29195
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29196
- * ptz.stop() → navigation.stop()
29197
- * ptz.goHome() → navigation.runAction('goHome')
29198
- * ptz.getPresets() → navigation.listActions() (id→preset)
29199
- * ptz.goToPreset(id) → navigation.runAction(id)
29200
- *
29201
- * ## Continuous drive
29202
- *
29203
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29204
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29205
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29206
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29207
- * coalesce them. The UI owns the cadence.
29208
- *
29209
- * ## The action dictionary
29210
- *
29211
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29212
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29213
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29214
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29215
- * vendor-specific list. `kind: 'action'` entries are triggered with
29216
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29217
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29218
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29219
- *
29220
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29221
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29222
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29223
- * every device handle. A future nodedreame publish adds a typed
29224
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29225
- * provider can then swap the raw calls for the typed methods with no change to
29226
- * THIS contract.
29227
- */
29228
- /**
29229
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29230
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29231
- * halts it.
29232
- *
29233
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29234
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29235
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29236
- * vector by it (drivers without proportional drive ignore it).
29237
- *
29238
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29239
- * axis alone; an all-undefined nudge is a no-op.
29240
- */
29241
- var NavigationMoveCommandSchema = object({
29242
- pan: number().min(-1).max(1).optional(),
29243
- tilt: number().min(-1).max(1).optional(),
29244
- speed: number().min(0).max(1).optional()
29245
- });
29246
- /**
29247
- * The enumerated discrete actions a navigation-capable robot can perform via
29248
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29249
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29250
- * `playSound` (see the `sound` dictionary entries).
29251
- */
29252
- var NavigationActionIdSchema = _enum([
29253
- "goHome",
29254
- "locate",
29255
- "spotClean",
29256
- "findPet",
29257
- "personFollow",
29258
- "stop",
29259
- "startClean",
29260
- "pauseClean",
29261
- "dockWash",
29262
- "autoEmpty",
29263
- "flashOn",
29264
- "flashOff"
29265
- ]);
29266
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29267
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29268
- /**
29269
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29270
- * native panel and the PTZ mimic render as a button.
29271
- *
29272
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29273
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29274
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29275
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29276
- * - `label` — operator-facing English label.
29277
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29278
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29279
- * PTZ render ONLY enabled entries. Data-driven: the provider
29280
- * flips it from config, never by editing code.
29281
- */
29282
- var NavigationActionEntrySchema = object({
29283
- id: string(),
29284
- kind: NavigationEntryKindSchema,
29285
- label: string(),
29286
- icon: string(),
29287
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29288
- soundId: number().int().optional(),
29289
- /** Per-device feature flag — render this entry only when true. */
29290
- enabled: boolean()
29291
- });
29292
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29293
- var NavigationPointSchema = object({
29294
- x: number(),
29295
- y: number()
29296
- });
29297
- /**
29298
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29299
- * The cap reports which are enabled so the UI / PTZ render only the controls
29300
- * that are turned on for THIS device. Data-driven: the provider derives these
29301
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29302
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29303
- * that are not dictionary entries.
29304
- *
29305
- * - `move` / `stop` — the momentary drive joystick.
29306
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29307
- * map-coordinate plumbing is wired.
29308
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29309
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29310
- * - `light` — the on/off fill-light toggle (works anytime).
29311
- * - `lightMode` — the auto/manual selector + manual level slider (a
29312
- * camera-service control; needs an active stream).
29313
- */
29314
- var NavigationFeaturesSchema = object({
29315
- move: boolean(),
29316
- stop: boolean(),
29317
- goToPoint: boolean(),
29318
- runAction: boolean(),
29319
- playSound: boolean(),
29320
- light: boolean(),
29321
- lightMode: boolean()
29322
- });
29323
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29324
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29325
- /**
29326
- * Live navigation state so the UI can reflect what the robot is doing:
29327
- * - `mode` — coarse activity (idle / cleaning / following / …).
29328
- * - `following` — person/pet follow is currently armed.
29329
- * - `flash` — the on-camera fill light is on.
29330
- * - `lightMode` — auto vs manual fill-light mode.
29331
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29332
- * `lightMode === 'manual'`.
29333
- */
29334
- var NavigationStatusSchema = object({
29335
- mode: _enum([
29336
- "idle",
29337
- "cleaning",
29338
- "spot",
29339
- "following",
29340
- "goto",
29341
- "returning",
29342
- "paused",
29343
- "unknown"
29344
- ]),
29345
- following: boolean(),
29346
- flash: boolean(),
29347
- lightMode: NavigationLightModeSchema,
29348
- lightLevel: number().min(40).max(100),
29349
- /** Ms epoch when the slice was last updated. */
29350
- lastChangedAt: number()
29351
- });
29352
- /**
29353
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29354
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29355
- * convention.
29356
- */
29357
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29358
- var navigationCapability = {
29359
- name: "navigation",
29360
- scope: "device",
29361
- deviceNative: true,
29362
- mode: "singleton",
29363
- deviceTypes: [DeviceType.Camera],
29364
- deviceConfig: { ui: {
29365
- kind: "widget",
29366
- widgetId: "host/navigation-panel",
29367
- tab: "navigation",
29368
- topTab: true,
29369
- label: "Navigation",
29370
- order: 0
29371
- } },
29372
- methods: {
29373
- /**
29374
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29375
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29376
- * path) works for any authenticated user, not admin-only. The UI sends
29377
- * these at ~1 Hz while a control is held; the provider forwards each one to
29378
- * a single drive write WITHOUT debouncing.
29379
- */
29380
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29381
- /** Halt all motion immediately (zero drive vector). */
29382
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29383
- /** Send the robot to a point on its live map. */
29384
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29385
- /**
29386
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29387
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29388
- */
29389
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29390
- /**
29391
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29392
- * unsupported action ids are rejected by the provider.
29393
- */
29394
- runAction: method(object({
29395
- deviceId: number(),
29396
- actionId: NavigationActionIdSchema
29397
- }), _void(), { kind: "mutation" }),
29398
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29399
- playSound: method(object({
29400
- deviceId: number(),
29401
- soundId: number().int()
29402
- }), _void(), { kind: "mutation" }),
29403
- /**
29404
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29405
- * works anytime, no active stream required).
29406
- */
29407
- setLightOn: method(object({
29408
- deviceId: number(),
29409
- on: boolean()
29410
- }), _void(), { kind: "mutation" }),
29411
- /**
29412
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29413
- * initial `level`. The auto/manual + level control is a CAMERA-service
29414
- * action that generally needs an active camera stream/monitor session — the
29415
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29416
- */
29417
- setLightMode: method(object({
29418
- deviceId: number(),
29419
- mode: NavigationLightModeSchema,
29420
- level: number().min(40).max(100).optional()
29421
- }), _void(), { kind: "mutation" }),
29422
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29423
- setLightLevel: method(object({
29424
- deviceId: number(),
29425
- level: number().min(40).max(100)
29426
- }), _void(), { kind: "mutation" }),
29427
- /**
29428
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29429
- * controls the UI shows (the per-entry flags for the dictionary come back on
29430
- * `listActions`).
29431
- */
29432
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29433
- },
29434
- events: { onStatusChanged: { data: object({
29435
- deviceId: number(),
29436
- status: NavigationStatusSchema
29437
- }) } },
29438
- status: {
29439
- schema: NavigationStatusSchema,
29440
- kind: "push"
29441
- },
29442
- /**
29443
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29444
- * for live mode / follow / flash changes.
29445
- */
29446
- runtimeState: NavigationRuntimeStateSchema,
29447
- /**
29448
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29449
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29450
- * that. The live handle re-publishes on connect.
29451
- *
29452
- * See `RuntimeStateDurability`. Enforced by
29453
- * `scripts/check-runtime-state-durability.ts`.
29454
- */
29455
- durability: "session"
29456
- };
29457
29584
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29458
29585
  kind: "mutation",
29459
29586
  auth: "admin"
@@ -38910,13 +39037,13 @@ Object.freeze({
38910
39037
  addonId: null,
38911
39038
  access: "view"
38912
39039
  },
38913
- "storage.getDefaultLocation": {
39040
+ "storage.list": {
38914
39041
  capName: "storage",
38915
39042
  capScope: "system",
38916
39043
  addonId: null,
38917
39044
  access: "view"
38918
39045
  },
38919
- "storage.list": {
39046
+ "storage.listDrainProgress": {
38920
39047
  capName: "storage",
38921
39048
  capScope: "system",
38922
39049
  addonId: null,
@@ -39066,6 +39193,12 @@ Object.freeze({
39066
39193
  addonId: null,
39067
39194
  access: "view"
39068
39195
  },
39196
+ "storageOccupancy.getOccupancy": {
39197
+ capName: "storage-occupancy",
39198
+ capScope: "system",
39199
+ addonId: null,
39200
+ access: "view"
39201
+ },
39069
39202
  "storageProvider.abortUpload": {
39070
39203
  capName: "storage-provider",
39071
39204
  capScope: "system",