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