feat(sdk): headless-browser provider mode - #18
Open
iWedmak wants to merge 5 commits into
Open
Conversation
added 5 commits
August 2, 2026 19:26
Rent out a machine's browser as a public provider: - `ceki provider run`: launches Chromium (Playwright, headed under Xvfb) with the Ceki extension loaded, injects the one-time browser token and brings the browser online with auto-accept enabled. Port of the QA public-browser recipe (provider-runner.js) into the Python SDK; the extension handles the provider WebSocket protocol itself. - api_base normalization: accept both `https://host` and `https://host/api` for CEKI_API_URL / --api-url (request paths are built as base + /api/...). - docker/: provider image (python:3.11-slim + Chromium via playwright + staged extension dist), entrypoint that starts Xvfb and execs the provider as PID 1 for clean SIGTERM shutdown, docker-compose reference, build.sh that stages the extension dist at build time, README. - `[provider]` optional extra (playwright); .dockerignore keeps the staged extension dist out of git. - tests: provider resolve helpers + CLI provider parser (10 tests).
…ces, automation flag)
- cli: _daemon_request returns (ok, result) tuple; callers branch on 'ok', a null result from a void command is success, not a failure signal - daemon: reuse one shared Client per api_key (single WS, no per-rent leak); drop session from registry on session.ended; disconnect shared client only when the last session ends - tests: unit regression for CLI void-command fallback and daemon WS reuse
The relay ends a session with 'session_ended' (underscore) carrying the id in 'event_id', not 'session.ended'/'session_id' which the client listened for. Relay-initiated ends (provider death, admin stop, backend reaper) were therefore silently dropped, leaving a zombie entry in the daemon's session registry and a live WS to the relay until an explicit /stop. - dispatch: accept session.ended / session_end / session_ended, read the id from session_id or event_id - dispatch: error -1011/-1018 with a session id is a session end, route it through the same cleanup (browser teardown + daemon hook) instead of logging it as an unhandled relay error - tests: unit + WS-level E2E reproducing the provider-death sequence (session.provider_disconnected -> grace -> error -1011 + session_ended) verifying the daemon drops the session and closes the shared WS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
provider mode в SDK (ceki_sdk/_provider.py) — SDK разворачивает браузер-провайдера: token из ЛК -> провайдер online. Docker-образ вынесен в отдельный публичный репо Ceki-me/docker-browser.
Что в PR
Проверено