@camstack/server 1.2.927 → 1.2.929
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/package.json +11 -14
- package/system/dist/addon-id-CVg1_r5E.mjs +39 -0
- package/system/dist/addon-id-Di0lNJ89.js +50 -0
- package/system/dist/addon-pages.cap-Df9FQwN1.js +49 -0
- package/system/dist/addon-pages.cap-DksUlE8j.mjs +44 -0
- package/system/dist/addon-settings.cap-3-TIIMq_.mjs +592 -0
- package/system/dist/addon-settings.cap-DAiE0Nb0.js +651 -0
- package/system/dist/addon-widgets.cap-C4jxflbF.js +200 -0
- package/system/dist/addon-widgets.cap-D9m48X78.mjs +183 -0
- package/system/dist/base-addon-DD5dIfcZ.js +4624 -0
- package/system/dist/base-addon-Md14i7pe.mjs +4505 -0
- package/system/dist/base-device-2sL1DMm1.js +1103 -0
- package/system/dist/base-device-IuM1AwXZ.mjs +1098 -0
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-pages-aggregator/addon-pages-aggregator.addon.mjs +3 -1
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.js +8 -6
- package/system/dist/builtins/addon-widgets-aggregator/addon-widgets-aggregator.addon.mjs +3 -1
- package/system/dist/builtins/alerts/alerts.addon.js +113 -56
- package/system/dist/builtins/alerts/alerts.addon.mjs +58 -1
- package/system/dist/builtins/autotrack/index.js +21 -17
- package/system/dist/builtins/autotrack/index.mjs +5 -1
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.js +14 -11
- package/system/dist/builtins/backup-orchestrator/backup-orchestrator.addon.mjs +5 -2
- package/system/dist/builtins/calendars/calendars.addon.js +8 -6
- package/system/dist/builtins/calendars/calendars.addon.mjs +3 -1
- package/system/dist/builtins/camera-grid/index.js +615 -58
- package/system/dist/builtins/camera-grid/index.mjs +558 -1
- package/system/dist/builtins/composer/composer.addon.js +788 -209
- package/system/dist/builtins/composer/composer.addon.mjs +583 -4
- package/system/dist/builtins/console-logging/index.js +4 -3
- package/system/dist/builtins/console-logging/index.mjs +2 -1
- package/system/dist/builtins/core-blocks/core-blocks.addon.js +7887 -381
- package/system/dist/builtins/core-blocks/core-blocks.addon.mjs +7511 -5
- package/system/dist/builtins/core-notifier/core-notifier.addon.js +731 -21
- package/system/dist/builtins/core-notifier/core-notifier.addon.mjs +711 -1
- package/system/dist/builtins/device-history/device-history.addon.js +110 -31
- package/system/dist/builtins/device-history/device-history.addon.mjs +81 -2
- package/system/dist/builtins/device-manager/device-manager.addon.js +12806 -227
- package/system/dist/builtins/device-manager/device-manager.addon.mjs +12583 -5
- package/system/dist/builtins/hub-forwarder/index.js +4 -3
- package/system/dist/builtins/hub-forwarder/index.mjs +2 -1
- package/system/dist/builtins/keychain/index.js +31 -28
- package/system/dist/builtins/keychain/index.mjs +7 -4
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.js +15 -12
- package/system/dist/builtins/liveness-monitor/liveness-monitor.addon.mjs +4 -1
- package/system/dist/builtins/local-auth/local-auth.addon.js +140 -39
- package/system/dist/builtins/local-auth/local-auth.addon.mjs +103 -3
- package/system/dist/builtins/local-network/local-network.addon.js +43 -39
- package/system/dist/builtins/local-network/local-network.addon.mjs +7 -3
- package/system/dist/builtins/loki-logging/index.js +23 -17
- package/system/dist/builtins/loki-logging/index.mjs +7 -1
- package/system/dist/builtins/native-metrics/native-metrics.addon.js +156 -15
- package/system/dist/builtins/native-metrics/native-metrics.addon.mjs +142 -1
- package/system/dist/builtins/platform-probe/index.js +25 -23
- package/system/dist/builtins/platform-probe/index.mjs +4 -2
- package/system/dist/builtins/record-entries/index.js +9 -7
- package/system/dist/builtins/record-entries/index.mjs +3 -1
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.js +4 -4
- package/system/dist/builtins/remote-access-orchestrator/remote-access-orchestrator.addon.mjs +1 -1
- package/system/dist/builtins/snapshot/index.js +97 -44
- package/system/dist/builtins/snapshot/index.mjs +54 -1
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.js +5 -4
- package/system/dist/builtins/sqlite-storage/filesystem-storage.addon.mjs +2 -1
- package/system/dist/builtins/sqlite-storage/index.js +1 -1
- package/system/dist/builtins/sqlite-storage/index.mjs +1 -1
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.js +87 -61
- package/system/dist/builtins/sqlite-storage/sqlite-settings.addon.mjs +29 -3
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.js +81 -72
- package/system/dist/builtins/storage-orchestrator/storage-orchestrator.addon.mjs +10 -1
- package/system/dist/builtins/system-config/system-config.addon.js +17 -14
- package/system/dist/builtins/system-config/system-config.addon.mjs +6 -3
- package/system/dist/builtins/winston-logging/index.js +7 -5
- package/system/dist/builtins/winston-logging/index.mjs +3 -1
- package/system/dist/calendars.cap-CaFlShS9.js +155 -0
- package/system/dist/calendars.cap-_C4eD4fi.mjs +138 -0
- package/system/dist/camstack-error-DJ-TUAi1.js +23 -0
- package/system/dist/camstack-error-viZYfcj9.mjs +18 -0
- package/system/dist/cap-call-context-Bd76CbOW.js +95 -0
- package/system/dist/cap-call-context-DNwdgGSQ.mjs +78 -0
- package/system/dist/capability-definition-C2rJdVeX.mjs +177 -0
- package/system/dist/capability-definition-HCmTem8c.js +242 -0
- package/system/dist/{capture-engine-BcuwOSXv.js → capture-engine-DZ0LIUqA.js} +5 -4
- package/system/dist/{capture-engine-Bz7eXFjT.mjs → capture-engine-DiwbjoWp.mjs} +2 -1
- package/system/dist/command-origin-claim-Cief660O.js +35 -0
- package/system/dist/command-origin-claim-D1Wy7Qld.mjs +24 -0
- package/system/dist/composition-sources-Caqv7O7z.mjs +391 -0
- package/system/dist/composition-sources-CgnHjm8Q.js +408 -0
- package/system/dist/{constants-D2etJ02O.js → constants-Ba3FTIHl.js} +1 -1
- package/system/dist/constants-C860Y6U4.js +26 -0
- package/system/dist/{constants-BcUTQd1M.mjs → constants-DB4piTD5.mjs} +1 -1
- package/system/dist/constants-DCLpoF4L.mjs +21 -0
- package/system/dist/coral-accelerators-7o8hqvcN.js +564 -0
- package/system/dist/coral-accelerators-BKcXP59c.mjs +521 -0
- package/system/dist/core-blocks.cap-C6iKAZ-x.mjs +17986 -0
- package/system/dist/core-blocks.cap-LEMqVwxO.js +18705 -0
- package/system/dist/custom-actions-BFUSalC9.mjs +25 -0
- package/system/dist/custom-actions-D92NRi2c.js +36 -0
- package/system/dist/database-snapshot.cap-DF38e-0P.js +162 -0
- package/system/dist/database-snapshot.cap-dhrc9xnY.mjs +133 -0
- package/system/dist/declared-device-BWphj9WE.js +303 -0
- package/system/dist/declared-device-CKERA1Hi.mjs +286 -0
- package/system/dist/{device-ca-ExMN3xW3.mjs → device-ca-BLM6fccc.mjs} +2 -1
- package/system/dist/{device-ca-CU8zh9Pi.js → device-ca-C5kJE6mL.js} +7 -6
- package/system/dist/device-certificate-Cddm4Idn.mjs +91 -0
- package/system/dist/device-certificate-CguVACQO.js +162 -0
- package/system/dist/device-identifiers-BQg9EQi1.js +600 -0
- package/system/dist/device-identifiers-iSuQCKmK.mjs +529 -0
- package/system/dist/device-kind-BJ2pfsjw.mjs +78 -0
- package/system/dist/device-kind-CsSiv_YF.js +101 -0
- package/system/dist/device-manager.cap-2abwVLCM.js +2874 -0
- package/system/dist/device-manager.cap-CFZSPfUh.mjs +2749 -0
- package/system/dist/device-provider.cap-3Uvk6f5-.mjs +331 -0
- package/system/dist/device-provider.cap-D7TV2kVH.js +366 -0
- package/system/dist/{device-row-store-CeW_GWh9.mjs → device-row-store-YF3jtmkk.mjs} +4 -1
- package/system/dist/{device-row-store-BMIR-n3m.js → device-row-store-doTfMOqn.js} +12 -9
- package/system/dist/device-transitions.cap-B5w5PYU_.js +860 -0
- package/system/dist/device-transitions.cap-DojcwEuX.mjs +819 -0
- package/system/dist/device-type-CbQsnFdC.js +477 -0
- package/system/dist/device-type-DgEvK3ch.mjs +454 -0
- package/system/dist/entry-kind-D9MuVJCK.mjs +44 -0
- package/system/dist/entry-kind-cq90c--V.js +55 -0
- package/system/dist/error.cap-CSM_SRfR.mjs +3423 -0
- package/system/dist/error.cap-DBhgPeWK.js +3848 -0
- package/system/dist/file-host-worker.js +1 -1
- package/system/dist/file-host-worker.mjs +1 -1
- package/system/dist/history-catalog-BKRarIL_.js +831 -0
- package/system/dist/history-catalog-BwTeQ4Mr.mjs +802 -0
- package/system/dist/{hub-identity-Csxx2Q8k.js → hub-identity-BMdR3Mw9.js} +2 -2
- package/system/dist/{hub-identity-BBXzP6Ve.mjs → hub-identity-DjMN9Ac2.mjs} +1 -1
- package/system/dist/{hub-mdns-ciao-By5577HM.js → hub-mdns-ciao--0v1TKME.js} +5 -5
- package/system/dist/{hub-mdns-ciao-DG17NbGU.mjs → hub-mdns-ciao-DBrtHOcc.mjs} +2 -2
- package/system/dist/index.js +763 -151
- package/system/dist/index.mjs +624 -12
- package/system/dist/integration-instances.cap-Cl9O-k4h.mjs +538 -0
- package/system/dist/integration-instances.cap-dJIxg2_s.js +549 -0
- package/system/dist/keychain-admin.cap-Db_oFX4H.js +425 -0
- package/system/dist/keychain-admin.cap-GtM7gVGG.mjs +396 -0
- package/system/dist/l10n-Bu6aUvSY.mjs +10 -0
- package/system/dist/l10n-CGMvp7NF.js +15 -0
- package/system/dist/labels-DX5S8deC.js +81 -0
- package/system/dist/labels-DsBcU7md.mjs +64 -0
- package/system/dist/{legacy-integration-rows-door-CVwOo5aq.js → legacy-integration-rows-door-B1nzxxr5.js} +2 -2
- package/system/dist/{legacy-integration-rows-door-D9tQOUzh.mjs → legacy-integration-rows-door-nTvo_6jQ.mjs} +1 -1
- package/system/dist/log-destination.cap-CxZzAVaR.mjs +143 -0
- package/system/dist/log-destination.cap-DELPJkZ0.js +148 -0
- package/system/dist/low-power-sleep.cap-7lfVU41N.js +103 -0
- package/system/dist/low-power-sleep.cap-tGPmaZ_V.mjs +92 -0
- package/system/dist/mask-shape-Ci8Co9w0.mjs +57 -0
- package/system/dist/mask-shape-CmPA2fst.js +92 -0
- package/system/dist/metrics-provider.cap-BNmcHDkQ.mjs +405 -0
- package/system/dist/metrics-provider.cap-BcmQUt6l.js +410 -0
- package/system/dist/migration-BMjgkyG2.js +380 -0
- package/system/dist/migration-DRJAtdy7.mjs +321 -0
- package/system/dist/network-access.cap-B5TWLDCC.js +1099 -0
- package/system/dist/network-access.cap-BJnGbE6n.mjs +1004 -0
- package/system/dist/notification-rules.cap-B__YBgnG.js +3422 -0
- package/system/dist/notification-rules.cap-D9ArZlwx.mjs +3357 -0
- package/system/dist/ops-log-CB4pIdqi.mjs +64 -0
- package/system/dist/ops-log-pxt9176Z.js +81 -0
- package/system/dist/pinned-binary-BOhOSNff.js +28 -0
- package/system/dist/pinned-binary-CrIRAi4G.mjs +23 -0
- package/system/dist/platform-probe.cap-1WrMhWHx.js +250 -0
- package/system/dist/platform-probe.cap-BFeqFLtQ.mjs +233 -0
- package/system/dist/prefix-walk-B4b2-9aK.mjs +790 -0
- package/system/dist/prefix-walk-DC0ljmbB.js +843 -0
- package/system/dist/ptz-autotrack.cap-BW7w0zHD.js +229 -0
- package/system/dist/ptz-autotrack.cap-DT2GypXw.mjs +224 -0
- package/system/dist/quantity-D3g5SxsZ.mjs +114 -0
- package/system/dist/quantity-lY1KiTSZ.js +143 -0
- package/system/dist/raw-secret-migration-DxuBFtvi.js +50 -0
- package/system/dist/raw-secret-migration-iv88mLoc.mjs +39 -0
- package/system/dist/record-entries.cap-sMUhTvTU.mjs +75 -0
- package/system/dist/record-entries.cap-ti1C046R.js +80 -0
- package/system/dist/record-kind-DoBfYHCs.js +203 -0
- package/system/dist/record-kind-ub6NXqfh.mjs +162 -0
- package/system/dist/recording-archive.cap-7OrIn9e5.mjs +1299 -0
- package/system/dist/recording-archive.cap-D7bo-QSM.js +1328 -0
- package/system/dist/records.cap-ClcWV64i.js +329 -0
- package/system/dist/records.cap-CwLT2ByG.mjs +294 -0
- package/system/dist/relocate-CdVQAk-w.js +804 -0
- package/system/dist/relocate-CoZZTui1.mjs +661 -0
- package/system/dist/rename-composition-block-7WIICIDq.mjs +33525 -0
- package/system/dist/rename-composition-block-CcWLwVhG.js +34692 -0
- package/system/dist/{restore-archive-kwtBd00M.mjs → restore-archive-CjAyKpgX.mjs} +3 -1
- package/system/dist/{restore-archive-CIFvqOze.js → restore-archive-CkTkv3Ss.js} +6 -4
- package/system/dist/scoped-settings-CylSSq_8.js +955 -0
- package/system/dist/scoped-settings-DVWUIP7Z.mjs +650 -0
- package/system/dist/server-name-BIhLuHvX.mjs +35 -0
- package/system/dist/server-name-OALNvpqC.js +52 -0
- package/system/dist/settings-store.cap-Ci4F2zul.mjs +569 -0
- package/system/dist/settings-store.cap-wlJhCspr.js +640 -0
- package/system/dist/snapshot.cap-3suPdBHV.js +250 -0
- package/system/dist/snapshot.cap-Bs8Oyaqh.mjs +245 -0
- package/system/dist/source-info-DGB7SdB_.mjs +190 -0
- package/system/dist/source-info-DtWf4k2j.js +225 -0
- package/system/dist/storage-admin.cap-BSv1NjKJ.mjs +883 -0
- package/system/dist/storage-admin.cap-he0OqvVM.js +906 -0
- package/system/dist/storage-location-CBT8GCD6.mjs +163 -0
- package/system/dist/storage-location-CTweDMZf.js +198 -0
- package/system/dist/storage-location-mode-B21UVRRX.mjs +167 -0
- package/system/dist/storage-location-mode-CS4sMzo-.js +232 -0
- package/system/dist/storage-migration.cap-CyyATY_p.js +330 -0
- package/system/dist/storage-migration.cap-D7QqGobp.mjs +313 -0
- package/system/dist/storage-occupancy.cap-2rmnS58Z.js +622 -0
- package/system/dist/storage-occupancy.cap-CqBztTl9.mjs +611 -0
- package/system/dist/storage-provider.cap-Bw0CfxVc.js +213 -0
- package/system/dist/storage-provider.cap-CMeck2w4.mjs +202 -0
- package/system/dist/stream-catalog.cap-Bp7SkgIf.mjs +6560 -0
- package/system/dist/stream-catalog.cap-D3uwePiA.js +6763 -0
- package/system/dist/streaming-shared-B8cXatuU.mjs +431 -0
- package/system/dist/streaming-shared-DQwFZOSi.js +526 -0
- package/system/dist/system-reasons-Be_k1W8g.js +25 -0
- package/system/dist/system-reasons-CYj4qwyS.mjs +20 -0
- package/system/dist/tag-BxLazvVb.js +2138 -0
- package/system/dist/tag-uZBAq6ox.mjs +2073 -0
- package/system/dist/user-management.cap-B9QDu8NE.js +825 -0
- package/system/dist/user-management.cap-DBIi77sB.mjs +766 -0
- package/system/dist/vector-store.cap-DnyfrYDn.js +330 -0
- package/system/dist/vector-store.cap-h2GHWQ1t.mjs +319 -0
- package/system/dist/{wal-maintenance-CTrCPzds.mjs → wal-maintenance-BG01rOn9.mjs} +0 -0
- package/system/dist/{wal-maintenance-dq7T3quB.js → wal-maintenance-DyrebYKF.js} +0 -0
- package/system/dist/zod-secret-DS7mj1bk.js +78 -0
- package/system/dist/zod-secret-zY4nM61M.mjs +73 -0
- package/system/package.json +1 -1
- package/system/dist/composition-sources-BI614LJx.mjs +0 -141
- package/system/dist/composition-sources-v_kkb8A9.js +0 -152
- package/system/dist/coral-accelerators-BSVsBVzt.js +0 -250
- package/system/dist/coral-accelerators-DBlgWB8k.mjs +0 -231
- package/system/dist/dist-BCHMSqzc.mjs +0 -143467
- package/system/dist/dist-BZfvhfS1.js +0 -146970
- package/system/dist/prefix-walk-DAOBSyH1.mjs +0 -88
- package/system/dist/prefix-walk-Dv6MLZlM.js +0 -99
- package/system/dist/rename-composition-block-C9HuBrKS.js +0 -112
- package/system/dist/rename-composition-block-DtaYmYAR.mjs +0 -101
|
@@ -3,7 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
|
+
const require_metrics_provider_cap = require("../../metrics-provider.cap-BcmQUt6l.js");
|
|
7
9
|
let node_fs = require("node:fs");
|
|
8
10
|
node_fs = require_chunk.__toESM(node_fs);
|
|
9
11
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -11,6 +13,145 @@ let node_util = require("node:util");
|
|
|
11
13
|
let node_os = require("node:os");
|
|
12
14
|
node_os = require_chunk.__toESM(node_os);
|
|
13
15
|
let node_child_process = require("node:child_process");
|
|
16
|
+
//#region ../types/dist/esm/metrics/load-series-fold.mjs
|
|
17
|
+
/** Bucket key for rows no addon owns. Stable, so its series is continuous. */
|
|
18
|
+
var UNATTRIBUTED_BUCKET_KEY = "__unattributed__";
|
|
19
|
+
var ROOT_BUCKET_KEY = "__root__";
|
|
20
|
+
function bucketFor(row) {
|
|
21
|
+
if (row.addonId !== null) return {
|
|
22
|
+
key: row.addonId,
|
|
23
|
+
kind: "addon"
|
|
24
|
+
};
|
|
25
|
+
if (row.classification === "root") return {
|
|
26
|
+
key: ROOT_BUCKET_KEY,
|
|
27
|
+
kind: "root"
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
key: UNATTRIBUTED_BUCKET_KEY,
|
|
31
|
+
kind: "unattributed"
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/** Round to one decimal — the precision both producers already emit at. */
|
|
35
|
+
function deci(value) {
|
|
36
|
+
return Math.round(value * 10) / 10;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Fold one snapshot into one point per function.
|
|
40
|
+
*
|
|
41
|
+
* Produces a ONE-SAMPLE point: `min === max` on every field, `samples === 1`.
|
|
42
|
+
* That is what lets a live event and a reduced server bucket sit in the same
|
|
43
|
+
* series without the consumer knowing which is which.
|
|
44
|
+
*/
|
|
45
|
+
function foldSnapshotByFunction(rows, atMs) {
|
|
46
|
+
const acc = /* @__PURE__ */ new Map();
|
|
47
|
+
for (const row of rows) {
|
|
48
|
+
const { key, kind } = bucketFor(row);
|
|
49
|
+
const cur = acc.get(key) ?? {
|
|
50
|
+
kind,
|
|
51
|
+
main: 0,
|
|
52
|
+
gc: 0,
|
|
53
|
+
lifetime: 0,
|
|
54
|
+
memory: 0,
|
|
55
|
+
count: 0,
|
|
56
|
+
splitKnown: true
|
|
57
|
+
};
|
|
58
|
+
const known = row.cpuMainPercent !== null && row.cpuGcPercent !== null;
|
|
59
|
+
acc.set(key, {
|
|
60
|
+
kind: cur.kind,
|
|
61
|
+
main: cur.main + (row.cpuMainPercent ?? 0),
|
|
62
|
+
gc: cur.gc + (row.cpuGcPercent ?? 0),
|
|
63
|
+
lifetime: cur.lifetime + row.cpuPercent,
|
|
64
|
+
memory: cur.memory + row.memoryRssBytes,
|
|
65
|
+
count: cur.count + 1,
|
|
66
|
+
splitKnown: cur.splitKnown && known
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return [...acc.entries()].map(([key, a]) => {
|
|
70
|
+
const main = a.splitKnown ? deci(a.main) : null;
|
|
71
|
+
const gc = a.splitKnown ? deci(a.gc) : null;
|
|
72
|
+
const lifetime = deci(a.lifetime);
|
|
73
|
+
return {
|
|
74
|
+
key,
|
|
75
|
+
kind: a.kind,
|
|
76
|
+
point: {
|
|
77
|
+
atMs,
|
|
78
|
+
samples: 1,
|
|
79
|
+
cpuMainPercent: main,
|
|
80
|
+
cpuMainPercentMin: main,
|
|
81
|
+
cpuGcPercent: gc,
|
|
82
|
+
cpuGcPercentMin: gc,
|
|
83
|
+
cpuLifetimePercent: lifetime,
|
|
84
|
+
cpuLifetimePercentMin: lifetime,
|
|
85
|
+
memoryRssBytes: a.memory,
|
|
86
|
+
memoryRssBytesMin: a.memory,
|
|
87
|
+
processCount: a.count,
|
|
88
|
+
processCountMin: a.count
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/** The narrower of two bounds, treating `null` (UNKNOWN) as absorbing. */
|
|
94
|
+
function minNullable(a, b) {
|
|
95
|
+
if (a === null || b === null) return null;
|
|
96
|
+
return a < b ? a : b;
|
|
97
|
+
}
|
|
98
|
+
function maxNullable(a, b) {
|
|
99
|
+
if (a === null || b === null) return null;
|
|
100
|
+
return a > b ? a : b;
|
|
101
|
+
}
|
|
102
|
+
/** Merge `next` into `held`, keeping the widest [min, max] of each field. */
|
|
103
|
+
function mergePoints(held, next, atMs) {
|
|
104
|
+
return {
|
|
105
|
+
atMs,
|
|
106
|
+
samples: held.samples + next.samples,
|
|
107
|
+
cpuMainPercent: maxNullable(held.cpuMainPercent, next.cpuMainPercent),
|
|
108
|
+
cpuMainPercentMin: minNullable(held.cpuMainPercentMin, next.cpuMainPercentMin),
|
|
109
|
+
cpuGcPercent: maxNullable(held.cpuGcPercent, next.cpuGcPercent),
|
|
110
|
+
cpuGcPercentMin: minNullable(held.cpuGcPercentMin, next.cpuGcPercentMin),
|
|
111
|
+
cpuLifetimePercent: Math.max(held.cpuLifetimePercent, next.cpuLifetimePercent),
|
|
112
|
+
cpuLifetimePercentMin: Math.min(held.cpuLifetimePercentMin, next.cpuLifetimePercentMin),
|
|
113
|
+
memoryRssBytes: Math.max(held.memoryRssBytes, next.memoryRssBytes),
|
|
114
|
+
memoryRssBytesMin: Math.min(held.memoryRssBytesMin, next.memoryRssBytesMin),
|
|
115
|
+
processCount: Math.max(held.processCount, next.processCount),
|
|
116
|
+
processCountMin: Math.min(held.processCountMin, next.processCountMin)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The bucket width that brings `spanMs` down to at most `maxPoints` points,
|
|
121
|
+
* snapped up to a whole multiple of the sampling cadence.
|
|
122
|
+
*
|
|
123
|
+
* Returns `cadenceMs` (no reduction) when the span already fits. A caller that
|
|
124
|
+
* asks for a `maxPoints` of 0 or less gets no reduction rather than an
|
|
125
|
+
* infinite bucket — a nonsensical request must not produce a plausible chart.
|
|
126
|
+
*/
|
|
127
|
+
function resolveBucketMs(spanMs, cadenceMs, maxPoints) {
|
|
128
|
+
if (maxPoints <= 0 || cadenceMs <= 0 || spanMs <= 0) return Math.max(cadenceMs, 1);
|
|
129
|
+
const wanted = spanMs / maxPoints;
|
|
130
|
+
if (wanted <= cadenceMs) return cadenceMs;
|
|
131
|
+
return Math.ceil(wanted / cadenceMs) * cadenceMs;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Reduce one function's points into buckets of `bucketMs`, preserving the
|
|
135
|
+
* extremes.
|
|
136
|
+
*
|
|
137
|
+
* Points are expected oldest-first and are returned oldest-first. A bucket
|
|
138
|
+
* with no samples is ABSENT — not zero, not interpolated, not the previous
|
|
139
|
+
* value held over.
|
|
140
|
+
*/
|
|
141
|
+
function reducePoints(points, bucketMs, origin) {
|
|
142
|
+
if (bucketMs <= 0 || points.length === 0) return points;
|
|
143
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
144
|
+
for (const point of points) {
|
|
145
|
+
const start = origin + Math.floor((point.atMs - origin) / bucketMs) * bucketMs;
|
|
146
|
+
const held = buckets.get(start);
|
|
147
|
+
buckets.set(start, held === void 0 ? {
|
|
148
|
+
...point,
|
|
149
|
+
atMs: start
|
|
150
|
+
} : mergePoints(held, point, start));
|
|
151
|
+
}
|
|
152
|
+
return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
14
155
|
//#region src/builtins/native-metrics/cgroup-memory.ts
|
|
15
156
|
/** `readFileSync`, with every failure flattened to `null`. */
|
|
16
157
|
var nodeCgroupFileReader = { read(path) {
|
|
@@ -300,7 +441,7 @@ var ContainerMemoryProbe = class {
|
|
|
300
441
|
this.layout = resolveCgroupMemoryLayout(this.fs);
|
|
301
442
|
} catch (err) {
|
|
302
443
|
this.layout = null;
|
|
303
|
-
this.logger.warn("cgroup memory resolution failed — container memory will be ABSENT", { meta: { error:
|
|
444
|
+
this.logger.warn("cgroup memory resolution failed — container memory will be ABSENT", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
304
445
|
return null;
|
|
305
446
|
}
|
|
306
447
|
if (this.layout === null) {
|
|
@@ -494,7 +635,7 @@ var ContainerPidsProbe = class {
|
|
|
494
635
|
this.layout = resolveCgroupPidsLayout(this.fs);
|
|
495
636
|
} catch (err) {
|
|
496
637
|
this.layout = null;
|
|
497
|
-
this.logger.warn("cgroup pids resolution failed — the pid ceiling will be ABSENT", { meta: { error:
|
|
638
|
+
this.logger.warn("cgroup pids resolution failed — the pid ceiling will be ABSENT", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
498
639
|
return null;
|
|
499
640
|
}
|
|
500
641
|
if (this.layout === null) {
|
|
@@ -989,7 +1130,7 @@ function mergeLoadSeries(input) {
|
|
|
989
1130
|
oldestAtMs: null
|
|
990
1131
|
};
|
|
991
1132
|
const byKey = /* @__PURE__ */ new Map();
|
|
992
|
-
for (const sample of samples) for (const bucket of
|
|
1133
|
+
for (const sample of samples) for (const bucket of foldSnapshotByFunction(toFoldRows(sample.processes), sample.atMs)) {
|
|
993
1134
|
const held = byKey.get(bucket.key);
|
|
994
1135
|
if (held === void 0) byKey.set(bucket.key, {
|
|
995
1136
|
kind: bucket.kind,
|
|
@@ -1000,12 +1141,12 @@ function mergeLoadSeries(input) {
|
|
|
1000
1141
|
const oldestAtMs = samples[0]?.atMs ?? null;
|
|
1001
1142
|
const newestAtMs = samples.at(-1)?.atMs ?? oldestAtMs;
|
|
1002
1143
|
const spanMs = oldestAtMs === null || newestAtMs === null ? 0 : newestAtMs - oldestAtMs + input.cadenceMs;
|
|
1003
|
-
const bucketMs = input.maxPoints === void 0 ? input.cadenceMs :
|
|
1144
|
+
const bucketMs = input.maxPoints === void 0 ? input.cadenceMs : resolveBucketMs(spanMs, input.cadenceMs, input.maxPoints);
|
|
1004
1145
|
const origin = oldestAtMs ?? 0;
|
|
1005
1146
|
const series = [...byKey.entries()].map(([key, held]) => ({
|
|
1006
1147
|
key,
|
|
1007
1148
|
kind: held.kind,
|
|
1008
|
-
points: bucketMs > input.cadenceMs ?
|
|
1149
|
+
points: bucketMs > input.cadenceMs ? reducePoints(held.points, bucketMs, origin) : held.points
|
|
1009
1150
|
}));
|
|
1010
1151
|
const weight = (s) => {
|
|
1011
1152
|
const last = s.points.at(-1);
|
|
@@ -1174,7 +1315,7 @@ function refusalCounts(result) {
|
|
|
1174
1315
|
/** The fold's function key of a process: the same rule as `foldSnapshotByFunction`. */
|
|
1175
1316
|
function runnerScopeOf(process) {
|
|
1176
1317
|
if (process.addonId !== null) return process.addonId;
|
|
1177
|
-
return process.classification === "root" ?
|
|
1318
|
+
return process.classification === "root" ? ROOT_BUCKET_KEY : UNATTRIBUTED_BUCKET_KEY;
|
|
1178
1319
|
}
|
|
1179
1320
|
function round1(value) {
|
|
1180
1321
|
return Math.round(value * 10) / 10;
|
|
@@ -1406,8 +1547,8 @@ function assembleRunnerSamples(answers) {
|
|
|
1406
1547
|
const m = main.get(atMs)?.get(scope);
|
|
1407
1548
|
const g = gc.get(atMs)?.get(scope);
|
|
1408
1549
|
const split = m !== void 0 && g !== void 0;
|
|
1409
|
-
const isRoot = scope ===
|
|
1410
|
-
const isUnattributed = scope ===
|
|
1550
|
+
const isRoot = scope === ROOT_BUCKET_KEY;
|
|
1551
|
+
const isUnattributed = scope === UNATTRIBUTED_BUCKET_KEY;
|
|
1411
1552
|
for (let i = 0; i < n; i += 1) processes.push({
|
|
1412
1553
|
pid: 0,
|
|
1413
1554
|
addonId: isRoot || isUnattributed ? null : scope,
|
|
@@ -2502,7 +2643,7 @@ function narrowWorkerState(state) {
|
|
|
2502
2643
|
* Native metrics — CPU, memory, disk usage sampling.
|
|
2503
2644
|
* Settings appear under Cluster → NodeDetail → Settings.
|
|
2504
2645
|
*/
|
|
2505
|
-
var NativeMetricsAddon = class NativeMetricsAddon extends
|
|
2646
|
+
var NativeMetricsAddon = class NativeMetricsAddon extends require_base_addon.BaseAddon {
|
|
2506
2647
|
provider = null;
|
|
2507
2648
|
startedAtMs = Date.now();
|
|
2508
2649
|
snapshotTimer = null;
|
|
@@ -2649,13 +2790,13 @@ var NativeMetricsAddon = class NativeMetricsAddon extends require_dist.BaseAddon
|
|
|
2649
2790
|
this.startProcessSnapshotTimer();
|
|
2650
2791
|
if (this.metricsHistory !== null) {
|
|
2651
2792
|
const history = this.metricsHistory;
|
|
2652
|
-
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category:
|
|
2793
|
+
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category: require_base_addon.EventCategory.MetricsNodeResourcesSnapshot }, (event) => {
|
|
2653
2794
|
history.recordTotals(event.data.nodeId, event.data.timestamp, event.data.snapshot);
|
|
2654
2795
|
}));
|
|
2655
2796
|
}
|
|
2656
|
-
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category:
|
|
2797
|
+
this.ctx.addDisposer(this.ctx.eventBus.subscribe({ category: require_base_addon.EventCategory.MetricsNodeProcessesSnapshot }, (event) => this.retainSnapshot(event.data.nodeId, event.data.timestamp, event.data.processes, event.data.containerMemory)));
|
|
2657
2798
|
return [{
|
|
2658
|
-
capability:
|
|
2799
|
+
capability: require_metrics_provider_cap.metricsProviderCapability,
|
|
2659
2800
|
provider: composed
|
|
2660
2801
|
}];
|
|
2661
2802
|
}
|
|
@@ -2872,7 +3013,7 @@ var NativeMetricsAddon = class NativeMetricsAddon extends require_dist.BaseAddon
|
|
|
2872
3013
|
coarse,
|
|
2873
3014
|
emittedAt: timestamp
|
|
2874
3015
|
};
|
|
2875
|
-
eventBus.emit(
|
|
3016
|
+
eventBus.emit(require_base_addon.createEvent(require_base_addon.EventCategory.MetricsNodeResourcesSnapshot, {
|
|
2876
3017
|
type: "node",
|
|
2877
3018
|
id: nodeId,
|
|
2878
3019
|
nodeId
|
|
@@ -2910,7 +3051,7 @@ var NativeMetricsAddon = class NativeMetricsAddon extends require_dist.BaseAddon
|
|
|
2910
3051
|
}
|
|
2911
3052
|
const containerMemory = this.memoryProbe?.sample() ?? null;
|
|
2912
3053
|
this.pidsProbe?.sample();
|
|
2913
|
-
eventBus.emit(
|
|
3054
|
+
eventBus.emit(require_base_addon.createEvent(require_base_addon.EventCategory.MetricsNodeProcessesSnapshot, {
|
|
2914
3055
|
type: "node",
|
|
2915
3056
|
id: nodeId,
|
|
2916
3057
|
nodeId
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as EventCategory, p as createEvent, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
2
|
+
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
3
|
+
import { t as metricsProviderCapability } from "../../metrics-provider.cap-BNmcHDkQ.mjs";
|
|
2
4
|
import * as fs$1 from "node:fs";
|
|
3
5
|
import { constants, readFileSync } from "node:fs";
|
|
4
6
|
import { access, readFile, readdir } from "node:fs/promises";
|
|
@@ -6,6 +8,145 @@ import { promisify } from "node:util";
|
|
|
6
8
|
import * as os$1 from "node:os";
|
|
7
9
|
import { platform } from "node:os";
|
|
8
10
|
import { execFile } from "node:child_process";
|
|
11
|
+
//#region ../types/dist/esm/metrics/load-series-fold.mjs
|
|
12
|
+
/** Bucket key for rows no addon owns. Stable, so its series is continuous. */
|
|
13
|
+
var UNATTRIBUTED_BUCKET_KEY = "__unattributed__";
|
|
14
|
+
var ROOT_BUCKET_KEY = "__root__";
|
|
15
|
+
function bucketFor(row) {
|
|
16
|
+
if (row.addonId !== null) return {
|
|
17
|
+
key: row.addonId,
|
|
18
|
+
kind: "addon"
|
|
19
|
+
};
|
|
20
|
+
if (row.classification === "root") return {
|
|
21
|
+
key: ROOT_BUCKET_KEY,
|
|
22
|
+
kind: "root"
|
|
23
|
+
};
|
|
24
|
+
return {
|
|
25
|
+
key: UNATTRIBUTED_BUCKET_KEY,
|
|
26
|
+
kind: "unattributed"
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/** Round to one decimal — the precision both producers already emit at. */
|
|
30
|
+
function deci(value) {
|
|
31
|
+
return Math.round(value * 10) / 10;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Fold one snapshot into one point per function.
|
|
35
|
+
*
|
|
36
|
+
* Produces a ONE-SAMPLE point: `min === max` on every field, `samples === 1`.
|
|
37
|
+
* That is what lets a live event and a reduced server bucket sit in the same
|
|
38
|
+
* series without the consumer knowing which is which.
|
|
39
|
+
*/
|
|
40
|
+
function foldSnapshotByFunction(rows, atMs) {
|
|
41
|
+
const acc = /* @__PURE__ */ new Map();
|
|
42
|
+
for (const row of rows) {
|
|
43
|
+
const { key, kind } = bucketFor(row);
|
|
44
|
+
const cur = acc.get(key) ?? {
|
|
45
|
+
kind,
|
|
46
|
+
main: 0,
|
|
47
|
+
gc: 0,
|
|
48
|
+
lifetime: 0,
|
|
49
|
+
memory: 0,
|
|
50
|
+
count: 0,
|
|
51
|
+
splitKnown: true
|
|
52
|
+
};
|
|
53
|
+
const known = row.cpuMainPercent !== null && row.cpuGcPercent !== null;
|
|
54
|
+
acc.set(key, {
|
|
55
|
+
kind: cur.kind,
|
|
56
|
+
main: cur.main + (row.cpuMainPercent ?? 0),
|
|
57
|
+
gc: cur.gc + (row.cpuGcPercent ?? 0),
|
|
58
|
+
lifetime: cur.lifetime + row.cpuPercent,
|
|
59
|
+
memory: cur.memory + row.memoryRssBytes,
|
|
60
|
+
count: cur.count + 1,
|
|
61
|
+
splitKnown: cur.splitKnown && known
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return [...acc.entries()].map(([key, a]) => {
|
|
65
|
+
const main = a.splitKnown ? deci(a.main) : null;
|
|
66
|
+
const gc = a.splitKnown ? deci(a.gc) : null;
|
|
67
|
+
const lifetime = deci(a.lifetime);
|
|
68
|
+
return {
|
|
69
|
+
key,
|
|
70
|
+
kind: a.kind,
|
|
71
|
+
point: {
|
|
72
|
+
atMs,
|
|
73
|
+
samples: 1,
|
|
74
|
+
cpuMainPercent: main,
|
|
75
|
+
cpuMainPercentMin: main,
|
|
76
|
+
cpuGcPercent: gc,
|
|
77
|
+
cpuGcPercentMin: gc,
|
|
78
|
+
cpuLifetimePercent: lifetime,
|
|
79
|
+
cpuLifetimePercentMin: lifetime,
|
|
80
|
+
memoryRssBytes: a.memory,
|
|
81
|
+
memoryRssBytesMin: a.memory,
|
|
82
|
+
processCount: a.count,
|
|
83
|
+
processCountMin: a.count
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/** The narrower of two bounds, treating `null` (UNKNOWN) as absorbing. */
|
|
89
|
+
function minNullable(a, b) {
|
|
90
|
+
if (a === null || b === null) return null;
|
|
91
|
+
return a < b ? a : b;
|
|
92
|
+
}
|
|
93
|
+
function maxNullable(a, b) {
|
|
94
|
+
if (a === null || b === null) return null;
|
|
95
|
+
return a > b ? a : b;
|
|
96
|
+
}
|
|
97
|
+
/** Merge `next` into `held`, keeping the widest [min, max] of each field. */
|
|
98
|
+
function mergePoints(held, next, atMs) {
|
|
99
|
+
return {
|
|
100
|
+
atMs,
|
|
101
|
+
samples: held.samples + next.samples,
|
|
102
|
+
cpuMainPercent: maxNullable(held.cpuMainPercent, next.cpuMainPercent),
|
|
103
|
+
cpuMainPercentMin: minNullable(held.cpuMainPercentMin, next.cpuMainPercentMin),
|
|
104
|
+
cpuGcPercent: maxNullable(held.cpuGcPercent, next.cpuGcPercent),
|
|
105
|
+
cpuGcPercentMin: minNullable(held.cpuGcPercentMin, next.cpuGcPercentMin),
|
|
106
|
+
cpuLifetimePercent: Math.max(held.cpuLifetimePercent, next.cpuLifetimePercent),
|
|
107
|
+
cpuLifetimePercentMin: Math.min(held.cpuLifetimePercentMin, next.cpuLifetimePercentMin),
|
|
108
|
+
memoryRssBytes: Math.max(held.memoryRssBytes, next.memoryRssBytes),
|
|
109
|
+
memoryRssBytesMin: Math.min(held.memoryRssBytesMin, next.memoryRssBytesMin),
|
|
110
|
+
processCount: Math.max(held.processCount, next.processCount),
|
|
111
|
+
processCountMin: Math.min(held.processCountMin, next.processCountMin)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* The bucket width that brings `spanMs` down to at most `maxPoints` points,
|
|
116
|
+
* snapped up to a whole multiple of the sampling cadence.
|
|
117
|
+
*
|
|
118
|
+
* Returns `cadenceMs` (no reduction) when the span already fits. A caller that
|
|
119
|
+
* asks for a `maxPoints` of 0 or less gets no reduction rather than an
|
|
120
|
+
* infinite bucket — a nonsensical request must not produce a plausible chart.
|
|
121
|
+
*/
|
|
122
|
+
function resolveBucketMs(spanMs, cadenceMs, maxPoints) {
|
|
123
|
+
if (maxPoints <= 0 || cadenceMs <= 0 || spanMs <= 0) return Math.max(cadenceMs, 1);
|
|
124
|
+
const wanted = spanMs / maxPoints;
|
|
125
|
+
if (wanted <= cadenceMs) return cadenceMs;
|
|
126
|
+
return Math.ceil(wanted / cadenceMs) * cadenceMs;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Reduce one function's points into buckets of `bucketMs`, preserving the
|
|
130
|
+
* extremes.
|
|
131
|
+
*
|
|
132
|
+
* Points are expected oldest-first and are returned oldest-first. A bucket
|
|
133
|
+
* with no samples is ABSENT — not zero, not interpolated, not the previous
|
|
134
|
+
* value held over.
|
|
135
|
+
*/
|
|
136
|
+
function reducePoints(points, bucketMs, origin) {
|
|
137
|
+
if (bucketMs <= 0 || points.length === 0) return points;
|
|
138
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
139
|
+
for (const point of points) {
|
|
140
|
+
const start = origin + Math.floor((point.atMs - origin) / bucketMs) * bucketMs;
|
|
141
|
+
const held = buckets.get(start);
|
|
142
|
+
buckets.set(start, held === void 0 ? {
|
|
143
|
+
...point,
|
|
144
|
+
atMs: start
|
|
145
|
+
} : mergePoints(held, point, start));
|
|
146
|
+
}
|
|
147
|
+
return [...buckets.values()].toSorted((a, b) => a.atMs - b.atMs);
|
|
148
|
+
}
|
|
149
|
+
//#endregion
|
|
9
150
|
//#region src/builtins/native-metrics/cgroup-memory.ts
|
|
10
151
|
/** `readFileSync`, with every failure flattened to `null`. */
|
|
11
152
|
var nodeCgroupFileReader = { read(path) {
|
|
@@ -3,8 +3,10 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
const require_chunk = require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
|
+
const require_platform_probe_cap = require("../../platform-probe.cap-1WrMhWHx.js");
|
|
9
|
+
const require_coral_accelerators = require("../../coral-accelerators-7o8hqvcN.js");
|
|
8
10
|
let node_fs = require("node:fs");
|
|
9
11
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
12
|
let node_path = require("node:path");
|
|
@@ -47,13 +49,13 @@ function withCoral(caps, coral) {
|
|
|
47
49
|
...caps.hardware,
|
|
48
50
|
coral
|
|
49
51
|
};
|
|
50
|
-
const { scores, best } =
|
|
52
|
+
const { scores, best } = require_coral_accelerators.scoreRuntimes(hardware);
|
|
51
53
|
return {
|
|
52
54
|
...caps,
|
|
53
55
|
hardware,
|
|
54
56
|
scores: [...scores],
|
|
55
57
|
bestScore: best,
|
|
56
|
-
devices:
|
|
58
|
+
devices: require_coral_accelerators.enumerateInferenceDevices(hardware)
|
|
57
59
|
};
|
|
58
60
|
}
|
|
59
61
|
//#endregion
|
|
@@ -347,7 +349,7 @@ async function getAvailableRAM_MB() {
|
|
|
347
349
|
const mem = await (await Promise.resolve().then(() => /* @__PURE__ */ require_chunk.__toESM(require("../../lib-CZ3g2WTS.js").default))).mem();
|
|
348
350
|
return Math.round(mem.available / 1024 / 1024);
|
|
349
351
|
} catch (err) {
|
|
350
|
-
console.debug(`systeminformation not available, using platform-specific RAM probe: ${
|
|
352
|
+
console.debug(`systeminformation not available, using platform-specific RAM probe: ${require_scoped_settings.errMsg(err)}`);
|
|
351
353
|
const platform = node_os.platform();
|
|
352
354
|
try {
|
|
353
355
|
if (platform === "darwin") {
|
|
@@ -366,7 +368,7 @@ async function getAvailableRAM_MB() {
|
|
|
366
368
|
if (match) return Math.round(parseInt(match[1]) / 1024);
|
|
367
369
|
}
|
|
368
370
|
} catch (probeErr) {
|
|
369
|
-
console.debug(`RAM probe failed, using total RAM fallback: ${
|
|
371
|
+
console.debug(`RAM probe failed, using total RAM fallback: ${require_scoped_settings.errMsg(probeErr)}`);
|
|
370
372
|
}
|
|
371
373
|
return Math.round(node_os.totalmem() / 1024 / 1024);
|
|
372
374
|
}
|
|
@@ -425,7 +427,7 @@ var PlatformScorer = class {
|
|
|
425
427
|
if (hardware.gpu) this.logger.info("GPU detected", { meta: { name: hardware.gpu.name } });
|
|
426
428
|
if (hardware.npu) this.logger.info("NPU detected", { meta: { type: hardware.npu.type } });
|
|
427
429
|
onPhase?.("hardware", { hardware });
|
|
428
|
-
const { scores, best: bestScore } =
|
|
430
|
+
const { scores, best: bestScore } = require_coral_accelerators.scoreRuntimes(hardware);
|
|
429
431
|
const pythonPath = await this.resolvePythonPath();
|
|
430
432
|
if (pythonPath) this.logger.info("Python interpreter located", { meta: { pythonPath } });
|
|
431
433
|
else this.logger.info("Python: not found");
|
|
@@ -454,7 +456,7 @@ var PlatformScorer = class {
|
|
|
454
456
|
scores: [...scores],
|
|
455
457
|
bestScore,
|
|
456
458
|
pythonPath,
|
|
457
|
-
devices:
|
|
459
|
+
devices: require_coral_accelerators.enumerateInferenceDevices(hardware)
|
|
458
460
|
};
|
|
459
461
|
onPhase?.("scored", {
|
|
460
462
|
scores,
|
|
@@ -616,7 +618,7 @@ var PlatformScorer = class {
|
|
|
616
618
|
this.logger.info("accelerator compute probed", { meta: { devices: facts.map((row) => row.deviceKey) } });
|
|
617
619
|
return facts;
|
|
618
620
|
} catch (err) {
|
|
619
|
-
this.logger.warn("accelerator compute probe failed", { meta: { error:
|
|
621
|
+
this.logger.warn("accelerator compute probe failed", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
620
622
|
return null;
|
|
621
623
|
}
|
|
622
624
|
}
|
|
@@ -688,7 +690,7 @@ var PlatformScorer = class {
|
|
|
688
690
|
* way an unusable Coral is: silence would read as "no NVIDIA".
|
|
689
691
|
*/
|
|
690
692
|
describeNvidiaSlot(probe) {
|
|
691
|
-
const nvidia =
|
|
693
|
+
const nvidia = require_coral_accelerators.describeNvidia(probe, null);
|
|
692
694
|
if (nvidia.usable) this.logger.info("NVIDIA GPU detected", { meta: { name: nvidia.name } });
|
|
693
695
|
else this.logger.warn("NVIDIA GPU present but not usable", { meta: {
|
|
694
696
|
name: nvidia.name,
|
|
@@ -713,7 +715,7 @@ var PlatformScorer = class {
|
|
|
713
715
|
memoryMB: parseInt(mem ?? "0")
|
|
714
716
|
};
|
|
715
717
|
} catch (err) {
|
|
716
|
-
this.logger.debug("NVIDIA GPU detection failed", { meta: { error:
|
|
718
|
+
this.logger.debug("NVIDIA GPU detection failed", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
717
719
|
return null;
|
|
718
720
|
}
|
|
719
721
|
}
|
|
@@ -735,7 +737,7 @@ var PlatformScorer = class {
|
|
|
735
737
|
onFallback: (reason) => this.logger.warn("Windows hardware probe degraded", { meta: { reason } })
|
|
736
738
|
});
|
|
737
739
|
} catch (err) {
|
|
738
|
-
this.logger.warn("Windows hardware probe failed — scoring as a CPU node", { meta: { error:
|
|
740
|
+
this.logger.warn("Windows hardware probe failed — scoring as a CPU node", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
739
741
|
return {
|
|
740
742
|
gpu: null,
|
|
741
743
|
nvidia: null,
|
|
@@ -761,7 +763,7 @@ var PlatformScorer = class {
|
|
|
761
763
|
await execFileAsync$1(cmd, ["--version"], { timeout: 5e3 });
|
|
762
764
|
return cmd;
|
|
763
765
|
} catch (err) {
|
|
764
|
-
this.logger.debug(`Python command "${cmd}" not found`, { meta: { error:
|
|
766
|
+
this.logger.debug(`Python command "${cmd}" not found`, { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
765
767
|
}
|
|
766
768
|
return null;
|
|
767
769
|
}
|
|
@@ -883,7 +885,7 @@ function readPublishedAcceleratorFacts(filePath) {
|
|
|
883
885
|
return null;
|
|
884
886
|
}
|
|
885
887
|
try {
|
|
886
|
-
return
|
|
888
|
+
return require_platform_probe_cap.parseAcceleratorFactsJson(jsonValue(text));
|
|
887
889
|
} catch {
|
|
888
890
|
return null;
|
|
889
891
|
}
|
|
@@ -912,7 +914,7 @@ async function runAcceleratorFactsProbe(input) {
|
|
|
912
914
|
if (input.pythonPath === null || input.scriptPath === null) return null;
|
|
913
915
|
const exec = input.exec ?? defaultExec;
|
|
914
916
|
try {
|
|
915
|
-
return
|
|
917
|
+
return require_platform_probe_cap.parseAcceleratorFactsJson(jsonValue(await exec(input.pythonPath, [input.scriptPath], input.timeoutMs ?? 8e3)));
|
|
916
918
|
} catch {
|
|
917
919
|
return null;
|
|
918
920
|
}
|
|
@@ -949,7 +951,7 @@ function narrowHwAccelPrefer(value) {
|
|
|
949
951
|
}
|
|
950
952
|
/** How often the accelerator part of the probe is re-run (D919). Cheap: `/sys` + `/dev` reads. */
|
|
951
953
|
var ACCELERATOR_REPROBE_INTERVAL_MS = 6e4;
|
|
952
|
-
var PlatformProbeNativeAddon = class extends
|
|
954
|
+
var PlatformProbeNativeAddon = class extends require_base_addon.BaseAddon {
|
|
953
955
|
scorer = null;
|
|
954
956
|
cachedCaps = null;
|
|
955
957
|
/** The periodic accelerator re-probe; started once the full probe completed. */
|
|
@@ -988,8 +990,8 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
988
990
|
if (!ctx) return;
|
|
989
991
|
const nodeId = this.bareLocalNodeId();
|
|
990
992
|
try {
|
|
991
|
-
|
|
992
|
-
capName:
|
|
993
|
+
require_base_addon.emitReadiness(ctx.eventBus, {
|
|
994
|
+
capName: require_platform_probe_cap.platformProbeCapability.name,
|
|
993
995
|
scope: {
|
|
994
996
|
type: "node",
|
|
995
997
|
nodeId
|
|
@@ -1003,7 +1005,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
1003
1005
|
async onInitialize() {
|
|
1004
1006
|
this.emitProbeReadiness("starting");
|
|
1005
1007
|
const embeddedPython = await this.ctx.deps.ensurePython().catch((err) => {
|
|
1006
|
-
this.ctx.logger.debug("ensurePython unavailable for platform probe", { meta: { error:
|
|
1008
|
+
this.ctx.logger.debug("ensurePython unavailable for platform probe", { meta: { error: require_scoped_settings.errMsg(err) } });
|
|
1007
1009
|
return null;
|
|
1008
1010
|
});
|
|
1009
1011
|
const factsScript = findAcceleratorFactsScript(this.ctx.dataDir);
|
|
@@ -1019,7 +1021,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
1019
1021
|
type: "core",
|
|
1020
1022
|
id: "platform-probe-native"
|
|
1021
1023
|
},
|
|
1022
|
-
category:
|
|
1024
|
+
category: require_base_addon.EventCategory.PlatformProbePhase,
|
|
1023
1025
|
data: {
|
|
1024
1026
|
type: "platform-probe.phase",
|
|
1025
1027
|
phase,
|
|
@@ -1041,7 +1043,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
1041
1043
|
this.startAcceleratorReprobe();
|
|
1042
1044
|
return caps;
|
|
1043
1045
|
}).catch((err) => {
|
|
1044
|
-
const msg =
|
|
1046
|
+
const msg = require_scoped_settings.errMsg(err);
|
|
1045
1047
|
this.ctx.logger.error("Platform probe failed", { meta: { error: msg } });
|
|
1046
1048
|
emitPhase("error", { message: msg });
|
|
1047
1049
|
throw err;
|
|
@@ -1050,7 +1052,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
1050
1052
|
return this.cachedCaps ?? probePromise;
|
|
1051
1053
|
};
|
|
1052
1054
|
return [{
|
|
1053
|
-
capability:
|
|
1055
|
+
capability: require_platform_probe_cap.platformProbeCapability,
|
|
1054
1056
|
provider: {
|
|
1055
1057
|
getCapabilities: async () => {
|
|
1056
1058
|
return getCaps();
|
|
@@ -1116,7 +1118,7 @@ var PlatformProbeNativeAddon = class extends require_dist.BaseAddon {
|
|
|
1116
1118
|
meta: {
|
|
1117
1119
|
nodeId: this.bareLocalNodeId(),
|
|
1118
1120
|
trigger,
|
|
1119
|
-
error:
|
|
1121
|
+
error: require_scoped_settings.errMsg(err)
|
|
1120
1122
|
}
|
|
1121
1123
|
});
|
|
1122
1124
|
return null;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { o as __toESM, r as __exportAll } from "../../chunk-CNf5ZN-e.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { b as EventCategory, m as emitReadiness, t as BaseAddon } from "../../base-addon-Md14i7pe.mjs";
|
|
3
|
+
import { Z as errMsg } from "../../scoped-settings-DVWUIP7Z.mjs";
|
|
4
|
+
import { n as parseAcceleratorFactsJson, t as platformProbeCapability } from "../../platform-probe.cap-BFeqFLtQ.mjs";
|
|
5
|
+
import { a as enumerateInferenceDevices, i as describeNvidia, n as detectCoralAccelerator, o as scoreRuntimes, r as nodeCoralFs } from "../../coral-accelerators-BKcXP59c.mjs";
|
|
4
6
|
import * as fs$1 from "node:fs";
|
|
5
7
|
import * as path$1 from "node:path";
|
|
6
8
|
import { promisify } from "node:util";
|
|
@@ -3,7 +3,9 @@ Object.defineProperties(exports, {
|
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
5
|
require("../../chunk-Cek0wNdY.js");
|
|
6
|
-
const
|
|
6
|
+
const require_base_addon = require("../../base-addon-DD5dIfcZ.js");
|
|
7
|
+
const require_scoped_settings = require("../../scoped-settings-CylSSq_8.js");
|
|
8
|
+
const require_record_entries_cap = require("../../record-entries.cap-ti1C046R.js");
|
|
7
9
|
let zod = require("zod");
|
|
8
10
|
let node_crypto = require("node:crypto");
|
|
9
11
|
//#region src/builtins/record-entries/entries-service.ts
|
|
@@ -30,12 +32,12 @@ var EntriesService = class {
|
|
|
30
32
|
}
|
|
31
33
|
async entryKind(owner, kind) {
|
|
32
34
|
const found = (await this.deps.listKinds(false)).find((k) => k.owner === owner && k.kind === kind && k.declaration.entry !== void 0);
|
|
33
|
-
if (found === void 0) throw new
|
|
35
|
+
if (found === void 0) throw new require_scoped_settings.UnknownRecordKindError(`"${owner}" declared no entry kind "${kind}"`);
|
|
34
36
|
return found;
|
|
35
37
|
}
|
|
36
38
|
definitionOf(info) {
|
|
37
39
|
const entry = info.declaration.entry;
|
|
38
|
-
if (entry === void 0) throw new
|
|
40
|
+
if (entry === void 0) throw new require_scoped_settings.UnknownRecordKindError(`"${info.kind}" is not an entry kind`);
|
|
39
41
|
const body = zod.z.fromJSONSchema(entry.fields);
|
|
40
42
|
const schema = zod.z.custom((value) => isRecord(value) && body.safeParse(value).success, { message: "the entry does not match the kind's schema" });
|
|
41
43
|
return {
|
|
@@ -77,11 +79,11 @@ var EntriesService = class {
|
|
|
77
79
|
name: typeof name === "string" ? name : row.id,
|
|
78
80
|
rev: row.rev,
|
|
79
81
|
updatedAt: row.updatedAt,
|
|
80
|
-
data:
|
|
82
|
+
data: require_base_addon.secretViewsOf(input.owner, input.kind, row.id, info.declaration, row.data)
|
|
81
83
|
});
|
|
82
84
|
}
|
|
83
85
|
cursor = page.nextCursor ?? void 0;
|
|
84
|
-
if (entries.length > 2e3) throw new
|
|
86
|
+
if (entries.length > 2e3) throw new require_scoped_settings.InvalidRecordError(`${input.kind}: more than ${ENTRIES_LIST_MAX} entries`);
|
|
85
87
|
} while (cursor !== void 0);
|
|
86
88
|
return { entries };
|
|
87
89
|
}
|
|
@@ -112,7 +114,7 @@ var EntriesService = class {
|
|
|
112
114
|
* records door, which only a hub in-process system builtin may do
|
|
113
115
|
* (`ctx.records.forOwner`, `ctx.secrets.forOwner`).
|
|
114
116
|
*/
|
|
115
|
-
var RecordEntriesAddon = class extends
|
|
117
|
+
var RecordEntriesAddon = class extends require_base_addon.BaseAddon {
|
|
116
118
|
id = "record-entries";
|
|
117
119
|
constructor() {
|
|
118
120
|
super({});
|
|
@@ -127,7 +129,7 @@ var RecordEntriesAddon = class extends require_dist.BaseAddon {
|
|
|
127
129
|
recordsFor: (owner) => forOwner(owner)
|
|
128
130
|
});
|
|
129
131
|
return [{
|
|
130
|
-
capability:
|
|
132
|
+
capability: require_record_entries_cap.recordEntriesCapability,
|
|
131
133
|
provider: {
|
|
132
134
|
listEntryKinds: () => service.listEntryKinds(),
|
|
133
135
|
listEntries: (input) => service.listEntries(input),
|