(() => localStorage.getItem('dsh.worktable.updateCheck.v1') !== '0')
const [updateCopied, setUpdateCopied] = useState(false)
+ const [updateCopyFailed, setUpdateCopyFailed] = useState(false)
const [updateStatus, setUpdateStatus] = useState<'idle' | 'checking' | 'uptodate' | 'failed'>('idle')
const updateCheckingRef = useRef(false)
const updateAliveRef = useRef(true)
@@ -1131,9 +1157,22 @@ function WorktableSection(props: any) {
}
}, [])
useEffect(() => { if (updateCheckOn) void checkUpdates() }, [updateCheckOn, checkUpdates])
+ // 升级命令/提示按「检测到的新版本」生成:给出的是要装的版本,而不是当前已装版本。
+ const upgrade = useMemo(
+ () => worktableUpgrade(updateInfo?.latest ?? LOCAL_VERSION),
+ [updateInfo?.latest],
+ )
const copyUpgradeAi = async () => {
- const ok = await copyText(UPGRADE_AI)
- if (ok) { setUpdateCopied(true); setTimeout(() => setUpdateCopied(false), 2200) }
+ const ok = await copyText(upgrade.prompt)
+ if (ok) {
+ setUpdateCopyFailed(false)
+ setUpdateCopied(true)
+ setTimeout(() => setUpdateCopied(false), 2200)
+ } else {
+ // 复制失败要让用户看见,否则就是「点了没反应」
+ setUpdateCopyFailed(true)
+ setTimeout(() => setUpdateCopyFailed(false), 3000)
+ }
}
const skipUpdate = () => {
if (updateInfo) {
@@ -2749,10 +2788,10 @@ function buildCustomLayoutPrompt(req: string): string {
{t('update.available')} · v{updateInfo.latest}
{t('update.current')} v{LOCAL_VERSION} → v{updateInfo.latest}
{updateInfo.notes && {updateInfo.notes}
}
- {UPGRADE_CMD}
+ {upgrade.command}
diff --git a/01_content/src/client/locales.ts b/01_content/src/client/locales.ts
index f296bcf..95d3f9f 100644
--- a/01_content/src/client/locales.ts
+++ b/01_content/src/client/locales.ts
@@ -230,6 +230,7 @@ export const zh = {
'update.available': '新版本可用',
'update.current': '当前版本',
'update.copyAi': '复制 AI 提示词',
+ 'update.copyFailed': '复制失败,请手动选中命令',
'update.skip': '忽略此版本',
'update.autoCheck': '自动检查更新',
'update.checkNow': '立即检查',
@@ -472,6 +473,7 @@ export const en = {
'update.available': 'New version available',
'update.current': 'Current version',
'update.copyAi': 'Copy AI prompt',
+ 'update.copyFailed': 'Copy failed, select the command manually',
'update.skip': 'Skip this version',
'update.autoCheck': 'Auto-check updates',
'update.checkNow': 'Check now',
diff --git a/01_content/src/client/split.tsx b/01_content/src/client/split.tsx
index abec0e7..ca5290a 100644
--- a/01_content/src/client/split.tsx
+++ b/01_content/src/client/split.tsx
@@ -492,8 +492,8 @@ function boxPayload(x0: number, y0: number, x1: number, y1: number): { primary:
return { primary, line, candidates, limited, src }
}
-/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启) */
-const { prompt: UPGRADE_AI } = worktableUpgrade()
+/** 更新方法:复制给 AI 的升级指令(插件不自更新;升级由用户或其 Agent 执行 + 重启)。
+ * 命令按「检测到的新版本」生成 —— 见下方 onCopyUpgrade 里的 worktableUpgrade(tag)。 */
async function copyTextSafe(text: string): Promise {
try { if (navigator.clipboard?.writeText) { await navigator.clipboard.writeText(text); return true } } catch {}
@@ -1764,7 +1764,9 @@ function ConsolePane() {
}
const [updCopied, setUpdCopied] = useState(false)
const onCopyUpgrade = async () => {
- const ok = await copyTextSafe(UPGRADE_AI)
+ // 按检测到的新版本生成命令;没有新版本时退回当前版本(保持原有可复制行为)
+ const { prompt } = worktableUpgrade(updInfo?.latest ?? LOCAL_VERSION)
+ const ok = await copyTextSafe(prompt)
if (ok) { setUpdCopied(true); window.setTimeout(() => setUpdCopied(false), 2200) }
}
const onSkipVersion = () => {
diff --git a/01_content/src/client/styles.ts b/01_content/src/client/styles.ts
index 23ed1ee..709917a 100644
--- a/01_content/src/client/styles.ts
+++ b/01_content/src/client/styles.ts
@@ -656,7 +656,11 @@ export const css = xtermCss + '\n' + [
'.dsh-wt_updateBtn svg{width:12px;height:12px;flex:none}',
'.dsh-wt_updateBadge svg{width:12px;height:12px;flex:none}',
'.dsh-wt_updateBtn:hover{background:var(--dsw-alias-fill-l1,rgba(255,255,255,.06))}',
- '.dsh-wt_updateBtnCopy{border-color:var(--dsw-alias-state-accent-primary,#4f8ef7);background:rgba(79,142,247,.18);color:#cfe0ff}',
+ // 「复制 AI 提示词」主按钮:原来用 rgba(...,.18) 半透明底 + 浅蓝字,在实际主题上
+ // 对比度极低(截图里几乎看不见)。改为实心强调色 + 白字,hover/active 明确反馈。
+ '.dsh-wt_updateBtnCopy{border-color:transparent;background:var(--dsw-alias-state-accent-primary,#4f8ef7);color:#fff;font-weight:600}',
+ '.dsh-wt_updateBtnCopy:hover{background:var(--dsw-alias-state-accent-primary-hover,#3f7de0);color:#fff}',
+ '.dsh-wt_updateBtnCopy:active{transform:translateY(.5px)}',
'.dsh-wt_updateHint{font-size:10.5px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
'.dsh-wt_versionRow{margin-top:8px;padding-top:8px;border-top:1px solid var(--dsw-alias-border-l1,#262b36);display:flex;align-items:center;justify-content:space-between;font-size:11px;color:var(--dsw-alias-label-tertiary,#7d8aa5)}',
'.dsh-wt_updateToggle{display:flex;align-items:center;gap:6px;cursor:pointer;user-select:none}',
diff --git a/02_process/LOCAL-CHANGES.md b/02_process/LOCAL-CHANGES.md
index 64d1567..6ba94d1 100644
--- a/02_process/LOCAL-CHANGES.md
+++ b/02_process/LOCAL-CHANGES.md
@@ -4,9 +4,9 @@
> 每条标注日期、动机、落点与验证方式。改动在 `01_content/src/`,经 `npm run build`
> 产出 `lib/`;发布物由 `npm run pack`(`01_content/release-prep.mjs`)生成。
-当前版本:**0.5.3-local.9**(2026-12-02)
-产物:`01_content/dist/v0.5.3-local.9/dsh-worktable.tgz`,485483 字节,
-sha256 `888d4e8fa8d3201c61ed0f6d548afae4fcf052c96b2a2f8cd9e3a6e58206cfcb`
+当前版本:**0.5.3-local.10**(2026-12-02)
+产物:`01_content/dist/v0.5.3-local.10/dsh-worktable.tgz`,486219 字节,
+sha256 `2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
---
diff --git a/04_test/host-transport.test.mjs b/04_test/host-transport.test.mjs
index 6c1945d..f711beb 100644
--- a/04_test/host-transport.test.mjs
+++ b/04_test/host-transport.test.mjs
@@ -38,14 +38,19 @@ test('Unknown stream protocols are rejected', () => {
})
test('Web update instructions retain the web profile', () => {
- const { command, prompt, desktop } = worktableUpgrade('https:')
+ const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'https:')
assert.equal(desktop, false)
assert.match(command, /--profile web add/)
assert.match(prompt, /重启 dsh web/)
+ // 命令必须指向「要装的版本」,不能是当前已装版本(否则提示与命令自相矛盾)
+ assert.match(command, /\/releases\/download\/v0\.5\.3-local\.10\/dsh-worktable\.tgz/)
+ const older = worktableUpgrade('0.5.3-local.9', 'https:').command
+ assert.match(older, /v0\.5\.3-local\.9/)
+ assert.doesNotMatch(older, /v0\.5\.3-local\.10/)
})
test('Desktop update instructions require its bundled CLI and manual restart', () => {
- const { command, prompt, desktop } = worktableUpgrade('dsh-app:')
+ const { command, prompt, desktop } = worktableUpgrade('0.5.3-local.10', 'dsh-app:')
assert.equal(desktop, true)
assert.match(command, /--profile desktop add/)
assert.doesNotMatch(command, /--profile web/)
diff --git a/README.md b/README.md
index f692068..30c1cd4 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
> ## 📦 本仓库是内部补丁分发仓,不是上游源码仓
>
-> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.9`)。
+> 上游: | 本仓 = 上游 **v0.5.1** + 桌面端状态持久化补丁 + 本项目自用的若干增强(`0.5.3-local.10`)。
> 下面从「Screenshots」开始的全部内容是上游 README 原文;本地改动逐条记录见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md)。
### 要不要装
@@ -16,16 +16,16 @@
### 安装
-当前版本 **v0.5.3-local.9**:
+当前版本 **v0.5.3-local.10**:
```bash
-dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.9/dsh-worktable.tgz"
+dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/releases/download/v0.5.3-local.10/dsh-worktable.tgz"
```
- **桌面端:先完全退出 Slark,再执行命令**,装完手动重开;不要在宿主运行时安装。
- `--profile web` 按你自己的 profile 名字改。
-- 资产 `dsh-worktable.tgz`,485483 字节,sha256:
- `888d4e8fa8d3201c61ed0f6d548afae4fcf052c96b2a2f8cd9e3a6e58206cfcb`
+- 资产 `dsh-worktable.tgz`,486219 字节,sha256:
+ `2ff7d45a3ea1d0d2344a72f313439be7dacdf52a9e4c9317ba11b54e1f58945f`
(下载后可 `Get-FileHash dsh-worktable.tgz -Algorithm SHA256` 核对)
- 声明兼容的 DSH 版本:`0.2.0-rc.2` / `0.2.1-rc.3` / `0.2.1-rc.5` / `0.2.2-alpha.2`。
宿主不在这个列表里时,安装会被兼容性检查直接拒绝并回滚。
@@ -50,7 +50,7 @@ dsh plugin --profile web add "https://gitea.ququclean.com/xiaoqu/dsh-worktable/r
### 升级与回退
-- 装上 `0.5.3-local.9` 后,插件不会提示升级到 0.5.1。
+- 装上 `0.5.3-local.10` 后,插件不会提示升级到 0.5.1。
- 上游发布 0.5.2 及以上时插件会提示升级;**一旦升级就回到没有补丁的状态**,重启又会丢数据。新版本需要把补丁重新合并(改动清单见 [LOCAL-CHANGES.md](02_process/LOCAL-CHANGES.md))。
- 回退官方版:
```bash