@camstack/addon-decoder-nodeav 1.2.36 → 1.2.38

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
@@ -5920,6 +5920,40 @@ var BaseAddon = class {
5920
5920
  deviceSettingsSchema() {
5921
5921
  return null;
5922
5922
  }
5923
+ /**
5924
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5925
+ * ARE the configuration of its integration.
5926
+ *
5927
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5928
+ * operator should find on the addon's integration page (System →
5929
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5930
+ * addon. Empty (the default) means the addon has no integration-level
5931
+ * settings and no such surface is offered — this is opt-in, because whether
5932
+ * an addon's configuration IS its integration's configuration depends on the
5933
+ * nature of the integration.
5934
+ *
5935
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5936
+ * the ONE global schema, in the ONE addon store, written by the ONE
5937
+ * `updateGlobalSettings` path. There is deliberately no
5938
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5939
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5940
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5941
+ *
5942
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5943
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5944
+ * removed with the reason recorded at
5945
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5946
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5947
+ * marker sprinkled across sections also has to borrow a field that already
5948
+ * means something else; borrowing `section.tab` put the literal word
5949
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5950
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5951
+ * supersedes D268). One declaration, in one place, next to the schema whose
5952
+ * ids it names.
5953
+ */
5954
+ integrationSettingSections() {
5955
+ return [];
5956
+ }
5923
5957
  async getGlobalSettings(overlay, cap, nodeId) {
5924
5958
  const schema = this.globalSettingsSchema(cap);
5925
5959
  if (!schema) return { sections: [] };
@@ -5930,6 +5964,55 @@ var BaseAddon = class {
5930
5964
  } : projected);
5931
5965
  }
5932
5966
  /**
5967
+ * The integration-level view of this addon's settings: exactly the sections
5968
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5969
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5970
+ *
5971
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5972
+ * no integration settings surface at all, rather than an empty one that reads
5973
+ * as a failed load.
5974
+ *
5975
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5976
+ * and not in whichever UI happens to render this:
5977
+ *
5978
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5979
+ * shown here is the same field, with the same bare key, that the addon's
5980
+ * own page shows. There is no integration-specific writer — callers save
5981
+ * through `updateGlobalSettings` — so a second store key is unreachable,
5982
+ * not merely discouraged.
5983
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
5984
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
5985
+ * such a field silently picked would be a wrong answer for the operator
5986
+ * who opened the page (D266).
5987
+ * 3. **No silent typo.** A declared id that names no section throws. The
5988
+ * alternative — skip it — turns a rename into a surface that quietly
5989
+ * empties, which looks exactly like an addon with nothing to configure.
5990
+ */
5991
+ async getIntegrationSettings(nodeId) {
5992
+ const declared = this.integrationSettingSections();
5993
+ if (declared.length === 0) return null;
5994
+ const schema = this.globalSettingsSchema();
5995
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
5996
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
5997
+ const sections = [];
5998
+ for (const id of declared) {
5999
+ const section = byId.get(id);
6000
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6001
+ const fields = dropPerNodeFields(section.fields);
6002
+ if (fields.length === 0) continue;
6003
+ sections.push({
6004
+ ...section,
6005
+ fields
6006
+ });
6007
+ }
6008
+ if (sections.length === 0) return null;
6009
+ const projected = await this.resolveGlobalStore(nodeId);
6010
+ return hydrateSchema({
6011
+ ...schema,
6012
+ sections
6013
+ }, projected);
6014
+ }
6015
+ /**
5933
6016
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5934
6017
  * every `perNode: true` field carries THAT node's scoped value on its bare
5935
6018
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6233,6 +6316,41 @@ var BaseAddon = class {
6233
6316
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6234
6317
  * don't declare `perNode` and are excluded by the `in` narrowing.
6235
6318
  */
6319
+ /**
6320
+ * The same fields with every `perNode: true` one removed, recursing into layout
6321
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6322
+ * with no child is dropped rather than rendered empty.
6323
+ *
6324
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6325
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6326
+ */
6327
+ function dropPerNodeFields(fields) {
6328
+ const kept = [];
6329
+ for (const field of fields) {
6330
+ if (field.type === "group") {
6331
+ const inner = dropPerNodeFields(field.fields);
6332
+ if (inner.length > 0) kept.push({
6333
+ ...field,
6334
+ fields: inner
6335
+ });
6336
+ continue;
6337
+ }
6338
+ if (field.type === "sub-tabs") {
6339
+ const tabs = field.tabs.map((tab) => ({
6340
+ ...tab,
6341
+ fields: dropPerNodeFields(tab.fields)
6342
+ })).filter((tab) => tab.fields.length > 0);
6343
+ if (tabs.length > 0) kept.push({
6344
+ ...field,
6345
+ tabs
6346
+ });
6347
+ continue;
6348
+ }
6349
+ if ("perNode" in field && field.perNode === true) continue;
6350
+ kept.push(field);
6351
+ }
6352
+ return kept;
6353
+ }
6236
6354
  function collectPerNodeFieldKeys(fields) {
6237
6355
  const collected = [];
6238
6356
  for (const field of fields) {
@@ -9398,6 +9516,9 @@ method(object({
9398
9516
  kind: "mutation",
9399
9517
  auth: "admin"
9400
9518
  }), method(object({
9519
+ addonId: string(),
9520
+ nodeId: string().optional()
9521
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9401
9522
  addonId: string(),
9402
9523
  deviceId: number(),
9403
9524
  nodeId: string().optional()
@@ -13212,6 +13333,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13212
13333
  limit: number().optional(),
13213
13334
  tags: record(string(), string()).optional()
13214
13335
  }), array(LogEntrySchema).readonly());
13336
+ /**
13337
+ * `failure-contribution` — the capability an addon reports its OWN losses
13338
+ * through, per camera, with the denominator attached. It stores nothing.
13339
+ *
13340
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13341
+ *
13342
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13343
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13344
+ * copied: the contributor reports what it already knows, hub-main adds only
13345
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13346
+ * somebody to forget to edit.
13347
+ *
13348
+ * They are not merged, because their invariants are opposites:
13349
+ *
13350
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13351
+ * claim a camera cost nothing, which is a measurement nobody made;
13352
+ * - a `failure-contribution` zero is the **most valuable value on the
13353
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13354
+ * and it is exactly what an absent entry cannot say.
13355
+ *
13356
+ * Putting a loss counter on a cost entry would also break the reconciliation
13357
+ * that gives `load-contribution` its point: contributions are subtracted from
13358
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13359
+ * has no process.
13360
+ *
13361
+ * ## Why not a log line, since the counters already exist
13362
+ *
13363
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13364
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13365
+ * ends in a log line, and a log line is the thing the operator asked to stop
13366
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13367
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13368
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13369
+ * media blackout were both diagnosed. The counters stay; this is where they can
13370
+ * be READ.
13371
+ *
13372
+ * ## The rate is served with its denominator or not at all
13373
+ *
13374
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13375
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13376
+ * than yesterday" and was **flat across twelve hours** once divided by the
13377
+ * successes on the same path. A surface that publishes only the numerator
13378
+ * reproduces that mistake on every read.
13379
+ *
13380
+ * ## Shape
13381
+ *
13382
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13383
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13384
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13385
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13386
+ * a forked runner's entries reach hub-main over transport that already exists.
13387
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13388
+ * result through `system.getFailureContributions`.
13389
+ */
13390
+ var FailureReasonCountSchema = object({
13391
+ /**
13392
+ * Why the attempt did not land, in the contributor's own vocabulary —
13393
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13394
+ * strings that already appear in this repo's logs and, where one exists, the
13395
+ * same string the per-track `previewMissReason` records (D276): a second
13396
+ * vocabulary for the same loss would make the row and the counter
13397
+ * un-joinable.
13398
+ */
13399
+ reason: string(),
13400
+ count: number().int().nonnegative()
13401
+ });
13402
+ var FailureContributionSchema = object({
13403
+ /**
13404
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13405
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13406
+ * `unit` free: the families are owned by different addons and a shared enum
13407
+ * is a central list that rots invisibly.
13408
+ */
13409
+ family: string(),
13410
+ /**
13411
+ * The NUMERIC device id — the same value every log line carries as
13412
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13413
+ * cannot name the camera must not emit the entry, because a fleet total
13414
+ * cannot answer the only question anybody asks of this surface.
13415
+ */
13416
+ deviceId: number().int().positive(),
13417
+ /**
13418
+ * A second dimension inside the family: the model / step id for an inference
13419
+ * timeout, so "which camera AND which model" is one read. Absent when the
13420
+ * family has a single variant.
13421
+ */
13422
+ variant: string().optional(),
13423
+ /**
13424
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13425
+ * differencing two reads must drop the interval when it changes, because the
13426
+ * counter restarted from zero in a respawned runner. Same discipline as
13427
+ * `LoadContribution.startedAtMs`.
13428
+ */
13429
+ sinceMs: number(),
13430
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13431
+ atMs: number(),
13432
+ /**
13433
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13434
+ * window. A failure count published without it is the mistake this schema
13435
+ * exists to make impossible.
13436
+ */
13437
+ attempts: number().int().nonnegative(),
13438
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13439
+ succeeded: number().int().nonnegative(),
13440
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13441
+ reasons: array(FailureReasonCountSchema).readonly()
13442
+ });
13443
+ method(_void(), array(FailureContributionSchema).readonly());
13215
13444
  var LoadContributionSchema = object({
13216
13445
  role: _enum([
13217
13446
  "decode",
@@ -17724,6 +17953,20 @@ var TrackSchema = object({
17724
17953
  * `=== true` and render nothing otherwise — never infer "no rider".
17725
17954
  */
17726
17955
  hasRider: boolean().optional(),
17956
+ /**
17957
+ * WHY this track ended without a NATIVE best-shot tile
17958
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17959
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17960
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17961
+ * the late-keyFrame upgrade when a native tile lands after all. The
17962
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17963
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17964
+ *
17965
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17966
+ * that predates the field, and every track whose tile landed native all
17967
+ * omit it. Render nothing when absent.
17968
+ */
17969
+ previewMissReason: string().optional(),
17727
17970
  ...TrackFlagFields,
17728
17971
  ...TrackRetrainFields
17729
17972
  });
@@ -26950,6 +27193,13 @@ var LoggingSettingsPatchSchema = object({
26950
27193
  * anyone but its owner.
26951
27194
  */
26952
27195
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27196
+ /**
27197
+ * One per-camera failure counter, plus WHO reported it.
27198
+ *
27199
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27200
+ * the hub as it enumerates providers, never by the contributor.
27201
+ */
27202
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26953
27203
  var GetLoggingSettingsInputSchema = object({
26954
27204
  scopeNodeId: string().optional(),
26955
27205
  /**
@@ -27008,7 +27258,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27008
27258
  }), method(_void(), SiteLocationStatusSchema, {
27009
27259
  kind: "mutation",
27010
27260
  auth: "admin"
27011
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27261
+ }), 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, {
27012
27262
  kind: "mutation",
27013
27263
  auth: "admin"
27014
27264
  });
@@ -27922,6 +28172,12 @@ Object.freeze({
27922
28172
  addonId: null,
27923
28173
  access: "view"
27924
28174
  },
28175
+ "addonSettings.getIntegrationSettings": {
28176
+ capName: "addon-settings",
28177
+ capScope: "system",
28178
+ addonId: null,
28179
+ access: "view"
28180
+ },
27925
28181
  "addonSettings.updateDeviceSettings": {
27926
28182
  capName: "addon-settings",
27927
28183
  capScope: "system",
@@ -29584,6 +29840,12 @@ Object.freeze({
29584
29840
  addonId: null,
29585
29841
  access: "create"
29586
29842
  },
29843
+ "failureContribution.list": {
29844
+ capName: "failure-contribution",
29845
+ capScope: "system",
29846
+ addonId: null,
29847
+ access: "view"
29848
+ },
29587
29849
  "fanControl.setDirection": {
29588
29850
  capName: "fan-control",
29589
29851
  capScope: "device",
@@ -32890,6 +33152,12 @@ Object.freeze({
32890
33152
  addonId: null,
32891
33153
  access: "create"
32892
33154
  },
33155
+ "system.getFailureContributions": {
33156
+ capName: "system",
33157
+ capScope: "system",
33158
+ addonId: null,
33159
+ access: "view"
33160
+ },
32893
33161
  "system.getLoadContributions": {
32894
33162
  capName: "system",
32895
33163
  capScope: "system",
package/dist/index.mjs CHANGED
@@ -5916,6 +5916,40 @@ var BaseAddon = class {
5916
5916
  deviceSettingsSchema() {
5917
5917
  return null;
5918
5918
  }
5919
+ /**
5920
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5921
+ * ARE the configuration of its integration.
5922
+ *
5923
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5924
+ * operator should find on the addon's integration page (System →
5925
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5926
+ * addon. Empty (the default) means the addon has no integration-level
5927
+ * settings and no such surface is offered — this is opt-in, because whether
5928
+ * an addon's configuration IS its integration's configuration depends on the
5929
+ * nature of the integration.
5930
+ *
5931
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5932
+ * the ONE global schema, in the ONE addon store, written by the ONE
5933
+ * `updateGlobalSettings` path. There is deliberately no
5934
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5935
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5936
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5937
+ *
5938
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5939
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5940
+ * removed with the reason recorded at
5941
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5942
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5943
+ * marker sprinkled across sections also has to borrow a field that already
5944
+ * means something else; borrowing `section.tab` put the literal word
5945
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5946
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5947
+ * supersedes D268). One declaration, in one place, next to the schema whose
5948
+ * ids it names.
5949
+ */
5950
+ integrationSettingSections() {
5951
+ return [];
5952
+ }
5919
5953
  async getGlobalSettings(overlay, cap, nodeId) {
5920
5954
  const schema = this.globalSettingsSchema(cap);
5921
5955
  if (!schema) return { sections: [] };
@@ -5926,6 +5960,55 @@ var BaseAddon = class {
5926
5960
  } : projected);
5927
5961
  }
5928
5962
  /**
5963
+ * The integration-level view of this addon's settings: exactly the sections
5964
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5965
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5966
+ *
5967
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5968
+ * no integration settings surface at all, rather than an empty one that reads
5969
+ * as a failed load.
5970
+ *
5971
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5972
+ * and not in whichever UI happens to render this:
5973
+ *
5974
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5975
+ * shown here is the same field, with the same bare key, that the addon's
5976
+ * own page shows. There is no integration-specific writer — callers save
5977
+ * through `updateGlobalSettings` — so a second store key is unreachable,
5978
+ * not merely discouraged.
5979
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
5980
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
5981
+ * such a field silently picked would be a wrong answer for the operator
5982
+ * who opened the page (D266).
5983
+ * 3. **No silent typo.** A declared id that names no section throws. The
5984
+ * alternative — skip it — turns a rename into a surface that quietly
5985
+ * empties, which looks exactly like an addon with nothing to configure.
5986
+ */
5987
+ async getIntegrationSettings(nodeId) {
5988
+ const declared = this.integrationSettingSections();
5989
+ if (declared.length === 0) return null;
5990
+ const schema = this.globalSettingsSchema();
5991
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
5992
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
5993
+ const sections = [];
5994
+ for (const id of declared) {
5995
+ const section = byId.get(id);
5996
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
5997
+ const fields = dropPerNodeFields(section.fields);
5998
+ if (fields.length === 0) continue;
5999
+ sections.push({
6000
+ ...section,
6001
+ fields
6002
+ });
6003
+ }
6004
+ if (sections.length === 0) return null;
6005
+ const projected = await this.resolveGlobalStore(nodeId);
6006
+ return hydrateSchema({
6007
+ ...schema,
6008
+ sections
6009
+ }, projected);
6010
+ }
6011
+ /**
5929
6012
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5930
6013
  * every `perNode: true` field carries THAT node's scoped value on its bare
5931
6014
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6229,6 +6312,41 @@ var BaseAddon = class {
6229
6312
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6230
6313
  * don't declare `perNode` and are excluded by the `in` narrowing.
6231
6314
  */
6315
+ /**
6316
+ * The same fields with every `perNode: true` one removed, recursing into layout
6317
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6318
+ * with no child is dropped rather than rendered empty.
6319
+ *
6320
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6321
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6322
+ */
6323
+ function dropPerNodeFields(fields) {
6324
+ const kept = [];
6325
+ for (const field of fields) {
6326
+ if (field.type === "group") {
6327
+ const inner = dropPerNodeFields(field.fields);
6328
+ if (inner.length > 0) kept.push({
6329
+ ...field,
6330
+ fields: inner
6331
+ });
6332
+ continue;
6333
+ }
6334
+ if (field.type === "sub-tabs") {
6335
+ const tabs = field.tabs.map((tab) => ({
6336
+ ...tab,
6337
+ fields: dropPerNodeFields(tab.fields)
6338
+ })).filter((tab) => tab.fields.length > 0);
6339
+ if (tabs.length > 0) kept.push({
6340
+ ...field,
6341
+ tabs
6342
+ });
6343
+ continue;
6344
+ }
6345
+ if ("perNode" in field && field.perNode === true) continue;
6346
+ kept.push(field);
6347
+ }
6348
+ return kept;
6349
+ }
6232
6350
  function collectPerNodeFieldKeys(fields) {
6233
6351
  const collected = [];
6234
6352
  for (const field of fields) {
@@ -9394,6 +9512,9 @@ method(object({
9394
9512
  kind: "mutation",
9395
9513
  auth: "admin"
9396
9514
  }), method(object({
9515
+ addonId: string(),
9516
+ nodeId: string().optional()
9517
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9397
9518
  addonId: string(),
9398
9519
  deviceId: number(),
9399
9520
  nodeId: string().optional()
@@ -13208,6 +13329,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13208
13329
  limit: number().optional(),
13209
13330
  tags: record(string(), string()).optional()
13210
13331
  }), array(LogEntrySchema).readonly());
13332
+ /**
13333
+ * `failure-contribution` — the capability an addon reports its OWN losses
13334
+ * through, per camera, with the denominator attached. It stores nothing.
13335
+ *
13336
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13337
+ *
13338
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13339
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13340
+ * copied: the contributor reports what it already knows, hub-main adds only
13341
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13342
+ * somebody to forget to edit.
13343
+ *
13344
+ * They are not merged, because their invariants are opposites:
13345
+ *
13346
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13347
+ * claim a camera cost nothing, which is a measurement nobody made;
13348
+ * - a `failure-contribution` zero is the **most valuable value on the
13349
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13350
+ * and it is exactly what an absent entry cannot say.
13351
+ *
13352
+ * Putting a loss counter on a cost entry would also break the reconciliation
13353
+ * that gives `load-contribution` its point: contributions are subtracted from
13354
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13355
+ * has no process.
13356
+ *
13357
+ * ## Why not a log line, since the counters already exist
13358
+ *
13359
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13360
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13361
+ * ends in a log line, and a log line is the thing the operator asked to stop
13362
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13363
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13364
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13365
+ * media blackout were both diagnosed. The counters stay; this is where they can
13366
+ * be READ.
13367
+ *
13368
+ * ## The rate is served with its denominator or not at all
13369
+ *
13370
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13371
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13372
+ * than yesterday" and was **flat across twelve hours** once divided by the
13373
+ * successes on the same path. A surface that publishes only the numerator
13374
+ * reproduces that mistake on every read.
13375
+ *
13376
+ * ## Shape
13377
+ *
13378
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13379
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13380
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13381
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13382
+ * a forked runner's entries reach hub-main over transport that already exists.
13383
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13384
+ * result through `system.getFailureContributions`.
13385
+ */
13386
+ var FailureReasonCountSchema = object({
13387
+ /**
13388
+ * Why the attempt did not land, in the contributor's own vocabulary —
13389
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13390
+ * strings that already appear in this repo's logs and, where one exists, the
13391
+ * same string the per-track `previewMissReason` records (D276): a second
13392
+ * vocabulary for the same loss would make the row and the counter
13393
+ * un-joinable.
13394
+ */
13395
+ reason: string(),
13396
+ count: number().int().nonnegative()
13397
+ });
13398
+ var FailureContributionSchema = object({
13399
+ /**
13400
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13401
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13402
+ * `unit` free: the families are owned by different addons and a shared enum
13403
+ * is a central list that rots invisibly.
13404
+ */
13405
+ family: string(),
13406
+ /**
13407
+ * The NUMERIC device id — the same value every log line carries as
13408
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13409
+ * cannot name the camera must not emit the entry, because a fleet total
13410
+ * cannot answer the only question anybody asks of this surface.
13411
+ */
13412
+ deviceId: number().int().positive(),
13413
+ /**
13414
+ * A second dimension inside the family: the model / step id for an inference
13415
+ * timeout, so "which camera AND which model" is one read. Absent when the
13416
+ * family has a single variant.
13417
+ */
13418
+ variant: string().optional(),
13419
+ /**
13420
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13421
+ * differencing two reads must drop the interval when it changes, because the
13422
+ * counter restarted from zero in a respawned runner. Same discipline as
13423
+ * `LoadContribution.startedAtMs`.
13424
+ */
13425
+ sinceMs: number(),
13426
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13427
+ atMs: number(),
13428
+ /**
13429
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13430
+ * window. A failure count published without it is the mistake this schema
13431
+ * exists to make impossible.
13432
+ */
13433
+ attempts: number().int().nonnegative(),
13434
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13435
+ succeeded: number().int().nonnegative(),
13436
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13437
+ reasons: array(FailureReasonCountSchema).readonly()
13438
+ });
13439
+ method(_void(), array(FailureContributionSchema).readonly());
13211
13440
  var LoadContributionSchema = object({
13212
13441
  role: _enum([
13213
13442
  "decode",
@@ -17720,6 +17949,20 @@ var TrackSchema = object({
17720
17949
  * `=== true` and render nothing otherwise — never infer "no rider".
17721
17950
  */
17722
17951
  hasRider: boolean().optional(),
17952
+ /**
17953
+ * WHY this track ended without a NATIVE best-shot tile
17954
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17955
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17956
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17957
+ * the late-keyFrame upgrade when a native tile lands after all. The
17958
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17959
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17960
+ *
17961
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17962
+ * that predates the field, and every track whose tile landed native all
17963
+ * omit it. Render nothing when absent.
17964
+ */
17965
+ previewMissReason: string().optional(),
17723
17966
  ...TrackFlagFields,
17724
17967
  ...TrackRetrainFields
17725
17968
  });
@@ -26946,6 +27189,13 @@ var LoggingSettingsPatchSchema = object({
26946
27189
  * anyone but its owner.
26947
27190
  */
26948
27191
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27192
+ /**
27193
+ * One per-camera failure counter, plus WHO reported it.
27194
+ *
27195
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27196
+ * the hub as it enumerates providers, never by the contributor.
27197
+ */
27198
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26949
27199
  var GetLoggingSettingsInputSchema = object({
26950
27200
  scopeNodeId: string().optional(),
26951
27201
  /**
@@ -27004,7 +27254,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
27004
27254
  }), method(_void(), SiteLocationStatusSchema, {
27005
27255
  kind: "mutation",
27006
27256
  auth: "admin"
27007
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27257
+ }), 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, {
27008
27258
  kind: "mutation",
27009
27259
  auth: "admin"
27010
27260
  });
@@ -27918,6 +28168,12 @@ Object.freeze({
27918
28168
  addonId: null,
27919
28169
  access: "view"
27920
28170
  },
28171
+ "addonSettings.getIntegrationSettings": {
28172
+ capName: "addon-settings",
28173
+ capScope: "system",
28174
+ addonId: null,
28175
+ access: "view"
28176
+ },
27921
28177
  "addonSettings.updateDeviceSettings": {
27922
28178
  capName: "addon-settings",
27923
28179
  capScope: "system",
@@ -29580,6 +29836,12 @@ Object.freeze({
29580
29836
  addonId: null,
29581
29837
  access: "create"
29582
29838
  },
29839
+ "failureContribution.list": {
29840
+ capName: "failure-contribution",
29841
+ capScope: "system",
29842
+ addonId: null,
29843
+ access: "view"
29844
+ },
29583
29845
  "fanControl.setDirection": {
29584
29846
  capName: "fan-control",
29585
29847
  capScope: "device",
@@ -32886,6 +33148,12 @@ Object.freeze({
32886
33148
  addonId: null,
32887
33149
  access: "create"
32888
33150
  },
33151
+ "system.getFailureContributions": {
33152
+ capName: "system",
33153
+ capScope: "system",
33154
+ addonId: null,
33155
+ access: "view"
33156
+ },
32889
33157
  "system.getLoadContributions": {
32890
33158
  capName: "system",
32891
33159
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-decoder-nodeav",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "description": "Standalone in-process node-av decoder addon for CamStack",
5
5
  "keywords": [
6
6
  "camstack",