refactor(agent): remove memory agent, simplify runtime config system
This commit is contained in:
@@ -202,10 +202,12 @@ interface ForwardedProps {
|
||||
|
||||
### 运行模式说明
|
||||
|
||||
| runtime_mode | 说明 | 后端 Pipeline |
|
||||
|--------------|------|---------------|
|
||||
| `chat` | 标准对话模式 | `router` -> `worker` |
|
||||
| `automation` | 自动化任务模式 | 由后端业务逻辑决定具体 Agent 类型 |
|
||||
| runtime_mode | 说明 | Pipeline | 差异 |
|
||||
|--------------|------|----------|------|
|
||||
| `chat` | 标准对话模式 | `router` -> `worker` | `enabled_tools` 和 `context` 来自 `system_agents.yaml` |
|
||||
| `automation` | 自动化任务模式 | `router` -> `worker` | `enabled_tools` 和 `context` 来自 `AutomationJob.config`(通过 `runtime_config` 注入)|
|
||||
|
||||
> `runtime_mode` 仅影响 `RuntimeConfig`(工具列表与上下文配置),不改变执行阶段。两模式均使用固定两阶段 pipeline。
|
||||
|
||||
### 时间来源优先级(固定)
|
||||
|
||||
|
||||
@@ -326,6 +326,48 @@ cost = uncached_prompt_tokens * input_cost_per_token
|
||||
|
||||
## 8) 可见性与上下文装载说明
|
||||
|
||||
- 持久化消息使用单字段 `visibility_mask`(位掩码)控制 consumer 可见性。
|
||||
- `/history` 仅投影 `ui.history` 可见消息。
|
||||
- 运行时上下文按当前 stage 对应 consumer 位过滤装载,不依赖前端展示可见性。
|
||||
### visibility_mask 位掩码系统
|
||||
|
||||
持久化消息使用单字段 `visibility_mask`(位掩码)控制不同 consumer 的可见性:
|
||||
|
||||
| Bit | 常量名 | 说明 |
|
||||
|-----|--------|------|
|
||||
| 0 | `UI_HISTORY` | `/history` API 投影可见的消息 |
|
||||
| 1 | `CONTEXT_ASSEMBLY` | 运行时上下文装配(context assembly)可见 |
|
||||
|
||||
> 新消息入库时,`chat` 模式设置 `mask = UI_HISTORY | CONTEXT_ASSEMBLY`(值为 3),`automation` 模式设置 `mask = 0`。
|
||||
|
||||
### /history API
|
||||
|
||||
`GET /api/v1/agent/history` 仅投影包含 `UI_HISTORY` 位的消息:
|
||||
|
||||
```sql
|
||||
WHERE (visibility_mask & 1) != 0
|
||||
```
|
||||
|
||||
### 运行时上下文装配
|
||||
|
||||
`load_context_messages` 查询上下文时使用 `CONTEXT_ASSEMBLY` 位过滤:
|
||||
|
||||
```sql
|
||||
WHERE (visibility_mask & 2) != 0
|
||||
```
|
||||
|
||||
**影响**:
|
||||
- `chat` 模式用户输入:mask=3 → 进入 `/history` ✅,进入 context assembly ✅
|
||||
- `automation` 模式用户输入:mask=0 → 进入 `/history` ❌,进入 context assembly ❌
|
||||
|
||||
### Automation 模式上下文注入
|
||||
|
||||
由于 automation 用户输入 `mask=0` 不进入 context assembly,router 调用前会从 `RunAgentInput.messages` 注入最新用户消息到 context 头部(条件:context 为空 或 最后一条非 user)。
|
||||
|
||||
### runtime_mode 差异总结
|
||||
|
||||
| 维度 | `chat` | `automation` |
|
||||
|------|--------|--------------|
|
||||
| Pipeline | `router` -> `worker` | `router` -> `worker` |
|
||||
| 用户输入 visibility_mask | `UI_HISTORY \| CONTEXT_ASSEMBLY` | `0` |
|
||||
| 进入 /history | ✅ | ❌ |
|
||||
| 进入 context assembly | ✅(自动) | ❌(通过 run_input 注入) |
|
||||
| enabled_tools 来源 | `system_agents.yaml` worker 配置 | `AutomationJob.config.enabled_tools` |
|
||||
| context 配置来源 | `system_agents.yaml` router context_messages | `AutomationJob.config.context` |
|
||||
|
||||
Reference in New Issue
Block a user