@camstack/addon-provider-dreame 0.2.42 → 0.2.45

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 +452 -23
  2. package/dist/addon.mjs +452 -23
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -58544,18 +58544,61 @@ var RelocateFootageInputSchema = object({
58544
58544
  * `RecordingConfig.enabled` or camera wrapper bindings. */
58545
58545
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
58546
58546
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
58547
+ /**
58548
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
58549
+ * mover (the engine already walks both collections with a timestamp cursor and
58550
+ * already has a stamp-without-copy path).
58551
+ *
58552
+ * - `move` — the default and the historical behaviour: event-media and
58553
+ * retrain blobs move to `toLocationId` and their rows are
58554
+ * stamped. The enrolled gallery is skipped (D197).
58555
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
58556
+ * stamped with `toLocationId`. `toLocationId` here is the id the
58557
+ * bytes ALREADY sit on — today's `eventMedia` default — because
58558
+ * a NULL row means "wherever `eventMedia` points *now*", and the
58559
+ * instant a repoint moves that pointer the row reads from the
58560
+ * new disk while its bytes are on the old one.
58561
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
58562
+ * (enrolled-gallery) rows, which `move` deliberately skips.
58563
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
58564
+ * never run beside a live second location: it is stop-the-world
58565
+ * by construction, which is acceptable only because the gallery
58566
+ * is a few KB per enrolled sample.
58567
+ */
58568
+ var MediaRelocateModeSchema = _enum([
58569
+ "move",
58570
+ "seal",
58571
+ "gallery"
58572
+ ]);
58547
58573
  var RelocateMediaInputSchema = object({
58548
58574
  toLocationId: string(),
58549
- throttleMbps: number().min(1).max(1e3).optional()
58575
+ throttleMbps: number().min(1).max(1e3).optional(),
58576
+ /** Omitted = `move`, the pre-existing behaviour. */
58577
+ mode: MediaRelocateModeSchema.optional()
58578
+ });
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()
58550
58586
  });
58551
58587
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58552
- /** The independently selectable logical storage classes. `recordings`
58553
- * encompasses the high and mid segment profiles; `recordingsLow` is low
58554
- * segments; `eventMedia` is post-analysis blobs. */
58588
+ /** The independently selectable logical storage classes — every class
58589
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
58590
+ * Zod enum error where they should meet an explanation.
58591
+ *
58592
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
58593
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
58594
+ * enrolled gallery; `backups` is the system backup archive. The last two have
58595
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
58555
58596
  var StorageMigrationClassSchema = _enum([
58556
58597
  "recordings",
58557
58598
  "recordingsLow",
58558
- "eventMedia"
58599
+ "eventMedia",
58600
+ "backups",
58601
+ "galleryMedia"
58559
58602
  ]);
58560
58603
  /** A destination is always an existing, fully-qualified location id. The
58561
58604
  * migration API intentionally never changes a source location's `basePath`:
@@ -58563,20 +58606,56 @@ var StorageMigrationClassSchema = _enum([
58563
58606
  var StorageMigrationDestinationsSchema = object({
58564
58607
  recordings: string().min(1).optional(),
58565
58608
  recordingsLow: string().min(1).optional(),
58566
- eventMedia: string().min(1).optional()
58609
+ eventMedia: string().min(1).optional(),
58610
+ backups: string().min(1).optional(),
58611
+ galleryMedia: string().min(1).optional()
58567
58612
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
58613
+ /**
58614
+ * How a migration sequences the cutover against the byte move.
58615
+ *
58616
+ * - `blocking` — the historical order: pause, move every byte, repoint,
58617
+ * resume. Recording is stopped for the whole move. Right
58618
+ * for a small or a cold class, and the only legal mode for
58619
+ * a `cardinality: 'single'` class.
58620
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
58621
+ * refresh, resume, then move the past with everything
58622
+ * running. The pause is three bounded instants (a detach +
58623
+ * attach round, a write-gate drain, a lease) instead of one
58624
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
58625
+ * stopped recording under `blocking`; the same move is
58626
+ * seconds of stopped recording under `nonBlocking`.
58627
+ *
58628
+ * The mode is on the JOB, not only on the input, because `status` is where an
58629
+ * operator finds out which one is running.
58630
+ */
58631
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
58568
58632
  /** Shared input for planning and starting an orchestrated storage migration. */
58569
58633
  var StorageMigrationInputSchema = object({
58570
58634
  destinations: StorageMigrationDestinationsSchema,
58571
- throttleMbps: number().min(1).max(1e3).optional()
58635
+ throttleMbps: number().min(1).max(1e3).optional(),
58636
+ /** Omitted = `blocking`, which stays the default. */
58637
+ mode: StorageMigrationModeSchema.optional()
58572
58638
  });
58573
- /** The durable coordinator state machine. The only phase that changes default
58574
- * locations is `repointing`, after every selected mover has completed and been
58575
- * verified. */
58639
+ /**
58640
+ * The durable coordinator state machine.
58641
+ *
58642
+ * `blocking`:
58643
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
58644
+ *
58645
+ * `nonBlocking`:
58646
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
58647
+ *
58648
+ * Same phases, different order plus two new ones — not a second mover.
58649
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
58650
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
58651
+ * `repointing` is still the only phase that changes a default location.
58652
+ */
58576
58653
  var StorageMigrationPhaseSchema = _enum([
58577
58654
  "planning",
58655
+ "sealing",
58578
58656
  "pausing",
58579
58657
  "moving",
58658
+ "draining",
58580
58659
  "verifying",
58581
58660
  "repointing",
58582
58661
  "refreshing",
@@ -58590,17 +58669,56 @@ var StorageMigrationParticipantSchema = _enum([
58590
58669
  "recorder",
58591
58670
  "analytics"
58592
58671
  ]);
58672
+ /**
58673
+ * The mover's own numbers, folded onto the coordinator's durable move record.
58674
+ *
58675
+ * The long half of a non-blocking migration is `draining`, and it is measured
58676
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
58677
+ * existed the only place those numbers appeared was a Loki line, so an operator
58678
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
58679
+ * afternoon.
58680
+ *
58681
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
58682
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
58683
+ * mover — which is the exact failure this is meant to end. The coordinator's
58684
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
58685
+ * read `state`; folding the counters costs no extra read and makes the durable
58686
+ * record say afterwards how far a move actually got.
58687
+ *
58688
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
58689
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
58690
+ * cannot say M, and a 0 there would render as "100 % done".
58691
+ */
58692
+ var StorageMigrationMoveProgressSchema = object({
58693
+ filesMoved: number().int().nonnegative(),
58694
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58695
+ filesTotal: number().int().nonnegative().nullable(),
58696
+ bytesMoved: number().int().nonnegative(),
58697
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
58698
+ * crash gets a new mover, and a rate computed from the migration's start
58699
+ * would silently average in the time nothing was running. */
58700
+ startedAt: number(),
58701
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
58702
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
58703
+ * subtract its own. */
58704
+ observedAt: number()
58705
+ });
58593
58706
  var StorageMigrationMoveSchema = object({
58594
58707
  storageClass: StorageMigrationClassSchema,
58595
58708
  fromLocationId: string(),
58596
58709
  toLocationId: string(),
58597
58710
  moverJobId: string().nullable(),
58598
58711
  state: RelocateJobStateSchema.nullable(),
58599
- error: string().nullable()
58712
+ error: string().nullable(),
58713
+ /** Last observed mover counters; `null` until the mover has been polled once. */
58714
+ progress: StorageMigrationMoveProgressSchema.nullable()
58600
58715
  });
58601
58716
  var StorageMigrationJobSchema = object({
58602
58717
  jobId: string(),
58603
58718
  phase: StorageMigrationPhaseSchema,
58719
+ /** Which order this job is running. `status` is the only place an operator
58720
+ * can tell a seconds-long cutover from a thirty-hour one. */
58721
+ mode: StorageMigrationModeSchema,
58604
58722
  destinations: StorageMigrationDestinationsSchema,
58605
58723
  throttleMbps: number(),
58606
58724
  moves: array(StorageMigrationMoveSchema),
@@ -58613,13 +58731,122 @@ var StorageMigrationJobSchema = object({
58613
58731
  finishedAt: number().nullable(),
58614
58732
  error: string().nullable()
58615
58733
  });
58734
+ var StorageMigrationFindingSchema = object({
58735
+ code: _enum([
58736
+ "sharesDeviceWithSource",
58737
+ "deviceIdentityUnknown",
58738
+ "unstampedEventMediaRows",
58739
+ "blockingOnly",
58740
+ "noMover"
58741
+ ]),
58742
+ storageClass: StorageMigrationClassSchema,
58743
+ /** Human-readable, already carrying the ids and counts. */
58744
+ message: string()
58745
+ });
58616
58746
  var StorageMigrationPlanSchema = object({
58617
58747
  destinations: StorageMigrationDestinationsSchema,
58748
+ /** The mode this plan was built for. A plan is only valid for its mode: the
58749
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
58750
+ * it. */
58751
+ mode: StorageMigrationModeSchema,
58618
58752
  moves: array(object({
58619
58753
  storageClass: StorageMigrationClassSchema,
58620
58754
  fromLocationId: string(),
58621
58755
  toLocationId: string()
58622
- }))
58756
+ })),
58757
+ findings: array(StorageMigrationFindingSchema)
58758
+ });
58759
+ /**
58760
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
58761
+ *
58762
+ * The coordinator's job record is the state of record for a migration, and its
58763
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
58764
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
58765
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
58766
+ * way because no supported UI path existed. A mover armed like that has no job
58767
+ * to fold progress into, so it has to be readable on its own or it is invisible.
58768
+ *
58769
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
58770
+ * orchestrated it.
58771
+ */
58772
+ var StorageMigrationMoverSchema = object({
58773
+ lane: _enum(["footage", "media"]),
58774
+ job: RelocateJobSchema,
58775
+ /** The coordinator job that armed this mover, or `null` for a mover armed
58776
+ * directly against the owning addon. */
58777
+ migrationJobId: string().nullable(),
58778
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
58779
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
58780
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
58781
+ * rate made of two different clocks. */
58782
+ observedAt: number()
58783
+ });
58784
+ /**
58785
+ * What a SOURCE still holds for one storage class — the number that makes a
58786
+ * "drain remaining" action honest rather than hopeful.
58787
+ *
58788
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
58789
+ * engine's own selection count for media), never from the resident index: a
58790
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
58791
+ * never been told about (D295).
58792
+ *
58793
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
58794
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
58795
+ * because refusing on an unanswerable read would hide exactly the case an
58796
+ * operator needs to act on.
58797
+ */
58798
+ var StorageMigrationResidueSchema = object({
58799
+ storageClass: StorageMigrationClassSchema,
58800
+ /** The location still holding the data. `'*'` for the media lane, whose rows
58801
+ * move from wherever they are rather than from one named source. */
58802
+ fromLocationId: string(),
58803
+ /** Where a drain would move it — the class's CURRENT default. */
58804
+ toLocationId: string(),
58805
+ /** Segments (footage lane) or rows (media lane) still on the source. */
58806
+ items: number().int().nonnegative().nullable(),
58807
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
58808
+ bytes: number().int().nonnegative().nullable()
58809
+ });
58810
+ /**
58811
+ * Run the DRAIN half and nothing else.
58812
+ *
58813
+ * A migration that reached `done` has already repointed, so `start` correctly
58814
+ * refuses its destination ("already the default") — there is nothing left to
58815
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
58816
+ * or finish against a work list that was a tenth of the archive (D295), and
58817
+ * before this there was no supported way to run only that half: the only way
58818
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
58819
+ *
58820
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
58821
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
58822
+ * re-repoint a class that is already migrated.
58823
+ */
58824
+ var StorageMigrationDrainInputSchema = object({
58825
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
58826
+ * a class whose source is already empty is refused rather than started. */
58827
+ classes: array(StorageMigrationClassSchema).min(1),
58828
+ throttleMbps: number().min(1).max(1e3).optional()
58829
+ });
58830
+ /** What a footage source still holds, asked of the durable hour ledger. */
58831
+ var RelocateResidueInputSchema = object({
58832
+ fromLocationId: string().min(1),
58833
+ /** Narrow to one logical class; omit for every profile on the location. */
58834
+ footageClass: RelocateFootageClassSchema.optional()
58835
+ });
58836
+ /** `null` = the archive could not answer (no ledger on this node, or the
58837
+ * aggregate failed). Never conflated with an empty source. */
58838
+ var RelocateResidueSchema = object({
58839
+ segments: number().int().nonnegative(),
58840
+ bytes: number().int().nonnegative()
58841
+ }).nullable();
58842
+ /** How many rows a media pass would still act on against a given target — the
58843
+ * media lane's denominator AND its residue, from ONE derivation so the two can
58844
+ * never disagree. `null` = the count could not be taken. */
58845
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
58846
+ var RelocatableMediaCountInputSchema = object({
58847
+ toLocationId: string().min(1),
58848
+ /** Omitted = `move`. */
58849
+ mode: MediaRelocateModeSchema.optional()
58623
58850
  });
58624
58851
  /**
58625
58852
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -58725,6 +58952,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
58725
58952
  * two addons declaring the same `id` must agree on `cardinality` (validated
58726
58953
  * at kernel aggregation time, not here).
58727
58954
  */
58955
+ /**
58956
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
58957
+ * actually reaches the bytes. It is the constraint that decides which
58958
+ * `storage-provider`s may back a location of that kind.
58959
+ *
58960
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
58961
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
58962
+ * post-analysis media roots). Only a provider that serves a genuine local
58963
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
58964
+ * remote provider's `resolve` returns a path on the REMOTE host, and
58965
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
58966
+ * against a same-named local directory that is something else entirely.
58967
+ *
58968
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
58969
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
58970
+ * service never sees a path, so any provider can back it. `backups` is the
58971
+ * one kind that qualifies today.
58972
+ *
58973
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
58974
+ * an EMERGENT property of how the recorder happened to be written. Nothing
58975
+ * refused the configuration; the first write simply went somewhere wrong, and
58976
+ * a recording write that goes wrong surfaces as a silent black window rather
58977
+ * than an error (the read path does not `stat`). This turns that accident into
58978
+ * a declared, enforced, testable refusal.
58979
+ */
58980
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
58728
58981
  var StorageLocationDeclarationSchema = object({
58729
58982
  /**
58730
58983
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -58744,6 +58997,19 @@ var StorageLocationDeclarationSchema = object({
58744
58997
  */
58745
58998
  cardinality: _enum(["single", "multi"]),
58746
58999
  /**
59000
+ * HOW the declaring service reaches the bytes — and therefore WHICH
59001
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
59002
+ * and {@link STORAGE_ACCESS_FALLBACK}.
59003
+ *
59004
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
59005
+ * can only over-restrict (refuse a remote provider for a kind that might
59006
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
59007
+ * permissive direction and is therefore never inferred — a repo guard
59008
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
59009
+ * reached by omission.
59010
+ */
59011
+ access: StorageAccessSchema.optional(),
59012
+ /**
58747
59013
  * When set, the default instance for this location inherits its resolved
58748
59014
  * root from the named location's default instance. Useful for derivative
58749
59015
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -68628,8 +68894,10 @@ var TrackSchema = object({
68628
68894
  lastSeen: number(),
68629
68895
  /** Frame-rate position history (subject to maxPositionHistory cap). */
68630
68896
  positions: array(TrackPositionSchema).readonly(),
68631
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
68632
- * saveThumbnails policy). */
68897
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
68898
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
68899
+ * the retired `saveThumbnails` used to gate this and the rolling
68900
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
68633
68901
  snapshots: array(TrackSnapshotSchema).readonly(),
68634
68902
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
68635
68903
  zonesVisited: array(string()).readonly(),
@@ -69489,6 +69757,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69489
69757
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
69490
69758
  kind: "mutation",
69491
69759
  auth: "admin"
69760
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
69761
+ kind: "query",
69762
+ auth: "admin"
69492
69763
  }), method(object({}), array(RelocateJobSchema).readonly(), {
69493
69764
  kind: "query",
69494
69765
  auth: "admin"
@@ -71396,7 +71667,10 @@ method(object({
71396
71667
  }), StorageLocationSchema, {
71397
71668
  kind: "mutation",
71398
71669
  auth: "admin"
71399
- }), method(object({ id: string() }), _void(), {
71670
+ }), method(object({
71671
+ id: string(),
71672
+ force: boolean().optional()
71673
+ }), _void(), {
71400
71674
  kind: "mutation",
71401
71675
  auth: "admin"
71402
71676
  }), method(object({ id: string() }), object({
@@ -71445,6 +71719,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
71445
71719
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
71446
71720
  kind: "mutation",
71447
71721
  auth: "admin"
71722
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
71723
+ kind: "mutation",
71724
+ auth: "admin"
71448
71725
  });
71449
71726
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
71450
71727
  providerId: string().min(1),
@@ -71843,12 +72120,38 @@ response: record(string(), unknown()) }), object({
71843
72120
  *
71844
72121
  * ## Why this is a capability and not a helper
71845
72122
  *
71846
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
71847
- * plate, vehicle, identity, and the event store's derivatives — and every one of
71848
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
71849
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
71850
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
71851
- * load 5,000 rows before ranking anything.
72123
+ * This capability was introduced with the claim that SIX stores in
72124
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
72125
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
72126
+ * claim was never true, and leaving it here made five stores look like pending
72127
+ * work when three of them have no vector at all. Counted column by column on
72128
+ * 2026-08-30, exactly THREE ever held one:
72129
+ *
72130
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
72131
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
72132
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
72133
+ * face, migrated 2026-08-30 into its OWN index (see below).
72134
+ *
72135
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
72136
+ * and `identities` store a name; the event store stores no derivative vector.
72137
+ * They are not migration candidates and never were.
72138
+ *
72139
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
72140
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
72141
+ * rows before ranking anything.
72142
+ *
72143
+ * ## One index per COMPARISON, never per encoder
72144
+ *
72145
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
72146
+ * model, and they still get two indexes. An index is a set of things that are
72147
+ * ranked against each other and that live and die together, and these two are
72148
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
72149
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
72150
+ * forever and is the gallery every recognition ranks against. One index would
72151
+ * mean every gallery load and every reconcile carried a filter whose failure
72152
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
72153
+ * person's only sample. The dimension they share is not a reason to share an
72154
+ * index; the question they answer is, and it differs.
71852
72155
  *
71853
72156
  * The fix is not a faster loop, it is a different backend — and the backend
71854
72157
  * should be replaceable without touching six callers. So: a singleton
@@ -71953,7 +72256,20 @@ var VectorQueryResultSchema = object({
71953
72256
  */
71954
72257
  scanned: number(),
71955
72258
  /** True when the backend could not consider every row that passed the filter. */
71956
- truncated: boolean()
72259
+ truncated: boolean(),
72260
+ /**
72261
+ * The `topK` the backend actually ran with.
72262
+ *
72263
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
72264
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
72265
+ * own log rather than in its answer. That is how an audit asking for 20,000
72266
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
72267
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
72268
+ * MUCH, in the return value, where the caller cannot fail to see it.
72269
+ *
72270
+ * Equals the requested `topK` whenever nothing was lowered.
72271
+ */
72272
+ effectiveTopK: number().int().positive()
71957
72273
  });
71958
72274
  var VectorDeleteInputSchema = object({
71959
72275
  index: string(),
@@ -71982,6 +72298,68 @@ var VectorGetResultSchema = object({ items: array(object({
71982
72298
  id: string(),
71983
72299
  metadata: VectorMetadataSchema
71984
72300
  })) });
72301
+ /**
72302
+ * Ids to read back WITH their vectors.
72303
+ *
72304
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
72305
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
72306
+ * caller depends on that promise. This one promises the opposite.
72307
+ *
72308
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
72309
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
72310
+ * a per-face cross-process KNN would be a network round trip inside the
72311
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
72312
+ * it requires the index to hand the floats back. Without this method the only
72313
+ * way to keep a readable vector is a JSON column, which is the thing this
72314
+ * capability exists to delete.
72315
+ *
72316
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
72317
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
72318
+ */
72319
+ var VectorFetchInputSchema = object({
72320
+ index: string(),
72321
+ ids: array(string())
72322
+ });
72323
+ var VectorFetchResultSchema = object({ items: array(object({
72324
+ id: string(),
72325
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
72326
+ vector: string(),
72327
+ metadata: VectorMetadataSchema
72328
+ })) });
72329
+ /**
72330
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
72331
+ *
72332
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
72333
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
72334
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
72335
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
72336
+ * distance to every row is degenerate. `examined: 4096` then read as "we
72337
+ * looked" for as long as anyone cared to read it.
72338
+ *
72339
+ * This is the primitive that question actually needs: a bounded page, ordered
72340
+ * by the backend's own row order, costing no distance computation at all.
72341
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
72342
+ * the full-table read this capability was built to stop.
72343
+ */
72344
+ var VectorScanInputSchema = object({
72345
+ index: string(),
72346
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
72347
+ cursor: number().int().nonnegative().default(0),
72348
+ limit: number().int().positive()
72349
+ });
72350
+ var VectorScanResultSchema = object({
72351
+ items: array(object({
72352
+ id: string(),
72353
+ metadata: VectorMetadataSchema
72354
+ })),
72355
+ /**
72356
+ * Where the next page starts, or `null` when the walk reached the end.
72357
+ *
72358
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
72359
+ * from a short page: a backend is free to return fewer rows than asked.
72360
+ */
72361
+ nextCursor: number().int().nonnegative().nullable()
72362
+ });
71985
72363
  var VectorStatsInputSchema = object({ index: string() });
71986
72364
  var VectorStatsResultSchema = object({
71987
72365
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -72000,7 +72378,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
72000
72378
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
72001
72379
  kind: "mutation",
72002
72380
  auth: "admin"
72003
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72381
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72004
72382
  kind: "mutation",
72005
72383
  auth: "admin"
72006
72384
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -78644,6 +79022,9 @@ method(object({
78644
79022
  }), method(object({}), array(RelocateJobSchema).readonly(), {
78645
79023
  kind: "query",
78646
79024
  auth: "admin"
79025
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
79026
+ kind: "query",
79027
+ auth: "admin"
78647
79028
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
78648
79029
  kind: "mutation",
78649
79030
  auth: "admin"
@@ -85278,6 +85659,18 @@ Object.freeze({
85278
85659
  addonId: null,
85279
85660
  access: "create"
85280
85661
  },
85662
+ "pipelineAnalytics.countRelocatableMedia": {
85663
+ capName: "pipeline-analytics",
85664
+ capScope: "device",
85665
+ addonId: null,
85666
+ access: "view"
85667
+ },
85668
+ "pipelineAnalytics.countUnstampedEventMedia": {
85669
+ capName: "pipeline-analytics",
85670
+ capScope: "device",
85671
+ addonId: null,
85672
+ access: "view"
85673
+ },
85281
85674
  "pipelineAnalytics.deleteDeviceEvents": {
85282
85675
  capName: "pipeline-analytics",
85283
85676
  capScope: "device",
@@ -86436,6 +86829,12 @@ Object.freeze({
86436
86829
  addonId: null,
86437
86830
  access: "view"
86438
86831
  },
86832
+ "recording.getRelocateResidue": {
86833
+ capName: "recording",
86834
+ capScope: "system",
86835
+ addonId: null,
86836
+ access: "view"
86837
+ },
86439
86838
  "recording.getStorageMigrationMoveStatus": {
86440
86839
  capName: "recording",
86441
86840
  capScope: "system",
@@ -86982,12 +87381,30 @@ Object.freeze({
86982
87381
  addonId: null,
86983
87382
  access: "create"
86984
87383
  },
87384
+ "storageMigration.drain": {
87385
+ capName: "storage-migration",
87386
+ capScope: "system",
87387
+ addonId: null,
87388
+ access: "create"
87389
+ },
87390
+ "storageMigration.movers": {
87391
+ capName: "storage-migration",
87392
+ capScope: "system",
87393
+ addonId: null,
87394
+ access: "view"
87395
+ },
86985
87396
  "storageMigration.plan": {
86986
87397
  capName: "storage-migration",
86987
87398
  capScope: "system",
86988
87399
  addonId: null,
86989
87400
  access: "view"
86990
87401
  },
87402
+ "storageMigration.residue": {
87403
+ capName: "storage-migration",
87404
+ capScope: "system",
87405
+ addonId: null,
87406
+ access: "view"
87407
+ },
86991
87408
  "storageMigration.start": {
86992
87409
  capName: "storage-migration",
86993
87410
  capScope: "system",
@@ -87822,6 +88239,12 @@ Object.freeze({
87822
88239
  addonId: null,
87823
88240
  access: "delete"
87824
88241
  },
88242
+ "vectorStore.fetchByIds": {
88243
+ capName: "vector-store",
88244
+ capScope: "system",
88245
+ addonId: null,
88246
+ access: "view"
88247
+ },
87825
88248
  "vectorStore.getByIds": {
87826
88249
  capName: "vector-store",
87827
88250
  capScope: "system",
@@ -87834,6 +88257,12 @@ Object.freeze({
87834
88257
  addonId: null,
87835
88258
  access: "view"
87836
88259
  },
88260
+ "vectorStore.scan": {
88261
+ capName: "vector-store",
88262
+ capScope: "system",
88263
+ addonId: null,
88264
+ access: "view"
88265
+ },
87837
88266
  "vectorStore.stats": {
87838
88267
  capName: "vector-store",
87839
88268
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -58544,18 +58544,61 @@ var RelocateFootageInputSchema = object({
58544
58544
  * `RecordingConfig.enabled` or camera wrapper bindings. */
58545
58545
  var StorageMigrationLeaseInputSchema = object({ leaseId: string().min(1) });
58546
58546
  var StorageMigrationFootageMoveInputSchema = RelocateFootageInputSchema.extend({ leaseId: string().min(1) });
58547
+ /**
58548
+ * What a `relocateMedia` pass DOES. One engine, three passes — never a second
58549
+ * mover (the engine already walks both collections with a timestamp cursor and
58550
+ * already has a stamp-without-copy path).
58551
+ *
58552
+ * - `move` — the default and the historical behaviour: event-media and
58553
+ * retrain blobs move to `toLocationId` and their rows are
58554
+ * stamped. The enrolled gallery is skipped (D197).
58555
+ * - `seal` — ROWS ONLY, no bytes. Every row whose `locationId` is NULL is
58556
+ * stamped with `toLocationId`. `toLocationId` here is the id the
58557
+ * bytes ALREADY sit on — today's `eventMedia` default — because
58558
+ * a NULL row means "wherever `eventMedia` points *now*", and the
58559
+ * instant a repoint moves that pointer the row reads from the
58560
+ * new disk while its bytes are on the old one.
58561
+ * - `gallery` — the inverse selection of `move`: ONLY the retention-exempt
58562
+ * (enrolled-gallery) rows, which `move` deliberately skips.
58563
+ * `galleryMedia` is `cardinality: 'single'`, so this pass can
58564
+ * never run beside a live second location: it is stop-the-world
58565
+ * by construction, which is acceptable only because the gallery
58566
+ * is a few KB per enrolled sample.
58567
+ */
58568
+ var MediaRelocateModeSchema = _enum([
58569
+ "move",
58570
+ "seal",
58571
+ "gallery"
58572
+ ]);
58547
58573
  var RelocateMediaInputSchema = object({
58548
58574
  toLocationId: string(),
58549
- throttleMbps: number().min(1).max(1e3).optional()
58575
+ throttleMbps: number().min(1).max(1e3).optional(),
58576
+ /** Omitted = `move`, the pre-existing behaviour. */
58577
+ mode: MediaRelocateModeSchema.optional()
58578
+ });
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()
58550
58586
  });
58551
58587
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58552
- /** The independently selectable logical storage classes. `recordings`
58553
- * encompasses the high and mid segment profiles; `recordingsLow` is low
58554
- * segments; `eventMedia` is post-analysis blobs. */
58588
+ /** The independently selectable logical storage classes — every class
58589
+ * `storage.listLocationDeclarations` reports, so an operator never meets a
58590
+ * Zod enum error where they should meet an explanation.
58591
+ *
58592
+ * `recordings` encompasses the high and mid segment profiles; `recordingsLow`
58593
+ * is low segments; `eventMedia` is post-analysis blobs; `galleryMedia` is the
58594
+ * enrolled gallery; `backups` is the system backup archive. The last two have
58595
+ * their own rules — see {@link StorageMigrationFindingCodeSchema}. */
58555
58596
  var StorageMigrationClassSchema = _enum([
58556
58597
  "recordings",
58557
58598
  "recordingsLow",
58558
- "eventMedia"
58599
+ "eventMedia",
58600
+ "backups",
58601
+ "galleryMedia"
58559
58602
  ]);
58560
58603
  /** A destination is always an existing, fully-qualified location id. The
58561
58604
  * migration API intentionally never changes a source location's `basePath`:
@@ -58563,20 +58606,56 @@ var StorageMigrationClassSchema = _enum([
58563
58606
  var StorageMigrationDestinationsSchema = object({
58564
58607
  recordings: string().min(1).optional(),
58565
58608
  recordingsLow: string().min(1).optional(),
58566
- eventMedia: string().min(1).optional()
58609
+ eventMedia: string().min(1).optional(),
58610
+ backups: string().min(1).optional(),
58611
+ galleryMedia: string().min(1).optional()
58567
58612
  }).refine((value) => Object.keys(value).length > 0, { message: "select at least one storage class" });
58613
+ /**
58614
+ * How a migration sequences the cutover against the byte move.
58615
+ *
58616
+ * - `blocking` — the historical order: pause, move every byte, repoint,
58617
+ * resume. Recording is stopped for the whole move. Right
58618
+ * for a small or a cold class, and the only legal mode for
58619
+ * a `cardinality: 'single'` class.
58620
+ * - `nonBlocking` — repoint FIRST, drain behind: seal, pause, repoint,
58621
+ * refresh, resume, then move the past with everything
58622
+ * running. The pause is three bounded instants (a detach +
58623
+ * attach round, a write-gate drain, a lease) instead of one
58624
+ * bounded by bytes. 1.09 TB at 7–14 MB/s is thirty hours of
58625
+ * stopped recording under `blocking`; the same move is
58626
+ * seconds of stopped recording under `nonBlocking`.
58627
+ *
58628
+ * The mode is on the JOB, not only on the input, because `status` is where an
58629
+ * operator finds out which one is running.
58630
+ */
58631
+ var StorageMigrationModeSchema = _enum(["blocking", "nonBlocking"]);
58568
58632
  /** Shared input for planning and starting an orchestrated storage migration. */
58569
58633
  var StorageMigrationInputSchema = object({
58570
58634
  destinations: StorageMigrationDestinationsSchema,
58571
- throttleMbps: number().min(1).max(1e3).optional()
58635
+ throttleMbps: number().min(1).max(1e3).optional(),
58636
+ /** Omitted = `blocking`, which stays the default. */
58637
+ mode: StorageMigrationModeSchema.optional()
58572
58638
  });
58573
- /** The durable coordinator state machine. The only phase that changes default
58574
- * locations is `repointing`, after every selected mover has completed and been
58575
- * verified. */
58639
+ /**
58640
+ * The durable coordinator state machine.
58641
+ *
58642
+ * `blocking`:
58643
+ * planning → pausing → moving → verifying → repointing → refreshing → resuming → done
58644
+ *
58645
+ * `nonBlocking`:
58646
+ * planning → sealing → pausing → repointing → refreshing → resuming → draining → verifying → done
58647
+ *
58648
+ * Same phases, different order plus two new ones — not a second mover.
58649
+ * `sealing` closes the `eventMedia` NULL-row hole BEFORE anything is paused;
58650
+ * `draining` runs the same movers UNLEASED, after every writer is back up.
58651
+ * `repointing` is still the only phase that changes a default location.
58652
+ */
58576
58653
  var StorageMigrationPhaseSchema = _enum([
58577
58654
  "planning",
58655
+ "sealing",
58578
58656
  "pausing",
58579
58657
  "moving",
58658
+ "draining",
58580
58659
  "verifying",
58581
58660
  "repointing",
58582
58661
  "refreshing",
@@ -58590,17 +58669,56 @@ var StorageMigrationParticipantSchema = _enum([
58590
58669
  "recorder",
58591
58670
  "analytics"
58592
58671
  ]);
58672
+ /**
58673
+ * The mover's own numbers, folded onto the coordinator's durable move record.
58674
+ *
58675
+ * The long half of a non-blocking migration is `draining`, and it is measured
58676
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
58677
+ * existed the only place those numbers appeared was a Loki line, so an operator
58678
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
58679
+ * afternoon.
58680
+ *
58681
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
58682
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
58683
+ * mover — which is the exact failure this is meant to end. The coordinator's
58684
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
58685
+ * read `state`; folding the counters costs no extra read and makes the durable
58686
+ * record say afterwards how far a move actually got.
58687
+ *
58688
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
58689
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
58690
+ * cannot say M, and a 0 there would render as "100 % done".
58691
+ */
58692
+ var StorageMigrationMoveProgressSchema = object({
58693
+ filesMoved: number().int().nonnegative(),
58694
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58695
+ filesTotal: number().int().nonnegative().nullable(),
58696
+ bytesMoved: number().int().nonnegative(),
58697
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
58698
+ * crash gets a new mover, and a rate computed from the migration's start
58699
+ * would silently average in the time nothing was running. */
58700
+ startedAt: number(),
58701
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
58702
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
58703
+ * subtract its own. */
58704
+ observedAt: number()
58705
+ });
58593
58706
  var StorageMigrationMoveSchema = object({
58594
58707
  storageClass: StorageMigrationClassSchema,
58595
58708
  fromLocationId: string(),
58596
58709
  toLocationId: string(),
58597
58710
  moverJobId: string().nullable(),
58598
58711
  state: RelocateJobStateSchema.nullable(),
58599
- error: string().nullable()
58712
+ error: string().nullable(),
58713
+ /** Last observed mover counters; `null` until the mover has been polled once. */
58714
+ progress: StorageMigrationMoveProgressSchema.nullable()
58600
58715
  });
58601
58716
  var StorageMigrationJobSchema = object({
58602
58717
  jobId: string(),
58603
58718
  phase: StorageMigrationPhaseSchema,
58719
+ /** Which order this job is running. `status` is the only place an operator
58720
+ * can tell a seconds-long cutover from a thirty-hour one. */
58721
+ mode: StorageMigrationModeSchema,
58604
58722
  destinations: StorageMigrationDestinationsSchema,
58605
58723
  throttleMbps: number(),
58606
58724
  moves: array(StorageMigrationMoveSchema),
@@ -58613,13 +58731,122 @@ var StorageMigrationJobSchema = object({
58613
58731
  finishedAt: number().nullable(),
58614
58732
  error: string().nullable()
58615
58733
  });
58734
+ var StorageMigrationFindingSchema = object({
58735
+ code: _enum([
58736
+ "sharesDeviceWithSource",
58737
+ "deviceIdentityUnknown",
58738
+ "unstampedEventMediaRows",
58739
+ "blockingOnly",
58740
+ "noMover"
58741
+ ]),
58742
+ storageClass: StorageMigrationClassSchema,
58743
+ /** Human-readable, already carrying the ids and counts. */
58744
+ message: string()
58745
+ });
58616
58746
  var StorageMigrationPlanSchema = object({
58617
58747
  destinations: StorageMigrationDestinationsSchema,
58748
+ /** The mode this plan was built for. A plan is only valid for its mode: the
58749
+ * `eventMedia` seal gate and the single-cardinality refusal both depend on
58750
+ * it. */
58751
+ mode: StorageMigrationModeSchema,
58618
58752
  moves: array(object({
58619
58753
  storageClass: StorageMigrationClassSchema,
58620
58754
  fromLocationId: string(),
58621
58755
  toLocationId: string()
58622
- }))
58756
+ })),
58757
+ findings: array(StorageMigrationFindingSchema)
58758
+ });
58759
+ /**
58760
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
58761
+ *
58762
+ * The coordinator's job record is the state of record for a migration, and its
58763
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
58764
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
58765
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
58766
+ * way because no supported UI path existed. A mover armed like that has no job
58767
+ * to fold progress into, so it has to be readable on its own or it is invisible.
58768
+ *
58769
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
58770
+ * orchestrated it.
58771
+ */
58772
+ var StorageMigrationMoverSchema = object({
58773
+ lane: _enum(["footage", "media"]),
58774
+ job: RelocateJobSchema,
58775
+ /** The coordinator job that armed this mover, or `null` for a mover armed
58776
+ * directly against the owning addon. */
58777
+ migrationJobId: string().nullable(),
58778
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
58779
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
58780
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
58781
+ * rate made of two different clocks. */
58782
+ observedAt: number()
58783
+ });
58784
+ /**
58785
+ * What a SOURCE still holds for one storage class — the number that makes a
58786
+ * "drain remaining" action honest rather than hopeful.
58787
+ *
58788
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
58789
+ * engine's own selection count for media), never from the resident index: a
58790
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
58791
+ * never been told about (D295).
58792
+ *
58793
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
58794
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
58795
+ * because refusing on an unanswerable read would hide exactly the case an
58796
+ * operator needs to act on.
58797
+ */
58798
+ var StorageMigrationResidueSchema = object({
58799
+ storageClass: StorageMigrationClassSchema,
58800
+ /** The location still holding the data. `'*'` for the media lane, whose rows
58801
+ * move from wherever they are rather than from one named source. */
58802
+ fromLocationId: string(),
58803
+ /** Where a drain would move it — the class's CURRENT default. */
58804
+ toLocationId: string(),
58805
+ /** Segments (footage lane) or rows (media lane) still on the source. */
58806
+ items: number().int().nonnegative().nullable(),
58807
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
58808
+ bytes: number().int().nonnegative().nullable()
58809
+ });
58810
+ /**
58811
+ * Run the DRAIN half and nothing else.
58812
+ *
58813
+ * A migration that reached `done` has already repointed, so `start` correctly
58814
+ * refuses its destination ("already the default") — there is nothing left to
58815
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
58816
+ * or finish against a work list that was a tenth of the archive (D295), and
58817
+ * before this there was no supported way to run only that half: the only way
58818
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
58819
+ *
58820
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
58821
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
58822
+ * re-repoint a class that is already migrated.
58823
+ */
58824
+ var StorageMigrationDrainInputSchema = object({
58825
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
58826
+ * a class whose source is already empty is refused rather than started. */
58827
+ classes: array(StorageMigrationClassSchema).min(1),
58828
+ throttleMbps: number().min(1).max(1e3).optional()
58829
+ });
58830
+ /** What a footage source still holds, asked of the durable hour ledger. */
58831
+ var RelocateResidueInputSchema = object({
58832
+ fromLocationId: string().min(1),
58833
+ /** Narrow to one logical class; omit for every profile on the location. */
58834
+ footageClass: RelocateFootageClassSchema.optional()
58835
+ });
58836
+ /** `null` = the archive could not answer (no ledger on this node, or the
58837
+ * aggregate failed). Never conflated with an empty source. */
58838
+ var RelocateResidueSchema = object({
58839
+ segments: number().int().nonnegative(),
58840
+ bytes: number().int().nonnegative()
58841
+ }).nullable();
58842
+ /** How many rows a media pass would still act on against a given target — the
58843
+ * media lane's denominator AND its residue, from ONE derivation so the two can
58844
+ * never disagree. `null` = the count could not be taken. */
58845
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
58846
+ var RelocatableMediaCountInputSchema = object({
58847
+ toLocationId: string().min(1),
58848
+ /** Omitted = `move`. */
58849
+ mode: MediaRelocateModeSchema.optional()
58623
58850
  });
58624
58851
  /**
58625
58852
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
@@ -58725,6 +58952,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
58725
58952
  * two addons declaring the same `id` must agree on `cardinality` (validated
58726
58953
  * at kernel aggregation time, not here).
58727
58954
  */
58955
+ /**
58956
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
58957
+ * actually reaches the bytes. It is the constraint that decides which
58958
+ * `storage-provider`s may back a location of that kind.
58959
+ *
58960
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
58961
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
58962
+ * post-analysis media roots). Only a provider that serves a genuine local
58963
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
58964
+ * remote provider's `resolve` returns a path on the REMOTE host, and
58965
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
58966
+ * against a same-named local directory that is something else entirely.
58967
+ *
58968
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
58969
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
58970
+ * service never sees a path, so any provider can back it. `backups` is the
58971
+ * one kind that qualifies today.
58972
+ *
58973
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
58974
+ * an EMERGENT property of how the recorder happened to be written. Nothing
58975
+ * refused the configuration; the first write simply went somewhere wrong, and
58976
+ * a recording write that goes wrong surfaces as a silent black window rather
58977
+ * than an error (the read path does not `stat`). This turns that accident into
58978
+ * a declared, enforced, testable refusal.
58979
+ */
58980
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
58728
58981
  var StorageLocationDeclarationSchema = object({
58729
58982
  /**
58730
58983
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -58744,6 +58997,19 @@ var StorageLocationDeclarationSchema = object({
58744
58997
  */
58745
58998
  cardinality: _enum(["single", "multi"]),
58746
58999
  /**
59000
+ * HOW the declaring service reaches the bytes — and therefore WHICH
59001
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
59002
+ * and {@link STORAGE_ACCESS_FALLBACK}.
59003
+ *
59004
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
59005
+ * can only over-restrict (refuse a remote provider for a kind that might
59006
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
59007
+ * permissive direction and is therefore never inferred — a repo guard
59008
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
59009
+ * reached by omission.
59010
+ */
59011
+ access: StorageAccessSchema.optional(),
59012
+ /**
58747
59013
  * When set, the default instance for this location inherits its resolved
58748
59014
  * root from the named location's default instance. Useful for derivative
58749
59015
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -68628,8 +68894,10 @@ var TrackSchema = object({
68628
68894
  lastSeen: number(),
68629
68895
  /** Frame-rate position history (subject to maxPositionHistory cap). */
68630
68896
  positions: array(TrackPositionSchema).readonly(),
68631
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
68632
- * saveThumbnails policy). */
68897
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
68898
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
68899
+ * the retired `saveThumbnails` used to gate this and the rolling
68900
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
68633
68901
  snapshots: array(TrackSnapshotSchema).readonly(),
68634
68902
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
68635
68903
  zonesVisited: array(string()).readonly(),
@@ -69489,6 +69757,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69489
69757
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
69490
69758
  kind: "mutation",
69491
69759
  auth: "admin"
69760
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
69761
+ kind: "query",
69762
+ auth: "admin"
69492
69763
  }), method(object({}), array(RelocateJobSchema).readonly(), {
69493
69764
  kind: "query",
69494
69765
  auth: "admin"
@@ -71396,7 +71667,10 @@ method(object({
71396
71667
  }), StorageLocationSchema, {
71397
71668
  kind: "mutation",
71398
71669
  auth: "admin"
71399
- }), method(object({ id: string() }), _void(), {
71670
+ }), method(object({
71671
+ id: string(),
71672
+ force: boolean().optional()
71673
+ }), _void(), {
71400
71674
  kind: "mutation",
71401
71675
  auth: "admin"
71402
71676
  }), method(object({ id: string() }), object({
@@ -71445,6 +71719,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
71445
71719
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
71446
71720
  kind: "mutation",
71447
71721
  auth: "admin"
71722
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
71723
+ kind: "mutation",
71724
+ auth: "admin"
71448
71725
  });
71449
71726
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
71450
71727
  providerId: string().min(1),
@@ -71843,12 +72120,38 @@ response: record(string(), unknown()) }), object({
71843
72120
  *
71844
72121
  * ## Why this is a capability and not a helper
71845
72122
  *
71846
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
71847
- * plate, vehicle, identity, and the event store's derivatives — and every one of
71848
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
71849
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
71850
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
71851
- * load 5,000 rows before ranking anything.
72123
+ * This capability was introduced with the claim that SIX stores in
72124
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
72125
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
72126
+ * claim was never true, and leaving it here made five stores look like pending
72127
+ * work when three of them have no vector at all. Counted column by column on
72128
+ * 2026-08-30, exactly THREE ever held one:
72129
+ *
72130
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
72131
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
72132
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
72133
+ * face, migrated 2026-08-30 into its OWN index (see below).
72134
+ *
72135
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
72136
+ * and `identities` store a name; the event store stores no derivative vector.
72137
+ * They are not migration candidates and never were.
72138
+ *
72139
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
72140
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
72141
+ * rows before ranking anything.
72142
+ *
72143
+ * ## One index per COMPARISON, never per encoder
72144
+ *
72145
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
72146
+ * model, and they still get two indexes. An index is a set of things that are
72147
+ * ranked against each other and that live and die together, and these two are
72148
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
72149
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
72150
+ * forever and is the gallery every recognition ranks against. One index would
72151
+ * mean every gallery load and every reconcile carried a filter whose failure
72152
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
72153
+ * person's only sample. The dimension they share is not a reason to share an
72154
+ * index; the question they answer is, and it differs.
71852
72155
  *
71853
72156
  * The fix is not a faster loop, it is a different backend — and the backend
71854
72157
  * should be replaceable without touching six callers. So: a singleton
@@ -71953,7 +72256,20 @@ var VectorQueryResultSchema = object({
71953
72256
  */
71954
72257
  scanned: number(),
71955
72258
  /** True when the backend could not consider every row that passed the filter. */
71956
- truncated: boolean()
72259
+ truncated: boolean(),
72260
+ /**
72261
+ * The `topK` the backend actually ran with.
72262
+ *
72263
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
72264
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
72265
+ * own log rather than in its answer. That is how an audit asking for 20,000
72266
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
72267
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
72268
+ * MUCH, in the return value, where the caller cannot fail to see it.
72269
+ *
72270
+ * Equals the requested `topK` whenever nothing was lowered.
72271
+ */
72272
+ effectiveTopK: number().int().positive()
71957
72273
  });
71958
72274
  var VectorDeleteInputSchema = object({
71959
72275
  index: string(),
@@ -71982,6 +72298,68 @@ var VectorGetResultSchema = object({ items: array(object({
71982
72298
  id: string(),
71983
72299
  metadata: VectorMetadataSchema
71984
72300
  })) });
72301
+ /**
72302
+ * Ids to read back WITH their vectors.
72303
+ *
72304
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
72305
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
72306
+ * caller depends on that promise. This one promises the opposite.
72307
+ *
72308
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
72309
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
72310
+ * a per-face cross-process KNN would be a network round trip inside the
72311
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
72312
+ * it requires the index to hand the floats back. Without this method the only
72313
+ * way to keep a readable vector is a JSON column, which is the thing this
72314
+ * capability exists to delete.
72315
+ *
72316
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
72317
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
72318
+ */
72319
+ var VectorFetchInputSchema = object({
72320
+ index: string(),
72321
+ ids: array(string())
72322
+ });
72323
+ var VectorFetchResultSchema = object({ items: array(object({
72324
+ id: string(),
72325
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
72326
+ vector: string(),
72327
+ metadata: VectorMetadataSchema
72328
+ })) });
72329
+ /**
72330
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
72331
+ *
72332
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
72333
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
72334
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
72335
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
72336
+ * distance to every row is degenerate. `examined: 4096` then read as "we
72337
+ * looked" for as long as anyone cared to read it.
72338
+ *
72339
+ * This is the primitive that question actually needs: a bounded page, ordered
72340
+ * by the backend's own row order, costing no distance computation at all.
72341
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
72342
+ * the full-table read this capability was built to stop.
72343
+ */
72344
+ var VectorScanInputSchema = object({
72345
+ index: string(),
72346
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
72347
+ cursor: number().int().nonnegative().default(0),
72348
+ limit: number().int().positive()
72349
+ });
72350
+ var VectorScanResultSchema = object({
72351
+ items: array(object({
72352
+ id: string(),
72353
+ metadata: VectorMetadataSchema
72354
+ })),
72355
+ /**
72356
+ * Where the next page starts, or `null` when the walk reached the end.
72357
+ *
72358
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
72359
+ * from a short page: a backend is free to return fewer rows than asked.
72360
+ */
72361
+ nextCursor: number().int().nonnegative().nullable()
72362
+ });
71985
72363
  var VectorStatsInputSchema = object({ index: string() });
71986
72364
  var VectorStatsResultSchema = object({
71987
72365
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -72000,7 +72378,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
72000
72378
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
72001
72379
  kind: "mutation",
72002
72380
  auth: "admin"
72003
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72381
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
72004
72382
  kind: "mutation",
72005
72383
  auth: "admin"
72006
72384
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -78644,6 +79022,9 @@ method(object({
78644
79022
  }), method(object({}), array(RelocateJobSchema).readonly(), {
78645
79023
  kind: "query",
78646
79024
  auth: "admin"
79025
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
79026
+ kind: "query",
79027
+ auth: "admin"
78647
79028
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
78648
79029
  kind: "mutation",
78649
79030
  auth: "admin"
@@ -85278,6 +85659,18 @@ Object.freeze({
85278
85659
  addonId: null,
85279
85660
  access: "create"
85280
85661
  },
85662
+ "pipelineAnalytics.countRelocatableMedia": {
85663
+ capName: "pipeline-analytics",
85664
+ capScope: "device",
85665
+ addonId: null,
85666
+ access: "view"
85667
+ },
85668
+ "pipelineAnalytics.countUnstampedEventMedia": {
85669
+ capName: "pipeline-analytics",
85670
+ capScope: "device",
85671
+ addonId: null,
85672
+ access: "view"
85673
+ },
85281
85674
  "pipelineAnalytics.deleteDeviceEvents": {
85282
85675
  capName: "pipeline-analytics",
85283
85676
  capScope: "device",
@@ -86436,6 +86829,12 @@ Object.freeze({
86436
86829
  addonId: null,
86437
86830
  access: "view"
86438
86831
  },
86832
+ "recording.getRelocateResidue": {
86833
+ capName: "recording",
86834
+ capScope: "system",
86835
+ addonId: null,
86836
+ access: "view"
86837
+ },
86439
86838
  "recording.getStorageMigrationMoveStatus": {
86440
86839
  capName: "recording",
86441
86840
  capScope: "system",
@@ -86982,12 +87381,30 @@ Object.freeze({
86982
87381
  addonId: null,
86983
87382
  access: "create"
86984
87383
  },
87384
+ "storageMigration.drain": {
87385
+ capName: "storage-migration",
87386
+ capScope: "system",
87387
+ addonId: null,
87388
+ access: "create"
87389
+ },
87390
+ "storageMigration.movers": {
87391
+ capName: "storage-migration",
87392
+ capScope: "system",
87393
+ addonId: null,
87394
+ access: "view"
87395
+ },
86985
87396
  "storageMigration.plan": {
86986
87397
  capName: "storage-migration",
86987
87398
  capScope: "system",
86988
87399
  addonId: null,
86989
87400
  access: "view"
86990
87401
  },
87402
+ "storageMigration.residue": {
87403
+ capName: "storage-migration",
87404
+ capScope: "system",
87405
+ addonId: null,
87406
+ access: "view"
87407
+ },
86991
87408
  "storageMigration.start": {
86992
87409
  capName: "storage-migration",
86993
87410
  capScope: "system",
@@ -87822,6 +88239,12 @@ Object.freeze({
87822
88239
  addonId: null,
87823
88240
  access: "delete"
87824
88241
  },
88242
+ "vectorStore.fetchByIds": {
88243
+ capName: "vector-store",
88244
+ capScope: "system",
88245
+ addonId: null,
88246
+ access: "view"
88247
+ },
87825
88248
  "vectorStore.getByIds": {
87826
88249
  capName: "vector-store",
87827
88250
  capScope: "system",
@@ -87834,6 +88257,12 @@ Object.freeze({
87834
88257
  addonId: null,
87835
88258
  access: "view"
87836
88259
  },
88260
+ "vectorStore.scan": {
88261
+ capName: "vector-store",
88262
+ capScope: "system",
88263
+ addonId: null,
88264
+ access: "view"
88265
+ },
87837
88266
  "vectorStore.stats": {
87838
88267
  capName: "vector-store",
87839
88268
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.42",
3
+ "version": "0.2.45",
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",