@proagentstore/cli 0.4.4 → 0.4.5
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.
|
@@ -594,6 +594,11 @@ export class LocalRunner {
|
|
|
594
594
|
const initial = this.browserContext.pages()[0];
|
|
595
595
|
if (initial)
|
|
596
596
|
this.trackPage(initial);
|
|
597
|
+
// A seeded real profile can restore MANY tabs on launch; keep a single clean
|
|
598
|
+
// workspace tab so the agent's page is unambiguous and visible (not lost among
|
|
599
|
+
// restored blank tabs — the "why is the window blank?" symptom).
|
|
600
|
+
await this.closeStalePages().catch(() => undefined);
|
|
601
|
+
await this.activePage?.bringToFront().catch(() => undefined);
|
|
597
602
|
return this.browserContext;
|
|
598
603
|
}
|
|
599
604
|
/** Mark a page as the active one; fall back to the newest remaining page when it closes. */
|
|
@@ -623,11 +628,15 @@ export class LocalRunner {
|
|
|
623
628
|
/** The page the brain drives and the human takes over — created on demand. */
|
|
624
629
|
async getActivePage() {
|
|
625
630
|
const context = await this.getBrowserContext();
|
|
626
|
-
if (this.activePage
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
+
if (!this.activePage || this.activePage.isClosed()) {
|
|
632
|
+
this.activePage = context.pages().at(-1) ?? (await context.newPage());
|
|
633
|
+
}
|
|
634
|
+
// Keep the agent's working tab in the FOREGROUND so the user actually SEES what
|
|
635
|
+
// the agent is doing (and can act on it during a takeover). Without this, on a
|
|
636
|
+
// real Chrome profile that restores several tabs, the agent may drive a
|
|
637
|
+
// background tab while the user stares at a blank foreground tab.
|
|
638
|
+
await this.activePage.bringToFront().catch(() => undefined);
|
|
639
|
+
return this.activePage;
|
|
631
640
|
}
|
|
632
641
|
/** The CDP endpoint of the launched Chrome (from DevToolsActivePort in its profile). */
|
|
633
642
|
async readCdpEndpoint() {
|