@camstack/addon-export-google 0.1.9 → 0.1.11

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.
@@ -8196,6 +8196,21 @@ var RelocateJobSchema = object({
8196
8196
  bytesMoved: number().int(),
8197
8197
  /** Total files discovered up front; null while (or when) unknown. */
8198
8198
  filesTotal: number().int().nullable(),
8199
+ /**
8200
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8201
+ * made that nobody asked for, so it is reported where the operator reads the
8202
+ * job rather than only in a log line.
8203
+ *
8204
+ * A footage segment records its byte count in its own NAME, and the durable
8205
+ * hour row derives its aggregates from those names. A file that does not
8206
+ * match its name therefore makes the ledger's sums — and with them quota and
8207
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8208
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8209
+ *
8210
+ * Absent on lanes where the question has no meaning: a media blob's size is
8211
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8212
+ */
8213
+ rowsReconciled: number().int().nonnegative().optional(),
8199
8214
  startedAt: number(),
8200
8215
  finishedAt: number().nullable(),
8201
8216
  error: string().nullable()
@@ -8264,14 +8279,42 @@ var RelocateMediaInputSchema = object({
8264
8279
  /** Omitted = `move`, the pre-existing behaviour. */
8265
8280
  mode: MediaRelocateModeSchema.optional()
8266
8281
  });
8267
- /** How many rows still carry NO `locationId` — the population a repoint would
8268
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8269
- * value that permits a non-blocking `eventMedia` cutover. */
8270
- var UnstampedEventMediaCountSchema = object({
8271
- media: number().int().nonnegative(),
8272
- retrainFrames: number().int().nonnegative(),
8273
- total: number().int().nonnegative()
8282
+ /**
8283
+ * The unstamped population of ONE collection — split, because the gate and the
8284
+ * operator ask two different questions and only one of them has to be cheap.
8285
+ *
8286
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8287
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8288
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8289
+ * that matters — after a seal, when the population is empty.
8290
+ *
8291
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8292
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8293
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8294
+ * and useful answer: "there are some, and this read could not say how many"
8295
+ * still refuses the cutover, which is the whole job.
8296
+ */
8297
+ var UnstampedRowsSchema = object({
8298
+ present: boolean(),
8299
+ rows: number().int().nonnegative().nullable()
8274
8300
  });
8301
+ /**
8302
+ * How many rows still carry NO `locationId` — the population a repoint would
8303
+ * silently re-aim at a disk that does not hold their bytes.
8304
+ *
8305
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8306
+ * over. The gate opens on a measured absence and on nothing else; an unread
8307
+ * collection and an empty one are different facts, and this repo has already
8308
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8309
+ */
8310
+ var UnstampedEventMediaCountSchema = object({
8311
+ media: UnstampedRowsSchema,
8312
+ retrainFrames: UnstampedRowsSchema,
8313
+ /** True when EITHER collection holds one. The refusal reads this. */
8314
+ anyPresent: boolean(),
8315
+ /** Sum across both, or `null` when either lane could not be counted. */
8316
+ total: number().int().nonnegative().nullable()
8317
+ }).nullable();
8275
8318
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8276
8319
  /** The independently selectable logical storage classes — every class
8277
8320
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8382,6 +8425,10 @@ var StorageMigrationMoveProgressSchema = object({
8382
8425
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8383
8426
  filesTotal: number().int().nonnegative().nullable(),
8384
8427
  bytesMoved: number().int().nonnegative(),
8428
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8429
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8430
+ * rows would be the same failure as one that silently skipped them. */
8431
+ rowsReconciled: number().int().nonnegative().optional(),
8385
8432
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8386
8433
  * crash gets a new mover, and a rate computed from the migration's start
8387
8434
  * would silently average in the time nothing was running. */
@@ -13139,6 +13186,114 @@ method(object({
13139
13186
  height: number()
13140
13187
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13141
13188
  /**
13189
+ * `failure-contribution` — the capability an addon reports its OWN losses
13190
+ * through, per camera, with the denominator attached. It stores nothing.
13191
+ *
13192
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13193
+ *
13194
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13195
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13196
+ * copied: the contributor reports what it already knows, hub-main adds only
13197
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13198
+ * somebody to forget to edit.
13199
+ *
13200
+ * They are not merged, because their invariants are opposites:
13201
+ *
13202
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13203
+ * claim a camera cost nothing, which is a measurement nobody made;
13204
+ * - a `failure-contribution` zero is the **most valuable value on the
13205
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13206
+ * and it is exactly what an absent entry cannot say.
13207
+ *
13208
+ * Putting a loss counter on a cost entry would also break the reconciliation
13209
+ * that gives `load-contribution` its point: contributions are subtracted from
13210
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13211
+ * has no process.
13212
+ *
13213
+ * ## Why not a log line, since the counters already exist
13214
+ *
13215
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13216
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13217
+ * ends in a log line, and a log line is the thing the operator asked to stop
13218
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13219
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13220
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13221
+ * media blackout were both diagnosed. The counters stay; this is where they can
13222
+ * be READ.
13223
+ *
13224
+ * ## The rate is served with its denominator or not at all
13225
+ *
13226
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13227
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13228
+ * than yesterday" and was **flat across twelve hours** once divided by the
13229
+ * successes on the same path. A surface that publishes only the numerator
13230
+ * reproduces that mistake on every read.
13231
+ *
13232
+ * ## Shape
13233
+ *
13234
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13235
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13236
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13237
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13238
+ * a forked runner's entries reach hub-main over transport that already exists.
13239
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13240
+ * result through `system.getFailureContributions`.
13241
+ */
13242
+ var FailureReasonCountSchema = object({
13243
+ /**
13244
+ * Why the attempt did not land, in the contributor's own vocabulary —
13245
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13246
+ * strings that already appear in this repo's logs and, where one exists, the
13247
+ * same string the per-track `previewMissReason` records (D276): a second
13248
+ * vocabulary for the same loss would make the row and the counter
13249
+ * un-joinable.
13250
+ */
13251
+ reason: string(),
13252
+ count: number().int().nonnegative()
13253
+ });
13254
+ var FailureContributionSchema = object({
13255
+ /**
13256
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13257
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13258
+ * `unit` free: the families are owned by different addons and a shared enum
13259
+ * is a central list that rots invisibly.
13260
+ */
13261
+ family: string(),
13262
+ /**
13263
+ * The NUMERIC device id — the same value every log line carries as
13264
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13265
+ * cannot name the camera must not emit the entry, because a fleet total
13266
+ * cannot answer the only question anybody asks of this surface.
13267
+ */
13268
+ deviceId: number().int().positive(),
13269
+ /**
13270
+ * A second dimension inside the family: the model / step id for an inference
13271
+ * timeout, so "which camera AND which model" is one read. Absent when the
13272
+ * family has a single variant.
13273
+ */
13274
+ variant: string().optional(),
13275
+ /**
13276
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13277
+ * differencing two reads must drop the interval when it changes, because the
13278
+ * counter restarted from zero in a respawned runner. Same discipline as
13279
+ * `LoadContribution.startedAtMs`.
13280
+ */
13281
+ sinceMs: number(),
13282
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13283
+ atMs: number(),
13284
+ /**
13285
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13286
+ * window. A failure count published without it is the mistake this schema
13287
+ * exists to make impossible.
13288
+ */
13289
+ attempts: number().int().nonnegative(),
13290
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13291
+ succeeded: number().int().nonnegative(),
13292
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13293
+ reasons: array(FailureReasonCountSchema).readonly()
13294
+ });
13295
+ method(_void(), array(FailureContributionSchema).readonly());
13296
+ /**
13142
13297
  * filesystem-browse — per-node capability for browsing the node's local
13143
13298
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13144
13299
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13660,6 +13815,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13660
13815
  kind: "mutation",
13661
13816
  auth: "admin"
13662
13817
  });
13818
+ var LoadContributionSchema = object({
13819
+ role: _enum([
13820
+ "decode",
13821
+ "transcode",
13822
+ "recording",
13823
+ "streaming",
13824
+ "detection"
13825
+ ]),
13826
+ /**
13827
+ * The NUMERIC device id — the same value every log line carries as
13828
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13829
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13830
+ * contributor that cannot name its camera must not emit the entry at all,
13831
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13832
+ * and would quietly turn one camera's cost into everybody's.
13833
+ */
13834
+ deviceId: number().int().positive().nullable(),
13835
+ attribution: _enum([
13836
+ "measured",
13837
+ "accounted",
13838
+ "unattributable"
13839
+ ]),
13840
+ /**
13841
+ * What ONE entry is, in the contributor's own words — `615/high`,
13842
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13843
+ * family and inventing a common one would lose the only information that
13844
+ * makes two entries for the same camera distinguishable.
13845
+ */
13846
+ unit: string(),
13847
+ /**
13848
+ * The OS process this cost lives in, when there is one. Present so a
13849
+ * consumer can (a) tell two generations of the same unit apart across a
13850
+ * restart, and (b) subtract claimed processes from the node's process
13851
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13852
+ * process of its own.
13853
+ */
13854
+ pid: number().int().positive().optional(),
13855
+ /**
13856
+ * When this generation started. The pid's incarnation marker: a consumer
13857
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13858
+ * window when this changes, because the counter restarted from zero in a new
13859
+ * process.
13860
+ */
13861
+ startedAtMs: number().optional(),
13862
+ /**
13863
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13864
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13865
+ * contribution is asked for.
13866
+ *
13867
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13868
+ * needs a sampler, and a new per-node sampler is the defect half of
13869
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13870
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13871
+ *
13872
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13873
+ * an entry with no process.
13874
+ */
13875
+ cpuSeconds: number().optional(),
13876
+ /** Resident bytes of this unit's process, same source and same rules. */
13877
+ rssBytes: number().optional()
13878
+ });
13879
+ method(_void(), array(LoadContributionSchema).readonly());
13663
13880
  /**
13664
13881
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13665
13882
  * through. It stores nothing.
@@ -13736,176 +13953,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13736
13953
  tags: record(string(), string()).optional()
13737
13954
  }), array(LogEntrySchema).readonly());
13738
13955
  /**
13739
- * `failure-contribution` — the capability an addon reports its OWN losses
13740
- * through, per camera, with the denominator attached. It stores nothing.
13741
- *
13742
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13743
- *
13744
- * `load-contribution` answers *what did this camera COST*. This answers *what
13745
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13746
- * copied: the contributor reports what it already knows, hub-main adds only
13747
- * `addonId`, nothing needs global knowledge, and there is no central list for
13748
- * somebody to forget to edit.
13749
- *
13750
- * They are not merged, because their invariants are opposites:
13751
- *
13752
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13753
- * claim a camera cost nothing, which is a measurement nobody made;
13754
- * - a `failure-contribution` zero is the **most valuable value on the
13755
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13756
- * and it is exactly what an absent entry cannot say.
13757
- *
13758
- * Putting a loss counter on a cost entry would also break the reconciliation
13759
- * that gives `load-contribution` its point: contributions are subtracted from
13760
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13761
- * has no process.
13762
- *
13763
- * ## Why not a log line, since the counters already exist
13764
- *
13765
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13766
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13767
- * ends in a log line, and a log line is the thing the operator asked to stop
13768
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13769
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13770
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13771
- * media blackout were both diagnosed. The counters stay; this is where they can
13772
- * be READ.
13773
- *
13774
- * ## The rate is served with its denominator or not at all
13775
- *
13776
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13777
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13778
- * than yesterday" and was **flat across twelve hours** once divided by the
13779
- * successes on the same path. A surface that publishes only the numerator
13780
- * reproduces that mistake on every read.
13781
- *
13782
- * ## Shape
13783
- *
13784
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13785
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13786
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13787
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13788
- * a forked runner's entries reach hub-main over transport that already exists.
13789
- * No new UDS message, no second registry (D3). The operator reads the assembled
13790
- * result through `system.getFailureContributions`.
13791
- */
13792
- var FailureReasonCountSchema = object({
13793
- /**
13794
- * Why the attempt did not land, in the contributor's own vocabulary —
13795
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13796
- * strings that already appear in this repo's logs and, where one exists, the
13797
- * same string the per-track `previewMissReason` records (D276): a second
13798
- * vocabulary for the same loss would make the row and the counter
13799
- * un-joinable.
13800
- */
13801
- reason: string(),
13802
- count: number().int().nonnegative()
13803
- });
13804
- var FailureContributionSchema = object({
13805
- /**
13806
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13807
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13808
- * `unit` free: the families are owned by different addons and a shared enum
13809
- * is a central list that rots invisibly.
13810
- */
13811
- family: string(),
13812
- /**
13813
- * The NUMERIC device id — the same value every log line carries as
13814
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13815
- * cannot name the camera must not emit the entry, because a fleet total
13816
- * cannot answer the only question anybody asks of this surface.
13817
- */
13818
- deviceId: number().int().positive(),
13819
- /**
13820
- * A second dimension inside the family: the model / step id for an inference
13821
- * timeout, so "which camera AND which model" is one read. Absent when the
13822
- * family has a single variant.
13823
- */
13824
- variant: string().optional(),
13825
- /**
13826
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13827
- * differencing two reads must drop the interval when it changes, because the
13828
- * counter restarted from zero in a respawned runner. Same discipline as
13829
- * `LoadContribution.startedAtMs`.
13830
- */
13831
- sinceMs: number(),
13832
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13833
- atMs: number(),
13834
- /**
13835
- * THE DENOMINATOR — every attempt on this path for this camera in the
13836
- * window. A failure count published without it is the mistake this schema
13837
- * exists to make impossible.
13838
- */
13839
- attempts: number().int().nonnegative(),
13840
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13841
- succeeded: number().int().nonnegative(),
13842
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13843
- reasons: array(FailureReasonCountSchema).readonly()
13844
- });
13845
- method(_void(), array(FailureContributionSchema).readonly());
13846
- var LoadContributionSchema = object({
13847
- role: _enum([
13848
- "decode",
13849
- "transcode",
13850
- "recording",
13851
- "streaming",
13852
- "detection"
13853
- ]),
13854
- /**
13855
- * The NUMERIC device id — the same value every log line carries as
13856
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13857
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13858
- * contributor that cannot name its camera must not emit the entry at all,
13859
- * because an unnamed per-camera entry is indistinguishable from a shared one
13860
- * and would quietly turn one camera's cost into everybody's.
13861
- */
13862
- deviceId: number().int().positive().nullable(),
13863
- attribution: _enum([
13864
- "measured",
13865
- "accounted",
13866
- "unattributable"
13867
- ]),
13868
- /**
13869
- * What ONE entry is, in the contributor's own words — `615/high`,
13870
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13871
- * family and inventing a common one would lose the only information that
13872
- * makes two entries for the same camera distinguishable.
13873
- */
13874
- unit: string(),
13875
- /**
13876
- * The OS process this cost lives in, when there is one. Present so a
13877
- * consumer can (a) tell two generations of the same unit apart across a
13878
- * restart, and (b) subtract claimed processes from the node's process
13879
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13880
- * process of its own.
13881
- */
13882
- pid: number().int().positive().optional(),
13883
- /**
13884
- * When this generation started. The pid's incarnation marker: a consumer
13885
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13886
- * window when this changes, because the counter restarted from zero in a new
13887
- * process.
13888
- */
13889
- startedAtMs: number().optional(),
13890
- /**
13891
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13892
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13893
- * contribution is asked for.
13894
- *
13895
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13896
- * needs a sampler, and a new per-node sampler is the defect half of
13897
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13898
- * by whoever already keeps a history; a rate cannot be un-averaged.
13899
- *
13900
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13901
- * an entry with no process.
13902
- */
13903
- cpuSeconds: number().optional(),
13904
- /** Resident bytes of this unit's process, same source and same rules. */
13905
- rssBytes: number().optional()
13906
- });
13907
- method(_void(), array(LoadContributionSchema).readonly());
13908
- /**
13909
13956
  * `login-method` — collection cap through which auth addons contribute
13910
13957
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13911
13958
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18581,12 +18628,53 @@ var MediaFileKindEnum = _enum([
18581
18628
  "keyFrameSmall",
18582
18629
  "thumbnailSmall"
18583
18630
  ]);
18631
+ /**
18632
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18633
+ * ARE — never the bytes themselves.
18634
+ *
18635
+ * ## Why `url` and not `base64`
18636
+ *
18637
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18638
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18639
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18640
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18641
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18642
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18643
+ *
18644
+ * `url` points at the `event-media` data plane
18645
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18646
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18647
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18648
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18649
+ * no less protected than they were inside a `view`-level cap response — see
18650
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18651
+ * (per-device scoping).
18652
+ *
18653
+ * The URL is built from the row's **stored** key, which is not always its
18654
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18655
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18656
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18657
+ *
18658
+ * ## `base64` is TRANSITIONAL and is going away
18659
+ *
18660
+ * It is still populated for one reason: the deployed viewer's track-detail
18661
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18662
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18663
+ * triangle — not as absence. Removing the field before that viewer ships is an
18664
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18665
+ * delete this line and the `withBytes` pass-through in
18666
+ * `analytics-query-facade.ts`; nothing else reads it.
18667
+ */
18584
18668
  var MediaFileSchema = object({
18585
18669
  key: string(),
18586
18670
  kind: MediaFileKindEnum,
18587
- base64: string(),
18588
18671
  sizeBytes: number(),
18589
18672
  timestamp: number()
18673
+ }).extend({
18674
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18675
+ url: string(),
18676
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18677
+ base64: string()
18590
18678
  });
18591
18679
  /**
18592
18680
  * One media row WITHOUT its bytes.
@@ -18598,7 +18686,9 @@ var MediaFileSchema = object({
18598
18686
  * blocks the whole view.
18599
18687
  *
18600
18688
  * `sizeBytes` is carried because it is what lets a client decide between the
18601
- * stored blob and a `?variant=thumb` rendering without fetching either.
18689
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18690
+ * `url` because a client that had to build the plane path itself is a second
18691
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18602
18692
  */
18603
18693
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18604
18694
  /**
@@ -19287,6 +19377,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19287
19377
  }), array(MediaFileSchema).readonly()), method(object({
19288
19378
  trackId: string(),
19289
19379
  deviceId: number()
19380
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19381
+ eventId: string(),
19382
+ deviceId: number()
19290
19383
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19291
19384
  kind: "mutation",
19292
19385
  auth: "admin"
@@ -23559,10 +23652,24 @@ var FaceClusterSchema = object({
23559
23652
  size: number().int(),
23560
23653
  cohesion: number()
23561
23654
  });
23655
+ /**
23656
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23657
+ * are — never the bytes.
23658
+ *
23659
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23660
+ * track/event contract) is still populated because a deployed viewer requires
23661
+ * the field to parse a row at all; this method has no such reader. Its ONE
23662
+ * caller is the admin UI's detail modal, which was building
23663
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23664
+ * dialog already rendering its key FRAME from the `event-media` plane.
23665
+ *
23666
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23667
+ * media key directly, so this needed no new plane and no new access decision.
23668
+ */
23562
23669
  var MediaFileLiteSchema$1 = object({
23563
23670
  key: string(),
23564
23671
  kind: string(),
23565
- base64: string(),
23672
+ url: string(),
23566
23673
  sizeBytes: number(),
23567
23674
  timestamp: number()
23568
23675
  });
@@ -25814,10 +25921,24 @@ var PlateInfoSchema = object({
25814
25921
  */
25815
25922
  cropUrl: string().optional()
25816
25923
  });
25924
+ /**
25925
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25926
+ * are — never the bytes.
25927
+ *
25928
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25929
+ * track/event contract) is still populated because a deployed viewer requires
25930
+ * the field to parse a row at all; this method has no such reader. Its ONE
25931
+ * caller is the admin UI's detail modal, which was building
25932
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25933
+ * dialog already rendering its key FRAME from the `event-media` plane.
25934
+ *
25935
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25936
+ * media key directly, so this needed no new plane and no new access decision.
25937
+ */
25817
25938
  var MediaFileLiteSchema = object({
25818
25939
  key: string(),
25819
25940
  kind: string(),
25820
- base64: string(),
25941
+ url: string(),
25821
25942
  sizeBytes: number(),
25822
25943
  timestamp: number()
25823
25944
  });
@@ -31837,6 +31958,12 @@ Object.freeze({
31837
31958
  addonId: null,
31838
31959
  access: "view"
31839
31960
  },
31961
+ "pipelineAnalytics.listEventMedia": {
31962
+ capName: "pipeline-analytics",
31963
+ capScope: "device",
31964
+ addonId: null,
31965
+ access: "view"
31966
+ },
31840
31967
  "pipelineAnalytics.listGroups": {
31841
31968
  capName: "pipeline-analytics",
31842
31969
  capScope: "device",
@@ -35460,6 +35587,11 @@ Object.freeze({
35460
35587
  form: "array",
35461
35588
  optional: false
35462
35589
  }],
35590
+ "pipelineAnalytics.listEventMedia": [{
35591
+ name: "deviceId",
35592
+ form: "single",
35593
+ optional: false
35594
+ }],
35463
35595
  "pipelineAnalytics.listGroups": [{
35464
35596
  name: "deviceIds",
35465
35597
  form: "array",
@@ -8192,6 +8192,21 @@ var RelocateJobSchema = object({
8192
8192
  bytesMoved: number().int(),
8193
8193
  /** Total files discovered up front; null while (or when) unknown. */
8194
8194
  filesTotal: number().int().nullable(),
8195
+ /**
8196
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8197
+ * made that nobody asked for, so it is reported where the operator reads the
8198
+ * job rather than only in a log line.
8199
+ *
8200
+ * A footage segment records its byte count in its own NAME, and the durable
8201
+ * hour row derives its aggregates from those names. A file that does not
8202
+ * match its name therefore makes the ledger's sums — and with them quota and
8203
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8204
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8205
+ *
8206
+ * Absent on lanes where the question has no meaning: a media blob's size is
8207
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8208
+ */
8209
+ rowsReconciled: number().int().nonnegative().optional(),
8195
8210
  startedAt: number(),
8196
8211
  finishedAt: number().nullable(),
8197
8212
  error: string().nullable()
@@ -8260,14 +8275,42 @@ var RelocateMediaInputSchema = object({
8260
8275
  /** Omitted = `move`, the pre-existing behaviour. */
8261
8276
  mode: MediaRelocateModeSchema.optional()
8262
8277
  });
8263
- /** How many rows still carry NO `locationId` — the population a repoint would
8264
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8265
- * value that permits a non-blocking `eventMedia` cutover. */
8266
- var UnstampedEventMediaCountSchema = object({
8267
- media: number().int().nonnegative(),
8268
- retrainFrames: number().int().nonnegative(),
8269
- total: number().int().nonnegative()
8278
+ /**
8279
+ * The unstamped population of ONE collection — split, because the gate and the
8280
+ * operator ask two different questions and only one of them has to be cheap.
8281
+ *
8282
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8283
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8284
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8285
+ * that matters — after a seal, when the population is empty.
8286
+ *
8287
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8288
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8289
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8290
+ * and useful answer: "there are some, and this read could not say how many"
8291
+ * still refuses the cutover, which is the whole job.
8292
+ */
8293
+ var UnstampedRowsSchema = object({
8294
+ present: boolean(),
8295
+ rows: number().int().nonnegative().nullable()
8270
8296
  });
8297
+ /**
8298
+ * How many rows still carry NO `locationId` — the population a repoint would
8299
+ * silently re-aim at a disk that does not hold their bytes.
8300
+ *
8301
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8302
+ * over. The gate opens on a measured absence and on nothing else; an unread
8303
+ * collection and an empty one are different facts, and this repo has already
8304
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8305
+ */
8306
+ var UnstampedEventMediaCountSchema = object({
8307
+ media: UnstampedRowsSchema,
8308
+ retrainFrames: UnstampedRowsSchema,
8309
+ /** True when EITHER collection holds one. The refusal reads this. */
8310
+ anyPresent: boolean(),
8311
+ /** Sum across both, or `null` when either lane could not be counted. */
8312
+ total: number().int().nonnegative().nullable()
8313
+ }).nullable();
8271
8314
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8272
8315
  /** The independently selectable logical storage classes — every class
8273
8316
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8378,6 +8421,10 @@ var StorageMigrationMoveProgressSchema = object({
8378
8421
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8379
8422
  filesTotal: number().int().nonnegative().nullable(),
8380
8423
  bytesMoved: number().int().nonnegative(),
8424
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8425
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8426
+ * rows would be the same failure as one that silently skipped them. */
8427
+ rowsReconciled: number().int().nonnegative().optional(),
8381
8428
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8382
8429
  * crash gets a new mover, and a rate computed from the migration's start
8383
8430
  * would silently average in the time nothing was running. */
@@ -13135,6 +13182,114 @@ method(object({
13135
13182
  height: number()
13136
13183
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13137
13184
  /**
13185
+ * `failure-contribution` — the capability an addon reports its OWN losses
13186
+ * through, per camera, with the denominator attached. It stores nothing.
13187
+ *
13188
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13189
+ *
13190
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13191
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13192
+ * copied: the contributor reports what it already knows, hub-main adds only
13193
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13194
+ * somebody to forget to edit.
13195
+ *
13196
+ * They are not merged, because their invariants are opposites:
13197
+ *
13198
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13199
+ * claim a camera cost nothing, which is a measurement nobody made;
13200
+ * - a `failure-contribution` zero is the **most valuable value on the
13201
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13202
+ * and it is exactly what an absent entry cannot say.
13203
+ *
13204
+ * Putting a loss counter on a cost entry would also break the reconciliation
13205
+ * that gives `load-contribution` its point: contributions are subtracted from
13206
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13207
+ * has no process.
13208
+ *
13209
+ * ## Why not a log line, since the counters already exist
13210
+ *
13211
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13212
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13213
+ * ends in a log line, and a log line is the thing the operator asked to stop
13214
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13215
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13216
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13217
+ * media blackout were both diagnosed. The counters stay; this is where they can
13218
+ * be READ.
13219
+ *
13220
+ * ## The rate is served with its denominator or not at all
13221
+ *
13222
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13223
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13224
+ * than yesterday" and was **flat across twelve hours** once divided by the
13225
+ * successes on the same path. A surface that publishes only the numerator
13226
+ * reproduces that mistake on every read.
13227
+ *
13228
+ * ## Shape
13229
+ *
13230
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13231
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13232
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13233
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13234
+ * a forked runner's entries reach hub-main over transport that already exists.
13235
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13236
+ * result through `system.getFailureContributions`.
13237
+ */
13238
+ var FailureReasonCountSchema = object({
13239
+ /**
13240
+ * Why the attempt did not land, in the contributor's own vocabulary —
13241
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13242
+ * strings that already appear in this repo's logs and, where one exists, the
13243
+ * same string the per-track `previewMissReason` records (D276): a second
13244
+ * vocabulary for the same loss would make the row and the counter
13245
+ * un-joinable.
13246
+ */
13247
+ reason: string(),
13248
+ count: number().int().nonnegative()
13249
+ });
13250
+ var FailureContributionSchema = object({
13251
+ /**
13252
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13253
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13254
+ * `unit` free: the families are owned by different addons and a shared enum
13255
+ * is a central list that rots invisibly.
13256
+ */
13257
+ family: string(),
13258
+ /**
13259
+ * The NUMERIC device id — the same value every log line carries as
13260
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13261
+ * cannot name the camera must not emit the entry, because a fleet total
13262
+ * cannot answer the only question anybody asks of this surface.
13263
+ */
13264
+ deviceId: number().int().positive(),
13265
+ /**
13266
+ * A second dimension inside the family: the model / step id for an inference
13267
+ * timeout, so "which camera AND which model" is one read. Absent when the
13268
+ * family has a single variant.
13269
+ */
13270
+ variant: string().optional(),
13271
+ /**
13272
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13273
+ * differencing two reads must drop the interval when it changes, because the
13274
+ * counter restarted from zero in a respawned runner. Same discipline as
13275
+ * `LoadContribution.startedAtMs`.
13276
+ */
13277
+ sinceMs: number(),
13278
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13279
+ atMs: number(),
13280
+ /**
13281
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13282
+ * window. A failure count published without it is the mistake this schema
13283
+ * exists to make impossible.
13284
+ */
13285
+ attempts: number().int().nonnegative(),
13286
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13287
+ succeeded: number().int().nonnegative(),
13288
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13289
+ reasons: array(FailureReasonCountSchema).readonly()
13290
+ });
13291
+ method(_void(), array(FailureContributionSchema).readonly());
13292
+ /**
13138
13293
  * filesystem-browse — per-node capability for browsing the node's local
13139
13294
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13140
13295
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13656,6 +13811,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13656
13811
  kind: "mutation",
13657
13812
  auth: "admin"
13658
13813
  });
13814
+ var LoadContributionSchema = object({
13815
+ role: _enum([
13816
+ "decode",
13817
+ "transcode",
13818
+ "recording",
13819
+ "streaming",
13820
+ "detection"
13821
+ ]),
13822
+ /**
13823
+ * The NUMERIC device id — the same value every log line carries as
13824
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13825
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13826
+ * contributor that cannot name its camera must not emit the entry at all,
13827
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13828
+ * and would quietly turn one camera's cost into everybody's.
13829
+ */
13830
+ deviceId: number().int().positive().nullable(),
13831
+ attribution: _enum([
13832
+ "measured",
13833
+ "accounted",
13834
+ "unattributable"
13835
+ ]),
13836
+ /**
13837
+ * What ONE entry is, in the contributor's own words — `615/high`,
13838
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13839
+ * family and inventing a common one would lose the only information that
13840
+ * makes two entries for the same camera distinguishable.
13841
+ */
13842
+ unit: string(),
13843
+ /**
13844
+ * The OS process this cost lives in, when there is one. Present so a
13845
+ * consumer can (a) tell two generations of the same unit apart across a
13846
+ * restart, and (b) subtract claimed processes from the node's process
13847
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13848
+ * process of its own.
13849
+ */
13850
+ pid: number().int().positive().optional(),
13851
+ /**
13852
+ * When this generation started. The pid's incarnation marker: a consumer
13853
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13854
+ * window when this changes, because the counter restarted from zero in a new
13855
+ * process.
13856
+ */
13857
+ startedAtMs: number().optional(),
13858
+ /**
13859
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13860
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13861
+ * contribution is asked for.
13862
+ *
13863
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13864
+ * needs a sampler, and a new per-node sampler is the defect half of
13865
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13866
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13867
+ *
13868
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13869
+ * an entry with no process.
13870
+ */
13871
+ cpuSeconds: number().optional(),
13872
+ /** Resident bytes of this unit's process, same source and same rules. */
13873
+ rssBytes: number().optional()
13874
+ });
13875
+ method(_void(), array(LoadContributionSchema).readonly());
13659
13876
  /**
13660
13877
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13661
13878
  * through. It stores nothing.
@@ -13732,176 +13949,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13732
13949
  tags: record(string(), string()).optional()
13733
13950
  }), array(LogEntrySchema).readonly());
13734
13951
  /**
13735
- * `failure-contribution` — the capability an addon reports its OWN losses
13736
- * through, per camera, with the denominator attached. It stores nothing.
13737
- *
13738
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13739
- *
13740
- * `load-contribution` answers *what did this camera COST*. This answers *what
13741
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13742
- * copied: the contributor reports what it already knows, hub-main adds only
13743
- * `addonId`, nothing needs global knowledge, and there is no central list for
13744
- * somebody to forget to edit.
13745
- *
13746
- * They are not merged, because their invariants are opposites:
13747
- *
13748
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13749
- * claim a camera cost nothing, which is a measurement nobody made;
13750
- * - a `failure-contribution` zero is the **most valuable value on the
13751
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13752
- * and it is exactly what an absent entry cannot say.
13753
- *
13754
- * Putting a loss counter on a cost entry would also break the reconciliation
13755
- * that gives `load-contribution` its point: contributions are subtracted from
13756
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13757
- * has no process.
13758
- *
13759
- * ## Why not a log line, since the counters already exist
13760
- *
13761
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13762
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13763
- * ends in a log line, and a log line is the thing the operator asked to stop
13764
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13765
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13766
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13767
- * media blackout were both diagnosed. The counters stay; this is where they can
13768
- * be READ.
13769
- *
13770
- * ## The rate is served with its denominator or not at all
13771
- *
13772
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13773
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13774
- * than yesterday" and was **flat across twelve hours** once divided by the
13775
- * successes on the same path. A surface that publishes only the numerator
13776
- * reproduces that mistake on every read.
13777
- *
13778
- * ## Shape
13779
- *
13780
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13781
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13782
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13783
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13784
- * a forked runner's entries reach hub-main over transport that already exists.
13785
- * No new UDS message, no second registry (D3). The operator reads the assembled
13786
- * result through `system.getFailureContributions`.
13787
- */
13788
- var FailureReasonCountSchema = object({
13789
- /**
13790
- * Why the attempt did not land, in the contributor's own vocabulary —
13791
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13792
- * strings that already appear in this repo's logs and, where one exists, the
13793
- * same string the per-track `previewMissReason` records (D276): a second
13794
- * vocabulary for the same loss would make the row and the counter
13795
- * un-joinable.
13796
- */
13797
- reason: string(),
13798
- count: number().int().nonnegative()
13799
- });
13800
- var FailureContributionSchema = object({
13801
- /**
13802
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13803
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13804
- * `unit` free: the families are owned by different addons and a shared enum
13805
- * is a central list that rots invisibly.
13806
- */
13807
- family: string(),
13808
- /**
13809
- * The NUMERIC device id — the same value every log line carries as
13810
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13811
- * cannot name the camera must not emit the entry, because a fleet total
13812
- * cannot answer the only question anybody asks of this surface.
13813
- */
13814
- deviceId: number().int().positive(),
13815
- /**
13816
- * A second dimension inside the family: the model / step id for an inference
13817
- * timeout, so "which camera AND which model" is one read. Absent when the
13818
- * family has a single variant.
13819
- */
13820
- variant: string().optional(),
13821
- /**
13822
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13823
- * differencing two reads must drop the interval when it changes, because the
13824
- * counter restarted from zero in a respawned runner. Same discipline as
13825
- * `LoadContribution.startedAtMs`.
13826
- */
13827
- sinceMs: number(),
13828
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13829
- atMs: number(),
13830
- /**
13831
- * THE DENOMINATOR — every attempt on this path for this camera in the
13832
- * window. A failure count published without it is the mistake this schema
13833
- * exists to make impossible.
13834
- */
13835
- attempts: number().int().nonnegative(),
13836
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13837
- succeeded: number().int().nonnegative(),
13838
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13839
- reasons: array(FailureReasonCountSchema).readonly()
13840
- });
13841
- method(_void(), array(FailureContributionSchema).readonly());
13842
- var LoadContributionSchema = object({
13843
- role: _enum([
13844
- "decode",
13845
- "transcode",
13846
- "recording",
13847
- "streaming",
13848
- "detection"
13849
- ]),
13850
- /**
13851
- * The NUMERIC device id — the same value every log line carries as
13852
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13853
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13854
- * contributor that cannot name its camera must not emit the entry at all,
13855
- * because an unnamed per-camera entry is indistinguishable from a shared one
13856
- * and would quietly turn one camera's cost into everybody's.
13857
- */
13858
- deviceId: number().int().positive().nullable(),
13859
- attribution: _enum([
13860
- "measured",
13861
- "accounted",
13862
- "unattributable"
13863
- ]),
13864
- /**
13865
- * What ONE entry is, in the contributor's own words — `615/high`,
13866
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13867
- * family and inventing a common one would lose the only information that
13868
- * makes two entries for the same camera distinguishable.
13869
- */
13870
- unit: string(),
13871
- /**
13872
- * The OS process this cost lives in, when there is one. Present so a
13873
- * consumer can (a) tell two generations of the same unit apart across a
13874
- * restart, and (b) subtract claimed processes from the node's process
13875
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13876
- * process of its own.
13877
- */
13878
- pid: number().int().positive().optional(),
13879
- /**
13880
- * When this generation started. The pid's incarnation marker: a consumer
13881
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13882
- * window when this changes, because the counter restarted from zero in a new
13883
- * process.
13884
- */
13885
- startedAtMs: number().optional(),
13886
- /**
13887
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13888
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13889
- * contribution is asked for.
13890
- *
13891
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13892
- * needs a sampler, and a new per-node sampler is the defect half of
13893
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13894
- * by whoever already keeps a history; a rate cannot be un-averaged.
13895
- *
13896
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13897
- * an entry with no process.
13898
- */
13899
- cpuSeconds: number().optional(),
13900
- /** Resident bytes of this unit's process, same source and same rules. */
13901
- rssBytes: number().optional()
13902
- });
13903
- method(_void(), array(LoadContributionSchema).readonly());
13904
- /**
13905
13952
  * `login-method` — collection cap through which auth addons contribute
13906
13953
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13907
13954
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18577,12 +18624,53 @@ var MediaFileKindEnum = _enum([
18577
18624
  "keyFrameSmall",
18578
18625
  "thumbnailSmall"
18579
18626
  ]);
18627
+ /**
18628
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18629
+ * ARE — never the bytes themselves.
18630
+ *
18631
+ * ## Why `url` and not `base64`
18632
+ *
18633
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18634
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18635
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18636
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18637
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18638
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18639
+ *
18640
+ * `url` points at the `event-media` data plane
18641
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18642
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18643
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18644
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18645
+ * no less protected than they were inside a `view`-level cap response — see
18646
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18647
+ * (per-device scoping).
18648
+ *
18649
+ * The URL is built from the row's **stored** key, which is not always its
18650
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18651
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18652
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18653
+ *
18654
+ * ## `base64` is TRANSITIONAL and is going away
18655
+ *
18656
+ * It is still populated for one reason: the deployed viewer's track-detail
18657
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18658
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18659
+ * triangle — not as absence. Removing the field before that viewer ships is an
18660
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18661
+ * delete this line and the `withBytes` pass-through in
18662
+ * `analytics-query-facade.ts`; nothing else reads it.
18663
+ */
18580
18664
  var MediaFileSchema = object({
18581
18665
  key: string(),
18582
18666
  kind: MediaFileKindEnum,
18583
- base64: string(),
18584
18667
  sizeBytes: number(),
18585
18668
  timestamp: number()
18669
+ }).extend({
18670
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18671
+ url: string(),
18672
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18673
+ base64: string()
18586
18674
  });
18587
18675
  /**
18588
18676
  * One media row WITHOUT its bytes.
@@ -18594,7 +18682,9 @@ var MediaFileSchema = object({
18594
18682
  * blocks the whole view.
18595
18683
  *
18596
18684
  * `sizeBytes` is carried because it is what lets a client decide between the
18597
- * stored blob and a `?variant=thumb` rendering without fetching either.
18685
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18686
+ * `url` because a client that had to build the plane path itself is a second
18687
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18598
18688
  */
18599
18689
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18600
18690
  /**
@@ -19283,6 +19373,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19283
19373
  }), array(MediaFileSchema).readonly()), method(object({
19284
19374
  trackId: string(),
19285
19375
  deviceId: number()
19376
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19377
+ eventId: string(),
19378
+ deviceId: number()
19286
19379
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19287
19380
  kind: "mutation",
19288
19381
  auth: "admin"
@@ -23555,10 +23648,24 @@ var FaceClusterSchema = object({
23555
23648
  size: number().int(),
23556
23649
  cohesion: number()
23557
23650
  });
23651
+ /**
23652
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23653
+ * are — never the bytes.
23654
+ *
23655
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23656
+ * track/event contract) is still populated because a deployed viewer requires
23657
+ * the field to parse a row at all; this method has no such reader. Its ONE
23658
+ * caller is the admin UI's detail modal, which was building
23659
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23660
+ * dialog already rendering its key FRAME from the `event-media` plane.
23661
+ *
23662
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23663
+ * media key directly, so this needed no new plane and no new access decision.
23664
+ */
23558
23665
  var MediaFileLiteSchema$1 = object({
23559
23666
  key: string(),
23560
23667
  kind: string(),
23561
- base64: string(),
23668
+ url: string(),
23562
23669
  sizeBytes: number(),
23563
23670
  timestamp: number()
23564
23671
  });
@@ -25810,10 +25917,24 @@ var PlateInfoSchema = object({
25810
25917
  */
25811
25918
  cropUrl: string().optional()
25812
25919
  });
25920
+ /**
25921
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25922
+ * are — never the bytes.
25923
+ *
25924
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25925
+ * track/event contract) is still populated because a deployed viewer requires
25926
+ * the field to parse a row at all; this method has no such reader. Its ONE
25927
+ * caller is the admin UI's detail modal, which was building
25928
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25929
+ * dialog already rendering its key FRAME from the `event-media` plane.
25930
+ *
25931
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25932
+ * media key directly, so this needed no new plane and no new access decision.
25933
+ */
25813
25934
  var MediaFileLiteSchema = object({
25814
25935
  key: string(),
25815
25936
  kind: string(),
25816
- base64: string(),
25937
+ url: string(),
25817
25938
  sizeBytes: number(),
25818
25939
  timestamp: number()
25819
25940
  });
@@ -31833,6 +31954,12 @@ Object.freeze({
31833
31954
  addonId: null,
31834
31955
  access: "view"
31835
31956
  },
31957
+ "pipelineAnalytics.listEventMedia": {
31958
+ capName: "pipeline-analytics",
31959
+ capScope: "device",
31960
+ addonId: null,
31961
+ access: "view"
31962
+ },
31836
31963
  "pipelineAnalytics.listGroups": {
31837
31964
  capName: "pipeline-analytics",
31838
31965
  capScope: "device",
@@ -35456,6 +35583,11 @@ Object.freeze({
35456
35583
  form: "array",
35457
35584
  optional: false
35458
35585
  }],
35586
+ "pipelineAnalytics.listEventMedia": [{
35587
+ name: "deviceId",
35588
+ form: "single",
35589
+ optional: false
35590
+ }],
35459
35591
  "pipelineAnalytics.listGroups": [{
35460
35592
  name: "deviceIds",
35461
35593
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-google",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Google Home export — hub-side smart-home fulfillment (SYNC / QUERY / EXECUTE / DISCONNECT) for the non-camera fleet, served over the hub's own OAuth account link. No Google credential is stored, sent or required.",
5
5
  "keywords": [
6
6
  "camstack",