@madarco/agentbox 0.19.0 → 0.20.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 (45) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/dist/{_cloud-attach-YM2KOWHO.js → _cloud-attach-THTN4CFZ.js} +7 -5
  3. package/dist/{chunk-A5OFRJDI.js → chunk-3VFY3N4A.js} +76 -22
  4. package/dist/chunk-3VFY3N4A.js.map +1 -0
  5. package/dist/{chunk-Y6PUCLOE.js → chunk-52LKNUY7.js} +5 -2
  6. package/dist/chunk-52LKNUY7.js.map +1 -0
  7. package/dist/{chunk-JK5V4OLT.js → chunk-7RWFYLF3.js} +194 -34
  8. package/dist/chunk-7RWFYLF3.js.map +1 -0
  9. package/dist/{chunk-SPUUOEW2.js → chunk-ZX6DTA4X.js} +5 -4
  10. package/dist/chunk-ZX6DTA4X.js.map +1 -0
  11. package/dist/{dist-EKSNZHDY.js → dist-3PLT2EK2.js} +6 -2
  12. package/dist/{dist-VQSZVBT3.js → dist-3WFNXXPE.js} +3 -3
  13. package/dist/{dist-U2BHTWG4.js → dist-7ELDXBAG.js} +6 -5
  14. package/dist/dist-7ELDXBAG.js.map +1 -0
  15. package/dist/{dist-PRDYMXCX.js → dist-C3YRC3PP.js} +3 -3
  16. package/dist/{dist-FTCDWRAL.js → dist-CZ6CRADC.js} +3 -3
  17. package/dist/index.js +789 -291
  18. package/dist/index.js.map +1 -1
  19. package/package.json +2 -2
  20. package/runtime/docker/packages/ctl/dist/bin.cjs +122 -62
  21. package/runtime/docker/packages/sandbox-docker/scripts/claude-managed-settings.json +4 -4
  22. package/runtime/e2b/agentbox-dockerd-start +145 -0
  23. package/runtime/e2b/attach-helper.cjs +23 -2
  24. package/runtime/e2b/claude-managed-settings.json +4 -4
  25. package/runtime/e2b/ctl.cjs +122 -62
  26. package/runtime/e2b/scripts/build-template.sh +22 -5
  27. package/runtime/hetzner/claude-managed-settings.json +4 -4
  28. package/runtime/hetzner/ctl.cjs +122 -62
  29. package/runtime/relay/bin.cjs +6 -0
  30. package/runtime/vercel/claude-managed-settings.json +4 -4
  31. package/runtime/vercel/ctl.cjs +122 -62
  32. package/share/host-skills/agentbox/SKILL.md +2 -2
  33. package/share/host-skills/agentbox-info/SKILL.md +6 -6
  34. package/share/host-skills/codex/agentbox.md +2 -2
  35. package/share/host-skills/opencode/agentbox.md +2 -2
  36. package/dist/chunk-A5OFRJDI.js.map +0 -1
  37. package/dist/chunk-JK5V4OLT.js.map +0 -1
  38. package/dist/chunk-SPUUOEW2.js.map +0 -1
  39. package/dist/chunk-Y6PUCLOE.js.map +0 -1
  40. package/dist/dist-U2BHTWG4.js.map +0 -1
  41. /package/dist/{_cloud-attach-YM2KOWHO.js.map → _cloud-attach-THTN4CFZ.js.map} +0 -0
  42. /package/dist/{dist-EKSNZHDY.js.map → dist-3PLT2EK2.js.map} +0 -0
  43. /package/dist/{dist-VQSZVBT3.js.map → dist-3WFNXXPE.js.map} +0 -0
  44. /package/dist/{dist-PRDYMXCX.js.map → dist-C3YRC3PP.js.map} +0 -0
  45. /package/dist/{dist-FTCDWRAL.js.map → dist-CZ6CRADC.js.map} +0 -0
@@ -11388,14 +11388,55 @@ var claudeSessionCommand = new Command("claude-session").description("Report whe
11388
11388
  }
11389
11389
  });
11390
11390
 
11391
+ // src/session-pointer.ts
11392
+ var import_node_fs2 = require("fs");
11393
+ var import_node_os = require("os");
11394
+ var import_node_path = require("path");
11395
+ var SESSION_POINTER_DIR = (0, import_node_path.join)((0, import_node_os.homedir)(), ".local", "state", "agentbox");
11396
+ var CLAUDE_SESSION_POINTER = (0, import_node_path.join)(SESSION_POINTER_DIR, "claude-session");
11397
+ var CODEX_ACTIVE_MARKER = (0, import_node_path.join)(SESSION_POINTER_DIR, "codex-active");
11398
+ function writePointer(path6, content) {
11399
+ try {
11400
+ (0, import_node_fs2.mkdirSync)((0, import_node_path.dirname)(path6), { recursive: true });
11401
+ (0, import_node_fs2.writeFileSync)(path6, content, "utf8");
11402
+ } catch {
11403
+ }
11404
+ }
11405
+ function recordClaudeSessionId(id) {
11406
+ if (!/^[0-9a-fA-F][0-9a-fA-F-]{7,}$/.test(id)) return;
11407
+ writePointer(CLAUDE_SESSION_POINTER, `${id}
11408
+ `);
11409
+ }
11410
+ function markCodexActive() {
11411
+ writePointer(CODEX_ACTIVE_MARKER, `${(/* @__PURE__ */ new Date()).toISOString()}
11412
+ `);
11413
+ }
11414
+ function clearPointer(path6) {
11415
+ try {
11416
+ (0, import_node_fs2.rmSync)(path6, { force: true });
11417
+ } catch {
11418
+ }
11419
+ }
11420
+ function clearClaudeSessionPointer() {
11421
+ clearPointer(CLAUDE_SESSION_POINTER);
11422
+ }
11423
+ function clearCodexMarker() {
11424
+ clearPointer(CODEX_ACTIVE_MARKER);
11425
+ }
11426
+
11391
11427
  // src/commands/claude-state.ts
11392
- var claudeStateCommand = new Command("claude-state").description("Report Claude activity state to the box supervisor (used by hooks)").argument("<state>", `one of: ${CLAUDE_ACTIVITY_STATES.join(", ")}`).option("--socket <path>", "unix socket path", DEFAULT_SOCKET_PATH).option("--payload-stdin", "parse Claude Code's hook JSON from stdin (PreToolUse plan/question)").option("--clear-pending", "force-clear a sticky end-plan/question state (PostToolUse cleanup)").action(async (state, opts) => {
11428
+ var claudeStateCommand = new Command("claude-state").description("Report Claude activity state to the box supervisor (used by hooks)").argument("<state>", `one of: ${CLAUDE_ACTIVITY_STATES.join(", ")}`).option("--socket <path>", "unix socket path", DEFAULT_SOCKET_PATH).option("--payload-stdin", "parse Claude Code's hook JSON from stdin (PreToolUse plan/question)").option("--clear-pending", "force-clear a sticky end-plan/question state (PostToolUse cleanup)").option("--capture-session", "record the hook's session_id to the box's session pointer").option("--clear-session", "drop the box's session pointer (SessionEnd)").action(async (state, opts) => {
11393
11429
  try {
11394
11430
  if (!CLAUDE_ACTIVITY_STATES.includes(state)) {
11395
11431
  process.exit(0);
11396
11432
  }
11433
+ if (opts.clearSession) clearClaudeSessionPointer();
11397
11434
  const typedState = state;
11398
- const extracted = opts.payloadStdin ? await extractPayload(typedState, await readStdinJson()) : void 0;
11435
+ const raw = opts.payloadStdin || opts.captureSession ? await readStdinJson() : null;
11436
+ if (opts.captureSession && typeof raw?.session_id === "string") {
11437
+ recordClaudeSessionId(raw.session_id);
11438
+ }
11439
+ const extracted = opts.payloadStdin ? extractPayload(typedState, raw) : void 0;
11399
11440
  const payload = { ...extracted ?? {} };
11400
11441
  if (opts.clearPending) payload.clearPending = true;
11401
11442
  const hasField = payload.plan !== void 0 || payload.question !== void 0 || payload.clearPending !== void 0;
@@ -11669,6 +11710,7 @@ var BUILT_IN_DEFAULTS = {
11669
11710
  vercelVcpus: 2,
11670
11711
  vercelTimeoutMs: 27e5,
11671
11712
  vercelNetworkPolicy: "",
11713
+ e2bTimeoutMs: 27e5,
11672
11714
  cpMaxBytes: 100 * 1024 * 1024
11673
11715
  },
11674
11716
  checkpoint: {
@@ -11952,6 +11994,11 @@ var KEY_REGISTRY = [
11952
11994
  type: "int",
11953
11995
  description: "Max session length (ms) for new --provider vercel boxes before the VM auto-snapshots; persistent mode auto-resumes on the next call. Default 2700000 (45 min, the Hobby ceiling). Vercel-only."
11954
11996
  },
11997
+ {
11998
+ key: "box.e2bTimeoutMs",
11999
+ type: "int",
12000
+ description: "Session timeout (ms) a new --provider e2b box is created with, before E2B auto-pauses it on inactivity. The host keepalive loop pushes this forward while the agent is working. Default 2700000 (45 min); the Hobby tier caps total session at ~1 h regardless. E2B-only."
12001
+ },
11955
12002
  {
11956
12003
  key: "box.cpMaxBytes",
11957
12004
  type: "int",
@@ -13306,13 +13353,13 @@ var handleCommand = (filePath, rawArguments, rawOptions) => {
13306
13353
  };
13307
13354
 
13308
13355
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/options.js
13309
- var import_node_path5 = __toESM(require("path"), 1);
13356
+ var import_node_path6 = __toESM(require("path"), 1);
13310
13357
  var import_node_process8 = __toESM(require("process"), 1);
13311
13358
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
13312
13359
 
13313
13360
  // ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
13314
13361
  var import_node_process5 = __toESM(require("process"), 1);
13315
- var import_node_path2 = __toESM(require("path"), 1);
13362
+ var import_node_path3 = __toESM(require("path"), 1);
13316
13363
 
13317
13364
  // ../../node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
13318
13365
  function pathKey(options = {}) {
@@ -13329,7 +13376,7 @@ function pathKey(options = {}) {
13329
13376
  // ../../node_modules/.pnpm/unicorn-magic@0.3.0/node_modules/unicorn-magic/node.js
13330
13377
  var import_node_util4 = require("util");
13331
13378
  var import_node_child_process3 = require("child_process");
13332
- var import_node_path = __toESM(require("path"), 1);
13379
+ var import_node_path2 = __toESM(require("path"), 1);
13333
13380
  var import_node_url2 = require("url");
13334
13381
  var execFileOriginal = (0, import_node_util4.promisify)(import_node_child_process3.execFile);
13335
13382
  function toPath(urlOrPath) {
@@ -13338,12 +13385,12 @@ function toPath(urlOrPath) {
13338
13385
  function traversePathUp(startPath) {
13339
13386
  return {
13340
13387
  *[Symbol.iterator]() {
13341
- let currentPath = import_node_path.default.resolve(toPath(startPath));
13388
+ let currentPath = import_node_path2.default.resolve(toPath(startPath));
13342
13389
  let previousPath;
13343
13390
  while (previousPath !== currentPath) {
13344
13391
  yield currentPath;
13345
13392
  previousPath = currentPath;
13346
- currentPath = import_node_path.default.resolve(currentPath, "..");
13393
+ currentPath = import_node_path2.default.resolve(currentPath, "..");
13347
13394
  }
13348
13395
  }
13349
13396
  };
@@ -13358,27 +13405,27 @@ var npmRunPath = ({
13358
13405
  execPath: execPath2 = import_node_process5.default.execPath,
13359
13406
  addExecPath = true
13360
13407
  } = {}) => {
13361
- const cwdPath = import_node_path2.default.resolve(toPath(cwd));
13408
+ const cwdPath = import_node_path3.default.resolve(toPath(cwd));
13362
13409
  const result = [];
13363
- const pathParts = pathOption.split(import_node_path2.default.delimiter);
13410
+ const pathParts = pathOption.split(import_node_path3.default.delimiter);
13364
13411
  if (preferLocal) {
13365
13412
  applyPreferLocal(result, pathParts, cwdPath);
13366
13413
  }
13367
13414
  if (addExecPath) {
13368
13415
  applyExecPath(result, pathParts, execPath2, cwdPath);
13369
13416
  }
13370
- return pathOption === "" || pathOption === import_node_path2.default.delimiter ? `${result.join(import_node_path2.default.delimiter)}${pathOption}` : [...result, pathOption].join(import_node_path2.default.delimiter);
13417
+ return pathOption === "" || pathOption === import_node_path3.default.delimiter ? `${result.join(import_node_path3.default.delimiter)}${pathOption}` : [...result, pathOption].join(import_node_path3.default.delimiter);
13371
13418
  };
13372
13419
  var applyPreferLocal = (result, pathParts, cwdPath) => {
13373
13420
  for (const directory of traversePathUp(cwdPath)) {
13374
- const pathPart = import_node_path2.default.join(directory, "node_modules/.bin");
13421
+ const pathPart = import_node_path3.default.join(directory, "node_modules/.bin");
13375
13422
  if (!pathParts.includes(pathPart)) {
13376
13423
  result.push(pathPart);
13377
13424
  }
13378
13425
  }
13379
13426
  };
13380
13427
  var applyExecPath = (result, pathParts, execPath2, cwdPath) => {
13381
- const pathPart = import_node_path2.default.resolve(cwdPath, toPath(execPath2), "..");
13428
+ const pathPart = import_node_path3.default.resolve(cwdPath, toPath(execPath2), "..");
13382
13429
  if (!pathParts.includes(pathPart)) {
13383
13430
  result.push(pathPart);
13384
13431
  }
@@ -13427,10 +13474,10 @@ var ExecaSyncError = class extends Error {
13427
13474
  setErrorName(ExecaSyncError, ExecaSyncError.name);
13428
13475
 
13429
13476
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/signal.js
13430
- var import_node_os3 = require("os");
13477
+ var import_node_os4 = require("os");
13431
13478
 
13432
13479
  // ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js
13433
- var import_node_os2 = require("os");
13480
+ var import_node_os3 = require("os");
13434
13481
 
13435
13482
  // ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/realtime.js
13436
13483
  var getRealtimeSignals = () => {
@@ -13448,7 +13495,7 @@ var SIGRTMIN = 34;
13448
13495
  var SIGRTMAX = 64;
13449
13496
 
13450
13497
  // ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js
13451
- var import_node_os = require("os");
13498
+ var import_node_os2 = require("os");
13452
13499
 
13453
13500
  // ../../node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/core.js
13454
13501
  var SIGNALS = [
@@ -13739,7 +13786,7 @@ var normalizeSignal = ({
13739
13786
  }) => {
13740
13787
  const {
13741
13788
  signals: { [name]: constantSignal }
13742
- } = import_node_os.constants;
13789
+ } = import_node_os2.constants;
13743
13790
  const supported = constantSignal !== void 0;
13744
13791
  const number = supported ? constantSignal : defaultNumber;
13745
13792
  return { name, number, description, supported, action, forced, standard };
@@ -13788,7 +13835,7 @@ var getSignalByNumber = (number, signals2) => {
13788
13835
  };
13789
13836
  };
13790
13837
  var findSignalByNumber = (number, signals2) => {
13791
- const signal = signals2.find(({ name }) => import_node_os2.constants.signals[name] === number);
13838
+ const signal = signals2.find(({ name }) => import_node_os3.constants.signals[name] === number);
13792
13839
  if (signal !== void 0) {
13793
13840
  return signal;
13794
13841
  }
@@ -13822,13 +13869,13 @@ var normalizeSignalInteger = (signalInteger, optionName) => {
13822
13869
  throw new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.
13823
13870
  ${getAvailableSignals()}`);
13824
13871
  };
13825
- var getSignalsIntegerToName = () => new Map(Object.entries(import_node_os3.constants.signals).reverse().map(([signalName, signalInteger]) => [signalInteger, signalName]));
13872
+ var getSignalsIntegerToName = () => new Map(Object.entries(import_node_os4.constants.signals).reverse().map(([signalName, signalInteger]) => [signalInteger, signalName]));
13826
13873
  var signalsIntegerToName = getSignalsIntegerToName();
13827
13874
  var normalizeSignalName = (signalName, optionName) => {
13828
- if (signalName in import_node_os3.constants.signals) {
13875
+ if (signalName in import_node_os4.constants.signals) {
13829
13876
  return signalName;
13830
13877
  }
13831
- if (signalName.toUpperCase() in import_node_os3.constants.signals) {
13878
+ if (signalName.toUpperCase() in import_node_os4.constants.signals) {
13832
13879
  throw new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);
13833
13880
  }
13834
13881
  throw new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.
@@ -13836,8 +13883,8 @@ ${getAvailableSignals()}`);
13836
13883
  };
13837
13884
  var getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.
13838
13885
  Available signal numbers: ${getAvailableSignalIntegers()}.`;
13839
- var getAvailableSignalNames = () => Object.keys(import_node_os3.constants.signals).sort().map((signalName) => `'${signalName}'`).join(", ");
13840
- var getAvailableSignalIntegers = () => [...new Set(Object.values(import_node_os3.constants.signals).sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))].join(", ");
13886
+ var getAvailableSignalNames = () => Object.keys(import_node_os4.constants.signals).sort().map((signalName) => `'${signalName}'`).join(", ");
13887
+ var getAvailableSignalIntegers = () => [...new Set(Object.values(import_node_os4.constants.signals).sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))].join(", ");
13841
13888
  var getSignalDescription = (signal) => signalsByName[signal].description;
13842
13889
 
13843
13890
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/terminate/kill.js
@@ -14533,7 +14580,7 @@ var killAfterTimeout = async (subprocess, timeout, context, { signal }) => {
14533
14580
 
14534
14581
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/methods/node.js
14535
14582
  var import_node_process6 = require("process");
14536
- var import_node_path3 = __toESM(require("path"), 1);
14583
+ var import_node_path4 = __toESM(require("path"), 1);
14537
14584
  var mapNode = ({ options }) => {
14538
14585
  if (options.node === false) {
14539
14586
  throw new TypeError('The "node" option cannot be false with `execaNode()`.');
@@ -14552,7 +14599,7 @@ var handleNodeOption = (file, commandArguments, {
14552
14599
  throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
14553
14600
  }
14554
14601
  const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
14555
- const resolvedNodePath = import_node_path3.default.resolve(cwd, normalizedNodePath);
14602
+ const resolvedNodePath = import_node_path4.default.resolve(cwd, normalizedNodePath);
14556
14603
  const newOptions = {
14557
14604
  ...options,
14558
14605
  nodePath: resolvedNodePath,
@@ -14562,7 +14609,7 @@ var handleNodeOption = (file, commandArguments, {
14562
14609
  if (!shouldHandleNode) {
14563
14610
  return [file, commandArguments, newOptions];
14564
14611
  }
14565
- if (import_node_path3.default.basename(file, ".exe") === "node") {
14612
+ if (import_node_path4.default.basename(file, ".exe") === "node") {
14566
14613
  throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
14567
14614
  }
14568
14615
  return [
@@ -14651,12 +14698,12 @@ var ENCODING_ALIASES = {
14651
14698
  var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encoding}"` : String(encoding);
14652
14699
 
14653
14700
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/arguments/cwd.js
14654
- var import_node_fs2 = require("fs");
14655
- var import_node_path4 = __toESM(require("path"), 1);
14701
+ var import_node_fs3 = require("fs");
14702
+ var import_node_path5 = __toESM(require("path"), 1);
14656
14703
  var import_node_process7 = __toESM(require("process"), 1);
14657
14704
  var normalizeCwd = (cwd = getDefaultCwd()) => {
14658
14705
  const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
14659
- return import_node_path4.default.resolve(cwdString);
14706
+ return import_node_path5.default.resolve(cwdString);
14660
14707
  };
14661
14708
  var getDefaultCwd = () => {
14662
14709
  try {
@@ -14673,7 +14720,7 @@ var fixCwdError = (originalMessage, cwd) => {
14673
14720
  }
14674
14721
  let cwdStat;
14675
14722
  try {
14676
- cwdStat = (0, import_node_fs2.statSync)(cwd);
14723
+ cwdStat = (0, import_node_fs3.statSync)(cwd);
14677
14724
  } catch (error) {
14678
14725
  return `The "cwd" option is invalid: ${cwd}.
14679
14726
  ${error.message}
@@ -14703,7 +14750,7 @@ var normalizeOptions = (filePath, rawArguments, rawOptions) => {
14703
14750
  options.killSignal = normalizeKillSignal(options.killSignal);
14704
14751
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
14705
14752
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
14706
- if (import_node_process8.default.platform === "win32" && import_node_path5.default.basename(file, ".exe") === "cmd") {
14753
+ if (import_node_process8.default.platform === "win32" && import_node_path6.default.basename(file, ".exe") === "cmd") {
14707
14754
  commandArguments.unshift("/q");
14708
14755
  }
14709
14756
  return { file, commandArguments, options };
@@ -15678,7 +15725,7 @@ var handleResult = (result, verboseInfo, { reject }) => {
15678
15725
  };
15679
15726
 
15680
15727
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/handle-sync.js
15681
- var import_node_fs4 = require("fs");
15728
+ var import_node_fs5 = require("fs");
15682
15729
 
15683
15730
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/type.js
15684
15731
  var getStdioItemType = (value, optionName) => {
@@ -16008,7 +16055,7 @@ var normalizeStdioSync = (stdioArray, buffer, verboseInfo) => stdioArray.map((st
16008
16055
  var isOutputPipeOnly = (stdioOption) => stdioOption === "pipe" || Array.isArray(stdioOption) && stdioOption.every((item) => item === "pipe");
16009
16056
 
16010
16057
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/native.js
16011
- var import_node_fs3 = require("fs");
16058
+ var import_node_fs4 = require("fs");
16012
16059
  var import_node_tty2 = __toESM(require("tty"), 1);
16013
16060
  var handleNativeStream = ({ stdioItem, stdioItem: { type }, isStdioArray, fdNumber, direction, isSync }) => {
16014
16061
  if (!isStdioArray || type !== "native") {
@@ -16042,7 +16089,7 @@ var getTargetFd = ({ value, optionName, fdNumber, direction }) => {
16042
16089
  if (import_node_tty2.default.isatty(targetFdNumber)) {
16043
16090
  throw new TypeError(`The \`${optionName}: ${serializeOptionValue(value)}\` option is invalid: it cannot be a TTY with synchronous methods.`);
16044
16091
  }
16045
- return { type: "uint8Array", value: bufferToUint8Array((0, import_node_fs3.readFileSync)(targetFdNumber)), optionName };
16092
+ return { type: "uint8Array", value: bufferToUint8Array((0, import_node_fs4.readFileSync)(targetFdNumber)), optionName };
16046
16093
  };
16047
16094
  var getTargetFdNumber = (value, fdNumber) => {
16048
16095
  if (value === "inherit") {
@@ -16375,8 +16422,8 @@ var addProperties = {
16375
16422
  var addPropertiesSync = {
16376
16423
  input: {
16377
16424
  ...addProperties,
16378
- fileUrl: ({ value }) => ({ contents: [bufferToUint8Array((0, import_node_fs4.readFileSync)(value))] }),
16379
- filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array((0, import_node_fs4.readFileSync)(file))] }),
16425
+ fileUrl: ({ value }) => ({ contents: [bufferToUint8Array((0, import_node_fs5.readFileSync)(value))] }),
16426
+ filePath: ({ value: { file } }) => ({ contents: [bufferToUint8Array((0, import_node_fs5.readFileSync)(file))] }),
16380
16427
  fileNumber: forbiddenIfSync,
16381
16428
  iterable: ({ value }) => ({ contents: [...value] }),
16382
16429
  string: ({ value }) => ({ contents: [value] }),
@@ -16722,7 +16769,7 @@ var validateSerializable = (newContents) => {
16722
16769
  };
16723
16770
 
16724
16771
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/io/output-sync.js
16725
- var import_node_fs5 = require("fs");
16772
+ var import_node_fs6 = require("fs");
16726
16773
 
16727
16774
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/verbose/output.js
16728
16775
  var shouldLogOutput = ({ stdioItems, encoding, verboseInfo, fdNumber }) => fdNumber !== "all" && isFullVerbose(verboseInfo, fdNumber) && !BINARY_ENCODINGS.has(encoding) && fdUsesVerbose(fdNumber) && (stdioItems.some(({ type, value }) => type === "native" && PIPED_STDIO_VALUES.has(value)) || stdioItems.every(({ type }) => TRANSFORM_TYPES.has(type)));
@@ -16846,10 +16893,10 @@ var writeToFiles = (serializedResult, stdioItems, outputFiles) => {
16846
16893
  for (const { path: path6, append } of stdioItems.filter(({ type }) => FILE_TYPES.has(type))) {
16847
16894
  const pathString = typeof path6 === "string" ? path6 : path6.toString();
16848
16895
  if (append || outputFiles.has(pathString)) {
16849
- (0, import_node_fs5.appendFileSync)(path6, serializedResult);
16896
+ (0, import_node_fs6.appendFileSync)(path6, serializedResult);
16850
16897
  } else {
16851
16898
  outputFiles.add(pathString);
16852
- (0, import_node_fs5.writeFileSync)(path6, serializedResult);
16899
+ (0, import_node_fs6.writeFileSync)(path6, serializedResult);
16853
16900
  }
16854
16901
  }
16855
16902
  };
@@ -17293,7 +17340,7 @@ var duplex = () => new import_node_stream2.Duplex({ read() {
17293
17340
  var handleDummyPromise = async (error, verboseInfo, options) => handleResult(error, verboseInfo, options);
17294
17341
 
17295
17342
  // ../../node_modules/.pnpm/execa@9.6.1/node_modules/execa/lib/stdio/handle-async.js
17296
- var import_node_fs6 = require("fs");
17343
+ var import_node_fs7 = require("fs");
17297
17344
  var import_node_buffer3 = require("buffer");
17298
17345
  var import_node_stream3 = require("stream");
17299
17346
  var handleStdioAsync = (options, verboseInfo) => handleStdio(addPropertiesAsync, options, verboseInfo, false);
@@ -17317,8 +17364,8 @@ var addProperties2 = {
17317
17364
  var addPropertiesAsync = {
17318
17365
  input: {
17319
17366
  ...addProperties2,
17320
- fileUrl: ({ value }) => ({ stream: (0, import_node_fs6.createReadStream)(value) }),
17321
- filePath: ({ value: { file } }) => ({ stream: (0, import_node_fs6.createReadStream)(file) }),
17367
+ fileUrl: ({ value }) => ({ stream: (0, import_node_fs7.createReadStream)(value) }),
17368
+ filePath: ({ value: { file } }) => ({ stream: (0, import_node_fs7.createReadStream)(file) }),
17322
17369
  webStream: ({ value }) => ({ stream: import_node_stream3.Readable.fromWeb(value) }),
17323
17370
  iterable: ({ value }) => ({ stream: import_node_stream3.Readable.from(value) }),
17324
17371
  asyncIterable: ({ value }) => ({ stream: import_node_stream3.Readable.from(value) }),
@@ -17327,8 +17374,8 @@ var addPropertiesAsync = {
17327
17374
  },
17328
17375
  output: {
17329
17376
  ...addProperties2,
17330
- fileUrl: ({ value }) => ({ stream: (0, import_node_fs6.createWriteStream)(value) }),
17331
- filePath: ({ value: { file, append } }) => ({ stream: (0, import_node_fs6.createWriteStream)(file, append ? { flags: "a" } : {}) }),
17377
+ fileUrl: ({ value }) => ({ stream: (0, import_node_fs7.createWriteStream)(value) }),
17378
+ filePath: ({ value: { file, append } }) => ({ stream: (0, import_node_fs7.createWriteStream)(file, append ? { flags: "a" } : {}) }),
17332
17379
  webStream: ({ value }) => ({ stream: import_node_stream3.Writable.fromWeb(value) }),
17333
17380
  iterable: forbiddenIfAsync,
17334
17381
  asyncIterable: forbiddenIfAsync,
@@ -23142,21 +23189,21 @@ function defaultCapturePane2(sessionName) {
23142
23189
  var import_node_child_process9 = require("child_process");
23143
23190
  var import_node_crypto = require("crypto");
23144
23191
  var import_node_events15 = require("events");
23145
- var import_node_fs7 = require("fs");
23192
+ var import_node_fs8 = require("fs");
23146
23193
  var import_promises22 = require("fs/promises");
23147
- var import_node_path7 = require("path");
23194
+ var import_node_path8 = require("path");
23148
23195
 
23149
23196
  // src/state-dir.ts
23150
23197
  var import_promises20 = require("fs/promises");
23151
- var import_node_path6 = require("path");
23198
+ var import_node_path7 = require("path");
23152
23199
  async function resolveWritableStateDir(want = DEFAULT_STATE_DIR, logDir = DEFAULT_LOG_DIR, ensureSubdir = "tasks", onNotice) {
23153
23200
  try {
23154
- await (0, import_promises20.mkdir)((0, import_node_path6.join)(want, ensureSubdir), { recursive: true });
23201
+ await (0, import_promises20.mkdir)((0, import_node_path7.join)(want, ensureSubdir), { recursive: true });
23155
23202
  return want;
23156
23203
  } catch {
23157
- const fallback = (0, import_node_path6.join)(logDir, "state");
23204
+ const fallback = (0, import_node_path7.join)(logDir, "state");
23158
23205
  try {
23159
- await (0, import_promises20.mkdir)((0, import_node_path6.join)(fallback, ensureSubdir), { recursive: true });
23206
+ await (0, import_promises20.mkdir)((0, import_node_path7.join)(fallback, ensureSubdir), { recursive: true });
23160
23207
  onNotice?.(`${want} not writable, using ${fallback}`);
23161
23208
  return fallback;
23162
23209
  } catch {
@@ -23415,7 +23462,7 @@ var Ring = class {
23415
23462
  };
23416
23463
  function resolveCwd(unitCwd, baseCwd) {
23417
23464
  if (!unitCwd) return baseCwd;
23418
- return unitCwd.startsWith("/") ? unitCwd : (0, import_node_path7.join)(baseCwd, unitCwd);
23465
+ return unitCwd.startsWith("/") ? unitCwd : (0, import_node_path8.join)(baseCwd, unitCwd);
23419
23466
  }
23420
23467
  function spawnArgs(cmd) {
23421
23468
  if (typeof cmd === "string") return { bin: "bash", args: ["-c", cmd] };
@@ -23537,7 +23584,7 @@ var ServiceRunner = class extends import_node_events15.EventEmitter {
23537
23584
  const spec = this.spec;
23538
23585
  const cwd = resolveCwd(spec.cwd, this.opts.cwd);
23539
23586
  if (!this.logStream) {
23540
- this.logStream = (0, import_node_fs7.createWriteStream)((0, import_node_path7.join)(this.opts.logDir, `${spec.name}.log`), {
23587
+ this.logStream = (0, import_node_fs8.createWriteStream)((0, import_node_path8.join)(this.opts.logDir, `${spec.name}.log`), {
23541
23588
  flags: "a"
23542
23589
  });
23543
23590
  this.logStream.on("error", (err) => {
@@ -23741,7 +23788,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
23741
23788
  }
23742
23789
  ensureLogStream() {
23743
23790
  if (this.logStream) return;
23744
- this.logStream = (0, import_node_fs7.createWriteStream)((0, import_node_path7.join)(this.opts.logDir, `${this.spec.name}.log`), {
23791
+ this.logStream = (0, import_node_fs8.createWriteStream)((0, import_node_path8.join)(this.opts.logDir, `${this.spec.name}.log`), {
23745
23792
  flags: "a"
23746
23793
  });
23747
23794
  this.logStream.on("error", (err) => {
@@ -23754,7 +23801,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
23754
23801
  return (0, import_node_crypto.createHash)("sha256").update(payload).digest("hex");
23755
23802
  }
23756
23803
  markerPath() {
23757
- return (0, import_node_path7.join)(this.opts.stateDir, "tasks", this.spec.name);
23804
+ return (0, import_node_path8.join)(this.opts.stateDir, "tasks", this.spec.name);
23758
23805
  }
23759
23806
  /** Run the `run_once.check` probe. Resolves true when it exits 0. */
23760
23807
  runCheck(command, cwd) {
@@ -23802,7 +23849,7 @@ var TaskRunner = class extends import_node_events15.EventEmitter {
23802
23849
  async writeMarker(cwd) {
23803
23850
  const marker = this.markerPath();
23804
23851
  try {
23805
- await (0, import_promises22.mkdir)((0, import_node_path7.join)(this.opts.stateDir, "tasks"), { recursive: true });
23852
+ await (0, import_promises22.mkdir)((0, import_node_path8.join)(this.opts.stateDir, "tasks"), { recursive: true });
23806
23853
  await (0, import_promises22.writeFile)(marker, `${this.commandHash(cwd)}
23807
23854
  `, "utf8");
23808
23855
  } catch (err) {
@@ -24330,7 +24377,7 @@ function normalizeTask(t) {
24330
24377
  };
24331
24378
  }
24332
24379
  async function readLogFile(logDir, service, tail) {
24333
- const path6 = (0, import_node_path7.join)(logDir, `${service}.log`);
24380
+ const path6 = (0, import_node_path8.join)(logDir, `${service}.log`);
24334
24381
  let text;
24335
24382
  try {
24336
24383
  text = await (0, import_promises22.readFile)(path6, "utf8");
@@ -24352,14 +24399,14 @@ async function readLogFile(logDir, service, tail) {
24352
24399
  // src/socket.ts
24353
24400
  var import_node_net4 = require("net");
24354
24401
  var import_promises23 = require("fs/promises");
24355
- var import_node_path8 = require("path");
24402
+ var import_node_path9 = require("path");
24356
24403
 
24357
24404
  // src/status-reporter.ts
24358
24405
  var import_node_child_process11 = require("child_process");
24359
24406
 
24360
24407
  // src/tmux.ts
24361
24408
  var import_node_child_process10 = require("child_process");
24362
- var import_node_os4 = require("os");
24409
+ var import_node_os5 = require("os");
24363
24410
  var MAX_TITLE_LEN = 120;
24364
24411
  function sanitizePaneTitle(raw, ctx) {
24365
24412
  const t = raw.trim();
@@ -24404,7 +24451,7 @@ async function probeAgentSession(sessionName) {
24404
24451
  sessionName,
24405
24452
  "#{pane_title}"
24406
24453
  ]);
24407
- const title = pt.exitCode === 0 ? sanitizePaneTitle(pt.stdout, { hostname: (0, import_node_os4.hostname)(), sessionName }) : null;
24454
+ const title = pt.exitCode === 0 ? sanitizePaneTitle(pt.stdout, { hostname: (0, import_node_os5.hostname)(), sessionName }) : null;
24408
24455
  return { running: true, sessionName, startedAt, title };
24409
24456
  }
24410
24457
 
@@ -24420,6 +24467,11 @@ var StatusReporter = class {
24420
24467
  claudeUpdatedAt = null;
24421
24468
  claudePlan;
24422
24469
  claudeQuestion;
24470
+ codexMarked = false;
24471
+ // Last-seen tmux liveness per agent, for the running→stopped edge that clears
24472
+ // the session pointer/marker (see snapshot()).
24473
+ lastClaudeRunning = false;
24474
+ lastCodexRunning = false;
24423
24475
  codexState = "unknown";
24424
24476
  codexUpdatedAt = null;
24425
24477
  opencodeState = "unknown";
@@ -24489,6 +24541,10 @@ var StatusReporter = class {
24489
24541
  setCodexState(state) {
24490
24542
  this.codexState = state;
24491
24543
  this.codexUpdatedAt = (/* @__PURE__ */ new Date()).toISOString();
24544
+ if (!this.codexMarked) {
24545
+ this.codexMarked = true;
24546
+ markCodexActive();
24547
+ }
24492
24548
  this.schedulePush();
24493
24549
  }
24494
24550
  setOpencodeState(state) {
@@ -24536,6 +24592,10 @@ var StatusReporter = class {
24536
24592
  const claudeSession2 = await probeAgentSession(this.sessionName);
24537
24593
  const codexSession = await probeAgentSession(DEFAULT_CODEX_SESSION_NAME);
24538
24594
  const opencodeSession = await probeAgentSession(DEFAULT_OPENCODE_SESSION_NAME);
24595
+ if (this.lastClaudeRunning && !claudeSession2.running) clearClaudeSessionPointer();
24596
+ if (this.lastCodexRunning && !codexSession.running) clearCodexMarker();
24597
+ this.lastClaudeRunning = claudeSession2.running;
24598
+ this.lastCodexRunning = codexSession.running;
24539
24599
  const status2 = {
24540
24600
  schema: BOX_STATUS_SCHEMA,
24541
24601
  boxId: this.boxId,
@@ -24614,7 +24674,7 @@ async function discoverListeningPorts() {
24614
24674
 
24615
24675
  // src/socket.ts
24616
24676
  async function startServer(opts) {
24617
- await (0, import_promises23.mkdir)((0, import_node_path8.dirname)(opts.socketPath), { recursive: true });
24677
+ await (0, import_promises23.mkdir)((0, import_node_path9.dirname)(opts.socketPath), { recursive: true });
24618
24678
  await (0, import_promises23.unlink)(opts.socketPath).catch(() => {
24619
24679
  });
24620
24680
  const server = (0, import_node_net4.createServer)((sock) => {
@@ -25387,7 +25447,7 @@ var import_promises25 = require("fs/promises");
25387
25447
  // src/secret.ts
25388
25448
  var import_node_crypto2 = require("crypto");
25389
25449
  var import_promises24 = require("fs/promises");
25390
- var import_node_path9 = require("path");
25450
+ var import_node_path10 = require("path");
25391
25451
  var SECRET_RE = /\{\{\s*AGENTBOX_AUTO_SECRET(?::([A-Za-z0-9_-]+))?\s*\}\}/g;
25392
25452
  var SECRET_BYTES = 32;
25393
25453
  function generateSecret() {
@@ -25406,7 +25466,7 @@ async function resolveAutoSecrets(content, opts = {}) {
25406
25466
  "secrets",
25407
25467
  (msg) => opts.onLog?.(msg)
25408
25468
  );
25409
- const dir = (0, import_node_path9.join)(base, "secrets");
25469
+ const dir = (0, import_node_path10.join)(base, "secrets");
25410
25470
  for (const name of names) named.set(name, await loadOrCreateSecret(dir, name, opts.onLog));
25411
25471
  }
25412
25472
  return content.replace(
@@ -25415,7 +25475,7 @@ async function resolveAutoSecrets(content, opts = {}) {
25415
25475
  );
25416
25476
  }
25417
25477
  async function loadOrCreateSecret(dir, name, onLog) {
25418
- const file = (0, import_node_path9.join)(dir, name);
25478
+ const file = (0, import_node_path10.join)(dir, name);
25419
25479
  try {
25420
25480
  const existing = (await (0, import_promises24.readFile)(file, "utf8")).trim();
25421
25481
  if (existing.length > 0) return existing;
@@ -8,8 +8,10 @@
8
8
  # Differences from the vercel installer (packages/sandbox-vercel/scripts/
9
9
  # provision.sh), which this mirrors:
10
10
  # - apt-get / dpkg, not dnf (E2B base = Debian 12 bookworm).
11
- # - NO docker / dockerd / iptables — E2B microVMs can't run nested
12
- # containers (same shape as vercel).
11
+ # - docker.io + iptables ARE installed (in-box DinD): unlike the original
12
+ # assumption, E2B microVMs DO support nested containers (full root +
13
+ # cap_sys_admin + working namespaces, verified 2026-06-23). dockerd is
14
+ # launched at create/resume by agentbox-dockerd-start, not systemd.
13
15
  # - The `vscode` user is created with a free uid (E2B's `code` group holds
14
16
  # 1000 on the base template, so useradd picks the next free uid; there are
15
17
  # no bind mounts so the exact uid is irrelevant — only ownership of
@@ -17,6 +19,7 @@
17
19
  #
18
20
  # Required inputs (uploaded via Template.copy before this runs):
19
21
  # /tmp/agentbox-ctl -- prebuilt @agentbox/ctl bundle (cjs)
22
+ # /tmp/agentbox-dockerd-start -- in-box dockerd launch helper (DinD)
20
23
  # /tmp/agentbox-vnc-start -- VNC startup helper
21
24
  # /tmp/agentbox-checkpoint-cleanup -- pre-snapshot cleanup helper
22
25
  # /tmp/agentbox-open -- in-box xdg-open shim
@@ -89,6 +92,19 @@ chmod 0440 /etc/sudoers.d/90-agentbox-vscode
89
92
  visudo -cf /etc/sudoers >/dev/null
90
93
  done_ "vscode user + sudoers"
91
94
 
95
+ step "docker engine (in-box DinD)"
96
+ # E2B microVMs support nested containers (full root + cap_sys_admin), so bake
97
+ # the docker engine like the vercel/hetzner/docker providers. dockerd is NOT
98
+ # started by systemd here — agentbox-dockerd-start launches it at create/resume
99
+ # (it picks the storage driver at runtime; overlay2 works on E2B). docker.io
100
+ # pulls containerd + runc + the cli; iptables is needed for bridge networking.
101
+ # Must run AFTER the vscode user exists (usermod -aG docker vscode below).
102
+ apt-get install -y -q --no-install-recommends docker.io iptables
103
+ groupadd -f docker
104
+ usermod -aG docker vscode
105
+ systemctl disable --now docker.service docker.socket 2>/dev/null || true
106
+ done_ "docker engine (in-box DinD)"
107
+
92
108
  step "agentbox base dirs + /workspace ownership"
93
109
  mkdir -p /workspace /run/agentbox /var/log/agentbox /var/lib/agentbox /etc/agentbox /etc/claude-code \
94
110
  /usr/local/share/agentbox
@@ -120,7 +136,8 @@ step "agentbox-ctl install"
120
136
  install -m 0755 /tmp/agentbox-ctl /usr/local/bin/agentbox-ctl
121
137
  done_ "agentbox-ctl install"
122
138
 
123
- step "baked helper scripts (vnc / cleanup / xdg-open)"
139
+ step "baked helper scripts (dockerd / vnc / cleanup / xdg-open)"
140
+ install -m 0755 /tmp/agentbox-dockerd-start /usr/local/bin/agentbox-dockerd-start
124
141
  install -m 0755 /tmp/agentbox-vnc-start /usr/local/bin/agentbox-vnc-start
125
142
  install -m 0755 /tmp/agentbox-checkpoint-cleanup /usr/local/bin/agentbox-checkpoint-cleanup
126
143
  install -m 0755 /tmp/agentbox-open /usr/local/bin/agentbox-open
@@ -129,7 +146,7 @@ ln -sf /usr/local/bin/agentbox-open /usr/local/bin/xdg-open
129
146
  # Installing them here would put the relay-routing `git` on PATH ahead of
130
147
  # /usr/bin/git and route this script's own remaining git/clone commands through
131
148
  # a relay that doesn't exist during the bake.
132
- done_ "baked helper scripts (vnc / cleanup / xdg-open)"
149
+ done_ "baked helper scripts (dockerd / vnc / cleanup / xdg-open)"
133
150
 
134
151
  step "baked config files (claude / codex / setup guide / tmux.conf)"
135
152
  install -m 0644 /tmp/agentbox-custom-CLAUDE.md /etc/claude-code/CLAUDE.md
@@ -289,7 +306,7 @@ install -m 0755 /tmp/agentbox-linear-shim /usr/local/bin/linear
289
306
  done_ "relay shims (gh + git + ntn + linear)"
290
307
 
291
308
  step "trim /tmp/agentbox-*"
292
- rm -f /tmp/agentbox-ctl /tmp/agentbox-vnc-start \
309
+ rm -f /tmp/agentbox-ctl /tmp/agentbox-dockerd-start /tmp/agentbox-vnc-start \
293
310
  /tmp/agentbox-checkpoint-cleanup /tmp/agentbox-open \
294
311
  /tmp/agentbox-gh-shim /tmp/agentbox-git-shim /tmp/agentbox-ntn-shim \
295
312
  /tmp/agentbox-linear-shim \
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "AgentBox enterprise-managed Claude Code settings, baked into the box image at /etc/claude-code/managed-settings.json. Highest precedence and NOT synced from the host ~/.claude, so claude-hooks-filter.ts never touches it; per Claude Code, hook arrays MERGE across settings sources, so the user's own hooks still run. These hooks report Claude's activity to the box supervisor (agentbox-ctl claude-state -> ctl socket -> relay -> ~/.agentbox/boxes/<id>/status.json) so `agentbox status/list/inspect` can show it even when the box is paused. Each command is exit-0 fast and shell-backgrounded so a hook can never block or fail a Claude turn. The ExitPlanMode / AskUserQuestion entries run SYNCHRONOUSLY (no &) because they consume the hook's stdin payload; the catchall PreToolUse 'working' hook races with them, but the supervisor's sticky-state semantics swallow that race (a 'working' set while in end-plan/question is ignored unless --clear-pending is set, which only the matching PostToolUse hook passes). skipDangerousModePermissionPrompt pre-accepts the bypass-permissions disclaimer at policy precedence — AgentBox boxes are isolated, and `agentbox claude` defaults to --dangerously-skip-permissions, so the one-time accept gate would just trap every fresh box.",
2
+ "$comment": "AgentBox enterprise-managed Claude Code settings, baked into the box image at /etc/claude-code/managed-settings.json. Highest precedence and NOT synced from the host ~/.claude, so claude-hooks-filter.ts never touches it; per Claude Code, hook arrays MERGE across settings sources, so the user's own hooks still run. These hooks report Claude's activity to the box supervisor (agentbox-ctl claude-state -> ctl socket -> relay -> ~/.agentbox/boxes/<id>/status.json) so `agentbox status/list/inspect` can show it even when the box is paused. Each command is exit-0 fast and shell-backgrounded so a hook can never block or fail a Claude turn. The ExitPlanMode / AskUserQuestion entries run SYNCHRONOUSLY (no &) because they consume the hook's stdin payload; the catchall PreToolUse 'working' hook races with them, but the supervisor's sticky-state semantics swallow that race (a 'working' set while in end-plan/question is ignored unless --clear-pending is set, which only the matching PostToolUse hook passes). The SessionStart / Stop entries also run SYNCHRONOUSLY (no &) with --capture-session: they read the hook's stdin session_id and record it to the box's per-box session pointer (~/.local/state/agentbox/claude-session) so a box restart can resume the exact conversation (claude --resume <id>); they fire often enough to track /new and /branch, which mint fresh session ids. (A backgrounded `&` hook would detach stdin, so capture hooks must be synchronous.) skipDangerousModePermissionPrompt pre-accepts the bypass-permissions disclaimer at policy precedence — AgentBox boxes are isolated, and `agentbox claude` defaults to --dangerously-skip-permissions, so the one-time accept gate would just trap every fresh box.",
3
3
  "skipDangerousModePermissionPrompt": true,
4
4
  "hooks": {
5
5
  "UserPromptSubmit": [
@@ -45,7 +45,7 @@
45
45
  "Stop": [
46
46
  {
47
47
  "hooks": [
48
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
48
+ { "type": "command", "command": "agentbox-ctl claude-state idle --capture-session >/dev/null 2>&1", "timeout": 3 }
49
49
  ]
50
50
  }
51
51
  ],
@@ -101,14 +101,14 @@
101
101
  "SessionStart": [
102
102
  {
103
103
  "hooks": [
104
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
104
+ { "type": "command", "command": "agentbox-ctl claude-state idle --capture-session >/dev/null 2>&1", "timeout": 3 }
105
105
  ]
106
106
  }
107
107
  ],
108
108
  "SessionEnd": [
109
109
  {
110
110
  "hooks": [
111
- { "type": "command", "command": "agentbox-ctl claude-state idle >/dev/null 2>&1 &", "timeout": 3 }
111
+ { "type": "command", "command": "agentbox-ctl claude-state idle --clear-session >/dev/null 2>&1 &", "timeout": 3 }
112
112
  ]
113
113
  }
114
114
  ]