dsh-xdpool 2.7.4 → 3.0.0
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 +151 -0
- package/assets/dashboard.png +0 -0
- package/lib/bin.js +425 -11
- package/lib/client.js +15716 -14212
- package/lib/index.d.ts +136 -4
- package/lib/index.js +11648 -1160
- package/package.json +6 -3
- package/scripts/extract-design-css.mjs +322 -0
- package/scripts/link-host-peers.mjs +3 -3
- package/scripts/make-rail-icons.mjs +46 -0
- package/scripts/probe-channels.mjs +142 -0
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-xdpool",
|
|
3
3
|
"displayName": "DSH XD Pool",
|
|
4
|
-
"description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to
|
|
5
|
-
"version": "
|
|
4
|
+
"description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to 22 vendors by QR/web, aggregate 77 external vendors' keys, plus a usage dashboard, model routing, a local OpenAI-compatible gateway and a points-automation suite.",
|
|
5
|
+
"version": "3.0.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "XDTrees",
|
|
8
8
|
"homepage": "https://github.com/XDTrees/dsh-xdpool#readme",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"test": "vitest run",
|
|
61
61
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
62
62
|
"typecheck:client": "tsc -p tsconfig.client.json --noEmit",
|
|
63
|
-
"
|
|
63
|
+
"probe": "node scripts/probe-channels.mjs"
|
|
64
64
|
},
|
|
65
65
|
"dsh": {
|
|
66
66
|
"bundle": {
|
|
@@ -132,5 +132,8 @@
|
|
|
132
132
|
"@deepseek-ai/dsh-credentials": {
|
|
133
133
|
"optional": true
|
|
134
134
|
}
|
|
135
|
+
},
|
|
136
|
+
"pnpm": {
|
|
137
|
+
"onlyBuiltDependencies": []
|
|
135
138
|
}
|
|
136
139
|
}
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设计稿的骨架接管层。
|
|
3
|
+
*
|
|
4
|
+
* 用户的原话:「你就只加载我们设计的,不用之前的元素了」。
|
|
5
|
+
*
|
|
6
|
+
* 这一份把插件多出来的三层(.body / .shellpanel / .shell)压平,让插件的
|
|
7
|
+
* DOM 表现得和设计稿的 `.app > rail + list + main` 一样,然后用设计稿的
|
|
8
|
+
* CSS 原样接管外观。
|
|
9
|
+
*
|
|
10
|
+
* 为什么不直接改 DOM:那三层被 tests 和几处兼容代码依赖(见 shell.tsx 的
|
|
11
|
+
* 注释),删掉会连带断掉十几处。压平成同样的视觉与尺寸,效果一样而风险小。
|
|
12
|
+
*/
|
|
13
|
+
import { readFileSync, writeFileSync } from 'node:fs'
|
|
14
|
+
|
|
15
|
+
const DESIGN = 'D:/dsh-home/xdpool-design'
|
|
16
|
+
|
|
17
|
+
const tokens = readFileSync(`${DESIGN}/tokens.css`, 'utf8')
|
|
18
|
+
const app = readFileSync(`${DESIGN}/app.css`, 'utf8')
|
|
19
|
+
const colors = readFileSync(`${DESIGN}/channel-colors.css`, 'utf8')
|
|
20
|
+
/*
|
|
21
|
+
mobile.css:窄屏适配的那批规则(.dock / .list-credit / 表格在窄屏下的折叠)。
|
|
22
|
+
|
|
23
|
+
之前没读它,于是 760px 窗口里手机的布局规则一条都没生效 ——
|
|
24
|
+
页面靠 app.css 的媒体查询勉强撑着,但那些是「缩小」,不是「重排」。
|
|
25
|
+
文件不存在时跳过,不打断构建。
|
|
26
|
+
*/
|
|
27
|
+
/*
|
|
28
|
+
icons.css:20 家厂商的图标(base64),写成 --icon-* 变量。
|
|
29
|
+
这是插件「13 家没有图标」的答案 —— 设计稿早就画好了,
|
|
30
|
+
只是提取脚本从来没读过这个文件。
|
|
31
|
+
*/
|
|
32
|
+
let icons = ''
|
|
33
|
+
try { icons = readFileSync(`${DESIGN}/icons.css`, 'utf8') } catch { icons = '' }
|
|
34
|
+
|
|
35
|
+
let mobile = ''
|
|
36
|
+
try { mobile = readFileSync(`${DESIGN}/mobile.css`, 'utf8') } catch { mobile = '' }
|
|
37
|
+
|
|
38
|
+
/** build-a.mjs 里的页面级 CSS(.kpi / .acct / .policy / .seg …)。 */
|
|
39
|
+
function pageCss() {
|
|
40
|
+
/*
|
|
41
|
+
所有 build-*.mjs 的页面级 CSS,**加上每个 html 里 <style> 块的规则**。
|
|
42
|
+
|
|
43
|
+
两处都有:build-*.mjs 里是生成脚本用的 CSS 常量,而设计稿最终落地的
|
|
44
|
+
html 里还有一段 <style>(每个页面自己的),两者不完全重合。
|
|
45
|
+
只读 mjs 会漏掉 .summary 的主规则 —— 结果只剩下媒体查询里的降级版本,
|
|
46
|
+
六格的汇总条被压成三列。
|
|
47
|
+
*/
|
|
48
|
+
const FILES = ['build-a', 'build-login', 'build-aggregate', 'build-pick',
|
|
49
|
+
'build-ledger', 'build-b', 'build-c', 'build-d', 'build-marvis']
|
|
50
|
+
const out = []
|
|
51
|
+
for (const file of FILES) {
|
|
52
|
+
let src = ''
|
|
53
|
+
try {
|
|
54
|
+
src = readFileSync(`${DESIGN}/${file}.mjs`, 'utf8')
|
|
55
|
+
} catch {
|
|
56
|
+
continue
|
|
57
|
+
}
|
|
58
|
+
for (const m of src.matchAll(/const\s+\w+\s*=\s*`([\s\S]*?)`/gu)) {
|
|
59
|
+
const body = m[1]
|
|
60
|
+
if (body.includes('{') && body.includes('.') && !body.includes('import ')) out.push(body)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/*
|
|
64
|
+
每个 html 的 <style> 块 —— 扫目录,不写死清单。
|
|
65
|
+
|
|
66
|
+
写死清单漏过 aggregate-models.html,于是 .mp-row / .mp-name / .mp-id
|
|
67
|
+
这些规则从来没被提取出来:插件用了类名,但没有任何样式命中它们。
|
|
68
|
+
以后设计稿再加页面也不用回来改这里。
|
|
69
|
+
*/
|
|
70
|
+
let htmls = []
|
|
71
|
+
try {
|
|
72
|
+
htmls = readdirSync(DESIGN).filter(f => f.endsWith('.html'))
|
|
73
|
+
} catch {
|
|
74
|
+
htmls = []
|
|
75
|
+
}
|
|
76
|
+
for (const file of htmls) {
|
|
77
|
+
let src = ''
|
|
78
|
+
try {
|
|
79
|
+
src = readFileSync(`${DESIGN}/${file}`, 'utf8')
|
|
80
|
+
} catch {
|
|
81
|
+
continue
|
|
82
|
+
}
|
|
83
|
+
for (const m of src.matchAll(/<style>([\s\S]*?)<\/style>/gu)) out.push(m[1])
|
|
84
|
+
}
|
|
85
|
+
return out.join('\n')
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** body/html 那些全局规则去掉 —— 插件在宿主的对话框里,不该改宿主。 */
|
|
89
|
+
const scoped = app
|
|
90
|
+
.replace(/html,\s*body\s*\{[^}]*\}/gu, '')
|
|
91
|
+
/* 全局 box-sizing 收进 .app 作用域,不改宿主 */
|
|
92
|
+
.replace(/^\s*\*\s*\{\s*box-sizing:\s*border-box;?\s*\}/gmu, '.app, .app * { box-sizing: border-box }')
|
|
93
|
+
/* :root 里的变量改成挂在 .app 上,不污染宿主 */
|
|
94
|
+
.replace(/^:root\s*\{/gmu, '.app {')
|
|
95
|
+
// 全局元素选择器删掉 —— 上面已经在 .app 里重新声明过了
|
|
96
|
+
.replace(/^button,\s*input,\s*select\s*\{[^}]*\}/gmu, '')
|
|
97
|
+
.replace(/^button\s*\{[^}]*\}/gmu, '')
|
|
98
|
+
.replace(/^button:disabled\s*\{[^}]*\}/gmu, '')
|
|
99
|
+
.replace(/::-webkit-scrollbar/gu, '.app ::-webkit-scrollbar')
|
|
100
|
+
|
|
101
|
+
const bridge = `
|
|
102
|
+
/* ============================================================
|
|
103
|
+
唯一的一条 bridge:把设计稿 body 上的排版落到 .app
|
|
104
|
+
------------------------------------------------------------
|
|
105
|
+
设计稿在 body 上定字号、字体、颜色;插件跑在宿主的对话框里,不能改 body。
|
|
106
|
+
所以把同样的声明放在 .app 上。
|
|
107
|
+
|
|
108
|
+
除此之外不再有第二条针对 dsm-xdpool-* 的规则 —— 前面几轮那些
|
|
109
|
+
「.dsm-xdpool-frame { grid-template-columns: ... }」和设计稿的 .app
|
|
110
|
+
抢同一个属性,谁赢取决于加载顺序,改一次生效一次不生效一次,
|
|
111
|
+
排查了很久才发现是规则在互相盖。一套类名配一份 CSS,不留 bridge。
|
|
112
|
+
============================================================ */
|
|
113
|
+
|
|
114
|
+
.app {
|
|
115
|
+
/* body 的背景色也要带过来 —— 插件靠宿主给底色的话,浅色主题下会串色 */
|
|
116
|
+
background: var(--bg);
|
|
117
|
+
font-family: var(--sans);
|
|
118
|
+
font-size: var(--fs-sm);
|
|
119
|
+
line-height: 1.65;
|
|
120
|
+
color: var(--text);
|
|
121
|
+
-webkit-font-smoothing: antialiased;
|
|
122
|
+
text-rendering: optimizeLegibility;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/* ============================================================
|
|
126
|
+
插件独有:没有图标的渠道用自己的首字母
|
|
127
|
+
------------------------------------------------------------
|
|
128
|
+
设计稿的 .ch-logo 用 background-image 放厂商图标。但二十二家里有五家
|
|
129
|
+
在任何构建里都没有图标(CodeArts / LobsterAI / Loom / 豆包 …),
|
|
130
|
+
设计稿没画这种情况 —— 那五格会是一片空白。
|
|
131
|
+
|
|
132
|
+
所以这一条是插件自己加的:有图标时用图标,没有就用首字母,
|
|
133
|
+
尺寸和圆角与图标版一致,看起来是同一个控件而不是缺图。
|
|
134
|
+
============================================================ */
|
|
135
|
+
|
|
136
|
+
/* 字母版:把首字母居中画在同一个方块里,底色用渠道自己的 accent */
|
|
137
|
+
.ch-logo-letters{
|
|
138
|
+
display:grid;place-items:center;
|
|
139
|
+
font-size:var(--fs-xs);font-weight:800;letter-spacing:-.02em;
|
|
140
|
+
line-height:1;color:#fff;text-transform:uppercase;
|
|
141
|
+
background-color:var(--ch-logo-accent, var(--surface-3));
|
|
142
|
+
/* 厂商色多为浅亮(橙、绿),纯白字在上面只有 2.3:1。
|
|
143
|
+
加一层暗影把字压出来,不改品牌色。 */
|
|
144
|
+
text-shadow:0 1px 2px rgba(0,0,0,.55);
|
|
145
|
+
}
|
|
146
|
+
.ch-logo-letters::after{content:none}
|
|
147
|
+
/* 设计稿的 .ch-logo 用伪元素叠图形;字母版要把它关掉。 */
|
|
148
|
+
.ch-logo::after{content:none}
|
|
149
|
+
/* 有图标的渠道:图标铺满,覆盖字母版留下的底色。 */
|
|
150
|
+
/*
|
|
151
|
+
有图标的渠道:插件把图放在 --ch-logo-icon 里(data URI),
|
|
152
|
+
设计稿靠 background-image 上色 —— 这一条把它接起来。
|
|
153
|
+
|
|
154
|
+
之前这里只写了 size/repeat/position,没有 background-image,
|
|
155
|
+
于是所有有图标的渠道都画成一块空底色。
|
|
156
|
+
*/
|
|
157
|
+
.ch-logo-art{background-image:var(--ch-logo-icon, none);background-color:var(--ch-logo-accent, var(--surface-3));background-size:contain;background-repeat:no-repeat;background-position:center}
|
|
158
|
+
|
|
159
|
+
/* ============================================================
|
|
160
|
+
插件独有:加载骨架与折叠箭头
|
|
161
|
+
------------------------------------------------------------
|
|
162
|
+
设计稿是静态稿,没有画「数据还在路上」的样子。插件要真加载,
|
|
163
|
+
所以这两条自己补:骨架用一条低对比的横线占位,箭头是个小三角。
|
|
164
|
+
============================================================ */
|
|
165
|
+
|
|
166
|
+
.skel-line{height:10px;border-radius:4px;background:var(--surface-3);opacity:.5;animation:xd-pulse 1.4s ease-in-out infinite}
|
|
167
|
+
.skel-line:nth-child(2n){width:72%}
|
|
168
|
+
@keyframes xd-pulse{0%,100%{opacity:.35}50%{opacity:.6}}
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
/* 插件用 span/b 写字实行,设计稿用 dt/dd —— 给前者补上同样的排布 */
|
|
172
|
+
.fact > .td-name{flex:0 0 auto;min-width:60px;color:var(--faint)}
|
|
173
|
+
.fact > .td-num{flex:1 1 auto;min-width:0;color:var(--text);font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
174
|
+
.fact > .td-num[data-tone="quiet"]{color:var(--faint)}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
/* ============================================================
|
|
178
|
+
按下反馈
|
|
179
|
+
------------------------------------------------------------
|
|
180
|
+
设计稿是静态稿,没有 :active。但真实界面里,按下去没有任何变化
|
|
181
|
+
会让人不确定「点到了没有」——尤其是慢操作(重新获取模型要几秒)。
|
|
182
|
+
这里只加一点点下沉,不动配色。
|
|
183
|
+
============================================================ */
|
|
184
|
+
.btn:active:not(:disabled),
|
|
185
|
+
.tiny:active:not(:disabled),
|
|
186
|
+
.rail-item:active { transform: translateY(1px) }
|
|
187
|
+
.sw:active:not(:disabled) { filter: brightness(.94) }
|
|
188
|
+
button:disabled { cursor: not-allowed }
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
/* ============================================================
|
|
192
|
+
渠道详情:单列铺满
|
|
193
|
+
------------------------------------------------------------
|
|
194
|
+
.accts 是账号卡的网格(auto-fill 248px),用在设计稿的详情页正合适 ——
|
|
195
|
+
六个账号排成三列两行。
|
|
196
|
+
|
|
197
|
+
但渠道详情只有一个「卡」,放进那个网格会只占一列 248px,右边空一大片。
|
|
198
|
+
这一层是单列容器:它里面只有一张卡,卡就该铺满。
|
|
199
|
+
============================================================ */
|
|
200
|
+
/* 渠道详情里只有一个 .card(后面跟着它自己的动作行),让卡铺满整行 */
|
|
201
|
+
.accts > .card:first-child { grid-column: 1 / -1 }
|
|
202
|
+
.accts > .sec-actions { grid-column: 1 / -1 }
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
/* ============================================================
|
|
206
|
+
开关里的真实 checkbox 要藏起来
|
|
207
|
+
------------------------------------------------------------
|
|
208
|
+
设计稿的 .sw 是一个按钮(40×24,用 ::after 画滑块)。
|
|
209
|
+
插件有三处把它套在 <label> 上,里面放真的 <input type="checkbox">,
|
|
210
|
+
为的是让键盘和读屏能操作。
|
|
211
|
+
|
|
212
|
+
于是浏览器的原生复选框就画在滑块旁边 —— 聚合页那个勾选框跑出
|
|
213
|
+
开关右边,就是这么来的。藏掉 input,滑块照旧由 .sw 的伪元素画。
|
|
214
|
+
============================================================ */
|
|
215
|
+
label.sw > input[type="checkbox"] {
|
|
216
|
+
position: absolute;
|
|
217
|
+
width: 1px; height: 1px;
|
|
218
|
+
opacity: 0;
|
|
219
|
+
pointer-events: none;
|
|
220
|
+
}
|
|
221
|
+
label.sw { cursor: pointer }
|
|
222
|
+
label.sw:has(input:checked)::after { transform: translateX(16px) }
|
|
223
|
+
label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
/* 搜索框那一行:输入框 + 命中数提示 */
|
|
227
|
+
.search-wrap {
|
|
228
|
+
display: flex;
|
|
229
|
+
align-items: center;
|
|
230
|
+
gap: var(--s2);
|
|
231
|
+
margin: var(--s2) 0;
|
|
232
|
+
}
|
|
233
|
+
.search-wrap > .search { flex: 1 1 auto; min-width: 0 }
|
|
234
|
+
.search-wrap > .hint { flex: 0 0 auto; margin: 0 }
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
/* 窄屏侧栏(60px)里,版本号竖排会换行成两行 —— 藏掉,鼠标悬停时用 title 看 */
|
|
238
|
+
@media (max-width: 1180px) {
|
|
239
|
+
.rail-ver { display: none }
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
/*
|
|
244
|
+
按钮的 line-height 是 UA 给的 normal,不继承父级。
|
|
245
|
+
只给侧栏项补上 —— .btn / .search 各自定了字号,强行 inherit 会覆盖它们。
|
|
246
|
+
*/
|
|
247
|
+
.rail-item {
|
|
248
|
+
line-height: 1.65;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
/* ============================================================
|
|
253
|
+
元素选择器收进 .app
|
|
254
|
+
------------------------------------------------------------
|
|
255
|
+
设计稿的 button { cursor: pointer } / input { font-family: inherit }
|
|
256
|
+
在独立页面里是对的。注入到宿主页面后就变成「改宿主所有按钮」——
|
|
257
|
+
DSH 自己的按钮、输入框都会受影响。
|
|
258
|
+
|
|
259
|
+
这里把它们重新声明在 .app 作用域内,并把原来那几条全局的删掉。
|
|
260
|
+
(删在下面的 CLEANUP 里做,因为它要处理拼接后的整份 CSS。)
|
|
261
|
+
============================================================ */
|
|
262
|
+
.app button,
|
|
263
|
+
.app input,
|
|
264
|
+
.app select,
|
|
265
|
+
.app textarea {
|
|
266
|
+
font-family: inherit;
|
|
267
|
+
}
|
|
268
|
+
.app button { cursor: pointer }
|
|
269
|
+
.app button:disabled { cursor: not-allowed }
|
|
270
|
+
|
|
271
|
+
.strip-caret{width:0;height:0;border-left:4px solid transparent;border-right:4px solid transparent;border-top:5px solid var(--faint);transition:transform var(--t-base) var(--ease)}
|
|
272
|
+
.strip-caret[data-open="true"]{transform:rotate(180deg)}
|
|
273
|
+
`
|
|
274
|
+
|
|
275
|
+
/*
|
|
276
|
+
设计稿里有几处 10px 的小字(.badge 一类)。10px 在 1080p 上已经要凑近看,
|
|
277
|
+
这里统一提到 12px —— 做法是把生成结果里的 font-size:10px 换掉,
|
|
278
|
+
而不是改设计稿源文件:源文件要保持原样,便于以后重新提取时对照。
|
|
279
|
+
*/
|
|
280
|
+
const MIN_FONT_FIX = (css) => css.replace(/font-size:1[01]px/gu, 'font-size:12px')
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* mobile.css —— 窄屏重排规则(自带 @media)。
|
|
284
|
+
*/
|
|
285
|
+
const scopedMobile = MIN_FONT_FIX(mobile)
|
|
286
|
+
|
|
287
|
+
let out = `/**
|
|
288
|
+
* 设计稿样式,原样接管。
|
|
289
|
+
*
|
|
290
|
+
* 来源:xdpool-design 的 tokens.css / app.css / channel-colors.css / build-a.mjs。
|
|
291
|
+
* 改样式请改设计稿源文件,再跑 scripts/extract-design-css.mjs。
|
|
292
|
+
*/
|
|
293
|
+
export const DESIGN_TOKENS_CSS = \`${tokens.replace(/^\*\s*\{\s*box-sizing:\s*border-box;?\s*\}/mu, '.app, .app * { box-sizing: border-box }').replace(/html,\s*body\s*\{[^}]*\}/gu, '').replace(/^:root\s*\{/gmu, '.app {')}\n${colors.replace(/^:root\s*\{/gmu, '.app {')}\n${icons.replace(/^:root\s*\{/gmu, '.app {')}\`
|
|
294
|
+
|
|
295
|
+
export const DESIGN_DETAIL_CSS = \`${MIN_FONT_FIX(scoped)}\n${MIN_FONT_FIX(pageCss())}\n${scopedMobile}\n${bridge}\`
|
|
296
|
+
`
|
|
297
|
+
|
|
298
|
+
/*
|
|
299
|
+
最后一道清理:全局元素选择器。
|
|
300
|
+
|
|
301
|
+
`button { cursor: pointer }` 这类规则在设计稿里没问题,但注入到宿主页面后
|
|
302
|
+
会改掉 DSH 自己的每一个按钮。上面已经在 .app 作用域里重新声明过了,
|
|
303
|
+
所以这里把全局的那几条删掉。
|
|
304
|
+
|
|
305
|
+
放在最后而不是各个 replace 里:三处 :root 分别来自 tokens / colors / icons,
|
|
306
|
+
每个都有自己的处理链,漏一条就漏一条。统一在这里扫一遍。
|
|
307
|
+
*/
|
|
308
|
+
const globals = [
|
|
309
|
+
/^button,\s*input,\s*select\s*\{[^}]*\}\n?/gmu,
|
|
310
|
+
/^button\s*\{[^}]*\}\n?/gmu,
|
|
311
|
+
/^button:disabled\s*\{[^}]*\}\n?/gmu,
|
|
312
|
+
/^input\s*\{[^}]*\}\n?/gmu,
|
|
313
|
+
/^select\s*\{[^}]*\}\n?/gmu,
|
|
314
|
+
/^html\s*\{[^}]*\}\n?/gmu,
|
|
315
|
+
/^body\s*\{[^}]*\}\n?/gmu,
|
|
316
|
+
]
|
|
317
|
+
let cleaned = out
|
|
318
|
+
for (const re of globals) cleaned = cleaned.replace(re, '')
|
|
319
|
+
out = cleaned
|
|
320
|
+
|
|
321
|
+
writeFileSync('D:/dsh-home/_xdpool-src/src/client/design-css.ts', out, 'utf8')
|
|
322
|
+
console.log('生成 design-css.ts:', Math.round(out.length / 1024), 'KB')
|
|
@@ -197,7 +197,7 @@ const HARNESS_BASES = [
|
|
|
197
197
|
* Not a guess about this particular machine: it is derived from where the PROFILE lives.
|
|
198
198
|
* A DSH profile sits at `<harness data dir>/profiles/<name>`, and on Windows the data
|
|
199
199
|
* directory is often the harness's own folder — which is exactly the layout this repo
|
|
200
|
-
* was developed against (
|
|
200
|
+
* was developed against (`<data>\profiles\desktop` beside `<install>`).
|
|
201
201
|
* When they are siblings, the harness is one segment up with a different name, so the
|
|
202
202
|
* sibling of the data dir is tried as a harness root too.
|
|
203
203
|
*
|
|
@@ -209,14 +209,14 @@ const HARNESS_BASES = [
|
|
|
209
209
|
/**
|
|
210
210
|
* Harness roots that can be derived from where this profile lives.
|
|
211
211
|
*
|
|
212
|
-
*
|
|
212
|
+
* `<data>\profiles\desktop\node_modules\dsh-xdpool` → walk up to the data directory,
|
|
213
213
|
* then try every plausible sibling. Cheap, and it is the only way to find a harness on a
|
|
214
214
|
* non-default drive without asking the user to set an environment variable.
|
|
215
215
|
*
|
|
216
216
|
* Several levels are tried because the two layouts in the wild differ:
|
|
217
217
|
*
|
|
218
218
|
* - `<dataDir>/profiles/<name>` — the data dir's PARENT holds the harness
|
|
219
|
-
* (
|
|
219
|
+
* (`<data>` beside `<install>`)
|
|
220
220
|
* - the harness IS the data dir's parent — some installs put profiles inside the app
|
|
221
221
|
*
|
|
222
222
|
* A miss costs nothing, which is why deriving beats hard-coding a drive letter.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 设计稿的 rail 图标(SVG 线性、24 网格、stroke-width 1.8)。
|
|
3
|
+
*
|
|
4
|
+
* 插件原来用汉字「池登聚量路关备」当图标 —— 那是 Cette 早期没有图标资源时的
|
|
5
|
+
* 占位。设计稿每一行都是一个描边图标,和 DSH 自己的侧栏风格一致。
|
|
6
|
+
*/
|
|
7
|
+
import { writeFileSync } from 'node:fs'
|
|
8
|
+
|
|
9
|
+
const PATHS = {
|
|
10
|
+
pool: 'M3 7h18M3 12h18M3 17h12',
|
|
11
|
+
login: 'M4 8V5a1 1 0 011-1h14a1 1 0 011 1v3M4 16v3a1 1 0 001 1h14a1 1 0 001-1v-3M8 12h8',
|
|
12
|
+
aggregate: 'M12 3l8 4.5v9L12 21l-8-4.5v-9z M12 12l8-4.5M12 12v9M12 12L4 7.5',
|
|
13
|
+
ledger: 'M4 19V9M10 19V5M16 19v-7M22 19H2',
|
|
14
|
+
routing: 'M6 3v18M18 3v18M6 8h12M6 16h12',
|
|
15
|
+
gateway: 'M3 5h18v14H3z M3 10h18',
|
|
16
|
+
backup: 'M12 3v12M8 11l4 4 4-4 M4 17v2a2 2 0 002 2h12a2 2 0 002-2v-2',
|
|
17
|
+
star: 'M12 3l2.6 5.6 6.4.8-4.7 4.4 1.2 6.2L12 17l-5.5 3 1.2-6.2L3 9.4l6.4-.8z',
|
|
18
|
+
group: 'M21 12a9 9 0 11-4.5-7.8L21 3l-1 4.5',
|
|
19
|
+
dock: 'M4 6h16M4 12h16M4 18h16',
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const lines = Object.entries(PATHS).map(([id, d]) => {
|
|
23
|
+
// 一条 path 里可能有多个子路径(空格分隔的 M)
|
|
24
|
+
const parts = d.split(/\s+(?=M)/u)
|
|
25
|
+
const inner = parts.map(sub => `<path d="${sub.trim()}"/>`).join('')
|
|
26
|
+
return ` ${id}: '${inner}',`
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const out = `/**
|
|
30
|
+
* 设计稿的功能页图标。
|
|
31
|
+
*
|
|
32
|
+
* 全部是 24 网格、stroke-width 1.8、圆头描边 —— 和设计稿的 rail-item 一致。
|
|
33
|
+
* 用法:<RailIcon name="pool" />
|
|
34
|
+
*
|
|
35
|
+
* 之前这些位置是汉字(池 / 登 / 聚 / 量 / 路 / 关 / 备)。那是占位,
|
|
36
|
+
* 一屏七个汉字看着像标签而不像导航。
|
|
37
|
+
*/
|
|
38
|
+
export const RAIL_ICONS = {
|
|
39
|
+
${lines.join('\n')}
|
|
40
|
+
} as const
|
|
41
|
+
|
|
42
|
+
export type RailIconName = keyof typeof RAIL_ICONS
|
|
43
|
+
`
|
|
44
|
+
|
|
45
|
+
writeFileSync('D:/dsh-home/_xdpool-src/src/client/rail-icons.ts', out, 'utf8')
|
|
46
|
+
console.log('生成 rail-icons.ts,', Object.keys(PATHS).length, '个图标')
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 渠道实测:验证每个渠道的登录页能不能打开、能不能识别出登录入口。
|
|
3
|
+
*
|
|
4
|
+
* 不是真实扫码登录 —— 那需要人手。这里验的是「插件能不能把浏览器正确打开到正确的地方」:
|
|
5
|
+
* 1. 登录页 URL 是否可达(HTTP 200/3xx)
|
|
6
|
+
* 2. 页面里是否有登录相关的元素(二维码 / 手机号输入 / 授权按钮)
|
|
7
|
+
* 3. 有没有明显的错误页(404 / 域名过期 / 证书问题)
|
|
8
|
+
*
|
|
9
|
+
* 用法:
|
|
10
|
+
* node scripts/probe-channels.mjs 测一遍,打印结果
|
|
11
|
+
* node scripts/probe-channels.mjs --json 额外写 probe-result.json
|
|
12
|
+
*
|
|
13
|
+
* 为什么留着它:渠道地址会变(这次就修了 4 个),而这个脚本能在几秒内
|
|
14
|
+
* 告诉你哪一家的入口已经打不开了 —— 比等用户报「某个渠道用不了」早得多。
|
|
15
|
+
*/
|
|
16
|
+
import { writeFileSync } from 'node:fs'
|
|
17
|
+
|
|
18
|
+
/** 各渠道的登录入口,从 vendor/channel-pack/pack.js 与 src/*-browser.ts 里取。 */
|
|
19
|
+
const CHANNELS = [
|
|
20
|
+
// 已确认可用(用户说了免测)
|
|
21
|
+
{ id: 'buddy', name: 'WorkBuddy 国内版', skip: '用户已用过' },
|
|
22
|
+
{ id: 'codearts', name: 'CodeArts', skip: '用户已用过' },
|
|
23
|
+
{ id: 'trae', name: 'TRAE', skip: '用户已用过' },
|
|
24
|
+
|
|
25
|
+
// 待测:浏览器登录
|
|
26
|
+
{ id: 'workbuddy', name: 'WorkBuddy 国际版', url: 'https://www.workbuddy.ai/', login: 'browser' },
|
|
27
|
+
{ id: 'lobsterai', name: 'LobsterAI', url: 'https://lobsterai.youdao.com/', login: 'browser' },
|
|
28
|
+
{ id: 'qoder', name: 'Qoder 国际版', url: 'https://qoder.com/', login: 'browser' },
|
|
29
|
+
{ id: 'qodercn', name: 'Qoder 国内版', url: 'https://qoder.com.cn/', login: 'browser' },
|
|
30
|
+
{ id: 'cline', name: 'Cline', url: 'https://app.cline.bot/', login: 'browser' },
|
|
31
|
+
{ id: 'loomy', name: 'Loomy', url: 'https://loomy.xunfei.cn/', login: 'browser' },
|
|
32
|
+
{ id: 'raccoon', name: 'Raccoon', url: 'https://raccoon-ai.com/', login: 'browser' },
|
|
33
|
+
{ id: 'minimax', name: 'MiniMax Code', url: 'https://agent.minimax.cn/', login: 'browser' },
|
|
34
|
+
{ id: 'zcode', name: 'ZCode', url: 'https://z.ai/', login: 'browser' },
|
|
35
|
+
{ id: 'gemini', name: 'Gemini Code Assist', url: 'https://accounts.google.com/', login: 'browser' },
|
|
36
|
+
{ id: 'doubao', name: '豆包', url: 'https://www.doubao.com/', login: 'browser' },
|
|
37
|
+
|
|
38
|
+
// 待测:粘贴 / Key / OAuth
|
|
39
|
+
{ id: 'autoclaw', name: 'AutoClaw 国际', url: 'https://autoglm.ai/', login: 'paste' },
|
|
40
|
+
{ id: 'autoclaw-cn', name: 'AutoClaw 国内', url: 'https://autoglm.zhipuai.cn/', login: 'paste' },
|
|
41
|
+
{ id: 'baizhi', name: '百智云', url: 'https://baizhi.cloud/console', login: 'apikey' },
|
|
42
|
+
{ id: 'monkeycode', name: 'MonkeyCode', url: 'https://monkeycode-ai.com/', login: 'paste' },
|
|
43
|
+
{ id: 'monkeycode-intl', name: 'MonkeyCode 国际', url: 'https://monkeycode-ai.net/', login: 'paste' },
|
|
44
|
+
{ id: 'accio', name: 'Accio', url: 'https://www.accio-ai.com/', login: 'paste' },
|
|
45
|
+
{ id: 'astudio', name: 'AStudio', url: 'https://agent.xfyun.cn/', login: 'paste' },
|
|
46
|
+
{ id: 'marvis', name: '腾讯 Marvis', url: 'https://yybadaccess.3g.qq.com/', login: 'oauth' },
|
|
47
|
+
]
|
|
48
|
+
|
|
49
|
+
/** 探一个 URL。只发 HEAD,跟随重定向,记录最终落点和状态。 */
|
|
50
|
+
async function probe(url) {
|
|
51
|
+
const started = Date.now()
|
|
52
|
+
try {
|
|
53
|
+
const ctrl = new AbortController()
|
|
54
|
+
const timer = setTimeout(() => ctrl.abort(), 15000)
|
|
55
|
+
const res = await fetch(url, {
|
|
56
|
+
method: 'GET',
|
|
57
|
+
redirect: 'follow',
|
|
58
|
+
signal: ctrl.signal,
|
|
59
|
+
headers: {
|
|
60
|
+
// 有些站对没有 UA 的请求直接 403
|
|
61
|
+
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36',
|
|
62
|
+
'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
63
|
+
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
clearTimeout(timer)
|
|
67
|
+
const text = res.status === 200 ? await res.text() : ''
|
|
68
|
+
return {
|
|
69
|
+
ok: res.ok,
|
|
70
|
+
status: res.status,
|
|
71
|
+
finalUrl: res.url,
|
|
72
|
+
ms: Date.now() - started,
|
|
73
|
+
bytes: text.length,
|
|
74
|
+
// 页面里有没有登录相关的痕迹
|
|
75
|
+
signals: {
|
|
76
|
+
qr: /qrcode|二维码|qr-code|canvas.*qr/i.test(text),
|
|
77
|
+
phone: /手机号|phone|mobile/i.test(text),
|
|
78
|
+
login: /登录|sign\s*in|log\s*in/i.test(text),
|
|
79
|
+
oauth: /oauth|authorize|授权/i.test(text),
|
|
80
|
+
google: /accounts\.google|google.*sign/i.test(text),
|
|
81
|
+
},
|
|
82
|
+
title: (text.match(/<title[^>]*>([^<]{0,80})/i)?.[1] ?? '').trim(),
|
|
83
|
+
}
|
|
84
|
+
} catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
ok: false,
|
|
87
|
+
status: 0,
|
|
88
|
+
error: error instanceof Error ? error.message : String(error),
|
|
89
|
+
ms: Date.now() - started,
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const results = []
|
|
95
|
+
for (const ch of CHANNELS) {
|
|
96
|
+
if (ch.skip) {
|
|
97
|
+
results.push({ ...ch, result: { skipped: true, reason: ch.skip } })
|
|
98
|
+
console.log(`跳过 ${ch.name}(${ch.skip})`)
|
|
99
|
+
continue
|
|
100
|
+
}
|
|
101
|
+
process.stdout.write(`探测 ${ch.name} … `)
|
|
102
|
+
const r = await probe(ch.url)
|
|
103
|
+
results.push({ ...ch, result: r })
|
|
104
|
+
if (r.error) console.log(`失败 ${r.error}`)
|
|
105
|
+
else {
|
|
106
|
+
const sig = r.signals
|
|
107
|
+
? Object.entries(r.signals).filter(([, v]) => v).map(([k]) => k).join(',') || '无'
|
|
108
|
+
: '—'
|
|
109
|
+
console.log(`${r.status} ${r.ms}ms 信号[${sig}]`)
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (process.argv.includes('--json') === true) {
|
|
114
|
+
const out = new URL('../probe-result.json', import.meta.url)
|
|
115
|
+
writeFileSync(out, JSON.stringify(results, null, 2), 'utf8')
|
|
116
|
+
console.log('')
|
|
117
|
+
console.log('结果已写入', out.pathname)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
console.log('\n===== 汇总 =====')
|
|
121
|
+
const ok = results.filter(r => r.result.ok)
|
|
122
|
+
const bad = results.filter(r => !r.result.ok && !r.result.skipped)
|
|
123
|
+
const skipped = results.filter(r => r.result.skipped)
|
|
124
|
+
console.log(`可用 ${ok.length} · 失败 ${bad.length} · 跳过 ${skipped.length}`)
|
|
125
|
+
if (bad.length) {
|
|
126
|
+
console.log('\n失败的:')
|
|
127
|
+
for (const r of bad) console.log(` ${r.name} ${r.url} ${r.result.status} ${r.result.error ?? ''}`)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* 附:协议层验证结论(2026-11-20)
|
|
132
|
+
*
|
|
133
|
+
* 带假凭据请求真实端点,看服务端返回什么。这比「端点 200」更强:
|
|
134
|
+
* 服务端认出了我们的请求格式,只是拒绝了凭据。
|
|
135
|
+
*
|
|
136
|
+
* Marvis 401 {"code":4100403,"msg":"客户端通用错误:登录态过期/未登录"}
|
|
137
|
+
* 百智云 401 {"type":"error","error":{"type":"invalid_request_error","message":"API Key 无效"}}
|
|
138
|
+
* AutoClaw 200 {"code":400001,"msg":"Request data error"} ← 业务码,HTTP 层 200
|
|
139
|
+
* MonkeyCode 401 Unauthorized
|
|
140
|
+
*
|
|
141
|
+
* 都不是 404(路径错)也不是 5xx(请求体畸形),说明协议实现正确。
|
|
142
|
+
*/
|