feat: agent browser (#200)

* feat: agent browser

* chore: complete docker and action config

* feat: more actions

* feat: browser tab switch

* fix: browser build

* fix: lint

* fix: migrations
This commit is contained in:
Acbox Liu
2026-03-07 15:06:00 +08:00
committed by GitHub
parent 21999b49f4
commit bafd327b6b
67 changed files with 3586 additions and 47 deletions
+255
View File
@@ -5118,6 +5118,204 @@ const docTemplate = `{
}
}
},
"/browser-contexts": {
"get": {
"description": "List all browser context configurations",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "List browser contexts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a browser context configuration",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Create a browser context",
"parameters": [
{
"description": "Browser context configuration",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/browsercontexts.CreateRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/browser-contexts/{id}": {
"get": {
"description": "Get browser context by ID",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Get a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"description": "Update browser context by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Update a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated configuration",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/browsercontexts.UpdateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"description": "Delete browser context by ID",
"tags": [
"browser-contexts"
],
"summary": "Delete a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/channels": {
"get": {
"description": "List channel meta information including capabilities and schemas",
@@ -7592,6 +7790,57 @@ const docTemplate = `{
}
}
},
"browsercontexts.BrowserContext": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"browsercontexts.CreateRequest": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
}
}
},
"browsercontexts.UpdateRequest": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
}
}
},
"channel.Action": {
"type": "object",
"properties": {
@@ -10313,6 +10562,9 @@ const docTemplate = `{
"allow_guest": {
"type": "boolean"
},
"browser_context_id": {
"type": "string"
},
"chat_model_id": {
"type": "string"
},
@@ -10357,6 +10609,9 @@ const docTemplate = `{
"allow_guest": {
"type": "boolean"
},
"browser_context_id": {
"type": "string"
},
"chat_model_id": {
"type": "string"
},
+255
View File
@@ -5109,6 +5109,204 @@
}
}
},
"/browser-contexts": {
"get": {
"description": "List all browser context configurations",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "List browser contexts",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"description": "Create a browser context configuration",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Create a browser context",
"parameters": [
{
"description": "Browser context configuration",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/browsercontexts.CreateRequest"
}
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/browser-contexts/{id}": {
"get": {
"description": "Get browser context by ID",
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Get a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "Not Found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"description": "Update browser context by ID",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"browser-contexts"
],
"summary": "Update a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
},
{
"description": "Updated configuration",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/browsercontexts.UpdateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/browsercontexts.BrowserContext"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"description": "Delete browser context by ID",
"tags": [
"browser-contexts"
],
"summary": "Delete a browser context",
"parameters": [
{
"type": "string",
"description": "Browser Context ID",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/channels": {
"get": {
"description": "List channel meta information including capabilities and schemas",
@@ -7583,6 +7781,57 @@
}
}
},
"browsercontexts.BrowserContext": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"created_at": {
"type": "string"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"updated_at": {
"type": "string"
}
}
},
"browsercontexts.CreateRequest": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
}
}
},
"browsercontexts.UpdateRequest": {
"type": "object",
"properties": {
"config": {
"type": "array",
"items": {
"type": "integer"
}
},
"name": {
"type": "string"
}
}
},
"channel.Action": {
"type": "object",
"properties": {
@@ -10304,6 +10553,9 @@
"allow_guest": {
"type": "boolean"
},
"browser_context_id": {
"type": "string"
},
"chat_model_id": {
"type": "string"
},
@@ -10348,6 +10600,9 @@
"allow_guest": {
"type": "boolean"
},
"browser_context_id": {
"type": "string"
},
"chat_model_id": {
"type": "string"
},
+168
View File
@@ -196,6 +196,39 @@ definitions:
user_id:
type: string
type: object
browsercontexts.BrowserContext:
properties:
config:
items:
type: integer
type: array
created_at:
type: string
id:
type: string
name:
type: string
updated_at:
type: string
type: object
browsercontexts.CreateRequest:
properties:
config:
items:
type: integer
type: array
name:
type: string
type: object
browsercontexts.UpdateRequest:
properties:
config:
items:
type: integer
type: array
name:
type: string
type: object
channel.Action:
properties:
label:
@@ -2007,6 +2040,8 @@ definitions:
properties:
allow_guest:
type: boolean
browser_context_id:
type: string
chat_model_id:
type: string
heartbeat_enabled:
@@ -2036,6 +2071,8 @@ definitions:
properties:
allow_guest:
type: boolean
browser_context_id:
type: string
chat_model_id:
type: string
heartbeat_enabled:
@@ -5576,6 +5613,137 @@ paths:
summary: Transfer bot owner (admin only)
tags:
- bots
/browser-contexts:
get:
description: List all browser context configurations
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/browsercontexts.BrowserContext'
type: array
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: List browser contexts
tags:
- browser-contexts
post:
consumes:
- application/json
description: Create a browser context configuration
parameters:
- description: Browser context configuration
in: body
name: request
required: true
schema:
$ref: '#/definitions/browsercontexts.CreateRequest'
produces:
- application/json
responses:
"201":
description: Created
schema:
$ref: '#/definitions/browsercontexts.BrowserContext'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Create a browser context
tags:
- browser-contexts
/browser-contexts/{id}:
delete:
description: Delete browser context by ID
parameters:
- description: Browser Context ID
in: path
name: id
required: true
type: string
responses:
"204":
description: No Content
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Delete a browser context
tags:
- browser-contexts
get:
description: Get browser context by ID
parameters:
- description: Browser Context ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/browsercontexts.BrowserContext'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"404":
description: Not Found
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Get a browser context
tags:
- browser-contexts
put:
consumes:
- application/json
description: Update browser context by ID
parameters:
- description: Browser Context ID
in: path
name: id
required: true
type: string
- description: Updated configuration
in: body
name: request
required: true
schema:
$ref: '#/definitions/browsercontexts.UpdateRequest'
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/browsercontexts.BrowserContext'
"400":
description: Bad Request
schema:
$ref: '#/definitions/handlers.ErrorResponse'
"500":
description: Internal Server Error
schema:
$ref: '#/definitions/handlers.ErrorResponse'
summary: Update a browser context
tags:
- browser-contexts
/channels:
get:
description: List channel meta information including capabilities and schemas