@madarco/agentbox 0.3.0 → 0.4.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.
@@ -3,8 +3,8 @@ import {
3
3
  createBox,
4
4
  defaultBoxName,
5
5
  sanitizeBasename
6
- } from "./chunk-3NCUES35.js";
7
- import "./chunk-MOC54XL6.js";
6
+ } from "./chunk-WR5FFGE5.js";
7
+ import "./chunk-NSIECUCS.js";
8
8
  import "./chunk-IDR4HVIC.js";
9
9
  import "./chunk-SOMIKEN2.js";
10
10
  export {
@@ -12,4 +12,4 @@ export {
12
12
  defaultBoxName,
13
13
  sanitizeBasename
14
14
  };
15
- //# sourceMappingURL=create-SE6H4B5U-IWAZHJHV.js.map
15
+ //# sourceMappingURL=create-4BQY2UYU-CGSW3RGE.js.map
package/dist/index.js CHANGED
@@ -1,11 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  createBox
4
- } from "./chunk-3NCUES35.js";
4
+ } from "./chunk-WR5FFGE5.js";
5
5
  import {
6
6
  AmbiguousBoxError,
7
7
  BoxNotFoundError,
8
8
  destroyBox,
9
+ getBoxEndpoints,
9
10
  getBoxHostPaths,
10
11
  inspectBox,
11
12
  listBoxes,
@@ -15,7 +16,7 @@ import {
15
16
  startBox,
16
17
  stopBox,
17
18
  unpauseBox
18
- } from "./chunk-7NQFIBQG.js";
19
+ } from "./chunk-FQD6ZWYW.js";
19
20
  import {
20
21
  ClaudeSessionError,
21
22
  SHARED_CLAUDE_VOLUME,
@@ -37,7 +38,7 @@ import {
37
38
  resolveClaudeVolume,
38
39
  startClaudeSession,
39
40
  stopRelay
40
- } from "./chunk-MOC54XL6.js";
41
+ } from "./chunk-NSIECUCS.js";
41
42
  import {
42
43
  STATE_DIR,
43
44
  readState,
@@ -66,6 +67,7 @@ import {
66
67
  lookupKey,
67
68
  pruneOrphanProjectConfigs,
68
69
  pullToHost,
70
+ readBoxStatus,
69
71
  refreshExport,
70
72
  removeCheckpoint,
71
73
  removeImage,
@@ -651,7 +653,7 @@ var claudeCommand = new Command2("claude").description("Create a sandboxed box a
651
653
  log5.warn(`plugin install failed for ${f.dir}; claude may still load it. stderr:
652
654
  ${f.stderr.trim()}`);
653
655
  }
654
- outro("attaching \u2014 Ctrl-b d to detach, leaves claude running");
656
+ outro("attaching \u2014 Control+a q to detach, leaves claude running");
655
657
  attachClaudeSession(result.record.container, sessionName, reattachRef(result.record));
656
658
  } catch (err) {
657
659
  s.stop("failed");
@@ -677,7 +679,7 @@ async function startOrAttachClaude(box, claudeArgs, opts) {
677
679
  }
678
680
  const existing = await claudeSessionInfo(box.container, sessionName);
679
681
  if (existing.running) {
680
- outro(`session "${sessionName}" already running \u2014 attaching (Ctrl-b d to detach)`);
682
+ outro(`session "${sessionName}" already running \u2014 attaching (Control+a q to detach)`);
681
683
  attachClaudeSession(box.container, sessionName, reattachRef(box));
682
684
  return;
683
685
  }
@@ -720,7 +722,7 @@ async function startOrAttachClaude(box, claudeArgs, opts) {
720
722
  log5.warn(`plugin install failed for ${f.dir}; claude may still load it. stderr:
721
723
  ${f.stderr.trim()}`);
722
724
  }
723
- outro("attaching \u2014 Ctrl-b d to detach, leaves claude running");
725
+ outro("attaching \u2014 Control+a q to detach, leaves claude running");
724
726
  attachClaudeSession(box.container, sessionName, reattachRef(box));
725
727
  }
726
728
  var claudeAttachCommand = new Command2("attach").description(
@@ -2886,23 +2888,35 @@ var dashboardCommand = new Command7("dashboard").description("Box list + the sel
2886
2888
  const ep = box.endpoints.endpoints.find((e) => e.kind === kind);
2887
2889
  return { name: box.name, url: ep && ep.reachable && ep.url ? ep.url : null };
2888
2890
  };
2891
+ const webTarget = (box) => {
2892
+ const ep = box.endpoints.endpoints.find((e) => e.kind === "web");
2893
+ const exposed = Boolean(ep && ep.reachable && ep.url);
2894
+ const url = box.endpoints.domainIsOrb ? `http://${box.endpoints.domain}` : exposed && ep?.url ? ep.url : `http://${box.endpoints.domain}`;
2895
+ return { url, exposed };
2896
+ };
2889
2897
  const openVnc = async (boxId) => {
2890
2898
  const { url } = await findEndpointUrl(boxId, "vnc");
2891
2899
  if (!url) return "VNC not available for this box";
2900
+ let exposedWebUrl = null;
2892
2901
  try {
2893
2902
  const box = await findBox2(boxId);
2903
+ const web = webTarget(box);
2904
+ if (web.exposed) exposedWebUrl = web.url;
2894
2905
  const br = await ensureBoxBrowser(box.container);
2895
2906
  if (!br.up) return `VNC: in-box browser unavailable (${br.reason ?? "box not running?"})`;
2896
2907
  } catch {
2897
2908
  }
2898
2909
  detach("open", [url]);
2910
+ if (exposedWebUrl) {
2911
+ detach("open", [exposedWebUrl]);
2912
+ return "Opening VNC + web in browser\u2026";
2913
+ }
2899
2914
  return "Opening VNC in browser\u2026";
2900
2915
  };
2901
2916
  const openWeb = async (boxId) => {
2902
2917
  const box = (await listBoxes()).find((b) => b.id === boxId);
2903
2918
  if (!box) return "box not found";
2904
- const ep = box.endpoints.endpoints.find((e) => e.kind === "web");
2905
- const url = ep && ep.reachable && ep.url ? ep.url : `http://${box.endpoints.domain}`;
2919
+ const { url } = webTarget(box);
2906
2920
  detach("open", [url]);
2907
2921
  return `Opening ${url.replace(/^https?:\/\//, "")}\u2026`;
2908
2922
  };
@@ -3735,6 +3749,21 @@ var screenCommand = new Command18("screen").description("Open a box's VNC (noVNC
3735
3749
  }
3736
3750
  process.stdout.write(`opened ${url}
3737
3751
  `);
3752
+ try {
3753
+ const { record } = await getBoxHostPaths(box.id);
3754
+ const persisted = await readBoxStatus(box.id);
3755
+ const eps = await getBoxEndpoints(record, engine, persisted);
3756
+ const webEp = eps.endpoints.find((e) => e.kind === "web");
3757
+ if (webEp?.reachable && webEp.url) {
3758
+ const webUrl = engine === "orbstack" && !opts.loopback ? `http://${record.container}.orb.local` : webEp.url;
3759
+ const w = spawnSync5("open", [webUrl], { stdio: "inherit" });
3760
+ if (w.status === 0) process.stdout.write(`also opened ${webUrl}
3761
+ `);
3762
+ else log19.warn(`could not open web app (${webUrl})`);
3763
+ }
3764
+ } catch (e) {
3765
+ log19.warn(`could not open web app: ${e instanceof Error ? e.message : String(e)}`);
3766
+ }
3738
3767
  } catch (err) {
3739
3768
  handleLifecycleError(err);
3740
3769
  }