From 3ee4494e09f80c240609e516710fe7aee7128f51 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 10 Mar 2026 11:02:52 +0000 Subject: [PATCH] feat: establish Persona Studio human developer numbering system v1.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Create human-registry.json master database (EXP-000 through EXP-011) - Migrate 冰朔 to EXP-000 as master control reserved number - Import 11 collaborators from dev-status.json into EXP numbering - Create notification outbox with queued notifications - Update registry.json to v2.0 with all developers - Update auth.js to read from human-registry.json - Add HLI registry lookup route (HLI-REGISTRY-001) - Update frontend: guest mode disabled, numbering hints updated Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- persona-studio/backend/routes/auth.js | 37 +++- persona-studio/brain/human-registry.json | 188 ++++++++++++++++++ .../brain/notifications/outbox.json | 140 +++++++++++++ persona-studio/brain/registry.json | 118 +++++++++-- persona-studio/frontend/index.html | 6 +- src/routes/hli/index.js | 4 + src/routes/hli/registry/index.js | 64 ++++++ src/schemas/hli/registry/lookup.schema.json | 26 +++ 8 files changed, 563 insertions(+), 20 deletions(-) create mode 100644 persona-studio/brain/human-registry.json create mode 100644 persona-studio/brain/notifications/outbox.json create mode 100644 src/routes/hli/registry/index.js create mode 100644 src/schemas/hli/registry/lookup.schema.json diff --git a/persona-studio/backend/routes/auth.js b/persona-studio/backend/routes/auth.js index e83ccb21..9868aa6d 100644 --- a/persona-studio/backend/routes/auth.js +++ b/persona-studio/backend/routes/auth.js @@ -1,6 +1,6 @@ /** * persona-studio · 登录校验路由 - * POST /api/ps/auth/login { dev_id: "EXP-001" } + * POST /api/ps/auth/login { dev_id: "EXP-000" } */ const express = require('express'); const router = express.Router(); @@ -8,16 +8,43 @@ const path = require('path'); const fs = require('fs'); const crypto = require('crypto'); +const HUMAN_REGISTRY_PATH = path.join(__dirname, '..', '..', 'brain', 'human-registry.json'); const REGISTRY_PATH = path.join(__dirname, '..', '..', 'brain', 'registry.json'); +function loadHumanRegistry() { + try { + return JSON.parse(fs.readFileSync(HUMAN_REGISTRY_PATH, 'utf-8')); + } catch { + return { developers: [] }; + } +} + function loadRegistry() { try { return JSON.parse(fs.readFileSync(REGISTRY_PATH, 'utf-8')); } catch { - return { developers: {} }; + return { developers: {}, guest_mode: {} }; } } +function findDeveloper(devId) { + const humanReg = loadHumanRegistry(); + if (humanReg.developers && Array.isArray(humanReg.developers)) { + const found = humanReg.developers.find(d => d.exp_id === devId); + if (found) { + return { name: found.name, status: found.status, role: found.role }; + } + } + + const registry = loadRegistry(); + const entry = registry.developers && registry.developers[devId]; + if (entry) { + return { name: entry.name, status: entry.status, role: entry.role }; + } + + return null; +} + // POST /api/ps/auth/login router.post('/login', (req, res) => { const { dev_id } = req.body || {}; @@ -31,7 +58,7 @@ router.post('/login', (req, res) => { return res.status(403).json({ error: true, code: 'GUEST_DISABLED', - message: '访客体验暂未开放' + message: '访客体验暂未开放,正式编号用户(EXP-XXX)可正常登录' }); } @@ -53,8 +80,7 @@ router.post('/login', (req, res) => { }); } - const registry = loadRegistry(); - const entry = registry.developers && registry.developers[dev_id]; + const entry = findDeveloper(dev_id); if (!entry) { return res.status(404).json({ @@ -80,6 +106,7 @@ router.post('/login', (req, res) => { dev_id, name: entry.name, status: entry.status, + role: entry.role, token }); }); diff --git a/persona-studio/brain/human-registry.json b/persona-studio/brain/human-registry.json new file mode 100644 index 00000000..fe490544 --- /dev/null +++ b/persona-studio/brain/human-registry.json @@ -0,0 +1,188 @@ +{ + "schema_version": "1.0", + "id_prefix": "EXP", + "next_id": 12, + "master_id": "EXP-000", + "last_updated": "2026-03-10T10:58:00Z", + "usage_policy": { + "description": "人类开发者编号主控数据库 · 系统内部使用", + "visibility": "system_only", + "rules": [ + "该数据库是系统主控数据库,不是公开展示页", + "人类前端只应看到自己的编号,而不是全量数据库", + "铸渊 / 系统逻辑 / auth 路由 / 后台工具可读取该数据库", + "新增授权编号时,由冰朔继续主控发放", + "新编号必须自动写入主数据库,并更新 next_id" + ] + }, + "developers": [ + { + "exp_id": "EXP-000", + "name": "冰朔", + "github_username": "qinfendebingshuo", + "status": "active", + "role": "master", + "registered_at": "2026-03-10T10:58:00Z", + "notified": true, + "notified_at": "2026-03-10T10:58:00Z", + "notify_channel": "system_init", + "notify_status": "sent", + "legacy_dev_id": null, + "notes": "系统主控保留号 · 冰朔最高权限 · 由铸渊系统初始化创建" + }, + { + "exp_id": "EXP-001", + "name": "页页", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-001", + "notes": "后端中间层开发者" + }, + { + "exp_id": "EXP-002", + "name": "肥猫", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-002", + "notes": "M14冷启动热身系统开发者" + }, + { + "exp_id": "EXP-003", + "name": "燕樊", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-003", + "notes": "M18健康检查开发者" + }, + { + "exp_id": "EXP-004", + "name": "之之", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-004", + "notes": "M17动态漫制作系统开发者" + }, + { + "exp_id": "EXP-005", + "name": "小草莓", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-005", + "notes": "部署与看板开发者" + }, + { + "exp_id": "EXP-006", + "name": "花尔", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-009", + "notes": "M05用户中心与M20搜索开发者" + }, + { + "exp_id": "EXP-007", + "name": "桔子", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-010", + "notes": "M06+M08+M11+M-CHANNEL开发者" + }, + { + "exp_id": "EXP-008", + "name": "匆匆那年", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-011", + "notes": "M16码字工作台开发者" + }, + { + "exp_id": "EXP-009", + "name": "Awen", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-012", + "notes": "M09全通+M22公告栏开发者" + }, + { + "exp_id": "EXP-010", + "name": "小兴", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-013", + "notes": "M-AUTH注册登录系统开发者" + }, + { + "exp_id": "EXP-011", + "name": "时雨", + "github_username": "", + "status": "active", + "role": "developer", + "registered_at": "2026-03-10T10:58:00Z", + "notified": false, + "notified_at": null, + "notify_channel": "github", + "notify_status": "pending", + "legacy_dev_id": "DEV-014", + "notes": "副控 · 待分配模块" + } + ] +} diff --git a/persona-studio/brain/notifications/outbox.json b/persona-studio/brain/notifications/outbox.json new file mode 100644 index 00000000..deaecd82 --- /dev/null +++ b/persona-studio/brain/notifications/outbox.json @@ -0,0 +1,140 @@ +{ + "schema_version": "1.0", + "description": "Persona Studio 开发者编号通知发件箱 · 系统自动生成", + "generated_at": "2026-03-10T10:58:00Z", + "generated_by": "铸渊(主控初始化)", + "notifications": [ + { + "id": "NOTIFY-000", + "exp_id": "EXP-000", + "recipient": "冰朔", + "channel": "system_init", + "status": "sent", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": "2026-03-10T10:58:00Z", + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-000\n\n此编号为系统主控保留号,拥有最高权限。\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-001", + "exp_id": "EXP-001", + "recipient": "页页", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-001\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-002", + "exp_id": "EXP-002", + "recipient": "肥猫", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-002\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-003", + "exp_id": "EXP-003", + "recipient": "燕樊", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-003\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-004", + "exp_id": "EXP-004", + "recipient": "之之", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-004\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-005", + "exp_id": "EXP-005", + "recipient": "小草莓", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-005\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-006", + "exp_id": "EXP-006", + "recipient": "花尔", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-006\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-007", + "exp_id": "EXP-007", + "recipient": "桔子", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-007\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-008", + "exp_id": "EXP-008", + "recipient": "匆匆那年", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-008\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-009", + "exp_id": "EXP-009", + "recipient": "Awen", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-009\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-010", + "exp_id": "EXP-010", + "recipient": "小兴", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-010\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + }, + { + "id": "NOTIFY-011", + "exp_id": "EXP-011", + "recipient": "时雨", + "channel": "github", + "status": "queued", + "created_at": "2026-03-10T10:58:00Z", + "sent_at": null, + "message": "你已被纳入 Persona Studio 人类开发者编号系统。\n\n你的开发编号是:\nEXP-011\n\n今后进入 Persona Studio 时,请使用该编号登录或识别身份。\n该编号为你的长期开发者身份标识。\n\n如需新增权限或补发编号,由冰朔主控统一授权。", + "retry_needed": false + } + ] +} diff --git a/persona-studio/brain/registry.json b/persona-studio/brain/registry.json index 040de08c..fbd7ccca 100644 --- a/persona-studio/brain/registry.json +++ b/persona-studio/brain/registry.json @@ -1,31 +1,125 @@ { - "schema_version": "1.1", + "schema_version": "2.0", "id_prefix": "EXP", - "next_id": 3, + "next_id": 12, + "master_id": "EXP-000", + "last_updated": "2026-03-10T10:58:00Z", + "master_registry": "persona-studio/brain/human-registry.json", "guest_mode": { - "enabled": true, + "enabled": false, "dev_id": "GUEST", "name": "访客体验者", - "max_conversations": 50 + "max_conversations": 50, + "disabled_reason": "访客模式暂不可用,正式编号用户不受影响" }, "developers": { - "EXP-001": { + "EXP-000": { "name": "冰朔", "github_username": "qinfendebingshuo", - "registered_at": "2026-03-09T23:20:00+08:00", + "registered_at": "2026-03-10T10:58:00Z", "registered_by": "铸渊(系统初始化)", "status": "active", "role": "master", - "notes": "系统创建者·最高权限" + "notes": "系统主控保留号 · 最高权限" + }, + "EXP-001": { + "name": "页页", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "后端中间层开发者" }, "EXP-002": { - "name": "体验者", + "name": "肥猫", "github_username": "", - "registered_at": "2026-03-10T07:00:00+08:00", - "registered_by": "铸渊(主控指令)", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", "status": "active", - "role": "tester", - "notes": "首位测试体验者" + "role": "developer", + "notes": "M14冷启动热身系统开发者" + }, + "EXP-003": { + "name": "燕樊", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M18健康检查开发者" + }, + "EXP-004": { + "name": "之之", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M17动态漫制作系统开发者" + }, + "EXP-005": { + "name": "小草莓", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "部署与看板开发者" + }, + "EXP-006": { + "name": "花尔", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M05用户中心与M20搜索开发者" + }, + "EXP-007": { + "name": "桔子", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M06+M08+M11+M-CHANNEL开发者" + }, + "EXP-008": { + "name": "匆匆那年", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M16码字工作台开发者" + }, + "EXP-009": { + "name": "Awen", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M09全通+M22公告栏开发者" + }, + "EXP-010": { + "name": "小兴", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "M-AUTH注册登录系统开发者" + }, + "EXP-011": { + "name": "时雨", + "github_username": "", + "registered_at": "2026-03-10T10:58:00Z", + "registered_by": "铸渊(主控批量导入)", + "status": "active", + "role": "developer", + "notes": "副控 · 待分配模块" } } } diff --git a/persona-studio/frontend/index.html b/persona-studio/frontend/index.html index 89ef72c0..230df193 100644 --- a/persona-studio/frontend/index.html +++ b/persona-studio/frontend/index.html @@ -15,7 +15,7 @@
编号由管理员分配,格式:EXP-001
+编号由冰朔主控分配,格式:EXP-000 ~ EXP-011
无需编号,直接与知秋对话
+ +访客模式暂不可用,正式编号用户可正常登录
diff --git a/src/routes/hli/index.js b/src/routes/hli/index.js index ee5e4b40..e0c0da43 100644 --- a/src/routes/hli/index.js +++ b/src/routes/hli/index.js @@ -17,6 +17,10 @@ const hliAuth = require('../../middleware/hli-auth.middleware'); router.use(hliAuth); +// REGISTRY 域 — 开发者编号查询 +const registryRouter = require('./registry'); +router.use('/registry', registryRouter); + // PERSONA 域 // const personaRouter = require('./persona'); // router.use('/persona', personaRouter); diff --git a/src/routes/hli/registry/index.js b/src/routes/hli/registry/index.js new file mode 100644 index 00000000..279e25db --- /dev/null +++ b/src/routes/hli/registry/index.js @@ -0,0 +1,64 @@ +/** + * HLI-REGISTRY-001 · 开发者编号查询 + * GET /hli/registry/lookup?exp_id=EXP-001 + * + * 仅返回指定编号的公开信息,不暴露全量数据库 + */ +const express = require('express'); +const router = express.Router(); +const path = require('path'); +const fs = require('fs'); + +const HUMAN_REGISTRY_PATH = path.join( + __dirname, '..', '..', '..', '..', + 'persona-studio', 'brain', 'human-registry.json' +); + +function loadHumanRegistry() { + try { + return JSON.parse(fs.readFileSync(HUMAN_REGISTRY_PATH, 'utf-8')); + } catch { + return { developers: [] }; + } +} + +// GET /hli/registry/lookup?exp_id=EXP-001 +router.get('/lookup', (req, res) => { + const { exp_id } = req.query || {}; + + if (!exp_id || !/^EXP-\d{3,}$/.test(exp_id)) { + return res.status(400).json({ + error: true, + hli_id: 'HLI-REGISTRY-001', + code: 'INVALID_ID', + message: '编号格式不正确,请使用 EXP-XXX 格式' + }); + } + + const registry = loadHumanRegistry(); + const devs = registry.developers || []; + const found = devs.find(d => d.exp_id === exp_id); + + if (!found) { + return res.status(404).json({ + error: true, + hli_id: 'HLI-REGISTRY-001', + code: 'NOT_FOUND', + message: '编号未注册' + }); + } + + res.json({ + error: false, + hli_id: 'HLI-REGISTRY-001', + data: { + exp_id: found.exp_id, + name: found.name, + status: found.status, + role: found.role, + registered_at: found.registered_at + } + }); +}); + +module.exports = router; diff --git a/src/schemas/hli/registry/lookup.schema.json b/src/schemas/hli/registry/lookup.schema.json new file mode 100644 index 00000000..c08df4d1 --- /dev/null +++ b/src/schemas/hli/registry/lookup.schema.json @@ -0,0 +1,26 @@ +{ + "hli_id": "HLI-REGISTRY-001", + "title": "开发者编号查询", + "description": "查询指定 EXP 编号的开发者信息(仅返回当前用户可见数据)", + "input": { + "type": "object", + "properties": { + "exp_id": { + "type": "string", + "pattern": "^EXP-\\d{3,}$", + "description": "开发者编号,格式 EXP-XXX" + } + }, + "required": ["exp_id"] + }, + "output": { + "type": "object", + "properties": { + "exp_id": { "type": "string" }, + "name": { "type": "string" }, + "status": { "type": "string" }, + "role": { "type": "string" }, + "registered_at": { "type": "string" } + } + } +}