dsh-agent-board 1.7.4 → 1.7.6
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/README.md +39 -14
- package/index.mjs +9 -1
- package/lib/client/board-list.js +37 -26
- package/lib/client/dashboard.js +407 -67
- package/lib/client/kernel.js +23 -10
- package/lib/client/task-detail.js +21 -2
- package/lib/client.js +488 -105
- package/lib/core.mjs +202 -8
- package/lib/dispatch.mjs +54 -7
- package/lib/health.mjs +68 -1
- package/lib/rpc.mjs +86 -16
- package/lib/usage.mjs +608 -0
- package/package.json +2 -2
- package/test/core.test.mjs +648 -70
- package/test/headless-smoke.test.mjs +209 -0
- package/test/helpers/mock-ctx.mjs +327 -0
- package/test/integration.test.mjs +543 -0
- package/test/quality-alert-digest.test.mjs +128 -0
- package/test/runtime-health.test.mjs +158 -0
- package/test/scoreboard-client.test.mjs +106 -0
- package/test/scoreboard-trends-client.test.mjs +104 -0
- package/test/scoreboard.test.mjs +271 -0
- package/test/scorecard-clusters.test.mjs +225 -0
- package/test/scorecard-data.test.mjs +214 -0
- package/test/usage-mainwindow.test.mjs +7 -5
- package/test/user-guide-client.test.mjs +79 -0
package/lib/client/dashboard.js
CHANGED
|
@@ -202,8 +202,59 @@
|
|
|
202
202
|
})) : null)
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
+
// ===== 每日批次摘要(近 24h,异常驱动审视③):报告导出「批次一页纸」段的数据源 =====
|
|
206
|
+
// 纯聚合现有字段(不新建状态、不重拉):完成/驳回/token/超时按 run 与消息的 at 滚 24h 窗口现算,
|
|
207
|
+
// 幽灵回收读当前 healthHints 里的一次性 info(「本轮回收 N 个幽灵活跃表项」,无则 0);
|
|
208
|
+
// 一句话质量趋势按近 24h 落定的 resolved 任务一次通过率(rejectCount=0 占比)。
|
|
209
|
+
// 范围无关:报告顶部的批次摘要永远反映「最近 24h」实况,不受「统计范围」筛选影响。
|
|
210
|
+
function batchDigest() {
|
|
211
|
+
var now = Date.now(), since = now - 86400000
|
|
212
|
+
var all = (Array.isArray(state.tasks) ? state.tasks : []).concat(Array.isArray(state.archived) ? state.archived : [])
|
|
213
|
+
var resolved = 0, rejected = 0, tokTot = 0, tokEff = 0, timeouts = 0, trendResolved = 0, trendFirstPass = 0
|
|
214
|
+
function in24(iso) { var d = Date.parse(iso); return isFinite(d) && d >= since && d <= now }
|
|
215
|
+
function pos(v) { var n = Number(v); return isFinite(n) && n > 0 ? n : 0 }
|
|
216
|
+
all.forEach(function (t) {
|
|
217
|
+
if (!t) return
|
|
218
|
+
var doneAt = t.resolvedAt || t.verifiedAt || ''
|
|
219
|
+
if (doneAt && in24(doneAt)) {
|
|
220
|
+
resolved++
|
|
221
|
+
if (t.status === 'resolved') { trendResolved++; if (!(t.rejectCount > 0)) trendFirstPass++ }
|
|
222
|
+
}
|
|
223
|
+
if (Array.isArray(t.messages)) t.messages.forEach(function (m) { if (m && m.kind === 'rejection' && m.at && in24(m.at)) rejected++ })
|
|
224
|
+
if (Array.isArray(t.runs)) t.runs.forEach(function (r) {
|
|
225
|
+
if (!r || !r.at || !in24(r.at)) return
|
|
226
|
+
var u = (r.usage && typeof r.usage === 'object') ? r.usage : {}
|
|
227
|
+
var inp = pos(u.input), outp = pos(u.output), cr = pos(u.cacheRead), cw = pos(u.cacheWrite)
|
|
228
|
+
var tot = pos(u.total) || (inp + outp + cr + cw)
|
|
229
|
+
tokTot += tot; tokEff += inp + outp + cw
|
|
230
|
+
if (r.outcome === 'timeout/error' || r.outcome === 'timeout') timeouts++
|
|
231
|
+
})
|
|
232
|
+
})
|
|
233
|
+
var ghosts = 0
|
|
234
|
+
var hints = Array.isArray(state.healthHints) ? state.healthHints : []
|
|
235
|
+
hints.forEach(function (h) { var m = h && h.text ? String(h.text).match(/本轮回收 (\d+) 个幽灵活跃表项/) : null; if (m) ghosts += pos(m[1]) })
|
|
236
|
+
var trend = trendResolved > 0 ? ('一次通过率 ' + Math.round(trendFirstPass / trendResolved * 100) + '%(近 24h 完成 ' + trendResolved + ' 张中 ' + trendFirstPass + ' 张零驳回)') : '近 24h 无完成记录,暂无质量趋势'
|
|
237
|
+
var has = resolved > 0 || rejected > 0 || tokTot > 0 || timeouts > 0 || ghosts > 0 || trendResolved > 0
|
|
238
|
+
return { has: has, resolved: resolved, rejected: rejected, tokTot: tokTot, tokEff: tokEff, timeouts: timeouts, ghosts: ghosts, trend: trend }
|
|
239
|
+
}
|
|
240
|
+
|
|
205
241
|
function buildReport() {
|
|
206
242
|
var lines = ['# 任务看板报告', '', '生成时间: ' + new Date().toLocaleString(), '工作模式: ' + (workModeNames[state.workMode || (state.teamMode ? 'team' : (state.boardMode === 'auto' ? 'auto' : 'list'))] || '自动派发'), '', '统计范围: ' + rangeLabel()]
|
|
243
|
+
// ===== 每日批次摘要(异常驱动审视③):报告顶部一页纸,近 24h 五字段 + 一句话质量趋势 =====
|
|
244
|
+
var dg = batchDigest()
|
|
245
|
+
if (dg.has) {
|
|
246
|
+
lines.push('## 批次摘要(近 24 小时)')
|
|
247
|
+
lines.push('- 完成:' + dg.resolved + ' 张')
|
|
248
|
+
lines.push('- 驳回:' + dg.rejected + ' 次')
|
|
249
|
+
lines.push('- Token:约 ' + fmtTokens(dg.tokTot) + (dg.tokEff > 0 ? '(其中有效 ' + fmtTokens(dg.tokEff) + ')' : ''))
|
|
250
|
+
lines.push('- 异常事件:超时 ' + dg.timeouts + ' 次 · 幽灵回收 ' + dg.ghosts + ' 次')
|
|
251
|
+
lines.push('- 质量趋势:' + dg.trend)
|
|
252
|
+
lines.push('')
|
|
253
|
+
} else {
|
|
254
|
+
lines.push('## 批次摘要(近 24 小时)')
|
|
255
|
+
lines.push('近 24 小时无活动记录(无完成 / 驳回 / 消耗 / 异常事件)')
|
|
256
|
+
lines.push('')
|
|
257
|
+
}
|
|
207
258
|
var groups = { inProgress: [], verifying: [], pending: [], blocked: [], resolved: [] }
|
|
208
259
|
var rg = activeRange()
|
|
209
260
|
state.tasks.forEach(function (t) {
|
|
@@ -217,6 +268,29 @@
|
|
|
217
268
|
if (groups.blocked.length) { lines.push('## 阻塞'); groups.blocked.forEach(function (t) { lines.push('- ' + t.title + (t.escalation ? '(待裁决)' : '')) }); lines.push('') }
|
|
218
269
|
var doneAll = state.archived.length ? state.archived : state.tasks.filter(function (t) { return t.status === 'resolved' }); var done = doneAll.filter(function (t) { return !(rg.from || rg.to) || tsInRange(taskLastTs(t), rg.from, rg.to) })
|
|
219
270
|
if (done.length) { lines.push('## 已完成(含归档,近 ' + Math.min(done.length, 20) + ' 条)'); done.slice(0, 20).forEach(function (t) { lines.push('- ' + t.title + (t.verification ? '|验收: ' + t.verification.verdict : '') + (t.deliverable && t.deliverable.summary ? '|' + t.deliverable.summary.slice(0, 80) : '')) }); lines.push('') }
|
|
271
|
+
// ===== 本版自测清单(verifyUserGuide 开关门禁,task-muxyyvg0)=====
|
|
272
|
+
// 已验收卡的 userTest 聚合:按验收通过时间(resolvedAt,兜底 verification.at)倒序取近 10 张,
|
|
273
|
+
// tier=internal 的收末尾并标注「无用户可感知面」——用户照着清单逐张自测;开关关掉整段不出现。
|
|
274
|
+
if (state.verifyUserGuide !== false) {
|
|
275
|
+
var ugList = done.filter(function (t) { return t.verification && t.verification.userTest })
|
|
276
|
+
ugList.sort(function (a, b) { return String(b.resolvedAt || b.verification.at || '').localeCompare(String(a.resolvedAt || a.verification.at || '')) })
|
|
277
|
+
var ugTop = ugList.slice(0, 10)
|
|
278
|
+
var ugAct = ugTop.filter(function (t) { return t.verification.userTest.tier !== 'internal' })
|
|
279
|
+
var ugInternal = ugTop.filter(function (t) { return t.verification.userTest.tier === 'internal' })
|
|
280
|
+
var ugOrdered = ugAct.concat(ugInternal)
|
|
281
|
+
if (ugOrdered.length) {
|
|
282
|
+
lines.push('## 本版自测清单(验收通过时间倒序 · 近 ' + ugOrdered.length + ' 张)')
|
|
283
|
+
ugOrdered.forEach(function (t) {
|
|
284
|
+
var ut = t.verification.userTest
|
|
285
|
+
var tierTag = ut.tier === 'ui' ? 'UI 可操作' : (ut.tier === 'metric' ? '看指标' : '纯内部 · 无用户可感知面')
|
|
286
|
+
lines.push('### ' + t.title + '(' + tierTag + ')')
|
|
287
|
+
if (ut.gist) lines.push('- 改动:' + ut.gist)
|
|
288
|
+
if (ut.steps && ut.steps.length) { lines.push('- 自测步骤:'); ut.steps.forEach(function (s, i) { lines.push(' ' + (i + 1) + '. ' + s) }) }
|
|
289
|
+
if (ut.expect) lines.push('- 预期:' + ut.expect)
|
|
290
|
+
lines.push('')
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
}
|
|
220
294
|
return lines.join('\n')
|
|
221
295
|
}
|
|
222
296
|
|
|
@@ -239,9 +313,10 @@
|
|
|
239
313
|
// usageSummary.total 为 0,一律显示「暂无数据」。
|
|
240
314
|
// 日账(usageSummary.byDayFull:{'YYYY-MM-DD': {t,e}})用于「今日」大数字与「近 7 天」条形。
|
|
241
315
|
// 双指标口径:t = 总量(含缓存读)、e = 有效消耗(输入+输出+缓存写,不含缓存读)。
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
//
|
|
316
|
+
// 主显口径(task-muxnqunk,用户 2026-10-07 裁决「算总的吧」,推翻 task-muwq9u04 的有效主显):
|
|
317
|
+
// 本区主数字一律总量 t(含缓存读),有效消耗 e 退居悬浮 title / 次要小字;e === null 的旧口径日
|
|
318
|
+
// (老 number 日账 / 存量兜底,没有逐 run 拆分)现在就是正常柱(t 恒有值)——
|
|
319
|
+
// task-muwsnyqv ③ 的「今日显— / 矮灰柱」旧口径规则顺势退役。
|
|
245
320
|
// dayKey 口径与 host 记账完全一致——本地 getters 拼,绝不用 toISOString()(UTC 会让
|
|
246
321
|
// 晚上 8 点后的消耗落到次日,今日消耗直接错位)。
|
|
247
322
|
function localDayKey(d) {
|
|
@@ -285,44 +360,43 @@
|
|
|
285
360
|
// ===== 主窗口(本会话对话)消耗(task-muwsol23):host 增量尾读主会话 v4 日志聚合 =====
|
|
286
361
|
// 隔离口径:只在 Token 区单列一行 + 模型分布尾部追加一条;不进累计 / Top 8 / 模型归属摊派。
|
|
287
362
|
// 缺字段(老 host)/ 读不到日志 / 无 usage → mw=null → 两处都不渲染(静默降级,不炸轮询)。
|
|
363
|
+
// 口径翻转(task-muxnqunk):今日/累计主数字显总量(含缓存读——缓存读不再单列,已含在 total 里),
|
|
364
|
+
// 有效消耗进悬浮 title。
|
|
288
365
|
var mw = (u && u.mainWindow && typeof u.mainWindow === 'object' && typeof u.mainWindow.effective === 'number') ? u.mainWindow : null
|
|
289
366
|
var todayKey0 = localDayKey()
|
|
290
367
|
var mwToday = 0
|
|
291
368
|
if (mw && mw.byDay && typeof mw.byDay === 'object') {
|
|
292
369
|
var mwc0 = mw.byDay[todayKey0]
|
|
293
|
-
mwToday = (mwc0 && typeof mwc0.
|
|
370
|
+
mwToday = (mwc0 && typeof mwc0.t === 'number') ? mwc0.t : 0
|
|
294
371
|
}
|
|
295
|
-
//
|
|
372
|
+
// 主窗口单列行(累计行下方):「主窗口(本会话):今日 X · 累计 Y」(总量口径,有效值见悬浮 title)
|
|
296
373
|
function mwLine() {
|
|
297
374
|
if (!mw) return null
|
|
298
|
-
return React.createElement('div', { style: { fontSize: 10, color: C.text2, marginBottom: 8 }, title: '
|
|
299
|
-
'
|
|
375
|
+
return React.createElement('div', { style: { fontSize: 10, color: C.text2, marginBottom: 8 }, title: '主窗口(本会话对话)消耗:总量口径(含缓存读);有效消耗(输入+输出+缓存写,不含缓存读)= ' + String(mw.effective) + ' tok。host 增量尾读本会话 v4 日志聚合' + (tgOn ? ';随统计范围裁剪(按助手消息的本地日落点)' : '') + '。与看板派发口径并列展示——不进累计 / Top 8 / 模型归属摊派' },
|
|
376
|
+
'主窗口(本会话):今日 ',
|
|
300
377
|
React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(mwToday)),
|
|
301
378
|
' · 累计 ',
|
|
302
|
-
React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(mw.
|
|
303
|
-
'(缓存读 ',
|
|
304
|
-
React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(mw.cacheRead)),
|
|
305
|
-
')')
|
|
379
|
+
React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(mw.total)))
|
|
306
380
|
}
|
|
307
381
|
if (!u || !u.total) return React.createElement('div', { style: box }, head, React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无数据(Worker/Verifier 会话日志里还没有 usage 记录)'), mwLine())
|
|
308
|
-
// =====
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
//
|
|
312
|
-
//
|
|
382
|
+
// ===== 主数字口径翻转(task-muxnqunk,用户 2026-10-07 裁决「算总的吧」,推翻 task-muwq9u04 的
|
|
383
|
+
// 有效主显):模型分布行与 Top8 行的主数字一律显示**总量**(byModel / topTasks[].total,含缓存读),
|
|
384
|
+
// 有效消耗(byModelEff / topTasks[].effective)退到 title 悬浮;老 host 缺 byModelEff / 老卡无
|
|
385
|
+
// 五分量留账时 title 标「有效不可知」(口径不伪造)。
|
|
386
|
+
// 排序按**显示口径**(总量)降序:条形长度与行序一致,否则首行不是最长的条。
|
|
313
387
|
var models = Object.keys(u.byModel || {}).map(function (m) {
|
|
314
388
|
var tt = u.byModel[m] || 0
|
|
315
389
|
var ee = (u.byModelEff && typeof u.byModelEff[m] === 'number') ? u.byModelEff[m] : null
|
|
316
|
-
return { model: m, total: tt, eff:
|
|
317
|
-
}).sort(function (a, b) { return b.
|
|
318
|
-
var maxM = models.length ? (models[0].
|
|
390
|
+
return { model: m, total: tt, eff: ee }
|
|
391
|
+
}).sort(function (a, b) { return b.total - a.total })
|
|
392
|
+
var maxM = models.length ? (models[0].total || 1) : 1
|
|
319
393
|
// 主窗口行与 run 模型同一把尺(参与归一,条形长度才可比),但固定尾部追加、不参与排序(见渲染处)
|
|
320
|
-
if (mw && mw.
|
|
394
|
+
if (mw && mw.total > maxM) maxM = mw.total
|
|
321
395
|
var top = (u.topTasks || []).map(function (x) {
|
|
322
396
|
var ee = (typeof x.effective === 'number') ? x.effective : null
|
|
323
|
-
return { id: x.id, title: x.title, total: x.total, cacheRead: x.cacheRead, runs: x.runs, eff:
|
|
324
|
-
}).sort(function (a, b) { return b.
|
|
325
|
-
var maxT = top.length ? (top[0].
|
|
397
|
+
return { id: x.id, title: x.title, total: x.total, cacheRead: x.cacheRead, runs: x.runs, eff: ee }
|
|
398
|
+
}).sort(function (a, b) { return b.total - a.total })
|
|
399
|
+
var maxT = top.length ? (top[0].total || 1) : 1
|
|
326
400
|
// 日账:今日数字取本地日 key,没有日账(缺字段/老 host)时退化为 0,不炸也不误报。
|
|
327
401
|
// 读侧兼容两种单元形态:老 number(只有总量,有效值不可知)→ { t: n, e: null }。
|
|
328
402
|
// 固定口径数据源(task-muwsnyqv ②):「今日」「近 7 天」读**未过滤**的 byDayFull——caption
|
|
@@ -335,70 +409,321 @@
|
|
|
335
409
|
}
|
|
336
410
|
var todayKey = localDayKey()
|
|
337
411
|
var todayCell = dayOf(byDay[todayKey])
|
|
338
|
-
//
|
|
339
|
-
//
|
|
340
|
-
var todayLegacy = todayCell.e === null && todayCell.t > 0
|
|
341
|
-
var todayEff = todayCell.e === null ? 0 : todayCell.e
|
|
412
|
+
// 口径翻转(task-muxnqunk):今日大数字显总量 t(含缓存读),有效 e 退次要小字/悬浮;
|
|
413
|
+
// e===null 的旧口径日不影响主显(t 恒有值),只在悬浮注明有效不可知;t=0 且无日账 = 今日尚无结算,照常显示 0。
|
|
342
414
|
var days = lastNDays(7)
|
|
343
415
|
var maxDay = 1
|
|
344
416
|
var hasDayData = false
|
|
345
|
-
|
|
346
|
-
//
|
|
347
|
-
|
|
348
|
-
for (var di = 0; di < days.length; di++) { var dc = dayOf(byDay[days[di]]); if (dc.e !== null && dc.e > maxDay) maxDay = dc.e; if (dc.e === null && dc.t > 0) hasLegacy = true; if (dc.t > 0 || dc.e > 0) hasDayData = true }
|
|
417
|
+
// maxDay 按总量归一(主显口径)——task-muwsnyqv ③ 的「只按有效归一 + 旧口径灰柱」规则随
|
|
418
|
+
// 口径翻转退役:总量就是主口径,不再存在「缓存读撑歪有效柱」的问题。
|
|
419
|
+
for (var di = 0; di < days.length; di++) { var dc = dayOf(byDay[days[di]]); if (dc.t > maxDay) maxDay = dc.t; if (dc.t > 0 || dc.e > 0) hasDayData = true }
|
|
349
420
|
function mini(label, value) { return React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, label + ' ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(value))) }
|
|
350
421
|
// 累计三分量:有效(真实成本)+ 缓存读(占了 total 的大头,必须单列才看得出虚高来源)+ 合计
|
|
351
422
|
var effTotal = (typeof u.effective === 'number') ? u.effective : ((u.input || 0) + (u.output || 0) + (u.cacheWrite || 0))
|
|
352
423
|
return React.createElement('div', { style: box },
|
|
353
424
|
head,
|
|
354
425
|
React.createElement('div', { style: { display: 'flex', alignItems: 'baseline', gap: 10, flexWrap: 'wrap', marginBottom: 8 } },
|
|
355
|
-
React.createElement('span', { style: { fontSize: 20, fontWeight: 700, color:
|
|
356
|
-
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, 'tokens
|
|
357
|
-
todayCell.t >
|
|
426
|
+
React.createElement('span', { style: { fontSize: 20, fontWeight: 700, color: C.brand }, title: '今日总量(本地日 ' + todayKey + ')= 输入+输出+缓存写+缓存读(含缓存读);一次 run 的消耗整笔记在结算日;有效消耗(不含缓存读)' + (todayCell.e === null ? '不可知:该日账为旧口径数据,只有总量' : '= ' + String(todayCell.e) + ' tok') }, fmtTokens(todayCell.t)),
|
|
427
|
+
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, 'tokens(今日总量,含缓存读)'),
|
|
428
|
+
(todayCell.e !== null && todayCell.t > todayCell.e) ? React.createElement('span', { style: { fontSize: 10, color: C.text2 }, title: '今日有效消耗 = 输入+输出+缓存写(不含缓存读);与总量的差额就是缓存读' }, '其中有效 ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(todayCell.e))) : null,
|
|
358
429
|
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, '累计(本看板) 有效 ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(effTotal)), ' · 缓存读 ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(u.cacheRead)), ' · 合计 ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(u.total))),
|
|
359
430
|
mini('输入', u.input), mini('输出', u.output), u.cacheWrite ? mini('缓存写', u.cacheWrite) : null),
|
|
360
431
|
// 主窗口(本会话对话)单列行:累计行下方,与看板派发口径并列不混入(mw=null 静默不渲染)
|
|
361
432
|
mwLine(),
|
|
362
433
|
// 近 7 天迷你条形:高按区间 max 归一(今天高亮 brand,其余浅底 + 边框),
|
|
363
|
-
//
|
|
364
|
-
//
|
|
434
|
+
// 柱高一律取**总量**(含缓存读,口径翻转 task-muxnqunk);e===null 的旧口径日就是正常柱
|
|
435
|
+
// (t 恒有值),有效值在 tooltip 里对照(不可知则注明)。7 天全为 0 时整块不渲染。
|
|
365
436
|
hasDayData ? React.createElement('div', { style: { marginBottom: 8 } },
|
|
366
|
-
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '近 7
|
|
437
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '近 7 天(总量,含缓存读)'),
|
|
367
438
|
React.createElement('div', { style: { display: 'flex', alignItems: 'flex-end', gap: 4 } },
|
|
368
439
|
days.map(function (k) {
|
|
369
440
|
var c = dayOf(byDay[k])
|
|
370
|
-
|
|
371
|
-
// 画固定矮灰柱 + tooltip 标明;有效日柱高照常按有效消耗归一。
|
|
372
|
-
var legacy = c.e === null && c.t > 0
|
|
373
|
-
var v = legacy ? 0 : (c.e || 0)
|
|
441
|
+
var v = c.t || 0
|
|
374
442
|
var isToday = k === todayKey
|
|
375
|
-
var h =
|
|
376
|
-
return React.createElement('div', { key: k, title:
|
|
377
|
-
React.createElement('div', { style: { width: '100%', height: h, background:
|
|
443
|
+
var h = v > 0 ? Math.max(3, Math.round(v / maxDay * 32)) : 3
|
|
444
|
+
return React.createElement('div', { key: k, title: k.slice(5) + ':总量 ' + String(v) + ' tok(含缓存读)' + (c.e !== null ? ' / 有效 ' + String(c.e) + ' tok' : ';有效不可知(旧口径日账)'), style: { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2 } },
|
|
445
|
+
React.createElement('div', { style: { width: '100%', height: h, background: isToday ? C.brand : C.nested, border: '1px solid ' + (isToday ? C.brand : C.border), borderRadius: 2 } }),
|
|
378
446
|
React.createElement('span', { style: { fontSize: 8, color: isToday ? C.brand : C.text2, whiteSpace: 'nowrap' } }, k.slice(5)))
|
|
379
447
|
}))) : null,
|
|
380
448
|
React.createElement('div', { style: { display: 'flex', gap: 12, flexWrap: 'wrap' } },
|
|
381
449
|
React.createElement('div', { style: { flex: '1 1 240px', minWidth: 200 } },
|
|
382
|
-
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '
|
|
450
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '按模型分布(总量)'),
|
|
383
451
|
models.length === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无数据') : models.map(function (m) {
|
|
384
|
-
return React.createElement(UsageRow, { key: m.model, label: m.model, value: m.
|
|
452
|
+
return React.createElement(UsageRow, { key: m.model, label: m.model, value: m.total, max: maxM, color: C.brand, title: m.model + ':总量 ' + String(m.total) + ' tokens(含缓存读)' + (m.eff === null ? ';有效不可知(本模型无分量留账)' : ' · 有效 ' + String(m.eff) + ' tokens(输入+输出+缓存写)') })
|
|
385
453
|
}),
|
|
386
|
-
// 模型分布尾部追加「主窗口(对话)」一条(task-muwsol23
|
|
454
|
+
// 模型分布尾部追加「主窗口(对话)」一条(task-muwsol23):总量为 0 不渲染;
|
|
387
455
|
// 琥珀色与 run 模型(brand)区分,固定尾部不参与排序,与派发口径并列不混入
|
|
388
|
-
(mw && mw.
|
|
456
|
+
(mw && mw.total > 0) ? React.createElement(UsageRow, { key: 'main-window', label: '主窗口(对话)', value: mw.total, max: maxM, color: C.warn, title: '主窗口(对话):总量 ' + String(mw.total) + ' tokens(含缓存读)· 有效 ' + String(mw.effective) + ' tokens(不含缓存读)——本会话对话消耗,与看板派发口径并列不混入(不进累计 / Top 8)' }) : null),
|
|
389
457
|
React.createElement('div', { style: { flex: '1 1 240px', minWidth: 200 } },
|
|
390
|
-
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '任务消耗 Top 8
|
|
458
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '任务消耗 Top 8(总量)'),
|
|
391
459
|
top.length === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无数据') : top.map(function (x) {
|
|
392
460
|
var t = getTask(x.id)
|
|
393
|
-
return React.createElement(UsageRow, { key: x.id, label: x.title || x.id, value: x.
|
|
461
|
+
return React.createElement(UsageRow, { key: x.id, label: x.title || x.id, value: x.total, max: maxT, color: C.ok, labelColor: t ? C.brand : C.text2, title: x.title + '(总量 ' + String(x.total) + ' tokens(含缓存读) · 其中缓存读 ' + String(x.cacheRead || 0) + (x.eff === null ? ';有效不可知(老卡无五分量留账)' : ' · 有效 ' + String(x.eff) + ' tokens(输入+输出+缓存写)') + ' · ' + (x.runs || 0) + ' 次 run)' + (t ? '——点击查看详情' : ''), onClick: t ? function () { state.detailId = x.id; notify() } : undefined })
|
|
394
462
|
}))),
|
|
395
463
|
// 口径边界:累计 / Top 8 只统计看板派发的 Worker/Verifier run;主窗口对话消耗自 task-muwsol23 起
|
|
396
464
|
// 单列一行 + 模型分布尾部一条并列展示(不越界混入累计/Top8/归属摊派),caption 必须讲清并列关系。
|
|
397
465
|
// 范围说明(task-muwc7hjd):用户常把 RangeFilter 当成「整页过滤」,但今日大数字与近 7 天柱子
|
|
398
466
|
// 是自身固定口径(今日=本地今天、近 7 天=最近 7 个本地日)——不随范围变,必须在文案里讲清,
|
|
399
467
|
// 否则「选了范围数字没变」看起来像 bug。模型分布/Top8/累计才是范围生效的三处。
|
|
400
|
-
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 6, lineHeight: 1.5 } }, '口径:累计与 Top 8 仅看板派发的 Worker/Verifier run
|
|
401
|
-
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 2, lineHeight: 1.5 } }, '统计范围作用于按模型分布 / 任务消耗 Top 8 / 累计三分量(按 run 的本地日落点过滤);今日与「近 7 天」为固定口径,不随范围变化。')
|
|
468
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 6, lineHeight: 1.5 } }, '口径:累计与 Top 8 仅看板派发的 Worker/Verifier run(= 一次执行)消耗;主窗口行=本会话对话消耗,与看板派发口径并列不混入(单列一行 + 模型分布尾部一条,不进累计 / Top 8);主数字(今日 / 近 7 天 / 模型分布 / Top 8 / 主窗口行)均为总量口径(含缓存读);有效消耗(input+output+cacheWrite,不含缓存读)见悬浮 title'),
|
|
469
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 2, lineHeight: 1.5 } }, '统计范围作用于按模型分布 / 任务消耗 Top 8 / 累计三分量(按 run 的本地日落点过滤);今日与「近 7 天」为固定口径,不随范围变化。'),
|
|
470
|
+
// 「→ 模型表现」滚动锚链接(task-muxhtgi2 卡3):一键滚到下方模型×场景七指标表
|
|
471
|
+
// (与详情页 goArbitration 同一 scrollIntoView 原语;目标区空态也挂锚 id,链接始终可达)
|
|
472
|
+
React.createElement('div', { style: { fontSize: 9, marginTop: 4 } },
|
|
473
|
+
React.createElement('span', { onClick: function () { var el = document.getElementById('tskb-model-perf'); if (el && el.scrollIntoView) el.scrollIntoView({ block: 'start' }) }, style: { color: C.brand, cursor: 'pointer' }, title: '滚动到下方「模型表现」区:模型 × 场景(角色 × 规模段)七指标对比表' }, '→ 模型表现')))
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// ===== 模型表现区(记分卡卡3,task-muxhtgi2):七指标表格 × 场景筛选器(本地过滤不重拉)=====
|
|
477
|
+
// 数据源:state.usageSummary.scoreboard——卡2 host 聚合底座(buildScoreboard)挂进 get-tasks 响应,
|
|
478
|
+
// 与 Token 区同通道透传、同一 range 口径(范围切换重拉后随 notify 同步刷新,本区零自持请求)。
|
|
479
|
+
// 每桶 = 模型 × 角色(worker/verifier)× 规模段(small/medium/large,按任务有效 token 分桶)。
|
|
480
|
+
// 本区三件事全部本地现算:
|
|
481
|
+
// ① 场景筛选器:角色(全部/worker/verifier)+ 规模段(全部/小/中/大)——scoreboard 已在响应里,
|
|
482
|
+
// 筛选只是 buckets 数组 pass,绝不重拉(组件内无 rpc/fetchTasks);
|
|
483
|
+
// ② 七指标表格:每 模型×场景桶 一行,七列——有效均值/耗时中位/驳回率/一次通过率/超时率/续跑率/
|
|
484
|
+
// 缓存命中率;表头列名带 title 口径说明(与卡2 host 注释同源);
|
|
485
|
+
// ③ 样本护栏:insufficient(runs<5)行整行灰显 + title 前缀「样本 <5,仅供参考」——
|
|
486
|
+
// 仅供参考,不参与任何「最优」视觉强调(本区 v1 不做任何高亮排名,从源头规避)。
|
|
487
|
+
// 空态:scoreboard 缺字段 / buckets 空 → 「暂无足够 run 数据」(锚 id 照挂,Token 区链接始终可达);
|
|
488
|
+
// 筛选后空 → 「当前筛选无匹配桶」。
|
|
489
|
+
// 锚点:区根 id='tskb-model-perf',Token 区 caption 的「→ 模型表现」链接 scrollIntoView 过来。
|
|
490
|
+
var MP_SIZE_LABEL = { small: '小', medium: '中', large: '大' }
|
|
491
|
+
// 率类/耗时格式化:null = 无样本(不假装 0,与 host 同哲学)
|
|
492
|
+
function mpPct(r) { return (r === null || r === undefined || !isFinite(r)) ? '—' : Math.round(r * 100) + '%' }
|
|
493
|
+
function mpDur(ms) { if (ms === null || ms === undefined || !isFinite(ms)) return '—'; var m = Math.round(ms / 60000); if (m < 1) return '<1m'; if (m < 60) return m + 'm'; return (m / 60).toFixed(1) + 'h' }
|
|
494
|
+
// 七列定义:label + title 口径说明 + 取值格式化(口径一句话版与 README 仪表盘段同步维护)
|
|
495
|
+
var MP_COLS = [
|
|
496
|
+
{ k: 'effAvg', label: '有效均值', title: '有效 token 均值 = 桶内 run 有效消耗(输入+输出+缓存写,不含缓存读)的均值;无 usage 留账的 run 不进均值(不伪造 0)', fmt: function (b) { return b.effAvg === null ? '—' : fmtTokens(b.effAvg) } },
|
|
497
|
+
{ k: 'durMedianMs', label: '耗时中位', title: 'run 耗时(endedAt - at)中位数;P90 见行 title;无合法时刻的 run 不进分布', fmt: function (b) { return mpDur(b.durMedianMs) } },
|
|
498
|
+
{ k: 'rejectRate', label: '驳回率', title: '驳回率 = 归因到本桶 run 的验收驳回次数 / 桶内 runs(归因 = 驳回前最近 worker run)', fmt: function (b) { return mpPct(b.rejectRate) } },
|
|
499
|
+
{ k: 'firstPassRate', label: '一次通过率', title: '一次通过率 = 桶内 resolved 任务中 rejectCount=0(零驳回)的占比;桶内无 resolved 任务 → —', fmt: function (b) { return mpPct(b.firstPassRate) } },
|
|
500
|
+
{ k: 'timeoutRate', label: '超时率', title: '超时率 = outcome 超时落定(timeout/error)的 run / 桶内 runs', fmt: function (b) { return mpPct(b.timeoutRate) } },
|
|
501
|
+
{ k: 'resumeRate', label: '续跑率', title: '续跑率 = resume:true 续跑记录 / 桶内 runs', fmt: function (b) { return mpPct(b.resumeRate) } },
|
|
502
|
+
{ k: 'cacheHitRate', label: '缓存命中率', title: '缓存命中率 = cacheRead / (input + cacheRead);⚠️ 跨 provider 口径可能不一(input 是否含缓存读各家不同),对比前先核口径;无 usage 样本 → —', fmt: function (b) { return mpPct(b.cacheHitRate) } }
|
|
503
|
+
]
|
|
504
|
+
function ModelPerf(props) {
|
|
505
|
+
var _R = React; var useState = _R.useState
|
|
506
|
+
var _a = useState(state.mpRole || ''), roleF = _a[0], setRoleF = _a[1]
|
|
507
|
+
var _b = useState(state.mpSize || ''), sizeF = _b[0], setSizeF = _b[1]
|
|
508
|
+
function pickRole(v) { state.mpRole = v; setRoleF(v) }
|
|
509
|
+
function pickSize(v) { state.mpSize = v; setSizeF(v) }
|
|
510
|
+
var box = { padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12 }
|
|
511
|
+
// 范围激活标记与 Token 区同源:scoreboard 由 host 按同一 range 裁剪,范围内数据必须亮明身份
|
|
512
|
+
var tg = activeRange()
|
|
513
|
+
var tgOn = !!(tg.from || tg.to)
|
|
514
|
+
var head = React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 4 } }, ic('bot', 11), '模型表现',
|
|
515
|
+
tgOn ? React.createElement('span', { style: { fontSize: 9, fontWeight: 400, color: C.brand, border: '1px solid ' + C.brand, borderRadius: 8, padding: '0 6px' }, title: '本区桶数据已按统计范围过滤(与 Token 区同一 range 口径):' + rangeLabel() }, '范围内: ' + rangeLabel()) : null)
|
|
516
|
+
var sb = props.sb
|
|
517
|
+
var buckets = (sb && Array.isArray(sb.buckets)) ? sb.buckets : []
|
|
518
|
+
// 空态:无 scoreboard(老 host)/ 无入桶 run → 一句话空态(锚 id 照挂,Token 区链接始终可达)
|
|
519
|
+
if (!buckets.length) return React.createElement('div', { id: 'tskb-model-perf', style: box }, head, React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无足够 run 数据(还没有可入桶的已落定 Worker/Verifier run 留账)'))
|
|
520
|
+
// 本地筛选:角色 × 规模段,纯数组 pass 不重拉
|
|
521
|
+
var shown = buckets.filter(function (b) { return (!roleF || b.role === roleF) && (!sizeF || b.size === sizeF) })
|
|
522
|
+
function chip(cur, setter, v, label) {
|
|
523
|
+
var on = cur === v
|
|
524
|
+
return React.createElement('button', { onClick: function () { setter(v) }, style: { fontSize: 10, padding: '1px 8px', border: '1px solid ' + (on ? C.brand : C.border2), borderRadius: 10, background: on ? C.nested : C.card, color: on ? C.brand : C.text2, cursor: 'pointer' } }, label)
|
|
525
|
+
}
|
|
526
|
+
var thL = { fontSize: 9, color: C.text2, fontWeight: 600, textAlign: 'left', padding: '2px 4px', borderBottom: '1px solid ' + C.border, whiteSpace: 'nowrap' }
|
|
527
|
+
var thR = { fontSize: 9, color: C.text2, fontWeight: 600, textAlign: 'right', padding: '2px 4px', borderBottom: '1px solid ' + C.border, whiteSpace: 'nowrap', cursor: 'help' }
|
|
528
|
+
var tdL = { fontSize: 10, color: C.text, textAlign: 'left', padding: '3px 4px', borderBottom: '1px solid ' + C.nested, whiteSpace: 'nowrap' }
|
|
529
|
+
var tdR = { fontSize: 10, color: C.text, textAlign: 'right', padding: '3px 4px', borderBottom: '1px solid ' + C.nested, whiteSpace: 'nowrap' }
|
|
530
|
+
var insufN = shown.filter(function (b) { return b.insufficient }).length
|
|
531
|
+
return React.createElement('div', { id: 'tskb-model-perf', style: box },
|
|
532
|
+
head,
|
|
533
|
+
// 场景筛选器(本地):角色 + 规模段两组 chip;右侧计数「显示/总数 · 样本不足 N」
|
|
534
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 4, flexWrap: 'wrap', marginBottom: 6 } },
|
|
535
|
+
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, '角色'),
|
|
536
|
+
chip(roleF, pickRole, '', '全部'), chip(roleF, pickRole, 'worker', 'worker'), chip(roleF, pickRole, 'verifier', 'verifier'),
|
|
537
|
+
React.createElement('span', { style: { fontSize: 10, color: C.text2, marginLeft: 6 } }, '规模段'),
|
|
538
|
+
chip(sizeF, pickSize, '', '全部'), chip(sizeF, pickSize, 'small', '小'), chip(sizeF, pickSize, 'medium', '中'), chip(sizeF, pickSize, 'large', '大'),
|
|
539
|
+
React.createElement('span', { style: { fontSize: 9, color: C.text2, marginLeft: 'auto' } }, shown.length + '/' + buckets.length + ' 桶' + (insufN ? ' · ' + insufN + ' 桶样本不足' : ''))),
|
|
540
|
+
shown.length === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2, padding: '4px 0' } }, '当前筛选无匹配桶(试试放宽角色/规模段)')
|
|
541
|
+
: React.createElement('div', { style: { overflowX: 'auto' } },
|
|
542
|
+
React.createElement('table', { style: { width: '100%', borderCollapse: 'collapse' } },
|
|
543
|
+
React.createElement('thead', null, React.createElement('tr', null,
|
|
544
|
+
React.createElement('th', { style: thL }, '模型'),
|
|
545
|
+
React.createElement('th', { style: thL }, '场景'),
|
|
546
|
+
React.createElement('th', { style: thR, title: '桶内已落定 run 数;<5 为样本不足,整行灰显仅供参考' }, '样本'),
|
|
547
|
+
MP_COLS.map(function (c) { return React.createElement('th', { key: c.k, style: thR, title: c.title }, c.label) }))),
|
|
548
|
+
React.createElement('tbody', null, shown.map(function (b) {
|
|
549
|
+
// 样本护栏:insufficient 行整行灰显 + title 前缀「样本 <5,仅供参考」,不进任何最优强调
|
|
550
|
+
var tip = (b.insufficient ? '样本 <5,仅供参考——' : '') + b.model + ' × ' + b.role + ' × ' + (MP_SIZE_LABEL[b.size] || b.size) + ':runs=' + b.runs + ';有效总额 ' + fmtTokens(b.effSum) + ' tok;耗时 P90 ' + mpDur(b.durP90Ms) + '(七指标口径见表头 title)'
|
|
551
|
+
return React.createElement('tr', { key: b.model + '|' + b.role + '|' + b.size, title: tip, style: { opacity: b.insufficient ? 0.45 : 1 } },
|
|
552
|
+
React.createElement('td', { style: tdL }, b.model),
|
|
553
|
+
React.createElement('td', { style: tdL }, b.role + '·' + (MP_SIZE_LABEL[b.size] || b.size)),
|
|
554
|
+
React.createElement('td', { style: tdR }, String(b.runs)),
|
|
555
|
+
MP_COLS.map(function (c) { return React.createElement('td', { key: c.k, style: tdR }, c.fmt(b)) }))
|
|
556
|
+
})))),
|
|
557
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 6, lineHeight: 1.5 } }, '口径:每行 = 模型 × 角色 × 规模段桶(规模按任务有效 token:小 <1M / 中 1~10M / 大 >10M);率类分母为桶内 runs,一次通过率分母为桶内 resolved 任务;runs<5 行灰显 = 样本不足仅供参考;随统计范围裁剪(与 Token 区同一 range)'))
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
// ===== 质量趋势区(记分卡卡4,task-muxhtgil):一次通过率趋势 / 卡时长分布 / 超时率走势 / 续跑成功率 =====
|
|
561
|
+
// 数据源:state.usageSummary.scoreboard.trends——卡2 host 聚合底座(assembleScoreboard)的全局 rollup,
|
|
562
|
+
// 与模型表现区同通道(get-tasks 响应透传)、同一 range 口径(host 已按 run/落定日裁剪,client 只渲染,
|
|
563
|
+
// 组件体内零 rpc/fetchTasks 不重拉)。
|
|
564
|
+
// 四块(P1 质量 KPI 并入的全局视图):
|
|
565
|
+
// ① 一次通过率趋势:近 14 天柱形(firstPassByDay:resolved 任务按落定日,当日零驳回占比),今日柱高亮 + 块头标今日值;
|
|
566
|
+
// ② 卡时长分布:四桶横条(durationBuckets:<10m / 10-30m / 30-60m / >60m,创建→落定墙钟,60m 端点归 30-60m 桶);
|
|
567
|
+
// ③ 超时率走势:近 14 天迷你柱行(timeoutByDay:当日超时落定 run / 当日 runs);
|
|
568
|
+
// ④ 续跑成功率:resume 续跑 run 的 completed 占比(卡2出参为范围总量口径、无 byDay——迷你行显率 + 成功/次数,不伪造逐日)。
|
|
569
|
+
// 空态灰显:trends 缺字段(老 host)/ 四块皆无数据 → 整区一句灰字(锚 id 照挂);单块无数据 → 块内灰字「暂无…」。
|
|
570
|
+
// 范围联动:trends 各字段已被 host 按统计范围裁剪,区头带「范围内: …」徽章(与 Token / 模型表现区同源 activeRange);
|
|
571
|
+
// 近 14 天为固定窗口(设计口径:标今日值),范围落在窗口外时对应日柱为空,caption 写明。
|
|
572
|
+
var QT_DUR_BUCKETS = [
|
|
573
|
+
{ k: 'lt10m', label: '<10m', tip: '卡时长 <10 分钟' },
|
|
574
|
+
{ k: 'm10to30', label: '10-30m', tip: '卡时长 10~30 分钟' },
|
|
575
|
+
{ k: 'm30to60', label: '30-60m', tip: '卡时长 30~60 分钟(含 60m 端点)' },
|
|
576
|
+
{ k: 'gt60m', label: '>60m', tip: '卡时长 >60 分钟' }
|
|
577
|
+
]
|
|
578
|
+
// 近 14 天柱形通用画法(① 通过率 / ③ 超时率共用):cells = [{ k, rate(null=当日无样本), tip }]
|
|
579
|
+
// 今日柱 brand 高亮 + 率值顶标;无样本日画 3px 灰基线(title 写明无样本,不假装 0%)。
|
|
580
|
+
function qtDayBars(cells, color, todayKey) {
|
|
581
|
+
return React.createElement('div', { style: { display: 'flex', alignItems: 'flex-end', gap: 3, height: 46 } },
|
|
582
|
+
cells.map(function (c) {
|
|
583
|
+
var isToday = c.k === todayKey
|
|
584
|
+
var h = c.rate === null ? 3 : Math.max(4, Math.round(c.rate * 34))
|
|
585
|
+
var kp = c.k.split('-')
|
|
586
|
+
var dLabel = Number(kp[1]) + '/' + Number(kp[2])
|
|
587
|
+
return React.createElement('div', { key: c.k, style: { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', justifyContent: 'flex-end', gap: 1 }, title: c.tip },
|
|
588
|
+
c.rate !== null ? React.createElement('span', { style: { fontSize: 8, color: isToday ? C.brand : C.text2 } }, mpPct(c.rate)) : null,
|
|
589
|
+
React.createElement('div', { style: { width: '100%', maxWidth: 22, height: h + 'px', borderRadius: 2, background: c.rate === null ? C.nested : (isToday ? C.brand : color), border: '1px solid ' + (isToday ? C.brand : (c.rate === null ? C.border : color)) } }),
|
|
590
|
+
React.createElement('span', { style: { fontSize: 8, color: isToday ? C.brand : C.text2 } }, dLabel))
|
|
591
|
+
}))
|
|
592
|
+
}
|
|
593
|
+
function QualityTrends(props) {
|
|
594
|
+
var sb = props.sb
|
|
595
|
+
var tr = (sb && sb.trends && typeof sb.trends === 'object') ? sb.trends : null
|
|
596
|
+
var box = { padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12 }
|
|
597
|
+
// 范围激活标记与 Token / 模型表现区同源:trends 由 host 按同一 range 裁剪,范围内数据必须亮明身份
|
|
598
|
+
var tg = activeRange()
|
|
599
|
+
var tgOn = !!(tg.from || tg.to)
|
|
600
|
+
var head = React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 4 } }, ic('check-circle', 11), '质量趋势',
|
|
601
|
+
tgOn ? React.createElement('span', { style: { fontSize: 9, fontWeight: 400, color: C.brand, border: '1px solid ' + C.brand, borderRadius: 8, padding: '0 6px' }, title: '本区趋势数据已按统计范围过滤(与 Token 区同一 range 口径):' + rangeLabel() }, '范围内: ' + rangeLabel()) : null)
|
|
602
|
+
var fpByDay = (tr && tr.firstPassByDay && typeof tr.firstPassByDay === 'object') ? tr.firstPassByDay : {}
|
|
603
|
+
var durB = (tr && tr.durationBuckets && typeof tr.durationBuckets === 'object') ? tr.durationBuckets : null
|
|
604
|
+
var toByDay = (tr && tr.timeoutByDay && typeof tr.timeoutByDay === 'object') ? tr.timeoutByDay : {}
|
|
605
|
+
var rsm = (tr && tr.resume && typeof tr.resume === 'object') ? tr.resume : null
|
|
606
|
+
// 整区空态判定:四块皆无数据(率类按日单元求和 / 时长按四桶求和 / 续跑按 runs)
|
|
607
|
+
var fpSum = 0; for (var fk in fpByDay) { if (Object.prototype.hasOwnProperty.call(fpByDay, fk)) fpSum += (fpByDay[fk] && fpByDay[fk].resolved) || 0 }
|
|
608
|
+
var toSum = 0; for (var tk2 in toByDay) { if (Object.prototype.hasOwnProperty.call(toByDay, tk2)) toSum += (toByDay[tk2] && toByDay[tk2].runs) || 0 }
|
|
609
|
+
var durSum = 0
|
|
610
|
+
if (durB) QT_DUR_BUCKETS.forEach(function (b) { durSum += Number(durB[b.k]) || 0 })
|
|
611
|
+
var rsmRuns = (rsm && rsm.runs) || 0
|
|
612
|
+
if (!tr || (fpSum + toSum + durSum + rsmRuns) === 0) {
|
|
613
|
+
return React.createElement('div', { id: 'tskb-quality-trends', style: box }, head,
|
|
614
|
+
React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无足够 run 数据(还没有可统计的已落定 Worker/Verifier run / resolved 任务)'))
|
|
615
|
+
}
|
|
616
|
+
var days14 = lastNDays(14)
|
|
617
|
+
var todayKey = localDayKey()
|
|
618
|
+
// 块头:左块名 + 右侧今日/汇总值(fontWeight 400 小字)
|
|
619
|
+
function blockHead(label, rightEl, tip) {
|
|
620
|
+
return React.createElement('div', { title: tip, style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4, display: 'flex', alignItems: 'baseline', gap: 6 } }, label,
|
|
621
|
+
rightEl ? React.createElement('span', { style: { marginLeft: 'auto', fontWeight: 400, fontSize: 9 } }, rightEl) : null)
|
|
622
|
+
}
|
|
623
|
+
// ===== ① 一次通过率趋势(近 14 天):当日率 = 落定 resolved 任务中零驳回(rejectCount=0)占比 =====
|
|
624
|
+
var fpCells = days14.map(function (k) {
|
|
625
|
+
var c = fpByDay[k]
|
|
626
|
+
var resolved = (c && c.resolved) || 0
|
|
627
|
+
var firstPass = (c && c.firstPass) || 0
|
|
628
|
+
return { k: k, rate: resolved ? firstPass / resolved : null, tip: k + ':' + (resolved ? ('一次通过率 ' + mpPct(firstPass / resolved) + '(零驳回 ' + firstPass + ' / 落定 ' + resolved + ')') : '无 resolved 任务落定') }
|
|
629
|
+
})
|
|
630
|
+
var fpHas = false; fpCells.forEach(function (c) { if (c.rate !== null) fpHas = true })
|
|
631
|
+
var fpToday = fpCells[fpCells.length - 1]
|
|
632
|
+
var block1 = React.createElement('div', { style: { flex: '1 1 260px', minWidth: 230 } },
|
|
633
|
+
blockHead('一次通过率(近 14 天)', React.createElement('span', null, '今日 ', React.createElement('span', { style: { color: fpToday.rate !== null ? C.brand : C.text2, fontWeight: 600 } }, fpToday.rate !== null ? mpPct(fpToday.rate) : '—')), '一次通过率 = 当天落定「已完成」任务里零驳回(rejectCount=0)的占比;驳回 = Verifier 验收判 reject'),
|
|
634
|
+
fpHas ? qtDayBars(fpCells, C.ok, todayKey)
|
|
635
|
+
: React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '近 14 天窗口内暂无 resolved 任务落定'))
|
|
636
|
+
// ===== ② 卡时长分布(四桶横条):创建 → 落定(verifiedAt||resolvedAt)墙钟,含排队/执行/验收全程 =====
|
|
637
|
+
var durMax = 1
|
|
638
|
+
if (durB) QT_DUR_BUCKETS.forEach(function (b) { var v = Number(durB[b.k]) || 0; if (v > durMax) durMax = v })
|
|
639
|
+
var block2 = React.createElement('div', { style: { flex: '1 1 180px', minWidth: 170 } },
|
|
640
|
+
blockHead('卡时长分布', durSum > 0 ? React.createElement('span', null, React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, String(durSum)), ' 张落定卡') : null, '卡时长 = 创建 → 落定的墙钟(含排队/执行/验收全程)'),
|
|
641
|
+
durSum === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无时长样本')
|
|
642
|
+
: React.createElement('div', null, QT_DUR_BUCKETS.map(function (b) {
|
|
643
|
+
var v = Number(durB[b.k]) || 0
|
|
644
|
+
var pct = v > 0 ? Math.max(2, Math.round(v / durMax * 100)) : 0
|
|
645
|
+
return React.createElement('div', { key: b.k, style: { display: 'flex', alignItems: 'center', gap: 6, marginBottom: 4 }, title: b.tip + ':' + v + ' 张(创建→落定墙钟,含排队 / 执行 / 验收全程)' },
|
|
646
|
+
React.createElement('span', { style: { width: 44, fontSize: 10, color: C.text2, textAlign: 'right', flexShrink: 0 } }, b.label),
|
|
647
|
+
React.createElement('div', { style: { flex: 1, height: 8, background: C.nested, borderRadius: 4, overflow: 'hidden' } },
|
|
648
|
+
React.createElement('div', { style: { height: '100%', width: pct + '%', background: C.brand, borderRadius: 4, transition: 'width .3s' } })),
|
|
649
|
+
React.createElement('span', { style: { width: 24, fontSize: 10, color: C.text2, flexShrink: 0 } }, String(v)))
|
|
650
|
+
})))
|
|
651
|
+
// ===== ③ 超时率走势(近 14 天迷你柱行):当日率 = 超时落定(timeout/error)run / 当日 runs =====
|
|
652
|
+
var toCells = days14.map(function (k) {
|
|
653
|
+
var c = toByDay[k]
|
|
654
|
+
var runs = (c && c.runs) || 0
|
|
655
|
+
var timeouts = (c && c.timeout) || 0
|
|
656
|
+
return { k: k, rate: runs ? timeouts / runs : null, tip: k + ':' + (runs ? ('超时率 ' + mpPct(timeouts / runs) + '(超时 ' + timeouts + ' / run ' + runs + ')') : '无 run 落定') }
|
|
657
|
+
})
|
|
658
|
+
var toHas = false; toCells.forEach(function (c) { if (c.rate !== null) toHas = true })
|
|
659
|
+
var toToday = toCells[toCells.length - 1]
|
|
660
|
+
var block3 = React.createElement('div', { style: { flex: '1 1 260px', minWidth: 230 } },
|
|
661
|
+
blockHead('超时率走势(近 14 天)', React.createElement('span', null, '今日 ', React.createElement('span', { style: { color: toToday.rate !== null ? C.warn : C.text2, fontWeight: 600 } }, toToday.rate !== null ? mpPct(toToday.rate) : '—')), '超时率 = 超时落定(timeout/error)的 run 占当天 run 的比例'),
|
|
662
|
+
toHas ? qtDayBars(toCells, C.warn, todayKey)
|
|
663
|
+
: React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '近 14 天窗口内暂无 run 落定'))
|
|
664
|
+
// ===== ④ 续跑成功率(范围总量口径,卡2出参无 byDay):resume:true 续跑记录中 completed 占比 =====
|
|
665
|
+
var rsmRate = (rsm && typeof rsm.rate === 'number' && isFinite(rsm.rate)) ? rsm.rate : null
|
|
666
|
+
var block4 = React.createElement('div', { style: { flex: '1 1 180px', minWidth: 170 } },
|
|
667
|
+
blockHead('续跑成功率', rsmRuns > 0 ? React.createElement('span', null, React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, String((rsm && rsm.completed) || 0) + '/' + rsmRuns), ' 续跑成功') : null, '续跑成功率 = resume 续跑记录中 outcome=completed 的占比;续跑 = 前次超时/失败后继续跑'),
|
|
668
|
+
rsmRuns === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无续跑记录')
|
|
669
|
+
: React.createElement('div', { title: '续跑成功率 = resume:true 续跑记录中 outcome=completed 的占比(范围总量口径,host 出参无逐日);续跑 = 前次 run 超时/失败后续跑' },
|
|
670
|
+
React.createElement('div', { style: { fontSize: 16, fontWeight: 700, color: rsmRate !== null ? C.ok : C.text2 } }, rsmRate !== null ? mpPct(rsmRate) : '—'),
|
|
671
|
+
React.createElement('div', { style: { height: 6, background: C.nested, borderRadius: 3, overflow: 'hidden', marginTop: 4 } },
|
|
672
|
+
React.createElement('div', { style: { height: '100%', width: (rsmRate !== null ? Math.round(rsmRate * 100) : 0) + '%', background: C.ok, borderRadius: 3, transition: 'width .3s' } }))))
|
|
673
|
+
return React.createElement('div', { id: 'tskb-quality-trends', style: box },
|
|
674
|
+
head,
|
|
675
|
+
React.createElement('div', { style: { display: 'flex', gap: 16, flexWrap: 'wrap', marginBottom: 8 } }, block1, block2),
|
|
676
|
+
React.createElement('div', { style: { display: 'flex', gap: 16, flexWrap: 'wrap' } }, block3, block4),
|
|
677
|
+
// 口径 caption:一句讲清统计本体(看板派发 run / 任务落定)+ 驳回定义 + 固定窗口与范围的关系
|
|
678
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 8, lineHeight: 1.5 } }, '口径:仅看板派发的 Worker/Verifier run 与任务落定记录(按本地日落点,随统计范围裁剪);一次通过率 = 当日落定 resolved 任务中零驳回占比(驳回 = 验收 verdict rejected,归因驳回前最近 worker run);超时 = run 落定 timeout/error;续跑成功率 = resume 续跑记录中 completed 占比(范围总量口径,无逐日);卡时长 = 创建 → 落定墙钟(含排队 / 验收)。通过率与超时率为近 14 天固定窗口——范围落在窗口外时对应日柱为空'))
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// ===== 驳回聚类区(记分卡卡5,task-muxhu1zv):驳回原因 Top3 +「建议沉淀为约定」文本(一键复制)=====
|
|
682
|
+
// 数据源:state.usageSummary.scoreboard.rejectionClusters——host 规则法聚类(关键词模板,首命中归类;
|
|
683
|
+
// 按驳回消息自身日落点随统计范围裁剪),与卡3/卡4 同通道透传,本区只渲染零 rpc(不重拉)。
|
|
684
|
+
// 每行 = TopN 类目 + 占比(count/total)+ 结构化建议文本 + 「复制」按钮(建议文本进剪贴板,
|
|
685
|
+
// 沉淀动作人工——v1 只输出文本,不代调 notes 插件);代表原文(截断 80 字 ×≤3 条)放行 title 悬浮。
|
|
686
|
+
// 缺省兼容:老 host 无 rejectionClusters 字段 → 返回 null 整块不渲染(与 HealthHints 同哲学);
|
|
687
|
+
// 有字段但 total=0 → 区头 + 一句空态「暂无驳回记录」。
|
|
688
|
+
function RejectionClusters(props) {
|
|
689
|
+
var _R = React; var useState = _R.useState
|
|
690
|
+
var _c = useState(''), copiedId = _c[0], setCopiedId = _c[1]
|
|
691
|
+
var sb = props.sb
|
|
692
|
+
var rc = sb && sb.rejectionClusters
|
|
693
|
+
if (!rc || typeof rc !== 'object') return null // 老 host 缺字段:整块不渲染(零残留)
|
|
694
|
+
var box = { padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12 }
|
|
695
|
+
var tg = activeRange()
|
|
696
|
+
var tgOn = !!(tg.from || tg.to)
|
|
697
|
+
var head = React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 4 } }, ic('flask-conical', 11), '驳回聚类',
|
|
698
|
+
tgOn ? React.createElement('span', { style: { fontSize: 9, fontWeight: 400, color: C.brand, border: '1px solid ' + C.brand, borderRadius: 8, padding: '0 6px' }, title: '本区已按统计范围过滤(按驳回消息本地日落点,与 Token 区同一 range):' + rangeLabel() }, '范围内: ' + rangeLabel()) : null)
|
|
699
|
+
var top = Array.isArray(rc.top) ? rc.top : []
|
|
700
|
+
if (!rc.total || !top.length) {
|
|
701
|
+
return React.createElement('div', { id: 'tskb-rejection-clusters', style: box }, head,
|
|
702
|
+
React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无驳回记录(验收驳回后会按关键词模板聚类出 Top3 类目与约定建议)'))
|
|
703
|
+
}
|
|
704
|
+
// 复制建议文本:clipboard API 不可用/被拒时静默降级(按钮不变样,下轮再试)
|
|
705
|
+
function copySugg(c) {
|
|
706
|
+
var text = String(c.suggestion || '')
|
|
707
|
+
if (!text) return
|
|
708
|
+
try {
|
|
709
|
+
navigator.clipboard.writeText(text).then(function () {
|
|
710
|
+
setCopiedId(c.id); setTimeout(function () { setCopiedId('') }, 2000)
|
|
711
|
+
}, function () {})
|
|
712
|
+
} catch (_) {}
|
|
713
|
+
}
|
|
714
|
+
return React.createElement('div', { id: 'tskb-rejection-clusters', style: box },
|
|
715
|
+
head,
|
|
716
|
+
top.map(function (c, i) {
|
|
717
|
+
var tip = (c.samples && c.samples.length) ? '代表原文:\n' + c.samples.map(function (s) { return '· ' + s }).join('\n') : '(无代表原文)'
|
|
718
|
+
return React.createElement('div', { key: c.id, title: tip, style: { marginBottom: 6, paddingBottom: 6, borderBottom: i < top.length - 1 ? '1px solid ' + C.nested : 'none' } },
|
|
719
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, fontSize: 11 } },
|
|
720
|
+
React.createElement('span', { style: { color: C.warn, fontWeight: 700 } }, 'Top' + (i + 1)),
|
|
721
|
+
React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, c.label),
|
|
722
|
+
React.createElement('span', { style: { color: C.text2, fontSize: 10 } }, c.pct + '%(' + c.count + '/' + rc.total + ')'),
|
|
723
|
+
React.createElement('button', { onClick: function () { copySugg(c) }, title: '复制「建议沉淀为约定」文本(粘贴到派发约定/Worker prompt,沉淀动作人工)', style: { marginLeft: 'auto', fontSize: 9, padding: '1px 8px', border: '1px solid ' + C.border2, borderRadius: 9, background: C.card, color: copiedId === c.id ? C.ok : C.text2, cursor: 'pointer' } }, copiedId === c.id ? '✅ 已复制' : '📋 复制约定建议')),
|
|
724
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, lineHeight: 1.5, marginTop: 2 } }, String(c.suggestion || '')))
|
|
725
|
+
}),
|
|
726
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 4, lineHeight: 1.5 } }, '口径:规则法关键词模板聚类(首命中归类,不上 embedding);占比分母 = ' + (tgOn ? '范围内' : '') + '驳回总数(' + rc.total + ' 条)' + (rc.restCount ? ';另有 ' + rc.restCount + ' 类未进 Top3' : '') + ';建议文本一键复制后人工沉淀为约定'))
|
|
402
727
|
}
|
|
403
728
|
|
|
404
729
|
// ===== 架构健康提示区(架构自省 L1 · 数据源:state.healthHints)=====
|
|
@@ -413,6 +738,8 @@
|
|
|
413
738
|
var infoColor = 'var(--dsw-alias-state-business-primary)'
|
|
414
739
|
return React.createElement('div', { style: { padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12 } },
|
|
415
740
|
React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6, display: 'flex', alignItems: 'center', gap: 4 } }, ic('activity', 11), '架构健康'),
|
|
741
|
+
// 术语白话(巡检 n-muyg5m7o5r00):settle/touches/p90 等黑话第一屏无解,补一行术语说明
|
|
742
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginBottom: 5, lineHeight: 1.5 } }, '运行时自检告警,多为自动恢复的瞬时异常。术语:settle = 任务结算通道;touches = 任务声明的改动文件(文件锁);p90 = 执行时长第 90 百分位'),
|
|
416
743
|
hints.map(function (h, i) {
|
|
417
744
|
var warn = h.level === 'warn'
|
|
418
745
|
var col = warn ? C.warn : infoColor
|
|
@@ -430,6 +757,12 @@
|
|
|
430
757
|
React.createElement('div', { style: { display: 'flex', gap: 6, marginBottom: 12, flexWrap: 'wrap' } }, React.createElement(StatCard, { label: '总任务', value: stats.total, color: C.text }), React.createElement(StatCard, { label: '待办', value: stats.byStatus['pending'] || 0, color: C.text2 }), React.createElement(StatCard, { label: '进行中', value: stats.byStatus['in-progress'] || 0, color: C.brand }), React.createElement(StatCard, { label: '验证中', value: stats.byStatus['verifying'] || 0, color: C.warn }), React.createElement(StatCard, { label: '已完成', value: stats.byStatus['resolved'] || 0, color: C.ok }), React.createElement(StatCard, { label: '已归档', value: stats.byStatus['archived'] || 0, color: C.text2 })),
|
|
431
758
|
React.createElement(HealthHints),
|
|
432
759
|
React.createElement(TokenUsage, { usage: state.usageSummary }),
|
|
760
|
+
// 模型表现区(卡3):Token 区正下方;scoreboard 随 usageSummary 同通道透传(老 host 缺字段 → null → 空态)
|
|
761
|
+
React.createElement(ModelPerf, { sb: (state.usageSummary && state.usageSummary.scoreboard) || null }),
|
|
762
|
+
// 质量趋势区(卡4):模型表现区正下方;同一 scoreboard 出参的 trends 全局 rollup(老 host 缺字段 → null → 空态灰显)
|
|
763
|
+
React.createElement(QualityTrends, { sb: (state.usageSummary && state.usageSummary.scoreboard) || null }),
|
|
764
|
+
// 驳回聚类区(卡5):质量趋势区正下方;scoreboard.rejectionClusters(老 host 缺字段 → 组件返回 null 整块不渲染)
|
|
765
|
+
React.createElement(RejectionClusters, { sb: (state.usageSummary && state.usageSummary.scoreboard) || null }),
|
|
433
766
|
React.createElement('div', { style: { display: 'flex', gap: 12, marginBottom: 12, flexWrap: 'wrap' } },
|
|
434
767
|
React.createElement('div', { style: { flex: '1 1 0', minWidth: 200, padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6 } }, React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6 } }, '按状态分布'), statusOrder.map(function (s) { return React.createElement(BarRow, { key: s, label: statusLabels[s] || s, count: stats.byStatus[s] || 0, total: stats.total, color: statusColors[s] || C.brand }) })),
|
|
435
768
|
React.createElement('div', { style: { flex: '1 1 0', minWidth: 200, padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6 } }, React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6 } }, '按优先级分布'), prioOrder.map(function (p) { return React.createElement(BarRow, { key: p, label: prioLabel[p] || p, count: stats.byPriority[p] || 0, total: stats.total, color: prioColor[p] || C.brand }) }))),
|
|
@@ -447,12 +780,12 @@
|
|
|
447
780
|
function pick(m) { if (m === cur) return; rpc('set-work-mode', { mode: m }).then(fetchTasks).catch(function () {}) }
|
|
448
781
|
// 档位文案:名称 + 一句说明(说明常驻显示在按钮内,选中态高亮不可用 title 才看得到)
|
|
449
782
|
var opts = [
|
|
450
|
-
{ k: 'list', name: '清单模式', desc: '
|
|
451
|
-
{ k: 'auto', name: '自动派发', desc: '
|
|
452
|
-
{ k: 'team', name: 'Team 托管', desc: '
|
|
783
|
+
{ k: 'list', name: '清单模式', desc: '只读清单,不自动派发', icon: 'clipboard-list' },
|
|
784
|
+
{ k: 'auto', name: '自动派发', desc: '建卡即派给后台子代理', icon: 'zap' },
|
|
785
|
+
{ k: 'team', name: 'Team 托管', desc: '草稿起步,你裁决全流程', icon: 'users' }
|
|
453
786
|
]
|
|
454
787
|
var btnBase = { border: 'none', cursor: 'pointer', fontWeight: 500, textAlign: 'center', display: 'inline-flex', flexDirection: 'column', alignItems: 'center', gap: 1, padding: '3px 9px', transition: 'all .15s', lineHeight: 1.25 }
|
|
455
|
-
return React.createElement('div', { title: '工作模式(清单 / 自动派发 / Team 托管)——歧义裁决、Verifier
|
|
788
|
+
return React.createElement('div', { title: '工作模式(清单 / 自动派发 / Team 托管)——歧义裁决、Verifier 验收、文件锁(touches)排他在三档下全部生效', style: { display: 'inline-flex', borderRadius: 8, border: '1px solid ' + C.border, overflow: 'hidden', background: C.card } }, opts.map(function (o) {
|
|
456
789
|
var on = cur === o.k
|
|
457
790
|
return React.createElement('button', {
|
|
458
791
|
key: o.k, onClick: function () { pick(o.k) }, title: o.name + ':' + o.desc,
|
|
@@ -491,13 +824,13 @@
|
|
|
491
824
|
var ps = state.poolStatus
|
|
492
825
|
if (!ps) return null
|
|
493
826
|
var wActive = (ps.workers || []).filter(function (w) { return w.busy }).length
|
|
494
|
-
var wTotal =
|
|
827
|
+
var wTotal = state.maxWorkers // 分母=并发上限而非当前池实例数,空闲也显示 0/上限
|
|
495
828
|
var vActive = (ps.verifiers || []).filter(function (v) { return v.busy }).length
|
|
496
|
-
var vTotal =
|
|
829
|
+
var vTotal = state.maxVerifiers
|
|
497
830
|
return React.createElement('span', { style: { fontSize: 9, color: C.text2, display: 'inline-flex', gap: 4, alignItems: 'center' } },
|
|
498
|
-
//
|
|
499
|
-
React.createElement('span', { title: 'Worker
|
|
500
|
-
React.createElement('span', { title: 'Verifier
|
|
831
|
+
// 池水位标注(反馈 n-mut9rzoq3flu / n-muyg4wl9208c):裸数字第一屏无解,补可见文字标签 + title
|
|
832
|
+
React.createElement('span', { title: '活跃 Worker 数/上限(⚡ = 在跑)', style: { display: 'inline-flex', alignItems: 'center', gap: 2 } }, ic('zap', 10), 'Worker ' + wActive + '/' + wTotal),
|
|
833
|
+
React.createElement('span', { title: '活跃 Verifier 数/上限(✓ = 在跑)', style: { display: 'inline-flex', alignItems: 'center', gap: 2 } }, ic('check', 10), 'Verifier ' + vActive + '/' + vTotal))
|
|
501
834
|
}
|
|
502
835
|
|
|
503
836
|
// #11 头部减负:池配置收纳进 ⚙️ 弹出层(含 #17 verifier 异构模型设置)
|
|
@@ -507,7 +840,7 @@
|
|
|
507
840
|
var _b = useState(false), dirty = _b[0], setDirty = _b[1]
|
|
508
841
|
var _m = useState(null), models = _m[0], setModels = _m[1]
|
|
509
842
|
var cfgKey = props.cfgKey || 'verifierModel'
|
|
510
|
-
var label = props.label || '
|
|
843
|
+
var label = props.label || 'Verifier 模型'
|
|
511
844
|
// 下拉列出当前网关可用模型(host list-models RPC);枚举失败降级为文本输入
|
|
512
845
|
useEffect(function () {
|
|
513
846
|
var cancelled = false
|
|
@@ -560,13 +893,13 @@
|
|
|
560
893
|
open && pos ? React.createElement('div', { style: { position: 'fixed', top: pos.top + 'px', right: pos.right + 'px', padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 8, boxShadow: '0 4px 16px rgba(0,0,0,0.15)', zIndex: 1000, whiteSpace: 'nowrap', maxHeight: 'calc(100vh - ' + (pos.top + 12) + 'px)', overflowY: 'auto' } },
|
|
561
894
|
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 5 } }, '并发上限(一次性派发,用完即销毁)'),
|
|
562
895
|
React.createElement('div', { style: { display: 'flex', gap: 8, alignItems: 'center', marginBottom: 5 } },
|
|
563
|
-
React.createElement(PoolCfg, { label: '
|
|
564
|
-
React.createElement(PoolCfg, { label: '
|
|
896
|
+
React.createElement(PoolCfg, { label: 'Worker 并发', cfgKey: 'maxWorkers', value: props.maxW }),
|
|
897
|
+
React.createElement(PoolCfg, { label: 'Verifier 并发', cfgKey: 'maxVerifiers', value: props.maxV })),
|
|
565
898
|
React.createElement('div', { style: { display: 'flex', gap: 8, alignItems: 'center', marginBottom: 5 } },
|
|
566
|
-
React.createElement(ModelCfg, { label: '
|
|
899
|
+
React.createElement(ModelCfg, { label: 'Worker 模型', cfgKey: 'workerModel', value: props.workerModel }),
|
|
567
900
|
React.createElement('span', { style: { fontSize: 9, color: C.text2 } }, '(Worker 执行模型)')),
|
|
568
901
|
React.createElement('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
569
|
-
React.createElement(ModelCfg, { label: '
|
|
902
|
+
React.createElement(ModelCfg, { label: 'Verifier 模型', cfgKey: 'verifierModel', value: props.verifierModel }),
|
|
570
903
|
React.createElement('span', { style: { fontSize: 9, color: C.text2 } }, '(Verifier 异构审查)')),
|
|
571
904
|
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, margin: '7px 0 5px' } }, '两级超时(软超时只提醒主窗口,由你决定继续等待或终止)'),
|
|
572
905
|
React.createElement('div', { style: { display: 'flex', gap: 8, alignItems: 'center' } },
|
|
@@ -587,6 +920,13 @@
|
|
|
587
920
|
React.createElement('input', { type: 'checkbox', checked: props.notifyDone !== false, onChange: function (e) { setCfg('notifyDone', e.target.checked) } }),
|
|
588
921
|
React.createElement('span', null, '✅ 完成回执(任务完成或阻塞时聚合播报)')),
|
|
589
922
|
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3, whiteSpace: 'normal', maxWidth: 260 } }, '歧义裁决通知不受这两个开关影响(任务等人裁决必须提醒)'),
|
|
923
|
+
// 自测指南开关(verifyUserGuide,缺省 true,「通知」小节旁的「验收」小节):关掉后
|
|
924
|
+
// ① Verifier prompt 不再要求「## 自测指南」段(省 token);② 验收落账不挂 userTest;
|
|
925
|
+
// ③ 详情页自测指南块与报告「本版自测清单」段整块不渲染。老看板缺字段=开。
|
|
926
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, margin: '7px 0 5px' } }, '验收'),
|
|
927
|
+
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 5, fontSize: 10, color: C.text, cursor: 'pointer', whiteSpace: 'normal', maxWidth: 260 } },
|
|
928
|
+
React.createElement('input', { type: 'checkbox', checked: props.verifyUserGuide !== false, onChange: function (e) { setCfg('verifyUserGuide', e.target.checked) } }),
|
|
929
|
+
React.createElement('span', null, '📋 自测指南(验收结论附用户自测步骤,详情页与报告展示)')),
|
|
590
930
|
// 史诗拆分总开关(板级 epicSplit,缺省 true):**只关引导,不禁机制**——关掉后 Team 提示词不再
|
|
591
931
|
// 注入「大任务必须拆分」第 6 条、create-task 响应不再附 suggestSplit 软提示;显式传 parentId 建
|
|
592
932
|
// 子卡、史诗自动收口/hooks 状态机照常(用户/主窗口明确要拆时不受阻)。勾选态缺字段=开,与 host 同口径。
|
|
@@ -610,7 +950,7 @@
|
|
|
610
950
|
React.createElement('span', { style: { marginLeft: 'auto', fontSize: 9, padding: '1px 6px', borderRadius: 3, background: C.brand, color: C_INV } }, '忙碌')),
|
|
611
951
|
m.model ? React.createElement('div', { style: { fontSize: 9, color: C.warn, marginBottom: 3 }, title: '异构模型审查' }, '🧬 ' + m.model) : null,
|
|
612
952
|
curTask ? React.createElement('div', { onClick: function () { state.detailId = curTask.id; state.view = 'board'; notify() }, style: { fontSize: 10, color: C.brand, cursor: 'pointer', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: curTask.title }, '→ ' + curTask.title) : React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '→ ' + m.taskId),
|
|
613
|
-
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3 }, title: '
|
|
953
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3 }, title: '一次性子代理会话:' + (m.runId || '') }, '会话 ' + String(m.runId || '').slice(0, 8) + '…(用完即销毁)'))
|
|
614
954
|
}
|
|
615
955
|
var ws = ps.workers || [], vs = ps.verifiers || []
|
|
616
956
|
var _R2 = React; var _st = _R2.useState(''), editMsg = _st[0], setEditMsg = _st[1]
|