@camstack/addon-provider-unifi 0.2.38 → 0.2.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/addon.js CHANGED
@@ -13467,6 +13467,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13467
13467
  limit: number().optional(),
13468
13468
  tags: record(string(), string()).optional()
13469
13469
  }), array(LogEntrySchema).readonly());
13470
+ /**
13471
+ * `failure-contribution` — the capability an addon reports its OWN losses
13472
+ * through, per camera, with the denominator attached. It stores nothing.
13473
+ *
13474
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13475
+ *
13476
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13477
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13478
+ * copied: the contributor reports what it already knows, hub-main adds only
13479
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13480
+ * somebody to forget to edit.
13481
+ *
13482
+ * They are not merged, because their invariants are opposites:
13483
+ *
13484
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13485
+ * claim a camera cost nothing, which is a measurement nobody made;
13486
+ * - a `failure-contribution` zero is the **most valuable value on the
13487
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13488
+ * and it is exactly what an absent entry cannot say.
13489
+ *
13490
+ * Putting a loss counter on a cost entry would also break the reconciliation
13491
+ * that gives `load-contribution` its point: contributions are subtracted from
13492
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13493
+ * has no process.
13494
+ *
13495
+ * ## Why not a log line, since the counters already exist
13496
+ *
13497
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13498
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13499
+ * ends in a log line, and a log line is the thing the operator asked to stop
13500
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13501
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13502
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13503
+ * media blackout were both diagnosed. The counters stay; this is where they can
13504
+ * be READ.
13505
+ *
13506
+ * ## The rate is served with its denominator or not at all
13507
+ *
13508
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13509
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13510
+ * than yesterday" and was **flat across twelve hours** once divided by the
13511
+ * successes on the same path. A surface that publishes only the numerator
13512
+ * reproduces that mistake on every read.
13513
+ *
13514
+ * ## Shape
13515
+ *
13516
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13517
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13518
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13519
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13520
+ * a forked runner's entries reach hub-main over transport that already exists.
13521
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13522
+ * result through `system.getFailureContributions`.
13523
+ */
13524
+ var FailureReasonCountSchema = object({
13525
+ /**
13526
+ * Why the attempt did not land, in the contributor's own vocabulary —
13527
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13528
+ * strings that already appear in this repo's logs and, where one exists, the
13529
+ * same string the per-track `previewMissReason` records (D276): a second
13530
+ * vocabulary for the same loss would make the row and the counter
13531
+ * un-joinable.
13532
+ */
13533
+ reason: string(),
13534
+ count: number().int().nonnegative()
13535
+ });
13536
+ var FailureContributionSchema = object({
13537
+ /**
13538
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13539
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13540
+ * `unit` free: the families are owned by different addons and a shared enum
13541
+ * is a central list that rots invisibly.
13542
+ */
13543
+ family: string(),
13544
+ /**
13545
+ * The NUMERIC device id — the same value every log line carries as
13546
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13547
+ * cannot name the camera must not emit the entry, because a fleet total
13548
+ * cannot answer the only question anybody asks of this surface.
13549
+ */
13550
+ deviceId: number().int().positive(),
13551
+ /**
13552
+ * A second dimension inside the family: the model / step id for an inference
13553
+ * timeout, so "which camera AND which model" is one read. Absent when the
13554
+ * family has a single variant.
13555
+ */
13556
+ variant: string().optional(),
13557
+ /**
13558
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13559
+ * differencing two reads must drop the interval when it changes, because the
13560
+ * counter restarted from zero in a respawned runner. Same discipline as
13561
+ * `LoadContribution.startedAtMs`.
13562
+ */
13563
+ sinceMs: number(),
13564
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13565
+ atMs: number(),
13566
+ /**
13567
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13568
+ * window. A failure count published without it is the mistake this schema
13569
+ * exists to make impossible.
13570
+ */
13571
+ attempts: number().int().nonnegative(),
13572
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13573
+ succeeded: number().int().nonnegative(),
13574
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13575
+ reasons: array(FailureReasonCountSchema).readonly()
13576
+ });
13577
+ method(_void(), array(FailureContributionSchema).readonly());
13470
13578
  var LoadContributionSchema = object({
13471
13579
  role: _enum([
13472
13580
  "decode",
@@ -18057,6 +18165,20 @@ var TrackSchema = object({
18057
18165
  * `=== true` and render nothing otherwise — never infer "no rider".
18058
18166
  */
18059
18167
  hasRider: boolean().optional(),
18168
+ /**
18169
+ * WHY this track ended without a NATIVE best-shot tile
18170
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
18171
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
18172
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
18173
+ * the late-keyFrame upgrade when a native tile lands after all. The
18174
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
18175
+ * tile is a face/plate stand-in, a raster crop, or an icon.
18176
+ *
18177
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
18178
+ * that predates the field, and every track whose tile landed native all
18179
+ * omit it. Render nothing when absent.
18180
+ */
18181
+ previewMissReason: string().optional(),
18060
18182
  ...TrackFlagFields,
18061
18183
  ...TrackRetrainFields
18062
18184
  });
@@ -29249,6 +29371,13 @@ var LoggingSettingsPatchSchema = object({
29249
29371
  * anyone but its owner.
29250
29372
  */
29251
29373
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29374
+ /**
29375
+ * One per-camera failure counter, plus WHO reported it.
29376
+ *
29377
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
29378
+ * the hub as it enumerates providers, never by the contributor.
29379
+ */
29380
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
29252
29381
  var GetLoggingSettingsInputSchema = object({
29253
29382
  scopeNodeId: string().optional(),
29254
29383
  /**
@@ -29307,7 +29436,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29307
29436
  }), method(_void(), SiteLocationStatusSchema, {
29308
29437
  kind: "mutation",
29309
29438
  auth: "admin"
29310
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29439
+ }), 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, {
29311
29440
  kind: "mutation",
29312
29441
  auth: "admin"
29313
29442
  });
@@ -33297,6 +33426,12 @@ Object.freeze({
33297
33426
  addonId: null,
33298
33427
  access: "create"
33299
33428
  },
33429
+ "failureContribution.list": {
33430
+ capName: "failure-contribution",
33431
+ capScope: "system",
33432
+ addonId: null,
33433
+ access: "view"
33434
+ },
33300
33435
  "fanControl.setDirection": {
33301
33436
  capName: "fan-control",
33302
33437
  capScope: "device",
@@ -36603,6 +36738,12 @@ Object.freeze({
36603
36738
  addonId: null,
36604
36739
  access: "create"
36605
36740
  },
36741
+ "system.getFailureContributions": {
36742
+ capName: "system",
36743
+ capScope: "system",
36744
+ addonId: null,
36745
+ access: "view"
36746
+ },
36606
36747
  "system.getLoadContributions": {
36607
36748
  capName: "system",
36608
36749
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -13466,6 +13466,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13466
13466
  limit: number().optional(),
13467
13467
  tags: record(string(), string()).optional()
13468
13468
  }), array(LogEntrySchema).readonly());
13469
+ /**
13470
+ * `failure-contribution` — the capability an addon reports its OWN losses
13471
+ * through, per camera, with the denominator attached. It stores nothing.
13472
+ *
13473
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13474
+ *
13475
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13476
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13477
+ * copied: the contributor reports what it already knows, hub-main adds only
13478
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13479
+ * somebody to forget to edit.
13480
+ *
13481
+ * They are not merged, because their invariants are opposites:
13482
+ *
13483
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13484
+ * claim a camera cost nothing, which is a measurement nobody made;
13485
+ * - a `failure-contribution` zero is the **most valuable value on the
13486
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13487
+ * and it is exactly what an absent entry cannot say.
13488
+ *
13489
+ * Putting a loss counter on a cost entry would also break the reconciliation
13490
+ * that gives `load-contribution` its point: contributions are subtracted from
13491
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13492
+ * has no process.
13493
+ *
13494
+ * ## Why not a log line, since the counters already exist
13495
+ *
13496
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13497
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13498
+ * ends in a log line, and a log line is the thing the operator asked to stop
13499
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13500
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13501
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13502
+ * media blackout were both diagnosed. The counters stay; this is where they can
13503
+ * be READ.
13504
+ *
13505
+ * ## The rate is served with its denominator or not at all
13506
+ *
13507
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13508
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13509
+ * than yesterday" and was **flat across twelve hours** once divided by the
13510
+ * successes on the same path. A surface that publishes only the numerator
13511
+ * reproduces that mistake on every read.
13512
+ *
13513
+ * ## Shape
13514
+ *
13515
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13516
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13517
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13518
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13519
+ * a forked runner's entries reach hub-main over transport that already exists.
13520
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13521
+ * result through `system.getFailureContributions`.
13522
+ */
13523
+ var FailureReasonCountSchema = object({
13524
+ /**
13525
+ * Why the attempt did not land, in the contributor's own vocabulary —
13526
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13527
+ * strings that already appear in this repo's logs and, where one exists, the
13528
+ * same string the per-track `previewMissReason` records (D276): a second
13529
+ * vocabulary for the same loss would make the row and the counter
13530
+ * un-joinable.
13531
+ */
13532
+ reason: string(),
13533
+ count: number().int().nonnegative()
13534
+ });
13535
+ var FailureContributionSchema = object({
13536
+ /**
13537
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13538
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13539
+ * `unit` free: the families are owned by different addons and a shared enum
13540
+ * is a central list that rots invisibly.
13541
+ */
13542
+ family: string(),
13543
+ /**
13544
+ * The NUMERIC device id — the same value every log line carries as
13545
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13546
+ * cannot name the camera must not emit the entry, because a fleet total
13547
+ * cannot answer the only question anybody asks of this surface.
13548
+ */
13549
+ deviceId: number().int().positive(),
13550
+ /**
13551
+ * A second dimension inside the family: the model / step id for an inference
13552
+ * timeout, so "which camera AND which model" is one read. Absent when the
13553
+ * family has a single variant.
13554
+ */
13555
+ variant: string().optional(),
13556
+ /**
13557
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13558
+ * differencing two reads must drop the interval when it changes, because the
13559
+ * counter restarted from zero in a respawned runner. Same discipline as
13560
+ * `LoadContribution.startedAtMs`.
13561
+ */
13562
+ sinceMs: number(),
13563
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13564
+ atMs: number(),
13565
+ /**
13566
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13567
+ * window. A failure count published without it is the mistake this schema
13568
+ * exists to make impossible.
13569
+ */
13570
+ attempts: number().int().nonnegative(),
13571
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13572
+ succeeded: number().int().nonnegative(),
13573
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13574
+ reasons: array(FailureReasonCountSchema).readonly()
13575
+ });
13576
+ method(_void(), array(FailureContributionSchema).readonly());
13469
13577
  var LoadContributionSchema = object({
13470
13578
  role: _enum([
13471
13579
  "decode",
@@ -18056,6 +18164,20 @@ var TrackSchema = object({
18056
18164
  * `=== true` and render nothing otherwise — never infer "no rider".
18057
18165
  */
18058
18166
  hasRider: boolean().optional(),
18167
+ /**
18168
+ * WHY this track ended without a NATIVE best-shot tile
18169
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
18170
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
18171
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
18172
+ * the late-keyFrame upgrade when a native tile lands after all. The
18173
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
18174
+ * tile is a face/plate stand-in, a raster crop, or an icon.
18175
+ *
18176
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
18177
+ * that predates the field, and every track whose tile landed native all
18178
+ * omit it. Render nothing when absent.
18179
+ */
18180
+ previewMissReason: string().optional(),
18059
18181
  ...TrackFlagFields,
18060
18182
  ...TrackRetrainFields
18061
18183
  });
@@ -29248,6 +29370,13 @@ var LoggingSettingsPatchSchema = object({
29248
29370
  * anyone but its owner.
29249
29371
  */
29250
29372
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29373
+ /**
29374
+ * One per-camera failure counter, plus WHO reported it.
29375
+ *
29376
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
29377
+ * the hub as it enumerates providers, never by the contributor.
29378
+ */
29379
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
29251
29380
  var GetLoggingSettingsInputSchema = object({
29252
29381
  scopeNodeId: string().optional(),
29253
29382
  /**
@@ -29306,7 +29435,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29306
29435
  }), method(_void(), SiteLocationStatusSchema, {
29307
29436
  kind: "mutation",
29308
29437
  auth: "admin"
29309
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29438
+ }), 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, {
29310
29439
  kind: "mutation",
29311
29440
  auth: "admin"
29312
29441
  });
@@ -33296,6 +33425,12 @@ Object.freeze({
33296
33425
  addonId: null,
33297
33426
  access: "create"
33298
33427
  },
33428
+ "failureContribution.list": {
33429
+ capName: "failure-contribution",
33430
+ capScope: "system",
33431
+ addonId: null,
33432
+ access: "view"
33433
+ },
33299
33434
  "fanControl.setDirection": {
33300
33435
  capName: "fan-control",
33301
33436
  capScope: "device",
@@ -36602,6 +36737,12 @@ Object.freeze({
36602
36737
  addonId: null,
36603
36738
  access: "create"
36604
36739
  },
36740
+ "system.getFailureContributions": {
36741
+ capName: "system",
36742
+ capScope: "system",
36743
+ addonId: null,
36744
+ access: "view"
36745
+ },
36605
36746
  "system.getLoadContributions": {
36606
36747
  capName: "system",
36607
36748
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-unifi",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "description": "UniFi Network controller device-provider addon for CamStack — local-controller infra switches/APs (as containers) + network-client presence. NO cameras/Protect.",
5
5
  "keywords": [
6
6
  "camstack",