Repository navigation
preliminary support for browser automations - #328
Conversation
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.55-pr.328.bc88e75Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.55-pr.328.bc88e75"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.55-pr.328.bc88e75"
}
}
Preview published to npm registry — try new features instantly! |
5f05cd2 to
a6a77a6
Compare
There was a problem hiding this comment.
Approved, with a few points:
-
Release order (question).
BrowserModulegoes into the public docs (types-to-expose.json), but/api/v1/browser-sessionsisn't on apper main yet (only on thebrowser_automation_*branches). If the SDK ships first,getSession()404s for anyone following the docs. What's the plan: hold the docs exposure until the endpoint is live, or is that fine for a "preliminary" release? -
Naming:
getSession()→createSession()? Every call creates (and bills) a fresh session, and "get" reads as idempotent. Public API names are hard to change after release, so now's the cheap moment. The brain contract test in apper would need the same rename. -
Timeout docs (
browser.types.ts,sessionTimeoutSeconds): the backend clamps to 60–900 s, defaults to 300, and applies it as total session lifetime. Worth stating those here instead of "depending on the provider…", so users don't have to guess. -
nit, test (
browser.test.ts:188):nock.pendingMocks()is always[]here because nothing is mocked, so it can't catch a request.nock.disableNetConnect()in this test, or a mock plusexpect(scope.isDone()).toBe(false), would actually prove no request was sent. -
Docs example (
browser.types.ts:80): doesbrowser.contexts()[0]exist whenconnectionScopeis'page'? If contexts can be empty,browser.contexts()[0]?.pages()[0] ?? await browser.newPage()is safer for people who copy-paste.
I was missing context, researched and found some in #feat-browser-api and #browserbase-base44
agent: review.328
🚀 Package Preview Available! (
|
Summary
Adds a
browsermodule to the SDK so backend code can run browser automation on remote browser sessions. It is available only onbase44.asServiceRole.getSession(options?)creates a session and returns a CDP connection URL to use with Playwright, Puppeteer or Stagehand. It also returns anend()helper.endSession(sessionId)ends a session that was created in an earlier request.captureDebugArtifactsturns recordings and logs on or off. It defaults totrue.sessionTimeoutSecondssets a custom session timeout. The backend clamps it and applies its own default when the option is omitted.Backend counterpart: base44-dev/apper#31752.
Testing
Unit tests in
packages/sdk/tests/unit/browser.test.tscover request mapping, option forwarding, error codes and the service-role requirement.