@starlink-awaken/agentmesh 1.0.0
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/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +243 -0
- package/README.zh-CN.md +243 -0
- package/config/gateway.yaml +190 -0
- package/docs/api.md +566 -0
- package/package.json +74 -0
- package/src/adapters/base.ts +34 -0
- package/src/adapters/claude-code.ts +122 -0
- package/src/adapters/openclaw.ts +120 -0
- package/src/adapters/process.ts +136 -0
- package/src/cli.ts +284 -0
- package/src/core/agent-registry.ts +334 -0
- package/src/core/config.ts +148 -0
- package/src/core/context-manager.ts +210 -0
- package/src/core/event-bus.ts +76 -0
- package/src/core/metrics.ts +216 -0
- package/src/core/router.ts +105 -0
- package/src/core/task-manager.ts +248 -0
- package/src/core/vector-store.ts +203 -0
- package/src/index.ts +84 -0
- package/src/routes/api.ts +158 -0
- package/src/routes/websocket.ts +91 -0
- package/src/types/index.ts +90 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-02-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- Initial release of @starlink-awaken/agentmesh
|
|
12
|
+
- 24 built-in AI Agent adapters (Claude Code, OpenClaw, Cursor, Windsurf, Aider, Ollama, etc.)
|
|
13
|
+
- REST API with task submission and management
|
|
14
|
+
- Server-Sent Events (SSE) for real-time updates
|
|
15
|
+
- Smart routing based on task keywords
|
|
16
|
+
- Shared space context management
|
|
17
|
+
- CLI tool with global installation support
|
|
18
|
+
- Configuration system with YAML support
|
|
19
|
+
- Event-driven architecture
|
|
20
|
+
- Metrics and logging system
|
|
21
|
+
- Vector database support (ChromaDB)
|
|
22
|
+
- Docker support
|
|
23
|
+
|
|
24
|
+
### Features
|
|
25
|
+
- Multi-agent coordination and collaboration
|
|
26
|
+
- Bidirectional agent dispatching
|
|
27
|
+
- File-level context sharing
|
|
28
|
+
- Custom agent adapter support
|
|
29
|
+
- Task lifecycle management
|
|
30
|
+
- Agent health monitoring
|
|
31
|
+
|
|
32
|
+
### Documentation
|
|
33
|
+
- API documentation
|
|
34
|
+
- README in English and Chinese
|
|
35
|
+
- Contributing guidelines
|
|
36
|
+
- Code of conduct
|
|
37
|
+
|
|
38
|
+
## [Unreleased]
|
|
39
|
+
|
|
40
|
+
### Planned
|
|
41
|
+
- WebSocket support for real-time communication
|
|
42
|
+
- More agent adapters
|
|
43
|
+
- Plugin system
|
|
44
|
+
- Authentication and authorization
|
|
45
|
+
- Rate limiting
|
|
46
|
+
- Advanced routing strategies
|
|
47
|
+
- Metrics dashboard
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Starlink Awaken
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# @starlink-awaken/agentmesh
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/@starlink-awaken/agentmesh" alt="npm version">
|
|
5
|
+
<img src="https://img.shields.io/npm/l/@starlink-awaken/agentmesh" alt="license">
|
|
6
|
+
<img src="https://img.shields.io/github/stars/starlink-awaken/agentmesh" alt="stars">
|
|
7
|
+
<img src="https://img.shields.io/github/forks/starlink-awaken/agentmesh" alt="forks">
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
> Uniifed Agent Gateway - Multi-Agent Scheduler and Router
|
|
11
|
+
|
|
12
|
+
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
13
|
+
|
|
14
|
+
## 概述
|
|
15
|
+
|
|
16
|
+
Agent Mesh 是一个强大的多智能体调度网关,能够协调和调度多种 AI Agent(包括 Claude Code、OpenClaw 以及其他本地安装的 Agent CLI 工具)。
|
|
17
|
+
|
|
18
|
+
## 特性
|
|
19
|
+
|
|
20
|
+
- 🤖 **多 Agent 支持** - 内置支持 24+ 种 AI Agent
|
|
21
|
+
- 🎯 **智能路由** - 根据任务类型自动选择合适的 Agent
|
|
22
|
+
- 🔄 **双向调度** - 支持 Agent 之间的相互调用
|
|
23
|
+
- 👥 **多 Agent 协作** - 同一任务可调度多个 Agent
|
|
24
|
+
- 📁 **上下文共享** - 文件级共享空间,支持上下文持久化
|
|
25
|
+
- 🌐 **REST API** - 完整的 HTTP API 支持
|
|
26
|
+
- 📡 **实时事件** - SSE/WebSocket 实时任务更新
|
|
27
|
+
- 📊 **监控日志** - 内置指标收集和日志系统
|
|
28
|
+
|
|
29
|
+
## 快速开始
|
|
30
|
+
|
|
31
|
+
### 安装
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 使用 bun
|
|
35
|
+
bun add @starlink-awaken/agentmesh
|
|
36
|
+
|
|
37
|
+
# 或使用 npm
|
|
38
|
+
npm install @starlink-awaken/agentmesh
|
|
39
|
+
|
|
40
|
+
# 或使用 yarn
|
|
41
|
+
yarn add @starlink-awaken/agentmesh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### CLI 全局安装
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @starlink-awaken/agentmesh
|
|
48
|
+
|
|
49
|
+
# 或者
|
|
50
|
+
bun install -g @starlink-awaken/agentmesh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 启动服务
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 使用 bun
|
|
57
|
+
bun run src/index.ts
|
|
58
|
+
|
|
59
|
+
# 或使用 CLI
|
|
60
|
+
agent-gateway start
|
|
61
|
+
|
|
62
|
+
# 或指定端口
|
|
63
|
+
agent-gateway start --port 8080
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 使用 Docker
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 构建镜像
|
|
70
|
+
docker build -t agentmesh .
|
|
71
|
+
|
|
72
|
+
# 运行容器
|
|
73
|
+
docker run -p 3000:3000 agentmesh
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 使用方法
|
|
77
|
+
|
|
78
|
+
### CLI 命令
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 列出所有可用 Agent
|
|
82
|
+
agent-gateway agents
|
|
83
|
+
|
|
84
|
+
# 提交通用任务(自动路由)
|
|
85
|
+
agent-gateway task "帮我写一个排序算法"
|
|
86
|
+
|
|
87
|
+
# 提交任务到指定 Agent
|
|
88
|
+
agent-gateway to claude-code "帮我 review 这段代码"
|
|
89
|
+
|
|
90
|
+
# 创建共享空间
|
|
91
|
+
agent-gateway space create-space
|
|
92
|
+
|
|
93
|
+
# 列出所有任务
|
|
94
|
+
agent-gateway tasks
|
|
95
|
+
|
|
96
|
+
# 检查 Gateway 状态
|
|
97
|
+
agent-gateway health
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### REST API
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 健康检查
|
|
104
|
+
curl http://localhost:3000/health
|
|
105
|
+
|
|
106
|
+
# 提交任务
|
|
107
|
+
curl -X POST http://localhost:3000/tasks \
|
|
108
|
+
-H "Content-Type: application/json" \
|
|
109
|
+
-d '{"payload": {"task": "帮我写一个排序算法"}}'
|
|
110
|
+
|
|
111
|
+
# 获取 Agent 列表
|
|
112
|
+
curl http://localhost:3000/agents
|
|
113
|
+
|
|
114
|
+
# 创建共享空间
|
|
115
|
+
curl -X POST http://localhost:3000/spaces \
|
|
116
|
+
-H "Content-Type: application/json" \
|
|
117
|
+
-d '{"metadata": {"name": "项目A"}}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### JavaScript/TypeScript
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { AgentGateway } from '@starlink-awaken/agentmesh';
|
|
124
|
+
|
|
125
|
+
const gateway = new AgentGateway({
|
|
126
|
+
port: 3000,
|
|
127
|
+
agents: [
|
|
128
|
+
{ id: 'claude-code', command: 'claude', args: ['-p'] }
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
await gateway.start();
|
|
133
|
+
|
|
134
|
+
// 提交任务
|
|
135
|
+
const task = await gateway.submitTask({
|
|
136
|
+
payload: {
|
|
137
|
+
task: '帮我写一个排序算法'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
console.log('Task ID:', task.id);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 配置
|
|
145
|
+
|
|
146
|
+
### 路由规则
|
|
147
|
+
|
|
148
|
+
在 `config/gateway.yaml` 中配置任务路由规则:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
routing:
|
|
152
|
+
rules:
|
|
153
|
+
- name: code-review
|
|
154
|
+
keywords: [review, code review, pr review]
|
|
155
|
+
agent: claude-code
|
|
156
|
+
priority: 10
|
|
157
|
+
|
|
158
|
+
- name: browser-automation
|
|
159
|
+
keywords: [browser, scrape, click]
|
|
160
|
+
agent: openclaw
|
|
161
|
+
priority: 10
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Agent 配置
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
agents:
|
|
168
|
+
- id: claude-code
|
|
169
|
+
name: Claude Code
|
|
170
|
+
type: claude-code
|
|
171
|
+
capabilities:
|
|
172
|
+
- code-generation
|
|
173
|
+
- code-review
|
|
174
|
+
|
|
175
|
+
- id: my-agent
|
|
176
|
+
name: My Custom Agent
|
|
177
|
+
type: http
|
|
178
|
+
endpoint: http://localhost:8080
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 支持的 Agent
|
|
182
|
+
|
|
183
|
+
| Agent | 描述 | 能力 |
|
|
184
|
+
|-------|------|------|
|
|
185
|
+
| claude-code | Anthropic Claude Code | 代码生成、审查、重构 |
|
|
186
|
+
| openclaw | OpenClaw | 浏览器自动化、网页抓取 |
|
|
187
|
+
| cursor | Cursor | 代码补全、聊天 |
|
|
188
|
+
| windsurf | Windsurf | Agent 编码、Flow 状态 |
|
|
189
|
+
| aider | Aider | Git 集成编辑、多文件修改 |
|
|
190
|
+
| ollama | Ollama | 本地 LLM、隐私优先 |
|
|
191
|
+
| perplexity | Perplexity | 研究助手、网络搜索 |
|
|
192
|
+
| grok | xAI Grok | 推理、代码生成 |
|
|
193
|
+
| ... | 更多 Agent | 见文档 |
|
|
194
|
+
|
|
195
|
+
## 架构
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
199
|
+
│ Agent Mesh Gateway │
|
|
200
|
+
├─────────────────────────────────────────────────────────────┤
|
|
201
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
202
|
+
│ │ Task API │ │ Event Bus │ │ Discovery │ │
|
|
203
|
+
│ │ (REST/WS) │ │ (Pub/Sub) │ │ Service │ │
|
|
204
|
+
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
|
|
205
|
+
│ │ │ │ │
|
|
206
|
+
│ ┌──────┴────────────────┴─────────────────┴──────┐ │
|
|
207
|
+
│ │ Context Manager │ │
|
|
208
|
+
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
|
209
|
+
│ │ │ Memory │ │ Files │ │VectorDB │ │ │
|
|
210
|
+
│ │ │ Cache │ │ Persist │ │ Storage │ │ │
|
|
211
|
+
│ │ └─────────┘ └─────────┘ └─────────┘ │ │
|
|
212
|
+
│ └──────────────────────┬──────────────────────────┘ │
|
|
213
|
+
└─────────────────────────┼──────────────────────────────────┘
|
|
214
|
+
│
|
|
215
|
+
┌─────────────────┼─────────────────┐
|
|
216
|
+
▼ ▼ ▼
|
|
217
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
218
|
+
│ Claude │ │ Open │ │ Other │
|
|
219
|
+
│ Code │◄────►│ Claw │◄────►│ Agents │
|
|
220
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 文档
|
|
224
|
+
|
|
225
|
+
- [API 文档](./docs/api.md)
|
|
226
|
+
- [配置参考](./config/gateway.yaml)
|
|
227
|
+
- [Agent 开发指南](./docs/agent-adapter.md)
|
|
228
|
+
|
|
229
|
+
## 贡献
|
|
230
|
+
|
|
231
|
+
欢迎贡献代码!请阅读 [贡献指南](./CONTRIBUTING.md) 了解如何参与项目开发。
|
|
232
|
+
|
|
233
|
+
## 许可证
|
|
234
|
+
|
|
235
|
+
MIT License - 请查看 [LICENSE](./LICENSE) 文件。
|
|
236
|
+
|
|
237
|
+
## 赞助
|
|
238
|
+
|
|
239
|
+
如果你喜欢这个项目,请考虑赞助我们。
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
Made with ❤️ by [Starlink Awaken](https://github.com/starlink-awaken)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
# @starlink-awaken/agentmesh
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/@starlink-awaken/agentmesh" alt="npm version">
|
|
5
|
+
<img src="https://img.shields.io/npm/l/@starlink-awaken/agentmesh" alt="license">
|
|
6
|
+
<img src="https://img.shields.io/github/stars/starlink-awaken/agentmesh" alt="stars">
|
|
7
|
+
<img src="https://img.shields.io/github/forks/starlink-awaken/agentmesh" alt="forks">
|
|
8
|
+
</p>
|
|
9
|
+
|
|
10
|
+
> 统一的 Agent 调度网关 - 多智能体调度与路由
|
|
11
|
+
|
|
12
|
+
[English](./README.md) | [中文](./README.zh-CN.md)
|
|
13
|
+
|
|
14
|
+
## 概述
|
|
15
|
+
|
|
16
|
+
Agent Mesh 是一个强大的多智能体调度网关,能够协调和调度多种 AI Agent(包括 Claude Code、OpenClaw 以及其他本地安装的 Agent CLI 工具)。
|
|
17
|
+
|
|
18
|
+
## 特性
|
|
19
|
+
|
|
20
|
+
- 🤖 **多 Agent 支持** - 内置支持 24+ 种 AI Agent
|
|
21
|
+
- 🎯 **智能路由** - 根据任务类型自动选择合适的 Agent
|
|
22
|
+
- 🔄 **双向调度** - 支持 Agent 之间的相互调用
|
|
23
|
+
- 👥 **多 Agent 协作** - 同一任务可调度多个 Agent
|
|
24
|
+
- 📁 **上下文共享** - 文件级共享空间,支持上下文持久化
|
|
25
|
+
- 🌐 **REST API** - 完整的 HTTP API 支持
|
|
26
|
+
- 📡 **实时事件** - SSE/WebSocket 实时任务更新
|
|
27
|
+
- 📊 **监控日志** - 内置指标收集和日志系统
|
|
28
|
+
|
|
29
|
+
## 快速开始
|
|
30
|
+
|
|
31
|
+
### 安装
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 使用 bun
|
|
35
|
+
bun add @starlink-awaken/agentmesh
|
|
36
|
+
|
|
37
|
+
# 或使用 npm
|
|
38
|
+
npm install @starlink-awaken/agentmesh
|
|
39
|
+
|
|
40
|
+
# 或使用 yarn
|
|
41
|
+
yarn add @starlink-awaken/agentmesh
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### CLI 全局安装
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
npm install -g @starlink-awaken/agentmesh
|
|
48
|
+
|
|
49
|
+
# 或者
|
|
50
|
+
bun install -g @starlink-awaken/agentmesh
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 启动服务
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 使用 bun
|
|
57
|
+
bun run src/index.ts
|
|
58
|
+
|
|
59
|
+
# 或使用 CLI
|
|
60
|
+
agent-gateway start
|
|
61
|
+
|
|
62
|
+
# 或指定端口
|
|
63
|
+
agent-gateway start --port 8080
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 使用 Docker
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 构建镜像
|
|
70
|
+
docker build -t agentmesh .
|
|
71
|
+
|
|
72
|
+
# 运行容器
|
|
73
|
+
docker run -p 3000:3000 agentmesh
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 使用方法
|
|
77
|
+
|
|
78
|
+
### CLI 命令
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# 列出所有可用 Agent
|
|
82
|
+
agent-gateway agents
|
|
83
|
+
|
|
84
|
+
# 提交通用任务(自动路由)
|
|
85
|
+
agent-gateway task "帮我写一个排序算法"
|
|
86
|
+
|
|
87
|
+
# 提交任务到指定 Agent
|
|
88
|
+
agent-gateway to claude-code "帮我 review 这段代码"
|
|
89
|
+
|
|
90
|
+
# 创建共享空间
|
|
91
|
+
agent-gateway space create-space
|
|
92
|
+
|
|
93
|
+
# 列出所有任务
|
|
94
|
+
agent-gateway tasks
|
|
95
|
+
|
|
96
|
+
# 检查 Gateway 状态
|
|
97
|
+
agent-gateway health
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### REST API
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# 健康检查
|
|
104
|
+
curl http://localhost:3000/health
|
|
105
|
+
|
|
106
|
+
# 提交任务
|
|
107
|
+
curl -X POST http://localhost:3000/tasks \
|
|
108
|
+
-H "Content-Type: application/json" \
|
|
109
|
+
-d '{"payload": {"task": "帮我写一个排序算法"}}'
|
|
110
|
+
|
|
111
|
+
# 获取 Agent 列表
|
|
112
|
+
curl http://localhost:3000/agents
|
|
113
|
+
|
|
114
|
+
# 创建共享空间
|
|
115
|
+
curl -X POST http://localhost:3000/spaces \
|
|
116
|
+
-H "Content-Type: application/json" \
|
|
117
|
+
-d '{"metadata": {"name": "项目A"}}'
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### JavaScript/TypeScript
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { AgentGateway } from '@starlink-awaken/agentmesh';
|
|
124
|
+
|
|
125
|
+
const gateway = new AgentGateway({
|
|
126
|
+
port: 3000,
|
|
127
|
+
agents: [
|
|
128
|
+
{ id: 'claude-code', command: 'claude', args: ['-p'] }
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
await gateway.start();
|
|
133
|
+
|
|
134
|
+
// 提交任务
|
|
135
|
+
const task = await gateway.submitTask({
|
|
136
|
+
payload: {
|
|
137
|
+
task: '帮我写一个排序算法'
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
console.log('Task ID:', task.id);
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## 配置
|
|
145
|
+
|
|
146
|
+
### 路由规则
|
|
147
|
+
|
|
148
|
+
在 `config/gateway.yaml` 中配置任务路由规则:
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
routing:
|
|
152
|
+
rules:
|
|
153
|
+
- name: code-review
|
|
154
|
+
keywords: [review, code review, pr review]
|
|
155
|
+
agent: claude-code
|
|
156
|
+
priority: 10
|
|
157
|
+
|
|
158
|
+
- name: browser-automation
|
|
159
|
+
keywords: [browser, scrape, click]
|
|
160
|
+
agent: openclaw
|
|
161
|
+
priority: 10
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Agent 配置
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
agents:
|
|
168
|
+
- id: claude-code
|
|
169
|
+
name: Claude Code
|
|
170
|
+
type: claude-code
|
|
171
|
+
capabilities:
|
|
172
|
+
- code-generation
|
|
173
|
+
- code-review
|
|
174
|
+
|
|
175
|
+
- id: my-agent
|
|
176
|
+
name: My Custom Agent
|
|
177
|
+
type: http
|
|
178
|
+
endpoint: http://localhost:8080
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 支持的 Agent
|
|
182
|
+
|
|
183
|
+
| Agent | 描述 | 能力 |
|
|
184
|
+
|-------|------|------|
|
|
185
|
+
| claude-code | Anthropic Claude Code | 代码生成、审查、重构 |
|
|
186
|
+
| openclaw | OpenClaw | 浏览器自动化、网页抓取 |
|
|
187
|
+
| cursor | Cursor | 代码补全、聊天 |
|
|
188
|
+
| windsurf | Windsurf | Agent 编码、Flow 状态 |
|
|
189
|
+
| aider | Aider | Git 集成编辑、多文件修改 |
|
|
190
|
+
| ollama | Ollama | 本地 LLM、隐私优先 |
|
|
191
|
+
| perplexity | Perplexity | 研究助手、网络搜索 |
|
|
192
|
+
| grok | xAI Grok | 推理、代码生成 |
|
|
193
|
+
| ... | 更多 Agent | 见文档 |
|
|
194
|
+
|
|
195
|
+
## 架构
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
199
|
+
│ Agent Mesh Gateway │
|
|
200
|
+
├─────────────────────────────────────────────────────────────┤
|
|
201
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
202
|
+
│ │ Task API │ │ Event Bus │ │ Discovery │ │
|
|
203
|
+
│ │ (REST/WS) │ │ (Pub/Sub) │ │ Service │ │
|
|
204
|
+
│ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │
|
|
205
|
+
│ │ │ │ │
|
|
206
|
+
│ ┌──────┴────────────────┴─────────────────┴──────┐ │
|
|
207
|
+
│ │ Context Manager │ │
|
|
208
|
+
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │
|
|
209
|
+
│ │ │ Memory │ │ Files │ │VectorDB │ │ │
|
|
210
|
+
│ │ │ Cache │ │ Persist │ │ Storage │ │ │
|
|
211
|
+
│ │ └─────────┘ └─────────┘ └─────────┘ │ │
|
|
212
|
+
│ └──────────────────────┬──────────────────────────┘ │
|
|
213
|
+
└─────────────────────────┼──────────────────────────────────┘
|
|
214
|
+
│
|
|
215
|
+
┌─────────────────┼─────────────────┐
|
|
216
|
+
▼ ▼ ▼
|
|
217
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
218
|
+
│ Claude │ │ Open │ │ Other │
|
|
219
|
+
│ Code │◄────►│ Claw │◄────►│ Agents │
|
|
220
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## 文档
|
|
224
|
+
|
|
225
|
+
- [API 文档](./docs/api.md)
|
|
226
|
+
- [配置参考](./config/gateway.yaml)
|
|
227
|
+
- [Agent 开发指南](./docs/agent-adapter.md)
|
|
228
|
+
|
|
229
|
+
## 贡献
|
|
230
|
+
|
|
231
|
+
欢迎贡献代码!请阅读 [贡献指南](./CONTRIBUTING.md) 了解如何参与项目开发。
|
|
232
|
+
|
|
233
|
+
## 许可证
|
|
234
|
+
|
|
235
|
+
MIT License - 请查看 [LICENSE](./LICENSE) 文件。
|
|
236
|
+
|
|
237
|
+
## 赞助
|
|
238
|
+
|
|
239
|
+
如果你喜欢这个项目,请考虑赞助我们。
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
Made with ❤️ by [Starlink Awaken](https://github.com/starlink-awaken)
|