@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.js CHANGED
@@ -31,7 +31,7 @@ let node_module = require("node:module");
31
31
  let sharp = require("sharp");
32
32
  sharp = __toESM(sharp);
33
33
  let node_http = require("node:http");
34
- //#region ../types/dist/event-category-zAv7pMUz.mjs
34
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
35
35
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
36
36
  EventCategory["SystemBoot"] = "system.boot";
37
37
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -226,6 +226,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
226
226
  EventCategory["ProcessCrashed"] = "process.crashed";
227
227
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
228
228
  EventCategory["ProcessRestarted"] = "process.restarted";
229
+ /**
230
+ * The SET of storage locations changed — one was created, edited, enabled,
231
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
232
+ *
233
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
234
+ * it must also converge on its own periodic path, because a dropped event
235
+ * must not leave a node writing to yesterday's disk set forever. It exists
236
+ * because there was NO signal at all — an operator who added a second
237
+ * recordings disk in the admin UI got nothing, and the recorder kept its
238
+ * resolved locations until something else happened to re-resolve them
239
+ * (D387). Payload `StorageLocationsChangedPayload`.
240
+ */
241
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
229
242
  EventCategory["RecordingStarted"] = "recording.started";
230
243
  EventCategory["RecordingStopped"] = "recording.stopped";
231
244
  EventCategory["RecordingError"] = "recording.error";
@@ -7714,111 +7727,6 @@ var CameraSwitchGroupSchema = object({
7714
7727
  var DETECTION_PIPELINE_CAP_NAME = "detection-pipeline";
7715
7728
  var AUDIO_ANALYSIS_CAP_NAME = "audio-analysis";
7716
7729
  /**
7717
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7718
- * an addon declares its channels in.
7719
- *
7720
- * ## Two axes, deliberately separated
7721
- *
7722
- * - **DECLARATION** — which channels exist. Only the addon knows:
7723
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7724
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7725
- * and rots silently. So a channel is declared where it is consulted, and the
7726
- * `log-channels` capability enumerates the declarations.
7727
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7728
- * thing: the logging settings document on the `system` cap. Two authorities
7729
- * over the values is the exact defect
7730
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7731
- * remove; re-introducing it from the cure side would be grotesque.
7732
- *
7733
- * Nothing in this file reads a clock, an env var or a store. The registry is
7734
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7735
- * the hot path with a value somebody actually read, and by
7736
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7737
- * never reaches here, so it can neither disarm an armed channel nor arm a
7738
- * disarmed one (D49).
7739
- *
7740
- * ## The canonical call shape
7741
- *
7742
- * ```ts
7743
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7744
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7745
- * }
7746
- * ```
7747
- *
7748
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7749
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7750
- * object literal is never constructed because it lives inside the branch. It
7751
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7752
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7753
- * destination floor (measured at 1.93 ns/call when off).
7754
- *
7755
- * ## Why a channel emits at `info`
7756
- *
7757
- * `loki-logging.addon.ts` pins the destination default at `info` and
7758
- * `loki-destination.ts` drops everything below it, so a line emitted at
7759
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7760
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7761
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7762
- * emits at the channel's declared level, whose schema floor is `info`.
7763
- */
7764
- /**
7765
- * The level a channel writes at once armed.
7766
- *
7767
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7768
- * not leave the process for Loki, and the whole point of arming a channel is
7769
- * to read it later.
7770
- */
7771
- var LogChannelLevelSchema = _enum([
7772
- "info",
7773
- "warn",
7774
- "error"
7775
- ]);
7776
- /**
7777
- * What an addon declares about one channel. No value, no state — a
7778
- * declaration is inert.
7779
- */
7780
- var LogChannelDescriptorSchema = object({
7781
- /**
7782
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7783
- * the addon's short name so an operator reading a channel list can tell who
7784
- * owns it without a second lookup.
7785
- */
7786
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7787
- /** One sentence: what the operator will SEE after arming it. */
7788
- description: string().min(1),
7789
- /** The level its lines are emitted at. Never below `info`. */
7790
- defaultLevel: LogChannelLevelSchema,
7791
- /**
7792
- * Whether this channel can be narrowed to a camera.
7793
- *
7794
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7795
- * consulted with the numeric device id, AND every line the channel admits
7796
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7797
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7798
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7799
- * the body is the only way to filter.
7800
- *
7801
- * A channel whose lines carry the device only in `meta` (or not at all) is
7802
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7803
- * the operator narrows to one camera, sees nothing, and concludes the code
7804
- * path was never taken.
7805
- */
7806
- perDevice: boolean()
7807
- });
7808
- /**
7809
- * An armed window over one channel, as the document hands it to a mirror.
7810
- *
7811
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7812
- * expires by itself, which is the one failure a boolean cannot avoid.
7813
- */
7814
- var LogChannelWindowSchema = object({
7815
- channel: string().min(1),
7816
- /** Epoch ms the window closes at. */
7817
- armedUntilMs: number(),
7818
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7819
- deviceIds: array(number().int()).readonly().nullable()
7820
- });
7821
- /**
7822
7730
  * Ops-log — the durable, append-only operations audit shared by the
7823
7731
  * recordings and events management surfaces.
7824
7732
  *
@@ -8740,6 +8648,21 @@ var StorageCleanupJobSchema = object({
8740
8648
  });
8741
8649
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8742
8650
  /**
8651
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8652
+ * alias below is `z.infer<>` of it, never a second spelling.
8653
+ */
8654
+ var StorageLocationModeSchema = _enum([
8655
+ "active",
8656
+ "readonly",
8657
+ "drain",
8658
+ "disabled"
8659
+ ]);
8660
+ _enum([
8661
+ "normal",
8662
+ "never",
8663
+ "drain"
8664
+ ]);
8665
+ /**
8743
8666
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8744
8667
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8745
8668
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8764,8 +8687,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8764
8687
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8765
8688
  *
8766
8689
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8767
- * The default location for a type uses `id === <type>:default` by
8768
- * convention (the bare type ref like `'backups'` resolves to it).
8690
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8691
+ * There is no default location any more (D383): `enabled` is the whole write
8692
+ * model, and a bare type ref resolves to the sole location of the type, or —
8693
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8694
+ * slug is `default`.
8769
8695
  *
8770
8696
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8771
8697
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8786,23 +8712,37 @@ var StorageLocationSchema = object({
8786
8712
  * flag at upsert time, not here (the schema is provider-agnostic).
8787
8713
  */
8788
8714
  nodeId: string().optional(),
8789
- isDefault: boolean().default(false),
8790
8715
  isSystem: boolean().default(false),
8791
8716
  /**
8792
- * Operator opt-in: whether consumers that BALANCE across several locations
8793
- * of a type may write here. Recordings reads it today; event media and
8794
- * backups are the next consumers, which is why the flag lives on the
8795
- * location rather than in any one addon's store nothing has to be
8796
- * extended to add the next consumer.
8717
+ * THE write switch, and the only one (D383). `enabled: true` means every
8718
+ * consumer that chooses a write target for this type may write here, and all
8719
+ * enabled locations of a type are used TOGETHER; `false` means read-only
8720
+ * still read, still played back, still age-swept, still drained, never
8721
+ * written.
8797
8722
  *
8798
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8799
- * flag existed reads back with no flag and keeps working exactly as before;
8800
- * that is the whole compat story, and it is why no migration ships with it.
8801
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8802
- * disk must not silently start writing to it); the default of a type is
8803
- * always stamped `true`.
8723
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8724
+ * stored" on an update and "born inert unless it is the first location of its
8725
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8726
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
8727
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8728
+ * stops existing rather than being re-derived on every read.
8804
8729
  */
8805
8730
  enabled: boolean().optional(),
8731
+ /**
8732
+ * THE state of this location (D385), and the only authority on what may be
8733
+ * written, read or evicted here. Interpreted in exactly one place —
8734
+ * `storage-location-mode.ts` — which also folds the legacy
8735
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8736
+ * ambiguous.
8737
+ *
8738
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8739
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8740
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8741
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8742
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8743
+ * either, so the two cannot disagree.
8744
+ */
8745
+ mode: StorageLocationModeSchema.optional(),
8806
8746
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8807
8747
  * for node-local locations it can reach) — never persisted, absent when the
8808
8748
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8810,13 +8750,50 @@ var StorageLocationSchema = object({
8810
8750
  totalBytes: number(),
8811
8751
  availableBytes: number()
8812
8752
  }).nullable().optional(),
8753
+ /**
8754
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8755
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8756
+ * never persisted, never a filesystem walk.
8757
+ *
8758
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8759
+ * location yet — nobody stores here, the owning addon is down, or the first
8760
+ * refresh has not completed. A UI must omit the segment rather than draw it
8761
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8762
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8763
+ * be spelled out loud instead of appearing by accident.
8764
+ *
8765
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8766
+ * about the whole figure rather than about its freshest part.
8767
+ */
8768
+ owned: object({
8769
+ bytes: number().int().nonnegative(),
8770
+ measuredAtMs: number().int().nonnegative()
8771
+ }).optional(),
8813
8772
  createdAt: number(),
8814
8773
  updatedAt: number()
8815
8774
  });
8775
+ object({ isDefault: boolean().optional() });
8776
+ /**
8777
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8778
+ *
8779
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8780
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8781
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8782
+ * operator learns not to believe the screen.
8783
+ */
8784
+ var StorageDrainProgressSchema = object({
8785
+ locationId: string(),
8786
+ startedAtMs: number(),
8787
+ startBytes: number(),
8788
+ bytesRemaining: number(),
8789
+ drained: boolean(),
8790
+ estimatedEmptyAtMs: number().nullable()
8791
+ });
8816
8792
  /**
8817
8793
  * Reference accepted by consumer-facing `api.storage.*` calls.
8818
8794
  * Either:
8819
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8795
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8796
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8820
8797
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8821
8798
  *
8822
8799
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -8992,6 +8969,111 @@ var DecoderSessionConfigSchema = object({
8992
8969
  */
8993
8970
  debug: boolean().optional()
8994
8971
  });
8972
+ /**
8973
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
8974
+ * an addon declares its channels in.
8975
+ *
8976
+ * ## Two axes, deliberately separated
8977
+ *
8978
+ * - **DECLARATION** — which channels exist. Only the addon knows:
8979
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8980
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
8981
+ * and rots silently. So a channel is declared where it is consulted, and the
8982
+ * `log-channels` capability enumerates the declarations.
8983
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
8984
+ * thing: the logging settings document on the `system` cap. Two authorities
8985
+ * over the values is the exact defect
8986
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8987
+ * remove; re-introducing it from the cure side would be grotesque.
8988
+ *
8989
+ * Nothing in this file reads a clock, an env var or a store. The registry is
8990
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8991
+ * the hot path with a value somebody actually read, and by
8992
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8993
+ * never reaches here, so it can neither disarm an armed channel nor arm a
8994
+ * disarmed one (D49).
8995
+ *
8996
+ * ## The canonical call shape
8997
+ *
8998
+ * ```ts
8999
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9000
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9001
+ * }
9002
+ * ```
9003
+ *
9004
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9005
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9006
+ * object literal is never constructed because it lives inside the branch. It
9007
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9008
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9009
+ * destination floor (measured at 1.93 ns/call when off).
9010
+ *
9011
+ * ## Why a channel emits at `info`
9012
+ *
9013
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9014
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9015
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9016
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9017
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9018
+ * emits at the channel's declared level, whose schema floor is `info`.
9019
+ */
9020
+ /**
9021
+ * The level a channel writes at once armed.
9022
+ *
9023
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9024
+ * not leave the process for Loki, and the whole point of arming a channel is
9025
+ * to read it later.
9026
+ */
9027
+ var LogChannelLevelSchema = _enum([
9028
+ "info",
9029
+ "warn",
9030
+ "error"
9031
+ ]);
9032
+ /**
9033
+ * What an addon declares about one channel. No value, no state — a
9034
+ * declaration is inert.
9035
+ */
9036
+ var LogChannelDescriptorSchema = object({
9037
+ /**
9038
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9039
+ * the addon's short name so an operator reading a channel list can tell who
9040
+ * owns it without a second lookup.
9041
+ */
9042
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9043
+ /** One sentence: what the operator will SEE after arming it. */
9044
+ description: string().min(1),
9045
+ /** The level its lines are emitted at. Never below `info`. */
9046
+ defaultLevel: LogChannelLevelSchema,
9047
+ /**
9048
+ * Whether this channel can be narrowed to a camera.
9049
+ *
9050
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9051
+ * consulted with the numeric device id, AND every line the channel admits
9052
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9053
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9054
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9055
+ * the body is the only way to filter.
9056
+ *
9057
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9058
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9059
+ * the operator narrows to one camera, sees nothing, and concludes the code
9060
+ * path was never taken.
9061
+ */
9062
+ perDevice: boolean()
9063
+ });
9064
+ /**
9065
+ * An armed window over one channel, as the document hands it to a mirror.
9066
+ *
9067
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9068
+ * expires by itself, which is the one failure a boolean cannot avoid.
9069
+ */
9070
+ var LogChannelWindowSchema = object({
9071
+ channel: string().min(1),
9072
+ /** Epoch ms the window closes at. */
9073
+ armedUntilMs: number(),
9074
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9075
+ deviceIds: array(number().int()).readonly().nullable()
9076
+ });
8995
9077
  var MODEL_FORMATS = [
8996
9078
  "onnx",
8997
9079
  "coreml",
@@ -22047,7 +22129,7 @@ method(object({
22047
22129
  downloadId: string(),
22048
22130
  offset: number(),
22049
22131
  length: number()
22050
- }), _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({
22132
+ }), _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({
22051
22133
  createdAt: true,
22052
22134
  updatedAt: true
22053
22135
  }), StorageLocationSchema, {
@@ -22059,7 +22141,7 @@ method(object({
22059
22141
  }), _void(), {
22060
22142
  kind: "mutation",
22061
22143
  auth: "admin"
22062
- }), method(object({ id: string() }), object({
22144
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22063
22145
  ok: boolean(),
22064
22146
  error: string().optional()
22065
22147
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22129,6 +22211,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22129
22211
  kind: "mutation",
22130
22212
  auth: "admin"
22131
22213
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22214
+ /**
22215
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22216
+ * location (D388).
22217
+ *
22218
+ * ## Why this is not `storage-evictable`
22219
+ *
22220
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22221
+ * not, in two ways that both matter and both bite hardest on the locations an
22222
+ * operator most wants a figure for:
22223
+ *
22224
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22225
+ * and `recordingsLow:default` deliberately share one root and evict as one
22226
+ * oldest-first pool, so both answer with the SAME combined total. As an
22227
+ * occupancy figure that double-counts the disk.
22228
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22229
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22230
+ * is retiring and staring at.
22231
+ *
22232
+ * So this is its own contract with its own quantity, and the quantity is
22233
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22234
+ * would ever be willing to delete it. A provider that can only answer
22235
+ * "evictable" must not register here — a number that silently means different
22236
+ * things per class is worse than no number.
22237
+ *
22238
+ * ## Absence is an answer
22239
+ *
22240
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22241
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22242
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22243
+ * consuming side has to be written out loud instead of appearing by accident.
22244
+ *
22245
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22246
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22247
+ */
22248
+ /** One provider's occupancy answer for one location. */
22249
+ var StorageOccupancyReportSchema = object({
22250
+ locationId: string(),
22251
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22252
+ * not net of what it is willing to delete. */
22253
+ ownedBytes: number().int().nonnegative(),
22254
+ /** When the provider last actually measured this. The orchestrator carries it
22255
+ * through so a UI can say how old the figure is instead of implying "now". */
22256
+ measuredAtMs: number().int().nonnegative()
22257
+ });
22258
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22132
22259
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22133
22260
  providerId: string().min(1),
22134
22261
  displayName: string().min(1),
@@ -24008,88 +24135,6 @@ onStatusChanged: { data: object({
24008
24135
  volatileStateFields: ["lastUpdated"]
24009
24136
  };
24010
24137
  /**
24011
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24012
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24013
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24014
- * one Home Assistant projection.
24015
- */
24016
- var NetworkLinkStatusSchema = object({
24017
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24018
- type: _enum([
24019
- "wifi",
24020
- "ethernet",
24021
- "cellular",
24022
- "unknown"
24023
- ]),
24024
- /**
24025
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24026
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24027
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24028
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24029
- * SKIP a null rather than coerce it.
24030
- */
24031
- signalPercent: number().min(0).max(100).nullable(),
24032
- /** Raw received signal strength in dBm, when the firmware reports one. */
24033
- rssiDbm: number().optional(),
24034
- /** Network name of a wireless link, when the firmware reports it. */
24035
- ssid: string().optional(),
24036
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24037
- lastUpdated: number()
24038
- });
24039
- var networkLinkCapability = {
24040
- name: "network-link",
24041
- scope: "device",
24042
- deviceNative: true,
24043
- mode: "singleton",
24044
- deviceTypes: [
24045
- DeviceType.Camera,
24046
- DeviceType.Sensor,
24047
- DeviceType.Button,
24048
- DeviceType.Switch,
24049
- DeviceType.Light,
24050
- DeviceType.Lock,
24051
- DeviceType.Siren
24052
- ],
24053
- methods: {},
24054
- events: {
24055
- /**
24056
- * Emitted whenever the cached status changes (a link switch, a signal
24057
- * reading that moved). Mirrored on the parent chain by the
24058
- * DeviceEventPropagator like `battery.onStatusChanged`.
24059
- */
24060
- onStatusChanged: { data: object({
24061
- deviceId: number(),
24062
- status: NetworkLinkStatusSchema
24063
- }) } },
24064
- status: {
24065
- schema: NetworkLinkStatusSchema,
24066
- kind: "push",
24067
- empty: {
24068
- type: "unknown",
24069
- signalPercent: null,
24070
- lastUpdated: 0
24071
- }
24072
- },
24073
- /**
24074
- * Runtime-state slice — every provider stores the same shape under
24075
- * `device.runtimeState['network-link']`, read once by the badge and the
24076
- * Home Assistant projector regardless of the driver.
24077
- */
24078
- runtimeState: NetworkLinkStatusSchema,
24079
- /**
24080
- * Runtime-state durability: **restored** — a link reading is slow to
24081
- * change and a sleeping battery camera may not report for hours; the
24082
- * restored slice is what the badge shows until the next read.
24083
- *
24084
- * See `RuntimeStateDurability`. Enforced by
24085
- * `scripts/check-runtime-state-durability.ts`.
24086
- */
24087
- durability: "restored",
24088
- /** Clock fields: written, but excluded from the compare that decides
24089
- * whether persisting is worth a SQLite commit. */
24090
- volatileStateFields: ["lastUpdated"]
24091
- };
24092
- /**
24093
24138
  * Generic boolean sensor — last-resort fallback when no domain-
24094
24139
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24095
24140
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27619,6 +27664,369 @@ var nativeObjectDetectionCapability = {
27619
27664
  volatileStateFields: ["lastFetchedAt"]
27620
27665
  };
27621
27666
  /**
27667
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27668
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27669
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27670
+ *
27671
+ * Why a NEW cap rather than overloading `ptz`:
27672
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27673
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27674
+ * The two are different physical models: PTZ is absolute-position + presets,
27675
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27676
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27677
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27678
+ * the reverse:
27679
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27680
+ * / `getOptions`), and
27681
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27682
+ * robot camera shows up in the existing PTZ control path without every
27683
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27684
+ * not here (see the addon design note):
27685
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27686
+ * ptz.stop() → navigation.stop()
27687
+ * ptz.goHome() → navigation.runAction('goHome')
27688
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27689
+ * ptz.goToPreset(id) → navigation.runAction(id)
27690
+ *
27691
+ * ## Continuous drive
27692
+ *
27693
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27694
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27695
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27696
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27697
+ * coalesce them. The UI owns the cadence.
27698
+ *
27699
+ * ## The action dictionary
27700
+ *
27701
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27702
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27703
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27704
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27705
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27706
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27707
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27708
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27709
+ *
27710
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27711
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27712
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27713
+ * every device handle. A future nodedreame publish adds a typed
27714
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27715
+ * provider can then swap the raw calls for the typed methods with no change to
27716
+ * THIS contract.
27717
+ */
27718
+ /**
27719
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27720
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27721
+ * halts it.
27722
+ *
27723
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27724
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27725
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27726
+ * vector by it (drivers without proportional drive ignore it).
27727
+ *
27728
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27729
+ * axis alone; an all-undefined nudge is a no-op.
27730
+ */
27731
+ var NavigationMoveCommandSchema = object({
27732
+ pan: number().min(-1).max(1).optional(),
27733
+ tilt: number().min(-1).max(1).optional(),
27734
+ speed: number().min(0).max(1).optional()
27735
+ });
27736
+ /**
27737
+ * The enumerated discrete actions a navigation-capable robot can perform via
27738
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27739
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27740
+ * `playSound` (see the `sound` dictionary entries).
27741
+ */
27742
+ var NavigationActionIdSchema = _enum([
27743
+ "goHome",
27744
+ "locate",
27745
+ "spotClean",
27746
+ "findPet",
27747
+ "personFollow",
27748
+ "stop",
27749
+ "startClean",
27750
+ "pauseClean",
27751
+ "dockWash",
27752
+ "autoEmpty",
27753
+ "flashOn",
27754
+ "flashOff"
27755
+ ]);
27756
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
27757
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
27758
+ /**
27759
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
27760
+ * native panel and the PTZ mimic render as a button.
27761
+ *
27762
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
27763
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
27764
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
27765
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
27766
+ * - `label` — operator-facing English label.
27767
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
27768
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
27769
+ * PTZ render ONLY enabled entries. Data-driven: the provider
27770
+ * flips it from config, never by editing code.
27771
+ */
27772
+ var NavigationActionEntrySchema = object({
27773
+ id: string(),
27774
+ kind: NavigationEntryKindSchema,
27775
+ label: string(),
27776
+ icon: string(),
27777
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
27778
+ soundId: number().int().optional(),
27779
+ /** Per-device feature flag — render this entry only when true. */
27780
+ enabled: boolean()
27781
+ });
27782
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
27783
+ var NavigationPointSchema = object({
27784
+ x: number(),
27785
+ y: number()
27786
+ });
27787
+ /**
27788
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
27789
+ * The cap reports which are enabled so the UI / PTZ render only the controls
27790
+ * that are turned on for THIS device. Data-driven: the provider derives these
27791
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
27792
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
27793
+ * that are not dictionary entries.
27794
+ *
27795
+ * - `move` / `stop` — the momentary drive joystick.
27796
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
27797
+ * map-coordinate plumbing is wired.
27798
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
27799
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
27800
+ * - `light` — the on/off fill-light toggle (works anytime).
27801
+ * - `lightMode` — the auto/manual selector + manual level slider (a
27802
+ * camera-service control; needs an active stream).
27803
+ */
27804
+ var NavigationFeaturesSchema = object({
27805
+ move: boolean(),
27806
+ stop: boolean(),
27807
+ goToPoint: boolean(),
27808
+ runAction: boolean(),
27809
+ playSound: boolean(),
27810
+ light: boolean(),
27811
+ lightMode: boolean()
27812
+ });
27813
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
27814
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
27815
+ /**
27816
+ * Live navigation state so the UI can reflect what the robot is doing:
27817
+ * - `mode` — coarse activity (idle / cleaning / following / …).
27818
+ * - `following` — person/pet follow is currently armed.
27819
+ * - `flash` — the on-camera fill light is on.
27820
+ * - `lightMode` — auto vs manual fill-light mode.
27821
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
27822
+ * `lightMode === 'manual'`.
27823
+ */
27824
+ var NavigationStatusSchema = object({
27825
+ mode: _enum([
27826
+ "idle",
27827
+ "cleaning",
27828
+ "spot",
27829
+ "following",
27830
+ "goto",
27831
+ "returning",
27832
+ "paused",
27833
+ "unknown"
27834
+ ]),
27835
+ following: boolean(),
27836
+ flash: boolean(),
27837
+ lightMode: NavigationLightModeSchema,
27838
+ lightLevel: number().min(40).max(100),
27839
+ /** Ms epoch when the slice was last updated. */
27840
+ lastChangedAt: number()
27841
+ });
27842
+ /**
27843
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
27844
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
27845
+ * convention.
27846
+ */
27847
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
27848
+ var navigationCapability = {
27849
+ name: "navigation",
27850
+ scope: "device",
27851
+ deviceNative: true,
27852
+ mode: "singleton",
27853
+ deviceTypes: [DeviceType.Camera],
27854
+ deviceConfig: { ui: {
27855
+ kind: "widget",
27856
+ widgetId: "host/navigation-panel",
27857
+ tab: "navigation",
27858
+ topTab: true,
27859
+ label: "Navigation",
27860
+ order: 0
27861
+ } },
27862
+ methods: {
27863
+ /**
27864
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
27865
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
27866
+ * path) works for any authenticated user, not admin-only. The UI sends
27867
+ * these at ~1 Hz while a control is held; the provider forwards each one to
27868
+ * a single drive write WITHOUT debouncing.
27869
+ */
27870
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27871
+ /** Halt all motion immediately (zero drive vector). */
27872
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
27873
+ /** Send the robot to a point on its live map. */
27874
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
27875
+ /**
27876
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
27877
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
27878
+ */
27879
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
27880
+ /**
27881
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
27882
+ * unsupported action ids are rejected by the provider.
27883
+ */
27884
+ runAction: method(object({
27885
+ deviceId: number(),
27886
+ actionId: NavigationActionIdSchema
27887
+ }), _void(), { kind: "mutation" }),
27888
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
27889
+ playSound: method(object({
27890
+ deviceId: number(),
27891
+ soundId: number().int()
27892
+ }), _void(), { kind: "mutation" }),
27893
+ /**
27894
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
27895
+ * works anytime, no active stream required).
27896
+ */
27897
+ setLightOn: method(object({
27898
+ deviceId: number(),
27899
+ on: boolean()
27900
+ }), _void(), { kind: "mutation" }),
27901
+ /**
27902
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
27903
+ * initial `level`. The auto/manual + level control is a CAMERA-service
27904
+ * action that generally needs an active camera stream/monitor session — the
27905
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
27906
+ */
27907
+ setLightMode: method(object({
27908
+ deviceId: number(),
27909
+ mode: NavigationLightModeSchema,
27910
+ level: number().min(40).max(100).optional()
27911
+ }), _void(), { kind: "mutation" }),
27912
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
27913
+ setLightLevel: method(object({
27914
+ deviceId: number(),
27915
+ level: number().min(40).max(100)
27916
+ }), _void(), { kind: "mutation" }),
27917
+ /**
27918
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
27919
+ * controls the UI shows (the per-entry flags for the dictionary come back on
27920
+ * `listActions`).
27921
+ */
27922
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
27923
+ },
27924
+ events: { onStatusChanged: { data: object({
27925
+ deviceId: number(),
27926
+ status: NavigationStatusSchema
27927
+ }) } },
27928
+ status: {
27929
+ schema: NavigationStatusSchema,
27930
+ kind: "push"
27931
+ },
27932
+ /**
27933
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
27934
+ * for live mode / follow / flash changes.
27935
+ */
27936
+ runtimeState: NavigationRuntimeStateSchema,
27937
+ /**
27938
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
27939
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
27940
+ * that. The live handle re-publishes on connect.
27941
+ *
27942
+ * See `RuntimeStateDurability`. Enforced by
27943
+ * `scripts/check-runtime-state-durability.ts`.
27944
+ */
27945
+ durability: "session"
27946
+ };
27947
+ /**
27948
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
27949
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
27950
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
27951
+ * one Home Assistant projection.
27952
+ */
27953
+ var NetworkLinkStatusSchema = object({
27954
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
27955
+ type: _enum([
27956
+ "wifi",
27957
+ "ethernet",
27958
+ "cellular",
27959
+ "unknown"
27960
+ ]),
27961
+ /**
27962
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
27963
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
27964
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
27965
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
27966
+ * SKIP a null rather than coerce it.
27967
+ */
27968
+ signalPercent: number().min(0).max(100).nullable(),
27969
+ /** Raw received signal strength in dBm, when the firmware reports one. */
27970
+ rssiDbm: number().optional(),
27971
+ /** Network name of a wireless link, when the firmware reports it. */
27972
+ ssid: string().optional(),
27973
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
27974
+ lastUpdated: number()
27975
+ });
27976
+ var networkLinkCapability = {
27977
+ name: "network-link",
27978
+ scope: "device",
27979
+ deviceNative: true,
27980
+ mode: "singleton",
27981
+ deviceTypes: [
27982
+ DeviceType.Camera,
27983
+ DeviceType.Sensor,
27984
+ DeviceType.Button,
27985
+ DeviceType.Switch,
27986
+ DeviceType.Light,
27987
+ DeviceType.Lock,
27988
+ DeviceType.Siren
27989
+ ],
27990
+ methods: {},
27991
+ events: {
27992
+ /**
27993
+ * Emitted whenever the cached status changes (a link switch, a signal
27994
+ * reading that moved). Mirrored on the parent chain by the
27995
+ * DeviceEventPropagator like `battery.onStatusChanged`.
27996
+ */
27997
+ onStatusChanged: { data: object({
27998
+ deviceId: number(),
27999
+ status: NetworkLinkStatusSchema
28000
+ }) } },
28001
+ status: {
28002
+ schema: NetworkLinkStatusSchema,
28003
+ kind: "push",
28004
+ empty: {
28005
+ type: "unknown",
28006
+ signalPercent: null,
28007
+ lastUpdated: 0
28008
+ }
28009
+ },
28010
+ /**
28011
+ * Runtime-state slice — every provider stores the same shape under
28012
+ * `device.runtimeState['network-link']`, read once by the badge and the
28013
+ * Home Assistant projector regardless of the driver.
28014
+ */
28015
+ runtimeState: NetworkLinkStatusSchema,
28016
+ /**
28017
+ * Runtime-state durability: **restored** — a link reading is slow to
28018
+ * change and a sleeping battery camera may not report for hours; the
28019
+ * restored slice is what the badge shows until the next read.
28020
+ *
28021
+ * See `RuntimeStateDurability`. Enforced by
28022
+ * `scripts/check-runtime-state-durability.ts`.
28023
+ */
28024
+ durability: "restored",
28025
+ /** Clock fields: written, but excluded from the compare that decides
28026
+ * whether persisting is worth a SQLite commit. */
28027
+ volatileStateFields: ["lastUpdated"]
28028
+ };
28029
+ /**
27622
28030
  * network-quality — system-scoped singleton capability tracking RTT,
27623
28031
  * jitter, and observed/peak bandwidth per device + per client.
27624
28032
  *
@@ -29199,287 +29607,6 @@ var ptzAutotrackCapability = {
29199
29607
  */
29200
29608
  durability: "session"
29201
29609
  };
29202
- /**
29203
- * `navigation` — a device-scoped capability that natively expresses the FULL
29204
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29205
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29206
- *
29207
- * Why a NEW cap rather than overloading `ptz`:
29208
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29209
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29210
- * The two are different physical models: PTZ is absolute-position + presets,
29211
- * navigation is momentary drive nudges + discrete robot ACTIONS
29212
- * (dock / spot-clean / follow-pet / go-to-point / …).
29213
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29214
- * the reverse:
29215
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29216
- * / `getOptions`), and
29217
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29218
- * robot camera shows up in the existing PTZ control path without every
29219
- * PTZ provider learning about robots. The mapping lives in the adapter,
29220
- * not here (see the addon design note):
29221
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29222
- * ptz.stop() → navigation.stop()
29223
- * ptz.goHome() → navigation.runAction('goHome')
29224
- * ptz.getPresets() → navigation.listActions() (id→preset)
29225
- * ptz.goToPreset(id) → navigation.runAction(id)
29226
- *
29227
- * ## Continuous drive
29228
- *
29229
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29230
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29231
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29232
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29233
- * coalesce them. The UI owns the cadence.
29234
- *
29235
- * ## The action dictionary
29236
- *
29237
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29238
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29239
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29240
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29241
- * vendor-specific list. `kind: 'action'` entries are triggered with
29242
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29243
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29244
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29245
- *
29246
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29247
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29248
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29249
- * every device handle. A future nodedreame publish adds a typed
29250
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29251
- * provider can then swap the raw calls for the typed methods with no change to
29252
- * THIS contract.
29253
- */
29254
- /**
29255
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29256
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29257
- * halts it.
29258
- *
29259
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29260
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29261
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29262
- * vector by it (drivers without proportional drive ignore it).
29263
- *
29264
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29265
- * axis alone; an all-undefined nudge is a no-op.
29266
- */
29267
- var NavigationMoveCommandSchema = object({
29268
- pan: number().min(-1).max(1).optional(),
29269
- tilt: number().min(-1).max(1).optional(),
29270
- speed: number().min(0).max(1).optional()
29271
- });
29272
- /**
29273
- * The enumerated discrete actions a navigation-capable robot can perform via
29274
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29275
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29276
- * `playSound` (see the `sound` dictionary entries).
29277
- */
29278
- var NavigationActionIdSchema = _enum([
29279
- "goHome",
29280
- "locate",
29281
- "spotClean",
29282
- "findPet",
29283
- "personFollow",
29284
- "stop",
29285
- "startClean",
29286
- "pauseClean",
29287
- "dockWash",
29288
- "autoEmpty",
29289
- "flashOn",
29290
- "flashOff"
29291
- ]);
29292
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29293
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29294
- /**
29295
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29296
- * native panel and the PTZ mimic render as a button.
29297
- *
29298
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29299
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29300
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29301
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29302
- * - `label` — operator-facing English label.
29303
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29304
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29305
- * PTZ render ONLY enabled entries. Data-driven: the provider
29306
- * flips it from config, never by editing code.
29307
- */
29308
- var NavigationActionEntrySchema = object({
29309
- id: string(),
29310
- kind: NavigationEntryKindSchema,
29311
- label: string(),
29312
- icon: string(),
29313
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29314
- soundId: number().int().optional(),
29315
- /** Per-device feature flag — render this entry only when true. */
29316
- enabled: boolean()
29317
- });
29318
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29319
- var NavigationPointSchema = object({
29320
- x: number(),
29321
- y: number()
29322
- });
29323
- /**
29324
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29325
- * The cap reports which are enabled so the UI / PTZ render only the controls
29326
- * that are turned on for THIS device. Data-driven: the provider derives these
29327
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29328
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29329
- * that are not dictionary entries.
29330
- *
29331
- * - `move` / `stop` — the momentary drive joystick.
29332
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29333
- * map-coordinate plumbing is wired.
29334
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29335
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29336
- * - `light` — the on/off fill-light toggle (works anytime).
29337
- * - `lightMode` — the auto/manual selector + manual level slider (a
29338
- * camera-service control; needs an active stream).
29339
- */
29340
- var NavigationFeaturesSchema = object({
29341
- move: boolean(),
29342
- stop: boolean(),
29343
- goToPoint: boolean(),
29344
- runAction: boolean(),
29345
- playSound: boolean(),
29346
- light: boolean(),
29347
- lightMode: boolean()
29348
- });
29349
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29350
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29351
- /**
29352
- * Live navigation state so the UI can reflect what the robot is doing:
29353
- * - `mode` — coarse activity (idle / cleaning / following / …).
29354
- * - `following` — person/pet follow is currently armed.
29355
- * - `flash` — the on-camera fill light is on.
29356
- * - `lightMode` — auto vs manual fill-light mode.
29357
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29358
- * `lightMode === 'manual'`.
29359
- */
29360
- var NavigationStatusSchema = object({
29361
- mode: _enum([
29362
- "idle",
29363
- "cleaning",
29364
- "spot",
29365
- "following",
29366
- "goto",
29367
- "returning",
29368
- "paused",
29369
- "unknown"
29370
- ]),
29371
- following: boolean(),
29372
- flash: boolean(),
29373
- lightMode: NavigationLightModeSchema,
29374
- lightLevel: number().min(40).max(100),
29375
- /** Ms epoch when the slice was last updated. */
29376
- lastChangedAt: number()
29377
- });
29378
- /**
29379
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29380
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29381
- * convention.
29382
- */
29383
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29384
- var navigationCapability = {
29385
- name: "navigation",
29386
- scope: "device",
29387
- deviceNative: true,
29388
- mode: "singleton",
29389
- deviceTypes: [DeviceType.Camera],
29390
- deviceConfig: { ui: {
29391
- kind: "widget",
29392
- widgetId: "host/navigation-panel",
29393
- tab: "navigation",
29394
- topTab: true,
29395
- label: "Navigation",
29396
- order: 0
29397
- } },
29398
- methods: {
29399
- /**
29400
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29401
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29402
- * path) works for any authenticated user, not admin-only. The UI sends
29403
- * these at ~1 Hz while a control is held; the provider forwards each one to
29404
- * a single drive write WITHOUT debouncing.
29405
- */
29406
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29407
- /** Halt all motion immediately (zero drive vector). */
29408
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29409
- /** Send the robot to a point on its live map. */
29410
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29411
- /**
29412
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29413
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29414
- */
29415
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29416
- /**
29417
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29418
- * unsupported action ids are rejected by the provider.
29419
- */
29420
- runAction: method(object({
29421
- deviceId: number(),
29422
- actionId: NavigationActionIdSchema
29423
- }), _void(), { kind: "mutation" }),
29424
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29425
- playSound: method(object({
29426
- deviceId: number(),
29427
- soundId: number().int()
29428
- }), _void(), { kind: "mutation" }),
29429
- /**
29430
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29431
- * works anytime, no active stream required).
29432
- */
29433
- setLightOn: method(object({
29434
- deviceId: number(),
29435
- on: boolean()
29436
- }), _void(), { kind: "mutation" }),
29437
- /**
29438
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29439
- * initial `level`. The auto/manual + level control is a CAMERA-service
29440
- * action that generally needs an active camera stream/monitor session — the
29441
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29442
- */
29443
- setLightMode: method(object({
29444
- deviceId: number(),
29445
- mode: NavigationLightModeSchema,
29446
- level: number().min(40).max(100).optional()
29447
- }), _void(), { kind: "mutation" }),
29448
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29449
- setLightLevel: method(object({
29450
- deviceId: number(),
29451
- level: number().min(40).max(100)
29452
- }), _void(), { kind: "mutation" }),
29453
- /**
29454
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29455
- * controls the UI shows (the per-entry flags for the dictionary come back on
29456
- * `listActions`).
29457
- */
29458
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29459
- },
29460
- events: { onStatusChanged: { data: object({
29461
- deviceId: number(),
29462
- status: NavigationStatusSchema
29463
- }) } },
29464
- status: {
29465
- schema: NavigationStatusSchema,
29466
- kind: "push"
29467
- },
29468
- /**
29469
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29470
- * for live mode / follow / flash changes.
29471
- */
29472
- runtimeState: NavigationRuntimeStateSchema,
29473
- /**
29474
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29475
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29476
- * that. The live handle re-publishes on connect.
29477
- *
29478
- * See `RuntimeStateDurability`. Enforced by
29479
- * `scripts/check-runtime-state-durability.ts`.
29480
- */
29481
- durability: "session"
29482
- };
29483
29610
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
29484
29611
  kind: "mutation",
29485
29612
  auth: "admin"
@@ -38518,13 +38645,13 @@ Object.freeze({
38518
38645
  addonId: null,
38519
38646
  access: "view"
38520
38647
  },
38521
- "storage.getDefaultLocation": {
38648
+ "storage.list": {
38522
38649
  capName: "storage",
38523
38650
  capScope: "system",
38524
38651
  addonId: null,
38525
38652
  access: "view"
38526
38653
  },
38527
- "storage.list": {
38654
+ "storage.listDrainProgress": {
38528
38655
  capName: "storage",
38529
38656
  capScope: "system",
38530
38657
  addonId: null,
@@ -38674,6 +38801,12 @@ Object.freeze({
38674
38801
  addonId: null,
38675
38802
  access: "view"
38676
38803
  },
38804
+ "storageOccupancy.getOccupancy": {
38805
+ capName: "storage-occupancy",
38806
+ capScope: "system",
38807
+ addonId: null,
38808
+ access: "view"
38809
+ },
38677
38810
  "storageProvider.abortUpload": {
38678
38811
  capName: "storage-provider",
38679
38812
  capScope: "system",