dsh-opencode-status 0.4.0 → 0.4.1
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 +17 -0
- package/README.md +10 -3
- package/package.json +1 -1
- package/src/client.js +134 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
- 新增**按当前消耗速率的可用时长估算**:用量面板的窗口行在「剩余 %」与「⏱ 重置倒计时」之间给出「按现在的用法还能撑多久」。估算用最近的实测采样外推(只用首尾两点,不做回归),三种状态严格区分:
|
|
6
|
+
- `约 13h10m 后耗尽`(警告色):按当前速率会在窗口重置前用完;
|
|
7
|
+
- `可支撑到重置`(中性色):按当前速率能撑到重置,不再显示多余数字;
|
|
8
|
+
- **完全不渲染**:样本不足(少于 3 个采样点,或首尾跨度不足 10 分钟)、速率为 0、剩余为 0、重置时间缺失或已过期时,该位置直接不出现,也不用「估算中」「--」之类占位凑数。
|
|
9
|
+
- 三条诚实性边界(本功能的定位是「仅供参考的描述」,不是预测):
|
|
10
|
+
1. **只基于页面打开期间的采样**:采样存在模块级内存里(每窗口最近 60 分钟、最多 120 个点,按 `fetchedAt` 去重),页面刷新或重启即清空,需要重新积累约 10 分钟才可能再次出现估算;不落盘、不上报、不做跨会话推断。
|
|
11
|
+
2. **整数 percent 下估不出来就不显示**:上游只给整数百分比,最小窗口 10 分钟内 1%→2% 的量化误差会把 ETA 放大成很宽的区间(示例场景真实区间约 8h47m–26h20m,界面只能显示一个点值),所以样本或跨度不足时宁可不出数,也不给一个看起来精确的假时长。行内保留「约」字,`title` 写明「按最近 N 分钟的消耗速率估算(按当前速率),仅供参考」,全文不用「预计 / 将」这类预测口吻。
|
|
12
|
+
3. **先与重置时间比较再下结论**:「可支撑到重置」与「约 X 后耗尽」是对比 `resetAt` 后的二选一(仅当 `etaMs < untilResetMs` 才判耗尽),不是两套独立文案;重置时间缺失或已过期时两者都不给。
|
|
13
|
+
- 重置安全:`usedPct` 回落或 `resetsAt` 变化视为窗口已重置,立即清空该窗口历史样本重新积累,避免算出负数或荒谬时长。
|
|
14
|
+
- 布局与可访问性:估算与「剩余 %」「⏱」同处一行且 `nowrap`,面板行高不变(实测 17px,有没有估算都一样);「剩余 %」、档位徽标、估算、倒计时均 `flexShrink: 0` 不截断,只有窗口标签可收缩为 ellipsis;不改动进度条的 `aria-valuetext`,不新增行。
|
|
15
|
+
- 220ms 悬浮微卡**有意不展示**估算:外宽约 220px,一行塞不下「名称 / 条 / 剩余 / 估算 / 倒计时」五项,缩字号、砍进度条或截断文案都不可接受,因此宁可不显示(估算逻辑与面板共用同一套,只是呈现密度不同)。
|
|
16
|
+
- 纯前端实现:无新增依赖、无新增网络请求与端点,数据仍只来自既有的 30 秒轮询与手动刷新。
|
|
17
|
+
- 测试:42 → 47,新增 5 个真实运行时用例(估算 null 场景、时长文案短于/长于重置、采样去重/回落/`resetsAt` 清空、120 上限与 60 分钟裁剪、三态渲染与布局 props);既有用例全部保留,唯一断言调整是把 F2 静态用例收紧为「采样先于落库」的结构断言。
|
|
18
|
+
- 版本号升至 `0.4.1`(`0.4.0` 的可访问性与信息设计改动见下一条)。
|
|
19
|
+
|
|
3
20
|
## 0.4.0
|
|
4
21
|
|
|
5
22
|
- 可访问性与键盘:用量面板从无语义裸容器改为 `role="dialog"`,`aria-label` 随视图变化(「OpenCode GO 用量」/「OpenCode GO 连接配置」);`Esc` 关闭面板,`Tab` 在面板内首尾循环;打开时焦点移入面板(容器 `tabIndex: -1`),关闭(含 Esc)后焦点归还打开前的触发按钮,点击面板外关闭时不抢焦点(焦点留在用户新点的控件上)。面板允许点击外部关闭、属非模态,因此**不声明** `aria-modal`(WAI-ARIA 要求 `aria-modal=true` 时外部内容不可交互,而本面板没有 inert 实现,声明反而误导读屏)。
|
package/README.md
CHANGED
|
@@ -10,10 +10,17 @@ OpenCode GO 套餐用量与配额状态监控面板插件(DeepSeek Harness)
|
|
|
10
10
|
- `⚙ 设置`:进入面板内的独立连接设置视图,可随时 `← 返回用量`。
|
|
11
11
|
- 右侧显示相对时间「上次同步 12s 前」(刚刚 / Ns 前 / N 分钟前 / N 小时前 / N 天前),绝对时刻 HH:MM:SS 保留在 `title`;同步数据超过 2 分钟追加「· 可能已过期」并用警告色,避免把旧额度当成实时值。
|
|
12
12
|
- **3 维度用量行**:主百分比只给剩余额度,进度条条长与它同源(条长 = 剩余占比,条色 = 剩余档位),「已用」放在 `title` 与 `aria-valuetext` 里,同一行不再重复表达同一个数字;窗口状态非 `ok` 时给出可见提示。
|
|
13
|
-
- **滚动窗口 (5h)**:`剩余 70% · ⏱ 4h20m`
|
|
14
|
-
- **周窗口 (Weekly)**:周额度剩余 % + ⏱ 重置倒计时
|
|
15
|
-
- **月窗口 (Monthly)**:月额度剩余 % + ⏱ 重置倒计时
|
|
13
|
+
- **滚动窗口 (5h)**:`剩余 70% · 约 13h10m 后耗尽 · ⏱ 4h20m`
|
|
14
|
+
- **周窗口 (Weekly)**:周额度剩余 % + 可用时长估算 + ⏱ 重置倒计时
|
|
15
|
+
- **月窗口 (Monthly)**:月额度剩余 % + 可用时长估算 + ⏱ 重置倒计时
|
|
16
16
|
- 面板头部只给判断性摘要「最紧张 <窗口> N%」(取剩余最小的窗口),具体数字留在窗口行。
|
|
17
|
+
- **可用时长估算(按当前速率,仅供参考)**:窗口行会顺带告诉你「按现在的用法还能撑多久」。三种状态严格区分,不存在第四种:
|
|
18
|
+
- `约 13h10m 后耗尽`(警告色):按当前速率会在窗口重置前用完;
|
|
19
|
+
- `可支撑到重置`(中性色):按当前速率能撑到重置,此时不再显示具体时长;
|
|
20
|
+
- **不显示**:采样点少于 3 个、首尾跨度不足 10 分钟、速率为 0、剩余为 0,或重置时间缺失/已过期时,这个位置直接不出现,也不会用「估算中」「--」占位。
|
|
21
|
+
- 鼠标悬停会说明依据:「按最近 N 分钟的消耗速率估算(按当前速率),仅供参考」。它是对已有采样点的机械外推(只用首尾两点,不做回归),**不是预测或承诺**。
|
|
22
|
+
- 采样只存在于页面打开期间的内存里(每窗口最近 60 分钟、最多 120 个点),刷新页面即清空,需要重新积累约 10 分钟才可能再次出现;上游只给整数百分比,样本不足时宁可不出数,也不给看起来精确的假时长。
|
|
23
|
+
- 纯前端计算:不新增网络请求、不新增依赖,数据仍只来自既有的 30 秒轮询与手动刷新。220ms 悬浮微卡不显示估算(一行放不下五项,缩字号或截断都不可接受,因此有意省略)。
|
|
17
24
|
- **可访问性与键盘交互**:
|
|
18
25
|
- 面板是 `role="dialog"`,`aria-label` 随视图切换(「OpenCode GO 用量」/「OpenCode GO 连接配置」)。
|
|
19
26
|
- `Esc` 关闭面板;`Tab` 在面板内首尾循环;打开时焦点移入面板,关闭(含 Esc)后归还到打开前的触发按钮,点击面板外关闭时不抢焦点。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-opencode-status",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "OpenCode GO quota status panel for DeepSeek Harness: click to open a usage panel with manual refresh, per-window remaining quota, a hover overview card, and in-app connection settings",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
package/src/client.js
CHANGED
|
@@ -170,6 +170,116 @@ window.__ModuleLoader__.load({
|
|
|
170
170
|
return tightest
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// ---------- 消耗速率估算(按当前速率还能撑多久) ----------
|
|
174
|
+
// 采样放模块级而不是 store:每次采样不触发整树重渲染,渲染时按需读取。
|
|
175
|
+
const ETA_SAMPLE_WINDOW_MS = 60 * 60_000
|
|
176
|
+
const ETA_MAX_SAMPLES = 120
|
|
177
|
+
const ETA_MIN_SAMPLES = 3
|
|
178
|
+
const ETA_MIN_SPAN_MS = 10 * 60_000
|
|
179
|
+
|
|
180
|
+
/** windowId -> { resetAt, samples: [{ at, used }] };at 取 status.fetchedAt(不是 Date.now)。 */
|
|
181
|
+
const etaSamples = new Map()
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* 记录一次成功刷新的样本:按窗口分组,用 fetchedAt 去重(宿主 30s 缓存会让多次轮询拿到同一个时间),
|
|
185
|
+
* usedPct 回落或 resetsAt 变化说明窗口已重置,立即清空该窗口历史重新采样,避免算出负数或荒谬 ETA。
|
|
186
|
+
*/
|
|
187
|
+
function recordSamples(status) {
|
|
188
|
+
if (!status?.ok || typeof status.fetchedAt !== 'number') return
|
|
189
|
+
const windows = Array.isArray(status.windows) ? status.windows : []
|
|
190
|
+
for (const w of windows) {
|
|
191
|
+
const id = w?.id
|
|
192
|
+
if (!id || typeof w?.usedPct !== 'number') continue
|
|
193
|
+
const at = status.fetchedAt
|
|
194
|
+
const used = w.usedPct
|
|
195
|
+
const resetAt = typeof w.resetAt === 'number' && Number.isFinite(w.resetAt) ? w.resetAt : null
|
|
196
|
+
let entry = etaSamples.get(id)
|
|
197
|
+
if (!entry) {
|
|
198
|
+
entry = { resetAt, samples: [] }
|
|
199
|
+
etaSamples.set(id, entry)
|
|
200
|
+
}
|
|
201
|
+
const last = entry.samples[entry.samples.length - 1]
|
|
202
|
+
if (last && last.at === at) continue // 同一份缓存数据不重复采样
|
|
203
|
+
if (last && (used < last.used || resetAt !== entry.resetAt)) entry.samples = []
|
|
204
|
+
entry.resetAt = resetAt
|
|
205
|
+
entry.samples.push({ at, used })
|
|
206
|
+
// 只保留最近 60 分钟、每窗口最多 120 个样本。
|
|
207
|
+
const cutoff = at - ETA_SAMPLE_WINDOW_MS
|
|
208
|
+
while (entry.samples.length && entry.samples[0].at < cutoff) entry.samples.shift()
|
|
209
|
+
if (entry.samples.length > ETA_MAX_SAMPLES) entry.samples.splice(0, entry.samples.length - ETA_MAX_SAMPLES)
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* 估算「按当前速率还能撑多久」。样本 ≥3、首尾跨度 ≥10 分钟、速率 >0 三者缺一即返回 null;
|
|
215
|
+
* 速率只用首尾两点(不做回归,抗噪且好解释)。resetAt 缺失或已过期时无法判断能否撑到重置,同样返回 null。
|
|
216
|
+
* 返回 { etaMs, untilResetMs, exhaustsBeforeReset, spanMs }:能否撑到重置由调用方决定怎么展示。
|
|
217
|
+
*/
|
|
218
|
+
function estimateEta(samples, remainingPct, resetAt, now = Date.now()) {
|
|
219
|
+
if (!Array.isArray(samples) || samples.length < ETA_MIN_SAMPLES) return null
|
|
220
|
+
if (typeof remainingPct !== 'number' || !Number.isFinite(remainingPct) || remainingPct <= 0) return null
|
|
221
|
+
if (typeof resetAt !== 'number' || !Number.isFinite(resetAt)) return null
|
|
222
|
+
const first = samples[0]
|
|
223
|
+
const last = samples[samples.length - 1]
|
|
224
|
+
if (typeof first?.at !== 'number' || typeof last?.at !== 'number') return null
|
|
225
|
+
if (typeof first?.used !== 'number' || typeof last?.used !== 'number') return null
|
|
226
|
+
const spanMs = last.at - first.at
|
|
227
|
+
if (!(spanMs >= ETA_MIN_SPAN_MS)) return null
|
|
228
|
+
const ratePerMs = (last.used - first.used) / spanMs
|
|
229
|
+
if (!(ratePerMs > 0)) return null
|
|
230
|
+
const etaMs = remainingPct / ratePerMs
|
|
231
|
+
if (!Number.isFinite(etaMs) || etaMs <= 0) return null
|
|
232
|
+
const untilResetMs = resetAt - now
|
|
233
|
+
if (!Number.isFinite(untilResetMs) || untilResetMs <= 0) return null
|
|
234
|
+
return { etaMs, untilResetMs, exhaustsBeforeReset: etaMs < untilResetMs, spanMs }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** 时长短文案:<1h 用分钟,<24h 用 h+m,更长用 d+h(「还能撑多久」不需要精确到分秒)。 */
|
|
238
|
+
function fmtEtaDuration(ms) {
|
|
239
|
+
const mins = Math.max(1, Math.round(ms / 60_000))
|
|
240
|
+
if (mins < 60) return `${mins}m`
|
|
241
|
+
const hours = Math.floor(mins / 60)
|
|
242
|
+
if (hours < 24) return `${hours}h${mins % 60 ? `${mins % 60}m` : ''}`
|
|
243
|
+
const days = Math.floor(hours / 24)
|
|
244
|
+
return `${days}d${hours % 24 ? `${hours % 24}h` : ''}`
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* 估算文案的三态:不可估算返回 null(调用方完全不渲染节点,不显示 "--"/"估算中" 之类占位);
|
|
249
|
+
* 撑不到重置用告警色「约 X 后耗尽」,撑得到用中性色「可支撑到重置」。
|
|
250
|
+
* 文案只用「按当前速率」的描述,不用「预计/将」这种预测口吻。
|
|
251
|
+
* 行内必须保留「约」与「后」:这是常驻可见的唯一表述(悬浮卡等场景 title 不可达),
|
|
252
|
+
* 缺了「约」会被读成确定性断言,与「仅供参考」的定位冲突。
|
|
253
|
+
* compact(悬浮微卡,外宽约 220px)整段不展示:一行放不下「名称/条/剩余/估算/倒计时」五项,
|
|
254
|
+
* 缩字号、砍进度条/倒计时、截断估算都不可接受,所以宁可不显示;估算逻辑仍共用 estimateEta,只是呈现密度不同。
|
|
255
|
+
* 这是有意为之,不是漏渲染。
|
|
256
|
+
*/
|
|
257
|
+
function etaView(w, options = {}) {
|
|
258
|
+
if (options?.compact) return null
|
|
259
|
+
const entry = etaSamples.get(w?.id)
|
|
260
|
+
if (!entry) return null
|
|
261
|
+
const estimate = estimateEta(entry.samples, w?.remainingPct, w?.resetAt)
|
|
262
|
+
if (!estimate) return null
|
|
263
|
+
const minutes = Math.max(1, Math.round(estimate.spanMs / 60_000))
|
|
264
|
+
// 文案只说「按最近 N 分钟的消耗速率(按当前速率)」的实测依据,不写「预计/将」这类预测口吻。
|
|
265
|
+
const title = `按最近 ${minutes} 分钟的消耗速率估算(按当前速率),仅供参考`
|
|
266
|
+
// 保留完整字面「约 X 后耗尽」:真实 Chrome 实测在 326px/262px 内容宽下都不会截断,只会让标签多收缩。
|
|
267
|
+
return estimate.exhaustsBeforeReset
|
|
268
|
+
? { text: `约 ${fmtEtaDuration(estimate.etaMs)} 后耗尽`, color: T.warn, title }
|
|
269
|
+
: { text: '可支撑到重置', color: T.secondary, title }
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** 仅供测试与诊断:读取某个窗口的采样副本。 */
|
|
273
|
+
function getSamples(windowId) {
|
|
274
|
+
const entry = etaSamples.get(windowId)
|
|
275
|
+
return entry ? entry.samples.map((s) => ({ ...s })) : []
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/** 仅供测试与诊断:清空所有采样。 */
|
|
279
|
+
function resetEtaSamples() {
|
|
280
|
+
etaSamples.clear()
|
|
281
|
+
}
|
|
282
|
+
|
|
173
283
|
/** 月窗口剩余百分比;上游只给百分比,不存在金额余额。 */
|
|
174
284
|
function monthlyRemainingOf(status) {
|
|
175
285
|
if (!status) return null
|
|
@@ -236,7 +346,10 @@ window.__ModuleLoader__.load({
|
|
|
236
346
|
try {
|
|
237
347
|
const status = await api('/api/opencode-status')
|
|
238
348
|
// 只接受最新 epoch 的响应:手动刷新之后返回的在途 GET 一律丢弃。
|
|
239
|
-
if (epoch === statusEpoch)
|
|
349
|
+
if (epoch === statusEpoch) {
|
|
350
|
+
recordSamples(status)
|
|
351
|
+
store.set({ status, error: null })
|
|
352
|
+
}
|
|
240
353
|
} catch (err) {
|
|
241
354
|
if (epoch === statusEpoch) store.set({ error: String(err?.message ?? err) })
|
|
242
355
|
} finally {
|
|
@@ -265,6 +378,7 @@ window.__ModuleLoader__.load({
|
|
|
265
378
|
headers: { 'content-type': 'application/json' },
|
|
266
379
|
})
|
|
267
380
|
// 手动刷新自身的响应始终落库(刷新期间已阻止新的 GET)。
|
|
381
|
+
recordSamples(status)
|
|
268
382
|
store.set({ status, error: null })
|
|
269
383
|
} catch (err) {
|
|
270
384
|
store.set({ error: String(err?.message ?? err) })
|
|
@@ -533,11 +647,14 @@ window.__ModuleLoader__.load({
|
|
|
533
647
|
)
|
|
534
648
|
}
|
|
535
649
|
|
|
536
|
-
/** 悬浮卡紧凑行:名称 / 剩余 % / ⏱ 重置倒计时 /
|
|
650
|
+
/** 悬浮卡紧凑行:名称 / 剩余 % / ⏱ 重置倒计时 / 细进度条(紧凑视图不展示估算)。 */
|
|
537
651
|
function MiniQuotaRow(props) {
|
|
538
652
|
const w = props.window
|
|
539
653
|
const remaining = w?.remainingPct ?? null
|
|
540
654
|
const color = remainingColor(remaining)
|
|
655
|
+
// compact:悬浮微卡外宽约 220px,五个元素塞不进去。这里整段不渲染估算(etaView 返回 null),
|
|
656
|
+
// 不缩字号、不砍进度条/倒计时、不截断成残句;面板 QuotaRow 仍照常展示。
|
|
657
|
+
const eta = etaView(w, { compact: true })
|
|
541
658
|
return h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } }, [
|
|
542
659
|
h('span', { key: 'n', style: { width: 46, flexShrink: 0, fontSize: 10, color: T.secondary, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, w?.shortLabel ?? w?.label ?? '—'),
|
|
543
660
|
h(
|
|
@@ -547,9 +664,13 @@ window.__ModuleLoader__.load({
|
|
|
547
664
|
? null
|
|
548
665
|
: h('div', { style: { height: '100%', width: `${clampPct(remaining)}%`, background: color, borderRadius: 2 } }),
|
|
549
666
|
),
|
|
550
|
-
h('span', { key: 'v', style: { minWidth: 30, textAlign: 'right', fontSize: 10, fontWeight: 600, color, fontVariantNumeric: 'tabular-nums' } }, remaining === null ? '—' : pctText(remaining)),
|
|
667
|
+
h('span', { key: 'v', style: { minWidth: 30, flexShrink: 0, textAlign: 'right', fontSize: 10, fontWeight: 600, color, fontVariantNumeric: 'tabular-nums' } }, remaining === null ? '—' : pctText(remaining)),
|
|
668
|
+
// 紧凑视图不会走到这里(etaView(compact) 恒为 null);保留非截断样式,避免以后误开时变成残句。
|
|
669
|
+
eta
|
|
670
|
+
? h('span', { key: 'e', title: eta.title, style: { flexShrink: 0, fontSize: 10, color: eta.color, whiteSpace: 'nowrap' } }, eta.text)
|
|
671
|
+
: null,
|
|
551
672
|
// 倒计时用 ⏱ 区分刷新动作的 ↻,避免两个图标同义混淆。
|
|
552
|
-
h('span', { key: 'r', style: { minWidth: 34, textAlign: 'right', fontSize: 10, color: T.secondary, fontVariantNumeric: 'tabular-nums' } }, w?.resetAt ? `⏱ ${timeUntil(w.resetAt)}` : ''),
|
|
673
|
+
h('span', { key: 'r', style: { minWidth: 34, flexShrink: 0, textAlign: 'right', fontSize: 10, color: T.secondary, fontVariantNumeric: 'tabular-nums' } }, w?.resetAt ? `⏱ ${timeUntil(w.resetAt)}` : ''),
|
|
553
674
|
])
|
|
554
675
|
}
|
|
555
676
|
|
|
@@ -608,12 +729,18 @@ window.__ModuleLoader__.load({
|
|
|
608
729
|
const remaining = w?.remainingPct ?? null
|
|
609
730
|
const color = remainingColor(remaining)
|
|
610
731
|
const band = remainingBand(remaining)
|
|
732
|
+
const eta = etaView(w)
|
|
611
733
|
const statusText = w?.status && w.status !== 'ok' ? w.status : null
|
|
612
734
|
const detail = remaining === null ? '数据不可用' : `已用 ${pctText(used)} · 剩余 ${pctText(remaining)}`
|
|
613
735
|
return h('div', { style: { marginBottom: 12 } }, [
|
|
614
736
|
h('div', { key: 'meta', style: { display: 'flex', alignItems: 'baseline', gap: 6, fontSize: 11, marginBottom: 4, fontVariantNumeric: 'tabular-nums' } }, [
|
|
615
|
-
h('span', { key: 'l', style: { color: T.label, fontWeight: 500, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, w?.label ?? '—'),
|
|
737
|
+
h('span', { key: 'l', style: { color: T.label, fontWeight: 500, minWidth: 0, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, w?.label ?? '—'),
|
|
616
738
|
h('span', { key: 'r', title: detail, style: { marginLeft: 'auto', color, fontWeight: 600, flexShrink: 0 } }, remaining === null ? '剩余 —' : `剩余 ${pctText(remaining)}`),
|
|
739
|
+
// 估算整段展示、不截断:flexShrink:0 且无 ellipsis;空间不足时只让窗口标签 ellipsis,
|
|
740
|
+
// 档位徽标(告警不只靠颜色)、剩余 % 与倒计时都不收缩。
|
|
741
|
+
eta
|
|
742
|
+
? h('span', { key: 'eta', title: eta.title, style: { flexShrink: 0, fontSize: 10, color: eta.color, whiteSpace: 'nowrap' } }, eta.text)
|
|
743
|
+
: null,
|
|
617
744
|
// 低额度除颜色外再给文字标记:色觉障碍与灰度截图里也能看出档位。
|
|
618
745
|
band
|
|
619
746
|
? h(
|
|
@@ -998,6 +1125,8 @@ window.__ModuleLoader__.load({
|
|
|
998
1125
|
|
|
999
1126
|
exports.apply = apply
|
|
1000
1127
|
exports.inject = ['slots']
|
|
1128
|
+
// 仅供测试与诊断:估算/采样是纯函数 + 模块内状态,导出以便做真实单元测试(宿主侧不消费)。
|
|
1129
|
+
exports.__internal = { estimateEta, recordSamples, getSamples, resetEtaSamples, fmtEtaDuration, etaView }
|
|
1001
1130
|
return module.exports
|
|
1002
1131
|
},
|
|
1003
1132
|
})
|