@camstack/addon-provider-petkit 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
@@ -14586,6 +14586,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14586
14586
  limit: number().optional(),
14587
14587
  tags: record(string(), string()).optional()
14588
14588
  }), array(LogEntrySchema).readonly());
14589
+ /**
14590
+ * `failure-contribution` — the capability an addon reports its OWN losses
14591
+ * through, per camera, with the denominator attached. It stores nothing.
14592
+ *
14593
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
14594
+ *
14595
+ * `load-contribution` answers *what did this camera COST*. This answers *what
14596
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
14597
+ * copied: the contributor reports what it already knows, hub-main adds only
14598
+ * `addonId`, nothing needs global knowledge, and there is no central list for
14599
+ * somebody to forget to edit.
14600
+ *
14601
+ * They are not merged, because their invariants are opposites:
14602
+ *
14603
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
14604
+ * claim a camera cost nothing, which is a measurement nobody made;
14605
+ * - a `failure-contribution` zero is the **most valuable value on the
14606
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14607
+ * and it is exactly what an absent entry cannot say.
14608
+ *
14609
+ * Putting a loss counter on a cost entry would also break the reconciliation
14610
+ * that gives `load-contribution` its point: contributions are subtracted from
14611
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14612
+ * has no process.
14613
+ *
14614
+ * ## Why not a log line, since the counters already exist
14615
+ *
14616
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
14617
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14618
+ * ends in a log line, and a log line is the thing the operator asked to stop
14619
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14620
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14621
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14622
+ * media blackout were both diagnosed. The counters stay; this is where they can
14623
+ * be READ.
14624
+ *
14625
+ * ## The rate is served with its denominator or not at all
14626
+ *
14627
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
14628
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14629
+ * than yesterday" and was **flat across twelve hours** once divided by the
14630
+ * successes on the same path. A surface that publishes only the numerator
14631
+ * reproduces that mistake on every read.
14632
+ *
14633
+ * ## Shape
14634
+ *
14635
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14636
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14637
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14638
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14639
+ * a forked runner's entries reach hub-main over transport that already exists.
14640
+ * No new UDS message, no second registry (D3). The operator reads the assembled
14641
+ * result through `system.getFailureContributions`.
14642
+ */
14643
+ var FailureReasonCountSchema = object({
14644
+ /**
14645
+ * Why the attempt did not land, in the contributor's own vocabulary —
14646
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14647
+ * strings that already appear in this repo's logs and, where one exists, the
14648
+ * same string the per-track `previewMissReason` records (D276): a second
14649
+ * vocabulary for the same loss would make the row and the counter
14650
+ * un-joinable.
14651
+ */
14652
+ reason: string(),
14653
+ count: number().int().nonnegative()
14654
+ });
14655
+ var FailureContributionSchema = object({
14656
+ /**
14657
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14658
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14659
+ * `unit` free: the families are owned by different addons and a shared enum
14660
+ * is a central list that rots invisibly.
14661
+ */
14662
+ family: string(),
14663
+ /**
14664
+ * The NUMERIC device id — the same value every log line carries as
14665
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
14666
+ * cannot name the camera must not emit the entry, because a fleet total
14667
+ * cannot answer the only question anybody asks of this surface.
14668
+ */
14669
+ deviceId: number().int().positive(),
14670
+ /**
14671
+ * A second dimension inside the family: the model / step id for an inference
14672
+ * timeout, so "which camera AND which model" is one read. Absent when the
14673
+ * family has a single variant.
14674
+ */
14675
+ variant: string().optional(),
14676
+ /**
14677
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14678
+ * differencing two reads must drop the interval when it changes, because the
14679
+ * counter restarted from zero in a respawned runner. Same discipline as
14680
+ * `LoadContribution.startedAtMs`.
14681
+ */
14682
+ sinceMs: number(),
14683
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14684
+ atMs: number(),
14685
+ /**
14686
+ * THE DENOMINATOR — every attempt on this path for this camera in the
14687
+ * window. A failure count published without it is the mistake this schema
14688
+ * exists to make impossible.
14689
+ */
14690
+ attempts: number().int().nonnegative(),
14691
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
14692
+ succeeded: number().int().nonnegative(),
14693
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
14694
+ reasons: array(FailureReasonCountSchema).readonly()
14695
+ });
14696
+ method(_void(), array(FailureContributionSchema).readonly());
14589
14697
  var LoadContributionSchema = object({
14590
14698
  role: _enum([
14591
14699
  "decode",
@@ -19176,6 +19284,20 @@ var TrackSchema = object({
19176
19284
  * `=== true` and render nothing otherwise — never infer "no rider".
19177
19285
  */
19178
19286
  hasRider: boolean().optional(),
19287
+ /**
19288
+ * WHY this track ended without a NATIVE best-shot tile
19289
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
19290
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
19291
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
19292
+ * the late-keyFrame upgrade when a native tile lands after all. The
19293
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
19294
+ * tile is a face/plate stand-in, a raster crop, or an icon.
19295
+ *
19296
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
19297
+ * that predates the field, and every track whose tile landed native all
19298
+ * omit it. Render nothing when absent.
19299
+ */
19300
+ previewMissReason: string().optional(),
19179
19301
  ...TrackFlagFields,
19180
19302
  ...TrackRetrainFields
19181
19303
  });
@@ -30359,6 +30481,13 @@ var LoggingSettingsPatchSchema = object({
30359
30481
  * anyone but its owner.
30360
30482
  */
30361
30483
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
30484
+ /**
30485
+ * One per-camera failure counter, plus WHO reported it.
30486
+ *
30487
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30488
+ * the hub as it enumerates providers, never by the contributor.
30489
+ */
30490
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
30362
30491
  var GetLoggingSettingsInputSchema = object({
30363
30492
  scopeNodeId: string().optional(),
30364
30493
  /**
@@ -30417,7 +30546,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
30417
30546
  }), method(_void(), SiteLocationStatusSchema, {
30418
30547
  kind: "mutation",
30419
30548
  auth: "admin"
30420
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30549
+ }), 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, {
30421
30550
  kind: "mutation",
30422
30551
  auth: "admin"
30423
30552
  });
@@ -34407,6 +34536,12 @@ Object.freeze({
34407
34536
  addonId: null,
34408
34537
  access: "create"
34409
34538
  },
34539
+ "failureContribution.list": {
34540
+ capName: "failure-contribution",
34541
+ capScope: "system",
34542
+ addonId: null,
34543
+ access: "view"
34544
+ },
34410
34545
  "fanControl.setDirection": {
34411
34546
  capName: "fan-control",
34412
34547
  capScope: "device",
@@ -37713,6 +37848,12 @@ Object.freeze({
37713
37848
  addonId: null,
37714
37849
  access: "create"
37715
37850
  },
37851
+ "system.getFailureContributions": {
37852
+ capName: "system",
37853
+ capScope: "system",
37854
+ addonId: null,
37855
+ access: "view"
37856
+ },
37716
37857
  "system.getLoadContributions": {
37717
37858
  capName: "system",
37718
37859
  capScope: "system",
package/dist/addon.mjs CHANGED
@@ -14585,6 +14585,114 @@ method(LogEntrySchema, _void(), { kind: "mutation" }), method(object({
14585
14585
  limit: number().optional(),
14586
14586
  tags: record(string(), string()).optional()
14587
14587
  }), array(LogEntrySchema).readonly());
14588
+ /**
14589
+ * `failure-contribution` — the capability an addon reports its OWN losses
14590
+ * through, per camera, with the denominator attached. It stores nothing.
14591
+ *
14592
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
14593
+ *
14594
+ * `load-contribution` answers *what did this camera COST*. This answers *what
14595
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
14596
+ * copied: the contributor reports what it already knows, hub-main adds only
14597
+ * `addonId`, nothing needs global knowledge, and there is no central list for
14598
+ * somebody to forget to edit.
14599
+ *
14600
+ * They are not merged, because their invariants are opposites:
14601
+ *
14602
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
14603
+ * claim a camera cost nothing, which is a measurement nobody made;
14604
+ * - a `failure-contribution` zero is the **most valuable value on the
14605
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
14606
+ * and it is exactly what an absent entry cannot say.
14607
+ *
14608
+ * Putting a loss counter on a cost entry would also break the reconciliation
14609
+ * that gives `load-contribution` its point: contributions are subtracted from
14610
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
14611
+ * has no process.
14612
+ *
14613
+ * ## Why not a log line, since the counters already exist
14614
+ *
14615
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
14616
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
14617
+ * ends in a log line, and a log line is the thing the operator asked to stop
14618
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
14619
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
14620
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
14621
+ * media blackout were both diagnosed. The counters stay; this is where they can
14622
+ * be READ.
14623
+ *
14624
+ * ## The rate is served with its denominator or not at all
14625
+ *
14626
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
14627
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
14628
+ * than yesterday" and was **flat across twelve hours** once divided by the
14629
+ * successes on the same path. A surface that publishes only the numerator
14630
+ * reproduces that mistake on every read.
14631
+ *
14632
+ * ## Shape
14633
+ *
14634
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
14635
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
14636
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
14637
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
14638
+ * a forked runner's entries reach hub-main over transport that already exists.
14639
+ * No new UDS message, no second registry (D3). The operator reads the assembled
14640
+ * result through `system.getFailureContributions`.
14641
+ */
14642
+ var FailureReasonCountSchema = object({
14643
+ /**
14644
+ * Why the attempt did not land, in the contributor's own vocabulary —
14645
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
14646
+ * strings that already appear in this repo's logs and, where one exists, the
14647
+ * same string the per-track `previewMissReason` records (D276): a second
14648
+ * vocabulary for the same loss would make the row and the counter
14649
+ * un-joinable.
14650
+ */
14651
+ reason: string(),
14652
+ count: number().int().nonnegative()
14653
+ });
14654
+ var FailureContributionSchema = object({
14655
+ /**
14656
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
14657
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
14658
+ * `unit` free: the families are owned by different addons and a shared enum
14659
+ * is a central list that rots invisibly.
14660
+ */
14661
+ family: string(),
14662
+ /**
14663
+ * The NUMERIC device id — the same value every log line carries as
14664
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
14665
+ * cannot name the camera must not emit the entry, because a fleet total
14666
+ * cannot answer the only question anybody asks of this surface.
14667
+ */
14668
+ deviceId: number().int().positive(),
14669
+ /**
14670
+ * A second dimension inside the family: the model / step id for an inference
14671
+ * timeout, so "which camera AND which model" is one read. Absent when the
14672
+ * family has a single variant.
14673
+ */
14674
+ variant: string().optional(),
14675
+ /**
14676
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
14677
+ * differencing two reads must drop the interval when it changes, because the
14678
+ * counter restarted from zero in a respawned runner. Same discipline as
14679
+ * `LoadContribution.startedAtMs`.
14680
+ */
14681
+ sinceMs: number(),
14682
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
14683
+ atMs: number(),
14684
+ /**
14685
+ * THE DENOMINATOR — every attempt on this path for this camera in the
14686
+ * window. A failure count published without it is the mistake this schema
14687
+ * exists to make impossible.
14688
+ */
14689
+ attempts: number().int().nonnegative(),
14690
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
14691
+ succeeded: number().int().nonnegative(),
14692
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
14693
+ reasons: array(FailureReasonCountSchema).readonly()
14694
+ });
14695
+ method(_void(), array(FailureContributionSchema).readonly());
14588
14696
  var LoadContributionSchema = object({
14589
14697
  role: _enum([
14590
14698
  "decode",
@@ -19175,6 +19283,20 @@ var TrackSchema = object({
19175
19283
  * `=== true` and render nothing otherwise — never infer "no rider".
19176
19284
  */
19177
19285
  hasRider: boolean().optional(),
19286
+ /**
19287
+ * WHY this track ended without a NATIVE best-shot tile
19288
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
19289
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
19290
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
19291
+ * the late-keyFrame upgrade when a native tile lands after all. The
19292
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
19293
+ * tile is a face/plate stand-in, a raster crop, or an icon.
19294
+ *
19295
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
19296
+ * that predates the field, and every track whose tile landed native all
19297
+ * omit it. Render nothing when absent.
19298
+ */
19299
+ previewMissReason: string().optional(),
19178
19300
  ...TrackFlagFields,
19179
19301
  ...TrackRetrainFields
19180
19302
  });
@@ -30358,6 +30480,13 @@ var LoggingSettingsPatchSchema = object({
30358
30480
  * anyone but its owner.
30359
30481
  */
30360
30482
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: string() });
30483
+ /**
30484
+ * One per-camera failure counter, plus WHO reported it.
30485
+ *
30486
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30487
+ * the hub as it enumerates providers, never by the contributor.
30488
+ */
30489
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: string() });
30361
30490
  var GetLoggingSettingsInputSchema = object({
30362
30491
  scopeNodeId: string().optional(),
30363
30492
  /**
@@ -30416,7 +30545,7 @@ method(_void(), FeatureManifestSchema), method(_void(), HealthStatusSchema), met
30416
30545
  }), method(_void(), SiteLocationStatusSchema, {
30417
30546
  kind: "mutation",
30418
30547
  auth: "admin"
30419
- }), method(_void(), RequestCensusStatusSchema, { auth: "admin" }), method(_void(), array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }), method(GetLoggingSettingsInputSchema, LoggingSettingsStateSchema, { auth: "admin" }), method(SetLoggingSettingsInputSchema, LoggingSettingsStateSchema, {
30548
+ }), 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, {
30420
30549
  kind: "mutation",
30421
30550
  auth: "admin"
30422
30551
  });
@@ -34406,6 +34535,12 @@ Object.freeze({
34406
34535
  addonId: null,
34407
34536
  access: "create"
34408
34537
  },
34538
+ "failureContribution.list": {
34539
+ capName: "failure-contribution",
34540
+ capScope: "system",
34541
+ addonId: null,
34542
+ access: "view"
34543
+ },
34409
34544
  "fanControl.setDirection": {
34410
34545
  capName: "fan-control",
34411
34546
  capScope: "device",
@@ -37712,6 +37847,12 @@ Object.freeze({
37712
37847
  addonId: null,
37713
37848
  access: "create"
37714
37849
  },
37850
+ "system.getFailureContributions": {
37851
+ capName: "system",
37852
+ capScope: "system",
37853
+ addonId: null,
37854
+ access: "view"
37855
+ },
37715
37856
  "system.getLoadContributions": {
37716
37857
  capName: "system",
37717
37858
  capScope: "system",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@camstack/addon-provider-petkit",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "description": "PetKit smart-feeder device-provider addon for CamStack — wraps the @apocaliss92/nodepetkit PetKit cloud client",
5
5
  "keywords": [
6
6
  "camstack",