@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.
@@ -13536,6 +13536,133 @@ var embeddingEncoderCapability = {
13536
13536
  }
13537
13537
  };
13538
13538
  /**
13539
+ * `failure-contribution` — the capability an addon reports its OWN losses
13540
+ * through, per camera, with the denominator attached. It stores nothing.
13541
+ *
13542
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13543
+ *
13544
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13545
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13546
+ * copied: the contributor reports what it already knows, hub-main adds only
13547
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13548
+ * somebody to forget to edit.
13549
+ *
13550
+ * They are not merged, because their invariants are opposites:
13551
+ *
13552
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13553
+ * claim a camera cost nothing, which is a measurement nobody made;
13554
+ * - a `failure-contribution` zero is the **most valuable value on the
13555
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13556
+ * and it is exactly what an absent entry cannot say.
13557
+ *
13558
+ * Putting a loss counter on a cost entry would also break the reconciliation
13559
+ * that gives `load-contribution` its point: contributions are subtracted from
13560
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13561
+ * has no process.
13562
+ *
13563
+ * ## Why not a log line, since the counters already exist
13564
+ *
13565
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13566
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13567
+ * ends in a log line, and a log line is the thing the operator asked to stop
13568
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13569
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13570
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13571
+ * media blackout were both diagnosed. The counters stay; this is where they can
13572
+ * be READ.
13573
+ *
13574
+ * ## The rate is served with its denominator or not at all
13575
+ *
13576
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13577
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13578
+ * than yesterday" and was **flat across twelve hours** once divided by the
13579
+ * successes on the same path. A surface that publishes only the numerator
13580
+ * reproduces that mistake on every read.
13581
+ *
13582
+ * ## Shape
13583
+ *
13584
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13585
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13586
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13587
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13588
+ * a forked runner's entries reach hub-main over transport that already exists.
13589
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13590
+ * result through `system.getFailureContributions`.
13591
+ */
13592
+ var FailureReasonCountSchema = object({
13593
+ /**
13594
+ * Why the attempt did not land, in the contributor's own vocabulary —
13595
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13596
+ * strings that already appear in this repo's logs and, where one exists, the
13597
+ * same string the per-track `previewMissReason` records (D276): a second
13598
+ * vocabulary for the same loss would make the row and the counter
13599
+ * un-joinable.
13600
+ */
13601
+ reason: string(),
13602
+ count: number().int().nonnegative()
13603
+ });
13604
+ var FailureContributionSchema = object({
13605
+ /**
13606
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13607
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13608
+ * `unit` free: the families are owned by different addons and a shared enum
13609
+ * is a central list that rots invisibly.
13610
+ */
13611
+ family: string(),
13612
+ /**
13613
+ * The NUMERIC device id — the same value every log line carries as
13614
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13615
+ * cannot name the camera must not emit the entry, because a fleet total
13616
+ * cannot answer the only question anybody asks of this surface.
13617
+ */
13618
+ deviceId: number().int().positive(),
13619
+ /**
13620
+ * A second dimension inside the family: the model / step id for an inference
13621
+ * timeout, so "which camera AND which model" is one read. Absent when the
13622
+ * family has a single variant.
13623
+ */
13624
+ variant: string().optional(),
13625
+ /**
13626
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13627
+ * differencing two reads must drop the interval when it changes, because the
13628
+ * counter restarted from zero in a respawned runner. Same discipline as
13629
+ * `LoadContribution.startedAtMs`.
13630
+ */
13631
+ sinceMs: number(),
13632
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13633
+ atMs: number(),
13634
+ /**
13635
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13636
+ * window. A failure count published without it is the mistake this schema
13637
+ * exists to make impossible.
13638
+ */
13639
+ attempts: number().int().nonnegative(),
13640
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13641
+ succeeded: number().int().nonnegative(),
13642
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13643
+ reasons: array(FailureReasonCountSchema).readonly()
13644
+ });
13645
+ var failureContributionCapability = {
13646
+ name: "failure-contribution",
13647
+ scope: "system",
13648
+ mode: "collection",
13649
+ internal: true,
13650
+ methods: {
13651
+ /**
13652
+ * This addon's per-camera failure counters, read live from bounded in-RAM
13653
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
13654
+ *
13655
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
13656
+ * consumer that wants a rate differences two reads. A draining read would
13657
+ * make two operators with the page open each destroy half of the other's
13658
+ * numbers, and `load-contribution` already settled the same question the
13659
+ * same way for `cpuSeconds`.
13660
+ */
13661
+ list: method(_void(), array(FailureContributionSchema).readonly()) },
13662
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
13663
+ mount: { kind: "skip" }
13664
+ };
13665
+ /**
13539
13666
  * filesystem-browse — per-node capability for browsing the node's local
13540
13667
  * filesystem. Reads are unconfined (whole filesystem, from `/` down); WRITES
13541
13668
  * are sandboxed to operator-configured allowed roots (D115). Used by the
@@ -14057,6 +14184,68 @@ method(LlmGenerateBaseInputSchema, LlmGenerateResultSchema, { kind: "mutation" }
14057
14184
  kind: "mutation",
14058
14185
  auth: "admin"
14059
14186
  });
14187
+ var LoadContributionSchema = object({
14188
+ role: _enum([
14189
+ "decode",
14190
+ "transcode",
14191
+ "recording",
14192
+ "streaming",
14193
+ "detection"
14194
+ ]),
14195
+ /**
14196
+ * The NUMERIC device id — the same value every log line carries as
14197
+ * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14198
+ * camera (a shared pool), NOT that the contributor forgot to look it up: a
14199
+ * contributor that cannot name its camera must not emit the entry at all,
14200
+ * because an unnamed per-camera entry is indistinguishable from a shared one
14201
+ * and would quietly turn one camera's cost into everybody's.
14202
+ */
14203
+ deviceId: number().int().positive().nullable(),
14204
+ attribution: _enum([
14205
+ "measured",
14206
+ "accounted",
14207
+ "unattributable"
14208
+ ]),
14209
+ /**
14210
+ * What ONE entry is, in the contributor's own words — `615/high`,
14211
+ * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14212
+ * family and inventing a common one would lose the only information that
14213
+ * makes two entries for the same camera distinguishable.
14214
+ */
14215
+ unit: string(),
14216
+ /**
14217
+ * The OS process this cost lives in, when there is one. Present so a
14218
+ * consumer can (a) tell two generations of the same unit apart across a
14219
+ * restart, and (b) subtract claimed processes from the node's process
14220
+ * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14221
+ * process of its own.
14222
+ */
14223
+ pid: number().int().positive().optional(),
14224
+ /**
14225
+ * When this generation started. The pid's incarnation marker: a consumer
14226
+ * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14227
+ * window when this changes, because the counter restarted from zero in a new
14228
+ * process.
14229
+ */
14230
+ startedAtMs: number().optional(),
14231
+ /**
14232
+ * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14233
+ * system, read from the child's own `/proc/<pid>/stat` at the moment the
14234
+ * contribution is asked for.
14235
+ *
14236
+ * Cumulative and not a rate on purpose: a rate needs a window, a window
14237
+ * needs a sampler, and a new per-node sampler is the defect half of
14238
+ * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14239
+ * by whoever already keeps a history; a rate cannot be un-averaged.
14240
+ *
14241
+ * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14242
+ * an entry with no process.
14243
+ */
14244
+ cpuSeconds: number().optional(),
14245
+ /** Resident bytes of this unit's process, same source and same rules. */
14246
+ rssBytes: number().optional()
14247
+ });
14248
+ method(_void(), array(LoadContributionSchema).readonly());
14060
14249
  /**
14061
14250
  * `log-channels` — the capability an addon DECLARES its diagnostic channels
14062
14251
  * through. It stores nothing.
@@ -14133,195 +14322,6 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14133
14322
  tags: record(string(), string()).optional()
14134
14323
  }), array(LogEntrySchema).readonly());
14135
14324
  /**
14136
- * `failure-contribution` — the capability an addon reports its OWN losses
14137
- * through, per camera, with the denominator attached. It stores nothing.
14138
- *
14139
- * ## The twin of `load-contribution`, and why it is a twin and not a field
14140
- *
14141
- * `load-contribution` answers *what did this camera COST*. This answers *what
14142
- * did this camera LOSE*. The reporting discipline is identical and deliberately
14143
- * copied: the contributor reports what it already knows, hub-main adds only
14144
- * `addonId`, nothing needs global knowledge, and there is no central list for
14145
- * somebody to forget to edit.
14146
- *
14147
- * They are not merged, because their invariants are opposites:
14148
- *
14149
- * - a `load-contribution` measurement is **absent, never zero** — a zero would
14150
- * claim a camera cost nothing, which is a measurement nobody made;
14151
- * - a `failure-contribution` zero is the **most valuable value on the
14152
- * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14153
- * and it is exactly what an absent entry cannot say.
14154
- *
14155
- * Putting a loss counter on a cost entry would also break the reconciliation
14156
- * that gives `load-contribution` its point: contributions are subtracted from
14157
- * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14158
- * has no process.
14159
- *
14160
- * ## Why not a log line, since the counters already exist
14161
- *
14162
- * Several of these paths already counted themselves — `CaptureScheduler`'s
14163
- * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14164
- * ends in a log line, and a log line is the thing the operator asked to stop
14165
- * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14166
- * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14167
- * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14168
- * media blackout were both diagnosed. The counters stay; this is where they can
14169
- * be READ.
14170
- *
14171
- * ## The rate is served with its denominator or not at all
14172
- *
14173
- * Every entry carries `attempts` and `succeeded`. A miss count alone is
14174
- * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14175
- * than yesterday" and was **flat across twelve hours** once divided by the
14176
- * successes on the same path. A surface that publishes only the numerator
14177
- * reproduces that mistake on every read.
14178
- *
14179
- * ## Shape
14180
- *
14181
- * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14182
- * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14183
- * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14184
- * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14185
- * a forked runner's entries reach hub-main over transport that already exists.
14186
- * No new UDS message, no second registry (D3). The operator reads the assembled
14187
- * result through `system.getFailureContributions`.
14188
- */
14189
- var FailureReasonCountSchema = object({
14190
- /**
14191
- * Why the attempt did not land, in the contributor's own vocabulary —
14192
- * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14193
- * strings that already appear in this repo's logs and, where one exists, the
14194
- * same string the per-track `previewMissReason` records (D276): a second
14195
- * vocabulary for the same loss would make the row and the counter
14196
- * un-joinable.
14197
- */
14198
- reason: string(),
14199
- count: number().int().nonnegative()
14200
- });
14201
- var FailureContributionSchema = object({
14202
- /**
14203
- * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14204
- * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14205
- * `unit` free: the families are owned by different addons and a shared enum
14206
- * is a central list that rots invisibly.
14207
- */
14208
- family: string(),
14209
- /**
14210
- * The NUMERIC device id — the same value every log line carries as
14211
- * `tags.deviceId`. Never nullable and never absent: a contributor that
14212
- * cannot name the camera must not emit the entry, because a fleet total
14213
- * cannot answer the only question anybody asks of this surface.
14214
- */
14215
- deviceId: number().int().positive(),
14216
- /**
14217
- * A second dimension inside the family: the model / step id for an inference
14218
- * timeout, so "which camera AND which model" is one read. Absent when the
14219
- * family has a single variant.
14220
- */
14221
- variant: string().optional(),
14222
- /**
14223
- * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14224
- * differencing two reads must drop the interval when it changes, because the
14225
- * counter restarted from zero in a respawned runner. Same discipline as
14226
- * `LoadContribution.startedAtMs`.
14227
- */
14228
- sinceMs: number(),
14229
- /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14230
- atMs: number(),
14231
- /**
14232
- * THE DENOMINATOR — every attempt on this path for this camera in the
14233
- * window. A failure count published without it is the mistake this schema
14234
- * exists to make impossible.
14235
- */
14236
- attempts: number().int().nonnegative(),
14237
- /** Attempts that landed. `attempts - succeeded` is the loss. */
14238
- succeeded: number().int().nonnegative(),
14239
- /** The loss, partitioned. Sums to `attempts - succeeded`. */
14240
- reasons: array(FailureReasonCountSchema).readonly()
14241
- });
14242
- var failureContributionCapability = {
14243
- name: "failure-contribution",
14244
- scope: "system",
14245
- mode: "collection",
14246
- internal: true,
14247
- methods: {
14248
- /**
14249
- * This addon's per-camera failure counters, read live from bounded in-RAM
14250
- * state it already keeps. Inert: no persistence, no sampling, no timer.
14251
- *
14252
- * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
14253
- * consumer that wants a rate differences two reads. A draining read would
14254
- * make two operators with the page open each destroy half of the other's
14255
- * numbers, and `load-contribution` already settled the same question the
14256
- * same way for `cpuSeconds`.
14257
- */
14258
- list: method(_void(), array(FailureContributionSchema).readonly()) },
14259
- /** In-process only — enumerated through `addons.listCapabilityProviders`. */
14260
- mount: { kind: "skip" }
14261
- };
14262
- var LoadContributionSchema = object({
14263
- role: _enum([
14264
- "decode",
14265
- "transcode",
14266
- "recording",
14267
- "streaming",
14268
- "detection"
14269
- ]),
14270
- /**
14271
- * The NUMERIC device id — the same value every log line carries as
14272
- * `tags.deviceId`. `null` means this cost genuinely belongs to no single
14273
- * camera (a shared pool), NOT that the contributor forgot to look it up: a
14274
- * contributor that cannot name its camera must not emit the entry at all,
14275
- * because an unnamed per-camera entry is indistinguishable from a shared one
14276
- * and would quietly turn one camera's cost into everybody's.
14277
- */
14278
- deviceId: number().int().positive().nullable(),
14279
- attribution: _enum([
14280
- "measured",
14281
- "accounted",
14282
- "unattributable"
14283
- ]),
14284
- /**
14285
- * What ONE entry is, in the contributor's own words — `615/high`,
14286
- * `617/native`, `cuda:0 shared pool`. Free text because the unit differs per
14287
- * family and inventing a common one would lose the only information that
14288
- * makes two entries for the same camera distinguishable.
14289
- */
14290
- unit: string(),
14291
- /**
14292
- * The OS process this cost lives in, when there is one. Present so a
14293
- * consumer can (a) tell two generations of the same unit apart across a
14294
- * restart, and (b) subtract claimed processes from the node's process
14295
- * snapshot to see what NOBODY claimed. Absent for an entry that owns no
14296
- * process of its own.
14297
- */
14298
- pid: number().int().positive().optional(),
14299
- /**
14300
- * When this generation started. The pid's incarnation marker: a consumer
14301
- * differencing {@link LoadContributionSchema.shape.cpuSeconds} must drop the
14302
- * window when this changes, because the counter restarted from zero in a new
14303
- * process.
14304
- */
14305
- startedAtMs: number().optional(),
14306
- /**
14307
- * CUMULATIVE CPU seconds this unit has consumed since it started — user +
14308
- * system, read from the child's own `/proc/<pid>/stat` at the moment the
14309
- * contribution is asked for.
14310
- *
14311
- * Cumulative and not a rate on purpose: a rate needs a window, a window
14312
- * needs a sampler, and a new per-node sampler is the defect half of
14313
- * `docs/architecture/load-ledger.md` documents. A counter can be differenced
14314
- * by whoever already keeps a history; a rate cannot be un-averaged.
14315
- *
14316
- * Absent — never zero — on a node with no `/proc`, on a read failure, and on
14317
- * an entry with no process.
14318
- */
14319
- cpuSeconds: number().optional(),
14320
- /** Resident bytes of this unit's process, same source and same rules. */
14321
- rssBytes: number().optional()
14322
- });
14323
- method(_void(), array(LoadContributionSchema).readonly());
14324
- /**
14325
14325
  * `login-method` — collection cap through which auth addons contribute
14326
14326
  * their pre-auth login surfaces to the login page. This is the SINGLE,
14327
14327
  * generic mechanism that supersedes the dead `auth.listProviders` reader:
@@ -19687,12 +19687,53 @@ var MediaFileKindEnum = _enum([
19687
19687
  "keyFrameSmall",
19688
19688
  "thumbnailSmall"
19689
19689
  ]);
19690
+ /**
19691
+ * One media row ON THE WIRE: what it is, how big it is, and WHERE ITS BYTES
19692
+ * ARE — never the bytes themselves.
19693
+ *
19694
+ * ## Why `url` and not `base64`
19695
+ *
19696
+ * Measured on the live hub 2026-08-30: `getTrackMedia {trackId, deviceId}`
19697
+ * with no `kinds` returned 6 rows / **3 597 219 B**, of which `keyFrame` alone
19698
+ * was **2 824 077 B** — one full-resolution frame, base64, so +33 % on the
19699
+ * wire. Forty events is ~144 MB. Every byte of it was read off disk,
19700
+ * base64-encoded, held whole in a unary tRPC envelope, and materialised in
19701
+ * hub-main's heap on the way past — for an `<img>` that would have cached it.
19702
+ *
19703
+ * `url` points at the `event-media` data plane
19704
+ * (`/addon/<addonId>/event-media/<storedKey>`), which serves the same blob
19705
+ * with an ETag and `Cache-Control: immutable`, honours conditional GETs, can
19706
+ * render a `?variant=thumb`, and streams. The hub gate in front of it requires
19707
+ * a bearer or the session cookie (`access: 'authenticated'`), so the bytes are
19708
+ * no less protected than they were inside a `view`-level cap response — see
19709
+ * `data-plane-access.ts` for the rule and the one gap it does not close
19710
+ * (per-device scoping).
19711
+ *
19712
+ * The URL is built from the row's **stored** key, which is not always its
19713
+ * published `kind`: a track's face/plate crop is stored as `crop` under
19714
+ * `('face'|'plate', '<prefix>-<trackId>')` and published as
19715
+ * `faceCrop`/`plateCrop`. `MediaStore.getByKey` knows only the stored key.
19716
+ *
19717
+ * ## `base64` is TRANSITIONAL and is going away
19718
+ *
19719
+ * It is still populated for one reason: the deployed viewer's track-detail
19720
+ * HERO tile reads it (`use-track-media-entry.ts` → `parseMediaFiles`, which
19721
+ * REQUIRES the field), and a row without it parses as a FAILED read — the red
19722
+ * triangle — not as absence. Removing the field before that viewer ships is an
19723
+ * outage, not a cleanup. Once the viewer takes its hero bytes from `url`,
19724
+ * delete this line and the `withBytes` pass-through in
19725
+ * `analytics-query-facade.ts`; nothing else reads it.
19726
+ */
19690
19727
  var MediaFileSchema = object({
19691
19728
  key: string(),
19692
19729
  kind: MediaFileKindEnum,
19693
- base64: string(),
19694
19730
  sizeBytes: number(),
19695
19731
  timestamp: number()
19732
+ }).extend({
19733
+ /** `/addon/<addonId>/event-media/<encoded stored key>`. Always present. */
19734
+ url: string(),
19735
+ /** @deprecated Transitional — see the schema docblock. Use {@link url}. */
19736
+ base64: string()
19696
19737
  });
19697
19738
  /**
19698
19739
  * One media row WITHOUT its bytes.
@@ -19704,7 +19745,9 @@ var MediaFileSchema = object({
19704
19745
  * blocks the whole view.
19705
19746
  *
19706
19747
  * `sizeBytes` is carried because it is what lets a client decide between the
19707
- * stored blob and a `?variant=thumb` rendering without fetching either.
19748
+ * stored blob and a `?variant=thumb` rendering without fetching either, and
19749
+ * `url` because a client that had to build the plane path itself is a second
19750
+ * copy of a route — the embed, the viewer and the admin UI each grew one.
19708
19751
  */
19709
19752
  var MediaFileInfoSchema = MediaFileSchema.omit({ base64: true });
19710
19753
  /**
@@ -20051,6 +20094,50 @@ var EventStoreFootprintSchema = object({
20051
20094
  totalBytes: number().int(),
20052
20095
  devices: array(EventStoreDeviceFootprintSchema).readonly()
20053
20096
  });
20097
+ /** Event-media footprint for one {@link MediaFileKind}. */
20098
+ var EventMediaKindFootprintSchema = object({
20099
+ kind: MediaFileKindEnum,
20100
+ /** Media rows of this kind. */
20101
+ rows: number().int(),
20102
+ /** Bytes on disk held by those rows. */
20103
+ bytes: number().int()
20104
+ });
20105
+ /**
20106
+ * The media footprint broken down by KIND — the axis a deletion decision
20107
+ * actually turns on.
20108
+ *
20109
+ * A byte total says how much there is; it cannot say what is safe to remove.
20110
+ * The deletable set (the periodic `snapshot` filmstrip, the surplus per-edge
20111
+ * motion stills) and the keep set (`firstFrame`, rolling `lastFrame`,
20112
+ * `thumbnail`/`thumbnailSmall`, `keyFrame`/`keyFrameSmall`, the face/plate
20113
+ * buffers, gallery media, the CLIP `crop`) are distinguished by `kind` and by
20114
+ * nothing else, so sizing a deletion means summing per kind.
20115
+ *
20116
+ * ## Why `unaccounted*` exists
20117
+ *
20118
+ * `kinds` is enumerated from {@link MediaFileKindEnum} — the closed set the
20119
+ * writers use — and summed one kind at a time. `totalRows` / `totalBytes` come
20120
+ * from a SEPARATE unfiltered aggregate over the same rows, never from adding
20121
+ * `kinds` up. A row whose stored `kind` is not in the enum (written by a
20122
+ * retired code path, or by a version that knew a kind this one does not) would
20123
+ * otherwise vanish from the total silently, and an operator would delete
20124
+ * against a denominator smaller than the disk.
20125
+ *
20126
+ * `unaccountedRows` / `unaccountedBytes` are the difference. They are normally
20127
+ * zero; a non-zero value is a real finding and must be shown, not rounded away.
20128
+ */
20129
+ var EventMediaKindBreakdownSchema = object({
20130
+ /** Every media row in scope, from one unfiltered aggregate. */
20131
+ totalRows: number().int(),
20132
+ /** Every media byte in scope, from that same aggregate. */
20133
+ totalBytes: number().int(),
20134
+ /** Per-kind footprint, ordered by bytes descending. */
20135
+ kinds: array(EventMediaKindFootprintSchema).readonly(),
20136
+ /** `totalRows` minus the summed `kinds` rows — see the schema note. */
20137
+ unaccountedRows: number().int(),
20138
+ /** `totalBytes` minus the summed `kinds` bytes — see the schema note. */
20139
+ unaccountedBytes: number().int()
20140
+ });
20054
20141
  /** Per-kind counts returned by the event-prune / device-delete mutations. */
20055
20142
  var EventPruneCountsSchema = object({
20056
20143
  motion: number().int(),
@@ -20432,6 +20519,22 @@ var pipelineAnalyticsCapability = {
20432
20519
  auth: "admin"
20433
20520
  }),
20434
20521
  /**
20522
+ * The same media footprint, broken down by {@link MediaFileKind} instead of
20523
+ * by camera — fleet-wide, or for one camera with `deviceId`.
20524
+ *
20525
+ * Separate from {@link getEventStoreFootprint} rather than a field on it:
20526
+ * the two answer different questions on different axes, the per-camera one
20527
+ * is what the management table renders on every open, and nothing should
20528
+ * pay for a per-kind pass to draw it. See
20529
+ * {@link EventMediaKindBreakdownSchema} for why `unaccounted*` exists —
20530
+ * `kinds` is enumerated, `totalBytes` is not, and the gap must be visible
20531
+ * to anyone sizing a deletion against it.
20532
+ */
20533
+ getEventMediaFootprintByKind: method(object({ deviceId: number().int().optional() }), EventMediaKindBreakdownSchema, {
20534
+ kind: "query",
20535
+ auth: "admin"
20536
+ }),
20537
+ /**
20435
20538
  * Cluster-wide prune of events older than `olderThanMs` (exclusive) across
20436
20539
  * every camera, deleting each event's media in lockstep. Logged to the
20437
20540
  * events ops-log with `reason` (default `'retention'`). Returns the summed
@@ -20836,6 +20939,26 @@ var pipelineAnalyticsCapability = {
20836
20939
  deviceId: number()
20837
20940
  }), array(MediaFileInfoSchema).readonly()),
20838
20941
  /**
20942
+ * What media an EVENT has, without any of it — the twin `getEventMedia`
20943
+ * never had.
20944
+ *
20945
+ * `listTrackMedia` above got this treatment because a track's media is
20946
+ * 5-8 MB. An event's is worse per row, not better: an old-style event owns
20947
+ * a `crop` AND a native-resolution `fullFrameBoxed`, and the track DETAIL
20948
+ * modal — the one surface that legitimately shows the big kinds — unions
20949
+ * both listings to build its filmstrip. It then renders every tile from
20950
+ * the `event-media` plane by key and throws the bytes away. Measured on
20951
+ * the live hub: one event's `fullFrameBoxed` is 2 824 077 B, base64'd to
20952
+ * ~3.8 MB, allocated whole in hub-main's heap, for a list of keys.
20953
+ *
20954
+ * Same `deviceId` authorization subject as `getEventMedia`, and the same
20955
+ * rows — this is a projection of that method, never a different question.
20956
+ */
20957
+ listEventMedia: method(object({
20958
+ eventId: string(),
20959
+ deviceId: number()
20960
+ }), array(MediaFileInfoSchema).readonly()),
20961
+ /**
20839
20962
  * Search object events by text query using CLIP cosine similarity.
20840
20963
  * Encodes `text` via the `embedding-encoder` cap, queries the
20841
20964
  * `ObjectEmbeddingStore` with optional prefilters, ranks all matching
@@ -22704,6 +22827,20 @@ method(object({
22704
22827
  error: string().optional()
22705
22828
  }), { auth: "admin" }), method(_void(), array(ProviderListEntrySchema).readonly()), method(object({
22706
22829
  providerId: string(),
22830
+ /**
22831
+ * The location this config is an UNSAVED edit of, when there is one.
22832
+ *
22833
+ * `listLocations` replaces every declared secret with the redaction
22834
+ * sentinel, so the edit modal's form state holds the sentinel for any
22835
+ * credential the operator did not retype — and posting that here
22836
+ * without a way to resolve it makes the provider try to authenticate
22837
+ * as `__camstack_redacted__` and report the operator's own working
22838
+ * password as wrong. Given this id, the orchestrator restores each
22839
+ * sentinel from the stored config (same rule as `upsertLocation`)
22840
+ * before dispatching. Omitted by the "Add location" wizard, where
22841
+ * every value was typed just now and nothing is stored yet.
22842
+ */
22843
+ locationId: string().optional(),
22707
22844
  config: record(string(), unknown())
22708
22845
  }), object({
22709
22846
  ok: boolean(),
@@ -25899,10 +26036,24 @@ var FaceClusterSchema = object({
25899
26036
  size: number().int(),
25900
26037
  cohesion: number()
25901
26038
  });
26039
+ /**
26040
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
26041
+ * are — never the bytes.
26042
+ *
26043
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
26044
+ * track/event contract) is still populated because a deployed viewer requires
26045
+ * the field to parse a row at all; this method has no such reader. Its ONE
26046
+ * caller is the admin UI's detail modal, which was building
26047
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
26048
+ * dialog already rendering its key FRAME from the `event-media` plane.
26049
+ *
26050
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
26051
+ * media key directly, so this needed no new plane and no new access decision.
26052
+ */
25902
26053
  var MediaFileLiteSchema$1 = object({
25903
26054
  key: string(),
25904
26055
  kind: string(),
25905
- base64: string(),
26056
+ url: string(),
25906
26057
  sizeBytes: number(),
25907
26058
  timestamp: number()
25908
26059
  });
@@ -28950,10 +29101,24 @@ var PlateInfoSchema = object({
28950
29101
  */
28951
29102
  cropUrl: string().optional()
28952
29103
  });
29104
+ /**
29105
+ * One gallery media row: what the crop is, how big it is, and WHERE its bytes
29106
+ * are — never the bytes.
29107
+ *
29108
+ * `base64` was deleted here rather than deprecated. `MediaFile.base64` (the
29109
+ * track/event contract) is still populated because a deployed viewer requires
29110
+ * the field to parse a row at all; this method has no such reader. Its ONE
29111
+ * caller is the admin UI's detail modal, which was building
29112
+ * `data:image/jpeg;base64,…` from a row whose `key` sat right beside it, in a
29113
+ * dialog already rendering its key FRAME from the `event-media` plane.
29114
+ *
29115
+ * `url` is `/addon/<addonId>/event-media/<encoded key>`. The plane resolves a
29116
+ * media key directly, so this needed no new plane and no new access decision.
29117
+ */
28953
29118
  var MediaFileLiteSchema = object({
28954
29119
  key: string(),
28955
29120
  kind: string(),
28956
- base64: string(),
29121
+ url: string(),
28957
29122
  sizeBytes: number(),
28958
29123
  timestamp: number()
28959
29124
  });
@@ -37005,6 +37170,12 @@ Object.freeze({
37005
37170
  addonId: null,
37006
37171
  access: "view"
37007
37172
  },
37173
+ "pipelineAnalytics.getEventMediaFootprintByKind": {
37174
+ capName: "pipeline-analytics",
37175
+ capScope: "device",
37176
+ addonId: null,
37177
+ access: "view"
37178
+ },
37008
37179
  "pipelineAnalytics.getEventStoreFootprint": {
37009
37180
  capName: "pipeline-analytics",
37010
37181
  capScope: "device",
@@ -37101,6 +37272,12 @@ Object.freeze({
37101
37272
  addonId: null,
37102
37273
  access: "view"
37103
37274
  },
37275
+ "pipelineAnalytics.listEventMedia": {
37276
+ capName: "pipeline-analytics",
37277
+ capScope: "device",
37278
+ addonId: null,
37279
+ access: "view"
37280
+ },
37104
37281
  "pipelineAnalytics.listGroups": {
37105
37282
  capName: "pipeline-analytics",
37106
37283
  capScope: "device",
@@ -40664,6 +40841,11 @@ Object.freeze({
40664
40841
  form: "single",
40665
40842
  optional: false
40666
40843
  }],
40844
+ "pipelineAnalytics.getEventMediaFootprintByKind": [{
40845
+ name: "deviceId",
40846
+ form: "single",
40847
+ optional: true
40848
+ }],
40667
40849
  "pipelineAnalytics.getGroup": [{
40668
40850
  name: "deviceId",
40669
40851
  form: "single",
@@ -40724,6 +40906,11 @@ Object.freeze({
40724
40906
  form: "array",
40725
40907
  optional: false
40726
40908
  }],
40909
+ "pipelineAnalytics.listEventMedia": [{
40910
+ name: "deviceId",
40911
+ form: "single",
40912
+ optional: false
40913
+ }],
40727
40914
  "pipelineAnalytics.listGroups": [{
40728
40915
  name: "deviceIds",
40729
40916
  form: "array",
@@ -42590,4 +42777,4 @@ function vectorDimFromBase64(encoded) {
42590
42777
  return Math.floor(Buffer.from(encoded, "base64").byteLength / 4);
42591
42778
  }
42592
42779
  //#endregion
42593
- export { audioModeOf as $, NcSnoozeSchema as A, BaseAddon as At, SCENE_DEFAULT_UNCOVERED_POLICY as B, discriminatedUnion as Bt, NcConditionDescriptorSchema as C, sceneMonitorCapability as Ct, NcRuleTargetSchema as D, videoclipsCapability as Dt, NcRuleSchema as E, vectorDimFromBase64 as Et, PoolMemoryWatchdog as F, nodePin as Ft, TimelapseRulePatchSchema as G, record as Gt, SceneMonitorSchema as H, number as Ht, RECORDING_EXPORT_MAX_READ_BYTES as I, sleep as It, VISIT_MERGE_GAP_MS as J, EventCategory as Jt, TimelapseRuleSchema as K, string as Kt, RetrainStatusSchema as L, _enum as Lt, NcSystemEventKindSchema as M, createEvent as Mt, NcTaxonomySchema as N, hydrateSchema as Nt, NcScheduleSchema as O, zoneAnalyticsCapability as Ot, OpsLogEntrySchema as P, isDeviceScopedCap as Pt, audioMetricsCapability as Q, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS as R, array as Rt, NC_TAXONOMY as S, resolvePoolMemoryPolicy as St, NcRulePatchSchema as T, systemEventFilterApplies as Tt, TIMELAPSE_DENSE_FLOOR_SEC as U, object as Ut, SCENE_DIVERGED as V, literal as Vt, TimelapseRuleInputSchema as W, partialRecord as Wt, alarmPanelCapability as X, addonWidgetsSourceCapability as Y, assertTimelapseCadences as Z, MACRO_LABELS as _, pickClusterStepModels as _t, COCO_TO_MACRO as a, embeddingEncoderCapability as at, NC_DEFAULT_SNOOZE_MINUTES as b, readDeviceStateFrom as bt, DEFAULT_TIMELAPSE_PREVIEW_TEXT as c, faceGalleryCapability as ct, DeclaredDevices as d, isDetectionMacroClass as dt, buildEventKindDescriptor as et, EVENT_KIND_BY_CAP as f, isScheduleActive as ft, LabelAttributionSchema as g, parseProcStatus as gt, FailureCounters as h, notificationRulesCapability as ht, CLUSTER_MODEL_SCOPED_STEPS as i, deriveRecordingMode as it, NcSnoozeSuppressedSchema as j, DeviceType as jt, NcSnoozeInputSchema as k, errMsg as kt, DETECTION_MACRO_CLASSES as l, failureContributionCapability as lt, FULL_IMAGE_BBOX as m, kebabToCamel as mt, AnalyticsGroupRecordSchema as n, customAction as nt, DEFAULT_EVENT_COLOR as o, encodeVectorBase64 as ot, EVENT_PAD_MS as p, isSourceCap as pt, TrackSourceSchema as q, unknown as qt, BaseDevice as r, defineCustomActions as rt, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as s, evaluateSensorEdge as st, AnalyticsGroupDetailSchema as t, cosineSimilarity as tt, DETECTION_PIPELINE_CAP_NAME as u, hfModelUrl as ut, NC_ALARM_SYSTEM_EVENT_KINDS as v, pipelineAnalyticsCapability as vt, NcRuleInputSchema as w, subKindsOf as wt, NC_SNOOZE_MAX_MINUTES as x, readTimelapseGeneratedAt as xt, NC_CONDITION_CATALOG as y, plateGalleryCapability as yt, SCENE_DEFAULT_ANCHOR_THRESHOLD as z, boolean as zt };
42780
+ export { audioMetricsCapability as $, NcSnoozeInputSchema as A, errMsg as At, SCENE_DEFAULT_ANCHOR_THRESHOLD as B, boolean as Bt, NC_TAXONOMY as C, resolvePoolMemoryPolicy as Ct, NcRuleSchema as D, vectorDimFromBase64 as Dt, NcRulePatchSchema as E, systemEventFilterApplies as Et, OpsLogEntrySchema as F, isDeviceScopedCap as Ft, TimelapseRuleInputSchema as G, partialRecord as Gt, SCENE_DIVERGED as H, literal as Ht, PoolMemoryWatchdog as I, nodePin as It, TrackSourceSchema as J, unknown as Jt, TimelapseRulePatchSchema as K, record as Kt, RECORDING_EXPORT_MAX_READ_BYTES as L, sleep as Lt, NcSnoozeSuppressedSchema as M, DeviceType as Mt, NcSystemEventKindSchema as N, createEvent as Nt, NcRuleTargetSchema as O, videoclipsCapability as Ot, NcTaxonomySchema as P, hydrateSchema as Pt, assertTimelapseCadences as Q, RetrainStatusSchema as R, _enum as Rt, NC_SNOOZE_MAX_MINUTES as S, readTimelapseGeneratedAt as St, NcRuleInputSchema as T, subKindsOf as Tt, SceneMonitorSchema as U, number as Ut, SCENE_DEFAULT_UNCOVERED_POLICY as V, discriminatedUnion as Vt, TIMELAPSE_DENSE_FLOOR_SEC as W, object as Wt, addonWidgetsSourceCapability as X, VISIT_MERGE_GAP_MS as Y, EventCategory as Yt, alarmPanelCapability as Z, MACRO_LABELS as _, parseProcStatus as _t, COCO_TO_MACRO as a, deriveRecordingMode as at, NC_CONDITION_CATALOG as b, plateGalleryCapability as bt, DEFAULT_TIMELAPSE_PREVIEW_TEXT as c, evaluateSensorEdge as ct, DeclaredDevices as d, hfModelUrl as dt, audioModeOf as et, EVENT_KIND_BY_CAP as f, isDetectionMacroClass as ft, LabelAttributionSchema as g, notificationRulesCapability as gt, FailureCounters as h, kebabToCamel as ht, CLUSTER_MODEL_SCOPED_STEPS as i, defineCustomActions as it, NcSnoozeSchema as j, BaseAddon as jt, NcScheduleSchema as k, zoneAnalyticsCapability as kt, DETECTION_MACRO_CLASSES as l, faceGalleryCapability as lt, FULL_IMAGE_BBOX as m, isSourceCap as mt, AnalyticsGroupRecordSchema as n, cosineSimilarity as nt, DEFAULT_EVENT_COLOR as o, embeddingEncoderCapability as ot, EVENT_PAD_MS as p, isScheduleActive as pt, TimelapseRuleSchema as q, string as qt, BaseDevice as r, customAction as rt, DEFAULT_FIRST_SIGHTING_FRESHNESS_MS as s, encodeVectorBase64 as st, AnalyticsGroupDetailSchema as t, buildEventKindDescriptor as tt, DETECTION_PIPELINE_CAP_NAME as u, failureContributionCapability as ut, MediaFileKindEnum as v, pickClusterStepModels as vt, NcConditionDescriptorSchema as w, sceneMonitorCapability as wt, NC_DEFAULT_SNOOZE_MINUTES as x, readDeviceStateFrom as xt, NC_ALARM_SYSTEM_EVENT_KINDS as y, pipelineAnalyticsCapability as yt, SCENE_CONFIRM_DEFAULT_TIMEOUT_MS as z, array as zt };