Files
mnote/design/old/07-ai/done/7-60-page-ai-settings-ia-cleanup-v1.md
T

515 lines
15 KiB
Markdown
Raw Normal View History

# [recycle] 7-60 Page AI 设置 IA 整理 v1
> 创建时间:2026-06-10
>
> 当前状态:`DONE`
>
> Owner07-ai / Page AI / Settings IA / Runtime status
>
> 前置完成项:
> - `design/07-ai/done/7-58-page-ai-reasonix-official-desktop-session-alignment-v1.md`
> - `design/07-ai/done/7-59-page-ai-reasonix-desktop-hermes-web-control-surface-alignment-v1.md`
>
> 当前问题来源:7-59 后 Page AI 已有 runtime status、queue、jobs、logs、sessions dashboard,但 UI 仍沿用旧的 `Common / Hermes / Reasonix / Chat-only / 高级 / Runtime` 分层,导致“设置”和“运行态”混在一起。
## 1. 第一结论
Page AI 设置需要按 owner 分三层:
```text
MNote = MNote 如何给 AI 上下文、权限、工具、会话历史和审计
Reasonix = Reasonix ACP/native-live/queue/MCP/memory 的专属运行配置
Hermes = Hermes gateway/profile/model/provider/session-load/replay/skills 的专属运行配置
```
同时必须把“运行态状态”从“设置”里拆出去:
```text
设置 = 可持久保存或影响后续 run 的配置
状态 = 当前这一轮/当前 session 的 live snapshot
```
当前截图里的混乱点不是单个控件坏了,而是抽象层级混用:
- 顶部显示 `Reasonix`runtime strip 却显示 `hermes · new-session`,用户会误以为当前 agent 与 runtime 不一致。
- `Common` 实际是 MNote 自身配置,但名字没有表达 owner。
- `高级``Runtime` 既有设置项,又有只读状态项。
- Runtime panel 里出现“打开 Hermes 设置”,但当前用户可能正在使用 Reasonix。
- `Chat-only` 被放成一级设置页,但它本质是 MNote/API Chat/Hermes provider 的一种 runtime/profile 类型,不应和 Reasonix/Hermes 并列为 provider owner。
## 2. 新信息架构
### 2.1 Page AI 顶层导航
Page AI 抽屉保留五个一级工作区:
| 一级区 | 含义 | 当前入口 |
| --- | --- | --- |
| 聊天 | 当前页对话、工具卡、引用、权限决策 | 默认页 |
| 状态 | 当前 runtime/session/run live snapshot | 由 runtime strip 或状态图标打开 |
| 设置 | MNote / Reasonix / Hermes 三层配置 | 齿轮 |
| 能力 | 当前 runtime 可用 tools/skills/memory 清单与开关 | sparkle/能力图标 |
| 历史 | MNote session dashboard | 搜索/历史图标 |
原则:
- “状态”不承载长期配置。
- “设置”不展示 transient logs/job/active-run。
- “能力”可以按 runtime 过滤,但 capability owner 仍归 MNote / Reasonix / Hermes。
- “历史”展示 MNote session asset,不等于 Hermes DB 或 Reasonix native session。
### 2.2 设置页三层结构
设置页只保留三个主 tab
```text
MNote | Reasonix | Hermes
```
不再显示:
```text
Common | Chat-only | 高级
```
旧 tab 映射:
| 旧 tab / 控件 | 新归属 |
| --- | --- |
| `Common` | `MNote` |
| `Chat-only` | `MNote > API Chat / Chat-only profile` |
| `高级` 里的 context scope | `MNote > 默认上下文` |
| `高级` 里的 runtime status | `状态` |
| `Runtime` panel | `状态` |
| `打开 Hermes 设置` | `Hermes` tab 内 |
| Reasonix memory / skill filter | `Reasonix` |
| Hermes profile / builtin skill filter | `Hermes` |
## 3. MNote 设置
MNote tab 只放 MNote 自己拥有的控制面:
### 3.1 授权区域
来源:SQLite `directory_grants` / current workspace grants。
展示:
- 当前 workspace/root。
- allowed roots 数量。
- read/write 权限。
- 授权来源:manual / smoke / share / system。
- 权限缺失时的修复入口。
不展示:
- Hermes API key。
- Reasonix ACP binary。
- providerConversationId。
### 3.2 默认上下文
来源:Page AI context refs。
控件:
- 当前页。
- 打开资源。
- 选中文本。
- 页面子树。
- 附件/资源 tab。
保存语义:
- 这是 MNote 的默认 run envelope 规则。
- 不直接改 Reasonix/Hermes 的 native memory。
### 3.3 MNote 工具
范围:
- LightRAG。
- citation/open reference。
- page context。
- local file audit。
- changed files receipt。
- MNote MCP/tool facade。
展示:
- enabled/disabled。
- tool count。
- last failed tool。
- capability source。
### 3.4 会话与审计
范围:
- MNote history。
- export `json/markdown/jsonl`
- delete MNote history。
- changed files audit。
- permission pending queue。
删除文案必须固定:
```text
删除只影响 MNote 历史,不删除外部 Hermes/provider/Reasonix session。
```
外部删除只能出现在 Hermes tab 的危险区,并需要二次确认。
## 4. Reasonix 设置
Reasonix tab 只放 Reasonix 专属配置与能力:
### 4.1 Runtime
展示:
- ACP runtime name`reasonix`
- binary/wrapper`scripts/reasonix-acp-wrapper.mjs` 或配置来源。
- workspace key 规则。
- native-live 支持状态。
- supports session/loadfalse。
- supports replayfalse。
### 4.2 Native-live session
只展示配置和策略,不展示当前 active-run 日志。当前 live binding 细节在“状态”页。
设置项:
- native-live 开关或策略说明。
- cold resume fallback 是否启用。
- short reply without context 的提示策略。
### 4.3 Queue
设置项:
- busy send 行为:enqueue。
- cancel queued item 策略。
- queue max length。
- queue timeout。
当前 queued count / preview 属于“状态”页。
### 4.4 MCP / tools / memory
范围:
- Reasonix MCP specs。
- Reasonix tool count。
- Reasonix memory 开关。
- Reasonix skill filter。
不放:
- Hermes profile。
- MNote LightRAG provider 设置。
- Chat-only provider 配置。
## 5. Hermes 设置
Hermes tab 只放 Hermes 相关配置:
### 5.1 Gateway
展示:
- `MNOTE_WEB_HERMES_UPSTREAM_URL`
- gateway health。
- config source。
- logs link / settings link。
当前“未配置 Hermes 设置入口”错误只应出现在 Hermes tab,不应污染 Reasonix 设置或状态。
### 5.2 Profile / model / provider
展示:
- profile id。
- resolved model。
- provider kind。
- credential status。
- config source。
- API key masked/missing/configured。
### 5.3 ACP session load / replay
展示:
- supports session/loadtrue。
- stored `acpSessionId`
- load statusloaded / load-failed-new。
- replaySeen / replaySeq / replayMessageCount。
注意:
- replay 是 history restore/evidence,不进入 assistant final。
- load failed 只影响 runtime continuity,不删除 MNote history。
### 5.4 Skills / memory
范围:
- Hermes skills。
- hide builtin skills。
- Hermes memory sectionssoul/user/memory。
- profile-local skills。
### 5.5 外部删除危险区
默认隐藏在 Hermes tab 底部。
动作:
- 删除 MNote history:跳回 MNote 会话与审计。
- 删除外部 Hermes/provider 会话:必须二次确认,且需要显式参数 `deleteExternalProviderSession=1`
## 6. 状态页
状态页是 7-59 runtime panel 的重排版,不是设置页。
入口:
- 点击顶部 runtime strip。
- 或 header 增加状态图标。
内容:
| 区块 | 字段 |
| --- | --- |
| Current runtime | runtime / mode / profile / model |
| Session | mnoteSessionId / acpSessionId / providerConversationId |
| Run | active run / status / queue |
| Context | allowed roots / context scope |
| MCP & tools | mcp status / tool count / failed |
| Jobs | running/completed/failed / stop all |
| Logs tail | ACP stderr / tool failed / MCP failed |
| Usage | last run / session total / cache/cost if available |
状态页允许两个操作:
| 操作 | 语义 |
| --- | --- |
| Stop turn | 只停止当前 run,不删除 session,不关闭 live binding |
| Reset current runtime | 关闭当前 runtime binding/manager,不删除 MNote history,不删除外部 provider |
状态页不允许:
- 删除 session history。
- 删除外部 provider/Hermes 会话。
- 改 Hermes API key。
- 改 Reasonix memory。
## 7. UI 文案规则
### 7.1 Runtime badge
顶部 badge 应按 owner 明确表达:
```text
Reasonix · native-live
Reasonix · cold-resumed
Hermes · loaded
Hermes · replay-seen
API Chat · server-transcript
Chat-only · provider-conversation
```
禁止出现“header 是 Reasonix,但 badge 是 hermes new-session”的短暂串线。切换 agent/profile 时必须先清空旧 runtime status,再加载新 status。
### 7.2 设置 tab 文案
使用:
```text
MNote
Reasonix
Hermes
```
不用:
```text
Common
高级
Chat-only
Runtime
```
### 7.3 危险动作文案
Stop turn
```text
停止当前输出,不关闭 runtime,不删除历史。
```
Reset runtime
```text
重置当前 runtime。MNote 历史保留,外部 provider 会话不删除。
```
Delete session
```text
删除 MNote 历史。外部 Hermes/provider 会话不会删除。
```
External delete
```text
这会请求删除外部 provider/Hermes 会话,可能不可恢复。需要二次确认。
```
## 8. 实施顺序
### Phase AIA rename / no behavior change
- [x] 将设置主 tab 收口为 `MNote / Reasonix / Hermes`
- [x] `Common` 改名 `MNote`
- [x] 移除一级 `Chat-only` tabChat-only 配置迁入 `MNote > API Chat / Chat-only profile`
- [x] `高级`/`Runtime` 不再作为设置 tab 名称。
- [x] 保持现有 DOM action 与后端合同不变,先只做布局与文案重排。
验证:
```bash
node --check rust/crates/mnote-web/browser/sidebar-page-ai-render-runtime.js
node scripts/task559-page-ai-terminal-status-reconciliation-smoke.js
```
### Phase B:状态页从设置页拆出
- [x] 新增或重排 `status` panel。
- [x] runtime strip 点击打开状态页。
- [x] runtime status、queue、jobs、logs、usage 移到状态页。
- [x] MNote/Reasonix/Hermes 设置页不再显示 transient active-run logs。
- [x] Stop turn / Reset current runtime 只在状态页显示。
验证:
```bash
node scripts/task559-page-ai-terminal-status-reconciliation-smoke.js
node scripts/task558-page-ai-reasonix-live-session-context-smoke.js
```
### Phase CMNote 设置 owner 收口
- [x] 授权区域、默认上下文、MNote 工具、会话与审计进入 MNote tab。
- [x] Chat-only/API Chat profile 的入口进入 MNote tab。
- [x] delete session 文案固定为只删 MNote history。
- [x] permission pending queue 刷新恢复仍可见。
验证:
```bash
node scripts/task561-page-ai-session-dashboard-smoke.js
cargo test -p mnote-web api_chat -- --nocapture
```
### Phase DReasonix / Hermes 设置 owner 收口
- [x] Reasonix tab 只展示 Reasonix runtime/native-live/queue/MCP/memory。
- [x] Hermes tab 只展示 Hermes gateway/profile/model/provider/load/replay/skills。
- [x] Hermes gateway 未配置错误只出现在 Hermes tab。
- [x] Reasonix 页面不出现 Hermes upstream/API key 错误。
- [x] Hermes 页面不出现 Reasonix native-live queue 当前状态。
验证:
```bash
node scripts/task558-page-ai-reasonix-live-session-context-smoke.js
node scripts/task560-page-ai-hermes-load-replay-smoke.js
```
### Phase E:截图与移动端收口
- [x] 桌面宽度下设置 tab 不换行、不挤压。
- [x] 移动宽度下三 tab 可点击,状态页内容可滚动。
- [x] Runtime strip 不遮挡 header action。
- [x] history actions 在移动宽度仍可点击。
验证:
```bash
node scripts/task559-page-ai-terminal-status-reconciliation-smoke.js
node scripts/task561-page-ai-session-dashboard-smoke.js
```
需要补截图断言:
- `MNote / Reasonix / Hermes` 三 tab 可见。
- 状态页打开后可见 `Current runtime / Session / Queue / Logs tail`
- Reasonix 设置页无 Hermes API key 错误。
- Hermes 设置页显示 gateway/profile/model/provider。
## 9. 不做事项
- 不改变 7-59 的后端 runtime/session API 合同。
- 不新增第二套 runtime truth。
- 不把 Hermes Web UI 作为完整 dashboard 搬进 MNote。
- 不把 Reasonix Desktop settings 全量复制进 MNote。
- 不自动删除外部 Hermes/provider/Reasonix session。
- 不把 runtime logs/job/tool status 拼进 assistant final。
## 10. 完成条件
- 设置页只剩 `MNote / Reasonix / Hermes` 三个 owner tab。
- Runtime status 从设置页拆出为独立状态页或 runtime strip popover。
- MNote tab 不出现 Hermes API key / Reasonix binary 这类外部 runtime 配置。
- Reasonix tab 不出现 Hermes upstream 未配置错误。
- Hermes tab 不出现 Reasonix native-live 当前 queue。
- Stop turn / Reset runtime / Delete session 三类动作仍语义分离。
- Reasonix queued send、Hermes load/replay、API Chat、ChatOnly 现有 smoke 全部通过。
- 移动截图中 tab、按钮、状态卡不重叠。
## 11. 实施记录
### 2026-06-10 Phase A-E
已完成:
- 设置页 tab 收口为 `MNote / Reasonix / Hermes`
- 移除一级 `Common / Chat-only / 高级 / Runtime` 设置 tab。
- runtime strip 改为可点击入口,点击打开独立 `status` panel。
- `status` panel 展示 `Current runtime / Session / Queue / Jobs / Logs tail / Usage`,并保留 `Stop turn` / `Reset current runtime`
- MNote tab 展示授权区域、默认上下文、会话与审计、API Chat / Chat-only profile、MNote 工具。
- Reasonix tab 只保留 ACP runtime、Reasonix descriptor、Reasonix memory 等专属内容。
- Hermes tab 展示 Hermes gateway、profile/model/provider、Hermes skills/memory,并承载 Hermes gateway 未配置提示。
- 扩展浏览器 smoke,增加设置 IA、状态页、移动宽度 tab 可点性、Hermes/Reasonix owner 边界断言。
验证:
```bash
node --check rust/crates/mnote-web/browser/sidebar-page-ai-render-runtime.js
node --check rust/crates/mnote-web/browser/sidebar-page-ai-runtime.js
node --check rust/crates/mnote-web/browser/sidebar-page-ai-profile-runtime.js
node --check rust/crates/mnote-web/browser/sidebar-page-ai-session-runtime.js
node --check rust/crates/mnote-web/browser/sidebar-page-ai-permission-runtime.js
node --check scripts/task558-page-ai-reasonix-live-session-context-smoke.js
node --check scripts/task559-page-ai-terminal-status-reconciliation-smoke.js
node --check scripts/task561-page-ai-session-dashboard-smoke.js
cargo test -p mnote-web hermes_client -- --nocapture
node scripts/task558-page-ai-reasonix-live-session-context-smoke.js
node scripts/task559-page-ai-terminal-status-reconciliation-smoke.js
node scripts/task560-page-ai-hermes-load-replay-smoke.js
node scripts/task561-page-ai-session-dashboard-smoke.js
```
浏览器截图证据:
- `tmp/task559-terminal-status-fpUZi3/task559-runtime-panel.png`:状态页展示 Current runtime、Queue、Jobs、Logs tail、Usage。
- `tmp/task559-terminal-status-fpUZi3/task559-settings-mobile.png`:移动宽度下 MNote / Reasonix / Hermes 三 tab 可点击且不重叠。
- `tmp/task561-session-dashboard-ttJKyq/task561-settings-ia.png`Hermes tab 展示 Hermes gateway/profile/skills,不显示 Reasonix queue。
归档说明:
- 本稿只重排 Page AI 设置 IA 与状态页,不改变 7-59 后端 runtime/session API 合同。
- 外部 Hermes/provider 删除仍需显式二次确认;本稿没有新增默认外部删除入口。