Commit Graph
165 Commits
Author SHA1 Message Date
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 ba9dc57f56 docs(tasks): README 的卡片与折叠两条按当前行为改写(维护者确认)
用户确认「现在就改写」那四条(README.md 的 v0.22.0 节 + README_EN 对应两条):

- 双段式节点卡:小条是状态点 + 原生状态文本,运行中/已结算都由活动行取代
  状态词(不再念两遍),空闲与出错保留状态词、无数据时回退状态词。
- 折叠:徽标写真实计数、小条只留出错尾注与展开箭头;点聚合只展开该组,
  页级展开/折叠仍在右下控制条且收起时会清掉按组展开。

设计文档的偏差条目随之改写为完整过程(先报偏差 → 维护者选择改写),
并补上「自查抓到判据反了 + 判别性用例」的记录。
2026-10-11 22:13:14 +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
Menghuan1918 06dff2f56e merge fix/871-preserve-eol into dev(#871 保存保持文件原有行尾:宿主侧在 fs.write 的唯一咽喉点先按盘上内容嗅探行尾(4096 字符多数表决,与宿主 dsh-fs-local 的 detectLineEndings 同判据),写回时按同一判定归一化,CRLF 文件不再被写成 LF 而产出整文件 diff;mtime 冲突基线、fs-conflict 横幅与 #855 的 dirty/编辑态跳过语义均不变)
# Conflicts:
#	CHANGELOG.md
2026-10-08 21:52:00 +08:00
Menghuan1918 90a88670de docs(plans): 给工作区围栏设计文档补「后续偏差」(围栏已于 v0.23.0 移除、fs.search 现在会越界)
这份 2026-08-29 的设计文档状态仍写着「已实现」,末句「`fs.search` 不动——它锚定
cwd 向下走,本来就不会越界」两处都已失真:

- 围栏本身在 v0.23.0 被用户要求整体移除(`path-security.ts` 只剩解析语义,
  `isWithin` 退化为客户端词法工具、不再是安全边界);
- #879 之后 `fs.search` 新增指名目标的直开分支,命中确实会返回工作区外路径。

按 AGENTS §6「docs/plans 逐特性设计,含实施偏差记录」补一节「后续偏差」,
并把状态行改为「已实现、随后整体移除」。纯文档改动。
2026-10-08 21:48:56 +08:00
ymac 419d1c4b67 fix(editor): 保存保持文件原有行尾,不再把 CRLF 文件写成 LF(#871)
编辑器传送的永远是 LF 文档(CodeMirror 没有别的行模型),`fs.write` 原样落盘,
于是在 Windows 检出上「改一行」= 整文件 diff。

- `text-encoding.ts`:`encodingOfFile` 扩成 `fileFormatOf(path)`,同一趟 64 KiB sniff
  同时给出 `{ encoding, eol }`;新增 `detectEol` / `restoreEol`(口径与宿主
  dsh-fs-local 的 detectLineEndings / restoreLineEndings 一致:前 4096 字符多数票、
  孤立 \r 不计票也不改写、还原前先归一化以免 \r\r\n)。
- `index.ts` 的 `fs.write`:落盘改为 `encodeText(restoreEol(content, eol), encoding)`。
  客户端零改动,所有保存入口自动覆盖;新文件仍是 UTF-8 + LF(项目级行尾约定另议)。
- 测试:text-encoding 补 3 条、fs-write-route 补 3 条端到端;拿掉 restoreEol 调用即 2 条红。
- 文档:设计文档 docs/plans/2026-10-06-preserve-eol-on-save.md、CHANGELOG、AGENTS §5 保存语义。

顺带核实(写进设计文档):宿主 `edit` 工具会保住行尾(editText 走 restoreLineEndings),
宿主 `write` 工具不会(writeText 原样写模型文本),那一半插件无权干预。
2026-10-06 15:36:36 +08:00
Menghuan1918 34ce191981 docs: 修正 #855 的用例数、脏态出口口径与轮询叠加口径
- **[硬数字]** CHANGELOG 的 `tests/editor-auto-refresh.spec.tsx` 用例数
  11 → 14(原本就少 1,加上本批新增 2 例);同批核对:既有 #167 的 4 条、
  2.5s 节奏、「N 个编辑器 tab 每 tick 1 个请求」均属实。
- **[用户可见承诺]** 删掉「dirty / 编辑态由既有的『编辑 → 预览』边沿补刷」
  这句不成立的话:该边沿**自身带 dirty 守卫**(`EditorHost.tsx` 的边沿判定
  要求 `dirty !== true`,`tests/editor-refresh.spec.tsx` 的 B 例两半都钉住了:
  干净时 fsRead 1→2,dirty 时仍是 1)。按事实改写为:未 dirty 时点页头
  「预览」会重载并拿到新内容;dirty 时该边沿被抑制,真正的两条出口是**页头
  刷新按钮**(`window.confirm` 后重载)与**「保存 → `fs-conflict` 横幅的
  reload」**(保存带 `mtimeMs` 基线,不会静默覆盖模型字节)。结论句:dirty
  期间保持旧内容直到用户显式动作,**不存在看不到新内容的死路**。指南 §5.2、
  指南行为差异表、CHANGELOG、设计文档 §4.2 四处同步。
- **[叠加口径]** 同一会话同时开着文件变动页(会话透镜)与编辑器时,该会话
  每 tick 是 **2 个** `changes.ops` 请求——「每 tick 1 个」只算编辑器这一份。
  一次性探针实测:会话透镜单独 1/tick、编辑器单独 1/tick、两者同开 2/tick
  (记进 CHANGELOG、指南行为差异表与设计文档 §4.1)。
- 设计文档 §5/§6 的用例数与门禁数字同步为本次实测(184 文件 2152 通过 /
  13 跳过 / 0 失败)。
2026-10-06 00:55:52 +08:00
Menghuan1918 1748c7b0d4 feat(editor): LLM 改完文件后自动刷新正在看的预览(#855)
模型在会话里 write/edit 一个正开着的文件后,侧栏里仍是旧内容,只能手点刷新或
关掉重开——加载 effect 的依赖里没有任何一项会因写盘而变化,keepMounted 又让
切走再切回不重挂。

信号源用插件自有的 `changes.ops` 增量流(宿主按 seq > afterSeq 下发 tool/call +
tool/result,客户端折成文件操作),不新增第二个轮询机制:没有 fs.watch,也没有
任何周期性的 fsRead 指纹轮询。

- 新增 src/client/ops-stream.ts:每会话一条流 + 成员选举一个 leader,只有 leader
  跑 usePolling(self-scheduling,2.5s,与文件变动页会话透镜同一路由同一节奏)。
  一个会话开 N 个编辑器 tab 每 tick 仍只有 1 个 changes.ops 请求;成员全部离开即
  停轮询但保留游标与已发布状态,页签回来时补折离开期间错过的增量。
- 只发布结算成功的 write/edit(running === false && !isError);第一帧是基线,
  打开前已结算的写入一律不触发。
- 命中判定 fileOpKey(cwd, path):resolveSidebarPath 归一相对路径 + `.`/`..` 词法
  折叠 + 分隔符统一 + Windows 盘符/UNC 大小写折叠。
- EditorHost:命中且非 dirty、非编辑态时 setReloadSeq(+1)——复用页头刷新按钮那条
  完全相同的加载路径,手动入口原样保留。脏态优先:dirty 时绝不覆盖用户输入。

测试 tests/editor-auto-refresh.spec.tsx(12 例,jsdom + 假计时器),逐条做了
「还原源码即红」的变异验证;#167 的既有 4 条未改动。
docs:接入指南 §5.2 与行为差异表、CHANGELOG、设计文档。
2026-10-06 00:34:42 +08:00
Menghuan1918 e4a4c3fa4c merge origin/dev into feat/774-terminal-tab(#774 收尾前置)
dev 前进 12 个提交(titleBar 让位机制整体移除、#132 新建文件与排序三档、
#817 后台激活改标记未读、#412 Windows「在应用中打开」候选链等)。两处冲突,
都是「双方各自新增的内容」,无实质取舍:

- CHANGELOG.md:Unreleased 保留双方条目。#774 一组在最上(本分支的新条目),
  其后是 dev 的「移除 titleBar 让位机制」「#132 新建文件 / 排序」一组,再往下
  是既有的 #109 / #203 一组(与文件里原有的空行分组一致)。
- tests/e2e/mount.e2e.ts:只在下一条用例的标题行冲突——保留本分支新增的底部
  终端用例(#774),标题取 dev 侧的新名(`a shell-stamped render URL mounts
  normally; …`;dev 已把 WCO / preset 两条场景删掉)。
- 21 份词典、AGENTS.md、docs/external-plugin-guide.md、README 自动合并:dev 删的
  12 个 titleBar 词典 key 保持删除,本分支新增的 3 个 terminal 词条保持新增。
2026-10-06 00:07:23 +08:00
Menghuan1918 66eb494bb3 docs: 修正 #774 的三处不实数字与 e2e 入口口径
- CHANGELOG:chunk 体积 750,030 → **749,897** 字节(实测 wc -c
  lib/client-terminal.js);chunk 名镜像点 9 处 → **8 处**(按 AGENTS §5 口径,
  tests/manifest-consistency.spec.ts 从 CHUNK_NAMES 派生,无需字面量改动)。
- e2e 入口写法改正:lane 点的是**空面板的类型卡片**(PaneEmptyCards,与 `+` 菜单
  同一份 buildNewTabOptions),不是 `+` 菜单;并注明 `+` 菜单那条点击路径 lane 里
  没有覆盖。计划文档同步。
- 计划文档第 6 节:「未验证:真实挂载 lane」改为已实测(实现节点与独立验证节点都
  跑过),并如实写明**完整 lane 曾因无关 spec zz-expand-refresh 抖动失败过一次、
  单独重跑即过**,所以「完整 lane 一次通过」不能当证据用。
- 计划文档与 CHANGELOG 同步本次新增的单元守护与用例数(14 → 15 条)。
2026-10-06 00:06:40 +08:00
Menghuan1918 2f66c921df docs: 同步 #774 的接入契约、设计文档与内置清单
「接入 API 即文档」:src/client/service.ts 与 src/client/builtins/ 变了,
唯一权威接入文档必须跟着变。

- docs/external-plugin-guide.md:`bottomOnly` 全字段说明(含与 `hidden`
  的区别、`openTab` 落点改道、为什么不注册原生承载面);承载面表把
  「终端(已交还宿主)」拆成三条——宿主一条 + 插件底部一条(彼此独立)、
  `bottomOnly`、底部终端的恢复语义;`target: 'side'` 行补上唯一的例外;
  guide 条目行补「`bottomOnly` 同样不占行」;§4.4 内置清单加
  `terminal-bottom` 行(5 → 6)。
- docs/plans/2026-10-05-bottom-terminal-tab.md:设计文档。五条已定决策、
  从装好的钉版包里读出来的宿主契约(含 view() 的 createWhenMissing 分支、
  SnapshotStore、帧协议、issue 枚举)、三条恢复语义的由来、降级矩阵、
  证据清单,以及**未验证项**(真 Windows / 真浏览器观感 / 本轮是否跑过
  真实挂载 lane)。
- README.md / README_EN.md / CHANGELOG.md / AGENTS.md:内置 5 tab → 6 tab
  的计数同步(README 的终端行与排障行补上底部终端与它的失败模式)、
  Unreleased 词条、AGENTS 的 chunk 名清单与关键测试守护条目。
2026-10-05 23:42:49 +08:00
Menghuan1918 85c7d12785 chore(shell): 删除 titleBar 让位机制及全部相关配置(#430)
插件自 v0.19.0 起不再自绘顶部 chrome:`223b254` 把那三条读 strip 的规则
(`top: calc(var(--dsh-title-bar-strip, 40px) + 3px)` / 右面板
`padding-top: var(--dsh-title-bar-strip, 40px)` / 折叠态 `+14px`)连同自绘
chrome 一起删掉了。此后「位置兼容模式」四方案仍在写
`--dsh-title-bar-strip` + `body[data-dsh-title-bar-compat]`,但**没有任何
消费者**:`src/**/*.css` 零命中,宿主也不读这条契约(DSH 核心整树 grep
`windowControlsOverlay|dsh-desktop-titlebar-inset|titlebarInset|
title-bar-strip|title-bar-compat` 与 `desktopWindow` 全部零命中)。结果是
用户改设置只写变量、什么都不动,而设置项描述(「标题栏条带高度:侧边栏
按钮与内容下移的像素数」)与现实不符。整套删除,不留兼容层。

删除范围(先做了完整消费者普查,见新增的设计文档):
- 计算与写入:`src/client/titlebar-strip.ts`、`src/client/wco.ts`、
  `src/client/shell-presets.ts` 三个文件整体删除;`Sidebar.tsx` 里的 strip
  计算 + 写 `--dsh-title-bar-strip` / `body[data-dsh-title-bar-compat]` 的
  effect 与 `titleBarCompat` 局部量一并清理。
- 壳信号:`desktop-env.ts` 的 `parseDesktopEnv` / `DesktopEnv` /
  `probeDesktopWindow` 与 `context-types.ts` 的 `SidebarDesktopWindowService`
  (含 Insets / DragRegion)删除。#864 新增的 `desktopWindow` 优先读取随之
  消失。**`desktop-env.ts` 文件保留**:同文件的 `hostTransportBase()` 另有
  3 个消费者(`host-route-url.ts` / `TextEditor.tsx` / `changes/DiffPane.tsx`),
  是反向代理前缀与 `dsh-app://` 自定义 scheme 的解析基准,与本机制无关。
- 配置:`titleBarScheme` / `titleBarPresetId` / `titleBarCompat` /
  `titleBarStripPx` 及 `TITLE_BAR_STRIP_{MIN,MAX,DEFAULT}` / `TITLE_BAR_SCHEMES`
  / `TitleBarScheme` / `clampTitleBarStrip`(`prefs-shared.ts` 的字段与默认值、
  `config.ts` 的 schema 字段、`client/prefs.ts` 的读迁移逻辑)。
- 设置界面:常规行的方案下拉 + 「自定义方案」齿轮弹窗 + `titleBarSchemeValue`
  / `onSchemeSelect` / `detectedEnv` / `stripSettingsOpen` 全部删除;
  **自定义 CSS 逃生口保留**,搬到独立的「自定义 CSS」分组,并去掉 scheme
  门控(非空即生效)。`SideCardSection.module.css` 的死样式 `.rowGear` 同步删。
- 词典:21 份(`locales.ts` 的 zh + en 与 19 个 `locales-*.ts`)同步删除 12 个
  只服务这些设置的 key(`settingsTitleBar*` / `settingsScheme*` /
  `presetDshDesktopDesc`);`settingsCustomCssPlaceholder` 的示例改为
  `[data-dsh-bottom-panel]` + `--dsw-font-mono`,不再引用已删变量。
- 文档:指南 §12.1 重写(删四方案 / strip 取值链 / 壳信号 / 迁移,保留用户
  空间 CSS 与两条拖拽区退出)、§7 的 `toggles` 键清单、AGENTS §5 皮肤契约与
  「契约反向引用」;新增 `docs/plans/2026-10-05-remove-titlebar-compat-strip.md`
  记录普查结论与去留理由。`docs/plans/` 的历史文档未改。

迁移安全(旧偏好数据被安全忽略):四个已删键在 OPEN 的宿主 schema 里是未知键,
解析不报错、不写回(`plugin-shape.spec.ts`);客户端 `parsePrefs` 只按声明字段
构造结果,旧键不进入 UI(`prefs.spec.ts`);一次性 `settings.yaml` 回迁按
`Config.dict` 的声明字段过滤,已删键被丢弃而非转发(`smoke.spec.ts`)。
三条新断言都做过变异证伪:让 `parsePrefs` 透传原记录 / 让 schema 重新声明
`titleBarCompat` / 去掉回迁的声明字段过滤,对应用例分别红在
「不要带上已删键」「解析结果不得含该字段」「回迁不得保留该键」。

测试:删除 `tests/titlebar-strip.spec.ts` / `wco.spec.ts` /
`shell-presets.spec.ts` / `desktop-window-strip.spec.tsx` /
`desktop-env.spec.ts`(五个文件断言的行为已整体移除,不留断言已删行为的测试);
`prefs.spec.ts` / `plugin-shape.spec.ts` / `smoke.spec.ts` /
`side-card-section{,-rows}.spec.tsx` 的夹具与断言改写;`mount.e2e.ts` 删掉 WCO
与壳预设两个场景,URL 戳记场景保留挂载与拖拽区断言、只删 strip 断言,
自定义 CSS 场景改为只写 `customCss`。

门禁:`pnpm typecheck`(0 错误)/ `pnpm lint`(0 问题)/
`pnpm exec vitest run --maxWorkers=3` —— 179 文件 / 2075 passed + 13 skipped
(删除前基线 184 文件 / 2117 passed + 13 skipped;差额 = 5 个被删 spec 的
41 条 + `prefs.spec.ts` 净减 1 条)。词典 parity(`locales.spec.ts`)与皮肤
契约(`theme.spec.ts`)均绿。
2026-10-05 23:38:04 +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 2c8d11a8fc feat(editor): 编辑器未提交变更提示(行号着色 + 左侧色条 + hover blame)(#212)
code 视图(可编辑 CodeMirror)显示未提交变更的行级提示,一个布尔设置
editorGitGutter(默认开)总开关:

- 行号槽着色 + 行号左侧 2px 细色条(新增/修改/删除),取色复用文件树
  既有 tone 口径(--dsw-alias-state-*);
- hover 某行时按需取该行 blame,纯文本 tooltip(作者 · 时间 + 摘要),
  按 sessionId+path+line 记忆化,不预取整文件、滚动不重复请求;
- 行映射复用既有 useGitStatus 共享 store 与既有统一 diff 引擎
  (parseUnifiedDiff/unifiedSegments),不新增第二个 git status 轮询器;
  未跟踪文件按状态 store 整篇标新增;
- 新增宿主路由 git.diff-head(git diff HEAD,部分暂存时给出已暂存+未暂存
  的整份未提交变更,未出生 HEAD 回退 --cached)与 git.blame
  (git blame --porcelain -L,四条失败路径一律返回空,不抛);
- 只给 viewerId === 'code' 挂 decoration/gutter/tooltip,markdown/html 与
  关闭设置后不安装任何扩展;开关经 Compartment 原地重配。

不做行尾常驻作者 widget、不做徽章、不做动画、不做渐变、不做四个独立开关。
2026-10-05 22:25:51 +08:00
Menghuan1918 a67779acdc fix(desktop): 顶部保留区优先读壳的 desktopWindow 契约(#864)
现象:dsh-desktop 的 compatibility / extended 模式下,壳已经把整个页面下移 36px(页面在独立
WebContentsView / 壳自有 root 里从 y=36 开始),却仍按契约在 URL 上盖
`dsh-desktop-titlebar-inset=36`;插件把这枚戳当成「页面还要再让位 36px」,于是面板顶部多一条空白。

修法:
① `desktop-env.ts`:mode 接受第三种取值 `extended`(与 compatibility 同几何的独立 36px
   frame),并新增 `probeDesktopWindow(ctx)` —— 结构化探测客户端服务 `ctx.desktopWindow`
   (镜像类型 `SidebarDesktopWindowService` 落在 `context-types.ts`,照 sidebar-file.ts 的
   probe 约定)。**不写进 `dsh.client.inject`**:普通浏览器没有该服务,注入它会让整个插件
   pending;探测按调用读(服务由壳自己的 client fiber 提供,可能后到),`get` 抛错按缺失处理。
② `computeTitleBarStrip`:取值链在 ⓪ `web` 强制 0 之后、① WCO 之前插入壳契约 —— 服务存在时
   以 `safeAreaInsets.top` 为权威(compatibility / extended 报 0 → 不再预留;advanced 报它画进
   内容里的 caption 行,darwin 与 win32 同为 32,以壳上报值为准)。URL 戳因此在有服务时被忽略;服务不存在时旧链路
   (WCO → URL → preset/custom)逐字不变。
③ `shell-presets.ts`:复核 `env.mode !== 'advanced'` —— extended 不套用 advanced 的 preset
   顶部值(guard 原样成立,补注释与用例把它钉住)。

文档:指南 §12 的壳信号与 strip 取值链、`docs/plans/2026-08-20-desktop-scheme-settings-design.md`
的实施偏差记录同步。

判别性(`git stash push -- src` 临时还原源码、保留测试后重跑):
- titlebar-strip.spec.ts:(a)/(d) 由 0 变 **36**、(b) 由 32 变 0 → 3 例红((c)「无服务 + 戳 36
  → 36」在旧代码上照旧绿,正是本次刻意不动的那段);
- desktop-window-strip.spec.tsx(挂真 Sidebar、断言页面实际状态):期望
  `{compat:false, px:''}` 实得 `{compat:true, px:'36px'}` —— issue 的可见症状本身;advanced 实得
  无 strip → 3 例红;
- desktop-env.spec.ts:extended 解析成 null、`probeDesktopWindow is not a function` → 4 例红
  (typecheck 同时报 12 条:链只收 5 参 / `'extended'` 不在联合里);
- 还原后 34/34 绿,src diff 与还原前逐字节一致(`git diff -- src | diff - /tmp/430-src.patch`)。

全量:174 files / 1977 passed | 13 skipped(新增 14 例),typecheck 0,eslint 0。

本改动**不**解决 #430(那是「preset / custom 档位不改变位置」的取值链优先级问题),两者不要互相关闭。
2026-10-05 21:59:14 +08:00
Menghuan1918 2dceb093b9 test(git): 补 git.suggest-message 宿主路由契约(模型回退链/截断/参数面/错误映射)
新增 tests/git-suggest-route.spec.ts(16 例;真 git 仓库 + 假 ctx.llm / 假会话 / 假设置,
沿 tests/git-remote-actions.spec.ts 的 harness),在真实 /sidebar/api 路由面上钉住:
三级模型回退链(固定 → 会话自身 → agentDefaultModel)与「全都拿不到」的可辨识 503、
提示词组装与 truncateDiff 的截断标记、512 token / 最低 reasoningEffort / 30s 超时确实
进了 llm.stream 入参、{message, provider, model} 返回形状与 cleanSuggestion 后的文本、
llm 失败与「无可用模型」可区分的错误映射,以及「除读 diff 外零 git 调用」的安全不变式
(spawn 进程边界 + 仓库状态双证据)。

顺带把 docs/plans/2026-10-05-git-commit-suggest-and-remote-actions.md 改名为
2026-10-05-git-remote-actions.md(内容本就是 Push/Pull 移植记录,slug 与内容错位),
并补记该路由层缺口的回填。

Refs #642
2026-10-05 02:50:34 +08:00
Menghuan1918andAhdong&Shouey 3badac1981 Merge port/pr-434:Push / Pull(建议提交信息只留 port/pr-642 的一份实现)
冲突取舍:

- src/client/locales*.ts + locales.ts(20 份词典):两侧都是在同一锚点插入新键。保留 HEAD
  (#642 的 generateCommitMessage / generatingCommitMessage / suggestCommitError /
  suggestCommitEmpty / commitModel* 等)全部译文,只并入 434 的 push / pull / pushError /
  pullError 四键;同名键只留一份(重复插入会 TS1117 直接红)。
- src/client/api.ts:保留 #642 的 gitSuggestMessage(返回 message+provider+model)与
  gitModels / gitCommitModel,并入 434 的 gitPush / gitPull;删 434 的同名 gitSuggestMessage。
- src/index.ts:git.suggest-message 取 #642 的路由体(pinned → 会话自身 → agentDefaultModel
  三级模型回退、buildCommitPrompt/truncateDiff、最低 reasoningEffort、512 token、30s 超时、
  assembler.finish 判错),删 434 的 SUGGEST_DIFF_LIMIT / sessionModelRoute / 重复的
  @deepseek-ai/dsh-llm import;git.push / git.pull 两条路由(434)保留。
- src/client/changes/GitLens.tsx:以 #642 的提交栏为基(原生 textarea + commitInputWrap +
  commitBusyText + suggestButton + Ctrl+G + 模型 tooltip),删 434 的重复 suggestMessage 与
  Input+IconButton 版建议按钮;把 Push/Pull 两个按钮并进同一条 commitRow(不新增第二行),
  失败仍落既有那一条 actionError 状态行。
- src/client/changes/changes.module.css:删 434 的 .suggestSpinner + keyframes +
  prefers-reduced-motion 块与 .commitRemoteRow(#642 自带 suggestButton / commitBusyText)。
- src/context-types.ts:整块回退到 HEAD,删 434 的 requestHeader() / SidebarSessionRoute
  (#642 的模型路由不消费它,留着就是死接线)。
- 测试:tests/git-remote-actions.spec.ts 只留 push/pull 的 4 例宿主用例(434 的
  git.suggest-message 组钉的是被替换的契约:requestHeader 折叠与 200 token 预算);
  tests/git-suggest-ui.spec.tsx 改为 tests/git-remote-actions-ui.spec.tsx,只留 Push/Pull 一例
  (jsdom,钉调用参数与共用状态行);建议实现由 #642 自带的 commit-message / git-suggest /
  commit-model-settings 三个 spec 覆盖。
- docs/plans/2026-10-05-git-commit-suggest-and-remote-actions.md:改写为 Push/Pull 的移植
  记录,写明两处集成取舍(建议以 #642 为准并逐项列出删除的接线;文件树 rename 整块丢弃)。

Co-authored-by: Ahdong&Shouey <131278957+LiuStar656@users.noreply.github.com>
2026-10-05 02:41:34 +08:00
Menghuan1918andAhdong&Shouey 7cf3d609ff feat(changes): AI commit-message suggestion + push/pull in the git lens
Port PR #434's two Git-panel features onto the current dev structure. The
PR's third commit (file-tree context-menu rename) is dropped: dev already
has it (#550, e39ea92) with a different `fs.rename` payload contract
(`name`, not `newName`) and its own i18n keys, so keeping it would break the
route and duplicate dictionary keys (TS1117).

Why this is a rewrite rather than the PR's diff applied:

- The client carrier moved. `src/client/GitView.tsx` was deleted by 24a3813
  (the unified "changes" tab), so the client half lands in
  `src/client/changes/GitLens.tsx` and follows that file's conventions: the
  bar's single `actionError` status line instead of a second `remoteError`
  channel, `runAction` for the git mutations, the kit's `IconButton`, and the
  host's own `IconSparkleRegular` rather than a new react-icons import.
- The host route could not read `Session.events` at all: it was renamed to
  `snapshotEvents()` in DSH 0.1.2-alpha.4, and 0.2.0-rc.1 marks it `new calls
  are prohibited`. `git.suggest-message` resolves its provider/model from the
  incrementally folded `Session.requestHeader()` — the same `request/header`
  record the PR was after, but O(new events) instead of a full reverse scan.
  `SidebarSessionStore` gains that face; `snapshotEvents()` is marked
  deprecated there.
- Message source is the plugin's own producer kind
  (`plugin:dsh-better-sidebar`, the existing `MessageSourceMap` augmentation):
  a bare `plugin` kind is rejected outright in session format v4.
- The commit row stays where dev put it. PR moved it to the top of the panel
  because it was buried between the two file lists; dev's commit bar is
  already a `position: sticky` footer, so that problem is gone — and
  `changes-tab.spec.tsx` pins the bar's status line to the message row.

Beyond the port, the route reads `assembler.finish` so a provider-side failure
is reported with the provider's own reason instead of "the model returned an
empty message", bounds the call with a 30s deadline, and truncates the diff at
12K characters.

Refs #434

Co-authored-by: Ahdong&Shouey <131278957+LiuStar656@users.noreply.github.com>
2026-10-05 02:11:10 +08:00
Menghuan1918 783ac9feb6 merge #600 into dev(草稿保护/冲突门/替换;删掉与 #587 重复的查找接线与词典键,换掉已删图标名)
贡献者 PR #600(feat/editor-draft-protection,head a14c1e8)以 --no-ff 落到 dev
基线(9b97e6f)。贡献者的提交原样保留,冲突解决体现为本次合并结果。

保留(PR 独有):
- 草稿保护:src/client/editor-dirty.ts(脏稿登记表 + confirmDiscardDraft)、EditorHost
  的登记/卸载清理、Sidebar 的 closeTab 门与 beforeunload、closePathTabs 的确认参数。
- 保存冲突门:fs.read 回报 mtimeMs、fs.write 的 expectedMtimeMs(409 fs-conflict,在写
  临时文件之前判定)、TextEditor 的 mtimeRef + 冲突横幅 + onReload、wire 的
  fs-conflict 码,以及 fs-write-route / text-editor-conflict 两个新 spec。
- 查找/替换入口:TextEditor 工具栏放大镜按钮(打开 #587 的面板;可编辑视图的面板自带
  替换行),文案用 #587 的 searchFind。

删除(与 #587 / 2e22b90 重复的部分):
- TextEditor 里重复的那份查找接线:本地 searchPhrases()、EditorState.phrases.of(...)、
  search({ top: true })、编辑器 keymap 里的 ...searchKeymap,以及 search / searchKeymap
  两个 import——#587 的 src/client/cm-search.ts 已提供同一套(面板、keymap、phrases 隔间、
  令牌主题)。
- 20 份词典里被 #587 取代的 10 个键:find / replace / findNext / findPrevious / findAll /
  findMatchCase / findRegexp / findByWord / replaceOne / replaceAll(命名以先落的 #587 为准:
  searchFind / searchReplace / searchNext / searchPrevious / searchAll / searchMatchCase /
  searchWholeWord / searchRegexp / searchReplaceAll)。
- src/index.ts 里已被 2e22b90 覆盖的临时文件改名(.dsh-write-<uuid>):保留 dev 的
  .dsh-sidebar-tmp-<uuid>,tests/fs-write-route.spec.ts 的残留断言改指 dev 命名。
- tests/text-editor-search.spec.tsx 中与 editor-find.spec.tsx 重复的三个用例(en/zh 文案、
  Mod-f),只留「工具栏按钮开面板并切到编辑态」这一个独有用例。
- README / README_EN / 指南里未实现的 Ctrl/Cmd + H 声明(PR 从未绑定 Mod-h,且浏览器保留
  该组合键),改为如实描述「Ctrl/Cmd + F 的面板含替换行」,并补上 #587 已支持的
  Ctrl/Cmd + G / Shift + Ctrl/Cmd + G / Ctrl/Cmd + D。

其它解冲突取舍(dev 上下文已漂移,不复活 PR 基线代码):
- 图标:IconSearchOutline16 在宿主图标整族改名后已不存在,换为 IconSearchOutlineRegular
  size={16}(显式尺寸;旧 16 后缀已删,不传会按新默认尺寸)。
- 采纳 dev 侧:fs.read 的 ensureWorkspacePath 两参调用、truncation 横幅不带 mode 条件、
  fs.write 的编码探测与 invalidateDirectoryCache、Sidebar 的 closeTab 里 PR 基线的终端
  pty 释放块(dev 已移走)与 summaryCwd/pushedBottomHeight/collapsed 块(dev 已删)。
- 测试 harness 跟随 dev:ctx.sidebarRight.mounted、bottomSplits、先打开底部工作台、
  apply() 需要的 ctx.on、api 模块改为部分 mock(保留 sessionPhase / sessionCwd)。
- 取舍记录写入 docs/plans/2026-09-09-editor-draft-protection-design.md。

Refs #600
2026-10-05 01:58:18 +08:00
Atlas Zeng 40f0255ad0 Merge pull request #807 from graydovee/fix/blank-session-bottom-entry
fix(client): 空白新会话里恢复「打开底部工作台」入口(#698 / #623)
2026-10-05 00:53:27 +08:00
Menghuan1918 7ddf99cb94 feat(skill): issue/PR 分诊与排队 skill(.agents/skills/issue-triage)
把这次 190 条 issue 全量分诊 + 排期看板落地的做法沉淀成仓库级 skill:

- `SKILL.md`:五阶段流程(快照 → 分类 → 判动作 → 同步看板 → 落档)+ 交付前检查表;
  写死了两条容易返工的纪律:已有优先级标签默认保留、优先级只降不升(要升先说)。
- `references/taxonomy.md`:类型/领域/优先级/批次/Status 口径与看板身份;
  「人工提入 R1 的 P2」只有一份机器可读来源(`promoted.json`),避免标签与名单两套真相。
- `references/gh-gotchas.md`:Projects v2 的实测坑——`project` scope 必须人工授权、
  组织项目可见性只有 owner 能改(连 `public:false` 空写都 FORBIDDEN)、视图分组不在公开 API、
  `updateProjectV2Field` 的选项是整体替换(会清值,必须重写一遍)、
  `gh project item-list` 的非 ASCII 键乱码、嵌套连接 50 万节点上限、条目不随 issue 关闭移除。
- `scripts/snapshot.mjs`:open issue/PR 快照 + 「是不是已经修了」的线索(提交 / 文件 / 提及),
  输出 `digest.md` 供人读;只读,不写 GitHub。
- `scripts/board-sync.mjs`:按**名字**解析项目/字段/选项,幂等加条目与写字段值(issue 按标签算优先级、
  PR 从它引用的仍开着的 issue 继承),`--dry-run` 看计划、`--verify` 回读断言(缺失 / 不一致 / 一 issue 多 P 标签)。
- `docs/plans/2026-10-04-issue-triage.md`:首次执行的完整记录(skill 的示例输出,含关闭理由与复核证据)。
- `AGENTS.md` §6 增加 skill 入口。

验证:在本仓库真实看板上跑通——`--dry-run` 与实跑各一次(+ #841 / #842 / #843,207 条目,字段写入 5 次),
`--verify` 输出 `missing=0 mismatched=0 multi-P-label=0 → OK`;多出的 1 条是已关闭的 PR #761,属预期(条目不随关闭移除)。
2026-10-05 00:17:08 +08:00
HuanLinOTO 8c37a7e7df Merge PR #663: fix(sidechat): clear the child inbox after create — fork markers alone do not fence the runtime inbox
# Conflicts:
#	AGENTS.md
#	tests/sidechat-seed-validation.spec.ts
2026-10-01 17:17:57 +08:00
ymac 0a83d671e5 docs: the post-merge division of labour for native tab state
Merging main moved the expansion set into the plugin store's session state
(`5c95002`: `attachStore` / `syncExpanded` / `getSessionStates().expanded`), which
was this branch's other half. Record the split so the next reader does not try to
keep two authorities: the STORE owns the expansion set, the RECORD owns identity
(`sessionId::tabId`) and lifetime (no `drop` on unmount), and `keepMounted` is
what makes both survive a tab or Conversation switch.

- `AGENTS.md` §3.4 item 9: three facts instead of two — (c) is the store authority.
- `docs/plans/2026-09-25-…md`: the merge note, plus the earlier attribution note
  that the `FILES_KIND` guard came from #777.
2026-10-01 16:47:43 +08:00
ymac d1c8208d56 Merge origin/main (v0.24.1, DSH 0.2.0-rc.1) into fix/native-tab-state-retention
Two conflicts, both in the native tab adapter's per-session work — main's
`5c95002` moved the expansion set into the plugin store's session state while
this branch moved the RECORD identity to `sessionId::tabId`:

- `src/client/native/tab-adapter.tsx`: keep main's store-backed expansion as
  the authority (`attachStore` / `syncExpanded` / `getSessionStates().expanded`)
  and this branch's seat-scoped identity (`views` keyed `sessionId::tabId`,
  `get/has/update/drop/versionOf/retain` take the seat session). `toggleExpanded`
  keeps main's active-`reduce` / background-`reduceFor` split, but locates the
  record by its seat and writes the SCOPE session's set — the set every view of
  that session mirrors.
- `tests/native-surface.spec.ts`: main's five expansion cases adapted to the
  session-scoped API (seat session on `ensure`, two-arg `get`/`drop`, seat on
  `toggleExpanded`); the branch's cases now bind a store before toggling, since
  expansion no longer lives in the record itself.

The `files` takeover guard and its registration invariants come from
main; this merge drops the branch's duplicate.
2026-10-01 16:37:35 +08:00
graydovee 78a7dbd272 fix(client): 空白新会话里恢复「打开底部工作台」入口(#698 / #623)
0.2.0-rc.1 实测:空白会话里宿主仍渲染会话头,但只渲染 leading + corner(宿主自己的
「Open right sidebar」按钮);header.utilities / header.actions 两个槽不渲染,插件挂在
utilities 上的底部工作台开关随之不可达。

- 判定来源不用 DOM 探测:host 半区新增只读路由 session.phase,读
  ctx.sessions.get(id).snapshotEvents(),按宿主会话列表投影同一规则判定 blank
  (无 user/message 与 assistant/message)。
- 客户端 useSessionPhase(sessionId):挂载/会话切换取一次;blank 期间每 1s 轮询;
  发出第一条消息即翻转停止。路由/宿主不支持时按非 blank 降级。
- 备用入口放在 conversation.composer.dock(list 槽,blank 态渲染且为空;hero 行的
  workspace 槽是 single 且被宿主 WorkspacePicker 占用,实测抢占会使客户端条目激活失败,
  不用)。仅在 blank 相位渲染,因此与会话头里的入口天然互斥、恒定一套。
- 备用按钮 position:fixed,按宿主「Open right sidebar」按钮的 rect 对齐到其左侧紧邻
  (随 resize 与 500ms 周期重对齐),经 portal 到 document.body(z 40:高于 AppFrame(20)
  与会话头、低于浮层 100+),否则会被会话头 titleRow 拦截点击(实测)。
- mount / perf 的入口断言从「attached 恰好 1 个」升级为「可见的第一个可 attached/点击」:
  宿主会为每个保留会话渲染隐藏的会话头副本(transform 移出视口、rect 仍在),节点计数
  会把副本算进去;「屏幕内恰好 1 个」的强不变量由新增用例的 on-screen 计数负责。
- 单测 tests/dock-fallback.spec.tsx(4 条,mock session.phase):blank 渲染且点击写 store;
  非 blank 不渲染;相位未到达不渲染;路由不可用降级。
- 部署级 tests/e2e/blank-session-dock-entry.e2e.ts:空白会话入口可见可点、宿主侧边栏按钮
  仍在旁、屏幕内恒定一套;发消息后退场、入口回会话头;无 console/pageerror。
- docs/plans/2026-09-29-blank-session-dock-entry.md:根因、实测、排除方案、判据。
2026-09-29 17:54:53 +08:00
Menghuan1918 0ac62b3a49 Merge origin/main (v0.22.1 与三个热修 PR) into feat/files-changes-uiux
冲突面 11 个文件,逐项裁决如下:

1. src/client/native/index.ts —— **取 main 版**。main 的 v0.22.1 在同一处做了更强的修复
   (清理循环同样跳过 FILES_KIND,另加 `disposeSafely` 与「注册失败必须回滚已占用 id /
   已建槽位」),是我们那行守卫的超集。
   ⚠️ 但 main 分支从来没有过我们 task-19 的 `records.attachStore(store)` 调用,整文件
   采用会**静默丢掉**它(records 拿不到 store → `toggleExpanded` 直接 return → 点目录
   树毫无反应),且 jsdom 单测看不见(它们自己绑 records)。已按原注释恢复该调用,并在
   注释里记下这次合并教训。真实宿主 lane 证明:恢复前 `zz-expand-refresh` 红(请求为
   空、`big` 不展开),恢复后 9/9 全绿。
2. package.json / dsh.plugin.json / src/client/service.ts —— 版本相关冲突取我们的
   0.24.1(支持线 ^0.2.0-rc.1 不变)。
3. CHANGELOG / README(中英各一)—— 双方版本节全部保留:我们的 v0.24.1 / v0.24.0 +
   **新增缺失的 v0.23.0 节**(开发线,内容随 v0.24.1 发布)+ main 的 v0.22.1。
   同时修正两处事实错误:① 「0.1.7 线请固定 v0.23.0」→ **v0.22.1**(0.23.0 从未发布);
   ② 安装对照表里 0.1.7 行的安装命令同改。README 并补上 v0.23.0 摘要(含 ⚠️ 删除工作区
   路径检测这一安全相关的行为变更)。
4. docs/external-plugin-guide.md —— 版本行取我们的(0.2.0 线)。

验证(合并后的树):pnpm typecheck / lint / test = **137 文件 / 1491 通过 / 9 跳过**
(含 main 新增的 native-registration.spec.ts);pnpm build ✓;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = **9/9**
(mount 5 + perf 2 + main 的 native-reload 1 + 我们的 zz-expand-refresh 1)。
2026-09-28 23:13:36 +08:00
Menghuan1918 b7825e1bd0 docs(dsh): 记录 profile overrides 必须与宿主同批抬版本的坑(0.2.0 升级实测)
升级 3080 后出现「加载提供商目录失败: settings service is absent」,根因是 profile 的
pnpm-workspace.yaml 里上一轮留下的 overrides '@deepseek-ai/dsh-settings': 0.1.7-rc.2——
它让 profile 顶层留住 0.1.7-rc.2 的 dsh-settings,后者用精确版本拉来 dsh-config-editor
0.1.7-rc.2 并遮蔽 bundle 自带的 0.2.0-rc.1,于是 0.2.0 的启动预检禁用 config-editor 行,
settings 行永远 pending (waiting for service: configEditor)。

已修:override 抬到 0.2.0-rc.1(profile 顶层全部收敛到 0.2.0-rc.1,.pnpm 里 0.1.7 副本归零)。
文档:适配记录新增 §5.1(含原始日志证据),AGENTS §3.0 增加「用户 profile 自己的 pin 也要
同批抬」一条。
2026-09-28 21:38:58 +08:00
Menghuan1918 b91675ae61 feat(dsh): 适配 DSH 0.2.0-rc.1(单线支持)+ v0.24.0
支持线从 ^0.1.7-rc.1 整体前移到 ^0.2.0-rc.1;0.1.7 线(含 npm latest 的
0.1.7-rc.2)停留在 v0.23.0。适配前实测确认这是纯增量,故本版无运行时兼容分支。

必改项(否则装不上/不加载)
- 14 条 DSH peer → ^0.2.0-rc.1。实测 caret 跨 minor 不成立:`^0.1.7-rc.1`
  展开为 >=0.1.7-rc.1 <0.2.0-0,对 0.2.0-rc.1 判定 false(includePrerelease
  也救不了)。判别性验证:把 peer 回退成 ^0.1.7-rc.1 后,在 0.2.0-rc.1 宿主上
  `dsh plugin add` 直接拒绝并回滚包树——
  "installation rejected: Plugin dsh-better-sidebar@0.24.0 is incompatible with
   dsh 0.2.0-rc.1: peerDependencies {…^0.1.7-rc.1…}";恢复 ^0.2.0-rc.1 后安装通过
- 28 个 @deepseek-ai/* devDependencies 精确钉 0.2.0-rc.1(cordis 4.0.4 /
  cordis-plugin-group 1.0.4 / cordis-plugin-include 1.0.9 不变)
- 新增 @deepseek-ai/dsh-util-code-language@0.2.0-rc.1:0.2.0 的 ui-primitives
  产物裸 import 它(0.1.7 的产物同样 import,只是旧树里恰好被传递提供),
  不补则所有加载 ui-primitives 的 20 个 spec 在收集期失败

实测证据(写进 docs/plans/2026-09-28-dsh-0.2.0-rc.1-adaptation.md)
- 本插件消费的 19 个宿主包零值导出删除(对比 export {} / exports.x=)
- 类型面仅 3 处且全为增量:ui-primitives(DisclosureRow/TextShimmer/Tooltip
  新增可选 prop、overlay 顶部内距)、dsh-session(新增 ToolCallRecovery)、
  dsh-api-remotes(新增 product-analytics remote)
- 会话格式仍 v4、SUBAGENT_DESCRIPTOR_VERSION 仍 3、dsh/lib/bin.js 与
  dsh-client-modules 运行时逐字节相同、web profile 客户端 inject 列表相同、
  ui-primitives 裸 import 集合不变、agent-team 四包类型逐字相同
- 宿主 web profile:新增 desktop-only product-analytics/telemetry(web 上
  disabled);time-context/schedule/ui-schedule(本就 disabled)移入可选
  dsh-experimental-schedule-bundle;插件不依赖宿主 schedule

其余同步
- CI 与挂载 lane 钉 @deepseek-ai/dsh@0.2.0-rc.1(scripts/e2e-common.sh 的
  DSH_NPX_SPEC/DSH_EXPECT_VERSION、ci.yml),注释记下「0.2.0 首个候选版只挂
  next」与「caret 跨 minor 必失效」两条教训
- tests/market-manifest.spec.ts 的 peer 形状断言钉当前基线 tuple
- dsh.plugin.json engines.dsh → >=0.2.0-rc.1;SIDEBAR_SERVICE_VERSION → 0.24.0
- README/README_EN、CHANGELOG/CHANGELOG_EN、AGENTS.md(§2 钉版句 + §3 改为
  「DSH 版本适配要点」并新增 §3.0 当前基线,0.1.7 内容降为历史分节)、
  docs/external-plugin-guide.md 全部同步

验证:pnpm peers check 仅剩上游 better-locale 的 5 条 unmet(非本插件 peer);
typecheck / lint / test(136 文件 1484 通过 9 跳过)/ build 全绿;
DSH_CMD='npx -y --package @deepseek-ai/dsh@0.2.0-rc.1 dsh' pnpm test:mount = 7/7;
pnpm test:mount:aggregate 通过(聚合双挂载退让)
2026-09-28 21:21:45 +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 a18e0f000d docs(release): 修正 v0.22.1 条目里的测试计数与「3/3」措辞(独立 review 发现)
- 单测计数:`122 files / 1292 passed / 9 skipped` → **1293**。1292 是 #785 当时的数字,
  本 commit 自己的 `make check` 两次都报 1293(`tests/` 与 main 逐字相同,122 个 spec +
  `it.each` 展开 = 1293)。涉及 CHANGELOG.md / CHANGELOG_EN.md / README.md / README_EN.md
  与事故文档。
- 「3/3 红 / 3/3 绿」措辞改为「连续 3 次运行全红 / 全绿」并注明该 lane 里只有 1 个用例、
  是重复跑三次——原措辞会被读成「3 个用例各红一次」。涉及上述四份发布文档 + 事故文档
  + AGENTS.md §2(同一句话在那边也有)。
- 其余 review 结论均已满足:版本三处锁步 + 两个守护用例绿、无遗留 0.22.0 引用、
  zh/en 段落一一对应、「最近更新」保持两条并把指针下移为 v0.21.1 → v0.12.3、
  release.yml 的 tag 校验与 `latest` dist-tag 都能过、lockfile 无需改动。
2026-09-28 11:30:29 +08:00
ymac aec7101374 feat(native): keep visited tab bodies mounted, and pin state retention end to end
DSH 0.1.7 gives a tab TYPE the `keepMounted` switch: a marked body stays
mounted through hiding, tab selection and Session switches. That is exactly
what the plugin tried to fake with module-level memory, so declare it on
every plugin type (the descriptor types and the `files` takeover) and let
the host hold the component state — tree scroll, unsaved drafts, chip
renames — with no plugin-side memory at all.

With the bodies staying up, the per-session record registry from the
previous commit is what keeps co-resident sessions apart; both halves are
required, because a body may still be remounted by the host (type disposal,
session teardown) and the records must outlive that.

Verification on a real host (`scripts/e2e-mount.sh`: npm pack -> fresh
scratch profile -> real `dsh web` pinned to 0.1.7-rc.1 -> headless Chromium),
new lane `tests/e2e/tree-scroll.e2e.ts`: build state in conversation A,
switch to B, come back, and compare the whole observable vector (tree
expansion, scroll offset, chip title) — plus the negative half, that B does
not inherit A's state.

That lane also exposed a defect in the old one: it picked its "second
conversation" by row index, but the session tree's first row is a WORKSPACE
row and a seeded session with no messages takes no row at all, so the
"A -> B -> A" round trip was re-selecting the same session and every
assertion held vacuously. It now identifies sessions by
`data-row-key="session:<id>"` and creates a real second session through the
rail.

`tests/e2e/mount.e2e.ts` reaches the side-chat tab through its guide entry
now: with the record retained, the chip shows the thread's own title, so
the old `/Side Chat/` chip match no longer names it.

Docs: AGENTS.md records the two facts that must hold together, and
docs/plans/2026-09-25-native-tab-state-retention-keepmounted.md replaces the
park/archive design (PR #712) with this one.
2026-09-28 11:27:50 +08:00
Menghuan1918 233201f7f8 fix(review): 按独立 review 结论修正 PR C 的注释、文档与用例保真度
独立 review(对照 606339f / 4099700 静态复核 + 日志逐行核对)提出的问题,逐条修正:

1. **补回被我自己抹掉的源码注释**:上次验证「未修复代码上 4/4 红」时用了
   `git checkout 606339f -- src/client/native/index.ts`,随后 `git checkout HEAD --
   <同一文件>` 把**尚未提交**的 `disposeSafely` 注释一起还原掉了 —— PR 描述里承诺的
   「说明释放失败为何只走 console.error」因此在 diff 里根本不存在。已重新落盘。
2. **事故文档三处事实修正**:同一毫秒的 `already registered` 是 **7 条**(.339 一条 +
   .340 六条,合计 burst 9 条),不是 6;验证段的「114 files / 1136 passed」是修复分支
   (base 早于 #781)的数字,补上口径并给出合入 main 后的 122/1292;`index.ts:353` 标注
   为 v0.22.0 行号(main 上因 #777 顺移)。
3. **撤回一处措辞过头**:「部分回滚分支从未被执行」→ 回收集合虽然进了、但 disposer
   列表恒为空(释放动作未执行),改后能真正覆盖。
4. **e2e 门不再可能静默通过**:`test.skip(CLIENT_JS === undefined, …)` 改成硬失败——
   这个门的价值就在于 harness 以后不再导出 DSH_HOME 时必须报错而不是变成 skip。
   同时把「无 `[data-sidebar-right-unavailable]`」移到文件渲染断言**之后**(前者在空
   pane 上恒真,不是真空但也没重量)。
5. **测试替身补齐保真度**:假注册表的 disposer 改为幂等(真宿主的 disposer 是幂等的
   ——cordis effect 二次释放返回同一个 task),避免「二次 release 又被记一笔」这种与
   真实宿主不一致的行为被后续用例当成事实。
6. **AGENTS §2 的 HMR 机制加版本限定**:`mtime/ctime/size` 的 sha1 rev 是**钉住的宿主
   0.1.7-rc.1** 的行为;DSH 源码树新版本改成只比 `mtime+size` 并对内容取 sha1,pin 上调
   时该触发器必须同步复核(否则会红在替换断言上,而不是静默失效)。

验证:typecheck / lint 通过;pnpm test 122 files / 1292 passed / 9 skipped(重启前机器上有
两个 scratch dsh 服务时的 fs-watch 超时是负载抖动,单独跑 5/5 绿、清空负载后全量绿)。
2026-09-28 11:09:30 +08:00
Menghuan1918 0b40f74ce8 fix(native): 钉牢 files 接管泄漏的守护断言 + 记录两条不变量
#777 已修掉根因(清理循环跳过 FILES_KIND、注册失败回滚已占用的 id),但它的两处
断言写在「活着的 id 集合」上——泄漏的 id 恰好构成同一个集合,未修复代码上同样
通过;且槽位失败判据按 key 命中,而一个描述符的两个槽共用一个 key,所以
registerSlots 的「部分回滚」分支从未被执行。

- tests/native-registration.spec.ts:断言改写到注册表的事件日志(孤儿 id 会让键
  集合看起来完全正常);槽位失败判据改为 name::key,从而可以只让某个描述符的
  第二个槽失败、真正走到部分回滚;补 reportFailure 的 phase 断言。实测:在
  v0.22.0 源码上 4/4 红,在修复后的源码上 4/4 绿。
- src/client/native/index.ts:给 disposeSafely 补注释,说明释放失败只写
  console.error、不弹诊断条的理由(两个调用点都在 teardown 路径上;真被占住的
  id 会在下一次注册尝试里经 reportFailure 显式报出)。
- AGENTS.md:§3.4 第 9 条补上这两条不变量(含真机日志实证的链接),§6 把
  native-registration.spec.ts 纳入关键测试守护。
- docs/plans/2026-09-28-native-files-takeover-reload-leak.md:事故/证据/否决方案
  记录(含「吸收」方案为何被否)。

验证:pnpm typecheck / pnpm lint 通过;pnpm test 122 files / 1292 passed / 9 skipped。
2026-09-28 10:57:10 +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 d8bc6566df feat(tasks): 适配 DSH 0.1.7 的 Agent Teams(读 projection + 写路由对接真实服务)
团队功能在 0.1.7 上整条失效:team-routes.ts 当初镜像的是 0.1.6 的 Remote 词汇
(remoteView / remoteCreateTask / remoteUpdateTask),而 0.1.7 把这三个方法删掉了,
读路径改到 Lead Session 的 `agentTeam` Session projection。真机 3080 复现:
teams.view 对带团队的会话返回 400 "membership.svc.remoteView is not a function",
于是 TeamBoard 从不渲染、节点富化与任务窗连带失效。

- 读:删掉 teams.view 与 5s 轮询,改读 SessionListState.projectionsBySession[root]
  .values.agentTeam(与 subagentCatalog 同源,推送式);新增 client/team-projection.ts
  做纯适配器,成员运行状态由 subagents.live 的 running 叠加、Lead 回退 session list
  (官方 README 的 "overlays activity from Session status")。projection 缺席 =
  这里没有团队,与旧的 {available:false}/{team:null} 合并成同一静默降级。
- 写:taskCreate/taskUpdate 改调 0.1.7 的 createTask/updateTask(返回已提交的 view,
  拒绝改为抛 TeamError),TEAM_TASK_STALE_REVISION → 409 team-conflict,其余 → 400
  team-error(wire 新增 team-conflict)。api.ts 的 writeTask 把失败信封还原成
  {ok:false,code,message} —— 原先窗口永远走不到该分支(readEnvelope 是抛)。
- 任务窗:外壳换成上一轮的 FloatingWindow(可拖拽/可拉伸/只在关闭或 Esc 时消失),
  动作行下沉到 shell 的 footer,长描述不再把动作推出视野。
- 真机抓到的两个单测抓不到的问题:
  1. 队列中任务的「完成」被宿主状态机拒绝(pending → claim → in_progress →
     complete → completed → reopen)→ 动作行跟随状态,pending 出「认领」;
  2. 认领后 Tag 变「阻塞」—— ready 的语义只是「pending 且无未完成 blocker」,
     对所有非 pending 任务都是 false → 抽出唯一规则 taskBlocked/taskStatusLabel/
     taskTone/taskDotState,四处展示点全部改走它。
- i18n:新增 teamTaskClaim / taskWindowCreate / taskWindowDetail /
  tasksStateProvisioning 词条 ×20 词典。

验证:typecheck / lint 通过;pnpm test 1276 passed / 9 skipped;
pnpm test:mount 7/7(真实 DSH 0.1.7-rc.2 挂载 + tab 全扫无崩溃)。
真机 3080(0.1.7-rc.1 + Agent Teams 实验层):看板从 projection 渲染、
队列任务「认领」→「完成」全链路写通(负责人 lead / 进行中 / 已完成)、
外部点击不关窗、Escape 关窗,截图见 docs/plans/2026-09-27-agent-teams-dsh-0.1.7-adaptation.md。

(cherry picked from commit dbc524e0b350c5d3564843f4776cd15d797506d8)
2026-09-27 22:19:05 +08:00
Menghuan1918 421fd3fde7 fix(tasks): 小条的状态词与活动行统一字体(修掉 1px 基线错位)
用户反馈「运行中和正在分析请求没对齐」。实测是字体度量差异,不是布局:
两者行盒完全一致(11px/14px、align-items: center 下同一位置),但 11px 下
sans 字族的 fontBoundingBox ascent/descent 是 11/2,mono 字族是 10/3 ——
基线低 1px。中文在 mono 栈里本来就走同一个 CJK 回退(PingFang SC),
mono 只改到句中的拉丁片段,等于半句等宽 + 整体低一像素。

修法:.barActivity 不再声明 font-family,两段文字共用小条自己的字族;
机器文本的等宽语气保留在 meta 行 / 后台任务行 / 终端输出井。
theme.spec 新增守护(.barActivity 不得声明 font-family)。

真机证据:真实运行中卡片的小条(3× DPR 截图 17-bar-real.png)两段同处一行,
两个 span 的 font-family 计算值完全相同;此前同一小条 3× 截图里蓝字明显偏低。

验证:typecheck / lint ✅;pnpm test 1257 passed / 9 skipped(新增 1 例)。

(cherry picked from commit 6816af76828a436eaf201205e385c1aa4f77dcd5)
2026-09-27 22:18:57 +08:00
Menghuan1918 7cce50c493 fix(tasks): 扫光改为整条完整扫过 + 折叠/展开按钮分向
用户反馈两条:

1) 扫光只有「部分」:第一版是 45% 宽的窄带 + background-position 位移,
   亮带始终只覆盖小条的一部分(峰值 22.5%→77.5%,两端扫不到),看起来像
   中间游走的一块光斑。改为与小条等宽的渐变带 + transform
   translateX(-100%) → translateX(100%):光带从左外侧进入、中途覆盖整条、
   再向右外侧离开,行程用条宽本身表达(任意条宽成立),末 1/3 周期停在
   右侧外侧留白。theme.spec 新增守护钉住该形状(宽度 100%、transform 行程、
   不再有 background-position/size 位移)。

2) 折叠按钮与展开按钮长得一样:三处控件原本共用向下箭头(控制条的折叠开关
   更是无论折叠还是展开都画同一个清单图标)。现按动作方向区分——
   卡片小条的逐节点按钮 = chevron up(收进聚合),聚合卡片 = chevron down
   (展开),控制条开关随状态在两者之间切换(并复用同一个折叠图标)。
   组件守护见 tasks-page.spec 的「draws COLLAPSE and EXPAND with different
   glyphs」。

真机证据(3080,真实运行中的后台任务):242px 小条上每 90ms 采样 ::after 的
matrix 平移量得到 [-23,32,85,131,163,-139,-94,-46,9,64,114,152,179,188]
(左侧 -139 → 右侧 +188,跨度超过一个条宽,单调推进);三处 svg 比对
expandVsCollapse / clusterMatchesExpand / clusterFlips / clusterCollapseMatchesCard
全部为 true。

验证:typecheck / lint ✅;pnpm test 1256 passed / 9 skipped(新增 2 例)。

(cherry picked from commit 0bb8228e6a7acb4302d9a8a9881d2df04a285152)
2026-09-27 22:18:57 +08:00
Menghuan1918 d38fefe55d feat(tasks): 任务输出常驻浮动窗 + 节点卡去竖线 + 手机设置
三件事一起落地(用户 brief),各自独立可验证:

1) 后台任务输出改为常驻浮动窗
   - 新增 src/client/FloatingWindow.tsx + .module.css:可复用组件,标题栏(拖拽手柄 +
     复制/关闭)、内容区(自滚动,长输出不再跑出视口)、可选底部行、三个拉伸柄
     (右/下/右下)。生命周期与 AnchoredPopover 相反:外部点击、失焦、锚点离屏都不关,
     只有关闭按钮与 Escape 结束;尺寸只在挂载时量一次(流式输出帧不会挪动读者摆好的窗);
     拖拽保持整窗在视口内(放不下才退化到保留 48px 可达);视口变化时夹回。
   - 手势复用既有范式:移动走 window 级 pointermove(同 AnchoredPopover),拉伸走
     setPointerCapture + createFrameBatcher(同 EditorHost 的面板拉伸)。
   - JobOutputPopoverContent → JobOutputWindow;顺带修掉「跟随最新」从不滚动的 bug
     (原先滚的是 TerminalBlock 外面那个永不滚动的 div),并清掉随旧弹窗死掉的
     .popPre / .jobPopPre 规则。节点/工作流详情与任务窗保持原样。

2) 节点卡统一
   - 删除两条左侧竖条(层级条 .cardTop::before、当前会话条 .nodeCurrent::before);
     层级改由上段极淡底色承担(7/5/3.5/2.5% → 9/7/5/3.5% 补偿对比度);
     当前会话改为 2px accent 描边(「边框加粗高亮」)。
   - 圆角 4px → 8px(与浮动窗同一家族);成员/工作流/聚合按用户选择保留类型区分。
   - 2px 而非 1.5px:真机 recon 发现 Chromium 在 DPR 1 下把亚像素边框向下取整,
     1.5px 的「加粗」完全看不出(实测 borderTopWidth: "1px")。几何不受影响
     (border-box + min-height,卡片外框 247×134 与预算逐像素一致)。

3) 手机设置
   - 两个新偏好 mobileNoAutoOpen / mobileDefaultTree(默认都开),落到 prefs-shared、
     PrefsSchema(volatile 自动)、parsePrefs 校验与设置页新增的「手机」分组。
   - 窄屏(沿用 768px 断点)时:新子代理与新后台任务都不再自动激活任务页;
     任务页默认树状图(页内切换仍是临时覆盖)。宽屏或开关关掉后行为完全不变。
   - 5 条词条 ×20 份词典;外部插件指南的 PrefsSchema 键清单同步。

验证:typecheck / lint ✅;pnpm test 1254 passed / 9 skipped(新增 14 例);
挂载 lane 7/7(真实 DSH 0.1.7-rc.2);3080 真机自测通过(长输出窗口内部滚动
5459px/449px、拖拽 424→304、拉伸 1008×540→918×480、外部点击不关、Escape 关、
卡片 8px/2px/无竖条、窄屏不自动弹出且默认树状图)。

(cherry picked from commit 7d9b428c6c34d28ad2d60c2086496eb533902273)
2026-09-27 22:18:57 +08:00
Menghuan1918 5ea2f2d6ec docs(tasks): 工作图打磨的设计文档与真机验证证据;卡片细节两处修正
- 新增 docs/plans/2026-09-27-tasks-graph-polish.md:本轮问答结论、架构与文件、
  关键设计(卡片两段 / 合并活动 / 扫光 / 折叠聚合 / ctx.jobs / 布局与窄栏)、
  移植与丢弃清单、实施偏差记录、验证证据(含 3080 真机逐项目击记录与截图路径)、
  未在真机复现的两项与已知取舍。
- 2026-09-14 图分支设计文档加「本轮打磨」小节指向新文档;README 任务页条目
  与 AGENTS §1/§3.1#4 同步(后台任务改读宿主客户端 ctx.jobs,不再自建回放路由)。
- 卡片两处修正(真机截图暴露):
  ① 小条的钩子从 `data-state` 改为 `data-card-bar` —— 宿主自己的 primitive 也在
     发 `data-state`(菜单分隔、编辑器等),同名属性让「卡片内恰好一条小条」的
     断言与用户 CSS 都不可靠;
  ② 上段的 mono 行改由新的 `agentIdentity()` 产出(只讲「是谁」),根节点返回空
     —— 原先复用 `agentMeta()` 会把状态词印两遍(徽章下方 + 小条),正是用户
     反馈的「节点内信息太密」。可访问名继续用含状态的 `agentMeta()`。

验证:typecheck / lint 通过;pnpm test 1240 passed / 9 skipped;
挂载 lane 7/7(真实 DSH 0.1.7-rc.2);3080 真机自测通过(见文档表格)。

(cherry picked from commit 338a54820799c26ab91141e8d98c673b8d474610)
2026-09-27 22:18:49 +08:00
Menghuan1918 b554665bde feat(tasks-ui): readability pass, height-budget fix and leftover sweep
The native port is finished off with the readability work the earlier rounds
left open, plus the cleanup of everything the shadcn era or the older canvas
left behind.

- Geometry: node height is now composed from named parts (chrome, two title
  lines, meta row) and per-node extras, so a teammate card that carries a task
  line no longer gets clipped by the old fixed 68px budget; the layout spec
  follows the new model and GRAPH_ROW_STRIDE stays exported for it.
- Readability: row rhythm (28-32px), three ink levels for title/meta/owner,
  truncation with title hints, current-row and hover expressed as an accent bar
  plus a hover fill (no shadows), phase frames and edges back on the l1/l2
  hairlines, control cluster uniformly 28px, drawer durations on tabular
  figures, kill action revealed on hover/focus without shifting the row, no
  horizontal overflow at 360px.
- Task window: the markdown body is pulled onto the page scale (12px body,
  12/13px headings, tightened list indent and paragraph spacing) while the
  shared MarkdownText/markdownTextProps contract is untouched.
- Cleanup: dead stylesheet rules, unused TSX exports and helpers, stale
  comments that still described the retired Variant-D canvas, zero-reference
  i18n keys across the dictionaries, and the Tailwind/shadcn/Variant-D
  narrative in the design doc, AGENTS.md and the plugin guide (kept as one
  short "why it was rolled back" section).

Verified here: typecheck and lint clean; 133 files / 1413 tests; build with no
radix-ui or --tw- strings in lib/client.js (988.9 KiB); the 70-assertion
real-browser contract at 70/70 with the 20 reference screenshots regenerated;
mount e2e 7/7.
2026-09-27 22:18:19 +08:00
Menghuan1918 a71d158f9a revert(tasks-ui): drop the shadcn/Tailwind layer and return to the plugin's own UI system
shadcn's defaults are built for a standalone app: 14px body, 36px controls,
solid primary fills and elevation read as a foreign surface next to this
plugin's own tabs (files, changes, side chat, settings), which are 12/11/10px
type, 28px controls, hairline borders and flat panels. Retuning the layer did
not converge, so the layer goes.

- Removed: src/client/ui/** (21 vendored components), components.json,
  scripts/ui-css.mjs, the Tailwind/PostCSS compile step in tsdown, and the deps
  tailwindcss / @tailwindcss/postcss / postcss / radix-ui /
  class-variance-authority / tailwind-merge. (diff and simple-icons stay: they
  patch undeclared bare imports of the host primitives, unrelated to shadcn.)
- The seven page surfaces are back on the plugin's own base: *.module.css with
  --dsw-* tokens plus the host primitives (Button/Menu/Modal/Pill/Tag/Switch/
  Input/Tooltip/StateDot/MarkdownText). Behaviour, data-* hooks, aria labels,
  i18n keys and the AnchoredPopover geometry/drag/dismiss contract are
  unchanged; the non-styling fixes landed during the shadcn era (model id
  dedupe, task-window CAS, drawer arming, popover dragging, the chunk packaging
  glob) were re-applied and are covered by the existing specs.
- The tasks page returns to the core bundle: `tasks` left CHUNK_NAMES /
  CHUNKS / ChunkName, src/client/chunks/tasks.tsx is gone and tabs.tsx imports
  SubagentView directly.
- The reverted stylesheet was retuned to the plugin's measured vocabulary
  (12/11/10px, 28px controls, border-l2 with border-l1 hairlines, hover fills,
  no static shadows, --dsw-shadow-lv2/3 on floating layers only) and verified
  against a 70-assertion real-browser contract; the harness's own two
  measurement defects were fixed with a falsification test proving the
  assertions still catch injected regressions (56/70, 14 FAIL).
- Tests: ui-foundation / ui-bundle / ui-shadows (the shadcn guards) deleted,
  theme.spec scoped back to the plugin's own stylesheets, bundle-route and
  manifest-consistency chunk lists back to four. Docs: AGENTS.md and the plugin
  guide drop the Tailwind/shadcn guidance; the design doc marks those sections
  superseded and records why the layer was removed.

Verified: typecheck/lint clean; 133 files / 1410 tests; core bundle 987.3 KiB
with no radix-ui/--tw-/tailwind strings and no client-tasks.js; mount e2e 7/7;
20 real-browser screenshots at 360/720 for graph, tree, board, task window,
drawer (including armed), both popovers and the 77-node fixture.
2026-09-27 22:18:19 +08:00
Menghuan1918 5deb5285da refactor(tasks-ui): align the page with the latest shadcn/ui defaults
The previous round kept a hand-trimmed, shadow-less, 11-13px variant of the
component set. This replaces it with the registry's own defaults and the
registry's own composition primitives, keeping only the adaptations this host
actually requires.

Registry refresh (npx shadcn@latest add --overwrite): the whole vendored set is
back to upstream sources, plus label, field, input-group, item and button-group.
Re-applied adaptations (documented in the design doc):
- cn from ./utils and explicit ./x.tsx specifiers (the registry writes virtual
  aliases this repo has no resolver for);
- host IconXxx instead of lucide (skin contract);
- no dark: variants (the DSH tokens already flip) and no palette literals;
- React.forwardRef on Button (the host is React 18, so radix Slot needs it);
- tw-animate-css animation utilities stripped: installing that dependency would
  inject generic keyframes into a page we do not own.
Restored to stock: the full Button variant/size set, shadow-xs on outline,
transition-all, badge ghost/link.

Recomposition on the newest primitives (per-file, verified here):
- board: full Card composition, Item rows, ToggleGroup filter, dropdown items
  grouped, Empty for the empty state;
- task window: Card composition, FieldGroup/Field with data-invalid validation,
  ToggleGroup owner (default variant: the outline variant's hover and pressed
  states measured identically, hiding the selection), destructive-armed delete,
  FieldError for conflicts;
- popovers: both portal cards use the same Card composition, rows are Item;
- drawer/header: Item rows with ItemActions, Separator bands, Spinner, Empty;
- graph/tree: stock node recipe, outline buttons, cn() for conditional classes.

Two no-preflight traps found by rendering, not by types:
- stock Empty ships border-dashed without a width, so the UA's 3px medium dashed
  frame wrapped the whole page: border-0 on that Empty;
- <Spinner size={12}/> stayed type-clean after the refresh (size is a valid span
  attribute) while the glyph silently rendered at size-4: className="size-3".

Verified: typecheck/lint clean; 136 files / 1515 tests; build with the core and
chunk bundle guards (core 836.3 KiB, chunk 734.7 KiB); mount e2e 7/7; and the
real-host-stylesheet mirror page re-shot for graph, tree, board, task window and
the 77-node stress fixture at 360 and 720.
2026-09-27 22:18:19 +08:00
Menghuan1918 d1a9d520ae fix(tasks-ui): restore the scoped preflight subset and return the page to stock shadcn
Real-device report: the Tasks page "looks like it has no CSS at all, with
blurry borders". Two hypotheses were falsified before the real cause surfaced:
the sheet IS delivered (the chunk carries both the CSS and its injector, and
the bundle route serves it) and the cascade is NOT the problem (with the real
host stylesheet plus the real compiled sheet, a controlled sample keeps our
padding, radius, border, background and font; host CSS-module selectors only
match host nodes, and its global element rules are element-level specificity).

The cause is what we deliberately excluded: PREFLIGHT is also what normalizes
form controls. Measured on a plugin icon button that sets only an icon size,
the UA chrome survived as padding 1px 6px, border 2px outset, background
ButtonFace (#efefef) and a 13.33px system font - gray beveled buttons with a
soft double border, i.e. "no CSS".

- ui/theme.css: a .dsw-tasks-scoped preflight subset (zero margins/padding,
  border width+style, background, appearance none, inherit color/spacing,
  cursor rules) inside @layer base, written with :where() so it stays at
  (0,1,0) and utilities in the later layer still win; plus an explicit
  "@layer theme, base, components, utilities;" statement - layer order follows
  first appearance, and without it the utilities import registered utilities
  BEFORE base, so the reset beat rounded-md (measured: square buttons). The
  built chunk's order was re-checked: properties, theme, base, components,
  utilities.
- Stock shadcn restyle: static cards carry stock shadow-xs/shadow-sm again
  (floating layers keep shadow-lg), body/meta text is text-sm/text-xs instead
  of 11-13px, status uses stock Badge variants, controls use stock Button
  variants and sizes, row actions appear on hover/focus while staying keyboard
  reachable, node cards are 176x68 with shadow-xs.
- bandColsFor budgets columns at the readability floor (width / 0.78) instead
  of 1:1, so a 360px panel keeps two columns; FIT_MIN_SCALE moved into the
  layout module as GRAPH_FIT_MIN_SCALE so the fit and the column budget share
  one constant.
- Guards: tests/ui-foundation.spec.ts pins the scoped reset declarations and
  the layer-order statement; tests/ui-shadows.spec.ts now allows shadow-xs and
  shadow-sm on static panels and bans md and above; the theme guard's inert
  paint rule forced the reset to spell border-width/border-style instead of the
  "border: 0 solid" shorthand.

Verified: typecheck and lint clean; 136 files / 1505 tests; build with the
core/chunk bundle guards; mount e2e 7/7 (mount 444ms, longtasks 2 of 8); the
visual mirror page (real host stylesheet + real components) re-shot at 360 and
720 for graph, tree and the 77-node stress fixture.
2026-09-27 22:18:19 +08:00
Menghuan1918 e94da2d4e4 fix(ci): keep the mount lane on 0.1.5-rc.2 (alpha.2 pin fails on unmodified main)
Pinning the lane to 0.1.6-alpha.2 makes plugin-mount fail deterministically:
the shell boots into the new-session empty state, no session scope reaches the
sidebar, and [data-dsh-better-sidebar] [title] never attaches
(mount.e2e.ts:216 plus perf.e2e.ts:182). Falsified against this branch with a
probe: origin/main + that one-line pin, run 35484961070, same red, zero plugin
changes involved.

So the dev tree keeps alpha.2 (the line the maintainer's desktop runs) while
the lane stays on the released pin; the evidence and the follow-up (teach the
lane to activate the seeded session on the alpha line) are recorded in
AGENTS.md §2/§3 and docs/plans/2026-09-17-dsh-0.1.6-alpha.2-adaptation.md.
2026-09-27 22:18:19 +08:00
Menghuan1918 221e955c6b fix(sidechat): keep the rc line's reconnect label via a documented shim
0.1.6-alpha.2 removed ConnectionIndicator's reconnectLabel, but the peer range
(^0.1.5-rc.1) still covers the rc line, where the prop is REQUIRED and renders
the retry button's hover/focus action text. Widening the component type once
keeps both lines correct: rc renders the label, alpha.2 ignores the extra key.
The shim carries a comment naming the condition for deleting it.
2026-09-27 22:18:19 +08:00
Menghuan1918 3e4da566d8 chore(deps): pin devDeps/CI to DSH 0.1.6-alpha.2 (peer range unchanged)
The maintainer's desktop already runs the 0.1.6-alpha line while the plugin
pinned 0.1.5-rc.2 (latest/next still point there). The peer range stays
^0.1.5-rc.1, so rc.1/rc.2 users are unaffected.

Upstream delta that actually touches this plugin (primitives .d.ts diff plus a
full scan of bare imports in its lib/**/*.js):

- IconSendOutline16 was removed (the only icon drop) -> IconSendOutline14.
- TerminalBlockLabels gained a REQUIRED noExitCode label -> new
  sideChatBlockNoExitCode copy across all 20 dictionaries.
- ConnectionIndicator dropped reconnectLabel -> prop removed.
- Menu/Modal changed only in docs/keyboard semantics; new exports
  (Checkbox/isDarwinDesktop/MarkdownDelegateProvider) are additive.
- dsh-tools no longer peers on dsh-code-runtime, and that package was never
  published at alpha.2 -> its devDependencies hoist is removed instead of
  mixing an rc.2 package into an alpha.2 tree.
- the primitives bundle still declares zero dependencies but now bare-imports
  'diff' (DiffBlock) and 'simple-icons' -> hoisted as diff@^9.0.0 (matching the
  host) and simple-icons@^15.0.0; missing them failed six jsdom suites at
  vite's import-analysis stage.

Verified: pnpm install + peers check clean; typecheck/lint 0; 136 files /
1503 tests; build green with the core/chunk bundle guards; mount e2e 7/7 on
0.1.6-alpha.2 (longtasks 2/8, and /sidebar/bundle/tasks.js really downloads).

Also recorded: origin/main is an ancestor of this branch (nothing to rebase in
git terms), and README's published-version wording is left to release time.
2026-09-27 22:18:19 +08:00