@algosuite/vo-mcp 0.2.0-beta.64 → 0.2.0-beta.65
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.
|
@@ -2997,22 +2997,33 @@ var terminatedChildren = /* @__PURE__ */ new WeakSet();
|
|
|
2997
2997
|
function attachSupervisorChildTerminationCustody(target, onTerminated, onObservedError = () => {
|
|
2998
2998
|
}) {
|
|
2999
2999
|
let accounted = false;
|
|
3000
|
-
const account = (kind, error = null) => {
|
|
3000
|
+
const account = (kind, { error = null, code = null, signal = null } = {}) => {
|
|
3001
3001
|
terminatedChildren.add(target);
|
|
3002
3002
|
if (accounted) return false;
|
|
3003
3003
|
accounted = true;
|
|
3004
|
-
onTerminated(Object.freeze({ target, kind, error }));
|
|
3004
|
+
onTerminated(Object.freeze({ target, kind, error, code, signal }));
|
|
3005
3005
|
return true;
|
|
3006
3006
|
};
|
|
3007
3007
|
target.on("error", (error) => {
|
|
3008
3008
|
onObservedError(error);
|
|
3009
|
-
if (target.pid === void 0 || target.pid === null) account("error", error);
|
|
3009
|
+
if (target.pid === void 0 || target.pid === null) account("error", { error });
|
|
3010
3010
|
});
|
|
3011
|
-
target.on("exit", () => {
|
|
3012
|
-
account("exit");
|
|
3011
|
+
target.on("exit", (code, signal) => {
|
|
3012
|
+
account("exit", { code: code ?? null, signal: signal ?? null });
|
|
3013
3013
|
});
|
|
3014
3014
|
return Object.freeze({ accounted: () => accounted });
|
|
3015
3015
|
}
|
|
3016
|
+
function describeChildTermination(record, runtime = process.version) {
|
|
3017
|
+
if (!record || typeof record !== "object") return `unknown termination on Node ${runtime}`;
|
|
3018
|
+
if (record.kind === "error") {
|
|
3019
|
+
const detail = record.error instanceof Error ? record.error.message : String(record.error ?? "no detail");
|
|
3020
|
+
return `spawn error on Node ${runtime}: ${detail}`;
|
|
3021
|
+
}
|
|
3022
|
+
if (record.signal) return `killed by ${record.signal} on Node ${runtime}`;
|
|
3023
|
+
if (record.code === 0) return `exited cleanly (code 0) on Node ${runtime}`;
|
|
3024
|
+
if (record.code === null) return `exited with no reported code or signal on Node ${runtime}`;
|
|
3025
|
+
return `exited with code ${record.code} on Node ${runtime}`;
|
|
3026
|
+
}
|
|
3016
3027
|
function supervisorChildHasExited(target) {
|
|
3017
3028
|
return terminatedChildren.has(target) || target.exitCode !== null || (target.signalCode ?? null) !== null;
|
|
3018
3029
|
}
|
|
@@ -3471,13 +3482,14 @@ async function main() {
|
|
|
3471
3482
|
});
|
|
3472
3483
|
attachSupervisorChildTerminationCustody(
|
|
3473
3484
|
next,
|
|
3474
|
-
() => {
|
|
3485
|
+
(record) => {
|
|
3475
3486
|
if (stopping || expectedChildStops.delete(next)) {
|
|
3476
3487
|
readinessDeferrals.forget(next);
|
|
3477
3488
|
return;
|
|
3478
3489
|
}
|
|
3479
3490
|
if (captureChildReadinessDeferral(next)) return;
|
|
3480
3491
|
readinessDeferrals.forget(next);
|
|
3492
|
+
console.error(`[vo-runner supervisor] child ${describeChildTermination(record)}`);
|
|
3481
3493
|
const decision = respawnCircuit.recordExit(startedAt, Date.now());
|
|
3482
3494
|
if (decision.tripped) {
|
|
3483
3495
|
markSupervisorDegraded();
|