@camstack/system 1.2.416 → 1.2.418
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 +9969 -27
- package/dist/addon-runner.mjs +9930 -9
- package/dist/addon-utils.js +19 -20
- package/dist/addon-utils.mjs +1 -2
- package/dist/auth/auth-audit-log.d.ts +1 -1
- 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 +1 -1
- package/dist/builtins/alerts/alerts.addon.mjs +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 +2 -2
- package/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +2 -2
- package/dist/builtins/calendars/calendars.addon.js +1 -1
- package/dist/builtins/calendars/calendars.addon.mjs +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 +2 -2
- package/dist/builtins/core-blocks/core-blocks.addon.mjs +2 -2
- package/dist/builtins/device-manager/device-manager.addon.js +2 -2
- package/dist/builtins/device-manager/device-manager.addon.mjs +2 -2
- package/dist/builtins/hub-forwarder/index.js +1 -1
- package/dist/builtins/hub-forwarder/index.mjs +1 -1
- package/dist/builtins/keychain/index.js +7 -9
- package/dist/builtins/keychain/index.mjs +7 -9
- 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 +5 -3
- package/dist/builtins/local-auth/local-auth.addon.mjs +5 -3
- 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 +102 -10
- package/dist/builtins/native-metrics/native-metrics.addon.mjs +92 -4
- package/dist/builtins/platform-probe/amd-npu.d.ts +6 -0
- package/dist/builtins/platform-probe/index.js +317 -19
- package/dist/builtins/platform-probe/index.mjs +318 -20
- package/dist/builtins/platform-probe/platform-scorer.d.ts +4 -0
- package/dist/builtins/platform-probe/windows-hardware.d.ts +77 -0
- 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/filesystem-storage.addon.js +1 -1
- package/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +1 -1
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.js +0 -0
- package/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +0 -0
- package/dist/builtins/storage-orchestrator/index.mjs +1 -1
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +83 -3
- package/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +79 -3
- package/dist/builtins/system-config/system-config.addon.js +2 -2
- package/dist/builtins/system-config/system-config.addon.mjs +2 -2
- package/dist/builtins/winston-logging/index.js +1 -1
- package/dist/builtins/winston-logging/index.mjs +1 -1
- package/dist/{composition-sources-DEZqZLPT.mjs → composition-sources-0cPw9E0M.mjs} +1 -1
- package/dist/{composition-sources-DBcOVpGn.js → composition-sources-BVjuMvpb.js} +1 -1
- package/dist/{constants-C4jZO_qO.js → constants-Aj0OBqlt.js} +1 -1
- package/dist/{constants-BSBtmzm3.mjs → constants-C8T7u1_Z.mjs} +1 -1
- package/dist/{event-loop-stall-monitor-LBZskC1S.mjs → custom-action-registry-BQnbN0DP.mjs} +57 -2
- package/dist/{event-loop-stall-monitor-E2hFvhDg.js → custom-action-registry-Bf_YnagS.js} +64 -3
- package/dist/{dist-DxiDI8hZ.js → dist-DVUg8e1T.js} +56 -182
- package/dist/{dist-DwE9yHdk.mjs → dist-DlmdESNT.mjs} +57 -153
- package/dist/index.js +22901 -10154
- package/dist/index.mjs +22616 -9869
- package/dist/{jwt-signing-key-DLbjTIuA.mjs → jwt-signing-key-CGg61A5v.mjs} +1 -1
- package/dist/{jwt-signing-key-CsC-FxSm.js → jwt-signing-key-Jyu81jZR.js} +1 -1
- package/dist/kernel/moleculer/broker-factory.d.ts +2 -4
- package/dist/kernel/transport/local-child-registry.d.ts +1 -1
- package/dist/logging/log-redactor.d.ts +1 -1
- package/dist/{resource-monitor-B2WZ8_q9.mjs → resource-monitor-Di9daRwI.mjs} +1 -1
- package/dist/{resource-monitor-BgWGRxN5.js → resource-monitor-mio9dSCT.js} +5 -5
- package/dist/{restore-archive-BtKjaVua.js → restore-archive-Bq5PpQ-H.js} +1 -1
- package/dist/{restore-archive-CImzbuRo.mjs → restore-archive-DVo5ooBt.mjs} +1 -1
- package/dist/{retired-settings-keys-Cl1tnkmq.js → retired-settings-keys-CihMX6h9.js} +1 -1
- package/dist/{retired-settings-keys-D1WsCdUY.mjs → retired-settings-keys-k_XuC-Mt.mjs} +1 -1
- package/dist/{tls-C0TRPfqc.js → tls-BgImdxCO.js} +4 -11
- package/dist/{tls-D-2dPY-5.mjs → tls-CaOLZ09W.mjs} +5 -12
- package/package.json +2 -2
- package/dist/amd-npu-B-QyyMyF.js +0 -53
- package/dist/amd-npu-Db_SoSuL.mjs +0 -52
- package/dist/child-cap-dispatch-B87B0FrC.js +0 -13986
- package/dist/child-cap-dispatch-CmfT-OR2.mjs +0 -12916
- package/dist/custom-action-registry-B4Cf4O_X.mjs +0 -57
- package/dist/custom-action-registry-acBY3mHA.js +0 -62
- package/dist/hub-cap-forward-CDiN1p98.mjs +0 -78
- package/dist/hub-cap-forward-W8oEm4ME.js +0 -101
- package/dist/proc-stat-CbC55Kqi.mjs +0 -92
- package/dist/proc-stat-DL-WUOhl.js +0 -127
|
@@ -7,8 +7,8 @@ interface BrokerConfig {
|
|
|
7
7
|
readonly logLevel?: string;
|
|
8
8
|
/**
|
|
9
9
|
* TCP port the hub listens on for cluster traffic.
|
|
10
|
-
* Agents
|
|
11
|
-
*
|
|
10
|
+
* Agents connect to it via `urls: 'hub@host:port'` — there is no UDP
|
|
11
|
+
* discovery (D826, D843).
|
|
12
12
|
*/
|
|
13
13
|
readonly tcpPort?: number;
|
|
14
14
|
/**
|
|
@@ -16,8 +16,6 @@ interface BrokerConfig {
|
|
|
16
16
|
* Clear traffic stays on {@link tcpPort}; enrolled agents dial this.
|
|
17
17
|
*/
|
|
18
18
|
readonly tlsPort?: number;
|
|
19
|
-
/** UDP port for cluster discovery (default: 4445). */
|
|
20
|
-
readonly udpPort?: number;
|
|
21
19
|
/**
|
|
22
20
|
* Explicit TCP port for the agent's own Moleculer reader to bind.
|
|
23
21
|
* When omitted, the port is derived deterministically from `nodeID`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { IReadinessRegistryRecord, SystemEvent } from "@camstack/types";
|
|
2
2
|
import type { CapUsageCallRecord } from "../moleculer/cap-usage-registry.js";
|
|
3
3
|
import { type CapActionReading } from "./cap-action-census.js";
|
|
4
4
|
import { type CapRoutingHints } from "./cap-routing-hints.js";
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* Hot path: a line with no meta, no `://`, no `--` and no registered values
|
|
20
20
|
* costs a few `includes` checks.
|
|
21
21
|
*/
|
|
22
|
-
import {
|
|
22
|
+
import type { LogEntry } from "@camstack/types";
|
|
23
23
|
/** True when a meta key names a credential. */
|
|
24
24
|
export declare function isCredentialKeyName(key: string): boolean;
|
|
25
25
|
/** Redact one free-form string. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __exportAll } from "./chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { i as parseProcStatusRss, n as nodeProcReader, r as parseProcStat, t as lifetimeCpuPercent } from "./builtins/native-metrics/native-metrics.addon.mjs";
|
|
3
3
|
import { platform } from "node:os";
|
|
4
4
|
import { execFile } from "node:child_process";
|
|
5
5
|
//#region src/process/resource-monitor.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const
|
|
2
|
+
const require_builtins_native_metrics_native_metrics_addon = require("./builtins/native-metrics/native-metrics.addon.js");
|
|
3
3
|
let node_os = require("node:os");
|
|
4
4
|
let node_child_process = require("node:child_process");
|
|
5
5
|
//#region src/process/resource-monitor.ts
|
|
@@ -22,7 +22,7 @@ function execPsForPids(pids) {
|
|
|
22
22
|
}
|
|
23
23
|
var defaultDeps = {
|
|
24
24
|
platform: (0, node_os.platform)(),
|
|
25
|
-
reader:
|
|
25
|
+
reader: require_builtins_native_metrics_native_metrics_addon.nodeProcReader,
|
|
26
26
|
spawnPs: execPsForPids
|
|
27
27
|
};
|
|
28
28
|
function parsePsOutput(stdout) {
|
|
@@ -52,12 +52,12 @@ async function readProcPidStats(pid, uptimeSec, reader) {
|
|
|
52
52
|
} catch {
|
|
53
53
|
return null;
|
|
54
54
|
}
|
|
55
|
-
const parsed =
|
|
55
|
+
const parsed = require_builtins_native_metrics_native_metrics_addon.parseProcStat(stat);
|
|
56
56
|
if (parsed === null) return null;
|
|
57
|
-
const rss =
|
|
57
|
+
const rss = require_builtins_native_metrics_native_metrics_addon.parseProcStatusRss(status);
|
|
58
58
|
if (rss.rssBytes === void 0) return null;
|
|
59
59
|
return {
|
|
60
|
-
cpu:
|
|
60
|
+
cpu: require_builtins_native_metrics_native_metrics_addon.lifetimeCpuPercent({
|
|
61
61
|
ticks: parsed.ticks,
|
|
62
62
|
startTicks: parsed.startTicks,
|
|
63
63
|
uptimeSec
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
|
-
const require_dist = require("./dist-
|
|
2
|
+
const require_dist = require("./dist-DVUg8e1T.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
4
|
let buffer = require("buffer");
|
|
5
5
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as DATABASE_SNAPSHOT_SUFFIX } from "./dist-
|
|
1
|
+
import { g as DATABASE_SNAPSHOT_SUFFIX } from "./dist-DlmdESNT.mjs";
|
|
2
2
|
import { createCipheriv, createDecipheriv, createHash, createPrivateKey, createPublicKey, diffieHellman, generateKeyPairSync, hkdfSync, randomBytes } from "node:crypto";
|
|
3
3
|
import { Buffer as Buffer$1 } from "buffer";
|
|
4
4
|
import * as fsp from "node:fs/promises";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-Cek0wNdY.js");
|
|
2
2
|
const require_x509_es = require("./x509.es-Dzl0BbmG.js");
|
|
3
3
|
let node_crypto = require("node:crypto");
|
|
4
|
+
let _camstack_types_node = require("@camstack/types/node");
|
|
4
5
|
let node_net = require("node:net");
|
|
5
6
|
let node_fs_promises = require("node:fs/promises");
|
|
6
7
|
let node_path = require("node:path");
|
|
@@ -594,22 +595,14 @@ async function regenerate(paths, identity, commonName, validDays, newCa) {
|
|
|
594
595
|
const chainPem = `${leaf.certPem.trimEnd()}\n${ca.certPem.trimEnd()}\n`;
|
|
595
596
|
if (newCa) {
|
|
596
597
|
await (0, node_fs_promises.writeFile)(`${paths.caCertPath}.new`, ca.certPem, "utf-8");
|
|
597
|
-
|
|
598
|
-
encoding: "utf-8",
|
|
599
|
-
mode: 384
|
|
600
|
-
});
|
|
598
|
+
(0, _camstack_types_node.writeOwnerOnlyFileSync)(`${paths.caKeyPath}.new`, ca.keyPem);
|
|
601
599
|
(0, node_fs.renameSync)(`${paths.caCertPath}.new`, paths.caCertPath);
|
|
602
600
|
(0, node_fs.renameSync)(`${paths.caKeyPath}.new`, paths.caKeyPath);
|
|
603
|
-
await (0, node_fs_promises.chmod)(paths.caKeyPath, 384);
|
|
604
601
|
}
|
|
605
|
-
|
|
606
|
-
encoding: "utf-8",
|
|
607
|
-
mode: 384
|
|
608
|
-
});
|
|
602
|
+
(0, _camstack_types_node.writeOwnerOnlyFileSync)(`${paths.keyPath}.new`, leaf.keyPem);
|
|
609
603
|
await (0, node_fs_promises.writeFile)(`${paths.certPath}.new`, chainPem, "utf-8");
|
|
610
604
|
(0, node_fs.renameSync)(`${paths.keyPath}.new`, paths.keyPath);
|
|
611
605
|
(0, node_fs.renameSync)(`${paths.certPath}.new`, paths.certPath);
|
|
612
|
-
await (0, node_fs_promises.chmod)(paths.keyPath, 384);
|
|
613
606
|
}
|
|
614
607
|
function describe(paths, generated, reason, caRotated, previousFingerprintSha256, reissueError) {
|
|
615
608
|
const leaf = new node_crypto.X509Certificate((0, node_fs.readFileSync)(paths.certPath));
|
|
@@ -917,7 +910,7 @@ async function storeUploadedCertificate(dataDir, input) {
|
|
|
917
910
|
const dir = (0, node_path.join)(dataDir, "tls");
|
|
918
911
|
await (0, node_fs_promises.mkdir)(dir, { recursive: true });
|
|
919
912
|
await (0, node_fs_promises.writeFile)((0, node_path.join)(dir, "camstack.crt"), withNewline(input.certPem));
|
|
920
|
-
|
|
913
|
+
(0, _camstack_types_node.writeOwnerOnlyFileSync)((0, node_path.join)(dir, "camstack.key"), withNewline(input.keyPem));
|
|
921
914
|
const caPath = (0, node_path.join)(dir, UPLOADED_CA_FILE);
|
|
922
915
|
if (input.caPem !== void 0 && input.caPem.trim() !== "") await (0, node_fs_promises.writeFile)(caPath, withNewline(input.caPem));
|
|
923
916
|
else (0, node_fs.rmSync)(caPath, { force: true });
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { a as KeyUsagesExtension, d as X509Certificate$1, f as X509CertificateGenerator, i as KeyUsageFlags, l as SubjectAlternativeNameExtension, n as BasicConstraintsExtension, o as PemConverter, p as cryptoProvider, r as ExtendedKeyUsageExtension, t as AuthorityKeyIdentifierExtension, u as SubjectKeyIdentifierExtension } from "./x509.es-CAjSsrkk.mjs";
|
|
2
2
|
import { X509Certificate, createPrivateKey, randomBytes, webcrypto } from "node:crypto";
|
|
3
|
+
import { writeOwnerOnlyFileSync } from "@camstack/types/node";
|
|
3
4
|
import { isIP } from "node:net";
|
|
4
|
-
import {
|
|
5
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
5
6
|
import { join } from "node:path";
|
|
6
7
|
import * as os from "node:os";
|
|
7
8
|
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -592,22 +593,14 @@ async function regenerate(paths, identity, commonName, validDays, newCa) {
|
|
|
592
593
|
const chainPem = `${leaf.certPem.trimEnd()}\n${ca.certPem.trimEnd()}\n`;
|
|
593
594
|
if (newCa) {
|
|
594
595
|
await writeFile(`${paths.caCertPath}.new`, ca.certPem, "utf-8");
|
|
595
|
-
|
|
596
|
-
encoding: "utf-8",
|
|
597
|
-
mode: 384
|
|
598
|
-
});
|
|
596
|
+
writeOwnerOnlyFileSync(`${paths.caKeyPath}.new`, ca.keyPem);
|
|
599
597
|
renameSync(`${paths.caCertPath}.new`, paths.caCertPath);
|
|
600
598
|
renameSync(`${paths.caKeyPath}.new`, paths.caKeyPath);
|
|
601
|
-
await chmod(paths.caKeyPath, 384);
|
|
602
599
|
}
|
|
603
|
-
|
|
604
|
-
encoding: "utf-8",
|
|
605
|
-
mode: 384
|
|
606
|
-
});
|
|
600
|
+
writeOwnerOnlyFileSync(`${paths.keyPath}.new`, leaf.keyPem);
|
|
607
601
|
await writeFile(`${paths.certPath}.new`, chainPem, "utf-8");
|
|
608
602
|
renameSync(`${paths.keyPath}.new`, paths.keyPath);
|
|
609
603
|
renameSync(`${paths.certPath}.new`, paths.certPath);
|
|
610
|
-
await chmod(paths.keyPath, 384);
|
|
611
604
|
}
|
|
612
605
|
function describe(paths, generated, reason, caRotated, previousFingerprintSha256, reissueError) {
|
|
613
606
|
const leaf = new X509Certificate(readFileSync(paths.certPath));
|
|
@@ -915,7 +908,7 @@ async function storeUploadedCertificate(dataDir, input) {
|
|
|
915
908
|
const dir = join(dataDir, "tls");
|
|
916
909
|
await mkdir(dir, { recursive: true });
|
|
917
910
|
await writeFile(join(dir, "camstack.crt"), withNewline(input.certPem));
|
|
918
|
-
|
|
911
|
+
writeOwnerOnlyFileSync(join(dir, "camstack.key"), withNewline(input.keyPem));
|
|
919
912
|
const caPath = join(dir, UPLOADED_CA_FILE);
|
|
920
913
|
if (input.caPem !== void 0 && input.caPem.trim() !== "") await writeFile(caPath, withNewline(input.caPem));
|
|
921
914
|
else rmSync(caPath, { force: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camstack/system",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.418",
|
|
4
4
|
"description": "Core addon for CamStack — builtins, pipeline, process management, auth, logging, events",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"camstack",
|
|
@@ -475,7 +475,7 @@
|
|
|
475
475
|
],
|
|
476
476
|
"scripts": {
|
|
477
477
|
"copy:hook": "node -e \"const fs=require('fs'),p=require('path');const dst=p.join('dist');fs.mkdirSync(dst,{recursive:true});fs.copyFileSync(p.join('src','kernel','moleculer','framework-resolver-hook.mjs'),p.join(dst,'framework-resolver-hook.mjs'));console.log('copied framework-resolver-hook.mjs ->',dst)\"",
|
|
478
|
-
"build": "vite build && npx tsx ../../scripts/emit-isolated-dts.ts --root . --src src --out dist && npm run copy:hook",
|
|
478
|
+
"build": "vite build && vite build -c vite.runner.config.ts && npx tsx ../../scripts/emit-isolated-dts.ts --root . --src src --out dist && npm run copy:hook",
|
|
479
479
|
"dev": "tsup --watch",
|
|
480
480
|
"typecheck": "tsc --noEmit -p tsconfig.spec.json",
|
|
481
481
|
"test": "vitest run",
|
package/dist/amd-npu-B-QyyMyF.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
require("./chunk-Cek0wNdY.js");
|
|
2
|
-
//#region src/builtins/platform-probe/amd-npu.ts
|
|
3
|
-
var ACCEL_CLASS = "/sys/class/accel";
|
|
4
|
-
var ACCEL_DEV = "/dev/accel";
|
|
5
|
-
var AMD_PCI_VENDOR = "0x1022";
|
|
6
|
-
/** Phoenix / Hawk Point XDNA1. */
|
|
7
|
-
var XDNA1_DEVICES = new Set(["0x1502"]);
|
|
8
|
-
/** Strix / Krackan XDNA2. */
|
|
9
|
-
var XDNA2_DEVICES = new Set(["0x17f0"]);
|
|
10
|
-
function normalizePciId(raw) {
|
|
11
|
-
const t = raw.trim().toLowerCase();
|
|
12
|
-
if (t.startsWith("0x")) return t;
|
|
13
|
-
if (t.length > 0 && [...t].every((c) => "0123456789abcdef".includes(c))) return "0x" + t;
|
|
14
|
-
return t;
|
|
15
|
-
}
|
|
16
|
-
function hasAccelCharDevice(fsx) {
|
|
17
|
-
if (fsx.listDir(ACCEL_DEV).some((n) => n.startsWith("accel"))) return true;
|
|
18
|
-
return fsx.exists("/dev/accel/accel0");
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Detect an AMD XDNA NPU and report it as **present only**.
|
|
22
|
-
*
|
|
23
|
-
* Inference is NOT offered until P2 (Ryzen AI on Linux is Strix-first;
|
|
24
|
-
* Phoenix is not a production path today). The probe still names the
|
|
25
|
-
* generation so the UI and fleet census can show the hardware.
|
|
26
|
-
*/
|
|
27
|
-
function classifyAmdNpu(ctx, fsx) {
|
|
28
|
-
if (ctx.platform !== "linux" || ctx.arch !== "x64" || !ctx.amdPresent) return null;
|
|
29
|
-
if (!hasAccelCharDevice(fsx)) return null;
|
|
30
|
-
for (const name of fsx.listDir(ACCEL_CLASS)) {
|
|
31
|
-
if (!name.startsWith("accel")) continue;
|
|
32
|
-
const vendor = normalizePciId(fsx.readFile("/sys/class/accel/" + name + "/device/vendor"));
|
|
33
|
-
const device = normalizePciId(fsx.readFile("/sys/class/accel/" + name + "/device/device"));
|
|
34
|
-
if (vendor !== AMD_PCI_VENDOR) continue;
|
|
35
|
-
if (XDNA1_DEVICES.has(device)) return {
|
|
36
|
-
type: "amd-xdna",
|
|
37
|
-
name: "AMD XDNA1 NPU",
|
|
38
|
-
generation: "xdna1"
|
|
39
|
-
};
|
|
40
|
-
if (XDNA2_DEVICES.has(device)) return {
|
|
41
|
-
type: "amd-xdna",
|
|
42
|
-
name: "AMD XDNA2 NPU",
|
|
43
|
-
generation: "xdna2"
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
type: "amd-xdna",
|
|
47
|
-
name: "AMD XDNA NPU"
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
//#endregion
|
|
53
|
-
exports.classifyAmdNpu = classifyAmdNpu;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
//#region src/builtins/platform-probe/amd-npu.ts
|
|
2
|
-
var ACCEL_CLASS = "/sys/class/accel";
|
|
3
|
-
var ACCEL_DEV = "/dev/accel";
|
|
4
|
-
var AMD_PCI_VENDOR = "0x1022";
|
|
5
|
-
/** Phoenix / Hawk Point XDNA1. */
|
|
6
|
-
var XDNA1_DEVICES = new Set(["0x1502"]);
|
|
7
|
-
/** Strix / Krackan XDNA2. */
|
|
8
|
-
var XDNA2_DEVICES = new Set(["0x17f0"]);
|
|
9
|
-
function normalizePciId(raw) {
|
|
10
|
-
const t = raw.trim().toLowerCase();
|
|
11
|
-
if (t.startsWith("0x")) return t;
|
|
12
|
-
if (t.length > 0 && [...t].every((c) => "0123456789abcdef".includes(c))) return "0x" + t;
|
|
13
|
-
return t;
|
|
14
|
-
}
|
|
15
|
-
function hasAccelCharDevice(fsx) {
|
|
16
|
-
if (fsx.listDir(ACCEL_DEV).some((n) => n.startsWith("accel"))) return true;
|
|
17
|
-
return fsx.exists("/dev/accel/accel0");
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Detect an AMD XDNA NPU and report it as **present only**.
|
|
21
|
-
*
|
|
22
|
-
* Inference is NOT offered until P2 (Ryzen AI on Linux is Strix-first;
|
|
23
|
-
* Phoenix is not a production path today). The probe still names the
|
|
24
|
-
* generation so the UI and fleet census can show the hardware.
|
|
25
|
-
*/
|
|
26
|
-
function classifyAmdNpu(ctx, fsx) {
|
|
27
|
-
if (ctx.platform !== "linux" || ctx.arch !== "x64" || !ctx.amdPresent) return null;
|
|
28
|
-
if (!hasAccelCharDevice(fsx)) return null;
|
|
29
|
-
for (const name of fsx.listDir(ACCEL_CLASS)) {
|
|
30
|
-
if (!name.startsWith("accel")) continue;
|
|
31
|
-
const vendor = normalizePciId(fsx.readFile("/sys/class/accel/" + name + "/device/vendor"));
|
|
32
|
-
const device = normalizePciId(fsx.readFile("/sys/class/accel/" + name + "/device/device"));
|
|
33
|
-
if (vendor !== AMD_PCI_VENDOR) continue;
|
|
34
|
-
if (XDNA1_DEVICES.has(device)) return {
|
|
35
|
-
type: "amd-xdna",
|
|
36
|
-
name: "AMD XDNA1 NPU",
|
|
37
|
-
generation: "xdna1"
|
|
38
|
-
};
|
|
39
|
-
if (XDNA2_DEVICES.has(device)) return {
|
|
40
|
-
type: "amd-xdna",
|
|
41
|
-
name: "AMD XDNA2 NPU",
|
|
42
|
-
generation: "xdna2"
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
type: "amd-xdna",
|
|
46
|
-
name: "AMD XDNA NPU"
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { classifyAmdNpu };
|