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