@camstack/addon-provider-dreo 0.2.46 → 0.2.48

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 +331 -174
  2. package/dist/addon.mjs +331 -174
  3. package/package.json +1 -1
package/dist/addon.js CHANGED
@@ -13237,6 +13237,114 @@ method(object({
13237
13237
  height: number()
13238
13238
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13239
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
+ /**
13240
13348
  * filesystem-browse — per-node capability for browsing the node's local
13241
13349
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13242
13350
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13758,6 +13866,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13758
13866
  kind: "mutation",
13759
13867
  auth: "admin"
13760
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());
13761
13931
  /**
13762
13932
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13763
13933
  * through. It stores nothing.
@@ -13834,176 +14004,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13834
14004
  tags: record(string(), string()).optional()
13835
14005
  }), array(LogEntrySchema).readonly());
13836
14006
  /**
13837
- * `failure-contribution` — the capability an addon reports its OWN losses
13838
- * through, per camera, with the denominator attached. It stores nothing.
13839
- *
13840
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13841
- *
13842
- * `load-contribution` answers *what did this camera COST*. This answers *what
13843
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13844
- * copied: the contributor reports what it already knows, hub-main adds only
13845
- * `addonId`, nothing needs global knowledge, and there is no central list for
13846
- * somebody to forget to edit.
13847
- *
13848
- * They are not merged, because their invariants are opposites:
13849
- *
13850
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13851
- * claim a camera cost nothing, which is a measurement nobody made;
13852
- * - a `failure-contribution` zero is the **most valuable value on the
13853
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13854
- * and it is exactly what an absent entry cannot say.
13855
- *
13856
- * Putting a loss counter on a cost entry would also break the reconciliation
13857
- * that gives `load-contribution` its point: contributions are subtracted from
13858
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13859
- * has no process.
13860
- *
13861
- * ## Why not a log line, since the counters already exist
13862
- *
13863
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13864
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13865
- * ends in a log line, and a log line is the thing the operator asked to stop
13866
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13867
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13868
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13869
- * media blackout were both diagnosed. The counters stay; this is where they can
13870
- * be READ.
13871
- *
13872
- * ## The rate is served with its denominator or not at all
13873
- *
13874
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13875
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13876
- * than yesterday" and was **flat across twelve hours** once divided by the
13877
- * successes on the same path. A surface that publishes only the numerator
13878
- * reproduces that mistake on every read.
13879
- *
13880
- * ## Shape
13881
- *
13882
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13883
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13884
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13885
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13886
- * a forked runner's entries reach hub-main over transport that already exists.
13887
- * No new UDS message, no second registry (D3). The operator reads the assembled
13888
- * result through `system.getFailureContributions`.
13889
- */
13890
- var FailureReasonCountSchema = object({
13891
- /**
13892
- * Why the attempt did not land, in the contributor's own vocabulary —
13893
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13894
- * strings that already appear in this repo's logs and, where one exists, the
13895
- * same string the per-track `previewMissReason` records (D276): a second
13896
- * vocabulary for the same loss would make the row and the counter
13897
- * un-joinable.
13898
- */
13899
- reason: string(),
13900
- count: number().int().nonnegative()
13901
- });
13902
- var FailureContributionSchema = object({
13903
- /**
13904
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13905
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13906
- * `unit` free: the families are owned by different addons and a shared enum
13907
- * is a central list that rots invisibly.
13908
- */
13909
- family: string(),
13910
- /**
13911
- * The NUMERIC device id — the same value every log line carries as
13912
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13913
- * cannot name the camera must not emit the entry, because a fleet total
13914
- * cannot answer the only question anybody asks of this surface.
13915
- */
13916
- deviceId: number().int().positive(),
13917
- /**
13918
- * A second dimension inside the family: the model / step id for an inference
13919
- * timeout, so "which camera AND which model" is one read. Absent when the
13920
- * family has a single variant.
13921
- */
13922
- variant: string().optional(),
13923
- /**
13924
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13925
- * differencing two reads must drop the interval when it changes, because the
13926
- * counter restarted from zero in a respawned runner. Same discipline as
13927
- * `LoadContribution.startedAtMs`.
13928
- */
13929
- sinceMs: number(),
13930
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13931
- atMs: number(),
13932
- /**
13933
- * THE DENOMINATOR — every attempt on this path for this camera in the
13934
- * window. A failure count published without it is the mistake this schema
13935
- * exists to make impossible.
13936
- */
13937
- attempts: number().int().nonnegative(),
13938
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13939
- succeeded: number().int().nonnegative(),
13940
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13941
- reasons: array(FailureReasonCountSchema).readonly()
13942
- });
13943
- method(_void(), array(FailureContributionSchema).readonly());
13944
- var LoadContributionSchema = object({
13945
- role: _enum([
13946
- "decode",
13947
- "transcode",
13948
- "recording",
13949
- "streaming",
13950
- "detection"
13951
- ]),
13952
- /**
13953
- * The NUMERIC device id — the same value every log line carries as
13954
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13955
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13956
- * contributor that cannot name its camera must not emit the entry at all,
13957
- * because an unnamed per-camera entry is indistinguishable from a shared one
13958
- * and would quietly turn one camera's cost into everybody's.
13959
- */
13960
- deviceId: number().int().positive().nullable(),
13961
- attribution: _enum([
13962
- "measured",
13963
- "accounted",
13964
- "unattributable"
13965
- ]),
13966
- /**
13967
- * What ONE entry is, in the contributor's own words — `615/high`,
13968
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13969
- * family and inventing a common one would lose the only information that
13970
- * makes two entries for the same camera distinguishable.
13971
- */
13972
- unit: string(),
13973
- /**
13974
- * The OS process this cost lives in, when there is one. Present so a
13975
- * consumer can (a) tell two generations of the same unit apart across a
13976
- * restart, and (b) subtract claimed processes from the node's process
13977
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13978
- * process of its own.
13979
- */
13980
- pid: number().int().positive().optional(),
13981
- /**
13982
- * When this generation started. The pid's incarnation marker: a consumer
13983
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13984
- * window when this changes, because the counter restarted from zero in a new
13985
- * process.
13986
- */
13987
- startedAtMs: number().optional(),
13988
- /**
13989
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13990
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13991
- * contribution is asked for.
13992
- *
13993
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13994
- * needs a sampler, and a new per-node sampler is the defect half of
13995
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13996
- * by whoever already keeps a history; a rate cannot be un-averaged.
13997
- *
13998
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
13999
- * an entry with no process.
14000
- */
14001
- cpuSeconds: number().optional(),
14002
- /** Resident bytes of this unit's process, same source and same rules. */
14003
- rssBytes: number().optional()
14004
- });
14005
- method(_void(), array(LoadContributionSchema).readonly());
14006
- /**
14007
14007
  * `login-method` — collection cap through which auth addons contribute
14008
14008
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14009
14009
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18741,12 +18741,53 @@ var MediaFileKindEnum = _enum([
18741
18741
  "keyFrameSmall",
18742
18742
  "thumbnailSmall"
18743
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
+ */
18744
18781
  var MediaFileSchema = object({
18745
18782
  key: string(),
18746
18783
  kind: MediaFileKindEnum,
18747
- base64: string(),
18748
18784
  sizeBytes: number(),
18749
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()
18750
18791
  });
18751
18792
  /**
18752
18793
  * One media row WITHOUT its bytes.
@@ -18758,7 +18799,9 @@ var MediaFileSchema = object({
18758
18799
  * blocks the whole view.
18759
18800
  *
18760
18801
  * `sizeBytes` is carried because it is what lets a client decide between the
18761
- * 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.
18762
18805
  */
18763
18806
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18764
18807
  /**
@@ -19105,6 +19148,50 @@ var EventStoreFootprintSchema = object({
19105
19148
  totalBytes: number().int(),
19106
19149
  devices: array(EventStoreDeviceFootprintSchema).readonly()
19107
19150
  });
19151
+ /** Event-media footprint for one {@link MediaFileKind}. */
19152
+ var EventMediaKindFootprintSchema = object({
19153
+ kind: MediaFileKindEnum,
19154
+ /** Media rows of this kind. */
19155
+ rows: number().int(),
19156
+ /** Bytes on disk held by those rows. */
19157
+ bytes: number().int()
19158
+ });
19159
+ /**
19160
+ * The media footprint broken down by KIND — the axis a deletion decision
19161
+ * actually turns on.
19162
+ *
19163
+ * A byte total says how much there is; it cannot say what is safe to remove.
19164
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19165
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19166
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19167
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19168
+ * nothing else, so sizing a deletion means summing per kind.
19169
+ *
19170
+ * ## Why `unaccounted*` exists
19171
+ *
19172
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19173
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19174
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19175
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19176
+ * retired code path, or by a version that knew a kind this one does not) would
19177
+ * otherwise vanish from the total silently, and an operator would delete
19178
+ * against a denominator smaller than the disk.
19179
+ *
19180
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19181
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19182
+ */
19183
+ var EventMediaKindBreakdownSchema = object({
19184
+ /** Every media row in scope, from one unfiltered aggregate. */
19185
+ totalRows: number().int(),
19186
+ /** Every media byte in scope, from that same aggregate. */
19187
+ totalBytes: number().int(),
19188
+ /** Per-kind footprint, ordered by bytes descending. */
19189
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19190
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19191
+ unaccountedRows: number().int(),
19192
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19193
+ unaccountedBytes: number().int()
19194
+ });
19108
19195
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
19109
19196
  var EventPruneCountsSchema = object({
19110
19197
  motion: number().int(),
@@ -19308,6 +19395,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19308
19395
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19309
19396
  kind: "query",
19310
19397
  auth: "admin"
19398
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19399
+ kind: "query",
19400
+ auth: "admin"
19311
19401
  }), method(object({
19312
19402
  olderThanMs: number(),
19313
19403
  reason: OpsLogReasonSchema.optional()
@@ -19447,6 +19537,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19447
19537
  }), array(MediaFileSchema).readonly()), method(object({
19448
19538
  trackId: string(),
19449
19539
  deviceId: number()
19540
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19541
+ eventId: string(),
19542
+ deviceId: number()
19450
19543
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19451
19544
  kind: "mutation",
19452
19545
  auth: "admin"
@@ -21256,6 +21349,20 @@ method(object({
21256
21349
  error: string().optional()
21257
21350
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21258
21351
  providerId: string(),
21352
+ /**
21353
+ * The location this config is an UNSAVED edit of, when there is one.
21354
+ *
21355
+ * `listLocations` replaces every declared secret with the redaction
21356
+ * sentinel, so the edit modal's form state holds the sentinel for any
21357
+ * credential the operator did not retype — and posting that here
21358
+ * without a way to resolve it makes the provider try to authenticate
21359
+ * as `__camstack_redacted__` and report the operator's own working
21360
+ * password as wrong. Given this id, the orchestrator restores each
21361
+ * sentinel from the stored config (same rule as `upsertLocation`)
21362
+ * before dispatching. Omitted by the "Add location" wizard, where
21363
+ * every value was typed just now and nothing is stored yet.
21364
+ */
21365
+ locationId: string().optional(),
21259
21366
  config: record(string(), unknown())
21260
21367
  }), object({
21261
21368
  ok: boolean(),
@@ -24445,10 +24552,24 @@ var FaceClusterSchema = object({
24445
24552
  size: number().int(),
24446
24553
  cohesion: number()
24447
24554
  });
24555
+ /**
24556
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24557
+ * are — never the bytes.
24558
+ *
24559
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24560
+ * track/event contract) is still populated because a deployed viewer requires
24561
+ * the field to parse a row at all; this method has no such reader. Its ONE
24562
+ * caller is the admin UI's detail modal, which was building
24563
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24564
+ * dialog already rendering its key FRAME from the `event-media` plane.
24565
+ *
24566
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24567
+ * media key directly, so this needed no new plane and no new access decision.
24568
+ */
24448
24569
  var MediaFileLiteSchema$1 = object({
24449
24570
  key: string(),
24450
24571
  kind: string(),
24451
- base64: string(),
24572
+ url: string(),
24452
24573
  sizeBytes: number(),
24453
24574
  timestamp: number()
24454
24575
  });
@@ -27470,10 +27591,24 @@ var PlateInfoSchema = object({
27470
27591
  */
27471
27592
  cropUrl: string().optional()
27472
27593
  });
27594
+ /**
27595
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27596
+ * are — never the bytes.
27597
+ *
27598
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27599
+ * track/event contract) is still populated because a deployed viewer requires
27600
+ * the field to parse a row at all; this method has no such reader. Its ONE
27601
+ * caller is the admin UI's detail modal, which was building
27602
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27603
+ * dialog already rendering its key FRAME from the `event-media` plane.
27604
+ *
27605
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27606
+ * media key directly, so this needed no new plane and no new access decision.
27607
+ */
27473
27608
  var MediaFileLiteSchema = object({
27474
27609
  key: string(),
27475
27610
  kind: string(),
27476
- base64: string(),
27611
+ url: string(),
27477
27612
  sizeBytes: number(),
27478
27613
  timestamp: number()
27479
27614
  });
@@ -35274,6 +35409,12 @@ Object.freeze({
35274
35409
  addonId: null,
35275
35410
  access: "view"
35276
35411
  },
35412
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
35413
+ capName: "pipeline-analytics",
35414
+ capScope: "device",
35415
+ addonId: null,
35416
+ access: "view"
35417
+ },
35277
35418
  "pipelineAnalytics.getEventStoreFootprint": {
35278
35419
  capName: "pipeline-analytics",
35279
35420
  capScope: "device",
@@ -35370,6 +35511,12 @@ Object.freeze({
35370
35511
  addonId: null,
35371
35512
  access: "view"
35372
35513
  },
35514
+ "pipelineAnalytics.listEventMedia": {
35515
+ capName: "pipeline-analytics",
35516
+ capScope: "device",
35517
+ addonId: null,
35518
+ access: "view"
35519
+ },
35373
35520
  "pipelineAnalytics.listGroups": {
35374
35521
  capName: "pipeline-analytics",
35375
35522
  capScope: "device",
@@ -38933,6 +39080,11 @@ Object.freeze({
38933
39080
  form: "single",
38934
39081
  optional: false
38935
39082
  }],
39083
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
39084
+ name: "deviceId",
39085
+ form: "single",
39086
+ optional: true
39087
+ }],
38936
39088
  "pipelineAnalytics.getGroup": [{
38937
39089
  name: "deviceId",
38938
39090
  form: "single",
@@ -38993,6 +39145,11 @@ Object.freeze({
38993
39145
  form: "array",
38994
39146
  optional: false
38995
39147
  }],
39148
+ "pipelineAnalytics.listEventMedia": [{
39149
+ name: "deviceId",
39150
+ form: "single",
39151
+ optional: false
39152
+ }],
38996
39153
  "pipelineAnalytics.listGroups": [{
38997
39154
  name: "deviceIds",
38998
39155
  form: "array",
package/dist/addon.mjs CHANGED
@@ -13238,6 +13238,114 @@ method(object({
13238
13238
  height: number()
13239
13239
  }), EmbeddingResultSchema, { auth: "admin" }), method(object({ text: string() }), EmbeddingResultSchema, { auth: "admin" }), method(_void(), EmbeddingInfoSchema, { auth: "admin" });
13240
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
+ /**
13241
13349
  * filesystem-browse — per-node capability for browsing the node's local
13242
13350
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13243
13351
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -13759,6 +13867,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
13759
13867
  kind: "mutation",
13760
13868
  auth: "admin"
13761
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());
13762
13932
  /**
13763
13933
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
13764
13934
  * through. It stores nothing.
@@ -13835,176 +14005,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13835
14005
  tags: record(string(), string()).optional()
13836
14006
  }), array(LogEntrySchema).readonly());
13837
14007
  /**
13838
- * `failure-contribution` — the capability an addon reports its OWN losses
13839
- * through, per camera, with the denominator attached. It stores nothing.
13840
- *
13841
- * ## The twin of `load-contribution`, and why it is a twin and not a field
13842
- *
13843
- * `load-contribution` answers *what did this camera COST*. This answers *what
13844
- * did this camera LOSE*. The reporting discipline is identical and deliberately
13845
- * copied: the contributor reports what it already knows, hub-main adds only
13846
- * `addonId`, nothing needs global knowledge, and there is no central list for
13847
- * somebody to forget to edit.
13848
- *
13849
- * They are not merged, because their invariants are opposites:
13850
- *
13851
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
13852
- * claim a camera cost nothing, which is a measurement nobody made;
13853
- * - a `failure-contribution` zero is the **most valuable value on the
13854
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13855
- * and it is exactly what an absent entry cannot say.
13856
- *
13857
- * Putting a loss counter on a cost entry would also break the reconciliation
13858
- * that gives `load-contribution` its point: contributions are subtracted from
13859
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13860
- * has no process.
13861
- *
13862
- * ## Why not a log line, since the counters already exist
13863
- *
13864
- * Several of these paths already counted themselves — `CaptureScheduler`'s
13865
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13866
- * ends in a log line, and a log line is the thing the operator asked to stop
13867
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13868
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13869
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13870
- * media blackout were both diagnosed. The counters stay; this is where they can
13871
- * be READ.
13872
- *
13873
- * ## The rate is served with its denominator or not at all
13874
- *
13875
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
13876
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13877
- * than yesterday" and was **flat across twelve hours** once divided by the
13878
- * successes on the same path. A surface that publishes only the numerator
13879
- * reproduces that mistake on every read.
13880
- *
13881
- * ## Shape
13882
- *
13883
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13884
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13885
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13886
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13887
- * a forked runner's entries reach hub-main over transport that already exists.
13888
- * No new UDS message, no second registry (D3). The operator reads the assembled
13889
- * result through `system.getFailureContributions`.
13890
- */
13891
- var FailureReasonCountSchema = object({
13892
- /**
13893
- * Why the attempt did not land, in the contributor's own vocabulary —
13894
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13895
- * strings that already appear in this repo's logs and, where one exists, the
13896
- * same string the per-track `previewMissReason` records (D276): a second
13897
- * vocabulary for the same loss would make the row and the counter
13898
- * un-joinable.
13899
- */
13900
- reason: string(),
13901
- count: number().int().nonnegative()
13902
- });
13903
- var FailureContributionSchema = object({
13904
- /**
13905
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13906
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13907
- * `unit` free: the families are owned by different addons and a shared enum
13908
- * is a central list that rots invisibly.
13909
- */
13910
- family: string(),
13911
- /**
13912
- * The NUMERIC device id — the same value every log line carries as
13913
- * `tags.deviceId`. Never nullable and never absent: a contributor that
13914
- * cannot name the camera must not emit the entry, because a fleet total
13915
- * cannot answer the only question anybody asks of this surface.
13916
- */
13917
- deviceId: number().int().positive(),
13918
- /**
13919
- * A second dimension inside the family: the model / step id for an inference
13920
- * timeout, so "which camera AND which model" is one read. Absent when the
13921
- * family has a single variant.
13922
- */
13923
- variant: string().optional(),
13924
- /**
13925
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13926
- * differencing two reads must drop the interval when it changes, because the
13927
- * counter restarted from zero in a respawned runner. Same discipline as
13928
- * `LoadContribution.startedAtMs`.
13929
- */
13930
- sinceMs: number(),
13931
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13932
- atMs: number(),
13933
- /**
13934
- * THE DENOMINATOR — every attempt on this path for this camera in the
13935
- * window. A failure count published without it is the mistake this schema
13936
- * exists to make impossible.
13937
- */
13938
- attempts: number().int().nonnegative(),
13939
- /** Attempts that landed. `attempts - succeeded` is the loss. */
13940
- succeeded: number().int().nonnegative(),
13941
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
13942
- reasons: array(FailureReasonCountSchema).readonly()
13943
- });
13944
- method(_void(), array(FailureContributionSchema).readonly());
13945
- var LoadContributionSchema = object({
13946
- role: _enum([
13947
- "decode",
13948
- "transcode",
13949
- "recording",
13950
- "streaming",
13951
- "detection"
13952
- ]),
13953
- /**
13954
- * The NUMERIC device id — the same value every log line carries as
13955
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
13956
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
13957
- * contributor that cannot name its camera must not emit the entry at all,
13958
- * because an unnamed per-camera entry is indistinguishable from a shared one
13959
- * and would quietly turn one camera's cost into everybody's.
13960
- */
13961
- deviceId: number().int().positive().nullable(),
13962
- attribution: _enum([
13963
- "measured",
13964
- "accounted",
13965
- "unattributable"
13966
- ]),
13967
- /**
13968
- * What ONE entry is, in the contributor's own words — `615/high`,
13969
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
13970
- * family and inventing a common one would lose the only information that
13971
- * makes two entries for the same camera distinguishable.
13972
- */
13973
- unit: string(),
13974
- /**
13975
- * The OS process this cost lives in, when there is one. Present so a
13976
- * consumer can (a) tell two generations of the same unit apart across a
13977
- * restart, and (b) subtract claimed processes from the node's process
13978
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
13979
- * process of its own.
13980
- */
13981
- pid: number().int().positive().optional(),
13982
- /**
13983
- * When this generation started. The pid's incarnation marker: a consumer
13984
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
13985
- * window when this changes, because the counter restarted from zero in a new
13986
- * process.
13987
- */
13988
- startedAtMs: number().optional(),
13989
- /**
13990
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
13991
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
13992
- * contribution is asked for.
13993
- *
13994
- * Cumulative and not a rate on purpose: a rate needs a window, a window
13995
- * needs a sampler, and a new per-node sampler is the defect half of
13996
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
13997
- * by whoever already keeps a history; a rate cannot be un-averaged.
13998
- *
13999
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14000
- * an entry with no process.
14001
- */
14002
- cpuSeconds: number().optional(),
14003
- /** Resident bytes of this unit's process, same source and same rules. */
14004
- rssBytes: number().optional()
14005
- });
14006
- method(_void(), array(LoadContributionSchema).readonly());
14007
- /**
14008
14008
  * `login-method` — collection cap through which auth addons contribute
14009
14009
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14010
14010
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -18742,12 +18742,53 @@ var MediaFileKindEnum = _enum([
18742
18742
  "keyFrameSmall",
18743
18743
  "thumbnailSmall"
18744
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
+ */
18745
18782
  var MediaFileSchema = object({
18746
18783
  key: string(),
18747
18784
  kind: MediaFileKindEnum,
18748
- base64: string(),
18749
18785
  sizeBytes: number(),
18750
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()
18751
18792
  });
18752
18793
  /**
18753
18794
  * One media row WITHOUT its bytes.
@@ -18759,7 +18800,9 @@ var MediaFileSchema = object({
18759
18800
  * blocks the whole view.
18760
18801
  *
18761
18802
  * `sizeBytes` is carried because it is what lets a client decide between the
18762
- * 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.
18763
18806
  */
18764
18807
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
18765
18808
  /**
@@ -19106,6 +19149,50 @@ var EventStoreFootprintSchema = object({
19106
19149
  totalBytes: number().int(),
19107
19150
  devices: array(EventStoreDeviceFootprintSchema).readonly()
19108
19151
  });
19152
+ /** Event-media footprint for one {@link MediaFileKind}. */
19153
+ var EventMediaKindFootprintSchema = object({
19154
+ kind: MediaFileKindEnum,
19155
+ /** Media rows of this kind. */
19156
+ rows: number().int(),
19157
+ /** Bytes on disk held by those rows. */
19158
+ bytes: number().int()
19159
+ });
19160
+ /**
19161
+ * The media footprint broken down by KIND — the axis a deletion decision
19162
+ * actually turns on.
19163
+ *
19164
+ * A byte total says how much there is; it cannot say what is safe to remove.
19165
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
19166
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
19167
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
19168
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
19169
+ * nothing else, so sizing a deletion means summing per kind.
19170
+ *
19171
+ * ## Why `unaccounted*` exists
19172
+ *
19173
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
19174
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
19175
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
19176
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
19177
+ * retired code path, or by a version that knew a kind this one does not) would
19178
+ * otherwise vanish from the total silently, and an operator would delete
19179
+ * against a denominator smaller than the disk.
19180
+ *
19181
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
19182
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
19183
+ */
19184
+ var EventMediaKindBreakdownSchema = object({
19185
+ /** Every media row in scope, from one unfiltered aggregate. */
19186
+ totalRows: number().int(),
19187
+ /** Every media byte in scope, from that same aggregate. */
19188
+ totalBytes: number().int(),
19189
+ /** Per-kind footprint, ordered by bytes descending. */
19190
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
19191
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
19192
+ unaccountedRows: number().int(),
19193
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
19194
+ unaccountedBytes: number().int()
19195
+ });
19109
19196
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
19110
19197
  var EventPruneCountsSchema = object({
19111
19198
  motion: number().int(),
@@ -19309,6 +19396,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19309
19396
  }), TrackFlagsSchema, { kind: "mutation" }), method(object({}), EventStoreFootprintSchema, {
19310
19397
  kind: "query",
19311
19398
  auth: "admin"
19399
+ }), method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
19400
+ kind: "query",
19401
+ auth: "admin"
19312
19402
  }), method(object({
19313
19403
  olderThanMs: number(),
19314
19404
  reason: OpsLogReasonSchema.optional()
@@ -19448,6 +19538,9 @@ DeviceType.Camera, method(object({ deviceId: number() }), array(TrackSchema).rea
19448
19538
  }), array(MediaFileSchema).readonly()), method(object({
19449
19539
  trackId: string(),
19450
19540
  deviceId: number()
19541
+ }), array(MediaFileInfoSchema).readonly()), method(object({
19542
+ eventId: string(),
19543
+ deviceId: number()
19451
19544
  }), array(MediaFileInfoSchema).readonly()), method(SearchObjectEventsInput, array(ScoredObjectEventSchema).readonly()), method(object({}), WipeObjectEmbeddingsResultSchema, {
19452
19545
  kind: "mutation",
19453
19546
  auth: "admin"
@@ -21257,6 +21350,20 @@ method(object({
21257
21350
  error: string().optional()
21258
21351
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
21259
21352
  providerId: string(),
21353
+ /**
21354
+ * The location this config is an UNSAVED edit of, when there is one.
21355
+ *
21356
+ * `listLocations` replaces every declared secret with the redaction
21357
+ * sentinel, so the edit modal's form state holds the sentinel for any
21358
+ * credential the operator did not retype — and posting that here
21359
+ * without a way to resolve it makes the provider try to authenticate
21360
+ * as `__camstack_redacted__` and report the operator's own working
21361
+ * password as wrong. Given this id, the orchestrator restores each
21362
+ * sentinel from the stored config (same rule as `upsertLocation`)
21363
+ * before dispatching. Omitted by the "Add location" wizard, where
21364
+ * every value was typed just now and nothing is stored yet.
21365
+ */
21366
+ locationId: string().optional(),
21260
21367
  config: record(string(), unknown())
21261
21368
  }), object({
21262
21369
  ok: boolean(),
@@ -24446,10 +24553,24 @@ var FaceClusterSchema = object({
24446
24553
  size: number().int(),
24447
24554
  cohesion: number()
24448
24555
  });
24556
+ /**
24557
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
24558
+ * are — never the bytes.
24559
+ *
24560
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
24561
+ * track/event contract) is still populated because a deployed viewer requires
24562
+ * the field to parse a row at all; this method has no such reader. Its ONE
24563
+ * caller is the admin UI's detail modal, which was building
24564
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
24565
+ * dialog already rendering its key FRAME from the `event-media` plane.
24566
+ *
24567
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
24568
+ * media key directly, so this needed no new plane and no new access decision.
24569
+ */
24449
24570
  var MediaFileLiteSchema$1 = object({
24450
24571
  key: string(),
24451
24572
  kind: string(),
24452
- base64: string(),
24573
+ url: string(),
24453
24574
  sizeBytes: number(),
24454
24575
  timestamp: number()
24455
24576
  });
@@ -27471,10 +27592,24 @@ var PlateInfoSchema = object({
27471
27592
  */
27472
27593
  cropUrl: string().optional()
27473
27594
  });
27595
+ /**
27596
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
27597
+ * are — never the bytes.
27598
+ *
27599
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
27600
+ * track/event contract) is still populated because a deployed viewer requires
27601
+ * the field to parse a row at all; this method has no such reader. Its ONE
27602
+ * caller is the admin UI's detail modal, which was building
27603
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
27604
+ * dialog already rendering its key FRAME from the `event-media` plane.
27605
+ *
27606
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
27607
+ * media key directly, so this needed no new plane and no new access decision.
27608
+ */
27474
27609
  var MediaFileLiteSchema = object({
27475
27610
  key: string(),
27476
27611
  kind: string(),
27477
- base64: string(),
27612
+ url: string(),
27478
27613
  sizeBytes: number(),
27479
27614
  timestamp: number()
27480
27615
  });
@@ -35275,6 +35410,12 @@ Object.freeze({
35275
35410
  addonId: null,
35276
35411
  access: "view"
35277
35412
  },
35413
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
35414
+ capName: "pipeline-analytics",
35415
+ capScope: "device",
35416
+ addonId: null,
35417
+ access: "view"
35418
+ },
35278
35419
  "pipelineAnalytics.getEventStoreFootprint": {
35279
35420
  capName: "pipeline-analytics",
35280
35421
  capScope: "device",
@@ -35371,6 +35512,12 @@ Object.freeze({
35371
35512
  addonId: null,
35372
35513
  access: "view"
35373
35514
  },
35515
+ "pipelineAnalytics.listEventMedia": {
35516
+ capName: "pipeline-analytics",
35517
+ capScope: "device",
35518
+ addonId: null,
35519
+ access: "view"
35520
+ },
35374
35521
  "pipelineAnalytics.listGroups": {
35375
35522
  capName: "pipeline-analytics",
35376
35523
  capScope: "device",
@@ -38934,6 +39081,11 @@ Object.freeze({
38934
39081
  form: "single",
38935
39082
  optional: false
38936
39083
  }],
39084
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
39085
+ name: "deviceId",
39086
+ form: "single",
39087
+ optional: true
39088
+ }],
38937
39089
  "pipelineAnalytics.getGroup": [{
38938
39090
  name: "deviceId",
38939
39091
  form: "single",
@@ -38994,6 +39146,11 @@ Object.freeze({
38994
39146
  form: "array",
38995
39147
  optional: false
38996
39148
  }],
39149
+ "pipelineAnalytics.listEventMedia": [{
39150
+ name: "deviceId",
39151
+ form: "single",
39152
+ optional: false
39153
+ }],
38997
39154
  "pipelineAnalytics.listGroups": [{
38998
39155
  name: "deviceIds",
38999
39156
  form: "array",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreo",
3
- "version": "0.2.46",
3
+ "version": "0.2.48",
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",