@camstack/system 1.2.149 → 1.2.151

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.
Files changed (57) hide show
  1. package/dist/addon-runner.js +1 -1
  2. package/dist/addon-runner.mjs +1 -1
  3. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  4. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  5. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/alerts/alerts.addon.js +1 -1
  8. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  9. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +1 -1
  10. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +1 -1
  11. package/dist/builtins/console-logging/index.js +1 -1
  12. package/dist/builtins/console-logging/index.mjs +1 -1
  13. package/dist/builtins/core-blocks/core-blocks.addon.js +1 -1
  14. package/dist/builtins/core-blocks/core-blocks.addon.mjs +1 -1
  15. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  16. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  17. package/dist/builtins/doorbell/virtual-doorbell.addon.js +1 -1
  18. package/dist/builtins/doorbell/virtual-doorbell.addon.mjs +1 -1
  19. package/dist/builtins/hub-forwarder/index.js +1 -1
  20. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  21. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  22. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  23. package/dist/builtins/local-auth/local-auth.addon.js +1 -1
  24. package/dist/builtins/local-auth/local-auth.addon.mjs +1 -1
  25. package/dist/builtins/local-network/local-network.addon.js +1 -1
  26. package/dist/builtins/local-network/local-network.addon.mjs +1 -1
  27. package/dist/builtins/loki-logging/index.js +1 -1
  28. package/dist/builtins/loki-logging/index.mjs +1 -1
  29. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  30. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  31. package/dist/builtins/platform-probe/index.js +1 -1
  32. package/dist/builtins/platform-probe/index.mjs +1 -1
  33. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  34. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  35. package/dist/builtins/snapshot/index.js +1 -1
  36. package/dist/builtins/snapshot/index.mjs +1 -1
  37. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  38. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  39. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
  40. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
  41. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  42. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  43. package/dist/builtins/system-config/system-config.addon.js +1 -1
  44. package/dist/builtins/system-config/system-config.addon.mjs +1 -1
  45. package/dist/builtins/winston-logging/index.js +1 -1
  46. package/dist/builtins/winston-logging/index.mjs +1 -1
  47. package/dist/{dist-DdEXjTDo.js → dist-CImxMt5h.js} +183 -0
  48. package/dist/{dist-CZWAU40-.mjs → dist-CbRciAbu.mjs} +183 -0
  49. package/dist/index.d.ts +2 -2
  50. package/dist/index.js +4 -2
  51. package/dist/index.mjs +3 -3
  52. package/dist/kernel/heap-watch.d.ts +71 -0
  53. package/dist/{manifest-python-deps-CivtrAha.js → manifest-python-deps-BqWrDjSN.js} +72 -2
  54. package/dist/{manifest-python-deps-HFh_iE0E.mjs → manifest-python-deps-DuQ3Uqoq.mjs} +61 -3
  55. package/dist/{retired-settings-keys-BXaTgLyZ.js → retired-settings-keys-C7gLUS3x.js} +1 -1
  56. package/dist/{retired-settings-keys-BynPjBHV.mjs → retired-settings-keys-DhFPXIRD.mjs} +1 -1
  57. package/package.json +1 -1
@@ -11607,6 +11607,133 @@ var logDestinationCapability = {
11607
11607
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
11608
11608
  mount: { kind: "skip" }
11609
11609
  };
11610
+ /**
11611
+ * `failure-contribution` — the capability an addon reports its OWN losses
11612
+ * through, per camera, with the denominator attached. It stores nothing.
11613
+ *
11614
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
11615
+ *
11616
+ * `load-contribution` answers *what did this camera COST*. This answers *what
11617
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
11618
+ * copied: the contributor reports what it already knows, hub-main adds only
11619
+ * `addonId`, nothing needs global knowledge, and there is no central list for
11620
+ * somebody to forget to edit.
11621
+ *
11622
+ * They are not merged, because their invariants are opposites:
11623
+ *
11624
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
11625
+ * claim a camera cost nothing, which is a measurement nobody made;
11626
+ * - a `failure-contribution` zero is the **most valuable value on the
11627
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
11628
+ * and it is exactly what an absent entry cannot say.
11629
+ *
11630
+ * Putting a loss counter on a cost entry would also break the reconciliation
11631
+ * that gives `load-contribution` its point: contributions are subtracted from
11632
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
11633
+ * has no process.
11634
+ *
11635
+ * ## Why not a log line, since the counters already exist
11636
+ *
11637
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
11638
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
11639
+ * ends in a log line, and a log line is the thing the operator asked to stop
11640
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
11641
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
11642
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
11643
+ * media blackout were both diagnosed. The counters stay; this is where they can
11644
+ * be READ.
11645
+ *
11646
+ * ## The rate is served with its denominator or not at all
11647
+ *
11648
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
11649
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
11650
+ * than yesterday" and was **flat across twelve hours** once divided by the
11651
+ * successes on the same path. A surface that publishes only the numerator
11652
+ * reproduces that mistake on every read.
11653
+ *
11654
+ * ## Shape
11655
+ *
11656
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
11657
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
11658
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
11659
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
11660
+ * a forked runner's entries reach hub-main over transport that already exists.
11661
+ * No new UDS message, no second registry (D3). The operator reads the assembled
11662
+ * result through `system.getFailureContributions`.
11663
+ */
11664
+ var FailureReasonCountSchema = zod.z.object({
11665
+ /**
11666
+ * Why the attempt did not land, in the contributor's own vocabulary —
11667
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
11668
+ * strings that already appear in this repo's logs and, where one exists, the
11669
+ * same string the per-track `previewMissReason` records (D276): a second
11670
+ * vocabulary for the same loss would make the row and the counter
11671
+ * un-joinable.
11672
+ */
11673
+ reason: zod.z.string(),
11674
+ count: zod.z.number().int().nonnegative()
11675
+ });
11676
+ var FailureContributionSchema = zod.z.object({
11677
+ /**
11678
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
11679
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
11680
+ * `unit` free: the families are owned by different addons and a shared enum
11681
+ * is a central list that rots invisibly.
11682
+ */
11683
+ family: zod.z.string(),
11684
+ /**
11685
+ * The NUMERIC device id — the same value every log line carries as
11686
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
11687
+ * cannot name the camera must not emit the entry, because a fleet total
11688
+ * cannot answer the only question anybody asks of this surface.
11689
+ */
11690
+ deviceId: zod.z.number().int().positive(),
11691
+ /**
11692
+ * A second dimension inside the family: the model / step id for an inference
11693
+ * timeout, so "which camera AND which model" is one read. Absent when the
11694
+ * family has a single variant.
11695
+ */
11696
+ variant: zod.z.string().optional(),
11697
+ /**
11698
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
11699
+ * differencing two reads must drop the interval when it changes, because the
11700
+ * counter restarted from zero in a respawned runner. Same discipline as
11701
+ * `LoadContribution.startedAtMs`.
11702
+ */
11703
+ sinceMs: zod.z.number(),
11704
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
11705
+ atMs: zod.z.number(),
11706
+ /**
11707
+ * THE DENOMINATOR — every attempt on this path for this camera in the
11708
+ * window. A failure count published without it is the mistake this schema
11709
+ * exists to make impossible.
11710
+ */
11711
+ attempts: zod.z.number().int().nonnegative(),
11712
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
11713
+ succeeded: zod.z.number().int().nonnegative(),
11714
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
11715
+ reasons: zod.z.array(FailureReasonCountSchema).readonly()
11716
+ });
11717
+ var failureContributionCapability = {
11718
+ name: "failure-contribution",
11719
+ scope: "system",
11720
+ mode: "collection",
11721
+ internal: true,
11722
+ methods: {
11723
+ /**
11724
+ * This addon's per-camera failure counters, read live from bounded in-RAM
11725
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
11726
+ *
11727
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
11728
+ * consumer that wants a rate differences two reads. A draining read would
11729
+ * make two operators with the page open each destroy half of the other's
11730
+ * numbers, and `load-contribution` already settled the same question the
11731
+ * same way for `cpuSeconds`.
11732
+ */
11733
+ list: method(zod.z.void(), zod.z.array(FailureContributionSchema).readonly()) },
11734
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11735
+ mount: { kind: "skip" }
11736
+ };
11610
11737
  var LoadContributionSchema = zod.z.object({
11611
11738
  role: zod.z.enum([
11612
11739
  "decode",
@@ -16717,6 +16844,20 @@ var TrackSchema = zod.z.object({
16717
16844
  * `=== true` and render nothing otherwise — never infer "no rider".
16718
16845
  */
16719
16846
  hasRider: zod.z.boolean().optional(),
16847
+ /**
16848
+ * WHY this track ended without a NATIVE best-shot tile
16849
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
16850
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
16851
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
16852
+ * the late-keyFrame upgrade when a native tile lands after all. The
16853
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
16854
+ * tile is a face/plate stand-in, a raster crop, or an icon.
16855
+ *
16856
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
16857
+ * that predates the field, and every track whose tile landed native all
16858
+ * omit it. Render nothing when absent.
16859
+ */
16860
+ previewMissReason: zod.z.string().optional(),
16720
16861
  ...TrackFlagFields,
16721
16862
  ...TrackRetrainFields
16722
16863
  });
@@ -30672,6 +30813,13 @@ var LoggingSettingsPatchSchema = zod.z.object({
30672
30813
  * anyone but its owner.
30673
30814
  */
30674
30815
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: zod.z.string() });
30816
+ /**
30817
+ * One per-camera failure counter, plus WHO reported it.
30818
+ *
30819
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30820
+ * the hub as it enumerates providers, never by the contributor.
30821
+ */
30822
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: zod.z.string() });
30675
30823
  var GetLoggingSettingsInputSchema = zod.z.object({
30676
30824
  scopeNodeId: zod.z.string().optional(),
30677
30825
  /**
@@ -30790,6 +30938,28 @@ var systemCapability = {
30790
30938
  */
30791
30939
  getLoadContributions: method(zod.z.void(), zod.z.array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }),
30792
30940
  /**
30941
+ * Every `failure-contribution` an addon on this cluster reports — per
30942
+ * camera, per reason, **with the denominator attached**.
30943
+ *
30944
+ * This is the surface the operator asked for on 2026-08-28 (*"possiamo
30945
+ * armare questi errori intanto? Così al prossimo giro ricontrolliamo tutti
30946
+ * questi punti"*). Before it, four live failure modes could only be counted
30947
+ * by grepping Loki and hand-correlating timestamps, which is exactly how a
30948
+ * 22% thumbnail gap and a 3-hour media blackout were diagnosed — twice.
30949
+ *
30950
+ * Read it as a RATIO, never as a count. `attempts` is on every entry
30951
+ * because the count on its own lies: `enrichment crop native miss` read as
30952
+ * "35x worse than yesterday" and was flat across twelve hours once divided
30953
+ * by the successes on the same path.
30954
+ *
30955
+ * The counters are CUMULATIVE since each entry's `sinceMs`. Reading does
30956
+ * not reset them, and `sinceMs` changing means the reporting runner
30957
+ * respawned — a consumer differencing two reads drops that interval.
30958
+ *
30959
+ * Admin-only: the rows name cameras and the paths that fail on them.
30960
+ */
30961
+ getFailureContributions: method(zod.z.void(), zod.z.array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }),
30962
+ /**
30793
30963
  * The logging settings document — levels and armed diagnostics — resolved
30794
30964
  * for `nodeId`, or for the cluster when `nodeId` is absent.
30795
30965
  *
@@ -32574,6 +32744,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
32574
32744
  eventEmitterCapability,
32575
32745
  eventsCapability,
32576
32746
  faceGalleryCapability,
32747
+ failureContributionCapability,
32577
32748
  fanControlCapability,
32578
32749
  featureProbeCapability,
32579
32750
  filesystemBrowseCapability,
@@ -34578,6 +34749,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
34578
34749
  addonId: null,
34579
34750
  access: "create"
34580
34751
  },
34752
+ "failureContribution.list": {
34753
+ capName: "failure-contribution",
34754
+ capScope: "system",
34755
+ addonId: null,
34756
+ access: "view"
34757
+ },
34581
34758
  "fanControl.setDirection": {
34582
34759
  capName: "fan-control",
34583
34760
  capScope: "device",
@@ -37884,6 +38061,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
37884
38061
  addonId: null,
37885
38062
  access: "create"
37886
38063
  },
38064
+ "system.getFailureContributions": {
38065
+ capName: "system",
38066
+ capScope: "system",
38067
+ addonId: null,
38068
+ access: "view"
38069
+ },
37887
38070
  "system.getLoadContributions": {
37888
38071
  capName: "system",
37889
38072
  capScope: "system",
@@ -11607,6 +11607,133 @@ var logDestinationCapability = {
11607
11607
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
11608
11608
  mount: { kind: "skip" }
11609
11609
  };
11610
+ /**
11611
+ * `failure-contribution` — the capability an addon reports its OWN losses
11612
+ * through, per camera, with the denominator attached. It stores nothing.
11613
+ *
11614
+ * ## The twin of `load-contribution`, and why it is a twin and not a field
11615
+ *
11616
+ * `load-contribution` answers *what did this camera COST*. This answers *what
11617
+ * did this camera LOSE*. The reporting discipline is identical and deliberately
11618
+ * copied: the contributor reports what it already knows, hub-main adds only
11619
+ * `addonId`, nothing needs global knowledge, and there is no central list for
11620
+ * somebody to forget to edit.
11621
+ *
11622
+ * They are not merged, because their invariants are opposites:
11623
+ *
11624
+ * - a `load-contribution` measurement is **absent, never zero** — a zero would
11625
+ * claim a camera cost nothing, which is a measurement nobody made;
11626
+ * - a `failure-contribution` zero is the **most valuable value on the
11627
+ * surface** — `attempts: 400, succeeded: 400` is the proof a fix landed,
11628
+ * and it is exactly what an absent entry cannot say.
11629
+ *
11630
+ * Putting a loss counter on a cost entry would also break the reconciliation
11631
+ * that gives `load-contribution` its point: contributions are subtracted from
11632
+ * `metrics.node-processes-snapshot` to find processes nobody claims. A failure
11633
+ * has no process.
11634
+ *
11635
+ * ## Why not a log line, since the counters already exist
11636
+ *
11637
+ * Several of these paths already counted themselves — `CaptureScheduler`'s
11638
+ * per-device window, `KeyFrameCaptureLog`, `bumpCropMetric`. Every one of them
11639
+ * ends in a log line, and a log line is the thing the operator asked to stop
11640
+ * needing: *"possiamo armare questi errori intanto? Così al prossimo giro
11641
+ * ricontrolliamo tutti questi punti"*. Reading them meant grepping Loki and
11642
+ * hand-correlating timestamps, which is how a 22% thumbnail gap and a 3-hour
11643
+ * media blackout were both diagnosed. The counters stay; this is where they can
11644
+ * be READ.
11645
+ *
11646
+ * ## The rate is served with its denominator or not at all
11647
+ *
11648
+ * Every entry carries `attempts` and `succeeded`. A miss count alone is
11649
+ * unreadable: on 2026-08-28 the enrichment-crop miss count read as "35x worse
11650
+ * than yesterday" and was **flat across twelve hours** once divided by the
11651
+ * successes on the same path. A surface that publishes only the numerator
11652
+ * reproduces that mistake on every read.
11653
+ *
11654
+ * ## Shape
11655
+ *
11656
+ * Copied from `load-contribution.cap.ts` (`mode: 'collection'`,
11657
+ * `internal: true`, `mount: { kind: 'skip' }`): no tRPC route of its own and no
11658
+ * generated hooks, while `addons.listCapabilityProviders` still enumerates it
11659
+ * and the hub's `CapabilityRegistry` still holds an RPC proxy per provider — so
11660
+ * a forked runner's entries reach hub-main over transport that already exists.
11661
+ * No new UDS message, no second registry (D3). The operator reads the assembled
11662
+ * result through `system.getFailureContributions`.
11663
+ */
11664
+ var FailureReasonCountSchema = z.object({
11665
+ /**
11666
+ * Why the attempt did not land, in the contributor's own vocabulary —
11667
+ * `worker-lease-gone`, `queue-overflow`, `timeout`, `empty-read`. The same
11668
+ * strings that already appear in this repo's logs and, where one exists, the
11669
+ * same string the per-track `previewMissReason` records (D276): a second
11670
+ * vocabulary for the same loss would make the row and the counter
11671
+ * un-joinable.
11672
+ */
11673
+ reason: z.string(),
11674
+ count: z.number().int().nonnegative()
11675
+ });
11676
+ var FailureContributionSchema = z.object({
11677
+ /**
11678
+ * The failing path — `enrichment-crop`, `inference`, `plate-ocr`,
11679
+ * `person-over-vehicle`. Free text, for the reason `load-contribution` keeps
11680
+ * `unit` free: the families are owned by different addons and a shared enum
11681
+ * is a central list that rots invisibly.
11682
+ */
11683
+ family: z.string(),
11684
+ /**
11685
+ * The NUMERIC device id — the same value every log line carries as
11686
+ * `tags.deviceId`. Never nullable and never absent: a contributor that
11687
+ * cannot name the camera must not emit the entry, because a fleet total
11688
+ * cannot answer the only question anybody asks of this surface.
11689
+ */
11690
+ deviceId: z.number().int().positive(),
11691
+ /**
11692
+ * A second dimension inside the family: the model / step id for an inference
11693
+ * timeout, so "which camera AND which model" is one read. Absent when the
11694
+ * family has a single variant.
11695
+ */
11696
+ variant: z.string().optional(),
11697
+ /**
11698
+ * Epoch ms this counter started — the INCARNATION MARKER. A consumer
11699
+ * differencing two reads must drop the interval when it changes, because the
11700
+ * counter restarted from zero in a respawned runner. Same discipline as
11701
+ * `LoadContribution.startedAtMs`.
11702
+ */
11703
+ sinceMs: z.number(),
11704
+ /** Epoch ms it was read. `atMs - sinceMs` is the interval this covers. */
11705
+ atMs: z.number(),
11706
+ /**
11707
+ * THE DENOMINATOR — every attempt on this path for this camera in the
11708
+ * window. A failure count published without it is the mistake this schema
11709
+ * exists to make impossible.
11710
+ */
11711
+ attempts: z.number().int().nonnegative(),
11712
+ /** Attempts that landed. `attempts - succeeded` is the loss. */
11713
+ succeeded: z.number().int().nonnegative(),
11714
+ /** The loss, partitioned. Sums to `attempts - succeeded`. */
11715
+ reasons: z.array(FailureReasonCountSchema).readonly()
11716
+ });
11717
+ var failureContributionCapability = {
11718
+ name: "failure-contribution",
11719
+ scope: "system",
11720
+ mode: "collection",
11721
+ internal: true,
11722
+ methods: {
11723
+ /**
11724
+ * This addon's per-camera failure counters, read live from bounded in-RAM
11725
+ * state it already keeps. Inert: no persistence, no sampling, no timer.
11726
+ *
11727
+ * READING NEVER RESETS. The counters are CUMULATIVE since `sinceMs`, and a
11728
+ * consumer that wants a rate differences two reads. A draining read would
11729
+ * make two operators with the page open each destroy half of the other's
11730
+ * numbers, and `load-contribution` already settled the same question the
11731
+ * same way for `cpuSeconds`.
11732
+ */
11733
+ list: method(z.void(), z.array(FailureContributionSchema).readonly()) },
11734
+ /** In-process only — enumerated through `addons.listCapabilityProviders`. */
11735
+ mount: { kind: "skip" }
11736
+ };
11610
11737
  var LoadContributionSchema = z.object({
11611
11738
  role: z.enum([
11612
11739
  "decode",
@@ -16717,6 +16844,20 @@ var TrackSchema = z.object({
16717
16844
  * `=== true` and render nothing otherwise — never infer "no rider".
16718
16845
  */
16719
16846
  hasRider: z.boolean().optional(),
16847
+ /**
16848
+ * WHY this track ended without a NATIVE best-shot tile
16849
+ * ([D276](../decisions/adr-0276-a-stand-in-tile-is-provisional-and-a-close-says-why.md)) —
16850
+ * a composed token line (`no-key-frame capture=keyframe:native-missx4`,
16851
+ * `derive-returned-null tile=standin`, …) written at close and CLEARED by
16852
+ * the late-keyFrame upgrade when a native tile lands after all. The
16853
+ * operator-facing answer to "perché manca l'immagine?" on a track whose
16854
+ * tile is a face/plate stand-in, a raster crop, or an icon.
16855
+ *
16856
+ * **Absent ≠ "missed silently"**: a row written before the column, a hub
16857
+ * that predates the field, and every track whose tile landed native all
16858
+ * omit it. Render nothing when absent.
16859
+ */
16860
+ previewMissReason: z.string().optional(),
16720
16861
  ...TrackFlagFields,
16721
16862
  ...TrackRetrainFields
16722
16863
  });
@@ -30672,6 +30813,13 @@ var LoggingSettingsPatchSchema = z.object({
30672
30813
  * anyone but its owner.
30673
30814
  */
30674
30815
  var ReportedLoadContributionSchema = LoadContributionSchema.extend({ addonId: z.string() });
30816
+ /**
30817
+ * One per-camera failure counter, plus WHO reported it.
30818
+ *
30819
+ * Same rule as {@link ReportedLoadContributionSchema}: `addonId` is stamped by
30820
+ * the hub as it enumerates providers, never by the contributor.
30821
+ */
30822
+ var ReportedFailureContributionSchema = FailureContributionSchema.extend({ addonId: z.string() });
30675
30823
  var GetLoggingSettingsInputSchema = z.object({
30676
30824
  scopeNodeId: z.string().optional(),
30677
30825
  /**
@@ -30790,6 +30938,28 @@ var systemCapability = {
30790
30938
  */
30791
30939
  getLoadContributions: method(z.void(), z.array(ReportedLoadContributionSchema).readonly(), { auth: "admin" }),
30792
30940
  /**
30941
+ * Every `failure-contribution` an addon on this cluster reports — per
30942
+ * camera, per reason, **with the denominator attached**.
30943
+ *
30944
+ * This is the surface the operator asked for on 2026-08-28 (*"possiamo
30945
+ * armare questi errori intanto? Così al prossimo giro ricontrolliamo tutti
30946
+ * questi punti"*). Before it, four live failure modes could only be counted
30947
+ * by grepping Loki and hand-correlating timestamps, which is exactly how a
30948
+ * 22% thumbnail gap and a 3-hour media blackout were diagnosed — twice.
30949
+ *
30950
+ * Read it as a RATIO, never as a count. `attempts` is on every entry
30951
+ * because the count on its own lies: `enrichment crop native miss` read as
30952
+ * "35x worse than yesterday" and was flat across twelve hours once divided
30953
+ * by the successes on the same path.
30954
+ *
30955
+ * The counters are CUMULATIVE since each entry's `sinceMs`. Reading does
30956
+ * not reset them, and `sinceMs` changing means the reporting runner
30957
+ * respawned — a consumer differencing two reads drops that interval.
30958
+ *
30959
+ * Admin-only: the rows name cameras and the paths that fail on them.
30960
+ */
30961
+ getFailureContributions: method(z.void(), z.array(ReportedFailureContributionSchema).readonly(), { auth: "admin" }),
30962
+ /**
30793
30963
  * The logging settings document — levels and armed diagnostics — resolved
30794
30964
  * for `nodeId`, or for the cluster when `nodeId` is absent.
30795
30965
  *
@@ -32574,6 +32744,7 @@ var ALL_CAPABILITY_DEFINITIONS = [
32574
32744
  eventEmitterCapability,
32575
32745
  eventsCapability,
32576
32746
  faceGalleryCapability,
32747
+ failureContributionCapability,
32577
32748
  fanControlCapability,
32578
32749
  featureProbeCapability,
32579
32750
  filesystemBrowseCapability,
@@ -34578,6 +34749,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
34578
34749
  addonId: null,
34579
34750
  access: "create"
34580
34751
  },
34752
+ "failureContribution.list": {
34753
+ capName: "failure-contribution",
34754
+ capScope: "system",
34755
+ addonId: null,
34756
+ access: "view"
34757
+ },
34581
34758
  "fanControl.setDirection": {
34582
34759
  capName: "fan-control",
34583
34760
  capScope: "device",
@@ -37884,6 +38061,12 @@ var METHOD_ACCESS_MAP = Object.freeze({
37884
38061
  addonId: null,
37885
38062
  access: "create"
37886
38063
  },
38064
+ "system.getFailureContributions": {
38065
+ capName: "system",
38066
+ capScope: "system",
38067
+ addonId: null,
38068
+ access: "view"
38069
+ },
37887
38070
  "system.getLoadContributions": {
37888
38071
  capName: "system",
37889
38072
  capScope: "system",
package/dist/index.d.ts CHANGED
@@ -46,8 +46,8 @@ export { createFileDataPlaneHandler } from './http/file-data-plane.js';
46
46
  export { allFamiliesListenHost, applyLanHttp, bindPendingLanHttp, closeLanHttp, DEFAULT_LAN_HTTP_PORT, readLanHttpState, registerLanHttpHandler, } from './http/lan-http-bind.js';
47
47
  export type { ReverseProxyOptions } from './http/reverse-proxy.js';
48
48
  export { proxyToUpstream } from './http/reverse-proxy.js';
49
- export type { HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, RssBreakdown, RssBudgetOptions, RssBudgetState, RssGrowthShape, RunnerHeapWatchOptions, } from './kernel/heap-watch.js';
50
- export { buildHeapSample, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, hubMainRssBudget, describeRss, nextRssBudgetState, parseRssBudgetMb, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, } from './kernel/heap-watch.js';
49
+ export type { DeferredHeapWatchSink, HeapReclaimer, HeapReclaimOptions, HeapSample, HeapWatchSink, RssBreakdown, RssBudgetOptions, RssBudgetState, RssGrowthShape, RunnerHeapWatchOptions, } from './kernel/heap-watch.js';
50
+ export { buildHeapSample, createDeferredHeapWatchSink, createV8Reclaimer, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, hubMainRssBudget, describeRss, nextRssBudgetState, parseRssBudgetMb, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, } from './kernel/heap-watch.js';
51
51
  export type { AddonDataPlaneFacility, DataPlaneSink, } from './kernel/moleculer/addon-data-plane-facility.js';
52
52
  export { createAddonDataPlaneFacility } from './kernel/moleculer/addon-data-plane-facility.js';
53
53
  export type { ElementState, ElementStatus, } from './lifecycle/lifecycle-state-machine.js';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-Cek0wNdY.js");
3
- const require_dist = require("./dist-DdEXjTDo.js");
3
+ const require_dist = require("./dist-CImxMt5h.js");
4
4
  const require_builtins_alerts_alerts_addon = require("./builtins/alerts/alerts.addon.js");
5
5
  require("./builtins/alerts/index.js");
6
6
  const require_formatter = require("./formatter-DqAKDlvN.js");
@@ -26,7 +26,7 @@ require("./builtins/system-config/index.js");
26
26
  const require_builtins_winston_logging_index = require("./builtins/winston-logging/index.js");
27
27
  const require_file_data_plane = require("./file-data-plane-DO8KbxCe.js");
28
28
  const require_tls$1 = require("./tls-u8QCJCFE.js");
29
- const require_manifest_python_deps = require("./manifest-python-deps-CivtrAha.js");
29
+ const require_manifest_python_deps = require("./manifest-python-deps-BqWrDjSN.js");
30
30
  const require_resource_monitor = require("./resource-monitor-CdnzxBLP.js");
31
31
  const require_custom_action_registry = require("./custom-action-registry-jY0NOZK8.js");
32
32
  let zod = require("zod");
@@ -95348,6 +95348,7 @@ exports.HEAP_WATCH_INTERVAL_MS = require_manifest_python_deps.HEAP_WATCH_INTERVA
95348
95348
  exports.HEAP_WATCH_WARN_RATIO = require_manifest_python_deps.HEAP_WATCH_WARN_RATIO;
95349
95349
  exports.HUB_CAP_FWD_ACTION = require_manifest_python_deps.HUB_CAP_FWD_ACTION;
95350
95350
  exports.HUB_CAP_FWD_SERVICE = require_manifest_python_deps.HUB_CAP_FWD_SERVICE;
95351
+ exports.HUB_MAIN_HEAP_WATCH_LABEL = require_manifest_python_deps.HUB_MAIN_HEAP_WATCH_LABEL;
95351
95352
  exports.HUB_MAIN_RSS_BUDGET_MB = require_manifest_python_deps.HUB_MAIN_RSS_BUDGET_MB;
95352
95353
  exports.HUB_RSS_BUDGET_ENV = require_manifest_python_deps.HUB_RSS_BUDGET_ENV;
95353
95354
  exports.HubForwarderAddon = require_builtins_hub_forwarder_index.HubForwarderAddon$1;
@@ -95468,6 +95469,7 @@ exports.createAuthenticatedFileServer = require_file_data_plane.createAuthentica
95468
95469
  exports.createBroker = createBroker;
95469
95470
  exports.createBrokerDeviceManagerApi = require_manifest_python_deps.createBrokerDeviceManagerApi;
95470
95471
  exports.createCoreCapService = createCoreCapService;
95472
+ exports.createDeferredHeapWatchSink = require_manifest_python_deps.createDeferredHeapWatchSink;
95471
95473
  exports.createDoorSettingsView = createDoorSettingsView;
95472
95474
  exports.createFileDataPlaneHandler = require_file_data_plane.createFileDataPlaneHandler;
95473
95475
  exports.createHubCapForwardService = require_manifest_python_deps.createHubCapForwardService;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM$1, r as __exportAll, t as __commonJSMin$1 } from "./chunk-CNf5ZN-e.mjs";
2
- import { $ as isVoidInput, $t as scopeKey, At as DATAPLANE_SECRET_HEADER$1, Bt as asNumber, C as addonSettingsCapability, G as extractNestedAddonId, Gt as expandCapMethods, Ht as createEvent, It as ReadinessRegistry, J as isArrayOutputSchema, Lt as ReadinessTimeoutError, Mt as DEVICE_STATUS_METHOD, Ot as errMsg$1, Qt as resolveCapMount, Ut as emitDownForOwnedCaps, Vt as asString$1, X as isObjectInput, Xt as parseJsonUnknown$1, Y as isCollectionArrayMethod, Yt as parseJsonObject, Zt as readinessKey, _t as scopesAllowDeviceCap, at as looseSchema, ct as objectInputDeclaresAddonId, dt as procedureAuthKey, et as kebabToCamel, f as LOG_LEVEL_RANK, gt as scopesAllowAddon, it as logLevelAtMost, jt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, m as RUNTIME_DEFAULTS, mt as resolveMethodAuth, p as METHOD_ACCESS_MAP, t as ALL_CAPABILITY_DEFINITIONS, tn as EventCategory$1, tt as lifecycleJobSchema, zt as asJsonObject$1 } from "./dist-CZWAU40-.mjs";
2
+ import { $ as isVoidInput, $t as scopeKey, At as DATAPLANE_SECRET_HEADER$1, Bt as asNumber, C as addonSettingsCapability, G as extractNestedAddonId, Gt as expandCapMethods, Ht as createEvent, It as ReadinessRegistry, J as isArrayOutputSchema, Lt as ReadinessTimeoutError, Mt as DEVICE_STATUS_METHOD, Ot as errMsg$1, Qt as resolveCapMount, Ut as emitDownForOwnedCaps, Vt as asString$1, X as isObjectInput, Xt as parseJsonUnknown$1, Y as isCollectionArrayMethod, Yt as parseJsonObject, Zt as readinessKey, _t as scopesAllowDeviceCap, at as looseSchema, ct as objectInputDeclaresAddonId, dt as procedureAuthKey, et as kebabToCamel, f as LOG_LEVEL_RANK, gt as scopesAllowAddon, it as logLevelAtMost, jt as DEVICE_SETTINGS_CONTRIBUTION_METHODS, m as RUNTIME_DEFAULTS, mt as resolveMethodAuth, p as METHOD_ACCESS_MAP, t as ALL_CAPABILITY_DEFINITIONS, tn as EventCategory$1, tt as lifecycleJobSchema, zt as asJsonObject$1 } from "./dist-CbRciAbu.mjs";
3
3
  import { AlertCenterAddon } from "./builtins/alerts/alerts.addon.mjs";
4
4
  import "./builtins/alerts/index.mjs";
5
5
  import { t as formatLogLine } from "./formatter-B7qW8bPJ.mjs";
@@ -25,7 +25,7 @@ import "./builtins/system-config/index.mjs";
25
25
  import { WinstonDestination, WinstonLoggingAddon } from "./builtins/winston-logging/index.mjs";
26
26
  import { a as parseTokenizedUrl, c as collectModelFiles, d as downloadModel, f as ensureModel, h as isModelDownloaded, i as parseRangeHeader, l as deleteModelFromDisk, m as getModelFilePath, n as contentTypeFor, o as resolveFilePath, p as fetchJson, r as createAuthenticatedFileServer, s as ModelDownloadService, t as createFileDataPlaneHandler, u as downloadFile } from "./file-data-plane-BhKdxJgf.mjs";
27
27
  import { C as registerLanHttpHandler, S as readLanHttpState, _ as DEFAULT_LAN_HTTP_PORT, a as writeTlsMode, b as bindPendingLanHttp, c as loadTlsCert, d as collectCertIdentity, f as CA_VALIDITY_DAYS, g as evaluateExistingCert, h as SERVER_AUTH_OID, i as writeExtraSans, l as reissueTlsLeaf, m as MAX_LEAF_VALIDITY_DAYS, n as readTlsAccessStatus, o as validateUploadedTls, p as LEAF_RENEWAL_WINDOW_DAYS, r as readTlsMode, s as ensureTlsCert, t as readExtraSans, u as CA_COMMON_NAME, v as allFamiliesListenHost, x as closeLanHttp, y as applyLanHttp } from "./tls-CQhPGSJm.mjs";
28
- import { $ as buildUdsNativeCapProxy, A as createParentUnownedCallHandler, At as RSS_BUDGET_REANNOUNCE_MIN_MS, B as AGENT_CAP_FWD_SERVICE, Bt as shouldReclaim, C as brokerTransportLink, Ct as createAddonDataPlaneFacility, D as HUB_CAP_FWD_ACTION, Dt as HEAP_WATCH_WARN_RATIO, E as localProviderLink, Et as HEAP_WATCH_INTERVAL_MS, F as createUdsLoggerWithControl, Ft as createV8Reclaimer, G as createLocalTransport, H as CapRouteError, Ht as startRunnerHeapWatch, I as LocalChildClient, It as describeRss, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, Lt as hubMainRssBudget, M as createUdsEventBus, Mt as RUNNER_HEAP_WATCH_INTERVAL_MS, N as udsChildLogToWorkerEntry, Nt as RUNNER_RSS_BUDGET_ENV, O as HUB_CAP_FWD_SERVICE, Ot as HUB_MAIN_RSS_BUDGET_MB, P as createUdsLogger, Pt as buildHeapSample, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, Rt as nextRssBudgetState, S as brokerCallForCap, St as runNpm, T as ipcParentLink, Tt as HEAP_RECLAIM_TRIGGER_MB, U as classifyCapRoute, Ut as strandedMb, V as CapRouteResolver, Vt as startHeapWatch, W as callWithServiceDiscovery, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as createKernelHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as capActionName, d as getBrokerEventBus, dt as capServiceName, et as createBrokerDeviceManagerApi, f as getMoleculerEventStats, ft as parseCapAction, g as AddonDepsManager, gt as CapabilityHandle, h as subscribePassthrough, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, jt as RSS_BUDGET_RELEASE_RATIO, k as createHubCapForwardService, kt as HUB_RSS_BUDGET_ENV, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as setNodeEventInterest, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as registerEventBusService, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as clusterEventTopic, ut as capBareAction, v as resolveHwAccel, vt as copyBundledNativeModules, w as buildLinkChain, wt as HEAP_RECLAIM_MIN_INTERVAL_MS, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as installManifestNativeDeps, z as AGENT_CAP_FWD_ACTION, zt as parseRssBudgetMb } from "./manifest-python-deps-HFh_iE0E.mjs";
28
+ import { $ as buildUdsNativeCapProxy, A as createParentUnownedCallHandler, At as HUB_RSS_BUDGET_ENV, B as AGENT_CAP_FWD_SERVICE, Bt as nextRssBudgetState, C as brokerTransportLink, Ct as createAddonDataPlaneFacility, D as HUB_CAP_FWD_ACTION, Dt as HEAP_WATCH_WARN_RATIO, E as localProviderLink, Et as HEAP_WATCH_INTERVAL_MS, F as createUdsLoggerWithControl, Ft as buildHeapSample, G as createLocalTransport, Gt as strandedMb, H as CapRouteError, Ht as shouldReclaim, I as LocalChildClient, It as createDeferredHeapWatchSink, J as SocketChannel, K as UdsLocalTransportClient, L as LocalChildRegistry, Lt as createV8Reclaimer, M as createUdsEventBus, Mt as RSS_BUDGET_RELEASE_RATIO, N as udsChildLogToWorkerEntry, Nt as RUNNER_HEAP_WATCH_INTERVAL_MS, O as HUB_CAP_FWD_SERVICE, Ot as HUB_MAIN_HEAP_WATCH_LABEL, P as createUdsLogger, Pt as RUNNER_RSS_BUDGET_ENV, Q as buildNativeCapProxy, R as UDS_NO_ROUTE_PREFIX, Rt as describeRss, S as brokerCallForCap, St as runNpm, T as ipcParentLink, Tt as HEAP_RECLAIM_TRIGGER_MB, U as classifyCapRoute, Ut as startHeapWatch, V as CapRouteResolver, Vt as parseRssBudgetMb, W as callWithServiceDiscovery, Wt as startRunnerHeapWatch, X as FrameDecoder, Y as localEndpointPath, Z as encodeFrame, _ as createKernelHwAccel, _t as CapabilityUnavailableError, a as getWorkerDeviceRegistry, at as createAddonService, b as __resetCapUsageRegistryForTests, bt as resolveAddonClass, c as setHubConnected, ct as capActionName, d as getBrokerEventBus, dt as capServiceName, et as createBrokerDeviceManagerApi, f as getMoleculerEventStats, ft as parseCapAction, g as AddonDepsManager, gt as CapabilityHandle, h as subscribePassthrough, ht as DeviceRegistry, i as createUdsAddonContext, j as createUdsEventBridge, jt as RSS_BUDGET_REANNOUNCE_MIN_MS, k as createHubCapForwardService, kt as HUB_MAIN_RSS_BUDGET_MB, l as EVENT_TOPIC_PREFIX, lt as capActionSuffix, m as setNodeEventInterest, mt as serializeTypedArrays, n as adaptBrokerToCluster, o as getOrInitReadinessRegistry, ot as validateProviderRegistrations, p as registerEventBusService, pt as deserializeTypedArrays, q as UdsLocalTransportServer, r as createAddonContext, rt as mountNativeCapService, s as getOrInitReadinessRegistryForClient, st as NATIVE_PROVIDER_SERVICE_INFIX, t as installManifestPythonDeps, u as clusterEventTopic, ut as capBareAction, v as resolveHwAccel, vt as copyBundledNativeModules, w as buildLinkChain, wt as HEAP_RECLAIM_MIN_INTERVAL_MS, x as getCapUsageRegistry, xt as resolveNpmInvocation, y as CapUsageRegistry, yt as installManifestNativeDeps, z as AGENT_CAP_FWD_ACTION, zt as hubMainRssBudget } from "./manifest-python-deps-DuQ3Uqoq.mjs";
29
29
  import { n as getSinglePidStats, t as getPidStats } from "./resource-monitor-BWmQ5i-o.mjs";
30
30
  import { t as CustomActionRegistry } from "./custom-action-registry-F__gp_VX.mjs";
31
31
  import { z } from "zod";
@@ -95283,4 +95283,4 @@ var LifecycleJobEngine = class {
95283
95283
  }
95284
95284
  };
95285
95285
  //#endregion
95286
- export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_READINESS_SERVICE_NAME, ALL_CAPABILITY_DEFINITIONS, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CA_COMMON_NAME, CA_VALIDITY_DAYS, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DEFAULT_LAN_HTTP_PORT, DEFAULT_LOG_LEVEL, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LEAF_RENEWAL_WINDOW_DAYS, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LoggingGate, LokiDestination, LokiLoggingAddon, MAX_LEAF_VALIDITY_DAYS, METHOD_ACCESS_MAP, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, QUARANTINE_DIRNAME, RESTART_MARKER_FILE, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, SERVER_AUTH_OID, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, __resetLoggingGateForTests, adaptBrokerToCluster, addonSettingsCapability, allFamiliesListenHost, applyLanHttp, bindPendingLanHttp, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, canServeDataPlane, capActionName, capActionSuffix, capBareAction, capServiceName, classifyAddonDir, classifyCapRoute, clearPendingRestart, closeLanHttp, clusterEventTopic, clusterSecretMatches, collectCertIdentity, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createDoorSettingsView, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, describeRss, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, evaluateExistingCert, expandCapMethods, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getLoggingGate, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hasDotNode, hashClusterSecret, hubMainRssBudget, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcParentLink, isAddonDeploySource, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isInfraCapability, isModelDownloaded, isSourceNewer, isolatedBuiltinPhase, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, nextRssBudgetState, parseCapAction, parseRangeHeader, parseRssBudgetMb, parseTokenizedUrl, partitionIsolatedBuiltinIds, proxyToUpstream, quarantineAddonResidue, readExtraSans, readLanHttpState, readPendingRestart, readTlsAccessStatus, readTlsMode, readinessKey, registerEventBusService, registerLanHttpHandler, reissueTlsLeaf, resolveFilePath, resolveHwAccel, resolveNpmInvocation, runHubAddonBoot, runNpm, scheduleSelfRestart, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, selectAddonResidue, serializeTypedArrays, setHubConnected, setNodeEventInterest, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };
95286
+ export { AGENT_CAP_FWD_ACTION, AGENT_CAP_FWD_SERVICE, AGENT_READINESS_SERVICE_NAME, ALL_CAPABILITY_DEFINITIONS, AddonApiFactory, AddonDepsManager, AddonEngineManager, AddonHealthMonitor, AddonInstaller, AddonLoader, AddonManifest, AddonRouteRegistry, AlertCenterAddon, ApiKeyManager, AuthManager, CA_COMMON_NAME, CA_VALIDITY_DAYS, CLUSTER_SECRET_MISMATCH_TYPE, CLUSTER_SECRET_REJECTED_EXIT_CODE, CORE_CAP_SERVICE_NAME, CapRouteError, CapRouteResolver, CapUsageRegistry, CapabilityHandle, CapabilityRegistry, CapabilityUnavailableError, ConfigManager, ConfigStore, ConsoleDestination, ConsoleLoggingAddon, CoreBlocksAddon, CustomActionRegistry, DEFAULT_DATA_PATH, DEFAULT_LAN_HTTP_PORT, DEFAULT_LOG_LEVEL, DEVICE_SETTINGS_CONTRIBUTION_METHODS, DEVICE_STATUS_METHOD, DataPlaneRegistry, DeviceManagerAddon, DeviceRegistry, DeviceStore, EVENT_TOPIC_PREFIX, EngineManagerResolver, EventBus, FeatureManager, FilesystemStorageAddon, FilesystemStorageProvider, FrameDecoder, FsStorageBackend, HEALTH_MONITOR_GRACE_PERIOD_MS, HEALTH_MONITOR_RETRY_INTERVALS_MS, HEALTH_MONITOR_TICK_MS, HEAP_RECLAIM_MIN_INTERVAL_MS, HEAP_RECLAIM_TRIGGER_MB, HEAP_WATCH_INTERVAL_MS, HEAP_WATCH_WARN_RATIO, HUB_CAP_FWD_ACTION, HUB_CAP_FWD_SERVICE, HUB_MAIN_HEAP_WATCH_LABEL, HUB_MAIN_RSS_BUDGET_MB, HUB_RSS_BUDGET_ENV, HubForwarderAddon, HubForwarderDestination, HubLogForwarder, HubNodeRegistry, INFRA_CAPABILITIES, IntegrationRegistry, JobJournal, LEAF_RENEWAL_WINDOW_DAYS, LifecycleJobEngine, LifecycleStateMachine, LivenessMonitorAddon, LocalAuthAddon, LocalChildClient, LocalChildRegistry, LogManager, LogRingBuffer, LoggingGate, LokiDestination, LokiLoggingAddon, MAX_LEAF_VALIDITY_DAYS, METHOD_ACCESS_MAP, ModelDownloadService, NATIVE_PROVIDER_SERVICE_INFIX, NATIVE_SCAN_DEPTH, NativeMetricsAddon, NativeMetricsProvider, NetworkQualityTracker, NotificationService, PYTHON_VERSION, PipelineRunner, PipelineValidator, PythonEnvManager, QUARANTINE_DIRNAME, RESTART_MARKER_FILE, RSS_BUDGET_REANNOUNCE_MIN_MS, RSS_BUDGET_RELEASE_RATIO, RUNNER_HEAP_WATCH_INTERVAL_MS, RUNNER_RSS_BUDGET_ENV, RUNTIME_DEFAULTS, ReadinessRegistry, ReadinessTimeoutError, ReplEngine, RingBuffer, SERVER_AUTH_OID, ScopedLogger, ScopedTokenManager, SocketChannel, SqliteSettingsAddon, SqliteSettingsBackend, StagingArea, StorageLocationManager, StorageManager, StorageOrchestratorAddon, StorageOrchestratorService, SystemConfigAddon, SystemEventBus, TRADITIONAL_NATIVE_PACKAGES, ToastService, UDS_NO_ROUTE_PREFIX, UdsLocalTransportClient, UdsLocalTransportServer, UserManager, WinstonDestination, WinstonLoggingAddon, __resetCapUsageRegistryForTests, __resetLoggingGateForTests, adaptBrokerToCluster, addonSettingsCapability, allFamiliesListenHost, applyLanHttp, bindPendingLanHttp, bootstrapSchema, brokerCallForCap, brokerTransportLink, buildBinaryPath, buildCapRouters, buildHeapSample, buildLinkChain, buildNativeCapProxy, buildNodeManifest, buildStorageLocationRegistry, buildUdsNativeCapProxy, builderMountedCapNames, callRegisterNodeWithRetry, callWithServiceDiscovery, canServeDataPlane, capActionName, capActionSuffix, capBareAction, capServiceName, classifyAddonDir, classifyCapRoute, clearPendingRestart, closeLanHttp, clusterEventTopic, clusterSecretMatches, collectCertIdentity, collectModelFiles, contentTypeFor, copyDirRecursive, copyExtraFileDirs, createAddonContext, createAddonDataPlaneFacility, createAddonService, createAuthenticatedFileServer, createBroker, createBrokerDeviceManagerApi, createCoreCapService, createDeferredHeapWatchSink, createDoorSettingsView, createFileDataPlaneHandler, createHubCapForwardService, createHubService, createKernelHwAccel, createLocalTransport, createParentUnownedCallHandler, createProcessService, createReadinessService, createReadinessServiceForRegistry, createScopedProcessManager, createStreamProbeBrokerService, createUdsAddonContext, createUdsEventBridge, createUdsEventBus, createUdsLogger, createUdsLoggerWithControl, createV8Reclaimer, deleteModelFromDisk, deriveAgentListenPort, describeProviderKindDrift, describeRss, detectWorkspacePackagesDir, downloadBinary, downloadFile, downloadModel, emitDownForOwnedCaps, encodeFrame, ensureAddonNativePrebuilds, ensureBinary, ensureDir, ensureFfmpeg, ensureLibraryBuilt, ensureModel, ensureNativePrebuilds, ensurePython, ensureTlsCert, evaluateExistingCert, expandCapMethods, fetchJson, findInPath, formatLogLine, getBrokerEventBus, getCapUsageRegistry, getFfmpegDownloadUrl, getLoggingGate, getModelFilePath, getMoleculerEventStats, getOrInitReadinessRegistry, getOrInitReadinessRegistryForClient, getPidStats, getPlatformInfo, getPythonDownloadUrl, getRestartMarkerPath, getSinglePidStats, getWorkerDeviceRegistry, hasDotNode, hashClusterSecret, hubMainRssBudget, installManifestNativeDeps, installManifestPythonDeps, installPackageFromNpm, installPythonPackages, installPythonRequirements, ipcParentLink, isAddonDeploySource, isArrayOutputSchema, isClusterSecretMismatchError, isCollectionArrayMethod, isInfraCapability, isModelDownloaded, isSourceNewer, isolatedBuiltinPhase, loadTlsCert, localEndpointPath, localProviderLink, mountNativeCapService, nextRssBudgetState, parseCapAction, parseRangeHeader, parseRssBudgetMb, parseTokenizedUrl, partitionIsolatedBuiltinIds, proxyToUpstream, quarantineAddonResidue, readExtraSans, readLanHttpState, readPendingRestart, readTlsAccessStatus, readTlsMode, readinessKey, registerEventBusService, registerLanHttpHandler, reissueTlsLeaf, resolveFilePath, resolveHwAccel, resolveNpmInvocation, runHubAddonBoot, runNpm, scheduleSelfRestart, scopeKey, scopesAllowAddon, scopesAllowDeviceCap, selectAddonResidue, serializeTypedArrays, setHubConnected, setNodeEventInterest, shouldReclaim, startHeapWatch, startRunnerHeapWatch, strandedMb, stripCamstackDeps, subscribePassthrough, udsChildLogToWorkerEntry, validateProviderRegistrations, validateUploadedTls, waitUntilReady, writeExtraSans, writePendingRestart, writeTlsMode };
@@ -1,3 +1,27 @@
1
+ /**
2
+ * What hub-main calls itself in a `[mem]` line.
3
+ *
4
+ * ## Why not `hub/main`
5
+ *
6
+ * A runner's label is its nodeId, and a nodeId is built in exactly one place as
7
+ * `` `${parentNodeId}/${runnerId}` `` (`kernel/moleculer/addon-runner.ts:222`) —
8
+ * so every runner label contains a `/` and every hub-local one is `hub/<runner>`.
9
+ * A label with NO slash therefore cannot be produced by that rule, which makes
10
+ * `hub-main` unambiguous by construction rather than by convention: no future
11
+ * addon, group or agent can ever claim it.
12
+ *
13
+ * It also sorts where it belongs. `-` (0x2D) precedes `/` (0x2F), so a sorted
14
+ * `[mem]` census puts `hub-main` immediately before `hub/decoder`,
15
+ * `hub/recorder`, `hub/stream-broker` — the composition root first, then the
16
+ * runners it forked. `hub/main` would sort into the middle of its own children
17
+ * and would be one addon id away from a collision.
18
+ *
19
+ * And it is the name the rest of this repository already uses — the docblocks,
20
+ * {@link HUB_MAIN_RSS_BUDGET_MB}, {@link HUB_RSS_BUDGET_ENV}, every ADR. A log
21
+ * label that disagreed with the prose would be a second vocabulary for one
22
+ * process, which is the exact failure this telemetry exists to remove.
23
+ */
24
+ export declare const HUB_MAIN_HEAP_WATCH_LABEL = "hub-main";
1
25
  /** Heartbeat period. Slow enough to be free, fast enough that the sample before
2
26
  * a fatal is recent. */
3
27
  export declare const HEAP_WATCH_INTERVAL_MS = 60000;
@@ -201,6 +225,53 @@ export interface HeapWatchSink {
201
225
  readonly info: (line: string) => void;
202
226
  readonly warn: (line: string) => void;
203
227
  }
228
+ /**
229
+ * A sink that starts on stdout and is repointed at the real logger the moment
230
+ * one exists.
231
+ *
232
+ * ## The gap this closes
233
+ *
234
+ * hub-main has had this heartbeat since 2026-08-02, started from
235
+ * `server/backend/src/main.ts` as the very first statement of `bootstrap()`.
236
+ * It was never wired to the LOG MANAGER, only to {@link consoleSink} — i.e. to
237
+ * `console.log`, which is not a destination. Every forked runner passes a sink
238
+ * backed by its `IScopedLogger` (`kernel/moleculer/addon-runner.ts:729`), so a
239
+ * runner's `[mem]` line fans out to the buffer, the console destination, the
240
+ * rotated file AND the Loki destination; hub-main's went to a file descriptor
241
+ * and nowhere else. Result: 42 hours of Loki with a `[mem]` line for every
242
+ * runner in the cluster and not one for the largest process in it, whose growth
243
+ * to ~4.8 GB was consequently never trended, only inferred.
244
+ *
245
+ * ## Why late binding rather than moving the call
246
+ *
247
+ * The heartbeat cannot simply be started later. Its whole point is that a
248
+ * process which dies early still leaves samples — the fatal that motivated it
249
+ * landed nine seconds after a viewer connected — and `LoggingService` does not
250
+ * exist until the Fastify app has been booted, hundreds of lines into
251
+ * `bootstrap()`. So the sink is handed over instead of the start being delayed:
252
+ * boot lines keep going to stdout exactly as they do today, and every line from
253
+ * the handover on enters the log manager.
254
+ *
255
+ * Nothing before the handover is lost from Loki by accident, only by design:
256
+ * `LogManager.addDestination` replays its ring buffer into a destination that
257
+ * registers late, so the heartbeat lines emitted between the handover and the
258
+ * Loki addon's own registration still ship.
259
+ */
260
+ export interface DeferredHeapWatchSink {
261
+ /** Hand this to {@link startHeapWatch}. */
262
+ readonly sink: HeapWatchSink;
263
+ /** Point every SUBSEQUENT line at `target`. Last call wins. */
264
+ readonly attach: (target: HeapWatchSink) => void;
265
+ }
266
+ /**
267
+ * Build a {@link DeferredHeapWatchSink}.
268
+ *
269
+ * The handover announces itself, once, through the NEW target: that line is the
270
+ * only in-band evidence that hub-main's telemetry actually reached the log
271
+ * manager on a given boot. Its absence from Loki means the wiring is broken —
272
+ * which is precisely the state this module was in, undetected, for 42 hours.
273
+ */
274
+ export declare function createDeferredHeapWatchSink(label?: string, fallback?: HeapWatchSink): DeferredHeapWatchSink;
204
275
  /**
205
276
  * RSS the process is holding but not using.
206
277
  *