agentlife 2.6.14 → 2.6.15
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 +12 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5517,6 +5517,8 @@ function persistTunnel(info) {
|
|
|
5517
5517
|
}
|
|
5518
5518
|
async function provisionTunnel(identity) {
|
|
5519
5519
|
const url = `${API_BASE}/api/v1/devices/provision`;
|
|
5520
|
+
const abort = new AbortController;
|
|
5521
|
+
const timeoutId = setTimeout(() => abort.abort(), 20000);
|
|
5520
5522
|
try {
|
|
5521
5523
|
const response = await fetch(url, {
|
|
5522
5524
|
method: "POST",
|
|
@@ -5524,7 +5526,8 @@ async function provisionTunnel(identity) {
|
|
|
5524
5526
|
body: JSON.stringify({
|
|
5525
5527
|
deviceId: identity.deviceId,
|
|
5526
5528
|
deviceSecret: identity.deviceSecret
|
|
5527
|
-
})
|
|
5529
|
+
}),
|
|
5530
|
+
signal: abort.signal
|
|
5528
5531
|
});
|
|
5529
5532
|
if (!response.ok) {
|
|
5530
5533
|
const body = await response.text();
|
|
@@ -5550,8 +5553,15 @@ async function provisionTunnel(identity) {
|
|
|
5550
5553
|
provisionedAt: Date.now()
|
|
5551
5554
|
};
|
|
5552
5555
|
} catch (err) {
|
|
5553
|
-
|
|
5556
|
+
const aborted = err?.name === "AbortError";
|
|
5557
|
+
if (aborted) {
|
|
5558
|
+
console.warn(`[cloudflared-supervisor] provision request timed out after 20s — ` + `will retry on next pair request`);
|
|
5559
|
+
} else {
|
|
5560
|
+
console.warn(`[cloudflared-supervisor] provision network error: ${err?.message ?? err}`);
|
|
5561
|
+
}
|
|
5554
5562
|
return null;
|
|
5563
|
+
} finally {
|
|
5564
|
+
clearTimeout(timeoutId);
|
|
5555
5565
|
}
|
|
5556
5566
|
}
|
|
5557
5567
|
function ensureCloudflaredBinary() {
|