@madarco/agentbox 0.3.0 → 0.4.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.
- package/dist/{chunk-7NQFIBQG.js → chunk-3JKQNOXP.js} +2 -1
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/dist/{lifecycle-YTMZYKOE-R4M3OR27.js → lifecycle-YTMZYKOE-TD5S5FTS.js} +2 -2
- package/package.json +1 -1
- package/runtime/docker/Dockerfile.box +1 -0
- /package/dist/{chunk-7NQFIBQG.js.map → chunk-3JKQNOXP.js.map} +0 -0
- /package/dist/{lifecycle-YTMZYKOE-R4M3OR27.js.map → lifecycle-YTMZYKOE-TD5S5FTS.js.map} +0 -0
|
@@ -504,6 +504,7 @@ async function snapshotPresent(path) {
|
|
|
504
504
|
}
|
|
505
505
|
|
|
506
506
|
export {
|
|
507
|
+
getBoxEndpoints,
|
|
507
508
|
listBoxes,
|
|
508
509
|
BoxNotFoundError,
|
|
509
510
|
AmbiguousBoxError,
|
|
@@ -518,4 +519,4 @@ export {
|
|
|
518
519
|
pruneBoxes,
|
|
519
520
|
snapshotPresent
|
|
520
521
|
};
|
|
521
|
-
//# sourceMappingURL=chunk-
|
|
522
|
+
//# sourceMappingURL=chunk-3JKQNOXP.js.map
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ 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-
|
|
19
|
+
} from "./chunk-3JKQNOXP.js";
|
|
19
20
|
import {
|
|
20
21
|
ClaudeSessionError,
|
|
21
22
|
SHARED_CLAUDE_VOLUME,
|
|
@@ -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,
|
|
@@ -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
|
|
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
|
}
|