@camstack/addon-tailscale 1.2.43 → 1.2.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_dist = require("../dist-Bzn0_Gfg.js");
27
+ const require_dist = require("../dist-B81Rw6ym.js");
28
28
  let node_child_process = require("node:child_process");
29
29
  let node_util = require("node:util");
30
30
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-cWp3ATn9.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-Tyu2rQxG.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
4
  import * as fs from "node:fs";
@@ -8020,6 +8020,21 @@ var RelocateJobSchema = object({
8020
8020
  bytesMoved: number().int(),
8021
8021
  /** Total files discovered up front; null while (or when) unknown. */
8022
8022
  filesTotal: number().int().nullable(),
8023
+ /**
8024
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8025
+ * made that nobody asked for, so it is reported where the operator reads the
8026
+ * job rather than only in a log line.
8027
+ *
8028
+ * A footage segment records its byte count in its own NAME, and the durable
8029
+ * hour row derives its aggregates from those names. A file that does not
8030
+ * match its name therefore makes the ledger's sums — and with them quota and
8031
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8032
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8033
+ *
8034
+ * Absent on lanes where the question has no meaning: a media blob's size is
8035
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8036
+ */
8037
+ rowsReconciled: number().int().nonnegative().optional(),
8023
8038
  startedAt: number(),
8024
8039
  finishedAt: number().nullable(),
8025
8040
  error: string().nullable()
@@ -8088,14 +8103,42 @@ var RelocateMediaInputSchema = object({
8088
8103
  /** Omitted = `move`, the pre-existing behaviour. */
8089
8104
  mode: MediaRelocateModeSchema.optional()
8090
8105
  });
8091
- /** How many rows still carry NO `locationId` — the population a repoint would
8092
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8093
- * value that permits a non-blocking `eventMedia` cutover. */
8094
- var UnstampedEventMediaCountSchema = object({
8095
- media: number().int().nonnegative(),
8096
- retrainFrames: number().int().nonnegative(),
8097
- total: number().int().nonnegative()
8106
+ /**
8107
+ * The unstamped population of ONE collection — split, because the gate and the
8108
+ * operator ask two different questions and only one of them has to be cheap.
8109
+ *
8110
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8111
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8112
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8113
+ * that matters — after a seal, when the population is empty.
8114
+ *
8115
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8116
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8117
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8118
+ * and useful answer: "there are some, and this read could not say how many"
8119
+ * still refuses the cutover, which is the whole job.
8120
+ */
8121
+ var UnstampedRowsSchema = object({
8122
+ present: boolean(),
8123
+ rows: number().int().nonnegative().nullable()
8098
8124
  });
8125
+ /**
8126
+ * How many rows still carry NO `locationId` — the population a repoint would
8127
+ * silently re-aim at a disk that does not hold their bytes.
8128
+ *
8129
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8130
+ * over. The gate opens on a measured absence and on nothing else; an unread
8131
+ * collection and an empty one are different facts, and this repo has already
8132
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8133
+ */
8134
+ var UnstampedEventMediaCountSchema = object({
8135
+ media: UnstampedRowsSchema,
8136
+ retrainFrames: UnstampedRowsSchema,
8137
+ /** True when EITHER collection holds one. The refusal reads this. */
8138
+ anyPresent: boolean(),
8139
+ /** Sum across both, or `null` when either lane could not be counted. */
8140
+ total: number().int().nonnegative().nullable()
8141
+ }).nullable();
8099
8142
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8100
8143
  /** The independently selectable logical storage classes — every class
8101
8144
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8181,13 +8224,53 @@ var StorageMigrationParticipantSchema = _enum([
8181
8224
  "recorder",
8182
8225
  "analytics"
8183
8226
  ]);
8227
+ /**
8228
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8229
+ *
8230
+ * The long half of a non-blocking migration is `draining`, and it is measured
8231
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8232
+ * existed the only place those numbers appeared was a Loki line, so an operator
8233
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8234
+ * afternoon.
8235
+ *
8236
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8237
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8238
+ * mover — which is the exact failure this is meant to end. The coordinator's
8239
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8240
+ * read `state`; folding the counters costs no extra read and makes the durable
8241
+ * record say afterwards how far a move actually got.
8242
+ *
8243
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8244
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8245
+ * cannot say M, and a 0 there would render as "100 % done".
8246
+ */
8247
+ var StorageMigrationMoveProgressSchema = object({
8248
+ filesMoved: number().int().nonnegative(),
8249
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8250
+ filesTotal: number().int().nonnegative().nullable(),
8251
+ bytesMoved: number().int().nonnegative(),
8252
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8253
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8254
+ * rows would be the same failure as one that silently skipped them. */
8255
+ rowsReconciled: number().int().nonnegative().optional(),
8256
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8257
+ * crash gets a new mover, and a rate computed from the migration's start
8258
+ * would silently average in the time nothing was running. */
8259
+ startedAt: number(),
8260
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8261
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8262
+ * subtract its own. */
8263
+ observedAt: number()
8264
+ });
8184
8265
  var StorageMigrationMoveSchema = object({
8185
8266
  storageClass: StorageMigrationClassSchema,
8186
8267
  fromLocationId: string(),
8187
8268
  toLocationId: string(),
8188
8269
  moverJobId: string().nullable(),
8189
8270
  state: RelocateJobStateSchema.nullable(),
8190
- error: string().nullable()
8271
+ error: string().nullable(),
8272
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8273
+ progress: StorageMigrationMoveProgressSchema.nullable()
8191
8274
  });
8192
8275
  var StorageMigrationJobSchema = object({
8193
8276
  jobId: string(),
@@ -8233,6 +8316,98 @@ var StorageMigrationPlanSchema = object({
8233
8316
  findings: array(StorageMigrationFindingSchema)
8234
8317
  });
8235
8318
  /**
8319
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8320
+ *
8321
+ * The coordinator's job record is the state of record for a migration, and its
8322
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8323
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8324
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8325
+ * way because no supported UI path existed. A mover armed like that has no job
8326
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8327
+ *
8328
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8329
+ * orchestrated it.
8330
+ */
8331
+ var StorageMigrationMoverSchema = object({
8332
+ lane: _enum(["footage", "media"]),
8333
+ job: RelocateJobSchema,
8334
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8335
+ * directly against the owning addon. */
8336
+ migrationJobId: string().nullable(),
8337
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8338
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8339
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8340
+ * rate made of two different clocks. */
8341
+ observedAt: number()
8342
+ });
8343
+ /**
8344
+ * What a SOURCE still holds for one storage class — the number that makes a
8345
+ * "drain remaining" action honest rather than hopeful.
8346
+ *
8347
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8348
+ * engine's own selection count for media), never from the resident index: a
8349
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8350
+ * never been told about (D295).
8351
+ *
8352
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8353
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8354
+ * because refusing on an unanswerable read would hide exactly the case an
8355
+ * operator needs to act on.
8356
+ */
8357
+ var StorageMigrationResidueSchema = object({
8358
+ storageClass: StorageMigrationClassSchema,
8359
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8360
+ * move from wherever they are rather than from one named source. */
8361
+ fromLocationId: string(),
8362
+ /** Where a drain would move it — the class's CURRENT default. */
8363
+ toLocationId: string(),
8364
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8365
+ items: number().int().nonnegative().nullable(),
8366
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8367
+ bytes: number().int().nonnegative().nullable()
8368
+ });
8369
+ /**
8370
+ * Run the DRAIN half and nothing else.
8371
+ *
8372
+ * A migration that reached `done` has already repointed, so `start` correctly
8373
+ * refuses its destination ("already the default") — there is nothing left to
8374
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8375
+ * or finish against a work list that was a tenth of the archive (D295), and
8376
+ * before this there was no supported way to run only that half: the only way
8377
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8378
+ *
8379
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8380
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8381
+ * re-repoint a class that is already migrated.
8382
+ */
8383
+ var StorageMigrationDrainInputSchema = object({
8384
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8385
+ * a class whose source is already empty is refused rather than started. */
8386
+ classes: array(StorageMigrationClassSchema).min(1),
8387
+ throttleMbps: number().min(1).max(1e3).optional()
8388
+ });
8389
+ /** What a footage source still holds, asked of the durable hour ledger. */
8390
+ var RelocateResidueInputSchema = object({
8391
+ fromLocationId: string().min(1),
8392
+ /** Narrow to one logical class; omit for every profile on the location. */
8393
+ footageClass: RelocateFootageClassSchema.optional()
8394
+ });
8395
+ /** `null` = the archive could not answer (no ledger on this node, or the
8396
+ * aggregate failed). Never conflated with an empty source. */
8397
+ var RelocateResidueSchema = object({
8398
+ segments: number().int().nonnegative(),
8399
+ bytes: number().int().nonnegative()
8400
+ }).nullable();
8401
+ /** How many rows a media pass would still act on against a given target — the
8402
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8403
+ * never disagree. `null` = the count could not be taken. */
8404
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8405
+ var RelocatableMediaCountInputSchema = object({
8406
+ toLocationId: string().min(1),
8407
+ /** Omitted = `move`. */
8408
+ mode: MediaRelocateModeSchema.optional()
8409
+ });
8410
+ /**
8236
8411
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8237
8412
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8238
8413
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8336,6 +8511,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8336
8511
  * two addons declaring the same `id` must agree on `cardinality` (validated
8337
8512
  * at kernel aggregation time, not here).
8338
8513
  */
8514
+ /**
8515
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8516
+ * actually reaches the bytes. It is the constraint that decides which
8517
+ * `storage-provider`s may back a location of that kind.
8518
+ *
8519
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8520
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8521
+ * post-analysis media roots). Only a provider that serves a genuine local
8522
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8523
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8524
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8525
+ * against a same-named local directory that is something else entirely.
8526
+ *
8527
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8528
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8529
+ * service never sees a path, so any provider can back it. `backups` is the
8530
+ * one kind that qualifies today.
8531
+ *
8532
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8533
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8534
+ * refused the configuration; the first write simply went somewhere wrong, and
8535
+ * a recording write that goes wrong surfaces as a silent black window rather
8536
+ * than an error (the read path does not `stat`). This turns that accident into
8537
+ * a declared, enforced, testable refusal.
8538
+ */
8539
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8339
8540
  var StorageLocationDeclarationSchema = object({
8340
8541
  /**
8341
8542
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8355,6 +8556,19 @@ var StorageLocationDeclarationSchema = object({
8355
8556
  */
8356
8557
  cardinality: _enum(["single", "multi"]),
8357
8558
  /**
8559
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8560
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8561
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8562
+ *
8563
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8564
+ * can only over-restrict (refuse a remote provider for a kind that might
8565
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8566
+ * permissive direction and is therefore never inferred — a repo guard
8567
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8568
+ * reached by omission.
8569
+ */
8570
+ access: StorageAccessSchema.optional(),
8571
+ /**
8358
8572
  * When set, the default instance for this location inherits its resolved
8359
8573
  * root from the named location's default instance. Useful for derivative
8360
8574
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17897,8 +18111,10 @@ var TrackSchema = object({
17897
18111
  lastSeen: number(),
17898
18112
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17899
18113
  positions: array(TrackPositionSchema).readonly(),
17900
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17901
- * saveThumbnails policy). */
18114
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18115
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18116
+ * the retired `saveThumbnails` used to gate this and the rolling
18117
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17902
18118
  snapshots: array(TrackSnapshotSchema).readonly(),
17903
18119
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17904
18120
  zonesVisited: array(string()).readonly(),
@@ -18758,7 +18974,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18758
18974
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18759
18975
  kind: "mutation",
18760
18976
  auth: "admin"
18761
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
18977
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18978
+ kind: "query",
18979
+ auth: "admin"
18980
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18762
18981
  kind: "query",
18763
18982
  auth: "admin"
18764
18983
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20717,6 +20936,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20717
20936
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20718
20937
  kind: "mutation",
20719
20938
  auth: "admin"
20939
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20940
+ kind: "mutation",
20941
+ auth: "admin"
20720
20942
  });
20721
20943
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20722
20944
  providerId: string().min(1),
@@ -21115,12 +21337,38 @@ response: record(string(), unknown()) }), object({
21115
21337
  *
21116
21338
  * ## Why this is a capability and not a helper
21117
21339
  *
21118
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21119
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21120
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21121
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21122
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21123
- * load 5,000 rows before ranking anything.
21340
+ * This capability was introduced with the claim that SIX stores in
21341
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21342
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21343
+ * claim was never true, and leaving it here made five stores look like pending
21344
+ * work when three of them have no vector at all. Counted column by column on
21345
+ * 2026-08-30, exactly THREE ever held one:
21346
+ *
21347
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21348
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21349
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21350
+ * face, migrated 2026-08-30 into its OWN index (see below).
21351
+ *
21352
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21353
+ * and `identities` store a name; the event store stores no derivative vector.
21354
+ * They are not migration candidates and never were.
21355
+ *
21356
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21357
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21358
+ * rows before ranking anything.
21359
+ *
21360
+ * ## One index per COMPARISON, never per encoder
21361
+ *
21362
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21363
+ * model, and they still get two indexes. An index is a set of things that are
21364
+ * ranked against each other and that live and die together, and these two are
21365
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21366
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21367
+ * forever and is the gallery every recognition ranks against. One index would
21368
+ * mean every gallery load and every reconcile carried a filter whose failure
21369
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21370
+ * person's only sample. The dimension they share is not a reason to share an
21371
+ * index; the question they answer is, and it differs.
21124
21372
  *
21125
21373
  * The fix is not a faster loop, it is a different backend — and the backend
21126
21374
  * should be replaceable without touching six callers. So: a singleton
@@ -21225,7 +21473,20 @@ var VectorQueryResultSchema = object({
21225
21473
  */
21226
21474
  scanned: number(),
21227
21475
  /** True when the backend could not consider every row that passed the filter. */
21228
- truncated: boolean()
21476
+ truncated: boolean(),
21477
+ /**
21478
+ * The `topK` the backend actually ran with.
21479
+ *
21480
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21481
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21482
+ * own log rather than in its answer. That is how an audit asking for 20,000
21483
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21484
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21485
+ * MUCH, in the return value, where the caller cannot fail to see it.
21486
+ *
21487
+ * Equals the requested `topK` whenever nothing was lowered.
21488
+ */
21489
+ effectiveTopK: number().int().positive()
21229
21490
  });
21230
21491
  var VectorDeleteInputSchema = object({
21231
21492
  index: string(),
@@ -21254,6 +21515,68 @@ var VectorGetResultSchema = object({ items: array(object({
21254
21515
  id: string(),
21255
21516
  metadata: VectorMetadataSchema
21256
21517
  })) });
21518
+ /**
21519
+ * Ids to read back WITH their vectors.
21520
+ *
21521
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21522
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21523
+ * caller depends on that promise. This one promises the opposite.
21524
+ *
21525
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21526
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21527
+ * a per-face cross-process KNN would be a network round trip inside the
21528
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21529
+ * it requires the index to hand the floats back. Without this method the only
21530
+ * way to keep a readable vector is a JSON column, which is the thing this
21531
+ * capability exists to delete.
21532
+ *
21533
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21534
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21535
+ */
21536
+ var VectorFetchInputSchema = object({
21537
+ index: string(),
21538
+ ids: array(string())
21539
+ });
21540
+ var VectorFetchResultSchema = object({ items: array(object({
21541
+ id: string(),
21542
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21543
+ vector: string(),
21544
+ metadata: VectorMetadataSchema
21545
+ })) });
21546
+ /**
21547
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21548
+ *
21549
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21550
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21551
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21552
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21553
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21554
+ * looked" for as long as anyone cared to read it.
21555
+ *
21556
+ * This is the primitive that question actually needs: a bounded page, ordered
21557
+ * by the backend's own row order, costing no distance computation at all.
21558
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21559
+ * the full-table read this capability was built to stop.
21560
+ */
21561
+ var VectorScanInputSchema = object({
21562
+ index: string(),
21563
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21564
+ cursor: number().int().nonnegative().default(0),
21565
+ limit: number().int().positive()
21566
+ });
21567
+ var VectorScanResultSchema = object({
21568
+ items: array(object({
21569
+ id: string(),
21570
+ metadata: VectorMetadataSchema
21571
+ })),
21572
+ /**
21573
+ * Where the next page starts, or `null` when the walk reached the end.
21574
+ *
21575
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21576
+ * from a short page: a backend is free to return fewer rows than asked.
21577
+ */
21578
+ nextCursor: number().int().nonnegative().nullable()
21579
+ });
21257
21580
  var VectorStatsInputSchema = object({ index: string() });
21258
21581
  var VectorStatsResultSchema = object({
21259
21582
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21272,7 +21595,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21272
21595
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21273
21596
  kind: "mutation",
21274
21597
  auth: "admin"
21275
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21598
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21276
21599
  kind: "mutation",
21277
21600
  auth: "admin"
21278
21601
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26237,6 +26560,9 @@ method(object({
26237
26560
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26238
26561
  kind: "query",
26239
26562
  auth: "admin"
26563
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26564
+ kind: "query",
26565
+ auth: "admin"
26240
26566
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26241
26567
  kind: "mutation",
26242
26568
  auth: "admin"
@@ -31202,6 +31528,12 @@ Object.freeze({
31202
31528
  addonId: null,
31203
31529
  access: "create"
31204
31530
  },
31531
+ "pipelineAnalytics.countRelocatableMedia": {
31532
+ capName: "pipeline-analytics",
31533
+ capScope: "device",
31534
+ addonId: null,
31535
+ access: "view"
31536
+ },
31205
31537
  "pipelineAnalytics.countUnstampedEventMedia": {
31206
31538
  capName: "pipeline-analytics",
31207
31539
  capScope: "device",
@@ -32366,6 +32698,12 @@ Object.freeze({
32366
32698
  addonId: null,
32367
32699
  access: "view"
32368
32700
  },
32701
+ "recording.getRelocateResidue": {
32702
+ capName: "recording",
32703
+ capScope: "system",
32704
+ addonId: null,
32705
+ access: "view"
32706
+ },
32369
32707
  "recording.getStorageMigrationMoveStatus": {
32370
32708
  capName: "recording",
32371
32709
  capScope: "system",
@@ -32912,12 +33250,30 @@ Object.freeze({
32912
33250
  addonId: null,
32913
33251
  access: "create"
32914
33252
  },
33253
+ "storageMigration.drain": {
33254
+ capName: "storage-migration",
33255
+ capScope: "system",
33256
+ addonId: null,
33257
+ access: "create"
33258
+ },
33259
+ "storageMigration.movers": {
33260
+ capName: "storage-migration",
33261
+ capScope: "system",
33262
+ addonId: null,
33263
+ access: "view"
33264
+ },
32915
33265
  "storageMigration.plan": {
32916
33266
  capName: "storage-migration",
32917
33267
  capScope: "system",
32918
33268
  addonId: null,
32919
33269
  access: "view"
32920
33270
  },
33271
+ "storageMigration.residue": {
33272
+ capName: "storage-migration",
33273
+ capScope: "system",
33274
+ addonId: null,
33275
+ access: "view"
33276
+ },
32921
33277
  "storageMigration.start": {
32922
33278
  capName: "storage-migration",
32923
33279
  capScope: "system",
@@ -33752,6 +34108,12 @@ Object.freeze({
33752
34108
  addonId: null,
33753
34109
  access: "delete"
33754
34110
  },
34111
+ "vectorStore.fetchByIds": {
34112
+ capName: "vector-store",
34113
+ capScope: "system",
34114
+ addonId: null,
34115
+ access: "view"
34116
+ },
33755
34117
  "vectorStore.getByIds": {
33756
34118
  capName: "vector-store",
33757
34119
  capScope: "system",
@@ -33764,6 +34126,12 @@ Object.freeze({
33764
34126
  addonId: null,
33765
34127
  access: "view"
33766
34128
  },
34129
+ "vectorStore.scan": {
34130
+ capName: "vector-store",
34131
+ capScope: "system",
34132
+ addonId: null,
34133
+ access: "view"
34134
+ },
33767
34135
  "vectorStore.stats": {
33768
34136
  capName: "vector-store",
33769
34137
  capScope: "system",
@@ -8020,6 +8020,21 @@ var RelocateJobSchema = object({
8020
8020
  bytesMoved: number().int(),
8021
8021
  /** Total files discovered up front; null while (or when) unknown. */
8022
8022
  filesTotal: number().int().nullable(),
8023
+ /**
8024
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8025
+ * made that nobody asked for, so it is reported where the operator reads the
8026
+ * job rather than only in a log line.
8027
+ *
8028
+ * A footage segment records its byte count in its own NAME, and the durable
8029
+ * hour row derives its aggregates from those names. A file that does not
8030
+ * match its name therefore makes the ledger's sums — and with them quota and
8031
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8032
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8033
+ *
8034
+ * Absent on lanes where the question has no meaning: a media blob's size is
8035
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8036
+ */
8037
+ rowsReconciled: number().int().nonnegative().optional(),
8023
8038
  startedAt: number(),
8024
8039
  finishedAt: number().nullable(),
8025
8040
  error: string().nullable()
@@ -8088,14 +8103,42 @@ var RelocateMediaInputSchema = object({
8088
8103
  /** Omitted = `move`, the pre-existing behaviour. */
8089
8104
  mode: MediaRelocateModeSchema.optional()
8090
8105
  });
8091
- /** How many rows still carry NO `locationId` — the population a repoint would
8092
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8093
- * value that permits a non-blocking `eventMedia` cutover. */
8094
- var UnstampedEventMediaCountSchema = object({
8095
- media: number().int().nonnegative(),
8096
- retrainFrames: number().int().nonnegative(),
8097
- total: number().int().nonnegative()
8106
+ /**
8107
+ * The unstamped population of ONE collection — split, because the gate and the
8108
+ * operator ask two different questions and only one of them has to be cheap.
8109
+ *
8110
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8111
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8112
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8113
+ * that matters — after a seal, when the population is empty.
8114
+ *
8115
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8116
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8117
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8118
+ * and useful answer: "there are some, and this read could not say how many"
8119
+ * still refuses the cutover, which is the whole job.
8120
+ */
8121
+ var UnstampedRowsSchema = object({
8122
+ present: boolean(),
8123
+ rows: number().int().nonnegative().nullable()
8098
8124
  });
8125
+ /**
8126
+ * How many rows still carry NO `locationId` — the population a repoint would
8127
+ * silently re-aim at a disk that does not hold their bytes.
8128
+ *
8129
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8130
+ * over. The gate opens on a measured absence and on nothing else; an unread
8131
+ * collection and an empty one are different facts, and this repo has already
8132
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8133
+ */
8134
+ var UnstampedEventMediaCountSchema = object({
8135
+ media: UnstampedRowsSchema,
8136
+ retrainFrames: UnstampedRowsSchema,
8137
+ /** True when EITHER collection holds one. The refusal reads this. */
8138
+ anyPresent: boolean(),
8139
+ /** Sum across both, or `null` when either lane could not be counted. */
8140
+ total: number().int().nonnegative().nullable()
8141
+ }).nullable();
8099
8142
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8100
8143
  /** The independently selectable logical storage classes — every class
8101
8144
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8181,13 +8224,53 @@ var StorageMigrationParticipantSchema = _enum([
8181
8224
  "recorder",
8182
8225
  "analytics"
8183
8226
  ]);
8227
+ /**
8228
+ * The mover's own numbers, folded onto the coordinator's durable move record.
8229
+ *
8230
+ * The long half of a non-blocking migration is `draining`, and it is measured
8231
+ * in hours: 136 885 files at ~4 MB/s is about five of them. Before this shape
8232
+ * existed the only place those numbers appeared was a Loki line, so an operator
8233
+ * watching the Admin UI saw `phase: draining` and nothing else for a whole
8234
+ * afternoon.
8235
+ *
8236
+ * It is POLLED, never pushed. Events are telemetry and may be dropped
8237
+ * (D8/D11), and a dropped progress event is indistinguishable from a stalled
8238
+ * mover — which is the exact failure this is meant to end. The coordinator's
8239
+ * `waitForMoves` already fetches the whole {@link RelocateJob} on every tick to
8240
+ * read `state`; folding the counters costs no extra read and makes the durable
8241
+ * record say afterwards how far a move actually got.
8242
+ *
8243
+ * `filesTotal` is `null` for "no honest denominator" and is never zero-filled:
8244
+ * a windowed footage job (`sinceMs`) and a node with no ledger both genuinely
8245
+ * cannot say M, and a 0 there would render as "100 % done".
8246
+ */
8247
+ var StorageMigrationMoveProgressSchema = object({
8248
+ filesMoved: number().int().nonnegative(),
8249
+ /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8250
+ filesTotal: number().int().nonnegative().nullable(),
8251
+ bytesMoved: number().int().nonnegative(),
8252
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8253
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8254
+ * rows would be the same failure as one that silently skipped them. */
8255
+ rowsReconciled: number().int().nonnegative().optional(),
8256
+ /** The MOVER's start, not the migration's: a drain restarted after an addon
8257
+ * crash gets a new mover, and a rate computed from the migration's start
8258
+ * would silently average in the time nothing was running. */
8259
+ startedAt: number(),
8260
+ /** When the coordinator last read these numbers. Paired with `startedAt` it
8261
+ * is the only honest rate: both clocks are the hub's, so a UI never has to
8262
+ * subtract its own. */
8263
+ observedAt: number()
8264
+ });
8184
8265
  var StorageMigrationMoveSchema = object({
8185
8266
  storageClass: StorageMigrationClassSchema,
8186
8267
  fromLocationId: string(),
8187
8268
  toLocationId: string(),
8188
8269
  moverJobId: string().nullable(),
8189
8270
  state: RelocateJobStateSchema.nullable(),
8190
- error: string().nullable()
8271
+ error: string().nullable(),
8272
+ /** Last observed mover counters; `null` until the mover has been polled once. */
8273
+ progress: StorageMigrationMoveProgressSchema.nullable()
8191
8274
  });
8192
8275
  var StorageMigrationJobSchema = object({
8193
8276
  jobId: string(),
@@ -8233,6 +8316,98 @@ var StorageMigrationPlanSchema = object({
8233
8316
  findings: array(StorageMigrationFindingSchema)
8234
8317
  });
8235
8318
  /**
8319
+ * A mover as it exists RIGHT NOW, whether or not a migration job owns it.
8320
+ *
8321
+ * The coordinator's job record is the state of record for a migration, and its
8322
+ * moves carry {@link StorageMigrationMoveProgress}. But the movers are usable
8323
+ * standalone — `recording.relocateFootage` and `pipelineAnalytics.relocateMedia`
8324
+ * are both operator-callable, and on 2026-08-29 a five-hour drain was armed that
8325
+ * way because no supported UI path existed. A mover armed like that has no job
8326
+ * to fold progress into, so it has to be readable on its own or it is invisible.
8327
+ *
8328
+ * `migrationJobId` is what tells the two apart: `null` means nothing here
8329
+ * orchestrated it.
8330
+ */
8331
+ var StorageMigrationMoverSchema = object({
8332
+ lane: _enum(["footage", "media"]),
8333
+ job: RelocateJobSchema,
8334
+ /** The coordinator job that armed this mover, or `null` for a mover armed
8335
+ * directly against the owning addon. */
8336
+ migrationJobId: string().nullable(),
8337
+ /** When the hub read these counters. Stamped here so a rate is `bytesMoved`
8338
+ * over (`observedAt` − `job.startedAt`) with BOTH ends on the hub's clock —
8339
+ * a browser subtracting its own `Date.now()` from a server `startedAt` is a
8340
+ * rate made of two different clocks. */
8341
+ observedAt: number()
8342
+ });
8343
+ /**
8344
+ * What a SOURCE still holds for one storage class — the number that makes a
8345
+ * "drain remaining" action honest rather than hopeful.
8346
+ *
8347
+ * It comes from the archive (`SegmentHourLedger.census` for footage, the media
8348
+ * engine's own selection count for media), never from the resident index: a
8349
+ * drain sized off `RecordingIndex` is what reported `done` over 80.3 GB it had
8350
+ * never been told about (D295).
8351
+ *
8352
+ * `items`/`bytes` are `null` for "the archive could not be asked", which is
8353
+ * deliberately NOT zero: a drain is still offered for an unknown residue,
8354
+ * because refusing on an unanswerable read would hide exactly the case an
8355
+ * operator needs to act on.
8356
+ */
8357
+ var StorageMigrationResidueSchema = object({
8358
+ storageClass: StorageMigrationClassSchema,
8359
+ /** The location still holding the data. `'*'` for the media lane, whose rows
8360
+ * move from wherever they are rather than from one named source. */
8361
+ fromLocationId: string(),
8362
+ /** Where a drain would move it — the class's CURRENT default. */
8363
+ toLocationId: string(),
8364
+ /** Segments (footage lane) or rows (media lane) still on the source. */
8365
+ items: number().int().nonnegative().nullable(),
8366
+ /** Bytes on the source; `null` when the lane counts rows rather than bytes. */
8367
+ bytes: number().int().nonnegative().nullable()
8368
+ });
8369
+ /**
8370
+ * Run the DRAIN half and nothing else.
8371
+ *
8372
+ * A migration that reached `done` has already repointed, so `start` correctly
8373
+ * refuses its destination ("already the default") — there is nothing left to
8374
+ * repoint. But the drain can fail, be cancelled, be interrupted by a restart,
8375
+ * or finish against a work list that was a tenth of the archive (D295), and
8376
+ * before this there was no supported way to run only that half: the only way
8377
+ * through was calling `recording.relocateFootage` by hand over admin tRPC.
8378
+ *
8379
+ * `drain` NEVER calls `setDefaultLocations`. That is what keeps `start`'s
8380
+ * refusal meaningful: the two verbs are disjoint, so nothing here can silently
8381
+ * re-repoint a class that is already migrated.
8382
+ */
8383
+ var StorageMigrationDrainInputSchema = object({
8384
+ /** The classes to drain. Each must appear in `storageMigration.residue`, so
8385
+ * a class whose source is already empty is refused rather than started. */
8386
+ classes: array(StorageMigrationClassSchema).min(1),
8387
+ throttleMbps: number().min(1).max(1e3).optional()
8388
+ });
8389
+ /** What a footage source still holds, asked of the durable hour ledger. */
8390
+ var RelocateResidueInputSchema = object({
8391
+ fromLocationId: string().min(1),
8392
+ /** Narrow to one logical class; omit for every profile on the location. */
8393
+ footageClass: RelocateFootageClassSchema.optional()
8394
+ });
8395
+ /** `null` = the archive could not answer (no ledger on this node, or the
8396
+ * aggregate failed). Never conflated with an empty source. */
8397
+ var RelocateResidueSchema = object({
8398
+ segments: number().int().nonnegative(),
8399
+ bytes: number().int().nonnegative()
8400
+ }).nullable();
8401
+ /** How many rows a media pass would still act on against a given target — the
8402
+ * media lane's denominator AND its residue, from ONE derivation so the two can
8403
+ * never disagree. `null` = the count could not be taken. */
8404
+ var RelocatableMediaCountSchema = object({ rows: number().int().nonnegative() }).nullable();
8405
+ var RelocatableMediaCountInputSchema = object({
8406
+ toLocationId: string().min(1),
8407
+ /** Omitted = `move`. */
8408
+ mode: MediaRelocateModeSchema.optional()
8409
+ });
8410
+ /**
8236
8411
  * `StorageLocationType` — an addon-declared id that identifies the *kind* of
8237
8412
  * storage a location serves. Defined here (not in `capabilities/storage.cap.ts`)
8238
8413
  * so the persisted record schema and the consumer-facing cap can both consume it
@@ -8336,6 +8511,32 @@ var StorageLocationRefSchema = union([StorageLocationTypeSchema, string().regex(
8336
8511
  * two addons declaring the same `id` must agree on `cardinality` (validated
8337
8512
  * at kernel aggregation time, not here).
8338
8513
  */
8514
+ /**
8515
+ * `StorageAccess` — how the service that DECLARED a storage-location kind
8516
+ * actually reaches the bytes. It is the constraint that decides which
8517
+ * `storage-provider`s may back a location of that kind.
8518
+ *
8519
+ * - `'local-path'` — the service asks `storage.resolve` for a path string and
8520
+ * then does its own `node:fs` I/O on it (the recorder's segment writer, the
8521
+ * post-analysis media roots). Only a provider that serves a genuine local
8522
+ * filesystem (`getProviderInfo().nodeLocal === true`) can satisfy that: a
8523
+ * remote provider's `resolve` returns a path on the REMOTE host, and
8524
+ * `fs.readdir` of it on this node either fails or — far worse — succeeds
8525
+ * against a same-named local directory that is something else entirely.
8526
+ *
8527
+ * - `'cap-mediated'` — every byte travels through the `storage` cap
8528
+ * (`read`/`write`, or `beginUpload`/`writeChunk`/`finalizeUpload`). The
8529
+ * service never sees a path, so any provider can back it. `backups` is the
8530
+ * one kind that qualifies today.
8531
+ *
8532
+ * Before this existed, `recordings` was unreachable by SFTP/S3/WebDAV only as
8533
+ * an EMERGENT property of how the recorder happened to be written. Nothing
8534
+ * refused the configuration; the first write simply went somewhere wrong, and
8535
+ * a recording write that goes wrong surfaces as a silent black window rather
8536
+ * than an error (the read path does not `stat`). This turns that accident into
8537
+ * a declared, enforced, testable refusal.
8538
+ */
8539
+ var StorageAccessSchema = _enum(["local-path", "cap-mediated"]);
8339
8540
  var StorageLocationDeclarationSchema = object({
8340
8541
  /**
8341
8542
  * Global location identifier, e.g. `recordings` or `recordingsLow`.
@@ -8355,6 +8556,19 @@ var StorageLocationDeclarationSchema = object({
8355
8556
  */
8356
8557
  cardinality: _enum(["single", "multi"]),
8357
8558
  /**
8559
+ * HOW the declaring service reaches the bytes — and therefore WHICH
8560
+ * providers may back a location of this kind. See {@link StorageAccessSchema}
8561
+ * and {@link STORAGE_ACCESS_FALLBACK}.
8562
+ *
8563
+ * Absent means `'local-path'`. That default is FAIL-CLOSED on purpose: it
8564
+ * can only over-restrict (refuse a remote provider for a kind that might
8565
+ * have coped) and never under-restrict. Declaring `'cap-mediated'` is the
8566
+ * permissive direction and is therefore never inferred — a repo guard
8567
+ * (`scripts/check-storage-access-declarations.ts`) refuses to let it be
8568
+ * reached by omission.
8569
+ */
8570
+ access: StorageAccessSchema.optional(),
8571
+ /**
8358
8572
  * When set, the default instance for this location inherits its resolved
8359
8573
  * root from the named location's default instance. Useful for derivative
8360
8574
  * slots (e.g. `recordingsLow` → `recordings`) so operators only need to
@@ -17897,8 +18111,10 @@ var TrackSchema = object({
17897
18111
  lastSeen: number(),
17898
18112
  /** Frame-rate position history (subject to maxPositionHistory cap). */
17899
18113
  positions: array(TrackPositionSchema).readonly(),
17900
- /** Periodic snapshots at snapshotIntervalMs cadence (subject to
17901
- * saveThumbnails policy). */
18114
+ /** Periodic snapshots at snapshotIntervalMs cadence — DEBUG media, produced
18115
+ * only while `MediaSettings.debugMediaEnabled` is on for the camera (D299;
18116
+ * the retired `saveThumbnails` used to gate this and the rolling
18117
+ * `lastFrame` together). Empty is the healthy default, not a capture gap. */
17902
18118
  snapshots: array(TrackSnapshotSchema).readonly(),
17903
18119
  /** Deduplicated zones the track has entered at least once. Zone IDS. */
17904
18120
  zonesVisited: array(string()).readonly(),
@@ -18758,7 +18974,10 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
18758
18974
  }), method(RelocateMediaInputSchema, object({ jobId: string() }), {
18759
18975
  kind: "mutation",
18760
18976
  auth: "admin"
18761
- }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(object({}), array(RelocateJobSchema).readonly(), {
18977
+ }), method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }), method(RelocatableMediaCountInputSchema, RelocatableMediaCountSchema, {
18978
+ kind: "query",
18979
+ auth: "admin"
18980
+ }), method(object({}), array(RelocateJobSchema).readonly(), {
18762
18981
  kind: "query",
18763
18982
  auth: "admin"
18764
18983
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
@@ -20717,6 +20936,9 @@ method(StorageMigrationInputSchema, StorageMigrationPlanSchema, { auth: "admin"
20717
20936
  }), method(object({ jobId: string().optional() }), StorageMigrationJobSchema.nullable(), { auth: "admin" }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
20718
20937
  kind: "mutation",
20719
20938
  auth: "admin"
20939
+ }), method(object({}), array(StorageMigrationMoverSchema).readonly(), { auth: "admin" }), method(object({}), array(StorageMigrationResidueSchema).readonly(), { auth: "admin" }), method(StorageMigrationDrainInputSchema, object({ jobId: string() }), {
20940
+ kind: "mutation",
20941
+ auth: "admin"
20720
20942
  });
20721
20943
  var ProviderInfoSchema = discriminatedUnion("shouldSaveDiskSpace", [object({
20722
20944
  providerId: string().min(1),
@@ -21115,12 +21337,38 @@ response: record(string(), unknown()) }), object({
21115
21337
  *
21116
21338
  * ## Why this is a capability and not a helper
21117
21339
  *
21118
- * Six stores in `addon-post-analysis` already hold vectors — object CLIP, face,
21119
- * plate, vehicle, identity, and the event store's derivatives — and every one of
21120
- * them keeps its vectors in a `JSON` settings-store column and ranks them by
21121
- * brute-force cosine in JS. Measured on the live hub that costs ~11.7 KB per row
21122
- * (512 floats as TEXT, `JSON.parse`d on every search) and made semantic search
21123
- * load 5,000 rows before ranking anything.
21340
+ * This capability was introduced with the claim that SIX stores in
21341
+ * `addon-post-analysis` held vectors in a `JSON` settings-store column — object
21342
+ * CLIP, face, plate, vehicle, identity, and the event store's derivatives. That
21343
+ * claim was never true, and leaving it here made five stores look like pending
21344
+ * work when three of them have no vector at all. Counted column by column on
21345
+ * 2026-08-30, exactly THREE ever held one:
21346
+ *
21347
+ * - `object-clip` — 512-dim CLIP image embedding, migrated 2026-08-06.
21348
+ * - `faces.embedding` — 512-dim ArcFace face embedding, migrated 2026-08-30.
21349
+ * - `identity-samples.embedding` — the same ArcFace vector for an ENROLLED
21350
+ * face, migrated 2026-08-30 into its OWN index (see below).
21351
+ *
21352
+ * `plates` and `vehicle-samples` store a plate STRING and a score; `vehicles`
21353
+ * and `identities` store a name; the event store stores no derivative vector.
21354
+ * They are not migration candidates and never were.
21355
+ *
21356
+ * Measured on the live hub the JSON encoding cost ~11.7 KB per row (512 floats
21357
+ * as TEXT, `JSON.parse`d on every search) and made semantic search load 5,000
21358
+ * rows before ranking anything.
21359
+ *
21360
+ * ## One index per COMPARISON, never per encoder
21361
+ *
21362
+ * `faces` and `identity-samples` hold the same 512 ArcFace dims from the same
21363
+ * model, and they still get two indexes. An index is a set of things that are
21364
+ * ranked against each other and that live and die together, and these two are
21365
+ * neither: a `faces` row is TRACK-OWNED and cascades away with its track under
21366
+ * a per-camera capacity cap, an `identity-samples` row is retention-EXEMPT
21367
+ * forever and is the gallery every recognition ranks against. One index would
21368
+ * mean every gallery load and every reconcile carried a filter whose failure
21369
+ * mode is either ranking a candidate against itself or reclaiming an enrolled
21370
+ * person's only sample. The dimension they share is not a reason to share an
21371
+ * index; the question they answer is, and it differs.
21124
21372
  *
21125
21373
  * The fix is not a faster loop, it is a different backend — and the backend
21126
21374
  * should be replaceable without touching six callers. So: a singleton
@@ -21225,7 +21473,20 @@ var VectorQueryResultSchema = object({
21225
21473
  */
21226
21474
  scanned: number(),
21227
21475
  /** True when the backend could not consider every row that passed the filter. */
21228
- truncated: boolean()
21476
+ truncated: boolean(),
21477
+ /**
21478
+ * The `topK` the backend actually ran with.
21479
+ *
21480
+ * Every backend has a ceiling — sqlite-vec's is 4,096 — and a caller asking
21481
+ * past it used to learn nothing but a boolean, from a WARN in the provider's
21482
+ * own log rather than in its answer. That is how an audit asking for 20,000
21483
+ * consumed 4,096 and reported `examined: 4096` as if it had walked the index,
21484
+ * for weeks. `truncated` says THAT the answer was short; this says BY HOW
21485
+ * MUCH, in the return value, where the caller cannot fail to see it.
21486
+ *
21487
+ * Equals the requested `topK` whenever nothing was lowered.
21488
+ */
21489
+ effectiveTopK: number().int().positive()
21229
21490
  });
21230
21491
  var VectorDeleteInputSchema = object({
21231
21492
  index: string(),
@@ -21254,6 +21515,68 @@ var VectorGetResultSchema = object({ items: array(object({
21254
21515
  id: string(),
21255
21516
  metadata: VectorMetadataSchema
21256
21517
  })) });
21518
+ /**
21519
+ * Ids to read back WITH their vectors.
21520
+ *
21521
+ * The sibling of {@link VectorGetResultSchema}, and deliberately a separate
21522
+ * method rather than a flag on it: `getByIds` promises no vectors and its one
21523
+ * caller depends on that promise. This one promises the opposite.
21524
+ *
21525
+ * It exists because a store cannot put its vectors here otherwise. An ArcFace
21526
+ * gallery is ranked IN PROCESS, per detection, against every enrolled sample —
21527
+ * a per-face cross-process KNN would be a network round trip inside the
21528
+ * recognition loop. So the gallery is loaded once and held in RAM, and loading
21529
+ * it requires the index to hand the floats back. Without this method the only
21530
+ * way to keep a readable vector is a JSON column, which is the thing this
21531
+ * capability exists to delete.
21532
+ *
21533
+ * BOUNDED BY THE CALLER: ids are named, never "everything". Enumerating an
21534
+ * index is {@link VectorScanInputSchema}'s job, and it returns no vectors.
21535
+ */
21536
+ var VectorFetchInputSchema = object({
21537
+ index: string(),
21538
+ ids: array(string())
21539
+ });
21540
+ var VectorFetchResultSchema = object({ items: array(object({
21541
+ id: string(),
21542
+ /** base64 Float32LE — the same wire form `upsert` accepts. */
21543
+ vector: string(),
21544
+ metadata: VectorMetadataSchema
21545
+ })) });
21546
+ /**
21547
+ * ENUMERATE an index: one page of rows in a stable order, no ranking.
21548
+ *
21549
+ * A reconcile does not want the nearest rows, it wants ALL of them, and asking
21550
+ * a KNN for "all" is the wrong question twice over. It hits the backend's `k`
21551
+ * ceiling — 4,096 on sqlite-vec against a 22,128-row index — and it needs a
21552
+ * probe vector it does not have, so the audit passed a ZERO vector whose cosine
21553
+ * distance to every row is degenerate. `examined: 4096` then read as "we
21554
+ * looked" for as long as anyone cared to read it.
21555
+ *
21556
+ * This is the primitive that question actually needs: a bounded page, ordered
21557
+ * by the backend's own row order, costing no distance computation at all.
21558
+ * Vectors are NOT returned — an enumeration that shipped 2 KB per row would be
21559
+ * the full-table read this capability was built to stop.
21560
+ */
21561
+ var VectorScanInputSchema = object({
21562
+ index: string(),
21563
+ /** Opaque resume point. `0` starts at the top; pass back `nextCursor`. */
21564
+ cursor: number().int().nonnegative().default(0),
21565
+ limit: number().int().positive()
21566
+ });
21567
+ var VectorScanResultSchema = object({
21568
+ items: array(object({
21569
+ id: string(),
21570
+ metadata: VectorMetadataSchema
21571
+ })),
21572
+ /**
21573
+ * Where the next page starts, or `null` when the walk reached the end.
21574
+ *
21575
+ * `null` is the ONLY end-of-index signal. A caller must not infer the end
21576
+ * from a short page: a backend is free to return fewer rows than asked.
21577
+ */
21578
+ nextCursor: number().int().nonnegative().nullable()
21579
+ });
21257
21580
  var VectorStatsInputSchema = object({ index: string() });
21258
21581
  var VectorStatsResultSchema = object({
21259
21582
  /** Provider id, so an operator can tell brute force from an ANN index. */
@@ -21272,7 +21595,7 @@ method(VectorDeclareIndexInputSchema, _void(), {
21272
21595
  }), method(VectorUpsertInputSchema, VectorUpsertResultSchema, {
21273
21596
  kind: "mutation",
21274
21597
  auth: "admin"
21275
- }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21598
+ }), method(VectorQueryInputSchema, VectorQueryResultSchema, { auth: "admin" }), method(VectorGetInputSchema, VectorGetResultSchema, { auth: "admin" }), method(VectorFetchInputSchema, VectorFetchResultSchema, { auth: "admin" }), method(VectorScanInputSchema, VectorScanResultSchema, { auth: "admin" }), method(VectorDeleteInputSchema, VectorDeleteResultSchema, {
21276
21599
  kind: "mutation",
21277
21600
  auth: "admin"
21278
21601
  }), method(VectorDeleteByFilterInputSchema, VectorDeleteResultSchema, {
@@ -26237,6 +26560,9 @@ method(object({
26237
26560
  }), method(object({}), array(RelocateJobSchema).readonly(), {
26238
26561
  kind: "query",
26239
26562
  auth: "admin"
26563
+ }), method(RelocateResidueInputSchema, RelocateResidueSchema, {
26564
+ kind: "query",
26565
+ auth: "admin"
26240
26566
  }), method(object({ jobId: string() }), object({ cancelled: boolean() }), {
26241
26567
  kind: "mutation",
26242
26568
  auth: "admin"
@@ -31202,6 +31528,12 @@ Object.freeze({
31202
31528
  addonId: null,
31203
31529
  access: "create"
31204
31530
  },
31531
+ "pipelineAnalytics.countRelocatableMedia": {
31532
+ capName: "pipeline-analytics",
31533
+ capScope: "device",
31534
+ addonId: null,
31535
+ access: "view"
31536
+ },
31205
31537
  "pipelineAnalytics.countUnstampedEventMedia": {
31206
31538
  capName: "pipeline-analytics",
31207
31539
  capScope: "device",
@@ -32366,6 +32698,12 @@ Object.freeze({
32366
32698
  addonId: null,
32367
32699
  access: "view"
32368
32700
  },
32701
+ "recording.getRelocateResidue": {
32702
+ capName: "recording",
32703
+ capScope: "system",
32704
+ addonId: null,
32705
+ access: "view"
32706
+ },
32369
32707
  "recording.getStorageMigrationMoveStatus": {
32370
32708
  capName: "recording",
32371
32709
  capScope: "system",
@@ -32912,12 +33250,30 @@ Object.freeze({
32912
33250
  addonId: null,
32913
33251
  access: "create"
32914
33252
  },
33253
+ "storageMigration.drain": {
33254
+ capName: "storage-migration",
33255
+ capScope: "system",
33256
+ addonId: null,
33257
+ access: "create"
33258
+ },
33259
+ "storageMigration.movers": {
33260
+ capName: "storage-migration",
33261
+ capScope: "system",
33262
+ addonId: null,
33263
+ access: "view"
33264
+ },
32915
33265
  "storageMigration.plan": {
32916
33266
  capName: "storage-migration",
32917
33267
  capScope: "system",
32918
33268
  addonId: null,
32919
33269
  access: "view"
32920
33270
  },
33271
+ "storageMigration.residue": {
33272
+ capName: "storage-migration",
33273
+ capScope: "system",
33274
+ addonId: null,
33275
+ access: "view"
33276
+ },
32921
33277
  "storageMigration.start": {
32922
33278
  capName: "storage-migration",
32923
33279
  capScope: "system",
@@ -33752,6 +34108,12 @@ Object.freeze({
33752
34108
  addonId: null,
33753
34109
  access: "delete"
33754
34110
  },
34111
+ "vectorStore.fetchByIds": {
34112
+ capName: "vector-store",
34113
+ capScope: "system",
34114
+ addonId: null,
34115
+ access: "view"
34116
+ },
33755
34117
  "vectorStore.getByIds": {
33756
34118
  capName: "vector-store",
33757
34119
  capScope: "system",
@@ -33764,6 +34126,12 @@ Object.freeze({
33764
34126
  addonId: null,
33765
34127
  access: "view"
33766
34128
  },
34129
+ "vectorStore.scan": {
34130
+ capName: "vector-store",
34131
+ capScope: "system",
34132
+ addonId: null,
34133
+ access: "view"
34134
+ },
33767
34135
  "vectorStore.stats": {
33768
34136
  capName: "vector-store",
33769
34137
  capScope: "system",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-Bzn0_Gfg.js");
5
+ const require_dist = require("../dist-B81Rw6ym.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/ingress/tailscale-cli.ts
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-cWp3ATn9.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-Tyu2rQxG.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-tailscale",
3
- "version": "1.2.43",
3
+ "version": "1.2.46",
4
4
  "description": "Tailscale bundle for CamStack — joins the host to a tailnet (client) and exposes the hub via Serve/Funnel (ingress). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",