PicoBot/Cargo.toml
oudecheng 14d903e067 fix: Agent 执行与显示层解耦,修复锁屏冻结根因
浏览器锁屏导致 WebSocket 半死,ws_sender.send().await 永久阻塞,
级联阻塞 dispatcher → MessageBus → Agent Loop,后端停止执行直到解锁。

基于第一性原理建立"执行-显示解耦"原则:agent 执行只依赖 SQLite
持久化,实时广播是可丢弃的最佳努力通道。

核心改动:
- MessageBus::publish_outbound 由 send().await 改为 try_send(),
  bus 满时丢弃消息并告警,agent 不再被显示层阻塞
- WebSocket writer task 包裹 30s 超时,使用每连接独立的
  CancellationToken(非共享 CliChannel 级 token),避免一个连接
  超时关闭所有连接;writer 退出时 cancel 通知主 loop 退出
- CliChannel::send 由 send().await 改为 try_send(),避免 dispatcher
  单线程被卡住的 writer 阻塞 37s
- 全仓 13 处 publish_outbound 调用统一区分 Dropped(warn)/Closed(error)
- scheduler 3 处 ? 改为 warn,避免 Dropped 触发 misfire 重试风暴
- 前端 WebSocket 添加 25s ping + 指数退避重连(3s→60s封顶)
- 前端 session_list 区分重连恢复/首次连接,重连时保留 messages
  并刷新 topic 列表

经五轮对抗性审查验证,修复了共享 cancel token、dispatcher 阻塞、
load_chat_messages 跨 topic 污染、原 session 删除后状态不一致等
回归问题。

同时升级版本号至 0.3.0 并更新 CHANGELOG。

验证:cargo clippy --all-targets --all-features ✓
      npm run build ✓ | useChat.test.ts 13 passed ✓
2026-08-04 10:55:52 +08:00

81 lines
2.6 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[package]
name = "picobot"
version = "0.3.0"
edition = "2024"
[lints.rust]
# 编译期硬错误:避免明显的内存安全/正确性隐患
unsafe_op_in_unsafe_fn = "warn"
rust_2018_idioms = "warn"
[lints.clippy]
# 渐进式策略:
# - 不直接声明 lint groupcorrectness/suspicious/complexity/perf
# 因为 lint group 在 [lints] 中需用 priority 语法,简单 = "warn" 会报错;
# 且 clippy 默认已把 correctness 设为 deny无需重复声明。
# - 仅显式 warn 少量高价值且存量不大的具体规则,避免一上线淹没在噪音中。
# 后续随着存量问题清理,可逐步把 unwrap_used/expect_used 升级为 warn。
redundant_clone = "warn"
dbg_macro = "warn"
print_stderr = "warn"
print_stdout = "warn"
[dependencies]
reqwest = { version = "0.13.2", default-features = false, features = ["json", "rustls", "multipart", "stream"] }
dotenv = "0.15"
serde = { version = "1.0", features = ["derive"] }
regex = "1.0"
serde_json = "1.0"
serde_yaml = "0.9"
async-trait = "0.1"
thiserror = "2.0.18"
tokio = { version = "1.0", features = ["full"] }
tokio-util = { version = "0.7", features = ["rt"] }
uuid = { version = "1.0", features = ["v4"] }
axum = { version = "0.8", features = ["ws"] }
tokio-tungstenite = { version = "0.29.0", features = ["rustls-tls-webpki-roots", "rustls"] }
futures-util = "0.3"
clap = { version = "4", features = ["derive"] }
dirs = "6.0.0"
prost = "0.14"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter", "json"] }
tracing-appender = "0.2"
anyhow = "1.0"
chrono = { version = "0.4", features = ["serde"] }
chrono-tz = "0.10"
cron = { version = "0.13", features = ["serde"] }
iana-time-zone = "0.1"
mime_guess = "2.0"
base64 = "0.22"
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "gif", "webp"] }
tempfile = "3"
meval = "0.2"
rusqlite = { version = "0.39", features = ["bundled"] }
r2d2 = "0.8"
r2d2_sqlite = "0.34"
rustls = { version = "0.23", features = ["ring"] }
wechatbot = { path = "vendor/wechatbot" }
encoding_rs = "0.8"
libc = "0.2"
gray_matter = { version = "0.2", default-features = false, features = ["yaml"] }
# MCP (Model Context Protocol) support
rmcp = { version = "1.7", features = [
"client",
"transport-child-process",
"transport-streamable-http-client-reqwest",
"reqwest",
] }
schemars = "1.0"
http = "1"
tower-http = { version = "0.6", features = ["fs"] }
rust-embed = "8"
[target.'cfg(windows)'.dependencies]
windows-sys = { version = "0.59", features = [
"Win32_System_Threading",
"Win32_System_Diagnostics_Debug",
"Win32_Foundation",
"Win32_System_Kernel",
] }