agentreel 0.2.1 → 0.2.3
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 +10 -3
- package/package.json +1 -1
- package/scripts/browser_demo.py +5 -0
package/bin/agentreel.mjs
CHANGED
|
@@ -90,8 +90,10 @@ function ensureBrowserDeps() {
|
|
|
90
90
|
});
|
|
91
91
|
|
|
92
92
|
console.error(" Installing Chromium (one-time, ~150MB)...");
|
|
93
|
+
const browsersDir = join(venvDir, "playwright-browsers");
|
|
93
94
|
execFileSync(venvPython, ["-m", "playwright", "install", "chromium"], {
|
|
94
95
|
stdio: ["ignore", "inherit", "inherit"],
|
|
96
|
+
env: { ...process.env, PLAYWRIGHT_BROWSERS_PATH: browsersDir },
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -122,6 +124,11 @@ function extractHighlightsFromCast(castPath, context) {
|
|
|
122
124
|
|
|
123
125
|
// ── Browser Recording ───────────────────────────────────────
|
|
124
126
|
|
|
127
|
+
function browserEnv() {
|
|
128
|
+
const browsersDir = join(ROOT, "scripts", ".venv", "playwright-browsers");
|
|
129
|
+
return { ...process.env, PLAYWRIGHT_BROWSERS_PATH: browsersDir };
|
|
130
|
+
}
|
|
131
|
+
|
|
125
132
|
function recordBrowser(url, task) {
|
|
126
133
|
const python = findPython();
|
|
127
134
|
const script = join(ROOT, "scripts", "browser_demo.py");
|
|
@@ -130,8 +137,8 @@ function recordBrowser(url, task) {
|
|
|
130
137
|
console.error(`Agent demoing browser app: ${url}`);
|
|
131
138
|
execFileSync(python, [script, url, outFile, task], {
|
|
132
139
|
stdio: ["ignore", "inherit", "inherit"],
|
|
133
|
-
env:
|
|
134
|
-
timeout:
|
|
140
|
+
env: browserEnv(),
|
|
141
|
+
timeout: 300000,
|
|
135
142
|
});
|
|
136
143
|
return outFile;
|
|
137
144
|
}
|
|
@@ -143,7 +150,7 @@ function extractBrowserHighlights(videoPath, task) {
|
|
|
143
150
|
|
|
144
151
|
execFileSync(python, [script, "--highlights", videoPath, outFile, task], {
|
|
145
152
|
stdio: ["ignore", "inherit", "inherit"],
|
|
146
|
-
env:
|
|
153
|
+
env: browserEnv(),
|
|
147
154
|
});
|
|
148
155
|
return outFile;
|
|
149
156
|
}
|
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
|
|