@tablation/crew 0.146.0 → 0.146.2
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/cli.js +36 -34
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -21696,6 +21696,37 @@ import { existsSync as existsSync48, mkdirSync as mkdirSync36, readFileSync as r
|
|
|
21696
21696
|
import { join as join52 } from "path";
|
|
21697
21697
|
import { randomBytes } from "crypto";
|
|
21698
21698
|
|
|
21699
|
+
// src/outage.ts
|
|
21700
|
+
var TRANSIENT_BACKOFF_MS = [15e3, 3e4, 6e4];
|
|
21701
|
+
var OUTAGE_ESCALATE_AFTER = 5;
|
|
21702
|
+
var TRACKER_OUTAGE_KEY = "tracker_unreachable";
|
|
21703
|
+
var NETWORK_CODES = ["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "EAI_AGAIN"];
|
|
21704
|
+
function transientBackoffMs(n) {
|
|
21705
|
+
return TRANSIENT_BACKOFF_MS[Math.min(Math.max(n, 1), TRANSIENT_BACKOFF_MS.length) - 1];
|
|
21706
|
+
}
|
|
21707
|
+
function codeOf(e) {
|
|
21708
|
+
const code = e?.code;
|
|
21709
|
+
return typeof code === "string" ? code : void 0;
|
|
21710
|
+
}
|
|
21711
|
+
function isTransientError(err3) {
|
|
21712
|
+
if (!(err3 instanceof Error)) return false;
|
|
21713
|
+
const msg = err3.message;
|
|
21714
|
+
if (msg === "fetch failed" || msg.startsWith("fetch failed")) return true;
|
|
21715
|
+
for (let e = err3, depth = 0; e && depth < 4; e = e.cause, depth++) {
|
|
21716
|
+
const code = codeOf(e);
|
|
21717
|
+
if (code && NETWORK_CODES.includes(code)) return true;
|
|
21718
|
+
}
|
|
21719
|
+
if (NETWORK_CODES.some((c) => msg.includes(c))) return true;
|
|
21720
|
+
if (/\b(?:HTTP|status)\s*:?\s*(502|503|504)\b/i.test(msg) || /^(502|503|504)\b/.test(msg)) return true;
|
|
21721
|
+
if (err3 instanceof SyntaxError && /Unexpected token '?<|is not valid JSON|Unexpected end of JSON/.test(msg)) return true;
|
|
21722
|
+
return false;
|
|
21723
|
+
}
|
|
21724
|
+
function describeCause(err3) {
|
|
21725
|
+
const first = (err3 instanceof Error ? err3.message : String(err3)).split("\n")[0];
|
|
21726
|
+
const code = codeOf(err3?.cause);
|
|
21727
|
+
return code && !first.includes(code) ? `${first} (${code})` : first;
|
|
21728
|
+
}
|
|
21729
|
+
|
|
21699
21730
|
// src/fleet.ts
|
|
21700
21731
|
function agedConnectionRank(rawRank, role, route2, decision, state, now) {
|
|
21701
21732
|
if (role !== "dev" && role !== "design") return rawRank;
|
|
@@ -21719,11 +21750,13 @@ async function decideFleet(o) {
|
|
|
21719
21750
|
rank: agedConnectionRank(rawRank, sel.selected, route2, decision, o.state, now)
|
|
21720
21751
|
};
|
|
21721
21752
|
} catch (e) {
|
|
21722
|
-
return { route: route2, rank: NOTHING_ACTIONABLE, error: e.message };
|
|
21753
|
+
return { route: route2, rank: NOTHING_ACTIONABLE, error: e.message, transient: isTransientError(e) };
|
|
21723
21754
|
}
|
|
21724
21755
|
}));
|
|
21725
21756
|
for (const e of entries) {
|
|
21726
|
-
if (e.error)
|
|
21757
|
+
if (!e.error) continue;
|
|
21758
|
+
const em = o.emit.forRoute(e.route.route);
|
|
21759
|
+
(e.transient ? em.warn : em.error).call(em, `${e.route.route}: ${e.error}`, { step: "poll" });
|
|
21727
21760
|
}
|
|
21728
21761
|
const contenders = entries.filter((e) => e.role && e.rank < NOTHING_ACTIONABLE);
|
|
21729
21762
|
const best = contenders.reduce(
|
|
@@ -22784,37 +22817,6 @@ function formatPeriscopeList(entries) {
|
|
|
22784
22817
|
].join(" ")).join("\n");
|
|
22785
22818
|
}
|
|
22786
22819
|
|
|
22787
|
-
// src/outage.ts
|
|
22788
|
-
var TRANSIENT_BACKOFF_MS = [15e3, 3e4, 6e4];
|
|
22789
|
-
var OUTAGE_ESCALATE_AFTER = 5;
|
|
22790
|
-
var TRACKER_OUTAGE_KEY = "tracker_unreachable";
|
|
22791
|
-
var NETWORK_CODES = ["ECONNRESET", "ECONNREFUSED", "ETIMEDOUT", "EAI_AGAIN"];
|
|
22792
|
-
function transientBackoffMs(n) {
|
|
22793
|
-
return TRANSIENT_BACKOFF_MS[Math.min(Math.max(n, 1), TRANSIENT_BACKOFF_MS.length) - 1];
|
|
22794
|
-
}
|
|
22795
|
-
function codeOf(e) {
|
|
22796
|
-
const code = e?.code;
|
|
22797
|
-
return typeof code === "string" ? code : void 0;
|
|
22798
|
-
}
|
|
22799
|
-
function isTransientError(err3) {
|
|
22800
|
-
if (!(err3 instanceof Error)) return false;
|
|
22801
|
-
const msg = err3.message;
|
|
22802
|
-
if (msg === "fetch failed" || msg.startsWith("fetch failed")) return true;
|
|
22803
|
-
for (let e = err3, depth = 0; e && depth < 4; e = e.cause, depth++) {
|
|
22804
|
-
const code = codeOf(e);
|
|
22805
|
-
if (code && NETWORK_CODES.includes(code)) return true;
|
|
22806
|
-
}
|
|
22807
|
-
if (NETWORK_CODES.some((c) => msg.includes(c))) return true;
|
|
22808
|
-
if (/\b(?:HTTP|status)\s*:?\s*(502|503|504)\b/i.test(msg) || /^(502|503|504)\b/.test(msg)) return true;
|
|
22809
|
-
if (err3 instanceof SyntaxError && /Unexpected token '?<|is not valid JSON|Unexpected end of JSON/.test(msg)) return true;
|
|
22810
|
-
return false;
|
|
22811
|
-
}
|
|
22812
|
-
function describeCause(err3) {
|
|
22813
|
-
const first = (err3 instanceof Error ? err3.message : String(err3)).split("\n")[0];
|
|
22814
|
-
const code = codeOf(err3?.cause);
|
|
22815
|
-
return code && !first.includes(code) ? `${first} (${code})` : first;
|
|
22816
|
-
}
|
|
22817
|
-
|
|
22818
22820
|
// src/daemon.ts
|
|
22819
22821
|
var DEFAULT_FLOOR_MS = 5e3;
|
|
22820
22822
|
var DEFAULT_CEILING_MS = INTERVAL_SECONDS * 1e3;
|
|
@@ -26537,7 +26539,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
26537
26539
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
26538
26540
|
import { join as join58 } from "path";
|
|
26539
26541
|
function builtVersion() {
|
|
26540
|
-
return true ? "0.146.
|
|
26542
|
+
return true ? "0.146.2" : null;
|
|
26541
26543
|
}
|
|
26542
26544
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
26543
26545
|
function newestMtime(path) {
|
package/package.json
CHANGED