agentreel 0.2.0 → 0.2.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.
- package/bin/agentreel.mjs +35 -0
- package/package.json +1 -1
package/bin/agentreel.mjs
CHANGED
|
@@ -61,6 +61,40 @@ function findPython() {
|
|
|
61
61
|
return "python3";
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
function ensureBrowserDeps() {
|
|
65
|
+
const venvDir = join(ROOT, "scripts", ".venv");
|
|
66
|
+
const venvPython = join(venvDir, "bin", "python");
|
|
67
|
+
|
|
68
|
+
if (existsSync(venvPython)) {
|
|
69
|
+
// Check if playwright is installed
|
|
70
|
+
try {
|
|
71
|
+
execFileSync(venvPython, ["-c", "import playwright"], {
|
|
72
|
+
stdio: "ignore",
|
|
73
|
+
});
|
|
74
|
+
return; // all good
|
|
75
|
+
} catch {
|
|
76
|
+
// playwright missing, install below
|
|
77
|
+
}
|
|
78
|
+
} else {
|
|
79
|
+
// Create venv
|
|
80
|
+
console.error(" Setting up Python environment...");
|
|
81
|
+
execFileSync("python3", ["-m", "venv", venvDir], {
|
|
82
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const pip = join(venvDir, "bin", "pip");
|
|
87
|
+
console.error(" Installing playwright...");
|
|
88
|
+
execFileSync(pip, ["install", "-q", "playwright"], {
|
|
89
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
console.error(" Installing Chromium (one-time, ~150MB)...");
|
|
93
|
+
execFileSync(venvPython, ["-m", "playwright", "install", "chromium"], {
|
|
94
|
+
stdio: ["ignore", "inherit", "inherit"],
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
|
|
64
98
|
function recordCLI(command, workDir, context) {
|
|
65
99
|
const python = findPython();
|
|
66
100
|
const script = join(ROOT, "scripts", "cli_demo.py");
|
|
@@ -263,6 +297,7 @@ async function main() {
|
|
|
263
297
|
if (demoURL) {
|
|
264
298
|
const task = prompt || "Explore the main features of this app";
|
|
265
299
|
|
|
300
|
+
ensureBrowserDeps();
|
|
266
301
|
console.error("Step 1/3: Recording browser demo...");
|
|
267
302
|
const videoPath = recordBrowser(demoURL, task);
|
|
268
303
|
|