refactor(browser): split browser cores via build ARG, add core selector (#237)

* refactor(browser): split browser cores via build ARG, add core selector

- Replace playwright official image with ubuntu:noble base in both
  docker/Dockerfile.browser and devenv/Dockerfile.browser; install
  browsers at build time driven by ARG/ENV BROWSER_CORES
- Add GET /cores endpoint to Browser Gateway reporting available cores
- Proxy GET /browser-contexts/cores in Go handler to Browser Gateway
- Add `core` field to BrowserContextConfigModel and GatewayBrowserContext;
  context creation selects the appropriate browser instance by core
- Frontend context-setting page fetches available cores and renders a
  core selector; saves core as part of the config JSON
- install.sh prompts for browser core selection and writes BROWSER_CORES
  to .env; builds the browser image locally before docker compose up
- Regenerate OpenAPI spec and TypeScript SDK

* fix: lint
This commit is contained in:
Acbox Liu
2026-03-14 12:37:20 +08:00
committed by GitHub
parent 627b673a5c
commit c8728ffc2c
22 changed files with 364 additions and 33 deletions
+37
View File
@@ -5482,6 +5482,32 @@ const docTemplate = `{
}
}
},
"/browser-contexts/cores": {
"get": {
"description": "Get the list of browser cores available in the Browser Gateway container",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Get available browser cores",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.BrowserCoresResponse"
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/browser-contexts/{id}": {
"get": {
"description": "Get browser context by ID",
@@ -10039,6 +10065,17 @@ const docTemplate = `{
}
}
},
"handlers.BrowserCoresResponse": {
"type": "object",
"properties": {
"cores": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"handlers.ChannelMeta": {
"type": "object",
"properties": {
+37
View File
@@ -5473,6 +5473,32 @@
}
}
},
"/browser-contexts/cores": {
"get": {
"description": "Get the list of browser cores available in the Browser Gateway container",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Get available browser cores",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.BrowserCoresResponse"
}
},
"502": {
"description": "Bad Gateway",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/browser-contexts/{id}": {
"get": {
"description": "Get browser context by ID",
@@ -10030,6 +10056,17 @@
}
}
},
"handlers.BrowserCoresResponse": {
"type": "object",
"properties": {
"cores": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"handlers.ChannelMeta": {
"type": "object",
"properties": {
+25
View File
@@ -1001,6 +1001,13 @@ definitions:
type: string
type: array
type: object
handlers.BrowserCoresResponse:
properties:
cores:
items:
type: string
type: array
type: object
handlers.ChannelMeta:
properties:
capabilities:
@@ -6178,6 +6185,24 @@ paths:
summary: Update a browser context
tags:
- browser-contexts
/browser-contexts/cores:
get:
description: Get the list of browser cores available in the Browser Gateway
container
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handlers.BrowserCoresResponse'
"502":
description: Bad Gateway
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get available browser cores
tags:
- browser-contexts
/channels:
get:
description: List channel meta information including capabilities and schemas