@camstack/system 1.2.468 → 1.2.470

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 (94) hide show
  1. package/dist/addon-runner.js +56 -25
  2. package/dist/addon-runner.mjs +56 -25
  3. package/dist/{agent-https-DJ8OzQOr.js → agent-https-D_oo3PNv.js} +1 -1
  4. package/dist/{agent-https-DR1wmhYY.mjs → agent-https-DmNQyAl7.mjs} +1 -1
  5. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
  6. package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
  7. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
  8. package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
  9. package/dist/builtins/alerts/alerts.addon.js +1 -1
  10. package/dist/builtins/alerts/alerts.addon.mjs +1 -1
  11. package/dist/builtins/autotrack/index.js +1 -1
  12. package/dist/builtins/autotrack/index.mjs +1 -1
  13. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +2 -2
  14. package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
  15. package/dist/builtins/calendars/calendars.addon.js +1 -1
  16. package/dist/builtins/calendars/calendars.addon.mjs +1 -1
  17. package/dist/builtins/camera-grid/index.js +1 -1
  18. package/dist/builtins/camera-grid/index.mjs +1 -1
  19. package/dist/builtins/composer/composer.addon.js +2 -2
  20. package/dist/builtins/composer/composer.addon.mjs +2 -2
  21. package/dist/builtins/console-logging/index.js +1 -1
  22. package/dist/builtins/console-logging/index.mjs +1 -1
  23. package/dist/builtins/core-blocks/core-blocks.addon.js +2 -2
  24. package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
  25. package/dist/builtins/device-history/capture/capture-engine.d.ts +24 -4
  26. package/dist/builtins/device-history/device-history.addon.js +319 -44
  27. package/dist/builtins/device-history/device-history.addon.mjs +319 -44
  28. package/dist/builtins/device-history/query/history-query.d.ts +19 -2
  29. package/dist/builtins/device-history/retention/orphans.d.ts +50 -0
  30. package/dist/builtins/device-history/retention/retention.d.ts +9 -2
  31. package/dist/builtins/device-history/runtime/history-runtime.d.ts +10 -2
  32. package/dist/builtins/device-history/store/history-store.d.ts +5 -0
  33. package/dist/builtins/device-manager/device-manager.addon.js +2 -2
  34. package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
  35. package/dist/builtins/device-manager/device-meta-types.d.ts +2 -2
  36. package/dist/builtins/hub-forwarder/index.js +1 -1
  37. package/dist/builtins/hub-forwarder/index.mjs +1 -1
  38. package/dist/builtins/keychain/index.js +3 -3
  39. package/dist/builtins/keychain/index.mjs +3 -3
  40. package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
  41. package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
  42. package/dist/builtins/local-auth/local-auth.addon.js +2 -2
  43. package/dist/builtins/local-auth/local-auth.addon.mjs +2 -2
  44. package/dist/builtins/local-network/local-network.addon.js +2 -2
  45. package/dist/builtins/local-network/local-network.addon.mjs +2 -2
  46. package/dist/builtins/loki-logging/index.js +1 -1
  47. package/dist/builtins/loki-logging/index.mjs +1 -1
  48. package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
  49. package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
  50. package/dist/builtins/platform-probe/accelerator-reprobe.d.ts +23 -0
  51. package/dist/builtins/platform-probe/coral-accelerators.d.ts +37 -8
  52. package/dist/builtins/platform-probe/index.d.ts +17 -1
  53. package/dist/builtins/platform-probe/index.js +192 -11
  54. package/dist/builtins/platform-probe/index.mjs +192 -12
  55. package/dist/builtins/platform-probe/platform-scorer.d.ts +14 -0
  56. package/dist/builtins/record-entries/index.js +1 -1
  57. package/dist/builtins/record-entries/index.mjs +1 -1
  58. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
  59. package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  60. package/dist/builtins/snapshot/index.js +1 -1
  61. package/dist/builtins/snapshot/index.mjs +1 -1
  62. package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
  63. package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
  64. package/dist/builtins/sqlite-storage/index.js +1 -1
  65. package/dist/builtins/sqlite-storage/index.mjs +1 -1
  66. package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +2 -2
  67. package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +2 -2
  68. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +1 -1
  69. package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +1 -1
  70. package/dist/builtins/system-config/system-config.addon.js +3 -3
  71. package/dist/builtins/system-config/system-config.addon.mjs +3 -3
  72. package/dist/builtins/winston-logging/index.js +1 -1
  73. package/dist/builtins/winston-logging/index.mjs +1 -1
  74. package/dist/{composition-sources-Qto-S6MA.mjs → composition-sources-B0tqvf0t.mjs} +1 -1
  75. package/dist/{composition-sources-5rpWQhA1.js → composition-sources-CRJffEiB.js} +1 -1
  76. package/dist/{constants-BWli8Cju.mjs → constants--A505iuO.mjs} +1 -1
  77. package/dist/{constants-CuO3rcw4.js → constants-WF1AqoKF.js} +1 -1
  78. package/dist/{coral-accelerators-oUXmmbc2.js → coral-accelerators-Cri32b7q.js} +61 -24
  79. package/dist/{coral-accelerators-D_S1Fo5h.mjs → coral-accelerators-Dl-GnMHn.mjs} +56 -25
  80. package/dist/{device-ca-C5cLlah1.mjs → device-ca-DYmToMp8.mjs} +1 -1
  81. package/dist/{device-ca-CGcaSheI.js → device-ca-R4MZZtc0.js} +1 -1
  82. package/dist/{dist-l6zKmHEb.js → dist-DRL3rEfN.js} +335 -120
  83. package/dist/{dist-BpUtAgqR.mjs → dist-X1r44BdF.mjs} +324 -121
  84. package/dist/file-host-worker.js +1 -1
  85. package/dist/file-host-worker.mjs +1 -1
  86. package/dist/{hub-mdns-ciao-0KWDyIMD.mjs → hub-mdns-ciao-CZV5Hion.mjs} +2 -2
  87. package/dist/{hub-mdns-ciao-CIno_SNn.js → hub-mdns-ciao-DUoTS6jN.js} +2 -2
  88. package/dist/index.js +8 -8
  89. package/dist/index.mjs +8 -8
  90. package/dist/{restore-archive-B71JI-sP.js → restore-archive-Df6PsOHP.js} +1 -1
  91. package/dist/{restore-archive-DKxAZ9pI.mjs → restore-archive-X0ciGMmO.mjs} +1 -1
  92. package/dist/{wal-maintenance-BXYwFecW.mjs → wal-maintenance-D6J_MmZ8.mjs} +0 -0
  93. package/dist/{wal-maintenance-B6LSQ_OZ.js → wal-maintenance-DYvzJiuK.js} +0 -0
  94. package/package.json +1 -1
@@ -3,14 +3,58 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
7
- const require_coral_accelerators = require("../../coral-accelerators-oUXmmbc2.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
+ const require_coral_accelerators = require("../../coral-accelerators-Cri32b7q.js");
8
8
  let node_util = require("node:util");
9
9
  let node_os = require("node:os");
10
10
  node_os = require_chunk.__toESM(node_os);
11
11
  let node_fs = require("node:fs");
12
12
  node_fs = require_chunk.__toESM(node_fs);
13
13
  let node_child_process = require("node:child_process");
14
+ //#region src/builtins/platform-probe/accelerator-reprobe.ts
15
+ /**
16
+ * The accelerator part of the platform probe, re-run on its own (D919).
17
+ *
18
+ * The full probe runs once per process. A Coral is the one accelerator that is
19
+ * plugged in, pulled out and moved between nodes while the process runs, so
20
+ * its part (USB ids, PCIe apex units — reads of `/sys` and `/dev`, no model
21
+ * load) is re-run periodically and on demand, and the node's inference device
22
+ * list is rebuilt from the new answer. Pure: the scorer owns the cache.
23
+ */
24
+ /** A stable signature of a Coral answer — what decides "did it change". */
25
+ function coralSignature(coral) {
26
+ if (coral == null) return "none";
27
+ return `units=${(coral.units ?? []).map((u) => `${u.bus}:${u.count}`).join(",")};unavailable=${(coral.unavailable ?? []).map((u) => `${u.bus}:${u.count}:${u.reason}`).join(",")}`;
28
+ }
29
+ /** Which device keys a new probe added and removed. */
30
+ function diffInferenceDevices(previous, next) {
31
+ const before = new Set(previous.map((d) => d.key));
32
+ const after = new Set(next.map((d) => d.key));
33
+ return {
34
+ appeared: [...after].filter((k) => !before.has(k)).toSorted(),
35
+ disappeared: [...before].filter((k) => !after.has(k)).toSorted()
36
+ };
37
+ }
38
+ /**
39
+ * The capabilities with a new Coral answer: hardware, scores and the device
40
+ * enumeration are all derived again from it, so the edgetpu runtime and its
41
+ * devices follow the hardware rather than the boot-time snapshot.
42
+ */
43
+ function withCoral(caps, coral) {
44
+ const hardware = {
45
+ ...caps.hardware,
46
+ coral
47
+ };
48
+ const { scores, best } = require_dist.scoreRuntimes(hardware);
49
+ return {
50
+ ...caps,
51
+ hardware,
52
+ scores: [...scores],
53
+ bestScore: best,
54
+ devices: require_dist.enumerateInferenceDevices(hardware)
55
+ };
56
+ }
57
+ //#endregion
14
58
  //#region src/builtins/platform-probe/amd-npu.ts
15
59
  var amd_npu_exports = /* @__PURE__ */ require_chunk.__exportAll({
16
60
  classifyAmdNpu: () => classifyAmdNpu,
@@ -417,15 +461,7 @@ var PlatformScorer = class {
417
461
  } });
418
462
  let gpu = null;
419
463
  let npu = null;
420
- const coral = require_coral_accelerators.classifyCoralAccelerator(this.coralFs);
421
- if (coral) {
422
- if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: { units: coral.units } });
423
- for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
424
- bus: unavailable.bus,
425
- count: unavailable.count,
426
- reason: unavailable.reason
427
- } });
428
- }
464
+ const coral = this.probeCoral().info;
429
465
  if (platform === "darwin" && arch === "arm64") {
430
466
  gpu = {
431
467
  type: "apple",
@@ -545,6 +581,64 @@ var PlatformScorer = class {
545
581
  coral
546
582
  };
547
583
  }
584
+ /**
585
+ * The Coral part of the probe, with the evidence that decided it logged —
586
+ * a node that reports a Coral, or stops reporting one, says WHY (D919).
587
+ */
588
+ probeCoral() {
589
+ const detection = require_coral_accelerators.detectCoralAccelerator(this.coralFs);
590
+ const coral = detection.info;
591
+ this.logger.info("Coral Edge TPU probe", { meta: {
592
+ usbBus: detection.usbBus,
593
+ decidedBy: detection.decidedBy,
594
+ units: coral?.units ?? []
595
+ } });
596
+ if (coral) {
597
+ if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: {
598
+ units: coral.units,
599
+ decidedBy: detection.decidedBy
600
+ } });
601
+ for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
602
+ bus: unavailable.bus,
603
+ count: unavailable.count,
604
+ reason: unavailable.reason
605
+ } });
606
+ }
607
+ return detection;
608
+ }
609
+ /**
610
+ * Re-run ONLY the accelerator part (Coral USB ids + PCIe apex units: `/sys`
611
+ * and `/dev` reads, no model load) against the cached probe, and rebuild the
612
+ * device list from it when it changed. `null` before the first full probe
613
+ * completed — there is nothing to compare against yet. Logs the evidence
614
+ * only when the answer changed, so a 60 s cadence stays quiet.
615
+ */
616
+ reprobeAccelerators() {
617
+ const cached = this.cached;
618
+ if (cached === null) return null;
619
+ const detection = require_coral_accelerators.detectCoralAccelerator(this.coralFs);
620
+ if (coralSignature(detection.info) === coralSignature(cached.hardware.coral)) return {
621
+ caps: cached,
622
+ change: {
623
+ appeared: [],
624
+ disappeared: []
625
+ },
626
+ detection
627
+ };
628
+ this.logger.info("Coral Edge TPU probe changed", { meta: {
629
+ usbBus: detection.usbBus,
630
+ decidedBy: detection.decidedBy,
631
+ before: coralSignature(cached.hardware.coral),
632
+ after: coralSignature(detection.info)
633
+ } });
634
+ const next = withCoral(cached, detection.info);
635
+ this.cached = next;
636
+ return {
637
+ caps: next,
638
+ change: diffInferenceDevices(cached.devices, next.devices),
639
+ detection
640
+ };
641
+ }
548
642
  /** NVIDIA's own tool: exact model and VRAM. Null when absent or failing. */
549
643
  async probeNvidiaSmi() {
550
644
  try {
@@ -733,9 +827,13 @@ function narrowHwAccelPrefer(value) {
733
827
  if (typeof value === "string" && isHwAccelBackend(value)) return value;
734
828
  return null;
735
829
  }
830
+ /** How often the accelerator part of the probe is re-run (D919). Cheap: `/sys` + `/dev` reads. */
831
+ var ACCELERATOR_REPROBE_INTERVAL_MS = 6e4;
736
832
  var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
737
833
  scorer = null;
738
834
  cachedCaps = null;
835
+ /** The periodic accelerator re-probe; started once the full probe completed. */
836
+ reprobeTimer = null;
739
837
  /**
740
838
  * Per-boot generation stamp for the manual readiness emissions below.
741
839
  * Constant for the lifetime of this addon instance (== one process boot);
@@ -816,6 +914,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
816
914
  bestScore: caps.bestScore.score
817
915
  } });
818
916
  this.emitProbeReadiness("ready");
917
+ this.startAcceleratorReprobe();
819
918
  return caps;
820
919
  }).catch((err) => {
821
920
  const msg = require_dist.errMsg(err);
@@ -850,17 +949,99 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
850
949
  preferred: res.preferred,
851
950
  rationale: res.rationale
852
951
  };
952
+ },
953
+ rescanAccelerators: async () => {
954
+ await getCaps();
955
+ const rescan = this.reprobeAccelerators("operator");
956
+ if (rescan === null) throw new Error("platform-probe: the probe is shutting down");
957
+ return rescan;
853
958
  }
854
959
  }
855
960
  }];
856
961
  }
962
+ /** Start the periodic accelerator re-probe (idempotent). */
963
+ startAcceleratorReprobe() {
964
+ if (this.reprobeTimer !== null) return;
965
+ this.reprobeTimer = setInterval(() => {
966
+ this.reprobeAccelerators("periodic");
967
+ }, ACCELERATOR_REPROBE_INTERVAL_MS);
968
+ this.reprobeTimer.unref?.();
969
+ }
970
+ /**
971
+ * Re-run the accelerator part of the probe and serve its answer from now on.
972
+ * Every device that appeared or disappeared is logged, naming the node and
973
+ * what triggered the re-probe; the orchestrator sees the new list on its next
974
+ * `getCapabilities` read and re-elects through its device-set-change path.
975
+ * `null` when the scorer is gone or has not completed its first probe.
976
+ */
977
+ reprobeAccelerators(trigger) {
978
+ const scorer = this.scorer;
979
+ if (scorer === null) return null;
980
+ let result;
981
+ try {
982
+ result = scorer.reprobeAccelerators();
983
+ } catch (err) {
984
+ this.ctx.logger.warn("accelerator re-probe failed — last device list kept", {
985
+ tags: { nodeId: this.bareLocalNodeId() },
986
+ meta: {
987
+ nodeId: this.bareLocalNodeId(),
988
+ trigger,
989
+ error: require_dist.errMsg(err)
990
+ }
991
+ });
992
+ return null;
993
+ }
994
+ if (result === null) return null;
995
+ this.cachedCaps = result.caps;
996
+ const nodeId = this.bareLocalNodeId();
997
+ for (const deviceKey of result.change.appeared) this.ctx.logger.info("inference device appeared", {
998
+ tags: { nodeId },
999
+ meta: {
1000
+ nodeId,
1001
+ deviceKey,
1002
+ trigger,
1003
+ decidedBy: result.detection.decidedBy
1004
+ }
1005
+ });
1006
+ for (const deviceKey of result.change.disappeared) this.ctx.logger.info("inference device disappeared", {
1007
+ tags: { nodeId },
1008
+ meta: {
1009
+ nodeId,
1010
+ deviceKey,
1011
+ trigger,
1012
+ decidedBy: result.detection.decidedBy
1013
+ }
1014
+ });
1015
+ if (trigger === "operator") this.ctx.logger.info("inference devices rescanned", {
1016
+ tags: { nodeId },
1017
+ meta: {
1018
+ nodeId,
1019
+ usbBus: result.detection.usbBus,
1020
+ decidedBy: result.detection.decidedBy,
1021
+ appeared: result.change.appeared,
1022
+ disappeared: result.change.disappeared
1023
+ }
1024
+ });
1025
+ return {
1026
+ devices: result.caps.devices,
1027
+ appeared: result.change.appeared,
1028
+ disappeared: result.change.disappeared,
1029
+ usbBus: result.detection.usbBus,
1030
+ decidedBy: result.detection.decidedBy
1031
+ };
1032
+ }
857
1033
  async onShutdown() {
1034
+ if (this.reprobeTimer !== null) {
1035
+ clearInterval(this.reprobeTimer);
1036
+ this.reprobeTimer = null;
1037
+ }
858
1038
  this.emitProbeReadiness("down");
859
1039
  this.scorer = null;
860
1040
  this.cachedCaps = null;
861
1041
  }
862
1042
  };
863
1043
  //#endregion
1044
+ exports.ACCELERATOR_REPROBE_INTERVAL_MS = ACCELERATOR_REPROBE_INTERVAL_MS;
864
1045
  exports.InferenceConfigResolver = InferenceConfigResolver;
865
1046
  exports.PlatformProbeNativeAddon = PlatformProbeNativeAddon;
866
1047
  exports.default = PlatformProbeNativeAddon;
@@ -1,10 +1,54 @@
1
1
  import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
2
- import { $r as BaseAddon, Qn as platformProbeCapability, Qr as errMsg, Ta as EventCategory, gr as scoreRuntimes, in as enumerateInferenceDevices, qi as emitReadiness } from "../../dist-BpUtAgqR.mjs";
3
- import { n as nodeCoralFs, t as classifyCoralAccelerator } from "../../coral-accelerators-D_S1Fo5h.mjs";
2
+ import { $n as platformProbeCapability, $r as errMsg, Da as EventCategory, Ji as emitReadiness, _r as scoreRuntimes, an as enumerateInferenceDevices, ei as BaseAddon } from "../../dist-X1r44BdF.mjs";
3
+ import { n as detectCoralAccelerator, r as nodeCoralFs } from "../../coral-accelerators-Dl-GnMHn.mjs";
4
4
  import { promisify } from "node:util";
5
5
  import * as os$1 from "node:os";
6
6
  import * as fs from "node:fs";
7
7
  import { execFile } from "node:child_process";
8
+ //#region src/builtins/platform-probe/accelerator-reprobe.ts
9
+ /**
10
+ * The accelerator part of the platform probe, re-run on its own (D919).
11
+ *
12
+ * The full probe runs once per process. A Coral is the one accelerator that is
13
+ * plugged in, pulled out and moved between nodes while the process runs, so
14
+ * its part (USB ids, PCIe apex units — reads of `/sys` and `/dev`, no model
15
+ * load) is re-run periodically and on demand, and the node's inference device
16
+ * list is rebuilt from the new answer. Pure: the scorer owns the cache.
17
+ */
18
+ /** A stable signature of a Coral answer — what decides "did it change". */
19
+ function coralSignature(coral) {
20
+ if (coral == null) return "none";
21
+ return `units=${(coral.units ?? []).map((u) => `${u.bus}:${u.count}`).join(",")};unavailable=${(coral.unavailable ?? []).map((u) => `${u.bus}:${u.count}:${u.reason}`).join(",")}`;
22
+ }
23
+ /** Which device keys a new probe added and removed. */
24
+ function diffInferenceDevices(previous, next) {
25
+ const before = new Set(previous.map((d) => d.key));
26
+ const after = new Set(next.map((d) => d.key));
27
+ return {
28
+ appeared: [...after].filter((k) => !before.has(k)).toSorted(),
29
+ disappeared: [...before].filter((k) => !after.has(k)).toSorted()
30
+ };
31
+ }
32
+ /**
33
+ * The capabilities with a new Coral answer: hardware, scores and the device
34
+ * enumeration are all derived again from it, so the edgetpu runtime and its
35
+ * devices follow the hardware rather than the boot-time snapshot.
36
+ */
37
+ function withCoral(caps, coral) {
38
+ const hardware = {
39
+ ...caps.hardware,
40
+ coral
41
+ };
42
+ const { scores, best } = scoreRuntimes(hardware);
43
+ return {
44
+ ...caps,
45
+ hardware,
46
+ scores: [...scores],
47
+ bestScore: best,
48
+ devices: enumerateInferenceDevices(hardware)
49
+ };
50
+ }
51
+ //#endregion
8
52
  //#region src/builtins/platform-probe/amd-npu.ts
9
53
  var amd_npu_exports = /* @__PURE__ */ __exportAll({
10
54
  classifyAmdNpu: () => classifyAmdNpu,
@@ -411,15 +455,7 @@ var PlatformScorer = class {
411
455
  } });
412
456
  let gpu = null;
413
457
  let npu = null;
414
- const coral = classifyCoralAccelerator(this.coralFs);
415
- if (coral) {
416
- if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: { units: coral.units } });
417
- for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
418
- bus: unavailable.bus,
419
- count: unavailable.count,
420
- reason: unavailable.reason
421
- } });
422
- }
458
+ const coral = this.probeCoral().info;
423
459
  if (platform === "darwin" && arch === "arm64") {
424
460
  gpu = {
425
461
  type: "apple",
@@ -539,6 +575,64 @@ var PlatformScorer = class {
539
575
  coral
540
576
  };
541
577
  }
578
+ /**
579
+ * The Coral part of the probe, with the evidence that decided it logged —
580
+ * a node that reports a Coral, or stops reporting one, says WHY (D919).
581
+ */
582
+ probeCoral() {
583
+ const detection = detectCoralAccelerator(this.coralFs);
584
+ const coral = detection.info;
585
+ this.logger.info("Coral Edge TPU probe", { meta: {
586
+ usbBus: detection.usbBus,
587
+ decidedBy: detection.decidedBy,
588
+ units: coral?.units ?? []
589
+ } });
590
+ if (coral) {
591
+ if ((coral.units ?? []).length > 0) this.logger.info("Coral Edge TPU detected", { meta: {
592
+ units: coral.units,
593
+ decidedBy: detection.decidedBy
594
+ } });
595
+ for (const unavailable of coral.unavailable ?? []) this.logger.warn("Coral Edge TPU present but unusable", { meta: {
596
+ bus: unavailable.bus,
597
+ count: unavailable.count,
598
+ reason: unavailable.reason
599
+ } });
600
+ }
601
+ return detection;
602
+ }
603
+ /**
604
+ * Re-run ONLY the accelerator part (Coral USB ids + PCIe apex units: `/sys`
605
+ * and `/dev` reads, no model load) against the cached probe, and rebuild the
606
+ * device list from it when it changed. `null` before the first full probe
607
+ * completed — there is nothing to compare against yet. Logs the evidence
608
+ * only when the answer changed, so a 60 s cadence stays quiet.
609
+ */
610
+ reprobeAccelerators() {
611
+ const cached = this.cached;
612
+ if (cached === null) return null;
613
+ const detection = detectCoralAccelerator(this.coralFs);
614
+ if (coralSignature(detection.info) === coralSignature(cached.hardware.coral)) return {
615
+ caps: cached,
616
+ change: {
617
+ appeared: [],
618
+ disappeared: []
619
+ },
620
+ detection
621
+ };
622
+ this.logger.info("Coral Edge TPU probe changed", { meta: {
623
+ usbBus: detection.usbBus,
624
+ decidedBy: detection.decidedBy,
625
+ before: coralSignature(cached.hardware.coral),
626
+ after: coralSignature(detection.info)
627
+ } });
628
+ const next = withCoral(cached, detection.info);
629
+ this.cached = next;
630
+ return {
631
+ caps: next,
632
+ change: diffInferenceDevices(cached.devices, next.devices),
633
+ detection
634
+ };
635
+ }
542
636
  /** NVIDIA's own tool: exact model and VRAM. Null when absent or failing. */
543
637
  async probeNvidiaSmi() {
544
638
  try {
@@ -727,9 +821,13 @@ function narrowHwAccelPrefer(value) {
727
821
  if (typeof value === "string" && isHwAccelBackend(value)) return value;
728
822
  return null;
729
823
  }
824
+ /** How often the accelerator part of the probe is re-run (D919). Cheap: `/sys` + `/dev` reads. */
825
+ var ACCELERATOR_REPROBE_INTERVAL_MS = 6e4;
730
826
  var PlatformProbeNativeAddon = class extends BaseAddon {
731
827
  scorer = null;
732
828
  cachedCaps = null;
829
+ /** The periodic accelerator re-probe; started once the full probe completed. */
830
+ reprobeTimer = null;
733
831
  /**
734
832
  * Per-boot generation stamp for the manual readiness emissions below.
735
833
  * Constant for the lifetime of this addon instance (== one process boot);
@@ -810,6 +908,7 @@ var PlatformProbeNativeAddon = class extends BaseAddon {
810
908
  bestScore: caps.bestScore.score
811
909
  } });
812
910
  this.emitProbeReadiness("ready");
911
+ this.startAcceleratorReprobe();
813
912
  return caps;
814
913
  }).catch((err) => {
815
914
  const msg = errMsg(err);
@@ -844,15 +943,96 @@ var PlatformProbeNativeAddon = class extends BaseAddon {
844
943
  preferred: res.preferred,
845
944
  rationale: res.rationale
846
945
  };
946
+ },
947
+ rescanAccelerators: async () => {
948
+ await getCaps();
949
+ const rescan = this.reprobeAccelerators("operator");
950
+ if (rescan === null) throw new Error("platform-probe: the probe is shutting down");
951
+ return rescan;
847
952
  }
848
953
  }
849
954
  }];
850
955
  }
956
+ /** Start the periodic accelerator re-probe (idempotent). */
957
+ startAcceleratorReprobe() {
958
+ if (this.reprobeTimer !== null) return;
959
+ this.reprobeTimer = setInterval(() => {
960
+ this.reprobeAccelerators("periodic");
961
+ }, ACCELERATOR_REPROBE_INTERVAL_MS);
962
+ this.reprobeTimer.unref?.();
963
+ }
964
+ /**
965
+ * Re-run the accelerator part of the probe and serve its answer from now on.
966
+ * Every device that appeared or disappeared is logged, naming the node and
967
+ * what triggered the re-probe; the orchestrator sees the new list on its next
968
+ * `getCapabilities` read and re-elects through its device-set-change path.
969
+ * `null` when the scorer is gone or has not completed its first probe.
970
+ */
971
+ reprobeAccelerators(trigger) {
972
+ const scorer = this.scorer;
973
+ if (scorer === null) return null;
974
+ let result;
975
+ try {
976
+ result = scorer.reprobeAccelerators();
977
+ } catch (err) {
978
+ this.ctx.logger.warn("accelerator re-probe failed — last device list kept", {
979
+ tags: { nodeId: this.bareLocalNodeId() },
980
+ meta: {
981
+ nodeId: this.bareLocalNodeId(),
982
+ trigger,
983
+ error: errMsg(err)
984
+ }
985
+ });
986
+ return null;
987
+ }
988
+ if (result === null) return null;
989
+ this.cachedCaps = result.caps;
990
+ const nodeId = this.bareLocalNodeId();
991
+ for (const deviceKey of result.change.appeared) this.ctx.logger.info("inference device appeared", {
992
+ tags: { nodeId },
993
+ meta: {
994
+ nodeId,
995
+ deviceKey,
996
+ trigger,
997
+ decidedBy: result.detection.decidedBy
998
+ }
999
+ });
1000
+ for (const deviceKey of result.change.disappeared) this.ctx.logger.info("inference device disappeared", {
1001
+ tags: { nodeId },
1002
+ meta: {
1003
+ nodeId,
1004
+ deviceKey,
1005
+ trigger,
1006
+ decidedBy: result.detection.decidedBy
1007
+ }
1008
+ });
1009
+ if (trigger === "operator") this.ctx.logger.info("inference devices rescanned", {
1010
+ tags: { nodeId },
1011
+ meta: {
1012
+ nodeId,
1013
+ usbBus: result.detection.usbBus,
1014
+ decidedBy: result.detection.decidedBy,
1015
+ appeared: result.change.appeared,
1016
+ disappeared: result.change.disappeared
1017
+ }
1018
+ });
1019
+ return {
1020
+ devices: result.caps.devices,
1021
+ appeared: result.change.appeared,
1022
+ disappeared: result.change.disappeared,
1023
+ usbBus: result.detection.usbBus,
1024
+ decidedBy: result.detection.decidedBy
1025
+ };
1026
+ }
851
1027
  async onShutdown() {
1028
+ if (this.reprobeTimer !== null) {
1029
+ clearInterval(this.reprobeTimer);
1030
+ this.reprobeTimer = null;
1031
+ }
852
1032
  this.emitProbeReadiness("down");
853
1033
  this.scorer = null;
854
1034
  this.cachedCaps = null;
855
1035
  }
856
1036
  };
857
1037
  //#endregion
858
- export { InferenceConfigResolver, PlatformProbeNativeAddon, PlatformProbeNativeAddon as default, PlatformScorer };
1038
+ export { ACCELERATOR_REPROBE_INTERVAL_MS, InferenceConfigResolver, PlatformProbeNativeAddon, PlatformProbeNativeAddon as default, PlatformScorer };
@@ -1,5 +1,6 @@
1
1
  import type { HardwareInfo, PlatformCapabilities, IScopedLogger } from "@camstack/types";
2
2
  import { type CoralFs } from "./coral-accelerators.js";
3
+ import { type AcceleratorReprobe } from "./accelerator-reprobe.js";
3
4
  export declare class PlatformScorer {
4
5
  private cached;
5
6
  private readonly logger;
@@ -29,6 +30,19 @@ export declare class PlatformScorer {
29
30
  */
30
31
  probe(onPhase?: (phase: string, payload?: Record<string, unknown>) => void): Promise<PlatformCapabilities>;
31
32
  probeHardware(): Promise<HardwareInfo>;
33
+ /**
34
+ * The Coral part of the probe, with the evidence that decided it logged —
35
+ * a node that reports a Coral, or stops reporting one, says WHY (D919).
36
+ */
37
+ private probeCoral;
38
+ /**
39
+ * Re-run ONLY the accelerator part (Coral USB ids + PCIe apex units: `/sys`
40
+ * and `/dev` reads, no model load) against the cached probe, and rebuild the
41
+ * device list from it when it changed. `null` before the first full probe
42
+ * completed — there is nothing to compare against yet. Logs the evidence
43
+ * only when the answer changed, so a 60 s cadence stays quiet.
44
+ */
45
+ reprobeAccelerators(): AcceleratorReprobe | null;
32
46
  /** NVIDIA's own tool: exact model and VRAM. Null when absent or failing. */
33
47
  private probeNvidiaSmi;
34
48
  /** Windows WMI probe; bounded, and a failure is a log line, never a boot failure. */
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
7
  let zod = require("zod");
8
8
  let node_crypto = require("node:crypto");
9
9
  //#region src/builtins/record-entries/entries-service.ts
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, Ai as UnknownRecordKindError, aa as mapSecretLeaves, li as InvalidRecordError, pa as recordSecretRef, tr as recordEntriesCapability } from "../../dist-BpUtAgqR.mjs";
1
+ import { ei as BaseAddon, ha as recordSecretRef, ji as UnknownRecordKindError, nr as recordEntriesCapability, sa as mapSecretLeaves, ui as InvalidRecordError } from "../../dist-X1r44BdF.mjs";
2
2
  import { z } from "zod";
3
3
  import { randomUUID } from "node:crypto";
4
4
  //#region src/builtins/record-entries/entries-service.ts
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
7
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
8
8
  /**
9
9
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, Ta as EventCategory } from "../../dist-BpUtAgqR.mjs";
1
+ import { Da as EventCategory, ei as BaseAddon } from "../../dist-X1r44BdF.mjs";
2
2
  //#region src/builtins/remote-access-orchestrator/enabled-providers-reconcile.ts
3
3
  /**
4
4
  * Reconcile the durable `enabledProviders` set against authoritative
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
7
  const require_snapshot_courtesy = require("../../snapshot-courtesy-D_C5-nC0.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, Et as batteryCapability, Or as streamQualityLabel, Qr as errMsg, Ta as EventCategory, Tt as bareAddonId, Vn as memoizePinnedFfmpeg, Yr as DeviceFeature, Yt as deriveBatteryPresence, Zr as DeviceType, br as snapshotCapability, o as BatteryStatusSchema, oa as nodePin } from "../../dist-BpUtAgqR.mjs";
1
+ import { $r as errMsg, Da as EventCategory, Dt as batteryCapability, Et as bareAddonId, Hn as memoizePinnedFfmpeg, Qr as DeviceType, Xr as DeviceFeature, Xt as deriveBatteryPresence, ca as nodePin, ei as BaseAddon, kr as streamQualityLabel, o as BatteryStatusSchema, xr as snapshotCapability } from "../../dist-X1r44BdF.mjs";
2
2
  import { i as renderCourtesyOverlayJpeg, n as courtesyCacheKey, r as renderCourtesyJpeg } from "../../snapshot-courtesy-CyFs1M3I.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
7
  let node_crypto = require("node:crypto");
8
8
  let node_fs_promises = require("node:fs/promises");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, Er as storageProviderCapability, fn as filesystemBrowseCapability } from "../../dist-BpUtAgqR.mjs";
1
+ import { Dr as storageProviderCapability, ei as BaseAddon, pn as filesystemBrowseCapability } from "../../dist-X1r44BdF.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { mkdir, readdir, realpath, statfs } from "node:fs/promises";
4
4
  import * as path$1 from "node:path";
@@ -4,7 +4,7 @@ Object.defineProperties(exports, {
4
4
  });
5
5
  require("../../chunk-Cek0wNdY.js");
6
6
  const require_builtins_sqlite_storage_filesystem_storage_addon = require("./filesystem-storage.addon.js");
7
- const require_wal_maintenance = require("../../wal-maintenance-B6LSQ_OZ.js");
7
+ const require_wal_maintenance = require("../../wal-maintenance-DYvzJiuK.js");
8
8
  const require_builtins_sqlite_storage_sqlite_settings_addon = require("./sqlite-settings.addon.js");
9
9
  //#region src/builtins/sqlite-storage/config-store.ts
10
10
  var ConfigStore = class {
@@ -1,5 +1,5 @@
1
1
  import { FilesystemStorageAddon, t as FilesystemStorageProvider } from "./filesystem-storage.addon.mjs";
2
- import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-BXYwFecW.mjs";
2
+ import { A as SQLITE_MMAP_CEILING_BYTES, B as SQLITE_SLOW_CALL_MS, F as sqlitePageCacheKibFor, H as sqliteEngineStorm, I as SQLITE_ENGINE_STORM_WALL_SHARE, L as SQLITE_PROFILE_REPORT_FLOOR_MS, M as SQLITE_PAGE_CACHE_CEILING_KIB, N as SQLITE_PAGE_CACHE_FLOOR_KIB, P as sqliteMmapSizeFor, R as SQLITE_PROFILE_REPORT_INTERVAL_MS, V as SqliteOpProfiler, a as WalMaintenance, i as WAL_MAINTENANCE_INTERVAL_MS, j as SQLITE_MMAP_FLOOR_BYTES, k as SQLITE_JOURNAL_SIZE_LIMIT_BYTES, l as SqliteSettingsBackend, n as WAL_HIGH_WATER_BYTES, r as WAL_IDLE_QUIET_MS, t as WAL_CHECKPOINT_BUSY_TIMEOUT_MS, z as SQLITE_PROFILE_TOP_N } from "../../wal-maintenance-D6J_MmZ8.mjs";
3
3
  import { SqliteSettingsAddon } from "./sqlite-settings.addon.mjs";
4
4
  //#region src/builtins/sqlite-storage/config-store.ts
5
5
  var ConfigStore = class {
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../../chunk-Cek0wNdY.js");
6
- const require_dist = require("../../dist-l6zKmHEb.js");
6
+ const require_dist = require("../../dist-DRL3rEfN.js");
7
7
  const require_retired_settings_keys = require("../../retired-settings-keys-CGUqX-Oz.js");
8
- const require_wal_maintenance = require("../../wal-maintenance-B6LSQ_OZ.js");
8
+ const require_wal_maintenance = require("../../wal-maintenance-DYvzJiuK.js");
9
9
  const require_sqlite_snapshot_protocol = require("../../sqlite-snapshot-protocol-B9OndqZv.js");
10
10
  const require_wal_checkpoint_policy = require("../../wal-checkpoint-policy-d2z2qPqx.js");
11
11
  let node_fs_promises = require("node:fs/promises");
@@ -1,6 +1,6 @@
1
- import { $r as BaseAddon, Ai as UnknownRecordKindError, C as DATA_STORE_DATABASES, Fr as vectorStoreCapability, Gt as databaseSnapshotCapability, Oi as TransactRefusedError, Qr as errMsg, S as DATABASE_SNAPSHOT_TIMEOUT_MS, Sr as storageAdminCapability, Tt as bareAddonId, Wt as dataStoreProviderCapability, ai as DeclarationRefusedError, b as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, ca as normalizeSecretOwner, hi as RECORD_SWEEP_INTERVAL_MS, li as InvalidRecordError, nr as recordsCapability, ui as NoCallerError, vi as RUNTIME_DEFAULTS, x as DATABASE_SNAPSHOT_SUFFIX, xi as RecordKindDeclarationSchema } from "../../dist-BpUtAgqR.mjs";
1
+ import { $r as errMsg, C as DATA_STORE_DATABASES, Cr as storageAdminCapability, Et as bareAddonId, Gt as dataStoreProviderCapability, Ir as vectorStoreCapability, Kt as databaseSnapshotCapability, S as DATABASE_SNAPSHOT_TIMEOUT_MS, Si as RecordKindDeclarationSchema, b as DATABASE_SNAPSHOT_PARTIAL_SUFFIX, di as NoCallerError, ei as BaseAddon, gi as RECORD_SWEEP_INTERVAL_MS, ji as UnknownRecordKindError, ki as TransactRefusedError, oi as DeclarationRefusedError, rr as recordsCapability, ua as normalizeSecretOwner, ui as InvalidRecordError, x as DATABASE_SNAPSHOT_SUFFIX, yi as RUNTIME_DEFAULTS } from "../../dist-X1r44BdF.mjs";
2
2
  import { r as retiredKeyStoreOf, t as purgeRetiredSettingsKeys } from "../../retired-settings-keys-C_Kjp-Bj.mjs";
3
- import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-BXYwFecW.mjs";
3
+ import { C as RecordsEngine, D as callVector, E as callRecords, O as controlTargetOf, S as trustResult, T as callData, _ as collectTransferables, a as WalMaintenance, c as vectorProviderOfOwnedFile, d as CrossDatabaseTransactError, f as DatabaseBusyError, l as SqliteSettingsBackend, m as rehydrateError, o as createVectorIndex, p as DuplicatePlacementError, s as vectorProviderOf, u as CollectionPlacementError, v as isFileHostMessage, w as callControl } from "../../wal-maintenance-D6J_MmZ8.mjs";
4
4
  import { r as isSnapshotWorkerMessage } from "../../sqlite-snapshot-protocol-2QaTouWV.mjs";
5
5
  import { a as isWorkerMessage, t as WAL_CHECKPOINT_LARGE_PASS_FRAMES } from "../../wal-checkpoint-policy-BahrTtyD.mjs";
6
6
  import { createRequire } from "node:module";