@proagentstore/cli 0.1.23 → 0.1.25
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/browser-runner/browser-actions.js +15 -2
- package/dist/index.js +21 -15
- package/package.json +1 -1
|
@@ -177,7 +177,20 @@ export async function performBrowserAction(page, action, clickRobustly, resumeFi
|
|
|
177
177
|
case "wait":
|
|
178
178
|
await page.waitForTimeout(Math.min(5_000, action.ms ?? 1_000));
|
|
179
179
|
break;
|
|
180
|
-
default:
|
|
181
|
-
|
|
180
|
+
default: {
|
|
181
|
+
const name = String(action.action || "");
|
|
182
|
+
// The brain sometimes invents click variants (triple_click / double_click
|
|
183
|
+
// to select a field's text before retyping). Handle them generically
|
|
184
|
+
// rather than failing the whole task — clickCount selects the text.
|
|
185
|
+
if (/click/i.test(name)) {
|
|
186
|
+
const loc = locate();
|
|
187
|
+
const clickCount = /triple/i.test(name) ? 3 : /double|dbl/i.test(name) ? 2 : 1;
|
|
188
|
+
if (!(await loc.click({ clickCount, timeout: 6_000 }).then(() => true).catch(() => false))) {
|
|
189
|
+
await clickRobustly(page, loc);
|
|
190
|
+
}
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
throw new RunnerInputError(`Unsupported action "${name}". Use one of: click, type, select, check, upload, navigate, scroll, key, wait. To clear or replace a field, use "type" — it overwrites the existing value.`);
|
|
194
|
+
}
|
|
182
195
|
}
|
|
183
196
|
}
|
package/dist/index.js
CHANGED
|
@@ -1258,6 +1258,25 @@ async function waitForKey(keys) {
|
|
|
1258
1258
|
// src/commands/up.ts
|
|
1259
1259
|
var API_BASE2 = "https://api.proagentstore.online";
|
|
1260
1260
|
var CLI_VERSION = createRequire(import.meta.url)("../package.json").version;
|
|
1261
|
+
async function stopRunnerProcesses() {
|
|
1262
|
+
if (process.platform === "win32") return false;
|
|
1263
|
+
const { execSync } = await import("child_process");
|
|
1264
|
+
const patterns = [
|
|
1265
|
+
"dist/browser-runner/index.js",
|
|
1266
|
+
"browser-runner/src/index",
|
|
1267
|
+
"runner connect",
|
|
1268
|
+
"tunnel --url http://127.0.0.1"
|
|
1269
|
+
];
|
|
1270
|
+
let stopped = false;
|
|
1271
|
+
for (const p of patterns) {
|
|
1272
|
+
try {
|
|
1273
|
+
execSync(`pkill -f ${JSON.stringify(p)}`, { stdio: "ignore" });
|
|
1274
|
+
stopped = true;
|
|
1275
|
+
} catch {
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
return stopped;
|
|
1279
|
+
}
|
|
1261
1280
|
var upCommand = new Command7("up").description("Start the browser runner for all your agent instances").option("--headless", "Run browser in headless mode").option("--instance <id>", "Connect to a specific instance only").action(async (opts) => {
|
|
1262
1281
|
const session = requireSession();
|
|
1263
1282
|
const state = {
|
|
@@ -1301,6 +1320,7 @@ var upCommand = new Command7("up").description("Start the browser runner for all
|
|
|
1301
1320
|
const target = instances[0];
|
|
1302
1321
|
state.activeInstance = target.name || target.slug || target.id.slice(0, 8);
|
|
1303
1322
|
printStep(`Connecting: ${state.activeInstance}`, "wait");
|
|
1323
|
+
await stopRunnerProcesses();
|
|
1304
1324
|
const { spawn: spawn3 } = await import("child_process");
|
|
1305
1325
|
const cliPath = process.argv[1];
|
|
1306
1326
|
const args = [cliPath, "runner", "connect", target.id];
|
|
@@ -1419,21 +1439,7 @@ var downCommand = new Command7("down").description("Stop the browser runner and
|
|
|
1419
1439
|
writeLine("");
|
|
1420
1440
|
return;
|
|
1421
1441
|
}
|
|
1422
|
-
const
|
|
1423
|
-
const patterns = [
|
|
1424
|
-
"dist/browser-runner/index.js",
|
|
1425
|
-
"browser-runner/src/index",
|
|
1426
|
-
"runner connect",
|
|
1427
|
-
"tunnel --url http://127.0.0.1"
|
|
1428
|
-
];
|
|
1429
|
-
let stopped = false;
|
|
1430
|
-
for (const p of patterns) {
|
|
1431
|
-
try {
|
|
1432
|
-
execSync(`pkill -f ${JSON.stringify(p)}`, { stdio: "ignore" });
|
|
1433
|
-
stopped = true;
|
|
1434
|
-
} catch {
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1442
|
+
const stopped = await stopRunnerProcesses();
|
|
1437
1443
|
if (stopped) {
|
|
1438
1444
|
writeLine(" \u2713 Runner stopped \u2014 you're disconnected.");
|
|
1439
1445
|
writeLine("");
|