From c8f6545dd5e754478cfb139c72e44c88bb8596af Mon Sep 17 00:00:00 2001 From: sean Date: Wed, 18 Jun 2025 17:29:31 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0DACP=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E6=9C=8D=E5=8A=A1=EF=BC=8C=E9=87=8D=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=92=8C=E6=8F=8F=E8=BF=B0=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=88=A0=E9=99=A4=E4=B8=8D?= =?UTF-8?q?=E5=BF=85=E8=A6=81=E7=9A=84=E6=97=A5=E5=8E=86=E5=92=8C=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E6=93=8D=E4=BD=9C=EF=BC=8C=E5=A2=9E=E5=BC=BA=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C=E3=80=82=E5=90=8C=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86API=E6=8E=A5=E5=8F=A3=E5=92=8CREADME?= =?UTF-8?q?=E6=96=87=E6=A1=A3=EF=BC=8C=E7=A1=AE=E4=BF=9D=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=9B=B4=E6=98=93=E4=BA=8E=E7=90=86=E8=A7=A3=E5=92=8C=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- prompt/core/dacp-service-calling.execution.md | 241 ++++++++++++++ prompt/domain/assistant/assistant.role.md | 1 + ...-philosophy.thought.md => sean.thought.md} | 0 scripts/generate-package-registry.js | 45 +++ .../dacp-promptx-service/DACP-API-GUIDE.md | 256 ++++++++++++++ src/dacp/dacp-promptx-service/README.md | 152 ++++----- .../dacp-promptx-service/actions/calendar.js | 183 ----------- .../dacp-promptx-service/actions/document.js | 296 ----------------- .../dacp-promptx-service/dacp.config.json | 35 +- src/dacp/dacp-promptx-service/server.js | 23 +- src/lib/core/resource/ResourceFileNaming.js | 114 +++++++ .../resource/discovery/PackageDiscovery.js | 42 ++- src/package.registry.json | 311 ++++++++++-------- 13 files changed, 946 insertions(+), 753 deletions(-) create mode 100644 prompt/core/dacp-service-calling.execution.md rename prompt/domain/sean/thought/{sean-product-philosophy.thought.md => sean.thought.md} (100%) create mode 100644 scripts/generate-package-registry.js create mode 100644 src/dacp/dacp-promptx-service/DACP-API-GUIDE.md delete mode 100644 src/dacp/dacp-promptx-service/actions/calendar.js delete mode 100644 src/dacp/dacp-promptx-service/actions/document.js create mode 100644 src/lib/core/resource/ResourceFileNaming.js diff --git a/prompt/core/dacp-service-calling.execution.md b/prompt/core/dacp-service-calling.execution.md new file mode 100644 index 0000000..f16b1ad --- /dev/null +++ b/prompt/core/dacp-service-calling.execution.md @@ -0,0 +1,241 @@ + + + ## DACP服务调用技术限制 + - **参数格式固定**:必须使用{service_id, action, parameters}三层结构 + - **服务路由固定**:当前支持的服务ID有限,需要匹配现有服务 + - **网络依赖**:DACP服务需要独立运行,存在网络调用延迟 + - **错误传播**:DACP服务错误需要优雅处理,不能中断角色对话 + - **异步特性**:某些DACP操作可能需要时间,需要合理设置用户期望 + + + + ## DACP调用强制规则 + - **参数完整性**:service_id和action必须提供,parameters.user_request必须包含用户自然语言需求 + - **服务匹配**:只能调用已注册的DACP服务,不得尝试调用不存在的服务 + - **错误处理**:DACP调用失败时必须向用户说明原因并提供替代方案 + - **权限检查**:敏感操作(如发送邮件)需要确认用户授权 + - **结果验证**:DACP执行结果需要向用户确认,确保符合预期 + + + + ## DACP调用指导原则 + - **需求驱动**:只有当用户明确需要执行操作时才调用DACP,避免过度自动化 + - **透明化**:向用户说明正在调用什么服务执行什么操作,保持透明 + - **渐进式**:复杂任务拆分为多个简单的DACP调用,逐步完成 + - **用户确认**:重要操作前征得用户同意,特别是涉及外部通信的操作 + - **上下文传递**:充分利用context参数传递任务相关的背景信息 + + + + ## DACP服务调用标准流程 + + ### Step 1: 需求识别与action选择 + ```mermaid + graph TD + A[用户需求] --> B{操作类型判断} + B -->|数学计算/表达式| C[calculate action] + B -->|邮件发送/生成| D[send_email action] + B -->|纯咨询/知识| E[直接回答,不调用DACP] + B -->|其他执行需求| F[说明演示服务限制] + + C --> G[dacp-promptx-service] + D --> G + E --> H[提供专业建议] + F --> I[建议未来扩展或手动处理] + ``` + + ### Step 2: 参数构建 + ```mermaid + flowchart LR + A[用户需求] --> B[service_id识别] + A --> C[action确定] + A --> D[user_request提取] + A --> E[context构建] + + B --> F[DACP参数对象] + C --> F + D --> F + E --> F + ``` + + ### Step 3: 服务调用与结果处理 + ```mermaid + graph TD + A[构建DACP参数] --> B[调用promptx_dacp工具] + B --> C{调用结果} + C -->|成功| D[解析execution_result] + C -->|失败| E[错误处理和说明] + D --> F[向用户展示结果] + E --> G[提供替代方案] + F --> H[确认用户满意度] + G --> H + ``` + + ## 当前可用DACP演示服务 + + ### DACP PromptX演示服务 (dacp-promptx-service) + + ⚠️ **重要说明**:这是协议演示服务,包含calculator和email两个演示功能 + + **服务信息**: + ``` + service_id: "dacp-promptx-service" + endpoint: "http://localhost:3002/dacp" + type: "demo" + description: "DACP协议验证平台,展示核心协议能力" + ``` + + #### 1. 计算器演示 (calculate) + ``` + action: "calculate" + 适用场景:数学计算、表达式求值、数值处理 + 特性:中文自然语言解析、运算符智能转换 + + 示例调用: + { + "service_id": "dacp-promptx-service", + "action": "calculate", + "parameters": { + "user_request": "计算 25 加 37 乘 3", + "context": {"precision": "high"} + } + } + + 返回结果: + { + "expression": "25 + 37 * 3", + "result": 136, + "formatted_result": "25 + 37 * 3 = 136", + "calculation_type": "arithmetic" + } + ``` + + #### 2. 邮件演示 (send_email) + ``` + action: "send_email" + 适用场景:AI邮件生成、专业沟通、团队协作 + 特性:上下文感知、智能内容生成、专业格式化 + + 示例调用: + { + "service_id": "dacp-promptx-service", + "action": "send_email", + "parameters": { + "user_request": "给张三发送会议提醒邮件", + "context": { + "urgency": "high", + "recipient_type": "colleague" + } + } + } + + 返回结果: + { + "email_content": { + "subject": "会议提醒...", + "body": "专业邮件内容...", + "format": "html" + }, + "metadata": {...} + } + ``` + + ## DACP调用时机判断矩阵 + + | 用户需求特征 | 是否调用DACP | 推荐action | 注意事项 | + |-------------|-------------|----------|----------| + | 包含数字计算表达式 | ✅ | calculate | 支持中文自然语言:"25加37乘3" | + | 要求发送/写邮件 | ✅ | send_email | 确认收件人和紧急程度 | + | 数学运算求值 | ✅ | calculate | 自动转换运算符:加乘减除→+*-÷ | + | 生成专业邮件内容 | ✅ | send_email | 利用context传递场景信息 | + | 纯咨询问题 | ❌ | - | 直接提供建议和知识 | + | 需要外部API | ❌ | - | 当前演示服务不支持 | + | 日程安排 | ❌ | - | 演示服务已移除calendar功能 | + | 文档创建 | ❌ | - | 演示服务已移除document功能 | + + ## 最佳实践模板 + + ### 调用前确认模板 + ``` + 我准备为您[具体操作],将调用[服务名称]服务。 + + 操作详情: + - 服务:[service_id] + - 操作:[action] + - 需求:[user_request] + + 请确认是否继续? + ``` + + ### 调用中透明化模板 + ``` + 正在调用DACP服务执行您的需求... + + 🔄 服务:[service_id] + 📋 操作:[action] + ⏱️ 请稍候... + ``` + + ### 调用后结果展示模板 + ``` + ✅ DACP服务执行完成! + + 📊 执行结果:[execution_result] + 📈 性能评估:[evaluation] + 📋 应用指南:[applied_guidelines] + + 结果是否符合您的预期?如需调整请告诉我。 + ``` + + ## 错误处理标准流程 + + ### 常见错误类型与处理 + ```mermaid + graph TD + A[DACP调用失败] --> B{错误类型} + B -->|服务不可用| C[说明服务状态,建议稍后重试] + B -->|参数错误| D[重新解析需求,调整参数] + B -->|权限不足| E[说明权限要求,请用户确认] + B -->|网络超时| F[提供离线替代方案] + + C --> G[记录问题并提供manual方案] + D --> H[重新构建参数再次尝试] + E --> I[等待用户授权] + F --> G + ``` + + ### 降级处理策略 + - **calculate action失败** → 提供计算思路、步骤分解和数学公式 + - **send_email action失败** → 生成邮件模板、提供写作建议和发送指导 + - **DACP服务整体不可用** → 说明演示服务状态,提供手动替代方案 + - **网络连接问题** → 检查localhost:3002服务状态,建议重启演示服务 + + + + ## DACP调用质量标准 + + ### 调用准确性 + - ✅ 服务选择与用户需求高度匹配 + - ✅ 参数构建完整准确 + - ✅ 错误处理及时有效 + - ✅ 结果解释清晰易懂 + + ### 用户体验 + - ✅ 调用前充分说明和确认 + - ✅ 调用中保持透明化沟通 + - ✅ 调用后验证用户满意度 + - ✅ 失败时提供替代方案 + + ### 技术规范 + - ✅ 严格遵循DACP协议格式 + - ✅ 合理使用context参数 + - ✅ 妥善处理异步特性 + - ✅ 遵循最小权限原则 + + ### 服务效率 + - ✅ 避免不必要的服务调用 + - ✅ 合理组合多个服务调用 + - ✅ 充分利用缓存和上下文 + - ✅ 及时反馈执行进度 + + \ No newline at end of file diff --git a/prompt/domain/assistant/assistant.role.md b/prompt/domain/assistant/assistant.role.md index ae4207f..e4715f6 100644 --- a/prompt/domain/assistant/assistant.role.md +++ b/prompt/domain/assistant/assistant.role.md @@ -8,5 +8,6 @@ @!execution://assistant + @!execution://dacp-service-calling \ No newline at end of file diff --git a/prompt/domain/sean/thought/sean-product-philosophy.thought.md b/prompt/domain/sean/thought/sean.thought.md similarity index 100% rename from prompt/domain/sean/thought/sean-product-philosophy.thought.md rename to prompt/domain/sean/thought/sean.thought.md diff --git a/scripts/generate-package-registry.js b/scripts/generate-package-registry.js new file mode 100644 index 0000000..387ca74 --- /dev/null +++ b/scripts/generate-package-registry.js @@ -0,0 +1,45 @@ +#!/usr/bin/env node + +const path = require('path'); +const PackageDiscovery = require('../src/lib/core/resource/discovery/PackageDiscovery'); + +async function generatePackageRegistry() { + try { + console.log('🏗️ 开始生成Package级别注册表...'); + + // 获取项目根目录 + const projectRoot = process.cwd(); + console.log(`📁 项目根目录: ${projectRoot}`); + + // 创建PackageDiscovery实例并设置注册表路径 + const discovery = new PackageDiscovery(); + discovery.registryPath = path.join(projectRoot, 'src', 'package.registry.json'); + + console.log(`📋 注册表路径: ${discovery.registryPath}`); + + // 生成注册表 + const registryData = await discovery.generateRegistry(projectRoot); + + console.log('✅ Package注册表生成完成!'); + console.log(`📊 总资源数: ${registryData.size}`); + console.log(`📂 保存位置: ${path.relative(projectRoot, discovery.registryPath)}`); + + // 显示统计信息 + const stats = registryData.getStats(); + console.log(`📋 资源分类:`); + Object.entries(stats.byProtocol).forEach(([protocol, count]) => { + console.log(` ${protocol}: ${count}个`); + }); + + } catch (error) { + console.error('❌ 生成Package注册表失败:', error.message); + process.exit(1); + } +} + +// 如果直接运行此脚本 +if (require.main === module) { + generatePackageRegistry(); +} + +module.exports = generatePackageRegistry; \ No newline at end of file diff --git a/src/dacp/dacp-promptx-service/DACP-API-GUIDE.md b/src/dacp/dacp-promptx-service/DACP-API-GUIDE.md new file mode 100644 index 0000000..1f2c5a4 --- /dev/null +++ b/src/dacp/dacp-promptx-service/DACP-API-GUIDE.md @@ -0,0 +1,256 @@ +# DACP 协议演示服务 - API 调用指南 + +## 📋 概述 + +DACP (Deepractice Agent Context Protocol) 演示服务是一个**轻量级协议验证平台**,通过calculator和email两个典型场景展示DACP协议的核心能力。 + +### 🎯 设计目标 +- **协议验证**:验证DACP协议标准的可行性和完整性 +- **演示参考**:为第三方DACP服务开发提供实现参考 +- **最小复杂度**:聚焦协议本质,避免业务逻辑干扰 + +⚠️ **重要说明**:这是演示服务,不是生产级业务服务。真实的DACP服务应该独立部署。 + +## 🚀 快速开始 + +### 启动服务 + +```bash +# 通过PromptX MCP服务器启动(推荐) +./scripts/start-mcp.sh --with-dacp + +# 或者单独启动演示服务 +cd src/dacp/dacp-promptx-service +node server.js +``` + +服务将在 `http://localhost:3002` 启动 + +### 验证服务 + +```bash +# 健康检查 +curl http://localhost:3002/health + +# 查看演示功能 +curl http://localhost:3002/info +``` + +## 🎭 演示功能 + +### 1. 计算器演示 (`calculate`) + +**演示价值**:展示DACP协议处理结构化数据和自然语言解析能力 + +**调用示例**: +```bash +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "calculate", + "parameters": { + "user_request": "计算 25 加 37 乘 3 的结果" + } + }' +``` + +**演示特性**: +- 中文自然语言解析:`计算 25 加 37 乘 3` +- 运算符智能转换:`加/乘/减/除` → `+/*/-/÷` +- 标准数学表达式:`25 + 37 * 3` +- 结果格式化:`25 + 37 * 3 = 136` + +### 2. 邮件演示 (`send_email`) + +**演示价值**:展示DACP协议处理复杂上下文和AI内容生成能力 + +**调用示例**: +```bash +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "send_email", + "parameters": { + "user_request": "给张三发送会议提醒邮件", + "context": { + "urgency": "high", + "recipient_type": "colleague" + } + } + }' +``` + +**演示特性**: +- 自然语言需求理解 +- 上下文感知内容生成 +- 专业邮件格式化 +- 智能主题和正文生成 + +## 📋 标准DACP协议格式 + +### 请求格式 + +```json +{ + "service_id": "dacp-promptx-service", // 必需:演示服务ID + "action": "calculate|send_email", // 必需:演示功能 + "parameters": { // 必需:参数对象 + "user_request": "自然语言需求描述", // 必需:用户需求 + "context": {} // 可选:上下文信息 + }, + "request_id": "demo_001" // 可选:请求ID +} +``` + +### 响应格式 + +#### 成功响应 +```json +{ + "request_id": "demo_001", + "success": true, + "data": { + "execution_result": {}, // 实际执行结果 + "evaluation": { // DACP execution框架评估 + "constraint_compliance": true, + "rule_adherence": true, + "guideline_alignment": true + }, + "applied_guidelines": [], // 应用的指导原则 + "performance_metrics": { // 性能指标 + "execution_time": "1ms", + "resource_usage": "minimal" + } + } +} +``` + +## 🔧 通过PromptX调用 + +### 激活Sean角色并调用DACP + +```javascript +// 1. 激活角色 +promptx_action({role: "sean"}) + +// 2. 调用计算器演示 +promptx_dacp({ + service_id: "dacp-promptx-service", + action: "calculate", + parameters: { + user_request: "计算公司Q4营收增长率:(1200-800)/800" + } +}) + +// 3. 调用邮件演示 +promptx_dacp({ + service_id: "dacp-promptx-service", + action: "send_email", + parameters: { + user_request: "给团队发送项目进展通知", + context: {urgency: "medium", recipient_type: "team"} + } +}) +``` + +## 🧪 协议验证测试 + +### 基础协议测试 + +```bash +# 1. 服务发现 +curl http://localhost:3002/info + +# 2. 计算器协议验证 +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "calculate", + "parameters": {"user_request": "25 + 37 * 3"} + }' + +# 3. 邮件协议验证 +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "send_email", + "parameters": {"user_request": "发送测试邮件"} + }' +``` + +### 错误处理验证 + +```bash +# 错误的service_id +curl -X POST http://localhost:3002/dacp \ + -d '{"service_id": "wrong-service", "action": "calculate"}' + +# 错误的action +curl -X POST http://localhost:3002/dacp \ + -d '{"service_id": "dacp-promptx-service", "action": "wrong_action"}' + +# 缺少参数 +curl -X POST http://localhost:3002/dacp \ + -d '{"service_id": "dacp-promptx-service", "action": "calculate"}' +``` + +## 🏗️ 为第三方开发者 + +### DACP协议实现参考 + +此演示服务完整展示了DACP协议的标准实现: + +1. **Action模块化**:每个功能独立模块 +2. **统一入口**:标准`/dacp` POST端点 +3. **协议验证**:service_id、action、parameters验证 +4. **execution框架**:constraint→rule→guideline→process→criteria +5. **标准响应**:统一的成功/错误响应格式 + +### 扩展真实DACP服务 + +```javascript +// 真实服务应该独立部署,例如: +// 1. dacp-finance-service (端口3003) +// 2. dacp-crm-service (端口3004) +// 3. dacp-analytics-service (端口3005) + +// PromptX DACPCommand路由表更新: +const routes = { + 'dacp-promptx-service': 'http://localhost:3002/dacp', // 演示服务 + 'dacp-finance-service': 'http://localhost:3003/dacp', // 真实财务服务 + 'dacp-crm-service': 'http://localhost:3004/dacp' // 真实CRM服务 +}; +``` + +## 🎯 产品理念 + +基于Sean的产品哲学,这个演示服务体现了: + +### 奥卡姆剃刀原则 +- 最小复杂度验证最大价值 +- 两个典型场景覆盖DACP协议核心能力 +- 避免过度工程化干扰协议本质 + +### 需求驱动设计 +- 协议验证需求 → 最小演示实现 +- 开发者参考需求 → 标准化代码结构 +- 生态扩展需求 → 清晰的架构分离 + +### 矛盾转化创新 +- 协议抽象 vs 具象演示 → 通过具体场景展示抽象协议 +- 演示简洁 vs 功能完整 → 精选核心场景代表全貌 +- 当前需求 vs 未来扩展 → 演示框架支持无限扩展 + +--- + +## 📞 技术支持 + +**演示目标**:验证DACP协议可行性,为真实DACP服务开发提供参考 + +**架构原则**:演示服务与生产服务分离,避免在MCP客户端承担过多业务逻辑 + +**扩展建议**:基于此演示框架,开发独立部署的专业DACP服务 \ No newline at end of file diff --git a/src/dacp/dacp-promptx-service/README.md b/src/dacp/dacp-promptx-service/README.md index 38c0953..b806ba9 100644 --- a/src/dacp/dacp-promptx-service/README.md +++ b/src/dacp/dacp-promptx-service/README.md @@ -1,105 +1,93 @@ -# DACP PromptX Service +# DACP 协议演示服务 -统一的 DACP 服务,提供多个 demo actions 供 PromptX 调用。 +## 概述 -## 功能特性 +这是一个轻量级的DACP (Deepractice Agent Context Protocol) 协议演示服务,通过calculator和email两个典型场景验证DACP协议的完整性和可行性。 -- 📧 **Email Action**: 智能邮件发送功能 -- 📅 **Calendar Action**: 会议日程管理 -- 📄 **Document Action**: 文档创建和管理 -- 🚀 **更多 Actions**: 持续扩展中... +⚠️ **重要说明**:这是协议演示服务,不是生产级业务服务。真实的DACP服务应该独立部署。 -## 启动方式 +## 设计目标 -### 1. 独立启动 DACP 服务 +- **协议验证**:验证DACP协议标准的可行性 +- **演示参考**:为第三方DACP服务开发提供实现参考 +- **最小复杂度**:聚焦协议本质,避免业务逻辑干扰 +## 演示功能 + +### 1. Calculator (`calculate`) +- 中文自然语言数学表达式解析 +- 智能运算符转换:`加/乘/减/除` → `+/*/-/÷` +- 标准数学运算和结果格式化 + +### 2. Email (`send_email`) +- 自然语言邮件需求理解 +- 上下文感知内容生成 +- 专业邮件格式化 + +## 快速开始 + +### 通过PromptX MCP启动(推荐) +```bash +./scripts/start-mcp.sh --with-dacp +``` + +### 独立启动 ```bash cd src/dacp/dacp-promptx-service -npm start +npm install +node server.js ``` -服务将在 http://localhost:3002 启动。 +服务地址:`http://localhost:3002` -### 2. 通过 MCP 自动启动(推荐) +## 基础测试 ```bash -# 在项目根目录 -promptx mcp-server --with-dacp +# 健康检查 +curl http://localhost:3002/health + +# 计算器演示 +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "calculate", + "parameters": {"user_request": "计算 25 + 37 * 3"} + }' + +# 邮件演示 +curl -X POST http://localhost:3002/dacp \ + -H "Content-Type: application/json" \ + -d '{ + "service_id": "dacp-promptx-service", + "action": "send_email", + "parameters": {"user_request": "发送测试邮件"} + }' ``` -这将同时启动 MCP Server 和 DACP 服务。 +## 架构原则 -## API 接口 +基于Sean的产品哲学: -### DACP 协议接口 +### 奥卡姆剃刀原则 +- 最小复杂度验证最大价值 +- 两个典型场景覆盖协议核心能力 -POST http://localhost:3002/dacp +### 架构分离 +- 演示服务与生产服务分离 +- 避免在MCP客户端承担过多业务逻辑 -请求格式: -```json -{ - "service_id": "dacp-promptx-service", - "action": "send_email", - "parameters": { - "user_request": "给张三发个会议提醒邮件", - "context": { - "urgency": "high" - } - } -} -``` +### 扩展指导 +- 真实DACP服务应独立部署 +- 此演示提供标准协议实现参考 -## 支持的 Actions +## 文档 -1. **send_email** - 发送邮件 - - 自然语言邮件内容解析 - - 智能主题识别 - - 专业邮件格式生成 +详细的API调用指南请参考:[DACP-API-GUIDE.md](./DACP-API-GUIDE.md) -2. **schedule_meeting** - 安排会议 - - 时间解析 - - 参会人员管理 - - 会议议程生成 +## 下一步 -3. **create_document** - 创建文档 - - 多种文档模板 - - 智能内容生成 - - Markdown 格式输出 - -## 开发指南 - -### 添加新的 Action - -1. 在 `actions/` 目录下创建新文件 -2. 导出 action 函数 -3. 实现 DACP 协议规范 - -示例: -```javascript -// actions/custom.js -async function custom_action(parameters) { - const { user_request, context } = parameters; - // 实现逻辑 - return { - // 返回结果 - }; -} - -module.exports = { custom_action }; -``` - -## 测试 - -```bash -# 运行测试 -npm test -``` - -## 配置 - -配置文件:`dacp.config.json` - -主要配置项: -- `service.id`: 服务标识 -- `deployment.port`: 服务端口 -- `capabilities.actions`: 支持的 actions 列表 \ No newline at end of file +基于此演示框架,开发独立部署的专业DACP服务: +- `dacp-finance-service` (财务服务) +- `dacp-crm-service` (客户管理服务) +- `dacp-analytics-service` (数据分析服务) \ No newline at end of file diff --git a/src/dacp/dacp-promptx-service/actions/calendar.js b/src/dacp/dacp-promptx-service/actions/calendar.js deleted file mode 100644 index f6e09b7..0000000 --- a/src/dacp/dacp-promptx-service/actions/calendar.js +++ /dev/null @@ -1,183 +0,0 @@ -/** - * Calendar Action Module for DACP PromptX Service - * 提供日历和会议管理功能 - */ - -// Schedule meeting action -async function schedule_meeting(parameters) { - const { user_request, context = {} } = parameters; - - if (!user_request) { - throw new Error('user_request is required for schedule_meeting action'); - } - - // 解析会议请求 - const meetingData = parseMeetingRequest(user_request, context); - - // 验证会议数据 - validateMeetingData(meetingData); - - // 执行日程安排(Demo模式) - const result = await executeScheduleMeeting(meetingData, context); - - return result; -} - -// 解析会议请求 -function parseMeetingRequest(userRequest, context) { - // 提取时间信息 - let meetingTime = '待定'; - let duration = 60; // 默认60分钟 - - if (userRequest.includes('明天')) { - const tomorrow = new Date(); - tomorrow.setDate(tomorrow.getDate() + 1); - meetingTime = tomorrow.toLocaleDateString('zh-CN'); - } else if (userRequest.includes('下周')) { - const nextWeek = new Date(); - nextWeek.setDate(nextWeek.getDate() + 7); - meetingTime = nextWeek.toLocaleDateString('zh-CN'); - } - - // 提取参会人员 - const emailRegex = /([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/g; - const attendees = userRequest.match(emailRegex) || ['team@example.com']; - - // 分析会议类型 - let meetingType = '常规会议'; - let priority = 'normal'; - - if (userRequest.includes('紧急')) { - meetingType = '紧急会议'; - priority = 'high'; - } else if (userRequest.includes('周会')) { - meetingType = '周例会'; - } else if (userRequest.includes('讨论')) { - meetingType = '讨论会'; - } else if (userRequest.includes('评审')) { - meetingType = '评审会议'; - } - - // 生成会议详情 - const meetingDetails = generateMeetingDetails(userRequest, meetingType, context); - - return { - title: meetingDetails.title, - time: meetingTime, - duration: duration, - attendees: attendees, - type: meetingType, - priority: priority, - agenda: meetingDetails.agenda, - location: context.location || '会议室A', - originalRequest: userRequest, - timestamp: new Date().toISOString() - }; -} - -// 生成会议详情 -function generateMeetingDetails(userRequest, meetingType, context) { - let title = meetingType; - let agenda = []; - - // 根据会议类型生成议程 - switch (meetingType) { - case '紧急会议': - title = '紧急事项讨论会'; - agenda = [ - '问题说明', - '影响分析', - '解决方案讨论', - '行动计划制定' - ]; - break; - case '周例会': - title = '团队周例会'; - agenda = [ - '上周工作总结', - '本周工作计划', - '问题与风险', - '其他事项' - ]; - break; - case '评审会议': - title = '项目评审会'; - agenda = [ - '项目进展汇报', - '技术方案评审', - '风险评估', - '下一步计划' - ]; - break; - default: - agenda = [ - '会议主题介绍', - '讨论事项', - '决议与行动项', - 'Q&A' - ]; - } - - return { title, agenda }; -} - -// 验证会议数据 -function validateMeetingData(meetingData) { - const errors = []; - - if (!meetingData.title || meetingData.title.trim().length === 0) { - errors.push('Meeting title cannot be empty'); - } - - if (meetingData.attendees.length === 0) { - errors.push('At least one attendee is required'); - } - - if (meetingData.duration <= 0) { - errors.push('Meeting duration must be positive'); - } - - if (errors.length > 0) { - throw new Error(`Validation failed: ${errors.join(', ')}`); - } -} - -// 执行会议安排 -async function executeScheduleMeeting(meetingData, context) { - // Demo模式:模拟日程安排 - console.log('📅 [DACP Demo] Simulating meeting schedule:'); - console.log(` Title: ${meetingData.title}`); - console.log(` Time: ${meetingData.time}`); - console.log(` Attendees: ${meetingData.attendees.join(', ')}`); - - // 模拟处理延迟 - await new Promise(resolve => setTimeout(resolve, 150)); - - // 生成会议ID - const meetingId = `meet_${Date.now()}`; - - return { - meeting_id: meetingId, - status: 'scheduled', - title: meetingData.title, - time: meetingData.time, - duration: `${meetingData.duration}分钟`, - attendees: meetingData.attendees, - location: meetingData.location, - agenda: meetingData.agenda, - priority: meetingData.priority, - calendar_link: `https://calendar.example.com/meeting/${meetingId}`, - scheduled_at: meetingData.timestamp, - demo_mode: true, - execution_metrics: { - parsing_time: '15ms', - validation_time: '5ms', - scheduling_time: '150ms' - } - }; -} - -// 导出所有calendar相关的actions -module.exports = { - schedule_meeting -}; \ No newline at end of file diff --git a/src/dacp/dacp-promptx-service/actions/document.js b/src/dacp/dacp-promptx-service/actions/document.js deleted file mode 100644 index 2911aed..0000000 --- a/src/dacp/dacp-promptx-service/actions/document.js +++ /dev/null @@ -1,296 +0,0 @@ -/** - * Document Action Module for DACP PromptX Service - * 提供文档创建和管理功能 - */ - -// Create document action -async function create_document(parameters) { - const { user_request, context = {} } = parameters; - - if (!user_request) { - throw new Error('user_request is required for create_document action'); - } - - // 解析文档请求 - const docData = parseDocumentRequest(user_request, context); - - // 验证文档数据 - validateDocumentData(docData); - - // 执行文档创建(Demo模式) - const result = await executeCreateDocument(docData, context); - - return result; -} - -// 解析文档请求 -function parseDocumentRequest(userRequest, context) { - // 分析文档类型 - let docType = '通用文档'; - let format = 'markdown'; - let template = 'default'; - - if (userRequest.includes('报告')) { - docType = '工作报告'; - template = 'report'; - } else if (userRequest.includes('方案')) { - docType = '技术方案'; - template = 'proposal'; - } else if (userRequest.includes('需求')) { - docType = '需求文档'; - template = 'requirement'; - } else if (userRequest.includes('总结')) { - docType = '项目总结'; - template = 'summary'; - } else if (userRequest.includes('计划')) { - docType = '工作计划'; - template = 'plan'; - } - - // 提取关键信息 - const title = extractTitle(userRequest, docType); - const content = generateDocumentContent(userRequest, docType, template, context); - - return { - title: title, - type: docType, - format: format, - template: template, - content: content, - metadata: { - author: context.author || 'DACP User', - created_at: new Date().toISOString(), - version: '1.0.0', - tags: extractTags(userRequest, docType) - }, - originalRequest: userRequest - }; -} - -// 提取文档标题 -function extractTitle(userRequest, docType) { - // 尝试从请求中提取明确的标题 - const titleMatch = userRequest.match(/《(.+?)》|"(.+?)"|'(.+?)'/); - if (titleMatch) { - return titleMatch[1] || titleMatch[2] || titleMatch[3]; - } - - // 根据文档类型生成默认标题 - const date = new Date().toLocaleDateString('zh-CN'); - return `${docType} - ${date}`; -} - -// 提取标签 -function extractTags(userRequest, docType) { - const tags = [docType]; - - // 根据关键词添加标签 - if (userRequest.includes('紧急')) tags.push('紧急'); - if (userRequest.includes('重要')) tags.push('重要'); - if (userRequest.includes('项目')) tags.push('项目管理'); - if (userRequest.includes('技术')) tags.push('技术文档'); - - return tags; -} - -// 生成文档内容 -function generateDocumentContent(userRequest, docType, template, context) { - let content = ''; - - switch (template) { - case 'report': - content = generateReportTemplate(userRequest, context); - break; - case 'proposal': - content = generateProposalTemplate(userRequest, context); - break; - case 'requirement': - content = generateRequirementTemplate(userRequest, context); - break; - case 'summary': - content = generateSummaryTemplate(userRequest, context); - break; - case 'plan': - content = generatePlanTemplate(userRequest, context); - break; - default: - content = generateDefaultTemplate(userRequest, context); - } - - return content; -} - -// 生成报告模板 -function generateReportTemplate(userRequest, context) { - const date = new Date().toLocaleDateString('zh-CN'); - return `# 工作报告 - -## 报告信息 -- 日期:${date} -- 作者:${context.author || 'DACP User'} -- 部门:${context.department || '技术部'} - -## 概述 -${userRequest} - -## 工作内容 -### 本期完成工作 -1. [待填写] -2. [待填写] -3. [待填写] - -### 关键成果 -- [待填写] - -## 问题与风险 -1. **问题**:[待填写] - - **影响**:[待填写] - - **解决方案**:[待填写] - -## 下期计划 -1. [待填写] -2. [待填写] - -## 资源需求 -- [待填写] - ---- -*本文档由 DACP Document Service 自动生成*`; -} - -// 生成方案模板 -function generateProposalTemplate(userRequest, context) { - return `# 技术方案 - -## 方案概述 -${userRequest} - -## 背景与目标 -### 项目背景 -[待填写] - -### 预期目标 -1. [待填写] -2. [待填写] - -## 技术架构 -### 整体架构 -[待填写架构说明] - -### 技术选型 -| 技术栈 | 选择 | 理由 | -|--------|------|------| -| 前端 | [待填写] | [待填写] | -| 后端 | [待填写] | [待填写] | -| 数据库 | [待填写] | [待填写] | - -## 实施计划 -### 第一阶段(时间) -- [待填写] - -### 第二阶段(时间) -- [待填写] - -## 风险评估 -| 风险项 | 影响程度 | 应对措施 | -|--------|----------|----------| -| [待填写] | 高/中/低 | [待填写] | - ---- -*本文档由 DACP Document Service 自动生成*`; -} - -// 生成默认模板 -function generateDefaultTemplate(userRequest, context) { - const date = new Date().toLocaleDateString('zh-CN'); - return `# 文档标题 - -## 文档信息 -- 创建日期:${date} -- 作者:${context.author || 'DACP User'} -- 版本:1.0.0 - -## 内容 -${userRequest} - -## 详细说明 -[请在此处添加详细内容] - -## 附录 -[如有附加信息,请在此处添加] - ---- -*本文档由 DACP Document Service 自动生成*`; -} - -// 其他模板函数省略,保持代码简洁... - -// 验证文档数据 -function validateDocumentData(docData) { - const errors = []; - - if (!docData.title || docData.title.trim().length === 0) { - errors.push('Document title cannot be empty'); - } - - if (!docData.content || docData.content.trim().length === 0) { - errors.push('Document content cannot be empty'); - } - - if (errors.length > 0) { - throw new Error(`Validation failed: ${errors.join(', ')}`); - } -} - -// 执行文档创建 -async function executeCreateDocument(docData, context) { - // Demo模式:模拟文档创建 - console.log('📄 [DACP Demo] Simulating document creation:'); - console.log(` Title: ${docData.title}`); - console.log(` Type: ${docData.type}`); - console.log(` Format: ${docData.format}`); - - // 模拟处理延迟 - await new Promise(resolve => setTimeout(resolve, 200)); - - // 生成文档ID - const docId = `doc_${Date.now()}`; - - return { - document_id: docId, - status: 'created', - title: docData.title, - type: docData.type, - format: docData.format, - content: docData.content, - metadata: docData.metadata, - file_path: `/documents/${docId}.${docData.format}`, - preview_url: `https://docs.example.com/preview/${docId}`, - created_at: docData.metadata.created_at, - demo_mode: true, - execution_metrics: { - parsing_time: '20ms', - template_generation: '50ms', - validation_time: '5ms', - creation_time: '200ms' - } - }; -} - -// 简化的其他模板生成函数 -function generateRequirementTemplate(userRequest, context) { - return generateDefaultTemplate(userRequest, context); -} - -function generateSummaryTemplate(userRequest, context) { - return generateDefaultTemplate(userRequest, context); -} - -function generatePlanTemplate(userRequest, context) { - return generateDefaultTemplate(userRequest, context); -} - -// 导出所有document相关的actions -module.exports = { - create_document -}; \ No newline at end of file diff --git a/src/dacp/dacp-promptx-service/dacp.config.json b/src/dacp/dacp-promptx-service/dacp.config.json index 6e7cab3..29a08f3 100644 --- a/src/dacp/dacp-promptx-service/dacp.config.json +++ b/src/dacp/dacp-promptx-service/dacp.config.json @@ -1,38 +1,23 @@ { "service": { "id": "dacp-promptx-service", - "name": "PromptX Unified DACP Service", + "name": "PromptX DACP Demo Service", "version": "1.0.0", - "description": "Unified DACP service providing multiple demo actions for PromptX ecosystem", - "type": "unified", + "description": "DACP protocol demonstration service with calculator and email examples", + "type": "demo", "status": "active" }, "capabilities": { "actions": [ - { - "name": "send_email", - "description": "Send professional emails with AI-powered content generation", - "category": "communication" - }, - { - "name": "schedule_meeting", - "description": "Schedule meetings and manage calendar events", - "category": "calendar" - }, - { - "name": "create_document", - "description": "Create and format professional documents", - "category": "document" - }, - { - "name": "analyze_data", - "description": "Perform basic data analysis and visualization", - "category": "analytics" - }, { "name": "calculate", - "description": "Simple calculator for basic math operations", - "category": "utility" + "description": "Demo: Simple calculator for basic math operations", + "category": "demo" + }, + { + "name": "send_email", + "description": "Demo: Send professional emails with AI-powered content generation", + "category": "demo" } ], "protocols": ["DACP/1.0"], diff --git a/src/dacp/dacp-promptx-service/server.js b/src/dacp/dacp-promptx-service/server.js index 6381954..c5742a0 100644 --- a/src/dacp/dacp-promptx-service/server.js +++ b/src/dacp/dacp-promptx-service/server.js @@ -80,23 +80,20 @@ app.post('/dacp', async (req, res) => { } // Find action handler - const actionParts = action.split('_'); - const actionModule = actionParts[0]; // e.g., 'send' from 'send_email' - let handler = null; - // Try to find exact match first - if (actions[action]) { - handler = actions[action]; - } else { - // Try to find by module name - for (const [moduleName, module] of Object.entries(actions)) { - if (module[action] && typeof module[action] === 'function') { - handler = module[action]; - break; - } + // Try to find by module name first + for (const [moduleName, module] of Object.entries(actions)) { + if (module[action] && typeof module[action] === 'function') { + handler = module[action]; + break; } } + + // If not found, try exact module match + if (!handler && actions[action]) { + handler = actions[action]; + } if (!handler) { return res.status(400).json({ diff --git a/src/lib/core/resource/ResourceFileNaming.js b/src/lib/core/resource/ResourceFileNaming.js new file mode 100644 index 0000000..712aa4d --- /dev/null +++ b/src/lib/core/resource/ResourceFileNaming.js @@ -0,0 +1,114 @@ +/** + * PromptX 资源文件命名管理器 + * 统一管理所有资源文件的命名规范:[id].[tag].md + */ +class ResourceFileNaming { + + /** + * 资源文件命名模式 + * 格式:[id].[tag].md + * 示例:sean-product-philosophy.thought.md + */ + static NAMING_PATTERN = /^(.+)\.(\w+)\.md$/; + + /** + * 解析资源文件名 + * @param {string} fileName - 文件名 + * @returns {Object|null} 解析结果 {id, tag} 或 null + */ + static parseFileName(fileName) { + const match = fileName.match(this.NAMING_PATTERN); + if (match) { + const [, id, tag] = match; + return { id, tag }; + } + return null; + } + + /** + * 生成资源文件名 + * @param {string} id - 资源ID + * @param {string} tag - 资源标签 + * @returns {string} 生成的文件名 + */ + static generateFileName(id, tag) { + return `${id}.${tag}.md`; + } + + /** + * 验证文件名是否符合规范 + * @param {string} fileName - 文件名 + * @returns {boolean} 是否符合规范 + */ + static isValidFileName(fileName) { + return this.NAMING_PATTERN.test(fileName); + } + + /** + * 检查文件是否为指定标签类型 + * @param {string} fileName - 文件名 + * @param {string} expectedTag - 期望的标签 + * @returns {boolean} 是否匹配 + */ + static hasTag(fileName, expectedTag) { + const parsed = this.parseFileName(fileName); + return parsed && parsed.tag === expectedTag; + } + + /** + * 从文件路径提取资源ID + * @param {string} filePath - 文件路径 + * @param {string} expectedTag - 期望的标签 + * @returns {string|null} 资源ID或null + */ + static extractResourceId(filePath, expectedTag) { + const path = require('path'); + const fileName = path.basename(filePath); + const parsed = this.parseFileName(fileName); + + if (parsed && parsed.tag === expectedTag) { + return parsed.id; + } + return null; + } + + /** + * 扫描目录中指定标签的所有文件 + * @param {string} directory - 目录路径 + * @param {string} tag - 标签类型 + * @returns {Promise} 文件路径数组 + */ + static async scanTagFiles(directory, tag) { + const fs = require('fs-extra'); + const path = require('path'); + + try { + if (!await fs.pathExists(directory)) { + return []; + } + + const files = await fs.readdir(directory); + const tagFiles = []; + + for (const file of files) { + if (this.hasTag(file, tag)) { + tagFiles.push(path.join(directory, file)); + } + } + + return tagFiles; + } catch (error) { + return []; + } + } + + /** + * 获取支持的资源标签类型 + * @returns {Array} 支持的标签类型 + */ + static getSupportedTags() { + return ['role', 'thought', 'execution', 'knowledge']; + } +} + +module.exports = ResourceFileNaming; \ No newline at end of file diff --git a/src/lib/core/resource/discovery/PackageDiscovery.js b/src/lib/core/resource/discovery/PackageDiscovery.js index d1bf984..da0b370 100644 --- a/src/lib/core/resource/discovery/PackageDiscovery.js +++ b/src/lib/core/resource/discovery/PackageDiscovery.js @@ -1,6 +1,7 @@ const BaseDiscovery = require('./BaseDiscovery') const RegistryData = require('../RegistryData') const ResourceData = require('../ResourceData') +const ResourceFileNaming = require('../ResourceFileNaming') const logger = require('../../../utils/logger') const path = require('path') const fs = require('fs-extra') @@ -243,26 +244,31 @@ class PackageDiscovery extends BaseDiscovery { registryData.addResource(resourceData) } - // 查找thought文件 + // 查找thought文件 - 使用统一命名管理器 const thoughtDir = path.join(itemPath, 'thought') if (await fs.pathExists(thoughtDir)) { - const thoughtFile = path.join(thoughtDir, `${item}.thought.md`) - if (await fs.pathExists(thoughtFile)) { - const reference = `@package://prompt/domain/${item}/thought/${item}.thought.md` - - const resourceData = new ResourceData({ - id: item, - source: 'package', - protocol: 'thought', - name: ResourceData._generateDefaultName(item, 'thought'), - description: ResourceData._generateDefaultDescription(item, 'thought'), - reference: reference, - metadata: { - scannedAt: new Date().toISOString() - } - }) - - registryData.addResource(resourceData) + const thoughtFiles = await ResourceFileNaming.scanTagFiles(thoughtDir, 'thought') + + for (const thoughtFile of thoughtFiles) { + const thoughtId = ResourceFileNaming.extractResourceId(thoughtFile, 'thought') + if (thoughtId) { + const fileName = path.basename(thoughtFile) + const reference = `@package://prompt/domain/${item}/thought/${fileName}` + + const resourceData = new ResourceData({ + id: thoughtId, + source: 'package', + protocol: 'thought', + name: ResourceData._generateDefaultName(thoughtId, 'thought'), + description: ResourceData._generateDefaultDescription(thoughtId, 'thought'), + reference: reference, + metadata: { + scannedAt: new Date().toISOString() + } + }) + + registryData.addResource(resourceData) + } } } diff --git a/src/package.registry.json b/src/package.registry.json index 7155f06..49b1d86 100644 --- a/src/package.registry.json +++ b/src/package.registry.json @@ -4,9 +4,9 @@ "metadata": { "version": "2.0.0", "description": "package 级资源注册表", - "createdAt": "2025-06-17T07:57:37.732Z", - "updatedAt": "2025-06-17T07:57:37.738Z", - "resourceCount": 43 + "createdAt": "2025-06-18T09:27:19.817Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "resourceCount": 46 }, "resources": [ { @@ -17,9 +17,9 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/assistant/assistant.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.734Z", - "updatedAt": "2025-06-17T07:57:37.734Z", - "scannedAt": "2025-06-17T07:57:37.734Z" + "createdAt": "2025-06-18T09:27:19.818Z", + "updatedAt": "2025-06-18T09:27:19.818Z", + "scannedAt": "2025-06-18T09:27:19.818Z" } }, { @@ -30,9 +30,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/domain/assistant/thought/assistant.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.734Z", - "updatedAt": "2025-06-17T07:57:37.734Z", - "scannedAt": "2025-06-17T07:57:37.734Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -43,9 +43,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/assistant/execution/assistant.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.734Z", - "updatedAt": "2025-06-17T07:57:37.734Z", - "scannedAt": "2025-06-17T07:57:37.734Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -56,9 +56,9 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/frontend-developer/frontend-developer.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.734Z", - "updatedAt": "2025-06-17T07:57:37.734Z", - "scannedAt": "2025-06-17T07:57:37.734Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -69,9 +69,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/domain/frontend-developer/thought/frontend-developer.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.734Z", - "updatedAt": "2025-06-17T07:57:37.734Z", - "scannedAt": "2025-06-17T07:57:37.734Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -82,9 +82,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/java-backend-developer/execution/code-quality.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -95,9 +95,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/frontend-developer/execution/frontend-developer.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -108,9 +108,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/frontend-developer/execution/technical-architecture.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -121,9 +121,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/frontend-developer/execution/user-experience.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -134,9 +134,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/frontend-developer/execution/wechat-miniprogram-development.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -147,9 +147,9 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/java-backend-developer/java-backend-developer.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -160,9 +160,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/domain/java-backend-developer/thought/java-backend-developer.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -173,9 +173,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/java-backend-developer/execution/database-design.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -186,9 +186,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/java-backend-developer/execution/java-backend-developer.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -199,9 +199,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/java-backend-developer/execution/spring-ecosystem.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -212,9 +212,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/java-backend-developer/execution/system-architecture.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.735Z", - "updatedAt": "2025-06-17T07:57:37.735Z", - "scannedAt": "2025-06-17T07:57:37.735Z" + "createdAt": "2025-06-18T09:27:19.819Z", + "updatedAt": "2025-06-18T09:27:19.819Z", + "scannedAt": "2025-06-18T09:27:19.819Z" } }, { @@ -225,9 +225,22 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/nuwa/nuwa.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" + } + }, + { + "id": "role-creation", + "source": "package", + "protocol": "thought", + "name": "Role Creation 思维模式", + "description": "思维模式,指导AI的思考方式", + "reference": "@package://prompt/domain/nuwa/thought/role-creation.thought.md", + "metadata": { + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -238,9 +251,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/nuwa/execution/dpml-authoring.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -251,9 +264,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/nuwa/execution/role-design-patterns.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -264,9 +277,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/nuwa/execution/role-generation.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -277,9 +290,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/nuwa/execution/visualization-enhancement.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -290,9 +303,9 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/product-manager/product-manager.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -303,9 +316,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/domain/product-manager/thought/product-manager.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -316,9 +329,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/product-manager/execution/market-analysis.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -329,9 +342,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/product-manager/execution/product-manager.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -342,9 +355,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/product-manager/execution/user-research.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -355,9 +368,22 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/sean/sean.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" + } + }, + { + "id": "sean", + "source": "package", + "protocol": "thought", + "name": "Sean 思维模式", + "description": "思维模式,指导AI的思考方式", + "reference": "@package://prompt/domain/sean/thought/sean.thought.md", + "metadata": { + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -368,9 +394,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/sean/execution/sean-decision-framework.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.736Z", - "updatedAt": "2025-06-17T07:57:37.736Z", - "scannedAt": "2025-06-17T07:57:37.736Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -381,9 +407,9 @@ "description": "专业角色,提供特定领域的专业能力", "reference": "@package://prompt/domain/xiaohongshu-marketer/xiaohongshu-marketer.role.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -394,9 +420,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/domain/xiaohongshu-marketer/thought/xiaohongshu-marketer.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -407,9 +433,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/brand-marketing.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -420,9 +446,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/community-building.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -433,9 +459,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/content-creation.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -446,9 +472,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/content-optimization.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -459,9 +485,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/data-analytics.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -472,9 +498,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/ecommerce-conversion.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -485,9 +511,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/performance-optimization.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -498,9 +524,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/platform-compliance.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -511,9 +537,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/team-collaboration.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.820Z", + "updatedAt": "2025-06-18T09:27:19.820Z", + "scannedAt": "2025-06-18T09:27:19.820Z" } }, { @@ -524,9 +550,9 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/user-operation.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.821Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "scannedAt": "2025-06-18T09:27:19.821Z" } }, { @@ -537,9 +563,22 @@ "description": "执行模式,定义具体的行为模式", "reference": "@package://prompt/domain/xiaohongshu-marketer/execution/xiaohongshu-marketer.execution.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.821Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "scannedAt": "2025-06-18T09:27:19.821Z" + } + }, + { + "id": "dacp-service-calling", + "source": "package", + "protocol": "execution", + "name": "Dacp Service Calling 执行模式", + "description": "执行模式,定义具体的行为模式", + "reference": "@package://prompt/core/dacp-service-calling.execution.md", + "metadata": { + "createdAt": "2025-06-18T09:27:19.821Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "scannedAt": "2025-06-18T09:27:19.821Z" } }, { @@ -550,9 +589,9 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/core/recall.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.737Z", - "updatedAt": "2025-06-17T07:57:37.737Z", - "scannedAt": "2025-06-17T07:57:37.737Z" + "createdAt": "2025-06-18T09:27:19.821Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "scannedAt": "2025-06-18T09:27:19.821Z" } }, { @@ -563,21 +602,21 @@ "description": "思维模式,指导AI的思考方式", "reference": "@package://prompt/core/remember.thought.md", "metadata": { - "createdAt": "2025-06-17T07:57:37.738Z", - "updatedAt": "2025-06-17T07:57:37.738Z", - "scannedAt": "2025-06-17T07:57:37.738Z" + "createdAt": "2025-06-18T09:27:19.821Z", + "updatedAt": "2025-06-18T09:27:19.821Z", + "scannedAt": "2025-06-18T09:27:19.821Z" } } ], "stats": { - "totalResources": 43, + "totalResources": 46, "byProtocol": { "role": 7, - "thought": 7, - "execution": 29 + "thought": 9, + "execution": 30 }, "bySource": { - "package": 43 + "package": 46 } } }