@proagentstore/cli 0.4.5 → 0.4.7
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.
|
@@ -689,6 +689,19 @@ export class LocalRunner {
|
|
|
689
689
|
const head = (cut >= 0 ? text.slice(0, cut) : text).replace(/```[a-z]*\n?|```/g, " ").replace(/\s+/g, " ").trim();
|
|
690
690
|
return head.slice(0, 400);
|
|
691
691
|
}
|
|
692
|
+
/** A small JPEG screenshot (base64, no data: prefix) of the page — one per action,
|
|
693
|
+
* so the cloud can store it per step and the whole run can be replayed visually. */
|
|
694
|
+
async shot(page) {
|
|
695
|
+
try {
|
|
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 });
|
|
699
|
+
return buf.toString("base64");
|
|
700
|
+
}
|
|
701
|
+
catch {
|
|
702
|
+
return undefined;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
692
705
|
/**
|
|
693
706
|
* After a WRITE action, read the field's REAL value back via the standard
|
|
694
707
|
* browser_evaluate tool (evaluates on the element by ref — no reinvented DOM
|
|
@@ -832,6 +845,7 @@ export class LocalRunner {
|
|
|
832
845
|
url: active.url(),
|
|
833
846
|
title: await active.title().catch(() => ""),
|
|
834
847
|
challenge: await detectHumanChallenge(active),
|
|
848
|
+
screenshot: await this.shot(active),
|
|
835
849
|
};
|
|
836
850
|
}
|
|
837
851
|
const mcp = await this.getMcp();
|
|
@@ -855,6 +869,7 @@ export class LocalRunner {
|
|
|
855
869
|
title: await settled.title().catch(() => ""),
|
|
856
870
|
challenge: await detectHumanChallenge(settled),
|
|
857
871
|
feedback: dialogMsg ? `a native dialog was accepted: "${dialogMsg}"` : "a native dialog was accepted",
|
|
872
|
+
screenshot: await this.shot(settled),
|
|
858
873
|
};
|
|
859
874
|
}
|
|
860
875
|
if (res.isError)
|
|
@@ -887,6 +902,7 @@ export class LocalRunner {
|
|
|
887
902
|
title: await active.title().catch(() => ""),
|
|
888
903
|
challenge: await detectHumanChallenge(active),
|
|
889
904
|
feedback: feedback || undefined,
|
|
905
|
+
screenshot: await this.shot(active),
|
|
890
906
|
};
|
|
891
907
|
}
|
|
892
908
|
// ── Agent-driven application lifecycle (called by the remote Workflow brain) ──
|