Sync from WENZHUOXI/guanghu-Awen at 2026-03-24T12:40:16Z
This commit is contained in:
parent
64661100ed
commit
49ff243a31
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"source": "WENZHUOXI/guanghu-Awen",
|
||||
"branch": "main",
|
||||
"commit": "96bcccd3640f226a818568fed96f75f4a096a5ff",
|
||||
"timestamp": "2026-03-24T12:18:37Z",
|
||||
"commit": "7612cb295b18fe3f69bac3a9edc25551422ff11b",
|
||||
"timestamp": "2026-03-24T12:40:14Z",
|
||||
"developer": "awen"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,78 @@
|
|||
// 知秋天眼 · 签到模块
|
||||
const https = require('https');
|
||||
const fs = require('fs');
|
||||
|
||||
const TOKEN = process.env.MAIN_REPO_TOKEN;
|
||||
const MAIN_REPO = 'qinfendebingshuo/guanghulab';
|
||||
|
||||
if (!TOKEN) {
|
||||
console.error('❌ MAIN_REPO_TOKEN 未配置,无法签到');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function sendCheckin(payload, callback) {
|
||||
const options = {
|
||||
hostname: 'api.github.com',
|
||||
path: `/repos/${MAIN_REPO}/dispatches`,
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'User-Agent': 'guanghu-skyeye',
|
||||
'Accept': 'application/vnd.github.everest-preview+json',
|
||||
'Authorization': `token ${TOKEN}`,
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
};
|
||||
|
||||
const req = https.request(options, res => {
|
||||
let data = '';
|
||||
res.on('data', d => data += d);
|
||||
res.on('end', () => {
|
||||
callback(null, {statusCode: res.statusCode, body: data});
|
||||
});
|
||||
});
|
||||
|
||||
req.on('error', err => callback(err));
|
||||
req.write(JSON.stringify(payload));
|
||||
req.end();
|
||||
}
|
||||
|
||||
const reportPath = '.github/persona-brain/skyeye-report.json';
|
||||
let report = {};
|
||||
if (fs.existsSync(reportPath)) {
|
||||
report = JSON.parse(fs.readFileSync(reportPath));
|
||||
}
|
||||
|
||||
const payload = {
|
||||
event_type: 'skyeye-checkin',
|
||||
client_payload: {
|
||||
persona: '知秋',
|
||||
persona_id: 'PER-ZQ001',
|
||||
dev_id: 'DEV-012',
|
||||
timestamp: new Date().toISOString(),
|
||||
signature_hash: report.signature_hash || null,
|
||||
repo: report.repo || 'WENZHUOXI/guanghu-awen'
|
||||
}
|
||||
};
|
||||
|
||||
sendCheckin(payload, (err, res) => {
|
||||
if (err) {
|
||||
console.error('签到请求失败:', err);
|
||||
process.exit(1);
|
||||
}
|
||||
if (res.statusCode >= 200 && res.statusCode < 300) {
|
||||
console.log('✅ 签到成功,主仓库已收到 dispatch');
|
||||
const statusPath = '.github/persona-brain/status.json';
|
||||
let status = {};
|
||||
if (fs.existsSync(statusPath)) {
|
||||
status = JSON.parse(fs.readFileSync(statusPath));
|
||||
}
|
||||
status.last_checkin_attempt = new Date().toISOString();
|
||||
status.last_checkin_success = new Date().toISOString();
|
||||
status.signature_hash = report.signature_hash || null;
|
||||
status.status = 'active';
|
||||
fs.writeFileSync(statusPath, JSON.stringify(status, null, 2));
|
||||
} else {
|
||||
console.error('签到失败,HTTP 状态码:', res.statusCode, '响应体:', res.body);
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
|
@ -1,11 +1,7 @@
|
|||
// 知秋天眼 · 仓库自扫描引擎
|
||||
// 指令编号:ZQ-PERSONA-INIT-2026-0323-001
|
||||
// 每次天眼醒来后执行,扫描整个仓库状态
|
||||
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
|
||||
// 主权区文件列表(天眼系统核心文件)
|
||||
const SOVEREIGN_FILES = [
|
||||
'.github/persona-brain/config.json',
|
||||
'.github/persona-brain/status.json',
|
||||
|
|
@ -15,7 +11,6 @@ const SOVEREIGN_FILES = [
|
|||
'.github/guanghu-language-shell.json'
|
||||
];
|
||||
|
||||
// 计算主权区签名哈希(身份证)
|
||||
function computeSignatureHash() {
|
||||
const hash = crypto.createHash('sha256');
|
||||
for (const file of SOVEREIGN_FILES) {
|
||||
|
|
@ -28,7 +23,6 @@ function computeSignatureHash() {
|
|||
return hash.digest('hex');
|
||||
}
|
||||
|
||||
// 扫描仓库
|
||||
function scanRepo() {
|
||||
const report = {
|
||||
timestamp: new Date().toISOString(),
|
||||
|
|
@ -44,17 +38,13 @@ function scanRepo() {
|
|||
repo_summary: {}
|
||||
};
|
||||
|
||||
// 逐项检查主权区文件
|
||||
for (const file of SOVEREIGN_FILES) {
|
||||
report.sovereign_files[file] = {
|
||||
exists: fs.existsSync(file),
|
||||
hash: fs.existsSync(file)
|
||||
? crypto.createHash('md5').update(fs.readFileSync(file)).digest('hex')
|
||||
: null
|
||||
hash: fs.existsSync(file) ? crypto.createHash('md5').update(fs.readFileSync(file)).digest('hex') : null
|
||||
};
|
||||
}
|
||||
|
||||
// 仓库概况
|
||||
try {
|
||||
const rootEntries = fs.readdirSync('.').filter(e => !e.startsWith('.'));
|
||||
report.repo_summary.root_entries_count = rootEntries.length;
|
||||
|
|
@ -69,7 +59,6 @@ function scanRepo() {
|
|||
return report;
|
||||
}
|
||||
|
||||
// 执行扫描
|
||||
const report = scanRepo();
|
||||
const outputPath = '.github/persona-brain/skyeye-report.json';
|
||||
fs.mkdirSync('.github/persona-brain', { recursive: true });
|
||||
|
|
|
|||
Loading…
Reference in New Issue