@blackbelt-technology/pi-dashboard-extension 0.8.0 → 0.10.0
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/.pi/skills/browser/SKILL.md +74 -28
- package/.pi/skills/browser/UPSTREAM.md +6 -3
- package/.pi/skills/browser/references/challenge.md +183 -0
- package/.pi/skills/browser/references/dashboard-relay.md +351 -0
- package/.pi/skills/browser/references/own-browser.agent.md +73 -0
- package/.pi/skills/browser/references/own-browser.md +7 -1
- package/.pi/skills/doctor/SKILL.md +1 -0
- package/.pi/skills/doctor/_lib/checks.ts +133 -0
- package/.pi/skills/doctor/_lib/derive-tokens.ts +4 -0
- package/.pi/skills/doctor/modules/apple-tools.md +2 -1
- package/.pi/skills/doctor/modules/mcp-builtin.knowledge.hash +1 -0
- package/.pi/skills/doctor/modules/mcp-builtin.md +61 -0
- package/.pi/skills/doctor/modules/pi-resolution.knowledge.hash +1 -1
- package/.pi/skills/doctor/modules/plugins-bridges.md +14 -1
- package/.pi/skills/pi-dashboard/SKILL.md +10 -3
- package/.pi/skills/pi-dashboard/references/api-reference.md +56 -0
- package/.pi/skills/pi-dashboard/scripts/dashboard-bus.ts +4 -4
- package/.pi/skills/project-init/SKILL.agent.md +70 -0
- package/.pi/skills/project-init/SKILL.md +175 -50
- package/.pi/skills/project-init/profiles/coding/AGENTS.md.tmpl +0 -23
- package/package.json +19 -16
- package/src/ask-user-tool.ts +69 -3
- package/src/auto-session-namer.ts +190 -50
- package/src/bridge-activation.ts +26 -0
- package/src/bridge-context.ts +21 -19
- package/src/bridge-default-model-gate.ts +38 -0
- package/src/bridge-handlers/dispatch.ts +450 -0
- package/src/bridge-handlers/forwarders.ts +616 -0
- package/src/bridge-handlers/instance.ts +220 -0
- package/src/bridge-handlers/lifecycle.ts +1030 -0
- package/src/bridge-handlers/ui-prompt-patch.ts +198 -0
- package/src/bridge-identity-log.ts +45 -0
- package/src/bridge-polling.ts +148 -0
- package/src/bridge.ts +968 -2292
- package/src/canvas-tool.ts +5 -0
- package/src/command-handler.ts +257 -42
- package/src/connection.ts +737 -25
- package/src/custom-entry-forward.ts +92 -0
- package/src/dashboard-context-injector.ts +26 -47
- package/src/empty-actionable-guard.ts +8 -3
- package/src/endpoint-resolution.ts +32 -0
- package/src/event-forwarder.ts +42 -0
- package/src/extension-identity.ts +59 -0
- package/src/flow-event-wiring.ts +1 -1
- package/src/followup-buffer.ts +1 -1
- package/src/followup-drain.ts +79 -0
- package/src/git-dir-watcher.ts +79 -0
- package/src/git-poll.ts +45 -12
- package/src/git-probe-scheduler.ts +119 -0
- package/src/git-tracker.ts +284 -0
- package/src/instance-verification.ts +31 -0
- package/src/local-token-header.ts +161 -17
- package/src/mcp-token-delivery.ts +147 -0
- package/src/message-update-coalescer.ts +342 -0
- package/src/model-refresh.ts +19 -0
- package/src/model-tracker.ts +118 -35
- package/src/multiselect-list.ts +6 -2
- package/src/multiselect-polyfill.ts +2 -2
- package/src/notify-proxy.ts +3 -0
- package/src/openspec-cli-shim.ts +1 -1
- package/src/path-gate/decide.ts +123 -0
- package/src/path-gate/grant-cache.ts +73 -0
- package/src/path-gate/grant-link.ts +108 -0
- package/src/path-gate/handler.ts +356 -0
- package/src/path-gate/index.ts +166 -0
- package/src/path-gate/resolve.ts +8 -0
- package/src/path-gate/roots.ts +140 -0
- package/src/path-gate/suppression.ts +30 -0
- package/src/path-gate/yolo-link.ts +104 -0
- package/src/pending-prompt-emitter.ts +59 -0
- package/src/pi-env.d.ts +2 -10
- package/src/plugin-event-forward-registry.ts +200 -0
- package/src/plugin-request-client.ts +114 -0
- package/src/poll-cost.ts +40 -0
- package/src/pr-status.ts +338 -0
- package/src/process-metrics.ts +77 -1
- package/src/process-scan-scheduler.ts +137 -0
- package/src/process-scanner.ts +226 -247
- package/src/project-init/dox-kb-config.ts +3 -0
- package/src/project-init/scaffold.ts +1 -4
- package/src/project-init/seed-doctrine.ts +23 -60
- package/src/project-trust.ts +119 -25
- package/src/prompt-bus.ts +13 -0
- package/src/prompt-expander.ts +5 -1
- package/src/prompt-meta.ts +64 -0
- package/src/provider-register.ts +93 -20
- package/src/retry-tracker.ts +0 -7
- package/src/role-manager.ts +27 -99
- package/src/role-model-tools.ts +6 -0
- package/src/server-auto-start.ts +202 -26
- package/src/server-launcher.ts +74 -40
- package/src/session-move.ts +23 -4
- package/src/session-sync.ts +81 -52
- package/src/slash-dispatch.ts +66 -81
- package/src/spawn-token.ts +46 -0
- package/src/stream-forward-buffer.ts +161 -0
- package/src/subagent-fanout-admission.ts +234 -0
- package/src/subagent-frame-buffer.ts +6 -2
- package/src/subagent-saturation.ts +196 -0
- package/src/subagent-tick-throttle.ts +3 -1
- package/src/terminal-reload.ts +298 -0
- package/src/tui-prompt-adapter.ts +13 -1
- package/src/usage-drain.ts +167 -0
- package/src/vault-delivery.ts +394 -0
- package/src/vault-forwarder.ts +128 -0
- package/src/vault-masker.ts +165 -0
- package/src/vault-redaction.ts +181 -0
- package/src/vcs-info.ts +264 -63
- package/.pi/skills/project-init/dox-doctrine.md +0 -146
- package/src/agent-settled.ts +0 -90
- package/src/transcript-request-guard.ts +0 -76
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: browser
|
|
3
|
-
description: 'Browser automation via the `agent-browser` CLI. Use when the user needs to drive websites or Electron
|
|
3
|
+
description: 'Browser automation via the `agent-browser` CLI. Use when the user needs to drive websites or Electron apps — navigating, forms, clicks, screenshots, data extraction, testing web apps, UI checks, the dashboard Electron shell, or the user''s own logged-in Chrome via the browser relay or Panerelay (SSO/2FA). Triggers: "open a website", "take a screenshot", "test this web app", "use my own browser".'
|
|
4
4
|
license: Apache-2.0
|
|
5
|
-
allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*), Bash(npx @panerelay/setup:*)
|
|
5
|
+
allowed-tools: Bash(agent-browser:*), Bash(npx agent-browser:*), Bash(npx @panerelay/setup:*), Bash(curl:*)
|
|
6
6
|
metadata:
|
|
7
7
|
author: pi-dashboard
|
|
8
|
-
version: "1.
|
|
8
|
+
version: "1.2"
|
|
9
9
|
vendoredFrom: agent-browser
|
|
10
10
|
vendoredVersion: "0.27.0"
|
|
11
11
|
verifiedAgainstCli: "0.33.2"
|
|
@@ -25,28 +25,46 @@ Three recipes:
|
|
|
25
25
|
a worked example for the Pi Dashboard's own shell via `--debug-cdp`.
|
|
26
26
|
Reference: [`references/electron.md`](references/electron.md).
|
|
27
27
|
- **The user's own logged-in browser** — reach SSO/2FA-gated sites using the
|
|
28
|
-
user's real cookies
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
user's real cookies. Two paths:
|
|
29
|
+
- **Pi Dashboard browser** (preferred when the pi session runs on the
|
|
30
|
+
dashboard host) — `browser_connect` hands back a loopback CDP URL for the
|
|
31
|
+
dedicated profile or a Chrome profile (Playwright Chrome Extension). Reference:
|
|
32
|
+
[`references/dashboard-relay.md`](references/dashboard-relay.md).
|
|
33
|
+
- **Panerelay extension bridge** (legacy) — a native-messaging host for when
|
|
34
|
+
there is no loopback dashboard. Reference:
|
|
35
|
+
[`references/own-browser.md`](references/own-browser.md).
|
|
31
36
|
|
|
32
37
|
## Step 0a — Preflight: `agent-browser` CLI must be installed
|
|
33
38
|
|
|
34
|
-
The skill does **not** bundle the CLI.
|
|
39
|
+
The skill does **not** bundle the CLI. Verify it through the dashboard tool
|
|
40
|
+
registry — recommend-only, nothing installs without an explicit `--install`:
|
|
35
41
|
|
|
36
42
|
```bash
|
|
37
|
-
|
|
43
|
+
pi-dashboard-ensure <extension-package-root>/package.json
|
|
38
44
|
```
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
`<extension-package-root>` is the package that ships this skill — three levels
|
|
47
|
+
above this SKILL.md's `.pi/skills/browser/` directory (in a global install:
|
|
48
|
+
`$(npm root -g)/@blackbelt-technology/pi-dashboard/node_modules/@blackbelt-technology/pi-dashboard-extension`).
|
|
49
|
+
The manifest (`pi.tools`) declares `agent-browser` (resolve) and `chromium`
|
|
50
|
+
(pw-browser); the registry answers `present` / `recommended` / `blocked` per
|
|
51
|
+
tool.
|
|
52
|
+
|
|
53
|
+
- `agent-browser: present` → continue to Step 0b.
|
|
54
|
+
- `agent-browser: recommended` or `blocked` → halt and tell the user:
|
|
55
|
+
|
|
56
|
+
> The `agent-browser` CLI is not installed. Install it as a pi extension so
|
|
57
|
+
> the `browser` tool is registered in your pi session too:
|
|
58
|
+
>
|
|
59
|
+
> ```
|
|
60
|
+
> pi install npm:pi-agent-browser
|
|
61
|
+
> ```
|
|
62
|
+
>
|
|
63
|
+
> Then re-invoke the skill.
|
|
64
|
+
|
|
65
|
+
- `chromium` missing → mention the registry's Install hint
|
|
66
|
+
(`npx playwright@1.62.1 install chromium`) only when the chosen recipe needs a
|
|
67
|
+
CDP browser; the dropdown on the Settings → Tools row carries it.
|
|
50
68
|
|
|
51
69
|
Do **not** attempt `npm install`, `pi install`, or any other install command
|
|
52
70
|
on the user's behalf — they should make that choice explicitly.
|
|
@@ -62,7 +80,9 @@ else
|
|
|
62
80
|
CDP_LIVE=$(nc -z 127.0.0.1 9222 2>/dev/null && echo yes || echo no)
|
|
63
81
|
fi
|
|
64
82
|
PD_RUNNING=$(pgrep -f "Pi Dashboard|pi-dashboard" >/dev/null 2>&1 && echo yes || echo no)
|
|
65
|
-
|
|
83
|
+
# Browser relay: the dashboard's own capability probe (see dashboard-relay.md).
|
|
84
|
+
RELAY=$(curl -fsS http://localhost:8000/api/browser/status 2>/dev/null || echo unavailable)
|
|
85
|
+
echo "CDP_LIVE=$CDP_LIVE PD_RUNNING=$PD_RUNNING RELAY=$RELAY"
|
|
66
86
|
```
|
|
67
87
|
|
|
68
88
|
Routing rule:
|
|
@@ -84,16 +104,37 @@ launching any Electron app with `--remote-debugging-port`.
|
|
|
84
104
|
|
|
85
105
|
**Override (login state)**: if the target needs the user's *existing*
|
|
86
106
|
session — "use my browser", "I'm already logged in", SSO/2FA, an internal
|
|
87
|
-
tool the agent cannot sign into — route to
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
107
|
+
tool the agent cannot sign into — route to a login-state recipe regardless of
|
|
108
|
+
the probe. Pick by capability, in this order:
|
|
109
|
+
|
|
110
|
+
1. **`references/dashboard-relay.md`** when the pi session runs on the
|
|
111
|
+
dashboard host and the dashboard browser is available. This is the preferred
|
|
112
|
+
path; it needs no extra install. Call `browser_connect {}` first (it picks
|
|
113
|
+
the dedicated profile by default); without that tool, use the recipe's REST
|
|
114
|
+
fallback — the probe's `RELAY` must be a JSON object with `"enabled":true`
|
|
115
|
+
and either `dedicated.available` or `"canOpenChrome":true`. A `headless`
|
|
116
|
+
result from `browser_connect` for a login task is a stop, not a fallback.
|
|
117
|
+
2. **`references/own-browser.md`** (legacy Panerelay bridge) only when the
|
|
118
|
+
dashboard browser is unavailable (`RELAY=unavailable`, `enabled:false`) or
|
|
119
|
+
the session is remote. `browser_connect` never routes to Panerelay; this
|
|
120
|
+
step is yours.
|
|
121
|
+
|
|
122
|
+
The default bundled browser starts logged out and cannot be made to inherit
|
|
123
|
+
those logins; `--profile` copies the profile and still loses macOS
|
|
124
|
+
Keychain-encrypted cookies. Prefer the bundled browser whenever login state is
|
|
125
|
+
irrelevant — it is faster and more capable. **Never** fall back to it for a
|
|
126
|
+
login-state task.
|
|
92
127
|
|
|
93
128
|
## Step 1 — Read the matched recipe and execute
|
|
94
129
|
|
|
95
|
-
Read the reference file selected above, then follow its workflow.
|
|
96
|
-
references are self-contained; you do not need to read
|
|
130
|
+
Read the reference file selected above, then follow its workflow. All
|
|
131
|
+
references are self-contained; you do not need to read more than one.
|
|
132
|
+
|
|
133
|
+
**Challenge encountered**: if at any point the page is an interactive
|
|
134
|
+
anti-bot challenge (Cloudflare Turnstile, hCaptcha, reCAPTCHA, "Checking
|
|
135
|
+
your browser…") that withholds the content you asked for, stop and follow
|
|
136
|
+
[`references/challenge.md`](references/challenge.md). Do not retry, do not
|
|
137
|
+
switch `--session`, `--profile`, or provider, and do not run `close --all`.
|
|
97
138
|
|
|
98
139
|
## Notes
|
|
99
140
|
|
|
@@ -101,8 +142,13 @@ references are self-contained; you do not need to read both.
|
|
|
101
142
|
snapshots of upstream `agent-browser` skill content (`core` and
|
|
102
143
|
`electron`) at CLI version 0.27.0. See [`UPSTREAM.md`](UPSTREAM.md) for
|
|
103
144
|
refresh procedure and [`LICENSE`](LICENSE) for upstream attribution.
|
|
104
|
-
`references/own-browser.md`
|
|
105
|
-
|
|
145
|
+
`references/own-browser.md`, `references/dashboard-relay.md`, and
|
|
146
|
+
`references/challenge.md` are **authored, not vendored** — an upstream
|
|
147
|
+
refresh must not overwrite them.
|
|
148
|
+
- **Login-state recipes**: `references/dashboard-relay.md` is the preferred
|
|
149
|
+
path (Pi Dashboard browser relay); `references/own-browser.md` is the legacy
|
|
150
|
+
Panerelay/native-messaging path for remote sessions with no loopback
|
|
151
|
+
dashboard.
|
|
106
152
|
- **Surfaces share one browser**: the `browser` MCP tool and
|
|
107
153
|
`Bash: agent-browser …` drive the *same* daemon and *same* Chrome, with a
|
|
108
154
|
shared active page. Probing with one mid-task can silently move the page
|
|
@@ -7,8 +7,10 @@ section in `electron.md` are project-specific and not from upstream.
|
|
|
7
7
|
|
|
8
8
|
**Not vendored — do not overwrite on refresh:**
|
|
9
9
|
`references/own-browser.md` and `scripts/check-panerelay.sh` are authored
|
|
10
|
-
for this repo (the Panerelay / own-logged-in-browser recipe).
|
|
11
|
-
|
|
10
|
+
for this repo (the Panerelay / own-logged-in-browser recipe).
|
|
11
|
+
`references/challenge.md` is authored for this repo too — the pause / resume
|
|
12
|
+
discipline for interactive anti-bot challenges. None of them has an upstream
|
|
13
|
+
counterpart.
|
|
12
14
|
|
|
13
15
|
| Field | Value |
|
|
14
16
|
|------------------------|--------------------------------------------------------------------|
|
|
@@ -43,7 +45,8 @@ diff <(awk 'BEGIN{n=0} /^---$/{n++; next} n>=2{print}' /tmp/electron.md) referen
|
|
|
43
45
|
# Preserve the Pi Dashboard addenda (after the first `---` separator
|
|
44
46
|
# in web.md, and the "Worked example: Pi Dashboard" section in
|
|
45
47
|
# electron.md). Update the LICENSE file if the upstream license text
|
|
46
|
-
# has changed. Leave own-browser.md
|
|
48
|
+
# has changed. Leave own-browser.md, challenge.md and
|
|
49
|
+
# check-panerelay.sh untouched.
|
|
47
50
|
|
|
48
51
|
# 5. Re-verify the authored recipe against the new CLI, then bump
|
|
49
52
|
# `verifiedAgainstCli` in SKILL.md frontmatter:
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Interactive challenges — pause, hand off, resume
|
|
2
|
+
|
|
3
|
+
Authored for this repo, not vendored from upstream (see
|
|
4
|
+
[`UPSTREAM.md`](../UPSTREAM.md)).
|
|
5
|
+
|
|
6
|
+
An interactive anti-bot challenge is a **stop sign, not an obstacle to
|
|
7
|
+
route around**. The site is asking for a human. Your job is to hand it to
|
|
8
|
+
the user and continue on the *same* browser afterwards.
|
|
9
|
+
|
|
10
|
+
**This file takes precedence over every recipe's troubleshooting advice.**
|
|
11
|
+
`own-browser.md`'s "re-run under a fresh `--session`" row and `web.md`'s
|
|
12
|
+
`close --all` cleanup both address other problems and are *wrong* here —
|
|
13
|
+
both throw away the exact session state the site is about to trust.
|
|
14
|
+
|
|
15
|
+
## What counts as a challenge
|
|
16
|
+
|
|
17
|
+
The test is the **withheld content**: the page asks a human to prove they
|
|
18
|
+
are one *before* showing you what you asked for. Signature alone is not
|
|
19
|
+
enough — text such as "Verify you are human" on a documentation page,
|
|
20
|
+
forum post, or search result that is *still serving its content* is **not**
|
|
21
|
+
a challenge. Keep working.
|
|
22
|
+
|
|
23
|
+
A short, non-exhaustive list of signatures:
|
|
24
|
+
|
|
25
|
+
| Kind | Signature |
|
|
26
|
+
|---|---|
|
|
27
|
+
| Cloudflare Turnstile / browser check | iframe from `challenges.cloudflare.com`; text "Checking your browser" |
|
|
28
|
+
| hCaptcha | iframe from `hcaptcha.com` |
|
|
29
|
+
| reCAPTCHA | iframe from `google.com/recaptcha` |
|
|
30
|
+
| Generic interstitial | text "Verify you are human" |
|
|
31
|
+
|
|
32
|
+
Genuine churn happens upstream in these vendors' markup — treat the list as
|
|
33
|
+
a prompt for what to look for, not a detector.
|
|
34
|
+
|
|
35
|
+
**Check more than the snapshot.** A snapshot inlines iframe *content*, not
|
|
36
|
+
its host, so it can miss the vendor entirely. Use all of:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
agent-browser --session <name> get url
|
|
40
|
+
agent-browser --session <name> get title
|
|
41
|
+
agent-browser --session <name> eval '[...document.querySelectorAll("iframe")].map(f => f.src)'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
`read` and the snapshot text catch the interstitial phrasing; `get url` and
|
|
45
|
+
`get title` catch the redirect to a challenge path; the `eval` of
|
|
46
|
+
`iframe[src]` catches the vendor host. Use `Bash: agent-browser eval …`, not
|
|
47
|
+
the MCP `eval` (wrapper bug: it echoes the source instead of running it).
|
|
48
|
+
|
|
49
|
+
## Pause
|
|
50
|
+
|
|
51
|
+
Stop driving the page immediately. Do **not**:
|
|
52
|
+
|
|
53
|
+
- run `close --all` — it is not session-scoped and kills every session,
|
|
54
|
+
including unrelated ones;
|
|
55
|
+
- switch to a different `--session` name, a different `--profile`, or a
|
|
56
|
+
different provider;
|
|
57
|
+
- re-navigate to the challenged URL hoping it passes;
|
|
58
|
+
- reach for the recipe's troubleshooting table — on a challenge this file
|
|
59
|
+
wins.
|
|
60
|
+
|
|
61
|
+
Report to the user, all three:
|
|
62
|
+
|
|
63
|
+
1. the challenged URL (`get url` at pause time — not the task's start URL),
|
|
64
|
+
2. the challenge kind (Turnstile / hCaptcha / reCAPTCHA / browser check),
|
|
65
|
+
3. **the session name you have been driving** — the `--session` value your
|
|
66
|
+
own launch command passed, or `AGENT_BROWSER_SESSION` if you relied on
|
|
67
|
+
the env var, or `default` if neither.
|
|
68
|
+
|
|
69
|
+
Do not run a bare `agent-browser session` to answer #3: it prints the
|
|
70
|
+
*environment/default* session name, not the one your task passed.
|
|
71
|
+
|
|
72
|
+
## Complete — branch on the route you are already on
|
|
73
|
+
|
|
74
|
+
```mermaid
|
|
75
|
+
flowchart TD
|
|
76
|
+
A["Challenge: requested content withheld"] --> B["Pause: stop driving; report URL + kind + driven session name"]
|
|
77
|
+
B --> C{"Who can see the browser?"}
|
|
78
|
+
C -->|"relay / own-browser / Electron-CDP"| D["User completes it in the visible window"]
|
|
79
|
+
C -->|"bundled headless"| E{"Ask: are you at the machine running the browser?"}
|
|
80
|
+
E -->|"yes"| F["Session-scoped close, then relaunch original flags + --headed on the challenged URL"]
|
|
81
|
+
E -->|"no — Docker, SSH, service host"| G["Stop: human needed on a visible host; offer relay / own-browser / desktop host"]
|
|
82
|
+
D --> H["Re-snapshot the same page, continue, never switch session"]
|
|
83
|
+
F --> H
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Relay / own-browser / Electron-CDP — the user already sees the browser
|
|
87
|
+
|
|
88
|
+
(The relay recipe lives in `references/dashboard-relay.md` when that file is
|
|
89
|
+
present.) Ask the user to complete the challenge in that window. On
|
|
90
|
+
confirmation, re-snapshot the same page and continue. The session is
|
|
91
|
+
untouched — nothing to relaunch.
|
|
92
|
+
|
|
93
|
+
### Bundled headless — ask before you assume a display
|
|
94
|
+
|
|
95
|
+
The user cannot see the bundled browser, and a running daemon cannot flip
|
|
96
|
+
headless → headed in place, so the agent has to relaunch. First ask:
|
|
97
|
+
|
|
98
|
+
> Are you at the machine running the browser?
|
|
99
|
+
|
|
100
|
+
Do **not** infer this from `$DISPLAY` — it is empty on macOS and set under
|
|
101
|
+
`ssh -X`, so it is wrong in both directions.
|
|
102
|
+
|
|
103
|
+
**Yes — display available.** From Bash (the MCP `browser` tool shares the
|
|
104
|
+
same daemon and session, so Bash is the relaunch surface either way):
|
|
105
|
+
|
|
106
|
+
1. Session-scoped `close`, with the same `--session` / `--namespace` flags
|
|
107
|
+
you launched with — never `close --all`:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
agent-browser --session <name> [--namespace <namespace>] close
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Tolerate failure: if the daemon already idled out, `close` errors.
|
|
114
|
+
Ignore it and go on.
|
|
115
|
+
|
|
116
|
+
2. Relaunch with **all your original launch flags verbatim**, plus
|
|
117
|
+
`--headed`, opening the challenged URL:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
agent-browser --session <name> [<original flags>] --headed open <challenged URL>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
"Repeat the original flags" is deliberately not a list here: it keeps
|
|
124
|
+
`--restore`, `--profile`, `--state`, `--namespace`, `--cdp`, and anything
|
|
125
|
+
else in play without you having to remember them.
|
|
126
|
+
|
|
127
|
+
3. Ask the user to complete the challenge in the visible window and confirm.
|
|
128
|
+
|
|
129
|
+
**Say this out loud to the user:** a session launched without `--restore`,
|
|
130
|
+
`--profile`, or `--state` starts the headed relaunch with **empty cookies**.
|
|
131
|
+
That is by design — a task that needed login state should already have been
|
|
132
|
+
on relay / own-browser. The clearance the user just earned lives in the
|
|
133
|
+
headed browser you now keep driving, so the task still works.
|
|
134
|
+
|
|
135
|
+
**Note:** if your session is `default`, its `close` also drops the MCP
|
|
136
|
+
`browser` tool's page — both surfaces share one daemon. That affects this
|
|
137
|
+
task only.
|
|
138
|
+
|
|
139
|
+
**No — no display** (Docker harness, SSH, service context). `--headed`
|
|
140
|
+
cannot work. Stop, tell the user the site needs a human on a host with a
|
|
141
|
+
visible browser, and offer the relay / own-browser route or running the task
|
|
142
|
+
from a desktop host. Do not attempt `--headed`, a virtual display (Xvfb),
|
|
143
|
+
or any bypass.
|
|
144
|
+
|
|
145
|
+
## Resume
|
|
146
|
+
|
|
147
|
+
The headed browser under the same name **is** the working browser now.
|
|
148
|
+
Re-snapshot, continue the task, and do not close it again for the rest of
|
|
149
|
+
the task. Do not start a different session name.
|
|
150
|
+
|
|
151
|
+
If the daemon idle-timed out while the user was away, relaunch exactly as
|
|
152
|
+
above — same name, original flags + `--headed` — and resume.
|
|
153
|
+
|
|
154
|
+
## Challenge reappears after resume
|
|
155
|
+
|
|
156
|
+
Stop. Report that the site is not accepting the session. Do **not** loop on
|
|
157
|
+
retries and do **not** switch identity — a second relaunch, a new
|
|
158
|
+
`--session`, or a UA change is exactly what the challenge is testing for.
|
|
159
|
+
|
|
160
|
+
## Never
|
|
161
|
+
|
|
162
|
+
The never-list is absolute. Every item below is a bypass attempt, and a
|
|
163
|
+
challenge is a request for a human — hand it to the human instead.
|
|
164
|
+
|
|
165
|
+
Never:
|
|
166
|
+
|
|
167
|
+
- use a CAPTCHA-solving service;
|
|
168
|
+
- inject a challenge token or a clearance cookie;
|
|
169
|
+
- copy cookies between browser identities;
|
|
170
|
+
- rotate proxies;
|
|
171
|
+
- change the user-agent, request headers, or `set device` emulation in
|
|
172
|
+
response to a challenge;
|
|
173
|
+
- pass launch flags whose purpose is to hide automation — for example
|
|
174
|
+
`--args --disable-blink-features=AutomationControlled` (the CLI's own help
|
|
175
|
+
happens to show this one);
|
|
176
|
+
- inject JavaScript whose purpose is to falsify automation signals.
|
|
177
|
+
|
|
178
|
+
## Related
|
|
179
|
+
|
|
180
|
+
- Default bundled-browser workflow: [`web.md`](web.md)
|
|
181
|
+
- Electron apps: [`electron.md`](electron.md)
|
|
182
|
+
- The user's logged-in browser: [`own-browser.md`](own-browser.md)
|
|
183
|
+
- Provenance / refresh rules: [`../UPSTREAM.md`](../UPSTREAM.md)
|