@camstack/addon-terminal 0.1.48 → 0.1.51

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
@@ -8102,6 +8102,21 @@ var RelocateJobSchema = object({
8102
8102
  bytesMoved: number().int(),
8103
8103
  /** Total files discovered up front; null while (or when) unknown. */
8104
8104
  filesTotal: number().int().nullable(),
8105
+ /**
8106
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8107
+ * made that nobody asked for, so it is reported where the operator reads the
8108
+ * job rather than only in a log line.
8109
+ *
8110
+ * A footage segment records its byte count in its own NAME, and the durable
8111
+ * hour row derives its aggregates from those names. A file that does not
8112
+ * match its name therefore makes the ledger's sums — and with them quota and
8113
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8114
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8115
+ *
8116
+ * Absent on lanes where the question has no meaning: a media blob's size is
8117
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8118
+ */
8119
+ rowsReconciled: number().int().nonnegative().optional(),
8105
8120
  startedAt: number(),
8106
8121
  finishedAt: number().nullable(),
8107
8122
  error: string().nullable()
@@ -8170,14 +8185,42 @@ var RelocateMediaInputSchema = object({
8170
8185
  /** Omitted = `move`, the pre-existing behaviour. */
8171
8186
  mode: MediaRelocateModeSchema.optional()
8172
8187
  });
8173
- /** How many rows still carry NO `locationId` — the population a repoint would
8174
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8175
- * value that permits a non-blocking `eventMedia` cutover. */
8176
- var UnstampedEventMediaCountSchema = object({
8177
- media: number().int().nonnegative(),
8178
- retrainFrames: number().int().nonnegative(),
8179
- total: number().int().nonnegative()
8188
+ /**
8189
+ * The unstamped population of ONE collection split, because the gate and the
8190
+ * operator ask two different questions and only one of them has to be cheap.
8191
+ *
8192
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8193
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8194
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8195
+ * that matters — after a seal, when the population is empty.
8196
+ *
8197
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8198
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8199
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8200
+ * and useful answer: "there are some, and this read could not say how many"
8201
+ * still refuses the cutover, which is the whole job.
8202
+ */
8203
+ var UnstampedRowsSchema = object({
8204
+ present: boolean(),
8205
+ rows: number().int().nonnegative().nullable()
8180
8206
  });
8207
+ /**
8208
+ * How many rows still carry NO `locationId` — the population a repoint would
8209
+ * silently re-aim at a disk that does not hold their bytes.
8210
+ *
8211
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8212
+ * over. The gate opens on a measured absence and on nothing else; an unread
8213
+ * collection and an empty one are different facts, and this repo has already
8214
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8215
+ */
8216
+ var UnstampedEventMediaCountSchema = object({
8217
+ media: UnstampedRowsSchema,
8218
+ retrainFrames: UnstampedRowsSchema,
8219
+ /** True when EITHER collection holds one. The refusal reads this. */
8220
+ anyPresent: boolean(),
8221
+ /** Sum across both, or `null` when either lane could not be counted. */
8222
+ total: number().int().nonnegative().nullable()
8223
+ }).nullable();
8181
8224
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8182
8225
  /** The independently selectable logical storage classes — every class
8183
8226
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8263,13 +8306,53 @@ var StorageMigrationParticipantSchema = _enum([
8263
8306
  "recorder",
8264
8307
  "analytics"
8265
8308
  ]);
8309
+ /**
8310
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8311
+ *
8312
+ * The long half of a non-blocking migration is `draining`, and it is measured
8313
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8314
+ * existed the only place those numbers appeared was a Loki line, so an operator
8315
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8316
+ * afternoon.
8317
+ *
8318
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8319
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8320
+ * mover — which is the exact failure this is meant to end. The coordinator's
8321
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8322
+ * read `state`; folding the counters costs no extra read and makes the durable
8323
+ * record say afterwards how far a move actually got.
8324
+ *
8325
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8326
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8327
+ * cannot say M, and a 0 there would render as "100 % done".
8328
+ */
8329
+ var StorageMigrationMoveProgressSchema = object({
8330
+ filesMoved: number().int().nonnegative(),
8331
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8332
+ filesTotal: number().int().nonnegative().nullable(),
8333
+ bytesMoved: number().int().nonnegative(),
8334
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8335
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8336
+ * rows would be the same failure as one that silently skipped them. */
8337
+ rowsReconciled: number().int().nonnegative().optional(),
8338
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8339
+ * crash gets a new mover, and a rate computed from the migration's start
8340
+ * would silently average in the time nothing was running. */
8341
+ startedAt: number(),
8342
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8343
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8344
+ * subtract its own. */
8345
+ observedAt: number()
8346
+ });
8266
8347
  var StorageMigrationMoveSchema = object({
8267
8348
  storageClass: StorageMigrationClassSchema,
8268
8349
  fromLocationId: string(),
8269
8350
  toLocationId: string(),
8270
8351
  moverJobId: string().nullable(),
8271
8352
  state: RelocateJobStateSchema.nullable(),
8272
- error: string().nullable()
8353
+ error: string().nullable(),
8354
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8355
+ progress: StorageMigrationMoveProgressSchema.nullable()
8273
8356
  });
8274
8357
  var StorageMigrationJobSchema = object({
8275
8358
  jobId: string(),
@@ -8315,6 +8398,98 @@ var StorageMigrationPlanSchema = object({
8315
8398
  findings: array(StorageMigrationFindingSchema)
8316
8399
  });
8317
8400
  /**
8401
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8402
+ *
8403
+ * The coordinator's job record is the state of record for a migration, and its
8404
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8405
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8406
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8407
+ * way because no supported UI path existed. A mover armed like that has no job
8408
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8409
+ *
8410
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8411
+ * orchestrated it.
8412
+ */
8413
+ var StorageMigrationMoverSchema = object({
8414
+ lane: _enum(["footage", "media"]),
8415
+ job: RelocateJobSchema,
8416
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8417
+ * directly against the owning addon. */
8418
+ migrationJobId: string().nullable(),
8419
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8420
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8421
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8422
+ * rate made of two different clocks. */
8423
+ observedAt: number()
8424
+ });
8425
+ /**
8426
+ * What a SOURCE still holds for one storage class — the number that makes a
8427
+ * "drain remaining" action honest rather than hopeful.
8428
+ *
8429
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8430
+ * engine's own selection count for media), never from the resident index: a
8431
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8432
+ * never been told about (D295).
8433
+ *
8434
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8435
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8436
+ * because refusing on an unanswerable read would hide exactly the case an
8437
+ * operator needs to act on.
8438
+ */
8439
+ var StorageMigrationResidueSchema = object({
8440
+ storageClass: StorageMigrationClassSchema,
8441
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8442
+ * move from wherever they are rather than from one named source. */
8443
+ fromLocationId: string(),
8444
+ /** Where a drain would move it — the class's CURRENT default. */
8445
+ toLocationId: string(),
8446
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8447
+ items: number().int().nonnegative().nullable(),
8448
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8449
+ bytes: number().int().nonnegative().nullable()
8450
+ });
8451
+ /**
8452
+ * Run the DRAIN half and nothing else.
8453
+ *
8454
+ * A migration that reached `done` has already repointed, so `start` correctly
8455
+ * refuses its destination ("already the default") — there is nothing left to
8456
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8457
+ * or finish against a work list that was a tenth of the archive (D295), and
8458
+ * before this there was no supported way to run only that half: the only way
8459
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8460
+ *
8461
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8462
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8463
+ * re-repoint a class that is already migrated.
8464
+ */
8465
+ var StorageMigrationDrainInputSchema = object({
8466
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8467
+ * a class whose source is already empty is refused rather than started. */
8468
+ classes: array(StorageMigrationClassSchema).min(1),
8469
+ throttleMbps: number().min(1).max(1e3).optional()
8470
+ });
8471
+ /** What a footage source still holds, asked of the durable hour ledger. */
8472
+ var RelocateResidueInputSchema = object({
8473
+ fromLocationId: string().min(1),
8474
+ /** Narrow to one logical class; omit for every profile on the location. */
8475
+ footageClass: RelocateFootageClassSchema.optional()
8476
+ });
8477
+ /** `null` = the archive could not answer (no ledger on this node, or the
8478
+ * aggregate failed). Never conflated with an empty source. */
8479
+ var RelocateResidueSchema = object({
8480
+ segments: number().int().nonnegative(),
8481
+ bytes: number().int().nonnegative()
8482
+ }).nullable();
8483
+ /** How many rows a media pass would still act on against a given target — the
8484
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8485
+ * never disagree. `null` = the count could not be taken. */
8486
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8487
+ var RelocatableMediaCountInputSchema = object({
8488
+ toLocationId: string().min(1),
8489
+ /** Omitted = `move`. */
8490
+ mode: MediaRelocateModeSchema.optional()
8491
+ });
8492
+ /**
8318
8493
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8319
8494
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8320
8495
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8418,6 +8593,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8418
8593
  * two addons declaring the same `id` must agree on `cardinality` (validated
8419
8594
  * at kernel aggregation time, not here).
8420
8595
  */
8596
+ /**
8597
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8598
+ * actually reaches the bytes. It is the constraint that decides which
8599
+ * `storage-provider`s may back a location of that kind.
8600
+ *
8601
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8602
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8603
+ * post-analysis media roots). Only a provider that serves a genuine local
8604
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8605
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8606
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8607
+ * against a same-named local directory that is something else entirely.
8608
+ *
8609
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8610
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8611
+ * service never sees a path, so any provider can back it. `backups` is the
8612
+ * one kind that qualifies today.
8613
+ *
8614
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8615
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8616
+ * refused the configuration; the first write simply went somewhere wrong, and
8617
+ * a recording write that goes wrong surfaces as a silent black window rather
8618
+ * than an error (the read path does not `stat`). This turns that accident into
8619
+ * a declared, enforced, testable refusal.
8620
+ */
8621
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8421
8622
  var StorageLocationDeclarationSchema = object({
8422
8623
  /**
8423
8624
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8437,6 +8638,19 @@ var StorageLocationDeclarationSchema = object({
8437
8638
  */
8438
8639
  cardinality: _enum(["single", "multi"]),
8439
8640
  /**
8641
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8642
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8643
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8644
+ *
8645
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8646
+ * can only over-restrict (refuse a remote provider for a kind that might
8647
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8648
+ * permissive direction and is therefore never inferred — a repo guard
8649
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8650
+ * reached by omission.
8651
+ */
8652
+ access: StorageAccessSchema.optional(),
8653
+ /**
8440
8654
  * When set, the default instance for this location inherits its resolved
8441
8655
  * root from the named location's default instance. Useful for derivative
8442
8656
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18249,8 +18463,10 @@ var TrackSchema = object({
18249
18463
  lastSeen: number(),
18250
18464
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18251
18465
  positions: array(TrackPositionSchema).readonly(),
18252
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18253
- * saveThumbnails policy). */
18466
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18467
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18468
+ * the retired `saveThumbnails` used to gate this and the rolling
18469
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18254
18470
  snapshots: array(TrackSnapshotSchema).readonly(),
18255
18471
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18256
18472
  zonesVisited: array(string()).readonly(),
@@ -19110,7 +19326,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19110
19326
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19111
19327
  kind: "mutation",
19112
19328
  auth: "admin"
19113
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19329
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19330
+ kind: "query",
19331
+ auth: "admin"
19332
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19114
19333
  kind: "query",
19115
19334
  auth: "admin"
19116
19335
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21173,6 +21392,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21173
21392
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21174
21393
  kind: "mutation",
21175
21394
  auth: "admin"
21395
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21396
+ kind: "mutation",
21397
+ auth: "admin"
21176
21398
  });
21177
21399
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21178
21400
  providerId: string().min(1),
@@ -21615,12 +21837,38 @@ response: record(string(), unknown()) }), object({
21615
21837
  *
21616
21838
  * ## Why this is a capability and not a helper
21617
21839
  *
21618
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21619
- * plate, vehicle, identity, and the event store's derivativesand every one of
21620
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21621
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21622
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21623
- * load 5,000 rows before ranking anything.
21840
+ * This capability was introduced with the claim that SIX stores in
21841
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21842
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21843
+ * claim was never true, and leaving it here made five stores look like pending
21844
+ * work when three of them have no vector at all. Counted column by column on
21845
+ * 2026-08-30, exactly THREE ever held one:
21846
+ *
21847
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21848
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21849
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21850
+ * face, migrated 2026-08-30 into its OWN index (see below).
21851
+ *
21852
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21853
+ * and `identities` store a name; the event store stores no derivative vector.
21854
+ * They are not migration candidates and never were.
21855
+ *
21856
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21857
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21858
+ * rows before ranking anything.
21859
+ *
21860
+ * ## One index per COMPARISON, never per encoder
21861
+ *
21862
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21863
+ * model, and they still get two indexes. An index is a set of things that are
21864
+ * ranked against each other and that live and die together, and these two are
21865
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21866
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21867
+ * forever and is the gallery every recognition ranks against. One index would
21868
+ * mean every gallery load and every reconcile carried a filter whose failure
21869
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21870
+ * person's only sample. The dimension they share is not a reason to share an
21871
+ * index; the question they answer is, and it differs.
21624
21872
  *
21625
21873
  * The fix is not a faster loop, it is a different backend — and the backend
21626
21874
  * should be replaceable without touching six callers. So: a singleton
@@ -21725,7 +21973,20 @@ var VectorQueryResultSchema = object({
21725
21973
  */
21726
21974
  scanned: number(),
21727
21975
  /** True when the backend could not consider every row that passed the filter. */
21728
- truncated: boolean()
21976
+ truncated: boolean(),
21977
+ /**
21978
+ * The `topK` the backend actually ran with.
21979
+ *
21980
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21981
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21982
+ * own log rather than in its answer. That is how an audit asking for 20,000
21983
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21984
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21985
+ * MUCH, in the return value, where the caller cannot fail to see it.
21986
+ *
21987
+ * Equals the requested `topK` whenever nothing was lowered.
21988
+ */
21989
+ effectiveTopK: number().int().positive()
21729
21990
  });
21730
21991
  var VectorDeleteInputSchema = object({
21731
21992
  index: string(),
@@ -21754,6 +22015,68 @@ var VectorGetResultSchema = object({ items: array(object({
21754
22015
  id: string(),
21755
22016
  metadata: VectorMetadataSchema
21756
22017
  })) });
22018
+ /**
22019
+ * Ids to read back WITH their vectors.
22020
+ *
22021
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
22022
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22023
+ * caller depends on that promise. This one promises the opposite.
22024
+ *
22025
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22026
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22027
+ * a per-face cross-process KNN would be a network round trip inside the
22028
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22029
+ * it requires the index to hand the floats back. Without this method the only
22030
+ * way to keep a readable vector is a JSON column, which is the thing this
22031
+ * capability exists to delete.
22032
+ *
22033
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22034
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22035
+ */
22036
+ var VectorFetchInputSchema = object({
22037
+ index: string(),
22038
+ ids: array(string())
22039
+ });
22040
+ var VectorFetchResultSchema = object({ items: array(object({
22041
+ id: string(),
22042
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22043
+ vector: string(),
22044
+ metadata: VectorMetadataSchema
22045
+ })) });
22046
+ /**
22047
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22048
+ *
22049
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22050
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22051
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22052
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22053
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22054
+ * looked" for as long as anyone cared to read it.
22055
+ *
22056
+ * This is the primitive that question actually needs: a bounded page, ordered
22057
+ * by the backend's own row order, costing no distance computation at all.
22058
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22059
+ * the full-table read this capability was built to stop.
22060
+ */
22061
+ var VectorScanInputSchema = object({
22062
+ index: string(),
22063
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22064
+ cursor: number().int().nonnegative().default(0),
22065
+ limit: number().int().positive()
22066
+ });
22067
+ var VectorScanResultSchema = object({
22068
+ items: array(object({
22069
+ id: string(),
22070
+ metadata: VectorMetadataSchema
22071
+ })),
22072
+ /**
22073
+ * Where the next page starts, or `null` when the walk reached the end.
22074
+ *
22075
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22076
+ * from a short page: a backend is free to return fewer rows than asked.
22077
+ */
22078
+ nextCursor: number().int().nonnegative().nullable()
22079
+ });
21757
22080
  var VectorStatsInputSchema = object({ index: string() });
21758
22081
  var VectorStatsResultSchema = object({
21759
22082
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21772,7 +22095,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21772
22095
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21773
22096
  kind: "mutation",
21774
22097
  auth: "admin"
21775
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22098
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21776
22099
  kind: "mutation",
21777
22100
  auth: "admin"
21778
22101
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28391,6 +28714,9 @@ method(object({
28391
28714
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28392
28715
  kind: "query",
28393
28716
  auth: "admin"
28717
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28718
+ kind: "query",
28719
+ auth: "admin"
28394
28720
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28395
28721
  kind: "mutation",
28396
28722
  auth: "admin"
@@ -35023,6 +35349,12 @@ Object.freeze({
35023
35349
  addonId: null,
35024
35350
  access: "create"
35025
35351
  },
35352
+ "pipelineAnalytics.countRelocatableMedia": {
35353
+ capName: "pipeline-analytics",
35354
+ capScope: "device",
35355
+ addonId: null,
35356
+ access: "view"
35357
+ },
35026
35358
  "pipelineAnalytics.countUnstampedEventMedia": {
35027
35359
  capName: "pipeline-analytics",
35028
35360
  capScope: "device",
@@ -36187,6 +36519,12 @@ Object.freeze({
36187
36519
  addonId: null,
36188
36520
  access: "view"
36189
36521
  },
36522
+ "recording.getRelocateResidue": {
36523
+ capName: "recording",
36524
+ capScope: "system",
36525
+ addonId: null,
36526
+ access: "view"
36527
+ },
36190
36528
  "recording.getStorageMigrationMoveStatus": {
36191
36529
  capName: "recording",
36192
36530
  capScope: "system",
@@ -36733,12 +37071,30 @@ Object.freeze({
36733
37071
  addonId: null,
36734
37072
  access: "create"
36735
37073
  },
37074
+ "storageMigration.drain": {
37075
+ capName: "storage-migration",
37076
+ capScope: "system",
37077
+ addonId: null,
37078
+ access: "create"
37079
+ },
37080
+ "storageMigration.movers": {
37081
+ capName: "storage-migration",
37082
+ capScope: "system",
37083
+ addonId: null,
37084
+ access: "view"
37085
+ },
36736
37086
  "storageMigration.plan": {
36737
37087
  capName: "storage-migration",
36738
37088
  capScope: "system",
36739
37089
  addonId: null,
36740
37090
  access: "view"
36741
37091
  },
37092
+ "storageMigration.residue": {
37093
+ capName: "storage-migration",
37094
+ capScope: "system",
37095
+ addonId: null,
37096
+ access: "view"
37097
+ },
36742
37098
  "storageMigration.start": {
36743
37099
  capName: "storage-migration",
36744
37100
  capScope: "system",
@@ -37573,6 +37929,12 @@ Object.freeze({
37573
37929
  addonId: null,
37574
37930
  access: "delete"
37575
37931
  },
37932
+ "vectorStore.fetchByIds": {
37933
+ capName: "vector-store",
37934
+ capScope: "system",
37935
+ addonId: null,
37936
+ access: "view"
37937
+ },
37576
37938
  "vectorStore.getByIds": {
37577
37939
  capName: "vector-store",
37578
37940
  capScope: "system",
@@ -37585,6 +37947,12 @@ Object.freeze({
37585
37947
  addonId: null,
37586
37948
  access: "view"
37587
37949
  },
37950
+ "vectorStore.scan": {
37951
+ capName: "vector-store",
37952
+ capScope: "system",
37953
+ addonId: null,
37954
+ access: "view"
37955
+ },
37588
37956
  "vectorStore.stats": {
37589
37957
  capName: "vector-store",
37590
37958
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -8079,6 +8079,21 @@ var RelocateJobSchema = object({
8079
8079
  bytesMoved: number().int(),
8080
8080
  /** Total files discovered up front; null while (or when) unknown. */
8081
8081
  filesTotal: number().int().nullable(),
8082
+ /**
8083
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8084
+ * made that nobody asked for, so it is reported where the operator reads the
8085
+ * job rather than only in a log line.
8086
+ *
8087
+ * A footage segment records its byte count in its own NAME, and the durable
8088
+ * hour row derives its aggregates from those names. A file that does not
8089
+ * match its name therefore makes the ledger's sums — and with them quota and
8090
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8091
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8092
+ *
8093
+ * Absent on lanes where the question has no meaning: a media blob's size is
8094
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8095
+ */
8096
+ rowsReconciled: number().int().nonnegative().optional(),
8082
8097
  startedAt: number(),
8083
8098
  finishedAt: number().nullable(),
8084
8099
  error: string().nullable()
@@ -8147,14 +8162,42 @@ var RelocateMediaInputSchema = object({
8147
8162
  /** Omitted = `move`, the pre-existing behaviour. */
8148
8163
  mode: MediaRelocateModeSchema.optional()
8149
8164
  });
8150
- /** How many rows still carry NO `locationId` — the population a repoint would
8151
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8152
- * value that permits a non-blocking `eventMedia` cutover. */
8153
- var UnstampedEventMediaCountSchema = object({
8154
- media: number().int().nonnegative(),
8155
- retrainFrames: number().int().nonnegative(),
8156
- total: number().int().nonnegative()
8165
+ /**
8166
+ * The unstamped population of ONE collection split, because the gate and the
8167
+ * operator ask two different questions and only one of them has to be cheap.
8168
+ *
8169
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8170
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8171
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8172
+ * that matters — after a seal, when the population is empty.
8173
+ *
8174
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8175
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8176
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8177
+ * and useful answer: "there are some, and this read could not say how many"
8178
+ * still refuses the cutover, which is the whole job.
8179
+ */
8180
+ var UnstampedRowsSchema = object({
8181
+ present: boolean(),
8182
+ rows: number().int().nonnegative().nullable()
8157
8183
  });
8184
+ /**
8185
+ * How many rows still carry NO `locationId` — the population a repoint would
8186
+ * silently re-aim at a disk that does not hold their bytes.
8187
+ *
8188
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8189
+ * over. The gate opens on a measured absence and on nothing else; an unread
8190
+ * collection and an empty one are different facts, and this repo has already
8191
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8192
+ */
8193
+ var UnstampedEventMediaCountSchema = object({
8194
+ media: UnstampedRowsSchema,
8195
+ retrainFrames: UnstampedRowsSchema,
8196
+ /** True when EITHER collection holds one. The refusal reads this. */
8197
+ anyPresent: boolean(),
8198
+ /** Sum across both, or `null` when either lane could not be counted. */
8199
+ total: number().int().nonnegative().nullable()
8200
+ }).nullable();
8158
8201
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8159
8202
  /** The independently selectable logical storage classes — every class
8160
8203
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8240,13 +8283,53 @@ var StorageMigrationParticipantSchema = _enum([
8240
8283
  "recorder",
8241
8284
  "analytics"
8242
8285
  ]);
8286
+ /**
8287
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8288
+ *
8289
+ * The long half of a non-blocking migration is `draining`, and it is measured
8290
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8291
+ * existed the only place those numbers appeared was a Loki line, so an operator
8292
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8293
+ * afternoon.
8294
+ *
8295
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8296
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8297
+ * mover — which is the exact failure this is meant to end. The coordinator's
8298
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8299
+ * read `state`; folding the counters costs no extra read and makes the durable
8300
+ * record say afterwards how far a move actually got.
8301
+ *
8302
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8303
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8304
+ * cannot say M, and a 0 there would render as "100 % done".
8305
+ */
8306
+ var StorageMigrationMoveProgressSchema = object({
8307
+ filesMoved: number().int().nonnegative(),
8308
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8309
+ filesTotal: number().int().nonnegative().nullable(),
8310
+ bytesMoved: number().int().nonnegative(),
8311
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8312
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8313
+ * rows would be the same failure as one that silently skipped them. */
8314
+ rowsReconciled: number().int().nonnegative().optional(),
8315
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8316
+ * crash gets a new mover, and a rate computed from the migration's start
8317
+ * would silently average in the time nothing was running. */
8318
+ startedAt: number(),
8319
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8320
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8321
+ * subtract its own. */
8322
+ observedAt: number()
8323
+ });
8243
8324
  var StorageMigrationMoveSchema = object({
8244
8325
  storageClass: StorageMigrationClassSchema,
8245
8326
  fromLocationId: string(),
8246
8327
  toLocationId: string(),
8247
8328
  moverJobId: string().nullable(),
8248
8329
  state: RelocateJobStateSchema.nullable(),
8249
- error: string().nullable()
8330
+ error: string().nullable(),
8331
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8332
+ progress: StorageMigrationMoveProgressSchema.nullable()
8250
8333
  });
8251
8334
  var StorageMigrationJobSchema = object({
8252
8335
  jobId: string(),
@@ -8292,6 +8375,98 @@ var StorageMigrationPlanSchema = object({
8292
8375
  findings: array(StorageMigrationFindingSchema)
8293
8376
  });
8294
8377
  /**
8378
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8379
+ *
8380
+ * The coordinator's job record is the state of record for a migration, and its
8381
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8382
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8383
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8384
+ * way because no supported UI path existed. A mover armed like that has no job
8385
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8386
+ *
8387
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8388
+ * orchestrated it.
8389
+ */
8390
+ var StorageMigrationMoverSchema = object({
8391
+ lane: _enum(["footage", "media"]),
8392
+ job: RelocateJobSchema,
8393
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8394
+ * directly against the owning addon. */
8395
+ migrationJobId: string().nullable(),
8396
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8397
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8398
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8399
+ * rate made of two different clocks. */
8400
+ observedAt: number()
8401
+ });
8402
+ /**
8403
+ * What a SOURCE still holds for one storage class — the number that makes a
8404
+ * "drain remaining" action honest rather than hopeful.
8405
+ *
8406
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8407
+ * engine's own selection count for media), never from the resident index: a
8408
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8409
+ * never been told about (D295).
8410
+ *
8411
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8412
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8413
+ * because refusing on an unanswerable read would hide exactly the case an
8414
+ * operator needs to act on.
8415
+ */
8416
+ var StorageMigrationResidueSchema = object({
8417
+ storageClass: StorageMigrationClassSchema,
8418
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8419
+ * move from wherever they are rather than from one named source. */
8420
+ fromLocationId: string(),
8421
+ /** Where a drain would move it — the class's CURRENT default. */
8422
+ toLocationId: string(),
8423
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8424
+ items: number().int().nonnegative().nullable(),
8425
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8426
+ bytes: number().int().nonnegative().nullable()
8427
+ });
8428
+ /**
8429
+ * Run the DRAIN half and nothing else.
8430
+ *
8431
+ * A migration that reached `done` has already repointed, so `start` correctly
8432
+ * refuses its destination ("already the default") — there is nothing left to
8433
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8434
+ * or finish against a work list that was a tenth of the archive (D295), and
8435
+ * before this there was no supported way to run only that half: the only way
8436
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8437
+ *
8438
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8439
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8440
+ * re-repoint a class that is already migrated.
8441
+ */
8442
+ var StorageMigrationDrainInputSchema = object({
8443
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8444
+ * a class whose source is already empty is refused rather than started. */
8445
+ classes: array(StorageMigrationClassSchema).min(1),
8446
+ throttleMbps: number().min(1).max(1e3).optional()
8447
+ });
8448
+ /** What a footage source still holds, asked of the durable hour ledger. */
8449
+ var RelocateResidueInputSchema = object({
8450
+ fromLocationId: string().min(1),
8451
+ /** Narrow to one logical class; omit for every profile on the location. */
8452
+ footageClass: RelocateFootageClassSchema.optional()
8453
+ });
8454
+ /** `null` = the archive could not answer (no ledger on this node, or the
8455
+ * aggregate failed). Never conflated with an empty source. */
8456
+ var RelocateResidueSchema = object({
8457
+ segments: number().int().nonnegative(),
8458
+ bytes: number().int().nonnegative()
8459
+ }).nullable();
8460
+ /** How many rows a media pass would still act on against a given target — the
8461
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8462
+ * never disagree. `null` = the count could not be taken. */
8463
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8464
+ var RelocatableMediaCountInputSchema = object({
8465
+ toLocationId: string().min(1),
8466
+ /** Omitted = `move`. */
8467
+ mode: MediaRelocateModeSchema.optional()
8468
+ });
8469
+ /**
8295
8470
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8296
8471
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8297
8472
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8395,6 +8570,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8395
8570
  * two addons declaring the same `id` must agree on `cardinality` (validated
8396
8571
  * at kernel aggregation time, not here).
8397
8572
  */
8573
+ /**
8574
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8575
+ * actually reaches the bytes. It is the constraint that decides which
8576
+ * `storage-provider`s may back a location of that kind.
8577
+ *
8578
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8579
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8580
+ * post-analysis media roots). Only a provider that serves a genuine local
8581
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8582
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8583
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8584
+ * against a same-named local directory that is something else entirely.
8585
+ *
8586
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8587
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8588
+ * service never sees a path, so any provider can back it. `backups` is the
8589
+ * one kind that qualifies today.
8590
+ *
8591
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8592
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8593
+ * refused the configuration; the first write simply went somewhere wrong, and
8594
+ * a recording write that goes wrong surfaces as a silent black window rather
8595
+ * than an error (the read path does not `stat`). This turns that accident into
8596
+ * a declared, enforced, testable refusal.
8597
+ */
8598
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8398
8599
  var StorageLocationDeclarationSchema = object({
8399
8600
  /**
8400
8601
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8414,6 +8615,19 @@ var StorageLocationDeclarationSchema = object({
8414
8615
  */
8415
8616
  cardinality: _enum(["single", "multi"]),
8416
8617
  /**
8618
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8619
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8620
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8621
+ *
8622
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8623
+ * can only over-restrict (refuse a remote provider for a kind that might
8624
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8625
+ * permissive direction and is therefore never inferred — a repo guard
8626
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8627
+ * reached by omission.
8628
+ */
8629
+ access: StorageAccessSchema.optional(),
8630
+ /**
8417
8631
  * When set, the default instance for this location inherits its resolved
8418
8632
  * root from the named location's default instance. Useful for derivative
8419
8633
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -18226,8 +18440,10 @@ var TrackSchema = object({
18226
18440
  lastSeen: number(),
18227
18441
  /** Frame-rate position history (subject to maxPositionHistory cap). */
18228
18442
  positions: array(TrackPositionSchema).readonly(),
18229
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
18230
- * saveThumbnails policy). */
18443
+ /** Periodic snapshots at snapshotIntervalMs cadence DEBUG media, produced
18444
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18445
+ * the retired `saveThumbnails` used to gate this and the rolling
18446
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
18231
18447
  snapshots: array(TrackSnapshotSchema).readonly(),
18232
18448
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
18233
18449
  zonesVisited: array(string()).readonly(),
@@ -19087,7 +19303,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19087
19303
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
19088
19304
  kind: "mutation",
19089
19305
  auth: "admin"
19090
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
19306
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
19307
+ kind: "query",
19308
+ auth: "admin"
19309
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
19091
19310
  kind: "query",
19092
19311
  auth: "admin"
19093
19312
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -21150,6 +21369,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
21150
21369
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
21151
21370
  kind: "mutation",
21152
21371
  auth: "admin"
21372
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
21373
+ kind: "mutation",
21374
+ auth: "admin"
21153
21375
  });
21154
21376
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
21155
21377
  providerId: string().min(1),
@@ -21592,12 +21814,38 @@ response: record(string(), unknown()) }), object({
21592
21814
  *
21593
21815
  * ## Why this is a capability and not a helper
21594
21816
  *
21595
- * Six stores in `addon-post-analysis` already hold vectors object CLIP, face,
21596
- * plate, vehicle, identity, and the event store's derivativesand every one of
21597
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21598
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21599
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21600
- * load 5,000 rows before ranking anything.
21817
+ * This capability was introduced with the claim that SIX stores in
21818
+ * `addon-post-analysis` held vectors in a `JSON` settings-store columnobject
21819
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21820
+ * claim was never true, and leaving it here made five stores look like pending
21821
+ * work when three of them have no vector at all. Counted column by column on
21822
+ * 2026-08-30, exactly THREE ever held one:
21823
+ *
21824
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21825
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21826
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21827
+ * face, migrated 2026-08-30 into its OWN index (see below).
21828
+ *
21829
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21830
+ * and `identities` store a name; the event store stores no derivative vector.
21831
+ * They are not migration candidates and never were.
21832
+ *
21833
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21834
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21835
+ * rows before ranking anything.
21836
+ *
21837
+ * ## One index per COMPARISON, never per encoder
21838
+ *
21839
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21840
+ * model, and they still get two indexes. An index is a set of things that are
21841
+ * ranked against each other and that live and die together, and these two are
21842
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21843
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21844
+ * forever and is the gallery every recognition ranks against. One index would
21845
+ * mean every gallery load and every reconcile carried a filter whose failure
21846
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21847
+ * person's only sample. The dimension they share is not a reason to share an
21848
+ * index; the question they answer is, and it differs.
21601
21849
  *
21602
21850
  * The fix is not a faster loop, it is a different backend — and the backend
21603
21851
  * should be replaceable without touching six callers. So: a singleton
@@ -21702,7 +21950,20 @@ var VectorQueryResultSchema = object({
21702
21950
  */
21703
21951
  scanned: number(),
21704
21952
  /** True when the backend could not consider every row that passed the filter. */
21705
- truncated: boolean()
21953
+ truncated: boolean(),
21954
+ /**
21955
+ * The `topK` the backend actually ran with.
21956
+ *
21957
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21958
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21959
+ * own log rather than in its answer. That is how an audit asking for 20,000
21960
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21961
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21962
+ * MUCH, in the return value, where the caller cannot fail to see it.
21963
+ *
21964
+ * Equals the requested `topK` whenever nothing was lowered.
21965
+ */
21966
+ effectiveTopK: number().int().positive()
21706
21967
  });
21707
21968
  var VectorDeleteInputSchema = object({
21708
21969
  index: string(),
@@ -21731,6 +21992,68 @@ var VectorGetResultSchema = object({ items: array(object({
21731
21992
  id: string(),
21732
21993
  metadata: VectorMetadataSchema
21733
21994
  })) });
21995
+ /**
21996
+ * Ids to read back WITH their vectors.
21997
+ *
21998
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21999
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
22000
+ * caller depends on that promise. This one promises the opposite.
22001
+ *
22002
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
22003
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
22004
+ * a per-face cross-process KNN would be a network round trip inside the
22005
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
22006
+ * it requires the index to hand the floats back. Without this method the only
22007
+ * way to keep a readable vector is a JSON column, which is the thing this
22008
+ * capability exists to delete.
22009
+ *
22010
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
22011
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
22012
+ */
22013
+ var VectorFetchInputSchema = object({
22014
+ index: string(),
22015
+ ids: array(string())
22016
+ });
22017
+ var VectorFetchResultSchema = object({ items: array(object({
22018
+ id: string(),
22019
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
22020
+ vector: string(),
22021
+ metadata: VectorMetadataSchema
22022
+ })) });
22023
+ /**
22024
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
22025
+ *
22026
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
22027
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
22028
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
22029
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
22030
+ * distance to every row is degenerate. `examined: 4096` then read as "we
22031
+ * looked" for as long as anyone cared to read it.
22032
+ *
22033
+ * This is the primitive that question actually needs: a bounded page, ordered
22034
+ * by the backend's own row order, costing no distance computation at all.
22035
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
22036
+ * the full-table read this capability was built to stop.
22037
+ */
22038
+ var VectorScanInputSchema = object({
22039
+ index: string(),
22040
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
22041
+ cursor: number().int().nonnegative().default(0),
22042
+ limit: number().int().positive()
22043
+ });
22044
+ var VectorScanResultSchema = object({
22045
+ items: array(object({
22046
+ id: string(),
22047
+ metadata: VectorMetadataSchema
22048
+ })),
22049
+ /**
22050
+ * Where the next page starts, or `null` when the walk reached the end.
22051
+ *
22052
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
22053
+ * from a short page: a backend is free to return fewer rows than asked.
22054
+ */
22055
+ nextCursor: number().int().nonnegative().nullable()
22056
+ });
21734
22057
  var VectorStatsInputSchema = object({ index: string() });
21735
22058
  var VectorStatsResultSchema = object({
21736
22059
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21749,7 +22072,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21749
22072
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21750
22073
  kind: "mutation",
21751
22074
  auth: "admin"
21752
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
22075
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21753
22076
  kind: "mutation",
21754
22077
  auth: "admin"
21755
22078
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -28368,6 +28691,9 @@ method(object({
28368
28691
  }), method(object({}), array(RelocateJobSchema).readonly(), {
28369
28692
  kind: "query",
28370
28693
  auth: "admin"
28694
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
28695
+ kind: "query",
28696
+ auth: "admin"
28371
28697
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
28372
28698
  kind: "mutation",
28373
28699
  auth: "admin"
@@ -35000,6 +35326,12 @@ Object.freeze({
35000
35326
  addonId: null,
35001
35327
  access: "create"
35002
35328
  },
35329
+ "pipelineAnalytics.countRelocatableMedia": {
35330
+ capName: "pipeline-analytics",
35331
+ capScope: "device",
35332
+ addonId: null,
35333
+ access: "view"
35334
+ },
35003
35335
  "pipelineAnalytics.countUnstampedEventMedia": {
35004
35336
  capName: "pipeline-analytics",
35005
35337
  capScope: "device",
@@ -36164,6 +36496,12 @@ Object.freeze({
36164
36496
  addonId: null,
36165
36497
  access: "view"
36166
36498
  },
36499
+ "recording.getRelocateResidue": {
36500
+ capName: "recording",
36501
+ capScope: "system",
36502
+ addonId: null,
36503
+ access: "view"
36504
+ },
36167
36505
  "recording.getStorageMigrationMoveStatus": {
36168
36506
  capName: "recording",
36169
36507
  capScope: "system",
@@ -36710,12 +37048,30 @@ Object.freeze({
36710
37048
  addonId: null,
36711
37049
  access: "create"
36712
37050
  },
37051
+ "storageMigration.drain": {
37052
+ capName: "storage-migration",
37053
+ capScope: "system",
37054
+ addonId: null,
37055
+ access: "create"
37056
+ },
37057
+ "storageMigration.movers": {
37058
+ capName: "storage-migration",
37059
+ capScope: "system",
37060
+ addonId: null,
37061
+ access: "view"
37062
+ },
36713
37063
  "storageMigration.plan": {
36714
37064
  capName: "storage-migration",
36715
37065
  capScope: "system",
36716
37066
  addonId: null,
36717
37067
  access: "view"
36718
37068
  },
37069
+ "storageMigration.residue": {
37070
+ capName: "storage-migration",
37071
+ capScope: "system",
37072
+ addonId: null,
37073
+ access: "view"
37074
+ },
36719
37075
  "storageMigration.start": {
36720
37076
  capName: "storage-migration",
36721
37077
  capScope: "system",
@@ -37550,6 +37906,12 @@ Object.freeze({
37550
37906
  addonId: null,
37551
37907
  access: "delete"
37552
37908
  },
37909
+ "vectorStore.fetchByIds": {
37910
+ capName: "vector-store",
37911
+ capScope: "system",
37912
+ addonId: null,
37913
+ access: "view"
37914
+ },
37553
37915
  "vectorStore.getByIds": {
37554
37916
  capName: "vector-store",
37555
37917
  capScope: "system",
@@ -37562,6 +37924,12 @@ Object.freeze({
37562
37924
  addonId: null,
37563
37925
  access: "view"
37564
37926
  },
37927
+ "vectorStore.scan": {
37928
+ capName: "vector-store",
37929
+ capScope: "system",
37930
+ addonId: null,
37931
+ access: "view"
37932
+ },
37565
37933
  "vectorStore.stats": {
37566
37934
  capName: "vector-store",
37567
37935
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-terminal",
3
- "version": "0.1.48",
3
+ "version": "0.1.51",
4
4
  "description": "Interactive terminal sessions (pty + xterm) as a CamStack addon",
5
5
  "keywords": [
6
6
  "camstack",