@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.js CHANGED
@@ -23,7 +23,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
23
23
  //#endregion
24
24
  let node_net = require("node:net");
25
25
  node_net = __toESM(node_net);
26
- //#region ../types/dist/event-category-zAv7pMUz.mjs
26
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
27
27
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
28
28
  EventCategory["SystemBoot"] = "system.boot";
29
29
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -218,6 +218,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
218
218
  EventCategory["ProcessCrashed"] = "process.crashed";
219
219
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
220
220
  EventCategory["ProcessRestarted"] = "process.restarted";
221
+ /**
222
+ * The SET of storage locations changed — one was created, edited, enabled,
223
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
224
+ *
225
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
226
+ * it must also converge on its own periodic path, because a dropped event
227
+ * must not leave a node writing to yesterday's disk set forever. It exists
228
+ * because there was NO signal at all — an operator who added a second
229
+ * recordings disk in the admin UI got nothing, and the recorder kept its
230
+ * resolved locations until something else happened to re-resolve them
231
+ * (D387). Payload `StorageLocationsChangedPayload`.
232
+ */
233
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
221
234
  EventCategory["RecordingStarted"] = "recording.started";
222
235
  EventCategory["RecordingStopped"] = "recording.stopped";
223
236
  EventCategory["RecordingError"] = "recording.error";
@@ -7671,111 +7684,6 @@ function classifyStreams(streams) {
7671
7684
  return result;
7672
7685
  }
7673
7686
  /**
7674
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7675
- * an addon declares its channels in.
7676
- *
7677
- * ## Two axes, deliberately separated
7678
- *
7679
- * - **DECLARATION** — which channels exist. Only the addon knows:
7680
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7681
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7682
- * and rots silently. So a channel is declared where it is consulted, and the
7683
- * `log-channels` capability enumerates the declarations.
7684
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7685
- * thing: the logging settings document on the `system` cap. Two authorities
7686
- * over the values is the exact defect
7687
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7688
- * remove; re-introducing it from the cure side would be grotesque.
7689
- *
7690
- * Nothing in this file reads a clock, an env var or a store. The registry is
7691
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7692
- * the hot path with a value somebody actually read, and by
7693
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7694
- * never reaches here, so it can neither disarm an armed channel nor arm a
7695
- * disarmed one (D49).
7696
- *
7697
- * ## The canonical call shape
7698
- *
7699
- * ```ts
7700
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7701
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7702
- * }
7703
- * ```
7704
- *
7705
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7706
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7707
- * object literal is never constructed because it lives inside the branch. It
7708
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7709
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7710
- * destination floor (measured at 1.93 ns/call when off).
7711
- *
7712
- * ## Why a channel emits at `info`
7713
- *
7714
- * `loki-logging.addon.ts` pins the destination default at `info` and
7715
- * `loki-destination.ts` drops everything below it, so a line emitted at
7716
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7717
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7718
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7719
- * emits at the channel's declared level, whose schema floor is `info`.
7720
- */
7721
- /**
7722
- * The level a channel writes at once armed.
7723
- *
7724
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7725
- * not leave the process for Loki, and the whole point of arming a channel is
7726
- * to read it later.
7727
- */
7728
- var LogChannelLevelSchema = _enum([
7729
- "info",
7730
- "warn",
7731
- "error"
7732
- ]);
7733
- /**
7734
- * What an addon declares about one channel. No value, no state — a
7735
- * declaration is inert.
7736
- */
7737
- var LogChannelDescriptorSchema = object({
7738
- /**
7739
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7740
- * the addon's short name so an operator reading a channel list can tell who
7741
- * owns it without a second lookup.
7742
- */
7743
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7744
- /** One sentence: what the operator will SEE after arming it. */
7745
- description: string().min(1),
7746
- /** The level its lines are emitted at. Never below `info`. */
7747
- defaultLevel: LogChannelLevelSchema,
7748
- /**
7749
- * Whether this channel can be narrowed to a camera.
7750
- *
7751
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7752
- * consulted with the numeric device id, AND every line the channel admits
7753
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7754
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7755
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7756
- * the body is the only way to filter.
7757
- *
7758
- * A channel whose lines carry the device only in `meta` (or not at all) is
7759
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7760
- * the operator narrows to one camera, sees nothing, and concludes the code
7761
- * path was never taken.
7762
- */
7763
- perDevice: boolean()
7764
- });
7765
- /**
7766
- * An armed window over one channel, as the document hands it to a mirror.
7767
- *
7768
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7769
- * expires by itself, which is the one failure a boolean cannot avoid.
7770
- */
7771
- var LogChannelWindowSchema = object({
7772
- channel: string().min(1),
7773
- /** Epoch ms the window closes at. */
7774
- armedUntilMs: number(),
7775
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7776
- deviceIds: array(number().int()).readonly().nullable()
7777
- });
7778
- /**
7779
7687
  * Ops-log — the durable, append-only operations audit shared by the
7780
7688
  * recordings and events management surfaces.
7781
7689
  *
@@ -8697,6 +8605,21 @@ var StorageCleanupJobSchema = object({
8697
8605
  });
8698
8606
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8699
8607
  /**
8608
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8609
+ * alias below is `z.infer<>` of it, never a second spelling.
8610
+ */
8611
+ var StorageLocationModeSchema = _enum([
8612
+ "active",
8613
+ "readonly",
8614
+ "drain",
8615
+ "disabled"
8616
+ ]);
8617
+ _enum([
8618
+ "normal",
8619
+ "never",
8620
+ "drain"
8621
+ ]);
8622
+ /**
8700
8623
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8701
8624
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8702
8625
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8721,8 +8644,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8721
8644
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8722
8645
  *
8723
8646
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8724
- * The default location for a type uses `id === <type>:default` by
8725
- * convention (the bare type ref like `'backups'` resolves to it).
8647
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8648
+ * There is no default location any more (D383): `enabled` is the whole write
8649
+ * model, and a bare type ref resolves to the sole location of the type, or —
8650
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8651
+ * slug is `default`.
8726
8652
  *
8727
8653
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8728
8654
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8743,23 +8669,37 @@ var StorageLocationSchema = object({
8743
8669
  * flag at upsert time, not here (the schema is provider-agnostic).
8744
8670
  */
8745
8671
  nodeId: string().optional(),
8746
- isDefault: boolean().default(false),
8747
8672
  isSystem: boolean().default(false),
8748
8673
  /**
8749
- * Operator opt-in: whether consumers that BALANCE across several locations
8750
- * of a type may write here. Recordings reads it today; event media and
8751
- * backups are the next consumers, which is why the flag lives on the
8752
- * location rather than in any one addon's store nothing has to be
8753
- * extended to add the next consumer.
8674
+ * THE write switch, and the only one (D383). `enabled: true` means every
8675
+ * consumer that chooses a write target for this type may write here, and all
8676
+ * enabled locations of a type are used TOGETHER; `false` means read-only
8677
+ * still read, still played back, still age-swept, still drained, never
8678
+ * written.
8754
8679
  *
8755
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8756
- * flag existed reads back with no flag and keeps working exactly as before;
8757
- * that is the whole compat story, and it is why no migration ships with it.
8758
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8759
- * disk must not silently start writing to it); the default of a type is
8760
- * always stamped `true`.
8680
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8681
+ * stored" on an update and "born inert unless it is the first location of its
8682
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8683
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
8684
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8685
+ * stops existing rather than being re-derived on every read.
8761
8686
  */
8762
8687
  enabled: boolean().optional(),
8688
+ /**
8689
+ * THE state of this location (D385), and the only authority on what may be
8690
+ * written, read or evicted here. Interpreted in exactly one place —
8691
+ * `storage-location-mode.ts` — which also folds the legacy
8692
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8693
+ * ambiguous.
8694
+ *
8695
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8696
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8697
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8698
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8699
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8700
+ * either, so the two cannot disagree.
8701
+ */
8702
+ mode: StorageLocationModeSchema.optional(),
8763
8703
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8764
8704
  * for node-local locations it can reach) — never persisted, absent when the
8765
8705
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8767,13 +8707,50 @@ var StorageLocationSchema = object({
8767
8707
  totalBytes: number(),
8768
8708
  availableBytes: number()
8769
8709
  }).nullable().optional(),
8710
+ /**
8711
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8712
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8713
+ * never persisted, never a filesystem walk.
8714
+ *
8715
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8716
+ * location yet — nobody stores here, the owning addon is down, or the first
8717
+ * refresh has not completed. A UI must omit the segment rather than draw it
8718
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8719
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8720
+ * be spelled out loud instead of appearing by accident.
8721
+ *
8722
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8723
+ * about the whole figure rather than about its freshest part.
8724
+ */
8725
+ owned: object({
8726
+ bytes: number().int().nonnegative(),
8727
+ measuredAtMs: number().int().nonnegative()
8728
+ }).optional(),
8770
8729
  createdAt: number(),
8771
8730
  updatedAt: number()
8772
8731
  });
8732
+ object({ isDefault: boolean().optional() });
8733
+ /**
8734
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8735
+ *
8736
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8737
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8738
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8739
+ * operator learns not to believe the screen.
8740
+ */
8741
+ var StorageDrainProgressSchema = object({
8742
+ locationId: string(),
8743
+ startedAtMs: number(),
8744
+ startBytes: number(),
8745
+ bytesRemaining: number(),
8746
+ drained: boolean(),
8747
+ estimatedEmptyAtMs: number().nullable()
8748
+ });
8773
8749
  /**
8774
8750
  * Reference accepted by consumer-facing `api.storage.*` calls.
8775
8751
  * Either:
8776
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8752
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8753
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8777
8754
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8778
8755
  *
8779
8756
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8949,6 +8926,111 @@ var DecoderSessionConfigSchema = object({
8949
8926
  */
8950
8927
  debug: boolean().optional()
8951
8928
  });
8929
+ /**
8930
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8931
+ * an addon declares its channels in.
8932
+ *
8933
+ * ## Two axes, deliberately separated
8934
+ *
8935
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8936
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8937
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8938
+ * and rots silently. So a channel is declared where it is consulted, and the
8939
+ * `log-channels` capability enumerates the declarations.
8940
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8941
+ * thing: the logging settings document on the `system` cap. Two authorities
8942
+ * over the values is the exact defect
8943
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8944
+ * remove; re-introducing it from the cure side would be grotesque.
8945
+ *
8946
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8947
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8948
+ * the hot path with a value somebody actually read, and by
8949
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8950
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8951
+ * disarmed one (D49).
8952
+ *
8953
+ * ## The canonical call shape
8954
+ *
8955
+ * ```ts
8956
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8957
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8958
+ * }
8959
+ * ```
8960
+ *
8961
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8962
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8963
+ * object literal is never constructed because it lives inside the branch. It
8964
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8965
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8966
+ * destination floor (measured at 1.93 ns/call when off).
8967
+ *
8968
+ * ## Why a channel emits at `info`
8969
+ *
8970
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8971
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8972
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8973
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8974
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8975
+ * emits at the channel's declared level, whose schema floor is `info`.
8976
+ */
8977
+ /**
8978
+ * The level a channel writes at once armed.
8979
+ *
8980
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8981
+ * not leave the process for Loki, and the whole point of arming a channel is
8982
+ * to read it later.
8983
+ */
8984
+ var LogChannelLevelSchema = _enum([
8985
+ "info",
8986
+ "warn",
8987
+ "error"
8988
+ ]);
8989
+ /**
8990
+ * What an addon declares about one channel. No value, no state — a
8991
+ * declaration is inert.
8992
+ */
8993
+ var LogChannelDescriptorSchema = object({
8994
+ /**
8995
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8996
+ * the addon's short name so an operator reading a channel list can tell who
8997
+ * owns it without a second lookup.
8998
+ */
8999
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9000
+ /** One sentence: what the operator will SEE after arming it. */
9001
+ description: string().min(1),
9002
+ /** The level its lines are emitted at. Never below `info`. */
9003
+ defaultLevel: LogChannelLevelSchema,
9004
+ /**
9005
+ * Whether this channel can be narrowed to a camera.
9006
+ *
9007
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9008
+ * consulted with the numeric device id, AND every line the channel admits
9009
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9010
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9011
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9012
+ * the body is the only way to filter.
9013
+ *
9014
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9015
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9016
+ * the operator narrows to one camera, sees nothing, and concludes the code
9017
+ * path was never taken.
9018
+ */
9019
+ perDevice: boolean()
9020
+ });
9021
+ /**
9022
+ * An armed window over one channel, as the document hands it to a mirror.
9023
+ *
9024
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9025
+ * expires by itself, which is the one failure a boolean cannot avoid.
9026
+ */
9027
+ var LogChannelWindowSchema = object({
9028
+ channel: string().min(1),
9029
+ /** Epoch ms the window closes at. */
9030
+ armedUntilMs: number(),
9031
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9032
+ deviceIds: array(number().int()).readonly().nullable()
9033
+ });
8952
9034
  var MODEL_FORMATS = [
8953
9035
  "onnx",
8954
9036
  "coreml",
@@ -22085,7 +22167,7 @@ method(object({
22085
22167
  downloadId: string(),
22086
22168
  offset: number(),
22087
22169
  length: number()
22088
- }), _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({
22170
+ }), _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({
22089
22171
  createdAt: true,
22090
22172
  updatedAt: true
22091
22173
  }), StorageLocationSchema, {
@@ -22097,7 +22179,7 @@ method(object({
22097
22179
  }), _void(), {
22098
22180
  kind: "mutation",
22099
22181
  auth: "admin"
22100
- }), method(object({ id: string() }), object({
22182
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22101
22183
  ok: boolean(),
22102
22184
  error: string().optional()
22103
22185
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22167,6 +22249,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22167
22249
  kind: "mutation",
22168
22250
  auth: "admin"
22169
22251
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22252
+ /**
22253
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22254
+ * location (D388).
22255
+ *
22256
+ * ## Why this is not `storage-evictable`
22257
+ *
22258
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22259
+ * not, in two ways that both matter and both bite hardest on the locations an
22260
+ * operator most wants a figure for:
22261
+ *
22262
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22263
+ * and `recordingsLow:default` deliberately share one root and evict as one
22264
+ * oldest-first pool, so both answer with the SAME combined total. As an
22265
+ * occupancy figure that double-counts the disk.
22266
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22267
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22268
+ * is retiring and staring at.
22269
+ *
22270
+ * So this is its own contract with its own quantity, and the quantity is
22271
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22272
+ * would ever be willing to delete it. A provider that can only answer
22273
+ * "evictable" must not register here — a number that silently means different
22274
+ * things per class is worse than no number.
22275
+ *
22276
+ * ## Absence is an answer
22277
+ *
22278
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22279
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22280
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22281
+ * consuming side has to be written out loud instead of appearing by accident.
22282
+ *
22283
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22284
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22285
+ */
22286
+ /** One provider's occupancy answer for one location. */
22287
+ var StorageOccupancyReportSchema = object({
22288
+ locationId: string(),
22289
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22290
+ * not net of what it is willing to delete. */
22291
+ ownedBytes: number().int().nonnegative(),
22292
+ /** When the provider last actually measured this. The orchestrator carries it
22293
+ * through so a UI can say how old the figure is instead of implying "now". */
22294
+ measuredAtMs: number().int().nonnegative()
22295
+ });
22296
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22170
22297
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22171
22298
  providerId: string().min(1),
22172
22299
  displayName: string().min(1),
@@ -24002,88 +24129,6 @@ onStatusChanged: { data: object({
24002
24129
  volatileStateFields: ["lastUpdated"]
24003
24130
  };
24004
24131
  /**
24005
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24006
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24007
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24008
- * one Home Assistant projection.
24009
- */
24010
- var NetworkLinkStatusSchema = object({
24011
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24012
- type: _enum([
24013
- "wifi",
24014
- "ethernet",
24015
- "cellular",
24016
- "unknown"
24017
- ]),
24018
- /**
24019
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24020
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24021
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24022
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24023
- * SKIP a null rather than coerce it.
24024
- */
24025
- signalPercent: number().min(0).max(100).nullable(),
24026
- /** Raw received signal strength in dBm, when the firmware reports one. */
24027
- rssiDbm: number().optional(),
24028
- /** Network name of a wireless link, when the firmware reports it. */
24029
- ssid: string().optional(),
24030
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24031
- lastUpdated: number()
24032
- });
24033
- var networkLinkCapability = {
24034
- name: "network-link",
24035
- scope: "device",
24036
- deviceNative: true,
24037
- mode: "singleton",
24038
- deviceTypes: [
24039
- DeviceType.Camera,
24040
- DeviceType.Sensor,
24041
- DeviceType.Button,
24042
- DeviceType.Switch,
24043
- DeviceType.Light,
24044
- DeviceType.Lock,
24045
- DeviceType.Siren
24046
- ],
24047
- methods: {},
24048
- events: {
24049
- /**
24050
- * Emitted whenever the cached status changes (a link switch, a signal
24051
- * reading that moved). Mirrored on the parent chain by the
24052
- * DeviceEventPropagator like `battery.onStatusChanged`.
24053
- */
24054
- onStatusChanged: { data: object({
24055
- deviceId: number(),
24056
- status: NetworkLinkStatusSchema
24057
- }) } },
24058
- status: {
24059
- schema: NetworkLinkStatusSchema,
24060
- kind: "push",
24061
- empty: {
24062
- type: "unknown",
24063
- signalPercent: null,
24064
- lastUpdated: 0
24065
- }
24066
- },
24067
- /**
24068
- * Runtime-state slice — every provider stores the same shape under
24069
- * `device.runtimeState['network-link']`, read once by the badge and the
24070
- * Home Assistant projector regardless of the driver.
24071
- */
24072
- runtimeState: NetworkLinkStatusSchema,
24073
- /**
24074
- * Runtime-state durability: **restored** — a link reading is slow to
24075
- * change and a sleeping battery camera may not report for hours; the
24076
- * restored slice is what the badge shows until the next read.
24077
- *
24078
- * See `RuntimeStateDurability`. Enforced by
24079
- * `scripts/check-runtime-state-durability.ts`.
24080
- */
24081
- durability: "restored",
24082
- /** Clock fields: written, but excluded from the compare that decides
24083
- * whether persisting is worth a SQLite commit. */
24084
- volatileStateFields: ["lastUpdated"]
24085
- };
24086
- /**
24087
24132
  * Generic boolean sensor — last-resort fallback when no domain-
24088
24133
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24089
24134
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27621,6 +27666,369 @@ var nativeObjectDetectionCapability = {
27621
27666
  volatileStateFields: ["lastFetchedAt"]
27622
27667
  };
27623
27668
  /**
27669
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27670
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27671
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27672
+ *
27673
+ * Why a NEW cap rather than overloading `ptz`:
27674
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27675
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27676
+ * The two are different physical models: PTZ is absolute-position + presets,
27677
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27678
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27679
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27680
+ * the reverse:
27681
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27682
+ * / `getOptions`), and
27683
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27684
+ * robot camera shows up in the existing PTZ control path without every
27685
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27686
+ * not here (see the addon design note):
27687
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27688
+ * ptz.stop() → navigation.stop()
27689
+ * ptz.goHome() → navigation.runAction('goHome')
27690
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27691
+ * ptz.goToPreset(id) → navigation.runAction(id)
27692
+ *
27693
+ * ## Continuous drive
27694
+ *
27695
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27696
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27697
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27698
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27699
+ * coalesce them. The UI owns the cadence.
27700
+ *
27701
+ * ## The action dictionary
27702
+ *
27703
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27704
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27705
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27706
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27707
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27708
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27709
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27710
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27711
+ *
27712
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27713
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27714
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27715
+ * every device handle. A future nodedreame publish adds a typed
27716
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27717
+ * provider can then swap the raw calls for the typed methods with no change to
27718
+ * THIS contract.
27719
+ */
27720
+ /**
27721
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27722
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27723
+ * halts it.
27724
+ *
27725
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27726
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27727
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27728
+ * vector by it (drivers without proportional drive ignore it).
27729
+ *
27730
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27731
+ * axis alone; an all-undefined nudge is a no-op.
27732
+ */
27733
+ var NavigationMoveCommandSchema = object({
27734
+ pan: number().min(-1).max(1).optional(),
27735
+ tilt: number().min(-1).max(1).optional(),
27736
+ speed: number().min(0).max(1).optional()
27737
+ });
27738
+ /**
27739
+ * The enumerated discrete actions a navigation-capable robot can perform via
27740
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27741
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27742
+ * `playSound` (see the `sound` dictionary entries).
27743
+ */
27744
+ var NavigationActionIdSchema = _enum([
27745
+ "goHome",
27746
+ "locate",
27747
+ "spotClean",
27748
+ "findPet",
27749
+ "personFollow",
27750
+ "stop",
27751
+ "startClean",
27752
+ "pauseClean",
27753
+ "dockWash",
27754
+ "autoEmpty",
27755
+ "flashOn",
27756
+ "flashOff"
27757
+ ]);
27758
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27759
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27760
+ /**
27761
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27762
+ * native panel and the PTZ mimic render as a button.
27763
+ *
27764
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27765
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27766
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27767
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27768
+ * - `label` — operator-facing English label.
27769
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27770
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27771
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27772
+ * flips it from config, never by editing code.
27773
+ */
27774
+ var NavigationActionEntrySchema = object({
27775
+ id: string(),
27776
+ kind: NavigationEntryKindSchema,
27777
+ label: string(),
27778
+ icon: string(),
27779
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27780
+ soundId: number().int().optional(),
27781
+ /** Per-device feature flag — render this entry only when true. */
27782
+ enabled: boolean()
27783
+ });
27784
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27785
+ var NavigationPointSchema = object({
27786
+ x: number(),
27787
+ y: number()
27788
+ });
27789
+ /**
27790
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27791
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27792
+ * that are turned on for THIS device. Data-driven: the provider derives these
27793
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27794
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27795
+ * that are not dictionary entries.
27796
+ *
27797
+ * - `move` / `stop` — the momentary drive joystick.
27798
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27799
+ * map-coordinate plumbing is wired.
27800
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27801
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27802
+ * - `light` — the on/off fill-light toggle (works anytime).
27803
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27804
+ * camera-service control; needs an active stream).
27805
+ */
27806
+ var NavigationFeaturesSchema = object({
27807
+ move: boolean(),
27808
+ stop: boolean(),
27809
+ goToPoint: boolean(),
27810
+ runAction: boolean(),
27811
+ playSound: boolean(),
27812
+ light: boolean(),
27813
+ lightMode: boolean()
27814
+ });
27815
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27816
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27817
+ /**
27818
+ * Live navigation state so the UI can reflect what the robot is doing:
27819
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27820
+ * - `following` — person/pet follow is currently armed.
27821
+ * - `flash` — the on-camera fill light is on.
27822
+ * - `lightMode` — auto vs manual fill-light mode.
27823
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27824
+ * `lightMode === 'manual'`.
27825
+ */
27826
+ var NavigationStatusSchema = object({
27827
+ mode: _enum([
27828
+ "idle",
27829
+ "cleaning",
27830
+ "spot",
27831
+ "following",
27832
+ "goto",
27833
+ "returning",
27834
+ "paused",
27835
+ "unknown"
27836
+ ]),
27837
+ following: boolean(),
27838
+ flash: boolean(),
27839
+ lightMode: NavigationLightModeSchema,
27840
+ lightLevel: number().min(40).max(100),
27841
+ /** Ms epoch when the slice was last updated. */
27842
+ lastChangedAt: number()
27843
+ });
27844
+ /**
27845
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27846
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27847
+ * convention.
27848
+ */
27849
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27850
+ var navigationCapability = {
27851
+ name: "navigation",
27852
+ scope: "device",
27853
+ deviceNative: true,
27854
+ mode: "singleton",
27855
+ deviceTypes: [DeviceType.Camera],
27856
+ deviceConfig: { ui: {
27857
+ kind: "widget",
27858
+ widgetId: "host/navigation-panel",
27859
+ tab: "navigation",
27860
+ topTab: true,
27861
+ label: "Navigation",
27862
+ order: 0
27863
+ } },
27864
+ methods: {
27865
+ /**
27866
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27867
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27868
+ * path) works for any authenticated user, not admin-only. The UI sends
27869
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27870
+ * a single drive write WITHOUT debouncing.
27871
+ */
27872
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27873
+ /** Halt all motion immediately (zero drive vector). */
27874
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27875
+ /** Send the robot to a point on its live map. */
27876
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27877
+ /**
27878
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27879
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27880
+ */
27881
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27882
+ /**
27883
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27884
+ * unsupported action ids are rejected by the provider.
27885
+ */
27886
+ runAction: method(object({
27887
+ deviceId: number(),
27888
+ actionId: NavigationActionIdSchema
27889
+ }), _void(), { kind: "mutation" }),
27890
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27891
+ playSound: method(object({
27892
+ deviceId: number(),
27893
+ soundId: number().int()
27894
+ }), _void(), { kind: "mutation" }),
27895
+ /**
27896
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27897
+ * works anytime, no active stream required).
27898
+ */
27899
+ setLightOn: method(object({
27900
+ deviceId: number(),
27901
+ on: boolean()
27902
+ }), _void(), { kind: "mutation" }),
27903
+ /**
27904
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27905
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27906
+ * action that generally needs an active camera stream/monitor session — the
27907
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27908
+ */
27909
+ setLightMode: method(object({
27910
+ deviceId: number(),
27911
+ mode: NavigationLightModeSchema,
27912
+ level: number().min(40).max(100).optional()
27913
+ }), _void(), { kind: "mutation" }),
27914
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27915
+ setLightLevel: method(object({
27916
+ deviceId: number(),
27917
+ level: number().min(40).max(100)
27918
+ }), _void(), { kind: "mutation" }),
27919
+ /**
27920
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27921
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27922
+ * `listActions`).
27923
+ */
27924
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27925
+ },
27926
+ events: { onStatusChanged: { data: object({
27927
+ deviceId: number(),
27928
+ status: NavigationStatusSchema
27929
+ }) } },
27930
+ status: {
27931
+ schema: NavigationStatusSchema,
27932
+ kind: "push"
27933
+ },
27934
+ /**
27935
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27936
+ * for live mode / follow / flash changes.
27937
+ */
27938
+ runtimeState: NavigationRuntimeStateSchema,
27939
+ /**
27940
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27941
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27942
+ * that. The live handle re-publishes on connect.
27943
+ *
27944
+ * See `RuntimeStateDurability`. Enforced by
27945
+ * `scripts/check-runtime-state-durability.ts`.
27946
+ */
27947
+ durability: "session"
27948
+ };
27949
+ /**
27950
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27951
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27952
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27953
+ * one Home Assistant projection.
27954
+ */
27955
+ var NetworkLinkStatusSchema = object({
27956
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27957
+ type: _enum([
27958
+ "wifi",
27959
+ "ethernet",
27960
+ "cellular",
27961
+ "unknown"
27962
+ ]),
27963
+ /**
27964
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27965
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27966
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27967
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27968
+ * SKIP a null rather than coerce it.
27969
+ */
27970
+ signalPercent: number().min(0).max(100).nullable(),
27971
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27972
+ rssiDbm: number().optional(),
27973
+ /** Network name of a wireless link, when the firmware reports it. */
27974
+ ssid: string().optional(),
27975
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27976
+ lastUpdated: number()
27977
+ });
27978
+ var networkLinkCapability = {
27979
+ name: "network-link",
27980
+ scope: "device",
27981
+ deviceNative: true,
27982
+ mode: "singleton",
27983
+ deviceTypes: [
27984
+ DeviceType.Camera,
27985
+ DeviceType.Sensor,
27986
+ DeviceType.Button,
27987
+ DeviceType.Switch,
27988
+ DeviceType.Light,
27989
+ DeviceType.Lock,
27990
+ DeviceType.Siren
27991
+ ],
27992
+ methods: {},
27993
+ events: {
27994
+ /**
27995
+ * Emitted whenever the cached status changes (a link switch, a signal
27996
+ * reading that moved). Mirrored on the parent chain by the
27997
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27998
+ */
27999
+ onStatusChanged: { data: object({
28000
+ deviceId: number(),
28001
+ status: NetworkLinkStatusSchema
28002
+ }) } },
28003
+ status: {
28004
+ schema: NetworkLinkStatusSchema,
28005
+ kind: "push",
28006
+ empty: {
28007
+ type: "unknown",
28008
+ signalPercent: null,
28009
+ lastUpdated: 0
28010
+ }
28011
+ },
28012
+ /**
28013
+ * Runtime-state slice — every provider stores the same shape under
28014
+ * `device.runtimeState['network-link']`, read once by the badge and the
28015
+ * Home Assistant projector regardless of the driver.
28016
+ */
28017
+ runtimeState: NetworkLinkStatusSchema,
28018
+ /**
28019
+ * Runtime-state durability: **restored** — a link reading is slow to
28020
+ * change and a sleeping battery camera may not report for hours; the
28021
+ * restored slice is what the badge shows until the next read.
28022
+ *
28023
+ * See `RuntimeStateDurability`. Enforced by
28024
+ * `scripts/check-runtime-state-durability.ts`.
28025
+ */
28026
+ durability: "restored",
28027
+ /** Clock fields: written, but excluded from the compare that decides
28028
+ * whether persisting is worth a SQLite commit. */
28029
+ volatileStateFields: ["lastUpdated"]
28030
+ };
28031
+ /**
27624
28032
  * network-quality — system-scoped singleton capability tracking RTT,
27625
28033
  * jitter, and observed/peak bandwidth per device + per client.
27626
28034
  *
@@ -29201,287 +29609,6 @@ var ptzAutotrackCapability = {
29201
29609
  */
29202
29610
  durability: "session"
29203
29611
  };
29204
- /**
29205
- * `navigation` — a device-scoped capability that natively expresses the FULL
29206
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29207
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29208
- *
29209
- * Why a NEW cap rather than overloading `ptz`:
29210
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29211
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29212
- * The two are different physical models: PTZ is absolute-position + presets,
29213
- * navigation is momentary drive nudges + discrete robot ACTIONS
29214
- * (dock / spot-clean / follow-pet / go-to-point / …).
29215
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29216
- * the reverse:
29217
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29218
- * / `getOptions`), and
29219
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29220
- * robot camera shows up in the existing PTZ control path without every
29221
- * PTZ provider learning about robots. The mapping lives in the adapter,
29222
- * not here (see the addon design note):
29223
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29224
- * ptz.stop() → navigation.stop()
29225
- * ptz.goHome() → navigation.runAction('goHome')
29226
- * ptz.getPresets() → navigation.listActions() (id→preset)
29227
- * ptz.goToPreset(id) → navigation.runAction(id)
29228
- *
29229
- * ## Continuous drive
29230
- *
29231
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29232
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29233
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29234
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29235
- * coalesce them. The UI owns the cadence.
29236
- *
29237
- * ## The action dictionary
29238
- *
29239
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29240
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29241
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29242
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29243
- * vendor-specific list. `kind: 'action'` entries are triggered with
29244
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29245
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29246
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29247
- *
29248
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29249
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29250
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29251
- * every device handle. A future nodedreame publish adds a typed
29252
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29253
- * provider can then swap the raw calls for the typed methods with no change to
29254
- * THIS contract.
29255
- */
29256
- /**
29257
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29258
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29259
- * halts it.
29260
- *
29261
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29262
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29263
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29264
- * vector by it (drivers without proportional drive ignore it).
29265
- *
29266
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29267
- * axis alone; an all-undefined nudge is a no-op.
29268
- */
29269
- var NavigationMoveCommandSchema = object({
29270
- pan: number().min(-1).max(1).optional(),
29271
- tilt: number().min(-1).max(1).optional(),
29272
- speed: number().min(0).max(1).optional()
29273
- });
29274
- /**
29275
- * The enumerated discrete actions a navigation-capable robot can perform via
29276
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29277
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29278
- * `playSound` (see the `sound` dictionary entries).
29279
- */
29280
- var NavigationActionIdSchema = _enum([
29281
- "goHome",
29282
- "locate",
29283
- "spotClean",
29284
- "findPet",
29285
- "personFollow",
29286
- "stop",
29287
- "startClean",
29288
- "pauseClean",
29289
- "dockWash",
29290
- "autoEmpty",
29291
- "flashOn",
29292
- "flashOff"
29293
- ]);
29294
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29295
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29296
- /**
29297
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29298
- * native panel and the PTZ mimic render as a button.
29299
- *
29300
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29301
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29302
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29303
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29304
- * - `label` — operator-facing English label.
29305
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29306
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29307
- * PTZ render ONLY enabled entries. Data-driven: the provider
29308
- * flips it from config, never by editing code.
29309
- */
29310
- var NavigationActionEntrySchema = object({
29311
- id: string(),
29312
- kind: NavigationEntryKindSchema,
29313
- label: string(),
29314
- icon: string(),
29315
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29316
- soundId: number().int().optional(),
29317
- /** Per-device feature flag — render this entry only when true. */
29318
- enabled: boolean()
29319
- });
29320
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29321
- var NavigationPointSchema = object({
29322
- x: number(),
29323
- y: number()
29324
- });
29325
- /**
29326
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29327
- * The cap reports which are enabled so the UI / PTZ render only the controls
29328
- * that are turned on for THIS device. Data-driven: the provider derives these
29329
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29330
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29331
- * that are not dictionary entries.
29332
- *
29333
- * - `move` / `stop` — the momentary drive joystick.
29334
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29335
- * map-coordinate plumbing is wired.
29336
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29337
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29338
- * - `light` — the on/off fill-light toggle (works anytime).
29339
- * - `lightMode` — the auto/manual selector + manual level slider (a
29340
- * camera-service control; needs an active stream).
29341
- */
29342
- var NavigationFeaturesSchema = object({
29343
- move: boolean(),
29344
- stop: boolean(),
29345
- goToPoint: boolean(),
29346
- runAction: boolean(),
29347
- playSound: boolean(),
29348
- light: boolean(),
29349
- lightMode: boolean()
29350
- });
29351
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29352
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29353
- /**
29354
- * Live navigation state so the UI can reflect what the robot is doing:
29355
- * - `mode` — coarse activity (idle / cleaning / following / …).
29356
- * - `following` — person/pet follow is currently armed.
29357
- * - `flash` — the on-camera fill light is on.
29358
- * - `lightMode` — auto vs manual fill-light mode.
29359
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29360
- * `lightMode === 'manual'`.
29361
- */
29362
- var NavigationStatusSchema = object({
29363
- mode: _enum([
29364
- "idle",
29365
- "cleaning",
29366
- "spot",
29367
- "following",
29368
- "goto",
29369
- "returning",
29370
- "paused",
29371
- "unknown"
29372
- ]),
29373
- following: boolean(),
29374
- flash: boolean(),
29375
- lightMode: NavigationLightModeSchema,
29376
- lightLevel: number().min(40).max(100),
29377
- /** Ms epoch when the slice was last updated. */
29378
- lastChangedAt: number()
29379
- });
29380
- /**
29381
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29382
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29383
- * convention.
29384
- */
29385
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29386
- var navigationCapability = {
29387
- name: "navigation",
29388
- scope: "device",
29389
- deviceNative: true,
29390
- mode: "singleton",
29391
- deviceTypes: [DeviceType.Camera],
29392
- deviceConfig: { ui: {
29393
- kind: "widget",
29394
- widgetId: "host/navigation-panel",
29395
- tab: "navigation",
29396
- topTab: true,
29397
- label: "Navigation",
29398
- order: 0
29399
- } },
29400
- methods: {
29401
- /**
29402
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29403
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29404
- * path) works for any authenticated user, not admin-only. The UI sends
29405
- * these at ~1 Hz while a control is held; the provider forwards each one to
29406
- * a single drive write WITHOUT debouncing.
29407
- */
29408
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29409
- /** Halt all motion immediately (zero drive vector). */
29410
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29411
- /** Send the robot to a point on its live map. */
29412
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29413
- /**
29414
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29415
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29416
- */
29417
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29418
- /**
29419
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29420
- * unsupported action ids are rejected by the provider.
29421
- */
29422
- runAction: method(object({
29423
- deviceId: number(),
29424
- actionId: NavigationActionIdSchema
29425
- }), _void(), { kind: "mutation" }),
29426
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29427
- playSound: method(object({
29428
- deviceId: number(),
29429
- soundId: number().int()
29430
- }), _void(), { kind: "mutation" }),
29431
- /**
29432
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29433
- * works anytime, no active stream required).
29434
- */
29435
- setLightOn: method(object({
29436
- deviceId: number(),
29437
- on: boolean()
29438
- }), _void(), { kind: "mutation" }),
29439
- /**
29440
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29441
- * initial `level`. The auto/manual + level control is a CAMERA-service
29442
- * action that generally needs an active camera stream/monitor session — the
29443
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29444
- */
29445
- setLightMode: method(object({
29446
- deviceId: number(),
29447
- mode: NavigationLightModeSchema,
29448
- level: number().min(40).max(100).optional()
29449
- }), _void(), { kind: "mutation" }),
29450
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29451
- setLightLevel: method(object({
29452
- deviceId: number(),
29453
- level: number().min(40).max(100)
29454
- }), _void(), { kind: "mutation" }),
29455
- /**
29456
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29457
- * controls the UI shows (the per-entry flags for the dictionary come back on
29458
- * `listActions`).
29459
- */
29460
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29461
- },
29462
- events: { onStatusChanged: { data: object({
29463
- deviceId: number(),
29464
- status: NavigationStatusSchema
29465
- }) } },
29466
- status: {
29467
- schema: NavigationStatusSchema,
29468
- kind: "push"
29469
- },
29470
- /**
29471
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29472
- * for live mode / follow / flash changes.
29473
- */
29474
- runtimeState: NavigationRuntimeStateSchema,
29475
- /**
29476
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29477
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29478
- * that. The live handle re-publishes on connect.
29479
- *
29480
- * See `RuntimeStateDurability`. Enforced by
29481
- * `scripts/check-runtime-state-durability.ts`.
29482
- */
29483
- durability: "session"
29484
- };
29485
29612
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29486
29613
  kind: "mutation",
29487
29614
  auth: "admin"
@@ -39004,13 +39131,13 @@ Object.freeze({
39004
39131
  addonId: null,
39005
39132
  access: "view"
39006
39133
  },
39007
- "storage.getDefaultLocation": {
39134
+ "storage.list": {
39008
39135
  capName: "storage",
39009
39136
  capScope: "system",
39010
39137
  addonId: null,
39011
39138
  access: "view"
39012
39139
  },
39013
- "storage.list": {
39140
+ "storage.listDrainProgress": {
39014
39141
  capName: "storage",
39015
39142
  capScope: "system",
39016
39143
  addonId: null,
@@ -39160,6 +39287,12 @@ Object.freeze({
39160
39287
  addonId: null,
39161
39288
  access: "view"
39162
39289
  },
39290
+ "storageOccupancy.getOccupancy": {
39291
+ capName: "storage-occupancy",
39292
+ capScope: "system",
39293
+ addonId: null,
39294
+ access: "view"
39295
+ },
39163
39296
  "storageProvider.abortUpload": {
39164
39297
  capName: "storage-provider",
39165
39298
  capScope: "system",