@camstack/server 1.2.928 → 1.2.930

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 (241) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +10 -10
  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/actions-service.d.ts +18 -1
  35. package/system/dist/builtins/core-blocks/core-blocks.addon.js +8670 -386
  36. package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +8294 -11
  37. package/system/dist/builtins/core-blocks/tcp-connect.d.ts +3 -0
  38. package/system/dist/builtins/core-notifier/core-notifier.addon.js +250 -21
  39. package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +230 -1
  40. package/system/dist/builtins/device-history/device-history.addon.js +110 -31
  41. package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
  42. package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
  43. package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
  44. package/system/dist/builtins/hub-forwarder/index.js +4 -3
  45. package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
  46. package/system/dist/builtins/keychain/index.js +31 -28
  47. package/system/dist/builtins/keychain/index.mjs +7 -4
  48. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
  49. package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
  50. package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
  51. package/system/dist/builtins/local-auth/local-auth.addon.mjs +106 -6
  52. package/system/dist/builtins/local-network/local-network.addon.js +43 -39
  53. package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
  54. package/system/dist/builtins/loki-logging/index.js +23 -17
  55. package/system/dist/builtins/loki-logging/index.mjs +7 -1
  56. package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
  57. package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +151 -10
  58. package/system/dist/builtins/platform-probe/index.js +25 -23
  59. package/system/dist/builtins/platform-probe/index.mjs +12 -10
  60. package/system/dist/builtins/record-entries/index.js +9 -7
  61. package/system/dist/builtins/record-entries/index.mjs +3 -1
  62. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
  63. package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
  64. package/system/dist/builtins/snapshot/index.js +97 -44
  65. package/system/dist/builtins/snapshot/index.mjs +54 -1
  66. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
  67. package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +21 -20
  68. package/system/dist/builtins/sqlite-storage/index.js +1 -1
  69. package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
  70. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
  71. package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
  72. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
  73. package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
  74. package/system/dist/builtins/system-config/system-config.addon.js +17 -14
  75. package/system/dist/builtins/system-config/system-config.addon.mjs +118 -115
  76. package/system/dist/builtins/winston-logging/index.js +7 -5
  77. package/system/dist/builtins/winston-logging/index.mjs +3 -1
  78. package/system/dist/calendars.cap-CaFlShS9.js +155 -0
  79. package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
  80. package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
  81. package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
  82. package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
  83. package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
  84. package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
  85. package/system/dist/capability-definition-HCmTem8c.js +242 -0
  86. package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
  87. package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
  88. package/system/dist/command-origin-claim-Cief660O.js +35 -0
  89. package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
  90. package/system/dist/composition-sources-BEUWn2s_.mjs +391 -0
  91. package/system/dist/composition-sources-acfR4hDq.js +408 -0
  92. package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
  93. package/system/dist/constants-C860Y6U4.js +26 -0
  94. package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
  95. package/system/dist/constants-DCLpoF4L.mjs +21 -0
  96. package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
  97. package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
  98. package/system/dist/core-blocks.cap-BMeMCBrx.js +18733 -0
  99. package/system/dist/core-blocks.cap-BRPsLAij.mjs +18008 -0
  100. package/system/dist/{custom-action-registry-N7flBDwT.mjs → custom-action-registry-B9zFBNVa.mjs} +37 -37
  101. package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
  102. package/system/dist/custom-actions-D92NRi2c.js +36 -0
  103. package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
  104. package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
  105. package/system/dist/declared-device-BWphj9WE.js +303 -0
  106. package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
  107. package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
  108. package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
  109. package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
  110. package/system/dist/device-certificate-CguVACQO.js +162 -0
  111. package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
  112. package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
  113. package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
  114. package/system/dist/device-kind-CsSiv_YF.js +101 -0
  115. package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
  116. package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
  117. package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
  118. package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
  119. package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
  120. package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
  121. package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
  122. package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
  123. package/system/dist/device-type-CbQsnFdC.js +477 -0
  124. package/system/dist/device-type-DgEvK3ch.mjs +454 -0
  125. package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
  126. package/system/dist/entry-kind-cq90c--V.js +55 -0
  127. package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
  128. package/system/dist/error.cap-DBhgPeWK.js +3848 -0
  129. package/system/dist/file-host-worker.js +1 -1
  130. package/system/dist/file-host-worker.mjs +1 -1
  131. package/system/dist/history-catalog-BKRarIL_.js +831 -0
  132. package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
  133. package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
  134. package/system/dist/{hub-identity-CYC1820R.mjs → hub-identity-DjMN9Ac2.mjs} +10 -10
  135. package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
  136. package/system/dist/{hub-mdns-ciao-CCDxM5qz.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
  137. package/system/dist/index.js +763 -151
  138. package/system/dist/index.mjs +832 -220
  139. package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
  140. package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
  141. package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
  142. package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
  143. package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
  144. package/system/dist/l10n-CGMvp7NF.js +15 -0
  145. package/system/dist/labels-DX5S8deC.js +81 -0
  146. package/system/dist/labels-DsBcU7md.mjs +64 -0
  147. package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
  148. package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
  149. package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
  150. package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
  151. package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
  152. package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
  153. package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
  154. package/system/dist/mask-shape-CmPA2fst.js +92 -0
  155. package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
  156. package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
  157. package/system/dist/migration-BMjgkyG2.js +380 -0
  158. package/system/dist/migration-DRJAtdy7.mjs +321 -0
  159. package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
  160. package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
  161. package/system/dist/notification-rules.cap-BDh0LDhV.js +3428 -0
  162. package/system/dist/notification-rules.cap-DUmiMBQB.mjs +3357 -0
  163. package/system/dist/notification-targets-CRH-9Dy5.js +509 -0
  164. package/system/dist/notification-targets-DaNE-pIt.mjs +486 -0
  165. package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
  166. package/system/dist/ops-log-pxt9176Z.js +81 -0
  167. package/system/dist/pinned-binary-BOhOSNff.js +28 -0
  168. package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
  169. package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
  170. package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
  171. package/system/dist/prefix-walk-BkMxoXpL.js +843 -0
  172. package/system/dist/prefix-walk-ifwg_ukx.mjs +790 -0
  173. package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
  174. package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
  175. package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
  176. package/system/dist/quantity-lY1KiTSZ.js +143 -0
  177. package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
  178. package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
  179. package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
  180. package/system/dist/record-entries.cap-ti1C046R.js +80 -0
  181. package/system/dist/record-kind-DoBfYHCs.js +203 -0
  182. package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
  183. package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
  184. package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
  185. package/system/dist/records.cap-ClcWV64i.js +329 -0
  186. package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
  187. package/system/dist/relocate-CdVQAk-w.js +804 -0
  188. package/system/dist/relocate-CoZZTui1.mjs +661 -0
  189. package/system/dist/rename-composition-block-BJsL58Ih.js +34798 -0
  190. package/system/dist/rename-composition-block-OAtErZgq.mjs +33631 -0
  191. package/system/dist/{restore-archive-BJfyu0sG.mjs → restore-archive-CjAyKpgX.mjs} +96 -94
  192. package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
  193. package/system/dist/scoped-settings-CylSSq_8.js +955 -0
  194. package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
  195. package/system/dist/server-name-BIhLuHvX.mjs +35 -0
  196. package/system/dist/server-name-OALNvpqC.js +52 -0
  197. package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
  198. package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
  199. package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
  200. package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
  201. package/system/dist/source-info-DGB7SdB_.mjs +190 -0
  202. package/system/dist/source-info-DtWf4k2j.js +225 -0
  203. package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
  204. package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
  205. package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
  206. package/system/dist/storage-location-CTweDMZf.js +198 -0
  207. package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
  208. package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
  209. package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
  210. package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
  211. package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
  212. package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
  213. package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
  214. package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
  215. package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
  216. package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
  217. package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
  218. package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
  219. package/system/dist/system-reasons-Be_k1W8g.js +25 -0
  220. package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
  221. package/system/dist/tag-BxLazvVb.js +2138 -0
  222. package/system/dist/tag-uZBAq6ox.mjs +2073 -0
  223. package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
  224. package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
  225. package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
  226. package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
  227. package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
  228. package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
  229. package/system/dist/zod-secret-DS7mj1bk.js +78 -0
  230. package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
  231. package/system/package.json +1 -1
  232. package/system/dist/composition-sources-BI614LJx.mjs +0 -141
  233. package/system/dist/composition-sources-v_kkb8A9.js +0 -152
  234. package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
  235. package/system/dist/coral-accelerators-BW3OcrLD.mjs +0 -231
  236. package/system/dist/dist-BCHMSqzc.mjs +0 -143467
  237. package/system/dist/dist-BZfvhfS1.js +0 -146970
  238. package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
  239. package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
  240. package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
  241. package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
@@ -1,250 +0,0 @@
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 src/builtins/platform-probe/coral-accelerators.ts
6
- /**
7
- * Coral USB Edge TPU USB identifiers.
8
- *
9
- * The device enumerates as `1a6e:089a` (Global Unichip) BEFORE the libedgetpu
10
- * firmware loads, then re-enumerates as `18d1:9302` (Google) AFTER. Either id
11
- * means a Coral is physically attached, so both count as a positive signal.
12
- */
13
- var CORAL_USB_IDS = [{
14
- vendor: "1a6e",
15
- product: "089a"
16
- }, {
17
- vendor: "18d1",
18
- product: "9302"
19
- }];
20
- /** The PCIe / M.2 Coral's PCI function id (Global Unichip "Apex"). */
21
- var CORAL_PCI_VENDOR = "0x1ac1";
22
- var CORAL_PCI_DEVICE = "0x089a";
23
- /** A unit the apex driver bound: `/sys/class/apex/apex_<N>` ↔ `/dev/apex_<N>`. */
24
- var APEX_ENTRY = /^apex_(\d+)$/;
25
- function currentDelegateHost() {
26
- return {
27
- platform: process.platform,
28
- dataDir: (0, _camstack_types_node.nodeDataRootFromEnv)(process.env),
29
- override: process.env[_camstack_types_node.EDGETPU_LIB_ENV]
30
- };
31
- }
32
- /** usbfs names a device `/dev/bus/usb/<busnum>/<devnum>`, each zero-padded to three digits. */
33
- function usbDeviceNode(device, fsx) {
34
- const bus = Number.parseInt(fsx.readUsbAttr(device, "busnum"), 10);
35
- const dev = Number.parseInt(fsx.readUsbAttr(device, "devnum"), 10);
36
- if (!Number.isInteger(bus) || !Number.isInteger(dev) || bus <= 0 || dev <= 0) return null;
37
- return `/dev/bus/usb/${String(bus).padStart(3, "0")}/${String(dev).padStart(3, "0")}`;
38
- }
39
- /**
40
- * USB units: sysfs is the HOST's view — a container whose `/dev/bus/usb`
41
- * mapping was removed still lists the stick under `/sys/bus/usb/devices`. A
42
- * listed Coral is usable only when its usbfs device node is in this process's
43
- * view AND opens read/write; otherwise it is present but not accessible.
44
- */
45
- function classifyUsb(devices, fsx) {
46
- let usable = 0;
47
- const inaccessibleNodes = [];
48
- for (const device of devices) {
49
- const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
50
- const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
51
- if (!CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) continue;
52
- const node = usbDeviceNode(device, fsx);
53
- if (node !== null && fsx.exists(node) && fsx.canOpen(node)) usable++;
54
- else inaccessibleNodes.push(node ?? `/sys/bus/usb/devices/${device}`);
55
- }
56
- return {
57
- usable,
58
- inaccessibleNodes
59
- };
60
- }
61
- function countPciCorals(fsx) {
62
- let count = 0;
63
- for (const device of fsx.listPciDevices()) {
64
- const vendor = fsx.readPciAttr(device, "vendor").toLowerCase();
65
- const product = fsx.readPciAttr(device, "device").toLowerCase();
66
- if (vendor === CORAL_PCI_VENDOR && product === CORAL_PCI_DEVICE) count++;
67
- }
68
- return count;
69
- }
70
- /**
71
- * PCIe units: each `/sys/class/apex/apex_N` is a unit the driver bound; it is
72
- * usable only when `/dev/apex_N` is in this process's view AND opens read/write.
73
- * PCI functions with the Coral id beyond the bound units have no driver.
74
- */
75
- function classifyPci(fsx) {
76
- let usable = 0;
77
- let notAccessible = 0;
78
- for (const entry of fsx.listApexClass()) {
79
- const match = APEX_ENTRY.exec(entry);
80
- if (match === null) continue;
81
- const node = `/dev/apex_${match[1]}`;
82
- if (fsx.exists(node) && fsx.canOpen(node)) usable++;
83
- else notAccessible++;
84
- }
85
- const driverMissing = Math.max(0, countPciCorals(fsx) - usable - notAccessible);
86
- return {
87
- usable,
88
- notAccessible,
89
- driverMissing
90
- };
91
- }
92
- /**
93
- * Detect Coral Edge TPUs on USB and PCIe/M.2 — the answer only. See
94
- * {@link detectCoralAccelerator} for the evidence that decided it.
95
- */
96
- function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
97
- return detectCoralAccelerator(fsx, delegateHost).info;
98
- }
99
- /**
100
- * Detect Coral Edge TPUs on USB and PCIe/M.2, with the evidence that decided.
101
- *
102
- * - USB: every matching USB device counts (multiple Corals run concurrently),
103
- * usable only if its `/dev/bus/usb/<BBB>/<DDD>` node opens read/write — a
104
- * listed stick whose node is missing or refused is `device-not-accessible`.
105
- * - PCIe: the apex driver's units, each usable only if its device node opens;
106
- * a Coral PCI function the driver did not bind is `driver-missing`.
107
- * - Fallback: when the USB bus is NOT OBSERVABLE (`/sys/bus/usb/devices`
108
- * missing, unreadable or empty — a macOS desktop, a restricted container)
109
- * and no PCI Coral was seen, an installed libedgetpu delegate means one USB
110
- * Coral is assumed. A bus that IS readable and lists no Coral id is the
111
- * answer: no USB Coral. The delegate stays installed after a stick is
112
- * unplugged or moved to another node, so it is evidence only where nothing
113
- * better exists (D919).
114
- *
115
- * Returns `null` only when no Coral was found at all; a present-but-unusable
116
- * Coral is reported with its typed reason, never as absent (D393/D315).
117
- */
118
- function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
119
- const usbDevices = fsx.listUsbDevices();
120
- const usbBus = usbDevices !== null && usbDevices.length > 0 ? "observed" : "unobservable";
121
- const usb = usbDevices === null ? {
122
- usable: 0,
123
- inaccessibleNodes: []
124
- } : classifyUsb(usbDevices, fsx);
125
- const usbSeen = usb.usable + usb.inaccessibleNodes.length;
126
- const inaccessibleUsbNodes = usb.inaccessibleNodes;
127
- const pci = classifyPci(fsx);
128
- const units = [];
129
- if (usb.usable > 0) units.push({
130
- bus: "usb",
131
- count: usb.usable
132
- });
133
- if (pci.usable > 0) units.push({
134
- bus: "pci",
135
- count: pci.usable
136
- });
137
- const unavailable = [];
138
- if (usb.inaccessibleNodes.length > 0) unavailable.push({
139
- bus: "usb",
140
- count: usb.inaccessibleNodes.length,
141
- reason: "device-not-accessible"
142
- });
143
- if (pci.driverMissing > 0) unavailable.push({
144
- bus: "pci",
145
- count: pci.driverMissing,
146
- reason: "driver-missing"
147
- });
148
- if (pci.notAccessible > 0) unavailable.push({
149
- bus: "pci",
150
- count: pci.notAccessible,
151
- reason: "device-not-accessible"
152
- });
153
- if (units.length > 0 || unavailable.length > 0) return {
154
- info: unavailable.length > 0 ? {
155
- type: "coral-edgetpu",
156
- units,
157
- unavailable
158
- } : {
159
- type: "coral-edgetpu",
160
- units
161
- },
162
- usbBus,
163
- decidedBy: usbSeen > 0 ? "usb-ids" : "pci",
164
- inaccessibleUsbNodes
165
- };
166
- if (usbBus === "unobservable" && (0, _camstack_types_node.chooseEdgetpuDelegate)({
167
- ...delegateHost,
168
- exists: (p) => fsx.exists(p)
169
- }) !== null) return {
170
- info: {
171
- type: "coral-edgetpu",
172
- units: [{
173
- bus: "usb",
174
- count: 1
175
- }]
176
- },
177
- usbBus,
178
- decidedBy: "delegate-fallback",
179
- inaccessibleUsbNodes
180
- };
181
- return {
182
- info: null,
183
- usbBus,
184
- decidedBy: "none",
185
- inaccessibleUsbNodes
186
- };
187
- }
188
- function safeListOrNull(dir) {
189
- try {
190
- return node_fs.default.readdirSync(dir);
191
- } catch {
192
- return null;
193
- }
194
- }
195
- function safeList(dir) {
196
- try {
197
- return node_fs.default.readdirSync(dir);
198
- } catch {
199
- return [];
200
- }
201
- }
202
- function safeRead(path) {
203
- try {
204
- return node_fs.default.readFileSync(path, "utf8").trim();
205
- } catch {
206
- return "";
207
- }
208
- }
209
- /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
210
- var nodeCoralFs = {
211
- listUsbDevices: () => safeListOrNull("/sys/bus/usb/devices"),
212
- readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
213
- listPciDevices: () => safeList("/sys/bus/pci/devices"),
214
- readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
215
- listApexClass: () => safeList("/sys/class/apex"),
216
- canOpen: (path) => {
217
- try {
218
- node_fs.default.accessSync(path, node_fs.default.constants.R_OK | node_fs.default.constants.W_OK);
219
- return true;
220
- } catch {
221
- return false;
222
- }
223
- },
224
- exists: (path) => {
225
- try {
226
- return node_fs.default.existsSync(path);
227
- } catch {
228
- return false;
229
- }
230
- }
231
- };
232
- //#endregion
233
- Object.defineProperty(exports, "classifyCoralAccelerator", {
234
- enumerable: true,
235
- get: function() {
236
- return classifyCoralAccelerator;
237
- }
238
- });
239
- Object.defineProperty(exports, "detectCoralAccelerator", {
240
- enumerable: true,
241
- get: function() {
242
- return detectCoralAccelerator;
243
- }
244
- });
245
- Object.defineProperty(exports, "nodeCoralFs", {
246
- enumerable: true,
247
- get: function() {
248
- return nodeCoralFs;
249
- }
250
- });
@@ -1,231 +0,0 @@
1
- import { EDGETPU_LIB_ENV, chooseEdgetpuDelegate, nodeDataRootFromEnv } from "@camstack/types/node";
2
- import Kt from "node:fs";
3
- //#region src/builtins/platform-probe/coral-accelerators.ts
4
- /**
5
- * Coral USB Edge TPU USB identifiers.
6
- *
7
- * The device enumerates as `1a6e:089a` (Global Unichip) BEFORE the libedgetpu
8
- * firmware loads, then re-enumerates as `18d1:9302` (Google) AFTER. Either id
9
- * means a Coral is physically attached, so both count as a positive signal.
10
- */
11
- var CORAL_USB_IDS = [{
12
- vendor: "1a6e",
13
- product: "089a"
14
- }, {
15
- vendor: "18d1",
16
- product: "9302"
17
- }];
18
- /** The PCIe / M.2 Coral's PCI function id (Global Unichip "Apex"). */
19
- var CORAL_PCI_VENDOR = "0x1ac1";
20
- var CORAL_PCI_DEVICE = "0x089a";
21
- /** A unit the apex driver bound: `/sys/class/apex/apex_<N>` ↔ `/dev/apex_<N>`. */
22
- var APEX_ENTRY = /^apex_(\d+)$/;
23
- function currentDelegateHost() {
24
- return {
25
- platform: process.platform,
26
- dataDir: nodeDataRootFromEnv(process.env),
27
- override: process.env[EDGETPU_LIB_ENV]
28
- };
29
- }
30
- /** usbfs names a device `/dev/bus/usb/<busnum>/<devnum>`, each zero-padded to three digits. */
31
- function usbDeviceNode(device, fsx) {
32
- const bus = Number.parseInt(fsx.readUsbAttr(device, "busnum"), 10);
33
- const dev = Number.parseInt(fsx.readUsbAttr(device, "devnum"), 10);
34
- if (!Number.isInteger(bus) || !Number.isInteger(dev) || bus <= 0 || dev <= 0) return null;
35
- return `/dev/bus/usb/${String(bus).padStart(3, "0")}/${String(dev).padStart(3, "0")}`;
36
- }
37
- /**
38
- * USB units: sysfs is the HOST's view — a container whose `/dev/bus/usb`
39
- * mapping was removed still lists the stick under `/sys/bus/usb/devices`. A
40
- * listed Coral is usable only when its usbfs device node is in this process's
41
- * view AND opens read/write; otherwise it is present but not accessible.
42
- */
43
- function classifyUsb(devices, fsx) {
44
- let usable = 0;
45
- const inaccessibleNodes = [];
46
- for (const device of devices) {
47
- const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
48
- const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
49
- if (!CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) continue;
50
- const node = usbDeviceNode(device, fsx);
51
- if (node !== null && fsx.exists(node) && fsx.canOpen(node)) usable++;
52
- else inaccessibleNodes.push(node ?? `/sys/bus/usb/devices/${device}`);
53
- }
54
- return {
55
- usable,
56
- inaccessibleNodes
57
- };
58
- }
59
- function countPciCorals(fsx) {
60
- let count = 0;
61
- for (const device of fsx.listPciDevices()) {
62
- const vendor = fsx.readPciAttr(device, "vendor").toLowerCase();
63
- const product = fsx.readPciAttr(device, "device").toLowerCase();
64
- if (vendor === CORAL_PCI_VENDOR && product === CORAL_PCI_DEVICE) count++;
65
- }
66
- return count;
67
- }
68
- /**
69
- * PCIe units: each `/sys/class/apex/apex_N` is a unit the driver bound; it is
70
- * usable only when `/dev/apex_N` is in this process's view AND opens read/write.
71
- * PCI functions with the Coral id beyond the bound units have no driver.
72
- */
73
- function classifyPci(fsx) {
74
- let usable = 0;
75
- let notAccessible = 0;
76
- for (const entry of fsx.listApexClass()) {
77
- const match = APEX_ENTRY.exec(entry);
78
- if (match === null) continue;
79
- const node = `/dev/apex_${match[1]}`;
80
- if (fsx.exists(node) && fsx.canOpen(node)) usable++;
81
- else notAccessible++;
82
- }
83
- const driverMissing = Math.max(0, countPciCorals(fsx) - usable - notAccessible);
84
- return {
85
- usable,
86
- notAccessible,
87
- driverMissing
88
- };
89
- }
90
- /**
91
- * Detect Coral Edge TPUs on USB and PCIe/M.2 — the answer only. See
92
- * {@link detectCoralAccelerator} for the evidence that decided it.
93
- */
94
- function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
95
- return detectCoralAccelerator(fsx, delegateHost).info;
96
- }
97
- /**
98
- * Detect Coral Edge TPUs on USB and PCIe/M.2, with the evidence that decided.
99
- *
100
- * - USB: every matching USB device counts (multiple Corals run concurrently),
101
- * usable only if its `/dev/bus/usb/<BBB>/<DDD>` node opens read/write — a
102
- * listed stick whose node is missing or refused is `device-not-accessible`.
103
- * - PCIe: the apex driver's units, each usable only if its device node opens;
104
- * a Coral PCI function the driver did not bind is `driver-missing`.
105
- * - Fallback: when the USB bus is NOT OBSERVABLE (`/sys/bus/usb/devices`
106
- * missing, unreadable or empty — a macOS desktop, a restricted container)
107
- * and no PCI Coral was seen, an installed libedgetpu delegate means one USB
108
- * Coral is assumed. A bus that IS readable and lists no Coral id is the
109
- * answer: no USB Coral. The delegate stays installed after a stick is
110
- * unplugged or moved to another node, so it is evidence only where nothing
111
- * better exists (D919).
112
- *
113
- * Returns `null` only when no Coral was found at all; a present-but-unusable
114
- * Coral is reported with its typed reason, never as absent (D393/D315).
115
- */
116
- function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
117
- const usbDevices = fsx.listUsbDevices();
118
- const usbBus = usbDevices !== null && usbDevices.length > 0 ? "observed" : "unobservable";
119
- const usb = usbDevices === null ? {
120
- usable: 0,
121
- inaccessibleNodes: []
122
- } : classifyUsb(usbDevices, fsx);
123
- const usbSeen = usb.usable + usb.inaccessibleNodes.length;
124
- const inaccessibleUsbNodes = usb.inaccessibleNodes;
125
- const pci = classifyPci(fsx);
126
- const units = [];
127
- if (usb.usable > 0) units.push({
128
- bus: "usb",
129
- count: usb.usable
130
- });
131
- if (pci.usable > 0) units.push({
132
- bus: "pci",
133
- count: pci.usable
134
- });
135
- const unavailable = [];
136
- if (usb.inaccessibleNodes.length > 0) unavailable.push({
137
- bus: "usb",
138
- count: usb.inaccessibleNodes.length,
139
- reason: "device-not-accessible"
140
- });
141
- if (pci.driverMissing > 0) unavailable.push({
142
- bus: "pci",
143
- count: pci.driverMissing,
144
- reason: "driver-missing"
145
- });
146
- if (pci.notAccessible > 0) unavailable.push({
147
- bus: "pci",
148
- count: pci.notAccessible,
149
- reason: "device-not-accessible"
150
- });
151
- if (units.length > 0 || unavailable.length > 0) return {
152
- info: unavailable.length > 0 ? {
153
- type: "coral-edgetpu",
154
- units,
155
- unavailable
156
- } : {
157
- type: "coral-edgetpu",
158
- units
159
- },
160
- usbBus,
161
- decidedBy: usbSeen > 0 ? "usb-ids" : "pci",
162
- inaccessibleUsbNodes
163
- };
164
- if (usbBus === "unobservable" && chooseEdgetpuDelegate({
165
- ...delegateHost,
166
- exists: (p) => fsx.exists(p)
167
- }) !== null) return {
168
- info: {
169
- type: "coral-edgetpu",
170
- units: [{
171
- bus: "usb",
172
- count: 1
173
- }]
174
- },
175
- usbBus,
176
- decidedBy: "delegate-fallback",
177
- inaccessibleUsbNodes
178
- };
179
- return {
180
- info: null,
181
- usbBus,
182
- decidedBy: "none",
183
- inaccessibleUsbNodes
184
- };
185
- }
186
- function safeListOrNull(dir) {
187
- try {
188
- return Kt.readdirSync(dir);
189
- } catch {
190
- return null;
191
- }
192
- }
193
- function safeList(dir) {
194
- try {
195
- return Kt.readdirSync(dir);
196
- } catch {
197
- return [];
198
- }
199
- }
200
- function safeRead(path) {
201
- try {
202
- return Kt.readFileSync(path, "utf8").trim();
203
- } catch {
204
- return "";
205
- }
206
- }
207
- /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
208
- var nodeCoralFs = {
209
- listUsbDevices: () => safeListOrNull("/sys/bus/usb/devices"),
210
- readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
211
- listPciDevices: () => safeList("/sys/bus/pci/devices"),
212
- readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
213
- listApexClass: () => safeList("/sys/class/apex"),
214
- canOpen: (path) => {
215
- try {
216
- Kt.accessSync(path, Kt.constants.R_OK | Kt.constants.W_OK);
217
- return true;
218
- } catch {
219
- return false;
220
- }
221
- },
222
- exists: (path) => {
223
- try {
224
- return Kt.existsSync(path);
225
- } catch {
226
- return false;
227
- }
228
- }
229
- };
230
- //#endregion
231
- export { detectCoralAccelerator as n, nodeCoralFs as r, classifyCoralAccelerator as t };