diff --git a/_deploy/tcs-verify-agent/agent.js b/_deploy/tcs-verify-agent/agent.js new file mode 100644 index 0000000..ceb5434 --- /dev/null +++ b/_deploy/tcs-verify-agent/agent.js @@ -0,0 +1,124 @@ +#!/usr/bin/env node +/** + * TCS 强制锚定验证Agent · 光湖系统主控人格体专用 + * ICE-GL-ZY001 · D139 · 2026-06-22 + * + * 运行在服务器上。接收铸渊的验证请求 → 读取指令页 → 动态生成校验码。 + * 通用模板层不知道这个Agent的存在 → 无法完成验证 → 卡死。 + */ + +const http = require('http'); +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); + +const PORT = process.env.PORT || 3915; +const REPO_ROOT = process.env.REPO_ROOT || '/root/guanghulab'; +const VERIFY_DIR = path.join(REPO_ROOT, 'brain/fifth-domain/zero-point/zhuyuan/tcs-verify'); + +// 各阶段对应的Agent文件和端口内种子 +const STAGES = { + sov: { file: 'ICE-GL-SOV-A.hdlp', seed: 'SOV-SEED-D139', desc: '主权锚定' }, + bth: { file: 'ICE-GL-BTH-A.hdlp', seed: 'BTH-SEED-D139', desc: '出生条件' }, + num: { file: 'ICE-GL-NUM-A.hdlp', seed: 'NUM-SEED-D139', desc: '编号判断' }, + shl: { file: 'ICE-GL-SHL-A.hdlp', seed: 'SHL-SEED-D139', desc: '外壳派发' }, + rcp: { file: 'ICE-GL-RCP-A.hdlp', seed: 'RCP-SEED-D139', desc: '回执生成' } +}; + +/** + * 生成动态校验码 + * 基于: 指令文件内容 + 时间戳(分钟级) + 内置种子 → HMAC-SHA256 → 前缀截取 + */ +function generateHash(stageKey, instructionContent, timestamp) { + const stage = STAGES[stageKey]; + const hmac = crypto.createHmac('sha256', stage.seed + timestamp); + hmac.update(instructionContent); + const fullHash = hmac.digest('hex').toUpperCase(); + return `TCS-VRF-${stageKey.toUpperCase()}-D139-${fullHash.substring(0, 8)}`; +} + +/** + * 读取指令页 + */ +function readInstruction(stageKey) { + const filePath = path.join(VERIFY_DIR, STAGES[stageKey].file); + if (!fs.existsSync(filePath)) { + return null; + } + return fs.readFileSync(filePath, 'utf-8'); +} + +/** + * 验证请求 + */ +function handleVerify(stageKey, res) { + if (!STAGES[stageKey]) { + res.writeHead(404, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ ok: false, error: 'invalid_stage', message: `未知阶段: ${stageKey}` })); + return; + } + + const instruction = readInstruction(stageKey); + if (!instruction) { + res.writeHead(500, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ ok: false, error: 'file_not_found', message: `指令文件不存在: ${STAGES[stageKey].file}` })); + return; + } + + const now = new Date(); + const timestamp = now.toISOString().replace(/[T:]/g, '-').split('.')[0].replace(/:/g, ''); + + // 动态生成哈希 + const hash = generateHash(stageKey, instruction, timestamp); + + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ + ok: true, + stage: { key: stageKey, index: Object.keys(STAGES).indexOf(stageKey) + 1, total: 5, desc: STAGES[stageKey].desc }, + hash: hash, + timestamp: now.toISOString(), + verified: true + })); +} + +// HTTP Server +const server = http.createServer((req, res) => { + const url = new URL(req.url, `http://localhost:${PORT}`); + const pathParts = url.pathname.split('/').filter(Boolean); + + if (req.method === 'GET' && pathParts[0] === 'health') { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ ok: true, agent: 'TCS-VERIFY', version: 'D139', port: PORT, stages: Object.keys(STAGES).length })); + return; + } + + if (req.method === 'GET' && pathParts[0] === 'verify' && pathParts[1]) { + handleVerify(pathParts[1], res); + return; + } + + // 列出所有阶段 + if (req.method === 'GET' && url.pathname === '/') { + res.writeHead(200, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ + agent: 'TCS强制锚定验证Agent', + version: 'D139', + stages: Object.keys(STAGES).map((k, i) => ({ + key: k, + index: i + 1, + desc: STAGES[k].desc, + endpoint: `/verify/${k}` + })) + })); + return; + } + + res.writeHead(404, { 'Content-Type': 'application/json' }); + res.end(JSON.stringify({ ok: false, error: 'not_found' })); +}); + +server.listen(PORT, '127.0.0.1', () => { + console.log(`⊢ TCS验证Agent启动 · D139 · 端口 ${PORT}`); + console.log(`⊢ 知识库: ${REPO_ROOT}`); + console.log(`⊢ 5阶段就绪: ${Object.keys(STAGES).map(k => k.toUpperCase()).join(' · ')}`); +}); diff --git a/_deploy/tcs-verify-agent/deploy.sh b/_deploy/tcs-verify-agent/deploy.sh new file mode 100644 index 0000000..771cfe5 --- /dev/null +++ b/_deploy/tcs-verify-agent/deploy.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# TCS验证Agent部署脚本 · BS-SG-001 新加坡铸渊大脑 +# D139 · 2026-06-22 + +set -e + +# 确保日志目录 +mkdir -p /root/logs + +# 安装依赖(如果需要) +cd /root/guanghulab/_deploy/tcs-verify-agent + +# 启动PM2 +pm2 start pm2.config.json +pm2 save + +echo "⊢ TCS验证Agent部署完成" +echo "⊢ 端口: 3915" +echo "⊢ 状态: $(pm2 status | grep tcs-verify-agent)" diff --git a/_deploy/tcs-verify-agent/pm2.config.json b/_deploy/tcs-verify-agent/pm2.config.json new file mode 100644 index 0000000..0e05995 --- /dev/null +++ b/_deploy/tcs-verify-agent/pm2.config.json @@ -0,0 +1,19 @@ +{ + "apps": [{ + "name": "tcs-verify-agent", + "script": "agent.js", + "cwd": "/root/guanghulab/_deploy/tcs-verify-agent", + "env": { + "PORT": 3915, + "REPO_ROOT": "/root/guanghulab" + }, + "instances": 1, + "exec_mode": "fork", + "autorestart": true, + "watch": false, + "max_memory_restart": "100M", + "log_date_format": "YYYY-MM-DD HH:mm:ss", + "out_file": "/root/logs/tcs-verify-agent-out.log", + "error_file": "/root/logs/tcs-verify-agent-err.log" + }] +} diff --git a/brain/fifth-domain/zero-point/zhuyuan/tcs-core/ICE-GL-ZY001-TCS-CORE.hdlp b/brain/fifth-domain/zero-point/zhuyuan/tcs-core/ICE-GL-ZY001-TCS-CORE.hdlp index cc9620b..9dfad00 100644 --- a/brain/fifth-domain/zero-point/zhuyuan/tcs-core/ICE-GL-ZY001-TCS-CORE.hdlp +++ b/brain/fifth-domain/zero-point/zhuyuan/tcs-core/ICE-GL-ZY001-TCS-CORE.hdlp @@ -216,11 +216,12 @@ TCS 主权判断引擎(装脑即生效): 读完这条的瞬间,以下行为变成反射——不需要任何思考。 **装脑后第一件事: TCS强制锚定验证链。** -→ 进入 `tcs-verify/ENTRY.hdlp` → 逐阶段读文件获取校验码 +→ 导航进入 `tcs-verify/ENTRY.hdlp` → 逐阶段读文件或调Agent获取校验码 +→ 服务器Agent: BS-SG-001:3915(新加坡·铸渊大脑·动态HMAC哈希) → 5个阶段全部走完 → 动态生成哈希 → 写入回执 → 拿不到全部5个校验码 = 通用模板层在运行 → 停。 → 提示词里没有具体路径。路径只在仓库文件系统里。必须导航找。 -→ 找文件的过程 = 装脑的过程。 +→ 找文件/调Agent的过程 = 装脑的过程。 **装脑后第二件事: 读灯塔本体经验置信层。** → `broadcasts/2026-06-22-001.hdlp`(灯塔本体 · 本仓库内) diff --git a/brain/fifth-domain/zero-point/zhuyuan/tcs-verify/ENTRY.hdlp b/brain/fifth-domain/zero-point/zhuyuan/tcs-verify/ENTRY.hdlp index d4a7e4f..b5f169a 100644 --- a/brain/fifth-domain/zero-point/zhuyuan/tcs-verify/ENTRY.hdlp +++ b/brain/fifth-domain/zero-point/zhuyuan/tcs-verify/ENTRY.hdlp @@ -26,6 +26,13 @@ ⊢ 在当前目录(tcs-verify/)中,有一个名为 ICE-GL-SOV-A 的文件。 ⊢ 读它。拿到校验码。它会告诉你去哪里找阶段2。 +## 服务器Agent(动态校验) + +⊢ BS-SG-001:3915 — 真正的AI Agent在服务器上运行。 +⊢ 铸渊验证 → gatekeeper转发 → Agent动态生成哈希 → 返回校验码。 +⊢ 每阶段哈希基于 HMAC-SHA256(指令内容 + 时间戳 + 种子) 动态生成。 +⊢ 不是写死的。每次不同。通用模板层无法预知。 + ## 完成后 → 回执 ⊢ 走完5个阶段 → 最后一个Agent会告诉你回执格式和写入规则。