@madarco/agentbox 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{_cloud-attach-THTN4CFZ.js → _cloud-attach-MH7NKIZY.js} +3 -3
  3. package/dist/{chunk-ZX6DTA4X.js → chunk-3465NDRZ.js} +95 -7
  4. package/dist/chunk-3465NDRZ.js.map +1 -0
  5. package/dist/{chunk-7RWFYLF3.js → chunk-4ATVA3RM.js} +7 -7
  6. package/dist/{chunk-3VFY3N4A.js → chunk-5N7GA2X7.js} +58 -76
  7. package/dist/chunk-5N7GA2X7.js.map +1 -0
  8. package/dist/{dist-3PLT2EK2.js → dist-AJWL4WLW.js} +4 -2
  9. package/dist/{dist-3WFNXXPE.js → dist-CTTTHG6U.js} +5 -4
  10. package/dist/{dist-3WFNXXPE.js.map → dist-CTTTHG6U.js.map} +1 -1
  11. package/dist/{dist-7ELDXBAG.js → dist-G5PDFWKH.js} +7 -4
  12. package/dist/{dist-7ELDXBAG.js.map → dist-G5PDFWKH.js.map} +1 -1
  13. package/dist/{dist-CZ6CRADC.js → dist-LUEH7MER.js} +3 -3
  14. package/dist/dist-LUEH7MER.js.map +1 -0
  15. package/dist/{dist-C3YRC3PP.js → dist-T3JIYHCA.js} +3 -3
  16. package/dist/index.js +29 -29
  17. package/package.json +5 -5
  18. package/runtime/docker/Dockerfile.box +13 -0
  19. package/runtime/e2b/attach-helper.cjs +4 -1
  20. package/runtime/e2b/scripts/build-template.sh +10 -0
  21. package/runtime/hetzner/scripts/install-box.sh +9 -0
  22. package/runtime/vercel/scripts/provision.sh +20 -0
  23. package/dist/chunk-3VFY3N4A.js.map +0 -1
  24. package/dist/chunk-ZX6DTA4X.js.map +0 -1
  25. package/dist/dist-CZ6CRADC.js.map +0 -1
  26. /package/dist/{_cloud-attach-THTN4CFZ.js.map → _cloud-attach-MH7NKIZY.js.map} +0 -0
  27. /package/dist/{chunk-7RWFYLF3.js.map → chunk-4ATVA3RM.js.map} +0 -0
  28. /package/dist/{dist-3PLT2EK2.js.map → dist-AJWL4WLW.js.map} +0 -0
  29. /package/dist/{dist-C3YRC3PP.js.map → dist-T3JIYHCA.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -9,6 +9,27 @@ Entries are generated from the commit history with `/release-notes` and then
9
9
  hand-reviewed — they describe what changed for someone using the `agentbox`
10
10
  CLI, not the raw commits.
11
11
 
12
+ ## [0.20.1] - 2026-06-25
13
+
14
+ ### Added
15
+
16
+ - **git-lfs repos now check out with real content inside boxes.** LFS-tracked
17
+ files land as their actual content instead of broken pointer files (or a
18
+ failed seed) at both create and checkpoint-restore. Covers every provider —
19
+ docker plus the cloud backends (daytona, hetzner, vercel, e2b). Cloud boxes
20
+ carry only the checked-out ref's objects (no creds/network needed in-box);
21
+ pushing box-created LFS objects back is not yet supported. Cloud providers
22
+ need a re-`prepare` to pick up the in-box git-lfs binary.
23
+
24
+ ### Fixed
25
+
26
+ - **Attaching to a box no longer flashes and exits with an unusual terminal.**
27
+ When your terminal isn't in the box's terminfo database (e.g. Ghostty's
28
+ `xterm-ghostty`), `agentbox claude` / `codex` / `opencode` / `shell` attach
29
+ used to flash-quit with "missing or unsuitable terminal"; it now falls back
30
+ to `xterm-256color`. Terminals the box does recognize keep full fidelity.
31
+ Fixed across docker and all cloud providers.
32
+
12
33
  ## [0.20.0] - 2026-06-24
13
34
 
14
35
  ### Added
@@ -4,8 +4,8 @@ import {
4
4
  cloudAgentAttach,
5
5
  cloudAgentStartDetached,
6
6
  verifyDetachedSession
7
- } from "./chunk-7RWFYLF3.js";
8
- import "./chunk-3VFY3N4A.js";
7
+ } from "./chunk-4ATVA3RM.js";
8
+ import "./chunk-5N7GA2X7.js";
9
9
  import "./chunk-7K2A3NLE.js";
10
10
  import "./chunk-G3H2L3O2.js";
11
11
  import "./chunk-WJFZJZIM.js";
@@ -15,4 +15,4 @@ export {
15
15
  cloudAgentStartDetached,
16
16
  verifyDetachedSession
17
17
  };
18
- //# sourceMappingURL=_cloud-attach-THTN4CFZ.js.map
18
+ //# sourceMappingURL=_cloud-attach-MH7NKIZY.js.map
@@ -12,6 +12,7 @@ import {
12
12
  SHARED_CLAUDE_VOLUME,
13
13
  SHARED_CODEX_VOLUME,
14
14
  SHARED_OPENCODE_VOLUME,
15
+ TERM_FALLBACK_SNIPPET,
15
16
  buildHostEnvFindArgs,
16
17
  buildHostSyncManifest,
17
18
  buildTmuxConfigShellSnippet,
@@ -42,7 +43,7 @@ import {
42
43
  stageOpencodeStateForUpload,
43
44
  stageOpencodeStaticForUpload,
44
45
  syncClaudeCredentials
45
- } from "./chunk-3VFY3N4A.js";
46
+ } from "./chunk-5N7GA2X7.js";
46
47
  import {
47
48
  DEFAULT_BOX_IMAGE,
48
49
  allocateProjectIndex,
@@ -90,9 +91,9 @@ import {
90
91
  } from "path";
91
92
  import { posix } from "path";
92
93
  import { execa as execa5 } from "execa";
93
- import { mkdtemp as mkdtemp5, rm as rm6, stat } from "fs/promises";
94
+ import { copyFile, mkdir as mkdir3, mkdtemp as mkdtemp5, rm as rm6, stat } from "fs/promises";
94
95
  import { tmpdir as tmpdir5 } from "os";
95
- import { join as join6 } from "path";
96
+ import { dirname as dirname3, join as join6 } from "path";
96
97
  var CREDENTIALS_VOLUME = "agentbox-credentials";
97
98
  var AGENT_SPECS = [
98
99
  {
@@ -1117,7 +1118,9 @@ async function seedFromGitClone(args) {
1117
1118
  adaptive ? `clone: depth=${String(DEFAULT_BUNDLE_DEPTH)} (default, adaptive)` : initialDepth === null ? "clone: depth=full (configured)" : `clone: depth=${String(initialDepth)} (configured)`
1118
1119
  );
1119
1120
  const cloneBranch = args.useBranch ?? args.fromBranch;
1121
+ const lfsRef = cloneBranch ?? "HEAD";
1120
1122
  await runShallowClone(args.hostRepo, cloneDir, initialDepth, stashRefCreated, cloneBranch);
1123
+ await seedCloneLfsObjects(args.hostRepo, cloneDir, lfsRef, log);
1121
1124
  await tarCloneDir(cloneDir, tarPath);
1122
1125
  if (adaptive && initialDepth !== null) {
1123
1126
  const size = await safeFileSize(tarPath);
@@ -1129,6 +1132,7 @@ async function seedFromGitClone(args) {
1129
1132
  await rm6(cloneDir, { recursive: true, force: true });
1130
1133
  await rm6(tarPath, { force: true });
1131
1134
  await runShallowClone(args.hostRepo, cloneDir, LARGE_BUNDLE_DEPTH, stashRefCreated, cloneBranch);
1135
+ await seedCloneLfsObjects(args.hostRepo, cloneDir, lfsRef, log);
1132
1136
  await tarCloneDir(cloneDir, tarPath);
1133
1137
  }
1134
1138
  }
@@ -1200,6 +1204,7 @@ async function seedFromGitClone(args) {
1200
1204
  }
1201
1205
  var DELTA_TARGET_REF = "refs/agentbox-delta/target";
1202
1206
  var REMOTE_DELTA_BUNDLE = "/tmp/agentbox-delta.bundle";
1207
+ var REMOTE_DELTA_LFS = "/tmp/agentbox-delta-lfs.tar.gz";
1203
1208
  var SHA_RE = /^[0-9a-f]{40}$/;
1204
1209
  async function tryReseedRepoDelta(args) {
1205
1210
  const log = args.onLog ?? (() => {
@@ -1232,6 +1237,7 @@ async function tryReseedRepoDelta(args) {
1232
1237
  const stage = await mkdtemp5(join6(tmpdir5(), "agentbox-delta-"));
1233
1238
  const bundlePath = join6(stage, "delta.bundle");
1234
1239
  const untrackedTarPath = join6(stage, "untracked.tar.gz");
1240
+ const deltaLfsTarPath = join6(stage, "delta-lfs.tar.gz");
1235
1241
  const stashSha = args.useBranch || args.skipCarryOver ? null : await safeStashCreate(args.hostRepo);
1236
1242
  const untrackedSize = args.useBranch || args.skipCarryOver ? 0 : await maybeBuildUntrackedTar(args.hostRepo, untrackedTarPath);
1237
1243
  let stashRefCreated = false;
@@ -1267,6 +1273,18 @@ async function tryReseedRepoDelta(args) {
1267
1273
  if (untrackedSize > 0) {
1268
1274
  await args.backend.uploadFile(args.handle, untrackedTarPath, REMOTE_UNTRACKED_TAR);
1269
1275
  }
1276
+ const deltaLfsSize = await maybeBuildDeltaLfsTar(
1277
+ args.hostRepo,
1278
+ target,
1279
+ checkpointTip,
1280
+ deltaLfsTarPath
1281
+ );
1282
+ if (deltaLfsSize > 0) {
1283
+ await args.backend.uploadFile(args.handle, deltaLfsTarPath, REMOTE_DELTA_LFS);
1284
+ log(
1285
+ `checkpoint restore: ${args.workspaceDir}: ${String(deltaLfsSize)} B of new git-lfs objects`
1286
+ );
1287
+ }
1270
1288
  log(
1271
1289
  needTarget ? `checkpoint restore: ${args.workspaceDir}: delta bundle (${checkpointTip.slice(0, 8)}..${target.slice(0, 8)})` : `checkpoint restore: ${args.workspaceDir}: no new host commits; re-branch + carry-over only`
1272
1290
  );
@@ -1284,18 +1302,20 @@ async function tryReseedRepoDelta(args) {
1284
1302
  hasUntracked: untrackedSize > 0,
1285
1303
  detectConflicts: true
1286
1304
  });
1305
+ const lfsStep = deltaLfsSize > 0 ? `tar -C ${quoteShellArgv([`${args.workspaceDir}/.git`])} -xzf ${quoteShellArgv([REMOTE_DELTA_LFS])}` : ": # no delta lfs objects";
1287
1306
  const SUDO = `if command -v sudo >/dev/null 2>&1; then SUDO='sudo -n'; else SUDO=''; fi`;
1288
1307
  const script = [
1289
1308
  `set -euo pipefail`,
1290
1309
  `cd /tmp`,
1291
1310
  SUDO,
1292
1311
  fetchStep,
1312
+ lfsStep,
1293
1313
  checkoutStep,
1294
1314
  `git -C ${wd} reset --hard ${quoteShellArgv([target])}`,
1295
1315
  setOrigin,
1296
1316
  ...carryOverSteps,
1297
1317
  `git -C ${wd} update-ref -d ${quoteShellArgv([DELTA_TARGET_REF])} || true`,
1298
- `rm -f ${quoteShellArgv([REMOTE_DELTA_BUNDLE])}`
1318
+ `rm -f ${quoteShellArgv([REMOTE_DELTA_BUNDLE])} ${quoteShellArgv([REMOTE_DELTA_LFS])}`
1299
1319
  ].join("\n");
1300
1320
  const r = await args.backend.exec(args.handle, bashScript(script));
1301
1321
  if (r.exitCode !== 0) {
@@ -1336,6 +1356,69 @@ async function tarCloneDir(cloneDir, outPath) {
1336
1356
  env: { ...process.env, COPYFILE_DISABLE: "1" }
1337
1357
  });
1338
1358
  }
1359
+ var LFS_OID_RE = /^[0-9a-f]{64}$/;
1360
+ function lfsObjectRelPath(oid) {
1361
+ return join6("lfs", "objects", oid.slice(0, 2), oid.slice(2, 4), oid);
1362
+ }
1363
+ async function lfsOidsForRef(hostRepo, ref) {
1364
+ const listed = await execa5("git", ["-C", hostRepo, "lfs", "ls-files", "--long", ref], {
1365
+ reject: false
1366
+ });
1367
+ if (listed.exitCode !== 0) return [];
1368
+ const oids = listed.stdout.split("\n").map((l) => l.trim().split(/\s+/)[0] ?? "").filter((o) => LFS_OID_RE.test(o));
1369
+ return [...new Set(oids)];
1370
+ }
1371
+ async function seedCloneLfsObjects(hostRepo, cloneDir, ref, log) {
1372
+ const tracked = await execa5("git", ["-C", hostRepo, "lfs", "ls-files", "-n", ref], {
1373
+ reject: false
1374
+ });
1375
+ if (tracked.exitCode !== 0 || tracked.stdout.trim().length === 0) return;
1376
+ const fetched = await execa5("git", ["-C", hostRepo, "lfs", "fetch", "origin", ref], {
1377
+ reject: false
1378
+ });
1379
+ if (fetched.exitCode !== 0) {
1380
+ const msg = (fetched.stderr || fetched.stdout || `exit ${String(fetched.exitCode ?? "?")}`).trim().split("\n")[0];
1381
+ log(`git-lfs prefetch for ${ref} skipped (best-effort, continuing): ${msg}`);
1382
+ }
1383
+ const oids = await lfsOidsForRef(hostRepo, ref);
1384
+ let copied = 0;
1385
+ for (const oid of oids) {
1386
+ const rel = lfsObjectRelPath(oid);
1387
+ const dst = join6(cloneDir, ".git", rel);
1388
+ try {
1389
+ await mkdir3(dirname3(dst), { recursive: true });
1390
+ await copyFile(join6(hostRepo, ".git", rel), dst);
1391
+ copied++;
1392
+ } catch {
1393
+ }
1394
+ }
1395
+ if (copied > 0) log(`seeded ${String(copied)} git-lfs object(s) for ${ref} into clone`);
1396
+ }
1397
+ async function maybeBuildDeltaLfsTar(hostRepo, target, checkpointTip, outPath) {
1398
+ const targetOids = await lfsOidsForRef(hostRepo, target);
1399
+ if (targetOids.length === 0) return 0;
1400
+ const have = new Set(await lfsOidsForRef(hostRepo, checkpointTip));
1401
+ const deltaOids = targetOids.filter((o) => !have.has(o));
1402
+ if (deltaOids.length === 0) return 0;
1403
+ await execa5("git", ["-C", hostRepo, "lfs", "fetch", "origin", target], { reject: false });
1404
+ const gitDir = join6(hostRepo, ".git");
1405
+ const relPaths = [];
1406
+ for (const oid of deltaOids) {
1407
+ const rel = lfsObjectRelPath(oid);
1408
+ try {
1409
+ await stat(join6(gitDir, rel));
1410
+ relPaths.push(rel);
1411
+ } catch {
1412
+ }
1413
+ }
1414
+ if (relPaths.length === 0) return 0;
1415
+ const tar = await execa5("tar", ["-C", gitDir, "-czf", outPath, ...relPaths], {
1416
+ env: { ...process.env, COPYFILE_DISABLE: "1" },
1417
+ reject: false
1418
+ });
1419
+ if (tar.exitCode !== 0) return 0;
1420
+ return safeFileSize(outPath);
1421
+ }
1339
1422
  async function safeFileSize(path) {
1340
1423
  try {
1341
1424
  return (await stat(path)).size;
@@ -2231,6 +2314,10 @@ function makeCloudCheckpoint(backend) {
2231
2314
  }
2232
2315
  };
2233
2316
  }
2317
+ function hostTermForCloud() {
2318
+ const t = process.env["TERM"];
2319
+ return t && /^[A-Za-z0-9][A-Za-z0-9._+-]*$/.test(t) ? t : "xterm-256color";
2320
+ }
2234
2321
  function renderInnerCommand(kind, opts) {
2235
2322
  const sessionName = opts?.sessionName ?? defaultSessionName(kind);
2236
2323
  const fallback = opts?.command ?? defaultCommand(kind, opts);
@@ -2249,8 +2336,8 @@ function renderInnerCommand(kind, opts) {
2249
2336
  `tmux has-session -t ${sessionQ} 2>/dev/null || tmux new-session -d -c ${cwdQ} -s ${sessionQ} ${fallbackQ}`,
2250
2337
  configSnippet
2251
2338
  ];
2252
- if (opts?.detached) return lines.join("; ");
2253
- return [...lines, `exec tmux attach -t ${sessionQ}`].join("; ");
2339
+ if (opts?.detached) return TERM_FALLBACK_SNIPPET + lines.join("; ");
2340
+ return TERM_FALLBACK_SNIPPET + [...lines, `exec tmux attach -t ${sessionQ}`].join("; ");
2254
2341
  }
2255
2342
  function defaultSessionName(kind) {
2256
2343
  switch (kind) {
@@ -2295,6 +2382,7 @@ export {
2295
2382
  removeCloudCheckpointDir,
2296
2383
  probeCloudCheckpoint,
2297
2384
  createCloudProvider,
2385
+ hostTermForCloud,
2298
2386
  renderInnerCommand
2299
2387
  };
2300
- //# sourceMappingURL=chunk-ZX6DTA4X.js.map
2388
+ //# sourceMappingURL=chunk-3465NDRZ.js.map