NolanHo
f320cdee83
fix(sidechat): drop grouped records atomically and honor the host's optional removedCount (round 5)
...
The round-5 delta review and the real-data re-run exposed two v5
regressions that disabled the optimization exactly where it matters.
First, the new bracket gate fell back on real multi-group sessions: a
mid-keep compaction group's summary cites nodes a later group
re-shadowed, so record-level dropping stranded its successful
compaction/end and the gate rejected the whole tail — the deployment's
main session forked at 9,077 ms with seed 35,993 (the full copy). The
fix is the reviewers' other option, now data-backed: decide the
emitted-seq set BEFORE emission and drop unmatched groups ATOMICALLY —
a compaction bracket goes as a whole, a command/done losing its run
goes alone. The fuzz suite recovers from 108 to 129 clean trims per
3000 cases (every one passing the real session, compaction, and
commands invariants plus the real inbox projection), and the round-4
cascade counterexample flips from fallback to a clean trim.
Second, v5 treated a missing removedCount as invalid, but the host
contract makes it optional and defaults it to 0 — the host's own writer
omits it for pure inserts, 54% of production splices are like that,
and 38 of 89 real compaction sessions (including the e2e main session)
fell back purely on this. Restored the ?? 0 default while keeping the
rest of the host-fold strictness.
The round-4 spec case is rewritten against the host's chained-replace
semantics (the consumed group swallows the surface span as it exists
at ITS fold moment), which turned it from an empty test — the fixture
could not fold at all, so it pinned nothing — into a real pin: the
atomic drop trims with the earlier group's records gone entirely.
Final second-instance e2e on the real main session: 953 ms, seed
3,457 (10.4x), and a cold-context answer that only the compaction
summaries could contain.
2026-10-16 16:14:41 +08:00
NolanHo
a106e1964e
fix(sidechat): keep grouped records atomic and pin them with host-oracle tests (review round 4)
...
Round 4 (two fresh reviewers, pinned to both 657dcd5 and 196fa11)
could not falsify the core equivalence (2100 generated shapes, 113
trims all passing the real session invariant, Session.create, the real
durable-inbox projection, and node-by-node deriveEventMessage wire
comparison; every non-trim byte-identical to the legacy full copy) but
both votes converged on one root cause: host GROUPED records were
split by record-level dropping. A kept compaction group could lose its
summary to the dropped span and strand a successful compaction/end the
host's compaction invariant companion rejects; a command/done could
outlive its command/run the commands companion rejects — invisible to
all three existing self-checks. The inbox fix from the e2e (196fa11)
was verified: the positional durable-inbox projection is the layer the
host rejects at, and the walk-back plus inboxSplicesValid hold.
v5: bracketsValid mirrors the host's grouped-record rules (a successful
compaction/end requires its compaction/summary; a command/done requires
its prior command/run) so a split group falls back to the full copy;
command/done.sourceEventSeq remaps onto the rebased run;
expectedFirstKeptTurn is derived from the skeleton's actual turn/start
(out-of-turn heads no longer renumber against a phantom turn 1); and
inboxSplicesValid matches the host fold's strictness (known targets,
numeric start/removedCount, array inserts, string ids). The spec's
oracle now uses the host's own deriveEventMessage so a projection bug
cannot hide from the equivalence cases, and two new cases pin the
round-4 shapes (same-turn double compaction, command bracket split and
its both-kept control with a remapped sourceEventSeq).
2026-10-16 16:14:41 +08:00
NolanHo
b4e5c62f04
fix(sidechat): swallow the keep window's leading inbox inserts (real-data e2e catch)
...
The real loop order writes a turn's inbox INSERT before its turn/start
and the CLAIM right after it; starting the keep window at the turn/start
kept the claim while dropping its insert, and the host's positional
durable-inbox fold rejected the seed at Session.create — caught on the
deployment's real main session during the v4 e2e re-run (thread creation
failed: invalid persisted inbox splice at session seq 7).
The keep start now swallows the contiguous agent/inbox/spliced events
preceding the skeleton root (they replay cleanly from an empty inbox),
and a new inboxSplicesValid gate mirrors the host's fold — positional
splice application with duplicate-id rejection — so any splice history
that cannot replay falls back to the full copy instead of shipping a
seed the host rejects. Pinned by a spec case in the real loop order.
2026-10-16 16:14:41 +08:00
NolanHo
98c42971a2
fix(sidechat): normalize the head skeleton and mirror the host invariant core (review round 3)
...
Round 3 (two fresh reviewers) converged on: the head skeleton kept the
rewritten system head's ORIGINAL step number (a mid-session rewrite can
live at turn 1 step >= 2), the relational gate lacked the host's
nextStep/pendingCalls rules (a wide head's tool/result without its call
slipped through), kept compaction metering records carried stale
shadowedRange/shadowedSeqs (violating the compaction invariant
companion), and the gate was STRICTER than the host on non-append
tool/results — so the default-loaded pruner's replacements silently
disabled the trim.
v4: the head skeleton normalizes to turn 1 step 1, rewriting only the
envelope numbers an event already carries (a user/message never gains
fields — its whole data object IS the model-visible message; the
equivalence token now mirrors the renderer's projection exactly: user
messages compare their full data, everything else data.message). The
gate mirrors the host invariant's counter and pairing core: contiguous
turns, no nested open turn, sequential steps, in-turn naming with the
host's non-append tool/result exemption, and pending-call consumption.
Compaction metering records rebase their citations; when the span they
priced did not survive, the record is dropped. A surface node that is a
kept replacement's fold TARGET is no longer skipped, so pruner
replacements replay their transition instead of degrading into an
append stranded after a closed step — that shape now trims.
Pinned by new spec cases (rewritten head, pruner-rewritten keep-window
result) and by all three review rounds' out-of-tree probes.
2026-10-16 16:14:41 +08:00
NolanHo
0f9772a0d9
fix(sidechat): renumber turns over the dropped gap and keep mid-span regions (review round 2)
...
Two fresh reviews converged on a new blocking: the v2 head skeleton
closes turn 1 while the keep window keeps its original turn/start{N},
so the seed's turn counter jumps (1, N) — both of the branch's own
self-checks (foldSurface equivalence, Session.create) miss it, but the
host's relational invariant throws InvariantError in sessions.create on
every host that loads the invariant companion. The spec's invariant case
passed only because its fixture put the keep window at turn 2 — the one
continuous shape.
Also from the same round: the host's compaction region boundary is only
tool-pairing balanced, so it can end mid-turn — the keep interval then
re-emits the shadowed early nodes of its first turn and the verification
fell back (measured: only turn-aligned cut points ever trimmed).
v3: renumber data.turn over the gap (first kept turn/start scanned in
the keep interval AND the tail, since a head-only survivor set leaves
the keep interval empty); skip shadowed surface events and orphaned
tool/calls inside the keep interval; gate the result with
turnSequenceValid — turn counters contiguous, steps opening/closing
inside their turn, in-turn messages naming the open turn/step — the
same semantics as the host invariant. Fixtures now use the real turn
gap (shadowed whole turn between head and keep) plus a mid-span case;
mutation-checked: turning the renumbering off reddens the real-gap
invariant case.
2026-10-16 16:14:41 +08:00
NolanHo
90d04f7aa0
fix(sidechat): keep turn/step skeletons in the compaction-tail seed (review round 1)
...
Two independent reviews converged on one blocking root cause: the first
construction kept only surface nodes, so the open turn's turn/start — which
an automatic compaction necessarily precedes (it fires inside the open
turn) — was dropped, silently bypassing the dangling-tool-call guard and
the synthetic interrupted-closers, and the seed violated the host's
requireOpenStep relational invariant.
Construction v2 drops only the forgotten span and keeps everything else
verbatim: the surviving head is wrapped in its enclosing turn/step
skeleton (closers recovered from the log), the checkpoint lands at its
surface slot as a plain append, and the keep window + tail keep their
skeletons — so lastTurnBoundary, the closers, and the snapshot path run on
the rebased log exactly as on the full copy. One uniform rebase for every
kept event; orphaned summaries rescan to the previous complete compaction;
the consumed group's log-only records ride out with the span they priced.
Spec rewritten to host-shaped fixtures (system/message {turn, step,
message}), adds the mid-turn automatic-compaction cases (closers +
dangling snapshot), the real relational-invariant harness, and structural
fallback assertions. Mutation-checked: skeleton wrap, remap branch, and
orphan rescan each turn their case red.
2026-10-16 16:14:41 +08:00
NolanHo
b025331b99
docs(sidechat): compaction-tail seed plan; test: discriminate remap and interleave paths
...
- plan doc: measured problem, the surface-equivalence argument, the
construction (surface-order head emission, tail rebase with honest
degradation, foldSurface self-verification, full-copy fallback), the
explicit non-goals, and the deployment e2e gate.
- spec: assert the trim fires in the remap case (a replace fully inside
the tail must stay a REMAPPED replace, not degrade into the fallback
copy) and pin the interleave fallback (a tail replace covering a
surviving pre-cut node).
2026-10-16 16:14:41 +08:00
NolanHo
f2443445aa
test(sidechat): real-validator acceptance for the compaction-tail seed
...
Session.create must accept the rebased seed exactly as the routes pass it
(isSeeded + the inherited cut): this is the layer that once caught a seed
whose surfaceOp markers were stripped, so it gates every envelope decision
the rebasing makes — degraded replaces, remapped citations, kept tool
pairs. The constructor's appended end-seed marker lands as the child's
first own event, same shape as today's full-copy threads.
2026-10-16 16:14:41 +08:00
NolanHo
32e7d041ad
feat(sidechat): seed from the last compaction instead of copying the whole parent log
...
A side-chat fork physically duplicated the parent's entire event log into
the child session (measured: a 32,674-event child on this deployment, 303k
duplicated rows across 36 seeded threads). After a summarizing compaction
the checkpoint user/message already replaces the shadowed span on the
model-visible surface, so the child only needs the surviving pre-cut
surface nodes, the checkpoint, and the post-compaction tail.
The rebased sequence is verified with the real fold (foldSurface) before
use: identical visible nodes to the parent, hence identical model context
and provider context-cache prefix. Any tail that cannot be proven
equivalent (dangling back-references, reordering replaces, no compaction)
falls back to today's verbatim full copy.
2026-10-16 16:14:41 +08:00
Menghuan1918
c765c3eb49
test: 三条负载/时序敏感用例改成确定性(同一 commit 两次跑结果相反的那三条)
...
1. `mount.e2e.ts` 的底部工作台入口:入口的既有产品规则是「宿主右侧栏展开时不渲染」,
而该用例先打开右侧栏、再去等这个入口,实际是在赌 500ms 复检窗口——同一 commit
一次绿一次红(trace 里该元素在开右侧栏前存在、之后消失)。改为「展开断言 guide →
收起右侧栏 → 点入口 → 最后重新展开右侧栏做 shadowing 断言」,每一步都等可观测状态。
2. `perf.e2e.ts` 的 `session.cwd` 门槛:15s 窗口 / 5s 节奏下,一个轮询器本身就报 3–4
次,而「宿主右侧栏是否真的收起了」决定是一个还是两个轮询器。改为 `< visited * 2`
(修复前 4 个页签是 15),既不再依赖视觉状态,也仍然区分「每会话」与「每页签」。
3. `editor-host.spec.tsx` 的渲染预算 20s → 60s(describe 时钟 35s → 120s)。实测同一
commit:绿的那次本文件 609ms、红的那次 50554ms(本机 108ms),且三条 `fs.trees`
应答都在等待开始前就落了地——80× 的 worker 停顿,不是等待太短。断言语义不变:
行始终不出现仍然失败。
2026-10-16 01:06:50 +08:00
Menghuan1918
57fe6e657d
test: 临时目录清理统一走 removeTree(修 Windows 上的 ENOTEMPTY 竞态)
...
CI 在 windows lane 上红在**清理**而不是断言:
`rmSync(scratch, { recursive: true, force: true })` 抛
`ENOTEMPTY: rmdir …archives-pvpAWR`——刚被 kill 的 zip/tar 子进程(以及刚关闭的
fs.watch / 刚结束的 git 子进程)还没被系统释放句柄,删除于是失败在一个**已经通过**
的用例的 afterEach 里(那一次 2466 个用例全过,只有清理挂掉,整个 lane 变红)。
`maxRetries` + `retryDelay` 正是 Node 为这种场景提供的对策,因此新增
`tests/temp-tree.ts` 的 `removeTree()`,把 30 份 spec(175 处 `{ recursive, force }`
写法)统一换过去,并清掉随之不再使用的 `rmSync` 导入。POSIX 上首次即成功、不触发
重试,行为不变。
本地:typecheck / lint 干净,全量 210 文件 / 2524 通过。
2026-10-16 00:51:11 +08:00
Menghuan1918
a628bdd1e9
fix(git): 行数封顶后不再累加输出 + 用注入式子进程确定性钉住两道上限
...
CI 在 ubuntu 上抓到 new 用例红:`stops producing once the NUL field cap is reached`
断言 2500 < 2500 不成立。查下来是**产品语义与断言不符**,不只是测试问题:
- `runGit` 在 `fieldCapped` 置位并 kill 子进程之后,仍然继续把后续 chunk 累加进
`stdout`。子进程早已把整份输出写进管道时(125 KB 的 status 在 CI 上就是如此),
被「封顶」的调用会原样返回全部 2500 行——「封顶」只约束了 kill,没有约束调用方
拿到的东西。现在置位后忽略后续 chunk,保留量真正有界(封顶值 + 至多一个跨越
封顶的 chunk)。
- 真 git 那条用例的 `toBeLessThan` 本质是竞态(kill 与子进程写完谁先到),把文件名
加长到「一个 64 KiB chunk 至多携带约 500 个字段」让上界成立,并在注释里写明这条
推理;**kill 本身**改由 `tests/git-spawn.spec.ts` 的注入式子进程确定性钉住
(跨过封顶的 chunk + 封顶之后才到达的尾巴 + kill 恰好一次),另补字节上限的
rejects 用例。撤掉产品守卫该用例当场红(kill 被调两次且尾巴进了结果)。
本地门禁:typecheck / lint 干净,全量 210 文件 / 2524 通过。
2026-10-16 00:28:41 +08:00
Menghuan1918
da0d294948
fix(release): 版本常量与 Windows 路径两处 CI 红
...
1. src/client/service.ts 的 SIDEBAR_SERVICE_VERSION 仍是 0.26.0,而
tests/service.spec.ts 钉住它与 package.json 同版本(设计如此,是我漏了)。
2. 新的定时器清单 spec 用 `path.slice(root.length)` 取包内相对路径,在 Windows
上留下前导反斜杠(\\JobsDrawer.tsx)导致两边永不相等——改用
`relative() + split(sep).join('/')`,与 AGENTS §6「按平台推导路径要用同方言的
node:path」同规。
2026-10-16 00:15:45 +08:00
Menghuan1918
ebfb207f08
test(perf): 稳态门禁(跨模块计时器/布局/请求 + 客户端定时器清单)
...
单模块用例各盯自己的 hook;这条只问跨模块的问题:把真实 Sidebar 壳挂起来、
什么都不给看时,它手里还握着多少会自己跑起来的东西。
- 非 blank 会话只允许存在**一条** 500ms 表(共享的宿主面板展开态),且不得存在 5s
表(每 tab 轮询已收敛为按会话 + 可见性);收起工作台时壳自己不得发 session.cwd;
隐藏页面时那条 500ms 表也必须消失,恢复即可重挂。
- 兜底入口在非 blank 会话渲染 null:宿主角落控件在场(measure() 能走到让位走查)
时命中测试必须为 0——before 侧真机实测 1620 次,after 侧 0。
- 末节是**客户端 setInterval 站点清单**:8 个站点逐一登记「它什么时候停」,新增未
登记的周期任务即红,登记了门控词却把门控删掉也红(绊线)。
- perf lane 新增 steady-state 指标与两条硬断言(兜底入口不渲染即不得命中测试、
session.cwd 必须按会话而非按访问过的页签计数)。真机 A/B:500ms 表 3→1、
5s 表 5→0、空闲窗 session.cwd 15→0、命中测试 1620→0、rect 5190→30。
2026-10-15 23:05:43 +08:00
Menghuan1918
ea3a016161
perf(client): 有界缓存与每秒再渲染收敛(#935 遗留项)
...
keepMounted 下「只增不减」的模块级表等于内存单调增长;每秒换新对象的 setState
等于每秒重建整份列表。
- git-status:槽位参与淘汰——释放归零即删(有在飞请求则等它结算),mint 顺序上限
256,只淘汰 visible===0 && 无在飞 的槽;retain 会重新登记被遗忘的槽对象,
同一键永不出现两条轮询器。30s 基线 / 退档 / poll:false 不持表 / 空闲不 notify 不变。
- ops-stream:streams 加 LRU 32(只淘汰无成员的记录),保留 seq/primed 游标——
parked 页签回来仍能折到错过的那次写操作;被挤出去才重新基线(与刷新同代价)。
- TextEditor.previewScrollMemory 64、GitLens.commitDrafts 32(提交失败仍保留草稿)、
markdown-navigation.pendingAnchors 改为写入时按 TTL 清扫。
- JobsDrawer:1s 时钟抽成自持 state 的 memo 组件并按 visible + document.hidden 门控,
行列表不再依赖走秒值;行的无障碍名不再逐秒变化。
- SubagentView:同值保持引用 + published ref 拦掉 dispatch(实测仅靠 updater 形式
React 仍会提交一次),模型/图派生因此不再每 tick 重算。
- GitLens:silent tick 改为「同值不换引用」而不是把 setWorktrees 挪到早退之后——
后者会让中途新建的 linked checkout 在 silent tick 上永远冻结。
测试:扩展 git-status-poll / subagent-live-polling / subagent-jobs-view,新增
unbounded-caches;每条都用「临时回退→变红→还原」验过。
2026-10-15 23:05:36 +08:00
Menghuan1918
3e5576ffbb
perf(host): cwd 解析加在飞去重与 TTL 对齐、numstat 加 pathspec 与输出上限
...
src/active-worktree.ts 是 v0.25 新文件,却插进了 12 条 /sidebar/* 路由共用的
cwdOf():实测每次缓存未命中 9.6–44.7ms、1–4 次真实 git spawn,而 TTL 3s 与客户端
新的 5s 每-tab 轮询错配——每次轮询必然未命中。
- active-worktree:(session, base) 整链与 base 探针都加在飞去重(并发 8 次只 spawn
一次);ACTIVE_ROOT_TTL_MS 3s→15s(跟随 worktree 的延迟代价写进注释);三个模块级
缓存加 LRU 上界 512/512/256,负结果仍缓存但可淘汰。
- git.ts:两条 --numstat 加 pathspec(非 ?? 路径 + R/C 的 origin,必须
--literal-pathspecs;未跟踪路径不参与 ⇒ 未忽略的大目录从两条全仓库 diff 变成零条;
路径超 8KB 回退整仓库 diff)、runGit 加 8MiB 输出上限、状态行上限改在产出侧生效。
- fs-tree:折叠探测每层封顶 32 且截断层不探测(折叠是纯装饰)。
- index.ts:单层 fs.tree 补 ProbeGate;teardown 主动关闭三个 noServer WSS 的已接受
连接(ws@8 的 close() 不终止在连 socket,句柄会活到浏览器断开)。
- sidechat-routes:冷线程日志按 (childId, revision, size) memo(16 线程,句柄照旧
open/close,只有结果被缓存)。
- agent-opens:每会话队列封顶 64,最旧的丢弃,FIFO 与 drainAll 语义不变。
测试:扩展 active-worktree / git-worktree / fs-tree-probe-gate / sidechat-routes /
smoke / agent-opens;14 项「临时回退→变红→还原」突变全部被捕获。
2026-10-15 23:05:32 +08:00
Menghuan1918
43742be658
perf(client): 每 tab 轮询收敛为按会话共享,keepMounted 加上界
...
v0.25 起原生 tab 一律 keepMounted:每个访问过的 body 都是永久的,于是
useSessionRoot 的 5s 轮询、目录 watch 的 socket、侧聊推送都按「挂载过的页签数」
永久复制。真机实测(4 个访问过的 tab、15s 空闲):活着的 5s 表 5 条、
session.cwd 请求 15 次;宿主那个解析器每次未命中要 spawn git 并回扫 4000 条事件。
- use-session-root:重写为模块级按会话引用计数的 store——一条 5s 表,只在 ≥1 个
可见订阅者时存在;页面隐藏停表;恢复可见/聚焦/取消 park 立刻补刷一次;focus 与
refresh-files 监听全 store 一份;parked body 保留上次答案。
- 消费点传真实可见性:native body 用 nativeTab.visible,壳用 bottomOpen。
- FileTree/use-dir-watch:已有的 visible 接进目录 watch——parked 或展开集为空时不建
socket、不重列,恢复时重连并强制补刷一次(宿主按连接持有 ≤64 个 fs.watch 句柄)。
- use-sidechat-push/SideChatView:订阅按可见性门控,lastThreadBySession 加 LRU 并
合并 localStorage 写入。
- state.bySession 加 LRU 32(当前会话永不淘汰,淘汰前先落盘),getSessionStates()
不再每次整份复制(syncExpanded 原先每次 store notify 都 O(会话数) 复制),
新增定向 getSessionState(id);FileTree 的 appsCacheRef 加上界。
2026-10-15 23:05:26 +08:00
Menghuan1918
c24d99168b
perf(client): 常驻 500ms 表按可见性门控 + 观察者合帧(v0.25 回归)
...
产物级 A/B:0.24.1 的 lib/client.js 里没有这两个 500ms 表、没有 elementsFromPoint
走查;0.25.0 引入、0.26.0 未动。实测合成页面单 tick 0.1→9.7ms、最坏约 3500 次
强制布局读取/秒,且**无论是否可见都在跑**。
- right-panel-open:改全模块一条共享表(引用计数 0→1 起表并立刻读一次、1→0 停表),
隐藏时 clearInterval(不是 tick 内早退),visibilitychange 回可见先读一次再起表;
读法收敛成「先量收起态,命中即返回」,不建临时数组、不量输的那一组。
- dock-fallback:500ms 重对齐表拆进独立 effect,只在入口真的渲染时存在(此前注册在
early return 之前,渲染 null 也照跑);隐藏时不测量不写 state;让位走查 400→100 步。
- settings-nav-icon:观察者回调 rAF 合帧并去掉 characterData——它是全插件唯一
「每次 DOM 变更都触发且回调做全文档查询」的地方,流式 token 下按微任务触发。
- use-center-column:1.5s 兜底表只在「一列都没有」时 armed(周期与复核窗口等长,
注释声称的 query-free 快路径此前永不生效),观察者仍是恢复路径。
- session-phase:隐藏时不发请求,值未变不 setState(blank 会话不再每秒重渲染)。
测试:新增 right-panel-open / session-phase 两份 spec,扩展 dock-fallback /
settings-nav-icon / center-column-locator;每条都用「临时回退→变红→还原」验过判别力。
2026-10-15 23:05:22 +08:00
Menghuan1918
99db903255
docs(readme): README 拆成英文默认版 + 中文 README_ZH.md,锚点守卫改用固定 fixture
...
- README.md 改为英文默认版,README_ZH.md 承接原中文 README,删除 README_EN.md;package.json 的 files 清单同步
- CHANGELOG.md / CHANGELOG_EN.md 顶部「最新版摘要」链接改指 README_ZH.md
- 特性区重排为表格布局并换用仓库内截图(docs/screenshots/*.png),README 里的目录(TOC)整块去掉
- 两条锚点守卫用例原本拿仓库 README 当真实文档(emoji 标题 + TOC 锚点 0/16 的回归),README 去掉目录后改用 tests/fixtures/github-toc-anchors.md 承载同一形状(emoji 标题 / U+FE0F 变体选择符 / & 转双横线):markdown-slug 只换文档来源,markdown-surface 的 CRLF 与「逐锚点点击真的滚动」两条同样改读 fixture,判别力不变
- tests/install-powershell.spec.ts 的 README 清单同步(README_EN.md → README_ZH.md)
维护者收尾:合并 origin/main(454afaf)后把「微信群二维码换新资源」移植到 README.md / README_ZH.md(旧资源 5d727d52 已换成 e9c77c37)
2026-10-15 21:52:59 +08:00
Menghuan1918
751720f4f0
perf(git): 状态轮询基线降到 30 s 并按实测退档;编辑器 gutter 不再持有轮询
...
一次抓取是 `git status --untracked-files=all` 加两条全仓库 `--numstat`(4 个
进程)。在未忽略的大目录上(嵌套 node_modules、pnpm store——根锚定
`/node_modules` 盖不住子目录那种仓库)实测 59,631 条 / 9.24 MB / 0.131 s,
而 `GIT_STATUS_LIMIT = 2000` 是在整份输出产出、拼进字符串、切成五万多个对象
之后才截断的。三处一起收:
- **编辑器 gutter 不再持有轮询**:它此前把功能开关当作页签可见性传进共享
store,而那个参数正是启动定时器的开关;原生页签 `keepMounted` 又让编辑器
切走不卸载,于是打开过任何一个 `code` / `jsonl` 文件之后,整页生命周期都在
每 2.5 s 跑一次那个扫描。现在订阅改为 `{ visible: active, poll: false }`,
只在换文件或保存时各 `refresh()` 一次,页签不可见时连订阅都不建立。
- **基线 30 s + 按实测退档**:往返超 750 ms / 2 s / 5 s 依次退到 60 s /
180 s / 停止自动轮询;tier 是最近一次耗时的纯函数,快响应自动回落,事件
驱动刷新(暂存、提交、丢弃、保存、手动刷新)永远即时,也是恢复通道。
- **空闲轮询不再通知**:`notify()` 原先无条件自增 `slot.version`,而它就是
`useSyncExternalStore` 的 snapshot,于是每个消费者每 tick 整体重渲染一次
(文件树那一列逐行重算 git 状态也在其中),即便数据一字未变。
- **linked-checkout 清单改单命令计数**:变动页的 worktree 选择器每 30 s 为
每个 checkout 跑一次完整 `status()` 只为读条目数,现为一条轻量
`status --untracked-files=normal`。一处刻意的语义变化:未跟踪目录计 1
(此前展开计入每个文件,且数字被 2000 上限悄悄截断)。
消费方 API 零变化;`FileViewerProps` / `ctx.betterSidebar` 均未动。文件树与
文件变动页的条目与配色语义不变,只是刷新节奏变慢。
测试:新增 `tests/git-status-poll.spec.tsx`(7 例,含「非轮询消费者不得启动
定时器」「空闲同结果不通知(snapshot 恒等)」「慢往返退档与快响应回落」);
`tests/editor-git-gutter.spec.tsx` +3;`tests/git-worktree.spec.ts` +1;
`tests/git-view-worktree.spec.tsx` 的计数重发布用例跟着新节奏推进假时钟。
判别性已逐条实测:回退空闲守卫、`poll` 归属、gutter 的 `poll: false`,
对应用例当场红。
设计、实测数据与普查后续项见
docs/plans/2026-10-13-git-poll-ladder-and-idle-notify.md。
2026-10-13 13:12:00 +08:00
Menghuan1918
0ba1b000d6
test(smoke): fs.trees 共享 gate 断言的转换改走 unknown(本地 invoke 把 value 标成 cwd 探针,直接转换不重叠)
2026-10-13 00:38:42 +08:00
Menghuan1918
4fe8b8a054
perf(filetree): 折叠链预加载与渲染共用 32 链上限;fs.trees 整批共享一个探测预算
...
核查用户列出的性能断言后,两处「真实存在」的放大被收敛(其余项按用户选择不动,
逐条结论与不做的理由见 docs/plans/2026-10-13-file-tree-perf-fold-preload-and-probe-budget.md)。
- 客户端:compactLoadTargets 改为从渲染根(cwd + expanded)沿 compactChain 下行,
上限天然继承 MAX_COMPACT_DEPTH。此前它扫描所有已加载层:渲染在 32 停手,预加载
却继续请求第 33、34… 节,每节一次串行 POST 加一次全树 render。顺带订正
MAX_COMPACT_DEPTH 上方「健康缓存永不触及」的不准确注释(合法深链会触及;
循环守卫是 compactChain 的 visited)。
- 宿主:新增 PROBE_BUDGET / ProbeGate / createProbeGate,listDirectory 增加可选
gate 参数(只在真实 fs 探测外层取槽,缓存命中不花),fs.trees 每请求建一个 gate
传给它的所有层。此前 64 路径 × 每层 32 路可同开约 2048 个 opendir;单层与
fs.tree 单路径行为逐字不变。
测试:新增 tests/fs-tree-probe-gate.spec.ts(gate 在飞上界 / 排队任务抛错后释放且
FIFO / limit<1 夹紧;listDirectory 每个目录探测恰花一槽、缓存命中不花;三层共享
一个 gate 计 9 次);file-tree-compact(-fold) 新增「到上限即停」用例(把实现回退
即变红,判别力已实测);smoke 增加「一次 fs.trees 只建一个 gate」的路由级断言。
不动虚拟化、watch 提示与全局句柄、DirRow chain identity。
2026-10-13 00:36:19 +08:00
Menghuan1918
ade04f8f5e
test(editor-host): 渲染等待预算 10s→20s、套件时钟 35s/30s,失败时吐出证据
...
同一天的 CI 失败三次烧光 `waitForTreeRow` 的整个 10s 预算(断言在 10008/10025ms 报
failed),本机同文件只用 ~1s——原来的预算与诊断都不足以定位(这也是这次绕远路的原因)。
- `RENDER_WAIT_MS` 10s → 20s,受影响 describe 给 35s 时钟:断言仍先于测试时钟失败;
- 全局 `testTimeout` 15s → 30s(同一天 `tests/fs-watch.spec.ts` 在本机堆受限时撞掉
15s 时钟,真 `fs.watch` + 150ms 去抖实际只需 ~1s);
- 等待超时时打印 names / fsTrees 调用与落地时刻 / DOM 片段,并再看 5s 区分「饿死但最终
渲染」与「始终不渲染」——正是这份转储把根因指到了 FileTree 的占位回收上。
测试 hook:`treeAnswers()`(调用计数与落地时刻)与 `treeScript()`(按调用序号延迟/挂死,
供上面那条丢弃应答的回归用例使用)。
2026-10-12 20:50:29 +08:00
Menghuan1918
56e3855d34
fix(filetree): 被丢弃的列表应答必须释放它写下的「加载中」占位
...
根因(本机已确定性复现,见下面的用例):`loadLevels` 对非强制加载会先写一个
`{}` 占位(渲染即「加载中」行),而应答被世代守卫丢弃时(刷新 tick / 排除列表变化 /
卸载都会 bump 世代)**那个占位没人回收**。之后任何非强制加载都把「缓存里有条目」
当成已加载(注释里明确写着「空 `{}` 占位也算命中,避免重复请求」),于是这一层
再也不会被重新请求——子树就永远停在 Loading 行,直到下一次强制刷新或重挂。
CI 上的表现正是这个形状:应答都到了(`landedAtMs=[283]`)、`names=["tmp"]`、
DOM 是 `…tmp@fileLoading…`、之后 5s 一行都不出。
修法(只动这一条路径):
- 新增 `pendingRef`(path → 写下占位的世代),占位的**所有权**跟着请求走;
- 应答被丢弃时调用 `releasePlaceholders`:只回收**本次调用仍持有**、且仍是空占位的
层(已有列表或错误的一律不动,丢弃的应答不得清空屏上的行),并**补发一次**该批请求
(每次调用最多补发一次),让丢弃自愈而不是等下一次 tick;
- 应答正常落地时清掉所有权。
回归用例:`tests/editor-host.spec.tsx` 的「a listing dropped by a refresh tick does not
strand the level on Loading…」——首答延迟 300ms、tick 在飞行中到达使其失效、tick 触发的
强制重列人为挂死(谁都settle不了它)。去掉本修复该用例红(并打印上面那份现场),保留则绿。
2026-10-12 20:50:29 +08:00
Menghuan1918
1be21965f3
merge origin/dev into feat/bottom-terminal-multi-tab(#926 多终端 Tab:合上 dev 并修掉「新建终端」丢实例)
...
dev 侧(#924/#925 之后)把底栏终端的身份收敛成**一个值**:`view(sessionId, key,
contentId)` 的 key 与 contentId 同源,`bottomTerminalKey` 已被删除,`TerminalView`
与 `closeBottomTerminal` 都只看 `bottomTerminalContentId(run)`。冲突按「保留 dev 的
结构 + 把 instance 穿进去」解开:不再恢复那个重复的 helper,实例前缀拼在 run 后缀之前。
**并修掉一处会让多终端串台的缺陷**:`nextTerminalMeta()` 原来只回 `{ terminalRun: run+1 }`,
而 `patchTab` 是**整份替换 meta** —— 于是点过「新建终端」的 tab 会丢掉 `terminalInstance`、
掉回旧命名空间,两个都换过进程的 tab 撞在同一个 `…terminal-bottom#1` 上;宿主按
`(sessionId, key)` 记忆 model,两个 tab 会拿到**同一个 shell**。现在实例随 run 一起保留
(没有实例的旧 tab 仍然不长出实例,身份逐字节不变)。
测试:`tests/terminal-tab.spec.tsx` +3 判别性用例(实例跨 bump 保留 / 两个实例各自 #1
不撞 / 两个实例渲染出两个宿主终端)与关闭钩子的带实例断言;把 `nextTerminalMeta` 退回
旧写法即红(实测 2 failed)。设计文档标注「一个终端」的限制已放开,CHANGELOG 补条目。
2026-10-12 16:40:18 +08:00
Menghuan1918
a8bb438028
merge origin/dev into fix/p1-draft-rename-encoding(#901 合上 dev 的 #911/#916/#912 与流式/任务批)
...
#912 把 src/client/tree-mutations.ts 整份重写(两承载面改名/删除调解),#901 的那处
改动落在它的重写区里,冲突按「取 #912 的重写 + 把 #901 的意图重新表达为关闭时传本页
座位自己的 scopeSessionId」解开:草稿注册表按 sessionId::tabId 记账,而原生页签的
编辑器 scope 来自文件地址(scopeSessionId),传座位 id 会在座位≠scope 时静默放行、
把未保存草稿丢掉。
2026-10-12 01:41:08 +08:00
Atlas Zeng
963bef89f0
Merge pull request #912 from UNscientific-9/fix/native-tab-path-reconcile
...
fix(tabs): 改名/删除的页签调解覆盖右侧栏原生页签,并让改名不再重载文档
2026-10-12 01:40:02 +08:00
Atlas Zeng
4bb914ef4a
Merge pull request #916 from yanzhaohui1999/fix/826-line-nav-mode
...
fix(editor): 行号落地四处收尾:能切回预览、插件预览也跳行、换文件不继承行号、落地有光标(#826)
2026-10-12 01:39:20 +08:00
Menghuan1918
ecb347eb11
merge origin/dev into fix/826-line-nav-mode(#826 行号落地四处收尾 合上 dev 的 #924/#925 与流式/任务批)
...
两处冲突的解法:
- CHANGELOG.md:dev 的 v0.25.0 落版提交已把「#826 第二半」条目移进已发布的 `### v0.25.0`,
因此该条目全篇只保留一份——留在 v0.25.0 原位,并采用 #916 修正后的措辞
(「并高亮该行」→「并给编辑器焦点(CodeMirror 只在获焦时画光标)」);
#916 新增的「引用行号的四处收尾(#914 回归报告)」条目置于 `### Unreleased` 最上方(该节新在上);
dev 的其余段落(Unreleased 与 v0.25.0 两节)逐字未动。
- src/client/service.ts:保留 dev 新的 `FileViewerProps.content` 文档(超限见 `largeFile`)
与 #924/#925 带来的侧边对话 / 流式面,叠加 #916 的 `onLineConsumed` 文档;
`OpenTabSeed.line`、`createBetterSidebarService` 的三处 seed 透传与 `updateTab` 文档补充按 #916 落地。
验证:pnpm typecheck 通过;pnpm test 203 文件 / 2419 用例全绿(17 skip),
含 #916 的 tests/editor-line-nav-mode.spec.tsx 等 6 个 spec。
2026-10-12 01:27:18 +08:00
Menghuan1918
293b0e12ea
merge origin/dev into fix/fs-write-missing-conflict(#911:带基线保存时目标已删除判 fs-conflict,语义落进 dev 的 writeWorkspaceText)
...
#924 把 fs.write 从 /sidebar/api 的 JSON 路由移到了 raw /sidebar/write →
src/fs-operations.ts 的 writeWorkspaceText,所以 #911 只改 src/index.ts 里那段
内联实现已经不存在了:冲突取 dev 侧(新的 fs.readPage 路由 + 已迁走的 fs.write),
把语义重落到 writeWorkspaceText,并同步改文档、客户端注释与其两个新用例。
解冲突的四个文件:
- src/index.ts:整份取 dev(#911 在此处的改动全部落在已被 #924 删除的内联实现里)
- src/fs-operations.ts(非冲突文件,语义落点):基线检查 current !== undefined && current !== expected
→ current !== expected;stat 失败(目标或父目录被删除)同样判 409,不再 mkdir -p 重建
- src/client/api.ts:保留 dev 的 fsRead 三态 + 新增 fsReadPage,fsWrite 注释合入「目标已不存在也判冲突」
- docs/external-plugin-guide.md:保留 dev 的 fs.read / fs.readPage / fs.write(raw) 三行,往 fs.write 行补该语义
- tests/fs-write-route.spec.ts:保留 dev 的两个新用例,并把 #911 的两个用例改写到 raw 路由
(invoke(route.api,'fs.read') 取基线 + invokeWrite(route,…) 保存)
2026-10-12 01:26:19 +08:00
eleven-lings
ab2d489ca8
test(terminal): pin the bottom terminal by type, since ids are minted per open
2026-10-12 01:24:53 +08:00
Atlas Zeng
23598d1f51
Merge pull request #910 from UNscientific-9/fix/diff-hunk-header-guard
...
fix(diff): 改动块内的 `---`/`+++` 不再当文件头,删掉 `-- …` 行不再截断 diff
2026-10-12 01:21:16 +08:00
Atlas Zeng
5ad37728bc
merge #925 into dev(侧边对话:实时推送 + 排队可见 + per-thread 模型选择 + 底栏重构)
...
真机复现取证后的四项修复 + 底栏与主会话对齐。三闸门全绿(ci / ci-windows / plugin-mount)。
2026-10-12 01:09:54 +08:00
eleven-lings
f7a10d6ef7
feat(terminal): bottom workbench supports multiple terminal tabs
2026-10-12 00:57:32 +08:00
Menghuan1918
5330eab474
feat(sidechat): 实时推送 + 排队可见 + per-thread 模型选择 + 底栏重构
...
侧边对话的四处用户痛点,加上「实时 fork」与「隐藏会话」两条路线的可行性结论。
全部结论都有真机复现取证(在运行中的宿主上建线程 + 读真实 session 日志)。
- 排队信息漏入:create 的 `inbox.clear()` 围栏确实生效(真机复现:子会话
request 只有 [boundary, 问题]);但幽灵来源比文档更宽——父会话 mid-turn 且
工具未返回时,种子被截断在 `turn/start` 之前,而 inbox 的「领取」splice 发生
在其后,于是**父会话本轮已领取的输入**在种子折叠里仍是 pending;而冷恢复
路径完全没有围栏。修法:create 保留硬围栏(本线程自己不可能有排队输入),
resume 改为 `inheritedPendingIds` 只折继承前缀得到幽灵 id → `inbox.remove(id)`
精确清扫,绝不误杀用户自己排的队。
- 消息不及时:新增 `/sidebar/ws/sidechat` 推送(`session/event` 60ms、
`agent/assistant-stream` 250ms 去抖,**纯失效帧**,客户端带 afterSeq 重拉),
2s 轮询降级为 15s 兜底,断线自愈。
- 模型选不了:宿主对 `origin:'subagent'` 会话**显式禁用**自带选择器,
`sessionController.selectModel` 又被 subagent fence 挡;插件因此自建
`sidechat.models`(直通宿主模型目录)与 `sidechat.model`(append
`model/selection` + `installModelSelection`),并让 `sidechat.info` 报**有效**
选择而不是冻结的创建期 options。
- 排队可见 / 回显 / spinner / 错误行:`sidechat.events` 增返 `pending`(claim
顺序)、`sidechat.dequeue` 按 id 撤销或清空、发送即本地回显、立即 thinking
行、`turn/end{error}` 与失败 attempt 渲染成可见错误行;另修掉「首问未 claim
时连发第二条会注入第二对 boundary+question」(新增 `boundaryPending`)。
- 底栏重构(用户反馈「注意力全在底栏,看不到上栏的保存为新会话」):顶栏整条
删除,`[+新建][线程][保存][归档] … [模型选择器][发送/停止]` 与主会话底栏对齐
(图标靠左、选择器靠右完整显示,agent 徽标不再显示);推理强度改为**平铺行**
——宿主 `Menu` 的 submenu 只能开在父项右侧(无翻转开关)且会让整个面板失去
滚动,钉在侧栏右缘必然被裁;每个控件加宿主 `Tooltip` 悬停气泡(锚在启用的
span 上,禁用态才解释得了「为什么不能点」),替代原生 title。
设计文档:docs/plans/2026-10-12-sidechat-native-surface.md(含取证、判定、
实施偏差与未验证项);AGENTS §3.4 第 4/10 条同步。
门禁:`tsc --noEmit` / `eslint .` / `vitest run`(2268 passed / 17 skipped)全绿;
宿主半 build + pack 后真实挂载进 sidechat-test profile 并验证新路由与 WS 通道。
2026-10-12 00:56:34 +08:00
Menghuan1918
6ecae3d7c3
merge origin/dev into feat/streaming-transfer-jsonl
...
冲突 21 个,全部是「两边在同一区域各加了 key」的机械冲突:
- 20 份词典 + src/client/locales.ts:dev 新增 pluginAudioDesc,我改写了紧邻的
pluginVideoPreviewDesc(去掉已不存在的 20MB mediaLimit 说法)。取并集——保留
我的 video 文案与 dev 的 audio 词条。tests/locales.spec.ts 的 key 集对齐断言
是这次解析的证明(20 例全绿)。
- CHANGELOG.md:两边各加了一个未发布段。按 dev 的标题惯例(### Unreleased)
合成**一个**段,我的条目在前(最新在前),dev 的任务面板条目在后。
CHANGELOG_EN.md 自动合并成功。
dev 还带进来一个新依赖(@formkit/auto-animate),已 pnpm install。
合并后门禁:tsc 0 error、eslint clean、tsdown 8 个 bundle、
vitest --maxWorkers=4 → 200 files / 2346 passed。
2026-10-12 00:22:35 +08:00
Menghuan1918
51c1650928
feat(preview): 超大文件改追加式滚动 + 加载全部按钮
...
按用户要求对齐 VS Code 的 output/log 面板:
- 滚到底**追加**下一页而不是替换当前页:读者读过的内容不会被抽走,
行号跨页连续;footer 改成「已加载 第 a–b 行/条记录 · 已读/总大小」
- 超限提示条最右侧新增「加载全部」按钮,加载中显示字节进度,到 EOF 置灰
- 游标模型整体删除(不再有 prev/next 与页码),只剩一个只向前的累加器,
比原来的 LRU 缓存 + 页表简单得多
唯一 VS Code 不需要而这里必须有的:行数上限 MAX_PREVIEW_ROWS = 50000。
它的 TextModel 与视图都虚拟化,模型塞进一个 GB、DOM 仍很小;这里渲染的是
真实元素,没有上限就是「加载全部」一点即卡死。到顶后停止追加并提示下载。
上限放在 hook 里(useTextPager 的 maxLines 参数)而不是视图按**已渲染**
行数判断——这是测试抓出来的:loadAll 在 await 循环中推进时 React 还没重
渲染,读渲染态的数字会滞后好几页把上限冲过去(spec 里 worker 十秒 OOM)。
另一个测试抓出的真 bug:appendOnce 原来从 setState 渲染态读 nextOffset,
在同一批 await 里拿到的是**上一页**的偏移,于是 loadAll 会反复请求同一页
(同样是 OOM)。游标改由 nextOffsetRef/atEndRef 在响应到达时同步写入。
测试:新增 tests/text-pages.spec.ts(9 例:追加不丢页、EOF 终态、loadAll
串行推进、上限截断与 atCap、失败中止、reload 清空、行数计账),
editor-large-file 补 6 例视图行为(滚动追加、中途不追加、自动填充视口、
加载全部分页、上限提示、默认上限不误报);chunk-artifact 的 externals
桩表补 react.memo(editor chunk 现在在模块求值期 memo 一行组件)。
2026-10-12 00:11:07 +08:00
Menghuan1918
0377730fe8
merge origin/dev into feat/tasks-status-and-group-fold(#881 预览插件目录)
2026-10-12 00:05:42 +08:00
Menghuan1918
e849874673
feat(tasks): 树模式补上单个收起 / 全部收起 / 全部展开
...
维护者反馈「树目录还缺单个收起/全部收起/全部展开的按钮」。读码确认:树**根本没有
按节点的展开收起**(只有页级的已结算聚合规则,aria-expanded 还是硬编码 true),
所以这三件事在树的语境里确实都不存在。
- 单个收起/展开:有子节点的行右侧一个 16px chevron(收起 →、展开 ⌄),位置与画布
卡片小条的 chevron 一致;叶子行不画(死控件);点它 stopPropagation,不会顺带
打开详情窗;行上补 aria-expanded。
- 全部收起/全部展开:控制条里两个**文字**单元格(与其它 28px 控件同形)。用文字而非
更多 chevron —— 旁边的「折叠已完成的节点」开关已经占了那套图形语汇,两套轴不能共用。
全部收敛到「有子节点」的节点(只留拓扑根),全部展清空该集合。
- 键盘补标准树绑定:→ 展开(已展开则进入子级)、← 收起(已收起则退回父级)。
- 折叠集存在 SubagentView,图/树切换不丢;与「已结算聚合」是两条互不干扰的轴。
词条 4 个 × 20 词典(tasksTree{Collapse,Expand}{All,Row})。测试 +4 条(单个收放、
叶子无控件、集群全收/全展、方向键收放)。全套 2260 passed / 17 skipped(194 文件)、
tsc 与 eslint 零告警、构建通过;新构建已装进 sidebar-test,:3080 挂载 0 pageerror。
2026-10-12 00:03:20 +08:00
Menghuan1918
48a8e9095c
feat(tasks): 卡片加最新文本尾行(按预留行数夹紧)+ 树模式 chip / 逐层动效 / 肘线连线
...
维护者第四轮反馈两条:
1. 「最近活动写到标题下方」在详情弹窗之外(卡片)也要有,两处都要限制显示量
→ 口径:小条保留合并活动,卡片标题下新增**最新助手文本尾行**(此前只在弹窗里
看得到);限制按**行数**而不是字符数,两边都**最多夹三行**。
- 新增 textTailLines():按字符宽度(CJK 全宽 / 拉丁约 0.55)估算折行、上限 3,
布局按估算值为每个节点**预留实际行数**而非最大值——预留最大值会让一行文本的
卡片在状态条上方留一个 26px 的洞(即用户此前抱怨过的「空荡荡」换个位置)。
估算值同时写进卡片的 -webkit-line-clamp,渲染与预留永远一致。
- rowStrideFor() 改为按**模型里最高的一张卡**算行距(run 的元信息行、任务行、
三行文本尾行都算进去),否则高卡片会压到下一行与相位框。
- 详情弹窗文本块 2 → 3 行,与卡片同一预算。
2. 树状图改进(模式词 chip / 嵌套层级动效 / 缩进连线密度)
- 模式词搬成标题旁 chip(与卡片徽标行同一处、同一个词),mono 行只留状态;
- 新增 TreeLevel 组件:每个嵌套层级各自拥有一个 FLIP host(库只观察直接子节点,
单 host 会让嵌套折叠硬闪);
- 连线改为每个子节点自绘的肘线:竖线对齐父行标记列,最后一个兄弟的竖线停在
自身标记处(不再拖出组外);组容器的 border-left 随之删除;
- 行距密度刻意不动(32px 节奏与侧栏其它面同度量),已在文档中说明理由与改法。
测试:布局 spec 补「按文本预留而非最大值」「行距覆盖最高的卡」,tasks-page 补
「卡片文本尾行 + 行数夹紧」「树行 chip 且 mono 行不再重复模式」,motion spec 补
「每个嵌套层级都有自己的 FLIP host」。全套 2256 passed / 17 skipped(194 文件)、
tsc 与 eslint 零告警、构建通过;新构建已装进 sidebar-test,:3080 挂载正常。
2026-10-11 23:47:29 +08:00
Menghuan1918
d035836a51
feat(tasks): 自动适配改为滑行——展开后仍保持自适应居中,且不再瞬跳
...
维护者第三轮反馈:在 fit(自适应)档位下展开后,画面也应回到自适应位置,
避免节点溢出面板 / 不在中间。上一版让折叠「接管视图」正是拿这个换的平滑。
收口方式:把视图变换本身也做成补间。
- 新增 tasks-view-glide.ts:把 fit 的算术抽成纯函数 fitTransform(用 CONTENT 盒而
非含 padding 的整张画布定缩放、双轴居中、容器未测量时返回 undefined),外加
lerpTransform 与 GLIDE_MS。这两块在 jsdom 里可达,因此有了单测(居中、上下限、
未测量、滑行中点)。
- TasksGraph:fit 拆成 fitTarget(算术)+ applyFit(animate)。布局变化且视图仍属自动
适配时→**滑行**(rAF 220ms,与卡片补间同一条缓动);切会话→直接落位(内容整体
换掉);⌂ / 背景双击→滑回。任何读者手势(pointerdown / 滚轮 / 缩放按钮)立刻取消
滑行,并照旧把视图标记为「已接管」。
- 折叠不再接管视图(去掉上一版的 markTouched 包装):展开即滑到新取景,画面保持
居中且内容完整。
测试:tests/tasks-view-glide.spec.ts(4 条:居中与缩放上限/下限、未测量返回 undefined、
滑行插值)与 tests/tasks-motion.spec.ts 第 4 条改写(布局变化必须滑行、切会话必须落位、
手势必须能取消)。全套 2252 passed / 17 skipped(194 文件)、tsc 与 eslint 零告警、
构建通过;新构建已装进 sidebar-test,:3080 挂载正常(0 pageerror)。
2026-10-11 23:35:52 +08:00
Menghuan1918
e6f9eda60f
feat(tasks): 画布动效改为布局坐标补间 + 错峰入场,FLIP 库只留流式布局
...
维护者第二轮反馈「还是突然直接出现」。上一版把 FLIP 库从画布摘掉后只留了
150ms 淡入 —— 太弱,看不出是「入场」。而且这个面本身需要的是**位置**动效,
不是入场动效,于是补上画布自己的补间:
- tasks-layout-tween.ts:rAF 逐帧插值每张卡在**画布坐标**里的 x / y / 高度。
为什么必须是坐标而不是 transform:卡片层带 fit 的 scale(k),left/top 是画布
单位,缩放对它和对终点位置一样生效;量 rect 再播未缩放 translate 的 FLIP 在
这里恒差 k 倍,auto-animate 还会把离场卡片钉上无法表达的绝对 left/top。
fromRef 跟着「已绘制」状态走 —— 中途再次变布局时接着当前位置走,不弹回。
- 连线路径与相位框改为读补间后的盒子(它们本就是盒子的纯函数),于是线跟着
卡片走,不再在卡片还在飞的时候先瞬移到终点。
- 入场改为 300ms 上浮 + 0.88→1 缩放 + 淡入(轻微过冲),按节点页序错峰 26ms,
fill-mode: backwards 让等待中的卡片先隐形;reduced-motion 下补间与入场都关。
修掉首版的一帧空档:新入场的节点在引入它的那一帧就带目标盒子渲染。
- 读者一碰折叠即接管视图(聚合卡 / 卡片 chevron / 控制条开关 → markTouched),
此后画布不再随布局自动重框;切会话重置并重新适配(顺带修掉换会话不适配的旧账)。
- FLIP 库保留在树视图与任务抽屉(那里离场是原地淡出 + 兄弟滑位的流式语义)。
守护:tests/tasks-layout-tween.spec.tsx(插值 / 缓动 / 中途位置 / 画布尺寸不中途
变化 / 入口盒子不缺席)与 tests/tasks-motion.spec.ts 扩到 5 条(画布不得 import
FLIP 库、必须在画布坐标补间、入场必须错峰、折叠必须接管视图)。
全套 2248 passed / 17 skipped(193 文件)、tsc 与 eslint 0 错误、构建通过;
新构建已装进 sidebar-test,:3080 挂载正常(0 pageerror)。
2026-10-11 23:29:51 +08:00
Menghuan1918
34671dcb34
fix(tasks): 画布不再跑 FLIP 库(真机「折叠展开动效特别怪」的根因)
...
维护者反馈折叠/展开展开的动效特别怪,比预期严重。读 @formkit/auto-animate
源码后确认两处几何错误在缩放层里都不可修:
- remove(el) 把离场元素重新插入 DOM 并钉上由 getBoundingClientRect 换算的
绝对 left/top/width/height —— 卡片层带 fit 的 transform: scale(k),这个钉位
在缩放层里根本无法表达,离场卡片直接跳位;
- 移动项用 el.animate 播未缩放的 translate,而量测是缩放过的,行程差 k 倍。
再叠加连线(SVG path)与相位框本来就不同步,观感必然崩。
处置:画布改为 .node 上的纯 CSS 入场(150ms、mount-only、离场即时,与不动的
连线一致),auto-animate 只保留在流式布局的树视图与任务抽屉 —— 那两处的 FLIP
语义正确(离场原地淡出、兄弟滑位)。新增 tests/tasks-motion.spec.ts 钉死边界:
画布不得 import use-auto-animate,树与抽屉必须有;同时守护 .node 的入场关键帧
与 reduced-motion 关闭。
全套 2241 passed / 17 skipped(192 文件)、tsc 与 eslint 0 错误、构建通过、新
构建已装进 sidebar-test 并在 :3080 挂载正常(0 pageerror)。
2026-10-11 23:20:03 +08:00
Menghuan1918
9ccc147e00
feat(tasks): 第二轮真机反馈——聚合条动作行、模式 chip、弹窗用量/耗时、原生侧栏转录、动效
...
用户在自己跑的 3080 实例上测完报回六条,逐条修:
1. 「已完成的聚合卡下方空荡荡」= 上一轮把计数收进徽标后那条只剩一个
chevron(我的取舍造成)。小条改为动作行:组图标 + 「展开」(新词条
tasksFoldExpandShort × 20 词典)+ 出错尾注 + 展开箭头。
2. 「展开后的子代理点不回去」= 真缺陷:expandedGroups 压过了 foldedIds,
展开组内卡片的 chevron 失效。改成手动折叠优先(手动 → 页级规则 →
组展开),补模型 + 组件两层判别性用例。
3. 「一次性一直显示」→ 模式词搬进徽标行成 chip(用户口径)。智能体卡不再
有 mono 元信息行,卡片高度预算拆成 GRAPH_AGENT_NODE_H / GRAPH_NODE_H
(只有 workflow run 卡保留元信息行),rowStrideFor(nodes) 按模型里有没有
run 选行距。
4. 动效:接入 @formkit/auto-animate(用户选定,~3KB、无依赖无安装脚本)+
useAutoAnimateRef 包装(WAAPI 守卫 → jsdom 空转、尊重 reduced-motion),
挂到画布卡片层 / 树视图 / 任务抽屉;详情卡另加 140ms 入场关键帧。核心
bundle +56KB(未压缩 CJS)。
5. 弹窗多两项:Token 用量(宿主 tokenUsage 四桶求和,悬停给明细)+ 耗时
(宿主 subagentTiming,按 3s 轮询刷新)。SidebarProjectionSnapshot 镜像
补两个键、模型新增 metrics 入参;**按存在性渲染**,没有测量就不显示这一
行(0 是投影初始态,与「没工作过」不可区分)。
6. 「查看转录」改为在原生右侧栏打开:宿主 ui-subagent 的 subagentchat tab
类型(宿主自己的子代理列表就是点行=主窗、点 chevron=侧栏)。插件照抄其
地址公式并调 openResource(..., { kind, preferNewPane: true }),三级降级回
主窗;页脚变「主按钮 + caret 菜单(在主窗口中打开)」。
测试 2238 passed / 17 skipped(191 文件)、tsc 0 错误、eslint 0 错误、构建
通过;新构建已装进 sidebar-test profile,:3080 上挂载正常、0 pageerror。
动效观感与真实数据的两行数值未在真机逐帧核验(右栏在无头上下文里被
transform 移出视口,合成点击不稳)——已如实记进设计文档的第二轮偏差段。
2026-10-11 23:15:40 +08:00
Menghuan1918
62b797665f
docs: 接入指南 / README / AGENTS / CHANGELOG 与设计文档同步
...
- 指南 §5.2 / §5.3 / §6:FileViewerProps 的 truncated → size + largeFile、
新增 visible;fs.read 三态;新增 fs.readPage;fs.write 迁到 raw 路由
- 指南 §6.1:打包改原生命令的完整说明(工具探测顺序、-y 与符号链接环、
公共祖先定位、临时文件 + 流式下发、unavailable 501),删掉已不存在的
ZIP_MAX_ENTRIES / ZIP_MAX_BYTES 与 src/zip.ts 的说法
- README / README_EN:挂载示例的四个限额收缩为 listLimit,并说明三个键
已删除、旧 profile 残留值会被静默忽略
- AGENTS §6 测试地图:6 tab + 4 viewer、新增的六个守护 spec
- CHANGELOG / CHANGELOG_EN:未发布段
- docs/plans/2026-10-11-streaming-transfer-jsonl-preview.md:设计过程、
与 VS Code Web 的对照(含「VS Code 并不分页」的纠错)与实施偏差记录
另修一处 lint:jsonl.ts 的 truncate 助手在重写摘要后成了死代码
2026-10-11 22:43:30 +08:00
Menghuan1918
27f71a3bd7
test: 适配流式传输 / JSONL / 大文件分页的新契约
...
- 新增 fs-read-page / jsonl / jsonl-language / file-stream-route 四个 spec
- 新增 archive 相关的两个 spec 之外的:写路由 spec 改指向 /sidebar/write,
并补上「远超旧的 1 MiB JSON 上限的一次保存」这条回归
- 上传与 fs-operations 的 size cap 断言改为「远超旧上限仍成功且不留残file」
- 查看器契约 port 到 kind 联合 + largeFile;新增 editor-large-file 取代
截断保存用例;内置 viewer 清单变 4 个
- smoke / plugin-shape 适配:删掉的四个配置键、新增的 /sidebar/write 路由、
文件名对应的 route 错误码由 500 变 400、fs.read 的 too-large 分支
- smoke 的 GET 改走真 node:http(字节路由要真 Writable),并 closeAllConnections
以免 undici 的 keep-alive 把用例拖过超时
- 21 份词典同步:18(+1) 个新 key、删除 truncation/zipProgress、
pluginVideoPreviewDesc 去掉已不存在的 mediaLimit 说法
测试发现的两个真实缺陷一并修复:
- lang-jsonl 的字符串分支把 StringStream.next() 的 undefined 当成 null,
遇到第一个未闭合字符串就无限增长直到 RangeError
- 分页读取原先锁死第一页嗅探到的编码,会让「长 ASCII 前缀 + GBK 正文」的
文件后半段变乱码;改为只锁宽字符编码,字节序编码逐页各自嗅探(分页按行
对齐,不会切断字符)
2026-10-11 22:36:42 +08:00
Menghuan1918
79ee383c5e
feat(tasks): 小条只说原生状态、聚合按组展开、浮窗活动行移到标题下
...
用户 brief:下方条不再显示「运行中」而是原生状态;「最近活动」以小字号写到
标题下方;展开不要点一个全开;顺带修其他的。
四条用户确认的口径:
- 小条(图模式 CardBar):运行中/已结算都由**活动行取代状态词**,措辞取宿主
`chat` 命名空间(正在分析请求 / 正在读取文件 · main.ts / 正在准备读取文件 /
正在运行命令 · npm run build),与主对话逐字一致。**`空闲` 与 `出错` 保留
状态词**(不被任何活动措辞蕴含),**没有活动数据时回退状态词**,小条不空。
状态点、执行扫光、折叠 chevron、22px 高度全不变 → 画布几何零改动。
- 根节点接上 live:live 路由一直把拓扑根的 fold 放进 `live[rootSessionId]`,而
模型从未挂到根节点上——主代理卡片的状态文本因此恒为 thinking 兜底(这就是
「大部分时间一直显示正在分析请求」的真因),树模式根行也恒为「思考中…」。
- 节点详情:删掉「最近活动 | 值」那一行(键值格的值列在 280px 被省略、标签又
占三分之一宽),改为标题下的 10px 活动行 + 夹两行的实时文本;**无数据不渲染
这一块**(此前每个浮窗都显示「最近活动:正在分析请求」,已结算节点也一样)。
新增共享规则 `activityLine(node)`:running → 宿主 live 措辞,其余 → 宿主
done.* 措辞,无 summary → undefined(调用方回退状态词,不谎报)。删 `tasksNodeActivity`(20 份词典)。
- 按组展开:模型新增 `expandedGroups`(键 = 新增的导出 `foldGroupId`,哈希
`fold:<parentId>[:idle]`),只覆盖「本来就要折」的分支——点聚合只开该组,兄弟组/
页级规则/手工折叠都不动。页面侧 `expandGroup` 同时把该组成员从 `foldedIds` 摘掉,
**控制条收起时清空按组展开**(判据写在收起分支,自查时抓到一次反了并补了判别性
用例:翻回去即红)。树里的聚合行同一语义,行内副文案固定为「展开」。
- 聚合卡计数只说一次:待命组徽标此前印**字面量字母 N**(`tasksFoldIdleGroup` 在 20 份
词典里都没有 `{count}` 插值),现在插值真实计数;小条只留 `出错 N` 尾注 + 展开箭头,
完整 tally 仍是 `aria-label` 与 tooltip(屏幕阅读器看不到徽标)。
- 树模式实时行图标按活动类别取:`tool-icons.tsx`(工具名映射,只有一处写死 bash 的
调用)换成 `activity-icons.tsx` 的 `activityGlyph(kind)`,`Record<ProcessActivity, …>`
让上游新增类别编译失败而不是静默兜底。
测试 2227 passed / 17 skipped(190 文件)、tsc 0 错误、eslint 0 错误、构建通过。
tasks-page 新增 FakeChatLocale(挂宿主 chat 命名空间,否则只能断言到 fallback 的
detail,钉不住契约)。设计文档 docs/plans/2026-10-11-tasks-status-and-group-fold.md,
其中记录了「README 的 v0.22.0 发布说明不改」的偏差理由(git log -L 显示那四条自发布
提交后再未被碰过,进行中通道是 CHANGELOG 的 Unreleased)。
2026-10-11 22:04:28 +08:00
Atlas Zeng
0c3e5e9279
merge #881 into dev(推荐目录收录音频预览插件 dsh-plugin-better-sidebar-plugin-audio)
...
Refs #881
2026-10-11 21:54:53 +08:00
unsc9
e4a2d530ea
refactor(tabs): 精简改名/删除页签调解的原生枚举与用例装配(行为不变)
...
上一个提交(e876aa9)过了一轮「代码精简」审查(复用 / 简化 / 效率 / 修在哪一层
四个角度,四个只读子代理并发),这里只落地行为完全不变的那批,净减 37 行。
- **原生页签枚举接回仓库既有的那条缝**:`SidebarSurface` 已有 `tabTypeOf?`
(存在理由逐字相同:「service 自己看不见原生记录」),新增可选
`pathTabs?()`,service 上加 `@internal nativePathTabs()` 转发。删掉
`src/client/native/surface.ts` 里的模块级单例 `installed`、
`installedNativeSurface()`,以及 dispose 里那条「只有仍是当前实例才清句柄」
的顺序敏感守卫——那是同一个状态被存两份才需要的补丁。`NativePathTab` 从
`native/tab-adapter.tsx` 上移到 `service.ts`(与 `NativeTabParams` 并列,
`SidebarSurface` 的方法就引用它),`createNativeSurface` 因此回到直接
`return { … }`,不再需要局部 `surface` 变量。
- `tab-adapter.tsx` 的 `ensure()`:`adopted`(三目求值 + `!== undefined` +
`||`)改成具名布尔 `newNavigation`,`meta` 与 `path` 共用一次判断。真值表
逐格等价(revision 缺省 → true;已定义且不同 → true;已定义且相同 → false)。
- `closePathTabs` 的 `tab.absolute !== target &&` 多余:`isWithinWorkspace`
本身对目标自身就返回 true,一条判断同时覆盖「这个文件」与「这个目录下」。
- `EditorHost.tsx` 的布尔 `movedPath` 与 `tree-mutations.ts` 里返回**路径**的
`movedPath` 撞名,改成 `pathChanged`。
- 用例装配:`mountNativeSession()` 一次装好 store / service / editor 描述符 /
原生承载面 / 会话,`resetModuleRegistries()` 供 `beforeEach` 与 `afterEach`
共用,`openNativeFile()` 参数化 seat 与 cwd(收掉两处手写 `records.ensure`)。
六个用例各自少 5 行样板,用例数与断言不变(15 条)。
按「超出本次 diff / 会改变行为」跳过的三条,留档:改名标记改挂 `SidebarTab`
临时字段(要动持久化 schema 与 `updateTab` 公开 patch 类型)、标记在「宿主直接
关页签且编辑器不再挂载」这条极端路径上不回收(每次几百字节)、批量删除逐行重跑
全量枚举(低于可测量门槛)。
验证:`tsc --noEmit` 通过;eslint 对 6 个改动文件无输出;`vitest run --dir tests`
189 个文件 2240 条用例,184 个文件通过,8 条失败均与本次改动无关且为环境原因
(3 条 Windows 建符号链接 EPERM、1 条 `tar` 在 Windows 输出 CRLF 使结尾带 `\r`、
4 条中文语言标签)——覆盖本次改动模块的用例全绿(`editor-unsaved-guard` 15、
`native-surface` 50,另有 `service`、`editor-host`)。旁证:本地
`.tmp-audit/upstream-tree` 那份不含本改动的镜像副本,在 `tasks-model` 上红的是
同样 4 条。
2026-10-11 16:49:24 +08:00
ymac
776e777da7
fix(editor): 落地到行时把光标亮出来,并让引用赢过预览的阅读位置(#826 收尾之四)
...
第一次真机手测反馈:跳转确实进了编辑视图,但**看不到光标**,所以不知道落在哪一行。
两个原因:
1. **没给编辑器焦点**。落地只 `dispatch({ selection })`,而 CodeMirror 只在
**获焦**的编辑器里画光标,且零长度选择本身不画任何东西——未获焦的落地读起来
就是「文件打开了,停在某处」。现在只在**行号引用**这条路上 `view.focus()`
(普通打开不动读者的焦点,读者可能是从聊天输入框点的链接)。
2. **预览的阅读位置会覆盖它**。进入编辑态时那条「按预览滚动位置恢复」的副作用
声明在落地之后,两个 effect 在同一次提交里,它会把选择与滚动重新写回读者
刚才预览的地方——读者先在预览里滚动过,再点带行号的引用,跳转就被静默抹掉。
落地前清掉 `previewSyncRef`:引用要的是源码里的那一行,不是预览里那个位置。
测试:text-editor-line-jump.spec.tsx 加 3 例(落地后 focus 被调用、普通打开不抢焦点、
markdown 翻转后仍获焦)+ 1 例判别性用例(预览滚到 90% 后再跳第 3 行,最后一次
dispatch 必须是第 3 行的 offset 8 而不是按比例算出的 14;去掉清空那行即红)。
2026-10-11 16:06:42 +08:00