新增: 小程序配置持久化与心跳闭环 + 文档同步

小程序(mobile client)三项改进:

一、配置持久化(分发前置)
- 运行时配置(relay 地址/设备 ID/token/心跳间隔)接入 storage
- 懒加载:首次读取从 storage 恢复,合并默认值兼容旧字段
- 新增重置函数:清除 storage + 回到默认占位值
- 读写失败降级不崩溃

二、心跳 pong 闭环(移动网络可靠性)
- 中继服务识别小程序心跳 ping,直接回 pong(不经桌面端透传)
- 小程序收到 pong 更新入站时间,半连接看门狗据此判活
- 治移动网络 TCP 半连接挂死(socket 仍开但无响应)

三、文档同步关闭已完成项
- 条件表达式引擎:求值器+执行器+前端编辑入口+翻译均已落地
- 流式状态按会话隔离:accessor 委派 per-conv Map 已落地
- 灵感录入增强:表单已含来源/标签/优先级字段
This commit is contained in:
2026-06-28 23:55:51 +08:00
parent cc3ef5bc1d
commit cb7e1fce82
6 changed files with 119 additions and 34 deletions

View File

@@ -674,7 +674,14 @@ function subscribeWs(): void {
}
},
onControl: (msg: ControlMessage) => {
// 心跳响应等,miniapp 仅 console(不维持在线状态 UI)
// 心跳 pong 响应:relay 收到 miniapp ping 后直接回 pong(不经 device),
// miniapp 据此更新 lastPongTime 看门狗(ws.ts 已维护 lastInboundAt,但该路径不经过
// onControl,这里记录到变量供日志诊断)。pong 闭环治移动网络 TCP 半连接挂死。
if (msg.control_kind === 'pong') {
console.debug('[useAiChat] 收到心跳 pong(relay 响应,连接健康)')
return
}
// 其他 control 消息(hello_ack / pair 等)仅 console 不维持在线状态 UI
console.log('[useAiChat] control', msg)
},
onStatus: (status: WsStatus, detail?: string) => {