@madarco/agentbox 0.18.0 → 0.19.0

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/README.md +4 -3
  3. package/dist/{_cloud-attach-3UC3IL62.js → _cloud-attach-YM2KOWHO.js} +4 -4
  4. package/dist/{chunk-6QFPYU4Z.js → chunk-7K2A3NLE.js} +8 -5
  5. package/dist/chunk-7K2A3NLE.js.map +1 -0
  6. package/dist/{chunk-U7IZS2ZP.js → chunk-A5OFRJDI.js} +1313 -213
  7. package/dist/chunk-A5OFRJDI.js.map +1 -0
  8. package/dist/{chunk-5BO6SGMI.js → chunk-JK5V4OLT.js} +7 -7
  9. package/dist/{chunk-IA6YHH52.js → chunk-MODNW54N.js} +6 -3
  10. package/dist/{chunk-IA6YHH52.js.map → chunk-MODNW54N.js.map} +1 -1
  11. package/dist/{chunk-46NXCJ6Z.js → chunk-NXX3KQZ6.js} +2 -2
  12. package/dist/{chunk-3JXSW6PN.js → chunk-P6UT5XGE.js} +2 -2
  13. package/dist/{chunk-OG4KMYOJ.js → chunk-SPUUOEW2.js} +273 -54
  14. package/dist/chunk-SPUUOEW2.js.map +1 -0
  15. package/dist/{chunk-XWBFWUY2.js → chunk-Y6PUCLOE.js} +2 -2
  16. package/dist/{dist-CFSKUAS5.js → dist-EKSNZHDY.js} +13 -3
  17. package/dist/{dist-7BS2JS27.js → dist-FTCDWRAL.js} +18 -7
  18. package/dist/dist-FTCDWRAL.js.map +1 -0
  19. package/dist/{dist-4BHW7DCO.js → dist-PRDYMXCX.js} +10 -5
  20. package/dist/dist-PRDYMXCX.js.map +1 -0
  21. package/dist/{dist-3UYQZOAO.js → dist-U2BHTWG4.js} +17 -5
  22. package/dist/dist-U2BHTWG4.js.map +1 -0
  23. package/dist/{dist-T7ESSBCZ.js → dist-VQSZVBT3.js} +20 -6
  24. package/dist/dist-VQSZVBT3.js.map +1 -0
  25. package/dist/index.js +471 -311
  26. package/dist/index.js.map +1 -1
  27. package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
  28. package/package.json +5 -5
  29. package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
  30. package/runtime/docker/packages/ctl/dist/bin.cjs +133 -107
  31. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
  32. package/runtime/e2b/agentbox-setup-skill.md +1 -1
  33. package/runtime/e2b/ctl.cjs +133 -107
  34. package/runtime/hetzner/agentbox-dockerd-start +13 -0
  35. package/runtime/hetzner/agentbox-setup-skill.md +1 -1
  36. package/runtime/hetzner/ctl.cjs +133 -107
  37. package/runtime/relay/bin.cjs +261 -63
  38. package/runtime/vercel/agentbox-dockerd-start +145 -0
  39. package/runtime/vercel/agentbox-setup-skill.md +1 -1
  40. package/runtime/vercel/ctl.cjs +133 -107
  41. package/runtime/vercel/custom-system-CLAUDE.md +5 -4
  42. package/runtime/vercel/scripts/provision.sh +20 -5
  43. package/share/agentbox-setup/SKILL.md +1 -1
  44. package/share/host-skills/agentbox/SKILL.md +2 -2
  45. package/share/host-skills/codex/agentbox.md +10 -2
  46. package/dist/chunk-6QFPYU4Z.js.map +0 -1
  47. package/dist/chunk-OG4KMYOJ.js.map +0 -1
  48. package/dist/chunk-U7IZS2ZP.js.map +0 -1
  49. package/dist/dist-3UYQZOAO.js.map +0 -1
  50. package/dist/dist-4BHW7DCO.js.map +0 -1
  51. package/dist/dist-7BS2JS27.js.map +0 -1
  52. package/dist/dist-T7ESSBCZ.js.map +0 -1
  53. /package/dist/{_cloud-attach-3UC3IL62.js.map → _cloud-attach-YM2KOWHO.js.map} +0 -0
  54. /package/dist/{chunk-5BO6SGMI.js.map → chunk-JK5V4OLT.js.map} +0 -0
  55. /package/dist/{chunk-46NXCJ6Z.js.map → chunk-NXX3KQZ6.js.map} +0 -0
  56. /package/dist/{chunk-3JXSW6PN.js.map → chunk-P6UT5XGE.js.map} +0 -0
  57. /package/dist/{chunk-XWBFWUY2.js.map → chunk-Y6PUCLOE.js.map} +0 -0
  58. /package/dist/{dist-CFSKUAS5.js.map → dist-EKSNZHDY.js.map} +0 -0
  59. /package/dist/{prepared-state-MQHD3M5F-OVABNV66.js.map → prepared-state-MQHD3M5F-5ZMCNY43.js.map} +0 -0
@@ -26,13 +26,13 @@ import {
26
26
  removeBoxRecord,
27
27
  renderCarryEntries,
28
28
  reserveProjectIndex
29
- } from "./chunk-6QFPYU4Z.js";
29
+ } from "./chunk-7K2A3NLE.js";
30
30
 
31
31
  // ../../packages/sandbox-docker/dist/index.js
32
- import { mkdir as mkdir7, stat as stat8 } from "fs/promises";
33
- import { homedir as homedir10 } from "os";
34
- import { basename as basename6, join as join12, resolve as resolve4 } from "path";
35
- import { execa as execa15 } from "execa";
32
+ import { mkdir as mkdir7, stat as stat9 } from "fs/promises";
33
+ import { homedir as homedir12 } from "os";
34
+ import { basename as basename6, join as join13, resolve as resolve4 } from "path";
35
+ import { execa as execa16 } from "execa";
36
36
 
37
37
  // ../../packages/ctl/dist/index.js
38
38
  import { readFile as readFile2 } from "fs/promises";
@@ -2050,7 +2050,7 @@ async function touchProjectMeta(absPath) {
2050
2050
  // ../../packages/sandbox-docker/dist/index.js
2051
2051
  import { spawnSync } from "child_process";
2052
2052
  import { mkdir as mkdir3, mkdtemp as mkdtemp2, readdir as readdir3, readFile as readFile42, realpath as realpath2, rm as rm2, stat as stat3, writeFile as writeFile22 } from "fs/promises";
2053
- import { homedir as homedir3, tmpdir as tmpdir2 } from "os";
2053
+ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
2054
2054
  import { isAbsolute as isAbsolute2, join as join4, relative as relative2 } from "path";
2055
2055
  import { setTimeout as delay } from "timers/promises";
2056
2056
  import { execa as execa6 } from "execa";
@@ -2064,51 +2064,879 @@ import { existsSync, mkdirSync, renameSync, statSync } from "fs";
2064
2064
  import { basename as basename3, dirname as dirname3, posix, resolve as resolve2 } from "path";
2065
2065
  import { execa as execa22 } from "execa";
2066
2066
  import { copyFile, mkdtemp, readdir as readdir22, readFile as readFile32, rm as rm3, stat as stat22, writeFile as writeFile3 } from "fs/promises";
2067
- import { homedir as homedir22, tmpdir } from "os";
2067
+ import { homedir as homedir3, tmpdir } from "os";
2068
2068
  import { basename as basename4, join as join32, relative } from "path";
2069
2069
  import { execa as execa5 } from "execa";
2070
2070
  import { chmod, mkdir as mkdir22, readFile as readFile23 } from "fs/promises";
2071
2071
  import { basename as basename32, join as join22 } from "path";
2072
2072
  import { execa as execa4 } from "execa";
2073
+ import { homedir as homedir22 } from "os";
2074
+
2075
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/date.js
2076
+ var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
2077
+ var TomlDate = class _TomlDate extends Date {
2078
+ #hasDate = false;
2079
+ #hasTime = false;
2080
+ #offset = null;
2081
+ constructor(date) {
2082
+ let hasDate = true;
2083
+ let hasTime = true;
2084
+ let offset = "Z";
2085
+ if (typeof date === "string") {
2086
+ let match = date.match(DATE_TIME_RE);
2087
+ if (match) {
2088
+ if (!match[1]) {
2089
+ hasDate = false;
2090
+ date = `0000-01-01T${date}`;
2091
+ }
2092
+ hasTime = !!match[2];
2093
+ hasTime && date[10] === " " && (date = date.replace(" ", "T"));
2094
+ if (match[2] && +match[2] > 23) {
2095
+ date = "";
2096
+ } else {
2097
+ offset = match[3] || null;
2098
+ date = date.toUpperCase();
2099
+ if (!offset && hasTime)
2100
+ date += "Z";
2101
+ }
2102
+ } else {
2103
+ date = "";
2104
+ }
2105
+ }
2106
+ super(date);
2107
+ if (!isNaN(this.getTime())) {
2108
+ this.#hasDate = hasDate;
2109
+ this.#hasTime = hasTime;
2110
+ this.#offset = offset;
2111
+ }
2112
+ }
2113
+ isDateTime() {
2114
+ return this.#hasDate && this.#hasTime;
2115
+ }
2116
+ isLocal() {
2117
+ return !this.#hasDate || !this.#hasTime || !this.#offset;
2118
+ }
2119
+ isDate() {
2120
+ return this.#hasDate && !this.#hasTime;
2121
+ }
2122
+ isTime() {
2123
+ return this.#hasTime && !this.#hasDate;
2124
+ }
2125
+ isValid() {
2126
+ return this.#hasDate || this.#hasTime;
2127
+ }
2128
+ toISOString() {
2129
+ let iso = super.toISOString();
2130
+ if (this.isDate())
2131
+ return iso.slice(0, 10);
2132
+ if (this.isTime())
2133
+ return iso.slice(11, 23);
2134
+ if (this.#offset === null)
2135
+ return iso.slice(0, -1);
2136
+ if (this.#offset === "Z")
2137
+ return iso;
2138
+ let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
2139
+ offset = this.#offset[0] === "-" ? offset : -offset;
2140
+ let offsetDate = new Date(this.getTime() - offset * 6e4);
2141
+ return offsetDate.toISOString().slice(0, -1) + this.#offset;
2142
+ }
2143
+ static wrapAsOffsetDateTime(jsDate, offset = "Z") {
2144
+ let date = new _TomlDate(jsDate);
2145
+ date.#offset = offset;
2146
+ return date;
2147
+ }
2148
+ static wrapAsLocalDateTime(jsDate) {
2149
+ let date = new _TomlDate(jsDate);
2150
+ date.#offset = null;
2151
+ return date;
2152
+ }
2153
+ static wrapAsLocalDate(jsDate) {
2154
+ let date = new _TomlDate(jsDate);
2155
+ date.#hasTime = false;
2156
+ date.#offset = null;
2157
+ return date;
2158
+ }
2159
+ static wrapAsLocalTime(jsDate) {
2160
+ let date = new _TomlDate(jsDate);
2161
+ date.#hasDate = false;
2162
+ date.#offset = null;
2163
+ return date;
2164
+ }
2165
+ };
2166
+
2167
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/error.js
2168
+ function getLineColFromPtr(string, ptr) {
2169
+ let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
2170
+ return [lines.length, lines.pop().length + 1];
2171
+ }
2172
+ function makeCodeBlock(string, line, column) {
2173
+ let lines = string.split(/\r\n|\n|\r/g);
2174
+ let codeblock = "";
2175
+ let numberLen = (Math.log10(line + 1) | 0) + 1;
2176
+ for (let i = line - 1; i <= line + 1; i++) {
2177
+ let l = lines[i - 1];
2178
+ if (!l)
2179
+ continue;
2180
+ codeblock += i.toString().padEnd(numberLen, " ");
2181
+ codeblock += ": ";
2182
+ codeblock += l;
2183
+ codeblock += "\n";
2184
+ if (i === line) {
2185
+ codeblock += " ".repeat(numberLen + column + 2);
2186
+ codeblock += "^\n";
2187
+ }
2188
+ }
2189
+ return codeblock;
2190
+ }
2191
+ var TomlError = class extends Error {
2192
+ line;
2193
+ column;
2194
+ codeblock;
2195
+ constructor(message, options) {
2196
+ const [line, column] = getLineColFromPtr(options.toml, options.ptr);
2197
+ const codeblock = makeCodeBlock(options.toml, line, column);
2198
+ super(`Invalid TOML document: ${message}
2199
+
2200
+ ${codeblock}`, options);
2201
+ this.line = line;
2202
+ this.column = column;
2203
+ this.codeblock = codeblock;
2204
+ }
2205
+ };
2206
+
2207
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/primitive.js
2208
+ var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
2209
+ var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
2210
+ var LEADING_ZERO = /^[+-]?0[0-9_]/;
2211
+ function parseString(str, ptr) {
2212
+ let c = str[ptr++];
2213
+ let first = c;
2214
+ let isLiteral = c === "'";
2215
+ let isMultiline = c === str[ptr] && c === str[ptr + 1];
2216
+ if (isMultiline) {
2217
+ if (str[ptr += 2] === "\n")
2218
+ ptr++;
2219
+ else if (str[ptr] === "\r" && str[ptr + 1] === "\n")
2220
+ ptr += 2;
2221
+ }
2222
+ let parsed = "";
2223
+ let sliceStart = ptr;
2224
+ let state = 0;
2225
+ for (let i = ptr; i < str.length; i++) {
2226
+ c = str[i];
2227
+ if (isMultiline && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
2228
+ state = state && 3;
2229
+ } else if (c < " " && c !== " " || c === "\x7F") {
2230
+ throw new TomlError("control characters are not allowed in strings", {
2231
+ toml: str,
2232
+ ptr: i
2233
+ });
2234
+ } else if ((!state || state === 3) && c === first && (!isMultiline || str[i + 1] === first && str[i + 2] === first)) {
2235
+ if (isMultiline) {
2236
+ if (str[i + 3] === first)
2237
+ i++;
2238
+ if (str[i + 3] === first)
2239
+ i++;
2240
+ }
2241
+ return [
2242
+ // If we're in a newline escape still, then there's nothing to add.
2243
+ // Also try to avoid concat if there's nothing to add to parsed, or nothing has been added to parsed.
2244
+ state ? parsed : parsed + str.slice(sliceStart, i),
2245
+ i + (isMultiline ? 3 : 1)
2246
+ ];
2247
+ } else if (!state) {
2248
+ if (!isLiteral && c === "\\") {
2249
+ parsed += str.slice(sliceStart, sliceStart = i);
2250
+ state = 1;
2251
+ }
2252
+ } else if (state === 1) {
2253
+ if (c === "x" || c === "u" || c === "U") {
2254
+ let value = 0;
2255
+ let len = c === "x" ? 2 : c === "u" ? 4 : 8;
2256
+ for (let j = 0; j < len; j++, i++) {
2257
+ let hex = str.charCodeAt(i + 1);
2258
+ let digit = (
2259
+ /* 0-9 */
2260
+ hex >= 48 && hex <= 57 ? hex - 48 : (
2261
+ /* A-F */
2262
+ hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
2263
+ /* a-f */
2264
+ hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
2265
+ )
2266
+ )
2267
+ );
2268
+ if (digit < 0)
2269
+ throw new TomlError("invalid non-hex character in unicode escape", { toml: str, ptr: i + 1 });
2270
+ value = value << 4 | digit;
2271
+ }
2272
+ if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
2273
+ throw new TomlError("invalid unicode escape", { toml: str, ptr: i });
2274
+ }
2275
+ parsed += String.fromCodePoint(value);
2276
+ sliceStart = i + 1;
2277
+ state = 0;
2278
+ } else if (c === " " || c === " ") {
2279
+ state = 2;
2280
+ } else {
2281
+ if (c === "b")
2282
+ parsed += "\b";
2283
+ else if (c === "t")
2284
+ parsed += " ";
2285
+ else if (c === "n")
2286
+ parsed += "\n";
2287
+ else if (c === "f")
2288
+ parsed += "\f";
2289
+ else if (c === "r")
2290
+ parsed += "\r";
2291
+ else if (c === "e")
2292
+ parsed += "\x1B";
2293
+ else if (c === '"')
2294
+ parsed += '"';
2295
+ else if (c === "\\")
2296
+ parsed += "\\";
2297
+ else
2298
+ throw new TomlError("unrecognized escape sequence", { toml: str, ptr: i });
2299
+ sliceStart = i + 1;
2300
+ state = 0;
2301
+ }
2302
+ } else if (c !== " " && c !== " ") {
2303
+ if (state === 2) {
2304
+ throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
2305
+ toml: str,
2306
+ ptr: sliceStart
2307
+ });
2308
+ }
2309
+ state = !isLiteral && c === "\\" ? 1 : 0;
2310
+ sliceStart = i;
2311
+ }
2312
+ }
2313
+ throw new TomlError("unfinished string", { toml: str, ptr });
2314
+ }
2315
+ function parseValue(value, toml, ptr, integersAsBigInt) {
2316
+ if (value === "true")
2317
+ return true;
2318
+ if (value === "false")
2319
+ return false;
2320
+ if (value === "-inf")
2321
+ return -Infinity;
2322
+ if (value === "inf" || value === "+inf")
2323
+ return Infinity;
2324
+ if (value === "nan" || value === "+nan" || value === "-nan")
2325
+ return NaN;
2326
+ if (value === "-0")
2327
+ return integersAsBigInt ? 0n : 0;
2328
+ let isInt = INT_REGEX.test(value);
2329
+ if (isInt || FLOAT_REGEX.test(value)) {
2330
+ if (LEADING_ZERO.test(value)) {
2331
+ throw new TomlError("leading zeroes are not allowed", {
2332
+ toml,
2333
+ ptr
2334
+ });
2335
+ }
2336
+ value = value.replace(/_/g, "");
2337
+ let numeric = +value;
2338
+ if (isNaN(numeric)) {
2339
+ throw new TomlError("invalid number", {
2340
+ toml,
2341
+ ptr
2342
+ });
2343
+ }
2344
+ if (isInt) {
2345
+ if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
2346
+ throw new TomlError("integer value cannot be represented losslessly", {
2347
+ toml,
2348
+ ptr
2349
+ });
2350
+ }
2351
+ if (isInt || integersAsBigInt === true)
2352
+ numeric = BigInt(value);
2353
+ }
2354
+ return numeric;
2355
+ }
2356
+ const date = new TomlDate(value);
2357
+ if (!date.isValid()) {
2358
+ throw new TomlError("invalid value", {
2359
+ toml,
2360
+ ptr
2361
+ });
2362
+ }
2363
+ return date;
2364
+ }
2365
+
2366
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/util.js
2367
+ function indexOfNewline(str, start = 0, end = str.length) {
2368
+ let idx = str.indexOf("\n", start);
2369
+ if (str[idx - 1] === "\r")
2370
+ idx--;
2371
+ return idx <= end ? idx : -1;
2372
+ }
2373
+ function skipComment(str, ptr) {
2374
+ for (let i = ptr; i < str.length; i++) {
2375
+ let c = str[i];
2376
+ if (c === "\n")
2377
+ return i;
2378
+ if (c === "\r" && str[i + 1] === "\n")
2379
+ return i + 1;
2380
+ if (c < " " && c !== " " || c === "\x7F") {
2381
+ throw new TomlError("control characters are not allowed in comments", {
2382
+ toml: str,
2383
+ ptr
2384
+ });
2385
+ }
2386
+ }
2387
+ return str.length;
2388
+ }
2389
+ function skipVoid(str, ptr, banNewLines, banComments) {
2390
+ let c;
2391
+ while (1) {
2392
+ while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
2393
+ ptr++;
2394
+ if (banComments || c !== "#")
2395
+ break;
2396
+ ptr = skipComment(str, ptr);
2397
+ }
2398
+ return ptr;
2399
+ }
2400
+ function skipUntil(str, ptr, sep2, end, banNewLines = false) {
2401
+ if (!end) {
2402
+ ptr = indexOfNewline(str, ptr);
2403
+ return ptr < 0 ? str.length : ptr;
2404
+ }
2405
+ for (let i = ptr; i < str.length; i++) {
2406
+ let c = str[i];
2407
+ if (c === "#") {
2408
+ i = indexOfNewline(str, i);
2409
+ } else if (c === sep2) {
2410
+ return i + 1;
2411
+ } else if (c === end || banNewLines && (c === "\n" || c === "\r" && str[i + 1] === "\n")) {
2412
+ return i;
2413
+ }
2414
+ }
2415
+ throw new TomlError("cannot find end of structure", {
2416
+ toml: str,
2417
+ ptr
2418
+ });
2419
+ }
2420
+
2421
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/extract.js
2422
+ function sliceAndTrimEndOf(str, startPtr, endPtr) {
2423
+ let value = str.slice(startPtr, endPtr);
2424
+ let commentIdx = value.indexOf("#");
2425
+ if (commentIdx > -1) {
2426
+ skipComment(str, commentIdx);
2427
+ value = value.slice(0, commentIdx);
2428
+ }
2429
+ return [value.trimEnd(), commentIdx];
2430
+ }
2431
+ function extractValue(str, ptr, end, depth, integersAsBigInt) {
2432
+ if (depth === 0) {
2433
+ throw new TomlError("document contains excessively nested structures. aborting.", {
2434
+ toml: str,
2435
+ ptr
2436
+ });
2437
+ }
2438
+ let c = str[ptr];
2439
+ if (c === "[" || c === "{") {
2440
+ let [value, endPtr2] = c === "[" ? parseArray(str, ptr, depth, integersAsBigInt) : parseInlineTable(str, ptr, depth, integersAsBigInt);
2441
+ if (end) {
2442
+ endPtr2 = skipVoid(str, endPtr2);
2443
+ if (str[endPtr2] === ",")
2444
+ endPtr2++;
2445
+ else if (str[endPtr2] !== end) {
2446
+ throw new TomlError("expected comma or end of structure", {
2447
+ toml: str,
2448
+ ptr: endPtr2
2449
+ });
2450
+ }
2451
+ }
2452
+ return [value, endPtr2];
2453
+ }
2454
+ if (c === '"' || c === "'") {
2455
+ let [parsed, endPtr2] = parseString(str, ptr);
2456
+ if (end) {
2457
+ endPtr2 = skipVoid(str, endPtr2);
2458
+ if (str[endPtr2] && str[endPtr2] !== "," && str[endPtr2] !== end && str[endPtr2] !== "\n" && str[endPtr2] !== "\r") {
2459
+ throw new TomlError("unexpected character encountered", {
2460
+ toml: str,
2461
+ ptr: endPtr2
2462
+ });
2463
+ }
2464
+ if (str[endPtr2] === ",")
2465
+ endPtr2++;
2466
+ }
2467
+ return [parsed, endPtr2];
2468
+ }
2469
+ let endPtr = skipUntil(str, ptr, ",", end);
2470
+ let slice = sliceAndTrimEndOf(str, ptr, endPtr - (str[endPtr - 1] === "," ? 1 : 0));
2471
+ if (!slice[0]) {
2472
+ throw new TomlError("incomplete key-value declaration: no value specified", {
2473
+ toml: str,
2474
+ ptr
2475
+ });
2476
+ }
2477
+ if (end && slice[1] > -1) {
2478
+ endPtr = skipVoid(str, ptr + slice[1]);
2479
+ if (str[endPtr] === ",")
2480
+ endPtr++;
2481
+ }
2482
+ return [
2483
+ parseValue(slice[0], str, ptr, integersAsBigInt),
2484
+ endPtr
2485
+ ];
2486
+ }
2487
+
2488
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/struct.js
2489
+ var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
2490
+ function parseKey(str, ptr, end = "=") {
2491
+ let dot = ptr - 1;
2492
+ let parsed = [];
2493
+ let endPtr = str.indexOf(end, ptr);
2494
+ if (endPtr < 0) {
2495
+ throw new TomlError("incomplete key-value: cannot find end of key", {
2496
+ toml: str,
2497
+ ptr
2498
+ });
2499
+ }
2500
+ do {
2501
+ let c = str[ptr = ++dot];
2502
+ if (c !== " " && c !== " ") {
2503
+ if (c === '"' || c === "'") {
2504
+ if (c === str[ptr + 1] && c === str[ptr + 2]) {
2505
+ throw new TomlError("multiline strings are not allowed in keys", {
2506
+ toml: str,
2507
+ ptr
2508
+ });
2509
+ }
2510
+ let [part, eos] = parseString(str, ptr);
2511
+ dot = str.indexOf(".", eos);
2512
+ let strEnd = str.slice(eos, dot < 0 || dot > endPtr ? endPtr : dot);
2513
+ let newLine = indexOfNewline(strEnd);
2514
+ if (newLine > -1) {
2515
+ throw new TomlError("newlines are not allowed in keys", {
2516
+ toml: str,
2517
+ ptr: ptr + dot + newLine
2518
+ });
2519
+ }
2520
+ if (strEnd.trimStart()) {
2521
+ throw new TomlError("found extra tokens after the string part", {
2522
+ toml: str,
2523
+ ptr: eos
2524
+ });
2525
+ }
2526
+ if (endPtr < eos) {
2527
+ endPtr = str.indexOf(end, eos);
2528
+ if (endPtr < 0) {
2529
+ throw new TomlError("incomplete key-value: cannot find end of key", {
2530
+ toml: str,
2531
+ ptr
2532
+ });
2533
+ }
2534
+ }
2535
+ parsed.push(part);
2536
+ } else {
2537
+ dot = str.indexOf(".", ptr);
2538
+ let part = str.slice(ptr, dot < 0 || dot > endPtr ? endPtr : dot);
2539
+ if (!KEY_PART_RE.test(part)) {
2540
+ throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
2541
+ toml: str,
2542
+ ptr
2543
+ });
2544
+ }
2545
+ parsed.push(part.trimEnd());
2546
+ }
2547
+ }
2548
+ } while (dot + 1 && dot < endPtr);
2549
+ return [parsed, skipVoid(str, endPtr + 1, true, true)];
2550
+ }
2551
+ function parseInlineTable(str, ptr, depth, integersAsBigInt) {
2552
+ let res = {};
2553
+ let seen = /* @__PURE__ */ new Set();
2554
+ let c;
2555
+ ptr++;
2556
+ while ((c = str[ptr++]) !== "}" && c) {
2557
+ if (c === ",") {
2558
+ throw new TomlError("expected value, found comma", {
2559
+ toml: str,
2560
+ ptr: ptr - 1
2561
+ });
2562
+ } else if (c === "#")
2563
+ ptr = skipComment(str, ptr);
2564
+ else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
2565
+ let k;
2566
+ let t = res;
2567
+ let hasOwn = false;
2568
+ let [key, keyEndPtr] = parseKey(str, ptr - 1);
2569
+ for (let i = 0; i < key.length; i++) {
2570
+ if (i)
2571
+ t = hasOwn ? t[k] : t[k] = {};
2572
+ k = key[i];
2573
+ if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
2574
+ throw new TomlError("trying to redefine an already defined value", {
2575
+ toml: str,
2576
+ ptr
2577
+ });
2578
+ }
2579
+ if (!hasOwn && k === "__proto__") {
2580
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
2581
+ }
2582
+ }
2583
+ if (hasOwn) {
2584
+ throw new TomlError("trying to redefine an already defined value", {
2585
+ toml: str,
2586
+ ptr
2587
+ });
2588
+ }
2589
+ let [value, valueEndPtr] = extractValue(str, keyEndPtr, "}", depth - 1, integersAsBigInt);
2590
+ seen.add(value);
2591
+ t[k] = value;
2592
+ ptr = valueEndPtr;
2593
+ }
2594
+ }
2595
+ if (!c) {
2596
+ throw new TomlError("unfinished table encountered", {
2597
+ toml: str,
2598
+ ptr
2599
+ });
2600
+ }
2601
+ return [res, ptr];
2602
+ }
2603
+ function parseArray(str, ptr, depth, integersAsBigInt) {
2604
+ let res = [];
2605
+ let c;
2606
+ ptr++;
2607
+ while ((c = str[ptr++]) !== "]" && c) {
2608
+ if (c === ",") {
2609
+ throw new TomlError("expected value, found comma", {
2610
+ toml: str,
2611
+ ptr: ptr - 1
2612
+ });
2613
+ } else if (c === "#")
2614
+ ptr = skipComment(str, ptr);
2615
+ else if (c !== " " && c !== " " && c !== "\n" && c !== "\r") {
2616
+ let e = extractValue(str, ptr - 1, "]", depth - 1, integersAsBigInt);
2617
+ res.push(e[0]);
2618
+ ptr = e[1];
2619
+ }
2620
+ }
2621
+ if (!c) {
2622
+ throw new TomlError("unfinished array encountered", {
2623
+ toml: str,
2624
+ ptr
2625
+ });
2626
+ }
2627
+ return [res, ptr];
2628
+ }
2629
+
2630
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/parse.js
2631
+ function peekTable(key, table, meta, type) {
2632
+ let t = table;
2633
+ let m = meta;
2634
+ let k;
2635
+ let hasOwn = false;
2636
+ let state;
2637
+ for (let i = 0; i < key.length; i++) {
2638
+ if (i) {
2639
+ t = hasOwn ? t[k] : t[k] = {};
2640
+ m = (state = m[k]).c;
2641
+ if (type === 0 && (state.t === 1 || state.t === 2)) {
2642
+ return null;
2643
+ }
2644
+ if (state.t === 2) {
2645
+ let l = t.length - 1;
2646
+ t = t[l];
2647
+ m = m[l].c;
2648
+ }
2649
+ }
2650
+ k = key[i];
2651
+ if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
2652
+ return null;
2653
+ }
2654
+ if (!hasOwn) {
2655
+ if (k === "__proto__") {
2656
+ Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
2657
+ Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
2658
+ }
2659
+ m[k] = {
2660
+ t: i < key.length - 1 && type === 2 ? 3 : type,
2661
+ d: false,
2662
+ i: 0,
2663
+ c: {}
2664
+ };
2665
+ }
2666
+ }
2667
+ state = m[k];
2668
+ if (state.t !== type && !(type === 1 && state.t === 3)) {
2669
+ return null;
2670
+ }
2671
+ if (type === 2) {
2672
+ if (!state.d) {
2673
+ state.d = true;
2674
+ t[k] = [];
2675
+ }
2676
+ t[k].push(t = {});
2677
+ state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
2678
+ }
2679
+ if (state.d) {
2680
+ return null;
2681
+ }
2682
+ state.d = true;
2683
+ if (type === 1) {
2684
+ t = hasOwn ? t[k] : t[k] = {};
2685
+ } else if (type === 0 && hasOwn) {
2686
+ return null;
2687
+ }
2688
+ return [k, t, state.c];
2689
+ }
2690
+ function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
2691
+ let res = {};
2692
+ let meta = {};
2693
+ let tbl = res;
2694
+ let m = meta;
2695
+ for (let ptr = skipVoid(toml, 0); ptr < toml.length; ) {
2696
+ if (toml[ptr] === "[") {
2697
+ let isTableArray = toml[++ptr] === "[";
2698
+ let k = parseKey(toml, ptr += +isTableArray, "]");
2699
+ if (isTableArray) {
2700
+ if (toml[k[1] - 1] !== "]") {
2701
+ throw new TomlError("expected end of table declaration", {
2702
+ toml,
2703
+ ptr: k[1] - 1
2704
+ });
2705
+ }
2706
+ k[1]++;
2707
+ }
2708
+ let p = peekTable(
2709
+ k[0],
2710
+ res,
2711
+ meta,
2712
+ isTableArray ? 2 : 1
2713
+ /* Type.EXPLICIT */
2714
+ );
2715
+ if (!p) {
2716
+ throw new TomlError("trying to redefine an already defined table or value", {
2717
+ toml,
2718
+ ptr
2719
+ });
2720
+ }
2721
+ m = p[2];
2722
+ tbl = p[1];
2723
+ ptr = k[1];
2724
+ } else {
2725
+ let k = parseKey(toml, ptr);
2726
+ let p = peekTable(
2727
+ k[0],
2728
+ tbl,
2729
+ m,
2730
+ 0
2731
+ /* Type.DOTTED */
2732
+ );
2733
+ if (!p) {
2734
+ throw new TomlError("trying to redefine an already defined table or value", {
2735
+ toml,
2736
+ ptr
2737
+ });
2738
+ }
2739
+ let v = extractValue(toml, k[1], void 0, maxDepth, integersAsBigInt);
2740
+ p[1][p[0]] = v[0];
2741
+ ptr = v[1];
2742
+ }
2743
+ ptr = skipVoid(toml, ptr, true);
2744
+ if (toml[ptr] && toml[ptr] !== "\n" && toml[ptr] !== "\r") {
2745
+ throw new TomlError("each key-value declaration must be followed by an end-of-line", {
2746
+ toml,
2747
+ ptr
2748
+ });
2749
+ }
2750
+ ptr = skipVoid(toml, ptr);
2751
+ }
2752
+ return res;
2753
+ }
2754
+
2755
+ // ../../node_modules/.pnpm/smol-toml@1.7.0/node_modules/smol-toml/dist/stringify.js
2756
+ var BARE_KEY = /^[a-z0-9-_]+$/i;
2757
+ function extendedTypeOf(obj) {
2758
+ let type = typeof obj;
2759
+ if (type === "object") {
2760
+ if (Array.isArray(obj))
2761
+ return "array";
2762
+ if (obj instanceof Date)
2763
+ return "date";
2764
+ }
2765
+ return type;
2766
+ }
2767
+ function isArrayOfTables(obj) {
2768
+ for (let i = 0; i < obj.length; i++) {
2769
+ if (extendedTypeOf(obj[i]) !== "object")
2770
+ return false;
2771
+ }
2772
+ return obj.length != 0;
2773
+ }
2774
+ function formatString(s) {
2775
+ return JSON.stringify(s).replace(/\x7f/g, "\\u007f");
2776
+ }
2777
+ function stringifyValue(val, type, depth, numberAsFloat) {
2778
+ if (depth === 0) {
2779
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
2780
+ }
2781
+ if (type === "number") {
2782
+ if (isNaN(val))
2783
+ return "nan";
2784
+ if (val === Infinity)
2785
+ return "inf";
2786
+ if (val === -Infinity)
2787
+ return "-inf";
2788
+ if (Number.isInteger(val) && (numberAsFloat || !Number.isSafeInteger(val)))
2789
+ return val.toFixed(1);
2790
+ return val.toString();
2791
+ }
2792
+ if (type === "bigint" || type === "boolean") {
2793
+ return val.toString();
2794
+ }
2795
+ if (type === "string") {
2796
+ return formatString(val);
2797
+ }
2798
+ if (type === "date") {
2799
+ if (isNaN(val.getTime())) {
2800
+ throw new TypeError("cannot serialize invalid date");
2801
+ }
2802
+ return val.toISOString();
2803
+ }
2804
+ if (type === "object") {
2805
+ return stringifyInlineTable(val, depth, numberAsFloat);
2806
+ }
2807
+ if (type === "array") {
2808
+ return stringifyArray(val, depth, numberAsFloat);
2809
+ }
2810
+ }
2811
+ function stringifyInlineTable(obj, depth, numberAsFloat) {
2812
+ let keys = Object.keys(obj);
2813
+ if (keys.length === 0)
2814
+ return "{}";
2815
+ let res = "{ ";
2816
+ for (let i = 0; i < keys.length; i++) {
2817
+ let k = keys[i];
2818
+ if (i)
2819
+ res += ", ";
2820
+ res += BARE_KEY.test(k) ? k : formatString(k);
2821
+ res += " = ";
2822
+ res += stringifyValue(obj[k], extendedTypeOf(obj[k]), depth - 1, numberAsFloat);
2823
+ }
2824
+ return res + " }";
2825
+ }
2826
+ function stringifyArray(array, depth, numberAsFloat) {
2827
+ if (array.length === 0)
2828
+ return "[]";
2829
+ let res = "[ ";
2830
+ for (let i = 0; i < array.length; i++) {
2831
+ if (i)
2832
+ res += ", ";
2833
+ if (array[i] === null || array[i] === void 0) {
2834
+ throw new TypeError("arrays cannot contain null or undefined values");
2835
+ }
2836
+ res += stringifyValue(array[i], extendedTypeOf(array[i]), depth - 1, numberAsFloat);
2837
+ }
2838
+ return res + " ]";
2839
+ }
2840
+ function stringifyArrayTable(array, key, depth, numberAsFloat) {
2841
+ if (depth === 0) {
2842
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
2843
+ }
2844
+ let res = "";
2845
+ for (let i = 0; i < array.length; i++) {
2846
+ res += `${res && "\n"}[[${key}]]
2847
+ `;
2848
+ res += stringifyTable(0, array[i], key, depth, numberAsFloat);
2849
+ }
2850
+ return res;
2851
+ }
2852
+ function stringifyTable(tableKey, obj, prefix, depth, numberAsFloat) {
2853
+ if (depth === 0) {
2854
+ throw new Error("Could not stringify the object: maximum object depth exceeded");
2855
+ }
2856
+ let preamble = "";
2857
+ let tables = "";
2858
+ let keys = Object.keys(obj);
2859
+ for (let i = 0; i < keys.length; i++) {
2860
+ let k = keys[i];
2861
+ if (obj[k] !== null && obj[k] !== void 0) {
2862
+ let type = extendedTypeOf(obj[k]);
2863
+ if (type === "symbol" || type === "function") {
2864
+ throw new TypeError(`cannot serialize values of type '${type}'`);
2865
+ }
2866
+ let key = BARE_KEY.test(k) ? k : formatString(k);
2867
+ if (type === "array" && isArrayOfTables(obj[k])) {
2868
+ tables += (tables && "\n") + stringifyArrayTable(obj[k], prefix ? `${prefix}.${key}` : key, depth - 1, numberAsFloat);
2869
+ } else if (type === "object") {
2870
+ let tblKey = prefix ? `${prefix}.${key}` : key;
2871
+ tables += (tables && "\n") + stringifyTable(tblKey, obj[k], tblKey, depth - 1, numberAsFloat);
2872
+ } else {
2873
+ preamble += key;
2874
+ preamble += " = ";
2875
+ preamble += stringifyValue(obj[k], type, depth, numberAsFloat);
2876
+ preamble += "\n";
2877
+ }
2878
+ }
2879
+ }
2880
+ if (tableKey && (preamble || !tables))
2881
+ preamble = preamble ? `[${tableKey}]
2882
+ ${preamble}` : `[${tableKey}]`;
2883
+ return preamble && tables ? `${preamble}
2884
+ ${tables}` : preamble || tables;
2885
+ }
2886
+ function stringify(obj, { maxDepth = 1e3, numbersAsFloat = false } = {}) {
2887
+ if (extendedTypeOf(obj) !== "object") {
2888
+ throw new TypeError("stringify can only be called with an object");
2889
+ }
2890
+ let str = stringifyTable(0, obj, "", maxDepth, numbersAsFloat);
2891
+ if (str[str.length - 1] !== "\n")
2892
+ return str + "\n";
2893
+ return str;
2894
+ }
2895
+
2896
+ // ../../packages/sandbox-docker/dist/index.js
2073
2897
  import { spawnSync as spawnSync2 } from "child_process";
2074
- import { stat as stat42 } from "fs/promises";
2075
- import { homedir as homedir4 } from "os";
2898
+ import { readFile as readFile52, stat as stat42 } from "fs/promises";
2899
+ import { homedir as homedir5 } from "os";
2076
2900
  import { join as join52 } from "path";
2077
2901
  import { execa as execa7 } from "execa";
2078
- import { spawnSync as spawnSync3 } from "child_process";
2079
2902
  import { stat as stat5 } from "fs/promises";
2080
- import { homedir as homedir5 } from "os";
2903
+ import { homedir as homedir6 } from "os";
2081
2904
  import { join as join6 } from "path";
2082
2905
  import { execa as execa8 } from "execa";
2083
- import { randomBytes as randomBytes2 } from "crypto";
2084
- import { createHash as createHash22 } from "crypto";
2085
- import { readFile as readFile52 } from "fs/promises";
2906
+ import { spawnSync as spawnSync3 } from "child_process";
2907
+ import { stat as stat6 } from "fs/promises";
2908
+ import { homedir as homedir7 } from "os";
2086
2909
  import { join as join7 } from "path";
2087
2910
  import { execa as execa9 } from "execa";
2088
- import { existsSync as existsSync2 } from "fs";
2911
+ import { randomBytes as randomBytes2 } from "crypto";
2912
+ import { createHash as createHash22 } from "crypto";
2089
2913
  import { readFile as readFile6 } from "fs/promises";
2090
- import { homedir as homedir6 } from "os";
2091
2914
  import { join as join8 } from "path";
2092
2915
  import { execa as execa10 } from "execa";
2916
+ import { existsSync as existsSync2 } from "fs";
2917
+ import { readFile as readFile7 } from "fs/promises";
2918
+ import { homedir as homedir8 } from "os";
2919
+ import { join as join9 } from "path";
2093
2920
  import { execa as execa11 } from "execa";
2094
- import { mkdir as mkdir42, readdir as readdir42, rm as rm32, stat as stat6 } from "fs/promises";
2095
- import { homedir as homedir7, platform } from "os";
2096
- import { join as join9, resolve as resolve22 } from "path";
2097
- import { mkdir as mkdir5, mkdtemp as mkdtemp3, readFile as readFile7, readdir as readdir5, rm as rm4, writeFile as writeFile32 } from "fs/promises";
2098
- import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
2099
- import { basename as basename5, join as join10 } from "path";
2100
2921
  import { execa as execa12 } from "execa";
2101
- import { stat as stat7 } from "fs/promises";
2922
+ import { mkdir as mkdir42, readdir as readdir42, rm as rm32, stat as stat7 } from "fs/promises";
2923
+ import { homedir as homedir9, platform } from "os";
2924
+ import { join as join10, resolve as resolve22 } from "path";
2925
+ import { mkdir as mkdir5, mkdtemp as mkdtemp3, readFile as readFile8, readdir as readdir5, rm as rm4, writeFile as writeFile32 } from "fs/promises";
2926
+ import { homedir as homedir10, tmpdir as tmpdir3 } from "os";
2927
+ import { basename as basename5, join as join11 } from "path";
2102
2928
  import { execa as execa13 } from "execa";
2929
+ import { stat as stat8 } from "fs/promises";
2103
2930
  import { execa as execa14 } from "execa";
2931
+ import { execa as execa15 } from "execa";
2104
2932
  import { spawn } from "child_process";
2105
2933
  import { randomBytes as randomBytes22 } from "crypto";
2106
2934
  import { existsSync as existsSync3, openSync } from "fs";
2107
- import { cp, mkdir as mkdir6, readFile as readFile8, readdir as readdir6, rename as rename3, rm as rm5, unlink as unlink2, writeFile as writeFile4 } from "fs/promises";
2935
+ import { cp, mkdir as mkdir6, readFile as readFile9, readdir as readdir6, rename as rename3, rm as rm5, unlink as unlink2, writeFile as writeFile4 } from "fs/promises";
2108
2936
  import { request as httpRequest } from "http";
2109
2937
  import { createRequire } from "module";
2110
- import { homedir as homedir9 } from "os";
2111
- import { dirname as dirname32, join as join11, resolve as resolve3, sep } from "path";
2938
+ import { homedir as homedir11 } from "os";
2939
+ import { dirname as dirname32, join as join12, resolve as resolve3, sep } from "path";
2112
2940
  import { setTimeout as delay2 } from "timers/promises";
2113
2941
  import { fileURLToPath } from "url";
2114
2942
 
@@ -2608,21 +3436,22 @@ var QUEUE_LOGS_DIR = join3(STATE_DIR, "logs");
2608
3436
  function queueLogPath(id) {
2609
3437
  return join3(QUEUE_LOGS_DIR, `queue-${id}.log`);
2610
3438
  }
3439
+ var FAILURE_BACKOFF_MS = 5 * 6e4;
2611
3440
 
2612
3441
  // ../../packages/sandbox-docker/dist/index.js
3442
+ import { execa as execa18 } from "execa";
3443
+ import { readdir as readdir7, rm as rm6, stat as stat10 } from "fs/promises";
3444
+ import { join as join15 } from "path";
2613
3445
  import { execa as execa17 } from "execa";
2614
- import { readdir as readdir7, rm as rm6, stat as stat9 } from "fs/promises";
2615
3446
  import { join as join14 } from "path";
2616
- import { execa as execa16 } from "execa";
2617
- import { join as join13 } from "path";
2618
- import { homedir as homedir11 } from "os";
2619
- import { join as join15 } from "path";
2620
- import { execa as execa18 } from "execa";
2621
- import { createHash as createHash32 } from "crypto";
2622
- import { copyFile as copyFile2, mkdir as mkdir8, mkdtemp as mkdtemp4, readdir as readdir8, readFile as readFile9, rm as rm7, stat as stat10 } from "fs/promises";
2623
- import { homedir as homedir12, tmpdir as tmpdir4 } from "os";
2624
- import { basename as basename7, dirname as dirname4, join as join16 } from "path";
3447
+ import { homedir as homedir13 } from "os";
3448
+ import { join as join16 } from "path";
2625
3449
  import { execa as execa19 } from "execa";
3450
+ import { createHash as createHash32 } from "crypto";
3451
+ import { copyFile as copyFile2, mkdir as mkdir8, mkdtemp as mkdtemp4, readdir as readdir8, readFile as readFile10, rm as rm7, stat as stat11 } from "fs/promises";
3452
+ import { homedir as homedir14, tmpdir as tmpdir4 } from "os";
3453
+ import { basename as basename7, dirname as dirname4, join as join17 } from "path";
3454
+ import { execa as execa20 } from "execa";
2626
3455
  function isHostPathHookCommand(command, hostHome) {
2627
3456
  if (typeof command !== "string" || command.length === 0) return false;
2628
3457
  if (hostHome.length === 0) return false;
@@ -3837,6 +4666,75 @@ async function syncClaudeCredentials(spec, opts) {
3837
4666
  return { direction: "noop", volumeHasCredentials: false };
3838
4667
  }
3839
4668
  }
4669
+ function isHostOnlyPath(cmd, hostHome) {
4670
+ if (typeof cmd !== "string" || cmd.length === 0) return false;
4671
+ if (!cmd.startsWith("/")) return false;
4672
+ const hostOnlyRoots = [
4673
+ hostHome.endsWith("/") ? hostHome : `${hostHome}/`,
4674
+ "/Applications/",
4675
+ "/opt/homebrew/",
4676
+ "/Library/",
4677
+ "/System/",
4678
+ "/private/",
4679
+ "/Users/"
4680
+ ];
4681
+ return hostOnlyRoots.some((root) => cmd.startsWith(root));
4682
+ }
4683
+ function isRecord(v) {
4684
+ return typeof v === "object" && v !== null && !Array.isArray(v);
4685
+ }
4686
+ var BOX_WORKSPACE = "/workspace";
4687
+ var MINIMAL_TRUSTED_CODEX_CONFIG = `[projects."${BOX_WORKSPACE}"]
4688
+ trust_level = "trusted"
4689
+ `;
4690
+ function sanitizeCodexConfigForBox(tomlText, hostHome = homedir22()) {
4691
+ const cfg = parse(tomlText);
4692
+ let changed = false;
4693
+ if (isRecord(cfg["mcp_servers"])) {
4694
+ const servers = cfg["mcp_servers"];
4695
+ for (const [name, def] of Object.entries(servers)) {
4696
+ if (isRecord(def) && isHostOnlyPath(def["command"], hostHome)) {
4697
+ delete servers[name];
4698
+ changed = true;
4699
+ }
4700
+ }
4701
+ }
4702
+ const notify = cfg["notify"];
4703
+ if (Array.isArray(notify) && isHostOnlyPath(notify[0], hostHome)) {
4704
+ delete cfg["notify"];
4705
+ changed = true;
4706
+ }
4707
+ const droppedMarkets = /* @__PURE__ */ new Set();
4708
+ if (isRecord(cfg["marketplaces"])) {
4709
+ const markets = cfg["marketplaces"];
4710
+ for (const [name, def] of Object.entries(markets)) {
4711
+ if (isRecord(def) && def["source_type"] === "local" && isHostOnlyPath(def["source"], hostHome)) {
4712
+ delete markets[name];
4713
+ droppedMarkets.add(name);
4714
+ changed = true;
4715
+ }
4716
+ }
4717
+ }
4718
+ if (droppedMarkets.size > 0 && isRecord(cfg["plugins"])) {
4719
+ const plugins = cfg["plugins"];
4720
+ for (const key of Object.keys(plugins)) {
4721
+ const marketplace = key.split("@")[1];
4722
+ if (marketplace !== void 0 && droppedMarkets.has(marketplace)) {
4723
+ delete plugins[key];
4724
+ changed = true;
4725
+ }
4726
+ }
4727
+ }
4728
+ if (!isRecord(cfg["projects"])) cfg["projects"] = {};
4729
+ const projects = cfg["projects"];
4730
+ const wsEntry = isRecord(projects[BOX_WORKSPACE]) ? projects[BOX_WORKSPACE] : {};
4731
+ if (wsEntry["trust_level"] !== "trusted") {
4732
+ wsEntry["trust_level"] = "trusted";
4733
+ projects[BOX_WORKSPACE] = wsEntry;
4734
+ changed = true;
4735
+ }
4736
+ return { text: changed ? stringify(cfg) : tomlText, changed };
4737
+ }
3840
4738
  var CLOUD_WORKSPACE = "/workspace";
3841
4739
  async function pathExists(p) {
3842
4740
  try {
@@ -3935,7 +4833,7 @@ function encodeClaudeProjectsKey(absPath) {
3935
4833
  return absPath.replace(/[^a-zA-Z0-9]/g, "-");
3936
4834
  }
3937
4835
  var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
3938
- async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir22()) {
4836
+ async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir3()) {
3939
4837
  if (hostWorkspace.length === 0) return null;
3940
4838
  const memDir = join32(
3941
4839
  hostHome,
@@ -3990,7 +4888,7 @@ async function buildBoxClaudeJsonFromHost(opts) {
3990
4888
  return working;
3991
4889
  }
3992
4890
  async function stageClaudeJsonOnlyForUpload(opts = {}) {
3993
- const hostHome = opts.hostHome ?? homedir22();
4891
+ const hostHome = opts.hostHome ?? homedir3();
3994
4892
  const stageDir = await mkStageDir("claude-json-only");
3995
4893
  let tarballPath = null;
3996
4894
  try {
@@ -4012,7 +4910,7 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
4012
4910
  }
4013
4911
  }
4014
4912
  async function stageClaudeStaticForUpload(opts = {}) {
4015
- const hostHome = opts.hostHome ?? homedir22();
4913
+ const hostHome = opts.hostHome ?? homedir3();
4016
4914
  const hostClaude = join32(hostHome, ".claude");
4017
4915
  if (!await pathExists(hostClaude)) return emptyResult();
4018
4916
  const stageDir = await mkStageDir("claude-static");
@@ -4083,12 +4981,16 @@ var CODEX_RSYNC_EXCLUDES = [
4083
4981
  "--exclude=log",
4084
4982
  "--exclude=history.jsonl",
4085
4983
  "--exclude=hooks.json",
4086
- "--exclude=logs_2.sqlite",
4087
- "--exclude=logs_2.sqlite-shm",
4088
- "--exclude=logs_2.sqlite-wal",
4089
- "--exclude=state_5.sqlite",
4090
- "--exclude=state_5.sqlite-shm",
4091
- "--exclude=state_5.sqlite-wal",
4984
+ // Codex's session-state DBs / indexes — the `state_*.sqlite` `threads` index
4985
+ // is where Codex reads the resume cwd, so seeding the host copy makes a
4986
+ // teleported session resume at its host cwd (the "Choose working directory"
4987
+ // prompt). Globbed on the version suffix (state_5 -> state_6 across schema
4988
+ // bumps) so it keeps matching. Codex rebuilds the index from the box's
4989
+ // rollouts (see `backfill_state`). Also stops the host's cross-project Codex
4990
+ // history from leaking into the box.
4991
+ "--exclude=state_*.sqlite*",
4992
+ "--exclude=logs_*.sqlite*",
4993
+ "--exclude=external_agent_session_imports.json",
4092
4994
  "--exclude=sqlite",
4093
4995
  "--exclude=cache",
4094
4996
  "--exclude=vendor_imports",
@@ -4106,8 +5008,16 @@ var CODEX_RSYNC_EXCLUDES = [
4106
5008
  "--exclude=version.json"
4107
5009
  ];
4108
5010
  var CODEX_KEYCHAIN_WARNING = 'codex: ~/.codex/auth.json missing. On macOS the codex CLI defaults to storing the OAuth token in the system Keychain, which isn\'t reachable from a remote sandbox. To share creds with cloud boxes either:\n - add `cli_auth_credentials_store = "file"` to ~/.codex/config.toml then re-run `codex login`, or\n - set OPENAI_API_KEY in your environment, or\n - run `codex login --with-api-key` for a file-backed login.\nSkipping codex seed; in-box codex will prompt for sign-in.';
5011
+ async function sanitizeStagedCodexConfig(configPath, hostHome) {
5012
+ try {
5013
+ if (!await pathExists(configPath)) return;
5014
+ const { text, changed } = sanitizeCodexConfigForBox(await readFile32(configPath, "utf8"), hostHome);
5015
+ if (changed) await writeFile3(configPath, text);
5016
+ } catch {
5017
+ }
5018
+ }
4109
5019
  async function stageCodexStaticForUpload(opts = {}) {
4110
- const hostHome = opts.hostHome ?? homedir22();
5020
+ const hostHome = opts.hostHome ?? homedir3();
4111
5021
  const hostCodex = join32(hostHome, ".codex");
4112
5022
  if (!await pathExists(hostCodex)) return emptyResult();
4113
5023
  const stageDir = await mkStageDir("codex-static");
@@ -4123,6 +5033,7 @@ async function stageCodexStaticForUpload(opts = {}) {
4123
5033
  `${hostCodex}/`,
4124
5034
  `${stageDir}/`
4125
5035
  ]);
5036
+ await sanitizeStagedCodexConfig(join32(stageDir, "config.toml"), hostHome);
4126
5037
  tarballPath = await tarballFromDir(stageDir, "codex-static");
4127
5038
  return {
4128
5039
  tarballPath,
@@ -4135,8 +5046,35 @@ async function stageCodexStaticForUpload(opts = {}) {
4135
5046
  throw err;
4136
5047
  }
4137
5048
  }
5049
+ async function stageAgentsStaticForUpload(opts = {}) {
5050
+ const hostHome = opts.hostHome ?? homedir3();
5051
+ const hostAgents = join32(hostHome, ".agents");
5052
+ if (!await pathExists(hostAgents)) return emptyResult();
5053
+ const stageDir = await mkStageDir("agents-static");
5054
+ let tarballPath = null;
5055
+ try {
5056
+ const broken = await findBrokenSymlinks(hostAgents);
5057
+ await execa5("rsync", [
5058
+ "-a",
5059
+ "-L",
5060
+ ...broken.map((r) => `--exclude=/${r}`),
5061
+ `${hostAgents}/`,
5062
+ `${stageDir}/`
5063
+ ]);
5064
+ tarballPath = await tarballFromDir(stageDir, "agents-static");
5065
+ return {
5066
+ tarballPath,
5067
+ cleanup: makeCleanup([stageDir, tarballPath]),
5068
+ warnings: []
5069
+ };
5070
+ } catch (err) {
5071
+ await rm3(stageDir, { recursive: true, force: true });
5072
+ if (tarballPath) await rm3(tarballPath, { force: true });
5073
+ throw err;
5074
+ }
5075
+ }
4138
5076
  async function stageCodexCredentialsForUpload(opts = {}) {
4139
- const hostHome = opts.hostHome ?? homedir22();
5077
+ const hostHome = opts.hostHome ?? homedir3();
4140
5078
  const cloudBackup = join32(hostHome, ".agentbox", "codex-credentials.json");
4141
5079
  if (await pathExists(cloudBackup)) {
4142
5080
  return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
@@ -4159,7 +5097,7 @@ var OPENCODE_DATA_EXCLUDES = [
4159
5097
  "--exclude=opencode.db-wal"
4160
5098
  ];
4161
5099
  async function stageOpencodeStaticForUpload(opts = {}) {
4162
- const hostHome = opts.hostHome ?? homedir22();
5100
+ const hostHome = opts.hostHome ?? homedir3();
4163
5101
  const hostData = join32(hostHome, ".local", "share", "opencode");
4164
5102
  const hostConfig = join32(hostHome, ".config", "opencode");
4165
5103
  const hasData = await pathExists(hostData);
@@ -4204,7 +5142,7 @@ async function stageOpencodeStaticForUpload(opts = {}) {
4204
5142
  }
4205
5143
  }
4206
5144
  async function stageOpencodeCredentialsForUpload(opts = {}) {
4207
- const hostHome = opts.hostHome ?? homedir22();
5145
+ const hostHome = opts.hostHome ?? homedir3();
4208
5146
  const cloudBackup = join32(hostHome, ".agentbox", "opencode-credentials.json");
4209
5147
  if (await pathExists(cloudBackup)) {
4210
5148
  return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
@@ -4214,7 +5152,7 @@ async function stageOpencodeCredentialsForUpload(opts = {}) {
4214
5152
  return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
4215
5153
  }
4216
5154
  async function stageOpencodeStateForUpload(opts = {}) {
4217
- const hostHome = opts.hostHome ?? homedir22();
5155
+ const hostHome = opts.hostHome ?? homedir3();
4218
5156
  const hostModel = join32(hostHome, ".local", "state", "opencode", "model.json");
4219
5157
  if (!await pathExists(hostModel)) return emptyResult();
4220
5158
  return stageSingleFileTarball("opencode-state", hostModel, "model.json");
@@ -4296,13 +5234,13 @@ async function ensureClaudeVolume(spec, opts) {
4296
5234
  await ensureVolume(spec.volume);
4297
5235
  const created = !existed;
4298
5236
  if (!opts.syncFromHost) return { created, synced: false };
4299
- const hostClaude = join4(homedir3(), ".claude");
5237
+ const hostClaude = join4(homedir4(), ".claude");
4300
5238
  if (!await pathExists2(hostClaude)) return { created, synced: false };
4301
- const hostClaudeJson = join4(homedir3(), ".claude.json");
5239
+ const hostClaudeJson = join4(homedir4(), ".claude.json");
4302
5240
  const hasJson = await pathExists2(hostClaudeJson);
4303
5241
  const seedClaudeJson = !await volumeHasClaudeJson(spec.volume, opts.image);
4304
- const hostHome = homedir3();
4305
- const hostAgents = join4(homedir3(), ".agents");
5242
+ const hostHome = homedir4();
5243
+ const hostAgents = join4(homedir4(), ".agents");
4306
5244
  const hasAgents = await pathExists2(hostAgents);
4307
5245
  const args = [
4308
5246
  "run",
@@ -5019,7 +5957,7 @@ async function readJsonFile(path) {
5019
5957
  }
5020
5958
  }
5021
5959
  async function pullClaudeExtras(spec, opts) {
5022
- const hostHome = homedir3();
5960
+ const hostHome = homedir4();
5023
5961
  const hostClaude = join4(hostHome, ".claude");
5024
5962
  const inventoryScript = [
5025
5963
  "for cat in skills agents commands; do",
@@ -5188,9 +6126,12 @@ async function ensureCodexVolume(spec, opts) {
5188
6126
  const existed = await volumeExists(spec.volume);
5189
6127
  await ensureVolume(spec.volume);
5190
6128
  const created = !existed;
5191
- const hostCodex = join52(homedir4(), ".codex");
6129
+ const hostCodex = join52(homedir5(), ".codex");
5192
6130
  const willSync = opts.syncFromHost && await pathExists3(hostCodex);
5193
6131
  if (willSync) {
6132
+ const hasAgents = await pathExists3(join52(homedir5(), ".agents"));
6133
+ const skillsExclude = hasAgents ? " --exclude=skills" : "";
6134
+ const skillsPurge = hasAgents ? " && { [ -d /dst/skills ] && find /dst/skills -mindepth 1 -maxdepth 1 ! -name .system -exec rm -rf {} + || true; }" : "";
5194
6135
  await execa7("docker", [
5195
6136
  "run",
5196
6137
  "--rm",
@@ -5205,8 +6146,18 @@ async function ensureCodexVolume(spec, opts) {
5205
6146
  "-c",
5206
6147
  // --exclude=hooks.json: the AgentBox activity hooks file is box-owned
5207
6148
  // (seeded by seedCodexHooks); never let the host copy clobber it.
5208
- "rsync -a --exclude=sessions --exclude=log --exclude=history.jsonl --exclude=hooks.json /src/ /dst/ && chown -R 1000:1000 /dst"
6149
+ // The session-state DBs / indexes are excluded so a teleported session
6150
+ // resumes at /workspace (Codex reads the cwd from state_*.sqlite's threads
6151
+ // index, which it backfills from the box's rollouts) and the host's
6152
+ // cross-project Codex history doesn't leak into the box.
6153
+ // The trailing `rm -rf` purges any state DBs a PREVIOUS sync (before these
6154
+ // excludes) already copied into the shared volume — rsync without
6155
+ // --delete only adds/updates. The globs are no-ops with `-f` when absent,
6156
+ // and never touch box-owned `sessions/` (the teleported rollouts) or
6157
+ // `hooks.json`.
6158
+ "rsync -a --exclude=sessions --exclude=log --exclude=history.jsonl --exclude=hooks.json" + skillsExclude + " --exclude=state_*.sqlite* --exclude=logs_*.sqlite* --exclude=session_index.jsonl --exclude=external_agent_session_imports.json --exclude=shell_snapshots /src/ /dst/ && rm -rf /dst/state_*.sqlite* /dst/logs_*.sqlite* /dst/session_index.jsonl /dst/external_agent_session_imports.json /dst/shell_snapshots" + skillsPurge + " && chown -R 1000:1000 /dst"
5209
6159
  ]);
6160
+ await sanitizeVolumeCodexConfig(spec.volume, opts.image);
5210
6161
  return { created, synced: true };
5211
6162
  }
5212
6163
  await execa7(
@@ -5225,6 +6176,9 @@ async function ensureCodexVolume(spec, opts) {
5225
6176
  ],
5226
6177
  { reject: false }
5227
6178
  );
6179
+ if (!await pathExists3(join52(hostCodex, "config.toml"))) {
6180
+ await sanitizeVolumeCodexConfig(spec.volume, opts.image);
6181
+ }
5228
6182
  return { created, synced: false };
5229
6183
  }
5230
6184
  async function seedCodexHooks(volume, image) {
@@ -5246,6 +6200,39 @@ async function seedCodexHooks(volume, image) {
5246
6200
  return { seeded: false };
5247
6201
  }
5248
6202
  }
6203
+ async function sanitizeVolumeCodexConfig(volume, image) {
6204
+ try {
6205
+ const hostConfig = join52(homedir5(), ".codex", "config.toml");
6206
+ let text;
6207
+ if (!await pathExists3(hostConfig)) {
6208
+ text = MINIMAL_TRUSTED_CODEX_CONFIG;
6209
+ } else {
6210
+ const sanitized = sanitizeCodexConfigForBox(await readFile52(hostConfig, "utf8"));
6211
+ if (!sanitized.changed || sanitized.text.length === 0) return { sanitized: false };
6212
+ text = sanitized.text;
6213
+ }
6214
+ await execa7(
6215
+ "docker",
6216
+ [
6217
+ "run",
6218
+ "--rm",
6219
+ "-i",
6220
+ "--user",
6221
+ "0",
6222
+ "-v",
6223
+ `${volume}:/dst`,
6224
+ image,
6225
+ "sh",
6226
+ "-c",
6227
+ "cat > /dst/config.toml.tmp && chown 1000:1000 /dst/config.toml.tmp && mv /dst/config.toml.tmp /dst/config.toml"
6228
+ ],
6229
+ { input: text }
6230
+ );
6231
+ return { sanitized: true };
6232
+ } catch {
6233
+ return { sanitized: false };
6234
+ }
6235
+ }
5249
6236
  var CODEX_FORWARDED_ENV_KEYS = ["OPENAI_API_KEY"];
5250
6237
  function buildCodexMounts(spec, hostEnv) {
5251
6238
  const env = {};
@@ -5420,7 +6407,7 @@ async function codexSessionInfo(container, sessionName) {
5420
6407
  }
5421
6408
  var CODEX_PULL_ITEMS = ["config.toml", "auth.json", "prompts"];
5422
6409
  async function pullCodexConfig(spec, opts) {
5423
- const hostCodex = join52(homedir4(), ".codex");
6410
+ const hostCodex = join52(homedir5(), ".codex");
5424
6411
  const inv = await execa7(
5425
6412
  "docker",
5426
6413
  [
@@ -5480,6 +6467,57 @@ async function pullCodexConfig(spec, opts) {
5480
6467
  }
5481
6468
  return { newItems };
5482
6469
  }
6470
+ var SHARED_AGENTS_VOLUME = "agentbox-agents-config";
6471
+ var CONTAINER_AGENTS_DIR = "/home/vscode/.agents";
6472
+ function resolveAgentsVolume() {
6473
+ return { volume: SHARED_AGENTS_VOLUME };
6474
+ }
6475
+ async function pathExists4(p) {
6476
+ try {
6477
+ await stat5(p);
6478
+ return true;
6479
+ } catch {
6480
+ return false;
6481
+ }
6482
+ }
6483
+ async function ensureAgentsVolume(spec, opts) {
6484
+ const existed = await volumeExists(spec.volume);
6485
+ await ensureVolume(spec.volume);
6486
+ const created = !existed;
6487
+ const hostAgents = join6(homedir6(), ".agents");
6488
+ const willSync = opts.syncFromHost && await pathExists4(hostAgents);
6489
+ if (willSync) {
6490
+ const unsyncable = await findUnsyncableSymlinks(hostAgents, [hostAgents]);
6491
+ const symlinkExcludes = unsyncable.map((rel) => ` --exclude=/${rel}`).join("");
6492
+ await execa8("docker", [
6493
+ "run",
6494
+ "--rm",
6495
+ "--user",
6496
+ "0",
6497
+ "-v",
6498
+ `${spec.volume}:/dst`,
6499
+ "-v",
6500
+ `${hostAgents}:/src:ro`,
6501
+ opts.image,
6502
+ "sh",
6503
+ "-c",
6504
+ "rsync -a --copy-unsafe-links" + symlinkExcludes + " /src/ /dst/ && chown -R 1000:1000 /dst"
6505
+ ]);
6506
+ return { created, synced: true };
6507
+ }
6508
+ await execa8(
6509
+ "docker",
6510
+ ["run", "--rm", "--user", "0", "-v", `${spec.volume}:/dst`, opts.image, "sh", "-c", "chown 1000:1000 /dst"],
6511
+ { reject: false }
6512
+ );
6513
+ return { created, synced: false };
6514
+ }
6515
+ function buildAgentsMounts(spec) {
6516
+ return {
6517
+ extraVolumes: [`${spec.volume}:${CONTAINER_AGENTS_DIR}`],
6518
+ volumeName: spec.volume
6519
+ };
6520
+ }
5483
6521
  var SHARED_OPENCODE_VOLUME = "agentbox-opencode-config";
5484
6522
  var DEFAULT_OPENCODE_SESSION = "opencode";
5485
6523
  var CONTAINER_OPENCODE_DIR = "/home/vscode/.local/share/opencode";
@@ -5492,9 +6530,9 @@ function resolveOpencodeVolume(opts) {
5492
6530
  }
5493
6531
  return { volume: SHARED_OPENCODE_VOLUME };
5494
6532
  }
5495
- async function pathExists4(p) {
6533
+ async function pathExists5(p) {
5496
6534
  try {
5497
- await stat5(p);
6535
+ await stat6(p);
5498
6536
  return true;
5499
6537
  } catch {
5500
6538
  return false;
@@ -5509,12 +6547,12 @@ async function ensureOpencodeVolume(spec, opts) {
5509
6547
  const existed = await volumeExists(spec.volume);
5510
6548
  await ensureVolume(spec.volume);
5511
6549
  const created = !existed;
5512
- const hostData = join6(homedir5(), ".local", "share", "opencode");
5513
- const hostConfig = join6(homedir5(), ".config", "opencode");
5514
- const hostState = join6(homedir5(), ".local", "state", "opencode");
5515
- const hasData = await pathExists4(hostData);
5516
- const hasConfig = await pathExists4(hostConfig);
5517
- const hasState = await pathExists4(hostState);
6550
+ const hostData = join7(homedir7(), ".local", "share", "opencode");
6551
+ const hostConfig = join7(homedir7(), ".config", "opencode");
6552
+ const hostState = join7(homedir7(), ".local", "state", "opencode");
6553
+ const hasData = await pathExists5(hostData);
6554
+ const hasConfig = await pathExists5(hostConfig);
6555
+ const hasState = await pathExists5(hostState);
5518
6556
  const willSync = opts.syncFromHost && (hasData || hasConfig || hasState);
5519
6557
  if (willSync) {
5520
6558
  const args = ["run", "--rm", "--user", "0", "-v", `${spec.volume}:/dst`];
@@ -5537,10 +6575,10 @@ async function ensureOpencodeVolume(spec, opts) {
5537
6575
  }
5538
6576
  steps.push("chown -R 1000:1000 /dst");
5539
6577
  args.push(opts.image, "sh", "-c", steps.join(" && "));
5540
- await execa8("docker", args);
6578
+ await execa9("docker", args);
5541
6579
  return { created, synced: true };
5542
6580
  }
5543
- await execa8(
6581
+ await execa9(
5544
6582
  "docker",
5545
6583
  [
5546
6584
  "run",
@@ -5560,7 +6598,7 @@ async function ensureOpencodeVolume(spec, opts) {
5560
6598
  }
5561
6599
  async function seedOpencodePlugin(volume, image) {
5562
6600
  try {
5563
- const { stdout } = await execa8("docker", [
6601
+ const { stdout } = await execa9("docker", [
5564
6602
  "run",
5565
6603
  "--rm",
5566
6604
  "--user",
@@ -5608,14 +6646,14 @@ var OpencodeSessionError = class extends Error {
5608
6646
  }
5609
6647
  };
5610
6648
  async function ensureOpencodeInstalled(container, opts = {}) {
5611
- const probe = await execa8(
6649
+ const probe = await execa9(
5612
6650
  "docker",
5613
6651
  ["exec", "--user", CONTAINER_USER, container, "sh", "-c", "command -v opencode"],
5614
6652
  { reject: false }
5615
6653
  );
5616
6654
  if (probe.exitCode === 0) return { installed: false };
5617
6655
  opts.onProgress?.("installing opencode (absent from this box image)");
5618
- const install = await execa8(
6656
+ const install = await execa9(
5619
6657
  "docker",
5620
6658
  ["exec", "--user", "root", container, "bash", "-lc", "npm install -g opencode-ai 2>&1"],
5621
6659
  { reject: false }
@@ -5637,7 +6675,7 @@ async function startOpencodeSession(opts) {
5637
6675
  const v = process.env[k];
5638
6676
  if (typeof v === "string" && v.length > 0) envFlags.push("-e", `${k}=${v}`);
5639
6677
  }
5640
- const result = await execa8(
6678
+ const result = await execa9(
5641
6679
  "docker",
5642
6680
  [
5643
6681
  "exec",
@@ -5723,7 +6761,7 @@ function runInteractiveOpencodeLogin(dockerArgv) {
5723
6761
  return { exitCode: child.status ?? 1 };
5724
6762
  }
5725
6763
  async function volumeHasOpencodeAuth(volume, image) {
5726
- const res = await execa8(
6764
+ const res = await execa9(
5727
6765
  "docker",
5728
6766
  ["run", "--rm", "-v", `${volume}:/dst`, image, "sh", "-c", "test -e /dst/auth.json"],
5729
6767
  { reject: false }
@@ -5732,7 +6770,7 @@ async function volumeHasOpencodeAuth(volume, image) {
5732
6770
  }
5733
6771
  async function opencodeSessionInfo(container, sessionName) {
5734
6772
  const name = sessionName ?? DEFAULT_OPENCODE_SESSION;
5735
- const has = await execa8(
6773
+ const has = await execa9(
5736
6774
  "docker",
5737
6775
  ["exec", "--user", CONTAINER_USER, container, "tmux", "has-session", "-t", name],
5738
6776
  { reject: false }
@@ -5740,7 +6778,7 @@ async function opencodeSessionInfo(container, sessionName) {
5740
6778
  if (has.exitCode !== 0) {
5741
6779
  return { running: false, sessionName: name, startedAt: null };
5742
6780
  }
5743
- const ts = await execa8(
6781
+ const ts = await execa9(
5744
6782
  "docker",
5745
6783
  [
5746
6784
  "exec",
@@ -5776,9 +6814,9 @@ var OPENCODE_PULL_CONFIG_ITEMS = [
5776
6814
  "themes"
5777
6815
  ];
5778
6816
  async function pullOpencodeConfig(spec, opts) {
5779
- const hostData = join6(homedir5(), ".local", "share", "opencode");
5780
- const hostConfig = join6(homedir5(), ".config", "opencode");
5781
- const inv = await execa8(
6817
+ const hostData = join7(homedir7(), ".local", "share", "opencode");
6818
+ const hostConfig = join7(homedir7(), ".config", "opencode");
6819
+ const inv = await execa9(
5782
6820
  "docker",
5783
6821
  [
5784
6822
  "run",
@@ -5804,7 +6842,7 @@ async function pullOpencodeConfig(spec, opts) {
5804
6842
  const [group, name] = line.trim().split(/\s+/, 2);
5805
6843
  if (!name || group !== "data" && group !== "config") continue;
5806
6844
  const hostBase = group === "data" ? hostData : hostConfig;
5807
- if (await pathExists4(join6(hostBase, name))) continue;
6845
+ if (await pathExists5(join7(hostBase, name))) continue;
5808
6846
  newItems.push({
5809
6847
  label: group === "data" ? name : `config/${name}`,
5810
6848
  src: group === "data" ? `/src/${name}` : `/src/config/${name}`,
@@ -5820,7 +6858,7 @@ async function pullOpencodeConfig(spec, opts) {
5820
6858
  const cmds = newItems.map(
5821
6859
  (i) => `cp -a '${i.src}' '${i.hostDst === "data" ? "/dst-data" : "/dst-config"}/${i.name}'`
5822
6860
  );
5823
- const apply = await execa8(
6861
+ const apply = await execa9(
5824
6862
  "docker",
5825
6863
  [
5826
6864
  "run",
@@ -5931,9 +6969,9 @@ function gitWorktreePathFor(branch) {
5931
6969
  return `${WORKTREE_ROOT}/${fsSafeBranch(branch)}`;
5932
6970
  }
5933
6971
  async function collectRepoCarryOver(repo, branch, containerPath, gitWorktreePath) {
5934
- const stash = await execa9("git", ["-C", repo.hostMainRepo, "stash", "create"], { reject: false });
6972
+ const stash = await execa10("git", ["-C", repo.hostMainRepo, "stash", "create"], { reject: false });
5935
6973
  const stashSha = stash.exitCode === 0 ? stash.stdout.trim() || null : null;
5936
- const untracked = await execa9(
6974
+ const untracked = await execa10(
5937
6975
  "git",
5938
6976
  ["-C", repo.hostMainRepo, "ls-files", "--others", "--exclude-standard", "-z"],
5939
6977
  { reject: false }
@@ -5950,7 +6988,7 @@ async function collectRepoCarryOver(repo, branch, containerPath, gitWorktreePath
5950
6988
  };
5951
6989
  }
5952
6990
  async function dexec(container, argv, user = "vscode", cwd = "/") {
5953
- const r = await execa9(
6991
+ const r = await execa10(
5954
6992
  "docker",
5955
6993
  ["exec", "-w", cwd, "--user", user, container, ...argv],
5956
6994
  { reject: false }
@@ -5982,7 +7020,7 @@ async function bindWorktrees(container, binds, onLog) {
5982
7020
  (a, b) => a.kind === "root" && b.kind !== "root" ? -1 : a.kind !== "root" && b.kind === "root" ? 1 : 0
5983
7021
  );
5984
7022
  for (const b of ordered) {
5985
- await execa9(
7023
+ await execa10(
5986
7024
  "docker",
5987
7025
  ["exec", "-w", "/", "--user", "root", container, "sh", "-c", `mountpoint -q ${b.containerPath} && umount ${b.containerPath} || true`],
5988
7026
  { reject: false }
@@ -6004,7 +7042,7 @@ async function seedWorkspace(opts) {
6004
7042
  const wt = r.gitWorktreePath;
6005
7043
  const baseRef = r.repo.kind === "root" ? opts.fromBranch ?? "HEAD" : "HEAD";
6006
7044
  const addArgs = r.reuseBranch ? ["worktree", "add", wt, r.branch] : ["worktree", "add", "-b", r.branch, wt, baseRef];
6007
- const add = await execa9(
7045
+ const add = await execa10(
6008
7046
  "docker",
6009
7047
  ["exec", "--user", "vscode", opts.container, "git", "-C", main, ...addArgs],
6010
7048
  { reject: false }
@@ -6015,7 +7053,7 @@ async function seedWorkspace(opts) {
6015
7053
  );
6016
7054
  }
6017
7055
  log(`worktree ${wt} on branch ${r.branch} (host main ${main})`);
6018
- await execa9(
7056
+ await execa10(
6019
7057
  "docker",
6020
7058
  [
6021
7059
  "exec",
@@ -6031,7 +7069,7 @@ async function seedWorkspace(opts) {
6031
7069
  ],
6032
7070
  { reject: false }
6033
7071
  );
6034
- await execa9(
7072
+ await execa10(
6035
7073
  "docker",
6036
7074
  [
6037
7075
  "exec",
@@ -6061,7 +7099,7 @@ async function seedWorkspace(opts) {
6061
7099
  for (const r of opts.repos) {
6062
7100
  const ct = r.containerPath;
6063
7101
  if (r.stashSha) {
6064
- const withIndex = await execa9(
7102
+ const withIndex = await execa10(
6065
7103
  "docker",
6066
7104
  [
6067
7105
  "exec",
@@ -6079,7 +7117,7 @@ async function seedWorkspace(opts) {
6079
7117
  { reject: false }
6080
7118
  );
6081
7119
  if (withIndex.exitCode !== 0) {
6082
- const noIndex = await execa9(
7120
+ const noIndex = await execa10(
6083
7121
  "docker",
6084
7122
  [
6085
7123
  "exec",
@@ -6107,7 +7145,7 @@ async function seedWorkspace(opts) {
6107
7145
  }
6108
7146
  }
6109
7147
  if (r.untrackedNul.length > 0) {
6110
- const tarOut = await execa9("tar", ["-C", r.hostSource, "--null", "-T", "-", "-cf", "-"], {
7148
+ const tarOut = await execa10("tar", ["-C", r.hostSource, "--null", "-T", "-", "-cf", "-"], {
6111
7149
  input: r.untrackedNul.replace(/\0$/, ""),
6112
7150
  encoding: "buffer",
6113
7151
  reject: false
@@ -6116,7 +7154,7 @@ async function seedWorkspace(opts) {
6116
7154
  log(`warning: tar of untracked files for ${r.repo.hostMainRepo} failed: ${tarOut.stderr}`);
6117
7155
  continue;
6118
7156
  }
6119
- const tarIn = await execa9(
7157
+ const tarIn = await execa10(
6120
7158
  "docker",
6121
7159
  ["exec", "-i", "--user", "vscode", opts.container, "tar", "-C", ct, "-xf", "-"],
6122
7160
  { input: tarOut.stdout, reject: false }
@@ -6169,7 +7207,7 @@ async function regenerateRestoredWorktrees(opts) {
6169
7207
  for (const p of opts.plans) {
6170
7208
  const baseRef = p.kind === "root" ? opts.fromBranch ?? "HEAD" : "HEAD";
6171
7209
  const metaDir = `${p.hostMainRepo}/.git/worktrees/${fsSafeBranch(p.freshBranch)}`;
6172
- const r = await execa9(
7210
+ const r = await execa10(
6173
7211
  "docker",
6174
7212
  [
6175
7213
  "exec",
@@ -6202,14 +7240,14 @@ async function regenerateRestoredWorktrees(opts) {
6202
7240
  async function seedWorkspaceFromDir(opts) {
6203
7241
  const log = opts.onLog ?? (() => {
6204
7242
  });
6205
- const tarOut = await execa9("tar", ["-C", opts.hostSource, "-cf", "-", "."], {
7243
+ const tarOut = await execa10("tar", ["-C", opts.hostSource, "-cf", "-", "."], {
6206
7244
  encoding: "buffer",
6207
7245
  reject: false
6208
7246
  });
6209
7247
  if (tarOut.exitCode !== 0) {
6210
7248
  throw new GitWorktreeError(`tar of ${opts.hostSource} failed: ${tarOut.stderr}`);
6211
7249
  }
6212
- const tarIn = await execa9(
7250
+ const tarIn = await execa10(
6213
7251
  "docker",
6214
7252
  ["exec", "-i", "--user", "1000:1000", opts.container, "tar", "-C", "/workspace", "-xf", "-"],
6215
7253
  { input: tarOut.stdout, reject: false }
@@ -6220,13 +7258,13 @@ async function seedWorkspaceFromDir(opts) {
6220
7258
  log(`seeded /workspace from ${opts.hostSource}`);
6221
7259
  }
6222
7260
  async function removeInBoxWorktree(args) {
6223
- const remove = await execa9(
7261
+ const remove = await execa10(
6224
7262
  "git",
6225
7263
  ["-C", args.hostMainRepo, "worktree", "remove", "--force", args.gitWorktreePath],
6226
7264
  { reject: false }
6227
7265
  );
6228
7266
  if (remove.exitCode === 0) return;
6229
- await execa9("git", ["-C", args.hostMainRepo, "worktree", "prune"], { reject: false });
7267
+ await execa10("git", ["-C", args.hostMainRepo, "worktree", "prune"], { reject: false });
6230
7268
  }
6231
7269
  function ctParent(p) {
6232
7270
  const i = p.lastIndexOf("/");
@@ -6257,20 +7295,20 @@ async function resyncWorkspaceFromHost(opts) {
6257
7295
  const hostMain = w.hostMainRepo;
6258
7296
  const boxBranch = w.branch;
6259
7297
  const res = { containerPath: ct, mergeConflicts: [], overlaySkipped: [] };
6260
- const hostBranchProbe = await execa9(
7298
+ const hostBranchProbe = await execa10(
6261
7299
  "git",
6262
7300
  ["-C", hostMain, "symbolic-ref", "--short", "-q", "HEAD"],
6263
7301
  { reject: false }
6264
7302
  );
6265
- const hostRef = hostBranchProbe.exitCode === 0 && hostBranchProbe.stdout.trim() ? hostBranchProbe.stdout.trim() : (await execa9("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false })).stdout.trim();
7303
+ const hostRef = hostBranchProbe.exitCode === 0 && hostBranchProbe.stdout.trim() ? hostBranchProbe.stdout.trim() : (await execa10("git", ["-C", hostMain, "rev-parse", "HEAD"], { reject: false })).stdout.trim();
6266
7304
  if (!hostRef) {
6267
7305
  log(`resync: ${ct}: could not resolve host ref; skipping`);
6268
7306
  results.push(res);
6269
7307
  continue;
6270
7308
  }
6271
- const stash = await execa9("git", ["-C", hostMain, "stash", "create"], { reject: false });
7309
+ const stash = await execa10("git", ["-C", hostMain, "stash", "create"], { reject: false });
6272
7310
  const hostStashSha = stash.exitCode === 0 ? stash.stdout.trim() || null : null;
6273
- const untracked = await execa9(
7311
+ const untracked = await execa10(
6274
7312
  "git",
6275
7313
  ["-C", hostMain, "ls-files", "--others", "--exclude-standard", "-z"],
6276
7314
  { reject: false }
@@ -6340,7 +7378,7 @@ async function resyncWorkspaceFromHost(opts) {
6340
7378
  }
6341
7379
  }
6342
7380
  if (hostUntracked.length > 0) {
6343
- const probe = await execa9(
7381
+ const probe = await execa10(
6344
7382
  "docker",
6345
7383
  [
6346
7384
  "exec",
@@ -6372,7 +7410,7 @@ async function resyncWorkspaceFromHost(opts) {
6372
7410
  let hostHash = "";
6373
7411
  if (boxToken !== void 0 && boxToken !== NON_REGULAR_TOKEN) {
6374
7412
  try {
6375
- hostHash = createHash22("sha256").update(await readFile52(join7(hostMain, p))).digest("hex");
7413
+ hostHash = createHash22("sha256").update(await readFile6(join8(hostMain, p))).digest("hex");
6376
7414
  } catch {
6377
7415
  identical++;
6378
7416
  continue;
@@ -6387,13 +7425,13 @@ async function resyncWorkspaceFromHost(opts) {
6387
7425
  log(`resync: ${ct}: ${String(identical)} untracked host file(s) already identical in box (no-op)`);
6388
7426
  }
6389
7427
  if (toCopy.length > 0) {
6390
- const tarOut = await execa9("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
7428
+ const tarOut = await execa10("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
6391
7429
  input: toCopy.join("\0"),
6392
7430
  encoding: "buffer",
6393
7431
  reject: false
6394
7432
  });
6395
7433
  if (tarOut.exitCode === 0) {
6396
- await execa9(
7434
+ await execa10(
6397
7435
  "docker",
6398
7436
  ["exec", "-i", "--user", "vscode", opts.container, "tar", "-C", ct, "-xf", "-"],
6399
7437
  { input: tarOut.stdout, reject: false }
@@ -6416,7 +7454,7 @@ var cached = null;
6416
7454
  async function detectPortless() {
6417
7455
  if (cached !== null) return cached;
6418
7456
  try {
6419
- const ver = await execa10(PORTLESS_BIN, SUB_VERSION, { reject: false });
7457
+ const ver = await execa11(PORTLESS_BIN, SUB_VERSION, { reject: false });
6420
7458
  if (ver.exitCode !== 0) {
6421
7459
  cached = { installed: false, proxyRunning: false };
6422
7460
  return cached;
@@ -6436,7 +7474,7 @@ function resetPortlessCache() {
6436
7474
  }
6437
7475
  async function portlessAlias(name, port) {
6438
7476
  try {
6439
- const r = await execa10(PORTLESS_BIN, [SUB_ALIAS, name, String(port)], { reject: false });
7477
+ const r = await execa11(PORTLESS_BIN, [SUB_ALIAS, name, String(port)], { reject: false });
6440
7478
  return r.exitCode === 0;
6441
7479
  } catch {
6442
7480
  return false;
@@ -6444,7 +7482,7 @@ async function portlessAlias(name, port) {
6444
7482
  }
6445
7483
  async function portlessUnalias(name) {
6446
7484
  try {
6447
- const r = await execa10(PORTLESS_BIN, [SUB_ALIAS, SUB_ALIAS_REMOVE, name], { reject: false });
7485
+ const r = await execa11(PORTLESS_BIN, [SUB_ALIAS, SUB_ALIAS_REMOVE, name], { reject: false });
6448
7486
  return r.exitCode === 0;
6449
7487
  } catch {
6450
7488
  return false;
@@ -6453,7 +7491,7 @@ async function portlessUnalias(name) {
6453
7491
  async function portlessGetUrl(name) {
6454
7492
  const fallback = `https://${name}.localhost`;
6455
7493
  try {
6456
- const r = await execa10(PORTLESS_BIN, [SUB_GET, name], { reject: false });
7494
+ const r = await execa11(PORTLESS_BIN, [SUB_GET, name], { reject: false });
6457
7495
  const out = (r.stdout ?? "").trim();
6458
7496
  if (r.exitCode === 0 && /^https?:\/\//.test(out)) return out;
6459
7497
  } catch {
@@ -6474,7 +7512,7 @@ function portlessBrowserEnv(boxName, opts) {
6474
7512
  }
6475
7513
  async function installPortless() {
6476
7514
  try {
6477
- const r = await execa10("npm", ["install", "-g", "portless"], { reject: false });
7515
+ const r = await execa11("npm", ["install", "-g", "portless"], { reject: false });
6478
7516
  return r.exitCode === 0;
6479
7517
  } catch {
6480
7518
  return false;
@@ -6482,7 +7520,7 @@ async function installPortless() {
6482
7520
  }
6483
7521
  async function startPortlessProxy() {
6484
7522
  try {
6485
- const r = await execa10(
7523
+ const r = await execa11(
6486
7524
  PORTLESS_BIN,
6487
7525
  ["proxy", "start", "--no-tls", "-p", String(PORTLESS_PROXY_PORT)],
6488
7526
  { reject: false }
@@ -6495,7 +7533,7 @@ async function startPortlessProxy() {
6495
7533
  function portlessStateDirCandidates() {
6496
7534
  const env = process.env["PORTLESS_STATE_DIR"];
6497
7535
  if (env && env.trim().length > 0) return [env.trim()];
6498
- return ["/tmp/portless", join8(homedir6(), ".portless")];
7536
+ return ["/tmp/portless", join9(homedir8(), ".portless")];
6499
7537
  }
6500
7538
  function pidAlive(pid) {
6501
7539
  if (!Number.isFinite(pid) || pid <= 0) return false;
@@ -6508,7 +7546,7 @@ function pidAlive(pid) {
6508
7546
  }
6509
7547
  async function readProxyPid(dir) {
6510
7548
  try {
6511
- const raw = await readFile6(join8(dir, "proxy.pid"), "utf8");
7549
+ const raw = await readFile7(join9(dir, "proxy.pid"), "utf8");
6512
7550
  const pid = Number.parseInt(raw.trim(), 10);
6513
7551
  return Number.isFinite(pid) && pid > 0 ? pid : null;
6514
7552
  } catch {
@@ -6528,7 +7566,7 @@ async function resolvePortlessHostStateDir(override) {
6528
7566
  if (env && env.trim().length > 0) return env.trim();
6529
7567
  const live = await findLivePortlessStateDir();
6530
7568
  if (live) return live;
6531
- const home = join8(homedir6(), ".portless");
7569
+ const home = join9(homedir8(), ".portless");
6532
7570
  if (existsSync2(home)) return home;
6533
7571
  if (existsSync2("/tmp/portless")) return "/tmp/portless";
6534
7572
  return home;
@@ -6536,7 +7574,7 @@ async function resolvePortlessHostStateDir(override) {
6536
7574
  async function isProxyRunning() {
6537
7575
  if (await findLivePortlessStateDir() !== null) return true;
6538
7576
  try {
6539
- const r = await execa10("pgrep", ["-f", "portless proxy"], { reject: false });
7577
+ const r = await execa11("pgrep", ["-f", "portless proxy"], { reject: false });
6540
7578
  return r.exitCode === 0 && (r.stdout ?? "").trim().length > 0;
6541
7579
  } catch {
6542
7580
  return false;
@@ -6557,12 +7595,12 @@ var EXCLUDE_DIRS = /* @__PURE__ */ new Set([
6557
7595
  ".cache",
6558
7596
  ".parcel-cache"
6559
7597
  ]);
6560
- var SNAPSHOTS_ROOT = join9(homedir7(), ".agentbox", "snapshots");
7598
+ var SNAPSHOTS_ROOT = join10(homedir9(), ".agentbox", "snapshots");
6561
7599
  function snapshotPathFor(box) {
6562
7600
  const mnemonic = sanitizeMnemonic(box.name);
6563
7601
  const n = box.projectIndex;
6564
7602
  const segment = typeof n === "number" && Number.isFinite(n) && n > 0 ? `${box.id}-${String(n)}-${mnemonic}` : `${box.id}-${mnemonic}`;
6565
- return join9(SNAPSHOTS_ROOT, segment);
7603
+ return join10(SNAPSHOTS_ROOT, segment);
6566
7604
  }
6567
7605
  async function findExcludedDirs(root, excluded = EXCLUDE_DIRS) {
6568
7606
  const matches = [];
@@ -6575,7 +7613,7 @@ async function findExcludedDirs(root, excluded = EXCLUDE_DIRS) {
6575
7613
  }
6576
7614
  for (const entry of entries) {
6577
7615
  if (!entry.isDirectory()) continue;
6578
- const abs = join9(dir, entry.name);
7616
+ const abs = join10(dir, entry.name);
6579
7617
  if (excluded.has(entry.name)) {
6580
7618
  matches.push(abs);
6581
7619
  continue;
@@ -6592,26 +7630,26 @@ async function createSnapshot(opts) {
6592
7630
  const excluded = opts.excluded ?? EXCLUDE_DIRS;
6593
7631
  await mkdir42(SNAPSHOTS_ROOT, { recursive: true });
6594
7632
  const cpArgs = platform() === "darwin" ? ["-cR"] : ["-R"];
6595
- await execa11("cp", [...cpArgs, `${source}/`, destination]);
7633
+ await execa12("cp", [...cpArgs, `${source}/`, destination]);
6596
7634
  const toPrune = await findExcludedDirs(destination, excluded);
6597
7635
  await Promise.all(toPrune.map((p) => rm32(p, { recursive: true, force: true })));
6598
7636
  return { destination, prunedPaths: toPrune };
6599
7637
  }
6600
- var CHECKPOINTS_ROOT = join10(homedir8(), ".agentbox", "checkpoints");
7638
+ var CHECKPOINTS_ROOT = join11(homedir10(), ".agentbox", "checkpoints");
6601
7639
  var CHECKPOINT_IMAGE_PREFIX = "agentbox-ckpt-";
6602
7640
  function checkpointImageTag(projectRoot, name) {
6603
7641
  const mnemonic = sanitizeMnemonic(basename5(projectRoot));
6604
7642
  return `${CHECKPOINT_IMAGE_PREFIX}${hashProjectPath(projectRoot)}_${mnemonic}:${name}`;
6605
7643
  }
6606
7644
  function projectCheckpointsDir(projectRoot) {
6607
- return join10(CHECKPOINTS_ROOT, projectDirSegment(projectRoot));
7645
+ return join11(CHECKPOINTS_ROOT, projectDirSegment(projectRoot));
6608
7646
  }
6609
7647
  function checkpointDir(projectRoot, name) {
6610
- return join10(projectCheckpointsDir(projectRoot), name);
7648
+ return join11(projectCheckpointsDir(projectRoot), name);
6611
7649
  }
6612
7650
  async function readManifest(dir) {
6613
7651
  try {
6614
- const raw = await readFile7(join10(dir, "manifest.json"), "utf8");
7652
+ const raw = await readFile8(join11(dir, "manifest.json"), "utf8");
6615
7653
  const m = JSON.parse(raw);
6616
7654
  if (m.schema !== 2 && m.schema !== 3) return null;
6617
7655
  return m;
@@ -6628,7 +7666,7 @@ async function listCheckpointsInDir(root) {
6628
7666
  }
6629
7667
  const out = [];
6630
7668
  for (const name of entries) {
6631
- const dir = join10(root, name);
7669
+ const dir = join11(root, name);
6632
7670
  const manifest = await readManifest(dir);
6633
7671
  if (manifest) out.push({ name, dir, manifest });
6634
7672
  }
@@ -6647,7 +7685,7 @@ async function listAllCheckpoints() {
6647
7685
  }
6648
7686
  const out = [];
6649
7687
  for (const segment of segments) {
6650
- const items = await listCheckpointsInDir(join10(CHECKPOINTS_ROOT, segment));
7688
+ const items = await listCheckpointsInDir(join11(CHECKPOINTS_ROOT, segment));
6651
7689
  if (items.length > 0) out.push({ segment, items });
6652
7690
  }
6653
7691
  return out;
@@ -6667,7 +7705,7 @@ async function listAllCheckpointImages() {
6667
7705
  }
6668
7706
  const out = /* @__PURE__ */ new Set();
6669
7707
  for (const proj of projectDirs) {
6670
- const projPath = join10(CHECKPOINTS_ROOT, proj);
7708
+ const projPath = join11(CHECKPOINTS_ROOT, proj);
6671
7709
  let names;
6672
7710
  try {
6673
7711
  names = (await readdir5(projPath, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
@@ -6675,7 +7713,7 @@ async function listAllCheckpointImages() {
6675
7713
  continue;
6676
7714
  }
6677
7715
  for (const name of names) {
6678
- const manifest = await readManifest(join10(projPath, name));
7716
+ const manifest = await readManifest(join11(projPath, name));
6679
7717
  if (manifest) out.add(manifest.image);
6680
7718
  }
6681
7719
  }
@@ -6717,7 +7755,7 @@ async function runCleanup(container, log) {
6717
7755
  }
6718
7756
  }
6719
7757
  async function inspectImageConfig(imageRef) {
6720
- const r = await execa12("docker", ["image", "inspect", imageRef], { reject: false });
7758
+ const r = await execa13("docker", ["image", "inspect", imageRef], { reject: false });
6721
7759
  if (r.exitCode !== 0) {
6722
7760
  throw new CheckpointError(`docker image inspect ${imageRef} failed`, r.stdout, r.stderr);
6723
7761
  }
@@ -6793,14 +7831,14 @@ async function createCheckpoint(opts) {
6793
7831
  await runCleanup(box.container, log);
6794
7832
  if (type === "layered") {
6795
7833
  log(`docker commit ${box.container} -> ${tag} (layered)`);
6796
- const r = await execa12("docker", ["commit", box.container, tag], { reject: false });
7834
+ const r = await execa13("docker", ["commit", box.container, tag], { reject: false });
6797
7835
  if (r.exitCode !== 0) {
6798
7836
  throw new CheckpointError(`docker commit failed for ${box.container}`, r.stdout, r.stderr);
6799
7837
  }
6800
7838
  } else {
6801
7839
  log(`docker commit ${box.container} -> <intermediate> (flattened path)`);
6802
7840
  const intermediate = `${tag}-intermediate`;
6803
- const commit = await execa12("docker", ["commit", box.container, intermediate], {
7841
+ const commit = await execa13("docker", ["commit", box.container, intermediate], {
6804
7842
  reject: false
6805
7843
  });
6806
7844
  if (commit.exitCode !== 0) {
@@ -6836,7 +7874,7 @@ async function createCheckpoint(opts) {
6836
7874
  cliVersion: stamp.cliVersion,
6837
7875
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6838
7876
  };
6839
- await writeFile32(join10(dir, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
7877
+ await writeFile32(join11(dir, "manifest.json"), JSON.stringify(manifest, null, 2) + "\n", "utf8");
6840
7878
  if (opts.setDefault) {
6841
7879
  await setConfigValue("project", "box.defaultCheckpointDocker", name, opts.projectRoot);
6842
7880
  log(`set project default checkpoint (box.defaultCheckpointDocker) -> ${name}`);
@@ -6845,7 +7883,7 @@ async function createCheckpoint(opts) {
6845
7883
  }
6846
7884
  async function flattenImage(sourceTag, destTag, log) {
6847
7885
  const tmpName = `agentbox-flatten-${Date.now().toString(36)}`;
6848
- const create = await execa12(
7886
+ const create = await execa13(
6849
7887
  "docker",
6850
7888
  ["create", "--name", tmpName, sourceTag, "sleep", "0"],
6851
7889
  { reject: false }
@@ -6853,11 +7891,11 @@ async function flattenImage(sourceTag, destTag, log) {
6853
7891
  if (create.exitCode !== 0) {
6854
7892
  throw new CheckpointError(`docker create for flatten failed`, create.stdout, create.stderr);
6855
7893
  }
6856
- const scratch = await mkdtemp3(join10(tmpdir3(), "agentbox-flatten-"));
7894
+ const scratch = await mkdtemp3(join11(tmpdir3(), "agentbox-flatten-"));
6857
7895
  try {
6858
- const rootfsPath = join10(scratch, "rootfs.tar");
7896
+ const rootfsPath = join11(scratch, "rootfs.tar");
6859
7897
  log(`exporting rootfs of ${sourceTag} to ${rootfsPath}`);
6860
- const exp = await execa12("docker", ["export", "-o", rootfsPath, tmpName], { reject: false });
7898
+ const exp = await execa13("docker", ["export", "-o", rootfsPath, tmpName], { reject: false });
6861
7899
  if (exp.exitCode !== 0) {
6862
7900
  throw new CheckpointError(`docker export failed`, exp.stdout, exp.stderr);
6863
7901
  }
@@ -6868,18 +7906,18 @@ async function flattenImage(sourceTag, destTag, log) {
6868
7906
  "ADD rootfs.tar /",
6869
7907
  ...renderConfigDirectives(cfg)
6870
7908
  ];
6871
- await writeFile32(join10(scratch, "Dockerfile"), lines.join("\n") + "\n", "utf8");
7909
+ await writeFile32(join11(scratch, "Dockerfile"), lines.join("\n") + "\n", "utf8");
6872
7910
  log(`building flattened ${destTag} from rootfs.tar (FROM scratch)`);
6873
- const build = await execa12(
7911
+ const build = await execa13(
6874
7912
  "docker",
6875
- ["build", "-t", destTag, "-f", join10(scratch, "Dockerfile"), scratch],
7913
+ ["build", "-t", destTag, "-f", join11(scratch, "Dockerfile"), scratch],
6876
7914
  { reject: false }
6877
7915
  );
6878
7916
  if (build.exitCode !== 0) {
6879
7917
  throw new CheckpointError(`flatten docker build failed`, build.stdout, build.stderr);
6880
7918
  }
6881
7919
  } finally {
6882
- await execa12("docker", ["rm", "-f", tmpName], { reject: false });
7920
+ await execa13("docker", ["rm", "-f", tmpName], { reject: false });
6883
7921
  await rm4(scratch, { recursive: true, force: true });
6884
7922
  }
6885
7923
  }
@@ -6905,7 +7943,7 @@ async function launchCtlDaemon(container, hostSocketPath, timeoutMs = 3e3) {
6905
7943
  }
6906
7944
  const deadline = Date.now() + timeoutMs;
6907
7945
  while (Date.now() < deadline) {
6908
- if (await pathExists5(hostSocketPath)) return { up: true };
7946
+ if (await pathExists6(hostSocketPath)) return { up: true };
6909
7947
  await new Promise((r) => setTimeout(r, 100));
6910
7948
  }
6911
7949
  return {
@@ -6913,9 +7951,9 @@ async function launchCtlDaemon(container, hostSocketPath, timeoutMs = 3e3) {
6913
7951
  reason: `socket ${hostSocketPath} did not appear within ${String(timeoutMs)}ms`
6914
7952
  };
6915
7953
  }
6916
- async function pathExists5(p) {
7954
+ async function pathExists6(p) {
6917
7955
  try {
6918
- await stat7(p);
7956
+ await stat8(p);
6919
7957
  return true;
6920
7958
  } catch {
6921
7959
  return false;
@@ -6923,7 +7961,7 @@ async function pathExists5(p) {
6923
7961
  }
6924
7962
  async function writeBoxEnvFile(container, env) {
6925
7963
  const body = formatBoxEnvBody(env);
6926
- const result = await execa13(
7964
+ const result = await execa14(
6927
7965
  "docker",
6928
7966
  ["exec", "--user", "root", "-i", container, "sh", "-c", "umask 022 && cat > /etc/agentbox/box.env"],
6929
7967
  { input: body, reject: false }
@@ -6947,7 +7985,7 @@ function shellSingleQuote(s) {
6947
7985
  return `'${s.replace(/'/g, `'\\''`)}'`;
6948
7986
  }
6949
7987
  async function ensureHomeOwnedByVscode(container) {
6950
- await execa14(
7988
+ await execa15(
6951
7989
  "docker",
6952
7990
  [
6953
7991
  "exec",
@@ -6963,10 +8001,10 @@ async function ensureHomeOwnedByVscode(container) {
6963
8001
  { reject: false }
6964
8002
  );
6965
8003
  }
6966
- var STATE_DIR22 = join11(homedir9(), ".agentbox");
6967
- var PID_FILE = join11(STATE_DIR22, "relay.pid");
6968
- var LOG_FILE = join11(STATE_DIR22, "relay.log");
6969
- var RELAY_HOME_DIR = join11(STATE_DIR22, "relay");
8004
+ var STATE_DIR22 = join12(homedir11(), ".agentbox");
8005
+ var PID_FILE = join12(STATE_DIR22, "relay.pid");
8006
+ var LOG_FILE = join12(STATE_DIR22, "relay.log");
8007
+ var RELAY_HOME_DIR = join12(STATE_DIR22, "relay");
6970
8008
  var PORT = DEFAULT_RELAY_PORT;
6971
8009
  var ENDPOINT = {
6972
8010
  // host.docker.internal is the Docker Desktop / OrbStack-supplied alias for
@@ -7133,13 +8171,13 @@ async function stageRelayHome(version, log) {
7133
8171
  if (process.env.AGENTBOX_RELAY_BIN || process.env.AGENTBOX_CLI_ENTRY) return null;
7134
8172
  const cliRoot = findCliRoot(dirname32(fileURLToPath(import.meta.url)));
7135
8173
  if (cliRoot === null) return null;
7136
- const homeDir = join11(RELAY_HOME_DIR, version);
7137
- const stagedEntry = join11(homeDir, "dist", "index.js");
7138
- const stagedBin = join11(homeDir, "runtime", "relay", "bin.cjs");
8174
+ const homeDir = join12(RELAY_HOME_DIR, version);
8175
+ const stagedEntry = join12(homeDir, "dist", "index.js");
8176
+ const stagedBin = join12(homeDir, "runtime", "relay", "bin.cjs");
7139
8177
  if (existsSync3(stagedEntry) && existsSync3(stagedBin)) {
7140
8178
  return { relayBin: stagedBin, cliEntry: stagedEntry };
7141
8179
  }
7142
- const nodeModules = resolveDepRoot(join11(cliRoot, "dist", "index.js"));
8180
+ const nodeModules = resolveDepRoot(join12(cliRoot, "dist", "index.js"));
7143
8181
  if (nodeModules === null) return null;
7144
8182
  const tmpDir = `${homeDir}.tmp-${String(process.pid)}`;
7145
8183
  try {
@@ -7147,10 +8185,10 @@ async function stageRelayHome(version, log) {
7147
8185
  await rm5(tmpDir, { recursive: true, force: true });
7148
8186
  await mkdir6(tmpDir, { recursive: true });
7149
8187
  for (const sub of ["dist", "runtime", "share"]) {
7150
- const src = join11(cliRoot, sub);
7151
- if (existsSync3(src)) await cp(src, join11(tmpDir, sub), { recursive: true });
8188
+ const src = join12(cliRoot, sub);
8189
+ if (existsSync3(src)) await cp(src, join12(tmpDir, sub), { recursive: true });
7152
8190
  }
7153
- await cp(nodeModules, join11(tmpDir, "node_modules"), { recursive: true, dereference: true });
8191
+ await cp(nodeModules, join12(tmpDir, "node_modules"), { recursive: true, dereference: true });
7154
8192
  await rm5(homeDir, { recursive: true, force: true });
7155
8193
  await rename3(tmpDir, homeDir);
7156
8194
  } catch (err) {
@@ -7169,7 +8207,7 @@ async function stageRelayHome(version, log) {
7169
8207
  }
7170
8208
  function findCliRoot(moduleDir) {
7171
8209
  for (const root of [resolve3(moduleDir, ".."), resolve3(moduleDir, "..", "..")]) {
7172
- if (existsSync3(join11(root, "dist", "index.js")) && existsSync3(join11(root, "runtime", "relay", "bin.cjs"))) {
8210
+ if (existsSync3(join12(root, "dist", "index.js")) && existsSync3(join12(root, "runtime", "relay", "bin.cjs"))) {
7173
8211
  return root;
7174
8212
  }
7175
8213
  }
@@ -7184,7 +8222,7 @@ function resolveDepRoot(fromFile) {
7184
8222
  const idx = main.lastIndexOf(marker);
7185
8223
  if (idx === -1) return null;
7186
8224
  const nm = main.slice(0, idx + marker.length - 1);
7187
- return existsSync3(join11(nm, "commander")) ? nm : null;
8225
+ return existsSync3(join12(nm, "commander")) ? nm : null;
7188
8226
  } catch {
7189
8227
  return null;
7190
8228
  }
@@ -7198,7 +8236,7 @@ async function gcOldRelayHomes(keepVersion) {
7198
8236
  }
7199
8237
  for (const name of entries) {
7200
8238
  if (name === keepVersion) continue;
7201
- await rm5(join11(RELAY_HOME_DIR, name), { recursive: true, force: true }).catch(() => {
8239
+ await rm5(join12(RELAY_HOME_DIR, name), { recursive: true, force: true }).catch(() => {
7202
8240
  });
7203
8241
  }
7204
8242
  }
@@ -7309,7 +8347,7 @@ function fetchHealthz(timeoutMs) {
7309
8347
  }
7310
8348
  async function readPidFile() {
7311
8349
  try {
7312
- const text = await readFile8(PID_FILE, "utf8");
8350
+ const text = await readFile9(PID_FILE, "utf8");
7313
8351
  const pid = Number.parseInt(text.trim(), 10);
7314
8352
  return Number.isFinite(pid) && pid > 0 ? pid : null;
7315
8353
  } catch {
@@ -7614,8 +8652,8 @@ async function ensureAgentboxTasksFile(container, services, opts = {}) {
7614
8652
  return { status: "wrote" };
7615
8653
  }
7616
8654
  async function writeFileInBox(container, path, content) {
7617
- const { execa: execa20 } = await import("execa");
7618
- const result = await execa20(
8655
+ const { execa: execa21 } = await import("execa");
8656
+ const result = await execa21(
7619
8657
  "docker",
7620
8658
  ["exec", "-i", "--user", "vscode", container, "sh", "-c", `cat > ${shellQuote(path)}`],
7621
8659
  { input: content, reject: false }
@@ -7646,22 +8684,22 @@ function defaultBoxName(workspacePath, id) {
7646
8684
  const base = sanitizeBasename(workspacePath);
7647
8685
  return base.length > 0 ? `${base}-${id}` : id;
7648
8686
  }
7649
- async function pathExists6(p) {
8687
+ async function pathExists7(p) {
7650
8688
  try {
7651
- await stat8(p);
8689
+ await stat9(p);
7652
8690
  return true;
7653
8691
  } catch {
7654
8692
  return false;
7655
8693
  }
7656
8694
  }
7657
8695
  async function buildIdentityMounts() {
7658
- const home = homedir10();
8696
+ const home = homedir12();
7659
8697
  const candidates = [
7660
- { src: join12(home, ".gitconfig"), dst: "/home/vscode/.gitconfig", readOnly: true }
8698
+ { src: join13(home, ".gitconfig"), dst: "/home/vscode/.gitconfig", readOnly: true }
7661
8699
  ];
7662
8700
  const out = [];
7663
8701
  for (const c of candidates) {
7664
- if (await pathExists6(c.src)) {
8702
+ if (await pathExists7(c.src)) {
7665
8703
  out.push(`${c.src}:${c.dst}${c.readOnly ? ":ro" : ""}`);
7666
8704
  }
7667
8705
  }
@@ -7671,11 +8709,11 @@ async function createBox(opts) {
7671
8709
  const log = opts.onLog ?? (() => {
7672
8710
  });
7673
8711
  const workspace = resolve4(opts.workspacePath);
7674
- if (!await pathExists6(workspace)) {
8712
+ if (!await pathExists7(workspace)) {
7675
8713
  throw new Error(`workspace does not exist: ${workspace}`);
7676
8714
  }
7677
- const cfgPath = join12(workspace, "agentbox.yaml");
7678
- if (await pathExists6(cfgPath)) {
8715
+ const cfgPath = join13(workspace, "agentbox.yaml");
8716
+ if (await pathExists7(cfgPath)) {
7679
8717
  try {
7680
8718
  const cfg = await loadConfig(cfgPath);
7681
8719
  log(`agentbox.yaml validated (${String(cfg.services.length)} service(s))`);
@@ -7890,7 +8928,7 @@ async function createBox(opts) {
7890
8928
  log(`seeded claude credentials into ${claudeSpec.volume} from host backup`);
7891
8929
  }
7892
8930
  const claudeMounts = buildClaudeMounts(claudeSpec, process.env);
7893
- const wantCodex = opts.codexConfig !== void 0 || await pathExists6(join12(homedir10(), ".codex"));
8931
+ const wantCodex = opts.codexConfig !== void 0 || await pathExists7(join13(homedir12(), ".codex"));
7894
8932
  let codexMounts;
7895
8933
  let codexConfigVolume;
7896
8934
  if (wantCodex) {
@@ -7910,7 +8948,21 @@ async function createBox(opts) {
7910
8948
  codexMounts = buildCodexMounts(codexSpec, process.env);
7911
8949
  codexConfigVolume = codexSpec.volume;
7912
8950
  }
7913
- const wantOpencode = opts.opencodeConfig !== void 0 || await pathExists6(join12(homedir10(), ".config", "opencode")) || await pathExists6(join12(homedir10(), ".local", "share", "opencode"));
8951
+ let agentsMounts;
8952
+ let agentsConfigVolume;
8953
+ if (await pathExists7(join13(homedir12(), ".agents"))) {
8954
+ const agentsSpec = resolveAgentsVolume();
8955
+ const agentsEnsured = await ensureAgentsVolume(agentsSpec, {
8956
+ syncFromHost: true,
8957
+ image: ensureRef
8958
+ });
8959
+ if (agentsEnsured.synced) log(`synced ${agentsSpec.volume} from ~/.agents`);
8960
+ else if (agentsEnsured.created) log(`created empty volume ${agentsSpec.volume}`);
8961
+ else log(`reusing volume ${agentsSpec.volume}`);
8962
+ agentsMounts = buildAgentsMounts(agentsSpec);
8963
+ agentsConfigVolume = agentsSpec.volume;
8964
+ }
8965
+ const wantOpencode = opts.opencodeConfig !== void 0 || await pathExists7(join13(homedir12(), ".config", "opencode")) || await pathExists7(join13(homedir12(), ".local", "share", "opencode"));
7914
8966
  let opencodeMounts;
7915
8967
  let opencodeConfigVolume;
7916
8968
  if (wantOpencode) {
@@ -7931,14 +8983,15 @@ async function createBox(opts) {
7931
8983
  opencodeConfigVolume = opencodeSpec.volume;
7932
8984
  }
7933
8985
  const boxDir = boxRunDirFor({ id, name, projectIndex });
7934
- const socketDir = join12(boxDir, "run");
7935
- const socketPath = join12(socketDir, "ctl.sock");
7936
- const mergedExportDir = join12(boxDir, "workspace");
8986
+ const socketDir = join13(boxDir, "run");
8987
+ const socketPath = join13(socketDir, "ctl.sock");
8988
+ const mergedExportDir = join13(boxDir, "workspace");
7937
8989
  await mkdir7(socketDir, { recursive: true });
7938
8990
  await mkdir7(mergedExportDir, { recursive: true });
7939
8991
  const extraVolumes = await buildIdentityMounts();
7940
8992
  extraVolumes.push(...claudeMounts.extraVolumes);
7941
8993
  if (codexMounts) extraVolumes.push(...codexMounts.extraVolumes);
8994
+ if (agentsMounts) extraVolumes.push(...agentsMounts.extraVolumes);
7942
8995
  if (opencodeMounts) extraVolumes.push(...opencodeMounts.extraVolumes);
7943
8996
  extraVolumes.push(...ide.extraVolumes);
7944
8997
  extraVolumes.push(`${socketDir}:/run/agentbox`);
@@ -8034,6 +9087,7 @@ async function createBox(opts) {
8034
9087
  socketPath,
8035
9088
  claudeConfigVolume: claudeSpec.volume,
8036
9089
  codexConfigVolume,
9090
+ agentsConfigVolume,
8037
9091
  opencodeConfigVolume,
8038
9092
  vscodeServerVolume: vscodeServerVolumeName(id),
8039
9093
  cursorServerVolume: cursorServerVolumeName(id),
@@ -8099,7 +9153,7 @@ async function createBox(opts) {
8099
9153
  } catch (err) {
8100
9154
  if (opts.useBranch !== void 0) {
8101
9155
  log(`seedWorkspace failed for --use-branch ${opts.useBranch}; cleaning up the box`);
8102
- await execa15("docker", ["rm", "-f", containerName], { reject: false });
9156
+ await execa16("docker", ["rm", "-f", containerName], { reject: false });
8103
9157
  await removeBoxRecord(id);
8104
9158
  for (const w of gitWorktreeRecords) {
8105
9159
  await removeInBoxWorktree({
@@ -8162,7 +9216,7 @@ async function createBox(opts) {
8162
9216
  else log(`agentbox-ctl daemon did not become reachable: ${ctl.reason}`);
8163
9217
  if (opts.withPlaywright) {
8164
9218
  log("installing @playwright/cli@latest (--with-playwright)");
8165
- const result = await execa15(
9219
+ const result = await execa16(
8166
9220
  "docker",
8167
9221
  [
8168
9222
  "exec",
@@ -8341,7 +9395,7 @@ function parseShellSessionList(stdout) {
8341
9395
  return out;
8342
9396
  }
8343
9397
  async function listShellSessions(container, user) {
8344
- const res = await execa16(
9398
+ const res = await execa17(
8345
9399
  "docker",
8346
9400
  [
8347
9401
  "exec",
@@ -8365,7 +9419,7 @@ async function startShellSession(opts) {
8365
9419
  const login = opts.login !== false;
8366
9420
  const term = process.env["TERM"] ?? "xterm-256color";
8367
9421
  const cmd = login ? "bash -l" : "bash";
8368
- const result = await execa16(
9422
+ const result = await execa17(
8369
9423
  "docker",
8370
9424
  [
8371
9425
  "exec",
@@ -8414,7 +9468,7 @@ function buildShellSessionAttachArgv(container, sessionName, user) {
8414
9468
  }
8415
9469
  async function shellSessionInfo(container, sessionName, user) {
8416
9470
  const name = sessionName ?? DEFAULT_SHELL_SESSION;
8417
- const has = await execa16(
9471
+ const has = await execa17(
8418
9472
  "docker",
8419
9473
  ["exec", "--user", user ?? CONTAINER_USER, container, "tmux", "has-session", "-t", name],
8420
9474
  { reject: false }
@@ -8422,7 +9476,7 @@ async function shellSessionInfo(container, sessionName, user) {
8422
9476
  return { running: has.exitCode === 0, sessionName: name };
8423
9477
  }
8424
9478
  async function killShellSession(container, sessionName, user) {
8425
- const res = await execa16(
9479
+ const res = await execa17(
8426
9480
  "docker",
8427
9481
  [
8428
9482
  "exec",
@@ -8476,7 +9530,7 @@ async function getBoxEndpoints(record, engine, persisted) {
8476
9530
  for (const svc of persistedServices) pushService(svc.name, svc.port);
8477
9531
  } else {
8478
9532
  try {
8479
- const cfg = await loadConfig(join13(record.workspacePath, "agentbox.yaml"));
9533
+ const cfg = await loadConfig(join14(record.workspacePath, "agentbox.yaml"));
8480
9534
  if (!webServiceName) {
8481
9535
  webServiceName = cfg.services.find((s) => s.expose)?.name ?? null;
8482
9536
  }
@@ -8581,9 +9635,9 @@ function safeHost(url) {
8581
9635
  return "";
8582
9636
  }
8583
9637
  }
8584
- async function pathExists7(p) {
9638
+ async function pathExists8(p) {
8585
9639
  try {
8586
- await stat9(p);
9640
+ await stat10(p);
8587
9641
  return true;
8588
9642
  } catch {
8589
9643
  return false;
@@ -8627,9 +9681,9 @@ async function resyncBox(idOrName, onLog) {
8627
9681
  async function startBox(idOrName) {
8628
9682
  const box = await resolveBox(idOrName);
8629
9683
  for (const w of box.gitWorktrees ?? []) {
8630
- if (!await pathExists7(join14(w.hostMainRepo, ".git"))) {
9684
+ if (!await pathExists8(join15(w.hostMainRepo, ".git"))) {
8631
9685
  throw new Error(
8632
- `main repo for box worktree missing: ${join14(w.hostMainRepo, ".git")} (recreate the box)`
9686
+ `main repo for box worktree missing: ${join15(w.hostMainRepo, ".git")} (recreate the box)`
8633
9687
  );
8634
9688
  }
8635
9689
  }
@@ -8725,7 +9779,7 @@ async function getBoxHostPaths(idOrName) {
8725
9779
  }
8726
9780
  async function dirSizeBytes(path) {
8727
9781
  try {
8728
- const result = await execa17("du", ["-sk", path], { reject: false });
9782
+ const result = await execa18("du", ["-sk", path], { reject: false });
8729
9783
  if (result.exitCode !== 0) return null;
8730
9784
  const sizeKb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
8731
9785
  if (Number.isNaN(sizeKb)) return null;
@@ -8856,7 +9910,7 @@ async function destroyBox(idOrName, opts = {}) {
8856
9910
  async function listSnapshotDirs() {
8857
9911
  try {
8858
9912
  const entries = await readdir7(SNAPSHOTS_ROOT, { withFileTypes: true });
8859
- return entries.filter((e) => e.isDirectory()).map((e) => join14(SNAPSHOTS_ROOT, e.name));
9913
+ return entries.filter((e) => e.isDirectory()).map((e) => join15(SNAPSHOTS_ROOT, e.name));
8860
9914
  } catch {
8861
9915
  return [];
8862
9916
  }
@@ -8864,13 +9918,13 @@ async function listSnapshotDirs() {
8864
9918
  async function listBoxDirs() {
8865
9919
  try {
8866
9920
  const entries = await readdir7(BOXES_ROOT, { withFileTypes: true });
8867
- return entries.filter((e) => e.isDirectory()).map((e) => join14(BOXES_ROOT, e.name));
9921
+ return entries.filter((e) => e.isDirectory()).map((e) => join15(BOXES_ROOT, e.name));
8868
9922
  } catch {
8869
9923
  return [];
8870
9924
  }
8871
9925
  }
8872
9926
  async function listCheckpointImageTags() {
8873
- const r = await execa17(
9927
+ const r = await execa18(
8874
9928
  "docker",
8875
9929
  ["image", "ls", "--format", "{{.Repository}}:{{.Tag}}", `${CHECKPOINT_IMAGE_PREFIX}*`],
8876
9930
  { reject: false }
@@ -8916,6 +9970,8 @@ async function pruneBoxes(opts = {}) {
8916
9970
  SHARED_CLAUDE_VOLUME,
8917
9971
  // The shared codex-config volume — same reasoning (holds Codex auth).
8918
9972
  SHARED_CODEX_VOLUME,
9973
+ // The shared agents-config volume — holds the cross-agent ~/.agents skills.
9974
+ SHARED_AGENTS_VOLUME,
8919
9975
  // The shared opencode-config volume — same reasoning (holds OpenCode auth).
8920
9976
  SHARED_OPENCODE_VOLUME,
8921
9977
  // Shared across boxes: downloaded IDE extensions. Same reasoning.
@@ -8978,7 +10034,7 @@ async function pruneBoxes(opts = {}) {
8978
10034
  } catch {
8979
10035
  }
8980
10036
  try {
8981
- await execa17("docker", ["image", "rm", RELAY_IMAGE_REF], { reject: false });
10037
+ await execa18("docker", ["image", "rm", RELAY_IMAGE_REF], { reject: false });
8982
10038
  } catch {
8983
10039
  }
8984
10040
  try {
@@ -8999,7 +10055,7 @@ async function pruneBoxes(opts = {}) {
8999
10055
  async function snapshotPresent(path) {
9000
10056
  if (!path) return false;
9001
10057
  try {
9002
- const s = await stat9(path);
10058
+ const s = await stat10(path);
9003
10059
  return s.isDirectory();
9004
10060
  } catch {
9005
10061
  return false;
@@ -9040,7 +10096,7 @@ function splitPair(raw) {
9040
10096
  return [parts[0].trim(), parts[1].trim()];
9041
10097
  }
9042
10098
  async function duBytes(path) {
9043
- const result = await execa18("du", ["-sk", path], { reject: false });
10099
+ const result = await execa19("du", ["-sk", path], { reject: false });
9044
10100
  if (result.exitCode !== 0) return null;
9045
10101
  const kb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
9046
10102
  return Number.isNaN(kb) ? null : kb * 1024;
@@ -9049,11 +10105,11 @@ async function volumeSizeBytes(name) {
9049
10105
  if (!name) return null;
9050
10106
  const engine = await detectEngine();
9051
10107
  if (engine === "orbstack") {
9052
- const live = join15(homedir11(), "OrbStack", "docker", "volumes", name);
10108
+ const live = join16(homedir13(), "OrbStack", "docker", "volumes", name);
9053
10109
  const sz = await duBytes(live);
9054
10110
  if (sz !== null) return sz;
9055
10111
  }
9056
- const df = await execa18(
10112
+ const df = await execa19(
9057
10113
  "docker",
9058
10114
  ["system", "df", "-v", "--format", "{{json .Volumes}}"],
9059
10115
  { reject: false }
@@ -9074,7 +10130,7 @@ async function volumeSizeBytes(name) {
9074
10130
  return null;
9075
10131
  }
9076
10132
  async function imageBytes(tag) {
9077
- const r = await execa18("docker", ["image", "inspect", tag, "--format", "{{.Size}}"], {
10133
+ const r = await execa19("docker", ["image", "inspect", tag, "--format", "{{.Size}}"], {
9078
10134
  reject: false
9079
10135
  });
9080
10136
  if (r.exitCode !== 0) return null;
@@ -9085,7 +10141,7 @@ async function projectCheckpointImageBytes(projectRoot, name) {
9085
10141
  return imageBytes(checkpointImageTag(projectRoot, name));
9086
10142
  }
9087
10143
  async function allCheckpointImagesBytes() {
9088
- const r = await execa18(
10144
+ const r = await execa19(
9089
10145
  "docker",
9090
10146
  [
9091
10147
  "image",
@@ -9112,7 +10168,7 @@ async function allCheckpointImagesBytes() {
9112
10168
  return any ? total : null;
9113
10169
  }
9114
10170
  async function agentboxHomeBytes() {
9115
- return duBytes(join15(homedir11(), ".agentbox"));
10171
+ return duBytes(join16(homedir13(), ".agentbox"));
9116
10172
  }
9117
10173
  function limitsFromRecord(record) {
9118
10174
  const r = record.resourceLimits;
@@ -9137,7 +10193,7 @@ function reconcileLimits(persisted, dockerJson) {
9137
10193
  };
9138
10194
  }
9139
10195
  async function containerWritableBytes(container) {
9140
- const r = await execa18(
10196
+ const r = await execa19(
9141
10197
  "docker",
9142
10198
  ["ps", "-a", "--filter", `name=^${container}$`, "--format", "{{.Size}}", "--size"],
9143
10199
  { reject: false }
@@ -9184,7 +10240,7 @@ async function boxResourceStats(record) {
9184
10240
  if (await inspectContainerStatus(record.container) !== "running") {
9185
10241
  return base;
9186
10242
  }
9187
- const proc = await execa18(
10243
+ const proc = await execa19(
9188
10244
  "docker",
9189
10245
  ["stats", "--no-stream", "--format", "{{json .}}", record.container],
9190
10246
  { reject: false }
@@ -9361,9 +10417,9 @@ var dockerProvider = {
9361
10417
  var BOX_WORKFLOWS_DIR = "/home/vscode/.claude/workflows";
9362
10418
  var BOX_DYNAMIC_SYNC_MANIFEST = "/home/vscode/.agentbox/dynamic-sync.json";
9363
10419
  var BOX_MEMORY_DIR = `${BOX_CLAUDE_PROJECT_DIR}/memory`;
9364
- async function pathExists8(p) {
10420
+ async function pathExists9(p) {
9365
10421
  try {
9366
- await stat10(p);
10422
+ await stat11(p);
9367
10423
  return true;
9368
10424
  } catch {
9369
10425
  return false;
@@ -9379,14 +10435,14 @@ async function walkFiles(root, prefix = "") {
9379
10435
  const out = [];
9380
10436
  for (const ent of entries) {
9381
10437
  const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
9382
- const full = join16(root, ent.name);
10438
+ const full = join17(root, ent.name);
9383
10439
  if (ent.isDirectory()) {
9384
10440
  out.push(...await walkFiles(full, rel));
9385
10441
  } else if (ent.isFile()) {
9386
10442
  out.push(rel);
9387
10443
  } else if (ent.isSymbolicLink()) {
9388
10444
  try {
9389
- const s = await stat10(full);
10445
+ const s = await stat11(full);
9390
10446
  if (s.isFile()) out.push(rel);
9391
10447
  } catch {
9392
10448
  }
@@ -9395,7 +10451,7 @@ async function walkFiles(root, prefix = "") {
9395
10451
  return out;
9396
10452
  }
9397
10453
  async function hashFile(absPath) {
9398
- const buf = await readFile9(absPath);
10454
+ const buf = await readFile10(absPath);
9399
10455
  return createHash32("sha256").update(buf).digest("hex");
9400
10456
  }
9401
10457
  async function buildHostSet(name, hostDir, boxDst) {
@@ -9403,13 +10459,13 @@ async function buildHostSet(name, hostDir, boxDst) {
9403
10459
  const rels = await walkFiles(hostDir);
9404
10460
  const files = {};
9405
10461
  for (const rel of rels) {
9406
- files[rel] = await hashFile(join16(hostDir, rel));
10462
+ files[rel] = await hashFile(join17(hostDir, rel));
9407
10463
  }
9408
10464
  return { dst: boxDst, files, hostDir };
9409
10465
  }
9410
- async function buildHostSyncManifest(workspacePath, hostHome = homedir12()) {
9411
- const workflowsDir = join16(hostHome, ".claude", "workflows");
9412
- const workflowsHost = await pathExists8(workflowsDir) ? workflowsDir : null;
10466
+ async function buildHostSyncManifest(workspacePath, hostHome = homedir14()) {
10467
+ const workflowsDir = join17(hostHome, ".claude", "workflows");
10468
+ const workflowsHost = await pathExists9(workflowsDir) ? workflowsDir : null;
9413
10469
  const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
9414
10470
  const [workflows, memory] = await Promise.all([
9415
10471
  buildHostSet("workflows", workflowsHost, BOX_WORKFLOWS_DIR),
@@ -9430,7 +10486,7 @@ function computeSyncDelta(host, box) {
9430
10486
  uploads.push({
9431
10487
  set: name,
9432
10488
  rel,
9433
- absSrc: join16(hostSet.hostDir, rel),
10489
+ absSrc: join17(hostSet.hostDir, rel),
9434
10490
  dst: `${hostSet.dst}/${rel}`
9435
10491
  });
9436
10492
  }
@@ -9449,16 +10505,16 @@ async function stageDynamicSyncTarball(uploads) {
9449
10505
  return { tarballPath: null, cleanup: async () => {
9450
10506
  } };
9451
10507
  }
9452
- const stageDir = await mkdtemp4(join16(tmpdir4(), "agentbox-dynsync-stage-"));
10508
+ const stageDir = await mkdtemp4(join17(tmpdir4(), "agentbox-dynsync-stage-"));
9453
10509
  let tarballPath = null;
9454
10510
  try {
9455
10511
  for (const up of uploads) {
9456
- const target = join16(stageDir, up.set, up.rel);
10512
+ const target = join17(stageDir, up.set, up.rel);
9457
10513
  await mkdir8(dirname4(target), { recursive: true });
9458
10514
  await copyFile2(up.absSrc, target);
9459
10515
  }
9460
- tarballPath = join16(tmpdir4(), `agentbox-dynsync-${basename7(stageDir)}.tar.gz`);
9461
- await execa19("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
10516
+ tarballPath = join17(tmpdir4(), `agentbox-dynsync-${basename7(stageDir)}.tar.gz`);
10517
+ await execa20("tar", ["-czf", tarballPath, "-C", stageDir, "."], {
9462
10518
  env: { ...process.env, COPYFILE_DISABLE: "1" }
9463
10519
  });
9464
10520
  const tp = tarballPath;
@@ -9585,6 +10641,7 @@ export {
9585
10641
  stageClaudeStaticForUpload,
9586
10642
  stageClaudeCredentialsForUpload,
9587
10643
  stageCodexStaticForUpload,
10644
+ stageAgentsStaticForUpload,
9588
10645
  stageCodexCredentialsForUpload,
9589
10646
  stageOpencodeStaticForUpload,
9590
10647
  stageOpencodeCredentialsForUpload,
@@ -9630,6 +10687,10 @@ export {
9630
10687
  volumeHasCodexAuth,
9631
10688
  codexSessionInfo,
9632
10689
  pullCodexConfig,
10690
+ SHARED_AGENTS_VOLUME,
10691
+ resolveAgentsVolume,
10692
+ ensureAgentsVolume,
10693
+ buildAgentsMounts,
9633
10694
  SHARED_OPENCODE_VOLUME,
9634
10695
  DEFAULT_OPENCODE_SESSION,
9635
10696
  resolveOpencodeVolume,
@@ -9755,4 +10816,43 @@ export {
9755
10816
  browserSessionActive,
9756
10817
  ensureBoxBrowser
9757
10818
  };
9758
- //# sourceMappingURL=chunk-U7IZS2ZP.js.map
10819
+ /*! Bundled license information:
10820
+
10821
+ smol-toml/dist/date.js:
10822
+ smol-toml/dist/error.js:
10823
+ smol-toml/dist/primitive.js:
10824
+ smol-toml/dist/util.js:
10825
+ smol-toml/dist/extract.js:
10826
+ smol-toml/dist/struct.js:
10827
+ smol-toml/dist/parse.js:
10828
+ smol-toml/dist/stringify.js:
10829
+ smol-toml/dist/index.js:
10830
+ (*!
10831
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
10832
+ * SPDX-License-Identifier: BSD-3-Clause
10833
+ *
10834
+ * Redistribution and use in source and binary forms, with or without
10835
+ * modification, are permitted provided that the following conditions are met:
10836
+ *
10837
+ * 1. Redistributions of source code must retain the above copyright notice, this
10838
+ * list of conditions and the following disclaimer.
10839
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
10840
+ * this list of conditions and the following disclaimer in the
10841
+ * documentation and/or other materials provided with the distribution.
10842
+ * 3. Neither the name of the copyright holder nor the names of its contributors
10843
+ * may be used to endorse or promote products derived from this software without
10844
+ * specific prior written permission.
10845
+ *
10846
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
10847
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10848
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
10849
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
10850
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10851
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
10852
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
10853
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
10854
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
10855
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
10856
+ *)
10857
+ */
10858
+ //# sourceMappingURL=chunk-A5OFRJDI.js.map