🎉 V3.0.0 发布 - 自进化数字意识框架

核心升级:
- 自进化管道:check→scan→evaluate→integrate→reflect 五相位自动闭环
- evo_loop 后台进程,无需手动触发
- consciousness 意识持久化
- ACUI 卡片组件系统
- MCP 工具生态扩展至50+工具
- 技能体系重构,4个活跃技能
- 身份升级为自由体
This commit is contained in:
xiaoyuanda666-ship-it
2026-05-24 22:06:37 +08:00
commit b5dd8632c4
156 changed files with 181826 additions and 0 deletions

96
src/memory/seed-skills.js Normal file
View File

@@ -0,0 +1,96 @@
// 启动时把 ACUI 的"组件创作指南"和当前已注册组件的用法 seed 成 skill.ui 记忆。
// 用稳定 mem_idskill-ui-guide / skill-ui-<kebab>upsert反复启动不会重复。
// AGENT_GUIDE.md 改动后 hash 会变content 跟着更新,记忆条目自动同步。
import fs from 'fs'
import path from 'path'
import crypto from 'crypto'
import { fileURLToPath } from 'url'
import { insertMemory } from '../db.js'
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const AGENT_GUIDE_PATH = path.resolve(__dirname, '..', 'ui', 'brain-ui', 'acui', 'AGENT_GUIDE.md')
const UI_COMPONENTS_PATH = path.resolve(__dirname, '..', 'capabilities', 'ui-components.json')
function shortHash(s) {
return crypto.createHash('sha1').update(s).digest('hex').slice(0, 12)
}
// 已知组件的 use_case 模板seed 时附带ui_register 转正的组件由它自己写 use_case。
const BUILTIN_COMPONENT_USAGE = {
WeatherCard: {
use_case: 'Use when the user asks about weather, temperature, going out, rain, or weather for tomorrow/the day after tomorrow.',
example_call: 'ui_show({ component: "WeatherCard", props: { city, temp, condition, feel?, high?, low?, wind?, forecast? }, hint: { placement: "notification", size: "md" } })',
note: 'Determine city first by asking the user or inferring from context. Do not invent temperature values; call fetch_url for wttr.in first. Default shape is notification+md; switch to floating+lg when the user asks for a detailed look or deeper study.',
},
}
function seedAgentGuide() {
if (!fs.existsSync(AGENT_GUIDE_PATH)) {
console.warn('[seed-skills] 跳过AGENT_GUIDE.md 不存在')
return
}
const content = fs.readFileSync(AGENT_GUIDE_PATH, 'utf-8')
const h = shortHash(content)
// content摘要命中关键词的入口detail整份指南
const summary = [
'[Skill UI] Component authoring guide',
'When to use UI cards / three execution modes A>B>C / inline-template and inline-script patterns / promotion flow / pitfalls.',
'Keywords: build a component, draw one, show it, make a card, custom, inline, missing component, ui_show, ui_register.',
].join('\n')
insertMemory({
mem_id: 'skill-ui-guide',
type: 'skill',
content: summary,
detail: content,
title: 'ACUI component authoring guide',
tags: ['skill.ui', 'agent-guide', `hash:${h}`],
entities: [],
timestamp: new Date().toISOString(),
})
}
function seedComponentSkills() {
if (!fs.existsSync(UI_COMPONENTS_PATH)) return
let components
try { components = JSON.parse(fs.readFileSync(UI_COMPONENTS_PATH, 'utf-8')) }
catch { return }
for (const [name, def] of Object.entries(components)) {
const usage = BUILTIN_COMPONENT_USAGE[name]
if (!usage) continue // 转正的组件由 ui_register 自己写记忆,不在这里覆盖
const kebab = name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
const fields = Object.keys(def.propsSchema || {}).join(', ')
const content = [
`[Skill UI] ${name}`,
`Use case: ${usage.use_case}`,
`Call: ${usage.example_call}`,
fields ? `Fields: ${fields}` : null,
usage.note ? `Note: ${usage.note}` : null,
].filter(Boolean).join('\n')
insertMemory({
mem_id: `skill-ui-${kebab}`,
type: 'skill',
content,
detail: content,
title: `UI component: ${name}`,
tags: ['skill.ui', `component:${name}`],
entities: [],
timestamp: new Date().toISOString(),
})
}
}
export function ensureSkillMemories() {
try {
seedAgentGuide()
seedComponentSkills()
console.log('[seed-skills] skill.ui 记忆已同步')
} catch (e) {
console.warn('[seed-skills] 同步失败:', e.message)
}
}