@camstack/addon-tailscale 1.2.37 → 1.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.
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  enumerable: true
25
25
  }) : target, mod));
26
26
  //#endregion
27
- const require_dist = require("../dist-oQYtf-HC.js");
27
+ const require_dist = require("../dist-DXDI20wF.js");
28
28
  let node_child_process = require("node:child_process");
29
29
  let node_util = require("node:util");
30
30
  let node_fs = require("node:fs");
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-BBoke9_u.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability, r as BOOT_RECOVERY_BACKOFF_MS, t as meshNetworkCapability } from "../dist-CNu9kGot.mjs";
2
2
  import { execFile, spawn } from "node:child_process";
3
3
  import { promisify } from "node:util";
4
4
  import * as fs from "node:fs";
@@ -5915,6 +5915,40 @@ var BaseAddon = class {
5915
5915
  deviceSettingsSchema() {
5916
5916
  return null;
5917
5917
  }
5918
+ /**
5919
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5920
+ * ARE the configuration of its integration.
5921
+ *
5922
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5923
+ * operator should find on the addon's integration page (System →
5924
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5925
+ * addon. Empty (the default) means the addon has no integration-level
5926
+ * settings and no such surface is offered — this is opt-in, because whether
5927
+ * an addon's configuration IS its integration's configuration depends on the
5928
+ * nature of the integration.
5929
+ *
5930
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5931
+ * the ONE global schema, in the ONE addon store, written by the ONE
5932
+ * `updateGlobalSettings` path. There is deliberately no
5933
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5934
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5935
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5936
+ *
5937
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5938
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5939
+ * removed with the reason recorded at
5940
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5941
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5942
+ * marker sprinkled across sections also has to borrow a field that already
5943
+ * means something else; borrowing `section.tab` put the literal word
5944
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5945
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5946
+ * supersedes D268). One declaration, in one place, next to the schema whose
5947
+ * ids it names.
5948
+ */
5949
+ integrationSettingSections() {
5950
+ return [];
5951
+ }
5918
5952
  async getGlobalSettings(overlay, cap, nodeId) {
5919
5953
  const schema = this.globalSettingsSchema(cap);
5920
5954
  if (!schema) return { sections: [] };
@@ -5925,6 +5959,55 @@ var BaseAddon = class {
5925
5959
  } : projected);
5926
5960
  }
5927
5961
  /**
5962
+ * The integration-level view of this addon's settings: exactly the sections
5963
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5964
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5965
+ *
5966
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5967
+ * no integration settings surface at all, rather than an empty one that reads
5968
+ * as a failed load.
5969
+ *
5970
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5971
+ * and not in whichever UI happens to render this:
5972
+ *
5973
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5974
+ * shown here is the same field, with the same bare key, that the addon's
5975
+ * own page shows. There is no integration-specific writer — callers save
5976
+ * through `updateGlobalSettings` — so a second store key is unreachable,
5977
+ * not merely discouraged.
5978
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
5979
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
5980
+ * such a field silently picked would be a wrong answer for the operator
5981
+ * who opened the page (D266).
5982
+ * 3. **No silent typo.** A declared id that names no section throws. The
5983
+ * alternative — skip it — turns a rename into a surface that quietly
5984
+ * empties, which looks exactly like an addon with nothing to configure.
5985
+ */
5986
+ async getIntegrationSettings(nodeId) {
5987
+ const declared = this.integrationSettingSections();
5988
+ if (declared.length === 0) return null;
5989
+ const schema = this.globalSettingsSchema();
5990
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
5991
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
5992
+ const sections = [];
5993
+ for (const id of declared) {
5994
+ const section = byId.get(id);
5995
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
5996
+ const fields = dropPerNodeFields(section.fields);
5997
+ if (fields.length === 0) continue;
5998
+ sections.push({
5999
+ ...section,
6000
+ fields
6001
+ });
6002
+ }
6003
+ if (sections.length === 0) return null;
6004
+ const projected = await this.resolveGlobalStore(nodeId);
6005
+ return hydrateSchema({
6006
+ ...schema,
6007
+ sections
6008
+ }, projected);
6009
+ }
6010
+ /**
5928
6011
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5929
6012
  * every `perNode: true` field carries THAT node's scoped value on its bare
5930
6013
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6228,6 +6311,41 @@ var BaseAddon = class {
6228
6311
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6229
6312
  * don't declare `perNode` and are excluded by the `in` narrowing.
6230
6313
  */
6314
+ /**
6315
+ * The same fields with every `perNode: true` one removed, recursing into layout
6316
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6317
+ * with no child is dropped rather than rendered empty.
6318
+ *
6319
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6320
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6321
+ */
6322
+ function dropPerNodeFields(fields) {
6323
+ const kept = [];
6324
+ for (const field of fields) {
6325
+ if (field.type === "group") {
6326
+ const inner = dropPerNodeFields(field.fields);
6327
+ if (inner.length > 0) kept.push({
6328
+ ...field,
6329
+ fields: inner
6330
+ });
6331
+ continue;
6332
+ }
6333
+ if (field.type === "sub-tabs") {
6334
+ const tabs = field.tabs.map((tab) => ({
6335
+ ...tab,
6336
+ fields: dropPerNodeFields(tab.fields)
6337
+ })).filter((tab) => tab.fields.length > 0);
6338
+ if (tabs.length > 0) kept.push({
6339
+ ...field,
6340
+ tabs
6341
+ });
6342
+ continue;
6343
+ }
6344
+ if ("perNode" in field && field.perNode === true) continue;
6345
+ kept.push(field);
6346
+ }
6347
+ return kept;
6348
+ }
6231
6349
  function collectPerNodeFieldKeys(fields) {
6232
6350
  const collected = [];
6233
6351
  for (const field of fields) {
@@ -9415,6 +9533,9 @@ method(object({
9415
9533
  kind: "mutation",
9416
9534
  auth: "admin"
9417
9535
  }), method(object({
9536
+ addonId: string(),
9537
+ nodeId: string().optional()
9538
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9418
9539
  addonId: string(),
9419
9540
  deviceId: number(),
9420
9541
  nodeId: string().optional()
@@ -13099,6 +13220,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13099
13220
  limit: number().optional(),
13100
13221
  tags: record(string(), string()).optional()
13101
13222
  }), array(LogEntrySchema).readonly());
13223
+ /**
13224
+ * `failure-contribution` — the capability an addon reports its OWN losses
13225
+ * through, per camera, with the denominator attached. It stores nothing.
13226
+ *
13227
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13228
+ *
13229
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13230
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13231
+ * copied: the contributor reports what it already knows, hub-main adds only
13232
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13233
+ * somebody to forget to edit.
13234
+ *
13235
+ * They are not merged, because their invariants are opposites:
13236
+ *
13237
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13238
+ * claim a camera cost nothing, which is a measurement nobody made;
13239
+ * - a `failure-contribution` zero is the **most valuable value on the
13240
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13241
+ * and it is exactly what an absent entry cannot say.
13242
+ *
13243
+ * Putting a loss counter on a cost entry would also break the reconciliation
13244
+ * that gives `load-contribution` its point: contributions are subtracted from
13245
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13246
+ * has no process.
13247
+ *
13248
+ * ## Why not a log line, since the counters already exist
13249
+ *
13250
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13251
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13252
+ * ends in a log line, and a log line is the thing the operator asked to stop
13253
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13254
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13255
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13256
+ * media blackout were both diagnosed. The counters stay; this is where they can
13257
+ * be READ.
13258
+ *
13259
+ * ## The rate is served with its denominator or not at all
13260
+ *
13261
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13262
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13263
+ * than yesterday" and was **flat across twelve hours** once divided by the
13264
+ * successes on the same path. A surface that publishes only the numerator
13265
+ * reproduces that mistake on every read.
13266
+ *
13267
+ * ## Shape
13268
+ *
13269
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13270
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13271
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13272
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13273
+ * a forked runner's entries reach hub-main over transport that already exists.
13274
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13275
+ * result through `system.getFailureContributions`.
13276
+ */
13277
+ var FailureReasonCountSchema = object({
13278
+ /**
13279
+ * Why the attempt did not land, in the contributor's own vocabulary —
13280
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13281
+ * strings that already appear in this repo's logs and, where one exists, the
13282
+ * same string the per-track `previewMissReason` records (D276): a second
13283
+ * vocabulary for the same loss would make the row and the counter
13284
+ * un-joinable.
13285
+ */
13286
+ reason: string(),
13287
+ count: number().int().nonnegative()
13288
+ });
13289
+ var FailureContributionSchema = object({
13290
+ /**
13291
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13292
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13293
+ * `unit` free: the families are owned by different addons and a shared enum
13294
+ * is a central list that rots invisibly.
13295
+ */
13296
+ family: string(),
13297
+ /**
13298
+ * The NUMERIC device id — the same value every log line carries as
13299
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13300
+ * cannot name the camera must not emit the entry, because a fleet total
13301
+ * cannot answer the only question anybody asks of this surface.
13302
+ */
13303
+ deviceId: number().int().positive(),
13304
+ /**
13305
+ * A second dimension inside the family: the model / step id for an inference
13306
+ * timeout, so "which camera AND which model" is one read. Absent when the
13307
+ * family has a single variant.
13308
+ */
13309
+ variant: string().optional(),
13310
+ /**
13311
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13312
+ * differencing two reads must drop the interval when it changes, because the
13313
+ * counter restarted from zero in a respawned runner. Same discipline as
13314
+ * `LoadContribution.startedAtMs`.
13315
+ */
13316
+ sinceMs: number(),
13317
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13318
+ atMs: number(),
13319
+ /**
13320
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13321
+ * window. A failure count published without it is the mistake this schema
13322
+ * exists to make impossible.
13323
+ */
13324
+ attempts: number().int().nonnegative(),
13325
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13326
+ succeeded: number().int().nonnegative(),
13327
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13328
+ reasons: array(FailureReasonCountSchema).readonly()
13329
+ });
13330
+ method(_void(), array(FailureContributionSchema).readonly());
13102
13331
  var LoadContributionSchema = object({
13103
13332
  role: _enum([
13104
13333
  "decode",
@@ -17628,6 +17857,20 @@ var TrackSchema = object({
17628
17857
  * `=== true` and render nothing otherwise — never infer "no rider".
17629
17858
  */
17630
17859
  hasRider: boolean().optional(),
17860
+ /**
17861
+ * WHY this track ended without a NATIVE best-shot tile
17862
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17863
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17864
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17865
+ * the late-keyFrame upgrade when a native tile lands after all. The
17866
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17867
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17868
+ *
17869
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17870
+ * that predates the field, and every track whose tile landed native all
17871
+ * omit it. Render nothing when absent.
17872
+ */
17873
+ previewMissReason: string().optional(),
17631
17874
  ...TrackFlagFields,
17632
17875
  ...TrackRetrainFields
17633
17876
  });
@@ -26915,6 +27158,13 @@ var LoggingSettingsPatchSchema = object({
26915
27158
  * anyone but its owner.
26916
27159
  */
26917
27160
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27161
+ /**
27162
+ * One per-camera failure counter, plus WHO reported it.
27163
+ *
27164
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27165
+ * the hub as it enumerates providers, never by the contributor.
27166
+ */
27167
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26918
27168
  var GetLoggingSettingsInputSchema = object({
26919
27169
  scopeNodeId: string().optional(),
26920
27170
  /**
@@ -26973,7 +27223,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26973
27223
  }), method(_void(), SiteLocationStatusSchema, {
26974
27224
  kind: "mutation",
26975
27225
  auth: "admin"
26976
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27226
+ }), 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, {
26977
27227
  kind: "mutation",
26978
27228
  auth: "admin"
26979
27229
  });
@@ -27887,6 +28137,12 @@ Object.freeze({
27887
28137
  addonId: null,
27888
28138
  access: "view"
27889
28139
  },
28140
+ "addonSettings.getIntegrationSettings": {
28141
+ capName: "addon-settings",
28142
+ capScope: "system",
28143
+ addonId: null,
28144
+ access: "view"
28145
+ },
27890
28146
  "addonSettings.updateDeviceSettings": {
27891
28147
  capName: "addon-settings",
27892
28148
  capScope: "system",
@@ -29549,6 +29805,12 @@ Object.freeze({
29549
29805
  addonId: null,
29550
29806
  access: "create"
29551
29807
  },
29808
+ "failureContribution.list": {
29809
+ capName: "failure-contribution",
29810
+ capScope: "system",
29811
+ addonId: null,
29812
+ access: "view"
29813
+ },
29552
29814
  "fanControl.setDirection": {
29553
29815
  capName: "fan-control",
29554
29816
  capScope: "device",
@@ -32855,6 +33117,12 @@ Object.freeze({
32855
33117
  addonId: null,
32856
33118
  access: "create"
32857
33119
  },
33120
+ "system.getFailureContributions": {
33121
+ capName: "system",
33122
+ capScope: "system",
33123
+ addonId: null,
33124
+ access: "view"
33125
+ },
32858
33126
  "system.getLoadContributions": {
32859
33127
  capName: "system",
32860
33128
  capScope: "system",
@@ -5915,6 +5915,40 @@ var BaseAddon = class {
5915
5915
  deviceSettingsSchema() {
5916
5916
  return null;
5917
5917
  }
5918
+ /**
5919
+ * INTEGRATION-LEVEL SETTINGS — declare which of this addon's global sections
5920
+ * ARE the configuration of its integration.
5921
+ *
5922
+ * Return the `ConfigSection.id`s, from {@link globalSettingsSchema}, that an
5923
+ * operator should find on the addon's integration page (System →
5924
+ * Integrations → <name>) rather than only in the cluster-wide list of every
5925
+ * addon. Empty (the default) means the addon has no integration-level
5926
+ * settings and no such surface is offered — this is opt-in, because whether
5927
+ * an addon's configuration IS its integration's configuration depends on the
5928
+ * nature of the integration.
5929
+ *
5930
+ * WHAT THIS IS NOT. It is not a scope. The selected sections keep living in
5931
+ * the ONE global schema, in the ONE addon store, written by the ONE
5932
+ * `updateGlobalSettings` path. There is deliberately no
5933
+ * `updateIntegrationSettings`: a second write path is how a surface acquires
5934
+ * a second store key, and this repo has shipped that twice (`btmPath@hub`,
5935
+ * D266). Selecting sections cannot introduce a key that selecting cannot.
5936
+ *
5937
+ * WHY IT IS A LIST OF SECTION IDS AND NOT A MARKER ON THE SECTION.
5938
+ * `ConfigFieldBase` used to carry `scope?: 'device' | 'global'` and it was
5939
+ * removed with the reason recorded at
5940
+ * `packages/types/src/interfaces/config-ui.ts:249` — *"a field's scope is
5941
+ * determined by WHICH schema it lives in, not by a field-level marker."* A
5942
+ * marker sprinkled across sections also has to borrow a field that already
5943
+ * means something else; borrowing `section.tab` put the literal word
5944
+ * "integration" into an operator-facing tab bar, because `tab` means "how to
5945
+ * GROUP this visually" and cannot also mean "where this lives" (D269
5946
+ * supersedes D268). One declaration, in one place, next to the schema whose
5947
+ * ids it names.
5948
+ */
5949
+ integrationSettingSections() {
5950
+ return [];
5951
+ }
5918
5952
  async getGlobalSettings(overlay, cap, nodeId) {
5919
5953
  const schema = this.globalSettingsSchema(cap);
5920
5954
  if (!schema) return { sections: [] };
@@ -5925,6 +5959,55 @@ var BaseAddon = class {
5925
5959
  } : projected);
5926
5960
  }
5927
5961
  /**
5962
+ * The integration-level view of this addon's settings: exactly the sections
5963
+ * named by {@link integrationSettingSections}, hydrated from the SAME store
5964
+ * `getGlobalSettings` reads, and narrowed to cluster-scoped fields.
5965
+ *
5966
+ * Returns `null` when the addon declared nothing — an addon that opts out has
5967
+ * no integration settings surface at all, rather than an empty one that reads
5968
+ * as a failed load.
5969
+ *
5970
+ * Three properties hold BY CONSTRUCTION, which is why they are here in core
5971
+ * and not in whichever UI happens to render this:
5972
+ *
5973
+ * 1. **One key.** The payload is a SUBSET of the global schema, so a field
5974
+ * shown here is the same field, with the same bare key, that the addon's
5975
+ * own page shows. There is no integration-specific writer — callers save
5976
+ * through `updateGlobalSettings` — so a second store key is unreachable,
5977
+ * not merely discouraged.
5978
+ * 2. **No node scope.** `perNode: true` fields are DROPPED. Their store key
5979
+ * is `<key>@<nodeId>` and an integration is not a node; whichever node
5980
+ * such a field silently picked would be a wrong answer for the operator
5981
+ * who opened the page (D266).
5982
+ * 3. **No silent typo.** A declared id that names no section throws. The
5983
+ * alternative — skip it — turns a rename into a surface that quietly
5984
+ * empties, which looks exactly like an addon with nothing to configure.
5985
+ */
5986
+ async getIntegrationSettings(nodeId) {
5987
+ const declared = this.integrationSettingSections();
5988
+ if (declared.length === 0) return null;
5989
+ const schema = this.globalSettingsSchema();
5990
+ if (!schema) throw new Error(`${this.constructor.name}: integrationSettingSections() names [${declared.join(", ")}] but globalSettingsSchema() returns null.`);
5991
+ const byId = new Map(schema.sections.map((section) => [section.id, section]));
5992
+ const sections = [];
5993
+ for (const id of declared) {
5994
+ const section = byId.get(id);
5995
+ if (!section) throw new Error(`${this.constructor.name}: integrationSettingSections() names unknown section "${id}". Known sections: [${[...byId.keys()].join(", ")}].`);
5996
+ const fields = dropPerNodeFields(section.fields);
5997
+ if (fields.length === 0) continue;
5998
+ sections.push({
5999
+ ...section,
6000
+ fields
6001
+ });
6002
+ }
6003
+ if (sections.length === 0) return null;
6004
+ const projected = await this.resolveGlobalStore(nodeId);
6005
+ return hydrateSchema({
6006
+ ...schema,
6007
+ sections
6008
+ }, projected);
6009
+ }
6010
+ /**
5928
6011
  * The raw addon store PROJECTED onto the target node's bare per-node keys:
5929
6012
  * every `perNode: true` field carries THAT node's scoped value on its bare
5930
6013
  * key (absent scoped key ⇒ key absent, so the schema `default` wins — no
@@ -6228,6 +6311,41 @@ var BaseAddon = class {
6228
6311
  * `hydrateSchema` does. Valueless structural fields (separator/info/…)
6229
6312
  * don't declare `perNode` and are excluded by the `in` narrowing.
6230
6313
  */
6314
+ /**
6315
+ * The same fields with every `perNode: true` one removed, recursing into layout
6316
+ * containers exactly as {@link collectPerNodeFieldKeys} does. A container left
6317
+ * with no child is dropped rather than rendered empty.
6318
+ *
6319
+ * Used by `getIntegrationSettings`: an integration is not a node, so a field
6320
+ * whose store key is `<key>@<nodeId>` has no node to belong to there.
6321
+ */
6322
+ function dropPerNodeFields(fields) {
6323
+ const kept = [];
6324
+ for (const field of fields) {
6325
+ if (field.type === "group") {
6326
+ const inner = dropPerNodeFields(field.fields);
6327
+ if (inner.length > 0) kept.push({
6328
+ ...field,
6329
+ fields: inner
6330
+ });
6331
+ continue;
6332
+ }
6333
+ if (field.type === "sub-tabs") {
6334
+ const tabs = field.tabs.map((tab) => ({
6335
+ ...tab,
6336
+ fields: dropPerNodeFields(tab.fields)
6337
+ })).filter((tab) => tab.fields.length > 0);
6338
+ if (tabs.length > 0) kept.push({
6339
+ ...field,
6340
+ tabs
6341
+ });
6342
+ continue;
6343
+ }
6344
+ if ("perNode" in field && field.perNode === true) continue;
6345
+ kept.push(field);
6346
+ }
6347
+ return kept;
6348
+ }
6231
6349
  function collectPerNodeFieldKeys(fields) {
6232
6350
  const collected = [];
6233
6351
  for (const field of fields) {
@@ -9415,6 +9533,9 @@ method(object({
9415
9533
  kind: "mutation",
9416
9534
  auth: "admin"
9417
9535
  }), method(object({
9536
+ addonId: string(),
9537
+ nodeId: string().optional()
9538
+ }), SettingsSchemaWithValuesSchema.nullable()), method(object({
9418
9539
  addonId: string(),
9419
9540
  deviceId: number(),
9420
9541
  nodeId: string().optional()
@@ -13099,6 +13220,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13099
13220
  limit: number().optional(),
13100
13221
  tags: record(string(), string()).optional()
13101
13222
  }), array(LogEntrySchema).readonly());
13223
+ /**
13224
+ * `failure-contribution` — the capability an addon reports its OWN losses
13225
+ * through, per camera, with the denominator attached. It stores nothing.
13226
+ *
13227
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13228
+ *
13229
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13230
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13231
+ * copied: the contributor reports what it already knows, hub-main adds only
13232
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13233
+ * somebody to forget to edit.
13234
+ *
13235
+ * They are not merged, because their invariants are opposites:
13236
+ *
13237
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13238
+ * claim a camera cost nothing, which is a measurement nobody made;
13239
+ * - a `failure-contribution` zero is the **most valuable value on the
13240
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13241
+ * and it is exactly what an absent entry cannot say.
13242
+ *
13243
+ * Putting a loss counter on a cost entry would also break the reconciliation
13244
+ * that gives `load-contribution` its point: contributions are subtracted from
13245
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13246
+ * has no process.
13247
+ *
13248
+ * ## Why not a log line, since the counters already exist
13249
+ *
13250
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13251
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13252
+ * ends in a log line, and a log line is the thing the operator asked to stop
13253
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13254
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13255
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13256
+ * media blackout were both diagnosed. The counters stay; this is where they can
13257
+ * be READ.
13258
+ *
13259
+ * ## The rate is served with its denominator or not at all
13260
+ *
13261
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13262
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13263
+ * than yesterday" and was **flat across twelve hours** once divided by the
13264
+ * successes on the same path. A surface that publishes only the numerator
13265
+ * reproduces that mistake on every read.
13266
+ *
13267
+ * ## Shape
13268
+ *
13269
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13270
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13271
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13272
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13273
+ * a forked runner's entries reach hub-main over transport that already exists.
13274
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13275
+ * result through `system.getFailureContributions`.
13276
+ */
13277
+ var FailureReasonCountSchema = object({
13278
+ /**
13279
+ * Why the attempt did not land, in the contributor's own vocabulary —
13280
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13281
+ * strings that already appear in this repo's logs and, where one exists, the
13282
+ * same string the per-track `previewMissReason` records (D276): a second
13283
+ * vocabulary for the same loss would make the row and the counter
13284
+ * un-joinable.
13285
+ */
13286
+ reason: string(),
13287
+ count: number().int().nonnegative()
13288
+ });
13289
+ var FailureContributionSchema = object({
13290
+ /**
13291
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13292
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13293
+ * `unit` free: the families are owned by different addons and a shared enum
13294
+ * is a central list that rots invisibly.
13295
+ */
13296
+ family: string(),
13297
+ /**
13298
+ * The NUMERIC device id — the same value every log line carries as
13299
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13300
+ * cannot name the camera must not emit the entry, because a fleet total
13301
+ * cannot answer the only question anybody asks of this surface.
13302
+ */
13303
+ deviceId: number().int().positive(),
13304
+ /**
13305
+ * A second dimension inside the family: the model / step id for an inference
13306
+ * timeout, so "which camera AND which model" is one read. Absent when the
13307
+ * family has a single variant.
13308
+ */
13309
+ variant: string().optional(),
13310
+ /**
13311
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13312
+ * differencing two reads must drop the interval when it changes, because the
13313
+ * counter restarted from zero in a respawned runner. Same discipline as
13314
+ * `LoadContribution.startedAtMs`.
13315
+ */
13316
+ sinceMs: number(),
13317
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13318
+ atMs: number(),
13319
+ /**
13320
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13321
+ * window. A failure count published without it is the mistake this schema
13322
+ * exists to make impossible.
13323
+ */
13324
+ attempts: number().int().nonnegative(),
13325
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13326
+ succeeded: number().int().nonnegative(),
13327
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13328
+ reasons: array(FailureReasonCountSchema).readonly()
13329
+ });
13330
+ method(_void(), array(FailureContributionSchema).readonly());
13102
13331
  var LoadContributionSchema = object({
13103
13332
  role: _enum([
13104
13333
  "decode",
@@ -17628,6 +17857,20 @@ var TrackSchema = object({
17628
17857
  * `=== true` and render nothing otherwise — never infer "no rider".
17629
17858
  */
17630
17859
  hasRider: boolean().optional(),
17860
+ /**
17861
+ * WHY this track ended without a NATIVE best-shot tile
17862
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
17863
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
17864
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
17865
+ * the late-keyFrame upgrade when a native tile lands after all. The
17866
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
17867
+ * tile is a face/plate stand-in, a raster crop, or an icon.
17868
+ *
17869
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
17870
+ * that predates the field, and every track whose tile landed native all
17871
+ * omit it. Render nothing when absent.
17872
+ */
17873
+ previewMissReason: string().optional(),
17631
17874
  ...TrackFlagFields,
17632
17875
  ...TrackRetrainFields
17633
17876
  });
@@ -26915,6 +27158,13 @@ var LoggingSettingsPatchSchema = object({
26915
27158
  * anyone but its owner.
26916
27159
  */
26917
27160
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
27161
+ /**
27162
+ * One per-camera failure counter, plus WHO reported it.
27163
+ *
27164
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
27165
+ * the hub as it enumerates providers, never by the contributor.
27166
+ */
27167
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
26918
27168
  var GetLoggingSettingsInputSchema = object({
26919
27169
  scopeNodeId: string().optional(),
26920
27170
  /**
@@ -26973,7 +27223,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
26973
27223
  }), method(_void(), SiteLocationStatusSchema, {
26974
27224
  kind: "mutation",
26975
27225
  auth: "admin"
26976
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
27226
+ }), 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, {
26977
27227
  kind: "mutation",
26978
27228
  auth: "admin"
26979
27229
  });
@@ -27887,6 +28137,12 @@ Object.freeze({
27887
28137
  addonId: null,
27888
28138
  access: "view"
27889
28139
  },
28140
+ "addonSettings.getIntegrationSettings": {
28141
+ capName: "addon-settings",
28142
+ capScope: "system",
28143
+ addonId: null,
28144
+ access: "view"
28145
+ },
27890
28146
  "addonSettings.updateDeviceSettings": {
27891
28147
  capName: "addon-settings",
27892
28148
  capScope: "system",
@@ -29549,6 +29805,12 @@ Object.freeze({
29549
29805
  addonId: null,
29550
29806
  access: "create"
29551
29807
  },
29808
+ "failureContribution.list": {
29809
+ capName: "failure-contribution",
29810
+ capScope: "system",
29811
+ addonId: null,
29812
+ access: "view"
29813
+ },
29552
29814
  "fanControl.setDirection": {
29553
29815
  capName: "fan-control",
29554
29816
  capScope: "device",
@@ -32855,6 +33117,12 @@ Object.freeze({
32855
33117
  addonId: null,
32856
33118
  access: "create"
32857
33119
  },
33120
+ "system.getFailureContributions": {
33121
+ capName: "system",
33122
+ capScope: "system",
33123
+ addonId: null,
33124
+ access: "view"
33125
+ },
32858
33126
  "system.getLoadContributions": {
32859
33127
  capName: "system",
32860
33128
  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_dist = require("../dist-oQYtf-HC.js");
5
+ const require_dist = require("../dist-DXDI20wF.js");
6
6
  let node_crypto = require("node:crypto");
7
7
  let node_child_process = require("node:child_process");
8
8
  //#region src/ingress/tailscale-cli.ts
@@ -1,4 +1,4 @@
1
- import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-BBoke9_u.mjs";
1
+ import { a as EventCategory, i as BaseAddon, n as networkAccessCapability } from "../dist-CNu9kGot.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { execFile } from "node:child_process";
4
4
  import { promisify } from "node:util";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-tailscale",
3
- "version": "1.2.37",
3
+ "version": "1.2.39",
4
4
  "description": "Tailscale bundle for CamStack — joins the host to a tailnet (client) and exposes the hub via Serve/Funnel (ingress). Multi-entry npm package shipping 2 addons under a single bundle.",
5
5
  "keywords": [
6
6
  "camstack",