@camstack/addon-provider-dreame 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
@@ -58508,6 +58508,21 @@ var RelocateJobSchema = object({
58508
58508
  bytesMoved: number().int(),
58509
58509
  /** Total files discovered up front; null while (or when) unknown. */
58510
58510
  filesTotal: number().int().nullable(),
58511
+ /**
58512
+ * Rows this run CORRECTED while moving them — a durable mutation the move
58513
+ * made that nobody asked for, so it is reported where the operator reads the
58514
+ * job rather than only in a log line.
58515
+ *
58516
+ * A footage segment records its byte count in its own NAME, and the durable
58517
+ * hour row derives its aggregates from those names. A file that does not
58518
+ * match its name therefore makes the ledger's sums — and with them quota and
58519
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
58520
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
58521
+ *
58522
+ * Absent on lanes where the question has no meaning: a media blob's size is
58523
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
58524
+ */
58525
+ rowsReconciled: number().int().nonnegative().optional(),
58511
58526
  startedAt: number(),
58512
58527
  finishedAt: number().nullable(),
58513
58528
  error: string().nullable()
@@ -58576,14 +58591,42 @@ var RelocateMediaInputSchema = object({
58576
58591
  /** Omitted = `move`, the pre-existing behaviour. */
58577
58592
  mode: MediaRelocateModeSchema.optional()
58578
58593
  });
58579
- /** How many rows still carry NO `locationId` — the population a repoint would
58580
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
58581
- * value that permits a non-blocking `eventMedia` cutover. */
58582
- var UnstampedEventMediaCountSchema = object({
58583
- media: number().int().nonnegative(),
58584
- retrainFrames: number().int().nonnegative(),
58585
- total: number().int().nonnegative()
58594
+ /**
58595
+ * The unstamped population of ONE collection — split, because the gate and the
58596
+ * operator ask two different questions and only one of them has to be cheap.
58597
+ *
58598
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
58599
+ * repoint". It is a single indexed seek to the first matching row, so it stays
58600
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
58601
+ * that matters — after a seal, when the population is empty.
58602
+ *
58603
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
58604
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
58605
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
58606
+ * and useful answer: "there are some, and this read could not say how many"
58607
+ * still refuses the cutover, which is the whole job.
58608
+ */
58609
+ var UnstampedRowsSchema = object({
58610
+ present: boolean(),
58611
+ rows: number().int().nonnegative().nullable()
58586
58612
  });
58613
+ /**
58614
+ * How many rows still carry NO `locationId` — the population a repoint would
58615
+ * silently re-aim at a disk that does not hold their bytes.
58616
+ *
58617
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
58618
+ * over. The gate opens on a measured absence and on nothing else; an unread
58619
+ * collection and an empty one are different facts, and this repo has already
58620
+ * paid for conflating them (`RelocateResidueSchema`, D295).
58621
+ */
58622
+ var UnstampedEventMediaCountSchema = object({
58623
+ media: UnstampedRowsSchema,
58624
+ retrainFrames: UnstampedRowsSchema,
58625
+ /** True when EITHER collection holds one. The refusal reads this. */
58626
+ anyPresent: boolean(),
58627
+ /** Sum across both, or `null` when either lane could not be counted. */
58628
+ total: number().int().nonnegative().nullable()
58629
+ }).nullable();
58587
58630
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58588
58631
  /** The independently selectable logical storage classes — every class
58589
58632
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -58694,6 +58737,10 @@ var StorageMigrationMoveProgressSchema = object({
58694
58737
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58695
58738
  filesTotal: number().int().nonnegative().nullable(),
58696
58739
  bytesMoved: number().int().nonnegative(),
58740
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
58741
+ * a lane that cannot reconcile. A migration that silently rewrote durable
58742
+ * rows would be the same failure as one that silently skipped them. */
58743
+ rowsReconciled: number().int().nonnegative().optional(),
58697
58744
  /** The MOVER's start, not the migration's: a drain restarted after an addon
58698
58745
  * crash gets a new mover, and a rate computed from the migration's start
58699
58746
  * would silently average in the time nothing was running. */
@@ -63659,6 +63706,114 @@ method(object({
63659
63706
  height: number()
63660
63707
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
63661
63708
  /**
63709
+ * `failure-contribution` — the capability an addon reports its OWN losses
63710
+ * through, per camera, with the denominator attached. It stores nothing.
63711
+ *
63712
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
63713
+ *
63714
+ * `load-contribution` answers *what did this camera COST*. This answers *what
63715
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
63716
+ * copied: the contributor reports what it already knows, hub-main adds only
63717
+ * `addonId`, nothing needs global knowledge, and there is no central list for
63718
+ * somebody to forget to edit.
63719
+ *
63720
+ * They are not merged, because their invariants are opposites:
63721
+ *
63722
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
63723
+ * claim a camera cost nothing, which is a measurement nobody made;
63724
+ * - a `failure-contribution` zero is the **most valuable value on the
63725
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
63726
+ * and it is exactly what an absent entry cannot say.
63727
+ *
63728
+ * Putting a loss counter on a cost entry would also break the reconciliation
63729
+ * that gives `load-contribution` its point: contributions are subtracted from
63730
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
63731
+ * has no process.
63732
+ *
63733
+ * ## Why not a log line, since the counters already exist
63734
+ *
63735
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
63736
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
63737
+ * ends in a log line, and a log line is the thing the operator asked to stop
63738
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
63739
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
63740
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
63741
+ * media blackout were both diagnosed. The counters stay; this is where they can
63742
+ * be READ.
63743
+ *
63744
+ * ## The rate is served with its denominator or not at all
63745
+ *
63746
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
63747
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
63748
+ * than yesterday" and was **flat across twelve hours** once divided by the
63749
+ * successes on the same path. A surface that publishes only the numerator
63750
+ * reproduces that mistake on every read.
63751
+ *
63752
+ * ## Shape
63753
+ *
63754
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
63755
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
63756
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
63757
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
63758
+ * a forked runner's entries reach hub-main over transport that already exists.
63759
+ * No new UDS message, no second registry (D3). The operator reads the assembled
63760
+ * result through `system.getFailureContributions`.
63761
+ */
63762
+ var FailureReasonCountSchema = object({
63763
+ /**
63764
+ * Why the attempt did not land, in the contributor's own vocabulary —
63765
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
63766
+ * strings that already appear in this repo's logs and, where one exists, the
63767
+ * same string the per-track `previewMissReason` records (D276): a second
63768
+ * vocabulary for the same loss would make the row and the counter
63769
+ * un-joinable.
63770
+ */
63771
+ reason: string(),
63772
+ count: number().int().nonnegative()
63773
+ });
63774
+ var FailureContributionSchema = object({
63775
+ /**
63776
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
63777
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
63778
+ * `unit` free: the families are owned by different addons and a shared enum
63779
+ * is a central list that rots invisibly.
63780
+ */
63781
+ family: string(),
63782
+ /**
63783
+ * The NUMERIC device id — the same value every log line carries as
63784
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
63785
+ * cannot name the camera must not emit the entry, because a fleet total
63786
+ * cannot answer the only question anybody asks of this surface.
63787
+ */
63788
+ deviceId: number().int().positive(),
63789
+ /**
63790
+ * A second dimension inside the family: the model / step id for an inference
63791
+ * timeout, so "which camera AND which model" is one read. Absent when the
63792
+ * family has a single variant.
63793
+ */
63794
+ variant: string().optional(),
63795
+ /**
63796
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
63797
+ * differencing two reads must drop the interval when it changes, because the
63798
+ * counter restarted from zero in a respawned runner. Same discipline as
63799
+ * `LoadContribution.startedAtMs`.
63800
+ */
63801
+ sinceMs: number(),
63802
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
63803
+ atMs: number(),
63804
+ /**
63805
+ * THE DENOMINATOR — every attempt on this path for this camera in the
63806
+ * window. A failure count published without it is the mistake this schema
63807
+ * exists to make impossible.
63808
+ */
63809
+ attempts: number().int().nonnegative(),
63810
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
63811
+ succeeded: number().int().nonnegative(),
63812
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
63813
+ reasons: array(FailureReasonCountSchema).readonly()
63814
+ });
63815
+ method(_void(), array(FailureContributionSchema).readonly());
63816
+ /**
63662
63817
  * filesystem-browse — per-node capability for browsing the node's local
63663
63818
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
63664
63819
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -64180,6 +64335,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
64180
64335
  kind: "mutation",
64181
64336
  auth: "admin"
64182
64337
  });
64338
+ var LoadContributionSchema = object({
64339
+ role: _enum([
64340
+ "decode",
64341
+ "transcode",
64342
+ "recording",
64343
+ "streaming",
64344
+ "detection"
64345
+ ]),
64346
+ /**
64347
+ * The NUMERIC device id — the same value every log line carries as
64348
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
64349
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
64350
+ * contributor that cannot name its camera must not emit the entry at all,
64351
+ * because an unnamed per-camera entry is indistinguishable from a shared one
64352
+ * and would quietly turn one camera's cost into everybody's.
64353
+ */
64354
+ deviceId: number().int().positive().nullable(),
64355
+ attribution: _enum([
64356
+ "measured",
64357
+ "accounted",
64358
+ "unattributable"
64359
+ ]),
64360
+ /**
64361
+ * What ONE entry is, in the contributor's own words — `615/high`,
64362
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
64363
+ * family and inventing a common one would lose the only information that
64364
+ * makes two entries for the same camera distinguishable.
64365
+ */
64366
+ unit: string(),
64367
+ /**
64368
+ * The OS process this cost lives in, when there is one. Present so a
64369
+ * consumer can (a) tell two generations of the same unit apart across a
64370
+ * restart, and (b) subtract claimed processes from the node's process
64371
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
64372
+ * process of its own.
64373
+ */
64374
+ pid: number().int().positive().optional(),
64375
+ /**
64376
+ * When this generation started. The pid's incarnation marker: a consumer
64377
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
64378
+ * window when this changes, because the counter restarted from zero in a new
64379
+ * process.
64380
+ */
64381
+ startedAtMs: number().optional(),
64382
+ /**
64383
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
64384
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
64385
+ * contribution is asked for.
64386
+ *
64387
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
64388
+ * needs a sampler, and a new per-node sampler is the defect half of
64389
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
64390
+ * by whoever already keeps a history; a rate cannot be un-averaged.
64391
+ *
64392
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
64393
+ * an entry with no process.
64394
+ */
64395
+ cpuSeconds: number().optional(),
64396
+ /** Resident bytes of this unit's process, same source and same rules. */
64397
+ rssBytes: number().optional()
64398
+ });
64399
+ method(_void(), array(LoadContributionSchema).readonly());
64183
64400
  /**
64184
64401
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
64185
64402
  * through. It stores nothing.
@@ -64256,176 +64473,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
64256
64473
  tags: record(string(), string()).optional()
64257
64474
  }), array(LogEntrySchema).readonly());
64258
64475
  /**
64259
- * `failure-contribution` — the capability an addon reports its OWN losses
64260
- * through, per camera, with the denominator attached. It stores nothing.
64261
- *
64262
- * ## The twin of `load-contribution`, and why it is a twin and not a field
64263
- *
64264
- * `load-contribution` answers *what did this camera COST*. This answers *what
64265
- * did this camera LOSE*. The reporting discipline is identical and deliberately
64266
- * copied: the contributor reports what it already knows, hub-main adds only
64267
- * `addonId`, nothing needs global knowledge, and there is no central list for
64268
- * somebody to forget to edit.
64269
- *
64270
- * They are not merged, because their invariants are opposites:
64271
- *
64272
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
64273
- * claim a camera cost nothing, which is a measurement nobody made;
64274
- * - a `failure-contribution` zero is the **most valuable value on the
64275
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
64276
- * and it is exactly what an absent entry cannot say.
64277
- *
64278
- * Putting a loss counter on a cost entry would also break the reconciliation
64279
- * that gives `load-contribution` its point: contributions are subtracted from
64280
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
64281
- * has no process.
64282
- *
64283
- * ## Why not a log line, since the counters already exist
64284
- *
64285
- * Several of these paths already counted themselves — `CaptureScheduler`'s
64286
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
64287
- * ends in a log line, and a log line is the thing the operator asked to stop
64288
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
64289
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
64290
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
64291
- * media blackout were both diagnosed. The counters stay; this is where they can
64292
- * be READ.
64293
- *
64294
- * ## The rate is served with its denominator or not at all
64295
- *
64296
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
64297
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
64298
- * than yesterday" and was **flat across twelve hours** once divided by the
64299
- * successes on the same path. A surface that publishes only the numerator
64300
- * reproduces that mistake on every read.
64301
- *
64302
- * ## Shape
64303
- *
64304
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
64305
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
64306
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
64307
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
64308
- * a forked runner's entries reach hub-main over transport that already exists.
64309
- * No new UDS message, no second registry (D3). The operator reads the assembled
64310
- * result through `system.getFailureContributions`.
64311
- */
64312
- var FailureReasonCountSchema = object({
64313
- /**
64314
- * Why the attempt did not land, in the contributor's own vocabulary —
64315
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
64316
- * strings that already appear in this repo's logs and, where one exists, the
64317
- * same string the per-track `previewMissReason` records (D276): a second
64318
- * vocabulary for the same loss would make the row and the counter
64319
- * un-joinable.
64320
- */
64321
- reason: string(),
64322
- count: number().int().nonnegative()
64323
- });
64324
- var FailureContributionSchema = object({
64325
- /**
64326
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
64327
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
64328
- * `unit` free: the families are owned by different addons and a shared enum
64329
- * is a central list that rots invisibly.
64330
- */
64331
- family: string(),
64332
- /**
64333
- * The NUMERIC device id — the same value every log line carries as
64334
- * `tags.deviceId`. Never nullable and never absent: a contributor that
64335
- * cannot name the camera must not emit the entry, because a fleet total
64336
- * cannot answer the only question anybody asks of this surface.
64337
- */
64338
- deviceId: number().int().positive(),
64339
- /**
64340
- * A second dimension inside the family: the model / step id for an inference
64341
- * timeout, so "which camera AND which model" is one read. Absent when the
64342
- * family has a single variant.
64343
- */
64344
- variant: string().optional(),
64345
- /**
64346
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
64347
- * differencing two reads must drop the interval when it changes, because the
64348
- * counter restarted from zero in a respawned runner. Same discipline as
64349
- * `LoadContribution.startedAtMs`.
64350
- */
64351
- sinceMs: number(),
64352
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
64353
- atMs: number(),
64354
- /**
64355
- * THE DENOMINATOR — every attempt on this path for this camera in the
64356
- * window. A failure count published without it is the mistake this schema
64357
- * exists to make impossible.
64358
- */
64359
- attempts: number().int().nonnegative(),
64360
- /** Attempts that landed. `attempts - succeeded` is the loss. */
64361
- succeeded: number().int().nonnegative(),
64362
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
64363
- reasons: array(FailureReasonCountSchema).readonly()
64364
- });
64365
- method(_void(), array(FailureContributionSchema).readonly());
64366
- var LoadContributionSchema = object({
64367
- role: _enum([
64368
- "decode",
64369
- "transcode",
64370
- "recording",
64371
- "streaming",
64372
- "detection"
64373
- ]),
64374
- /**
64375
- * The NUMERIC device id — the same value every log line carries as
64376
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
64377
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
64378
- * contributor that cannot name its camera must not emit the entry at all,
64379
- * because an unnamed per-camera entry is indistinguishable from a shared one
64380
- * and would quietly turn one camera's cost into everybody's.
64381
- */
64382
- deviceId: number().int().positive().nullable(),
64383
- attribution: _enum([
64384
- "measured",
64385
- "accounted",
64386
- "unattributable"
64387
- ]),
64388
- /**
64389
- * What ONE entry is, in the contributor's own words — `615/high`,
64390
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
64391
- * family and inventing a common one would lose the only information that
64392
- * makes two entries for the same camera distinguishable.
64393
- */
64394
- unit: string(),
64395
- /**
64396
- * The OS process this cost lives in, when there is one. Present so a
64397
- * consumer can (a) tell two generations of the same unit apart across a
64398
- * restart, and (b) subtract claimed processes from the node's process
64399
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
64400
- * process of its own.
64401
- */
64402
- pid: number().int().positive().optional(),
64403
- /**
64404
- * When this generation started. The pid's incarnation marker: a consumer
64405
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
64406
- * window when this changes, because the counter restarted from zero in a new
64407
- * process.
64408
- */
64409
- startedAtMs: number().optional(),
64410
- /**
64411
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
64412
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
64413
- * contribution is asked for.
64414
- *
64415
- * Cumulative and not a rate on purpose: a rate needs a window, a window
64416
- * needs a sampler, and a new per-node sampler is the defect half of
64417
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
64418
- * by whoever already keeps a history; a rate cannot be un-averaged.
64419
- *
64420
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
64421
- * an entry with no process.
64422
- */
64423
- cpuSeconds: number().optional(),
64424
- /** Resident bytes of this unit's process, same source and same rules. */
64425
- rssBytes: number().optional()
64426
- });
64427
- method(_void(), array(LoadContributionSchema).readonly());
64428
- /**
64429
64476
  * `login-method` — collection cap through which auth addons contribute
64430
64477
  * their pre-auth login surfaces to the login page. This is the SINGLE,
64431
64478
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -69163,12 +69210,53 @@ var MediaFileKindEnum = _enum([
69163
69210
  "keyFrameSmall",
69164
69211
  "thumbnailSmall"
69165
69212
  ]);
69213
+ /**
69214
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
69215
+ * ARE — never the bytes themselves.
69216
+ *
69217
+ * ## Why `url` and not `base64`
69218
+ *
69219
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
69220
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
69221
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
69222
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
69223
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
69224
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
69225
+ *
69226
+ * `url` points at the `event-media` data plane
69227
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
69228
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
69229
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
69230
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
69231
+ * no less protected than they were inside a `view`-level cap response — see
69232
+ * `data-plane-access.ts` for the rule and the one gap it does not close
69233
+ * (per-device scoping).
69234
+ *
69235
+ * The URL is built from the row's **stored** key, which is not always its
69236
+ * published `kind`: a track's face/plate crop is stored as `crop` under
69237
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
69238
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
69239
+ *
69240
+ * ## `base64` is TRANSITIONAL and is going away
69241
+ *
69242
+ * It is still populated for one reason: the deployed viewer's track-detail
69243
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
69244
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
69245
+ * triangle — not as absence. Removing the field before that viewer ships is an
69246
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
69247
+ * delete this line and the `withBytes` pass-through in
69248
+ * `analytics-query-facade.ts`; nothing else reads it.
69249
+ */
69166
69250
  var MediaFileSchema = object({
69167
69251
  key: string(),
69168
69252
  kind: MediaFileKindEnum,
69169
- base64: string(),
69170
69253
  sizeBytes: number(),
69171
69254
  timestamp: number()
69255
+ }).extend({
69256
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
69257
+ url: string(),
69258
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
69259
+ base64: string()
69172
69260
  });
69173
69261
  /**
69174
69262
  * One media row WITHOUT its bytes.
@@ -69180,7 +69268,9 @@ var MediaFileSchema = object({
69180
69268
  * blocks the whole view.
69181
69269
  *
69182
69270
  * `sizeBytes` is carried because it is what lets a client decide between the
69183
- * stored blob and a `?variant=thumb` rendering without fetching either.
69271
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
69272
+ * `url` because a client that had to build the plane path itself is a second
69273
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
69184
69274
  */
69185
69275
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
69186
69276
  /**
@@ -69869,6 +69959,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69869
69959
  }), array(MediaFileSchema).readonly()), method(object({
69870
69960
  trackId: string(),
69871
69961
  deviceId: number()
69962
+ }), array(MediaFileInfoSchema).readonly()), method(object({
69963
+ eventId: string(),
69964
+ deviceId: number()
69872
69965
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
69873
69966
  kind: "mutation",
69874
69967
  auth: "admin"
@@ -74884,10 +74977,24 @@ var FaceClusterSchema = object({
74884
74977
  size: number().int(),
74885
74978
  cohesion: number()
74886
74979
  });
74980
+ /**
74981
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
74982
+ * are — never the bytes.
74983
+ *
74984
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
74985
+ * track/event contract) is still populated because a deployed viewer requires
74986
+ * the field to parse a row at all; this method has no such reader. Its ONE
74987
+ * caller is the admin UI's detail modal, which was building
74988
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
74989
+ * dialog already rendering its key FRAME from the `event-media` plane.
74990
+ *
74991
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
74992
+ * media key directly, so this needed no new plane and no new access decision.
74993
+ */
74887
74994
  var MediaFileLiteSchema$1 = object({
74888
74995
  key: string(),
74889
74996
  kind: string(),
74890
- base64: string(),
74997
+ url: string(),
74891
74998
  sizeBytes: number(),
74892
74999
  timestamp: number()
74893
75000
  });
@@ -77909,10 +78016,24 @@ var PlateInfoSchema = object({
77909
78016
  */
77910
78017
  cropUrl: string().optional()
77911
78018
  });
78019
+ /**
78020
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
78021
+ * are — never the bytes.
78022
+ *
78023
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
78024
+ * track/event contract) is still populated because a deployed viewer requires
78025
+ * the field to parse a row at all; this method has no such reader. Its ONE
78026
+ * caller is the admin UI's detail modal, which was building
78027
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
78028
+ * dialog already rendering its key FRAME from the `event-media` plane.
78029
+ *
78030
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
78031
+ * media key directly, so this needed no new plane and no new access decision.
78032
+ */
77912
78033
  var MediaFileLiteSchema = object({
77913
78034
  key: string(),
77914
78035
  kind: string(),
77915
- base64: string(),
78036
+ url: string(),
77916
78037
  sizeBytes: number(),
77917
78038
  timestamp: number()
77918
78039
  });
@@ -85809,6 +85930,12 @@ Object.freeze({
85809
85930
  addonId: null,
85810
85931
  access: "view"
85811
85932
  },
85933
+ "pipelineAnalytics.listEventMedia": {
85934
+ capName: "pipeline-analytics",
85935
+ capScope: "device",
85936
+ addonId: null,
85937
+ access: "view"
85938
+ },
85812
85939
  "pipelineAnalytics.listGroups": {
85813
85940
  capName: "pipeline-analytics",
85814
85941
  capScope: "device",
@@ -89432,6 +89559,11 @@ Object.freeze({
89432
89559
  form: "array",
89433
89560
  optional: false
89434
89561
  }],
89562
+ "pipelineAnalytics.listEventMedia": [{
89563
+ name: "deviceId",
89564
+ form: "single",
89565
+ optional: false
89566
+ }],
89435
89567
  "pipelineAnalytics.listGroups": [{
89436
89568
  name: "deviceIds",
89437
89569
  form: "array",
package/dist/addon.mjs CHANGED
@@ -58508,6 +58508,21 @@ var RelocateJobSchema = object({
58508
58508
  bytesMoved: number().int(),
58509
58509
  /** Total files discovered up front; null while (or when) unknown. */
58510
58510
  filesTotal: number().int().nullable(),
58511
+ /**
58512
+ * Rows this run CORRECTED while moving them — a durable mutation the move
58513
+ * made that nobody asked for, so it is reported where the operator reads the
58514
+ * job rather than only in a log line.
58515
+ *
58516
+ * A footage segment records its byte count in its own NAME, and the durable
58517
+ * hour row derives its aggregates from those names. A file that does not
58518
+ * match its name therefore makes the ledger's sums — and with them quota and
58519
+ * pressure eviction — wrong by the difference, and only a rename can fix it.
58520
+ * On 2026-08-30 one such row also stalled a 110 749-file drain permanently.
58521
+ *
58522
+ * Absent on lanes where the question has no meaning: a media blob's size is
58523
+ * in its row, not in its name, so `MediaRelocateEngine` never reconciles one.
58524
+ */
58525
+ rowsReconciled: number().int().nonnegative().optional(),
58511
58526
  startedAt: number(),
58512
58527
  finishedAt: number().nullable(),
58513
58528
  error: string().nullable()
@@ -58576,14 +58591,42 @@ var RelocateMediaInputSchema = object({
58576
58591
  /** Omitted = `move`, the pre-existing behaviour. */
58577
58592
  mode: MediaRelocateModeSchema.optional()
58578
58593
  });
58579
- /** How many rows still carry NO `locationId` — the population a repoint would
58580
- * silently re-aim at a disk that does not hold their bytes. Zero is the only
58581
- * value that permits a non-blocking `eventMedia` cutover. */
58582
- var UnstampedEventMediaCountSchema = object({
58583
- media: number().int().nonnegative(),
58584
- retrainFrames: number().int().nonnegative(),
58585
- total: number().int().nonnegative()
58594
+ /**
58595
+ * The unstamped population of ONE collection — split, because the gate and the
58596
+ * operator ask two different questions and only one of them has to be cheap.
58597
+ *
58598
+ * `present` is the GATE: "is there at least one row that would be orphaned by a
58599
+ * repoint". It is a single indexed seek to the first matching row, so it stays
58600
+ * answerable on a saturated disk and answers in O(log n) precisely in the state
58601
+ * that matters — after a seal, when the population is empty.
58602
+ *
58603
+ * `rows` is the NUMBER, for the refusal message and the operator's sense of
58604
+ * scale. It is a second, indexed `COUNT(*)`, and `null` means **not
58605
+ * measurable** — never zero. `{ present: true, rows: null }` is a legitimate
58606
+ * and useful answer: "there are some, and this read could not say how many"
58607
+ * still refuses the cutover, which is the whole job.
58608
+ */
58609
+ var UnstampedRowsSchema = object({
58610
+ present: boolean(),
58611
+ rows: number().int().nonnegative().nullable()
58586
58612
  });
58613
+ /**
58614
+ * How many rows still carry NO `locationId` — the population a repoint would
58615
+ * silently re-aim at a disk that does not hold their bytes.
58616
+ *
58617
+ * **`null` = the count could not be taken**, and it is NOT permission to cut
58618
+ * over. The gate opens on a measured absence and on nothing else; an unread
58619
+ * collection and an empty one are different facts, and this repo has already
58620
+ * paid for conflating them (`RelocateResidueSchema`, D295).
58621
+ */
58622
+ var UnstampedEventMediaCountSchema = object({
58623
+ media: UnstampedRowsSchema,
58624
+ retrainFrames: UnstampedRowsSchema,
58625
+ /** True when EITHER collection holds one. The refusal reads this. */
58626
+ anyPresent: boolean(),
58627
+ /** Sum across both, or `null` when either lane could not be counted. */
58628
+ total: number().int().nonnegative().nullable()
58629
+ }).nullable();
58587
58630
  var StorageMigrationMediaMoveInputSchema = RelocateMediaInputSchema.extend({ leaseId: string().min(1) });
58588
58631
  /** The independently selectable logical storage classes — every class
58589
58632
  * `storage.listLocationDeclarations` reports, so an operator never meets a
@@ -58694,6 +58737,10 @@ var StorageMigrationMoveProgressSchema = object({
58694
58737
  /** The archive census — the **M** of "N of M" (D295). `null` = unknowable. */
58695
58738
  filesTotal: number().int().nonnegative().nullable(),
58696
58739
  bytesMoved: number().int().nonnegative(),
58740
+ /** Rows the mover corrected while moving them — see `RelocateJob`. Absent on
58741
+ * a lane that cannot reconcile. A migration that silently rewrote durable
58742
+ * rows would be the same failure as one that silently skipped them. */
58743
+ rowsReconciled: number().int().nonnegative().optional(),
58697
58744
  /** The MOVER's start, not the migration's: a drain restarted after an addon
58698
58745
  * crash gets a new mover, and a rate computed from the migration's start
58699
58746
  * would silently average in the time nothing was running. */
@@ -63659,6 +63706,114 @@ method(object({
63659
63706
  height: number()
63660
63707
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
63661
63708
  /**
63709
+ * `failure-contribution` — the capability an addon reports its OWN losses
63710
+ * through, per camera, with the denominator attached. It stores nothing.
63711
+ *
63712
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
63713
+ *
63714
+ * `load-contribution` answers *what did this camera COST*. This answers *what
63715
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
63716
+ * copied: the contributor reports what it already knows, hub-main adds only
63717
+ * `addonId`, nothing needs global knowledge, and there is no central list for
63718
+ * somebody to forget to edit.
63719
+ *
63720
+ * They are not merged, because their invariants are opposites:
63721
+ *
63722
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
63723
+ * claim a camera cost nothing, which is a measurement nobody made;
63724
+ * - a `failure-contribution` zero is the **most valuable value on the
63725
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
63726
+ * and it is exactly what an absent entry cannot say.
63727
+ *
63728
+ * Putting a loss counter on a cost entry would also break the reconciliation
63729
+ * that gives `load-contribution` its point: contributions are subtracted from
63730
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
63731
+ * has no process.
63732
+ *
63733
+ * ## Why not a log line, since the counters already exist
63734
+ *
63735
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
63736
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
63737
+ * ends in a log line, and a log line is the thing the operator asked to stop
63738
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
63739
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
63740
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
63741
+ * media blackout were both diagnosed. The counters stay; this is where they can
63742
+ * be READ.
63743
+ *
63744
+ * ## The rate is served with its denominator or not at all
63745
+ *
63746
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
63747
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
63748
+ * than yesterday" and was **flat across twelve hours** once divided by the
63749
+ * successes on the same path. A surface that publishes only the numerator
63750
+ * reproduces that mistake on every read.
63751
+ *
63752
+ * ## Shape
63753
+ *
63754
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
63755
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
63756
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
63757
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
63758
+ * a forked runner's entries reach hub-main over transport that already exists.
63759
+ * No new UDS message, no second registry (D3). The operator reads the assembled
63760
+ * result through `system.getFailureContributions`.
63761
+ */
63762
+ var FailureReasonCountSchema = object({
63763
+ /**
63764
+ * Why the attempt did not land, in the contributor's own vocabulary —
63765
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
63766
+ * strings that already appear in this repo's logs and, where one exists, the
63767
+ * same string the per-track `previewMissReason` records (D276): a second
63768
+ * vocabulary for the same loss would make the row and the counter
63769
+ * un-joinable.
63770
+ */
63771
+ reason: string(),
63772
+ count: number().int().nonnegative()
63773
+ });
63774
+ var FailureContributionSchema = object({
63775
+ /**
63776
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
63777
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
63778
+ * `unit` free: the families are owned by different addons and a shared enum
63779
+ * is a central list that rots invisibly.
63780
+ */
63781
+ family: string(),
63782
+ /**
63783
+ * The NUMERIC device id — the same value every log line carries as
63784
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
63785
+ * cannot name the camera must not emit the entry, because a fleet total
63786
+ * cannot answer the only question anybody asks of this surface.
63787
+ */
63788
+ deviceId: number().int().positive(),
63789
+ /**
63790
+ * A second dimension inside the family: the model / step id for an inference
63791
+ * timeout, so "which camera AND which model" is one read. Absent when the
63792
+ * family has a single variant.
63793
+ */
63794
+ variant: string().optional(),
63795
+ /**
63796
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
63797
+ * differencing two reads must drop the interval when it changes, because the
63798
+ * counter restarted from zero in a respawned runner. Same discipline as
63799
+ * `LoadContribution.startedAtMs`.
63800
+ */
63801
+ sinceMs: number(),
63802
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
63803
+ atMs: number(),
63804
+ /**
63805
+ * THE DENOMINATOR — every attempt on this path for this camera in the
63806
+ * window. A failure count published without it is the mistake this schema
63807
+ * exists to make impossible.
63808
+ */
63809
+ attempts: number().int().nonnegative(),
63810
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
63811
+ succeeded: number().int().nonnegative(),
63812
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
63813
+ reasons: array(FailureReasonCountSchema).readonly()
63814
+ });
63815
+ method(_void(), array(FailureContributionSchema).readonly());
63816
+ /**
63662
63817
  * filesystem-browse — per-node capability for browsing the node's local
63663
63818
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
63664
63819
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -64180,6 +64335,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
64180
64335
  kind: "mutation",
64181
64336
  auth: "admin"
64182
64337
  });
64338
+ var LoadContributionSchema = object({
64339
+ role: _enum([
64340
+ "decode",
64341
+ "transcode",
64342
+ "recording",
64343
+ "streaming",
64344
+ "detection"
64345
+ ]),
64346
+ /**
64347
+ * The NUMERIC device id — the same value every log line carries as
64348
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
64349
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
64350
+ * contributor that cannot name its camera must not emit the entry at all,
64351
+ * because an unnamed per-camera entry is indistinguishable from a shared one
64352
+ * and would quietly turn one camera's cost into everybody's.
64353
+ */
64354
+ deviceId: number().int().positive().nullable(),
64355
+ attribution: _enum([
64356
+ "measured",
64357
+ "accounted",
64358
+ "unattributable"
64359
+ ]),
64360
+ /**
64361
+ * What ONE entry is, in the contributor's own words — `615/high`,
64362
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
64363
+ * family and inventing a common one would lose the only information that
64364
+ * makes two entries for the same camera distinguishable.
64365
+ */
64366
+ unit: string(),
64367
+ /**
64368
+ * The OS process this cost lives in, when there is one. Present so a
64369
+ * consumer can (a) tell two generations of the same unit apart across a
64370
+ * restart, and (b) subtract claimed processes from the node's process
64371
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
64372
+ * process of its own.
64373
+ */
64374
+ pid: number().int().positive().optional(),
64375
+ /**
64376
+ * When this generation started. The pid's incarnation marker: a consumer
64377
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
64378
+ * window when this changes, because the counter restarted from zero in a new
64379
+ * process.
64380
+ */
64381
+ startedAtMs: number().optional(),
64382
+ /**
64383
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
64384
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
64385
+ * contribution is asked for.
64386
+ *
64387
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
64388
+ * needs a sampler, and a new per-node sampler is the defect half of
64389
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
64390
+ * by whoever already keeps a history; a rate cannot be un-averaged.
64391
+ *
64392
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
64393
+ * an entry with no process.
64394
+ */
64395
+ cpuSeconds: number().optional(),
64396
+ /** Resident bytes of this unit's process, same source and same rules. */
64397
+ rssBytes: number().optional()
64398
+ });
64399
+ method(_void(), array(LoadContributionSchema).readonly());
64183
64400
  /**
64184
64401
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
64185
64402
  * through. It stores nothing.
@@ -64256,176 +64473,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
64256
64473
  tags: record(string(), string()).optional()
64257
64474
  }), array(LogEntrySchema).readonly());
64258
64475
  /**
64259
- * `failure-contribution` — the capability an addon reports its OWN losses
64260
- * through, per camera, with the denominator attached. It stores nothing.
64261
- *
64262
- * ## The twin of `load-contribution`, and why it is a twin and not a field
64263
- *
64264
- * `load-contribution` answers *what did this camera COST*. This answers *what
64265
- * did this camera LOSE*. The reporting discipline is identical and deliberately
64266
- * copied: the contributor reports what it already knows, hub-main adds only
64267
- * `addonId`, nothing needs global knowledge, and there is no central list for
64268
- * somebody to forget to edit.
64269
- *
64270
- * They are not merged, because their invariants are opposites:
64271
- *
64272
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
64273
- * claim a camera cost nothing, which is a measurement nobody made;
64274
- * - a `failure-contribution` zero is the **most valuable value on the
64275
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
64276
- * and it is exactly what an absent entry cannot say.
64277
- *
64278
- * Putting a loss counter on a cost entry would also break the reconciliation
64279
- * that gives `load-contribution` its point: contributions are subtracted from
64280
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
64281
- * has no process.
64282
- *
64283
- * ## Why not a log line, since the counters already exist
64284
- *
64285
- * Several of these paths already counted themselves — `CaptureScheduler`'s
64286
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
64287
- * ends in a log line, and a log line is the thing the operator asked to stop
64288
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
64289
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
64290
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
64291
- * media blackout were both diagnosed. The counters stay; this is where they can
64292
- * be READ.
64293
- *
64294
- * ## The rate is served with its denominator or not at all
64295
- *
64296
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
64297
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
64298
- * than yesterday" and was **flat across twelve hours** once divided by the
64299
- * successes on the same path. A surface that publishes only the numerator
64300
- * reproduces that mistake on every read.
64301
- *
64302
- * ## Shape
64303
- *
64304
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
64305
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
64306
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
64307
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
64308
- * a forked runner's entries reach hub-main over transport that already exists.
64309
- * No new UDS message, no second registry (D3). The operator reads the assembled
64310
- * result through `system.getFailureContributions`.
64311
- */
64312
- var FailureReasonCountSchema = object({
64313
- /**
64314
- * Why the attempt did not land, in the contributor's own vocabulary —
64315
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
64316
- * strings that already appear in this repo's logs and, where one exists, the
64317
- * same string the per-track `previewMissReason` records (D276): a second
64318
- * vocabulary for the same loss would make the row and the counter
64319
- * un-joinable.
64320
- */
64321
- reason: string(),
64322
- count: number().int().nonnegative()
64323
- });
64324
- var FailureContributionSchema = object({
64325
- /**
64326
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
64327
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
64328
- * `unit` free: the families are owned by different addons and a shared enum
64329
- * is a central list that rots invisibly.
64330
- */
64331
- family: string(),
64332
- /**
64333
- * The NUMERIC device id — the same value every log line carries as
64334
- * `tags.deviceId`. Never nullable and never absent: a contributor that
64335
- * cannot name the camera must not emit the entry, because a fleet total
64336
- * cannot answer the only question anybody asks of this surface.
64337
- */
64338
- deviceId: number().int().positive(),
64339
- /**
64340
- * A second dimension inside the family: the model / step id for an inference
64341
- * timeout, so "which camera AND which model" is one read. Absent when the
64342
- * family has a single variant.
64343
- */
64344
- variant: string().optional(),
64345
- /**
64346
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
64347
- * differencing two reads must drop the interval when it changes, because the
64348
- * counter restarted from zero in a respawned runner. Same discipline as
64349
- * `LoadContribution.startedAtMs`.
64350
- */
64351
- sinceMs: number(),
64352
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
64353
- atMs: number(),
64354
- /**
64355
- * THE DENOMINATOR — every attempt on this path for this camera in the
64356
- * window. A failure count published without it is the mistake this schema
64357
- * exists to make impossible.
64358
- */
64359
- attempts: number().int().nonnegative(),
64360
- /** Attempts that landed. `attempts - succeeded` is the loss. */
64361
- succeeded: number().int().nonnegative(),
64362
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
64363
- reasons: array(FailureReasonCountSchema).readonly()
64364
- });
64365
- method(_void(), array(FailureContributionSchema).readonly());
64366
- var LoadContributionSchema = object({
64367
- role: _enum([
64368
- "decode",
64369
- "transcode",
64370
- "recording",
64371
- "streaming",
64372
- "detection"
64373
- ]),
64374
- /**
64375
- * The NUMERIC device id — the same value every log line carries as
64376
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
64377
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
64378
- * contributor that cannot name its camera must not emit the entry at all,
64379
- * because an unnamed per-camera entry is indistinguishable from a shared one
64380
- * and would quietly turn one camera's cost into everybody's.
64381
- */
64382
- deviceId: number().int().positive().nullable(),
64383
- attribution: _enum([
64384
- "measured",
64385
- "accounted",
64386
- "unattributable"
64387
- ]),
64388
- /**
64389
- * What ONE entry is, in the contributor's own words — `615/high`,
64390
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
64391
- * family and inventing a common one would lose the only information that
64392
- * makes two entries for the same camera distinguishable.
64393
- */
64394
- unit: string(),
64395
- /**
64396
- * The OS process this cost lives in, when there is one. Present so a
64397
- * consumer can (a) tell two generations of the same unit apart across a
64398
- * restart, and (b) subtract claimed processes from the node's process
64399
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
64400
- * process of its own.
64401
- */
64402
- pid: number().int().positive().optional(),
64403
- /**
64404
- * When this generation started. The pid's incarnation marker: a consumer
64405
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
64406
- * window when this changes, because the counter restarted from zero in a new
64407
- * process.
64408
- */
64409
- startedAtMs: number().optional(),
64410
- /**
64411
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
64412
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
64413
- * contribution is asked for.
64414
- *
64415
- * Cumulative and not a rate on purpose: a rate needs a window, a window
64416
- * needs a sampler, and a new per-node sampler is the defect half of
64417
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
64418
- * by whoever already keeps a history; a rate cannot be un-averaged.
64419
- *
64420
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
64421
- * an entry with no process.
64422
- */
64423
- cpuSeconds: number().optional(),
64424
- /** Resident bytes of this unit's process, same source and same rules. */
64425
- rssBytes: number().optional()
64426
- });
64427
- method(_void(), array(LoadContributionSchema).readonly());
64428
- /**
64429
64476
  * `login-method` — collection cap through which auth addons contribute
64430
64477
  * their pre-auth login surfaces to the login page. This is the SINGLE,
64431
64478
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -69163,12 +69210,53 @@ var MediaFileKindEnum = _enum([
69163
69210
  "keyFrameSmall",
69164
69211
  "thumbnailSmall"
69165
69212
  ]);
69213
+ /**
69214
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
69215
+ * ARE — never the bytes themselves.
69216
+ *
69217
+ * ## Why `url` and not `base64`
69218
+ *
69219
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
69220
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
69221
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
69222
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
69223
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
69224
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
69225
+ *
69226
+ * `url` points at the `event-media` data plane
69227
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
69228
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
69229
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
69230
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
69231
+ * no less protected than they were inside a `view`-level cap response — see
69232
+ * `data-plane-access.ts` for the rule and the one gap it does not close
69233
+ * (per-device scoping).
69234
+ *
69235
+ * The URL is built from the row's **stored** key, which is not always its
69236
+ * published `kind`: a track's face/plate crop is stored as `crop` under
69237
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
69238
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
69239
+ *
69240
+ * ## `base64` is TRANSITIONAL and is going away
69241
+ *
69242
+ * It is still populated for one reason: the deployed viewer's track-detail
69243
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
69244
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
69245
+ * triangle — not as absence. Removing the field before that viewer ships is an
69246
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
69247
+ * delete this line and the `withBytes` pass-through in
69248
+ * `analytics-query-facade.ts`; nothing else reads it.
69249
+ */
69166
69250
  var MediaFileSchema = object({
69167
69251
  key: string(),
69168
69252
  kind: MediaFileKindEnum,
69169
- base64: string(),
69170
69253
  sizeBytes: number(),
69171
69254
  timestamp: number()
69255
+ }).extend({
69256
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
69257
+ url: string(),
69258
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
69259
+ base64: string()
69172
69260
  });
69173
69261
  /**
69174
69262
  * One media row WITHOUT its bytes.
@@ -69180,7 +69268,9 @@ var MediaFileSchema = object({
69180
69268
  * blocks the whole view.
69181
69269
  *
69182
69270
  * `sizeBytes` is carried because it is what lets a client decide between the
69183
- * stored blob and a `?variant=thumb` rendering without fetching either.
69271
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
69272
+ * `url` because a client that had to build the plane path itself is a second
69273
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
69184
69274
  */
69185
69275
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
69186
69276
  /**
@@ -69869,6 +69959,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
69869
69959
  }), array(MediaFileSchema).readonly()), method(object({
69870
69960
  trackId: string(),
69871
69961
  deviceId: number()
69962
+ }), array(MediaFileInfoSchema).readonly()), method(object({
69963
+ eventId: string(),
69964
+ deviceId: number()
69872
69965
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
69873
69966
  kind: "mutation",
69874
69967
  auth: "admin"
@@ -74884,10 +74977,24 @@ var FaceClusterSchema = object({
74884
74977
  size: number().int(),
74885
74978
  cohesion: number()
74886
74979
  });
74980
+ /**
74981
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
74982
+ * are — never the bytes.
74983
+ *
74984
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
74985
+ * track/event contract) is still populated because a deployed viewer requires
74986
+ * the field to parse a row at all; this method has no such reader. Its ONE
74987
+ * caller is the admin UI's detail modal, which was building
74988
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
74989
+ * dialog already rendering its key FRAME from the `event-media` plane.
74990
+ *
74991
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
74992
+ * media key directly, so this needed no new plane and no new access decision.
74993
+ */
74887
74994
  var MediaFileLiteSchema$1 = object({
74888
74995
  key: string(),
74889
74996
  kind: string(),
74890
- base64: string(),
74997
+ url: string(),
74891
74998
  sizeBytes: number(),
74892
74999
  timestamp: number()
74893
75000
  });
@@ -77909,10 +78016,24 @@ var PlateInfoSchema = object({
77909
78016
  */
77910
78017
  cropUrl: string().optional()
77911
78018
  });
78019
+ /**
78020
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
78021
+ * are — never the bytes.
78022
+ *
78023
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
78024
+ * track/event contract) is still populated because a deployed viewer requires
78025
+ * the field to parse a row at all; this method has no such reader. Its ONE
78026
+ * caller is the admin UI's detail modal, which was building
78027
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
78028
+ * dialog already rendering its key FRAME from the `event-media` plane.
78029
+ *
78030
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
78031
+ * media key directly, so this needed no new plane and no new access decision.
78032
+ */
77912
78033
  var MediaFileLiteSchema = object({
77913
78034
  key: string(),
77914
78035
  kind: string(),
77915
- base64: string(),
78036
+ url: string(),
77916
78037
  sizeBytes: number(),
77917
78038
  timestamp: number()
77918
78039
  });
@@ -85809,6 +85930,12 @@ Object.freeze({
85809
85930
  addonId: null,
85810
85931
  access: "view"
85811
85932
  },
85933
+ "pipelineAnalytics.listEventMedia": {
85934
+ capName: "pipeline-analytics",
85935
+ capScope: "device",
85936
+ addonId: null,
85937
+ access: "view"
85938
+ },
85812
85939
  "pipelineAnalytics.listGroups": {
85813
85940
  capName: "pipeline-analytics",
85814
85941
  capScope: "device",
@@ -89432,6 +89559,11 @@ Object.freeze({
89432
89559
  form: "array",
89433
89560
  optional: false
89434
89561
  }],
89562
+ "pipelineAnalytics.listEventMedia": [{
89563
+ name: "deviceId",
89564
+ form: "single",
89565
+ optional: false
89566
+ }],
89435
89567
  "pipelineAnalytics.listGroups": [{
89436
89568
  name: "deviceIds",
89437
89569
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.45",
3
+ "version": "0.2.47",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",