@proagentstore/cli 0.4.6 → 0.4.8
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.
|
@@ -693,7 +693,9 @@ export class LocalRunner {
|
|
|
693
693
|
* so the cloud can store it per step and the whole run can be replayed visually. */
|
|
694
694
|
async shot(page) {
|
|
695
695
|
try {
|
|
696
|
-
|
|
696
|
+
// scale:"css" avoids 2× retina bloat; a short timeout means a stuck page
|
|
697
|
+
// never delays the action (the screenshot is best-effort, not the point).
|
|
698
|
+
const buf = await page.screenshot({ type: "jpeg", quality: 45, scale: "css", timeout: 8_000 });
|
|
697
699
|
return buf.toString("base64");
|
|
698
700
|
}
|
|
699
701
|
catch {
|
|
@@ -759,13 +761,24 @@ export class LocalRunner {
|
|
|
759
761
|
case "check":
|
|
760
762
|
return mcp.callTool("browser_click", { element: label, target: this.refOf(a) });
|
|
761
763
|
case "upload": {
|
|
762
|
-
// Standard two-step: clicking the upload control opens the file chooser,
|
|
763
|
-
// which puts the @playwright/mcp server into its file-chooser modal state;
|
|
764
|
-
// browser_file_upload then resolves that state with the résumé path.
|
|
765
|
-
await mcp.callTool("browser_click", { element: label, target: this.refOf(a) });
|
|
766
764
|
if (!this.applyResumePath)
|
|
767
765
|
throw new RunnerInputError("no résumé file available to upload");
|
|
768
|
-
|
|
766
|
+
// Standard two-step FIRST (respects the brain's target): clicking the upload
|
|
767
|
+
// control opens the file chooser → browser_file_upload attaches the résumé.
|
|
768
|
+
const ref = (a.ref || "").trim();
|
|
769
|
+
if (ref)
|
|
770
|
+
await mcp.callTool("browser_click", { element: label, target: ref }).catch(() => undefined);
|
|
771
|
+
const res = await mcp.callTool("browser_file_upload", { paths: [this.applyResumePath] });
|
|
772
|
+
if (!res.isError || !/modal state|file chooser/i.test(mcp.textOf(res)))
|
|
773
|
+
return res;
|
|
774
|
+
// The target was a LABEL / DROP-ZONE, not the chooser trigger, so no file
|
|
775
|
+
// chooser opened. Fall back to setting the résumé directly on the page's
|
|
776
|
+
// file input — robust across hidden inputs, drop-zones and custom upload
|
|
777
|
+
// widgets (the semantically-correct upload field the brain clicks is often
|
|
778
|
+
// a container, not the button that fires the chooser).
|
|
779
|
+
const page = await this.getActivePage();
|
|
780
|
+
await page.locator('input[type="file"]').first().setInputFiles(this.applyResumePath, { timeout: 8_000 });
|
|
781
|
+
return { content: [{ type: "text", text: "résumé attached directly to the file input" }] };
|
|
769
782
|
}
|
|
770
783
|
case "select":
|
|
771
784
|
return mcp.callTool("browser_select_option", { element: label, target: this.refOf(a), values: [a.text ?? ""] });
|