@xixka/dsh-hub 0.2.1-rc.15 → 0.2.1-rc.16
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 +62 -19
- 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,26 +1171,36 @@ 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
1205
|
/* 三段式文本容器:渠道名 + 分隔符 + 读数。
|
|
1196
1206
|
⚠️ 必须是 flex 容器,两个文本子项才能各自独立收缩(这正是「数字不被截」的前提)。 */
|
|
@@ -1242,13 +1252,13 @@ var STYLES = `
|
|
|
1242
1252
|
字号小一档并压紧行高,让它读起来像角标而不是读数的一部分。 */
|
|
1243
1253
|
.dim-jh-badgeWarn { flex: none; font-size: 10px; line-height: 1; color: var(--dsw-alias-state-warn-primary); cursor: help; }
|
|
1244
1254
|
|
|
1245
|
-
/* ②
|
|
1246
|
-
* 阈值 720px 是实测桌面版在 100% 缩放下「徽标 216px +
|
|
1255
|
+
/* ② 窄屏收敛:只留状态点,文字与图标让位给同排官方 pill 与输入框。
|
|
1256
|
+
* 阈值 720px 是实测桌面版在 100% 缩放下「徽标 216px + 官方 pill ≥ 240px」的临界值。
|
|
1247
1257
|
* ⚠️⚠️ 本段的**位置**是功能性的,不要为了排版把它挪到 .dim-jh-badgeText 之前:
|
|
1248
1258
|
* 它与 ".dim-jh-badgeText { display: flex }" 特异性相同(都是单个类),
|
|
1249
1259
|
* 靠**源顺序**决定胜负 —— 一旦被排到前面,窄屏下 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:
|
|
1260
|
+
* 后面的 display:flex 覆盖,文字重新出现并挤压同排官方 pill(静默回归)。 */
|
|
1261
|
+
@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
1262
|
.dim-jh-badgeDot { width: 5px; height: 5px; flex: none; border-radius: 999px; background: var(--dsw-alias-state-success-primary); }
|
|
1253
1263
|
.dim-jh-badgeDot[data-tone="warn"] { background: var(--dsw-alias-state-warn-primary); }
|
|
1254
1264
|
.dim-jh-badgeDot[data-tone="error"] { background: var(--dsw-alias-state-error-primary); }
|
|
@@ -13813,6 +13823,32 @@ var CLAIM_NOTICE_MS = 8e3;
|
|
|
13813
13823
|
var CLAIM_NOTICE_WARN_MS = 2e4;
|
|
13814
13824
|
var CREDITS_COLLAPSED_LIMIT = 5;
|
|
13815
13825
|
var RESOLVE_RETRY_DELAYS = [300, 700, 1500, 2e3];
|
|
13826
|
+
function BadgePillIcon({ className }) {
|
|
13827
|
+
return React6.createElement("svg", {
|
|
13828
|
+
width: 16,
|
|
13829
|
+
height: 16,
|
|
13830
|
+
viewBox: "0 0 16 16",
|
|
13831
|
+
fill: "none",
|
|
13832
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13833
|
+
className,
|
|
13834
|
+
"aria-hidden": "true",
|
|
13835
|
+
strokeWidth: 1
|
|
13836
|
+
}, [
|
|
13837
|
+
React6.createElement("ellipse", { key: "top", cx: 8, cy: 4.4, rx: 5.2, ry: 2.5, stroke: "currentColor" }),
|
|
13838
|
+
React6.createElement("path", {
|
|
13839
|
+
key: "mid",
|
|
13840
|
+
d: "M2.8 4.4v3.4c0 1.38 2.33 2.5 5.2 2.5s5.2-1.12 5.2-2.5V4.4",
|
|
13841
|
+
stroke: "currentColor",
|
|
13842
|
+
strokeLinecap: "round"
|
|
13843
|
+
}),
|
|
13844
|
+
React6.createElement("path", {
|
|
13845
|
+
key: "bot",
|
|
13846
|
+
d: "M2.8 7.8v3.4c0 1.38 2.33 2.5 5.2 2.5s5.2-1.12 5.2-2.5V7.8",
|
|
13847
|
+
stroke: "currentColor",
|
|
13848
|
+
strokeLinecap: "round"
|
|
13849
|
+
})
|
|
13850
|
+
]);
|
|
13851
|
+
}
|
|
13816
13852
|
function UsageBadge(props) {
|
|
13817
13853
|
const resolveDirectory = props.resolveDirectory;
|
|
13818
13854
|
const [directory, setDirectory] = React6.useState(null);
|
|
@@ -14192,7 +14228,7 @@ function UsageBadgeActive(props) {
|
|
|
14192
14228
|
const collapsed = React6.createElement("span", { key: "text", className: "dim-jh-badgeText" }, [
|
|
14193
14229
|
React6.createElement("span", { key: "name", className: "dim-jh-badgeName" }, view.name),
|
|
14194
14230
|
React6.createElement("span", { key: "sep", className: "dim-jh-badgeSep" }, "•"),
|
|
14195
|
-
// 空串时**不渲染**该节点:留一个空 span 会白吃一个
|
|
14231
|
+
// 空串时**不渲染**该节点:留一个空 span 会白吃一个 6px 的 gap
|
|
14196
14232
|
//(.dim-jh-badgeText 用的是 .dim-jh-badgeBtn 的 gap)。只有套餐模式有中段。
|
|
14197
14233
|
view.detail === "" ? null : React6.createElement("span", { key: "detail", className: "dim-jh-badgeDetail" }, view.detail),
|
|
14198
14234
|
// ⚠️ 类名是 Reading 而**不是** Value:.dim-jh-badgeValue 已被弹窗里的读数占用
|
|
@@ -14218,7 +14254,13 @@ function UsageBadgeActive(props) {
|
|
|
14218
14254
|
"aria-hidden": "true"
|
|
14219
14255
|
}, "⚠")
|
|
14220
14256
|
]);
|
|
14221
|
-
return React6.createElement("div", {
|
|
14257
|
+
return React6.createElement("div", {
|
|
14258
|
+
className: "dim-jh-badge",
|
|
14259
|
+
ref: root,
|
|
14260
|
+
// 与同排官方 pill 相同的数据标记(StatsPills 的 anchor 带 data-composer-stat)
|
|
14261
|
+
// —— 便于在 DOM 里把这一排 pill 当一个整体查找/测试。
|
|
14262
|
+
"data-composer-stat": "jet-hub-usage"
|
|
14263
|
+
}, [
|
|
14222
14264
|
React6.createElement("button", {
|
|
14223
14265
|
key: "btn",
|
|
14224
14266
|
type: "button",
|
|
@@ -14229,6 +14271,7 @@ function UsageBadgeActive(props) {
|
|
|
14229
14271
|
onClick: () => setOpen((was) => !was)
|
|
14230
14272
|
}, [
|
|
14231
14273
|
React6.createElement("span", { key: "dot", className: "dim-jh-badgeDot", "data-tone": tone }),
|
|
14274
|
+
React6.createElement(BadgePillIcon, { key: "icon", className: "dim-jh-badgeIcon" }),
|
|
14232
14275
|
collapsed
|
|
14233
14276
|
]),
|
|
14234
14277
|
open ? renderPopover() : null
|
|
@@ -15096,10 +15139,10 @@ function apply(ctx) {
|
|
|
15096
15139
|
key: "@xixka/dsh-hub",
|
|
15097
15140
|
inject: () => ({ rpcCall })
|
|
15098
15141
|
}, JetHubPanelEntryCardGuarded));
|
|
15099
|
-
ctx.slots.inject("conversation.
|
|
15100
|
-
name: "conversation.
|
|
15142
|
+
ctx.slots.inject("conversation.composer.dock", () => ctx.slots.register({
|
|
15143
|
+
name: "conversation.composer.dock",
|
|
15101
15144
|
id: "jet-hub-usage",
|
|
15102
|
-
order:
|
|
15145
|
+
order: -10,
|
|
15103
15146
|
inject: (sessionId) => ({
|
|
15104
15147
|
// ⚠️⚠️ **必须惰性取目录,不能在 inject 里取**(真机事故 2026-10-02)。
|
|
15105
15148
|
//
|
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.16",
|
|
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",
|