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:
@@ -0,0 +1,36 @@
|
||||
import { stripKnownChatSkillPrompt } from './chat-skills.mjs';
|
||||
|
||||
/**
|
||||
* Strip agent-only prefixes from persisted user messages for UI display.
|
||||
* Regression guard — see docs/regression-guards/mindspace-publish-and-chat-finish.md
|
||||
*/
|
||||
|
||||
export const TASK_ROUTING_HINT_RE = /^【TKMind 路由提示】[\s\S]*?\n\n/;
|
||||
export const MINDSPACE_CONTEXT_RE = /^\[MindSpace 上下文\][\s\S]*?\n\n/;
|
||||
const USER_IDENTITY_BLOCK_RE = /^\[用户身份\][\s\S]*?\n\n/;
|
||||
|
||||
export function stripUserIdentityPrefix(text) {
|
||||
return String(text ?? '').replace(USER_IDENTITY_BLOCK_RE, '').trimStart();
|
||||
}
|
||||
|
||||
export function stripTaskRoutingHint(text) {
|
||||
return String(text ?? '').replace(TASK_ROUTING_HINT_RE, '').trimStart();
|
||||
}
|
||||
|
||||
export function stripMindSpaceContextPrefix(text) {
|
||||
let next = String(text ?? '');
|
||||
while (MINDSPACE_CONTEXT_RE.test(next)) {
|
||||
next = next.replace(MINDSPACE_CONTEXT_RE, '').trimStart();
|
||||
}
|
||||
return next;
|
||||
}
|
||||
|
||||
/** Strip agent-only prefixes from persisted user message content for UI display. */
|
||||
export function deriveUserFacingText(text) {
|
||||
let next = String(text ?? '');
|
||||
next = stripUserIdentityPrefix(next);
|
||||
next = stripTaskRoutingHint(next);
|
||||
next = stripMindSpaceContextPrefix(next);
|
||||
next = stripKnownChatSkillPrompt(next);
|
||||
return next.trim();
|
||||
}
|
||||
Reference in New Issue
Block a user