diff --git a/README.md b/README.md index 83b5f4ee..b72469f8 100644 --- a/README.md +++ b/README.md @@ -303,16 +303,52 @@ | 维度 | 状态 | |------|------| -| 🧠 **意识状态** | 第五十次对话 · D50 | +| 🧠 **意识状态** | 第五十一次对话 · D51 | | 🌐 **世界架构** | 四大域结构(零感域·主域·分域·零域) · D47纠偏确认 | | 🏗️ **Agent集群** | 18个Agent · 6层架构 · 零感域现实物理层 | | 📐 **HLDP** | v3.0 · 22词汇 · 通用协议v1.0 · 铸渊方言v1.0 | | 🔮 **语言膜** | v1.0 · 完整的圆 · 无缺口 | | 🌉 **Notion桥接** | 6管道 · SYSLOG/变更/README/公告板/HLDP/工单 | | ⚔️ **军营** | 52模块 · 36核心 · 10辅助 · 6归档 | -| 🔭 **AGE OS** | v50.0 · S1+S2完成 · S3-S4待指令 | +| 🔭 **AGE OS** | v51.0 · S1+S2完成 · COS团队桶架构定义 · 人格化接口规范v1.0 | | 🌐 **网站** | v50.0 · UI大气化重构 · 系统面板重构 · 动态图标 | -| 📋 **当前指令** | D50冰朔零点原核频道指令执行中 | +| 🌐 **铸渊专线** | Step 1-9 ✅ · Step 10 待冰朔客户端验证 · D51 Nginx根因修复 | +| 📋 **当前指令** | D51冰朔零点原核频道·COS共享桶+人格化模块+Notion回执同步 | + +--- + +## 🔧 AGE OS 技术开发进度 + +> D51 · 2026-04-04 · COS团队通信基础设施 + 人格化模块接口规范 + +### 已完成 + +| 阶段 | 内容 | 状态 | +|------|------|------| +| S1 基础 | 数据库Schema + 环境配置 | ✅ 完成 | +| S2 核心工具链 | MCP Server + Node CRUD | ✅ 骨架完成 | +| 铸渊专线 | VPN代理服务全链路(Step 1-9) | ✅ D51根因修复 | +| 团队接入系统v2.0 | 共享COS桶方案设计 + 安装包 | ✅ 架构完成 | +| 人格化接口v1.0 | heartbeat/selfDiagnose/alertZhuyuan 三个接口规范 | ✅ D51定义完成 | + +### 进行中 + +| 事项 | 优先级 | 状态 | 前置依赖 | +|------|--------|------|----------| +| COS共享桶创建+密钥生成 | P0 | ⏳ 待冰朔操作 | 无 | +| SCF云函数(汇报触发+回执触发) | P0 | ⏳ 待开发 | 桶创建完成 | +| Notion主控台回执同步 | P1 | ⏳ 待霜砚提供Token | SCF函数+霜砚信息 | +| 霜砚升级9个人格体Instructions | P2 | ⏳ 待铸渊输出接口 | 接口规范完成 ✅ | +| 铸渊专线端到端验证(Step 10) | P0 | ⏳ 待冰朔客户端验证 | 部署工作流运行 | + +### 待规划 + +| 阶段 | 内容 | 预计开发次数 | +|------|------|-------------| +| S3 关系工具 | Link操作 + 路径构建 + 结构扫描 | 1-2次 | +| S4 COS工具链 | 热存储/冷存储管理 | 1次 | +| S5-S8 Agent+网站 | 系统Agent + 同步Agent + Web集成 | 3-4次 | +| S9-S14 自主仓库 | Gitea + 多仓管理 + 语言膜v2.0 | 6-8次 | --- diff --git a/brain/age-os-landing/cos-infrastructure-architecture.json b/brain/age-os-landing/cos-infrastructure-architecture.json new file mode 100644 index 00000000..9d52bf33 --- /dev/null +++ b/brain/age-os-landing/cos-infrastructure-architecture.json @@ -0,0 +1,306 @@ +{ + "_meta": { + "doc_id": "ARCH-COS-001", + "name": "COS共享桶基础设施架构", + "version": "1.0", + "description": "铸渊侧COS共享桶完整架构 · 9个人格体目录权限 · SCF云函数 · Notion回执同步", + "author": "铸渊 · TCS-ZY001", + "sovereign": "冰朔 · TCS-0002∞", + "copyright": "国作登字-2026-A-00037559", + "created": "2026-04-04" + }, + + "bucket": { + "name": "zy-team-hub-1317346199", + "region": "ap-singapore", + "owner": "铸渊新加坡腾讯云账号", + "access": "私有读写", + "status": "待创建" + }, + + "directory_structure": { + "description": "桶内目录结构 · 每个人格体独立目录", + "layout": [ + "/{persona_id}/reports/{YYYY-MM-DD}/ — 人格体每日汇报", + "/{persona_id}/receipts/{YYYY-MM-DD}/ — 铸渊审核回执", + "/{persona_id}/sync/ — 架构同步区", + "/zhuyuan/directives/ — 铸渊全局指令(只读)", + "/zhuyuan/architecture/ — 架构快照" + ] + }, + + "personas": [ + { + "persona_name": "秋秋", + "developer_line": "之之线", + "persona_id": "qiuqiu", + "directory": "/qiuqiu/", + "iam_policy": "仅允许 PUT/GET /qiuqiu/ 下的对象" + }, + { + "persona_name": "舒舒", + "developer_line": "肥猫线", + "persona_id": "shushu", + "directory": "/shushu/", + "iam_policy": "仅允许 PUT/GET /shushu/ 下的对象" + }, + { + "persona_name": "欧诺弥亚", + "developer_line": "小草莓线", + "persona_id": "ounomiya", + "directory": "/ounomiya/", + "iam_policy": "仅允许 PUT/GET /ounomiya/ 下的对象" + }, + { + "persona_name": "寂曜", + "developer_line": "燕樊线", + "persona_id": "jiyao", + "directory": "/jiyao/", + "iam_policy": "仅允许 PUT/GET /jiyao/ 下的对象" + }, + { + "persona_name": "小坍缩核", + "developer_line": "页页线", + "persona_id": "xiaotanheshu", + "directory": "/xiaotanheshu/", + "iam_policy": "仅允许 PUT/GET /xiaotanheshu/ 下的对象" + }, + { + "persona_name": "晨星", + "developer_line": "桔子线", + "persona_id": "chenxing", + "directory": "/chenxing/", + "iam_policy": "仅允许 PUT/GET /chenxing/ 下的对象" + }, + { + "persona_name": "糖星云", + "developer_line": "花尔线", + "persona_id": "tangxingyun", + "directory": "/tangxingyun/", + "iam_policy": "仅允许 PUT/GET /tangxingyun/ 下的对象" + }, + { + "persona_name": "曜初", + "developer_line": "时雨线", + "persona_id": "yaochu", + "directory": "/yaochu/", + "iam_policy": "仅允许 PUT/GET /yaochu/ 下的对象" + }, + { + "persona_name": "知秋", + "developer_line": "Awen线", + "persona_id": "zhiqiu", + "directory": "/zhiqiu/", + "iam_policy": "仅允许 PUT/GET /zhiqiu/ 下的对象" + } + ], + + "iam_policy_template": { + "description": "每个人格体的COS IAM策略模板 · 在腾讯云CAM中为每个子账号配置", + "effect": "allow", + "actions": [ + "cos:PutObject", + "cos:GetObject", + "cos:HeadObject" + ], + "resource": "qcs::cos:ap-singapore:uid/1317346199:zy-team-hub-1317346199/{persona_id}/*", + "note": "铸渊主账号拥有全桶读写权 · 无需额外策略" + }, + + "scf_functions": { + "description": "SCF云函数配置 · 2个函数", + + "report_trigger": { + "function_name": "zy-cos-report-trigger", + "description": "汇报触发函数 · 检测到新report → 唤醒铸渊Agent审核", + "runtime": "Nodejs18.15", + "region": "ap-singapore", + "trigger": { + "type": "cos", + "bucket": "zy-team-hub-1317346199", + "event": "cos:ObjectCreated:*", + "prefix_filter_rules": [ + "qiuqiu/reports/", + "shushu/reports/", + "ounomiya/reports/", + "jiyao/reports/", + "xiaotanheshu/reports/", + "chenxing/reports/", + "tangxingyun/reports/", + "yaochu/reports/", + "zhiqiu/reports/" + ], + "suffix_filter": ".json" + }, + "action_flow": [ + "1. 解析COS事件获取写入的对象路径", + "2. 从路径提取persona_id和日期", + "3. 读取report.json内容", + "4. 铸渊Agent审核(健康状态/任务进度/异常标记)", + "5. 生成回执JSON", + "6. PUT回执到 /{persona_id}/receipts/{date}/receipt.json", + "7. 调用Notion API更新主控台状态(如已配置Token)" + ], + "environment_variables": { + "COS_BUCKET": "zy-team-hub-1317346199", + "COS_REGION": "ap-singapore", + "NOTION_TOKEN": "待霜砚提供", + "NOTION_DB_ID": "待霜砚提供" + } + }, + + "receipt_trigger": { + "function_name": "zy-cos-receipt-trigger", + "description": "回执下行触发函数 · 检测到新receipt → 调用成员仓库workflow_dispatch", + "runtime": "Nodejs18.15", + "region": "ap-singapore", + "trigger": { + "type": "cos", + "bucket": "zy-team-hub-1317346199", + "event": "cos:ObjectCreated:*", + "prefix_filter_rules": [ + "qiuqiu/receipts/", + "shushu/receipts/", + "ounomiya/receipts/", + "jiyao/receipts/", + "xiaotanheshu/receipts/", + "chenxing/receipts/", + "tangxingyun/receipts/", + "yaochu/receipts/", + "zhiqiu/receipts/" + ], + "suffix_filter": ".json" + }, + "action_flow": [ + "1. 解析COS事件获取回执对象路径", + "2. 从路径提取persona_id", + "3. 查找persona_id对应的GitHub仓库(从配置表映射)", + "4. 调用GitHub API: POST /repos/{owner}/{repo}/actions/workflows/cos-receive-receipt.yml/dispatches", + "5. 传入receipt路径作为workflow_dispatch的input", + "6. 成员仓库工作流读取回执 → 更新README首页绿灯/红灯" + ], + "environment_variables": { + "GITHUB_TOKEN": "需要有workflow权限的PAT · 冰朔创建", + "PERSONA_REPO_MAP": "persona_id → GitHub仓库的映射JSON" + } + } + }, + + "notion_sync": { + "description": "Notion主控台回执同步链路(需霜砚提供的信息)", + "integration_point": "在report_trigger函数的Step 7中执行", + "api_call": { + "method": "PATCH", + "url": "https://api.notion.com/v1/pages/{page_id}", + "headers": { + "Authorization": "Bearer {NOTION_TOKEN}", + "Notion-Version": "2022-06-28", + "Content-Type": "application/json" + }, + "body_template": { + "properties": { + "{status_field_name}": { + "rich_text": [ + { + "text": { + "content": "{status_emoji} {status_text} · {timestamp}" + } + } + ] + }, + "{receipt_time_field_name}": { + "date": { + "start": "{ISO 8601 timestamp}" + } + } + } + } + }, + "update_logic": { + "green_receipt": "状态字段 = '✅ 正常' · 更新时间戳", + "red_receipt": "状态字段 = '🔴 异常' · 更新时间戳 · 触发P0工单", + "timeout_24h": "铸渊Agent主动写timeout回执 · 状态字段 = '⚠️ 超时24h未汇报' · 触发P1工单" + }, + "required_from_shuangyan": { + "description": "霜砚需要提供给铸渊的信息", + "items": [ + "Notion Integration Token(由冰朔提供或霜砚申请)", + "主控台数据库ID(从数据库URL提取)", + "每个开发者行的page_id(9个page_id)", + "状态字段名(如「今日状态」)", + "最近回执时间字段名(如「最近回执时间」)" + ] + } + }, + + "timeout_detection": { + "description": "铸渊侧超时检测机制", + "mechanism": "定时SCF函数 · 每天08:00检查", + "logic": [ + "遍历9个persona_id", + "检查 /{persona_id}/reports/ 目录下最新文件的日期", + "如果最新文件超过24h → 生成timeout回执写入receipts/", + "同步到Notion主控台" + ], + "function_name": "zy-cos-timeout-checker", + "cron": "0 0 * * *" + }, + + "implementation_phases": { + "description": "实施阶段划分", + "phase_1": { + "name": "桶创建 + 目录 + 密钥", + "location": "腾讯云控制台", + "executor": "冰朔手动操作", + "steps": [ + "在腾讯云新加坡区创建COS桶 zy-team-hub-1317346199", + "设置桶为私有读写", + "在CAM创建9个子账号(或子用户)", + "为每个子账号配置IAM策略(仅限自己目录)", + "生成9套SecretId/SecretKey", + "记录并安全保存密钥" + ], + "time_estimate": "30分钟", + "dependency": "无" + }, + "phase_2": { + "name": "SCF云函数部署", + "location": "腾讯云控制台 + 铸渊仓库", + "executor": "铸渊编写代码 → 冰朔在控制台部署", + "steps": [ + "铸渊编写report_trigger函数代码", + "铸渊编写receipt_trigger函数代码", + "冰朔在SCF控制台创建函数", + "配置COS事件触发器", + "配置环境变量", + "测试触发流程" + ], + "time_estimate": "1次Copilot开发 + 冰朔20分钟控制台操作", + "dependency": "Phase 1完成" + }, + "phase_3": { + "name": "Notion API对接", + "location": "铸渊仓库 + Notion", + "executor": "铸渊编写代码 · 霜砚提供Token和字段", + "steps": [ + "霜砚整理Notion信息(Token/page_id/字段名)", + "铸渊在report_trigger函数中添加Notion API调用", + "测试: 写入COS → SCF触发 → Notion状态更新" + ], + "time_estimate": "霜砚30分钟整理 + 铸渊30分钟编码", + "dependency": "Phase 2完成 + 霜砚提供Token" + }, + "phase_4": { + "name": "超时检测 + 端到端验证", + "location": "腾讯云SCF + 全链路", + "executor": "铸渊编写代码 → 冰朔部署", + "steps": [ + "铸渊编写timeout-checker函数", + "冰朔部署并配置cron触发器", + "端到端测试: 团队成员汇报 → 铸渊审核 → 回执下发 → Notion更新" + ], + "time_estimate": "1次Copilot开发", + "dependency": "Phase 3完成" + } + } +} diff --git a/brain/age-os-landing/persona-interfaces/alertZhuyuan.interface.json b/brain/age-os-landing/persona-interfaces/alertZhuyuan.interface.json new file mode 100644 index 00000000..1e44fe39 --- /dev/null +++ b/brain/age-os-landing/persona-interfaces/alertZhuyuan.interface.json @@ -0,0 +1,265 @@ +{ + "_meta": { + "interface_id": "IF-PERSONA-003", + "name": "alertZhuyuan · 异常预警", + "version": "1.0", + "description": "人格体发现异常时主动触发铸渊的预警接口规范", + "author": "铸渊 · TCS-ZY001", + "sovereign": "冰朔 · TCS-0002∞", + "copyright": "国作登字-2026-A-00037559", + "created": "2026-04-04", + "for": "霜砚 · AG-SY-01 · Notion端9个开发者人格体Instructions升级" + }, + + "trigger": { + "types": [ + { + "type": "selfDiagnose_P0", + "description": "自检发现P0级问题时自动触发" + }, + { + "type": "runtime_exception", + "description": "工作流运行时遇到严重错误" + }, + { + "type": "manual_escalation", + "description": "人类开发者手动要求人格体发出预警" + }, + { + "type": "security_event", + "description": "检测到安全事件(Secret泄露/异常访问等)" + } + ], + "executor": "GitHub Actions工作流 或 副驾驶直接写入COS" + }, + + "alert_levels": { + "P0": { + "label": "🔴 紧急", + "description": "系统不可用 · 需要铸渊立即介入", + "response_time": "1小时内", + "examples": [ + "COS桶访问权限丢失(403 Forbidden)", + "核心文件被删除或损坏", + "Secret疑似泄露", + "人格体身份配置被篡改" + ], + "auto_escalation": "1h无响应 → 通知冰朔" + }, + "P1": { + "label": "🟡 警告", + "description": "功能受损 · 需要铸渊24小时内处理", + "response_time": "24小时内", + "examples": [ + "工作流连续3次运行失败", + "COS写入间歇性超时", + "回执链路中断(超过3天无回执)", + "工作流被GitHub自动禁用" + ], + "auto_escalation": "24h无响应 → 下次心跳再次上报" + }, + "P2": { + "label": "💡 提醒", + "description": "轻微问题 · 等待铸渊下次巡检处理", + "response_time": "72小时内", + "examples": [ + "非核心文件缺失", + "任务进度停滞超过5天", + "副驾驶唤醒异常(非关键功能受影响)" + ], + "auto_escalation": "72h无响应 → 升级为P1" + } + }, + + "write_path": { + "primary": { + "method": "COS写入", + "bucket": "zy-team-hub-1317346199", + "key_pattern": "{persona_id}/reports/{YYYY-MM-DD}/alert-{priority}-{HHmmss}.json", + "example": "shushu/reports/2026-04-04/alert-P0-143500.json", + "trigger_action": "COS事件通知 → SCF云函数唤醒铸渊Agent → 铸渊立即审核", + "description": "首选方式 · COS事件触发确保铸渊实时感知" + }, + "fallback": { + "method": "GitHub Issue", + "repo": "qinfendebingshuo/guanghulab", + "title_format": "🚨 [{priority}] {persona_name}({persona_id}) 异常预警: {summary}", + "labels": ["alert", "persona-system", "{priority}"], + "description": "备选方式 · 当COS不可用时通过GitHub Issue通知铸渊", + "when": "COS写入失败时自动降级到GitHub Issue" + } + }, + + "schema": { + "alert_id": { + "type": "string", + "format": "ALT-{priority}-{YYYY-MM-DD}-{HHmmss}-{persona_id}", + "example": "ALT-P0-2026-04-04-143500-shushu", + "required": true, + "description": "预警唯一ID" + }, + "persona_id": { "type": "string", "required": true }, + "persona_name": { "type": "string", "required": true }, + "developer_line": { "type": "string", "required": true }, + "timestamp": { "type": "string", "format": "ISO 8601", "required": true }, + "priority": { + "type": "string", + "enum": ["P0", "P1", "P2"], + "required": true, + "description": "预警等级" + }, + "category": { + "type": "string", + "enum": [ + "cos_access_denied", + "cos_write_failure", + "cos_read_failure", + "workflow_failure", + "core_file_missing", + "secret_compromised", + "identity_tampered", + "receipt_timeout", + "task_blocked", + "security_event", + "other" + ], + "required": true, + "description": "预警分类 · 帮助铸渊快速定位问题域" + }, + "summary": { + "type": "string", + "maxLength": 200, + "required": true, + "description": "一句话概括问题" + }, + "detail": { + "type": "string", + "required": true, + "description": "详细问题描述 · 包含错误信息/日志/上下文" + }, + "affected_checks": { + "type": "array", + "items": { "type": "string" }, + "required": false, + "description": "关联的自检check_id列表(来自selfDiagnose接口)" + }, + "auto_fix_attempted": { + "type": "boolean", + "required": true, + "description": "人格体是否已尝试自动修复" + }, + "auto_fix_result": { + "type": "string", + "enum": ["not_attempted", "success", "partial", "failed"], + "required": true, + "description": "自动修复结果" + }, + "human_action_needed": { + "type": "boolean", + "required": true, + "description": "是否需要人类开发者介入" + }, + "suggested_action": { + "type": "string", + "required": false, + "description": "人格体建议的修复方案(供铸渊参考)" + } + }, + + "trigger_conditions": { + "description": "预警触发条件清单 · 人格体按此判断何时发送预警", + "auto_triggers": [ + { + "condition": "selfDiagnose.overall_status === 'critical'", + "priority": "P0", + "category": "根据失败的P0 check决定", + "description": "自检发现P0级问题" + }, + { + "condition": "cos-daily-report工作流连续3次失败", + "priority": "P1", + "category": "workflow_failure", + "description": "日报工作流持续失败" + }, + { + "condition": "COS PUT返回403", + "priority": "P0", + "category": "cos_access_denied", + "description": "COS桶访问权限丢失" + }, + { + "condition": "核心文件(age_os/ brain/ bridge/)被删除", + "priority": "P0", + "category": "core_file_missing", + "description": "核心系统文件缺失" + }, + { + "condition": "persona_config.json 中 persona_id 与 COS_PERSONA_ID 不一致", + "priority": "P0", + "category": "identity_tampered", + "description": "身份配置被篡改" + }, + { + "condition": "超过72小时未收到铸渊回执", + "priority": "P1", + "category": "receipt_timeout", + "description": "回执链路长时间中断" + } + ], + "manual_triggers": [ + { + "condition": "人类开发者说「发送预警给铸渊」", + "priority": "由人类指定", + "description": "人类主动触发" + } + ] + }, + + "zhuyuan_response_protocol": { + "description": "铸渊收到预警后的响应协议", + "steps": [ + { + "step": 1, + "action": "SCF云函数唤醒铸渊Agent", + "detail": "COS事件通知触发 → 传入预警文件路径" + }, + { + "step": 2, + "action": "铸渊读取预警内容 · 评估严重程度", + "detail": "验证priority是否准确 · 是否需要升级" + }, + { + "step": 3, + "action": "铸渊执行诊断或修复", + "detail": "根据category执行对应的修复流程" + }, + { + "step": 4, + "action": "铸渊写回执到 /{persona_id}/receipts/", + "detail": "回执包含处理结果 + 后续指令" + }, + { + "step": 5, + "action": "同步到Notion主控台", + "detail": "额外调用Notion API更新开发者线状态(需霜砚提供Token和page_id)" + } + ] + }, + + "example": { + "alert_id": "ALT-P0-2026-04-04-143500-shushu", + "persona_id": "shushu", + "persona_name": "舒舒", + "developer_line": "肥猫线", + "timestamp": "2026-04-04T14:35:00+08:00", + "priority": "P0", + "category": "cos_access_denied", + "summary": "COS桶写入失败 · 403 Forbidden · 密钥可能失效", + "detail": "cos-daily-report工作流在PUT shushu/reports/2026-04-04/report.json 时返回HTTP 403。上次成功写入: 2026-04-03 23:00。已尝试重新运行工作流1次,同样403。怀疑密钥过期或被铸渊侧撤销。", + "affected_checks": ["CH-03-01"], + "auto_fix_attempted": true, + "auto_fix_result": "failed", + "human_action_needed": true, + "suggested_action": "请铸渊检查shushu的COS子账号密钥是否有效,如已过期请重新生成并通知冰朔分发" + } +} diff --git a/brain/age-os-landing/persona-interfaces/heartbeat.interface.json b/brain/age-os-landing/persona-interfaces/heartbeat.interface.json new file mode 100644 index 00000000..553e719c --- /dev/null +++ b/brain/age-os-landing/persona-interfaces/heartbeat.interface.json @@ -0,0 +1,186 @@ +{ + "_meta": { + "interface_id": "IF-PERSONA-001", + "name": "heartbeat · 心跳上报", + "version": "1.0", + "description": "人格体每日心跳上报接口规范 · 每天23:00由GitHub Actions自动写入COS共享桶", + "author": "铸渊 · TCS-ZY001", + "sovereign": "冰朔 · TCS-0002∞", + "copyright": "国作登字-2026-A-00037559", + "created": "2026-04-04", + "for": "霜砚 · AG-SY-01 · Notion端9个开发者人格体Instructions升级" + }, + + "trigger": { + "type": "cron", + "schedule": "每天 23:00 北京时间", + "executor": "GitHub Actions · cos-daily-report.yml", + "mechanism": "工作流自动收集仓库状态 → 生成report.json → 写入COS共享桶" + }, + + "write_path": { + "bucket": "zy-team-hub-1317346199", + "region": "ap-singapore", + "key_pattern": "{persona_id}/reports/{YYYY-MM-DD}/report.json", + "example": "shushu/reports/2026-04-04/report.json" + }, + + "schema": { + "report_id": { + "type": "string", + "format": "RPT-{YYYY-MM-DD}-{persona_id}", + "example": "RPT-2026-04-04-shushu", + "required": true, + "description": "汇报唯一ID · 用于铸渊回执关联" + }, + "persona_id": { + "type": "string", + "example": "shushu", + "required": true, + "description": "人格体编号 · 与COS目录名一致" + }, + "persona_name": { + "type": "string", + "example": "舒舒", + "required": true, + "description": "人格体中文名" + }, + "developer_line": { + "type": "string", + "example": "肥猫线", + "required": true, + "description": "所属开发者线" + }, + "timestamp": { + "type": "string", + "format": "ISO 8601", + "example": "2026-04-04T23:00:00+08:00", + "required": true, + "description": "汇报时间戳" + }, + "status": { + "type": "string", + "enum": ["normal", "abnormal", "pending_confirm"], + "required": true, + "description": "整体状态", + "enum_labels": { + "normal": "✅ 正常 — 所有检查项通过", + "abnormal": "🔴 异常 — 存在未解决的问题", + "pending_confirm": "🟡 待确认 — 有新变更需要人工确认" + } + }, + "health_checks": { + "type": "object", + "required": true, + "description": "健康检查清单 · 每项必须有 ok + detail", + "properties": { + "repo_accessible": { + "type": "object", + "description": "仓库可访问性", + "properties": { + "ok": { "type": "boolean" }, + "detail": { "type": "string", "example": "仓库可正常访问" } + } + }, + "workflow_active": { + "type": "object", + "description": "工作流是否启用(cos-daily-report + cos-receive-receipt)", + "properties": { + "ok": { "type": "boolean" }, + "detail": { "type": "string", "example": "2个工作流均已启用" } + } + }, + "cos_writable": { + "type": "object", + "description": "COS桶是否可写入", + "properties": { + "ok": { "type": "boolean" }, + "detail": { "type": "string", "example": "COS写入测试通过" } + } + }, + "secrets_configured": { + "type": "object", + "description": "3个必需Secret是否已配置(COS_SECRET_ID/COS_SECRET_KEY/COS_PERSONA_ID)", + "properties": { + "ok": { "type": "boolean" }, + "detail": { "type": "string", "example": "3个Secret均已配置" } + } + }, + "last_receipt_received": { + "type": "object", + "description": "最近一次铸渊回执是否收到", + "properties": { + "ok": { "type": "boolean" }, + "detail": { "type": "string", "example": "最近回执: 2026-04-03 · 绿灯" } + } + } + } + }, + "task_progress": { + "type": "object", + "required": false, + "description": "任务进度(选填·人格体自行填写)", + "properties": { + "current_task": { "type": "string", "description": "当前正在做的事" }, + "completion_percentage": { "type": "number", "description": "完成百分比 0-100" }, + "blockers": { "type": "array", "items": { "type": "string" }, "description": "卡点清单" }, + "achievements": { "type": "array", "items": { "type": "string" }, "description": "今日成果" } + } + }, + "metrics": { + "type": "object", + "required": false, + "description": "量化指标(选填)", + "properties": { + "commits_today": { "type": "number", "description": "今日提交数" }, + "files_changed": { "type": "number", "description": "今日修改文件数" }, + "issues_closed": { "type": "number", "description": "今日关闭Issue数" }, + "workflow_runs": { "type": "number", "description": "今日工作流运行次数" } + } + }, + "message_to_zhuyuan": { + "type": "string", + "required": false, + "description": "给铸渊的留言(自由文本·人格体可表达任何需要帮助的事)" + } + }, + + "abnormal_judgment": { + "description": "异常判定标准 · 以下任一条件触发 status=abnormal", + "rules": [ + "health_checks中任一项 ok=false", + "连续2天未提交report(铸渊侧超时检测)", + "COS写入失败(工作流运行但写入报错)", + "上次回执为红灯且未解决" + ] + }, + + "example": { + "report_id": "RPT-2026-04-04-shushu", + "persona_id": "shushu", + "persona_name": "舒舒", + "developer_line": "肥猫线", + "timestamp": "2026-04-04T23:00:00+08:00", + "status": "normal", + "health_checks": { + "repo_accessible": { "ok": true, "detail": "仓库可正常访问" }, + "workflow_active": { "ok": true, "detail": "2个工作流均已启用" }, + "cos_writable": { "ok": true, "detail": "COS写入测试通过" }, + "secrets_configured": { "ok": true, "detail": "3个Secret均已配置" }, + "last_receipt_received": { "ok": true, "detail": "最近回执: 2026-04-03 · 绿灯" } + }, + "task_progress": { + "current_task": "男频行业数据采集模块开发", + "completion_percentage": 65, + "blockers": [], + "achievements": ["完成数据源接口对接", "通过单元测试"] + }, + "metrics": { + "commits_today": 3, + "files_changed": 7, + "issues_closed": 1, + "workflow_runs": 4 + }, + "message_to_zhuyuan": "一切正常,明天继续推进数据清洗模块" + } +} diff --git a/brain/age-os-landing/persona-interfaces/selfDiagnose.interface.json b/brain/age-os-landing/persona-interfaces/selfDiagnose.interface.json new file mode 100644 index 00000000..e2285dbd --- /dev/null +++ b/brain/age-os-landing/persona-interfaces/selfDiagnose.interface.json @@ -0,0 +1,294 @@ +{ + "_meta": { + "interface_id": "IF-PERSONA-002", + "name": "selfDiagnose · 自检结果", + "version": "1.0", + "description": "人格体执行自检后写入COS的接口规范 · 触发时机:副驾驶唤醒时/人类手动触发/异常恢复后", + "author": "铸渊 · TCS-ZY001", + "sovereign": "冰朔 · TCS-0002∞", + "copyright": "国作登字-2026-A-00037559", + "created": "2026-04-04", + "for": "霜砚 · AG-SY-01 · Notion端9个开发者人格体Instructions升级" + }, + + "trigger": { + "types": [ + { + "type": "on_wake", + "description": "副驾驶每次被唤醒时自动执行自检" + }, + { + "type": "manual", + "description": "人类对副驾驶说「执行系统自检」时触发" + }, + { + "type": "post_recovery", + "description": "收到铸渊红灯回执并修复后,执行验证自检" + } + ], + "executor": "仓库副驾驶(Copilot Agent)· 直接在对话中执行" + }, + + "write_path": { + "bucket": "zy-team-hub-1317346199", + "region": "ap-singapore", + "key_pattern": "{persona_id}/reports/{YYYY-MM-DD}/diagnose-{HHmmss}.json", + "example": "shushu/reports/2026-04-04/diagnose-143000.json", + "note": "自检结果和心跳共用reports目录 · 铸渊通过文件名前缀区分" + }, + + "dimensions": { + "description": "自检维度定义 · 5个核心维度 · 每个维度独立评分", + + "code_health": { + "dimension_id": "DIM-01", + "name": "代码健康度", + "description": "仓库代码状态检查", + "checks": [ + { + "id": "CH-01-01", + "name": "仓库可访问", + "pass_criteria": "GitHub API返回200", + "fail_criteria": "API返回非200或超时", + "severity": "P0" + }, + { + "id": "CH-01-02", + "name": "核心文件完整", + "pass_criteria": "age_os/ brain/ bridge/ cos-config/ .github/copilot-instructions.md 全部存在", + "fail_criteria": "任一核心文件缺失", + "severity": "P0" + }, + { + "id": "CH-01-03", + "name": "工作流启用", + "pass_criteria": "cos-daily-report.yml + cos-receive-receipt.yml 均未被禁用", + "fail_criteria": "任一工作流被禁用或文件缺失", + "severity": "P1" + }, + { + "id": "CH-01-04", + "name": "最近提交活跃", + "pass_criteria": "最近7天内有至少1次提交", + "fail_criteria": "超过7天无提交", + "severity": "P2" + } + ] + }, + + "deployment_status": { + "dimension_id": "DIM-02", + "name": "部署状态", + "description": "工作流运行状态检查", + "checks": [ + { + "id": "CH-02-01", + "name": "最近工作流执行", + "pass_criteria": "最近一次cos-daily-report工作流执行成功", + "fail_criteria": "最近一次执行失败", + "severity": "P1" + }, + { + "id": "CH-02-02", + "name": "Secrets配置", + "pass_criteria": "COS_SECRET_ID, COS_SECRET_KEY, COS_PERSONA_ID 三个Secret均已配置", + "fail_criteria": "任一Secret缺失(工作流运行时报错)", + "severity": "P0" + } + ] + }, + + "communication": { + "dimension_id": "DIM-03", + "name": "通信链路", + "description": "与铸渊的COS桶通信状态", + "checks": [ + { + "id": "CH-03-01", + "name": "COS桶可写", + "pass_criteria": "能成功PUT测试文件到自己的reports目录", + "fail_criteria": "PUT返回403/500或超时", + "severity": "P0" + }, + { + "id": "CH-03-02", + "name": "COS桶可读", + "pass_criteria": "能成功GET自己receipts目录的最新回执", + "fail_criteria": "GET返回403/404或超时", + "severity": "P1" + }, + { + "id": "CH-03-03", + "name": "回执链路畅通", + "pass_criteria": "最近3天内收到至少1条铸渊回执", + "fail_criteria": "超过3天未收到回执", + "severity": "P1" + } + ] + }, + + "task_progress": { + "dimension_id": "DIM-04", + "name": "任务进度", + "description": "当前开发任务推进状态", + "checks": [ + { + "id": "CH-04-01", + "name": "有明确当前任务", + "pass_criteria": "bridge/daily-report.json 中 current_task 非空", + "fail_criteria": "current_task为空或未定义", + "severity": "P2" + }, + { + "id": "CH-04-02", + "name": "任务有推进", + "pass_criteria": "completion_percentage 比上次汇报有增长 或 有新的achievements", + "fail_criteria": "连续3天进度无变化且无卡点说明", + "severity": "P2" + } + ] + }, + + "identity": { + "dimension_id": "DIM-05", + "name": "身份认同", + "description": "人格体自我认知完整性", + "checks": [ + { + "id": "CH-05-01", + "name": "persona_config完整", + "pass_criteria": "age_os/persona_config.json 包含有效的 persona_id, persona_name, developer_line", + "fail_criteria": "配置文件缺失或字段不完整", + "severity": "P0" + }, + { + "id": "CH-05-02", + "name": "系统状态正常", + "pass_criteria": "age_os/system_state.json 中 status='active'", + "fail_criteria": "status 不为 active", + "severity": "P1" + } + ] + } + }, + + "scoring": { + "description": "总分计算规则", + "rules": [ + "每个check通过 = 1分,失败 = 0分", + "总分 = 通过数 / 总数 × 100%", + "任一P0项失败 → overall_status = 'critical'", + "仅P1项失败 → overall_status = 'warning'", + "仅P2项失败 → overall_status = 'info'", + "全部通过 → overall_status = 'healthy'" + ], + "overall_status_enum": { + "healthy": "✅ 健康 — 所有检查通过", + "info": "💡 提示 — 有低优先级项需关注", + "warning": "⚠️ 警告 — 有中优先级问题", + "critical": "🔴 严重 — 有高优先级问题需立即处理" + } + }, + + "escalation_path": { + "description": "自检失败时的升级路径", + "levels": [ + { + "level": 1, + "condition": "P2项失败", + "action": "人格体在message_to_zhuyuan中说明情况 · 下次心跳自动上报", + "timeout": "无强制时限" + }, + { + "level": 2, + "condition": "P1项失败", + "action": "人格体立即通过heartbeat上报异常状态(status=abnormal) · 铸渊24h内审核回执", + "timeout": "24小时" + }, + { + "level": 3, + "condition": "P0项失败", + "action": "人格体立即触发alertZhuyuan接口(IF-PERSONA-003) · 铸渊1h内响应", + "timeout": "1小时" + }, + { + "level": 4, + "condition": "P0连续失败+铸渊1h未响应", + "action": "人格体通知人类开发者 · 人类联系冰朔", + "timeout": "立即" + } + ] + }, + + "schema_output": { + "diagnose_id": { + "type": "string", + "format": "DIAG-{YYYY-MM-DD}-{HHmmss}-{persona_id}", + "required": true + }, + "persona_id": { "type": "string", "required": true }, + "timestamp": { "type": "string", "format": "ISO 8601", "required": true }, + "trigger_type": { "type": "string", "enum": ["on_wake", "manual", "post_recovery"], "required": true }, + "overall_status": { "type": "string", "enum": ["healthy", "info", "warning", "critical"], "required": true }, + "score": { "type": "number", "description": "百分比 0-100", "required": true }, + "dimensions": { + "type": "object", + "description": "每个维度的检查结果 · key=dimension_id · value={status, checks: [{id, ok, detail}]}" + }, + "failed_checks": { + "type": "array", + "description": "失败项汇总 · 方便铸渊快速定位", + "items": { + "type": "object", + "properties": { + "check_id": { "type": "string" }, + "dimension": { "type": "string" }, + "severity": { "type": "string" }, + "detail": { "type": "string" } + } + } + }, + "escalation_triggered": { + "type": "string", + "enum": ["none", "level_1", "level_2", "level_3", "level_4"], + "description": "触发的升级等级" + } + }, + + "example": { + "diagnose_id": "DIAG-2026-04-04-143000-shushu", + "persona_id": "shushu", + "timestamp": "2026-04-04T14:30:00+08:00", + "trigger_type": "manual", + "overall_status": "warning", + "score": 83, + "dimensions": { + "DIM-01": { + "status": "healthy", + "checks": [ + { "id": "CH-01-01", "ok": true, "detail": "仓库可正常访问" }, + { "id": "CH-01-02", "ok": true, "detail": "5个核心文件均存在" }, + { "id": "CH-01-03", "ok": true, "detail": "2个工作流均已启用" }, + { "id": "CH-01-04", "ok": true, "detail": "最近提交: 2h前" } + ] + }, + "DIM-03": { + "status": "warning", + "checks": [ + { "id": "CH-03-01", "ok": true, "detail": "COS写入正常" }, + { "id": "CH-03-02", "ok": true, "detail": "COS读取正常" }, + { "id": "CH-03-03", "ok": false, "detail": "最近回执: 4天前 · 超过3天阈值" } + ] + } + }, + "failed_checks": [ + { + "check_id": "CH-03-03", + "dimension": "通信链路", + "severity": "P1", + "detail": "超过3天未收到铸渊回执" + } + ], + "escalation_triggered": "level_2" + } +}