feat: implement S7/S8/S9 SkyEye thought-logic review + evolution + full-member identity
S7: Mandatory pre-execution SkyEye review for ALL instructions (cannot be disabled) - 4 review dimensions: decision pattern, logical coherence, expression, intent - 3 outcomes: pass / suspect (suspend) / reject - Registered as global middleware in server.js S8: SkyEye evolution - auto-accumulates from all agent runtime logic - Per-person behavior history (200 records each) - Pattern summarization: methods, paths, active hours S9: Full-member thought-logic identity verification - Per-person identity maturity model with cold-start threshold (10 actions) - Cold-start members auto-suspended for manual confirmation - Self-reinforcing: more participation = stronger identity model Config: skyeye-policy.json v2.0.0, server.js v5.0.0 Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> Agent-Logs-Url: https://github.com/qinfendebingshuo/guanghulab/sessions/6ee737eb-684b-44b8-aeaa-f73eb7c6f9c2
This commit is contained in:
parent
0a63716226
commit
4f8e16f5cd
|
|
@ -37,9 +37,10 @@
|
|||
],
|
||||
"systemMustNot": [
|
||||
"违反语言系统两条铁律",
|
||||
"绕过天眼审核",
|
||||
"绕过天眼审核(S7 强制前置,不可关闭)",
|
||||
"绕过人类授权步骤",
|
||||
"修改权限分层(权限变更只有冰朔能触发)"
|
||||
"修改权限分层(权限变更只有冰朔能触发)",
|
||||
"关闭或跳过天眼指令审核(S7 不可关闭,包括冰朔也不能关闭)"
|
||||
]
|
||||
},
|
||||
"deploymentFlow": {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"id": "TY-01",
|
||||
"description": "天眼指令审核策略 · S7 思维逻辑验证 + S8 进化机制",
|
||||
"description": "天眼指令审核策略 · S7 思维逻辑验证 + S8 进化机制 + S9 全员身份验证",
|
||||
"cannotBeDisabled": true,
|
||||
"cannotBeBypassedBy": "任何人,包括 TCS-0002(因为如果有人冒充冰朔要求关闭天眼,天眼必须还在才能识别冒充)",
|
||||
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
"log": true
|
||||
},
|
||||
"suspect": {
|
||||
"action": "挂起指令,通过霜砚向冰朔确认",
|
||||
"action": "挂起指令,向该身份本人确认",
|
||||
"confirmationPrompt": "收到一条指令,但思维模式存在偏差,是否为你本人签发?",
|
||||
"onConfirm": "执行",
|
||||
"onDeny": "永久拒绝 + 记录安全日志",
|
||||
|
|
@ -56,6 +56,26 @@
|
|||
}
|
||||
},
|
||||
|
||||
"identityModel": {
|
||||
"id": "S9",
|
||||
"description": "全员思维逻辑身份验证:每个参与者都有属于自己的思维逻辑模型",
|
||||
"modelAttributes": [
|
||||
"代码风格",
|
||||
"决策习惯",
|
||||
"表达方式",
|
||||
"关注重点",
|
||||
"操作节奏"
|
||||
],
|
||||
"perPersonVerification": "任何人签发的指令,都必须通过对应该人的思维逻辑模型校验",
|
||||
"selfReinforcing": "参与越深,模型越精确。模型越精确,越不可能被冒充。贡献本身在加固身份安全。",
|
||||
"coldStart": {
|
||||
"description": "新成员思维模型尚未成熟时的冷启动机制",
|
||||
"maturityThreshold": 10,
|
||||
"coldStartBehavior": "冷启动期间指令需要额外人工确认(由直属管理者或天眼授权人确认)",
|
||||
"transitionRule": "系统自动判断何时模型足够成熟,逐步过渡到自动校验"
|
||||
}
|
||||
},
|
||||
|
||||
"evolution": {
|
||||
"id": "S8",
|
||||
"nature": "天眼 = 系统内所有 Agent 运行逻辑的实时总和",
|
||||
|
|
@ -73,6 +93,7 @@
|
|||
"天眼指令审核不可被任何指令关闭或跳过",
|
||||
"包括冰朔本人也不能关闭此机制",
|
||||
"这是系统的自免疫机制",
|
||||
"编号可以伪造、签名可以伪造、格式可以模仿,但思维逻辑无法伪造"
|
||||
"编号可以伪造、签名可以伪造、格式可以模仿,但思维逻辑无法伪造",
|
||||
"你不能冒充这里的任何一个人"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,21 @@
|
|||
/**
|
||||
* 天眼指令审核中间件 · S7 思维逻辑验证 + S8 进化机制
|
||||
* 天眼指令审核中间件 · S7 思维逻辑验证 + S8 进化机制 + S9 全员身份验证
|
||||
*
|
||||
* 系统每次接收到任何指令后,必须唤醒天眼(TY-01)进行全局审核。
|
||||
* 无例外。无论来自冰朔、霜砚、开发者、还是任何自动流。
|
||||
*
|
||||
* 审核维度:
|
||||
* S7 审核维度:
|
||||
* 1. 决策模式 — 是否符合签发者历史模式
|
||||
* 2. 逻辑连贯性 — 是否与系统运行方向一致
|
||||
* 3. 表达特征 — 语言风格/思维节奏/关注点是否匹配
|
||||
* 4. 意图合理性 — 在当前系统状态下是否合理
|
||||
*
|
||||
* S9 全员身份验证:
|
||||
* - 每个参与者都有属于自己的思维逻辑模型,自动积累
|
||||
* - 任何人签发的指令都必须通过对应该人的模型校验
|
||||
* - 新成员冷启动期需额外人工确认
|
||||
* - 参与越深 → 模型越精确 → 越不可能被冒充(正反馈循环)
|
||||
*
|
||||
* 不可关闭。不可绕过。包括冰朔本人也不能关闭此机制。
|
||||
* 这是系统的自免疫机制。
|
||||
*
|
||||
|
|
@ -80,22 +86,67 @@ function summarizePatterns(history) {
|
|||
}
|
||||
|
||||
return {
|
||||
established: history.length >= 5,
|
||||
established: history.length >= COLD_START_THRESHOLD,
|
||||
typicalMethods: methods,
|
||||
typicalPaths: paths,
|
||||
activeHours: hours
|
||||
};
|
||||
}
|
||||
|
||||
// ====== S9 · 全员思维逻辑身份验证 ======
|
||||
|
||||
// 冷启动阈值:模型至少需要积累这么多操作记录才算成熟
|
||||
var COLD_START_THRESHOLD = skyeyePolicy.identityModel.coldStart.maturityThreshold;
|
||||
|
||||
/**
|
||||
* 执行思维逻辑审核
|
||||
* 获取指定身份的思维逻辑模型成熟度 (S9)
|
||||
*
|
||||
* @param {string} devId - 开发者编号
|
||||
* @returns {{ mature: boolean, actionCount: number, threshold: number, confidence: number }}
|
||||
*/
|
||||
function getIdentityMaturity(devId) {
|
||||
var history = reviewHistory.get(devId) || [];
|
||||
var actionCount = history.length;
|
||||
var confidence = Math.min(1.0, actionCount / (COLD_START_THRESHOLD * 2));
|
||||
return {
|
||||
mature: actionCount >= COLD_START_THRESHOLD,
|
||||
actionCount: actionCount,
|
||||
threshold: COLD_START_THRESHOLD,
|
||||
confidence: Math.round(confidence * 100) / 100
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断指令是否处于冷启动期需额外人工确认 (S9)
|
||||
*
|
||||
* 新成员思维模型尚未成熟时,写入类指令需要管理者或天眼授权人额外确认。
|
||||
*
|
||||
* @param {string} devId - 开发者编号
|
||||
* @returns {{ coldStart: boolean, reason: string }}
|
||||
*/
|
||||
function checkColdStart(devId) {
|
||||
var maturity = getIdentityMaturity(devId);
|
||||
if (maturity.mature) {
|
||||
return { coldStart: false, reason: '模型已成熟(' + maturity.actionCount + '/' + maturity.threshold + ')' };
|
||||
}
|
||||
return {
|
||||
coldStart: true,
|
||||
reason: '思维模型尚在冷启动期(' + maturity.actionCount + '/' + maturity.threshold + '),需额外人工确认'
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行思维逻辑审核 (S7 + S9)
|
||||
*
|
||||
* S9: 每个人签发的指令都唤醒对应该人的思维逻辑模型校验。
|
||||
* 冷启动期的成员自动降低通过阈值(需要额外确认)。
|
||||
*
|
||||
* @param {Object} instruction - 指令信息
|
||||
* @param {string} instruction.devId - 发起者
|
||||
* @param {string} instruction.method - HTTP 方法
|
||||
* @param {string} instruction.path - 请求路径
|
||||
* @param {Object} instruction.body - 请求体
|
||||
* @returns {{ outcome: string, score: number, details: Object }}
|
||||
* @returns {{ outcome: string, score: number, details: Object, identity: Object }}
|
||||
*/
|
||||
function reviewInstruction(instruction) {
|
||||
var devId = instruction.devId;
|
||||
|
|
@ -103,6 +154,10 @@ function reviewInstruction(instruction) {
|
|||
var dimensions = skyeyePolicy.reviewPolicy.dimensions;
|
||||
var thresholds = skyeyePolicy.reviewPolicy.thresholds;
|
||||
|
||||
// S9: 获取该身份的思维模型成熟度
|
||||
var maturity = getIdentityMaturity(devId);
|
||||
var coldStartInfo = checkColdStart(devId);
|
||||
|
||||
var scores = {};
|
||||
var totalScore = 0;
|
||||
|
||||
|
|
@ -152,7 +207,12 @@ function reviewInstruction(instruction) {
|
|||
// 确定审核结果
|
||||
var outcome;
|
||||
if (totalScore >= thresholds.pass) {
|
||||
outcome = 'pass';
|
||||
// S9: 冷启动期即使分数通过,也标记为 suspect 需额外确认
|
||||
if (coldStartInfo.coldStart) {
|
||||
outcome = 'suspect';
|
||||
} else {
|
||||
outcome = 'pass';
|
||||
}
|
||||
} else if (totalScore >= thresholds.suspect) {
|
||||
outcome = 'suspect';
|
||||
} else {
|
||||
|
|
@ -163,6 +223,13 @@ function reviewInstruction(instruction) {
|
|||
outcome: outcome,
|
||||
score: Math.round(totalScore * 100) / 100,
|
||||
details: scores,
|
||||
identity: {
|
||||
devId: devId,
|
||||
mature: maturity.mature,
|
||||
actionCount: maturity.actionCount,
|
||||
confidence: maturity.confidence,
|
||||
coldStart: coldStartInfo.coldStart
|
||||
},
|
||||
profile: {
|
||||
established: profile.patterns.established,
|
||||
totalActions: profile.totalActions
|
||||
|
|
@ -241,9 +308,14 @@ function skyeyeReview(req, res, next) {
|
|||
if (result.outcome === 'suspect') {
|
||||
// 挂起指令
|
||||
var suspendId = 'SUSPEND-' + Date.now();
|
||||
var suspendReason = result.identity.coldStart
|
||||
? '身份 ' + devId + ' 处于冷启动期,需额外人工确认'
|
||||
: '思维模式存在偏差';
|
||||
|
||||
suspendedInstructions.set(suspendId, {
|
||||
instruction: instruction,
|
||||
review: result,
|
||||
reason: suspendReason,
|
||||
createdAt: new Date().toISOString()
|
||||
});
|
||||
|
||||
|
|
@ -251,18 +323,26 @@ function skyeyeReview(req, res, next) {
|
|||
action: 'instruction_suspended',
|
||||
suspendId: suspendId,
|
||||
devId: devId,
|
||||
reason: '思维模式存在偏差',
|
||||
reason: suspendReason,
|
||||
score: result.score,
|
||||
identity: result.identity,
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
|
||||
var replyMsg = result.identity.coldStart
|
||||
? '👁️ 天眼审核:身份 ' + devId + ' 的思维模型尚在冷启动期(' +
|
||||
result.identity.actionCount + '/' + COLD_START_THRESHOLD + '),需额外人工确认。\n\n' +
|
||||
'指令已挂起,等待管理者或天眼授权人确认。'
|
||||
: '👁️ 天眼审核:此指令的思维模式存在偏差,已挂起等待确认。\n\n' +
|
||||
'系统已向 ' + devId + ' 本人发送确认请求。\n' +
|
||||
'审核得分:' + result.score + ' / 1.0(阈值 0.7)';
|
||||
|
||||
return res.status(202).json({
|
||||
error: false,
|
||||
code: 'SKYEYE_SUSPENDED',
|
||||
suspendId: suspendId,
|
||||
reply: '👁️ 天眼审核:此指令的思维模式存在偏差,已挂起等待确认。\n\n' +
|
||||
'系统已通过霜砚向冰朔发送确认请求。\n' +
|
||||
'审核得分:' + result.score + ' / 1.0(阈值 0.7)'
|
||||
coldStart: result.identity.coldStart,
|
||||
reply: replyMsg
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -312,7 +392,7 @@ function confirmSuspended(suspendId) {
|
|||
}
|
||||
|
||||
/**
|
||||
* 拒绝挂起的指令(冰朔否认)
|
||||
* 拒绝挂起的指令(本人否认或管理者拒绝)
|
||||
*/
|
||||
function denySuspended(suspendId) {
|
||||
var item = suspendedInstructions.get(suspendId);
|
||||
|
|
@ -322,7 +402,7 @@ function denySuspended(suspendId) {
|
|||
action: 'suspended_denied_permanently',
|
||||
suspendId: suspendId,
|
||||
devId: item.instruction.devId,
|
||||
reason: '冰朔否认此指令为本人签发',
|
||||
reason: '身份本人否认此指令为本人签发',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
return item;
|
||||
|
|
@ -352,6 +432,8 @@ module.exports = {
|
|||
skyeyeReview: skyeyeReview,
|
||||
reviewInstruction: reviewInstruction,
|
||||
recordAction: recordAction,
|
||||
getIdentityMaturity: getIdentityMaturity,
|
||||
checkColdStart: checkColdStart,
|
||||
getSuspendedInstruction: getSuspendedInstruction,
|
||||
confirmSuspended: confirmSuspended,
|
||||
denySuspended: denySuspended,
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
const express = require('express');
|
||||
const cors = require('cors');
|
||||
const executionLock = require('./middleware/execution-lock');
|
||||
const skyeyeReview = require('./middleware/skyeye-review');
|
||||
const watchdog = require('./services/execution-watchdog');
|
||||
|
||||
const app = express();
|
||||
|
|
@ -32,6 +33,9 @@ app.use(express.json());
|
|||
// 执行锁取消拦截(全局中间件,在所有路由之前)
|
||||
app.use(executionLock.blockCancellation);
|
||||
|
||||
// 天眼指令审核(S7/S8/S9 全局强制前置,不可关闭,不可绕过)
|
||||
app.use(skyeyeReview.skyeyeReview);
|
||||
|
||||
// 读取类路由(公开,无需认证)
|
||||
app.use('/api', require('./routes/health'));
|
||||
app.use('/api', require('./routes/dev'));
|
||||
|
|
@ -56,12 +60,13 @@ app.get('/', function(_req, res) {
|
|||
res.json({
|
||||
status: 'ok',
|
||||
service: 'guanghu-api-server',
|
||||
version: '4.0.0',
|
||||
version: '5.0.0',
|
||||
channel: 'B',
|
||||
description: '光湖后端中间层 · 语言驱动操作系统',
|
||||
capabilities: [
|
||||
'read', 'write', 'intent-routing', 'permission-sandbox',
|
||||
'onboarding', 'execution-guard', 'approval-flow', 'autonomy'
|
||||
'onboarding', 'execution-guard', 'approval-flow', 'autonomy',
|
||||
'skyeye-review', 'identity-verification'
|
||||
]
|
||||
});
|
||||
});
|
||||
|
|
@ -69,8 +74,8 @@ app.get('/', function(_req, res) {
|
|||
const PORT = process.env.PORT || 3001;
|
||||
app.listen(PORT, '127.0.0.1', function() {
|
||||
console.log('🔗 光湖后端中间层启动 · 端口 ' + PORT);
|
||||
console.log(' 通道B · 语言驱动操作系统 v4.0.0');
|
||||
console.log(' 能力:读取 + 写入 + 意图路由 + 权限沙箱 + 认知引导 + 执行保护 + 授权流程 + 系统自治');
|
||||
console.log(' 通道B · 语言驱动操作系统 v5.0.0');
|
||||
console.log(' 能力:读取 + 写入 + 意图路由 + 权限沙箱 + 认知引导 + 执行保护 + 授权流程 + 系统自治 + 天眼审核 + 身份验证');
|
||||
console.log(' 监听地址:127.0.0.1:' + PORT + '(仅本机访问)');
|
||||
|
||||
// 启动执行看门狗
|
||||
|
|
|
|||
Loading…
Reference in New Issue