@camstack/addon-post-analysis 1.2.151 → 1.2.153

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.
@@ -13567,6 +13567,133 @@ var embeddingEncoderCapability = {
13567
13567
  }
13568
13568
  };
13569
13569
  /**
13570
+ * `failure-contribution` — the capability an addon reports its OWN losses
13571
+ * through, per camera, with the denominator attached. It stores nothing.
13572
+ *
13573
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13574
+ *
13575
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13576
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13577
+ * copied: the contributor reports what it already knows, hub-main adds only
13578
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13579
+ * somebody to forget to edit.
13580
+ *
13581
+ * They are not merged, because their invariants are opposites:
13582
+ *
13583
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13584
+ * claim a camera cost nothing, which is a measurement nobody made;
13585
+ * - a `failure-contribution` zero is the **most valuable value on the
13586
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13587
+ * and it is exactly what an absent entry cannot say.
13588
+ *
13589
+ * Putting a loss counter on a cost entry would also break the reconciliation
13590
+ * that gives `load-contribution` its point: contributions are subtracted from
13591
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13592
+ * has no process.
13593
+ *
13594
+ * ## Why not a log line, since the counters already exist
13595
+ *
13596
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13597
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13598
+ * ends in a log line, and a log line is the thing the operator asked to stop
13599
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13600
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13601
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13602
+ * media blackout were both diagnosed. The counters stay; this is where they can
13603
+ * be READ.
13604
+ *
13605
+ * ## The rate is served with its denominator or not at all
13606
+ *
13607
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13608
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13609
+ * than yesterday" and was **flat across twelve hours** once divided by the
13610
+ * successes on the same path. A surface that publishes only the numerator
13611
+ * reproduces that mistake on every read.
13612
+ *
13613
+ * ## Shape
13614
+ *
13615
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13616
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13617
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13618
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13619
+ * a forked runner's entries reach hub-main over transport that already exists.
13620
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13621
+ * result through `system.getFailureContributions`.
13622
+ */
13623
+ var FailureReasonCountSchema = object({
13624
+ /**
13625
+ * Why the attempt did not land, in the contributor's own vocabulary —
13626
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13627
+ * strings that already appear in this repo's logs and, where one exists, the
13628
+ * same string the per-track `previewMissReason` records (D276): a second
13629
+ * vocabulary for the same loss would make the row and the counter
13630
+ * un-joinable.
13631
+ */
13632
+ reason: string(),
13633
+ count: number().int().nonnegative()
13634
+ });
13635
+ var FailureContributionSchema = object({
13636
+ /**
13637
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13638
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13639
+ * `unit` free: the families are owned by different addons and a shared enum
13640
+ * is a central list that rots invisibly.
13641
+ */
13642
+ family: string(),
13643
+ /**
13644
+ * The NUMERIC device id — the same value every log line carries as
13645
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13646
+ * cannot name the camera must not emit the entry, because a fleet total
13647
+ * cannot answer the only question anybody asks of this surface.
13648
+ */
13649
+ deviceId: number().int().positive(),
13650
+ /**
13651
+ * A second dimension inside the family: the model / step id for an inference
13652
+ * timeout, so "which camera AND which model" is one read. Absent when the
13653
+ * family has a single variant.
13654
+ */
13655
+ variant: string().optional(),
13656
+ /**
13657
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13658
+ * differencing two reads must drop the interval when it changes, because the
13659
+ * counter restarted from zero in a respawned runner. Same discipline as
13660
+ * `LoadContribution.startedAtMs`.
13661
+ */
13662
+ sinceMs: number(),
13663
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13664
+ atMs: number(),
13665
+ /**
13666
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13667
+ * window. A failure count published without it is the mistake this schema
13668
+ * exists to make impossible.
13669
+ */
13670
+ attempts: number().int().nonnegative(),
13671
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13672
+ succeeded: number().int().nonnegative(),
13673
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13674
+ reasons: array(FailureReasonCountSchema).readonly()
13675
+ });
13676
+ var failureContributionCapability = {
13677
+ name: "failure-contribution",
13678
+ scope: "system",
13679
+ mode: "collection",
13680
+ internal: true,
13681
+ methods: {
13682
+ /**
13683
+ * This addon's per-camera failure counters, read live from bounded in-RAM
13684
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
13685
+ *
13686
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
13687
+ * consumer that wants a rate differences two reads. A draining read would
13688
+ * make two operators with the page open each destroy half of the other's
13689
+ * numbers, and `load-contribution` already settled the same question the
13690
+ * same way for `cpuSeconds`.
13691
+ */
13692
+ list: method(_void(), array(FailureContributionSchema).readonly()) },
13693
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
13694
+ mount: { kind: "skip" }
13695
+ };
13696
+ /**
13570
13697
  * filesystem-browse — per-node capability for browsing the node's local
13571
13698
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13572
13699
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -14088,6 +14215,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14088
14215
  kind: "mutation",
14089
14216
  auth: "admin"
14090
14217
  });
14218
+ var LoadContributionSchema = object({
14219
+ role: _enum([
14220
+ "decode",
14221
+ "transcode",
14222
+ "recording",
14223
+ "streaming",
14224
+ "detection"
14225
+ ]),
14226
+ /**
14227
+ * The NUMERIC device id — the same value every log line carries as
14228
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14229
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14230
+ * contributor that cannot name its camera must not emit the entry at all,
14231
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14232
+ * and would quietly turn one camera's cost into everybody's.
14233
+ */
14234
+ deviceId: number().int().positive().nullable(),
14235
+ attribution: _enum([
14236
+ "measured",
14237
+ "accounted",
14238
+ "unattributable"
14239
+ ]),
14240
+ /**
14241
+ * What ONE entry is, in the contributor's own words — `615/high`,
14242
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14243
+ * family and inventing a common one would lose the only information that
14244
+ * makes two entries for the same camera distinguishable.
14245
+ */
14246
+ unit: string(),
14247
+ /**
14248
+ * The OS process this cost lives in, when there is one. Present so a
14249
+ * consumer can (a) tell two generations of the same unit apart across a
14250
+ * restart, and (b) subtract claimed processes from the node's process
14251
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14252
+ * process of its own.
14253
+ */
14254
+ pid: number().int().positive().optional(),
14255
+ /**
14256
+ * When this generation started. The pid's incarnation marker: a consumer
14257
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14258
+ * window when this changes, because the counter restarted from zero in a new
14259
+ * process.
14260
+ */
14261
+ startedAtMs: number().optional(),
14262
+ /**
14263
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14264
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14265
+ * contribution is asked for.
14266
+ *
14267
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14268
+ * needs a sampler, and a new per-node sampler is the defect half of
14269
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14270
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14271
+ *
14272
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14273
+ * an entry with no process.
14274
+ */
14275
+ cpuSeconds: number().optional(),
14276
+ /** Resident bytes of this unit's process, same source and same rules. */
14277
+ rssBytes: number().optional()
14278
+ });
14279
+ method(_void(), array(LoadContributionSchema).readonly());
14091
14280
  /**
14092
14281
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
14093
14282
  * through. It stores nothing.
@@ -14164,195 +14353,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14164
14353
  tags: record(string(), string()).optional()
14165
14354
  }), array(LogEntrySchema).readonly());
14166
14355
  /**
14167
- * `failure-contribution` — the capability an addon reports its OWN losses
14168
- * through, per camera, with the denominator attached. It stores nothing.
14169
- *
14170
- * ## The twin of `load-contribution`, and why it is a twin and not a field
14171
- *
14172
- * `load-contribution` answers *what did this camera COST*. This answers *what
14173
- * did this camera LOSE*. The reporting discipline is identical and deliberately
14174
- * copied: the contributor reports what it already knows, hub-main adds only
14175
- * `addonId`, nothing needs global knowledge, and there is no central list for
14176
- * somebody to forget to edit.
14177
- *
14178
- * They are not merged, because their invariants are opposites:
14179
- *
14180
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
14181
- * claim a camera cost nothing, which is a measurement nobody made;
14182
- * - a `failure-contribution` zero is the **most valuable value on the
14183
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14184
- * and it is exactly what an absent entry cannot say.
14185
- *
14186
- * Putting a loss counter on a cost entry would also break the reconciliation
14187
- * that gives `load-contribution` its point: contributions are subtracted from
14188
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14189
- * has no process.
14190
- *
14191
- * ## Why not a log line, since the counters already exist
14192
- *
14193
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14194
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14195
- * ends in a log line, and a log line is the thing the operator asked to stop
14196
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14197
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14198
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14199
- * media blackout were both diagnosed. The counters stay; this is where they can
14200
- * be READ.
14201
- *
14202
- * ## The rate is served with its denominator or not at all
14203
- *
14204
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14205
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14206
- * than yesterday" and was **flat across twelve hours** once divided by the
14207
- * successes on the same path. A surface that publishes only the numerator
14208
- * reproduces that mistake on every read.
14209
- *
14210
- * ## Shape
14211
- *
14212
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14213
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14214
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14215
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14216
- * a forked runner's entries reach hub-main over transport that already exists.
14217
- * No new UDS message, no second registry (D3). The operator reads the assembled
14218
- * result through `system.getFailureContributions`.
14219
- */
14220
- var FailureReasonCountSchema = object({
14221
- /**
14222
- * Why the attempt did not land, in the contributor's own vocabulary —
14223
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14224
- * strings that already appear in this repo's logs and, where one exists, the
14225
- * same string the per-track `previewMissReason` records (D276): a second
14226
- * vocabulary for the same loss would make the row and the counter
14227
- * un-joinable.
14228
- */
14229
- reason: string(),
14230
- count: number().int().nonnegative()
14231
- });
14232
- var FailureContributionSchema = object({
14233
- /**
14234
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14235
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14236
- * `unit` free: the families are owned by different addons and a shared enum
14237
- * is a central list that rots invisibly.
14238
- */
14239
- family: string(),
14240
- /**
14241
- * The NUMERIC device id — the same value every log line carries as
14242
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14243
- * cannot name the camera must not emit the entry, because a fleet total
14244
- * cannot answer the only question anybody asks of this surface.
14245
- */
14246
- deviceId: number().int().positive(),
14247
- /**
14248
- * A second dimension inside the family: the model / step id for an inference
14249
- * timeout, so "which camera AND which model" is one read. Absent when the
14250
- * family has a single variant.
14251
- */
14252
- variant: string().optional(),
14253
- /**
14254
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14255
- * differencing two reads must drop the interval when it changes, because the
14256
- * counter restarted from zero in a respawned runner. Same discipline as
14257
- * `LoadContribution.startedAtMs`.
14258
- */
14259
- sinceMs: number(),
14260
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14261
- atMs: number(),
14262
- /**
14263
- * THE DENOMINATOR — every attempt on this path for this camera in the
14264
- * window. A failure count published without it is the mistake this schema
14265
- * exists to make impossible.
14266
- */
14267
- attempts: number().int().nonnegative(),
14268
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14269
- succeeded: number().int().nonnegative(),
14270
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14271
- reasons: array(FailureReasonCountSchema).readonly()
14272
- });
14273
- var failureContributionCapability = {
14274
- name: "failure-contribution",
14275
- scope: "system",
14276
- mode: "collection",
14277
- internal: true,
14278
- methods: {
14279
- /**
14280
- * This addon's per-camera failure counters, read live from bounded in-RAM
14281
- * state it already keeps. Inert: no persistence, no sampling, no timer.
14282
- *
14283
- * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
14284
- * consumer that wants a rate differences two reads. A draining read would
14285
- * make two operators with the page open each destroy half of the other's
14286
- * numbers, and `load-contribution` already settled the same question the
14287
- * same way for `cpuSeconds`.
14288
- */
14289
- list: method(_void(), array(FailureContributionSchema).readonly()) },
14290
- /** In-process only — enumerated through `addons.listCapabilityProviders`. */
14291
- mount: { kind: "skip" }
14292
- };
14293
- var LoadContributionSchema = object({
14294
- role: _enum([
14295
- "decode",
14296
- "transcode",
14297
- "recording",
14298
- "streaming",
14299
- "detection"
14300
- ]),
14301
- /**
14302
- * The NUMERIC device id — the same value every log line carries as
14303
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14304
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14305
- * contributor that cannot name its camera must not emit the entry at all,
14306
- * because an unnamed per-camera entry is indistinguishable from a shared one
14307
- * and would quietly turn one camera's cost into everybody's.
14308
- */
14309
- deviceId: number().int().positive().nullable(),
14310
- attribution: _enum([
14311
- "measured",
14312
- "accounted",
14313
- "unattributable"
14314
- ]),
14315
- /**
14316
- * What ONE entry is, in the contributor's own words — `615/high`,
14317
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14318
- * family and inventing a common one would lose the only information that
14319
- * makes two entries for the same camera distinguishable.
14320
- */
14321
- unit: string(),
14322
- /**
14323
- * The OS process this cost lives in, when there is one. Present so a
14324
- * consumer can (a) tell two generations of the same unit apart across a
14325
- * restart, and (b) subtract claimed processes from the node's process
14326
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14327
- * process of its own.
14328
- */
14329
- pid: number().int().positive().optional(),
14330
- /**
14331
- * When this generation started. The pid's incarnation marker: a consumer
14332
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14333
- * window when this changes, because the counter restarted from zero in a new
14334
- * process.
14335
- */
14336
- startedAtMs: number().optional(),
14337
- /**
14338
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14339
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14340
- * contribution is asked for.
14341
- *
14342
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14343
- * needs a sampler, and a new per-node sampler is the defect half of
14344
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14345
- * by whoever already keeps a history; a rate cannot be un-averaged.
14346
- *
14347
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14348
- * an entry with no process.
14349
- */
14350
- cpuSeconds: number().optional(),
14351
- /** Resident bytes of this unit's process, same source and same rules. */
14352
- rssBytes: number().optional()
14353
- });
14354
- method(_void(), array(LoadContributionSchema).readonly());
14355
- /**
14356
14356
  * `login-method` — collection cap through which auth addons contribute
14357
14357
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14358
14358
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -19718,12 +19718,53 @@ var MediaFileKindEnum = _enum([
19718
19718
  "keyFrameSmall",
19719
19719
  "thumbnailSmall"
19720
19720
  ]);
19721
+ /**
19722
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
19723
+ * ARE — never the bytes themselves.
19724
+ *
19725
+ * ## Why `url` and not `base64`
19726
+ *
19727
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
19728
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
19729
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
19730
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
19731
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
19732
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
19733
+ *
19734
+ * `url` points at the `event-media` data plane
19735
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
19736
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
19737
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
19738
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
19739
+ * no less protected than they were inside a `view`-level cap response — see
19740
+ * `data-plane-access.ts` for the rule and the one gap it does not close
19741
+ * (per-device scoping).
19742
+ *
19743
+ * The URL is built from the row's **stored** key, which is not always its
19744
+ * published `kind`: a track's face/plate crop is stored as `crop` under
19745
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
19746
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
19747
+ *
19748
+ * ## `base64` is TRANSITIONAL and is going away
19749
+ *
19750
+ * It is still populated for one reason: the deployed viewer's track-detail
19751
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
19752
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
19753
+ * triangle — not as absence. Removing the field before that viewer ships is an
19754
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
19755
+ * delete this line and the `withBytes` pass-through in
19756
+ * `analytics-query-facade.ts`; nothing else reads it.
19757
+ */
19721
19758
  var MediaFileSchema = object({
19722
19759
  key: string(),
19723
19760
  kind: MediaFileKindEnum,
19724
- base64: string(),
19725
19761
  sizeBytes: number(),
19726
19762
  timestamp: number()
19763
+ }).extend({
19764
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
19765
+ url: string(),
19766
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
19767
+ base64: string()
19727
19768
  });
19728
19769
  /**
19729
19770
  * One media row WITHOUT its bytes.
@@ -19735,7 +19776,9 @@ var MediaFileSchema = object({
19735
19776
  * blocks the whole view.
19736
19777
  *
19737
19778
  * `sizeBytes` is carried because it is what lets a client decide between the
19738
- * stored blob and a `?variant=thumb` rendering without fetching either.
19779
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
19780
+ * `url` because a client that had to build the plane path itself is a second
19781
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
19739
19782
  */
19740
19783
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
19741
19784
  /**
@@ -20082,6 +20125,50 @@ var EventStoreFootprintSchema = object({
20082
20125
  totalBytes: number().int(),
20083
20126
  devices: array(EventStoreDeviceFootprintSchema).readonly()
20084
20127
  });
20128
+ /** Event-media footprint for one {@link MediaFileKind}. */
20129
+ var EventMediaKindFootprintSchema = object({
20130
+ kind: MediaFileKindEnum,
20131
+ /** Media rows of this kind. */
20132
+ rows: number().int(),
20133
+ /** Bytes on disk held by those rows. */
20134
+ bytes: number().int()
20135
+ });
20136
+ /**
20137
+ * The media footprint broken down by KIND — the axis a deletion decision
20138
+ * actually turns on.
20139
+ *
20140
+ * A byte total says how much there is; it cannot say what is safe to remove.
20141
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
20142
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
20143
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
20144
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
20145
+ * nothing else, so sizing a deletion means summing per kind.
20146
+ *
20147
+ * ## Why `unaccounted*` exists
20148
+ *
20149
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
20150
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
20151
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
20152
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
20153
+ * retired code path, or by a version that knew a kind this one does not) would
20154
+ * otherwise vanish from the total silently, and an operator would delete
20155
+ * against a denominator smaller than the disk.
20156
+ *
20157
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
20158
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
20159
+ */
20160
+ var EventMediaKindBreakdownSchema = object({
20161
+ /** Every media row in scope, from one unfiltered aggregate. */
20162
+ totalRows: number().int(),
20163
+ /** Every media byte in scope, from that same aggregate. */
20164
+ totalBytes: number().int(),
20165
+ /** Per-kind footprint, ordered by bytes descending. */
20166
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
20167
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
20168
+ unaccountedRows: number().int(),
20169
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
20170
+ unaccountedBytes: number().int()
20171
+ });
20085
20172
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
20086
20173
  var EventPruneCountsSchema = object({
20087
20174
  motion: number().int(),
@@ -20463,6 +20550,22 @@ var pipelineAnalyticsCapability = {
20463
20550
  auth: "admin"
20464
20551
  }),
20465
20552
  /**
20553
+ * The same media footprint, broken down by {@link MediaFileKind} instead of
20554
+ * by camera — fleet-wide, or for one camera with `deviceId`.
20555
+ *
20556
+ * Separate from {@link getEventStoreFootprint} rather than a field on it:
20557
+ * the two answer different questions on different axes, the per-camera one
20558
+ * is what the management table renders on every open, and nothing should
20559
+ * pay for a per-kind pass to draw it. See
20560
+ * {@link EventMediaKindBreakdownSchema} for why `unaccounted*` exists —
20561
+ * `kinds` is enumerated, `totalBytes` is not, and the gap must be visible
20562
+ * to anyone sizing a deletion against it.
20563
+ */
20564
+ getEventMediaFootprintByKind: method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
20565
+ kind: "query",
20566
+ auth: "admin"
20567
+ }),
20568
+ /**
20466
20569
  * Cluster-wide prune of events older than `olderThanMs` (exclusive) across
20467
20570
  * every camera, deleting each event's media in lockstep. Logged to the
20468
20571
  * events ops-log with `reason` (default `'retention'`). Returns the summed
@@ -20867,6 +20970,26 @@ var pipelineAnalyticsCapability = {
20867
20970
  deviceId: number()
20868
20971
  }), array(MediaFileInfoSchema).readonly()),
20869
20972
  /**
20973
+ * What media an EVENT has, without any of it — the twin `getEventMedia`
20974
+ * never had.
20975
+ *
20976
+ * `listTrackMedia` above got this treatment because a track's media is
20977
+ * 5-8 MB. An event's is worse per row, not better: an old-style event owns
20978
+ * a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
20979
+ * modal — the one surface that legitimately shows the big kinds — unions
20980
+ * both listings to build its filmstrip. It then renders every tile from
20981
+ * the `event-media` plane by key and throws the bytes away. Measured on
20982
+ * the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
20983
+ * ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
20984
+ *
20985
+ * Same `deviceId` authorization subject as `getEventMedia`, and the same
20986
+ * rows — this is a projection of that method, never a different question.
20987
+ */
20988
+ listEventMedia: method(object({
20989
+ eventId: string(),
20990
+ deviceId: number()
20991
+ }), array(MediaFileInfoSchema).readonly()),
20992
+ /**
20870
20993
  * Search object events by text query using CLIP cosine similarity.
20871
20994
  * Encodes `text` via the `embedding-encoder` cap, queries the
20872
20995
  * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
@@ -22735,6 +22858,20 @@ method(object({
22735
22858
  error: string().optional()
22736
22859
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
22737
22860
  providerId: string(),
22861
+ /**
22862
+ * The location this config is an UNSAVED edit of, when there is one.
22863
+ *
22864
+ * `listLocations` replaces every declared secret with the redaction
22865
+ * sentinel, so the edit modal's form state holds the sentinel for any
22866
+ * credential the operator did not retype — and posting that here
22867
+ * without a way to resolve it makes the provider try to authenticate
22868
+ * as `__camstack_redacted__` and report the operator's own working
22869
+ * password as wrong. Given this id, the orchestrator restores each
22870
+ * sentinel from the stored config (same rule as `upsertLocation`)
22871
+ * before dispatching. Omitted by the "Add location" wizard, where
22872
+ * every value was typed just now and nothing is stored yet.
22873
+ */
22874
+ locationId: string().optional(),
22738
22875
  config: record(string(), unknown())
22739
22876
  }), object({
22740
22877
  ok: boolean(),
@@ -25930,10 +26067,24 @@ var FaceClusterSchema = object({
25930
26067
  size: number().int(),
25931
26068
  cohesion: number()
25932
26069
  });
26070
+ /**
26071
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
26072
+ * are — never the bytes.
26073
+ *
26074
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26075
+ * track/event contract) is still populated because a deployed viewer requires
26076
+ * the field to parse a row at all; this method has no such reader. Its ONE
26077
+ * caller is the admin UI's detail modal, which was building
26078
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26079
+ * dialog already rendering its key FRAME from the `event-media` plane.
26080
+ *
26081
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26082
+ * media key directly, so this needed no new plane and no new access decision.
26083
+ */
25933
26084
  var MediaFileLiteSchema$1 = object({
25934
26085
  key: string(),
25935
26086
  kind: string(),
25936
- base64: string(),
26087
+ url: string(),
25937
26088
  sizeBytes: number(),
25938
26089
  timestamp: number()
25939
26090
  });
@@ -28981,10 +29132,24 @@ var PlateInfoSchema = object({
28981
29132
  */
28982
29133
  cropUrl: string().optional()
28983
29134
  });
29135
+ /**
29136
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
29137
+ * are — never the bytes.
29138
+ *
29139
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
29140
+ * track/event contract) is still populated because a deployed viewer requires
29141
+ * the field to parse a row at all; this method has no such reader. Its ONE
29142
+ * caller is the admin UI's detail modal, which was building
29143
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
29144
+ * dialog already rendering its key FRAME from the `event-media` plane.
29145
+ *
29146
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
29147
+ * media key directly, so this needed no new plane and no new access decision.
29148
+ */
28984
29149
  var MediaFileLiteSchema = object({
28985
29150
  key: string(),
28986
29151
  kind: string(),
28987
- base64: string(),
29152
+ url: string(),
28988
29153
  sizeBytes: number(),
28989
29154
  timestamp: number()
28990
29155
  });
@@ -37036,6 +37201,12 @@ Object.freeze({
37036
37201
  addonId: null,
37037
37202
  access: "view"
37038
37203
  },
37204
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
37205
+ capName: "pipeline-analytics",
37206
+ capScope: "device",
37207
+ addonId: null,
37208
+ access: "view"
37209
+ },
37039
37210
  "pipelineAnalytics.getEventStoreFootprint": {
37040
37211
  capName: "pipeline-analytics",
37041
37212
  capScope: "device",
@@ -37132,6 +37303,12 @@ Object.freeze({
37132
37303
  addonId: null,
37133
37304
  access: "view"
37134
37305
  },
37306
+ "pipelineAnalytics.listEventMedia": {
37307
+ capName: "pipeline-analytics",
37308
+ capScope: "device",
37309
+ addonId: null,
37310
+ access: "view"
37311
+ },
37135
37312
  "pipelineAnalytics.listGroups": {
37136
37313
  capName: "pipeline-analytics",
37137
37314
  capScope: "device",
@@ -40695,6 +40872,11 @@ Object.freeze({
40695
40872
  form: "single",
40696
40873
  optional: false
40697
40874
  }],
40875
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
40876
+ name: "deviceId",
40877
+ form: "single",
40878
+ optional: true
40879
+ }],
40698
40880
  "pipelineAnalytics.getGroup": [{
40699
40881
  name: "deviceId",
40700
40882
  form: "single",
@@ -40755,6 +40937,11 @@ Object.freeze({
40755
40937
  form: "array",
40756
40938
  optional: false
40757
40939
  }],
40940
+ "pipelineAnalytics.listEventMedia": [{
40941
+ name: "deviceId",
40942
+ form: "single",
40943
+ optional: false
40944
+ }],
40758
40945
  "pipelineAnalytics.listGroups": [{
40759
40946
  name: "deviceIds",
40760
40947
  form: "array",
@@ -42741,6 +42928,12 @@ Object.defineProperty(exports, "MACRO_LABELS", {
42741
42928
  return MACRO_LABELS;
42742
42929
  }
42743
42930
  });
42931
+ Object.defineProperty(exports, "MediaFileKindEnum", {
42932
+ enumerable: true,
42933
+ get: function() {
42934
+ return MediaFileKindEnum;
42935
+ }
42936
+ });
42744
42937
  Object.defineProperty(exports, "NC_ALARM_SYSTEM_EVENT_KINDS", {
42745
42938
  enumerable: true,
42746
42939
  get: function() {