@camstack/addon-post-analysis 1.2.196 → 1.2.198

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.
@@ -29,7 +29,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  enumerable: true
30
30
  }) : target, mod));
31
31
  //#endregion
32
- //#region ../types/dist/event-category-zAv7pMUz.mjs
32
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
33
33
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
34
34
  EventCategory["SystemBoot"] = "system.boot";
35
35
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -224,6 +224,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
224
224
  EventCategory["ProcessCrashed"] = "process.crashed";
225
225
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
226
226
  EventCategory["ProcessRestarted"] = "process.restarted";
227
+ /**
228
+ * The SET of storage locations changed — one was created, edited, enabled,
229
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
230
+ *
231
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
232
+ * it must also converge on its own periodic path, because a dropped event
233
+ * must not leave a node writing to yesterday's disk set forever. It exists
234
+ * because there was NO signal at all — an operator who added a second
235
+ * recordings disk in the admin UI got nothing, and the recorder kept its
236
+ * resolved locations until something else happened to re-resolve them
237
+ * (D387). Payload `StorageLocationsChangedPayload`.
238
+ */
239
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
227
240
  EventCategory["RecordingStarted"] = "recording.started";
228
241
  EventCategory["RecordingStopped"] = "recording.stopped";
229
242
  EventCategory["RecordingError"] = "recording.error";
@@ -7841,111 +7854,6 @@ var CameraSwitchGroupSchema = object({
7841
7854
  */
7842
7855
  var DETECTION_PIPELINE_CAP_NAME = "detection-pipeline";
7843
7856
  /**
7844
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7845
- * an addon declares its channels in.
7846
- *
7847
- * ## Two axes, deliberately separated
7848
- *
7849
- * - **DECLARATION** — which channels exist. Only the addon knows:
7850
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7851
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7852
- * and rots silently. So a channel is declared where it is consulted, and the
7853
- * `log-channels` capability enumerates the declarations.
7854
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7855
- * thing: the logging settings document on the `system` cap. Two authorities
7856
- * over the values is the exact defect
7857
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7858
- * remove; re-introducing it from the cure side would be grotesque.
7859
- *
7860
- * Nothing in this file reads a clock, an env var or a store. The registry is
7861
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7862
- * the hot path with a value somebody actually read, and by
7863
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7864
- * never reaches here, so it can neither disarm an armed channel nor arm a
7865
- * disarmed one (D49).
7866
- *
7867
- * ## The canonical call shape
7868
- *
7869
- * ```ts
7870
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7871
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7872
- * }
7873
- * ```
7874
- *
7875
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7876
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7877
- * object literal is never constructed because it lives inside the branch. It
7878
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7879
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7880
- * destination floor (measured at 1.93 ns/call when off).
7881
- *
7882
- * ## Why a channel emits at `info`
7883
- *
7884
- * `loki-logging.addon.ts` pins the destination default at `info` and
7885
- * `loki-destination.ts` drops everything below it, so a line emitted at
7886
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7887
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7888
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7889
- * emits at the channel's declared level, whose schema floor is `info`.
7890
- */
7891
- /**
7892
- * The level a channel writes at once armed.
7893
- *
7894
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7895
- * not leave the process for Loki, and the whole point of arming a channel is
7896
- * to read it later.
7897
- */
7898
- var LogChannelLevelSchema = _enum([
7899
- "info",
7900
- "warn",
7901
- "error"
7902
- ]);
7903
- /**
7904
- * What an addon declares about one channel. No value, no state — a
7905
- * declaration is inert.
7906
- */
7907
- var LogChannelDescriptorSchema = object({
7908
- /**
7909
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7910
- * the addon's short name so an operator reading a channel list can tell who
7911
- * owns it without a second lookup.
7912
- */
7913
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7914
- /** One sentence: what the operator will SEE after arming it. */
7915
- description: string().min(1),
7916
- /** The level its lines are emitted at. Never below `info`. */
7917
- defaultLevel: LogChannelLevelSchema,
7918
- /**
7919
- * Whether this channel can be narrowed to a camera.
7920
- *
7921
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7922
- * consulted with the numeric device id, AND every line the channel admits
7923
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7924
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7925
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7926
- * the body is the only way to filter.
7927
- *
7928
- * A channel whose lines carry the device only in `meta` (or not at all) is
7929
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7930
- * the operator narrows to one camera, sees nothing, and concludes the code
7931
- * path was never taken.
7932
- */
7933
- perDevice: boolean()
7934
- });
7935
- /**
7936
- * An armed window over one channel, as the document hands it to a mirror.
7937
- *
7938
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7939
- * expires by itself, which is the one failure a boolean cannot avoid.
7940
- */
7941
- var LogChannelWindowSchema = object({
7942
- channel: string().min(1),
7943
- /** Epoch ms the window closes at. */
7944
- armedUntilMs: number(),
7945
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7946
- deviceIds: array(number().int()).readonly().nullable()
7947
- });
7948
- /**
7949
7857
  * Ops-log — the durable, append-only operations audit shared by the
7950
7858
  * recordings and events management surfaces.
7951
7859
  *
@@ -8916,6 +8824,100 @@ var StorageCleanupJobSchema = object({
8916
8824
  });
8917
8825
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8918
8826
  /**
8827
+ * The storage-location STATE MODEL (D385) — one typed state, one policy module.
8828
+ *
8829
+ * A location's state used to be split across two authorities: the typed
8830
+ * `enabled` field (THE write switch since D383) and an untyped `config.readOnly`
8831
+ * key. They did not mean the same thing — `enabled: false` was still evicted
8832
+ * under disk pressure while `config.readOnly` was deliberately excluded — and
8833
+ * neither name said which. Every consumer re-derived the difference, and the
8834
+ * three questions that actually matter were answered in six places.
8835
+ *
8836
+ * This module is the ONLY place in the repo allowed to interpret the state. It
8837
+ * answers three questions and nothing else:
8838
+ *
8839
+ * - may this location be WRITTEN to? {@link modeMayWrite}
8840
+ * - may this location be READ? {@link modeMayRead}
8841
+ * - what is its eviction policy? {@link evictionPolicyForMode}
8842
+ *
8843
+ * | mode | write | read | eviction |
8844
+ * | ---------- | ----- | ---- | ------------------------------ |
8845
+ * | `active` | yes | yes | `normal` (pressure + usage cap) |
8846
+ * | `readonly` | no | yes | `never` |
8847
+ * | `drain` | no | yes | `drain` (paced, until empty) |
8848
+ * | `disabled` | no | no | `never` |
8849
+ *
8850
+ * `scripts/check-storage-location-mode-single-owner.ts` fails the build when
8851
+ * anything outside this module reads `config['readOnly']` or compares `enabled`
8852
+ * directly. A rule nothing checks has already been broken somewhere.
8853
+ */
8854
+ var STORAGE_LOCATION_MODES = [
8855
+ "active",
8856
+ "readonly",
8857
+ "drain",
8858
+ "disabled"
8859
+ ];
8860
+ /**
8861
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8862
+ * alias below is `z.infer<>` of it, never a second spelling.
8863
+ */
8864
+ var StorageLocationModeSchema = _enum(STORAGE_LOCATION_MODES);
8865
+ _enum([
8866
+ "normal",
8867
+ "never",
8868
+ "drain"
8869
+ ]);
8870
+ /** Is this mode a write target? Only `active` is. */
8871
+ function modeMayWrite(mode) {
8872
+ return mode === "active";
8873
+ }
8874
+ /** What eviction may do here. See {@link StorageEvictionPolicy}. */
8875
+ function evictionPolicyForMode(mode) {
8876
+ switch (mode) {
8877
+ case "active": return "normal";
8878
+ case "drain": return "drain";
8879
+ case "readonly":
8880
+ case "disabled": return "never";
8881
+ }
8882
+ }
8883
+ /**
8884
+ * The mode a LEGACY row implies, or `null` when it implies nothing — the row is
8885
+ * already stamped, or it carried neither flag.
8886
+ *
8887
+ * Both legacy flags fold to `readonly`, which is the CONSERVATIVE direction: a
8888
+ * state change must never start deleting footage on its own, and it must never
8889
+ * make footage that was still being served disappear. `enabled: false` used to
8890
+ * leave the location evictable under pressure; folding it to `readonly` stops
8891
+ * that, which is a strictly safer answer than the one it replaces.
8892
+ */
8893
+ function legacyModeOf(location) {
8894
+ if (location.mode !== void 0) return null;
8895
+ if (location.config["readOnly"] === true) return "readonly";
8896
+ if (location.enabled === false) return "readonly";
8897
+ return null;
8898
+ }
8899
+ /**
8900
+ * The state of a location, stamped or folded. THE one interpretation: a row
8901
+ * that predates D385 is never ambiguous, and a stamped `mode` always wins over
8902
+ * whatever the legacy pair still says.
8903
+ */
8904
+ function resolveLocationMode(location) {
8905
+ return (isStorageLocationMode(location.mode) ? location.mode : void 0) ?? legacyModeOf(location) ?? "active";
8906
+ }
8907
+ /** Is this one of the four states? The stamped value crosses a wire, and a
8908
+ * value nobody defined must not be rendered as if it were a state. */
8909
+ function isStorageLocationMode(value) {
8910
+ return STORAGE_LOCATION_MODES.some((mode) => mode === value);
8911
+ }
8912
+ /** May this location be written to? */
8913
+ function mayWriteToLocation(location) {
8914
+ return modeMayWrite(resolveLocationMode(location));
8915
+ }
8916
+ /** What eviction may do to this location. */
8917
+ function evictionPolicyOfLocation(location) {
8918
+ return evictionPolicyForMode(resolveLocationMode(location));
8919
+ }
8920
+ /**
8919
8921
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8920
8922
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8921
8923
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8940,8 +8942,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8940
8942
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8941
8943
  *
8942
8944
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8943
- * The default location for a type uses `id === <type>:default` by
8944
- * convention (the bare type ref like `'backups'` resolves to it).
8945
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8946
+ * There is no default location any more (D383): `enabled` is the whole write
8947
+ * model, and a bare type ref resolves to the sole location of the type, or —
8948
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8949
+ * slug is `default`.
8945
8950
  *
8946
8951
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8947
8952
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8962,23 +8967,37 @@ var StorageLocationSchema = object({
8962
8967
  * flag at upsert time, not here (the schema is provider-agnostic).
8963
8968
  */
8964
8969
  nodeId: string().optional(),
8965
- isDefault: boolean().default(false),
8966
8970
  isSystem: boolean().default(false),
8967
8971
  /**
8968
- * Operator opt-in: whether consumers that BALANCE across several locations
8969
- * of a type may write here. Recordings reads it today; event media and
8970
- * backups are the next consumers, which is why the flag lives on the
8971
- * location rather than in any one addon's store nothing has to be
8972
- * extended to add the next consumer.
8972
+ * THE write switch, and the only one (D383). `enabled: true` means every
8973
+ * consumer that chooses a write target for this type may write here, and all
8974
+ * enabled locations of a type are used TOGETHER; `false` means read-only
8975
+ * still read, still played back, still age-swept, still drained, never
8976
+ * written.
8973
8977
  *
8974
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8975
- * flag existed reads back with no flag and keeps working exactly as before;
8976
- * that is the whole compat story, and it is why no migration ships with it.
8977
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8978
- * disk must not silently start writing to it); the default of a type is
8979
- * always stamped `true`.
8978
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8979
+ * stored" on an update and "born inert unless it is the first location of its
8980
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8981
+ * enabled {@link isLocationEnabled} is the one place that says so, and the
8982
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8983
+ * stops existing rather than being re-derived on every read.
8980
8984
  */
8981
8985
  enabled: boolean().optional(),
8986
+ /**
8987
+ * THE state of this location (D385), and the only authority on what may be
8988
+ * written, read or evicted here. Interpreted in exactly one place —
8989
+ * `storage-location-mode.ts` — which also folds the legacy
8990
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8991
+ * ambiguous.
8992
+ *
8993
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8994
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8995
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8996
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8997
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8998
+ * either, so the two cannot disagree.
8999
+ */
9000
+ mode: StorageLocationModeSchema.optional(),
8982
9001
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8983
9002
  * for node-local locations it can reach) — never persisted, absent when the
8984
9003
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8986,13 +9005,50 @@ var StorageLocationSchema = object({
8986
9005
  totalBytes: number(),
8987
9006
  availableBytes: number()
8988
9007
  }).nullable().optional(),
9008
+ /**
9009
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
9010
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
9011
+ * never persisted, never a filesystem walk.
9012
+ *
9013
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
9014
+ * location yet — nobody stores here, the owning addon is down, or the first
9015
+ * refresh has not completed. A UI must omit the segment rather than draw it
9016
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
9017
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
9018
+ * be spelled out loud instead of appearing by accident.
9019
+ *
9020
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
9021
+ * about the whole figure rather than about its freshest part.
9022
+ */
9023
+ owned: object({
9024
+ bytes: number().int().nonnegative(),
9025
+ measuredAtMs: number().int().nonnegative()
9026
+ }).optional(),
8989
9027
  createdAt: number(),
8990
9028
  updatedAt: number()
8991
9029
  });
9030
+ object({ isDefault: boolean().optional() });
9031
+ /**
9032
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
9033
+ *
9034
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
9035
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
9036
+ * drain with no observed growth has no honest ETA, and inventing one is how an
9037
+ * operator learns not to believe the screen.
9038
+ */
9039
+ var StorageDrainProgressSchema = object({
9040
+ locationId: string(),
9041
+ startedAtMs: number(),
9042
+ startBytes: number(),
9043
+ bytesRemaining: number(),
9044
+ drained: boolean(),
9045
+ estimatedEmptyAtMs: number().nullable()
9046
+ });
8992
9047
  /**
8993
9048
  * Reference accepted by consumer-facing `api.storage.*` calls.
8994
9049
  * Either:
8995
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
9050
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
9051
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8996
9052
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8997
9053
  *
8998
9054
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9169,6 +9225,111 @@ var DecoderSessionConfigSchema = object({
9169
9225
  debug: boolean().optional()
9170
9226
  });
9171
9227
  /**
9228
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9229
+ * an addon declares its channels in.
9230
+ *
9231
+ * ## Two axes, deliberately separated
9232
+ *
9233
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9234
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9235
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9236
+ * and rots silently. So a channel is declared where it is consulted, and the
9237
+ * `log-channels` capability enumerates the declarations.
9238
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9239
+ * thing: the logging settings document on the `system` cap. Two authorities
9240
+ * over the values is the exact defect
9241
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9242
+ * remove; re-introducing it from the cure side would be grotesque.
9243
+ *
9244
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9245
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9246
+ * the hot path with a value somebody actually read, and by
9247
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9248
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9249
+ * disarmed one (D49).
9250
+ *
9251
+ * ## The canonical call shape
9252
+ *
9253
+ * ```ts
9254
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9255
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9256
+ * }
9257
+ * ```
9258
+ *
9259
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9260
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9261
+ * object literal is never constructed because it lives inside the branch. It
9262
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9263
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9264
+ * destination floor (measured at 1.93 ns/call when off).
9265
+ *
9266
+ * ## Why a channel emits at `info`
9267
+ *
9268
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9269
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9270
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9271
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9272
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9273
+ * emits at the channel's declared level, whose schema floor is `info`.
9274
+ */
9275
+ /**
9276
+ * The level a channel writes at once armed.
9277
+ *
9278
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9279
+ * not leave the process for Loki, and the whole point of arming a channel is
9280
+ * to read it later.
9281
+ */
9282
+ var LogChannelLevelSchema = _enum([
9283
+ "info",
9284
+ "warn",
9285
+ "error"
9286
+ ]);
9287
+ /**
9288
+ * What an addon declares about one channel. No value, no state — a
9289
+ * declaration is inert.
9290
+ */
9291
+ var LogChannelDescriptorSchema = object({
9292
+ /**
9293
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9294
+ * the addon's short name so an operator reading a channel list can tell who
9295
+ * owns it without a second lookup.
9296
+ */
9297
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9298
+ /** One sentence: what the operator will SEE after arming it. */
9299
+ description: string().min(1),
9300
+ /** The level its lines are emitted at. Never below `info`. */
9301
+ defaultLevel: LogChannelLevelSchema,
9302
+ /**
9303
+ * Whether this channel can be narrowed to a camera.
9304
+ *
9305
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9306
+ * consulted with the numeric device id, AND every line the channel admits
9307
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9308
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9309
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9310
+ * the body is the only way to filter.
9311
+ *
9312
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9313
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9314
+ * the operator narrows to one camera, sees nothing, and concludes the code
9315
+ * path was never taken.
9316
+ */
9317
+ perDevice: boolean()
9318
+ });
9319
+ /**
9320
+ * An armed window over one channel, as the document hands it to a mirror.
9321
+ *
9322
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9323
+ * expires by itself, which is the one failure a boolean cannot avoid.
9324
+ */
9325
+ var LogChannelWindowSchema = object({
9326
+ channel: string().min(1),
9327
+ /** Epoch ms the window closes at. */
9328
+ armedUntilMs: number(),
9329
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9330
+ deviceIds: array(number().int()).readonly().nullable()
9331
+ });
9332
+ /**
9172
9333
  * Distinct (device, family, variant) counters one instance will hold.
9173
9334
  *
9174
9335
  * A large fleet x the handful of families any single addon reports, with
@@ -23514,7 +23675,7 @@ method(object({
23514
23675
  downloadId: string(),
23515
23676
  offset: number(),
23516
23677
  length: number()
23517
- }), _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({
23678
+ }), _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({
23518
23679
  createdAt: true,
23519
23680
  updatedAt: true
23520
23681
  }), StorageLocationSchema, {
@@ -23526,7 +23687,7 @@ method(object({
23526
23687
  }), _void(), {
23527
23688
  kind: "mutation",
23528
23689
  auth: "admin"
23529
- }), method(object({ id: string() }), object({
23690
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
23530
23691
  ok: boolean(),
23531
23692
  error: string().optional()
23532
23693
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -23596,6 +23757,71 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
23596
23757
  kind: "mutation",
23597
23758
  auth: "admin"
23598
23759
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
23760
+ /**
23761
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
23762
+ * location (D388).
23763
+ *
23764
+ * ## Why this is not `storage-evictable`
23765
+ *
23766
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
23767
+ * not, in two ways that both matter and both bite hardest on the locations an
23768
+ * operator most wants a figure for:
23769
+ *
23770
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
23771
+ * and `recordingsLow:default` deliberately share one root and evict as one
23772
+ * oldest-first pool, so both answer with the SAME combined total. As an
23773
+ * occupancy figure that double-counts the disk.
23774
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
23775
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
23776
+ * is retiring and staring at.
23777
+ *
23778
+ * So this is its own contract with its own quantity, and the quantity is
23779
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
23780
+ * would ever be willing to delete it. A provider that can only answer
23781
+ * "evictable" must not register here — a number that silently means different
23782
+ * things per class is worse than no number.
23783
+ *
23784
+ * ## Absence is an answer
23785
+ *
23786
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
23787
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
23788
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
23789
+ * consuming side has to be written out loud instead of appearing by accident.
23790
+ *
23791
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
23792
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
23793
+ */
23794
+ /** One provider's occupancy answer for one location. */
23795
+ var StorageOccupancyReportSchema = object({
23796
+ locationId: string(),
23797
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
23798
+ * not net of what it is willing to delete. */
23799
+ ownedBytes: number().int().nonnegative(),
23800
+ /** When the provider last actually measured this. The orchestrator carries it
23801
+ * through so a UI can say how old the figure is instead of implying "now". */
23802
+ measuredAtMs: number().int().nonnegative()
23803
+ });
23804
+ var storageOccupancyCapability = {
23805
+ name: "storage-occupancy",
23806
+ scope: "system",
23807
+ mode: "collection",
23808
+ internal: true,
23809
+ methods: {
23810
+ /**
23811
+ * Occupancy for the given locations, in ONE round trip.
23812
+ *
23813
+ * A provider answers only for the locations it actually holds bytes on and
23814
+ * OMITS the rest — an omitted location is "I hold nothing measurable here",
23815
+ * which the orchestrator merges as a contribution of nothing rather than as
23816
+ * a claim that the location is empty. Only a location no provider reports
23817
+ * at all stays unknown.
23818
+ *
23819
+ * This must be CHEAP and must never walk a filesystem: it is on the admin
23820
+ * UI's `listLocations` path. The owner keeps its own figure fresh (D224) and
23821
+ * answers from what it already has.
23822
+ */
23823
+ getOccupancy: method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" }) }
23824
+ };
23599
23825
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
23600
23826
  providerId: string().min(1),
23601
23827
  displayName: string().min(1),
@@ -25445,88 +25671,6 @@ onStatusChanged: { data: object({
25445
25671
  volatileStateFields: ["lastUpdated"]
25446
25672
  };
25447
25673
  /**
25448
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
25449
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
25450
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
25451
- * one Home Assistant projection.
25452
- */
25453
- var NetworkLinkStatusSchema = object({
25454
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
25455
- type: _enum([
25456
- "wifi",
25457
- "ethernet",
25458
- "cellular",
25459
- "unknown"
25460
- ]),
25461
- /**
25462
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
25463
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
25464
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
25465
- * one whose reading has not landed must not be drawn at 0 %. Consumers
25466
- * SKIP a null rather than coerce it.
25467
- */
25468
- signalPercent: number().min(0).max(100).nullable(),
25469
- /** Raw received signal strength in dBm, when the firmware reports one. */
25470
- rssiDbm: number().optional(),
25471
- /** Network name of a wireless link, when the firmware reports it. */
25472
- ssid: string().optional(),
25473
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
25474
- lastUpdated: number()
25475
- });
25476
- var networkLinkCapability = {
25477
- name: "network-link",
25478
- scope: "device",
25479
- deviceNative: true,
25480
- mode: "singleton",
25481
- deviceTypes: [
25482
- DeviceType.Camera,
25483
- DeviceType.Sensor,
25484
- DeviceType.Button,
25485
- DeviceType.Switch,
25486
- DeviceType.Light,
25487
- DeviceType.Lock,
25488
- DeviceType.Siren
25489
- ],
25490
- methods: {},
25491
- events: {
25492
- /**
25493
- * Emitted whenever the cached status changes (a link switch, a signal
25494
- * reading that moved). Mirrored on the parent chain by the
25495
- * DeviceEventPropagator like `battery.onStatusChanged`.
25496
- */
25497
- onStatusChanged: { data: object({
25498
- deviceId: number(),
25499
- status: NetworkLinkStatusSchema
25500
- }) } },
25501
- status: {
25502
- schema: NetworkLinkStatusSchema,
25503
- kind: "push",
25504
- empty: {
25505
- type: "unknown",
25506
- signalPercent: null,
25507
- lastUpdated: 0
25508
- }
25509
- },
25510
- /**
25511
- * Runtime-state slice — every provider stores the same shape under
25512
- * `device.runtimeState['network-link']`, read once by the badge and the
25513
- * Home Assistant projector regardless of the driver.
25514
- */
25515
- runtimeState: NetworkLinkStatusSchema,
25516
- /**
25517
- * Runtime-state durability: **restored** — a link reading is slow to
25518
- * change and a sleeping battery camera may not report for hours; the
25519
- * restored slice is what the badge shows until the next read.
25520
- *
25521
- * See `RuntimeStateDurability`. Enforced by
25522
- * `scripts/check-runtime-state-durability.ts`.
25523
- */
25524
- durability: "restored",
25525
- /** Clock fields: written, but excluded from the compare that decides
25526
- * whether persisting is worth a SQLite commit. */
25527
- volatileStateFields: ["lastUpdated"]
25528
- };
25529
- /**
25530
25674
  * Generic boolean sensor — last-resort fallback when no domain-
25531
25675
  * specific binary cap fits (Home Assistant `binary_sensor` without a
25532
25676
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -29082,6 +29226,369 @@ var nativeObjectDetectionCapability = {
29082
29226
  volatileStateFields: ["lastFetchedAt"]
29083
29227
  };
29084
29228
  /**
29229
+ * `navigation` — a device-scoped capability that natively expresses the FULL
29230
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
29231
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
29232
+ *
29233
+ * Why a NEW cap rather than overloading `ptz`:
29234
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29235
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29236
+ * The two are different physical models: PTZ is absolute-position + presets,
29237
+ * navigation is momentary drive nudges + discrete robot ACTIONS
29238
+ * (dock / spot-clean / follow-pet / go-to-point / …).
29239
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29240
+ * the reverse:
29241
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
29242
+ * / `getOptions`), and
29243
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29244
+ * robot camera shows up in the existing PTZ control path without every
29245
+ * PTZ provider learning about robots. The mapping lives in the adapter,
29246
+ * not here (see the addon design note):
29247
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29248
+ * ptz.stop() → navigation.stop()
29249
+ * ptz.goHome() → navigation.runAction('goHome')
29250
+ * ptz.getPresets() → navigation.listActions() (id→preset)
29251
+ * ptz.goToPreset(id) → navigation.runAction(id)
29252
+ *
29253
+ * ## Continuous drive
29254
+ *
29255
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29256
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29257
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29258
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29259
+ * coalesce them. The UI owns the cadence.
29260
+ *
29261
+ * ## The action dictionary
29262
+ *
29263
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29264
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29265
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29266
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29267
+ * vendor-specific list. `kind: 'action'` entries are triggered with
29268
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29269
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
29270
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29271
+ *
29272
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29273
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29274
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
29275
+ * every device handle. A future nodedreame publish adds a typed
29276
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29277
+ * provider can then swap the raw calls for the typed methods with no change to
29278
+ * THIS contract.
29279
+ */
29280
+ /**
29281
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29282
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29283
+ * halts it.
29284
+ *
29285
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
29286
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29287
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29288
+ * vector by it (drivers without proportional drive ignore it).
29289
+ *
29290
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29291
+ * axis alone; an all-undefined nudge is a no-op.
29292
+ */
29293
+ var NavigationMoveCommandSchema = object({
29294
+ pan: number().min(-1).max(1).optional(),
29295
+ tilt: number().min(-1).max(1).optional(),
29296
+ speed: number().min(0).max(1).optional()
29297
+ });
29298
+ /**
29299
+ * The enumerated discrete actions a navigation-capable robot can perform via
29300
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29301
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
29302
+ * `playSound` (see the `sound` dictionary entries).
29303
+ */
29304
+ var NavigationActionIdSchema = _enum([
29305
+ "goHome",
29306
+ "locate",
29307
+ "spotClean",
29308
+ "findPet",
29309
+ "personFollow",
29310
+ "stop",
29311
+ "startClean",
29312
+ "pauseClean",
29313
+ "dockWash",
29314
+ "autoEmpty",
29315
+ "flashOn",
29316
+ "flashOff"
29317
+ ]);
29318
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29319
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
29320
+ /**
29321
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29322
+ * native panel and the PTZ mimic render as a button.
29323
+ *
29324
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29325
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29326
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
29327
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29328
+ * - `label` — operator-facing English label.
29329
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29330
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29331
+ * PTZ render ONLY enabled entries. Data-driven: the provider
29332
+ * flips it from config, never by editing code.
29333
+ */
29334
+ var NavigationActionEntrySchema = object({
29335
+ id: string(),
29336
+ kind: NavigationEntryKindSchema,
29337
+ label: string(),
29338
+ icon: string(),
29339
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29340
+ soundId: number().int().optional(),
29341
+ /** Per-device feature flag — render this entry only when true. */
29342
+ enabled: boolean()
29343
+ });
29344
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
29345
+ var NavigationPointSchema = object({
29346
+ x: number(),
29347
+ y: number()
29348
+ });
29349
+ /**
29350
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29351
+ * The cap reports which are enabled so the UI / PTZ render only the controls
29352
+ * that are turned on for THIS device. Data-driven: the provider derives these
29353
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29354
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29355
+ * that are not dictionary entries.
29356
+ *
29357
+ * - `move` / `stop` — the momentary drive joystick.
29358
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29359
+ * map-coordinate plumbing is wired.
29360
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29361
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29362
+ * - `light` — the on/off fill-light toggle (works anytime).
29363
+ * - `lightMode` — the auto/manual selector + manual level slider (a
29364
+ * camera-service control; needs an active stream).
29365
+ */
29366
+ var NavigationFeaturesSchema = object({
29367
+ move: boolean(),
29368
+ stop: boolean(),
29369
+ goToPoint: boolean(),
29370
+ runAction: boolean(),
29371
+ playSound: boolean(),
29372
+ light: boolean(),
29373
+ lightMode: boolean()
29374
+ });
29375
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29376
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
29377
+ /**
29378
+ * Live navigation state so the UI can reflect what the robot is doing:
29379
+ * - `mode` — coarse activity (idle / cleaning / following / …).
29380
+ * - `following` — person/pet follow is currently armed.
29381
+ * - `flash` — the on-camera fill light is on.
29382
+ * - `lightMode` — auto vs manual fill-light mode.
29383
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
29384
+ * `lightMode === 'manual'`.
29385
+ */
29386
+ var NavigationStatusSchema = object({
29387
+ mode: _enum([
29388
+ "idle",
29389
+ "cleaning",
29390
+ "spot",
29391
+ "following",
29392
+ "goto",
29393
+ "returning",
29394
+ "paused",
29395
+ "unknown"
29396
+ ]),
29397
+ following: boolean(),
29398
+ flash: boolean(),
29399
+ lightMode: NavigationLightModeSchema,
29400
+ lightLevel: number().min(40).max(100),
29401
+ /** Ms epoch when the slice was last updated. */
29402
+ lastChangedAt: number()
29403
+ });
29404
+ /**
29405
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29406
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
29407
+ * convention.
29408
+ */
29409
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29410
+ var navigationCapability = {
29411
+ name: "navigation",
29412
+ scope: "device",
29413
+ deviceNative: true,
29414
+ mode: "singleton",
29415
+ deviceTypes: [DeviceType.Camera],
29416
+ deviceConfig: { ui: {
29417
+ kind: "widget",
29418
+ widgetId: "host/navigation-panel",
29419
+ tab: "navigation",
29420
+ topTab: true,
29421
+ label: "Navigation",
29422
+ order: 0
29423
+ } },
29424
+ methods: {
29425
+ /**
29426
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
29427
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29428
+ * path) works for any authenticated user, not admin-only. The UI sends
29429
+ * these at ~1 Hz while a control is held; the provider forwards each one to
29430
+ * a single drive write WITHOUT debouncing.
29431
+ */
29432
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29433
+ /** Halt all motion immediately (zero drive vector). */
29434
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29435
+ /** Send the robot to a point on its live map. */
29436
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29437
+ /**
29438
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
29439
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29440
+ */
29441
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29442
+ /**
29443
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29444
+ * unsupported action ids are rejected by the provider.
29445
+ */
29446
+ runAction: method(object({
29447
+ deviceId: number(),
29448
+ actionId: NavigationActionIdSchema
29449
+ }), _void(), { kind: "mutation" }),
29450
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29451
+ playSound: method(object({
29452
+ deviceId: number(),
29453
+ soundId: number().int()
29454
+ }), _void(), { kind: "mutation" }),
29455
+ /**
29456
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29457
+ * works anytime, no active stream required).
29458
+ */
29459
+ setLightOn: method(object({
29460
+ deviceId: number(),
29461
+ on: boolean()
29462
+ }), _void(), { kind: "mutation" }),
29463
+ /**
29464
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29465
+ * initial `level`. The auto/manual + level control is a CAMERA-service
29466
+ * action that generally needs an active camera stream/monitor session — the
29467
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
29468
+ */
29469
+ setLightMode: method(object({
29470
+ deviceId: number(),
29471
+ mode: NavigationLightModeSchema,
29472
+ level: number().min(40).max(100).optional()
29473
+ }), _void(), { kind: "mutation" }),
29474
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29475
+ setLightLevel: method(object({
29476
+ deviceId: number(),
29477
+ level: number().min(40).max(100)
29478
+ }), _void(), { kind: "mutation" }),
29479
+ /**
29480
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
29481
+ * controls the UI shows (the per-entry flags for the dictionary come back on
29482
+ * `listActions`).
29483
+ */
29484
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29485
+ },
29486
+ events: { onStatusChanged: { data: object({
29487
+ deviceId: number(),
29488
+ status: NavigationStatusSchema
29489
+ }) } },
29490
+ status: {
29491
+ schema: NavigationStatusSchema,
29492
+ kind: "push"
29493
+ },
29494
+ /**
29495
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29496
+ * for live mode / follow / flash changes.
29497
+ */
29498
+ runtimeState: NavigationRuntimeStateSchema,
29499
+ /**
29500
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
29501
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
29502
+ * that. The live handle re-publishes on connect.
29503
+ *
29504
+ * See `RuntimeStateDurability`. Enforced by
29505
+ * `scripts/check-runtime-state-durability.ts`.
29506
+ */
29507
+ durability: "session"
29508
+ };
29509
+ /**
29510
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
29511
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
29512
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
29513
+ * one Home Assistant projection.
29514
+ */
29515
+ var NetworkLinkStatusSchema = object({
29516
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
29517
+ type: _enum([
29518
+ "wifi",
29519
+ "ethernet",
29520
+ "cellular",
29521
+ "unknown"
29522
+ ]),
29523
+ /**
29524
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
29525
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
29526
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
29527
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
29528
+ * SKIP a null rather than coerce it.
29529
+ */
29530
+ signalPercent: number().min(0).max(100).nullable(),
29531
+ /** Raw received signal strength in dBm, when the firmware reports one. */
29532
+ rssiDbm: number().optional(),
29533
+ /** Network name of a wireless link, when the firmware reports it. */
29534
+ ssid: string().optional(),
29535
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
29536
+ lastUpdated: number()
29537
+ });
29538
+ var networkLinkCapability = {
29539
+ name: "network-link",
29540
+ scope: "device",
29541
+ deviceNative: true,
29542
+ mode: "singleton",
29543
+ deviceTypes: [
29544
+ DeviceType.Camera,
29545
+ DeviceType.Sensor,
29546
+ DeviceType.Button,
29547
+ DeviceType.Switch,
29548
+ DeviceType.Light,
29549
+ DeviceType.Lock,
29550
+ DeviceType.Siren
29551
+ ],
29552
+ methods: {},
29553
+ events: {
29554
+ /**
29555
+ * Emitted whenever the cached status changes (a link switch, a signal
29556
+ * reading that moved). Mirrored on the parent chain by the
29557
+ * DeviceEventPropagator like `battery.onStatusChanged`.
29558
+ */
29559
+ onStatusChanged: { data: object({
29560
+ deviceId: number(),
29561
+ status: NetworkLinkStatusSchema
29562
+ }) } },
29563
+ status: {
29564
+ schema: NetworkLinkStatusSchema,
29565
+ kind: "push",
29566
+ empty: {
29567
+ type: "unknown",
29568
+ signalPercent: null,
29569
+ lastUpdated: 0
29570
+ }
29571
+ },
29572
+ /**
29573
+ * Runtime-state slice — every provider stores the same shape under
29574
+ * `device.runtimeState['network-link']`, read once by the badge and the
29575
+ * Home Assistant projector regardless of the driver.
29576
+ */
29577
+ runtimeState: NetworkLinkStatusSchema,
29578
+ /**
29579
+ * Runtime-state durability: **restored** — a link reading is slow to
29580
+ * change and a sleeping battery camera may not report for hours; the
29581
+ * restored slice is what the badge shows until the next read.
29582
+ *
29583
+ * See `RuntimeStateDurability`. Enforced by
29584
+ * `scripts/check-runtime-state-durability.ts`.
29585
+ */
29586
+ durability: "restored",
29587
+ /** Clock fields: written, but excluded from the compare that decides
29588
+ * whether persisting is worth a SQLite commit. */
29589
+ volatileStateFields: ["lastUpdated"]
29590
+ };
29591
+ /**
29085
29592
  * network-quality — system-scoped singleton capability tracking RTT,
29086
29593
  * jitter, and observed/peak bandwidth per device + per client.
29087
29594
  *
@@ -30696,287 +31203,6 @@ var ptzAutotrackCapability = {
30696
31203
  */
30697
31204
  durability: "session"
30698
31205
  };
30699
- /**
30700
- * `navigation` — a device-scoped capability that natively expresses the FULL
30701
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
30702
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
30703
- *
30704
- * Why a NEW cap rather than overloading `ptz`:
30705
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
30706
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
30707
- * The two are different physical models: PTZ is absolute-position + presets,
30708
- * navigation is momentary drive nudges + discrete robot ACTIONS
30709
- * (dock / spot-clean / follow-pet / go-to-point / …).
30710
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
30711
- * the reverse:
30712
- * 1. a native CamStack navigation panel (data-driven from `listActions`
30713
- * / `getOptions`), and
30714
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
30715
- * robot camera shows up in the existing PTZ control path without every
30716
- * PTZ provider learning about robots. The mapping lives in the adapter,
30717
- * not here (see the addon design note):
30718
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
30719
- * ptz.stop() → navigation.stop()
30720
- * ptz.goHome() → navigation.runAction('goHome')
30721
- * ptz.getPresets() → navigation.listActions() (id→preset)
30722
- * ptz.goToPreset(id) → navigation.runAction(id)
30723
- *
30724
- * ## Continuous drive
30725
- *
30726
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
30727
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
30728
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
30729
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
30730
- * coalesce them. The UI owns the cadence.
30731
- *
30732
- * ## The action dictionary
30733
- *
30734
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
30735
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
30736
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
30737
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
30738
- * vendor-specific list. `kind: 'action'` entries are triggered with
30739
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
30740
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
30741
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
30742
- *
30743
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
30744
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
30745
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
30746
- * every device handle. A future nodedreame publish adds a typed
30747
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
30748
- * provider can then swap the raw calls for the typed methods with no change to
30749
- * THIS contract.
30750
- */
30751
- /**
30752
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
30753
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
30754
- * halts it.
30755
- *
30756
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
30757
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
30758
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
30759
- * vector by it (drivers without proportional drive ignore it).
30760
- *
30761
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
30762
- * axis alone; an all-undefined nudge is a no-op.
30763
- */
30764
- var NavigationMoveCommandSchema = object({
30765
- pan: number().min(-1).max(1).optional(),
30766
- tilt: number().min(-1).max(1).optional(),
30767
- speed: number().min(0).max(1).optional()
30768
- });
30769
- /**
30770
- * The enumerated discrete actions a navigation-capable robot can perform via
30771
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
30772
- * subset it supports through `listActions`. Sounds are NOT here — they go through
30773
- * `playSound` (see the `sound` dictionary entries).
30774
- */
30775
- var NavigationActionIdSchema = _enum([
30776
- "goHome",
30777
- "locate",
30778
- "spotClean",
30779
- "findPet",
30780
- "personFollow",
30781
- "stop",
30782
- "startClean",
30783
- "pauseClean",
30784
- "dockWash",
30785
- "autoEmpty",
30786
- "flashOn",
30787
- "flashOff"
30788
- ]);
30789
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
30790
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
30791
- /**
30792
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
30793
- * native panel and the PTZ mimic render as a button.
30794
- *
30795
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
30796
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
30797
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
30798
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
30799
- * - `label` — operator-facing English label.
30800
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
30801
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
30802
- * PTZ render ONLY enabled entries. Data-driven: the provider
30803
- * flips it from config, never by editing code.
30804
- */
30805
- var NavigationActionEntrySchema = object({
30806
- id: string(),
30807
- kind: NavigationEntryKindSchema,
30808
- label: string(),
30809
- icon: string(),
30810
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
30811
- soundId: number().int().optional(),
30812
- /** Per-device feature flag — render this entry only when true. */
30813
- enabled: boolean()
30814
- });
30815
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
30816
- var NavigationPointSchema = object({
30817
- x: number(),
30818
- y: number()
30819
- });
30820
- /**
30821
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
30822
- * The cap reports which are enabled so the UI / PTZ render only the controls
30823
- * that are turned on for THIS device. Data-driven: the provider derives these
30824
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
30825
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
30826
- * that are not dictionary entries.
30827
- *
30828
- * - `move` / `stop` — the momentary drive joystick.
30829
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
30830
- * map-coordinate plumbing is wired.
30831
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
30832
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
30833
- * - `light` — the on/off fill-light toggle (works anytime).
30834
- * - `lightMode` — the auto/manual selector + manual level slider (a
30835
- * camera-service control; needs an active stream).
30836
- */
30837
- var NavigationFeaturesSchema = object({
30838
- move: boolean(),
30839
- stop: boolean(),
30840
- goToPoint: boolean(),
30841
- runAction: boolean(),
30842
- playSound: boolean(),
30843
- light: boolean(),
30844
- lightMode: boolean()
30845
- });
30846
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
30847
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
30848
- /**
30849
- * Live navigation state so the UI can reflect what the robot is doing:
30850
- * - `mode` — coarse activity (idle / cleaning / following / …).
30851
- * - `following` — person/pet follow is currently armed.
30852
- * - `flash` — the on-camera fill light is on.
30853
- * - `lightMode` — auto vs manual fill-light mode.
30854
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
30855
- * `lightMode === 'manual'`.
30856
- */
30857
- var NavigationStatusSchema = object({
30858
- mode: _enum([
30859
- "idle",
30860
- "cleaning",
30861
- "spot",
30862
- "following",
30863
- "goto",
30864
- "returning",
30865
- "paused",
30866
- "unknown"
30867
- ]),
30868
- following: boolean(),
30869
- flash: boolean(),
30870
- lightMode: NavigationLightModeSchema,
30871
- lightLevel: number().min(40).max(100),
30872
- /** Ms epoch when the slice was last updated. */
30873
- lastChangedAt: number()
30874
- });
30875
- /**
30876
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
30877
- * observable). Adds `lastFetchedAt` on top of the status shape per the
30878
- * convention.
30879
- */
30880
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
30881
- var navigationCapability = {
30882
- name: "navigation",
30883
- scope: "device",
30884
- deviceNative: true,
30885
- mode: "singleton",
30886
- deviceTypes: [DeviceType.Camera],
30887
- deviceConfig: { ui: {
30888
- kind: "widget",
30889
- widgetId: "host/navigation-panel",
30890
- tab: "navigation",
30891
- topTab: true,
30892
- label: "Navigation",
30893
- order: 0
30894
- } },
30895
- methods: {
30896
- /**
30897
- * Momentary drive nudge (the robot moves). `protected` — mirrors
30898
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
30899
- * path) works for any authenticated user, not admin-only. The UI sends
30900
- * these at ~1 Hz while a control is held; the provider forwards each one to
30901
- * a single drive write WITHOUT debouncing.
30902
- */
30903
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30904
- /** Halt all motion immediately (zero drive vector). */
30905
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
30906
- /** Send the robot to a point on its live map. */
30907
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
30908
- /**
30909
- * Enumerate the discrete controls THIS device supports (data-driven UI +
30910
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
30911
- */
30912
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
30913
- /**
30914
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
30915
- * unsupported action ids are rejected by the provider.
30916
- */
30917
- runAction: method(object({
30918
- deviceId: number(),
30919
- actionId: NavigationActionIdSchema
30920
- }), _void(), { kind: "mutation" }),
30921
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
30922
- playSound: method(object({
30923
- deviceId: number(),
30924
- soundId: number().int()
30925
- }), _void(), { kind: "mutation" }),
30926
- /**
30927
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
30928
- * works anytime, no active stream required).
30929
- */
30930
- setLightOn: method(object({
30931
- deviceId: number(),
30932
- on: boolean()
30933
- }), _void(), { kind: "mutation" }),
30934
- /**
30935
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
30936
- * initial `level`. The auto/manual + level control is a CAMERA-service
30937
- * action that generally needs an active camera stream/monitor session — the
30938
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
30939
- */
30940
- setLightMode: method(object({
30941
- deviceId: number(),
30942
- mode: NavigationLightModeSchema,
30943
- level: number().min(40).max(100).optional()
30944
- }), _void(), { kind: "mutation" }),
30945
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
30946
- setLightLevel: method(object({
30947
- deviceId: number(),
30948
- level: number().min(40).max(100)
30949
- }), _void(), { kind: "mutation" }),
30950
- /**
30951
- * Per-device FEATURE-FLAG report for the general primitives — drives which
30952
- * controls the UI shows (the per-entry flags for the dictionary come back on
30953
- * `listActions`).
30954
- */
30955
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
30956
- },
30957
- events: { onStatusChanged: { data: object({
30958
- deviceId: number(),
30959
- status: NavigationStatusSchema
30960
- }) } },
30961
- status: {
30962
- schema: NavigationStatusSchema,
30963
- kind: "push"
30964
- },
30965
- /**
30966
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
30967
- * for live mode / follow / flash changes.
30968
- */
30969
- runtimeState: NavigationRuntimeStateSchema,
30970
- /**
30971
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
30972
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
30973
- * that. The live handle re-publishes on connect.
30974
- *
30975
- * See `RuntimeStateDurability`. Enforced by
30976
- * `scripts/check-runtime-state-durability.ts`.
30977
- */
30978
- durability: "session"
30979
- };
30980
31206
  DeviceType.Camera, DeviceType.Sensor, DeviceType.Switch, method(object({ deviceId: number().int().nonnegative() }), object({ success: literal(true) }), {
30981
31207
  kind: "mutation",
30982
31208
  auth: "admin"
@@ -40234,13 +40460,13 @@ Object.freeze({
40234
40460
  addonId: null,
40235
40461
  access: "view"
40236
40462
  },
40237
- "storage.getDefaultLocation": {
40463
+ "storage.list": {
40238
40464
  capName: "storage",
40239
40465
  capScope: "system",
40240
40466
  addonId: null,
40241
40467
  access: "view"
40242
40468
  },
40243
- "storage.list": {
40469
+ "storage.listDrainProgress": {
40244
40470
  capName: "storage",
40245
40471
  capScope: "system",
40246
40472
  addonId: null,
@@ -40390,6 +40616,12 @@ Object.freeze({
40390
40616
  addonId: null,
40391
40617
  access: "view"
40392
40618
  },
40619
+ "storageOccupancy.getOccupancy": {
40620
+ capName: "storage-occupancy",
40621
+ capScope: "system",
40622
+ addonId: null,
40623
+ access: "view"
40624
+ },
40393
40625
  "storageProvider.abortUpload": {
40394
40626
  capName: "storage-provider",
40395
40627
  capScope: "system",
@@ -44831,6 +45063,12 @@ Object.defineProperty(exports, "evaluateSensorEdge", {
44831
45063
  return evaluateSensorEdge;
44832
45064
  }
44833
45065
  });
45066
+ Object.defineProperty(exports, "evictionPolicyOfLocation", {
45067
+ enumerable: true,
45068
+ get: function() {
45069
+ return evictionPolicyOfLocation;
45070
+ }
45071
+ });
44834
45072
  Object.defineProperty(exports, "faceGalleryCapability", {
44835
45073
  enumerable: true,
44836
45074
  get: function() {
@@ -44891,6 +45129,12 @@ Object.defineProperty(exports, "literal", {
44891
45129
  return literal;
44892
45130
  }
44893
45131
  });
45132
+ Object.defineProperty(exports, "mayWriteToLocation", {
45133
+ enumerable: true,
45134
+ get: function() {
45135
+ return mayWriteToLocation;
45136
+ }
45137
+ });
44894
45138
  Object.defineProperty(exports, "nodePin", {
44895
45139
  enumerable: true,
44896
45140
  get: function() {
@@ -44963,6 +45207,12 @@ Object.defineProperty(exports, "record", {
44963
45207
  return record;
44964
45208
  }
44965
45209
  });
45210
+ Object.defineProperty(exports, "resolveLocationMode", {
45211
+ enumerable: true,
45212
+ get: function() {
45213
+ return resolveLocationMode;
45214
+ }
45215
+ });
44966
45216
  Object.defineProperty(exports, "resolvePoolMemoryPolicy", {
44967
45217
  enumerable: true,
44968
45218
  get: function() {
@@ -44981,6 +45231,12 @@ Object.defineProperty(exports, "sleep", {
44981
45231
  return sleep;
44982
45232
  }
44983
45233
  });
45234
+ Object.defineProperty(exports, "storageOccupancyCapability", {
45235
+ enumerable: true,
45236
+ get: function() {
45237
+ return storageOccupancyCapability;
45238
+ }
45239
+ });
44984
45240
  Object.defineProperty(exports, "string", {
44985
45241
  enumerable: true,
44986
45242
  get: function() {