@camstack/server 1.2.928 → 1.2.929

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 (237) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/package.json +10 -8
  3. package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
  4. package/system/dist/addon-id-Di0lNJ89.js +50 -0
  5. package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
  6. package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
  7. package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
  8. package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
  9. package/system/dist/addon-utils.mjs +1 -1
  10. package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
  11. package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
  12. package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
  13. package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
  14. package/system/dist/base-device-2sL1DMm1.js +1103 -0
  15. package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
  16. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
  17. package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +6 -4
  18. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
  19. package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +7 -5
  20. package/system/dist/builtins/alerts/alerts.addon.js +113 -56
  21. package/system/dist/builtins/alerts/alerts.addon.mjs +60 -3
  22. package/system/dist/builtins/autotrack/index.js +21 -17
  23. package/system/dist/builtins/autotrack/index.mjs +5 -1
  24. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
  25. package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +8 -5
  26. package/system/dist/builtins/calendars/calendars.addon.js +8 -6
  27. package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
  28. package/system/dist/builtins/camera-grid/index.js +615 -58
  29. package/system/dist/builtins/camera-grid/index.mjs +558 -1
  30. package/system/dist/builtins/composer/composer.addon.js +788 -209
  31. package/system/dist/builtins/composer/composer.addon.mjs +583 -4
  32. package/system/dist/builtins/console-logging/index.js +4 -3
  33. package/system/dist/builtins/console-logging/index.mjs +2 -1
  34. package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
  36. package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
  37. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
  38. package/system/dist/builtins/device-history/device-history.addon.js +110 -31
  39. package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
  40. package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
  41. package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
  42. package/system/dist/builtins/hub-forwarder/index.js +4 -3
  43. package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
  44. package/system/dist/builtins/keychain/index.js +31 -28
  45. package/system/dist/builtins/keychain/index.mjs +7 -4
  46. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
  47. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
  48. package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
  49. package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
  50. package/system/dist/builtins/local-network/local-network.addon.js +43 -39
  51. package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
  52. package/system/dist/builtins/loki-logging/index.js +23 -17
  53. package/system/dist/builtins/loki-logging/index.mjs +7 -1
  54. package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
  55. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
  56. package/system/dist/builtins/platform-probe/index.js +25 -23
  57. package/system/dist/builtins/platform-probe/index.mjs +12 -10
  58. package/system/dist/builtins/record-entries/index.js +9 -7
  59. package/system/dist/builtins/record-entries/index.mjs +3 -1
  60. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
  61. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  62. package/system/dist/builtins/snapshot/index.js +97 -44
  63. package/system/dist/builtins/snapshot/index.mjs +54 -1
  64. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
  65. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
  66. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  67. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  68. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
  69. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
  70. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
  71. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
  72. package/system/dist/builtins/system-config/system-config.addon.js +17 -14
  73. package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
  74. package/system/dist/builtins/winston-logging/index.js +7 -5
  75. package/system/dist/builtins/winston-logging/index.mjs +3 -1
  76. package/system/dist/calendars.cap-CaFlShS9.js +155 -0
  77. package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
  78. package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
  79. package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
  80. package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
  81. package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
  82. package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
  83. package/system/dist/capability-definition-HCmTem8c.js +242 -0
  84. package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
  85. package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
  86. package/system/dist/command-origin-claim-Cief660O.js +35 -0
  87. package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
  88. package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
  89. package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
  90. package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
  91. package/system/dist/constants-C860Y6U4.js +26 -0
  92. package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
  93. package/system/dist/constants-DCLpoF4L.mjs +21 -0
  94. package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
  95. package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
  96. package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
  97. package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
  98. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  99. package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
  100. package/system/dist/custom-actions-D92NRi2c.js +36 -0
  101. package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
  102. package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
  103. package/system/dist/declared-device-BWphj9WE.js +303 -0
  104. package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
  105. package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
  106. package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
  107. package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
  108. package/system/dist/device-certificate-CguVACQO.js +162 -0
  109. package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
  110. package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
  111. package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
  112. package/system/dist/device-kind-CsSiv_YF.js +101 -0
  113. package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
  114. package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
  115. package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
  116. package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
  117. package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
  118. package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
  119. package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
  120. package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
  121. package/system/dist/device-type-CbQsnFdC.js +477 -0
  122. package/system/dist/device-type-DgEvK3ch.mjs +454 -0
  123. package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
  124. package/system/dist/entry-kind-cq90c--V.js +55 -0
  125. package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
  126. package/system/dist/error.cap-DBhgPeWK.js +3848 -0
  127. package/system/dist/file-host-worker.js +1 -1
  128. package/system/dist/file-host-worker.mjs +1 -1
  129. package/system/dist/history-catalog-BKRarIL_.js +831 -0
  130. package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
  131. package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
  132. package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
  133. package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
  134. package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
  135. package/system/dist/index.js +763 -151
  136. package/system/dist/index.mjs +832 -220
  137. package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
  138. package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
  139. package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
  140. package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
  141. package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
  142. package/system/dist/l10n-CGMvp7NF.js +15 -0
  143. package/system/dist/labels-DX5S8deC.js +81 -0
  144. package/system/dist/labels-DsBcU7md.mjs +64 -0
  145. package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
  146. package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
  147. package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
  148. package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
  149. package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
  150. package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
  151. package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
  152. package/system/dist/mask-shape-CmPA2fst.js +92 -0
  153. package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
  154. package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
  155. package/system/dist/migration-BMjgkyG2.js +380 -0
  156. package/system/dist/migration-DRJAtdy7.mjs +321 -0
  157. package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
  158. package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
  159. package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
  160. package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
  161. package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
  162. package/system/dist/ops-log-pxt9176Z.js +81 -0
  163. package/system/dist/pinned-binary-BOhOSNff.js +28 -0
  164. package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
  165. package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
  166. package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
  167. package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
  168. package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
  169. package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
  170. package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
  171. package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
  172. package/system/dist/quantity-lY1KiTSZ.js +143 -0
  173. package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
  174. package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
  175. package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
  176. package/system/dist/record-entries.cap-ti1C046R.js +80 -0
  177. package/system/dist/record-kind-DoBfYHCs.js +203 -0
  178. package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
  179. package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
  180. package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
  181. package/system/dist/records.cap-ClcWV64i.js +329 -0
  182. package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
  183. package/system/dist/relocate-CdVQAk-w.js +804 -0
  184. package/system/dist/relocate-CoZZTui1.mjs +661 -0
  185. package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
  186. package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
  187. package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
  188. package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
  189. package/system/dist/scoped-settings-CylSSq_8.js +955 -0
  190. package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
  191. package/system/dist/server-name-BIhLuHvX.mjs +35 -0
  192. package/system/dist/server-name-OALNvpqC.js +52 -0
  193. package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
  194. package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
  195. package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
  196. package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
  197. package/system/dist/source-info-DGB7SdB_.mjs +190 -0
  198. package/system/dist/source-info-DtWf4k2j.js +225 -0
  199. package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
  200. package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
  201. package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
  202. package/system/dist/storage-location-CTweDMZf.js +198 -0
  203. package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
  204. package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
  205. package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
  206. package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
  207. package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
  208. package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
  209. package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
  210. package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
  211. package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
  212. package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
  213. package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
  214. package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
  215. package/system/dist/system-reasons-Be_k1W8g.js +25 -0
  216. package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
  217. package/system/dist/tag-BxLazvVb.js +2138 -0
  218. package/system/dist/tag-uZBAq6ox.mjs +2073 -0
  219. package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
  220. package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
  221. package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
  222. package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
  223. package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
  224. package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
  225. package/system/dist/zod-secret-DS7mj1bk.js +78 -0
  226. package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
  227. package/system/package.json +1 -1
  228. package/system/dist/composition-sources-BI614LJx.mjs +0 -141
  229. package/system/dist/composition-sources-v_kkb8A9.js +0 -152
  230. package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
  231. package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
  232. package/system/dist/dist-BCHMSqzc.mjs +0 -143467
  233. package/system/dist/dist-BZfvhfS1.js +0 -146970
  234. package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
  235. package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
  236. package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
  237. package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
@@ -0,0 +1,564 @@
1
+ const require_chunk = require("./chunk-Cek0wNdY.js");
2
+ let _camstack_types_node = require("@camstack/types/node");
3
+ let node_fs = require("node:fs");
4
+ node_fs = require_chunk.__toESM(node_fs);
5
+ //#region ../types/dist/esm/inference/coral-units.mjs
6
+ /** Bus order of the enumeration: USB first (the historical key), then PCIe. */
7
+ var BUS_ORDER = ["usb", "pci"];
8
+ function unitDevice(bus, index) {
9
+ return index === 0 ? bus : `${bus}:${index}`;
10
+ }
11
+ function countOn(coral, bus) {
12
+ if (coral.units !== void 0) return coral.units.filter((u) => u.bus === bus).reduce((n, u) => n + Math.max(0, u.count), 0);
13
+ return bus === (coral.bus === "pci" ? "pci" : "usb") ? Math.max(1, coral.count ?? 1) : 0;
14
+ }
15
+ /** Every usable Coral unit on a node, USB first then PCIe, in ordinal order. */
16
+ function coralUsableUnits(coral) {
17
+ if (coral == null) return [];
18
+ const out = [];
19
+ for (const bus of BUS_ORDER) {
20
+ const count = countOn(coral, bus);
21
+ for (let index = 0; index < count; index++) out.push({
22
+ bus,
23
+ index,
24
+ device: unitDevice(bus, index)
25
+ });
26
+ }
27
+ return out;
28
+ }
29
+ //#endregion
30
+ //#region ../types/dist/esm/inference/runtime-capabilities.mjs
31
+ var AUTO = {
32
+ value: "auto",
33
+ label: "Auto"
34
+ };
35
+ var CPU = {
36
+ value: "cpu",
37
+ label: "CPU"
38
+ };
39
+ var USB = {
40
+ value: "usb",
41
+ label: "Coral USB"
42
+ };
43
+ function coralUnitOption(unit) {
44
+ const bus = unit.bus === "pci" ? "PCIe" : "USB";
45
+ const label = unit.index === 0 ? `Coral ${bus}` : `Coral ${bus} ${unit.index + 1}`;
46
+ return {
47
+ value: unit.device,
48
+ label
49
+ };
50
+ }
51
+ var ONNX_CUDA_EP = "CUDAExecutionProvider";
52
+ /**
53
+ * The `HardwareInfo.nvidia` slot for a found card. Usable only when the node's
54
+ * ONNX Runtime lists the CUDA execution provider (`ort.get_available_providers()`,
55
+ * the signal the inference pool binds on); `null` = not reported = not usable.
56
+ */
57
+ function describeNvidia(probe, onnxExecutionProviders) {
58
+ const base = {
59
+ type: "nvidia",
60
+ name: probe.name,
61
+ ...probe.memoryMB === void 0 ? {} : { memoryMB: probe.memoryMB }
62
+ };
63
+ return onnxExecutionProviders?.includes(ONNX_CUDA_EP) === true ? {
64
+ ...base,
65
+ usable: true
66
+ } : {
67
+ ...base,
68
+ usable: false,
69
+ reason: "no-cuda-execution-provider"
70
+ };
71
+ }
72
+ /**
73
+ * CUDA is offered only for a USABLE NVIDIA slot. An NVIDIA GPU alone is not
74
+ * enough: without the EP the pool binds the CPU provider and a `cuda` device
75
+ * would be the CPU under another name. `gpu.type === 'nvidia'` (older nodes)
76
+ * never counts.
77
+ */
78
+ function onnxCudaAvailable(hw) {
79
+ return hw?.nvidia?.usable === true;
80
+ }
81
+ var RUNTIMES = [
82
+ {
83
+ id: "onnx",
84
+ supports: () => true,
85
+ devices: (hw) => {
86
+ if (!hw) return [CPU];
87
+ const out = [CPU];
88
+ if (onnxCudaAvailable(hw)) out.push({
89
+ value: "cuda",
90
+ label: "CUDA"
91
+ });
92
+ if (hw.gpu?.type === "amd" && hw.platform === "linux") out.push({
93
+ value: "webgpu",
94
+ label: "WebGPU (AMD iGPU)"
95
+ });
96
+ if (hw.npu?.type === "apple-ane") out.push({
97
+ value: "coreml",
98
+ label: "CoreML EP"
99
+ });
100
+ return out;
101
+ },
102
+ defaultDevice: "cpu"
103
+ },
104
+ {
105
+ id: "openvino",
106
+ supports: (hw) => hw?.arch === "x64" && hw.platform !== "darwin" && (hw.gpu?.type === "intel" || hw.gpu?.type === "amd"),
107
+ devices: (hw) => {
108
+ if (!hw) return [AUTO];
109
+ if (hw.gpu?.type === "amd") return [CPU];
110
+ const out = [AUTO, CPU];
111
+ if (hw.gpu?.type === "intel") out.push({
112
+ value: "gpu",
113
+ label: "GPU"
114
+ });
115
+ if (hw.npu?.type === "intel-npu") out.push({
116
+ value: "npu",
117
+ label: "NPU"
118
+ });
119
+ return out;
120
+ },
121
+ defaultDevice: "auto"
122
+ },
123
+ {
124
+ id: "coreml",
125
+ supports: (hw) => hw?.platform === "darwin",
126
+ devices: (hw) => {
127
+ const all = {
128
+ value: "all",
129
+ label: "All (ANE + GPU + CPU)"
130
+ };
131
+ if (!hw) return [all];
132
+ const out = [all];
133
+ if (hw.npu?.type === "apple-ane") out.push({
134
+ value: "ane",
135
+ label: "Apple Neural Engine"
136
+ });
137
+ out.push({
138
+ value: "gpu",
139
+ label: "GPU"
140
+ }, CPU);
141
+ return out;
142
+ },
143
+ defaultDevice: "all"
144
+ },
145
+ {
146
+ id: "edgetpu",
147
+ supports: (hw) => coralUsableUnits(hw?.coral).length > 0,
148
+ devices: (hw) => {
149
+ const units = coralUsableUnits(hw?.coral);
150
+ return units.length > 0 ? units.map(coralUnitOption) : [USB];
151
+ },
152
+ defaultDevice: "usb"
153
+ }
154
+ ];
155
+ /**
156
+ * Returns the list of supported runtime IDs for given hardware.
157
+ * onnx is always included (universal floor); accelerators added when hw matches.
158
+ */
159
+ function supportedRuntimes(hw) {
160
+ return RUNTIMES.filter((r) => r.supports(hw)).map((r) => r.id);
161
+ }
162
+ /**
163
+ * Scores all applicable inference backends for the given hardware.
164
+ *
165
+ * Rules (hardware-driven only — no Python import probes):
166
+ * - coreml: score 95, darwin+arm64
167
+ * - cuda: score 85, only for a usable `nvidia` slot (the CUDA EP exists)
168
+ * - openvino: score 90 if intel-npu present, else 80 if intel gpu
169
+ * - edgetpu: score 70, a usable Coral unit (USB or PCIe)
170
+ * - cpu: score 50 (universal floor, always included)
171
+ *
172
+ * All hardware-matched entries are `available: true`.
173
+ * Scores are sorted descending; `best` is the first available entry
174
+ * (or last entry as fallback).
175
+ */
176
+ function scoreRuntimes(hw) {
177
+ const scores = [];
178
+ if (hw.platform === "darwin" && hw.arch === "arm64") scores.push({
179
+ runtime: "python",
180
+ backend: "coreml",
181
+ format: "coreml",
182
+ score: 95,
183
+ reason: "Apple Neural Engine (Python CoreML)",
184
+ available: true
185
+ });
186
+ if (onnxCudaAvailable(hw)) scores.push({
187
+ runtime: "python",
188
+ backend: "cuda",
189
+ format: "onnx",
190
+ score: 85,
191
+ reason: "NVIDIA CUDA (Python ONNX Runtime)",
192
+ available: true
193
+ });
194
+ if (hw.gpu?.type === "intel") {
195
+ const score = hw.npu?.type === "intel-npu" ? 90 : 80;
196
+ scores.push({
197
+ runtime: "python",
198
+ backend: "openvino",
199
+ format: "openvino",
200
+ score,
201
+ reason: "Intel OpenVINO",
202
+ available: true
203
+ });
204
+ }
205
+ if (hw.gpu?.type === "amd") {
206
+ if (hw.platform === "linux") scores.push({
207
+ runtime: "python",
208
+ backend: "onnx",
209
+ format: "onnx",
210
+ score: 75,
211
+ reason: "ONNX WebGPU (AMD iGPU)",
212
+ available: true
213
+ });
214
+ scores.push({
215
+ runtime: "python",
216
+ backend: "openvino",
217
+ format: "openvino",
218
+ score: 65,
219
+ reason: "OpenVINO CPU (AMD x64)",
220
+ available: true
221
+ });
222
+ }
223
+ if (coralUsableUnits(hw.coral).length > 0) scores.push({
224
+ runtime: "python",
225
+ backend: "edgetpu",
226
+ format: "tflite",
227
+ score: 70,
228
+ reason: "Coral Edge TPU (Python LiteRT)",
229
+ available: true
230
+ });
231
+ scores.push({
232
+ runtime: "python",
233
+ backend: "cpu",
234
+ format: "onnx",
235
+ score: 50,
236
+ reason: "CPU (Python ONNX Runtime)",
237
+ available: true
238
+ });
239
+ const sorted = scores.toSorted((a, b) => b.score - a.score);
240
+ return {
241
+ scores: sorted,
242
+ best: sorted.find((s) => s.available) ?? sorted[sorted.length - 1]
243
+ };
244
+ }
245
+ var DEVICE_FOR_BACKEND = {
246
+ cuda: "gpu",
247
+ edgetpu: "usb",
248
+ coreml: "all",
249
+ cpu: "cpu"
250
+ };
251
+ function device(backend, dev, format, score) {
252
+ return {
253
+ key: backend === "cpu" ? "cpu" : `${backend}:${dev}`,
254
+ backend,
255
+ device: dev,
256
+ format,
257
+ runtime: "python",
258
+ score,
259
+ available: true
260
+ };
261
+ }
262
+ /**
263
+ * Enumerate every usable inference device on a node — one descriptor PER PHYSICAL
264
+ * ACCELERATOR, so the orchestrator can run and balance across all of them
265
+ * CONCURRENTLY (each device is its own pool). Critically, OpenVINO is expanded
266
+ * into its distinct devices (NPU / iGPU / CPU) rather than a single AUTO entry:
267
+ * the Intel NPU ("AI Boost") and the iGPU are separate accelerators and run in
268
+ * parallel — collapsing them to AUTO would leave one idle. NPU is scored above
269
+ * the iGPU (faster for int8 detection AND frees the GPU).
270
+ */
271
+ function enumerateInferenceDevices(hw) {
272
+ const { scores } = scoreRuntimes(hw);
273
+ const out = [];
274
+ for (const s of scores) {
275
+ if (s.backend === "openvino") {
276
+ if (hw.npu?.type === "intel-npu") out.push(device("openvino", "npu", s.format, s.score + 2));
277
+ if (hw.gpu?.type === "intel") out.push(device("openvino", "gpu", s.format, s.score));
278
+ if (hw.gpu?.type === "amd") out.push(device("openvino", "cpu", s.format, s.score));
279
+ continue;
280
+ }
281
+ if (s.backend === "edgetpu") {
282
+ for (const unit of coralUsableUnits(hw.coral)) out.push(device("edgetpu", unit.device, s.format, s.score));
283
+ continue;
284
+ }
285
+ if (s.backend === "onnx" && s.reason.startsWith("ONNX WebGPU")) {
286
+ out.push(device("onnx", "webgpu", s.format, s.score));
287
+ continue;
288
+ }
289
+ const dev = DEVICE_FOR_BACKEND[s.backend] ?? s.backend;
290
+ out.push(device(s.backend, dev, s.format, s.score));
291
+ }
292
+ return out;
293
+ }
294
+ //#endregion
295
+ //#region src/builtins/platform-probe/coral-accelerators.ts
296
+ /**
297
+ * Coral USB Edge TPU USB identifiers.
298
+ *
299
+ * The device enumerates as `1a6e:089a` (Global Unichip) BEFORE the libedgetpu
300
+ * firmware loads, then re-enumerates as `18d1:9302` (Google) AFTER. Either id
301
+ * means a Coral is physically attached, so both count as a positive signal.
302
+ */
303
+ var CORAL_USB_IDS = [{
304
+ vendor: "1a6e",
305
+ product: "089a"
306
+ }, {
307
+ vendor: "18d1",
308
+ product: "9302"
309
+ }];
310
+ /** The PCIe / M.2 Coral's PCI function id (Global Unichip "Apex"). */
311
+ var CORAL_PCI_VENDOR = "0x1ac1";
312
+ var CORAL_PCI_DEVICE = "0x089a";
313
+ /** A unit the apex driver bound: `/sys/class/apex/apex_<N>` ↔ `/dev/apex_<N>`. */
314
+ var APEX_ENTRY = /^apex_(\d+)$/;
315
+ function currentDelegateHost() {
316
+ return {
317
+ platform: process.platform,
318
+ dataDir: (0, _camstack_types_node.nodeDataRootFromEnv)(process.env),
319
+ override: process.env[_camstack_types_node.EDGETPU_LIB_ENV]
320
+ };
321
+ }
322
+ /** usbfs names a device `/dev/bus/usb/<busnum>/<devnum>`, each zero-padded to three digits. */
323
+ function usbDeviceNode(device, fsx) {
324
+ const bus = Number.parseInt(fsx.readUsbAttr(device, "busnum"), 10);
325
+ const dev = Number.parseInt(fsx.readUsbAttr(device, "devnum"), 10);
326
+ if (!Number.isInteger(bus) || !Number.isInteger(dev) || bus <= 0 || dev <= 0) return null;
327
+ return `/dev/bus/usb/${String(bus).padStart(3, "0")}/${String(dev).padStart(3, "0")}`;
328
+ }
329
+ /**
330
+ * USB units: sysfs is the HOST's view — a container whose `/dev/bus/usb`
331
+ * mapping was removed still lists the stick under `/sys/bus/usb/devices`. A
332
+ * listed Coral is usable only when its usbfs device node is in this process's
333
+ * view AND opens read/write; otherwise it is present but not accessible.
334
+ */
335
+ function classifyUsb(devices, fsx) {
336
+ let usable = 0;
337
+ const inaccessibleNodes = [];
338
+ for (const device of devices) {
339
+ const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
340
+ const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
341
+ if (!CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) continue;
342
+ const node = usbDeviceNode(device, fsx);
343
+ if (node !== null && fsx.exists(node) && fsx.canOpen(node)) usable++;
344
+ else inaccessibleNodes.push(node ?? `/sys/bus/usb/devices/${device}`);
345
+ }
346
+ return {
347
+ usable,
348
+ inaccessibleNodes
349
+ };
350
+ }
351
+ function countPciCorals(fsx) {
352
+ let count = 0;
353
+ for (const device of fsx.listPciDevices()) {
354
+ const vendor = fsx.readPciAttr(device, "vendor").toLowerCase();
355
+ const product = fsx.readPciAttr(device, "device").toLowerCase();
356
+ if (vendor === CORAL_PCI_VENDOR && product === CORAL_PCI_DEVICE) count++;
357
+ }
358
+ return count;
359
+ }
360
+ /**
361
+ * PCIe units: each `/sys/class/apex/apex_N` is a unit the driver bound; it is
362
+ * usable only when `/dev/apex_N` is in this process's view AND opens read/write.
363
+ * PCI functions with the Coral id beyond the bound units have no driver.
364
+ */
365
+ function classifyPci(fsx) {
366
+ let usable = 0;
367
+ let notAccessible = 0;
368
+ for (const entry of fsx.listApexClass()) {
369
+ const match = APEX_ENTRY.exec(entry);
370
+ if (match === null) continue;
371
+ const node = `/dev/apex_${match[1]}`;
372
+ if (fsx.exists(node) && fsx.canOpen(node)) usable++;
373
+ else notAccessible++;
374
+ }
375
+ const driverMissing = Math.max(0, countPciCorals(fsx) - usable - notAccessible);
376
+ return {
377
+ usable,
378
+ notAccessible,
379
+ driverMissing
380
+ };
381
+ }
382
+ /**
383
+ * Detect Coral Edge TPUs on USB and PCIe/M.2 — the answer only. See
384
+ * {@link detectCoralAccelerator} for the evidence that decided it.
385
+ */
386
+ function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
387
+ return detectCoralAccelerator(fsx, delegateHost).info;
388
+ }
389
+ /**
390
+ * Detect Coral Edge TPUs on USB and PCIe/M.2, with the evidence that decided.
391
+ *
392
+ * - USB: every matching USB device counts (multiple Corals run concurrently),
393
+ * usable only if its `/dev/bus/usb/<BBB>/<DDD>` node opens read/write — a
394
+ * listed stick whose node is missing or refused is `device-not-accessible`.
395
+ * - PCIe: the apex driver's units, each usable only if its device node opens;
396
+ * a Coral PCI function the driver did not bind is `driver-missing`.
397
+ * - Fallback: when the USB bus is NOT OBSERVABLE (`/sys/bus/usb/devices`
398
+ * missing, unreadable or empty — a macOS desktop, a restricted container)
399
+ * and no PCI Coral was seen, an installed libedgetpu delegate means one USB
400
+ * Coral is assumed. A bus that IS readable and lists no Coral id is the
401
+ * answer: no USB Coral. The delegate stays installed after a stick is
402
+ * unplugged or moved to another node, so it is evidence only where nothing
403
+ * better exists (D919).
404
+ *
405
+ * Returns `null` only when no Coral was found at all; a present-but-unusable
406
+ * Coral is reported with its typed reason, never as absent (D393/D315).
407
+ */
408
+ function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
409
+ const usbDevices = fsx.listUsbDevices();
410
+ const usbBus = usbDevices !== null && usbDevices.length > 0 ? "observed" : "unobservable";
411
+ const usb = usbDevices === null ? {
412
+ usable: 0,
413
+ inaccessibleNodes: []
414
+ } : classifyUsb(usbDevices, fsx);
415
+ const usbSeen = usb.usable + usb.inaccessibleNodes.length;
416
+ const inaccessibleUsbNodes = usb.inaccessibleNodes;
417
+ const pci = classifyPci(fsx);
418
+ const units = [];
419
+ if (usb.usable > 0) units.push({
420
+ bus: "usb",
421
+ count: usb.usable
422
+ });
423
+ if (pci.usable > 0) units.push({
424
+ bus: "pci",
425
+ count: pci.usable
426
+ });
427
+ const unavailable = [];
428
+ if (usb.inaccessibleNodes.length > 0) unavailable.push({
429
+ bus: "usb",
430
+ count: usb.inaccessibleNodes.length,
431
+ reason: "device-not-accessible"
432
+ });
433
+ if (pci.driverMissing > 0) unavailable.push({
434
+ bus: "pci",
435
+ count: pci.driverMissing,
436
+ reason: "driver-missing"
437
+ });
438
+ if (pci.notAccessible > 0) unavailable.push({
439
+ bus: "pci",
440
+ count: pci.notAccessible,
441
+ reason: "device-not-accessible"
442
+ });
443
+ if (units.length > 0 || unavailable.length > 0) return {
444
+ info: unavailable.length > 0 ? {
445
+ type: "coral-edgetpu",
446
+ units,
447
+ unavailable
448
+ } : {
449
+ type: "coral-edgetpu",
450
+ units
451
+ },
452
+ usbBus,
453
+ decidedBy: usbSeen > 0 ? "usb-ids" : "pci",
454
+ inaccessibleUsbNodes
455
+ };
456
+ if (usbBus === "unobservable" && (0, _camstack_types_node.chooseEdgetpuDelegate)({
457
+ ...delegateHost,
458
+ exists: (p) => fsx.exists(p)
459
+ }) !== null) return {
460
+ info: {
461
+ type: "coral-edgetpu",
462
+ units: [{
463
+ bus: "usb",
464
+ count: 1
465
+ }]
466
+ },
467
+ usbBus,
468
+ decidedBy: "delegate-fallback",
469
+ inaccessibleUsbNodes
470
+ };
471
+ return {
472
+ info: null,
473
+ usbBus,
474
+ decidedBy: "none",
475
+ inaccessibleUsbNodes
476
+ };
477
+ }
478
+ function safeListOrNull(dir) {
479
+ try {
480
+ return node_fs.default.readdirSync(dir);
481
+ } catch {
482
+ return null;
483
+ }
484
+ }
485
+ function safeList(dir) {
486
+ try {
487
+ return node_fs.default.readdirSync(dir);
488
+ } catch {
489
+ return [];
490
+ }
491
+ }
492
+ function safeRead(path) {
493
+ try {
494
+ return node_fs.default.readFileSync(path, "utf8").trim();
495
+ } catch {
496
+ return "";
497
+ }
498
+ }
499
+ /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
500
+ var nodeCoralFs = {
501
+ listUsbDevices: () => safeListOrNull("/sys/bus/usb/devices"),
502
+ readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
503
+ listPciDevices: () => safeList("/sys/bus/pci/devices"),
504
+ readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
505
+ listApexClass: () => safeList("/sys/class/apex"),
506
+ canOpen: (path) => {
507
+ try {
508
+ node_fs.default.accessSync(path, node_fs.default.constants.R_OK | node_fs.default.constants.W_OK);
509
+ return true;
510
+ } catch {
511
+ return false;
512
+ }
513
+ },
514
+ exists: (path) => {
515
+ try {
516
+ return node_fs.default.existsSync(path);
517
+ } catch {
518
+ return false;
519
+ }
520
+ }
521
+ };
522
+ //#endregion
523
+ Object.defineProperty(exports, "classifyCoralAccelerator", {
524
+ enumerable: true,
525
+ get: function() {
526
+ return classifyCoralAccelerator;
527
+ }
528
+ });
529
+ Object.defineProperty(exports, "describeNvidia", {
530
+ enumerable: true,
531
+ get: function() {
532
+ return describeNvidia;
533
+ }
534
+ });
535
+ Object.defineProperty(exports, "detectCoralAccelerator", {
536
+ enumerable: true,
537
+ get: function() {
538
+ return detectCoralAccelerator;
539
+ }
540
+ });
541
+ Object.defineProperty(exports, "enumerateInferenceDevices", {
542
+ enumerable: true,
543
+ get: function() {
544
+ return enumerateInferenceDevices;
545
+ }
546
+ });
547
+ Object.defineProperty(exports, "nodeCoralFs", {
548
+ enumerable: true,
549
+ get: function() {
550
+ return nodeCoralFs;
551
+ }
552
+ });
553
+ Object.defineProperty(exports, "scoreRuntimes", {
554
+ enumerable: true,
555
+ get: function() {
556
+ return scoreRuntimes;
557
+ }
558
+ });
559
+ Object.defineProperty(exports, "supportedRuntimes", {
560
+ enumerable: true,
561
+ get: function() {
562
+ return supportedRuntimes;
563
+ }
564
+ });