@camstack/addon-import-alexa 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 +387 -19
  2. package/dist/addon.mjs +387 -19
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8161,6 +8161,21 @@ var RelocateJobSchema = object({
8161
8161
  bytesMoved: number().int(),
8162
8162
  /** Total files discovered up front; null while (or when) unknown. */
8163
8163
  filesTotal: number().int().nullable(),
8164
+ /**
8165
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8166
+ * made that nobody asked for, so it is reported where the operator reads the
8167
+ * job rather than only in a log line.
8168
+ *
8169
+ * A footage segment records its byte count in its own NAME, and the durable
8170
+ * hour row derives its aggregates from those names. A file that does not
8171
+ * match its name therefore makes the ledger's sums — and with them quota and
8172
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8173
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8174
+ *
8175
+ * Absent on lanes where the question has no meaning: a media blob's size is
8176
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8177
+ */
8178
+ rowsReconciled: number().int().nonnegative().optional(),
8164
8179
  startedAt: number(),
8165
8180
  finishedAt: number().nullable(),
8166
8181
  error: string().nullable()
@@ -8229,14 +8244,42 @@ var RelocateMediaInputSchema = object({
8229
8244
  /** Omitted = `move`, the pre-existing behaviour. */
8230
8245
  mode: MediaRelocateModeSchema.optional()
8231
8246
  });
8232
- /** How many rows still carry NO `locationId` — the population a repoint would
8233
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
- * value that permits a non-blocking `eventMedia` cutover. */
8235
- var UnstampedEventMediaCountSchema = object({
8236
- media: number().int().nonnegative(),
8237
- retrainFrames: number().int().nonnegative(),
8238
- total: number().int().nonnegative()
8247
+ /**
8248
+ * The unstamped population of ONE collection — split, because the gate and the
8249
+ * operator ask two different questions and only one of them has to be cheap.
8250
+ *
8251
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8252
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8253
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8254
+ * that matters — after a seal, when the population is empty.
8255
+ *
8256
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8257
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8258
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8259
+ * and useful answer: "there are some, and this read could not say how many"
8260
+ * still refuses the cutover, which is the whole job.
8261
+ */
8262
+ var UnstampedRowsSchema = object({
8263
+ present: boolean(),
8264
+ rows: number().int().nonnegative().nullable()
8239
8265
  });
8266
+ /**
8267
+ * How many rows still carry NO `locationId` — the population a repoint would
8268
+ * silently re-aim at a disk that does not hold their bytes.
8269
+ *
8270
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8271
+ * over. The gate opens on a measured absence and on nothing else; an unread
8272
+ * collection and an empty one are different facts, and this repo has already
8273
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8274
+ */
8275
+ var UnstampedEventMediaCountSchema = object({
8276
+ media: UnstampedRowsSchema,
8277
+ retrainFrames: UnstampedRowsSchema,
8278
+ /** True when EITHER collection holds one. The refusal reads this. */
8279
+ anyPresent: boolean(),
8280
+ /** Sum across both, or `null` when either lane could not be counted. */
8281
+ total: number().int().nonnegative().nullable()
8282
+ }).nullable();
8240
8283
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8241
8284
  /** The independently selectable logical storage classes — every class
8242
8285
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8322,13 +8365,53 @@ var StorageMigrationParticipantSchema = _enum([
8322
8365
  "recorder",
8323
8366
  "analytics"
8324
8367
  ]);
8368
+ /**
8369
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8370
+ *
8371
+ * The long half of a non-blocking migration is `draining`, and it is measured
8372
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8373
+ * existed the only place those numbers appeared was a Loki line, so an operator
8374
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8375
+ * afternoon.
8376
+ *
8377
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8378
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8379
+ * mover — which is the exact failure this is meant to end. The coordinator's
8380
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8381
+ * read `state`; folding the counters costs no extra read and makes the durable
8382
+ * record say afterwards how far a move actually got.
8383
+ *
8384
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8385
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8386
+ * cannot say M, and a 0 there would render as "100 % done".
8387
+ */
8388
+ var StorageMigrationMoveProgressSchema = object({
8389
+ filesMoved: number().int().nonnegative(),
8390
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8391
+ filesTotal: number().int().nonnegative().nullable(),
8392
+ bytesMoved: number().int().nonnegative(),
8393
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8394
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8395
+ * rows would be the same failure as one that silently skipped them. */
8396
+ rowsReconciled: number().int().nonnegative().optional(),
8397
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8398
+ * crash gets a new mover, and a rate computed from the migration's start
8399
+ * would silently average in the time nothing was running. */
8400
+ startedAt: number(),
8401
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8402
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8403
+ * subtract its own. */
8404
+ observedAt: number()
8405
+ });
8325
8406
  var StorageMigrationMoveSchema = object({
8326
8407
  storageClass: StorageMigrationClassSchema,
8327
8408
  fromLocationId: string(),
8328
8409
  toLocationId: string(),
8329
8410
  moverJobId: string().nullable(),
8330
8411
  state: RelocateJobStateSchema.nullable(),
8331
- error: string().nullable()
8412
+ error: string().nullable(),
8413
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8414
+ progress: StorageMigrationMoveProgressSchema.nullable()
8332
8415
  });
8333
8416
  var StorageMigrationJobSchema = object({
8334
8417
  jobId: string(),
@@ -8374,6 +8457,98 @@ var StorageMigrationPlanSchema = object({
8374
8457
  findings: array(StorageMigrationFindingSchema)
8375
8458
  });
8376
8459
  /**
8460
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8461
+ *
8462
+ * The coordinator's job record is the state of record for a migration, and its
8463
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8464
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8465
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8466
+ * way because no supported UI path existed. A mover armed like that has no job
8467
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8468
+ *
8469
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8470
+ * orchestrated it.
8471
+ */
8472
+ var StorageMigrationMoverSchema = object({
8473
+ lane: _enum(["footage", "media"]),
8474
+ job: RelocateJobSchema,
8475
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8476
+ * directly against the owning addon. */
8477
+ migrationJobId: string().nullable(),
8478
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8479
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8480
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8481
+ * rate made of two different clocks. */
8482
+ observedAt: number()
8483
+ });
8484
+ /**
8485
+ * What a SOURCE still holds for one storage class — the number that makes a
8486
+ * "drain remaining" action honest rather than hopeful.
8487
+ *
8488
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8489
+ * engine's own selection count for media), never from the resident index: a
8490
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8491
+ * never been told about (D295).
8492
+ *
8493
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8494
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8495
+ * because refusing on an unanswerable read would hide exactly the case an
8496
+ * operator needs to act on.
8497
+ */
8498
+ var StorageMigrationResidueSchema = object({
8499
+ storageClass: StorageMigrationClassSchema,
8500
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8501
+ * move from wherever they are rather than from one named source. */
8502
+ fromLocationId: string(),
8503
+ /** Where a drain would move it — the class's CURRENT default. */
8504
+ toLocationId: string(),
8505
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8506
+ items: number().int().nonnegative().nullable(),
8507
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8508
+ bytes: number().int().nonnegative().nullable()
8509
+ });
8510
+ /**
8511
+ * Run the DRAIN half and nothing else.
8512
+ *
8513
+ * A migration that reached `done` has already repointed, so `start` correctly
8514
+ * refuses its destination ("already the default") — there is nothing left to
8515
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8516
+ * or finish against a work list that was a tenth of the archive (D295), and
8517
+ * before this there was no supported way to run only that half: the only way
8518
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8519
+ *
8520
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8521
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8522
+ * re-repoint a class that is already migrated.
8523
+ */
8524
+ var StorageMigrationDrainInputSchema = object({
8525
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8526
+ * a class whose source is already empty is refused rather than started. */
8527
+ classes: array(StorageMigrationClassSchema).min(1),
8528
+ throttleMbps: number().min(1).max(1e3).optional()
8529
+ });
8530
+ /** What a footage source still holds, asked of the durable hour ledger. */
8531
+ var RelocateResidueInputSchema = object({
8532
+ fromLocationId: string().min(1),
8533
+ /** Narrow to one logical class; omit for every profile on the location. */
8534
+ footageClass: RelocateFootageClassSchema.optional()
8535
+ });
8536
+ /** `null` = the archive could not answer (no ledger on this node, or the
8537
+ * aggregate failed). Never conflated with an empty source. */
8538
+ var RelocateResidueSchema = object({
8539
+ segments: number().int().nonnegative(),
8540
+ bytes: number().int().nonnegative()
8541
+ }).nullable();
8542
+ /** How many rows a media pass would still act on against a given target — the
8543
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8544
+ * never disagree. `null` = the count could not be taken. */
8545
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8546
+ var RelocatableMediaCountInputSchema = object({
8547
+ toLocationId: string().min(1),
8548
+ /** Omitted = `move`. */
8549
+ mode: MediaRelocateModeSchema.optional()
8550
+ });
8551
+ /**
8377
8552
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8378
8553
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8379
8554
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8477,6 +8652,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8477
8652
  * two addons declaring the same `id` must agree on `cardinality` (validated
8478
8653
  * at kernel aggregation time, not here).
8479
8654
  */
8655
+ /**
8656
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8657
+ * actually reaches the bytes. It is the constraint that decides which
8658
+ * `storage-provider`s may back a location of that kind.
8659
+ *
8660
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8661
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8662
+ * post-analysis media roots). Only a provider that serves a genuine local
8663
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8664
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8665
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8666
+ * against a same-named local directory that is something else entirely.
8667
+ *
8668
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8669
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8670
+ * service never sees a path, so any provider can back it. `backups` is the
8671
+ * one kind that qualifies today.
8672
+ *
8673
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8674
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8675
+ * refused the configuration; the first write simply went somewhere wrong, and
8676
+ * a recording write that goes wrong surfaces as a silent black window rather
8677
+ * than an error (the read path does not `stat`). This turns that accident into
8678
+ * a declared, enforced, testable refusal.
8679
+ */
8680
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8480
8681
  var StorageLocationDeclarationSchema = object({
8481
8682
  /**
8482
8683
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8496,6 +8697,19 @@ var StorageLocationDeclarationSchema = object({
8496
8697
  */
8497
8698
  cardinality: _enum(["single", "multi"]),
8498
8699
  /**
8700
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8701
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8702
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8703
+ *
8704
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8705
+ * can only over-restrict (refuse a remote provider for a kind that might
8706
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8707
+ * permissive direction and is therefore never inferred — a repo guard
8708
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8709
+ * reached by omission.
8710
+ */
8711
+ access: StorageAccessSchema.optional(),
8712
+ /**
8499
8713
  * When set, the default instance for this location inherits its resolved
8500
8714
  * root from the named location's default instance. Useful for derivative
8501
8715
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18448,8 +18662,10 @@ var TrackSchema = object({
18448
18662
  lastSeen: number(),
18449
18663
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18450
18664
  positions: array(TrackPositionSchema).readonly(),
18451
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18452
- * saveThumbnails policy). */
18665
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18666
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18667
+ * the retired `saveThumbnails` used to gate this and the rolling
18668
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18453
18669
  snapshots: array(TrackSnapshotSchema).readonly(),
18454
18670
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18455
18671
  zonesVisited: array(string()).readonly(),
@@ -19309,7 +19525,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19309
19525
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19310
19526
  kind: "mutation",
19311
19527
  auth: "admin"
19312
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19528
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19529
+ kind: "query",
19530
+ auth: "admin"
19531
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19313
19532
  kind: "query",
19314
19533
  auth: "admin"
19315
19534
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21268,6 +21487,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21268
21487
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21269
21488
  kind: "mutation",
21270
21489
  auth: "admin"
21490
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21491
+ kind: "mutation",
21492
+ auth: "admin"
21271
21493
  });
21272
21494
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21273
21495
  providerId: string().min(1),
@@ -21666,12 +21888,38 @@ response: record(string(), unknown()) }), object({
21666
21888
  *
21667
21889
  * ## Why this is a capability and not a helper
21668
21890
  *
21669
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21670
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21671
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21672
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21673
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21674
- * load 5,000 rows before ranking anything.
21891
+ * This capability was introduced with the claim that SIX stores in
21892
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21893
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21894
+ * claim was never true, and leaving it here made five stores look like pending
21895
+ * work when three of them have no vector at all. Counted column by column on
21896
+ * 2026-08-30, exactly THREE ever held one:
21897
+ *
21898
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21899
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21900
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21901
+ * face, migrated 2026-08-30 into its OWN index (see below).
21902
+ *
21903
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21904
+ * and `identities` store a name; the event store stores no derivative vector.
21905
+ * They are not migration candidates and never were.
21906
+ *
21907
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21908
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21909
+ * rows before ranking anything.
21910
+ *
21911
+ * ## One index per COMPARISON, never per encoder
21912
+ *
21913
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21914
+ * model, and they still get two indexes. An index is a set of things that are
21915
+ * ranked against each other and that live and die together, and these two are
21916
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21917
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21918
+ * forever and is the gallery every recognition ranks against. One index would
21919
+ * mean every gallery load and every reconcile carried a filter whose failure
21920
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21921
+ * person's only sample. The dimension they share is not a reason to share an
21922
+ * index; the question they answer is, and it differs.
21675
21923
  *
21676
21924
  * The fix is not a faster loop, it is a different backend — and the backend
21677
21925
  * should be replaceable without touching six callers. So: a singleton
@@ -21776,7 +22024,20 @@ var VectorQueryResultSchema = object({
21776
22024
  */
21777
22025
  scanned: number(),
21778
22026
  /** True when the backend could not consider every row that passed the filter. */
21779
- truncated: boolean()
22027
+ truncated: boolean(),
22028
+ /**
22029
+ * The `topK` the backend actually ran with.
22030
+ *
22031
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22032
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22033
+ * own log rather than in its answer. That is how an audit asking for 20,000
22034
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22035
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22036
+ * MUCH, in the return value, where the caller cannot fail to see it.
22037
+ *
22038
+ * Equals the requested `topK` whenever nothing was lowered.
22039
+ */
22040
+ effectiveTopK: number().int().positive()
21780
22041
  });
21781
22042
  var VectorDeleteInputSchema = object({
21782
22043
  index: string(),
@@ -21805,6 +22066,68 @@ var VectorGetResultSchema = object({ items: array(object({
21805
22066
  id: string(),
21806
22067
  metadata: VectorMetadataSchema
21807
22068
  })) });
22069
+ /**
22070
+ * Ids to read back WITH their vectors.
22071
+ *
22072
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22073
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22074
+ * caller depends on that promise. This one promises the opposite.
22075
+ *
22076
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22077
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22078
+ * a per-face cross-process KNN would be a network round trip inside the
22079
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22080
+ * it requires the index to hand the floats back. Without this method the only
22081
+ * way to keep a readable vector is a JSON column, which is the thing this
22082
+ * capability exists to delete.
22083
+ *
22084
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22085
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22086
+ */
22087
+ var VectorFetchInputSchema = object({
22088
+ index: string(),
22089
+ ids: array(string())
22090
+ });
22091
+ var VectorFetchResultSchema = object({ items: array(object({
22092
+ id: string(),
22093
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22094
+ vector: string(),
22095
+ metadata: VectorMetadataSchema
22096
+ })) });
22097
+ /**
22098
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22099
+ *
22100
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22101
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22102
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22103
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22104
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22105
+ * looked" for as long as anyone cared to read it.
22106
+ *
22107
+ * This is the primitive that question actually needs: a bounded page, ordered
22108
+ * by the backend's own row order, costing no distance computation at all.
22109
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22110
+ * the full-table read this capability was built to stop.
22111
+ */
22112
+ var VectorScanInputSchema = object({
22113
+ index: string(),
22114
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22115
+ cursor: number().int().nonnegative().default(0),
22116
+ limit: number().int().positive()
22117
+ });
22118
+ var VectorScanResultSchema = object({
22119
+ items: array(object({
22120
+ id: string(),
22121
+ metadata: VectorMetadataSchema
22122
+ })),
22123
+ /**
22124
+ * Where the next page starts, or `null` when the walk reached the end.
22125
+ *
22126
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22127
+ * from a short page: a backend is free to return fewer rows than asked.
22128
+ */
22129
+ nextCursor: number().int().nonnegative().nullable()
22130
+ });
21808
22131
  var VectorStatsInputSchema = object({ index: string() });
21809
22132
  var VectorStatsResultSchema = object({
21810
22133
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21823,7 +22146,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21823
22146
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21824
22147
  kind: "mutation",
21825
22148
  auth: "admin"
21826
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22149
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21827
22150
  kind: "mutation",
21828
22151
  auth: "admin"
21829
22152
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28459,6 +28782,9 @@ method(object({
28459
28782
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28460
28783
  kind: "query",
28461
28784
  auth: "admin"
28785
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28786
+ kind: "query",
28787
+ auth: "admin"
28462
28788
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28463
28789
  kind: "mutation",
28464
28790
  auth: "admin"
@@ -35093,6 +35419,12 @@ Object.freeze({
35093
35419
  addonId: null,
35094
35420
  access: "create"
35095
35421
  },
35422
+ "pipelineAnalytics.countRelocatableMedia": {
35423
+ capName: "pipeline-analytics",
35424
+ capScope: "device",
35425
+ addonId: null,
35426
+ access: "view"
35427
+ },
35096
35428
  "pipelineAnalytics.countUnstampedEventMedia": {
35097
35429
  capName: "pipeline-analytics",
35098
35430
  capScope: "device",
@@ -36257,6 +36589,12 @@ Object.freeze({
36257
36589
  addonId: null,
36258
36590
  access: "view"
36259
36591
  },
36592
+ "recording.getRelocateResidue": {
36593
+ capName: "recording",
36594
+ capScope: "system",
36595
+ addonId: null,
36596
+ access: "view"
36597
+ },
36260
36598
  "recording.getStorageMigrationMoveStatus": {
36261
36599
  capName: "recording",
36262
36600
  capScope: "system",
@@ -36803,12 +37141,30 @@ Object.freeze({
36803
37141
  addonId: null,
36804
37142
  access: "create"
36805
37143
  },
37144
+ "storageMigration.drain": {
37145
+ capName: "storage-migration",
37146
+ capScope: "system",
37147
+ addonId: null,
37148
+ access: "create"
37149
+ },
37150
+ "storageMigration.movers": {
37151
+ capName: "storage-migration",
37152
+ capScope: "system",
37153
+ addonId: null,
37154
+ access: "view"
37155
+ },
36806
37156
  "storageMigration.plan": {
36807
37157
  capName: "storage-migration",
36808
37158
  capScope: "system",
36809
37159
  addonId: null,
36810
37160
  access: "view"
36811
37161
  },
37162
+ "storageMigration.residue": {
37163
+ capName: "storage-migration",
37164
+ capScope: "system",
37165
+ addonId: null,
37166
+ access: "view"
37167
+ },
36812
37168
  "storageMigration.start": {
36813
37169
  capName: "storage-migration",
36814
37170
  capScope: "system",
@@ -37643,6 +37999,12 @@ Object.freeze({
37643
37999
  addonId: null,
37644
38000
  access: "delete"
37645
38001
  },
38002
+ "vectorStore.fetchByIds": {
38003
+ capName: "vector-store",
38004
+ capScope: "system",
38005
+ addonId: null,
38006
+ access: "view"
38007
+ },
37646
38008
  "vectorStore.getByIds": {
37647
38009
  capName: "vector-store",
37648
38010
  capScope: "system",
@@ -37655,6 +38017,12 @@ Object.freeze({
37655
38017
  addonId: null,
37656
38018
  access: "view"
37657
38019
  },
38020
+ "vectorStore.scan": {
38021
+ capName: "vector-store",
38022
+ capScope: "system",
38023
+ addonId: null,
38024
+ access: "view"
38025
+ },
37658
38026
  "vectorStore.stats": {
37659
38027
  capName: "vector-store",
37660
38028
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8161,6 +8161,21 @@ var RelocateJobSchema = object({
8161
8161
  bytesMoved: number().int(),
8162
8162
  /** Total files discovered up front; null while (or when) unknown. */
8163
8163
  filesTotal: number().int().nullable(),
8164
+ /**
8165
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8166
+ * made that nobody asked for, so it is reported where the operator reads the
8167
+ * job rather than only in a log line.
8168
+ *
8169
+ * A footage segment records its byte count in its own NAME, and the durable
8170
+ * hour row derives its aggregates from those names. A file that does not
8171
+ * match its name therefore makes the ledger's sums — and with them quota and
8172
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8173
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8174
+ *
8175
+ * Absent on lanes where the question has no meaning: a media blob's size is
8176
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8177
+ */
8178
+ rowsReconciled: number().int().nonnegative().optional(),
8164
8179
  startedAt: number(),
8165
8180
  finishedAt: number().nullable(),
8166
8181
  error: string().nullable()
@@ -8229,14 +8244,42 @@ var RelocateMediaInputSchema = object({
8229
8244
  /** Omitted = `move`, the pre-existing behaviour. */
8230
8245
  mode: MediaRelocateModeSchema.optional()
8231
8246
  });
8232
- /** How many rows still carry NO `locationId` — the population a repoint would
8233
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8234
- * value that permits a non-blocking `eventMedia` cutover. */
8235
- var UnstampedEventMediaCountSchema = object({
8236
- media: number().int().nonnegative(),
8237
- retrainFrames: number().int().nonnegative(),
8238
- total: number().int().nonnegative()
8247
+ /**
8248
+ * The unstamped population of ONE collection — split, because the gate and the
8249
+ * operator ask two different questions and only one of them has to be cheap.
8250
+ *
8251
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8252
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8253
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8254
+ * that matters — after a seal, when the population is empty.
8255
+ *
8256
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8257
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8258
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8259
+ * and useful answer: "there are some, and this read could not say how many"
8260
+ * still refuses the cutover, which is the whole job.
8261
+ */
8262
+ var UnstampedRowsSchema = object({
8263
+ present: boolean(),
8264
+ rows: number().int().nonnegative().nullable()
8239
8265
  });
8266
+ /**
8267
+ * How many rows still carry NO `locationId` — the population a repoint would
8268
+ * silently re-aim at a disk that does not hold their bytes.
8269
+ *
8270
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8271
+ * over. The gate opens on a measured absence and on nothing else; an unread
8272
+ * collection and an empty one are different facts, and this repo has already
8273
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8274
+ */
8275
+ var UnstampedEventMediaCountSchema = object({
8276
+ media: UnstampedRowsSchema,
8277
+ retrainFrames: UnstampedRowsSchema,
8278
+ /** True when EITHER collection holds one. The refusal reads this. */
8279
+ anyPresent: boolean(),
8280
+ /** Sum across both, or `null` when either lane could not be counted. */
8281
+ total: number().int().nonnegative().nullable()
8282
+ }).nullable();
8240
8283
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8241
8284
  /** The independently selectable logical storage classes — every class
8242
8285
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8322,13 +8365,53 @@ var StorageMigrationParticipantSchema = _enum([
8322
8365
  "recorder",
8323
8366
  "analytics"
8324
8367
  ]);
8368
+ /**
8369
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8370
+ *
8371
+ * The long half of a non-blocking migration is `draining`, and it is measured
8372
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8373
+ * existed the only place those numbers appeared was a Loki line, so an operator
8374
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8375
+ * afternoon.
8376
+ *
8377
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8378
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8379
+ * mover — which is the exact failure this is meant to end. The coordinator's
8380
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8381
+ * read `state`; folding the counters costs no extra read and makes the durable
8382
+ * record say afterwards how far a move actually got.
8383
+ *
8384
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8385
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8386
+ * cannot say M, and a 0 there would render as "100 % done".
8387
+ */
8388
+ var StorageMigrationMoveProgressSchema = object({
8389
+ filesMoved: number().int().nonnegative(),
8390
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8391
+ filesTotal: number().int().nonnegative().nullable(),
8392
+ bytesMoved: number().int().nonnegative(),
8393
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8394
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8395
+ * rows would be the same failure as one that silently skipped them. */
8396
+ rowsReconciled: number().int().nonnegative().optional(),
8397
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8398
+ * crash gets a new mover, and a rate computed from the migration's start
8399
+ * would silently average in the time nothing was running. */
8400
+ startedAt: number(),
8401
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8402
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8403
+ * subtract its own. */
8404
+ observedAt: number()
8405
+ });
8325
8406
  var StorageMigrationMoveSchema = object({
8326
8407
  storageClass: StorageMigrationClassSchema,
8327
8408
  fromLocationId: string(),
8328
8409
  toLocationId: string(),
8329
8410
  moverJobId: string().nullable(),
8330
8411
  state: RelocateJobStateSchema.nullable(),
8331
- error: string().nullable()
8412
+ error: string().nullable(),
8413
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8414
+ progress: StorageMigrationMoveProgressSchema.nullable()
8332
8415
  });
8333
8416
  var StorageMigrationJobSchema = object({
8334
8417
  jobId: string(),
@@ -8374,6 +8457,98 @@ var StorageMigrationPlanSchema = object({
8374
8457
  findings: array(StorageMigrationFindingSchema)
8375
8458
  });
8376
8459
  /**
8460
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8461
+ *
8462
+ * The coordinator's job record is the state of record for a migration, and its
8463
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8464
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8465
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8466
+ * way because no supported UI path existed. A mover armed like that has no job
8467
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8468
+ *
8469
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8470
+ * orchestrated it.
8471
+ */
8472
+ var StorageMigrationMoverSchema = object({
8473
+ lane: _enum(["footage", "media"]),
8474
+ job: RelocateJobSchema,
8475
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8476
+ * directly against the owning addon. */
8477
+ migrationJobId: string().nullable(),
8478
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8479
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8480
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8481
+ * rate made of two different clocks. */
8482
+ observedAt: number()
8483
+ });
8484
+ /**
8485
+ * What a SOURCE still holds for one storage class — the number that makes a
8486
+ * "drain remaining" action honest rather than hopeful.
8487
+ *
8488
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8489
+ * engine's own selection count for media), never from the resident index: a
8490
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8491
+ * never been told about (D295).
8492
+ *
8493
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8494
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8495
+ * because refusing on an unanswerable read would hide exactly the case an
8496
+ * operator needs to act on.
8497
+ */
8498
+ var StorageMigrationResidueSchema = object({
8499
+ storageClass: StorageMigrationClassSchema,
8500
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8501
+ * move from wherever they are rather than from one named source. */
8502
+ fromLocationId: string(),
8503
+ /** Where a drain would move it — the class's CURRENT default. */
8504
+ toLocationId: string(),
8505
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8506
+ items: number().int().nonnegative().nullable(),
8507
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8508
+ bytes: number().int().nonnegative().nullable()
8509
+ });
8510
+ /**
8511
+ * Run the DRAIN half and nothing else.
8512
+ *
8513
+ * A migration that reached `done` has already repointed, so `start` correctly
8514
+ * refuses its destination ("already the default") — there is nothing left to
8515
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8516
+ * or finish against a work list that was a tenth of the archive (D295), and
8517
+ * before this there was no supported way to run only that half: the only way
8518
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8519
+ *
8520
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8521
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8522
+ * re-repoint a class that is already migrated.
8523
+ */
8524
+ var StorageMigrationDrainInputSchema = object({
8525
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8526
+ * a class whose source is already empty is refused rather than started. */
8527
+ classes: array(StorageMigrationClassSchema).min(1),
8528
+ throttleMbps: number().min(1).max(1e3).optional()
8529
+ });
8530
+ /** What a footage source still holds, asked of the durable hour ledger. */
8531
+ var RelocateResidueInputSchema = object({
8532
+ fromLocationId: string().min(1),
8533
+ /** Narrow to one logical class; omit for every profile on the location. */
8534
+ footageClass: RelocateFootageClassSchema.optional()
8535
+ });
8536
+ /** `null` = the archive could not answer (no ledger on this node, or the
8537
+ * aggregate failed). Never conflated with an empty source. */
8538
+ var RelocateResidueSchema = object({
8539
+ segments: number().int().nonnegative(),
8540
+ bytes: number().int().nonnegative()
8541
+ }).nullable();
8542
+ /** How many rows a media pass would still act on against a given target — the
8543
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8544
+ * never disagree. `null` = the count could not be taken. */
8545
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8546
+ var RelocatableMediaCountInputSchema = object({
8547
+ toLocationId: string().min(1),
8548
+ /** Omitted = `move`. */
8549
+ mode: MediaRelocateModeSchema.optional()
8550
+ });
8551
+ /**
8377
8552
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8378
8553
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8379
8554
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8477,6 +8652,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8477
8652
  * two addons declaring the same `id` must agree on `cardinality` (validated
8478
8653
  * at kernel aggregation time, not here).
8479
8654
  */
8655
+ /**
8656
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8657
+ * actually reaches the bytes. It is the constraint that decides which
8658
+ * `storage-provider`s may back a location of that kind.
8659
+ *
8660
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8661
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8662
+ * post-analysis media roots). Only a provider that serves a genuine local
8663
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8664
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8665
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8666
+ * against a same-named local directory that is something else entirely.
8667
+ *
8668
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8669
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8670
+ * service never sees a path, so any provider can back it. `backups` is the
8671
+ * one kind that qualifies today.
8672
+ *
8673
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8674
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8675
+ * refused the configuration; the first write simply went somewhere wrong, and
8676
+ * a recording write that goes wrong surfaces as a silent black window rather
8677
+ * than an error (the read path does not `stat`). This turns that accident into
8678
+ * a declared, enforced, testable refusal.
8679
+ */
8680
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8480
8681
  var StorageLocationDeclarationSchema = object({
8481
8682
  /**
8482
8683
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8496,6 +8697,19 @@ var StorageLocationDeclarationSchema = object({
8496
8697
  */
8497
8698
  cardinality: _enum(["single", "multi"]),
8498
8699
  /**
8700
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8701
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8702
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8703
+ *
8704
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8705
+ * can only over-restrict (refuse a remote provider for a kind that might
8706
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8707
+ * permissive direction and is therefore never inferred — a repo guard
8708
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8709
+ * reached by omission.
8710
+ */
8711
+ access: StorageAccessSchema.optional(),
8712
+ /**
8499
8713
  * When set, the default instance for this location inherits its resolved
8500
8714
  * root from the named location's default instance. Useful for derivative
8501
8715
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18448,8 +18662,10 @@ var TrackSchema = object({
18448
18662
  lastSeen: number(),
18449
18663
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18450
18664
  positions: array(TrackPositionSchema).readonly(),
18451
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18452
- * saveThumbnails policy). */
18665
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18666
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18667
+ * the retired `saveThumbnails` used to gate this and the rolling
18668
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18453
18669
  snapshots: array(TrackSnapshotSchema).readonly(),
18454
18670
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18455
18671
  zonesVisited: array(string()).readonly(),
@@ -19309,7 +19525,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19309
19525
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19310
19526
  kind: "mutation",
19311
19527
  auth: "admin"
19312
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19528
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19529
+ kind: "query",
19530
+ auth: "admin"
19531
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19313
19532
  kind: "query",
19314
19533
  auth: "admin"
19315
19534
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21268,6 +21487,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21268
21487
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21269
21488
  kind: "mutation",
21270
21489
  auth: "admin"
21490
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21491
+ kind: "mutation",
21492
+ auth: "admin"
21271
21493
  });
21272
21494
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21273
21495
  providerId: string().min(1),
@@ -21666,12 +21888,38 @@ response: record(string(), unknown()) }), object({
21666
21888
  *
21667
21889
  * ## Why this is a capability and not a helper
21668
21890
  *
21669
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21670
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21671
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21672
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21673
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21674
- * load 5,000 rows before ranking anything.
21891
+ * This capability was introduced with the claim that SIX stores in
21892
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21893
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21894
+ * claim was never true, and leaving it here made five stores look like pending
21895
+ * work when three of them have no vector at all. Counted column by column on
21896
+ * 2026-08-30, exactly THREE ever held one:
21897
+ *
21898
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21899
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21900
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21901
+ * face, migrated 2026-08-30 into its OWN index (see below).
21902
+ *
21903
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21904
+ * and `identities` store a name; the event store stores no derivative vector.
21905
+ * They are not migration candidates and never were.
21906
+ *
21907
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21908
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21909
+ * rows before ranking anything.
21910
+ *
21911
+ * ## One index per COMPARISON, never per encoder
21912
+ *
21913
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21914
+ * model, and they still get two indexes. An index is a set of things that are
21915
+ * ranked against each other and that live and die together, and these two are
21916
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21917
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21918
+ * forever and is the gallery every recognition ranks against. One index would
21919
+ * mean every gallery load and every reconcile carried a filter whose failure
21920
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21921
+ * person's only sample. The dimension they share is not a reason to share an
21922
+ * index; the question they answer is, and it differs.
21675
21923
  *
21676
21924
  * The fix is not a faster loop, it is a different backend — and the backend
21677
21925
  * should be replaceable without touching six callers. So: a singleton
@@ -21776,7 +22024,20 @@ var VectorQueryResultSchema = object({
21776
22024
  */
21777
22025
  scanned: number(),
21778
22026
  /** True when the backend could not consider every row that passed the filter. */
21779
- truncated: boolean()
22027
+ truncated: boolean(),
22028
+ /**
22029
+ * The `topK` the backend actually ran with.
22030
+ *
22031
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
22032
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
22033
+ * own log rather than in its answer. That is how an audit asking for 20,000
22034
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
22035
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
22036
+ * MUCH, in the return value, where the caller cannot fail to see it.
22037
+ *
22038
+ * Equals the requested `topK` whenever nothing was lowered.
22039
+ */
22040
+ effectiveTopK: number().int().positive()
21780
22041
  });
21781
22042
  var VectorDeleteInputSchema = object({
21782
22043
  index: string(),
@@ -21805,6 +22066,68 @@ var VectorGetResultSchema = object({ items: array(object({
21805
22066
  id: string(),
21806
22067
  metadata: VectorMetadataSchema
21807
22068
  })) });
22069
+ /**
22070
+ * Ids to read back WITH their vectors.
22071
+ *
22072
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22073
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22074
+ * caller depends on that promise. This one promises the opposite.
22075
+ *
22076
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22077
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22078
+ * a per-face cross-process KNN would be a network round trip inside the
22079
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22080
+ * it requires the index to hand the floats back. Without this method the only
22081
+ * way to keep a readable vector is a JSON column, which is the thing this
22082
+ * capability exists to delete.
22083
+ *
22084
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22085
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22086
+ */
22087
+ var VectorFetchInputSchema = object({
22088
+ index: string(),
22089
+ ids: array(string())
22090
+ });
22091
+ var VectorFetchResultSchema = object({ items: array(object({
22092
+ id: string(),
22093
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22094
+ vector: string(),
22095
+ metadata: VectorMetadataSchema
22096
+ })) });
22097
+ /**
22098
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22099
+ *
22100
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22101
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22102
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22103
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22104
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22105
+ * looked" for as long as anyone cared to read it.
22106
+ *
22107
+ * This is the primitive that question actually needs: a bounded page, ordered
22108
+ * by the backend's own row order, costing no distance computation at all.
22109
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22110
+ * the full-table read this capability was built to stop.
22111
+ */
22112
+ var VectorScanInputSchema = object({
22113
+ index: string(),
22114
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22115
+ cursor: number().int().nonnegative().default(0),
22116
+ limit: number().int().positive()
22117
+ });
22118
+ var VectorScanResultSchema = object({
22119
+ items: array(object({
22120
+ id: string(),
22121
+ metadata: VectorMetadataSchema
22122
+ })),
22123
+ /**
22124
+ * Where the next page starts, or `null` when the walk reached the end.
22125
+ *
22126
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22127
+ * from a short page: a backend is free to return fewer rows than asked.
22128
+ */
22129
+ nextCursor: number().int().nonnegative().nullable()
22130
+ });
21808
22131
  var VectorStatsInputSchema = object({ index: string() });
21809
22132
  var VectorStatsResultSchema = object({
21810
22133
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21823,7 +22146,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21823
22146
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21824
22147
  kind: "mutation",
21825
22148
  auth: "admin"
21826
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22149
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21827
22150
  kind: "mutation",
21828
22151
  auth: "admin"
21829
22152
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28459,6 +28782,9 @@ method(object({
28459
28782
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28460
28783
  kind: "query",
28461
28784
  auth: "admin"
28785
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28786
+ kind: "query",
28787
+ auth: "admin"
28462
28788
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28463
28789
  kind: "mutation",
28464
28790
  auth: "admin"
@@ -35093,6 +35419,12 @@ Object.freeze({
35093
35419
  addonId: null,
35094
35420
  access: "create"
35095
35421
  },
35422
+ "pipelineAnalytics.countRelocatableMedia": {
35423
+ capName: "pipeline-analytics",
35424
+ capScope: "device",
35425
+ addonId: null,
35426
+ access: "view"
35427
+ },
35096
35428
  "pipelineAnalytics.countUnstampedEventMedia": {
35097
35429
  capName: "pipeline-analytics",
35098
35430
  capScope: "device",
@@ -36257,6 +36589,12 @@ Object.freeze({
36257
36589
  addonId: null,
36258
36590
  access: "view"
36259
36591
  },
36592
+ "recording.getRelocateResidue": {
36593
+ capName: "recording",
36594
+ capScope: "system",
36595
+ addonId: null,
36596
+ access: "view"
36597
+ },
36260
36598
  "recording.getStorageMigrationMoveStatus": {
36261
36599
  capName: "recording",
36262
36600
  capScope: "system",
@@ -36803,12 +37141,30 @@ Object.freeze({
36803
37141
  addonId: null,
36804
37142
  access: "create"
36805
37143
  },
37144
+ "storageMigration.drain": {
37145
+ capName: "storage-migration",
37146
+ capScope: "system",
37147
+ addonId: null,
37148
+ access: "create"
37149
+ },
37150
+ "storageMigration.movers": {
37151
+ capName: "storage-migration",
37152
+ capScope: "system",
37153
+ addonId: null,
37154
+ access: "view"
37155
+ },
36806
37156
  "storageMigration.plan": {
36807
37157
  capName: "storage-migration",
36808
37158
  capScope: "system",
36809
37159
  addonId: null,
36810
37160
  access: "view"
36811
37161
  },
37162
+ "storageMigration.residue": {
37163
+ capName: "storage-migration",
37164
+ capScope: "system",
37165
+ addonId: null,
37166
+ access: "view"
37167
+ },
36812
37168
  "storageMigration.start": {
36813
37169
  capName: "storage-migration",
36814
37170
  capScope: "system",
@@ -37643,6 +37999,12 @@ Object.freeze({
37643
37999
  addonId: null,
37644
38000
  access: "delete"
37645
38001
  },
38002
+ "vectorStore.fetchByIds": {
38003
+ capName: "vector-store",
38004
+ capScope: "system",
38005
+ addonId: null,
38006
+ access: "view"
38007
+ },
37646
38008
  "vectorStore.getByIds": {
37647
38009
  capName: "vector-store",
37648
38010
  capScope: "system",
@@ -37655,6 +38017,12 @@ Object.freeze({
37655
38017
  addonId: null,
37656
38018
  access: "view"
37657
38019
  },
38020
+ "vectorStore.scan": {
38021
+ capName: "vector-store",
38022
+ capScope: "system",
38023
+ addonId: null,
38024
+ access: "view"
38025
+ },
37658
38026
  "vectorStore.stats": {
37659
38027
  capName: "vector-store",
37660
38028
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-import-alexa",
3
- "version": "0.2.42",
3
+ "version": "0.2.45",
4
4
  "description": "Alexa device-import provider for CamStack — imports the smart-home devices in a user's Alexa account via the unofficial alexa-remote2 cookie/token client (the inverse of the Alexa exporter)",
5
5
  "keywords": [
6
6
  "camstack",