@camstack/addon-provider-dreame 0.2.43 → 0.2.46

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 +387 -19
  2. package/dist/addon.mjs +387 -19
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -58508,6 +58508,21 @@ var RelocateJobSchema = object({
58508
58508
  bytesMoved: number().int(),
58509
58509
  /** Total files discovered up front; null while (or when) unknown. */
58510
58510
  filesTotal: number().int().nullable(),
58511
+ /**
58512
+ * Rows this run CORRECTED while moving them — a durable mutation the move
58513
+ * made that nobody asked for, so it is reported where the operator reads the
58514
+ * job rather than only in a log line.
58515
+ *
58516
+ * A footage segment records its byte count in its own NAME, and the durable
58517
+ * hour row derives its aggregates from those names. A file that does not
58518
+ * match its name therefore makes the ledger's sums — and with them quota and
58519
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
58520
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
58521
+ *
58522
+ * Absent on lanes where the question has no meaning: a media blob's size is
58523
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
58524
+ */
58525
+ rowsReconciled: number().int().nonnegative().optional(),
58511
58526
  startedAt: number(),
58512
58527
  finishedAt: number().nullable(),
58513
58528
  error: string().nullable()
@@ -58576,14 +58591,42 @@ var RelocateMediaInputSchema = object({
58576
58591
  /** Omitted = `move`, the pre-existing behaviour. */
58577
58592
  mode: MediaRelocateModeSchema.optional()
58578
58593
  });
58579
- /** How many rows still carry NO `locationId` — the population a repoint would
58580
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
58581
- * value that permits a non-blocking `eventMedia` cutover. */
58582
- var UnstampedEventMediaCountSchema = object({
58583
- media: number().int().nonnegative(),
58584
- retrainFrames: number().int().nonnegative(),
58585
- total: number().int().nonnegative()
58594
+ /**
58595
+ * The unstamped population of ONE collection — split, because the gate and the
58596
+ * operator ask two different questions and only one of them has to be cheap.
58597
+ *
58598
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
58599
+ * repoint". It is a single indexed seek to the first matching row, so it stays
58600
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
58601
+ * that matters — after a seal, when the population is empty.
58602
+ *
58603
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
58604
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
58605
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
58606
+ * and useful answer: "there are some, and this read could not say how many"
58607
+ * still refuses the cutover, which is the whole job.
58608
+ */
58609
+ var UnstampedRowsSchema = object({
58610
+ present: boolean(),
58611
+ rows: number().int().nonnegative().nullable()
58586
58612
  });
58613
+ /**
58614
+ * How many rows still carry NO `locationId` — the population a repoint would
58615
+ * silently re-aim at a disk that does not hold their bytes.
58616
+ *
58617
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
58618
+ * over. The gate opens on a measured absence and on nothing else; an unread
58619
+ * collection and an empty one are different facts, and this repo has already
58620
+ * paid for conflating them (`RelocateResidueSchema`, D295).
58621
+ */
58622
+ var UnstampedEventMediaCountSchema = object({
58623
+ media: UnstampedRowsSchema,
58624
+ retrainFrames: UnstampedRowsSchema,
58625
+ /** True when EITHER collection holds one. The refusal reads this. */
58626
+ anyPresent: boolean(),
58627
+ /** Sum across both, or `null` when either lane could not be counted. */
58628
+ total: number().int().nonnegative().nullable()
58629
+ }).nullable();
58587
58630
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58588
58631
  /** The independently selectable logical storage classes — every class
58589
58632
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -58669,13 +58712,53 @@ var StorageMigrationParticipantSchema = _enum([
58669
58712
  "recorder",
58670
58713
  "analytics"
58671
58714
  ]);
58715
+ /**
58716
+ * The mover's own numbers, folded onto the coordinator's durable move record.
58717
+ *
58718
+ * The long half of a non-blocking migration is `draining`, and it is measured
58719
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
58720
+ * existed the only place those numbers appeared was a Loki line, so an operator
58721
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
58722
+ * afternoon.
58723
+ *
58724
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
58725
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
58726
+ * mover — which is the exact failure this is meant to end. The coordinator's
58727
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
58728
+ * read `state`; folding the counters costs no extra read and makes the durable
58729
+ * record say afterwards how far a move actually got.
58730
+ *
58731
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
58732
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
58733
+ * cannot say M, and a 0 there would render as "100 % done".
58734
+ */
58735
+ var StorageMigrationMoveProgressSchema = object({
58736
+ filesMoved: number().int().nonnegative(),
58737
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58738
+ filesTotal: number().int().nonnegative().nullable(),
58739
+ bytesMoved: number().int().nonnegative(),
58740
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
58741
+ * a lane that cannot reconcile. A migration that silently rewrote durable
58742
+ * rows would be the same failure as one that silently skipped them. */
58743
+ rowsReconciled: number().int().nonnegative().optional(),
58744
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
58745
+ * crash gets a new mover, and a rate computed from the migration's start
58746
+ * would silently average in the time nothing was running. */
58747
+ startedAt: number(),
58748
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
58749
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
58750
+ * subtract its own. */
58751
+ observedAt: number()
58752
+ });
58672
58753
  var StorageMigrationMoveSchema = object({
58673
58754
  storageClass: StorageMigrationClassSchema,
58674
58755
  fromLocationId: string(),
58675
58756
  toLocationId: string(),
58676
58757
  moverJobId: string().nullable(),
58677
58758
  state: RelocateJobStateSchema.nullable(),
58678
- error: string().nullable()
58759
+ error: string().nullable(),
58760
+ /** Last observed mover counters; `null` until the mover has been polled once. */
58761
+ progress: StorageMigrationMoveProgressSchema.nullable()
58679
58762
  });
58680
58763
  var StorageMigrationJobSchema = object({
58681
58764
  jobId: string(),
@@ -58721,6 +58804,98 @@ var StorageMigrationPlanSchema = object({
58721
58804
  findings: array(StorageMigrationFindingSchema)
58722
58805
  });
58723
58806
  /**
58807
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
58808
+ *
58809
+ * The coordinator's job record is the state of record for a migration, and its
58810
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
58811
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
58812
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
58813
+ * way because no supported UI path existed. A mover armed like that has no job
58814
+ * to fold progress into, so it has to be readable on its own or it is invisible.
58815
+ *
58816
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
58817
+ * orchestrated it.
58818
+ */
58819
+ var StorageMigrationMoverSchema = object({
58820
+ lane: _enum(["footage", "media"]),
58821
+ job: RelocateJobSchema,
58822
+ /** The coordinator job that armed this mover, or `null` for a mover armed
58823
+ * directly against the owning addon. */
58824
+ migrationJobId: string().nullable(),
58825
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
58826
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
58827
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
58828
+ * rate made of two different clocks. */
58829
+ observedAt: number()
58830
+ });
58831
+ /**
58832
+ * What a SOURCE still holds for one storage class — the number that makes a
58833
+ * "drain remaining" action honest rather than hopeful.
58834
+ *
58835
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
58836
+ * engine's own selection count for media), never from the resident index: a
58837
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
58838
+ * never been told about (D295).
58839
+ *
58840
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
58841
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
58842
+ * because refusing on an unanswerable read would hide exactly the case an
58843
+ * operator needs to act on.
58844
+ */
58845
+ var StorageMigrationResidueSchema = object({
58846
+ storageClass: StorageMigrationClassSchema,
58847
+ /** The location still holding the data. `'*'` for the media lane, whose rows
58848
+ * move from wherever they are rather than from one named source. */
58849
+ fromLocationId: string(),
58850
+ /** Where a drain would move it — the class's CURRENT default. */
58851
+ toLocationId: string(),
58852
+ /** Segments (footage lane) or rows (media lane) still on the source. */
58853
+ items: number().int().nonnegative().nullable(),
58854
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
58855
+ bytes: number().int().nonnegative().nullable()
58856
+ });
58857
+ /**
58858
+ * Run the DRAIN half and nothing else.
58859
+ *
58860
+ * A migration that reached `done` has already repointed, so `start` correctly
58861
+ * refuses its destination ("already the default") — there is nothing left to
58862
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
58863
+ * or finish against a work list that was a tenth of the archive (D295), and
58864
+ * before this there was no supported way to run only that half: the only way
58865
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
58866
+ *
58867
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
58868
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
58869
+ * re-repoint a class that is already migrated.
58870
+ */
58871
+ var StorageMigrationDrainInputSchema = object({
58872
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
58873
+ * a class whose source is already empty is refused rather than started. */
58874
+ classes: array(StorageMigrationClassSchema).min(1),
58875
+ throttleMbps: number().min(1).max(1e3).optional()
58876
+ });
58877
+ /** What a footage source still holds, asked of the durable hour ledger. */
58878
+ var RelocateResidueInputSchema = object({
58879
+ fromLocationId: string().min(1),
58880
+ /** Narrow to one logical class; omit for every profile on the location. */
58881
+ footageClass: RelocateFootageClassSchema.optional()
58882
+ });
58883
+ /** `null` = the archive could not answer (no ledger on this node, or the
58884
+ * aggregate failed). Never conflated with an empty source. */
58885
+ var RelocateResidueSchema = object({
58886
+ segments: number().int().nonnegative(),
58887
+ bytes: number().int().nonnegative()
58888
+ }).nullable();
58889
+ /** How many rows a media pass would still act on against a given target — the
58890
+ * media lane's denominator AND its residue, from ONE derivation so the two can
58891
+ * never disagree. `null` = the count could not be taken. */
58892
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
58893
+ var RelocatableMediaCountInputSchema = object({
58894
+ toLocationId: string().min(1),
58895
+ /** Omitted = `move`. */
58896
+ mode: MediaRelocateModeSchema.optional()
58897
+ });
58898
+ /**
58724
58899
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
58725
58900
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
58726
58901
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -58824,6 +58999,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
58824
58999
  * two addons declaring the same `id` must agree on `cardinality` (validated
58825
59000
  * at kernel aggregation time, not here).
58826
59001
  */
59002
+ /**
59003
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
59004
+ * actually reaches the bytes. It is the constraint that decides which
59005
+ * `storage-provider`s may back a location of that kind.
59006
+ *
59007
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
59008
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
59009
+ * post-analysis media roots). Only a provider that serves a genuine local
59010
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
59011
+ * remote provider's `resolve` returns a path on the REMOTE host, and
59012
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
59013
+ * against a same-named local directory that is something else entirely.
59014
+ *
59015
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
59016
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
59017
+ * service never sees a path, so any provider can back it. `backups` is the
59018
+ * one kind that qualifies today.
59019
+ *
59020
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
59021
+ * an EMERGENT property of how the recorder happened to be written. Nothing
59022
+ * refused the configuration; the first write simply went somewhere wrong, and
59023
+ * a recording write that goes wrong surfaces as a silent black window rather
59024
+ * than an error (the read path does not `stat`). This turns that accident into
59025
+ * a declared, enforced, testable refusal.
59026
+ */
59027
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
58827
59028
  var StorageLocationDeclarationSchema = object({
58828
59029
  /**
58829
59030
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -58843,6 +59044,19 @@ var StorageLocationDeclarationSchema = object({
58843
59044
  */
58844
59045
  cardinality: _enum(["single", "multi"]),
58845
59046
  /**
59047
+ * HOW the declaring service reaches the bytes — and therefore WHICH
59048
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
59049
+ * and {@link STORAGE_ACCESS_FALLBACK}.
59050
+ *
59051
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
59052
+ * can only over-restrict (refuse a remote provider for a kind that might
59053
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
59054
+ * permissive direction and is therefore never inferred — a repo guard
59055
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
59056
+ * reached by omission.
59057
+ */
59058
+ access: StorageAccessSchema.optional(),
59059
+ /**
58846
59060
  * When set, the default instance for this location inherits its resolved
58847
59061
  * root from the named location's default instance. Useful for derivative
58848
59062
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -68727,8 +68941,10 @@ var TrackSchema = object({
68727
68941
  lastSeen: number(),
68728
68942
  /** Frame-rate position history (subject to maxPositionHistory cap). */
68729
68943
  positions: array(TrackPositionSchema).readonly(),
68730
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
68731
- * saveThumbnails policy). */
68944
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
68945
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
68946
+ * the retired `saveThumbnails` used to gate this and the rolling
68947
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
68732
68948
  snapshots: array(TrackSnapshotSchema).readonly(),
68733
68949
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
68734
68950
  zonesVisited: array(string()).readonly(),
@@ -69588,7 +69804,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69588
69804
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
69589
69805
  kind: "mutation",
69590
69806
  auth: "admin"
69591
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
69807
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
69808
+ kind: "query",
69809
+ auth: "admin"
69810
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
69592
69811
  kind: "query",
69593
69812
  auth: "admin"
69594
69813
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -71547,6 +71766,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
71547
71766
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
71548
71767
  kind: "mutation",
71549
71768
  auth: "admin"
71769
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
71770
+ kind: "mutation",
71771
+ auth: "admin"
71550
71772
  });
71551
71773
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
71552
71774
  providerId: string().min(1),
@@ -71945,12 +72167,38 @@ response: record(string(), unknown()) }), object({
71945
72167
  *
71946
72168
  * ## Why this is a capability and not a helper
71947
72169
  *
71948
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
71949
- * plate, vehicle, identity, and the event store's derivatives — and every one of
71950
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
71951
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
71952
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
71953
- * load 5,000 rows before ranking anything.
72170
+ * This capability was introduced with the claim that SIX stores in
72171
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
72172
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
72173
+ * claim was never true, and leaving it here made five stores look like pending
72174
+ * work when three of them have no vector at all. Counted column by column on
72175
+ * 2026-08-30, exactly THREE ever held one:
72176
+ *
72177
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
72178
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
72179
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
72180
+ * face, migrated 2026-08-30 into its OWN index (see below).
72181
+ *
72182
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
72183
+ * and `identities` store a name; the event store stores no derivative vector.
72184
+ * They are not migration candidates and never were.
72185
+ *
72186
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
72187
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
72188
+ * rows before ranking anything.
72189
+ *
72190
+ * ## One index per COMPARISON, never per encoder
72191
+ *
72192
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
72193
+ * model, and they still get two indexes. An index is a set of things that are
72194
+ * ranked against each other and that live and die together, and these two are
72195
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
72196
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
72197
+ * forever and is the gallery every recognition ranks against. One index would
72198
+ * mean every gallery load and every reconcile carried a filter whose failure
72199
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
72200
+ * person's only sample. The dimension they share is not a reason to share an
72201
+ * index; the question they answer is, and it differs.
71954
72202
  *
71955
72203
  * The fix is not a faster loop, it is a different backend — and the backend
71956
72204
  * should be replaceable without touching six callers. So: a singleton
@@ -72055,7 +72303,20 @@ var VectorQueryResultSchema = object({
72055
72303
  */
72056
72304
  scanned: number(),
72057
72305
  /** True when the backend could not consider every row that passed the filter. */
72058
- truncated: boolean()
72306
+ truncated: boolean(),
72307
+ /**
72308
+ * The `topK` the backend actually ran with.
72309
+ *
72310
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
72311
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
72312
+ * own log rather than in its answer. That is how an audit asking for 20,000
72313
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
72314
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
72315
+ * MUCH, in the return value, where the caller cannot fail to see it.
72316
+ *
72317
+ * Equals the requested `topK` whenever nothing was lowered.
72318
+ */
72319
+ effectiveTopK: number().int().positive()
72059
72320
  });
72060
72321
  var VectorDeleteInputSchema = object({
72061
72322
  index: string(),
@@ -72084,6 +72345,68 @@ var VectorGetResultSchema = object({ items: array(object({
72084
72345
  id: string(),
72085
72346
  metadata: VectorMetadataSchema
72086
72347
  })) });
72348
+ /**
72349
+ * Ids to read back WITH their vectors.
72350
+ *
72351
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
72352
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
72353
+ * caller depends on that promise. This one promises the opposite.
72354
+ *
72355
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
72356
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
72357
+ * a per-face cross-process KNN would be a network round trip inside the
72358
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
72359
+ * it requires the index to hand the floats back. Without this method the only
72360
+ * way to keep a readable vector is a JSON column, which is the thing this
72361
+ * capability exists to delete.
72362
+ *
72363
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
72364
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
72365
+ */
72366
+ var VectorFetchInputSchema = object({
72367
+ index: string(),
72368
+ ids: array(string())
72369
+ });
72370
+ var VectorFetchResultSchema = object({ items: array(object({
72371
+ id: string(),
72372
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
72373
+ vector: string(),
72374
+ metadata: VectorMetadataSchema
72375
+ })) });
72376
+ /**
72377
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
72378
+ *
72379
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
72380
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
72381
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
72382
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
72383
+ * distance to every row is degenerate. `examined: 4096` then read as "we
72384
+ * looked" for as long as anyone cared to read it.
72385
+ *
72386
+ * This is the primitive that question actually needs: a bounded page, ordered
72387
+ * by the backend's own row order, costing no distance computation at all.
72388
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
72389
+ * the full-table read this capability was built to stop.
72390
+ */
72391
+ var VectorScanInputSchema = object({
72392
+ index: string(),
72393
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
72394
+ cursor: number().int().nonnegative().default(0),
72395
+ limit: number().int().positive()
72396
+ });
72397
+ var VectorScanResultSchema = object({
72398
+ items: array(object({
72399
+ id: string(),
72400
+ metadata: VectorMetadataSchema
72401
+ })),
72402
+ /**
72403
+ * Where the next page starts, or `null` when the walk reached the end.
72404
+ *
72405
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
72406
+ * from a short page: a backend is free to return fewer rows than asked.
72407
+ */
72408
+ nextCursor: number().int().nonnegative().nullable()
72409
+ });
72087
72410
  var VectorStatsInputSchema = object({ index: string() });
72088
72411
  var VectorStatsResultSchema = object({
72089
72412
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -72102,7 +72425,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
72102
72425
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
72103
72426
  kind: "mutation",
72104
72427
  auth: "admin"
72105
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72428
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72106
72429
  kind: "mutation",
72107
72430
  auth: "admin"
72108
72431
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -78746,6 +79069,9 @@ method(object({
78746
79069
  }), method(object({}), array(RelocateJobSchema).readonly(), {
78747
79070
  kind: "query",
78748
79071
  auth: "admin"
79072
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
79073
+ kind: "query",
79074
+ auth: "admin"
78749
79075
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
78750
79076
  kind: "mutation",
78751
79077
  auth: "admin"
@@ -85380,6 +85706,12 @@ Object.freeze({
85380
85706
  addonId: null,
85381
85707
  access: "create"
85382
85708
  },
85709
+ "pipelineAnalytics.countRelocatableMedia": {
85710
+ capName: "pipeline-analytics",
85711
+ capScope: "device",
85712
+ addonId: null,
85713
+ access: "view"
85714
+ },
85383
85715
  "pipelineAnalytics.countUnstampedEventMedia": {
85384
85716
  capName: "pipeline-analytics",
85385
85717
  capScope: "device",
@@ -86544,6 +86876,12 @@ Object.freeze({
86544
86876
  addonId: null,
86545
86877
  access: "view"
86546
86878
  },
86879
+ "recording.getRelocateResidue": {
86880
+ capName: "recording",
86881
+ capScope: "system",
86882
+ addonId: null,
86883
+ access: "view"
86884
+ },
86547
86885
  "recording.getStorageMigrationMoveStatus": {
86548
86886
  capName: "recording",
86549
86887
  capScope: "system",
@@ -87090,12 +87428,30 @@ Object.freeze({
87090
87428
  addonId: null,
87091
87429
  access: "create"
87092
87430
  },
87431
+ "storageMigration.drain": {
87432
+ capName: "storage-migration",
87433
+ capScope: "system",
87434
+ addonId: null,
87435
+ access: "create"
87436
+ },
87437
+ "storageMigration.movers": {
87438
+ capName: "storage-migration",
87439
+ capScope: "system",
87440
+ addonId: null,
87441
+ access: "view"
87442
+ },
87093
87443
  "storageMigration.plan": {
87094
87444
  capName: "storage-migration",
87095
87445
  capScope: "system",
87096
87446
  addonId: null,
87097
87447
  access: "view"
87098
87448
  },
87449
+ "storageMigration.residue": {
87450
+ capName: "storage-migration",
87451
+ capScope: "system",
87452
+ addonId: null,
87453
+ access: "view"
87454
+ },
87099
87455
  "storageMigration.start": {
87100
87456
  capName: "storage-migration",
87101
87457
  capScope: "system",
@@ -87930,6 +88286,12 @@ Object.freeze({
87930
88286
  addonId: null,
87931
88287
  access: "delete"
87932
88288
  },
88289
+ "vectorStore.fetchByIds": {
88290
+ capName: "vector-store",
88291
+ capScope: "system",
88292
+ addonId: null,
88293
+ access: "view"
88294
+ },
87933
88295
  "vectorStore.getByIds": {
87934
88296
  capName: "vector-store",
87935
88297
  capScope: "system",
@@ -87942,6 +88304,12 @@ Object.freeze({
87942
88304
  addonId: null,
87943
88305
  access: "view"
87944
88306
  },
88307
+ "vectorStore.scan": {
88308
+ capName: "vector-store",
88309
+ capScope: "system",
88310
+ addonId: null,
88311
+ access: "view"
88312
+ },
87945
88313
  "vectorStore.stats": {
87946
88314
  capName: "vector-store",
87947
88315
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -58508,6 +58508,21 @@ var RelocateJobSchema = object({
58508
58508
  bytesMoved: number().int(),
58509
58509
  /** Total files discovered up front; null while (or when) unknown. */
58510
58510
  filesTotal: number().int().nullable(),
58511
+ /**
58512
+ * Rows this run CORRECTED while moving them — a durable mutation the move
58513
+ * made that nobody asked for, so it is reported where the operator reads the
58514
+ * job rather than only in a log line.
58515
+ *
58516
+ * A footage segment records its byte count in its own NAME, and the durable
58517
+ * hour row derives its aggregates from those names. A file that does not
58518
+ * match its name therefore makes the ledger's sums — and with them quota and
58519
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
58520
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
58521
+ *
58522
+ * Absent on lanes where the question has no meaning: a media blob's size is
58523
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
58524
+ */
58525
+ rowsReconciled: number().int().nonnegative().optional(),
58511
58526
  startedAt: number(),
58512
58527
  finishedAt: number().nullable(),
58513
58528
  error: string().nullable()
@@ -58576,14 +58591,42 @@ var RelocateMediaInputSchema = object({
58576
58591
  /** Omitted = `move`, the pre-existing behaviour. */
58577
58592
  mode: MediaRelocateModeSchema.optional()
58578
58593
  });
58579
- /** How many rows still carry NO `locationId` — the population a repoint would
58580
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
58581
- * value that permits a non-blocking `eventMedia` cutover. */
58582
- var UnstampedEventMediaCountSchema = object({
58583
- media: number().int().nonnegative(),
58584
- retrainFrames: number().int().nonnegative(),
58585
- total: number().int().nonnegative()
58594
+ /**
58595
+ * The unstamped population of ONE collection — split, because the gate and the
58596
+ * operator ask two different questions and only one of them has to be cheap.
58597
+ *
58598
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
58599
+ * repoint". It is a single indexed seek to the first matching row, so it stays
58600
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
58601
+ * that matters — after a seal, when the population is empty.
58602
+ *
58603
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
58604
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
58605
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
58606
+ * and useful answer: "there are some, and this read could not say how many"
58607
+ * still refuses the cutover, which is the whole job.
58608
+ */
58609
+ var UnstampedRowsSchema = object({
58610
+ present: boolean(),
58611
+ rows: number().int().nonnegative().nullable()
58586
58612
  });
58613
+ /**
58614
+ * How many rows still carry NO `locationId` — the population a repoint would
58615
+ * silently re-aim at a disk that does not hold their bytes.
58616
+ *
58617
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
58618
+ * over. The gate opens on a measured absence and on nothing else; an unread
58619
+ * collection and an empty one are different facts, and this repo has already
58620
+ * paid for conflating them (`RelocateResidueSchema`, D295).
58621
+ */
58622
+ var UnstampedEventMediaCountSchema = object({
58623
+ media: UnstampedRowsSchema,
58624
+ retrainFrames: UnstampedRowsSchema,
58625
+ /** True when EITHER collection holds one. The refusal reads this. */
58626
+ anyPresent: boolean(),
58627
+ /** Sum across both, or `null` when either lane could not be counted. */
58628
+ total: number().int().nonnegative().nullable()
58629
+ }).nullable();
58587
58630
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58588
58631
  /** The independently selectable logical storage classes — every class
58589
58632
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -58669,13 +58712,53 @@ var StorageMigrationParticipantSchema = _enum([
58669
58712
  "recorder",
58670
58713
  "analytics"
58671
58714
  ]);
58715
+ /**
58716
+ * The mover's own numbers, folded onto the coordinator's durable move record.
58717
+ *
58718
+ * The long half of a non-blocking migration is `draining`, and it is measured
58719
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
58720
+ * existed the only place those numbers appeared was a Loki line, so an operator
58721
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
58722
+ * afternoon.
58723
+ *
58724
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
58725
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
58726
+ * mover — which is the exact failure this is meant to end. The coordinator's
58727
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
58728
+ * read `state`; folding the counters costs no extra read and makes the durable
58729
+ * record say afterwards how far a move actually got.
58730
+ *
58731
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
58732
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
58733
+ * cannot say M, and a 0 there would render as "100 % done".
58734
+ */
58735
+ var StorageMigrationMoveProgressSchema = object({
58736
+ filesMoved: number().int().nonnegative(),
58737
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58738
+ filesTotal: number().int().nonnegative().nullable(),
58739
+ bytesMoved: number().int().nonnegative(),
58740
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
58741
+ * a lane that cannot reconcile. A migration that silently rewrote durable
58742
+ * rows would be the same failure as one that silently skipped them. */
58743
+ rowsReconciled: number().int().nonnegative().optional(),
58744
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
58745
+ * crash gets a new mover, and a rate computed from the migration's start
58746
+ * would silently average in the time nothing was running. */
58747
+ startedAt: number(),
58748
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
58749
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
58750
+ * subtract its own. */
58751
+ observedAt: number()
58752
+ });
58672
58753
  var StorageMigrationMoveSchema = object({
58673
58754
  storageClass: StorageMigrationClassSchema,
58674
58755
  fromLocationId: string(),
58675
58756
  toLocationId: string(),
58676
58757
  moverJobId: string().nullable(),
58677
58758
  state: RelocateJobStateSchema.nullable(),
58678
- error: string().nullable()
58759
+ error: string().nullable(),
58760
+ /** Last observed mover counters; `null` until the mover has been polled once. */
58761
+ progress: StorageMigrationMoveProgressSchema.nullable()
58679
58762
  });
58680
58763
  var StorageMigrationJobSchema = object({
58681
58764
  jobId: string(),
@@ -58721,6 +58804,98 @@ var StorageMigrationPlanSchema = object({
58721
58804
  findings: array(StorageMigrationFindingSchema)
58722
58805
  });
58723
58806
  /**
58807
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
58808
+ *
58809
+ * The coordinator's job record is the state of record for a migration, and its
58810
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
58811
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
58812
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
58813
+ * way because no supported UI path existed. A mover armed like that has no job
58814
+ * to fold progress into, so it has to be readable on its own or it is invisible.
58815
+ *
58816
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
58817
+ * orchestrated it.
58818
+ */
58819
+ var StorageMigrationMoverSchema = object({
58820
+ lane: _enum(["footage", "media"]),
58821
+ job: RelocateJobSchema,
58822
+ /** The coordinator job that armed this mover, or `null` for a mover armed
58823
+ * directly against the owning addon. */
58824
+ migrationJobId: string().nullable(),
58825
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
58826
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
58827
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
58828
+ * rate made of two different clocks. */
58829
+ observedAt: number()
58830
+ });
58831
+ /**
58832
+ * What a SOURCE still holds for one storage class — the number that makes a
58833
+ * "drain remaining" action honest rather than hopeful.
58834
+ *
58835
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
58836
+ * engine's own selection count for media), never from the resident index: a
58837
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
58838
+ * never been told about (D295).
58839
+ *
58840
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
58841
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
58842
+ * because refusing on an unanswerable read would hide exactly the case an
58843
+ * operator needs to act on.
58844
+ */
58845
+ var StorageMigrationResidueSchema = object({
58846
+ storageClass: StorageMigrationClassSchema,
58847
+ /** The location still holding the data. `'*'` for the media lane, whose rows
58848
+ * move from wherever they are rather than from one named source. */
58849
+ fromLocationId: string(),
58850
+ /** Where a drain would move it — the class's CURRENT default. */
58851
+ toLocationId: string(),
58852
+ /** Segments (footage lane) or rows (media lane) still on the source. */
58853
+ items: number().int().nonnegative().nullable(),
58854
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
58855
+ bytes: number().int().nonnegative().nullable()
58856
+ });
58857
+ /**
58858
+ * Run the DRAIN half and nothing else.
58859
+ *
58860
+ * A migration that reached `done` has already repointed, so `start` correctly
58861
+ * refuses its destination ("already the default") — there is nothing left to
58862
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
58863
+ * or finish against a work list that was a tenth of the archive (D295), and
58864
+ * before this there was no supported way to run only that half: the only way
58865
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
58866
+ *
58867
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
58868
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
58869
+ * re-repoint a class that is already migrated.
58870
+ */
58871
+ var StorageMigrationDrainInputSchema = object({
58872
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
58873
+ * a class whose source is already empty is refused rather than started. */
58874
+ classes: array(StorageMigrationClassSchema).min(1),
58875
+ throttleMbps: number().min(1).max(1e3).optional()
58876
+ });
58877
+ /** What a footage source still holds, asked of the durable hour ledger. */
58878
+ var RelocateResidueInputSchema = object({
58879
+ fromLocationId: string().min(1),
58880
+ /** Narrow to one logical class; omit for every profile on the location. */
58881
+ footageClass: RelocateFootageClassSchema.optional()
58882
+ });
58883
+ /** `null` = the archive could not answer (no ledger on this node, or the
58884
+ * aggregate failed). Never conflated with an empty source. */
58885
+ var RelocateResidueSchema = object({
58886
+ segments: number().int().nonnegative(),
58887
+ bytes: number().int().nonnegative()
58888
+ }).nullable();
58889
+ /** How many rows a media pass would still act on against a given target — the
58890
+ * media lane's denominator AND its residue, from ONE derivation so the two can
58891
+ * never disagree. `null` = the count could not be taken. */
58892
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
58893
+ var RelocatableMediaCountInputSchema = object({
58894
+ toLocationId: string().min(1),
58895
+ /** Omitted = `move`. */
58896
+ mode: MediaRelocateModeSchema.optional()
58897
+ });
58898
+ /**
58724
58899
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
58725
58900
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
58726
58901
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -58824,6 +58999,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
58824
58999
  * two addons declaring the same `id` must agree on `cardinality` (validated
58825
59000
  * at kernel aggregation time, not here).
58826
59001
  */
59002
+ /**
59003
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
59004
+ * actually reaches the bytes. It is the constraint that decides which
59005
+ * `storage-provider`s may back a location of that kind.
59006
+ *
59007
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
59008
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
59009
+ * post-analysis media roots). Only a provider that serves a genuine local
59010
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
59011
+ * remote provider's `resolve` returns a path on the REMOTE host, and
59012
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
59013
+ * against a same-named local directory that is something else entirely.
59014
+ *
59015
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
59016
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
59017
+ * service never sees a path, so any provider can back it. `backups` is the
59018
+ * one kind that qualifies today.
59019
+ *
59020
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
59021
+ * an EMERGENT property of how the recorder happened to be written. Nothing
59022
+ * refused the configuration; the first write simply went somewhere wrong, and
59023
+ * a recording write that goes wrong surfaces as a silent black window rather
59024
+ * than an error (the read path does not `stat`). This turns that accident into
59025
+ * a declared, enforced, testable refusal.
59026
+ */
59027
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
58827
59028
  var StorageLocationDeclarationSchema = object({
58828
59029
  /**
58829
59030
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -58843,6 +59044,19 @@ var StorageLocationDeclarationSchema = object({
58843
59044
  */
58844
59045
  cardinality: _enum(["single", "multi"]),
58845
59046
  /**
59047
+ * HOW the declaring service reaches the bytes — and therefore WHICH
59048
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
59049
+ * and {@link STORAGE_ACCESS_FALLBACK}.
59050
+ *
59051
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
59052
+ * can only over-restrict (refuse a remote provider for a kind that might
59053
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
59054
+ * permissive direction and is therefore never inferred — a repo guard
59055
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
59056
+ * reached by omission.
59057
+ */
59058
+ access: StorageAccessSchema.optional(),
59059
+ /**
58846
59060
  * When set, the default instance for this location inherits its resolved
58847
59061
  * root from the named location's default instance. Useful for derivative
58848
59062
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -68727,8 +68941,10 @@ var TrackSchema = object({
68727
68941
  lastSeen: number(),
68728
68942
  /** Frame-rate position history (subject to maxPositionHistory cap). */
68729
68943
  positions: array(TrackPositionSchema).readonly(),
68730
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
68731
- * saveThumbnails policy). */
68944
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
68945
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
68946
+ * the retired `saveThumbnails` used to gate this and the rolling
68947
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
68732
68948
  snapshots: array(TrackSnapshotSchema).readonly(),
68733
68949
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
68734
68950
  zonesVisited: array(string()).readonly(),
@@ -69588,7 +69804,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69588
69804
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
69589
69805
  kind: "mutation",
69590
69806
  auth: "admin"
69591
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
69807
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
69808
+ kind: "query",
69809
+ auth: "admin"
69810
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
69592
69811
  kind: "query",
69593
69812
  auth: "admin"
69594
69813
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -71547,6 +71766,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
71547
71766
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
71548
71767
  kind: "mutation",
71549
71768
  auth: "admin"
71769
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
71770
+ kind: "mutation",
71771
+ auth: "admin"
71550
71772
  });
71551
71773
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
71552
71774
  providerId: string().min(1),
@@ -71945,12 +72167,38 @@ response: record(string(), unknown()) }), object({
71945
72167
  *
71946
72168
  * ## Why this is a capability and not a helper
71947
72169
  *
71948
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
71949
- * plate, vehicle, identity, and the event store's derivatives — and every one of
71950
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
71951
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
71952
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
71953
- * load 5,000 rows before ranking anything.
72170
+ * This capability was introduced with the claim that SIX stores in
72171
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
72172
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
72173
+ * claim was never true, and leaving it here made five stores look like pending
72174
+ * work when three of them have no vector at all. Counted column by column on
72175
+ * 2026-08-30, exactly THREE ever held one:
72176
+ *
72177
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
72178
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
72179
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
72180
+ * face, migrated 2026-08-30 into its OWN index (see below).
72181
+ *
72182
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
72183
+ * and `identities` store a name; the event store stores no derivative vector.
72184
+ * They are not migration candidates and never were.
72185
+ *
72186
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
72187
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
72188
+ * rows before ranking anything.
72189
+ *
72190
+ * ## One index per COMPARISON, never per encoder
72191
+ *
72192
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
72193
+ * model, and they still get two indexes. An index is a set of things that are
72194
+ * ranked against each other and that live and die together, and these two are
72195
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
72196
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
72197
+ * forever and is the gallery every recognition ranks against. One index would
72198
+ * mean every gallery load and every reconcile carried a filter whose failure
72199
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
72200
+ * person's only sample. The dimension they share is not a reason to share an
72201
+ * index; the question they answer is, and it differs.
71954
72202
  *
71955
72203
  * The fix is not a faster loop, it is a different backend — and the backend
71956
72204
  * should be replaceable without touching six callers. So: a singleton
@@ -72055,7 +72303,20 @@ var VectorQueryResultSchema = object({
72055
72303
  */
72056
72304
  scanned: number(),
72057
72305
  /** True when the backend could not consider every row that passed the filter. */
72058
- truncated: boolean()
72306
+ truncated: boolean(),
72307
+ /**
72308
+ * The `topK` the backend actually ran with.
72309
+ *
72310
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
72311
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
72312
+ * own log rather than in its answer. That is how an audit asking for 20,000
72313
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
72314
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
72315
+ * MUCH, in the return value, where the caller cannot fail to see it.
72316
+ *
72317
+ * Equals the requested `topK` whenever nothing was lowered.
72318
+ */
72319
+ effectiveTopK: number().int().positive()
72059
72320
  });
72060
72321
  var VectorDeleteInputSchema = object({
72061
72322
  index: string(),
@@ -72084,6 +72345,68 @@ var VectorGetResultSchema = object({ items: array(object({
72084
72345
  id: string(),
72085
72346
  metadata: VectorMetadataSchema
72086
72347
  })) });
72348
+ /**
72349
+ * Ids to read back WITH their vectors.
72350
+ *
72351
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
72352
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
72353
+ * caller depends on that promise. This one promises the opposite.
72354
+ *
72355
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
72356
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
72357
+ * a per-face cross-process KNN would be a network round trip inside the
72358
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
72359
+ * it requires the index to hand the floats back. Without this method the only
72360
+ * way to keep a readable vector is a JSON column, which is the thing this
72361
+ * capability exists to delete.
72362
+ *
72363
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
72364
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
72365
+ */
72366
+ var VectorFetchInputSchema = object({
72367
+ index: string(),
72368
+ ids: array(string())
72369
+ });
72370
+ var VectorFetchResultSchema = object({ items: array(object({
72371
+ id: string(),
72372
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
72373
+ vector: string(),
72374
+ metadata: VectorMetadataSchema
72375
+ })) });
72376
+ /**
72377
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
72378
+ *
72379
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
72380
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
72381
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
72382
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
72383
+ * distance to every row is degenerate. `examined: 4096` then read as "we
72384
+ * looked" for as long as anyone cared to read it.
72385
+ *
72386
+ * This is the primitive that question actually needs: a bounded page, ordered
72387
+ * by the backend's own row order, costing no distance computation at all.
72388
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
72389
+ * the full-table read this capability was built to stop.
72390
+ */
72391
+ var VectorScanInputSchema = object({
72392
+ index: string(),
72393
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
72394
+ cursor: number().int().nonnegative().default(0),
72395
+ limit: number().int().positive()
72396
+ });
72397
+ var VectorScanResultSchema = object({
72398
+ items: array(object({
72399
+ id: string(),
72400
+ metadata: VectorMetadataSchema
72401
+ })),
72402
+ /**
72403
+ * Where the next page starts, or `null` when the walk reached the end.
72404
+ *
72405
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
72406
+ * from a short page: a backend is free to return fewer rows than asked.
72407
+ */
72408
+ nextCursor: number().int().nonnegative().nullable()
72409
+ });
72087
72410
  var VectorStatsInputSchema = object({ index: string() });
72088
72411
  var VectorStatsResultSchema = object({
72089
72412
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -72102,7 +72425,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
72102
72425
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
72103
72426
  kind: "mutation",
72104
72427
  auth: "admin"
72105
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72428
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72106
72429
  kind: "mutation",
72107
72430
  auth: "admin"
72108
72431
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -78746,6 +79069,9 @@ method(object({
78746
79069
  }), method(object({}), array(RelocateJobSchema).readonly(), {
78747
79070
  kind: "query",
78748
79071
  auth: "admin"
79072
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
79073
+ kind: "query",
79074
+ auth: "admin"
78749
79075
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
78750
79076
  kind: "mutation",
78751
79077
  auth: "admin"
@@ -85380,6 +85706,12 @@ Object.freeze({
85380
85706
  addonId: null,
85381
85707
  access: "create"
85382
85708
  },
85709
+ "pipelineAnalytics.countRelocatableMedia": {
85710
+ capName: "pipeline-analytics",
85711
+ capScope: "device",
85712
+ addonId: null,
85713
+ access: "view"
85714
+ },
85383
85715
  "pipelineAnalytics.countUnstampedEventMedia": {
85384
85716
  capName: "pipeline-analytics",
85385
85717
  capScope: "device",
@@ -86544,6 +86876,12 @@ Object.freeze({
86544
86876
  addonId: null,
86545
86877
  access: "view"
86546
86878
  },
86879
+ "recording.getRelocateResidue": {
86880
+ capName: "recording",
86881
+ capScope: "system",
86882
+ addonId: null,
86883
+ access: "view"
86884
+ },
86547
86885
  "recording.getStorageMigrationMoveStatus": {
86548
86886
  capName: "recording",
86549
86887
  capScope: "system",
@@ -87090,12 +87428,30 @@ Object.freeze({
87090
87428
  addonId: null,
87091
87429
  access: "create"
87092
87430
  },
87431
+ "storageMigration.drain": {
87432
+ capName: "storage-migration",
87433
+ capScope: "system",
87434
+ addonId: null,
87435
+ access: "create"
87436
+ },
87437
+ "storageMigration.movers": {
87438
+ capName: "storage-migration",
87439
+ capScope: "system",
87440
+ addonId: null,
87441
+ access: "view"
87442
+ },
87093
87443
  "storageMigration.plan": {
87094
87444
  capName: "storage-migration",
87095
87445
  capScope: "system",
87096
87446
  addonId: null,
87097
87447
  access: "view"
87098
87448
  },
87449
+ "storageMigration.residue": {
87450
+ capName: "storage-migration",
87451
+ capScope: "system",
87452
+ addonId: null,
87453
+ access: "view"
87454
+ },
87099
87455
  "storageMigration.start": {
87100
87456
  capName: "storage-migration",
87101
87457
  capScope: "system",
@@ -87930,6 +88286,12 @@ Object.freeze({
87930
88286
  addonId: null,
87931
88287
  access: "delete"
87932
88288
  },
88289
+ "vectorStore.fetchByIds": {
88290
+ capName: "vector-store",
88291
+ capScope: "system",
88292
+ addonId: null,
88293
+ access: "view"
88294
+ },
87933
88295
  "vectorStore.getByIds": {
87934
88296
  capName: "vector-store",
87935
88297
  capScope: "system",
@@ -87942,6 +88304,12 @@ Object.freeze({
87942
88304
  addonId: null,
87943
88305
  access: "view"
87944
88306
  },
88307
+ "vectorStore.scan": {
88308
+ capName: "vector-store",
88309
+ capScope: "system",
88310
+ addonId: null,
88311
+ access: "view"
88312
+ },
87945
88313
  "vectorStore.stats": {
87946
88314
  capName: "vector-store",
87947
88315
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.43",
3
+ "version": "0.2.46",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",