@camstack/addon-provider-amcrest 0.2.39 → 0.2.40

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
@@ -13460,6 +13460,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13460
13460
  limit: number().optional(),
13461
13461
  tags: record(string(), string()).optional()
13462
13462
  }), array(LogEntrySchema).readonly());
13463
+ /**
13464
+ * `failure-contribution` — the capability an addon reports its OWN losses
13465
+ * through, per camera, with the denominator attached. It stores nothing.
13466
+ *
13467
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13468
+ *
13469
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13470
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13471
+ * copied: the contributor reports what it already knows, hub-main adds only
13472
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13473
+ * somebody to forget to edit.
13474
+ *
13475
+ * They are not merged, because their invariants are opposites:
13476
+ *
13477
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13478
+ * claim a camera cost nothing, which is a measurement nobody made;
13479
+ * - a `failure-contribution` zero is the **most valuable value on the
13480
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13481
+ * and it is exactly what an absent entry cannot say.
13482
+ *
13483
+ * Putting a loss counter on a cost entry would also break the reconciliation
13484
+ * that gives `load-contribution` its point: contributions are subtracted from
13485
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13486
+ * has no process.
13487
+ *
13488
+ * ## Why not a log line, since the counters already exist
13489
+ *
13490
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13491
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13492
+ * ends in a log line, and a log line is the thing the operator asked to stop
13493
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13494
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13495
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13496
+ * media blackout were both diagnosed. The counters stay; this is where they can
13497
+ * be READ.
13498
+ *
13499
+ * ## The rate is served with its denominator or not at all
13500
+ *
13501
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13502
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13503
+ * than yesterday" and was **flat across twelve hours** once divided by the
13504
+ * successes on the same path. A surface that publishes only the numerator
13505
+ * reproduces that mistake on every read.
13506
+ *
13507
+ * ## Shape
13508
+ *
13509
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13510
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13511
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13512
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13513
+ * a forked runner's entries reach hub-main over transport that already exists.
13514
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13515
+ * result through `system.getFailureContributions`.
13516
+ */
13517
+ var FailureReasonCountSchema = object({
13518
+ /**
13519
+ * Why the attempt did not land, in the contributor's own vocabulary —
13520
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13521
+ * strings that already appear in this repo's logs and, where one exists, the
13522
+ * same string the per-track `previewMissReason` records (D276): a second
13523
+ * vocabulary for the same loss would make the row and the counter
13524
+ * un-joinable.
13525
+ */
13526
+ reason: string(),
13527
+ count: number().int().nonnegative()
13528
+ });
13529
+ var FailureContributionSchema = object({
13530
+ /**
13531
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13532
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13533
+ * `unit` free: the families are owned by different addons and a shared enum
13534
+ * is a central list that rots invisibly.
13535
+ */
13536
+ family: string(),
13537
+ /**
13538
+ * The NUMERIC device id — the same value every log line carries as
13539
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13540
+ * cannot name the camera must not emit the entry, because a fleet total
13541
+ * cannot answer the only question anybody asks of this surface.
13542
+ */
13543
+ deviceId: number().int().positive(),
13544
+ /**
13545
+ * A second dimension inside the family: the model / step id for an inference
13546
+ * timeout, so "which camera AND which model" is one read. Absent when the
13547
+ * family has a single variant.
13548
+ */
13549
+ variant: string().optional(),
13550
+ /**
13551
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13552
+ * differencing two reads must drop the interval when it changes, because the
13553
+ * counter restarted from zero in a respawned runner. Same discipline as
13554
+ * `LoadContribution.startedAtMs`.
13555
+ */
13556
+ sinceMs: number(),
13557
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13558
+ atMs: number(),
13559
+ /**
13560
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13561
+ * window. A failure count published without it is the mistake this schema
13562
+ * exists to make impossible.
13563
+ */
13564
+ attempts: number().int().nonnegative(),
13565
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13566
+ succeeded: number().int().nonnegative(),
13567
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13568
+ reasons: array(FailureReasonCountSchema).readonly()
13569
+ });
13570
+ method(_void(), array(FailureContributionSchema).readonly());
13463
13571
  var LoadContributionSchema = object({
13464
13572
  role: _enum([
13465
13573
  "decode",
@@ -18050,6 +18158,20 @@ var TrackSchema = object({
18050
18158
  * `=== true` and render nothing otherwise — never infer "no rider".
18051
18159
  */
18052
18160
  hasRider: boolean().optional(),
18161
+ /**
18162
+ * WHY this track ended without a NATIVE best-shot tile
18163
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
18164
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
18165
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
18166
+ * the late-keyFrame upgrade when a native tile lands after all. The
18167
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
18168
+ * tile is a face/plate stand-in, a raster crop, or an icon.
18169
+ *
18170
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
18171
+ * that predates the field, and every track whose tile landed native all
18172
+ * omit it. Render nothing when absent.
18173
+ */
18174
+ previewMissReason: string().optional(),
18053
18175
  ...TrackFlagFields,
18054
18176
  ...TrackRetrainFields
18055
18177
  });
@@ -29615,6 +29737,13 @@ var LoggingSettingsPatchSchema = object({
29615
29737
  * anyone but its owner.
29616
29738
  */
29617
29739
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29740
+ /**
29741
+ * One per-camera failure counter, plus WHO reported it.
29742
+ *
29743
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
29744
+ * the hub as it enumerates providers, never by the contributor.
29745
+ */
29746
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
29618
29747
  var GetLoggingSettingsInputSchema = object({
29619
29748
  scopeNodeId: string().optional(),
29620
29749
  /**
@@ -29673,7 +29802,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29673
29802
  }), method(_void(), SiteLocationStatusSchema, {
29674
29803
  kind: "mutation",
29675
29804
  auth: "admin"
29676
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29805
+ }), 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, {
29677
29806
  kind: "mutation",
29678
29807
  auth: "admin"
29679
29808
  });
@@ -33869,6 +33998,12 @@ Object.freeze({
33869
33998
  addonId: null,
33870
33999
  access: "create"
33871
34000
  },
34001
+ "failureContribution.list": {
34002
+ capName: "failure-contribution",
34003
+ capScope: "system",
34004
+ addonId: null,
34005
+ access: "view"
34006
+ },
33872
34007
  "fanControl.setDirection": {
33873
34008
  capName: "fan-control",
33874
34009
  capScope: "device",
@@ -37175,6 +37310,12 @@ Object.freeze({
37175
37310
  addonId: null,
37176
37311
  access: "create"
37177
37312
  },
37313
+ "system.getFailureContributions": {
37314
+ capName: "system",
37315
+ capScope: "system",
37316
+ addonId: null,
37317
+ access: "view"
37318
+ },
37178
37319
  "system.getLoadContributions": {
37179
37320
  capName: "system",
37180
37321
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -13461,6 +13461,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
13461
13461
  limit: number().optional(),
13462
13462
  tags: record(string(), string()).optional()
13463
13463
  }), array(LogEntrySchema).readonly());
13464
+ /**
13465
+ * `failure-contribution` — the capability an addon reports its OWN losses
13466
+ * through, per camera, with the denominator attached. It stores nothing.
13467
+ *
13468
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
13469
+ *
13470
+ * `load-contribution` answers *what did this camera COST*. This answers *what
13471
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
13472
+ * copied: the contributor reports what it already knows, hub-main adds only
13473
+ * `addonId`, nothing needs global knowledge, and there is no central list for
13474
+ * somebody to forget to edit.
13475
+ *
13476
+ * They are not merged, because their invariants are opposites:
13477
+ *
13478
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
13479
+ * claim a camera cost nothing, which is a measurement nobody made;
13480
+ * - a `failure-contribution` zero is the **most valuable value on the
13481
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
13482
+ * and it is exactly what an absent entry cannot say.
13483
+ *
13484
+ * Putting a loss counter on a cost entry would also break the reconciliation
13485
+ * that gives `load-contribution` its point: contributions are subtracted from
13486
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
13487
+ * has no process.
13488
+ *
13489
+ * ## Why not a log line, since the counters already exist
13490
+ *
13491
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
13492
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
13493
+ * ends in a log line, and a log line is the thing the operator asked to stop
13494
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
13495
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
13496
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
13497
+ * media blackout were both diagnosed. The counters stay; this is where they can
13498
+ * be READ.
13499
+ *
13500
+ * ## The rate is served with its denominator or not at all
13501
+ *
13502
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
13503
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
13504
+ * than yesterday" and was **flat across twelve hours** once divided by the
13505
+ * successes on the same path. A surface that publishes only the numerator
13506
+ * reproduces that mistake on every read.
13507
+ *
13508
+ * ## Shape
13509
+ *
13510
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
13511
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
13512
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
13513
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
13514
+ * a forked runner's entries reach hub-main over transport that already exists.
13515
+ * No new UDS message, no second registry (D3). The operator reads the assembled
13516
+ * result through `system.getFailureContributions`.
13517
+ */
13518
+ var FailureReasonCountSchema = object({
13519
+ /**
13520
+ * Why the attempt did not land, in the contributor's own vocabulary —
13521
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
13522
+ * strings that already appear in this repo's logs and, where one exists, the
13523
+ * same string the per-track `previewMissReason` records (D276): a second
13524
+ * vocabulary for the same loss would make the row and the counter
13525
+ * un-joinable.
13526
+ */
13527
+ reason: string(),
13528
+ count: number().int().nonnegative()
13529
+ });
13530
+ var FailureContributionSchema = object({
13531
+ /**
13532
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
13533
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
13534
+ * `unit` free: the families are owned by different addons and a shared enum
13535
+ * is a central list that rots invisibly.
13536
+ */
13537
+ family: string(),
13538
+ /**
13539
+ * The NUMERIC device id — the same value every log line carries as
13540
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
13541
+ * cannot name the camera must not emit the entry, because a fleet total
13542
+ * cannot answer the only question anybody asks of this surface.
13543
+ */
13544
+ deviceId: number().int().positive(),
13545
+ /**
13546
+ * A second dimension inside the family: the model / step id for an inference
13547
+ * timeout, so "which camera AND which model" is one read. Absent when the
13548
+ * family has a single variant.
13549
+ */
13550
+ variant: string().optional(),
13551
+ /**
13552
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
13553
+ * differencing two reads must drop the interval when it changes, because the
13554
+ * counter restarted from zero in a respawned runner. Same discipline as
13555
+ * `LoadContribution.startedAtMs`.
13556
+ */
13557
+ sinceMs: number(),
13558
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
13559
+ atMs: number(),
13560
+ /**
13561
+ * THE DENOMINATOR — every attempt on this path for this camera in the
13562
+ * window. A failure count published without it is the mistake this schema
13563
+ * exists to make impossible.
13564
+ */
13565
+ attempts: number().int().nonnegative(),
13566
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
13567
+ succeeded: number().int().nonnegative(),
13568
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
13569
+ reasons: array(FailureReasonCountSchema).readonly()
13570
+ });
13571
+ method(_void(), array(FailureContributionSchema).readonly());
13464
13572
  var LoadContributionSchema = object({
13465
13573
  role: _enum([
13466
13574
  "decode",
@@ -18051,6 +18159,20 @@ var TrackSchema = object({
18051
18159
  * `=== true` and render nothing otherwise — never infer "no rider".
18052
18160
  */
18053
18161
  hasRider: boolean().optional(),
18162
+ /**
18163
+ * WHY this track ended without a NATIVE best-shot tile
18164
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
18165
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
18166
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
18167
+ * the late-keyFrame upgrade when a native tile lands after all. The
18168
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
18169
+ * tile is a face/plate stand-in, a raster crop, or an icon.
18170
+ *
18171
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
18172
+ * that predates the field, and every track whose tile landed native all
18173
+ * omit it. Render nothing when absent.
18174
+ */
18175
+ previewMissReason: string().optional(),
18054
18176
  ...TrackFlagFields,
18055
18177
  ...TrackRetrainFields
18056
18178
  });
@@ -29616,6 +29738,13 @@ var LoggingSettingsPatchSchema = object({
29616
29738
  * anyone but its owner.
29617
29739
  */
29618
29740
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
29741
+ /**
29742
+ * One per-camera failure counter, plus WHO reported it.
29743
+ *
29744
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
29745
+ * the hub as it enumerates providers, never by the contributor.
29746
+ */
29747
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
29619
29748
  var GetLoggingSettingsInputSchema = object({
29620
29749
  scopeNodeId: string().optional(),
29621
29750
  /**
@@ -29674,7 +29803,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
29674
29803
  }), method(_void(), SiteLocationStatusSchema, {
29675
29804
  kind: "mutation",
29676
29805
  auth: "admin"
29677
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
29806
+ }), 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, {
29678
29807
  kind: "mutation",
29679
29808
  auth: "admin"
29680
29809
  });
@@ -33870,6 +33999,12 @@ Object.freeze({
33870
33999
  addonId: null,
33871
34000
  access: "create"
33872
34001
  },
34002
+ "failureContribution.list": {
34003
+ capName: "failure-contribution",
34004
+ capScope: "system",
34005
+ addonId: null,
34006
+ access: "view"
34007
+ },
33873
34008
  "fanControl.setDirection": {
33874
34009
  capName: "fan-control",
33875
34010
  capScope: "device",
@@ -37176,6 +37311,12 @@ Object.freeze({
37176
37311
  addonId: null,
37177
37312
  access: "create"
37178
37313
  },
37314
+ "system.getFailureContributions": {
37315
+ capName: "system",
37316
+ capScope: "system",
37317
+ addonId: null,
37318
+ access: "view"
37319
+ },
37179
37320
  "system.getLoadContributions": {
37180
37321
  capName: "system",
37181
37322
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-amcrest",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "description": "Amcrest/Dahua camera device provider addon for CamStack — Dahua CGI over HTTP(S) with digest auth (snapshot, RTSP catalog, PTZ, image/day-night config)",
5
5
  "keywords": [
6
6
  "camstack",