docs(wiki): 重构为模块化知识库 — 按模块组织而非按文档类型
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

问题: 旧 wiki 按文档类型组织(architecture/data-flows/file-map),
修复 Butler Router 需要读 4 个文件才能拼凑全貌。
且 SaaS Relay 主路径 vs 本地降级的优先级描述不准确。

重构为模块化结构,每个模块页自包含:
- 设计思想: 为什么这样设计
- 代码逻辑: 数据流 + 关键代码
- 关联模块: 依赖关系

新增模块页:
- routing.md: 客户端路由 (明确 SaaS Relay 是主路径,不是本地模式)
- chat.md: 聊天系统 (3种实现 + Token Pool 中转机制)
- butler.md: 管家模式 (路由/冷启动/痛点/双模式UI)
- memory.md: 记忆管道 (提取→FTS5→检索→注入)
- saas.md: SaaS平台 (认证/Token池/计费/Admin)
- middleware.md: 中间件链 (14层 + 优先级)
- hands-skills.md: Hands(9) + Skills(75)
- pipeline.md: Pipeline DSL

删除旧文件: architecture.md, data-flows.md, module-status.md, file-map.md
(内容已分布到对应模块页中)

添加 .gitignore 排除 Obsidian 工作区状态文件
This commit is contained in:
iven
2026-04-11 00:36:26 +08:00
parent 9772d6ec94
commit 36a1c87d87
18 changed files with 839 additions and 627 deletions

70
wiki/pipeline.md Normal file
View File

@@ -0,0 +1,70 @@
---
title: Pipeline DSL
updated: 2026-04-11
status: active
tags: [module, pipeline, dsl]
---
# Pipeline DSL
> 从 [[index]] 导航。关联模块: [[hands-skills]]
## 设计思想
**Pipeline = 可编排的工作流,按 DAG 依赖顺序执行步骤。**
- YAML 定义 Pipeline 结构(步骤、依赖、输入/输出)
- DAG 执行器按依赖拓扑排序执行
- 17 个行业模板覆盖 10 大行业
- 前端已接通 8 个 Tauri invoke 调用
## 代码逻辑
### 架构
```
YAML Pipeline 定义
→ PipelineExecutor (crates/zclaw-pipeline/src/executor.rs)
→ 构建 DAG (按依赖排序)
→ 逐步执行:
→ ActionRegistry.resolve(action_type)
→ 执行 action → PipelineRun.step_results
→ 全部完成 → PipelineRun.status = Completed
```
### 运行状态
```rust
enum RunStatus { Pending, Running, Completed, Failed, Cancelled }
```
### 模板 (17 个 YAML)
位于 `pipelines/` 目录,覆盖:
- 汕头玩具行业、服装设计、医疗
- 数据分析、报告生成
- 教育、营销
- 等 10 大行业
### 前端集成
| 组件 | 文件 |
|------|------|
| PipelineClient | `desktop/src/lib/pipeline-client.ts` |
| Tauri 命令 | `desktop/src-tauri/src/pipeline_commands/` |
8 个前端 invoke 调用匹配 8 个 Rust 命令,完整可用。
## 关联模块
- [[hands-skills]] — Pipeline 步骤可能调用 Hand/Skill
## 关键文件
| 文件 | 职责 |
|------|------|
| `crates/zclaw-pipeline/src/executor.rs` | DAG 执行器 |
| `crates/zclaw-pipeline/src/` | Pipeline DSL 解析 |
| `pipelines/` | 17 个 YAML 模板 |
| `desktop/src/lib/pipeline-client.ts` | 前端 Pipeline 客户端 |
| `desktop/src-tauri/src/pipeline_commands/` | Tauri 命令桥接 |