HubStudio Integration Guide
Table of Contents
- 1. Introduction
- Installation
- Configure HubStudio
- Using API/CLI
- Connection Details
- Automation Examples
- FAQ
- Advanced Usage
- ADB Connection Skill
- Resources
Introduction
HubStudio provides browser environment automation, cloud phone operations, environment management, account management, and group management through local APIs.
This Skill is designed to:
- - Locate all HubStudio endpoints quickly
- Explain request/response fields and constraints
- Provide safe call patterns for automation
- Standardize API testing and troubleshooting
Core docs:
Installation
1. Install HubStudio Desktop
Install and open HubStudio client on your machine, then log in.
2. Verify Local API Service
The current OpenAPI file uses:
CODEBLOCK0
Verify service health with:
CODEBLOCK1
3. Install Optional Tooling
CODEBLOCK2
Configure HubStudio
1. Login and Prepare Data
- 1. Login to HubStudio client
- Ensure browser environments/cloud phones exist
- Confirm local API is reachable
2. Configure Runtime Variables (Optional)
CODEBLOCK3
3. Timing Notes
- - Browser environment startup typically takes 3-5 seconds
- Cloud phone startup typically takes 30-90 seconds
- Build retry/timeout logic based on those windows
Using API/CLI
HubStudio OpenAPI in this project contains 56 operations across these domains:
- - Browser Environment
- Cloud Phone
- Environment Management
- Account Management
- Group Management
Recommended Call Pattern
CODEBLOCK4
Node CLI (Direct Execution)
This project includes hubstudio.js, so you can execute capabilities directly:
CODEBLOCK5
INLINECODE1 now supports all OpenAPI endpoints via generated commands in commands.generated.json.
Example generated command:
CODEBLOCK6
Cloud Phone ADB Commands
CODEBLOCK7
Common Browser Environment APIs
CODEBLOCK8
Discover Full Endpoint Details
- All endpoints and methods
- Request/response field descriptions
- Required fields and constraints
- Grouped view by tags
Connection Details
Base URL
From openapi.yaml:
CODEBLOCK9
Response Convention
Most endpoints return:
CODEBLOCK10
Interpretation:
- -
code = 0: success - non-zero code: business error (missing field, not found, permission, precondition)
Automation Examples
Example 1: Open Browser Environment
CODEBLOCK11
Example 2: Query Running Browser Environments
CODEBLOCK12
Example 3: Smoke Test All OpenAPI Endpoints
CODEBLOCK13
Example 4: Validate Skill Completeness
CODEBLOCK14
FAQ
Q1: API Returns HTTP 200 But Business Failure
This is expected for many endpoints. Check response body code and msg for business-level result.
Q2: Environment Open Failed
Check:
- 1.
containerCode is correct - Environment exists in current account/workspace
- HubStudio client is logged in and local service is running
Q3: Why Some Endpoint Tests Fail with Missing Parameters?
Endpoint smoke tests are designed for reachability first. Business failures due to required params/resources are normal unless strict case data is provided.
Q4: How to Find Required Fields?
Use reference.md. Each endpoint lists:
- - Required parameters
- Request body required fields
- Type and constraint details
Advanced Usage
1. OpenClaw Integration
In OpenClaw workflows, call HubStudio endpoints directly with structured payloads:
CODEBLOCK15
2. Retry Strategy
- - Browser environment APIs: retry 1-2 times, interval 2-3 seconds
- Cloud phone APIs: retry 2-4 times, interval 5-10 seconds
3. Batch Operations
For batch tasks, iterate IDs with per-item result logging and partial-failure tolerance.
4. Validation Loop
- 1. Update data in INLINECODE8
- Re-generate INLINECODE9
- Run INLINECODE10
- Run endpoint smoke tests and inspect INLINECODE11
ADB Connection Skill
Use this capability when the user asks to connect cloud phones through ADB.
- - Android 12 / Android 15: direct
adb connect <ip:port> mode - Android 13 / Android 14 / Android 15A: SSH tunnel +
adb connect localhost:<port> mode - Full guide and command templates: ADBCONNECTION_GUIDE.md
Execution rule:
- 1. Ensure cloud phone is powered on
- Enable ADB via INLINECODE14
- Query ADB info via INLINECODE15
- Choose direct or tunnel workflow by Android version
- Validate with INLINECODE16
Resources
HubStudio 集成指南
目录
- 1. 简介
- 安装
- 配置 HubStudio
- 使用 API/CLI
- 连接详情
- 自动化示例
- 常见问题
- 高级用法
- ADB 连接技能
- 资源
简介
HubStudio 通过本地 API 提供浏览器环境自动化、云手机操作、环境管理、账号管理和群组管理功能。
本技能旨在:
- - 快速定位所有 HubStudio 端点
- 解释请求/响应字段及约束条件
- 提供安全的自动化调用模式
- 标准化 API 测试和故障排查
核心文档:
安装
1. 安装 HubStudio 桌面端
在您的机器上安装并打开 HubStudio 客户端,然后登录。
2. 验证本地 API 服务
当前 OpenAPI 文件使用:
bash
http://127.0.0.1:6873
使用以下命令验证服务健康状态:
bash
curl -s -X POST http://127.0.0.1:6873/api/v1/browser/all-browser-status \
-H Content-Type: application/json \
-d {}
3. 安装可选工具
bash
API 调用和 JSON 检查
brew install curl jq
Python 验证脚本
python3 -m pip install --user pyyaml
配置 HubStudio
1. 登录并准备数据
- 1. 登录 HubStudio 客户端
- 确保存在浏览器环境/云手机
- 确认本地 API 可访问
2. 配置运行时变量(可选)
bash
export HUBSTUDIOBASEURL=http://127.0.0.1:6873
export HUBSTUDIOAUTHTOKEN=
3. 时间说明
- - 浏览器环境启动通常需要 3-5 秒
- 云手机启动通常需要 30-90 秒
- 根据这些时间窗口构建重试/超时逻辑
使用 API/CLI
本项目中的 HubStudio OpenAPI 包含以下领域的 56 个操作:
推荐调用模式
bash
curl -s -X POST $HUBSTUDIOBASEURL/ \
-H Content-Type: application/json \
-d
Node CLI(直接执行)
本项目包含 hubstudio.js,因此可以直接执行功能:
bash
node hubstudio.js help
node hubstudio.js list
node hubstudio.js browserCreate
node hubstudio.js browserStart 1474900026
node hubstudio.js browserStatus 1474900026
node hubstudio.js browserForeground 1474900026
node hubstudio.js browserArrange
node hubstudio.js browserStop 1474900026
node hubstudio.js testAll
hubstudio.js 现在通过 commands.generated.json 中生成的命令支持所有 OpenAPI 端点。
生成的命令示例:
bash
node hubstudio.js postV1BrowserStart --body {containerCode:1474900026}
云手机 ADB 命令
bash
启用 ADB
node hubstudio.js postV1CloudMobileBatchUpdateAdb --body {mobileIds:[
],enableAdb:true}
查询 ADB 连接信息
node hubstudio.js postV1CloudMobileListAdb --body {mobileIds:[]}
常用浏览器环境 API
bash
打开环境
curl -s -X POST http://127.0.0.1:6873/api/v1/browser/start \
-H Content-Type: application/json \
-d {containerCode:1474900026}
关闭环境
curl -s -X POST http://127.0.0.1:6873/api/v1/browser/stop \
-H Content-Type: application/json \
-d {containerCode:1474900026}
获取所有打开环境的状态
curl -s -X POST http://127.0.0.1:6873/api/v1/browser/all-browser-status \
-H Content-Type: application/json \
-d {}
发现完整端点详情
- 所有端点和方法
- 请求/响应字段描述
- 必填字段和约束条件
- 按标签分组视图
连接详情
基础 URL
来自 openapi.yaml:
bash
http://127.0.0.1:6873
响应约定
大多数端点返回:
json
{
code: 0,
msg: Success,
data: {}
}
解释:
- - code = 0:成功
- 非零 code:业务错误(缺少字段、未找到、权限、前置条件)
自动化示例
示例 1:打开浏览器环境
bash
node hubstudio.js browserStart 1474900026
示例 2:查询运行中的浏览器环境
bash
node hubstudio.js browserStatus
示例 3:对所有 OpenAPI 端点进行冒烟测试
bash
当前冒烟测试报告(先前生成):
cat scripts/endpointtestreport.json | jq .total, .reachable, .transportfailcount
示例 4:验证技能完整性
bash
python3 scripts/validate_completeness.py
常见问题
问题 1:API 返回 HTTP 200 但业务失败
这是许多端点的预期行为。请检查响应体中的 code 和 msg 以获取业务级别结果。
问题 2:环境打开失败
检查:
- 1. containerCode 是否正确
- 环境在当前账号/工作空间中是否存在
- HubStudio 客户端已登录且本地服务正在运行
问题 3:为什么某些端点测试因缺少参数而失败?
端点冒烟测试首先测试可达性。因必需参数/资源导致的业务失败是正常的,除非提供了严格的案例数据。
问题 4:如何找到必填字段?
使用 reference.md。每个端点列出:
高级用法
1. OpenClaw 集成
在 OpenClaw 工作流中,直接使用结构化负载调用 HubStudio 端点:
bash
示例:打开环境
openclaw hubstudio call --path /api/v1/browser/start \
--method POST \
--body {containerCode:1474900026}
2. 重试策略
- - 浏览器环境 API:重试 1-2 次,间隔 2-3 秒
- 云手机 API:重试 2-4 次,间隔 5-10 秒
3. 批量操作
对于批量任务,遍历 ID 并记录每个项目的结果,容忍部分失败。
4. 验证循环
- 1. 更新 openapi.yaml 中的数据
- 重新生成 reference.md
- 运行 python3 scripts/validatecompleteness.py
- 运行端点冒烟测试并检查 scripts/endpointtest_report.json
ADB 连接技能
当用户要求通过 ADB 连接云手机时使用此功能。
- - Android 12 / Android 15:直接 adb connect 模式
- Android 13 / Android 14 / Android 15A:SSH 隧道 + adb connect localhost: 模式
- 完整指南和命令模板:ADBCONNECTION_GUIDE.md
执行规则:
- 1. 确保云手机已开机
- 通过 postV1CloudMobileBatchUpdateAdb 启用 ADB
- 通过 postV1CloudMobileListAdb 查询 ADB 信息
- 根据 Android 版本选择直接或隧道工作流
- 使用 adb devices 验证
资源