@camstack/addon-provider-gree 0.2.77 → 0.2.79

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
@@ -1,7 +1,7 @@
1
1
  import { createSocket } from "dgram";
2
2
  import { createCipheriv, createDecipheriv } from "crypto";
3
3
  import { EventEmitter } from "events";
4
- //#region ../types/dist/event-category-zAv7pMUz.mjs
4
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
5
5
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
6
6
  EventCategory["SystemBoot"] = "system.boot";
7
7
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -196,6 +196,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
196
196
  EventCategory["ProcessCrashed"] = "process.crashed";
197
197
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
198
198
  EventCategory["ProcessRestarted"] = "process.restarted";
199
+ /**
200
+ * The SET of storage locations changed — one was created, edited, enabled,
201
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
202
+ *
203
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
204
+ * it must also converge on its own periodic path, because a dropped event
205
+ * must not leave a node writing to yesterday's disk set forever. It exists
206
+ * because there was NO signal at all — an operator who added a second
207
+ * recordings disk in the admin UI got nothing, and the recorder kept its
208
+ * resolved locations until something else happened to re-resolve them
209
+ * (D387). Payload `StorageLocationsChangedPayload`.
210
+ */
211
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
199
212
  EventCategory["RecordingStarted"] = "recording.started";
200
213
  EventCategory["RecordingStopped"] = "recording.stopped";
201
214
  EventCategory["RecordingError"] = "recording.error";
@@ -7617,111 +7630,6 @@ var CameraSwitchGroupSchema = object({
7617
7630
  fetchedAt: number()
7618
7631
  });
7619
7632
  /**
7620
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7621
- * an addon declares its channels in.
7622
- *
7623
- * ## Two axes, deliberately separated
7624
- *
7625
- * - **DECLARATION** — which channels exist. Only the addon knows:
7626
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7627
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7628
- * and rots silently. So a channel is declared where it is consulted, and the
7629
- * `log-channels` capability enumerates the declarations.
7630
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7631
- * thing: the logging settings document on the `system` cap. Two authorities
7632
- * over the values is the exact defect
7633
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7634
- * remove; re-introducing it from the cure side would be grotesque.
7635
- *
7636
- * Nothing in this file reads a clock, an env var or a store. The registry is
7637
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7638
- * the hot path with a value somebody actually read, and by
7639
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7640
- * never reaches here, so it can neither disarm an armed channel nor arm a
7641
- * disarmed one (D49).
7642
- *
7643
- * ## The canonical call shape
7644
- *
7645
- * ```ts
7646
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7647
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7648
- * }
7649
- * ```
7650
- *
7651
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7652
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7653
- * object literal is never constructed because it lives inside the branch. It
7654
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7655
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7656
- * destination floor (measured at 1.93 ns/call when off).
7657
- *
7658
- * ## Why a channel emits at `info`
7659
- *
7660
- * `loki-logging.addon.ts` pins the destination default at `info` and
7661
- * `loki-destination.ts` drops everything below it, so a line emitted at
7662
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7663
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7664
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7665
- * emits at the channel's declared level, whose schema floor is `info`.
7666
- */
7667
- /**
7668
- * The level a channel writes at once armed.
7669
- *
7670
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7671
- * not leave the process for Loki, and the whole point of arming a channel is
7672
- * to read it later.
7673
- */
7674
- var LogChannelLevelSchema = _enum([
7675
- "info",
7676
- "warn",
7677
- "error"
7678
- ]);
7679
- /**
7680
- * What an addon declares about one channel. No value, no state — a
7681
- * declaration is inert.
7682
- */
7683
- var LogChannelDescriptorSchema = object({
7684
- /**
7685
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7686
- * the addon's short name so an operator reading a channel list can tell who
7687
- * owns it without a second lookup.
7688
- */
7689
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7690
- /** One sentence: what the operator will SEE after arming it. */
7691
- description: string().min(1),
7692
- /** The level its lines are emitted at. Never below `info`. */
7693
- defaultLevel: LogChannelLevelSchema,
7694
- /**
7695
- * Whether this channel can be narrowed to a camera.
7696
- *
7697
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7698
- * consulted with the numeric device id, AND every line the channel admits
7699
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7700
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7701
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7702
- * the body is the only way to filter.
7703
- *
7704
- * A channel whose lines carry the device only in `meta` (or not at all) is
7705
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7706
- * the operator narrows to one camera, sees nothing, and concludes the code
7707
- * path was never taken.
7708
- */
7709
- perDevice: boolean()
7710
- });
7711
- /**
7712
- * An armed window over one channel, as the document hands it to a mirror.
7713
- *
7714
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7715
- * expires by itself, which is the one failure a boolean cannot avoid.
7716
- */
7717
- var LogChannelWindowSchema = object({
7718
- channel: string().min(1),
7719
- /** Epoch ms the window closes at. */
7720
- armedUntilMs: number(),
7721
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7722
- deviceIds: array(number().int()).readonly().nullable()
7723
- });
7724
- /**
7725
7633
  * Ops-log — the durable, append-only operations audit shared by the
7726
7634
  * recordings and events management surfaces.
7727
7635
  *
@@ -8643,6 +8551,21 @@ var StorageCleanupJobSchema = object({
8643
8551
  });
8644
8552
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8645
8553
  /**
8554
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8555
+ * alias below is `z.infer<>` of it, never a second spelling.
8556
+ */
8557
+ var StorageLocationModeSchema = _enum([
8558
+ "active",
8559
+ "readonly",
8560
+ "drain",
8561
+ "disabled"
8562
+ ]);
8563
+ _enum([
8564
+ "normal",
8565
+ "never",
8566
+ "drain"
8567
+ ]);
8568
+ /**
8646
8569
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8647
8570
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8648
8571
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8667,8 +8590,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8667
8590
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8668
8591
  *
8669
8592
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8670
- * The default location for a type uses `id === <type>:default` by
8671
- * convention (the bare type ref like `'backups'` resolves to it).
8593
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8594
+ * There is no default location any more (D383): `enabled` is the whole write
8595
+ * model, and a bare type ref resolves to the sole location of the type, or —
8596
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8597
+ * slug is `default`.
8672
8598
  *
8673
8599
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8674
8600
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8689,23 +8615,37 @@ var StorageLocationSchema = object({
8689
8615
  * flag at upsert time, not here (the schema is provider-agnostic).
8690
8616
  */
8691
8617
  nodeId: string().optional(),
8692
- isDefault: boolean().default(false),
8693
8618
  isSystem: boolean().default(false),
8694
8619
  /**
8695
- * Operator opt-in: whether consumers that BALANCE across several locations
8696
- * of a type may write here. Recordings reads it today; event media and
8697
- * backups are the next consumers, which is why the flag lives on the
8698
- * location rather than in any one addon's store — nothing has to be
8699
- * extended to add the next consumer.
8620
+ * THE write switch, and the only one (D383). `enabled: true` means every
8621
+ * consumer that chooses a write target for this type may write here, and all
8622
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8623
+ * still read, still played back, still age-swept, still drained, never
8624
+ * written.
8700
8625
  *
8701
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8702
- * flag existed reads back with no flag and keeps working exactly as before;
8703
- * that is the whole compat story, and it is why no migration ships with it.
8704
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8705
- * disk must not silently start writing to it); the default of a type is
8706
- * always stamped `true`.
8626
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8627
+ * stored" on an update and "born inert unless it is the first location of its
8628
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8629
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8630
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8631
+ * stops existing rather than being re-derived on every read.
8707
8632
  */
8708
8633
  enabled: boolean().optional(),
8634
+ /**
8635
+ * THE state of this location (D385), and the only authority on what may be
8636
+ * written, read or evicted here. Interpreted in exactly one place —
8637
+ * `storage-location-mode.ts` — which also folds the legacy
8638
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8639
+ * ambiguous.
8640
+ *
8641
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8642
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8643
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8644
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8645
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8646
+ * either, so the two cannot disagree.
8647
+ */
8648
+ mode: StorageLocationModeSchema.optional(),
8709
8649
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8710
8650
  * for node-local locations it can reach) — never persisted, absent when the
8711
8651
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8713,13 +8653,50 @@ var StorageLocationSchema = object({
8713
8653
  totalBytes: number(),
8714
8654
  availableBytes: number()
8715
8655
  }).nullable().optional(),
8656
+ /**
8657
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8658
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8659
+ * never persisted, never a filesystem walk.
8660
+ *
8661
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8662
+ * location yet — nobody stores here, the owning addon is down, or the first
8663
+ * refresh has not completed. A UI must omit the segment rather than draw it
8664
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8665
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8666
+ * be spelled out loud instead of appearing by accident.
8667
+ *
8668
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8669
+ * about the whole figure rather than about its freshest part.
8670
+ */
8671
+ owned: object({
8672
+ bytes: number().int().nonnegative(),
8673
+ measuredAtMs: number().int().nonnegative()
8674
+ }).optional(),
8716
8675
  createdAt: number(),
8717
8676
  updatedAt: number()
8718
8677
  });
8678
+ object({ isDefault: boolean().optional() });
8679
+ /**
8680
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8681
+ *
8682
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8683
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8684
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8685
+ * operator learns not to believe the screen.
8686
+ */
8687
+ var StorageDrainProgressSchema = object({
8688
+ locationId: string(),
8689
+ startedAtMs: number(),
8690
+ startBytes: number(),
8691
+ bytesRemaining: number(),
8692
+ drained: boolean(),
8693
+ estimatedEmptyAtMs: number().nullable()
8694
+ });
8719
8695
  /**
8720
8696
  * Reference accepted by consumer-facing `api.storage.*` calls.
8721
8697
  * Either:
8722
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8698
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8699
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8723
8700
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8724
8701
  *
8725
8702
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8895,6 +8872,111 @@ var DecoderSessionConfigSchema = object({
8895
8872
  */
8896
8873
  debug: boolean().optional()
8897
8874
  });
8875
+ /**
8876
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8877
+ * an addon declares its channels in.
8878
+ *
8879
+ * ## Two axes, deliberately separated
8880
+ *
8881
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8882
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8883
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8884
+ * and rots silently. So a channel is declared where it is consulted, and the
8885
+ * `log-channels` capability enumerates the declarations.
8886
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8887
+ * thing: the logging settings document on the `system` cap. Two authorities
8888
+ * over the values is the exact defect
8889
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8890
+ * remove; re-introducing it from the cure side would be grotesque.
8891
+ *
8892
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8893
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8894
+ * the hot path with a value somebody actually read, and by
8895
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8896
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8897
+ * disarmed one (D49).
8898
+ *
8899
+ * ## The canonical call shape
8900
+ *
8901
+ * ```ts
8902
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8903
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8904
+ * }
8905
+ * ```
8906
+ *
8907
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8908
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8909
+ * object literal is never constructed because it lives inside the branch. It
8910
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8911
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8912
+ * destination floor (measured at 1.93 ns/call when off).
8913
+ *
8914
+ * ## Why a channel emits at `info`
8915
+ *
8916
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8917
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8918
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8919
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8920
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8921
+ * emits at the channel's declared level, whose schema floor is `info`.
8922
+ */
8923
+ /**
8924
+ * The level a channel writes at once armed.
8925
+ *
8926
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8927
+ * not leave the process for Loki, and the whole point of arming a channel is
8928
+ * to read it later.
8929
+ */
8930
+ var LogChannelLevelSchema = _enum([
8931
+ "info",
8932
+ "warn",
8933
+ "error"
8934
+ ]);
8935
+ /**
8936
+ * What an addon declares about one channel. No value, no state — a
8937
+ * declaration is inert.
8938
+ */
8939
+ var LogChannelDescriptorSchema = object({
8940
+ /**
8941
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8942
+ * the addon's short name so an operator reading a channel list can tell who
8943
+ * owns it without a second lookup.
8944
+ */
8945
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8946
+ /** One sentence: what the operator will SEE after arming it. */
8947
+ description: string().min(1),
8948
+ /** The level its lines are emitted at. Never below `info`. */
8949
+ defaultLevel: LogChannelLevelSchema,
8950
+ /**
8951
+ * Whether this channel can be narrowed to a camera.
8952
+ *
8953
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
8954
+ * consulted with the numeric device id, AND every line the channel admits
8955
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
8956
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8957
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8958
+ * the body is the only way to filter.
8959
+ *
8960
+ * A channel whose lines carry the device only in `meta` (or not at all) is
8961
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8962
+ * the operator narrows to one camera, sees nothing, and concludes the code
8963
+ * path was never taken.
8964
+ */
8965
+ perDevice: boolean()
8966
+ });
8967
+ /**
8968
+ * An armed window over one channel, as the document hands it to a mirror.
8969
+ *
8970
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8971
+ * expires by itself, which is the one failure a boolean cannot avoid.
8972
+ */
8973
+ var LogChannelWindowSchema = object({
8974
+ channel: string().min(1),
8975
+ /** Epoch ms the window closes at. */
8976
+ armedUntilMs: number(),
8977
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8978
+ deviceIds: array(number().int()).readonly().nullable()
8979
+ });
8898
8980
  var MODEL_FORMATS = [
8899
8981
  "onnx",
8900
8982
  "coreml",
@@ -21927,7 +22009,7 @@ method(object({
21927
22009
  downloadId: string(),
21928
22010
  offset: number(),
21929
22011
  length: number()
21930
- }), _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({
22012
+ }), _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({
21931
22013
  createdAt: true,
21932
22014
  updatedAt: true
21933
22015
  }), StorageLocationSchema, {
@@ -21939,7 +22021,7 @@ method(object({
21939
22021
  }), _void(), {
21940
22022
  kind: "mutation",
21941
22023
  auth: "admin"
21942
- }), method(object({ id: string() }), object({
22024
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
21943
22025
  ok: boolean(),
21944
22026
  error: string().optional()
21945
22027
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22009,6 +22091,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22009
22091
  kind: "mutation",
22010
22092
  auth: "admin"
22011
22093
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22094
+ /**
22095
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22096
+ * location (D388).
22097
+ *
22098
+ * ## Why this is not `storage-evictable`
22099
+ *
22100
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22101
+ * not, in two ways that both matter and both bite hardest on the locations an
22102
+ * operator most wants a figure for:
22103
+ *
22104
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22105
+ * and `recordingsLow:default` deliberately share one root and evict as one
22106
+ * oldest-first pool, so both answer with the SAME combined total. As an
22107
+ * occupancy figure that double-counts the disk.
22108
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22109
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22110
+ * is retiring and staring at.
22111
+ *
22112
+ * So this is its own contract with its own quantity, and the quantity is
22113
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22114
+ * would ever be willing to delete it. A provider that can only answer
22115
+ * "evictable" must not register here — a number that silently means different
22116
+ * things per class is worse than no number.
22117
+ *
22118
+ * ## Absence is an answer
22119
+ *
22120
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22121
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22122
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22123
+ * consuming side has to be written out loud instead of appearing by accident.
22124
+ *
22125
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22126
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22127
+ */
22128
+ /** One provider's occupancy answer for one location. */
22129
+ var StorageOccupancyReportSchema = object({
22130
+ locationId: string(),
22131
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22132
+ * not net of what it is willing to delete. */
22133
+ ownedBytes: number().int().nonnegative(),
22134
+ /** When the provider last actually measured this. The orchestrator carries it
22135
+ * through so a UI can say how old the figure is instead of implying "now". */
22136
+ measuredAtMs: number().int().nonnegative()
22137
+ });
22138
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22012
22139
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22013
22140
  providerId: string().min(1),
22014
22141
  displayName: string().min(1),
@@ -23844,88 +23971,6 @@ onStatusChanged: { data: object({
23844
23971
  volatileStateFields: ["lastUpdated"]
23845
23972
  };
23846
23973
  /**
23847
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23848
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23849
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23850
- * one Home Assistant projection.
23851
- */
23852
- var NetworkLinkStatusSchema = object({
23853
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23854
- type: _enum([
23855
- "wifi",
23856
- "ethernet",
23857
- "cellular",
23858
- "unknown"
23859
- ]),
23860
- /**
23861
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
23862
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
23863
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
23864
- * one whose reading has not landed must not be drawn at 0 %. Consumers
23865
- * SKIP a null rather than coerce it.
23866
- */
23867
- signalPercent: number().min(0).max(100).nullable(),
23868
- /** Raw received signal strength in dBm, when the firmware reports one. */
23869
- rssiDbm: number().optional(),
23870
- /** Network name of a wireless link, when the firmware reports it. */
23871
- ssid: string().optional(),
23872
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
23873
- lastUpdated: number()
23874
- });
23875
- var networkLinkCapability = {
23876
- name: "network-link",
23877
- scope: "device",
23878
- deviceNative: true,
23879
- mode: "singleton",
23880
- deviceTypes: [
23881
- DeviceType.Camera,
23882
- DeviceType.Sensor,
23883
- DeviceType.Button,
23884
- DeviceType.Switch,
23885
- DeviceType.Light,
23886
- DeviceType.Lock,
23887
- DeviceType.Siren
23888
- ],
23889
- methods: {},
23890
- events: {
23891
- /**
23892
- * Emitted whenever the cached status changes (a link switch, a signal
23893
- * reading that moved). Mirrored on the parent chain by the
23894
- * DeviceEventPropagator like `battery.onStatusChanged`.
23895
- */
23896
- onStatusChanged: { data: object({
23897
- deviceId: number(),
23898
- status: NetworkLinkStatusSchema
23899
- }) } },
23900
- status: {
23901
- schema: NetworkLinkStatusSchema,
23902
- kind: "push",
23903
- empty: {
23904
- type: "unknown",
23905
- signalPercent: null,
23906
- lastUpdated: 0
23907
- }
23908
- },
23909
- /**
23910
- * Runtime-state slice — every provider stores the same shape under
23911
- * `device.runtimeState['network-link']`, read once by the badge and the
23912
- * Home Assistant projector regardless of the driver.
23913
- */
23914
- runtimeState: NetworkLinkStatusSchema,
23915
- /**
23916
- * Runtime-state durability: **restored** — a link reading is slow to
23917
- * change and a sleeping battery camera may not report for hours; the
23918
- * restored slice is what the badge shows until the next read.
23919
- *
23920
- * See `RuntimeStateDurability`. Enforced by
23921
- * `scripts/check-runtime-state-durability.ts`.
23922
- */
23923
- durability: "restored",
23924
- /** Clock fields: written, but excluded from the compare that decides
23925
- * whether persisting is worth a SQLite commit. */
23926
- volatileStateFields: ["lastUpdated"]
23927
- };
23928
- /**
23929
23974
  * Generic boolean sensor — last-resort fallback when no domain-
23930
23975
  * specific binary cap fits (Home Assistant `binary_sensor` without a
23931
23976
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27455,6 +27500,369 @@ var nativeObjectDetectionCapability = {
27455
27500
  volatileStateFields: ["lastFetchedAt"]
27456
27501
  };
27457
27502
  /**
27503
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27504
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27505
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27506
+ *
27507
+ * Why a NEW cap rather than overloading `ptz`:
27508
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27509
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27510
+ * The two are different physical models: PTZ is absolute-position + presets,
27511
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27512
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27513
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27514
+ * the reverse:
27515
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27516
+ * / `getOptions`), and
27517
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27518
+ * robot camera shows up in the existing PTZ control path without every
27519
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27520
+ * not here (see the addon design note):
27521
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27522
+ * ptz.stop() → navigation.stop()
27523
+ * ptz.goHome() → navigation.runAction('goHome')
27524
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27525
+ * ptz.goToPreset(id) → navigation.runAction(id)
27526
+ *
27527
+ * ## Continuous drive
27528
+ *
27529
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27530
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27531
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27532
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27533
+ * coalesce them. The UI owns the cadence.
27534
+ *
27535
+ * ## The action dictionary
27536
+ *
27537
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27538
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27539
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27540
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27541
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27542
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27543
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27544
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27545
+ *
27546
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27547
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27548
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27549
+ * every device handle. A future nodedreame publish adds a typed
27550
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27551
+ * provider can then swap the raw calls for the typed methods with no change to
27552
+ * THIS contract.
27553
+ */
27554
+ /**
27555
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27556
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27557
+ * halts it.
27558
+ *
27559
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27560
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27561
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27562
+ * vector by it (drivers without proportional drive ignore it).
27563
+ *
27564
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27565
+ * axis alone; an all-undefined nudge is a no-op.
27566
+ */
27567
+ var NavigationMoveCommandSchema = object({
27568
+ pan: number().min(-1).max(1).optional(),
27569
+ tilt: number().min(-1).max(1).optional(),
27570
+ speed: number().min(0).max(1).optional()
27571
+ });
27572
+ /**
27573
+ * The enumerated discrete actions a navigation-capable robot can perform via
27574
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27575
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27576
+ * `playSound` (see the `sound` dictionary entries).
27577
+ */
27578
+ var NavigationActionIdSchema = _enum([
27579
+ "goHome",
27580
+ "locate",
27581
+ "spotClean",
27582
+ "findPet",
27583
+ "personFollow",
27584
+ "stop",
27585
+ "startClean",
27586
+ "pauseClean",
27587
+ "dockWash",
27588
+ "autoEmpty",
27589
+ "flashOn",
27590
+ "flashOff"
27591
+ ]);
27592
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27593
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27594
+ /**
27595
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27596
+ * native panel and the PTZ mimic render as a button.
27597
+ *
27598
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27599
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27600
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27601
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27602
+ * - `label` — operator-facing English label.
27603
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27604
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27605
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27606
+ * flips it from config, never by editing code.
27607
+ */
27608
+ var NavigationActionEntrySchema = object({
27609
+ id: string(),
27610
+ kind: NavigationEntryKindSchema,
27611
+ label: string(),
27612
+ icon: string(),
27613
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27614
+ soundId: number().int().optional(),
27615
+ /** Per-device feature flag — render this entry only when true. */
27616
+ enabled: boolean()
27617
+ });
27618
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27619
+ var NavigationPointSchema = object({
27620
+ x: number(),
27621
+ y: number()
27622
+ });
27623
+ /**
27624
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27625
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27626
+ * that are turned on for THIS device. Data-driven: the provider derives these
27627
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27628
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27629
+ * that are not dictionary entries.
27630
+ *
27631
+ * - `move` / `stop` — the momentary drive joystick.
27632
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27633
+ * map-coordinate plumbing is wired.
27634
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27635
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27636
+ * - `light` — the on/off fill-light toggle (works anytime).
27637
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27638
+ * camera-service control; needs an active stream).
27639
+ */
27640
+ var NavigationFeaturesSchema = object({
27641
+ move: boolean(),
27642
+ stop: boolean(),
27643
+ goToPoint: boolean(),
27644
+ runAction: boolean(),
27645
+ playSound: boolean(),
27646
+ light: boolean(),
27647
+ lightMode: boolean()
27648
+ });
27649
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27650
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27651
+ /**
27652
+ * Live navigation state so the UI can reflect what the robot is doing:
27653
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27654
+ * - `following` — person/pet follow is currently armed.
27655
+ * - `flash` — the on-camera fill light is on.
27656
+ * - `lightMode` — auto vs manual fill-light mode.
27657
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27658
+ * `lightMode === 'manual'`.
27659
+ */
27660
+ var NavigationStatusSchema = object({
27661
+ mode: _enum([
27662
+ "idle",
27663
+ "cleaning",
27664
+ "spot",
27665
+ "following",
27666
+ "goto",
27667
+ "returning",
27668
+ "paused",
27669
+ "unknown"
27670
+ ]),
27671
+ following: boolean(),
27672
+ flash: boolean(),
27673
+ lightMode: NavigationLightModeSchema,
27674
+ lightLevel: number().min(40).max(100),
27675
+ /** Ms epoch when the slice was last updated. */
27676
+ lastChangedAt: number()
27677
+ });
27678
+ /**
27679
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27680
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27681
+ * convention.
27682
+ */
27683
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27684
+ var navigationCapability = {
27685
+ name: "navigation",
27686
+ scope: "device",
27687
+ deviceNative: true,
27688
+ mode: "singleton",
27689
+ deviceTypes: [DeviceType.Camera],
27690
+ deviceConfig: { ui: {
27691
+ kind: "widget",
27692
+ widgetId: "host/navigation-panel",
27693
+ tab: "navigation",
27694
+ topTab: true,
27695
+ label: "Navigation",
27696
+ order: 0
27697
+ } },
27698
+ methods: {
27699
+ /**
27700
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27701
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27702
+ * path) works for any authenticated user, not admin-only. The UI sends
27703
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27704
+ * a single drive write WITHOUT debouncing.
27705
+ */
27706
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27707
+ /** Halt all motion immediately (zero drive vector). */
27708
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27709
+ /** Send the robot to a point on its live map. */
27710
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27711
+ /**
27712
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27713
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27714
+ */
27715
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27716
+ /**
27717
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27718
+ * unsupported action ids are rejected by the provider.
27719
+ */
27720
+ runAction: method(object({
27721
+ deviceId: number(),
27722
+ actionId: NavigationActionIdSchema
27723
+ }), _void(), { kind: "mutation" }),
27724
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27725
+ playSound: method(object({
27726
+ deviceId: number(),
27727
+ soundId: number().int()
27728
+ }), _void(), { kind: "mutation" }),
27729
+ /**
27730
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27731
+ * works anytime, no active stream required).
27732
+ */
27733
+ setLightOn: method(object({
27734
+ deviceId: number(),
27735
+ on: boolean()
27736
+ }), _void(), { kind: "mutation" }),
27737
+ /**
27738
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27739
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27740
+ * action that generally needs an active camera stream/monitor session — the
27741
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27742
+ */
27743
+ setLightMode: method(object({
27744
+ deviceId: number(),
27745
+ mode: NavigationLightModeSchema,
27746
+ level: number().min(40).max(100).optional()
27747
+ }), _void(), { kind: "mutation" }),
27748
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27749
+ setLightLevel: method(object({
27750
+ deviceId: number(),
27751
+ level: number().min(40).max(100)
27752
+ }), _void(), { kind: "mutation" }),
27753
+ /**
27754
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27755
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27756
+ * `listActions`).
27757
+ */
27758
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27759
+ },
27760
+ events: { onStatusChanged: { data: object({
27761
+ deviceId: number(),
27762
+ status: NavigationStatusSchema
27763
+ }) } },
27764
+ status: {
27765
+ schema: NavigationStatusSchema,
27766
+ kind: "push"
27767
+ },
27768
+ /**
27769
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27770
+ * for live mode / follow / flash changes.
27771
+ */
27772
+ runtimeState: NavigationRuntimeStateSchema,
27773
+ /**
27774
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27775
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27776
+ * that. The live handle re-publishes on connect.
27777
+ *
27778
+ * See `RuntimeStateDurability`. Enforced by
27779
+ * `scripts/check-runtime-state-durability.ts`.
27780
+ */
27781
+ durability: "session"
27782
+ };
27783
+ /**
27784
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27785
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27786
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27787
+ * one Home Assistant projection.
27788
+ */
27789
+ var NetworkLinkStatusSchema = object({
27790
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27791
+ type: _enum([
27792
+ "wifi",
27793
+ "ethernet",
27794
+ "cellular",
27795
+ "unknown"
27796
+ ]),
27797
+ /**
27798
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27799
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27800
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27801
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27802
+ * SKIP a null rather than coerce it.
27803
+ */
27804
+ signalPercent: number().min(0).max(100).nullable(),
27805
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27806
+ rssiDbm: number().optional(),
27807
+ /** Network name of a wireless link, when the firmware reports it. */
27808
+ ssid: string().optional(),
27809
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27810
+ lastUpdated: number()
27811
+ });
27812
+ var networkLinkCapability = {
27813
+ name: "network-link",
27814
+ scope: "device",
27815
+ deviceNative: true,
27816
+ mode: "singleton",
27817
+ deviceTypes: [
27818
+ DeviceType.Camera,
27819
+ DeviceType.Sensor,
27820
+ DeviceType.Button,
27821
+ DeviceType.Switch,
27822
+ DeviceType.Light,
27823
+ DeviceType.Lock,
27824
+ DeviceType.Siren
27825
+ ],
27826
+ methods: {},
27827
+ events: {
27828
+ /**
27829
+ * Emitted whenever the cached status changes (a link switch, a signal
27830
+ * reading that moved). Mirrored on the parent chain by the
27831
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27832
+ */
27833
+ onStatusChanged: { data: object({
27834
+ deviceId: number(),
27835
+ status: NetworkLinkStatusSchema
27836
+ }) } },
27837
+ status: {
27838
+ schema: NetworkLinkStatusSchema,
27839
+ kind: "push",
27840
+ empty: {
27841
+ type: "unknown",
27842
+ signalPercent: null,
27843
+ lastUpdated: 0
27844
+ }
27845
+ },
27846
+ /**
27847
+ * Runtime-state slice — every provider stores the same shape under
27848
+ * `device.runtimeState['network-link']`, read once by the badge and the
27849
+ * Home Assistant projector regardless of the driver.
27850
+ */
27851
+ runtimeState: NetworkLinkStatusSchema,
27852
+ /**
27853
+ * Runtime-state durability: **restored** — a link reading is slow to
27854
+ * change and a sleeping battery camera may not report for hours; the
27855
+ * restored slice is what the badge shows until the next read.
27856
+ *
27857
+ * See `RuntimeStateDurability`. Enforced by
27858
+ * `scripts/check-runtime-state-durability.ts`.
27859
+ */
27860
+ durability: "restored",
27861
+ /** Clock fields: written, but excluded from the compare that decides
27862
+ * whether persisting is worth a SQLite commit. */
27863
+ volatileStateFields: ["lastUpdated"]
27864
+ };
27865
+ /**
27458
27866
  * network-quality — system-scoped singleton capability tracking RTT,
27459
27867
  * jitter, and observed/peak bandwidth per device + per client.
27460
27868
  *
@@ -29035,287 +29443,6 @@ var ptzAutotrackCapability = {
29035
29443
  */
29036
29444
  durability: "session"
29037
29445
  };
29038
- /**
29039
- * `navigation` — a device-scoped capability that natively expresses the FULL
29040
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29041
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29042
- *
29043
- * Why a NEW cap rather than overloading `ptz`:
29044
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29045
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29046
- * The two are different physical models: PTZ is absolute-position + presets,
29047
- * navigation is momentary drive nudges + discrete robot ACTIONS
29048
- * (dock / spot-clean / follow-pet / go-to-point / …).
29049
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29050
- * the reverse:
29051
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29052
- * / `getOptions`), and
29053
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29054
- * robot camera shows up in the existing PTZ control path without every
29055
- * PTZ provider learning about robots. The mapping lives in the adapter,
29056
- * not here (see the addon design note):
29057
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29058
- * ptz.stop() → navigation.stop()
29059
- * ptz.goHome() → navigation.runAction('goHome')
29060
- * ptz.getPresets() → navigation.listActions() (id→preset)
29061
- * ptz.goToPreset(id) → navigation.runAction(id)
29062
- *
29063
- * ## Continuous drive
29064
- *
29065
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29066
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29067
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29068
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29069
- * coalesce them. The UI owns the cadence.
29070
- *
29071
- * ## The action dictionary
29072
- *
29073
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29074
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29075
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29076
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29077
- * vendor-specific list. `kind: 'action'` entries are triggered with
29078
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29079
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29080
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29081
- *
29082
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29083
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29084
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29085
- * every device handle. A future nodedreame publish adds a typed
29086
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29087
- * provider can then swap the raw calls for the typed methods with no change to
29088
- * THIS contract.
29089
- */
29090
- /**
29091
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29092
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29093
- * halts it.
29094
- *
29095
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29096
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29097
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29098
- * vector by it (drivers without proportional drive ignore it).
29099
- *
29100
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29101
- * axis alone; an all-undefined nudge is a no-op.
29102
- */
29103
- var NavigationMoveCommandSchema = object({
29104
- pan: number().min(-1).max(1).optional(),
29105
- tilt: number().min(-1).max(1).optional(),
29106
- speed: number().min(0).max(1).optional()
29107
- });
29108
- /**
29109
- * The enumerated discrete actions a navigation-capable robot can perform via
29110
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29111
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29112
- * `playSound` (see the `sound` dictionary entries).
29113
- */
29114
- var NavigationActionIdSchema = _enum([
29115
- "goHome",
29116
- "locate",
29117
- "spotClean",
29118
- "findPet",
29119
- "personFollow",
29120
- "stop",
29121
- "startClean",
29122
- "pauseClean",
29123
- "dockWash",
29124
- "autoEmpty",
29125
- "flashOn",
29126
- "flashOff"
29127
- ]);
29128
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29129
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29130
- /**
29131
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29132
- * native panel and the PTZ mimic render as a button.
29133
- *
29134
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29135
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29136
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29137
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29138
- * - `label` — operator-facing English label.
29139
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29140
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29141
- * PTZ render ONLY enabled entries. Data-driven: the provider
29142
- * flips it from config, never by editing code.
29143
- */
29144
- var NavigationActionEntrySchema = object({
29145
- id: string(),
29146
- kind: NavigationEntryKindSchema,
29147
- label: string(),
29148
- icon: string(),
29149
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29150
- soundId: number().int().optional(),
29151
- /** Per-device feature flag — render this entry only when true. */
29152
- enabled: boolean()
29153
- });
29154
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29155
- var NavigationPointSchema = object({
29156
- x: number(),
29157
- y: number()
29158
- });
29159
- /**
29160
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29161
- * The cap reports which are enabled so the UI / PTZ render only the controls
29162
- * that are turned on for THIS device. Data-driven: the provider derives these
29163
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29164
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29165
- * that are not dictionary entries.
29166
- *
29167
- * - `move` / `stop` — the momentary drive joystick.
29168
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29169
- * map-coordinate plumbing is wired.
29170
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29171
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29172
- * - `light` — the on/off fill-light toggle (works anytime).
29173
- * - `lightMode` — the auto/manual selector + manual level slider (a
29174
- * camera-service control; needs an active stream).
29175
- */
29176
- var NavigationFeaturesSchema = object({
29177
- move: boolean(),
29178
- stop: boolean(),
29179
- goToPoint: boolean(),
29180
- runAction: boolean(),
29181
- playSound: boolean(),
29182
- light: boolean(),
29183
- lightMode: boolean()
29184
- });
29185
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29186
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29187
- /**
29188
- * Live navigation state so the UI can reflect what the robot is doing:
29189
- * - `mode` — coarse activity (idle / cleaning / following / …).
29190
- * - `following` — person/pet follow is currently armed.
29191
- * - `flash` — the on-camera fill light is on.
29192
- * - `lightMode` — auto vs manual fill-light mode.
29193
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29194
- * `lightMode === 'manual'`.
29195
- */
29196
- var NavigationStatusSchema = object({
29197
- mode: _enum([
29198
- "idle",
29199
- "cleaning",
29200
- "spot",
29201
- "following",
29202
- "goto",
29203
- "returning",
29204
- "paused",
29205
- "unknown"
29206
- ]),
29207
- following: boolean(),
29208
- flash: boolean(),
29209
- lightMode: NavigationLightModeSchema,
29210
- lightLevel: number().min(40).max(100),
29211
- /** Ms epoch when the slice was last updated. */
29212
- lastChangedAt: number()
29213
- });
29214
- /**
29215
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29216
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29217
- * convention.
29218
- */
29219
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29220
- var navigationCapability = {
29221
- name: "navigation",
29222
- scope: "device",
29223
- deviceNative: true,
29224
- mode: "singleton",
29225
- deviceTypes: [DeviceType.Camera],
29226
- deviceConfig: { ui: {
29227
- kind: "widget",
29228
- widgetId: "host/navigation-panel",
29229
- tab: "navigation",
29230
- topTab: true,
29231
- label: "Navigation",
29232
- order: 0
29233
- } },
29234
- methods: {
29235
- /**
29236
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29237
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29238
- * path) works for any authenticated user, not admin-only. The UI sends
29239
- * these at ~1 Hz while a control is held; the provider forwards each one to
29240
- * a single drive write WITHOUT debouncing.
29241
- */
29242
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29243
- /** Halt all motion immediately (zero drive vector). */
29244
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29245
- /** Send the robot to a point on its live map. */
29246
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29247
- /**
29248
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29249
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29250
- */
29251
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29252
- /**
29253
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29254
- * unsupported action ids are rejected by the provider.
29255
- */
29256
- runAction: method(object({
29257
- deviceId: number(),
29258
- actionId: NavigationActionIdSchema
29259
- }), _void(), { kind: "mutation" }),
29260
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29261
- playSound: method(object({
29262
- deviceId: number(),
29263
- soundId: number().int()
29264
- }), _void(), { kind: "mutation" }),
29265
- /**
29266
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29267
- * works anytime, no active stream required).
29268
- */
29269
- setLightOn: method(object({
29270
- deviceId: number(),
29271
- on: boolean()
29272
- }), _void(), { kind: "mutation" }),
29273
- /**
29274
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29275
- * initial `level`. The auto/manual + level control is a CAMERA-service
29276
- * action that generally needs an active camera stream/monitor session — the
29277
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29278
- */
29279
- setLightMode: method(object({
29280
- deviceId: number(),
29281
- mode: NavigationLightModeSchema,
29282
- level: number().min(40).max(100).optional()
29283
- }), _void(), { kind: "mutation" }),
29284
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29285
- setLightLevel: method(object({
29286
- deviceId: number(),
29287
- level: number().min(40).max(100)
29288
- }), _void(), { kind: "mutation" }),
29289
- /**
29290
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29291
- * controls the UI shows (the per-entry flags for the dictionary come back on
29292
- * `listActions`).
29293
- */
29294
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29295
- },
29296
- events: { onStatusChanged: { data: object({
29297
- deviceId: number(),
29298
- status: NavigationStatusSchema
29299
- }) } },
29300
- status: {
29301
- schema: NavigationStatusSchema,
29302
- kind: "push"
29303
- },
29304
- /**
29305
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29306
- * for live mode / follow / flash changes.
29307
- */
29308
- runtimeState: NavigationRuntimeStateSchema,
29309
- /**
29310
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29311
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29312
- * that. The live handle re-publishes on connect.
29313
- *
29314
- * See `RuntimeStateDurability`. Enforced by
29315
- * `scripts/check-runtime-state-durability.ts`.
29316
- */
29317
- durability: "session"
29318
- };
29319
29446
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29320
29447
  kind: "mutation",
29321
29448
  auth: "admin"
@@ -38772,13 +38899,13 @@ Object.freeze({
38772
38899
  addonId: null,
38773
38900
  access: "view"
38774
38901
  },
38775
- "storage.getDefaultLocation": {
38902
+ "storage.list": {
38776
38903
  capName: "storage",
38777
38904
  capScope: "system",
38778
38905
  addonId: null,
38779
38906
  access: "view"
38780
38907
  },
38781
- "storage.list": {
38908
+ "storage.listDrainProgress": {
38782
38909
  capName: "storage",
38783
38910
  capScope: "system",
38784
38911
  addonId: null,
@@ -38928,6 +39055,12 @@ Object.freeze({
38928
39055
  addonId: null,
38929
39056
  access: "view"
38930
39057
  },
39058
+ "storageOccupancy.getOccupancy": {
39059
+ capName: "storage-occupancy",
39060
+ capScope: "system",
39061
+ addonId: null,
39062
+ access: "view"
39063
+ },
38931
39064
  "storageProvider.abortUpload": {
38932
39065
  capName: "storage-provider",
38933
39066
  capScope: "system",