open-agents-ai 0.105.1 → 0.105.3
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 +56 -59
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12682,8 +12682,7 @@ async function handleCmd(cmd) {
|
|
|
12682
12682
|
if (riEvt.event === 'token' && riEvt.data) {
|
|
12683
12683
|
var tkn = typeof riEvt.data === 'string' ? riEvt.data : String(riEvt.data);
|
|
12684
12684
|
riTokenContent += tkn;
|
|
12685
|
-
appendFileSync(riStreamFile, JSON.stringify({ type: 'token', content: tkn }) + '
|
|
12686
|
-
');
|
|
12685
|
+
appendFileSync(riStreamFile, JSON.stringify({ type: 'token', content: tkn }) + '\\n');
|
|
12687
12686
|
} else if (riEvt.event === 'result' && riEvt.data) {
|
|
12688
12687
|
// Final metadata event \u2014 parse for usage/tool_calls
|
|
12689
12688
|
try {
|
|
@@ -12714,8 +12713,7 @@ async function handleCmd(cmd) {
|
|
|
12714
12713
|
}],
|
|
12715
12714
|
usage: { input_tokens: riInputTokens, output_tokens: riOutputTokens },
|
|
12716
12715
|
};
|
|
12717
|
-
appendFileSync(riStreamFile, JSON.stringify({ type: 'done', result: JSON.stringify(riFinalPayload) }) + '
|
|
12718
|
-
');
|
|
12716
|
+
appendFileSync(riStreamFile, JSON.stringify({ type: 'done', result: JSON.stringify(riFinalPayload) }) + '\\n');
|
|
12719
12717
|
dlog('remote_infer: stream complete, tokens=' + riTokenContent.length + ' in=' + riInputTokens + ' out=' + riOutputTokens);
|
|
12720
12718
|
break;
|
|
12721
12719
|
}
|
|
@@ -13206,8 +13204,7 @@ async function handleCmd(cmd) {
|
|
|
13206
13204
|
var sseChunk = await sseReader.read();
|
|
13207
13205
|
if (sseChunk.done) break;
|
|
13208
13206
|
sseBuf += sseDecoder.decode(sseChunk.value, { stream: true });
|
|
13209
|
-
var sseLines = sseBuf.split('
|
|
13210
|
-
');
|
|
13207
|
+
var sseLines = sseBuf.split('\\n');
|
|
13211
13208
|
sseBuf = sseLines.pop();
|
|
13212
13209
|
|
|
13213
13210
|
for (var sli = 0; sli < sseLines.length; sli++) {
|
|
@@ -29961,14 +29958,6 @@ ${this.formatConnectionInfo()}`);
|
|
|
29961
29958
|
lines.push(`\x1B]52;c;${b64}\x07`);
|
|
29962
29959
|
lines.push(` ${c2.dim("(copied to clipboard)")}`);
|
|
29963
29960
|
}
|
|
29964
|
-
const infCaps = this._capabilities.filter((cap) => cap.startsWith("inference:"));
|
|
29965
|
-
if (infCaps.length > 0) {
|
|
29966
|
-
lines.push("");
|
|
29967
|
-
lines.push(` ${c2.bold("Exposed capabilities:")}`);
|
|
29968
|
-
for (const cap of infCaps) {
|
|
29969
|
-
lines.push(` ${c2.cyan(cap)}`);
|
|
29970
|
-
}
|
|
29971
|
-
}
|
|
29972
29961
|
return lines.join("\n");
|
|
29973
29962
|
}
|
|
29974
29963
|
/** Format usage stats for display */
|
|
@@ -48396,56 +48385,64 @@ var init_status_bar = __esm({
|
|
|
48396
48385
|
return null;
|
|
48397
48386
|
};
|
|
48398
48387
|
let lastPeerMetricsDebug = "";
|
|
48388
|
+
let pollInFlight = false;
|
|
48399
48389
|
const poll = async () => {
|
|
48400
|
-
|
|
48390
|
+
if (pollInFlight)
|
|
48391
|
+
return;
|
|
48392
|
+
pollInFlight = true;
|
|
48401
48393
|
try {
|
|
48402
|
-
|
|
48403
|
-
|
|
48404
|
-
queryData
|
|
48405
|
-
|
|
48406
|
-
|
|
48407
|
-
|
|
48408
|
-
|
|
48409
|
-
|
|
48410
|
-
|
|
48411
|
-
|
|
48412
|
-
|
|
48413
|
-
|
|
48414
|
-
|
|
48415
|
-
|
|
48416
|
-
|
|
48417
|
-
|
|
48418
|
-
|
|
48419
|
-
|
|
48420
|
-
|
|
48421
|
-
|
|
48422
|
-
|
|
48423
|
-
|
|
48424
|
-
|
|
48425
|
-
|
|
48426
|
-
|
|
48427
|
-
|
|
48428
|
-
|
|
48429
|
-
|
|
48430
|
-
|
|
48431
|
-
|
|
48432
|
-
|
|
48433
|
-
|
|
48434
|
-
|
|
48435
|
-
|
|
48394
|
+
pollAttempt++;
|
|
48395
|
+
try {
|
|
48396
|
+
const queryData = { type: "query" };
|
|
48397
|
+
if (authKey)
|
|
48398
|
+
queryData.auth_key = authKey;
|
|
48399
|
+
const raw = await sendCommand("invoke_capability", {
|
|
48400
|
+
target_peer: peerId,
|
|
48401
|
+
capability: "system_metrics",
|
|
48402
|
+
input: queryData
|
|
48403
|
+
}, 15e3);
|
|
48404
|
+
if (typeof raw === "string" && raw.startsWith("Invoke error:")) {
|
|
48405
|
+
lastPeerMetricsDebug = `invoke error: ${raw.slice(0, 200)}`;
|
|
48406
|
+
throw new Error(raw);
|
|
48407
|
+
}
|
|
48408
|
+
const metricsData = extractMetrics(raw);
|
|
48409
|
+
if (metricsData?.cpu) {
|
|
48410
|
+
lastPeerMetricsDebug = `ok: cpu=${metricsData.cpu.utilization}%`;
|
|
48411
|
+
this.setRemoteMetrics({
|
|
48412
|
+
cpuUtil: metricsData.cpu?.utilization ?? 0,
|
|
48413
|
+
cpuCores: metricsData.cpu?.cores ?? 0,
|
|
48414
|
+
cpuModel: metricsData.cpu?.model ?? "",
|
|
48415
|
+
gpuUtil: metricsData.gpu?.available ? metricsData.gpu.utilization ?? 0 : -1,
|
|
48416
|
+
gpuName: metricsData.gpu?.name ?? "",
|
|
48417
|
+
vramUtil: metricsData.gpu?.available ? metricsData.gpu.vramUtilization ?? 0 : -1,
|
|
48418
|
+
vramUsedMB: metricsData.gpu?.vramUsedMB ?? 0,
|
|
48419
|
+
vramTotalMB: metricsData.gpu?.vramTotalMB ?? 0,
|
|
48420
|
+
memUtil: metricsData.memory?.utilization ?? 0,
|
|
48421
|
+
memTotalGB: metricsData.memory?.totalGB ?? 0,
|
|
48422
|
+
memUsedGB: metricsData.memory?.usedGB ?? 0
|
|
48423
|
+
});
|
|
48424
|
+
return;
|
|
48425
|
+
}
|
|
48426
|
+
lastPeerMetricsDebug = `parse fail: ${typeof raw === "string" ? raw.slice(0, 300) : "non-string"}`;
|
|
48427
|
+
} catch (e) {
|
|
48428
|
+
if (!lastPeerMetricsDebug.startsWith("invoke error:")) {
|
|
48429
|
+
lastPeerMetricsDebug = `exception: ${e instanceof Error ? e.message.slice(0, 200) : String(e).slice(0, 200)}`;
|
|
48430
|
+
}
|
|
48436
48431
|
}
|
|
48432
|
+
this.setRemoteMetrics({
|
|
48433
|
+
cpuUtil: -1,
|
|
48434
|
+
// -1 = unavailable (won't render bar)
|
|
48435
|
+
gpuUtil: -1,
|
|
48436
|
+
gpuName: pollAttempt <= 5 ? "connecting..." : `peer (${lastPeerMetricsDebug.slice(0, 40)})`,
|
|
48437
|
+
vramUtil: -1,
|
|
48438
|
+
memUtil: -1
|
|
48439
|
+
});
|
|
48440
|
+
} finally {
|
|
48441
|
+
pollInFlight = false;
|
|
48437
48442
|
}
|
|
48438
|
-
this.setRemoteMetrics({
|
|
48439
|
-
cpuUtil: -1,
|
|
48440
|
-
// -1 = unavailable (won't render bar)
|
|
48441
|
-
gpuUtil: -1,
|
|
48442
|
-
gpuName: pollAttempt <= 5 ? "connecting..." : `peer (${lastPeerMetricsDebug.slice(0, 40)})`,
|
|
48443
|
-
vramUtil: -1,
|
|
48444
|
-
memUtil: -1
|
|
48445
|
-
});
|
|
48446
48443
|
};
|
|
48447
|
-
setTimeout(poll,
|
|
48448
|
-
this._remoteMetricsTimer = setInterval(poll,
|
|
48444
|
+
setTimeout(poll, 2e3);
|
|
48445
|
+
this._remoteMetricsTimer = setInterval(poll, 1e4);
|
|
48449
48446
|
}
|
|
48450
48447
|
/** Stop polling remote metrics and switch back to local */
|
|
48451
48448
|
stopRemoteMetricsPolling() {
|
package/package.json
CHANGED