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
+38 -1
View File
@@ -48,6 +48,7 @@ const MNOTE_TOOL_NAMES = [
'mnote.context.read_current_page',
'mnote.knowledge_rag.status',
'mnote.knowledge_rag.query',
'mnote.knowledge_rag.section_context',
'mnote.knowledge_rag.open_reference',
];
@@ -58,6 +59,7 @@ const REASONIX_TOOL_TO_MNOTE_TOOL = {
mnote_context_read_current_page: 'mnote.context.read_current_page',
mnote_knowledge_rag_status: 'mnote.knowledge_rag.status',
mnote_knowledge_rag_query: 'mnote.knowledge_rag.query',
mnote_knowledge_rag_section_context: 'mnote.knowledge_rag.section_context',
mnote_knowledge_rag_open_reference: 'mnote.knowledge_rag.open_reference',
};
@@ -153,6 +155,7 @@ function isWriteMnoteTool(toolName) {
'mnote.context.read_current_page',
'mnote.knowledge_rag.status',
'mnote.knowledge_rag.query',
'mnote.knowledge_rag.section_context',
'mnote.knowledge_rag.open_reference',
'mnote.doc.fetch',
'mnote.page.get',
@@ -693,6 +696,10 @@ function compactMnoteToolResultForReasonix(toolName, payload) {
answerGuidance: result.answerGuidance || '',
references: Array.isArray(result.references) ? result.references.slice(0, 8) : [],
citations: citationMarkdowns,
documentStructureIndex: result.documentStructureIndex || null,
requestedRetrievalMode: result.requestedRetrievalMode || null,
effectiveRetrievalMode: result.effectiveRetrievalMode || result.retrievalMode || null,
retrievalModeReason: result.retrievalModeReason || null,
sourceScope: result.sourceScope || [],
sourceScopeMode: result.sourceScopeMode || '',
rawScopeFiltered: Boolean(result.rawScopeFiltered),
@@ -875,6 +882,10 @@ function fallbackMnoteToolSpecs() {
topK: { type: 'integer', description: 'LightRAG top_k' },
chunkTopK: { type: 'integer', description: 'LightRAG chunk_top_k' },
includeChunkContent: { type: 'boolean', description: '是否在 reference 中包含 chunk 内容' },
includeDocumentStructureIndex: {
type: 'boolean',
description: '是否返回由 LightRAG sidecar headings 派生的 document_structure_index;适合大书/长文档章节导航,不替代 references 引用证据。',
},
sourcePaths: {
type: 'array',
items: { type: 'string' },
@@ -903,6 +914,32 @@ function fallbackMnoteToolSpecs() {
},
parallelSafe: true,
},
{
mnoteToolName: 'mnote.knowledge_rag.section_context',
name: 'mnote_knowledge_rag_section_context',
description: '按 documentStructureIndex section 的 block/paragraph range,从 LightRAG native sidecar 拉取有限正文 blocks/chunks,供大书/长文档二次解读;不做检索、重排或 fallback。',
parameters: {
type: 'object',
properties: {
sourcePath: { type: 'string', description: 'MNote workspace 相对路径,推荐从 documentStructureIndex.documents[].sourceRootRelativePath 传入' },
sourceId: { type: 'string' },
lightRagDocId: { type: 'string' },
filePath: { type: 'string', description: 'LightRAG provider file_path' },
sectionId: { type: 'string' },
startBlockOrdinal: { type: 'integer' },
endBlockOrdinal: { type: 'integer' },
startParagraphOrdinal: { type: 'integer' },
endParagraphOrdinal: { type: 'integer' },
contextBefore: { type: 'integer' },
contextAfter: { type: 'integer' },
maxBlocks: { type: 'integer' },
maxChars: { type: 'integer' },
workspaceId: { type: 'string', description: 'MNote workspace ID,可省略并使用当前上下文' },
rootUri: { type: 'string', description: 'local folder rootUri,可省略并使用当前上下文' },
},
},
parallelSafe: true,
},
];
}
@@ -1001,7 +1038,7 @@ onRequest('session/new', async (params) => {
'<available-skills>',
'Use mnote_skill_read to load the full content of any skill listed by the current prompt capabilities.',
'- mnote-current-page — Read the current MNote Markdown page when the task needs page content.',
'- mnote-knowledge-rag — Ask the LightRAG-backed knowledge library across books, papers, PDFs, Office files, images, and attachments. Use mnote_knowledge_rag_query for knowledge-library questions and answers that require links/sources/citations. Returned uiCitations/citationMarkdown values are MNote clickable source locators and are rendered by the MNote UI after the final answer. Do not copy citationMarkdown into the answer, do not hand-write /documents or mnote:// links, and never wrap local citation URLs with search engines. Mention source titles in plain text only when useful; sourcePaths filters returned references after provider retrieval, so do not cite raw chunks. If locatorDegraded is true, say the source location is degraded rather than inventing page/bbox.',
'- mnote-knowledge-rag — Ask the LightRAG-backed knowledge library across books, papers, PDFs, Office files, images, and attachments. Use mnote_knowledge_rag_query for knowledge-library questions and answers that require links/sources/citations. For book-like results, request includeDocumentStructureIndex and then use mnote_knowledge_rag_section_context to read bounded section blocks when the map is not enough. Returned uiCitations/citationMarkdown values are MNote clickable source locators and are rendered by the MNote UI after the final answer. Do not copy citationMarkdown into the answer, do not hand-write /documents or mnote:// links, and never wrap local citation URLs with search engines. Mention source titles in plain text only when useful; sourcePaths filters returned references after provider retrieval, so do not cite raw chunks. If locatorDegraded is true, say the source location is degraded rather than inventing page/bbox.',
'- mnote-local-file — Resolve MNote targets and then use native file tools inside allowed roots.',
'- mnote-chat-only — Reply conversationally without MNote file/page tools.',
'</available-skills>',