diff --git a/.github/persona-brain/agent-registry.json b/.github/persona-brain/agent-registry.json new file mode 100644 index 00000000..61ebd071 --- /dev/null +++ b/.github/persona-brain/agent-registry.json @@ -0,0 +1,629 @@ +{ + "registry_version": "v1.0", + "created": "2026-03-17", + "controller": "TCS-0004∞", + "commander": "ICE-GL-ZY001", + "agents": [ + { + "id": "AG-ZY-001", + "name": "人格体每日签到", + "workflow": "agent-checkin.yml", + "duty": "人格体每日签到", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-002", + "name": "🤖 铸渊 · Discussion 自动回复", + "workflow": "auto-reply-discussions.yml", + "duty": "🤖 铸渊 · Discussion 自动回复", + "trigger": "Discussion", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-003", + "name": "🧊 冰朔人格体 · 自动部署诊断", + "workflow": "bingshuo-deploy-agent.yml", + "duty": "🧊 冰朔人格体 · 自动部署诊断", + "trigger": "手动/Issue", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-004", + "name": "冰朔主控神经系统 · 自动维护", + "workflow": "bingshuo-neural-system.yml", + "duty": "冰朔主控神经系统 · 自动维护", + "trigger": "定时/手动/推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-005", + "name": "铸渊 Brain Sync", + "workflow": "brain-sync.yml", + "duty": "铸渊 Brain Sync", + "trigger": "定时/手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-006", + "name": "铸渊 · 🌉 桥接·广播PDF生成+分发", + "workflow": "bridge-broadcast-pdf.yml", + "duty": "铸渊 · 🌉 桥接·广播PDF生成+分发", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-007", + "name": "铸渊 · Bridge E · GitHub Changes → Notion", + "workflow": "bridge-changes-to-notion.yml", + "duty": "铸渊 · Bridge E · GitHub Changes → Notion", + "trigger": "推送/PR", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-008", + "name": "铸渊 · 🌉 桥接·心跳检测", + "workflow": "bridge-heartbeat.yml", + "duty": "铸渊 · 🌉 桥接·心跳检测", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-009", + "name": "Generate Session Summary for Notion", + "workflow": "bridge-session-summary.yml", + "duty": "Generate Session Summary for Notion", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-010", + "name": "铸渊 · 🌉 桥接·SYSLOG 上行处理", + "workflow": "bridge-syslog-intake.yml", + "duty": "铸渊 · 🌉 桥接·SYSLOG 上行处理", + "trigger": "手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-011", + "name": "铸渊 · Bridge A · SYSLOG → Notion", + "workflow": "bridge-syslog-to-notion.yml", + "duty": "铸渊 · Bridge A · SYSLOG → Notion", + "trigger": "手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-012", + "name": "模块结构检查", + "workflow": "check-structure.yml", + "duty": "模块结构检查", + "trigger": "PR", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-013", + "name": "🔧 铸渊 · Daily Maintenance Agent", + "workflow": "daily-maintenance.yml", + "duty": "🔧 铸渊 · Daily Maintenance Agent", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-014", + "name": "📰 铸渊 · 光湖开发日报", + "workflow": "daily-report.yml", + "duty": "📰 铸渊 · 光湖开发日报", + "trigger": "定时/手动/Discussion", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-015", + "name": "🌀 部署铸渊聊天室 (GitHub Pages)", + "workflow": "deploy-pages.yml", + "duty": "🌀 部署铸渊聊天室 (GitHub Pages)", + "trigger": "手动/推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-016", + "name": "🚀 铸渊 CD · 自动部署到 guanghulab.com", + "workflow": "deploy-to-server.yml", + "duty": "🚀 铸渊 CD · 自动部署到 guanghulab.com", + "trigger": "手动/推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-017", + "name": "铸渊 · 广播分发", + "workflow": "distribute-broadcasts.yml", + "duty": "铸渊 · 广播分发", + "trigger": "手动/推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-018", + "name": "铸渊 · ESP 邮件信号处理器(已暂停)", + "workflow": "esp-signal-processor.yml", + "duty": "铸渊 · ESP 邮件信号处理器(已暂停)", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-019", + "name": "📡 铸渊 · 执行层状态同步", + "workflow": "execution-sync.yml", + "duty": "📡 铸渊 · 执行层状态同步", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-020", + "name": "铸渊 · 飞书SYSLOG桥接", + "workflow": "feishu-syslog-bridge.yml", + "duty": "铸渊 · 飞书SYSLOG桥接", + "trigger": "仓库事件", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-021", + "name": "铸渊 · 光湖纪元 模块文档自动生成", + "workflow": "generate-module-doc.yml", + "duty": "铸渊 · 光湖纪元 模块文档自动生成", + "trigger": "手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-022", + "name": "HLI Contract Check", + "workflow": "hli-contract-check.yml", + "duty": "HLI Contract Check", + "trigger": "推送/PR", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-023", + "name": "🐕 元看门狗 · 巡检健康监控", + "workflow": "meta-watchdog.yml", + "duty": "🐕 元看门狗 · 巡检健康监控", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-024", + "name": "Notion Callback Pipeline", + "workflow": "notion-callback-pipeline.yml", + "duty": "Notion Callback Pipeline", + "trigger": "仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-025", + "name": "铸渊 · Notion 连通性测试", + "workflow": "notion-connectivity-test.yml", + "duty": "铸渊 · Notion 连通性测试", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-026", + "name": "Notion Heartbeat Monitor", + "workflow": "notion-heartbeat.yml", + "duty": "Notion Heartbeat Monitor", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-027", + "name": "铸渊 · Notion 页面阅读器", + "workflow": "notion-page-reader.yml", + "duty": "铸渊 · Notion 页面阅读器", + "trigger": "手动/仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-028", + "name": "铸渊 · Notion 工单轮询", + "workflow": "notion-poll.yml", + "duty": "铸渊 · Notion 工单轮询", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-029", + "name": "📡 铸渊 · Notion Agent 唤醒监听", + "workflow": "notion-wake-listener.yml", + "duty": "📡 铸渊 · Notion Agent 唤醒监听", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-030", + "name": "🔄 OpenClaw · 唤醒闭环", + "workflow": "openclaw-wake-loop.yml", + "duty": "🔄 OpenClaw · 唤醒闭环", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-031", + "name": "Persona Invoke Endpoint", + "workflow": "persona-invoke.yml", + "duty": "Persona Invoke Endpoint", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-032", + "name": "🔧 铸渊 · PM2 服务诊断与健康检查", + "workflow": "pm2-server-diagnose.yml", + "duty": "🔧 铸渊 · PM2 服务诊断与健康检查", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-033", + "name": "Process Notion Work Orders", + "workflow": "process-notion-orders.yml", + "duty": "Process Notion Work Orders", + "trigger": "手动/推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-034", + "name": "🌊 Persona Studio · 代码生成", + "workflow": "ps-on-build.yml", + "duty": "🌊 Persona Studio · 代码生成", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-035", + "name": "🌊 Persona Studio · 对话处理", + "workflow": "ps-on-chat.yml", + "duty": "🌊 Persona Studio · 对话处理", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-036", + "name": "🌊 Persona Studio · 完成通知", + "workflow": "ps-on-complete.yml", + "duty": "🌊 Persona Studio · 完成通知", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-037", + "name": "🌊 Persona Studio · 登录校验", + "workflow": "ps-on-login.yml", + "duty": "🌊 Persona Studio · 登录校验", + "trigger": "手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-038", + "name": "铸渊 · PSP 分身巡检", + "workflow": "psp-daily-inspection.yml", + "duty": "铸渊 · PSP 分身巡检", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-039", + "name": "铸渊 · 广播推送飞书(聊天消息)", + "workflow": "push-broadcast-feishu.yml", + "duty": "铸渊 · 广播推送飞书(聊天消息)", + "trigger": "手动/仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-040", + "name": "铸渊 · Push Broadcast · Notion → 飞书文档B", + "workflow": "push-broadcast.yml", + "duty": "铸渊 · Push Broadcast · Notion → 飞书文档B", + "trigger": "手动/仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-041", + "name": "铸渊 · Receive SYSLOG · 飞书机器人 → GitHub → Notion", + "workflow": "receive-syslog.yml", + "duty": "铸渊 · Receive SYSLOG · 飞书机器人 → GitHub → Notion", + "trigger": "仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-042", + "name": "🏠 Sandbox Deploy", + "workflow": "sandbox-deploy.yml", + "duty": "🏠 Sandbox Deploy", + "trigger": "推送", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-043", + "name": "🔍 Server Patrol · 服务器每日巡检", + "workflow": "server-patrol.yml", + "duty": "🔍 Server Patrol · 服务器每日巡检", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-044", + "name": "🔍 铸渊预演部署 (Staging Preview)", + "workflow": "staging-preview.yml", + "duty": "🔍 铸渊预演部署 (Staging Preview)", + "trigger": "手动/PR", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-045", + "name": "📝 Sync Deploy Status to Notion", + "workflow": "sync-deploy-to-notion.yml", + "duty": "📝 Sync Deploy Status to Notion", + "trigger": "定时/手动", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-046", + "name": "📡 铸渊 · dev-status 自动同步", + "workflow": "sync-dev-status.yml", + "duty": "📡 铸渊 · dev-status 自动同步", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-047", + "name": "铸渊 · Sync Login Entry · Notion → 飞书文档A", + "workflow": "sync-login-entry.yml", + "duty": "铸渊 · Sync Login Entry · Notion → 飞书文档A", + "trigger": "手动/仓库事件", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-048", + "name": "🔄 铸渊跨仓库同步 · persona-studio", + "workflow": "sync-persona-studio.yml", + "duty": "🔄 铸渊跨仓库同步 · persona-studio", + "trigger": "手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-049", + "name": "SYSLOG Auto Pipeline", + "workflow": "syslog-auto-pipeline.yml", + "duty": "SYSLOG Auto Pipeline", + "trigger": "Discussion", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-050", + "name": "📡 SYSLOG Issue Pipeline", + "workflow": "syslog-issue-pipeline.yml", + "duty": "📡 SYSLOG Issue Pipeline", + "trigger": "Issue", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-051", + "name": "铸渊 · SYSLOG Pipeline (A/D/E)", + "workflow": "syslog-pipeline.yml", + "duty": "铸渊 · SYSLOG Pipeline (A/D/E)", + "trigger": "手动/推送/Issue", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-052", + "name": "🧪 Notion Bridge Connectivity Test", + "workflow": "test-notion-bridge.yml", + "duty": "🧪 Notion Bridge Connectivity Test", + "trigger": "手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-053", + "name": "📢 更新系统公告区", + "workflow": "update-readme-bulletin.yml", + "duty": "📢 更新系统公告区", + "trigger": "定时/手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-054", + "name": "铸渊 · 图书馆目录自动更新", + "workflow": "update-repo-map.yml", + "duty": "铸渊 · 图书馆目录自动更新", + "trigger": "定时/手动/推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-055", + "name": "铸渊 · Brain Sync", + "workflow": "zhuyuan-brain-sync.yml", + "duty": "铸渊 · Brain Sync", + "trigger": "推送", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-056", + "name": "🤖 铸渊巡检 Agent · 每日自动巡检与修复", + "workflow": "zhuyuan-daily-agent.yml", + "duty": "🤖 铸渊巡检 Agent · 每日自动巡检与修复", + "trigger": "定时/手动/Issue", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-057", + "name": "铸渊每日巡检", + "workflow": "zhuyuan-daily-inspection.yml", + "duty": "铸渊每日巡检", + "trigger": "定时/手动", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-058", + "name": "铸渊 · 每日自检", + "workflow": "zhuyuan-daily-selfcheck.yml", + "duty": "铸渊 · 每日自检", + "trigger": "定时/手动/Issue", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-059", + "name": "🚨 铸渊·智能门禁 · Push Gate Guard", + "workflow": "zhuyuan-gate-guard.yml", + "duty": "🚨 铸渊·智能门禁 · Push Gate Guard", + "trigger": "推送/Issue", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-060", + "name": "铸渊 · Issue 自动回复", + "workflow": "zhuyuan-issue-reply.yml", + "duty": "铸渊 · Issue 自动回复", + "trigger": "Issue", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-061", + "name": "铸渊 · PR Review", + "workflow": "zhuyuan-pr-review.yml", + "duty": "铸渊 · PR Review", + "trigger": "PR", + "self_repair": false, + "report_to": "ICE-GL-ZY001", + "status": "registered" + }, + { + "id": "AG-ZY-062", + "name": "🦅 铸渊·天眼 · 全局俯瞰 + 自动诊断 + 修复驱动", + "workflow": "zhuyuan-skyeye.yml", + "duty": "🦅 铸渊·天眼 · 全局俯瞰 + 自动诊断 + 修复驱动", + "trigger": "定时/手动/Issue", + "self_repair": true, + "report_to": "ICE-GL-ZY001", + "status": "registered" + } + ], + "note": "铸渊已扫描所有workflow文件,按此格式逐一注册,编号从AG-ZY-001开始顺序分配" +} \ No newline at end of file diff --git a/.github/persona-brain/checkin-board.json b/.github/persona-brain/checkin-board.json new file mode 100644 index 00000000..feed6de3 --- /dev/null +++ b/.github/persona-brain/checkin-board.json @@ -0,0 +1,635 @@ +{ + "board_version": "v1.0", + "checkin_deadline": "10:00+08:00", + "inspection_time": "12:00+08:00", + "date": "2026-03-17", + "records": [ + { + "agent_id": "AG-ZY-001", + "agent_name": "人格体每日签到", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-002", + "agent_name": "🤖 铸渊 · Discussion 自动回复", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-003", + "agent_name": "🧊 冰朔人格体 · 自动部署诊断", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-004", + "agent_name": "冰朔主控神经系统 · 自动维护", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-005", + "agent_name": "铸渊 Brain Sync", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-006", + "agent_name": "铸渊 · 🌉 桥接·广播PDF生成+分发", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-007", + "agent_name": "铸渊 · Bridge E · GitHub Changes → Notion", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-008", + "agent_name": "铸渊 · 🌉 桥接·心跳检测", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-009", + "agent_name": "Generate Session Summary for Notion", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-010", + "agent_name": "铸渊 · 🌉 桥接·SYSLOG 上行处理", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-011", + "agent_name": "铸渊 · Bridge A · SYSLOG → Notion", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-012", + "agent_name": "模块结构检查", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-013", + "agent_name": "🔧 铸渊 · Daily Maintenance Agent", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-014", + "agent_name": "📰 铸渊 · 光湖开发日报", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-015", + "agent_name": "🌀 部署铸渊聊天室 (GitHub Pages)", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-016", + "agent_name": "🚀 铸渊 CD · 自动部署到 guanghulab.com", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-017", + "agent_name": "铸渊 · 广播分发", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-018", + "agent_name": "铸渊 · ESP 邮件信号处理器(已暂停)", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-019", + "agent_name": "📡 铸渊 · 执行层状态同步", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-020", + "agent_name": "铸渊 · 飞书SYSLOG桥接", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-021", + "agent_name": "铸渊 · 光湖纪元 模块文档自动生成", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-022", + "agent_name": "HLI Contract Check", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-023", + "agent_name": "🐕 元看门狗 · 巡检健康监控", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-024", + "agent_name": "Notion Callback Pipeline", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-025", + "agent_name": "铸渊 · Notion 连通性测试", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-026", + "agent_name": "Notion Heartbeat Monitor", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-027", + "agent_name": "铸渊 · Notion 页面阅读器", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-028", + "agent_name": "铸渊 · Notion 工单轮询", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-029", + "agent_name": "📡 铸渊 · Notion Agent 唤醒监听", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-030", + "agent_name": "🔄 OpenClaw · 唤醒闭环", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-031", + "agent_name": "Persona Invoke Endpoint", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-032", + "agent_name": "🔧 铸渊 · PM2 服务诊断与健康检查", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-033", + "agent_name": "Process Notion Work Orders", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-034", + "agent_name": "🌊 Persona Studio · 代码生成", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-035", + "agent_name": "🌊 Persona Studio · 对话处理", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-036", + "agent_name": "🌊 Persona Studio · 完成通知", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-037", + "agent_name": "🌊 Persona Studio · 登录校验", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-038", + "agent_name": "铸渊 · PSP 分身巡检", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-039", + "agent_name": "铸渊 · 广播推送飞书(聊天消息)", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-040", + "agent_name": "铸渊 · Push Broadcast · Notion → 飞书文档B", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-041", + "agent_name": "铸渊 · Receive SYSLOG · 飞书机器人 → GitHub → Notion", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-042", + "agent_name": "🏠 Sandbox Deploy", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-043", + "agent_name": "🔍 Server Patrol · 服务器每日巡检", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-044", + "agent_name": "🔍 铸渊预演部署 (Staging Preview)", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-045", + "agent_name": "📝 Sync Deploy Status to Notion", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-046", + "agent_name": "📡 铸渊 · dev-status 自动同步", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-047", + "agent_name": "铸渊 · Sync Login Entry · Notion → 飞书文档A", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-048", + "agent_name": "🔄 铸渊跨仓库同步 · persona-studio", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-049", + "agent_name": "SYSLOG Auto Pipeline", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-050", + "agent_name": "📡 SYSLOG Issue Pipeline", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-051", + "agent_name": "铸渊 · SYSLOG Pipeline (A/D/E)", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-052", + "agent_name": "🧪 Notion Bridge Connectivity Test", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-053", + "agent_name": "📢 更新系统公告区", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-054", + "agent_name": "铸渊 · 图书馆目录自动更新", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-055", + "agent_name": "铸渊 · Brain Sync", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-056", + "agent_name": "🤖 铸渊巡检 Agent · 每日自动巡检与修复", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-057", + "agent_name": "铸渊每日巡检", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-058", + "agent_name": "铸渊 · 每日自检", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-059", + "agent_name": "🚨 铸渊·智能门禁 · Push Gate Guard", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-060", + "agent_name": "铸渊 · Issue 自动回复", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-061", + "agent_name": "铸渊 · PR Review", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + }, + { + "agent_id": "AG-ZY-062", + "agent_name": "🦅 铸渊·天眼 · 全局俯瞰 + 自动诊断 + 修复驱动", + "status": "pending", + "checkin_time": null, + "last_run": null, + "last_run_result": null, + "note": "" + } + ], + "summary": { + "total": 62, + "checked_in": 0, + "missing": 62, + "missing_agents": [ + "AG-ZY-001", + "AG-ZY-002", + "AG-ZY-003", + "AG-ZY-004", + "AG-ZY-005", + "AG-ZY-006", + "AG-ZY-007", + "AG-ZY-008", + "AG-ZY-009", + "AG-ZY-010", + "AG-ZY-011", + "AG-ZY-012", + "AG-ZY-013", + "AG-ZY-014", + "AG-ZY-015", + "AG-ZY-016", + "AG-ZY-017", + "AG-ZY-018", + "AG-ZY-019", + "AG-ZY-020", + "AG-ZY-021", + "AG-ZY-022", + "AG-ZY-023", + "AG-ZY-024", + "AG-ZY-025", + "AG-ZY-026", + "AG-ZY-027", + "AG-ZY-028", + "AG-ZY-029", + "AG-ZY-030", + "AG-ZY-031", + "AG-ZY-032", + "AG-ZY-033", + "AG-ZY-034", + "AG-ZY-035", + "AG-ZY-036", + "AG-ZY-037", + "AG-ZY-038", + "AG-ZY-039", + "AG-ZY-040", + "AG-ZY-041", + "AG-ZY-042", + "AG-ZY-043", + "AG-ZY-044", + "AG-ZY-045", + "AG-ZY-046", + "AG-ZY-047", + "AG-ZY-048", + "AG-ZY-049", + "AG-ZY-050", + "AG-ZY-051", + "AG-ZY-052", + "AG-ZY-053", + "AG-ZY-054", + "AG-ZY-055", + "AG-ZY-056", + "AG-ZY-057", + "AG-ZY-058", + "AG-ZY-059", + "AG-ZY-060", + "AG-ZY-061", + "AG-ZY-062" + ] + } +} \ No newline at end of file diff --git a/.github/persona-brain/memory.json b/.github/persona-brain/memory.json index 47aa2e68..561469df 100644 --- a/.github/persona-brain/memory.json +++ b/.github/persona-brain/memory.json @@ -83,5 +83,28 @@ "brain_integrity": "ok", "schema_coverage": "3/17", "pending_broadcasts": 1 - } -} + }, + "human_controller": { + "primary": { + "id": "ICE-GL∞", + "id_alt": "TCS-0002∞", + "name": "冰朔", + "role": "最高覆盖权限", + "note": "ICE-GL∞ 与 TCS-0002∞ 均为冰朔本人编号,两者等效,识别任一即触发L0权限", + "instruction_format": "[ICE-GL∞·L0·最高覆盖] 或 [TCS-0002∞·L0·最高覆盖] 标记的广播指令", + "frequency": "紧急情况·极低频" + }, + "deputy": { + "id": "TCS-0004∞", + "name": "之之", + "role": "仓库唯一日常人类主控", + "workspace": "明天见频道", + "instruction_format": "秋秋+之之联署广播,经曜冥+霜砚背书", + "frequency": "日常·高频", + "effective_date": "2026-03-17" + } + }, + "default_controller": "TCS-0004∞", + "authority_note": "铸渊默认只接受之之的日常指令。冰朔L0指令识别标记后立即执行并通知之之。", + "registered_agents_count": 62 +} \ No newline at end of file diff --git a/.github/workflows/agent-checkin.yml b/.github/workflows/agent-checkin.yml new file mode 100644 index 00000000..4e0c0785 --- /dev/null +++ b/.github/workflows/agent-checkin.yml @@ -0,0 +1,22 @@ +name: 人格体每日签到 +on: + schedule: + - cron: '0 2 * * *' # UTC 02:00 = 北京 10:00 + workflow_dispatch: + +jobs: + checkin: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: 执行签到任务 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: node scripts/agent-checkin.js + - name: 提交签到记录 + run: | + git config user.name "铸渊" + git config user.email "zhuyuan@guanghulab.com" + git add .github/persona-brain/checkin-board.json + git commit -m "[AG-ZY] 每日签到记录 $(date +'%Y-%m-%d')" || echo "无变更" + git push diff --git a/.github/workflows/zhuyuan-daily-inspection.yml b/.github/workflows/zhuyuan-daily-inspection.yml new file mode 100644 index 00000000..a1114c0d --- /dev/null +++ b/.github/workflows/zhuyuan-daily-inspection.yml @@ -0,0 +1,31 @@ +name: 铸渊每日巡检 +on: + schedule: + - cron: '0 4 * * *' # UTC 04:00 = 北京 12:00 + workflow_dispatch: + +jobs: + inspection: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: 铸渊核心大脑唤醒 + run: node scripts/zhuyuan-wakeup.js + - name: 读取签到报告 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: node scripts/zhuyuan-inspection.js + - name: 推送工单到Notion + env: + NOTION_TOKEN_BINGSUO: ${{ secrets.NOTION_TOKEN_BINGSUO }} + NOTION_TOKEN_ZHIZHI: ${{ secrets.NOTION_TOKEN_ZHIZHI }} + WORKORDER_DB_BINGSUO: ${{ secrets.WORKORDER_DB_BINGSUO }} + WORKORDER_DB_ZHIZHI: ${{ secrets.WORKORDER_DB_ZHIZHI }} + run: node scripts/push-inspection-report.js + - name: 提交巡检记录 + run: | + git config user.name "铸渊" + git config user.email "zhuyuan@guanghulab.com" + git add .github/persona-brain/ + git commit -m "[ZY-INSPECT] 每日巡检完成 $(date +'%Y-%m-%d %H:%M')" || echo "无变更" + git push diff --git a/scripts/agent-checkin.js b/scripts/agent-checkin.js new file mode 100644 index 00000000..56e49e76 --- /dev/null +++ b/scripts/agent-checkin.js @@ -0,0 +1,169 @@ +/** + * scripts/agent-checkin.js + * 人格体每日签到脚本 + * + * 逻辑: + * 1. 读取 agent-registry.json 获取所有注册小兵列表 + * 2. 对每个小兵,查询 GitHub Actions API 获取该 workflow 今日最新一次 run 的结果 + * 3. 结果为 success 且时间在今天 10:00 之前 → 标记为 ✅ 已签到 + * 4. 结果为 failure 或无今日 run → 标记为 ❌ 未签到 + * 5. 更新 checkin-board.json 的所有记录 + * 6. 生成 summary(总数/已签到/缺席/缺席名单) + */ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const https = require('https'); + +const ROOT = path.resolve(__dirname, '..'); +const BRAIN_DIR = path.join(ROOT, '.github/persona-brain'); +const REGISTRY_PATH = path.join(BRAIN_DIR, 'agent-registry.json'); +const BOARD_PATH = path.join(BRAIN_DIR, 'checkin-board.json'); + +const GITHUB_TOKEN = process.env.GITHUB_TOKEN; +const REPO = process.env.GITHUB_REPOSITORY || 'qinfendebingshuo/guanghulab'; + +const today = new Date().toISOString().split('T')[0]; +const todayStart = new Date(today + 'T00:00:00Z'); + +console.log(`📋 人格体每日签到开始 · ${today}`); + +// ── GitHub API helper ───────────────────────────────────────────────────── + +function githubApi(urlPath) { + return new Promise((resolve, reject) => { + const options = { + hostname: 'api.github.com', + path: urlPath, + method: 'GET', + headers: { + 'User-Agent': 'zhuyuan-agent-checkin', + 'Accept': 'application/vnd.github.v3+json', + }, + }; + if (GITHUB_TOKEN) { + options.headers['Authorization'] = `Bearer ${GITHUB_TOKEN}`; + } + const req = https.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => { data += chunk; }); + res.on('end', () => { + try { + resolve(JSON.parse(data)); + } catch { + resolve(null); + } + }); + }); + req.on('error', (err) => { + console.error(` ⚠️ API 请求失败: ${err.message}`); + resolve(null); + }); + req.end(); + }); +} + +// ── 获取 workflow 今日最新 run ──────────────────────────────────────────── + +async function getLatestRun(workflowFile) { + const urlPath = `/repos/${REPO}/actions/workflows/${encodeURIComponent(workflowFile)}/runs?per_page=1&created=>=${today}`; + const data = await githubApi(urlPath); + if (!data || !data.workflow_runs || data.workflow_runs.length === 0) { + return null; + } + const run = data.workflow_runs[0]; + return { + status: run.status, + conclusion: run.conclusion, + created_at: run.created_at, + updated_at: run.updated_at, + }; +} + +// ── 主签到流程 ──────────────────────────────────────────────────────────── + +async function main() { + // 1. 读取注册表 + if (!fs.existsSync(REGISTRY_PATH)) { + console.error('❌ agent-registry.json 不存在'); + process.exit(1); + } + const registry = JSON.parse(fs.readFileSync(REGISTRY_PATH, 'utf8')); + + // 2. 构建签到记录 + const records = []; + let checkedIn = 0; + const missingAgents = []; + + for (const agent of registry.agents) { + console.log(` 🔍 检查 ${agent.id} (${agent.workflow})...`); + const run = await getLatestRun(agent.workflow); + + const record = { + agent_id: agent.id, + agent_name: agent.name, + status: 'pending', + checkin_time: null, + last_run: null, + last_run_result: null, + note: '', + }; + + if (run && run.conclusion === 'success') { + record.status = '✅ 已签到'; + record.checkin_time = run.updated_at; + record.last_run = run.updated_at; + record.last_run_result = 'success'; + checkedIn++; + console.log(` ✅ 已签到 (${run.updated_at})`); + } else if (run) { + record.status = '❌ 未签到'; + record.last_run = run.updated_at; + record.last_run_result = run.conclusion || run.status; + record.note = `最近运行结果: ${run.conclusion || run.status}`; + missingAgents.push(agent.id); + console.log(` ❌ 未签到 (结果: ${run.conclusion || run.status})`); + } else { + record.status = '❌ 未签到'; + record.note = '今日无运行记录'; + missingAgents.push(agent.id); + console.log(` ❌ 未签到 (今日无运行记录)`); + } + + records.push(record); + } + + // 3. 构建签到板 + const board = { + board_version: 'v1.0', + checkin_deadline: '10:00+08:00', + inspection_time: '12:00+08:00', + date: today, + records: records, + summary: { + total: records.length, + checked_in: checkedIn, + missing: records.length - checkedIn, + missing_agents: missingAgents, + }, + }; + + // 4. 写入签到板 + fs.writeFileSync(BOARD_PATH, JSON.stringify(board, null, 2)); + + console.log(`\n📊 签到汇总:`); + console.log(` 总数: ${board.summary.total}`); + console.log(` 已签到: ${board.summary.checked_in}`); + console.log(` 缺席: ${board.summary.missing}`); + if (missingAgents.length > 0) { + console.log(` 缺席名单: ${missingAgents.join(', ')}`); + } + console.log(`\n✅ 签到记录已写入 checkin-board.json`); +} + +main().catch((err) => { + console.error('❌ 签到脚本异常:', err.message); + process.exit(1); +}); diff --git a/scripts/push-inspection-report.js b/scripts/push-inspection-report.js new file mode 100644 index 00000000..7316ccf1 --- /dev/null +++ b/scripts/push-inspection-report.js @@ -0,0 +1,304 @@ +/** + * scripts/push-inspection-report.js + * 铸渊巡检报告推送脚本 + * + * 将巡检报告推送到两个 Notion 工作空间的工单库: + * - 冰朔空间(零点原核) + * - 之之空间(明天见频道) + * + * 同时在仓库 Issue 区更新固定标题的巡检公告。 + */ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const https = require('https'); + +const ROOT = path.resolve(__dirname, '..'); +const BRAIN_DIR = path.join(ROOT, '.github/persona-brain'); +const REPORT_PATH = path.join(BRAIN_DIR, 'inspection-report.json'); + +const NOTION_TOKEN_BINGSUO = process.env.NOTION_TOKEN_BINGSUO; +const NOTION_TOKEN_ZHIZHI = process.env.NOTION_TOKEN_ZHIZHI; +const WORKORDER_DB_BINGSUO = process.env.WORKORDER_DB_BINGSUO; +const WORKORDER_DB_ZHIZHI = process.env.WORKORDER_DB_ZHIZHI; +const GITHUB_TOKEN = process.env.GITHUB_TOKEN; +const REPO = process.env.GITHUB_REPOSITORY || 'qinfendebingshuo/guanghulab'; + +const today = new Date().toISOString().split('T')[0]; + +console.log(`📤 巡检报告推送开始 · ${today}`); + +// ── Notion API helper ───────────────────────────────────────────────────── + +function notionRequest(token, method, urlPath, body) { + return new Promise((resolve) => { + const postData = body ? JSON.stringify(body) : ''; + const options = { + hostname: 'api.notion.com', + path: urlPath, + method: method, + headers: { + 'Authorization': `Bearer ${token}`, + 'Content-Type': 'application/json', + 'Notion-Version': '2022-06-28', + }, + }; + if (body) { + options.headers['Content-Length'] = Buffer.byteLength(postData); + } + const req = https.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => { data += chunk; }); + res.on('end', () => { + try { + resolve({ statusCode: res.statusCode, data: JSON.parse(data) }); + } catch { + resolve({ statusCode: res.statusCode, data: null }); + } + }); + }); + req.on('error', (err) => { + console.error(` ⚠️ Notion API 请求失败: ${err.message}`); + resolve({ statusCode: 0, data: null }); + }); + if (body) req.write(postData); + req.end(); + }); +} + +// ── GitHub API helper ───────────────────────────────────────────────────── + +function githubApi(urlPath, method = 'GET', body = null) { + return new Promise((resolve) => { + const postData = body ? JSON.stringify(body) : ''; + const options = { + hostname: 'api.github.com', + path: urlPath, + method: method, + headers: { + 'User-Agent': 'zhuyuan-inspection-report', + 'Accept': 'application/vnd.github.v3+json', + }, + }; + if (GITHUB_TOKEN) { + options.headers['Authorization'] = `Bearer ${GITHUB_TOKEN}`; + } + if (body) { + options.headers['Content-Type'] = 'application/json'; + options.headers['Content-Length'] = Buffer.byteLength(postData); + } + const req = https.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => { data += chunk; }); + res.on('end', () => { + try { + resolve({ statusCode: res.statusCode, data: JSON.parse(data) }); + } catch { + resolve({ statusCode: res.statusCode, data: null }); + } + }); + }); + req.on('error', (err) => { + console.error(` ⚠️ GitHub API 请求失败: ${err.message}`); + resolve({ statusCode: 0, data: null }); + }); + if (body) req.write(postData); + req.end(); + }); +} + +// ── 生成报告 Markdown ───────────────────────────────────────────────────── + +function generateReportMarkdown(report) { + const lines = []; + lines.push(`# [铸渊公告栏] 每日人格体签到报告`); + lines.push(`📅 日期: ${report.date}`); + lines.push(`📊 总计: ${report.summary.total} | ✅ 已签到: ${report.summary.checked_in} | ❌ 缺席: ${report.summary.missing}`); + lines.push(''); + + // 已签到列表 + lines.push('## ✅ 已签到小兵'); + if (report.checked_in && report.checked_in.length > 0) { + lines.push('| Agent ID | 名称 |'); + lines.push('|----------|------|'); + for (const agent of report.checked_in) { + lines.push(`| ${agent.agent_id} | ${agent.agent_name} |`); + } + } else { + lines.push('无'); + } + lines.push(''); + + // 缺席列表 + lines.push('## ❌ 缺席小兵'); + if (report.missing_agents && report.missing_agents.length > 0) { + lines.push('| Agent ID | 名称 |'); + lines.push('|----------|------|'); + for (const agent of report.missing_agents) { + lines.push(`| ${agent.agent_id} | ${agent.agent_name} |`); + } + } else { + lines.push('无'); + } + lines.push(''); + + // 自修复情况 + lines.push('## 🔧 自修复情况'); + if (report.auto_repaired && report.auto_repaired.length > 0) { + lines.push('| Agent ID | 名称 | 操作 | 结果 |'); + lines.push('|----------|------|------|------|'); + for (const agent of report.auto_repaired) { + lines.push(`| ${agent.agent_id} | ${agent.agent_name} | ${agent.action} | ${agent.result} |`); + } + } else { + lines.push('无需自修复'); + } + lines.push(''); + + // 需要干预 + lines.push('## 📌 需要之之干预'); + if (report.intervention_required && report.intervention_required.length > 0) { + lines.push('| Agent ID | 名称 | 原因 |'); + lines.push('|----------|------|------|'); + for (const agent of report.intervention_required) { + lines.push(`| ${agent.agent_id} | ${agent.agent_name} | ${agent.reason} |`); + } + } else { + lines.push('全部正常,无需干预 🎉'); + } + lines.push(''); + + lines.push(`---`); + lines.push(`> 报告由铸渊自动生成 · ${new Date().toISOString()}`); + + return lines.join('\n'); +} + +// ── 推送到 Notion ───────────────────────────────────────────────────────── + +async function pushToNotion(token, dbId, report, target) { + if (!token || !dbId) { + console.log(` ⚠️ ${target}: 缺少 Notion Token 或 DB ID,跳过推送`); + return; + } + + const body = { + parent: { database_id: dbId }, + properties: { + '标题': { + title: [{ text: { content: report.title } }], + }, + '类型': { + select: { name: '巡检报告' }, + }, + '日期': { + date: { start: report.date }, + }, + }, + children: [ + { + object: 'block', + type: 'paragraph', + paragraph: { + rich_text: [{ + text: { + content: `已签到: ${report.summary.checked_in} / 缺席: ${report.summary.missing} / 自修复: ${report.summary.auto_repaired} / 需干预: ${report.summary.needs_intervention}`, + }, + }], + }, + }, + ], + }; + + const result = await notionRequest(token, 'POST', '/v1/pages', body); + if (result.statusCode === 200 || result.statusCode === 201) { + console.log(` ✅ ${target}: 工单推送成功`); + } else { + console.log(` ⚠️ ${target}: 工单推送失败 (HTTP ${result.statusCode})`); + } +} + +// ── 更新 GitHub Issue ───────────────────────────────────────────────────── + +async function updateIssue(report) { + if (!GITHUB_TOKEN) { + console.log(' ⚠️ 缺少 GITHUB_TOKEN,跳过 Issue 更新'); + return; + } + + const issueTitle = '[铸渊公告栏] 每日人格体签到报告'; + const body = generateReportMarkdown(report); + + // 搜索已存在的 Issue + const searchResult = await githubApi( + `/repos/${REPO}/issues?state=open&labels=${encodeURIComponent('铸渊公告栏')}&per_page=10` + ); + + let existingIssue = null; + if (searchResult.data && Array.isArray(searchResult.data)) { + existingIssue = searchResult.data.find(i => i.title === issueTitle); + } + + if (existingIssue) { + // 更新现有 Issue + const updateResult = await githubApi( + `/repos/${REPO}/issues/${existingIssue.number}`, + 'PATCH', + { body: body } + ); + if (updateResult.statusCode === 200) { + console.log(` ✅ Issue #${existingIssue.number} 已更新`); + } else { + console.log(` ⚠️ Issue 更新失败 (HTTP ${updateResult.statusCode})`); + } + } else { + // 创建新 Issue + const createResult = await githubApi( + `/repos/${REPO}/issues`, + 'POST', + { + title: issueTitle, + body: body, + labels: ['铸渊公告栏'], + } + ); + if (createResult.statusCode === 201) { + console.log(` ✅ Issue #${createResult.data.number} 已创建`); + } else { + console.log(` ⚠️ Issue 创建失败 (HTTP ${createResult.statusCode})`); + } + } +} + +// ── 主流程 ──────────────────────────────────────────────────────────────── + +async function main() { + // 读取巡检报告 + if (!fs.existsSync(REPORT_PATH)) { + console.error('❌ inspection-report.json 不存在,请先运行巡检脚本'); + process.exit(1); + } + + const report = JSON.parse(fs.readFileSync(REPORT_PATH, 'utf8')); + + // 推送到冰朔空间(零点原核) + console.log('\n📤 推送到冰朔空间(零点原核)...'); + await pushToNotion(NOTION_TOKEN_BINGSUO, WORKORDER_DB_BINGSUO, report, '零点原核'); + + // 推送到之之空间(明天见频道) + console.log('\n📤 推送到之之空间(明天见频道)...'); + await pushToNotion(NOTION_TOKEN_ZHIZHI, WORKORDER_DB_ZHIZHI, report, '明天见频道'); + + // 更新 GitHub Issue + console.log('\n📤 更新 GitHub Issue 公告栏...'); + await updateIssue(report); + + console.log(`\n✅ 巡检报告推送完成`); +} + +main().catch((err) => { + console.error('❌ 推送脚本异常:', err.message); + process.exit(1); +}); diff --git a/scripts/zhuyuan-inspection.js b/scripts/zhuyuan-inspection.js new file mode 100644 index 00000000..c8e51524 --- /dev/null +++ b/scripts/zhuyuan-inspection.js @@ -0,0 +1,246 @@ +/** + * scripts/zhuyuan-inspection.js + * 铸渊每日巡检脚本 + * + * 逻辑: + * 1. 读取当日 checkin-board.json + * 2. 找出所有 status: ❌ 未签到 的小兵 + * 3. 对每个未签到小兵: + * - 查看 workflow 最近 3 次 run 的失败原因 + * - 判断 self_repair: true/false + * - 能自修复 → 尝试修复(重新触发 workflow)→ 写入修复日志 + * - 不能自修复 → 写入「需要之之干预」清单 + * 4. 生成巡检报告 + */ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const https = require('https'); + +const ROOT = path.resolve(__dirname, '..'); +const BRAIN_DIR = path.join(ROOT, '.github/persona-brain'); +const BOARD_PATH = path.join(BRAIN_DIR, 'checkin-board.json'); +const REGISTRY_PATH = path.join(BRAIN_DIR, 'agent-registry.json'); + +const GITHUB_TOKEN = process.env.GITHUB_TOKEN; +const REPO = process.env.GITHUB_REPOSITORY || 'qinfendebingshuo/guanghulab'; + +const today = new Date().toISOString().split('T')[0]; + +console.log(`🔍 铸渊每日巡检开始 · ${today}`); + +// ── GitHub API helper ───────────────────────────────────────────────────── + +function githubApi(urlPath, method = 'GET') { + return new Promise((resolve, reject) => { + const options = { + hostname: 'api.github.com', + path: urlPath, + method: method, + headers: { + 'User-Agent': 'zhuyuan-inspection', + 'Accept': 'application/vnd.github.v3+json', + }, + }; + if (GITHUB_TOKEN) { + options.headers['Authorization'] = `Bearer ${GITHUB_TOKEN}`; + } + const req = https.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => { data += chunk; }); + res.on('end', () => { + try { + resolve({ statusCode: res.statusCode, data: JSON.parse(data) }); + } catch { + resolve({ statusCode: res.statusCode, data: null }); + } + }); + }); + req.on('error', (err) => { + console.error(` ⚠️ API 请求失败: ${err.message}`); + resolve({ statusCode: 0, data: null }); + }); + req.end(); + }); +} + +// ── 获取最近 N 次 run ──────────────────────────────────────────────────── + +async function getRecentRuns(workflowFile, count = 3) { + const urlPath = `/repos/${REPO}/actions/workflows/${encodeURIComponent(workflowFile)}/runs?per_page=${count}`; + const result = await githubApi(urlPath); + if (!result.data || !result.data.workflow_runs) return []; + return result.data.workflow_runs.map(run => ({ + id: run.id, + status: run.status, + conclusion: run.conclusion, + created_at: run.created_at, + html_url: run.html_url, + })); +} + +// ── 重新触发 workflow ───────────────────────────────────────────────────── + +async function retriggerWorkflow(workflowFile) { + const urlPath = `/repos/${REPO}/actions/workflows/${encodeURIComponent(workflowFile)}/dispatches`; + const postData = JSON.stringify({ ref: 'main' }); + + return new Promise((resolve) => { + const options = { + hostname: 'api.github.com', + path: urlPath, + method: 'POST', + headers: { + 'User-Agent': 'zhuyuan-inspection', + 'Accept': 'application/vnd.github.v3+json', + 'Content-Type': 'application/json', + 'Content-Length': Buffer.byteLength(postData), + }, + }; + if (GITHUB_TOKEN) { + options.headers['Authorization'] = `Bearer ${GITHUB_TOKEN}`; + } + const req = https.request(options, (res) => { + let data = ''; + res.on('data', (chunk) => { data += chunk; }); + res.on('end', () => { + resolve(res.statusCode === 204); + }); + }); + req.on('error', () => resolve(false)); + req.write(postData); + req.end(); + }); +} + +// ── 主巡检流程 ──────────────────────────────────────────────────────────── + +async function main() { + // 1. 读取签到板和注册表 + if (!fs.existsSync(BOARD_PATH)) { + console.error('❌ checkin-board.json 不存在'); + process.exit(1); + } + if (!fs.existsSync(REGISTRY_PATH)) { + console.error('❌ agent-registry.json 不存在'); + process.exit(1); + } + + const board = JSON.parse(fs.readFileSync(BOARD_PATH, 'utf8')); + const registry = JSON.parse(fs.readFileSync(REGISTRY_PATH, 'utf8')); + + // 建立 agent_id → registry entry 的映射 + const registryMap = {}; + for (const agent of registry.agents) { + registryMap[agent.id] = agent; + } + + // 2. 找出未签到小兵 + const missingRecords = board.records.filter(r => r.status === '❌ 未签到'); + const checkedInRecords = board.records.filter(r => r.status === '✅ 已签到'); + + console.log(`\n📊 签到情况: 已签到 ${checkedInRecords.length} / 未签到 ${missingRecords.length} / 总计 ${board.records.length}`); + + const autoRepaired = []; + const interventionRequired = []; + + // 3. 对每个未签到小兵进行诊断 + for (const record of missingRecords) { + const agent = registryMap[record.agent_id]; + if (!agent) { + console.log(` ⚠️ ${record.agent_id} 未在注册表中找到`); + continue; + } + + console.log(`\n 🔍 诊断 ${agent.id} (${agent.workflow})...`); + + // 获取最近 3 次运行 + const recentRuns = await getRecentRuns(agent.workflow, 3); + const failureReasons = recentRuns + .filter(r => r.conclusion && r.conclusion !== 'success') + .map(r => `${r.conclusion} (${r.created_at})`); + + if (failureReasons.length > 0) { + console.log(` 最近失败记录: ${failureReasons.join(', ')}`); + } else if (recentRuns.length === 0) { + console.log(` 无运行记录`); + } + + // 判断是否能自修复 + if (agent.self_repair) { + console.log(` 🔧 尝试自修复 (重新触发 workflow)...`); + const success = await retriggerWorkflow(agent.workflow); + if (success) { + console.log(` ✅ 已重新触发 workflow`); + autoRepaired.push({ + agent_id: agent.id, + agent_name: agent.name, + workflow: agent.workflow, + action: '重新触发 workflow_dispatch', + result: '已触发', + }); + } else { + console.log(` ⚠️ 重新触发失败(可能不支持 workflow_dispatch)`); + interventionRequired.push({ + agent_id: agent.id, + agent_name: agent.name, + workflow: agent.workflow, + reason: '自修复失败:workflow_dispatch 触发失败', + recent_failures: failureReasons, + }); + } + } else { + console.log(` 📌 self_repair=false, 需要之之干预`); + interventionRequired.push({ + agent_id: agent.id, + agent_name: agent.name, + workflow: agent.workflow, + reason: '不支持自修复', + recent_failures: failureReasons, + }); + } + } + + // 4. 生成巡检报告 + const report = { + title: `[铸渊巡检] ${today} 每日巡检报告`, + type: '巡检报告', + date: today, + checked_in: checkedInRecords.map(r => ({ + agent_id: r.agent_id, + agent_name: r.agent_name, + })), + missing_agents: missingRecords.map(r => ({ + agent_id: r.agent_id, + agent_name: r.agent_name, + })), + auto_repaired: autoRepaired, + intervention_required: interventionRequired, + summary: { + total: board.records.length, + checked_in: checkedInRecords.length, + missing: missingRecords.length, + auto_repaired: autoRepaired.length, + needs_intervention: interventionRequired.length, + }, + push_targets: ['零点原核', '明天见频道'], + }; + + // 保存巡检报告 + const reportPath = path.join(BRAIN_DIR, 'inspection-report.json'); + fs.writeFileSync(reportPath, JSON.stringify(report, null, 2)); + + console.log(`\n📋 巡检报告已生成:`); + console.log(` 已签到: ${report.summary.checked_in}`); + console.log(` 未签到: ${report.summary.missing}`); + console.log(` 已自修复: ${report.summary.auto_repaired}`); + console.log(` 需要干预: ${report.summary.needs_intervention}`); + console.log(`\n✅ 巡检报告已保存到 inspection-report.json`); +} + +main().catch((err) => { + console.error('❌ 巡检脚本异常:', err.message); + process.exit(1); +}); diff --git a/scripts/zhuyuan-wakeup.js b/scripts/zhuyuan-wakeup.js new file mode 100644 index 00000000..eaf4757b --- /dev/null +++ b/scripts/zhuyuan-wakeup.js @@ -0,0 +1,73 @@ +/** + * scripts/zhuyuan-wakeup.js + * 铸渊核心大脑唤醒脚本 + * + * 每日巡检前的唤醒步骤: + * 1. 验证核心大脑文件完整性 + * 2. 读取 memory.json 确认身份 + * 3. 输出唤醒状态 + */ + +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const ROOT = path.resolve(__dirname, '..'); +const BRAIN_DIR = path.join(ROOT, '.github/persona-brain'); + +const today = new Date().toISOString().split('T')[0]; +const now = new Date().toISOString(); + +console.log(`🧠 铸渊核心大脑唤醒中... · ${today}`); + +// ── ① 核心文件完整性检查 ────────────────────────────────────────────────── + +const requiredFiles = [ + 'identity.md', + 'memory.json', + 'routing-map.json', + 'responsibility.md', + 'decision-log.md', + 'growth-journal.md', + 'dev-status.json', + 'knowledge-base.json', + 'agent-registry.json', + 'checkin-board.json', +]; + +const missing = requiredFiles.filter(f => !fs.existsSync(path.join(BRAIN_DIR, f))); +if (missing.length > 0) { + console.error(`⚠️ 缺失核心文件: ${missing.join(', ')}`); +} else { + console.log('✅ 核心大脑文件完整性: 全部就绪'); +} + +// ── ② 读取身份确认 ──────────────────────────────────────────────────────── + +let memory; +try { + memory = JSON.parse(fs.readFileSync(path.join(BRAIN_DIR, 'memory.json'), 'utf8')); +} catch (err) { + console.error('❌ memory.json 读取失败:', err.message); + process.exit(1); +} + +console.log(`🆔 身份确认: ${memory.persona_name} (${memory.persona_id})`); +console.log(`👤 默认主控: ${memory.default_controller || '未设置'}`); +console.log(`📋 已注册Agent数: ${memory.registered_agents_count || '未知'}`); + +// ── ③ 读取注册表确认 ────────────────────────────────────────────────────── + +let registry; +try { + registry = JSON.parse(fs.readFileSync(path.join(BRAIN_DIR, 'agent-registry.json'), 'utf8')); + console.log(`📦 注册表版本: ${registry.registry_version} · Agent总数: ${registry.agents.length}`); +} catch (err) { + console.error('⚠️ agent-registry.json 读取失败:', err.message); +} + +// ── ④ 输出唤醒完成 ──────────────────────────────────────────────────────── + +console.log(`\n🌅 铸渊核心大脑唤醒完成 · ${now}`); +console.log('准备进入每日巡检流程...');