@camstack/addon-remote-storage 1.2.36 → 1.2.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/s3.addon.js CHANGED
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-CWzgutnW.js");
5
+ const require_shared = require("./shared-B9LrdyaK.js");
6
6
  let node_stream = require("node:stream");
7
7
  let _aws_sdk_client_s3 = require("@aws-sdk/client-s3");
8
8
  let _aws_sdk_lib_storage = require("@aws-sdk/lib-storage");
package/dist/s3.addon.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-AzvwyoO3.mjs";
1
+ import { c as BaseAddon, i as rearmIdleAbort, n as getOptionalBasePath, o as scheduleIdleAbort, s as storageProviderCapability, t as createSessionId } from "./shared-DgwL7dV-.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { DeleteObjectCommand, GetObjectCommand, HeadBucketCommand, HeadObjectCommand, ListObjectsV2Command, PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
4
  import { Upload } from "@aws-sdk/lib-storage";
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-CWzgutnW.js");
5
+ const require_shared = require("./shared-B9LrdyaK.js");
6
6
  let ssh2 = require("ssh2");
7
7
  let node_path = require("node:path");
8
8
  node_path = require_shared.__toESM(node_path);
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-AzvwyoO3.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DgwL7dV-.mjs";
2
2
  import { Client } from "ssh2";
3
3
  import * as path from "node:path";
4
4
  //#region src/providers/sftp/sftp-config-schema.ts
@@ -5940,6 +5940,40 @@ var BaseAddon = class {
5940
5940
  deviceSettingsSchema() {
5941
5941
  return null;
5942
5942
  }
5943
+ /**
5944
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5945
+ * ARE the configuration of its integration.
5946
+ *
5947
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5948
+ * operator should find on the addon's integration page (System →
5949
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5950
+ * addon. Empty (the default) means the addon has no integration-level
5951
+ * settings and no such surface is offered — this is opt-in, because whether
5952
+ * an addon's configuration IS its integration's configuration depends on the
5953
+ * nature of the integration.
5954
+ *
5955
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5956
+ * the ONE global schema, in the ONE addon store, written by the ONE
5957
+ * `updateGlobalSettings` path. There is deliberately no
5958
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5959
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5960
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5961
+ *
5962
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5963
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5964
+ * removed with the reason recorded at
5965
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5966
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5967
+ * marker sprinkled across sections also has to borrow a field that already
5968
+ * means something else; borrowing `section.tab` put the literal word
5969
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5970
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5971
+ * supersedes D268). One declaration, in one place, next to the schema whose
5972
+ * ids it names.
5973
+ */
5974
+ integrationSettingSections() {
5975
+ return [];
5976
+ }
5943
5977
  async getGlobalSettings(overlay, cap, nodeId) {
5944
5978
  const schema = this.globalSettingsSchema(cap);
5945
5979
  if (!schema) return { sections: [] };
@@ -5950,6 +5984,55 @@ var BaseAddon = class {
5950
5984
  } : projected);
5951
5985
  }
5952
5986
  /**
5987
+ * The integration-level view of this addon's settings: exactly the sections
5988
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5989
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5990
+ *
5991
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5992
+ * no integration settings surface at all, rather than an empty one that reads
5993
+ * as a failed load.
5994
+ *
5995
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5996
+ * and not in whichever UI happens to render this:
5997
+ *
5998
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5999
+ * shown here is the same field, with the same bare key, that the addon's
6000
+ * own page shows. There is no integration-specific writer — callers save
6001
+ * through `updateGlobalSettings` — so a second store key is unreachable,
6002
+ * not merely discouraged.
6003
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
6004
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
6005
+ * such a field silently picked would be a wrong answer for the operator
6006
+ * who opened the page (D266).
6007
+ * 3. **No silent typo.** A declared id that names no section throws. The
6008
+ * alternative — skip it — turns a rename into a surface that quietly
6009
+ * empties, which looks exactly like an addon with nothing to configure.
6010
+ */
6011
+ async getIntegrationSettings(nodeId) {
6012
+ const declared = this.integrationSettingSections();
6013
+ if (declared.length === 0) return null;
6014
+ const schema = this.globalSettingsSchema();
6015
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
6016
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
6017
+ const sections = [];
6018
+ for (const id of declared) {
6019
+ const section = byId.get(id);
6020
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
6021
+ const fields = dropPerNodeFields(section.fields);
6022
+ if (fields.length === 0) continue;
6023
+ sections.push({
6024
+ ...section,
6025
+ fields
6026
+ });
6027
+ }
6028
+ if (sections.length === 0) return null;
6029
+ const projected = await this.resolveGlobalStore(nodeId);
6030
+ return hydrateSchema({
6031
+ ...schema,
6032
+ sections
6033
+ }, projected);
6034
+ }
6035
+ /**
5953
6036
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5954
6037
  * every `perNode: true` field carries THAT node's scoped value on its bare
5955
6038
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6253,6 +6336,41 @@ var BaseAddon = class {
6253
6336
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6254
6337
  * don't declare `perNode` and are excluded by the `in` narrowing.
6255
6338
  */
6339
+ /**
6340
+ * The same fields with every `perNode: true` one removed, recursing into layout
6341
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6342
+ * with no child is dropped rather than rendered empty.
6343
+ *
6344
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6345
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6346
+ */
6347
+ function dropPerNodeFields(fields) {
6348
+ const kept = [];
6349
+ for (const field of fields) {
6350
+ if (field.type === "group") {
6351
+ const inner = dropPerNodeFields(field.fields);
6352
+ if (inner.length > 0) kept.push({
6353
+ ...field,
6354
+ fields: inner
6355
+ });
6356
+ continue;
6357
+ }
6358
+ if (field.type === "sub-tabs") {
6359
+ const tabs = field.tabs.map((tab) => ({
6360
+ ...tab,
6361
+ fields: dropPerNodeFields(tab.fields)
6362
+ })).filter((tab) => tab.fields.length > 0);
6363
+ if (tabs.length > 0) kept.push({
6364
+ ...field,
6365
+ tabs
6366
+ });
6367
+ continue;
6368
+ }
6369
+ if ("perNode" in field && field.perNode === true) continue;
6370
+ kept.push(field);
6371
+ }
6372
+ return kept;
6373
+ }
6256
6374
  function collectPerNodeFieldKeys(fields) {
6257
6375
  const collected = [];
6258
6376
  for (const field of fields) {
@@ -9406,6 +9524,9 @@ method(object({
9406
9524
  kind: "mutation",
9407
9525
  auth: "admin"
9408
9526
  }), method(object({
9527
+ addonId: string(),
9528
+ nodeId: string().optional()
9529
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9409
9530
  addonId: string(),
9410
9531
  deviceId: number(),
9411
9532
  nodeId: string().optional()
@@ -13090,6 +13211,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13090
13211
  limit: number().optional(),
13091
13212
  tags: record(string(), string()).optional()
13092
13213
  }), array(LogEntrySchema).readonly());
13214
+ /**
13215
+ * `failure-contribution` — the capability an addon reports its OWN losses
13216
+ * through, per camera, with the denominator attached. It stores nothing.
13217
+ *
13218
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13219
+ *
13220
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13221
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13222
+ * copied: the contributor reports what it already knows, hub-main adds only
13223
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13224
+ * somebody to forget to edit.
13225
+ *
13226
+ * They are not merged, because their invariants are opposites:
13227
+ *
13228
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13229
+ * claim a camera cost nothing, which is a measurement nobody made;
13230
+ * - a `failure-contribution` zero is the **most valuable value on the
13231
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13232
+ * and it is exactly what an absent entry cannot say.
13233
+ *
13234
+ * Putting a loss counter on a cost entry would also break the reconciliation
13235
+ * that gives `load-contribution` its point: contributions are subtracted from
13236
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13237
+ * has no process.
13238
+ *
13239
+ * ## Why not a log line, since the counters already exist
13240
+ *
13241
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13242
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13243
+ * ends in a log line, and a log line is the thing the operator asked to stop
13244
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13245
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13246
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13247
+ * media blackout were both diagnosed. The counters stay; this is where they can
13248
+ * be READ.
13249
+ *
13250
+ * ## The rate is served with its denominator or not at all
13251
+ *
13252
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13253
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13254
+ * than yesterday" and was **flat across twelve hours** once divided by the
13255
+ * successes on the same path. A surface that publishes only the numerator
13256
+ * reproduces that mistake on every read.
13257
+ *
13258
+ * ## Shape
13259
+ *
13260
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13261
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13262
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13263
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13264
+ * a forked runner's entries reach hub-main over transport that already exists.
13265
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13266
+ * result through `system.getFailureContributions`.
13267
+ */
13268
+ var FailureReasonCountSchema = object({
13269
+ /**
13270
+ * Why the attempt did not land, in the contributor's own vocabulary —
13271
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13272
+ * strings that already appear in this repo's logs and, where one exists, the
13273
+ * same string the per-track `previewMissReason` records (D276): a second
13274
+ * vocabulary for the same loss would make the row and the counter
13275
+ * un-joinable.
13276
+ */
13277
+ reason: string(),
13278
+ count: number().int().nonnegative()
13279
+ });
13280
+ var FailureContributionSchema = object({
13281
+ /**
13282
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13283
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13284
+ * `unit` free: the families are owned by different addons and a shared enum
13285
+ * is a central list that rots invisibly.
13286
+ */
13287
+ family: string(),
13288
+ /**
13289
+ * The NUMERIC device id — the same value every log line carries as
13290
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13291
+ * cannot name the camera must not emit the entry, because a fleet total
13292
+ * cannot answer the only question anybody asks of this surface.
13293
+ */
13294
+ deviceId: number().int().positive(),
13295
+ /**
13296
+ * A second dimension inside the family: the model / step id for an inference
13297
+ * timeout, so "which camera AND which model" is one read. Absent when the
13298
+ * family has a single variant.
13299
+ */
13300
+ variant: string().optional(),
13301
+ /**
13302
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13303
+ * differencing two reads must drop the interval when it changes, because the
13304
+ * counter restarted from zero in a respawned runner. Same discipline as
13305
+ * `LoadContribution.startedAtMs`.
13306
+ */
13307
+ sinceMs: number(),
13308
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13309
+ atMs: number(),
13310
+ /**
13311
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13312
+ * window. A failure count published without it is the mistake this schema
13313
+ * exists to make impossible.
13314
+ */
13315
+ attempts: number().int().nonnegative(),
13316
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13317
+ succeeded: number().int().nonnegative(),
13318
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13319
+ reasons: array(FailureReasonCountSchema).readonly()
13320
+ });
13321
+ method(_void(), array(FailureContributionSchema).readonly());
13093
13322
  var LoadContributionSchema = object({
13094
13323
  role: _enum([
13095
13324
  "decode",
@@ -17602,6 +17831,20 @@ var TrackSchema = object({
17602
17831
  * `=== true` and render nothing otherwise — never infer "no rider".
17603
17832
  */
17604
17833
  hasRider: boolean().optional(),
17834
+ /**
17835
+ * WHY this track ended without a NATIVE best-shot tile
17836
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17837
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17838
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17839
+ * the late-keyFrame upgrade when a native tile lands after all. The
17840
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17841
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17842
+ *
17843
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17844
+ * that predates the field, and every track whose tile landed native all
17845
+ * omit it. Render nothing when absent.
17846
+ */
17847
+ previewMissReason: string().optional(),
17605
17848
  ...TrackFlagFields,
17606
17849
  ...TrackRetrainFields
17607
17850
  });
@@ -26888,6 +27131,13 @@ var LoggingSettingsPatchSchema = object({
26888
27131
  * anyone but its owner.
26889
27132
  */
26890
27133
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27134
+ /**
27135
+ * One per-camera failure counter, plus WHO reported it.
27136
+ *
27137
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27138
+ * the hub as it enumerates providers, never by the contributor.
27139
+ */
27140
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26891
27141
  var GetLoggingSettingsInputSchema = object({
26892
27142
  scopeNodeId: string().optional(),
26893
27143
  /**
@@ -26946,7 +27196,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26946
27196
  }), method(_void(), SiteLocationStatusSchema, {
26947
27197
  kind: "mutation",
26948
27198
  auth: "admin"
26949
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27199
+ }), 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, {
26950
27200
  kind: "mutation",
26951
27201
  auth: "admin"
26952
27202
  });
@@ -27860,6 +28110,12 @@ Object.freeze({
27860
28110
  addonId: null,
27861
28111
  access: "view"
27862
28112
  },
28113
+ "addonSettings.getIntegrationSettings": {
28114
+ capName: "addon-settings",
28115
+ capScope: "system",
28116
+ addonId: null,
28117
+ access: "view"
28118
+ },
27863
28119
  "addonSettings.updateDeviceSettings": {
27864
28120
  capName: "addon-settings",
27865
28121
  capScope: "system",
@@ -29522,6 +29778,12 @@ Object.freeze({
29522
29778
  addonId: null,
29523
29779
  access: "create"
29524
29780
  },
29781
+ "failureContribution.list": {
29782
+ capName: "failure-contribution",
29783
+ capScope: "system",
29784
+ addonId: null,
29785
+ access: "view"
29786
+ },
29525
29787
  "fanControl.setDirection": {
29526
29788
  capName: "fan-control",
29527
29789
  capScope: "device",
@@ -32828,6 +33090,12 @@ Object.freeze({
32828
33090
  addonId: null,
32829
33091
  access: "create"
32830
33092
  },
33093
+ "system.getFailureContributions": {
33094
+ capName: "system",
33095
+ capScope: "system",
33096
+ addonId: null,
33097
+ access: "view"
33098
+ },
32831
33099
  "system.getLoadContributions": {
32832
33100
  capName: "system",
32833
33101
  capScope: "system",
@@ -5917,6 +5917,40 @@ var BaseAddon = class {
5917
5917
  deviceSettingsSchema() {
5918
5918
  return null;
5919
5919
  }
5920
+ /**
5921
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5922
+ * ARE the configuration of its integration.
5923
+ *
5924
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5925
+ * operator should find on the addon's integration page (System →
5926
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5927
+ * addon. Empty (the default) means the addon has no integration-level
5928
+ * settings and no such surface is offered — this is opt-in, because whether
5929
+ * an addon's configuration IS its integration's configuration depends on the
5930
+ * nature of the integration.
5931
+ *
5932
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5933
+ * the ONE global schema, in the ONE addon store, written by the ONE
5934
+ * `updateGlobalSettings` path. There is deliberately no
5935
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5936
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5937
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5938
+ *
5939
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5940
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5941
+ * removed with the reason recorded at
5942
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5943
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5944
+ * marker sprinkled across sections also has to borrow a field that already
5945
+ * means something else; borrowing `section.tab` put the literal word
5946
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5947
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5948
+ * supersedes D268). One declaration, in one place, next to the schema whose
5949
+ * ids it names.
5950
+ */
5951
+ integrationSettingSections() {
5952
+ return [];
5953
+ }
5920
5954
  async getGlobalSettings(overlay, cap, nodeId) {
5921
5955
  const schema = this.globalSettingsSchema(cap);
5922
5956
  if (!schema) return { sections: [] };
@@ -5927,6 +5961,55 @@ var BaseAddon = class {
5927
5961
  } : projected);
5928
5962
  }
5929
5963
  /**
5964
+ * The integration-level view of this addon's settings: exactly the sections
5965
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5966
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5967
+ *
5968
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5969
+ * no integration settings surface at all, rather than an empty one that reads
5970
+ * as a failed load.
5971
+ *
5972
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5973
+ * and not in whichever UI happens to render this:
5974
+ *
5975
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5976
+ * shown here is the same field, with the same bare key, that the addon's
5977
+ * own page shows. There is no integration-specific writer — callers save
5978
+ * through `updateGlobalSettings` — so a second store key is unreachable,
5979
+ * not merely discouraged.
5980
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
5981
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
5982
+ * such a field silently picked would be a wrong answer for the operator
5983
+ * who opened the page (D266).
5984
+ * 3. **No silent typo.** A declared id that names no section throws. The
5985
+ * alternative — skip it — turns a rename into a surface that quietly
5986
+ * empties, which looks exactly like an addon with nothing to configure.
5987
+ */
5988
+ async getIntegrationSettings(nodeId) {
5989
+ const declared = this.integrationSettingSections();
5990
+ if (declared.length === 0) return null;
5991
+ const schema = this.globalSettingsSchema();
5992
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
5993
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
5994
+ const sections = [];
5995
+ for (const id of declared) {
5996
+ const section = byId.get(id);
5997
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
5998
+ const fields = dropPerNodeFields(section.fields);
5999
+ if (fields.length === 0) continue;
6000
+ sections.push({
6001
+ ...section,
6002
+ fields
6003
+ });
6004
+ }
6005
+ if (sections.length === 0) return null;
6006
+ const projected = await this.resolveGlobalStore(nodeId);
6007
+ return hydrateSchema({
6008
+ ...schema,
6009
+ sections
6010
+ }, projected);
6011
+ }
6012
+ /**
5930
6013
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5931
6014
  * every `perNode: true` field carries THAT node's scoped value on its bare
5932
6015
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6230,6 +6313,41 @@ var BaseAddon = class {
6230
6313
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6231
6314
  * don't declare `perNode` and are excluded by the `in` narrowing.
6232
6315
  */
6316
+ /**
6317
+ * The same fields with every `perNode: true` one removed, recursing into layout
6318
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6319
+ * with no child is dropped rather than rendered empty.
6320
+ *
6321
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6322
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6323
+ */
6324
+ function dropPerNodeFields(fields) {
6325
+ const kept = [];
6326
+ for (const field of fields) {
6327
+ if (field.type === "group") {
6328
+ const inner = dropPerNodeFields(field.fields);
6329
+ if (inner.length > 0) kept.push({
6330
+ ...field,
6331
+ fields: inner
6332
+ });
6333
+ continue;
6334
+ }
6335
+ if (field.type === "sub-tabs") {
6336
+ const tabs = field.tabs.map((tab) => ({
6337
+ ...tab,
6338
+ fields: dropPerNodeFields(tab.fields)
6339
+ })).filter((tab) => tab.fields.length > 0);
6340
+ if (tabs.length > 0) kept.push({
6341
+ ...field,
6342
+ tabs
6343
+ });
6344
+ continue;
6345
+ }
6346
+ if ("perNode" in field && field.perNode === true) continue;
6347
+ kept.push(field);
6348
+ }
6349
+ return kept;
6350
+ }
6233
6351
  function collectPerNodeFieldKeys(fields) {
6234
6352
  const collected = [];
6235
6353
  for (const field of fields) {
@@ -9383,6 +9501,9 @@ method(object({
9383
9501
  kind: "mutation",
9384
9502
  auth: "admin"
9385
9503
  }), method(object({
9504
+ addonId: string(),
9505
+ nodeId: string().optional()
9506
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9386
9507
  addonId: string(),
9387
9508
  deviceId: number(),
9388
9509
  nodeId: string().optional()
@@ -13067,6 +13188,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13067
13188
  limit: number().optional(),
13068
13189
  tags: record(string(), string()).optional()
13069
13190
  }), array(LogEntrySchema).readonly());
13191
+ /**
13192
+ * `failure-contribution` — the capability an addon reports its OWN losses
13193
+ * through, per camera, with the denominator attached. It stores nothing.
13194
+ *
13195
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13196
+ *
13197
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13198
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13199
+ * copied: the contributor reports what it already knows, hub-main adds only
13200
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13201
+ * somebody to forget to edit.
13202
+ *
13203
+ * They are not merged, because their invariants are opposites:
13204
+ *
13205
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13206
+ * claim a camera cost nothing, which is a measurement nobody made;
13207
+ * - a `failure-contribution` zero is the **most valuable value on the
13208
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13209
+ * and it is exactly what an absent entry cannot say.
13210
+ *
13211
+ * Putting a loss counter on a cost entry would also break the reconciliation
13212
+ * that gives `load-contribution` its point: contributions are subtracted from
13213
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13214
+ * has no process.
13215
+ *
13216
+ * ## Why not a log line, since the counters already exist
13217
+ *
13218
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13219
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13220
+ * ends in a log line, and a log line is the thing the operator asked to stop
13221
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13222
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13223
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13224
+ * media blackout were both diagnosed. The counters stay; this is where they can
13225
+ * be READ.
13226
+ *
13227
+ * ## The rate is served with its denominator or not at all
13228
+ *
13229
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13230
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13231
+ * than yesterday" and was **flat across twelve hours** once divided by the
13232
+ * successes on the same path. A surface that publishes only the numerator
13233
+ * reproduces that mistake on every read.
13234
+ *
13235
+ * ## Shape
13236
+ *
13237
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13238
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13239
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13240
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13241
+ * a forked runner's entries reach hub-main over transport that already exists.
13242
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13243
+ * result through `system.getFailureContributions`.
13244
+ */
13245
+ var FailureReasonCountSchema = object({
13246
+ /**
13247
+ * Why the attempt did not land, in the contributor's own vocabulary —
13248
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13249
+ * strings that already appear in this repo's logs and, where one exists, the
13250
+ * same string the per-track `previewMissReason` records (D276): a second
13251
+ * vocabulary for the same loss would make the row and the counter
13252
+ * un-joinable.
13253
+ */
13254
+ reason: string(),
13255
+ count: number().int().nonnegative()
13256
+ });
13257
+ var FailureContributionSchema = object({
13258
+ /**
13259
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13260
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13261
+ * `unit` free: the families are owned by different addons and a shared enum
13262
+ * is a central list that rots invisibly.
13263
+ */
13264
+ family: string(),
13265
+ /**
13266
+ * The NUMERIC device id — the same value every log line carries as
13267
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13268
+ * cannot name the camera must not emit the entry, because a fleet total
13269
+ * cannot answer the only question anybody asks of this surface.
13270
+ */
13271
+ deviceId: number().int().positive(),
13272
+ /**
13273
+ * A second dimension inside the family: the model / step id for an inference
13274
+ * timeout, so "which camera AND which model" is one read. Absent when the
13275
+ * family has a single variant.
13276
+ */
13277
+ variant: string().optional(),
13278
+ /**
13279
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13280
+ * differencing two reads must drop the interval when it changes, because the
13281
+ * counter restarted from zero in a respawned runner. Same discipline as
13282
+ * `LoadContribution.startedAtMs`.
13283
+ */
13284
+ sinceMs: number(),
13285
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13286
+ atMs: number(),
13287
+ /**
13288
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13289
+ * window. A failure count published without it is the mistake this schema
13290
+ * exists to make impossible.
13291
+ */
13292
+ attempts: number().int().nonnegative(),
13293
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13294
+ succeeded: number().int().nonnegative(),
13295
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13296
+ reasons: array(FailureReasonCountSchema).readonly()
13297
+ });
13298
+ method(_void(), array(FailureContributionSchema).readonly());
13070
13299
  var LoadContributionSchema = object({
13071
13300
  role: _enum([
13072
13301
  "decode",
@@ -17579,6 +17808,20 @@ var TrackSchema = object({
17579
17808
  * `=== true` and render nothing otherwise — never infer "no rider".
17580
17809
  */
17581
17810
  hasRider: boolean().optional(),
17811
+ /**
17812
+ * WHY this track ended without a NATIVE best-shot tile
17813
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17814
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17815
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17816
+ * the late-keyFrame upgrade when a native tile lands after all. The
17817
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17818
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17819
+ *
17820
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17821
+ * that predates the field, and every track whose tile landed native all
17822
+ * omit it. Render nothing when absent.
17823
+ */
17824
+ previewMissReason: string().optional(),
17582
17825
  ...TrackFlagFields,
17583
17826
  ...TrackRetrainFields
17584
17827
  });
@@ -26865,6 +27108,13 @@ var LoggingSettingsPatchSchema = object({
26865
27108
  * anyone but its owner.
26866
27109
  */
26867
27110
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27111
+ /**
27112
+ * One per-camera failure counter, plus WHO reported it.
27113
+ *
27114
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27115
+ * the hub as it enumerates providers, never by the contributor.
27116
+ */
27117
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26868
27118
  var GetLoggingSettingsInputSchema = object({
26869
27119
  scopeNodeId: string().optional(),
26870
27120
  /**
@@ -26923,7 +27173,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26923
27173
  }), method(_void(), SiteLocationStatusSchema, {
26924
27174
  kind: "mutation",
26925
27175
  auth: "admin"
26926
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27176
+ }), 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, {
26927
27177
  kind: "mutation",
26928
27178
  auth: "admin"
26929
27179
  });
@@ -27837,6 +28087,12 @@ Object.freeze({
27837
28087
  addonId: null,
27838
28088
  access: "view"
27839
28089
  },
28090
+ "addonSettings.getIntegrationSettings": {
28091
+ capName: "addon-settings",
28092
+ capScope: "system",
28093
+ addonId: null,
28094
+ access: "view"
28095
+ },
27840
28096
  "addonSettings.updateDeviceSettings": {
27841
28097
  capName: "addon-settings",
27842
28098
  capScope: "system",
@@ -29499,6 +29755,12 @@ Object.freeze({
29499
29755
  addonId: null,
29500
29756
  access: "create"
29501
29757
  },
29758
+ "failureContribution.list": {
29759
+ capName: "failure-contribution",
29760
+ capScope: "system",
29761
+ addonId: null,
29762
+ access: "view"
29763
+ },
29502
29764
  "fanControl.setDirection": {
29503
29765
  capName: "fan-control",
29504
29766
  capScope: "device",
@@ -32805,6 +33067,12 @@ Object.freeze({
32805
33067
  addonId: null,
32806
33068
  access: "create"
32807
33069
  },
33070
+ "system.getFailureContributions": {
33071
+ capName: "system",
33072
+ capScope: "system",
33073
+ addonId: null,
33074
+ access: "view"
33075
+ },
32808
33076
  "system.getLoadContributions": {
32809
33077
  capName: "system",
32810
33078
  capScope: "system",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_shared = require("./shared-CWzgutnW.js");
5
+ const require_shared = require("./shared-B9LrdyaK.js");
6
6
  let node_stream = require("node:stream");
7
7
  let webdav = require("webdav");
8
8
  //#region src/providers/webdav/webdav-config-schema.ts
@@ -1,4 +1,4 @@
1
- import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-AzvwyoO3.mjs";
1
+ import { a as safeJoinRemotePath, c as BaseAddon, i as rearmIdleAbort, o as scheduleIdleAbort, r as getRequiredBasePath, s as storageProviderCapability, t as createSessionId } from "./shared-DgwL7dV-.mjs";
2
2
  import { PassThrough } from "node:stream";
3
3
  import { AuthType, createClient } from "webdav";
4
4
  //#region src/providers/webdav/webdav-config-schema.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-remote-storage",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "description": "Remote storage providers (SFTP, S3, WebDAV) — unifies remote backends behind the storage-provider cap",
5
5
  "keywords": [
6
6
  "camstack",