@camstack/addon-provider-hikvision 1.2.86 → 1.2.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +621 -488
  2. package/dist/addon.mjs +621 -488
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -6,7 +6,7 @@ let node_crypto = require("node:crypto");
6
6
  let node_http = require("node:http");
7
7
  let node_https = require("node:https");
8
8
  let node_os = require("node:os");
9
- //#region ../types/dist/event-category-zAv7pMUz.mjs
9
+ //#region ../types/dist/event-category-CnLqLOKs.mjs
10
10
  var EventCategory = /* @__PURE__ */ function(EventCategory) {
11
11
  EventCategory["SystemBoot"] = "system.boot";
12
12
  EventCategory["SystemAddonsReady"] = "system.addons-ready";
@@ -201,6 +201,19 @@ var EventCategory = /* @__PURE__ */ function(EventCategory) {
201
201
  EventCategory["ProcessCrashed"] = "process.crashed";
202
202
  EventCategory["ProcessRestartScheduled"] = "process.restart_scheduled";
203
203
  EventCategory["ProcessRestarted"] = "process.restarted";
204
+ /**
205
+ * The SET of storage locations changed — one was created, edited, enabled,
206
+ * disabled or deleted through `storage.upsertLocation` / `deleteLocation`.
207
+ *
208
+ * Telemetry, not a transaction (D8/D11): every consumer that re-resolves on
209
+ * it must also converge on its own periodic path, because a dropped event
210
+ * must not leave a node writing to yesterday's disk set forever. It exists
211
+ * because there was NO signal at all — an operator who added a second
212
+ * recordings disk in the admin UI got nothing, and the recorder kept its
213
+ * resolved locations until something else happened to re-resolve them
214
+ * (D387). Payload `StorageLocationsChangedPayload`.
215
+ */
216
+ EventCategory["StorageLocationsChanged"] = "storage.locations-changed";
204
217
  EventCategory["RecordingStarted"] = "recording.started";
205
218
  EventCategory["RecordingStopped"] = "recording.stopped";
206
219
  EventCategory["RecordingError"] = "recording.error";
@@ -7610,111 +7623,6 @@ var CameraSwitchGroupSchema = object({
7610
7623
  fetchedAt: number()
7611
7624
  });
7612
7625
  /**
7613
- * Per-component log CHANNELS — the gate a hot path consults, and the registry
7614
- * an addon declares its channels in.
7615
- *
7616
- * ## Two axes, deliberately separated
7617
- *
7618
- * - **DECLARATION** — which channels exist. Only the addon knows:
7619
- * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
7620
- * baichuan/handshake. A hand-wired central list rots at the first addition,
7621
- * and rots silently. So a channel is declared where it is consulted, and the
7622
- * `log-channels` capability enumerates the declarations.
7623
- * - **VALUE** — at which level, for which scope, until when. That stays ONE
7624
- * thing: the logging settings document on the `system` cap. Two authorities
7625
- * over the values is the exact defect
7626
- * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
7627
- * remove; re-introducing it from the cure side would be grotesque.
7628
- *
7629
- * Nothing in this file reads a clock, an env var or a store. The registry is
7630
- * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
7631
- * the hot path with a value somebody actually read, and by
7632
- * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
7633
- * never reaches here, so it can neither disarm an armed channel nor arm a
7634
- * disarmed one (D49).
7635
- *
7636
- * ## The canonical call shape
7637
- *
7638
- * ```ts
7639
- * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
7640
- * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
7641
- * }
7642
- * ```
7643
- *
7644
- * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
7645
- * read. Disarmed, a call site costs one load and one branch, and the `extras`
7646
- * object literal is never constructed because it lives inside the branch. It
7647
- * is the same shape already proven in production at `stream-broker.ts:1650`,
7648
- * and the same discipline `LoggingGate.allowsDestination` uses for the
7649
- * destination floor (measured at 1.93 ns/call when off).
7650
- *
7651
- * ## Why a channel emits at `info`
7652
- *
7653
- * `loki-logging.addon.ts` pins the destination default at `info` and
7654
- * `loki-destination.ts` drops everything below it, so a line emitted at
7655
- * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
7656
- * minutes. A diagnostic that cannot be read an hour later is worse than no
7657
- * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
7658
- * emits at the channel's declared level, whose schema floor is `info`.
7659
- */
7660
- /**
7661
- * The level a channel writes at once armed.
7662
- *
7663
- * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
7664
- * not leave the process for Loki, and the whole point of arming a channel is
7665
- * to read it later.
7666
- */
7667
- var LogChannelLevelSchema = _enum([
7668
- "info",
7669
- "warn",
7670
- "error"
7671
- ]);
7672
- /**
7673
- * What an addon declares about one channel. No value, no state — a
7674
- * declaration is inert.
7675
- */
7676
- var LogChannelDescriptorSchema = object({
7677
- /**
7678
- * Dotted `area.thing`, unique across the workspace. `area` is conventionally
7679
- * the addon's short name so an operator reading a channel list can tell who
7680
- * owns it without a second lookup.
7681
- */
7682
- name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
7683
- /** One sentence: what the operator will SEE after arming it. */
7684
- description: string().min(1),
7685
- /** The level its lines are emitted at. Never below `info`. */
7686
- defaultLevel: LogChannelLevelSchema,
7687
- /**
7688
- * Whether this channel can be narrowed to a camera.
7689
- *
7690
- * `true` is a PROMISE with two halves, and both must hold: the gate is
7691
- * consulted with the numeric device id, AND every line the channel admits
7692
- * carries `tags: { deviceId }` with that same numeric id. The second half is
7693
- * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
7694
- * keeps `deviceId` out of the stream labels for cardinality, so the tag in
7695
- * the body is the only way to filter.
7696
- *
7697
- * A channel whose lines carry the device only in `meta` (or not at all) is
7698
- * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
7699
- * the operator narrows to one camera, sees nothing, and concludes the code
7700
- * path was never taken.
7701
- */
7702
- perDevice: boolean()
7703
- });
7704
- /**
7705
- * An armed window over one channel, as the document hands it to a mirror.
7706
- *
7707
- * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
7708
- * expires by itself, which is the one failure a boolean cannot avoid.
7709
- */
7710
- var LogChannelWindowSchema = object({
7711
- channel: string().min(1),
7712
- /** Epoch ms the window closes at. */
7713
- armedUntilMs: number(),
7714
- /** `null` = every camera. A non-empty list narrows to those numeric ids. */
7715
- deviceIds: array(number().int()).readonly().nullable()
7716
- });
7717
- /**
7718
7626
  * Ops-log — the durable, append-only operations audit shared by the
7719
7627
  * recordings and events management surfaces.
7720
7628
  *
@@ -8636,6 +8544,21 @@ var StorageCleanupJobSchema = object({
8636
8544
  });
8637
8545
  var StorageCleanupStatusInputSchema = object({ jobId: string().optional() });
8638
8546
  /**
8547
+ * The one typed state of a storage location. Authoritative Zod schema — the TS
8548
+ * alias below is `z.infer<>` of it, never a second spelling.
8549
+ */
8550
+ var StorageLocationModeSchema = _enum([
8551
+ "active",
8552
+ "readonly",
8553
+ "drain",
8554
+ "disabled"
8555
+ ]);
8556
+ _enum([
8557
+ "normal",
8558
+ "never",
8559
+ "drain"
8560
+ ]);
8561
+ /**
8639
8562
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8640
8563
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8641
8564
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8660,8 +8583,11 @@ var StorageLocationTypeSchema = string().regex(/^[a-z][a-zA-Z0-9-]*$/);
8660
8583
  * `STORAGE_LOCATION_CARDINALITY` map has been removed.
8661
8584
  *
8662
8585
  * `id` is a stable namespaced string of the form `<type>:<slug>`.
8663
- * The default location for a type uses `id === <type>:default` by
8664
- * convention (the bare type ref like `'backups'` resolves to it).
8586
+ * The seed names its first instance `<type>:default` — a NAME, not a flag.
8587
+ * There is no default location any more (D383): `enabled` is the whole write
8588
+ * model, and a bare type ref resolves to the sole location of the type, or —
8589
+ * transitionally, only while legacy NULL-stamped rows exist — to the row whose
8590
+ * slug is `default`.
8665
8591
  *
8666
8592
  * `isSystem` is a legacy persisted flag. Seed still creates the initial
8667
8593
  * `<type>:default` locations; the flag is no longer a lock, a badge, or a
@@ -8682,23 +8608,37 @@ var StorageLocationSchema = object({
8682
8608
  * flag at upsert time, not here (the schema is provider-agnostic).
8683
8609
  */
8684
8610
  nodeId: string().optional(),
8685
- isDefault: boolean().default(false),
8686
8611
  isSystem: boolean().default(false),
8687
8612
  /**
8688
- * Operator opt-in: whether consumers that BALANCE across several locations
8689
- * of a type may write here. Recordings reads it today; event media and
8690
- * backups are the next consumers, which is why the flag lives on the
8691
- * location rather than in any one addon's store — nothing has to be
8692
- * extended to add the next consumer.
8613
+ * THE write switch, and the only one (D383). `enabled: true` means every
8614
+ * consumer that chooses a write target for this type may write here, and all
8615
+ * enabled locations of a type are used TOGETHER; `false` means read-only —
8616
+ * still read, still played back, still age-swept, still drained, never
8617
+ * written.
8693
8618
  *
8694
- * OPTIONAL, and ABSENT MEANS ACTIVE. Every location persisted before the
8695
- * flag existed reads back with no flag and keeps working exactly as before;
8696
- * that is the whole compat story, and it is why no migration ships with it.
8697
- * A newly CREATED sibling is stamped `false` by the orchestrator (creating a
8698
- * disk must not silently start writing to it); the default of a type is
8699
- * always stamped `true`.
8619
+ * OPTIONAL only for the wire: an upsert that omits it means "leave what is
8620
+ * stored" on an update and "born inert unless it is the first location of its
8621
+ * type" on a create. On a PERSISTED row absence is legacy and it means
8622
+ * enabled — {@link isLocationEnabled} is the one place that says so, and the
8623
+ * orchestrator stamps every flagless row `true` once at hydrate so absence
8624
+ * stops existing rather than being re-derived on every read.
8700
8625
  */
8701
8626
  enabled: boolean().optional(),
8627
+ /**
8628
+ * THE state of this location (D385), and the only authority on what may be
8629
+ * written, read or evicted here. Interpreted in exactly one place —
8630
+ * `storage-location-mode.ts` — which also folds the legacy
8631
+ * `enabled` / `config.readOnly` pair into a mode so an old row is never
8632
+ * ambiguous.
8633
+ *
8634
+ * OPTIONAL only for the wire and for rows written before D385: absence is
8635
+ * resolved by `resolveLocationMode`, and the orchestrator stamps every
8636
+ * unstamped row ONCE at hydrate so absence stops existing rather than being
8637
+ * re-derived on every read. `enabled` survives one release as a DERIVED
8638
+ * mirror (`mode === 'active'`); `withLocationMode` is the only writer of
8639
+ * either, so the two cannot disagree.
8640
+ */
8641
+ mode: StorageLocationModeSchema.optional(),
8702
8642
  /** COMPUTED at read time by the orchestrator (statfs of the backing volume
8703
8643
  * for node-local locations it can reach) — never persisted, absent when the
8704
8644
  * volume is remote/unreachable. The single capacity truth every UI reads. */
@@ -8706,13 +8646,50 @@ var StorageLocationSchema = object({
8706
8646
  totalBytes: number(),
8707
8647
  availableBytes: number()
8708
8648
  }).nullable().optional(),
8649
+ /**
8650
+ * How much of that volume CamStack ITSELF holds on this location (D388) —
8651
+ * COMPUTED at read time from the `storage-occupancy` providers' own figures,
8652
+ * never persisted, never a filesystem walk.
8653
+ *
8654
+ * **ABSENT MEANS UNKNOWN, never zero.** No provider has reported for this
8655
+ * location yet — nobody stores here, the owning addon is down, or the first
8656
+ * refresh has not completed. A UI must omit the segment rather than draw it
8657
+ * at zero, which would claim we occupy nothing (D315). It is an OBJECT and
8658
+ * not a bare number precisely so that a `?? 0` on the consuming side has to
8659
+ * be spelled out loud instead of appearing by accident.
8660
+ *
8661
+ * `measuredAtMs` is the OLDEST contributing measurement, so it is honest
8662
+ * about the whole figure rather than about its freshest part.
8663
+ */
8664
+ owned: object({
8665
+ bytes: number().int().nonnegative(),
8666
+ measuredAtMs: number().int().nonnegative()
8667
+ }).optional(),
8709
8668
  createdAt: number(),
8710
8669
  updatedAt: number()
8711
8670
  });
8671
+ object({ isDefault: boolean().optional() });
8672
+ /**
8673
+ * How far a `drain` has got (D386) — the read a UI renders, and nothing more.
8674
+ *
8675
+ * `estimatedEmptyAtMs` is derived from the growth the ratchet has actually
8676
+ * OBSERVED and is `null` when it has observed none. Never a fabricated date: a
8677
+ * drain with no observed growth has no honest ETA, and inventing one is how an
8678
+ * operator learns not to believe the screen.
8679
+ */
8680
+ var StorageDrainProgressSchema = object({
8681
+ locationId: string(),
8682
+ startedAtMs: number(),
8683
+ startBytes: number(),
8684
+ bytesRemaining: number(),
8685
+ drained: boolean(),
8686
+ estimatedEmptyAtMs: number().nullable()
8687
+ });
8712
8688
  /**
8713
8689
  * Reference accepted by consumer-facing `api.storage.*` calls.
8714
8690
  * Either:
8715
- * - a `StorageLocationType` (e.g. `'backups'`) → orchestrator resolves to the default of that type
8691
+ * - a `StorageLocationType` (e.g. `'backups'`) → the sole location of that type
8692
+ * (transitionally, the `<type>:default`-slugged row when several exist)
8716
8693
  * - a fully-qualified id (e.g. `'backups:nas-01'`) → addresses a specific instance
8717
8694
  *
8718
8695
  * The orchestrator's `resolveRef(ref)` handles both cases.
@@ -9064,6 +9041,111 @@ function findTimezone(id) {
9064
9041
  return TIMEZONES.find((tz) => tz.id === id);
9065
9042
  }
9066
9043
  /**
9044
+ * Per-component log CHANNELS — the gate a hot path consults, and the registry
9045
+ * an addon declares its channels in.
9046
+ *
9047
+ * ## Two axes, deliberately separated
9048
+ *
9049
+ * - **DECLARATION** — which channels exist. Only the addon knows:
9050
+ * `stream-broker` knows webrtc/ICE/RTP, `provider-reolink` knows
9051
+ * baichuan/handshake. A hand-wired central list rots at the first addition,
9052
+ * and rots silently. So a channel is declared where it is consulted, and the
9053
+ * `log-channels` capability enumerates the declarations.
9054
+ * - **VALUE** — at which level, for which scope, until when. That stays ONE
9055
+ * thing: the logging settings document on the `system` cap. Two authorities
9056
+ * over the values is the exact defect
9057
+ * `docs/design/plans/2026-08-26-logging-per-componente.md` was written to
9058
+ * remove; re-introducing it from the cure side would be grotesque.
9059
+ *
9060
+ * Nothing in this file reads a clock, an env var or a store. The registry is
9061
+ * a MIRROR: it is moved only by {@link LogChannelRegistry.apply}, called off
9062
+ * the hot path with a value somebody actually read, and by
9063
+ * {@link LogChannelRegistry.tick}, called on a timer. A store read that fails
9064
+ * never reaches here, so it can neither disarm an armed channel nor arm a
9065
+ * disarmed one (D49).
9066
+ *
9067
+ * ## The canonical call shape
9068
+ *
9069
+ * ```ts
9070
+ * if (CH_RTP.on && CH_RTP.wants(deviceId)) {
9071
+ * CH_RTP.log(logger, 'rtp subscriber added', { tags: { deviceId }, meta: { ssrc } })
9072
+ * }
9073
+ * ```
9074
+ *
9075
+ * `on` is a plain boolean FIELD — never a getter — and it is the FIRST thing
9076
+ * read. Disarmed, a call site costs one load and one branch, and the `extras`
9077
+ * object literal is never constructed because it lives inside the branch. It
9078
+ * is the same shape already proven in production at `stream-broker.ts:1650`,
9079
+ * and the same discipline `LoggingGate.allowsDestination` uses for the
9080
+ * destination floor (measured at 1.93 ns/call when off).
9081
+ *
9082
+ * ## Why a channel emits at `info`
9083
+ *
9084
+ * `loki-logging.addon.ts` pins the destination default at `info` and
9085
+ * `loki-destination.ts` drops everything below it, so a line emitted at
9086
+ * `debug` never reaches Loki and the hub's in-memory ring only holds ~35
9087
+ * minutes. A diagnostic that cannot be read an hour later is worse than no
9088
+ * diagnostic, because it looks done. {@link LogChannelGate.log} therefore
9089
+ * emits at the channel's declared level, whose schema floor is `info`.
9090
+ */
9091
+ /**
9092
+ * The level a channel writes at once armed.
9093
+ *
9094
+ * `debug` is absent ON PURPOSE and not by omission: below `info` the line does
9095
+ * not leave the process for Loki, and the whole point of arming a channel is
9096
+ * to read it later.
9097
+ */
9098
+ var LogChannelLevelSchema = _enum([
9099
+ "info",
9100
+ "warn",
9101
+ "error"
9102
+ ]);
9103
+ /**
9104
+ * What an addon declares about one channel. No value, no state — a
9105
+ * declaration is inert.
9106
+ */
9107
+ var LogChannelDescriptorSchema = object({
9108
+ /**
9109
+ * Dotted `area.thing`, unique across the workspace. `area` is conventionally
9110
+ * the addon's short name so an operator reading a channel list can tell who
9111
+ * owns it without a second lookup.
9112
+ */
9113
+ name: string().min(3).regex(/^[a-z0-9-]+(\.[a-z0-9-]+)+$/, "a channel name is dotted lower-kebab, e.g. area.thing"),
9114
+ /** One sentence: what the operator will SEE after arming it. */
9115
+ description: string().min(1),
9116
+ /** The level its lines are emitted at. Never below `info`. */
9117
+ defaultLevel: LogChannelLevelSchema,
9118
+ /**
9119
+ * Whether this channel can be narrowed to a camera.
9120
+ *
9121
+ * `true` is a PROMISE with two halves, and both must hold: the gate is
9122
+ * consulted with the numeric device id, AND every line the channel admits
9123
+ * carries `tags: { deviceId }` with that same numeric id. The second half is
9124
+ * what makes `| json | deviceId="617"` work in Loki — `loki-payload.ts`
9125
+ * keeps `deviceId` out of the stream labels for cardinality, so the tag in
9126
+ * the body is the only way to filter.
9127
+ *
9128
+ * A channel whose lines carry the device only in `meta` (or not at all) is
9129
+ * declared `false`. Declaring it `true` anyway would be a lie the UI repeats:
9130
+ * the operator narrows to one camera, sees nothing, and concludes the code
9131
+ * path was never taken.
9132
+ */
9133
+ perDevice: boolean()
9134
+ });
9135
+ /**
9136
+ * An armed window over one channel, as the document hands it to a mirror.
9137
+ *
9138
+ * A window is a DEADLINE, never a flag (ADR-0244): a channel somebody forgot
9139
+ * expires by itself, which is the one failure a boolean cannot avoid.
9140
+ */
9141
+ var LogChannelWindowSchema = object({
9142
+ channel: string().min(1),
9143
+ /** Epoch ms the window closes at. */
9144
+ armedUntilMs: number(),
9145
+ /** `null` = every camera. A non-empty list narrows to those numeric ids. */
9146
+ deviceIds: array(number().int()).readonly().nullable()
9147
+ });
9148
+ /**
9067
9149
  * Distinct (device, family, variant) counters one instance will hold.
9068
9150
  *
9069
9151
  * A large fleet x the handful of families any single addon reports, with
@@ -22336,7 +22418,7 @@ method(object({
22336
22418
  downloadId: string(),
22337
22419
  offset: number(),
22338
22420
  length: number()
22339
- }), _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({
22421
+ }), _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({
22340
22422
  createdAt: true,
22341
22423
  updatedAt: true
22342
22424
  }), StorageLocationSchema, {
@@ -22348,7 +22430,7 @@ method(object({
22348
22430
  }), _void(), {
22349
22431
  kind: "mutation",
22350
22432
  auth: "admin"
22351
- }), method(object({ id: string() }), object({
22433
+ }), method(_void(), array(StorageDrainProgressSchema).readonly()), method(object({ id: string() }), object({
22352
22434
  ok: boolean(),
22353
22435
  error: string().optional()
22354
22436
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
@@ -22418,6 +22500,51 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
22418
22500
  kind: "mutation",
22419
22501
  auth: "admin"
22420
22502
  }), method(object({}), array(StorageMigrationJobSchema).readonly(), { auth: "admin" });
22503
+ /**
22504
+ * `storage-occupancy` — how many bytes an addon actually HOLDS on a storage
22505
+ * location (D388).
22506
+ *
22507
+ * ## Why this is not `storage-evictable`
22508
+ *
22509
+ * `storage-evictable.getEvictableUsage` looks like the same question and is
22510
+ * not, in two ways that both matter and both bite hardest on the locations an
22511
+ * operator most wants a figure for:
22512
+ *
22513
+ * - it reports the whole eviction DOMAIN, not the location. `recordings:default`
22514
+ * and `recordingsLow:default` deliberately share one root and evict as one
22515
+ * oldest-first pool, so both answer with the SAME combined total. As an
22516
+ * occupancy figure that double-counts the disk.
22517
+ * - it reports ZERO for a location whose eviction policy is `never` (D385) —
22518
+ * a `readonly` or `disabled` disk. Those are exactly the disks an operator
22519
+ * is retiring and staring at.
22520
+ *
22521
+ * So this is its own contract with its own quantity, and the quantity is
22522
+ * OCCUPIED: every byte the addon holds on that location, whether or not it
22523
+ * would ever be willing to delete it. A provider that can only answer
22524
+ * "evictable" must not register here — a number that silently means different
22525
+ * things per class is worse than no number.
22526
+ *
22527
+ * ## Absence is an answer
22528
+ *
22529
+ * A location nobody reports for is UNKNOWN, never zero (D315). The orchestrator
22530
+ * stamps `StorageLocation.owned` only for locations it has a report for, and
22531
+ * the field is an OBJECT rather than a bare number so that a `?? 0` on the
22532
+ * consuming side has to be written out loud instead of appearing by accident.
22533
+ *
22534
+ * `internal: true` — consumed by the orchestrator's `listLocations` stamp, never
22535
+ * a public client surface. Clients read the stamped `StorageLocation.owned`.
22536
+ */
22537
+ /** One provider's occupancy answer for one location. */
22538
+ var StorageOccupancyReportSchema = object({
22539
+ locationId: string(),
22540
+ /** Bytes this provider holds on THAT location — not its eviction domain, and
22541
+ * not net of what it is willing to delete. */
22542
+ ownedBytes: number().int().nonnegative(),
22543
+ /** When the provider last actually measured this. The orchestrator carries it
22544
+ * through so a UI can say how old the figure is instead of implying "now". */
22545
+ measuredAtMs: number().int().nonnegative()
22546
+ });
22547
+ method(object({ locationIds: array(string()).readonly() }), array(StorageOccupancyReportSchema).readonly(), { auth: "admin" });
22421
22548
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
22422
22549
  providerId: string().min(1),
22423
22550
  displayName: string().min(1),
@@ -24253,88 +24380,6 @@ onStatusChanged: { data: object({
24253
24380
  volatileStateFields: ["lastUpdated"]
24254
24381
  };
24255
24382
  /**
24256
- * Network-link snapshot. Same shape for every provider (a Reolink wifi
24257
- * camera, a Home Assistant device with a signal-strength sensor, a Tapo
24258
- * plug): one slice under `device.runtimeState['network-link']`, one badge,
24259
- * one Home Assistant projection.
24260
- */
24261
- var NetworkLinkStatusSchema = object({
24262
- /** The link the device is on. `'unknown'` = not read yet, not "no link". */
24263
- type: _enum([
24264
- "wifi",
24265
- "ethernet",
24266
- "cellular",
24267
- "unknown"
24268
- ]),
24269
- /**
24270
- * Link quality, 0..100 inclusive, normalised by the provider from whatever
24271
- * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
24272
- * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
24273
- * one whose reading has not landed must not be drawn at 0 %. Consumers
24274
- * SKIP a null rather than coerce it.
24275
- */
24276
- signalPercent: number().min(0).max(100).nullable(),
24277
- /** Raw received signal strength in dBm, when the firmware reports one. */
24278
- rssiDbm: number().optional(),
24279
- /** Network name of a wireless link, when the firmware reports it. */
24280
- ssid: string().optional(),
24281
- /** Ms epoch of the last observation. Lets consumers reason about freshness. */
24282
- lastUpdated: number()
24283
- });
24284
- var networkLinkCapability = {
24285
- name: "network-link",
24286
- scope: "device",
24287
- deviceNative: true,
24288
- mode: "singleton",
24289
- deviceTypes: [
24290
- DeviceType.Camera,
24291
- DeviceType.Sensor,
24292
- DeviceType.Button,
24293
- DeviceType.Switch,
24294
- DeviceType.Light,
24295
- DeviceType.Lock,
24296
- DeviceType.Siren
24297
- ],
24298
- methods: {},
24299
- events: {
24300
- /**
24301
- * Emitted whenever the cached status changes (a link switch, a signal
24302
- * reading that moved). Mirrored on the parent chain by the
24303
- * DeviceEventPropagator like `battery.onStatusChanged`.
24304
- */
24305
- onStatusChanged: { data: object({
24306
- deviceId: number(),
24307
- status: NetworkLinkStatusSchema
24308
- }) } },
24309
- status: {
24310
- schema: NetworkLinkStatusSchema,
24311
- kind: "push",
24312
- empty: {
24313
- type: "unknown",
24314
- signalPercent: null,
24315
- lastUpdated: 0
24316
- }
24317
- },
24318
- /**
24319
- * Runtime-state slice — every provider stores the same shape under
24320
- * `device.runtimeState['network-link']`, read once by the badge and the
24321
- * Home Assistant projector regardless of the driver.
24322
- */
24323
- runtimeState: NetworkLinkStatusSchema,
24324
- /**
24325
- * Runtime-state durability: **restored** — a link reading is slow to
24326
- * change and a sleeping battery camera may not report for hours; the
24327
- * restored slice is what the badge shows until the next read.
24328
- *
24329
- * See `RuntimeStateDurability`. Enforced by
24330
- * `scripts/check-runtime-state-durability.ts`.
24331
- */
24332
- durability: "restored",
24333
- /** Clock fields: written, but excluded from the compare that decides
24334
- * whether persisting is worth a SQLite commit. */
24335
- volatileStateFields: ["lastUpdated"]
24336
- };
24337
- /**
24338
24383
  * Generic boolean sensor — last-resort fallback when no domain-
24339
24384
  * specific binary cap fits (Home Assistant `binary_sensor` without a
24340
24385
  * known `device_class`, or a domain we haven't typed yet). Pure
@@ -27864,6 +27909,369 @@ var nativeObjectDetectionCapability = {
27864
27909
  volatileStateFields: ["lastFetchedAt"]
27865
27910
  };
27866
27911
  /**
27912
+ * `navigation` — a device-scoped capability that natively expresses the FULL
27913
+ * navigation / action surface of a robot that DRIVES ITSELF and carries an
27914
+ * on-board camera (the Dreame robot-vacuum camera is the first provider).
27915
+ *
27916
+ * Why a NEW cap rather than overloading `ptz`:
27917
+ * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
27918
+ * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
27919
+ * The two are different physical models: PTZ is absolute-position + presets,
27920
+ * navigation is momentary drive nudges + discrete robot ACTIONS
27921
+ * (dock / spot-clean / follow-pet / go-to-point / …).
27922
+ * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
27923
+ * the reverse:
27924
+ * 1. a native CamStack navigation panel (data-driven from `listActions`
27925
+ * / `getOptions`), and
27926
+ * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
27927
+ * robot camera shows up in the existing PTZ control path without every
27928
+ * PTZ provider learning about robots. The mapping lives in the adapter,
27929
+ * not here (see the addon design note):
27930
+ * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
27931
+ * ptz.stop() → navigation.stop()
27932
+ * ptz.goHome() → navigation.runAction('goHome')
27933
+ * ptz.getPresets() → navigation.listActions() (id→preset)
27934
+ * ptz.goToPreset(id) → navigation.runAction(id)
27935
+ *
27936
+ * ## Continuous drive
27937
+ *
27938
+ * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
27939
+ * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
27940
+ * one `stop()` on release — exactly like the robot app's remote-drive joystick.
27941
+ * The provider forwards EACH `move` to one drive write; it must NOT debounce or
27942
+ * coalesce them. The UI owns the cadence.
27943
+ *
27944
+ * ## The action dictionary
27945
+ *
27946
+ * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
27947
+ * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
27948
+ * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
27949
+ * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
27950
+ * vendor-specific list. `kind: 'action'` entries are triggered with
27951
+ * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
27952
+ * (the entry carries the `soundId` to pass). The general primitives — `move`,
27953
+ * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
27954
+ *
27955
+ * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
27956
+ * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
27957
+ * that the currently-published `@apocaliss92/nodedreame` already exposes on
27958
+ * every device handle. A future nodedreame publish adds a typed
27959
+ * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
27960
+ * provider can then swap the raw calls for the typed methods with no change to
27961
+ * THIS contract.
27962
+ */
27963
+ /**
27964
+ * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
27965
+ * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
27966
+ * halts it.
27967
+ *
27968
+ * - `pan` — turn: negative = left, positive = right, 0 = straight.
27969
+ * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
27970
+ * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
27971
+ * vector by it (drivers without proportional drive ignore it).
27972
+ *
27973
+ * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
27974
+ * axis alone; an all-undefined nudge is a no-op.
27975
+ */
27976
+ var NavigationMoveCommandSchema = object({
27977
+ pan: number().min(-1).max(1).optional(),
27978
+ tilt: number().min(-1).max(1).optional(),
27979
+ speed: number().min(0).max(1).optional()
27980
+ });
27981
+ /**
27982
+ * The enumerated discrete actions a navigation-capable robot can perform via
27983
+ * `runAction`. This is the CLOSED vocabulary; a given device advertises the
27984
+ * subset it supports through `listActions`. Sounds are NOT here — they go through
27985
+ * `playSound` (see the `sound` dictionary entries).
27986
+ */
27987
+ var NavigationActionIdSchema = _enum([
27988
+ "goHome",
27989
+ "locate",
27990
+ "spotClean",
27991
+ "findPet",
27992
+ "personFollow",
27993
+ "stop",
27994
+ "startClean",
27995
+ "pauseClean",
27996
+ "dockWash",
27997
+ "autoEmpty",
27998
+ "flashOn",
27999
+ "flashOff"
28000
+ ]);
28001
+ /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
28002
+ var NavigationEntryKindSchema = _enum(["action", "sound"]);
28003
+ /**
28004
+ * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
28005
+ * native panel and the PTZ mimic render as a button.
28006
+ *
28007
+ * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
28008
+ * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
28009
+ * (`sound:meow`) whose `soundId` is passed to `playSound`.
28010
+ * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
28011
+ * - `label` — operator-facing English label.
28012
+ * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
28013
+ * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
28014
+ * PTZ render ONLY enabled entries. Data-driven: the provider
28015
+ * flips it from config, never by editing code.
28016
+ */
28017
+ var NavigationActionEntrySchema = object({
28018
+ id: string(),
28019
+ kind: NavigationEntryKindSchema,
28020
+ label: string(),
28021
+ icon: string(),
28022
+ /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
28023
+ soundId: number().int().optional(),
28024
+ /** Per-device feature flag — render this entry only when true. */
28025
+ enabled: boolean()
28026
+ });
28027
+ /** Coordinates for `goToPoint` — a point on the robot's live map. */
28028
+ var NavigationPointSchema = object({
28029
+ x: number(),
28030
+ y: number()
28031
+ });
28032
+ /**
28033
+ * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
28034
+ * The cap reports which are enabled so the UI / PTZ render only the controls
28035
+ * that are turned on for THIS device. Data-driven: the provider derives these
28036
+ * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
28037
+ * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
28038
+ * that are not dictionary entries.
28039
+ *
28040
+ * - `move` / `stop` — the momentary drive joystick.
28041
+ * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
28042
+ * map-coordinate plumbing is wired.
28043
+ * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
28044
+ * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
28045
+ * - `light` — the on/off fill-light toggle (works anytime).
28046
+ * - `lightMode` — the auto/manual selector + manual level slider (a
28047
+ * camera-service control; needs an active stream).
28048
+ */
28049
+ var NavigationFeaturesSchema = object({
28050
+ move: boolean(),
28051
+ stop: boolean(),
28052
+ goToPoint: boolean(),
28053
+ runAction: boolean(),
28054
+ playSound: boolean(),
28055
+ light: boolean(),
28056
+ lightMode: boolean()
28057
+ });
28058
+ /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
28059
+ var NavigationLightModeSchema = _enum(["auto", "manual"]);
28060
+ /**
28061
+ * Live navigation state so the UI can reflect what the robot is doing:
28062
+ * - `mode` — coarse activity (idle / cleaning / following / …).
28063
+ * - `following` — person/pet follow is currently armed.
28064
+ * - `flash` — the on-camera fill light is on.
28065
+ * - `lightMode` — auto vs manual fill-light mode.
28066
+ * - `lightLevel` — manual fill-light level (40..100); meaningful when
28067
+ * `lightMode === 'manual'`.
28068
+ */
28069
+ var NavigationStatusSchema = object({
28070
+ mode: _enum([
28071
+ "idle",
28072
+ "cleaning",
28073
+ "spot",
28074
+ "following",
28075
+ "goto",
28076
+ "returning",
28077
+ "paused",
28078
+ "unknown"
28079
+ ]),
28080
+ following: boolean(),
28081
+ flash: boolean(),
28082
+ lightMode: NavigationLightModeSchema,
28083
+ lightLevel: number().min(40).max(100),
28084
+ /** Ms epoch when the slice was last updated. */
28085
+ lastChangedAt: number()
28086
+ });
28087
+ /**
28088
+ * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
28089
+ * observable). Adds `lastFetchedAt` on top of the status shape per the
28090
+ * convention.
28091
+ */
28092
+ var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
28093
+ var navigationCapability = {
28094
+ name: "navigation",
28095
+ scope: "device",
28096
+ deviceNative: true,
28097
+ mode: "singleton",
28098
+ deviceTypes: [DeviceType.Camera],
28099
+ deviceConfig: { ui: {
28100
+ kind: "widget",
28101
+ widgetId: "host/navigation-panel",
28102
+ tab: "navigation",
28103
+ topTab: true,
28104
+ label: "Navigation",
28105
+ order: 0
28106
+ } },
28107
+ methods: {
28108
+ /**
28109
+ * Momentary drive nudge (the robot moves). `protected` — mirrors
28110
+ * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
28111
+ * path) works for any authenticated user, not admin-only. The UI sends
28112
+ * these at ~1 Hz while a control is held; the provider forwards each one to
28113
+ * a single drive write WITHOUT debouncing.
28114
+ */
28115
+ move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28116
+ /** Halt all motion immediately (zero drive vector). */
28117
+ stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
28118
+ /** Send the robot to a point on its live map. */
28119
+ goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
28120
+ /**
28121
+ * Enumerate the discrete controls THIS device supports (data-driven UI +
28122
+ * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
28123
+ */
28124
+ listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
28125
+ /**
28126
+ * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
28127
+ * unsupported action ids are rejected by the provider.
28128
+ */
28129
+ runAction: method(object({
28130
+ deviceId: number(),
28131
+ actionId: NavigationActionIdSchema
28132
+ }), _void(), { kind: "mutation" }),
28133
+ /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
28134
+ playSound: method(object({
28135
+ deviceId: number(),
28136
+ soundId: number().int()
28137
+ }), _void(), { kind: "mutation" }),
28138
+ /**
28139
+ * Turn the on-camera fill light on / off (the `OpenFullLight` control —
28140
+ * works anytime, no active stream required).
28141
+ */
28142
+ setLightOn: method(object({
28143
+ deviceId: number(),
28144
+ on: boolean()
28145
+ }), _void(), { kind: "mutation" }),
28146
+ /**
28147
+ * Set the fill-light mode (auto vs manual). `manual` optionally carries the
28148
+ * initial `level`. The auto/manual + level control is a CAMERA-service
28149
+ * action that generally needs an active camera stream/monitor session — the
28150
+ * UI shows the manual level slider ONLY when `mode === 'manual'`.
28151
+ */
28152
+ setLightMode: method(object({
28153
+ deviceId: number(),
28154
+ mode: NavigationLightModeSchema,
28155
+ level: number().min(40).max(100).optional()
28156
+ }), _void(), { kind: "mutation" }),
28157
+ /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
28158
+ setLightLevel: method(object({
28159
+ deviceId: number(),
28160
+ level: number().min(40).max(100)
28161
+ }), _void(), { kind: "mutation" }),
28162
+ /**
28163
+ * Per-device FEATURE-FLAG report for the general primitives — drives which
28164
+ * controls the UI shows (the per-entry flags for the dictionary come back on
28165
+ * `listActions`).
28166
+ */
28167
+ getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
28168
+ },
28169
+ events: { onStatusChanged: { data: object({
28170
+ deviceId: number(),
28171
+ status: NavigationStatusSchema
28172
+ }) } },
28173
+ status: {
28174
+ schema: NavigationStatusSchema,
28175
+ kind: "push"
28176
+ },
28177
+ /**
28178
+ * Runtime-state slice mirrored by the kernel. The navigation panel watches it
28179
+ * for live mode / follow / flash changes.
28180
+ */
28181
+ runtimeState: NavigationRuntimeStateSchema,
28182
+ /**
28183
+ * Runtime-state durability: **session** — like `vacuum-control`, a restored
28184
+ * `mode: cleaning` / `following: true` is a robot that is not actually doing
28185
+ * that. The live handle re-publishes on connect.
28186
+ *
28187
+ * See `RuntimeStateDurability`. Enforced by
28188
+ * `scripts/check-runtime-state-durability.ts`.
28189
+ */
28190
+ durability: "session"
28191
+ };
28192
+ /**
28193
+ * Network-link snapshot. Same shape for every provider (a Reolink wifi
28194
+ * camera, a Home Assistant device with a signal-strength sensor, a Tapo
28195
+ * plug): one slice under `device.runtimeState['network-link']`, one badge,
28196
+ * one Home Assistant projection.
28197
+ */
28198
+ var NetworkLinkStatusSchema = object({
28199
+ /** The link the device is on. `'unknown'` = not read yet, not "no link". */
28200
+ type: _enum([
28201
+ "wifi",
28202
+ "ethernet",
28203
+ "cellular",
28204
+ "unknown"
28205
+ ]),
28206
+ /**
28207
+ * Link quality, 0..100 inclusive, normalised by the provider from whatever
28208
+ * the firmware reports (bars, RSSI, a vendor scale). **`null` means NOT
28209
+ * KNOWN or NOT APPLICABLE** — a wired link has no signal, and a wireless
28210
+ * one whose reading has not landed must not be drawn at 0 %. Consumers
28211
+ * SKIP a null rather than coerce it.
28212
+ */
28213
+ signalPercent: number().min(0).max(100).nullable(),
28214
+ /** Raw received signal strength in dBm, when the firmware reports one. */
28215
+ rssiDbm: number().optional(),
28216
+ /** Network name of a wireless link, when the firmware reports it. */
28217
+ ssid: string().optional(),
28218
+ /** Ms epoch of the last observation. Lets consumers reason about freshness. */
28219
+ lastUpdated: number()
28220
+ });
28221
+ var networkLinkCapability = {
28222
+ name: "network-link",
28223
+ scope: "device",
28224
+ deviceNative: true,
28225
+ mode: "singleton",
28226
+ deviceTypes: [
28227
+ DeviceType.Camera,
28228
+ DeviceType.Sensor,
28229
+ DeviceType.Button,
28230
+ DeviceType.Switch,
28231
+ DeviceType.Light,
28232
+ DeviceType.Lock,
28233
+ DeviceType.Siren
28234
+ ],
28235
+ methods: {},
28236
+ events: {
28237
+ /**
28238
+ * Emitted whenever the cached status changes (a link switch, a signal
28239
+ * reading that moved). Mirrored on the parent chain by the
28240
+ * DeviceEventPropagator like `battery.onStatusChanged`.
28241
+ */
28242
+ onStatusChanged: { data: object({
28243
+ deviceId: number(),
28244
+ status: NetworkLinkStatusSchema
28245
+ }) } },
28246
+ status: {
28247
+ schema: NetworkLinkStatusSchema,
28248
+ kind: "push",
28249
+ empty: {
28250
+ type: "unknown",
28251
+ signalPercent: null,
28252
+ lastUpdated: 0
28253
+ }
28254
+ },
28255
+ /**
28256
+ * Runtime-state slice — every provider stores the same shape under
28257
+ * `device.runtimeState['network-link']`, read once by the badge and the
28258
+ * Home Assistant projector regardless of the driver.
28259
+ */
28260
+ runtimeState: NetworkLinkStatusSchema,
28261
+ /**
28262
+ * Runtime-state durability: **restored** — a link reading is slow to
28263
+ * change and a sleeping battery camera may not report for hours; the
28264
+ * restored slice is what the badge shows until the next read.
28265
+ *
28266
+ * See `RuntimeStateDurability`. Enforced by
28267
+ * `scripts/check-runtime-state-durability.ts`.
28268
+ */
28269
+ durability: "restored",
28270
+ /** Clock fields: written, but excluded from the compare that decides
28271
+ * whether persisting is worth a SQLite commit. */
28272
+ volatileStateFields: ["lastUpdated"]
28273
+ };
28274
+ /**
27867
28275
  * network-quality — system-scoped singleton capability tracking RTT,
27868
28276
  * jitter, and observed/peak bandwidth per device + per client.
27869
28277
  *
@@ -29553,287 +29961,6 @@ var ptzAutotrackCapability = {
29553
29961
  durability: "session"
29554
29962
  };
29555
29963
  /**
29556
- * `navigation` — a device-scoped capability that natively expresses the FULL
29557
- * navigation / action surface of a robot that DRIVES ITSELF and carries an
29558
- * on-board camera (the Dreame robot-vacuum camera is the first provider).
29559
- *
29560
- * Why a NEW cap rather than overloading `ptz`:
29561
- * - `ptz` moves a *gimbal* on a fixed camera (pan/tilt/zoom of the lens). A
29562
- * robot vacuum has no gimbal — the whole chassis drives, turns and spins.
29563
- * The two are different physical models: PTZ is absolute-position + presets,
29564
- * navigation is momentary drive nudges + discrete robot ACTIONS
29565
- * (dock / spot-clean / follow-pet / go-to-point / …).
29566
- * - This cap is the SOURCE OF TRUTH. Two consumers adapt from it rather than
29567
- * the reverse:
29568
- * 1. a native CamStack navigation panel (data-driven from `listActions`
29569
- * / `getOptions`), and
29570
- * 2. the PTZ surface — a thin adapter mimics `ptz` from `navigation` so a
29571
- * robot camera shows up in the existing PTZ control path without every
29572
- * PTZ provider learning about robots. The mapping lives in the adapter,
29573
- * not here (see the addon design note):
29574
- * ptz.continuousMove({pan,tilt}) → navigation.move({pan,tilt})
29575
- * ptz.stop() → navigation.stop()
29576
- * ptz.goHome() → navigation.runAction('goHome')
29577
- * ptz.getPresets() → navigation.listActions() (id→preset)
29578
- * ptz.goToPreset(id) → navigation.runAction(id)
29579
- *
29580
- * ## Continuous drive
29581
- *
29582
- * `move` is MOMENTARY. Fluid navigation comes from the UI (or the PTZ adapter)
29583
- * sending `move({pan,tilt})` REPEATEDLY at ~1 Hz while a direction is held, and
29584
- * one `stop()` on release — exactly like the robot app's remote-drive joystick.
29585
- * The provider forwards EACH `move` to one drive write; it must NOT debounce or
29586
- * coalesce them. The UI owns the cadence.
29587
- *
29588
- * ## The action dictionary
29589
- *
29590
- * The discrete controls (dock / locate / spot-clean / follow / flash / sounds)
29591
- * are a DATA-DRIVEN dictionary the cap exposes via `listActions()`. Each entry
29592
- * carries `{ id, kind, label, icon }` (plus `soundId` for sound entries) so the
29593
- * native panel AND the PTZ mimic render buttons WITHOUT hardcoding a
29594
- * vendor-specific list. `kind: 'action'` entries are triggered with
29595
- * `runAction({ actionId })`; `kind: 'sound'` entries with `playSound({ soundId })`
29596
- * (the entry carries the `soundId` to pass). The general primitives — `move`,
29597
- * `stop`, `goToPoint` — stay as first-class methods, not dictionary entries.
29598
- *
29599
- * NOTE (provider wiring): the first provider (Dreame) drives this with the RAW
29600
- * `callAction(siid,aiid,in)` / `setProperty({siid,piid,value})` MIoT primitives
29601
- * that the currently-published `@apocaliss92/nodedreame` already exposes on
29602
- * every device handle. A future nodedreame publish adds a typed
29603
- * `DreameCameraController` (drive / playPetSound / spotClean / findPet / …); the
29604
- * provider can then swap the raw calls for the typed methods with no change to
29605
- * THIS contract.
29606
- */
29607
- /**
29608
- * A momentary drive nudge. The robot MOVES (no gimbal) for as long as the caller
29609
- * keeps sending nudges (~1 Hz); an explicit `stop` (or letting the nudges lapse)
29610
- * halts it.
29611
- *
29612
- * - `pan` — turn: negative = left, positive = right, 0 = straight.
29613
- * - `tilt` — throttle: positive = forward, negative = spin / turn-around.
29614
- * - `speed` — optional intensity hint [0, 1]; the provider may scale the drive
29615
- * vector by it (drivers without proportional drive ignore it).
29616
- *
29617
- * `pan` / `tilt` are normalized [-1, 1]. Both optional so a caller can nudge one
29618
- * axis alone; an all-undefined nudge is a no-op.
29619
- */
29620
- var NavigationMoveCommandSchema = object({
29621
- pan: number().min(-1).max(1).optional(),
29622
- tilt: number().min(-1).max(1).optional(),
29623
- speed: number().min(0).max(1).optional()
29624
- });
29625
- /**
29626
- * The enumerated discrete actions a navigation-capable robot can perform via
29627
- * `runAction`. This is the CLOSED vocabulary; a given device advertises the
29628
- * subset it supports through `listActions`. Sounds are NOT here — they go through
29629
- * `playSound` (see the `sound` dictionary entries).
29630
- */
29631
- var NavigationActionIdSchema = _enum([
29632
- "goHome",
29633
- "locate",
29634
- "spotClean",
29635
- "findPet",
29636
- "personFollow",
29637
- "stop",
29638
- "startClean",
29639
- "pauseClean",
29640
- "dockWash",
29641
- "autoEmpty",
29642
- "flashOn",
29643
- "flashOff"
29644
- ]);
29645
- /** Whether a dictionary entry is a `runAction` action or a `playSound` sound. */
29646
- var NavigationEntryKindSchema = _enum(["action", "sound"]);
29647
- /**
29648
- * One entry in the navigation action dictionary — the DATA-DRIVEN unit both the
29649
- * native panel and the PTZ mimic render as a button.
29650
- *
29651
- * - `id` — stable id. For `kind:'action'` it is a {@link NavigationActionId}
29652
- * (pass to `runAction`); for `kind:'sound'` it is a namespaced id
29653
- * (`sound:meow`) whose `soundId` is passed to `playSound`.
29654
- * - `icon` — icon HINT (lucide-style name; the UI maps it to its own set).
29655
- * - `label` — operator-facing English label.
29656
- * - `soundId` — wire sound id, present only on `kind:'sound'` entries.
29657
- * - `enabled` — per-device FEATURE FLAG. `listActions` reports it so the UI /
29658
- * PTZ render ONLY enabled entries. Data-driven: the provider
29659
- * flips it from config, never by editing code.
29660
- */
29661
- var NavigationActionEntrySchema = object({
29662
- id: string(),
29663
- kind: NavigationEntryKindSchema,
29664
- label: string(),
29665
- icon: string(),
29666
- /** Present only on `kind:'sound'` entries — the id to pass to `playSound`. */
29667
- soundId: number().int().optional(),
29668
- /** Per-device feature flag — render this entry only when true. */
29669
- enabled: boolean()
29670
- });
29671
- /** Coordinates for `goToPoint` — a point on the robot's live map. */
29672
- var NavigationPointSchema = object({
29673
- x: number(),
29674
- y: number()
29675
- });
29676
- /**
29677
- * Per-device FEATURE-FLAG report for the general (non-dictionary) primitives.
29678
- * The cap reports which are enabled so the UI / PTZ render only the controls
29679
- * that are turned on for THIS device. Data-driven: the provider derives these
29680
- * from config + probe, never hardcoded in the UI. The per-DICTIONARY-entry flags
29681
- * live on {@link NavigationActionEntrySchema.enabled}; these gate the primitives
29682
- * that are not dictionary entries.
29683
- *
29684
- * - `move` / `stop` — the momentary drive joystick.
29685
- * - `goToPoint` — send-to-map-coordinate. Ships OFF on Dreame until the
29686
- * map-coordinate plumbing is wired.
29687
- * - `runAction` — the discrete action buttons (dictionary `kind:'action'`).
29688
- * - `playSound` — the sound buttons (dictionary `kind:'sound'`).
29689
- * - `light` — the on/off fill-light toggle (works anytime).
29690
- * - `lightMode` — the auto/manual selector + manual level slider (a
29691
- * camera-service control; needs an active stream).
29692
- */
29693
- var NavigationFeaturesSchema = object({
29694
- move: boolean(),
29695
- stop: boolean(),
29696
- goToPoint: boolean(),
29697
- runAction: boolean(),
29698
- playSound: boolean(),
29699
- light: boolean(),
29700
- lightMode: boolean()
29701
- });
29702
- /** Light mode: `auto` lets the camera choose brightness; `manual` uses `level`. */
29703
- var NavigationLightModeSchema = _enum(["auto", "manual"]);
29704
- /**
29705
- * Live navigation state so the UI can reflect what the robot is doing:
29706
- * - `mode` — coarse activity (idle / cleaning / following / …).
29707
- * - `following` — person/pet follow is currently armed.
29708
- * - `flash` — the on-camera fill light is on.
29709
- * - `lightMode` — auto vs manual fill-light mode.
29710
- * - `lightLevel` — manual fill-light level (40..100); meaningful when
29711
- * `lightMode === 'manual'`.
29712
- */
29713
- var NavigationStatusSchema = object({
29714
- mode: _enum([
29715
- "idle",
29716
- "cleaning",
29717
- "spot",
29718
- "following",
29719
- "goto",
29720
- "returning",
29721
- "paused",
29722
- "unknown"
29723
- ]),
29724
- following: boolean(),
29725
- flash: boolean(),
29726
- lightMode: NavigationLightModeSchema,
29727
- lightLevel: number().min(40).max(100),
29728
- /** Ms epoch when the slice was last updated. */
29729
- lastChangedAt: number()
29730
- });
29731
- /**
29732
- * Runtime-state slice owned by this cap (kernel-managed: validated, mirrored,
29733
- * observable). Adds `lastFetchedAt` on top of the status shape per the
29734
- * convention.
29735
- */
29736
- var NavigationRuntimeStateSchema = NavigationStatusSchema.extend({ lastFetchedAt: number() });
29737
- var navigationCapability = {
29738
- name: "navigation",
29739
- scope: "device",
29740
- deviceNative: true,
29741
- mode: "singleton",
29742
- deviceTypes: [DeviceType.Camera],
29743
- deviceConfig: { ui: {
29744
- kind: "widget",
29745
- widgetId: "host/navigation-panel",
29746
- tab: "navigation",
29747
- topTab: true,
29748
- label: "Navigation",
29749
- order: 0
29750
- } },
29751
- methods: {
29752
- /**
29753
- * Momentary drive nudge (the robot moves). `protected` — mirrors
29754
- * `ptz.continuousMove` so the Viewer navigation panel (and the PTZ-mimic
29755
- * path) works for any authenticated user, not admin-only. The UI sends
29756
- * these at ~1 Hz while a control is held; the provider forwards each one to
29757
- * a single drive write WITHOUT debouncing.
29758
- */
29759
- move: method(NavigationMoveCommandSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29760
- /** Halt all motion immediately (zero drive vector). */
29761
- stop: method(object({ deviceId: number() }), _void(), { kind: "mutation" }),
29762
- /** Send the robot to a point on its live map. */
29763
- goToPoint: method(NavigationPointSchema.extend({ deviceId: number() }), _void(), { kind: "mutation" }),
29764
- /**
29765
- * Enumerate the discrete controls THIS device supports (data-driven UI +
29766
- * PTZ mimic). Camera-probed subset of {@link NAVIGATION_ACTION_CATALOG}.
29767
- */
29768
- listActions: method(object({ deviceId: number() }), array(NavigationActionEntrySchema)),
29769
- /**
29770
- * Run one discrete action (a `kind:'action'` dictionary entry). Invalid /
29771
- * unsupported action ids are rejected by the provider.
29772
- */
29773
- runAction: method(object({
29774
- deviceId: number(),
29775
- actionId: NavigationActionIdSchema
29776
- }), _void(), { kind: "mutation" }),
29777
- /** Play a sound by its wire id (the `soundId` of a `kind:'sound'` entry). */
29778
- playSound: method(object({
29779
- deviceId: number(),
29780
- soundId: number().int()
29781
- }), _void(), { kind: "mutation" }),
29782
- /**
29783
- * Turn the on-camera fill light on / off (the `OpenFullLight` control —
29784
- * works anytime, no active stream required).
29785
- */
29786
- setLightOn: method(object({
29787
- deviceId: number(),
29788
- on: boolean()
29789
- }), _void(), { kind: "mutation" }),
29790
- /**
29791
- * Set the fill-light mode (auto vs manual). `manual` optionally carries the
29792
- * initial `level`. The auto/manual + level control is a CAMERA-service
29793
- * action that generally needs an active camera stream/monitor session — the
29794
- * UI shows the manual level slider ONLY when `mode === 'manual'`.
29795
- */
29796
- setLightMode: method(object({
29797
- deviceId: number(),
29798
- mode: NavigationLightModeSchema,
29799
- level: number().min(40).max(100).optional()
29800
- }), _void(), { kind: "mutation" }),
29801
- /** Set the MANUAL fill-light level (40..100). Implies `manual` mode. */
29802
- setLightLevel: method(object({
29803
- deviceId: number(),
29804
- level: number().min(40).max(100)
29805
- }), _void(), { kind: "mutation" }),
29806
- /**
29807
- * Per-device FEATURE-FLAG report for the general primitives — drives which
29808
- * controls the UI shows (the per-entry flags for the dictionary come back on
29809
- * `listActions`).
29810
- */
29811
- getFeatures: method(object({ deviceId: number() }), NavigationFeaturesSchema)
29812
- },
29813
- events: { onStatusChanged: { data: object({
29814
- deviceId: number(),
29815
- status: NavigationStatusSchema
29816
- }) } },
29817
- status: {
29818
- schema: NavigationStatusSchema,
29819
- kind: "push"
29820
- },
29821
- /**
29822
- * Runtime-state slice mirrored by the kernel. The navigation panel watches it
29823
- * for live mode / follow / flash changes.
29824
- */
29825
- runtimeState: NavigationRuntimeStateSchema,
29826
- /**
29827
- * Runtime-state durability: **session** — like `vacuum-control`, a restored
29828
- * `mode: cleaning` / `following: true` is a robot that is not actually doing
29829
- * that. The live handle re-publishes on connect.
29830
- *
29831
- * See `RuntimeStateDurability`. Enforced by
29832
- * `scripts/check-runtime-state-durability.ts`.
29833
- */
29834
- durability: "session"
29835
- };
29836
- /**
29837
29964
  * reboot — device-scoped capability for "soft" device reboots (firmware
29838
29965
  * reboot via vendor protocol; cameras, NVRs, doorbells). Surfaces a
29839
29966
  * single mutation so the UI can offer a confirm-and-reboot button for
@@ -39745,13 +39872,13 @@ Object.freeze({
39745
39872
  addonId: null,
39746
39873
  access: "view"
39747
39874
  },
39748
- "storage.getDefaultLocation": {
39875
+ "storage.list": {
39749
39876
  capName: "storage",
39750
39877
  capScope: "system",
39751
39878
  addonId: null,
39752
39879
  access: "view"
39753
39880
  },
39754
- "storage.list": {
39881
+ "storage.listDrainProgress": {
39755
39882
  capName: "storage",
39756
39883
  capScope: "system",
39757
39884
  addonId: null,
@@ -39901,6 +40028,12 @@ Object.freeze({
39901
40028
  addonId: null,
39902
40029
  access: "view"
39903
40030
  },
40031
+ "storageOccupancy.getOccupancy": {
40032
+ capName: "storage-occupancy",
40033
+ capScope: "system",
40034
+ addonId: null,
40035
+ access: "view"
40036
+ },
39904
40037
  "storageProvider.abortUpload": {
39905
40038
  capName: "storage-provider",
39906
40039
  capScope: "system",