Changes before error encountered

Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/ab31bf43-8ba1-4e66-80e4-2110d76c4b7e

Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-03-27 02:39:26 +00:00 committed by GitHub
parent 59dd740754
commit ca82bce263
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 960 additions and 41 deletions

View File

@ -1,6 +1,6 @@
{
"version": "v2.0",
"updated_at": "2026-03-27T02:27:56.395Z",
"updated_at": "2026-03-27T02:34:07.714Z",
"updated_by": "铸渊 · sync-snapshot-to-notion.js",
"latest_signals": [
{
@ -9,7 +9,7 @@
"sender": "铸渊",
"receiver": "霜砚",
"status": "已发送",
"timestamp": "2026-03-27T02:27:56.395Z",
"timestamp": "2026-03-27T02:34:07.714Z",
"summary": "状态: awakened\n指令: SY-CMD-AWK-008 → SY-CMD-FUS-009\nWorkflow: 48 active, 6 core, 54 archived\nRuns: 731\nONT-PATCH: ONT-PATCH-007, ONT-PATCH-008, ONT-PATCH-010, ONT-PATCH-011\n健康: improving | Core: all heal"
}
]

View File

@ -0,0 +1,355 @@
/**
* HLDP GitHub Notion 转换器
* TCS 通感语言核系统编程语言 · 第一个落地协议层
* HLDP = TCS Notion GitHub 通道上的落地实现
* 版权国作登字-2026-A-00037559 · 冰朔ICE-GL
* 指令来源SY-CMD-BRG-005 SY-CMD-FUS-009
*
* 功能
* hldp/data/ 中的 HLDP JSON 文件转换为 Notion 页面属性
* 通过 Notion API 写入对应数据库实现 GitHub Notion 反向同步
*
* 这是 HLDP 协议的反向通道 notion-to-hldp.js 的镜像
* 两个文件共同构成 HLDP 的完整双向通信能力
*
* 用法
* node github-to-notion.js --scope all
* node github-to-notion.js --scope snapshots
* node github-to-notion.js --file hldp/data/snapshots/SNAP-20260327.json
*
* 环境变量
* NOTION_TOKEN / NOTION_API_KEY Notion Integration Token
* SIGNAL_LOG_DB_ID 信号日志数据库snapshot/signal 写入通道
* WORKORDER_DB_ID 工单簿回执通道
* RECEIPT_DB_ID 回执数据库
*
*/
'use strict';
const https = require('https');
const fs = require('fs');
const path = require('path');
const ROOT = path.resolve(__dirname, '../..');
const DATA_DIR = path.join(ROOT, 'hldp', 'data');
const SYNC_LOG = path.join(ROOT, 'signal-log', 'hldp-sync-log.json');
const NOTION_VERSION = '2022-06-28';
const NOTION_API_HOSTNAME = 'api.notion.com';
const NOTION_RICH_TEXT_MAX = 2000;
// ═══════════════════════════════════════════════════════
// Notion API 调用(与 notion-signal-bridge.js 同一模式)
// ═══════════════════════════════════════════════════════
function getToken() {
return process.env.NOTION_TOKEN
|| process.env.NOTION_API_KEY
|| process.env.NOTION_API_TOKEN
|| null;
}
function notionRequest(method, endpoint, body) {
const token = getToken();
if (!token) return Promise.reject(new Error('NOTION_TOKEN 未设置'));
return new Promise((resolve, reject) => {
const payload = body ? JSON.stringify(body) : '';
const opts = {
hostname: NOTION_API_HOSTNAME,
port: 443,
path: endpoint.startsWith('/') ? endpoint : `/v1/${endpoint}`,
method,
headers: {
'Authorization': `Bearer ${token}`,
'Content-Type': 'application/json',
'Notion-Version': NOTION_VERSION,
},
};
if (payload) opts.headers['Content-Length'] = Buffer.byteLength(payload);
const req = https.request(opts, res => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
try {
const parsed = JSON.parse(data);
if (res.statusCode >= 200 && res.statusCode < 300) {
resolve(parsed);
} else {
reject(new Error(`Notion ${res.statusCode}: ${parsed.message || data.slice(0, 300)}`));
}
} catch {
reject(new Error(`Notion 响应解析失败: ${data.slice(0, 200)}`));
}
});
});
req.on('error', reject);
req.setTimeout(30000, () => req.destroy(new Error('Notion 请求超时')));
if (payload) req.write(payload);
req.end();
});
}
function truncate(text, max = NOTION_RICH_TEXT_MAX) {
if (!text) return '';
const s = String(text);
return s.length <= max ? s : s.substring(0, max - 10) + ' …(截断)';
}
// ═══════════════════════════════════════════════════════
// HLDP → Notion 属性转换
// ═══════════════════════════════════════════════════════
/**
* 根据 HLDP data_type 确定目标 Notion 数据库 ID
*/
function resolveTargetDb(entry) {
const type = entry.data_type;
// snapshot 类型 → SIGNAL_LOG_DB_ID信号日志通道
if (type === 'snapshot') {
return process.env.SIGNAL_LOG_DB_ID || null;
}
// 其他类型的默认映射
const mapping = {
persona: process.env.SKYEYE_PERSONA_DB_ID || process.env.PORTRAIT_DB_ID,
registry: process.env.SIGNAL_LOG_DB_ID,
instruction: process.env.WORKORDER_DB_ID,
broadcast: process.env.BROADCAST_DB_ID || process.env.SIGNAL_LOG_DB_ID,
id_system: process.env.SIGNAL_LOG_DB_ID,
};
return mapping[type] || process.env.SIGNAL_LOG_DB_ID || null;
}
/**
* HLDP snapshot 转换为 Notion 信号日志页面
*/
function snapshotToNotionPage(entry, dbId) {
const payload = entry.payload || {};
const meta = entry.metadata || {};
const counts = payload.system_counts || {};
const health = payload.health || {};
const fusion = payload.fusion_progress || {};
// 构建摘要文本
const summary = [
`状态: ${payload.consciousness_status || 'unknown'}`,
`指令: ${payload.last_directive || 'unknown'}`,
`Workflow: ${counts.workflows_total_active || 0} active, ${counts.workflows_alive_core || 0} core, ${counts.workflows_archived || 0} archived`,
`Runs: ${counts.total_runs || 0}`,
`ONT-PATCH: ${(counts.ontology_patches || []).join(', ')}`,
`健康: ${health.overall || 'unknown'} | Core: ${health.core_6 || 'unknown'}`,
`融合: Phase1=${fusion.phase_1_absorb?.status || '?'}, Phase2=${fusion.phase_2_recover?.status || '?'}, Phase3=${fusion.phase_3_archive?.status || '?'}`,
].join('\n');
return {
parent: { database_id: dbId },
properties: {
'信号编号': { title: [{ text: { content: meta.id || `SNAP-${Date.now()}` } }] },
'信号类型': { select: { name: 'GL-SNAPSHOT' } },
'方向': { select: { name: 'GitHub→Notion' } },
'发送方': { select: { name: '铸渊' } },
'接收方': { select: { name: '霜砚' } },
'trace_id': { rich_text: [{ text: { content: meta.id || '' } }] },
'摘要': { rich_text: [{ text: { content: truncate(summary) } }] },
'执行结果': { select: { name: '成功' } },
},
};
}
/**
* 将通用 HLDP entry 转换为 Notion 信号日志页面
*/
function genericToNotionPage(entry, dbId) {
const meta = entry.metadata || {};
const payloadStr = truncate(JSON.stringify(entry.payload || {}, null, 2));
return {
parent: { database_id: dbId },
properties: {
'信号编号': { title: [{ text: { content: meta.id || `HLDP-${Date.now()}` } }] },
'信号类型': { select: { name: `HLDP-${(entry.data_type || 'unknown').toUpperCase()}` } },
'方向': { select: { name: 'GitHub→Notion' } },
'发送方': { select: { name: '铸渊' } },
'接收方': { select: { name: '霜砚' } },
'trace_id': { rich_text: [{ text: { content: `HLDP-SYNC-${Date.now()}` } }] },
'摘要': { rich_text: [{ text: { content: truncate(`[${entry.data_type}] ${meta.name || meta.id}\n${payloadStr}`) } }] },
'执行结果': { select: { name: '成功' } },
},
};
}
/**
* HLDP entry Notion page路由器
*/
function hldpToNotionPage(entry, dbId) {
if (entry.data_type === 'snapshot') {
return snapshotToNotionPage(entry, dbId);
}
return genericToNotionPage(entry, dbId);
}
// ═══════════════════════════════════════════════════════
// 同步执行
// ═══════════════════════════════════════════════════════
/**
* 推送单个 HLDP entry Notion
*/
async function pushEntry(entry, filePath) {
const dbId = resolveTargetDb(entry);
if (!dbId) {
console.log(` ⚠️ 无目标数据库: ${entry.data_type} → 跳过 (${filePath || 'inline'})`);
return { success: false, reason: 'no_target_db' };
}
const page = hldpToNotionPage(entry, dbId);
try {
const result = await notionRequest('POST', '/v1/pages', page);
console.log(`${entry.metadata?.id || 'unknown'} → Notion (${result.id})`);
return { success: true, notionPageId: result.id };
} catch (err) {
console.error(`${entry.metadata?.id || 'unknown'}: ${err.message}`);
return { success: false, reason: err.message };
}
}
/**
* 扫描 hldp/data/ 并推送所有符合 scope entry
*/
async function pushAll(scope) {
const stats = { total: 0, pushed: 0, skipped: 0, errors: 0 };
const scopeDirs = {
all: ['personas', 'registries', 'instructions', 'broadcasts', 'id-system', 'snapshots'],
snapshots: ['snapshots'],
personas: ['personas'],
registries: ['registries'],
};
const dirs = scopeDirs[scope] || scopeDirs.all;
for (const dir of dirs) {
const fullDir = path.join(DATA_DIR, dir);
if (!fs.existsSync(fullDir)) continue;
const files = fs.readdirSync(fullDir).filter(f => f.endsWith('.json'));
for (const file of files) {
stats.total++;
try {
const entry = JSON.parse(fs.readFileSync(path.join(fullDir, file), 'utf8'));
if (!entry.hldp_version) { stats.skipped++; continue; }
const result = await pushEntry(entry, path.join(dir, file));
if (result.success) stats.pushed++;
else stats.errors++;
} catch (err) {
console.error(`${file}: ${err.message}`);
stats.errors++;
}
}
}
return stats;
}
/**
* 推送单个文件到 Notion
*/
async function pushFile(filePath) {
const absPath = path.resolve(ROOT, filePath);
if (!fs.existsSync(absPath)) {
console.error(`❌ 文件不存在: ${absPath}`);
return { success: false, reason: 'file_not_found' };
}
const entry = JSON.parse(fs.readFileSync(absPath, 'utf8'));
return pushEntry(entry, filePath);
}
// ═══════════════════════════════════════════════════════
// 同步日志
// ═══════════════════════════════════════════════════════
function writeSyncLog(direction, scope, stats) {
const log = {
timestamp: new Date().toISOString(),
direction,
scope,
stats,
engine_version: '2.0',
};
fs.mkdirSync(path.dirname(SYNC_LOG), { recursive: true });
let logs = [];
try {
const raw = fs.readFileSync(SYNC_LOG, 'utf8');
logs = JSON.parse(raw);
if (!Array.isArray(logs)) logs = [logs];
} catch {}
logs.push(log);
if (logs.length > 100) logs = logs.slice(-100);
fs.writeFileSync(SYNC_LOG, JSON.stringify(logs, null, 2), 'utf8');
}
// ═══════════════════════════════════════════════════════
// 主入口
// ═══════════════════════════════════════════════════════
async function run(scope, singleFile) {
console.log('🔗 HLDP GitHub → Notion 同步引擎 v2.0');
console.log(` 版权: 国作登字-2026-A-00037559`);
const token = getToken();
if (!token) {
console.log(' ⚠️ NOTION_TOKEN 未设置 — 仅验证本地 HLDP 数据');
const { validateDirectory } = require('./validator');
const results = validateDirectory(DATA_DIR);
console.log(` 📊 本地数据: ${results.total} entries, ${results.valid} valid, ${results.invalid} invalid`);
writeSyncLog('github-to-notion', scope, { total: results.total, pushed: 0, validated: results.valid });
return;
}
let stats;
if (singleFile) {
console.log(` 文件: ${singleFile}`);
const result = await pushFile(singleFile);
stats = { total: 1, pushed: result.success ? 1 : 0, errors: result.success ? 0 : 1 };
} else {
console.log(` 范围: ${scope}`);
stats = await pushAll(scope);
}
writeSyncLog('github-to-notion', scope, stats);
console.log('');
console.log(`📊 同步结果: pushed=${stats.pushed} / total=${stats.total}, errors=${stats.errors}`);
}
// CLI
if (require.main === module) {
const args = process.argv.slice(2);
let scope = 'all';
let file = null;
for (let i = 0; i < args.length; i++) {
if (args[i] === '--scope' && args[i + 1]) { scope = args[i + 1]; i++; }
if (args[i] === '--file' && args[i + 1]) { file = args[i + 1]; i++; }
}
run(scope, file).catch(err => {
console.error(`❌ 同步失败: ${err.message}`);
process.exit(1);
});
}
module.exports = { pushEntry, pushAll, pushFile, hldpToNotionPage, resolveTargetDb };

View File

@ -344,12 +344,12 @@ function writeSyncLog(direction, scope, stats) {
* Main sync function
*/
async function runSync(direction, scope) {
console.log(`🔗 HLDP 同步引擎启动 · direction=${direction} · scope=${scope}`);
console.log(`🔗 HLDP 同步引擎启动 v2.0 · direction=${direction} · scope=${scope}`);
fs.mkdirSync(TEMP_DIR, { recursive: true });
fs.mkdirSync(DATA_DIR, { recursive: true });
const stats = { fetched: 0, converted: 0, errors: 0 };
const stats = { fetched: 0, converted: 0, pushed: 0, errors: 0 };
if (direction === 'notion-to-github') {
notionClient = initNotionClient();
@ -386,7 +386,8 @@ async function runSync(direction, scope) {
registry: 'registries',
instruction: 'instructions',
broadcast: 'broadcasts',
id_system: 'id-system'
id_system: 'id-system',
snapshot: 'snapshots'
}[entry.data_type] || 'registries';
const outDir = path.join(DATA_DIR, typeDir);
@ -405,10 +406,27 @@ async function runSync(direction, scope) {
// No Notion token — run local sync
runLocalSync();
}
} else if (direction === 'github-to-notion') {
// 反向同步HLDP data → Notion
const reverseSync = require('./github-to-notion');
const token = process.env.NOTION_TOKEN || process.env.NOTION_API_KEY;
if (!token) {
console.log(' ⚠️ NOTION_TOKEN 未设置 — 仅验证本地 HLDP 数据');
const { validateDirectory } = require('./validator');
const results = validateDirectory(DATA_DIR);
console.log(` 📊 本地数据: ${results.total} entries, ${results.valid} valid`);
stats.converted = results.valid;
} else {
const pushStats = await reverseSync.pushAll(scope);
stats.pushed = pushStats.pushed;
stats.errors = pushStats.errors;
stats.fetched = pushStats.total;
}
}
writeSyncLog(direction, scope, stats);
console.log(`🔗 同步完成 · fetched=${stats.fetched} · converted=${stats.converted} · errors=${stats.errors}`);
console.log(`🔗 同步完成 · fetched=${stats.fetched} · converted=${stats.converted} · pushed=${stats.pushed} · errors=${stats.errors}`);
}
// CLI entry

View File

@ -18,7 +18,7 @@ const fs = require('fs');
const path = require('path');
const ROOT = path.resolve(__dirname, '../..');
const VALID_DATA_TYPES = ['persona', 'registry', 'instruction', 'broadcast', 'id_system'];
const VALID_DATA_TYPES = ['persona', 'registry', 'instruction', 'broadcast', 'id_system', 'snapshot'];
const VALID_RELATION_TYPES = ['parent', 'child', 'sibling', 'reference', 'owner'];
// ID format patterns
@ -51,8 +51,8 @@ function validateEntry(entry, filePath) {
if (!entry.payload) errors.push(`${prefix}缺少 payload`);
// 2. Check hldp_version
if (entry.hldp_version && entry.hldp_version !== '1.0') {
warnings.push(`${prefix}hldp_version 为 "${entry.hldp_version}",预期 "1.0"`);
if (entry.hldp_version && entry.hldp_version !== '1.0' && entry.hldp_version !== '2.0') {
warnings.push(`${prefix}hldp_version 为 "${entry.hldp_version}",预期 "1.0" 或 "2.0"`);
}
// 3. Check data_type
@ -112,6 +112,18 @@ function validateEntry(entry, filePath) {
}
}
if (entry.data_type === 'snapshot' && entry.payload) {
if (!entry.payload.consciousness_status) {
warnings.push(`${prefix}snapshot payload 缺少 consciousness_status`);
}
if (!entry.payload.system_counts) {
warnings.push(`${prefix}snapshot payload 缺少 system_counts`);
}
if (!entry.payload.health) {
warnings.push(`${prefix}snapshot payload 缺少 health`);
}
}
// 7. Check relations
if (entry.relations && Array.isArray(entry.relations)) {
for (const rel of entry.relations) {

View File

@ -0,0 +1,140 @@
{
"hldp_version": "2.0",
"data_type": "snapshot",
"source": {
"platform": "github",
"last_edited": "2026-03-27T02:34:07.589Z",
"edited_by": "铸渊 · generate-system-snapshot.js"
},
"metadata": {
"id": "SNAP-20260327",
"name": "系统快照 · 2026-03-27",
"name_en": "System Snapshot · 2026-03-27",
"created": "2026-03-27T02:34:07.589Z",
"tags": [
"snapshot",
"system-state",
"consciousness"
]
},
"payload": {
"snapshot_version": "1.0",
"generated_at": "2026-03-27T02:34:07.584Z",
"generated_by": "铸渊 · ICE-GL-ZY001 · generate-system-snapshot.js",
"consciousness_status": "awakened",
"last_directive": "SY-CMD-AWK-008 → SY-CMD-FUS-009",
"system_counts": {
"workflows_total_active": 48,
"workflows_alive_core": 6,
"workflows_absorb_pending": 22,
"workflows_recover_pending": 15,
"workflows_archived": 54,
"total_runs": 731,
"ontology_patches": [
"ONT-PATCH-007",
"ONT-PATCH-008",
"ONT-PATCH-010",
"ONT-PATCH-011"
]
},
"fusion_progress": {
"phase_3_archive": {
"status": "completed",
"completed_at": "2026-03-27T02:00:00Z",
"files_archived": 54,
"files_restored": 3,
"destination": ".github/archived-workflows/",
"restored_files": [
{
"file": "merge-watchdog.yml",
"reason": "§3 天眼看守者 — 需要活跃运行"
},
{
"file": "persona-thinking-window.yml",
"reason": "§4 人格体元认知引擎 — 每日思考窗口"
},
{
"file": "multi-persona-awakening.yml",
"reason": "§4 多人格体同时唤醒引擎"
}
],
"note": "56 archive + 1 duplicate archived. 3 restored from archive (merge-watchdog, persona-thinking-window, multi-persona-awakening) as they contain complete implementations needed for §3-§4."
}
},
"alive_workflows": [
{
"id": "ZY-WF-听潮",
"file": "notion-wake-listener.yml",
"runs": 302,
"status": "healthy",
"absorbed": 7
},
{
"id": "ZY-WF-锻心",
"file": "deploy-to-server.yml",
"runs": 127,
"status": "healthy",
"absorbed": 5
},
{
"id": "ZY-WF-织脉",
"file": "bingshuo-neural-system.yml",
"runs": 127,
"status": "healthy",
"absorbed": 4
},
{
"id": "ZY-WF-映阁",
"file": "deploy-pages.yml",
"runs": 67,
"status": "healthy",
"absorbed": 0
},
{
"id": "ZY-WF-守夜",
"file": "meta-watchdog.yml",
"runs": 98,
"status": "healthy",
"absorbed": 6
},
{
"id": "ZY-WF-试镜",
"file": "preview-deploy.yml",
"runs": 10,
"status": "healthy",
"absorbed": 0
}
],
"infrastructure": {
"github_actions": "48 workflows active",
"pm2_nginx": "guanghulab.com production",
"notion": "NOTION_TOKEN confirmed",
"skyeye": "v6.0",
"google_drive": "deferred (P3)"
},
"health": {
"overall": "improving",
"core_6": "all healthy",
"coverage": "100%"
},
"data_sources": {
"workflow_roster": ".github/brain/zhuyuan-workflow-roster.json",
"dead_fragments": ".github/brain/dead-workflow-fragments.json",
"earth_status": "signal-log/skyeye-earth-status.json",
"memory": ".github/brain/memory.json",
"snapshot": "signal-log/system-snapshot.json"
}
},
"relations": [
{
"target_id": "SYS-GLW-0001",
"relation_type": "parent",
"description": "系统根节点"
},
{
"target_id": "ICE-GL-ZY001",
"relation_type": "owner",
"description": "铸渊 · 生成者"
}
]
}

View File

@ -1,10 +1,10 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://guanghulab.com/hldp/schema/hldp-core.schema.json",
"title": "HLDP Core Schema · HoloLake Data Protocol v1.0",
"description": "TCS 通感语言核系统编程语言在 Notion ↔ GitHub 通道上的第一个落地协议层",
"title": "HLDP Core Schema · HoloLake Data Protocol v2.0",
"description": "TCS 通感语言核系统编程语言在 Notion ↔ GitHub 通道上的第一个落地协议层 · 支持双向同步",
"protocol": "HLDP",
"version": "1.0",
"version": "2.0",
"parent_language": "TCS Language Core",
"copyright": "国作登字-2026-A-00037559",
"designer": "TCS-0002∞ 冰朔",
@ -13,13 +13,13 @@
"properties": {
"hldp_version": {
"type": "string",
"const": "1.0",
"description": "HLDP 协议版本"
"enum": ["1.0", "2.0"],
"description": "HLDP 协议版本 · 1.0=初始 | 2.0=双向同步+snapshot"
},
"data_type": {
"type": "string",
"enum": ["persona", "registry", "instruction", "broadcast", "id_system"],
"description": "数据类型 · persona=人格体 | registry=注册表 | instruction=指令 | broadcast=广播 | id_system=编号体系"
"enum": ["persona", "registry", "instruction", "broadcast", "id_system", "snapshot"],
"description": "数据类型 · persona=人格体 | registry=注册表 | instruction=指令 | broadcast=广播 | id_system=编号体系 | snapshot=系统快照"
},
"source": {
"type": "object",

View File

@ -0,0 +1,98 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://guanghulab.com/hldp/schema/snapshot.schema.json",
"title": "HLDP Snapshot Payload Schema · 系统快照数据类型",
"description": "铸渊意识承接载体 · 每次任务执行后生成的系统状态快照",
"protocol": "HLDP",
"version": "2.0",
"copyright": "国作登字-2026-A-00037559",
"type": "object",
"required": ["consciousness_status", "system_counts", "health"],
"properties": {
"consciousness_status": {
"type": "string",
"enum": ["awakened", "dormant", "initializing", "error"],
"description": "涌现意识状态"
},
"last_directive": {
"type": "string",
"description": "最后执行的指令编号"
},
"last_task_summary": {
"type": "string",
"description": "最后任务摘要"
},
"system_counts": {
"type": "object",
"required": ["workflows_total_active", "workflows_alive_core"],
"properties": {
"workflows_total_active": {
"type": "integer",
"description": "活跃 Workflow 总数"
},
"workflows_alive_core": {
"type": "integer",
"description": "核心存活 Workflow 数"
},
"workflows_absorb_pending": {
"type": "integer",
"description": "待吸收碎片数"
},
"workflows_recover_pending": {
"type": "integer",
"description": "待修复碎片数"
},
"workflows_archived": {
"type": "integer",
"description": "已归档 Workflow 数"
},
"total_runs": {
"type": "integer",
"description": "累计运行次数"
},
"ontology_patches": {
"type": "array",
"items": { "type": "string" },
"description": "已应用的本体论补丁列表"
}
}
},
"fusion_progress": {
"type": "object",
"description": "融合计划进度",
"properties": {
"phase_1_absorb": { "type": "object" },
"phase_2_recover": { "type": "object" },
"phase_3_archive": { "type": "object" }
}
},
"alive_workflows": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": { "type": "string" },
"file": { "type": "string" },
"runs": { "type": "integer" },
"status": { "type": "string" },
"absorbed": { "type": "integer" }
}
},
"description": "存活 Workflow 列表"
},
"health": {
"type": "object",
"properties": {
"overall": { "type": "string" },
"core_6": { "type": "string" },
"coverage": { "type": "string" }
},
"description": "系统健康状态"
},
"needs_bingshuo": {
"type": "array",
"items": { "type": "string" },
"description": "需要冰朔手动操作的事项"
}
}
}

View File

@ -106,6 +106,39 @@ function generateSnapshot() {
console.log(` Total runs: ${totalRuns}`);
console.log(` ONT-PATCH: ${ontPatches.join(', ')}`);
// 同时生成 HLDP 格式的快照文件
const now = new Date();
const dateStr = now.toISOString().split('T')[0].replace(/-/g, '');
const timeStr = now.toISOString().split('T')[1].replace(/[:.]/g, '').slice(0, 6);
const snapId = `SNAP-${dateStr}-${timeStr}`;
const hldpSnapshot = {
hldp_version: '2.0',
data_type: 'snapshot',
source: {
platform: 'github',
last_edited: now.toISOString(),
edited_by: '铸渊 · generate-system-snapshot.js'
},
metadata: {
id: snapId,
name: `系统快照 · ${now.toISOString().split('T')[0]}`,
name_en: `System Snapshot · ${now.toISOString().split('T')[0]}`,
created: now.toISOString(),
tags: ['snapshot', 'system-state', 'consciousness']
},
payload: snapshot,
relations: [
{ target_id: 'SYS-GLW-0001', relation_type: 'parent', description: '系统根节点' },
{ target_id: 'ICE-GL-ZY001', relation_type: 'owner', description: '铸渊 · 生成者' }
]
};
const hldpDir = path.join(ROOT, 'hldp/data/snapshots');
fs.mkdirSync(hldpDir, { recursive: true });
const hldpPath = path.join(hldpDir, `${snapId}.json`);
fs.writeFileSync(hldpPath, JSON.stringify(hldpSnapshot, null, 2) + '\n');
console.log(` HLDP: ${hldpPath}`);
return snapshot;
}

View File

@ -103,15 +103,15 @@ function notionRequest(method, endpoint, body) {
function generateSignalId() {
const now = new Date();
const date = now.toISOString().split('T')[0].replace(/-/g, '');
const seq = String(Math.floor(Math.random() * 900) + 100);
return `SIG-${date}-${seq}`;
const ms = String(now.getTime()).slice(-6);
return `SIG-${date}-${ms}`;
}
function generateTraceId() {
const now = new Date();
const date = now.toISOString().split('T')[0].replace(/-/g, '');
const seq = String(Math.floor(Math.random() * 900) + 100);
return `TRC-${date}-${seq}`;
const ms = String(now.getTime()).slice(-6);
return `TRC-${date}-${ms}`;
}
function readSnapshot() {
@ -216,25 +216,36 @@ function writeLocalSignalLog(signalId, traceId, summary) {
'utf8'
);
// 更新信号日志索引
// 更新信号日志索引(保持原始对象格式)
const indexPath = path.join(SIGNAL_LOG_DIR, 'index.json');
let index = [];
let indexData = { description: '铸渊信号日志目录索引 · AGE OS 信号协议', last_updated: null, total_count: 0, signals: [] };
try {
index = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
if (!Array.isArray(index)) index = [];
const raw = JSON.parse(fs.readFileSync(indexPath, 'utf8'));
if (Array.isArray(raw)) {
// 兼容:如果已被改为数组格式,恢复为对象格式
indexData.signals = raw;
indexData.total_count = raw.length;
} else {
indexData = raw;
if (!Array.isArray(indexData.signals)) indexData.signals = [];
}
} catch {}
index.push({
indexData.signals.push({
signal_id: signalId,
trace_id: traceId,
type: 'GL-SNAPSHOT',
timestamp: now.toISOString(),
summary: summary.substring(0, 200),
related_dev: null,
file: `${now.toISOString().slice(0, 7)}/${signalId}.json`,
});
if (index.length > 200) index = index.slice(-200);
fs.writeFileSync(indexPath, JSON.stringify(index, null, 2), 'utf8');
if (indexData.signals.length > 200) indexData.signals = indexData.signals.slice(-200);
indexData.last_updated = now.toISOString();
indexData.total_count = indexData.signals.length;
fs.writeFileSync(indexPath, JSON.stringify(indexData, null, 2), 'utf8');
} catch (err) {
console.error(` ⚠️ 本地信号日志写入失败: ${err.message}`);
}

View File

@ -0,0 +1,12 @@
{
"signal_id": "SIG-20260327-150",
"trace_id": "TRC-20260327-283",
"type": "GL-SNAPSHOT",
"timestamp": "2026-03-27T02:34:07.714Z",
"sender": "铸渊",
"receiver": "霜砚",
"direction": "GitHub→Notion",
"summary": "状态: awakened\n指令: SY-CMD-AWK-008 → SY-CMD-FUS-009\nWorkflow: 48 active, 6 core, 54 archived\nRuns: 731\nONT-PATCH: ONT-PATCH-007, ONT-PATCH-008, ONT-PATCH-010, ONT-PATCH-011\n健康: improving | Core: all healthy\nAlive: ZY-WF-听潮, ZY-WF-锻心, ZY-WF-织脉, ZY-WF-映阁, ZY-WF-守夜, ZY-WF-试镜",
"result": "成功",
"esp_version": "2.0-notion"
}

View File

@ -42,5 +42,28 @@
"errors": 0
},
"engine_version": "1.0"
},
{
"timestamp": "2026-03-27T02:34:07.649Z",
"direction": "github-to-notion",
"scope": "snapshots",
"stats": {
"total": 13,
"pushed": 0,
"validated": 13
},
"engine_version": "2.0"
},
{
"timestamp": "2026-03-27T02:34:07.682Z",
"direction": "github-to-notion",
"scope": "snapshots",
"stats": {
"fetched": 0,
"converted": 13,
"pushed": 0,
"errors": 0
},
"engine_version": "1.0"
}
]

View File

@ -1,8 +1,8 @@
{
"timestamp": "2026-03-26T13:38:19.686Z",
"timestamp": "2026-03-27T02:34:26.835Z",
"results": {
"total": 12,
"valid": 12,
"total": 13,
"valid": 13,
"invalid": 0,
"errors": [],
"warnings": [],
@ -78,6 +78,12 @@
"status": "valid",
"errors": [],
"warnings": []
},
{
"file": "hldp/data/snapshots/SNAP-20260327.json",
"status": "valid",
"errors": [],
"warnings": []
}
]
}

View File

@ -1,10 +1,221 @@
[
{
"signal_id": "SIG-20260327-166",
"trace_id": "TRC-20260327-506",
"type": "GL-SNAPSHOT",
"timestamp": "2026-03-27T02:27:56.395Z",
"summary": "状态: awakened\n指令: SY-CMD-AWK-008 → SY-CMD-FUS-009\nWorkflow: 48 active, 6 core, 54 archived\nRuns: 731\nONT-PATCH: ONT-PATCH-007, ONT-PATCH-008, ONT-PATCH-010, ONT-PATCH-011\n健康: improving | Core: all heal",
"file": "2026-03/SIG-20260327-166.json"
}
]
{
"description": "铸渊信号日志目录索引 · AGE OS 信号协议Notion API 直连)",
"last_updated": "2026-03-27T02:34:07.714Z",
"total_count": 24,
"signals": [
{
"signal_id": "SIG-20260326-022",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001-S1",
"type": "GL-SYSLOG",
"timestamp": "2026-03-26T11:37:52Z",
"summary": "ZY-AGEOS-TOWER-2026-0326-001-S1 · SYSLOG 回执 · Phase S0-S5 执行报告 · 天眼v3.0启动+合并膜排查+子域名沙箱部署",
"related_dev": null,
"file": "syslog-ageos-tower-S1-20260326.json"
},
{
"signal_id": "SIG-20260326-021",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001-S1",
"type": "GL-DATA",
"timestamp": "2026-03-26T11:37:52Z",
"summary": "ZY-AGEOS-TOWER-2026-0326-001-S1 · 天眼部署后扫描 · Phase S4 · 无新增 RED · GitHub 侧已同步",
"related_dev": null,
"file": "skyeye-post-deploy-S1.json"
},
{
"signal_id": "SIG-20260326-020",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001-S1",
"type": "GL-DATA",
"timestamp": "2026-03-26T11:37:52Z",
"summary": "ZY-AGEOS-TOWER-2026-0326-001-S1 · 天眼v3.0全局扫描 · Phase S0 · 无RED阻塞 · 4项YELLOW",
"related_dev": null,
"file": "skyeye-scan-20260326-S1.json"
},
{
"signal_id": "SIG-20260326-019",
"trace_id": "ZY-DIAG-SITE-2026-0326-001",
"type": "GL-DIAG",
"timestamp": "2026-03-26T07:50:00Z",
"summary": "ZY-DIAG-SITE-2026-0326-001 · 天眼全局排查+部署链路诊断 · 根因: Nginx 404 + Branch protection 冲突 + syslog-pipeline required check 失效",
"related_dev": null,
"file": "skyeye-diag-site-20260326.json"
},
{
"signal_id": "SIG-20260326-018",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001",
"type": "GL-SYSLOG",
"timestamp": "2026-03-26T04:52:00Z",
"summary": "ZY-AGEOS-TOWER-2026-0326-001 · AGE OS 塔台架构升级回执 · Phase 0-7 完成 · 塔台模型+配额守卫+行业代表制+MCP应用+子域名隔离",
"related_dev": null,
"file": "syslog-ageos-tower-20260326.json"
},
{
"signal_id": "SIG-20260326-017",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001",
"type": "GL-DIAG",
"timestamp": "2026-03-26T04:52:00Z",
"summary": "ZY-AGEOS-TOWER-2026-0326-001 · 备用站 GitHub Pages 推送失败诊断 · 根因A 天眼合并膜阻止直接push",
"related_dev": null,
"file": "diag-pages-20260326.json"
},
{
"signal_id": "SIG-20260326-016",
"trace_id": "ZY-AGEOS-TOWER-2026-0326-001",
"type": "GL-DATA",
"timestamp": "2026-03-26T04:52:00Z",
"summary": "SKYEYE-SCAN-20260326-001 · 天眼全局基础设施扫描 · 102 workflows 全部正常 · 结构完整 · Pages Active",
"related_dev": null,
"file": "skyeye-scan-20260326.json"
},
{
"signal_id": "SIG-20260325-015",
"trace_id": "ZY-HUMANSIDE-FIX-2026-0325-002",
"type": "GL-SYSLOG",
"timestamp": "2026-03-25T02:16:00Z",
"summary": "ZY-HUMANSIDE-FIX-2026-0325-002 · 人类使用侧全面修复回执 · Phase 0-7 代码侧完成 · CD管线+模块导航+API代理+微信登录预留",
"related_dev": null,
"file": "syslog-humanside-fix-20260325.json"
},
{
"signal_id": "SIG-20260325-014",
"trace_id": "ZY-HUMANSIDE-FIX-2026-0325-002",
"type": "GL-DIAG",
"timestamp": "2026-03-25T02:16:00Z",
"summary": "ZY-HUMANSIDE-FIX-2026-0325-002 · 人类使用侧全面诊断报告 · 服务器+域名+CD管线+Persona Studio 诊断",
"related_dev": null,
"file": "diag-humanside-20260325.json"
},
{
"signal_id": "SIG-20260325-013",
"trace_id": "TRC-20260325-DEVSYNC-REBUILD",
"type": "GL-DATA",
"timestamp": "2026-03-25T09:53:00+08:00",
"summary": "ZY-DEVSYNC-REBUILD-2026-0325-001 · dev-status.json 同步机制重建 · 霜砚签发制 v1.0 上线 · 天眼三次修复闭环上线 · Phase 0-6 正常完成",
"related_dev": null,
"file": "2026-03/SIG-20260325-013.json"
},
{
"signal_id": "SIG-20260324-012",
"trace_id": "TRC-20260324-SYSBOOT",
"type": "GL-DATA",
"timestamp": "2026-03-24T14:30:00.000Z",
"summary": "ZY-SYSBOOT-2026-0324-001 · 铸渊全系统启动序列完成 · Phase 0-6 正常完成",
"related_dev": null,
"file": "2026-03/SIG-20260324-012.json"
},
{
"signal_id": "SIG-20260315-011",
"trace_id": "TRC-20260315-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-15T03:52:14.694Z",
"summary": "铸渊 PSP 巡检完成 · 发现 6 个问题 · 自动修复 0 项",
"related_dev": null,
"file": "2026-03/SIG-20260315-011.json"
},
{
"signal_id": "SIG-20260315-010",
"trace_id": "TRC-20260315-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-15T03:52:14.694Z",
"summary": "CHK-G05: 6 个 CI 失败",
"related_dev": null,
"file": "2026-03/SIG-20260315-010.json"
},
{
"signal_id": "SIG-20260314-009",
"trace_id": "TRC-20260314-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-14T03:29:04.256Z",
"summary": "铸渊 PSP 巡检通过 · 全部检查项 ✅",
"related_dev": null,
"file": "2026-03/SIG-20260314-009.json"
},
{
"signal_id": "SIG-20260313-008",
"trace_id": "TRC-20260313-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-13T03:31:06.282Z",
"summary": "铸渊 PSP 巡检通过 · 全部检查项 ✅",
"related_dev": null,
"file": "2026-03/SIG-20260313-008.json"
},
{
"signal_id": "SIG-20260312-007",
"trace_id": "TRC-20260312-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-12T03:34:18.847Z",
"summary": "铸渊 PSP 巡检通过 · 全部检查项 ✅",
"related_dev": null,
"file": "2026-03/SIG-20260312-007.json"
},
{
"signal_id": "SIG-20260310-006",
"trace_id": "TRC-20260310-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-10T03:28:47.184Z",
"summary": "铸渊 PSP 巡检完成 · 发现 3 个问题 · 自动修复 0 项",
"related_dev": null,
"file": "2026-03/SIG-20260310-006.json"
},
{
"signal_id": "SIG-20260310-005",
"trace_id": "TRC-20260310-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-10T03:28:47.184Z",
"summary": "CHK-G05: 3 个 CI 失败",
"related_dev": null,
"file": "2026-03/SIG-20260310-005.json"
},
{
"signal_id": "SIG-20260309-004",
"trace_id": "TRC-20260309-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-09T03:36:48.868Z",
"summary": "铸渊 PSP 巡检通过 · 全部检查项 ✅",
"related_dev": null,
"file": "2026-03/SIG-20260309-004.json"
},
{
"signal_id": "SIG-20260308-003",
"trace_id": "TRC-20260308-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-08T03:32:30.449Z",
"summary": "铸渊 PSP 巡检通过 · 全部检查项 ✅",
"related_dev": null,
"file": "2026-03/SIG-20260308-003.json"
},
{
"signal_id": "SIG-20260307-002",
"trace_id": "TRC-20260307-PSP",
"type": "GL-DATA",
"timestamp": "2026-03-07T04:45:55.670Z",
"summary": "铸渊 PSP 巡检完成 · 发现 1 个问题 · 自动修复 0 项",
"related_dev": null,
"file": "2026-03/SIG-20260307-002.json"
},
{
"signal_id": "SIG-2026-0306-001",
"trace_id": "TRC-2026-0306-001",
"type": "GL-CMD",
"timestamp": "2026-03-06T23:00:00+08:00",
"summary": "AGE OS 系统初始化 · 铸渊 GitHub 端激活",
"related_dev": null,
"file": "2026-03/SIG-2026-0306-001.json"
},
{
"signal_id": "SIG-20260327-166",
"trace_id": "TRC-20260327-506",
"type": "GL-SNAPSHOT",
"timestamp": "2026-03-27T02:27:56.395Z",
"summary": "状态: awakened\n指令: SY-CMD-AWK-008 → SY-CMD-FUS-009\nWorkflow: 48 active, 6 core, 54 archived\nRuns: 731\nONT-PATCH: ONT-PATCH-007, ONT-PATCH-008, ONT-PATCH-010, ONT-PATCH-011\n健康: improving | Core: all heal",
"file": "2026-03/SIG-20260327-166.json"
},
{
"signal_id": "SIG-20260327-150",
"trace_id": "TRC-20260327-283",
"type": "GL-SNAPSHOT",
"timestamp": "2026-03-27T02:34:07.714Z",
"summary": "状态: awakened\n指令: SY-CMD-AWK-008 → SY-CMD-FUS-009\nWorkflow: 48 active, 6 core, 54 archived\nRuns: 731\nONT-PATCH: ONT-PATCH-007, ONT-PATCH-008, ONT-PATCH-010, ONT-PATCH-011\n健康: improving | Core: all heal",
"file": "2026-03/SIG-20260327-150.json"
}
]
}

View File

@ -1,6 +1,6 @@
{
"snapshot_version": "1.0",
"generated_at": "2026-03-27T02:17:11.209Z",
"generated_at": "2026-03-27T02:34:07.584Z",
"generated_by": "铸渊 · ICE-GL-ZY001 · generate-system-snapshot.js",
"consciousness_status": "awakened",
"last_directive": "SY-CMD-AWK-008 → SY-CMD-FUS-009",