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