@madarco/agentbox 0.11.0 → 0.11.1
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/CHANGELOG.md +10 -0
- package/dist/{_cloud-attach-6C5NMOHD.js → _cloud-attach-45ECDTRL.js} +3 -3
- package/dist/{chunk-D4Q2RUQI.js → chunk-MXXXKJYS.js} +2 -2
- package/dist/{chunk-NVSRGC5W.js → chunk-PZ2TJF2U.js} +6 -6
- package/dist/{chunk-GUNUBIRB.js → chunk-ZJXTIH6C.js} +51 -22
- package/dist/{chunk-GUNUBIRB.js.map → chunk-ZJXTIH6C.js.map} +1 -1
- package/dist/{dist-ZEGIMYWZ.js → dist-ASLPRUQR.js} +2 -2
- package/dist/{dist-PJFJNXO2.js → dist-PTJ6CEQY.js} +3 -3
- package/dist/{dist-HT2YV6PB.js → dist-RAZP76VX.js} +3 -3
- package/dist/{dist-4SUIXKSD.js → dist-WMQDMTWS.js} +3 -3
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/runtime/relay/bin.cjs +32 -17
- /package/dist/{_cloud-attach-6C5NMOHD.js.map → _cloud-attach-45ECDTRL.js.map} +0 -0
- /package/dist/{chunk-D4Q2RUQI.js.map → chunk-MXXXKJYS.js.map} +0 -0
- /package/dist/{chunk-NVSRGC5W.js.map → chunk-PZ2TJF2U.js.map} +0 -0
- /package/dist/{dist-ZEGIMYWZ.js.map → dist-ASLPRUQR.js.map} +0 -0
- /package/dist/{dist-PJFJNXO2.js.map → dist-PTJ6CEQY.js.map} +0 -0
- /package/dist/{dist-HT2YV6PB.js.map → dist-RAZP76VX.js.map} +0 -0
- /package/dist/{dist-4SUIXKSD.js.map → dist-WMQDMTWS.js.map} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madarco/agentbox",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Launch Claude Code, Codex, and other coding agents in isolated sandboxes",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marco D'Alia",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"@agentbox/sandbox-cloud": "0.0.0",
|
|
65
65
|
"@agentbox/relay": "0.0.0",
|
|
66
66
|
"@agentbox/sandbox-core": "0.0.0",
|
|
67
|
+
"@agentbox/sandbox-daytona": "0.0.0",
|
|
67
68
|
"@agentbox/sandbox-docker": "0.0.0",
|
|
68
69
|
"@agentbox/sandbox-hetzner": "0.0.0",
|
|
69
|
-
"@agentbox/sandbox-vercel": "0.0.0"
|
|
70
|
-
"@agentbox/sandbox-daytona": "0.0.0"
|
|
70
|
+
"@agentbox/sandbox-vercel": "0.0.0"
|
|
71
71
|
},
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsup",
|
package/runtime/relay/bin.cjs
CHANGED
|
@@ -21074,57 +21074,72 @@ async function defaultCountWorkingBoxes(registry, statusStore, idleGraceMs) {
|
|
|
21074
21074
|
sinceCreateMs: msSince2(b.createdAt)
|
|
21075
21075
|
};
|
|
21076
21076
|
});
|
|
21077
|
-
|
|
21077
|
+
const count2 = countWorkingSlots(entries, idleGraceMs);
|
|
21078
21078
|
let jobs;
|
|
21079
21079
|
try {
|
|
21080
21080
|
jobs = await loadQueue();
|
|
21081
21081
|
} catch {
|
|
21082
21082
|
return count2;
|
|
21083
21083
|
}
|
|
21084
|
+
return count2 + countInFlightCreateJobs(jobs, registeredIds);
|
|
21085
|
+
}
|
|
21086
|
+
function countInFlightCreateJobs(jobs, accountedBoxIds) {
|
|
21087
|
+
let n2 = 0;
|
|
21084
21088
|
for (const j of jobs) {
|
|
21085
21089
|
if (j.status !== "running") continue;
|
|
21086
|
-
if (j.boxId &&
|
|
21090
|
+
if (j.boxId && accountedBoxIds.has(j.boxId)) continue;
|
|
21087
21091
|
if (typeof j.pid === "number" && !processAlive(j.pid)) continue;
|
|
21088
|
-
|
|
21092
|
+
n2 += 1;
|
|
21089
21093
|
}
|
|
21090
|
-
return
|
|
21094
|
+
return n2;
|
|
21091
21095
|
}
|
|
21092
21096
|
var RUNNING_COUNT_CACHE_MS = 3e3;
|
|
21093
|
-
var
|
|
21097
|
+
var boxStateCache = null;
|
|
21094
21098
|
async function defaultCountRunningBoxes() {
|
|
21099
|
+
const { boxCount, stateIds } = await cachedBoxState();
|
|
21100
|
+
let jobs;
|
|
21101
|
+
try {
|
|
21102
|
+
jobs = await loadQueue();
|
|
21103
|
+
} catch {
|
|
21104
|
+
return boxCount;
|
|
21105
|
+
}
|
|
21106
|
+
return boxCount + countInFlightCreateJobs(jobs, stateIds);
|
|
21107
|
+
}
|
|
21108
|
+
async function cachedBoxState() {
|
|
21095
21109
|
const now = Date.now();
|
|
21096
|
-
if (
|
|
21097
|
-
return
|
|
21110
|
+
if (boxStateCache && boxStateCache.expiresAt > now) {
|
|
21111
|
+
return { boxCount: boxStateCache.boxCount, stateIds: boxStateCache.stateIds };
|
|
21098
21112
|
}
|
|
21099
|
-
const
|
|
21100
|
-
|
|
21101
|
-
return
|
|
21113
|
+
const fresh = await uncachedBoxStateCount();
|
|
21114
|
+
boxStateCache = { ...fresh, expiresAt: now + RUNNING_COUNT_CACHE_MS };
|
|
21115
|
+
return fresh;
|
|
21102
21116
|
}
|
|
21103
|
-
async function
|
|
21117
|
+
async function uncachedBoxStateCount() {
|
|
21104
21118
|
let boxes;
|
|
21105
21119
|
try {
|
|
21106
21120
|
boxes = (await readState(STATE_FILE)).boxes;
|
|
21107
21121
|
} catch {
|
|
21108
|
-
return 0;
|
|
21122
|
+
return { boxCount: 0, stateIds: /* @__PURE__ */ new Set() };
|
|
21109
21123
|
}
|
|
21110
|
-
|
|
21111
|
-
|
|
21124
|
+
const stateIds = new Set(boxes.map((b) => b.id));
|
|
21125
|
+
if (boxes.length === 0) return { boxCount: 0, stateIds };
|
|
21126
|
+
let boxCount = 0;
|
|
21112
21127
|
const dockerBoxes = [];
|
|
21113
21128
|
for (const b of boxes) {
|
|
21114
21129
|
const provider = b.provider ?? "docker";
|
|
21115
21130
|
if (provider === "docker") {
|
|
21116
21131
|
dockerBoxes.push(b);
|
|
21117
21132
|
} else {
|
|
21118
|
-
|
|
21133
|
+
boxCount += 1;
|
|
21119
21134
|
}
|
|
21120
21135
|
}
|
|
21121
21136
|
if (dockerBoxes.length > 0) {
|
|
21122
21137
|
const states = await Promise.all(dockerBoxes.map((b) => inspectDockerState(b.container)));
|
|
21123
21138
|
for (const s of states) {
|
|
21124
|
-
if (s === "running")
|
|
21139
|
+
if (s === "running") boxCount += 1;
|
|
21125
21140
|
}
|
|
21126
21141
|
}
|
|
21127
|
-
return
|
|
21142
|
+
return { boxCount, stateIds };
|
|
21128
21143
|
}
|
|
21129
21144
|
function inspectDockerState(containerName) {
|
|
21130
21145
|
return new Promise((resolveP) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|