@camstack/addon-provider-amcrest 0.2.80 → 0.2.82

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.
@@ -8889,6 +8866,111 @@ var DecoderSessionConfigSchema = object({
8889
8866
  */
8890
8867
  debug: boolean().optional()
8891
8868
  });
8869
+ /**
8870
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8871
+ * an addon declares its channels in.
8872
+ *
8873
+ * ## Two axes, deliberately separated
8874
+ *
8875
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8876
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8877
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8878
+ * and rots silently. So a channel is declared where it is consulted, and the
8879
+ * `log-channels` capability enumerates the declarations.
8880
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8881
+ * thing: the logging settings document on the `system` cap. Two authorities
8882
+ * over the values is the exact defect
8883
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8884
+ * remove; re-introducing it from the cure side would be grotesque.
8885
+ *
8886
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8887
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8888
+ * the hot path with a value somebody actually read, and by
8889
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8890
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8891
+ * disarmed one (D49).
8892
+ *
8893
+ * ## The canonical call shape
8894
+ *
8895
+ * ```ts
8896
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8897
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8898
+ * }
8899
+ * ```
8900
+ *
8901
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8902
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8903
+ * object literal is never constructed because it lives inside the branch. It
8904
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8905
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8906
+ * destination floor (measured at 1.93 ns/call when off).
8907
+ *
8908
+ * ## Why a channel emits at `info`
8909
+ *
8910
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8911
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8912
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8913
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8914
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8915
+ * emits at the channel's declared level, whose schema floor is `info`.
8916
+ */
8917
+ /**
8918
+ * The level a channel writes at once armed.
8919
+ *
8920
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8921
+ * not leave the process for Loki, and the whole point of arming a channel is
8922
+ * to read it later.
8923
+ */
8924
+ var LogChannelLevelSchema = _enum([
8925
+ "info",
8926
+ "warn",
8927
+ "error"
8928
+ ]);
8929
+ /**
8930
+ * What an addon declares about one channel. No value, no state — a
8931
+ * declaration is inert.
8932
+ */
8933
+ var LogChannelDescriptorSchema = object({
8934
+ /**
8935
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8936
+ * the addon's short name so an operator reading a channel list can tell who
8937
+ * owns it without a second lookup.
8938
+ */
8939
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8940
+ /** One sentence: what the operator will SEE after arming it. */
8941
+ description: string().min(1),
8942
+ /** The level its lines are emitted at. Never below `info`. */
8943
+ defaultLevel: LogChannelLevelSchema,
8944
+ /**
8945
+ * Whether this channel can be narrowed to a camera.
8946
+ *
8947
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8948
+ * consulted with the numeric device id, AND every line the channel admits
8949
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8950
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8951
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8952
+ * the body is the only way to filter.
8953
+ *
8954
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8955
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8956
+ * the operator narrows to one camera, sees nothing, and concludes the code
8957
+ * path was never taken.
8958
+ */
8959
+ perDevice: boolean()
8960
+ });
8961
+ /**
8962
+ * An armed window over one channel, as the document hands it to a mirror.
8963
+ *
8964
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8965
+ * expires by itself, which is the one failure a boolean cannot avoid.
8966
+ */
8967
+ var LogChannelWindowSchema = object({
8968
+ channel: string().min(1),
8969
+ /** Epoch ms the window closes at. */
8970
+ armedUntilMs: number(),
8971
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8972
+ deviceIds: array(number().int()).readonly().nullable()
8973
+ });
8892
8974
  var MODEL_FORMATS = [
8893
8975
  "onnx",
8894
8976
  "coreml",
@@ -22025,7 +22107,7 @@ method(object({
22025
22107
  downloadId: string(),
22026
22108
  offset: number(),
22027
22109
  length: number()
22028
- }), _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({
22110
+ }), _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({
22029
22111
  createdAt: true,
22030
22112
  updatedAt: true
22031
22113
  }), StorageLocationSchema, {
@@ -22037,7 +22119,7 @@ method(object({
22037
22119
  }), _void(), {
22038
22120
  kind: "mutation",
22039
22121
  auth: "admin"
22040
- }), method(object({ id: string() }), object({
22122
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22041
22123
  ok: boolean(),
22042
22124
  error: string().optional()
22043
22125
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22107,6 +22189,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22107
22189
  kind: "mutation",
22108
22190
  auth: "admin"
22109
22191
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22192
+ /**
22193
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22194
+ * location (D388).
22195
+ *
22196
+ * ## Why this is not `storage-evictable`
22197
+ *
22198
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22199
+ * not, in two ways that both matter and both bite hardest on the locations an
22200
+ * operator most wants a figure for:
22201
+ *
22202
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22203
+ * and `recordingsLow:default` deliberately share one root and evict as one
22204
+ * oldest-first pool, so both answer with the SAME combined total. As an
22205
+ * occupancy figure that double-counts the disk.
22206
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22207
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22208
+ * is retiring and staring at.
22209
+ *
22210
+ * So this is its own contract with its own quantity, and the quantity is
22211
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22212
+ * would ever be willing to delete it. A provider that can only answer
22213
+ * "evictable" must not register here — a number that silently means different
22214
+ * things per class is worse than no number.
22215
+ *
22216
+ * ## Absence is an answer
22217
+ *
22218
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22219
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22220
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22221
+ * consuming side has to be written out loud instead of appearing by accident.
22222
+ *
22223
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22224
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22225
+ */
22226
+ /** One provider's occupancy answer for one location. */
22227
+ var StorageOccupancyReportSchema = object({
22228
+ locationId: string(),
22229
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22230
+ * not net of what it is willing to delete. */
22231
+ ownedBytes: number().int().nonnegative(),
22232
+ /** When the provider last actually measured this. The orchestrator carries it
22233
+ * through so a UI can say how old the figure is instead of implying "now". */
22234
+ measuredAtMs: number().int().nonnegative()
22235
+ });
22236
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22110
22237
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22111
22238
  providerId: string().min(1),
22112
22239
  displayName: string().min(1),
@@ -23942,88 +24069,6 @@ onStatusChanged: { data: object({
23942
24069
  volatileStateFields: ["lastUpdated"]
23943
24070
  };
23944
24071
  /**
23945
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23946
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23947
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23948
- * one Home Assistant projection.
23949
- */
23950
- var NetworkLinkStatusSchema = object({
23951
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23952
- type: _enum([
23953
- "wifi",
23954
- "ethernet",
23955
- "cellular",
23956
- "unknown"
23957
- ]),
23958
- /**
23959
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23960
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23961
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23962
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23963
- * SKIP a null rather than coerce it.
23964
- */
23965
- signalPercent: number().min(0).max(100).nullable(),
23966
- /** Raw received signal strength in dBm, when the firmware reports one. */
23967
- rssiDbm: number().optional(),
23968
- /** Network name of a wireless link, when the firmware reports it. */
23969
- ssid: string().optional(),
23970
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23971
- lastUpdated: number()
23972
- });
23973
- var networkLinkCapability = {
23974
- name: "network-link",
23975
- scope: "device",
23976
- deviceNative: true,
23977
- mode: "singleton",
23978
- deviceTypes: [
23979
- DeviceType.Camera,
23980
- DeviceType.Sensor,
23981
- DeviceType.Button,
23982
- DeviceType.Switch,
23983
- DeviceType.Light,
23984
- DeviceType.Lock,
23985
- DeviceType.Siren
23986
- ],
23987
- methods: {},
23988
- events: {
23989
- /**
23990
- * Emitted whenever the cached status changes (a link switch, a signal
23991
- * reading that moved). Mirrored on the parent chain by the
23992
- * DeviceEventPropagator like `battery.onStatusChanged`.
23993
- */
23994
- onStatusChanged: { data: object({
23995
- deviceId: number(),
23996
- status: NetworkLinkStatusSchema
23997
- }) } },
23998
- status: {
23999
- schema: NetworkLinkStatusSchema,
24000
- kind: "push",
24001
- empty: {
24002
- type: "unknown",
24003
- signalPercent: null,
24004
- lastUpdated: 0
24005
- }
24006
- },
24007
- /**
24008
- * Runtime-state slice — every provider stores the same shape under
24009
- * `device.runtimeState['network-link']`, read once by the badge and the
24010
- * Home Assistant projector regardless of the driver.
24011
- */
24012
- runtimeState: NetworkLinkStatusSchema,
24013
- /**
24014
- * Runtime-state durability: **restored** — a link reading is slow to
24015
- * change and a sleeping battery camera may not report for hours; the
24016
- * restored slice is what the badge shows until the next read.
24017
- *
24018
- * See `RuntimeStateDurability`. Enforced by
24019
- * `scripts/check-runtime-state-durability.ts`.
24020
- */
24021
- durability: "restored",
24022
- /** Clock fields: written, but excluded from the compare that decides
24023
- * whether persisting is worth a SQLite commit. */
24024
- volatileStateFields: ["lastUpdated"]
24025
- };
24026
- /**
24027
24072
  * Generic boolean sensor — last-resort fallback when no domain-
24028
24073
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24029
24074
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27553,6 +27598,369 @@ var nativeObjectDetectionCapability = {
27553
27598
  volatileStateFields: ["lastFetchedAt"]
27554
27599
  };
27555
27600
  /**
27601
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27602
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27603
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27604
+ *
27605
+ * Why a NEW cap rather than overloading `ptz`:
27606
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27607
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27608
+ * The two are different physical models: PTZ is absolute-position + presets,
27609
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27610
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27611
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27612
+ * the reverse:
27613
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27614
+ * / `getOptions`), and
27615
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27616
+ * robot camera shows up in the existing PTZ control path without every
27617
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27618
+ * not here (see the addon design note):
27619
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27620
+ * ptz.stop() → navigation.stop()
27621
+ * ptz.goHome() → navigation.runAction('goHome')
27622
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27623
+ * ptz.goToPreset(id) → navigation.runAction(id)
27624
+ *
27625
+ * ## Continuous drive
27626
+ *
27627
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27628
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27629
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27630
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27631
+ * coalesce them. The UI owns the cadence.
27632
+ *
27633
+ * ## The action dictionary
27634
+ *
27635
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27636
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27637
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27638
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27639
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27640
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27641
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27642
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27643
+ *
27644
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27645
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27646
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27647
+ * every device handle. A future nodedreame publish adds a typed
27648
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27649
+ * provider can then swap the raw calls for the typed methods with no change to
27650
+ * THIS contract.
27651
+ */
27652
+ /**
27653
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27654
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27655
+ * halts it.
27656
+ *
27657
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27658
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27659
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27660
+ * vector by it (drivers without proportional drive ignore it).
27661
+ *
27662
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27663
+ * axis alone; an all-undefined nudge is a no-op.
27664
+ */
27665
+ var NavigationMoveCommandSchema = object({
27666
+ pan: number().min(-1).max(1).optional(),
27667
+ tilt: number().min(-1).max(1).optional(),
27668
+ speed: number().min(0).max(1).optional()
27669
+ });
27670
+ /**
27671
+ * The enumerated discrete actions a navigation-capable robot can perform via
27672
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27673
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27674
+ * `playSound` (see the `sound` dictionary entries).
27675
+ */
27676
+ var NavigationActionIdSchema = _enum([
27677
+ "goHome",
27678
+ "locate",
27679
+ "spotClean",
27680
+ "findPet",
27681
+ "personFollow",
27682
+ "stop",
27683
+ "startClean",
27684
+ "pauseClean",
27685
+ "dockWash",
27686
+ "autoEmpty",
27687
+ "flashOn",
27688
+ "flashOff"
27689
+ ]);
27690
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27691
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27692
+ /**
27693
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27694
+ * native panel and the PTZ mimic render as a button.
27695
+ *
27696
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27697
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27698
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27699
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27700
+ * - `label` — operator-facing English label.
27701
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27702
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27703
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27704
+ * flips it from config, never by editing code.
27705
+ */
27706
+ var NavigationActionEntrySchema = object({
27707
+ id: string(),
27708
+ kind: NavigationEntryKindSchema,
27709
+ label: string(),
27710
+ icon: string(),
27711
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27712
+ soundId: number().int().optional(),
27713
+ /** Per-device feature flag — render this entry only when true. */
27714
+ enabled: boolean()
27715
+ });
27716
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27717
+ var NavigationPointSchema = object({
27718
+ x: number(),
27719
+ y: number()
27720
+ });
27721
+ /**
27722
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27723
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27724
+ * that are turned on for THIS device. Data-driven: the provider derives these
27725
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27726
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27727
+ * that are not dictionary entries.
27728
+ *
27729
+ * - `move` / `stop` — the momentary drive joystick.
27730
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27731
+ * map-coordinate plumbing is wired.
27732
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27733
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27734
+ * - `light` — the on/off fill-light toggle (works anytime).
27735
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27736
+ * camera-service control; needs an active stream).
27737
+ */
27738
+ var NavigationFeaturesSchema = object({
27739
+ move: boolean(),
27740
+ stop: boolean(),
27741
+ goToPoint: boolean(),
27742
+ runAction: boolean(),
27743
+ playSound: boolean(),
27744
+ light: boolean(),
27745
+ lightMode: boolean()
27746
+ });
27747
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27748
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27749
+ /**
27750
+ * Live navigation state so the UI can reflect what the robot is doing:
27751
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27752
+ * - `following` — person/pet follow is currently armed.
27753
+ * - `flash` — the on-camera fill light is on.
27754
+ * - `lightMode` — auto vs manual fill-light mode.
27755
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27756
+ * `lightMode === 'manual'`.
27757
+ */
27758
+ var NavigationStatusSchema = object({
27759
+ mode: _enum([
27760
+ "idle",
27761
+ "cleaning",
27762
+ "spot",
27763
+ "following",
27764
+ "goto",
27765
+ "returning",
27766
+ "paused",
27767
+ "unknown"
27768
+ ]),
27769
+ following: boolean(),
27770
+ flash: boolean(),
27771
+ lightMode: NavigationLightModeSchema,
27772
+ lightLevel: number().min(40).max(100),
27773
+ /** Ms epoch when the slice was last updated. */
27774
+ lastChangedAt: number()
27775
+ });
27776
+ /**
27777
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27778
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27779
+ * convention.
27780
+ */
27781
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27782
+ var navigationCapability = {
27783
+ name: "navigation",
27784
+ scope: "device",
27785
+ deviceNative: true,
27786
+ mode: "singleton",
27787
+ deviceTypes: [DeviceType.Camera],
27788
+ deviceConfig: { ui: {
27789
+ kind: "widget",
27790
+ widgetId: "host/navigation-panel",
27791
+ tab: "navigation",
27792
+ topTab: true,
27793
+ label: "Navigation",
27794
+ order: 0
27795
+ } },
27796
+ methods: {
27797
+ /**
27798
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27799
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27800
+ * path) works for any authenticated user, not admin-only. The UI sends
27801
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27802
+ * a single drive write WITHOUT debouncing.
27803
+ */
27804
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27805
+ /** Halt all motion immediately (zero drive vector). */
27806
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27807
+ /** Send the robot to a point on its live map. */
27808
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27809
+ /**
27810
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27811
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27812
+ */
27813
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27814
+ /**
27815
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27816
+ * unsupported action ids are rejected by the provider.
27817
+ */
27818
+ runAction: method(object({
27819
+ deviceId: number(),
27820
+ actionId: NavigationActionIdSchema
27821
+ }), _void(), { kind: "mutation" }),
27822
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27823
+ playSound: method(object({
27824
+ deviceId: number(),
27825
+ soundId: number().int()
27826
+ }), _void(), { kind: "mutation" }),
27827
+ /**
27828
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27829
+ * works anytime, no active stream required).
27830
+ */
27831
+ setLightOn: method(object({
27832
+ deviceId: number(),
27833
+ on: boolean()
27834
+ }), _void(), { kind: "mutation" }),
27835
+ /**
27836
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27837
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27838
+ * action that generally needs an active camera stream/monitor session — the
27839
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27840
+ */
27841
+ setLightMode: method(object({
27842
+ deviceId: number(),
27843
+ mode: NavigationLightModeSchema,
27844
+ level: number().min(40).max(100).optional()
27845
+ }), _void(), { kind: "mutation" }),
27846
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27847
+ setLightLevel: method(object({
27848
+ deviceId: number(),
27849
+ level: number().min(40).max(100)
27850
+ }), _void(), { kind: "mutation" }),
27851
+ /**
27852
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27853
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27854
+ * `listActions`).
27855
+ */
27856
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27857
+ },
27858
+ events: { onStatusChanged: { data: object({
27859
+ deviceId: number(),
27860
+ status: NavigationStatusSchema
27861
+ }) } },
27862
+ status: {
27863
+ schema: NavigationStatusSchema,
27864
+ kind: "push"
27865
+ },
27866
+ /**
27867
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27868
+ * for live mode / follow / flash changes.
27869
+ */
27870
+ runtimeState: NavigationRuntimeStateSchema,
27871
+ /**
27872
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27873
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27874
+ * that. The live handle re-publishes on connect.
27875
+ *
27876
+ * See `RuntimeStateDurability`. Enforced by
27877
+ * `scripts/check-runtime-state-durability.ts`.
27878
+ */
27879
+ durability: "session"
27880
+ };
27881
+ /**
27882
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27883
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27884
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27885
+ * one Home Assistant projection.
27886
+ */
27887
+ var NetworkLinkStatusSchema = object({
27888
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27889
+ type: _enum([
27890
+ "wifi",
27891
+ "ethernet",
27892
+ "cellular",
27893
+ "unknown"
27894
+ ]),
27895
+ /**
27896
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27897
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27898
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27899
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27900
+ * SKIP a null rather than coerce it.
27901
+ */
27902
+ signalPercent: number().min(0).max(100).nullable(),
27903
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27904
+ rssiDbm: number().optional(),
27905
+ /** Network name of a wireless link, when the firmware reports it. */
27906
+ ssid: string().optional(),
27907
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27908
+ lastUpdated: number()
27909
+ });
27910
+ var networkLinkCapability = {
27911
+ name: "network-link",
27912
+ scope: "device",
27913
+ deviceNative: true,
27914
+ mode: "singleton",
27915
+ deviceTypes: [
27916
+ DeviceType.Camera,
27917
+ DeviceType.Sensor,
27918
+ DeviceType.Button,
27919
+ DeviceType.Switch,
27920
+ DeviceType.Light,
27921
+ DeviceType.Lock,
27922
+ DeviceType.Siren
27923
+ ],
27924
+ methods: {},
27925
+ events: {
27926
+ /**
27927
+ * Emitted whenever the cached status changes (a link switch, a signal
27928
+ * reading that moved). Mirrored on the parent chain by the
27929
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27930
+ */
27931
+ onStatusChanged: { data: object({
27932
+ deviceId: number(),
27933
+ status: NetworkLinkStatusSchema
27934
+ }) } },
27935
+ status: {
27936
+ schema: NetworkLinkStatusSchema,
27937
+ kind: "push",
27938
+ empty: {
27939
+ type: "unknown",
27940
+ signalPercent: null,
27941
+ lastUpdated: 0
27942
+ }
27943
+ },
27944
+ /**
27945
+ * Runtime-state slice — every provider stores the same shape under
27946
+ * `device.runtimeState['network-link']`, read once by the badge and the
27947
+ * Home Assistant projector regardless of the driver.
27948
+ */
27949
+ runtimeState: NetworkLinkStatusSchema,
27950
+ /**
27951
+ * Runtime-state durability: **restored** — a link reading is slow to
27952
+ * change and a sleeping battery camera may not report for hours; the
27953
+ * restored slice is what the badge shows until the next read.
27954
+ *
27955
+ * See `RuntimeStateDurability`. Enforced by
27956
+ * `scripts/check-runtime-state-durability.ts`.
27957
+ */
27958
+ durability: "restored",
27959
+ /** Clock fields: written, but excluded from the compare that decides
27960
+ * whether persisting is worth a SQLite commit. */
27961
+ volatileStateFields: ["lastUpdated"]
27962
+ };
27963
+ /**
27556
27964
  * network-quality — system-scoped singleton capability tracking RTT,
27557
27965
  * jitter, and observed/peak bandwidth per device + per client.
27558
27966
  *
@@ -29241,287 +29649,6 @@ var ptzAutotrackCapability = {
29241
29649
  */
29242
29650
  durability: "session"
29243
29651
  };
29244
- /**
29245
- * `navigation` — a device-scoped capability that natively expresses the FULL
29246
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29247
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29248
- *
29249
- * Why a NEW cap rather than overloading `ptz`:
29250
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29251
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29252
- * The two are different physical models: PTZ is absolute-position + presets,
29253
- * navigation is momentary drive nudges + discrete robot ACTIONS
29254
- * (dock / spot-clean / follow-pet / go-to-point / …).
29255
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29256
- * the reverse:
29257
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29258
- * / `getOptions`), and
29259
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29260
- * robot camera shows up in the existing PTZ control path without every
29261
- * PTZ provider learning about robots. The mapping lives in the adapter,
29262
- * not here (see the addon design note):
29263
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29264
- * ptz.stop() → navigation.stop()
29265
- * ptz.goHome() → navigation.runAction('goHome')
29266
- * ptz.getPresets() → navigation.listActions() (id→preset)
29267
- * ptz.goToPreset(id) → navigation.runAction(id)
29268
- *
29269
- * ## Continuous drive
29270
- *
29271
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29272
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29273
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29274
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29275
- * coalesce them. The UI owns the cadence.
29276
- *
29277
- * ## The action dictionary
29278
- *
29279
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29280
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29281
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29282
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29283
- * vendor-specific list. `kind: 'action'` entries are triggered with
29284
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29285
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29286
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29287
- *
29288
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29289
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29290
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29291
- * every device handle. A future nodedreame publish adds a typed
29292
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29293
- * provider can then swap the raw calls for the typed methods with no change to
29294
- * THIS contract.
29295
- */
29296
- /**
29297
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29298
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29299
- * halts it.
29300
- *
29301
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29302
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29303
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29304
- * vector by it (drivers without proportional drive ignore it).
29305
- *
29306
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29307
- * axis alone; an all-undefined nudge is a no-op.
29308
- */
29309
- var NavigationMoveCommandSchema = object({
29310
- pan: number().min(-1).max(1).optional(),
29311
- tilt: number().min(-1).max(1).optional(),
29312
- speed: number().min(0).max(1).optional()
29313
- });
29314
- /**
29315
- * The enumerated discrete actions a navigation-capable robot can perform via
29316
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29317
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29318
- * `playSound` (see the `sound` dictionary entries).
29319
- */
29320
- var NavigationActionIdSchema = _enum([
29321
- "goHome",
29322
- "locate",
29323
- "spotClean",
29324
- "findPet",
29325
- "personFollow",
29326
- "stop",
29327
- "startClean",
29328
- "pauseClean",
29329
- "dockWash",
29330
- "autoEmpty",
29331
- "flashOn",
29332
- "flashOff"
29333
- ]);
29334
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29335
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29336
- /**
29337
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29338
- * native panel and the PTZ mimic render as a button.
29339
- *
29340
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29341
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29342
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29343
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29344
- * - `label` — operator-facing English label.
29345
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29346
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29347
- * PTZ render ONLY enabled entries. Data-driven: the provider
29348
- * flips it from config, never by editing code.
29349
- */
29350
- var NavigationActionEntrySchema = object({
29351
- id: string(),
29352
- kind: NavigationEntryKindSchema,
29353
- label: string(),
29354
- icon: string(),
29355
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29356
- soundId: number().int().optional(),
29357
- /** Per-device feature flag — render this entry only when true. */
29358
- enabled: boolean()
29359
- });
29360
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29361
- var NavigationPointSchema = object({
29362
- x: number(),
29363
- y: number()
29364
- });
29365
- /**
29366
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29367
- * The cap reports which are enabled so the UI / PTZ render only the controls
29368
- * that are turned on for THIS device. Data-driven: the provider derives these
29369
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29370
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29371
- * that are not dictionary entries.
29372
- *
29373
- * - `move` / `stop` — the momentary drive joystick.
29374
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29375
- * map-coordinate plumbing is wired.
29376
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29377
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29378
- * - `light` — the on/off fill-light toggle (works anytime).
29379
- * - `lightMode` — the auto/manual selector + manual level slider (a
29380
- * camera-service control; needs an active stream).
29381
- */
29382
- var NavigationFeaturesSchema = object({
29383
- move: boolean(),
29384
- stop: boolean(),
29385
- goToPoint: boolean(),
29386
- runAction: boolean(),
29387
- playSound: boolean(),
29388
- light: boolean(),
29389
- lightMode: boolean()
29390
- });
29391
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29392
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29393
- /**
29394
- * Live navigation state so the UI can reflect what the robot is doing:
29395
- * - `mode` — coarse activity (idle / cleaning / following / …).
29396
- * - `following` — person/pet follow is currently armed.
29397
- * - `flash` — the on-camera fill light is on.
29398
- * - `lightMode` — auto vs manual fill-light mode.
29399
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29400
- * `lightMode === 'manual'`.
29401
- */
29402
- var NavigationStatusSchema = object({
29403
- mode: _enum([
29404
- "idle",
29405
- "cleaning",
29406
- "spot",
29407
- "following",
29408
- "goto",
29409
- "returning",
29410
- "paused",
29411
- "unknown"
29412
- ]),
29413
- following: boolean(),
29414
- flash: boolean(),
29415
- lightMode: NavigationLightModeSchema,
29416
- lightLevel: number().min(40).max(100),
29417
- /** Ms epoch when the slice was last updated. */
29418
- lastChangedAt: number()
29419
- });
29420
- /**
29421
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29422
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29423
- * convention.
29424
- */
29425
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29426
- var navigationCapability = {
29427
- name: "navigation",
29428
- scope: "device",
29429
- deviceNative: true,
29430
- mode: "singleton",
29431
- deviceTypes: [DeviceType.Camera],
29432
- deviceConfig: { ui: {
29433
- kind: "widget",
29434
- widgetId: "host/navigation-panel",
29435
- tab: "navigation",
29436
- topTab: true,
29437
- label: "Navigation",
29438
- order: 0
29439
- } },
29440
- methods: {
29441
- /**
29442
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29443
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29444
- * path) works for any authenticated user, not admin-only. The UI sends
29445
- * these at ~1 Hz while a control is held; the provider forwards each one to
29446
- * a single drive write WITHOUT debouncing.
29447
- */
29448
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29449
- /** Halt all motion immediately (zero drive vector). */
29450
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29451
- /** Send the robot to a point on its live map. */
29452
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29453
- /**
29454
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29455
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29456
- */
29457
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29458
- /**
29459
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29460
- * unsupported action ids are rejected by the provider.
29461
- */
29462
- runAction: method(object({
29463
- deviceId: number(),
29464
- actionId: NavigationActionIdSchema
29465
- }), _void(), { kind: "mutation" }),
29466
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29467
- playSound: method(object({
29468
- deviceId: number(),
29469
- soundId: number().int()
29470
- }), _void(), { kind: "mutation" }),
29471
- /**
29472
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29473
- * works anytime, no active stream required).
29474
- */
29475
- setLightOn: method(object({
29476
- deviceId: number(),
29477
- on: boolean()
29478
- }), _void(), { kind: "mutation" }),
29479
- /**
29480
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29481
- * initial `level`. The auto/manual + level control is a CAMERA-service
29482
- * action that generally needs an active camera stream/monitor session — the
29483
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29484
- */
29485
- setLightMode: method(object({
29486
- deviceId: number(),
29487
- mode: NavigationLightModeSchema,
29488
- level: number().min(40).max(100).optional()
29489
- }), _void(), { kind: "mutation" }),
29490
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29491
- setLightLevel: method(object({
29492
- deviceId: number(),
29493
- level: number().min(40).max(100)
29494
- }), _void(), { kind: "mutation" }),
29495
- /**
29496
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29497
- * controls the UI shows (the per-entry flags for the dictionary come back on
29498
- * `listActions`).
29499
- */
29500
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29501
- },
29502
- events: { onStatusChanged: { data: object({
29503
- deviceId: number(),
29504
- status: NavigationStatusSchema
29505
- }) } },
29506
- status: {
29507
- schema: NavigationStatusSchema,
29508
- kind: "push"
29509
- },
29510
- /**
29511
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29512
- * for live mode / follow / flash changes.
29513
- */
29514
- runtimeState: NavigationRuntimeStateSchema,
29515
- /**
29516
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29517
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29518
- * that. The live handle re-publishes on connect.
29519
- *
29520
- * See `RuntimeStateDurability`. Enforced by
29521
- * `scripts/check-runtime-state-durability.ts`.
29522
- */
29523
- durability: "session"
29524
- };
29525
29652
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29526
29653
  kind: "mutation",
29527
29654
  auth: "admin"
@@ -39382,13 +39509,13 @@ Object.freeze({
39382
39509
  addonId: null,
39383
39510
  access: "view"
39384
39511
  },
39385
- "storage.getDefaultLocation": {
39512
+ "storage.list": {
39386
39513
  capName: "storage",
39387
39514
  capScope: "system",
39388
39515
  addonId: null,
39389
39516
  access: "view"
39390
39517
  },
39391
- "storage.list": {
39518
+ "storage.listDrainProgress": {
39392
39519
  capName: "storage",
39393
39520
  capScope: "system",
39394
39521
  addonId: null,
@@ -39538,6 +39665,12 @@ Object.freeze({
39538
39665
  addonId: null,
39539
39666
  access: "view"
39540
39667
  },
39668
+ "storageOccupancy.getOccupancy": {
39669
+ capName: "storage-occupancy",
39670
+ capScope: "system",
39671
+ addonId: null,
39672
+ access: "view"
39673
+ },
39541
39674
  "storageProvider.abortUpload": {
39542
39675
  capName: "storage-provider",
39543
39676
  capScope: "system",