@next-open-ai/openbot 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -10
- package/desktop/README.md +210 -0
- package/desktop/renderer/dist/assets/index-1nA9hbE0.js +89 -0
- package/desktop/renderer/dist/assets/index-C_kMPPGO.css +10 -0
- package/desktop/renderer/dist/assets/logo-RfPiqt5-.png +0 -0
- package/desktop/renderer/dist/index.html +22 -0
- package/dist/agent/agent-manager.js +15 -0
- package/dist/cli.js +34 -33
- package/dist/config/desktop-config.d.ts +67 -0
- package/dist/config/desktop-config.js +334 -0
- package/dist/config/provider-support-default.d.ts +19 -0
- package/dist/config/provider-support-default.js +44 -0
- package/dist/gateway/backend-url.js +1 -1
- package/dist/gateway/methods/agent-chat.js +25 -72
- package/dist/gateway/methods/connect.d.ts +2 -1
- package/dist/gateway/methods/connect.js +7 -4
- package/dist/gateway/methods/install-skill-from-path.js +4 -37
- package/dist/gateway/methods/run-scheduled-task.d.ts +3 -1
- package/dist/gateway/methods/run-scheduled-task.js +22 -60
- package/dist/gateway/server.js +13 -8
- package/dist/gateway/types.d.ts +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/installer/index.d.ts +1 -0
- package/dist/installer/index.js +1 -0
- package/dist/installer/skill-installer.d.ts +30 -0
- package/dist/installer/skill-installer.js +121 -0
- package/dist/server/agents/agents.gateway.js +1 -1
- package/dist/server/config/config.controller.d.ts +14 -2
- package/dist/server/config/config.controller.js +18 -4
- package/dist/server/config/config.service.d.ts +37 -1
- package/dist/server/config/config.service.js +27 -10
- package/dist/server/main.js +6 -2
- package/dist/server/tasks/tasks.module.js +2 -1
- package/dist/server/tasks/tasks.service.d.ts +3 -1
- package/dist/server/tasks/tasks.service.js +17 -3
- package/dist/tools/install-skill-tool.d.ts +2 -5
- package/dist/tools/install-skill-tool.js +13 -37
- package/package.json +4 -2
- package/dist/agent/desktop-config.d.ts +0 -15
- package/dist/agent/desktop-config.js +0 -91
- package/dist/gateway/desktop-config.d.ts +0 -7
- package/dist/gateway/desktop-config.js +0 -25
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
| 能力 | 说明 |
|
|
14
14
|
|------|------|
|
|
15
|
-
| **技能架构** | 基于
|
|
15
|
+
| **技能架构** | 基于 Agent Skills 规范,支持多路径加载、本地安装与动态扩展 |
|
|
16
16
|
| **编码智能体** | 集成 [pi-coding-agent](https://www.npmjs.com/package/@mariozechner/pi-coding-agent),支持多轮工具调用与代码执行 |
|
|
17
17
|
| **浏览器自动化** | 内置 [agent-browser](https://www.npmjs.com/package/agent-browser),可导航、填表、截图与数据抓取 |
|
|
18
18
|
| **长期记忆** | 向量存储(Vectra)+ 本地嵌入,支持经验总结与会话压缩(compaction) |
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
│ 客户端 / 接入层 │
|
|
28
28
|
├─────────────────┬─────────────────────────────┬─────────────────────────────┤
|
|
29
29
|
│ CLI (openbot) │ WebSocket Gateway (JSON-RPC) │ OpenBot Desktop (Electron) │
|
|
30
|
-
│ Commander │ ws, 端口
|
|
30
|
+
│ Commander │ ws, 端口 38080 │ Vue 3 + Pinia + Vite │
|
|
31
31
|
└────────┬────────┴──────────────┬──────────────┴──────────────┬──────────────┘
|
|
32
32
|
│ │ │
|
|
33
33
|
│ │ HTTP + Socket.io │
|
|
@@ -54,10 +54,21 @@
|
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
- **CLI**:直接调用 Agent 核心,单次提示或批量脚本。
|
|
57
|
-
- **Gateway
|
|
58
|
-
- **Desktop
|
|
57
|
+
- **WebSocket Gateway**(`src/gateway/`):对外提供 WebSocket(JSON-RPC),供 Web/移动端连接;负责起端口、拉 Nest 后端子进程、代理 `/server-api` 请求。**与「Desktop 后端」是不同进程。**
|
|
58
|
+
- **Desktop 后端**(`src/server/`):NestJS HTTP API,即 **server-api**;会话、智能体配置、技能、任务、工作区、鉴权等由本模块提供。桌面前端与 Gateway 通过 HTTP 调用此服务。
|
|
59
|
+
- **Desktop**:Electron 包一层 Vue 前端 + 上述后端;通过 Gateway 或直连 Desktop 后端与 Agent 通信。
|
|
59
60
|
- **Agent 核心**:统一由 `AgentManager` 管理会话、技能注入与工具注册;记忆与 compaction 作为扩展参与 system prompt 与经验写入。
|
|
60
61
|
|
|
62
|
+
### 目录与模块对应
|
|
63
|
+
|
|
64
|
+
| 目录 | 说明 |
|
|
65
|
+
|------|------|
|
|
66
|
+
| `src/server/` | **Desktop 后端**(NestJS),HTTP API,前缀 `server-api`。不要与「Gateway 进程」混淆。 |
|
|
67
|
+
| `src/gateway/` | **WebSocket 网关**,独立进程,提供 WS JSON-RPC 并代理到 Desktop 后端。 |
|
|
68
|
+
| `src/agent/` | Agent 核心(CLI 与 Gateway 共用)。 |
|
|
69
|
+
| `src/config/` | 桌面配置读取(~/.openbot/desktop),CLI 与 Gateway 共用。 |
|
|
70
|
+
| `examples/workspace/` | 示例工作区数据(仅示例/测试用)。真实工作区根目录为 `~/.openbot/workspace/`。 |
|
|
71
|
+
|
|
61
72
|
---
|
|
62
73
|
|
|
63
74
|
## 各端技术栈
|
|
@@ -77,7 +88,7 @@
|
|
|
77
88
|
| 类别 | 技术 |
|
|
78
89
|
|------|------|
|
|
79
90
|
| 协议 | JSON-RPC over WebSocket(`ws`) |
|
|
80
|
-
| 端口 | 默认
|
|
91
|
+
| 端口 | 默认 38080,可 `-p` 指定 |
|
|
81
92
|
| 职责 | 连接管理、消息路由、静态资源、拉 Nest 子进程 |
|
|
82
93
|
| 方法 | `connect`、`agent.chat`、`agent.cancel`、`subscribe_session`、`unsubscribe_session` 等 |
|
|
83
94
|
|
|
@@ -133,7 +144,7 @@
|
|
|
133
144
|
### 环境要求
|
|
134
145
|
|
|
135
146
|
- **Node.js** ≥ 20
|
|
136
|
-
- 可选:`OPENAI_API_KEY`
|
|
147
|
+
- 可选:`OPENAI_API_KEY` (按所用 provider 配置)
|
|
137
148
|
|
|
138
149
|
### 安装与构建
|
|
139
150
|
|
|
@@ -154,17 +165,51 @@ openbot -s ./skills "用 find-skills 搜一下 PDF 相关技能"
|
|
|
154
165
|
# 仅打印 system/user prompt,不调 LLM
|
|
155
166
|
openbot --dry-run --prompt "查北京天气"
|
|
156
167
|
|
|
157
|
-
# 指定模型与 provider
|
|
168
|
+
# 指定模型与 provider(覆盖桌面缺省)
|
|
158
169
|
openbot --model deepseek-chat --provider deepseek "写一段 TypeScript 示例"
|
|
159
170
|
```
|
|
160
171
|
|
|
172
|
+
### CLI 配置模型选项
|
|
173
|
+
|
|
174
|
+
CLI 与桌面端共用**桌面配置**(`~/.openbot/desktop/config.json`)。未在命令行显式指定 `--provider` / `--model` 时,将使用该配置中的**缺省智能体**对应的 provider 与 model;若该智能体未单独配置模型,则使用全局缺省模型。
|
|
175
|
+
|
|
176
|
+
| 操作 | 命令 | 说明 |
|
|
177
|
+
|------|------|------|
|
|
178
|
+
| 保存 API Key | `openbot login <provider> <apiKey>` | 将某 Provider 的 API Key 写入桌面配置,供 CLI 与桌面端共用 |
|
|
179
|
+
| 设置缺省模型 | `openbot config set-model <provider> <modelId>` | 在桌面配置中设置全局缺省 provider 与 model(如 `deepseek` / `deepseek-chat`) |
|
|
180
|
+
| 查看配置 | `openbot config list` | 列出桌面配置中的 providers 与缺省模型 |
|
|
181
|
+
| 同步到 Agent 目录 | `openbot config sync` | 将桌面配置同步到 `~/.openbot/agent/models.json`,供 pi-agent 使用 |
|
|
182
|
+
|
|
183
|
+
**常用 Provider 示例**:`deepseek`、`dashscope`、`openai`、`openai-custom`(自定义 OpenAI 兼容端点)、`nvidia`、`kimi`。模型 ID 需与各 Provider 支持的一致(如 DeepSeek 的 `deepseek-chat`、OpenAI 的 `gpt-4o`);使用 `openai-custom` 时可填写自部署模型的 ID。
|
|
184
|
+
|
|
185
|
+
**命令行覆盖**:单次执行时可用 `--provider`、`--model`、`--api-key` 覆盖配置或环境变量中的值。
|
|
186
|
+
|
|
187
|
+
**环境变量**:未在桌面配置中保存 API Key 时,会回退到环境变量,例如 `OPENAI_API_KEY`、`DEEPSEEK_API_KEY`、`DASHSCOPE_API_KEY` 等(详见 `openbot --help` 末尾的 Environment 说明)。
|
|
188
|
+
|
|
189
|
+
**首次使用建议**:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# 1. 保存 API Key(任选其一或多种)
|
|
193
|
+
openbot login deepseek YOUR_DEEPSEEK_API_KEY
|
|
194
|
+
# openbot login openai YOUR_OPENAI_API_KEY
|
|
195
|
+
|
|
196
|
+
# 2. 设置缺省模型
|
|
197
|
+
openbot config set-model deepseek deepseek-chat
|
|
198
|
+
|
|
199
|
+
# 3. 可选:同步到 agent 目录(桌面端保存配置后也会自动同步)
|
|
200
|
+
openbot config sync
|
|
201
|
+
|
|
202
|
+
# 4. 直接对话
|
|
203
|
+
openbot "总结一下当前有哪些技能"
|
|
204
|
+
```
|
|
205
|
+
|
|
161
206
|
### 启动 WebSocket 网关
|
|
162
207
|
|
|
163
208
|
```bash
|
|
164
|
-
openbot gateway --port
|
|
209
|
+
openbot gateway --port 38080
|
|
165
210
|
```
|
|
166
211
|
|
|
167
|
-
客户端通过 `ws://localhost:
|
|
212
|
+
客户端通过 `ws://localhost:38080` 连接,使用 JSON-RPC 调用 `connect`、`agent.chat` 等。
|
|
168
213
|
|
|
169
214
|
### 启动桌面端
|
|
170
215
|
|
|
@@ -195,7 +240,7 @@ npm run desktop:install
|
|
|
195
240
|
## 开发
|
|
196
241
|
|
|
197
242
|
```bash
|
|
198
|
-
#
|
|
243
|
+
# 单元/集成测试(含 config/desktop-config、gateway/utils、server agents e2e)
|
|
199
244
|
npm test
|
|
200
245
|
|
|
201
246
|
# 仅 e2e
|
|
@@ -205,6 +250,8 @@ npm run test:e2e
|
|
|
205
250
|
npm run test:memory
|
|
206
251
|
```
|
|
207
252
|
|
|
253
|
+
测试分布:`test/config/` 桌面配置、`test/gateway/` 网关工具方法、`test/server/` Nest 后端 e2e。
|
|
254
|
+
|
|
208
255
|
---
|
|
209
256
|
|
|
210
257
|
## 许可证
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# OpenBot Desktop Application
|
|
2
|
+
|
|
3
|
+
A professional desktop application for managing and executing AI agents with real-time chat, session management, and skills browsing.
|
|
4
|
+
|
|
5
|
+
## 🚀 Features
|
|
6
|
+
|
|
7
|
+
- **Real-time Agent Chat**: Stream responses from AI agents with live tool execution visualization
|
|
8
|
+
- **Session Management**: Create, manage, and switch between multiple agent sessions
|
|
9
|
+
- **Skills Browser**: Browse and explore available agent skills with detailed documentation
|
|
10
|
+
- **Professional UI**: Modern glassmorphism design with dark/light theme support
|
|
11
|
+
- **WebSocket Integration**: Real-time communication with OpenBot gateway service
|
|
12
|
+
- **Configuration Management**: Flexible agent and workspace configuration
|
|
13
|
+
|
|
14
|
+
## 📋 Prerequisites
|
|
15
|
+
|
|
16
|
+
- Node.js >= 20.0.0
|
|
17
|
+
- npm or yarn
|
|
18
|
+
- OpenBot gateway service running
|
|
19
|
+
|
|
20
|
+
## 🛠️ Installation
|
|
21
|
+
|
|
22
|
+
### 1. Install Dependencies
|
|
23
|
+
|
|
24
|
+
From the openbot root directory:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Install desktop app dependencies
|
|
28
|
+
npm run desktop:install
|
|
29
|
+
|
|
30
|
+
# Or install manually
|
|
31
|
+
cd desktop
|
|
32
|
+
npm install
|
|
33
|
+
cd server && npm install
|
|
34
|
+
cd ../renderer && npm install
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 2. Build OpenBot Core
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# From openbot root
|
|
41
|
+
npm install
|
|
42
|
+
npm run build
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 🎯 Usage
|
|
46
|
+
|
|
47
|
+
### Development Mode
|
|
48
|
+
|
|
49
|
+
Start all services in development mode:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Terminal 1: Start OpenBot Gateway
|
|
53
|
+
npm run build
|
|
54
|
+
node dist/gateway/server.js
|
|
55
|
+
|
|
56
|
+
# Terminal 2: Start Desktop App (from openbot root)
|
|
57
|
+
npm run desktop:dev
|
|
58
|
+
|
|
59
|
+
# Or from desktop directory
|
|
60
|
+
cd desktop
|
|
61
|
+
npm run dev
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
This will start:
|
|
65
|
+
- NestJS backend on `http://localhost:38081`
|
|
66
|
+
- Vue.js frontend on `http://localhost:5173`
|
|
67
|
+
- Electron desktop window
|
|
68
|
+
|
|
69
|
+
### Production Build
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cd desktop
|
|
73
|
+
npm run build
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 🏗️ Architecture
|
|
77
|
+
|
|
78
|
+
### Backend (NestJS)
|
|
79
|
+
|
|
80
|
+
- **Agents Module**: Session management and gateway integration
|
|
81
|
+
- **Skills Module**: Skills browsing and documentation
|
|
82
|
+
- **Config Module**: Application configuration management
|
|
83
|
+
- **WebSocket Gateway**: Real-time event streaming
|
|
84
|
+
|
|
85
|
+
### Frontend (Vue.js)
|
|
86
|
+
|
|
87
|
+
- **Dashboard**: Overview and quick actions
|
|
88
|
+
- **Agent Chat**: Real-time chat interface with streaming
|
|
89
|
+
- **Sessions**: Session management and history
|
|
90
|
+
- **Skills**: Skills browser with modal details
|
|
91
|
+
- **Configuration**: Agent and workspace settings
|
|
92
|
+
- **Settings**: Application preferences
|
|
93
|
+
|
|
94
|
+
### Communication Flow
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Desktop UI (Vue.js)
|
|
98
|
+
↓ HTTP/WebSocket
|
|
99
|
+
NestJS Backend
|
|
100
|
+
↓ WebSocket
|
|
101
|
+
OpenBot Gateway
|
|
102
|
+
↓
|
|
103
|
+
Agent Manager
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 📁 Directory Structure
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
desktop/
|
|
110
|
+
├── main.js # Electron main process
|
|
111
|
+
├── preload.js # Electron preload script
|
|
112
|
+
├── package.json # Root dependencies
|
|
113
|
+
├── server/ # NestJS backend
|
|
114
|
+
│ ├── src/
|
|
115
|
+
│ │ ├── agents/ # Agent management
|
|
116
|
+
│ │ ├── skills/ # Skills browsing
|
|
117
|
+
│ │ ├── config/ # Configuration
|
|
118
|
+
│ │ └── main.ts # Entry point
|
|
119
|
+
│ └── package.json
|
|
120
|
+
└── renderer/ # Vue.js frontend
|
|
121
|
+
├── src/
|
|
122
|
+
│ ├── views/ # Page components
|
|
123
|
+
│ ├── components/ # Reusable components
|
|
124
|
+
│ ├── store/ # Pinia state management
|
|
125
|
+
│ ├── router/ # Vue Router
|
|
126
|
+
│ ├── api/ # API client
|
|
127
|
+
│ └── assets/ # Styles and assets
|
|
128
|
+
└── package.json
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## 🎨 Design System
|
|
132
|
+
|
|
133
|
+
The application uses a professional design system with:
|
|
134
|
+
|
|
135
|
+
- **Glassmorphism effects**: Modern translucent UI elements
|
|
136
|
+
- **Gradient accents**: Vibrant color gradients for primary actions
|
|
137
|
+
- **Smooth animations**: Fade, slide, and pulse animations
|
|
138
|
+
- **Dark/Light themes**: Automatic theme switching
|
|
139
|
+
- **Typography**: Inter for UI, Roboto Mono for code
|
|
140
|
+
- **Responsive layouts**: Adapts to different window sizes
|
|
141
|
+
|
|
142
|
+
## 🔧 Configuration
|
|
143
|
+
|
|
144
|
+
Configuration is stored in `~/.openbot/desktop/config.json`:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"gatewayUrl": "ws://localhost:38080",
|
|
149
|
+
"defaultProvider": "deepseek",
|
|
150
|
+
"defaultModel": "deepseek-chat",
|
|
151
|
+
"defaultAgentId": "default",
|
|
152
|
+
"theme": "dark"
|
|
153
|
+
}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
(`defaultAgentId` 表示缺省智能体 id。)
|
|
157
|
+
|
|
158
|
+
## 🐛 Troubleshooting
|
|
159
|
+
|
|
160
|
+
### Gateway Connection Issues
|
|
161
|
+
|
|
162
|
+
If the desktop app can't connect to the gateway:
|
|
163
|
+
|
|
164
|
+
1. Ensure the gateway is running: `node dist/gateway/server.js`
|
|
165
|
+
2. Check the gateway URL in Configuration
|
|
166
|
+
3. Verify no firewall is blocking port 38080
|
|
167
|
+
|
|
168
|
+
### Build Errors
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Clean and rebuild
|
|
172
|
+
cd desktop
|
|
173
|
+
rm -rf node_modules server/node_modules renderer/node_modules
|
|
174
|
+
npm install
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### WebSocket Not Connecting
|
|
178
|
+
|
|
179
|
+
Check that:
|
|
180
|
+
- NestJS backend is running on port 38081
|
|
181
|
+
- Frontend is connecting to the correct backend URL
|
|
182
|
+
- CORS is properly configured
|
|
183
|
+
|
|
184
|
+
## 📝 Development Tips
|
|
185
|
+
|
|
186
|
+
### Hot Reload
|
|
187
|
+
|
|
188
|
+
All three services support hot reload:
|
|
189
|
+
- Electron: Restart on main process changes
|
|
190
|
+
- NestJS: Auto-restart on file changes
|
|
191
|
+
- Vue.js: Hot module replacement
|
|
192
|
+
|
|
193
|
+
### Debugging
|
|
194
|
+
|
|
195
|
+
- **Frontend**: Open DevTools in Electron window (Cmd/Ctrl+Shift+I)
|
|
196
|
+
- **Backend**: Check NestJS console output
|
|
197
|
+
- **Gateway**: Check gateway server logs
|
|
198
|
+
|
|
199
|
+
## 🚢 Building for Production
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
cd desktop
|
|
203
|
+
npm run build
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
This creates platform-specific installers in `desktop/dist/`.
|
|
207
|
+
|
|
208
|
+
## 📄 License
|
|
209
|
+
|
|
210
|
+
MIT
|