@tangle-network/agent-app 0.60.156 → 0.60.157
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.
|
@@ -1667,6 +1667,20 @@ var SandboxRecoveryFailedError = class extends Error {
|
|
|
1667
1667
|
this.phase = phase;
|
|
1668
1668
|
}
|
|
1669
1669
|
};
|
|
1670
|
+
var SandboxBoxBusyError = class extends Error {
|
|
1671
|
+
boxKey;
|
|
1672
|
+
stage;
|
|
1673
|
+
runningSessions;
|
|
1674
|
+
constructor(stage, boxKey, runningSessions, detail) {
|
|
1675
|
+
super(
|
|
1676
|
+
`${stage} sandbox ${boxKey} is not connectable (${detail}) but is serving ${runningSessions} running session${runningSessions === 1 ? "" : "s"}, so it was not restarted. Retry when they finish.`
|
|
1677
|
+
);
|
|
1678
|
+
this.name = "SandboxBoxBusyError";
|
|
1679
|
+
this.boxKey = boxKey;
|
|
1680
|
+
this.stage = stage;
|
|
1681
|
+
this.runningSessions = runningSessions;
|
|
1682
|
+
}
|
|
1683
|
+
};
|
|
1670
1684
|
function fileApiTarget(mount) {
|
|
1671
1685
|
if (mount.resource.kind !== "inline") return null;
|
|
1672
1686
|
let rel;
|
|
@@ -1920,7 +1934,6 @@ async function isBoxAlive(box, probe) {
|
|
|
1920
1934
|
}
|
|
1921
1935
|
}
|
|
1922
1936
|
var DEFAULT_LIVENESS_CACHE_TTL_MS = 5e3;
|
|
1923
|
-
var PATIENT_LIVENESS_EXEC_TIMEOUT_MS = 3e4;
|
|
1924
1937
|
function hasRecentLivenessVerification(box, probe, now = Date.now()) {
|
|
1925
1938
|
const ttlMs = probe.cacheTtlMs ?? DEFAULT_LIVENESS_CACHE_TTL_MS;
|
|
1926
1939
|
if (!Number.isFinite(ttlMs) || ttlMs <= 0) return false;
|
|
@@ -2117,16 +2130,26 @@ function resumeEnvRequiredKeys(cause) {
|
|
|
2117
2130
|
if (code !== "RESUME_ENV_REQUIRED" || !Array.isArray(missingEnvKeys)) return void 0;
|
|
2118
2131
|
return missingEnvKeys.filter((key) => typeof key === "string");
|
|
2119
2132
|
}
|
|
2133
|
+
async function runningSessionCount(box) {
|
|
2134
|
+
try {
|
|
2135
|
+
const sessions = await box.sessions();
|
|
2136
|
+
return sessions.filter(
|
|
2137
|
+
({ info }) => info.status === "running" || Boolean(info.activeExecutionId) || info.status === "queued" && Boolean(info.latestExecutionId)
|
|
2138
|
+
).length;
|
|
2139
|
+
} catch {
|
|
2140
|
+
return void 0;
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2120
2143
|
async function recoverUnresponsiveBox(client, box, probe, stage, name, resumeTimeout, runtimeEnv, onProgress) {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2144
|
+
const running = await runningSessionCount(box);
|
|
2145
|
+
if (running) {
|
|
2146
|
+
if (sandboxRuntimeUrl(box) && !sandboxEdgeFailed(box)) return box;
|
|
2147
|
+
throw new SandboxBoxBusyError(
|
|
2148
|
+
stage,
|
|
2149
|
+
name,
|
|
2150
|
+
running,
|
|
2151
|
+
sandboxEdgeFailed(box) ? "runtime edge readiness failed" : "runtime URL is missing"
|
|
2152
|
+
);
|
|
2130
2153
|
}
|
|
2131
2154
|
try {
|
|
2132
2155
|
await box.stop();
|
|
@@ -3286,6 +3309,7 @@ export {
|
|
|
3286
3309
|
SandboxEgressPolicyMismatchError,
|
|
3287
3310
|
SandboxRuntimeAuthRefreshError,
|
|
3288
3311
|
SandboxRecoveryFailedError,
|
|
3312
|
+
SandboxBoxBusyError,
|
|
3289
3313
|
writeProfileFilesToBox,
|
|
3290
3314
|
deferredCorpusHash,
|
|
3291
3315
|
PROVISION_PAYLOAD_MAX_BYTES,
|
|
@@ -3319,4 +3343,4 @@ export {
|
|
|
3319
3343
|
isTerminalPromptEvent,
|
|
3320
3344
|
detectInteractiveQuestion
|
|
3321
3345
|
};
|
|
3322
|
-
//# sourceMappingURL=chunk-
|
|
3346
|
+
//# sourceMappingURL=chunk-RHDP4VIG.js.map
|