@xixka/dsh-hub 0.2.1-rc.15 → 0.2.1-rc.17
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/lib/client/jet-hub.js +67 -49
- package/package.json +1 -1
package/lib/client/jet-hub.js
CHANGED
|
@@ -1161,8 +1161,8 @@ var STYLES = `
|
|
|
1161
1161
|
* 216px 全部装得下且留 6.7px 余量(字体回退时字宽会变)。
|
|
1162
1162
|
*
|
|
1163
1163
|
* ⚠️ **上限不能再往上放**:实测把上限放到「无上限」时,极窄 composer(220px)
|
|
1164
|
-
* 下胶囊会**溢出容器 8.3px
|
|
1165
|
-
*
|
|
1164
|
+
* 下胶囊会**溢出容器 8.3px**,把同排的官方 pill(tok/s / 缓存命中)挤出可视区。
|
|
1165
|
+
* 内容自适应 + 合理上限,两者缺一不可。
|
|
1166
1166
|
* 兜底退化顺序:超长时**渠道名**先出省略号,**余额一个字都不会少**
|
|
1167
1167
|
* (.dim-jh-badgeReading 是 flex: none)。
|
|
1168
1168
|
*
|
|
@@ -1171,49 +1171,43 @@ var STYLES = `
|
|
|
1171
1171
|
* ⚠️⚠️ 本段注释里**不能出现反引号**(本文件整体是 JS 模板字符串,会提前终止)。
|
|
1172
1172
|
* ② 容器再窄时(< 720px,媒体查询挂在**全局宽度**上:composer 宽度受
|
|
1173
1173
|
* 侧栏影响,用容器查询无法表达「右侧还剩多少」)**只留状态点**,
|
|
1174
|
-
*
|
|
1174
|
+
* 文字与图标全部隐藏 —— 此时 composer dock 行让位给官方 pill 与输入框。 */
|
|
1175
1175
|
/* ⚠️ flex: 0 1 auto(而非 none):胶囊自身也要能收缩。它是 flex: none 时
|
|
1176
1176
|
宽度只由 max-width 兜底,而 max-width 只在**内容超标**时生效 —— 容器更窄时
|
|
1177
|
-
|
|
1177
|
+
它会把同排的官方 pill 一起挤出可视区。允许收缩后,空间不足时同排一起让位,
|
|
1178
1178
|
且胶囊内部退化是有序的(先名字出省略号,数字最后才动)。 */
|
|
1179
|
-
.dim-jh-badge { position: relative; display: flex; align-items: center; flex: 0 1 auto; min-width: 0; }
|
|
1179
|
+
.dim-jh-badge { position: relative; display: flex; align-items: center; flex: 0 1 auto; min-width: 0; font-size: calc(var(--dsh-content-font-size-secondary, 13px) - 1px); line-height: calc(20px + var(--dsh-content-font-delta-secondary, 0px)); }
|
|
1180
|
+
/* ⚠️ 上面两条是宿主 StatsPills.module.css 的 anchor 字号口径(2026-11-01 迁居
|
|
1181
|
+
composer dock 行后与官方 tok/s / 缓存命中 pill 同排):字号 = 内容字号 −1px、
|
|
1182
|
+
行高 20px + 字号偏移。逐字照抄,别「就地取整」—— 宿主改变量时这里要跟着走。 */
|
|
1180
1183
|
/* ⚠️ box-sizing 是**显式写出**的,不是修复:button 的 UA 默认样式表本就是
|
|
1181
1184
|
border-box(实测 offsetWidth 与 max-width 相等)。写上它只为在元素类型被改
|
|
1182
1185
|
(span/div 默认是 content-box)时语义不悄悄漂移 —— 那种情况下 max-width 会从
|
|
1183
1186
|
「占位宽度」变成「内容宽度」,胶囊会突然变宽 19px 而这行代码看着毫无变化。 */
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
+
/* 几何口径 = 宿主 StatsPills.module.css 的 .pill 规则(2026-11-01 用户要求
|
|
1188
|
+
「样式要和 Pill 状态条其他元素一样」,逐字对齐):无底无框、radius-sm、
|
|
1189
|
+
内边距 1px 8px、gap 6px、tertiary 色、tabular-nums、行高继承 anchor。
|
|
1190
|
+
与 pill 的差别只有两处,都是**功能性**的:cursor:pointer(本 pill 可点开浮层,
|
|
1191
|
+
官方 DialogPill 也有指针);max-width 216px 收敛上限(见下一段)。 */
|
|
1192
|
+
.dim-jh-badgeBtn { box-sizing: border-box; display: inline-flex; align-items: center; gap: 6px; max-width: 216px; min-width: 0; padding: 1px 8px; border: none; border-radius: var(--dsw-radius-sm, 6px); background: 0 0; color: var(--dsw-alias-label-tertiary); font: inherit; line-height: inherit; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; transition: color .15s ease; }
|
|
1193
|
+
.dim-jh-badgeBtn:hover, .dim-jh-badgeBtn[aria-expanded="true"] { color: var(--dsw-alias-label-primary); }
|
|
1194
|
+
/* pill 图标(叠币):与官方 pill 图标同规格(16px、currentColor 1px 描边)。
|
|
1195
|
+
flex: none —— 图标被压缩会先于文字变形,宁可让文字先让位。 */
|
|
1196
|
+
.dim-jh-badgeIcon { flex: none; }
|
|
1187
1197
|
/* 聚合「待首次请求」占位胶囊(用户报障 2026-10-08:「也没胶囊了?」)。
|
|
1188
1198
|
⚠️ 刻意与 .dim-jh-badgeBtn **外观一致但不共用类名**:那个类名带 cursor:pointer
|
|
1189
1199
|
与 :hover 反馈,而这里没有任何可点的东西(无历史 ⇒ 没有余额可展开)。
|
|
1190
1200
|
给一个点了没反应的按钮比没有按钮更糟。
|
|
1191
|
-
⚠️ 宽度口径与 .dim-jh-badgeBtn 同步(gap
|
|
1201
|
+
⚠️ 宽度口径与 .dim-jh-badgeBtn 同步(gap 6px / padding 1px 8px / anchor 字号):
|
|
1192
1202
|
两者会在同一位置交替出现(首次请求成功后换成真胶囊),尺寸不一致会看到跳动。 */
|
|
1193
|
-
.dim-jh-badgePending { display: inline-flex; align-items: center; gap:
|
|
1203
|
+
.dim-jh-badgePending { display: inline-flex; align-items: center; gap: 6px; max-width: 216px; min-width: 0; padding: 1px 8px; border-radius: var(--dsw-radius-sm, 6px); background: 0 0; color: var(--dsw-alias-label-tertiary); line-height: inherit; white-space: nowrap; font-variant-numeric: tabular-nums; }
|
|
1194
1204
|
.dim-jh-badgePending > span:last-child { overflow: hidden; text-overflow: ellipsis; }
|
|
1195
|
-
/*
|
|
1196
|
-
|
|
1205
|
+
/* 折叠态文本容器:只装「额度」一个读数(用户 2026-11-01 要求 pill 不显示供应商名
|
|
1206
|
+
—— 渠道名挤在同排官方 pill 中间只会被截成省略号;名字走 title 悬停与浮层)。
|
|
1207
|
+
⚠️ 仍必须是 flex 容器:读数与「不完整」角标各自独立、角标不参与收缩。 */
|
|
1197
1208
|
.dim-jh-badgeText { display: flex; align-items: center; min-width: 0; }
|
|
1198
|
-
/* ⚠️ 让位顺序:中段说明(999) → 渠道名(99) → 读数(none,**不参与收缩**)。
|
|
1199
|
-
收缩量按 flex-shrink × flex-basis 加权分配,999 与 99 相差一个数量级,
|
|
1200
|
-
故「包名先走、渠道名其次」,读数一个字都不会少。
|
|
1201
|
-
flex-grow 一律为 0:胶囊是内容自适应宽度,任何 grow 都只会让它在宽容器里虚胖。
|
|
1202
|
-
min-width:0 是省略号生效的前提(flex 子项默认 min-width:auto,会撑破 max-width)。 */
|
|
1203
|
-
.dim-jh-badgeName { flex: 0 99 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1204
|
-
/* 分隔符「•」:定宽不收缩,两侧间距由 margin 给。
|
|
1205
|
-
⚠️ 这里的 3px **不能**换成前后空格:flex 容器把 span 之间只含空白的文本节点
|
|
1206
|
-
渲染成**零宽**(实测 gap=0,节点还在但看不见),空格会静默消失。
|
|
1207
|
-
带空格的那份写法(BADGE_SEP = ' • ')只用于 title / aria-label 那句整文。 */
|
|
1208
|
-
.dim-jh-badgeSep { flex: none; margin: 0 3px; }
|
|
1209
|
-
/* 中段说明(只有套餐模式有值,如包名 Free Plan Subscription)。
|
|
1210
|
-
⚠️ 收缩权重**最大**(999):它比渠道名更该让位 —— 包名多为样板字、且长,
|
|
1211
|
-
而用户认得出自己选的渠道。
|
|
1212
|
-
⚠️ 它被压到 0 宽时(内容过长)该节点仍在,会留下一个「悬空的分隔符」;
|
|
1213
|
-
这在胶囊这一行是可接受的(完整文案在 title 与弹窗里),故不额外做条件渲染。 */
|
|
1214
|
-
.dim-jh-badgeDetail { flex: 0 999 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1215
1209
|
/* ⚠️⚠️ 读数必须 flex: none(**完全不收缩**),不能写 flex: 0 1 auto。
|
|
1216
|
-
|
|
1210
|
+
这是历史上「数字被截」的隐蔽成因,**靠截图才发现**:
|
|
1217
1211
|
|
|
1218
1212
|
收缩量按 flex-shrink × flex-basis 加权分配,读数那一份虽小却**不为零** ——
|
|
1219
1213
|
实测读数被分到 0.77px 的收缩(getBoundingClientRect 宽 78.23 / 内容宽 79)。
|
|
@@ -1228,11 +1222,7 @@ var STYLES = `
|
|
|
1228
1222
|
不能用取整后的 clientWidth。
|
|
1229
1223
|
|
|
1230
1224
|
⚠️ 类名刻意**不叫 .dim-jh-badgeValue**:那个名字已被弹窗读数占用,且那条规则
|
|
1231
|
-
(font-weight:600)排在样式表更后面 ——
|
|
1232
|
-
|
|
1233
|
-
⇒ 读数恒定完整;全部收缩由 .dim-jh-badgeDetail(999) 与 .dim-jh-badgeName(99)
|
|
1234
|
-
承担,两者最坏缩到 0 也放得下(读数最宽约 97px + 分隔符与内边距 ≈ 131px
|
|
1235
|
-
< 186px 上限)。 */
|
|
1225
|
+
(font-weight:600)排在样式表更后面 —— 同名会让数字被静默加粗。 */
|
|
1236
1226
|
.dim-jh-badgeReading { flex: none; min-width: 0; white-space: nowrap; }
|
|
1237
1227
|
/* 「这个读数不完整」的标记(合计少算了账号时才出现),排在读数**之后**。
|
|
1238
1228
|
⚠️ 必须与读数同级 flex: none:它是**补语**,被省略号吃掉就等于没标 —— 而它要
|
|
@@ -1242,13 +1232,13 @@ var STYLES = `
|
|
|
1242
1232
|
字号小一档并压紧行高,让它读起来像角标而不是读数的一部分。 */
|
|
1243
1233
|
.dim-jh-badgeWarn { flex: none; font-size: 10px; line-height: 1; color: var(--dsw-alias-state-warn-primary); cursor: help; }
|
|
1244
1234
|
|
|
1245
|
-
/* ②
|
|
1246
|
-
* 阈值 720px 是实测桌面版在 100% 缩放下「徽标 216px +
|
|
1235
|
+
/* ② 窄屏收敛:只留状态点,文字与图标让位给同排官方 pill 与输入框。
|
|
1236
|
+
* 阈值 720px 是实测桌面版在 100% 缩放下「徽标 216px + 官方 pill ≥ 240px」的临界值。
|
|
1247
1237
|
* ⚠️⚠️ 本段的**位置**是功能性的,不要为了排版把它挪到 .dim-jh-badgeText 之前:
|
|
1248
1238
|
* 它与 ".dim-jh-badgeText { display: flex }" 特异性相同(都是单个类),
|
|
1249
1239
|
* 靠**源顺序**决定胜负 —— 一旦被排到前面,窄屏下 display:none 会被
|
|
1250
|
-
* 后面的 display:flex
|
|
1251
|
-
@media (max-width: 720px) { .dim-jh-badgeText, .dim-jh-badgeBtn > svg, .dim-jh-badgeBtn > .dim-jh-badgeChevron { display: none; } .dim-jh-badgeBtn { max-width: none; padding:
|
|
1240
|
+
* 后面的 display:flex 覆盖,文字重新出现并挤压同排官方 pill(静默回归)。 */
|
|
1241
|
+
@media (max-width: 720px) { .dim-jh-badgeText, .dim-jh-badgeBtn > svg, .dim-jh-badgeBtn > .dim-jh-badgeChevron { display: none; } .dim-jh-badgeBtn { max-width: none; padding: 1px 6px; } }
|
|
1252
1242
|
.dim-jh-badgeDot { width: 5px; height: 5px; flex: none; border-radius: 999px; background: var(--dsw-alias-state-success-primary); }
|
|
1253
1243
|
.dim-jh-badgeDot[data-tone="warn"] { background: var(--dsw-alias-state-warn-primary); }
|
|
1254
1244
|
.dim-jh-badgeDot[data-tone="error"] { background: var(--dsw-alias-state-error-primary); }
|
|
@@ -13813,6 +13803,32 @@ var CLAIM_NOTICE_MS = 8e3;
|
|
|
13813
13803
|
var CLAIM_NOTICE_WARN_MS = 2e4;
|
|
13814
13804
|
var CREDITS_COLLAPSED_LIMIT = 5;
|
|
13815
13805
|
var RESOLVE_RETRY_DELAYS = [300, 700, 1500, 2e3];
|
|
13806
|
+
function BadgePillIcon({ className }) {
|
|
13807
|
+
return React6.createElement("svg", {
|
|
13808
|
+
width: 16,
|
|
13809
|
+
height: 16,
|
|
13810
|
+
viewBox: "0 0 16 16",
|
|
13811
|
+
fill: "none",
|
|
13812
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13813
|
+
className,
|
|
13814
|
+
"aria-hidden": "true",
|
|
13815
|
+
strokeWidth: 1
|
|
13816
|
+
}, [
|
|
13817
|
+
React6.createElement("ellipse", { key: "top", cx: 8, cy: 4.4, rx: 5.2, ry: 2.5, stroke: "currentColor" }),
|
|
13818
|
+
React6.createElement("path", {
|
|
13819
|
+
key: "mid",
|
|
13820
|
+
d: "M2.8 4.4v3.4c0 1.38 2.33 2.5 5.2 2.5s5.2-1.12 5.2-2.5V4.4",
|
|
13821
|
+
stroke: "currentColor",
|
|
13822
|
+
strokeLinecap: "round"
|
|
13823
|
+
}),
|
|
13824
|
+
React6.createElement("path", {
|
|
13825
|
+
key: "bot",
|
|
13826
|
+
d: "M2.8 7.8v3.4c0 1.38 2.33 2.5 5.2 2.5s5.2-1.12 5.2-2.5V7.8",
|
|
13827
|
+
stroke: "currentColor",
|
|
13828
|
+
strokeLinecap: "round"
|
|
13829
|
+
})
|
|
13830
|
+
]);
|
|
13831
|
+
}
|
|
13816
13832
|
function UsageBadge(props) {
|
|
13817
13833
|
const resolveDirectory = props.resolveDirectory;
|
|
13818
13834
|
const [directory, setDirectory] = React6.useState(null);
|
|
@@ -14190,13 +14206,8 @@ function UsageBadgeActive(props) {
|
|
|
14190
14206
|
const title = [view.text, view.incompleteNote, view.failureReason].filter((part) => part !== "").join("\n");
|
|
14191
14207
|
const ariaLabel = `${label} 用量:${view.text}${view.incompleteNote === "" ? "" : `(${view.incompleteNote})`}`;
|
|
14192
14208
|
const collapsed = React6.createElement("span", { key: "text", className: "dim-jh-badgeText" }, [
|
|
14193
|
-
React6.createElement("span", { key: "name", className: "dim-jh-badgeName" }, view.name),
|
|
14194
|
-
React6.createElement("span", { key: "sep", className: "dim-jh-badgeSep" }, "•"),
|
|
14195
|
-
// 空串时**不渲染**该节点:留一个空 span 会白吃一个 5px 的 gap
|
|
14196
|
-
//(.dim-jh-badgeText 用的是 .dim-jh-badgeBtn 的 gap)。只有套餐模式有中段。
|
|
14197
|
-
view.detail === "" ? null : React6.createElement("span", { key: "detail", className: "dim-jh-badgeDetail" }, view.detail),
|
|
14198
14209
|
// ⚠️ 类名是 Reading 而**不是** Value:.dim-jh-badgeValue 已被弹窗里的读数占用
|
|
14199
|
-
//(那条规则带 font-weight:600,且排在样式表更后面 ——
|
|
14210
|
+
//(那条规则带 font-weight:600,且排在样式表更后面 —— 同名会让数字
|
|
14200
14211
|
// 被静默加粗、并拿到 flex:none 而无法收缩)。
|
|
14201
14212
|
React6.createElement("span", { key: "value", className: "dim-jh-badgeReading" }, view.reading),
|
|
14202
14213
|
/**
|
|
@@ -14218,7 +14229,13 @@ function UsageBadgeActive(props) {
|
|
|
14218
14229
|
"aria-hidden": "true"
|
|
14219
14230
|
}, "⚠")
|
|
14220
14231
|
]);
|
|
14221
|
-
return React6.createElement("div", {
|
|
14232
|
+
return React6.createElement("div", {
|
|
14233
|
+
className: "dim-jh-badge",
|
|
14234
|
+
ref: root,
|
|
14235
|
+
// 与同排官方 pill 相同的数据标记(StatsPills 的 anchor 带 data-composer-stat)
|
|
14236
|
+
// —— 便于在 DOM 里把这一排 pill 当一个整体查找/测试。
|
|
14237
|
+
"data-composer-stat": "jet-hub-usage"
|
|
14238
|
+
}, [
|
|
14222
14239
|
React6.createElement("button", {
|
|
14223
14240
|
key: "btn",
|
|
14224
14241
|
type: "button",
|
|
@@ -14229,6 +14246,7 @@ function UsageBadgeActive(props) {
|
|
|
14229
14246
|
onClick: () => setOpen((was) => !was)
|
|
14230
14247
|
}, [
|
|
14231
14248
|
React6.createElement("span", { key: "dot", className: "dim-jh-badgeDot", "data-tone": tone }),
|
|
14249
|
+
React6.createElement(BadgePillIcon, { key: "icon", className: "dim-jh-badgeIcon" }),
|
|
14232
14250
|
collapsed
|
|
14233
14251
|
]),
|
|
14234
14252
|
open ? renderPopover() : null
|
|
@@ -15096,10 +15114,10 @@ function apply(ctx) {
|
|
|
15096
15114
|
key: "@xixka/dsh-hub",
|
|
15097
15115
|
inject: () => ({ rpcCall })
|
|
15098
15116
|
}, JetHubPanelEntryCardGuarded));
|
|
15099
|
-
ctx.slots.inject("conversation.
|
|
15100
|
-
name: "conversation.
|
|
15117
|
+
ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
|
|
15118
|
+
name: "conversation.composer.dock",
|
|
15101
15119
|
id: "jet-hub-usage",
|
|
15102
|
-
order:
|
|
15120
|
+
order: -10,
|
|
15103
15121
|
inject: (sessionId) => ({
|
|
15104
15122
|
// ⚠️⚠️ **必须惰性取目录,不能在 inject 里取**(真机事故 2026-10-02)。
|
|
15105
15123
|
//
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xixka/dsh-hub",
|
|
3
|
-
"version": "0.2.1-rc.
|
|
3
|
+
"version": "0.2.1-rc.17",
|
|
4
4
|
"description": "DeepSeek Harness plugin: one hub for AI coding providers — account login, multi-account pools, silent credential refresh, credit claiming, and a local OpenAI-compatible gateway",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|