@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.js CHANGED
@@ -6,7 +6,7 @@ let node_crypto = require("node:crypto");
6
6
  let node_http = require("node:http");
7
7
  let node_https = require("node:https");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-zAv7pMUz.mjs
9
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -201,6 +201,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
201
201
  EventCategory["ProcessCrashed"] = "process.crashed";
202
202
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
203
203
  EventCategory["ProcessRestarted"] = "process.restarted";
204
+ /**
205
+ * The SET of storage locations changed — one was created, edited, enabled,
206
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
207
+ *
208
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
209
+ * it must also converge on its own periodic path, because a dropped event
210
+ * must not leave a node writing to yesterday's disk set forever. It exists
211
+ * because there was NO signal at all — an operator who added a second
212
+ * recordings disk in the admin UI got nothing, and the recorder kept its
213
+ * resolved locations until something else happened to re-resolve them
214
+ * (D387). Payload `StorageLocationsChangedPayload`.
215
+ */
216
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
204
217
  EventCategory["RecordingStarted"] = "recording.started";
205
218
  EventCategory["RecordingStopped"] = "recording.stopped";
206
219
  EventCategory["RecordingError"] = "recording.error";
@@ -7610,111 +7623,6 @@ var CameraSwitchGroupSchema = object({
7610
7623
  fetchedAt: number()
7611
7624
  });
7612
7625
  /**
7613
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7614
- * an addon declares its channels in.
7615
- *
7616
- * ## Two axes, deliberately separated
7617
- *
7618
- * - **DECLARATION** — which channels exist. Only the addon knows:
7619
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7620
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7621
- * and rots silently. So a channel is declared where it is consulted, and the
7622
- * `log-channels` capability enumerates the declarations.
7623
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7624
- * thing: the logging settings document on the `system` cap. Two authorities
7625
- * over the values is the exact defect
7626
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7627
- * remove; re-introducing it from the cure side would be grotesque.
7628
- *
7629
- * Nothing in this file reads a clock, an env var or a store. The registry is
7630
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7631
- * the hot path with a value somebody actually read, and by
7632
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7633
- * never reaches here, so it can neither disarm an armed channel nor arm a
7634
- * disarmed one (D49).
7635
- *
7636
- * ## The canonical call shape
7637
- *
7638
- * ```ts
7639
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7640
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7641
- * }
7642
- * ```
7643
- *
7644
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7645
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7646
- * object literal is never constructed because it lives inside the branch. It
7647
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7648
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7649
- * destination floor (measured at 1.93 ns/call when off).
7650
- *
7651
- * ## Why a channel emits at `info`
7652
- *
7653
- * `loki-logging.addon.ts` pins the destination default at `info` and
7654
- * `loki-destination.ts` drops everything below it, so a line emitted at
7655
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7656
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7657
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7658
- * emits at the channel's declared level, whose schema floor is `info`.
7659
- */
7660
- /**
7661
- * The level a channel writes at once armed.
7662
- *
7663
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7664
- * not leave the process for Loki, and the whole point of arming a channel is
7665
- * to read it later.
7666
- */
7667
- var LogChannelLevelSchema = _enum([
7668
- "info",
7669
- "warn",
7670
- "error"
7671
- ]);
7672
- /**
7673
- * What an addon declares about one channel. No value, no state — a
7674
- * declaration is inert.
7675
- */
7676
- var LogChannelDescriptorSchema = object({
7677
- /**
7678
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7679
- * the addon's short name so an operator reading a channel list can tell who
7680
- * owns it without a second lookup.
7681
- */
7682
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7683
- /** One sentence: what the operator will SEE after arming it. */
7684
- description: string().min(1),
7685
- /** The level its lines are emitted at. Never below `info`. */
7686
- defaultLevel: LogChannelLevelSchema,
7687
- /**
7688
- * Whether this channel can be narrowed to a camera.
7689
- *
7690
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7691
- * consulted with the numeric device id, AND every line the channel admits
7692
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7693
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7694
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7695
- * the body is the only way to filter.
7696
- *
7697
- * A channel whose lines carry the device only in `meta` (or not at all) is
7698
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7699
- * the operator narrows to one camera, sees nothing, and concludes the code
7700
- * path was never taken.
7701
- */
7702
- perDevice: boolean()
7703
- });
7704
- /**
7705
- * An armed window over one channel, as the document hands it to a mirror.
7706
- *
7707
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7708
- * expires by itself, which is the one failure a boolean cannot avoid.
7709
- */
7710
- var LogChannelWindowSchema = object({
7711
- channel: string().min(1),
7712
- /** Epoch ms the window closes at. */
7713
- armedUntilMs: number(),
7714
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7715
- deviceIds: array(number().int()).readonly().nullable()
7716
- });
7717
- /**
7718
7626
  * Ops-log — the durable, append-only operations audit shared by the
7719
7627
  * recordings and events management surfaces.
7720
7628
  *
@@ -8636,6 +8544,21 @@ var StorageCleanupJobSchema = object({
8636
8544
  });
8637
8545
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8638
8546
  /**
8547
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8548
+ * alias below is `z.infer<>` of it, never a second spelling.
8549
+ */
8550
+ var StorageLocationModeSchema = _enum([
8551
+ "active",
8552
+ "readonly",
8553
+ "drain",
8554
+ "disabled"
8555
+ ]);
8556
+ _enum([
8557
+ "normal",
8558
+ "never",
8559
+ "drain"
8560
+ ]);
8561
+ /**
8639
8562
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8640
8563
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8641
8564
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8660,8 +8583,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8660
8583
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8661
8584
  *
8662
8585
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8663
- * The default location for a type uses `id === <type>:default` by
8664
- * convention (the bare type ref like `'backups'` resolves to it).
8586
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8587
+ * There is no default location any more (D383): `enabled` is the whole write
8588
+ * model, and a bare type ref resolves to the sole location of the type, or —
8589
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8590
+ * slug is `default`.
8665
8591
  *
8666
8592
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8667
8593
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8682,23 +8608,37 @@ var StorageLocationSchema = object({
8682
8608
  * flag at upsert time, not here (the schema is provider-agnostic).
8683
8609
  */
8684
8610
  nodeId: string().optional(),
8685
- isDefault: boolean().default(false),
8686
8611
  isSystem: boolean().default(false),
8687
8612
  /**
8688
- * Operator opt-in: whether consumers that BALANCE across several locations
8689
- * of a type may write here. Recordings reads it today; event media and
8690
- * backups are the next consumers, which is why the flag lives on the
8691
- * location rather than in any one addon's store — nothing has to be
8692
- * extended to add the next consumer.
8613
+ * THE write switch, and the only one (D383). `enabled: true` means every
8614
+ * consumer that chooses a write target for this type may write here, and all
8615
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8616
+ * still read, still played back, still age-swept, still drained, never
8617
+ * written.
8693
8618
  *
8694
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8695
- * flag existed reads back with no flag and keeps working exactly as before;
8696
- * that is the whole compat story, and it is why no migration ships with it.
8697
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8698
- * disk must not silently start writing to it); the default of a type is
8699
- * always stamped `true`.
8619
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8620
+ * stored" on an update and "born inert unless it is the first location of its
8621
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8622
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8623
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8624
+ * stops existing rather than being re-derived on every read.
8700
8625
  */
8701
8626
  enabled: boolean().optional(),
8627
+ /**
8628
+ * THE state of this location (D385), and the only authority on what may be
8629
+ * written, read or evicted here. Interpreted in exactly one place —
8630
+ * `storage-location-mode.ts` — which also folds the legacy
8631
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8632
+ * ambiguous.
8633
+ *
8634
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8635
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8636
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8637
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8638
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8639
+ * either, so the two cannot disagree.
8640
+ */
8641
+ mode: StorageLocationModeSchema.optional(),
8702
8642
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8703
8643
  * for node-local locations it can reach) — never persisted, absent when the
8704
8644
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8706,13 +8646,50 @@ var StorageLocationSchema = object({
8706
8646
  totalBytes: number(),
8707
8647
  availableBytes: number()
8708
8648
  }).nullable().optional(),
8649
+ /**
8650
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8651
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8652
+ * never persisted, never a filesystem walk.
8653
+ *
8654
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8655
+ * location yet — nobody stores here, the owning addon is down, or the first
8656
+ * refresh has not completed. A UI must omit the segment rather than draw it
8657
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8658
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8659
+ * be spelled out loud instead of appearing by accident.
8660
+ *
8661
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8662
+ * about the whole figure rather than about its freshest part.
8663
+ */
8664
+ owned: object({
8665
+ bytes: number().int().nonnegative(),
8666
+ measuredAtMs: number().int().nonnegative()
8667
+ }).optional(),
8709
8668
  createdAt: number(),
8710
8669
  updatedAt: number()
8711
8670
  });
8671
+ object({ isDefault: boolean().optional() });
8672
+ /**
8673
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8674
+ *
8675
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8676
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8677
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8678
+ * operator learns not to believe the screen.
8679
+ */
8680
+ var StorageDrainProgressSchema = object({
8681
+ locationId: string(),
8682
+ startedAtMs: number(),
8683
+ startBytes: number(),
8684
+ bytesRemaining: number(),
8685
+ drained: boolean(),
8686
+ estimatedEmptyAtMs: number().nullable()
8687
+ });
8712
8688
  /**
8713
8689
  * Reference accepted by consumer-facing `api.storage.*` calls.
8714
8690
  * Either:
8715
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8691
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8692
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8716
8693
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8717
8694
  *
8718
8695
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8888,6 +8865,111 @@ var DecoderSessionConfigSchema = object({
8888
8865
  */
8889
8866
  debug: boolean().optional()
8890
8867
  });
8868
+ /**
8869
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8870
+ * an addon declares its channels in.
8871
+ *
8872
+ * ## Two axes, deliberately separated
8873
+ *
8874
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8875
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8876
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8877
+ * and rots silently. So a channel is declared where it is consulted, and the
8878
+ * `log-channels` capability enumerates the declarations.
8879
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8880
+ * thing: the logging settings document on the `system` cap. Two authorities
8881
+ * over the values is the exact defect
8882
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8883
+ * remove; re-introducing it from the cure side would be grotesque.
8884
+ *
8885
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8886
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8887
+ * the hot path with a value somebody actually read, and by
8888
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8889
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8890
+ * disarmed one (D49).
8891
+ *
8892
+ * ## The canonical call shape
8893
+ *
8894
+ * ```ts
8895
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8896
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8897
+ * }
8898
+ * ```
8899
+ *
8900
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8901
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8902
+ * object literal is never constructed because it lives inside the branch. It
8903
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8904
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8905
+ * destination floor (measured at 1.93 ns/call when off).
8906
+ *
8907
+ * ## Why a channel emits at `info`
8908
+ *
8909
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8910
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8911
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8912
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8913
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8914
+ * emits at the channel's declared level, whose schema floor is `info`.
8915
+ */
8916
+ /**
8917
+ * The level a channel writes at once armed.
8918
+ *
8919
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8920
+ * not leave the process for Loki, and the whole point of arming a channel is
8921
+ * to read it later.
8922
+ */
8923
+ var LogChannelLevelSchema = _enum([
8924
+ "info",
8925
+ "warn",
8926
+ "error"
8927
+ ]);
8928
+ /**
8929
+ * What an addon declares about one channel. No value, no state — a
8930
+ * declaration is inert.
8931
+ */
8932
+ var LogChannelDescriptorSchema = object({
8933
+ /**
8934
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8935
+ * the addon's short name so an operator reading a channel list can tell who
8936
+ * owns it without a second lookup.
8937
+ */
8938
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8939
+ /** One sentence: what the operator will SEE after arming it. */
8940
+ description: string().min(1),
8941
+ /** The level its lines are emitted at. Never below `info`. */
8942
+ defaultLevel: LogChannelLevelSchema,
8943
+ /**
8944
+ * Whether this channel can be narrowed to a camera.
8945
+ *
8946
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8947
+ * consulted with the numeric device id, AND every line the channel admits
8948
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8949
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8950
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8951
+ * the body is the only way to filter.
8952
+ *
8953
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8954
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8955
+ * the operator narrows to one camera, sees nothing, and concludes the code
8956
+ * path was never taken.
8957
+ */
8958
+ perDevice: boolean()
8959
+ });
8960
+ /**
8961
+ * An armed window over one channel, as the document hands it to a mirror.
8962
+ *
8963
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8964
+ * expires by itself, which is the one failure a boolean cannot avoid.
8965
+ */
8966
+ var LogChannelWindowSchema = object({
8967
+ channel: string().min(1),
8968
+ /** Epoch ms the window closes at. */
8969
+ armedUntilMs: number(),
8970
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8971
+ deviceIds: array(number().int()).readonly().nullable()
8972
+ });
8891
8973
  var MODEL_FORMATS = [
8892
8974
  "onnx",
8893
8975
  "coreml",
@@ -22024,7 +22106,7 @@ method(object({
22024
22106
  downloadId: string(),
22025
22107
  offset: number(),
22026
22108
  length: number()
22027
- }), _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({
22109
+ }), _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({
22028
22110
  createdAt: true,
22029
22111
  updatedAt: true
22030
22112
  }), StorageLocationSchema, {
@@ -22036,7 +22118,7 @@ method(object({
22036
22118
  }), _void(), {
22037
22119
  kind: "mutation",
22038
22120
  auth: "admin"
22039
- }), method(object({ id: string() }), object({
22121
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22040
22122
  ok: boolean(),
22041
22123
  error: string().optional()
22042
22124
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22106,6 +22188,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22106
22188
  kind: "mutation",
22107
22189
  auth: "admin"
22108
22190
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22191
+ /**
22192
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22193
+ * location (D388).
22194
+ *
22195
+ * ## Why this is not `storage-evictable`
22196
+ *
22197
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22198
+ * not, in two ways that both matter and both bite hardest on the locations an
22199
+ * operator most wants a figure for:
22200
+ *
22201
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22202
+ * and `recordingsLow:default` deliberately share one root and evict as one
22203
+ * oldest-first pool, so both answer with the SAME combined total. As an
22204
+ * occupancy figure that double-counts the disk.
22205
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22206
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22207
+ * is retiring and staring at.
22208
+ *
22209
+ * So this is its own contract with its own quantity, and the quantity is
22210
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22211
+ * would ever be willing to delete it. A provider that can only answer
22212
+ * "evictable" must not register here — a number that silently means different
22213
+ * things per class is worse than no number.
22214
+ *
22215
+ * ## Absence is an answer
22216
+ *
22217
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22218
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22219
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22220
+ * consuming side has to be written out loud instead of appearing by accident.
22221
+ *
22222
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22223
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22224
+ */
22225
+ /** One provider's occupancy answer for one location. */
22226
+ var StorageOccupancyReportSchema = object({
22227
+ locationId: string(),
22228
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22229
+ * not net of what it is willing to delete. */
22230
+ ownedBytes: number().int().nonnegative(),
22231
+ /** When the provider last actually measured this. The orchestrator carries it
22232
+ * through so a UI can say how old the figure is instead of implying "now". */
22233
+ measuredAtMs: number().int().nonnegative()
22234
+ });
22235
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22109
22236
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22110
22237
  providerId: string().min(1),
22111
22238
  displayName: string().min(1),
@@ -23941,88 +24068,6 @@ onStatusChanged: { data: object({
23941
24068
  volatileStateFields: ["lastUpdated"]
23942
24069
  };
23943
24070
  /**
23944
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23945
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23946
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23947
- * one Home Assistant projection.
23948
- */
23949
- var NetworkLinkStatusSchema = object({
23950
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23951
- type: _enum([
23952
- "wifi",
23953
- "ethernet",
23954
- "cellular",
23955
- "unknown"
23956
- ]),
23957
- /**
23958
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23959
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23960
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23961
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23962
- * SKIP a null rather than coerce it.
23963
- */
23964
- signalPercent: number().min(0).max(100).nullable(),
23965
- /** Raw received signal strength in dBm, when the firmware reports one. */
23966
- rssiDbm: number().optional(),
23967
- /** Network name of a wireless link, when the firmware reports it. */
23968
- ssid: string().optional(),
23969
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23970
- lastUpdated: number()
23971
- });
23972
- var networkLinkCapability = {
23973
- name: "network-link",
23974
- scope: "device",
23975
- deviceNative: true,
23976
- mode: "singleton",
23977
- deviceTypes: [
23978
- DeviceType.Camera,
23979
- DeviceType.Sensor,
23980
- DeviceType.Button,
23981
- DeviceType.Switch,
23982
- DeviceType.Light,
23983
- DeviceType.Lock,
23984
- DeviceType.Siren
23985
- ],
23986
- methods: {},
23987
- events: {
23988
- /**
23989
- * Emitted whenever the cached status changes (a link switch, a signal
23990
- * reading that moved). Mirrored on the parent chain by the
23991
- * DeviceEventPropagator like `battery.onStatusChanged`.
23992
- */
23993
- onStatusChanged: { data: object({
23994
- deviceId: number(),
23995
- status: NetworkLinkStatusSchema
23996
- }) } },
23997
- status: {
23998
- schema: NetworkLinkStatusSchema,
23999
- kind: "push",
24000
- empty: {
24001
- type: "unknown",
24002
- signalPercent: null,
24003
- lastUpdated: 0
24004
- }
24005
- },
24006
- /**
24007
- * Runtime-state slice — every provider stores the same shape under
24008
- * `device.runtimeState['network-link']`, read once by the badge and the
24009
- * Home Assistant projector regardless of the driver.
24010
- */
24011
- runtimeState: NetworkLinkStatusSchema,
24012
- /**
24013
- * Runtime-state durability: **restored** — a link reading is slow to
24014
- * change and a sleeping battery camera may not report for hours; the
24015
- * restored slice is what the badge shows until the next read.
24016
- *
24017
- * See `RuntimeStateDurability`. Enforced by
24018
- * `scripts/check-runtime-state-durability.ts`.
24019
- */
24020
- durability: "restored",
24021
- /** Clock fields: written, but excluded from the compare that decides
24022
- * whether persisting is worth a SQLite commit. */
24023
- volatileStateFields: ["lastUpdated"]
24024
- };
24025
- /**
24026
24071
  * Generic boolean sensor — last-resort fallback when no domain-
24027
24072
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24028
24073
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27552,6 +27597,369 @@ var nativeObjectDetectionCapability = {
27552
27597
  volatileStateFields: ["lastFetchedAt"]
27553
27598
  };
27554
27599
  /**
27600
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27601
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27602
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27603
+ *
27604
+ * Why a NEW cap rather than overloading `ptz`:
27605
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27606
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27607
+ * The two are different physical models: PTZ is absolute-position + presets,
27608
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27609
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27610
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27611
+ * the reverse:
27612
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27613
+ * / `getOptions`), and
27614
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27615
+ * robot camera shows up in the existing PTZ control path without every
27616
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27617
+ * not here (see the addon design note):
27618
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27619
+ * ptz.stop() → navigation.stop()
27620
+ * ptz.goHome() → navigation.runAction('goHome')
27621
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27622
+ * ptz.goToPreset(id) → navigation.runAction(id)
27623
+ *
27624
+ * ## Continuous drive
27625
+ *
27626
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27627
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27628
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27629
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27630
+ * coalesce them. The UI owns the cadence.
27631
+ *
27632
+ * ## The action dictionary
27633
+ *
27634
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27635
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27636
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27637
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27638
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27639
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27640
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27641
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27642
+ *
27643
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27644
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27645
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27646
+ * every device handle. A future nodedreame publish adds a typed
27647
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27648
+ * provider can then swap the raw calls for the typed methods with no change to
27649
+ * THIS contract.
27650
+ */
27651
+ /**
27652
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27653
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27654
+ * halts it.
27655
+ *
27656
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27657
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27658
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27659
+ * vector by it (drivers without proportional drive ignore it).
27660
+ *
27661
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27662
+ * axis alone; an all-undefined nudge is a no-op.
27663
+ */
27664
+ var NavigationMoveCommandSchema = object({
27665
+ pan: number().min(-1).max(1).optional(),
27666
+ tilt: number().min(-1).max(1).optional(),
27667
+ speed: number().min(0).max(1).optional()
27668
+ });
27669
+ /**
27670
+ * The enumerated discrete actions a navigation-capable robot can perform via
27671
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27672
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27673
+ * `playSound` (see the `sound` dictionary entries).
27674
+ */
27675
+ var NavigationActionIdSchema = _enum([
27676
+ "goHome",
27677
+ "locate",
27678
+ "spotClean",
27679
+ "findPet",
27680
+ "personFollow",
27681
+ "stop",
27682
+ "startClean",
27683
+ "pauseClean",
27684
+ "dockWash",
27685
+ "autoEmpty",
27686
+ "flashOn",
27687
+ "flashOff"
27688
+ ]);
27689
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27690
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27691
+ /**
27692
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27693
+ * native panel and the PTZ mimic render as a button.
27694
+ *
27695
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27696
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27697
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27698
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27699
+ * - `label` — operator-facing English label.
27700
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27701
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27702
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27703
+ * flips it from config, never by editing code.
27704
+ */
27705
+ var NavigationActionEntrySchema = object({
27706
+ id: string(),
27707
+ kind: NavigationEntryKindSchema,
27708
+ label: string(),
27709
+ icon: string(),
27710
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27711
+ soundId: number().int().optional(),
27712
+ /** Per-device feature flag — render this entry only when true. */
27713
+ enabled: boolean()
27714
+ });
27715
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27716
+ var NavigationPointSchema = object({
27717
+ x: number(),
27718
+ y: number()
27719
+ });
27720
+ /**
27721
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27722
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27723
+ * that are turned on for THIS device. Data-driven: the provider derives these
27724
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27725
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27726
+ * that are not dictionary entries.
27727
+ *
27728
+ * - `move` / `stop` — the momentary drive joystick.
27729
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27730
+ * map-coordinate plumbing is wired.
27731
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27732
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27733
+ * - `light` — the on/off fill-light toggle (works anytime).
27734
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27735
+ * camera-service control; needs an active stream).
27736
+ */
27737
+ var NavigationFeaturesSchema = object({
27738
+ move: boolean(),
27739
+ stop: boolean(),
27740
+ goToPoint: boolean(),
27741
+ runAction: boolean(),
27742
+ playSound: boolean(),
27743
+ light: boolean(),
27744
+ lightMode: boolean()
27745
+ });
27746
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27747
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27748
+ /**
27749
+ * Live navigation state so the UI can reflect what the robot is doing:
27750
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27751
+ * - `following` — person/pet follow is currently armed.
27752
+ * - `flash` — the on-camera fill light is on.
27753
+ * - `lightMode` — auto vs manual fill-light mode.
27754
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27755
+ * `lightMode === 'manual'`.
27756
+ */
27757
+ var NavigationStatusSchema = object({
27758
+ mode: _enum([
27759
+ "idle",
27760
+ "cleaning",
27761
+ "spot",
27762
+ "following",
27763
+ "goto",
27764
+ "returning",
27765
+ "paused",
27766
+ "unknown"
27767
+ ]),
27768
+ following: boolean(),
27769
+ flash: boolean(),
27770
+ lightMode: NavigationLightModeSchema,
27771
+ lightLevel: number().min(40).max(100),
27772
+ /** Ms epoch when the slice was last updated. */
27773
+ lastChangedAt: number()
27774
+ });
27775
+ /**
27776
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27777
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27778
+ * convention.
27779
+ */
27780
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27781
+ var navigationCapability = {
27782
+ name: "navigation",
27783
+ scope: "device",
27784
+ deviceNative: true,
27785
+ mode: "singleton",
27786
+ deviceTypes: [DeviceType.Camera],
27787
+ deviceConfig: { ui: {
27788
+ kind: "widget",
27789
+ widgetId: "host/navigation-panel",
27790
+ tab: "navigation",
27791
+ topTab: true,
27792
+ label: "Navigation",
27793
+ order: 0
27794
+ } },
27795
+ methods: {
27796
+ /**
27797
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27798
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27799
+ * path) works for any authenticated user, not admin-only. The UI sends
27800
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27801
+ * a single drive write WITHOUT debouncing.
27802
+ */
27803
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27804
+ /** Halt all motion immediately (zero drive vector). */
27805
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27806
+ /** Send the robot to a point on its live map. */
27807
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27808
+ /**
27809
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27810
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27811
+ */
27812
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27813
+ /**
27814
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27815
+ * unsupported action ids are rejected by the provider.
27816
+ */
27817
+ runAction: method(object({
27818
+ deviceId: number(),
27819
+ actionId: NavigationActionIdSchema
27820
+ }), _void(), { kind: "mutation" }),
27821
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27822
+ playSound: method(object({
27823
+ deviceId: number(),
27824
+ soundId: number().int()
27825
+ }), _void(), { kind: "mutation" }),
27826
+ /**
27827
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27828
+ * works anytime, no active stream required).
27829
+ */
27830
+ setLightOn: method(object({
27831
+ deviceId: number(),
27832
+ on: boolean()
27833
+ }), _void(), { kind: "mutation" }),
27834
+ /**
27835
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27836
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27837
+ * action that generally needs an active camera stream/monitor session — the
27838
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27839
+ */
27840
+ setLightMode: method(object({
27841
+ deviceId: number(),
27842
+ mode: NavigationLightModeSchema,
27843
+ level: number().min(40).max(100).optional()
27844
+ }), _void(), { kind: "mutation" }),
27845
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27846
+ setLightLevel: method(object({
27847
+ deviceId: number(),
27848
+ level: number().min(40).max(100)
27849
+ }), _void(), { kind: "mutation" }),
27850
+ /**
27851
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27852
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27853
+ * `listActions`).
27854
+ */
27855
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27856
+ },
27857
+ events: { onStatusChanged: { data: object({
27858
+ deviceId: number(),
27859
+ status: NavigationStatusSchema
27860
+ }) } },
27861
+ status: {
27862
+ schema: NavigationStatusSchema,
27863
+ kind: "push"
27864
+ },
27865
+ /**
27866
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27867
+ * for live mode / follow / flash changes.
27868
+ */
27869
+ runtimeState: NavigationRuntimeStateSchema,
27870
+ /**
27871
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27872
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27873
+ * that. The live handle re-publishes on connect.
27874
+ *
27875
+ * See `RuntimeStateDurability`. Enforced by
27876
+ * `scripts/check-runtime-state-durability.ts`.
27877
+ */
27878
+ durability: "session"
27879
+ };
27880
+ /**
27881
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27882
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27883
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27884
+ * one Home Assistant projection.
27885
+ */
27886
+ var NetworkLinkStatusSchema = object({
27887
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27888
+ type: _enum([
27889
+ "wifi",
27890
+ "ethernet",
27891
+ "cellular",
27892
+ "unknown"
27893
+ ]),
27894
+ /**
27895
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27896
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27897
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27898
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27899
+ * SKIP a null rather than coerce it.
27900
+ */
27901
+ signalPercent: number().min(0).max(100).nullable(),
27902
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27903
+ rssiDbm: number().optional(),
27904
+ /** Network name of a wireless link, when the firmware reports it. */
27905
+ ssid: string().optional(),
27906
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27907
+ lastUpdated: number()
27908
+ });
27909
+ var networkLinkCapability = {
27910
+ name: "network-link",
27911
+ scope: "device",
27912
+ deviceNative: true,
27913
+ mode: "singleton",
27914
+ deviceTypes: [
27915
+ DeviceType.Camera,
27916
+ DeviceType.Sensor,
27917
+ DeviceType.Button,
27918
+ DeviceType.Switch,
27919
+ DeviceType.Light,
27920
+ DeviceType.Lock,
27921
+ DeviceType.Siren
27922
+ ],
27923
+ methods: {},
27924
+ events: {
27925
+ /**
27926
+ * Emitted whenever the cached status changes (a link switch, a signal
27927
+ * reading that moved). Mirrored on the parent chain by the
27928
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27929
+ */
27930
+ onStatusChanged: { data: object({
27931
+ deviceId: number(),
27932
+ status: NetworkLinkStatusSchema
27933
+ }) } },
27934
+ status: {
27935
+ schema: NetworkLinkStatusSchema,
27936
+ kind: "push",
27937
+ empty: {
27938
+ type: "unknown",
27939
+ signalPercent: null,
27940
+ lastUpdated: 0
27941
+ }
27942
+ },
27943
+ /**
27944
+ * Runtime-state slice — every provider stores the same shape under
27945
+ * `device.runtimeState['network-link']`, read once by the badge and the
27946
+ * Home Assistant projector regardless of the driver.
27947
+ */
27948
+ runtimeState: NetworkLinkStatusSchema,
27949
+ /**
27950
+ * Runtime-state durability: **restored** — a link reading is slow to
27951
+ * change and a sleeping battery camera may not report for hours; the
27952
+ * restored slice is what the badge shows until the next read.
27953
+ *
27954
+ * See `RuntimeStateDurability`. Enforced by
27955
+ * `scripts/check-runtime-state-durability.ts`.
27956
+ */
27957
+ durability: "restored",
27958
+ /** Clock fields: written, but excluded from the compare that decides
27959
+ * whether persisting is worth a SQLite commit. */
27960
+ volatileStateFields: ["lastUpdated"]
27961
+ };
27962
+ /**
27555
27963
  * network-quality — system-scoped singleton capability tracking RTT,
27556
27964
  * jitter, and observed/peak bandwidth per device + per client.
27557
27965
  *
@@ -29240,287 +29648,6 @@ var ptzAutotrackCapability = {
29240
29648
  */
29241
29649
  durability: "session"
29242
29650
  };
29243
- /**
29244
- * `navigation` — a device-scoped capability that natively expresses the FULL
29245
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29246
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29247
- *
29248
- * Why a NEW cap rather than overloading `ptz`:
29249
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29250
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29251
- * The two are different physical models: PTZ is absolute-position + presets,
29252
- * navigation is momentary drive nudges + discrete robot ACTIONS
29253
- * (dock / spot-clean / follow-pet / go-to-point / …).
29254
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29255
- * the reverse:
29256
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29257
- * / `getOptions`), and
29258
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29259
- * robot camera shows up in the existing PTZ control path without every
29260
- * PTZ provider learning about robots. The mapping lives in the adapter,
29261
- * not here (see the addon design note):
29262
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29263
- * ptz.stop() → navigation.stop()
29264
- * ptz.goHome() → navigation.runAction('goHome')
29265
- * ptz.getPresets() → navigation.listActions() (id→preset)
29266
- * ptz.goToPreset(id) → navigation.runAction(id)
29267
- *
29268
- * ## Continuous drive
29269
- *
29270
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29271
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29272
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29273
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29274
- * coalesce them. The UI owns the cadence.
29275
- *
29276
- * ## The action dictionary
29277
- *
29278
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29279
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29280
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29281
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29282
- * vendor-specific list. `kind: 'action'` entries are triggered with
29283
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29284
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29285
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29286
- *
29287
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29288
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29289
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29290
- * every device handle. A future nodedreame publish adds a typed
29291
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29292
- * provider can then swap the raw calls for the typed methods with no change to
29293
- * THIS contract.
29294
- */
29295
- /**
29296
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29297
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29298
- * halts it.
29299
- *
29300
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29301
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29302
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29303
- * vector by it (drivers without proportional drive ignore it).
29304
- *
29305
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29306
- * axis alone; an all-undefined nudge is a no-op.
29307
- */
29308
- var NavigationMoveCommandSchema = object({
29309
- pan: number().min(-1).max(1).optional(),
29310
- tilt: number().min(-1).max(1).optional(),
29311
- speed: number().min(0).max(1).optional()
29312
- });
29313
- /**
29314
- * The enumerated discrete actions a navigation-capable robot can perform via
29315
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29316
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29317
- * `playSound` (see the `sound` dictionary entries).
29318
- */
29319
- var NavigationActionIdSchema = _enum([
29320
- "goHome",
29321
- "locate",
29322
- "spotClean",
29323
- "findPet",
29324
- "personFollow",
29325
- "stop",
29326
- "startClean",
29327
- "pauseClean",
29328
- "dockWash",
29329
- "autoEmpty",
29330
- "flashOn",
29331
- "flashOff"
29332
- ]);
29333
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29334
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29335
- /**
29336
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29337
- * native panel and the PTZ mimic render as a button.
29338
- *
29339
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29340
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29341
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29342
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29343
- * - `label` — operator-facing English label.
29344
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29345
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29346
- * PTZ render ONLY enabled entries. Data-driven: the provider
29347
- * flips it from config, never by editing code.
29348
- */
29349
- var NavigationActionEntrySchema = object({
29350
- id: string(),
29351
- kind: NavigationEntryKindSchema,
29352
- label: string(),
29353
- icon: string(),
29354
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29355
- soundId: number().int().optional(),
29356
- /** Per-device feature flag — render this entry only when true. */
29357
- enabled: boolean()
29358
- });
29359
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29360
- var NavigationPointSchema = object({
29361
- x: number(),
29362
- y: number()
29363
- });
29364
- /**
29365
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29366
- * The cap reports which are enabled so the UI / PTZ render only the controls
29367
- * that are turned on for THIS device. Data-driven: the provider derives these
29368
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29369
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29370
- * that are not dictionary entries.
29371
- *
29372
- * - `move` / `stop` — the momentary drive joystick.
29373
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29374
- * map-coordinate plumbing is wired.
29375
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29376
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29377
- * - `light` — the on/off fill-light toggle (works anytime).
29378
- * - `lightMode` — the auto/manual selector + manual level slider (a
29379
- * camera-service control; needs an active stream).
29380
- */
29381
- var NavigationFeaturesSchema = object({
29382
- move: boolean(),
29383
- stop: boolean(),
29384
- goToPoint: boolean(),
29385
- runAction: boolean(),
29386
- playSound: boolean(),
29387
- light: boolean(),
29388
- lightMode: boolean()
29389
- });
29390
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29391
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29392
- /**
29393
- * Live navigation state so the UI can reflect what the robot is doing:
29394
- * - `mode` — coarse activity (idle / cleaning / following / …).
29395
- * - `following` — person/pet follow is currently armed.
29396
- * - `flash` — the on-camera fill light is on.
29397
- * - `lightMode` — auto vs manual fill-light mode.
29398
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29399
- * `lightMode === 'manual'`.
29400
- */
29401
- var NavigationStatusSchema = object({
29402
- mode: _enum([
29403
- "idle",
29404
- "cleaning",
29405
- "spot",
29406
- "following",
29407
- "goto",
29408
- "returning",
29409
- "paused",
29410
- "unknown"
29411
- ]),
29412
- following: boolean(),
29413
- flash: boolean(),
29414
- lightMode: NavigationLightModeSchema,
29415
- lightLevel: number().min(40).max(100),
29416
- /** Ms epoch when the slice was last updated. */
29417
- lastChangedAt: number()
29418
- });
29419
- /**
29420
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29421
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29422
- * convention.
29423
- */
29424
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29425
- var navigationCapability = {
29426
- name: "navigation",
29427
- scope: "device",
29428
- deviceNative: true,
29429
- mode: "singleton",
29430
- deviceTypes: [DeviceType.Camera],
29431
- deviceConfig: { ui: {
29432
- kind: "widget",
29433
- widgetId: "host/navigation-panel",
29434
- tab: "navigation",
29435
- topTab: true,
29436
- label: "Navigation",
29437
- order: 0
29438
- } },
29439
- methods: {
29440
- /**
29441
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29442
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29443
- * path) works for any authenticated user, not admin-only. The UI sends
29444
- * these at ~1 Hz while a control is held; the provider forwards each one to
29445
- * a single drive write WITHOUT debouncing.
29446
- */
29447
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29448
- /** Halt all motion immediately (zero drive vector). */
29449
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29450
- /** Send the robot to a point on its live map. */
29451
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29452
- /**
29453
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29454
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29455
- */
29456
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29457
- /**
29458
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29459
- * unsupported action ids are rejected by the provider.
29460
- */
29461
- runAction: method(object({
29462
- deviceId: number(),
29463
- actionId: NavigationActionIdSchema
29464
- }), _void(), { kind: "mutation" }),
29465
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29466
- playSound: method(object({
29467
- deviceId: number(),
29468
- soundId: number().int()
29469
- }), _void(), { kind: "mutation" }),
29470
- /**
29471
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29472
- * works anytime, no active stream required).
29473
- */
29474
- setLightOn: method(object({
29475
- deviceId: number(),
29476
- on: boolean()
29477
- }), _void(), { kind: "mutation" }),
29478
- /**
29479
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29480
- * initial `level`. The auto/manual + level control is a CAMERA-service
29481
- * action that generally needs an active camera stream/monitor session — the
29482
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29483
- */
29484
- setLightMode: method(object({
29485
- deviceId: number(),
29486
- mode: NavigationLightModeSchema,
29487
- level: number().min(40).max(100).optional()
29488
- }), _void(), { kind: "mutation" }),
29489
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29490
- setLightLevel: method(object({
29491
- deviceId: number(),
29492
- level: number().min(40).max(100)
29493
- }), _void(), { kind: "mutation" }),
29494
- /**
29495
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29496
- * controls the UI shows (the per-entry flags for the dictionary come back on
29497
- * `listActions`).
29498
- */
29499
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29500
- },
29501
- events: { onStatusChanged: { data: object({
29502
- deviceId: number(),
29503
- status: NavigationStatusSchema
29504
- }) } },
29505
- status: {
29506
- schema: NavigationStatusSchema,
29507
- kind: "push"
29508
- },
29509
- /**
29510
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29511
- * for live mode / follow / flash changes.
29512
- */
29513
- runtimeState: NavigationRuntimeStateSchema,
29514
- /**
29515
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29516
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29517
- * that. The live handle re-publishes on connect.
29518
- *
29519
- * See `RuntimeStateDurability`. Enforced by
29520
- * `scripts/check-runtime-state-durability.ts`.
29521
- */
29522
- durability: "session"
29523
- };
29524
29651
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29525
29652
  kind: "mutation",
29526
29653
  auth: "admin"
@@ -39381,13 +39508,13 @@ Object.freeze({
39381
39508
  addonId: null,
39382
39509
  access: "view"
39383
39510
  },
39384
- "storage.getDefaultLocation": {
39511
+ "storage.list": {
39385
39512
  capName: "storage",
39386
39513
  capScope: "system",
39387
39514
  addonId: null,
39388
39515
  access: "view"
39389
39516
  },
39390
- "storage.list": {
39517
+ "storage.listDrainProgress": {
39391
39518
  capName: "storage",
39392
39519
  capScope: "system",
39393
39520
  addonId: null,
@@ -39537,6 +39664,12 @@ Object.freeze({
39537
39664
  addonId: null,
39538
39665
  access: "view"
39539
39666
  },
39667
+ "storageOccupancy.getOccupancy": {
39668
+ capName: "storage-occupancy",
39669
+ capScope: "system",
39670
+ addonId: null,
39671
+ access: "view"
39672
+ },
39540
39673
  "storageProvider.abortUpload": {
39541
39674
  capName: "storage-provider",
39542
39675
  capScope: "system",