@proagentstore/cli 0.4.70 → 0.4.71
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/index.js +17 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1204,6 +1204,21 @@ async function waitForLocalRunner(opts, timeoutMs = 15e3) {
|
|
|
1204
1204
|
// src/commands/runner/relay.ts
|
|
1205
1205
|
import { hostname as hostname3 } from "os";
|
|
1206
1206
|
|
|
1207
|
+
// src/commands/runner/resources.ts
|
|
1208
|
+
import os from "os";
|
|
1209
|
+
function sampleResources(read = os, now = Date.now()) {
|
|
1210
|
+
const [l1 = 0, l5 = 0, l15 = 0] = read.loadavg();
|
|
1211
|
+
return {
|
|
1212
|
+
loadAvg: [l1, l5, l15],
|
|
1213
|
+
// `availableParallelism` would be better, but `cpus()` is what every supported Node has.
|
|
1214
|
+
cpus: Math.max(1, read.cpus().length),
|
|
1215
|
+
memTotalBytes: read.totalmem(),
|
|
1216
|
+
memFreeBytes: read.freemem(),
|
|
1217
|
+
platform: read.platform(),
|
|
1218
|
+
sampledAt: now
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1207
1222
|
// src/commands/runner/self-update.ts
|
|
1208
1223
|
import { execFile, spawn as spawn3 } from "child_process";
|
|
1209
1224
|
import { promisify } from "util";
|
|
@@ -1544,9 +1559,10 @@ async function connectViaRelay(instanceIds, localUrl, runnerToken, opts, force =
|
|
|
1544
1559
|
const heartbeat = () => {
|
|
1545
1560
|
const timer = setTimeout(async () => {
|
|
1546
1561
|
let failure = null;
|
|
1562
|
+
const resources = sampleResources();
|
|
1547
1563
|
for (const id of [...attached.keys()]) {
|
|
1548
1564
|
try {
|
|
1549
|
-
await requestPags("POST", `/v1/instances/${apiPathSegment(id)}/runtime/heartbeat`, opts, { runnerNode });
|
|
1565
|
+
await requestPags("POST", `/v1/instances/${apiPathSegment(id)}/runtime/heartbeat`, opts, { runnerNode, resources });
|
|
1550
1566
|
} catch (e) {
|
|
1551
1567
|
failure = e instanceof Error ? e.message : String(e);
|
|
1552
1568
|
}
|