@camstack/addon-provider-dreo 0.2.78 → 0.2.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +621 -488
  2. package/dist/addon.mjs +621 -488
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -35,7 +35,7 @@ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["modu
35
35
  //#endregion
36
36
  let crypto$1 = require("crypto");
37
37
  let events = require("events");
38
- //#region ../types/dist/event-category-zAv7pMUz.mjs
38
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
39
39
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
40
40
  EventCategory["SystemBoot"] = "system.boot";
41
41
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -230,6 +230,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
230
230
  EventCategory["ProcessCrashed"] = "process.crashed";
231
231
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
232
232
  EventCategory["ProcessRestarted"] = "process.restarted";
233
+ /**
234
+ * The SET of storage locations changed — one was created, edited, enabled,
235
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
236
+ *
237
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
238
+ * it must also converge on its own periodic path, because a dropped event
239
+ * must not leave a node writing to yesterday's disk set forever. It exists
240
+ * because there was NO signal at all — an operator who added a second
241
+ * recordings disk in the admin UI got nothing, and the recorder kept its
242
+ * resolved locations until something else happened to re-resolve them
243
+ * (D387). Payload `StorageLocationsChangedPayload`.
244
+ */
245
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
233
246
  EventCategory["RecordingStarted"] = "recording.started";
234
247
  EventCategory["RecordingStopped"] = "recording.stopped";
235
248
  EventCategory["RecordingError"] = "recording.error";
@@ -7651,111 +7664,6 @@ var CameraSwitchGroupSchema = object({
7651
7664
  fetchedAt: number()
7652
7665
  });
7653
7666
  /**
7654
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7655
- * an addon declares its channels in.
7656
- *
7657
- * ## Two axes, deliberately separated
7658
- *
7659
- * - **DECLARATION** — which channels exist. Only the addon knows:
7660
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7661
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7662
- * and rots silently. So a channel is declared where it is consulted, and the
7663
- * `log-channels` capability enumerates the declarations.
7664
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7665
- * thing: the logging settings document on the `system` cap. Two authorities
7666
- * over the values is the exact defect
7667
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7668
- * remove; re-introducing it from the cure side would be grotesque.
7669
- *
7670
- * Nothing in this file reads a clock, an env var or a store. The registry is
7671
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7672
- * the hot path with a value somebody actually read, and by
7673
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7674
- * never reaches here, so it can neither disarm an armed channel nor arm a
7675
- * disarmed one (D49).
7676
- *
7677
- * ## The canonical call shape
7678
- *
7679
- * ```ts
7680
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7681
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7682
- * }
7683
- * ```
7684
- *
7685
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7686
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7687
- * object literal is never constructed because it lives inside the branch. It
7688
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7689
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7690
- * destination floor (measured at 1.93 ns/call when off).
7691
- *
7692
- * ## Why a channel emits at `info`
7693
- *
7694
- * `loki-logging.addon.ts` pins the destination default at `info` and
7695
- * `loki-destination.ts` drops everything below it, so a line emitted at
7696
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7697
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7698
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7699
- * emits at the channel's declared level, whose schema floor is `info`.
7700
- */
7701
- /**
7702
- * The level a channel writes at once armed.
7703
- *
7704
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7705
- * not leave the process for Loki, and the whole point of arming a channel is
7706
- * to read it later.
7707
- */
7708
- var LogChannelLevelSchema = _enum([
7709
- "info",
7710
- "warn",
7711
- "error"
7712
- ]);
7713
- /**
7714
- * What an addon declares about one channel. No value, no state — a
7715
- * declaration is inert.
7716
- */
7717
- var LogChannelDescriptorSchema = object({
7718
- /**
7719
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7720
- * the addon's short name so an operator reading a channel list can tell who
7721
- * owns it without a second lookup.
7722
- */
7723
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7724
- /** One sentence: what the operator will SEE after arming it. */
7725
- description: string().min(1),
7726
- /** The level its lines are emitted at. Never below `info`. */
7727
- defaultLevel: LogChannelLevelSchema,
7728
- /**
7729
- * Whether this channel can be narrowed to a camera.
7730
- *
7731
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7732
- * consulted with the numeric device id, AND every line the channel admits
7733
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7734
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7735
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7736
- * the body is the only way to filter.
7737
- *
7738
- * A channel whose lines carry the device only in `meta` (or not at all) is
7739
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7740
- * the operator narrows to one camera, sees nothing, and concludes the code
7741
- * path was never taken.
7742
- */
7743
- perDevice: boolean()
7744
- });
7745
- /**
7746
- * An armed window over one channel, as the document hands it to a mirror.
7747
- *
7748
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7749
- * expires by itself, which is the one failure a boolean cannot avoid.
7750
- */
7751
- var LogChannelWindowSchema = object({
7752
- channel: string().min(1),
7753
- /** Epoch ms the window closes at. */
7754
- armedUntilMs: number(),
7755
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7756
- deviceIds: array(number().int()).readonly().nullable()
7757
- });
7758
- /**
7759
7667
  * Ops-log — the durable, append-only operations audit shared by the
7760
7668
  * recordings and events management surfaces.
7761
7669
  *
@@ -8677,6 +8585,21 @@ var StorageCleanupJobSchema = object({
8677
8585
  });
8678
8586
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8679
8587
  /**
8588
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8589
+ * alias below is `z.infer<>` of it, never a second spelling.
8590
+ */
8591
+ var StorageLocationModeSchema = _enum([
8592
+ "active",
8593
+ "readonly",
8594
+ "drain",
8595
+ "disabled"
8596
+ ]);
8597
+ _enum([
8598
+ "normal",
8599
+ "never",
8600
+ "drain"
8601
+ ]);
8602
+ /**
8680
8603
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8681
8604
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8682
8605
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8701,8 +8624,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8701
8624
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8702
8625
  *
8703
8626
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8704
- * The default location for a type uses `id === <type>:default` by
8705
- * convention (the bare type ref like `'backups'` resolves to it).
8627
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8628
+ * There is no default location any more (D383): `enabled` is the whole write
8629
+ * model, and a bare type ref resolves to the sole location of the type, or —
8630
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8631
+ * slug is `default`.
8706
8632
  *
8707
8633
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8708
8634
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8723,23 +8649,37 @@ var StorageLocationSchema = object({
8723
8649
  * flag at upsert time, not here (the schema is provider-agnostic).
8724
8650
  */
8725
8651
  nodeId: string().optional(),
8726
- isDefault: boolean().default(false),
8727
8652
  isSystem: boolean().default(false),
8728
8653
  /**
8729
- * Operator opt-in: whether consumers that BALANCE across several locations
8730
- * of a type may write here. Recordings reads it today; event media and
8731
- * backups are the next consumers, which is why the flag lives on the
8732
- * location rather than in any one addon's store — nothing has to be
8733
- * extended to add the next consumer.
8654
+ * THE write switch, and the only one (D383). `enabled: true` means every
8655
+ * consumer that chooses a write target for this type may write here, and all
8656
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8657
+ * still read, still played back, still age-swept, still drained, never
8658
+ * written.
8734
8659
  *
8735
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8736
- * flag existed reads back with no flag and keeps working exactly as before;
8737
- * that is the whole compat story, and it is why no migration ships with it.
8738
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8739
- * disk must not silently start writing to it); the default of a type is
8740
- * always stamped `true`.
8660
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8661
+ * stored" on an update and "born inert unless it is the first location of its
8662
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8663
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8664
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8665
+ * stops existing rather than being re-derived on every read.
8741
8666
  */
8742
8667
  enabled: boolean().optional(),
8668
+ /**
8669
+ * THE state of this location (D385), and the only authority on what may be
8670
+ * written, read or evicted here. Interpreted in exactly one place —
8671
+ * `storage-location-mode.ts` — which also folds the legacy
8672
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8673
+ * ambiguous.
8674
+ *
8675
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8676
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8677
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8678
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8679
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8680
+ * either, so the two cannot disagree.
8681
+ */
8682
+ mode: StorageLocationModeSchema.optional(),
8743
8683
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8744
8684
  * for node-local locations it can reach) — never persisted, absent when the
8745
8685
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8747,13 +8687,50 @@ var StorageLocationSchema = object({
8747
8687
  totalBytes: number(),
8748
8688
  availableBytes: number()
8749
8689
  }).nullable().optional(),
8690
+ /**
8691
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8692
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8693
+ * never persisted, never a filesystem walk.
8694
+ *
8695
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8696
+ * location yet — nobody stores here, the owning addon is down, or the first
8697
+ * refresh has not completed. A UI must omit the segment rather than draw it
8698
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8699
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8700
+ * be spelled out loud instead of appearing by accident.
8701
+ *
8702
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8703
+ * about the whole figure rather than about its freshest part.
8704
+ */
8705
+ owned: object({
8706
+ bytes: number().int().nonnegative(),
8707
+ measuredAtMs: number().int().nonnegative()
8708
+ }).optional(),
8750
8709
  createdAt: number(),
8751
8710
  updatedAt: number()
8752
8711
  });
8712
+ object({ isDefault: boolean().optional() });
8713
+ /**
8714
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8715
+ *
8716
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8717
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8718
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8719
+ * operator learns not to believe the screen.
8720
+ */
8721
+ var StorageDrainProgressSchema = object({
8722
+ locationId: string(),
8723
+ startedAtMs: number(),
8724
+ startBytes: number(),
8725
+ bytesRemaining: number(),
8726
+ drained: boolean(),
8727
+ estimatedEmptyAtMs: number().nullable()
8728
+ });
8753
8729
  /**
8754
8730
  * Reference accepted by consumer-facing `api.storage.*` calls.
8755
8731
  * Either:
8756
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8732
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8733
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8757
8734
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8758
8735
  *
8759
8736
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8929,6 +8906,111 @@ var DecoderSessionConfigSchema = object({
8929
8906
  */
8930
8907
  debug: boolean().optional()
8931
8908
  });
8909
+ /**
8910
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8911
+ * an addon declares its channels in.
8912
+ *
8913
+ * ## Two axes, deliberately separated
8914
+ *
8915
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8916
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8917
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8918
+ * and rots silently. So a channel is declared where it is consulted, and the
8919
+ * `log-channels` capability enumerates the declarations.
8920
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8921
+ * thing: the logging settings document on the `system` cap. Two authorities
8922
+ * over the values is the exact defect
8923
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8924
+ * remove; re-introducing it from the cure side would be grotesque.
8925
+ *
8926
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8927
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8928
+ * the hot path with a value somebody actually read, and by
8929
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8930
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8931
+ * disarmed one (D49).
8932
+ *
8933
+ * ## The canonical call shape
8934
+ *
8935
+ * ```ts
8936
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8937
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8938
+ * }
8939
+ * ```
8940
+ *
8941
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8942
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8943
+ * object literal is never constructed because it lives inside the branch. It
8944
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8945
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8946
+ * destination floor (measured at 1.93 ns/call when off).
8947
+ *
8948
+ * ## Why a channel emits at `info`
8949
+ *
8950
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8951
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8952
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8953
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8954
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8955
+ * emits at the channel's declared level, whose schema floor is `info`.
8956
+ */
8957
+ /**
8958
+ * The level a channel writes at once armed.
8959
+ *
8960
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8961
+ * not leave the process for Loki, and the whole point of arming a channel is
8962
+ * to read it later.
8963
+ */
8964
+ var LogChannelLevelSchema = _enum([
8965
+ "info",
8966
+ "warn",
8967
+ "error"
8968
+ ]);
8969
+ /**
8970
+ * What an addon declares about one channel. No value, no state — a
8971
+ * declaration is inert.
8972
+ */
8973
+ var LogChannelDescriptorSchema = object({
8974
+ /**
8975
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8976
+ * the addon's short name so an operator reading a channel list can tell who
8977
+ * owns it without a second lookup.
8978
+ */
8979
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8980
+ /** One sentence: what the operator will SEE after arming it. */
8981
+ description: string().min(1),
8982
+ /** The level its lines are emitted at. Never below `info`. */
8983
+ defaultLevel: LogChannelLevelSchema,
8984
+ /**
8985
+ * Whether this channel can be narrowed to a camera.
8986
+ *
8987
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8988
+ * consulted with the numeric device id, AND every line the channel admits
8989
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8990
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8991
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8992
+ * the body is the only way to filter.
8993
+ *
8994
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8995
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8996
+ * the operator narrows to one camera, sees nothing, and concludes the code
8997
+ * path was never taken.
8998
+ */
8999
+ perDevice: boolean()
9000
+ });
9001
+ /**
9002
+ * An armed window over one channel, as the document hands it to a mirror.
9003
+ *
9004
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9005
+ * expires by itself, which is the one failure a boolean cannot avoid.
9006
+ */
9007
+ var LogChannelWindowSchema = object({
9008
+ channel: string().min(1),
9009
+ /** Epoch ms the window closes at. */
9010
+ armedUntilMs: number(),
9011
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9012
+ deviceIds: array(number().int()).readonly().nullable()
9013
+ });
8932
9014
  var MODEL_FORMATS = [
8933
9015
  "onnx",
8934
9016
  "coreml",
@@ -21978,7 +22060,7 @@ method(object({
21978
22060
  downloadId: string(),
21979
22061
  offset: number(),
21980
22062
  length: number()
21981
- }), _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({
22063
+ }), _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({
21982
22064
  createdAt: true,
21983
22065
  updatedAt: true
21984
22066
  }), StorageLocationSchema, {
@@ -21990,7 +22072,7 @@ method(object({
21990
22072
  }), _void(), {
21991
22073
  kind: "mutation",
21992
22074
  auth: "admin"
21993
- }), method(object({ id: string() }), object({
22075
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
21994
22076
  ok: boolean(),
21995
22077
  error: string().optional()
21996
22078
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22060,6 +22142,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22060
22142
  kind: "mutation",
22061
22143
  auth: "admin"
22062
22144
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22145
+ /**
22146
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22147
+ * location (D388).
22148
+ *
22149
+ * ## Why this is not `storage-evictable`
22150
+ *
22151
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22152
+ * not, in two ways that both matter and both bite hardest on the locations an
22153
+ * operator most wants a figure for:
22154
+ *
22155
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22156
+ * and `recordingsLow:default` deliberately share one root and evict as one
22157
+ * oldest-first pool, so both answer with the SAME combined total. As an
22158
+ * occupancy figure that double-counts the disk.
22159
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22160
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22161
+ * is retiring and staring at.
22162
+ *
22163
+ * So this is its own contract with its own quantity, and the quantity is
22164
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22165
+ * would ever be willing to delete it. A provider that can only answer
22166
+ * "evictable" must not register here — a number that silently means different
22167
+ * things per class is worse than no number.
22168
+ *
22169
+ * ## Absence is an answer
22170
+ *
22171
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22172
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22173
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22174
+ * consuming side has to be written out loud instead of appearing by accident.
22175
+ *
22176
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22177
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22178
+ */
22179
+ /** One provider's occupancy answer for one location. */
22180
+ var StorageOccupancyReportSchema = object({
22181
+ locationId: string(),
22182
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22183
+ * not net of what it is willing to delete. */
22184
+ ownedBytes: number().int().nonnegative(),
22185
+ /** When the provider last actually measured this. The orchestrator carries it
22186
+ * through so a UI can say how old the figure is instead of implying "now". */
22187
+ measuredAtMs: number().int().nonnegative()
22188
+ });
22189
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22063
22190
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22064
22191
  providerId: string().min(1),
22065
22192
  displayName: string().min(1),
@@ -23895,88 +24022,6 @@ onStatusChanged: { data: object({
23895
24022
  volatileStateFields: ["lastUpdated"]
23896
24023
  };
23897
24024
  /**
23898
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23899
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23900
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23901
- * one Home Assistant projection.
23902
- */
23903
- var NetworkLinkStatusSchema = object({
23904
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23905
- type: _enum([
23906
- "wifi",
23907
- "ethernet",
23908
- "cellular",
23909
- "unknown"
23910
- ]),
23911
- /**
23912
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23913
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23914
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23915
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23916
- * SKIP a null rather than coerce it.
23917
- */
23918
- signalPercent: number().min(0).max(100).nullable(),
23919
- /** Raw received signal strength in dBm, when the firmware reports one. */
23920
- rssiDbm: number().optional(),
23921
- /** Network name of a wireless link, when the firmware reports it. */
23922
- ssid: string().optional(),
23923
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23924
- lastUpdated: number()
23925
- });
23926
- var networkLinkCapability = {
23927
- name: "network-link",
23928
- scope: "device",
23929
- deviceNative: true,
23930
- mode: "singleton",
23931
- deviceTypes: [
23932
- DeviceType.Camera,
23933
- DeviceType.Sensor,
23934
- DeviceType.Button,
23935
- DeviceType.Switch,
23936
- DeviceType.Light,
23937
- DeviceType.Lock,
23938
- DeviceType.Siren
23939
- ],
23940
- methods: {},
23941
- events: {
23942
- /**
23943
- * Emitted whenever the cached status changes (a link switch, a signal
23944
- * reading that moved). Mirrored on the parent chain by the
23945
- * DeviceEventPropagator like `battery.onStatusChanged`.
23946
- */
23947
- onStatusChanged: { data: object({
23948
- deviceId: number(),
23949
- status: NetworkLinkStatusSchema
23950
- }) } },
23951
- status: {
23952
- schema: NetworkLinkStatusSchema,
23953
- kind: "push",
23954
- empty: {
23955
- type: "unknown",
23956
- signalPercent: null,
23957
- lastUpdated: 0
23958
- }
23959
- },
23960
- /**
23961
- * Runtime-state slice — every provider stores the same shape under
23962
- * `device.runtimeState['network-link']`, read once by the badge and the
23963
- * Home Assistant projector regardless of the driver.
23964
- */
23965
- runtimeState: NetworkLinkStatusSchema,
23966
- /**
23967
- * Runtime-state durability: **restored** — a link reading is slow to
23968
- * change and a sleeping battery camera may not report for hours; the
23969
- * restored slice is what the badge shows until the next read.
23970
- *
23971
- * See `RuntimeStateDurability`. Enforced by
23972
- * `scripts/check-runtime-state-durability.ts`.
23973
- */
23974
- durability: "restored",
23975
- /** Clock fields: written, but excluded from the compare that decides
23976
- * whether persisting is worth a SQLite commit. */
23977
- volatileStateFields: ["lastUpdated"]
23978
- };
23979
- /**
23980
24025
  * Generic boolean sensor — last-resort fallback when no domain-
23981
24026
  * specific binary cap fits (Home Assistant `binary_sensor` without a
23982
24027
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27514,6 +27559,369 @@ var nativeObjectDetectionCapability = {
27514
27559
  volatileStateFields: ["lastFetchedAt"]
27515
27560
  };
27516
27561
  /**
27562
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27563
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27564
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27565
+ *
27566
+ * Why a NEW cap rather than overloading `ptz`:
27567
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27568
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27569
+ * The two are different physical models: PTZ is absolute-position + presets,
27570
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27571
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27572
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27573
+ * the reverse:
27574
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27575
+ * / `getOptions`), and
27576
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27577
+ * robot camera shows up in the existing PTZ control path without every
27578
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27579
+ * not here (see the addon design note):
27580
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27581
+ * ptz.stop() → navigation.stop()
27582
+ * ptz.goHome() → navigation.runAction('goHome')
27583
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27584
+ * ptz.goToPreset(id) → navigation.runAction(id)
27585
+ *
27586
+ * ## Continuous drive
27587
+ *
27588
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27589
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27590
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27591
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27592
+ * coalesce them. The UI owns the cadence.
27593
+ *
27594
+ * ## The action dictionary
27595
+ *
27596
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27597
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27598
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27599
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27600
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27601
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27602
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27603
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27604
+ *
27605
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27606
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27607
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27608
+ * every device handle. A future nodedreame publish adds a typed
27609
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27610
+ * provider can then swap the raw calls for the typed methods with no change to
27611
+ * THIS contract.
27612
+ */
27613
+ /**
27614
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27615
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27616
+ * halts it.
27617
+ *
27618
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27619
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27620
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27621
+ * vector by it (drivers without proportional drive ignore it).
27622
+ *
27623
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27624
+ * axis alone; an all-undefined nudge is a no-op.
27625
+ */
27626
+ var NavigationMoveCommandSchema = object({
27627
+ pan: number().min(-1).max(1).optional(),
27628
+ tilt: number().min(-1).max(1).optional(),
27629
+ speed: number().min(0).max(1).optional()
27630
+ });
27631
+ /**
27632
+ * The enumerated discrete actions a navigation-capable robot can perform via
27633
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27634
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27635
+ * `playSound` (see the `sound` dictionary entries).
27636
+ */
27637
+ var NavigationActionIdSchema = _enum([
27638
+ "goHome",
27639
+ "locate",
27640
+ "spotClean",
27641
+ "findPet",
27642
+ "personFollow",
27643
+ "stop",
27644
+ "startClean",
27645
+ "pauseClean",
27646
+ "dockWash",
27647
+ "autoEmpty",
27648
+ "flashOn",
27649
+ "flashOff"
27650
+ ]);
27651
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27652
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27653
+ /**
27654
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27655
+ * native panel and the PTZ mimic render as a button.
27656
+ *
27657
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27658
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27659
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27660
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27661
+ * - `label` — operator-facing English label.
27662
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27663
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27664
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27665
+ * flips it from config, never by editing code.
27666
+ */
27667
+ var NavigationActionEntrySchema = object({
27668
+ id: string(),
27669
+ kind: NavigationEntryKindSchema,
27670
+ label: string(),
27671
+ icon: string(),
27672
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27673
+ soundId: number().int().optional(),
27674
+ /** Per-device feature flag — render this entry only when true. */
27675
+ enabled: boolean()
27676
+ });
27677
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27678
+ var NavigationPointSchema = object({
27679
+ x: number(),
27680
+ y: number()
27681
+ });
27682
+ /**
27683
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27684
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27685
+ * that are turned on for THIS device. Data-driven: the provider derives these
27686
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27687
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27688
+ * that are not dictionary entries.
27689
+ *
27690
+ * - `move` / `stop` — the momentary drive joystick.
27691
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27692
+ * map-coordinate plumbing is wired.
27693
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27694
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27695
+ * - `light` — the on/off fill-light toggle (works anytime).
27696
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27697
+ * camera-service control; needs an active stream).
27698
+ */
27699
+ var NavigationFeaturesSchema = object({
27700
+ move: boolean(),
27701
+ stop: boolean(),
27702
+ goToPoint: boolean(),
27703
+ runAction: boolean(),
27704
+ playSound: boolean(),
27705
+ light: boolean(),
27706
+ lightMode: boolean()
27707
+ });
27708
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27709
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27710
+ /**
27711
+ * Live navigation state so the UI can reflect what the robot is doing:
27712
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27713
+ * - `following` — person/pet follow is currently armed.
27714
+ * - `flash` — the on-camera fill light is on.
27715
+ * - `lightMode` — auto vs manual fill-light mode.
27716
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27717
+ * `lightMode === 'manual'`.
27718
+ */
27719
+ var NavigationStatusSchema = object({
27720
+ mode: _enum([
27721
+ "idle",
27722
+ "cleaning",
27723
+ "spot",
27724
+ "following",
27725
+ "goto",
27726
+ "returning",
27727
+ "paused",
27728
+ "unknown"
27729
+ ]),
27730
+ following: boolean(),
27731
+ flash: boolean(),
27732
+ lightMode: NavigationLightModeSchema,
27733
+ lightLevel: number().min(40).max(100),
27734
+ /** Ms epoch when the slice was last updated. */
27735
+ lastChangedAt: number()
27736
+ });
27737
+ /**
27738
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27739
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27740
+ * convention.
27741
+ */
27742
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27743
+ var navigationCapability = {
27744
+ name: "navigation",
27745
+ scope: "device",
27746
+ deviceNative: true,
27747
+ mode: "singleton",
27748
+ deviceTypes: [DeviceType.Camera],
27749
+ deviceConfig: { ui: {
27750
+ kind: "widget",
27751
+ widgetId: "host/navigation-panel",
27752
+ tab: "navigation",
27753
+ topTab: true,
27754
+ label: "Navigation",
27755
+ order: 0
27756
+ } },
27757
+ methods: {
27758
+ /**
27759
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27760
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27761
+ * path) works for any authenticated user, not admin-only. The UI sends
27762
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27763
+ * a single drive write WITHOUT debouncing.
27764
+ */
27765
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27766
+ /** Halt all motion immediately (zero drive vector). */
27767
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27768
+ /** Send the robot to a point on its live map. */
27769
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27770
+ /**
27771
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27772
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27773
+ */
27774
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27775
+ /**
27776
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27777
+ * unsupported action ids are rejected by the provider.
27778
+ */
27779
+ runAction: method(object({
27780
+ deviceId: number(),
27781
+ actionId: NavigationActionIdSchema
27782
+ }), _void(), { kind: "mutation" }),
27783
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27784
+ playSound: method(object({
27785
+ deviceId: number(),
27786
+ soundId: number().int()
27787
+ }), _void(), { kind: "mutation" }),
27788
+ /**
27789
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27790
+ * works anytime, no active stream required).
27791
+ */
27792
+ setLightOn: method(object({
27793
+ deviceId: number(),
27794
+ on: boolean()
27795
+ }), _void(), { kind: "mutation" }),
27796
+ /**
27797
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27798
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27799
+ * action that generally needs an active camera stream/monitor session — the
27800
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27801
+ */
27802
+ setLightMode: method(object({
27803
+ deviceId: number(),
27804
+ mode: NavigationLightModeSchema,
27805
+ level: number().min(40).max(100).optional()
27806
+ }), _void(), { kind: "mutation" }),
27807
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27808
+ setLightLevel: method(object({
27809
+ deviceId: number(),
27810
+ level: number().min(40).max(100)
27811
+ }), _void(), { kind: "mutation" }),
27812
+ /**
27813
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27814
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27815
+ * `listActions`).
27816
+ */
27817
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27818
+ },
27819
+ events: { onStatusChanged: { data: object({
27820
+ deviceId: number(),
27821
+ status: NavigationStatusSchema
27822
+ }) } },
27823
+ status: {
27824
+ schema: NavigationStatusSchema,
27825
+ kind: "push"
27826
+ },
27827
+ /**
27828
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27829
+ * for live mode / follow / flash changes.
27830
+ */
27831
+ runtimeState: NavigationRuntimeStateSchema,
27832
+ /**
27833
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27834
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27835
+ * that. The live handle re-publishes on connect.
27836
+ *
27837
+ * See `RuntimeStateDurability`. Enforced by
27838
+ * `scripts/check-runtime-state-durability.ts`.
27839
+ */
27840
+ durability: "session"
27841
+ };
27842
+ /**
27843
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27844
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27845
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27846
+ * one Home Assistant projection.
27847
+ */
27848
+ var NetworkLinkStatusSchema = object({
27849
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27850
+ type: _enum([
27851
+ "wifi",
27852
+ "ethernet",
27853
+ "cellular",
27854
+ "unknown"
27855
+ ]),
27856
+ /**
27857
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27858
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27859
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27860
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27861
+ * SKIP a null rather than coerce it.
27862
+ */
27863
+ signalPercent: number().min(0).max(100).nullable(),
27864
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27865
+ rssiDbm: number().optional(),
27866
+ /** Network name of a wireless link, when the firmware reports it. */
27867
+ ssid: string().optional(),
27868
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27869
+ lastUpdated: number()
27870
+ });
27871
+ var networkLinkCapability = {
27872
+ name: "network-link",
27873
+ scope: "device",
27874
+ deviceNative: true,
27875
+ mode: "singleton",
27876
+ deviceTypes: [
27877
+ DeviceType.Camera,
27878
+ DeviceType.Sensor,
27879
+ DeviceType.Button,
27880
+ DeviceType.Switch,
27881
+ DeviceType.Light,
27882
+ DeviceType.Lock,
27883
+ DeviceType.Siren
27884
+ ],
27885
+ methods: {},
27886
+ events: {
27887
+ /**
27888
+ * Emitted whenever the cached status changes (a link switch, a signal
27889
+ * reading that moved). Mirrored on the parent chain by the
27890
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27891
+ */
27892
+ onStatusChanged: { data: object({
27893
+ deviceId: number(),
27894
+ status: NetworkLinkStatusSchema
27895
+ }) } },
27896
+ status: {
27897
+ schema: NetworkLinkStatusSchema,
27898
+ kind: "push",
27899
+ empty: {
27900
+ type: "unknown",
27901
+ signalPercent: null,
27902
+ lastUpdated: 0
27903
+ }
27904
+ },
27905
+ /**
27906
+ * Runtime-state slice — every provider stores the same shape under
27907
+ * `device.runtimeState['network-link']`, read once by the badge and the
27908
+ * Home Assistant projector regardless of the driver.
27909
+ */
27910
+ runtimeState: NetworkLinkStatusSchema,
27911
+ /**
27912
+ * Runtime-state durability: **restored** — a link reading is slow to
27913
+ * change and a sleeping battery camera may not report for hours; the
27914
+ * restored slice is what the badge shows until the next read.
27915
+ *
27916
+ * See `RuntimeStateDurability`. Enforced by
27917
+ * `scripts/check-runtime-state-durability.ts`.
27918
+ */
27919
+ durability: "restored",
27920
+ /** Clock fields: written, but excluded from the compare that decides
27921
+ * whether persisting is worth a SQLite commit. */
27922
+ volatileStateFields: ["lastUpdated"]
27923
+ };
27924
+ /**
27517
27925
  * network-quality — system-scoped singleton capability tracking RTT,
27518
27926
  * jitter, and observed/peak bandwidth per device + per client.
27519
27927
  *
@@ -29094,287 +29502,6 @@ var ptzAutotrackCapability = {
29094
29502
  */
29095
29503
  durability: "session"
29096
29504
  };
29097
- /**
29098
- * `navigation` — a device-scoped capability that natively expresses the FULL
29099
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29100
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29101
- *
29102
- * Why a NEW cap rather than overloading `ptz`:
29103
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29104
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29105
- * The two are different physical models: PTZ is absolute-position + presets,
29106
- * navigation is momentary drive nudges + discrete robot ACTIONS
29107
- * (dock / spot-clean / follow-pet / go-to-point / …).
29108
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29109
- * the reverse:
29110
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29111
- * / `getOptions`), and
29112
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29113
- * robot camera shows up in the existing PTZ control path without every
29114
- * PTZ provider learning about robots. The mapping lives in the adapter,
29115
- * not here (see the addon design note):
29116
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29117
- * ptz.stop() → navigation.stop()
29118
- * ptz.goHome() → navigation.runAction('goHome')
29119
- * ptz.getPresets() → navigation.listActions() (id→preset)
29120
- * ptz.goToPreset(id) → navigation.runAction(id)
29121
- *
29122
- * ## Continuous drive
29123
- *
29124
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29125
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29126
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29127
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29128
- * coalesce them. The UI owns the cadence.
29129
- *
29130
- * ## The action dictionary
29131
- *
29132
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29133
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29134
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29135
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29136
- * vendor-specific list. `kind: 'action'` entries are triggered with
29137
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29138
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29139
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29140
- *
29141
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29142
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29143
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29144
- * every device handle. A future nodedreame publish adds a typed
29145
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29146
- * provider can then swap the raw calls for the typed methods with no change to
29147
- * THIS contract.
29148
- */
29149
- /**
29150
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29151
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29152
- * halts it.
29153
- *
29154
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29155
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29156
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29157
- * vector by it (drivers without proportional drive ignore it).
29158
- *
29159
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29160
- * axis alone; an all-undefined nudge is a no-op.
29161
- */
29162
- var NavigationMoveCommandSchema = object({
29163
- pan: number().min(-1).max(1).optional(),
29164
- tilt: number().min(-1).max(1).optional(),
29165
- speed: number().min(0).max(1).optional()
29166
- });
29167
- /**
29168
- * The enumerated discrete actions a navigation-capable robot can perform via
29169
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29170
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29171
- * `playSound` (see the `sound` dictionary entries).
29172
- */
29173
- var NavigationActionIdSchema = _enum([
29174
- "goHome",
29175
- "locate",
29176
- "spotClean",
29177
- "findPet",
29178
- "personFollow",
29179
- "stop",
29180
- "startClean",
29181
- "pauseClean",
29182
- "dockWash",
29183
- "autoEmpty",
29184
- "flashOn",
29185
- "flashOff"
29186
- ]);
29187
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29188
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29189
- /**
29190
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29191
- * native panel and the PTZ mimic render as a button.
29192
- *
29193
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29194
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29195
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29196
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29197
- * - `label` — operator-facing English label.
29198
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29199
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29200
- * PTZ render ONLY enabled entries. Data-driven: the provider
29201
- * flips it from config, never by editing code.
29202
- */
29203
- var NavigationActionEntrySchema = object({
29204
- id: string(),
29205
- kind: NavigationEntryKindSchema,
29206
- label: string(),
29207
- icon: string(),
29208
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29209
- soundId: number().int().optional(),
29210
- /** Per-device feature flag — render this entry only when true. */
29211
- enabled: boolean()
29212
- });
29213
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29214
- var NavigationPointSchema = object({
29215
- x: number(),
29216
- y: number()
29217
- });
29218
- /**
29219
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29220
- * The cap reports which are enabled so the UI / PTZ render only the controls
29221
- * that are turned on for THIS device. Data-driven: the provider derives these
29222
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29223
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29224
- * that are not dictionary entries.
29225
- *
29226
- * - `move` / `stop` — the momentary drive joystick.
29227
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29228
- * map-coordinate plumbing is wired.
29229
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29230
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29231
- * - `light` — the on/off fill-light toggle (works anytime).
29232
- * - `lightMode` — the auto/manual selector + manual level slider (a
29233
- * camera-service control; needs an active stream).
29234
- */
29235
- var NavigationFeaturesSchema = object({
29236
- move: boolean(),
29237
- stop: boolean(),
29238
- goToPoint: boolean(),
29239
- runAction: boolean(),
29240
- playSound: boolean(),
29241
- light: boolean(),
29242
- lightMode: boolean()
29243
- });
29244
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29245
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29246
- /**
29247
- * Live navigation state so the UI can reflect what the robot is doing:
29248
- * - `mode` — coarse activity (idle / cleaning / following / …).
29249
- * - `following` — person/pet follow is currently armed.
29250
- * - `flash` — the on-camera fill light is on.
29251
- * - `lightMode` — auto vs manual fill-light mode.
29252
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29253
- * `lightMode === 'manual'`.
29254
- */
29255
- var NavigationStatusSchema = object({
29256
- mode: _enum([
29257
- "idle",
29258
- "cleaning",
29259
- "spot",
29260
- "following",
29261
- "goto",
29262
- "returning",
29263
- "paused",
29264
- "unknown"
29265
- ]),
29266
- following: boolean(),
29267
- flash: boolean(),
29268
- lightMode: NavigationLightModeSchema,
29269
- lightLevel: number().min(40).max(100),
29270
- /** Ms epoch when the slice was last updated. */
29271
- lastChangedAt: number()
29272
- });
29273
- /**
29274
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29275
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29276
- * convention.
29277
- */
29278
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29279
- var navigationCapability = {
29280
- name: "navigation",
29281
- scope: "device",
29282
- deviceNative: true,
29283
- mode: "singleton",
29284
- deviceTypes: [DeviceType.Camera],
29285
- deviceConfig: { ui: {
29286
- kind: "widget",
29287
- widgetId: "host/navigation-panel",
29288
- tab: "navigation",
29289
- topTab: true,
29290
- label: "Navigation",
29291
- order: 0
29292
- } },
29293
- methods: {
29294
- /**
29295
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29296
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29297
- * path) works for any authenticated user, not admin-only. The UI sends
29298
- * these at ~1 Hz while a control is held; the provider forwards each one to
29299
- * a single drive write WITHOUT debouncing.
29300
- */
29301
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29302
- /** Halt all motion immediately (zero drive vector). */
29303
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29304
- /** Send the robot to a point on its live map. */
29305
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29306
- /**
29307
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29308
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29309
- */
29310
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29311
- /**
29312
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29313
- * unsupported action ids are rejected by the provider.
29314
- */
29315
- runAction: method(object({
29316
- deviceId: number(),
29317
- actionId: NavigationActionIdSchema
29318
- }), _void(), { kind: "mutation" }),
29319
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29320
- playSound: method(object({
29321
- deviceId: number(),
29322
- soundId: number().int()
29323
- }), _void(), { kind: "mutation" }),
29324
- /**
29325
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29326
- * works anytime, no active stream required).
29327
- */
29328
- setLightOn: method(object({
29329
- deviceId: number(),
29330
- on: boolean()
29331
- }), _void(), { kind: "mutation" }),
29332
- /**
29333
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29334
- * initial `level`. The auto/manual + level control is a CAMERA-service
29335
- * action that generally needs an active camera stream/monitor session — the
29336
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29337
- */
29338
- setLightMode: method(object({
29339
- deviceId: number(),
29340
- mode: NavigationLightModeSchema,
29341
- level: number().min(40).max(100).optional()
29342
- }), _void(), { kind: "mutation" }),
29343
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29344
- setLightLevel: method(object({
29345
- deviceId: number(),
29346
- level: number().min(40).max(100)
29347
- }), _void(), { kind: "mutation" }),
29348
- /**
29349
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29350
- * controls the UI shows (the per-entry flags for the dictionary come back on
29351
- * `listActions`).
29352
- */
29353
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29354
- },
29355
- events: { onStatusChanged: { data: object({
29356
- deviceId: number(),
29357
- status: NavigationStatusSchema
29358
- }) } },
29359
- status: {
29360
- schema: NavigationStatusSchema,
29361
- kind: "push"
29362
- },
29363
- /**
29364
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29365
- * for live mode / follow / flash changes.
29366
- */
29367
- runtimeState: NavigationRuntimeStateSchema,
29368
- /**
29369
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29370
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29371
- * that. The live handle re-publishes on connect.
29372
- *
29373
- * See `RuntimeStateDurability`. Enforced by
29374
- * `scripts/check-runtime-state-durability.ts`.
29375
- */
29376
- durability: "session"
29377
- };
29378
29505
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29379
29506
  kind: "mutation",
29380
29507
  auth: "admin"
@@ -38831,13 +38958,13 @@ Object.freeze({
38831
38958
  addonId: null,
38832
38959
  access: "view"
38833
38960
  },
38834
- "storage.getDefaultLocation": {
38961
+ "storage.list": {
38835
38962
  capName: "storage",
38836
38963
  capScope: "system",
38837
38964
  addonId: null,
38838
38965
  access: "view"
38839
38966
  },
38840
- "storage.list": {
38967
+ "storage.listDrainProgress": {
38841
38968
  capName: "storage",
38842
38969
  capScope: "system",
38843
38970
  addonId: null,
@@ -38987,6 +39114,12 @@ Object.freeze({
38987
39114
  addonId: null,
38988
39115
  access: "view"
38989
39116
  },
39117
+ "storageOccupancy.getOccupancy": {
39118
+ capName: "storage-occupancy",
39119
+ capScope: "system",
39120
+ addonId: null,
39121
+ access: "view"
39122
+ },
38990
39123
  "storageProvider.abortUpload": {
38991
39124
  capName: "storage-provider",
38992
39125
  capScope: "system",