@camstack/addon-provider-homematic 1.2.79 → 1.2.81

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