Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .changeset/new-glasses-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
"@promptx/mcp-server": patch
"@promptx/resource": patch
"@promptx/core": patch
"@promptx/desktop": patch
---

# v2.2.1 版本更新

## 🎉 RoleX V2 完整认知循环支持

### 核心操作
- **want** - 制定产品目标(如:发布新功能、优化用户体验)
- **plan** - 为目标制定执行计划(⚠️ 必须传入 id 参数)
- **todo** - 创建具体任务
- **finish** - 完成任务
- **achieve** - 达成目标,沉淀经验
- **focus** - 查看当前进行中的工作
- **abandon** - 放弃目标/任务

### 自我沉淀(学习循环)
- **reflect** - 反思遇到的问题,创建经验
- **realize** - 总结领悟的原则
- **master** - 沉淀为标准操作流程(SOP)
- **synthesize** - 向其他角色传授知识
- **forget** - 遗忘过时的知识

## 🔧 修复与改进

### RoleX V2 核心修复
- 修复 plan 操作未传递 id 参数导致 todo 操作失败的问题
- 修复 "No focused plan" 错误
- 更新 RolexBridge 和 RolexActionDispatcher 正确传递所有参数
- 添加关键警告:plan 操作必须传入 id 参数

### 大禹迁移功能修复
- 更新大禹迁移文档适配 RoleX 1.3.0 数据库存储模式
- 移除过时的 "born → activate → synthesize" 流程
- 更新为正确模式:synthesize 直接传入 targetRole 参数
- 添加职位命名规范:"角色名+岗位"格式(如"产品经理岗位")
- 说明 appoint 的 position 参数必须与 establish 的 name 完全一致

### 记忆工具优化
- remember/recall 工具检测到 V2 角色时提供清晰引导
- 引导 V2 角色使用 action 工具的认知循环操作
- 提供完整的示例代码和操作说明

### AgentX 用户体验
- 添加两个 V2 专属预设问题:
- "激活大禹帮我把v1迁移到v2"
- "查看我现在的组织架构"
- 预设问题仅在系统设置开启 V2 时显示
- 优化布局:V2 关闭时 2 列,V2 开启时 3 列

### 通知系统
- 添加 v2.2.1 版本更新通知
- 修复通知服务自动合并新通知的问题
- 新通知现在会自动出现在通知列表中

## 📝 文档更新

### MCP 工具描述
- 更新 action 工具描述,添加完整的 V2 学习循环示例
- 添加职位命名规范和组织操作示例
- 强调 plan 操作的 id 参数要求

### 大禹角色文档
- migration-workflow.execution.md - 更新迁移工作流
- rolex-api.knowledge.md - 更新 API 速查表
- 添加实际迁移经验和最佳实践

## 🌐 国际化
- 添加中英文通知文本
- 添加 AgentX 预设问题的中英文翻译

## ⚠️ 重要提示

### plan 操作关键要点
plan 操作如果不传入 id 参数,focused_plan_id 不会被设置,导致后续 todo 操作失败并报错 "No focused plan. Call plan first."

**错误示例:**
```json
{ "operation": "plan", "role": "_", "source": "..." }
```

**正确示例:**
```json
{ "operation": "plan", "role": "_", "source": "...", "id": "my-plan" }
```

### 职位命名规范
- establish 创建职位时,name 必须是"角色名+岗位"格式(如"产品经理岗位")
- appoint 任命时,position 参数必须与 establish 的 name 完全一致
- 验证方式:用 directory 检查 members 列表,而不是只看命令返回值
10 changes: 9 additions & 1 deletion apps/desktop/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,11 @@
"role": "Explore available roles",
"rolePrompt": "What roles are available?",
"tool": "Explore available tools",
"toolPrompt": "What tools are available?"
"toolPrompt": "What tools are available?",
"dayu": "Activate Dayu to migrate roles",
"dayuPrompt": "Activate Dayu to help me migrate v1 roles to v2",
"directory": "View organization structure",
"directoryPrompt": "Show me the current organization structure"
}
}
},
Expand Down Expand Up @@ -803,6 +807,10 @@
"title": "v2.2.0 Update Released",
"content": "New notification center, AgentX config with preset & OpenAI protocol detection, RoleX core upgraded from v0.11.0 to v1.3.0, fixed conversation rename bug, fixed Windows Git link issue. V2 role import/export/delete features temporarily disabled."
},
"updateV221": {
"title": "v2.2.1 Update Released",
"content": "🎉 V2 RoleX now supports complete cognitive cycle!\n\n🎯 Core Operations: want (set goals), plan (create plans), todo (create tasks), finish (complete tasks), achieve (reach goals), focus (view progress), abandon (give up goals)\n\n🧠 Self-Reflection: reflect (reflect on issues), realize (summarize principles), master (create SOPs), synthesize (teach knowledge), forget (forget outdated knowledge)\n\n✨ Fixed Dayu migration feature, supports V1 to V2 role migration"
},
"rolexUpgrade": {
"title": "RoleX (V2) Architecture Upgrade",
"content": "Existing V2 roles need to be upgraded. Please activate Nuwa and ask her to upgrade and migrate your roles to continue using them."
Expand Down
10 changes: 9 additions & 1 deletion apps/desktop/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,11 @@
"role": "探索可用角色",
"rolePrompt": "有哪些可用的角色?",
"tool": "探索可用工具",
"toolPrompt": "有哪些可用的工具?"
"toolPrompt": "有哪些可用的工具?",
"dayu": "激活大禹,迁移角色",
"dayuPrompt": "激活大禹帮我把v1迁移到v2",
"directory": "查看组织架构",
"directoryPrompt": "查看我现在的组织架构"
}
}
},
Expand Down Expand Up @@ -800,6 +804,10 @@
"title": "v2.2.0 版本更新",
"content": "新增通知中心、AgentX 配置增加预设与 OpenAI 协议识别功能、V2 RoleX 内核从 v0.11.0 更新到 v1.3.0、修复对话重命名后无效的 bug、修复 Windows 平台点击 Git 链接无响应的 bug。V2 的角色导入导出与删除功能暂时下架。"
},
"updateV221": {
"title": "v2.2.1 版本更新",
"content": "🎉 V2 RoleX 成功支持完整认知循环!\n\n🎯 核心操作:want(制定目标)、plan(制定计划)、todo(创建任务)、finish(完成任务)、achieve(达成目标)、focus(查看进度)、abandon(放弃目标)\n\n🧠 自我沉淀:reflect(反思问题)、realize(总结原则)、master(沉淀流程)、synthesize(传授知识)、forget(遗忘过时知识)\n\n✨ 修复大禹迁移功能,支持 V1 角色迁移到 V2"
},
"rolexUpgrade": {
"title": "RoleX(V2)架构升级",
"content": "原有 V2 角色需要升级。请激活女娲,让女娲进行升级与迁移才能继续使用。"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
*/

import * as React from "react";
import { Send, Hammer, Sparkles, Bot, Wrench } from "lucide-react";
import { Send, Hammer, Sparkles, Bot, Wrench, Users, GitBranch } from "lucide-react";
import { useTranslation } from "react-i18next";
import { cn } from "@/components/agentx-ui/utils";
import logo from "../../../../../../assets/icons/icon.png";
Expand Down Expand Up @@ -75,37 +75,71 @@ export function WelcomePage({
}: WelcomePageProps): React.ReactElement {
const { t } = useTranslation();
const [inputValue, setInputValue] = React.useState("");
const [enableV2, setEnableV2] = React.useState(false);

// Load V2 config on mount
React.useEffect(() => {
window.electronAPI?.invoke("server-config:get").then((config: any) => {
if (config?.enableV2) {
setEnableV2(true);
}
}).catch(() => {
// Ignore errors, default to false
});
}, []);

const tagline = t("agentxUI.welcome.tagline");
const displayText = useTypewriter(tagline, 100, true);

// Preset questions
const presetQuestions: PresetQuestion[] = React.useMemo(() => [
{
id: "luban",
icon: <Hammer className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.luban"),
prompt: t("agentxUI.welcome.presets.lubanPrompt"),
},
{
id: "nuwa",
icon: <Sparkles className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.nuwa"),
prompt: t("agentxUI.welcome.presets.nuwaPrompt"),
},
{
id: "role",
icon: <Bot className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.role"),
prompt: t("agentxUI.welcome.presets.rolePrompt"),
},
{
id: "tool",
icon: <Wrench className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.tool"),
prompt: t("agentxUI.welcome.presets.toolPrompt"),
},
], [t]);
const presetQuestions: PresetQuestion[] = React.useMemo(() => {
const baseQuestions = [
{
id: "luban",
icon: <Hammer className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.luban"),
prompt: t("agentxUI.welcome.presets.lubanPrompt"),
},
{
id: "nuwa",
icon: <Sparkles className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.nuwa"),
prompt: t("agentxUI.welcome.presets.nuwaPrompt"),
},
{
id: "role",
icon: <Bot className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.role"),
prompt: t("agentxUI.welcome.presets.rolePrompt"),
},
{
id: "tool",
icon: <Wrench className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.tool"),
prompt: t("agentxUI.welcome.presets.toolPrompt"),
},
];

// Add V2-only questions
if (enableV2) {
baseQuestions.push(
{
id: "dayu",
icon: <GitBranch className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.dayu"),
prompt: t("agentxUI.welcome.presets.dayuPrompt"),
},
{
id: "directory",
icon: <Users className="w-4 h-4" />,
title: t("agentxUI.welcome.presets.directory"),
prompt: t("agentxUI.welcome.presets.directoryPrompt"),
}
);
}

return baseQuestions;
}, [t, enableV2]);

const handleSend = React.useCallback(() => {
if (inputValue.trim() && onSend) {
Expand Down Expand Up @@ -181,7 +215,10 @@ export function WelcomePage({

{/* Preset question cards */}
<div className="w-full max-w-3xl">
<div className="grid grid-cols-2 gap-3">
<div className={cn(
"grid gap-3",
enableV2 ? "grid-cols-3" : "grid-cols-2"
)}>
{presetQuestions.map((question) => (
<button
key={question.id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ const SHOWN_KEY = "promptx_notifications_shown"

// 默认通知数据
const defaultNotifications: Notification[] = [
{
id: "update-v2.2.1",
title: "notifications.updateV221.title",
content: "notifications.updateV221.content",
type: "success",
timestamp: Date.now(),
read: false,
},
{
id: "update-v2.2.0",
title: "notifications.updateV220.title",
Expand All @@ -27,9 +35,28 @@ export const notificationService = {
// 获取所有通知
getNotifications(): Notification[] {
const stored = localStorage.getItem(STORAGE_KEY)
let existingNotifications: Notification[] = []

if (stored) {
return JSON.parse(stored)
existingNotifications = JSON.parse(stored)
}

// 检查是否有新的默认通知需要添加
const existingIds = new Set(existingNotifications.map(n => n.id))
const newNotifications = defaultNotifications.filter(n => !existingIds.has(n.id))

if (newNotifications.length > 0) {
// 有新通知,合并并保存
const merged = [...newNotifications, ...existingNotifications]
this.saveNotifications(merged)
return merged
}

// 没有新通知
if (existingNotifications.length > 0) {
return existingNotifications
}

// 首次使用,初始化默认通知
this.saveNotifications(defaultNotifications)
return defaultNotifications
Expand Down
12 changes: 6 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@
"@npmcli/arborist": "^9.2.0",
"@promptx/logger": "workspace:*",
"@promptx/resource": "workspace:*",
"@rolexjs/core": "^1.1.0",
"@rolexjs/core": "^1.3.0",
"@rolexjs/genesis": "^1.3.0",
"@rolexjs/local-platform": "^1.1.0",
"@rolexjs/parser": "^1.1.0",
"@rolexjs/prototype": "^1.1.0",
"@rolexjs/system": "^1.1.0",
"@rolexjs/local-platform": "^1.3.0",
"@rolexjs/parser": "^1.3.0",
"@rolexjs/prototype": "^1.3.0",
"@rolexjs/system": "^1.3.0",
"ajv": "^8.17.1",
"better-sqlite3": "^12.4.1",
"env-paths": "2.2.1",
Expand All @@ -54,7 +54,7 @@
"is-electron": "^2.2.2",
"peggy": "^5.0.5",
"resourcexjs": "^2.14.0",
"rolexjs": "^1.1.0"
"rolexjs": "^1.3.0"
},
"files": [
"dist/**/*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/rolex/RolexActionDispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class RolexActionDispatcher {
}

async _plan (args) {
return this.bridge.plan(args.source)
return this.bridge.plan(args.source, args.id, args.after, args.fallback)
}

async _todo (args) {
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/rolex/RolexBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,13 +209,13 @@ class RolexBridge {

/**
* 制定计划 (plan)
* RoleX 1.1.0: role.plan(plan)
* RoleX 1.3.0: role.plan(plan, id, after, fallback)
*/
async plan (source) {
async plan (source, id, after, fallback) {
await this.ensureInitialized()
const roleId = this._requireActiveRole()
const role = await this.rolex.activate(roleId)
return role.plan(source)
return role.plan(source, id, after, fallback)
}

/**
Expand Down
Loading