@camstack/addon-mqtt-broker 1.2.38 → 1.2.39

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.
@@ -13281,6 +13281,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13281
13281
  limit: number().optional(),
13282
13282
  tags: record(string(), string()).optional()
13283
13283
  }), array(LogEntrySchema).readonly());
13284
+ /**
13285
+ * `failure-contribution` — the capability an addon reports its OWN losses
13286
+ * through, per camera, with the denominator attached. It stores nothing.
13287
+ *
13288
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13289
+ *
13290
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13291
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13292
+ * copied: the contributor reports what it already knows, hub-main adds only
13293
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13294
+ * somebody to forget to edit.
13295
+ *
13296
+ * They are not merged, because their invariants are opposites:
13297
+ *
13298
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13299
+ * claim a camera cost nothing, which is a measurement nobody made;
13300
+ * - a `failure-contribution` zero is the **most valuable value on the
13301
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13302
+ * and it is exactly what an absent entry cannot say.
13303
+ *
13304
+ * Putting a loss counter on a cost entry would also break the reconciliation
13305
+ * that gives `load-contribution` its point: contributions are subtracted from
13306
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13307
+ * has no process.
13308
+ *
13309
+ * ## Why not a log line, since the counters already exist
13310
+ *
13311
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13312
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13313
+ * ends in a log line, and a log line is the thing the operator asked to stop
13314
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13315
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13316
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13317
+ * media blackout were both diagnosed. The counters stay; this is where they can
13318
+ * be READ.
13319
+ *
13320
+ * ## The rate is served with its denominator or not at all
13321
+ *
13322
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13323
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13324
+ * than yesterday" and was **flat across twelve hours** once divided by the
13325
+ * successes on the same path. A surface that publishes only the numerator
13326
+ * reproduces that mistake on every read.
13327
+ *
13328
+ * ## Shape
13329
+ *
13330
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13331
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13332
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13333
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13334
+ * a forked runner's entries reach hub-main over transport that already exists.
13335
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13336
+ * result through `system.getFailureContributions`.
13337
+ */
13338
+ var FailureReasonCountSchema = object({
13339
+ /**
13340
+ * Why the attempt did not land, in the contributor's own vocabulary —
13341
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13342
+ * strings that already appear in this repo's logs and, where one exists, the
13343
+ * same string the per-track `previewMissReason` records (D276): a second
13344
+ * vocabulary for the same loss would make the row and the counter
13345
+ * un-joinable.
13346
+ */
13347
+ reason: string(),
13348
+ count: number().int().nonnegative()
13349
+ });
13350
+ var FailureContributionSchema = object({
13351
+ /**
13352
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13353
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13354
+ * `unit` free: the families are owned by different addons and a shared enum
13355
+ * is a central list that rots invisibly.
13356
+ */
13357
+ family: string(),
13358
+ /**
13359
+ * The NUMERIC device id — the same value every log line carries as
13360
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13361
+ * cannot name the camera must not emit the entry, because a fleet total
13362
+ * cannot answer the only question anybody asks of this surface.
13363
+ */
13364
+ deviceId: number().int().positive(),
13365
+ /**
13366
+ * A second dimension inside the family: the model / step id for an inference
13367
+ * timeout, so "which camera AND which model" is one read. Absent when the
13368
+ * family has a single variant.
13369
+ */
13370
+ variant: string().optional(),
13371
+ /**
13372
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13373
+ * differencing two reads must drop the interval when it changes, because the
13374
+ * counter restarted from zero in a respawned runner. Same discipline as
13375
+ * `LoadContribution.startedAtMs`.
13376
+ */
13377
+ sinceMs: number(),
13378
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13379
+ atMs: number(),
13380
+ /**
13381
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13382
+ * window. A failure count published without it is the mistake this schema
13383
+ * exists to make impossible.
13384
+ */
13385
+ attempts: number().int().nonnegative(),
13386
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13387
+ succeeded: number().int().nonnegative(),
13388
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13389
+ reasons: array(FailureReasonCountSchema).readonly()
13390
+ });
13391
+ method(_void(), array(FailureContributionSchema).readonly());
13284
13392
  var LoadContributionSchema = object({
13285
13393
  role: _enum([
13286
13394
  "decode",
@@ -17812,6 +17920,20 @@ var TrackSchema = object({
17812
17920
  * `=== true` and render nothing otherwise — never infer "no rider".
17813
17921
  */
17814
17922
  hasRider: boolean().optional(),
17923
+ /**
17924
+ * WHY this track ended without a NATIVE best-shot tile
17925
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17926
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17927
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17928
+ * the late-keyFrame upgrade when a native tile lands after all. The
17929
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17930
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17931
+ *
17932
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17933
+ * that predates the field, and every track whose tile landed native all
17934
+ * omit it. Render nothing when absent.
17935
+ */
17936
+ previewMissReason: string().optional(),
17815
17937
  ...TrackFlagFields,
17816
17938
  ...TrackRetrainFields
17817
17939
  });
@@ -27038,6 +27160,13 @@ var LoggingSettingsPatchSchema = object({
27038
27160
  * anyone but its owner.
27039
27161
  */
27040
27162
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27163
+ /**
27164
+ * One per-camera failure counter, plus WHO reported it.
27165
+ *
27166
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27167
+ * the hub as it enumerates providers, never by the contributor.
27168
+ */
27169
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
27041
27170
  var GetLoggingSettingsInputSchema = object({
27042
27171
  scopeNodeId: string().optional(),
27043
27172
  /**
@@ -27096,7 +27225,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27096
27225
  }), method(_void(), SiteLocationStatusSchema, {
27097
27226
  kind: "mutation",
27098
27227
  auth: "admin"
27099
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27228
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(_void(), array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27100
27229
  kind: "mutation",
27101
27230
  auth: "admin"
27102
27231
  });
@@ -29678,6 +29807,12 @@ Object.freeze({
29678
29807
  addonId: null,
29679
29808
  access: "create"
29680
29809
  },
29810
+ "failureContribution.list": {
29811
+ capName: "failure-contribution",
29812
+ capScope: "system",
29813
+ addonId: null,
29814
+ access: "view"
29815
+ },
29681
29816
  "fanControl.setDirection": {
29682
29817
  capName: "fan-control",
29683
29818
  capScope: "device",
@@ -32984,6 +33119,12 @@ Object.freeze({
32984
33119
  addonId: null,
32985
33120
  access: "create"
32986
33121
  },
33122
+ "system.getFailureContributions": {
33123
+ capName: "system",
33124
+ capScope: "system",
33125
+ addonId: null,
33126
+ access: "view"
33127
+ },
32987
33128
  "system.getLoadContributions": {
32988
33129
  capName: "system",
32989
33130
  capScope: "system",
@@ -13276,6 +13276,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13276
13276
  limit: number().optional(),
13277
13277
  tags: record(string(), string()).optional()
13278
13278
  }), array(LogEntrySchema).readonly());
13279
+ /**
13280
+ * `failure-contribution` — the capability an addon reports its OWN losses
13281
+ * through, per camera, with the denominator attached. It stores nothing.
13282
+ *
13283
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13284
+ *
13285
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13286
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13287
+ * copied: the contributor reports what it already knows, hub-main adds only
13288
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13289
+ * somebody to forget to edit.
13290
+ *
13291
+ * They are not merged, because their invariants are opposites:
13292
+ *
13293
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13294
+ * claim a camera cost nothing, which is a measurement nobody made;
13295
+ * - a `failure-contribution` zero is the **most valuable value on the
13296
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13297
+ * and it is exactly what an absent entry cannot say.
13298
+ *
13299
+ * Putting a loss counter on a cost entry would also break the reconciliation
13300
+ * that gives `load-contribution` its point: contributions are subtracted from
13301
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13302
+ * has no process.
13303
+ *
13304
+ * ## Why not a log line, since the counters already exist
13305
+ *
13306
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13307
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13308
+ * ends in a log line, and a log line is the thing the operator asked to stop
13309
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13310
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13311
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13312
+ * media blackout were both diagnosed. The counters stay; this is where they can
13313
+ * be READ.
13314
+ *
13315
+ * ## The rate is served with its denominator or not at all
13316
+ *
13317
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13318
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13319
+ * than yesterday" and was **flat across twelve hours** once divided by the
13320
+ * successes on the same path. A surface that publishes only the numerator
13321
+ * reproduces that mistake on every read.
13322
+ *
13323
+ * ## Shape
13324
+ *
13325
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13326
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13327
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13328
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13329
+ * a forked runner's entries reach hub-main over transport that already exists.
13330
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13331
+ * result through `system.getFailureContributions`.
13332
+ */
13333
+ var FailureReasonCountSchema = object({
13334
+ /**
13335
+ * Why the attempt did not land, in the contributor's own vocabulary —
13336
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13337
+ * strings that already appear in this repo's logs and, where one exists, the
13338
+ * same string the per-track `previewMissReason` records (D276): a second
13339
+ * vocabulary for the same loss would make the row and the counter
13340
+ * un-joinable.
13341
+ */
13342
+ reason: string(),
13343
+ count: number().int().nonnegative()
13344
+ });
13345
+ var FailureContributionSchema = object({
13346
+ /**
13347
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13348
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13349
+ * `unit` free: the families are owned by different addons and a shared enum
13350
+ * is a central list that rots invisibly.
13351
+ */
13352
+ family: string(),
13353
+ /**
13354
+ * The NUMERIC device id — the same value every log line carries as
13355
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13356
+ * cannot name the camera must not emit the entry, because a fleet total
13357
+ * cannot answer the only question anybody asks of this surface.
13358
+ */
13359
+ deviceId: number().int().positive(),
13360
+ /**
13361
+ * A second dimension inside the family: the model / step id for an inference
13362
+ * timeout, so "which camera AND which model" is one read. Absent when the
13363
+ * family has a single variant.
13364
+ */
13365
+ variant: string().optional(),
13366
+ /**
13367
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13368
+ * differencing two reads must drop the interval when it changes, because the
13369
+ * counter restarted from zero in a respawned runner. Same discipline as
13370
+ * `LoadContribution.startedAtMs`.
13371
+ */
13372
+ sinceMs: number(),
13373
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13374
+ atMs: number(),
13375
+ /**
13376
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13377
+ * window. A failure count published without it is the mistake this schema
13378
+ * exists to make impossible.
13379
+ */
13380
+ attempts: number().int().nonnegative(),
13381
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13382
+ succeeded: number().int().nonnegative(),
13383
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13384
+ reasons: array(FailureReasonCountSchema).readonly()
13385
+ });
13386
+ method(_void(), array(FailureContributionSchema).readonly());
13279
13387
  var LoadContributionSchema = object({
13280
13388
  role: _enum([
13281
13389
  "decode",
@@ -17807,6 +17915,20 @@ var TrackSchema = object({
17807
17915
  * `=== true` and render nothing otherwise — never infer "no rider".
17808
17916
  */
17809
17917
  hasRider: boolean().optional(),
17918
+ /**
17919
+ * WHY this track ended without a NATIVE best-shot tile
17920
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17921
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17922
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17923
+ * the late-keyFrame upgrade when a native tile lands after all. The
17924
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17925
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17926
+ *
17927
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17928
+ * that predates the field, and every track whose tile landed native all
17929
+ * omit it. Render nothing when absent.
17930
+ */
17931
+ previewMissReason: string().optional(),
17810
17932
  ...TrackFlagFields,
17811
17933
  ...TrackRetrainFields
17812
17934
  });
@@ -27033,6 +27155,13 @@ var LoggingSettingsPatchSchema = object({
27033
27155
  * anyone but its owner.
27034
27156
  */
27035
27157
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27158
+ /**
27159
+ * One per-camera failure counter, plus WHO reported it.
27160
+ *
27161
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27162
+ * the hub as it enumerates providers, never by the contributor.
27163
+ */
27164
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
27036
27165
  var GetLoggingSettingsInputSchema = object({
27037
27166
  scopeNodeId: string().optional(),
27038
27167
  /**
@@ -27091,7 +27220,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27091
27220
  }), method(_void(), SiteLocationStatusSchema, {
27092
27221
  kind: "mutation",
27093
27222
  auth: "admin"
27094
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27223
+ }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(_void(), array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27095
27224
  kind: "mutation",
27096
27225
  auth: "admin"
27097
27226
  });
@@ -29673,6 +29802,12 @@ Object.freeze({
29673
29802
  addonId: null,
29674
29803
  access: "create"
29675
29804
  },
29805
+ "failureContribution.list": {
29806
+ capName: "failure-contribution",
29807
+ capScope: "system",
29808
+ addonId: null,
29809
+ access: "view"
29810
+ },
29676
29811
  "fanControl.setDirection": {
29677
29812
  capName: "fan-control",
29678
29813
  capScope: "device",
@@ -32979,6 +33114,12 @@ Object.freeze({
32979
33114
  addonId: null,
32980
33115
  access: "create"
32981
33116
  },
33117
+ "system.getFailureContributions": {
33118
+ capName: "system",
33119
+ capScope: "system",
33120
+ addonId: null,
33121
+ access: "view"
33122
+ },
32982
33123
  "system.getLoadContributions": {
32983
33124
  capName: "system",
32984
33125
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-mqtt-broker",
3
- "version": "1.2.38",
3
+ "version": "1.2.39",
4
4
  "description": "MQTT broker registry addon for CamStack — manages external broker entries + an optional embedded aedes broker. Consumers spin up their own `mqtt.js` clients via the `mqtt-broker` cap.",
5
5
  "keywords": [
6
6
  "camstack",