feat: 升级至 v0.3.14 — 移除 AGENTS.md/USERS.md + 内置提示词统一管理 + 时间感知 + 工具管理滚动

This commit is contained in:
2026-07-21 17:50:39 +08:00
parent f640c9b48a
commit c0a26ce053
9 changed files with 106 additions and 127 deletions
+8 -16
View File
@@ -3,9 +3,11 @@
*
* 负责:
* 1. 工作空间目录的创建和验证
* 2. 4 个必需磁盘文件的加载和自动创建
* 2. 2 个必需磁盘文件的加载和自动创建SOUL.md + MEMORY.md
* 3. MEMORY.md 格式校验和自动修正
*
* v0.3.14: 移除 AGENTS.md 和 USERS.md(不再读取,不再自动创建)
*
* @see docs/MetonaAI-Desktop 架构与交互设计.html — 工作空间
* @see standard/开发规范.md — 使用 fs/path 内置模块(非第三方库)
*/
@@ -19,9 +21,7 @@ import log from 'electron-log';
export interface WorkspaceFiles {
soul: string;
agents: string;
memory: string;
users: string;
}
export interface WorkspaceInfo {
@@ -33,7 +33,7 @@ export interface WorkspaceInfo {
// ===== 常量 =====
const REQUIRED_FILES = ['SOUL.md', 'AGENTS.md', 'MEMORY.md', 'USERS.md'] as const;
const REQUIRED_FILES = ['SOUL.md', 'MEMORY.md'] as const;
const AUTO_CREATED_DIRS = ['logs', 'traces', '.metona'] as const;
@@ -58,7 +58,7 @@ const MEMORY_TEMPLATE = `# MEMORY.md — AI 持久记忆
export class WorkspaceService {
private workspacePath: string;
private files: WorkspaceFiles = { soul: '', agents: '', memory: '', users: '' };
private files: WorkspaceFiles = { soul: '', memory: '' };
constructor(workspacePath?: string) {
this.workspacePath = workspacePath ?? join(app.getPath('userData'), 'MetonaWorkspaces', 'default');
@@ -68,7 +68,7 @@ export class WorkspaceService {
* 初始化工作空间
*
* 1. 创建目录结构
* 2. 验证/创建 4 个必需文件
* 2. 验证/创建 2 个必需文件SOUL.md + MEMORY.md
* 3. 加载文件内容
*/
initialize(): WorkspaceInfo {
@@ -82,7 +82,7 @@ export class WorkspaceService {
this.ensureDirectory(join(this.workspacePath, dir));
}
// 验证/创建必需文件
// 验证/创建必需文件SOUL.md + MEMORY.md
const missingOnStart: string[] = [];
for (const fileName of REQUIRED_FILES) {
const filePath = join(this.workspacePath, fileName);
@@ -289,25 +289,17 @@ export class WorkspaceService {
case 'SOUL.md':
writeFileSync(filePath, '# SOUL.md — AI 灵魂定义\n\n# 用户可在此定义 Agent 的身份、性格和核心价值观\n', 'utf-8');
break;
case 'AGENTS.md':
writeFileSync(filePath, '# AGENTS.md — AI 行为定义\n\n# 用户可在此定义 Agent 的行为规则和边界\n', 'utf-8');
break;
case 'USERS.md':
writeFileSync(filePath, '# USERS.md — 用户信息画像\n\n# 用户可在此描述自己的背景、技能和偏好\n', 'utf-8');
break;
}
log.info(`Auto-created file: ${fileName}`);
}
/**
* 加载所有文件内容
* 加载所有文件内容SOUL.md + MEMORY.md
*/
private loadFiles(): void {
this.files.soul = this.readFile('SOUL.md');
this.files.agents = this.readFile('AGENTS.md');
this.files.memory = this.readFile('MEMORY.md');
this.files.users = this.readFile('USERS.md');
}
/**