@madarco/agentbox 0.17.1 → 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 (60) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +4 -3
  3. package/dist/{_cloud-attach-RUD4W33P.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-HFQZJO73.js → chunk-A5OFRJDI.js} +1322 -216
  7. package/dist/chunk-A5OFRJDI.js.map +1 -0
  8. package/dist/{chunk-YUGLNTT2.js → chunk-JK5V4OLT.js} +349 -16
  9. package/dist/chunk-JK5V4OLT.js.map +1 -0
  10. package/dist/{chunk-IA6YHH52.js → chunk-MODNW54N.js} +6 -3
  11. package/dist/{chunk-IA6YHH52.js.map → chunk-MODNW54N.js.map} +1 -1
  12. package/dist/{chunk-46NXCJ6Z.js → chunk-NXX3KQZ6.js} +2 -2
  13. package/dist/{chunk-3JXSW6PN.js → chunk-P6UT5XGE.js} +2 -2
  14. package/dist/{chunk-KTDJ5JTE.js → chunk-SPUUOEW2.js} +273 -54
  15. package/dist/chunk-SPUUOEW2.js.map +1 -0
  16. package/dist/{chunk-XWBFWUY2.js → chunk-Y6PUCLOE.js} +2 -2
  17. package/dist/{dist-VAATGBAR.js → dist-EKSNZHDY.js} +13 -3
  18. package/dist/{dist-TEKY3GFT.js → dist-FTCDWRAL.js} +18 -7
  19. package/dist/dist-FTCDWRAL.js.map +1 -0
  20. package/dist/{dist-CNABE32V.js → dist-PRDYMXCX.js} +10 -5
  21. package/dist/dist-PRDYMXCX.js.map +1 -0
  22. package/dist/{dist-BO2R55FX.js → dist-U2BHTWG4.js} +17 -5
  23. package/dist/dist-U2BHTWG4.js.map +1 -0
  24. package/dist/{dist-CROGTJ7N.js → dist-VQSZVBT3.js} +20 -6
  25. package/dist/dist-VQSZVBT3.js.map +1 -0
  26. package/dist/index.js +1009 -449
  27. package/dist/index.js.map +1 -1
  28. package/dist/{prepared-state-MQHD3M5F-OVABNV66.js → prepared-state-MQHD3M5F-5ZMCNY43.js} +2 -2
  29. package/package.json +3 -3
  30. package/runtime/docker/apps/cli/share/agentbox-setup/SKILL.md +1 -1
  31. package/runtime/docker/packages/ctl/dist/bin.cjs +142 -110
  32. package/runtime/docker/packages/sandbox-docker/scripts/agentbox-dockerd-start +13 -0
  33. package/runtime/e2b/agentbox-setup-skill.md +1 -1
  34. package/runtime/e2b/ctl.cjs +142 -110
  35. package/runtime/hetzner/agentbox-dockerd-start +13 -0
  36. package/runtime/hetzner/agentbox-setup-skill.md +1 -1
  37. package/runtime/hetzner/ctl.cjs +142 -110
  38. package/runtime/relay/bin.cjs +270 -66
  39. package/runtime/vercel/agentbox-dockerd-start +145 -0
  40. package/runtime/vercel/agentbox-setup-skill.md +1 -1
  41. package/runtime/vercel/ctl.cjs +142 -110
  42. package/runtime/vercel/custom-system-CLAUDE.md +5 -4
  43. package/runtime/vercel/scripts/provision.sh +20 -5
  44. package/share/agentbox-setup/SKILL.md +1 -1
  45. package/share/host-skills/agentbox/SKILL.md +2 -2
  46. package/share/host-skills/codex/agentbox.md +10 -2
  47. package/dist/chunk-6QFPYU4Z.js.map +0 -1
  48. package/dist/chunk-HFQZJO73.js.map +0 -1
  49. package/dist/chunk-KTDJ5JTE.js.map +0 -1
  50. package/dist/chunk-YUGLNTT2.js.map +0 -1
  51. package/dist/dist-BO2R55FX.js.map +0 -1
  52. package/dist/dist-CNABE32V.js.map +0 -1
  53. package/dist/dist-CROGTJ7N.js.map +0 -1
  54. package/dist/dist-TEKY3GFT.js.map +0 -1
  55. /package/dist/{_cloud-attach-RUD4W33P.js.map → _cloud-attach-YM2KOWHO.js.map} +0 -0
  56. /package/dist/{chunk-46NXCJ6Z.js.map → chunk-NXX3KQZ6.js.map} +0 -0
  57. /package/dist/{chunk-3JXSW6PN.js.map → chunk-P6UT5XGE.js.map} +0 -0
  58. /package/dist/{chunk-XWBFWUY2.js.map → chunk-Y6PUCLOE.js.map} +0 -0
  59. /package/dist/{dist-VAATGBAR.js.map → dist-EKSNZHDY.js.map} +0 -0
  60. /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";
@@ -986,7 +986,8 @@ var BUILT_IN_DEFAULTS = {
986
986
  },
987
987
  attach: {
988
988
  openIn: "split",
989
- cmuxStatus: true
989
+ cmuxStatus: true,
990
+ herdrStatus: true
990
991
  },
991
992
  code: {
992
993
  ide: "auto",
@@ -1290,13 +1291,18 @@ var KEY_REGISTRY = [
1290
1291
  key: "attach.openIn",
1291
1292
  type: "enum",
1292
1293
  enumValues: ["split", "window", "tab", "same"],
1293
- description: "Where `agentbox claude|codex|opencode` opens the attached session when run from tmux, cmux, or iTerm2: `split` (tmux split-window / cmux new-split / iTerm2 vertical split, default \u2014 same workspace), `window` (tmux new-window / cmux new-workspace / new iTerm2 window), `tab` (tmux new-window / cmux new-surface tab in the current pane, same workspace / new iTerm2 tab), or `same` (attach inline in the current terminal). Outside tmux/cmux/iTerm2 every value behaves like `same`."
1294
+ description: "Where `agentbox claude|codex|opencode` opens the attached session when run from tmux, cmux, Herdr, or iTerm2: `split` (tmux split-window / cmux new-split / Herdr pane.split / iTerm2 vertical split, default \u2014 same workspace), `window` (tmux new-window / cmux new-workspace / Herdr workspace.create / new iTerm2 window), `tab` (tmux new-window / cmux new-surface / Herdr tab.create in the current workspace / new iTerm2 tab), or `same` (attach inline in the current terminal). Outside tmux/cmux/Herdr/iTerm2 every value behaves like `same`."
1294
1295
  },
1295
1296
  {
1296
1297
  key: "attach.cmuxStatus",
1297
1298
  type: "bool",
1298
1299
  description: "When attached inside cmux, reflect the box agent's live activity on its cmux workspace (colour + description: blue=working, amber=needs input, idle clears; restored on detach) and, when the agent needs input, flag the box's own tab via a cmux notification (tab badge + reorder + desktop notification) so it stands out among sibling tabs. cmux only; no-op in other terminals."
1299
1300
  },
1301
+ {
1302
+ key: "attach.herdrStatus",
1303
+ type: "bool",
1304
+ description: "When attached inside Herdr, report the box agent's live activity to its Herdr pane (pane.report_agent: working / blocked / idle) so it looks like a normal agent pane and Herdr handles needs-input natively, and fire a Herdr notification for AgentBox's own host-relay approval prompts (git push / PR / checkpoint \u2026) which Herdr can't otherwise see. Herdr only; no-op in other terminals."
1305
+ },
1300
1306
  {
1301
1307
  key: "code.ide",
1302
1308
  type: "enum",
@@ -1407,7 +1413,7 @@ var KEY_REGISTRY = [
1407
1413
  key: "queue.openIn",
1408
1414
  type: "enum",
1409
1415
  enumValues: ["none", "split", "window", "tab"],
1410
- description: "When a background `-i` job finishes creating its box, where the host relay opens an attached terminal onto it: `none` (default \u2014 open nothing, just queue), `split`, `window`, or `tab`. Honored only when the submitting shell runs inside tmux, cmux, or iTerm2 (the targeting is captured at submit time). Under cmux, `split` splits the pane you submitted from (falling back to the parent workspace, then a new workspace), `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; iTerm2 opens relative to the frontmost window. Unlike `attach.openIn` there is no `same` mode \u2014 the box is created asynchronously, so it is always a fresh terminal."
1416
+ description: "When a background `-i` job finishes creating its box, where the host relay opens an attached terminal onto it: `none` (default \u2014 open nothing, just queue), `split`, `window`, or `tab`. Honored only when the submitting shell runs inside tmux, cmux, Herdr, or iTerm2 (the targeting is captured at submit time). Under cmux, `split` splits the pane you submitted from (falling back to the parent workspace, then a new workspace), `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; under Herdr, `split` splits the pane you submitted from, `tab` adds a tab in the parent workspace, and `window` opens a separate workspace; iTerm2 opens relative to the frontmost window. Unlike `attach.openIn` there is no `same` mode \u2014 the box is created asynchronously, so it is always a fresh terminal."
1411
1417
  },
1412
1418
  {
1413
1419
  key: "cloud.useCurrentBranch",
@@ -2044,7 +2050,7 @@ async function touchProjectMeta(absPath) {
2044
2050
  // ../../packages/sandbox-docker/dist/index.js
2045
2051
  import { spawnSync } from "child_process";
2046
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";
2047
- import { homedir as homedir3, tmpdir as tmpdir2 } from "os";
2053
+ import { homedir as homedir4, tmpdir as tmpdir2 } from "os";
2048
2054
  import { isAbsolute as isAbsolute2, join as join4, relative as relative2 } from "path";
2049
2055
  import { setTimeout as delay } from "timers/promises";
2050
2056
  import { execa as execa6 } from "execa";
@@ -2058,51 +2064,879 @@ import { existsSync, mkdirSync, renameSync, statSync } from "fs";
2058
2064
  import { basename as basename3, dirname as dirname3, posix, resolve as resolve2 } from "path";
2059
2065
  import { execa as execa22 } from "execa";
2060
2066
  import { copyFile, mkdtemp, readdir as readdir22, readFile as readFile32, rm as rm3, stat as stat22, writeFile as writeFile3 } from "fs/promises";
2061
- import { homedir as homedir22, tmpdir } from "os";
2067
+ import { homedir as homedir3, tmpdir } from "os";
2062
2068
  import { basename as basename4, join as join32, relative } from "path";
2063
2069
  import { execa as execa5 } from "execa";
2064
2070
  import { chmod, mkdir as mkdir22, readFile as readFile23 } from "fs/promises";
2065
2071
  import { basename as basename32, join as join22 } from "path";
2066
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
2067
2897
  import { spawnSync as spawnSync2 } from "child_process";
2068
- import { stat as stat42 } from "fs/promises";
2069
- import { homedir as homedir4 } from "os";
2898
+ import { readFile as readFile52, stat as stat42 } from "fs/promises";
2899
+ import { homedir as homedir5 } from "os";
2070
2900
  import { join as join52 } from "path";
2071
2901
  import { execa as execa7 } from "execa";
2072
- import { spawnSync as spawnSync3 } from "child_process";
2073
2902
  import { stat as stat5 } from "fs/promises";
2074
- import { homedir as homedir5 } from "os";
2903
+ import { homedir as homedir6 } from "os";
2075
2904
  import { join as join6 } from "path";
2076
2905
  import { execa as execa8 } from "execa";
2077
- import { randomBytes as randomBytes2 } from "crypto";
2078
- import { createHash as createHash22 } from "crypto";
2079
- 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";
2080
2909
  import { join as join7 } from "path";
2081
2910
  import { execa as execa9 } from "execa";
2082
- import { existsSync as existsSync2 } from "fs";
2911
+ import { randomBytes as randomBytes2 } from "crypto";
2912
+ import { createHash as createHash22 } from "crypto";
2083
2913
  import { readFile as readFile6 } from "fs/promises";
2084
- import { homedir as homedir6 } from "os";
2085
2914
  import { join as join8 } from "path";
2086
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";
2087
2920
  import { execa as execa11 } from "execa";
2088
- import { mkdir as mkdir42, readdir as readdir42, rm as rm32, stat as stat6 } from "fs/promises";
2089
- import { homedir as homedir7, platform } from "os";
2090
- import { join as join9, resolve as resolve22 } from "path";
2091
- import { mkdir as mkdir5, mkdtemp as mkdtemp3, readFile as readFile7, readdir as readdir5, rm as rm4, writeFile as writeFile32 } from "fs/promises";
2092
- import { homedir as homedir8, tmpdir as tmpdir3 } from "os";
2093
- import { basename as basename5, join as join10 } from "path";
2094
2921
  import { execa as execa12 } from "execa";
2095
- 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";
2096
2928
  import { execa as execa13 } from "execa";
2929
+ import { stat as stat8 } from "fs/promises";
2097
2930
  import { execa as execa14 } from "execa";
2931
+ import { execa as execa15 } from "execa";
2098
2932
  import { spawn } from "child_process";
2099
2933
  import { randomBytes as randomBytes22 } from "crypto";
2100
2934
  import { existsSync as existsSync3, openSync } from "fs";
2101
- 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";
2102
2936
  import { request as httpRequest } from "http";
2103
2937
  import { createRequire } from "module";
2104
- import { homedir as homedir9 } from "os";
2105
- 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";
2106
2940
  import { setTimeout as delay2 } from "timers/promises";
2107
2941
  import { fileURLToPath } from "url";
2108
2942
 
@@ -2602,21 +3436,22 @@ var QUEUE_LOGS_DIR = join3(STATE_DIR, "logs");
2602
3436
  function queueLogPath(id) {
2603
3437
  return join3(QUEUE_LOGS_DIR, `queue-${id}.log`);
2604
3438
  }
3439
+ var FAILURE_BACKOFF_MS = 5 * 6e4;
2605
3440
 
2606
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";
2607
3445
  import { execa as execa17 } from "execa";
2608
- import { readdir as readdir7, rm as rm6, stat as stat9 } from "fs/promises";
2609
3446
  import { join as join14 } from "path";
2610
- import { execa as execa16 } from "execa";
2611
- import { join as join13 } from "path";
2612
- import { homedir as homedir11 } from "os";
2613
- import { join as join15 } from "path";
2614
- import { execa as execa18 } from "execa";
2615
- import { createHash as createHash32 } from "crypto";
2616
- 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";
2617
- import { homedir as homedir12, tmpdir as tmpdir4 } from "os";
2618
- 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";
2619
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";
2620
3455
  function isHostPathHookCommand(command, hostHome) {
2621
3456
  if (typeof command !== "string" || command.length === 0) return false;
2622
3457
  if (hostHome.length === 0) return false;
@@ -3831,6 +4666,75 @@ async function syncClaudeCredentials(spec, opts) {
3831
4666
  return { direction: "noop", volumeHasCredentials: false };
3832
4667
  }
3833
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
+ }
3834
4738
  var CLOUD_WORKSPACE = "/workspace";
3835
4739
  async function pathExists(p) {
3836
4740
  try {
@@ -3929,7 +4833,7 @@ function encodeClaudeProjectsKey(absPath) {
3929
4833
  return absPath.replace(/[^a-zA-Z0-9]/g, "-");
3930
4834
  }
3931
4835
  var BOX_CLAUDE_PROJECT_DIR = "/home/vscode/.claude/projects/-workspace";
3932
- async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir22()) {
4836
+ async function resolveClaudeMemoryDir(hostWorkspace, hostHome = homedir3()) {
3933
4837
  if (hostWorkspace.length === 0) return null;
3934
4838
  const memDir = join32(
3935
4839
  hostHome,
@@ -3984,7 +4888,7 @@ async function buildBoxClaudeJsonFromHost(opts) {
3984
4888
  return working;
3985
4889
  }
3986
4890
  async function stageClaudeJsonOnlyForUpload(opts = {}) {
3987
- const hostHome = opts.hostHome ?? homedir22();
4891
+ const hostHome = opts.hostHome ?? homedir3();
3988
4892
  const stageDir = await mkStageDir("claude-json-only");
3989
4893
  let tarballPath = null;
3990
4894
  try {
@@ -4006,7 +4910,7 @@ async function stageClaudeJsonOnlyForUpload(opts = {}) {
4006
4910
  }
4007
4911
  }
4008
4912
  async function stageClaudeStaticForUpload(opts = {}) {
4009
- const hostHome = opts.hostHome ?? homedir22();
4913
+ const hostHome = opts.hostHome ?? homedir3();
4010
4914
  const hostClaude = join32(hostHome, ".claude");
4011
4915
  if (!await pathExists(hostClaude)) return emptyResult();
4012
4916
  const stageDir = await mkStageDir("claude-static");
@@ -4077,12 +4981,16 @@ var CODEX_RSYNC_EXCLUDES = [
4077
4981
  "--exclude=log",
4078
4982
  "--exclude=history.jsonl",
4079
4983
  "--exclude=hooks.json",
4080
- "--exclude=logs_2.sqlite",
4081
- "--exclude=logs_2.sqlite-shm",
4082
- "--exclude=logs_2.sqlite-wal",
4083
- "--exclude=state_5.sqlite",
4084
- "--exclude=state_5.sqlite-shm",
4085
- "--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",
4086
4994
  "--exclude=sqlite",
4087
4995
  "--exclude=cache",
4088
4996
  "--exclude=vendor_imports",
@@ -4100,8 +5008,16 @@ var CODEX_RSYNC_EXCLUDES = [
4100
5008
  "--exclude=version.json"
4101
5009
  ];
4102
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
+ }
4103
5019
  async function stageCodexStaticForUpload(opts = {}) {
4104
- const hostHome = opts.hostHome ?? homedir22();
5020
+ const hostHome = opts.hostHome ?? homedir3();
4105
5021
  const hostCodex = join32(hostHome, ".codex");
4106
5022
  if (!await pathExists(hostCodex)) return emptyResult();
4107
5023
  const stageDir = await mkStageDir("codex-static");
@@ -4117,6 +5033,7 @@ async function stageCodexStaticForUpload(opts = {}) {
4117
5033
  `${hostCodex}/`,
4118
5034
  `${stageDir}/`
4119
5035
  ]);
5036
+ await sanitizeStagedCodexConfig(join32(stageDir, "config.toml"), hostHome);
4120
5037
  tarballPath = await tarballFromDir(stageDir, "codex-static");
4121
5038
  return {
4122
5039
  tarballPath,
@@ -4129,8 +5046,35 @@ async function stageCodexStaticForUpload(opts = {}) {
4129
5046
  throw err;
4130
5047
  }
4131
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
+ }
4132
5076
  async function stageCodexCredentialsForUpload(opts = {}) {
4133
- const hostHome = opts.hostHome ?? homedir22();
5077
+ const hostHome = opts.hostHome ?? homedir3();
4134
5078
  const cloudBackup = join32(hostHome, ".agentbox", "codex-credentials.json");
4135
5079
  if (await pathExists(cloudBackup)) {
4136
5080
  return stageSingleFileTarball("codex-creds", cloudBackup, "auth.json");
@@ -4153,7 +5097,7 @@ var OPENCODE_DATA_EXCLUDES = [
4153
5097
  "--exclude=opencode.db-wal"
4154
5098
  ];
4155
5099
  async function stageOpencodeStaticForUpload(opts = {}) {
4156
- const hostHome = opts.hostHome ?? homedir22();
5100
+ const hostHome = opts.hostHome ?? homedir3();
4157
5101
  const hostData = join32(hostHome, ".local", "share", "opencode");
4158
5102
  const hostConfig = join32(hostHome, ".config", "opencode");
4159
5103
  const hasData = await pathExists(hostData);
@@ -4198,7 +5142,7 @@ async function stageOpencodeStaticForUpload(opts = {}) {
4198
5142
  }
4199
5143
  }
4200
5144
  async function stageOpencodeCredentialsForUpload(opts = {}) {
4201
- const hostHome = opts.hostHome ?? homedir22();
5145
+ const hostHome = opts.hostHome ?? homedir3();
4202
5146
  const cloudBackup = join32(hostHome, ".agentbox", "opencode-credentials.json");
4203
5147
  if (await pathExists(cloudBackup)) {
4204
5148
  return stageSingleFileTarball("opencode-creds", cloudBackup, "auth.json");
@@ -4208,7 +5152,7 @@ async function stageOpencodeCredentialsForUpload(opts = {}) {
4208
5152
  return stageSingleFileTarball("opencode-creds", hostAuth, "auth.json");
4209
5153
  }
4210
5154
  async function stageOpencodeStateForUpload(opts = {}) {
4211
- const hostHome = opts.hostHome ?? homedir22();
5155
+ const hostHome = opts.hostHome ?? homedir3();
4212
5156
  const hostModel = join32(hostHome, ".local", "state", "opencode", "model.json");
4213
5157
  if (!await pathExists(hostModel)) return emptyResult();
4214
5158
  return stageSingleFileTarball("opencode-state", hostModel, "model.json");
@@ -4290,13 +5234,13 @@ async function ensureClaudeVolume(spec, opts) {
4290
5234
  await ensureVolume(spec.volume);
4291
5235
  const created = !existed;
4292
5236
  if (!opts.syncFromHost) return { created, synced: false };
4293
- const hostClaude = join4(homedir3(), ".claude");
5237
+ const hostClaude = join4(homedir4(), ".claude");
4294
5238
  if (!await pathExists2(hostClaude)) return { created, synced: false };
4295
- const hostClaudeJson = join4(homedir3(), ".claude.json");
5239
+ const hostClaudeJson = join4(homedir4(), ".claude.json");
4296
5240
  const hasJson = await pathExists2(hostClaudeJson);
4297
5241
  const seedClaudeJson = !await volumeHasClaudeJson(spec.volume, opts.image);
4298
- const hostHome = homedir3();
4299
- const hostAgents = join4(homedir3(), ".agents");
5242
+ const hostHome = homedir4();
5243
+ const hostAgents = join4(homedir4(), ".agents");
4300
5244
  const hasAgents = await pathExists2(hostAgents);
4301
5245
  const args = [
4302
5246
  "run",
@@ -5013,7 +5957,7 @@ async function readJsonFile(path) {
5013
5957
  }
5014
5958
  }
5015
5959
  async function pullClaudeExtras(spec, opts) {
5016
- const hostHome = homedir3();
5960
+ const hostHome = homedir4();
5017
5961
  const hostClaude = join4(hostHome, ".claude");
5018
5962
  const inventoryScript = [
5019
5963
  "for cat in skills agents commands; do",
@@ -5182,9 +6126,12 @@ async function ensureCodexVolume(spec, opts) {
5182
6126
  const existed = await volumeExists(spec.volume);
5183
6127
  await ensureVolume(spec.volume);
5184
6128
  const created = !existed;
5185
- const hostCodex = join52(homedir4(), ".codex");
6129
+ const hostCodex = join52(homedir5(), ".codex");
5186
6130
  const willSync = opts.syncFromHost && await pathExists3(hostCodex);
5187
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; }" : "";
5188
6135
  await execa7("docker", [
5189
6136
  "run",
5190
6137
  "--rm",
@@ -5199,8 +6146,18 @@ async function ensureCodexVolume(spec, opts) {
5199
6146
  "-c",
5200
6147
  // --exclude=hooks.json: the AgentBox activity hooks file is box-owned
5201
6148
  // (seeded by seedCodexHooks); never let the host copy clobber it.
5202
- "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"
5203
6159
  ]);
6160
+ await sanitizeVolumeCodexConfig(spec.volume, opts.image);
5204
6161
  return { created, synced: true };
5205
6162
  }
5206
6163
  await execa7(
@@ -5219,6 +6176,9 @@ async function ensureCodexVolume(spec, opts) {
5219
6176
  ],
5220
6177
  { reject: false }
5221
6178
  );
6179
+ if (!await pathExists3(join52(hostCodex, "config.toml"))) {
6180
+ await sanitizeVolumeCodexConfig(spec.volume, opts.image);
6181
+ }
5222
6182
  return { created, synced: false };
5223
6183
  }
5224
6184
  async function seedCodexHooks(volume, image) {
@@ -5240,6 +6200,39 @@ async function seedCodexHooks(volume, image) {
5240
6200
  return { seeded: false };
5241
6201
  }
5242
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
+ }
5243
6236
  var CODEX_FORWARDED_ENV_KEYS = ["OPENAI_API_KEY"];
5244
6237
  function buildCodexMounts(spec, hostEnv) {
5245
6238
  const env = {};
@@ -5414,7 +6407,7 @@ async function codexSessionInfo(container, sessionName) {
5414
6407
  }
5415
6408
  var CODEX_PULL_ITEMS = ["config.toml", "auth.json", "prompts"];
5416
6409
  async function pullCodexConfig(spec, opts) {
5417
- const hostCodex = join52(homedir4(), ".codex");
6410
+ const hostCodex = join52(homedir5(), ".codex");
5418
6411
  const inv = await execa7(
5419
6412
  "docker",
5420
6413
  [
@@ -5474,6 +6467,57 @@ async function pullCodexConfig(spec, opts) {
5474
6467
  }
5475
6468
  return { newItems };
5476
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
+ }
5477
6521
  var SHARED_OPENCODE_VOLUME = "agentbox-opencode-config";
5478
6522
  var DEFAULT_OPENCODE_SESSION = "opencode";
5479
6523
  var CONTAINER_OPENCODE_DIR = "/home/vscode/.local/share/opencode";
@@ -5486,9 +6530,9 @@ function resolveOpencodeVolume(opts) {
5486
6530
  }
5487
6531
  return { volume: SHARED_OPENCODE_VOLUME };
5488
6532
  }
5489
- async function pathExists4(p) {
6533
+ async function pathExists5(p) {
5490
6534
  try {
5491
- await stat5(p);
6535
+ await stat6(p);
5492
6536
  return true;
5493
6537
  } catch {
5494
6538
  return false;
@@ -5503,12 +6547,12 @@ async function ensureOpencodeVolume(spec, opts) {
5503
6547
  const existed = await volumeExists(spec.volume);
5504
6548
  await ensureVolume(spec.volume);
5505
6549
  const created = !existed;
5506
- const hostData = join6(homedir5(), ".local", "share", "opencode");
5507
- const hostConfig = join6(homedir5(), ".config", "opencode");
5508
- const hostState = join6(homedir5(), ".local", "state", "opencode");
5509
- const hasData = await pathExists4(hostData);
5510
- const hasConfig = await pathExists4(hostConfig);
5511
- 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);
5512
6556
  const willSync = opts.syncFromHost && (hasData || hasConfig || hasState);
5513
6557
  if (willSync) {
5514
6558
  const args = ["run", "--rm", "--user", "0", "-v", `${spec.volume}:/dst`];
@@ -5531,10 +6575,10 @@ async function ensureOpencodeVolume(spec, opts) {
5531
6575
  }
5532
6576
  steps.push("chown -R 1000:1000 /dst");
5533
6577
  args.push(opts.image, "sh", "-c", steps.join(" && "));
5534
- await execa8("docker", args);
6578
+ await execa9("docker", args);
5535
6579
  return { created, synced: true };
5536
6580
  }
5537
- await execa8(
6581
+ await execa9(
5538
6582
  "docker",
5539
6583
  [
5540
6584
  "run",
@@ -5554,7 +6598,7 @@ async function ensureOpencodeVolume(spec, opts) {
5554
6598
  }
5555
6599
  async function seedOpencodePlugin(volume, image) {
5556
6600
  try {
5557
- const { stdout } = await execa8("docker", [
6601
+ const { stdout } = await execa9("docker", [
5558
6602
  "run",
5559
6603
  "--rm",
5560
6604
  "--user",
@@ -5602,14 +6646,14 @@ var OpencodeSessionError = class extends Error {
5602
6646
  }
5603
6647
  };
5604
6648
  async function ensureOpencodeInstalled(container, opts = {}) {
5605
- const probe = await execa8(
6649
+ const probe = await execa9(
5606
6650
  "docker",
5607
6651
  ["exec", "--user", CONTAINER_USER, container, "sh", "-c", "command -v opencode"],
5608
6652
  { reject: false }
5609
6653
  );
5610
6654
  if (probe.exitCode === 0) return { installed: false };
5611
6655
  opts.onProgress?.("installing opencode (absent from this box image)");
5612
- const install = await execa8(
6656
+ const install = await execa9(
5613
6657
  "docker",
5614
6658
  ["exec", "--user", "root", container, "bash", "-lc", "npm install -g opencode-ai 2>&1"],
5615
6659
  { reject: false }
@@ -5631,7 +6675,7 @@ async function startOpencodeSession(opts) {
5631
6675
  const v = process.env[k];
5632
6676
  if (typeof v === "string" && v.length > 0) envFlags.push("-e", `${k}=${v}`);
5633
6677
  }
5634
- const result = await execa8(
6678
+ const result = await execa9(
5635
6679
  "docker",
5636
6680
  [
5637
6681
  "exec",
@@ -5717,7 +6761,7 @@ function runInteractiveOpencodeLogin(dockerArgv) {
5717
6761
  return { exitCode: child.status ?? 1 };
5718
6762
  }
5719
6763
  async function volumeHasOpencodeAuth(volume, image) {
5720
- const res = await execa8(
6764
+ const res = await execa9(
5721
6765
  "docker",
5722
6766
  ["run", "--rm", "-v", `${volume}:/dst`, image, "sh", "-c", "test -e /dst/auth.json"],
5723
6767
  { reject: false }
@@ -5726,7 +6770,7 @@ async function volumeHasOpencodeAuth(volume, image) {
5726
6770
  }
5727
6771
  async function opencodeSessionInfo(container, sessionName) {
5728
6772
  const name = sessionName ?? DEFAULT_OPENCODE_SESSION;
5729
- const has = await execa8(
6773
+ const has = await execa9(
5730
6774
  "docker",
5731
6775
  ["exec", "--user", CONTAINER_USER, container, "tmux", "has-session", "-t", name],
5732
6776
  { reject: false }
@@ -5734,7 +6778,7 @@ async function opencodeSessionInfo(container, sessionName) {
5734
6778
  if (has.exitCode !== 0) {
5735
6779
  return { running: false, sessionName: name, startedAt: null };
5736
6780
  }
5737
- const ts = await execa8(
6781
+ const ts = await execa9(
5738
6782
  "docker",
5739
6783
  [
5740
6784
  "exec",
@@ -5770,9 +6814,9 @@ var OPENCODE_PULL_CONFIG_ITEMS = [
5770
6814
  "themes"
5771
6815
  ];
5772
6816
  async function pullOpencodeConfig(spec, opts) {
5773
- const hostData = join6(homedir5(), ".local", "share", "opencode");
5774
- const hostConfig = join6(homedir5(), ".config", "opencode");
5775
- const inv = await execa8(
6817
+ const hostData = join7(homedir7(), ".local", "share", "opencode");
6818
+ const hostConfig = join7(homedir7(), ".config", "opencode");
6819
+ const inv = await execa9(
5776
6820
  "docker",
5777
6821
  [
5778
6822
  "run",
@@ -5798,7 +6842,7 @@ async function pullOpencodeConfig(spec, opts) {
5798
6842
  const [group, name] = line.trim().split(/\s+/, 2);
5799
6843
  if (!name || group !== "data" && group !== "config") continue;
5800
6844
  const hostBase = group === "data" ? hostData : hostConfig;
5801
- if (await pathExists4(join6(hostBase, name))) continue;
6845
+ if (await pathExists5(join7(hostBase, name))) continue;
5802
6846
  newItems.push({
5803
6847
  label: group === "data" ? name : `config/${name}`,
5804
6848
  src: group === "data" ? `/src/${name}` : `/src/config/${name}`,
@@ -5814,7 +6858,7 @@ async function pullOpencodeConfig(spec, opts) {
5814
6858
  const cmds = newItems.map(
5815
6859
  (i) => `cp -a '${i.src}' '${i.hostDst === "data" ? "/dst-data" : "/dst-config"}/${i.name}'`
5816
6860
  );
5817
- const apply = await execa8(
6861
+ const apply = await execa9(
5818
6862
  "docker",
5819
6863
  [
5820
6864
  "run",
@@ -5925,9 +6969,9 @@ function gitWorktreePathFor(branch) {
5925
6969
  return `${WORKTREE_ROOT}/${fsSafeBranch(branch)}`;
5926
6970
  }
5927
6971
  async function collectRepoCarryOver(repo, branch, containerPath, gitWorktreePath) {
5928
- 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 });
5929
6973
  const stashSha = stash.exitCode === 0 ? stash.stdout.trim() || null : null;
5930
- const untracked = await execa9(
6974
+ const untracked = await execa10(
5931
6975
  "git",
5932
6976
  ["-C", repo.hostMainRepo, "ls-files", "--others", "--exclude-standard", "-z"],
5933
6977
  { reject: false }
@@ -5944,7 +6988,7 @@ async function collectRepoCarryOver(repo, branch, containerPath, gitWorktreePath
5944
6988
  };
5945
6989
  }
5946
6990
  async function dexec(container, argv, user = "vscode", cwd = "/") {
5947
- const r = await execa9(
6991
+ const r = await execa10(
5948
6992
  "docker",
5949
6993
  ["exec", "-w", cwd, "--user", user, container, ...argv],
5950
6994
  { reject: false }
@@ -5976,7 +7020,7 @@ async function bindWorktrees(container, binds, onLog) {
5976
7020
  (a, b) => a.kind === "root" && b.kind !== "root" ? -1 : a.kind !== "root" && b.kind === "root" ? 1 : 0
5977
7021
  );
5978
7022
  for (const b of ordered) {
5979
- await execa9(
7023
+ await execa10(
5980
7024
  "docker",
5981
7025
  ["exec", "-w", "/", "--user", "root", container, "sh", "-c", `mountpoint -q ${b.containerPath} && umount ${b.containerPath} || true`],
5982
7026
  { reject: false }
@@ -5998,7 +7042,7 @@ async function seedWorkspace(opts) {
5998
7042
  const wt = r.gitWorktreePath;
5999
7043
  const baseRef = r.repo.kind === "root" ? opts.fromBranch ?? "HEAD" : "HEAD";
6000
7044
  const addArgs = r.reuseBranch ? ["worktree", "add", wt, r.branch] : ["worktree", "add", "-b", r.branch, wt, baseRef];
6001
- const add = await execa9(
7045
+ const add = await execa10(
6002
7046
  "docker",
6003
7047
  ["exec", "--user", "vscode", opts.container, "git", "-C", main, ...addArgs],
6004
7048
  { reject: false }
@@ -6009,7 +7053,7 @@ async function seedWorkspace(opts) {
6009
7053
  );
6010
7054
  }
6011
7055
  log(`worktree ${wt} on branch ${r.branch} (host main ${main})`);
6012
- await execa9(
7056
+ await execa10(
6013
7057
  "docker",
6014
7058
  [
6015
7059
  "exec",
@@ -6025,7 +7069,7 @@ async function seedWorkspace(opts) {
6025
7069
  ],
6026
7070
  { reject: false }
6027
7071
  );
6028
- await execa9(
7072
+ await execa10(
6029
7073
  "docker",
6030
7074
  [
6031
7075
  "exec",
@@ -6055,7 +7099,7 @@ async function seedWorkspace(opts) {
6055
7099
  for (const r of opts.repos) {
6056
7100
  const ct = r.containerPath;
6057
7101
  if (r.stashSha) {
6058
- const withIndex = await execa9(
7102
+ const withIndex = await execa10(
6059
7103
  "docker",
6060
7104
  [
6061
7105
  "exec",
@@ -6073,7 +7117,7 @@ async function seedWorkspace(opts) {
6073
7117
  { reject: false }
6074
7118
  );
6075
7119
  if (withIndex.exitCode !== 0) {
6076
- const noIndex = await execa9(
7120
+ const noIndex = await execa10(
6077
7121
  "docker",
6078
7122
  [
6079
7123
  "exec",
@@ -6101,7 +7145,7 @@ async function seedWorkspace(opts) {
6101
7145
  }
6102
7146
  }
6103
7147
  if (r.untrackedNul.length > 0) {
6104
- const tarOut = await execa9("tar", ["-C", r.hostSource, "--null", "-T", "-", "-cf", "-"], {
7148
+ const tarOut = await execa10("tar", ["-C", r.hostSource, "--null", "-T", "-", "-cf", "-"], {
6105
7149
  input: r.untrackedNul.replace(/\0$/, ""),
6106
7150
  encoding: "buffer",
6107
7151
  reject: false
@@ -6110,7 +7154,7 @@ async function seedWorkspace(opts) {
6110
7154
  log(`warning: tar of untracked files for ${r.repo.hostMainRepo} failed: ${tarOut.stderr}`);
6111
7155
  continue;
6112
7156
  }
6113
- const tarIn = await execa9(
7157
+ const tarIn = await execa10(
6114
7158
  "docker",
6115
7159
  ["exec", "-i", "--user", "vscode", opts.container, "tar", "-C", ct, "-xf", "-"],
6116
7160
  { input: tarOut.stdout, reject: false }
@@ -6163,7 +7207,7 @@ async function regenerateRestoredWorktrees(opts) {
6163
7207
  for (const p of opts.plans) {
6164
7208
  const baseRef = p.kind === "root" ? opts.fromBranch ?? "HEAD" : "HEAD";
6165
7209
  const metaDir = `${p.hostMainRepo}/.git/worktrees/${fsSafeBranch(p.freshBranch)}`;
6166
- const r = await execa9(
7210
+ const r = await execa10(
6167
7211
  "docker",
6168
7212
  [
6169
7213
  "exec",
@@ -6196,14 +7240,14 @@ async function regenerateRestoredWorktrees(opts) {
6196
7240
  async function seedWorkspaceFromDir(opts) {
6197
7241
  const log = opts.onLog ?? (() => {
6198
7242
  });
6199
- const tarOut = await execa9("tar", ["-C", opts.hostSource, "-cf", "-", "."], {
7243
+ const tarOut = await execa10("tar", ["-C", opts.hostSource, "-cf", "-", "."], {
6200
7244
  encoding: "buffer",
6201
7245
  reject: false
6202
7246
  });
6203
7247
  if (tarOut.exitCode !== 0) {
6204
7248
  throw new GitWorktreeError(`tar of ${opts.hostSource} failed: ${tarOut.stderr}`);
6205
7249
  }
6206
- const tarIn = await execa9(
7250
+ const tarIn = await execa10(
6207
7251
  "docker",
6208
7252
  ["exec", "-i", "--user", "1000:1000", opts.container, "tar", "-C", "/workspace", "-xf", "-"],
6209
7253
  { input: tarOut.stdout, reject: false }
@@ -6214,13 +7258,13 @@ async function seedWorkspaceFromDir(opts) {
6214
7258
  log(`seeded /workspace from ${opts.hostSource}`);
6215
7259
  }
6216
7260
  async function removeInBoxWorktree(args) {
6217
- const remove = await execa9(
7261
+ const remove = await execa10(
6218
7262
  "git",
6219
7263
  ["-C", args.hostMainRepo, "worktree", "remove", "--force", args.gitWorktreePath],
6220
7264
  { reject: false }
6221
7265
  );
6222
7266
  if (remove.exitCode === 0) return;
6223
- await execa9("git", ["-C", args.hostMainRepo, "worktree", "prune"], { reject: false });
7267
+ await execa10("git", ["-C", args.hostMainRepo, "worktree", "prune"], { reject: false });
6224
7268
  }
6225
7269
  function ctParent(p) {
6226
7270
  const i = p.lastIndexOf("/");
@@ -6251,20 +7295,20 @@ async function resyncWorkspaceFromHost(opts) {
6251
7295
  const hostMain = w.hostMainRepo;
6252
7296
  const boxBranch = w.branch;
6253
7297
  const res = { containerPath: ct, mergeConflicts: [], overlaySkipped: [] };
6254
- const hostBranchProbe = await execa9(
7298
+ const hostBranchProbe = await execa10(
6255
7299
  "git",
6256
7300
  ["-C", hostMain, "symbolic-ref", "--short", "-q", "HEAD"],
6257
7301
  { reject: false }
6258
7302
  );
6259
- 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();
6260
7304
  if (!hostRef) {
6261
7305
  log(`resync: ${ct}: could not resolve host ref; skipping`);
6262
7306
  results.push(res);
6263
7307
  continue;
6264
7308
  }
6265
- const stash = await execa9("git", ["-C", hostMain, "stash", "create"], { reject: false });
7309
+ const stash = await execa10("git", ["-C", hostMain, "stash", "create"], { reject: false });
6266
7310
  const hostStashSha = stash.exitCode === 0 ? stash.stdout.trim() || null : null;
6267
- const untracked = await execa9(
7311
+ const untracked = await execa10(
6268
7312
  "git",
6269
7313
  ["-C", hostMain, "ls-files", "--others", "--exclude-standard", "-z"],
6270
7314
  { reject: false }
@@ -6334,7 +7378,7 @@ async function resyncWorkspaceFromHost(opts) {
6334
7378
  }
6335
7379
  }
6336
7380
  if (hostUntracked.length > 0) {
6337
- const probe = await execa9(
7381
+ const probe = await execa10(
6338
7382
  "docker",
6339
7383
  [
6340
7384
  "exec",
@@ -6366,7 +7410,7 @@ async function resyncWorkspaceFromHost(opts) {
6366
7410
  let hostHash = "";
6367
7411
  if (boxToken !== void 0 && boxToken !== NON_REGULAR_TOKEN) {
6368
7412
  try {
6369
- hostHash = createHash22("sha256").update(await readFile52(join7(hostMain, p))).digest("hex");
7413
+ hostHash = createHash22("sha256").update(await readFile6(join8(hostMain, p))).digest("hex");
6370
7414
  } catch {
6371
7415
  identical++;
6372
7416
  continue;
@@ -6381,13 +7425,13 @@ async function resyncWorkspaceFromHost(opts) {
6381
7425
  log(`resync: ${ct}: ${String(identical)} untracked host file(s) already identical in box (no-op)`);
6382
7426
  }
6383
7427
  if (toCopy.length > 0) {
6384
- const tarOut = await execa9("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
7428
+ const tarOut = await execa10("tar", ["-C", hostMain, "--null", "-T", "-", "-cf", "-"], {
6385
7429
  input: toCopy.join("\0"),
6386
7430
  encoding: "buffer",
6387
7431
  reject: false
6388
7432
  });
6389
7433
  if (tarOut.exitCode === 0) {
6390
- await execa9(
7434
+ await execa10(
6391
7435
  "docker",
6392
7436
  ["exec", "-i", "--user", "vscode", opts.container, "tar", "-C", ct, "-xf", "-"],
6393
7437
  { input: tarOut.stdout, reject: false }
@@ -6410,7 +7454,7 @@ var cached = null;
6410
7454
  async function detectPortless() {
6411
7455
  if (cached !== null) return cached;
6412
7456
  try {
6413
- const ver = await execa10(PORTLESS_BIN, SUB_VERSION, { reject: false });
7457
+ const ver = await execa11(PORTLESS_BIN, SUB_VERSION, { reject: false });
6414
7458
  if (ver.exitCode !== 0) {
6415
7459
  cached = { installed: false, proxyRunning: false };
6416
7460
  return cached;
@@ -6430,7 +7474,7 @@ function resetPortlessCache() {
6430
7474
  }
6431
7475
  async function portlessAlias(name, port) {
6432
7476
  try {
6433
- 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 });
6434
7478
  return r.exitCode === 0;
6435
7479
  } catch {
6436
7480
  return false;
@@ -6438,7 +7482,7 @@ async function portlessAlias(name, port) {
6438
7482
  }
6439
7483
  async function portlessUnalias(name) {
6440
7484
  try {
6441
- 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 });
6442
7486
  return r.exitCode === 0;
6443
7487
  } catch {
6444
7488
  return false;
@@ -6447,7 +7491,7 @@ async function portlessUnalias(name) {
6447
7491
  async function portlessGetUrl(name) {
6448
7492
  const fallback = `https://${name}.localhost`;
6449
7493
  try {
6450
- const r = await execa10(PORTLESS_BIN, [SUB_GET, name], { reject: false });
7494
+ const r = await execa11(PORTLESS_BIN, [SUB_GET, name], { reject: false });
6451
7495
  const out = (r.stdout ?? "").trim();
6452
7496
  if (r.exitCode === 0 && /^https?:\/\//.test(out)) return out;
6453
7497
  } catch {
@@ -6468,7 +7512,7 @@ function portlessBrowserEnv(boxName, opts) {
6468
7512
  }
6469
7513
  async function installPortless() {
6470
7514
  try {
6471
- const r = await execa10("npm", ["install", "-g", "portless"], { reject: false });
7515
+ const r = await execa11("npm", ["install", "-g", "portless"], { reject: false });
6472
7516
  return r.exitCode === 0;
6473
7517
  } catch {
6474
7518
  return false;
@@ -6476,7 +7520,7 @@ async function installPortless() {
6476
7520
  }
6477
7521
  async function startPortlessProxy() {
6478
7522
  try {
6479
- const r = await execa10(
7523
+ const r = await execa11(
6480
7524
  PORTLESS_BIN,
6481
7525
  ["proxy", "start", "--no-tls", "-p", String(PORTLESS_PROXY_PORT)],
6482
7526
  { reject: false }
@@ -6489,7 +7533,7 @@ async function startPortlessProxy() {
6489
7533
  function portlessStateDirCandidates() {
6490
7534
  const env = process.env["PORTLESS_STATE_DIR"];
6491
7535
  if (env && env.trim().length > 0) return [env.trim()];
6492
- return ["/tmp/portless", join8(homedir6(), ".portless")];
7536
+ return ["/tmp/portless", join9(homedir8(), ".portless")];
6493
7537
  }
6494
7538
  function pidAlive(pid) {
6495
7539
  if (!Number.isFinite(pid) || pid <= 0) return false;
@@ -6502,7 +7546,7 @@ function pidAlive(pid) {
6502
7546
  }
6503
7547
  async function readProxyPid(dir) {
6504
7548
  try {
6505
- const raw = await readFile6(join8(dir, "proxy.pid"), "utf8");
7549
+ const raw = await readFile7(join9(dir, "proxy.pid"), "utf8");
6506
7550
  const pid = Number.parseInt(raw.trim(), 10);
6507
7551
  return Number.isFinite(pid) && pid > 0 ? pid : null;
6508
7552
  } catch {
@@ -6522,7 +7566,7 @@ async function resolvePortlessHostStateDir(override) {
6522
7566
  if (env && env.trim().length > 0) return env.trim();
6523
7567
  const live = await findLivePortlessStateDir();
6524
7568
  if (live) return live;
6525
- const home = join8(homedir6(), ".portless");
7569
+ const home = join9(homedir8(), ".portless");
6526
7570
  if (existsSync2(home)) return home;
6527
7571
  if (existsSync2("/tmp/portless")) return "/tmp/portless";
6528
7572
  return home;
@@ -6530,7 +7574,7 @@ async function resolvePortlessHostStateDir(override) {
6530
7574
  async function isProxyRunning() {
6531
7575
  if (await findLivePortlessStateDir() !== null) return true;
6532
7576
  try {
6533
- const r = await execa10("pgrep", ["-f", "portless proxy"], { reject: false });
7577
+ const r = await execa11("pgrep", ["-f", "portless proxy"], { reject: false });
6534
7578
  return r.exitCode === 0 && (r.stdout ?? "").trim().length > 0;
6535
7579
  } catch {
6536
7580
  return false;
@@ -6551,12 +7595,12 @@ var EXCLUDE_DIRS = /* @__PURE__ */ new Set([
6551
7595
  ".cache",
6552
7596
  ".parcel-cache"
6553
7597
  ]);
6554
- var SNAPSHOTS_ROOT = join9(homedir7(), ".agentbox", "snapshots");
7598
+ var SNAPSHOTS_ROOT = join10(homedir9(), ".agentbox", "snapshots");
6555
7599
  function snapshotPathFor(box) {
6556
7600
  const mnemonic = sanitizeMnemonic(box.name);
6557
7601
  const n = box.projectIndex;
6558
7602
  const segment = typeof n === "number" && Number.isFinite(n) && n > 0 ? `${box.id}-${String(n)}-${mnemonic}` : `${box.id}-${mnemonic}`;
6559
- return join9(SNAPSHOTS_ROOT, segment);
7603
+ return join10(SNAPSHOTS_ROOT, segment);
6560
7604
  }
6561
7605
  async function findExcludedDirs(root, excluded = EXCLUDE_DIRS) {
6562
7606
  const matches = [];
@@ -6569,7 +7613,7 @@ async function findExcludedDirs(root, excluded = EXCLUDE_DIRS) {
6569
7613
  }
6570
7614
  for (const entry of entries) {
6571
7615
  if (!entry.isDirectory()) continue;
6572
- const abs = join9(dir, entry.name);
7616
+ const abs = join10(dir, entry.name);
6573
7617
  if (excluded.has(entry.name)) {
6574
7618
  matches.push(abs);
6575
7619
  continue;
@@ -6586,26 +7630,26 @@ async function createSnapshot(opts) {
6586
7630
  const excluded = opts.excluded ?? EXCLUDE_DIRS;
6587
7631
  await mkdir42(SNAPSHOTS_ROOT, { recursive: true });
6588
7632
  const cpArgs = platform() === "darwin" ? ["-cR"] : ["-R"];
6589
- await execa11("cp", [...cpArgs, `${source}/`, destination]);
7633
+ await execa12("cp", [...cpArgs, `${source}/`, destination]);
6590
7634
  const toPrune = await findExcludedDirs(destination, excluded);
6591
7635
  await Promise.all(toPrune.map((p) => rm32(p, { recursive: true, force: true })));
6592
7636
  return { destination, prunedPaths: toPrune };
6593
7637
  }
6594
- var CHECKPOINTS_ROOT = join10(homedir8(), ".agentbox", "checkpoints");
7638
+ var CHECKPOINTS_ROOT = join11(homedir10(), ".agentbox", "checkpoints");
6595
7639
  var CHECKPOINT_IMAGE_PREFIX = "agentbox-ckpt-";
6596
7640
  function checkpointImageTag(projectRoot, name) {
6597
7641
  const mnemonic = sanitizeMnemonic(basename5(projectRoot));
6598
7642
  return `${CHECKPOINT_IMAGE_PREFIX}${hashProjectPath(projectRoot)}_${mnemonic}:${name}`;
6599
7643
  }
6600
7644
  function projectCheckpointsDir(projectRoot) {
6601
- return join10(CHECKPOINTS_ROOT, projectDirSegment(projectRoot));
7645
+ return join11(CHECKPOINTS_ROOT, projectDirSegment(projectRoot));
6602
7646
  }
6603
7647
  function checkpointDir(projectRoot, name) {
6604
- return join10(projectCheckpointsDir(projectRoot), name);
7648
+ return join11(projectCheckpointsDir(projectRoot), name);
6605
7649
  }
6606
7650
  async function readManifest(dir) {
6607
7651
  try {
6608
- const raw = await readFile7(join10(dir, "manifest.json"), "utf8");
7652
+ const raw = await readFile8(join11(dir, "manifest.json"), "utf8");
6609
7653
  const m = JSON.parse(raw);
6610
7654
  if (m.schema !== 2 && m.schema !== 3) return null;
6611
7655
  return m;
@@ -6622,7 +7666,7 @@ async function listCheckpointsInDir(root) {
6622
7666
  }
6623
7667
  const out = [];
6624
7668
  for (const name of entries) {
6625
- const dir = join10(root, name);
7669
+ const dir = join11(root, name);
6626
7670
  const manifest = await readManifest(dir);
6627
7671
  if (manifest) out.push({ name, dir, manifest });
6628
7672
  }
@@ -6641,7 +7685,7 @@ async function listAllCheckpoints() {
6641
7685
  }
6642
7686
  const out = [];
6643
7687
  for (const segment of segments) {
6644
- const items = await listCheckpointsInDir(join10(CHECKPOINTS_ROOT, segment));
7688
+ const items = await listCheckpointsInDir(join11(CHECKPOINTS_ROOT, segment));
6645
7689
  if (items.length > 0) out.push({ segment, items });
6646
7690
  }
6647
7691
  return out;
@@ -6661,7 +7705,7 @@ async function listAllCheckpointImages() {
6661
7705
  }
6662
7706
  const out = /* @__PURE__ */ new Set();
6663
7707
  for (const proj of projectDirs) {
6664
- const projPath = join10(CHECKPOINTS_ROOT, proj);
7708
+ const projPath = join11(CHECKPOINTS_ROOT, proj);
6665
7709
  let names;
6666
7710
  try {
6667
7711
  names = (await readdir5(projPath, { withFileTypes: true })).filter((e) => e.isDirectory()).map((e) => e.name);
@@ -6669,7 +7713,7 @@ async function listAllCheckpointImages() {
6669
7713
  continue;
6670
7714
  }
6671
7715
  for (const name of names) {
6672
- const manifest = await readManifest(join10(projPath, name));
7716
+ const manifest = await readManifest(join11(projPath, name));
6673
7717
  if (manifest) out.add(manifest.image);
6674
7718
  }
6675
7719
  }
@@ -6711,7 +7755,7 @@ async function runCleanup(container, log) {
6711
7755
  }
6712
7756
  }
6713
7757
  async function inspectImageConfig(imageRef) {
6714
- const r = await execa12("docker", ["image", "inspect", imageRef], { reject: false });
7758
+ const r = await execa13("docker", ["image", "inspect", imageRef], { reject: false });
6715
7759
  if (r.exitCode !== 0) {
6716
7760
  throw new CheckpointError(`docker image inspect ${imageRef} failed`, r.stdout, r.stderr);
6717
7761
  }
@@ -6787,14 +7831,14 @@ async function createCheckpoint(opts) {
6787
7831
  await runCleanup(box.container, log);
6788
7832
  if (type === "layered") {
6789
7833
  log(`docker commit ${box.container} -> ${tag} (layered)`);
6790
- const r = await execa12("docker", ["commit", box.container, tag], { reject: false });
7834
+ const r = await execa13("docker", ["commit", box.container, tag], { reject: false });
6791
7835
  if (r.exitCode !== 0) {
6792
7836
  throw new CheckpointError(`docker commit failed for ${box.container}`, r.stdout, r.stderr);
6793
7837
  }
6794
7838
  } else {
6795
7839
  log(`docker commit ${box.container} -> <intermediate> (flattened path)`);
6796
7840
  const intermediate = `${tag}-intermediate`;
6797
- const commit = await execa12("docker", ["commit", box.container, intermediate], {
7841
+ const commit = await execa13("docker", ["commit", box.container, intermediate], {
6798
7842
  reject: false
6799
7843
  });
6800
7844
  if (commit.exitCode !== 0) {
@@ -6830,7 +7874,7 @@ async function createCheckpoint(opts) {
6830
7874
  cliVersion: stamp.cliVersion,
6831
7875
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6832
7876
  };
6833
- 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");
6834
7878
  if (opts.setDefault) {
6835
7879
  await setConfigValue("project", "box.defaultCheckpointDocker", name, opts.projectRoot);
6836
7880
  log(`set project default checkpoint (box.defaultCheckpointDocker) -> ${name}`);
@@ -6839,7 +7883,7 @@ async function createCheckpoint(opts) {
6839
7883
  }
6840
7884
  async function flattenImage(sourceTag, destTag, log) {
6841
7885
  const tmpName = `agentbox-flatten-${Date.now().toString(36)}`;
6842
- const create = await execa12(
7886
+ const create = await execa13(
6843
7887
  "docker",
6844
7888
  ["create", "--name", tmpName, sourceTag, "sleep", "0"],
6845
7889
  { reject: false }
@@ -6847,11 +7891,11 @@ async function flattenImage(sourceTag, destTag, log) {
6847
7891
  if (create.exitCode !== 0) {
6848
7892
  throw new CheckpointError(`docker create for flatten failed`, create.stdout, create.stderr);
6849
7893
  }
6850
- const scratch = await mkdtemp3(join10(tmpdir3(), "agentbox-flatten-"));
7894
+ const scratch = await mkdtemp3(join11(tmpdir3(), "agentbox-flatten-"));
6851
7895
  try {
6852
- const rootfsPath = join10(scratch, "rootfs.tar");
7896
+ const rootfsPath = join11(scratch, "rootfs.tar");
6853
7897
  log(`exporting rootfs of ${sourceTag} to ${rootfsPath}`);
6854
- const exp = await execa12("docker", ["export", "-o", rootfsPath, tmpName], { reject: false });
7898
+ const exp = await execa13("docker", ["export", "-o", rootfsPath, tmpName], { reject: false });
6855
7899
  if (exp.exitCode !== 0) {
6856
7900
  throw new CheckpointError(`docker export failed`, exp.stdout, exp.stderr);
6857
7901
  }
@@ -6862,18 +7906,18 @@ async function flattenImage(sourceTag, destTag, log) {
6862
7906
  "ADD rootfs.tar /",
6863
7907
  ...renderConfigDirectives(cfg)
6864
7908
  ];
6865
- await writeFile32(join10(scratch, "Dockerfile"), lines.join("\n") + "\n", "utf8");
7909
+ await writeFile32(join11(scratch, "Dockerfile"), lines.join("\n") + "\n", "utf8");
6866
7910
  log(`building flattened ${destTag} from rootfs.tar (FROM scratch)`);
6867
- const build = await execa12(
7911
+ const build = await execa13(
6868
7912
  "docker",
6869
- ["build", "-t", destTag, "-f", join10(scratch, "Dockerfile"), scratch],
7913
+ ["build", "-t", destTag, "-f", join11(scratch, "Dockerfile"), scratch],
6870
7914
  { reject: false }
6871
7915
  );
6872
7916
  if (build.exitCode !== 0) {
6873
7917
  throw new CheckpointError(`flatten docker build failed`, build.stdout, build.stderr);
6874
7918
  }
6875
7919
  } finally {
6876
- await execa12("docker", ["rm", "-f", tmpName], { reject: false });
7920
+ await execa13("docker", ["rm", "-f", tmpName], { reject: false });
6877
7921
  await rm4(scratch, { recursive: true, force: true });
6878
7922
  }
6879
7923
  }
@@ -6899,7 +7943,7 @@ async function launchCtlDaemon(container, hostSocketPath, timeoutMs = 3e3) {
6899
7943
  }
6900
7944
  const deadline = Date.now() + timeoutMs;
6901
7945
  while (Date.now() < deadline) {
6902
- if (await pathExists5(hostSocketPath)) return { up: true };
7946
+ if (await pathExists6(hostSocketPath)) return { up: true };
6903
7947
  await new Promise((r) => setTimeout(r, 100));
6904
7948
  }
6905
7949
  return {
@@ -6907,9 +7951,9 @@ async function launchCtlDaemon(container, hostSocketPath, timeoutMs = 3e3) {
6907
7951
  reason: `socket ${hostSocketPath} did not appear within ${String(timeoutMs)}ms`
6908
7952
  };
6909
7953
  }
6910
- async function pathExists5(p) {
7954
+ async function pathExists6(p) {
6911
7955
  try {
6912
- await stat7(p);
7956
+ await stat8(p);
6913
7957
  return true;
6914
7958
  } catch {
6915
7959
  return false;
@@ -6917,7 +7961,7 @@ async function pathExists5(p) {
6917
7961
  }
6918
7962
  async function writeBoxEnvFile(container, env) {
6919
7963
  const body = formatBoxEnvBody(env);
6920
- const result = await execa13(
7964
+ const result = await execa14(
6921
7965
  "docker",
6922
7966
  ["exec", "--user", "root", "-i", container, "sh", "-c", "umask 022 && cat > /etc/agentbox/box.env"],
6923
7967
  { input: body, reject: false }
@@ -6941,7 +7985,7 @@ function shellSingleQuote(s) {
6941
7985
  return `'${s.replace(/'/g, `'\\''`)}'`;
6942
7986
  }
6943
7987
  async function ensureHomeOwnedByVscode(container) {
6944
- await execa14(
7988
+ await execa15(
6945
7989
  "docker",
6946
7990
  [
6947
7991
  "exec",
@@ -6957,10 +8001,10 @@ async function ensureHomeOwnedByVscode(container) {
6957
8001
  { reject: false }
6958
8002
  );
6959
8003
  }
6960
- var STATE_DIR22 = join11(homedir9(), ".agentbox");
6961
- var PID_FILE = join11(STATE_DIR22, "relay.pid");
6962
- var LOG_FILE = join11(STATE_DIR22, "relay.log");
6963
- 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");
6964
8008
  var PORT = DEFAULT_RELAY_PORT;
6965
8009
  var ENDPOINT = {
6966
8010
  // host.docker.internal is the Docker Desktop / OrbStack-supplied alias for
@@ -7127,13 +8171,13 @@ async function stageRelayHome(version, log) {
7127
8171
  if (process.env.AGENTBOX_RELAY_BIN || process.env.AGENTBOX_CLI_ENTRY) return null;
7128
8172
  const cliRoot = findCliRoot(dirname32(fileURLToPath(import.meta.url)));
7129
8173
  if (cliRoot === null) return null;
7130
- const homeDir = join11(RELAY_HOME_DIR, version);
7131
- const stagedEntry = join11(homeDir, "dist", "index.js");
7132
- 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");
7133
8177
  if (existsSync3(stagedEntry) && existsSync3(stagedBin)) {
7134
8178
  return { relayBin: stagedBin, cliEntry: stagedEntry };
7135
8179
  }
7136
- const nodeModules = resolveDepRoot(join11(cliRoot, "dist", "index.js"));
8180
+ const nodeModules = resolveDepRoot(join12(cliRoot, "dist", "index.js"));
7137
8181
  if (nodeModules === null) return null;
7138
8182
  const tmpDir = `${homeDir}.tmp-${String(process.pid)}`;
7139
8183
  try {
@@ -7141,10 +8185,10 @@ async function stageRelayHome(version, log) {
7141
8185
  await rm5(tmpDir, { recursive: true, force: true });
7142
8186
  await mkdir6(tmpDir, { recursive: true });
7143
8187
  for (const sub of ["dist", "runtime", "share"]) {
7144
- const src = join11(cliRoot, sub);
7145
- 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 });
7146
8190
  }
7147
- await cp(nodeModules, join11(tmpDir, "node_modules"), { recursive: true, dereference: true });
8191
+ await cp(nodeModules, join12(tmpDir, "node_modules"), { recursive: true, dereference: true });
7148
8192
  await rm5(homeDir, { recursive: true, force: true });
7149
8193
  await rename3(tmpDir, homeDir);
7150
8194
  } catch (err) {
@@ -7163,7 +8207,7 @@ async function stageRelayHome(version, log) {
7163
8207
  }
7164
8208
  function findCliRoot(moduleDir) {
7165
8209
  for (const root of [resolve3(moduleDir, ".."), resolve3(moduleDir, "..", "..")]) {
7166
- 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"))) {
7167
8211
  return root;
7168
8212
  }
7169
8213
  }
@@ -7178,7 +8222,7 @@ function resolveDepRoot(fromFile) {
7178
8222
  const idx = main.lastIndexOf(marker);
7179
8223
  if (idx === -1) return null;
7180
8224
  const nm = main.slice(0, idx + marker.length - 1);
7181
- return existsSync3(join11(nm, "commander")) ? nm : null;
8225
+ return existsSync3(join12(nm, "commander")) ? nm : null;
7182
8226
  } catch {
7183
8227
  return null;
7184
8228
  }
@@ -7192,7 +8236,7 @@ async function gcOldRelayHomes(keepVersion) {
7192
8236
  }
7193
8237
  for (const name of entries) {
7194
8238
  if (name === keepVersion) continue;
7195
- 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(() => {
7196
8240
  });
7197
8241
  }
7198
8242
  }
@@ -7303,7 +8347,7 @@ function fetchHealthz(timeoutMs) {
7303
8347
  }
7304
8348
  async function readPidFile() {
7305
8349
  try {
7306
- const text = await readFile8(PID_FILE, "utf8");
8350
+ const text = await readFile9(PID_FILE, "utf8");
7307
8351
  const pid = Number.parseInt(text.trim(), 10);
7308
8352
  return Number.isFinite(pid) && pid > 0 ? pid : null;
7309
8353
  } catch {
@@ -7608,8 +8652,8 @@ async function ensureAgentboxTasksFile(container, services, opts = {}) {
7608
8652
  return { status: "wrote" };
7609
8653
  }
7610
8654
  async function writeFileInBox(container, path, content) {
7611
- const { execa: execa20 } = await import("execa");
7612
- const result = await execa20(
8655
+ const { execa: execa21 } = await import("execa");
8656
+ const result = await execa21(
7613
8657
  "docker",
7614
8658
  ["exec", "-i", "--user", "vscode", container, "sh", "-c", `cat > ${shellQuote(path)}`],
7615
8659
  { input: content, reject: false }
@@ -7640,22 +8684,22 @@ function defaultBoxName(workspacePath, id) {
7640
8684
  const base = sanitizeBasename(workspacePath);
7641
8685
  return base.length > 0 ? `${base}-${id}` : id;
7642
8686
  }
7643
- async function pathExists6(p) {
8687
+ async function pathExists7(p) {
7644
8688
  try {
7645
- await stat8(p);
8689
+ await stat9(p);
7646
8690
  return true;
7647
8691
  } catch {
7648
8692
  return false;
7649
8693
  }
7650
8694
  }
7651
8695
  async function buildIdentityMounts() {
7652
- const home = homedir10();
8696
+ const home = homedir12();
7653
8697
  const candidates = [
7654
- { src: join12(home, ".gitconfig"), dst: "/home/vscode/.gitconfig", readOnly: true }
8698
+ { src: join13(home, ".gitconfig"), dst: "/home/vscode/.gitconfig", readOnly: true }
7655
8699
  ];
7656
8700
  const out = [];
7657
8701
  for (const c of candidates) {
7658
- if (await pathExists6(c.src)) {
8702
+ if (await pathExists7(c.src)) {
7659
8703
  out.push(`${c.src}:${c.dst}${c.readOnly ? ":ro" : ""}`);
7660
8704
  }
7661
8705
  }
@@ -7665,11 +8709,11 @@ async function createBox(opts) {
7665
8709
  const log = opts.onLog ?? (() => {
7666
8710
  });
7667
8711
  const workspace = resolve4(opts.workspacePath);
7668
- if (!await pathExists6(workspace)) {
8712
+ if (!await pathExists7(workspace)) {
7669
8713
  throw new Error(`workspace does not exist: ${workspace}`);
7670
8714
  }
7671
- const cfgPath = join12(workspace, "agentbox.yaml");
7672
- if (await pathExists6(cfgPath)) {
8715
+ const cfgPath = join13(workspace, "agentbox.yaml");
8716
+ if (await pathExists7(cfgPath)) {
7673
8717
  try {
7674
8718
  const cfg = await loadConfig(cfgPath);
7675
8719
  log(`agentbox.yaml validated (${String(cfg.services.length)} service(s))`);
@@ -7884,7 +8928,7 @@ async function createBox(opts) {
7884
8928
  log(`seeded claude credentials into ${claudeSpec.volume} from host backup`);
7885
8929
  }
7886
8930
  const claudeMounts = buildClaudeMounts(claudeSpec, process.env);
7887
- const wantCodex = opts.codexConfig !== void 0 || await pathExists6(join12(homedir10(), ".codex"));
8931
+ const wantCodex = opts.codexConfig !== void 0 || await pathExists7(join13(homedir12(), ".codex"));
7888
8932
  let codexMounts;
7889
8933
  let codexConfigVolume;
7890
8934
  if (wantCodex) {
@@ -7904,7 +8948,21 @@ async function createBox(opts) {
7904
8948
  codexMounts = buildCodexMounts(codexSpec, process.env);
7905
8949
  codexConfigVolume = codexSpec.volume;
7906
8950
  }
7907
- 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"));
7908
8966
  let opencodeMounts;
7909
8967
  let opencodeConfigVolume;
7910
8968
  if (wantOpencode) {
@@ -7925,14 +8983,15 @@ async function createBox(opts) {
7925
8983
  opencodeConfigVolume = opencodeSpec.volume;
7926
8984
  }
7927
8985
  const boxDir = boxRunDirFor({ id, name, projectIndex });
7928
- const socketDir = join12(boxDir, "run");
7929
- const socketPath = join12(socketDir, "ctl.sock");
7930
- const mergedExportDir = join12(boxDir, "workspace");
8986
+ const socketDir = join13(boxDir, "run");
8987
+ const socketPath = join13(socketDir, "ctl.sock");
8988
+ const mergedExportDir = join13(boxDir, "workspace");
7931
8989
  await mkdir7(socketDir, { recursive: true });
7932
8990
  await mkdir7(mergedExportDir, { recursive: true });
7933
8991
  const extraVolumes = await buildIdentityMounts();
7934
8992
  extraVolumes.push(...claudeMounts.extraVolumes);
7935
8993
  if (codexMounts) extraVolumes.push(...codexMounts.extraVolumes);
8994
+ if (agentsMounts) extraVolumes.push(...agentsMounts.extraVolumes);
7936
8995
  if (opencodeMounts) extraVolumes.push(...opencodeMounts.extraVolumes);
7937
8996
  extraVolumes.push(...ide.extraVolumes);
7938
8997
  extraVolumes.push(`${socketDir}:/run/agentbox`);
@@ -8028,6 +9087,7 @@ async function createBox(opts) {
8028
9087
  socketPath,
8029
9088
  claudeConfigVolume: claudeSpec.volume,
8030
9089
  codexConfigVolume,
9090
+ agentsConfigVolume,
8031
9091
  opencodeConfigVolume,
8032
9092
  vscodeServerVolume: vscodeServerVolumeName(id),
8033
9093
  cursorServerVolume: cursorServerVolumeName(id),
@@ -8093,7 +9153,7 @@ async function createBox(opts) {
8093
9153
  } catch (err) {
8094
9154
  if (opts.useBranch !== void 0) {
8095
9155
  log(`seedWorkspace failed for --use-branch ${opts.useBranch}; cleaning up the box`);
8096
- await execa15("docker", ["rm", "-f", containerName], { reject: false });
9156
+ await execa16("docker", ["rm", "-f", containerName], { reject: false });
8097
9157
  await removeBoxRecord(id);
8098
9158
  for (const w of gitWorktreeRecords) {
8099
9159
  await removeInBoxWorktree({
@@ -8156,7 +9216,7 @@ async function createBox(opts) {
8156
9216
  else log(`agentbox-ctl daemon did not become reachable: ${ctl.reason}`);
8157
9217
  if (opts.withPlaywright) {
8158
9218
  log("installing @playwright/cli@latest (--with-playwright)");
8159
- const result = await execa15(
9219
+ const result = await execa16(
8160
9220
  "docker",
8161
9221
  [
8162
9222
  "exec",
@@ -8335,7 +9395,7 @@ function parseShellSessionList(stdout) {
8335
9395
  return out;
8336
9396
  }
8337
9397
  async function listShellSessions(container, user) {
8338
- const res = await execa16(
9398
+ const res = await execa17(
8339
9399
  "docker",
8340
9400
  [
8341
9401
  "exec",
@@ -8359,7 +9419,7 @@ async function startShellSession(opts) {
8359
9419
  const login = opts.login !== false;
8360
9420
  const term = process.env["TERM"] ?? "xterm-256color";
8361
9421
  const cmd = login ? "bash -l" : "bash";
8362
- const result = await execa16(
9422
+ const result = await execa17(
8363
9423
  "docker",
8364
9424
  [
8365
9425
  "exec",
@@ -8408,7 +9468,7 @@ function buildShellSessionAttachArgv(container, sessionName, user) {
8408
9468
  }
8409
9469
  async function shellSessionInfo(container, sessionName, user) {
8410
9470
  const name = sessionName ?? DEFAULT_SHELL_SESSION;
8411
- const has = await execa16(
9471
+ const has = await execa17(
8412
9472
  "docker",
8413
9473
  ["exec", "--user", user ?? CONTAINER_USER, container, "tmux", "has-session", "-t", name],
8414
9474
  { reject: false }
@@ -8416,7 +9476,7 @@ async function shellSessionInfo(container, sessionName, user) {
8416
9476
  return { running: has.exitCode === 0, sessionName: name };
8417
9477
  }
8418
9478
  async function killShellSession(container, sessionName, user) {
8419
- const res = await execa16(
9479
+ const res = await execa17(
8420
9480
  "docker",
8421
9481
  [
8422
9482
  "exec",
@@ -8470,7 +9530,7 @@ async function getBoxEndpoints(record, engine, persisted) {
8470
9530
  for (const svc of persistedServices) pushService(svc.name, svc.port);
8471
9531
  } else {
8472
9532
  try {
8473
- const cfg = await loadConfig(join13(record.workspacePath, "agentbox.yaml"));
9533
+ const cfg = await loadConfig(join14(record.workspacePath, "agentbox.yaml"));
8474
9534
  if (!webServiceName) {
8475
9535
  webServiceName = cfg.services.find((s) => s.expose)?.name ?? null;
8476
9536
  }
@@ -8575,9 +9635,9 @@ function safeHost(url) {
8575
9635
  return "";
8576
9636
  }
8577
9637
  }
8578
- async function pathExists7(p) {
9638
+ async function pathExists8(p) {
8579
9639
  try {
8580
- await stat9(p);
9640
+ await stat10(p);
8581
9641
  return true;
8582
9642
  } catch {
8583
9643
  return false;
@@ -8621,9 +9681,9 @@ async function resyncBox(idOrName, onLog) {
8621
9681
  async function startBox(idOrName) {
8622
9682
  const box = await resolveBox(idOrName);
8623
9683
  for (const w of box.gitWorktrees ?? []) {
8624
- if (!await pathExists7(join14(w.hostMainRepo, ".git"))) {
9684
+ if (!await pathExists8(join15(w.hostMainRepo, ".git"))) {
8625
9685
  throw new Error(
8626
- `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)`
8627
9687
  );
8628
9688
  }
8629
9689
  }
@@ -8719,7 +9779,7 @@ async function getBoxHostPaths(idOrName) {
8719
9779
  }
8720
9780
  async function dirSizeBytes(path) {
8721
9781
  try {
8722
- const result = await execa17("du", ["-sk", path], { reject: false });
9782
+ const result = await execa18("du", ["-sk", path], { reject: false });
8723
9783
  if (result.exitCode !== 0) return null;
8724
9784
  const sizeKb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
8725
9785
  if (Number.isNaN(sizeKb)) return null;
@@ -8850,7 +9910,7 @@ async function destroyBox(idOrName, opts = {}) {
8850
9910
  async function listSnapshotDirs() {
8851
9911
  try {
8852
9912
  const entries = await readdir7(SNAPSHOTS_ROOT, { withFileTypes: true });
8853
- 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));
8854
9914
  } catch {
8855
9915
  return [];
8856
9916
  }
@@ -8858,13 +9918,13 @@ async function listSnapshotDirs() {
8858
9918
  async function listBoxDirs() {
8859
9919
  try {
8860
9920
  const entries = await readdir7(BOXES_ROOT, { withFileTypes: true });
8861
- 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));
8862
9922
  } catch {
8863
9923
  return [];
8864
9924
  }
8865
9925
  }
8866
9926
  async function listCheckpointImageTags() {
8867
- const r = await execa17(
9927
+ const r = await execa18(
8868
9928
  "docker",
8869
9929
  ["image", "ls", "--format", "{{.Repository}}:{{.Tag}}", `${CHECKPOINT_IMAGE_PREFIX}*`],
8870
9930
  { reject: false }
@@ -8910,6 +9970,8 @@ async function pruneBoxes(opts = {}) {
8910
9970
  SHARED_CLAUDE_VOLUME,
8911
9971
  // The shared codex-config volume — same reasoning (holds Codex auth).
8912
9972
  SHARED_CODEX_VOLUME,
9973
+ // The shared agents-config volume — holds the cross-agent ~/.agents skills.
9974
+ SHARED_AGENTS_VOLUME,
8913
9975
  // The shared opencode-config volume — same reasoning (holds OpenCode auth).
8914
9976
  SHARED_OPENCODE_VOLUME,
8915
9977
  // Shared across boxes: downloaded IDE extensions. Same reasoning.
@@ -8972,7 +10034,7 @@ async function pruneBoxes(opts = {}) {
8972
10034
  } catch {
8973
10035
  }
8974
10036
  try {
8975
- await execa17("docker", ["image", "rm", RELAY_IMAGE_REF], { reject: false });
10037
+ await execa18("docker", ["image", "rm", RELAY_IMAGE_REF], { reject: false });
8976
10038
  } catch {
8977
10039
  }
8978
10040
  try {
@@ -8993,7 +10055,7 @@ async function pruneBoxes(opts = {}) {
8993
10055
  async function snapshotPresent(path) {
8994
10056
  if (!path) return false;
8995
10057
  try {
8996
- const s = await stat9(path);
10058
+ const s = await stat10(path);
8997
10059
  return s.isDirectory();
8998
10060
  } catch {
8999
10061
  return false;
@@ -9034,7 +10096,7 @@ function splitPair(raw) {
9034
10096
  return [parts[0].trim(), parts[1].trim()];
9035
10097
  }
9036
10098
  async function duBytes(path) {
9037
- const result = await execa18("du", ["-sk", path], { reject: false });
10099
+ const result = await execa19("du", ["-sk", path], { reject: false });
9038
10100
  if (result.exitCode !== 0) return null;
9039
10101
  const kb = Number.parseInt((result.stdout ?? "").split(/\s+/)[0] ?? "", 10);
9040
10102
  return Number.isNaN(kb) ? null : kb * 1024;
@@ -9043,11 +10105,11 @@ async function volumeSizeBytes(name) {
9043
10105
  if (!name) return null;
9044
10106
  const engine = await detectEngine();
9045
10107
  if (engine === "orbstack") {
9046
- const live = join15(homedir11(), "OrbStack", "docker", "volumes", name);
10108
+ const live = join16(homedir13(), "OrbStack", "docker", "volumes", name);
9047
10109
  const sz = await duBytes(live);
9048
10110
  if (sz !== null) return sz;
9049
10111
  }
9050
- const df = await execa18(
10112
+ const df = await execa19(
9051
10113
  "docker",
9052
10114
  ["system", "df", "-v", "--format", "{{json .Volumes}}"],
9053
10115
  { reject: false }
@@ -9068,7 +10130,7 @@ async function volumeSizeBytes(name) {
9068
10130
  return null;
9069
10131
  }
9070
10132
  async function imageBytes(tag) {
9071
- const r = await execa18("docker", ["image", "inspect", tag, "--format", "{{.Size}}"], {
10133
+ const r = await execa19("docker", ["image", "inspect", tag, "--format", "{{.Size}}"], {
9072
10134
  reject: false
9073
10135
  });
9074
10136
  if (r.exitCode !== 0) return null;
@@ -9079,7 +10141,7 @@ async function projectCheckpointImageBytes(projectRoot, name) {
9079
10141
  return imageBytes(checkpointImageTag(projectRoot, name));
9080
10142
  }
9081
10143
  async function allCheckpointImagesBytes() {
9082
- const r = await execa18(
10144
+ const r = await execa19(
9083
10145
  "docker",
9084
10146
  [
9085
10147
  "image",
@@ -9106,7 +10168,7 @@ async function allCheckpointImagesBytes() {
9106
10168
  return any ? total : null;
9107
10169
  }
9108
10170
  async function agentboxHomeBytes() {
9109
- return duBytes(join15(homedir11(), ".agentbox"));
10171
+ return duBytes(join16(homedir13(), ".agentbox"));
9110
10172
  }
9111
10173
  function limitsFromRecord(record) {
9112
10174
  const r = record.resourceLimits;
@@ -9131,7 +10193,7 @@ function reconcileLimits(persisted, dockerJson) {
9131
10193
  };
9132
10194
  }
9133
10195
  async function containerWritableBytes(container) {
9134
- const r = await execa18(
10196
+ const r = await execa19(
9135
10197
  "docker",
9136
10198
  ["ps", "-a", "--filter", `name=^${container}$`, "--format", "{{.Size}}", "--size"],
9137
10199
  { reject: false }
@@ -9178,7 +10240,7 @@ async function boxResourceStats(record) {
9178
10240
  if (await inspectContainerStatus(record.container) !== "running") {
9179
10241
  return base;
9180
10242
  }
9181
- const proc = await execa18(
10243
+ const proc = await execa19(
9182
10244
  "docker",
9183
10245
  ["stats", "--no-stream", "--format", "{{json .}}", record.container],
9184
10246
  { reject: false }
@@ -9355,9 +10417,9 @@ var dockerProvider = {
9355
10417
  var BOX_WORKFLOWS_DIR = "/home/vscode/.claude/workflows";
9356
10418
  var BOX_DYNAMIC_SYNC_MANIFEST = "/home/vscode/.agentbox/dynamic-sync.json";
9357
10419
  var BOX_MEMORY_DIR = `${BOX_CLAUDE_PROJECT_DIR}/memory`;
9358
- async function pathExists8(p) {
10420
+ async function pathExists9(p) {
9359
10421
  try {
9360
- await stat10(p);
10422
+ await stat11(p);
9361
10423
  return true;
9362
10424
  } catch {
9363
10425
  return false;
@@ -9373,14 +10435,14 @@ async function walkFiles(root, prefix = "") {
9373
10435
  const out = [];
9374
10436
  for (const ent of entries) {
9375
10437
  const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
9376
- const full = join16(root, ent.name);
10438
+ const full = join17(root, ent.name);
9377
10439
  if (ent.isDirectory()) {
9378
10440
  out.push(...await walkFiles(full, rel));
9379
10441
  } else if (ent.isFile()) {
9380
10442
  out.push(rel);
9381
10443
  } else if (ent.isSymbolicLink()) {
9382
10444
  try {
9383
- const s = await stat10(full);
10445
+ const s = await stat11(full);
9384
10446
  if (s.isFile()) out.push(rel);
9385
10447
  } catch {
9386
10448
  }
@@ -9389,7 +10451,7 @@ async function walkFiles(root, prefix = "") {
9389
10451
  return out;
9390
10452
  }
9391
10453
  async function hashFile(absPath) {
9392
- const buf = await readFile9(absPath);
10454
+ const buf = await readFile10(absPath);
9393
10455
  return createHash32("sha256").update(buf).digest("hex");
9394
10456
  }
9395
10457
  async function buildHostSet(name, hostDir, boxDst) {
@@ -9397,13 +10459,13 @@ async function buildHostSet(name, hostDir, boxDst) {
9397
10459
  const rels = await walkFiles(hostDir);
9398
10460
  const files = {};
9399
10461
  for (const rel of rels) {
9400
- files[rel] = await hashFile(join16(hostDir, rel));
10462
+ files[rel] = await hashFile(join17(hostDir, rel));
9401
10463
  }
9402
10464
  return { dst: boxDst, files, hostDir };
9403
10465
  }
9404
- async function buildHostSyncManifest(workspacePath, hostHome = homedir12()) {
9405
- const workflowsDir = join16(hostHome, ".claude", "workflows");
9406
- 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;
9407
10469
  const memoryHost = await resolveClaudeMemoryDir(workspacePath, hostHome);
9408
10470
  const [workflows, memory] = await Promise.all([
9409
10471
  buildHostSet("workflows", workflowsHost, BOX_WORKFLOWS_DIR),
@@ -9424,7 +10486,7 @@ function computeSyncDelta(host, box) {
9424
10486
  uploads.push({
9425
10487
  set: name,
9426
10488
  rel,
9427
- absSrc: join16(hostSet.hostDir, rel),
10489
+ absSrc: join17(hostSet.hostDir, rel),
9428
10490
  dst: `${hostSet.dst}/${rel}`
9429
10491
  });
9430
10492
  }
@@ -9443,16 +10505,16 @@ async function stageDynamicSyncTarball(uploads) {
9443
10505
  return { tarballPath: null, cleanup: async () => {
9444
10506
  } };
9445
10507
  }
9446
- const stageDir = await mkdtemp4(join16(tmpdir4(), "agentbox-dynsync-stage-"));
10508
+ const stageDir = await mkdtemp4(join17(tmpdir4(), "agentbox-dynsync-stage-"));
9447
10509
  let tarballPath = null;
9448
10510
  try {
9449
10511
  for (const up of uploads) {
9450
- const target = join16(stageDir, up.set, up.rel);
10512
+ const target = join17(stageDir, up.set, up.rel);
9451
10513
  await mkdir8(dirname4(target), { recursive: true });
9452
10514
  await copyFile2(up.absSrc, target);
9453
10515
  }
9454
- tarballPath = join16(tmpdir4(), `agentbox-dynsync-${basename7(stageDir)}.tar.gz`);
9455
- 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, "."], {
9456
10518
  env: { ...process.env, COPYFILE_DISABLE: "1" }
9457
10519
  });
9458
10520
  const tp = tarballPath;
@@ -9579,6 +10641,7 @@ export {
9579
10641
  stageClaudeStaticForUpload,
9580
10642
  stageClaudeCredentialsForUpload,
9581
10643
  stageCodexStaticForUpload,
10644
+ stageAgentsStaticForUpload,
9582
10645
  stageCodexCredentialsForUpload,
9583
10646
  stageOpencodeStaticForUpload,
9584
10647
  stageOpencodeCredentialsForUpload,
@@ -9624,6 +10687,10 @@ export {
9624
10687
  volumeHasCodexAuth,
9625
10688
  codexSessionInfo,
9626
10689
  pullCodexConfig,
10690
+ SHARED_AGENTS_VOLUME,
10691
+ resolveAgentsVolume,
10692
+ ensureAgentsVolume,
10693
+ buildAgentsMounts,
9627
10694
  SHARED_OPENCODE_VOLUME,
9628
10695
  DEFAULT_OPENCODE_SESSION,
9629
10696
  resolveOpencodeVolume,
@@ -9749,4 +10816,43 @@ export {
9749
10816
  browserSessionActive,
9750
10817
  ensureBoxBrowser
9751
10818
  };
9752
- //# sourceMappingURL=chunk-HFQZJO73.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