browser4-cli 4.13.10 → 4.14.0-rc.1

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.md CHANGED
@@ -38,6 +38,7 @@ English | [简体中文](README.zh.md) | [中国镜像](https://gitee.com/platon
38
38
  - [🚀 Build from Source](#-build-from-source)
39
39
  - [Architecture](#architecture)
40
40
  - [📦 Modules Overview](#-modules-overview)
41
+ - [🧩 Programming-Agent Kernel (browser4-coding)](#-programming-agent-kernel-browser4-coding)
41
42
  - [🧪 Test Fixture Server (MockSite)](#-test-fixture-server-mocksite)
42
43
  - [🤝 Support & Community](#-support--community)
43
44
  - [📜 Documentation](#-documentation)
@@ -51,11 +52,12 @@ English | [简体中文](README.zh.md) | [中国镜像](https://gitee.com/platon
51
52
 
52
53
  ### ✨ Key Capabilities
53
54
 
54
- * 🤖 **Agent Browser** — Enable AI agents to browse, interact, and automate real-world websites.
55
- * 🧠 **ML-Powered Extraction** — Learn page structures and extract structured data without LLM token costs.
56
- * ⚡ **High-Performance Runtime** — Coroutine-safe architecture supporting 100k–200k complex page visits per machine per day.
57
- * 🧬 **Hybrid Intelligence** — Combine LLM, ML, X-SQL, and selectors for robust extraction and experience reuse.
58
- * 📦 **Enterprise-Scale Automation** — Swarm crawling, CDP-native control, batch jobs, stateful sessions, plugins, extensions, and more.
55
+ * 🤖 **Agent Browser** — AI agents and humans drive real browsers via a Rust CLI, MCP, and an agentic backend: navigate, click, fill, snapshot, batch, and loop.
56
+ * 🧬 **Zero-Token Extraction** — X-SQL + CSS selectors for deterministic extraction from live pages or stored HTML snapshots; WebMiner ML clustering turns HTML corpora into spreadsheet and report views with no LLM tokens.
57
+ * 🧠 **Hybrid Intelligence** — Combine LLM extraction, ML clustering, X-SQL, and a progressive experience store that reuses learned selectors and blockers.
58
+ * ⚡ **High-Performance Runtime** — Coroutine-safe, CDP-native engine designed for 100k–200k complex page visits per machine per day via swarm/crawl scale-out.
59
+ * 📦 **Enterprise-Scale Automation** — Swarm crawling, batch/loop jobs, stateful sessions, plugins, runtime skills, browser extension, and MCP-over-HTTP.
60
+ * 🛠️ **Programming-Agent Kernel** — 50+ `coding.*` tools (sandboxed shell/fs, scaffolding, validation, self-development) for agents building Browser4 artifacts — or Browser4 itself.
59
61
 
60
62
  ## Quick Start
61
63
 
@@ -273,7 +275,7 @@ export DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
273
275
 
274
276
  | Command | Description |
275
277
  |---|---|
276
- | `open [url]` | Open a browser session or reconnect to an existing one. **Headless by default.** Supports `--headed` (visible window), `--headless`, `--profile <path>`, `--profile-mode <DEFAULT\|SYSTEM_DEFAULT\|SEQUENTIAL\|TEMPORARY>`, `--interact-level <FASTEST\|FAST\|DEFAULT>`. |
278
+ | `open [url]` | Open a browser session or reconnect to an existing one. **Headless by default.** Supports `--headed` (visible window), `--headless`, `--profile <path>`, `--profile-mode <DEFAULT\|SYSTEM_DEFAULT\|SEQUENTIAL\|TEMPORARY>`, `--interact-level <FASTEST\|FAST\|DEFAULT>`. **Note:** `SYSTEM_DEFAULT` is deprecated and unsupported on Chrome ≥ 143 — use `attach` + `state-save`/`state-load` to reuse system browser state (see [browser-state-import.md](skills/browser4-cli/references/browser-state-import.md)). |
277
279
  | `attach` | Attach to an existing browser via CDP or the Browser4 extension. Supports `--cdp <url\|port\|channel>` and remote endpoint options. |
278
280
  | `close` | Close the active browser session. |
279
281
  | `list` | List browser sessions with their status and next-open behavior. Supports `--all`. |
@@ -281,10 +283,11 @@ export DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxx
281
283
  | `close-all` | Close all sessions without stopping the backend. |
282
284
  | `kill-all` | Force-stop the backend and Browser4-managed browser processes. |
283
285
  | `stop` | Gracefully stop the Browser4 server. |
284
- | `status` | Show server version, port, and health. |
286
+ | `status` | Show server version, port, health, and the web status panel URL (`http://<server>:8182/status`). |
285
287
  | `doctor` | Run diagnostics: build info, LLM status, stale daemon cleanup, optional repair. Supports `--verbose` and `--fix`. |
286
288
  | `doctor log [name]` | List, view, tail, or grep backend log files. Supports `--tail`, grep-style flags, and `doctor log <name> grep <pattern>`. |
287
289
  | `doctor metrics [filter]` | List, filter, or grep backend metrics. Supports `doctor metrics grep <pattern>`. |
290
+ | `doctor status [--section <name>] [--verbose]` | Print the aggregated status panel report in the terminal: summary layer by default, full detail with `--verbose`, one report with `--section` (health, build, runtime, llm, sessions, pulsar-sessions, swarm, url-pool, browsers, drivers, privacy, plugins, skills, metrics, logs), machine-readable JSON with `--json`. |
288
291
  | `delete-data` | Delete session data. |
289
292
  | `install` | Install the Browser4 runtime bundle. Supports `--tag <version>` and `--force`. |
290
293
  | `upgrade` | Upgrade the CLI/runtime bundle. Supports `--tag <version>` and `--force`. |
@@ -296,8 +299,31 @@ browser4-cli attach --cdp chrome
296
299
  browser4-cli doctor --verbose
297
300
  browser4-cli doctor log server.log --tail
298
301
  browser4-cli doctor metrics grep request
302
+ browser4-cli doctor status --section skills --verbose
299
303
  ```
300
304
 
305
+ **Web status panel:** open `http://127.0.0.1:8182/status` in a browser for a live dashboard
306
+ (health, version, JVM/runtime, LLM config, sessions, **Pulsar sessions** — SDK identity,
307
+ context and main-loop state, **swarm** — swarm session plus task summary, **URL pool** —
308
+ queued/real-time/delay counts per priority cache, browsers & open tabs — per-session
309
+ browser/driver binding and tab counts, with on-demand live tab details via
310
+ `GET /api/system/tabs` — driver pools, plugins: load/enable state and SDK compatibility,
311
+ **skills**: registered skills with origin (classpath/filesystem/programmatic),
312
+ metrics, log files; auto-refreshes, set `?refresh=<ms>` to change the interval). The panel
313
+ is backed by the aggregated `GET /api/system/status` endpoint; the individual endpoints
314
+ (`/api/system/health`, `/api/system/build`, `/api/doctor/llm-status`, `/api/doctor/metrics`,
315
+ `/api/doctor/log-files`, `/api/plugins`, `/api/skills`) remain available. `browser4-cli plugin-list` also
316
+ reports load/enable state and SDK version for every installed plugin; the same reports can be
317
+ read from the terminal with `browser4-cli doctor status`.
318
+
319
+ **Page screenshots:** open `http://127.0.0.1:8182/pages.html` for a grid of every open page
320
+ across sessions. The active tab of each session is captured automatically (click a screenshot
321
+ to re-capture it); inactive tabs show a placeholder that captures on click. Swarm sessions only
322
+ show placeholders. Screenshots load **asynchronously** — the backend captures in the background
323
+ (`202 Accepted` with `Retry-After` while capturing, cached `image/png` when ready), so the panel
324
+ never blocks on a capture. Backed by `GET /api/pages` and
325
+ `GET /api/pages/{sessionId}/{guid}/screenshot.png` (`?refresh=1` forces a new capture).
326
+
301
327
  #### Navigation
302
328
 
303
329
  | Command | Description |
@@ -468,7 +494,7 @@ These commands require an LLM key.
468
494
  | `summarize [instruction]` | Summarize the current page. Supports `--selector`, `--filename`, `--raw`, `--stdout`. |
469
495
  | `chat <message>` | Send a plain AI chat request without auto-appended browser context. |
470
496
  | `chat-result <id>` | Retrieve the result of an async chat task. |
471
- | `agent run <task>` | Submit an autonomous browser task and immediately receive a task ID. |
497
+ | `agent run <task>` | Submit an autonomous browser task and immediately receive a task ID. Supports `--wait` (block for the result) and `--wait-timeout <seconds>` (default 600). |
472
498
  | `agent status <id>` | Check a running task. |
473
499
  | `agent result <id>` | Fetch a completed result. |
474
500
  | `agent list` | List tracked agent tasks and their status. |
@@ -617,7 +643,7 @@ The runtime bundle is stored separately in a platform-conventional application-d
617
643
 
618
644
  ## 🚀 Build from Source
619
645
 
620
- **Prerequisites:** Git, JDK 17+ (21+ recommended), Chrome/Chromium, and PowerShell 7 (Linux/macOS only). For the full prerequisites table, platform-specific tools, and Chrome auto-detection paths, see [Build from Source](docs/build-from-source.md).
646
+ **Prerequisites:** Git, JDK 25+ (Eclipse Temurin), Chrome/Chromium, and PowerShell 7 (Linux/macOS only). For the full prerequisites table, platform-specific tools, and Chrome auto-detection paths, see [Build from Source](docs/build-from-source.md).
621
647
 
622
648
  1. **Clone the repository**
623
649
  ```shell
@@ -676,6 +702,7 @@ browser4-cli (Rust) ──MCP over HTTP──▶ browser4-rest (Kotlin/Spring)
676
702
  - **Backend** (`browser4-rest`) — Spring Boot server, dispatches MCP tools to browser drivers
677
703
  - **Browser driver** (`browser4-core/browser4-browser`) — wraps Chrome DevTools Protocol
678
704
  - **Agent tools** (`browser4-agentic`) — maps MCP tool names to browser automation methods
705
+ - **Programming kernel** (`browser4-coding`) — dependency-light agent toolkit (sandboxed shell/filesystem, scaffolding, validation, self-development tools) — see [below](#-programming-agent-kernel-browser4-coding)
679
706
 
680
707
  ## 📦 Modules Overview
681
708
 
@@ -687,6 +714,7 @@ browser4-cli (Rust) ──MCP over HTTP──▶ browser4-rest (Kotlin/Spring)
687
714
  | `browser4-dependencies` | BOM and dependency version alignment |
688
715
  | `browser4-tools` | Operational tools and launch helpers |
689
716
  | `browser4-agentic` | AI agents, MCP integration, skill registration |
717
+ | `browser4-coding` | Programming-agent kernel — sandboxed shell/fs, artifact scaffolding & validation, self-development tools (47 `coding.*` tools) |
690
718
  | `browser4-agent-tools` | High-level agent tools: scraping, crawling, stateful page interaction |
691
719
  | `browser4-rest` | Spring Boot REST layer & command endpoints |
692
720
  | `browser4-apps/browser4-standalone` | Product packaging — unified launcher (`target/Browser4.jar`) |
@@ -697,6 +725,28 @@ browser4-cli (Rust) ──MCP over HTTP──▶ browser4-rest (Kotlin/Spring)
697
725
 
698
726
  ---
699
727
 
728
+ ## 🧩 Programming-Agent Kernel (browser4-coding)
729
+
730
+ `browser4-coding` is the dependency-light programming kernel that lets an AI agent create Browser4 artifacts **and** develop Browser4 itself. It is independent of `browser4-agentic` and `pulsar-common` (only SLF4J + Jackson + coroutines), so it can be reused by non-agent hosts. Heavy backends (LSP servers, kotlin-compiler-embeddable) are probed at runtime and never downloaded by default.
731
+
732
+ The `coding` domain exposes **47 tools** in four groups:
733
+
734
+ | Group | Count | Highlights |
735
+ |---|---|---|
736
+ | Shell & filesystem | 28 | sandboxed `coding.shell` (command whitelist), snapshot-based edit primitives with `revert`, `diff` (Myers/Patience), repo-governance protection (`coding.protect`) |
737
+ | Artifact creation & validation | 6 | `scaffold` (plugin/skill/js/script), `scaffoldFlow` (multi-file dev-flow), `scaffoldFromExample` (anti-staleness live templates, directory mode + stem-derived renames), `validate` (incl. `repo-consistency`) |
738
+ | Self-development | 7 | `mvnBuild` (structured diagnostics), `ktSymbols`/`ktReferences`/`ktInheritance` (zero-dep Kotlin analysis), `impact` + `moduleGraph` (live pom graph), `devTask` (AGENTS.md flow + execution), `trapCheck` (CDP pitfalls) |
739
+ | LSP | 4 | on-demand `diagnostics`/`symbols`/`references` for ts/js/py/rs (degrades gracefully when a server is missing) |
740
+
741
+ **Generic vs project-specific**: the kernel is layered by *mechanism vs data* — diff, sandbox, LSP client, Kotlin analysis, Maven passthrough and the pom-graph scanner are generic and portable; the scaffolds, validators, `ModuleMap`, `CdpTrapCheck` and the governance defaults encode Browser4 conventions and are the layer to rewrite when reusing the kernel elsewhere.
742
+
743
+ - Full tool reference & workflows: `skills/browser4-coding/SKILL.md`
744
+ - Developing Browser4 itself: `skills/browser4-dev/SKILL.md`
745
+ - Four-artifact comparison examples (real vs scaffold output): `docs-dev/copilot/examples/`
746
+ - Evaluation summary (P1–P7): `docs-dev/copilot/browser4-programming-support-eval.md`
747
+
748
+ ---
749
+
700
750
  ## 🧪 Test Fixture Server (MockSite)
701
751
 
702
752
  Browser4 includes a lightweight **MockSite** server that serves static HTML pages for testing and demos. Start it from the repository root:
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser4-cli",
3
- "version": "4.13.10",
3
+ "version": "4.14.0-rc.1",
4
4
  "description": "Browser automation CLI for AI agents",
5
5
  "type": "module",
6
6
  "files": [
@@ -39,8 +39,20 @@ cleanup() {
39
39
  wait "$HTTP_PID" 2>/dev/null || true
40
40
  fi
41
41
  if [ -n "${TEMP_DIR:-}" ] && [ -d "$TEMP_DIR" ]; then
42
- rm -rf "$TEMP_DIR"
42
+ # On Windows the JVM/Chrome may hold jar and log handles open for a
43
+ # few seconds after kill-all ("Device or resource busy"). Retry
44
+ # briefly, and never let a cleanup failure override the script's
45
+ # PASS/FAIL exit status — the test result is what matters, and CI
46
+ # runners are ephemeral anyway.
47
+ local attempt
48
+ for attempt in 1 2 3 4 5; do
49
+ if rm -rf "$TEMP_DIR" 2>/dev/null; then
50
+ break
51
+ fi
52
+ sleep 2
53
+ done
43
54
  fi
55
+ return 0
44
56
  }
45
57
  trap cleanup EXIT
46
58
 
@@ -189,6 +201,13 @@ run_cli() {
189
201
  # BROWSER4_RUNTIME_DIR → where the installed runtime lives
190
202
  # BROWSER4_CLI_STATE_DIR → where CLI session state is persisted
191
203
  # BROWSER4_SERVER_LOG_DIR → where server startup logs go
204
+ # BROWSER4_CLI_FORCE_REMOTE_BUNDLE → skip the "build local bundle from
205
+ # the repo checkout" dev path. Without this, the CLI prefers a
206
+ # Maven rebuild of browser4-bundle when run inside a checkout
207
+ # (and hard-fails when Maven cannot run, e.g. no/mismatched JDK).
208
+ # The smoke test must exercise the *downloaded archive*, not a
209
+ # locally rebuilt bundle, so force the installed-runtime path.
210
+ BROWSER4_CLI_FORCE_REMOTE_BUNDLE=1 \
192
211
  BROWSER4_CLI_STATE_DIR="$STATE_DIR" \
193
212
  BROWSER4_RUNTIME_DIR="$RUNTIME_DIR" \
194
213
  BROWSER4_SERVER_LOG_DIR="$SERVER_LOG_DIR" \