@camstack/addon-post-analysis 1.2.150 → 1.2.152

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.
@@ -8273,6 +8273,21 @@ var RelocateJobSchema = object({
8273
8273
  bytesMoved: number().int(),
8274
8274
  /** Total files discovered up front; null while (or when) unknown. */
8275
8275
  filesTotal: number().int().nullable(),
8276
+ /**
8277
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8278
+ * made that nobody asked for, so it is reported where the operator reads the
8279
+ * job rather than only in a log line.
8280
+ *
8281
+ * A footage segment records its byte count in its own NAME, and the durable
8282
+ * hour row derives its aggregates from those names. A file that does not
8283
+ * match its name therefore makes the ledger's sums — and with them quota and
8284
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8285
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8286
+ *
8287
+ * Absent on lanes where the question has no meaning: a media blob's size is
8288
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8289
+ */
8290
+ rowsReconciled: number().int().nonnegative().optional(),
8276
8291
  startedAt: number(),
8277
8292
  finishedAt: number().nullable(),
8278
8293
  error: string().nullable()
@@ -8341,14 +8356,42 @@ var RelocateMediaInputSchema = object({
8341
8356
  /** Omitted = `move`, the pre-existing behaviour. */
8342
8357
  mode: MediaRelocateModeSchema.optional()
8343
8358
  });
8344
- /** How many rows still carry NO `locationId` — the population a repoint would
8345
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8346
- * value that permits a non-blocking `eventMedia` cutover. */
8347
- var UnstampedEventMediaCountSchema = object({
8348
- media: number().int().nonnegative(),
8349
- retrainFrames: number().int().nonnegative(),
8350
- total: number().int().nonnegative()
8359
+ /**
8360
+ * The unstamped population of ONE collection — split, because the gate and the
8361
+ * operator ask two different questions and only one of them has to be cheap.
8362
+ *
8363
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8364
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8365
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8366
+ * that matters — after a seal, when the population is empty.
8367
+ *
8368
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8369
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8370
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8371
+ * and useful answer: "there are some, and this read could not say how many"
8372
+ * still refuses the cutover, which is the whole job.
8373
+ */
8374
+ var UnstampedRowsSchema = object({
8375
+ present: boolean(),
8376
+ rows: number().int().nonnegative().nullable()
8351
8377
  });
8378
+ /**
8379
+ * How many rows still carry NO `locationId` — the population a repoint would
8380
+ * silently re-aim at a disk that does not hold their bytes.
8381
+ *
8382
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8383
+ * over. The gate opens on a measured absence and on nothing else; an unread
8384
+ * collection and an empty one are different facts, and this repo has already
8385
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8386
+ */
8387
+ var UnstampedEventMediaCountSchema = object({
8388
+ media: UnstampedRowsSchema,
8389
+ retrainFrames: UnstampedRowsSchema,
8390
+ /** True when EITHER collection holds one. The refusal reads this. */
8391
+ anyPresent: boolean(),
8392
+ /** Sum across both, or `null` when either lane could not be counted. */
8393
+ total: number().int().nonnegative().nullable()
8394
+ }).nullable();
8352
8395
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8353
8396
  /** The independently selectable logical storage classes — every class
8354
8397
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8459,6 +8502,10 @@ var StorageMigrationMoveProgressSchema = object({
8459
8502
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8460
8503
  filesTotal: number().int().nonnegative().nullable(),
8461
8504
  bytesMoved: number().int().nonnegative(),
8505
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8506
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8507
+ * rows would be the same failure as one that silently skipped them. */
8508
+ rowsReconciled: number().int().nonnegative().optional(),
8462
8509
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8463
8510
  * crash gets a new mover, and a rate computed from the migration's start
8464
8511
  * would silently average in the time nothing was running. */
@@ -13520,6 +13567,133 @@ var embeddingEncoderCapability = {
13520
13567
  }
13521
13568
  };
13522
13569
  /**
13570
+ * `failure-contribution` — the capability an addon reports its OWN losses
13571
+ * through, per camera, with the denominator attached. It stores nothing.
13572
+ *
13573
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13574
+ *
13575
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13576
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13577
+ * copied: the contributor reports what it already knows, hub-main adds only
13578
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13579
+ * somebody to forget to edit.
13580
+ *
13581
+ * They are not merged, because their invariants are opposites:
13582
+ *
13583
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13584
+ * claim a camera cost nothing, which is a measurement nobody made;
13585
+ * - a `failure-contribution` zero is the **most valuable value on the
13586
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13587
+ * and it is exactly what an absent entry cannot say.
13588
+ *
13589
+ * Putting a loss counter on a cost entry would also break the reconciliation
13590
+ * that gives `load-contribution` its point: contributions are subtracted from
13591
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13592
+ * has no process.
13593
+ *
13594
+ * ## Why not a log line, since the counters already exist
13595
+ *
13596
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13597
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13598
+ * ends in a log line, and a log line is the thing the operator asked to stop
13599
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13600
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13601
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13602
+ * media blackout were both diagnosed. The counters stay; this is where they can
13603
+ * be READ.
13604
+ *
13605
+ * ## The rate is served with its denominator or not at all
13606
+ *
13607
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13608
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13609
+ * than yesterday" and was **flat across twelve hours** once divided by the
13610
+ * successes on the same path. A surface that publishes only the numerator
13611
+ * reproduces that mistake on every read.
13612
+ *
13613
+ * ## Shape
13614
+ *
13615
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13616
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13617
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13618
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13619
+ * a forked runner's entries reach hub-main over transport that already exists.
13620
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13621
+ * result through `system.getFailureContributions`.
13622
+ */
13623
+ var FailureReasonCountSchema = object({
13624
+ /**
13625
+ * Why the attempt did not land, in the contributor's own vocabulary —
13626
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13627
+ * strings that already appear in this repo's logs and, where one exists, the
13628
+ * same string the per-track `previewMissReason` records (D276): a second
13629
+ * vocabulary for the same loss would make the row and the counter
13630
+ * un-joinable.
13631
+ */
13632
+ reason: string(),
13633
+ count: number().int().nonnegative()
13634
+ });
13635
+ var FailureContributionSchema = object({
13636
+ /**
13637
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13638
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13639
+ * `unit` free: the families are owned by different addons and a shared enum
13640
+ * is a central list that rots invisibly.
13641
+ */
13642
+ family: string(),
13643
+ /**
13644
+ * The NUMERIC device id — the same value every log line carries as
13645
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13646
+ * cannot name the camera must not emit the entry, because a fleet total
13647
+ * cannot answer the only question anybody asks of this surface.
13648
+ */
13649
+ deviceId: number().int().positive(),
13650
+ /**
13651
+ * A second dimension inside the family: the model / step id for an inference
13652
+ * timeout, so "which camera AND which model" is one read. Absent when the
13653
+ * family has a single variant.
13654
+ */
13655
+ variant: string().optional(),
13656
+ /**
13657
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13658
+ * differencing two reads must drop the interval when it changes, because the
13659
+ * counter restarted from zero in a respawned runner. Same discipline as
13660
+ * `LoadContribution.startedAtMs`.
13661
+ */
13662
+ sinceMs: number(),
13663
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13664
+ atMs: number(),
13665
+ /**
13666
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13667
+ * window. A failure count published without it is the mistake this schema
13668
+ * exists to make impossible.
13669
+ */
13670
+ attempts: number().int().nonnegative(),
13671
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13672
+ succeeded: number().int().nonnegative(),
13673
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13674
+ reasons: array(FailureReasonCountSchema).readonly()
13675
+ });
13676
+ var failureContributionCapability = {
13677
+ name: "failure-contribution",
13678
+ scope: "system",
13679
+ mode: "collection",
13680
+ internal: true,
13681
+ methods: {
13682
+ /**
13683
+ * This addon's per-camera failure counters, read live from bounded in-RAM
13684
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
13685
+ *
13686
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
13687
+ * consumer that wants a rate differences two reads. A draining read would
13688
+ * make two operators with the page open each destroy half of the other's
13689
+ * numbers, and `load-contribution` already settled the same question the
13690
+ * same way for `cpuSeconds`.
13691
+ */
13692
+ list: method(_void(), array(FailureContributionSchema).readonly()) },
13693
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
13694
+ mount: { kind: "skip" }
13695
+ };
13696
+ /**
13523
13697
  * filesystem-browse — per-node capability for browsing the node's local
13524
13698
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13525
13699
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -14041,6 +14215,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14041
14215
  kind: "mutation",
14042
14216
  auth: "admin"
14043
14217
  });
14218
+ var LoadContributionSchema = object({
14219
+ role: _enum([
14220
+ "decode",
14221
+ "transcode",
14222
+ "recording",
14223
+ "streaming",
14224
+ "detection"
14225
+ ]),
14226
+ /**
14227
+ * The NUMERIC device id — the same value every log line carries as
14228
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14229
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14230
+ * contributor that cannot name its camera must not emit the entry at all,
14231
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14232
+ * and would quietly turn one camera's cost into everybody's.
14233
+ */
14234
+ deviceId: number().int().positive().nullable(),
14235
+ attribution: _enum([
14236
+ "measured",
14237
+ "accounted",
14238
+ "unattributable"
14239
+ ]),
14240
+ /**
14241
+ * What ONE entry is, in the contributor's own words — `615/high`,
14242
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14243
+ * family and inventing a common one would lose the only information that
14244
+ * makes two entries for the same camera distinguishable.
14245
+ */
14246
+ unit: string(),
14247
+ /**
14248
+ * The OS process this cost lives in, when there is one. Present so a
14249
+ * consumer can (a) tell two generations of the same unit apart across a
14250
+ * restart, and (b) subtract claimed processes from the node's process
14251
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14252
+ * process of its own.
14253
+ */
14254
+ pid: number().int().positive().optional(),
14255
+ /**
14256
+ * When this generation started. The pid's incarnation marker: a consumer
14257
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14258
+ * window when this changes, because the counter restarted from zero in a new
14259
+ * process.
14260
+ */
14261
+ startedAtMs: number().optional(),
14262
+ /**
14263
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14264
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14265
+ * contribution is asked for.
14266
+ *
14267
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14268
+ * needs a sampler, and a new per-node sampler is the defect half of
14269
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14270
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14271
+ *
14272
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14273
+ * an entry with no process.
14274
+ */
14275
+ cpuSeconds: number().optional(),
14276
+ /** Resident bytes of this unit's process, same source and same rules. */
14277
+ rssBytes: number().optional()
14278
+ });
14279
+ method(_void(), array(LoadContributionSchema).readonly());
14044
14280
  /**
14045
14281
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
14046
14282
  * through. It stores nothing.
@@ -14117,195 +14353,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14117
14353
  tags: record(string(), string()).optional()
14118
14354
  }), array(LogEntrySchema).readonly());
14119
14355
  /**
14120
- * `failure-contribution` — the capability an addon reports its OWN losses
14121
- * through, per camera, with the denominator attached. It stores nothing.
14122
- *
14123
- * ## The twin of `load-contribution`, and why it is a twin and not a field
14124
- *
14125
- * `load-contribution` answers *what did this camera COST*. This answers *what
14126
- * did this camera LOSE*. The reporting discipline is identical and deliberately
14127
- * copied: the contributor reports what it already knows, hub-main adds only
14128
- * `addonId`, nothing needs global knowledge, and there is no central list for
14129
- * somebody to forget to edit.
14130
- *
14131
- * They are not merged, because their invariants are opposites:
14132
- *
14133
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
14134
- * claim a camera cost nothing, which is a measurement nobody made;
14135
- * - a `failure-contribution` zero is the **most valuable value on the
14136
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14137
- * and it is exactly what an absent entry cannot say.
14138
- *
14139
- * Putting a loss counter on a cost entry would also break the reconciliation
14140
- * that gives `load-contribution` its point: contributions are subtracted from
14141
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14142
- * has no process.
14143
- *
14144
- * ## Why not a log line, since the counters already exist
14145
- *
14146
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14147
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14148
- * ends in a log line, and a log line is the thing the operator asked to stop
14149
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14150
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14151
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14152
- * media blackout were both diagnosed. The counters stay; this is where they can
14153
- * be READ.
14154
- *
14155
- * ## The rate is served with its denominator or not at all
14156
- *
14157
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14158
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14159
- * than yesterday" and was **flat across twelve hours** once divided by the
14160
- * successes on the same path. A surface that publishes only the numerator
14161
- * reproduces that mistake on every read.
14162
- *
14163
- * ## Shape
14164
- *
14165
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14166
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14167
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14168
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14169
- * a forked runner's entries reach hub-main over transport that already exists.
14170
- * No new UDS message, no second registry (D3). The operator reads the assembled
14171
- * result through `system.getFailureContributions`.
14172
- */
14173
- var FailureReasonCountSchema = object({
14174
- /**
14175
- * Why the attempt did not land, in the contributor's own vocabulary —
14176
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14177
- * strings that already appear in this repo's logs and, where one exists, the
14178
- * same string the per-track `previewMissReason` records (D276): a second
14179
- * vocabulary for the same loss would make the row and the counter
14180
- * un-joinable.
14181
- */
14182
- reason: string(),
14183
- count: number().int().nonnegative()
14184
- });
14185
- var FailureContributionSchema = object({
14186
- /**
14187
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14188
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14189
- * `unit` free: the families are owned by different addons and a shared enum
14190
- * is a central list that rots invisibly.
14191
- */
14192
- family: string(),
14193
- /**
14194
- * The NUMERIC device id — the same value every log line carries as
14195
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14196
- * cannot name the camera must not emit the entry, because a fleet total
14197
- * cannot answer the only question anybody asks of this surface.
14198
- */
14199
- deviceId: number().int().positive(),
14200
- /**
14201
- * A second dimension inside the family: the model / step id for an inference
14202
- * timeout, so "which camera AND which model" is one read. Absent when the
14203
- * family has a single variant.
14204
- */
14205
- variant: string().optional(),
14206
- /**
14207
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14208
- * differencing two reads must drop the interval when it changes, because the
14209
- * counter restarted from zero in a respawned runner. Same discipline as
14210
- * `LoadContribution.startedAtMs`.
14211
- */
14212
- sinceMs: number(),
14213
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14214
- atMs: number(),
14215
- /**
14216
- * THE DENOMINATOR — every attempt on this path for this camera in the
14217
- * window. A failure count published without it is the mistake this schema
14218
- * exists to make impossible.
14219
- */
14220
- attempts: number().int().nonnegative(),
14221
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14222
- succeeded: number().int().nonnegative(),
14223
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14224
- reasons: array(FailureReasonCountSchema).readonly()
14225
- });
14226
- var failureContributionCapability = {
14227
- name: "failure-contribution",
14228
- scope: "system",
14229
- mode: "collection",
14230
- internal: true,
14231
- methods: {
14232
- /**
14233
- * This addon's per-camera failure counters, read live from bounded in-RAM
14234
- * state it already keeps. Inert: no persistence, no sampling, no timer.
14235
- *
14236
- * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
14237
- * consumer that wants a rate differences two reads. A draining read would
14238
- * make two operators with the page open each destroy half of the other's
14239
- * numbers, and `load-contribution` already settled the same question the
14240
- * same way for `cpuSeconds`.
14241
- */
14242
- list: method(_void(), array(FailureContributionSchema).readonly()) },
14243
- /** In-process only — enumerated through `addons.listCapabilityProviders`. */
14244
- mount: { kind: "skip" }
14245
- };
14246
- var LoadContributionSchema = object({
14247
- role: _enum([
14248
- "decode",
14249
- "transcode",
14250
- "recording",
14251
- "streaming",
14252
- "detection"
14253
- ]),
14254
- /**
14255
- * The NUMERIC device id — the same value every log line carries as
14256
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14257
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14258
- * contributor that cannot name its camera must not emit the entry at all,
14259
- * because an unnamed per-camera entry is indistinguishable from a shared one
14260
- * and would quietly turn one camera's cost into everybody's.
14261
- */
14262
- deviceId: number().int().positive().nullable(),
14263
- attribution: _enum([
14264
- "measured",
14265
- "accounted",
14266
- "unattributable"
14267
- ]),
14268
- /**
14269
- * What ONE entry is, in the contributor's own words — `615/high`,
14270
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14271
- * family and inventing a common one would lose the only information that
14272
- * makes two entries for the same camera distinguishable.
14273
- */
14274
- unit: string(),
14275
- /**
14276
- * The OS process this cost lives in, when there is one. Present so a
14277
- * consumer can (a) tell two generations of the same unit apart across a
14278
- * restart, and (b) subtract claimed processes from the node's process
14279
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14280
- * process of its own.
14281
- */
14282
- pid: number().int().positive().optional(),
14283
- /**
14284
- * When this generation started. The pid's incarnation marker: a consumer
14285
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14286
- * window when this changes, because the counter restarted from zero in a new
14287
- * process.
14288
- */
14289
- startedAtMs: number().optional(),
14290
- /**
14291
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14292
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14293
- * contribution is asked for.
14294
- *
14295
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14296
- * needs a sampler, and a new per-node sampler is the defect half of
14297
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14298
- * by whoever already keeps a history; a rate cannot be un-averaged.
14299
- *
14300
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14301
- * an entry with no process.
14302
- */
14303
- cpuSeconds: number().optional(),
14304
- /** Resident bytes of this unit's process, same source and same rules. */
14305
- rssBytes: number().optional()
14306
- });
14307
- method(_void(), array(LoadContributionSchema).readonly());
14308
- /**
14309
14356
  * `login-method` — collection cap through which auth addons contribute
14310
14357
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14311
14358
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -19671,12 +19718,53 @@ var MediaFileKindEnum = _enum([
19671
19718
  "keyFrameSmall",
19672
19719
  "thumbnailSmall"
19673
19720
  ]);
19721
+ /**
19722
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
19723
+ * ARE — never the bytes themselves.
19724
+ *
19725
+ * ## Why `url` and not `base64`
19726
+ *
19727
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
19728
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
19729
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
19730
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
19731
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
19732
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
19733
+ *
19734
+ * `url` points at the `event-media` data plane
19735
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
19736
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
19737
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
19738
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
19739
+ * no less protected than they were inside a `view`-level cap response — see
19740
+ * `data-plane-access.ts` for the rule and the one gap it does not close
19741
+ * (per-device scoping).
19742
+ *
19743
+ * The URL is built from the row's **stored** key, which is not always its
19744
+ * published `kind`: a track's face/plate crop is stored as `crop` under
19745
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
19746
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
19747
+ *
19748
+ * ## `base64` is TRANSITIONAL and is going away
19749
+ *
19750
+ * It is still populated for one reason: the deployed viewer's track-detail
19751
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
19752
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
19753
+ * triangle — not as absence. Removing the field before that viewer ships is an
19754
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
19755
+ * delete this line and the `withBytes` pass-through in
19756
+ * `analytics-query-facade.ts`; nothing else reads it.
19757
+ */
19674
19758
  var MediaFileSchema = object({
19675
19759
  key: string(),
19676
19760
  kind: MediaFileKindEnum,
19677
- base64: string(),
19678
19761
  sizeBytes: number(),
19679
19762
  timestamp: number()
19763
+ }).extend({
19764
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
19765
+ url: string(),
19766
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
19767
+ base64: string()
19680
19768
  });
19681
19769
  /**
19682
19770
  * One media row WITHOUT its bytes.
@@ -19688,7 +19776,9 @@ var MediaFileSchema = object({
19688
19776
  * blocks the whole view.
19689
19777
  *
19690
19778
  * `sizeBytes` is carried because it is what lets a client decide between the
19691
- * stored blob and a `?variant=thumb` rendering without fetching either.
19779
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
19780
+ * `url` because a client that had to build the plane path itself is a second
19781
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
19692
19782
  */
19693
19783
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
19694
19784
  /**
@@ -20486,6 +20576,17 @@ var pipelineAnalyticsCapability = {
20486
20576
  * happens to stamp it. This count is what the migration planner's
20487
20577
  * non-blocking gate reads; `relocateMedia({ mode: 'seal' })` is what drives
20488
20578
  * it to zero.
20579
+ *
20580
+ * TWO indexed statements per collection, not a walk. It used to page the
20581
+ * whole collection at 200 rows per RPC ordered by an unindexed column, so
20582
+ * on the live hub — 1 254 576 rows — it hit the 60 s RPC deadline every
20583
+ * time it was called, and the migration it gates could never start. The
20584
+ * cheap question (`present`: is there at least one) is asked first and
20585
+ * separately from the expensive one (`rows`), because only the first has
20586
+ * to be answerable for the gate to do its job.
20587
+ *
20588
+ * **`null` is "not measurable", never zero** — at either level. An
20589
+ * unreadable collection must not read as a sealed one.
20489
20590
  */
20490
20591
  countUnstampedEventMedia: method(object({}), UnstampedEventMediaCountSchema, { auth: "admin" }),
20491
20592
  /**
@@ -20809,6 +20910,26 @@ var pipelineAnalyticsCapability = {
20809
20910
  deviceId: number()
20810
20911
  }), array(MediaFileInfoSchema).readonly()),
20811
20912
  /**
20913
+ * What media an EVENT has, without any of it — the twin `getEventMedia`
20914
+ * never had.
20915
+ *
20916
+ * `listTrackMedia` above got this treatment because a track's media is
20917
+ * 5-8 MB. An event's is worse per row, not better: an old-style event owns
20918
+ * a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
20919
+ * modal — the one surface that legitimately shows the big kinds — unions
20920
+ * both listings to build its filmstrip. It then renders every tile from
20921
+ * the `event-media` plane by key and throws the bytes away. Measured on
20922
+ * the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
20923
+ * ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
20924
+ *
20925
+ * Same `deviceId` authorization subject as `getEventMedia`, and the same
20926
+ * rows — this is a projection of that method, never a different question.
20927
+ */
20928
+ listEventMedia: method(object({
20929
+ eventId: string(),
20930
+ deviceId: number()
20931
+ }), array(MediaFileInfoSchema).readonly()),
20932
+ /**
20812
20933
  * Search object events by text query using CLIP cosine similarity.
20813
20934
  * Encodes `text` via the `embedding-encoder` cap, queries the
20814
20935
  * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
@@ -25872,10 +25993,24 @@ var FaceClusterSchema = object({
25872
25993
  size: number().int(),
25873
25994
  cohesion: number()
25874
25995
  });
25996
+ /**
25997
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25998
+ * are — never the bytes.
25999
+ *
26000
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26001
+ * track/event contract) is still populated because a deployed viewer requires
26002
+ * the field to parse a row at all; this method has no such reader. Its ONE
26003
+ * caller is the admin UI's detail modal, which was building
26004
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26005
+ * dialog already rendering its key FRAME from the `event-media` plane.
26006
+ *
26007
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26008
+ * media key directly, so this needed no new plane and no new access decision.
26009
+ */
25875
26010
  var MediaFileLiteSchema$1 = object({
25876
26011
  key: string(),
25877
26012
  kind: string(),
25878
- base64: string(),
26013
+ url: string(),
25879
26014
  sizeBytes: number(),
25880
26015
  timestamp: number()
25881
26016
  });
@@ -28923,10 +29058,24 @@ var PlateInfoSchema = object({
28923
29058
  */
28924
29059
  cropUrl: string().optional()
28925
29060
  });
29061
+ /**
29062
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
29063
+ * are — never the bytes.
29064
+ *
29065
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
29066
+ * track/event contract) is still populated because a deployed viewer requires
29067
+ * the field to parse a row at all; this method has no such reader. Its ONE
29068
+ * caller is the admin UI's detail modal, which was building
29069
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
29070
+ * dialog already rendering its key FRAME from the `event-media` plane.
29071
+ *
29072
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
29073
+ * media key directly, so this needed no new plane and no new access decision.
29074
+ */
28926
29075
  var MediaFileLiteSchema = object({
28927
29076
  key: string(),
28928
29077
  kind: string(),
28929
- base64: string(),
29078
+ url: string(),
28930
29079
  sizeBytes: number(),
28931
29080
  timestamp: number()
28932
29081
  });
@@ -37074,6 +37223,12 @@ Object.freeze({
37074
37223
  addonId: null,
37075
37224
  access: "view"
37076
37225
  },
37226
+ "pipelineAnalytics.listEventMedia": {
37227
+ capName: "pipeline-analytics",
37228
+ capScope: "device",
37229
+ addonId: null,
37230
+ access: "view"
37231
+ },
37077
37232
  "pipelineAnalytics.listGroups": {
37078
37233
  capName: "pipeline-analytics",
37079
37234
  capScope: "device",
@@ -40697,6 +40852,11 @@ Object.freeze({
40697
40852
  form: "array",
40698
40853
  optional: false
40699
40854
  }],
40855
+ "pipelineAnalytics.listEventMedia": [{
40856
+ name: "deviceId",
40857
+ form: "single",
40858
+ optional: false
40859
+ }],
40700
40860
  "pipelineAnalytics.listGroups": [{
40701
40861
  name: "deviceIds",
40702
40862
  form: "array",