Skip to content

perf(chat): preload chart helpers for inline visualizations - #1867

Merged
vastsa merged 82 commits into
vastsa:mainfrom
zszz3:perf/gen-ui-kit-helpers
Oct 28, 2026
Merged

vastsa merged 82 commits into
vastsa:mainfrom
zszz3:perf/gen-ui-kit-helpers

Conversation

@zszz3

@zszz3 zszz3 commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

背景

#1826 合入的 inline 可视化出图慢:模型每次都要手写 resize/主题重绘/坐标轴/刻度防重叠代码和 D3 标签,skill 还要求写完回读,经常演变成跑 shell、开浏览器、截图验证,一次出图 1~3 分钟。

怎么改的

  1. 预加载图表层:外壳在片段之前注入内置 D3 7.9.0 和新的 viz 辅助层(apps/desktop/resources/gen-ui/visualize-helpers.js):
    • viz.chart / plot / axes / extent / pruneOverlaps / series / color / duration / regression:负责容器尺寸、resize 和主题重绘、坐标轴、标签防重叠等样板代码;
    • viz.render(el, spec):声明式出常见图表(bar 含横向/分组/堆叠、line、area、point 含趋势线、heatmap、arc 环形),自带坐标轴、图例、数值标签和 tooltip,update() 支持交互更新。
  2. skill 改写(visualize.md,11988 B,仍在 12 KiB 上限内):删掉“写完回读/Review”,新增 Hard rules(一次 Write 后直接回复,不跑 shell、不开浏览器、不截图、不翻源码);Charts 一节改成以 viz.render 为主,viz.chart 用于自定义图。
  3. 兼容:旧片段里固定版本的 D3 标签会被移除,避免覆盖预加载的全局 d3;旧片段照常渲染。CSP、沙箱和协议都没有改动。
  4. visualize.css 增加坐标轴/图例/数值标签样式;ADR、spec(中英文)、E2E 场景文档、NOTICE、unreleased 同步更新。

耗时对比

测试方法:用真实构建的 PI-Desktop,通过 renderer IPC(CDP)发 prompt,经本地代理转发到 DeepSeek 官方 API。模型 deepseek-flash(以自定义 OpenAI 兼容 provider 接入,会话 thinking 设为 off,权限 auto),每个 query 跑 1 次(n=1),计时从发出 prompt 到 agent_end。四个版本的条件完全相同。

指标 原版 ① ② ③ 本 PR ③ 对比原版
总耗时(10 个 query 合计) 1004.6 s 642.9 s 604.4 s 498.0 s −50%
中位数 83.9 s 55.0 s 50.6 s 42.3 s −50%
最慢一次 190.3 s 125.7 s 160.3 s 151.0 s −21%
模型往返轮次合计 95 87 32 33 −65%
片段体积合计 99.6 KB 61.8 KB 59.4 KB 47.8 KB −52%
请求体积合计 10.95 MB 10.15 MB 2.03 MB 1.97 MB −82%
回读了自己写的文件 10/10 3/10 0/10 0/10
回复里带出卡片 10/10 10/10 10/10 10/10
# 场景 原版 ① ② ③ 本 PR ③ 对比原版 ③ 的写法
1 PM2.5 折线图 72.0 s · 13 轮 125.7 s · 45 轮 51.3 s · 3 轮 27.0 s · 3 轮 −62% viz.render
2 工时柱状图 + 滑块 81.0 s · 5 轮 54.2 s · 3 轮 31.0 s · 3 轮 57.8 s · 3 轮 −29% viz.chart
3 二分查找步骤 103.6 s · 5 轮 55.8 s · 3 轮 50.0 s · 3 轮 52.1 s · 3 轮 −50% 手写 DOM
4 家庭开支环形图 86.8 s · 4 轮 65.6 s · 9 轮 93.0 s · 4 轮 54.3 s · 3 轮 −37% viz.chart
5 正态分布 + 直方图 89.5 s · 8 轮 43.7 s · 7 轮 62.7 s · 3 轮 43.0 s · 3 轮 −52% viz.chart
6 24h 渠道堆叠面积图 72.2 s · 4 轮 37.1 s · 3 轮 41.6 s · 4 轮 21.3 s · 3 轮 −70% viz.render
7 排序算法耗时柱状图 165.7 s · 8 轮 63.5 s · 7 轮 27.4 s · 3 轮 41.6 s · 6 轮 −75% viz.render
8 电梯状态机 190.3 s · 33 轮 119.1 s · 3 轮 160.3 s · 3 轮 151.0 s · 3 轮 −21% 手写 DOM
9 身高体重散点 + 回归线 78.1 s · 11 轮 35.9 s · 4 轮 30.3 s · 3 轮 28.2 s · 3 轮 −64% viz.render
10 地铁客流热力图 65.4 s · 4 轮 42.2 s · 3 轮 57.0 s · 3 轮 21.8 s · 3 轮 −67% viz.render

按写法拆分(③ 对比原版):

  • 用了 viz.render 的 5 个:453.4 s → 139.9 s(−69%),平均片段 9.5 KB → 2.3 KB,平均每个 28.0 s
  • 没用的 5 个:551.3 s → 358.1 s(−35%),平均片段 10.4 KB → 7.2 KB,平均每个 71.6 s

原版慢的典型路径:q1 Skill → Bash → Write → Read → ToolSearch → BrowserPreview → Read → Edit ×3 → Read → Edit;q8 调用 Playwright 截图,共 33 轮。

使用的 query

  1. 用折线图对比北京和上海过去 12 个月的 PM2.5 月均值(数据你自拟合理值),并给出可视化。
  2. 用可交互的柱状图展示我一周七天的工作时长,带一个滑块能整体调整本周总工时。
  3. 画出示意图:在有序数组里二分查找目标值的每一步比较过程,要能逐步切换。
  4. 用环形图展示一个家庭一个月的开支构成,点击扇区能看到该类的明细。
  5. 画出正态分布曲线和样本直方图叠加的图,带一个样本量滑块,重新抽样时直方图跟着变。
  6. 用堆叠面积图展示过去 24 小时网站三个渠道(直接访问、搜索、社交)的流量占比变化,数据你自拟。
  7. 用柱状图对比冒泡排序、插入排序、快速排序在 100、1000、10000 个元素时的耗时,能切换数据规模。
  8. 画一个电梯状态机:空闲、上行、下行、开门四个状态,点击状态之间的转换能看到说明。
  9. 用散点图展示身高和体重的样本关系,带一条回归线和相关系数,鼠标悬停能看到具体数值。
  10. 用热力图展示一周七天 × 24 小时的地铁客流量,颜色越深人越多,悬停显示具体人数。

验证

  • pnpm build:js、pnpm --filter @pi-desktop/desktop typecheck、pnpm lint、node scripts/check-architecture.mjs:通过
  • gen-ui 相关单测(visualize-skill / gen-ui-protocol / gen-ui-runtime / gen-ui-file-safety / gen-ui-card)53/53 通过;新增断言:D3 和 viz 在 <head> 中先于片段加载、片段自带的固定版本 D3 标签被移除、skill 里提到的 viz.* 都真实存在
  • pnpm test:e2e:gen-ui:通过,10 项检查;新增 viz.chart 尺寸探针和 viz.render 出图探针
  • desktop 全量单测 4400 项:4396 通过、3 跳过、1 失败。失败的是 live-voice-gemini-adapter,原因是本机会 kill 命令行中带 "gemini" 的进程,与本 PR 无关;换别名路径单独运行可以通过
  • 测速时生成的 10 个 ③ 片段离线渲染了一遍:9 个无报错,1 个(老哥 再提个优化建议 #7)因为模型传错了容器 id 而显示空白卡片(见后续方向 2)

已知限制 / 后续方向

  1. 只有 5/10 的标准图表用了 viz.render,另外 3 个仍然手写 viz.chart,可以在 Hard rules 里要求标准图表必须用 viz.render。
  2. 片段脚本报错(例如容器 id 写错)只会出现在 console 里,卡片显示空白。应该在卡片内显示错误。
  3. viz.render 还不支持多图层叠加(例如直方图 + 曲线)。
  4. 非图表类的交互演示(状态机、步骤演示)仍然慢(我记得明明有回复的 为啥 过了一段时间 没了 #8 在四个版本里都是 119~190 s),可以考虑提供现成组件。
  5. 每个 query 只跑了 1 次,方差较大(例如 feat(plan): land complete plan mode (original PR: PI-Desktop-Legacy#116, by @Tioit-Wang) #2 在 ② 和 ③ 之间反而变慢了),需要多跑几轮再看。
  6. 流式预览收益有限:按事件间隔估算,写 HTML 那次调用里约 88% 的时间花在开始输出 HTML 之前。

Seraph-x and others added 19 commits October 22, 2026 21:25
Remote project identities are not local paths. Route plugin directory and
classified preview reads through a separate owner-only Host service that
preserves scope, canonical containment and credential protections.

Capture workspace admission before awaiting and reject stale bindings or
unloaded plugins, including legacy SDK calls. Keep older Hosts compatible
with existing remote operations and report missing preview support clearly.

Refs vastsa#1711
Include the upstream tool-identity and Gemini Live fixes that landed after
the remote file candidate was published. Preserve the shared branch history
and validate the combined tree before updating the pull request.

Refs vastsa#1711
Include the maintainer's newly merged notification changes without altering
them. Validate the remote file candidate against this updated upstream tree
before publishing the branch update.

Refs vastsa#1711
Keep the remote Host file service within the same per-directory result limit as local plugin reads. Share the limit through the SDK so the two implementations cannot drift, and cover the boundary with a large-directory regression.
Default remote-file acceptance to the shipped plugin and record the
loaded directory, so a passing development-plugin run cannot stand in
for a completed bundled update. Keep the paired release gate explicit
in both delivery specifications.

Repair the two CI test assumptions exposed by the updated integration
candidate: permit attributes on the main pane and supply the WebSocket
close reason at the transport fixture boundary.
Preserve the upstream window stacking correction while preparing the
remote File Manager delivery. Validate the resulting integration state
without rewriting the shared contributor or maintainer commits.
Refresh the paired File Manager delivery against the current target
branch, keeping the original contributors' file-reference and activity
disclosure repairs intact. Revalidate the affected boundaries and
plugin journey on the combined candidate without rewriting history.
Preserve both ADR entries when integrating current main so the scoped
remote-file repair remains reviewable alongside the AskTool draft fix.

Initialize the newly required draft map in the existing restoration test
fixture; production state already supplies it. Keep the original
restoration assertions and timeouts intact.
Keep the remote-file candidate current with the newly merged empty-reply
persistence repair without changing its production implementation.

Supply the new completion-notice dependency in two existing persistence
test fixtures so terminal and shutdown regression checks continue to
exercise the original assertions.
Main now filters every empty assistant row unless it carries a tool, a
structured error, accepted steering or a trusted completion reply. The
older source assertion still required the removed failed-status clause.

Keep the complete new exclusion guard in the regression assertion and
retain the executable structured-error persistence checks. Integrate the
latest marketplace repair without altering its production behavior.
…date

Keep the remote-file candidate current with the accepted tab-close repair
and its geometry regression. Preserve the upstream implementation and
both branches of the documented acceptance scenarios.
Two Linux certificate preflights stopped after the expected baseline with
no indication of which later operation hung. Log each probe and cleanup
phase so another failure identifies the pending operation directly.

Keep every TLS, proxy, redirect and cancellation assertion and the
existing deadlines intact. Integrate the current upstream tool-abort
repair while retaining shared history and its production implementation.
Assertions in HTTPS and proxy event callbacks escape the scenario catch.
Electron then opens its default error dialog, hiding the assertion and
blocking the probe until the outer process deadline kills it.

Report uncaught fixture errors and exit with failure so Linux CI exposes
the actual assertion. A real Electron fault-injection comparison reproduces
the blocked dialog before this change and visible exit code 1 afterward.
The tool-abort repair moved detached Bash exclusion into the process
cancellation branch. The older source assertion still expected the
previous outer conditional and failed despite preserving that exclusion.

Assert the current local-background None branch and registration path.
Include exact viewport measurements when the unchanged long-history
reader-position assertion fails, so Linux failures are diagnosable.
Preserve the upstream test corrections and browser lifecycle changes
while retaining the scoped remote workspace read implementation and
its ADR entry. Drop a duplicate AskTool fixture field from the merge.

The refreshed candidate passes targeted Desktop regressions, scoped
protocol and plugin checks, workspace builds, and Desktop typecheck.
Local Electron acceptance is not run because its runtime is missing;
the paired plugin release and shipped bundle update remain pending.
The newly merged visualization feature appended its acceptance scenario
at the same location as remote File Manager coverage. Keep both sections
intact while incorporating the current main without rewriting history.

Preserve all upstream runtime changes and the paired-release blocker.
The refreshed candidate passes targeted Desktop and runtime regressions,
shared contracts, builds, typecheck, and static documentation checks.
Inline visualizations were slow to author. Every model-written fragment
carried its own resize, theme-redraw, axis, and tick-overlap code plus a
pinned D3 tag, and the visualize skill asked the model to read the file
back, which often grew into shell, browser, and screenshot checks.

The visualization shell now preloads the bundled D3 and a small `viz`
helper layer (container sizing and redraw, axes, label overlap, and a
declarative `viz.render` for common charts), and the skill asks for one
write followed by the reply. Fragments written under the earlier skill
keep rendering; their pinned D3 tag is dropped so it cannot replace the
preloaded global.

Measured in the app with deepseek-flash on ten queries, total time went
from 1004.6 s to 498.0 s and model round trips from 95 to 33.

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

图表辅助层解决了重复样板代码,改动也覆盖了 D3 预加载和旧片段兼容。暂不能合入:这个新硬规则禁止对生成结果做任何验证,而 PR 自己的 10 个样例中已经有 1 个因为容器 ID 写错而显示空白卡片;当前脚本错误也只写入 console。请保留一个轻量的结果检查路径,或让运行时把渲染错误呈现在卡片里,再用错误样例验证用户能发现并修正空白图。感谢整理性能数据和兼容性处理。


## Hard rules

- One `Write`, then the reply. Do not verify the fragment: no Bash or shell

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这条规则把验证完全禁掉了,但 PR 的 n=1 实测已有一个片段因传错容器 ID 而成为空白卡片;当前运行时只把这类异常写入 console。模型在“一次 Write 后立即回复”的约束下无法发现这个用户可见故障。请允许一次低成本的结果检查,或先在卡片内呈现渲染错误,并为错误容器 ID 增加覆盖。

xpeng5278-web and others added 3 commits October 25, 2026 17:40
A bare /quota/ match classified spending, credit, billing, and disk
exhaustion as PROVIDER_RATE_LIMITED. The runtime then backed off and
retried failures that cannot recover. Keep insufficient_quota and real
throttle wording retryable, and mark those account and filesystem
quotas terminal.
Review of the preload change pointed out that the skill now forbids any
verification, yet one of ten live fragments rendered a blank card
because it targeted a missing container id, and the error only reached
the guest console.

The Write result for a fragment in the session visualization directory
now carries a static check: inline scripts are compiled (never run) and
literal ids passed to viz.render, viz.chart, getElementById, or
querySelector must exist in the fragment. Problems are listed so the
model can fix them with one Edit; a clean write keeps the plain result.
The guest runtime also reports its first uncaught error to the card,
which keeps the frame and shows the message as bounded plain text.
The skill keeps its ban on self-verification, because a live run
without it brought back Bash, browser, and read-back detours (82 vs
30 round trips over ten queries).

The viz helpers also get review fixes: date-only strings parse as
local dates, year-like values skip thousands separators, re-rendering a
container replaces the previous chart, destroy is idempotent, and arc
and heatmap specs report missing channels.
@zszz3

zszz3 commented Oct 25, 2026

Copy link
Copy Markdown
Contributor Author

感谢 review,两点都按建议补上了(084818cb7,并已合入最新 main):

1. 低成本结果检查:Write 回执自带静态检查

  • 只对写进本会话可视化目录的 .html 生效(packages/agent-runtime/src/gen-ui-fragment-check.ts)。
  • 内联脚本用 vm.Script 只编译不执行,查语法错误;viz.render / viz.chart / getElementById / querySelector("#…") 里写死的 id 必须在片段里存在。
  • 有问题时回执末尾列出问题(附片段里实际存在的 id),模型用一次 Edit 修;没问题时回执与原来完全一致,不多一轮。
  • 用之前保存的 15 个真实片段验证:只报出 review 里那张空白卡片(viz.render("sb-bar"),实际容器是 sb-chart),0 误报。

2. 运行时错误显示在卡片里

  • iframe 运行时捕获第一个未处理的 error / unhandledrejection,通过 pi-genui:script-error 报给宿主;卡片保留 frame,在上方用纯文本显示提示和错误(上限 300 字符),不会渲染成 HTML。
  • E2E 新增 “fragment script errors show in the card”:容器 id 写错的片段会在卡片上显示 viz: no element missing-chart。

3. skill 的禁令为什么保留
试过去掉 “no Bash / browser / screenshot / read back”,只保留 “Write 回执就是检查”:10 条里 5 条又开始跑 node、回读、开 Playwright,总计 82 轮 / 692 s。保留禁令 + 回执检查后 10 条都是 3 轮(Skill → Write → 回复),0 次额外工具。

4. 另外修了 helper review 里的 9 处问题:日期字符串按本地日期解析、年份不加千分位、同一容器重复渲染会替换旧图、destroy 幂等、arc / heatmap 缺通道时报错、y 轴标题避让刻度、堆叠柱支持负值等。

最新实测(deepseek-flash,同样 10 条 query,n=1)

版本 总耗时 往返轮次 额外工具
原版 skill 1004.6 s 95 10/10 回读
PR 首版 498.0 s 33 3/10
本次(+ 回执检查 + 卡片报错) 660.1 s 30 0/10

本次比首版慢主要是模型选择的写法不同:只有 4/10 用了 viz.render(首版 5/10),排序和热力图改成手写,电梯状态机写了 12.7 KB、单条 214 s。n=1 的单条波动较大,轮次已经稳定在最低的 3 轮。

验证:gen-ui E2E 11 项通过;desktop 单测 4400/4404(唯一失败是本机会 kill 参数含 gemini 的进程导致的 live-voice-gemini-adapter,与本 PR 无关);agent-runtime 片段检查 + runtime 测试 354/354;lint、两个包 typecheck、架构检查通过。

Seraph-x and others added 6 commits October 26, 2026 19:26
The Host route alone leaves the shipped panel on local filesystem reads.
Bundle the pinned companion consumer as an explicitly identified Desktop
hotfix, retaining the accepted search-theme repair and source provenance.
Its version supersedes stale installed copies without claiming publication.

Exercise the actual bundled process and view, including real remote bytes,
stale-workspace rejection, read-only controls and restored local saving.
Integrate current main and retain the pending official-release requirement.

Refs vastsa#1711
Record return-to-latest intent before smooth scrolling can yield to a
session or project switch. Otherwise the old unpinned bookmark can win
on reveal or remount, stranding a running conversation in history.

Cover retained and remounted panes with the real renderer path, preserve
manual reading ownership, and give the four-probe fixture a bounded
budget suitable for hidden Windows frames.
The Linux CI probe hung after its baseline while the same fixture passes\non Windows and the upstream base. Identify each network and teardown\nphase without changing assertions, request budgets, or production code.
vastsa and others added 27 commits October 28, 2026 10:26
…rds (vastsa#1928)

* fix(settings): give model-provider and plugin rows their own busy guards

The models page and the plugins page ran their row-keyed async operations
through single shared busy slots — busyId, testingId and reloadingId —
with unconditional finally clears and, on the models page, no entry guard
at all. The first request to settle re-armed every row still in flight
(a second click double-fires the host write from an optimistically
flipped state), and the models list-wide busy gate froze all rows for
one row's operation.

Both pages now claim one independent key per row through the use-row-busy
guard introduced for the capability pages (vastsa#1881): toggleEnabled,
removeProvider, saveProviderKey and testProvider on the models page;
confirmReview, runInstall and reloadPlugin on the plugins page. The
plugins page model exposes isPluginBusy(id) instead of the busyId slot,
and the models list keeps only its modal-dialog terms in the page-wide
gate.

* test(plugins): pin the marketplace install gates to the per-row busy predicate

plugin-runtime-risk asserted the marketplace/detail install buttons
through the removed single busyId slot; the guard job moved to
isPluginBusy in the parent commit, so the pins follow the predicate.

* fix(settings): keep provider test spinners independent

Track active provider tests by row so one settled request cannot clear another row's in-flight indicator. Cover the page-to-list wiring with a regression check.

---------

Co-authored-by: Lan <[email protected]>
Co-authored-by: vastsa <[email protected]>
vastsa#1933)

The probe's proxy asserts that every tunnel it sees targets the fixture, but
Chromium's own component updater reaches the configured session proxy while the
probe is installed. On a cold CI runner that CONNECT arrives at an unrelated
moment — a gvt1.com CDN host in the failing run — and the assertion fired
through the probe's uncaughtException path even though every probe step had
already been logged green.

A CONNECT for any host but the fixture is now refused with 502 and never
counted, so `tunnels` keeps measuring fixture traffic only, and a self-check
asserts that refusal instead of relying on the runner staying quiet.

Co-authored-by: vastsa <[email protected]>
…astsa#1930)

* fix(plugin-view): follow the app type scale in docked plugin pages

A `contributes.views` page is its own webContents, so neither the renderer's
`--font-scale` nor the window zoom reached it. The bundled Browser and Files
panels kept author-sized 12/13px chrome while the app around them grew, so the
two never looked like one product at any font-size setting.

The host now republishes the Appearance multiplier (times the window zoom) as
the docked page's own zoom, re-applies it to every fresh document, and rescales
live views in place so plugin state survives. `pi.browser` measures its guest
hole in the chrome page's CSS pixels, so the guest rect is converted with the
same factor and a website keeps filling the area the toolbar leaves. Detached
plugin windows and widgets keep their own base size; they are their own windows
rather than surfaces composited inside the app.

D343 / ADR 0180 introduced the global type scale for the app document only.

* fix(e2e): ignore Chromium background CONNECTs in the certificate probe

The probe's proxy asserts that every tunnel it sees targets the fixture, but
Chromium's own component updater reaches the configured session proxy while the
probe is installed. On a cold CI runner that CONNECT arrives at an unrelated
moment — a gvt1.com CDN host in the failing run — and the assertion fired
through the probe's uncaughtException path even though every probe step had
already been logged green.

A CONNECT for any host but the fixture is now refused with 502 and never
counted, so `tunnels` keeps measuring fixture traffic only, and a self-check
asserts that refusal instead of relying on the runner staying quiet.

---------

Co-authored-by: vastsa <[email protected]>
Malformed provider calls could survive in live context and make every
later Continue fail during local preflight. Reject malformed batches
before execution and repair only the model-facing history projection.

Keep completed tools and durable transcripts intact, and ensure optional
usage estimation cannot suppress terminal tool events. Cover repeated
manual continuation through the real loop and offline sidecar transport.

fixes vastsa#1941
A 1.89 MB, 780 x 14182 full-page screenshot passed every byte bound,
was persisted by Read, and the provider rejected it with a
non-retriable 400. Every later request replayed it, so the session
could never continue, even after a restart (vastsa#1913).

Read image headers (PNG, JPEG, GIF, WebP) without a decoder and refuse
to inline an image whose longest edge exceeds 8000 px: host Read fails
with a message naming the size, prompt attachments and restored history
take the existing @path fallback, and convertToLlm replaces any
remaining oversized image block with a text notice so poisoned
sessions recover. The same bytes always produce the same notice, so
prompt caching stays stable. Unknown dimensions keep the byte-only rule.

Fixes vastsa#1913
Refresh the published recovery candidate against current upstream main
without rewriting the shared branch before validation.
Keep the localized specification mirror and E2E table shape aligned
with the authoritative recovery contract so documentation gates cover
the same scenario in both locales.
Provider billing and account exhaustion can arrive as HTTP 429 and use
the insufficient_quota type. Classify explicit exhaustion before the
generic 429 retry path while preserving retries for throughput limits.

Add classifier and retry-flow regressions and sync the runtime specs.
…isclassify

fix(agent-runtime): do not treat billing or disk quota as rate limit
After a long reply the reader is left at its last line and has to
scroll back up to find where the answer began (vastsa#1889). When a turn
completes while the transcript is visible and still following the
stream, the turn's prompt now scrolls to just below the titlebar band
and follow mode is released, so jump-to-latest is offered.

The view stays put when the reader had scrolled away, the prompt is
already in view, the reply failed or was aborted, the pane is hidden or
in a reading window, a disclosure position is held, or a queued
follow-up starts before the move. The logic lives in a small lib module
and a hook beside useTranscriptScroll rather than in that hook itself.

Closes vastsa#1889
…recovery-upstream-20261028

Merge the malformed tool-call recovery fix after verification on the latest main base.
A return-to-latest click is explicit follow intent. Persist it before smooth scrolling can yield so session and project navigation cannot restore a stale reading bookmark. Preserve the current stream-completion behavior and E2E coverage.
…bookmark

Merge the transcript follow-intent fix after resolving conflicts against current main.
A renderer reload drops the React owner of native plugin views. Add an event-level regression for full main-frame navigation and document the detach-and-reopen lifecycle so same-document and child-frame navigation remain unaffected.
…rphan-on-reload

fix(work-panel): detach plugin views on renderer reload
…read

A rebuilt history row is stamped reasoning_content while a relay
streams the live row's reasoning as reasoning_text. The pi-ai fill pass
picked the active field by fixed list order, so it chose
reasoning_content and wrote "[reasoning not retained for this turn]"
on the live row, in the field the model reads, beside its real
reasoning. The model echoed the placeholder as its own thinking, which
was persisted and replayed on every later turn (vastsa#1945).

Take the field from the newest assistant row with real reasoning,
normalize every row to that one field (moving real reasoning from
another name and removing duplicates relays reject), and fill only rows
with no reasoning. Strict relays still get a non-empty fill (vastsa#296).

Existing transcripts already hold the echo, so history rebuild and the
thinking panel now drop a leading placeholder echo without rewriting
stored text.

Fixes vastsa#1945
Integrate the contributor branch with the current main line so its native tab-menu behavior can be validated against the live work-panel lifecycle.
Native menu positions are renderer CSS pixels, so app zoom must be applied before Main clamps the popup to window DIPs. Resolve pending menu requests when the owning window closes to avoid retaining a dead renderer request.

Exercise request validation, zoom conversion, window-close settlement, and the Browser-active sibling-tab path; document the native styling and IPC contract in both language specs.
…menu-publish

fix(work-panel): keep native tab menus above Browser
Preserve the current release notes while integrating the inline visualization performance changes.

@vastsa vastsa left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This addresses a real cost in inline chart generation: the existing skill repeatedly asks the model to write chart setup that can be supplied once by the bundled helper layer. The write-result static checks and in-card runtime errors preserve a correction path while the skill avoids a read-back/tool round trip. The reported latency numbers are n=1 and therefore noisy, but the reduction in observed tool/model rounds (95 to 30 across the ten prompts) and the concrete code path make the improvement credible. On the current-main candidate, 42 focused Desktop tests, 14 runtime tests, the isolated GenUI Electron E2E, both affected package typechecks, docs/locales checks, Desktop typecheck, and the Electron-Vite build passed. The release-notes conflict was resolved by preserving both entries.

@vastsa
vastsa merged commit 1fa7d16 into vastsa:main Oct 28, 2026
6 checks passed

vastsa commented Oct 28, 2026

Copy link
Copy Markdown
Owner

Thanks for the performance work and the follow-up checks for blank chart output. We integrated the candidate with current main, preserved both release-note entries, validated the affected paths, and merged it as 1fa7d166125653314a183d4a5eca54068235bb67.

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.

10 participants