feat: Page AI Reasonix desktop session alignment, settings IA cleanup, knowledge RAG hardening

- ACP client/session manager: Reasonix desktop live session context
- Hermes tools: knowledge_rag tool manifest and skill updates
- Browser runtime: sidebar page AI permission/profile/render/session/tree modules
- Routes: hermes_client, hermes_tools, knowledge_rag, web_shell
- Scripts: reasonix ACP wrapper, LightRAG MCP, smoke tasks 159/558/559/561/562
- Skills: mnote-knowledge-rag and mnote-lightrag-bridge SKILL.md updates
This commit is contained in:
lix-2026
2026-06-13 22:20:01 +08:00
parent 2236a053c0
commit 4a7efd4a30
30 changed files with 5321 additions and 291 deletions
+3 -2
View File
@@ -6,9 +6,10 @@
- 先用 `mnote.knowledge_rag.status` 检查 LightRAG provider 是否可用、当前 root 是否有 source registry。
-`mnote.knowledge_rag.query` 提问。默认 `mode=mix`,需要跨资料总结时可用 `global`。指定资料细节时可传 `sourcePaths`,但当前语义是 LightRAG provider 检索后,MNote 只过滤返回的 `references`;不要把 `raw` 当作已被 scope 限制的来源。
- 如果返回 `documentStructureIndex`,它只是一张章节地图。需要阅读某个章节范围时,调用 `mnote.knowledge_rag.section_context`,传 `sourcePath` 以及 `startBlockOrdinal/endBlockOrdinal``startParagraphOrdinal/endParagraphOrdinal`,并限制 `maxBlocks/maxChars`
- 回答必须引用 `references` 中的来源;优先使用返回的 `citationMarkdown`
- 若需要打开来源,调用 `mnote.knowledge_rag.open_reference`,不要手拼 LightRAG dashboard、`file://` 或 provider 内部路径。
- 如果当前 Agent runtime 额外挂载了 `lightrag_native`,可用其 `query_text` / `query_data` 完成 LightRAG 原生检索;拿到 provider 的 `file_path` / `chunk_id` 后,用 `mnote_lightrag_bridge.open_mnote_reference``mnote.knowledge_rag.open_reference` 转成 MNote 可点击定位
- 如果当前 Agent runtime 只有 MCP 入口,优先调用 `mnote_lightrag_bridge.mnote_knowledge_rag_query`;它会转到 MNote `/api/knowledge-rag/query`,保留 source registry、citation contract 和定位信息。`lightrag_native.query_text/query_data` 只用于原生 graph/documents/pipeline 管理或显式调试,不作为普通问答首选
- 引入或变更 LightRAG MCP、`mnote.knowledge_rag.*` 工具、citation 渲染或 open-reference 映射后,必须跑 Reasonix/Page AI 浏览器验收:AI 可见回答包含 citation 链接,点击该链接后 MNote 能打开对应资源并落到 locator。
边界:
@@ -17,4 +18,4 @@
- `filePath` 是 LightRAG provider-local 名称;只有 registry 命中的 reference 才能映射回 MNote source。
- 如果返回 `locatorDegraded: true`,可以使用返回的 `citationMarkdown`,但必须明说“来源定位降级”,不要伪造页码、bbox 或 provider 内部路径。
- LightRAG 不可用时,不要声称资料库已查到;提示用户启动或检查 LightRAG provider。旧 LiteParse / evidence 检索已退役,不作为 fallback。
- MNote 的职责不是重排、补召回或再做一套全文搜索;MNote 只做 allowed roots、source registry、结果过滤和 citation/open-reference 映射。
- MNote 的职责不是重排、补召回或再做一套全文搜索;MNote 只做 allowed roots、source registry、结果过滤、有限 section context 和 citation/open-reference 映射。
+12 -8
View File
@@ -1,27 +1,31 @@
---
name: mnote_lightrag_bridge
description: Use when an agent has LightRAG references or file_path/chunk_id and must convert them into MNote clickable citation links or openable local resource locators. Pair with lightrag_native for retrieval, but use this bridge for MNote source registry and citation/open-reference mapping.
description: Use when an agent must query MNote's LightRAG-backed knowledge library through MNote source registry, or convert LightRAG references/file_path/chunk_id into clickable MNote locators.
---
# MNote LightRAG Bridge
用途:把 LightRAG 原生检索结果映射成 MNote 可点击、可打开、可定位的引用。它不是检索系统本身
用途:把 agent 的资料库查询稳定路由到 MNote `knowledge_rag` facade,并把引用映射成 MNote 可点击、可打开、可定位的 locator
## 工具分层
- `lightrag_native`LightRAG 原生 MCP,负责 `query_text``query_data`、graph、documents、pipeline
- `mnote_lightrag_bridge`MNote bridge,负责 source registry、`file_path/chunk_id` 映射、`citationUrl``openAction`
- `mnote_lightrag_bridge.mnote_knowledge_rag_query`:首选资料库问答入口,调用 MNote `/api/knowledge-rag/query`,返回已映射的 references/citations
- `mnote_lightrag_bridge.mnote_knowledge_rag_section_context`:按 `documentStructureIndex` 中的 section range 拉取有限 sidecar blocks/chunks,用于大书/长文档二次阅读,不做召回或重排
- `mnote_lightrag_bridge.mnote_knowledge_rag_open_reference` / `open_mnote_reference`:把 `file_path/chunk_id` 映射为 `citationUrl``openAction`
- `lightrag_native`:只在需要 LightRAG 原生 graph/documents/pipeline 管理时使用;普通资料库问答优先走 MNote bridge,避免绕过 source registry 和 citation contract。
## 使用流程
1. 先用 `lightrag_native.query_text``lightrag_native.query_data` 做资料库检索
2. 返回的 `references[]` 里取 `file_path`,有 `chunk_id` 时一并保留
3. 调用 `mnote_lightrag_bridge.open_mnote_reference`输入 `file_path` / `chunk_id` / `workspace_id` / `root_uri`
4. 最终回答引用 bridge 返回的 `citationMarkdown` 或让 MNote UI 渲染 citation;不要手写 `/documents``file://`、LightRAG dashboard URL
1. 资料库问答直接调用 `mnote_lightrag_bridge.mnote_knowledge_rag_query`;大书/长文档问题传 `source_paths` 并设置 `include_document_structure_index=true`
2. 回答依据必须来自返回的 `references[]` / `citations[]``documentStructureIndex` 只作章节导航,不单独当证据
3. 需要阅读某章节时,调用 `mnote_knowledge_rag_section_context` `source_path` 以及 `start_block_ordinal/end_block_ordinal` `start_paragraph_ordinal/end_paragraph_ordinal`,并限制 `max_blocks/max_chars`
4. 如已有 LightRAG 原生 `file_path/chunk_id`,调用 `mnote_lightrag_bridge.open_mnote_reference``mnote_knowledge_rag_open_reference` 转成 MNote locator
5. 最终回答引用 bridge 返回的 `citationMarkdown` 或让 MNote UI 渲染 citation;不要手写 `/documents``file://`、LightRAG dashboard URL。
## 边界
- `file_path` 是 LightRAG provider 内部文件名,不等于用户本地相对路径。
- 普通问答不要直接调用 `lightrag_native.query_*` 绕过 MNote;否则 citations 可能没有 source registry 和定位信息。
- 只有 MNote registry 命中的 reference 才能映射回本地资源和页面。
- `locatorDegraded=true` 时必须说明“来源定位降级”,不能伪造页码、bbox、段落或坐标。
- 不要用 bridge 做召回、重排、全文 fallback 或资料管理。