@camstack/addon-provider-dreo 0.2.45 → 0.2.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/addon.js +313 -181
  2. package/dist/addon.mjs +313 -181
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -8039,6 +8039,21 @@ var RelocateJobSchema = object({
8039
8039
  bytesMoved: number().int(),
8040
8040
  /** Total files discovered up front; null while (or when) unknown. */
8041
8041
  filesTotal: number().int().nullable(),
8042
+ /**
8043
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8044
+ * made that nobody asked for, so it is reported where the operator reads the
8045
+ * job rather than only in a log line.
8046
+ *
8047
+ * A footage segment records its byte count in its own NAME, and the durable
8048
+ * hour row derives its aggregates from those names. A file that does not
8049
+ * match its name therefore makes the ledger's sums — and with them quota and
8050
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8051
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8052
+ *
8053
+ * Absent on lanes where the question has no meaning: a media blob's size is
8054
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8055
+ */
8056
+ rowsReconciled: number().int().nonnegative().optional(),
8042
8057
  startedAt: number(),
8043
8058
  finishedAt: number().nullable(),
8044
8059
  error: string().nullable()
@@ -8107,14 +8122,42 @@ var RelocateMediaInputSchema = object({
8107
8122
  /** Omitted = `move`, the pre-existing behaviour. */
8108
8123
  mode: MediaRelocateModeSchema.optional()
8109
8124
  });
8110
- /** How many rows still carry NO `locationId` — the population a repoint would
8111
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8112
- * value that permits a non-blocking `eventMedia` cutover. */
8113
- var UnstampedEventMediaCountSchema = object({
8114
- media: number().int().nonnegative(),
8115
- retrainFrames: number().int().nonnegative(),
8116
- total: number().int().nonnegative()
8125
+ /**
8126
+ * The unstamped population of ONE collection — split, because the gate and the
8127
+ * operator ask two different questions and only one of them has to be cheap.
8128
+ *
8129
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8130
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8131
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8132
+ * that matters — after a seal, when the population is empty.
8133
+ *
8134
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8135
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8136
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8137
+ * and useful answer: "there are some, and this read could not say how many"
8138
+ * still refuses the cutover, which is the whole job.
8139
+ */
8140
+ var UnstampedRowsSchema = object({
8141
+ present: boolean(),
8142
+ rows: number().int().nonnegative().nullable()
8117
8143
  });
8144
+ /**
8145
+ * How many rows still carry NO `locationId` — the population a repoint would
8146
+ * silently re-aim at a disk that does not hold their bytes.
8147
+ *
8148
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8149
+ * over. The gate opens on a measured absence and on nothing else; an unread
8150
+ * collection and an empty one are different facts, and this repo has already
8151
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8152
+ */
8153
+ var UnstampedEventMediaCountSchema = object({
8154
+ media: UnstampedRowsSchema,
8155
+ retrainFrames: UnstampedRowsSchema,
8156
+ /** True when EITHER collection holds one. The refusal reads this. */
8157
+ anyPresent: boolean(),
8158
+ /** Sum across both, or `null` when either lane could not be counted. */
8159
+ total: number().int().nonnegative().nullable()
8160
+ }).nullable();
8118
8161
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8119
8162
  /** The independently selectable logical storage classes — every class
8120
8163
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8225,6 +8268,10 @@ var StorageMigrationMoveProgressSchema = object({
8225
8268
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8226
8269
  filesTotal: number().int().nonnegative().nullable(),
8227
8270
  bytesMoved: number().int().nonnegative(),
8271
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8272
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8273
+ * rows would be the same failure as one that silently skipped them. */
8274
+ rowsReconciled: number().int().nonnegative().optional(),
8228
8275
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8229
8276
  * crash gets a new mover, and a rate computed from the migration's start
8230
8277
  * would silently average in the time nothing was running. */
@@ -13190,6 +13237,114 @@ method(object({
13190
13237
  height: number()
13191
13238
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13192
13239
  /**
13240
+ * `failure-contribution` — the capability an addon reports its OWN losses
13241
+ * through, per camera, with the denominator attached. It stores nothing.
13242
+ *
13243
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13244
+ *
13245
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13246
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13247
+ * copied: the contributor reports what it already knows, hub-main adds only
13248
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13249
+ * somebody to forget to edit.
13250
+ *
13251
+ * They are not merged, because their invariants are opposites:
13252
+ *
13253
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13254
+ * claim a camera cost nothing, which is a measurement nobody made;
13255
+ * - a `failure-contribution` zero is the **most valuable value on the
13256
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13257
+ * and it is exactly what an absent entry cannot say.
13258
+ *
13259
+ * Putting a loss counter on a cost entry would also break the reconciliation
13260
+ * that gives `load-contribution` its point: contributions are subtracted from
13261
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13262
+ * has no process.
13263
+ *
13264
+ * ## Why not a log line, since the counters already exist
13265
+ *
13266
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13267
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13268
+ * ends in a log line, and a log line is the thing the operator asked to stop
13269
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13270
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13271
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13272
+ * media blackout were both diagnosed. The counters stay; this is where they can
13273
+ * be READ.
13274
+ *
13275
+ * ## The rate is served with its denominator or not at all
13276
+ *
13277
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13278
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13279
+ * than yesterday" and was **flat across twelve hours** once divided by the
13280
+ * successes on the same path. A surface that publishes only the numerator
13281
+ * reproduces that mistake on every read.
13282
+ *
13283
+ * ## Shape
13284
+ *
13285
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13286
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13287
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13288
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13289
+ * a forked runner's entries reach hub-main over transport that already exists.
13290
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13291
+ * result through `system.getFailureContributions`.
13292
+ */
13293
+ var FailureReasonCountSchema = object({
13294
+ /**
13295
+ * Why the attempt did not land, in the contributor's own vocabulary —
13296
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13297
+ * strings that already appear in this repo's logs and, where one exists, the
13298
+ * same string the per-track `previewMissReason` records (D276): a second
13299
+ * vocabulary for the same loss would make the row and the counter
13300
+ * un-joinable.
13301
+ */
13302
+ reason: string(),
13303
+ count: number().int().nonnegative()
13304
+ });
13305
+ var FailureContributionSchema = object({
13306
+ /**
13307
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13308
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13309
+ * `unit` free: the families are owned by different addons and a shared enum
13310
+ * is a central list that rots invisibly.
13311
+ */
13312
+ family: string(),
13313
+ /**
13314
+ * The NUMERIC device id — the same value every log line carries as
13315
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13316
+ * cannot name the camera must not emit the entry, because a fleet total
13317
+ * cannot answer the only question anybody asks of this surface.
13318
+ */
13319
+ deviceId: number().int().positive(),
13320
+ /**
13321
+ * A second dimension inside the family: the model / step id for an inference
13322
+ * timeout, so "which camera AND which model" is one read. Absent when the
13323
+ * family has a single variant.
13324
+ */
13325
+ variant: string().optional(),
13326
+ /**
13327
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13328
+ * differencing two reads must drop the interval when it changes, because the
13329
+ * counter restarted from zero in a respawned runner. Same discipline as
13330
+ * `LoadContribution.startedAtMs`.
13331
+ */
13332
+ sinceMs: number(),
13333
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13334
+ atMs: number(),
13335
+ /**
13336
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13337
+ * window. A failure count published without it is the mistake this schema
13338
+ * exists to make impossible.
13339
+ */
13340
+ attempts: number().int().nonnegative(),
13341
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13342
+ succeeded: number().int().nonnegative(),
13343
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13344
+ reasons: array(FailureReasonCountSchema).readonly()
13345
+ });
13346
+ method(_void(), array(FailureContributionSchema).readonly());
13347
+ /**
13193
13348
  * filesystem-browse — per-node capability for browsing the node's local
13194
13349
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13195
13350
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13711,6 +13866,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13711
13866
  kind: "mutation",
13712
13867
  auth: "admin"
13713
13868
  });
13869
+ var LoadContributionSchema = object({
13870
+ role: _enum([
13871
+ "decode",
13872
+ "transcode",
13873
+ "recording",
13874
+ "streaming",
13875
+ "detection"
13876
+ ]),
13877
+ /**
13878
+ * The NUMERIC device id — the same value every log line carries as
13879
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13880
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13881
+ * contributor that cannot name its camera must not emit the entry at all,
13882
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13883
+ * and would quietly turn one camera's cost into everybody's.
13884
+ */
13885
+ deviceId: number().int().positive().nullable(),
13886
+ attribution: _enum([
13887
+ "measured",
13888
+ "accounted",
13889
+ "unattributable"
13890
+ ]),
13891
+ /**
13892
+ * What ONE entry is, in the contributor's own words — `615/high`,
13893
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13894
+ * family and inventing a common one would lose the only information that
13895
+ * makes two entries for the same camera distinguishable.
13896
+ */
13897
+ unit: string(),
13898
+ /**
13899
+ * The OS process this cost lives in, when there is one. Present so a
13900
+ * consumer can (a) tell two generations of the same unit apart across a
13901
+ * restart, and (b) subtract claimed processes from the node's process
13902
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13903
+ * process of its own.
13904
+ */
13905
+ pid: number().int().positive().optional(),
13906
+ /**
13907
+ * When this generation started. The pid's incarnation marker: a consumer
13908
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13909
+ * window when this changes, because the counter restarted from zero in a new
13910
+ * process.
13911
+ */
13912
+ startedAtMs: number().optional(),
13913
+ /**
13914
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13915
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13916
+ * contribution is asked for.
13917
+ *
13918
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13919
+ * needs a sampler, and a new per-node sampler is the defect half of
13920
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13921
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13922
+ *
13923
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13924
+ * an entry with no process.
13925
+ */
13926
+ cpuSeconds: number().optional(),
13927
+ /** Resident bytes of this unit's process, same source and same rules. */
13928
+ rssBytes: number().optional()
13929
+ });
13930
+ method(_void(), array(LoadContributionSchema).readonly());
13714
13931
  /**
13715
13932
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13716
13933
  * through. It stores nothing.
@@ -13787,176 +14004,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13787
14004
  tags: record(string(), string()).optional()
13788
14005
  }), array(LogEntrySchema).readonly());
13789
14006
  /**
13790
- * `failure-contribution` — the capability an addon reports its OWN losses
13791
- * through, per camera, with the denominator attached. It stores nothing.
13792
- *
13793
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13794
- *
13795
- * `load-contribution` answers *what did this camera COST*. This answers *what
13796
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13797
- * copied: the contributor reports what it already knows, hub-main adds only
13798
- * `addonId`, nothing needs global knowledge, and there is no central list for
13799
- * somebody to forget to edit.
13800
- *
13801
- * They are not merged, because their invariants are opposites:
13802
- *
13803
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13804
- * claim a camera cost nothing, which is a measurement nobody made;
13805
- * - a `failure-contribution` zero is the **most valuable value on the
13806
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13807
- * and it is exactly what an absent entry cannot say.
13808
- *
13809
- * Putting a loss counter on a cost entry would also break the reconciliation
13810
- * that gives `load-contribution` its point: contributions are subtracted from
13811
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13812
- * has no process.
13813
- *
13814
- * ## Why not a log line, since the counters already exist
13815
- *
13816
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13817
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13818
- * ends in a log line, and a log line is the thing the operator asked to stop
13819
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13820
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13821
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13822
- * media blackout were both diagnosed. The counters stay; this is where they can
13823
- * be READ.
13824
- *
13825
- * ## The rate is served with its denominator or not at all
13826
- *
13827
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13828
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13829
- * than yesterday" and was **flat across twelve hours** once divided by the
13830
- * successes on the same path. A surface that publishes only the numerator
13831
- * reproduces that mistake on every read.
13832
- *
13833
- * ## Shape
13834
- *
13835
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13836
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13837
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13838
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13839
- * a forked runner's entries reach hub-main over transport that already exists.
13840
- * No new UDS message, no second registry (D3). The operator reads the assembled
13841
- * result through `system.getFailureContributions`.
13842
- */
13843
- var FailureReasonCountSchema = object({
13844
- /**
13845
- * Why the attempt did not land, in the contributor's own vocabulary —
13846
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13847
- * strings that already appear in this repo's logs and, where one exists, the
13848
- * same string the per-track `previewMissReason` records (D276): a second
13849
- * vocabulary for the same loss would make the row and the counter
13850
- * un-joinable.
13851
- */
13852
- reason: string(),
13853
- count: number().int().nonnegative()
13854
- });
13855
- var FailureContributionSchema = object({
13856
- /**
13857
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13858
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13859
- * `unit` free: the families are owned by different addons and a shared enum
13860
- * is a central list that rots invisibly.
13861
- */
13862
- family: string(),
13863
- /**
13864
- * The NUMERIC device id — the same value every log line carries as
13865
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13866
- * cannot name the camera must not emit the entry, because a fleet total
13867
- * cannot answer the only question anybody asks of this surface.
13868
- */
13869
- deviceId: number().int().positive(),
13870
- /**
13871
- * A second dimension inside the family: the model / step id for an inference
13872
- * timeout, so "which camera AND which model" is one read. Absent when the
13873
- * family has a single variant.
13874
- */
13875
- variant: string().optional(),
13876
- /**
13877
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13878
- * differencing two reads must drop the interval when it changes, because the
13879
- * counter restarted from zero in a respawned runner. Same discipline as
13880
- * `LoadContribution.startedAtMs`.
13881
- */
13882
- sinceMs: number(),
13883
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13884
- atMs: number(),
13885
- /**
13886
- * THE DENOMINATOR — every attempt on this path for this camera in the
13887
- * window. A failure count published without it is the mistake this schema
13888
- * exists to make impossible.
13889
- */
13890
- attempts: number().int().nonnegative(),
13891
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13892
- succeeded: number().int().nonnegative(),
13893
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13894
- reasons: array(FailureReasonCountSchema).readonly()
13895
- });
13896
- method(_void(), array(FailureContributionSchema).readonly());
13897
- var LoadContributionSchema = object({
13898
- role: _enum([
13899
- "decode",
13900
- "transcode",
13901
- "recording",
13902
- "streaming",
13903
- "detection"
13904
- ]),
13905
- /**
13906
- * The NUMERIC device id — the same value every log line carries as
13907
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13908
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13909
- * contributor that cannot name its camera must not emit the entry at all,
13910
- * because an unnamed per-camera entry is indistinguishable from a shared one
13911
- * and would quietly turn one camera's cost into everybody's.
13912
- */
13913
- deviceId: number().int().positive().nullable(),
13914
- attribution: _enum([
13915
- "measured",
13916
- "accounted",
13917
- "unattributable"
13918
- ]),
13919
- /**
13920
- * What ONE entry is, in the contributor's own words — `615/high`,
13921
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13922
- * family and inventing a common one would lose the only information that
13923
- * makes two entries for the same camera distinguishable.
13924
- */
13925
- unit: string(),
13926
- /**
13927
- * The OS process this cost lives in, when there is one. Present so a
13928
- * consumer can (a) tell two generations of the same unit apart across a
13929
- * restart, and (b) subtract claimed processes from the node's process
13930
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13931
- * process of its own.
13932
- */
13933
- pid: number().int().positive().optional(),
13934
- /**
13935
- * When this generation started. The pid's incarnation marker: a consumer
13936
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13937
- * window when this changes, because the counter restarted from zero in a new
13938
- * process.
13939
- */
13940
- startedAtMs: number().optional(),
13941
- /**
13942
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13943
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13944
- * contribution is asked for.
13945
- *
13946
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13947
- * needs a sampler, and a new per-node sampler is the defect half of
13948
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13949
- * by whoever already keeps a history; a rate cannot be un-averaged.
13950
- *
13951
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13952
- * an entry with no process.
13953
- */
13954
- cpuSeconds: number().optional(),
13955
- /** Resident bytes of this unit's process, same source and same rules. */
13956
- rssBytes: number().optional()
13957
- });
13958
- method(_void(), array(LoadContributionSchema).readonly());
13959
- /**
13960
14007
  * `login-method` — collection cap through which auth addons contribute
13961
14008
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13962
14009
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18694,12 +18741,53 @@ var MediaFileKindEnum = _enum([
18694
18741
  "keyFrameSmall",
18695
18742
  "thumbnailSmall"
18696
18743
  ]);
18744
+ /**
18745
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18746
+ * ARE — never the bytes themselves.
18747
+ *
18748
+ * ## Why `url` and not `base64`
18749
+ *
18750
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18751
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18752
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18753
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18754
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18755
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18756
+ *
18757
+ * `url` points at the `event-media` data plane
18758
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18759
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18760
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18761
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18762
+ * no less protected than they were inside a `view`-level cap response — see
18763
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18764
+ * (per-device scoping).
18765
+ *
18766
+ * The URL is built from the row's **stored** key, which is not always its
18767
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18768
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18769
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18770
+ *
18771
+ * ## `base64` is TRANSITIONAL and is going away
18772
+ *
18773
+ * It is still populated for one reason: the deployed viewer's track-detail
18774
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18775
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18776
+ * triangle — not as absence. Removing the field before that viewer ships is an
18777
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18778
+ * delete this line and the `withBytes` pass-through in
18779
+ * `analytics-query-facade.ts`; nothing else reads it.
18780
+ */
18697
18781
  var MediaFileSchema = object({
18698
18782
  key: string(),
18699
18783
  kind: MediaFileKindEnum,
18700
- base64: string(),
18701
18784
  sizeBytes: number(),
18702
18785
  timestamp: number()
18786
+ }).extend({
18787
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18788
+ url: string(),
18789
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18790
+ base64: string()
18703
18791
  });
18704
18792
  /**
18705
18793
  * One media row WITHOUT its bytes.
@@ -18711,7 +18799,9 @@ var MediaFileSchema = object({
18711
18799
  * blocks the whole view.
18712
18800
  *
18713
18801
  * `sizeBytes` is carried because it is what lets a client decide between the
18714
- * stored blob and a `?variant=thumb` rendering without fetching either.
18802
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18803
+ * `url` because a client that had to build the plane path itself is a second
18804
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18715
18805
  */
18716
18806
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18717
18807
  /**
@@ -19400,6 +19490,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19400
19490
  }), array(MediaFileSchema).readonly()), method(object({
19401
19491
  trackId: string(),
19402
19492
  deviceId: number()
19493
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19494
+ eventId: string(),
19495
+ deviceId: number()
19403
19496
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19404
19497
  kind: "mutation",
19405
19498
  auth: "admin"
@@ -24398,10 +24491,24 @@ var FaceClusterSchema = object({
24398
24491
  size: number().int(),
24399
24492
  cohesion: number()
24400
24493
  });
24494
+ /**
24495
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24496
+ * are — never the bytes.
24497
+ *
24498
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24499
+ * track/event contract) is still populated because a deployed viewer requires
24500
+ * the field to parse a row at all; this method has no such reader. Its ONE
24501
+ * caller is the admin UI's detail modal, which was building
24502
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24503
+ * dialog already rendering its key FRAME from the `event-media` plane.
24504
+ *
24505
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24506
+ * media key directly, so this needed no new plane and no new access decision.
24507
+ */
24401
24508
  var MediaFileLiteSchema$1 = object({
24402
24509
  key: string(),
24403
24510
  kind: string(),
24404
- base64: string(),
24511
+ url: string(),
24405
24512
  sizeBytes: number(),
24406
24513
  timestamp: number()
24407
24514
  });
@@ -27423,10 +27530,24 @@ var PlateInfoSchema = object({
27423
27530
  */
27424
27531
  cropUrl: string().optional()
27425
27532
  });
27533
+ /**
27534
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27535
+ * are — never the bytes.
27536
+ *
27537
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27538
+ * track/event contract) is still populated because a deployed viewer requires
27539
+ * the field to parse a row at all; this method has no such reader. Its ONE
27540
+ * caller is the admin UI's detail modal, which was building
27541
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27542
+ * dialog already rendering its key FRAME from the `event-media` plane.
27543
+ *
27544
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27545
+ * media key directly, so this needed no new plane and no new access decision.
27546
+ */
27426
27547
  var MediaFileLiteSchema = object({
27427
27548
  key: string(),
27428
27549
  kind: string(),
27429
- base64: string(),
27550
+ url: string(),
27430
27551
  sizeBytes: number(),
27431
27552
  timestamp: number()
27432
27553
  });
@@ -35323,6 +35444,12 @@ Object.freeze({
35323
35444
  addonId: null,
35324
35445
  access: "view"
35325
35446
  },
35447
+ "pipelineAnalytics.listEventMedia": {
35448
+ capName: "pipeline-analytics",
35449
+ capScope: "device",
35450
+ addonId: null,
35451
+ access: "view"
35452
+ },
35326
35453
  "pipelineAnalytics.listGroups": {
35327
35454
  capName: "pipeline-analytics",
35328
35455
  capScope: "device",
@@ -38946,6 +39073,11 @@ Object.freeze({
38946
39073
  form: "array",
38947
39074
  optional: false
38948
39075
  }],
39076
+ "pipelineAnalytics.listEventMedia": [{
39077
+ name: "deviceId",
39078
+ form: "single",
39079
+ optional: false
39080
+ }],
38949
39081
  "pipelineAnalytics.listGroups": [{
38950
39082
  name: "deviceIds",
38951
39083
  form: "array",
package/dist/addon.mjs CHANGED
@@ -8040,6 +8040,21 @@ var RelocateJobSchema = object({
8040
8040
  bytesMoved: number().int(),
8041
8041
  /** Total files discovered up front; null while (or when) unknown. */
8042
8042
  filesTotal: number().int().nullable(),
8043
+ /**
8044
+ * Rows this run CORRECTED while moving them — a durable mutation the move
8045
+ * made that nobody asked for, so it is reported where the operator reads the
8046
+ * job rather than only in a log line.
8047
+ *
8048
+ * A footage segment records its byte count in its own NAME, and the durable
8049
+ * hour row derives its aggregates from those names. A file that does not
8050
+ * match its name therefore makes the ledger's sums — and with them quota and
8051
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
8052
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
8053
+ *
8054
+ * Absent on lanes where the question has no meaning: a media blob's size is
8055
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
8056
+ */
8057
+ rowsReconciled: number().int().nonnegative().optional(),
8043
8058
  startedAt: number(),
8044
8059
  finishedAt: number().nullable(),
8045
8060
  error: string().nullable()
@@ -8108,14 +8123,42 @@ var RelocateMediaInputSchema = object({
8108
8123
  /** Omitted = `move`, the pre-existing behaviour. */
8109
8124
  mode: MediaRelocateModeSchema.optional()
8110
8125
  });
8111
- /** How many rows still carry NO `locationId` — the population a repoint would
8112
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
8113
- * value that permits a non-blocking `eventMedia` cutover. */
8114
- var UnstampedEventMediaCountSchema = object({
8115
- media: number().int().nonnegative(),
8116
- retrainFrames: number().int().nonnegative(),
8117
- total: number().int().nonnegative()
8126
+ /**
8127
+ * The unstamped population of ONE collection — split, because the gate and the
8128
+ * operator ask two different questions and only one of them has to be cheap.
8129
+ *
8130
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
8131
+ * repoint". It is a single indexed seek to the first matching row, so it stays
8132
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
8133
+ * that matters — after a seal, when the population is empty.
8134
+ *
8135
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
8136
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
8137
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
8138
+ * and useful answer: "there are some, and this read could not say how many"
8139
+ * still refuses the cutover, which is the whole job.
8140
+ */
8141
+ var UnstampedRowsSchema = object({
8142
+ present: boolean(),
8143
+ rows: number().int().nonnegative().nullable()
8118
8144
  });
8145
+ /**
8146
+ * How many rows still carry NO `locationId` — the population a repoint would
8147
+ * silently re-aim at a disk that does not hold their bytes.
8148
+ *
8149
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
8150
+ * over. The gate opens on a measured absence and on nothing else; an unread
8151
+ * collection and an empty one are different facts, and this repo has already
8152
+ * paid for conflating them (`RelocateResidueSchema`, D295).
8153
+ */
8154
+ var UnstampedEventMediaCountSchema = object({
8155
+ media: UnstampedRowsSchema,
8156
+ retrainFrames: UnstampedRowsSchema,
8157
+ /** True when EITHER collection holds one. The refusal reads this. */
8158
+ anyPresent: boolean(),
8159
+ /** Sum across both, or `null` when either lane could not be counted. */
8160
+ total: number().int().nonnegative().nullable()
8161
+ }).nullable();
8119
8162
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
8120
8163
  /** The independently selectable logical storage classes — every class
8121
8164
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -8226,6 +8269,10 @@ var StorageMigrationMoveProgressSchema = object({
8226
8269
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
8227
8270
  filesTotal: number().int().nonnegative().nullable(),
8228
8271
  bytesMoved: number().int().nonnegative(),
8272
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
8273
+ * a lane that cannot reconcile. A migration that silently rewrote durable
8274
+ * rows would be the same failure as one that silently skipped them. */
8275
+ rowsReconciled: number().int().nonnegative().optional(),
8229
8276
  /** The MOVER's start, not the migration's: a drain restarted after an addon
8230
8277
  * crash gets a new mover, and a rate computed from the migration's start
8231
8278
  * would silently average in the time nothing was running. */
@@ -13191,6 +13238,114 @@ method(object({
13191
13238
  height: number()
13192
13239
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13193
13240
  /**
13241
+ * `failure-contribution` — the capability an addon reports its OWN losses
13242
+ * through, per camera, with the denominator attached. It stores nothing.
13243
+ *
13244
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13245
+ *
13246
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13247
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13248
+ * copied: the contributor reports what it already knows, hub-main adds only
13249
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13250
+ * somebody to forget to edit.
13251
+ *
13252
+ * They are not merged, because their invariants are opposites:
13253
+ *
13254
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13255
+ * claim a camera cost nothing, which is a measurement nobody made;
13256
+ * - a `failure-contribution` zero is the **most valuable value on the
13257
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13258
+ * and it is exactly what an absent entry cannot say.
13259
+ *
13260
+ * Putting a loss counter on a cost entry would also break the reconciliation
13261
+ * that gives `load-contribution` its point: contributions are subtracted from
13262
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13263
+ * has no process.
13264
+ *
13265
+ * ## Why not a log line, since the counters already exist
13266
+ *
13267
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13268
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13269
+ * ends in a log line, and a log line is the thing the operator asked to stop
13270
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13271
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13272
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13273
+ * media blackout were both diagnosed. The counters stay; this is where they can
13274
+ * be READ.
13275
+ *
13276
+ * ## The rate is served with its denominator or not at all
13277
+ *
13278
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13279
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13280
+ * than yesterday" and was **flat across twelve hours** once divided by the
13281
+ * successes on the same path. A surface that publishes only the numerator
13282
+ * reproduces that mistake on every read.
13283
+ *
13284
+ * ## Shape
13285
+ *
13286
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13287
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13288
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13289
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13290
+ * a forked runner's entries reach hub-main over transport that already exists.
13291
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13292
+ * result through `system.getFailureContributions`.
13293
+ */
13294
+ var FailureReasonCountSchema = object({
13295
+ /**
13296
+ * Why the attempt did not land, in the contributor's own vocabulary —
13297
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13298
+ * strings that already appear in this repo's logs and, where one exists, the
13299
+ * same string the per-track `previewMissReason` records (D276): a second
13300
+ * vocabulary for the same loss would make the row and the counter
13301
+ * un-joinable.
13302
+ */
13303
+ reason: string(),
13304
+ count: number().int().nonnegative()
13305
+ });
13306
+ var FailureContributionSchema = object({
13307
+ /**
13308
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13309
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13310
+ * `unit` free: the families are owned by different addons and a shared enum
13311
+ * is a central list that rots invisibly.
13312
+ */
13313
+ family: string(),
13314
+ /**
13315
+ * The NUMERIC device id — the same value every log line carries as
13316
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13317
+ * cannot name the camera must not emit the entry, because a fleet total
13318
+ * cannot answer the only question anybody asks of this surface.
13319
+ */
13320
+ deviceId: number().int().positive(),
13321
+ /**
13322
+ * A second dimension inside the family: the model / step id for an inference
13323
+ * timeout, so "which camera AND which model" is one read. Absent when the
13324
+ * family has a single variant.
13325
+ */
13326
+ variant: string().optional(),
13327
+ /**
13328
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13329
+ * differencing two reads must drop the interval when it changes, because the
13330
+ * counter restarted from zero in a respawned runner. Same discipline as
13331
+ * `LoadContribution.startedAtMs`.
13332
+ */
13333
+ sinceMs: number(),
13334
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13335
+ atMs: number(),
13336
+ /**
13337
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13338
+ * window. A failure count published without it is the mistake this schema
13339
+ * exists to make impossible.
13340
+ */
13341
+ attempts: number().int().nonnegative(),
13342
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13343
+ succeeded: number().int().nonnegative(),
13344
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13345
+ reasons: array(FailureReasonCountSchema).readonly()
13346
+ });
13347
+ method(_void(), array(FailureContributionSchema).readonly());
13348
+ /**
13194
13349
  * filesystem-browse — per-node capability for browsing the node's local
13195
13350
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13196
13351
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13712,6 +13867,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13712
13867
  kind: "mutation",
13713
13868
  auth: "admin"
13714
13869
  });
13870
+ var LoadContributionSchema = object({
13871
+ role: _enum([
13872
+ "decode",
13873
+ "transcode",
13874
+ "recording",
13875
+ "streaming",
13876
+ "detection"
13877
+ ]),
13878
+ /**
13879
+ * The NUMERIC device id — the same value every log line carries as
13880
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13881
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
13882
+ * contributor that cannot name its camera must not emit the entry at all,
13883
+ * because an unnamed per-camera entry is indistinguishable from a shared one
13884
+ * and would quietly turn one camera's cost into everybody's.
13885
+ */
13886
+ deviceId: number().int().positive().nullable(),
13887
+ attribution: _enum([
13888
+ "measured",
13889
+ "accounted",
13890
+ "unattributable"
13891
+ ]),
13892
+ /**
13893
+ * What ONE entry is, in the contributor's own words — `615/high`,
13894
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13895
+ * family and inventing a common one would lose the only information that
13896
+ * makes two entries for the same camera distinguishable.
13897
+ */
13898
+ unit: string(),
13899
+ /**
13900
+ * The OS process this cost lives in, when there is one. Present so a
13901
+ * consumer can (a) tell two generations of the same unit apart across a
13902
+ * restart, and (b) subtract claimed processes from the node's process
13903
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13904
+ * process of its own.
13905
+ */
13906
+ pid: number().int().positive().optional(),
13907
+ /**
13908
+ * When this generation started. The pid's incarnation marker: a consumer
13909
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13910
+ * window when this changes, because the counter restarted from zero in a new
13911
+ * process.
13912
+ */
13913
+ startedAtMs: number().optional(),
13914
+ /**
13915
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13916
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
13917
+ * contribution is asked for.
13918
+ *
13919
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
13920
+ * needs a sampler, and a new per-node sampler is the defect half of
13921
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13922
+ * by whoever already keeps a history; a rate cannot be un-averaged.
13923
+ *
13924
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13925
+ * an entry with no process.
13926
+ */
13927
+ cpuSeconds: number().optional(),
13928
+ /** Resident bytes of this unit's process, same source and same rules. */
13929
+ rssBytes: number().optional()
13930
+ });
13931
+ method(_void(), array(LoadContributionSchema).readonly());
13715
13932
  /**
13716
13933
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13717
13934
  * through. It stores nothing.
@@ -13788,176 +14005,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13788
14005
  tags: record(string(), string()).optional()
13789
14006
  }), array(LogEntrySchema).readonly());
13790
14007
  /**
13791
- * `failure-contribution` — the capability an addon reports its OWN losses
13792
- * through, per camera, with the denominator attached. It stores nothing.
13793
- *
13794
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13795
- *
13796
- * `load-contribution` answers *what did this camera COST*. This answers *what
13797
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13798
- * copied: the contributor reports what it already knows, hub-main adds only
13799
- * `addonId`, nothing needs global knowledge, and there is no central list for
13800
- * somebody to forget to edit.
13801
- *
13802
- * They are not merged, because their invariants are opposites:
13803
- *
13804
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13805
- * claim a camera cost nothing, which is a measurement nobody made;
13806
- * - a `failure-contribution` zero is the **most valuable value on the
13807
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13808
- * and it is exactly what an absent entry cannot say.
13809
- *
13810
- * Putting a loss counter on a cost entry would also break the reconciliation
13811
- * that gives `load-contribution` its point: contributions are subtracted from
13812
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13813
- * has no process.
13814
- *
13815
- * ## Why not a log line, since the counters already exist
13816
- *
13817
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13818
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13819
- * ends in a log line, and a log line is the thing the operator asked to stop
13820
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13821
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13822
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13823
- * media blackout were both diagnosed. The counters stay; this is where they can
13824
- * be READ.
13825
- *
13826
- * ## The rate is served with its denominator or not at all
13827
- *
13828
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13829
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13830
- * than yesterday" and was **flat across twelve hours** once divided by the
13831
- * successes on the same path. A surface that publishes only the numerator
13832
- * reproduces that mistake on every read.
13833
- *
13834
- * ## Shape
13835
- *
13836
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13837
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13838
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13839
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13840
- * a forked runner's entries reach hub-main over transport that already exists.
13841
- * No new UDS message, no second registry (D3). The operator reads the assembled
13842
- * result through `system.getFailureContributions`.
13843
- */
13844
- var FailureReasonCountSchema = object({
13845
- /**
13846
- * Why the attempt did not land, in the contributor's own vocabulary —
13847
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13848
- * strings that already appear in this repo's logs and, where one exists, the
13849
- * same string the per-track `previewMissReason` records (D276): a second
13850
- * vocabulary for the same loss would make the row and the counter
13851
- * un-joinable.
13852
- */
13853
- reason: string(),
13854
- count: number().int().nonnegative()
13855
- });
13856
- var FailureContributionSchema = object({
13857
- /**
13858
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13859
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13860
- * `unit` free: the families are owned by different addons and a shared enum
13861
- * is a central list that rots invisibly.
13862
- */
13863
- family: string(),
13864
- /**
13865
- * The NUMERIC device id — the same value every log line carries as
13866
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13867
- * cannot name the camera must not emit the entry, because a fleet total
13868
- * cannot answer the only question anybody asks of this surface.
13869
- */
13870
- deviceId: number().int().positive(),
13871
- /**
13872
- * A second dimension inside the family: the model / step id for an inference
13873
- * timeout, so "which camera AND which model" is one read. Absent when the
13874
- * family has a single variant.
13875
- */
13876
- variant: string().optional(),
13877
- /**
13878
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13879
- * differencing two reads must drop the interval when it changes, because the
13880
- * counter restarted from zero in a respawned runner. Same discipline as
13881
- * `LoadContribution.startedAtMs`.
13882
- */
13883
- sinceMs: number(),
13884
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13885
- atMs: number(),
13886
- /**
13887
- * THE DENOMINATOR — every attempt on this path for this camera in the
13888
- * window. A failure count published without it is the mistake this schema
13889
- * exists to make impossible.
13890
- */
13891
- attempts: number().int().nonnegative(),
13892
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13893
- succeeded: number().int().nonnegative(),
13894
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13895
- reasons: array(FailureReasonCountSchema).readonly()
13896
- });
13897
- method(_void(), array(FailureContributionSchema).readonly());
13898
- var LoadContributionSchema = object({
13899
- role: _enum([
13900
- "decode",
13901
- "transcode",
13902
- "recording",
13903
- "streaming",
13904
- "detection"
13905
- ]),
13906
- /**
13907
- * The NUMERIC device id — the same value every log line carries as
13908
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13909
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13910
- * contributor that cannot name its camera must not emit the entry at all,
13911
- * because an unnamed per-camera entry is indistinguishable from a shared one
13912
- * and would quietly turn one camera's cost into everybody's.
13913
- */
13914
- deviceId: number().int().positive().nullable(),
13915
- attribution: _enum([
13916
- "measured",
13917
- "accounted",
13918
- "unattributable"
13919
- ]),
13920
- /**
13921
- * What ONE entry is, in the contributor's own words — `615/high`,
13922
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13923
- * family and inventing a common one would lose the only information that
13924
- * makes two entries for the same camera distinguishable.
13925
- */
13926
- unit: string(),
13927
- /**
13928
- * The OS process this cost lives in, when there is one. Present so a
13929
- * consumer can (a) tell two generations of the same unit apart across a
13930
- * restart, and (b) subtract claimed processes from the node's process
13931
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13932
- * process of its own.
13933
- */
13934
- pid: number().int().positive().optional(),
13935
- /**
13936
- * When this generation started. The pid's incarnation marker: a consumer
13937
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13938
- * window when this changes, because the counter restarted from zero in a new
13939
- * process.
13940
- */
13941
- startedAtMs: number().optional(),
13942
- /**
13943
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13944
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13945
- * contribution is asked for.
13946
- *
13947
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13948
- * needs a sampler, and a new per-node sampler is the defect half of
13949
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13950
- * by whoever already keeps a history; a rate cannot be un-averaged.
13951
- *
13952
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13953
- * an entry with no process.
13954
- */
13955
- cpuSeconds: number().optional(),
13956
- /** Resident bytes of this unit's process, same source and same rules. */
13957
- rssBytes: number().optional()
13958
- });
13959
- method(_void(), array(LoadContributionSchema).readonly());
13960
- /**
13961
14008
  * `login-method` — collection cap through which auth addons contribute
13962
14009
  * their pre-auth login surfaces to the login page. This is the SINGLE,
13963
14010
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18695,12 +18742,53 @@ var MediaFileKindEnum = _enum([
18695
18742
  "keyFrameSmall",
18696
18743
  "thumbnailSmall"
18697
18744
  ]);
18745
+ /**
18746
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
18747
+ * ARE — never the bytes themselves.
18748
+ *
18749
+ * ## Why `url` and not `base64`
18750
+ *
18751
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
18752
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
18753
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
18754
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
18755
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
18756
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
18757
+ *
18758
+ * `url` points at the `event-media` data plane
18759
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
18760
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
18761
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
18762
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
18763
+ * no less protected than they were inside a `view`-level cap response — see
18764
+ * `data-plane-access.ts` for the rule and the one gap it does not close
18765
+ * (per-device scoping).
18766
+ *
18767
+ * The URL is built from the row's **stored** key, which is not always its
18768
+ * published `kind`: a track's face/plate crop is stored as `crop` under
18769
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
18770
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
18771
+ *
18772
+ * ## `base64` is TRANSITIONAL and is going away
18773
+ *
18774
+ * It is still populated for one reason: the deployed viewer's track-detail
18775
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
18776
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
18777
+ * triangle — not as absence. Removing the field before that viewer ships is an
18778
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
18779
+ * delete this line and the `withBytes` pass-through in
18780
+ * `analytics-query-facade.ts`; nothing else reads it.
18781
+ */
18698
18782
  var MediaFileSchema = object({
18699
18783
  key: string(),
18700
18784
  kind: MediaFileKindEnum,
18701
- base64: string(),
18702
18785
  sizeBytes: number(),
18703
18786
  timestamp: number()
18787
+ }).extend({
18788
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
18789
+ url: string(),
18790
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
18791
+ base64: string()
18704
18792
  });
18705
18793
  /**
18706
18794
  * One media row WITHOUT its bytes.
@@ -18712,7 +18800,9 @@ var MediaFileSchema = object({
18712
18800
  * blocks the whole view.
18713
18801
  *
18714
18802
  * `sizeBytes` is carried because it is what lets a client decide between the
18715
- * stored blob and a `?variant=thumb` rendering without fetching either.
18803
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
18804
+ * `url` because a client that had to build the plane path itself is a second
18805
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
18716
18806
  */
18717
18807
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18718
18808
  /**
@@ -19401,6 +19491,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19401
19491
  }), array(MediaFileSchema).readonly()), method(object({
19402
19492
  trackId: string(),
19403
19493
  deviceId: number()
19494
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19495
+ eventId: string(),
19496
+ deviceId: number()
19404
19497
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19405
19498
  kind: "mutation",
19406
19499
  auth: "admin"
@@ -24399,10 +24492,24 @@ var FaceClusterSchema = object({
24399
24492
  size: number().int(),
24400
24493
  cohesion: number()
24401
24494
  });
24495
+ /**
24496
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24497
+ * are — never the bytes.
24498
+ *
24499
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24500
+ * track/event contract) is still populated because a deployed viewer requires
24501
+ * the field to parse a row at all; this method has no such reader. Its ONE
24502
+ * caller is the admin UI's detail modal, which was building
24503
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24504
+ * dialog already rendering its key FRAME from the `event-media` plane.
24505
+ *
24506
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24507
+ * media key directly, so this needed no new plane and no new access decision.
24508
+ */
24402
24509
  var MediaFileLiteSchema$1 = object({
24403
24510
  key: string(),
24404
24511
  kind: string(),
24405
- base64: string(),
24512
+ url: string(),
24406
24513
  sizeBytes: number(),
24407
24514
  timestamp: number()
24408
24515
  });
@@ -27424,10 +27531,24 @@ var PlateInfoSchema = object({
27424
27531
  */
27425
27532
  cropUrl: string().optional()
27426
27533
  });
27534
+ /**
27535
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27536
+ * are — never the bytes.
27537
+ *
27538
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27539
+ * track/event contract) is still populated because a deployed viewer requires
27540
+ * the field to parse a row at all; this method has no such reader. Its ONE
27541
+ * caller is the admin UI's detail modal, which was building
27542
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27543
+ * dialog already rendering its key FRAME from the `event-media` plane.
27544
+ *
27545
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27546
+ * media key directly, so this needed no new plane and no new access decision.
27547
+ */
27427
27548
  var MediaFileLiteSchema = object({
27428
27549
  key: string(),
27429
27550
  kind: string(),
27430
- base64: string(),
27551
+ url: string(),
27431
27552
  sizeBytes: number(),
27432
27553
  timestamp: number()
27433
27554
  });
@@ -35324,6 +35445,12 @@ Object.freeze({
35324
35445
  addonId: null,
35325
35446
  access: "view"
35326
35447
  },
35448
+ "pipelineAnalytics.listEventMedia": {
35449
+ capName: "pipeline-analytics",
35450
+ capScope: "device",
35451
+ addonId: null,
35452
+ access: "view"
35453
+ },
35327
35454
  "pipelineAnalytics.listGroups": {
35328
35455
  capName: "pipeline-analytics",
35329
35456
  capScope: "device",
@@ -38947,6 +39074,11 @@ Object.freeze({
38947
39074
  form: "array",
38948
39075
  optional: false
38949
39076
  }],
39077
+ "pipelineAnalytics.listEventMedia": [{
39078
+ name: "deviceId",
39079
+ form: "single",
39080
+ optional: false
39081
+ }],
38950
39082
  "pipelineAnalytics.listGroups": [{
38951
39083
  name: "deviceIds",
38952
39084
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "description": "Dreo smart-device (fan / air-circulator / purifier / heater / humidifier) device-provider addon for CamStack — wraps the @apocaliss92/nodedreo Dreo cloud client (REST + WebSocket)",
5
5
  "keywords": [
6
6
  "camstack",