@zaofan/dsh-qqbot 1.5.3 → 1.5.5
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.md +45 -0
- package/dist/commands/model.js +1 -1
- package/dist/commands/model.js.map +1 -1
- package/dist/features/extension-store.d.ts.map +1 -1
- package/dist/features/extension-store.js +19 -4
- package/dist/features/extension-store.js.map +1 -1
- package/dist/gateway/debounce.d.ts.map +1 -1
- package/dist/gateway/debounce.js +12 -0
- package/dist/gateway/debounce.js.map +1 -1
- package/dist/gateway/middleware-setup.d.ts.map +1 -1
- package/dist/gateway/middleware-setup.js +3 -0
- package/dist/gateway/middleware-setup.js.map +1 -1
- package/dist/middleware/media-history.d.ts +2 -0
- package/dist/middleware/media-history.d.ts.map +1 -1
- package/dist/middleware/media-history.js +32 -3
- package/dist/middleware/media-history.js.map +1 -1
- package/dist/model/model-resolver.d.ts +1 -1
- package/dist/model/model-resolver.d.ts.map +1 -1
- package/dist/model/model-resolver.js +5 -2
- package/dist/model/model-resolver.js.map +1 -1
- package/dist/session/session-manager.d.ts.map +1 -1
- package/dist/session/session-manager.js +17 -2
- package/dist/session/session-manager.js.map +1 -1
- package/dist/transport/inbound.d.ts.map +1 -1
- package/dist/transport/inbound.js +11 -4
- package/dist/transport/inbound.js.map +1 -1
- package/docs/USER-GUIDE.md +1 -1
- package/package.json +3 -2
- package/scripts/fix-dsh-016-presets.ps1 +133 -0
- package/settings-host.js +2 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
修复 dsh 0.1.5 → 0.1.6 升级后「自定义预设挂载失败」的问题。
|
|
4
|
+
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
dsh 0.1.6 把工作流执行器插件改了名,且**不保留别名**:
|
|
7
|
+
@deepseek-ai/dsh-workflow-worker-thread → @deepseek-ai/dsh-workflow-ptc
|
|
8
|
+
从旧版官方预设「复制」出来的自定义预设(~/.dsh/.agent-presets/<名字>/agent.cordis.yml)
|
|
9
|
+
仍然写着旧名,升级后恢复会话时会报:
|
|
10
|
+
preset "xxx" failed to mount: row "workflow-worker-thread"
|
|
11
|
+
names a plugin that cannot be resolved: @deepseek-ai/dsh-workflow-worker-thread
|
|
12
|
+
|
|
13
|
+
本脚本扫描预设并给出两类结果:
|
|
14
|
+
① 可自动改名:workflow-worker-thread → workflow-ptc、dsh-code-runtime → dsh-ptc-runtime
|
|
15
|
+
② 仅报告(需人工删行):dsh-code-runtime-worker-thread / dsh-tool-subagent-report / dsh-agent-spine-demo
|
|
16
|
+
|
|
17
|
+
默认 dry-run 只检查;加 -Apply 才写回,写前自动备份为 <文件>.bak-dsh016-<时间戳>。
|
|
18
|
+
|
|
19
|
+
.EXAMPLE
|
|
20
|
+
pwsh -File scripts/fix-dsh-016-presets.ps1 # 只检查(不改任何文件)
|
|
21
|
+
pwsh -File scripts/fix-dsh-016-presets.ps1 -Apply # 修复(自动备份)
|
|
22
|
+
pwsh -File scripts/fix-dsh-016-presets.ps1 -DshHome "D:\my-dsh" -Apply
|
|
23
|
+
#>
|
|
24
|
+
[CmdletBinding()]
|
|
25
|
+
param(
|
|
26
|
+
# 真正写回(不传则只检测)
|
|
27
|
+
[switch]$Apply,
|
|
28
|
+
# DSH 家目录;缺省用 $env:DSH_HOME,再缺省 ~/.dsh
|
|
29
|
+
[string]$DshHome = ''
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
$ErrorActionPreference = 'Stop'
|
|
33
|
+
|
|
34
|
+
if (-not $DshHome) { $DshHome = if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' } }
|
|
35
|
+
$presetRoot = Join-Path $DshHome '.agent-presets'
|
|
36
|
+
|
|
37
|
+
Write-Host "== dsh 0.1.6 预设兼容检查 ==" -ForegroundColor Cyan
|
|
38
|
+
Write-Host "DSH 家目录 : $DshHome"
|
|
39
|
+
Write-Host "预设目录 : $presetRoot"
|
|
40
|
+
Write-Host ("模式 : " + $(if ($Apply) { 'APPLY(会写回,自动备份)' } else { 'DRY-RUN(只检查)' }))
|
|
41
|
+
Write-Host ""
|
|
42
|
+
|
|
43
|
+
if (-not (Test-Path -LiteralPath $presetRoot)) {
|
|
44
|
+
Write-Host "预设目录不存在,无需处理。" -ForegroundColor Yellow
|
|
45
|
+
exit 0
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
# ── 规则表 ──
|
|
49
|
+
# 改名类:(正则) -> 替换值;用负向断言避免误伤带后缀的包名
|
|
50
|
+
$renames = @(
|
|
51
|
+
@{ Pattern = 'dsh-workflow-worker-thread'; Replace = 'dsh-workflow-ptc' },
|
|
52
|
+
@{ Pattern = 'workflow-worker-thread'; Replace = 'workflow-ptc' },
|
|
53
|
+
@{ Pattern = 'dsh-code-runtime(?![\w-])'; Replace = 'dsh-ptc-runtime' }
|
|
54
|
+
)
|
|
55
|
+
# 移除类:只报告
|
|
56
|
+
$removed = @('dsh-code-runtime-worker-thread', 'dsh-tool-subagent-report', 'dsh-agent-spine-demo')
|
|
57
|
+
|
|
58
|
+
$changedFiles = 0
|
|
59
|
+
$reportFiles = 0
|
|
60
|
+
$pass = @{
|
|
61
|
+
'dsh-workflow-worker-thread' = 'dsh-workflow-ptc'
|
|
62
|
+
'workflow-worker-thread' = 'workflow-ptc'
|
|
63
|
+
}
|
|
64
|
+
$yamlFiles = Get-ChildItem -LiteralPath $presetRoot -Recurse -File -Filter 'agent.cordis.yml' -ErrorAction SilentlyContinue |
|
|
65
|
+
Where-Object { $_.FullName -notmatch '\.bak' }
|
|
66
|
+
|
|
67
|
+
if (-not $yamlFiles) {
|
|
68
|
+
Write-Host "没找到任何 agent.cordis.yml。" -ForegroundColor Yellow
|
|
69
|
+
exit 0
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
foreach ($f in $yamlFiles) {
|
|
73
|
+
$lines = @(Get-Content -LiteralPath $f.FullName -Encoding utf8)
|
|
74
|
+
$out = New-Object System.Collections.Generic.List[string]
|
|
75
|
+
$presetName = Split-Path (Split-Path $f.FullName -Parent) -Leaf
|
|
76
|
+
$notes = @()
|
|
77
|
+
$touched = $false
|
|
78
|
+
|
|
79
|
+
foreach ($line in $lines) {
|
|
80
|
+
$newLine = $line
|
|
81
|
+
# ⚠️ 注释行不动:预设里常有「v0.1.6 起 xxx 改名为 yyy」这类说明文字,
|
|
82
|
+
# 提到旧名不代表真的引用它(早先版本按整文件匹配会误报)。
|
|
83
|
+
$isComment = $line.TrimStart().StartsWith('#')
|
|
84
|
+
if (-not $isComment) {
|
|
85
|
+
# ① 移除类(只报告)
|
|
86
|
+
foreach ($pkg in $removed) {
|
|
87
|
+
if ($newLine -match [regex]::Escape($pkg)) { $notes += "需人工删行: $pkg" }
|
|
88
|
+
}
|
|
89
|
+
# ② 改名类
|
|
90
|
+
foreach ($r in $renames) {
|
|
91
|
+
if ($newLine -match $r.Pattern) {
|
|
92
|
+
$newLine = [regex]::Replace($newLine, $r.Pattern, $r.Replace)
|
|
93
|
+
$notes += ("改名: " + $r.Pattern + " → " + $r.Replace)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if ($newLine -ne $line) { $touched = $true }
|
|
97
|
+
}
|
|
98
|
+
$out.Add($newLine)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
$notes = @($notes | Select-Object -Unique)
|
|
102
|
+
if ($notes.Count -eq 0) { continue }
|
|
103
|
+
|
|
104
|
+
Write-Host ("[$presetName]") -ForegroundColor White
|
|
105
|
+
$notes | ForEach-Object { Write-Host (" - " + $_) }
|
|
106
|
+
Write-Host (" 文件: " + $f.FullName)
|
|
107
|
+
|
|
108
|
+
if ($touched) {
|
|
109
|
+
if ($Apply) {
|
|
110
|
+
$bak = $f.FullName + '.bak-dsh016-' + (Get-Date -Format 'yyyyMMdd-HHmmss')
|
|
111
|
+
Copy-Item -LiteralPath $f.FullName -Destination $bak -Force
|
|
112
|
+
Set-Content -LiteralPath $f.FullName -Value ($out -join [Environment]::NewLine) -Encoding utf8
|
|
113
|
+
Write-Host (" ✔ 已修复(备份: " + (Split-Path $bak -Leaf) + ")") -ForegroundColor Green
|
|
114
|
+
} else {
|
|
115
|
+
Write-Host " → 加 -Apply 即执行修复" -ForegroundColor DarkGray
|
|
116
|
+
}
|
|
117
|
+
$changedFiles++
|
|
118
|
+
} else {
|
|
119
|
+
Write-Host " (仅注释/无需改动)" -ForegroundColor DarkGray
|
|
120
|
+
}
|
|
121
|
+
$reportFiles++
|
|
122
|
+
Write-Host ""
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
Write-Host "== 结果 ==" -ForegroundColor Cyan
|
|
126
|
+
if ($reportFiles -eq 0) {
|
|
127
|
+
Write-Host "✅ 未发现 dsh 0.1.6 不兼容的插件名,预设干净。" -ForegroundColor Green
|
|
128
|
+
} else {
|
|
129
|
+
Write-Host ("发现 " + $reportFiles + " 个预设受影响,其中可自动修复 " + $changedFiles + " 个。")
|
|
130
|
+
if (-not $Apply) { Write-Host "(当前是 DRY-RUN,未改动任何文件;确认后加 -Apply 重跑)" -ForegroundColor Yellow }
|
|
131
|
+
}
|
|
132
|
+
Write-Host ""
|
|
133
|
+
Write-Host "提示:改完后重启 dsh(dsh web / dsh --profile <名字>)让预设重新挂载。" -ForegroundColor DarkGray
|
package/settings-host.js
CHANGED
|
@@ -752,7 +752,7 @@ export function apply(ctx) {
|
|
|
752
752
|
return dir;
|
|
753
753
|
}
|
|
754
754
|
function presetWritable(id) {
|
|
755
|
-
//
|
|
755
|
+
// 安全规则: 仅"复制出来带 QQ 工具标记"的预设可改写(底层/实验预设保持只读)。
|
|
756
756
|
const p = scanPresets().find((x) => x.id === id);
|
|
757
757
|
return !!(p && p.hasChannelTools);
|
|
758
758
|
}
|
|
@@ -777,7 +777,7 @@ export function apply(ctx) {
|
|
|
777
777
|
if (!dir || !PRESET_EDIT_EXT.test(name)) return writeJson(res, 400, { error: '参数不合法' });
|
|
778
778
|
const p = join(dir, name);
|
|
779
779
|
if (!existsSync(p) || !resolve(p).startsWith(resolve(dir) + sep)) return writeJson(res, 404, { error: '文件不存在' });
|
|
780
|
-
if (!presetWritable(id)) return writeJson(res, 403, { error: '安全限制: 仅"带QQ工具标记"的复制预设可改写(
|
|
780
|
+
if (!presetWritable(id)) return writeJson(res, 403, { error: '安全限制: 仅"带QQ工具标记"的复制预设可改写(底层预设只读)' });
|
|
781
781
|
const content = String(body?.content ?? '');
|
|
782
782
|
if (Buffer.byteLength(content, 'utf8') > PRESET_EDIT_MAX) return writeJson(res, 400, { error: '内容过大(上限 200KB)' });
|
|
783
783
|
try {
|