Improve local evidence search and AI capabilities
This commit is contained in:
@@ -47,6 +47,8 @@ function isWriteMnoteTool(toolName) {
|
||||
'mnote.evidence.search',
|
||||
'mnote.evidence.read',
|
||||
'mnote.evidence.open',
|
||||
'mnote.index.status',
|
||||
'mnote.index.refresh',
|
||||
'mnote.doc.fetch',
|
||||
'mnote.page.get',
|
||||
'mnote.block.fetch',
|
||||
@@ -503,6 +505,9 @@ const MNOTE_TOOL_NAMES = [
|
||||
'mnote.evidence.search',
|
||||
'mnote.evidence.read',
|
||||
'mnote.evidence.open',
|
||||
'mnote.index.status',
|
||||
'mnote.index.refresh',
|
||||
'mnote.index.update_settings',
|
||||
];
|
||||
|
||||
const REASONIX_TOOL_TO_MNOTE_TOOL = {
|
||||
@@ -513,6 +518,9 @@ const REASONIX_TOOL_TO_MNOTE_TOOL = {
|
||||
mnote_evidence_search: 'mnote.evidence.search',
|
||||
mnote_evidence_read: 'mnote.evidence.read',
|
||||
mnote_evidence_open: 'mnote.evidence.open',
|
||||
mnote_index_status: 'mnote.index.status',
|
||||
mnote_index_refresh: 'mnote.index.refresh',
|
||||
mnote_index_update_settings: 'mnote.index.update_settings',
|
||||
};
|
||||
|
||||
async function callMnoteTool(toolName, args) {
|
||||
@@ -595,7 +603,7 @@ tools.register({
|
||||
|
||||
tools.register({
|
||||
name: 'mnote_evidence_search',
|
||||
description: '搜索 MNote 本地文档和资源证据,返回 quote、locator 与 openAction。',
|
||||
description: '搜索 MNote 本地文档和资源证据,返回 quote、locator 与 openAction。查询语言与资料语言可能不一致时,先在提示层做轻量多语关键词扩展,再用简短关键词检索。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
@@ -654,6 +662,59 @@ tools.register({
|
||||
parallelSafe: true,
|
||||
});
|
||||
|
||||
tools.register({
|
||||
name: 'mnote_index_status',
|
||||
description: '查看 MNote 本地索引范围、缓存文件状态、文档数和 evidence block 数。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workspaceId: { type: 'string', description: 'MNote workspace ID,可省略并使用当前上下文' },
|
||||
rootUri: { type: 'string', description: 'local folder rootUri,可省略并使用当前上下文' },
|
||||
},
|
||||
},
|
||||
readOnly: true,
|
||||
fn: async (args) => callMnoteTool(REASONIX_TOOL_TO_MNOTE_TOOL.mnote_index_status, args),
|
||||
parallelSafe: true,
|
||||
});
|
||||
|
||||
tools.register({
|
||||
name: 'mnote_index_refresh',
|
||||
description: '按当前有效范围重建 MNote 本地搜索/evidence 缓存,不修改 Markdown 正文。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workspaceId: { type: 'string', description: 'MNote workspace ID,可省略并使用当前上下文' },
|
||||
rootUri: { type: 'string', description: 'local folder rootUri,可省略并使用当前上下文' },
|
||||
},
|
||||
},
|
||||
readOnly: true,
|
||||
fn: async (args) => callMnoteTool(REASONIX_TOOL_TO_MNOTE_TOOL.mnote_index_refresh, args),
|
||||
parallelSafe: false,
|
||||
});
|
||||
|
||||
tools.register({
|
||||
name: 'mnote_index_update_settings',
|
||||
description: '新增或删除 MNote 本地索引范围;includePaths 为空表示删除当前用户范围。',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
workspaceId: { type: 'string', description: 'MNote workspace ID,可省略并使用当前上下文' },
|
||||
rootUri: { type: 'string', description: 'local folder rootUri,可省略并使用当前上下文' },
|
||||
includePaths: { type: 'array', items: { type: 'string' }, description: 'root 内相对路径列表,空数组表示删除范围' },
|
||||
scheduleMode: { type: 'string', enum: ['manual', 'daily', 'weekly', 'monthly'], description: '刷新计划' },
|
||||
scheduleTime: { type: 'string', description: 'HH:mm' },
|
||||
scheduleDate: { type: 'string', description: '可选日期' },
|
||||
runOnChange: { type: 'boolean', description: '文件变化时是否自动刷新' },
|
||||
dryRun: { type: 'boolean', description: 'true 只返回计划;false 写入设置并刷新索引' },
|
||||
idempotencyKey: { type: 'string', description: '写入幂等键' },
|
||||
},
|
||||
required: ['includePaths', 'dryRun', 'idempotencyKey'],
|
||||
},
|
||||
readOnly: false,
|
||||
fn: async (args) => callMnoteTool(REASONIX_TOOL_TO_MNOTE_TOOL.mnote_index_update_settings, args),
|
||||
parallelSafe: false,
|
||||
});
|
||||
|
||||
// ── Session Store ────────────────────────────────────
|
||||
|
||||
const sessions = new Map();
|
||||
@@ -693,7 +754,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-document-evidence — Search local documents and resources with clickable evidence locators.',
|
||||
'- mnote-local-index — Search local documents with clickable evidence locators and manage local index scopes. When the query language may differ from the corpus language, infer likely corpus terms from filenames/titles/domain context, expand 2-6 concise multilingual keywords, and call mnote_evidence_search with the best short keyword queries. Do not assume the answer language from the corpus; answer in the user language and cite only retrieved evidence.',
|
||||
'- 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>',
|
||||
|
||||
Reference in New Issue
Block a user