Related docs:
Provide one concrete maintainer workflow for validating repo state, package contents, and install guidance before publishing pi-agent-browser-native.
From the repository root:
npm install
npm run doctor
npm run verify -- releasenpm run doctor is a read-only first-run diagnostic for PATH, targeted upstream version, and duplicate package/checkout source conflicts. It does not replace upstream agent-browser doctor for browser runtime health and does not edit Pi settings.
npm run verify -- release runs:
npm run verifyfor TypeScript, unit coverage, and command-reference drift detectionnpm run verify -- package-pi, which first validates package contents vianpm pack --json --dry-runand then smoke-loads the packed package in Pi isolation
The configured-source lifecycle regression harness is opt-in because it launches an interactive pi process under tmux and requires a usable local model configuration:
npm run verify -- lifecycleUse npm run verify -- lifecycle --keep-artifacts when debugging failures.
npm run verify -- package confirms that:
- no repo-local
.pi/extensions/agent-browser.tsautoload shim is present LICENSEexists in the repo and the packed tarball- canonical published docs are present
- the package-level doctor command and capability baseline are present
- extension source files are present, including the split result-rendering modules required by the published facade
- agent-only and superseded docs are absent from the tarball
npm run verify -- package-pi runs the same package-content checks and additionally confirms that:
- the packed package can be loaded through Pi SDK resource loading with the same isolation principle as
pi --no-extensions -e <package-source> - exactly one
agent_browsertool is registered - the registered
agent_browsersource resolves inside the extracted packed package path, not the working checkout - the packaged
agent_browsertool can be executed through Pi's loaded native tool definition with a deterministic fake upstreamagent-browser --versionbinary
The packaged execution smoke intentionally uses a temporary fake agent-browser binary and the --version inspection path. It proves first invocation of the packaged Pi tool without launching a real browser. Real browser coverage remains part of local checkout validation and post-publish install validation.
Current forbidden packed files include:
AGENTS.mddocs/IMPLEMENTATION_PLAN.mddocs/native-integration-design.mddocs/v1-tool-contract.md.pi/extensions/agent-browser.ts- test and repo-only maintenance files
For a full packed file listing:
npm run verify -- package --list-filesBefore publishing, validate both local-checkout modes without mixing their assumptions.
- Install
agent-browserseparately. - Launch
pi --no-extensions -e .from this repository root. - Confirm the checkout extension loads from
extensions/agent-browser/index.ts. - Run a smoke prompt that exercises
agent_browser. - Restart the
piprocess after extension edits; Pi settings and/reloadare not the validation target in this isolated mode.
Prefer the automated harness for deterministic configured-source lifecycle regression coverage:
npm run verify -- lifecycleThe harness creates an isolated PI_CODING_AGENT_DIR, writes settings with exactly one temporary configured package source, runs plain pi in tmux, puts a deterministic fake agent-browser first on PATH, and drives /reload, full restart, and /resume. It asserts same-page managed-session continuity, persisted details.fullOutputPath reachability after resume, and updated extension-code pickup through a temporary sentinel command. On failure it retains transcripts/session artifacts; on success it performs best-effort cleanup. It does not replace occasional real-browser manual smoke testing.
Manual validation remains useful for release confidence and installed-package checks:
- Configure exactly one active source for this extension in Pi settings: this checkout path before publishing, or the installed package after publishing.
- Launch plain
piso extension discovery is active. - Validate managed-session continuity with
/reloadand a full restart +/resume. - Re-check local extension-side docs (
README.md,docs/COMMAND_REFERENCE.md, and prompt guidance) if the upstreamagent-browserversion/help surface changed, then runnpm run verify -- command-reference.
The default npm test and npm run verify paths use fast deterministic tests and fake binaries. When a change touches upstream command planning, result presentation, managed-session behavior, or the canonical capability baseline, also run the opt-in real-upstream contract suite:
npm run verify -- real-upstreamThis suite requires the installed agent-browser --version to exactly match scripts/agent-browser-capability-baseline.mjs. It serves fixture pages from localhost and validates real runtime output shapes for --version, open, eval --stdin, snapshot -i, batch stdin, wait --download metadata, wrapper artifact existence reporting for the requested wait-download path, and implicit managed-session reuse. The current upstream agent-browser 0.27.0 wait --download <path> saveAs persistence limitation is tracked at vercel-labs/agent-browser#1300; until it is fixed, release validation must treat details.savedFilePath as upstream-reported metadata and use details.artifacts[].exists as the filesystem truth. If the suite fails because JSON/detail keys drifted, update the wrapper behavior or refresh test/fixtures/agent-browser-real-output-shapes.json together with the presentation work that consumes those shapes.
Example smoke prompt:
Use the agent_browser tool to open https://react.dev and then take an interactive snapshot.
Recommended configured-source lifecycle follow-up:
- Open a page with the implicit managed session and confirm the title.
- Run
/reload, then ask forsnapshot -iand confirm the same page is still active. - Exit
pi, relaunch it against the same session file or use/resume, then ask forsnapshot -iagain and confirm the same page is still active. - Open a large page that compacts its snapshot output and confirm
details.fullOutputPathstill exists after the restart/resume flow. - Trigger an oversized non-snapshot output (for example a deliberately large
eval --stdinresult) and confirm the tool prints the actual spill file path directly in content instead of only referencing a details key. - Validate at least one direct file-download flow with
download <selector> <path>. - Validate at least one asynchronous export flow with
clickfollowed bywait --download <path>, confirming the wait result reportssavedFilePath/savedFileand checkingdetails.artifacts[].existsbefore relying on the requested path being present on disk.
After publishing a release, validate the package-first path in isolation. npm run verify -- release includes the deterministic fake-binary packaged execution gate, but it does not replace a real-browser installed-package smoke:
npm exec --package pi-agent-browser-native -- pi-agent-browser-doctor
npm run verify -- release
pi --no-extensions -e npm:pi-agent-browser-native@<version>Then run the real-browser smoke prompt:
Use the agent_browser tool to open https://react.dev and then take an interactive snapshot.
Only use plain pi for installed-package validation after temporarily disabling or removing the checkout source or any other active source for this extension from Pi settings. Then confirm pi exposes the native agent_browser tool, that a basic open + snapshot -i flow works, and that /reload plus restart//resume keep following the same implicit managed browser session.
Before publishing:
- update
CHANGELOG.md - confirm README install guidance still leads with the package-first flow
- confirm
docs/COMMAND_REFERENCE.mdstill matches the effective upstream command/help surface used by the wrapper - run
npm run verify -- command-referenceif the installed upstreamagent-browserversion or help surface changed - run
npm run doctorand confirm any duplicate-source remediation matches the active package/checkout setup - run
npm run verify -- real-upstreamfor upstream runtime, result-presentation, or managed-session changes - confirm both local-checkout modes still work for pre-release validation: isolated
pi --no-extensions -e .smoke testing and configured-source lifecycle validation - rerun
npm run verify -- release - run
npm run verify -- lifecyclefor opt-in configured-source/reloadplus restart//resumeregression coverage - manually exercise real-browser
/reloadand full restart +/resumecontinuity when release risk warrants browser-level confidence beyond the fake upstream harness - publish only after the tarball contents and isolated packaged-extension smoke check match expectations