@camstack/addon-provider-dreame 0.2.37 → 0.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.
package/dist/addon.js CHANGED
@@ -56421,6 +56421,40 @@ var BaseAddon = class {
56421
56421
  deviceSettingsSchema() {
56422
56422
  return null;
56423
56423
  }
56424
+ /**
56425
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
56426
+ * ARE the configuration of its integration.
56427
+ *
56428
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
56429
+ * operator should find on the addon's integration page (System →
56430
+ * Integrations → <name>) rather than only in the cluster-wide list of every
56431
+ * addon. Empty (the default) means the addon has no integration-level
56432
+ * settings and no such surface is offered — this is opt-in, because whether
56433
+ * an addon's configuration IS its integration's configuration depends on the
56434
+ * nature of the integration.
56435
+ *
56436
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
56437
+ * the ONE global schema, in the ONE addon store, written by the ONE
56438
+ * `updateGlobalSettings` path. There is deliberately no
56439
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
56440
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
56441
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
56442
+ *
56443
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
56444
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
56445
+ * removed with the reason recorded at
56446
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
56447
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
56448
+ * marker sprinkled across sections also has to borrow a field that already
56449
+ * means something else; borrowing `section.tab` put the literal word
56450
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
56451
+ * GROUP this visually" and cannot also mean "where this lives" (D269
56452
+ * supersedes D268). One declaration, in one place, next to the schema whose
56453
+ * ids it names.
56454
+ */
56455
+ integrationSettingSections() {
56456
+ return [];
56457
+ }
56424
56458
  async getGlobalSettings(overlay, cap, nodeId) {
56425
56459
  const schema = this.globalSettingsSchema(cap);
56426
56460
  if (!schema) return { sections: [] };
@@ -56431,6 +56465,55 @@ var BaseAddon = class {
56431
56465
  } : projected);
56432
56466
  }
56433
56467
  /**
56468
+ * The integration-level view of this addon's settings: exactly the sections
56469
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
56470
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
56471
+ *
56472
+ * Returns `null` when the addon declared nothing — an addon that opts out has
56473
+ * no integration settings surface at all, rather than an empty one that reads
56474
+ * as a failed load.
56475
+ *
56476
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
56477
+ * and not in whichever UI happens to render this:
56478
+ *
56479
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
56480
+ * shown here is the same field, with the same bare key, that the addon's
56481
+ * own page shows. There is no integration-specific writer — callers save
56482
+ * through `updateGlobalSettings` — so a second store key is unreachable,
56483
+ * not merely discouraged.
56484
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
56485
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
56486
+ * such a field silently picked would be a wrong answer for the operator
56487
+ * who opened the page (D266).
56488
+ * 3. **No silent typo.** A declared id that names no section throws. The
56489
+ * alternative — skip it — turns a rename into a surface that quietly
56490
+ * empties, which looks exactly like an addon with nothing to configure.
56491
+ */
56492
+ async getIntegrationSettings(nodeId) {
56493
+ const declared = this.integrationSettingSections();
56494
+ if (declared.length === 0) return null;
56495
+ const schema = this.globalSettingsSchema();
56496
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
56497
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
56498
+ const sections = [];
56499
+ for (const id of declared) {
56500
+ const section = byId.get(id);
56501
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
56502
+ const fields = dropPerNodeFields(section.fields);
56503
+ if (fields.length === 0) continue;
56504
+ sections.push({
56505
+ ...section,
56506
+ fields
56507
+ });
56508
+ }
56509
+ if (sections.length === 0) return null;
56510
+ const projected = await this.resolveGlobalStore(nodeId);
56511
+ return hydrateSchema({
56512
+ ...schema,
56513
+ sections
56514
+ }, projected);
56515
+ }
56516
+ /**
56434
56517
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
56435
56518
  * every `perNode: true` field carries THAT node's scoped value on its bare
56436
56519
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -56734,6 +56817,41 @@ var BaseAddon = class {
56734
56817
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
56735
56818
  * don't declare `perNode` and are excluded by the `in` narrowing.
56736
56819
  */
56820
+ /**
56821
+ * The same fields with every `perNode: true` one removed, recursing into layout
56822
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
56823
+ * with no child is dropped rather than rendered empty.
56824
+ *
56825
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
56826
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
56827
+ */
56828
+ function dropPerNodeFields(fields) {
56829
+ const kept = [];
56830
+ for (const field of fields) {
56831
+ if (field.type === "group") {
56832
+ const inner = dropPerNodeFields(field.fields);
56833
+ if (inner.length > 0) kept.push({
56834
+ ...field,
56835
+ fields: inner
56836
+ });
56837
+ continue;
56838
+ }
56839
+ if (field.type === "sub-tabs") {
56840
+ const tabs = field.tabs.map((tab) => ({
56841
+ ...tab,
56842
+ fields: dropPerNodeFields(tab.fields)
56843
+ })).filter((tab) => tab.fields.length > 0);
56844
+ if (tabs.length > 0) kept.push({
56845
+ ...field,
56846
+ tabs
56847
+ });
56848
+ continue;
56849
+ }
56850
+ if ("perNode" in field && field.perNode === true) continue;
56851
+ kept.push(field);
56852
+ }
56853
+ return kept;
56854
+ }
56737
56855
  function collectPerNodeFieldKeys(fields) {
56738
56856
  const collected = [];
56739
56857
  for (const field of fields) {
@@ -59903,6 +60021,9 @@ method(object({
59903
60021
  kind: "mutation",
59904
60022
  auth: "admin"
59905
60023
  }), method(object({
60024
+ addonId: string(),
60025
+ nodeId: string().optional()
60026
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
59906
60027
  addonId: string(),
59907
60028
  deviceId: number(),
59908
60029
  nodeId: string().optional()
@@ -63868,6 +63989,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
63868
63989
  limit: number().optional(),
63869
63990
  tags: record(string(), string()).optional()
63870
63991
  }), array(LogEntrySchema).readonly());
63992
+ /**
63993
+ * `failure-contribution` — the capability an addon reports its OWN losses
63994
+ * through, per camera, with the denominator attached. It stores nothing.
63995
+ *
63996
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
63997
+ *
63998
+ * `load-contribution` answers *what did this camera COST*. This answers *what
63999
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
64000
+ * copied: the contributor reports what it already knows, hub-main adds only
64001
+ * `addonId`, nothing needs global knowledge, and there is no central list for
64002
+ * somebody to forget to edit.
64003
+ *
64004
+ * They are not merged, because their invariants are opposites:
64005
+ *
64006
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
64007
+ * claim a camera cost nothing, which is a measurement nobody made;
64008
+ * - a `failure-contribution` zero is the **most valuable value on the
64009
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
64010
+ * and it is exactly what an absent entry cannot say.
64011
+ *
64012
+ * Putting a loss counter on a cost entry would also break the reconciliation
64013
+ * that gives `load-contribution` its point: contributions are subtracted from
64014
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
64015
+ * has no process.
64016
+ *
64017
+ * ## Why not a log line, since the counters already exist
64018
+ *
64019
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
64020
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
64021
+ * ends in a log line, and a log line is the thing the operator asked to stop
64022
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
64023
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
64024
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
64025
+ * media blackout were both diagnosed. The counters stay; this is where they can
64026
+ * be READ.
64027
+ *
64028
+ * ## The rate is served with its denominator or not at all
64029
+ *
64030
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
64031
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
64032
+ * than yesterday" and was **flat across twelve hours** once divided by the
64033
+ * successes on the same path. A surface that publishes only the numerator
64034
+ * reproduces that mistake on every read.
64035
+ *
64036
+ * ## Shape
64037
+ *
64038
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
64039
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
64040
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
64041
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
64042
+ * a forked runner's entries reach hub-main over transport that already exists.
64043
+ * No new UDS message, no second registry (D3). The operator reads the assembled
64044
+ * result through `system.getFailureContributions`.
64045
+ */
64046
+ var FailureReasonCountSchema = object({
64047
+ /**
64048
+ * Why the attempt did not land, in the contributor's own vocabulary —
64049
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
64050
+ * strings that already appear in this repo's logs and, where one exists, the
64051
+ * same string the per-track `previewMissReason` records (D276): a second
64052
+ * vocabulary for the same loss would make the row and the counter
64053
+ * un-joinable.
64054
+ */
64055
+ reason: string(),
64056
+ count: number().int().nonnegative()
64057
+ });
64058
+ var FailureContributionSchema = object({
64059
+ /**
64060
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
64061
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
64062
+ * `unit` free: the families are owned by different addons and a shared enum
64063
+ * is a central list that rots invisibly.
64064
+ */
64065
+ family: string(),
64066
+ /**
64067
+ * The NUMERIC device id — the same value every log line carries as
64068
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
64069
+ * cannot name the camera must not emit the entry, because a fleet total
64070
+ * cannot answer the only question anybody asks of this surface.
64071
+ */
64072
+ deviceId: number().int().positive(),
64073
+ /**
64074
+ * A second dimension inside the family: the model / step id for an inference
64075
+ * timeout, so "which camera AND which model" is one read. Absent when the
64076
+ * family has a single variant.
64077
+ */
64078
+ variant: string().optional(),
64079
+ /**
64080
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
64081
+ * differencing two reads must drop the interval when it changes, because the
64082
+ * counter restarted from zero in a respawned runner. Same discipline as
64083
+ * `LoadContribution.startedAtMs`.
64084
+ */
64085
+ sinceMs: number(),
64086
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
64087
+ atMs: number(),
64088
+ /**
64089
+ * THE DENOMINATOR — every attempt on this path for this camera in the
64090
+ * window. A failure count published without it is the mistake this schema
64091
+ * exists to make impossible.
64092
+ */
64093
+ attempts: number().int().nonnegative(),
64094
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
64095
+ succeeded: number().int().nonnegative(),
64096
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
64097
+ reasons: array(FailureReasonCountSchema).readonly()
64098
+ });
64099
+ method(_void(), array(FailureContributionSchema).readonly());
63871
64100
  var LoadContributionSchema = object({
63872
64101
  role: _enum([
63873
64102
  "decode",
@@ -68458,6 +68687,20 @@ var TrackSchema = object({
68458
68687
  * `=== true` and render nothing otherwise — never infer "no rider".
68459
68688
  */
68460
68689
  hasRider: boolean().optional(),
68690
+ /**
68691
+ * WHY this track ended without a NATIVE best-shot tile
68692
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
68693
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
68694
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
68695
+ * the late-keyFrame upgrade when a native tile lands after all. The
68696
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
68697
+ * tile is a face/plate stand-in, a raster crop, or an icon.
68698
+ *
68699
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
68700
+ * that predates the field, and every track whose tile landed native all
68701
+ * omit it. Render nothing when absent.
68702
+ */
68703
+ previewMissReason: string().optional(),
68461
68704
  ...TrackFlagFields,
68462
68705
  ...TrackRetrainFields
68463
68706
  });
@@ -79658,6 +79901,13 @@ var LoggingSettingsPatchSchema = object({
79658
79901
  * anyone but its owner.
79659
79902
  */
79660
79903
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
79904
+ /**
79905
+ * One per-camera failure counter, plus WHO reported it.
79906
+ *
79907
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
79908
+ * the hub as it enumerates providers, never by the contributor.
79909
+ */
79910
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
79661
79911
  var GetLoggingSettingsInputSchema = object({
79662
79912
  scopeNodeId: string().optional(),
79663
79913
  /**
@@ -79716,7 +79966,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
79716
79966
  }), method(_void(), SiteLocationStatusSchema, {
79717
79967
  kind: "mutation",
79718
79968
  auth: "admin"
79719
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
79969
+ }), 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, {
79720
79970
  kind: "mutation",
79721
79971
  auth: "admin"
79722
79972
  });
@@ -82038,6 +82288,12 @@ Object.freeze({
82038
82288
  addonId: null,
82039
82289
  access: "view"
82040
82290
  },
82291
+ "addonSettings.getIntegrationSettings": {
82292
+ capName: "addon-settings",
82293
+ capScope: "system",
82294
+ addonId: null,
82295
+ access: "view"
82296
+ },
82041
82297
  "addonSettings.updateDeviceSettings": {
82042
82298
  capName: "addon-settings",
82043
82299
  capScope: "system",
@@ -83700,6 +83956,12 @@ Object.freeze({
83700
83956
  addonId: null,
83701
83957
  access: "create"
83702
83958
  },
83959
+ "failureContribution.list": {
83960
+ capName: "failure-contribution",
83961
+ capScope: "system",
83962
+ addonId: null,
83963
+ access: "view"
83964
+ },
83703
83965
  "fanControl.setDirection": {
83704
83966
  capName: "fan-control",
83705
83967
  capScope: "device",
@@ -87006,6 +87268,12 @@ Object.freeze({
87006
87268
  addonId: null,
87007
87269
  access: "create"
87008
87270
  },
87271
+ "system.getFailureContributions": {
87272
+ capName: "system",
87273
+ capScope: "system",
87274
+ addonId: null,
87275
+ access: "view"
87276
+ },
87009
87277
  "system.getLoadContributions": {
87010
87278
  capName: "system",
87011
87279
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -56421,6 +56421,40 @@ var BaseAddon = class {
56421
56421
  deviceSettingsSchema() {
56422
56422
  return null;
56423
56423
  }
56424
+ /**
56425
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
56426
+ * ARE the configuration of its integration.
56427
+ *
56428
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
56429
+ * operator should find on the addon's integration page (System →
56430
+ * Integrations → <name>) rather than only in the cluster-wide list of every
56431
+ * addon. Empty (the default) means the addon has no integration-level
56432
+ * settings and no such surface is offered — this is opt-in, because whether
56433
+ * an addon's configuration IS its integration's configuration depends on the
56434
+ * nature of the integration.
56435
+ *
56436
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
56437
+ * the ONE global schema, in the ONE addon store, written by the ONE
56438
+ * `updateGlobalSettings` path. There is deliberately no
56439
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
56440
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
56441
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
56442
+ *
56443
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
56444
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
56445
+ * removed with the reason recorded at
56446
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
56447
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
56448
+ * marker sprinkled across sections also has to borrow a field that already
56449
+ * means something else; borrowing `section.tab` put the literal word
56450
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
56451
+ * GROUP this visually" and cannot also mean "where this lives" (D269
56452
+ * supersedes D268). One declaration, in one place, next to the schema whose
56453
+ * ids it names.
56454
+ */
56455
+ integrationSettingSections() {
56456
+ return [];
56457
+ }
56424
56458
  async getGlobalSettings(overlay, cap, nodeId) {
56425
56459
  const schema = this.globalSettingsSchema(cap);
56426
56460
  if (!schema) return { sections: [] };
@@ -56431,6 +56465,55 @@ var BaseAddon = class {
56431
56465
  } : projected);
56432
56466
  }
56433
56467
  /**
56468
+ * The integration-level view of this addon's settings: exactly the sections
56469
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
56470
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
56471
+ *
56472
+ * Returns `null` when the addon declared nothing — an addon that opts out has
56473
+ * no integration settings surface at all, rather than an empty one that reads
56474
+ * as a failed load.
56475
+ *
56476
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
56477
+ * and not in whichever UI happens to render this:
56478
+ *
56479
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
56480
+ * shown here is the same field, with the same bare key, that the addon's
56481
+ * own page shows. There is no integration-specific writer — callers save
56482
+ * through `updateGlobalSettings` — so a second store key is unreachable,
56483
+ * not merely discouraged.
56484
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
56485
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
56486
+ * such a field silently picked would be a wrong answer for the operator
56487
+ * who opened the page (D266).
56488
+ * 3. **No silent typo.** A declared id that names no section throws. The
56489
+ * alternative — skip it — turns a rename into a surface that quietly
56490
+ * empties, which looks exactly like an addon with nothing to configure.
56491
+ */
56492
+ async getIntegrationSettings(nodeId) {
56493
+ const declared = this.integrationSettingSections();
56494
+ if (declared.length === 0) return null;
56495
+ const schema = this.globalSettingsSchema();
56496
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
56497
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
56498
+ const sections = [];
56499
+ for (const id of declared) {
56500
+ const section = byId.get(id);
56501
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
56502
+ const fields = dropPerNodeFields(section.fields);
56503
+ if (fields.length === 0) continue;
56504
+ sections.push({
56505
+ ...section,
56506
+ fields
56507
+ });
56508
+ }
56509
+ if (sections.length === 0) return null;
56510
+ const projected = await this.resolveGlobalStore(nodeId);
56511
+ return hydrateSchema({
56512
+ ...schema,
56513
+ sections
56514
+ }, projected);
56515
+ }
56516
+ /**
56434
56517
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
56435
56518
  * every `perNode: true` field carries THAT node's scoped value on its bare
56436
56519
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -56734,6 +56817,41 @@ var BaseAddon = class {
56734
56817
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
56735
56818
  * don't declare `perNode` and are excluded by the `in` narrowing.
56736
56819
  */
56820
+ /**
56821
+ * The same fields with every `perNode: true` one removed, recursing into layout
56822
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
56823
+ * with no child is dropped rather than rendered empty.
56824
+ *
56825
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
56826
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
56827
+ */
56828
+ function dropPerNodeFields(fields) {
56829
+ const kept = [];
56830
+ for (const field of fields) {
56831
+ if (field.type === "group") {
56832
+ const inner = dropPerNodeFields(field.fields);
56833
+ if (inner.length > 0) kept.push({
56834
+ ...field,
56835
+ fields: inner
56836
+ });
56837
+ continue;
56838
+ }
56839
+ if (field.type === "sub-tabs") {
56840
+ const tabs = field.tabs.map((tab) => ({
56841
+ ...tab,
56842
+ fields: dropPerNodeFields(tab.fields)
56843
+ })).filter((tab) => tab.fields.length > 0);
56844
+ if (tabs.length > 0) kept.push({
56845
+ ...field,
56846
+ tabs
56847
+ });
56848
+ continue;
56849
+ }
56850
+ if ("perNode" in field && field.perNode === true) continue;
56851
+ kept.push(field);
56852
+ }
56853
+ return kept;
56854
+ }
56737
56855
  function collectPerNodeFieldKeys(fields) {
56738
56856
  const collected = [];
56739
56857
  for (const field of fields) {
@@ -59903,6 +60021,9 @@ method(object({
59903
60021
  kind: "mutation",
59904
60022
  auth: "admin"
59905
60023
  }), method(object({
60024
+ addonId: string(),
60025
+ nodeId: string().optional()
60026
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
59906
60027
  addonId: string(),
59907
60028
  deviceId: number(),
59908
60029
  nodeId: string().optional()
@@ -63868,6 +63989,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
63868
63989
  limit: number().optional(),
63869
63990
  tags: record(string(), string()).optional()
63870
63991
  }), array(LogEntrySchema).readonly());
63992
+ /**
63993
+ * `failure-contribution` — the capability an addon reports its OWN losses
63994
+ * through, per camera, with the denominator attached. It stores nothing.
63995
+ *
63996
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
63997
+ *
63998
+ * `load-contribution` answers *what did this camera COST*. This answers *what
63999
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
64000
+ * copied: the contributor reports what it already knows, hub-main adds only
64001
+ * `addonId`, nothing needs global knowledge, and there is no central list for
64002
+ * somebody to forget to edit.
64003
+ *
64004
+ * They are not merged, because their invariants are opposites:
64005
+ *
64006
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
64007
+ * claim a camera cost nothing, which is a measurement nobody made;
64008
+ * - a `failure-contribution` zero is the **most valuable value on the
64009
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
64010
+ * and it is exactly what an absent entry cannot say.
64011
+ *
64012
+ * Putting a loss counter on a cost entry would also break the reconciliation
64013
+ * that gives `load-contribution` its point: contributions are subtracted from
64014
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
64015
+ * has no process.
64016
+ *
64017
+ * ## Why not a log line, since the counters already exist
64018
+ *
64019
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
64020
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
64021
+ * ends in a log line, and a log line is the thing the operator asked to stop
64022
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
64023
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
64024
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
64025
+ * media blackout were both diagnosed. The counters stay; this is where they can
64026
+ * be READ.
64027
+ *
64028
+ * ## The rate is served with its denominator or not at all
64029
+ *
64030
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
64031
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
64032
+ * than yesterday" and was **flat across twelve hours** once divided by the
64033
+ * successes on the same path. A surface that publishes only the numerator
64034
+ * reproduces that mistake on every read.
64035
+ *
64036
+ * ## Shape
64037
+ *
64038
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
64039
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
64040
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
64041
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
64042
+ * a forked runner's entries reach hub-main over transport that already exists.
64043
+ * No new UDS message, no second registry (D3). The operator reads the assembled
64044
+ * result through `system.getFailureContributions`.
64045
+ */
64046
+ var FailureReasonCountSchema = object({
64047
+ /**
64048
+ * Why the attempt did not land, in the contributor's own vocabulary —
64049
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
64050
+ * strings that already appear in this repo's logs and, where one exists, the
64051
+ * same string the per-track `previewMissReason` records (D276): a second
64052
+ * vocabulary for the same loss would make the row and the counter
64053
+ * un-joinable.
64054
+ */
64055
+ reason: string(),
64056
+ count: number().int().nonnegative()
64057
+ });
64058
+ var FailureContributionSchema = object({
64059
+ /**
64060
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
64061
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
64062
+ * `unit` free: the families are owned by different addons and a shared enum
64063
+ * is a central list that rots invisibly.
64064
+ */
64065
+ family: string(),
64066
+ /**
64067
+ * The NUMERIC device id — the same value every log line carries as
64068
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
64069
+ * cannot name the camera must not emit the entry, because a fleet total
64070
+ * cannot answer the only question anybody asks of this surface.
64071
+ */
64072
+ deviceId: number().int().positive(),
64073
+ /**
64074
+ * A second dimension inside the family: the model / step id for an inference
64075
+ * timeout, so "which camera AND which model" is one read. Absent when the
64076
+ * family has a single variant.
64077
+ */
64078
+ variant: string().optional(),
64079
+ /**
64080
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
64081
+ * differencing two reads must drop the interval when it changes, because the
64082
+ * counter restarted from zero in a respawned runner. Same discipline as
64083
+ * `LoadContribution.startedAtMs`.
64084
+ */
64085
+ sinceMs: number(),
64086
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
64087
+ atMs: number(),
64088
+ /**
64089
+ * THE DENOMINATOR — every attempt on this path for this camera in the
64090
+ * window. A failure count published without it is the mistake this schema
64091
+ * exists to make impossible.
64092
+ */
64093
+ attempts: number().int().nonnegative(),
64094
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
64095
+ succeeded: number().int().nonnegative(),
64096
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
64097
+ reasons: array(FailureReasonCountSchema).readonly()
64098
+ });
64099
+ method(_void(), array(FailureContributionSchema).readonly());
63871
64100
  var LoadContributionSchema = object({
63872
64101
  role: _enum([
63873
64102
  "decode",
@@ -68458,6 +68687,20 @@ var TrackSchema = object({
68458
68687
  * `=== true` and render nothing otherwise — never infer "no rider".
68459
68688
  */
68460
68689
  hasRider: boolean().optional(),
68690
+ /**
68691
+ * WHY this track ended without a NATIVE best-shot tile
68692
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
68693
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
68694
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
68695
+ * the late-keyFrame upgrade when a native tile lands after all. The
68696
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
68697
+ * tile is a face/plate stand-in, a raster crop, or an icon.
68698
+ *
68699
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
68700
+ * that predates the field, and every track whose tile landed native all
68701
+ * omit it. Render nothing when absent.
68702
+ */
68703
+ previewMissReason: string().optional(),
68461
68704
  ...TrackFlagFields,
68462
68705
  ...TrackRetrainFields
68463
68706
  });
@@ -79658,6 +79901,13 @@ var LoggingSettingsPatchSchema = object({
79658
79901
  * anyone but its owner.
79659
79902
  */
79660
79903
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
79904
+ /**
79905
+ * One per-camera failure counter, plus WHO reported it.
79906
+ *
79907
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
79908
+ * the hub as it enumerates providers, never by the contributor.
79909
+ */
79910
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
79661
79911
  var GetLoggingSettingsInputSchema = object({
79662
79912
  scopeNodeId: string().optional(),
79663
79913
  /**
@@ -79716,7 +79966,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
79716
79966
  }), method(_void(), SiteLocationStatusSchema, {
79717
79967
  kind: "mutation",
79718
79968
  auth: "admin"
79719
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
79969
+ }), 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, {
79720
79970
  kind: "mutation",
79721
79971
  auth: "admin"
79722
79972
  });
@@ -82038,6 +82288,12 @@ Object.freeze({
82038
82288
  addonId: null,
82039
82289
  access: "view"
82040
82290
  },
82291
+ "addonSettings.getIntegrationSettings": {
82292
+ capName: "addon-settings",
82293
+ capScope: "system",
82294
+ addonId: null,
82295
+ access: "view"
82296
+ },
82041
82297
  "addonSettings.updateDeviceSettings": {
82042
82298
  capName: "addon-settings",
82043
82299
  capScope: "system",
@@ -83700,6 +83956,12 @@ Object.freeze({
83700
83956
  addonId: null,
83701
83957
  access: "create"
83702
83958
  },
83959
+ "failureContribution.list": {
83960
+ capName: "failure-contribution",
83961
+ capScope: "system",
83962
+ addonId: null,
83963
+ access: "view"
83964
+ },
83703
83965
  "fanControl.setDirection": {
83704
83966
  capName: "fan-control",
83705
83967
  capScope: "device",
@@ -87006,6 +87268,12 @@ Object.freeze({
87006
87268
  addonId: null,
87007
87269
  access: "create"
87008
87270
  },
87271
+ "system.getFailureContributions": {
87272
+ capName: "system",
87273
+ capScope: "system",
87274
+ addonId: null,
87275
+ access: "view"
87276
+ },
87009
87277
  "system.getLoadContributions": {
87010
87278
  capName: "system",
87011
87279
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-dreame",
3
- "version": "0.2.37",
3
+ "version": "0.2.39",
4
4
  "description": "Dreame robot-vacuum / lawn-mower device-provider addon for CamStack — wraps the @apocaliss92/nodedreame Dreamehome cloud client",
5
5
  "keywords": [
6
6
  "camstack",