@camstack/addon-smtp-nodemailer 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.
@@ -5953,6 +5953,40 @@ var BaseAddon = class {
5953
5953
  deviceSettingsSchema() {
5954
5954
  return null;
5955
5955
  }
5956
+ /**
5957
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5958
+ * ARE the configuration of its integration.
5959
+ *
5960
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5961
+ * operator should find on the addon's integration page (System →
5962
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5963
+ * addon. Empty (the default) means the addon has no integration-level
5964
+ * settings and no such surface is offered — this is opt-in, because whether
5965
+ * an addon's configuration IS its integration's configuration depends on the
5966
+ * nature of the integration.
5967
+ *
5968
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5969
+ * the ONE global schema, in the ONE addon store, written by the ONE
5970
+ * `updateGlobalSettings` path. There is deliberately no
5971
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5972
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5973
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5974
+ *
5975
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5976
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5977
+ * removed with the reason recorded at
5978
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5979
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5980
+ * marker sprinkled across sections also has to borrow a field that already
5981
+ * means something else; borrowing `section.tab` put the literal word
5982
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5983
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5984
+ * supersedes D268). One declaration, in one place, next to the schema whose
5985
+ * ids it names.
5986
+ */
5987
+ integrationSettingSections() {
5988
+ return [];
5989
+ }
5956
5990
  async getGlobalSettings(overlay, cap, nodeId) {
5957
5991
  const schema = this.globalSettingsSchema(cap);
5958
5992
  if (!schema) return { sections: [] };
@@ -5963,6 +5997,55 @@ var BaseAddon = class {
5963
5997
  } : projected);
5964
5998
  }
5965
5999
  /**
6000
+ * The integration-level view of this addon's settings: exactly the sections
6001
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
6002
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
6003
+ *
6004
+ * Returns `null` when the addon declared nothing — an addon that opts out has
6005
+ * no integration settings surface at all, rather than an empty one that reads
6006
+ * as a failed load.
6007
+ *
6008
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
6009
+ * and not in whichever UI happens to render this:
6010
+ *
6011
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
6012
+ * shown here is the same field, with the same bare key, that the addon's
6013
+ * own page shows. There is no integration-specific writer — callers save
6014
+ * through `updateGlobalSettings` — so a second store key is unreachable,
6015
+ * not merely discouraged.
6016
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
6017
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
6018
+ * such a field silently picked would be a wrong answer for the operator
6019
+ * who opened the page (D266).
6020
+ * 3. **No silent typo.** A declared id that names no section throws. The
6021
+ * alternative — skip it — turns a rename into a surface that quietly
6022
+ * empties, which looks exactly like an addon with nothing to configure.
6023
+ */
6024
+ async getIntegrationSettings(nodeId) {
6025
+ const declared = this.integrationSettingSections();
6026
+ if (declared.length === 0) return null;
6027
+ const schema = this.globalSettingsSchema();
6028
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
6029
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
6030
+ const sections = [];
6031
+ for (const id of declared) {
6032
+ const section = byId.get(id);
6033
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6034
+ const fields = dropPerNodeFields(section.fields);
6035
+ if (fields.length === 0) continue;
6036
+ sections.push({
6037
+ ...section,
6038
+ fields
6039
+ });
6040
+ }
6041
+ if (sections.length === 0) return null;
6042
+ const projected = await this.resolveGlobalStore(nodeId);
6043
+ return hydrateSchema({
6044
+ ...schema,
6045
+ sections
6046
+ }, projected);
6047
+ }
6048
+ /**
5966
6049
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5967
6050
  * every `perNode: true` field carries THAT node's scoped value on its bare
5968
6051
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6266,6 +6349,41 @@ var BaseAddon = class {
6266
6349
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6267
6350
  * don't declare `perNode` and are excluded by the `in` narrowing.
6268
6351
  */
6352
+ /**
6353
+ * The same fields with every `perNode: true` one removed, recursing into layout
6354
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6355
+ * with no child is dropped rather than rendered empty.
6356
+ *
6357
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6358
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6359
+ */
6360
+ function dropPerNodeFields(fields) {
6361
+ const kept = [];
6362
+ for (const field of fields) {
6363
+ if (field.type === "group") {
6364
+ const inner = dropPerNodeFields(field.fields);
6365
+ if (inner.length > 0) kept.push({
6366
+ ...field,
6367
+ fields: inner
6368
+ });
6369
+ continue;
6370
+ }
6371
+ if (field.type === "sub-tabs") {
6372
+ const tabs = field.tabs.map((tab) => ({
6373
+ ...tab,
6374
+ fields: dropPerNodeFields(tab.fields)
6375
+ })).filter((tab) => tab.fields.length > 0);
6376
+ if (tabs.length > 0) kept.push({
6377
+ ...field,
6378
+ tabs
6379
+ });
6380
+ continue;
6381
+ }
6382
+ if ("perNode" in field && field.perNode === true) continue;
6383
+ kept.push(field);
6384
+ }
6385
+ return kept;
6386
+ }
6269
6387
  function collectPerNodeFieldKeys(fields) {
6270
6388
  const collected = [];
6271
6389
  for (const field of fields) {
@@ -9419,6 +9537,9 @@ method(object({
9419
9537
  kind: "mutation",
9420
9538
  auth: "admin"
9421
9539
  }), method(object({
9540
+ addonId: string(),
9541
+ nodeId: string().optional()
9542
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9422
9543
  addonId: string(),
9423
9544
  deviceId: number(),
9424
9545
  nodeId: string().optional()
@@ -13103,6 +13224,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13103
13224
  limit: number().optional(),
13104
13225
  tags: record(string(), string()).optional()
13105
13226
  }), array(LogEntrySchema).readonly());
13227
+ /**
13228
+ * `failure-contribution` — the capability an addon reports its OWN losses
13229
+ * through, per camera, with the denominator attached. It stores nothing.
13230
+ *
13231
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13232
+ *
13233
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13234
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13235
+ * copied: the contributor reports what it already knows, hub-main adds only
13236
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13237
+ * somebody to forget to edit.
13238
+ *
13239
+ * They are not merged, because their invariants are opposites:
13240
+ *
13241
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13242
+ * claim a camera cost nothing, which is a measurement nobody made;
13243
+ * - a `failure-contribution` zero is the **most valuable value on the
13244
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13245
+ * and it is exactly what an absent entry cannot say.
13246
+ *
13247
+ * Putting a loss counter on a cost entry would also break the reconciliation
13248
+ * that gives `load-contribution` its point: contributions are subtracted from
13249
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13250
+ * has no process.
13251
+ *
13252
+ * ## Why not a log line, since the counters already exist
13253
+ *
13254
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13255
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13256
+ * ends in a log line, and a log line is the thing the operator asked to stop
13257
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13258
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13259
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13260
+ * media blackout were both diagnosed. The counters stay; this is where they can
13261
+ * be READ.
13262
+ *
13263
+ * ## The rate is served with its denominator or not at all
13264
+ *
13265
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13266
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13267
+ * than yesterday" and was **flat across twelve hours** once divided by the
13268
+ * successes on the same path. A surface that publishes only the numerator
13269
+ * reproduces that mistake on every read.
13270
+ *
13271
+ * ## Shape
13272
+ *
13273
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13274
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13275
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13276
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13277
+ * a forked runner's entries reach hub-main over transport that already exists.
13278
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13279
+ * result through `system.getFailureContributions`.
13280
+ */
13281
+ var FailureReasonCountSchema = object({
13282
+ /**
13283
+ * Why the attempt did not land, in the contributor's own vocabulary —
13284
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13285
+ * strings that already appear in this repo's logs and, where one exists, the
13286
+ * same string the per-track `previewMissReason` records (D276): a second
13287
+ * vocabulary for the same loss would make the row and the counter
13288
+ * un-joinable.
13289
+ */
13290
+ reason: string(),
13291
+ count: number().int().nonnegative()
13292
+ });
13293
+ var FailureContributionSchema = object({
13294
+ /**
13295
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13296
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13297
+ * `unit` free: the families are owned by different addons and a shared enum
13298
+ * is a central list that rots invisibly.
13299
+ */
13300
+ family: string(),
13301
+ /**
13302
+ * The NUMERIC device id — the same value every log line carries as
13303
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13304
+ * cannot name the camera must not emit the entry, because a fleet total
13305
+ * cannot answer the only question anybody asks of this surface.
13306
+ */
13307
+ deviceId: number().int().positive(),
13308
+ /**
13309
+ * A second dimension inside the family: the model / step id for an inference
13310
+ * timeout, so "which camera AND which model" is one read. Absent when the
13311
+ * family has a single variant.
13312
+ */
13313
+ variant: string().optional(),
13314
+ /**
13315
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13316
+ * differencing two reads must drop the interval when it changes, because the
13317
+ * counter restarted from zero in a respawned runner. Same discipline as
13318
+ * `LoadContribution.startedAtMs`.
13319
+ */
13320
+ sinceMs: number(),
13321
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13322
+ atMs: number(),
13323
+ /**
13324
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13325
+ * window. A failure count published without it is the mistake this schema
13326
+ * exists to make impossible.
13327
+ */
13328
+ attempts: number().int().nonnegative(),
13329
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13330
+ succeeded: number().int().nonnegative(),
13331
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13332
+ reasons: array(FailureReasonCountSchema).readonly()
13333
+ });
13334
+ method(_void(), array(FailureContributionSchema).readonly());
13106
13335
  var LoadContributionSchema = object({
13107
13336
  role: _enum([
13108
13337
  "decode",
@@ -17615,6 +17844,20 @@ var TrackSchema = object({
17615
17844
  * `=== true` and render nothing otherwise — never infer "no rider".
17616
17845
  */
17617
17846
  hasRider: boolean().optional(),
17847
+ /**
17848
+ * WHY this track ended without a NATIVE best-shot tile
17849
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17850
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17851
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17852
+ * the late-keyFrame upgrade when a native tile lands after all. The
17853
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17854
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17855
+ *
17856
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17857
+ * that predates the field, and every track whose tile landed native all
17858
+ * omit it. Render nothing when absent.
17859
+ */
17860
+ previewMissReason: string().optional(),
17618
17861
  ...TrackFlagFields,
17619
17862
  ...TrackRetrainFields
17620
17863
  });
@@ -26854,6 +27097,13 @@ var LoggingSettingsPatchSchema = object({
26854
27097
  * anyone but its owner.
26855
27098
  */
26856
27099
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27100
+ /**
27101
+ * One per-camera failure counter, plus WHO reported it.
27102
+ *
27103
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27104
+ * the hub as it enumerates providers, never by the contributor.
27105
+ */
27106
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26857
27107
  var GetLoggingSettingsInputSchema = object({
26858
27108
  scopeNodeId: string().optional(),
26859
27109
  /**
@@ -26912,7 +27162,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26912
27162
  }), method(_void(), SiteLocationStatusSchema, {
26913
27163
  kind: "mutation",
26914
27164
  auth: "admin"
26915
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27165
+ }), 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, {
26916
27166
  kind: "mutation",
26917
27167
  auth: "admin"
26918
27168
  });
@@ -27826,6 +28076,12 @@ Object.freeze({
27826
28076
  addonId: null,
27827
28077
  access: "view"
27828
28078
  },
28079
+ "addonSettings.getIntegrationSettings": {
28080
+ capName: "addon-settings",
28081
+ capScope: "system",
28082
+ addonId: null,
28083
+ access: "view"
28084
+ },
27829
28085
  "addonSettings.updateDeviceSettings": {
27830
28086
  capName: "addon-settings",
27831
28087
  capScope: "system",
@@ -29488,6 +29744,12 @@ Object.freeze({
29488
29744
  addonId: null,
29489
29745
  access: "create"
29490
29746
  },
29747
+ "failureContribution.list": {
29748
+ capName: "failure-contribution",
29749
+ capScope: "system",
29750
+ addonId: null,
29751
+ access: "view"
29752
+ },
29491
29753
  "fanControl.setDirection": {
29492
29754
  capName: "fan-control",
29493
29755
  capScope: "device",
@@ -32794,6 +33056,12 @@ Object.freeze({
32794
33056
  addonId: null,
32795
33057
  access: "create"
32796
33058
  },
33059
+ "system.getFailureContributions": {
33060
+ capName: "system",
33061
+ capScope: "system",
33062
+ addonId: null,
33063
+ access: "view"
33064
+ },
32797
33065
  "system.getLoadContributions": {
32798
33066
  capName: "system",
32799
33067
  capScope: "system",
@@ -5951,6 +5951,40 @@ var BaseAddon = class {
5951
5951
  deviceSettingsSchema() {
5952
5952
  return null;
5953
5953
  }
5954
+ /**
5955
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5956
+ * ARE the configuration of its integration.
5957
+ *
5958
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5959
+ * operator should find on the addon's integration page (System →
5960
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5961
+ * addon. Empty (the default) means the addon has no integration-level
5962
+ * settings and no such surface is offered — this is opt-in, because whether
5963
+ * an addon's configuration IS its integration's configuration depends on the
5964
+ * nature of the integration.
5965
+ *
5966
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5967
+ * the ONE global schema, in the ONE addon store, written by the ONE
5968
+ * `updateGlobalSettings` path. There is deliberately no
5969
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5970
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5971
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5972
+ *
5973
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5974
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5975
+ * removed with the reason recorded at
5976
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5977
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5978
+ * marker sprinkled across sections also has to borrow a field that already
5979
+ * means something else; borrowing `section.tab` put the literal word
5980
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5981
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5982
+ * supersedes D268). One declaration, in one place, next to the schema whose
5983
+ * ids it names.
5984
+ */
5985
+ integrationSettingSections() {
5986
+ return [];
5987
+ }
5954
5988
  async getGlobalSettings(overlay, cap, nodeId) {
5955
5989
  const schema = this.globalSettingsSchema(cap);
5956
5990
  if (!schema) return { sections: [] };
@@ -5961,6 +5995,55 @@ var BaseAddon = class {
5961
5995
  } : projected);
5962
5996
  }
5963
5997
  /**
5998
+ * The integration-level view of this addon's settings: exactly the sections
5999
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
6000
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
6001
+ *
6002
+ * Returns `null` when the addon declared nothing — an addon that opts out has
6003
+ * no integration settings surface at all, rather than an empty one that reads
6004
+ * as a failed load.
6005
+ *
6006
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
6007
+ * and not in whichever UI happens to render this:
6008
+ *
6009
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
6010
+ * shown here is the same field, with the same bare key, that the addon's
6011
+ * own page shows. There is no integration-specific writer — callers save
6012
+ * through `updateGlobalSettings` — so a second store key is unreachable,
6013
+ * not merely discouraged.
6014
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
6015
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
6016
+ * such a field silently picked would be a wrong answer for the operator
6017
+ * who opened the page (D266).
6018
+ * 3. **No silent typo.** A declared id that names no section throws. The
6019
+ * alternative — skip it — turns a rename into a surface that quietly
6020
+ * empties, which looks exactly like an addon with nothing to configure.
6021
+ */
6022
+ async getIntegrationSettings(nodeId) {
6023
+ const declared = this.integrationSettingSections();
6024
+ if (declared.length === 0) return null;
6025
+ const schema = this.globalSettingsSchema();
6026
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
6027
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
6028
+ const sections = [];
6029
+ for (const id of declared) {
6030
+ const section = byId.get(id);
6031
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6032
+ const fields = dropPerNodeFields(section.fields);
6033
+ if (fields.length === 0) continue;
6034
+ sections.push({
6035
+ ...section,
6036
+ fields
6037
+ });
6038
+ }
6039
+ if (sections.length === 0) return null;
6040
+ const projected = await this.resolveGlobalStore(nodeId);
6041
+ return hydrateSchema({
6042
+ ...schema,
6043
+ sections
6044
+ }, projected);
6045
+ }
6046
+ /**
5964
6047
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5965
6048
  * every `perNode: true` field carries THAT node's scoped value on its bare
5966
6049
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6264,6 +6347,41 @@ var BaseAddon = class {
6264
6347
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6265
6348
  * don't declare `perNode` and are excluded by the `in` narrowing.
6266
6349
  */
6350
+ /**
6351
+ * The same fields with every `perNode: true` one removed, recursing into layout
6352
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6353
+ * with no child is dropped rather than rendered empty.
6354
+ *
6355
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6356
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6357
+ */
6358
+ function dropPerNodeFields(fields) {
6359
+ const kept = [];
6360
+ for (const field of fields) {
6361
+ if (field.type === "group") {
6362
+ const inner = dropPerNodeFields(field.fields);
6363
+ if (inner.length > 0) kept.push({
6364
+ ...field,
6365
+ fields: inner
6366
+ });
6367
+ continue;
6368
+ }
6369
+ if (field.type === "sub-tabs") {
6370
+ const tabs = field.tabs.map((tab) => ({
6371
+ ...tab,
6372
+ fields: dropPerNodeFields(tab.fields)
6373
+ })).filter((tab) => tab.fields.length > 0);
6374
+ if (tabs.length > 0) kept.push({
6375
+ ...field,
6376
+ tabs
6377
+ });
6378
+ continue;
6379
+ }
6380
+ if ("perNode" in field && field.perNode === true) continue;
6381
+ kept.push(field);
6382
+ }
6383
+ return kept;
6384
+ }
6267
6385
  function collectPerNodeFieldKeys(fields) {
6268
6386
  const collected = [];
6269
6387
  for (const field of fields) {
@@ -9417,6 +9535,9 @@ method(object({
9417
9535
  kind: "mutation",
9418
9536
  auth: "admin"
9419
9537
  }), method(object({
9538
+ addonId: string(),
9539
+ nodeId: string().optional()
9540
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9420
9541
  addonId: string(),
9421
9542
  deviceId: number(),
9422
9543
  nodeId: string().optional()
@@ -13101,6 +13222,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13101
13222
  limit: number().optional(),
13102
13223
  tags: record(string(), string()).optional()
13103
13224
  }), array(LogEntrySchema).readonly());
13225
+ /**
13226
+ * `failure-contribution` — the capability an addon reports its OWN losses
13227
+ * through, per camera, with the denominator attached. It stores nothing.
13228
+ *
13229
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13230
+ *
13231
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13232
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13233
+ * copied: the contributor reports what it already knows, hub-main adds only
13234
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13235
+ * somebody to forget to edit.
13236
+ *
13237
+ * They are not merged, because their invariants are opposites:
13238
+ *
13239
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13240
+ * claim a camera cost nothing, which is a measurement nobody made;
13241
+ * - a `failure-contribution` zero is the **most valuable value on the
13242
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13243
+ * and it is exactly what an absent entry cannot say.
13244
+ *
13245
+ * Putting a loss counter on a cost entry would also break the reconciliation
13246
+ * that gives `load-contribution` its point: contributions are subtracted from
13247
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13248
+ * has no process.
13249
+ *
13250
+ * ## Why not a log line, since the counters already exist
13251
+ *
13252
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13253
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13254
+ * ends in a log line, and a log line is the thing the operator asked to stop
13255
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13256
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13257
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13258
+ * media blackout were both diagnosed. The counters stay; this is where they can
13259
+ * be READ.
13260
+ *
13261
+ * ## The rate is served with its denominator or not at all
13262
+ *
13263
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13264
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13265
+ * than yesterday" and was **flat across twelve hours** once divided by the
13266
+ * successes on the same path. A surface that publishes only the numerator
13267
+ * reproduces that mistake on every read.
13268
+ *
13269
+ * ## Shape
13270
+ *
13271
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13272
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13273
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13274
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13275
+ * a forked runner's entries reach hub-main over transport that already exists.
13276
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13277
+ * result through `system.getFailureContributions`.
13278
+ */
13279
+ var FailureReasonCountSchema = object({
13280
+ /**
13281
+ * Why the attempt did not land, in the contributor's own vocabulary —
13282
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13283
+ * strings that already appear in this repo's logs and, where one exists, the
13284
+ * same string the per-track `previewMissReason` records (D276): a second
13285
+ * vocabulary for the same loss would make the row and the counter
13286
+ * un-joinable.
13287
+ */
13288
+ reason: string(),
13289
+ count: number().int().nonnegative()
13290
+ });
13291
+ var FailureContributionSchema = object({
13292
+ /**
13293
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13294
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13295
+ * `unit` free: the families are owned by different addons and a shared enum
13296
+ * is a central list that rots invisibly.
13297
+ */
13298
+ family: string(),
13299
+ /**
13300
+ * The NUMERIC device id — the same value every log line carries as
13301
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13302
+ * cannot name the camera must not emit the entry, because a fleet total
13303
+ * cannot answer the only question anybody asks of this surface.
13304
+ */
13305
+ deviceId: number().int().positive(),
13306
+ /**
13307
+ * A second dimension inside the family: the model / step id for an inference
13308
+ * timeout, so "which camera AND which model" is one read. Absent when the
13309
+ * family has a single variant.
13310
+ */
13311
+ variant: string().optional(),
13312
+ /**
13313
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13314
+ * differencing two reads must drop the interval when it changes, because the
13315
+ * counter restarted from zero in a respawned runner. Same discipline as
13316
+ * `LoadContribution.startedAtMs`.
13317
+ */
13318
+ sinceMs: number(),
13319
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13320
+ atMs: number(),
13321
+ /**
13322
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13323
+ * window. A failure count published without it is the mistake this schema
13324
+ * exists to make impossible.
13325
+ */
13326
+ attempts: number().int().nonnegative(),
13327
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13328
+ succeeded: number().int().nonnegative(),
13329
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13330
+ reasons: array(FailureReasonCountSchema).readonly()
13331
+ });
13332
+ method(_void(), array(FailureContributionSchema).readonly());
13104
13333
  var LoadContributionSchema = object({
13105
13334
  role: _enum([
13106
13335
  "decode",
@@ -17613,6 +17842,20 @@ var TrackSchema = object({
17613
17842
  * `=== true` and render nothing otherwise — never infer "no rider".
17614
17843
  */
17615
17844
  hasRider: boolean().optional(),
17845
+ /**
17846
+ * WHY this track ended without a NATIVE best-shot tile
17847
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17848
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17849
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17850
+ * the late-keyFrame upgrade when a native tile lands after all. The
17851
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17852
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17853
+ *
17854
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17855
+ * that predates the field, and every track whose tile landed native all
17856
+ * omit it. Render nothing when absent.
17857
+ */
17858
+ previewMissReason: string().optional(),
17616
17859
  ...TrackFlagFields,
17617
17860
  ...TrackRetrainFields
17618
17861
  });
@@ -26852,6 +27095,13 @@ var LoggingSettingsPatchSchema = object({
26852
27095
  * anyone but its owner.
26853
27096
  */
26854
27097
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27098
+ /**
27099
+ * One per-camera failure counter, plus WHO reported it.
27100
+ *
27101
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27102
+ * the hub as it enumerates providers, never by the contributor.
27103
+ */
27104
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26855
27105
  var GetLoggingSettingsInputSchema = object({
26856
27106
  scopeNodeId: string().optional(),
26857
27107
  /**
@@ -26910,7 +27160,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26910
27160
  }), method(_void(), SiteLocationStatusSchema, {
26911
27161
  kind: "mutation",
26912
27162
  auth: "admin"
26913
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27163
+ }), 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, {
26914
27164
  kind: "mutation",
26915
27165
  auth: "admin"
26916
27166
  });
@@ -27824,6 +28074,12 @@ Object.freeze({
27824
28074
  addonId: null,
27825
28075
  access: "view"
27826
28076
  },
28077
+ "addonSettings.getIntegrationSettings": {
28078
+ capName: "addon-settings",
28079
+ capScope: "system",
28080
+ addonId: null,
28081
+ access: "view"
28082
+ },
27827
28083
  "addonSettings.updateDeviceSettings": {
27828
28084
  capName: "addon-settings",
27829
28085
  capScope: "system",
@@ -29486,6 +29742,12 @@ Object.freeze({
29486
29742
  addonId: null,
29487
29743
  access: "create"
29488
29744
  },
29745
+ "failureContribution.list": {
29746
+ capName: "failure-contribution",
29747
+ capScope: "system",
29748
+ addonId: null,
29749
+ access: "view"
29750
+ },
29489
29751
  "fanControl.setDirection": {
29490
29752
  capName: "fan-control",
29491
29753
  capScope: "device",
@@ -32792,6 +33054,12 @@ Object.freeze({
32792
33054
  addonId: null,
32793
33055
  access: "create"
32794
33056
  },
33057
+ "system.getFailureContributions": {
33058
+ capName: "system",
33059
+ capScope: "system",
33060
+ addonId: null,
33061
+ access: "view"
33062
+ },
32795
33063
  "system.getLoadContributions": {
32796
33064
  capName: "system",
32797
33065
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-smtp-nodemailer",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "description": "SMTP email provider addon for CamStack — wraps `nodemailer` and registers a `smtp-provider` cap collection entry. Used by magic-link login + notifier addons.",
5
5
  "keywords": [
6
6
  "camstack",