@camstack/addon-export-alexa 1.2.51 → 1.2.53

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.
@@ -8171,6 +8171,21 @@ var RelocateJobSchema = object({
8171
8171
  bytesMoved: number().int(),
8172
8172
  /** Total files discovered up front; null while (or when) unknown. */
8173
8173
  filesTotal: number().int().nullable(),
8174
+ /**
8175
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8176
+ * made that nobody asked for, so it is reported where the operator reads the
8177
+ * job rather than only in a log line.
8178
+ *
8179
+ * A footage segment records its byte count in its own NAME, and the durable
8180
+ * hour row derives its aggregates from those names. A file that does not
8181
+ * match its name therefore makes the ledger's sums — and with them quota and
8182
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8183
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8184
+ *
8185
+ * Absent on lanes where the question has no meaning: a media blob's size is
8186
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8187
+ */
8188
+ rowsReconciled: number().int().nonnegative().optional(),
8174
8189
  startedAt: number(),
8175
8190
  finishedAt: number().nullable(),
8176
8191
  error: string().nullable()
@@ -8239,14 +8254,42 @@ var RelocateMediaInputSchema = object({
8239
8254
  /** Omitted = `move`, the pre-existing behaviour. */
8240
8255
  mode: MediaRelocateModeSchema.optional()
8241
8256
  });
8242
- /** How many rows still carry NO `locationId` — the population a repoint would
8243
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8244
- * value that permits a non-blocking `eventMedia` cutover. */
8245
- var UnstampedEventMediaCountSchema = object({
8246
- media: number().int().nonnegative(),
8247
- retrainFrames: number().int().nonnegative(),
8248
- total: number().int().nonnegative()
8257
+ /**
8258
+ * The unstamped population of ONE collection — split, because the gate and the
8259
+ * operator ask two different questions and only one of them has to be cheap.
8260
+ *
8261
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8262
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8263
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8264
+ * that matters — after a seal, when the population is empty.
8265
+ *
8266
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8267
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8268
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8269
+ * and useful answer: "there are some, and this read could not say how many"
8270
+ * still refuses the cutover, which is the whole job.
8271
+ */
8272
+ var UnstampedRowsSchema = object({
8273
+ present: boolean(),
8274
+ rows: number().int().nonnegative().nullable()
8249
8275
  });
8276
+ /**
8277
+ * How many rows still carry NO `locationId` — the population a repoint would
8278
+ * silently re-aim at a disk that does not hold their bytes.
8279
+ *
8280
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8281
+ * over. The gate opens on a measured absence and on nothing else; an unread
8282
+ * collection and an empty one are different facts, and this repo has already
8283
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8284
+ */
8285
+ var UnstampedEventMediaCountSchema = object({
8286
+ media: UnstampedRowsSchema,
8287
+ retrainFrames: UnstampedRowsSchema,
8288
+ /** True when EITHER collection holds one. The refusal reads this. */
8289
+ anyPresent: boolean(),
8290
+ /** Sum across both, or `null` when either lane could not be counted. */
8291
+ total: number().int().nonnegative().nullable()
8292
+ }).nullable();
8250
8293
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8251
8294
  /** The independently selectable logical storage classes — every class
8252
8295
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8357,6 +8400,10 @@ var StorageMigrationMoveProgressSchema = object({
8357
8400
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8358
8401
  filesTotal: number().int().nonnegative().nullable(),
8359
8402
  bytesMoved: number().int().nonnegative(),
8403
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8404
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8405
+ * rows would be the same failure as one that silently skipped them. */
8406
+ rowsReconciled: number().int().nonnegative().optional(),
8360
8407
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8361
8408
  * crash gets a new mover, and a rate computed from the migration's start
8362
8409
  * would silently average in the time nothing was running. */
@@ -13168,6 +13215,114 @@ method(object({
13168
13215
  height: number()
13169
13216
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13170
13217
  /**
13218
+ * `failure-contribution` — the capability an addon reports its OWN losses
13219
+ * through, per camera, with the denominator attached. It stores nothing.
13220
+ *
13221
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13222
+ *
13223
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13224
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13225
+ * copied: the contributor reports what it already knows, hub-main adds only
13226
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13227
+ * somebody to forget to edit.
13228
+ *
13229
+ * They are not merged, because their invariants are opposites:
13230
+ *
13231
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13232
+ * claim a camera cost nothing, which is a measurement nobody made;
13233
+ * - a `failure-contribution` zero is the **most valuable value on the
13234
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13235
+ * and it is exactly what an absent entry cannot say.
13236
+ *
13237
+ * Putting a loss counter on a cost entry would also break the reconciliation
13238
+ * that gives `load-contribution` its point: contributions are subtracted from
13239
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13240
+ * has no process.
13241
+ *
13242
+ * ## Why not a log line, since the counters already exist
13243
+ *
13244
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13245
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13246
+ * ends in a log line, and a log line is the thing the operator asked to stop
13247
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13248
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13249
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13250
+ * media blackout were both diagnosed. The counters stay; this is where they can
13251
+ * be READ.
13252
+ *
13253
+ * ## The rate is served with its denominator or not at all
13254
+ *
13255
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13256
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13257
+ * than yesterday" and was **flat across twelve hours** once divided by the
13258
+ * successes on the same path. A surface that publishes only the numerator
13259
+ * reproduces that mistake on every read.
13260
+ *
13261
+ * ## Shape
13262
+ *
13263
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13264
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13265
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13266
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13267
+ * a forked runner's entries reach hub-main over transport that already exists.
13268
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13269
+ * result through `system.getFailureContributions`.
13270
+ */
13271
+ var FailureReasonCountSchema = object({
13272
+ /**
13273
+ * Why the attempt did not land, in the contributor's own vocabulary —
13274
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13275
+ * strings that already appear in this repo's logs and, where one exists, the
13276
+ * same string the per-track `previewMissReason` records (D276): a second
13277
+ * vocabulary for the same loss would make the row and the counter
13278
+ * un-joinable.
13279
+ */
13280
+ reason: string(),
13281
+ count: number().int().nonnegative()
13282
+ });
13283
+ var FailureContributionSchema = object({
13284
+ /**
13285
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13286
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13287
+ * `unit` free: the families are owned by different addons and a shared enum
13288
+ * is a central list that rots invisibly.
13289
+ */
13290
+ family: string(),
13291
+ /**
13292
+ * The NUMERIC device id — the same value every log line carries as
13293
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13294
+ * cannot name the camera must not emit the entry, because a fleet total
13295
+ * cannot answer the only question anybody asks of this surface.
13296
+ */
13297
+ deviceId: number().int().positive(),
13298
+ /**
13299
+ * A second dimension inside the family: the model / step id for an inference
13300
+ * timeout, so "which camera AND which model" is one read. Absent when the
13301
+ * family has a single variant.
13302
+ */
13303
+ variant: string().optional(),
13304
+ /**
13305
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13306
+ * differencing two reads must drop the interval when it changes, because the
13307
+ * counter restarted from zero in a respawned runner. Same discipline as
13308
+ * `LoadContribution.startedAtMs`.
13309
+ */
13310
+ sinceMs: number(),
13311
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13312
+ atMs: number(),
13313
+ /**
13314
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13315
+ * window. A failure count published without it is the mistake this schema
13316
+ * exists to make impossible.
13317
+ */
13318
+ attempts: number().int().nonnegative(),
13319
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13320
+ succeeded: number().int().nonnegative(),
13321
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13322
+ reasons: array(FailureReasonCountSchema).readonly()
13323
+ });
13324
+ method(_void(), array(FailureContributionSchema).readonly());
13325
+ /**
13171
13326
  * filesystem-browse — per-node capability for browsing the node's local
13172
13327
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13173
13328
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13689,6 +13844,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13689
13844
  kind: "mutation",
13690
13845
  auth: "admin"
13691
13846
  });
13847
+ var LoadContributionSchema = object({
13848
+ role: _enum([
13849
+ "decode",
13850
+ "transcode",
13851
+ "recording",
13852
+ "streaming",
13853
+ "detection"
13854
+ ]),
13855
+ /**
13856
+ * The NUMERIC device id — the same value every log line carries as
13857
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13858
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13859
+ * contributor that cannot name its camera must not emit the entry at all,
13860
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13861
+ * and would quietly turn one camera's cost into everybody's.
13862
+ */
13863
+ deviceId: number().int().positive().nullable(),
13864
+ attribution: _enum([
13865
+ "measured",
13866
+ "accounted",
13867
+ "unattributable"
13868
+ ]),
13869
+ /**
13870
+ * What ONE entry is, in the contributor's own words — `615/high`,
13871
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13872
+ * family and inventing a common one would lose the only information that
13873
+ * makes two entries for the same camera distinguishable.
13874
+ */
13875
+ unit: string(),
13876
+ /**
13877
+ * The OS process this cost lives in, when there is one. Present so a
13878
+ * consumer can (a) tell two generations of the same unit apart across a
13879
+ * restart, and (b) subtract claimed processes from the node's process
13880
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13881
+ * process of its own.
13882
+ */
13883
+ pid: number().int().positive().optional(),
13884
+ /**
13885
+ * When this generation started. The pid's incarnation marker: a consumer
13886
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13887
+ * window when this changes, because the counter restarted from zero in a new
13888
+ * process.
13889
+ */
13890
+ startedAtMs: number().optional(),
13891
+ /**
13892
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13893
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13894
+ * contribution is asked for.
13895
+ *
13896
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13897
+ * needs a sampler, and a new per-node sampler is the defect half of
13898
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13899
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13900
+ *
13901
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13902
+ * an entry with no process.
13903
+ */
13904
+ cpuSeconds: number().optional(),
13905
+ /** Resident bytes of this unit's process, same source and same rules. */
13906
+ rssBytes: number().optional()
13907
+ });
13908
+ method(_void(), array(LoadContributionSchema).readonly());
13692
13909
  /**
13693
13910
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13694
13911
  * through. It stores nothing.
@@ -13765,176 +13982,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13765
13982
  tags: record(string(), string()).optional()
13766
13983
  }), array(LogEntrySchema).readonly());
13767
13984
  /**
13768
- * `failure-contribution` — the capability an addon reports its OWN losses
13769
- * through, per camera, with the denominator attached. It stores nothing.
13770
- *
13771
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13772
- *
13773
- * `load-contribution` answers *what did this camera COST*. This answers *what
13774
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13775
- * copied: the contributor reports what it already knows, hub-main adds only
13776
- * `addonId`, nothing needs global knowledge, and there is no central list for
13777
- * somebody to forget to edit.
13778
- *
13779
- * They are not merged, because their invariants are opposites:
13780
- *
13781
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13782
- * claim a camera cost nothing, which is a measurement nobody made;
13783
- * - a `failure-contribution` zero is the **most valuable value on the
13784
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13785
- * and it is exactly what an absent entry cannot say.
13786
- *
13787
- * Putting a loss counter on a cost entry would also break the reconciliation
13788
- * that gives `load-contribution` its point: contributions are subtracted from
13789
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13790
- * has no process.
13791
- *
13792
- * ## Why not a log line, since the counters already exist
13793
- *
13794
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13795
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13796
- * ends in a log line, and a log line is the thing the operator asked to stop
13797
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13798
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13799
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13800
- * media blackout were both diagnosed. The counters stay; this is where they can
13801
- * be READ.
13802
- *
13803
- * ## The rate is served with its denominator or not at all
13804
- *
13805
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13806
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13807
- * than yesterday" and was **flat across twelve hours** once divided by the
13808
- * successes on the same path. A surface that publishes only the numerator
13809
- * reproduces that mistake on every read.
13810
- *
13811
- * ## Shape
13812
- *
13813
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13814
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13815
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13816
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13817
- * a forked runner's entries reach hub-main over transport that already exists.
13818
- * No new UDS message, no second registry (D3). The operator reads the assembled
13819
- * result through `system.getFailureContributions`.
13820
- */
13821
- var FailureReasonCountSchema = object({
13822
- /**
13823
- * Why the attempt did not land, in the contributor's own vocabulary —
13824
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13825
- * strings that already appear in this repo's logs and, where one exists, the
13826
- * same string the per-track `previewMissReason` records (D276): a second
13827
- * vocabulary for the same loss would make the row and the counter
13828
- * un-joinable.
13829
- */
13830
- reason: string(),
13831
- count: number().int().nonnegative()
13832
- });
13833
- var FailureContributionSchema = object({
13834
- /**
13835
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13836
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13837
- * `unit` free: the families are owned by different addons and a shared enum
13838
- * is a central list that rots invisibly.
13839
- */
13840
- family: string(),
13841
- /**
13842
- * The NUMERIC device id — the same value every log line carries as
13843
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13844
- * cannot name the camera must not emit the entry, because a fleet total
13845
- * cannot answer the only question anybody asks of this surface.
13846
- */
13847
- deviceId: number().int().positive(),
13848
- /**
13849
- * A second dimension inside the family: the model / step id for an inference
13850
- * timeout, so "which camera AND which model" is one read. Absent when the
13851
- * family has a single variant.
13852
- */
13853
- variant: string().optional(),
13854
- /**
13855
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13856
- * differencing two reads must drop the interval when it changes, because the
13857
- * counter restarted from zero in a respawned runner. Same discipline as
13858
- * `LoadContribution.startedAtMs`.
13859
- */
13860
- sinceMs: number(),
13861
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13862
- atMs: number(),
13863
- /**
13864
- * THE DENOMINATOR — every attempt on this path for this camera in the
13865
- * window. A failure count published without it is the mistake this schema
13866
- * exists to make impossible.
13867
- */
13868
- attempts: number().int().nonnegative(),
13869
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13870
- succeeded: number().int().nonnegative(),
13871
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13872
- reasons: array(FailureReasonCountSchema).readonly()
13873
- });
13874
- method(_void(), array(FailureContributionSchema).readonly());
13875
- var LoadContributionSchema = object({
13876
- role: _enum([
13877
- "decode",
13878
- "transcode",
13879
- "recording",
13880
- "streaming",
13881
- "detection"
13882
- ]),
13883
- /**
13884
- * The NUMERIC device id — the same value every log line carries as
13885
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13886
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13887
- * contributor that cannot name its camera must not emit the entry at all,
13888
- * because an unnamed per-camera entry is indistinguishable from a shared one
13889
- * and would quietly turn one camera's cost into everybody's.
13890
- */
13891
- deviceId: number().int().positive().nullable(),
13892
- attribution: _enum([
13893
- "measured",
13894
- "accounted",
13895
- "unattributable"
13896
- ]),
13897
- /**
13898
- * What ONE entry is, in the contributor's own words — `615/high`,
13899
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13900
- * family and inventing a common one would lose the only information that
13901
- * makes two entries for the same camera distinguishable.
13902
- */
13903
- unit: string(),
13904
- /**
13905
- * The OS process this cost lives in, when there is one. Present so a
13906
- * consumer can (a) tell two generations of the same unit apart across a
13907
- * restart, and (b) subtract claimed processes from the node's process
13908
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13909
- * process of its own.
13910
- */
13911
- pid: number().int().positive().optional(),
13912
- /**
13913
- * When this generation started. The pid's incarnation marker: a consumer
13914
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13915
- * window when this changes, because the counter restarted from zero in a new
13916
- * process.
13917
- */
13918
- startedAtMs: number().optional(),
13919
- /**
13920
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13921
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13922
- * contribution is asked for.
13923
- *
13924
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13925
- * needs a sampler, and a new per-node sampler is the defect half of
13926
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13927
- * by whoever already keeps a history; a rate cannot be un-averaged.
13928
- *
13929
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13930
- * an entry with no process.
13931
- */
13932
- cpuSeconds: number().optional(),
13933
- /** Resident bytes of this unit's process, same source and same rules. */
13934
- rssBytes: number().optional()
13935
- });
13936
- method(_void(), array(LoadContributionSchema).readonly());
13937
- /**
13938
13985
  * `login-method` — collection cap through which auth addons contribute
13939
13986
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13940
13987
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18610,12 +18657,53 @@ var MediaFileKindEnum = _enum([
18610
18657
  "keyFrameSmall",
18611
18658
  "thumbnailSmall"
18612
18659
  ]);
18660
+ /**
18661
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18662
+ * ARE — never the bytes themselves.
18663
+ *
18664
+ * ## Why `url` and not `base64`
18665
+ *
18666
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18667
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18668
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18669
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18670
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18671
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18672
+ *
18673
+ * `url` points at the `event-media` data plane
18674
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18675
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18676
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18677
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18678
+ * no less protected than they were inside a `view`-level cap response — see
18679
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18680
+ * (per-device scoping).
18681
+ *
18682
+ * The URL is built from the row's **stored** key, which is not always its
18683
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18684
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18685
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18686
+ *
18687
+ * ## `base64` is TRANSITIONAL and is going away
18688
+ *
18689
+ * It is still populated for one reason: the deployed viewer's track-detail
18690
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18691
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18692
+ * triangle — not as absence. Removing the field before that viewer ships is an
18693
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18694
+ * delete this line and the `withBytes` pass-through in
18695
+ * `analytics-query-facade.ts`; nothing else reads it.
18696
+ */
18613
18697
  var MediaFileSchema = object({
18614
18698
  key: string(),
18615
18699
  kind: MediaFileKindEnum,
18616
- base64: string(),
18617
18700
  sizeBytes: number(),
18618
18701
  timestamp: number()
18702
+ }).extend({
18703
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18704
+ url: string(),
18705
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18706
+ base64: string()
18619
18707
  });
18620
18708
  /**
18621
18709
  * One media row WITHOUT its bytes.
@@ -18627,7 +18715,9 @@ var MediaFileSchema = object({
18627
18715
  * blocks the whole view.
18628
18716
  *
18629
18717
  * `sizeBytes` is carried because it is what lets a client decide between the
18630
- * stored blob and a `?variant=thumb` rendering without fetching either.
18718
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18719
+ * `url` because a client that had to build the plane path itself is a second
18720
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18631
18721
  */
18632
18722
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18633
18723
  /**
@@ -19316,6 +19406,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19316
19406
  }), array(MediaFileSchema).readonly()), method(object({
19317
19407
  trackId: string(),
19318
19408
  deviceId: number()
19409
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19410
+ eventId: string(),
19411
+ deviceId: number()
19319
19412
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19320
19413
  kind: "mutation",
19321
19414
  auth: "admin"
@@ -23576,10 +23669,24 @@ var FaceClusterSchema = object({
23576
23669
  size: number().int(),
23577
23670
  cohesion: number()
23578
23671
  });
23672
+ /**
23673
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23674
+ * are — never the bytes.
23675
+ *
23676
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23677
+ * track/event contract) is still populated because a deployed viewer requires
23678
+ * the field to parse a row at all; this method has no such reader. Its ONE
23679
+ * caller is the admin UI's detail modal, which was building
23680
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23681
+ * dialog already rendering its key FRAME from the `event-media` plane.
23682
+ *
23683
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23684
+ * media key directly, so this needed no new plane and no new access decision.
23685
+ */
23579
23686
  var MediaFileLiteSchema$1 = object({
23580
23687
  key: string(),
23581
23688
  kind: string(),
23582
- base64: string(),
23689
+ url: string(),
23583
23690
  sizeBytes: number(),
23584
23691
  timestamp: number()
23585
23692
  });
@@ -25831,10 +25938,24 @@ var PlateInfoSchema = object({
25831
25938
  */
25832
25939
  cropUrl: string().optional()
25833
25940
  });
25941
+ /**
25942
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25943
+ * are — never the bytes.
25944
+ *
25945
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25946
+ * track/event contract) is still populated because a deployed viewer requires
25947
+ * the field to parse a row at all; this method has no such reader. Its ONE
25948
+ * caller is the admin UI's detail modal, which was building
25949
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25950
+ * dialog already rendering its key FRAME from the `event-media` plane.
25951
+ *
25952
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25953
+ * media key directly, so this needed no new plane and no new access decision.
25954
+ */
25834
25955
  var MediaFileLiteSchema = object({
25835
25956
  key: string(),
25836
25957
  kind: string(),
25837
- base64: string(),
25958
+ url: string(),
25838
25959
  sizeBytes: number(),
25839
25960
  timestamp: number()
25840
25961
  });
@@ -31847,6 +31968,12 @@ Object.freeze({
31847
31968
  addonId: null,
31848
31969
  access: "view"
31849
31970
  },
31971
+ "pipelineAnalytics.listEventMedia": {
31972
+ capName: "pipeline-analytics",
31973
+ capScope: "device",
31974
+ addonId: null,
31975
+ access: "view"
31976
+ },
31850
31977
  "pipelineAnalytics.listGroups": {
31851
31978
  capName: "pipeline-analytics",
31852
31979
  capScope: "device",
@@ -35470,6 +35597,11 @@ Object.freeze({
35470
35597
  form: "array",
35471
35598
  optional: false
35472
35599
  }],
35600
+ "pipelineAnalytics.listEventMedia": [{
35601
+ name: "deviceId",
35602
+ form: "single",
35603
+ optional: false
35604
+ }],
35473
35605
  "pipelineAnalytics.listGroups": [{
35474
35606
  name: "deviceIds",
35475
35607
  form: "array",
@@ -8144,6 +8144,21 @@ var RelocateJobSchema = object({
8144
8144
  bytesMoved: number().int(),
8145
8145
  /** Total files discovered up front; null while (or when) unknown. */
8146
8146
  filesTotal: number().int().nullable(),
8147
+ /**
8148
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8149
+ * made that nobody asked for, so it is reported where the operator reads the
8150
+ * job rather than only in a log line.
8151
+ *
8152
+ * A footage segment records its byte count in its own NAME, and the durable
8153
+ * hour row derives its aggregates from those names. A file that does not
8154
+ * match its name therefore makes the ledger's sums — and with them quota and
8155
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8156
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8157
+ *
8158
+ * Absent on lanes where the question has no meaning: a media blob's size is
8159
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8160
+ */
8161
+ rowsReconciled: number().int().nonnegative().optional(),
8147
8162
  startedAt: number(),
8148
8163
  finishedAt: number().nullable(),
8149
8164
  error: string().nullable()
@@ -8212,14 +8227,42 @@ var RelocateMediaInputSchema = object({
8212
8227
  /** Omitted = `move`, the pre-existing behaviour. */
8213
8228
  mode: MediaRelocateModeSchema.optional()
8214
8229
  });
8215
- /** How many rows still carry NO `locationId` — the population a repoint would
8216
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8217
- * value that permits a non-blocking `eventMedia` cutover. */
8218
- var UnstampedEventMediaCountSchema = object({
8219
- media: number().int().nonnegative(),
8220
- retrainFrames: number().int().nonnegative(),
8221
- total: number().int().nonnegative()
8230
+ /**
8231
+ * The unstamped population of ONE collection — split, because the gate and the
8232
+ * operator ask two different questions and only one of them has to be cheap.
8233
+ *
8234
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8235
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8236
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8237
+ * that matters — after a seal, when the population is empty.
8238
+ *
8239
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8240
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8241
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8242
+ * and useful answer: "there are some, and this read could not say how many"
8243
+ * still refuses the cutover, which is the whole job.
8244
+ */
8245
+ var UnstampedRowsSchema = object({
8246
+ present: boolean(),
8247
+ rows: number().int().nonnegative().nullable()
8222
8248
  });
8249
+ /**
8250
+ * How many rows still carry NO `locationId` — the population a repoint would
8251
+ * silently re-aim at a disk that does not hold their bytes.
8252
+ *
8253
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8254
+ * over. The gate opens on a measured absence and on nothing else; an unread
8255
+ * collection and an empty one are different facts, and this repo has already
8256
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8257
+ */
8258
+ var UnstampedEventMediaCountSchema = object({
8259
+ media: UnstampedRowsSchema,
8260
+ retrainFrames: UnstampedRowsSchema,
8261
+ /** True when EITHER collection holds one. The refusal reads this. */
8262
+ anyPresent: boolean(),
8263
+ /** Sum across both, or `null` when either lane could not be counted. */
8264
+ total: number().int().nonnegative().nullable()
8265
+ }).nullable();
8223
8266
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8224
8267
  /** The independently selectable logical storage classes — every class
8225
8268
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8330,6 +8373,10 @@ var StorageMigrationMoveProgressSchema = object({
8330
8373
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8331
8374
  filesTotal: number().int().nonnegative().nullable(),
8332
8375
  bytesMoved: number().int().nonnegative(),
8376
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8377
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8378
+ * rows would be the same failure as one that silently skipped them. */
8379
+ rowsReconciled: number().int().nonnegative().optional(),
8333
8380
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8334
8381
  * crash gets a new mover, and a rate computed from the migration's start
8335
8382
  * would silently average in the time nothing was running. */
@@ -13141,6 +13188,114 @@ method(object({
13141
13188
  height: number()
13142
13189
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13143
13190
  /**
13191
+ * `failure-contribution` — the capability an addon reports its OWN losses
13192
+ * through, per camera, with the denominator attached. It stores nothing.
13193
+ *
13194
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13195
+ *
13196
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13197
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13198
+ * copied: the contributor reports what it already knows, hub-main adds only
13199
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13200
+ * somebody to forget to edit.
13201
+ *
13202
+ * They are not merged, because their invariants are opposites:
13203
+ *
13204
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13205
+ * claim a camera cost nothing, which is a measurement nobody made;
13206
+ * - a `failure-contribution` zero is the **most valuable value on the
13207
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13208
+ * and it is exactly what an absent entry cannot say.
13209
+ *
13210
+ * Putting a loss counter on a cost entry would also break the reconciliation
13211
+ * that gives `load-contribution` its point: contributions are subtracted from
13212
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13213
+ * has no process.
13214
+ *
13215
+ * ## Why not a log line, since the counters already exist
13216
+ *
13217
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13218
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13219
+ * ends in a log line, and a log line is the thing the operator asked to stop
13220
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13221
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13222
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13223
+ * media blackout were both diagnosed. The counters stay; this is where they can
13224
+ * be READ.
13225
+ *
13226
+ * ## The rate is served with its denominator or not at all
13227
+ *
13228
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13229
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13230
+ * than yesterday" and was **flat across twelve hours** once divided by the
13231
+ * successes on the same path. A surface that publishes only the numerator
13232
+ * reproduces that mistake on every read.
13233
+ *
13234
+ * ## Shape
13235
+ *
13236
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13237
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13238
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13239
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13240
+ * a forked runner's entries reach hub-main over transport that already exists.
13241
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13242
+ * result through `system.getFailureContributions`.
13243
+ */
13244
+ var FailureReasonCountSchema = object({
13245
+ /**
13246
+ * Why the attempt did not land, in the contributor's own vocabulary —
13247
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13248
+ * strings that already appear in this repo's logs and, where one exists, the
13249
+ * same string the per-track `previewMissReason` records (D276): a second
13250
+ * vocabulary for the same loss would make the row and the counter
13251
+ * un-joinable.
13252
+ */
13253
+ reason: string(),
13254
+ count: number().int().nonnegative()
13255
+ });
13256
+ var FailureContributionSchema = object({
13257
+ /**
13258
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13259
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13260
+ * `unit` free: the families are owned by different addons and a shared enum
13261
+ * is a central list that rots invisibly.
13262
+ */
13263
+ family: string(),
13264
+ /**
13265
+ * The NUMERIC device id — the same value every log line carries as
13266
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13267
+ * cannot name the camera must not emit the entry, because a fleet total
13268
+ * cannot answer the only question anybody asks of this surface.
13269
+ */
13270
+ deviceId: number().int().positive(),
13271
+ /**
13272
+ * A second dimension inside the family: the model / step id for an inference
13273
+ * timeout, so "which camera AND which model" is one read. Absent when the
13274
+ * family has a single variant.
13275
+ */
13276
+ variant: string().optional(),
13277
+ /**
13278
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13279
+ * differencing two reads must drop the interval when it changes, because the
13280
+ * counter restarted from zero in a respawned runner. Same discipline as
13281
+ * `LoadContribution.startedAtMs`.
13282
+ */
13283
+ sinceMs: number(),
13284
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13285
+ atMs: number(),
13286
+ /**
13287
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13288
+ * window. A failure count published without it is the mistake this schema
13289
+ * exists to make impossible.
13290
+ */
13291
+ attempts: number().int().nonnegative(),
13292
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13293
+ succeeded: number().int().nonnegative(),
13294
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13295
+ reasons: array(FailureReasonCountSchema).readonly()
13296
+ });
13297
+ method(_void(), array(FailureContributionSchema).readonly());
13298
+ /**
13144
13299
  * filesystem-browse — per-node capability for browsing the node's local
13145
13300
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13146
13301
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13662,6 +13817,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13662
13817
  kind: "mutation",
13663
13818
  auth: "admin"
13664
13819
  });
13820
+ var LoadContributionSchema = object({
13821
+ role: _enum([
13822
+ "decode",
13823
+ "transcode",
13824
+ "recording",
13825
+ "streaming",
13826
+ "detection"
13827
+ ]),
13828
+ /**
13829
+ * The NUMERIC device id — the same value every log line carries as
13830
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13831
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13832
+ * contributor that cannot name its camera must not emit the entry at all,
13833
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13834
+ * and would quietly turn one camera's cost into everybody's.
13835
+ */
13836
+ deviceId: number().int().positive().nullable(),
13837
+ attribution: _enum([
13838
+ "measured",
13839
+ "accounted",
13840
+ "unattributable"
13841
+ ]),
13842
+ /**
13843
+ * What ONE entry is, in the contributor's own words — `615/high`,
13844
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13845
+ * family and inventing a common one would lose the only information that
13846
+ * makes two entries for the same camera distinguishable.
13847
+ */
13848
+ unit: string(),
13849
+ /**
13850
+ * The OS process this cost lives in, when there is one. Present so a
13851
+ * consumer can (a) tell two generations of the same unit apart across a
13852
+ * restart, and (b) subtract claimed processes from the node's process
13853
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13854
+ * process of its own.
13855
+ */
13856
+ pid: number().int().positive().optional(),
13857
+ /**
13858
+ * When this generation started. The pid's incarnation marker: a consumer
13859
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13860
+ * window when this changes, because the counter restarted from zero in a new
13861
+ * process.
13862
+ */
13863
+ startedAtMs: number().optional(),
13864
+ /**
13865
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13866
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13867
+ * contribution is asked for.
13868
+ *
13869
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13870
+ * needs a sampler, and a new per-node sampler is the defect half of
13871
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13872
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13873
+ *
13874
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13875
+ * an entry with no process.
13876
+ */
13877
+ cpuSeconds: number().optional(),
13878
+ /** Resident bytes of this unit's process, same source and same rules. */
13879
+ rssBytes: number().optional()
13880
+ });
13881
+ method(_void(), array(LoadContributionSchema).readonly());
13665
13882
  /**
13666
13883
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13667
13884
  * through. It stores nothing.
@@ -13738,176 +13955,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13738
13955
  tags: record(string(), string()).optional()
13739
13956
  }), array(LogEntrySchema).readonly());
13740
13957
  /**
13741
- * `failure-contribution` — the capability an addon reports its OWN losses
13742
- * through, per camera, with the denominator attached. It stores nothing.
13743
- *
13744
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13745
- *
13746
- * `load-contribution` answers *what did this camera COST*. This answers *what
13747
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13748
- * copied: the contributor reports what it already knows, hub-main adds only
13749
- * `addonId`, nothing needs global knowledge, and there is no central list for
13750
- * somebody to forget to edit.
13751
- *
13752
- * They are not merged, because their invariants are opposites:
13753
- *
13754
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13755
- * claim a camera cost nothing, which is a measurement nobody made;
13756
- * - a `failure-contribution` zero is the **most valuable value on the
13757
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13758
- * and it is exactly what an absent entry cannot say.
13759
- *
13760
- * Putting a loss counter on a cost entry would also break the reconciliation
13761
- * that gives `load-contribution` its point: contributions are subtracted from
13762
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13763
- * has no process.
13764
- *
13765
- * ## Why not a log line, since the counters already exist
13766
- *
13767
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13768
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13769
- * ends in a log line, and a log line is the thing the operator asked to stop
13770
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13771
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13772
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13773
- * media blackout were both diagnosed. The counters stay; this is where they can
13774
- * be READ.
13775
- *
13776
- * ## The rate is served with its denominator or not at all
13777
- *
13778
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13779
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13780
- * than yesterday" and was **flat across twelve hours** once divided by the
13781
- * successes on the same path. A surface that publishes only the numerator
13782
- * reproduces that mistake on every read.
13783
- *
13784
- * ## Shape
13785
- *
13786
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13787
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13788
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13789
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13790
- * a forked runner's entries reach hub-main over transport that already exists.
13791
- * No new UDS message, no second registry (D3). The operator reads the assembled
13792
- * result through `system.getFailureContributions`.
13793
- */
13794
- var FailureReasonCountSchema = object({
13795
- /**
13796
- * Why the attempt did not land, in the contributor's own vocabulary —
13797
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13798
- * strings that already appear in this repo's logs and, where one exists, the
13799
- * same string the per-track `previewMissReason` records (D276): a second
13800
- * vocabulary for the same loss would make the row and the counter
13801
- * un-joinable.
13802
- */
13803
- reason: string(),
13804
- count: number().int().nonnegative()
13805
- });
13806
- var FailureContributionSchema = object({
13807
- /**
13808
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13809
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13810
- * `unit` free: the families are owned by different addons and a shared enum
13811
- * is a central list that rots invisibly.
13812
- */
13813
- family: string(),
13814
- /**
13815
- * The NUMERIC device id — the same value every log line carries as
13816
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13817
- * cannot name the camera must not emit the entry, because a fleet total
13818
- * cannot answer the only question anybody asks of this surface.
13819
- */
13820
- deviceId: number().int().positive(),
13821
- /**
13822
- * A second dimension inside the family: the model / step id for an inference
13823
- * timeout, so "which camera AND which model" is one read. Absent when the
13824
- * family has a single variant.
13825
- */
13826
- variant: string().optional(),
13827
- /**
13828
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13829
- * differencing two reads must drop the interval when it changes, because the
13830
- * counter restarted from zero in a respawned runner. Same discipline as
13831
- * `LoadContribution.startedAtMs`.
13832
- */
13833
- sinceMs: number(),
13834
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13835
- atMs: number(),
13836
- /**
13837
- * THE DENOMINATOR — every attempt on this path for this camera in the
13838
- * window. A failure count published without it is the mistake this schema
13839
- * exists to make impossible.
13840
- */
13841
- attempts: number().int().nonnegative(),
13842
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13843
- succeeded: number().int().nonnegative(),
13844
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13845
- reasons: array(FailureReasonCountSchema).readonly()
13846
- });
13847
- method(_void(), array(FailureContributionSchema).readonly());
13848
- var LoadContributionSchema = object({
13849
- role: _enum([
13850
- "decode",
13851
- "transcode",
13852
- "recording",
13853
- "streaming",
13854
- "detection"
13855
- ]),
13856
- /**
13857
- * The NUMERIC device id — the same value every log line carries as
13858
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13859
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13860
- * contributor that cannot name its camera must not emit the entry at all,
13861
- * because an unnamed per-camera entry is indistinguishable from a shared one
13862
- * and would quietly turn one camera's cost into everybody's.
13863
- */
13864
- deviceId: number().int().positive().nullable(),
13865
- attribution: _enum([
13866
- "measured",
13867
- "accounted",
13868
- "unattributable"
13869
- ]),
13870
- /**
13871
- * What ONE entry is, in the contributor's own words — `615/high`,
13872
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13873
- * family and inventing a common one would lose the only information that
13874
- * makes two entries for the same camera distinguishable.
13875
- */
13876
- unit: string(),
13877
- /**
13878
- * The OS process this cost lives in, when there is one. Present so a
13879
- * consumer can (a) tell two generations of the same unit apart across a
13880
- * restart, and (b) subtract claimed processes from the node's process
13881
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13882
- * process of its own.
13883
- */
13884
- pid: number().int().positive().optional(),
13885
- /**
13886
- * When this generation started. The pid's incarnation marker: a consumer
13887
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13888
- * window when this changes, because the counter restarted from zero in a new
13889
- * process.
13890
- */
13891
- startedAtMs: number().optional(),
13892
- /**
13893
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13894
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13895
- * contribution is asked for.
13896
- *
13897
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13898
- * needs a sampler, and a new per-node sampler is the defect half of
13899
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13900
- * by whoever already keeps a history; a rate cannot be un-averaged.
13901
- *
13902
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13903
- * an entry with no process.
13904
- */
13905
- cpuSeconds: number().optional(),
13906
- /** Resident bytes of this unit's process, same source and same rules. */
13907
- rssBytes: number().optional()
13908
- });
13909
- method(_void(), array(LoadContributionSchema).readonly());
13910
- /**
13911
13958
  * `login-method` — collection cap through which auth addons contribute
13912
13959
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13913
13960
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18583,12 +18630,53 @@ var MediaFileKindEnum = _enum([
18583
18630
  "keyFrameSmall",
18584
18631
  "thumbnailSmall"
18585
18632
  ]);
18633
+ /**
18634
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18635
+ * ARE — never the bytes themselves.
18636
+ *
18637
+ * ## Why `url` and not `base64`
18638
+ *
18639
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18640
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18641
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18642
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18643
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18644
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18645
+ *
18646
+ * `url` points at the `event-media` data plane
18647
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18648
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18649
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18650
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18651
+ * no less protected than they were inside a `view`-level cap response — see
18652
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18653
+ * (per-device scoping).
18654
+ *
18655
+ * The URL is built from the row's **stored** key, which is not always its
18656
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18657
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18658
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18659
+ *
18660
+ * ## `base64` is TRANSITIONAL and is going away
18661
+ *
18662
+ * It is still populated for one reason: the deployed viewer's track-detail
18663
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18664
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18665
+ * triangle — not as absence. Removing the field before that viewer ships is an
18666
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18667
+ * delete this line and the `withBytes` pass-through in
18668
+ * `analytics-query-facade.ts`; nothing else reads it.
18669
+ */
18586
18670
  var MediaFileSchema = object({
18587
18671
  key: string(),
18588
18672
  kind: MediaFileKindEnum,
18589
- base64: string(),
18590
18673
  sizeBytes: number(),
18591
18674
  timestamp: number()
18675
+ }).extend({
18676
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18677
+ url: string(),
18678
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18679
+ base64: string()
18592
18680
  });
18593
18681
  /**
18594
18682
  * One media row WITHOUT its bytes.
@@ -18600,7 +18688,9 @@ var MediaFileSchema = object({
18600
18688
  * blocks the whole view.
18601
18689
  *
18602
18690
  * `sizeBytes` is carried because it is what lets a client decide between the
18603
- * stored blob and a `?variant=thumb` rendering without fetching either.
18691
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18692
+ * `url` because a client that had to build the plane path itself is a second
18693
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18604
18694
  */
18605
18695
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18606
18696
  /**
@@ -19289,6 +19379,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19289
19379
  }), array(MediaFileSchema).readonly()), method(object({
19290
19380
  trackId: string(),
19291
19381
  deviceId: number()
19382
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19383
+ eventId: string(),
19384
+ deviceId: number()
19292
19385
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19293
19386
  kind: "mutation",
19294
19387
  auth: "admin"
@@ -23549,10 +23642,24 @@ var FaceClusterSchema = object({
23549
23642
  size: number().int(),
23550
23643
  cohesion: number()
23551
23644
  });
23645
+ /**
23646
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
23647
+ * are — never the bytes.
23648
+ *
23649
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
23650
+ * track/event contract) is still populated because a deployed viewer requires
23651
+ * the field to parse a row at all; this method has no such reader. Its ONE
23652
+ * caller is the admin UI's detail modal, which was building
23653
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
23654
+ * dialog already rendering its key FRAME from the `event-media` plane.
23655
+ *
23656
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
23657
+ * media key directly, so this needed no new plane and no new access decision.
23658
+ */
23552
23659
  var MediaFileLiteSchema$1 = object({
23553
23660
  key: string(),
23554
23661
  kind: string(),
23555
- base64: string(),
23662
+ url: string(),
23556
23663
  sizeBytes: number(),
23557
23664
  timestamp: number()
23558
23665
  });
@@ -25804,10 +25911,24 @@ var PlateInfoSchema = object({
25804
25911
  */
25805
25912
  cropUrl: string().optional()
25806
25913
  });
25914
+ /**
25915
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
25916
+ * are — never the bytes.
25917
+ *
25918
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
25919
+ * track/event contract) is still populated because a deployed viewer requires
25920
+ * the field to parse a row at all; this method has no such reader. Its ONE
25921
+ * caller is the admin UI's detail modal, which was building
25922
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
25923
+ * dialog already rendering its key FRAME from the `event-media` plane.
25924
+ *
25925
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
25926
+ * media key directly, so this needed no new plane and no new access decision.
25927
+ */
25807
25928
  var MediaFileLiteSchema = object({
25808
25929
  key: string(),
25809
25930
  kind: string(),
25810
- base64: string(),
25931
+ url: string(),
25811
25932
  sizeBytes: number(),
25812
25933
  timestamp: number()
25813
25934
  });
@@ -31820,6 +31941,12 @@ Object.freeze({
31820
31941
  addonId: null,
31821
31942
  access: "view"
31822
31943
  },
31944
+ "pipelineAnalytics.listEventMedia": {
31945
+ capName: "pipeline-analytics",
31946
+ capScope: "device",
31947
+ addonId: null,
31948
+ access: "view"
31949
+ },
31823
31950
  "pipelineAnalytics.listGroups": {
31824
31951
  capName: "pipeline-analytics",
31825
31952
  capScope: "device",
@@ -35443,6 +35570,11 @@ Object.freeze({
35443
35570
  form: "array",
35444
35571
  optional: false
35445
35572
  }],
35573
+ "pipelineAnalytics.listEventMedia": [{
35574
+ name: "deviceId",
35575
+ form: "single",
35576
+ optional: false
35577
+ }],
35446
35578
  "pipelineAnalytics.listGroups": [{
35447
35579
  name: "deviceIds",
35448
35580
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-export-alexa",
3
- "version": "1.2.51",
3
+ "version": "1.2.53",
4
4
  "description": "Alexa Smart Home Skill export — hub-side OAuth provider + directive handler. The companion AWS Lambda forwards Alexa directives to this addon's /addon/export-alexa/directive endpoint.",
5
5
  "keywords": [
6
6
  "camstack",