Open-source Python library for AI browser agents, plus Browser Use Cloud: stealth browsers and a hosted agent API.
Python ai-agentsai-toolsbrowser-agentbrowser-automationbrowser-usecdpcloud-browsercomputer-useheadless-browserllmmcpplaywrightpythonremote-browserstealth-browserweb-automationweb-scraping
fix: simplify OpenClaw skill metadata
MagMuellerdee2d16bef1e
diff --git a/browser_use/skills/browser-use/SKILL.md b/browser_use/skills/browser-use/SKILL.mdindex a0aa3e585..0c8f6cc22 100644--- a/browser_use/skills/browser-use/SKILL.md+++ b/browser_use/skills/browser-use/SKILL.md@@ -6,7 +6,6 @@ metadata:{"openclaw":{- "emoji": "π","requires": { "bins": ["browser-use"] },"install":[diff --git a/browser_use/skills/browser_use.py b/browser_use/skills/browser_use.pyindex 1a1bb76b7..d78f0c194 100644--- a/browser_use/skills/browser_use.py+++ b/browser_use/skills/browser_use.py@@ -6,34 +6,27 @@ import refrom importlib import resourcesfrom pathlib import Path--def _canonical_skill_path() -> Path:- return Path(__file__).resolve().parent / 'browser-use' / 'SKILL.md'---def _canonical_metadata_lines() -> list[str]:- """Read the metadata block from the canonical Browser Use skill."""- skill_path = _canonical_skill_path()- if not skill_path.exists():- return []-- try:- _, frontmatter, _ = skill_path.read_text(encoding='utf-8').split('---\n', 2)- except ValueError:- return []-- lines = frontmatter.splitlines()- try:- start = lines.index('metadata:')- except ValueError:- return []-- end = len(lines)- for index in range(start + 1, len(lines)):- if lines[index] and not lines[index][0].isspace():- end = index- break- return lines[start:end]+# Browser Use-only frontmatter added while generating both checked-in SKILL.md copies.+# Keep this as the source of truth; scripts/sync_browser_harness_skill.py verifies the outputs.+OPENCLAW_METADATA_LINES = (+ 'metadata:',+ ' {',+ ' "openclaw":',+ ' {',+ ' "requires": { "bins": ["browser-use"] },',+ ' "install":',+ ' [',+ ' {',+ ' "id": "uv",',+ ' "kind": "uv",',+ ' "package": "browser-use",',+ ' "bins": ["browser-use"],',+ ' "label": "Install Browser Use CLI (uv)",',+ ' },',+ ' ],',+ ' },',+ ' }',+)def as_browser_use_skill(text: str) -> str:@@ -71,7 +64,7 @@ def as_browser_use_skill(text: str) -> str:if not any(line.startswith('homepage:') for line in lines):lines.append('homepage: https://browser-use.com')if not any(line.startswith('metadata:') for line in lines):- lines.extend(_canonical_metadata_lines())+ lines.extend(OPENCLAW_METADATA_LINES)body = body.replace('# browser-harness', '# Browser Use', 1).replace('# Browser Harness', '# Browser Use', 1)# Rebrand every mention except repo URLs (github.com/browser-use/browser-harness/...)@@ -83,7 +76,7 @@ def as_browser_use_skill(text: str) -> str:def skill_text() -> str:"""Return the canonical Browser Use skill."""- skill_path = _canonical_skill_path()+ skill_path = Path(__file__).resolve().parent / 'browser-use' / 'SKILL.md'if skill_path.exists():return skill_path.read_text(encoding='utf-8')diff --git a/browser_use/skills/install.py b/browser_use/skills/install.pyindex 9d67ff3ad..5997e12ac 100644--- a/browser_use/skills/install.py+++ b/browser_use/skills/install.py@@ -148,23 +148,6 @@ def _validate_output_paths(output_paths: list[Path]) -> None:raise RuntimeError(f'{ancestor} is not a directory.')-def _print_skill_text(text: str) -> None:- # Windows consoles commonly default to cp1252, which cannot encode the emoji- # in OpenClaw skill metadata. Prefer UTF-8 when stdout supports reconfiguration.- reconfigure = getattr(sys.stdout, 'reconfigure', None)- reconfigured = False- if callable(reconfigure):- try:- reconfigure(encoding='utf-8', errors='replace')- reconfigured = True- except (OSError, TypeError, ValueError):- pass- if not reconfigured:- encoding = getattr(sys.stdout, 'encoding', None) or 'utf-8'- text = text.encode(encoding, errors='replace').decode(encoding)- print(text, end='')--def handle(argv: list[str]) -> int:parser = _build_parser()args = parser.parse_args(argv)@@ -177,7 +160,7 @@ def handle(argv: list[str]) -> int:except RuntimeError as exc:print(f'Error: {exc}', file=sys.stderr)return 1- _print_skill_text(text)+ print(text, end='')return 0if command == 'install':diff --git a/skills/browser-use/SKILL.md b/skills/browser-use/SKILL.mdindex a0aa3e585..0c8f6cc22 100644--- a/skills/browser-use/SKILL.md+++ b/skills/browser-use/SKILL.md@@ -6,7 +6,6 @@ metadata:{"openclaw":{- "emoji": "π","requires": { "bins": ["browser-use"] },"install":[diff --git a/tests/ci/test_browser_use_skill_install_docs.py b/tests/ci/test_browser_use_skill_install_docs.pyindex f83e6c3e6..41da21a81 100644--- a/tests/ci/test_browser_use_skill_install_docs.py+++ b/tests/ci/test_browser_use_skill_install_docs.py@@ -1,7 +1,6 @@import osimport subprocessimport sys-from io import BytesIO, TextIOWrapperfrom pathlib import PathROOT = Path(__file__).resolve().parents[2]@@ -93,7 +92,6 @@ def test_browser_use_cli_installs_browser_harness_package_skill(tmp_path):' {\n'' "openclaw":\n'' {\n'- ' "emoji": "π",\n'' "requires": { "bins": ["browser-use"] },\n'' "install":\n'' [\n'@@ -138,53 +136,3 @@ def test_browser_use_cli_validates_destination_before_installing_harness(tmp_patassert result.returncode == 1assert 'is not a directory' in result.stderrassert not uv_args.exists()---def test_skill_show_reconfigures_windows_stdout_to_utf8(monkeypatch):- from browser_use.skills import install-- buffer = BytesIO()- windows_stdout = TextIOWrapper(buffer, encoding='cp1252')- monkeypatch.setattr(sys, 'stdout', windows_stdout)- install._print_skill_text('Browser Use π\n')- windows_stdout.flush()-- assert buffer.getvalue().decode('utf-8') == 'Browser Use π\n'---def test_skill_show_replaces_unsupported_characters_without_reconfigure(monkeypatch):- from browser_use.skills import install-- class LegacyStdout:- encoding = 'cp1252'-- def __init__(self):- self.buffer = BytesIO()-- def write(self, text: str) -> int:- data = text.encode(self.encoding)- self.buffer.write(data)- return len(text)-- class FailingReconfigureStdout(LegacyStdout):- def reconfigure(self, **kwargs):- raise OSError('legacy stream cannot be reconfigured')-- for legacy_stdout in (LegacyStdout(), FailingReconfigureStdout()):- monkeypatch.setattr(sys, 'stdout', legacy_stdout)- install._print_skill_text('Browser Use π\n')-- assert legacy_stdout.buffer.getvalue().decode('cp1252') == 'Browser Use ?\n'---def test_browser_use_alias_sources_metadata_from_canonical_skill():- from browser_use.skills import browser_use-- canonical = browser_use.skill_text()- _, canonical_frontmatter, _ = canonical.split('---\n', 2)- metadata = canonical_frontmatter[canonical_frontmatter.index('metadata:') :]-- converted = browser_use.as_browser_use_skill('---\nname: browser-harness\n---\n\n# Browser Harness\n')- _, converted_frontmatter, _ = converted.split('---\n', 2)-- assert metadata in converted_frontmatter