@camstack/addon-provider-tuya 0.2.78 → 0.2.80

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +621 -488
  2. package/dist/addon.mjs +621 -488
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -818,7 +818,7 @@ async function discoverDevices(options = {}, binder = createDgramBinder()) {
818
818
  return [...byId.values()];
819
819
  }
820
820
  //#endregion
821
- //#region ../types/dist/event-category-zAv7pMUz.mjs
821
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
822
822
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
823
823
  EventCategory["SystemBoot"] = "system.boot";
824
824
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1013,6 +1013,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1013
1013
  EventCategory["ProcessCrashed"] = "process.crashed";
1014
1014
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
1015
1015
  EventCategory["ProcessRestarted"] = "process.restarted";
1016
+ /**
1017
+ * The SET of storage locations changed — one was created, edited, enabled,
1018
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
1019
+ *
1020
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
1021
+ * it must also converge on its own periodic path, because a dropped event
1022
+ * must not leave a node writing to yesterday's disk set forever. It exists
1023
+ * because there was NO signal at all — an operator who added a second
1024
+ * recordings disk in the admin UI got nothing, and the recorder kept its
1025
+ * resolved locations until something else happened to re-resolve them
1026
+ * (D387). Payload `StorageLocationsChangedPayload`.
1027
+ */
1028
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
1016
1029
  EventCategory["RecordingStarted"] = "recording.started";
1017
1030
  EventCategory["RecordingStopped"] = "recording.stopped";
1018
1031
  EventCategory["RecordingError"] = "recording.error";
@@ -8434,111 +8447,6 @@ var CameraSwitchGroupSchema = object({
8434
8447
  fetchedAt: number()
8435
8448
  });
8436
8449
  /**
8437
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
8438
- * an addon declares its channels in.
8439
- *
8440
- * ## Two axes, deliberately separated
8441
- *
8442
- * - **DECLARATION** — which channels exist. Only the addon knows:
8443
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8444
- * baichuan/handshake. A hand-wired central list rots at the first addition,
8445
- * and rots silently. So a channel is declared where it is consulted, and the
8446
- * `log-channels` capability enumerates the declarations.
8447
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
8448
- * thing: the logging settings document on the `system` cap. Two authorities
8449
- * over the values is the exact defect
8450
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8451
- * remove; re-introducing it from the cure side would be grotesque.
8452
- *
8453
- * Nothing in this file reads a clock, an env var or a store. The registry is
8454
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8455
- * the hot path with a value somebody actually read, and by
8456
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8457
- * never reaches here, so it can neither disarm an armed channel nor arm a
8458
- * disarmed one (D49).
8459
- *
8460
- * ## The canonical call shape
8461
- *
8462
- * ```ts
8463
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8464
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8465
- * }
8466
- * ```
8467
- *
8468
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8469
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
8470
- * object literal is never constructed because it lives inside the branch. It
8471
- * is the same shape already proven in production at `stream-broker.ts:1650`,
8472
- * and the same discipline `LoggingGate.allowsDestination` uses for the
8473
- * destination floor (measured at 1.93 ns/call when off).
8474
- *
8475
- * ## Why a channel emits at `info`
8476
- *
8477
- * `loki-logging.addon.ts` pins the destination default at `info` and
8478
- * `loki-destination.ts` drops everything below it, so a line emitted at
8479
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8480
- * minutes. A diagnostic that cannot be read an hour later is worse than no
8481
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8482
- * emits at the channel's declared level, whose schema floor is `info`.
8483
- */
8484
- /**
8485
- * The level a channel writes at once armed.
8486
- *
8487
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8488
- * not leave the process for Loki, and the whole point of arming a channel is
8489
- * to read it later.
8490
- */
8491
- var LogChannelLevelSchema = _enum([
8492
- "info",
8493
- "warn",
8494
- "error"
8495
- ]);
8496
- /**
8497
- * What an addon declares about one channel. No value, no state — a
8498
- * declaration is inert.
8499
- */
8500
- var LogChannelDescriptorSchema = object({
8501
- /**
8502
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8503
- * the addon's short name so an operator reading a channel list can tell who
8504
- * owns it without a second lookup.
8505
- */
8506
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8507
- /** One sentence: what the operator will SEE after arming it. */
8508
- description: string().min(1),
8509
- /** The level its lines are emitted at. Never below `info`. */
8510
- defaultLevel: LogChannelLevelSchema,
8511
- /**
8512
- * Whether this channel can be narrowed to a camera.
8513
- *
8514
- * `true` is a PROMISE with two halves, and both must hold: the gate is
8515
- * consulted with the numeric device id, AND every line the channel admits
8516
- * carries `tags: { deviceId }` with that same numeric id. The second half is
8517
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8518
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8519
- * the body is the only way to filter.
8520
- *
8521
- * A channel whose lines carry the device only in `meta` (or not at all) is
8522
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8523
- * the operator narrows to one camera, sees nothing, and concludes the code
8524
- * path was never taken.
8525
- */
8526
- perDevice: boolean()
8527
- });
8528
- /**
8529
- * An armed window over one channel, as the document hands it to a mirror.
8530
- *
8531
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8532
- * expires by itself, which is the one failure a boolean cannot avoid.
8533
- */
8534
- var LogChannelWindowSchema = object({
8535
- channel: string().min(1),
8536
- /** Epoch ms the window closes at. */
8537
- armedUntilMs: number(),
8538
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8539
- deviceIds: array(number().int()).readonly().nullable()
8540
- });
8541
- /**
8542
8450
  * Ops-log — the durable, append-only operations audit shared by the
8543
8451
  * recordings and events management surfaces.
8544
8452
  *
@@ -9460,6 +9368,21 @@ var StorageCleanupJobSchema = object({
9460
9368
  });
9461
9369
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
9462
9370
  /**
9371
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
9372
+ * alias below is `z.infer<>` of it, never a second spelling.
9373
+ */
9374
+ var StorageLocationModeSchema = _enum([
9375
+ "active",
9376
+ "readonly",
9377
+ "drain",
9378
+ "disabled"
9379
+ ]);
9380
+ _enum([
9381
+ "normal",
9382
+ "never",
9383
+ "drain"
9384
+ ]);
9385
+ /**
9463
9386
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9464
9387
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9465
9388
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9484,8 +9407,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
9484
9407
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
9485
9408
  *
9486
9409
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
9487
- * The default location for a type uses `id === <type>:default` by
9488
- * convention (the bare type ref like `'backups'` resolves to it).
9410
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
9411
+ * There is no default location any more (D383): `enabled` is the whole write
9412
+ * model, and a bare type ref resolves to the sole location of the type, or —
9413
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
9414
+ * slug is `default`.
9489
9415
  *
9490
9416
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
9491
9417
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -9506,23 +9432,37 @@ var StorageLocationSchema = object({
9506
9432
  * flag at upsert time, not here (the schema is provider-agnostic).
9507
9433
  */
9508
9434
  nodeId: string().optional(),
9509
- isDefault: boolean().default(false),
9510
9435
  isSystem: boolean().default(false),
9511
9436
  /**
9512
- * Operator opt-in: whether consumers that BALANCE across several locations
9513
- * of a type may write here. Recordings reads it today; event media and
9514
- * backups are the next consumers, which is why the flag lives on the
9515
- * location rather than in any one addon's store — nothing has to be
9516
- * extended to add the next consumer.
9437
+ * THE write switch, and the only one (D383). `enabled: true` means every
9438
+ * consumer that chooses a write target for this type may write here, and all
9439
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
9440
+ * still read, still played back, still age-swept, still drained, never
9441
+ * written.
9517
9442
  *
9518
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
9519
- * flag existed reads back with no flag and keeps working exactly as before;
9520
- * that is the whole compat story, and it is why no migration ships with it.
9521
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
9522
- * disk must not silently start writing to it); the default of a type is
9523
- * always stamped `true`.
9443
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
9444
+ * stored" on an update and "born inert unless it is the first location of its
9445
+ * type" on a create. On a PERSISTED row absence is legacy and it means
9446
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
9447
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
9448
+ * stops existing rather than being re-derived on every read.
9524
9449
  */
9525
9450
  enabled: boolean().optional(),
9451
+ /**
9452
+ * THE state of this location (D385), and the only authority on what may be
9453
+ * written, read or evicted here. Interpreted in exactly one place —
9454
+ * `storage-location-mode.ts` — which also folds the legacy
9455
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
9456
+ * ambiguous.
9457
+ *
9458
+ * OPTIONAL only for the wire and for rows written before D385: absence is
9459
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
9460
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
9461
+ * re-derived on every read. `enabled` survives one release as a DERIVED
9462
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
9463
+ * either, so the two cannot disagree.
9464
+ */
9465
+ mode: StorageLocationModeSchema.optional(),
9526
9466
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
9527
9467
  * for node-local locations it can reach) — never persisted, absent when the
9528
9468
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9530,13 +9470,50 @@ var StorageLocationSchema = object({
9530
9470
  totalBytes: number(),
9531
9471
  availableBytes: number()
9532
9472
  }).nullable().optional(),
9473
+ /**
9474
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9475
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9476
+ * never persisted, never a filesystem walk.
9477
+ *
9478
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9479
+ * location yet — nobody stores here, the owning addon is down, or the first
9480
+ * refresh has not completed. A UI must omit the segment rather than draw it
9481
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9482
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9483
+ * be spelled out loud instead of appearing by accident.
9484
+ *
9485
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9486
+ * about the whole figure rather than about its freshest part.
9487
+ */
9488
+ owned: object({
9489
+ bytes: number().int().nonnegative(),
9490
+ measuredAtMs: number().int().nonnegative()
9491
+ }).optional(),
9533
9492
  createdAt: number(),
9534
9493
  updatedAt: number()
9535
9494
  });
9495
+ object({ isDefault: boolean().optional() });
9496
+ /**
9497
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9498
+ *
9499
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9500
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9501
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9502
+ * operator learns not to believe the screen.
9503
+ */
9504
+ var StorageDrainProgressSchema = object({
9505
+ locationId: string(),
9506
+ startedAtMs: number(),
9507
+ startBytes: number(),
9508
+ bytesRemaining: number(),
9509
+ drained: boolean(),
9510
+ estimatedEmptyAtMs: number().nullable()
9511
+ });
9536
9512
  /**
9537
9513
  * Reference accepted by consumer-facing `api.storage.*` calls.
9538
9514
  * Either:
9539
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
9515
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
9516
+ * (transitionally, the `<type>:default`-slugged row when several exist)
9540
9517
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
9541
9518
  *
9542
9519
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9712,6 +9689,111 @@ var DecoderSessionConfigSchema = object({
9712
9689
  */
9713
9690
  debug: boolean().optional()
9714
9691
  });
9692
+ /**
9693
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9694
+ * an addon declares its channels in.
9695
+ *
9696
+ * ## Two axes, deliberately separated
9697
+ *
9698
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9699
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9700
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9701
+ * and rots silently. So a channel is declared where it is consulted, and the
9702
+ * `log-channels` capability enumerates the declarations.
9703
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9704
+ * thing: the logging settings document on the `system` cap. Two authorities
9705
+ * over the values is the exact defect
9706
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9707
+ * remove; re-introducing it from the cure side would be grotesque.
9708
+ *
9709
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9710
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9711
+ * the hot path with a value somebody actually read, and by
9712
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9713
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9714
+ * disarmed one (D49).
9715
+ *
9716
+ * ## The canonical call shape
9717
+ *
9718
+ * ```ts
9719
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9720
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9721
+ * }
9722
+ * ```
9723
+ *
9724
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9725
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9726
+ * object literal is never constructed because it lives inside the branch. It
9727
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9728
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9729
+ * destination floor (measured at 1.93 ns/call when off).
9730
+ *
9731
+ * ## Why a channel emits at `info`
9732
+ *
9733
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9734
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9735
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9736
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9737
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9738
+ * emits at the channel's declared level, whose schema floor is `info`.
9739
+ */
9740
+ /**
9741
+ * The level a channel writes at once armed.
9742
+ *
9743
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9744
+ * not leave the process for Loki, and the whole point of arming a channel is
9745
+ * to read it later.
9746
+ */
9747
+ var LogChannelLevelSchema = _enum([
9748
+ "info",
9749
+ "warn",
9750
+ "error"
9751
+ ]);
9752
+ /**
9753
+ * What an addon declares about one channel. No value, no state — a
9754
+ * declaration is inert.
9755
+ */
9756
+ var LogChannelDescriptorSchema = object({
9757
+ /**
9758
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9759
+ * the addon's short name so an operator reading a channel list can tell who
9760
+ * owns it without a second lookup.
9761
+ */
9762
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9763
+ /** One sentence: what the operator will SEE after arming it. */
9764
+ description: string().min(1),
9765
+ /** The level its lines are emitted at. Never below `info`. */
9766
+ defaultLevel: LogChannelLevelSchema,
9767
+ /**
9768
+ * Whether this channel can be narrowed to a camera.
9769
+ *
9770
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9771
+ * consulted with the numeric device id, AND every line the channel admits
9772
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9773
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9774
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9775
+ * the body is the only way to filter.
9776
+ *
9777
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9778
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9779
+ * the operator narrows to one camera, sees nothing, and concludes the code
9780
+ * path was never taken.
9781
+ */
9782
+ perDevice: boolean()
9783
+ });
9784
+ /**
9785
+ * An armed window over one channel, as the document hands it to a mirror.
9786
+ *
9787
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9788
+ * expires by itself, which is the one failure a boolean cannot avoid.
9789
+ */
9790
+ var LogChannelWindowSchema = object({
9791
+ channel: string().min(1),
9792
+ /** Epoch ms the window closes at. */
9793
+ armedUntilMs: number(),
9794
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9795
+ deviceIds: array(number().int()).readonly().nullable()
9796
+ });
9715
9797
  var MODEL_FORMATS = [
9716
9798
  "onnx",
9717
9799
  "coreml",
@@ -22761,7 +22843,7 @@ method(object({
22761
22843
  downloadId: string(),
22762
22844
  offset: number(),
22763
22845
  length: number()
22764
- }), _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({
22846
+ }), _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({
22765
22847
  createdAt: true,
22766
22848
  updatedAt: true
22767
22849
  }), StorageLocationSchema, {
@@ -22773,7 +22855,7 @@ method(object({
22773
22855
  }), _void(), {
22774
22856
  kind: "mutation",
22775
22857
  auth: "admin"
22776
- }), method(object({ id: string() }), object({
22858
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22777
22859
  ok: boolean(),
22778
22860
  error: string().optional()
22779
22861
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22843,6 +22925,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22843
22925
  kind: "mutation",
22844
22926
  auth: "admin"
22845
22927
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22928
+ /**
22929
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22930
+ * location (D388).
22931
+ *
22932
+ * ## Why this is not `storage-evictable`
22933
+ *
22934
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22935
+ * not, in two ways that both matter and both bite hardest on the locations an
22936
+ * operator most wants a figure for:
22937
+ *
22938
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22939
+ * and `recordingsLow:default` deliberately share one root and evict as one
22940
+ * oldest-first pool, so both answer with the SAME combined total. As an
22941
+ * occupancy figure that double-counts the disk.
22942
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22943
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22944
+ * is retiring and staring at.
22945
+ *
22946
+ * So this is its own contract with its own quantity, and the quantity is
22947
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22948
+ * would ever be willing to delete it. A provider that can only answer
22949
+ * "evictable" must not register here — a number that silently means different
22950
+ * things per class is worse than no number.
22951
+ *
22952
+ * ## Absence is an answer
22953
+ *
22954
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22955
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22956
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22957
+ * consuming side has to be written out loud instead of appearing by accident.
22958
+ *
22959
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22960
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22961
+ */
22962
+ /** One provider's occupancy answer for one location. */
22963
+ var StorageOccupancyReportSchema = object({
22964
+ locationId: string(),
22965
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22966
+ * not net of what it is willing to delete. */
22967
+ ownedBytes: number().int().nonnegative(),
22968
+ /** When the provider last actually measured this. The orchestrator carries it
22969
+ * through so a UI can say how old the figure is instead of implying "now". */
22970
+ measuredAtMs: number().int().nonnegative()
22971
+ });
22972
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22846
22973
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22847
22974
  providerId: string().min(1),
22848
22975
  displayName: string().min(1),
@@ -24678,88 +24805,6 @@ onStatusChanged: { data: object({
24678
24805
  volatileStateFields: ["lastUpdated"]
24679
24806
  };
24680
24807
  /**
24681
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24682
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24683
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24684
- * one Home Assistant projection.
24685
- */
24686
- var NetworkLinkStatusSchema = object({
24687
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24688
- type: _enum([
24689
- "wifi",
24690
- "ethernet",
24691
- "cellular",
24692
- "unknown"
24693
- ]),
24694
- /**
24695
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24696
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24697
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24698
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24699
- * SKIP a null rather than coerce it.
24700
- */
24701
- signalPercent: number().min(0).max(100).nullable(),
24702
- /** Raw received signal strength in dBm, when the firmware reports one. */
24703
- rssiDbm: number().optional(),
24704
- /** Network name of a wireless link, when the firmware reports it. */
24705
- ssid: string().optional(),
24706
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24707
- lastUpdated: number()
24708
- });
24709
- var networkLinkCapability = {
24710
- name: "network-link",
24711
- scope: "device",
24712
- deviceNative: true,
24713
- mode: "singleton",
24714
- deviceTypes: [
24715
- DeviceType.Camera,
24716
- DeviceType.Sensor,
24717
- DeviceType.Button,
24718
- DeviceType.Switch,
24719
- DeviceType.Light,
24720
- DeviceType.Lock,
24721
- DeviceType.Siren
24722
- ],
24723
- methods: {},
24724
- events: {
24725
- /**
24726
- * Emitted whenever the cached status changes (a link switch, a signal
24727
- * reading that moved). Mirrored on the parent chain by the
24728
- * DeviceEventPropagator like `battery.onStatusChanged`.
24729
- */
24730
- onStatusChanged: { data: object({
24731
- deviceId: number(),
24732
- status: NetworkLinkStatusSchema
24733
- }) } },
24734
- status: {
24735
- schema: NetworkLinkStatusSchema,
24736
- kind: "push",
24737
- empty: {
24738
- type: "unknown",
24739
- signalPercent: null,
24740
- lastUpdated: 0
24741
- }
24742
- },
24743
- /**
24744
- * Runtime-state slice — every provider stores the same shape under
24745
- * `device.runtimeState['network-link']`, read once by the badge and the
24746
- * Home Assistant projector regardless of the driver.
24747
- */
24748
- runtimeState: NetworkLinkStatusSchema,
24749
- /**
24750
- * Runtime-state durability: **restored** — a link reading is slow to
24751
- * change and a sleeping battery camera may not report for hours; the
24752
- * restored slice is what the badge shows until the next read.
24753
- *
24754
- * See `RuntimeStateDurability`. Enforced by
24755
- * `scripts/check-runtime-state-durability.ts`.
24756
- */
24757
- durability: "restored",
24758
- /** Clock fields: written, but excluded from the compare that decides
24759
- * whether persisting is worth a SQLite commit. */
24760
- volatileStateFields: ["lastUpdated"]
24761
- };
24762
- /**
24763
24808
  * Generic boolean sensor — last-resort fallback when no domain-
24764
24809
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24765
24810
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -28297,6 +28342,369 @@ var nativeObjectDetectionCapability = {
28297
28342
  volatileStateFields: ["lastFetchedAt"]
28298
28343
  };
28299
28344
  /**
28345
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28346
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28347
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28348
+ *
28349
+ * Why a NEW cap rather than overloading `ptz`:
28350
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28351
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28352
+ * The two are different physical models: PTZ is absolute-position + presets,
28353
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28354
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28355
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28356
+ * the reverse:
28357
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28358
+ * / `getOptions`), and
28359
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28360
+ * robot camera shows up in the existing PTZ control path without every
28361
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28362
+ * not here (see the addon design note):
28363
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28364
+ * ptz.stop() → navigation.stop()
28365
+ * ptz.goHome() → navigation.runAction('goHome')
28366
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28367
+ * ptz.goToPreset(id) → navigation.runAction(id)
28368
+ *
28369
+ * ## Continuous drive
28370
+ *
28371
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
28372
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
28373
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
28374
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
28375
+ * coalesce them. The UI owns the cadence.
28376
+ *
28377
+ * ## The action dictionary
28378
+ *
28379
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
28380
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
28381
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
28382
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
28383
+ * vendor-specific list. `kind: 'action'` entries are triggered with
28384
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
28385
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
28386
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
28387
+ *
28388
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
28389
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
28390
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
28391
+ * every device handle. A future nodedreame publish adds a typed
28392
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
28393
+ * provider can then swap the raw calls for the typed methods with no change to
28394
+ * THIS contract.
28395
+ */
28396
+ /**
28397
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
28398
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
28399
+ * halts it.
28400
+ *
28401
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
28402
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
28403
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
28404
+ * vector by it (drivers without proportional drive ignore it).
28405
+ *
28406
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
28407
+ * axis alone; an all-undefined nudge is a no-op.
28408
+ */
28409
+ var NavigationMoveCommandSchema = object({
28410
+ pan: number().min(-1).max(1).optional(),
28411
+ tilt: number().min(-1).max(1).optional(),
28412
+ speed: number().min(0).max(1).optional()
28413
+ });
28414
+ /**
28415
+ * The enumerated discrete actions a navigation-capable robot can perform via
28416
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
28417
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
28418
+ * `playSound` (see the `sound` dictionary entries).
28419
+ */
28420
+ var NavigationActionIdSchema = _enum([
28421
+ "goHome",
28422
+ "locate",
28423
+ "spotClean",
28424
+ "findPet",
28425
+ "personFollow",
28426
+ "stop",
28427
+ "startClean",
28428
+ "pauseClean",
28429
+ "dockWash",
28430
+ "autoEmpty",
28431
+ "flashOn",
28432
+ "flashOff"
28433
+ ]);
28434
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28435
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28436
+ /**
28437
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28438
+ * native panel and the PTZ mimic render as a button.
28439
+ *
28440
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28441
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28442
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28443
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28444
+ * - `label` — operator-facing English label.
28445
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28446
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28447
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28448
+ * flips it from config, never by editing code.
28449
+ */
28450
+ var NavigationActionEntrySchema = object({
28451
+ id: string(),
28452
+ kind: NavigationEntryKindSchema,
28453
+ label: string(),
28454
+ icon: string(),
28455
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28456
+ soundId: number().int().optional(),
28457
+ /** Per-device feature flag — render this entry only when true. */
28458
+ enabled: boolean()
28459
+ });
28460
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28461
+ var NavigationPointSchema = object({
28462
+ x: number(),
28463
+ y: number()
28464
+ });
28465
+ /**
28466
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28467
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28468
+ * that are turned on for THIS device. Data-driven: the provider derives these
28469
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28470
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28471
+ * that are not dictionary entries.
28472
+ *
28473
+ * - `move` / `stop` — the momentary drive joystick.
28474
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28475
+ * map-coordinate plumbing is wired.
28476
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28477
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28478
+ * - `light` — the on/off fill-light toggle (works anytime).
28479
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28480
+ * camera-service control; needs an active stream).
28481
+ */
28482
+ var NavigationFeaturesSchema = object({
28483
+ move: boolean(),
28484
+ stop: boolean(),
28485
+ goToPoint: boolean(),
28486
+ runAction: boolean(),
28487
+ playSound: boolean(),
28488
+ light: boolean(),
28489
+ lightMode: boolean()
28490
+ });
28491
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28492
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28493
+ /**
28494
+ * Live navigation state so the UI can reflect what the robot is doing:
28495
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28496
+ * - `following` — person/pet follow is currently armed.
28497
+ * - `flash` — the on-camera fill light is on.
28498
+ * - `lightMode` — auto vs manual fill-light mode.
28499
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28500
+ * `lightMode === 'manual'`.
28501
+ */
28502
+ var NavigationStatusSchema = object({
28503
+ mode: _enum([
28504
+ "idle",
28505
+ "cleaning",
28506
+ "spot",
28507
+ "following",
28508
+ "goto",
28509
+ "returning",
28510
+ "paused",
28511
+ "unknown"
28512
+ ]),
28513
+ following: boolean(),
28514
+ flash: boolean(),
28515
+ lightMode: NavigationLightModeSchema,
28516
+ lightLevel: number().min(40).max(100),
28517
+ /** Ms epoch when the slice was last updated. */
28518
+ lastChangedAt: number()
28519
+ });
28520
+ /**
28521
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28522
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28523
+ * convention.
28524
+ */
28525
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28526
+ var navigationCapability = {
28527
+ name: "navigation",
28528
+ scope: "device",
28529
+ deviceNative: true,
28530
+ mode: "singleton",
28531
+ deviceTypes: [DeviceType.Camera],
28532
+ deviceConfig: { ui: {
28533
+ kind: "widget",
28534
+ widgetId: "host/navigation-panel",
28535
+ tab: "navigation",
28536
+ topTab: true,
28537
+ label: "Navigation",
28538
+ order: 0
28539
+ } },
28540
+ methods: {
28541
+ /**
28542
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28543
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28544
+ * path) works for any authenticated user, not admin-only. The UI sends
28545
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28546
+ * a single drive write WITHOUT debouncing.
28547
+ */
28548
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28549
+ /** Halt all motion immediately (zero drive vector). */
28550
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28551
+ /** Send the robot to a point on its live map. */
28552
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28553
+ /**
28554
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28555
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28556
+ */
28557
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28558
+ /**
28559
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28560
+ * unsupported action ids are rejected by the provider.
28561
+ */
28562
+ runAction: method(object({
28563
+ deviceId: number(),
28564
+ actionId: NavigationActionIdSchema
28565
+ }), _void(), { kind: "mutation" }),
28566
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28567
+ playSound: method(object({
28568
+ deviceId: number(),
28569
+ soundId: number().int()
28570
+ }), _void(), { kind: "mutation" }),
28571
+ /**
28572
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28573
+ * works anytime, no active stream required).
28574
+ */
28575
+ setLightOn: method(object({
28576
+ deviceId: number(),
28577
+ on: boolean()
28578
+ }), _void(), { kind: "mutation" }),
28579
+ /**
28580
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28581
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28582
+ * action that generally needs an active camera stream/monitor session — the
28583
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28584
+ */
28585
+ setLightMode: method(object({
28586
+ deviceId: number(),
28587
+ mode: NavigationLightModeSchema,
28588
+ level: number().min(40).max(100).optional()
28589
+ }), _void(), { kind: "mutation" }),
28590
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28591
+ setLightLevel: method(object({
28592
+ deviceId: number(),
28593
+ level: number().min(40).max(100)
28594
+ }), _void(), { kind: "mutation" }),
28595
+ /**
28596
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28597
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28598
+ * `listActions`).
28599
+ */
28600
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28601
+ },
28602
+ events: { onStatusChanged: { data: object({
28603
+ deviceId: number(),
28604
+ status: NavigationStatusSchema
28605
+ }) } },
28606
+ status: {
28607
+ schema: NavigationStatusSchema,
28608
+ kind: "push"
28609
+ },
28610
+ /**
28611
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28612
+ * for live mode / follow / flash changes.
28613
+ */
28614
+ runtimeState: NavigationRuntimeStateSchema,
28615
+ /**
28616
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28617
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28618
+ * that. The live handle re-publishes on connect.
28619
+ *
28620
+ * See `RuntimeStateDurability`. Enforced by
28621
+ * `scripts/check-runtime-state-durability.ts`.
28622
+ */
28623
+ durability: "session"
28624
+ };
28625
+ /**
28626
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28627
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28628
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28629
+ * one Home Assistant projection.
28630
+ */
28631
+ var NetworkLinkStatusSchema = object({
28632
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28633
+ type: _enum([
28634
+ "wifi",
28635
+ "ethernet",
28636
+ "cellular",
28637
+ "unknown"
28638
+ ]),
28639
+ /**
28640
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28641
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28642
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28643
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28644
+ * SKIP a null rather than coerce it.
28645
+ */
28646
+ signalPercent: number().min(0).max(100).nullable(),
28647
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28648
+ rssiDbm: number().optional(),
28649
+ /** Network name of a wireless link, when the firmware reports it. */
28650
+ ssid: string().optional(),
28651
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28652
+ lastUpdated: number()
28653
+ });
28654
+ var networkLinkCapability = {
28655
+ name: "network-link",
28656
+ scope: "device",
28657
+ deviceNative: true,
28658
+ mode: "singleton",
28659
+ deviceTypes: [
28660
+ DeviceType.Camera,
28661
+ DeviceType.Sensor,
28662
+ DeviceType.Button,
28663
+ DeviceType.Switch,
28664
+ DeviceType.Light,
28665
+ DeviceType.Lock,
28666
+ DeviceType.Siren
28667
+ ],
28668
+ methods: {},
28669
+ events: {
28670
+ /**
28671
+ * Emitted whenever the cached status changes (a link switch, a signal
28672
+ * reading that moved). Mirrored on the parent chain by the
28673
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28674
+ */
28675
+ onStatusChanged: { data: object({
28676
+ deviceId: number(),
28677
+ status: NetworkLinkStatusSchema
28678
+ }) } },
28679
+ status: {
28680
+ schema: NetworkLinkStatusSchema,
28681
+ kind: "push",
28682
+ empty: {
28683
+ type: "unknown",
28684
+ signalPercent: null,
28685
+ lastUpdated: 0
28686
+ }
28687
+ },
28688
+ /**
28689
+ * Runtime-state slice — every provider stores the same shape under
28690
+ * `device.runtimeState['network-link']`, read once by the badge and the
28691
+ * Home Assistant projector regardless of the driver.
28692
+ */
28693
+ runtimeState: NetworkLinkStatusSchema,
28694
+ /**
28695
+ * Runtime-state durability: **restored** — a link reading is slow to
28696
+ * change and a sleeping battery camera may not report for hours; the
28697
+ * restored slice is what the badge shows until the next read.
28698
+ *
28699
+ * See `RuntimeStateDurability`. Enforced by
28700
+ * `scripts/check-runtime-state-durability.ts`.
28701
+ */
28702
+ durability: "restored",
28703
+ /** Clock fields: written, but excluded from the compare that decides
28704
+ * whether persisting is worth a SQLite commit. */
28705
+ volatileStateFields: ["lastUpdated"]
28706
+ };
28707
+ /**
28300
28708
  * network-quality — system-scoped singleton capability tracking RTT,
28301
28709
  * jitter, and observed/peak bandwidth per device + per client.
28302
28710
  *
@@ -29877,287 +30285,6 @@ var ptzAutotrackCapability = {
29877
30285
  */
29878
30286
  durability: "session"
29879
30287
  };
29880
- /**
29881
- * `navigation` — a device-scoped capability that natively expresses the FULL
29882
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29883
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29884
- *
29885
- * Why a NEW cap rather than overloading `ptz`:
29886
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29887
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29888
- * The two are different physical models: PTZ is absolute-position + presets,
29889
- * navigation is momentary drive nudges + discrete robot ACTIONS
29890
- * (dock / spot-clean / follow-pet / go-to-point / …).
29891
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29892
- * the reverse:
29893
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29894
- * / `getOptions`), and
29895
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29896
- * robot camera shows up in the existing PTZ control path without every
29897
- * PTZ provider learning about robots. The mapping lives in the adapter,
29898
- * not here (see the addon design note):
29899
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29900
- * ptz.stop() → navigation.stop()
29901
- * ptz.goHome() → navigation.runAction('goHome')
29902
- * ptz.getPresets() → navigation.listActions() (id→preset)
29903
- * ptz.goToPreset(id) → navigation.runAction(id)
29904
- *
29905
- * ## Continuous drive
29906
- *
29907
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29908
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29909
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29910
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29911
- * coalesce them. The UI owns the cadence.
29912
- *
29913
- * ## The action dictionary
29914
- *
29915
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29916
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29917
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29918
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29919
- * vendor-specific list. `kind: 'action'` entries are triggered with
29920
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29921
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29922
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29923
- *
29924
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29925
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29926
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29927
- * every device handle. A future nodedreame publish adds a typed
29928
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29929
- * provider can then swap the raw calls for the typed methods with no change to
29930
- * THIS contract.
29931
- */
29932
- /**
29933
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29934
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29935
- * halts it.
29936
- *
29937
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29938
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29939
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29940
- * vector by it (drivers without proportional drive ignore it).
29941
- *
29942
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29943
- * axis alone; an all-undefined nudge is a no-op.
29944
- */
29945
- var NavigationMoveCommandSchema = object({
29946
- pan: number().min(-1).max(1).optional(),
29947
- tilt: number().min(-1).max(1).optional(),
29948
- speed: number().min(0).max(1).optional()
29949
- });
29950
- /**
29951
- * The enumerated discrete actions a navigation-capable robot can perform via
29952
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29953
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29954
- * `playSound` (see the `sound` dictionary entries).
29955
- */
29956
- var NavigationActionIdSchema = _enum([
29957
- "goHome",
29958
- "locate",
29959
- "spotClean",
29960
- "findPet",
29961
- "personFollow",
29962
- "stop",
29963
- "startClean",
29964
- "pauseClean",
29965
- "dockWash",
29966
- "autoEmpty",
29967
- "flashOn",
29968
- "flashOff"
29969
- ]);
29970
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29971
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29972
- /**
29973
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29974
- * native panel and the PTZ mimic render as a button.
29975
- *
29976
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29977
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29978
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29979
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29980
- * - `label` — operator-facing English label.
29981
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29982
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29983
- * PTZ render ONLY enabled entries. Data-driven: the provider
29984
- * flips it from config, never by editing code.
29985
- */
29986
- var NavigationActionEntrySchema = object({
29987
- id: string(),
29988
- kind: NavigationEntryKindSchema,
29989
- label: string(),
29990
- icon: string(),
29991
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29992
- soundId: number().int().optional(),
29993
- /** Per-device feature flag — render this entry only when true. */
29994
- enabled: boolean()
29995
- });
29996
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29997
- var NavigationPointSchema = object({
29998
- x: number(),
29999
- y: number()
30000
- });
30001
- /**
30002
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30003
- * The cap reports which are enabled so the UI / PTZ render only the controls
30004
- * that are turned on for THIS device. Data-driven: the provider derives these
30005
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30006
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30007
- * that are not dictionary entries.
30008
- *
30009
- * - `move` / `stop` — the momentary drive joystick.
30010
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30011
- * map-coordinate plumbing is wired.
30012
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30013
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30014
- * - `light` — the on/off fill-light toggle (works anytime).
30015
- * - `lightMode` — the auto/manual selector + manual level slider (a
30016
- * camera-service control; needs an active stream).
30017
- */
30018
- var NavigationFeaturesSchema = object({
30019
- move: boolean(),
30020
- stop: boolean(),
30021
- goToPoint: boolean(),
30022
- runAction: boolean(),
30023
- playSound: boolean(),
30024
- light: boolean(),
30025
- lightMode: boolean()
30026
- });
30027
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30028
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30029
- /**
30030
- * Live navigation state so the UI can reflect what the robot is doing:
30031
- * - `mode` — coarse activity (idle / cleaning / following / …).
30032
- * - `following` — person/pet follow is currently armed.
30033
- * - `flash` — the on-camera fill light is on.
30034
- * - `lightMode` — auto vs manual fill-light mode.
30035
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30036
- * `lightMode === 'manual'`.
30037
- */
30038
- var NavigationStatusSchema = object({
30039
- mode: _enum([
30040
- "idle",
30041
- "cleaning",
30042
- "spot",
30043
- "following",
30044
- "goto",
30045
- "returning",
30046
- "paused",
30047
- "unknown"
30048
- ]),
30049
- following: boolean(),
30050
- flash: boolean(),
30051
- lightMode: NavigationLightModeSchema,
30052
- lightLevel: number().min(40).max(100),
30053
- /** Ms epoch when the slice was last updated. */
30054
- lastChangedAt: number()
30055
- });
30056
- /**
30057
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30058
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30059
- * convention.
30060
- */
30061
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30062
- var navigationCapability = {
30063
- name: "navigation",
30064
- scope: "device",
30065
- deviceNative: true,
30066
- mode: "singleton",
30067
- deviceTypes: [DeviceType.Camera],
30068
- deviceConfig: { ui: {
30069
- kind: "widget",
30070
- widgetId: "host/navigation-panel",
30071
- tab: "navigation",
30072
- topTab: true,
30073
- label: "Navigation",
30074
- order: 0
30075
- } },
30076
- methods: {
30077
- /**
30078
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30079
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30080
- * path) works for any authenticated user, not admin-only. The UI sends
30081
- * these at ~1 Hz while a control is held; the provider forwards each one to
30082
- * a single drive write WITHOUT debouncing.
30083
- */
30084
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30085
- /** Halt all motion immediately (zero drive vector). */
30086
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30087
- /** Send the robot to a point on its live map. */
30088
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30089
- /**
30090
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30091
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30092
- */
30093
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30094
- /**
30095
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30096
- * unsupported action ids are rejected by the provider.
30097
- */
30098
- runAction: method(object({
30099
- deviceId: number(),
30100
- actionId: NavigationActionIdSchema
30101
- }), _void(), { kind: "mutation" }),
30102
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30103
- playSound: method(object({
30104
- deviceId: number(),
30105
- soundId: number().int()
30106
- }), _void(), { kind: "mutation" }),
30107
- /**
30108
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30109
- * works anytime, no active stream required).
30110
- */
30111
- setLightOn: method(object({
30112
- deviceId: number(),
30113
- on: boolean()
30114
- }), _void(), { kind: "mutation" }),
30115
- /**
30116
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30117
- * initial `level`. The auto/manual + level control is a CAMERA-service
30118
- * action that generally needs an active camera stream/monitor session — the
30119
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30120
- */
30121
- setLightMode: method(object({
30122
- deviceId: number(),
30123
- mode: NavigationLightModeSchema,
30124
- level: number().min(40).max(100).optional()
30125
- }), _void(), { kind: "mutation" }),
30126
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30127
- setLightLevel: method(object({
30128
- deviceId: number(),
30129
- level: number().min(40).max(100)
30130
- }), _void(), { kind: "mutation" }),
30131
- /**
30132
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30133
- * controls the UI shows (the per-entry flags for the dictionary come back on
30134
- * `listActions`).
30135
- */
30136
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30137
- },
30138
- events: { onStatusChanged: { data: object({
30139
- deviceId: number(),
30140
- status: NavigationStatusSchema
30141
- }) } },
30142
- status: {
30143
- schema: NavigationStatusSchema,
30144
- kind: "push"
30145
- },
30146
- /**
30147
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30148
- * for live mode / follow / flash changes.
30149
- */
30150
- runtimeState: NavigationRuntimeStateSchema,
30151
- /**
30152
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30153
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30154
- * that. The live handle re-publishes on connect.
30155
- *
30156
- * See `RuntimeStateDurability`. Enforced by
30157
- * `scripts/check-runtime-state-durability.ts`.
30158
- */
30159
- durability: "session"
30160
- };
30161
30288
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30162
30289
  kind: "mutation",
30163
30290
  auth: "admin"
@@ -39614,13 +39741,13 @@ Object.freeze({
39614
39741
  addonId: null,
39615
39742
  access: "view"
39616
39743
  },
39617
- "storage.getDefaultLocation": {
39744
+ "storage.list": {
39618
39745
  capName: "storage",
39619
39746
  capScope: "system",
39620
39747
  addonId: null,
39621
39748
  access: "view"
39622
39749
  },
39623
- "storage.list": {
39750
+ "storage.listDrainProgress": {
39624
39751
  capName: "storage",
39625
39752
  capScope: "system",
39626
39753
  addonId: null,
@@ -39770,6 +39897,12 @@ Object.freeze({
39770
39897
  addonId: null,
39771
39898
  access: "view"
39772
39899
  },
39900
+ "storageOccupancy.getOccupancy": {
39901
+ capName: "storage-occupancy",
39902
+ capScope: "system",
39903
+ addonId: null,
39904
+ access: "view"
39905
+ },
39773
39906
  "storageProvider.abortUpload": {
39774
39907
  capName: "storage-provider",
39775
39908
  capScope: "system",