fix(mindspace): edit_file 落盘、Finish 聊天 merge 与回归守卫

- finish-sync 支持 edit_file 覆盖 public HTML
- Finish 同步 merge 本地流式消息,剥离 agent 内部前缀
- 新增 verify:mindspace-publish-guards 与 AGENTS.md 跨工具说明
- 发版脚本接入回归门禁;103 runtime 发布含备份回退

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-06-30 00:27:15 +08:00
parent 742aee7148
commit 98721371a4
31 changed files with 1440 additions and 141 deletions
+54
View File
@@ -0,0 +1,54 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import path from 'node:path';
const root = path.resolve(new URL('..', import.meta.url).pathname);
function read(relativePath) {
const absolutePath = path.join(root, relativePath);
assert.ok(fs.existsSync(absolutePath), `missing guarded file: ${relativePath}`);
return fs.readFileSync(absolutePath, 'utf8');
}
function assertIncludes(source, snippet, label) {
assert.ok(source.includes(snippet), `${label} must include guarded snippet: ${snippet}`);
}
function assertExcludes(source, snippet, label) {
assert.ok(!source.includes(snippet), `${label} must not regress to: ${snippet}`);
}
const useTKMindChat = read('src/hooks/useTKMindChat.ts');
assertIncludes(useTKMindChat, 'FINISH_SYNC_RETRY_DELAYS_MS', 'useTKMindChat.ts');
assertIncludes(
useTKMindChat,
'mergeConversationSnapshot(localMessages, detail.messages)',
'useTKMindChat.ts',
);
assertIncludes(useTKMindChat, 'chat-finish-sync.mjs', 'useTKMindChat.ts');
assertExcludes(
useTKMindChat,
'messagesRef.current = detail.messages;\n messageHistoryLoadedCountRef.current = detail.messages.length',
'useTKMindChat.ts Finish sync',
);
const messageTs = read('src/utils/message.ts');
assertIncludes(messageTs, 'deriveUserFacingText', 'message.ts');
assertIncludes(messageTs, 'chat-finish-sync.mjs', 'message.ts');
const conversationDisplay = read('conversation-display.mjs');
assertIncludes(conversationDisplay, 'TASK_ROUTING_HINT_RE', 'conversation-display.mjs');
assertIncludes(conversationDisplay, 'deriveUserFacingText', 'conversation-display.mjs');
const chatSkills = read('chat-skills.mjs');
assertIncludes(chatSkills, 'stripKnownChatSkillPrompt', 'chat-skills.mjs');
const server = read('server.mjs');
assertIncludes(server, 'canUseSnapshotCache', 'server.mjs');
assertIncludes(server, 'hintMc != null && hintUa != null', 'server.mjs');
const publicFinishSync = read('mindspace-public-finish-sync.mjs');
assertIncludes(publicFinishSync, 'applyPublicHtmlEdit', 'mindspace-public-finish-sync.mjs');
assertIncludes(publicFinishSync, 'isEditLikeHtmlTool', 'mindspace-public-finish-sync.mjs');
console.log('chat finish sync source guards ok');