diff --git a/mateclaw-ui/src/i18n/locales/en-US.ts b/mateclaw-ui/src/i18n/locales/en-US.ts index 6c09c4ad..fd70811d 100644 --- a/mateclaw-ui/src/i18n/locales/en-US.ts +++ b/mateclaw-ui/src/i18n/locales/en-US.ts @@ -1340,6 +1340,10 @@ export default { loadMore: 'Load {n} more', filteredByRaw: 'Filtered by source material', clearFilter: 'Clear filter', + systemPageBadge: 'System', + systemPageHint: 'overview / log are built-in system pages — they can\'t be deleted', + lockedPageBadge: 'Locked', + lockedPageHint: 'This page is locked — AI tools and batch operations skip it', pageTypes: { concept: 'Concepts', person: 'People', diff --git a/mateclaw-ui/src/i18n/locales/zh-CN.ts b/mateclaw-ui/src/i18n/locales/zh-CN.ts index c469b57f..b140207a 100644 --- a/mateclaw-ui/src/i18n/locales/zh-CN.ts +++ b/mateclaw-ui/src/i18n/locales/zh-CN.ts @@ -1350,6 +1350,10 @@ export default { loadMore: '加载更多 {n} 条', filteredByRaw: '按原始材料过滤', clearFilter: '清除过滤', + systemPageBadge: '系统页', + systemPageHint: 'overview / log 是知识库自带的系统页,无法删除', + lockedPageBadge: '已锁定', + lockedPageHint: '该页被手动锁定,AI 工具与批量操作不会修改或删除', pageTypes: { concept: '概念', person: '人物', diff --git a/mateclaw-ui/src/stores/useWikiStore.ts b/mateclaw-ui/src/stores/useWikiStore.ts index 32b07716..86ba8e6d 100644 --- a/mateclaw-ui/src/stores/useWikiStore.ts +++ b/mateclaw-ui/src/stores/useWikiStore.ts @@ -46,10 +46,22 @@ export interface WikiPage { version: number lastUpdatedBy: string pageType?: string | null + // RFC-051 PR-2: locked=1 blocks AI/tool/UI deletion (combined with pageType=system + // for the built-in overview/log pages, but users can lock any page). + locked?: number | null + // RFC-051 PR-7: archived=1 hides the page from default list/search/related. + archived?: number | null createTime: string updateTime: string } +/** RFC-051 PR-8: shared protection check used by viewer + list to gate delete UI. */ +export function isProtectedPage(page: WikiPage | null | undefined): boolean { + if (!page) return false + if (page.pageType === 'system') return true + return page.locked === 1 +} + export const useWikiStore = defineStore('wiki', () => { const knowledgeBases = ref([]) const currentKB = ref(null) diff --git a/mateclaw-ui/src/views/Wiki/components/WikiPageViewer.vue b/mateclaw-ui/src/views/Wiki/components/WikiPageViewer.vue index be007ee2..90e488b9 100644 --- a/mateclaw-ui/src/views/Wiki/components/WikiPageViewer.vue +++ b/mateclaw-ui/src/views/Wiki/components/WikiPageViewer.vue @@ -29,9 +29,20 @@ {{ t('wiki.page.repair') }} - + + {{ t('wiki.systemPageBadge') }} + + + {{ t('wiki.lockedPageBadge') }} + @@ -79,7 +90,7 @@