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