@dsh-plugins/dsh-llm-hub 1.9.7 → 1.9.8
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 +12 -0
- package/README.md +4 -4
- package/package.json +2 -2
- package/scripts/version-sync-gate.mjs +197 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循 [Semantic Versioning](https://semver.org/lang/zh-CN/)。
|
|
4
4
|
|
|
5
|
+
## [1.9.8](https://github.com/webkubor/dsh-llm-hub/compare/v1.9.7...v1.9.8) (2026-10-28)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **test:** README 旧包名守卫误报 CDN 图片地址 ([1709d25](https://github.com/webkubor/dsh-llm-hub/commit/1709d257904b8ad0caabd479ccc2af88cc7cd3e6))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### 📝 Documentation
|
|
14
|
+
|
|
15
|
+
* README 素材迁入 free-imgbed 图床(本地相对路径 → CDN 直链) ([34c7aad](https://github.com/webkubor/dsh-llm-hub/commit/34c7aad183c3c2f942cf1a17452a1fecfcc3cbeb))
|
|
16
|
+
|
|
5
17
|
## [1.9.7](https://github.com/webkubor/dsh-llm-hub/compare/v1.9.6...v1.9.7) (2026-10-25)
|
|
6
18
|
|
|
7
19
|
|
package/README.md
CHANGED
|
@@ -71,14 +71,14 @@ npx @deepseek-ai/dsh plugin --profile <你的 profile> add @dsh-plugins/dsh-llm-
|
|
|
71
71
|
1. **套餐 vs 按量付费**:每个 provider 卡片新增 billing capsule,左边"按量付费"右边"套餐",
|
|
72
72
|
自动按 5 层 fallback 识别云端账单类型(settings → `/status` → `/token_plan/remains`
|
|
73
73
|
→ `/usage/quota/limit` → `/user/balance`),手动点另一边切模式即写回 settings。
|
|
74
|
-

|
|
75
75
|
2. **LLM 下拉套餐优先**:composer 模型选择器按当前 provider 的 billingMode 把套餐模型
|
|
76
76
|
置顶(绿色「套餐」徽章段),按量模型跟在后面。**不**自动改路由、不隐藏按量。
|
|
77
|
-

|
|
78
78
|
3. **家族面板真实激活探测(修 bug)**:设置 → 模型 → 底部「Webkubor DSH 扩展家族」,
|
|
79
79
|
之前的版本不管装几个插件永远只亮自己。改读 `window.__DSH_BOOT__.entries`
|
|
80
80
|
做真实激活探测,读不到时显示「判定不可用」而非谎报「没装」。
|
|
81
|
-

|
|
82
82
|
|
|
83
83
|
升级:
|
|
84
84
|
|
|
@@ -502,7 +502,7 @@ publish。Release 的存在性单独探测,所以「npm 发成功但 Release
|
|
|
502
502
|
|
|
503
503
|
```bash
|
|
504
504
|
PROFILE=<你的 profile>
|
|
505
|
-
npx -y @deepseek-ai/dsh plugin --profile "$PROFILE" add dsh-bloom-theme @dsh-plugins/dsh-llm-hub
|
|
505
|
+
npx -y @deepseek-ai/dsh plugin --profile "$PROFILE" add dsh-bloom-theme @dsh-plugins/dsh-llm-hub && PROFILE="$PROFILE" node -e 'const f=(process.env.DSH_HOME||require("os").homedir()+"/.dsh")+"/profiles/"+process.env.PROFILE+"/package.json",p=require(f),b=p.dsh.profile.bundles;for(const n of Object.keys(p.dependencies))if(/^(dsh-bloom-theme|@dsh-plugins\/)/.test(n)&&!b.includes(n))b.push(n);require("fs").writeFileSync(f,JSON.stringify(p,null,2)+"\n")'
|
|
506
506
|
```
|
|
507
507
|
|
|
508
508
|
> **桌面端用户**:官方 Electron 端独占 `desktop` profile,命令行对它做插件操作会被拒
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dsh-plugins/dsh-llm-hub",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.8",
|
|
4
4
|
"description": "DSH 模型管理层:网关可达性探测、模型目录拉取、DeepSeek + MiniMax/智谱/Moonshot/StepFun 余额与配额、本月用量统计、余额预警、Provider 健康看板,再把本机装好的 codex / claude / agy 注册成子代理(装了才出现)。零运行时依赖,不改动 DSH 安装。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"preview": "npm run deploy && echo '部署完成 —— 到桌面端应用里重载页面(它不是浏览器,没有可 open 的 URL)'",
|
|
33
33
|
"check": "for f in lib/*.js; do node --check \"$f\" || exit 1; done",
|
|
34
34
|
"test": "node --test",
|
|
35
|
-
"prepublishOnly": "npm run check && npm test && node scripts/prepublish-gate.mjs && node scripts/readme-gate.mjs"
|
|
35
|
+
"prepublishOnly": "npm run check && npm test && node scripts/prepublish-gate.mjs && node scripts/readme-gate.mjs && node scripts/version-sync-gate.mjs"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
38
|
"dsh",
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* version-sync-gate —— 发版时的「版本号 → 文档」同步门禁
|
|
4
|
+
*
|
|
5
|
+
* 🔴 本文件是真源,只在这里改。各仓的拷贝用同步脚本下发:
|
|
6
|
+
* node $CORTEXOS_ROOT/scripts/check-release-gate-sync.mjs --fix
|
|
7
|
+
*
|
|
8
|
+
* ## 为什么需要它
|
|
9
|
+
*
|
|
10
|
+
* prepublish-gate 保证 CHANGELOG 有当前版本段、README 首屏合规,但**没有一条门禁
|
|
11
|
+
* 在发新版时把版本号同步进「记录当前版本」的文档**。于是出现最常见的老化:
|
|
12
|
+
* · 工作区台账 `vite-plugins/README.md` 版本列停在上个版本
|
|
13
|
+
* · 包自带的 SKILL.md frontmatter `version` 停在更早的版本(`cs skill validate` 会
|
|
14
|
+
* 因此标红 —— 仓打 tag 时 SKILL.md version 必须同步,这是 SKILL_SPEC 的强同步规则)
|
|
15
|
+
*
|
|
16
|
+
* 这与 prepublish-gate 的出发点相同:**约定没做成门禁,就会烂。**
|
|
17
|
+
*
|
|
18
|
+
* ## 设计取舍
|
|
19
|
+
*
|
|
20
|
+
* 仓库文档里有两类「版本相关的数字」,语义完全不同,必须分开对待:
|
|
21
|
+
*
|
|
22
|
+
* ① **台账版本列 + SKILL.md version** ——「这个插件当前是几版 / 这个 skill 是几版」,
|
|
23
|
+
* 语义就是 package.json 的 version,随发版**必须**同步。→ 自动改写。
|
|
24
|
+
* ② **功能引入版本**(文档站里 `0.10.0+` / `0.14.0+` 这类标记)——「这个功能
|
|
25
|
+
* 是哪个版本引入的」,语义是历史事实,**不随新版本变**。→ 绝不改写。
|
|
26
|
+
*
|
|
27
|
+
* ## 契约
|
|
28
|
+
* 契约 A 台账同步 —— 若 `<pkgRoot>/../README.md`(工作区台账)里有一行以该包名开头、
|
|
29
|
+
* 内嵌包名的表格行,则把该行尾部的版本号改写为 `package.json#version`。
|
|
30
|
+
* 找不到包对应行 → 拦(该插件没登记进分类台账)。
|
|
31
|
+
* 契约 B SKILL.md 同步 —— 若包根存在 `SKILL.md`,把其 frontmatter 的 `version:` 改写为
|
|
32
|
+
* `package.json#version`(版本号`## 如何同步 SKILL.md`)。缺 SKILL.md 时跳过(非必填)。
|
|
33
|
+
* 契约 C 可重复 —— A/B 改写后立即重复(同样的 version)仍为幂等,不产生 diff。
|
|
34
|
+
*
|
|
35
|
+
* 逃生舱:VERSION_SYNC_OFF=1 全跳过;VERSION_SYNC_DRY_RUN=1 只报告不改写(用于首次接入审计)。
|
|
36
|
+
*/
|
|
37
|
+
import { readFileSync, writeFileSync, existsSync } from 'node:fs'
|
|
38
|
+
import { dirname, join } from 'node:path'
|
|
39
|
+
import { fileURLToPath } from 'node:url'
|
|
40
|
+
|
|
41
|
+
const GATE_VERSION = 4
|
|
42
|
+
const NAME = 'version-sync-gate'
|
|
43
|
+
const here = dirname(fileURLToPath(import.meta.url))
|
|
44
|
+
// 目标包目录:可显式传参(多仓批处理/CI 用),默认取脚本所在目录的上一层(本脚本拷贝在 <pkg>/scripts/ 下)。
|
|
45
|
+
const targetArg = process.argv[2]
|
|
46
|
+
const pkgRoot = targetArg
|
|
47
|
+
? (targetArg.startsWith('/') || targetArg.startsWith('~') ? targetArg : join(process.cwd(), targetArg))
|
|
48
|
+
: dirname(here)
|
|
49
|
+
|
|
50
|
+
const errors = []
|
|
51
|
+
const notes = []
|
|
52
|
+
|
|
53
|
+
if (String(process.env.VERSION_SYNC_OFF).toLowerCase() === '1' ||
|
|
54
|
+
String(process.env.VERSION_SYNC_OFF).toLowerCase() === 'true') {
|
|
55
|
+
console.log(`[${NAME}] ↩ VERSION_SYNC_OFF=1 —— 跳过所有检查`)
|
|
56
|
+
process.exit(0)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const DRY_RUN = String(process.env.VERSION_SYNC_DRY_RUN).toLowerCase() === '1' ||
|
|
60
|
+
String(process.env.VERSION_SYNC_DRY_RUN).toLowerCase() === 'true'
|
|
61
|
+
|
|
62
|
+
const pkg = JSON.parse(readFileSync(join(pkgRoot, 'package.json'), 'utf8'))
|
|
63
|
+
const version = String(pkg.version ?? '')
|
|
64
|
+
if (!/^\d+\.\d+\.\d+$/.test(version)) {
|
|
65
|
+
console.error(`[${NAME}] ✖ package.json version 不是合法 SemVer: ${version}`)
|
|
66
|
+
process.exit(1)
|
|
67
|
+
}
|
|
68
|
+
const fileName = (pkg.name.split('/').pop() ?? '')
|
|
69
|
+
// 台账里包名可能以两种形式出现:去 scope 的目录名(`pkg/`)或完整 scope 名(`@scope/pkg`)。
|
|
70
|
+
const pkgNames = new Set([fileName, pkg.name])
|
|
71
|
+
|
|
72
|
+
// ── 契约 A:父目录台账版本列 ────────────────────────────────────────────────
|
|
73
|
+
const ledger = join(pkgRoot, '..', 'README.md')
|
|
74
|
+
if (existsSync(ledger)) {
|
|
75
|
+
const raw = readFileSync(ledger, 'utf8')
|
|
76
|
+
const lines = raw.split(/\r?\n/)
|
|
77
|
+
// 定位含 `[<包名>` 的表格行。行首链接可能用去 scope 的目录名 `[pkg/`,也可能用完整 scope 名 `[@scope/pkg/`。
|
|
78
|
+
const escFull = pkg.name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
79
|
+
const rowLead = new Set([fileName, pkg.name])
|
|
80
|
+
const rowLeadAlt = [...rowLead].map(s => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&').replace(/\//g, '\\/')).join('|')
|
|
81
|
+
const rowRe = new RegExp(`^\\|\\s*\\[\\s*[\`](?:${rowLeadAlt})\\/?[\`]?`, 'i')
|
|
82
|
+
let idx = -1
|
|
83
|
+
for (let i = 0; i < lines.length; i++) { if (rowRe.test(lines[i])) { idx = i; break } }
|
|
84
|
+
if (idx < 0) {
|
|
85
|
+
// 台账整体是不是「版本表格」?不是的话,契约 A 对这个仓**不适用** ——
|
|
86
|
+
// 那种台账是组件清单(`- **\`pkg/\`**:说明」),本来就没有版本列可同步。
|
|
87
|
+
// 2026-10-28 之前这里一律报「没登记 → 拦」,于是 museav-cli 这种仓一装这道门禁
|
|
88
|
+
// 就永久 exit 1、发版直接卡死 —— 实际它压根没有需要同步的版本号
|
|
89
|
+
// (无 SKILL.md、台账行不带版本)。
|
|
90
|
+
// 「台账没有版本列」与「该仓漏登记进台账」是两回事,必须分开判。
|
|
91
|
+
const tableRows = lines.filter(l => /^\|.*\|/.test(l.trim()) && l.trim().length > 2)
|
|
92
|
+
if (tableRows.length === 0) {
|
|
93
|
+
// 台账不是表格格式 → 契约 A 不适用,跳过(不算失败)
|
|
94
|
+
console.log(`[${NAME}] · 台账 ${ledger} 不是版本表格格式(无表格行)—— 契约 A 不适用,跳过`)
|
|
95
|
+
} else {
|
|
96
|
+
errors.push(
|
|
97
|
+
`台账 ${ledger} 里没有 ${pkg.name} 对应行(判据:以 | [\`${fileName}/` + '` 开头的表格行)。\n' +
|
|
98
|
+
` → 该插件未登记进分类台账,或台账是老式 markdown 列表而非表格。发版后台账仍会是空的/旧的,先补登记。`
|
|
99
|
+
)
|
|
100
|
+
}
|
|
101
|
+
} else {
|
|
102
|
+
const row = lines[idx]
|
|
103
|
+
// 按表格单元拆分:| a | b | ... | → ["a","b",...]。单元内可能含 `code`、加粗、链接。
|
|
104
|
+
// 版本号不总是最后一行 token —— dsh 台账在第 4 列版本后面还有「谁在用」列。
|
|
105
|
+
// 判据:找到「剔除非字符后与包名一致」的那个单元,把它后面第一个纯 semver 单元当作版本列改写。
|
|
106
|
+
const cells = row.split('|').slice(1, -1).map(c => c.trim())
|
|
107
|
+
// 查找包名单元:该单元格以 Markdown 链接或裸名开头,且**不含 `]`**(链接单元格里 `](` 后是相对路径,
|
|
108
|
+
// 若把整格剥到只剩屏显文本再判,会把 `](new/` 当成分隔 —— 所以这里只看单元格前缀是否命中包名)。
|
|
109
|
+
const pkgNameEsc = (pkg.name.match(/[^/]+\/?$/) ?? [fileName])[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
110
|
+
const nameRe = new RegExp(`^(?:${fileName}\\b|${pkgNameEsc}\\b|\\[\\s*[\`]?(?:${fileName}|${pkgNameEsc}))`, 'i')
|
|
111
|
+
let pkgCol = -1
|
|
112
|
+
for (let i = 0; i < cells.length; i++) {
|
|
113
|
+
if (nameRe.test(cells[i])) { pkgCol = i; break }
|
|
114
|
+
}
|
|
115
|
+
if (pkgCol < 0) {
|
|
116
|
+
errors.push(`台账行(第 ${idx + 1} 行)里没找到包名单元 ${pkg.name}: ${row}`)
|
|
117
|
+
} else {
|
|
118
|
+
// 从包名后面找「纯 semver」单元格(版本列)。版本号后面可能还有其它列(如「谁在用」),
|
|
119
|
+
// 也可能嵌在备注里(`0.14.0 起`/`1.5.3` 这种)——它必然带后续文字。
|
|
120
|
+
let verCol = -1
|
|
121
|
+
for (let i = pkgCol + 1; i < cells.length; i++) {
|
|
122
|
+
const c = cells[i]
|
|
123
|
+
// 剥掉反引号围栏后必须是纯 semver(`0.1.0` / 0.1.0 都认);museav` 这类带尾注的忽略
|
|
124
|
+
const verMatch = c.match(/^`?(\d+\.\d+\.\d+)`?$/)
|
|
125
|
+
if (verMatch) { verCol = i; break }
|
|
126
|
+
if (/^\d+\.\d+\.\d+/.test(c)) {
|
|
127
|
+
// 带后续文字/括号 → 不是版本列
|
|
128
|
+
const rest = c.replace(/^\d+\.\d+\.\d+/, '').trim()
|
|
129
|
+
if (rest === '' || /^[-_!#?]/.test(rest)) { verCol = i; break }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
if (verCol < 0) {
|
|
133
|
+
errors.push(`台账行(第 ${idx + 1} 行)里找不到版本列(${pkg.name} 包名后没有纯 semver 单元): ${row}`)
|
|
134
|
+
} else {
|
|
135
|
+
const oldV = cells[verCol]
|
|
136
|
+
// 按列改写而不是重组整行:cells 已经去了 trim 和围栏,重组会丢掉单元格内的反引号/链接。
|
|
137
|
+
// 逐步定位到目标单元格,只替换其内部版本号。
|
|
138
|
+
const segs = row.split('|')
|
|
139
|
+
let cellIdx = 0
|
|
140
|
+
for (let i = 1; i < segs.length - 1; i++) {
|
|
141
|
+
// 跳过边框(空)段;行为与 cells 的切分一一对应
|
|
142
|
+
if (i === 1 && segs[i].trim() === '') continue
|
|
143
|
+
if (cellIdx === verCol) {
|
|
144
|
+
segs[i] = segs[i].replace(/\d+\.\d+\.\d+/, version)
|
|
145
|
+
break
|
|
146
|
+
}
|
|
147
|
+
cellIdx++
|
|
148
|
+
}
|
|
149
|
+
const newRow = segs.join('|')
|
|
150
|
+
if (row !== newRow) {
|
|
151
|
+
notes.push(`台账行版本 ${oldV} → ${version}`)
|
|
152
|
+
if (!DRY_RUN) { lines[idx] = newRow; writeFileSync(ledger, lines.join('\n'), 'utf8') }
|
|
153
|
+
else notes.push(`(DRY_RUN:台账第 ${idx + 1} 行未落盘)`)
|
|
154
|
+
} else {
|
|
155
|
+
notes.push(`台账行已是 ${version},幂等无改动`)
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
} else {
|
|
161
|
+
notes.push(`未发现父目录台账 ${ledger}(此包可能不在归类目录下)——跳过台账同步`)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ── 契约 B:包内 SKILL.md frontmatter version ──────────────────────────────
|
|
165
|
+
// SKILL_SPEC 强同步规则:仓打 tag 时 SKILL.md version 必须等于包版本,否则 cs skill validate 标红。
|
|
166
|
+
const skillPath = join(pkgRoot, 'SKILL.md')
|
|
167
|
+
if (existsSync(skillPath)) {
|
|
168
|
+
const skillText = readFileSync(skillPath, 'utf8')
|
|
169
|
+
const fmRe = /^(\s*version\s*:\s*)[^\s]+(\s*)$/m
|
|
170
|
+
if (fmRe.test(skillText)) {
|
|
171
|
+
const newText = skillText.replace(fmRe, (_, pre, post) => pre + version + post)
|
|
172
|
+
if (newText !== skillText) {
|
|
173
|
+
const oldV = skillText.match(fmRe)?.[0].trim()
|
|
174
|
+
notes.push(`SKILL.md frontmatter version ${oldV?.split(':').pop()?.trim()} → ${version}`)
|
|
175
|
+
if (!DRY_RUN) writeFileSync(skillPath, newText, 'utf8')
|
|
176
|
+
else notes.push(`(DRY_RUN:SKILL.md version 未落盘)`)
|
|
177
|
+
} else {
|
|
178
|
+
notes.push(`SKILL.md version 已是 ${version},幂等无改动`)
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
notes.push(`SKILL.md 没有 version 字段——SKILL_SPEC 要求必填,建议补充(本次不拦)`)
|
|
182
|
+
}
|
|
183
|
+
} else {
|
|
184
|
+
notes.push(`包根无 SKILL.md——跳过 SKILL version 同步(非必填)`)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// ── 报告 ──────────────────────────────────────────────────────────────────
|
|
188
|
+
if (errors.length > 0) {
|
|
189
|
+
console.error(`\n[${NAME}] ${errors.length} 条契约不满足:\n`)
|
|
190
|
+
for (const e of errors) console.error(' ✖', e)
|
|
191
|
+
console.error(`\n[${NAME}] exit 1 → 发布中止。修完再推。`)
|
|
192
|
+
process.exit(1)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
console.log(`[${NAME}] ✓ ${pkg.name}@${version} 版本同步通过(gate v${GATE_VERSION})`)
|
|
196
|
+
if (DRY_RUN) console.log(`[${NAME}] · DRY_RUN 模式:只报告,未改写`)
|
|
197
|
+
for (const n of notes) console.log(`[${NAME}] · ${n}`)
|