open-agents-ai 0.103.48 → 0.103.50
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 +43 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13161,6 +13161,30 @@ process.on('unhandledRejection', (reason) => {
|
|
|
13161
13161
|
}
|
|
13162
13162
|
connected = true;
|
|
13163
13163
|
|
|
13164
|
+
// Monkey-patch node.dialProtocol to convert string multiaddrs to Multiaddr objects.
|
|
13165
|
+
// libp2p v3 requires Multiaddr objects (with .getComponents()), but
|
|
13166
|
+
// open-agents-nexus resolves multiaddrs as plain strings in dialPeerProtocol().
|
|
13167
|
+
// nexus.node is only available AFTER connect(), so we patch here.
|
|
13168
|
+
var _patchNode = nexus.network ? nexus.network.node : nexus.node;
|
|
13169
|
+
if (_patchNode && typeof _patchNode.dialProtocol === 'function') {
|
|
13170
|
+
var _origDialProtocol = _patchNode.dialProtocol.bind(_patchNode);
|
|
13171
|
+
_patchNode.dialProtocol = async function patchedDialProtocol(peer, protocols, options) {
|
|
13172
|
+
if (typeof peer === 'string' && peer.startsWith('/')) {
|
|
13173
|
+
try {
|
|
13174
|
+
var { multiaddr: maFromStr } = await import('@multiformats/multiaddr');
|
|
13175
|
+
peer = maFromStr(peer);
|
|
13176
|
+
dlog('converted string multiaddr to Multiaddr object');
|
|
13177
|
+
} catch (convErr) {
|
|
13178
|
+
dlog('multiaddr conversion failed: ' + (convErr.message || convErr));
|
|
13179
|
+
}
|
|
13180
|
+
}
|
|
13181
|
+
return _origDialProtocol(peer, protocols, options);
|
|
13182
|
+
};
|
|
13183
|
+
dlog('patched node.dialProtocol for multiaddr string conversion');
|
|
13184
|
+
} else {
|
|
13185
|
+
dlog('WARNING: could not patch node.dialProtocol \u2014 node=' + !!_patchNode);
|
|
13186
|
+
}
|
|
13187
|
+
|
|
13164
13188
|
// v1.5.0: Setup metering audit hook
|
|
13165
13189
|
try {
|
|
13166
13190
|
if (nexus.metering && typeof nexus.metering.addHook === 'function') {
|
|
@@ -44258,19 +44282,26 @@ var init_status_bar = __esm({
|
|
|
44258
44282
|
const raw = await sendCommand("invoke_capability", {
|
|
44259
44283
|
target_peer: peerId,
|
|
44260
44284
|
capability: "system_metrics",
|
|
44261
|
-
|
|
44285
|
+
input: queryData
|
|
44262
44286
|
}, 8e3);
|
|
44263
|
-
const
|
|
44264
|
-
if (
|
|
44265
|
-
|
|
44266
|
-
|
|
44267
|
-
|
|
44268
|
-
|
|
44269
|
-
|
|
44270
|
-
|
|
44271
|
-
|
|
44272
|
-
|
|
44273
|
-
|
|
44287
|
+
const parsed = JSON.parse(raw);
|
|
44288
|
+
if (parsed) {
|
|
44289
|
+
let metricsData = null;
|
|
44290
|
+
if (typeof parsed === "object" && parsed.result) {
|
|
44291
|
+
metricsData = typeof parsed.result === "string" ? JSON.parse(parsed.result) : parsed.result;
|
|
44292
|
+
} else if (typeof parsed === "object" && parsed.cpu) {
|
|
44293
|
+
metricsData = parsed;
|
|
44294
|
+
}
|
|
44295
|
+
if (metricsData?.cpu) {
|
|
44296
|
+
this.setRemoteMetrics({
|
|
44297
|
+
cpuUtil: metricsData.cpu?.utilization ?? 0,
|
|
44298
|
+
gpuUtil: metricsData.gpu?.available ? metricsData.gpu.utilization ?? 0 : -1,
|
|
44299
|
+
gpuName: metricsData.gpu?.name ?? "",
|
|
44300
|
+
vramUtil: metricsData.gpu?.available ? metricsData.gpu.vramUtilization ?? 0 : -1,
|
|
44301
|
+
memUtil: metricsData.memory?.utilization ?? 0
|
|
44302
|
+
});
|
|
44303
|
+
return;
|
|
44304
|
+
}
|
|
44274
44305
|
}
|
|
44275
44306
|
} catch {
|
|
44276
44307
|
}
|
package/package.json
CHANGED