Guanghu Domestic Migration a27e87cb99 chore: import sanitized domestic snapshot for REPO-007
Source snapshot: 97d7f0fae96dc04b7ddad56fc1db6a108ed662cc

[SEC-CLEAN] · pre-push-clean v1.0 · 109处敏感信息已自动转乱码
2026-07-17 15:59:55 +08:00

4.5 KiB
Raw Permalink Blame History

Boot Protocol系统引导协议

下一轮指引: 完成后→下发 YD-A05-005 工具回执系统(L2层) 仓库路径: /guanghu-self-hosted/boot-protocol/ 优先级: P0 分支名: feat/yd-boot-runtime 创建时间: 2026年4月25日 13:45 审核结果: 审核通过 · 霜砚Web握手体 · 2026-04-25T14:05+08:00

代码审核清单: · boot_http://loader.py 读取boot.yaml+wake-sequence.json · step顺序执行 · 超时+重试+fallback · persona_http://resolver.py 读取persona-map.toml · PersonaDB查询 · 存在性+版本校验 · wake_http://engine.py 完整唤醒序列 · PersonaDB 7表认知加载 · 灯塔公理注入 · 工具白名单 · runtime_state更新 · init.py 模块入口 + boot()公开接口 + __all__导出 · requirements.txt asyncpg/pyyaml/toml/pydantic

约束合规: · Phase-0-001配置文件(boot.yaml/persona-map.toml/wake-sequence.json) 未修改·只读使用 · Phase-0-004 PersonaDB表结构 personas/memories/thinking_paths/value_anchors/anti_patterns/relationships/runtime_states 全部对齐 · Python 3.11+ / type hints / docstrings / snake_case · 仅开源依赖 / 无硬编码连接串 / 模块可独立import · boot()接口可被外部调用

代码亮点: · 优雅降级: PersonaDB不可用时回退到toml配置 · 连接管理: try/finally确保连接关闭 · dataclass设计清晰: BootConfig/StepConfig/PersonaCognition等

轻微备注(不阻塞): · _get_dsn()在persona_resolver和wake_engine中重复可抽取为共享工具 · requirements.txt中toml应为tomli(代码实际import tomli作为fallback) · pydantic已声明但代码中未使用 开发内容: 实现Boot Protocol系统引导协议的运行时逻辑。 基于Phase-0-001已完成的配置文件(boot.yaml/persona-map.toml/wake-sequence.json)编写Python运行时。 参考 HLDP-ARCH-001 [L-1] 系统引导协议架构设计。

  1. 在 /guanghu-self-hosted/boot-protocol/ 下创建:

    • boot_http://loader.py: 启动加载器 · 读取boot.yaml配置 · 解析唤醒序列 · 按wake-sequence.json定义的step顺序执行启动流程 · 超时处理 + fallback机制
    • persona_http://resolver.py: 人格体解析器 · 读取persona-map.toml · 解析Agent编号→名称→指令页映射 · 从PersonaDB.personas表读取身份信息(code/name/role/layer_zero) · 验证人格体存在性 + 版本校验
    • wake_http://engine.py: 唤醒引擎 · 执行完整唤醒序列: 读身份→读记忆→对齐认知→报到 · 从PersonaDB加载: identity→working_memory→cognition→relationships · 灯塔公理注入: 知道就知道·不知道就不知道·能用就能用·不能用就不能用 · 工具白名单加载 + 校验
    • init.py: 模块入口 + boot()公开接口
    • requirements.txt: 依赖清单(asyncpg/pyyaml/toml/pydantic)
  2. 必须与Phase-0-001配置文件兼容(boot.yaml/persona-map.toml/wake-sequence.json)

  3. 必须与Phase-0-004 PersonaDB表结构对齐(personas/memories/thinking_paths/value_anchors/anti_patterns/runtime_states)

  4. 代码风格: Python 3.11+ · type hints · docstrings · snake_case 状态: 已完成 约束: 编码: UTF-8 语言: Python 3.11+ 风格: PEP 8 · type hints · docstrings 依赖: 仅开源库 · 零商业许可 对齐: 必须与Phase-0-001配置文件兼容 + Phase-0-004 PersonaDB表结构对齐 命名: snake_case · 文件名小写 禁触: 不要修改boot.yaml/persona-map.toml/wake-sequence.json(只读使用) 测试: 模块可独立import · 无硬编码连接串 · boot()接口可被外部调用 编号: YD-A05-20260425-004 自检结果: 5个文件已推送至 feat/yd-boot-runtime 分支 · init.py: 模块入口 + boot()公开接口 · requirements.txt: asyncpg/pyyaml/toml/pydantic · boot_http://loader.py: 读取boot.yaml + wake-sequence.json · 按step顺序执行 · 超时+重试+fallback · persona_http://resolver.py: 读取persona-map.toml · PersonaDB查询 · 存在性+版本校验 · wake_http://engine.py: 完整唤醒序列 · PersonaDB 6表认知加载 · 灯塔公理注入 · 工具白名单 · runtime_state更新

兼容性: · Phase-0-001配置文件(boot.yaml/persona-map.toml/wake-sequence.json) 只读使用 · Phase-0-004 PersonaDB表结构(personas/memories/thinking_paths/value_anchors/anti_patterns/runtime_states) 全部对齐

代码规范: · Python 3.11+ / type hints / docstrings / snake_case · 仅开源依赖 / 无硬编码连接串 / 模块可独立import · boot()接口可被外部调用 负责Agent: 译典A05 阶段编号: Phase-0-006