dsh-config-sync-plugin 0.3.83 → 0.3.84

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/client.js CHANGED
@@ -1608,7 +1608,9 @@ window.__ModuleLoader__.load({
1608
1608
  const [busy, setBusy] = react.useState(false)
1609
1609
  const [msg, setMsg] = react.useState('')
1610
1610
  const [expanded, setExpanded] = react.useState({})
1611
- const [editing, setEditing] = react.useState({})
1611
+ // 整张卡片只有一个「修改」按钮:进入编辑态后所有工作区与会话一起可改,
1612
+ // 不再每行各带一个按钮(那样按钮多、和会话对不上)。
1613
+ const [editing, setEditing] = react.useState(false)
1612
1614
  // 默认折叠智能体(subagent)会话:一屏全是子会话时根本找不到自己的会话。
1613
1615
  const [showAgents, setShowAgents] = react.useState(false)
1614
1616
  // 默认折叠空会话:建了没聊过、或者只是 Mnemon 空闲审查的父容器,列出只会干扰。
@@ -1668,11 +1670,33 @@ window.__ModuleLoader__.load({
1668
1670
  const archived = wss.filter(w => w.state === 'archive').length
1669
1671
  const agentHidden = Number(data.agentHidden || 0)
1670
1672
  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
1671
1693
  return h('div', { style: S.card },
1672
1694
  h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap' } },
1673
1695
  h('div', { style: S.cardTitle }, M('工作区显示状态', 'Workspace visibility')),
1674
1696
  h('div', { style: { ...S.hint, flex: 1, minWidth: '160px' } },
1675
- M('点工作区展开会话;点「修改」后才可切换状态。改动即时生效,会话列表会跟着变。', 'Click a workspace to expand sessions; click Edit to change states. Changes apply immediately and the session list follows.')),
1697
+ editing
1698
+ ? M('点工作区展开会话;每条会话右侧的按钮就是它自己的显示/隐藏。改动即时生效。', 'Click a workspace to expand sessions; the button on each row toggles that session. Changes apply immediately.')
1699
+ : M('点工作区展开会话;要改状态先点右侧「修改」。改动即时生效,会话列表会跟着变。', 'Click a workspace to expand sessions; click Edit on the right to change states. Changes apply immediately and the session list follows.')),
1676
1700
  h('label', {
1677
1701
  style: { display: 'inline-flex', alignItems: 'center', gap: '4px', fontSize: '12px', color: 'var(--dsw-alias-label-secondary)', cursor: 'pointer' },
1678
1702
  title: M('默认隐藏空会话(没跑过对话的历史条目)与 Mnemon 空闲审查的父容器,勾选后一并列出', 'Blank sessions (never used) and Mnemon idle-review parents are hidden by default; tick to list them too'),
@@ -1697,8 +1721,17 @@ window.__ModuleLoader__.load({
1697
1721
  }),
1698
1722
  h('span', null, M('显示智能体', 'Show agents')),
1699
1723
  ),
1724
+ // 全卡片唯一的主操作按钮:编辑 / 完成切换(编辑态下高亮,位置不变)
1725
+ h('button', {
1726
+ type: 'button',
1727
+ style: editing ? { ...S.btnPrimary } : { ...S.btn },
1728
+ disabled: busy,
1729
+ onClick: () => setEditing(v => !v),
1730
+ title: editing ? M('退出编辑态', 'Leave edit mode') : M('进入编辑态,才能改状态', 'Enter edit mode to change states'),
1731
+ }, editing ? M('完成', 'Done') : M('修改', 'Edit')),
1700
1732
  h('button', { type: 'button', style: S.btn, disabled: busy, onClick: load }, busy ? M('刷新中…', 'Refreshing…') : M('刷新', 'Refresh')),
1701
1733
  ),
1734
+ editBanner,
1702
1735
  msg ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-success-primary, #1a7f37)' } }, msg) : null,
1703
1736
  err ? h('div', { style: { ...S.hint, color: 'var(--dsw-alias-state-error-primary)' } }, err) : null,
1704
1737
  h('div', { style: S.footnote },
@@ -1710,8 +1743,14 @@ window.__ModuleLoader__.load({
1710
1743
  : h('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', marginTop: '2px' } },
1711
1744
  wss.map(w => {
1712
1745
  const open = !!expanded[w.workspaceId]
1713
- const edit = !!editing[w.workspaceId]
1714
- return h('div', { key: w.workspaceId, style: { border: '1px solid var(--dsw-alias-border-l1)', borderRadius: '8px', padding: '8px 10px' } },
1746
+ const wsTone = w.state === 'archive' ? 'warn' : w.state === 'normal' ? 'ok' : 'pull'
1747
+ return h('div', {
1748
+ key: w.workspaceId,
1749
+ style: {
1750
+ border: '1px solid ' + (editing ? 'var(--dsw-alias-border-l2)' : 'var(--dsw-alias-border-l1)'),
1751
+ borderRadius: '8px', padding: '8px 10px',
1752
+ },
1753
+ },
1715
1754
  // 整行可点展开 / 收起(需求3)
1716
1755
  h('div', {
1717
1756
  style: { display: 'flex', alignItems: 'center', gap: '8px', flexWrap: 'wrap', cursor: 'pointer' },
@@ -1720,44 +1759,57 @@ window.__ModuleLoader__.load({
1720
1759
  },
1721
1760
  h('span', { style: { fontSize: '12px', color: 'var(--dsw-alias-label-tertiary)', width: '12px' } }, open ? '▾' : '▸'),
1722
1761
  h('span', { style: { fontSize: '12px', fontWeight: 600, minWidth: '90px' } }, w.title || w.workspaceId.slice(0, 8)),
1723
- h('span', { style: chipStyle(w.state === 'archive' ? 'warn' : w.state === 'normal' ? 'ok' : 'pull') }, stateLabel(w.state)),
1724
- h('span', { style: { ...S.footnote, flex: 1 } }, M(w.sessionCount + ' 会话 · ' + w.hiddenCount + ' 隐藏', w.sessionCount + ' sessions · ' + w.hiddenCount + ' hidden')),
1725
- h('button', {
1726
- type: 'button', style: S.btn, disabled: busy,
1727
- onClick: (e) => { stop(e); setEditing(v => ({ ...v, [w.workspaceId]: !edit })) },
1728
- }, edit ? M('完成', 'Done') : M('修改', 'Edit')),
1729
- ),
1730
- // 编辑态才出现三态选择(需求2)
1731
- edit
1732
- ? h('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', marginTop: '6px', flexWrap: 'wrap' }, onClick: stop },
1733
- h('span', { style: S.footnote }, M('工作区状态', 'Workspace state')),
1734
- h('select', {
1762
+ // 非编辑态:状态只作为徽标展示(只读);
1763
+ // 编辑态:徽标右侧直接给出三态下拉,改的是这个工作区本身 —— 不再需要行内「修改」按钮。
1764
+ editing
1765
+ ? h('select', {
1735
1766
  value: w.state === 'partial' ? 'partial' : w.state,
1736
1767
  disabled: busy,
1768
+ onClick: stop,
1737
1769
  onChange: (e) => { if (e.target.value !== 'partial') changeWorkspace(w.workspaceId, e.target.value) },
1738
- style: { fontSize: '12px', padding: '3px 6px', borderRadius: '6px', border: '1px solid var(--dsw-alias-border-l1)', background: 'var(--dsw-alias-bg-base)', color: 'var(--dsw-alias-label-primary)' },
1770
+ title: M('这个工作区的三态', 'State of this workspace'),
1771
+ style: { fontSize: '12px', padding: '3px 6px', borderRadius: '6px', border: '1px solid var(--dsw-alias-border-l2)', background: 'var(--dsw-alias-bg-base)', color: 'var(--dsw-alias-label-primary)' },
1739
1772
  },
1740
1773
  w.state === 'partial' ? h('option', { value: 'partial' }, stateLabel('partial')) : null,
1741
1774
  opts.map(([v, label]) => h('option', { key: v, value: v }, label)),
1742
- ),
1743
- )
1744
- : null,
1745
- // 展开的会话列表:显示会话名(需求1),编辑态才出隐藏/显示按钮(需求2)
1775
+ )
1776
+ : h('span', { style: chipStyle(wsTone) }, stateLabel(w.state)),
1777
+ h('span', { style: { ...S.footnote, flex: 1 } }, M(w.sessionCount + ' 会话 · ' + w.hiddenCount + ' 隐藏', w.sessionCount + ' sessions · ' + w.hiddenCount + ' hidden')),
1778
+ ),
1779
+ // 展开的会话列表:每行是「会话名 + 它自己的开关」,按钮与会话同一行、紧跟其名,
1780
+ // 编辑态下用带词义的按钮文案(隐藏/显示,颜色区分),不再是一个孤零零的按钮。
1746
1781
  open
1747
1782
  ? h('div', { style: { display: 'flex', flexDirection: 'column', gap: '2px', marginTop: '6px', paddingLeft: '18px' } },
1748
1783
  (w.sessions || []).length === 0
1749
1784
  ? h('div', { style: S.footnote }, M('这个工作区还没有会话。', 'No sessions in this workspace.'))
1750
- : w.sessions.map(s => h('div', { key: s.id, style: { display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px', lineHeight: '18px' } },
1785
+ : w.sessions.map(s => h('div', {
1786
+ key: s.id,
1787
+ style: {
1788
+ display: 'flex', alignItems: 'center', gap: '8px', fontSize: '12px', lineHeight: '18px',
1789
+ borderTop: '1px solid var(--dsw-alias-border-l1)',
1790
+ // 编辑态给整行加底色,视线一眼能把「这一行会话」和「这一行的按钮」框在一起
1791
+ padding: editing ? '3px 6px' : '3px 0',
1792
+ borderRadius: editing ? '6px' : 0,
1793
+ background: editing ? 'var(--dsw-alias-fill-l1, var(--dsw-alias-border-l1))' : 'transparent',
1794
+ },
1795
+ },
1751
1796
  h('span', {
1752
- style: { flex: 1, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', color: s.hidden ? 'var(--dsw-alias-label-tertiary)' : 'var(--dsw-alias-label-secondary)' },
1797
+ style: {
1798
+ flex: '1 1 auto', minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap',
1799
+ color: s.hidden ? 'var(--dsw-alias-label-tertiary)' : 'var(--dsw-alias-label-secondary)',
1800
+ textDecoration: s.hidden ? 'line-through' : 'none',
1801
+ },
1753
1802
  title: (s.title || s.id) + '\n' + s.id,
1754
1803
  }, s.title || s.id),
1755
- s.hidden
1756
- ? h('span', { style: { ...S.footnote, color: 'var(--dsw-alias-label-tertiary)' } }, M('已隐藏', 'Hidden'))
1757
- : null,
1758
- edit
1804
+ // 按钮与会话同行、等宽右对齐:换行也不会跑到别的会话旁边
1805
+ editing
1759
1806
  ? h('button', {
1760
- type: 'button', style: S.btn, disabled: busy,
1807
+ type: 'button',
1808
+ style: s.hidden
1809
+ ? { ...S.btn, minWidth: '56px', color: 'var(--dsw-alias-state-success-primary, #1a7f37)' }
1810
+ : { ...S.btn, minWidth: '56px', color: 'var(--dsw-alias-state-error-primary)' },
1811
+ disabled: busy,
1812
+ title: (s.hidden ? M('让这条会话重新显示在列表里', 'Make this session visible again') : M('把这条会话从列表隐藏', 'Hide this session from the list')) + '\n' + (s.title || s.id),
1761
1813
  onClick: () => changeSession(s.id, !s.hidden),
1762
1814
  }, s.hidden ? M('显示', 'Show') : M('隐藏', 'Hide'))
1763
1815
  : null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-config-sync-plugin",
3
- "version": "0.3.83",
3
+ "version": "0.3.84",
4
4
  "type": "module",
5
5
  "description": "在 DSH 设置里查看 dsh-config 仓库与本机的同步状态,并生成退出后执行的 push/pull 脚本。同步动作本身不在应用内执行。面板与文案跟随客户端语言(中文/English)。",
6
6
  "main": "./index.js",
@@ -1677,14 +1677,19 @@ console.log('== 配置同步页面 5 点调整 ==')
1677
1677
  && wvSrc.includes('cleanTitle(providerTitle) || cleanTitle(fallbackTitle)')
1678
1678
  && !wvSrc.includes('if (lastTitle) break'), '标题演进:provider > fallback > 无来源 > 首条消息')
1679
1679
  check('会话名称:卡片显示 s.title || s.id', cliSrc.includes('s.title || s.id'), 'client.js 卡片')
1680
- // 2) 修改按钮:点「修改」才出现三态 select 与会话隐藏按钮
1681
- check('修改按钮:编辑态才显示三态 select 与会话隐藏按钮',
1682
- cliSrc.includes('const [editing, setEditing]')
1680
+ // 2) 修改按钮:全卡片只有一个「修改」,进入编辑态后三态 select 与每行的隐藏/显示按钮一起出现
1681
+ check('修改按钮:整卡一个「修改」,编辑态才显示三态 select 与会话隐藏按钮',
1682
+ cliSrc.includes('// 整张卡片只有一个「修改」按钮')
1683
1683
  && cliSrc.includes("M('修改', 'Edit')") && cliSrc.includes("M('完成', 'Done')")
1684
- && cliSrc.includes('const edit = !!editing[w.workspaceId]')
1685
- && cliSrc.includes('setEditing(v => ({ ...v, [w.workspaceId]: !edit }))')
1684
+ // 工作区行不再各带一个编辑按钮
1685
+ && !cliSrc.includes('const edit = !!editing[w.workspaceId]')
1686
+ && !cliSrc.includes('setEditing(v => ({ ...v, [w.workspaceId]: !edit }))')
1687
+ // 编辑态由整卡开关控制,且行内下拉与行内按钮都存在
1688
+ && cliSrc.includes('onClick: () => setEditing(v => !v)')
1686
1689
  && cliSrc.includes('changeWorkspace(w.workspaceId, e.target.value)')
1687
- && cliSrc.includes('changeSession(s.id, !s.hidden)'), 'client.js 编辑态')
1690
+ && cliSrc.includes('changeSession(s.id, !s.hidden)')
1691
+ // 编辑态有明显的说明条与退出按钮
1692
+ && cliSrc.includes("M('编辑中', 'Editing')"), 'client.js 编辑态')
1688
1693
  // 3) 点工作区整行即展开,不再单独展开按钮
1689
1694
  check('点工作区即展开(整行 onClick,无独立展开按钮)',
1690
1695
  cliSrc.includes("onClick: () => setExpanded(e => ({ ...e, [w.workspaceId]: !open }))")