v0.7.10
Pi Agent Desktop v0.7.10 😎
🇨🇳 中文说明
我们很高兴发布 v0.7.10 版本!本次更新专注于系统架构稳定性、渲染效率以及异步 I/O 吞吐性能的深度优化。我们解决了一系列潜在的连接风暴、内存泄漏和主线程同步阻塞问题,以带来更稳定、低延迟的高频流式对话体验。
🚀 核心改进与优化
- SSE 连接指数退避重连与自愈故障恢复 (优化点 5)
- 改进:SSE 连接断开时的自动重试机制从固定 1 秒探针升级为指数退避重连算法(1s -> 2s -> 4s -> 8s -> 16s,最大 30s 延迟),并将连续失败尝试次数上限限制为 5 次。
- 自愈:当自动重连耗尽进入失败状态时,聊天视口顶部将渲染红色网络异常通知条,支持用户一键“手动重新连接”并重置重试计数。
- 多
onDestroy清理回调队列 (优化点 6)- 改进:重构了
AgentSessionWrapper中的清理注销逻辑,支持同时安全注册多个注销钩子。销毁会话时采用try-catch循环保护执行所有回调。 - 收益:避免了多个内部模块间清理动作互相覆盖的隐患,彻底消除 Electron 与 Server 的 IPC 句柄内存泄露。
- 改进:重构了
- 去定时器化与消息组件 Memo 隔离 (优化点 7 & 8)
- 改进:将
UserMessageView与AssistantMessageView通过React.memo包裹以避免重复重绘;彻底移除了流式接收时每 300ms 心跳触发的setInterval轮询定时器,改用useEffect配合纯数据驱动推演 TPS 吞吐率和 thinking 运行时长。 - 收益:消除了高频流式输出下的计时器和状态竞争(Timer-State Competition),极大降低了 CPU 占用,打字流更加平稳流畅。
- 改进:将
- 全异步会话 I/O 文件加载 (优化点 9)
- 改进:全面使用
fs/promises重写读盘机制,实现异步 JSONL 解析与首行会话头读取,替换掉原先在 API 接口中同步阻塞的SessionManager.open()方法。 - 收益:防止在加载、切换较大会话历史文件时死锁 Node.js 服务端的事件循环,消除了页面出现无响应或卡顿的现象。
- 改进:全面使用
- 消息列表原生 CSS 虚拟化 (优化点 10)
- 改进:在消息列表容器中引入了现代浏览器原生的 CSS 虚拟化特性:
content-visibility: auto与contain-intrinsic-size: auto 150px。 - 收益:由 Chromium 容器自动跳过视口外消息 DOM 的排版重绘计算。既保持了极简的 DOM 结构,又完美兼容现有的 React Ref 滚动锚定,保障超长历史对话下的 60fps 流畅滑动。
- 改进:在消息列表容器中引入了现代浏览器原生的 CSS 虚拟化特性:
- 规范硬化与 100% 测试通过
- 移除了测试代码中所有遗留的 explicit
any,清理了所有未使用的变量及导入。 - 类型校验 (
npx tsc --noEmit)、ESLint 代码规范审计 (npm run lint) 和全量单元测试(135 个用例 100% 通过)均无错通过。
- 移除了测试代码中所有遗留的 explicit
🇬🇧 English Release Notes
We are excited to release v0.7.10! This release focuses on deep optimizations in system architectural stability, rendering efficiency, and asynchronous I/O performance. We resolved potential connection storms, memory leaks, and event-loop blocking issues to deliver a smoother, low-latency, high-frequency streaming conversation experience.
🚀 Key Improvements & Optimizations
- Exponential Backoff Reconnection & Self-Healing (Opt 5)
- Change: Replaced the fixed 1-second reconnect probe for Server-Sent Events (SSE) with an Exponential Backoff Reconnection Algorithm (1s -> 2s -> 4s -> 8s -> 16s, capped at 30s) and capped consecutive failures at 5 attempts.
- Self-Healing: When attempts are exhausted, a red network error banner appears at the top of the chat, allowing users to trigger a manual reconnect instantly and reset the retry count.
- Multiple
onDestroyCleanup Callbacks (Opt 6)- Change: Upgraded the cleanup mechanism in
AgentSessionWrapperto support a registry of multiple callback hooks, executed safely within atry-catchloop upon session destruction. - Impact: Eliminates cleanup overrides between internal modules, completely resolving memory and IPC handle leakage between Electron and the server.
- Change: Upgraded the cleanup mechanism in
- No-Timer TPS Calculation & Memoized Message Views (Opt 7 & 8)
- Change: Wrapped sub-message views (
UserMessageView,AssistantMessageView) withReact.memoto isolate rendering. Removed the 300mssetIntervalheartbeat loop, using a pure data-drivenuseEffectto calculate TPS and thinking duration on block updates. - Impact: Resolves timer-state competition during token streaming, drastically lowering CPU usage and resulting in a much smoother typewriter effect.
- Change: Wrapped sub-message views (
- Fully Asynchronous Session I/O Loading (Opt 9)
- Change: Rewrote JSONL file loading and header extraction with asynchronous I/O using
fs/promises. Removed all blocking synchronousSessionManager.open()invocations within the API layer. - Impact: Prevents Node.js event-loop starvation when loading or switching large session files, eliminating freeze and stutter issues.
- Change: Rewrote JSONL file loading and header extraction with asynchronous I/O using
- Native CSS Virtualization for Message Lists (Opt 10)
- Change: Integrated native browser virtualization using
content-visibility: autoandcontain-intrinsic-size: auto 150pxon message wrapper elements. - Impact: Offloads off-screen DOM layout and repaint operations directly to Chromium. This keeps the DOM tree lightweight while preserving existing React Refs and scroll anchoring, ensuring a fluid 60fps scrolling experience for long conversations.
- Change: Integrated native browser virtualization using
- Strict Code Audits & 100% Unit Test Pass
- Removed all explicit
anycasts from test mocks and cleaned up all unused imports and variables. - Successfully validated TypeScript types (
npx tsc --noEmit), passed ESLint audits (npm run lint), and passed 135/135 unit tests successfully.
- Removed all explicit