@camstack/addon-provider-hikvision 1.2.86 → 1.2.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +621 -488
  2. package/dist/addon.mjs +621 -488
  3. package/package.json +1 -1
package/dist/addon.mjs CHANGED
@@ -7,7 +7,7 @@ import { networkInterfaces } from "node:os";
7
7
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
8
8
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
9
9
  //#endregion
10
- //#region ../types/dist/event-category-zAv7pMUz.mjs
10
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
11
11
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
12
12
  EventCategory["SystemBoot"] = "system.boot";
13
13
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -202,6 +202,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
202
202
  EventCategory["ProcessCrashed"] = "process.crashed";
203
203
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
204
204
  EventCategory["ProcessRestarted"] = "process.restarted";
205
+ /**
206
+ * The SET of storage locations changed — one was created, edited, enabled,
207
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
208
+ *
209
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
210
+ * it must also converge on its own periodic path, because a dropped event
211
+ * must not leave a node writing to yesterday's disk set forever. It exists
212
+ * because there was NO signal at all — an operator who added a second
213
+ * recordings disk in the admin UI got nothing, and the recorder kept its
214
+ * resolved locations until something else happened to re-resolve them
215
+ * (D387). Payload `StorageLocationsChangedPayload`.
216
+ */
217
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
205
218
  EventCategory["RecordingStarted"] = "recording.started";
206
219
  EventCategory["RecordingStopped"] = "recording.stopped";
207
220
  EventCategory["RecordingError"] = "recording.error";
@@ -7611,111 +7624,6 @@ var CameraSwitchGroupSchema = object({
7611
7624
  fetchedAt: number()
7612
7625
  });
7613
7626
  /**
7614
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7615
- * an addon declares its channels in.
7616
- *
7617
- * ## Two axes, deliberately separated
7618
- *
7619
- * - **DECLARATION** — which channels exist. Only the addon knows:
7620
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7621
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7622
- * and rots silently. So a channel is declared where it is consulted, and the
7623
- * `log-channels` capability enumerates the declarations.
7624
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7625
- * thing: the logging settings document on the `system` cap. Two authorities
7626
- * over the values is the exact defect
7627
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7628
- * remove; re-introducing it from the cure side would be grotesque.
7629
- *
7630
- * Nothing in this file reads a clock, an env var or a store. The registry is
7631
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7632
- * the hot path with a value somebody actually read, and by
7633
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7634
- * never reaches here, so it can neither disarm an armed channel nor arm a
7635
- * disarmed one (D49).
7636
- *
7637
- * ## The canonical call shape
7638
- *
7639
- * ```ts
7640
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7641
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7642
- * }
7643
- * ```
7644
- *
7645
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7646
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7647
- * object literal is never constructed because it lives inside the branch. It
7648
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7649
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7650
- * destination floor (measured at 1.93 ns/call when off).
7651
- *
7652
- * ## Why a channel emits at `info`
7653
- *
7654
- * `loki-logging.addon.ts` pins the destination default at `info` and
7655
- * `loki-destination.ts` drops everything below it, so a line emitted at
7656
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7657
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7658
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7659
- * emits at the channel's declared level, whose schema floor is `info`.
7660
- */
7661
- /**
7662
- * The level a channel writes at once armed.
7663
- *
7664
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7665
- * not leave the process for Loki, and the whole point of arming a channel is
7666
- * to read it later.
7667
- */
7668
- var LogChannelLevelSchema = _enum([
7669
- "info",
7670
- "warn",
7671
- "error"
7672
- ]);
7673
- /**
7674
- * What an addon declares about one channel. No value, no state — a
7675
- * declaration is inert.
7676
- */
7677
- var LogChannelDescriptorSchema = object({
7678
- /**
7679
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7680
- * the addon's short name so an operator reading a channel list can tell who
7681
- * owns it without a second lookup.
7682
- */
7683
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7684
- /** One sentence: what the operator will SEE after arming it. */
7685
- description: string().min(1),
7686
- /** The level its lines are emitted at. Never below `info`. */
7687
- defaultLevel: LogChannelLevelSchema,
7688
- /**
7689
- * Whether this channel can be narrowed to a camera.
7690
- *
7691
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7692
- * consulted with the numeric device id, AND every line the channel admits
7693
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7694
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7695
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7696
- * the body is the only way to filter.
7697
- *
7698
- * A channel whose lines carry the device only in `meta` (or not at all) is
7699
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7700
- * the operator narrows to one camera, sees nothing, and concludes the code
7701
- * path was never taken.
7702
- */
7703
- perDevice: boolean()
7704
- });
7705
- /**
7706
- * An armed window over one channel, as the document hands it to a mirror.
7707
- *
7708
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7709
- * expires by itself, which is the one failure a boolean cannot avoid.
7710
- */
7711
- var LogChannelWindowSchema = object({
7712
- channel: string().min(1),
7713
- /** Epoch ms the window closes at. */
7714
- armedUntilMs: number(),
7715
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7716
- deviceIds: array(number().int()).readonly().nullable()
7717
- });
7718
- /**
7719
7627
  * Ops-log — the durable, append-only operations audit shared by the
7720
7628
  * recordings and events management surfaces.
7721
7629
  *
@@ -8637,6 +8545,21 @@ var StorageCleanupJobSchema = object({
8637
8545
  });
8638
8546
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8639
8547
  /**
8548
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8549
+ * alias below is `z.infer<>` of it, never a second spelling.
8550
+ */
8551
+ var StorageLocationModeSchema = _enum([
8552
+ "active",
8553
+ "readonly",
8554
+ "drain",
8555
+ "disabled"
8556
+ ]);
8557
+ _enum([
8558
+ "normal",
8559
+ "never",
8560
+ "drain"
8561
+ ]);
8562
+ /**
8640
8563
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8641
8564
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8642
8565
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8661,8 +8584,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8661
8584
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8662
8585
  *
8663
8586
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8664
- * The default location for a type uses `id === <type>:default` by
8665
- * convention (the bare type ref like `'backups'` resolves to it).
8587
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8588
+ * There is no default location any more (D383): `enabled` is the whole write
8589
+ * model, and a bare type ref resolves to the sole location of the type, or —
8590
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8591
+ * slug is `default`.
8666
8592
  *
8667
8593
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8668
8594
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8683,23 +8609,37 @@ var StorageLocationSchema = object({
8683
8609
  * flag at upsert time, not here (the schema is provider-agnostic).
8684
8610
  */
8685
8611
  nodeId: string().optional(),
8686
- isDefault: boolean().default(false),
8687
8612
  isSystem: boolean().default(false),
8688
8613
  /**
8689
- * Operator opt-in: whether consumers that BALANCE across several locations
8690
- * of a type may write here. Recordings reads it today; event media and
8691
- * backups are the next consumers, which is why the flag lives on the
8692
- * location rather than in any one addon's store — nothing has to be
8693
- * extended to add the next consumer.
8614
+ * THE write switch, and the only one (D383). `enabled: true` means every
8615
+ * consumer that chooses a write target for this type may write here, and all
8616
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8617
+ * still read, still played back, still age-swept, still drained, never
8618
+ * written.
8694
8619
  *
8695
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8696
- * flag existed reads back with no flag and keeps working exactly as before;
8697
- * that is the whole compat story, and it is why no migration ships with it.
8698
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8699
- * disk must not silently start writing to it); the default of a type is
8700
- * always stamped `true`.
8620
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8621
+ * stored" on an update and "born inert unless it is the first location of its
8622
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8623
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8624
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8625
+ * stops existing rather than being re-derived on every read.
8701
8626
  */
8702
8627
  enabled: boolean().optional(),
8628
+ /**
8629
+ * THE state of this location (D385), and the only authority on what may be
8630
+ * written, read or evicted here. Interpreted in exactly one place —
8631
+ * `storage-location-mode.ts` — which also folds the legacy
8632
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8633
+ * ambiguous.
8634
+ *
8635
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8636
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8637
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8638
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8639
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8640
+ * either, so the two cannot disagree.
8641
+ */
8642
+ mode: StorageLocationModeSchema.optional(),
8703
8643
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8704
8644
  * for node-local locations it can reach) — never persisted, absent when the
8705
8645
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8707,13 +8647,50 @@ var StorageLocationSchema = object({
8707
8647
  totalBytes: number(),
8708
8648
  availableBytes: number()
8709
8649
  }).nullable().optional(),
8650
+ /**
8651
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8652
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8653
+ * never persisted, never a filesystem walk.
8654
+ *
8655
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8656
+ * location yet — nobody stores here, the owning addon is down, or the first
8657
+ * refresh has not completed. A UI must omit the segment rather than draw it
8658
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8659
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8660
+ * be spelled out loud instead of appearing by accident.
8661
+ *
8662
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8663
+ * about the whole figure rather than about its freshest part.
8664
+ */
8665
+ owned: object({
8666
+ bytes: number().int().nonnegative(),
8667
+ measuredAtMs: number().int().nonnegative()
8668
+ }).optional(),
8710
8669
  createdAt: number(),
8711
8670
  updatedAt: number()
8712
8671
  });
8672
+ object({ isDefault: boolean().optional() });
8673
+ /**
8674
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8675
+ *
8676
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8677
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8678
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8679
+ * operator learns not to believe the screen.
8680
+ */
8681
+ var StorageDrainProgressSchema = object({
8682
+ locationId: string(),
8683
+ startedAtMs: number(),
8684
+ startBytes: number(),
8685
+ bytesRemaining: number(),
8686
+ drained: boolean(),
8687
+ estimatedEmptyAtMs: number().nullable()
8688
+ });
8713
8689
  /**
8714
8690
  * Reference accepted by consumer-facing `api.storage.*` calls.
8715
8691
  * Either:
8716
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8692
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8693
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8717
8694
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8718
8695
  *
8719
8696
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9065,6 +9042,111 @@ function findTimezone(id) {
9065
9042
  return TIMEZONES.find((tz) => tz.id === id);
9066
9043
  }
9067
9044
  /**
9045
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9046
+ * an addon declares its channels in.
9047
+ *
9048
+ * ## Two axes, deliberately separated
9049
+ *
9050
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9051
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9052
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9053
+ * and rots silently. So a channel is declared where it is consulted, and the
9054
+ * `log-channels` capability enumerates the declarations.
9055
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9056
+ * thing: the logging settings document on the `system` cap. Two authorities
9057
+ * over the values is the exact defect
9058
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9059
+ * remove; re-introducing it from the cure side would be grotesque.
9060
+ *
9061
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9062
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9063
+ * the hot path with a value somebody actually read, and by
9064
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9065
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9066
+ * disarmed one (D49).
9067
+ *
9068
+ * ## The canonical call shape
9069
+ *
9070
+ * ```ts
9071
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9072
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9073
+ * }
9074
+ * ```
9075
+ *
9076
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9077
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9078
+ * object literal is never constructed because it lives inside the branch. It
9079
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9080
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9081
+ * destination floor (measured at 1.93 ns/call when off).
9082
+ *
9083
+ * ## Why a channel emits at `info`
9084
+ *
9085
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9086
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9087
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9088
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9089
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9090
+ * emits at the channel's declared level, whose schema floor is `info`.
9091
+ */
9092
+ /**
9093
+ * The level a channel writes at once armed.
9094
+ *
9095
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9096
+ * not leave the process for Loki, and the whole point of arming a channel is
9097
+ * to read it later.
9098
+ */
9099
+ var LogChannelLevelSchema = _enum([
9100
+ "info",
9101
+ "warn",
9102
+ "error"
9103
+ ]);
9104
+ /**
9105
+ * What an addon declares about one channel. No value, no state — a
9106
+ * declaration is inert.
9107
+ */
9108
+ var LogChannelDescriptorSchema = object({
9109
+ /**
9110
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9111
+ * the addon's short name so an operator reading a channel list can tell who
9112
+ * owns it without a second lookup.
9113
+ */
9114
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9115
+ /** One sentence: what the operator will SEE after arming it. */
9116
+ description: string().min(1),
9117
+ /** The level its lines are emitted at. Never below `info`. */
9118
+ defaultLevel: LogChannelLevelSchema,
9119
+ /**
9120
+ * Whether this channel can be narrowed to a camera.
9121
+ *
9122
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9123
+ * consulted with the numeric device id, AND every line the channel admits
9124
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9125
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9126
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9127
+ * the body is the only way to filter.
9128
+ *
9129
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9130
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9131
+ * the operator narrows to one camera, sees nothing, and concludes the code
9132
+ * path was never taken.
9133
+ */
9134
+ perDevice: boolean()
9135
+ });
9136
+ /**
9137
+ * An armed window over one channel, as the document hands it to a mirror.
9138
+ *
9139
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9140
+ * expires by itself, which is the one failure a boolean cannot avoid.
9141
+ */
9142
+ var LogChannelWindowSchema = object({
9143
+ channel: string().min(1),
9144
+ /** Epoch ms the window closes at. */
9145
+ armedUntilMs: number(),
9146
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9147
+ deviceIds: array(number().int()).readonly().nullable()
9148
+ });
9149
+ /**
9068
9150
  * Distinct (device, family, variant) counters one instance will hold.
9069
9151
  *
9070
9152
  * A large fleet x the handful of families any single addon reports, with
@@ -22337,7 +22419,7 @@ method(object({
22337
22419
  downloadId: string(),
22338
22420
  offset: number(),
22339
22421
  length: number()
22340
- }), _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({
22422
+ }), _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({
22341
22423
  createdAt: true,
22342
22424
  updatedAt: true
22343
22425
  }), StorageLocationSchema, {
@@ -22349,7 +22431,7 @@ method(object({
22349
22431
  }), _void(), {
22350
22432
  kind: "mutation",
22351
22433
  auth: "admin"
22352
- }), method(object({ id: string() }), object({
22434
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22353
22435
  ok: boolean(),
22354
22436
  error: string().optional()
22355
22437
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22419,6 +22501,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22419
22501
  kind: "mutation",
22420
22502
  auth: "admin"
22421
22503
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22504
+ /**
22505
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22506
+ * location (D388).
22507
+ *
22508
+ * ## Why this is not `storage-evictable`
22509
+ *
22510
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22511
+ * not, in two ways that both matter and both bite hardest on the locations an
22512
+ * operator most wants a figure for:
22513
+ *
22514
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22515
+ * and `recordingsLow:default` deliberately share one root and evict as one
22516
+ * oldest-first pool, so both answer with the SAME combined total. As an
22517
+ * occupancy figure that double-counts the disk.
22518
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22519
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22520
+ * is retiring and staring at.
22521
+ *
22522
+ * So this is its own contract with its own quantity, and the quantity is
22523
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22524
+ * would ever be willing to delete it. A provider that can only answer
22525
+ * "evictable" must not register here — a number that silently means different
22526
+ * things per class is worse than no number.
22527
+ *
22528
+ * ## Absence is an answer
22529
+ *
22530
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22531
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22532
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22533
+ * consuming side has to be written out loud instead of appearing by accident.
22534
+ *
22535
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22536
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22537
+ */
22538
+ /** One provider's occupancy answer for one location. */
22539
+ var StorageOccupancyReportSchema = object({
22540
+ locationId: string(),
22541
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22542
+ * not net of what it is willing to delete. */
22543
+ ownedBytes: number().int().nonnegative(),
22544
+ /** When the provider last actually measured this. The orchestrator carries it
22545
+ * through so a UI can say how old the figure is instead of implying "now". */
22546
+ measuredAtMs: number().int().nonnegative()
22547
+ });
22548
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22422
22549
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22423
22550
  providerId: string().min(1),
22424
22551
  displayName: string().min(1),
@@ -24254,88 +24381,6 @@ onStatusChanged: { data: object({
24254
24381
  volatileStateFields: ["lastUpdated"]
24255
24382
  };
24256
24383
  /**
24257
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24258
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24259
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24260
- * one Home Assistant projection.
24261
- */
24262
- var NetworkLinkStatusSchema = object({
24263
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24264
- type: _enum([
24265
- "wifi",
24266
- "ethernet",
24267
- "cellular",
24268
- "unknown"
24269
- ]),
24270
- /**
24271
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24272
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24273
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24274
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24275
- * SKIP a null rather than coerce it.
24276
- */
24277
- signalPercent: number().min(0).max(100).nullable(),
24278
- /** Raw received signal strength in dBm, when the firmware reports one. */
24279
- rssiDbm: number().optional(),
24280
- /** Network name of a wireless link, when the firmware reports it. */
24281
- ssid: string().optional(),
24282
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24283
- lastUpdated: number()
24284
- });
24285
- var networkLinkCapability = {
24286
- name: "network-link",
24287
- scope: "device",
24288
- deviceNative: true,
24289
- mode: "singleton",
24290
- deviceTypes: [
24291
- DeviceType.Camera,
24292
- DeviceType.Sensor,
24293
- DeviceType.Button,
24294
- DeviceType.Switch,
24295
- DeviceType.Light,
24296
- DeviceType.Lock,
24297
- DeviceType.Siren
24298
- ],
24299
- methods: {},
24300
- events: {
24301
- /**
24302
- * Emitted whenever the cached status changes (a link switch, a signal
24303
- * reading that moved). Mirrored on the parent chain by the
24304
- * DeviceEventPropagator like `battery.onStatusChanged`.
24305
- */
24306
- onStatusChanged: { data: object({
24307
- deviceId: number(),
24308
- status: NetworkLinkStatusSchema
24309
- }) } },
24310
- status: {
24311
- schema: NetworkLinkStatusSchema,
24312
- kind: "push",
24313
- empty: {
24314
- type: "unknown",
24315
- signalPercent: null,
24316
- lastUpdated: 0
24317
- }
24318
- },
24319
- /**
24320
- * Runtime-state slice — every provider stores the same shape under
24321
- * `device.runtimeState['network-link']`, read once by the badge and the
24322
- * Home Assistant projector regardless of the driver.
24323
- */
24324
- runtimeState: NetworkLinkStatusSchema,
24325
- /**
24326
- * Runtime-state durability: **restored** — a link reading is slow to
24327
- * change and a sleeping battery camera may not report for hours; the
24328
- * restored slice is what the badge shows until the next read.
24329
- *
24330
- * See `RuntimeStateDurability`. Enforced by
24331
- * `scripts/check-runtime-state-durability.ts`.
24332
- */
24333
- durability: "restored",
24334
- /** Clock fields: written, but excluded from the compare that decides
24335
- * whether persisting is worth a SQLite commit. */
24336
- volatileStateFields: ["lastUpdated"]
24337
- };
24338
- /**
24339
24384
  * Generic boolean sensor — last-resort fallback when no domain-
24340
24385
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24341
24386
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27865,6 +27910,369 @@ var nativeObjectDetectionCapability = {
27865
27910
  volatileStateFields: ["lastFetchedAt"]
27866
27911
  };
27867
27912
  /**
27913
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27914
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27915
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27916
+ *
27917
+ * Why a NEW cap rather than overloading `ptz`:
27918
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27919
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27920
+ * The two are different physical models: PTZ is absolute-position + presets,
27921
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27922
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27923
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27924
+ * the reverse:
27925
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27926
+ * / `getOptions`), and
27927
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27928
+ * robot camera shows up in the existing PTZ control path without every
27929
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27930
+ * not here (see the addon design note):
27931
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27932
+ * ptz.stop() → navigation.stop()
27933
+ * ptz.goHome() → navigation.runAction('goHome')
27934
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27935
+ * ptz.goToPreset(id) → navigation.runAction(id)
27936
+ *
27937
+ * ## Continuous drive
27938
+ *
27939
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27940
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27941
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27942
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27943
+ * coalesce them. The UI owns the cadence.
27944
+ *
27945
+ * ## The action dictionary
27946
+ *
27947
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27948
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27949
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27950
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27951
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27952
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27953
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27954
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27955
+ *
27956
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27957
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27958
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27959
+ * every device handle. A future nodedreame publish adds a typed
27960
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27961
+ * provider can then swap the raw calls for the typed methods with no change to
27962
+ * THIS contract.
27963
+ */
27964
+ /**
27965
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27966
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27967
+ * halts it.
27968
+ *
27969
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27970
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27971
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27972
+ * vector by it (drivers without proportional drive ignore it).
27973
+ *
27974
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27975
+ * axis alone; an all-undefined nudge is a no-op.
27976
+ */
27977
+ var NavigationMoveCommandSchema = object({
27978
+ pan: number().min(-1).max(1).optional(),
27979
+ tilt: number().min(-1).max(1).optional(),
27980
+ speed: number().min(0).max(1).optional()
27981
+ });
27982
+ /**
27983
+ * The enumerated discrete actions a navigation-capable robot can perform via
27984
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27985
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27986
+ * `playSound` (see the `sound` dictionary entries).
27987
+ */
27988
+ var NavigationActionIdSchema = _enum([
27989
+ "goHome",
27990
+ "locate",
27991
+ "spotClean",
27992
+ "findPet",
27993
+ "personFollow",
27994
+ "stop",
27995
+ "startClean",
27996
+ "pauseClean",
27997
+ "dockWash",
27998
+ "autoEmpty",
27999
+ "flashOn",
28000
+ "flashOff"
28001
+ ]);
28002
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28003
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28004
+ /**
28005
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28006
+ * native panel and the PTZ mimic render as a button.
28007
+ *
28008
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28009
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28010
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28011
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28012
+ * - `label` — operator-facing English label.
28013
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28014
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28015
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28016
+ * flips it from config, never by editing code.
28017
+ */
28018
+ var NavigationActionEntrySchema = object({
28019
+ id: string(),
28020
+ kind: NavigationEntryKindSchema,
28021
+ label: string(),
28022
+ icon: string(),
28023
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28024
+ soundId: number().int().optional(),
28025
+ /** Per-device feature flag — render this entry only when true. */
28026
+ enabled: boolean()
28027
+ });
28028
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28029
+ var NavigationPointSchema = object({
28030
+ x: number(),
28031
+ y: number()
28032
+ });
28033
+ /**
28034
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28035
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28036
+ * that are turned on for THIS device. Data-driven: the provider derives these
28037
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28038
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28039
+ * that are not dictionary entries.
28040
+ *
28041
+ * - `move` / `stop` — the momentary drive joystick.
28042
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28043
+ * map-coordinate plumbing is wired.
28044
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28045
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28046
+ * - `light` — the on/off fill-light toggle (works anytime).
28047
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28048
+ * camera-service control; needs an active stream).
28049
+ */
28050
+ var NavigationFeaturesSchema = object({
28051
+ move: boolean(),
28052
+ stop: boolean(),
28053
+ goToPoint: boolean(),
28054
+ runAction: boolean(),
28055
+ playSound: boolean(),
28056
+ light: boolean(),
28057
+ lightMode: boolean()
28058
+ });
28059
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28060
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28061
+ /**
28062
+ * Live navigation state so the UI can reflect what the robot is doing:
28063
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28064
+ * - `following` — person/pet follow is currently armed.
28065
+ * - `flash` — the on-camera fill light is on.
28066
+ * - `lightMode` — auto vs manual fill-light mode.
28067
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28068
+ * `lightMode === 'manual'`.
28069
+ */
28070
+ var NavigationStatusSchema = object({
28071
+ mode: _enum([
28072
+ "idle",
28073
+ "cleaning",
28074
+ "spot",
28075
+ "following",
28076
+ "goto",
28077
+ "returning",
28078
+ "paused",
28079
+ "unknown"
28080
+ ]),
28081
+ following: boolean(),
28082
+ flash: boolean(),
28083
+ lightMode: NavigationLightModeSchema,
28084
+ lightLevel: number().min(40).max(100),
28085
+ /** Ms epoch when the slice was last updated. */
28086
+ lastChangedAt: number()
28087
+ });
28088
+ /**
28089
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28090
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28091
+ * convention.
28092
+ */
28093
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28094
+ var navigationCapability = {
28095
+ name: "navigation",
28096
+ scope: "device",
28097
+ deviceNative: true,
28098
+ mode: "singleton",
28099
+ deviceTypes: [DeviceType.Camera],
28100
+ deviceConfig: { ui: {
28101
+ kind: "widget",
28102
+ widgetId: "host/navigation-panel",
28103
+ tab: "navigation",
28104
+ topTab: true,
28105
+ label: "Navigation",
28106
+ order: 0
28107
+ } },
28108
+ methods: {
28109
+ /**
28110
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28111
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28112
+ * path) works for any authenticated user, not admin-only. The UI sends
28113
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28114
+ * a single drive write WITHOUT debouncing.
28115
+ */
28116
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28117
+ /** Halt all motion immediately (zero drive vector). */
28118
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28119
+ /** Send the robot to a point on its live map. */
28120
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28121
+ /**
28122
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28123
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28124
+ */
28125
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28126
+ /**
28127
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28128
+ * unsupported action ids are rejected by the provider.
28129
+ */
28130
+ runAction: method(object({
28131
+ deviceId: number(),
28132
+ actionId: NavigationActionIdSchema
28133
+ }), _void(), { kind: "mutation" }),
28134
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28135
+ playSound: method(object({
28136
+ deviceId: number(),
28137
+ soundId: number().int()
28138
+ }), _void(), { kind: "mutation" }),
28139
+ /**
28140
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28141
+ * works anytime, no active stream required).
28142
+ */
28143
+ setLightOn: method(object({
28144
+ deviceId: number(),
28145
+ on: boolean()
28146
+ }), _void(), { kind: "mutation" }),
28147
+ /**
28148
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28149
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28150
+ * action that generally needs an active camera stream/monitor session — the
28151
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28152
+ */
28153
+ setLightMode: method(object({
28154
+ deviceId: number(),
28155
+ mode: NavigationLightModeSchema,
28156
+ level: number().min(40).max(100).optional()
28157
+ }), _void(), { kind: "mutation" }),
28158
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28159
+ setLightLevel: method(object({
28160
+ deviceId: number(),
28161
+ level: number().min(40).max(100)
28162
+ }), _void(), { kind: "mutation" }),
28163
+ /**
28164
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28165
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28166
+ * `listActions`).
28167
+ */
28168
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28169
+ },
28170
+ events: { onStatusChanged: { data: object({
28171
+ deviceId: number(),
28172
+ status: NavigationStatusSchema
28173
+ }) } },
28174
+ status: {
28175
+ schema: NavigationStatusSchema,
28176
+ kind: "push"
28177
+ },
28178
+ /**
28179
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28180
+ * for live mode / follow / flash changes.
28181
+ */
28182
+ runtimeState: NavigationRuntimeStateSchema,
28183
+ /**
28184
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28185
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28186
+ * that. The live handle re-publishes on connect.
28187
+ *
28188
+ * See `RuntimeStateDurability`. Enforced by
28189
+ * `scripts/check-runtime-state-durability.ts`.
28190
+ */
28191
+ durability: "session"
28192
+ };
28193
+ /**
28194
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28195
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28196
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28197
+ * one Home Assistant projection.
28198
+ */
28199
+ var NetworkLinkStatusSchema = object({
28200
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28201
+ type: _enum([
28202
+ "wifi",
28203
+ "ethernet",
28204
+ "cellular",
28205
+ "unknown"
28206
+ ]),
28207
+ /**
28208
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28209
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28210
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28211
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28212
+ * SKIP a null rather than coerce it.
28213
+ */
28214
+ signalPercent: number().min(0).max(100).nullable(),
28215
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28216
+ rssiDbm: number().optional(),
28217
+ /** Network name of a wireless link, when the firmware reports it. */
28218
+ ssid: string().optional(),
28219
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28220
+ lastUpdated: number()
28221
+ });
28222
+ var networkLinkCapability = {
28223
+ name: "network-link",
28224
+ scope: "device",
28225
+ deviceNative: true,
28226
+ mode: "singleton",
28227
+ deviceTypes: [
28228
+ DeviceType.Camera,
28229
+ DeviceType.Sensor,
28230
+ DeviceType.Button,
28231
+ DeviceType.Switch,
28232
+ DeviceType.Light,
28233
+ DeviceType.Lock,
28234
+ DeviceType.Siren
28235
+ ],
28236
+ methods: {},
28237
+ events: {
28238
+ /**
28239
+ * Emitted whenever the cached status changes (a link switch, a signal
28240
+ * reading that moved). Mirrored on the parent chain by the
28241
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28242
+ */
28243
+ onStatusChanged: { data: object({
28244
+ deviceId: number(),
28245
+ status: NetworkLinkStatusSchema
28246
+ }) } },
28247
+ status: {
28248
+ schema: NetworkLinkStatusSchema,
28249
+ kind: "push",
28250
+ empty: {
28251
+ type: "unknown",
28252
+ signalPercent: null,
28253
+ lastUpdated: 0
28254
+ }
28255
+ },
28256
+ /**
28257
+ * Runtime-state slice — every provider stores the same shape under
28258
+ * `device.runtimeState['network-link']`, read once by the badge and the
28259
+ * Home Assistant projector regardless of the driver.
28260
+ */
28261
+ runtimeState: NetworkLinkStatusSchema,
28262
+ /**
28263
+ * Runtime-state durability: **restored** — a link reading is slow to
28264
+ * change and a sleeping battery camera may not report for hours; the
28265
+ * restored slice is what the badge shows until the next read.
28266
+ *
28267
+ * See `RuntimeStateDurability`. Enforced by
28268
+ * `scripts/check-runtime-state-durability.ts`.
28269
+ */
28270
+ durability: "restored",
28271
+ /** Clock fields: written, but excluded from the compare that decides
28272
+ * whether persisting is worth a SQLite commit. */
28273
+ volatileStateFields: ["lastUpdated"]
28274
+ };
28275
+ /**
27868
28276
  * network-quality — system-scoped singleton capability tracking RTT,
27869
28277
  * jitter, and observed/peak bandwidth per device + per client.
27870
28278
  *
@@ -29554,287 +29962,6 @@ var ptzAutotrackCapability = {
29554
29962
  durability: "session"
29555
29963
  };
29556
29964
  /**
29557
- * `navigation` — a device-scoped capability that natively expresses the FULL
29558
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29559
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29560
- *
29561
- * Why a NEW cap rather than overloading `ptz`:
29562
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29563
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29564
- * The two are different physical models: PTZ is absolute-position + presets,
29565
- * navigation is momentary drive nudges + discrete robot ACTIONS
29566
- * (dock / spot-clean / follow-pet / go-to-point / …).
29567
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29568
- * the reverse:
29569
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29570
- * / `getOptions`), and
29571
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29572
- * robot camera shows up in the existing PTZ control path without every
29573
- * PTZ provider learning about robots. The mapping lives in the adapter,
29574
- * not here (see the addon design note):
29575
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29576
- * ptz.stop() → navigation.stop()
29577
- * ptz.goHome() → navigation.runAction('goHome')
29578
- * ptz.getPresets() → navigation.listActions() (id→preset)
29579
- * ptz.goToPreset(id) → navigation.runAction(id)
29580
- *
29581
- * ## Continuous drive
29582
- *
29583
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29584
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29585
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29586
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29587
- * coalesce them. The UI owns the cadence.
29588
- *
29589
- * ## The action dictionary
29590
- *
29591
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29592
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29593
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29594
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29595
- * vendor-specific list. `kind: 'action'` entries are triggered with
29596
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29597
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29598
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29599
- *
29600
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29601
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29602
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29603
- * every device handle. A future nodedreame publish adds a typed
29604
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29605
- * provider can then swap the raw calls for the typed methods with no change to
29606
- * THIS contract.
29607
- */
29608
- /**
29609
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29610
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29611
- * halts it.
29612
- *
29613
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29614
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29615
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29616
- * vector by it (drivers without proportional drive ignore it).
29617
- *
29618
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29619
- * axis alone; an all-undefined nudge is a no-op.
29620
- */
29621
- var NavigationMoveCommandSchema = object({
29622
- pan: number().min(-1).max(1).optional(),
29623
- tilt: number().min(-1).max(1).optional(),
29624
- speed: number().min(0).max(1).optional()
29625
- });
29626
- /**
29627
- * The enumerated discrete actions a navigation-capable robot can perform via
29628
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29629
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29630
- * `playSound` (see the `sound` dictionary entries).
29631
- */
29632
- var NavigationActionIdSchema = _enum([
29633
- "goHome",
29634
- "locate",
29635
- "spotClean",
29636
- "findPet",
29637
- "personFollow",
29638
- "stop",
29639
- "startClean",
29640
- "pauseClean",
29641
- "dockWash",
29642
- "autoEmpty",
29643
- "flashOn",
29644
- "flashOff"
29645
- ]);
29646
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29647
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29648
- /**
29649
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29650
- * native panel and the PTZ mimic render as a button.
29651
- *
29652
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29653
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29654
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29655
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29656
- * - `label` — operator-facing English label.
29657
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29658
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29659
- * PTZ render ONLY enabled entries. Data-driven: the provider
29660
- * flips it from config, never by editing code.
29661
- */
29662
- var NavigationActionEntrySchema = object({
29663
- id: string(),
29664
- kind: NavigationEntryKindSchema,
29665
- label: string(),
29666
- icon: string(),
29667
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29668
- soundId: number().int().optional(),
29669
- /** Per-device feature flag — render this entry only when true. */
29670
- enabled: boolean()
29671
- });
29672
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29673
- var NavigationPointSchema = object({
29674
- x: number(),
29675
- y: number()
29676
- });
29677
- /**
29678
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29679
- * The cap reports which are enabled so the UI / PTZ render only the controls
29680
- * that are turned on for THIS device. Data-driven: the provider derives these
29681
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29682
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29683
- * that are not dictionary entries.
29684
- *
29685
- * - `move` / `stop` — the momentary drive joystick.
29686
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29687
- * map-coordinate plumbing is wired.
29688
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29689
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29690
- * - `light` — the on/off fill-light toggle (works anytime).
29691
- * - `lightMode` — the auto/manual selector + manual level slider (a
29692
- * camera-service control; needs an active stream).
29693
- */
29694
- var NavigationFeaturesSchema = object({
29695
- move: boolean(),
29696
- stop: boolean(),
29697
- goToPoint: boolean(),
29698
- runAction: boolean(),
29699
- playSound: boolean(),
29700
- light: boolean(),
29701
- lightMode: boolean()
29702
- });
29703
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29704
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29705
- /**
29706
- * Live navigation state so the UI can reflect what the robot is doing:
29707
- * - `mode` — coarse activity (idle / cleaning / following / …).
29708
- * - `following` — person/pet follow is currently armed.
29709
- * - `flash` — the on-camera fill light is on.
29710
- * - `lightMode` — auto vs manual fill-light mode.
29711
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29712
- * `lightMode === 'manual'`.
29713
- */
29714
- var NavigationStatusSchema = object({
29715
- mode: _enum([
29716
- "idle",
29717
- "cleaning",
29718
- "spot",
29719
- "following",
29720
- "goto",
29721
- "returning",
29722
- "paused",
29723
- "unknown"
29724
- ]),
29725
- following: boolean(),
29726
- flash: boolean(),
29727
- lightMode: NavigationLightModeSchema,
29728
- lightLevel: number().min(40).max(100),
29729
- /** Ms epoch when the slice was last updated. */
29730
- lastChangedAt: number()
29731
- });
29732
- /**
29733
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29734
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29735
- * convention.
29736
- */
29737
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29738
- var navigationCapability = {
29739
- name: "navigation",
29740
- scope: "device",
29741
- deviceNative: true,
29742
- mode: "singleton",
29743
- deviceTypes: [DeviceType.Camera],
29744
- deviceConfig: { ui: {
29745
- kind: "widget",
29746
- widgetId: "host/navigation-panel",
29747
- tab: "navigation",
29748
- topTab: true,
29749
- label: "Navigation",
29750
- order: 0
29751
- } },
29752
- methods: {
29753
- /**
29754
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29755
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29756
- * path) works for any authenticated user, not admin-only. The UI sends
29757
- * these at ~1 Hz while a control is held; the provider forwards each one to
29758
- * a single drive write WITHOUT debouncing.
29759
- */
29760
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29761
- /** Halt all motion immediately (zero drive vector). */
29762
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29763
- /** Send the robot to a point on its live map. */
29764
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29765
- /**
29766
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29767
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29768
- */
29769
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29770
- /**
29771
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29772
- * unsupported action ids are rejected by the provider.
29773
- */
29774
- runAction: method(object({
29775
- deviceId: number(),
29776
- actionId: NavigationActionIdSchema
29777
- }), _void(), { kind: "mutation" }),
29778
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29779
- playSound: method(object({
29780
- deviceId: number(),
29781
- soundId: number().int()
29782
- }), _void(), { kind: "mutation" }),
29783
- /**
29784
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29785
- * works anytime, no active stream required).
29786
- */
29787
- setLightOn: method(object({
29788
- deviceId: number(),
29789
- on: boolean()
29790
- }), _void(), { kind: "mutation" }),
29791
- /**
29792
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29793
- * initial `level`. The auto/manual + level control is a CAMERA-service
29794
- * action that generally needs an active camera stream/monitor session — the
29795
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29796
- */
29797
- setLightMode: method(object({
29798
- deviceId: number(),
29799
- mode: NavigationLightModeSchema,
29800
- level: number().min(40).max(100).optional()
29801
- }), _void(), { kind: "mutation" }),
29802
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29803
- setLightLevel: method(object({
29804
- deviceId: number(),
29805
- level: number().min(40).max(100)
29806
- }), _void(), { kind: "mutation" }),
29807
- /**
29808
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29809
- * controls the UI shows (the per-entry flags for the dictionary come back on
29810
- * `listActions`).
29811
- */
29812
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29813
- },
29814
- events: { onStatusChanged: { data: object({
29815
- deviceId: number(),
29816
- status: NavigationStatusSchema
29817
- }) } },
29818
- status: {
29819
- schema: NavigationStatusSchema,
29820
- kind: "push"
29821
- },
29822
- /**
29823
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29824
- * for live mode / follow / flash changes.
29825
- */
29826
- runtimeState: NavigationRuntimeStateSchema,
29827
- /**
29828
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29829
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29830
- * that. The live handle re-publishes on connect.
29831
- *
29832
- * See `RuntimeStateDurability`. Enforced by
29833
- * `scripts/check-runtime-state-durability.ts`.
29834
- */
29835
- durability: "session"
29836
- };
29837
- /**
29838
29965
  * reboot — device-scoped capability for "soft" device reboots (firmware
29839
29966
  * reboot via vendor protocol; cameras, NVRs, doorbells). Surfaces a
29840
29967
  * single mutation so the UI can offer a confirm-and-reboot button for
@@ -39746,13 +39873,13 @@ Object.freeze({
39746
39873
  addonId: null,
39747
39874
  access: "view"
39748
39875
  },
39749
- "storage.getDefaultLocation": {
39876
+ "storage.list": {
39750
39877
  capName: "storage",
39751
39878
  capScope: "system",
39752
39879
  addonId: null,
39753
39880
  access: "view"
39754
39881
  },
39755
- "storage.list": {
39882
+ "storage.listDrainProgress": {
39756
39883
  capName: "storage",
39757
39884
  capScope: "system",
39758
39885
  addonId: null,
@@ -39902,6 +40029,12 @@ Object.freeze({
39902
40029
  addonId: null,
39903
40030
  access: "view"
39904
40031
  },
40032
+ "storageOccupancy.getOccupancy": {
40033
+ capName: "storage-occupancy",
40034
+ capScope: "system",
40035
+ addonId: null,
40036
+ access: "view"
40037
+ },
39905
40038
  "storageProvider.abortUpload": {
39906
40039
  capName: "storage-provider",
39907
40040
  capScope: "system",