docs: record the pet window fixes and correct the N-11 root cause
一些检测仍在等待运行
ci / Portable quality checks (push) Waiting to run
ci / Windows Tauri build (push) Waiting to run

The queue recorded N-11's cause as "the rebuild path never called
show()". That was a real code defect and it is fixed, but it was not
this symptom — the pet still did not appear after it. The live log
showed the rebuild path failing outright before the reveal step, so the
record now states that and names the fix that actually worked. The two
root causes I proposed and retracted are kept as their own row, since
"tried and disproved" is worth more to the next reader than a clean
record.

Also formats the queue with prettier, which reflows three tables. One
hunk of that reflow was reverted by hand: a continuation line began
with "+" meaning "and", and prettier normalised it into a nested list
item, turning half a sentence into a bullet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
这个提交存在于:
YokiiroBW 2026-07-27 04:45:09 +08:00
父节点 4f73c0819d
当前提交 3e03a4e8b6
共有 2 个文件被更改,包括 131 次插入 和 126 次删除

查看文件

@ -56,6 +56,10 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
removed them from the tab order, so the focus rule that reveals them could never fire.
- A failure to open the desktop pet's context menu is now reported instead of silently doing
nothing.
- The desktop pet appears when its display mode is set to floating. Switching modes closed the pet
by destroying its window, which forced every later open through a rebuild path that failed
outright; the pet window is now hidden and re-shown instead.
- The desktop pet no longer sits inside an opaque dark card when rendered inside the application.
- One unreachable connection no longer freezes the whole application. The reachability probe now
runs outside the runtime lock, so a slot that is connecting cannot block status, sending,
cancelling or disconnecting on the other slot, and the attempt itself can be interrupted.

查看文件

@ -13,7 +13,7 @@
## 执行状态(2026-07-26 更新)
| 批次 | 状态 | 说明 |
|---|---|---|
| --------------------- | ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| R1 发布阻断批 | **已完成,门槛已验证** | 9 项全部实现。2026-07-26 首次跑完整门槛,发现 2 处编译/lint 失败并修复(详见下方「R1 门槛验证结果」),补写 F-05 缺失的单测。现全绿。 |
| R2 传输层批 | **已完成,门槛已验证** | F-10 – F-13 全部实现,新增 9 条 Rust 测试(`astrbot-desktop` 单元测试 67 → 76)。顺带并入 F-56(P3-4,取消不再置 Disconnected)。全绿。 |
| R3 隔离与状态正确性批 | **已完成,门槛已验证** | F-14 – F-19 全部实现,新增 11 条 Rust 测试(`astrbot-desktop` 单元测试 76 → 87)与 5 条前端测试(19 → 24,含新建的 `ChatPanel.test.tsx`)。全绿。详见下方「R3 实现记录」。 |
@ -62,8 +62,8 @@
- 移除流式总超时后,单条响应失去唯一边界(`read_timeout` 只测两次读之间的间隔,不能替代)。
已加 64MiB 单响应上限,同时约束 `mapper.accumulated`。
- `send_slot_message` 的 `client.take()` 独占窗口原被 120s 总超时封顶,F-10 后变成与回复等长——
期间 sessions / capabilities / upload / download / switch 五个命令全部误报未连接。已改 `clone()`
+ 以 `message_cancellation` 串行化发送(即 **F-49**,因 R2 使其显性化而从 R7 提前)。
期间 sessions / capabilities / upload / download / switch 五个命令全部误报未连接。已改为
`clone()` 并以 `message_cancellation` 串行化发送(即 **F-49**,因 R2 使其显性化而从 R7 提前)。
- `SseLineBuffer` 逐行从头 `drain` 是平方复杂度(hyper 单个 item 可达数百 KiB)。已改游标。
**R2 未覆盖、仍开放**:P1-2 描述中的「发送先入库 user 行」属 F-18(R3),本批未动。
@ -160,14 +160,14 @@
其余批次之间可并行分派给不同分支。
* * *
---
## R1 · 发布阻断批
**目标**:恢复真实 AstrBot 聊天闭环与桌宠功能。9 项全部是小改动(多数一行到一函数),建议 1–2 天内合并,合并后重新走一遍 Q9 门槛。
| ID | 来源 | 位置 | 动作 | 验证 |
| --- | --- | --- | --- | --- |
| -------- | ----- | -------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **F-01** | P0-1 | `crates/desktop-protocol/src/astrbot.rs:453-455`;`src-tauri/src/networking/astrbot_client.rs:440` | **推荐方案 A**:`AstrBotStreamMapper::new(server_instance_id, stream_id)` 增加流级种子(调用方传 `Uuid::new_v4()`),`event_id` 改为 `astrbot-{sid}-{stream}-{seq}`。保留同流内去重语义,事件 ID 全局唯一。(方案 B:sequence 提到 client 级 `AtomicU64` —— 会让协议 crate 依赖 client 生命周期,不推荐;方案 C:astrbot 路径取消去重 —— 最省事但丢掉同流重复防护) | 新增单测:同一 `AstrBotClient` 连续两次 `send_chat_stream`,第二条流的 delta 与 completed 全部到达 sender。真机:同一连接连发 3 条,每条回复完整显示 |
| **F-02** | P1-12 | `src/features/pet/types.ts:47` | 正则 `\\.` → `\.` | `expect(petPackManifestSchema.parse(内置 manifest.json))` 通过 |
| **F-03** | P1-13 | `src-tauri/capabilities/default.json:5` | `windows` 数组加 `"desktop-pet"` | 桌宠窗口能收到 `connection-runtime-event`;拖动与右键菜单生效 |
@ -182,14 +182,14 @@
**建议提交**:`fix(astrbot): scope stream event ids per request` / `fix(pet): correct manifest image pattern` / `fix(tauri): grant desktop-pet capability` / `fix(tauri): allow blob images in production csp` / `fix(chat): restrict markdown link protocols` / `fix(chat): accept null in runtime event contracts` / `fix(protocol): serialize model options in camelCase` / `refactor(ui): share ipc error formatting` / `fix(ui): restore corrupted localized strings`
* * *
---
## R2 · 传输层批(串行,同一分支)
**目标**:让长连接与长回复真正可用。四项都在 `astrbot_client.rs` / `gateway_client.rs` 的流循环,必须串行。
| ID | 来源 | 位置 | 动作 | 验证 |
| --- | --- | --- | --- | --- |
| -------- | ---- | -------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| **F-10** | P1-1 | `gateway_client.rs:100-101`;`astrbot_client.rs:147-148` | 拆分两个 reqwest Client:REST 保留总时限,流式端点**不设** `.timeout()`,改用 `connect_timeout` + 心跳看门狗 / `read_timeout` 做空闲检测 | desktop SSE 连续保持 \>5 分钟不断;AstrBot 生成 \>120s 的长回复完整到达 |
| **F-11** | P1-3 | `astrbot_client.rs:462-463` | `buffer` 改 `Vec<u8>`,按 `\n` 在**字节层**分行,逐行 `String::from_utf8`(保留不完整尾字节到下一 chunk) | 单测:把一条中文 SSE 帧在 UTF-8 字符中间切成两个 chunk 喂入,输出无 `U+FFFD` |
| **F-12** | P1-2 | `runtime.rs:647-653`、`:723-731` | `should_retry_astrbot` 收窄:仅"连接建立失败"可重试;一旦收到响应头/首字节即不再自动重发,改返回可手动重试的错误码 | 单测:mock 在响应体中途断流 → 不产生第二次 POST |
@ -199,12 +199,12 @@
**建议提交**:`fix(net): stop total timeouts from killing streams` / `fix(astrbot): decode sse bytes on line boundaries` / `fix(astrbot): do not resend messages after response start` / `fix(astrbot): finalize streams on cancel and error`
* * *
---
## R3 · 隔离与状态正确性批
| ID | 来源 | 位置 | 动作 | 验证 |
| --- | --- | --- | --- | --- |
| -------- | ----- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------- |
| **F-14** | P1-4 | `runtime.rs:197-325` | 探测移出锁:先置 `Connecting` 快照并 `drop(guard)`,`health()`/`probe()` 在锁外执行,按 generation 回写;激活伊始即安装 `connection_cancellation` 并在 probe 内 `select` | 一个槽连接不可达地址期间,另一槽的 `status()`/发送/断开全部正常;激活中可被 disconnect 打断 |
| **F-15** | P1-10 | `ChatPanel.tsx:144-155`;`App.tsx:391-399`;`DesktopPetView.tsx:46-82`;`src/test/setup.ts` | 三处改 `let active=true; listen().then(fn => active ? unlisten=fn : fn()); return () => {active=false; unlisten?.()}`;测试 mock 改为延迟 resolve 并断言注销次数 | StrictMode 下 delta 不再翻倍;新测试断言 unmount 后注销被调用 |
| **F-16** | P1-11 | `ChatPanel.tsx:80-82,384-412` | `pendingAttachments`、`draft`、`error` 改 `Record<ChatSlot, …>` | 陪伴槽上传附件 → 切运维 → 发送,附件不跟随;运维错误横幅不出现在陪伴槽 |
@ -212,7 +212,7 @@
| **F-18** | P2-3 | `commands.rs:632-656` | 校验通过且确认 client 存在后再 `upsert_chat_message`;失败路径按 message_id 回删或标记 error | 未连接状态下发送,历史里不留 user 行 |
| **F-19** | P2-4 | `commands.rs:412-461` | `probe_connection_slot` 激活前校验 `connection_slots` 分配,拒绝同一 profile 占用两个运行时槽;operations 切换守卫覆盖 probe/disconnect | 同一 profile 依次 probe 双槽 → 第二次被 `profileAlreadyAssigned` 拒绝 |
* * *
---
## R3.5 · 真机反馈批(2026-07-27 追加)
@ -222,7 +222,7 @@
### 已完成
| ID | 位置 | 根因 | 状态 |
| --- | --- | --- | --- |
| -------- | ------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| **N-1** | `styles.css:2183/2456/2655/2735/3134`;`ChatPanel.tsx:822,834,846` | `.message-action-label`(`clip-rect` 屏幕阅读器类)**定义了却从未被任何组件使用**,组件用的是裸 `<span>`;同时按钮被 5 处重复定义中的 3 处当作胶囊按钮,与最终块冲突。文字塞进 2rem 方框后竖排折行 | 已修 |
| **N-2** | `styles.css:509` + `:3106` | `.chat-message-row{align-items:flex-end}` 把头像对齐到 `.chat-message-content` 底边,而该盒子因操作条占位比气泡高一行 → 头像掉到气泡下方 | 已修 |
| **F-40** | `styles.css:3113` | 顺带关闭:`visibility:hidden` 把按钮移出 tab 序,`:focus-within` 永远无法触发。改为仅 `opacity` | 已修(原属 R6) |
@ -253,7 +253,7 @@ F-33 / N-6 / N-7 全部**无法验证**,需先让服务端真的发出图片
AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
| 类型 | 语义 | 实测 |
| --- | --- | --- |
| ------------------ | ------------------------------------ | ------------------------------------------------------------- |
| `streaming: true` | 逐字增量,累计等于 `complete` 的内容 | 第2轮 173 字 = complete 173;第3轮 209 = 209;第4轮 142 = 142 |
| `streaming: false` | **整段已完成的消息** | 第2轮 5 段共 915 字;第3轮 2 段共 469 字;第4轮 1 段 133 字 |
@ -277,17 +277,18 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
### 新增项
| ID | 问题 | 位置 | 状态 |
| --- | --- | --- | --- |
| -------- | -------------------------------------------------- | ------------------------------------------------------------------- | ------------------------------------- |
| **N-9** | 分段消息被拼接进流式消息,并被 `complete` 替换丢弃 | `astrbot.rs:379`(`map_plain`)、`astrbot.rs:405`(`map_complete`) | 真因已定位,待重复性探针结果后实施 |
| **F-44** | 发送后不滚动到底部,流式生成发生在视口外 | `ChatPanel.tsx` 全文件无 scroll 代码 | 已归档于 R6,用户 2026-07-27 反馈确认 |
| **N-8** | 消息进入列表无过渡动画,生硬出现 | `ChatPanel.tsx` 消息列表渲染 | 新记录,用户要求类 TG 的淡入过渡 |
### 桌宠两项(2026-07-27 真机反馈)
### 桌宠两项(2026-07-27 真机反馈,均已闭环)
| ID | 问题 | 根因 | 状态 |
| --- | --- | --- | --- |
| -------- | ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **N-10** | 应用内桌宠周边是不透明深色卡片 | `styles.css:1621` 的 `.app-pet-overlay .pet-window-embedded` 画了 92%/88% 不透明渐变 + 边框 + 投影。基类 `.pet-window` 本是 `transparent`,但该规则特异度更高(0,2,0)。**这是同一样式表第四次因重复/覆盖定义产生真实故障** | 已修 |
| **N-11** | 切到「桌面悬浮」模式桌宠直接消失 | `close_pet_window`(`lib.rs:394`)用 `destroy()` 而非隐藏;应用启动时默认 `app-ui` 模式会立刻销毁配置创建的窗口。此后 `open_pet_window` 必走 `WebviewWindowBuilder::from_config` 重建分支,而配置声明 `"visible": false` —— **窗口建出来了但从未 `show()`**。已存在窗口的分支有 `.show()` 与定位,重建分支两者皆无 | 已修(抽出 `reveal_pet_window` 供两条路径共用) |
| **N-11** | 切到「桌面悬浮」模式桌宠直接消失 | `close_pet_window` 用 `destroy()` 而非隐藏。应用启动时默认 `app-ui` 模式会立刻销毁配置创建的窗口(真机日志:启动时 `close_pet_window invoked window_existed=true` 出现两次,React StrictMode 双挂载),此后 `open_pet_window` 必走 `WebviewWindowBuilder::from_config` 重建分支,而**该分支整体失败**——日志显示 `open_pet_window invoked window_existed=false` 之后既无 `pet window revealed` 也无失败行,即在配置查找 / `from_config` / `build()` 三处裸 `?` 之一返回 Err 且无日志。改为 `hide()` 后每次打开都走「窗口已存在」这条已验证可用的分支 | 已修(`4f73c08`)。真机确认:`window_existed=true` → `pet window revealed monitors=2 monitor_work_area=3840x2088+0+0 position=3554,1742 size=270x330 visible=true`,右下角 16px 安全边距正确 |
| — | _N-11 排查中提出并被推翻的两条根因_ | ①「重建分支没调 `show()`」——是真实代码缺陷(配置声明 `"visible": false`),已修,但**不是本症状的原因**:修完桌宠依旧不出现。②「`DesktopPetView` 缺 Suspense 边界」——**变异测试直接推翻**,React 19 容忍无边界的 lazy 组件。教训:在拿到日志前不应给根因结论,这一条上我连错两次 | 已记录 |
## 功能空缺盘点(2026-07-27)
@ -296,7 +297,7 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
均为**逐条 grep 验证**,非文档声称:
| 能力 | 实际状态 |
| --- | --- |
| ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **语音聊天** | `ChatPanel.tsx:647` 用浏览器 Web Speech API。**WebView2 不提供 `SpeechRecognition`**,故语音输入在应用内大概率恒不可用;朗读(`speechSynthesis`)可用。而架构 §14.1 定的是「按键录音 → 上传音频 → 服务端 STT → 文本回复 → 可选 TTS」,**方向与现实现不一致**。麦克风绑定聚焦实例、双面板目标显示与快捷键切换:**均未实现** |
| **窗口感知** | Rust 侧已完成:`foreground_window.rs`(191行)、`uia.rs`(339行)、`capture.rs`(363行)。但**只有 `inspect_foreground_window` 与 `inspect_process` 注册为命令**,`uia` 与 `capture` 无任何出口。前端仅 `SettingsPages.tsx:136` 的诊断按钮手动调用,**没有任何通路把结果送给陪伴实例** |
| **游戏陪伴** | 仅有 `pet-game-mode-toggle` 事件与 `gameMode` 状态,**只改窗口偏好**,不截图、不读窗口、不产生事件。架构 §14.2 的隔离规则(运维槽位不得自动接收游戏截图/窗口状态/事件)目前无从违反,因为没有数据流 |
@ -320,18 +321,18 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
已加 `trace_frame_shape()`(`astrbot_client.rs`,`RUST_LOG=astrbot_desktop=debug` 开启,只记结构不记内容)。
| ID | 问题 | 候选根因 | 判据 |
| --- | --- | --- | --- |
| ------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| **N-4** | 生成中概率出现两个回复气泡,结束后恢复成一个 | **候选 A = F-34(P2-13)**:`ChatPanel.tsx:976` 与 `commands.rs:412` 同用 `messageId \|\| eventId` 回退,`event_id` 每事件唯一,任一 delta 缺 `message_id` 即自成一条消息。**候选 B**:`ChatPanel.tsx:74-75` 的 `historySessionId` 回退到 `storedSessions[0]`,会加载**另一个会话**的历史并合并 | 日志中 `plain` 帧的 `has_message_id` 是否恒为 true |
| **N-5** | 「恢复成一个」不是自愈 | `activeMessages`(`ChatPanel.tsx:116`)按 sessionId 过滤,只是**遮住**孤儿气泡;React state 与 SQLite 中它仍在 | 需随 N-4 一并清理 |
| **N-6** | 插件发的图片不显示 | `map_media()`(`astrbot.rs:339`)只记 `pending_media` 不产出事件,必须等后续 `attachment_saved` 配对;**若插件的 image 帧自带 id/URL 且无该后续帧,图片被静默丢弃**。另:非图片媒体全丢(F-33)、`pending_media` 单槽位(F-33)、id 字符集限 `[A-Za-z0-9._-]` 挡掉 URL 形态 | 日志中 image 帧的 `data_keys`,以及其后是否出现 `attachment_saved` |
| **N-7** | 图片即便拿到也可能被 CSP 拦 | `tauri.conf.json:45` 的 `img-src 'self' asset: http://asset.localhost data: blob:` 不含任意 http 源 | 若插件走 URL,**倾向代理下载转 blob**,不放宽 `img-src`——放宽等于让渲染层直连任意外部主机 |
* * *
---
## R4 · 数据与凭据安全批
| ID | 来源 | 位置 | 动作 | 验证 |
| --- | --- | --- | --- | --- |
| -------- | ----- | ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
| **F-20** | P1-6 | `database/mod.rs:319-320` | 改 `SELECT * FROM (… ORDER BY updated_at DESC LIMIT ?) ORDER BY updated_at ASC`;补 `before`/`after` 游标参数 | 单测:插入 250 条,加载返回最新 100 条 |
| **F-21** | P1-18 | `diagnostics/redaction.rs:91` | `key_value_regex` 候选加入裸 `token`、`auth[_-]?token`、`id[_-]?token`、`session[_-]?token`;新增 JWT 形态正则 `eyJ[\w-]+\.[\w-]+\.[\w-]+` | 新测试**不使用 known_secrets**:`token=eyJ…`、`?token=…`、YAML `token: eyJ…` 均须被脱敏(现有测试用 canary 掩盖了缺口,需一并重写) |
| **F-22** | P2-11 | `diagnostics/config.rs:213,232,259` | YAML/INI/.env 增加按 key 的行级结构化脱敏(对齐 JSON/TOML 的 `is_sensitive_key` 路径) | `.env` 内 `AUTH_TOKEN=…` 经诊断返回时为 `[REDACTED]` |
@ -339,12 +340,12 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
| **F-24** | P2-10 | `auth.rs:13-20`;`credentials/mod.rs:11-20` | 两个请求结构体手写 `Debug`(敏感字段输出 `[REDACTED]`)或改 `secrecy::SecretString` | 单测断言 `format!("{:?}", req)` 不含明文(对齐 `SecretCredential` 既有测试) |
| **F-25** | P2-12 | `database/mod.rs:524,556` 及相关读写 | 统一 `account_id` 键模型:两表都含并全部读写带上,或彻底移除该列 —— 二选一,写进 ADR | 迁移测试 + 隔离测试 |
* * *
---
## R5 · 协议健壮与契约治理批
| ID | 来源 | 位置 | 动作 | 验证 |
| --- | --- | --- | --- | --- |
| -------- | ----- | -------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| **F-26** | P1-5 | `gateway_client.rs:179-184,282-284` | `UnsupportedEventType` / `InvalidPayload` 降级为事件级跳过(记日志、推进 `last_event_id`),仅版本/身份不匹配保持终态 | 单测:mock 推未知事件类型 → 槽位保持 Connected,后续事件正常 |
| **F-27** | P2-15 | `envelope.rs:171` 及各 payload | 信封与只读 payload 移除 `deny_unknown_fields`(`ToolProposal`/`ToolResult` **保留**);或解析失败跳过并推进游标 | 单测:信封带附加字段仍能解析;不再出现重放死循环 |
| **F-28** | P1-8 | `docs/protocol/v1/schemas/`;`tests/protocol_contract.rs` | 重跑 `export_schemas --write`;新增测试比对 `generated_schemas()` 与磁盘文件 | `cargo test` 即可发现漂移;`connection-profile.schema.json` 含 `remoteDisplayName` |
@ -363,12 +364,12 @@ AstrBot 在一次回复中**交错**投递两类 `plain` 帧:
「同文件相邻改动合并进同一批」的编排原则归入 R5;放入 R4 会让两个可并行分支争夺同一文件。
R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
* * *
---
## R6 · 体验、无障碍与产品红线批
| ID | 来源 | 位置 | 动作 |
| --- | --- | --- | --- |
| -------- | ----- | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| **F-35** | P2-30 | `DesktopPetView.tsx:139-148`;`tauri.conf.json` | **产品红线**:`alwaysOnTop` 默认改 `false`(隔离基线要求气泡/桌宠不默认置顶);embedded 模式跳过偏好写入;非 embedded 先读既有偏好再增量提交 |
| **F-36** | P2-20 | `ChatPanel.tsx:73-74,181-187,264-293` | mark-read 完成后再重取会话列表;仅存在真实 `activeSessionId` 时标已读;非选中槽位监听事件递增未读 |
| **F-37** | P2-21 | `ChatPanel.tsx:468-475` | `retryMessage` 增加 `sessionId === activeSessionId` 过滤;`messageOverride` 与 draft 回退解耦 |
@ -380,12 +381,12 @@ R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
| **F-43** | P2-27 | `ChatPanel.tsx:343-354` | 首次 refresh 失败也建立退避轮询;snapshot schema strict 失败给可见告警而非静默离线 |
| **F-44** | P2-28 | `ChatPanel.tsx` | 消息列表底部锚点 +"接近底部才跟随";unmount 调 `recognition.stop()` / `speechSynthesis.cancel()`;朗读前 Markdown 转纯文本 |
* * *
---
## R7 · 性能与工程化批
| ID | 来源 | 动作 | 预期收益 |
| --- | --- | --- | --- |
| -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| **F-45** | 优化 §2 | `DesktopPetView.tsx:10` 去掉 `?inline` 改普通资源引用,manifest 与 import 同时切到已有的 WebP | lazy chunk 从 \~5.2MB 降到 \~0.6MB |
| **F-46** | 优化 §1 | `activeMessages` memo 依赖改标量 `activeSessionId`;`MessageContent` 套 `React.memo`;`applyRuntimeEvents` 只克隆命中项;`messages` 按会话修剪 | 消除 500ms 全表重渲染与重复 Markdown 解析 |
| **F-47** | 优化 §3 | 附件上传/下载改 Tauri 2 raw body / `tauri::ipc::Response` 二进制通道;Rust 侧去掉 `bytes.clone()` | 16MiB 附件不再膨胀成 1670 万元素数组 |
@ -395,7 +396,7 @@ R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
| **F-51** | P2-31 | `tauri.conf.json` 的 `beforeDevCommand`/`beforeBuildCommand` 改 `pnpm run`;engines 与 `@types/node` 对齐;文档 React 版本更正为 19 | 消除双包管理器混跑 |
| **F-52** | P3-17 | tsconfig 补 `noUnusedLocals`/`noUncheckedIndexedAccess`;eslint 接 jsx-a11y、重开 `set-state-in-effect`;vitest 加 coverage;关掉无谓的 `usePolling` | 编译期即可暴露索引假设类缺陷 |
* * *
---
## R8 · 剩余 P3 与外部依赖
@ -416,12 +417,12 @@ R5 因此由 9 项增至 13 项,与 R3、R4 仍无依赖关系。
- **工具提案六道闸门**:未开始实现属阶段合理;**在闸门落地前不得放开任何工具执行入口**,`connection_policy_status` 应如实上报 guard 未激活。
- **签名更新、双服务器 soak**:维持现状,不在本地伪造。
* * *
---
## 附录 · 批次依赖图与建议分支
| 批次 | 依赖 | 建议分支 | 可并行 |
| --- | --- | --- | --- |
| ---- | ---------- | --------------------------------- | ------------------------------- |
| R1 | 无 | `fix/p02-release-blockers` | 内部 9 项可并行(除 F-06→F-08) |
| R2 | R1 的 F-01 | `fix/astrbot-stream-transport` | 内部串行 |
| R3 | R1 的 F-06 | `fix/slot-isolation-and-state` | Rust 项与前端项可分两人 |