@camstack/addon-provider-dreame 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 +769 -636
  2. package/dist/addon.mjs +769 -636
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -52669,7 +52669,7 @@ var DreameCameraStream = class extends TypedEmitter {
52669
52669
  }
52670
52670
  };
52671
52671
  //#endregion
52672
- //#region ../types/dist/event-category-zAv7pMUz.mjs
52672
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
52673
52673
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
52674
52674
  EventCategory["SystemBoot"] = "system.boot";
52675
52675
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -52864,6 +52864,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
52864
52864
  EventCategory["ProcessCrashed"] = "process.crashed";
52865
52865
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
52866
52866
  EventCategory["ProcessRestarted"] = "process.restarted";
52867
+ /**
52868
+ * The SET of storage locations changed — one was created, edited, enabled,
52869
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
52870
+ *
52871
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
52872
+ * it must also converge on its own periodic path, because a dropped event
52873
+ * must not leave a node writing to yesterday's disk set forever. It exists
52874
+ * because there was NO signal at all — an operator who added a second
52875
+ * recordings disk in the admin UI got nothing, and the recorder kept its
52876
+ * resolved locations until something else happened to re-resolve them
52877
+ * (D387). Payload `StorageLocationsChangedPayload`.
52878
+ */
52879
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
52867
52880
  EventCategory["RecordingStarted"] = "recording.started";
52868
52881
  EventCategory["RecordingStopped"] = "recording.stopped";
52869
52882
  EventCategory["RecordingError"] = "recording.error";
@@ -60285,111 +60298,6 @@ var CameraSwitchGroupSchema = object({
60285
60298
  fetchedAt: number()
60286
60299
  });
60287
60300
  /**
60288
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
60289
- * an addon declares its channels in.
60290
- *
60291
- * ## Two axes, deliberately separated
60292
- *
60293
- * - **DECLARATION** — which channels exist. Only the addon knows:
60294
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
60295
- * baichuan/handshake. A hand-wired central list rots at the first addition,
60296
- * and rots silently. So a channel is declared where it is consulted, and the
60297
- * `log-channels` capability enumerates the declarations.
60298
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
60299
- * thing: the logging settings document on the `system` cap. Two authorities
60300
- * over the values is the exact defect
60301
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
60302
- * remove; re-introducing it from the cure side would be grotesque.
60303
- *
60304
- * Nothing in this file reads a clock, an env var or a store. The registry is
60305
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
60306
- * the hot path with a value somebody actually read, and by
60307
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
60308
- * never reaches here, so it can neither disarm an armed channel nor arm a
60309
- * disarmed one (D49).
60310
- *
60311
- * ## The canonical call shape
60312
- *
60313
- * ```ts
60314
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
60315
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
60316
- * }
60317
- * ```
60318
- *
60319
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
60320
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
60321
- * object literal is never constructed because it lives inside the branch. It
60322
- * is the same shape already proven in production at `stream-broker.ts:1650`,
60323
- * and the same discipline `LoggingGate.allowsDestination` uses for the
60324
- * destination floor (measured at 1.93 ns/call when off).
60325
- *
60326
- * ## Why a channel emits at `info`
60327
- *
60328
- * `loki-logging.addon.ts` pins the destination default at `info` and
60329
- * `loki-destination.ts` drops everything below it, so a line emitted at
60330
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
60331
- * minutes. A diagnostic that cannot be read an hour later is worse than no
60332
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
60333
- * emits at the channel's declared level, whose schema floor is `info`.
60334
- */
60335
- /**
60336
- * The level a channel writes at once armed.
60337
- *
60338
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
60339
- * not leave the process for Loki, and the whole point of arming a channel is
60340
- * to read it later.
60341
- */
60342
- var LogChannelLevelSchema = _enum([
60343
- "info",
60344
- "warn",
60345
- "error"
60346
- ]);
60347
- /**
60348
- * What an addon declares about one channel. No value, no state — a
60349
- * declaration is inert.
60350
- */
60351
- var LogChannelDescriptorSchema = object({
60352
- /**
60353
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
60354
- * the addon's short name so an operator reading a channel list can tell who
60355
- * owns it without a second lookup.
60356
- */
60357
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
60358
- /** One sentence: what the operator will SEE after arming it. */
60359
- description: string().min(1),
60360
- /** The level its lines are emitted at. Never below `info`. */
60361
- defaultLevel: LogChannelLevelSchema,
60362
- /**
60363
- * Whether this channel can be narrowed to a camera.
60364
- *
60365
- * `true` is a PROMISE with two halves, and both must hold: the gate is
60366
- * consulted with the numeric device id, AND every line the channel admits
60367
- * carries `tags: { deviceId }` with that same numeric id. The second half is
60368
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
60369
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
60370
- * the body is the only way to filter.
60371
- *
60372
- * A channel whose lines carry the device only in `meta` (or not at all) is
60373
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
60374
- * the operator narrows to one camera, sees nothing, and concludes the code
60375
- * path was never taken.
60376
- */
60377
- perDevice: boolean()
60378
- });
60379
- /**
60380
- * An armed window over one channel, as the document hands it to a mirror.
60381
- *
60382
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
60383
- * expires by itself, which is the one failure a boolean cannot avoid.
60384
- */
60385
- var LogChannelWindowSchema = object({
60386
- channel: string().min(1),
60387
- /** Epoch ms the window closes at. */
60388
- armedUntilMs: number(),
60389
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
60390
- deviceIds: array(number().int()).readonly().nullable()
60391
- });
60392
- /**
60393
60301
  * Ops-log — the durable, append-only operations audit shared by the
60394
60302
  * recordings and events management surfaces.
60395
60303
  *
@@ -61311,6 +61219,21 @@ var StorageCleanupJobSchema = object({
61311
61219
  });
61312
61220
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
61313
61221
  /**
61222
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
61223
+ * alias below is `z.infer<>` of it, never a second spelling.
61224
+ */
61225
+ var StorageLocationModeSchema = _enum([
61226
+ "active",
61227
+ "readonly",
61228
+ "drain",
61229
+ "disabled"
61230
+ ]);
61231
+ _enum([
61232
+ "normal",
61233
+ "never",
61234
+ "drain"
61235
+ ]);
61236
+ /**
61314
61237
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
61315
61238
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
61316
61239
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -61335,8 +61258,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
61335
61258
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
61336
61259
  *
61337
61260
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
61338
- * The default location for a type uses `id === <type>:default` by
61339
- * convention (the bare type ref like `'backups'` resolves to it).
61261
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
61262
+ * There is no default location any more (D383): `enabled` is the whole write
61263
+ * model, and a bare type ref resolves to the sole location of the type, or —
61264
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
61265
+ * slug is `default`.
61340
61266
  *
61341
61267
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
61342
61268
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -61357,23 +61283,37 @@ var StorageLocationSchema = object({
61357
61283
  * flag at upsert time, not here (the schema is provider-agnostic).
61358
61284
  */
61359
61285
  nodeId: string().optional(),
61360
- isDefault: boolean().default(false),
61361
61286
  isSystem: boolean().default(false),
61362
61287
  /**
61363
- * Operator opt-in: whether consumers that BALANCE across several locations
61364
- * of a type may write here. Recordings reads it today; event media and
61365
- * backups are the next consumers, which is why the flag lives on the
61366
- * location rather than in any one addon's store — nothing has to be
61367
- * extended to add the next consumer.
61288
+ * THE write switch, and the only one (D383). `enabled: true` means every
61289
+ * consumer that chooses a write target for this type may write here, and all
61290
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
61291
+ * still read, still played back, still age-swept, still drained, never
61292
+ * written.
61368
61293
  *
61369
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
61370
- * flag existed reads back with no flag and keeps working exactly as before;
61371
- * that is the whole compat story, and it is why no migration ships with it.
61372
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
61373
- * disk must not silently start writing to it); the default of a type is
61374
- * always stamped `true`.
61294
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
61295
+ * stored" on an update and "born inert unless it is the first location of its
61296
+ * type" on a create. On a PERSISTED row absence is legacy and it means
61297
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
61298
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
61299
+ * stops existing rather than being re-derived on every read.
61375
61300
  */
61376
61301
  enabled: boolean().optional(),
61302
+ /**
61303
+ * THE state of this location (D385), and the only authority on what may be
61304
+ * written, read or evicted here. Interpreted in exactly one place —
61305
+ * `storage-location-mode.ts` — which also folds the legacy
61306
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
61307
+ * ambiguous.
61308
+ *
61309
+ * OPTIONAL only for the wire and for rows written before D385: absence is
61310
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
61311
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
61312
+ * re-derived on every read. `enabled` survives one release as a DERIVED
61313
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
61314
+ * either, so the two cannot disagree.
61315
+ */
61316
+ mode: StorageLocationModeSchema.optional(),
61377
61317
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
61378
61318
  * for node-local locations it can reach) — never persisted, absent when the
61379
61319
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -61381,13 +61321,50 @@ var StorageLocationSchema = object({
61381
61321
  totalBytes: number(),
61382
61322
  availableBytes: number()
61383
61323
  }).nullable().optional(),
61324
+ /**
61325
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
61326
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
61327
+ * never persisted, never a filesystem walk.
61328
+ *
61329
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
61330
+ * location yet — nobody stores here, the owning addon is down, or the first
61331
+ * refresh has not completed. A UI must omit the segment rather than draw it
61332
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
61333
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
61334
+ * be spelled out loud instead of appearing by accident.
61335
+ *
61336
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
61337
+ * about the whole figure rather than about its freshest part.
61338
+ */
61339
+ owned: object({
61340
+ bytes: number().int().nonnegative(),
61341
+ measuredAtMs: number().int().nonnegative()
61342
+ }).optional(),
61384
61343
  createdAt: number(),
61385
61344
  updatedAt: number()
61386
61345
  });
61346
+ object({ isDefault: boolean().optional() });
61347
+ /**
61348
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
61349
+ *
61350
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
61351
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
61352
+ * drain with no observed growth has no honest ETA, and inventing one is how an
61353
+ * operator learns not to believe the screen.
61354
+ */
61355
+ var StorageDrainProgressSchema = object({
61356
+ locationId: string(),
61357
+ startedAtMs: number(),
61358
+ startBytes: number(),
61359
+ bytesRemaining: number(),
61360
+ drained: boolean(),
61361
+ estimatedEmptyAtMs: number().nullable()
61362
+ });
61387
61363
  /**
61388
61364
  * Reference accepted by consumer-facing `api.storage.*` calls.
61389
61365
  * Either:
61390
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
61366
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
61367
+ * (transitionally, the `<type>:default`-slugged row when several exist)
61391
61368
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
61392
61369
  *
61393
61370
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -61563,6 +61540,111 @@ var DecoderSessionConfigSchema = object({
61563
61540
  */
61564
61541
  debug: boolean().optional()
61565
61542
  });
61543
+ /**
61544
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
61545
+ * an addon declares its channels in.
61546
+ *
61547
+ * ## Two axes, deliberately separated
61548
+ *
61549
+ * - **DECLARATION** — which channels exist. Only the addon knows:
61550
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
61551
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
61552
+ * and rots silently. So a channel is declared where it is consulted, and the
61553
+ * `log-channels` capability enumerates the declarations.
61554
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
61555
+ * thing: the logging settings document on the `system` cap. Two authorities
61556
+ * over the values is the exact defect
61557
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
61558
+ * remove; re-introducing it from the cure side would be grotesque.
61559
+ *
61560
+ * Nothing in this file reads a clock, an env var or a store. The registry is
61561
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
61562
+ * the hot path with a value somebody actually read, and by
61563
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
61564
+ * never reaches here, so it can neither disarm an armed channel nor arm a
61565
+ * disarmed one (D49).
61566
+ *
61567
+ * ## The canonical call shape
61568
+ *
61569
+ * ```ts
61570
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
61571
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
61572
+ * }
61573
+ * ```
61574
+ *
61575
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
61576
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
61577
+ * object literal is never constructed because it lives inside the branch. It
61578
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
61579
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
61580
+ * destination floor (measured at 1.93 ns/call when off).
61581
+ *
61582
+ * ## Why a channel emits at `info`
61583
+ *
61584
+ * `loki-logging.addon.ts` pins the destination default at `info` and
61585
+ * `loki-destination.ts` drops everything below it, so a line emitted at
61586
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
61587
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
61588
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
61589
+ * emits at the channel's declared level, whose schema floor is `info`.
61590
+ */
61591
+ /**
61592
+ * The level a channel writes at once armed.
61593
+ *
61594
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
61595
+ * not leave the process for Loki, and the whole point of arming a channel is
61596
+ * to read it later.
61597
+ */
61598
+ var LogChannelLevelSchema = _enum([
61599
+ "info",
61600
+ "warn",
61601
+ "error"
61602
+ ]);
61603
+ /**
61604
+ * What an addon declares about one channel. No value, no state — a
61605
+ * declaration is inert.
61606
+ */
61607
+ var LogChannelDescriptorSchema = object({
61608
+ /**
61609
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
61610
+ * the addon's short name so an operator reading a channel list can tell who
61611
+ * owns it without a second lookup.
61612
+ */
61613
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
61614
+ /** One sentence: what the operator will SEE after arming it. */
61615
+ description: string().min(1),
61616
+ /** The level its lines are emitted at. Never below `info`. */
61617
+ defaultLevel: LogChannelLevelSchema,
61618
+ /**
61619
+ * Whether this channel can be narrowed to a camera.
61620
+ *
61621
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
61622
+ * consulted with the numeric device id, AND every line the channel admits
61623
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
61624
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
61625
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
61626
+ * the body is the only way to filter.
61627
+ *
61628
+ * A channel whose lines carry the device only in `meta` (or not at all) is
61629
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
61630
+ * the operator narrows to one camera, sees nothing, and concludes the code
61631
+ * path was never taken.
61632
+ */
61633
+ perDevice: boolean()
61634
+ });
61635
+ /**
61636
+ * An armed window over one channel, as the document hands it to a mirror.
61637
+ *
61638
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
61639
+ * expires by itself, which is the one failure a boolean cannot avoid.
61640
+ */
61641
+ var LogChannelWindowSchema = object({
61642
+ channel: string().min(1),
61643
+ /** Epoch ms the window closes at. */
61644
+ armedUntilMs: number(),
61645
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
61646
+ deviceIds: array(number().int()).readonly().nullable()
61647
+ });
61566
61648
  var MODEL_FORMATS = [
61567
61649
  "onnx",
61568
61650
  "coreml",
@@ -74612,7 +74694,7 @@ method(object({
74612
74694
  downloadId: string(),
74613
74695
  offset: number(),
74614
74696
  length: number()
74615
- }), _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({
74697
+ }), _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({
74616
74698
  createdAt: true,
74617
74699
  updatedAt: true
74618
74700
  }), StorageLocationSchema, {
@@ -74624,7 +74706,7 @@ method(object({
74624
74706
  }), _void(), {
74625
74707
  kind: "mutation",
74626
74708
  auth: "admin"
74627
- }), method(object({ id: string() }), object({
74709
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
74628
74710
  ok: boolean(),
74629
74711
  error: string().optional()
74630
74712
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -74694,6 +74776,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
74694
74776
  kind: "mutation",
74695
74777
  auth: "admin"
74696
74778
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
74779
+ /**
74780
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
74781
+ * location (D388).
74782
+ *
74783
+ * ## Why this is not `storage-evictable`
74784
+ *
74785
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
74786
+ * not, in two ways that both matter and both bite hardest on the locations an
74787
+ * operator most wants a figure for:
74788
+ *
74789
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
74790
+ * and `recordingsLow:default` deliberately share one root and evict as one
74791
+ * oldest-first pool, so both answer with the SAME combined total. As an
74792
+ * occupancy figure that double-counts the disk.
74793
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
74794
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
74795
+ * is retiring and staring at.
74796
+ *
74797
+ * So this is its own contract with its own quantity, and the quantity is
74798
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
74799
+ * would ever be willing to delete it. A provider that can only answer
74800
+ * "evictable" must not register here — a number that silently means different
74801
+ * things per class is worse than no number.
74802
+ *
74803
+ * ## Absence is an answer
74804
+ *
74805
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
74806
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
74807
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
74808
+ * consuming side has to be written out loud instead of appearing by accident.
74809
+ *
74810
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
74811
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
74812
+ */
74813
+ /** One provider's occupancy answer for one location. */
74814
+ var StorageOccupancyReportSchema = object({
74815
+ locationId: string(),
74816
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
74817
+ * not net of what it is willing to delete. */
74818
+ ownedBytes: number().int().nonnegative(),
74819
+ /** When the provider last actually measured this. The orchestrator carries it
74820
+ * through so a UI can say how old the figure is instead of implying "now". */
74821
+ measuredAtMs: number().int().nonnegative()
74822
+ });
74823
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
74697
74824
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
74698
74825
  providerId: string().min(1),
74699
74826
  displayName: string().min(1),
@@ -76529,99 +76656,6 @@ onStatusChanged: { data: object({
76529
76656
  volatileStateFields: ["lastUpdated"]
76530
76657
  };
76531
76658
  /**
76532
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
76533
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
76534
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
76535
- * one Home Assistant projection.
76536
- */
76537
- var NetworkLinkStatusSchema = object({
76538
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
76539
- type: _enum([
76540
- "wifi",
76541
- "ethernet",
76542
- "cellular",
76543
- "unknown"
76544
- ]),
76545
- /**
76546
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
76547
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
76548
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
76549
- * one whose reading has not landed must not be drawn at 0 %. Consumers
76550
- * SKIP a null rather than coerce it.
76551
- */
76552
- signalPercent: number().min(0).max(100).nullable(),
76553
- /** Raw received signal strength in dBm, when the firmware reports one. */
76554
- rssiDbm: number().optional(),
76555
- /** Network name of a wireless link, when the firmware reports it. */
76556
- ssid: string().optional(),
76557
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
76558
- lastUpdated: number()
76559
- });
76560
- /** The slice a provider seeds before its first read: nothing is known yet. */
76561
- var NETWORK_LINK_UNKNOWN = {
76562
- type: "unknown",
76563
- signalPercent: null,
76564
- lastUpdated: 0
76565
- };
76566
- /**
76567
- * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
76568
- * Out-of-range or non-finite input is not a reading: `null`.
76569
- */
76570
- function signalPercentFromBars(bars, maxBars) {
76571
- if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
76572
- if (bars < 0 || bars > maxBars) return null;
76573
- return Math.round(bars / maxBars * 100);
76574
- }
76575
- var networkLinkCapability = {
76576
- name: "network-link",
76577
- scope: "device",
76578
- deviceNative: true,
76579
- mode: "singleton",
76580
- deviceTypes: [
76581
- DeviceType.Camera,
76582
- DeviceType.Sensor,
76583
- DeviceType.Button,
76584
- DeviceType.Switch,
76585
- DeviceType.Light,
76586
- DeviceType.Lock,
76587
- DeviceType.Siren
76588
- ],
76589
- methods: {},
76590
- events: {
76591
- /**
76592
- * Emitted whenever the cached status changes (a link switch, a signal
76593
- * reading that moved). Mirrored on the parent chain by the
76594
- * DeviceEventPropagator like `battery.onStatusChanged`.
76595
- */
76596
- onStatusChanged: { data: object({
76597
- deviceId: number(),
76598
- status: NetworkLinkStatusSchema
76599
- }) } },
76600
- status: {
76601
- schema: NetworkLinkStatusSchema,
76602
- kind: "push",
76603
- empty: NETWORK_LINK_UNKNOWN
76604
- },
76605
- /**
76606
- * Runtime-state slice — every provider stores the same shape under
76607
- * `device.runtimeState['network-link']`, read once by the badge and the
76608
- * Home Assistant projector regardless of the driver.
76609
- */
76610
- runtimeState: NetworkLinkStatusSchema,
76611
- /**
76612
- * Runtime-state durability: **restored** — a link reading is slow to
76613
- * change and a sleeping battery camera may not report for hours; the
76614
- * restored slice is what the badge shows until the next read.
76615
- *
76616
- * See `RuntimeStateDurability`. Enforced by
76617
- * `scripts/check-runtime-state-durability.ts`.
76618
- */
76619
- durability: "restored",
76620
- /** Clock fields: written, but excluded from the compare that decides
76621
- * whether persisting is worth a SQLite commit. */
76622
- volatileStateFields: ["lastUpdated"]
76623
- };
76624
- /**
76625
76659
  * Generic boolean sensor — last-resort fallback when no domain-
76626
76660
  * specific binary cap fits (Home Assistant `binary_sensor` without a
76627
76661
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -80176,6 +80210,517 @@ var nativeObjectDetectionCapability = {
80176
80210
  volatileStateFields: ["lastFetchedAt"]
80177
80211
  };
80178
80212
  /**
80213
+ * `navigation` — a device-scoped capability that natively expresses the FULL
80214
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
80215
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
80216
+ *
80217
+ * Why a NEW cap rather than overloading `ptz`:
80218
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
80219
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
80220
+ * The two are different physical models: PTZ is absolute-position + presets,
80221
+ * navigation is momentary drive nudges + discrete robot ACTIONS
80222
+ * (dock / spot-clean / follow-pet / go-to-point / …).
80223
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
80224
+ * the reverse:
80225
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
80226
+ * / `getOptions`), and
80227
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
80228
+ * robot camera shows up in the existing PTZ control path without every
80229
+ * PTZ provider learning about robots. The mapping lives in the adapter,
80230
+ * not here (see the addon design note):
80231
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
80232
+ * ptz.stop() → navigation.stop()
80233
+ * ptz.goHome() → navigation.runAction('goHome')
80234
+ * ptz.getPresets() → navigation.listActions() (id→preset)
80235
+ * ptz.goToPreset(id) → navigation.runAction(id)
80236
+ *
80237
+ * ## Continuous drive
80238
+ *
80239
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
80240
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
80241
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
80242
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
80243
+ * coalesce them. The UI owns the cadence.
80244
+ *
80245
+ * ## The action dictionary
80246
+ *
80247
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
80248
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
80249
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
80250
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
80251
+ * vendor-specific list. `kind: 'action'` entries are triggered with
80252
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
80253
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
80254
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
80255
+ *
80256
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
80257
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
80258
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
80259
+ * every device handle. A future nodedreame publish adds a typed
80260
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
80261
+ * provider can then swap the raw calls for the typed methods with no change to
80262
+ * THIS contract.
80263
+ */
80264
+ /**
80265
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
80266
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
80267
+ * halts it.
80268
+ *
80269
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
80270
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
80271
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
80272
+ * vector by it (drivers without proportional drive ignore it).
80273
+ *
80274
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
80275
+ * axis alone; an all-undefined nudge is a no-op.
80276
+ */
80277
+ var NavigationMoveCommandSchema = object({
80278
+ pan: number().min(-1).max(1).optional(),
80279
+ tilt: number().min(-1).max(1).optional(),
80280
+ speed: number().min(0).max(1).optional()
80281
+ });
80282
+ /**
80283
+ * The enumerated discrete actions a navigation-capable robot can perform via
80284
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
80285
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
80286
+ * `playSound` (see the `sound` dictionary entries).
80287
+ */
80288
+ var NavigationActionIdSchema = _enum([
80289
+ "goHome",
80290
+ "locate",
80291
+ "spotClean",
80292
+ "findPet",
80293
+ "personFollow",
80294
+ "stop",
80295
+ "startClean",
80296
+ "pauseClean",
80297
+ "dockWash",
80298
+ "autoEmpty",
80299
+ "flashOn",
80300
+ "flashOff"
80301
+ ]);
80302
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
80303
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
80304
+ /**
80305
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
80306
+ * native panel and the PTZ mimic render as a button.
80307
+ *
80308
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
80309
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
80310
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
80311
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
80312
+ * - `label` — operator-facing English label.
80313
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
80314
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
80315
+ * PTZ render ONLY enabled entries. Data-driven: the provider
80316
+ * flips it from config, never by editing code.
80317
+ */
80318
+ var NavigationActionEntrySchema = object({
80319
+ id: string(),
80320
+ kind: NavigationEntryKindSchema,
80321
+ label: string(),
80322
+ icon: string(),
80323
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
80324
+ soundId: number().int().optional(),
80325
+ /** Per-device feature flag — render this entry only when true. */
80326
+ enabled: boolean()
80327
+ });
80328
+ /**
80329
+ * Canonical dictionary of every navigation control (discrete actions + sounds)
80330
+ * with its default label + icon hint. A provider filters this to the subset a
80331
+ * device supports (and may override a label). Exported so the provider AND the
80332
+ * UI share ONE list instead of re-deriving labels / ids independently.
80333
+ *
80334
+ * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
80335
+ * catalog default is `enabled: true`; a provider overrides per-device from
80336
+ * config (data-driven — enabling / disabling one later is a config change, not a
80337
+ * code change).
80338
+ */
80339
+ var NAVIGATION_ACTION_CATALOG = [
80340
+ {
80341
+ id: "startClean",
80342
+ kind: "action",
80343
+ label: "Start cleaning",
80344
+ icon: "play",
80345
+ enabled: true
80346
+ },
80347
+ {
80348
+ id: "pauseClean",
80349
+ kind: "action",
80350
+ label: "Pause cleaning",
80351
+ icon: "pause",
80352
+ enabled: true
80353
+ },
80354
+ {
80355
+ id: "stop",
80356
+ kind: "action",
80357
+ label: "Stop",
80358
+ icon: "hand",
80359
+ enabled: true
80360
+ },
80361
+ {
80362
+ id: "goHome",
80363
+ kind: "action",
80364
+ label: "Return to dock",
80365
+ icon: "home",
80366
+ enabled: true
80367
+ },
80368
+ {
80369
+ id: "locate",
80370
+ kind: "action",
80371
+ label: "Locate",
80372
+ icon: "bell",
80373
+ enabled: true
80374
+ },
80375
+ {
80376
+ id: "spotClean",
80377
+ kind: "action",
80378
+ label: "Spot clean here",
80379
+ icon: "crosshair",
80380
+ enabled: true
80381
+ },
80382
+ {
80383
+ id: "findPet",
80384
+ kind: "action",
80385
+ label: "Find pet",
80386
+ icon: "paw-print",
80387
+ enabled: true
80388
+ },
80389
+ {
80390
+ id: "personFollow",
80391
+ kind: "action",
80392
+ label: "Follow me",
80393
+ icon: "footprints",
80394
+ enabled: true
80395
+ },
80396
+ {
80397
+ id: "dockWash",
80398
+ kind: "action",
80399
+ label: "Wash mop",
80400
+ icon: "droplets",
80401
+ enabled: true
80402
+ },
80403
+ {
80404
+ id: "autoEmpty",
80405
+ kind: "action",
80406
+ label: "Empty dustbin",
80407
+ icon: "trash-2",
80408
+ enabled: true
80409
+ },
80410
+ {
80411
+ id: "flashOn",
80412
+ kind: "action",
80413
+ label: "Flash on",
80414
+ icon: "flashlight",
80415
+ enabled: true
80416
+ },
80417
+ {
80418
+ id: "flashOff",
80419
+ kind: "action",
80420
+ label: "Flash off",
80421
+ icon: "flashlight-off",
80422
+ enabled: true
80423
+ },
80424
+ {
80425
+ id: "sound:meow",
80426
+ kind: "sound",
80427
+ label: "Meow",
80428
+ icon: "cat",
80429
+ soundId: 684,
80430
+ enabled: true
80431
+ },
80432
+ {
80433
+ id: "sound:bark",
80434
+ kind: "sound",
80435
+ label: "Woof",
80436
+ icon: "dog",
80437
+ soundId: 685,
80438
+ enabled: true
80439
+ },
80440
+ {
80441
+ id: "sound:footsteps",
80442
+ kind: "sound",
80443
+ label: "Footsteps",
80444
+ icon: "footprints",
80445
+ soundId: 686,
80446
+ enabled: true
80447
+ },
80448
+ {
80449
+ id: "sound:purring",
80450
+ kind: "sound",
80451
+ label: "Purring",
80452
+ icon: "cat",
80453
+ soundId: 687,
80454
+ enabled: true
80455
+ },
80456
+ {
80457
+ id: "sound:tickTock",
80458
+ kind: "sound",
80459
+ label: "Tick-tock",
80460
+ icon: "clock",
80461
+ soundId: 688,
80462
+ enabled: true
80463
+ }
80464
+ ];
80465
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
80466
+ var NavigationPointSchema = object({
80467
+ x: number(),
80468
+ y: number()
80469
+ });
80470
+ /**
80471
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
80472
+ * The cap reports which are enabled so the UI / PTZ render only the controls
80473
+ * that are turned on for THIS device. Data-driven: the provider derives these
80474
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
80475
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
80476
+ * that are not dictionary entries.
80477
+ *
80478
+ * - `move` / `stop` — the momentary drive joystick.
80479
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
80480
+ * map-coordinate plumbing is wired.
80481
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
80482
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
80483
+ * - `light` — the on/off fill-light toggle (works anytime).
80484
+ * - `lightMode` — the auto/manual selector + manual level slider (a
80485
+ * camera-service control; needs an active stream).
80486
+ */
80487
+ var NavigationFeaturesSchema = object({
80488
+ move: boolean(),
80489
+ stop: boolean(),
80490
+ goToPoint: boolean(),
80491
+ runAction: boolean(),
80492
+ playSound: boolean(),
80493
+ light: boolean(),
80494
+ lightMode: boolean()
80495
+ });
80496
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
80497
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
80498
+ /**
80499
+ * Live navigation state so the UI can reflect what the robot is doing:
80500
+ * - `mode` — coarse activity (idle / cleaning / following / …).
80501
+ * - `following` — person/pet follow is currently armed.
80502
+ * - `flash` — the on-camera fill light is on.
80503
+ * - `lightMode` — auto vs manual fill-light mode.
80504
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
80505
+ * `lightMode === 'manual'`.
80506
+ */
80507
+ var NavigationStatusSchema = object({
80508
+ mode: _enum([
80509
+ "idle",
80510
+ "cleaning",
80511
+ "spot",
80512
+ "following",
80513
+ "goto",
80514
+ "returning",
80515
+ "paused",
80516
+ "unknown"
80517
+ ]),
80518
+ following: boolean(),
80519
+ flash: boolean(),
80520
+ lightMode: NavigationLightModeSchema,
80521
+ lightLevel: number().min(40).max(100),
80522
+ /** Ms epoch when the slice was last updated. */
80523
+ lastChangedAt: number()
80524
+ });
80525
+ /**
80526
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
80527
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
80528
+ * convention.
80529
+ */
80530
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
80531
+ var navigationCapability = {
80532
+ name: "navigation",
80533
+ scope: "device",
80534
+ deviceNative: true,
80535
+ mode: "singleton",
80536
+ deviceTypes: [DeviceType.Camera],
80537
+ deviceConfig: { ui: {
80538
+ kind: "widget",
80539
+ widgetId: "host/navigation-panel",
80540
+ tab: "navigation",
80541
+ topTab: true,
80542
+ label: "Navigation",
80543
+ order: 0
80544
+ } },
80545
+ methods: {
80546
+ /**
80547
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
80548
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
80549
+ * path) works for any authenticated user, not admin-only. The UI sends
80550
+ * these at ~1 Hz while a control is held; the provider forwards each one to
80551
+ * a single drive write WITHOUT debouncing.
80552
+ */
80553
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
80554
+ /** Halt all motion immediately (zero drive vector). */
80555
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
80556
+ /** Send the robot to a point on its live map. */
80557
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
80558
+ /**
80559
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
80560
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
80561
+ */
80562
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
80563
+ /**
80564
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
80565
+ * unsupported action ids are rejected by the provider.
80566
+ */
80567
+ runAction: method(object({
80568
+ deviceId: number(),
80569
+ actionId: NavigationActionIdSchema
80570
+ }), _void(), { kind: "mutation" }),
80571
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
80572
+ playSound: method(object({
80573
+ deviceId: number(),
80574
+ soundId: number().int()
80575
+ }), _void(), { kind: "mutation" }),
80576
+ /**
80577
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
80578
+ * works anytime, no active stream required).
80579
+ */
80580
+ setLightOn: method(object({
80581
+ deviceId: number(),
80582
+ on: boolean()
80583
+ }), _void(), { kind: "mutation" }),
80584
+ /**
80585
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
80586
+ * initial `level`. The auto/manual + level control is a CAMERA-service
80587
+ * action that generally needs an active camera stream/monitor session — the
80588
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
80589
+ */
80590
+ setLightMode: method(object({
80591
+ deviceId: number(),
80592
+ mode: NavigationLightModeSchema,
80593
+ level: number().min(40).max(100).optional()
80594
+ }), _void(), { kind: "mutation" }),
80595
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
80596
+ setLightLevel: method(object({
80597
+ deviceId: number(),
80598
+ level: number().min(40).max(100)
80599
+ }), _void(), { kind: "mutation" }),
80600
+ /**
80601
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
80602
+ * controls the UI shows (the per-entry flags for the dictionary come back on
80603
+ * `listActions`).
80604
+ */
80605
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
80606
+ },
80607
+ events: { onStatusChanged: { data: object({
80608
+ deviceId: number(),
80609
+ status: NavigationStatusSchema
80610
+ }) } },
80611
+ status: {
80612
+ schema: NavigationStatusSchema,
80613
+ kind: "push"
80614
+ },
80615
+ /**
80616
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
80617
+ * for live mode / follow / flash changes.
80618
+ */
80619
+ runtimeState: NavigationRuntimeStateSchema,
80620
+ /**
80621
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
80622
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
80623
+ * that. The live handle re-publishes on connect.
80624
+ *
80625
+ * See `RuntimeStateDurability`. Enforced by
80626
+ * `scripts/check-runtime-state-durability.ts`.
80627
+ */
80628
+ durability: "session"
80629
+ };
80630
+ /**
80631
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
80632
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
80633
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
80634
+ * one Home Assistant projection.
80635
+ */
80636
+ var NetworkLinkStatusSchema = object({
80637
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
80638
+ type: _enum([
80639
+ "wifi",
80640
+ "ethernet",
80641
+ "cellular",
80642
+ "unknown"
80643
+ ]),
80644
+ /**
80645
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
80646
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
80647
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
80648
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
80649
+ * SKIP a null rather than coerce it.
80650
+ */
80651
+ signalPercent: number().min(0).max(100).nullable(),
80652
+ /** Raw received signal strength in dBm, when the firmware reports one. */
80653
+ rssiDbm: number().optional(),
80654
+ /** Network name of a wireless link, when the firmware reports it. */
80655
+ ssid: string().optional(),
80656
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
80657
+ lastUpdated: number()
80658
+ });
80659
+ /** The slice a provider seeds before its first read: nothing is known yet. */
80660
+ var NETWORK_LINK_UNKNOWN = {
80661
+ type: "unknown",
80662
+ signalPercent: null,
80663
+ lastUpdated: 0
80664
+ };
80665
+ /**
80666
+ * Normalise a signal the firmware reports as BARS (0..`maxBars`) to 0..100.
80667
+ * Out-of-range or non-finite input is not a reading: `null`.
80668
+ */
80669
+ function signalPercentFromBars(bars, maxBars) {
80670
+ if (bars === void 0 || !Number.isFinite(bars) || maxBars <= 0) return null;
80671
+ if (bars < 0 || bars > maxBars) return null;
80672
+ return Math.round(bars / maxBars * 100);
80673
+ }
80674
+ var networkLinkCapability = {
80675
+ name: "network-link",
80676
+ scope: "device",
80677
+ deviceNative: true,
80678
+ mode: "singleton",
80679
+ deviceTypes: [
80680
+ DeviceType.Camera,
80681
+ DeviceType.Sensor,
80682
+ DeviceType.Button,
80683
+ DeviceType.Switch,
80684
+ DeviceType.Light,
80685
+ DeviceType.Lock,
80686
+ DeviceType.Siren
80687
+ ],
80688
+ methods: {},
80689
+ events: {
80690
+ /**
80691
+ * Emitted whenever the cached status changes (a link switch, a signal
80692
+ * reading that moved). Mirrored on the parent chain by the
80693
+ * DeviceEventPropagator like `battery.onStatusChanged`.
80694
+ */
80695
+ onStatusChanged: { data: object({
80696
+ deviceId: number(),
80697
+ status: NetworkLinkStatusSchema
80698
+ }) } },
80699
+ status: {
80700
+ schema: NetworkLinkStatusSchema,
80701
+ kind: "push",
80702
+ empty: NETWORK_LINK_UNKNOWN
80703
+ },
80704
+ /**
80705
+ * Runtime-state slice — every provider stores the same shape under
80706
+ * `device.runtimeState['network-link']`, read once by the badge and the
80707
+ * Home Assistant projector regardless of the driver.
80708
+ */
80709
+ runtimeState: NetworkLinkStatusSchema,
80710
+ /**
80711
+ * Runtime-state durability: **restored** — a link reading is slow to
80712
+ * change and a sleeping battery camera may not report for hours; the
80713
+ * restored slice is what the badge shows until the next read.
80714
+ *
80715
+ * See `RuntimeStateDurability`. Enforced by
80716
+ * `scripts/check-runtime-state-durability.ts`.
80717
+ */
80718
+ durability: "restored",
80719
+ /** Clock fields: written, but excluded from the compare that decides
80720
+ * whether persisting is worth a SQLite commit. */
80721
+ volatileStateFields: ["lastUpdated"]
80722
+ };
80723
+ /**
80179
80724
  * network-quality — system-scoped singleton capability tracking RTT,
80180
80725
  * jitter, and observed/peak bandwidth per device + per client.
80181
80726
  *
@@ -81756,424 +82301,6 @@ var ptzAutotrackCapability = {
81756
82301
  */
81757
82302
  durability: "session"
81758
82303
  };
81759
- /**
81760
- * `navigation` — a device-scoped capability that natively expresses the FULL
81761
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
81762
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
81763
- *
81764
- * Why a NEW cap rather than overloading `ptz`:
81765
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
81766
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
81767
- * The two are different physical models: PTZ is absolute-position + presets,
81768
- * navigation is momentary drive nudges + discrete robot ACTIONS
81769
- * (dock / spot-clean / follow-pet / go-to-point / …).
81770
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
81771
- * the reverse:
81772
- * 1. a native CamStack navigation panel (data-driven from `listActions`
81773
- * / `getOptions`), and
81774
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
81775
- * robot camera shows up in the existing PTZ control path without every
81776
- * PTZ provider learning about robots. The mapping lives in the adapter,
81777
- * not here (see the addon design note):
81778
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
81779
- * ptz.stop() → navigation.stop()
81780
- * ptz.goHome() → navigation.runAction('goHome')
81781
- * ptz.getPresets() → navigation.listActions() (id→preset)
81782
- * ptz.goToPreset(id) → navigation.runAction(id)
81783
- *
81784
- * ## Continuous drive
81785
- *
81786
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
81787
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
81788
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
81789
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
81790
- * coalesce them. The UI owns the cadence.
81791
- *
81792
- * ## The action dictionary
81793
- *
81794
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
81795
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
81796
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
81797
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
81798
- * vendor-specific list. `kind: 'action'` entries are triggered with
81799
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
81800
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
81801
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
81802
- *
81803
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
81804
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
81805
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
81806
- * every device handle. A future nodedreame publish adds a typed
81807
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
81808
- * provider can then swap the raw calls for the typed methods with no change to
81809
- * THIS contract.
81810
- */
81811
- /**
81812
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
81813
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
81814
- * halts it.
81815
- *
81816
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
81817
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
81818
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
81819
- * vector by it (drivers without proportional drive ignore it).
81820
- *
81821
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
81822
- * axis alone; an all-undefined nudge is a no-op.
81823
- */
81824
- var NavigationMoveCommandSchema = object({
81825
- pan: number().min(-1).max(1).optional(),
81826
- tilt: number().min(-1).max(1).optional(),
81827
- speed: number().min(0).max(1).optional()
81828
- });
81829
- /**
81830
- * The enumerated discrete actions a navigation-capable robot can perform via
81831
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
81832
- * subset it supports through `listActions`. Sounds are NOT here — they go through
81833
- * `playSound` (see the `sound` dictionary entries).
81834
- */
81835
- var NavigationActionIdSchema = _enum([
81836
- "goHome",
81837
- "locate",
81838
- "spotClean",
81839
- "findPet",
81840
- "personFollow",
81841
- "stop",
81842
- "startClean",
81843
- "pauseClean",
81844
- "dockWash",
81845
- "autoEmpty",
81846
- "flashOn",
81847
- "flashOff"
81848
- ]);
81849
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
81850
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
81851
- /**
81852
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
81853
- * native panel and the PTZ mimic render as a button.
81854
- *
81855
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
81856
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
81857
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
81858
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
81859
- * - `label` — operator-facing English label.
81860
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
81861
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
81862
- * PTZ render ONLY enabled entries. Data-driven: the provider
81863
- * flips it from config, never by editing code.
81864
- */
81865
- var NavigationActionEntrySchema = object({
81866
- id: string(),
81867
- kind: NavigationEntryKindSchema,
81868
- label: string(),
81869
- icon: string(),
81870
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
81871
- soundId: number().int().optional(),
81872
- /** Per-device feature flag — render this entry only when true. */
81873
- enabled: boolean()
81874
- });
81875
- /**
81876
- * Canonical dictionary of every navigation control (discrete actions + sounds)
81877
- * with its default label + icon hint. A provider filters this to the subset a
81878
- * device supports (and may override a label). Exported so the provider AND the
81879
- * UI share ONE list instead of re-deriving labels / ids independently.
81880
- *
81881
- * Icons are lucide-style hints; the viewer maps them to its own icon set. Every
81882
- * catalog default is `enabled: true`; a provider overrides per-device from
81883
- * config (data-driven — enabling / disabling one later is a config change, not a
81884
- * code change).
81885
- */
81886
- var NAVIGATION_ACTION_CATALOG = [
81887
- {
81888
- id: "startClean",
81889
- kind: "action",
81890
- label: "Start cleaning",
81891
- icon: "play",
81892
- enabled: true
81893
- },
81894
- {
81895
- id: "pauseClean",
81896
- kind: "action",
81897
- label: "Pause cleaning",
81898
- icon: "pause",
81899
- enabled: true
81900
- },
81901
- {
81902
- id: "stop",
81903
- kind: "action",
81904
- label: "Stop",
81905
- icon: "hand",
81906
- enabled: true
81907
- },
81908
- {
81909
- id: "goHome",
81910
- kind: "action",
81911
- label: "Return to dock",
81912
- icon: "home",
81913
- enabled: true
81914
- },
81915
- {
81916
- id: "locate",
81917
- kind: "action",
81918
- label: "Locate",
81919
- icon: "bell",
81920
- enabled: true
81921
- },
81922
- {
81923
- id: "spotClean",
81924
- kind: "action",
81925
- label: "Spot clean here",
81926
- icon: "crosshair",
81927
- enabled: true
81928
- },
81929
- {
81930
- id: "findPet",
81931
- kind: "action",
81932
- label: "Find pet",
81933
- icon: "paw-print",
81934
- enabled: true
81935
- },
81936
- {
81937
- id: "personFollow",
81938
- kind: "action",
81939
- label: "Follow me",
81940
- icon: "footprints",
81941
- enabled: true
81942
- },
81943
- {
81944
- id: "dockWash",
81945
- kind: "action",
81946
- label: "Wash mop",
81947
- icon: "droplets",
81948
- enabled: true
81949
- },
81950
- {
81951
- id: "autoEmpty",
81952
- kind: "action",
81953
- label: "Empty dustbin",
81954
- icon: "trash-2",
81955
- enabled: true
81956
- },
81957
- {
81958
- id: "flashOn",
81959
- kind: "action",
81960
- label: "Flash on",
81961
- icon: "flashlight",
81962
- enabled: true
81963
- },
81964
- {
81965
- id: "flashOff",
81966
- kind: "action",
81967
- label: "Flash off",
81968
- icon: "flashlight-off",
81969
- enabled: true
81970
- },
81971
- {
81972
- id: "sound:meow",
81973
- kind: "sound",
81974
- label: "Meow",
81975
- icon: "cat",
81976
- soundId: 684,
81977
- enabled: true
81978
- },
81979
- {
81980
- id: "sound:bark",
81981
- kind: "sound",
81982
- label: "Woof",
81983
- icon: "dog",
81984
- soundId: 685,
81985
- enabled: true
81986
- },
81987
- {
81988
- id: "sound:footsteps",
81989
- kind: "sound",
81990
- label: "Footsteps",
81991
- icon: "footprints",
81992
- soundId: 686,
81993
- enabled: true
81994
- },
81995
- {
81996
- id: "sound:purring",
81997
- kind: "sound",
81998
- label: "Purring",
81999
- icon: "cat",
82000
- soundId: 687,
82001
- enabled: true
82002
- },
82003
- {
82004
- id: "sound:tickTock",
82005
- kind: "sound",
82006
- label: "Tick-tock",
82007
- icon: "clock",
82008
- soundId: 688,
82009
- enabled: true
82010
- }
82011
- ];
82012
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
82013
- var NavigationPointSchema = object({
82014
- x: number(),
82015
- y: number()
82016
- });
82017
- /**
82018
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
82019
- * The cap reports which are enabled so the UI / PTZ render only the controls
82020
- * that are turned on for THIS device. Data-driven: the provider derives these
82021
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
82022
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
82023
- * that are not dictionary entries.
82024
- *
82025
- * - `move` / `stop` — the momentary drive joystick.
82026
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
82027
- * map-coordinate plumbing is wired.
82028
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
82029
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
82030
- * - `light` — the on/off fill-light toggle (works anytime).
82031
- * - `lightMode` — the auto/manual selector + manual level slider (a
82032
- * camera-service control; needs an active stream).
82033
- */
82034
- var NavigationFeaturesSchema = object({
82035
- move: boolean(),
82036
- stop: boolean(),
82037
- goToPoint: boolean(),
82038
- runAction: boolean(),
82039
- playSound: boolean(),
82040
- light: boolean(),
82041
- lightMode: boolean()
82042
- });
82043
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
82044
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
82045
- /**
82046
- * Live navigation state so the UI can reflect what the robot is doing:
82047
- * - `mode` — coarse activity (idle / cleaning / following / …).
82048
- * - `following` — person/pet follow is currently armed.
82049
- * - `flash` — the on-camera fill light is on.
82050
- * - `lightMode` — auto vs manual fill-light mode.
82051
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
82052
- * `lightMode === 'manual'`.
82053
- */
82054
- var NavigationStatusSchema = object({
82055
- mode: _enum([
82056
- "idle",
82057
- "cleaning",
82058
- "spot",
82059
- "following",
82060
- "goto",
82061
- "returning",
82062
- "paused",
82063
- "unknown"
82064
- ]),
82065
- following: boolean(),
82066
- flash: boolean(),
82067
- lightMode: NavigationLightModeSchema,
82068
- lightLevel: number().min(40).max(100),
82069
- /** Ms epoch when the slice was last updated. */
82070
- lastChangedAt: number()
82071
- });
82072
- /**
82073
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
82074
- * observable). Adds `lastFetchedAt` on top of the status shape per the
82075
- * convention.
82076
- */
82077
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
82078
- var navigationCapability = {
82079
- name: "navigation",
82080
- scope: "device",
82081
- deviceNative: true,
82082
- mode: "singleton",
82083
- deviceTypes: [DeviceType.Camera],
82084
- deviceConfig: { ui: {
82085
- kind: "widget",
82086
- widgetId: "host/navigation-panel",
82087
- tab: "navigation",
82088
- topTab: true,
82089
- label: "Navigation",
82090
- order: 0
82091
- } },
82092
- methods: {
82093
- /**
82094
- * Momentary drive nudge (the robot moves). `protected` — mirrors
82095
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
82096
- * path) works for any authenticated user, not admin-only. The UI sends
82097
- * these at ~1 Hz while a control is held; the provider forwards each one to
82098
- * a single drive write WITHOUT debouncing.
82099
- */
82100
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
82101
- /** Halt all motion immediately (zero drive vector). */
82102
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
82103
- /** Send the robot to a point on its live map. */
82104
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
82105
- /**
82106
- * Enumerate the discrete controls THIS device supports (data-driven UI +
82107
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
82108
- */
82109
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
82110
- /**
82111
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
82112
- * unsupported action ids are rejected by the provider.
82113
- */
82114
- runAction: method(object({
82115
- deviceId: number(),
82116
- actionId: NavigationActionIdSchema
82117
- }), _void(), { kind: "mutation" }),
82118
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
82119
- playSound: method(object({
82120
- deviceId: number(),
82121
- soundId: number().int()
82122
- }), _void(), { kind: "mutation" }),
82123
- /**
82124
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
82125
- * works anytime, no active stream required).
82126
- */
82127
- setLightOn: method(object({
82128
- deviceId: number(),
82129
- on: boolean()
82130
- }), _void(), { kind: "mutation" }),
82131
- /**
82132
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
82133
- * initial `level`. The auto/manual + level control is a CAMERA-service
82134
- * action that generally needs an active camera stream/monitor session — the
82135
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
82136
- */
82137
- setLightMode: method(object({
82138
- deviceId: number(),
82139
- mode: NavigationLightModeSchema,
82140
- level: number().min(40).max(100).optional()
82141
- }), _void(), { kind: "mutation" }),
82142
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
82143
- setLightLevel: method(object({
82144
- deviceId: number(),
82145
- level: number().min(40).max(100)
82146
- }), _void(), { kind: "mutation" }),
82147
- /**
82148
- * Per-device FEATURE-FLAG report for the general primitives — drives which
82149
- * controls the UI shows (the per-entry flags for the dictionary come back on
82150
- * `listActions`).
82151
- */
82152
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
82153
- },
82154
- events: { onStatusChanged: { data: object({
82155
- deviceId: number(),
82156
- status: NavigationStatusSchema
82157
- }) } },
82158
- status: {
82159
- schema: NavigationStatusSchema,
82160
- kind: "push"
82161
- },
82162
- /**
82163
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
82164
- * for live mode / follow / flash changes.
82165
- */
82166
- runtimeState: NavigationRuntimeStateSchema,
82167
- /**
82168
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
82169
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
82170
- * that. The live handle re-publishes on connect.
82171
- *
82172
- * See `RuntimeStateDurability`. Enforced by
82173
- * `scripts/check-runtime-state-durability.ts`.
82174
- */
82175
- durability: "session"
82176
- };
82177
82304
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
82178
82305
  kind: "mutation",
82179
82306
  auth: "admin"
@@ -91630,13 +91757,13 @@ Object.freeze({
91630
91757
  addonId: null,
91631
91758
  access: "view"
91632
91759
  },
91633
- "storage.getDefaultLocation": {
91760
+ "storage.list": {
91634
91761
  capName: "storage",
91635
91762
  capScope: "system",
91636
91763
  addonId: null,
91637
91764
  access: "view"
91638
91765
  },
91639
- "storage.list": {
91766
+ "storage.listDrainProgress": {
91640
91767
  capName: "storage",
91641
91768
  capScope: "system",
91642
91769
  addonId: null,
@@ -91786,6 +91913,12 @@ Object.freeze({
91786
91913
  addonId: null,
91787
91914
  access: "view"
91788
91915
  },
91916
+ "storageOccupancy.getOccupancy": {
91917
+ capName: "storage-occupancy",
91918
+ capScope: "system",
91919
+ addonId: null,
91920
+ access: "view"
91921
+ },
91789
91922
  "storageProvider.abortUpload": {
91790
91923
  capName: "storage-provider",
91791
91924
  capScope: "system",