@camstack/system 1.2.457 → 1.2.459
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.
- package/dist/addon-runner.js +163 -27
- package/dist/addon-runner.mjs +193 -57
- package/dist/{agent-https-CoyOZ3pC.js → agent-https-Dnr_nIVx.js} +3 -723
- package/dist/{agent-https-CK9Z4sSR.mjs → agent-https-Iw3RSQup.mjs} +4 -616
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +1 -1
- package/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +1 -1
- package/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +1 -1
- package/dist/builtins/alerts/alerts.addon.js +5 -7
- package/dist/builtins/alerts/alerts.addon.mjs +5 -7
- package/dist/builtins/alerts/record-kinds.d.ts +1 -1
- package/dist/builtins/autotrack/index.js +1 -1
- package/dist/builtins/autotrack/index.mjs +1 -1
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +242 -4
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +240 -2
- package/dist/builtins/calendars/calendars.addon.js +2 -10
- package/dist/builtins/calendars/calendars.addon.mjs +2 -3
- package/dist/builtins/calendars/record-kinds.d.ts +1 -1
- package/dist/builtins/camera-grid/index.js +1 -1
- package/dist/builtins/camera-grid/index.mjs +1 -1
- package/dist/builtins/composer/composer.addon.js +2 -2
- package/dist/builtins/composer/composer.addon.mjs +2 -2
- package/dist/builtins/console-logging/index.js +1 -1
- package/dist/builtins/console-logging/index.mjs +1 -1
- package/dist/builtins/core-blocks/core-blocks.addon.js +4 -6
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +4 -6
- package/dist/builtins/device-history/device-history.addon.d.ts +13 -0
- package/dist/builtins/device-history/device-history.addon.js +296 -233
- package/dist/builtins/device-history/device-history.addon.mjs +296 -233
- package/dist/builtins/device-history/ingest/producer-ingest.d.ts +11 -1
- package/dist/builtins/device-manager/device-manager.addon.js +2 -4
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -4
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +41 -43
- package/dist/builtins/keychain/index.mjs +41 -43
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.js +1 -1
- package/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +1 -1
- package/dist/builtins/local-auth/local-auth.addon.js +24 -40
- package/dist/builtins/local-auth/local-auth.addon.mjs +24 -40
- package/dist/builtins/local-network/local-network.addon.js +2 -2
- package/dist/builtins/local-network/local-network.addon.mjs +2 -2
- package/dist/builtins/loki-logging/index.js +1 -1
- package/dist/builtins/loki-logging/index.mjs +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.js +1 -1
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +1 -1
- package/dist/builtins/native-metrics/node-metrics-history-recorder.d.ts +1 -2
- package/dist/builtins/platform-probe/coral-accelerators.d.ts +26 -9
- package/dist/builtins/platform-probe/index.js +11 -68
- package/dist/builtins/platform-probe/index.mjs +11 -68
- package/dist/builtins/record-entries/index.js +1 -1
- package/dist/builtins/record-entries/index.mjs +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +1 -1
- package/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/dist/builtins/snapshot/index.js +1 -1
- package/dist/builtins/snapshot/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/file-host-protocol.d.ts +0 -15
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/index.js +1 -1
- package/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/dist/builtins/sqlite-storage/owned-sqlite-file.d.ts +0 -44
- package/dist/builtins/sqlite-storage/records/records-catalog.d.ts +0 -2
- package/dist/builtins/sqlite-storage/records/records-engine-types.d.ts +0 -21
- package/dist/builtins/sqlite-storage/records/records-engine.d.ts +3 -20
- package/dist/builtins/sqlite-storage/records/records-provider.d.ts +4 -18
- package/dist/builtins/sqlite-storage/records/records-sql.d.ts +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings-backend.d.ts +0 -17
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +21 -196
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +21 -196
- package/dist/builtins/sqlite-storage/storage-admin-provider.d.ts +6 -14
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.d.ts +2 -2
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +7 -9
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +7 -9
- package/dist/builtins/system-config/system-config.addon.js +667 -40
- package/dist/builtins/system-config/system-config.addon.mjs +625 -15
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-B_jeZDRJ.mjs → composition-sources-DNRZWR1j.mjs} +1 -1
- package/dist/{composition-sources-qKyvMAvc.js → composition-sources-b0e_2I-D.js} +1 -1
- package/dist/{constants-B_X9cWEK.js → constants-6OeJiZgi.js} +1 -1
- package/dist/{constants-cxKcZRMi.mjs → constants-BnkOdj9Q.mjs} +1 -1
- package/dist/coral-accelerators-Bi_c3Rft.js +175 -0
- package/dist/coral-accelerators-DcnZvctM.mjs +162 -0
- package/dist/{device-ca-BB6nHAL5.mjs → device-ca-Bnkw8GyU.mjs} +1 -1
- package/dist/{device-ca-CVK3YcR_.js → device-ca-CPTDs--d.js} +1 -1
- package/dist/{dist-C89nqNnn.js → dist-Bn-RNanh.js} +84 -140
- package/dist/{dist-Dhux90yB.mjs → dist-Wy8cTxg6.mjs} +85 -123
- package/dist/file-host-worker.js +1 -1
- package/dist/file-host-worker.mjs +1 -1
- package/dist/{hub-mdns-ciao-B8olZqqd.mjs → hub-mdns-ciao-CJu0nhla.mjs} +2 -2
- package/dist/{hub-mdns-ciao-DB1Y9agt.js → hub-mdns-ciao-CTBTlia4.js} +2 -2
- package/dist/index.js +32 -58
- package/dist/index.mjs +16 -42
- package/dist/kernel/hwaccel/hwaccel-resolver.d.ts +7 -3
- package/dist/{restore-archive-DyOaPeAr.mjs → restore-archive-CmP-iiG9.mjs} +84 -331
- package/dist/{restore-archive-4DOUR5Gu.js → restore-archive-DM1OBYq4.js} +89 -342
- package/dist/{wal-maintenance-DVN-DiVP.js → wal-maintenance-DUHEp_09.js} +0 -0
- package/dist/{wal-maintenance-BMiX6UIa.mjs → wal-maintenance-NKbwWovZ.mjs} +0 -0
- package/package.json +1 -1
- package/dist/builtins/records/legacy-table-row-count.d.ts +0 -5
- package/dist/builtins/records/phase6-declare-gate.d.ts +0 -28
- package/dist/builtins/sqlite-storage/records/count-settings-array-legacy.d.ts +0 -5
- package/dist/builtins/sqlite-storage/records/count-settings-brokers-legacy.d.ts +0 -6
- package/dist/phase6-declare-gate-BO-_jLh_.js +0 -98
- package/dist/phase6-declare-gate-x9ZCbQJP.mjs +0 -93
|
@@ -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-
|
|
6
|
+
const require_dist = require("../../dist-Bn-RNanh.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 { ni as BaseAddon, zn as logDestinationCapability } from "../../dist-
|
|
1
|
+
import { ni as BaseAddon, zn as logDestinationCapability } from "../../dist-Wy8cTxg6.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 { Jr as compositionSourceKey, ti as errMsg } from "./dist-
|
|
1
|
+
import { Jr as compositionSourceKey, ti as errMsg } from "./dist-Wy8cTxg6.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,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-
|
|
2
|
+
var MESH_CA_KEY_REF = require("./dist-Bn-RNanh.js").buildSecretRef({
|
|
3
3
|
owner: "system",
|
|
4
4
|
scope: { kind: "global" },
|
|
5
5
|
fieldPath: "meshCaKey"
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_chunk.__toESM(node_fs);
|
|
4
|
+
//#region src/builtins/platform-probe/coral-accelerators.ts
|
|
5
|
+
/**
|
|
6
|
+
* Coral USB Edge TPU USB identifiers.
|
|
7
|
+
*
|
|
8
|
+
* The device enumerates as `1a6e:089a` (Global Unichip) BEFORE the libedgetpu
|
|
9
|
+
* firmware loads, then re-enumerates as `18d1:9302` (Google) AFTER. Either id
|
|
10
|
+
* means a Coral is physically attached, so both count as a positive signal.
|
|
11
|
+
*/
|
|
12
|
+
var CORAL_USB_IDS = [{
|
|
13
|
+
vendor: "1a6e",
|
|
14
|
+
product: "089a"
|
|
15
|
+
}, {
|
|
16
|
+
vendor: "18d1",
|
|
17
|
+
product: "9302"
|
|
18
|
+
}];
|
|
19
|
+
/** The PCIe / M.2 Coral's PCI function id (Global Unichip "Apex"). */
|
|
20
|
+
var CORAL_PCI_VENDOR = "0x1ac1";
|
|
21
|
+
var CORAL_PCI_DEVICE = "0x089a";
|
|
22
|
+
/** A unit the apex driver bound: `/sys/class/apex/apex_<N>` ↔ `/dev/apex_<N>`. */
|
|
23
|
+
var APEX_ENTRY = /^apex_(\d+)$/;
|
|
24
|
+
/**
|
|
25
|
+
* Default install path of the libedgetpu delegate on the hub, provisioned
|
|
26
|
+
* out-of-band by `/data/deps/edgetpu-install.sh` (it is a system shared
|
|
27
|
+
* library, not a pip package). Overridable via `CAMSTACK_EDGETPU_LIB` — kept in
|
|
28
|
+
* sync with the Python pool's own default in `inference_pool.py`.
|
|
29
|
+
*/
|
|
30
|
+
var DEFAULT_EDGETPU_LIB = "/data/deps/edgetpu/lib/libedgetpu.so.1";
|
|
31
|
+
function countUsbCorals(fsx) {
|
|
32
|
+
let count = 0;
|
|
33
|
+
for (const device of fsx.listUsbDevices()) {
|
|
34
|
+
const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
|
|
35
|
+
const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
|
|
36
|
+
if (CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) count++;
|
|
37
|
+
}
|
|
38
|
+
return count;
|
|
39
|
+
}
|
|
40
|
+
function countPciCorals(fsx) {
|
|
41
|
+
let count = 0;
|
|
42
|
+
for (const device of fsx.listPciDevices()) {
|
|
43
|
+
const vendor = fsx.readPciAttr(device, "vendor").toLowerCase();
|
|
44
|
+
const product = fsx.readPciAttr(device, "device").toLowerCase();
|
|
45
|
+
if (vendor === CORAL_PCI_VENDOR && product === CORAL_PCI_DEVICE) count++;
|
|
46
|
+
}
|
|
47
|
+
return count;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* PCIe units: each `/sys/class/apex/apex_N` is a unit the driver bound; it is
|
|
51
|
+
* usable only when `/dev/apex_N` is in this process's view AND opens read/write.
|
|
52
|
+
* PCI functions with the Coral id beyond the bound units have no driver.
|
|
53
|
+
*/
|
|
54
|
+
function classifyPci(fsx) {
|
|
55
|
+
let usable = 0;
|
|
56
|
+
let notAccessible = 0;
|
|
57
|
+
for (const entry of fsx.listApexClass()) {
|
|
58
|
+
const match = APEX_ENTRY.exec(entry);
|
|
59
|
+
if (match === null) continue;
|
|
60
|
+
const node = `/dev/apex_${match[1]}`;
|
|
61
|
+
if (fsx.exists(node) && fsx.canOpen(node)) usable++;
|
|
62
|
+
else notAccessible++;
|
|
63
|
+
}
|
|
64
|
+
const driverMissing = Math.max(0, countPciCorals(fsx) - usable - notAccessible);
|
|
65
|
+
return {
|
|
66
|
+
usable,
|
|
67
|
+
notAccessible,
|
|
68
|
+
driverMissing
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Detect Coral Edge TPUs on USB and PCIe/M.2.
|
|
73
|
+
*
|
|
74
|
+
* - USB: every matching USB device counts (multiple Corals run concurrently).
|
|
75
|
+
* - PCIe: the apex driver's units, each usable only if its device node opens;
|
|
76
|
+
* a Coral PCI function the driver did not bind is `driver-missing`.
|
|
77
|
+
* - Fallback: when NO Coral signal of either bus is visible but the libedgetpu
|
|
78
|
+
* delegate is installed (a container whose `/sys` USB view is limited), one
|
|
79
|
+
* USB Coral is assumed — never when a PCI Coral was seen, since the delegate
|
|
80
|
+
* then says nothing about USB.
|
|
81
|
+
*
|
|
82
|
+
* Returns `null` only when no Coral was found at all; a present-but-unusable
|
|
83
|
+
* Coral is reported with its typed reason, never as absent (D393/D315).
|
|
84
|
+
*/
|
|
85
|
+
function classifyCoralAccelerator(fsx) {
|
|
86
|
+
const usb = countUsbCorals(fsx);
|
|
87
|
+
const pci = classifyPci(fsx);
|
|
88
|
+
const units = [];
|
|
89
|
+
if (usb > 0) units.push({
|
|
90
|
+
bus: "usb",
|
|
91
|
+
count: usb
|
|
92
|
+
});
|
|
93
|
+
if (pci.usable > 0) units.push({
|
|
94
|
+
bus: "pci",
|
|
95
|
+
count: pci.usable
|
|
96
|
+
});
|
|
97
|
+
const unavailable = [];
|
|
98
|
+
if (pci.driverMissing > 0) unavailable.push({
|
|
99
|
+
bus: "pci",
|
|
100
|
+
count: pci.driverMissing,
|
|
101
|
+
reason: "driver-missing"
|
|
102
|
+
});
|
|
103
|
+
if (pci.notAccessible > 0) unavailable.push({
|
|
104
|
+
bus: "pci",
|
|
105
|
+
count: pci.notAccessible,
|
|
106
|
+
reason: "device-not-accessible"
|
|
107
|
+
});
|
|
108
|
+
if (units.length > 0 || unavailable.length > 0) return unavailable.length > 0 ? {
|
|
109
|
+
type: "coral-edgetpu",
|
|
110
|
+
units,
|
|
111
|
+
unavailable
|
|
112
|
+
} : {
|
|
113
|
+
type: "coral-edgetpu",
|
|
114
|
+
units
|
|
115
|
+
};
|
|
116
|
+
const libPath = process.env["CAMSTACK_EDGETPU_LIB"] ?? DEFAULT_EDGETPU_LIB;
|
|
117
|
+
if (fsx.exists(libPath)) return {
|
|
118
|
+
type: "coral-edgetpu",
|
|
119
|
+
units: [{
|
|
120
|
+
bus: "usb",
|
|
121
|
+
count: 1
|
|
122
|
+
}]
|
|
123
|
+
};
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
function safeList(dir) {
|
|
127
|
+
try {
|
|
128
|
+
return node_fs.default.readdirSync(dir);
|
|
129
|
+
} catch {
|
|
130
|
+
return [];
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
function safeRead(path) {
|
|
134
|
+
try {
|
|
135
|
+
return node_fs.default.readFileSync(path, "utf8").trim();
|
|
136
|
+
} catch {
|
|
137
|
+
return "";
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
|
|
141
|
+
var nodeCoralFs = {
|
|
142
|
+
listUsbDevices: () => safeList("/sys/bus/usb/devices"),
|
|
143
|
+
readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
|
|
144
|
+
listPciDevices: () => safeList("/sys/bus/pci/devices"),
|
|
145
|
+
readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
|
|
146
|
+
listApexClass: () => safeList("/sys/class/apex"),
|
|
147
|
+
canOpen: (path) => {
|
|
148
|
+
try {
|
|
149
|
+
node_fs.default.accessSync(path, node_fs.default.constants.R_OK | node_fs.default.constants.W_OK);
|
|
150
|
+
return true;
|
|
151
|
+
} catch {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
exists: (path) => {
|
|
156
|
+
try {
|
|
157
|
+
return node_fs.default.existsSync(path);
|
|
158
|
+
} catch {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
//#endregion
|
|
164
|
+
Object.defineProperty(exports, "classifyCoralAccelerator", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function() {
|
|
167
|
+
return classifyCoralAccelerator;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "nodeCoralFs", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return nodeCoralFs;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import Kt from "node:fs";
|
|
2
|
+
//#region src/builtins/platform-probe/coral-accelerators.ts
|
|
3
|
+
/**
|
|
4
|
+
* Coral USB Edge TPU USB identifiers.
|
|
5
|
+
*
|
|
6
|
+
* The device enumerates as `1a6e:089a` (Global Unichip) BEFORE the libedgetpu
|
|
7
|
+
* firmware loads, then re-enumerates as `18d1:9302` (Google) AFTER. Either id
|
|
8
|
+
* means a Coral is physically attached, so both count as a positive signal.
|
|
9
|
+
*/
|
|
10
|
+
var CORAL_USB_IDS = [{
|
|
11
|
+
vendor: "1a6e",
|
|
12
|
+
product: "089a"
|
|
13
|
+
}, {
|
|
14
|
+
vendor: "18d1",
|
|
15
|
+
product: "9302"
|
|
16
|
+
}];
|
|
17
|
+
/** The PCIe / M.2 Coral's PCI function id (Global Unichip "Apex"). */
|
|
18
|
+
var CORAL_PCI_VENDOR = "0x1ac1";
|
|
19
|
+
var CORAL_PCI_DEVICE = "0x089a";
|
|
20
|
+
/** A unit the apex driver bound: `/sys/class/apex/apex_<N>` ↔ `/dev/apex_<N>`. */
|
|
21
|
+
var APEX_ENTRY = /^apex_(\d+)$/;
|
|
22
|
+
/**
|
|
23
|
+
* Default install path of the libedgetpu delegate on the hub, provisioned
|
|
24
|
+
* out-of-band by `/data/deps/edgetpu-install.sh` (it is a system shared
|
|
25
|
+
* library, not a pip package). Overridable via `CAMSTACK_EDGETPU_LIB` — kept in
|
|
26
|
+
* sync with the Python pool's own default in `inference_pool.py`.
|
|
27
|
+
*/
|
|
28
|
+
var DEFAULT_EDGETPU_LIB = "/data/deps/edgetpu/lib/libedgetpu.so.1";
|
|
29
|
+
function countUsbCorals(fsx) {
|
|
30
|
+
let count = 0;
|
|
31
|
+
for (const device of fsx.listUsbDevices()) {
|
|
32
|
+
const vendor = fsx.readUsbAttr(device, "idVendor").toLowerCase();
|
|
33
|
+
const product = fsx.readUsbAttr(device, "idProduct").toLowerCase();
|
|
34
|
+
if (CORAL_USB_IDS.some((id) => id.vendor === vendor && id.product === product)) count++;
|
|
35
|
+
}
|
|
36
|
+
return count;
|
|
37
|
+
}
|
|
38
|
+
function countPciCorals(fsx) {
|
|
39
|
+
let count = 0;
|
|
40
|
+
for (const device of fsx.listPciDevices()) {
|
|
41
|
+
const vendor = fsx.readPciAttr(device, "vendor").toLowerCase();
|
|
42
|
+
const product = fsx.readPciAttr(device, "device").toLowerCase();
|
|
43
|
+
if (vendor === CORAL_PCI_VENDOR && product === CORAL_PCI_DEVICE) count++;
|
|
44
|
+
}
|
|
45
|
+
return count;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* PCIe units: each `/sys/class/apex/apex_N` is a unit the driver bound; it is
|
|
49
|
+
* usable only when `/dev/apex_N` is in this process's view AND opens read/write.
|
|
50
|
+
* PCI functions with the Coral id beyond the bound units have no driver.
|
|
51
|
+
*/
|
|
52
|
+
function classifyPci(fsx) {
|
|
53
|
+
let usable = 0;
|
|
54
|
+
let notAccessible = 0;
|
|
55
|
+
for (const entry of fsx.listApexClass()) {
|
|
56
|
+
const match = APEX_ENTRY.exec(entry);
|
|
57
|
+
if (match === null) continue;
|
|
58
|
+
const node = `/dev/apex_${match[1]}`;
|
|
59
|
+
if (fsx.exists(node) && fsx.canOpen(node)) usable++;
|
|
60
|
+
else notAccessible++;
|
|
61
|
+
}
|
|
62
|
+
const driverMissing = Math.max(0, countPciCorals(fsx) - usable - notAccessible);
|
|
63
|
+
return {
|
|
64
|
+
usable,
|
|
65
|
+
notAccessible,
|
|
66
|
+
driverMissing
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Detect Coral Edge TPUs on USB and PCIe/M.2.
|
|
71
|
+
*
|
|
72
|
+
* - USB: every matching USB device counts (multiple Corals run concurrently).
|
|
73
|
+
* - PCIe: the apex driver's units, each usable only if its device node opens;
|
|
74
|
+
* a Coral PCI function the driver did not bind is `driver-missing`.
|
|
75
|
+
* - Fallback: when NO Coral signal of either bus is visible but the libedgetpu
|
|
76
|
+
* delegate is installed (a container whose `/sys` USB view is limited), one
|
|
77
|
+
* USB Coral is assumed — never when a PCI Coral was seen, since the delegate
|
|
78
|
+
* then says nothing about USB.
|
|
79
|
+
*
|
|
80
|
+
* Returns `null` only when no Coral was found at all; a present-but-unusable
|
|
81
|
+
* Coral is reported with its typed reason, never as absent (D393/D315).
|
|
82
|
+
*/
|
|
83
|
+
function classifyCoralAccelerator(fsx) {
|
|
84
|
+
const usb = countUsbCorals(fsx);
|
|
85
|
+
const pci = classifyPci(fsx);
|
|
86
|
+
const units = [];
|
|
87
|
+
if (usb > 0) units.push({
|
|
88
|
+
bus: "usb",
|
|
89
|
+
count: usb
|
|
90
|
+
});
|
|
91
|
+
if (pci.usable > 0) units.push({
|
|
92
|
+
bus: "pci",
|
|
93
|
+
count: pci.usable
|
|
94
|
+
});
|
|
95
|
+
const unavailable = [];
|
|
96
|
+
if (pci.driverMissing > 0) unavailable.push({
|
|
97
|
+
bus: "pci",
|
|
98
|
+
count: pci.driverMissing,
|
|
99
|
+
reason: "driver-missing"
|
|
100
|
+
});
|
|
101
|
+
if (pci.notAccessible > 0) unavailable.push({
|
|
102
|
+
bus: "pci",
|
|
103
|
+
count: pci.notAccessible,
|
|
104
|
+
reason: "device-not-accessible"
|
|
105
|
+
});
|
|
106
|
+
if (units.length > 0 || unavailable.length > 0) return unavailable.length > 0 ? {
|
|
107
|
+
type: "coral-edgetpu",
|
|
108
|
+
units,
|
|
109
|
+
unavailable
|
|
110
|
+
} : {
|
|
111
|
+
type: "coral-edgetpu",
|
|
112
|
+
units
|
|
113
|
+
};
|
|
114
|
+
const libPath = process.env["CAMSTACK_EDGETPU_LIB"] ?? DEFAULT_EDGETPU_LIB;
|
|
115
|
+
if (fsx.exists(libPath)) return {
|
|
116
|
+
type: "coral-edgetpu",
|
|
117
|
+
units: [{
|
|
118
|
+
bus: "usb",
|
|
119
|
+
count: 1
|
|
120
|
+
}]
|
|
121
|
+
};
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
function safeList(dir) {
|
|
125
|
+
try {
|
|
126
|
+
return Kt.readdirSync(dir);
|
|
127
|
+
} catch {
|
|
128
|
+
return [];
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function safeRead(path) {
|
|
132
|
+
try {
|
|
133
|
+
return Kt.readFileSync(path, "utf8").trim();
|
|
134
|
+
} catch {
|
|
135
|
+
return "";
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/** The real filesystem view: `/sys` for enumeration, `/dev` for access. */
|
|
139
|
+
var nodeCoralFs = {
|
|
140
|
+
listUsbDevices: () => safeList("/sys/bus/usb/devices"),
|
|
141
|
+
readUsbAttr: (device, attr) => safeRead(`/sys/bus/usb/devices/${device}/${attr}`),
|
|
142
|
+
listPciDevices: () => safeList("/sys/bus/pci/devices"),
|
|
143
|
+
readPciAttr: (device, attr) => safeRead(`/sys/bus/pci/devices/${device}/${attr}`),
|
|
144
|
+
listApexClass: () => safeList("/sys/class/apex"),
|
|
145
|
+
canOpen: (path) => {
|
|
146
|
+
try {
|
|
147
|
+
Kt.accessSync(path, Kt.constants.R_OK | Kt.constants.W_OK);
|
|
148
|
+
return true;
|
|
149
|
+
} catch {
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
exists: (path) => {
|
|
154
|
+
try {
|
|
155
|
+
return Kt.existsSync(path);
|
|
156
|
+
} catch {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
//#endregion
|
|
162
|
+
export { nodeCoralFs as n, classifyCoralAccelerator as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as DEVICE_SAN_CREDENTIAL_PREFIX, Li as buildSecretRef, j as DEVICE_SAN_USER_PREFIX } from "./dist-
|
|
1
|
+
import { A as DEVICE_SAN_CREDENTIAL_PREFIX, Li as buildSecretRef, j as DEVICE_SAN_USER_PREFIX } from "./dist-Wy8cTxg6.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
|