@camstack/addon-provider-petkit 0.2.78 → 0.2.80

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
@@ -1101,7 +1101,7 @@ var Nodepetkit = class {
1101
1101
  }
1102
1102
  };
1103
1103
  //#endregion
1104
- //#region ../types/dist/event-category-zAv7pMUz.mjs
1104
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
1105
1105
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
1106
1106
  EventCategory["SystemBoot"] = "system.boot";
1107
1107
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -1296,6 +1296,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
1296
1296
  EventCategory["ProcessCrashed"] = "process.crashed";
1297
1297
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
1298
1298
  EventCategory["ProcessRestarted"] = "process.restarted";
1299
+ /**
1300
+ * The SET of storage locations changed — one was created, edited, enabled,
1301
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
1302
+ *
1303
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
1304
+ * it must also converge on its own periodic path, because a dropped event
1305
+ * must not leave a node writing to yesterday's disk set forever. It exists
1306
+ * because there was NO signal at all — an operator who added a second
1307
+ * recordings disk in the admin UI got nothing, and the recorder kept its
1308
+ * resolved locations until something else happened to re-resolve them
1309
+ * (D387). Payload `StorageLocationsChangedPayload`.
1310
+ */
1311
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
1299
1312
  EventCategory["RecordingStarted"] = "recording.started";
1300
1313
  EventCategory["RecordingStopped"] = "recording.stopped";
1301
1314
  EventCategory["RecordingError"] = "recording.error";
@@ -8717,111 +8730,6 @@ var CameraSwitchGroupSchema = object({
8717
8730
  fetchedAt: number()
8718
8731
  });
8719
8732
  /**
8720
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
8721
- * an addon declares its channels in.
8722
- *
8723
- * ## Two axes, deliberately separated
8724
- *
8725
- * - **DECLARATION** — which channels exist. Only the addon knows:
8726
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
8727
- * baichuan/handshake. A hand-wired central list rots at the first addition,
8728
- * and rots silently. So a channel is declared where it is consulted, and the
8729
- * `log-channels` capability enumerates the declarations.
8730
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
8731
- * thing: the logging settings document on the `system` cap. Two authorities
8732
- * over the values is the exact defect
8733
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
8734
- * remove; re-introducing it from the cure side would be grotesque.
8735
- *
8736
- * Nothing in this file reads a clock, an env var or a store. The registry is
8737
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
8738
- * the hot path with a value somebody actually read, and by
8739
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
8740
- * never reaches here, so it can neither disarm an armed channel nor arm a
8741
- * disarmed one (D49).
8742
- *
8743
- * ## The canonical call shape
8744
- *
8745
- * ```ts
8746
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
8747
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
8748
- * }
8749
- * ```
8750
- *
8751
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
8752
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
8753
- * object literal is never constructed because it lives inside the branch. It
8754
- * is the same shape already proven in production at `stream-broker.ts:1650`,
8755
- * and the same discipline `LoggingGate.allowsDestination` uses for the
8756
- * destination floor (measured at 1.93 ns/call when off).
8757
- *
8758
- * ## Why a channel emits at `info`
8759
- *
8760
- * `loki-logging.addon.ts` pins the destination default at `info` and
8761
- * `loki-destination.ts` drops everything below it, so a line emitted at
8762
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
8763
- * minutes. A diagnostic that cannot be read an hour later is worse than no
8764
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
8765
- * emits at the channel's declared level, whose schema floor is `info`.
8766
- */
8767
- /**
8768
- * The level a channel writes at once armed.
8769
- *
8770
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
8771
- * not leave the process for Loki, and the whole point of arming a channel is
8772
- * to read it later.
8773
- */
8774
- var LogChannelLevelSchema = _enum([
8775
- "info",
8776
- "warn",
8777
- "error"
8778
- ]);
8779
- /**
8780
- * What an addon declares about one channel. No value, no state — a
8781
- * declaration is inert.
8782
- */
8783
- var LogChannelDescriptorSchema = object({
8784
- /**
8785
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
8786
- * the addon's short name so an operator reading a channel list can tell who
8787
- * owns it without a second lookup.
8788
- */
8789
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
8790
- /** One sentence: what the operator will SEE after arming it. */
8791
- description: string().min(1),
8792
- /** The level its lines are emitted at. Never below `info`. */
8793
- defaultLevel: LogChannelLevelSchema,
8794
- /**
8795
- * Whether this channel can be narrowed to a camera.
8796
- *
8797
- * `true` is a PROMISE with two halves, and both must hold: the gate is
8798
- * consulted with the numeric device id, AND every line the channel admits
8799
- * carries `tags: { deviceId }` with that same numeric id. The second half is
8800
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
8801
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
8802
- * the body is the only way to filter.
8803
- *
8804
- * A channel whose lines carry the device only in `meta` (or not at all) is
8805
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
8806
- * the operator narrows to one camera, sees nothing, and concludes the code
8807
- * path was never taken.
8808
- */
8809
- perDevice: boolean()
8810
- });
8811
- /**
8812
- * An armed window over one channel, as the document hands it to a mirror.
8813
- *
8814
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
8815
- * expires by itself, which is the one failure a boolean cannot avoid.
8816
- */
8817
- var LogChannelWindowSchema = object({
8818
- channel: string().min(1),
8819
- /** Epoch ms the window closes at. */
8820
- armedUntilMs: number(),
8821
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
8822
- deviceIds: array(number().int()).readonly().nullable()
8823
- });
8824
- /**
8825
8733
  * Ops-log — the durable, append-only operations audit shared by the
8826
8734
  * recordings and events management surfaces.
8827
8735
  *
@@ -9743,6 +9651,21 @@ var StorageCleanupJobSchema = object({
9743
9651
  });
9744
9652
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
9745
9653
  /**
9654
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
9655
+ * alias below is `z.infer<>` of it, never a second spelling.
9656
+ */
9657
+ var StorageLocationModeSchema = _enum([
9658
+ "active",
9659
+ "readonly",
9660
+ "drain",
9661
+ "disabled"
9662
+ ]);
9663
+ _enum([
9664
+ "normal",
9665
+ "never",
9666
+ "drain"
9667
+ ]);
9668
+ /**
9746
9669
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
9747
9670
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
9748
9671
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -9767,8 +9690,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
9767
9690
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
9768
9691
  *
9769
9692
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
9770
- * The default location for a type uses `id === <type>:default` by
9771
- * convention (the bare type ref like `'backups'` resolves to it).
9693
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
9694
+ * There is no default location any more (D383): `enabled` is the whole write
9695
+ * model, and a bare type ref resolves to the sole location of the type, or —
9696
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
9697
+ * slug is `default`.
9772
9698
  *
9773
9699
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
9774
9700
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -9789,23 +9715,37 @@ var StorageLocationSchema = object({
9789
9715
  * flag at upsert time, not here (the schema is provider-agnostic).
9790
9716
  */
9791
9717
  nodeId: string().optional(),
9792
- isDefault: boolean().default(false),
9793
9718
  isSystem: boolean().default(false),
9794
9719
  /**
9795
- * Operator opt-in: whether consumers that BALANCE across several locations
9796
- * of a type may write here. Recordings reads it today; event media and
9797
- * backups are the next consumers, which is why the flag lives on the
9798
- * location rather than in any one addon's store nothing has to be
9799
- * extended to add the next consumer.
9720
+ * THE write switch, and the only one (D383). `enabled: true` means every
9721
+ * consumer that chooses a write target for this type may write here, and all
9722
+ * enabled locations of a type are used TOGETHER; `false` means read-only
9723
+ * still read, still played back, still age-swept, still drained, never
9724
+ * written.
9800
9725
  *
9801
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
9802
- * flag existed reads back with no flag and keeps working exactly as before;
9803
- * that is the whole compat story, and it is why no migration ships with it.
9804
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
9805
- * disk must not silently start writing to it); the default of a type is
9806
- * always stamped `true`.
9726
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
9727
+ * stored" on an update and "born inert unless it is the first location of its
9728
+ * type" on a create. On a PERSISTED row absence is legacy and it means
9729
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
9730
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
9731
+ * stops existing rather than being re-derived on every read.
9807
9732
  */
9808
9733
  enabled: boolean().optional(),
9734
+ /**
9735
+ * THE state of this location (D385), and the only authority on what may be
9736
+ * written, read or evicted here. Interpreted in exactly one place —
9737
+ * `storage-location-mode.ts` — which also folds the legacy
9738
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
9739
+ * ambiguous.
9740
+ *
9741
+ * OPTIONAL only for the wire and for rows written before D385: absence is
9742
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
9743
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
9744
+ * re-derived on every read. `enabled` survives one release as a DERIVED
9745
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
9746
+ * either, so the two cannot disagree.
9747
+ */
9748
+ mode: StorageLocationModeSchema.optional(),
9809
9749
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
9810
9750
  * for node-local locations it can reach) — never persisted, absent when the
9811
9751
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -9813,13 +9753,50 @@ var StorageLocationSchema = object({
9813
9753
  totalBytes: number(),
9814
9754
  availableBytes: number()
9815
9755
  }).nullable().optional(),
9756
+ /**
9757
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9758
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9759
+ * never persisted, never a filesystem walk.
9760
+ *
9761
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9762
+ * location yet — nobody stores here, the owning addon is down, or the first
9763
+ * refresh has not completed. A UI must omit the segment rather than draw it
9764
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9765
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9766
+ * be spelled out loud instead of appearing by accident.
9767
+ *
9768
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9769
+ * about the whole figure rather than about its freshest part.
9770
+ */
9771
+ owned: object({
9772
+ bytes: number().int().nonnegative(),
9773
+ measuredAtMs: number().int().nonnegative()
9774
+ }).optional(),
9816
9775
  createdAt: number(),
9817
9776
  updatedAt: number()
9818
9777
  });
9778
+ object({ isDefault: boolean().optional() });
9779
+ /**
9780
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9781
+ *
9782
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9783
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9784
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9785
+ * operator learns not to believe the screen.
9786
+ */
9787
+ var StorageDrainProgressSchema = object({
9788
+ locationId: string(),
9789
+ startedAtMs: number(),
9790
+ startBytes: number(),
9791
+ bytesRemaining: number(),
9792
+ drained: boolean(),
9793
+ estimatedEmptyAtMs: number().nullable()
9794
+ });
9819
9795
  /**
9820
9796
  * Reference accepted by consumer-facing `api.storage.*` calls.
9821
9797
  * Either:
9822
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
9798
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
9799
+ * (transitionally, the `<type>:default`-slugged row when several exist)
9823
9800
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
9824
9801
  *
9825
9802
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9995,6 +9972,111 @@ var DecoderSessionConfigSchema = object({
9995
9972
  */
9996
9973
  debug: boolean().optional()
9997
9974
  });
9975
+ /**
9976
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9977
+ * an addon declares its channels in.
9978
+ *
9979
+ * ## Two axes, deliberately separated
9980
+ *
9981
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9982
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9983
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9984
+ * and rots silently. So a channel is declared where it is consulted, and the
9985
+ * `log-channels` capability enumerates the declarations.
9986
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9987
+ * thing: the logging settings document on the `system` cap. Two authorities
9988
+ * over the values is the exact defect
9989
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9990
+ * remove; re-introducing it from the cure side would be grotesque.
9991
+ *
9992
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9993
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9994
+ * the hot path with a value somebody actually read, and by
9995
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9996
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9997
+ * disarmed one (D49).
9998
+ *
9999
+ * ## The canonical call shape
10000
+ *
10001
+ * ```ts
10002
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
10003
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
10004
+ * }
10005
+ * ```
10006
+ *
10007
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
10008
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
10009
+ * object literal is never constructed because it lives inside the branch. It
10010
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
10011
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
10012
+ * destination floor (measured at 1.93 ns/call when off).
10013
+ *
10014
+ * ## Why a channel emits at `info`
10015
+ *
10016
+ * `loki-logging.addon.ts` pins the destination default at `info` and
10017
+ * `loki-destination.ts` drops everything below it, so a line emitted at
10018
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
10019
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
10020
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
10021
+ * emits at the channel's declared level, whose schema floor is `info`.
10022
+ */
10023
+ /**
10024
+ * The level a channel writes at once armed.
10025
+ *
10026
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
10027
+ * not leave the process for Loki, and the whole point of arming a channel is
10028
+ * to read it later.
10029
+ */
10030
+ var LogChannelLevelSchema = _enum([
10031
+ "info",
10032
+ "warn",
10033
+ "error"
10034
+ ]);
10035
+ /**
10036
+ * What an addon declares about one channel. No value, no state — a
10037
+ * declaration is inert.
10038
+ */
10039
+ var LogChannelDescriptorSchema = object({
10040
+ /**
10041
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
10042
+ * the addon's short name so an operator reading a channel list can tell who
10043
+ * owns it without a second lookup.
10044
+ */
10045
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
10046
+ /** One sentence: what the operator will SEE after arming it. */
10047
+ description: string().min(1),
10048
+ /** The level its lines are emitted at. Never below `info`. */
10049
+ defaultLevel: LogChannelLevelSchema,
10050
+ /**
10051
+ * Whether this channel can be narrowed to a camera.
10052
+ *
10053
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
10054
+ * consulted with the numeric device id, AND every line the channel admits
10055
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
10056
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
10057
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
10058
+ * the body is the only way to filter.
10059
+ *
10060
+ * A channel whose lines carry the device only in `meta` (or not at all) is
10061
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
10062
+ * the operator narrows to one camera, sees nothing, and concludes the code
10063
+ * path was never taken.
10064
+ */
10065
+ perDevice: boolean()
10066
+ });
10067
+ /**
10068
+ * An armed window over one channel, as the document hands it to a mirror.
10069
+ *
10070
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
10071
+ * expires by itself, which is the one failure a boolean cannot avoid.
10072
+ */
10073
+ var LogChannelWindowSchema = object({
10074
+ channel: string().min(1),
10075
+ /** Epoch ms the window closes at. */
10076
+ armedUntilMs: number(),
10077
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
10078
+ deviceIds: array(number().int()).readonly().nullable()
10079
+ });
9998
10080
  var MODEL_FORMATS = [
9999
10081
  "onnx",
10000
10082
  "coreml",
@@ -23044,7 +23126,7 @@ method(object({
23044
23126
  downloadId: string(),
23045
23127
  offset: number(),
23046
23128
  length: number()
23047
- }), _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({
23129
+ }), _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({
23048
23130
  createdAt: true,
23049
23131
  updatedAt: true
23050
23132
  }), StorageLocationSchema, {
@@ -23056,7 +23138,7 @@ method(object({
23056
23138
  }), _void(), {
23057
23139
  kind: "mutation",
23058
23140
  auth: "admin"
23059
- }), method(object({ id: string() }), object({
23141
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
23060
23142
  ok: boolean(),
23061
23143
  error: string().optional()
23062
23144
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -23126,6 +23208,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
23126
23208
  kind: "mutation",
23127
23209
  auth: "admin"
23128
23210
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
23211
+ /**
23212
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23213
+ * location (D388).
23214
+ *
23215
+ * ## Why this is not `storage-evictable`
23216
+ *
23217
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23218
+ * not, in two ways that both matter and both bite hardest on the locations an
23219
+ * operator most wants a figure for:
23220
+ *
23221
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23222
+ * and `recordingsLow:default` deliberately share one root and evict as one
23223
+ * oldest-first pool, so both answer with the SAME combined total. As an
23224
+ * occupancy figure that double-counts the disk.
23225
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23226
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23227
+ * is retiring and staring at.
23228
+ *
23229
+ * So this is its own contract with its own quantity, and the quantity is
23230
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23231
+ * would ever be willing to delete it. A provider that can only answer
23232
+ * "evictable" must not register here — a number that silently means different
23233
+ * things per class is worse than no number.
23234
+ *
23235
+ * ## Absence is an answer
23236
+ *
23237
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23238
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23239
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23240
+ * consuming side has to be written out loud instead of appearing by accident.
23241
+ *
23242
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23243
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23244
+ */
23245
+ /** One provider's occupancy answer for one location. */
23246
+ var StorageOccupancyReportSchema = object({
23247
+ locationId: string(),
23248
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23249
+ * not net of what it is willing to delete. */
23250
+ ownedBytes: number().int().nonnegative(),
23251
+ /** When the provider last actually measured this. The orchestrator carries it
23252
+ * through so a UI can say how old the figure is instead of implying "now". */
23253
+ measuredAtMs: number().int().nonnegative()
23254
+ });
23255
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
23129
23256
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
23130
23257
  providerId: string().min(1),
23131
23258
  displayName: string().min(1),
@@ -24961,88 +25088,6 @@ onStatusChanged: { data: object({
24961
25088
  volatileStateFields: ["lastUpdated"]
24962
25089
  };
24963
25090
  /**
24964
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24965
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24966
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24967
- * one Home Assistant projection.
24968
- */
24969
- var NetworkLinkStatusSchema = object({
24970
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24971
- type: _enum([
24972
- "wifi",
24973
- "ethernet",
24974
- "cellular",
24975
- "unknown"
24976
- ]),
24977
- /**
24978
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24979
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24980
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24981
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24982
- * SKIP a null rather than coerce it.
24983
- */
24984
- signalPercent: number().min(0).max(100).nullable(),
24985
- /** Raw received signal strength in dBm, when the firmware reports one. */
24986
- rssiDbm: number().optional(),
24987
- /** Network name of a wireless link, when the firmware reports it. */
24988
- ssid: string().optional(),
24989
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24990
- lastUpdated: number()
24991
- });
24992
- var networkLinkCapability = {
24993
- name: "network-link",
24994
- scope: "device",
24995
- deviceNative: true,
24996
- mode: "singleton",
24997
- deviceTypes: [
24998
- DeviceType.Camera,
24999
- DeviceType.Sensor,
25000
- DeviceType.Button,
25001
- DeviceType.Switch,
25002
- DeviceType.Light,
25003
- DeviceType.Lock,
25004
- DeviceType.Siren
25005
- ],
25006
- methods: {},
25007
- events: {
25008
- /**
25009
- * Emitted whenever the cached status changes (a link switch, a signal
25010
- * reading that moved). Mirrored on the parent chain by the
25011
- * DeviceEventPropagator like `battery.onStatusChanged`.
25012
- */
25013
- onStatusChanged: { data: object({
25014
- deviceId: number(),
25015
- status: NetworkLinkStatusSchema
25016
- }) } },
25017
- status: {
25018
- schema: NetworkLinkStatusSchema,
25019
- kind: "push",
25020
- empty: {
25021
- type: "unknown",
25022
- signalPercent: null,
25023
- lastUpdated: 0
25024
- }
25025
- },
25026
- /**
25027
- * Runtime-state slice — every provider stores the same shape under
25028
- * `device.runtimeState['network-link']`, read once by the badge and the
25029
- * Home Assistant projector regardless of the driver.
25030
- */
25031
- runtimeState: NetworkLinkStatusSchema,
25032
- /**
25033
- * Runtime-state durability: **restored** — a link reading is slow to
25034
- * change and a sleeping battery camera may not report for hours; the
25035
- * restored slice is what the badge shows until the next read.
25036
- *
25037
- * See `RuntimeStateDurability`. Enforced by
25038
- * `scripts/check-runtime-state-durability.ts`.
25039
- */
25040
- durability: "restored",
25041
- /** Clock fields: written, but excluded from the compare that decides
25042
- * whether persisting is worth a SQLite commit. */
25043
- volatileStateFields: ["lastUpdated"]
25044
- };
25045
- /**
25046
25091
  * Generic boolean sensor — last-resort fallback when no domain-
25047
25092
  * specific binary cap fits (Home Assistant `binary_sensor` without a
25048
25093
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -28580,6 +28625,369 @@ var nativeObjectDetectionCapability = {
28580
28625
  volatileStateFields: ["lastFetchedAt"]
28581
28626
  };
28582
28627
  /**
28628
+ * `navigation` — a device-scoped capability that natively expresses the FULL
28629
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
28630
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
28631
+ *
28632
+ * Why a NEW cap rather than overloading `ptz`:
28633
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
28634
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
28635
+ * The two are different physical models: PTZ is absolute-position + presets,
28636
+ * navigation is momentary drive nudges + discrete robot ACTIONS
28637
+ * (dock / spot-clean / follow-pet / go-to-point / …).
28638
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
28639
+ * the reverse:
28640
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
28641
+ * / `getOptions`), and
28642
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
28643
+ * robot camera shows up in the existing PTZ control path without every
28644
+ * PTZ provider learning about robots. The mapping lives in the adapter,
28645
+ * not here (see the addon design note):
28646
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
28647
+ * ptz.stop() → navigation.stop()
28648
+ * ptz.goHome() → navigation.runAction('goHome')
28649
+ * ptz.getPresets() → navigation.listActions() (id→preset)
28650
+ * ptz.goToPreset(id) → navigation.runAction(id)
28651
+ *
28652
+ * ## Continuous drive
28653
+ *
28654
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
28655
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
28656
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
28657
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
28658
+ * coalesce them. The UI owns the cadence.
28659
+ *
28660
+ * ## The action dictionary
28661
+ *
28662
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
28663
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
28664
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
28665
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
28666
+ * vendor-specific list. `kind: 'action'` entries are triggered with
28667
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
28668
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
28669
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
28670
+ *
28671
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
28672
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
28673
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
28674
+ * every device handle. A future nodedreame publish adds a typed
28675
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
28676
+ * provider can then swap the raw calls for the typed methods with no change to
28677
+ * THIS contract.
28678
+ */
28679
+ /**
28680
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
28681
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
28682
+ * halts it.
28683
+ *
28684
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
28685
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
28686
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
28687
+ * vector by it (drivers without proportional drive ignore it).
28688
+ *
28689
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
28690
+ * axis alone; an all-undefined nudge is a no-op.
28691
+ */
28692
+ var NavigationMoveCommandSchema = object({
28693
+ pan: number().min(-1).max(1).optional(),
28694
+ tilt: number().min(-1).max(1).optional(),
28695
+ speed: number().min(0).max(1).optional()
28696
+ });
28697
+ /**
28698
+ * The enumerated discrete actions a navigation-capable robot can perform via
28699
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
28700
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
28701
+ * `playSound` (see the `sound` dictionary entries).
28702
+ */
28703
+ var NavigationActionIdSchema = _enum([
28704
+ "goHome",
28705
+ "locate",
28706
+ "spotClean",
28707
+ "findPet",
28708
+ "personFollow",
28709
+ "stop",
28710
+ "startClean",
28711
+ "pauseClean",
28712
+ "dockWash",
28713
+ "autoEmpty",
28714
+ "flashOn",
28715
+ "flashOff"
28716
+ ]);
28717
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28718
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28719
+ /**
28720
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28721
+ * native panel and the PTZ mimic render as a button.
28722
+ *
28723
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28724
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28725
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28726
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28727
+ * - `label` — operator-facing English label.
28728
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28729
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28730
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28731
+ * flips it from config, never by editing code.
28732
+ */
28733
+ var NavigationActionEntrySchema = object({
28734
+ id: string(),
28735
+ kind: NavigationEntryKindSchema,
28736
+ label: string(),
28737
+ icon: string(),
28738
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28739
+ soundId: number().int().optional(),
28740
+ /** Per-device feature flag — render this entry only when true. */
28741
+ enabled: boolean()
28742
+ });
28743
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28744
+ var NavigationPointSchema = object({
28745
+ x: number(),
28746
+ y: number()
28747
+ });
28748
+ /**
28749
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28750
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28751
+ * that are turned on for THIS device. Data-driven: the provider derives these
28752
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28753
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28754
+ * that are not dictionary entries.
28755
+ *
28756
+ * - `move` / `stop` — the momentary drive joystick.
28757
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28758
+ * map-coordinate plumbing is wired.
28759
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28760
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28761
+ * - `light` — the on/off fill-light toggle (works anytime).
28762
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28763
+ * camera-service control; needs an active stream).
28764
+ */
28765
+ var NavigationFeaturesSchema = object({
28766
+ move: boolean(),
28767
+ stop: boolean(),
28768
+ goToPoint: boolean(),
28769
+ runAction: boolean(),
28770
+ playSound: boolean(),
28771
+ light: boolean(),
28772
+ lightMode: boolean()
28773
+ });
28774
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28775
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28776
+ /**
28777
+ * Live navigation state so the UI can reflect what the robot is doing:
28778
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28779
+ * - `following` — person/pet follow is currently armed.
28780
+ * - `flash` — the on-camera fill light is on.
28781
+ * - `lightMode` — auto vs manual fill-light mode.
28782
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28783
+ * `lightMode === 'manual'`.
28784
+ */
28785
+ var NavigationStatusSchema = object({
28786
+ mode: _enum([
28787
+ "idle",
28788
+ "cleaning",
28789
+ "spot",
28790
+ "following",
28791
+ "goto",
28792
+ "returning",
28793
+ "paused",
28794
+ "unknown"
28795
+ ]),
28796
+ following: boolean(),
28797
+ flash: boolean(),
28798
+ lightMode: NavigationLightModeSchema,
28799
+ lightLevel: number().min(40).max(100),
28800
+ /** Ms epoch when the slice was last updated. */
28801
+ lastChangedAt: number()
28802
+ });
28803
+ /**
28804
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28805
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28806
+ * convention.
28807
+ */
28808
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28809
+ var navigationCapability = {
28810
+ name: "navigation",
28811
+ scope: "device",
28812
+ deviceNative: true,
28813
+ mode: "singleton",
28814
+ deviceTypes: [DeviceType.Camera],
28815
+ deviceConfig: { ui: {
28816
+ kind: "widget",
28817
+ widgetId: "host/navigation-panel",
28818
+ tab: "navigation",
28819
+ topTab: true,
28820
+ label: "Navigation",
28821
+ order: 0
28822
+ } },
28823
+ methods: {
28824
+ /**
28825
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28826
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28827
+ * path) works for any authenticated user, not admin-only. The UI sends
28828
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28829
+ * a single drive write WITHOUT debouncing.
28830
+ */
28831
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28832
+ /** Halt all motion immediately (zero drive vector). */
28833
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28834
+ /** Send the robot to a point on its live map. */
28835
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28836
+ /**
28837
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28838
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28839
+ */
28840
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28841
+ /**
28842
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28843
+ * unsupported action ids are rejected by the provider.
28844
+ */
28845
+ runAction: method(object({
28846
+ deviceId: number(),
28847
+ actionId: NavigationActionIdSchema
28848
+ }), _void(), { kind: "mutation" }),
28849
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28850
+ playSound: method(object({
28851
+ deviceId: number(),
28852
+ soundId: number().int()
28853
+ }), _void(), { kind: "mutation" }),
28854
+ /**
28855
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28856
+ * works anytime, no active stream required).
28857
+ */
28858
+ setLightOn: method(object({
28859
+ deviceId: number(),
28860
+ on: boolean()
28861
+ }), _void(), { kind: "mutation" }),
28862
+ /**
28863
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28864
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28865
+ * action that generally needs an active camera stream/monitor session — the
28866
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28867
+ */
28868
+ setLightMode: method(object({
28869
+ deviceId: number(),
28870
+ mode: NavigationLightModeSchema,
28871
+ level: number().min(40).max(100).optional()
28872
+ }), _void(), { kind: "mutation" }),
28873
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28874
+ setLightLevel: method(object({
28875
+ deviceId: number(),
28876
+ level: number().min(40).max(100)
28877
+ }), _void(), { kind: "mutation" }),
28878
+ /**
28879
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28880
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28881
+ * `listActions`).
28882
+ */
28883
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28884
+ },
28885
+ events: { onStatusChanged: { data: object({
28886
+ deviceId: number(),
28887
+ status: NavigationStatusSchema
28888
+ }) } },
28889
+ status: {
28890
+ schema: NavigationStatusSchema,
28891
+ kind: "push"
28892
+ },
28893
+ /**
28894
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28895
+ * for live mode / follow / flash changes.
28896
+ */
28897
+ runtimeState: NavigationRuntimeStateSchema,
28898
+ /**
28899
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28900
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28901
+ * that. The live handle re-publishes on connect.
28902
+ *
28903
+ * See `RuntimeStateDurability`. Enforced by
28904
+ * `scripts/check-runtime-state-durability.ts`.
28905
+ */
28906
+ durability: "session"
28907
+ };
28908
+ /**
28909
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28910
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28911
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28912
+ * one Home Assistant projection.
28913
+ */
28914
+ var NetworkLinkStatusSchema = object({
28915
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28916
+ type: _enum([
28917
+ "wifi",
28918
+ "ethernet",
28919
+ "cellular",
28920
+ "unknown"
28921
+ ]),
28922
+ /**
28923
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28924
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28925
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28926
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28927
+ * SKIP a null rather than coerce it.
28928
+ */
28929
+ signalPercent: number().min(0).max(100).nullable(),
28930
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28931
+ rssiDbm: number().optional(),
28932
+ /** Network name of a wireless link, when the firmware reports it. */
28933
+ ssid: string().optional(),
28934
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28935
+ lastUpdated: number()
28936
+ });
28937
+ var networkLinkCapability = {
28938
+ name: "network-link",
28939
+ scope: "device",
28940
+ deviceNative: true,
28941
+ mode: "singleton",
28942
+ deviceTypes: [
28943
+ DeviceType.Camera,
28944
+ DeviceType.Sensor,
28945
+ DeviceType.Button,
28946
+ DeviceType.Switch,
28947
+ DeviceType.Light,
28948
+ DeviceType.Lock,
28949
+ DeviceType.Siren
28950
+ ],
28951
+ methods: {},
28952
+ events: {
28953
+ /**
28954
+ * Emitted whenever the cached status changes (a link switch, a signal
28955
+ * reading that moved). Mirrored on the parent chain by the
28956
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28957
+ */
28958
+ onStatusChanged: { data: object({
28959
+ deviceId: number(),
28960
+ status: NetworkLinkStatusSchema
28961
+ }) } },
28962
+ status: {
28963
+ schema: NetworkLinkStatusSchema,
28964
+ kind: "push",
28965
+ empty: {
28966
+ type: "unknown",
28967
+ signalPercent: null,
28968
+ lastUpdated: 0
28969
+ }
28970
+ },
28971
+ /**
28972
+ * Runtime-state slice — every provider stores the same shape under
28973
+ * `device.runtimeState['network-link']`, read once by the badge and the
28974
+ * Home Assistant projector regardless of the driver.
28975
+ */
28976
+ runtimeState: NetworkLinkStatusSchema,
28977
+ /**
28978
+ * Runtime-state durability: **restored** — a link reading is slow to
28979
+ * change and a sleeping battery camera may not report for hours; the
28980
+ * restored slice is what the badge shows until the next read.
28981
+ *
28982
+ * See `RuntimeStateDurability`. Enforced by
28983
+ * `scripts/check-runtime-state-durability.ts`.
28984
+ */
28985
+ durability: "restored",
28986
+ /** Clock fields: written, but excluded from the compare that decides
28987
+ * whether persisting is worth a SQLite commit. */
28988
+ volatileStateFields: ["lastUpdated"]
28989
+ };
28990
+ /**
28583
28991
  * network-quality — system-scoped singleton capability tracking RTT,
28584
28992
  * jitter, and observed/peak bandwidth per device + per client.
28585
28993
  *
@@ -30160,287 +30568,6 @@ var ptzAutotrackCapability = {
30160
30568
  */
30161
30569
  durability: "session"
30162
30570
  };
30163
- /**
30164
- * `navigation` — a device-scoped capability that natively expresses the FULL
30165
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
30166
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
30167
- *
30168
- * Why a NEW cap rather than overloading `ptz`:
30169
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30170
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30171
- * The two are different physical models: PTZ is absolute-position + presets,
30172
- * navigation is momentary drive nudges + discrete robot ACTIONS
30173
- * (dock / spot-clean / follow-pet / go-to-point / …).
30174
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30175
- * the reverse:
30176
- * 1. a native CamStack navigation panel (data-driven from `listActions`
30177
- * / `getOptions`), and
30178
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30179
- * robot camera shows up in the existing PTZ control path without every
30180
- * PTZ provider learning about robots. The mapping lives in the adapter,
30181
- * not here (see the addon design note):
30182
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30183
- * ptz.stop() → navigation.stop()
30184
- * ptz.goHome() → navigation.runAction('goHome')
30185
- * ptz.getPresets() → navigation.listActions() (id→preset)
30186
- * ptz.goToPreset(id) → navigation.runAction(id)
30187
- *
30188
- * ## Continuous drive
30189
- *
30190
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30191
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30192
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30193
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30194
- * coalesce them. The UI owns the cadence.
30195
- *
30196
- * ## The action dictionary
30197
- *
30198
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30199
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30200
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30201
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30202
- * vendor-specific list. `kind: 'action'` entries are triggered with
30203
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30204
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
30205
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30206
- *
30207
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30208
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30209
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
30210
- * every device handle. A future nodedreame publish adds a typed
30211
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30212
- * provider can then swap the raw calls for the typed methods with no change to
30213
- * THIS contract.
30214
- */
30215
- /**
30216
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30217
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30218
- * halts it.
30219
- *
30220
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
30221
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30222
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30223
- * vector by it (drivers without proportional drive ignore it).
30224
- *
30225
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30226
- * axis alone; an all-undefined nudge is a no-op.
30227
- */
30228
- var NavigationMoveCommandSchema = object({
30229
- pan: number().min(-1).max(1).optional(),
30230
- tilt: number().min(-1).max(1).optional(),
30231
- speed: number().min(0).max(1).optional()
30232
- });
30233
- /**
30234
- * The enumerated discrete actions a navigation-capable robot can perform via
30235
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30236
- * subset it supports through `listActions`. Sounds are NOT here — they go through
30237
- * `playSound` (see the `sound` dictionary entries).
30238
- */
30239
- var NavigationActionIdSchema = _enum([
30240
- "goHome",
30241
- "locate",
30242
- "spotClean",
30243
- "findPet",
30244
- "personFollow",
30245
- "stop",
30246
- "startClean",
30247
- "pauseClean",
30248
- "dockWash",
30249
- "autoEmpty",
30250
- "flashOn",
30251
- "flashOff"
30252
- ]);
30253
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30254
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
30255
- /**
30256
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30257
- * native panel and the PTZ mimic render as a button.
30258
- *
30259
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30260
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30261
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
30262
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30263
- * - `label` — operator-facing English label.
30264
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30265
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30266
- * PTZ render ONLY enabled entries. Data-driven: the provider
30267
- * flips it from config, never by editing code.
30268
- */
30269
- var NavigationActionEntrySchema = object({
30270
- id: string(),
30271
- kind: NavigationEntryKindSchema,
30272
- label: string(),
30273
- icon: string(),
30274
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30275
- soundId: number().int().optional(),
30276
- /** Per-device feature flag — render this entry only when true. */
30277
- enabled: boolean()
30278
- });
30279
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
30280
- var NavigationPointSchema = object({
30281
- x: number(),
30282
- y: number()
30283
- });
30284
- /**
30285
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30286
- * The cap reports which are enabled so the UI / PTZ render only the controls
30287
- * that are turned on for THIS device. Data-driven: the provider derives these
30288
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30289
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30290
- * that are not dictionary entries.
30291
- *
30292
- * - `move` / `stop` — the momentary drive joystick.
30293
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30294
- * map-coordinate plumbing is wired.
30295
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30296
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30297
- * - `light` — the on/off fill-light toggle (works anytime).
30298
- * - `lightMode` — the auto/manual selector + manual level slider (a
30299
- * camera-service control; needs an active stream).
30300
- */
30301
- var NavigationFeaturesSchema = object({
30302
- move: boolean(),
30303
- stop: boolean(),
30304
- goToPoint: boolean(),
30305
- runAction: boolean(),
30306
- playSound: boolean(),
30307
- light: boolean(),
30308
- lightMode: boolean()
30309
- });
30310
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30311
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30312
- /**
30313
- * Live navigation state so the UI can reflect what the robot is doing:
30314
- * - `mode` — coarse activity (idle / cleaning / following / …).
30315
- * - `following` — person/pet follow is currently armed.
30316
- * - `flash` — the on-camera fill light is on.
30317
- * - `lightMode` — auto vs manual fill-light mode.
30318
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30319
- * `lightMode === 'manual'`.
30320
- */
30321
- var NavigationStatusSchema = object({
30322
- mode: _enum([
30323
- "idle",
30324
- "cleaning",
30325
- "spot",
30326
- "following",
30327
- "goto",
30328
- "returning",
30329
- "paused",
30330
- "unknown"
30331
- ]),
30332
- following: boolean(),
30333
- flash: boolean(),
30334
- lightMode: NavigationLightModeSchema,
30335
- lightLevel: number().min(40).max(100),
30336
- /** Ms epoch when the slice was last updated. */
30337
- lastChangedAt: number()
30338
- });
30339
- /**
30340
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30341
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30342
- * convention.
30343
- */
30344
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30345
- var navigationCapability = {
30346
- name: "navigation",
30347
- scope: "device",
30348
- deviceNative: true,
30349
- mode: "singleton",
30350
- deviceTypes: [DeviceType.Camera],
30351
- deviceConfig: { ui: {
30352
- kind: "widget",
30353
- widgetId: "host/navigation-panel",
30354
- tab: "navigation",
30355
- topTab: true,
30356
- label: "Navigation",
30357
- order: 0
30358
- } },
30359
- methods: {
30360
- /**
30361
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30362
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30363
- * path) works for any authenticated user, not admin-only. The UI sends
30364
- * these at ~1 Hz while a control is held; the provider forwards each one to
30365
- * a single drive write WITHOUT debouncing.
30366
- */
30367
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30368
- /** Halt all motion immediately (zero drive vector). */
30369
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30370
- /** Send the robot to a point on its live map. */
30371
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30372
- /**
30373
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30374
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30375
- */
30376
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30377
- /**
30378
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30379
- * unsupported action ids are rejected by the provider.
30380
- */
30381
- runAction: method(object({
30382
- deviceId: number(),
30383
- actionId: NavigationActionIdSchema
30384
- }), _void(), { kind: "mutation" }),
30385
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30386
- playSound: method(object({
30387
- deviceId: number(),
30388
- soundId: number().int()
30389
- }), _void(), { kind: "mutation" }),
30390
- /**
30391
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30392
- * works anytime, no active stream required).
30393
- */
30394
- setLightOn: method(object({
30395
- deviceId: number(),
30396
- on: boolean()
30397
- }), _void(), { kind: "mutation" }),
30398
- /**
30399
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30400
- * initial `level`. The auto/manual + level control is a CAMERA-service
30401
- * action that generally needs an active camera stream/monitor session — the
30402
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30403
- */
30404
- setLightMode: method(object({
30405
- deviceId: number(),
30406
- mode: NavigationLightModeSchema,
30407
- level: number().min(40).max(100).optional()
30408
- }), _void(), { kind: "mutation" }),
30409
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30410
- setLightLevel: method(object({
30411
- deviceId: number(),
30412
- level: number().min(40).max(100)
30413
- }), _void(), { kind: "mutation" }),
30414
- /**
30415
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30416
- * controls the UI shows (the per-entry flags for the dictionary come back on
30417
- * `listActions`).
30418
- */
30419
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30420
- },
30421
- events: { onStatusChanged: { data: object({
30422
- deviceId: number(),
30423
- status: NavigationStatusSchema
30424
- }) } },
30425
- status: {
30426
- schema: NavigationStatusSchema,
30427
- kind: "push"
30428
- },
30429
- /**
30430
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30431
- * for live mode / follow / flash changes.
30432
- */
30433
- runtimeState: NavigationRuntimeStateSchema,
30434
- /**
30435
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30436
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30437
- * that. The live handle re-publishes on connect.
30438
- *
30439
- * See `RuntimeStateDurability`. Enforced by
30440
- * `scripts/check-runtime-state-durability.ts`.
30441
- */
30442
- durability: "session"
30443
- };
30444
30571
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30445
30572
  kind: "mutation",
30446
30573
  auth: "admin"
@@ -39897,13 +40024,13 @@ Object.freeze({
39897
40024
  addonId: null,
39898
40025
  access: "view"
39899
40026
  },
39900
- "storage.getDefaultLocation": {
40027
+ "storage.list": {
39901
40028
  capName: "storage",
39902
40029
  capScope: "system",
39903
40030
  addonId: null,
39904
40031
  access: "view"
39905
40032
  },
39906
- "storage.list": {
40033
+ "storage.listDrainProgress": {
39907
40034
  capName: "storage",
39908
40035
  capScope: "system",
39909
40036
  addonId: null,
@@ -40053,6 +40180,12 @@ Object.freeze({
40053
40180
  addonId: null,
40054
40181
  access: "view"
40055
40182
  },
40183
+ "storageOccupancy.getOccupancy": {
40184
+ capName: "storage-occupancy",
40185
+ capScope: "system",
40186
+ addonId: null,
40187
+ access: "view"
40188
+ },
40056
40189
  "storageProvider.abortUpload": {
40057
40190
  capName: "storage-provider",
40058
40191
  capScope: "system",