diff options
| -rw-r--r-- | FORK.md | 42 | ||||
| -rw-r--r-- | castle-search/README.md | 29 | ||||
| -rw-r--r-- | package.json | 5 |
3 files changed, 51 insertions, 25 deletions
@@ -1,17 +1,23 @@ # Fork notes -A fork of [amankumarsingh77/pi-browser-harness](https://github.com/amankumarsingh77/pi-browser-harness), -carrying one patch: `BU_CDP_HTTP`, which lets pi drive a browser on **another -host**. +**sz-chrome-remote-cdp**: driving a Chrome on another host over its DevTools +port. A fork of [amankumarsingh77/pi-browser-harness](https://github.com/amankumarsingh77/pi-browser-harness), +carrying one patch, `BU_CDP_HTTP`, which lets pi drive a browser on **another +host**, plus `castle-search/`, a web-search tool over the same route (below). +Until 2026-10 this repository was named pi-browser-harness. Hosted on the fleet git host rather than a public forge — deliberately not published to npm and not proposed upstream. ``` -origin git@git.soarez.net:sz/pi-browser-harness.git (canonical) +origin git@git.soarez.net:sz/sz-chrome-remote-cdp.git (canonical) upstream https://github.com/amankumarsingh77/pi-browser-harness.git ``` +The package keeps upstream's name, `pi-browser-harness`, in `package.json`: +renaming it would conflict on every rebase, and pi identifies a git package by +its URL, not its name. + ## Why the patch exists Upstream can only reach a browser on localhost: @@ -44,10 +50,10 @@ watchdog restarts Chrome whenever CDP stops answering, plus once a day; see ## Install ``` -pi install git:git@git.soarez.net:sz/pi-browser-harness.git +pi install git:git@git.soarez.net:sz/sz-chrome-remote-cdp.git ``` -Clones to `~/.pi/agent/git/git.soarez.net/sz/pi-browser-harness`. The same +Clones to `~/.pi/agent/git/git.soarez.net/sz/sz-chrome-remote-cdp`. The same identifier works on macOS and Linux, which a local-path install could not do — pi records those by resolved absolute path, and `settings.json` is shared across hosts via the dotfiles symlink. @@ -55,6 +61,23 @@ hosts via the dotfiles symlink. Nothing else to configure: castle is the built-in default (`DEFAULT_REMOTE_CDP` in `src/cdp/endpoint.ts`). +## castle-search + +`castle-search/` is `castle_cdp_search`, web search run in the same remote +Chrome: it opens a background tab on an engine's results page, reads it and +closes it. It was its own repository, pi-castle-cdp-search, until 2026-10; its +commits were replayed here with `git am --directory=castle-search`, linear, so +they rebase like any fork commit. Its README has the details. + +It touches no upstream file except the root `package.json`, where it is listed +in `pi.extensions` and added to `check`. It keeps its own `package.json`, +`tsconfig.json` and tests, and its own copy of the endpoint logic rather than +importing the harness's `src/cdp/endpoint.ts`: that would tie it to upstream's +layout, which rebases move. Both read `~/.pi/agent/browser-target.json`. + +The root `.gitignore` ignores `docs/` at any depth, so a new file under +`castle-search/docs/` needs `git add -f`. + ## Choosing a browser From inside a pi session: @@ -129,9 +152,12 @@ and the `host` parameter on `queryLiveWsUrl`) and `src/setup.ts` (the skipped local-process precondition). Upstream refactors also touch the fork's hunks in `src/index.ts` (imports, `/browser-status`, `before_agent_start`), `src/prompt.ts`, `src/daemon/spawn.ts` (`stopDaemon`), `src/profile/*` and -`CHANGELOG.md`. +`CHANGELOG.md`, and `package.json` (castle-search's entries in `pi.extensions` +and `check`). Commits under `castle-search/` never conflict. -Verify with `npm run check` (typecheck, the boundary scanner and the tests). +Verify with `npm run check` (typecheck, the boundary scanner and the tests, +then castle-search's typecheck and tests; `npm --prefix castle-search install` +first). The boundary scanner rejects unguarded casts, so parse JSON with `src/util/guards.ts`. `test/daemon/entry-imports-test.ts` walks the daemon's import graph, which includes `endpoint.ts` and `target-store.ts`, and fails if diff --git a/castle-search/README.md b/castle-search/README.md index 60930b3..23a36e6 100644 --- a/castle-search/README.md +++ b/castle-search/README.md @@ -1,4 +1,7 @@ -# pi-castle-cdp-search +# castle-search + +Part of [sz-chrome-remote-cdp](../FORK.md); until 2026-10 it was its own repo, +pi-castle-cdp-search. Web search for [pi](https://pi.dev) through a Chrome that is **already running** on the wire network, driven over the Chrome DevTools Protocol. @@ -190,17 +193,9 @@ container at all" (query, or rate limiting). ## Install -``` -pi install git:git@git.soarez.net:sz/pi-castle-cdp-search.git -``` - -That is the fleet's form, over ssh. Anyone else can install from the public -clone: `pi install https://git.soarez.net/sz/pi-castle-cdp-search.git`. Either -is portable, unlike a local path: pi records local-path installs by resolved -absolute path, and `settings.json` is shared across hosts through the dotfiles -symlink. - -To try it without installing: +It comes with sz-chrome-remote-cdp: the root `package.json` lists +`./castle-search/src/index.ts` among its pi extensions, so installing that +package installs this tool. To try it on its own, from this directory: ``` pi -e ./src/index.ts @@ -208,10 +203,14 @@ pi -e ./src/index.ts ## Development +It keeps its own `package.json` and dev dependencies, separate from the +harness's. From the repository root, `npm run check` runs these too, once they +are installed: + ``` -npm install -npm run typecheck -npm test # unit tests, no browser needed +npm --prefix castle-search install +npm --prefix castle-search run typecheck +npm --prefix castle-search test # unit tests, no browser needed ``` The tests cover engine selection and precedence, URL building for all four diff --git a/package.json b/package.json index d8a5e05..55c3dc7 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ ], "pi": { "extensions": [ - "./src/index.ts" + "./src/index.ts", + "./castle-search/src/index.ts" ], "skills": [ "./skills" @@ -59,7 +60,7 @@ "typecheck": "tsc --noEmit && tsc -p tsconfig.test.json", "test": "node --conditions=import --import tsx --test \"test/{profile,domains,cdp,daemon,util}/**/*-test.ts\"", "boundaries": "tsx scripts/check-boundaries.ts", - "check": "npm run typecheck && npm run boundaries && npm test", + "check": "npm run typecheck && npm run boundaries && npm test && npm --prefix castle-search run typecheck && npm --prefix castle-search test", "prepublishOnly": "tsc --noEmit" }, "publishConfig": { |
