guanghulab/scripts/fix-registry-checkin.js
Guanghu Domestic Migration d1e47f4565
Some checks are pending
自动更新代码和重启 / update-and-restart (push) Waiting to run
CI检查 + 自动部署 / check (push) Waiting to run
CI检查 + 自动部署 / deploy (push) Blocked by required conditions
重启聊天服务 / restart (push) Waiting to run
chore: import sanitized domestic snapshot for REPO-002
Source snapshot: ca48d3ddf926d79aa138306164169baf764bb829
2026-07-17 15:54:41 +08:00

50 lines
1.8 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* scripts/fix-registry-checkin.js
* 铸渊修复脚本:给所有 Agent 补上 daily_checkin_required 字段
*
* 根因agent-registry.json 中 62 个 Agent 均缺少 daily_checkin_required 字段,
* 签到系统将所有 Agent 视为需要签到,导致事件触发型 Agent 被误报为缺席。
*
* 修复策略:只有定时运行的核心系统 Agent 标记为 true其余标记为 false。
*/
'use strict';
const fs = require('fs');
const path = require('path');
const REGISTRY_PATH = path.resolve(__dirname, '..', '.github/persona-brain/agent-registry.json');
const registry = JSON.parse(fs.readFileSync(REGISTRY_PATH, 'utf8'));
// 真正需要每日签到的 Agent 列表(核心系统 Agent具备定时触发能力
const MUST_CHECKIN = [
'AG-ZY-004', // 冰朔主控神经系统
'AG-ZY-007', // Bridge E · GitHub→Notion
'AG-ZY-008', // 桥接心跳检测
'AG-ZY-013', // Daily Maintenance
'AG-ZY-014', // 光湖开发日报
'AG-ZY-016', // CD 自动部署
'AG-ZY-017', // 广播分发
'AG-ZY-023', // 元看门狗
'AG-ZY-026', // Heartbeat Monitor
'AG-ZY-028', // 工单轮询
'AG-ZY-029', // Agent 唤醒监听
'AG-ZY-053', // 更新系统公告区
'AG-ZY-054', // 图书馆目录更新
'AG-ZY-058', // 每日自检
];
let fixed = 0;
registry.agents.forEach(agent => {
if (agent.daily_checkin_required === undefined) {
agent.daily_checkin_required = MUST_CHECKIN.includes(agent.id);
fixed++;
}
});
fs.writeFileSync(REGISTRY_PATH, JSON.stringify(registry, null, 2) + '\n');
console.log(`✅ 修复完成:${fixed} 个 Agent 已补上 daily_checkin_required 字段`);
console.log(`📊 需要签到: ${registry.agents.filter(a => a.daily_checkin_required).length}`);
console.log(`📊 无需签到: ${registry.agents.filter(a => !a.daily_checkin_required).length}`);