fix(agent): harden @mention scope and simplify must_use hints

Tighten per-turn @MCP/@Skill/@tag handling after review: enforce agent
MCP/Skill whitelist, ignore mentions when selection mode is none, tag-scope
grep_chunks, and simplified English must_use lines without tool dumps.
Skip persisting scope envelopes to history rendered_content.
This commit is contained in:
wizardchen
2026-06-29 16:54:08 +08:00
committed by lyingbug
parent 049f85139d
commit b86efe3f92
14 changed files with 442 additions and 104 deletions
+10 -1
View File
@@ -576,9 +576,18 @@ export const useSettingsStore = defineStore("settings", {
// 需要 lazy 拉取。保留 store 现值,避免误删用户刚加进来的文件映射。
}
if (Array.isArray(state.mentioned_items)) {
this.settings.selectedTags = state.mentioned_items
const fromMentions = state.mentioned_items
.filter(item => item.type === "tag" && item.id && item.kb_id)
.map(item => ({ id: item.id, name: item.name || item.id, kbId: item.kb_id!, kbName: item.kb_name }));
const covered = new Set(fromMentions.map(t => t.id));
const orphanTagIds = (state.tag_ids || []).filter(id => id && !covered.has(id));
if (orphanTagIds.length > 0 && Array.isArray(state.knowledge_base_ids) && state.knowledge_base_ids.length === 1) {
const kbId = state.knowledge_base_ids[0];
orphanTagIds.forEach(id => {
fromMentions.push({ id, name: id, kbId, kbName: undefined });
});
}
this.settings.selectedTags = fromMentions;
} else if (Array.isArray(state.tag_ids)) {
const existing = this.settings.selectedTags || [];
this.settings.selectedTags = existing.filter(tag => state.tag_ids?.includes(tag.id));