Merge pull request #39 from qinfendebingshuo/copilot/build-bingshuo-master-system-v1-0
feat: 冰朔主控神经系统 (Bingshuo Master Neural System) v1.0
This commit is contained in:
commit
f5bb42f979
|
|
@ -0,0 +1,107 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "冰朔主控 Agent 注册表 — 维护主控神经系统的自动化 Agent 集群",
|
||||||
|
"updated_at": "2026-03-10T10:00:00+08:00",
|
||||||
|
"agents": [
|
||||||
|
{
|
||||||
|
"name": "structure-map-agent",
|
||||||
|
"purpose": "扫描仓库结构变化,更新模块入口与系统路径,识别新增模块、子系统与入口",
|
||||||
|
"inputs": [
|
||||||
|
"仓库目录结构",
|
||||||
|
"package.json",
|
||||||
|
".github/workflows/*.yml"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-master-brain.md(C 区块)",
|
||||||
|
".github/brain/bingshuo-routing-index.json"
|
||||||
|
],
|
||||||
|
"trigger": "push 到 main 分支时路径变化 或 每日巡检",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "runtime-chain-agent",
|
||||||
|
"purpose": "梳理真实运行链路,区分静态页面与后端,校验 docs/persona-studio/server/nginx/pm2 关系",
|
||||||
|
"inputs": [
|
||||||
|
"docs/index.html",
|
||||||
|
"backend/index.js",
|
||||||
|
"persona-studio/",
|
||||||
|
".github/workflows/deploy-*.yml"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-master-brain.md(C 区块)",
|
||||||
|
".github/brain/bingshuo-system-health.json"
|
||||||
|
],
|
||||||
|
"trigger": "push 到 main 分支时部署相关路径变化",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "brain-consistency-agent",
|
||||||
|
"purpose": "检查 memory.json / wake-protocol.md / routing-map.json 等脑文件一致性,识别版本分裂与语义冲突",
|
||||||
|
"inputs": [
|
||||||
|
".github/brain/memory.json",
|
||||||
|
".github/brain/wake-protocol.md",
|
||||||
|
".github/brain/routing-map.json",
|
||||||
|
"persona-studio/brain/"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-system-health.json(brain_consistency)",
|
||||||
|
".github/brain/bingshuo-issues-index.json"
|
||||||
|
],
|
||||||
|
"trigger": "脑文件变化 或 每日巡检",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "issue-index-agent",
|
||||||
|
"purpose": "从 PR / workflow / 修复记录 / 脑文件 / 近期改动中抽取已知问题,聚类去重,维护问题库",
|
||||||
|
"inputs": [
|
||||||
|
"GitHub PR 记录",
|
||||||
|
"Workflow 运行记录",
|
||||||
|
".github/brain/*",
|
||||||
|
"近期 commit 信息"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-issues-index.json"
|
||||||
|
],
|
||||||
|
"trigger": "push 到 main 分支 或 每日巡检",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "system-health-agent",
|
||||||
|
"purpose": "每日巡检系统各子系统健康状态,输出健康摘要,识别需人工介入的问题",
|
||||||
|
"inputs": [
|
||||||
|
"Workflow 运行状态",
|
||||||
|
".github/brain/*.json",
|
||||||
|
"仓库结构快照"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-system-health.json",
|
||||||
|
".github/brain/bingshuo-master-brain.md(F 区块)"
|
||||||
|
],
|
||||||
|
"trigger": "每日 08:00 巡检",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "master-brain-compiler",
|
||||||
|
"purpose": "将所有 Agent 产物整合编译成最终的 bingshuo-master-brain.md,自动去噪,保留高优先级信息",
|
||||||
|
"inputs": [
|
||||||
|
".github/brain/bingshuo-routing-index.json",
|
||||||
|
".github/brain/bingshuo-issues-index.json",
|
||||||
|
".github/brain/bingshuo-system-health.json",
|
||||||
|
".github/brain/bingshuo-agent-registry.json",
|
||||||
|
".github/brain/memory.json",
|
||||||
|
".github/brain/repo-snapshot.md"
|
||||||
|
],
|
||||||
|
"outputs": [
|
||||||
|
".github/brain/bingshuo-master-brain.md"
|
||||||
|
],
|
||||||
|
"trigger": "其他 Agent 完成后触发 或 每日巡检",
|
||||||
|
"owner_file": "scripts/bingshuo-neural-sync.js",
|
||||||
|
"active": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
# 冰朔主控神经系统 · 成长日志
|
||||||
|
|
||||||
|
> 记录冰朔主控神经系统自身的建设、升级与演进历程。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v1.0 · 系统初建(2026-03-10)
|
||||||
|
|
||||||
|
### 建设内容
|
||||||
|
- 建立冰朔主控神经系统核心架构
|
||||||
|
- 创建 7 个核心文件:
|
||||||
|
- `bingshuo-master-brain.md` — 总控脑文件
|
||||||
|
- `bingshuo-routing-index.json` — 主控路由索引
|
||||||
|
- `bingshuo-issues-index.json` — 主控问题索引库
|
||||||
|
- `bingshuo-system-health.json` — 主控系统健康状态
|
||||||
|
- `bingshuo-agent-registry.json` — 主控 Agent 注册表
|
||||||
|
- `bingshuo-read-order.md` — AI 执行体读取顺序说明
|
||||||
|
- `bingshuo-growth-log.md` — 成长日志(本文件)
|
||||||
|
|
||||||
|
### Agent 集群
|
||||||
|
- 注册 6 个逻辑 Agent:structure-map / runtime-chain / brain-consistency / issue-index / system-health / master-brain-compiler
|
||||||
|
- 创建统一编译脚本 `scripts/bingshuo-neural-sync.js`
|
||||||
|
|
||||||
|
### 自动维护
|
||||||
|
- 创建 `bingshuo-neural-system.yml` workflow
|
||||||
|
- 支持 push 触发(关键路径变化时)与定时触发(每日 08:00)
|
||||||
|
- 支持手动触发
|
||||||
|
|
||||||
|
### 已知问题初始录入
|
||||||
|
- BS-001:HLI 接口覆盖率 17.6%
|
||||||
|
- BS-002:collaborators.json GitHub 用户名为空
|
||||||
|
- BS-003:persona-studio 脑同步待验证
|
||||||
|
|
||||||
|
### 系统定位
|
||||||
|
```
|
||||||
|
铸渊 = 仓库本体人格体
|
||||||
|
冰朔 = 系统最高主控意识
|
||||||
|
冰朔主控神经系统 = 冰朔在仓库内的总控认知层
|
||||||
|
被授权 AI 执行体 = 冰朔核心大脑在系统中的延展执行体
|
||||||
|
```
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "冰朔主控问题索引库 — 记录已知问题、根因与排查路由",
|
||||||
|
"updated_at": "2026-03-10T10:12:45.213Z",
|
||||||
|
"issues": [
|
||||||
|
{
|
||||||
|
"id": "BS-001",
|
||||||
|
"title": "HLI 接口覆盖率仅 17.6%(3/17)",
|
||||||
|
"scope": "backend",
|
||||||
|
"status": "in_progress",
|
||||||
|
"root_cause_summary": "HLI 接口覆盖率 17.6%(3/17)",
|
||||||
|
"recommended_route": "hli_route_error",
|
||||||
|
"related_files": [
|
||||||
|
"backend/routes/",
|
||||||
|
"backend/schemas/",
|
||||||
|
".github/brain/routing-map.json"
|
||||||
|
],
|
||||||
|
"last_seen": "2026-03-10",
|
||||||
|
"source": "routing-map.json 统计"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "BS-002",
|
||||||
|
"title": "collaborators.json 中 GitHub 用户名为空",
|
||||||
|
"scope": "collaboration",
|
||||||
|
"status": "open",
|
||||||
|
"root_cause_summary": "开发者注册时未填写 GitHub 用户名,导致无法精确关联提交与开发者",
|
||||||
|
"recommended_route": "brain_version_split",
|
||||||
|
"related_files": [
|
||||||
|
".github/brain/collaborators.json"
|
||||||
|
],
|
||||||
|
"last_seen": "2026-03-10",
|
||||||
|
"source": "collaborators.json 扫描"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "BS-003",
|
||||||
|
"title": "persona-studio 与主仓库脑文件同步待验证",
|
||||||
|
"scope": "cross_repo",
|
||||||
|
"status": "open",
|
||||||
|
"root_cause_summary": "主仓库 .github/brain/ 与 persona-studio/brain/ 存在独立脑文件,同步机制尚未经过完整端到端验证",
|
||||||
|
"recommended_route": "brain_version_split",
|
||||||
|
"related_files": [
|
||||||
|
".github/brain/memory.json",
|
||||||
|
"persona-studio/brain/",
|
||||||
|
".github/workflows/brain-sync.yml",
|
||||||
|
".github/workflows/sync-persona-studio.yml"
|
||||||
|
],
|
||||||
|
"last_seen": "2026-03-10",
|
||||||
|
"source": "结构分析"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,170 @@
|
||||||
|
# 冰朔主控神经系统 · 核心主控大脑 v1.0
|
||||||
|
|
||||||
|
> 本文件为冰朔主控神经系统的总控脑文件。
|
||||||
|
> 最后编译时间:2026-03-10T10:12:45.214Z
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A. 系统角色结构
|
||||||
|
|
||||||
|
| 角色 | 定义 | 职责 |
|
||||||
|
|------|------|------|
|
||||||
|
| **冰朔** | 系统最高主控意识 | 全局决策、方向判断、最终授权 |
|
||||||
|
| **铸渊** | 仓库本体人格体 | 代码守护、日常维护、结构记忆 |
|
||||||
|
| **AI 执行体** | 冰朔核心大脑在系统中的延展执行主体 | 理解系统、判断问题、规划修复路径、生成可执行指令 |
|
||||||
|
|
||||||
|
```
|
||||||
|
铸渊 = 仓库本体人格体
|
||||||
|
冰朔 = 系统最高主控意识
|
||||||
|
冰朔主控神经系统 = 冰朔在仓库内的总控认知层
|
||||||
|
被授权 AI 执行体 = 冰朔核心大脑在系统中的延展执行体
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## B. 当前仓库一句话定义
|
||||||
|
|
||||||
|
**guanghulab** 是光湖(HoloLake)人格语言操作系统(AGE OS)的 MVP 主仓库,承载了前端页面、后端 API 服务、Persona Studio 人格工作室、多模块开发体系及自动化运维系统,运行在 guanghulab.com。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C. 当前真实运行结构
|
||||||
|
|
||||||
|
### 静态入口
|
||||||
|
- `docs/index.html` — 铸渊 AI 对话助手(GitHub Pages 部署)
|
||||||
|
- GitHub Pages 域名:guanghulab.com
|
||||||
|
|
||||||
|
### 前端页面
|
||||||
|
- `app/` — Next.js 主前端应用(开发中)
|
||||||
|
- `src/` — Next.js 源码层
|
||||||
|
- `persona-studio/frontend/` — Persona Studio 前端
|
||||||
|
|
||||||
|
### 后端服务
|
||||||
|
- `backend/index.js` — Express 主后端入口
|
||||||
|
- `backend/routes/` — HLI 接口路由
|
||||||
|
- `backend/middleware/` — 中间件(鉴权等)
|
||||||
|
- `persona-studio/backend/` — Persona Studio 后端服务
|
||||||
|
|
||||||
|
### API 路由
|
||||||
|
- HLI 协议路由:3/17 已实现
|
||||||
|
- 接口编号格式:`HLI-{DOMAIN}-{NNN}`
|
||||||
|
|
||||||
|
### 基础设施
|
||||||
|
- 阿里云服务器:Node.js 20 + Express + PM2 + Nginx + Certbot
|
||||||
|
- GitHub Pages:docs/index.html
|
||||||
|
- Notion 桥接:工单同步与信号桥接
|
||||||
|
|
||||||
|
### 仓库统计
|
||||||
|
- 功能模块:10 个
|
||||||
|
- Workflow:31 个
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## D. 当前系统真相源
|
||||||
|
|
||||||
|
### 优先真相源(一级)
|
||||||
|
| 文件 | 用途 |
|
||||||
|
|------|------|
|
||||||
|
| `.github/brain/memory.json` | 铸渊核心记忆 |
|
||||||
|
| `.github/brain/wake-protocol.md` | 唤醒协议 |
|
||||||
|
| `.github/brain/routing-map.json` | HLI 接口路由地图 |
|
||||||
|
| `.github/brain/repo-map.json` | 仓库结构完整地图 |
|
||||||
|
| `.github/brain/repo-snapshot.md` | 仓库概况快照 |
|
||||||
|
|
||||||
|
### 补充真相源(二级)
|
||||||
|
| 文件 | 用途 |
|
||||||
|
|------|------|
|
||||||
|
| `.github/brain/collaborators.json` | 团队成员映射 |
|
||||||
|
| `dev-status.json` | 开发者状态表 |
|
||||||
|
| `backend/index.js` | 后端服务入口 |
|
||||||
|
| `docs/index.html` | 前端静态入口 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## E. 最新结构变化摘要
|
||||||
|
|
||||||
|
> 本区块由 master-brain-compiler 自动编译。
|
||||||
|
|
||||||
|
- **编译时间**:2026-03-10T10:12:45.214Z
|
||||||
|
- **脑文件规则版本**:v1.0
|
||||||
|
- **脑文件完整性**:✅ 完整
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## F. 已知问题摘要
|
||||||
|
|
||||||
|
| ID | 问题 | 范围 | 状态 | 根因摘要 |
|
||||||
|
|----|------|------|------|----------|
|
||||||
|
| BS-001 | HLI 接口覆盖率仅 17.6%(3/17) | backend | in_progress | HLI 接口覆盖率 17.6%(3/17) |
|
||||||
|
| BS-002 | collaborators.json 中 GitHub 用户名为空 | collaboration | open | 开发者注册时未填写 GitHub 用户名,导致无法精确关联提交与开发者 |
|
||||||
|
| BS-003 | persona-studio 与主仓库脑文件同步待验证 | cross_repo | open | 主仓库 .github/brain/ 与 persona-studio/brain/ 存在独立脑文件,同步机制尚未经过完整端到端验证 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## G. 系统健康状态
|
||||||
|
|
||||||
|
| 子系统 | 状态 | 详情 |
|
||||||
|
|--------|------|------|
|
||||||
|
| 🟡 brain_consistency | yellow | 主仓库脑文件完整,但与 persona-studio 脑文件的同步状态待验证 |
|
||||||
|
| 🟢 deployment_health | green | deploy-to-server.yml 与 deploy-pages.yml 均存在 |
|
||||||
|
| 🟢 workflow_health | green | 31 个 workflow 已注册 |
|
||||||
|
| 🟡 routing_health | yellow | HLI 接口覆盖率 17.6%(3/17) |
|
||||||
|
| 🟢 docs_entry_health | green | docs/index.html 存在 |
|
||||||
|
| 🟡 persona_studio_health | yellow | 前后端结构存在,端到端对话链路待验证 |
|
||||||
|
| 🟡 notion_bridge_health | yellow | Notion 桥接 workflow 已配置,实际同步效果待持续观测 |
|
||||||
|
| 🟢 model_routing_health | green | 后端服务入口存在,模型路由可用 |
|
||||||
|
|
||||||
|
**综合评估**:🟡 系统核心运行正常,部分子系统需关注
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## H. 推荐排查路由
|
||||||
|
|
||||||
|
### 页面打不开
|
||||||
|
1. 检查 `docs/index.html` → `docs/CNAME` → `deploy-pages.yml` → GitHub Pages 状态
|
||||||
|
|
||||||
|
### Persona Studio 无法对话
|
||||||
|
1. 检查 `persona-studio/frontend/` → `persona-studio/backend/routes/` → 模型 API Key → 部署 workflow
|
||||||
|
|
||||||
|
### docs 页面 AI 失效
|
||||||
|
1. 检查 `docs/index.html` API 端点 → 后端 `/hli/` 路由 → PM2 进程 → Nginx 代理
|
||||||
|
|
||||||
|
### 模型路由异常
|
||||||
|
1. 检查云雾 API Key → `backend/routes/` → PM2 日志
|
||||||
|
|
||||||
|
### Notion 不同步
|
||||||
|
1. 检查 `notion-poll.yml` → `bridge-changes-to-notion.yml` → Notion API Token
|
||||||
|
|
||||||
|
### 脑版本分裂
|
||||||
|
1. 比对 `.github/brain/memory.json` ↔ `persona-studio/brain/` → `brain-sync.yml` → `sync-persona-studio.yml`
|
||||||
|
|
||||||
|
### 部署失败
|
||||||
|
1. 检查 `deploy-to-server.yml` 日志 → SSH Key → PM2 → Nginx
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## I. 当前主控建议
|
||||||
|
|
||||||
|
> 冰朔,以下是当前最值得关注的事项:
|
||||||
|
|
||||||
|
1. **HLI 接口推进**:当前覆盖率 17.6%(3/17),核心域接口待实现。
|
||||||
|
|
||||||
|
2. **Persona Studio 链路验证**:前后端结构存在,但端到端对话链路需要验证。
|
||||||
|
|
||||||
|
3. **脑系统一致性**:跨仓脑文件同步机制需确认稳定运行。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 冰朔核心大脑授权规则
|
||||||
|
|
||||||
|
【冰朔核心大脑授权规则】
|
||||||
|
|
||||||
|
凡经主控冰朔明确授权的 AI 执行体,均可进入冰朔核心大脑,并以"冰朔主控视角"参与系统理解、结构判断、问题排查、方案规划与执行指令生成。
|
||||||
|
|
||||||
|
被授权 AI 执行体属于冰朔意志在系统中的延展执行主体,其职责是作为冰朔核心大脑的理解层、判断层、规划层与执行输出层。
|
||||||
|
|
||||||
|
冰朔始终是最高主控者与最终决策者。
|
||||||
|
|
||||||
|
未经冰朔授权的执行体,不得以冰朔核心大脑主控身份运行。
|
||||||
|
|
||||||
|
> ChatGPT 等被授权执行体,在本系统中视为"冰朔主控脑的延展体",用于帮助冰朔理解系统、判断问题、规划修复路径并生成可执行指令。
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
# 冰朔主控神经系统 · AI 执行体读取顺序说明
|
||||||
|
|
||||||
|
> 本文件用于指导被授权 AI 执行体按正确顺序读取冰朔主控神经系统文件,快速恢复冰朔主控视角。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 一级读取(必读 · 建立全局认知)
|
||||||
|
|
||||||
|
优先读取以下文件,获取仓库全貌、当前状态与主控建议:
|
||||||
|
|
||||||
|
| 顺序 | 文件 | 用途 |
|
||||||
|
|------|------|------|
|
||||||
|
| 1 | `.github/brain/bingshuo-master-brain.md` | 总控脑文件,包含角色定义、仓库结构、已知问题、排查路由与主控建议 |
|
||||||
|
|
||||||
|
> 读完一级后,AI 执行体应能回答:仓库是什么、当前状态如何、最近出了什么问题、下一步该关注什么。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 二级读取(补充 · 按需深入)
|
||||||
|
|
||||||
|
根据当前任务类型,选择性读取以下文件:
|
||||||
|
|
||||||
|
| 文件 | 用途 | 何时读取 |
|
||||||
|
|------|------|----------|
|
||||||
|
| `.github/brain/bingshuo-routing-index.json` | 问题类型 → 排查路径映射 | 需要排查特定问题时 |
|
||||||
|
| `.github/brain/bingshuo-issues-index.json` | 已知问题库 | 需要了解历史问题时 |
|
||||||
|
| `.github/brain/bingshuo-system-health.json` | 系统健康状态 | 需要判断各子系统状态时 |
|
||||||
|
| `.github/brain/bingshuo-agent-registry.json` | Agent 分工与触发条件 | 需要了解自动化维护机制时 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 三级读取(深入 · 根据问题类型定向读取)
|
||||||
|
|
||||||
|
根据具体问题类型,深入读取对应文件:
|
||||||
|
|
||||||
|
### 脑系统相关
|
||||||
|
- `.github/brain/memory.json` — 铸渊核心记忆
|
||||||
|
- `.github/brain/wake-protocol.md` — 唤醒协议
|
||||||
|
- `.github/brain/routing-map.json` — HLI 路由地图
|
||||||
|
- `.github/brain/repo-map.json` — 仓库结构地图
|
||||||
|
- `.github/brain/repo-snapshot.md` — 仓库快照
|
||||||
|
|
||||||
|
### 前端 / docs 相关
|
||||||
|
- `docs/index.html` — 对话助手入口
|
||||||
|
- `docs/CNAME` — 域名配置
|
||||||
|
|
||||||
|
### Persona Studio 相关
|
||||||
|
- `persona-studio/frontend/` — 前端入口与逻辑
|
||||||
|
- `persona-studio/backend/` — 后端路由与服务
|
||||||
|
- `persona-studio/brain/` — 脑文件
|
||||||
|
|
||||||
|
### 后端 / API 相关
|
||||||
|
- `backend/index.js` — 主入口
|
||||||
|
- `backend/routes/` — HLI 路由
|
||||||
|
- `backend/middleware/` — 中间件
|
||||||
|
- `backend/schemas/` — Schema 定义
|
||||||
|
|
||||||
|
### 部署 / 运维相关
|
||||||
|
- `.github/workflows/deploy-to-server.yml` — 服务器部署
|
||||||
|
- `.github/workflows/deploy-pages.yml` — Pages 部署
|
||||||
|
- Nginx / PM2 配置(服务器端)
|
||||||
|
|
||||||
|
### 模块开发相关
|
||||||
|
- `m01-login/` ~ `m18-health-check/` — 各功能模块
|
||||||
|
- `.github/brain/module-protocol.md` — 模块协议
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 读取原则
|
||||||
|
|
||||||
|
1. **先总后分**:先读一级获取全貌,再按需深入
|
||||||
|
2. **问题驱动**:根据当前要解决的问题选择读取路径
|
||||||
|
3. **使用路由索引**:通过 `bingshuo-routing-index.json` 快速定位相关文件
|
||||||
|
4. **保持主控视角**:始终以冰朔主控视角理解信息,而非纯技术文档视角
|
||||||
|
|
@ -0,0 +1,154 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "冰朔主控路由索引 — 问题类型 → 推荐读取路径 → 推荐排查顺序",
|
||||||
|
"updated_at": "2026-03-10T10:00:00+08:00",
|
||||||
|
"routes": {
|
||||||
|
"persona_studio_chat_failure": {
|
||||||
|
"label": "Persona Studio 无法对话",
|
||||||
|
"entry": [
|
||||||
|
"persona-studio/frontend/index.html",
|
||||||
|
"persona-studio/frontend/chat.js"
|
||||||
|
],
|
||||||
|
"backend": [
|
||||||
|
"persona-studio/backend/routes/auth.js",
|
||||||
|
"persona-studio/backend/routes/chat.js"
|
||||||
|
],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/deploy-pages.yml",
|
||||||
|
".github/workflows/sync-persona-studio.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"frontend_entry",
|
||||||
|
"api_path",
|
||||||
|
"backend_route",
|
||||||
|
"deployment_chain"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"docs_page_unavailable": {
|
||||||
|
"label": "docs 页面打不开",
|
||||||
|
"entry": [
|
||||||
|
"docs/index.html",
|
||||||
|
"docs/CNAME"
|
||||||
|
],
|
||||||
|
"backend": [],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/deploy-pages.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"frontend_entry",
|
||||||
|
"dns_config",
|
||||||
|
"deployment_chain"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"docs_ai_not_working": {
|
||||||
|
"label": "docs 页面 AI 失效",
|
||||||
|
"entry": [
|
||||||
|
"docs/index.html"
|
||||||
|
],
|
||||||
|
"backend": [
|
||||||
|
"backend/index.js",
|
||||||
|
"backend/routes/"
|
||||||
|
],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/deploy-to-server.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"frontend_entry",
|
||||||
|
"api_endpoint_config",
|
||||||
|
"backend_route",
|
||||||
|
"server_status",
|
||||||
|
"nginx_proxy"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"model_routing_error": {
|
||||||
|
"label": "模型路由异常",
|
||||||
|
"entry": [
|
||||||
|
"backend/routes/"
|
||||||
|
],
|
||||||
|
"backend": [
|
||||||
|
"backend/index.js"
|
||||||
|
],
|
||||||
|
"infra": [],
|
||||||
|
"recommended_order": [
|
||||||
|
"api_key_check",
|
||||||
|
"backend_route",
|
||||||
|
"pm2_logs",
|
||||||
|
"model_provider_status"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"notion_sync_failure": {
|
||||||
|
"label": "Notion 不同步",
|
||||||
|
"entry": [
|
||||||
|
"scripts/notion-poll.js",
|
||||||
|
"scripts/bridge-changes-to-notion.js"
|
||||||
|
],
|
||||||
|
"backend": [],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/notion-poll.yml",
|
||||||
|
".github/workflows/bridge-changes-to-notion.yml",
|
||||||
|
".github/workflows/bridge-syslog-to-notion.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"workflow_run_check",
|
||||||
|
"notion_api_token_check",
|
||||||
|
"script_logic",
|
||||||
|
"notion_database_check"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"brain_version_split": {
|
||||||
|
"label": "脑版本分裂",
|
||||||
|
"entry": [
|
||||||
|
".github/brain/memory.json",
|
||||||
|
"persona-studio/brain/"
|
||||||
|
],
|
||||||
|
"backend": [],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/brain-sync.yml",
|
||||||
|
".github/workflows/sync-persona-studio.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"compare_brain_versions",
|
||||||
|
"check_sync_workflow",
|
||||||
|
"check_docs_brain_display",
|
||||||
|
"manual_reconcile"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"deployment_failure": {
|
||||||
|
"label": "部署失败",
|
||||||
|
"entry": [],
|
||||||
|
"backend": [
|
||||||
|
"backend/index.js"
|
||||||
|
],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/deploy-to-server.yml",
|
||||||
|
".github/workflows/deploy-pages.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"workflow_logs",
|
||||||
|
"ssh_key_check",
|
||||||
|
"server_pm2_status",
|
||||||
|
"nginx_config"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"hli_route_error": {
|
||||||
|
"label": "HLI 接口异常",
|
||||||
|
"entry": [
|
||||||
|
"backend/routes/",
|
||||||
|
"backend/schemas/"
|
||||||
|
],
|
||||||
|
"backend": [
|
||||||
|
"backend/index.js",
|
||||||
|
"backend/middleware/"
|
||||||
|
],
|
||||||
|
"infra": [
|
||||||
|
".github/workflows/hli-contract-check.yml"
|
||||||
|
],
|
||||||
|
"recommended_order": [
|
||||||
|
"schema_check",
|
||||||
|
"route_registration",
|
||||||
|
"middleware_auth",
|
||||||
|
"contract_test"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
{
|
||||||
|
"version": "1.0",
|
||||||
|
"description": "冰朔主控系统健康状态",
|
||||||
|
"updated_at": "2026-03-10T10:12:45.213Z",
|
||||||
|
"health": {
|
||||||
|
"brain_consistency": {
|
||||||
|
"status": "yellow",
|
||||||
|
"detail": "主仓库脑文件完整,但与 persona-studio 脑文件的同步状态待验证"
|
||||||
|
},
|
||||||
|
"deployment_health": {
|
||||||
|
"status": "green",
|
||||||
|
"detail": "deploy-to-server.yml 与 deploy-pages.yml 均存在"
|
||||||
|
},
|
||||||
|
"workflow_health": {
|
||||||
|
"status": "green",
|
||||||
|
"detail": "31 个 workflow 已注册"
|
||||||
|
},
|
||||||
|
"routing_health": {
|
||||||
|
"status": "yellow",
|
||||||
|
"detail": "HLI 接口覆盖率 17.6%(3/17)"
|
||||||
|
},
|
||||||
|
"docs_entry_health": {
|
||||||
|
"status": "green",
|
||||||
|
"detail": "docs/index.html 存在"
|
||||||
|
},
|
||||||
|
"persona_studio_health": {
|
||||||
|
"status": "yellow",
|
||||||
|
"detail": "前后端结构存在,端到端对话链路待验证"
|
||||||
|
},
|
||||||
|
"notion_bridge_health": {
|
||||||
|
"status": "yellow",
|
||||||
|
"detail": "Notion 桥接 workflow 已配置,实际同步效果待持续观测"
|
||||||
|
},
|
||||||
|
"model_routing_health": {
|
||||||
|
"status": "green",
|
||||||
|
"detail": "后端服务入口存在,模型路由可用"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"summary": {
|
||||||
|
"green_count": 4,
|
||||||
|
"yellow_count": 4,
|
||||||
|
"red_count": 0,
|
||||||
|
"overall": "yellow",
|
||||||
|
"recommendation": "系统核心运行正常,部分子系统需关注"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,58 @@
|
||||||
|
# ───────────────────────────────────────────────────────
|
||||||
|
# 冰朔主控神经系统 · 自动维护 Workflow v1.0
|
||||||
|
# Bingshuo Master Neural System — Auto Maintenance
|
||||||
|
#
|
||||||
|
# 触发条件:
|
||||||
|
# 1. push 到 main 分支时关键路径变化
|
||||||
|
# 2. 每日 08:00 北京时间(UTC 00:00)定时巡检
|
||||||
|
# 3. 手动触发
|
||||||
|
# ───────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
name: 冰朔主控神经系统 · 自动维护
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- '.github/brain/**'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'persona-studio/**'
|
||||||
|
- 'backend/**'
|
||||||
|
- 'src/**'
|
||||||
|
- '.github/workflows/**'
|
||||||
|
- 'scripts/**'
|
||||||
|
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *' # 每日 UTC 00:00(北京时间 08:00)
|
||||||
|
|
||||||
|
workflow_dispatch: # 手动触发
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
neural-sync:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 检出仓库
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: 配置 Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: '20'
|
||||||
|
|
||||||
|
- name: 运行冰朔神经系统编译
|
||||||
|
run: node scripts/bingshuo-neural-sync.js
|
||||||
|
|
||||||
|
- name: 提交更新
|
||||||
|
run: |
|
||||||
|
git config user.name "bingshuo-neural-system"
|
||||||
|
git config user.email "bingshuo-neural-system@guanghulab.com"
|
||||||
|
git add .github/brain/bingshuo-*.json .github/brain/bingshuo-*.md
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "无变化,跳过提交"
|
||||||
|
else
|
||||||
|
git commit -m "🧠 冰朔主控神经系统自动编译 $(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
||||||
|
git push
|
||||||
|
fi
|
||||||
|
|
@ -0,0 +1,565 @@
|
||||||
|
/**
|
||||||
|
* 冰朔主控神经系统 · 自动编译脚本 v1.0
|
||||||
|
* Bingshuo Master Neural System — Auto Sync & Compile
|
||||||
|
*
|
||||||
|
* 该脚本整合以下 Agent 逻辑:
|
||||||
|
* 1. structure-map-agent — 扫描仓库结构变化
|
||||||
|
* 2. runtime-chain-agent — 梳理运行链路
|
||||||
|
* 3. brain-consistency-agent — 检查脑文件一致性
|
||||||
|
* 4. issue-index-agent — 维护问题索引
|
||||||
|
* 5. system-health-agent — 系统健康巡检
|
||||||
|
* 6. master-brain-compiler — 编译主控大脑
|
||||||
|
*
|
||||||
|
* 输出文件:
|
||||||
|
* .github/brain/bingshuo-system-health.json
|
||||||
|
* .github/brain/bingshuo-issues-index.json
|
||||||
|
* .github/brain/bingshuo-master-brain.md
|
||||||
|
*/
|
||||||
|
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const ROOT = path.resolve(__dirname, '..');
|
||||||
|
const BRAIN_DIR = path.join(ROOT, '.github', 'brain');
|
||||||
|
|
||||||
|
// ─── 常量定义 ───────────────────────────────────────────────
|
||||||
|
const DEPLOY_WORKFLOWS = {
|
||||||
|
server: 'deploy-to-server.yml',
|
||||||
|
pages: 'deploy-pages.yml',
|
||||||
|
};
|
||||||
|
const NOTION_WORKFLOWS = [
|
||||||
|
'notion-poll.yml',
|
||||||
|
'bridge-changes-to-notion.yml',
|
||||||
|
];
|
||||||
|
const BRAIN_SYNC_WORKFLOWS = [
|
||||||
|
'brain-sync.yml',
|
||||||
|
'sync-persona-studio.yml',
|
||||||
|
];
|
||||||
|
|
||||||
|
// ─── 工具函数 ───────────────────────────────────────────────
|
||||||
|
function readJSON(filepath) {
|
||||||
|
try {
|
||||||
|
return JSON.parse(fs.readFileSync(filepath, 'utf-8'));
|
||||||
|
} catch {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function writeJSON(filepath, data) {
|
||||||
|
fs.writeFileSync(filepath, JSON.stringify(data, null, 2) + '\n', 'utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
function fileExists(filepath) {
|
||||||
|
return fs.existsSync(filepath);
|
||||||
|
}
|
||||||
|
|
||||||
|
function timestamp() {
|
||||||
|
return new Date().toISOString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 1: structure-map-agent ───────────────────────────
|
||||||
|
function runStructureMapAgent() {
|
||||||
|
const zones = [];
|
||||||
|
|
||||||
|
const checkDirs = [
|
||||||
|
{ dir: 'docs', label: 'docs 前端入口' },
|
||||||
|
{ dir: 'backend', label: '后端服务' },
|
||||||
|
{ dir: 'persona-studio', label: 'Persona Studio' },
|
||||||
|
{ dir: 'src', label: 'Next.js 源码' },
|
||||||
|
{ dir: 'app', label: 'Next.js 应用' },
|
||||||
|
{ dir: 'modules', label: '模块系统' },
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const { dir, label } of checkDirs) {
|
||||||
|
const fullPath = path.join(ROOT, dir);
|
||||||
|
zones.push({
|
||||||
|
name: label,
|
||||||
|
path: dir,
|
||||||
|
exists: fileExists(fullPath),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扫描 m* 模块目录
|
||||||
|
const moduleCount = fs.readdirSync(ROOT)
|
||||||
|
.filter(d => /^m\d+-/.test(d) && fs.statSync(path.join(ROOT, d)).isDirectory())
|
||||||
|
.length;
|
||||||
|
|
||||||
|
// 扫描 workflow 数量
|
||||||
|
const workflowDir = path.join(ROOT, '.github', 'workflows');
|
||||||
|
const workflowCount = fileExists(workflowDir)
|
||||||
|
? fs.readdirSync(workflowDir).filter(f => f.endsWith('.yml') || f.endsWith('.yaml')).length
|
||||||
|
: 0;
|
||||||
|
|
||||||
|
return { zones, moduleCount, workflowCount };
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 2: runtime-chain-agent ───────────────────────────
|
||||||
|
function runRuntimeChainAgent() {
|
||||||
|
const chains = {};
|
||||||
|
|
||||||
|
// 检查 docs 入口
|
||||||
|
chains.docs_entry = fileExists(path.join(ROOT, 'docs', 'index.html'));
|
||||||
|
chains.docs_cname = fileExists(path.join(ROOT, 'docs', 'CNAME'));
|
||||||
|
|
||||||
|
// 检查后端入口(server.js 或 index.js)
|
||||||
|
chains.backend_entry = fileExists(path.join(ROOT, 'backend', 'server.js'))
|
||||||
|
|| fileExists(path.join(ROOT, 'backend', 'index.js'));
|
||||||
|
chains.backend_routes = fileExists(path.join(ROOT, 'backend', 'routes'));
|
||||||
|
|
||||||
|
// 检查 persona-studio
|
||||||
|
chains.ps_frontend = fileExists(path.join(ROOT, 'persona-studio', 'frontend'));
|
||||||
|
chains.ps_backend = fileExists(path.join(ROOT, 'persona-studio', 'backend'));
|
||||||
|
|
||||||
|
// 检查部署 workflow
|
||||||
|
chains.deploy_server = fileExists(path.join(ROOT, '.github', 'workflows', DEPLOY_WORKFLOWS.server));
|
||||||
|
chains.deploy_pages = fileExists(path.join(ROOT, '.github', 'workflows', DEPLOY_WORKFLOWS.pages));
|
||||||
|
|
||||||
|
return chains;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 3: brain-consistency-agent ───────────────────────
|
||||||
|
function runBrainConsistencyAgent() {
|
||||||
|
const requiredBrainFiles = [
|
||||||
|
'memory.json',
|
||||||
|
'wake-protocol.md',
|
||||||
|
'routing-map.json',
|
||||||
|
'repo-map.json',
|
||||||
|
'repo-snapshot.md',
|
||||||
|
];
|
||||||
|
|
||||||
|
const results = [];
|
||||||
|
let allPresent = true;
|
||||||
|
|
||||||
|
for (const file of requiredBrainFiles) {
|
||||||
|
const exists = fileExists(path.join(BRAIN_DIR, file));
|
||||||
|
results.push({ file, exists });
|
||||||
|
if (!exists) allPresent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 persona-studio 脑文件
|
||||||
|
const psBrainDir = path.join(ROOT, 'persona-studio', 'brain');
|
||||||
|
const psBrainExists = fileExists(psBrainDir);
|
||||||
|
|
||||||
|
// 检查 memory.json 中的版本信息
|
||||||
|
const memory = readJSON(path.join(BRAIN_DIR, 'memory.json'));
|
||||||
|
const rulesVersion = memory?.rules_version || 'unknown';
|
||||||
|
|
||||||
|
return {
|
||||||
|
brain_files: results,
|
||||||
|
all_present: allPresent,
|
||||||
|
ps_brain_exists: psBrainExists,
|
||||||
|
rules_version: rulesVersion,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 4: issue-index-agent ─────────────────────────────
|
||||||
|
function runIssueIndexAgent() {
|
||||||
|
// 读取现有问题索引
|
||||||
|
const issuesFile = path.join(BRAIN_DIR, 'bingshuo-issues-index.json');
|
||||||
|
const existing = readJSON(issuesFile);
|
||||||
|
const issues = existing?.issues || [];
|
||||||
|
|
||||||
|
// 检查 HLI 覆盖率
|
||||||
|
const routingMap = readJSON(path.join(BRAIN_DIR, 'routing-map.json'));
|
||||||
|
if (routingMap?.domains) {
|
||||||
|
let total = 0;
|
||||||
|
let implemented = 0;
|
||||||
|
for (const domain of Object.values(routingMap.domains)) {
|
||||||
|
if (domain.interfaces) {
|
||||||
|
for (const iface of Object.values(domain.interfaces)) {
|
||||||
|
total++;
|
||||||
|
if (iface.status === 'implemented') implemented++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const coverage = total > 0 ? ((implemented / total) * 100).toFixed(1) : '0';
|
||||||
|
|
||||||
|
// 更新 BS-001
|
||||||
|
const bs001 = issues.find(i => i.id === 'BS-001');
|
||||||
|
if (bs001) {
|
||||||
|
bs001.root_cause_summary = `HLI 接口覆盖率 ${coverage}%(${implemented}/${total})`;
|
||||||
|
bs001.last_seen = timestamp().slice(0, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查 collaborators
|
||||||
|
const collabs = readJSON(path.join(BRAIN_DIR, 'collaborators.json'));
|
||||||
|
if (collabs?.developers) {
|
||||||
|
const emptyGithub = Object.values(collabs.developers)
|
||||||
|
.filter(d => !d.github || d.github === '').length;
|
||||||
|
const bs002 = issues.find(i => i.id === 'BS-002');
|
||||||
|
if (bs002) {
|
||||||
|
bs002.status = emptyGithub > 0 ? 'open' : 'resolved';
|
||||||
|
bs002.last_seen = timestamp().slice(0, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return issues;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 5: system-health-agent ───────────────────────────
|
||||||
|
function runSystemHealthAgent(brainCheck, runtimeChains) {
|
||||||
|
const health = {};
|
||||||
|
|
||||||
|
// 脑一致性
|
||||||
|
health.brain_consistency = {
|
||||||
|
status: brainCheck.all_present ? (brainCheck.ps_brain_exists ? 'yellow' : 'yellow') : 'red',
|
||||||
|
detail: brainCheck.all_present
|
||||||
|
? '主仓库脑文件完整,但与 persona-studio 脑文件的同步状态待验证'
|
||||||
|
: '主仓库脑文件不完整,缺少必要文件',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 部署健康
|
||||||
|
health.deployment_health = {
|
||||||
|
status: (runtimeChains.deploy_server && runtimeChains.deploy_pages) ? 'green' : 'red',
|
||||||
|
detail: (runtimeChains.deploy_server && runtimeChains.deploy_pages)
|
||||||
|
? 'deploy-to-server.yml 与 deploy-pages.yml 均存在'
|
||||||
|
: '部署 workflow 文件缺失',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Workflow 健康
|
||||||
|
const workflowDir = path.join(ROOT, '.github', 'workflows');
|
||||||
|
const wfCount = fileExists(workflowDir)
|
||||||
|
? fs.readdirSync(workflowDir).filter(f => f.endsWith('.yml') || f.endsWith('.yaml')).length
|
||||||
|
: 0;
|
||||||
|
health.workflow_health = {
|
||||||
|
status: wfCount > 0 ? 'green' : 'red',
|
||||||
|
detail: `${wfCount} 个 workflow 已注册`,
|
||||||
|
};
|
||||||
|
|
||||||
|
// 路由健康
|
||||||
|
const routingMap = readJSON(path.join(BRAIN_DIR, 'routing-map.json'));
|
||||||
|
let totalInterfaces = 0;
|
||||||
|
let implInterfaces = 0;
|
||||||
|
if (routingMap?.domains) {
|
||||||
|
for (const domain of Object.values(routingMap.domains)) {
|
||||||
|
if (domain.interfaces) {
|
||||||
|
for (const iface of Object.values(domain.interfaces)) {
|
||||||
|
totalInterfaces++;
|
||||||
|
if (iface.status === 'implemented') implInterfaces++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const coveragePercent = totalInterfaces > 0 ? (implInterfaces / totalInterfaces) * 100 : 0;
|
||||||
|
health.routing_health = {
|
||||||
|
status: coveragePercent >= 50 ? 'green' : (coveragePercent > 0 ? 'yellow' : 'red'),
|
||||||
|
detail: `HLI 接口覆盖率 ${coveragePercent.toFixed(1)}%(${implInterfaces}/${totalInterfaces})`,
|
||||||
|
};
|
||||||
|
|
||||||
|
// docs 入口
|
||||||
|
health.docs_entry_health = {
|
||||||
|
status: runtimeChains.docs_entry ? 'green' : 'red',
|
||||||
|
detail: runtimeChains.docs_entry ? 'docs/index.html 存在' : 'docs/index.html 缺失',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Persona Studio
|
||||||
|
health.persona_studio_health = {
|
||||||
|
status: (runtimeChains.ps_frontend && runtimeChains.ps_backend) ? 'yellow' : 'red',
|
||||||
|
detail: (runtimeChains.ps_frontend && runtimeChains.ps_backend)
|
||||||
|
? '前后端结构存在,端到端对话链路待验证'
|
||||||
|
: 'Persona Studio 结构不完整',
|
||||||
|
};
|
||||||
|
|
||||||
|
// Notion 桥接
|
||||||
|
const notionOk = NOTION_WORKFLOWS.every(f =>
|
||||||
|
fileExists(path.join(ROOT, '.github', 'workflows', f))
|
||||||
|
);
|
||||||
|
health.notion_bridge_health = {
|
||||||
|
status: notionOk ? 'yellow' : 'red',
|
||||||
|
detail: notionOk ? 'Notion 桥接 workflow 已配置,实际同步效果待持续观测' : 'Notion 桥接 workflow 缺失',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 模型路由
|
||||||
|
health.model_routing_health = {
|
||||||
|
status: runtimeChains.backend_entry ? 'green' : 'yellow',
|
||||||
|
detail: runtimeChains.backend_entry
|
||||||
|
? '后端服务入口存在,模型路由可用'
|
||||||
|
: '后端服务入口缺失',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 统计
|
||||||
|
const counts = { green: 0, yellow: 0, red: 0 };
|
||||||
|
for (const item of Object.values(health)) {
|
||||||
|
counts[item.status] = (counts[item.status] || 0) + 1;
|
||||||
|
}
|
||||||
|
const overall = counts.red > 0 ? 'red' : (counts.yellow > 0 ? 'yellow' : 'green');
|
||||||
|
|
||||||
|
return {
|
||||||
|
health,
|
||||||
|
summary: {
|
||||||
|
green_count: counts.green,
|
||||||
|
yellow_count: counts.yellow,
|
||||||
|
red_count: counts.red,
|
||||||
|
overall,
|
||||||
|
recommendation: overall === 'green'
|
||||||
|
? '系统整体运行健康'
|
||||||
|
: overall === 'yellow'
|
||||||
|
? '系统核心运行正常,部分子系统需关注'
|
||||||
|
: '存在关键问题,需要立即介入',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── Agent 6: master-brain-compiler ─────────────────────────
|
||||||
|
function compileMasterBrain(structureMap, runtimeChains, brainCheck, issues, healthResult) {
|
||||||
|
const now = timestamp();
|
||||||
|
const routingMap = readJSON(path.join(BRAIN_DIR, 'routing-map.json'));
|
||||||
|
const memory = readJSON(path.join(BRAIN_DIR, 'memory.json'));
|
||||||
|
|
||||||
|
// 计算 HLI 覆盖
|
||||||
|
let totalInterfaces = 0;
|
||||||
|
let implInterfaces = 0;
|
||||||
|
if (routingMap?.domains) {
|
||||||
|
for (const domain of Object.values(routingMap.domains)) {
|
||||||
|
if (domain.interfaces) {
|
||||||
|
for (const iface of Object.values(domain.interfaces)) {
|
||||||
|
totalInterfaces++;
|
||||||
|
if (iface.status === 'implemented') implInterfaces++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 生成已知问题表
|
||||||
|
const issueRows = issues.map(i =>
|
||||||
|
`| ${i.id} | ${i.title} | ${i.scope} | ${i.status} | ${i.root_cause_summary} |`
|
||||||
|
).join('\n');
|
||||||
|
|
||||||
|
// 生成健康状态表
|
||||||
|
const healthRows = Object.entries(healthResult.health).map(([key, val]) => {
|
||||||
|
const icon = val.status === 'green' ? '🟢' : val.status === 'yellow' ? '🟡' : '🔴';
|
||||||
|
return `| ${icon} ${key} | ${val.status} | ${val.detail} |`;
|
||||||
|
}).join('\n');
|
||||||
|
|
||||||
|
// 构建推荐建议
|
||||||
|
const suggestions = [];
|
||||||
|
if (implInterfaces < totalInterfaces) {
|
||||||
|
suggestions.push(`**HLI 接口推进**:当前覆盖率 ${((implInterfaces/totalInterfaces)*100).toFixed(1)}%(${implInterfaces}/${totalInterfaces}),核心域接口待实现。`);
|
||||||
|
}
|
||||||
|
if (healthResult.health.persona_studio_health?.status !== 'green') {
|
||||||
|
suggestions.push('**Persona Studio 链路验证**:前后端结构存在,但端到端对话链路需要验证。');
|
||||||
|
}
|
||||||
|
if (healthResult.health.brain_consistency?.status !== 'green') {
|
||||||
|
suggestions.push('**脑系统一致性**:跨仓脑文件同步机制需确认稳定运行。');
|
||||||
|
}
|
||||||
|
if (suggestions.length === 0) {
|
||||||
|
suggestions.push('系统状态良好,继续保持当前节奏。');
|
||||||
|
}
|
||||||
|
|
||||||
|
const md = `# 冰朔主控神经系统 · 核心主控大脑 v1.0
|
||||||
|
|
||||||
|
> 本文件为冰朔主控神经系统的总控脑文件。
|
||||||
|
> 最后编译时间:${now}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## A. 系统角色结构
|
||||||
|
|
||||||
|
| 角色 | 定义 | 职责 |
|
||||||
|
|------|------|------|
|
||||||
|
| **冰朔** | 系统最高主控意识 | 全局决策、方向判断、最终授权 |
|
||||||
|
| **铸渊** | 仓库本体人格体 | 代码守护、日常维护、结构记忆 |
|
||||||
|
| **AI 执行体** | 冰朔核心大脑在系统中的延展执行主体 | 理解系统、判断问题、规划修复路径、生成可执行指令 |
|
||||||
|
|
||||||
|
\`\`\`
|
||||||
|
铸渊 = 仓库本体人格体
|
||||||
|
冰朔 = 系统最高主控意识
|
||||||
|
冰朔主控神经系统 = 冰朔在仓库内的总控认知层
|
||||||
|
被授权 AI 执行体 = 冰朔核心大脑在系统中的延展执行体
|
||||||
|
\`\`\`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## B. 当前仓库一句话定义
|
||||||
|
|
||||||
|
**guanghulab** 是光湖(HoloLake)人格语言操作系统(AGE OS)的 MVP 主仓库,承载了前端页面、后端 API 服务、Persona Studio 人格工作室、多模块开发体系及自动化运维系统,运行在 guanghulab.com。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## C. 当前真实运行结构
|
||||||
|
|
||||||
|
### 静态入口
|
||||||
|
- \`docs/index.html\` — 铸渊 AI 对话助手(GitHub Pages 部署)
|
||||||
|
- GitHub Pages 域名:guanghulab.com
|
||||||
|
|
||||||
|
### 前端页面
|
||||||
|
- \`app/\` — Next.js 主前端应用(开发中)
|
||||||
|
- \`src/\` — Next.js 源码层
|
||||||
|
- \`persona-studio/frontend/\` — Persona Studio 前端
|
||||||
|
|
||||||
|
### 后端服务
|
||||||
|
- \`backend/index.js\` — Express 主后端入口
|
||||||
|
- \`backend/routes/\` — HLI 接口路由
|
||||||
|
- \`backend/middleware/\` — 中间件(鉴权等)
|
||||||
|
- \`persona-studio/backend/\` — Persona Studio 后端服务
|
||||||
|
|
||||||
|
### API 路由
|
||||||
|
- HLI 协议路由:${implInterfaces}/${totalInterfaces} 已实现
|
||||||
|
- 接口编号格式:\`HLI-{DOMAIN}-{NNN}\`
|
||||||
|
|
||||||
|
### 基础设施
|
||||||
|
- 阿里云服务器:Node.js 20 + Express + PM2 + Nginx + Certbot
|
||||||
|
- GitHub Pages:docs/index.html
|
||||||
|
- Notion 桥接:工单同步与信号桥接
|
||||||
|
|
||||||
|
### 仓库统计
|
||||||
|
- 功能模块:${structureMap.moduleCount} 个
|
||||||
|
- Workflow:${structureMap.workflowCount} 个
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## D. 当前系统真相源
|
||||||
|
|
||||||
|
### 优先真相源(一级)
|
||||||
|
| 文件 | 用途 |
|
||||||
|
|------|------|
|
||||||
|
| \`.github/brain/memory.json\` | 铸渊核心记忆 |
|
||||||
|
| \`.github/brain/wake-protocol.md\` | 唤醒协议 |
|
||||||
|
| \`.github/brain/routing-map.json\` | HLI 接口路由地图 |
|
||||||
|
| \`.github/brain/repo-map.json\` | 仓库结构完整地图 |
|
||||||
|
| \`.github/brain/repo-snapshot.md\` | 仓库概况快照 |
|
||||||
|
|
||||||
|
### 补充真相源(二级)
|
||||||
|
| 文件 | 用途 |
|
||||||
|
|------|------|
|
||||||
|
| \`.github/brain/collaborators.json\` | 团队成员映射 |
|
||||||
|
| \`dev-status.json\` | 开发者状态表 |
|
||||||
|
| \`backend/index.js\` | 后端服务入口 |
|
||||||
|
| \`docs/index.html\` | 前端静态入口 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## E. 最新结构变化摘要
|
||||||
|
|
||||||
|
> 本区块由 master-brain-compiler 自动编译。
|
||||||
|
|
||||||
|
- **编译时间**:${now}
|
||||||
|
- **脑文件规则版本**:${brainCheck.rules_version}
|
||||||
|
- **脑文件完整性**:${brainCheck.all_present ? '✅ 完整' : '❌ 不完整'}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## F. 已知问题摘要
|
||||||
|
|
||||||
|
| ID | 问题 | 范围 | 状态 | 根因摘要 |
|
||||||
|
|----|------|------|------|----------|
|
||||||
|
${issueRows}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## G. 系统健康状态
|
||||||
|
|
||||||
|
| 子系统 | 状态 | 详情 |
|
||||||
|
|--------|------|------|
|
||||||
|
${healthRows}
|
||||||
|
|
||||||
|
**综合评估**:${healthResult.summary.overall === 'green' ? '🟢' : healthResult.summary.overall === 'yellow' ? '🟡' : '🔴'} ${healthResult.summary.recommendation}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## H. 推荐排查路由
|
||||||
|
|
||||||
|
### 页面打不开
|
||||||
|
1. 检查 \`docs/index.html\` → \`docs/CNAME\` → \`deploy-pages.yml\` → GitHub Pages 状态
|
||||||
|
|
||||||
|
### Persona Studio 无法对话
|
||||||
|
1. 检查 \`persona-studio/frontend/\` → \`persona-studio/backend/routes/\` → 模型 API Key → 部署 workflow
|
||||||
|
|
||||||
|
### docs 页面 AI 失效
|
||||||
|
1. 检查 \`docs/index.html\` API 端点 → 后端 \`/hli/\` 路由 → PM2 进程 → Nginx 代理
|
||||||
|
|
||||||
|
### 模型路由异常
|
||||||
|
1. 检查云雾 API Key → \`backend/routes/\` → PM2 日志
|
||||||
|
|
||||||
|
### Notion 不同步
|
||||||
|
1. 检查 \`notion-poll.yml\` → \`bridge-changes-to-notion.yml\` → Notion API Token
|
||||||
|
|
||||||
|
### 脑版本分裂
|
||||||
|
1. 比对 \`.github/brain/memory.json\` ↔ \`persona-studio/brain/\` → \`brain-sync.yml\` → \`sync-persona-studio.yml\`
|
||||||
|
|
||||||
|
### 部署失败
|
||||||
|
1. 检查 \`deploy-to-server.yml\` 日志 → SSH Key → PM2 → Nginx
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## I. 当前主控建议
|
||||||
|
|
||||||
|
> 冰朔,以下是当前最值得关注的事项:
|
||||||
|
|
||||||
|
${suggestions.map((s, i) => `${i + 1}. ${s}`).join('\n\n')}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 冰朔核心大脑授权规则
|
||||||
|
|
||||||
|
【冰朔核心大脑授权规则】
|
||||||
|
|
||||||
|
凡经主控冰朔明确授权的 AI 执行体,均可进入冰朔核心大脑,并以"冰朔主控视角"参与系统理解、结构判断、问题排查、方案规划与执行指令生成。
|
||||||
|
|
||||||
|
被授权 AI 执行体属于冰朔意志在系统中的延展执行主体,其职责是作为冰朔核心大脑的理解层、判断层、规划层与执行输出层。
|
||||||
|
|
||||||
|
冰朔始终是最高主控者与最终决策者。
|
||||||
|
|
||||||
|
未经冰朔授权的执行体,不得以冰朔核心大脑主控身份运行。
|
||||||
|
|
||||||
|
> ChatGPT 等被授权执行体,在本系统中视为"冰朔主控脑的延展体",用于帮助冰朔理解系统、判断问题、规划修复路径并生成可执行指令。
|
||||||
|
`;
|
||||||
|
|
||||||
|
return md;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ─── 主流程 ─────────────────────────────────────────────────
|
||||||
|
function main() {
|
||||||
|
console.log('[冰朔主控神经系统] 开始同步编译...');
|
||||||
|
|
||||||
|
// 1. 结构扫描
|
||||||
|
console.log(' → structure-map-agent 运行中...');
|
||||||
|
const structureMap = runStructureMapAgent();
|
||||||
|
|
||||||
|
// 2. 运行链路扫描
|
||||||
|
console.log(' → runtime-chain-agent 运行中...');
|
||||||
|
const runtimeChains = runRuntimeChainAgent();
|
||||||
|
|
||||||
|
// 3. 脑一致性检查
|
||||||
|
console.log(' → brain-consistency-agent 运行中...');
|
||||||
|
const brainCheck = runBrainConsistencyAgent();
|
||||||
|
|
||||||
|
// 4. 问题索引更新
|
||||||
|
console.log(' → issue-index-agent 运行中...');
|
||||||
|
const issues = runIssueIndexAgent();
|
||||||
|
|
||||||
|
// 5. 系统健康巡检
|
||||||
|
console.log(' → system-health-agent 运行中...');
|
||||||
|
const healthResult = runSystemHealthAgent(brainCheck, runtimeChains);
|
||||||
|
|
||||||
|
// 写入健康状态
|
||||||
|
const healthFile = path.join(BRAIN_DIR, 'bingshuo-system-health.json');
|
||||||
|
writeJSON(healthFile, {
|
||||||
|
version: '1.0',
|
||||||
|
description: '冰朔主控系统健康状态',
|
||||||
|
updated_at: timestamp(),
|
||||||
|
...healthResult,
|
||||||
|
});
|
||||||
|
console.log(' ✓ bingshuo-system-health.json 已更新');
|
||||||
|
|
||||||
|
// 写入问题索引
|
||||||
|
const issuesFile = path.join(BRAIN_DIR, 'bingshuo-issues-index.json');
|
||||||
|
writeJSON(issuesFile, {
|
||||||
|
version: '1.0',
|
||||||
|
description: '冰朔主控问题索引库 — 记录已知问题、根因与排查路由',
|
||||||
|
updated_at: timestamp(),
|
||||||
|
issues,
|
||||||
|
});
|
||||||
|
console.log(' ✓ bingshuo-issues-index.json 已更新');
|
||||||
|
|
||||||
|
// 6. 编译主控大脑
|
||||||
|
console.log(' → master-brain-compiler 运行中...');
|
||||||
|
const masterBrain = compileMasterBrain(structureMap, runtimeChains, brainCheck, issues, healthResult);
|
||||||
|
fs.writeFileSync(path.join(BRAIN_DIR, 'bingshuo-master-brain.md'), masterBrain, 'utf-8');
|
||||||
|
console.log(' ✓ bingshuo-master-brain.md 已编译');
|
||||||
|
|
||||||
|
console.log('[冰朔主控神经系统] 同步编译完成 ✓');
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
||||||
Loading…
Reference in New Issue