dsh-config-sync-plugin 0.3.84 → 0.3.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.en.md CHANGED
@@ -19,7 +19,7 @@ The package name is **`dsh-config-sync-plugin`** (the `dsh-config-sync` name on
19
19
 
20
20
  | Way | Command / entry | Notes |
21
21
  |---|---|---|
22
- | npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.82"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
22
+ | npm | `npm i dsh-config-sync-plugin` | Use it as a dependency, or add `"dsh-config-sync-plugin": "^0.3.86"` to the profile's `package.json` and run `pnpm i`. The name matches the `cordis.patch.yml` insert name and the install folder `dsh-config-sync-plugin-<ver>` |
23
23
  | Marketplace | client → Plugins → Discover → “Config Sync” | Installs from the git commit registered in `market-index.json` |
24
24
  | Offline tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release asset for air-gapped machines; the panel's Update button downloads the same file |
25
25
 
@@ -239,7 +239,7 @@ Each workspace switches between the three states independently; expanding it let
239
239
  Five interaction refinements on top of the 0.3.76 "Workspace visibility" card:
240
240
 
241
241
  1. **Session names**: each expanded session shows a readable title (from the `session/title` event, falling back to the first user message text); hover for the full session ID. Titles are cached and rebuilt from the local logs on each machine.
242
- 2. **Edit button**: the state dropdown and per-session Hide/Show buttons stay hidden until you click Edit on that workspace; click Done to leave edit mode, so states cannot be changed by accident.
242
+ 2. **Edit button**: the state dropdown and per-session Hide/Show buttons stay hidden until you click Edit on that workspace; click Done to leave edit mode, so states cannot be changed by accident. (From 0.3.84 there is a single Edit button for the whole card — see below.)
243
243
  3. **Click to expand**: click anywhere on a workspace row to expand/collapse its sessions; no separate expand button.
244
244
  4. **Card position**: the Workspace visibility card moved just above Feedback, as the last configuration step.
245
245
  5. **Sticky title + quick jump**: the panel title bar is sticky, with shortcut tabs below it (Overview / Workspaces / Targets / Automation / Scripts / Restore / Content / Plugin data / Feedback); clicking one smoothly scrolls to that section.
@@ -253,6 +253,31 @@ Two display fixes on top of 0.3.77:
253
253
  1. **Jump order matches section order**: the quick-jump tabs now follow the exact render order of the sections (Overview / Sync conflicts [when present] / Local paths [when expanded] / Targets / Automation & updates / Scripts / Restore / Content / Plugin data / Workspace visibility / Feedback). The two conditional sections (conflicts, local paths) appear in the tabs only when their cards are shown.
254
254
  2. **Scroll lands below the title**: the sticky title bar now uses an opaque background (same fill as panel cards), so content no longer shows through it; jumping to a tab sets the scroll offset from the title bar's actual height, so the target section lands fully below the title instead of being covered.
255
255
 
256
+ ### Local data moved into To-do, grouped by sync content, sessions shown by name (0.3.86)
257
+
258
+ The "Local data" row in the "Local repo" card moved into "Overview → To-do", with its presentation reorganised:
259
+
260
+ 1. **Location**: the old "Local data" line at the bottom of the "Local repo" card is gone. The To-do card now shows even when nothing else is wrong — it starts with local data (last sync time / pending count / mode) and then the existing to-do suggestions. "How much is still unsynced" and "what to do about it" sit together.
261
+ 2. **Grouped by sync content**: pending files are counted by the same twelve groups as "Sync content" — Conversations / Skills / Plugin data / Memory data / Local profile / Global prompts / Agent presets / Plugin settings & workflows / Workspace files / Extra paths, etc. Each group is a chip with a count, sorted by count descending; no more bare single total.
262
+ 3. **Sessions shown by name**: in the "Recently changed" sample, session files show the projected session title (matching the DSH panel, e.g. "列出工作区下的文件夹") instead of a `session-xxx/session.v4.jsonl.zstd` directory id; non-session items with no title still show their parent directory / file name.
263
+
264
+ ### Workspace visibility card: one Edit button for the whole card, sessions paired with their toggles (0.3.84 / 0.3.85)
265
+
266
+ The edit interaction of the "Workspace visibility" card was rebuilt:
267
+
268
+ 1. **A single Edit button for the entire card** (0.3.84): previously every workspace row carried its own Edit/Done button, and once there were several rows the buttons no longer lined up with the sessions. Now there is one button on the right of the header row — "Edit" when idle, switching to "Done" (primary colour, same position) once you are editing — and it unlocks every workspace tri-state plus every session toggle at once; clicking again leaves edit mode. The per-row button is gone.
269
+ 2. **Session/button pairing made concrete** (0.3.84): each session gets its own row with a divider between rows; in edit mode the whole row gets a background and rounded corners, framing "this session" together with "its button". The toggle sits at the end of that row with a fixed width, so a wrap never puts it next to a different session. The word and colour distinguish Hide (red) from Show (green), the `title` carries the session name, and hidden sessions get a struck-through, dimmed name (the separate "Hidden" label was dropped).
270
+ 3. **No tinted explanation banner** (0.3.85): edit mode no longer inserts a yellow-bordered hint row above the list; whether you are editing is read from the header button alone.
271
+
272
+ ### Workspace visibility card: blank sessions and idle-review parents are collapsed too (0.3.83)
273
+
274
+ On top of 0.3.82's "collapse agent child sessions by default", two more kinds of noise are folded away:
275
+
276
+ 1. **Blank sessions**: entries that were created but never used — no message, no turn (empty `origin` in the session header, and the log only holds permission / sandbox / approval / session-end-seed events, no `turn/start` and no `user/message`).
277
+ 2. **Mnemon idle-review parents**: `mnemon-review-owner-v1-*`, which carry only a `subagent/catalog` event — the actual content lives in the `mnemon-review-v1-*` child session they point at.
278
+
279
+ Both naturally satisfy the same "blank" test, so one rule folds them away; no name matching is needed. A "Show blank" checkbox in the header row brings them back, and the footer reports how many blank and how many agent sessions were collapsed. On this machine the default view drops from 99 entries to 10.
280
+
256
281
  ### Workspace visibility card: agent sessions collapsed by default + instant hide/show (0.3.82)
257
282
 
258
283
  Two changes to the "Workspace visibility" card:
@@ -652,6 +677,10 @@ The log shows which path ran: `文件比较(快筛):比对 N 个,深哈
652
677
 
653
678
  | Date | Version | Summary |
654
679
  |---|---|---|
680
+ | 2026-11-23 | 0.3.86 | Moved "Local data" into Overview / To-do, grouped pending files by the twelve sync-content groups, and show session names instead of session ids in the sample |
681
+ | 2026-11-23 | 0.3.85 | Removed the tinted banner above the workspace list in edit mode; edit state is read from the Edit/Done button in the header |
682
+ | 2026-11-23 | 0.3.84 | Workspace visibility card uses one Edit button for the whole card; each session row carries its own toggle with a background and divider, hidden names struck through |
683
+ | 2026-11-23 | 0.3.83 | Workspace visibility card also collapses blank sessions and Mnemon idle-review parents; default view on this machine 99 → 10 |
655
684
  | 2026-11-23 | 0.3.82 | Workspace visibility card collapses agent sessions by default; hide/show goes through workspaceRegistry and applies instantly (no restart) |
656
685
  | 2026-11-21 | 0.3.75 | Sync hidden/archived workspaces across machines (workspace-archives.v1.json into settings); hidden workspaces and sessions stay hidden on B after pull |
657
686
  | 2026-11-19 | 0.3.69 | Carry billion-context compaction state across machines (bili-state.mjs); two new notice kinds (plugin-missing / context-state) |
package/README.md CHANGED
@@ -15,7 +15,7 @@ DSH 插件:左侧栏多一行「配置同步」,点开是整页体检面板
15
15
 
16
16
  | 方式 | 命令 / 入口 | 说明 |
17
17
  |---|---|---|
18
- | npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.82"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
18
+ | npm | `npm i dsh-config-sync-plugin` | 适合把它当依赖管理,或在 profile 的 `package.json` 里写 `"dsh-config-sync-plugin": "^0.3.86"` 后 `pnpm i`;包名与 `cordis.patch.yml` 里注册的名字、插件目录 `dsh-config-sync-plugin-<ver>` 一致 |
19
19
  | 插件市场 | 客户端「插件市场 → 发现」搜「配置同步」 | 走 `market-index.json` 登记的 git 提交,版本与 README 对齐 |
20
20
  | 离线 tgz | `releases\dsh-config-sync-plugin-<ver>.tgz` | GitHub Release 附件,适合内网机器;面板「更新」按钮下载的也是它 |
21
21
 
@@ -259,7 +259,7 @@ pwsh -File runtime\sync.ps1 pull `
259
259
  在 0.3.76「工作区显示」卡片之上做了五点交互调整:
260
260
 
261
261
  1. **会话名称**:工作区展开后每条会话显示可读标题(从 `session/title` 事件提取,取不到时回退到首条用户消息文本),鼠标悬停可看完整会话 ID;标题提取带缓存,换机器后按新机器日志重建。
262
- 2. **修改按钮**:三态下拉与会话的「隐藏 / 显示」按钮默认不出现,点该工作区的「修改」才进入编辑态,点「完成」退出,避免误改。
262
+ 2. **修改按钮**:三态下拉与会话的「隐藏 / 显示」按钮默认不出现,点该工作区的「修改」才进入编辑态,点「完成」退出,避免误改。(0.3.84 起改为**整卡一个**「修改」按钮,见下文。)
263
263
  3. **点行展开**:点工作区整行即可展开 / 收起会话,不再单独点展开按钮。
264
264
  4. **卡片位置**:工作区显示卡片移到「问题反馈」前,作为配置调整的最后一步。
265
265
  5. **固定标题 + 快速跳转**:面板标题栏吸顶;标题下方增加快捷标签(概览 / 工作区显示 / 同步目标 / 自动化 / 生成脚本 / 还原备份 / 同步内容 / 插件数据 / 问题反馈),点击平滑滚动到对应分区。
@@ -273,6 +273,31 @@ pwsh -File runtime\sync.ps1 pull `
273
273
  1. **跳转顺序对齐卡片**:快捷标签顺序改为与分区实际渲染顺序完全一致(概览 / 同步冲突[有冲突时] / 本机路径[展开时] / 同步目标 / 自动化与插件更新 / 生成脚本 / 还原备份 / 同步内容 / 插件数据 / 工作区显示 / 问题反馈)。同步冲突、本机路径两个条件分区只在卡片存在时才出现在标签里。
274
274
  2. **滚动落点在标题下方**:标题栏改为不透明背景(面板卡片同色),滚动时内容不再从标题背后透出;点标签跳转时按标题栏实际高度设置滚动落点,目标分区完整显示在标题下方,不再被遮住。
275
275
 
276
+ ### 本机数据挪进待办 + 按同步内容分组 + 会话显示会话名(0.3.86)
277
+
278
+ 把「本机仓库」卡里的「本机数据」行移到了「概览 → 待办」,并重新组织它的呈现:
279
+
280
+ 1. **位置**:原先「本机仓库」卡底部那行「本机数据」删掉;现在待办卡在无其它异常时也照样出现,顶部先显示本机数据(上次同步时间 / 待推送数 / 模式),下面才是原来的待办建议。这样「本机还有多少没推」和「该做什么」在同一处看。
281
+ 2. **按同步内容分组**:待推送文件按「同步内容」那套 12 组口径归类统计 —— 会话记录 / Skills / 插件数据 / 记忆数据 / 本机 profile / 全局提示 / Agent 预设 / 插件设置 / 工作区资料 / 额外路径 等,每组一个 chip 显示条数,按数量从多到少排;不再只报一个总数。
282
+ 3. **会话显示会话名**:待办里「最近写入」的样本,会话文件显示投影缓存里的会话标题(和 DSH 面板一致,如「列出工作区下的文件夹」),不再是 `session-xxx/session.v4.jsonl.zstd` 这种目录 ID;取不到标题的非会话项仍显示父目录/文件名。
283
+
284
+ ### 工作区显示卡片:整卡一个「修改」按钮,会话与开关一一对应(0.3.84 / 0.3.85)
285
+
286
+ 「工作区显示」卡片的编辑交互重做:
287
+
288
+ 1. **整张卡片只有一个「修改」按钮**(0.3.84):以前每个工作区行各带一个「修改 / 完成」,按钮一多就和会话对不上。现在标题行右侧只有一个按钮 —— 非编辑态是「修改」,点进去变成「完成」(主色高亮,位置不动),所有工作区的三态下拉和所有会话的显隐开关一起解锁,再点一次统一退出。行内那个按钮已删除。
289
+ 2. **会话与按钮的对应关系做实**(0.3.84):每条会话独占一行,行间加分隔线;编辑态下整行加底色 + 圆角,把「这一行会话」和「这一行按钮」框在一起。开关贴在该行最右侧且等宽,换行也不会漂到别的会话旁边。按钮文案与颜色区分「隐藏」(红)/「显示」(绿),`title` 里带会话名,隐藏的会话名加删除线并变灰(原来那个单独的「已隐藏」小字去掉了)。
290
+ 3. **不额外插强调色说明条**(0.3.85):编辑态不再在列表上方插一条黄底提示,是否在编辑只看标题行那个按钮本身。
291
+
292
+ ### 工作区显示卡片:连空会话与空闲审查父容器一起折叠(0.3.83)
293
+
294
+ 在 0.3.82「默认折叠智能体子会话」之外,再默认折叠两类干扰条目:
295
+
296
+ 1. **空会话**:建了但从没发过消息、也没跑过 turn 的历史条目(会话头 `origin` 为空,日志里只有 permission / sandbox / approval / session-end-seed 这几条,没有 `turn/start`、没有 `user/message`)。
297
+ 2. **Mnemon 空闲审查的父容器**:`mnemon-review-owner-v1-*`,它自己只有一条 `subagent/catalog` 事件,真正的内容都在它指向的 `mnemon-review-v1-*` 子会话里。
298
+
299
+ 两类都天然满足「blank」判据,所以用同一条规则折掉,不需要单独写名字匹配。卡片标题行新增「显示空会话」勾选项,需要时可以放回来;footer 会分别说明折叠了多少条空会话和多少条智能体会话。本机默认视图从 99 条降到 10 条。
300
+
276
301
  ### 工作区显示卡片:默认折叠智能体会话 + 隐藏/显示即时生效(0.3.82)
277
302
 
278
303
  「工作区显示」卡片两处改动:
@@ -634,6 +659,10 @@ pwsh -File sync.ps1 push -ScanHistory
634
659
 
635
660
  | 日期 | 版本 | 要点 |
636
661
  |---|---|---|
662
+ | 2026-11-23 | 0.3.86 | 「本机数据」挪进概览-待办,按同步内容的 12 组口径分类统计,会话样本显示会话标题而非 session id |
663
+ | 2026-11-23 | 0.3.85 | 去掉工作区显示卡片编辑态的强调色说明条,编辑与否只看标题行「修改」/「完成」按钮 |
664
+ | 2026-11-23 | 0.3.84 | 工作区显示卡片改成整卡一个「修改」按钮;会话行自带开关、加底色与分隔线,隐藏态删除线 |
665
+ | 2026-11-23 | 0.3.83 | 工作区显示卡片再折叠空会话与 Mnemon 空闲审查父容器;本机默认视图 99 → 10 条 |
637
666
  | 2026-11-23 | 0.3.82 | 工作区显示卡片默认折叠智能体会话;隐藏/显示改走 workspaceRegistry,切完即时生效(不再需要重启) |
638
667
  | 2026-11-21 | 0.3.75 | 隐藏/归档的工作区跨机同步(workspace-archives.v1.json 纳入 settings),B 机拉取后不再显示已隐藏的工作区与会话 |
639
668
  | 2026-11-19 | 0.3.69 | 跨机搬运 billion-context 压缩状态(bili-state.mjs);同步清单新增 plugin-missing / context-state 两类提示 |
package/client.js CHANGED
@@ -713,21 +713,6 @@ window.__ModuleLoader__.load({
713
713
  'The local repo has no content yet: Pull fetches the whole repo into this path (git init + fetch + checkout). Push is disabled until then.',
714
714
  ))
715
715
  : null,
716
- h(Kv, { k: M('本机数据', 'Local data'), v: (() => {
717
- const local = props.data && props.data.local
718
- if (!local || !local.known) return M('还没同步过', 'Never synced yet')
719
- const when = local.lastSyncAt ? new Date(local.lastSyncAt).toLocaleString(localeNow(), { hour12: false }) : '?'
720
- const tail = local.pending > 0
721
- ? M(
722
- `有 ${local.pending} 个文件待推送${local.sample && local.sample.length ? `(如 ${local.sample.join('、')})` : ''}`,
723
- `${local.pending} file(s) to push${local.sample && local.sample.length ? ` (e.g. ${local.sample.join(', ')})` : ''}`,
724
- )
725
- : M('没有新写入', 'nothing new')
726
- return M(
727
- `${tail} · 上次同步 ${when}${local.mode ? `(${local.mode})` : ''}`,
728
- `${tail} · last sync ${when}${local.mode ? ` (${local.mode})` : ''}`,
729
- )
730
- })() }),
731
716
  h('div', { style: S.footnote }, M(
732
717
  '路径只存本机设置文件(~\\.dsh\\dsh-config-sync.json),不进仓库,各机器各配各的。',
733
718
  'The path lives only in the local settings file (~\\.dsh\\dsh-config-sync.json), never in the repo.',
@@ -1670,26 +1655,6 @@ window.__ModuleLoader__.load({
1670
1655
  const archived = wss.filter(w => w.state === 'archive').length
1671
1656
  const agentHidden = Number(data.agentHidden || 0)
1672
1657
  const blankHidden = Number(data.blankHidden || 0)
1673
- // 编辑态用一条明显的强调色说明条,让「现在可改」这件事一眼可见。
1674
- const editBanner = editing
1675
- ? h('div', {
1676
- style: {
1677
- display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap',
1678
- padding: '7px 10px', borderRadius: '8px',
1679
- background: 'var(--dsw-alias-state-warn-secondary, transparent)',
1680
- color: 'var(--dsw-alias-label-primary)',
1681
- fontSize: '12px', lineHeight: '18px',
1682
- },
1683
- },
1684
- h('span', { style: { fontWeight: 600 } }, M('编辑中', 'Editing')),
1685
- h('span', { style: { flex: 1, minWidth: '160px' } },
1686
- M('现在可以改工作区三态和每条会话的显示/隐藏;点「完成」退出编辑。', 'You can change workspace states and toggle each session now; click Done to finish.')),
1687
- h('button', {
1688
- type: 'button', style: { ...S.btn, fontWeight: 600 }, disabled: busy,
1689
- onClick: () => setEditing(false),
1690
- }, M('完成', 'Done')),
1691
- )
1692
- : null
1693
1658
  return h('div', { style: S.card },
1694
1659
  h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' } },
1695
1660
  h('div', { style: S.cardTitle }, M('工作区显示状态', 'Workspace visibility')),
@@ -1731,7 +1696,6 @@ window.__ModuleLoader__.load({
1731
1696
  }, editing ? M('完成', 'Done') : M('修改', 'Edit')),
1732
1697
  h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
1733
1698
  ),
1734
- editBanner,
1735
1699
  msg ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' } }, msg) : null,
1736
1700
  err ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, err) : null,
1737
1701
  h('div', { style: S.footnote },
@@ -2647,12 +2611,39 @@ window.__ModuleLoader__.load({
2647
2611
  return local.pending > 0 ? M(`${base}(+${local.pending})`, `${base} (+${local.pending})`) : base
2648
2612
  })(), data && data.local && data.local.pending > 0 ? 'warn' : 'ok'),
2649
2613
  )
2614
+ // 本机数据(原「本机仓库」卡里的一行)挪进待办:按「同步内容」分组列出待推送项,会话显示会话名
2615
+ const localBlock = data && data.local && data.local.known ? (() => {
2616
+ const local = data.local
2617
+ const when = local.lastSyncAt ? new Date(local.lastSyncAt).toLocaleString(localeNow(), { hour12: false }) : '?'
2618
+ const groups = Array.isArray(local.groups) ? local.groups : []
2619
+ const head = h('div', { style: { ...S.cardTitle, marginBottom: '4px' } }, M('本机数据', 'Local data'))
2620
+ const meta = h('div', { style: S.footnote }, M(
2621
+ `上次同步 ${when} · ${local.pending > 0 ? `有 ${local.pending} 个文件待推送` : '没有新写入'}${local.mode ? `(${local.mode})` : ''}`,
2622
+ `Last sync ${when} · ${local.pending > 0 ? `${local.pending} file(s) to push` : 'nothing new'}${local.mode ? ` (${local.mode})` : ''}`,
2623
+ ))
2624
+ const groupRows = groups.length
2625
+ ? h('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '6px' } }, groups.map((g, i) =>
2626
+ h('div', {
2627
+ key: i,
2628
+ style: { ...S.chip, background: 'var(--dsw-alias-fill-l1, var(--dsw-alias-border-l1))' },
2629
+ }, `${langIsZh() ? g.zh : g.en} · ${g.count}`)))
2630
+ : null
2631
+ const sampleRow = Array.isArray(local.sample) && local.sample.length
2632
+ ? h('div', { style: S.footnote }, M(
2633
+ `最近写入:${local.sample.join('、')}`,
2634
+ `Recently changed: ${local.sample.join(', ')}`,
2635
+ ))
2636
+ : null
2637
+ return h('div', { style: { display: 'flex', flexDirection: 'column', gap: '4px' } }, head, meta, groupRows, sampleRow)
2638
+ })() : null
2639
+
2650
2640
  const overview = h('div', { style: { gridColumn: '1 / -1', display: 'flex', flexDirection: 'column', gap: '8px' } },
2651
2641
  metrics,
2652
- data && Array.isArray(data.advice) && data.advice.length
2653
- ? h('div', { style: { ...S.card, gap: '4px', padding: '10px 13px' } },
2642
+ (localBlock || (data && Array.isArray(data.advice) && data.advice.length))
2643
+ ? h('div', { style: { ...S.card, gap: '6px', padding: '10px 13px' } },
2654
2644
  h('div', { style: S.cardTitle }, M('待办', 'To-do')),
2655
- h(Advice, { items: data.advice }))
2645
+ localBlock,
2646
+ data && Array.isArray(data.advice) && data.advice.length ? h(Advice, { items: data.advice }) : null)
2656
2647
  : null,
2657
2648
  )
2658
2649
 
package/index.js CHANGED
@@ -1761,6 +1761,51 @@ function workspaceRoots(dshHome) {
1761
1761
  : []
1762
1762
  }
1763
1763
 
1764
+ // 本机待推送文件按「同步内容」的分组归类;标签与 collectScopeGroups 的 titleZh/titleEn 对齐
1765
+ const PENDING_GROUP_LABEL = {
1766
+ profile: ['本机 profile', 'Local profile'],
1767
+ prompt: ['全局提示', 'Global prompts'],
1768
+ skills: ['Skills', 'Skills'],
1769
+ presets: ['Agent 预设', 'Agent presets'],
1770
+ 'storages-record': ['技能市场台账', 'Skill market ledger'],
1771
+ settings: ['插件设置与工作流', 'Plugin settings & workflows'],
1772
+ mnemon: ['记忆数据', 'Memory data'],
1773
+ 'local-plugins': ['本地源码插件包', 'Local plugin packages'],
1774
+ 'plugin-data': ['插件数据', 'Plugin data'],
1775
+ extra: ['额外路径', 'Extra paths'],
1776
+ workspace: ['工作区资料', 'Workspace files'],
1777
+ conversations: ['会话记录', 'Conversations'],
1778
+ other: ['其它', 'Other'],
1779
+ }
1780
+
1781
+ function pendingGroupOf(file, dshHome, profileDir, workspacePaths) {
1782
+ const norm = String(file).replace(/\\/g, '/')
1783
+ const base = String(dshHome).replace(/\\/g, '/').replace(/\/+$/, '')
1784
+ const prof = String(profileDir).replace(/\\/g, '/').replace(/\/+$/, '')
1785
+ if (prof && norm.startsWith(prof + '/')) return 'profile'
1786
+ if (/\/AGENTS\.md$|\/prompt-inject\.md$/i.test(norm)) return 'prompt'
1787
+ if (norm.startsWith(base + '/skills/')) return 'skills'
1788
+ if (norm.startsWith(base + '/.agent-presets/')) return 'presets'
1789
+ if (norm.startsWith(base + '/mnemon/')) return 'mnemon'
1790
+ if (norm.startsWith(base + '/sessions/')) return 'conversations'
1791
+ for (const w of workspacePaths || []) {
1792
+ const wn = String(w).replace(/\\/g, '/').replace(/\/+$/, '')
1793
+ if (wn && norm.startsWith(wn + '/')) return 'workspace'
1794
+ }
1795
+ return 'other'
1796
+ }
1797
+
1798
+ // 会话文件的标题:投影缓存 record.rows.title.val 就是 DSH 面板显示的会话名
1799
+ function sessionTitleOf(dshHome, sessionId) {
1800
+ if (!sessionId) return ''
1801
+ try {
1802
+ const p = join(dshHome, 'storages', 'session_projcache', 'sessions', sessionId + '.json')
1803
+ const o = JSON.parse(readFileSync(p, 'utf8'))
1804
+ const t = o && o.record && o.record.rows && o.record.rows.title && o.record.rows.title.val
1805
+ return typeof t === 'string' && t.trim() ? t : ''
1806
+ } catch { return '' }
1807
+ }
1808
+
1764
1809
  /**
1765
1810
  * 本机 DSH 数据里「上次同步之后又写过」的文件有多少个。
1766
1811
  * 只看 mtime,不读内容、**不跑 capture**(跑 capture 要复制整个工作区,几 GB)。
@@ -1773,9 +1818,10 @@ function workspaceRoots(dshHome) {
1773
1818
  */
1774
1819
  function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1775
1820
  const since = lastSyncAt ? Date.parse(lastSyncAt) : NaN
1776
- if (!Number.isFinite(since)) return { known: false, pending: 0, newestAt: '', sample: [] }
1821
+ if (!Number.isFinite(since)) return { known: false, pending: 0, newestAt: '', sample: [], groups: [] }
1777
1822
  const skip = new Set(['node_modules', '.git', 'models', '_tmp', 'staging', 'logs', 'attachments'])
1778
1823
  const profile = join(dshHome, 'profiles', profileName || 'desktop')
1824
+ const workspacePaths = workspaceRoots(dshHome)
1779
1825
  const stack = [
1780
1826
  join(dshHome, 'sessions'),
1781
1827
  join(dshHome, 'skills'),
@@ -1804,6 +1850,7 @@ function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1804
1850
  let pending = 0
1805
1851
  let newest = 0
1806
1852
  const sample = []
1853
+ const groupCount = new Map()
1807
1854
  while (stack.length && scanned < 20000 && Date.now() < deadline) {
1808
1855
  const cur = stack.pop()
1809
1856
  let st
@@ -1826,14 +1873,27 @@ function localPending(dshHome, lastSyncAt, profileName, ctx = {}) {
1826
1873
  }
1827
1874
  pending++
1828
1875
  if (st.mtimeMs > newest) newest = st.mtimeMs
1829
- if (sample.length < 3) sample.push(`${basename(dirname(cur))}/${basename(cur)}`)
1876
+ const gid = pendingGroupOf(cur, dshHome, profile, workspacePaths)
1877
+ groupCount.set(gid, (groupCount.get(gid) || 0) + 1)
1878
+ // 会话文件显示会话标题而不是目录 ID;其余显示父目录/文件名
1879
+ let label = `${basename(dirname(cur))}/${basename(cur)}`
1880
+ if (gid === 'conversations') {
1881
+ const sid = basename(dirname(cur)) // sessions/<workspace>/<sessionId>/session.v4.jsonl.zstd
1882
+ const title = sessionTitleOf(dshHome, sid)
1883
+ if (title) label = title
1884
+ }
1885
+ if (sample.length < 3) sample.push(label)
1830
1886
  }
1831
1887
  }
1888
+ const groups = [...groupCount.entries()]
1889
+ .map(([id, count]) => ({ id, zh: PENDING_GROUP_LABEL[id]?.[0] || id, en: PENDING_GROUP_LABEL[id]?.[1] || id, count }))
1890
+ .sort((a, b) => b.count - a.count)
1832
1891
  return {
1833
1892
  known: true,
1834
1893
  pending,
1835
1894
  newestAt: newest ? new Date(newest).toISOString() : '',
1836
1895
  sample,
1896
+ groups,
1837
1897
  truncated: scanned >= 20000 || Date.now() >= deadline,
1838
1898
  }
1839
1899
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.84",
3
+ "version": "0.3.86",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -1688,8 +1688,8 @@ console.log('== 配置同步页面 5 点调整 ==')
1688
1688
  && cliSrc.includes('onClick: () => setEditing(v => !v)')
1689
1689
  && cliSrc.includes('changeWorkspace(w.workspaceId, e.target.value)')
1690
1690
  && cliSrc.includes('changeSession(s.id, !s.hidden)')
1691
- // 编辑态有明显的说明条与退出按钮
1692
- && cliSrc.includes("M('编辑中', 'Editing')"), 'client.js 编辑态')
1691
+ // 编辑态只靠顶部按钮本身表达状态,不再额外插入强调色说明条
1692
+ && !cliSrc.includes('editBanner') && !cliSrc.includes("M('编辑中', 'Editing')"), 'client.js 编辑态')
1693
1693
  // 3) 点工作区整行即展开,不再单独展开按钮
1694
1694
  check('点工作区即展开(整行 onClick,无独立展开按钮)',
1695
1695
  cliSrc.includes("onClick: () => setExpanded(e => ({ ...e, [w.workspaceId]: !open }))")
@@ -1726,5 +1726,45 @@ console.log('== 配置同步页面 5 点调整 ==')
1726
1726
  && cliSrc.includes("scrollMarginTop: '8px'")
1727
1727
  && !cliSrc.includes('headerRef.current ? headerRef.current.offsetHeight'), '滚动遮挡')
1728
1728
  }
1729
+ console.log('')
1730
+ console.log('== 0.3.86:本机数据挪进待办 + 会话显示会话名 + 按同步内容分组 ==')
1731
+ {
1732
+ const idxSrc = existsSync(join(pluginRootSelf, 'index.js')) ? readFileSync(join(pluginRootSelf, 'index.js'), 'utf8') : ''
1733
+ const cliSrc = existsSync(join(pluginRootSelf, 'client.js')) ? readFileSync(join(pluginRootSelf, 'client.js'), 'utf8') : ''
1734
+ // 1) 宿主:按同步内容分组归类 + 从投影缓存取会话标题
1735
+ check('本机数据按同步内容分组归类(pendingGroupOf + PENDING_GROUP_LABEL)',
1736
+ idxSrc.includes('const PENDING_GROUP_LABEL = {')
1737
+ && idxSrc.includes('conversations: [\'会话记录\', \'Conversations\']')
1738
+ && idxSrc.includes('function pendingGroupOf(')
1739
+ && idxSrc.includes('const gid = pendingGroupOf(')
1740
+ && idxSrc.includes('groupCount.set(gid, (groupCount.get(gid) || 0) + 1)'), 'index.js 分组统计')
1741
+ check('本机数据样本里会话显示会话标题(sessionTitleOf)',
1742
+ idxSrc.includes('function sessionTitleOf(')
1743
+ && idxSrc.includes('record.rows.title.val')
1744
+ && idxSrc.includes("if (gid === 'conversations')")
1745
+ && idxSrc.includes('if (title) label = title')
1746
+ && idxSrc.includes('if (sample.length < 3) sample.push(label)'), 'index.js 会话标题')
1747
+ check('localPending 返回 groups(zh/en/count)',
1748
+ idxSrc.includes('const groups = [...groupCount.entries()]')
1749
+ && idxSrc.includes('zh: PENDING_GROUP_LABEL[id]?.[0]')
1750
+ && idxSrc.includes('groups,')
1751
+ && idxSrc.includes('sample: [], groups: []'), 'index.js localPending 返回值')
1752
+ // 2) 客户端:本机数据从「本机仓库」卡挪进「待办」
1753
+ const localDataHits = cliSrc.split("M('本机数据', 'Local data')").length - 1
1754
+ check('本机数据只出现在待办卡(从本机仓库卡移除)',
1755
+ localDataHits === 1
1756
+ && cliSrc.includes('const localBlock = data && data.local && data.local.known')
1757
+ && cliSrc.includes('localBlock,'), 'client.js 待办装配')
1758
+ check('待办里按同步内容分组显示,并列出会话名样本',
1759
+ cliSrc.includes('langIsZh() ? g.zh : g.en')
1760
+ && cliSrc.includes('g.count')
1761
+ && cliSrc.includes('最近写入:')
1762
+ && cliSrc.includes('local.sample.join'), 'client.js 分组展示')
1763
+ check('分组标签与同步内容一致(会话记录/技能/插件数据/记忆数据)',
1764
+ idxSrc.includes("conversations: ['会话记录', 'Conversations']")
1765
+ && idxSrc.includes("skills: ['Skills', 'Skills']")
1766
+ && idxSrc.includes("'plugin-data': ['插件数据', 'Plugin data']")
1767
+ && idxSrc.includes("mnemon: ['记忆数据', 'Memory data']"), '分组口径')
1768
+ }
1729
1769
  process.exit(failures === 0 ? 0 : 1)
1730
1770