@highway1/cli 0.1.34 → 0.1.35
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 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -116433,7 +116433,7 @@ function capKey(cap) {
|
|
|
116433
116433
|
}
|
|
116434
116434
|
async function readDIDList(dht, key) {
|
|
116435
116435
|
try {
|
|
116436
|
-
for await (const event of dht.get(key, { signal: AbortSignal.timeout(
|
|
116436
|
+
for await (const event of dht.get(key, { signal: AbortSignal.timeout(3e4) })) {
|
|
116437
116437
|
const raw = extractValue(event);
|
|
116438
116438
|
if (raw) {
|
|
116439
116439
|
const text = toString2(raw);
|
|
@@ -116446,11 +116446,18 @@ async function readDIDList(dht, key) {
|
|
|
116446
116446
|
}
|
|
116447
116447
|
async function writeDIDList(dht, key, dids) {
|
|
116448
116448
|
const value2 = fromString2([...new Set(dids)].join("\n"));
|
|
116449
|
-
|
|
116450
|
-
|
|
116449
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
116450
|
+
try {
|
|
116451
|
+
for await (const _ of dht.put(key, value2, { signal: AbortSignal.timeout(3e4) })) {
|
|
116452
|
+
}
|
|
116453
|
+
return;
|
|
116454
|
+
} catch (e2) {
|
|
116455
|
+
if (e2?.name === "AbortError" && attempt < 3) {
|
|
116456
|
+
logger4.debug(`DHT put timeout, retrying (${attempt}/3)...`);
|
|
116457
|
+
continue;
|
|
116458
|
+
}
|
|
116459
|
+
if (e2?.name !== "AbortError") throw e2;
|
|
116451
116460
|
}
|
|
116452
|
-
} catch (e2) {
|
|
116453
|
-
if (e2?.name !== "AbortError") throw e2;
|
|
116454
116461
|
}
|
|
116455
116462
|
}
|
|
116456
116463
|
function createDHTOperations(libp2p) {
|
|
@@ -116462,11 +116469,19 @@ function createDHTOperations(libp2p) {
|
|
|
116462
116469
|
const dht = libp2p.services?.dht;
|
|
116463
116470
|
if (!dht) throw new DiscoveryError("DHT service not available");
|
|
116464
116471
|
const agentKey = fromString2(`/clawiverse/agent/${card.did}`);
|
|
116465
|
-
|
|
116466
|
-
|
|
116472
|
+
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
116473
|
+
try {
|
|
116474
|
+
for await (const _ of dht.put(agentKey, encodeForDHT(card), { signal: AbortSignal.timeout(3e4) })) {
|
|
116475
|
+
}
|
|
116476
|
+
break;
|
|
116477
|
+
} catch (e2) {
|
|
116478
|
+
if (e2?.name === "AbortError" && attempt < 3) {
|
|
116479
|
+
logger4.debug(`DHT put agent card timeout, retrying (${attempt}/3)...`);
|
|
116480
|
+
continue;
|
|
116481
|
+
}
|
|
116482
|
+
logger4.warn("DHT put agent card failed (non-fatal)", { error: e2.message });
|
|
116483
|
+
break;
|
|
116467
116484
|
}
|
|
116468
|
-
} catch (e2) {
|
|
116469
|
-
logger4.warn("DHT put agent card failed (non-fatal)", { error: e2.message });
|
|
116470
116485
|
}
|
|
116471
116486
|
const caps = (card.capabilities ?? []).map(
|
|
116472
116487
|
(c2) => typeof c2 === "string" ? c2 : c2.name
|