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