Skip to content

feat(sidechat): render local images and present deliveries - #1044

Merged
Menghuan1918 merged 2 commits into
omdsh-dev:devfrom
NolanHo:fix/sidechat-render-parity
Oct 23, 2026
Merged

Menghuan1918 merged 2 commits into
omdsh-dev:devfrom
NolanHo:fix/sidechat-render-parity

Conversation

@NolanHo

@NolanHo NolanHo commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

问题

Side Chat 与主 Session 历史的渲染能力差距较大:

  • 本地 Markdown 图片只显示 alt 文本(共享 MarkdownText 只接受绝对 http(s),Side Chat 未提供图片词汇);
  • 模型 present 的文件/图片只有通用 tool 行,没有交付卡片;
  • 250 ms 流式推送和每次 composer 按键都会重解析整个 transcript(markdownTextProps 每次新建 labels,打穿宿主 MarkdownText 的 memo);live 行也没有 streaming。

改动

  • markdownTextProps 按五个 label 值缓存 labels(32 条 FIFO);SideChatView 对未 settled 的 assistant 行传 streaming。
  • Side Chat prose 的本地图片在链接 rewrite 之前走 rewriteLocalImageUrls 语义,按 session cwd 解析为 /sidebar/file 绝对 URL;支持 angle destination(含空格)和 title;代码区域、remote、anchor 不变。
  • present 调用与 deliverables/presented 事件渲染 compact 交付卡片(图标/basename/描述/图片缩略图/点击 openSidebarFile);失败 present 回退 generic failed 行;event-first/call-first 都只有一张事件权威卡片;seed 内事件不渲染。
  • 独立 review 修复:卡片边框使用宿主真实 token、aria 包含描述、title 解析 cwd、多行 title、空错误文本等。
  • 新增 spec/exploration 与聚焦回归;不改 host、不加依赖/路由、不改会话格式。

验证

  • 聚焦 8 files / 127 tests 全绿;全量 vitest run 2717 passed / 17 skipped,唯一失败为本地 git 2.34.1 的既有环境用例(基线同失败)。
  • pnpm typecheck、pnpm lint、pnpm build、pnpm pack 通过。
  • 真实 SideChatView jsdom 性能:200 markdown 组件 push 5.38 ms / keystroke 3.18 ms(基线 101.7–117.8 / 105.1–117.2,约 19–37×);100 组件 2.19/1.96 ms;labels 引用稳定,未变化行 MarkdownText 执行数 0;8 KB 增长行 settled 22.0 ms → streaming 1.01 ms。
  • 浏览器 e2e(隔离第二实例,宿主 0.2.1-rc.2,确定性 Messages mock):Present files 卡片、文件描述、图片缩略图、assistant 本地 Markdown 图片(/sidebar/file,naturalWidth=28)、点击打开 README 均通过。
  • 宿主 app 重建后的生产 GUI 复验:Side Chat 渲染出 Present files 卡片,按钮 aria 带描述(Open README.md: …、Open running-whale@2x.png: …),review 修复后的边框/aria 已确认生效。
  • 独立 review:Standards 代码项 PASS;spec D1–D3 PASS、D4 PASS。

关联

  • Spec: docs/plans/2026-10-22-sidechat-render-parity/spec.md
  • Commits: 909f536, e2a7869

Cache markdown label objects by value so MarkdownText's memo survives parent re-renders; pass streaming for unsettled assistant rows.

Rewrite local image destinations in Side Chat prose against the session cwd through the existing /sidebar/file media route.

Map present tool calls and deliverables/presented events to a compact delivery card with thumbnails and the plugin's file-open path.

Add the change spec, exploration notes, and regression tests.
Replace a failed present card with the generic failed tool row; keep one event-authoritative card whichever of the call and its delivered event lands first.

Use the host's real border token for the delivery card; include the visible description in the file button's accessible name and resolve its title path.

Handle CommonMark angle-delimited image destinations and preserve titles; add transcript, prose-rewrite, and DOM regression tests.

Update the change spec with review-driven acceptance commands, status, and evidence.
@NolanHo
NolanHo force-pushed the fix/sidechat-render-parity branch from e2a7869 to 6f14792 Compare October 23, 2026 09:48
@Menghuan1918
Menghuan1918 merged commit 090a548 into omdsh-dev:dev Oct 23, 2026
3 checks passed
@NolanHo
NolanHo deleted the fix/sidechat-render-parity branch October 23, 2026 11:11
davidLi17 added a commit to davidLi17/DSH-better-sidebar that referenced this pull request Oct 24, 2026
Selectively backport upstream dev PR omdsh-dev#1044 (6f14792) and pointer fixes from PR omdsh-dev#1041 (dc38513), retaining LHG image attachments, draft bridge and compacted-history inheritance. Resolve delivered files against current scope cwd. Do not adopt new folding preferences.

Ship 0.28.1-lhg.3 with matching prebuilt assets. Verified 2747 tests passed / 17 skipped, typecheck, lint, build, pack, consumer types, scratch DSH startup and Git package consistency. Browser UI verification blocked by environment. Details: docs/plans/2026-10-24-lhg-selective-maintenance.md
Menghuan1918 added a commit that referenced this pull request Oct 26, 2026
#1035 (seed trim on a model switch) and #1044 (local images and deliveries)
merged after v0.28.0 and ship in v0.28.1; the changelog and the release
notes now list them and credit their author.
Menghuan1918 added a commit that referenced this pull request Oct 26, 2026
#1035 (seed trim on a model switch) and #1044 (local images and deliveries)
merged after v0.28.0 and ship in v0.28.1; the changelog and the release
notes now list them and credit their author.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants