@camstack/addon-provider-rademacher 0.2.36 → 0.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/addon.js CHANGED
@@ -6901,6 +6901,40 @@ var BaseAddon = class {
6901
6901
  deviceSettingsSchema() {
6902
6902
  return null;
6903
6903
  }
6904
+ /**
6905
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
6906
+ * ARE the configuration of its integration.
6907
+ *
6908
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
6909
+ * operator should find on the addon's integration page (System →
6910
+ * Integrations → <name>) rather than only in the cluster-wide list of every
6911
+ * addon. Empty (the default) means the addon has no integration-level
6912
+ * settings and no such surface is offered — this is opt-in, because whether
6913
+ * an addon's configuration IS its integration's configuration depends on the
6914
+ * nature of the integration.
6915
+ *
6916
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
6917
+ * the ONE global schema, in the ONE addon store, written by the ONE
6918
+ * `updateGlobalSettings` path. There is deliberately no
6919
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
6920
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
6921
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
6922
+ *
6923
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
6924
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
6925
+ * removed with the reason recorded at
6926
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
6927
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
6928
+ * marker sprinkled across sections also has to borrow a field that already
6929
+ * means something else; borrowing `section.tab` put the literal word
6930
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
6931
+ * GROUP this visually" and cannot also mean "where this lives" (D269
6932
+ * supersedes D268). One declaration, in one place, next to the schema whose
6933
+ * ids it names.
6934
+ */
6935
+ integrationSettingSections() {
6936
+ return [];
6937
+ }
6904
6938
  async getGlobalSettings(overlay, cap, nodeId) {
6905
6939
  const schema = this.globalSettingsSchema(cap);
6906
6940
  if (!schema) return { sections: [] };
@@ -6911,6 +6945,55 @@ var BaseAddon = class {
6911
6945
  } : projected);
6912
6946
  }
6913
6947
  /**
6948
+ * The integration-level view of this addon's settings: exactly the sections
6949
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
6950
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
6951
+ *
6952
+ * Returns `null` when the addon declared nothing — an addon that opts out has
6953
+ * no integration settings surface at all, rather than an empty one that reads
6954
+ * as a failed load.
6955
+ *
6956
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
6957
+ * and not in whichever UI happens to render this:
6958
+ *
6959
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
6960
+ * shown here is the same field, with the same bare key, that the addon's
6961
+ * own page shows. There is no integration-specific writer — callers save
6962
+ * through `updateGlobalSettings` — so a second store key is unreachable,
6963
+ * not merely discouraged.
6964
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
6965
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
6966
+ * such a field silently picked would be a wrong answer for the operator
6967
+ * who opened the page (D266).
6968
+ * 3. **No silent typo.** A declared id that names no section throws. The
6969
+ * alternative — skip it — turns a rename into a surface that quietly
6970
+ * empties, which looks exactly like an addon with nothing to configure.
6971
+ */
6972
+ async getIntegrationSettings(nodeId) {
6973
+ const declared = this.integrationSettingSections();
6974
+ if (declared.length === 0) return null;
6975
+ const schema = this.globalSettingsSchema();
6976
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
6977
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
6978
+ const sections = [];
6979
+ for (const id of declared) {
6980
+ const section = byId.get(id);
6981
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6982
+ const fields = dropPerNodeFields(section.fields);
6983
+ if (fields.length === 0) continue;
6984
+ sections.push({
6985
+ ...section,
6986
+ fields
6987
+ });
6988
+ }
6989
+ if (sections.length === 0) return null;
6990
+ const projected = await this.resolveGlobalStore(nodeId);
6991
+ return hydrateSchema({
6992
+ ...schema,
6993
+ sections
6994
+ }, projected);
6995
+ }
6996
+ /**
6914
6997
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
6915
6998
  * every `perNode: true` field carries THAT node's scoped value on its bare
6916
6999
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -7214,6 +7297,41 @@ var BaseAddon = class {
7214
7297
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
7215
7298
  * don't declare `perNode` and are excluded by the `in` narrowing.
7216
7299
  */
7300
+ /**
7301
+ * The same fields with every `perNode: true` one removed, recursing into layout
7302
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
7303
+ * with no child is dropped rather than rendered empty.
7304
+ *
7305
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
7306
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
7307
+ */
7308
+ function dropPerNodeFields(fields) {
7309
+ const kept = [];
7310
+ for (const field of fields) {
7311
+ if (field.type === "group") {
7312
+ const inner = dropPerNodeFields(field.fields);
7313
+ if (inner.length > 0) kept.push({
7314
+ ...field,
7315
+ fields: inner
7316
+ });
7317
+ continue;
7318
+ }
7319
+ if (field.type === "sub-tabs") {
7320
+ const tabs = field.tabs.map((tab) => ({
7321
+ ...tab,
7322
+ fields: dropPerNodeFields(tab.fields)
7323
+ })).filter((tab) => tab.fields.length > 0);
7324
+ if (tabs.length > 0) kept.push({
7325
+ ...field,
7326
+ tabs
7327
+ });
7328
+ continue;
7329
+ }
7330
+ if ("perNode" in field && field.perNode === true) continue;
7331
+ kept.push(field);
7332
+ }
7333
+ return kept;
7334
+ }
7217
7335
  function collectPerNodeFieldKeys(fields) {
7218
7336
  const collected = [];
7219
7337
  for (const field of fields) {
@@ -10383,6 +10501,9 @@ method(object({
10383
10501
  kind: "mutation",
10384
10502
  auth: "admin"
10385
10503
  }), method(object({
10504
+ addonId: string(),
10505
+ nodeId: string().optional()
10506
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
10386
10507
  addonId: string(),
10387
10508
  deviceId: number(),
10388
10509
  nodeId: string().optional()
@@ -14331,6 +14452,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14331
14452
  limit: number().optional(),
14332
14453
  tags: record(string(), string()).optional()
14333
14454
  }), array(LogEntrySchema).readonly());
14455
+ /**
14456
+ * `failure-contribution` — the capability an addon reports its OWN losses
14457
+ * through, per camera, with the denominator attached. It stores nothing.
14458
+ *
14459
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
14460
+ *
14461
+ * `load-contribution` answers *what did this camera COST*. This answers *what
14462
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
14463
+ * copied: the contributor reports what it already knows, hub-main adds only
14464
+ * `addonId`, nothing needs global knowledge, and there is no central list for
14465
+ * somebody to forget to edit.
14466
+ *
14467
+ * They are not merged, because their invariants are opposites:
14468
+ *
14469
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
14470
+ * claim a camera cost nothing, which is a measurement nobody made;
14471
+ * - a `failure-contribution` zero is the **most valuable value on the
14472
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14473
+ * and it is exactly what an absent entry cannot say.
14474
+ *
14475
+ * Putting a loss counter on a cost entry would also break the reconciliation
14476
+ * that gives `load-contribution` its point: contributions are subtracted from
14477
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14478
+ * has no process.
14479
+ *
14480
+ * ## Why not a log line, since the counters already exist
14481
+ *
14482
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
14483
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14484
+ * ends in a log line, and a log line is the thing the operator asked to stop
14485
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14486
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14487
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14488
+ * media blackout were both diagnosed. The counters stay; this is where they can
14489
+ * be READ.
14490
+ *
14491
+ * ## The rate is served with its denominator or not at all
14492
+ *
14493
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
14494
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14495
+ * than yesterday" and was **flat across twelve hours** once divided by the
14496
+ * successes on the same path. A surface that publishes only the numerator
14497
+ * reproduces that mistake on every read.
14498
+ *
14499
+ * ## Shape
14500
+ *
14501
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14502
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14503
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14504
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14505
+ * a forked runner's entries reach hub-main over transport that already exists.
14506
+ * No new UDS message, no second registry (D3). The operator reads the assembled
14507
+ * result through `system.getFailureContributions`.
14508
+ */
14509
+ var FailureReasonCountSchema = object({
14510
+ /**
14511
+ * Why the attempt did not land, in the contributor's own vocabulary —
14512
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14513
+ * strings that already appear in this repo's logs and, where one exists, the
14514
+ * same string the per-track `previewMissReason` records (D276): a second
14515
+ * vocabulary for the same loss would make the row and the counter
14516
+ * un-joinable.
14517
+ */
14518
+ reason: string(),
14519
+ count: number().int().nonnegative()
14520
+ });
14521
+ var FailureContributionSchema = object({
14522
+ /**
14523
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14524
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14525
+ * `unit` free: the families are owned by different addons and a shared enum
14526
+ * is a central list that rots invisibly.
14527
+ */
14528
+ family: string(),
14529
+ /**
14530
+ * The NUMERIC device id — the same value every log line carries as
14531
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
14532
+ * cannot name the camera must not emit the entry, because a fleet total
14533
+ * cannot answer the only question anybody asks of this surface.
14534
+ */
14535
+ deviceId: number().int().positive(),
14536
+ /**
14537
+ * A second dimension inside the family: the model / step id for an inference
14538
+ * timeout, so "which camera AND which model" is one read. Absent when the
14539
+ * family has a single variant.
14540
+ */
14541
+ variant: string().optional(),
14542
+ /**
14543
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14544
+ * differencing two reads must drop the interval when it changes, because the
14545
+ * counter restarted from zero in a respawned runner. Same discipline as
14546
+ * `LoadContribution.startedAtMs`.
14547
+ */
14548
+ sinceMs: number(),
14549
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14550
+ atMs: number(),
14551
+ /**
14552
+ * THE DENOMINATOR — every attempt on this path for this camera in the
14553
+ * window. A failure count published without it is the mistake this schema
14554
+ * exists to make impossible.
14555
+ */
14556
+ attempts: number().int().nonnegative(),
14557
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
14558
+ succeeded: number().int().nonnegative(),
14559
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
14560
+ reasons: array(FailureReasonCountSchema).readonly()
14561
+ });
14562
+ method(_void(), array(FailureContributionSchema).readonly());
14334
14563
  var LoadContributionSchema = object({
14335
14564
  role: _enum([
14336
14565
  "decode",
@@ -18921,6 +19150,20 @@ var TrackSchema = object({
18921
19150
  * `=== true` and render nothing otherwise — never infer "no rider".
18922
19151
  */
18923
19152
  hasRider: boolean().optional(),
19153
+ /**
19154
+ * WHY this track ended without a NATIVE best-shot tile
19155
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
19156
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
19157
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
19158
+ * the late-keyFrame upgrade when a native tile lands after all. The
19159
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
19160
+ * tile is a face/plate stand-in, a raster crop, or an icon.
19161
+ *
19162
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
19163
+ * that predates the field, and every track whose tile landed native all
19164
+ * omit it. Render nothing when absent.
19165
+ */
19166
+ previewMissReason: string().optional(),
18924
19167
  ...TrackFlagFields,
18925
19168
  ...TrackRetrainFields
18926
19169
  });
@@ -30096,6 +30339,13 @@ var LoggingSettingsPatchSchema = object({
30096
30339
  * anyone but its owner.
30097
30340
  */
30098
30341
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
30342
+ /**
30343
+ * One per-camera failure counter, plus WHO reported it.
30344
+ *
30345
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30346
+ * the hub as it enumerates providers, never by the contributor.
30347
+ */
30348
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
30099
30349
  var GetLoggingSettingsInputSchema = object({
30100
30350
  scopeNodeId: string().optional(),
30101
30351
  /**
@@ -30154,7 +30404,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
30154
30404
  }), method(_void(), SiteLocationStatusSchema, {
30155
30405
  kind: "mutation",
30156
30406
  auth: "admin"
30157
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30407
+ }), 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, {
30158
30408
  kind: "mutation",
30159
30409
  auth: "admin"
30160
30410
  });
@@ -32476,6 +32726,12 @@ Object.freeze({
32476
32726
  addonId: null,
32477
32727
  access: "view"
32478
32728
  },
32729
+ "addonSettings.getIntegrationSettings": {
32730
+ capName: "addon-settings",
32731
+ capScope: "system",
32732
+ addonId: null,
32733
+ access: "view"
32734
+ },
32479
32735
  "addonSettings.updateDeviceSettings": {
32480
32736
  capName: "addon-settings",
32481
32737
  capScope: "system",
@@ -34138,6 +34394,12 @@ Object.freeze({
34138
34394
  addonId: null,
34139
34395
  access: "create"
34140
34396
  },
34397
+ "failureContribution.list": {
34398
+ capName: "failure-contribution",
34399
+ capScope: "system",
34400
+ addonId: null,
34401
+ access: "view"
34402
+ },
34141
34403
  "fanControl.setDirection": {
34142
34404
  capName: "fan-control",
34143
34405
  capScope: "device",
@@ -37444,6 +37706,12 @@ Object.freeze({
37444
37706
  addonId: null,
37445
37707
  access: "create"
37446
37708
  },
37709
+ "system.getFailureContributions": {
37710
+ capName: "system",
37711
+ capScope: "system",
37712
+ addonId: null,
37713
+ access: "view"
37714
+ },
37447
37715
  "system.getLoadContributions": {
37448
37716
  capName: "system",
37449
37717
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -6900,6 +6900,40 @@ var BaseAddon = class {
6900
6900
  deviceSettingsSchema() {
6901
6901
  return null;
6902
6902
  }
6903
+ /**
6904
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
6905
+ * ARE the configuration of its integration.
6906
+ *
6907
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
6908
+ * operator should find on the addon's integration page (System →
6909
+ * Integrations → <name>) rather than only in the cluster-wide list of every
6910
+ * addon. Empty (the default) means the addon has no integration-level
6911
+ * settings and no such surface is offered — this is opt-in, because whether
6912
+ * an addon's configuration IS its integration's configuration depends on the
6913
+ * nature of the integration.
6914
+ *
6915
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
6916
+ * the ONE global schema, in the ONE addon store, written by the ONE
6917
+ * `updateGlobalSettings` path. There is deliberately no
6918
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
6919
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
6920
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
6921
+ *
6922
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
6923
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
6924
+ * removed with the reason recorded at
6925
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
6926
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
6927
+ * marker sprinkled across sections also has to borrow a field that already
6928
+ * means something else; borrowing `section.tab` put the literal word
6929
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
6930
+ * GROUP this visually" and cannot also mean "where this lives" (D269
6931
+ * supersedes D268). One declaration, in one place, next to the schema whose
6932
+ * ids it names.
6933
+ */
6934
+ integrationSettingSections() {
6935
+ return [];
6936
+ }
6903
6937
  async getGlobalSettings(overlay, cap, nodeId) {
6904
6938
  const schema = this.globalSettingsSchema(cap);
6905
6939
  if (!schema) return { sections: [] };
@@ -6910,6 +6944,55 @@ var BaseAddon = class {
6910
6944
  } : projected);
6911
6945
  }
6912
6946
  /**
6947
+ * The integration-level view of this addon's settings: exactly the sections
6948
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
6949
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
6950
+ *
6951
+ * Returns `null` when the addon declared nothing — an addon that opts out has
6952
+ * no integration settings surface at all, rather than an empty one that reads
6953
+ * as a failed load.
6954
+ *
6955
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
6956
+ * and not in whichever UI happens to render this:
6957
+ *
6958
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
6959
+ * shown here is the same field, with the same bare key, that the addon's
6960
+ * own page shows. There is no integration-specific writer — callers save
6961
+ * through `updateGlobalSettings` — so a second store key is unreachable,
6962
+ * not merely discouraged.
6963
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
6964
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
6965
+ * such a field silently picked would be a wrong answer for the operator
6966
+ * who opened the page (D266).
6967
+ * 3. **No silent typo.** A declared id that names no section throws. The
6968
+ * alternative — skip it — turns a rename into a surface that quietly
6969
+ * empties, which looks exactly like an addon with nothing to configure.
6970
+ */
6971
+ async getIntegrationSettings(nodeId) {
6972
+ const declared = this.integrationSettingSections();
6973
+ if (declared.length === 0) return null;
6974
+ const schema = this.globalSettingsSchema();
6975
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
6976
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
6977
+ const sections = [];
6978
+ for (const id of declared) {
6979
+ const section = byId.get(id);
6980
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6981
+ const fields = dropPerNodeFields(section.fields);
6982
+ if (fields.length === 0) continue;
6983
+ sections.push({
6984
+ ...section,
6985
+ fields
6986
+ });
6987
+ }
6988
+ if (sections.length === 0) return null;
6989
+ const projected = await this.resolveGlobalStore(nodeId);
6990
+ return hydrateSchema({
6991
+ ...schema,
6992
+ sections
6993
+ }, projected);
6994
+ }
6995
+ /**
6913
6996
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
6914
6997
  * every `perNode: true` field carries THAT node's scoped value on its bare
6915
6998
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -7213,6 +7296,41 @@ var BaseAddon = class {
7213
7296
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
7214
7297
  * don't declare `perNode` and are excluded by the `in` narrowing.
7215
7298
  */
7299
+ /**
7300
+ * The same fields with every `perNode: true` one removed, recursing into layout
7301
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
7302
+ * with no child is dropped rather than rendered empty.
7303
+ *
7304
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
7305
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
7306
+ */
7307
+ function dropPerNodeFields(fields) {
7308
+ const kept = [];
7309
+ for (const field of fields) {
7310
+ if (field.type === "group") {
7311
+ const inner = dropPerNodeFields(field.fields);
7312
+ if (inner.length > 0) kept.push({
7313
+ ...field,
7314
+ fields: inner
7315
+ });
7316
+ continue;
7317
+ }
7318
+ if (field.type === "sub-tabs") {
7319
+ const tabs = field.tabs.map((tab) => ({
7320
+ ...tab,
7321
+ fields: dropPerNodeFields(tab.fields)
7322
+ })).filter((tab) => tab.fields.length > 0);
7323
+ if (tabs.length > 0) kept.push({
7324
+ ...field,
7325
+ tabs
7326
+ });
7327
+ continue;
7328
+ }
7329
+ if ("perNode" in field && field.perNode === true) continue;
7330
+ kept.push(field);
7331
+ }
7332
+ return kept;
7333
+ }
7216
7334
  function collectPerNodeFieldKeys(fields) {
7217
7335
  const collected = [];
7218
7336
  for (const field of fields) {
@@ -10382,6 +10500,9 @@ method(object({
10382
10500
  kind: "mutation",
10383
10501
  auth: "admin"
10384
10502
  }), method(object({
10503
+ addonId: string(),
10504
+ nodeId: string().optional()
10505
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
10385
10506
  addonId: string(),
10386
10507
  deviceId: number(),
10387
10508
  nodeId: string().optional()
@@ -14330,6 +14451,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14330
14451
  limit: number().optional(),
14331
14452
  tags: record(string(), string()).optional()
14332
14453
  }), array(LogEntrySchema).readonly());
14454
+ /**
14455
+ * `failure-contribution` — the capability an addon reports its OWN losses
14456
+ * through, per camera, with the denominator attached. It stores nothing.
14457
+ *
14458
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
14459
+ *
14460
+ * `load-contribution` answers *what did this camera COST*. This answers *what
14461
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
14462
+ * copied: the contributor reports what it already knows, hub-main adds only
14463
+ * `addonId`, nothing needs global knowledge, and there is no central list for
14464
+ * somebody to forget to edit.
14465
+ *
14466
+ * They are not merged, because their invariants are opposites:
14467
+ *
14468
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
14469
+ * claim a camera cost nothing, which is a measurement nobody made;
14470
+ * - a `failure-contribution` zero is the **most valuable value on the
14471
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14472
+ * and it is exactly what an absent entry cannot say.
14473
+ *
14474
+ * Putting a loss counter on a cost entry would also break the reconciliation
14475
+ * that gives `load-contribution` its point: contributions are subtracted from
14476
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14477
+ * has no process.
14478
+ *
14479
+ * ## Why not a log line, since the counters already exist
14480
+ *
14481
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
14482
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14483
+ * ends in a log line, and a log line is the thing the operator asked to stop
14484
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14485
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14486
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14487
+ * media blackout were both diagnosed. The counters stay; this is where they can
14488
+ * be READ.
14489
+ *
14490
+ * ## The rate is served with its denominator or not at all
14491
+ *
14492
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
14493
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14494
+ * than yesterday" and was **flat across twelve hours** once divided by the
14495
+ * successes on the same path. A surface that publishes only the numerator
14496
+ * reproduces that mistake on every read.
14497
+ *
14498
+ * ## Shape
14499
+ *
14500
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14501
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14502
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14503
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14504
+ * a forked runner's entries reach hub-main over transport that already exists.
14505
+ * No new UDS message, no second registry (D3). The operator reads the assembled
14506
+ * result through `system.getFailureContributions`.
14507
+ */
14508
+ var FailureReasonCountSchema = object({
14509
+ /**
14510
+ * Why the attempt did not land, in the contributor's own vocabulary —
14511
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14512
+ * strings that already appear in this repo's logs and, where one exists, the
14513
+ * same string the per-track `previewMissReason` records (D276): a second
14514
+ * vocabulary for the same loss would make the row and the counter
14515
+ * un-joinable.
14516
+ */
14517
+ reason: string(),
14518
+ count: number().int().nonnegative()
14519
+ });
14520
+ var FailureContributionSchema = object({
14521
+ /**
14522
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14523
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14524
+ * `unit` free: the families are owned by different addons and a shared enum
14525
+ * is a central list that rots invisibly.
14526
+ */
14527
+ family: string(),
14528
+ /**
14529
+ * The NUMERIC device id — the same value every log line carries as
14530
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
14531
+ * cannot name the camera must not emit the entry, because a fleet total
14532
+ * cannot answer the only question anybody asks of this surface.
14533
+ */
14534
+ deviceId: number().int().positive(),
14535
+ /**
14536
+ * A second dimension inside the family: the model / step id for an inference
14537
+ * timeout, so "which camera AND which model" is one read. Absent when the
14538
+ * family has a single variant.
14539
+ */
14540
+ variant: string().optional(),
14541
+ /**
14542
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14543
+ * differencing two reads must drop the interval when it changes, because the
14544
+ * counter restarted from zero in a respawned runner. Same discipline as
14545
+ * `LoadContribution.startedAtMs`.
14546
+ */
14547
+ sinceMs: number(),
14548
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14549
+ atMs: number(),
14550
+ /**
14551
+ * THE DENOMINATOR — every attempt on this path for this camera in the
14552
+ * window. A failure count published without it is the mistake this schema
14553
+ * exists to make impossible.
14554
+ */
14555
+ attempts: number().int().nonnegative(),
14556
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
14557
+ succeeded: number().int().nonnegative(),
14558
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
14559
+ reasons: array(FailureReasonCountSchema).readonly()
14560
+ });
14561
+ method(_void(), array(FailureContributionSchema).readonly());
14333
14562
  var LoadContributionSchema = object({
14334
14563
  role: _enum([
14335
14564
  "decode",
@@ -18920,6 +19149,20 @@ var TrackSchema = object({
18920
19149
  * `=== true` and render nothing otherwise — never infer "no rider".
18921
19150
  */
18922
19151
  hasRider: boolean().optional(),
19152
+ /**
19153
+ * WHY this track ended without a NATIVE best-shot tile
19154
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
19155
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
19156
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
19157
+ * the late-keyFrame upgrade when a native tile lands after all. The
19158
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
19159
+ * tile is a face/plate stand-in, a raster crop, or an icon.
19160
+ *
19161
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
19162
+ * that predates the field, and every track whose tile landed native all
19163
+ * omit it. Render nothing when absent.
19164
+ */
19165
+ previewMissReason: string().optional(),
18923
19166
  ...TrackFlagFields,
18924
19167
  ...TrackRetrainFields
18925
19168
  });
@@ -30095,6 +30338,13 @@ var LoggingSettingsPatchSchema = object({
30095
30338
  * anyone but its owner.
30096
30339
  */
30097
30340
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
30341
+ /**
30342
+ * One per-camera failure counter, plus WHO reported it.
30343
+ *
30344
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30345
+ * the hub as it enumerates providers, never by the contributor.
30346
+ */
30347
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
30098
30348
  var GetLoggingSettingsInputSchema = object({
30099
30349
  scopeNodeId: string().optional(),
30100
30350
  /**
@@ -30153,7 +30403,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
30153
30403
  }), method(_void(), SiteLocationStatusSchema, {
30154
30404
  kind: "mutation",
30155
30405
  auth: "admin"
30156
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30406
+ }), 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, {
30157
30407
  kind: "mutation",
30158
30408
  auth: "admin"
30159
30409
  });
@@ -32475,6 +32725,12 @@ Object.freeze({
32475
32725
  addonId: null,
32476
32726
  access: "view"
32477
32727
  },
32728
+ "addonSettings.getIntegrationSettings": {
32729
+ capName: "addon-settings",
32730
+ capScope: "system",
32731
+ addonId: null,
32732
+ access: "view"
32733
+ },
32478
32734
  "addonSettings.updateDeviceSettings": {
32479
32735
  capName: "addon-settings",
32480
32736
  capScope: "system",
@@ -34137,6 +34393,12 @@ Object.freeze({
34137
34393
  addonId: null,
34138
34394
  access: "create"
34139
34395
  },
34396
+ "failureContribution.list": {
34397
+ capName: "failure-contribution",
34398
+ capScope: "system",
34399
+ addonId: null,
34400
+ access: "view"
34401
+ },
34140
34402
  "fanControl.setDirection": {
34141
34403
  capName: "fan-control",
34142
34404
  capScope: "device",
@@ -37443,6 +37705,12 @@ Object.freeze({
37443
37705
  addonId: null,
37444
37706
  access: "create"
37445
37707
  },
37708
+ "system.getFailureContributions": {
37709
+ capName: "system",
37710
+ capScope: "system",
37711
+ addonId: null,
37712
+ access: "view"
37713
+ },
37446
37714
  "system.getLoadContributions": {
37447
37715
  capName: "system",
37448
37716
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-rademacher",
3
- "version": "0.2.36",
3
+ "version": "0.2.38",
4
4
  "description": "Rademacher HomePilot device-provider addon for CamStack — wraps the @apocaliss92/noderademacher local-hub client (roller shutters over the cover cap)",
5
5
  "keywords": [
6
6
  "camstack",