收口 MNote P0 P1 P2 审查尾项

- 归档 OnlyOffice live bridge、Page AI、mindmap、design governance 与相关 bug 条目
- 补齐 MinerU OCR 后端 runtime 合同与 smoke/test 基线
- 收口 ChatOnly/Doubao、ObjectIdentity、Page Aggregate compat 与 runtime owner 文档口径

验证:
- cargo test --manifest-path rust/Cargo.toml -p mnote-web local_ocr -- --test-threads=1
- cargo test --manifest-path rust/Cargo.toml -p mnote-web onlyoffice_bridge -- --test-threads=1
- git diff --check
- git diff --cached --check
- codegraph index . --force && codegraph status .
- codegraph sync . && codegraph status .
This commit is contained in:
lix-2026
2026-06-01 09:29:12 +08:00
parent 49a0545148
commit 1882db7681
143 changed files with 29810 additions and 3228 deletions
+61 -1
View File
@@ -58,6 +58,37 @@ function stableIdPart(value, fallback) {
return text || String(fallback || 'unknown');
}
function stableJson(value) {
try {
return JSON.stringify(value || null, null, 2);
} catch {
return 'null';
}
}
function buildMnotePromptText(userPrompt, context = {}) {
const capabilities = context.mnoteCapabilities || {};
const envelope = capabilities.agentRunEnvelope || null;
if (!envelope || capabilities.attachMnoteCapabilities !== true) {
return userPrompt;
}
const primaryPath = envelope.primaryTarget?.workspacePath?.relativePath
|| envelope.primaryTarget?.relativePath
|| '';
const allowedRoots = envelope.allowedRoots || capabilities.allowedRoots || [];
const guidance = [
'<mnote-agent-run>',
'MNote has attached a local-first agent run envelope.',
'Use your native file tools to read and edit real files inside the current working directory and allowed roots.',
'Do not use MNote doc/page write tools for ordinary local Markdown edits.',
primaryPath ? `Primary target relativePath: ${primaryPath}` : '',
`Allowed roots: ${stableJson(allowedRoots)}`,
`Agent run envelope: ${stableJson(envelope)}`,
'</mnote-agent-run>',
].filter(Boolean).join('\n');
return `${guidance}\n\n${userPrompt}`;
}
function buildMnoteToolPayload(toolName, rawArgs = {}, context = {}) {
const {
actorId,
@@ -183,6 +214,35 @@ if (process.env.MNOTE_REASONIX_ACP_SELFTEST === '1') {
if (contextualPayload.args.aiAccessScope?.permissionLevel !== 'read_write') {
throw new Error('selftest expected aiAccessScope inherited from mnoteCapabilities');
}
const promptWithEnvelope = buildMnotePromptText('请把标题改成测试标题', {
mnoteCapabilities: {
attachMnoteCapabilities: true,
agentRunEnvelope: {
schema: 'mnote.agent_run_envelope.v1',
sourceKind: 'local_folder',
primaryTarget: {
workspacePath: {
relativePath: 'docs/current.md',
rootUri: 'file:///tmp/mnote-local',
},
},
allowedRoots: [{ rootUri: 'file:///tmp/mnote-local', permission: 'write' }],
resultPolicy: {
receiptSchema: 'mnote.agent_run_receipt.v1',
changedFiles: 'required',
},
},
},
});
if (!promptWithEnvelope.includes('mnote.agent_run_envelope.v1')) {
throw new Error('selftest expected prompt to include agentRunEnvelope schema');
}
if (!promptWithEnvelope.includes('docs/current.md')) {
throw new Error('selftest expected prompt to include primary target relativePath');
}
if (!promptWithEnvelope.includes('native file tools')) {
throw new Error('selftest expected prompt to instruct native file tools');
}
process.stderr.write('[reasonix-acp-mnote] selftest ok\n');
process.exit(0);
}
@@ -575,7 +635,7 @@ onRequest('session/prompt', async (params) => {
const mnoteCapabilities = params.mnoteCapabilities || {};
const useMnoteTools = mnoteCapabilities.attachMnoteCapabilities === true;
const loop = useMnoteTools ? session.mnoteLoop : session.chatLoop;
const promptText = text;
const promptText = buildMnotePromptText(text, toolContext);
let stopReason = 'end_turn';
let hasAssistantOutput = false;
let hasToolCall = false;