@53able/pi-agent-browser 0.6.1 → 0.7.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/README.ja-JP.md +1 -1
- package/README.md +1 -1
- package/index.ts +12 -2
- package/package.json +1 -1
- package/skills/agent-browser/SKILL.md +2 -1
package/README.ja-JP.md
CHANGED
|
@@ -18,7 +18,7 @@ Pi が Web ページを開き、rendered context を抽出し、ログイン状
|
|
|
18
18
|
## Requirements
|
|
19
19
|
|
|
20
20
|
- package support 付きの Pi / Feynman runtime
|
|
21
|
-
- [`agent-browser`](https://github.com/vercel-labs/agent-browser)
|
|
21
|
+
- [`agent-browser`](https://github.com/vercel-labs/agent-browser) 0.40.0 以降が `PATH` 上にあること
|
|
22
22
|
- `agent-browser install` で Chrome for Testing が入っていること
|
|
23
23
|
|
|
24
24
|
確認:
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ Use this package when Pi needs to operate real web pages, extract rendered conte
|
|
|
18
18
|
## Requirements
|
|
19
19
|
|
|
20
20
|
- Pi / Feynman runtime with package support
|
|
21
|
-
- [`agent-browser`](https://github.com/vercel-labs/agent-browser) installed and available on `PATH`
|
|
21
|
+
- [`agent-browser`](https://github.com/vercel-labs/agent-browser) 0.40.0 or later installed and available on `PATH`
|
|
22
22
|
- Chrome for Testing installed through `agent-browser install`
|
|
23
23
|
|
|
24
24
|
Check your local setup:
|
package/index.ts
CHANGED
|
@@ -9,6 +9,7 @@ import { createServer } from "node:net";
|
|
|
9
9
|
const DEFAULT_TIMEOUT_MS = 120_000;
|
|
10
10
|
const DEFAULT_MAX_PREVIEW_CHARS = 12_000;
|
|
11
11
|
const DEFAULT_ARTIFACT_DIR = "outputs/browser";
|
|
12
|
+
const MIN_AGENT_BROWSER_VERSION = [0, 40, 0];
|
|
12
13
|
|
|
13
14
|
// Heuristics for content that signals a human-only checkpoint (2FA, CAPTCHA, identity
|
|
14
15
|
// verification). These are advisory only — read/snapshot stay non-destructive, so we
|
|
@@ -232,7 +233,6 @@ const DoctorSchema = Type.Object({
|
|
|
232
233
|
async function findAgentBrowserBin(): Promise<string> {
|
|
233
234
|
if (process.env.AGENT_BROWSER_BIN) return process.env.AGENT_BROWSER_BIN;
|
|
234
235
|
const candidates = [
|
|
235
|
-
"/Users/tadano-go/.local/bin/agent-browser",
|
|
236
236
|
join(process.env.HOME ?? "", ".local/bin/agent-browser"),
|
|
237
237
|
"agent-browser",
|
|
238
238
|
];
|
|
@@ -652,6 +652,7 @@ export default function agentBrowserExtension(pi: ExtensionAPI) {
|
|
|
652
652
|
promptGuidelines: [
|
|
653
653
|
"Use operation=list before destructive clear/clean operations unless the user explicitly asks to clear everything.",
|
|
654
654
|
"Use session + restore on agent_browser_open for automatic state persistence; use state save/load for explicit files.",
|
|
655
|
+
"state load / restore only writes storage while the page is on the saved origin; origins that redirect elsewhere are skipped and listed in the output. Open the target origin first if its storage must apply.",
|
|
655
656
|
"Do not clear all saved states unless the user clearly asks for global cleanup.",
|
|
656
657
|
],
|
|
657
658
|
parameters: StateSchema,
|
|
@@ -940,7 +941,7 @@ export default function agentBrowserExtension(pi: ExtensionAPI) {
|
|
|
940
941
|
const tabArgs = ["--cdp", String(port), "tab", "list"];
|
|
941
942
|
const tabResult = await runAgentBrowser(tabArgs, { signal, timeoutMs: params.timeoutMs as number | undefined, cwd: ctx.cwd, onUpdate });
|
|
942
943
|
|
|
943
|
-
const bindArgs = ["--session", session, "--cdp", String(port), "snapshot"];
|
|
944
|
+
const bindArgs = ["--session", session, "--cdp", String(port), "--pin-tab", "snapshot"];
|
|
944
945
|
const result = await runAgentBrowser(bindArgs, { signal, timeoutMs: params.timeoutMs as number | undefined, cwd: ctx.cwd, onUpdate });
|
|
945
946
|
|
|
946
947
|
if (!result.ok) {
|
|
@@ -1091,6 +1092,15 @@ export default function agentBrowserExtension(pi: ExtensionAPI) {
|
|
|
1091
1092
|
const result = await runAgentBrowser(args, { signal, timeoutMs: params.timeoutMs as number | undefined, cwd: ctx.cwd, onUpdate });
|
|
1092
1093
|
const textResult = buildTextResult(result);
|
|
1093
1094
|
|
|
1095
|
+
const versionResult = await runAgentBrowser(["--version"], { signal, cwd: ctx.cwd });
|
|
1096
|
+
const version = versionResult.stdout.match(/(\d+)\.(\d+)\.(\d+)/)?.slice(1).map(Number);
|
|
1097
|
+
if (version) {
|
|
1098
|
+
const diff = version.map((n, i) => n - MIN_AGENT_BROWSER_VERSION[i]).find((d) => d !== 0) ?? 0;
|
|
1099
|
+
if (diff < 0) {
|
|
1100
|
+
textResult.content[0].text += `\nagent-browser ${version.join(".")} is older than ${MIN_AGENT_BROWSER_VERSION.join(".")}, the minimum supported version. Run \`npm install -g agent-browser@latest\`.`;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1094
1104
|
const states = await readSessionStates(ctx.cwd);
|
|
1095
1105
|
const liveBrowsers: { session: string; pid: number; port: number | undefined; lastUrl?: string }[] = [];
|
|
1096
1106
|
for (const [session, state] of Object.entries(states)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@53able/pi-agent-browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Typed Pi tools for browser automation, rendered-page context extraction, screenshots, and saved session state via agent-browser.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,6 +25,7 @@ Use the `agent_browser_*` tools instead of raw `bash` commands when browser stat
|
|
|
25
25
|
- Prefer `agent_browser_read` over screenshots for textual evidence.
|
|
26
26
|
- Use `agent_browser_eval` only when read/snapshot cannot expose the required state.
|
|
27
27
|
- To keep login state automatically, open with a stable `session` and `restore: true`.
|
|
28
|
+
- State load/restore only writes storage while the page is on the saved origin; origins that redirect elsewhere are skipped and listed. Open the target origin first if its storage must apply.
|
|
28
29
|
- Before clearing state, list saved states with `agent_browser_state` unless the user explicitly asks for broad cleanup.
|
|
29
30
|
|
|
30
31
|
## Human handoff and commit gates
|
|
@@ -62,7 +63,7 @@ Example call:
|
|
|
62
63
|
}
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
After the human confirms login is complete, subsequent `agent_browser_open`, `agent_browser_snapshot`, `agent_browser_click`, and other calls with the same `session` name will reuse the authenticated browser and operate normally. **The login browser window remains visible and open indefinitely** — this is a real, user-visible Chrome window with an open remote-debugging port on `127.0.0.1` that any local process can access. The session is recorded as `headed: true` (since the authenticated browser is still running).
|
|
66
|
+
After the human confirms login is complete, subsequent `agent_browser_open`, `agent_browser_snapshot`, `agent_browser_click`, and other calls with the same `session` name will reuse the authenticated browser and operate normally. **The login browser window remains visible and open indefinitely** — this is a real, user-visible Chrome window with an open remote-debugging port on `127.0.0.1` that any local process can access. The session is recorded as `headed: true` (since the authenticated browser is still running). The session is pinned to the login tab: if that tab is closed, later calls fail with `tab_gone` instead of silently driving another tab — re-run `agent_browser_login_handoff` to recover.
|
|
66
67
|
|
|
67
68
|
**Security note:** The login browser's `--remote-debugging-port` remains open on localhost for as long as the session is alive. This gives any local process full browser control — the same caveat agent-browser's own docs give about `--remote-debugging-port`. Call `agent_browser_close` when done with a session that went through login handoff, rather than leaving it open indefinitely. `agent_browser_close` will terminate the tracked login Chrome process and clean up its debugging port.
|
|
68
69
|
|