@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,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_read_all_rows$1 = require("../../read-all-rows-CVoO1ONM.js");
8
8
  let zod = require("zod");
9
9
  let node_crypto = require("node:crypto");
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, Bn as mayWriteToLocation, Cr as storageCapability, Gi as defineRecordKinds, Ir as withLocationMode, K as LegacyStorageLocationDefaultSchema, Mn as legacyModeOf, Ri as collectSecretConfigKeys, Sa as transformSecretWrite, Ta as EventCategory, Tn as isLocationEnabled, Un as modeMayWrite, _a as secretTreeFromPaths, _r as settingsStoreCapability, cn as evictionPolicyOfLocation, dt as StorageLocationTypeSchema, ft as StorageMigrationJobSchema, gi as REDACTED_SECRET, gn as gbToBytes, ha as resolveSecretMarkers, la as parseJsonObject, lt as StorageCleanupJobSchema, sa as normalizeNodeId, ta as isSecretMarker, ur as resolveLocationMode, ut as StorageLocationModeSchema, wr as storageMigrationCapability, zn as mayReadLocation } from "../../dist-BpUtAgqR.mjs";
1
+ import { Bn as mayReadLocation, Da as EventCategory, En as isLocationEnabled, Ki as defineRecordKinds, Lr as withLocationMode, Nn as legacyModeOf, Tr as storageMigrationCapability, Vn as mayWriteToLocation, Wn as modeMayWrite, _a as resolveSecretMarkers, _i as REDACTED_SECRET, _n as gbToBytes, da as parseJsonObject, dr as resolveLocationMode, dt as StorageLocationModeSchema, ei as BaseAddon, ft as StorageLocationTypeSchema, la as normalizeNodeId, ln as evictionPolicyOfLocation, pt as StorageMigrationJobSchema, q as LegacyStorageLocationDefaultSchema, ra as isSecretMarker, ut as StorageCleanupJobSchema, vr as settingsStoreCapability, wa as transformSecretWrite, wr as storageCapability, ya as secretTreeFromPaths, zi as collectSecretConfigKeys } from "../../dist-X1r44BdF.mjs";
2
2
  import { t as require_read_all_rows } from "../../read-all-rows-TaPqdWNF.mjs";
3
3
  import { z } from "zod";
4
4
  import { randomUUID } from "node:crypto";
@@ -3,11 +3,11 @@ 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_safe_buffer$1 = require("../../safe-buffer-D3aoa-7X.js");
8
8
  const require_x509_es = require("../../x509.es-C4cOo48M.js");
9
- const require_agent_https = require("../../agent-https-DJ8OzQOr.js");
10
- const require_constants$8 = require("../../constants-CuO3rcw4.js");
9
+ const require_agent_https = require("../../agent-https-D_oo3PNv.js");
10
+ const require_constants$8 = require("../../constants-WF1AqoKF.js");
11
11
  const require_src$1 = require("../../src-CnAqG6EF.js");
12
12
  let zod = require("zod");
13
13
  let node_crypto = require("node:crypto");
@@ -1,9 +1,9 @@
1
1
  import { a as __toCommonJS, i as __require, n as __esmMin, o as __toESM, r as __exportAll, t as __commonJSMin } from "../../chunk-CNf5ZN-e.mjs";
2
- import { $r as BaseAddon, Qr as errMsg, Ui as customAction, Wi as defineCustomActions, Xi as hydrateSchema, st as ServerNameSchema, vr as shortHostname } from "../../dist-BpUtAgqR.mjs";
2
+ import { $r as errMsg, Gi as defineCustomActions, Qi as hydrateSchema, Wi as customAction, ct as ServerNameSchema, ei as BaseAddon, yr as shortHostname } from "../../dist-X1r44BdF.mjs";
3
3
  import { t as require_safe_buffer } from "../../safe-buffer-B1OjL1I9.mjs";
4
4
  import { S as backdatedNotBefore, a as KeyUsageFlags, c as Pkcs10CertificateRequest, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, l as Pkcs10CertificateRequestGenerator, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension } from "../../x509.es-DK__ETIe.mjs";
5
- import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-DR1wmhYY.mjs";
6
- import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants-BWli8Cju.mjs";
5
+ import { B as setProcessAgentHttpsNames, I as AGENT_HTTPS_NAMES_COLLECTION, L as AGENT_HTTPS_NAMES_COLUMNS, M as isLocalOnlyHostname, R as AgentHttpsNames, V as systemConfigRecordKinds, u as isPrivateAddress, z as getProcessAgentHttpsNames } from "../../agent-https-DmNQyAl7.mjs";
6
+ import { a as MESH_CA_KEY_REF, c as SERVER_AUTH_OID, i as MESH_CA_FIELD, n as DEFAULT_HUB_TLS_TCP_PORT, o as MESH_CA_SETTINGS_KEY, r as MESH_CA_COMMON_NAME, s as MESH_CA_VALIDITY_DAYS, t as CLIENT_AUTH_OID } from "../../constants--A505iuO.mjs";
7
7
  import { t as require_src } from "../../src-hG4grMU4.mjs";
8
8
  import { z } from "zod";
9
9
  import { X509Certificate, createHash, createPrivateKey, randomBytes, randomInt, sign, timingSafeEqual, verify, webcrypto } 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
  const require_formatter = require("../../formatter-DqAKDlvN.js");
8
8
  const require_log_file_read_protocol = require("../../log-file-read-protocol-D0WcLbIV.js");
9
9
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { $r as BaseAddon, In as logDestinationCapability } from "../../dist-BpUtAgqR.mjs";
1
+ import { Ln as logDestinationCapability, ei as BaseAddon } from "../../dist-X1r44BdF.mjs";
2
2
  import { t as formatLogLine } from "../../formatter-B7qW8bPJ.mjs";
3
3
  import { a as LogFileIndexStore, i as serveRead, n as isFromReader, t as CancelBook } from "../../log-file-read-protocol-B7M3X3bT.mjs";
4
4
  import { createRequire } from "node:module";
@@ -1,4 +1,4 @@
1
- import { Gr as compositionSourceKey, Qr as errMsg } from "./dist-BpUtAgqR.mjs";
1
+ import { $r as errMsg, Kr as compositionSourceKey } from "./dist-X1r44BdF.mjs";
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-l6zKmHEb.js");
1
+ const require_dist = require("./dist-DRL3rEfN.js");
2
2
  //#region src/builtins/core-blocks/composition-sources.ts
3
3
  /**
4
4
  * Describe what a composition reads and writes for SAVE-time validation
@@ -1,4 +1,4 @@
1
- import { Li as buildSecretRef } from "./dist-BpUtAgqR.mjs";
1
+ import { Ri as buildSecretRef } from "./dist-X1r44BdF.mjs";
2
2
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
3
3
  var MESH_CA_KEY_REF = buildSecretRef({
4
4
  owner: "system",
@@ -1,5 +1,5 @@
1
1
  /** `secret://system/global/meshCaKey` — EC P-256 PKCS#8 PEM of the hub mesh CA. */
2
- var MESH_CA_KEY_REF = require("./dist-l6zKmHEb.js").buildSecretRef({
2
+ var MESH_CA_KEY_REF = require("./dist-DRL3rEfN.js").buildSecretRef({
3
3
  owner: "system",
4
4
  scope: { kind: "global" },
5
5
  fieldPath: "meshCaKey"
@@ -29,9 +29,9 @@ function currentDelegateHost() {
29
29
  override: process.env[_camstack_types_node.EDGETPU_LIB_ENV]
30
30
  };
31
31
  }
32
- function countUsbCorals(fsx) {
32
+ function countUsbCorals(devices, fsx) {
33
33
  let count = 0;
34
- for (const device of fsx.listUsbDevices()) {
34
+ for (const device of devices) {
35
35
  const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
36
36
  const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
37
37
  if (CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) count++;
@@ -70,21 +70,33 @@ function classifyPci(fsx) {
70
70
  };
71
71
  }
72
72
  /**
73
- * Detect Coral Edge TPUs on USB and PCIe/M.2.
73
+ * Detect Coral Edge TPUs on USB and PCIe/M.2 — the answer only. See
74
+ * {@link detectCoralAccelerator} for the evidence that decided it.
75
+ */
76
+ function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
77
+ return detectCoralAccelerator(fsx, delegateHost).info;
78
+ }
79
+ /**
80
+ * Detect Coral Edge TPUs on USB and PCIe/M.2, with the evidence that decided.
74
81
  *
75
82
  * - USB: every matching USB device counts (multiple Corals run concurrently).
76
83
  * - PCIe: the apex driver's units, each usable only if its device node opens;
77
84
  * a Coral PCI function the driver did not bind is `driver-missing`.
78
- * - Fallback: when NO Coral signal of either bus is visible but the libedgetpu
79
- * delegate is installed (a container whose `/sys` USB view is limited), one
80
- * USB Coral is assumed — never when a PCI Coral was seen, since the delegate
81
- * then says nothing about USB.
85
+ * - Fallback: when the USB bus is NOT OBSERVABLE (`/sys/bus/usb/devices`
86
+ * missing, unreadable or empty — a macOS desktop, a restricted container)
87
+ * and no PCI Coral was seen, an installed libedgetpu delegate means one USB
88
+ * Coral is assumed. A bus that IS readable and lists no Coral id is the
89
+ * answer: no USB Coral. The delegate stays installed after a stick is
90
+ * unplugged or moved to another node, so it is evidence only where nothing
91
+ * better exists (D919).
82
92
  *
83
93
  * Returns `null` only when no Coral was found at all; a present-but-unusable
84
94
  * Coral is reported with its typed reason, never as absent (D393/D315).
85
95
  */
86
- function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
87
- const usb = countUsbCorals(fsx);
96
+ function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
97
+ const usbDevices = fsx.listUsbDevices();
98
+ const usbBus = usbDevices !== null && usbDevices.length > 0 ? "observed" : "unobservable";
99
+ const usb = usbDevices === null ? 0 : countUsbCorals(usbDevices, fsx);
88
100
  const pci = classifyPci(fsx);
89
101
  const units = [];
90
102
  if (usb > 0) units.push({
@@ -106,25 +118,44 @@ function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
106
118
  count: pci.notAccessible,
107
119
  reason: "device-not-accessible"
108
120
  });
109
- if (units.length > 0 || unavailable.length > 0) return unavailable.length > 0 ? {
110
- type: "coral-edgetpu",
111
- units,
112
- unavailable
113
- } : {
114
- type: "coral-edgetpu",
115
- units
121
+ if (units.length > 0 || unavailable.length > 0) return {
122
+ info: unavailable.length > 0 ? {
123
+ type: "coral-edgetpu",
124
+ units,
125
+ unavailable
126
+ } : {
127
+ type: "coral-edgetpu",
128
+ units
129
+ },
130
+ usbBus,
131
+ decidedBy: usb > 0 ? "usb-ids" : "pci"
116
132
  };
117
- if ((0, _camstack_types_node.chooseEdgetpuDelegate)({
133
+ if (usbBus === "unobservable" && (0, _camstack_types_node.chooseEdgetpuDelegate)({
118
134
  ...delegateHost,
119
135
  exists: (p) => fsx.exists(p)
120
136
  }) !== null) return {
121
- type: "coral-edgetpu",
122
- units: [{
123
- bus: "usb",
124
- count: 1
125
- }]
137
+ info: {
138
+ type: "coral-edgetpu",
139
+ units: [{
140
+ bus: "usb",
141
+ count: 1
142
+ }]
143
+ },
144
+ usbBus,
145
+ decidedBy: "delegate-fallback"
146
+ };
147
+ return {
148
+ info: null,
149
+ usbBus,
150
+ decidedBy: "none"
126
151
  };
127
- return null;
152
+ }
153
+ function safeListOrNull(dir) {
154
+ try {
155
+ return node_fs.default.readdirSync(dir);
156
+ } catch {
157
+ return null;
158
+ }
128
159
  }
129
160
  function safeList(dir) {
130
161
  try {
@@ -142,7 +173,7 @@ function safeRead(path) {
142
173
  }
143
174
  /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
144
175
  var nodeCoralFs = {
145
- listUsbDevices: () => safeList("/sys/bus/usb/devices"),
176
+ listUsbDevices: () => safeListOrNull("/sys/bus/usb/devices"),
146
177
  readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
147
178
  listPciDevices: () => safeList("/sys/bus/pci/devices"),
148
179
  readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
@@ -170,6 +201,12 @@ Object.defineProperty(exports, "classifyCoralAccelerator", {
170
201
  return classifyCoralAccelerator;
171
202
  }
172
203
  });
204
+ Object.defineProperty(exports, "detectCoralAccelerator", {
205
+ enumerable: true,
206
+ get: function() {
207
+ return detectCoralAccelerator;
208
+ }
209
+ });
173
210
  Object.defineProperty(exports, "nodeCoralFs", {
174
211
  enumerable: true,
175
212
  get: function() {
@@ -27,9 +27,9 @@ function currentDelegateHost() {
27
27
  override: process.env[EDGETPU_LIB_ENV]
28
28
  };
29
29
  }
30
- function countUsbCorals(fsx) {
30
+ function countUsbCorals(devices, fsx) {
31
31
  let count = 0;
32
- for (const device of fsx.listUsbDevices()) {
32
+ for (const device of devices) {
33
33
  const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
34
34
  const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
35
35
  if (CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) count++;
@@ -68,21 +68,33 @@ function classifyPci(fsx) {
68
68
  };
69
69
  }
70
70
  /**
71
- * Detect Coral Edge TPUs on USB and PCIe/M.2.
71
+ * Detect Coral Edge TPUs on USB and PCIe/M.2 — the answer only. See
72
+ * {@link detectCoralAccelerator} for the evidence that decided it.
73
+ */
74
+ function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
75
+ return detectCoralAccelerator(fsx, delegateHost).info;
76
+ }
77
+ /**
78
+ * Detect Coral Edge TPUs on USB and PCIe/M.2, with the evidence that decided.
72
79
  *
73
80
  * - USB: every matching USB device counts (multiple Corals run concurrently).
74
81
  * - PCIe: the apex driver's units, each usable only if its device node opens;
75
82
  * a Coral PCI function the driver did not bind is `driver-missing`.
76
- * - Fallback: when NO Coral signal of either bus is visible but the libedgetpu
77
- * delegate is installed (a container whose `/sys` USB view is limited), one
78
- * USB Coral is assumed — never when a PCI Coral was seen, since the delegate
79
- * then says nothing about USB.
83
+ * - Fallback: when the USB bus is NOT OBSERVABLE (`/sys/bus/usb/devices`
84
+ * missing, unreadable or empty — a macOS desktop, a restricted container)
85
+ * and no PCI Coral was seen, an installed libedgetpu delegate means one USB
86
+ * Coral is assumed. A bus that IS readable and lists no Coral id is the
87
+ * answer: no USB Coral. The delegate stays installed after a stick is
88
+ * unplugged or moved to another node, so it is evidence only where nothing
89
+ * better exists (D919).
80
90
  *
81
91
  * Returns `null` only when no Coral was found at all; a present-but-unusable
82
92
  * Coral is reported with its typed reason, never as absent (D393/D315).
83
93
  */
84
- function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
85
- const usb = countUsbCorals(fsx);
94
+ function detectCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
95
+ const usbDevices = fsx.listUsbDevices();
96
+ const usbBus = usbDevices !== null && usbDevices.length > 0 ? "observed" : "unobservable";
97
+ const usb = usbDevices === null ? 0 : countUsbCorals(usbDevices, fsx);
86
98
  const pci = classifyPci(fsx);
87
99
  const units = [];
88
100
  if (usb > 0) units.push({
@@ -104,25 +116,44 @@ function classifyCoralAccelerator(fsx, delegateHost = currentDelegateHost()) {
104
116
  count: pci.notAccessible,
105
117
  reason: "device-not-accessible"
106
118
  });
107
- if (units.length > 0 || unavailable.length > 0) return unavailable.length > 0 ? {
108
- type: "coral-edgetpu",
109
- units,
110
- unavailable
111
- } : {
112
- type: "coral-edgetpu",
113
- units
119
+ if (units.length > 0 || unavailable.length > 0) return {
120
+ info: unavailable.length > 0 ? {
121
+ type: "coral-edgetpu",
122
+ units,
123
+ unavailable
124
+ } : {
125
+ type: "coral-edgetpu",
126
+ units
127
+ },
128
+ usbBus,
129
+ decidedBy: usb > 0 ? "usb-ids" : "pci"
114
130
  };
115
- if (chooseEdgetpuDelegate({
131
+ if (usbBus === "unobservable" && chooseEdgetpuDelegate({
116
132
  ...delegateHost,
117
133
  exists: (p) => fsx.exists(p)
118
134
  }) !== null) return {
119
- type: "coral-edgetpu",
120
- units: [{
121
- bus: "usb",
122
- count: 1
123
- }]
135
+ info: {
136
+ type: "coral-edgetpu",
137
+ units: [{
138
+ bus: "usb",
139
+ count: 1
140
+ }]
141
+ },
142
+ usbBus,
143
+ decidedBy: "delegate-fallback"
144
+ };
145
+ return {
146
+ info: null,
147
+ usbBus,
148
+ decidedBy: "none"
124
149
  };
125
- return null;
150
+ }
151
+ function safeListOrNull(dir) {
152
+ try {
153
+ return Kt.readdirSync(dir);
154
+ } catch {
155
+ return null;
156
+ }
126
157
  }
127
158
  function safeList(dir) {
128
159
  try {
@@ -140,7 +171,7 @@ function safeRead(path) {
140
171
  }
141
172
  /** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
142
173
  var nodeCoralFs = {
143
- listUsbDevices: () => safeList("/sys/bus/usb/devices"),
174
+ listUsbDevices: () => safeListOrNull("/sys/bus/usb/devices"),
144
175
  readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
145
176
  listPciDevices: () => safeList("/sys/bus/pci/devices"),
146
177
  readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
@@ -162,4 +193,4 @@ var nodeCoralFs = {
162
193
  }
163
194
  };
164
195
  //#endregion
165
- export { nodeCoralFs as n, classifyCoralAccelerator as t };
196
+ export { detectCoralAccelerator as n, nodeCoralFs as r, classifyCoralAccelerator as t };
@@ -1,4 +1,4 @@
1
- import { A as DEVICE_SAN_USER_PREFIX, Li as buildSecretRef, k as DEVICE_SAN_CREDENTIAL_PREFIX } from "./dist-BpUtAgqR.mjs";
1
+ import { A as DEVICE_SAN_USER_PREFIX, Ri as buildSecretRef, k as DEVICE_SAN_CREDENTIAL_PREFIX } from "./dist-X1r44BdF.mjs";
2
2
  import { S as backdatedNotBefore, a as KeyUsageFlags, d as SubjectKeyIdentifierExtension, f as X509Certificate$1, m as cryptoProvider, n as BasicConstraintsExtension, o as KeyUsagesExtension, p as X509CertificateGenerator, r as ExtendedKeyUsageExtension, s as PemConverter, t as AuthorityKeyIdentifierExtension, u as SubjectAlternativeNameExtension } from "./x509.es-DK__ETIe.mjs";
3
3
  import { X509Certificate, createPublicKey, randomBytes, verify, webcrypto } from "node:crypto";
4
4
  //#region src/auth/jwt-signing-key.ts
@@ -1,4 +1,4 @@
1
- const require_dist = require("./dist-l6zKmHEb.js");
1
+ const require_dist = require("./dist-DRL3rEfN.js");
2
2
  const require_x509_es = require("./x509.es-C4cOo48M.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  //#region src/auth/jwt-signing-key.ts