dsh-capability-switch 1.5.0 → 1.5.1
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/CHANGELOG.md +10 -0
- package/README.md +4 -4
- package/lib/client.js +31 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -124,12 +124,12 @@ npm install --ignore-scripts
|
|
|
124
124
|
|
|
125
125
|
在 DSH 中打开“插件”,选择“添加插件”,然后选择这个目录。安装完成后,左侧边栏会出现 `技能与MCP`。
|
|
126
126
|
|
|
127
|
-
也可以下载 GitHub Release 中的 `dsh-capability-switch-1.5.
|
|
127
|
+
也可以下载 GitHub Release 中的 `dsh-capability-switch-1.5.1.tgz`,解压后按上面的目录方式安装。
|
|
128
128
|
|
|
129
129
|
从 GitHub 固定版本安装(Git 安装不会自动更新):
|
|
130
130
|
|
|
131
131
|
```bash
|
|
132
|
-
dsh plugin --profile desktop add "git+https://github.com/lock-down/dsh-capability-switch.git#v1.5.
|
|
132
|
+
dsh plugin --profile desktop add "git+https://github.com/lock-down/dsh-capability-switch.git#v1.5.1"
|
|
133
133
|
```
|
|
134
134
|
|
|
135
135
|
## 自动更新
|
|
@@ -144,7 +144,7 @@ dsh plugin --profile desktop add "git+https://github.com/lock-down/dsh-capabilit
|
|
|
144
144
|
- 有 HMR 时安装后自动加载;没有 HMR 时提示重启 DSH。
|
|
145
145
|
- 自动更新不会修改 Skills、MCP、工作区或同步状态。
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
顶部显示当前版本、自动更新开关和“检查更新”。发现新版本时,状态条会同时显示最新版本号和当前版本号,并提供“更新到该版本”按钮;没有可用更新时,手动检查会明确显示“当前已是最新版本”和当前版本号。关闭自动更新后仍可手动检查和安装。设置保存在 `~/.dsh/capability-switch/update-preferences.json`。
|
|
148
148
|
|
|
149
149
|
`1.5.0` 是首个带自动更新机制的版本;`1.4.9` 及更早版本需要手动安装一次 `1.5.0`,之后的新版本才会自动更新。
|
|
150
150
|
|
|
@@ -224,7 +224,7 @@ npm pack
|
|
|
224
224
|
- 独立 MCP 编辑、只读权限、启停、补丁删除和备份
|
|
225
225
|
- SSE 映射、表单与 JSON 编辑
|
|
226
226
|
- Host 路由、代理工具和无损 JSON 输出
|
|
227
|
-
- npm registry
|
|
227
|
+
- npm registry 更新检查、稳定版本筛选、无更新状态和本地安装拒绝自动更新
|
|
228
228
|
|
|
229
229
|
主要文件:
|
|
230
230
|
|
package/lib/client.js
CHANGED
|
@@ -43,8 +43,8 @@ window.__ModuleLoader__.load({
|
|
|
43
43
|
prefsTitle: '自定义显示', sidebarVisible: '在左侧边栏显示入口', sidebarLabel: '入口名称', defaultTab: '默认打开',
|
|
44
44
|
showDescriptions: '显示描述与配置摘要', compactRows: '使用紧凑行距', prefsSaved: '显示偏好已保存到 DSH 配置',
|
|
45
45
|
preferencesHint: '这些偏好保存在当前 DSH profile 中,重启后仍会保留。设置页始终保留,便于恢复侧边栏入口。',
|
|
46
|
-
autoUpdate: '自动更新', autoUpdateHint: '仅 npm 安装支持自动更新;会检查兼容的稳定版本并通过 DSH 插件管理器安装。', checkUpdate: '检查更新',
|
|
47
|
-
updateAvailable: '发现新版本 {
|
|
46
|
+
autoUpdate: '自动更新', autoUpdateHint: '仅 npm 安装支持自动更新;会检查兼容的稳定版本并通过 DSH 插件管理器安装。', checkUpdate: '检查更新', checkingUpdate: '正在检查…',
|
|
47
|
+
updateAvailable: '发现新版本', updateAvailableDetail: '最新版本 v{latest} · 当前版本 v{current}', updateNow: '更新到 v{version}', updatingVersion: '正在更新到 v{version}…', updateCurrent: '当前已是最新版本', updateCurrentDetail: '当前版本 v{version}', updateUnsupported: '当前安装方式不自动更新', updateFailed: '更新失败:', updateRestart: '已安装 v{version},重启 DSH 后生效', updateDone: '已更新到 v{version}', updateAutoSaved: '自动更新设置已保存',
|
|
48
48
|
userSkillsDir: '用户级技能目录', readonlyHint: '用户级和所有已注册工作区的 .agents 项目技能支持编辑、启停和删除;跨工作区修改会提示影响范围。',
|
|
49
49
|
connected: '已连接', connecting: '连接中', reconnecting: '等待重连', failed: '连接失败', waiting: '等待凭据', closed: '已关闭',
|
|
50
50
|
unknownStatus: '未知状态', toolCount: '{count} 个工具', invalidJson: 'JSON 格式不正确', empty: '暂无描述',
|
|
@@ -90,8 +90,8 @@ window.__ModuleLoader__.load({
|
|
|
90
90
|
prefsTitle: 'Customize display', sidebarVisible: 'Show an entry in the left sidebar', sidebarLabel: 'Entry label', defaultTab: 'Open by default',
|
|
91
91
|
showDescriptions: 'Show descriptions and configuration summaries', compactRows: 'Use compact rows', prefsSaved: 'Display preferences saved to the DSH configuration',
|
|
92
92
|
preferencesHint: 'Preferences persist in the active DSH profile. The Settings page always remains available so you can restore the sidebar entry.',
|
|
93
|
-
autoUpdate: 'Auto update', autoUpdateHint: 'Only npm installs auto-update; compatible stable releases are installed through the DSH plugin manager.', checkUpdate: 'Check for updates',
|
|
94
|
-
updateAvailable: '
|
|
93
|
+
autoUpdate: 'Auto update', autoUpdateHint: 'Only npm installs auto-update; compatible stable releases are installed through the DSH plugin manager.', checkUpdate: 'Check for updates', checkingUpdate: 'Checking…',
|
|
94
|
+
updateAvailable: 'New version available', updateAvailableDetail: 'Latest v{latest} · Current v{current}', updateNow: 'Update to v{version}', updatingVersion: 'Updating to v{version}…', updateCurrent: 'You are on the latest version', updateCurrentDetail: 'Current version v{version}', updateUnsupported: 'This install cannot auto-update', updateFailed: 'Update failed: ', updateRestart: 'Version v{version} is installed; restart DSH to apply', updateDone: 'Updated to v{version}', updateAutoSaved: 'Auto-update setting saved',
|
|
95
95
|
userSkillsDir: 'User skill directory', readonlyHint: 'User and .agents project skills in every registered workspace support editing, toggling, and deletion; cross-workspace edits show their impact.',
|
|
96
96
|
connected: 'Connected', connecting: 'Connecting', reconnecting: 'Reconnecting', failed: 'Failed', waiting: 'Waiting for credentials', closed: 'Closed',
|
|
97
97
|
unknownStatus: 'Unknown status', toolCount: '{count} tools', invalidJson: 'Invalid JSON', empty: 'No description',
|
|
@@ -134,7 +134,14 @@ window.__ModuleLoader__.load({
|
|
|
134
134
|
'.dsh-caps-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;}',
|
|
135
135
|
'.dsh-caps-update-actions{justify-content:flex-end;row-gap:10px;}',
|
|
136
136
|
'.dsh-caps-version{color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums;font-size:12px;}',
|
|
137
|
-
'.dsh-caps-update{display:flex;align-items:center;
|
|
137
|
+
'.dsh-caps-update{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px;border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);}',
|
|
138
|
+
'.dsh-caps-update-icon{display:grid;place-items:center;flex:0 0 20px;color:var(--dsw-alias-label-secondary);}',
|
|
139
|
+
'.dsh-caps-update-copy{display:flex;flex:1;min-width:180px;flex-direction:column;gap:2px;}',
|
|
140
|
+
'.dsh-caps-update-title{color:var(--dsw-alias-label-primary);font-weight:600;}',
|
|
141
|
+
'.dsh-caps-update-detail{color:var(--dsw-alias-label-secondary);font-size:12px;font-variant-numeric:tabular-nums;}',
|
|
142
|
+
'.dsh-caps-update[data-state=available] .dsh-caps-update-icon{color:var(--dsw-alias-brand-primary);}',
|
|
143
|
+
'.dsh-caps-update[data-state=current] .dsh-caps-update-icon,.dsh-caps-update[data-state=updated] .dsh-caps-update-icon{color:var(--dsw-alias-state-success-primary);}',
|
|
144
|
+
'.dsh-caps-update[data-state=failed]{color:var(--dsw-alias-state-error-primary);background:color-mix(in srgb,var(--dsw-alias-state-error-primary) 7%,transparent);border-color:color-mix(in srgb,var(--dsw-alias-state-error-primary) 24%,transparent);}',
|
|
138
145
|
'.dsh-caps-btn{border:.5px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-bg-layer-1);color:var(--dsw-alias-label-secondary);border-radius:7px;min-height:32px;padding:5px 11px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:6px;white-space:nowrap;}',
|
|
139
146
|
'.dsh-caps-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);}',
|
|
140
147
|
'.dsh-caps-btn:focus-visible,.dsh-caps-tab:focus-visible,.dsh-caps-switch:focus-visible{outline:var(--dsw-focus-ring-width,2px) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:2px;}',
|
|
@@ -210,6 +217,9 @@ window.__ModuleLoader__.load({
|
|
|
210
217
|
link: h('path', { d: 'M6.2 9.8 4.8 11.2a2.3 2.3 0 0 1-3.3-3.3l2.2-2.2a2.3 2.3 0 0 1 3.3 0M9.8 6.2l1.4-1.4a2.3 2.3 0 0 1 3.3 3.3l-2.2 2.2a2.3 2.3 0 0 1-3.3 0M5.5 10.5l5-5' }),
|
|
211
218
|
copy: h('path', { d: 'M5.5 2.5h6a2 2 0 0 1 2 2v6M3 5.5h7.5v8H3z' }),
|
|
212
219
|
close: h('path', { d: 'm4 4 8 8m0-8-8 8' }),
|
|
220
|
+
check: h('path', { d: 'm3 8.2 3.1 3.1L13 4.8' }),
|
|
221
|
+
download: h('path', { d: 'M8 2v8m-3-3 3 3 3-3M3 12.5h10' }),
|
|
222
|
+
info: h('path', { d: 'M8 2.5a5.5 5.5 0 1 0 0 11 5.5 5.5 0 0 0 0-11ZM8 7v4M8 4.7v.2' }),
|
|
213
223
|
}
|
|
214
224
|
return h('svg', { width: size, height: size, viewBox: '0 0 16 16', fill: 'none', stroke: 'currentColor', strokeWidth: 1.4, strokeLinecap: 'round', strokeLinejoin: 'round', 'aria-hidden': true }, paths[name] || paths.settings)
|
|
215
225
|
}
|
|
@@ -649,7 +659,7 @@ window.__ModuleLoader__.load({
|
|
|
649
659
|
const update = data.update || {}
|
|
650
660
|
const updateNotice = result => {
|
|
651
661
|
if (!result) return ''
|
|
652
|
-
if (result.state === 'available') return t('updateAvailable'
|
|
662
|
+
if (result.state === 'available') return t('updateAvailable')
|
|
653
663
|
if (result.state === 'current') return t('updateCurrent')
|
|
654
664
|
if (result.state === 'updated') return t('updateDone', { version: result.latest })
|
|
655
665
|
if (result.state === 'restart-required') return t('updateRestart', { version: result.latest })
|
|
@@ -658,8 +668,13 @@ window.__ModuleLoader__.load({
|
|
|
658
668
|
if (result.state === 'failed') return t('updateFailed') + (result.error || '')
|
|
659
669
|
return ''
|
|
660
670
|
}
|
|
661
|
-
const
|
|
662
|
-
|
|
671
|
+
const updateDetail = update.state === 'available'
|
|
672
|
+
? t('updateAvailableDetail', { latest: update.latest, current: update.current })
|
|
673
|
+
: update.state === 'current' ? t('updateCurrentDetail', { version: update.current }) : ''
|
|
674
|
+
const updateIcon = update.state === 'available' || update.state === 'updating' ? 'download'
|
|
675
|
+
: update.state === 'current' || update.state === 'updated' ? 'check' : 'info'
|
|
676
|
+
const checkForUpdates = () => perform('update-check', () => api('/update/check', { body: {} }), '')
|
|
677
|
+
const applyUpdate = version => perform('update-apply', () => api('/update/apply', { body: { version } }), '')
|
|
663
678
|
const setAutoUpdate = enabled => perform('update-config', () => api('/update/config', { body: { autoUpdate: enabled } }), t('updateAutoSaved'))
|
|
664
679
|
|
|
665
680
|
const filtered = useMemo(() => {
|
|
@@ -771,7 +786,14 @@ window.__ModuleLoader__.load({
|
|
|
771
786
|
h('label', { className: 'dsh-caps-check', title: t('autoUpdateHint') },
|
|
772
787
|
h('input', { type: 'checkbox', checked: update.autoUpdate !== false, disabled: Boolean(busy) || update.state === 'updating' || update.supported === false, onChange: event => setAutoUpdate(event.target.checked) }),
|
|
773
788
|
t('autoUpdate')),
|
|
774
|
-
h('button', { className: 'dsh-caps-btn', disabled: Boolean(busy) || update.state === 'updating', onClick: checkForUpdates }, h(Icon, { name: 'refresh' }), t('checkUpdate')))),
|
|
789
|
+
h('button', { className: 'dsh-caps-btn', disabled: Boolean(busy) || update.state === 'updating', 'aria-busy': busy === 'update-check', onClick: checkForUpdates }, h(Icon, { name: 'refresh' }), t(busy === 'update-check' ? 'checkingUpdate' : 'checkUpdate')))),
|
|
790
|
+
['available', 'current', 'updating', 'failed', 'restart-required', 'updated', 'unsupported'].includes(update.state) ? h('div', { className: 'dsh-caps-notice dsh-caps-update', 'data-state': update.state, role: update.state === 'failed' ? 'alert' : 'status', 'aria-live': 'polite' },
|
|
791
|
+
h('span', { className: 'dsh-caps-update-icon' }, h(Icon, { name: updateIcon, size: 18 })),
|
|
792
|
+
h('div', { className: 'dsh-caps-update-copy' },
|
|
793
|
+
h('div', { className: 'dsh-caps-update-title' }, updateNotice(update)),
|
|
794
|
+
updateDetail ? h('div', { className: 'dsh-caps-update-detail' }, updateDetail) : null),
|
|
795
|
+
update.state === 'available' ? h('button', { className: 'dsh-caps-btn dsh-caps-primary', disabled: Boolean(busy), onClick: () => applyUpdate(update.latest) }, t('updateNow', { version: update.latest }))
|
|
796
|
+
: update.state === 'failed' ? h('button', { className: 'dsh-caps-btn', disabled: Boolean(busy), onClick: checkForUpdates }, t('retry')) : null) : null,
|
|
775
797
|
h('div', { className: 'dsh-caps-tabs' }, ['skills', 'mcp'].map(key => h('button', { key, 'aria-pressed': tab === key, className: 'dsh-caps-tab', onClick: () => setTab(key) }, t(key), h('span', { className: 'dsh-caps-count' }, (data[key] || []).length)))),
|
|
776
798
|
h('div', { className: 'dsh-caps-toolbar' },
|
|
777
799
|
h('div', { className: 'dsh-caps-search' }, h('span', { className: 'dsh-caps-search-icon' }, h(Icon, { name: 'search' })), h('input', { className: 'dsh-caps-input', type: 'search', value: query, onChange: e => setQuery(e.target.value), placeholder: t('search'), 'aria-label': t('search') })),
|
|
@@ -781,9 +803,6 @@ window.__ModuleLoader__.load({
|
|
|
781
803
|
h('button', { className: 'dsh-caps-btn dsh-caps-primary', onClick: () => openModal(tab === 'skills' ? { kind: 'skill-create' } : { kind: 'mcp', item: null }) }, h(Icon, { name: 'plus' }), t(tab === 'skills' ? 'addSkill' : 'addMcp'))),
|
|
782
804
|
error ? h('div', { className: 'dsh-caps-notice dsh-caps-error', role: 'alert' }, error) : null,
|
|
783
805
|
notice ? h('div', { className: 'dsh-caps-notice', role: 'status' }, notice) : null,
|
|
784
|
-
['available', 'updating', 'failed', 'restart-required', 'updated'].includes(update.state) ? h('div', { className: 'dsh-caps-notice dsh-caps-update', role: 'status', 'aria-live': 'polite' },
|
|
785
|
-
h('span', null, updateNotice(update)),
|
|
786
|
-
update.state === 'available' || update.state === 'failed' ? h('button', { className: 'dsh-caps-btn dsh-caps-primary', disabled: Boolean(busy), onClick: () => update.latest ? applyUpdate(update.latest) : checkForUpdates() }, t('updateNow')) : null) : null,
|
|
787
806
|
data.mcpError && tab === 'mcp' ? h('div', { className: 'dsh-caps-notice dsh-caps-error', role: 'alert' }, data.mcpError) : null,
|
|
788
807
|
data.skillWarnings?.length && tab === 'skills' ? h('div', { className: 'dsh-caps-notice', role: 'status' }, t('workspaceScanWarnings') + ' ' + data.skillWarnings.map(item => item.workspaceTitle).join(', ')) : null,
|
|
789
808
|
tab === 'skills' ? h('div', { className: 'dsh-caps-help', style: { marginBottom: '8px' } }, t('takeoverHint')) : null,
|