@camstack/types 1.2.119 → 1.2.122

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.
package/dist/index.js CHANGED
@@ -1885,11 +1885,10 @@ var DetectionCatalogClassMapSchema = zod.z.object({
1885
1885
  * timestamp + postMs]`). Matches the admin-ui clip window (−5s/+10s).
1886
1886
  *
1887
1887
  * Every consumer derives from this ONE constant so event↔footage boundaries
1888
- * agree everywhere (C1):
1889
- * - the `videoclips` default provider (addon-post-analysis) pads its clip
1890
- * windows with it;
1891
- * - the recorder's ephemeral in-RAM `EventMap` markers (addon-pipeline) pad
1892
- * their `startMs/endMs` with it.
1888
+ * agree everywhere (C1): today that is the `videoclips` default provider
1889
+ * (addon-post-analysis), which pads its clip windows with it. The recorder used
1890
+ * to pad in-RAM playback markers with it too; those markers had no reader
1891
+ * anywhere in the repo and were deleted on 2026-08-29.
1893
1892
  *
1894
1893
  * NOTE: this is a UI/JOIN convention, NOT the `events`-band keep/discard gate —
1895
1894
  * that uses the per-device `preBufferSec`/`postBufferSec` config.
@@ -2906,6 +2905,190 @@ function reducePoints(points, bucketMs, origin) {
2906
2905
  return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
2907
2906
  }
2908
2907
  //#endregion
2908
+ //#region src/metrics/failure-counters.ts
2909
+ /**
2910
+ * `FailureCounters` — the per-camera counter every "how often does this camera
2911
+ * lose work, and why" question is answered from.
2912
+ *
2913
+ * ## Why a primitive and not four counters
2914
+ *
2915
+ * Four open failure modes were being triaged on 2026-08-28 and every one of
2916
+ * them was measured the same way: grep a log line, count it, and then guess at
2917
+ * the denominator. The guess is the defect. `enrichment crop native miss` read
2918
+ * as "35x worse than yesterday" and turned out to be **flat all day** the
2919
+ * moment it was divided by the successes on the same path — 0.25 misses per
2920
+ * landed capture, 0.08–0.33 across twelve hours, no trend. The count moved
2921
+ * because the traffic moved.
2922
+ *
2923
+ * So the unit here is not a counter. It is a **ratio with its denominator
2924
+ * attached**: {@link FailureCounterSample.attempts} is incremented on every
2925
+ * try, {@link FailureCounterSample.succeeded} on the ones that landed, and the
2926
+ * reasons partition the rest. A consumer can always divide; it can never
2927
+ * un-divide a bare count.
2928
+ *
2929
+ * ## Per camera, always
2930
+ *
2931
+ * The key is the numeric `deviceId` — the same value every log line in this
2932
+ * repo carries as `tags.deviceId`. There is no fleet-total mode and no
2933
+ * device-less bucket, because the question is always "why is 617 worse than
2934
+ * 615?" and a fleet total cannot answer it. A caller that cannot name the
2935
+ * camera must not note anything: an unnamed per-camera count is
2936
+ * indistinguishable from a shared one, which is how one camera's failures
2937
+ * quietly become everybody's.
2938
+ *
2939
+ * ## Cumulative, never drained
2940
+ *
2941
+ * A read NEVER resets anything. `load-contribution.cap.ts` already argued this
2942
+ * for CPU seconds and the argument carries over verbatim: *"a rate needs a
2943
+ * window, a window needs a sampler, and a new per-node sampler is the defect
2944
+ * half of `docs/architecture/load-ledger.md` documents. A counter can be
2945
+ * differenced by whoever already keeps a history; a rate cannot be
2946
+ * un-averaged."* A draining read has a second failure this surface cannot
2947
+ * afford — two consumers polling it would each destroy half of the other's
2948
+ * numbers, silently.
2949
+ *
2950
+ * {@link FailureCounterSample.sinceMs} is the incarnation marker: it is when
2951
+ * this counter started, and a consumer differencing two reads must drop the
2952
+ * interval when it changes, because the counter restarted from zero in a new
2953
+ * process.
2954
+ *
2955
+ * ## Bounded, and the bound is the point
2956
+ *
2957
+ * This lives in the memory of a process that is already the subject of an RSS
2958
+ * budget, so both dimensions are capped: {@link MAX_KEYS} counters and
2959
+ * {@link MAX_REASONS_PER_KEY} distinct reasons within one. Past the reason cap
2960
+ * the counts are folded into {@link OVERFLOW_REASON} rather than dropped —
2961
+ * losing them would make `attempts - succeeded` stop equalling the reason
2962
+ * total, and the ratio the whole surface exists to publish would quietly stop
2963
+ * adding up. Past the key cap a new key is refused and
2964
+ * {@link FailureCounters.keysRefused} says so, so the omission is visible
2965
+ * instead of silent.
2966
+ *
2967
+ * ## No timers, no IO, no logging
2968
+ *
2969
+ * Pure. It is read on whatever beat the caller already has. A telemetry
2970
+ * primitive that schedules its own work is a second sampler, and this repo has
2971
+ * paid for one of those already (`docs/architecture/load-ledger.md`).
2972
+ */
2973
+ /** Distinct reason strings kept per counter before folding. */
2974
+ var MAX_REASONS_PER_KEY = 16;
2975
+ /**
2976
+ * Distinct (device, family, variant) counters one instance will hold.
2977
+ *
2978
+ * A large fleet x the handful of families any single addon reports, with
2979
+ * slack. At ~200 B per counter this is a ~100 KB ceiling on a process that
2980
+ * already declares an RSS budget in the gigabytes.
2981
+ */
2982
+ var MAX_KEYS = 1024;
2983
+ /**
2984
+ * Where reasons past {@link MAX_REASONS_PER_KEY} go.
2985
+ *
2986
+ * They are FOLDED, never dropped: `attempts - succeeded` must always equal the
2987
+ * sum of the reason counts, or the ratio stops adding up.
2988
+ */
2989
+ var OVERFLOW_REASON = "other";
2990
+ /** `deviceId` + `family` + optional `variant`, flattened into the map key. */
2991
+ function counterKey(deviceId, family, variant) {
2992
+ return variant === void 0 ? `${deviceId}${family}` : `${deviceId}${family}${variant}`;
2993
+ }
2994
+ /**
2995
+ * A bounded set of per-camera, cumulative failure counters.
2996
+ *
2997
+ * One instance per contributing subsystem. `note` is O(1) and allocation-free
2998
+ * on the steady path; `snapshot` reads without mutating anything.
2999
+ */
3000
+ var FailureCounters = class {
3001
+ maxKeys;
3002
+ maxReasons;
3003
+ counters = /* @__PURE__ */ new Map();
3004
+ refused = 0;
3005
+ constructor(maxKeys = MAX_KEYS, maxReasons = 16) {
3006
+ this.maxKeys = maxKeys;
3007
+ this.maxReasons = maxReasons;
3008
+ }
3009
+ /**
3010
+ * Counters refused because {@link MAX_KEYS} was already held.
3011
+ *
3012
+ * Cumulative for the life of the instance: a bound that bit is a fact about
3013
+ * the deployment, and a surface that hid it would under-report a fleet
3014
+ * precisely when the fleet got large enough to matter.
3015
+ */
3016
+ get keysRefused() {
3017
+ return this.refused;
3018
+ }
3019
+ /** Counters currently held. */
3020
+ get size() {
3021
+ return this.counters.size;
3022
+ }
3023
+ /**
3024
+ * Fold one observation in.
3025
+ *
3026
+ * A non-positive or non-integer `deviceId` is REFUSED rather than bucketed:
3027
+ * see the module docblock — an entry that cannot name its camera is worse
3028
+ * than no entry.
3029
+ */
3030
+ note(observation, nowMs) {
3031
+ if (!Number.isInteger(observation.deviceId) || observation.deviceId <= 0) return;
3032
+ const key = counterKey(observation.deviceId, observation.family, observation.variant);
3033
+ let counter = this.counters.get(key);
3034
+ if (counter === void 0) {
3035
+ if (this.counters.size >= this.maxKeys) {
3036
+ this.refused += 1;
3037
+ return;
3038
+ }
3039
+ counter = {
3040
+ deviceId: observation.deviceId,
3041
+ family: observation.family,
3042
+ variant: observation.variant,
3043
+ sinceMs: nowMs,
3044
+ attempts: 0,
3045
+ succeeded: 0,
3046
+ reasons: /* @__PURE__ */ new Map()
3047
+ };
3048
+ this.counters.set(key, counter);
3049
+ }
3050
+ counter.attempts += 1;
3051
+ if (observation.reason === void 0) {
3052
+ counter.succeeded += 1;
3053
+ return;
3054
+ }
3055
+ const reason = counter.reasons.has(observation.reason) || counter.reasons.size < this.maxReasons ? observation.reason : OVERFLOW_REASON;
3056
+ counter.reasons.set(reason, (counter.reasons.get(reason) ?? 0) + 1);
3057
+ }
3058
+ /** Read every counter. Never mutates — see the module docblock. */
3059
+ snapshot(nowMs) {
3060
+ const out = [];
3061
+ for (const counter of this.counters.values()) out.push({
3062
+ deviceId: counter.deviceId,
3063
+ family: counter.family,
3064
+ ...counter.variant !== void 0 ? { variant: counter.variant } : {},
3065
+ sinceMs: counter.sinceMs,
3066
+ atMs: nowMs,
3067
+ attempts: counter.attempts,
3068
+ succeeded: counter.succeeded,
3069
+ reasons: [...counter.reasons.entries()].map(([reason, count]) => ({
3070
+ reason,
3071
+ count
3072
+ })).toSorted((a, b) => b.count - a.count)
3073
+ });
3074
+ return out;
3075
+ }
3076
+ /** Drop everything (host disposal). */
3077
+ clear() {
3078
+ this.counters.clear();
3079
+ }
3080
+ };
3081
+ /**
3082
+ * Losses per attempt, as a ratio — the number the operator actually reads.
3083
+ *
3084
+ * `null` when there were no attempts: a camera nobody asked anything of has no
3085
+ * failure rate, and reporting 0 would say it was perfect.
3086
+ */
3087
+ function failureRate(sample) {
3088
+ if (sample.attempts <= 0) return null;
3089
+ return (sample.attempts - sample.succeeded) / sample.attempts;
3090
+ }
3091
+ //#endregion
2909
3092
  //#region src/types/model-variant-groups.ts
2910
3093
  var FORMAT_KEYS = [
2911
3094
  "onnx",
@@ -11149,6 +11332,135 @@ var logDestinationCapability = {
11149
11332
  mount: { kind: "skip" }
11150
11333
  };
11151
11334
  //#endregion
11335
+ //#region src/capabilities/failure-contribution.cap.ts
11336
+ /**
11337
+ * `failure-contribution` — the capability an addon reports its OWN losses
11338
+ * through, per camera, with the denominator attached. It stores nothing.
11339
+ *
11340
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
11341
+ *
11342
+ * `load-contribution` answers *what did this camera COST*. This answers *what
11343
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
11344
+ * copied: the contributor reports what it already knows, hub-main adds only
11345
+ * `addonId`, nothing needs global knowledge, and there is no central list for
11346
+ * somebody to forget to edit.
11347
+ *
11348
+ * They are not merged, because their invariants are opposites:
11349
+ *
11350
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
11351
+ * claim a camera cost nothing, which is a measurement nobody made;
11352
+ * - a `failure-contribution` zero is the **most valuable value on the
11353
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
11354
+ * and it is exactly what an absent entry cannot say.
11355
+ *
11356
+ * Putting a loss counter on a cost entry would also break the reconciliation
11357
+ * that gives `load-contribution` its point: contributions are subtracted from
11358
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
11359
+ * has no process.
11360
+ *
11361
+ * ## Why not a log line, since the counters already exist
11362
+ *
11363
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
11364
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
11365
+ * ends in a log line, and a log line is the thing the operator asked to stop
11366
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
11367
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
11368
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
11369
+ * media blackout were both diagnosed. The counters stay; this is where they can
11370
+ * be READ.
11371
+ *
11372
+ * ## The rate is served with its denominator or not at all
11373
+ *
11374
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
11375
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
11376
+ * than yesterday" and was **flat across twelve hours** once divided by the
11377
+ * successes on the same path. A surface that publishes only the numerator
11378
+ * reproduces that mistake on every read.
11379
+ *
11380
+ * ## Shape
11381
+ *
11382
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
11383
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
11384
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
11385
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
11386
+ * a forked runner's entries reach hub-main over transport that already exists.
11387
+ * No new UDS message, no second registry (D3). The operator reads the assembled
11388
+ * result through `system.getFailureContributions`.
11389
+ */
11390
+ var FailureReasonCountSchema = zod.z.object({
11391
+ /**
11392
+ * Why the attempt did not land, in the contributor's own vocabulary —
11393
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
11394
+ * strings that already appear in this repo's logs and, where one exists, the
11395
+ * same string the per-track `previewMissReason` records (D276): a second
11396
+ * vocabulary for the same loss would make the row and the counter
11397
+ * un-joinable.
11398
+ */
11399
+ reason: zod.z.string(),
11400
+ count: zod.z.number().int().nonnegative()
11401
+ });
11402
+ var FailureContributionSchema = zod.z.object({
11403
+ /**
11404
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
11405
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
11406
+ * `unit` free: the families are owned by different addons and a shared enum
11407
+ * is a central list that rots invisibly.
11408
+ */
11409
+ family: zod.z.string(),
11410
+ /**
11411
+ * The NUMERIC device id — the same value every log line carries as
11412
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
11413
+ * cannot name the camera must not emit the entry, because a fleet total
11414
+ * cannot answer the only question anybody asks of this surface.
11415
+ */
11416
+ deviceId: zod.z.number().int().positive(),
11417
+ /**
11418
+ * A second dimension inside the family: the model / step id for an inference
11419
+ * timeout, so "which camera AND which model" is one read. Absent when the
11420
+ * family has a single variant.
11421
+ */
11422
+ variant: zod.z.string().optional(),
11423
+ /**
11424
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
11425
+ * differencing two reads must drop the interval when it changes, because the
11426
+ * counter restarted from zero in a respawned runner. Same discipline as
11427
+ * `LoadContribution.startedAtMs`.
11428
+ */
11429
+ sinceMs: zod.z.number(),
11430
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
11431
+ atMs: zod.z.number(),
11432
+ /**
11433
+ * THE DENOMINATOR — every attempt on this path for this camera in the
11434
+ * window. A failure count published without it is the mistake this schema
11435
+ * exists to make impossible.
11436
+ */
11437
+ attempts: zod.z.number().int().nonnegative(),
11438
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
11439
+ succeeded: zod.z.number().int().nonnegative(),
11440
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
11441
+ reasons: zod.z.array(FailureReasonCountSchema).readonly()
11442
+ });
11443
+ var failureContributionCapability = {
11444
+ name: "failure-contribution",
11445
+ scope: "system",
11446
+ mode: "collection",
11447
+ internal: true,
11448
+ methods: {
11449
+ /**
11450
+ * This addon's per-camera failure counters, read live from bounded in-RAM
11451
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
11452
+ *
11453
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
11454
+ * consumer that wants a rate differences two reads. A draining read would
11455
+ * make two operators with the page open each destroy half of the other's
11456
+ * numbers, and `load-contribution` already settled the same question the
11457
+ * same way for `cpuSeconds`.
11458
+ */
11459
+ list: require_sleep.method(zod.z.void(), zod.z.array(FailureContributionSchema).readonly()) },
11460
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11461
+ mount: { kind: "skip" }
11462
+ };
11463
+ //#endregion
11152
11464
  //#region src/capabilities/load-contribution.cap.ts
11153
11465
  /**
11154
11466
  * `load-contribution` — the capability an addon reports its OWN cost through,
@@ -11585,6 +11897,50 @@ var NodeProcessSchema = zod.z.object({
11585
11897
  /** Wall-clock uptime (seconds). Parsed from `ps etime`. */
11586
11898
  uptimeSec: zod.z.number()
11587
11899
  });
11900
+ /**
11901
+ * One retained container-memory reading.
11902
+ *
11903
+ * `atMs` is the timestamp of the PROCESS snapshot taken in the same tick, not
11904
+ * a second clock: that is what makes "processes sum to X, container says Y"
11905
+ * subtractable per point rather than an eyeballed comparison of two series
11906
+ * sampled at different instants.
11907
+ *
11908
+ * A reduced window keeps the sample with the LARGEST `currentBytes` in each
11909
+ * bucket, WHOLE. Taking a per-field maximum would synthesise a row whose parts
11910
+ * never coexisted, and a mean would smear away the peak this exists to find.
11911
+ */
11912
+ var ContainerMemoryPointSchema = zod.z.object({
11913
+ /** Which hierarchy answered, so a reading is never ambiguous. */
11914
+ source: zod.z.enum(["cgroup-v2", "cgroup-v1"]),
11915
+ /** `memory.current` (v2) / `memory.usage_in_bytes` (v1). Always known. */
11916
+ currentBytes: zod.z.number(),
11917
+ /** The cgroup's ceiling. `null` = NO LIMIT — never a sentinel, never zero. */
11918
+ limitBytes: zod.z.number().nullable(),
11919
+ /** Anonymous pages: the closest thing to "what the processes allocated". */
11920
+ anonBytes: zod.z.number().nullable(),
11921
+ /** Page cache. Charged to the cgroup, owned by no process. */
11922
+ fileBytes: zod.z.number().nullable(),
11923
+ /**
11924
+ * Shared memory — and the field that explained the largest single surprise.
11925
+ * The i915 driver backs GPU buffers with shmem, so an inference pool or a
11926
+ * hardware-decode session holding DRM objects is charged HERE and appears
11927
+ * nowhere in a `ps` scan.
11928
+ */
11929
+ shmemBytes: zod.z.number().nullable(),
11930
+ /** Kernel slab charged to this cgroup. `null` on v1, which never publishes it. */
11931
+ slabBytes: zod.z.number().nullable(),
11932
+ /**
11933
+ * Shrinkable i915 GEM object bytes, from debugfs.
11934
+ *
11935
+ * **Host-wide across every DRM client, NOT cgroup-scoped.** It is not a
11936
+ * component of `currentBytes` and must not be subtracted from it; it says
11937
+ * what put the shmem there, where `shmemBytes` only says how much.
11938
+ *
11939
+ * `null` wherever debugfs is not mounted — which is inside every camstack
11940
+ * container today — and on any node with no Intel GPU.
11941
+ */
11942
+ gpuShmemBytes: zod.z.number().nullable()
11943
+ }).extend({ atMs: zod.z.number() });
11588
11944
  var DumpHeapSnapshotInputSchema = zod.z.object({
11589
11945
  /** The addon whose runner should dump a heap snapshot. */
11590
11946
  addonId: zod.z.string() });
@@ -11648,6 +12004,21 @@ var NodeLoadSeriesSchema = zod.z.object({
11648
12004
  /** One entry per function seen in the window, heaviest-first. */
11649
12005
  series: zod.z.array(LoadFunctionSeriesSchema).readonly(),
11650
12006
  /**
12007
+ * The CONTAINER's memory over the same window, oldest-first.
12008
+ *
12009
+ * Sits next to `series` rather than in a method of its own because the whole
12010
+ * question is a subtraction: the per-process rows in `series` sum to one
12011
+ * number and this one is another, and an operator who has to issue two calls
12012
+ * to compare them will compare two different instants. Same reader, same
12013
+ * `sinceMs`, same `bucketMs`, same timestamps.
12014
+ *
12015
+ * **EMPTY means ABSENT, never zero.** A node with no cgroup — a developer
12016
+ * Mac, a bare-metal host, a container with the hierarchy hidden — reports no
12017
+ * points at all. A zero here would be indistinguishable from a healthy
12018
+ * container and is precisely the lie this field exists to avoid.
12019
+ */
12020
+ containerMemory: zod.z.array(ContainerMemoryPointSchema).readonly(),
12021
+ /**
11651
12022
  * Width of one returned bucket, in ms. Equals the sampling cadence when no
11652
12023
  * reduction was needed — so a caller can always say what one point covers
11653
12024
  * without having to know whether it was reduced.
@@ -17295,6 +17666,20 @@ var TrackSchema = zod.z.object({
17295
17666
  * `=== true` and render nothing otherwise — never infer "no rider".
17296
17667
  */
17297
17668
  hasRider: zod.z.boolean().optional(),
17669
+ /**
17670
+ * WHY this track ended without a NATIVE best-shot tile
17671
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17672
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17673
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17674
+ * the late-keyFrame upgrade when a native tile lands after all. The
17675
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17676
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17677
+ *
17678
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17679
+ * that predates the field, and every track whose tile landed native all
17680
+ * omit it. Render nothing when absent.
17681
+ */
17682
+ previewMissReason: zod.z.string().optional(),
17298
17683
  ...TrackFlagFields,
17299
17684
  ...TrackRetrainFields
17300
17685
  });
@@ -29626,10 +30011,10 @@ var rebootCapability = {
29626
30011
  * recording config. NOTE on events (source of truth, R5/C3): this cap carries
29627
30012
  * NO event surface — `getPlaybackManifest` returns playlist URLs only. Timeline
29628
30013
  * events (motion/object/audio) come from `pipelineAnalytics` (durable SQLite
29629
- * rows); the recorder's internal EventMap markers are ephemeral in-RAM
29630
- * annotations that are not exposed here and must not be treated as an event
29631
- * feed. Event<->footage joins are by time, padded with the shared `EVENT_PAD_MS`
29632
- * (`interfaces/recording-config.ts`).
30014
+ * rows) and are the ONLY event surface the recorder has none. The in-RAM
30015
+ * playback markers it used to build were deleted on 2026-08-29 because nothing
30016
+ * ever read them. Event<->footage joins are by time, padded with the shared
30017
+ * `EVENT_PAD_MS` (`interfaces/recording-config.ts`).
29633
30018
  */
29634
30019
  var RecordingStatusSchema = zod.z.object({
29635
30020
  deviceId: zod.z.number(),
@@ -31829,6 +32214,13 @@ var LoggingSettingsPatchSchema = zod.z.object({
31829
32214
  * anyone but its owner.
31830
32215
  */
31831
32216
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: zod.z.string() });
32217
+ /**
32218
+ * One per-camera failure counter, plus WHO reported it.
32219
+ *
32220
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
32221
+ * the hub as it enumerates providers, never by the contributor.
32222
+ */
32223
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: zod.z.string() });
31832
32224
  var GetLoggingSettingsInputSchema = zod.z.object({
31833
32225
  scopeNodeId: zod.z.string().optional(),
31834
32226
  /**
@@ -31947,6 +32339,28 @@ var systemCapability = {
31947
32339
  */
31948
32340
  getLoadContributions: require_sleep.method(zod.z.void(), zod.z.array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }),
31949
32341
  /**
32342
+ * Every `failure-contribution` an addon on this cluster reports — per
32343
+ * camera, per reason, **with the denominator attached**.
32344
+ *
32345
+ * This is the surface the operator asked for on 2026-08-28 (*"possiamo
32346
+ * armare questi errori intanto? Così al prossimo giro ricontrolliamo tutti
32347
+ * questi punti"*). Before it, four live failure modes could only be counted
32348
+ * by grepping Loki and hand-correlating timestamps, which is exactly how a
32349
+ * 22% thumbnail gap and a 3-hour media blackout were diagnosed — twice.
32350
+ *
32351
+ * Read it as a RATIO, never as a count. `attempts` is on every entry
32352
+ * because the count on its own lies: `enrichment crop native miss` read as
32353
+ * "35x worse than yesterday" and was flat across twelve hours once divided
32354
+ * by the successes on the same path.
32355
+ *
32356
+ * The counters are CUMULATIVE since each entry's `sinceMs`. Reading does
32357
+ * not reset them, and `sinceMs` changing means the reporting runner
32358
+ * respawned — a consumer differencing two reads drops that interval.
32359
+ *
32360
+ * Admin-only: the rows name cameras and the paths that fail on them.
32361
+ */
32362
+ getFailureContributions: require_sleep.method(zod.z.void(), zod.z.array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }),
32363
+ /**
31950
32364
  * The logging settings document — levels and armed diagnostics — resolved
31951
32365
  * for `nodeId`, or for the cluster when `nodeId` is absent.
31952
32366
  *
@@ -36281,6 +36695,7 @@ var CAPABILITY_NAMES = {
36281
36695
  eventEmitter: "event-emitter",
36282
36696
  events: "events",
36283
36697
  faceGallery: "face-gallery",
36698
+ failureContribution: "failure-contribution",
36284
36699
  fanControl: "fan-control",
36285
36700
  featureProbe: "feature-probe",
36286
36701
  filesystemBrowse: "filesystem-browse",
@@ -36606,6 +37021,10 @@ var CAPABILITY_ROUTER_KEYS = [
36606
37021
  key: "faceGallery",
36607
37022
  name: "face-gallery"
36608
37023
  },
37024
+ {
37025
+ key: "failureContribution",
37026
+ name: "failure-contribution"
37027
+ },
36609
37028
  {
36610
37029
  key: "fanControl",
36611
37030
  name: "fan-control"
@@ -37050,6 +37469,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
37050
37469
  eventEmitterCapability,
37051
37470
  eventsCapability,
37052
37471
  faceGalleryCapability,
37472
+ failureContributionCapability,
37053
37473
  fanControlCapability,
37054
37474
  featureProbeCapability,
37055
37475
  filesystemBrowseCapability,
@@ -39056,6 +39476,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
39056
39476
  addonId: null,
39057
39477
  access: "create"
39058
39478
  },
39479
+ "failureContribution.list": {
39480
+ capName: "failure-contribution",
39481
+ capScope: "system",
39482
+ addonId: null,
39483
+ access: "view"
39484
+ },
39059
39485
  "fanControl.setDirection": {
39060
39486
  capName: "fan-control",
39061
39487
  capScope: "device",
@@ -42362,6 +42788,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
42362
42788
  addonId: null,
42363
42789
  access: "create"
42364
42790
  },
42791
+ "system.getFailureContributions": {
42792
+ capName: "system",
42793
+ capScope: "system",
42794
+ addonId: null,
42795
+ access: "view"
42796
+ },
42365
42797
  "system.getLoadContributions": {
42366
42798
  capName: "system",
42367
42799
  capScope: "system",
@@ -43052,6 +43484,7 @@ var KNOWN_CAP_NAMES = [
43052
43484
  "embedding-encoder",
43053
43485
  "events",
43054
43486
  "face-gallery",
43487
+ "failure-contribution",
43055
43488
  "fan-control",
43056
43489
  "filesystem-browse",
43057
43490
  "humidifier",
@@ -43218,6 +43651,7 @@ var SYSTEM_CAP_NAMES = [
43218
43651
  "device-state",
43219
43652
  "embedding-encoder",
43220
43653
  "face-gallery",
43654
+ "failure-contribution",
43221
43655
  "filesystem-browse",
43222
43656
  "integrations",
43223
43657
  "llm",
@@ -46166,6 +46600,7 @@ function createSystemProxy(api) {
46166
46600
  detectSiteLocation: (input) => dispatch("system", "detectSiteLocation", "mutation", input),
46167
46601
  getRequestCensus: (input) => dispatch("system", "getRequestCensus", "query", input),
46168
46602
  getLoadContributions: (input) => dispatch("system", "getLoadContributions", "query", input),
46603
+ getFailureContributions: (input) => dispatch("system", "getFailureContributions", "query", input),
46169
46604
  getLoggingSettings: (input) => dispatch("system", "getLoggingSettings", "query", input),
46170
46605
  setLoggingSettings: (input) => dispatch("system", "setLoggingSettings", "mutation", input)
46171
46606
  },
@@ -50498,6 +50933,9 @@ exports.ExpressionParseError = ExpressionParseError;
50498
50933
  exports.ExpressionSourceSchema = ExpressionSourceSchema;
50499
50934
  exports.FIRST_LEVEL_MACRO_CLASSES = FIRST_LEVEL_MACRO_CLASSES;
50500
50935
  exports.FULL_IMAGE_BBOX = FULL_IMAGE_BBOX;
50936
+ exports.FailureContributionSchema = FailureContributionSchema;
50937
+ exports.FailureCounters = FailureCounters;
50938
+ exports.FailureReasonCountSchema = FailureReasonCountSchema;
50501
50939
  exports.FanControlStatusSchema = FanControlStatusSchema;
50502
50940
  exports.FanDirectionSchema = FanDirectionSchema;
50503
50941
  exports.FeatureManifestSchema = FeatureManifestSchema;
@@ -50613,6 +51051,8 @@ exports.MAX_EXPRESSION_BINDINGS = MAX_EXPRESSION_BINDINGS;
50613
51051
  exports.MAX_EXPRESSION_CALL_ARGS = MAX_EXPRESSION_CALL_ARGS;
50614
51052
  exports.MAX_EXPRESSION_EVAL_STEPS = MAX_EXPRESSION_EVAL_STEPS;
50615
51053
  exports.MAX_EXPRESSION_SOURCE_LENGTH = MAX_EXPRESSION_SOURCE_LENGTH;
51054
+ exports.MAX_KEYS = MAX_KEYS;
51055
+ exports.MAX_REASONS_PER_KEY = MAX_REASONS_PER_KEY;
50616
51056
  exports.MAX_SENSOR_TRIGGER_DEVICES = MAX_SENSOR_TRIGGER_DEVICES;
50617
51057
  exports.METHOD_ACCESS_MAP = METHOD_ACCESS_MAP;
50618
51058
  exports.METHOD_DEVICE_SELECTORS = METHOD_DEVICE_SELECTORS;
@@ -50783,6 +51223,7 @@ exports.NumericSensorStatusSchema = NumericSensorStatusSchema;
50783
51223
  exports.OPERATOR_WRITTEN_STALE_MS = OPERATOR_WRITTEN_STALE_MS;
50784
51224
  exports.OPS_LOG_DEFAULT_LIMIT = OPS_LOG_DEFAULT_LIMIT;
50785
51225
  exports.OPS_LOG_RING_DEFAULT_MAX = OPS_LOG_RING_DEFAULT_MAX;
51226
+ exports.OVERFLOW_REASON = OVERFLOW_REASON;
50786
51227
  exports.OauthIntegrationDescriptorSchema = OauthIntegrationDescriptorSchema;
50787
51228
  exports.ObjectEventSchema = ObjectEventSchema;
50788
51229
  exports.OpsLogDomainSchema = OpsLogDomainSchema;
@@ -50904,6 +51345,7 @@ exports.RelocateJobStateSchema = RelocateJobStateSchema;
50904
51345
  exports.RelocateMediaInputSchema = RelocateMediaInputSchema;
50905
51346
  exports.RenderedAsSchema = RenderedAsSchema;
50906
51347
  exports.ReportMotionInputSchema = ReportMotionInputSchema;
51348
+ exports.ReportedFailureContributionSchema = ReportedFailureContributionSchema;
50907
51349
  exports.ReportedLoadContributionSchema = ReportedLoadContributionSchema;
50908
51350
  exports.RequestCensusGroupSchema = RequestCensusGroupSchema;
50909
51351
  exports.RequestCensusProcedureSchema = RequestCensusProcedureSchema;
@@ -51302,6 +51744,8 @@ exports.expandCapMethods = require_sleep.expandCapMethods;
51302
51744
  exports.extractNestedAddonId = extractNestedAddonId;
51303
51745
  exports.extractSourceInfoFromMetadata = extractSourceInfoFromMetadata;
51304
51746
  exports.faceGalleryCapability = faceGalleryCapability;
51747
+ exports.failureContributionCapability = failureContributionCapability;
51748
+ exports.failureRate = failureRate;
51305
51749
  exports.fanControlCapability = fanControlCapability;
51306
51750
  exports.featureProbeCapability = featureProbeCapability;
51307
51751
  exports.filesystemBrowseCapability = filesystemBrowseCapability;