pi-agent-browser-native 0.2.57 → 0.2.59

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/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.2.59 - 2026-06-24
6
+
7
+ ### Changed
8
+
9
+ - Shortened the always-on `agent_browser` prompt guidance by over 1KB while preserving the native-tool trigger, open → `snapshot -i` workflow, `sessionMode=fresh`, artifact verification, and extraction rules.
10
+ - Moved the quick live-search guidance onto `agent_browser_web_search` so browser-search routing stays available without duplicating that guidance in the main browser tool prompt.
11
+
12
+ ### Validation
13
+
14
+ - Ran `npm run verify -- release`, `npm run doctor`, and `npm run verify -- startup-profile --samples 3` against the local checkout.
15
+ - Ran tmux-driven Pi checkout smoke with `pi --approve --model zai/glm-5.2:high --no-extensions --no-skills --session-dir <tmp> -e .`, confirming the model chose `agent_browser` for `open` + `snapshot -i`, chose `agent_browser_web_search` for live search, and closed the managed browser session.
16
+ - Ran an independent reviewer subagent over the diff; no blockers found.
17
+
18
+ ## 0.2.58 - 2026-06-23
19
+
20
+ ### Changed
21
+
22
+ - Updated the local Pi development baseline to `@earendil-works/*` `0.80.1` and raised the doctor/runtime floor to Pi `0.80.1`.
23
+ - Moved extension source/test imports that typecheck against old root `@earendil-works/pi-ai` globals to `@earendil-works/pi-ai/compat`, matching the Pi 0.80 migration guidance.
24
+
25
+ ### Validation
26
+
27
+ - Pending in this release train.
28
+
5
29
  ## 0.2.57 - 2026-06-22
6
30
 
7
31
  ### Changed
package/README.md CHANGED
@@ -89,7 +89,7 @@ The result is optimized for agent work:
89
89
 
90
90
  ## Fastest way to try it
91
91
 
92
- Use Pi 0.79.10 or newer. This package keeps Pi core imports as wildcard `peerDependencies` because Pi package docs require the host Pi install to provide those packages, and `pi-agent-browser-doctor` fails setup when `pi --version` is below the enforced runtime floor. The current release is audited and validated against the Pi 0.79.10 extension/package baseline, including Project Trust.
92
+ Use Pi 0.80.1 or newer. This package keeps Pi core imports as wildcard `peerDependencies` because Pi package docs require the host Pi install to provide those packages, and `pi-agent-browser-doctor` fails setup when `pi --version` is below the enforced runtime floor. The current release is audited and validated against the Pi 0.80.1 extension/package baseline, including Project Trust.
93
93
 
94
94
  Install upstream `agent-browser` first and make sure it is on `PATH`:
95
95
 
@@ -8,10 +8,10 @@ import { LAUNCH_SCOPED_FLAG_LABEL } from "./launch-scoped-flags.js";
8
8
  */
9
9
  export const PROJECT_RULE_PROMPT = "Project rule: when browser automation is needed, prefer the native `agent_browser` tool. Do not run direct `agent-browser` bash commands unless the user explicitly asks for a bash-oriented workflow or browser-integration debugging.";
10
10
  export const TOOL_PROMPT_GUIDELINES_PREFIX = [
11
- "Use agent_browser whenever the task requires a real browser or live web content.",
11
+ "Use agent_browser for real browser or live web content.",
12
12
  ];
13
13
  export function buildInstalledDocsGuideline(paths) {
14
- return `For deeper agent_browser guidance without bloating context, read installed package docs on demand: ${paths.readmePath} for setup/external dependencies, ${paths.commandReferencePath} for command workflows, and ${paths.toolContractPath} for result/details contracts. Do not load the full command reference unless needed; prefer targeted sections.`;
14
+ return `For detailed agent_browser docs, read targeted sections: ${paths.readmePath} (setup), ${paths.commandReferencePath} (commands), ${paths.toolContractPath} (result/details). Do not load the full command reference unless needed.`;
15
15
  }
16
16
  export const QUICK_START_GUIDELINES = [
17
17
  `Quick start mental model: use exactly one of args (exact agent-browser CLI args after the binary), semanticAction (a thin shorthand compiled to find argv for locator actions, direct selector/ref click/check/fill, or select argv for native dropdowns), job (a constrained short-workflow schema compiled to batch --bail by default; set failFast:false only when later diagnostics should continue after a failed step), qa (a lightweight fail-fast QA preset built on batch --bail with bounded visible expected-text checks, including qa.attached for current sessions), electron (desktop Electron list/launch/status/cleanup/probe), or the experimental sourceLookup / networkSourceLookup helpers (candidates only; each compiled to batch); stdin is only for batch, eval --stdin, auth save --password-stdin, and wrapper-generated batch stdin from job, qa, sourceLookup, or networkSourceLookup, and is rejected with electron; sessionMode=fresh switches the extension-managed pi-scoped session to a fresh upstream launch when you need new launch-scoped flags (${LAUNCH_SCOPED_FLAG_LABEL}) to apply. Use outputPath for durable eval/get/snapshot captures. Do not pass --json in args; the wrapper injects it.`,
@@ -24,7 +24,7 @@ export const QUICK_START_GUIDELINES = [
24
24
  "For artifact-producing commands, read the visible artifact block and details.artifactVerification before using files: check requested path, absolute path, existence, size bytes, artifact kind, optional mediaType, status, optional limitation, and verified/missing/pending/unverified counts. details.artifacts contains per-file metadata; record start rows are pending/openRecording until record stop writes the target. The wrapper creates parent directories for direct artifact paths and can save simple loopback HTTP(S) anchor downloads directly to the requested path before upstream download fallback. Browser close does not delete explicit saved files; if close reports details.artifactCleanup, use host file tools to remove paths listed in explicitArtifactPaths (when non-empty) after inspection. If close fails with details.promptGuard.reason=requested-artifacts-missing-before-close, save the exact required artifact path before closing. For annotated screenshots inside batch, put --annotate in top-level args (for example { args: [\"--annotate\", \"batch\"], stdin: \"[[\\\"screenshot\\\",\\\"/tmp/page.png\\\"]]\" }) rather than inside the screenshot step; if annotation labels crowd a dense page, use a scoped or non-annotated screenshot plus snapshot refs instead.",
25
25
  "When details.nextActions is present, prefer those exact native agent_browser follow-up payloads over prose guidance; they may include args, stdin, sessionMode, networkSourceLookup, safety notes, or artifactPath for saved files.",
26
26
  ];
27
- export const WEB_SEARCH_PROMPT_GUIDELINE = "Use agent_browser_web_search for quick live search/URL discovery; prefer it over browser-automating public search-engine forms, which can hit anti-bot/CAPTCHA-gated pages. Use agent_browser for interaction/DOM/screenshots/auth after you have a target URL. One query, inspect, one follow-up max; on HTTP 429 stop/report limits.";
27
+ export const WEB_SEARCH_PROMPT_GUIDELINE = "Use agent_browser_web_search for quick live search/URL discovery; prefer it over public search-engine forms that can hit anti-bot/CAPTCHA-gated pages. Use agent_browser after you have a target URL; one query, one follow-up max; stop on HTTP 429.";
28
28
  export const SHARED_BROWSER_PLAYBOOK_GUIDELINES = [
29
29
  "Standard workflow: open the page, snapshot -i, interact using current @refs from that snapshot, and re-snapshot after navigation, scrolling, rerendering, or other major DOM changes because refs are page-scoped; the wrapper fails mutation-prone stale/recycled refs before upstream can silently target a different current-page element. On dense pages, use wrapper-side snapshot -i --search <text> or snapshot -i --filter role=<role> to render matching refs while preserving the full ref map in details.refSnapshot, add snapshot --viewport when scroll position or above/below-fold context matters, and add snapshot --diff when a quick before/after ref-map delta would prevent reading a full spill file.",
30
30
  "For ordinary forms from one snapshot, batch multiple fill @refs before the submit/click step to avoid serial tool calls; if a fill may autosubmit, navigate, or rerender later fields, split the flow and refresh refs first.",
@@ -60,8 +60,7 @@ export const SHARED_BROWSER_PLAYBOOK_GUIDELINES = [
60
60
  "Do not call --help or other exploratory inspection commands unless the user explicitly asks for them or debugging the browser integration is necessary.",
61
61
  ];
62
62
  export const TOOL_PROMPT_GUIDELINES_SUFFIX = [
63
- "Prefer agent_browser over bash for opening sites, docs, clicking, filling, screenshots, eval, and batch workflows.",
64
- "Do not fall back to osascript, AppleScript, or generic browser-driving bash commands when agent_browser can do the job.",
63
+ "Prefer agent_browser over bash, osascript, AppleScript, or generic browser-driving shell for sites, docs, clicking, filling, screenshots, eval, and batch workflows.",
65
64
  "Pass exact agent-browser CLI arguments in agent_browser args when you are not using semanticAction, job, or qa, excluding the binary name and --json (agent_browser injects --json automatically).",
66
65
  "Use agent_browser stdin only for eval --stdin, batch, auth save --password-stdin, or wrapper-generated job/qa batches instead of shell heredocs or password args; other command/stdin combinations are rejected before launch.",
67
66
  `Let the agent_browser extension-managed session handle the common path unless you explicitly need a fresh launch for launch-scoped flags (${LAUNCH_SCOPED_FLAG_LABEL}).`,
@@ -86,12 +85,12 @@ export function buildSharedBrowserPlaybookGuidelines(options) {
86
85
  }
87
86
  /** Tier A: always-on tool promptGuidelines (keep small; Tier B lives in SHARED_BROWSER_PLAYBOOK_GUIDELINES and docs). */
88
87
  export const RUNTIME_PROMPT_GUIDELINES = [
89
- "Use agent_browser with exactly one input mode: args, semanticAction, job, qa, sourceLookup/networkSourceLookup, or electron. stdin only for batch/eval/auth or wrapper batch; electron rejects stdin. Do not pass --json in args; agent_browser injects it.",
90
- "For agent_browser, the common flow is open, snapshot -i, use current @refs or semanticAction, then re-snapshot after navigation/scroll/rerender/DOM change. Batch same-snapshot forms unless they may submit/navigate/rerender. Keep job flows short around navigation/click/rerender boundaries on dynamic apps. Respect explicit stop boundaries: stop before order/post/purchase/submit.",
91
- "Use agent_browser top-level sessionMode=fresh for launch-scoped flags; never put --session-mode in args. For signed-in/account-specific content, use requested/configured profiles, never assume --profile Default; on profile failures, run profiles/doctor and tell the user what to configure. Use --executable-path for configured Chromium. Profile content is model-visible.",
92
- "For agent_browser artifacts, save the exact user path and verify details.artifactVerification/details.artifacts before claiming success. If close is blocked by details.promptGuard, save the required artifact first. record stop needs ffmpeg; close does not delete saved files; waited:timeout is not proof.",
93
- "When agent_browser details.nextActions is present, prefer exact payloads over prose/guessed selectors. For dense snapshots, check Omitted high-value controls/details.data.highValueControlRefIds. For dashboards, verify scroll with screenshot/snapshot; if nothing moved, target the real scroll region.",
94
- "For agent_browser extraction, prefer get title/url/text/html/value/attr/count or eval --stdin with plain expression, not console.log. Batch three or more known refs/selectors (e.g. [[\"get\",\"text\",\"@e1\"],[\"get\",\"text\",\"@e2\"]]); selector visibility warnings visible @refs/nextActions.",
88
+ "Use agent_browser with one input mode: args, semanticAction, job, qa, sourceLookup/networkSourceLookup, or electron. stdin only for batch/eval/auth/wrapper batch; electron rejects stdin; never pass --json.",
89
+ "For agent_browser, use open snapshot -i current @refs or semanticAction re-snapshot after navigation/scroll/rerender. Batch same-snapshot forms; split before navigation/submits. Stop before order/post/purchase/submit.",
90
+ "Use agent_browser sessionMode=fresh for launch-scoped flags; never put --session-mode in args. Use requested/configured profiles only; on profile failures run profiles/doctor. Profile content is model-visible.",
91
+ "For agent_browser artifacts, use exact user paths and verify details.artifactVerification/details.artifacts before claiming success. Save details.promptGuard-required artifacts before close; record stop needs ffmpeg; close keeps files; waited:timeout is not proof.",
92
+ "When agent_browser details.nextActions exists, use exact payloads over guessed selectors/prose. Dense snapshots: check Omitted high-value controls/highValueControlRefIds. Dashboards: verify scroll with screenshot/snapshot.",
93
+ "For agent_browser extraction, prefer get title/url/text/html/value/attr/count or eval --stdin returning a plain value, not console.log. Batch three-plus known reads; selector visibility warnings mean use visible @refs/nextActions.",
95
94
  ];
96
95
  export function buildBrowserExecutablePathGuideline(executablePath) {
97
96
  if (!executablePath)
@@ -115,8 +114,6 @@ export function buildToolPromptGuidelines(options) {
115
114
  ...RUNTIME_PROMPT_GUIDELINES,
116
115
  ...(browserExecutablePathGuideline ? [browserExecutablePathGuideline] : []),
117
116
  ...(browserDefaultProfileGuideline ? [browserDefaultProfileGuideline] : []),
118
- ...(options.includeWebSearch ? [WEB_SEARCH_PROMPT_GUIDELINE] : []),
119
117
  TOOL_PROMPT_GUIDELINES_SUFFIX[0],
120
- TOOL_PROMPT_GUIDELINES_SUFFIX[1],
121
118
  ];
122
119
  }
@@ -4,6 +4,7 @@
4
4
  * Scope: Live web search only; browser automation remains in the `agent_browser` tool.
5
5
  */
6
6
  import { JsonSchema } from "./json-schema.js";
7
+ import { WEB_SEARCH_PROMPT_GUIDELINE } from "./playbook.js";
7
8
  import { StringEnum as localStringEnum } from "./string-enum-schema.js";
8
9
  import { DEFAULT_WEB_SEARCH_PROVIDER, WEB_SEARCH_PROVIDERS, resolvePreferredWebSearchCredential, } from "./config.js";
9
10
  export const AGENT_BROWSER_WEB_SEARCH_TOOL_NAME = "agent_browser_web_search";
@@ -505,7 +506,7 @@ export function createAgentBrowserWebSearchTool(configState, options = {}) {
505
506
  description: `Search the web with Exa or Brave when configured. Returns up to ${MAX_SEARCH_RESULT_COUNT} concise web results.`,
506
507
  promptSnippet: "Search the live web with Exa or Brave for current or external information.",
507
508
  promptGuidelines: [
508
- "Use agent_browser_web_search when live web search would help answer the task, find current external information, or discover candidate URLs for agent_browser.",
509
+ WEB_SEARCH_PROMPT_GUIDELINE,
509
510
  "agent_browser_web_search chooses Exa or Brave from configured keys; when both are available, Exa is preferred by default unless webSearch.preferredProvider says otherwise. Use provider only when the user/config calls for a specific provider.",
510
511
  "Prefer agent_browser_web_search over opening or typing into public search engine result pages with agent_browser when a quick result list is enough; browser-automated search forms are often anti-bot/CAPTCHA-gated, and this tool is the fallback for discovery rather than a CAPTCHA bypass.",
511
512
  "Do not issue parallel or repeated agent_browser_web_search calls; use one high-signal query, inspect the results, then only run a focused follow-up if needed. If the provider returns HTTP 429, stop searching and tell the user the API plan/rate limit needs time or a plan change.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agent-browser-native",
3
- "version": "0.2.57",
3
+ "version": "0.2.59",
4
4
  "description": "pi extension that exposes agent-browser as a native tool for browser automation",
5
5
  "type": "module",
6
6
  "author": "Mitch Fultz (https://github.com/fitchmultz)",
@@ -63,9 +63,9 @@
63
63
  "typebox": "*"
64
64
  },
65
65
  "devDependencies": {
66
- "@earendil-works/pi-ai": "^0.79.10",
67
- "@earendil-works/pi-coding-agent": "^0.79.10",
68
- "@earendil-works/pi-tui": "^0.79.10",
66
+ "@earendil-works/pi-ai": "^0.80.1",
67
+ "@earendil-works/pi-coding-agent": "^0.80.1",
68
+ "@earendil-works/pi-tui": "^0.80.1",
69
69
  "@types/node": "^25.9.3",
70
70
  "tsx": "^4.21.0",
71
71
  "typebox": "^1.1.38",
@@ -25,7 +25,7 @@ const EXTENSION_ENTRYPOINTS = Object.freeze([
25
25
  "dist/extensions/agent-browser/index.js",
26
26
  ]);
27
27
  const EXPECTED_VERSION = CAPABILITY_BASELINE.targetVersion;
28
- const MINIMUM_PI_VERSION = "0.79.10";
28
+ const MINIMUM_PI_VERSION = "0.80.1";
29
29
  const DEFAULT_AGENT_DIR = resolve(homedir(), ".pi/agent");
30
30
  const THIS_PACKAGE_ROOT = resolve(dirname(fileURLToPath(import.meta.url)), "..");
31
31
 
@@ -309,7 +309,7 @@ async function checkPiVersion({ runPi }) {
309
309
  status: "fail",
310
310
  title: `Pi ${MINIMUM_PI_VERSION} or newer is required; found ${version || "<empty>"}.`,
311
311
  lines: [
312
- "This release enforces the Pi 0.79.10 runtime floor through the read-only doctor and release/package validation because it depends on Project Trust, package loading, session lifecycle, TUI rendering, and tool_result patch behavior from that baseline.",
312
+ "This release enforces the Pi 0.80.1 runtime floor through the read-only doctor and release/package validation because it depends on Project Trust, package loading, session lifecycle, TUI rendering, and tool_result patch behavior from that baseline.",
313
313
  "Update Pi before using this package or running lifecycle/package validation.",
314
314
  ],
315
315
  };