@camstack/addon-ai 0.4.39 → 0.4.42

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
@@ -8206,6 +8206,21 @@ var RelocateJobSchema = object({
8206
8206
  bytesMoved: number$1().int(),
8207
8207
  /** Total files discovered up front; null while (or when) unknown. */
8208
8208
  filesTotal: number$1().int().nullable(),
8209
+ /**
8210
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8211
+ * made that nobody asked for, so it is reported where the operator reads the
8212
+ * job rather than only in a log line.
8213
+ *
8214
+ * A footage segment records its byte count in its own NAME, and the durable
8215
+ * hour row derives its aggregates from those names. A file that does not
8216
+ * match its name therefore makes the ledger's sums — and with them quota and
8217
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8218
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8219
+ *
8220
+ * Absent on lanes where the question has no meaning: a media blob's size is
8221
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8222
+ */
8223
+ rowsReconciled: number$1().int().nonnegative().optional(),
8209
8224
  startedAt: number$1(),
8210
8225
  finishedAt: number$1().nullable(),
8211
8226
  error: string().nullable()
@@ -8274,14 +8289,42 @@ var RelocateMediaInputSchema = object({
8274
8289
  /** Omitted = `move`, the pre-existing behaviour. */
8275
8290
  mode: MediaRelocateModeSchema.optional()
8276
8291
  });
8277
- /** How many rows still carry NO `locationId` — the population a repoint would
8278
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8279
- * value that permits a non-blocking `eventMedia` cutover. */
8280
- var UnstampedEventMediaCountSchema = object({
8281
- media: number$1().int().nonnegative(),
8282
- retrainFrames: number$1().int().nonnegative(),
8283
- total: number$1().int().nonnegative()
8292
+ /**
8293
+ * The unstamped population of ONE collection — split, because the gate and the
8294
+ * operator ask two different questions and only one of them has to be cheap.
8295
+ *
8296
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8297
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8298
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8299
+ * that matters — after a seal, when the population is empty.
8300
+ *
8301
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8302
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8303
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8304
+ * and useful answer: "there are some, and this read could not say how many"
8305
+ * still refuses the cutover, which is the whole job.
8306
+ */
8307
+ var UnstampedRowsSchema = object({
8308
+ present: boolean(),
8309
+ rows: number$1().int().nonnegative().nullable()
8284
8310
  });
8311
+ /**
8312
+ * How many rows still carry NO `locationId` — the population a repoint would
8313
+ * silently re-aim at a disk that does not hold their bytes.
8314
+ *
8315
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8316
+ * over. The gate opens on a measured absence and on nothing else; an unread
8317
+ * collection and an empty one are different facts, and this repo has already
8318
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8319
+ */
8320
+ var UnstampedEventMediaCountSchema = object({
8321
+ media: UnstampedRowsSchema,
8322
+ retrainFrames: UnstampedRowsSchema,
8323
+ /** True when EITHER collection holds one. The refusal reads this. */
8324
+ anyPresent: boolean(),
8325
+ /** Sum across both, or `null` when either lane could not be counted. */
8326
+ total: number$1().int().nonnegative().nullable()
8327
+ }).nullable();
8285
8328
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8286
8329
  /** The independently selectable logical storage classes — every class
8287
8330
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8367,13 +8410,53 @@ var StorageMigrationParticipantSchema = _enum([
8367
8410
  "recorder",
8368
8411
  "analytics"
8369
8412
  ]);
8413
+ /**
8414
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8415
+ *
8416
+ * The long half of a non-blocking migration is `draining`, and it is measured
8417
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8418
+ * existed the only place those numbers appeared was a Loki line, so an operator
8419
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8420
+ * afternoon.
8421
+ *
8422
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8423
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8424
+ * mover — which is the exact failure this is meant to end. The coordinator's
8425
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8426
+ * read `state`; folding the counters costs no extra read and makes the durable
8427
+ * record say afterwards how far a move actually got.
8428
+ *
8429
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8430
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8431
+ * cannot say M, and a 0 there would render as "100 % done".
8432
+ */
8433
+ var StorageMigrationMoveProgressSchema = object({
8434
+ filesMoved: number$1().int().nonnegative(),
8435
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8436
+ filesTotal: number$1().int().nonnegative().nullable(),
8437
+ bytesMoved: number$1().int().nonnegative(),
8438
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8439
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8440
+ * rows would be the same failure as one that silently skipped them. */
8441
+ rowsReconciled: number$1().int().nonnegative().optional(),
8442
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8443
+ * crash gets a new mover, and a rate computed from the migration's start
8444
+ * would silently average in the time nothing was running. */
8445
+ startedAt: number$1(),
8446
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8447
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8448
+ * subtract its own. */
8449
+ observedAt: number$1()
8450
+ });
8370
8451
  var StorageMigrationMoveSchema = object({
8371
8452
  storageClass: StorageMigrationClassSchema,
8372
8453
  fromLocationId: string(),
8373
8454
  toLocationId: string(),
8374
8455
  moverJobId: string().nullable(),
8375
8456
  state: RelocateJobStateSchema.nullable(),
8376
- error: string().nullable()
8457
+ error: string().nullable(),
8458
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8459
+ progress: StorageMigrationMoveProgressSchema.nullable()
8377
8460
  });
8378
8461
  var StorageMigrationJobSchema = object({
8379
8462
  jobId: string(),
@@ -8419,6 +8502,98 @@ var StorageMigrationPlanSchema = object({
8419
8502
  findings: array(StorageMigrationFindingSchema)
8420
8503
  });
8421
8504
  /**
8505
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8506
+ *
8507
+ * The coordinator's job record is the state of record for a migration, and its
8508
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8509
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8510
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8511
+ * way because no supported UI path existed. A mover armed like that has no job
8512
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8513
+ *
8514
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8515
+ * orchestrated it.
8516
+ */
8517
+ var StorageMigrationMoverSchema = object({
8518
+ lane: _enum(["footage", "media"]),
8519
+ job: RelocateJobSchema,
8520
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8521
+ * directly against the owning addon. */
8522
+ migrationJobId: string().nullable(),
8523
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8524
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8525
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8526
+ * rate made of two different clocks. */
8527
+ observedAt: number$1()
8528
+ });
8529
+ /**
8530
+ * What a SOURCE still holds for one storage class — the number that makes a
8531
+ * "drain remaining" action honest rather than hopeful.
8532
+ *
8533
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8534
+ * engine's own selection count for media), never from the resident index: a
8535
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8536
+ * never been told about (D295).
8537
+ *
8538
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8539
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8540
+ * because refusing on an unanswerable read would hide exactly the case an
8541
+ * operator needs to act on.
8542
+ */
8543
+ var StorageMigrationResidueSchema = object({
8544
+ storageClass: StorageMigrationClassSchema,
8545
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8546
+ * move from wherever they are rather than from one named source. */
8547
+ fromLocationId: string(),
8548
+ /** Where a drain would move it — the class's CURRENT default. */
8549
+ toLocationId: string(),
8550
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8551
+ items: number$1().int().nonnegative().nullable(),
8552
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8553
+ bytes: number$1().int().nonnegative().nullable()
8554
+ });
8555
+ /**
8556
+ * Run the DRAIN half and nothing else.
8557
+ *
8558
+ * A migration that reached `done` has already repointed, so `start` correctly
8559
+ * refuses its destination ("already the default") — there is nothing left to
8560
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8561
+ * or finish against a work list that was a tenth of the archive (D295), and
8562
+ * before this there was no supported way to run only that half: the only way
8563
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8564
+ *
8565
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8566
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8567
+ * re-repoint a class that is already migrated.
8568
+ */
8569
+ var StorageMigrationDrainInputSchema = object({
8570
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8571
+ * a class whose source is already empty is refused rather than started. */
8572
+ classes: array(StorageMigrationClassSchema).min(1),
8573
+ throttleMbps: number$1().min(1).max(1e3).optional()
8574
+ });
8575
+ /** What a footage source still holds, asked of the durable hour ledger. */
8576
+ var RelocateResidueInputSchema = object({
8577
+ fromLocationId: string().min(1),
8578
+ /** Narrow to one logical class; omit for every profile on the location. */
8579
+ footageClass: RelocateFootageClassSchema.optional()
8580
+ });
8581
+ /** `null` = the archive could not answer (no ledger on this node, or the
8582
+ * aggregate failed). Never conflated with an empty source. */
8583
+ var RelocateResidueSchema = object({
8584
+ segments: number$1().int().nonnegative(),
8585
+ bytes: number$1().int().nonnegative()
8586
+ }).nullable();
8587
+ /** How many rows a media pass would still act on against a given target — the
8588
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8589
+ * never disagree. `null` = the count could not be taken. */
8590
+ var RelocatableMediaCountSchema = object({ rows: number$1().int().nonnegative() }).nullable();
8591
+ var RelocatableMediaCountInputSchema = object({
8592
+ toLocationId: string().min(1),
8593
+ /** Omitted = `move`. */
8594
+ mode: MediaRelocateModeSchema.optional()
8595
+ });
8596
+ /**
8422
8597
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8423
8598
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8424
8599
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8522,6 +8697,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8522
8697
  * two addons declaring the same `id` must agree on `cardinality` (validated
8523
8698
  * at kernel aggregation time, not here).
8524
8699
  */
8700
+ /**
8701
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8702
+ * actually reaches the bytes. It is the constraint that decides which
8703
+ * `storage-provider`s may back a location of that kind.
8704
+ *
8705
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8706
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8707
+ * post-analysis media roots). Only a provider that serves a genuine local
8708
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8709
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8710
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8711
+ * against a same-named local directory that is something else entirely.
8712
+ *
8713
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8714
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8715
+ * service never sees a path, so any provider can back it. `backups` is the
8716
+ * one kind that qualifies today.
8717
+ *
8718
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8719
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8720
+ * refused the configuration; the first write simply went somewhere wrong, and
8721
+ * a recording write that goes wrong surfaces as a silent black window rather
8722
+ * than an error (the read path does not `stat`). This turns that accident into
8723
+ * a declared, enforced, testable refusal.
8724
+ */
8725
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8525
8726
  var StorageLocationDeclarationSchema = object({
8526
8727
  /**
8527
8728
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8541,6 +8742,19 @@ var StorageLocationDeclarationSchema = object({
8541
8742
  */
8542
8743
  cardinality: _enum(["single", "multi"]),
8543
8744
  /**
8745
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8746
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8747
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8748
+ *
8749
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8750
+ * can only over-restrict (refuse a remote provider for a kind that might
8751
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8752
+ * permissive direction and is therefore never inferred — a repo guard
8753
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8754
+ * reached by omission.
8755
+ */
8756
+ access: StorageAccessSchema.optional(),
8757
+ /**
8544
8758
  * When set, the default instance for this location inherits its resolved
8545
8759
  * root from the named location's default instance. Useful for derivative
8546
8760
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18160,8 +18374,10 @@ var TrackSchema = object({
18160
18374
  lastSeen: number$1(),
18161
18375
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18162
18376
  positions: array(TrackPositionSchema).readonly(),
18163
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18164
- * saveThumbnails policy). */
18377
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18378
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18379
+ * the retired `saveThumbnails` used to gate this and the rolling
18380
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18165
18381
  snapshots: array(TrackSnapshotSchema).readonly(),
18166
18382
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18167
18383
  zonesVisited: array(string()).readonly(),
@@ -19021,7 +19237,10 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
19021
19237
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19022
19238
  kind: "mutation",
19023
19239
  auth: "admin"
19024
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19240
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19241
+ kind: "query",
19242
+ auth: "admin"
19243
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19025
19244
  kind: "query",
19026
19245
  auth: "admin"
19027
19246
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20980,6 +21199,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20980
21199
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20981
21200
  kind: "mutation",
20982
21201
  auth: "admin"
21202
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21203
+ kind: "mutation",
21204
+ auth: "admin"
20983
21205
  });
20984
21206
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20985
21207
  providerId: string().min(1),
@@ -21378,12 +21600,38 @@ response: record(string(), unknown()) }), object({
21378
21600
  *
21379
21601
  * ## Why this is a capability and not a helper
21380
21602
  *
21381
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21382
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21383
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21384
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21385
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21386
- * load 5,000 rows before ranking anything.
21603
+ * This capability was introduced with the claim that SIX stores in
21604
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21605
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21606
+ * claim was never true, and leaving it here made five stores look like pending
21607
+ * work when three of them have no vector at all. Counted column by column on
21608
+ * 2026-08-30, exactly THREE ever held one:
21609
+ *
21610
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21611
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21612
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21613
+ * face, migrated 2026-08-30 into its OWN index (see below).
21614
+ *
21615
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21616
+ * and `identities` store a name; the event store stores no derivative vector.
21617
+ * They are not migration candidates and never were.
21618
+ *
21619
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21620
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21621
+ * rows before ranking anything.
21622
+ *
21623
+ * ## One index per COMPARISON, never per encoder
21624
+ *
21625
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21626
+ * model, and they still get two indexes. An index is a set of things that are
21627
+ * ranked against each other and that live and die together, and these two are
21628
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21629
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21630
+ * forever and is the gallery every recognition ranks against. One index would
21631
+ * mean every gallery load and every reconcile carried a filter whose failure
21632
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21633
+ * person's only sample. The dimension they share is not a reason to share an
21634
+ * index; the question they answer is, and it differs.
21387
21635
  *
21388
21636
  * The fix is not a faster loop, it is a different backend — and the backend
21389
21637
  * should be replaceable without touching six callers. So: a singleton
@@ -21488,7 +21736,20 @@ var VectorQueryResultSchema = object({
21488
21736
  */
21489
21737
  scanned: number$1(),
21490
21738
  /** True when the backend could not consider every row that passed the filter. */
21491
- truncated: boolean()
21739
+ truncated: boolean(),
21740
+ /**
21741
+ * The `topK` the backend actually ran with.
21742
+ *
21743
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21744
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21745
+ * own log rather than in its answer. That is how an audit asking for 20,000
21746
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21747
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21748
+ * MUCH, in the return value, where the caller cannot fail to see it.
21749
+ *
21750
+ * Equals the requested `topK` whenever nothing was lowered.
21751
+ */
21752
+ effectiveTopK: number$1().int().positive()
21492
21753
  });
21493
21754
  var VectorDeleteInputSchema = object({
21494
21755
  index: string(),
@@ -21517,6 +21778,68 @@ var VectorGetResultSchema = object({ items: array(object({
21517
21778
  id: string(),
21518
21779
  metadata: VectorMetadataSchema
21519
21780
  })) });
21781
+ /**
21782
+ * Ids to read back WITH their vectors.
21783
+ *
21784
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21785
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21786
+ * caller depends on that promise. This one promises the opposite.
21787
+ *
21788
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21789
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21790
+ * a per-face cross-process KNN would be a network round trip inside the
21791
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21792
+ * it requires the index to hand the floats back. Without this method the only
21793
+ * way to keep a readable vector is a JSON column, which is the thing this
21794
+ * capability exists to delete.
21795
+ *
21796
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21797
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21798
+ */
21799
+ var VectorFetchInputSchema = object({
21800
+ index: string(),
21801
+ ids: array(string())
21802
+ });
21803
+ var VectorFetchResultSchema = object({ items: array(object({
21804
+ id: string(),
21805
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21806
+ vector: string(),
21807
+ metadata: VectorMetadataSchema
21808
+ })) });
21809
+ /**
21810
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21811
+ *
21812
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21813
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21814
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21815
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21816
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21817
+ * looked" for as long as anyone cared to read it.
21818
+ *
21819
+ * This is the primitive that question actually needs: a bounded page, ordered
21820
+ * by the backend's own row order, costing no distance computation at all.
21821
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21822
+ * the full-table read this capability was built to stop.
21823
+ */
21824
+ var VectorScanInputSchema = object({
21825
+ index: string(),
21826
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21827
+ cursor: number$1().int().nonnegative().default(0),
21828
+ limit: number$1().int().positive()
21829
+ });
21830
+ var VectorScanResultSchema = object({
21831
+ items: array(object({
21832
+ id: string(),
21833
+ metadata: VectorMetadataSchema
21834
+ })),
21835
+ /**
21836
+ * Where the next page starts, or `null` when the walk reached the end.
21837
+ *
21838
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21839
+ * from a short page: a backend is free to return fewer rows than asked.
21840
+ */
21841
+ nextCursor: number$1().int().nonnegative().nullable()
21842
+ });
21520
21843
  var VectorStatsInputSchema = object({ index: string() });
21521
21844
  var VectorStatsResultSchema = object({
21522
21845
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21535,7 +21858,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21535
21858
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21536
21859
  kind: "mutation",
21537
21860
  auth: "admin"
21538
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21861
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21539
21862
  kind: "mutation",
21540
21863
  auth: "admin"
21541
21864
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26439,6 +26762,9 @@ method(object({
26439
26762
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26440
26763
  kind: "query",
26441
26764
  auth: "admin"
26765
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26766
+ kind: "query",
26767
+ auth: "admin"
26442
26768
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26443
26769
  kind: "mutation",
26444
26770
  auth: "admin"
@@ -31404,6 +31730,12 @@ Object.freeze({
31404
31730
  addonId: null,
31405
31731
  access: "create"
31406
31732
  },
31733
+ "pipelineAnalytics.countRelocatableMedia": {
31734
+ capName: "pipeline-analytics",
31735
+ capScope: "device",
31736
+ addonId: null,
31737
+ access: "view"
31738
+ },
31407
31739
  "pipelineAnalytics.countUnstampedEventMedia": {
31408
31740
  capName: "pipeline-analytics",
31409
31741
  capScope: "device",
@@ -32568,6 +32900,12 @@ Object.freeze({
32568
32900
  addonId: null,
32569
32901
  access: "view"
32570
32902
  },
32903
+ "recording.getRelocateResidue": {
32904
+ capName: "recording",
32905
+ capScope: "system",
32906
+ addonId: null,
32907
+ access: "view"
32908
+ },
32571
32909
  "recording.getStorageMigrationMoveStatus": {
32572
32910
  capName: "recording",
32573
32911
  capScope: "system",
@@ -33114,12 +33452,30 @@ Object.freeze({
33114
33452
  addonId: null,
33115
33453
  access: "create"
33116
33454
  },
33455
+ "storageMigration.drain": {
33456
+ capName: "storage-migration",
33457
+ capScope: "system",
33458
+ addonId: null,
33459
+ access: "create"
33460
+ },
33461
+ "storageMigration.movers": {
33462
+ capName: "storage-migration",
33463
+ capScope: "system",
33464
+ addonId: null,
33465
+ access: "view"
33466
+ },
33117
33467
  "storageMigration.plan": {
33118
33468
  capName: "storage-migration",
33119
33469
  capScope: "system",
33120
33470
  addonId: null,
33121
33471
  access: "view"
33122
33472
  },
33473
+ "storageMigration.residue": {
33474
+ capName: "storage-migration",
33475
+ capScope: "system",
33476
+ addonId: null,
33477
+ access: "view"
33478
+ },
33123
33479
  "storageMigration.start": {
33124
33480
  capName: "storage-migration",
33125
33481
  capScope: "system",
@@ -33954,6 +34310,12 @@ Object.freeze({
33954
34310
  addonId: null,
33955
34311
  access: "delete"
33956
34312
  },
34313
+ "vectorStore.fetchByIds": {
34314
+ capName: "vector-store",
34315
+ capScope: "system",
34316
+ addonId: null,
34317
+ access: "view"
34318
+ },
33957
34319
  "vectorStore.getByIds": {
33958
34320
  capName: "vector-store",
33959
34321
  capScope: "system",
@@ -33966,6 +34328,12 @@ Object.freeze({
33966
34328
  addonId: null,
33967
34329
  access: "view"
33968
34330
  },
34331
+ "vectorStore.scan": {
34332
+ capName: "vector-store",
34333
+ capScope: "system",
34334
+ addonId: null,
34335
+ access: "view"
34336
+ },
33969
34337
  "vectorStore.stats": {
33970
34338
  capName: "vector-store",
33971
34339
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8233,6 +8233,21 @@ var RelocateJobSchema = object({
8233
8233
  bytesMoved: number$1().int(),
8234
8234
  /** Total files discovered up front; null while (or when) unknown. */
8235
8235
  filesTotal: number$1().int().nullable(),
8236
+ /**
8237
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8238
+ * made that nobody asked for, so it is reported where the operator reads the
8239
+ * job rather than only in a log line.
8240
+ *
8241
+ * A footage segment records its byte count in its own NAME, and the durable
8242
+ * hour row derives its aggregates from those names. A file that does not
8243
+ * match its name therefore makes the ledger's sums — and with them quota and
8244
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8245
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8246
+ *
8247
+ * Absent on lanes where the question has no meaning: a media blob's size is
8248
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8249
+ */
8250
+ rowsReconciled: number$1().int().nonnegative().optional(),
8236
8251
  startedAt: number$1(),
8237
8252
  finishedAt: number$1().nullable(),
8238
8253
  error: string().nullable()
@@ -8301,14 +8316,42 @@ var RelocateMediaInputSchema = object({
8301
8316
  /** Omitted = `move`, the pre-existing behaviour. */
8302
8317
  mode: MediaRelocateModeSchema.optional()
8303
8318
  });
8304
- /** How many rows still carry NO `locationId` — the population a repoint would
8305
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8306
- * value that permits a non-blocking `eventMedia` cutover. */
8307
- var UnstampedEventMediaCountSchema = object({
8308
- media: number$1().int().nonnegative(),
8309
- retrainFrames: number$1().int().nonnegative(),
8310
- total: number$1().int().nonnegative()
8319
+ /**
8320
+ * The unstamped population of ONE collection — split, because the gate and the
8321
+ * operator ask two different questions and only one of them has to be cheap.
8322
+ *
8323
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8324
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8325
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8326
+ * that matters — after a seal, when the population is empty.
8327
+ *
8328
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8329
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8330
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8331
+ * and useful answer: "there are some, and this read could not say how many"
8332
+ * still refuses the cutover, which is the whole job.
8333
+ */
8334
+ var UnstampedRowsSchema = object({
8335
+ present: boolean(),
8336
+ rows: number$1().int().nonnegative().nullable()
8311
8337
  });
8338
+ /**
8339
+ * How many rows still carry NO `locationId` — the population a repoint would
8340
+ * silently re-aim at a disk that does not hold their bytes.
8341
+ *
8342
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8343
+ * over. The gate opens on a measured absence and on nothing else; an unread
8344
+ * collection and an empty one are different facts, and this repo has already
8345
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8346
+ */
8347
+ var UnstampedEventMediaCountSchema = object({
8348
+ media: UnstampedRowsSchema,
8349
+ retrainFrames: UnstampedRowsSchema,
8350
+ /** True when EITHER collection holds one. The refusal reads this. */
8351
+ anyPresent: boolean(),
8352
+ /** Sum across both, or `null` when either lane could not be counted. */
8353
+ total: number$1().int().nonnegative().nullable()
8354
+ }).nullable();
8312
8355
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8313
8356
  /** The independently selectable logical storage classes — every class
8314
8357
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8394,13 +8437,53 @@ var StorageMigrationParticipantSchema = _enum([
8394
8437
  "recorder",
8395
8438
  "analytics"
8396
8439
  ]);
8440
+ /**
8441
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8442
+ *
8443
+ * The long half of a non-blocking migration is `draining`, and it is measured
8444
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8445
+ * existed the only place those numbers appeared was a Loki line, so an operator
8446
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8447
+ * afternoon.
8448
+ *
8449
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8450
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8451
+ * mover — which is the exact failure this is meant to end. The coordinator's
8452
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8453
+ * read `state`; folding the counters costs no extra read and makes the durable
8454
+ * record say afterwards how far a move actually got.
8455
+ *
8456
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8457
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8458
+ * cannot say M, and a 0 there would render as "100 % done".
8459
+ */
8460
+ var StorageMigrationMoveProgressSchema = object({
8461
+ filesMoved: number$1().int().nonnegative(),
8462
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8463
+ filesTotal: number$1().int().nonnegative().nullable(),
8464
+ bytesMoved: number$1().int().nonnegative(),
8465
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8466
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8467
+ * rows would be the same failure as one that silently skipped them. */
8468
+ rowsReconciled: number$1().int().nonnegative().optional(),
8469
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8470
+ * crash gets a new mover, and a rate computed from the migration's start
8471
+ * would silently average in the time nothing was running. */
8472
+ startedAt: number$1(),
8473
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8474
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8475
+ * subtract its own. */
8476
+ observedAt: number$1()
8477
+ });
8397
8478
  var StorageMigrationMoveSchema = object({
8398
8479
  storageClass: StorageMigrationClassSchema,
8399
8480
  fromLocationId: string(),
8400
8481
  toLocationId: string(),
8401
8482
  moverJobId: string().nullable(),
8402
8483
  state: RelocateJobStateSchema.nullable(),
8403
- error: string().nullable()
8484
+ error: string().nullable(),
8485
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8486
+ progress: StorageMigrationMoveProgressSchema.nullable()
8404
8487
  });
8405
8488
  var StorageMigrationJobSchema = object({
8406
8489
  jobId: string(),
@@ -8446,6 +8529,98 @@ var StorageMigrationPlanSchema = object({
8446
8529
  findings: array(StorageMigrationFindingSchema)
8447
8530
  });
8448
8531
  /**
8532
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8533
+ *
8534
+ * The coordinator's job record is the state of record for a migration, and its
8535
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8536
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8537
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8538
+ * way because no supported UI path existed. A mover armed like that has no job
8539
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8540
+ *
8541
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8542
+ * orchestrated it.
8543
+ */
8544
+ var StorageMigrationMoverSchema = object({
8545
+ lane: _enum(["footage", "media"]),
8546
+ job: RelocateJobSchema,
8547
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8548
+ * directly against the owning addon. */
8549
+ migrationJobId: string().nullable(),
8550
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8551
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8552
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8553
+ * rate made of two different clocks. */
8554
+ observedAt: number$1()
8555
+ });
8556
+ /**
8557
+ * What a SOURCE still holds for one storage class — the number that makes a
8558
+ * "drain remaining" action honest rather than hopeful.
8559
+ *
8560
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8561
+ * engine's own selection count for media), never from the resident index: a
8562
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8563
+ * never been told about (D295).
8564
+ *
8565
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8566
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8567
+ * because refusing on an unanswerable read would hide exactly the case an
8568
+ * operator needs to act on.
8569
+ */
8570
+ var StorageMigrationResidueSchema = object({
8571
+ storageClass: StorageMigrationClassSchema,
8572
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8573
+ * move from wherever they are rather than from one named source. */
8574
+ fromLocationId: string(),
8575
+ /** Where a drain would move it — the class's CURRENT default. */
8576
+ toLocationId: string(),
8577
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8578
+ items: number$1().int().nonnegative().nullable(),
8579
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8580
+ bytes: number$1().int().nonnegative().nullable()
8581
+ });
8582
+ /**
8583
+ * Run the DRAIN half and nothing else.
8584
+ *
8585
+ * A migration that reached `done` has already repointed, so `start` correctly
8586
+ * refuses its destination ("already the default") — there is nothing left to
8587
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8588
+ * or finish against a work list that was a tenth of the archive (D295), and
8589
+ * before this there was no supported way to run only that half: the only way
8590
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8591
+ *
8592
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8593
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8594
+ * re-repoint a class that is already migrated.
8595
+ */
8596
+ var StorageMigrationDrainInputSchema = object({
8597
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8598
+ * a class whose source is already empty is refused rather than started. */
8599
+ classes: array(StorageMigrationClassSchema).min(1),
8600
+ throttleMbps: number$1().min(1).max(1e3).optional()
8601
+ });
8602
+ /** What a footage source still holds, asked of the durable hour ledger. */
8603
+ var RelocateResidueInputSchema = object({
8604
+ fromLocationId: string().min(1),
8605
+ /** Narrow to one logical class; omit for every profile on the location. */
8606
+ footageClass: RelocateFootageClassSchema.optional()
8607
+ });
8608
+ /** `null` = the archive could not answer (no ledger on this node, or the
8609
+ * aggregate failed). Never conflated with an empty source. */
8610
+ var RelocateResidueSchema = object({
8611
+ segments: number$1().int().nonnegative(),
8612
+ bytes: number$1().int().nonnegative()
8613
+ }).nullable();
8614
+ /** How many rows a media pass would still act on against a given target — the
8615
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8616
+ * never disagree. `null` = the count could not be taken. */
8617
+ var RelocatableMediaCountSchema = object({ rows: number$1().int().nonnegative() }).nullable();
8618
+ var RelocatableMediaCountInputSchema = object({
8619
+ toLocationId: string().min(1),
8620
+ /** Omitted = `move`. */
8621
+ mode: MediaRelocateModeSchema.optional()
8622
+ });
8623
+ /**
8449
8624
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8450
8625
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8451
8626
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8549,6 +8724,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8549
8724
  * two addons declaring the same `id` must agree on `cardinality` (validated
8550
8725
  * at kernel aggregation time, not here).
8551
8726
  */
8727
+ /**
8728
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8729
+ * actually reaches the bytes. It is the constraint that decides which
8730
+ * `storage-provider`s may back a location of that kind.
8731
+ *
8732
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8733
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8734
+ * post-analysis media roots). Only a provider that serves a genuine local
8735
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8736
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8737
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8738
+ * against a same-named local directory that is something else entirely.
8739
+ *
8740
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8741
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8742
+ * service never sees a path, so any provider can back it. `backups` is the
8743
+ * one kind that qualifies today.
8744
+ *
8745
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8746
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8747
+ * refused the configuration; the first write simply went somewhere wrong, and
8748
+ * a recording write that goes wrong surfaces as a silent black window rather
8749
+ * than an error (the read path does not `stat`). This turns that accident into
8750
+ * a declared, enforced, testable refusal.
8751
+ */
8752
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8552
8753
  var StorageLocationDeclarationSchema = object({
8553
8754
  /**
8554
8755
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8568,6 +8769,19 @@ var StorageLocationDeclarationSchema = object({
8568
8769
  */
8569
8770
  cardinality: _enum(["single", "multi"]),
8570
8771
  /**
8772
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8773
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8774
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8775
+ *
8776
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8777
+ * can only over-restrict (refuse a remote provider for a kind that might
8778
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8779
+ * permissive direction and is therefore never inferred — a repo guard
8780
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8781
+ * reached by omission.
8782
+ */
8783
+ access: StorageAccessSchema.optional(),
8784
+ /**
8571
8785
  * When set, the default instance for this location inherits its resolved
8572
8786
  * root from the named location's default instance. Useful for derivative
8573
8787
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18187,8 +18401,10 @@ var TrackSchema = object({
18187
18401
  lastSeen: number$1(),
18188
18402
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18189
18403
  positions: array(TrackPositionSchema).readonly(),
18190
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18191
- * saveThumbnails policy). */
18404
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18405
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18406
+ * the retired `saveThumbnails` used to gate this and the rolling
18407
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18192
18408
  snapshots: array(TrackSnapshotSchema).readonly(),
18193
18409
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18194
18410
  zonesVisited: array(string()).readonly(),
@@ -19048,7 +19264,10 @@ DeviceType.Camera, method(object({ deviceId: number$1() }), array(TrackSchema).r
19048
19264
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19049
19265
  kind: "mutation",
19050
19266
  auth: "admin"
19051
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19267
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19268
+ kind: "query",
19269
+ auth: "admin"
19270
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19052
19271
  kind: "query",
19053
19272
  auth: "admin"
19054
19273
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21007,6 +21226,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21007
21226
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21008
21227
  kind: "mutation",
21009
21228
  auth: "admin"
21229
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21230
+ kind: "mutation",
21231
+ auth: "admin"
21010
21232
  });
21011
21233
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21012
21234
  providerId: string().min(1),
@@ -21405,12 +21627,38 @@ response: record(string(), unknown()) }), object({
21405
21627
  *
21406
21628
  * ## Why this is a capability and not a helper
21407
21629
  *
21408
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21409
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21410
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21411
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21412
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21413
- * load 5,000 rows before ranking anything.
21630
+ * This capability was introduced with the claim that SIX stores in
21631
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21632
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21633
+ * claim was never true, and leaving it here made five stores look like pending
21634
+ * work when three of them have no vector at all. Counted column by column on
21635
+ * 2026-08-30, exactly THREE ever held one:
21636
+ *
21637
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21638
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21639
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21640
+ * face, migrated 2026-08-30 into its OWN index (see below).
21641
+ *
21642
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21643
+ * and `identities` store a name; the event store stores no derivative vector.
21644
+ * They are not migration candidates and never were.
21645
+ *
21646
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21647
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21648
+ * rows before ranking anything.
21649
+ *
21650
+ * ## One index per COMPARISON, never per encoder
21651
+ *
21652
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21653
+ * model, and they still get two indexes. An index is a set of things that are
21654
+ * ranked against each other and that live and die together, and these two are
21655
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21656
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21657
+ * forever and is the gallery every recognition ranks against. One index would
21658
+ * mean every gallery load and every reconcile carried a filter whose failure
21659
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21660
+ * person's only sample. The dimension they share is not a reason to share an
21661
+ * index; the question they answer is, and it differs.
21414
21662
  *
21415
21663
  * The fix is not a faster loop, it is a different backend — and the backend
21416
21664
  * should be replaceable without touching six callers. So: a singleton
@@ -21515,7 +21763,20 @@ var VectorQueryResultSchema = object({
21515
21763
  */
21516
21764
  scanned: number$1(),
21517
21765
  /** True when the backend could not consider every row that passed the filter. */
21518
- truncated: boolean()
21766
+ truncated: boolean(),
21767
+ /**
21768
+ * The `topK` the backend actually ran with.
21769
+ *
21770
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21771
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21772
+ * own log rather than in its answer. That is how an audit asking for 20,000
21773
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21774
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21775
+ * MUCH, in the return value, where the caller cannot fail to see it.
21776
+ *
21777
+ * Equals the requested `topK` whenever nothing was lowered.
21778
+ */
21779
+ effectiveTopK: number$1().int().positive()
21519
21780
  });
21520
21781
  var VectorDeleteInputSchema = object({
21521
21782
  index: string(),
@@ -21544,6 +21805,68 @@ var VectorGetResultSchema = object({ items: array(object({
21544
21805
  id: string(),
21545
21806
  metadata: VectorMetadataSchema
21546
21807
  })) });
21808
+ /**
21809
+ * Ids to read back WITH their vectors.
21810
+ *
21811
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21812
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21813
+ * caller depends on that promise. This one promises the opposite.
21814
+ *
21815
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21816
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21817
+ * a per-face cross-process KNN would be a network round trip inside the
21818
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21819
+ * it requires the index to hand the floats back. Without this method the only
21820
+ * way to keep a readable vector is a JSON column, which is the thing this
21821
+ * capability exists to delete.
21822
+ *
21823
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21824
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21825
+ */
21826
+ var VectorFetchInputSchema = object({
21827
+ index: string(),
21828
+ ids: array(string())
21829
+ });
21830
+ var VectorFetchResultSchema = object({ items: array(object({
21831
+ id: string(),
21832
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21833
+ vector: string(),
21834
+ metadata: VectorMetadataSchema
21835
+ })) });
21836
+ /**
21837
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21838
+ *
21839
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21840
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21841
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21842
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21843
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21844
+ * looked" for as long as anyone cared to read it.
21845
+ *
21846
+ * This is the primitive that question actually needs: a bounded page, ordered
21847
+ * by the backend's own row order, costing no distance computation at all.
21848
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21849
+ * the full-table read this capability was built to stop.
21850
+ */
21851
+ var VectorScanInputSchema = object({
21852
+ index: string(),
21853
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21854
+ cursor: number$1().int().nonnegative().default(0),
21855
+ limit: number$1().int().positive()
21856
+ });
21857
+ var VectorScanResultSchema = object({
21858
+ items: array(object({
21859
+ id: string(),
21860
+ metadata: VectorMetadataSchema
21861
+ })),
21862
+ /**
21863
+ * Where the next page starts, or `null` when the walk reached the end.
21864
+ *
21865
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21866
+ * from a short page: a backend is free to return fewer rows than asked.
21867
+ */
21868
+ nextCursor: number$1().int().nonnegative().nullable()
21869
+ });
21547
21870
  var VectorStatsInputSchema = object({ index: string() });
21548
21871
  var VectorStatsResultSchema = object({
21549
21872
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21562,7 +21885,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21562
21885
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21563
21886
  kind: "mutation",
21564
21887
  auth: "admin"
21565
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21888
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21566
21889
  kind: "mutation",
21567
21890
  auth: "admin"
21568
21891
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26466,6 +26789,9 @@ method(object({
26466
26789
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26467
26790
  kind: "query",
26468
26791
  auth: "admin"
26792
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26793
+ kind: "query",
26794
+ auth: "admin"
26469
26795
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26470
26796
  kind: "mutation",
26471
26797
  auth: "admin"
@@ -31431,6 +31757,12 @@ Object.freeze({
31431
31757
  addonId: null,
31432
31758
  access: "create"
31433
31759
  },
31760
+ "pipelineAnalytics.countRelocatableMedia": {
31761
+ capName: "pipeline-analytics",
31762
+ capScope: "device",
31763
+ addonId: null,
31764
+ access: "view"
31765
+ },
31434
31766
  "pipelineAnalytics.countUnstampedEventMedia": {
31435
31767
  capName: "pipeline-analytics",
31436
31768
  capScope: "device",
@@ -32595,6 +32927,12 @@ Object.freeze({
32595
32927
  addonId: null,
32596
32928
  access: "view"
32597
32929
  },
32930
+ "recording.getRelocateResidue": {
32931
+ capName: "recording",
32932
+ capScope: "system",
32933
+ addonId: null,
32934
+ access: "view"
32935
+ },
32598
32936
  "recording.getStorageMigrationMoveStatus": {
32599
32937
  capName: "recording",
32600
32938
  capScope: "system",
@@ -33141,12 +33479,30 @@ Object.freeze({
33141
33479
  addonId: null,
33142
33480
  access: "create"
33143
33481
  },
33482
+ "storageMigration.drain": {
33483
+ capName: "storage-migration",
33484
+ capScope: "system",
33485
+ addonId: null,
33486
+ access: "create"
33487
+ },
33488
+ "storageMigration.movers": {
33489
+ capName: "storage-migration",
33490
+ capScope: "system",
33491
+ addonId: null,
33492
+ access: "view"
33493
+ },
33144
33494
  "storageMigration.plan": {
33145
33495
  capName: "storage-migration",
33146
33496
  capScope: "system",
33147
33497
  addonId: null,
33148
33498
  access: "view"
33149
33499
  },
33500
+ "storageMigration.residue": {
33501
+ capName: "storage-migration",
33502
+ capScope: "system",
33503
+ addonId: null,
33504
+ access: "view"
33505
+ },
33150
33506
  "storageMigration.start": {
33151
33507
  capName: "storage-migration",
33152
33508
  capScope: "system",
@@ -33981,6 +34337,12 @@ Object.freeze({
33981
34337
  addonId: null,
33982
34338
  access: "delete"
33983
34339
  },
34340
+ "vectorStore.fetchByIds": {
34341
+ capName: "vector-store",
34342
+ capScope: "system",
34343
+ addonId: null,
34344
+ access: "view"
34345
+ },
33984
34346
  "vectorStore.getByIds": {
33985
34347
  capName: "vector-store",
33986
34348
  capScope: "system",
@@ -33993,6 +34355,12 @@ Object.freeze({
33993
34355
  addonId: null,
33994
34356
  access: "view"
33995
34357
  },
34358
+ "vectorStore.scan": {
34359
+ capName: "vector-store",
34360
+ capScope: "system",
34361
+ addonId: null,
34362
+ access: "view"
34363
+ },
33996
34364
  "vectorStore.stats": {
33997
34365
  capName: "vector-store",
33998
34366
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-ai",
3
- "version": "0.4.39",
3
+ "version": "0.4.42",
4
4
  "description": "AI addon for CamStack — the `llm` collection provider (cloud, LAN, and camstack-managed local llama.cpp profiles) plus the per-node `llm-runtime` managed executor.",
5
5
  "keywords": [
6
6
  "camstack",