browser-use--browser-harness
82a1f2f540
* remote: stop_remote_daemon helper, skill updates from sub-agent testing
Three fresh sub-agents ran typical-user prompts against the skill
("start a remote browser with my logged-in data" / "Stripe only, no
Google" / "refresh my existing profile"). All three completed
end-to-end — cookies made the round trip, filters scoped cleanly,
refresh was idempotent. But they hit a few doc/code seams worth
closing:
admin.py:
- Add stop_remote_daemon(name="remote"). Sub-agents kept reaching
for restart_daemon() because there was no obvious way to end a
remote session; the new alias pairs symmetrically with
start_remote_daemon() and makes the intent explicit. Same
underlying implementation — it's just naming for callers.
run.py:
- Pre-import stop_remote_daemon so it's usable from
browser-harness <<'PY' ... PY without an extra import line.
interaction-skills/profile-sync.md:
- Drop the "close Chrome before syncing" trap at the top of the
Traps section. Obsolete on profile-use v1.0.5+ — the tool copies
the profile dir to a temp and syncs from the copy. Two sub-agents
verified sync works with Chrome open on v1.0.5. Kept a small
note at the bottom for anyone on older versions.
- Document the ♻️ / 📝 reuse-vs-create signal in sync_local_profile
output, so agents can confirm cloud_profile_id was accepted
without counting profiles.
- Clarify the API path convention for _browser_use and the raw
examples: paths are relative to BU_API, not absolute
/api/v3/... Sub-agents were copy-pasting the old doc form and
getting 404s.
- Add a one-liner for looking up an existing cloud profile's UUID.
- Surface stop_remote_daemon in the Python API overview.
Housekeeping:
- Stopped 5 sub-agent-leftover remote browsers from today's testing
burst (not committed; just an operations note).
* skill: UUID lookup pattern must handle 0 and >1 matches (cubic review)
cubic flagged the one-liner as unsafe: 'next(p["id"] for p in … if …)'
raises StopIteration on no match and silently picks the first duplicate
when names repeat. Profile names genuinely aren't unique — sub-3 in the
same testing round surfaced a duplicate on this account — so use a list
comprehension and require exactly one match before using the UUID.
45 行
883 B
Python
45 行
883 B
Python
import sys
|
|
|
|
from admin import (
|
|
ensure_daemon,
|
|
list_cloud_profiles,
|
|
list_local_profiles,
|
|
restart_daemon,
|
|
start_remote_daemon,
|
|
stop_remote_daemon,
|
|
sync_local_profile,
|
|
)
|
|
from helpers import *
|
|
|
|
HELP = """Browser Harness
|
|
|
|
Read SKILL.md for the default workflow and examples.
|
|
|
|
Typical usage:
|
|
uv run bh <<'PY'
|
|
ensure_real_tab()
|
|
print(page_info())
|
|
PY
|
|
|
|
Helpers are pre-imported. The daemon auto-starts and connects to the running browser.
|
|
"""
|
|
|
|
|
|
def main():
|
|
if len(sys.argv) > 1 and sys.argv[1] in {"-h", "--help"}:
|
|
print(HELP)
|
|
return
|
|
if sys.stdin.isatty():
|
|
sys.exit(
|
|
"browser-harness reads Python from stdin. Use:\n"
|
|
" browser-harness <<'PY'\n"
|
|
" print(page_info())\n"
|
|
" PY"
|
|
)
|
|
ensure_daemon()
|
|
exec(sys.stdin.read())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|