webpilot-cli 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,7 @@
1
+ """pip launcher for the WebPilot CLI.
2
+
3
+ The agent itself is the npm package ``@capagents/webpilot`` (OpenTUI + Bun).
4
+ This distribution only puts a ``webpilot`` command on PATH.
5
+ """
6
+
7
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ from webpilot_cli.launcher import main
2
+
3
+ main()
@@ -0,0 +1,67 @@
1
+ from __future__ import annotations
2
+
3
+ import os
4
+ import shutil
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ from webpilot_cli import __version__
9
+
10
+ NPM_PACKAGE = "@capagents/webpilot"
11
+
12
+
13
+ class LaunchError(Exception):
14
+ pass
15
+
16
+
17
+ def find_bun() -> str | None:
18
+ if os.environ.get("WEBPILOT_BUN"):
19
+ explicit = os.environ["WEBPILOT_BUN"]
20
+ if Path(explicit).is_file() or shutil.which(explicit):
21
+ return explicit
22
+ found = shutil.which("bun")
23
+ if found:
24
+ return found
25
+ home = os.environ.get("HOME") or os.environ.get("USERPROFILE") or ""
26
+ if home:
27
+ candidate = Path(home) / ".bun" / "bin" / "bun"
28
+ if candidate.is_file():
29
+ return str(candidate)
30
+ return None
31
+
32
+
33
+ def find_checkout_entry() -> Path | None:
34
+ """Repo layout is <root>/py/webpilot_cli/launcher.py. Wheels do not match."""
35
+ root = Path(__file__).resolve().parents[2]
36
+ entry = root / "src" / "index.ts"
37
+ package_json = root / "package.json"
38
+ if entry.is_file() and package_json.is_file():
39
+ return entry
40
+ return None
41
+
42
+
43
+ def resolve_launch(args: list[str]) -> list[str]:
44
+ bun = find_bun()
45
+ if not bun:
46
+ raise LaunchError(
47
+ "webpilot needs Bun 1.3 or newer.\n"
48
+ " curl -fsSL https://bun.sh/install | bash"
49
+ )
50
+ if os.environ.get("WEBPILOT_FROM_REGISTRY") == "1":
51
+ entry = None
52
+ else:
53
+ entry = find_checkout_entry()
54
+ if entry is not None:
55
+ return [bun, str(entry), *args]
56
+ return [bun, "x", f"{NPM_PACKAGE}@{__version__}", *args]
57
+
58
+
59
+ def main() -> None:
60
+ try:
61
+ cmd = resolve_launch(sys.argv[1:])
62
+ except LaunchError as exc:
63
+ print(str(exc), file=sys.stderr)
64
+ raise SystemExit(1) from exc
65
+ bindir = str(Path(cmd[0]).parent)
66
+ os.environ["PATH"] = bindir + os.pathsep + os.environ.get("PATH", "")
67
+ os.execv(cmd[0], cmd)
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: webpilot-cli
3
+ Version: 0.1.0
4
+ Summary: pip launcher for the WebPilot browser agent (npm package: @capagents/webpilot)
5
+ Author: CLI-Agents
6
+ License: MIT
7
+ Keywords: webpilot,browser,agent,cli,opentui
8
+ Requires-Python: >=3.9
9
+ Description-Content-Type: text/markdown
10
+ Provides-Extra: dev
11
+ Requires-Dist: pytest>=8.0; extra == "dev"
12
+
13
+ # WebPilot
14
+
15
+ Self-contained browser agent: OODA loop (observe → orient → decide → act) → Playwright spec.
16
+
17
+ No FastAPI or database. LLM profiles live in `llms.json`, agent settings in `webpilot.yaml`. The interactive shell is [OpenTUI](https://opentui.com). Headless `run` is for CI.
18
+
19
+ The loop matches the WebPilot design in test-agent-nexus (`backend/docs/WEBPILOT_FLOW.md`): DOM observe with shadow roots, viewport JPEG, one JSON action per step, then click / type / select / navigate. See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) and [HOW_TO_USE.md](HOW_TO_USE.md).
20
+
21
+ ## Install
22
+
23
+ OpenTUI needs **Bun 1.3+**. Node cannot load the native renderer.
24
+
25
+ The CLI is published on **npm** as `@capagents/webpilot` (the unscoped name is too close to an existing package). **PyPI** package `webpilot-cli` is a pip launcher for the same `webpilot` command (`webpilot` is already another project on PyPI).
26
+
27
+ ```bash
28
+ curl -fsSL https://bun.sh/install | bash
29
+
30
+ # npm
31
+ npm install -g @capagents/webpilot
32
+ npx @capagents/webpilot --help
33
+
34
+ # pip (launcher; runs the npm package via bun)
35
+ pip install webpilot-cli
36
+ webpilot --help
37
+ ```
38
+
39
+ Live browser profiles also need Chromium: `bunx playwright install chromium`. The `mock` profile does not.
40
+
41
+ From this repo:
42
+
43
+ ```bash
44
+ cd WebPilot
45
+ bun install
46
+ bun src/index.ts init
47
+ bun src/index.ts start
48
+ ```
49
+
50
+ One-shot release (same version on both registries; assumes `npm` and `twine` are already logged in):
51
+
52
+ ```bash
53
+ ./scripts/publish.sh # current version
54
+ ./scripts/publish.sh 0.2.0 # bump + publish
55
+ ./scripts/publish.sh --dry-run # pack only
56
+ ```
57
+
58
+ npm is published first. The pip launcher runs `bun x @capagents/webpilot@<version>`.
59
+
60
+ ## Configure
61
+
62
+ `init` writes:
63
+
64
+ | File | Purpose |
65
+ |------|---------|
66
+ | `webpilot.yaml` | Browser, prompts, export, active profile |
67
+ | `llms.json` | Named LLM profiles |
68
+ | `.env.example` | API key names |
69
+
70
+ ```bash
71
+ webpilot models
72
+ webpilot run --goal "Read the homepage" --url https://example.com --profile mock --plain
73
+ ```
74
+
75
+ `mock` uses a synthetic page, writes `workflow.yaml` and `webpilot.spec.ts`, and does not call a model. Switch `llm.active` to `azure-gpt4o` or `openai-gpt4o` for a real browser run.
76
+
77
+ ## CLI
78
+
79
+ ```bash
80
+ webpilot start
81
+ webpilot start -u https://example.com -g "Find the documentation link" -p openai-gpt4o
82
+
83
+ webpilot run --goal "Get a quote" --url https://example.com --profile azure-gpt4o --headed
84
+ webpilot run --goal "..." --url https://example.com --profile mock --plain --out ./out/demo
85
+ ```
86
+
87
+ Inside the shell: `/url`, `/goal`, `/run`, `/stop`, `/headed`, `/steps`, `/profile`, `/export`, `/exit`. A line without a slash sets the goal and starts when a URL is known.
@@ -0,0 +1,8 @@
1
+ webpilot_cli/__init__.py,sha256=AWZzS9jnB9raJbBet2mSRZ-XdMzSThhTpP2vTWv2yM8,203
2
+ webpilot_cli/__main__.py,sha256=DnMLrQOZZUhSIv58pA8_byuM786fNKLZSLmvqPsDRPg,47
3
+ webpilot_cli/launcher.py,sha256=oNfhZfZdGKUF86S0L3NUWXlFC1b2SyRFcfvGnhVpp7Q,1856
4
+ webpilot_cli-0.1.0.dist-info/METADATA,sha256=nkCFdmr8izlzeW9lINESHeeCg0DWsnvF3zu_roTkgNw,3004
5
+ webpilot_cli-0.1.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
6
+ webpilot_cli-0.1.0.dist-info/entry_points.txt,sha256=SWWnrtH4hIyM6q3gREzDiImBTGx-ToXKXJuroRXMkXQ,56
7
+ webpilot_cli-0.1.0.dist-info/top_level.txt,sha256=_p0GEdg7Rf1WKhl4godWgEEBRAJb3ufIp8LDqMdLPcA,13
8
+ webpilot_cli-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ webpilot = webpilot_cli.launcher:main
@@ -0,0 +1 @@
1
+ webpilot_cli