feat(ai): switch page ai to hermes panel
This commit is contained in:
@@ -1,544 +0,0 @@
|
||||
# 7-2 [process] Phase 7 结构化 Artifact 写链最小落地方案 v1
|
||||
|
||||
> 更新时间:2026-04-23
|
||||
>
|
||||
> 上位依据:
|
||||
> - `/mnt/Data1T/mnote/ARCHITECTURE.md`
|
||||
> - `/mnt/Data1T/mnote/design/01-tree-first-graph-kernel/process/1-tree-first-graph-kernel-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-5-page-aggregate-single-truth-alignment-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-6-page-aggregate-alignment-checklist-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/process/7-phase7-ai-kernel-projection-plan-v4.md`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/done/7-1-phase7-document-ai-minimum-loop-checklist-v1.md`
|
||||
>
|
||||
> 2026-05-05 追加说明:
|
||||
> - 本稿的对象模型、artifact 写链与 kernel 边界仍然有效
|
||||
> - 当时触发与执行口径曾被 `/mnt/Data1T/mnote/design/old/07-ai/process/7-phase7-ai-kernel-projection-plan-v4.md` 覆盖
|
||||
> - 该 `mnote-cli` host 口径现已被 2026-05-13 的 Hermes 面板主线覆盖
|
||||
>
|
||||
> 2026-05-13 追加说明:
|
||||
> - 本稿的对象模型、artifact 写链、projection-only `AI Artifacts` 分组与 kernel 边界继续有效
|
||||
> - 触发与执行口径改由 `/mnt/Data1T/mnote/design/07-ai/process/7-3-page-ai-hermes-panel-and-mnote-plugin-v1.md` 覆盖
|
||||
> - 当前凡是提到“页面 AI 面板触发”或“页面 AI host 固定动作”的位置,都应理解为:
|
||||
> 页面 AI 面板作为 Hermes 页面内客户端发起意图,Hermes 通过 mnote skill/plugin 调用正式 artifact 工具,最终写入仍回到 Rust runtime / kernel
|
||||
|
||||
---
|
||||
|
||||
## 1. 文档目的
|
||||
|
||||
这份稿只回答一个问题:
|
||||
|
||||
> **在文档页 AI 最小闭环已经完成之后,`summary node / ai_note node / reference edge` 这三条结构化知识写链,第一版到底如何落地,才能既进入 kernel,又不重新污染页面树、文件树和页面主链。**
|
||||
|
||||
当前不写这份稿,后续最容易出现两类跑偏:
|
||||
|
||||
- 把 `summary / ai_note` 继续做成 AI 面板里的临时聊天产物,而不是 kernel node
|
||||
- 为了让文件树看见它们,额外发明一个 `AI Artifacts` 真容器节点,重新污染树真相
|
||||
|
||||
因此本稿的目标不是“做完整 AI 平台”,而是:
|
||||
|
||||
> **只把 `summary node / ai_note node / reference edge` 这三条结构化写链,收口成第一版可执行、可验证、可继续扩展的最小实现。**
|
||||
|
||||
---
|
||||
|
||||
## 2. 当前结论
|
||||
|
||||
第一版固定采用下面这组边界,不再开放:
|
||||
|
||||
1. 只做三类结构对象:
|
||||
- `summary node`
|
||||
- `ai_note node`
|
||||
- `reference edge`
|
||||
2. 只允许围绕**当前文档页**创建,不做跨页、跨工作区写链
|
||||
3. 第一版允许页面 AI 面板提供固定快捷入口,但快捷入口本质是向 Hermes 发送意图;Hermes 通过 mnote skill/plugin 调用 artifact 工具,不再由页面 AI host 或 `mnote-cli` host 私有触发
|
||||
4. 点击按钮后直接创建,不走“先预览再确认”的两阶段流
|
||||
5. `summary node` 默认单例覆盖更新;`ai_note node` 每次新建
|
||||
6. 两者都落成**可编辑的页面型节点**
|
||||
7. 文件树可见,页面树默认不可见
|
||||
8. 文件树中的 `AI Artifacts` 只是 projection-only 的虚拟分组,不是新的真实 kernel node
|
||||
9. 每次创建 `summary node` 或 `ai_note node` 时,自动连一条指向当前页的 `reference edge`
|
||||
|
||||
一句话收口:
|
||||
|
||||
> **第一版不是让 AI 自由生长“知识图谱”,而是让当前页能够稳定产出两类正式 artifact node,并带上一条最小来源边。**
|
||||
|
||||
---
|
||||
|
||||
## 3. 为什么第一版只做这三条
|
||||
|
||||
### 3.1 这是从“正文写链”走向“结构写链”的最小跨越
|
||||
|
||||
当前 `7-1` 已经完成的是:
|
||||
|
||||
- AI 读取当前页 page aggregate 上下文
|
||||
- AI 通过 `page.head.updateTitle / page.body.save` 回写标题和正文
|
||||
|
||||
但这仍然只是在“改当前页”。
|
||||
|
||||
如果要让 AI 真正进入 `tree-first graph kernel`,第一步不应该直接跳到:
|
||||
|
||||
- 跨页知识网
|
||||
- PDF / Book 结构化摄取
|
||||
- 完整 index node / retrieval 主线
|
||||
|
||||
而应先从三条最小结构写链开始:
|
||||
|
||||
- 为当前页生成一个 `summary node`
|
||||
- 为当前页生成一个 `ai_note node`
|
||||
- 把它们用 `reference edge` 连回当前页
|
||||
|
||||
### 3.2 这三条最适合当前主线边界
|
||||
|
||||
这三者同时满足:
|
||||
|
||||
- 与当前页 AI 主链直接相邻
|
||||
- 不要求跨页权限扩展
|
||||
- 不要求额外引入新的树真相层
|
||||
- 能直接复用当前的 page aggregate 上下文
|
||||
- 能验证 `typed node / typed edge` 进入产品主线,而不是继续只停在文档里
|
||||
|
||||
### 3.3 `PDF / Book -> kernel index` 当前必须继续后置
|
||||
|
||||
`kernel index` 第一版不并入本稿,原因很明确:
|
||||
|
||||
- 它依赖更稳定的摄取边界
|
||||
- 它会引入更重的异步任务与检索协议
|
||||
- 它不是当前页 AI host 面板的最小邻接能力
|
||||
|
||||
所以本稿故意不把阶段 5 全写成一个“大包”,而是只切出:
|
||||
|
||||
> **当前页 -> artifact node / reference edge**
|
||||
|
||||
---
|
||||
|
||||
## 4. 对象模型
|
||||
|
||||
第一版真正进入 kernel 的对象只有三类。
|
||||
|
||||
### 4.1 `summary node`
|
||||
|
||||
`summary node` 是一个真实的 `KernelNode`,`node_type = summary`。
|
||||
|
||||
它的产品语义固定为:
|
||||
|
||||
- 它代表“当前页的最新摘要页”
|
||||
- 它不是聊天消息
|
||||
- 它不是页面内一段临时 block
|
||||
- 它是可编辑页面型节点,但语义上属于 artifact
|
||||
|
||||
它的最小数据要求:
|
||||
|
||||
- `node_type = summary`
|
||||
- `workspace_id = 当前页 workspace`
|
||||
- `metadata.title = 当前页标题 + Summary`
|
||||
- `content = 可被页面主编辑区消费的正文载荷`
|
||||
- `refs.reference_node_ids` 至少包含当前页 `pageId`
|
||||
- `refs.source_node_ids` 至少包含当前页 `pageId`
|
||||
- `audit` 带最小 request / trace / actor 信息
|
||||
|
||||
### 4.2 `ai_note node`
|
||||
|
||||
`ai_note node` 也是一个真实的 `KernelNode`,`node_type = ai_note`。
|
||||
|
||||
它的产品语义固定为:
|
||||
|
||||
- 它代表“围绕当前页生成的一份 AI 工作笔记页”
|
||||
- 它不是摘要快照
|
||||
- 它允许后续继续人工编辑
|
||||
- 它是页面型节点,但语义上属于 artifact
|
||||
|
||||
它的最小数据要求:
|
||||
|
||||
- `node_type = ai_note`
|
||||
- `workspace_id = 当前页 workspace`
|
||||
- `metadata.title = 当前页标题 + AI Note + 时间戳/序号`
|
||||
- `content = 可被页面主编辑区消费的正文载荷`
|
||||
- `refs.reference_node_ids` 至少包含当前页 `pageId`
|
||||
- `refs.source_node_ids` 至少包含当前页 `pageId`
|
||||
- `audit` 带最小 request / trace / actor 信息
|
||||
|
||||
### 4.3 `reference edge`
|
||||
|
||||
`reference edge` 在第一版里不新增新的 edge type 名字,先收口到现有 `KernelEdgeType::References`。
|
||||
|
||||
它的产品语义固定为:
|
||||
|
||||
- 表示 artifact node 引用了当前页
|
||||
- 它不是父子边
|
||||
- 它不进入页面树 / 文件树
|
||||
- 它只进入关系层 / 引用层 /后续 graph traversal
|
||||
|
||||
第一版边方向固定为:
|
||||
|
||||
- `from_node_id = artifact node`
|
||||
- `to_node_id = 当前页 node`
|
||||
- `edge_type = references`
|
||||
|
||||
这样可以稳定表达:
|
||||
|
||||
> **这个 summary / ai_note 是围绕当前页生成的。**
|
||||
|
||||
### 4.4 `AI Artifacts` 不是对象,只是投影分组
|
||||
|
||||
第一版明确禁止把 `AI Artifacts` 做成真实 node。
|
||||
|
||||
它只允许存在于:
|
||||
|
||||
- 文件树 projection
|
||||
- 可能的 Inspector / artifact 列表 projection
|
||||
|
||||
它不允许存在于:
|
||||
|
||||
- kernel node truth
|
||||
- tree command truth
|
||||
- page aggregate truth
|
||||
|
||||
理由很简单:
|
||||
|
||||
- 它只是展示分组
|
||||
- 它不是用户真正的知识对象
|
||||
- 它不应反向塑造树真相
|
||||
|
||||
---
|
||||
|
||||
## 5. 写入语义
|
||||
|
||||
### 5.1 统一动作面
|
||||
|
||||
第一版只开放两个显式动作:
|
||||
|
||||
- `create_summary_artifact_for_current_page`
|
||||
- `create_ai_note_artifact_for_current_page`
|
||||
|
||||
这里先用产品动作名描述,不在本稿中强行冻结底层最终 route/path 名。
|
||||
|
||||
长期原则固定为:
|
||||
|
||||
- 它们必须进入 Rust runtime / bridge-runtime 主写链
|
||||
- 不允许绕过 kernel 直接只写前端本地状态
|
||||
- 不允许只停留在 AI 面板会话日志里
|
||||
|
||||
### 5.2 `summary node` 的写入策略
|
||||
|
||||
`summary node` 第一版采用**单例覆盖更新**。
|
||||
|
||||
固定规则:
|
||||
|
||||
1. 先按“当前页 -> artifact node_type = summary”查询是否已有 summary node
|
||||
2. 若已存在:
|
||||
- 复用该节点 `node_id`
|
||||
- 覆盖其 `content`
|
||||
- 更新其 `metadata.updated_at`
|
||||
- 保留其页面型身份
|
||||
3. 若不存在:
|
||||
- 新建一个 `summary node`
|
||||
- 自动附加到当前页的 artifact projection 分组下
|
||||
- 自动创建一条 `reference edge`
|
||||
|
||||
为什么 `summary` 采用单例:
|
||||
|
||||
- 它更像“当前页最新摘要”
|
||||
- 否则文件树下会快速积累多份摘要页
|
||||
- 第一版要先控制 artifact 数量,而不是先保留完整历史
|
||||
|
||||
### 5.3 `ai_note node` 的写入策略
|
||||
|
||||
`ai_note node` 第一版采用**每次新建**。
|
||||
|
||||
固定规则:
|
||||
|
||||
1. 每次点击 `创建 AI Note` 都新建一个 `ai_note node`
|
||||
2. 标题默认带时间戳或递增序号
|
||||
3. 创建后自动创建一条 `reference edge`
|
||||
4. 不尝试合并、覆盖旧 `ai_note`
|
||||
|
||||
为什么 `ai_note` 采用多实例:
|
||||
|
||||
- 它更像工作产物
|
||||
- 一次次 AI 分析、本轮整理、本轮方案,本来就可能并存
|
||||
- 如果也做成单例,会过早丢失工作过程
|
||||
|
||||
### 5.4 来源边写入策略
|
||||
|
||||
创建 `summary node` 或 `ai_note node` 时,自动写一条 `reference edge`。
|
||||
|
||||
第一版不要求用户再单独确认,也不要求额外按钮。
|
||||
|
||||
这条边的作用不是“展示炫酷图谱”,而是保证两个基本能力:
|
||||
|
||||
1. 后续能追溯这个 artifact 来源于哪一页
|
||||
2. 后续文件树/关系面板/graph traversal 不需要重新猜测来源
|
||||
|
||||
### 5.5 第一版不做的写入动作
|
||||
|
||||
第一版明确不做:
|
||||
|
||||
- artifact -> 多来源页面的复合引用
|
||||
- artifact -> 块级 evidence 的精细挂接
|
||||
- 跨页创建 summary / ai_note
|
||||
- 人工拖拽 artifact 重新挂到别的页面
|
||||
- artifact 自动进页面树
|
||||
|
||||
这些都属于第二版以后再做的能力。
|
||||
|
||||
---
|
||||
|
||||
## 6. 触发方式与产品入口
|
||||
|
||||
### 6.1 允许固定按钮触发,但必须经过 Hermes
|
||||
|
||||
第一版允许页面 AI 面板提供两个固定快捷按钮:
|
||||
|
||||
- `创建 Summary`
|
||||
- `创建 AI Note`
|
||||
|
||||
但按钮不得绕过 Hermes 或 mnote plugin 直接写入。正确链路是:
|
||||
|
||||
```text
|
||||
Leptos 页面 AI 面板
|
||||
-> Hermes session/run
|
||||
-> mnote Hermes skill/plugin
|
||||
-> Rust runtime / kernel
|
||||
-> artifact node / reference edge
|
||||
```
|
||||
|
||||
自然语言触发可以作为后续能力加入,但第一版验收仍以固定按钮或固定 tool intent 为准,避免 artifact 写链质量和权限边界同时失控。
|
||||
|
||||
### 6.2 点击后直接创建
|
||||
|
||||
第一版点击按钮后,直接创建,不走预览确认。
|
||||
|
||||
这是一个非常明确的产品取舍:
|
||||
|
||||
- 优点:动作和结果一一对应,最容易验证主写链
|
||||
- 缺点:产物质量控制不如“先预览再落库”
|
||||
|
||||
当前优先级里,第一版更重视:
|
||||
|
||||
- 正式写链成立
|
||||
- kernel node / edge 成立
|
||||
- 文件树 projection 成立
|
||||
- Hermes tool call -> mnote plugin -> Rust kernel 的边界成立
|
||||
|
||||
而不是先做复杂的人机审核流。
|
||||
|
||||
### 6.3 内容来源固定为当前页全文
|
||||
|
||||
第一版两个按钮的内容来源都固定为:
|
||||
|
||||
- 当前页全文
|
||||
|
||||
不做:
|
||||
|
||||
- 仅选区生成
|
||||
- 仅当前可见块生成
|
||||
- 混入会话消息做额外上下文真相
|
||||
|
||||
这能确保第一版边界足够清楚:
|
||||
|
||||
> **artifact 是围绕当前页全文生成,而不是围绕聊天面板局部状态生成。**
|
||||
|
||||
---
|
||||
|
||||
## 7. 文件树 projection 与页面树隐藏规则
|
||||
|
||||
### 7.1 页面树默认不可见
|
||||
|
||||
`summary node` 与 `ai_note node` 第一版默认不进入页面树 projection。
|
||||
|
||||
原因:
|
||||
|
||||
- 页面树是日常导航主链
|
||||
- artifact 进入页面树会明显污染日常使用
|
||||
- 它们虽然是页面型节点,但不是“用户正常页面层级”的一部分
|
||||
|
||||
### 7.2 文件树可见
|
||||
|
||||
`summary node` 与 `ai_note node` 第一版可以在文件树 projection 中可见。
|
||||
|
||||
这样做的目的不是把文件树变成第二个知识图谱,而是保留一个“必要时可管理”的管理入口。
|
||||
|
||||
### 7.3 `AI Artifacts` 虚拟分组规则
|
||||
|
||||
在文件树 projection 中,为每个当前页生成一个 projection-only 分组:
|
||||
|
||||
- `AI Artifacts`
|
||||
|
||||
固定规则如下:
|
||||
|
||||
1. 它不是真实 node
|
||||
2. 它不持久化到 kernel
|
||||
3. 它只存在于 `file_tree` projection 结果中
|
||||
4. 它的 children 由“当前页关联的 artifact nodes”动态投影得出
|
||||
|
||||
### 7.4 文件树中的相对位置
|
||||
|
||||
第一版推荐把 `AI Artifacts` 放在当前页下面,但与普通子页面分区显示。
|
||||
|
||||
不是:
|
||||
|
||||
- artifact 混在普通子页面列表里
|
||||
|
||||
而是:
|
||||
|
||||
- 当前页
|
||||
- 普通文件/子页
|
||||
- `AI Artifacts`
|
||||
- `Summary`
|
||||
- `AI Note 2026-04-23 10:31`
|
||||
- `AI Note 2026-04-23 10:46`
|
||||
|
||||
这样既满足“文件树可管理”,又最大限度避免污染普通导航。
|
||||
|
||||
### 7.5 `reference edge` 不进树
|
||||
|
||||
`reference edge` 永远不是树项。
|
||||
|
||||
它应只进入:
|
||||
|
||||
- 关系面板
|
||||
- 引用面板
|
||||
- graph traversal
|
||||
- 后续结构阅读态
|
||||
|
||||
它不允许伪装成页面树 / 文件树节点。
|
||||
|
||||
---
|
||||
|
||||
## 8. 与当前主链的关系
|
||||
|
||||
### 8.1 不改变当前页主编辑区真相
|
||||
|
||||
第一版 artifact 写链不会改变:
|
||||
|
||||
- 当前页正文依然走 `page.body.save`
|
||||
- 当前页标题依然走 `page.head.updateTitle`
|
||||
- 当前页页面设置依然走 `page.layout.updateOptions`
|
||||
|
||||
artifact 写链是新增的结构写链,不是对当前页主链的替代。
|
||||
|
||||
### 8.2 与 page aggregate 的关系
|
||||
|
||||
第一版 artifact 生成必须依赖当前 page aggregate 上下文,但不把 artifact 自身并入当前页的 page aggregate truth。
|
||||
|
||||
也就是说:
|
||||
|
||||
- page aggregate 提供生成材料
|
||||
- artifact 是新的 kernel node
|
||||
- artifact 不是当前页 `page_body` 的附属字段
|
||||
|
||||
这是必须守住的边界,否则又会回到“把结构对象塞进页面壳状态”的旧路。
|
||||
|
||||
### 8.3 与 tree command 的关系
|
||||
|
||||
artifact node 虽然默认不进页面树,但它们仍然是 tree-first graph kernel 的真实 node。
|
||||
|
||||
因此长期上仍应可复用:
|
||||
|
||||
- `kernel.node.get`
|
||||
- `kernel.subtree.get`
|
||||
- `kernel.edges.list`
|
||||
- `kernel.edge.attach`
|
||||
|
||||
但第一版不要求把 artifact 的全部树命令交互一次做完。
|
||||
|
||||
---
|
||||
|
||||
## 9. 最小实现分层
|
||||
|
||||
### 9.1 Kernel / Rust runtime 层
|
||||
|
||||
需要补的最小能力:
|
||||
|
||||
1. 创建 `summary node`
|
||||
2. 更新现有 `summary node`
|
||||
3. 创建 `ai_note node`
|
||||
4. 创建 `references` edge
|
||||
5. 按当前页查找其关联 artifact nodes
|
||||
|
||||
第一版不要求完整 artifact 生命周期,只要求:
|
||||
|
||||
- create
|
||||
- update summary
|
||||
- list by current page relation
|
||||
|
||||
### 9.2 Projection 层
|
||||
|
||||
需要补的最小能力:
|
||||
|
||||
1. `file_tree` projection 能识别“当前页关联的 artifact nodes”
|
||||
2. 在 projection 里注入一个虚拟 `AI Artifacts` 分组
|
||||
3. 页面树 projection 不注入该分组
|
||||
|
||||
### 9.3 前端文档页层
|
||||
|
||||
需要补的最小能力:
|
||||
|
||||
1. 页面 AI 面板显示两个固定按钮
|
||||
2. 点击按钮后触发相应写入动作
|
||||
3. 创建完成后,文件树对应 projection 刷新
|
||||
4. 若新建了 `ai_note node`,允许点击进入该页面
|
||||
5. 若更新了 `summary node`,允许点击进入摘要页
|
||||
|
||||
---
|
||||
|
||||
## 10. 验证口径
|
||||
|
||||
第一版完成,至少要满足以下验证。
|
||||
|
||||
### 10.1 Summary 链
|
||||
|
||||
- 当前页点击 `创建 Summary`
|
||||
- 若不存在 summary node,则新建
|
||||
- 若已存在,则覆盖更新
|
||||
- 文件树中当前页下出现或保留 `AI Artifacts / Summary`
|
||||
- 页面树中不出现该节点
|
||||
- 可打开该 `summary node`
|
||||
- kernel 中存在从 `summary node -> 当前页` 的 `references` edge
|
||||
|
||||
### 10.2 AI Note 链
|
||||
|
||||
- 当前页点击 `创建 AI Note`
|
||||
- 每次都新建一个新的 `ai_note node`
|
||||
- 文件树中当前页下 `AI Artifacts` 分组内累积出现新节点
|
||||
- 页面树中不出现这些节点
|
||||
- 可打开新建的 `ai_note node`
|
||||
- kernel 中存在从 `ai_note node -> 当前页` 的 `references` edge
|
||||
|
||||
### 10.3 真相边界
|
||||
|
||||
- `AI Artifacts` 不出现在真实 kernel node 列表中
|
||||
- `AI Artifacts` 只存在于文件树 projection 结果中
|
||||
- 当前页 page aggregate 不被额外塞入 artifact truth
|
||||
- artifact 不混入普通页面树导航主链
|
||||
|
||||
---
|
||||
|
||||
## 11. 明确不做什么
|
||||
|
||||
第一版明确不做:
|
||||
|
||||
- 自然语言隐式触发 artifact 创建
|
||||
- 跨页 summary / ai_note 写链
|
||||
- artifact 多来源引用
|
||||
- block 级 evidence 精细挂接
|
||||
- `AI Artifacts` 真实容器节点化
|
||||
- artifact 进入页面树默认主链
|
||||
- artifact 复杂权限模型
|
||||
- artifact 预览确认流
|
||||
- artifact 版本历史产品壳
|
||||
|
||||
---
|
||||
|
||||
## 12. 最终冻结口径
|
||||
|
||||
当前冻结如下:
|
||||
|
||||
> **阶段 5 的第一版,只把 `summary node / ai_note node / reference edge` 作为最小结构化知识写链落到 kernel。**
|
||||
|
||||
> **`summary node / ai_note node` 都是真实页面型 kernel node,`reference edge` 使用现有 `references` typed edge;`AI Artifacts` 只是文件树 projection 下的虚拟分组,不是真实对象。**
|
||||
|
||||
> **第一版只允许围绕当前页,通过页面 AI 面板固定按钮直接触发;`summary node` 单例覆盖更新,`ai_note node` 每次新建;创建节点时自动连一条指向当前页的 `reference edge`。**
|
||||
|
||||
一句话收口:
|
||||
|
||||
> **第一版的目标不是做“大而全 AI 知识层”,而是让当前页第一次稳定地产出正式 artifact node,并且能在不污染页面树真相的前提下进入文件树管理视图。**
|
||||
@@ -1,427 +0,0 @@
|
||||
# 7-3 [process] 页面 AI Hermes 面板与 mnote Plugin 主线方案 v1
|
||||
|
||||
> 更新时间:2026-05-13
|
||||
>
|
||||
> 上位依据:
|
||||
> - `/mnt/Data1T/mnote/ARCHITECTURE.md`
|
||||
> - `/mnt/Data1T/mnote/design/01-05-current-priority-overview.md`
|
||||
> - `/mnt/Data1T/mnote/design/03-rust-web/process/3-rust-web-long-term-architecture-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-5-page-aggregate-single-truth-alignment-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-6-page-aggregate-alignment-checklist-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/done/5-10-wolai-page-settings-and-ai-surface-alignment-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/reference-code/hermes-web-ui-0.5.18`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/process/7-2-phase7-structured-artifact-write-chain-v1.md`
|
||||
>
|
||||
> 覆盖关系:
|
||||
> - 覆盖 `/mnt/Data1T/mnote/design/old/07-ai/process/7-phase7-ai-kernel-projection-plan-v4.md`
|
||||
> 中“`mnote-cli` 是唯一长期 agent 执行面”的口径。
|
||||
> - 保留 `v4` 中“Web 不应拥有第二套工具注册表、结构化写入必须回到 Rust runtime / kernel”的判断。
|
||||
> - 保留 `7-2` 中 `summary node / ai_note node / reference edge` 的对象模型和写入边界,
|
||||
> 但触发方改为 Hermes tool call,而不是页面 AI host 私有按钮或 `mnote-cli` host。
|
||||
|
||||
---
|
||||
|
||||
## 1. 文档目的
|
||||
|
||||
这份稿只回答一个问题:
|
||||
|
||||
> **未来页面 AI 的长期主语到底是谁。**
|
||||
|
||||
当前冻结答案是:
|
||||
|
||||
> **页面 AI 面板只是 Hermes 的页面内客户端;Hermes session/message/tool event/usage/model 才是会话真相;mnote 通过 Hermes skill/plugin 暴露业务能力。**
|
||||
|
||||
这不是把 mnote 的业务真相交给 Hermes。长期边界必须分清:
|
||||
|
||||
- Hermes 负责 AI 编排、会话、模型、tool call 调度和聊天历史。
|
||||
- mnote 负责页面、树、正文、artifact、edge、projection 和审计事实。
|
||||
- 页面 AI 面板只负责在文档页里打开一个 Hermes 客户端。
|
||||
|
||||
一句话收口:
|
||||
|
||||
> **AI 会话归 Hermes,mnote 能力归 Rust kernel;页面 AI 面板只连接两者。**
|
||||
|
||||
---
|
||||
|
||||
## 2. 为什么要从 CLI-first 改为 Hermes-first
|
||||
|
||||
`CLI-first` 解决了一个真实问题:避免 Web 前端继续拥有私有 AI 编排、私有工具注册表和私有写链。
|
||||
|
||||
但它也带来了新的错位:
|
||||
|
||||
- 页面 AI 面板开始伪装成 `mnote-cli` 图形客户端。
|
||||
- Hermes、Codex、`openai-agents-python` 被统一压成“外置 agent”,但实际用户希望页面 AI 就是 Hermes 面板。
|
||||
- 真实会话能力、模型选择、tool event、thinking、usage、历史搜索这些已经是 Hermes 的强项,mnote 自己再做一套会重复。
|
||||
- 当前运行态已经出现冲突:页面壳默认发送 `provider=hermes`,而 `/api/ai-agent/run` 又按旧退场口径返回 `ai_provider_bridge_unavailable`。
|
||||
|
||||
因此新的主线不是恢复旧的 Web 私有 AI 编排,而是:
|
||||
|
||||
> **把页面 AI 从 `mnote-cli host` 改成 Hermes client,把 mnote 能力从 Web 私有 tool 改成 Hermes 可发现、可调用的 skill/plugin。**
|
||||
|
||||
---
|
||||
|
||||
## 3. 长期分层
|
||||
|
||||
### 3.1 Hermes
|
||||
|
||||
Hermes 负责:
|
||||
|
||||
- session 创建、恢复、重命名、删除、搜索
|
||||
- message 存储与 conversation history
|
||||
- model / provider / profile 选择
|
||||
- streaming 事件、thinking / reasoning、usage
|
||||
- tool call 调度、排队、取消、恢复
|
||||
- skill / plugin 的发现和启停
|
||||
|
||||
Hermes 不负责:
|
||||
|
||||
- 直接写 mnote 的 Convex 表
|
||||
- 直接构造第二套 page aggregate
|
||||
- 直接决定页面树、文件树、artifact、edge 的事实结构
|
||||
|
||||
### 3.2 mnote Rust kernel / runtime
|
||||
|
||||
mnote Rust 负责:
|
||||
|
||||
- `Page Aggregate`
|
||||
- `page.*` command
|
||||
- `tree.*` command
|
||||
- `kernel.*` query / edge
|
||||
- `summary node / ai_note node / reference edge`
|
||||
- projection、audit、idempotency、workspace / actor scope
|
||||
|
||||
Rust 不负责:
|
||||
|
||||
- 存储 Hermes 聊天历史
|
||||
- 维护 Hermes session 列表
|
||||
- 重做 Hermes 模型、profile、usage 管理
|
||||
|
||||
### 3.3 页面 AI Leptos 面板
|
||||
|
||||
页面 AI 面板负责:
|
||||
|
||||
- 右下角入口与右侧抽屉壳层继续服从 Wolai 对齐结果
|
||||
- 用 Leptos 实现 Hermes chat 的页面内子集
|
||||
- 调用 Hermes session / run / stream API
|
||||
- 把当前页面上下文作为 Hermes run 的输入或 session workspace context
|
||||
- 展示 Hermes 返回的 message、reasoning、tool event、error、usage
|
||||
|
||||
页面 AI 面板不负责:
|
||||
|
||||
- 自己保存聊天真相
|
||||
- 自己维护工具注册表
|
||||
- 自己执行页面写入
|
||||
- 自己 fallback 到 `mnote-cli` 或旧 sidecar
|
||||
|
||||
### 3.4 mnote Hermes skill/plugin
|
||||
|
||||
mnote 需要作为 Hermes skill/plugin 暴露能力。
|
||||
|
||||
第一版建议能力分组:
|
||||
|
||||
- `mnote.page.get`
|
||||
- `mnote.page.save`
|
||||
- `mnote.page.update_title`
|
||||
- `mnote.page.update_options`
|
||||
- `mnote.tree.create`
|
||||
- `mnote.tree.move`
|
||||
- `mnote.search.documents`
|
||||
- `mnote.artifact.create_summary`
|
||||
- `mnote.artifact.create_ai_note`
|
||||
- `mnote.kernel.attach_reference`
|
||||
|
||||
这些工具可以由 plugin 内部调用:
|
||||
|
||||
- Rust Web 同源 tool bridge
|
||||
- `mnote-cli` JSON adapter
|
||||
- 或后续更稳定的 Rust plugin bridge
|
||||
|
||||
但对 Hermes 来说,它们必须表现为一组稳定 Hermes tools,而不是页面前端私有函数。
|
||||
|
||||
---
|
||||
|
||||
## 4. 会话真相
|
||||
|
||||
页面 AI 的会话真相固定在 Hermes。
|
||||
|
||||
mnote 不保存:
|
||||
|
||||
- 聊天消息列表
|
||||
- assistant 文本历史
|
||||
- thinking / reasoning 历史
|
||||
- tool event 完整展开状态
|
||||
- session 标题、分组、usage
|
||||
|
||||
mnote 可以保存:
|
||||
|
||||
- 结构化写入产生的 audit
|
||||
- artifact node
|
||||
- reference edge
|
||||
- page/body/title/options 的正式变更
|
||||
- 与一次 Hermes tool call 对应的 request / trace / actor / reason
|
||||
|
||||
也就是说,mnote 只保存“对 mnote 事实源造成影响的结果”,不复制 Hermes 的聊天数据库。
|
||||
|
||||
---
|
||||
|
||||
## 5. 页面上下文进入 Hermes 的方式
|
||||
|
||||
页面 AI 面板打开时,mnote 应提供最小上下文包:
|
||||
|
||||
- `workspaceId`
|
||||
- `documentId`
|
||||
- 页面标题
|
||||
- `pageAggregate` 摘要
|
||||
- 当前选区 / blockId / selected text
|
||||
- 页面设置
|
||||
- 当前用户 actor / capability 摘要
|
||||
|
||||
上下文传入 Hermes 有两种可接受方式:
|
||||
|
||||
1. 作为 run input / instructions 的结构化上下文。
|
||||
2. 作为 Hermes session workspace context,由 mnote panel 在创建或恢复 session 时设置。
|
||||
|
||||
第一版优先采用简单方式:
|
||||
|
||||
> 页面 AI 面板每次发起 run 时附带当前页面上下文摘要;Hermes 如需读取最新正文,再通过 `mnote.page.get` 工具回读。
|
||||
|
||||
这样可以避免把 page aggregate 大对象长期塞进 Hermes session,也避免 stale context 变成事实源。
|
||||
|
||||
---
|
||||
|
||||
## 6. API 与路由边界
|
||||
|
||||
### 6.1 退役 `/api/ai-agent/run` 主路径
|
||||
|
||||
`/api/ai-agent/run` 不再作为页面 AI 的长期主入口。
|
||||
|
||||
允许状态:
|
||||
|
||||
- 暂时保留为 legacy compat,明确返回旧接口退场信息
|
||||
- 或只用于旧 smoke / 对照验证
|
||||
|
||||
禁止状态:
|
||||
|
||||
- 页面 AI 新实现继续向它发送 `provider=hermes`
|
||||
- `/api/ai-agent/run` 继续作为 Hermes 面板的主代理
|
||||
- 它继续持有 mnote 私有工具注册表或执行编排
|
||||
|
||||
### 6.2 新增 Hermes client proxy
|
||||
|
||||
浏览器不应直接暴露 Hermes API key。
|
||||
|
||||
建议在 `mnote-web` 中提供同源薄代理:
|
||||
|
||||
- `/api/hermes/client/sessions`
|
||||
- `/api/hermes/client/runs`
|
||||
- `/api/hermes/client/events`
|
||||
- `/api/hermes/client/models`
|
||||
- `/api/hermes/client/tools`
|
||||
|
||||
这层只做:
|
||||
|
||||
- auth / cookie / token 转发
|
||||
- 同源安全边界
|
||||
- 页面上下文最小注入
|
||||
- 错误码标准化
|
||||
|
||||
这层不做:
|
||||
|
||||
- session 真相存储
|
||||
- message 真相存储
|
||||
- tool 执行编排
|
||||
- 旧 provider fallback
|
||||
|
||||
### 6.3 mnote tool bridge
|
||||
|
||||
Hermes 调用 mnote 工具时,应进入窄桥:
|
||||
|
||||
```text
|
||||
Hermes tool call
|
||||
-> mnote Hermes plugin
|
||||
-> mnote-web /api/hermes/tools/mnote/*
|
||||
-> Rust runtime / kernel command/query
|
||||
-> Hermes tool result
|
||||
```
|
||||
|
||||
第一版不要求一次性冻结最终 URL,但要求协议字段稳定:
|
||||
|
||||
- `toolName`
|
||||
- `arguments`
|
||||
- `workspaceId`
|
||||
- `documentId`
|
||||
- `actor`
|
||||
- `sessionId`
|
||||
- `traceId`
|
||||
- `idempotencyKey`
|
||||
- `dryRun`
|
||||
- `capabilityScope`
|
||||
|
||||
---
|
||||
|
||||
## 7. Leptos 面板参考范围
|
||||
|
||||
参考 `hermes-web-ui-0.5.18`,但只采用页面内必要子集。
|
||||
|
||||
第一版采用:
|
||||
|
||||
- Chat session list
|
||||
- Message list
|
||||
- Chat input
|
||||
- streaming delta
|
||||
- thinking / reasoning 展开
|
||||
- tool started / tool completed 展开
|
||||
- model selector
|
||||
- error / retry / abort
|
||||
- session search 可后置
|
||||
|
||||
第一版不采用:
|
||||
|
||||
- 平台 Channels 管理
|
||||
- Jobs / Cron 管理
|
||||
- Profiles 管理全页面
|
||||
- Logs 全页面
|
||||
- Files 全浏览器
|
||||
- Terminal
|
||||
- Group Chat
|
||||
- Hermes 全局 Settings
|
||||
|
||||
这些能力属于 Hermes 管理台,不属于 mnote 页面 AI 抽屉。
|
||||
|
||||
实现要求:
|
||||
|
||||
- 使用 Leptos island 实现,不引入 Vue / Naive UI。
|
||||
- 保留 Wolai 对齐的右下角入口和右侧 drawer 容器。
|
||||
- 文案和视觉以 mnote 文档页密度为准,不照搬 Hermes Web UI 的整站导航。
|
||||
|
||||
---
|
||||
|
||||
## 8. 结构化 Artifact 写链
|
||||
|
||||
`7-2` 的对象模型继续成立:
|
||||
|
||||
- `summary node`
|
||||
- `ai_note node`
|
||||
- `reference edge`
|
||||
- `AI Artifacts` projection-only 分组
|
||||
|
||||
但触发方改为 Hermes tool call:
|
||||
|
||||
- 用户可以在 Hermes 面板中自然语言要求总结当前页。
|
||||
- Hermes 决定调用 `mnote.artifact.create_summary`。
|
||||
- 或页面面板提供快捷按钮,但按钮本质也是向 Hermes 发送意图,不是绕过 Hermes 直接写 mnote。
|
||||
|
||||
第一版允许两个快捷入口:
|
||||
|
||||
- `创建 Summary`
|
||||
- `创建 AI Note`
|
||||
|
||||
但它们必须走:
|
||||
|
||||
```text
|
||||
Leptos panel -> Hermes session/run -> mnote plugin tool call -> Rust kernel
|
||||
```
|
||||
|
||||
不得走:
|
||||
|
||||
```text
|
||||
Leptos panel -> /api/documents/* 直接写 artifact
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 9. 权限与安全
|
||||
|
||||
Hermes 可以调度工具,但 mnote 必须做最终授权。
|
||||
|
||||
每个 mnote tool call 至少校验:
|
||||
|
||||
- 当前 actor 是否登录
|
||||
- actor 是否属于 workspace
|
||||
- 当前页面是否允许 AI 读取
|
||||
- 当前页面是否允许 AI 写入
|
||||
- 当前工具是否允许写入页面 / 树 / artifact
|
||||
- 是否需要 `dryRun` 或确认
|
||||
|
||||
默认第一版:
|
||||
|
||||
- 读当前页:允许
|
||||
- 写当前页:按页面 capability
|
||||
- 创建 summary / ai_note:按当前页 artifact capability
|
||||
- 跨页写入:默认禁止
|
||||
- 跨 workspace:禁止
|
||||
|
||||
---
|
||||
|
||||
## 10. 迁移步骤
|
||||
|
||||
### Phase A:设计口径统一
|
||||
|
||||
- 新增本稿作为 07-ai 当前主线。
|
||||
- 将 `7-v4 CLI-first` 移入 `design/old/07-ai/process/` 并标记 `[recycle]`。
|
||||
- 更新仍引用 `mnote-cli` 唯一长期 agent 执行面的活跃设计稿。
|
||||
|
||||
### Phase B:薄 Hermes client proxy
|
||||
|
||||
- 在 `mnote-web` 补 Hermes client proxy。
|
||||
- 页面 AI 面板不再调用 `/api/ai-agent/run`。
|
||||
- 浏览器不直接持有 Hermes API key。
|
||||
|
||||
### Phase C:Leptos Hermes 面板最小子集
|
||||
|
||||
- 实现 session 创建 / 恢复。
|
||||
- 实现 run / stream / abort。
|
||||
- 实现 message / reasoning / tool event 展示。
|
||||
- 保留 Wolai 右侧抽屉壳。
|
||||
|
||||
### Phase D:mnote Hermes plugin
|
||||
|
||||
- 暴露 mnote tool manifest。
|
||||
- 先接 `mnote.page.get`、`mnote.page.save`、`mnote.artifact.create_summary`、`mnote.artifact.create_ai_note`。
|
||||
- 工具结果回到 Hermes tool event。
|
||||
|
||||
### Phase E:退役旧面板执行链
|
||||
|
||||
- `/api/ai-agent/run` 从主路径移除。
|
||||
- 旧 React `DocumentAiAgentPanel.runtime` 降为历史参考或 compat。
|
||||
- `provider=hermes/codex/claudecode` 502 不再出现在新页面 AI 主链。
|
||||
|
||||
---
|
||||
|
||||
## 11. 验收标准
|
||||
|
||||
第一版完成时必须满足:
|
||||
|
||||
- 页面 AI 抽屉打开后可创建或恢复 Hermes session。
|
||||
- Hermes session 存储中能看到页面 AI 的消息历史。
|
||||
- mnote 本地不复制聊天消息真相。
|
||||
- 发送消息后,事件流来自 Hermes run。
|
||||
- tool call 展示使用 Hermes tool event。
|
||||
- Hermes 可调用至少一个只读 mnote 工具读取当前页面。
|
||||
- Hermes 可调用至少一个写入工具,经 Rust runtime 写回当前页或创建 artifact。
|
||||
- 页面刷新后,AI 会话从 Hermes 恢复,而不是从 mnote 本地 state 恢复。
|
||||
- 结构化写入产生的 artifact / edge 能在 mnote projection 中验证。
|
||||
|
||||
---
|
||||
|
||||
## 12. 禁止项
|
||||
|
||||
- 不再新增 Web 私有 AI tool registry。
|
||||
- 不再把 `mnote-cli` 写成页面 AI 唯一长期执行面。
|
||||
- 不把 Hermes 聊天历史复制进 mnote page aggregate。
|
||||
- 不让 Hermes plugin 直接写 Convex。
|
||||
- 不在 Leptos 面板里重做 Hermes 后台管理台。
|
||||
- 不把 `AI Artifacts` 做成真实 kernel node。
|
||||
- 不绕过 Rust runtime 创建 artifact / edge。
|
||||
|
||||
---
|
||||
|
||||
## 13. 最终冻结口径
|
||||
|
||||
> **页面 AI 是 Hermes 面板,不是 mnote-cli 面板。**
|
||||
|
||||
> **Hermes 持有 AI 会话真相,mnote 持有业务对象真相。**
|
||||
|
||||
> **mnote 通过 Hermes skill/plugin 暴露工具,工具最终回到 Rust runtime / kernel。**
|
||||
|
||||
> **Leptos 负责页面内 Hermes 客户端体验,不负责 AI 编排。**
|
||||
@@ -0,0 +1,277 @@
|
||||
# 7-7 [process] 页面 AI Mini Hermes 控制面设计与执行 checklist v1
|
||||
|
||||
> 更新时间:2026-05-14
|
||||
>
|
||||
> 当前状态:`PROCESS`。当前实现已经可以通过 Hermes 返回回复,并已完成 `7-4` 的 session/run/tool/writeback/audit 主链;本稿只承接下一阶段体验与设置面的收口。
|
||||
>
|
||||
> 上位依据:
|
||||
> - `/mnt/Data1T/mnote/ARCHITECTURE.md`
|
||||
> - `/mnt/Data1T/mnote/design/01-05-current-priority-overview.md`
|
||||
> - `/mnt/Data1T/mnote/design/03-rust-web/process/3-rust-web-long-term-architecture-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-5-page-aggregate-single-truth-alignment-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/process/5-6-page-aggregate-alignment-checklist-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/05-editor-mainline/reference-code/hermes-web-ui-0.5.18`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/done/7-3-page-ai-hermes-panel-and-mnote-plugin-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/done/7-4-page-ai-hermes-panel-execution-checklist-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/done/7-5-hermes-client-proxy-contract-v1.md`
|
||||
> - `/mnt/Data1T/mnote/design/07-ai/done/7-6-mnote-hermes-plugin-tool-contract-v1.md`
|
||||
|
||||
---
|
||||
|
||||
## 1. 方向判断
|
||||
|
||||
当前截图和实现状态说明:页面 AI 已经能回复,但它还更像“能发消息的 Hermes run 面板”,缺少用户自然期待的 Hermes 运行态控制与设置入口。
|
||||
|
||||
下一阶段不要把 mnote 做成第二个 Hermes 管理台,也不要把 Hermes 的 Settings / Profiles / Usage / Logs 全部搬进页面抽屉。正确方向是:
|
||||
|
||||
> **页面 AI 面板成为 Mini Hermes control surface:只展示和当前 mnote 页面会话直接相关的 session、run、model、profile、tool、context scope 与错误恢复;所有全局配置真相仍归 Hermes。**
|
||||
|
||||
边界继续保持:
|
||||
|
||||
- Hermes 持有 session/message/tool event/usage/model/profile 真相。
|
||||
- mnote 只持有页面、树、正文、artifact、edge、Page Aggregate 和 audit 真相。
|
||||
- 页面 AI 面板只调用 Hermes,不保存聊天历史,不维护 provider/API key,不重建 plugin registry。
|
||||
- 需要深层设置时跳转或 deep link 到 Hermes 自己的设置页。
|
||||
|
||||
---
|
||||
|
||||
## 2. Hermes Web UI 参考索引
|
||||
|
||||
参考根目录固定为:
|
||||
|
||||
```text
|
||||
/mnt/Data1T/mnote/design/05-editor-mainline/reference-code/hermes-web-ui-0.5.18
|
||||
```
|
||||
|
||||
只参考下表列出的具体位置。目标是复用 Hermes 的语义与行为边界,仍然用 Leptos 实现 mnote 页面内面板。
|
||||
|
||||
| mnote 下一步任务 | 参考文件 | 搜索点 / 具体位置 | 参考目的 | 不采用内容 |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| run 发起、恢复和事件语义 | `packages/client/src/api/hermes/chat.ts` | `StartRunRequest`、`RunEvent`、`registerSessionHandlers`、`resumeSession`、`startRunViaSocket` | 对齐 run 创建、session room 恢复、事件类型和浏览器端分发语义 | 不直接复用 Vue/TS client,不让浏览器绕过 mnote-web proxy |
|
||||
| 前端消息归并 | `packages/client/src/stores/hermes/chat.ts` | `mapHermesMessages`、`case 'tool.started'`、`case 'tool.completed'`、`refreshActiveSession`、`switchSession` | 对齐 message/tool event 在前端归并成消息列表的规则 | 不把归并结果保存到 mnote local/session storage 作为真相 |
|
||||
| 面板分层 | `packages/client/src/components/hermes/chat/ChatPanel.vue` | `activeSessionTitle`、`showSessions`、`handleNewChat`、`MessageList`、`ChatInput`、`SessionListItem` | 对齐 session list / message list / input 的最小层次 | 不复制 Hermes 全屏布局、Vue 组件结构或 Naive UI |
|
||||
| tool 消息展示 | `packages/client/src/components/hermes/chat/MessageItem.vue` | `message.role === 'tool'`、`formatToolPayload`、`tool-preview`、`tool-details`、`tool-error-badge` | 对齐 tool 结果默认折叠、摘要、错误 badge、详情展开 | 不把 tool result 当正文写入,不扩大为审计详情管理台 |
|
||||
| session 列表项 | `packages/client/src/components/hermes/chat/SessionListItem.vue` | `session-item-title`、`session.title`、`session-item-model` | 对齐 session 标题、模型和时间的展示语义 | 不把 Hermes session title 同步为 mnote page title |
|
||||
| model 选择展示 | `packages/client/src/components/layout/ModelSelector.vue` | `selectedDisplayName`、`handleSelect`、`model-name`、`model-item` | 对齐模型显示名称、选择行为和禁用态 | 不在 mnote 保存 model/provider/API key 真相 |
|
||||
| run 生命周期与持久化 | `packages/server/src/services/hermes/chat-run-socket.ts` | `handleRun`、`emit`、`applyResponseStreamEvent`、`flushResponseRunToDb`、`markCompleted` | 对齐 queued/running/tool_calling/completed/failed 与 flush 到 Hermes DB 的时机 | 不在 mnote 里重写 Hermes 编排器 |
|
||||
| session 存储真相 | `packages/server/src/db/hermes/session-store.ts` | `HermesSessionRow`、`HermesMessageRow`、`getSessionDetail`、`addMessage`、`renameSession` | 明确 session/message/tool call 真相字段来自 Hermes | 不在 mnote 建第二份 chat/session 表 |
|
||||
| plugin/tool 发现 | `packages/server/src/services/hermes/plugins.ts` | `PluginManager`、`providesTools`、`listHermesPlugins`、`requiresEnv` | 对齐 mnote tools 作为 Hermes plugin/tool registry 的一部分被发现 | 不把 mnote-web 私有 route 当成最终 plugin registry |
|
||||
| skill/plugin API 外观 | `packages/client/src/api/hermes/plugins.ts`、`packages/client/src/api/hermes/skills.ts` | `list`、`get`、`enable`、`disable` 类方法 | 仅用于面板显示 mnote plugin/tool 可用性和缺失状态 | 不实现完整 Hermes plugin/skill 管理页 |
|
||||
| 不进入 mnote 面板第一阶段 | `packages/client/src/views/hermes/SettingsView.vue`、`ProfilesView.vue`、`UsageView.vue`、`LogsView.vue`、`JobsView.vue`、`FilesView.vue`、`ChannelsView.vue`、`TerminalView.vue`、`GroupChatView.vue` | 页面级管理视图入口 | 用来明确边界:这些属于 Hermes 管理台 | 不搬进 mnote 页面 AI 抽屉 |
|
||||
|
||||
快速定位命令:
|
||||
|
||||
```bash
|
||||
cd /mnt/Data1T/mnote/design/05-editor-mainline/reference-code/hermes-web-ui-0.5.18
|
||||
rg -n "StartRunRequest|RunEvent|registerSessionHandlers|resumeSession|startRunViaSocket|mapHermesMessages|tool\\.started|tool\\.completed|activeSessionTitle|formatToolPayload|selectedDisplayName|handleRun|flushResponseRunToDb|PluginManager|providesTools" packages/client/src packages/server/src
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 3. 产品边界
|
||||
|
||||
### 3.1 必须进入 mnote 页面 AI 面板
|
||||
|
||||
- 当前 Hermes session 标题、session id、模型名、profile 名和恢复状态。
|
||||
- 当前 run 状态:`idle`、`queued`、`running`、`tool_calling`、`completed`、`failed`、`aborted`。
|
||||
- 当前页面上下文范围:当前页、当前选区、当前块、全文、页面设置。
|
||||
- 当前 mnote tools 可用性:`mnote.page.get`、`mnote.page.save`、`mnote.page.update_title`、`mnote.page.update_options`、`mnote.artifact.create_summary`、`mnote.artifact.create_ai_note`。
|
||||
- 最近 tool call 摘要、参数摘要、结果摘要、失败原因和 trace/audit id。
|
||||
- 停止、重试、继续、重新读取当前页上下文的最小操作。
|
||||
- 跳转 Hermes 设置的入口,说明缺失项应在 Hermes 中配置。
|
||||
|
||||
### 3.2 不进入 mnote 页面 AI 面板
|
||||
|
||||
- provider/API key 密钥管理。
|
||||
- 全局 profile 创建、删除、复杂编辑。
|
||||
- Hermes plugin marketplace / skill marketplace 管理。
|
||||
- usage 报表、日志中心、任务中心、文件中心、频道、终端、群聊。
|
||||
- Hermes session 数据库迁移、导入导出、conversation 管理台。
|
||||
- 独立 mnote 聊天历史存储。
|
||||
|
||||
### 3.3 可选但不阻塞第一阶段
|
||||
|
||||
- 当前页面最近 sessions 搜索。
|
||||
- session 重命名与删除。
|
||||
- profile/model 下拉切换。
|
||||
- tool event JSON 详情复制。
|
||||
- session deep link 到 Hermes 管理台。
|
||||
|
||||
---
|
||||
|
||||
## 4. 目标信息架构
|
||||
|
||||
页面 AI 抽屉保持 Wolai 对齐后的壳层,内部按四层组织:
|
||||
|
||||
1. 顶部状态条:session 标题、模型/profile、连接状态、设置跳转。
|
||||
2. 消息区:Hermes message list、streaming 回复、tool event 折叠项。
|
||||
3. 上下文与工具条:当前 context scope、可用 mnote tools、最近 audit/trace。
|
||||
4. 输入区:prompt 输入、发送、停止、重试、继续。
|
||||
|
||||
验收时不要只看 DOM,应以截图和交互为准:
|
||||
|
||||
- 顶部状态在窄屏不挤压输入区。
|
||||
- tool event 折叠项不会撑破抽屉宽度。
|
||||
- 失败态能看到可执行动作,不只是一段错误文本。
|
||||
- 设置入口不会暗示 mnote 自己持有 API key。
|
||||
|
||||
---
|
||||
|
||||
## 5. 数据与 API 边界
|
||||
|
||||
### 5.1 mnote-web proxy 需要补齐的读接口
|
||||
|
||||
- `GET /api/hermes/client/session/current?documentId=...`
|
||||
- `GET /api/hermes/client/sessions?documentId=...&limit=...`
|
||||
- `GET /api/hermes/client/session/:sessionId`
|
||||
- `GET /api/hermes/client/models`
|
||||
- `GET /api/hermes/client/tools?scope=mnote`
|
||||
- `GET /api/hermes/client/runtime/status`
|
||||
|
||||
这些接口只透传或规整 Hermes 状态,不在 mnote 保存真相。
|
||||
|
||||
### 5.2 mnote-web proxy 需要补齐的操作接口
|
||||
|
||||
- `POST /api/hermes/client/run`
|
||||
- `POST /api/hermes/client/run/:runId/stop`
|
||||
- `POST /api/hermes/client/run/:runId/retry`
|
||||
- `POST /api/hermes/client/session/:sessionId/resume`
|
||||
- `POST /api/hermes/client/session/:sessionId/rename`
|
||||
- `DELETE /api/hermes/client/session/:sessionId`
|
||||
|
||||
第一阶段可以只完成 `run/stop/resume`,`retry/rename/delete` 可以排到 P2,但 UI 文案不能让用户误以为已经支持。
|
||||
|
||||
### 5.3 mnote tool manifest
|
||||
|
||||
页面 AI 面板展示 tool 可用性时应优先从 Hermes plugin/tool registry 来,而不是硬编码前端列表。允许 mnote-web 在过渡期提供同源聚合:
|
||||
|
||||
- tool name
|
||||
- description
|
||||
- read/write 分类
|
||||
- required scope
|
||||
- permission 状态
|
||||
- last call summary
|
||||
- last audit id
|
||||
- unavailable reason
|
||||
|
||||
---
|
||||
|
||||
## 6. 顺序执行 checklist
|
||||
|
||||
### A. 设计与现状审计
|
||||
|
||||
- [ ] A1. 打开当前 `3000` 页面 AI 抽屉,记录“能回复但缺设置/运行态控制”的截图到 `tmp/`。
|
||||
- 验收标准:截图能看到回复链路、顶部或设置区域缺失点、当前 session/run 状态展示缺口。
|
||||
- [ ] A2. 用 `rg` 确认活跃设计稿中页面 AI 主线已经指向 Hermes session/run/events。
|
||||
- 验收标准:`design/07-ai/process` 只剩本 `7-7` 作为 AI 活跃稿;`7-2` 到 `7-6` 位于 `done/`。
|
||||
- [ ] A3. 对照 Hermes Web UI 参考索引打开精确文件,不整目录通读。
|
||||
- 验收标准:实现任务说明中写明参考了哪个 `packages/...` 文件和哪个搜索点。
|
||||
|
||||
### B. 面板状态模型
|
||||
|
||||
- [ ] B1. 定义 Leptos 侧 `HermesPanelState`。
|
||||
- 验收标准:状态至少包含 `sessionId`、`sessionTitle`、`modelName`、`profileName`、`runStatus`、`connectionStatus`、`contextScope`、`toolAvailability`、`lastAudit`。
|
||||
- [ ] B2. 明确哪些字段来自 Hermes,哪些字段来自 mnote。
|
||||
- 验收标准:session/message/model/profile/run/tool event 来自 Hermes;page title/context/audit 来自 mnote;没有字段把 Hermes session title 当作页面标题。
|
||||
- [ ] B3. 增加空态、连接失败态、tool 不可用态。
|
||||
- 验收标准:Hermes 未启动、未配置模型、mnote plugin 缺失、权限不足分别有不同 UI 状态。
|
||||
|
||||
### C. 顶部 Mini Hermes 状态条
|
||||
|
||||
- [ ] C1. 展示当前 session 标题和恢复状态。
|
||||
- 验收标准:刷新页面后能从 Hermes session detail 恢复标题和消息,不从 mnote 本地 state 恢复聊天真相。
|
||||
- [ ] C2. 展示 model/profile 摘要。
|
||||
- 验收标准:能看到当前模型与 profile;缺失时显示“去 Hermes 配置”的动作,而不是在 mnote 内要求填写 API key。
|
||||
- [ ] C3. 增加设置跳转入口。
|
||||
- 验收标准:入口跳到 Hermes 设置或 profile 页面;mnote 页面内不出现 provider/API key 编辑表单。
|
||||
|
||||
### D. Run 控制与恢复
|
||||
|
||||
- [ ] D1. 显示 run 状态。
|
||||
- 验收标准:发送后能依次看到 running/tool_calling/completed 或 failed;状态来自 Hermes run event。
|
||||
- [ ] D2. 支持停止当前 run。
|
||||
- 验收标准:点击停止后 Hermes run 进入 aborted/failed 的明确终止态,输入框恢复可用。
|
||||
- [ ] D3. 支持失败后重试或继续。
|
||||
- 验收标准:失败态有明确按钮;重试不会创建 mnote 本地聊天副本。
|
||||
- [ ] D4. 刷新后恢复进行中或已完成 session。
|
||||
- 验收标准:刷新页面不丢失 Hermes 消息;若 run 已结束,状态显示 completed/failed 而不是一直 loading。
|
||||
|
||||
### E. Context Scope
|
||||
|
||||
- [ ] E1. 增加 context scope 控件。
|
||||
- 验收标准:至少支持当前页、当前选区、当前块、页面设置四类;无选区时选区项禁用。
|
||||
- [ ] E2. run input 只携带当前 scope 的上下文摘要。
|
||||
- 验收标准:正文大对象不长期写进 Hermes session;Hermes 需要最新正文时通过 `mnote.page.get` 回读。
|
||||
- [ ] E3. tool call audit 记录 context scope。
|
||||
- 验收标准:`mnote.page.save`、artifact 写入等 audit 能看到本次来源是 page/selection/block/options 哪种 scope。
|
||||
|
||||
### F. Tool 可用性与最近调用
|
||||
|
||||
- [ ] F1. 展示 mnote tools 清单。
|
||||
- 验收标准:清单来源于 Hermes plugin/tool registry 或 mnote-web 过渡聚合,不能只写死在前端。
|
||||
- [ ] F2. 区分只读工具和写入工具。
|
||||
- 验收标准:`mnote.page.get` 明确为只读;`mnote.page.save`、`mnote.page.update_title`、`mnote.artifact.*` 明确为写入。
|
||||
- [ ] F3. tool event 默认折叠,支持展开详情。
|
||||
- 验收标准:交互参考 `MessageItem.vue` 的 `tool-preview` / `tool-details`,但使用 Leptos 实现;长 JSON 不撑破布局。
|
||||
- [ ] F4. 最近 tool call 关联 audit。
|
||||
- 验收标准:能从 UI 或测试输出看到 `sessionId/runId/toolCallId/traceId/auditId` 的串联。
|
||||
|
||||
### G. Session 列表最小面
|
||||
|
||||
- [ ] G1. 支持当前页面最近 Hermes sessions 列表。
|
||||
- 验收标准:列表来自 Hermes session API;只过滤/标注当前 document context,不复制 session 到 mnote。
|
||||
- [ ] G2. 支持切换 session。
|
||||
- 验收标准:切换后 message list 从 Hermes detail 恢复;页面正文不因切换 session 被自动修改。
|
||||
- [ ] G3. P2 支持 rename/delete/search。
|
||||
- 验收标准:若未实现,UI 不出现可点击假按钮;若实现,操作调用 Hermes session API。
|
||||
|
||||
### H. 错误与权限
|
||||
|
||||
- [ ] H1. Hermes 未启动或 proxy 502 时显示可诊断状态。
|
||||
- 验收标准:错误能区分 upstream unavailable、auth/permission、model missing、tool unavailable。
|
||||
- [ ] H2. 写入工具权限失败不泄露正文。
|
||||
- 验收标准:tool error 展示摘要、trace/audit id 和恢复动作,不展示不必要的正文 payload。
|
||||
- [ ] H3. 旧 `/api/ai-agent/run` 继续保持退场 guard。
|
||||
- 验收标准:新页面 AI 主链不会调用旧入口;retirement smoke 继续通过。
|
||||
|
||||
### I. 自动化验收
|
||||
|
||||
- [ ] I1. 新增或扩展 browser smoke:session 状态条。
|
||||
- 验收标准:断言 session title/model/run status 可见。
|
||||
- [ ] I2. 新增或扩展 browser smoke:run stop/retry。
|
||||
- 验收标准:至少覆盖 stop;retry 若未实现则断言按钮不存在或禁用。
|
||||
- [ ] I3. 新增或扩展 browser smoke:context scope。
|
||||
- 验收标准:选区/当前页上下文能进入 run payload 或 tool audit。
|
||||
- [ ] I4. 新增或扩展 browser smoke:tool 可用性与 audit。
|
||||
- 验收标准:能看到 mnote tool 列表、一次 tool call、对应 audit id。
|
||||
- [ ] I5. 移动端 smoke。
|
||||
- 验收标准:状态条、tool 折叠、输入区在窄屏不重叠。
|
||||
|
||||
---
|
||||
|
||||
## 7. Done Gate
|
||||
|
||||
本稿移入 `done/` 前必须同时满足:
|
||||
|
||||
- [ ] 页面 AI 抽屉具备 Mini Hermes 状态条,用户能看见当前 session、model/profile、run 状态。
|
||||
- [ ] 页面 AI 抽屉具备 context scope 控件,run input 和 tool audit 能反映 scope。
|
||||
- [ ] 页面 AI 抽屉能展示 mnote tool 可用性、最近 tool call 和 audit/trace 串联。
|
||||
- [ ] stop 至少可用;retry/rename/delete 若未实现,必须明确标为 P2 且 UI 不出现假可用按钮。
|
||||
- [ ] Hermes 未启动、模型缺失、plugin/tool 不可用、权限失败至少四类错误有可区分展示。
|
||||
- [ ] 页面刷新后仍以 Hermes session detail/resume 为会话真相。
|
||||
- [ ] mnote 不保存聊天消息真相,不保存 provider/API key,不创建第二套 plugin registry。
|
||||
- [ ] `git diff --check` 通过。
|
||||
- [ ] Rust 侧相关测试通过:`cargo test -p mnote-web hermes_client -- --nocapture`、`cargo test -p mnote-web hermes_tools_ -- --nocapture`。
|
||||
- [ ] 正式 `3000` smoke 覆盖 session/run/tool/audit/mobile,且证据写回本文。
|
||||
|
||||
---
|
||||
|
||||
## 8. 当前建议的下一步
|
||||
|
||||
优先顺序:
|
||||
|
||||
1. 先补顶部 Mini Hermes 状态条和错误态,因为这是当前“能回复但缺 Hermes 设置感”的直接缺口。
|
||||
2. 再补 context scope 和 tool 可用性,让用户明确 Hermes 正在调用 mnote 的哪些能力。
|
||||
3. 最后补 session 列表、rename/delete/search 等历史管理能力。
|
||||
|
||||
不要先做 Hermes 全局设置页复刻。API key、provider、全局 profile、usage/logs/jobs/files/channels 仍应留在 Hermes 自己的管理台。
|
||||
Reference in New Issue
Block a user