open-agents-ai 0.103.49 → 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 +24 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12122,27 +12122,6 @@ if (hasX402Key) {
|
|
|
12122
12122
|
}
|
|
12123
12123
|
const nexus = new NexusClient(nexusOpts);
|
|
12124
12124
|
|
|
12125
|
-
// Monkey-patch dialPeerProtocol to convert string multiaddrs to proper Multiaddr objects.
|
|
12126
|
-
// libp2p v3 (3.1.x) requires Multiaddr objects (with .getComponents()), but
|
|
12127
|
-
// open-agents-nexus resolves multiaddrs as plain strings. This shim wraps
|
|
12128
|
-
// node.dialProtocol to auto-convert strings before they reach libp2p's getPeerAddress().
|
|
12129
|
-
if (nexus.node && typeof nexus.node.dialProtocol === 'function') {
|
|
12130
|
-
var _origDialProtocol = nexus.node.dialProtocol.bind(nexus.node);
|
|
12131
|
-
nexus.node.dialProtocol = async function patchedDialProtocol(peer, protocols, options) {
|
|
12132
|
-
// If peer is a string (multiaddr), convert to a proper Multiaddr object
|
|
12133
|
-
if (typeof peer === 'string' && peer.startsWith('/')) {
|
|
12134
|
-
try {
|
|
12135
|
-
var { multiaddr: maFromStr } = await import('@multiformats/multiaddr');
|
|
12136
|
-
peer = maFromStr(peer);
|
|
12137
|
-
} catch (convErr) {
|
|
12138
|
-
dlog('multiaddr conversion failed: ' + (convErr.message || convErr));
|
|
12139
|
-
}
|
|
12140
|
-
}
|
|
12141
|
-
return _origDialProtocol(peer, protocols, options);
|
|
12142
|
-
};
|
|
12143
|
-
dlog('patched node.dialProtocol for multiaddr string conversion');
|
|
12144
|
-
}
|
|
12145
|
-
|
|
12146
12125
|
const rooms = new Map();
|
|
12147
12126
|
let connected = false;
|
|
12148
12127
|
const blockedPeers = [];
|
|
@@ -13182,6 +13161,30 @@ process.on('unhandledRejection', (reason) => {
|
|
|
13182
13161
|
}
|
|
13183
13162
|
connected = true;
|
|
13184
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
|
+
|
|
13185
13188
|
// v1.5.0: Setup metering audit hook
|
|
13186
13189
|
try {
|
|
13187
13190
|
if (nexus.metering && typeof nexus.metering.addHook === 'function') {
|
package/package.json
CHANGED