k-skill-browser-runtime
v0.4.0
Published
Browser runtime adapter for k-skill packages with BrowserOS, Aside, and Chrome CDP providers
Maintainers
Readme
k-skill-browser-runtime
Browser runtime adapter for k-skill packages, with platform-aware automatic provider selection.
Scope
- The recommended default is
auto: macOS prefers Aside Browser, then BrowserOS, then Chrome/Chromium CDP. Other platforms preserve BrowserOS, Aside Browser, then Chrome/Chromium CDP. - BrowserOS is used as a GUI/session browser over CDP, not as a headless backend, CAPTCHA bypass, login solver, payment solver, or stealth scraping browser.
- The
browserosprovider connects to a user-launched BrowserOS session. It never launches BrowserOS and never passes headless flags. - The
asideprovider uses the publicaside replCLI surface. It does not rely on undocumented local ports or a private CDP endpoint. - Site-specific navigation, parsing, and irreversible-boundary decisions stay in each skill.
Providers
| Provider | Default surface | Launches browser | Intended use |
| --- | --- | --- | --- |
| auto (default) | macOS: aside repl, BrowserOS 9100, Chrome 9222; other platforms: BrowserOS, Aside, Chrome | No | Platform-aware fallback order |
| browseros | http://127.0.0.1:9100 | No | Force a user-launched BrowserOS GUI/session browser |
| aside | aside repl | No | Force an available Aside Browser session through the documented CLI REPL |
| chrome-cdp | http://127.0.0.1:9222 | No | Force a Chrome/Chromium CDP session |
Unknown provider names fail closed with a typed UNKNOWN_PROVIDER error rather than silently falling back to BrowserOS.
Environment
KSKILL_BROWSER_PROVIDERselectsauto(default),browseros,aside, orchrome-cdp.KSKILL_BROWSEROS_CDP_URLoverrides the BrowserOS CDP URL.KSKILL_CHROME_CDP_URLoverrides the Chrome CDP URL.KSKILL_ASIDE_COMMANDoverrides the Aside CLI command (defaultaside).
Lifecycle
For BrowserOS CDP and Chrome CDP sessions, disconnect automation clients instead of closing the browser application or persistent user profile. For Aside Browser sessions, close only tabs created by the adapter. Pre-existing user pages must not be closed.
Connect options
connect(options) selects and connects to a CDP endpoint. It supports dependency injection for tests:
options.probe—falseskips the CDP health probe; a function replaces the defaultprobeCdpprobe.options.connectLoader— function(cdpUrl, options) => browserreplacing the defaultconnectOverCDPpath (which lazily loadsplaywright-core/playwright/rebrowser-playwright).options.chromiumLoader— function passed through to the default CDP loader for lazy chromium resolution and caching.
connect() probes CDP providers with <cdpUrl>/json/version before connecting. For Aside, it runs a safe aside repl probe that lists tabs without opening a page. Provider failures throw UNAVAILABLE; unknown providers throw UNKNOWN_PROVIDER.
Stop rules
The runtime exports typed stop reasons for manual handoff boundaries: authentication, CAPTCHA, payment, electronic signature, irreversible submit, blocked upstream responses, and provider unavailability.
Job runner
runJob({ url, steps, stopOn }) is a narrow declared-step runner. It executes ONLY caller-supplied step functions in declared order and never invents navigation, generates steps, or plans site behavior.
steps— array of caller-supplied async functions({ page, results }) => result. Empty/non-arraystepsreturns{ status: "no-steps", results: [] }without navigating.url— optional. When a URL is supplied AND at least one caller step exists, the runner performs a singlepage.goto(url, { waitUntil: "domcontentloaded" })before the steps. No URL means no navigation.page— caller-supplied automation page (for example fromgetAutomationPage). Required only whenurlis supplied.stopOn— optional async callback({ page, phase, url, step, index, results }) => stopReason | nullinvoked at phase boundaries: once before navigation (phase: "navigate") and once before each step (phase: "step", withindex). A truthystopReasonshort-circuits to{ status: "stopped", stopReason, results }without bypassing manual handoff boundaries.
Returns { status, results } where status is "no-steps", "stopped", or "complete". Non-function steps throw a TypeError before any navigation or step execution.
