agentreel 0.2.2 → 0.2.4
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 +3 -4
- package/package.json +1 -1
- package/scripts/browser_demo.py +5 -0
package/bin/agentreel.mjs
CHANGED
|
@@ -64,9 +64,9 @@ function findPython() {
|
|
|
64
64
|
function ensureBrowserDeps() {
|
|
65
65
|
const venvDir = join(ROOT, "scripts", ".venv");
|
|
66
66
|
const venvPython = join(venvDir, "bin", "python");
|
|
67
|
+
const browsersDir = join(venvDir, "playwright-browsers");
|
|
67
68
|
|
|
68
69
|
if (existsSync(venvPython)) {
|
|
69
|
-
// Check if playwright is installed
|
|
70
70
|
try {
|
|
71
71
|
execFileSync(venvPython, ["-c", "import playwright"], {
|
|
72
72
|
stdio: "ignore",
|
|
@@ -76,7 +76,6 @@ function ensureBrowserDeps() {
|
|
|
76
76
|
// playwright missing, install below
|
|
77
77
|
}
|
|
78
78
|
} else {
|
|
79
|
-
// Create venv
|
|
80
79
|
console.error(" Setting up Python environment...");
|
|
81
80
|
execFileSync("python3", ["-m", "venv", venvDir], {
|
|
82
81
|
stdio: ["ignore", "inherit", "inherit"],
|
|
@@ -90,10 +89,10 @@ function ensureBrowserDeps() {
|
|
|
90
89
|
});
|
|
91
90
|
|
|
92
91
|
console.error(" Installing Chromium (one-time, ~150MB)...");
|
|
93
|
-
const browsersDir = join(venvDir, "playwright-browsers");
|
|
94
92
|
execFileSync(venvPython, ["-m", "playwright", "install", "chromium"], {
|
|
95
93
|
stdio: ["ignore", "inherit", "inherit"],
|
|
96
94
|
env: { ...process.env, PLAYWRIGHT_BROWSERS_PATH: browsersDir },
|
|
95
|
+
cwd: tmpdir(),
|
|
97
96
|
});
|
|
98
97
|
}
|
|
99
98
|
|
|
@@ -138,7 +137,7 @@ function recordBrowser(url, task) {
|
|
|
138
137
|
execFileSync(python, [script, url, outFile, task], {
|
|
139
138
|
stdio: ["ignore", "inherit", "inherit"],
|
|
140
139
|
env: browserEnv(),
|
|
141
|
-
timeout:
|
|
140
|
+
timeout: 300000,
|
|
142
141
|
});
|
|
143
142
|
return outFile;
|
|
144
143
|
}
|
package/package.json
CHANGED
package/scripts/browser_demo.py
CHANGED
|
@@ -39,6 +39,11 @@ def generate_playwright_script(url, task):
|
|
|
39
39
|
f"Navigate to the URL, wait for load, interact with key features — "
|
|
40
40
|
f"click buttons, fill forms, scroll. Take about 20 seconds total. "
|
|
41
41
|
f"Add page.wait_for_timeout(1500) between actions so the viewer can see each step. "
|
|
42
|
+
f"IMPORTANT rules for robust scripts: "
|
|
43
|
+
f"- Use timeout=5000 on every click/fill/action so failures are fast. "
|
|
44
|
+
f"- Use force=True on all click() calls to bypass overlapping labels/overlays. "
|
|
45
|
+
f"- Click visible labels and buttons, never hidden inputs (like sr-only radio buttons). "
|
|
46
|
+
f"- Wrap each action in try/except and continue on failure — the demo must finish. "
|
|
42
47
|
f"Return ONLY the Python function code, no imports, no markdown fences."
|
|
43
48
|
)
|
|
44
49
|
|