whalestar-doc
1aeff633b6
fix(file-tree): pass contextual so the PC context menu opens
...
Rebased onto v0.33.0 (0f4b87c4 ). The trust-admission change from this PR is dropped: upstream 089246e6 now solves it with ctx.inject(['connection.authentication']) + admit(), and the repo forbids runtime compatibility layers.
2026-11-24 16:37:10 +08:00
Menghuan1918
e4c9366d5c
chore(compat): drop unused GitLens store and folder-icon parameter
2026-11-13 01:21:39 +08:00
Menghuan1918
e6f1af2f82
chore(dsh): 适配 DSH 0.2.2-rc.2 并补齐插件页图文详情(v0.32.1)
2026-11-12 21:20:46 +08:00
lu.wang7
bff5beb689
feat(file-tree): 行菜单支持外部插件注册动作(registerFileAction,feature 'fileActions')
...
文件树的行菜单此前完全由插件自己组装(打开方式 / 下载 / 上传到此目录 /
复制 / 重命名 / 删除),外部插件没有任何位置能加一项——「把这个文件传到
我的云端」这类入口只能另开界面,而它需要的恰恰是这个文件。
新增第四个注册表 `registerFileAction(descriptor)`(能力 'fileActions'):
- 菜单项排在内置打开/下载行之后、复制/重命名之前,多条外部动作之间不加
分隔线,第一个之前有一条;排序 order 升序、同 order 按注册序;
- `row: true` 在行右侧「引用」按钮旁再加一个悬停按钮(要求同时给 icon,
无图标的注册只进菜单);
- 回调拿到行的绝对路径 + 这棵树的 root 与会话;目录默认不认领(`dirs`);
- `when` 每行渲染与每次开菜单各调一次,抛错只隐藏该注册,不打断文件树;
- `run` 抛错/reject 以 error.message 落进既有错误条,resolve 静默(成功
提示由注册方自己给),同一 (id, path) 在飞行中的重复点击被忽略;
- 树只提供入口:不替注册方上传、复制或移动任何东西。
文档:指南新增 §7.3(类型、用例、渲染位置、两条约定),§1/§7 能力清单与
README 扩展点计数同步;CHANGELOG 中英各一条。
测试:新增 tests/file-actions.spec.tsx(12 例,注册表 5 + 文件树 7);
tests/file-tree-row-memo / file-tree-menu-perf 的最小 service stub 补
getFileActions(它们的计数器仍是重渲染探针)。
2026-11-08 00:07:03 +08:00
Menghuan1918
18dade0f63
fix(perf): address the perf-scan review findings
2026-10-24 12:10:17 +08:00
Menghuan1918
4cb7937a37
perf(files): keep parked trees idle and batch the watcher re-arm
2026-10-24 02:17:07 +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
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
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
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
Menghuan1918
d4ca9eb6fb
feat(transfer): 流式传输与原生打包,JSONL 预览/编辑与大文件分页预览
...
宿主半:
- /sidebar/file 与 /sidebar/html 改为 createReadStream + pipeline(新增
file-stream.ts),删除 mediaLimit;流开始后失败由 writeJson 的
headersSent 守卫降级为 destroy,不再抛 ERR_HTTP_HEADERS_SENT
- 上传本就是流式的,只删掉客户端 MAX_UPLOAD_BYTES 预检与宿主 limit 逐块检查
- 删除 readLimit / mediaLimit / uploadLimit 三个配置键,新增共享常量模块
editor-limits.ts(MAX_EDITABLE_BYTES = 5 MiB、PAGE_BYTES、写入体护栏)
- fs.read 重塑为 text | binary | too-large 三态,不再有「截断文本」这个
既不可信又不可保存的中间态;新增 fs.readPage 字节窗口分页(按行对齐、
按 path+size+mtime 缓存首次探测到的编码)
- 删除 JSON 版 fs.write,改为 /sidebar/write raw 路由(文档即请求体),
拆掉 MAX_BODY_BYTES=1MiB 这道保存墙;编码与行尾还原逻辑原样搬到
fs-operations.writeWorkspaceText
- 打包改原生命令:新增 archive-tools.ts(zip → tar 探测、公共祖先定位、
argv 规划、stdio 重定向),archive-route 改为后台写临时文件 + 流式下发,
删除手写 ZIP writer src/zip.ts;新增 unavailable 错误码
客户端半:
- 新增 text-pages.ts(字节偏移分页游标,显式翻页)、jsonl.ts(逐行记录
解析与摘要)、lang-jsonl.ts(每行独立的 JSON tokenizer,替代会为每条记录
产生错误节点的 json() 语法)、LargeFileView.tsx(记录卡片 / 日志行两种
只读分页视图)
- 新增 jsonl viewer 描述符(预览 = 记录列表,编辑 = 可保存的 CodeMirror)
- FileViewerProps 用 size/largeFile 取代 truncated;超限文件改为只读分页
预览并可下载,不再提供编辑器
- tags.invalid 由纯白改为红色波浪线(浅色主题下原本白底白字不可见)
- zip 下载改回普通 <a download> 直链,不再把整包放进浏览器内存
2026-10-11 22:25:25 +08:00
unsc9
ebc5d0b6b7
refactor: 精简 dev 相对 main 新增代码里的重复与白干(行为不变)
...
dev 分支的新增代码过了一轮「代码精简」审查(复用 / 简化 / 效率 / 修在哪一层四个角度,
分宿主侧、客户端外壳、客户端功能面板三片,另加测试与脚本),这里只落地行为完全不变的那批:
- `runGitRaw` 是 `runGit` 的纯转发别名(三个角度都点到):导出 `runGit`、删掉别名,
`active-worktree.ts` 与它的 `vi.mock` 键同步改名。
- `open-external.ts` 的 `messageOf` 与 `fs-tree.ts` 的导出逐字相同:删本地实现改 import。
- `fs-operations.ts` 的单段名校验抄了三遍(注释却自称 shared rule):提成
`assertSingleSegmentName`,rename / mkdir / 新建文件三处共用。
- `fs-tree.ts` 两个探测函数各抄一遍有界并发池:提成 `forEachRow`。
- `index.ts` 自己复刻了一遍 `request/header` 的 provider/model 读取:改调
`collectModelRoutes(events, 1)[0]`;`lowestReasoningEffortOf` 的三态循环收成
best/bestRank;`formatModelRoute` 零调用点,删掉(连带自测)。
- `state.ts`:`markUnread` / `clearUnread` 的当前会话路径改走已有的 `reduce`
(「归约器返回同引用即 no-op」本来就在 reduce 里),删掉私有的 `replaceCurrent`;
非当前会话那条仍只写内存不落盘,行为未动。
- `editor-dirty.ts`:`DirtyEntry.sessionId` 只服务一个没有生产调用者的
`dirtyCountForSession`,会话隔离已由 `sessionId::tabId` 这个键承载,两个一起删,
用例改断 `isEditorDirty(tabId, sessionId)`。
- `FileTree.tsx`:同一批行原先 `renderLevel` 与 `visibleRows` 各排一次,收进按
`(data, sort)` 记忆的 `entriesFor`(照 `chainFor` 的形状)。
- `dock-fallback.tsx`:500ms 重测出的坐标没变就不换 state 对象(省掉一次无意义重渲染)。
- 其余同形收口:`DiffPane` 的死分支、`terminal-client` 的 `bottomTerminalKey`
(与 `bottomTerminalContentId` 同值,调用点复用同一个 id)、`SideChatView` 的
O(线程×目录) 排序扫描降为 Map、`conversation-draft` 的末段路径复用 `paths.baseName`、
`TreePanel` 的目录命中集按 results 记忆。
验证:`tsc --noEmit` 只剩改动前那 3 条缺 `@xterm/*` 的既有报错;eslint 干净;
全套 vitest 与改动前的失败集合逐条一致(13 条,均为环境原因:缺 xterm 的构建/转换类
3 条、Windows 符号链接权限 3 条、语言字典串味 4 条、真起 git 的冒烟 1 条、文件级 1 条)。
2026-10-09 16:04:24 +08:00
unsc9
9021d1094e
fix(client): 草稿守卫按会话记账、折叠行重命名落链尾、16 位小端数据不再当文本
...
代码审查第一档的三条真实缺陷(都带判别性用例):
- 未保存草稿的注册表改按 `sessionId::tabId` 记账。原生/工作台 id 只在**会话内**唯一
(每个会话各自铸造 tab1…,工作台对同一文件在各会话复用 editor:<path>),按裸 tab id
记账时会话 B 的编辑器挂载会报 clean 并删掉会话 A 的记录 —— 记录一没,刷新守卫就放行,
A 的草稿静默丢失。读/清/确认三个入口都带上会话;不带会话时按「任一会话命中」保守处理
(宁可多问一次,也不放过活着的草稿)。
- 折叠行(a/b/c 一行)的重命名提交**链尾**:菜单与预填名都指向链尾,提交却用了行渲染所在
的链头 —— 不改字直接回车会把父目录改名。
- 无 BOM UTF-16 探测加一道「解码结果必须是文本」:16 位小端数据(值域 <256 的采样表/音频
缓冲)高字节恒 0,与 UTF-16 的 NUL 车道一模一样,被当文本打开后可编辑、保存按 UTF-16
整份改写(奇数长度还会丢尾字节)。真实 UTF-16 脚本/配置照旧识别。
测试:editor-unsaved-guard 新增跨会话回归两条并改写旧的「同 id 跨会话重指向」语义、
file-tree-compact-fold 新增折叠行重命名落链尾、text-encoding 新增 16 位小端判二进制
(同形状的真文本仍判 UTF-16)。
2026-10-09 15:25:53 +08:00
Menghuan1918
657f75c1be
merge fix/session-scope-write-guard into dev(#848 会话切换不再把上一个项目的写操作带进新项目:文件树选中集/菜单/内联编辑器/确认框随会话与 cwd 一起失效,批量删除与打包构建按 generation 退役结算;含收尾修正——删除确认与拖拽上传改在**调用点**复核 armed scope,关掉「swap 已提交、passive effect 未 flush」之间那个仍会把 B 的 scope 配 A 的绝对路径发出去的丢数据窗口)
...
# Conflicts:
# src/client/FileTree.tsx
2026-10-08 21:56:03 +08:00
Menghuan1918
62c1a0cc63
fix(safety): 删除确认与拖拽上传在调用点校验自己的 scope(#848 收尾)
...
独立正确性评审在 PR #853 上复现出一个**仍然丢数据**的窗口,本提交把它关掉:
**HIGH|单行删除**:`confirmDelete` 只装 `{path, isDir, name}`,scope 在确认时现读。
换会话的清理写在 **passive** effect 里,而点击可以落在「swap 已提交、effect 尚未
flush」之间 —— 此时 `propsRef.current` 已经是新会话。实测(`flushSync` 提交 swap
后立刻点那个仍挂在 DOM 上的 Confirm):
```
fsRemove({sessionId:'s2',cwd:'/projects/beta'}, '/projects/alpha/a.ts')
```
宿主对绝对路径原样执行(包含性检查是刻意移除的),于是**删掉的是上一个项目的文件**,
正是本 PR 要修的那件事。批量走的第一次 `fsRemove` 同样直接发在点击处理器里。
修法是把「armed 时的 scope」随确认一起存下来,并在**调用点**复核(`sameScope`):
单行删除存进 `confirmDelete.scope`,批量把 `confirmDeleteSelected` 从 boolean 换成
`FsScope | null`;不一致就整条请求不发(fail closed),请求本身用 armed scope,
scope 与 path 因此永远属于同一个项目。同时在途结算也按 `scopeGenRef` 退役,
不再把结果写进已经换过的项目。
**MEDIUM|拖拽上传**:`reportDrop` 的 `uploadItemsFromDrop(...).then` 里用的是**最新**
props 的 `onUploadRequest`,而 `dir` 是拖拽开始时的旧路径 —— 一次落点会把这批文件
传进新项目的树里。现在同样 armed/复核,不一致即丢弃。
测试:`tests/file-tree-session-scope.spec.tsx` 新增两条 —— 上面那条窗口的判别性用例
(**还原守卫即红**:`expected "vi.fn()" to not be called at all, but actually been
called 1 times`)与一条正向对照,钉住「请求里的 scope 与 path 必须同源」(只数调用
次数抓不到 scope 被换掉的回归)。typecheck / lint 干净,该 spec 6/6 绿。
2026-10-08 21:55:12 +08:00
Menghuan1918
235212e72a
merge fix/412-win32-open-external into dev(#412 Windows 在应用中打开:cmd start → rundll32 候选链,元字符 URL 跳过 cmd;全失败返回结构化错误并落到 UI 提示条,不再静默成功)
2026-10-05 23:17:33 +08:00
Menghuan1918
307513561b
fix(explorer): Shift 连选改用渲染序(#132)
...
`visibleRows` 的 walk 枚举的是层级缓存的宿主序(`level.entries`),而
`renderLevel` 画的是 `sortEntries(level.entries, sort)` —— 排序控制一旦
离开默认档,Shift 连选的坐标系就和用户看到的行序错位:视觉上连续的一段
只选中两端,中间被排序挪过位置的行漏选(实测 `[beta, Gamma.MD]` vs
`[beta, zdir, Gamma.MD]`)。
危害不止观感:批量条的 Copy paths / Zip and download / Delete selected 都
作用于这个错误集合,而批量删除确认框只显示数量、不列路径。
让 walk 跑同一个 `sortEntries(...)`,并把 `sort` 加进依赖数组——两条路
(渲染 / 选择)从此共用一份有序视图。
判别性用例 tests/file-tree-select-order.spec.tsx:夹具宿主序
`[zdir(dir), alpha.ts, beta, Gamma.MD]`,非默认档
`{key:'type', dirsFirst:false}` 下渲染序为
`[beta, zdir, Gamma.MD, alpha.ts]`;Ctrl 点第 1 行 + Shift 点第 3 行必须选中
恰好这 3 行。在还原后的源码上该用例红(`expected [ 'beta', 'Gamma.MD' ] to
deeply equal [ 'beta', 'zdir', 'Gamma.MD' ]`),修复后绿。
2026-10-05 23:11:11 +08:00
Menghuan1918
f6f7629b23
fix(open-external): Windows「在应用中打开」改为 cmd start → rundll32 候选链,全失败不再静默成功(#412)
...
现象(#412):Windows 上右键「在应用中打开」经常没反应。核实:`urlCommand` 的 win32 分支
只有 `rundll32.exe url.dll,FileProtocolHandler <url>` 一条候选,而 rundll32.exe 在任何
Windows 上都存在、spawn 必然成功 → 路由回 `{started:true}`,UI 拿不到任何失败信息。
修法:
① `urlCommand` → `urlCommands(...): ExternalCommand[]`(有序候选链):win32 为
`cmd.exe /d /c start "" <url>` → `rundll32.exe url.dll,FileProtocolHandler <url>`
(空首参是 start 的窗口标题,缺了它带引号的 URL 会被当成标题、只弹空控制台);
darwin / linux / android / WSL 仍是单元素,语义逐字不变。
② URL 含 cmd 元字符(& % ^ ! | < > ")或控制字符时**跳过 cmd 分支**直接走 rundll32:
Node 的 argv 引用拦不住 `cmd /c` 的第二次解析(%VAR% 展开、&/| 截断、^ 吞字符、"
打乱引用),而 rundll32 以单个 argv 收到 URL、什么都不解释。
③ `launchExternal` 顺序尝试候选:只有 Node 发出 `spawn` 才算成功,同步抛错与 `error`
事件都推进到下一候选;**全部候选失败**时抛 `SidebarError('internal', …)`,消息里逐个
列出命令与底层报错(走既有 `{ok:false,error:{code,message}}` 信封)。
④ 调用方一并改形状:`EditorHost.openWith` 返回「是否被接受」(失败仍 console.error 留痕),
`FileTree` 据此把失败渲染进既有 `openInAppFailed` 错误条——复用词条,未新增词典 key。
测试:
- tests/open-external.spec.ts:候选链顺序、元字符跳过规则、空格 URL 仍是单个 argv、
失败回退顺序、全失败错误形状(含 `&` URL 只尝试 rundll32、reveal 分支的 path 措辞)。
- tests/open-external-windows.spec.ts(Windows lane,pnpm test:windows):只注入两个
「不可能存在」的可执行名(`WindowsOpenerOptions` 测试缝),走**真实 spawn** 断言两条
候选都失败时错误被回报而不是静默成功;**绝不拉起任何应用**(detached:true 会开真窗口,
所以生产命令名一个都不在测试里出现)。
- tests/file-tree-open-with.spec.tsx / tests/editor-host.spec.tsx:被拒(返回 false)与
抛错的打开都必须落进错误条,console-only 即红。
判别性(临时还原源码改动后跑新增用例,随后逐字恢复、md5 校验一致):
- 候选链退回单 rundll32(`if (false && …)`)→ 9 red(含 Windows lane 两条)
- spawn error 仍回 `{started:true}`(旧的「从不失败」契约)→ 6 red
- 去掉元字符跳过 → 11 red
- FileTree 不再上报失败 → 3 red
- EditorHost 恢复吞错 → 1 red
限制(写入设计文档):`start` 与 rundll32 在 handler 忽略 URL 时都退出 0,
「已启动但没打开」仍不可从退出码探测。
2026-10-05 22:58:01 +08:00
Menghuan1918 and finley08
0655b88629
feat(explorer): 资源管理器补「新建文件」+ 排序三档(#132)
...
第一部分:新建文件(移植贡献者 PR #832 的交互语义,写路径改落服务端)
- 新增路由 fs.createFile → fs-operations.ts 的 createWorkspaceFile:单段名、
已存在即拒(fs-error 409,同一句 "x" already exists,绝不截断同名文件,
落盘用 wx)、拒绝 Windows 非法字符(< > : " | ? * 与控制字符)与保留设备名
(CON / PRN / AUX / NUL / COM1-9 / LPT1-9,带不带扩展名都拒)、路径穿越
(..、a/b、a\b)与空名一律 bad-request 400
- src/client/api.ts 镜像 fsCreateFile;FileTree 目录行右键「新建文件」与
「新建文件夹」并列,复用同一套行内输入(Enter 提交 / Escape 取消 / 失焦提交
/ IME 保护,图标跟随输入名),两者互斥;客户端先在已加载层做大小写不敏感的
占用检查(newFileExists),服务端仍是最终裁决
- 词条 newFile / newFilePlaceholder / newFileInvalid / newFileExists 进入
locales.ts 的 zh/en 与 19 份第三语言词典(ja 为真日文)
第二部分:排序三档(名称 / 类型 / 文件夹优先开关)
- 新增 src/client/file-tree-sort.ts:对 level.entries 的副本排序,不改服务端、
不原地重排共享目录缓存;默认(名称 + 文件夹优先)与宿主 fs-tree.ts 的
compareEntries 逐元素一致
- 控件落在文件树头部既有工具区(TreePanel 搜索行的刷新按钮旁):IconButton +
Menu(名称 / 类型打勾 + 文件夹优先独立开关),沿用既有控件样式与可访问名
- 「按修改时间」不在本批范围
测试:tests/fs-create-file.spec.ts(11)、tests/file-tree-new-file.spec.tsx(11)、
tests/file-tree-sort.spec.tsx(12),并修 tests/file-tree-hover-title.spec.tsx 的
夹具顺序(原夹具不是任何宿主会返回的目录序)
Co-authored-by: finley08 <fazhang08@163.com >
2026-10-05 22:57:58 +08:00
Menghuan1918
f5a22b781e
fix(explorer): 目录行与工作区根行补齐悬停完整路径(#186)
2026-10-05 21:46:13 +08:00
unsc9
8a3bd0f9e3
refactor(safety): 两个换会话计数器合一,resolveEntry 去掉 async 空壳
...
FileTree 的 batchGenRef 与 archiveGenRef 用途相同、触发条件相同、生命周期
相同(都由 sessionId/cwd 切换作废),合并成一个 scopeGenRef,重复的说明也
收敛成一份。
resolveEntry 在丢掉 real 字段后已是纯同步的两次调用,去掉 async 外壳与三处
await,不再读起来像碰了文件系统。
2026-10-05 14:01:35 +08:00
unsc9
963a362249
fix(files): 换会话时也清掉新建文件夹的 ref
...
newFolderRef 在渲染期从 newFolder 同步,而重置 effect 只 setNewFolder(null):从 swap 的
commit 到下一次渲染之间,ref 仍持有上个会话的 {dir, value},而 commitNewFolder 唯一的守卫
就是「ref 非空」—— 同一 tick 内的 blur/Enter 就会用新 scope + 旧 dir 调 fsMkdir
(包含性检查已刻意移除,宿主会照做),在 A 项目建目录而界面显示 B。
相邻几行的 anchorRef / kindRef 本来就一起清了,这条属遗漏而非取舍。
窗口很窄(commit 到被动 effect 之间通常不给用户事件留位置),故未写守护用例:
要稳定复现得控制 React 的调度时序,写出来会是一条时灵时不灵的用例。
2026-10-05 11:31:54 +08:00
unsc9
58c4e7b49b
fix(files): 换会话时,正在起步的打包任务不许把 job 塞回来
...
切换会话会 settleArchive() 清掉打包状态,但 archiveBuild() 的回调没有守卫:网络答
回来时无条件写 archiveJobRef / setArchiveProgress / setArchiveJobId,把刚清掉的状态
原样盖回去。archiveJobId 一非空,usePolling 就在新会话里重新武装,去轮询一个用户
根本没发起的打包;轮询失败则在新项目弹出「打包失败」。
时序上这是常见结果而非窄窗口:effect 在 commit 时同步执行,回调要等网络。
加 archiveGenRef,切换时递增(与批删、读目录同一套做法);回调过期就直接丢弃 —— 失败
的构建也不再写错误条,它属于已经离开的那个项目。
顺带改掉那条注释里不成立的理由:原文说「轮询会拿新 scope 去问旧任务」,而轮询根本不
发送 scope(那是另一个既有问题,本次不动)。换成真正的理由:进度条属于发起它的项目,
遗留的 archiveJobId 会让轮询继续跑并把失败报在新项目上。
守护用例:file-tree-archive 新增一条,把 build 挂在延迟 promise 上,中途换会话再放行 ——
去掉修复后实测 archiveStatus 会被调用。mountTree 顺势扩出 show(sessionId, cwd) 以支持
就地换会话,现有用例不受影响。
2026-10-05 11:31:54 +08:00
unsc9
44d9e7f408
fix(files): 批量删除走到一半换了会话就停下来,不再收拾上一个项目
...
切换会话时把「正在删除」标志归零了(原问题是新项目里删除按钮被卡住),但上一批的
循环还在跑:用户可以立刻在新项目发起第二批,两批重叠,而旧循环收尾时的 pruneTree 与
clearSelection 会把新项目刚选中的行清掉。
加一个代际计数(跟读目录那条用的是同一套做法):切换时递增,循环每次 await 回来先确认
自己没过期 —— 过期就整批放弃,既不接着删、也不再往界面上写。删除调用本身带着自己的
scope,所以停在哪里都是安全的。
守护用例:file-tree-session-scope 新增一条,用延迟 promise 把第一次删除停住,切成新会话
并在新会话里选中一行,再放行旧循环 —— 去掉修复后实测新会话的选择会被清掉。另把该 spec
的 afterEach 由 mockClear 换成 mockReset,免得挂起的实现漏给下一个用例。
2026-10-05 11:31:54 +08:00
unsc9
fe7125ae3b
refactor(safety): 复用既有 helper、归位注释——c8d5030 的质量收敛
...
不改变行为,只收敛上一提交引入的重复与错位:
- FileTree 会话重置改为复用 clearSelection():它自带「选中已空则返回」守卫,未选
中时不再为一次重置白跑整棵树的 re-render。anchor 仍无条件清——取消最后一行选中
会留下「空选中 + 非空锚点」,这个状态必须在切换时一并丢掉。依赖数组去掉已不再
被该 effect 引用的 setSelection。
- fs-operations:isWorkspaceRoot 的 JSDoc 原本紧贴 sameSpelling 上方,结果
sameSpelling 挂着两段注释,而真正执行安全守卫的函数反而没有文档——已归位,
让「为什么必须比 dev+ino 而不是比字符串」跟着守卫走。
- 测试:task-window 三份重复挂载收进 beforeEach;git-view-worktree 新用例改用同
文件已有的 makeRoot()(提到模块级,两个 describe 共用);fs-operations 的
makeProject() 同样提出模块级,供软链接用例复用。
验证:typecheck 通过;改动文件 lint 干净;相关 6 个 spec 64 通过。其中
fs-operations 两条 symlink 用例在本机 EPERM(无创建软链接权限),stash 对比确认
改动前同样失败,与本次无关。
2026-10-05 11:31:54 +08:00
unsc9
74461c9954
fix(safety): 会话切换不再把上一项目的删除动作带进新项目
...
工作台每个 tab 一个常驻组件实例(tab id 按会话重新计数),会话/cwd 切换只换
props 不重挂,于是「指向某一行」的危险状态跨会话存活,执行时却用新会话的 scope:
- 文件树:选中集不清 → 批量删除用新 scope + 旧会话绝对路径(宿主按原样执行,
工作区包含检查已刻意移除)→ 删掉别的项目的文件。现在切换即清空全部 path 型
状态、批删进行标志与在轮询的打包任务。
- 变更页:右键菜单与待确认的「放弃更改 / 还原 / 拣选」不清 → onConfirm 闭包带
旧行路径,而 gitScopeNow() 已在点击时读到新 scope → 在新项目里丢未提交改动。
- 任务窗口:两步删除的 armed 状态不清 → 切任务后第一次点击就是删除。
同时修掉工作区根守卫:原来比较两个字符串,同一目录的大小写变体、\\?\ 前缀、
8.3 短名、映射盘都能绕过,rm -r 真的递归删光整个项目。改为按 dev+ino 比较身份
(stat 跟随链接,指向根的链接也拒绝;拿不到 inode 或 stat 失败时退回归一化拼写)。
守护用例:file-tree-session-scope / task-window-delete-arm / GitLens scope swap
三条在未修复代码上均精确变红;fs-operations 增补 Windows 拼写变体与 symlink→根。
2026-10-05 11:31:54 +08:00
Menghuan1918 and shyuan-hub
5254c031b1
feat(explorer): 文件树面包屑折叠 + VS Code 风格可配置排除模式(移植 #264)
...
按当前 dev 重写贡献者 PR #264 的两项核心意图:
1. 面包屑折叠(VSCode "compact folders"):host 给「内容恰为一个有效
子项」的目录行标记 `compact`,client 把单目录链折叠成一行 `a/b/c`
并整链展开/折叠。
2. `explorerExclude`(VS Code `files.exclude` 风格的 glob 子集):匹配
条目从文件树与文件名搜索中彻底移除;树与搜索共用同一份 host 侧编译
好的 matcher,两个界面永不失配。
为什么按 dev 现有结构重写而不是机械解冲突——证据卡逐条点名的 dev 侧变化:
- **客户端树已换成 DirRow 记忆化组件 + loadLevels/api.fsTrees 批量路由**。
PR 改的是旧的 `expanded.includes(...)` 内联目录行与单路径 `api.fsTree`,
该上下文在 dev 已不存在。折叠因此接在 renderLevel/visibleRows 的链上,
并新增「每级缓存修订一次」的链缓存:DirRow 按 prop 身份 memo,每次渲染
新建数组会让选择/悬停把每个目录行都重渲。
- **`api.fsTree(scope, path, signal?)` 的第三位已经是 AbortSignal**,PR 的
`api.fsTree(scope, dir, exclude)` 会把数组当 signal。exclude 统一排在
signal 之前(`fsTree`/`fsTrees`/`fsSearch` 三处一致)。
- **dev 的 `listDirectory` 有 1.5s TTL 缓存,PR 是直接读盘**。照搬会让不同
排除集共用一份缓存(改完排除列表仍读到旧行),而 pref 变更没有可搭的
失效钩子。故把模式集的身份并入 cacheKey(新增 `ExcludeMatcher.key`,含
锚点 root 与大小写折叠语义):同列表命中缓存,改列表即换键。
- **文件树的真实入口是批量路由 `fs.trees`**(挂载/展开一次 POST),PR 只
改了 `fs.tree`/`fs.search` 两处——不接批量路由等于 exclude 不生效。
- PR body 声称移除 `explorerShowHidden`,但净 diff 对它零命中、dev 与 PR
合并基也都没有该键,属失效声明,不做产品取舍。
复用的部分(与 dev 无耦合):`src/exclude-patterns.ts` 与
`src/client/file-tree-compact.ts` 两个纯逻辑模块逐字取用(前者仅新增缓存
身份 `ExcludeMatcher.key`)。设置 UI 沿用 PR 的声明式 `patterns` 行类型
(chips + 删除钮 + 常驻添加输入框,原子提交整表),5 个新词条按仓库规则
同步全部 21 份词典;`src/client/service.ts` 的能力清单新增 `settingPatterns`
并同步 docs/external-plugin-guide.md。
门禁:pnpm typecheck 0;pnpm exec vitest run --maxWorkers=3 全绿
(165 files / 1847 passed / 13 skipped);npx eslint 45 个改动文件 0;
新增与改动的 spec 单跑 154 passed;pnpm build 0。
Refs #264
Co-authored-by: shyuan-hub <311810858+shyuan-hub@users.noreply.github.com >
2026-10-05 02:13:53 +08:00
Menghuan1918
9c4b5dada2
fix(ime-guard): capture 守卫收窄到 composition 窗口,FileTree 保留保守的 229 判定(#833)
...
PR #845 把 isImeComposition 从「keyCode === 229 无条件算 IME」改成「229 只在
composition 上下文里算 IME」,修好了 #833(KeyRay 布局切换发出的 229 keydown 被
capture 静默吞掉)。但那同一个谓词还被 FileTree 的两处提交处理器当「非拦截式
早退」用,收窄之后 legacy 引擎在组合期发出的裸 229 Enter 会穿透到处理器:输入法
选字时的回车直接把重命名 / 新建文件夹提交掉。(本树实测探针:同一 4 行处理器
形状,用旧谓词 commits=1,用新谓词 commits=0。)
两处口径本来就该不同,因为假阳性代价不同:
- capture 守卫的假阳性 = stopPropagation(),全页所有下游监听器都收不到这个键,
正是毁掉 KeyRay 的那一步 → 必须收窄到 composition 窗口。
- FileTree 的假阳性 = 少处理一个键(它不 stopPropagation),假阴性却会提交一个
半成品名字 → 取过近似更划算。
新导出 isLikelyImeKey(isComposing === true || keyCode === 229)承载后者;
isImeComposition 保持现状(守卫仍用它,#833 的修复不受本次改动影响)。
宿主旁证:DSH core 两处都是保守形状、且都不 stopPropagation ——
ui-user-questions 的 QuestionComposer 完全没有 composition 跟踪,只有
`isComposing || keyCode === 229`;ui-conversation 的 InputBar(issue #535)把
composition ref 与裸 229 做或。所以「保守析取」是宿主口径,本插件是唯一因为
capture 语义而不能照抄的地方 —— 文件头原来那句 follows the DSH core convention
据此改写为两谓词分工。
改动面:
- src/client/ime-guard.ts:新导出 + 文件头两谓词分工说明;isImeComposition 的
「the pure decision」措辞改正(它读模块级 composition 状态),实现未动。
- src/client/FileTree.tsx:1536 / :1567:改用 isLikelyImeKey,两处失真注释改准。
- tests/ime-guard.spec.ts:新谓词用例 + FileTree 处理器形状的回归用例(点明它
守的是 FileTree 语义而非 capture 守卫);顺手去掉 :57 与 :61 重复的同一断言。
Refs #833
2026-10-05 01:54:17 +08:00
Atlas Zeng
c7980cee7c
Merge pull request #811 from ZinChl/fix/fs-trees-batch-split
...
fix(files): fs.trees 按宿主上限分块,展开集 ≥64 的会话不再整树报错(#799)
2026-10-05 00:53:58 +08:00
Atlas Zeng
ce3527ca1e
Merge pull request #809 from ZinChl/fix/archive-status-session-scope
...
fix(files): 修「压缩并下载」必然失败——archive.status 缺 sessionId + ready 交接无护栏(#798)
2026-10-05 00:53:43 +08:00
HuanLinOTO
0500aa045a
Merge PR #789 (ported): fix(files): 在途层渲染 loading 行,消除新展开文件夹的空目录闪烁(移植到 loadLevels 新形状,#693 #687)
2026-10-01 17:46:52 +08:00
HuanLinOTO
e10510f29a
fix(files): 在途层渲染 loading 行,消除新展开文件夹的空目录闪烁(#789 移植到 loadLevels 新形状)
...
移植 PR #789 的语义到 v0.24.1(98a446b)重写后的加载形状,原 diff 基于
已不存在的 loadDir 形状,不再适用:
- 核心条件原样保留:renderLevel 对「未请求」(undefined)与「在途标记」
(loadLevels 非强制路径写入的 {} —— 无 entries 无 error)都画 loading
行。修复前标记落进 entries ?? [] 渲染零行:展开新目录闪「loading →
看似又折叠了 → 条目」,且首挂载的根层也是空体。settled 层必带 entries
(不可读层另带 error),条件不会误伤真实数据。
- 原 PR 改在 per-level loadDir 请求时代;现形状 loadLevels 非强制路径先
storeLevel(path, {}) 再发批量 fs.trees,在途标记形状未变,故只需渲染
侧一处扩展,加载逻辑零改动(force 路径保留旧行的语义不受影响)。
- 测试 tests/file-tree-loading.spec.tsx 随形状移植:原版 gate 住单层
fsTree 路由,现 gate 住批量 fsTrees 的 { levels } envelope;并按真实
用户流拆成两批——先挂载根层、落地后再展开子目录触发第二批(批量语义
本身由 file-tree-batch-load.spec.tsx 单独守护)。三个用例语义不变:
展开期间 loading 行不消失、真空目录渲染零行不卡 loading、整批失败出
错误行。判别性验证:回退修复后前两用例红(错误路径用例两态都绿,它
守护边界而非本次回归)。
- 原 PR 未新增词典 key(复用既有 t('loading')),本次同样零词典改动,
无需触碰 19 份第三语言词典。
- 全套件对照:改动前后均 1485 通过 / 6 失败;6 个失败(locales ja 缺
2 key、plugin-meta 打包、tasks-model ×4)在干净 origin/main @1499502
上同样复现,属 main 既有问题,与本提交无关。
2026-10-01 17:15:49 +08:00
HuanLinOTO
5256eef3ab
fix(files): 目录级别加载失败不再被当成缓存命中,自动加载路径可重试(#677 移植到 loadLevels 新形状)
...
PR #677 was written against the pre-0.24.1 loadDir shape (one fs.tree per
directory): its error branch stored { error } in the level cache and the
cache-hit guard `dataRef.current[dir] !== undefined` treated that failure as
"already loaded", so the automatic load path never re-requested a failed
level; only the force path (refresh tick / fence-notice retry) recovered.
FileTree.tsx has since been rewritten around batched loadLevels (one fs.trees
POST for the visible set, commit 98a446b ), but the bug survived the rewrite in
a new spot: BOTH failure branches now store an error in the same cache —
(a) a per-level `error` riding an otherwise-successful batch, and
(b) `{ error }` written by the whole-request catch for levels with no listing
— and the non-force `wanted` filter (`dataRef.current[path] === undefined`)
counted both as cache hits.
Port, in current idioms:
- The non-force filter now admits a cached entry only when it carries no
`error`: `cached === undefined || cached.error !== undefined`. The host
guarantees a failed level never carries entries (fs.trees returns
`{ entries: [], error }` in place), so `error` alone identifies "nothing
usable cached" for both failure branches.
- The empty `{}` placeholder of an in-flight load is still a hit, so a
re-render while a batch is open does not duplicate the request.
- The retry rides the batch route (wanted subset only; levels that DID list
stay cached) and reuses the existing non-force flow, which stores `{}`
first — same behavior the original fix gave loadDir.
- loadLevels' doc comment gains the "only a LISTING settles a level" rule.
Not ported: the original diff's comment wording about "the fence notice's
retry button" — that notice (and isOutsideWorkspaceMessage usage in the tree)
no longer exists in the current shape; recovery paths today are the refresh
tick and watch-notice/mutation re-lists, and after this fix any automatic
re-load of the expanded set.
Tests: tests/file-tree-level-retry.spec.tsx adapts the PR's spec to the
batched shape (fsTrees mock, batch-load-spec harness): (1) a per-level error
is re-requested as a batch of 1 on the next automatic load (with an added
assertion that an in-flight batch is NOT duplicated), (2) levels stored by a
failed whole request are all retryable. Both go red on the unfixed filter
(verified: "expected to be called 2 times, but got 1"). All 9 file-tree
suites (47 tests) and tsc --noEmit stay green.
2026-10-01 17:13:10 +08:00
ZinChl
38a82db0e3
fix(files): fs.trees 按宿主上限分块,展开集 ≥64 的会话不再整树报错(#799)
...
宿主对一次 `fs.trees` 批量请求有硬上限 `FS_TREES_MAX_PATHS = 64`,超限
**整批** `bad-request`;而客户端把 root + 全部展开目录放进**一次**请求
(loadLevels)。展开集按会话持久化,所以累计展开到 64+ 的用户每次挂载/刷新
都被整批拒绝,catch 把所有无缓存层写成 error —— 整棵树报错,只能手动折叠。
改动:
- 新增 `src/fs-batch.ts`:把行上限放成**两半共用的零依赖模块**(`prefs-shared.ts`
的同一模式),宿主 `src/index.ts` 改为 re-export,客户端按同一常量分块,
两边不会再漂移。
- `src/client/FileTree.tsx` 的 `loadLevels`:把可见集按上限切块、并发请求,
并保留批量路由的**逐层错误粒度**——某一批失败只标记它自己携带的层,
不会再把其它批已经拿到的列表一起标红(原先单请求失败时会标记全部
wanted)。缓存/代际(generation)语义不变。
- 宿主上限保持不动(那是针对恶意超大批量的防线)。
测试:`tests/file-tree-batch-load.spec.tsx` 新增两例——71 个可见路径切成
64 + 7 两批且每个路径恰好出现一次;某一批失败时另一批的层仍正常渲染。
回退 FileTree 的分块后这两例当场红、原有 8 例仍绿(已实测)。
2026-09-30 01:56:11 +08:00
ZinChl
214bf451a0
fix(files): 修 v0.24.1「压缩并下载」必然失败——archive.status 缺 sessionId + ready 交接无护栏(#798)
...
同一条轮询链上的两处,都在 #782 新增的 archive 功能里:
1. `archiveStatus(id)` 只发 `{ id }`,而宿主 `archive.status` 对 id 与
sessionId 都 `requireString`(src/index.ts)→ 第一次轮询即 400
`missing or invalid "sessionId"`,`state === 'ready'` 永远到不了,
整条链只有 build 成功。同族的 `archive.build` 与下载 URL 都带 scope,
只有这一处漏了。改为 `archiveStatus(scope, id)` 走 `scopePayload`。
2. `saveArchive` 是 fire-and-forget,`settleArchive()` 只在完成回调里执行,
于是 ready 之后 250ms 轮询照跑:下载路由是消费式的(GET 服务后释放任务),
首个 GET 未完成时会并发第二次 `save`(双下载),已完成时下一次 `status`
404 → 已成功的下载旁边同时挂一条 zipFailed。改为 ready 时先
`setArchiveJobId(null)` 停轮询,并用 `archiveHandedOffRef` 保证恰好一次交接。
测试:新增 `tests/archive-client.spec.ts` 钉客户端**真实载荷形状**(此前的
用例要么整体 mock 掉本模块、要么只测宿主侧),并给 FileTree 加一条
「ready 恰好交接一次」用例。回退 api.ts 的两个载荷断言、回退 FileTree 的
交接护栏,对应用例分别当场红(已实测)。
2026-09-30 01:52:59 +08:00
Menghuan1918
98a446bbfc
fix(sidebar): 点击展开时文件树整体重建(两处根因)+ v0.24.1
...
用户报告:「点击展开的时候,文件树会频繁整体刷新,看起来非常难受」。
根因 1(主):src/client/native/index.ts 的 sync() 把 files 接管项当成多余注册。
它按 KIND 记账、永远不在 wanted 里,于是每次 sync 都被 dispose + 重建;而
disposeSubscriptions 同时订阅了 service 与 store,**任何会话状态写入**(展开/收起、
切 tab、拖底部工作台、选中…)都会跑一遍 sync。替换 slot 注册 = 宿主换 slot entry →
插件 tab body 被 unmount/remount → 文件树丢失层缓存、滚动位置与目录 watcher,并重新
fs.trees([root, ...expanded]) 重列整棵可见树。机械证明(临时插桩,已回退):
[probe-sync] enter live=[editor,git,subagent,sidechat,diff,files]
[probe-registerSlots] slot inject ran for dsh-better-sidebar:files
[probe-body] unmount tab3 kind=files
[probe-body] mount tab3 kind=files
修法:wantsFiles 提前,删除循环里对 files 接管项 skip(禁用 editor 时仍照旧释放)。
根因 2(次):FileTree.tsx 的 retryDir 先把该层缓存删掉再请求,行被「Loading…」
占位替换后重建——目录有外部写入(构建 / 格式化 / 模型跑 bash)时整层闪空。
修法:复用既有 force 路径 loadLevels([dir], { force: true }),保留旧行直到新答案到达
(与 refreshTick 的强制刷新路径行为一致)。
判别性证据(回退任一修复即红)
- tests/native-surface.spec.ts:三次 store 写入不得产生任何注册/注销 → 回退后
registered 6 → 12、disposed 全是 dsh-better-sidebar:files
- tests/file-tree-batch-load.spec.tsx:重列期间旧行仍在屏 → 回退后层被删空
- 新增真实宿主 lane tests/e2e/zz-expand-refresh.e2e.ts(quiescence 判据,无固定 sleep;
zz- 前缀保证它最后跑,因为它会自建 workspace + session):A1 展开只请求被展开那一层、
A2 tab body 存活(不重开 watch socket)、A3 屏上行数不归零;回退修复 1 后退出码 1
(Error: expanding a folder must ask for that folder, not the whole visible set)
修复后实测(40 子项目录,同一探针/机器/工作区)
| 阶段 | fs.trees payload | 新开 ws | DOM +/- | 被删行 | body 替换 | 层内最小行数 |
| 展开 big | [big](原 [root, big]) | 0(原 1) | +41/-1 | 0(原 45) | 0(原是) | 40(原 40) |
| 外部写入 big | [big] | 0 | +1/-0(原 +41/-40) | 0 | 0 | 40(原 0) |
| 展开 bravo | [bravo] | 0 | +2/-1 | 0(原 45) | 0(原是) | 41 |
证伪记录:新建 fs.watch(dir,{persistent:false}) 在 macOS 上无改动时 0 事件(Node 微
探针两遍 + 8 轮真实时序 + 浏览器侧从未收到 {dir} 陈旧帧)→ src/fs-watch.ts 与
use-dir-watch.ts 一行未改。
验证:pnpm typecheck / lint / test(136 文件 1486 通过 9 跳过,基线 1484 + 新增 2)/ build
全绿;DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = 8/8。
版本 0.24.0 → 0.24.1(package.json / dsh.plugin.json / SIDEBAR_SERVICE_VERSION /
README×2 / CHANGELOG×2 同步)。
2026-09-28 22:33:30 +08:00
Menghuan1918
5c95002641
perf(sidebar): fs.tree 22.8ms→3.8ms + 删除工作区路径检测(放开权限)+ 树展开状态按会话
...
用户实测反馈:
1) `/sidebar/api/fs.tree` 性能极差 —— 先测后改(10k 条目目录、热缓存、中位数):
- 冷调用 cap=1000:22.76ms → **3.77ms**;TTL 内重复:≈23ms → **0.000ms**
- 改法:opendir for-await → readdir(withFileTypes) 一次取回;只为 cap 条建行
(slice + 定长数组);路径用字符串拼接而非 path.join;排序弃 localeCompare
(14.6ms/10k → 0.35ms)改小写比较 + 原名码点兜底;新增 1.5s 目录级缓存
(键 绝对路径\0cap,上限 512),由 fs.write/rename/remove/mkdir/upload 与
fs-watch 的变更通知显式失效
- 契约逐字不变;新增 tests/fs-tree.spec.ts 6 例 + fs-watch 失效用例(判别性验证)
2) 删除工作区路径检测(默认不检测、放开权限):
- path-security 变纯词法解析(realpath/包含性判定删除)、fs-operations 去 fence
分支、所有 fs 路由不再读 fence、403 分支消失、config 删 workspaceFence 字段
(schemastery 容忍未知键,旧 profile 不会加载失败)、settings 开关删除
- ⚠️ 安全影响:插件 fs 路由(tree/read/write/rename/remove/mkdir/媒体/HTML/
upload/archive)现在可读写宿主用户可访问的任意路径,只受 OS 权限约束;
指南 §8.1 已加醒目声明
- 死代码清理:FenceErrorNotice 组件 + EditorHost 分支 + 4 个词条(settingsFence*、
fenceErrorReason、fenceDisableAction)+ isOutsideWorkspace* 助手 + TreePanel 的
store prop + 相关 CSS 块
3) 批量列举路由 `fs.trees`(单层失败只在该层带 error)+ 客户端批量加载:
挂载/刷新时的 N+1 请求变为 1 个(8 个展开目录:9 → 1,探针断言)
refreshTick 不再先清缓存(旧行保留到新答案;失败保留旧行 + warn 提示)
4) 修复「关闭文件后返回文件树,展开状态被重置」:
原生承载面的展开集合原来存在每个 tab 的记录里(drop 即丢),改为**每会话状态**
的投影(ensure 从会话态读、toggleExpanded 写回会话态、registerNativeSurface 用
attachStore 订阅);同一会话多 tab 共享、不同会话隔离;revealed 保持 per-tab
验证:typecheck / lint / test(136 文件 / 1484 通过 / 9 跳过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
版本镜像同步(dsh.plugin.json + SIDEBAR_SERVICE_VERSION)
2026-09-28 20:37:56 +08:00
Menghuan1918
ee1fe05067
feat(sidebar): 菜单层级/性能 + 选中条吸底 + 打包进度 + 修复「在侧边打开」
...
用户实测反馈 5 条:
1) 文件列表性能 / 右键菜单不再刷屏(先测量后改,探针 tests/file-tree-menu-perf.spec.tsx)
- 宿主应用列表按路径缓存:N 次打开菜单只请求 1 次(原每次 1 次 + Loading 帧)
- 行上的 git 数据改为原始值(tone/letter):共享 store 每次轮询重建对象不再触达行
(探针:开窗 folderIcons 4 → 0;root 行也 memo 化)
- 菜单开关不触发目录重列(fsTree=0);实测「菜单打开期间暂停轮询」会让变更行瞬时
掉色并多两次重渲染,故按测量结果放弃该做法(数字与理由写进探针注释)
2) 「已选择 N 项」条移到底部:滚动容器最后一个内容子节点 + sticky bottom(不遮最后
一行),窄栏 flex-wrap 换行不出横向滚动条
3) 菜单层级重构:一级只留默认动作(宿主默认应用 / 打开方式 ▸ / 在文件管理器中显示 /
新 Tab / 在侧边打开 / 下载 / 压缩并下载 / 复制路径 / 重命名 / 删除;目录行另有
新建文件夹、上传到此处),应用列表整体收进「打开方式」子菜单;宿主探测到本机关联
应用时默认不显示插件自研 open-with 项目,新增设置开关 openWithPluginTargets
(editor descriptor 的 pluginToggles)可强制并存;宿主不可用时插件项目照旧
4) 压缩并下载显示进度:宿主改为可观测任务(archive.build / archive.status /
/sidebar/archive?id=,4 并发 + 5 分钟 TTL + sessionId 绑定,buildZip 逐条目
onProgress),客户端轮询 250ms 显示「正在打包 done/total · N%」,ready 后 blob 下载,
失败进 zipFailed
5) 修复「在侧边打开没有效果」:根因是它只写插件底部工作台(原生右侧栏的 tab 不在
bottomSplits 里),现按承载面分流 —— 原生 tab 走 service.openTab(target:'side') →
宿主 openResource(preferNewPane, revealIfOpened:false) 真正分栏;底部工作台行为不变
(接入 API 变更已同步 docs/external-plugin-guide.md)
验证:typecheck / lint / test(135 文件 1461 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
新增/更新测试:menu-perf(3)、archive(10)、open-in-app(18)、open-with(10)、multiselect(9)、
zip(37)、service(64)、editor-host(11)、builtins(23)、locales(20)
2026-09-28 20:11:46 +08:00
Menghuan1918
13d4bae321
fix(sidebar): 二轮独立验证的 9 项缺陷 + 目录级暂存
...
verifier 二轮报告(F1–F9)全部修复,每条都有「临时回退即变红」的判别性验证:
- F1【高】中文等非 latin1 下载名 → 真实宿主 500:content-disposition 改用
RFC 5987(ASCII 回退 + filename*=UTF-8'');补真 node:http 用例与根因对照断言
- F2【中】多选同名文件归档重名(解压互相覆盖):冲突项逐级上溯父目录消歧
- F3【中低】maxBytes 在读完之后才判定;budget<=0 的 0 字节 FIFO 会永久阻塞:
改为先 stat、读取前拒绝(FIFO 探针验证)
- F4【中低】SSH 模式 + 宿主不可用时 reveal 整条消失:保留 kind==='reveal' 目标
- F5【低】图钉嵌套交互语义非法且键盘不可达:改为诚实的鼠标热区,键盘入口归设置面板
- F6【低】变更树空闲 tick 全量重渲染:行 memo + 恒定 props + 内容键派生 +
共享 store 的 sameStatus 保住快照身份
- F7【低】排序随运行时 locale 漂移:显式 'en' collation + 码点兜底
- F8【低】POSIX 文件名的反斜杠被当成层级:不再替换
- F9【低】打包中重复点击静默、无反馈:busy 行(role=status)+ in-flight 守卫
- 新增:目录行「暂存/取消暂存该目录」(git pathspec 语义,不触发折叠)
验证:typecheck / lint / test(134 文件 1441 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过
2026-09-28 18:20:08 +08:00
Menghuan1918
b011be1e98
feat(sidebar): 打开方式双源并存 + 多选压缩下载 + 文件变动层级树
...
用户追加三条需求,全部落地:
1) 打开方式 = 宿主探测应用 + 插件自研 open-with(并存)
- 逐字恢复 src/client/open-with.ts / open-with-settings.tsx / plugin-settings.ts /
src/open-external.ts / open.external 路由 / api.openExternal / editor descriptor
的 settings.render,以及 20 个 openWith* 词条(19 份词典从 main 取回原文)
- 恢复 menu-flip.ts + layout.css 子菜单翻转规则(子菜单回来了)
- FileTree 菜单段(无标题行):宿主行 → 分隔线 → 插件 pinned + 「在应用中打开 >」
子菜单(图钉 / SSH 后缀原样)→ 分隔线 → 宿主 reveal;宿主可用时过滤插件
explorer 目标,宿主不可用时插件行照旧(SSH 远端场景保持可用)
- 死键清理:菜单去掉标题行后 openInApp 词条无引用,已从 21 份词典删除
2) 文件页多选右键「压缩并打包下载」
- 新增 src/zip.ts(自研 ZIP:方法 0/8 按收益二选一、UTF-8 bit 11、目录条目、
自实现 CRC32、无第三方依赖)+ src/archive-route.ts(名净化 + 递归收集)+
GET /sidebar/archive(同一道 workspace fence、目录递归跳过符号链接、
10000 条目 / 256 MiB 上限)+ api.archiveUrl
- FileTree:多选 ≥2 项或单选目录时出现;fetch → blob → objectURL 下载,
路由错误(超限 / fence / 非 GET)以 zipFailed 显示在错误条
- 修掉真实缺陷:central directory 只写 MS-DOS 位而 version-made-by 声称 Unix,
Info-ZIP 会把每个文件解成 mode 000;改为 Unix 语义(0o100644 * 0x10000,
<< 16 会溢出 int32)。系统 unzip 复验:mode 644/755、unzip -t 无错
3) 文件变动页层级树 + 视觉打磨
- 新增 src/client/changes/change-tree.ts:单子目录链压缩成一行、目录先于文件、
大小写不敏感排序、文件带 GitFileStatus、目录带下级变更数
- GitLens 两组各自渲染树:折叠状态按「组+路径」独立、默认展开;分组头吸顶 +
计数胶囊;Stage all/Unstage all 改为带 aria-label 的 IconButton;选中 =
interactive-bg-active + 2px 内嵌强调条;12px/级缩进 + l1 参考线;
历史行 hash 徽标 / ref 胶囊 / 作者·时间右对齐
验证:typecheck / lint / test(134 文件 1422 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过;
真实宿主截图确认三条需求(多选+双源菜单+zip 项、变动页树形层级)
2026-09-28 18:08:21 +08:00
Menghuan1918
36fbc5ac7e
feat(sidebar): 文件页与文件变动页 UIUX 重构 + 全局组件抽取
...
文件页(FileTree/TreePanel)
- Ctrl/Cmd 多选 + Shift 按可见行序连选(Esc/点空白/右键收敛),批量条支持复制路径、批量删除(共享 ConfirmDialog + 顺序 fsRemove)
- Git 变更着色:行名按状态上色 + M/A/D/U 徽标,目录按 dirHasChanges 着色,非仓库静默降级(数据来自共享 git 状态存储)
- 新建文件夹:fs.mkdir 路由 + mkdirWorkspaceEntry + 内联输入行(Enter/Esc/blur/IME 守卫)
- 性能:FileRow/DirRow memo(含反向验证)、搜索 hidden 停车不再卸载树、level 拉取世代守卫 + AbortController、fs.tree truncated 提示、use-dir-watch 入参 memo
- 拖拽上传视觉 token 化(硬编码色清零);可见性下传后隐藏页签停止轮询
- 右键「打开方式」改为复用 DSH 自带 open-in-app(宿主探测的关联应用 + 文件管理器显示)
文件变动页(changes/diff)
- 36px 头(宿主 SegmentedControl)+ 单一 ChangeRow + SectionHeader 分组 + 吸底提交条单状态行 + 历史独立空态
- 修掉:双份空态、暂存失败 unhandled rejection、手动刷新被丢、仓库切换刷新两次、worktree 清单缺 repoRoot、工作树被自动切走、预览持旧快照、恢复高度未 clamp、session ops 无谓轮询
- DiffPane/DiffTab 共用 use-git-diff;修掉 DiffPane 的 untracked 预览从不渲染
全局组件与宿主接入
- 新增 src/client/ui(IconButton/Chip/SectionHeader/Notice/ConfirmDialog/StatusBadge + 共享 git 状态存储)
- 新增 src/client/open-in-app.ts(宿主 open-in-app 客户端适配),删除自研 open-with 全链路与 open.external 路由
- 客户端 inject 补 remote / remote.session:缺声明时 ctx.get('remote').session 会抛出并把整个面板打成错误条(真实挂载 lane 抓到)
- 词典:+25 键 / -20 openWith* / -noChanges,20 份同步
验证:typecheck / lint / test(126 文件 1322 通过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.1.7-rc.1 dsh' pnpm test:mount 7/7 通过(含 tab sweep 与 perf lane)
2026-09-28 00:27:31 +08:00
Menghuan1918
6586e3e2d3
feat: adapt to DSH 0.1.7-alpha.1 and yield the read-only previews
...
DSH 0.1.7-alpha.1 is 1299 commits past 0.1.6-alpha.2 and rewrites four
contracts this plugin was built on. The peer floor moves to
^0.1.7-alpha.1 (semver's prerelease rule means ^0.1.6-alpha.2 can never
match a 0.1.7 prerelease); 0.1.6-alpha.2 and earlier stay on v0.19.1.
Released as 0.21.0-alpha.1 (dist-tag alpha).
Hard breaks:
- dsh-settings was rewritten: register(ns, schema) is gone, a form is
addressed by the plugin row's Loader entry id and read from the
module's exported Config. The preferences are merged into Config and
marked volatile — which requires DSH's own schemastery, because only
that build wraps a volatile field in the cosmokit reference the
loader's volatile commit walks. With the public package a settings
write reports success and revision 1 while the effective value never
changes.
- ui-primitives renamed its whole icon family (IconXxx14/16 ->
IconXxxRegular/Medium): 26 imported symbols, 17 files. The failing
mode is render-time, not load-time. Five call sites that relied on the
old 14px default now pass size={14} explicitly.
- Session format v4 rejects source.kind === 'plugin'; the side-chat
boundary injection now writes plugin:dsh-better-sidebar, the same kind
DSH's own v3->v4 migration produces, so historical threads survive.
Tool results moved to role 'tool' with top-level content/isError; all
four parsers accept both shapes.
- The client session snapshot dropped subagentsByParent/jobsBySession
and the on-demand subagent-catalog observation API. The Tasks page
reads projectionsBySession and a new jobs.list route.
Yields and convergence:
- The read-only previews go to DSH's documentpreview (Office->PDF, a
spreadsheet worker, zoom, per-directory refresh); editor.canOpen
refuses those 26 extensions. Markdown, HTML (with its sandbox
switches) and the editable code buffer stay.
- The host browser kind is desktop-profile-only now, so the web e2e
lanes expect no browser entry and assert its absence.
- Link takeover claims only urlTarget links and passes the rest to the
host, fixing a regression from the 0.1.6 round: the fallback pointed
at a 'browser' type the plugin no longer registers, so http links in
its own markdown did nothing.
Also fixed, found along the way:
- The file tree refreshes live (new directory watch over the plugin's
own socket), since the plugin owns the `files` kind.
- ctx.sessions.list has no `current` field at either tag; the three
readers were dead. They now use ctx.sidebarRight.mounted.
- package.json.files was missing lib/client-locale.js.
- Two genuinely dead call sites: sessions.openSubagent/open/
refreshSubagents do not exist on the current baseline, so the
topology click, the jump-back and the retry were all no-ops.
- The test harness window shim lacked addEventListener, which the 0.1.7
primitives call at module-evaluation time; and the e2e token exchange
needs Playwright's request stack, not Node's fetch.
2026-09-22 17:09:08 +08:00
Menghuan1918
22e772ce45
feat(icons): file icons and tab glyphs in color, from the host's own artwork
...
Issue #611 asked for file-type icons like the official explorer's, and #429
built a colored theme for them. DSH 0.1.5-rc.2 makes most of that work
unnecessary: `@deepseek-ai/dsh-client-ui-primitives` now exports
`FileTypeIcon` / `CodeFileIcon` with the host's own 48-type full-color code
artwork plus category-colored sheet glyphs (and its classifier behind them).
So the plugin renders the host's icons instead of shipping a color table, and
color becomes the only behaviour rather than an opt-in theme.
File icons (src/client/file-icons.tsx)
- `builtinFileIcon(path, size)` → `<FileTypeIcon path size />`; folders use the
host's folder category. The plugin's own per-extension VSCodicon map is gone.
- The public `registerFileIcon` API from #531 is unchanged and still outranks
the built-ins, so an external plugin can take over any row. One semantic
consequence, now documented and tested: because the host classifier covers
every path, a registered catch-all (`exts: []`) claims rows it used to lose
to the built-in map. An unregistered catch-all (the old icon theme's shape)
is unaffected.
- Nothing is lazy any more: the artwork lives in a platform module the client
already holds, so `lib/client-file-icons.js` and its 563-entry dataset (255
kB) are deleted outright — the core bundle grew by 10 kB (0.85 → 0.86 MB).
- `src/client/file-icon-theme.ts`, the `fileIconTheme` pref (prefs-shared /
config / client prefs), the settings-page select row and the six
`settingsFileIconTheme*` keys in all 20 dictionaries are removed with it.
Tab glyphs (src/client/builtins/tab-icons.tsx)
- Every built-in tab type now declares a colored glyph: files (the host's
folder artwork), changes/diff (commit), tasks (checklist), side chat
(discussion), terminal (shell), browser (globe).
- The color comes from a `--dsw-alias-*` token through a wrapper class, never
from a literal — the skin contract (§12) holds and `tests/theme.spec.ts`
enforces both halves (no literals in the module, every color declaration in
the stylesheet resolves to a token).
Native right Sidebar chips (src/client/native/tab-adapter.tsx)
- The host's tab definition has no icon field, but the
`sidebar.right.pane.tab.title` slot IS the chip's content, so the plugin
draws the glyph itself: an editor tab with a path shows that file's icon,
every other tab shows its descriptor's icon — the same `descriptor.icon` the
workbench strip and the guide capsules already render, so the three cannot
drift. The glyph is `aria-hidden`, which keeps the chip's accessible name
exactly the title the mount lane matches on.
Gates: typecheck / lint / check:consumer-types green; pnpm test 127 files /
1342 passed / 9 skipped (3 new chip cases, 1 rewritten built-in case).
2026-09-11 15:28:49 +08:00
Menghuan1918
8722bfb29c
fix(file-icons): 适配 v0.18.1 基线——重命名行接入解析器 + 测试与门禁补齐
...
rebase 到 main(v0.18.1)后的适配层:
- 冲突(EditorHost ×2 / TreePanel / FileTree)按并集解:main 侧
onPathRenamed/onPathDeleted 与 PR 侧 service prop 并存。
- main 新增的行内重命名行仍用 <VscFile>/<VscFolder>,而本次改动已删除
VscFile import(合并后 TS2304)——改走 dirRowIcon/fileRowIcon,与树行
同一条回退链;VscFolder 随之无引用,从 import 移除。
- tests/file-icons.spec.tsx:markerB 换成独立元素类型(<b>),使
「priority 降序 / 同级按注册序」断言真正可区分(此前两个 marker 都是
<span>,断言恒真);新增「工厂返回 undefined 则拒绝该级、链继续」与
「注册/注销触发订阅通知」两例(17 → 19)。
- tests/consumer-types.ts:补齐 FileIconDescriptor / registerFileIcon /
getFileIcons / matchFileIcon / matchFolderIcon / fileIcon / folderIcon /
FOLDER_EXT / FOLDER_OPEN_EXT 的编译期门禁。
- README:v0.19.0(未发布)段移到「最近更新」最前(此前被自动合并夹在
v0.18.1 与 v0.18.0 之间)。
- file-icons.tsx:注释修正——展平后的 Map 是后写覆盖,不是「first match
wins」;当前无重复扩展名键,仅潜在语义。
2026-09-08 21:14:15 +08:00
Menghuan1918
8025b83a45
feat(file-icons): 目录保留扩展名注册 + 全局默认兜底 + 编辑器文件 tab 对应
...
- registerFileIcon 保留 'folder'/'folder-open' 特殊扩展名:目录行(含根行)
图标可注册,匹配保留值不认领真实 .folder 文件
- 新增权威解析器 fileIcon(path,size)(具体注册 → 内置 glyph → catch-all
全局默认 → VscFile,逐工厂崩溃隔离)与 folderIcon(path,open,size);
matchFileIcon 收窄为仅具体扩展名匹配
- 编辑器文件 tab(非 meta.dir)与文件树行显示同一 fileIcon 图标
- 同步 external-plugin-guide §7(保留值/回退链/三例注册)与 README
(功能一览、v0.19.0-alpha.0 发布注记、服务化扩展章节)
- tests/file-icons.spec.tsx 重写为 17 用例(链序/保留值/目录/崩溃回退)
2026-09-08 21:11:32 +08:00
Menghuan1918
05773e0f2a
feat(file-icons): 文件树按扩展名区分图标 + 对外 registerFileIcon API
...
- 新增内置扩展名→glyph 映射(md/媒体/pdf/json/代码/配置/数据库/压缩包,
单色 currentColor 遵循皮肤契约,未知扩展回退 VscFile)
- ctx.betterSidebar 新增 registerFileIcon/getFileIcons/matchFileIcon
(priority 降序,同优先级 catch-all 垫底),features 增加 'fileIcons'
- FileTree 文件行消费注册表:注册图标优先(可为彩色 ReactNode,
工厂抛错回退内置),注册/注销即时生效
- 同步 docs/external-plugin-guide.md §7 与 tests/file-icons.spec.ts
2026-09-08 21:11:32 +08:00
Menghuan1918
e39ea92ade
feat(files): tree rename (inline) + delete (confirmed) + submenu visual tether
...
资源管理器补全:文件树右键菜单新增「重命名」(行内编辑:预填+全选、
Enter/失焦提交、Esc 取消、IME 组合键守卫)与「删除」(Modal 确认,文件/
目录文案区分,永久删除——宿主无回收站)。根行(工作区根)不提供两项,
服务端 fs.rename/fs.remove 双保险拒绝;目标已存在 409;link-aware——
symlink 行只改/删链接本身(lstat 判定),fence 校验对解析后目标进行。
落定收尾:pruneTree 清旧前缀缓存 + 收起 stale expanded + 单层重载父目录;
tab 调解走 service(rename→updateTab 改路径改标题、delete→closeTab 关
受影响 tab,覆盖两侧分栏/底栏/浮动窗口,经 tree-mutations.ts)。
二级菜单视觉关系(layout.css,仍限 data-dsh-sidebar-submenu 作用域):
父行在子菜单打开期间保持高亮(宿主已渲染 aria-expanded="true"),
卡片间距 10px→4px(悬停走廊同步收窄),翻转规则一并 4px。
i18n 新增 7 key × 20 语言文件(locales.spec 的 key-set-parity 门禁)。
测试:fs-operations 追加 12 例(rename/remove 全失败面);新增
file-tree-rename-delete.spec.tsx 8 例(菜单可见性/重命名流/删除流/错误条);
menu-flip.spec.tsx 契约扩展覆盖 tether 规则。设计文档
docs/plans/2026-09-04-file-tree-rename-delete-design.md。
2026-09-04 22:08:02 +08:00
Menghuan1918
76b57508f4
fix(ui): compact context menus + viewport-clamped submenu flip
...
减重:全部右键菜单(FileTree 行菜单 / TabBar tab 菜单 / GitLens 文件与
历史菜单 / FreeWindow 标题菜单)与「+」菜单切到宿主 Menu 原语的 compact
密度(26px 行高 / 12px 字 / 164px 卡片),图标随槽位 16→14,「打开方式」
子菜单图钉 20→16,还原工具型右键菜单的趁手感。
越界:宿主子菜单纯 CSS 定位(从父行向上、向右生长)不受视口钳制——树顶
部右键时「打开方式 ▸」子菜单伸出视口上沿,窄面板(280–400px)时伸出右
沿。新增 menu-flip.ts:菜单打开期间在 <body> 发布 data-dsh-sidebar-submenu
="down|left" 方向 token(y < vh/2 → down;x + 400 > vw → left),layout.css
据此翻转子菜单生长方向与 ::before 悬停桥;属性存续期即作用域,宿主自有
菜单不受影响。刻意不做 max-height 滚动钳制——overflow 裁剪会切断悬停桥。
测试:menu-flip.spec.tsx(token 纯函数 + hook 生命周期 + CSS 契约跨文件
一致性);tab-bar / file-tree 两个 spec 追加翻转向量断言;mount.e2e 追加
compact 行高(≤30px)布局级证据。设计偏差记录同步至
docs/plans/2026-08-22-open-with-menu-design.md。
2026-09-04 20:28:35 +08:00
Ch3n4y
94ffac0224
fix(editor): keep file basename in @-reference links
...
The explorer @ button appended plain text (@folder/file.ts), which DSH's
composer only decorates as a folder ref (@folder/) — the file name stayed
outside the link. Insert FILE references through DSH's own structured
insert-reference event instead, minting one chip for the whole reference
(displayed as @basename, serialized as the full @path). Directories keep the
plain @dir/ mention so folder completion still works.
2026-09-03 10:00:13 +08:00
Menghuan1918
b7af498427
perf: stabilize renders (transcript row reuse, tree Sets, shared + options, batched drags)
...
SideChat transcript: every 2s poll rebuilt ALL row objects, so every
row (markdown parse + DOMPurify included) re-rendered even when the
log had not changed. transcriptRows now takes the previous poll's
rows and re-adopts the position-aligned rows whose content is
identical (reuseRows) — only the changed tail rebuilds. The view
feeds the memoized array back through a ref; unit tests pin the
identity contract (unchanged rows keep object identity, changed rows
and everything past the change rebuild, tool-result landings never
re-adopt).
FileTree: expanded/revealed membership was an includes() scan per
rendered row (O(rows × expanded) per render on deep trees); one Set
per render keeps it O(1) per row.
Shell: buildNewTabOptions was inlined in the two Workbench JSX
sites — two fresh arrays per render (drag state, resizes) re-rendered
every LeafView's + affordance. One shared memo now.
DiffPane resize / TerminalView ResizeObserver: pointer and resize
streams fired a setState / glyph-measuring fit() per event; both ride
per-frame batching now (frame-batcher in the core, a local rAF gate
in the lazy terminal chunk). SessionLens sizes each row's content
with a Blob (a UTF-8 encode of the whole edit) — that moved from
per-row-per-render into one memoized pass per changed fold.
2026-09-01 16:01:34 +08:00