@camstack/addon-provider-wyze 0.2.82 → 0.2.84

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