Repository navigation
fix: 共享网关连接下重新登录失败不再断开所有客户端,新增连接验证 - #41
Merged
lazyalex616 merged 1 commit intoNov 2, 2026
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
常驻 HTTP 模式下所有客户端共用同一个网关连接,现有实现有几处会让一个操作断掉所有人的连接。本 PR 修复这些问题,并补上「真实验证连接」的能力。不改变任何使用方式,版本号 0.1.1 → 0.1.2。
修复
GatewayManager.connect()原来先关闭现有连接再登录。新登录码输错或新地址不通时,原本可用的连接也没了。现在先建立并认证新连接,成功后才替换并关闭旧连接;失败时关闭新连接,旧连接保持不变。connect()串行执行。mijia_disconnect说明里「建议在完成所有操作后调用以释放资源」会让 AI 用完就断开,常驻模式下所有客户端同时掉线,登录码也已作废。改为「仅在用户明确要求时调用」,并写明影响。mijia_auth已连接时的提示不再要求「先调用 mijia_disconnect」,改为新增的reconnect=true参数。新增
mijia_auth的reconnect参数:已连接时更换网关或重新登录,新连接成功后才替换。失败时返回「原有网关连接保持可用」。mijia_status的verify参数:绕过缓存,向网关实际发一次轻量只读请求(getVarScopeList),返回是否响应与耗时。原来的connected只是本地标志,网关重启等情况下可能与实际不符。GatewayManager.verify()(接口上为可选方法,保持网页版和现有替身兼容)。文档
docs/one-command-setup-plan.md:「一条命令安装与管理」的整体实施计划,本 PR 是其中第 1 阶段。测试
tests/core/gatewayManager.test.ts(8 项,替身客户端,不连接真实网关):重新登录失败保留原连接、成功后才替换、首次失败保持未连接、并发登录串行、前一次失败不影响后续、verify 三种结果、disconnect。tests/mcp/http.test.ts:断言新提示不再要求先断开,覆盖mijia_status verify=true。