@camstack/addon-terminal 0.1.83 → 0.1.85

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
@@ -8,7 +8,7 @@ import { createServer } from "node:http";
8
8
  //#region \0rolldown/runtime.js
9
9
  var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
10
  //#endregion
11
- //#region ../types/dist/event-category-zAv7pMUz.mjs
11
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
12
12
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
13
13
  EventCategory["SystemBoot"] = "system.boot";
14
14
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -203,6 +203,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
203
203
  EventCategory["ProcessCrashed"] = "process.crashed";
204
204
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
205
205
  EventCategory["ProcessRestarted"] = "process.restarted";
206
+ /**
207
+ * The SET of storage locations changed — one was created, edited, enabled,
208
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
209
+ *
210
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
211
+ * it must also converge on its own periodic path, because a dropped event
212
+ * must not leave a node writing to yesterday's disk set forever. It exists
213
+ * because there was NO signal at all — an operator who added a second
214
+ * recordings disk in the admin UI got nothing, and the recorder kept its
215
+ * resolved locations until something else happened to re-resolve them
216
+ * (D387). Payload `StorageLocationsChangedPayload`.
217
+ */
218
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
206
219
  EventCategory["RecordingStarted"] = "recording.started";
207
220
  EventCategory["RecordingStopped"] = "recording.stopped";
208
221
  EventCategory["RecordingError"] = "recording.error";
@@ -7691,111 +7704,6 @@ var CameraSwitchGroupSchema = object({
7691
7704
  var DETECTION_PIPELINE_CAP_NAME = "detection-pipeline";
7692
7705
  var AUDIO_ANALYSIS_CAP_NAME = "audio-analysis";
7693
7706
  /**
7694
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7695
- * an addon declares its channels in.
7696
- *
7697
- * ## Two axes, deliberately separated
7698
- *
7699
- * - **DECLARATION** — which channels exist. Only the addon knows:
7700
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7701
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7702
- * and rots silently. So a channel is declared where it is consulted, and the
7703
- * `log-channels` capability enumerates the declarations.
7704
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7705
- * thing: the logging settings document on the `system` cap. Two authorities
7706
- * over the values is the exact defect
7707
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7708
- * remove; re-introducing it from the cure side would be grotesque.
7709
- *
7710
- * Nothing in this file reads a clock, an env var or a store. The registry is
7711
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7712
- * the hot path with a value somebody actually read, and by
7713
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7714
- * never reaches here, so it can neither disarm an armed channel nor arm a
7715
- * disarmed one (D49).
7716
- *
7717
- * ## The canonical call shape
7718
- *
7719
- * ```ts
7720
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7721
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7722
- * }
7723
- * ```
7724
- *
7725
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7726
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7727
- * object literal is never constructed because it lives inside the branch. It
7728
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7729
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7730
- * destination floor (measured at 1.93 ns/call when off).
7731
- *
7732
- * ## Why a channel emits at `info`
7733
- *
7734
- * `loki-logging.addon.ts` pins the destination default at `info` and
7735
- * `loki-destination.ts` drops everything below it, so a line emitted at
7736
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7737
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7738
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7739
- * emits at the channel's declared level, whose schema floor is `info`.
7740
- */
7741
- /**
7742
- * The level a channel writes at once armed.
7743
- *
7744
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7745
- * not leave the process for Loki, and the whole point of arming a channel is
7746
- * to read it later.
7747
- */
7748
- var LogChannelLevelSchema = _enum([
7749
- "info",
7750
- "warn",
7751
- "error"
7752
- ]);
7753
- /**
7754
- * What an addon declares about one channel. No value, no state — a
7755
- * declaration is inert.
7756
- */
7757
- var LogChannelDescriptorSchema = object({
7758
- /**
7759
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7760
- * the addon's short name so an operator reading a channel list can tell who
7761
- * owns it without a second lookup.
7762
- */
7763
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7764
- /** One sentence: what the operator will SEE after arming it. */
7765
- description: string().min(1),
7766
- /** The level its lines are emitted at. Never below `info`. */
7767
- defaultLevel: LogChannelLevelSchema,
7768
- /**
7769
- * Whether this channel can be narrowed to a camera.
7770
- *
7771
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7772
- * consulted with the numeric device id, AND every line the channel admits
7773
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7774
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7775
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7776
- * the body is the only way to filter.
7777
- *
7778
- * A channel whose lines carry the device only in `meta` (or not at all) is
7779
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7780
- * the operator narrows to one camera, sees nothing, and concludes the code
7781
- * path was never taken.
7782
- */
7783
- perDevice: boolean()
7784
- });
7785
- /**
7786
- * An armed window over one channel, as the document hands it to a mirror.
7787
- *
7788
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7789
- * expires by itself, which is the one failure a boolean cannot avoid.
7790
- */
7791
- var LogChannelWindowSchema = object({
7792
- channel: string().min(1),
7793
- /** Epoch ms the window closes at. */
7794
- armedUntilMs: number(),
7795
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7796
- deviceIds: array(number().int()).readonly().nullable()
7797
- });
7798
- /**
7799
7707
  * Ops-log — the durable, append-only operations audit shared by the
7800
7708
  * recordings and events management surfaces.
7801
7709
  *
@@ -8717,6 +8625,21 @@ var StorageCleanupJobSchema = object({
8717
8625
  });
8718
8626
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8719
8627
  /**
8628
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8629
+ * alias below is `z.infer<>` of it, never a second spelling.
8630
+ */
8631
+ var StorageLocationModeSchema = _enum([
8632
+ "active",
8633
+ "readonly",
8634
+ "drain",
8635
+ "disabled"
8636
+ ]);
8637
+ _enum([
8638
+ "normal",
8639
+ "never",
8640
+ "drain"
8641
+ ]);
8642
+ /**
8720
8643
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8721
8644
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8722
8645
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8741,8 +8664,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8741
8664
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8742
8665
  *
8743
8666
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8744
- * The default location for a type uses `id === <type>:default` by
8745
- * convention (the bare type ref like `'backups'` resolves to it).
8667
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8668
+ * There is no default location any more (D383): `enabled` is the whole write
8669
+ * model, and a bare type ref resolves to the sole location of the type, or —
8670
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8671
+ * slug is `default`.
8746
8672
  *
8747
8673
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8748
8674
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8763,23 +8689,37 @@ var StorageLocationSchema = object({
8763
8689
  * flag at upsert time, not here (the schema is provider-agnostic).
8764
8690
  */
8765
8691
  nodeId: string().optional(),
8766
- isDefault: boolean().default(false),
8767
8692
  isSystem: boolean().default(false),
8768
8693
  /**
8769
- * Operator opt-in: whether consumers that BALANCE across several locations
8770
- * of a type may write here. Recordings reads it today; event media and
8771
- * backups are the next consumers, which is why the flag lives on the
8772
- * location rather than in any one addon's store nothing has to be
8773
- * extended to add the next consumer.
8694
+ * THE write switch, and the only one (D383). `enabled: true` means every
8695
+ * consumer that chooses a write target for this type may write here, and all
8696
+ * enabled locations of a type are used TOGETHER; `false` means read-only
8697
+ * still read, still played back, still age-swept, still drained, never
8698
+ * written.
8774
8699
  *
8775
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8776
- * flag existed reads back with no flag and keeps working exactly as before;
8777
- * that is the whole compat story, and it is why no migration ships with it.
8778
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8779
- * disk must not silently start writing to it); the default of a type is
8780
- * always stamped `true`.
8700
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8701
+ * stored" on an update and "born inert unless it is the first location of its
8702
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8703
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
8704
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8705
+ * stops existing rather than being re-derived on every read.
8781
8706
  */
8782
8707
  enabled: boolean().optional(),
8708
+ /**
8709
+ * THE state of this location (D385), and the only authority on what may be
8710
+ * written, read or evicted here. Interpreted in exactly one place —
8711
+ * `storage-location-mode.ts` — which also folds the legacy
8712
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8713
+ * ambiguous.
8714
+ *
8715
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8716
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8717
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8718
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8719
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8720
+ * either, so the two cannot disagree.
8721
+ */
8722
+ mode: StorageLocationModeSchema.optional(),
8783
8723
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8784
8724
  * for node-local locations it can reach) — never persisted, absent when the
8785
8725
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8787,13 +8727,50 @@ var StorageLocationSchema = object({
8787
8727
  totalBytes: number(),
8788
8728
  availableBytes: number()
8789
8729
  }).nullable().optional(),
8730
+ /**
8731
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8732
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8733
+ * never persisted, never a filesystem walk.
8734
+ *
8735
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8736
+ * location yet — nobody stores here, the owning addon is down, or the first
8737
+ * refresh has not completed. A UI must omit the segment rather than draw it
8738
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8739
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8740
+ * be spelled out loud instead of appearing by accident.
8741
+ *
8742
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8743
+ * about the whole figure rather than about its freshest part.
8744
+ */
8745
+ owned: object({
8746
+ bytes: number().int().nonnegative(),
8747
+ measuredAtMs: number().int().nonnegative()
8748
+ }).optional(),
8790
8749
  createdAt: number(),
8791
8750
  updatedAt: number()
8792
8751
  });
8752
+ object({ isDefault: boolean().optional() });
8753
+ /**
8754
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8755
+ *
8756
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8757
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8758
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8759
+ * operator learns not to believe the screen.
8760
+ */
8761
+ var StorageDrainProgressSchema = object({
8762
+ locationId: string(),
8763
+ startedAtMs: number(),
8764
+ startBytes: number(),
8765
+ bytesRemaining: number(),
8766
+ drained: boolean(),
8767
+ estimatedEmptyAtMs: number().nullable()
8768
+ });
8793
8769
  /**
8794
8770
  * Reference accepted by consumer-facing `api.storage.*` calls.
8795
8771
  * Either:
8796
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8772
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8773
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8797
8774
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8798
8775
  *
8799
8776
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8969,6 +8946,111 @@ var DecoderSessionConfigSchema = object({
8969
8946
  */
8970
8947
  debug: boolean().optional()
8971
8948
  });
8949
+ /**
8950
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8951
+ * an addon declares its channels in.
8952
+ *
8953
+ * ## Two axes, deliberately separated
8954
+ *
8955
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8956
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8957
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8958
+ * and rots silently. So a channel is declared where it is consulted, and the
8959
+ * `log-channels` capability enumerates the declarations.
8960
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8961
+ * thing: the logging settings document on the `system` cap. Two authorities
8962
+ * over the values is the exact defect
8963
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8964
+ * remove; re-introducing it from the cure side would be grotesque.
8965
+ *
8966
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8967
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8968
+ * the hot path with a value somebody actually read, and by
8969
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8970
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8971
+ * disarmed one (D49).
8972
+ *
8973
+ * ## The canonical call shape
8974
+ *
8975
+ * ```ts
8976
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8977
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8978
+ * }
8979
+ * ```
8980
+ *
8981
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8982
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
8983
+ * object literal is never constructed because it lives inside the branch. It
8984
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
8985
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
8986
+ * destination floor (measured at 1.93 ns/call when off).
8987
+ *
8988
+ * ## Why a channel emits at `info`
8989
+ *
8990
+ * `loki-logging.addon.ts` pins the destination default at `info` and
8991
+ * `loki-destination.ts` drops everything below it, so a line emitted at
8992
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8993
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
8994
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8995
+ * emits at the channel's declared level, whose schema floor is `info`.
8996
+ */
8997
+ /**
8998
+ * The level a channel writes at once armed.
8999
+ *
9000
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9001
+ * not leave the process for Loki, and the whole point of arming a channel is
9002
+ * to read it later.
9003
+ */
9004
+ var LogChannelLevelSchema = _enum([
9005
+ "info",
9006
+ "warn",
9007
+ "error"
9008
+ ]);
9009
+ /**
9010
+ * What an addon declares about one channel. No value, no state — a
9011
+ * declaration is inert.
9012
+ */
9013
+ var LogChannelDescriptorSchema = object({
9014
+ /**
9015
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9016
+ * the addon's short name so an operator reading a channel list can tell who
9017
+ * owns it without a second lookup.
9018
+ */
9019
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9020
+ /** One sentence: what the operator will SEE after arming it. */
9021
+ description: string().min(1),
9022
+ /** The level its lines are emitted at. Never below `info`. */
9023
+ defaultLevel: LogChannelLevelSchema,
9024
+ /**
9025
+ * Whether this channel can be narrowed to a camera.
9026
+ *
9027
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9028
+ * consulted with the numeric device id, AND every line the channel admits
9029
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9030
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9031
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9032
+ * the body is the only way to filter.
9033
+ *
9034
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9035
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9036
+ * the operator narrows to one camera, sees nothing, and concludes the code
9037
+ * path was never taken.
9038
+ */
9039
+ perDevice: boolean()
9040
+ });
9041
+ /**
9042
+ * An armed window over one channel, as the document hands it to a mirror.
9043
+ *
9044
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9045
+ * expires by itself, which is the one failure a boolean cannot avoid.
9046
+ */
9047
+ var LogChannelWindowSchema = object({
9048
+ channel: string().min(1),
9049
+ /** Epoch ms the window closes at. */
9050
+ armedUntilMs: number(),
9051
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9052
+ deviceIds: array(number().int()).readonly().nullable()
9053
+ });
8972
9054
  var MODEL_FORMATS = [
8973
9055
  "onnx",
8974
9056
  "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),
@@ -23985,88 +24112,6 @@ onStatusChanged: { data: object({
23985
24112
  volatileStateFields: ["lastUpdated"]
23986
24113
  };
23987
24114
  /**
23988
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
23989
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
23990
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
23991
- * one Home Assistant projection.
23992
- */
23993
- var NetworkLinkStatusSchema = object({
23994
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
23995
- type: _enum([
23996
- "wifi",
23997
- "ethernet",
23998
- "cellular",
23999
- "unknown"
24000
- ]),
24001
- /**
24002
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24003
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24004
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24005
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24006
- * SKIP a null rather than coerce it.
24007
- */
24008
- signalPercent: number().min(0).max(100).nullable(),
24009
- /** Raw received signal strength in dBm, when the firmware reports one. */
24010
- rssiDbm: number().optional(),
24011
- /** Network name of a wireless link, when the firmware reports it. */
24012
- ssid: string().optional(),
24013
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24014
- lastUpdated: number()
24015
- });
24016
- var networkLinkCapability = {
24017
- name: "network-link",
24018
- scope: "device",
24019
- deviceNative: true,
24020
- mode: "singleton",
24021
- deviceTypes: [
24022
- DeviceType.Camera,
24023
- DeviceType.Sensor,
24024
- DeviceType.Button,
24025
- DeviceType.Switch,
24026
- DeviceType.Light,
24027
- DeviceType.Lock,
24028
- DeviceType.Siren
24029
- ],
24030
- methods: {},
24031
- events: {
24032
- /**
24033
- * Emitted whenever the cached status changes (a link switch, a signal
24034
- * reading that moved). Mirrored on the parent chain by the
24035
- * DeviceEventPropagator like `battery.onStatusChanged`.
24036
- */
24037
- onStatusChanged: { data: object({
24038
- deviceId: number(),
24039
- status: NetworkLinkStatusSchema
24040
- }) } },
24041
- status: {
24042
- schema: NetworkLinkStatusSchema,
24043
- kind: "push",
24044
- empty: {
24045
- type: "unknown",
24046
- signalPercent: null,
24047
- lastUpdated: 0
24048
- }
24049
- },
24050
- /**
24051
- * Runtime-state slice — every provider stores the same shape under
24052
- * `device.runtimeState['network-link']`, read once by the badge and the
24053
- * Home Assistant projector regardless of the driver.
24054
- */
24055
- runtimeState: NetworkLinkStatusSchema,
24056
- /**
24057
- * Runtime-state durability: **restored** — a link reading is slow to
24058
- * change and a sleeping battery camera may not report for hours; the
24059
- * restored slice is what the badge shows until the next read.
24060
- *
24061
- * See `RuntimeStateDurability`. Enforced by
24062
- * `scripts/check-runtime-state-durability.ts`.
24063
- */
24064
- durability: "restored",
24065
- /** Clock fields: written, but excluded from the compare that decides
24066
- * whether persisting is worth a SQLite commit. */
24067
- volatileStateFields: ["lastUpdated"]
24068
- };
24069
- /**
24070
24115
  * Generic boolean sensor — last-resort fallback when no domain-
24071
24116
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24072
24117
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27596,6 +27641,369 @@ var nativeObjectDetectionCapability = {
27596
27641
  volatileStateFields: ["lastFetchedAt"]
27597
27642
  };
27598
27643
  /**
27644
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27645
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27646
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27647
+ *
27648
+ * Why a NEW cap rather than overloading `ptz`:
27649
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27650
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27651
+ * The two are different physical models: PTZ is absolute-position + presets,
27652
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27653
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27654
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27655
+ * the reverse:
27656
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27657
+ * / `getOptions`), and
27658
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27659
+ * robot camera shows up in the existing PTZ control path without every
27660
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27661
+ * not here (see the addon design note):
27662
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27663
+ * ptz.stop() → navigation.stop()
27664
+ * ptz.goHome() → navigation.runAction('goHome')
27665
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27666
+ * ptz.goToPreset(id) → navigation.runAction(id)
27667
+ *
27668
+ * ## Continuous drive
27669
+ *
27670
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27671
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27672
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27673
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27674
+ * coalesce them. The UI owns the cadence.
27675
+ *
27676
+ * ## The action dictionary
27677
+ *
27678
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27679
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27680
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27681
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27682
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27683
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27684
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27685
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27686
+ *
27687
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27688
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27689
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27690
+ * every device handle. A future nodedreame publish adds a typed
27691
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27692
+ * provider can then swap the raw calls for the typed methods with no change to
27693
+ * THIS contract.
27694
+ */
27695
+ /**
27696
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27697
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27698
+ * halts it.
27699
+ *
27700
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27701
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27702
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27703
+ * vector by it (drivers without proportional drive ignore it).
27704
+ *
27705
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27706
+ * axis alone; an all-undefined nudge is a no-op.
27707
+ */
27708
+ var NavigationMoveCommandSchema = object({
27709
+ pan: number().min(-1).max(1).optional(),
27710
+ tilt: number().min(-1).max(1).optional(),
27711
+ speed: number().min(0).max(1).optional()
27712
+ });
27713
+ /**
27714
+ * The enumerated discrete actions a navigation-capable robot can perform via
27715
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27716
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27717
+ * `playSound` (see the `sound` dictionary entries).
27718
+ */
27719
+ var NavigationActionIdSchema = _enum([
27720
+ "goHome",
27721
+ "locate",
27722
+ "spotClean",
27723
+ "findPet",
27724
+ "personFollow",
27725
+ "stop",
27726
+ "startClean",
27727
+ "pauseClean",
27728
+ "dockWash",
27729
+ "autoEmpty",
27730
+ "flashOn",
27731
+ "flashOff"
27732
+ ]);
27733
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27734
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27735
+ /**
27736
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27737
+ * native panel and the PTZ mimic render as a button.
27738
+ *
27739
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27740
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27741
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27742
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27743
+ * - `label` — operator-facing English label.
27744
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27745
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27746
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27747
+ * flips it from config, never by editing code.
27748
+ */
27749
+ var NavigationActionEntrySchema = object({
27750
+ id: string(),
27751
+ kind: NavigationEntryKindSchema,
27752
+ label: string(),
27753
+ icon: string(),
27754
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27755
+ soundId: number().int().optional(),
27756
+ /** Per-device feature flag — render this entry only when true. */
27757
+ enabled: boolean()
27758
+ });
27759
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27760
+ var NavigationPointSchema = object({
27761
+ x: number(),
27762
+ y: number()
27763
+ });
27764
+ /**
27765
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27766
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27767
+ * that are turned on for THIS device. Data-driven: the provider derives these
27768
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27769
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27770
+ * that are not dictionary entries.
27771
+ *
27772
+ * - `move` / `stop` — the momentary drive joystick.
27773
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27774
+ * map-coordinate plumbing is wired.
27775
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27776
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27777
+ * - `light` — the on/off fill-light toggle (works anytime).
27778
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27779
+ * camera-service control; needs an active stream).
27780
+ */
27781
+ var NavigationFeaturesSchema = object({
27782
+ move: boolean(),
27783
+ stop: boolean(),
27784
+ goToPoint: boolean(),
27785
+ runAction: boolean(),
27786
+ playSound: boolean(),
27787
+ light: boolean(),
27788
+ lightMode: boolean()
27789
+ });
27790
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27791
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27792
+ /**
27793
+ * Live navigation state so the UI can reflect what the robot is doing:
27794
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27795
+ * - `following` — person/pet follow is currently armed.
27796
+ * - `flash` — the on-camera fill light is on.
27797
+ * - `lightMode` — auto vs manual fill-light mode.
27798
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27799
+ * `lightMode === 'manual'`.
27800
+ */
27801
+ var NavigationStatusSchema = object({
27802
+ mode: _enum([
27803
+ "idle",
27804
+ "cleaning",
27805
+ "spot",
27806
+ "following",
27807
+ "goto",
27808
+ "returning",
27809
+ "paused",
27810
+ "unknown"
27811
+ ]),
27812
+ following: boolean(),
27813
+ flash: boolean(),
27814
+ lightMode: NavigationLightModeSchema,
27815
+ lightLevel: number().min(40).max(100),
27816
+ /** Ms epoch when the slice was last updated. */
27817
+ lastChangedAt: number()
27818
+ });
27819
+ /**
27820
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27821
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27822
+ * convention.
27823
+ */
27824
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27825
+ var navigationCapability = {
27826
+ name: "navigation",
27827
+ scope: "device",
27828
+ deviceNative: true,
27829
+ mode: "singleton",
27830
+ deviceTypes: [DeviceType.Camera],
27831
+ deviceConfig: { ui: {
27832
+ kind: "widget",
27833
+ widgetId: "host/navigation-panel",
27834
+ tab: "navigation",
27835
+ topTab: true,
27836
+ label: "Navigation",
27837
+ order: 0
27838
+ } },
27839
+ methods: {
27840
+ /**
27841
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27842
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27843
+ * path) works for any authenticated user, not admin-only. The UI sends
27844
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27845
+ * a single drive write WITHOUT debouncing.
27846
+ */
27847
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27848
+ /** Halt all motion immediately (zero drive vector). */
27849
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27850
+ /** Send the robot to a point on its live map. */
27851
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27852
+ /**
27853
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27854
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27855
+ */
27856
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27857
+ /**
27858
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27859
+ * unsupported action ids are rejected by the provider.
27860
+ */
27861
+ runAction: method(object({
27862
+ deviceId: number(),
27863
+ actionId: NavigationActionIdSchema
27864
+ }), _void(), { kind: "mutation" }),
27865
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27866
+ playSound: method(object({
27867
+ deviceId: number(),
27868
+ soundId: number().int()
27869
+ }), _void(), { kind: "mutation" }),
27870
+ /**
27871
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27872
+ * works anytime, no active stream required).
27873
+ */
27874
+ setLightOn: method(object({
27875
+ deviceId: number(),
27876
+ on: boolean()
27877
+ }), _void(), { kind: "mutation" }),
27878
+ /**
27879
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27880
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27881
+ * action that generally needs an active camera stream/monitor session — the
27882
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27883
+ */
27884
+ setLightMode: method(object({
27885
+ deviceId: number(),
27886
+ mode: NavigationLightModeSchema,
27887
+ level: number().min(40).max(100).optional()
27888
+ }), _void(), { kind: "mutation" }),
27889
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27890
+ setLightLevel: method(object({
27891
+ deviceId: number(),
27892
+ level: number().min(40).max(100)
27893
+ }), _void(), { kind: "mutation" }),
27894
+ /**
27895
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27896
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27897
+ * `listActions`).
27898
+ */
27899
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27900
+ },
27901
+ events: { onStatusChanged: { data: object({
27902
+ deviceId: number(),
27903
+ status: NavigationStatusSchema
27904
+ }) } },
27905
+ status: {
27906
+ schema: NavigationStatusSchema,
27907
+ kind: "push"
27908
+ },
27909
+ /**
27910
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27911
+ * for live mode / follow / flash changes.
27912
+ */
27913
+ runtimeState: NavigationRuntimeStateSchema,
27914
+ /**
27915
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27916
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27917
+ * that. The live handle re-publishes on connect.
27918
+ *
27919
+ * See `RuntimeStateDurability`. Enforced by
27920
+ * `scripts/check-runtime-state-durability.ts`.
27921
+ */
27922
+ durability: "session"
27923
+ };
27924
+ /**
27925
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27926
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27927
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27928
+ * one Home Assistant projection.
27929
+ */
27930
+ var NetworkLinkStatusSchema = object({
27931
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27932
+ type: _enum([
27933
+ "wifi",
27934
+ "ethernet",
27935
+ "cellular",
27936
+ "unknown"
27937
+ ]),
27938
+ /**
27939
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27940
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27941
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27942
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27943
+ * SKIP a null rather than coerce it.
27944
+ */
27945
+ signalPercent: number().min(0).max(100).nullable(),
27946
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27947
+ rssiDbm: number().optional(),
27948
+ /** Network name of a wireless link, when the firmware reports it. */
27949
+ ssid: string().optional(),
27950
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27951
+ lastUpdated: number()
27952
+ });
27953
+ var networkLinkCapability = {
27954
+ name: "network-link",
27955
+ scope: "device",
27956
+ deviceNative: true,
27957
+ mode: "singleton",
27958
+ deviceTypes: [
27959
+ DeviceType.Camera,
27960
+ DeviceType.Sensor,
27961
+ DeviceType.Button,
27962
+ DeviceType.Switch,
27963
+ DeviceType.Light,
27964
+ DeviceType.Lock,
27965
+ DeviceType.Siren
27966
+ ],
27967
+ methods: {},
27968
+ events: {
27969
+ /**
27970
+ * Emitted whenever the cached status changes (a link switch, a signal
27971
+ * reading that moved). Mirrored on the parent chain by the
27972
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27973
+ */
27974
+ onStatusChanged: { data: object({
27975
+ deviceId: number(),
27976
+ status: NetworkLinkStatusSchema
27977
+ }) } },
27978
+ status: {
27979
+ schema: NetworkLinkStatusSchema,
27980
+ kind: "push",
27981
+ empty: {
27982
+ type: "unknown",
27983
+ signalPercent: null,
27984
+ lastUpdated: 0
27985
+ }
27986
+ },
27987
+ /**
27988
+ * Runtime-state slice — every provider stores the same shape under
27989
+ * `device.runtimeState['network-link']`, read once by the badge and the
27990
+ * Home Assistant projector regardless of the driver.
27991
+ */
27992
+ runtimeState: NetworkLinkStatusSchema,
27993
+ /**
27994
+ * Runtime-state durability: **restored** — a link reading is slow to
27995
+ * change and a sleeping battery camera may not report for hours; the
27996
+ * restored slice is what the badge shows until the next read.
27997
+ *
27998
+ * See `RuntimeStateDurability`. Enforced by
27999
+ * `scripts/check-runtime-state-durability.ts`.
28000
+ */
28001
+ durability: "restored",
28002
+ /** Clock fields: written, but excluded from the compare that decides
28003
+ * whether persisting is worth a SQLite commit. */
28004
+ volatileStateFields: ["lastUpdated"]
28005
+ };
28006
+ /**
27599
28007
  * network-quality — system-scoped singleton capability tracking RTT,
27600
28008
  * jitter, and observed/peak bandwidth per device + per client.
27601
28009
  *
@@ -29176,287 +29584,6 @@ var ptzAutotrackCapability = {
29176
29584
  */
29177
29585
  durability: "session"
29178
29586
  };
29179
- /**
29180
- * `navigation` — a device-scoped capability that natively expresses the FULL
29181
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29182
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29183
- *
29184
- * Why a NEW cap rather than overloading `ptz`:
29185
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29186
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29187
- * The two are different physical models: PTZ is absolute-position + presets,
29188
- * navigation is momentary drive nudges + discrete robot ACTIONS
29189
- * (dock / spot-clean / follow-pet / go-to-point / …).
29190
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29191
- * the reverse:
29192
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29193
- * / `getOptions`), and
29194
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29195
- * robot camera shows up in the existing PTZ control path without every
29196
- * PTZ provider learning about robots. The mapping lives in the adapter,
29197
- * not here (see the addon design note):
29198
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29199
- * ptz.stop() → navigation.stop()
29200
- * ptz.goHome() → navigation.runAction('goHome')
29201
- * ptz.getPresets() → navigation.listActions() (id→preset)
29202
- * ptz.goToPreset(id) → navigation.runAction(id)
29203
- *
29204
- * ## Continuous drive
29205
- *
29206
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29207
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29208
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29209
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29210
- * coalesce them. The UI owns the cadence.
29211
- *
29212
- * ## The action dictionary
29213
- *
29214
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29215
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29216
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29217
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29218
- * vendor-specific list. `kind: 'action'` entries are triggered with
29219
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29220
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29221
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29222
- *
29223
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29224
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29225
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29226
- * every device handle. A future nodedreame publish adds a typed
29227
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29228
- * provider can then swap the raw calls for the typed methods with no change to
29229
- * THIS contract.
29230
- */
29231
- /**
29232
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29233
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29234
- * halts it.
29235
- *
29236
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29237
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29238
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29239
- * vector by it (drivers without proportional drive ignore it).
29240
- *
29241
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29242
- * axis alone; an all-undefined nudge is a no-op.
29243
- */
29244
- var NavigationMoveCommandSchema = object({
29245
- pan: number().min(-1).max(1).optional(),
29246
- tilt: number().min(-1).max(1).optional(),
29247
- speed: number().min(0).max(1).optional()
29248
- });
29249
- /**
29250
- * The enumerated discrete actions a navigation-capable robot can perform via
29251
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29252
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29253
- * `playSound` (see the `sound` dictionary entries).
29254
- */
29255
- var NavigationActionIdSchema = _enum([
29256
- "goHome",
29257
- "locate",
29258
- "spotClean",
29259
- "findPet",
29260
- "personFollow",
29261
- "stop",
29262
- "startClean",
29263
- "pauseClean",
29264
- "dockWash",
29265
- "autoEmpty",
29266
- "flashOn",
29267
- "flashOff"
29268
- ]);
29269
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29270
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29271
- /**
29272
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29273
- * native panel and the PTZ mimic render as a button.
29274
- *
29275
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29276
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29277
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29278
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29279
- * - `label` — operator-facing English label.
29280
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29281
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29282
- * PTZ render ONLY enabled entries. Data-driven: the provider
29283
- * flips it from config, never by editing code.
29284
- */
29285
- var NavigationActionEntrySchema = object({
29286
- id: string(),
29287
- kind: NavigationEntryKindSchema,
29288
- label: string(),
29289
- icon: string(),
29290
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29291
- soundId: number().int().optional(),
29292
- /** Per-device feature flag — render this entry only when true. */
29293
- enabled: boolean()
29294
- });
29295
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29296
- var NavigationPointSchema = object({
29297
- x: number(),
29298
- y: number()
29299
- });
29300
- /**
29301
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29302
- * The cap reports which are enabled so the UI / PTZ render only the controls
29303
- * that are turned on for THIS device. Data-driven: the provider derives these
29304
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29305
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29306
- * that are not dictionary entries.
29307
- *
29308
- * - `move` / `stop` — the momentary drive joystick.
29309
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29310
- * map-coordinate plumbing is wired.
29311
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29312
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29313
- * - `light` — the on/off fill-light toggle (works anytime).
29314
- * - `lightMode` — the auto/manual selector + manual level slider (a
29315
- * camera-service control; needs an active stream).
29316
- */
29317
- var NavigationFeaturesSchema = object({
29318
- move: boolean(),
29319
- stop: boolean(),
29320
- goToPoint: boolean(),
29321
- runAction: boolean(),
29322
- playSound: boolean(),
29323
- light: boolean(),
29324
- lightMode: boolean()
29325
- });
29326
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29327
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29328
- /**
29329
- * Live navigation state so the UI can reflect what the robot is doing:
29330
- * - `mode` — coarse activity (idle / cleaning / following / …).
29331
- * - `following` — person/pet follow is currently armed.
29332
- * - `flash` — the on-camera fill light is on.
29333
- * - `lightMode` — auto vs manual fill-light mode.
29334
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29335
- * `lightMode === 'manual'`.
29336
- */
29337
- var NavigationStatusSchema = object({
29338
- mode: _enum([
29339
- "idle",
29340
- "cleaning",
29341
- "spot",
29342
- "following",
29343
- "goto",
29344
- "returning",
29345
- "paused",
29346
- "unknown"
29347
- ]),
29348
- following: boolean(),
29349
- flash: boolean(),
29350
- lightMode: NavigationLightModeSchema,
29351
- lightLevel: number().min(40).max(100),
29352
- /** Ms epoch when the slice was last updated. */
29353
- lastChangedAt: number()
29354
- });
29355
- /**
29356
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29357
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29358
- * convention.
29359
- */
29360
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29361
- var navigationCapability = {
29362
- name: "navigation",
29363
- scope: "device",
29364
- deviceNative: true,
29365
- mode: "singleton",
29366
- deviceTypes: [DeviceType.Camera],
29367
- deviceConfig: { ui: {
29368
- kind: "widget",
29369
- widgetId: "host/navigation-panel",
29370
- tab: "navigation",
29371
- topTab: true,
29372
- label: "Navigation",
29373
- order: 0
29374
- } },
29375
- methods: {
29376
- /**
29377
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29378
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29379
- * path) works for any authenticated user, not admin-only. The UI sends
29380
- * these at ~1 Hz while a control is held; the provider forwards each one to
29381
- * a single drive write WITHOUT debouncing.
29382
- */
29383
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29384
- /** Halt all motion immediately (zero drive vector). */
29385
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29386
- /** Send the robot to a point on its live map. */
29387
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29388
- /**
29389
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29390
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29391
- */
29392
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29393
- /**
29394
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29395
- * unsupported action ids are rejected by the provider.
29396
- */
29397
- runAction: method(object({
29398
- deviceId: number(),
29399
- actionId: NavigationActionIdSchema
29400
- }), _void(), { kind: "mutation" }),
29401
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29402
- playSound: method(object({
29403
- deviceId: number(),
29404
- soundId: number().int()
29405
- }), _void(), { kind: "mutation" }),
29406
- /**
29407
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29408
- * works anytime, no active stream required).
29409
- */
29410
- setLightOn: method(object({
29411
- deviceId: number(),
29412
- on: boolean()
29413
- }), _void(), { kind: "mutation" }),
29414
- /**
29415
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29416
- * initial `level`. The auto/manual + level control is a CAMERA-service
29417
- * action that generally needs an active camera stream/monitor session — the
29418
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29419
- */
29420
- setLightMode: method(object({
29421
- deviceId: number(),
29422
- mode: NavigationLightModeSchema,
29423
- level: number().min(40).max(100).optional()
29424
- }), _void(), { kind: "mutation" }),
29425
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29426
- setLightLevel: method(object({
29427
- deviceId: number(),
29428
- level: number().min(40).max(100)
29429
- }), _void(), { kind: "mutation" }),
29430
- /**
29431
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29432
- * controls the UI shows (the per-entry flags for the dictionary come back on
29433
- * `listActions`).
29434
- */
29435
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29436
- },
29437
- events: { onStatusChanged: { data: object({
29438
- deviceId: number(),
29439
- status: NavigationStatusSchema
29440
- }) } },
29441
- status: {
29442
- schema: NavigationStatusSchema,
29443
- kind: "push"
29444
- },
29445
- /**
29446
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29447
- * for live mode / follow / flash changes.
29448
- */
29449
- runtimeState: NavigationRuntimeStateSchema,
29450
- /**
29451
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29452
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29453
- * that. The live handle re-publishes on connect.
29454
- *
29455
- * See `RuntimeStateDurability`. Enforced by
29456
- * `scripts/check-runtime-state-durability.ts`.
29457
- */
29458
- durability: "session"
29459
- };
29460
29587
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29461
29588
  kind: "mutation",
29462
29589
  auth: "admin"
@@ -38495,13 +38622,13 @@ Object.freeze({
38495
38622
  addonId: null,
38496
38623
  access: "view"
38497
38624
  },
38498
- "storage.getDefaultLocation": {
38625
+ "storage.list": {
38499
38626
  capName: "storage",
38500
38627
  capScope: "system",
38501
38628
  addonId: null,
38502
38629
  access: "view"
38503
38630
  },
38504
- "storage.list": {
38631
+ "storage.listDrainProgress": {
38505
38632
  capName: "storage",
38506
38633
  capScope: "system",
38507
38634
  addonId: null,
@@ -38651,6 +38778,12 @@ Object.freeze({
38651
38778
  addonId: null,
38652
38779
  access: "view"
38653
38780
  },
38781
+ "storageOccupancy.getOccupancy": {
38782
+ capName: "storage-occupancy",
38783
+ capScope: "system",
38784
+ addonId: null,
38785
+ access: "view"
38786
+ },
38654
38787
  "storageProvider.abortUpload": {
38655
38788
  capName: "storage-provider",
38656
38789
  capScope: "system",