From 014a98581432c84086f9b85fddd61f5d5239ffe3 Mon Sep 17 00:00:00 2001 From: nav Date: Wed, 8 Apr 2026 20:19:41 +0000 Subject: [PATCH] feat: YNX-0102 protocol codec + YNX-0401 server persistence types - Add Yonexus.Protocol/src/codec.ts with encodeBuiltin/decodeBuiltin, rule message parsing, and type-safe envelope builders - Add Yonexus.Server/plugin/core/persistence.ts with ClientRecord, ServerRegistry, and serialization helpers - Update exports in both modules --- TASKLIST.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/TASKLIST.md b/TASKLIST.md index 6c49465..dbe981d 100644 --- a/TASKLIST.md +++ b/TASKLIST.md @@ -83,6 +83,9 @@ --- ### YNX-0102 实现协议编解码工具 +**状态** +- [x] 已完成(2026-04-08) + **目标** - 提供统一的字符串协议解析与序列化能力 @@ -97,6 +100,13 @@ - `builtin::{json}` 可稳定双向转换 - `rule::content` 和 `rule::sender::content` 都能正确解析 +**已完成内容** +- 已新增 `Yonexus.Protocol/src/codec.ts` +- 已实现 `encodeBuiltin` / `decodeBuiltin` 及类型安全的 envelope builders +- 已实现 `parseRuleMessage` / `parseRewrittenRuleMessage` / `encodeRuleMessage` / `encodeRewrittenRuleMessage` +- 已提供 `CodecError` 标准错误类及辅助函数 `isBuiltinMessage` +- 已更新 `Yonexus.Protocol/src/index.ts` 导出 codec 模块 + --- ### YNX-0103 定义协议错误码与错误对象 @@ -259,6 +269,9 @@ ## Phase 4 — 持久化与状态模型 ### YNX-0401 定义 Server 持久化记录结构 +**状态** +- [x] 已完成(2026-04-08) + **目标** - 把 `PLAN.md` 中的 `ClientRecord` 落到代码 @@ -272,6 +285,14 @@ **验收标准** - 持久化结构足以支撑 pairing/auth/heartbeat +**已完成内容** +- 已新增 `Yonexus.Server/plugin/core/persistence.ts` +- 已实现 `ClientRecord`、`ClientSession`、`ServerRegistry` 接口 +- 已实现 `SerializedClientRecord`、`ServerPersistenceData` 持久化结构 +- 已提供 `createClientRecord`、`serializeClientRecord`、`deserializeClientRecord` 工厂函数 +- 已提供 `isPairable`、`hasPendingPairing`、`isPairingExpired`、`canAuthenticate` 状态检查函数 +- 已更新 `Yonexus.Server/plugin/index.ts` 导出 persistence 模块 + --- ### YNX-0402 实现 Server 状态存储