dsh-agent-board 1.7.0 → 1.7.2
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 +21 -10
- package/index.mjs +10 -3
- package/lib/client/board-list.js +47 -5
- package/lib/client/dashboard.js +151 -8
- package/lib/client/kernel.js +61 -15
- package/lib/client/task-detail.js +161 -9
- package/lib/client.js +420 -37
- package/lib/core.mjs +402 -21
- package/lib/dispatch.mjs +164 -12
- package/lib/health.mjs +43 -11
- package/lib/notify.mjs +42 -12
- package/lib/policy.mjs +17 -1
- package/lib/rpc.mjs +71 -13
- package/lib/session.mjs +24 -3
- package/lib/store.mjs +2 -1
- package/lib/usage.mjs +84 -3
- package/package.json +1 -1
- package/test/core.test.mjs +1906 -38
- package/test/health.test.mjs +86 -4
package/lib/client.js
CHANGED
|
@@ -232,7 +232,7 @@ function apply(ctx) {
|
|
|
232
232
|
|
|
233
233
|
var COLUMNS = ['draft', 'pending', 'in-progress', 'verifying', 'resolved', 'blocked']
|
|
234
234
|
var reqEpoch = 0 // 会话切换纪元:切会话时自增,旧会话在途响应按纪元丢弃
|
|
235
|
-
var state = { sessionId: null, tasks: [], boardMode: 'auto', teamMode: false, workMode: 'auto', minWorkers: 1, maxWorkers: 3, minVerifiers: 0, maxVerifiers: 2, workerModel: '', verifierModel: '', softTimeoutMin: 30, hardTimeoutMin: 120, feedbackEnabled: true, lessonPushed: {}, isRoot: true, open: false, detailId: null, children: [], dragOver: null, dragTask: null, dispatchInfo: '', view: 'board', layoutLeft: 280, layoutRight: 0, poolStatus: null, escalatedIds: [], filterQ: '', filterPrio: [], filterTag: '', selectMode: false, selected: {}, undoSnapshot: null, cardHover: '', archSort: 'time-desc', dateRange: { from: '', to: '' }, rfOpen: false, gboOpen: false, activity: {}, archived: [], archQ: '', globalBoards: [], createOpen: false, createFlash: '', usageSummary: null, childStats: {}, tasksErr: '' }
|
|
235
|
+
var state = { sessionId: null, tasks: [], boardMode: 'auto', teamMode: false, workMode: 'auto', minWorkers: 1, maxWorkers: 3, minVerifiers: 0, maxVerifiers: 2, workerModel: '', verifierModel: '', softTimeoutMin: 30, hardTimeoutMin: 120, feedbackEnabled: true, notifyDispatch: true, notifyDone: true, epicSplit: true, lessonPushed: {}, isRoot: true, isRootEverTrue: false, isRootFalseN: 0, isRootStable: true, open: false, detailId: null, children: [], dragOver: null, dragTask: null, dispatchInfo: '', view: 'board', layoutLeft: 280, layoutRight: 0, poolStatus: null, escalatedIds: [], filterQ: '', filterPrio: [], filterTag: '', selectMode: false, selected: {}, undoSnapshot: null, cardHover: '', archSort: 'time-desc', dateRange: { from: '', to: '' }, rfOpen: false, gboOpen: false, activity: {}, archived: [], archQ: '', globalBoards: [], createOpen: false, createFlash: '', usageSummary: null, childStats: {}, tasksErr: '', tasksHash: '' }
|
|
236
236
|
|
|
237
237
|
// #16 快捷键:Esc 逐级关闭(详情→看板→面板);输入框聚焦时不劫持
|
|
238
238
|
try {
|
|
@@ -271,6 +271,32 @@ function apply(ctx) {
|
|
|
271
271
|
function clearReadErr() { state.tasksErr = '' } // 仅 fetchTasks 成功路径调用(3s 轮询兜底,任何错误条都能随之消失)
|
|
272
272
|
function readErrText(e) { return String((e && e.message) || e || '网络异常') }
|
|
273
273
|
|
|
274
|
+
// ===== isRoot 蝶变防抖(反馈 n-muuerxv9ijxs / task-muupr8ld)=====
|
|
275
|
+
// 为什么防抖:host rpc.mjs L97 的 isRoot 是每次 get-tasks 现算的
|
|
276
|
+
// (agents.roots() 是否含本会话 id)。生成开始/结束瞬间 agents 树重建,roots() 存在一个
|
|
277
|
+
// 瞬态窗口返回不含本 sid → 单次 isRoot=false 就触发 L303 强收抽屉(state.open=false),
|
|
278
|
+
// 用户表现为「看板在生成状态切换时突然消失,每次都要重新打开」;按钮/面板同病闪烁。
|
|
279
|
+
// 防抖口径:已确认过 true 的会话(everTrue)需连续 IS_ROOT_FALSE_LIMIT 次 false
|
|
280
|
+
// (host 3s 心跳 ≈ 9s)才把 isRootStable 翻成 false——覆盖瞬态窗口,真正降级仍会收敛。
|
|
281
|
+
// 为什么子代理会话不防抖:everTrue=false 的会话(新打开的子代理)立即 isRootStable=false,
|
|
282
|
+
// 保护语义不削弱——子代理会话本就不该出现看板入口/抽屉,即时收起没有代价。
|
|
283
|
+
// 消费口径:强收(本函数)/按钮(BoardButton)/面板(TopPanel)/活动心跳省流(fetchActivity)
|
|
284
|
+
// 四处一律读 isRootStable,不读单次轮询的 state.isRoot 原始值。
|
|
285
|
+
var IS_ROOT_FALSE_LIMIT = 3
|
|
286
|
+
function applyIsRoot(rawIsRoot) {
|
|
287
|
+
state.isRoot = rawIsRoot
|
|
288
|
+
if (rawIsRoot) {
|
|
289
|
+
state.isRootEverTrue = true // 曾确认 true:此后 false 需连续累计(会话生命周期内粘滞,切换会话时重置)
|
|
290
|
+
state.isRootFalseN = 0
|
|
291
|
+
state.isRootStable = true
|
|
292
|
+
} else if (!state.isRootEverTrue) {
|
|
293
|
+
state.isRootStable = false // 从未 true(新打开的子代理会话):即时收起,不防抖
|
|
294
|
+
} else {
|
|
295
|
+
state.isRootFalseN++
|
|
296
|
+
if (state.isRootFalseN >= IS_ROOT_FALSE_LIMIT) state.isRootStable = false // 连续 3 次 false:真降级(子代理树已重建不含本 sid),收敛
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
274
300
|
function fetchTasks() {
|
|
275
301
|
if (!state.sessionId) return
|
|
276
302
|
var epoch = reqEpoch
|
|
@@ -278,7 +304,17 @@ function apply(ctx) {
|
|
|
278
304
|
if (epoch !== reqEpoch) return // 会话已切换,丢弃过期响应
|
|
279
305
|
if (d && d.error) { reportReadErr('看板数据刷新失败:' + d.error); return } // error 分支:保留旧 tasks/设置,绝不当空板渲染
|
|
280
306
|
clearReadErr()
|
|
281
|
-
|
|
307
|
+
// 渲染节约(反馈 n-mut9rzs2mkhg):host 附 tasksHash(任务关键字段的稳定 hash,口径见 host core.tasksHash)。
|
|
308
|
+
// hash 相同 → 任务列表实质没变:跳过 state.tasks 赋值与 notify(3s 轮询大头是空转重渲染)。
|
|
309
|
+
// 注意区分:tasksErr 清除、boardMode/usageSummary/healthHints/childStats 等轻量字段照常赋值
|
|
310
|
+
// (hash 只管任务列表渲染;这些字段随下次任意 notify 生效,不为它们单独渲染)。
|
|
311
|
+
// 老 host 不返回 tasksHash → 恒视为变化,行为与旧版完全一致。
|
|
312
|
+
var newHash = (d && d.tasksHash) || ''
|
|
313
|
+
var tasksChanged = !newHash || newHash !== state.tasksHash
|
|
314
|
+
if (tasksChanged) {
|
|
315
|
+
state.tasksHash = newHash
|
|
316
|
+
state.tasks = (d && d.tasks) || []
|
|
317
|
+
}
|
|
282
318
|
state.boardMode = (d && d.boardMode) || 'auto'
|
|
283
319
|
state.teamMode = !!(d && d.teamMode)
|
|
284
320
|
// 工作模式(三档)读取:优先用服务端派生字段 workMode,缺失时按同口径本地兜底派生
|
|
@@ -302,14 +338,22 @@ function apply(ctx) {
|
|
|
302
338
|
state.childStats = (d && d.childStats) || {}
|
|
303
339
|
// 学习飞轮 v1 能力检测:老 host 不返回该字段 → 视为开启(默认开);只有显式 false 才关。
|
|
304
340
|
state.feedbackEnabled = !(d && d.feedbackEnabled === false)
|
|
305
|
-
|
|
306
|
-
|
|
341
|
+
// 回执开关(设置区「通知」):同口径——老 host 不返回 → 视为开,只有显式 false 才关
|
|
342
|
+
state.notifyDispatch = !(d && d.notifyDispatch === false)
|
|
343
|
+
state.notifyDone = !(d && d.notifyDone === false)
|
|
344
|
+
// 史诗拆分总开关(设置区「功能」):同上——老 host 不返回 = 开(引导照旧),只有显式 false 才关
|
|
345
|
+
state.epicSplit = !(d && d.epicSplit === false)
|
|
346
|
+
applyIsRoot(!d || d.isRoot !== false) // 原始值只喂给防抖器,消费点一律读 isRootStable
|
|
347
|
+
if (!state.isRootStable && state.open) { state.open = false; state.detailId = null } // 子代理会话(含连续 3 次 false 的真降级):强制收起看板
|
|
307
348
|
if (d && d.dispatchInfo && d.dispatchInfoAt && Date.now() - new Date(d.dispatchInfoAt).getTime() < 120000) { state.dispatchInfo = d.dispatchInfo } else { state.dispatchInfo = '' } // 瞬时通知 2min 内有效,过期强制清空(服务端写后不清曾致残留数天)
|
|
308
349
|
// escalation 一等公民:出现新的待裁决任务 → 面板自动弹开直达该任务详情
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
350
|
+
// (escalation.question 在 tasksHash 序列化口径内:新歧义必然改变 hash → 必然走变化分支,不会漏弹)
|
|
351
|
+
if (tasksChanged) {
|
|
352
|
+
var newEsc = state.tasks.filter(function (t) { return t.escalation && state.escalatedIds.indexOf(t.id) < 0 })
|
|
353
|
+
state.escalatedIds = state.tasks.filter(function (t) { return t.escalation }).map(function (t) { return t.id })
|
|
354
|
+
if (newEsc.length > 0) { state.open = true; state.view = 'board'; state.detailId = newEsc[0].id }
|
|
355
|
+
notify()
|
|
356
|
+
}
|
|
313
357
|
}).catch(function (e) { if (epoch !== reqEpoch) return; reportReadErr('看板数据刷新失败:' + readErrText(e)) }) // 网络 reject 同口径
|
|
314
358
|
}
|
|
315
359
|
|
|
@@ -318,7 +362,7 @@ function apply(ctx) {
|
|
|
318
362
|
|
|
319
363
|
// 活动心跳:对进行中/验收中的任务轮询子代理最近动作(卡片与详情展示"现在跑到哪了")
|
|
320
364
|
function fetchActivity() {
|
|
321
|
-
if (!state.sessionId || !state.
|
|
365
|
+
if (!state.sessionId || !state.isRootStable || !state.open) return // 面板关闭时不轮询活动(省同步 I/O);isRootStable 口径见 isRoot 蝶变防抖
|
|
322
366
|
var running = state.tasks.filter(function (t) { return t.status === 'in-progress' || t.status === 'verifying' })
|
|
323
367
|
if (!running.length) { if (Object.keys(state.activity).length) { state.activity = {}; notify() } return }
|
|
324
368
|
var pending = running.length
|
|
@@ -469,9 +513,9 @@ function apply(ctx) {
|
|
|
469
513
|
function BoardButton(props) {
|
|
470
514
|
var _R = React; var useState = _R.useState, useEffect = _R.useEffect
|
|
471
515
|
var _a = useState(0), pendingCount = _a[0], setPendingCount = _a[1]; var _b = useState(false), isOpen = _b[0], setIsOpen = _b[1]; var _c = useState(0), escCount = _c[0], setEscCount = _c[1]; var _d2 = useState(true), isRoot = _d2[0], setIsRoot = _d2[1]
|
|
472
|
-
useEffect(function () { if (props && props.sessionId) { var sid = String(props.sessionId); if (state.sessionId !== sid) { state.sessionId = sid; reqEpoch++; state.tasks = []; state.children = []; state.activity = {}; state.archived = []; state.detailId = null; state.childStats = {}; state.tasksErr = ''; notify(); fetchTasks(); fetchChildren() } } }, [props && props.sessionId])
|
|
473
|
-
useEffect(function () { function update() { var n = 0, e = 0; for (var i = 0; i < state.tasks.length; i++) { if (state.tasks[i].status === 'pending') n++; if (state.tasks[i].escalation) e++ }; setPendingCount(n); setEscCount(e); setIsOpen(state.open); setIsRoot(state.
|
|
474
|
-
if (!isRoot) return null //
|
|
516
|
+
useEffect(function () { if (props && props.sessionId) { var sid = String(props.sessionId); if (state.sessionId !== sid) { state.sessionId = sid; reqEpoch++; state.tasks = []; state.tasksHash = ''; state.children = []; state.activity = {}; state.archived = []; state.detailId = null; state.childStats = {}; state.tasksErr = ''; state.isRootEverTrue = false; state.isRootFalseN = 0; state.isRootStable = false; notify(); fetchTasks(); fetchChildren() } } }, [props && props.sessionId]) // 会话切换重置 isRoot 防抖态(everTrue/计数/stable 都按会话生命周期——旧会话的"曾确认 true"不得漂到新会话);reset 后首轮 get-tasks 判定前按"未确认 root"保守隐藏,避免切进子代理会话时入口闪现
|
|
517
|
+
useEffect(function () { function update() { var n = 0, e = 0; for (var i = 0; i < state.tasks.length; i++) { if (state.tasks[i].status === 'pending') n++; if (state.tasks[i].escalation) e++ }; setPendingCount(n); setEscCount(e); setIsOpen(state.open); setIsRoot(state.isRootStable) }; listeners.push(update); update(); return function () { var i = listeners.indexOf(update); if (i >= 0) listeners.splice(i, 1) } }, [])
|
|
518
|
+
if (!isRoot) return null // 子代理会话不显示看板入口(读 isRootStable:瞬态 false 不收,见 isRoot 蝶变防抖)
|
|
475
519
|
return React.createElement('button', { onClick: function () { state.open = !state.open; notify() }, title: '智能看板' + (pendingCount > 0 ? '(' + pendingCount + ' 待办)' : '') + (escCount > 0 ? '(' + escCount + ' 待裁决)' : ''), style: { display: 'inline-flex', alignItems: 'center', gap: 4, padding: '3px 10px', border: '1px solid ' + (escCount > 0 ? C.err : C.border), borderRadius: 6, background: isOpen ? C.nested : 'transparent', color: C.text, cursor: 'pointer', fontSize: 12 } }, React.createElement('span', { style: { display: 'inline-flex', alignItems: 'center' } }, ic('clipboard-list', 14)), React.createElement('span', null, '智能看板'), escCount > 0 ? React.createElement('span', { style: { minWidth: 16, height: 16, padding: '0 4px', borderRadius: 8, background: C.err, color: C_INV, fontSize: 10, fontWeight: 700, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 1, animation: 'tskb-pulse 1s ease-in-out infinite' }, title: escCount + ' 个任务待裁决' }, ic('alert-triangle', 10), escCount) : null, pendingCount > 0 ? React.createElement('span', { style: { minWidth: 16, height: 16, padding: '0 4px', borderRadius: 8, background: C.brand, color: C_INV, fontSize: 10, fontWeight: 600, display: 'inline-flex', alignItems: 'center', justifyContent: 'center' } }, String(pendingCount)) : null)
|
|
476
520
|
}
|
|
477
521
|
|
|
@@ -487,9 +531,11 @@ function apply(ctx) {
|
|
|
487
531
|
var _te = useState(state.tasksErr), tasksErr = _te[0], setTasksErr = _te[1] // 读路径错误条(无错不渲染)
|
|
488
532
|
var _sto = useState(state.softTimeoutMin), softT = _sto[0], setSoftT = _sto[1]; var _hto = useState(state.hardTimeoutMin), hardT = _hto[0], setHardT = _hto[1]
|
|
489
533
|
var _fbo = useState(state.feedbackEnabled), fbEnabled = _fbo[0], setFbEnabled = _fbo[1]
|
|
490
|
-
|
|
534
|
+
var _ndo = useState(state.notifyDispatch), ndOn = _ndo[0], setNdOn = _ndo[1]; var _nno = useState(state.notifyDone), nnOn = _nno[0], setNnOn = _nno[1]
|
|
535
|
+
var _eso = useState(state.epicSplit), esOn = _eso[0], setEsOn = _eso[1] // 史诗拆分总开关勾选态(设置区「功能」)
|
|
536
|
+
useEffect(function () { function update() { setOpen(state.open); setTasksState(state.tasks); setModeState(state.boardMode); setDetailId(state.detailId); setDragOver(state.dragOver); setDispatchInfo(state.dispatchInfo); setViewState(state.view); setLayL(state.layoutLeft); setLayR(state.layoutRight); setMinW(state.minWorkers); setMaxW(state.maxWorkers); setMinV(state.minVerifiers); setMaxV(state.maxVerifiers); setWorkerModel(state.workerModel); setVerifierModel(state.verifierModel); setTeamMode(state.teamMode); setWorkModeState(state.workMode); setDR(state.dateRange); setSoftT(state.softTimeoutMin); setHardT(state.hardTimeoutMin); setFbEnabled(state.feedbackEnabled); setNdOn(state.notifyDispatch); setNnOn(state.notifyDone); setEsOn(state.epicSplit); setCreateOpen(state.createOpen); setCreateFlash(state.createFlash); setTasksErr(state.tasksErr) }; listeners.push(update); update(); return function () { var i = listeners.indexOf(update); if (i >= 0) listeners.splice(i, 1) } }, [])
|
|
491
537
|
if (!open) return null
|
|
492
|
-
if (state.
|
|
538
|
+
if (!state.isRootStable) return null // 子代理会话不渲染看板面板(读 isRootStable:瞬态 false 不闪,见 isRoot 蝶变防抖)
|
|
493
539
|
var active = tasks.filter(function (t) { return t.status !== 'archived' }); var archived = tasks.filter(function (t) { return t.status === 'archived' })
|
|
494
540
|
var hasFilter = state.filterQ.trim() || state.filterPrio.length > 0 || state.filterTag
|
|
495
541
|
if (hasFilter) { active = active.filter(passFilter); archived = archived.filter(passFilter) }
|
|
@@ -513,7 +559,7 @@ function apply(ctx) {
|
|
|
513
559
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', padding: '6px 12px', borderBottom: '1px solid ' + C.border, flexShrink: 0, flexWrap: 'wrap', gap: 4 } },
|
|
514
560
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } }, React.createElement('span', { style: { fontWeight: 600, fontSize: 13, color: C.text, display: 'inline-flex', alignItems: 'center', gap: 5 } }, ic('clipboard-list', 15), '智能看板'), React.createElement(ViewTab, null), React.createElement(PoolStatus, null)),
|
|
515
561
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 4, flexWrap: 'wrap' } },
|
|
516
|
-
React.createElement(PoolCfgPopover, { minW: minW, maxW: maxW, minV: minV, maxV: maxV, workerModel: workerModel, verifierModel: verifierModel, softT: softT, hardT: hardT, feedbackEnabled: fbEnabled }),
|
|
562
|
+
React.createElement(PoolCfgPopover, { minW: minW, maxW: maxW, minV: minV, maxV: maxV, workerModel: workerModel, verifierModel: verifierModel, softT: softT, hardT: hardT, feedbackEnabled: fbEnabled, notifyDispatch: ndOn, notifyDone: nnOn, epicSplit: esOn }),
|
|
517
563
|
dispatchInfo ? React.createElement('span', { style: { fontSize: 9, color: C.brand, maxWidth: 120, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: dispatchInfo }, dispatchInfo) : null,
|
|
518
564
|
React.createElement('button', { onClick: function () { state.createOpen = true; notify() }, title: '新建任务(可存为草稿)', style: { fontSize: 11, padding: '3px 8px', border: '1px solid ' + C.border, borderRadius: 6, cursor: 'pointer', background: 'transparent', color: C.text2, display: 'inline-flex', alignItems: 'center', gap: 3 } }, ic('plus', 11), '新建任务'),
|
|
519
565
|
createFlash ? React.createElement('span', { style: { fontSize: 10, color: C.ok } }, createFlash) : null,
|
|
@@ -599,6 +645,11 @@ function apply(ctx) {
|
|
|
599
645
|
function isCardHover(id, kind) { return String(state.cardHover || '') === (id + '|' + kind) }
|
|
600
646
|
function setHover(id, kind) { var v = id ? (id + '|' + kind) : ''; if (state.cardHover !== v) { state.cardHover = v; notify() } }
|
|
601
647
|
|
|
648
|
+
// 卡片键盘焦点态(无障碍,反馈 n-mut9rzpyc7p1):内联样式表达不了 :focus 伪类,
|
|
649
|
+
// 用 focus/blur 事件 + state 现算主题色 outline——样式由 state 推导,轮询重渲染也不会丢焦点框。
|
|
650
|
+
function isCardFocus(id) { return String(state.cardFocus || '') === id }
|
|
651
|
+
function setCardFocus(id) { var v = id || ''; if (state.cardFocus !== v) { state.cardFocus = v; notify() } }
|
|
652
|
+
|
|
602
653
|
// ===== 卡片「当前动作」行摘要化(client 侧提炼;host 仍下发原文,不改 host)=====
|
|
603
654
|
// host 的 activity 形如 `🔧 pwsh {"command": "Get-ChildItem …"}`(90 字符硬截,常断在 JSON 中段,
|
|
604
655
|
// 原样展示零信息量,反馈 n-mut914xana0t)或 `💬 自由文本`。这里提炼为「工具名 + 关键参数摘要」:
|
|
@@ -630,7 +681,9 @@ function apply(ctx) {
|
|
|
630
681
|
}
|
|
631
682
|
|
|
632
683
|
// 史诗/依赖/父子识别层(childStats 缺省兼容:host 未返回该字段时一律不渲染相关元素):
|
|
633
|
-
// 父卡 = 元信息行首位「📦 史诗 ·
|
|
684
|
+
// 父卡 = 元信息行首位「📦 史诗 · settled/total」徽章 + 3px 迷你进度条 + activeTitle 非空时「▸ 在跑」行;
|
|
685
|
+
// settled = resolved | cancelled | archived(含已归档子任务、total 也含),口径同宿主 aggregateChildStats;
|
|
686
|
+
// 老宿主只下发 resolved 时回退读它(缺省兼容)——所以归档子卡不再让徽章从 0/10 退化成 0/9;
|
|
634
687
|
// 子卡 = 标题下一行小字「↳ 父任务标题」(从 state.tasks 找父卡,找不到回退 shortId);
|
|
635
688
|
// 依赖未满足的待办卡 = 卡片底部灰字「⛓ 等待「第一个未满足依赖标题」」(多个时附「 等 N 个」)。
|
|
636
689
|
// ===== 调研门禁·UI:「⚠️ 无调研」徽章判定(纯 client 侧现算,host 不下发该字段)=====
|
|
@@ -646,8 +699,43 @@ function apply(ctx) {
|
|
|
646
699
|
var notes = typeof cx.notes === 'string' ? cx.notes.trim() : ''
|
|
647
700
|
return files.length === 0 && notes.length === 0
|
|
648
701
|
}
|
|
649
|
-
|
|
650
|
-
|
|
702
|
+
// ===== epic hook 相位徽章(hooks=agent run 的卡片侧可见性,task-muuw56yf)=====
|
|
703
|
+
// 与 host core.normalizeHooks 契约同源:epic.hooks = { pre: { enabled, prompt, state, runId, pending? }, post: 同构 },
|
|
704
|
+
// state ∈ idle | running | done | failed(host 状态机推进,UI 只读展示,不在这里改状态)。
|
|
705
|
+
// 缺省兼容硬约束:卡上无 hooks / 该点位未启用 → 返回 null,老卡渲染逐字不变(零额外 DOM)。
|
|
706
|
+
// 优先级与文案(同一时刻只可能有一个相位有话说):
|
|
707
|
+
// pre|post failed → 「⚠️ hook 失败待裁决」(err 色):史诗已被 host 转 blocked 挂歧义,过程态文案都让位;
|
|
708
|
+
// pre running → 「⏳ 前置准备中」:串行闸门期内,该 epic 的子任务一张都不派;
|
|
709
|
+
// post running → 「🧪 收尾中」:子任务已全部了结、epic 仍 in-progress,等收口 run 归还;
|
|
710
|
+
// idle / done → 不渲染(普通进行中维持「📦 史诗 · x/y」原样,稳定态不加噪音)。
|
|
711
|
+
function hookBadgeOf(t) {
|
|
712
|
+
var h = t && t.hooks
|
|
713
|
+
if (!h) return null
|
|
714
|
+
var pre = (h.pre && h.pre.enabled) ? h.pre : null
|
|
715
|
+
var post = (h.post && h.post.enabled) ? h.post : null
|
|
716
|
+
if ((pre && pre.state === 'failed') || (post && post.state === 'failed')) {
|
|
717
|
+
var ph = (pre && pre.state === 'failed') ? 'pre' : 'post'
|
|
718
|
+
return { txt: '⚠️ hook 失败待裁决', color: C.err, tip: 'hooks.' + ph + '(' + (ph === 'pre' ? '前置准备' : '收口') + ')运行失败:史诗已转阻塞等人裁决(重试/跳过/放弃),详情页可跳裁决区' }
|
|
719
|
+
}
|
|
720
|
+
if (pre && pre.state === 'running') return { txt: '⏳ 前置准备中', color: C.brand, tip: '前置 hook run 正在跑:完成前该史诗的子任务一张都不派(串行闸门)' }
|
|
721
|
+
if (post && post.state === 'running') return { txt: '🧪 收尾中', color: C.brand, tip: '收口 hook run 正在跑:子任务已全部了结,史诗仍 in-progress,收口完成后才转验证中' }
|
|
722
|
+
return null
|
|
723
|
+
}
|
|
724
|
+
function hookPhaseBadge(t) {
|
|
725
|
+
var b = hookBadgeOf(t)
|
|
726
|
+
if (!b) return null
|
|
727
|
+
return React.createElement('span', { title: b.tip, style: { fontSize: 9, padding: '0 4px', borderRadius: 2, background: 'color-mix(in srgb, ' + b.color + ' 14%, transparent)', color: b.color, fontWeight: 600, whiteSpace: 'nowrap' } }, b.txt)
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function Card(props) { var t = props.task; var pc = prioColor[t.priority] || prioColor.low; var dragging = state.dragTask === t.id; var preview = (t.deliverable && t.deliverable.summary) || t.resolution; var critGlow = t.priority === 'critical' && !t.escalation; var sel = !!state.selected[t.id]; var pm = pipeOf(t); var depBlock = t.status === 'pending' && depsBlocked(t); var delOk = !state.selectMode && canDelete(t); var cs = (state.childStats && state.childStats[t.id]) || null; var csDone = cs ? (typeof cs.settled === 'number' ? cs.settled : cs.resolved) : 0; var epic = !!(cs && cs.total > 0); var parentT = t.parentId ? getTask(t.parentId) : null; var depWaitTitle = ''; var depWaitN = 0; if (depBlock) { t.dependsOn.forEach(function (id) { var d = getTask(id); if (!d || (d.status !== 'resolved' && d.status !== 'archived')) { depWaitN++; if (!depWaitTitle) depWaitTitle = d && d.title ? d.title : id } }) } var durB = cardDur(t);
|
|
731
|
+
// 无障碍(反馈 n-mut9rzpyc7p1):卡片根以 button 角色进 Tab 序(aria-label=标题+状态),
|
|
732
|
+
// Enter/Space 触发与点击相同的激活行为(多选=切换选中,否则开详情);
|
|
733
|
+
// focus 态用主题色 C.brand 2px outline(不用浏览器默认蓝框,保持主题一致)
|
|
734
|
+
function activate() { if (state.selectMode) { if (state.selected[t.id]) delete state.selected[t.id]; else state.selected[t.id] = true; notify() } else { state.detailId = t.id; notify() } }
|
|
735
|
+
return React.createElement('div', { role: 'button', tabIndex: 0, 'aria-label': t.title + '(' + (statusLabels[t.status] || t.status) + ')', draggable: !state.selectMode, onDragStart: function (e) { onDragStart(e, t) }, onDragEnd: onDragEnd, onMouseEnter: function () { if (delOk) setHover(t.id, 'del') }, onMouseLeave: function () { if (delOk) setHover('', '') }, onFocus: function () { setCardFocus(t.id) }, onBlur: function () { setCardFocus('') }, onKeyDown: function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); activate() } }, onClick: activate, style: { outline: isCardFocus(t.id) ? '2px solid ' + C.brand : 'none', outlineOffset: 2, border: '1px solid ' + (sel ? C.brand : (t.escalation ? C.err : (critGlow ? C.err : C.border))), borderRadius: 6, padding: '6px 8px', marginBottom: 6, background: sel ? C.nested : C.card, borderLeft: '3px solid ' + (t.escalation ? C.err : pc), cursor: state.selectMode ? 'pointer' : 'grab', fontSize: 12, opacity: dragging ? 0.4 : (depBlock ? 0.65 : 1), transition: 'opacity .15s', animation: critGlow ? 'tskb-crit 2s ease-in-out infinite' : 'none' } }, React.createElement('div', { style: { display: 'flex', alignItems: 'flex-start', gap: 4 } }, state.selectMode ? React.createElement('span', { style: { color: sel ? C.brand : C.text2, flexShrink: 0, marginTop: 1, display: 'inline-flex' } }, ic(sel ? 'square-check-big' : 'square', 12)) : null, React.createElement('div', { style: { fontWeight: 600, color: C.text, marginBottom: 2, wordBreak: 'break-word', flex: 1 } }, t.title), React.createElement('span', { style: { flexShrink: 0, marginTop: 1, display: 'inline-flex', color: C.text2 }, title: pm.label }, ic(pm.icon, 10)), React.createElement('span', { style: { fontSize: 9, padding: '1px 5px', borderRadius: 3, background: 'color-mix(in srgb, ' + pc + ' 20%, transparent)', color: pc, flexShrink: 0, marginTop: 1 } }, prioLabel[t.priority] || '中'), noResearch(t) ? React.createElement('span', { title: '本任务未附调研上下文,Worker 需自行定位——建议补 contextFiles/contextNotes', style: { fontSize: 9, padding: '1px 5px', borderRadius: 3, background: 'color-mix(in srgb, ' + C.warn + ' 18%, transparent)', color: C.warn, fontWeight: 600, flexShrink: 0, marginTop: 1, whiteSpace: 'nowrap' } }, '⚠️ 无调研') : null, (t.usage && t.usage.total) ?React.createElement('span', { style: { fontSize: 9, color: C.text2, flexShrink: 0, marginTop: 1 }, title: '本任务累计 token:' + String(t.usage.total) + '(' + (t.usage.runs || 0) + ' 次 run)' }, '⛁ ' + fmtTokens(t.usage.total)) : null), t.parentId ? React.createElement('div', { style: { fontSize: 10, color: C.text2, marginBottom: 2, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: parentT ? '父任务:' + parentT.title + ' (' + t.parentId + ')' : t.parentId }, '↳ ' + (parentT && parentT.title ? parentT.title : shortId(t.parentId))) : null, t.escalation ? React.createElement('div', { style: { fontSize: 10, color: C.err, fontWeight: 600, marginBottom: 2, display: 'flex', alignItems: 'center', gap: 3 } }, ic('alert-triangle', 10), '待裁决 — 点击查看疑问') : null, t.stuckSince ? React.createElement('div', { style: { fontSize: 10, color: C.warn, fontWeight: 600, marginBottom: 2, animation: 'tskb-pulse 1.5s ease-in-out infinite' } }, '⏱ 疑似卡死 · ' + ago(t.stuckSince) + ' — 点击处理') : null, React.createElement('div', { style: { fontSize: 10, color: C.text2, display: 'flex', alignItems: 'center', gap: 5, flexWrap: 'wrap' } },
|
|
736
|
+
epic ? React.createElement('span', { title: '史诗父卡:' + csDone + '/' + cs.total + ' 个子任务已了结(完成/取消/归档)', style: { fontSize: 9, padding: '0 4px', borderRadius: 2, background: 'color-mix(in srgb, ' + C.brand + ' 14%, transparent)', color: C.brand, fontWeight: 600 } }, '📦 史诗 · ' + csDone + '/' + cs.total) : null,
|
|
737
|
+
// hook 相位徽章:与 📦 徽章**并存**(相位是 epic 的附加过程态,不是替代进度)
|
|
738
|
+
epic ? hookPhaseBadge(t) : null,
|
|
651
739
|
t.frozen ? React.createElement('span', { title: '已冻结:不参与自动派发(详情页可「解除冻结」)', style: { color: C.brand, fontWeight: 600 } }, '❄ 冻结') : null,
|
|
652
740
|
(Array.isArray(t.waitingForTouches) && t.waitingForTouches.length) ? React.createElement('span', { title: '等文件锁释放:' + t.waitingForTouches.join('、') + '(touches 冲突,详情页可 force 越权派发)', style: { color: C.warn, fontWeight: 600 } }, '🔒 等文件释放') : null,
|
|
653
741
|
React.createElement('span', { title: pm.label, style: { fontSize: 9, padding: '0 4px', borderRadius: 2, background: C.nested, border: '1px solid ' + C.border } }, pm.short),
|
|
@@ -662,8 +750,8 @@ function apply(ctx) {
|
|
|
662
750
|
title: '删除任务(不可恢复;执行中请先终止,已落定请用归档)',
|
|
663
751
|
style: { flexShrink: 0, marginTop: 1, display: 'inline-flex', cursor: 'pointer', color: C.err, opacity: isCardHover(t.id, 'del') ? 1 : 0, transition: 'opacity .15s' }
|
|
664
752
|
}, ic('trash-2', 11)) : null),
|
|
665
|
-
// 史诗迷你进度条(3px 高,
|
|
666
|
-
epic ? React.createElement('div', { style: { height: 3, borderRadius: 2, background: C.nested, marginTop: 4, overflow: 'hidden' }, title: '子任务进度 ' +
|
|
753
|
+
// 史诗迷你进度条(3px 高,settled/total 比例,ok 色填充)+ 在跑子任务行(activeTitle 非空才渲染)
|
|
754
|
+
epic ? React.createElement('div', { style: { height: 3, borderRadius: 2, background: C.nested, marginTop: 4, overflow: 'hidden' }, title: '子任务进度 ' + csDone + '/' + cs.total }, React.createElement('div', { style: { height: '100%', width: Math.max(0, Math.min(100, Math.round((csDone / cs.total) * 100))) + '%', background: C.ok, borderRadius: 2, transition: 'width .3s' } })) : null,
|
|
667
755
|
epic && cs.activeTitle ? React.createElement('div', { style: { fontSize: 10, color: C.brand, marginTop: 3, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: '在跑子任务:' + cs.activeTitle }, '▸ 在跑:' + cs.activeTitle) : null,
|
|
668
756
|
// 当前动作行:展示摘要(工具名+关键参数),悬停 title 仍是 host 原文
|
|
669
757
|
(t.status === 'in-progress' || t.status === 'verifying') && state.activity[t.id] ? React.createElement('div', { style: { fontSize: 10, color: C.brand, marginTop: 3, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, title: state.activity[t.id] }, '👁 ' + activitySummary(state.activity[t.id])) : null,
|
|
@@ -873,30 +961,155 @@ function apply(ctx) {
|
|
|
873
961
|
|
|
874
962
|
// 父子区块(与 DepsSection 并列):
|
|
875
963
|
// 子卡 = 父链面包屑「↳ 史诗:<父标题>」,点击回跳父卡详情;
|
|
876
|
-
// 父卡 =
|
|
964
|
+
// 父卡 = 子任务清单(状态色点 + 标题 + 状态标签,点击直达子卡详情;标题行汇总 settled/total)。
|
|
965
|
+
// 归档留档(反馈 task-muupgfot):清单**含已归档子任务**——归档后子任务不该从详情消失,
|
|
966
|
+
// 否则史诗拆分过程整段丢失、只剩一个分母缩水的数字。归档行灰化(降透明度 + 次要文字色)
|
|
967
|
+
// + 行尾「已归档」徽章,并沉底排在未归档之后(稳定排序:未归档保持 state.tasks 既有顺序);
|
|
968
|
+
// 仅降视觉权重不改交互——点击照旧进子卡详情看留档。
|
|
969
|
+
// 口径与卡片 📦 徽章同源:settled = resolved | cancelled | archived(宿主 aggregateChildStats 的
|
|
970
|
+
// settled/resolved 字段),total 含归档,所以详情与卡片永远显示同一个 N/M。
|
|
877
971
|
// 数据源是 state.tasks 按 parentId 现算(parentId 为老字段),不依赖 host 的 childStats,天然缺省兼容;
|
|
878
972
|
// 既无父也无子的普通卡整块不渲染。嵌套史诗(本身也是子卡的父卡)两段同区块上下排列。
|
|
879
973
|
function FamilySection(props) {
|
|
880
974
|
var task = props.task
|
|
881
975
|
var parentT = task.parentId ? getTask(task.parentId) : null
|
|
882
|
-
|
|
976
|
+
// 不按状态过滤(归档也要留在清单里);仅按「是否归档」稳定排序把归档沉底(V8 sort 稳定,未归档保序)
|
|
977
|
+
var kids = state.tasks.filter(function (x) { return x.parentId === task.id })
|
|
978
|
+
.sort(function (a, b) { return (a.status === 'archived' ? 1 : 0) - (b.status === 'archived' ? 1 : 0) })
|
|
883
979
|
if (!task.parentId && kids.length === 0) return null
|
|
884
|
-
var
|
|
980
|
+
var settledN = kids.filter(function (x) { return x.status === 'resolved' || x.status === 'cancelled' || x.status === 'archived' }).length
|
|
885
981
|
function jump(id) { state.detailId = id; notify() }
|
|
886
982
|
return React.createElement('div', { style: { marginBottom: 8, padding: '6px 8px', border: '1px solid ' + C.border, borderRadius: 6, background: C.card } },
|
|
887
983
|
task.parentId ? React.createElement('div', { style: { fontSize: 11, marginBottom: kids.length ? 6 : 0 } },
|
|
888
984
|
React.createElement('span', { style: { color: C.text2, fontWeight: 600 } }, '↳ 史诗:'),
|
|
889
985
|
React.createElement('span', { onClick: function () { if (parentT) jump(task.parentId) }, title: parentT ? parentT.title + ' (' + task.parentId + ')' : task.parentId, style: { color: parentT ? C.brand : C.text2, cursor: parentT ? 'pointer' : 'default', fontWeight: 600 } }, parentT && parentT.title ? parentT.title : shortId(task.parentId))) : null,
|
|
890
986
|
kids.length > 0 ? React.createElement('div', null,
|
|
891
|
-
React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '📦 子任务 · ' +
|
|
987
|
+
React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '📦 子任务 · ' + settledN + '/' + kids.length + ' 已了结'),
|
|
892
988
|
kids.map(function (x) {
|
|
893
|
-
|
|
989
|
+
var arch = x.status === 'archived'
|
|
990
|
+
return React.createElement('div', { key: x.id, onClick: function () { jump(x.id) }, title: (statusLabels[x.status] || x.status) + ' · ' + x.id + (arch ? ' · 已归档留档(点击查看)' : ''), style: { display: 'flex', alignItems: 'center', gap: 6, marginBottom: 3, fontSize: 10, cursor: 'pointer', opacity: arch ? 0.55 : 1 } },
|
|
894
991
|
React.createElement('span', { style: { width: 7, height: 7, borderRadius: '50%', background: statusColors[x.status] || C.text2, flexShrink: 0 } }),
|
|
895
|
-
React.createElement('span', { style: { color: C.brand, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, x.title || x.id),
|
|
896
|
-
|
|
992
|
+
React.createElement('span', { style: { color: arch ? C.text2 : C.brand, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', flex: 1 } }, x.title || x.id),
|
|
993
|
+
arch
|
|
994
|
+
? React.createElement('span', { style: { fontSize: 9, padding: '0 4px', borderRadius: 2, background: C.nested, color: C.text2, border: '1px solid ' + C.border, flexShrink: 0 } }, '已归档')
|
|
995
|
+
: React.createElement('span', { style: { fontSize: 9, color: C.text2, flexShrink: 0 } }, statusLabels[x.status] || x.status))
|
|
897
996
|
})) : null)
|
|
898
997
|
}
|
|
899
998
|
|
|
999
|
+
// ===== Hooks(可选点位)· 史诗前置/后置 agent run 的编辑与状态面板(task-muuw56yf)=====
|
|
1000
|
+
// 契约以 host core.normalizeHooks / mergeHooks 为准(勿凭记忆改字段名):
|
|
1001
|
+
// epic.hooks = { pre: { enabled, prompt, state, runId, pending? }, post: 同构 },state ∈ idle|running|done|failed;
|
|
1002
|
+
// hook run 记在 epic.runs[](role 'hook-pre'/'hook-post',字段 { role, id, at, endedAt, outcome, model })。
|
|
1003
|
+
// 写入通道 = update-task RPC 的 hooks 字段(浅合并:未提交的点位保留原值,传 null 撤点位)。
|
|
1004
|
+
// 三条 UI 口径:
|
|
1005
|
+
// ① 老卡零渲染:既无子任务、也未声明 hooks 的普通卡整块不出现(与卡片相位徽章同一门禁);
|
|
1006
|
+
// ② 权限不在 UI 判断——「hooks 仅主窗口可设」由 host 双重门禁裁决,失败原因原样 ⚠️ 回显;
|
|
1007
|
+
// 客户端预判角色只会把真实错误变成灰按钮,反而更难查;
|
|
1008
|
+
// ③ state 只读展示(host 状态机推进,重启可恢复);重试=把 state 置回 idle,走裁决通道,
|
|
1009
|
+
// 这里只负责给 failed 一个「前往裁决」锚点,不另造裁决入口。
|
|
1010
|
+
function hookRunOf(task, phase, runId) {
|
|
1011
|
+
var role = 'hook-' + phase
|
|
1012
|
+
// host 侧 run id 落位不对称:pre 在 spawn 成功时回填 hooks.pre.runId,post 复用 verifierRun 位
|
|
1013
|
+
// (claim 占位换真 id);且两端结算都把 runId 归零——所以取不到时按角色回退「最后一条」。
|
|
1014
|
+
var rid = runId || (phase === 'post' ? task.verifierRun : null)
|
|
1015
|
+
var runs = Array.isArray(task.runs) ? task.runs : []
|
|
1016
|
+
var hit = null
|
|
1017
|
+
for (var i = 0; i < runs.length; i++) {
|
|
1018
|
+
if (!runs[i] || runs[i].role !== role) continue
|
|
1019
|
+
if (rid && runs[i].id !== rid) continue
|
|
1020
|
+
hit = runs[i] // 顺序遍历取最后一条匹配:重试后的新 run 覆盖旧展示
|
|
1021
|
+
}
|
|
1022
|
+
return hit
|
|
1023
|
+
}
|
|
1024
|
+
function hookStateMeta(task, phase) {
|
|
1025
|
+
var h = (task.hooks && task.hooks[phase]) || null
|
|
1026
|
+
var st = (h && h.state) || 'idle'
|
|
1027
|
+
var off = !h || !h.enabled
|
|
1028
|
+
var run = hookRunOf(task, phase, h && h.runId)
|
|
1029
|
+
var meta = { idle: { label: off ? '未启用' : '待运行', color: C.text2 }, running: { label: '运行中', color: C.brand }, done: { label: '已完成', color: C.ok }, failed: { label: '失败', color: C.err } }[st] || { label: String(st), color: C.text2 }
|
|
1030
|
+
// 耗时:运行中 = 距 spawn 的已跑时长;已落定 = spawn → endedAt 净耗时(老 run 无 endedAt 则不显示)
|
|
1031
|
+
var dur = ''
|
|
1032
|
+
if (run && run.at) {
|
|
1033
|
+
if (st === 'running') dur = '已跑 ' + elapsedSince(run.at)
|
|
1034
|
+
else if (run.endedAt) dur = '耗时 ' + fmtDur(new Date(run.at).getTime(), new Date(run.endedAt).getTime())
|
|
1035
|
+
}
|
|
1036
|
+
return { state: st, off: off, label: meta.label, color: meta.color, run: run, dur: dur }
|
|
1037
|
+
}
|
|
1038
|
+
function HooksSection(props) {
|
|
1039
|
+
var _R = React; var useState = _R.useState // 与全库组件同例:bundler 只注入 React 本体,hook 须自行解构(漏了就是运行期 ReferenceError,shell 容错层直接卸载整个 overlay——2026-10-05 详情页崩板事故)
|
|
1040
|
+
var task = props.task
|
|
1041
|
+
var kHooks = task.hooks || null
|
|
1042
|
+
var _a = useState(''), msg = _a[0], setMsg = _a[1]
|
|
1043
|
+
var _b = useState(false), saving = _b[0], setSaving = _b[1]
|
|
1044
|
+
// 编辑缓冲以「卡上现值」为初值;父层以 key=task.id 挂载 → 切换任务自动重挂,缓冲不会串卡
|
|
1045
|
+
var _c = useState({ pre: { enabled: !!(kHooks && kHooks.pre && kHooks.pre.enabled), prompt: (kHooks && kHooks.pre && kHooks.pre.prompt) || '' }, post: { enabled: !!(kHooks && kHooks.post && kHooks.post.enabled), prompt: (kHooks && kHooks.post && kHooks.post.prompt) || '' } }), buf = _c[0], setBuf = _c[1]
|
|
1046
|
+
var kids = state.tasks.filter(function (x) { return x.parentId === task.id })
|
|
1047
|
+
var declared = !!(kHooks && (kHooks.pre || kHooks.post))
|
|
1048
|
+
if (kids.length === 0 && !declared) return null
|
|
1049
|
+
function setPhase(ph, patch) { var nb = { pre: buf.pre, post: buf.post }; nb[ph] = Object.assign({}, nb[ph], patch); setBuf(nb) }
|
|
1050
|
+
// 提交体组装(三条口径缺一都踩坑):
|
|
1051
|
+
// a) prompt 清空 = 撤掉该点位:host normalizeHooks 明确拒绝空 prompt,撤点位用 null 表达才在契约内
|
|
1052
|
+
// (不该把「我不想要这个 hook 了」变成一条报错);**例外**——该点位 state='running' 时不清空:
|
|
1053
|
+
// run 还在飞,撤掉声明会让它的结算落到空点位(表现为白跑一轮),删除意图原样保留并回一行提示;
|
|
1054
|
+
// b) 已声明点位的 state/runId/pending 原样回传:normalizeHooks 对缺省 state 归零成 idle,
|
|
1055
|
+
// 不透传就等于「改一下 prompt 把在跑/已落定的 hook 打回待运行」;
|
|
1056
|
+
// c) 凑不出 prompt 的点位一律提交 null(幂等删除,不凭空造点位)。
|
|
1057
|
+
function payloadFor(ph) {
|
|
1058
|
+
var cur = (task.hooks && task.hooks[ph]) || null
|
|
1059
|
+
var b = buf[ph] || { enabled: false, prompt: '' }
|
|
1060
|
+
function keep(h) { var it = { enabled: !!h.enabled, prompt: String(h.prompt || '') }; if (h.state) it.state = h.state; if (h.runId) it.runId = h.runId; if (h.pending) it.pending = true; return it }
|
|
1061
|
+
if (!String(b.prompt || '').trim()) {
|
|
1062
|
+
if (cur && cur.state === 'running') return { item: keep(cur), warn: ph + ' 运行中:本次不清空该点位(run 还在跑),等它跑完再撤' }
|
|
1063
|
+
return { item: null }
|
|
1064
|
+
}
|
|
1065
|
+
var item = { enabled: !!b.enabled, prompt: String(b.prompt).slice(0, 4000) }
|
|
1066
|
+
if (cur) {
|
|
1067
|
+
if (cur.state) item.state = cur.state
|
|
1068
|
+
if (cur.runId) item.runId = cur.runId
|
|
1069
|
+
if (cur.pending) item.pending = true
|
|
1070
|
+
}
|
|
1071
|
+
return { item: item }
|
|
1072
|
+
}
|
|
1073
|
+
function save() {
|
|
1074
|
+
if (saving) return
|
|
1075
|
+
var pre = payloadFor('pre'), post = payloadFor('post')
|
|
1076
|
+
var warns = [pre.warn, post.warn].filter(Boolean)
|
|
1077
|
+
setSaving(true); setMsg('')
|
|
1078
|
+
rpc('update-task', { taskId: task.id, hooks: { pre: pre.item, post: post.item } }).then(function (r) {
|
|
1079
|
+
setSaving(false)
|
|
1080
|
+
if (r && r.ok === false) { setMsg('⚠️ ' + (r.error || '保存失败')); return }
|
|
1081
|
+
setMsg(warns.length ? '⚠️ ' + warns.join(';') : '✅ 已保存 hooks 配置')
|
|
1082
|
+
fetchTasks()
|
|
1083
|
+
}).catch(function (e) { setSaving(false); setMsg('⚠️ ' + String(e)) })
|
|
1084
|
+
}
|
|
1085
|
+
// 「前往裁决」= 同页锚点跳转(裁决区 id 固定 tskb-escalation,由 DetailView 渲染);
|
|
1086
|
+
// hook 失败时 host 已把 epic 转 blocked 并挂好 escalation,这里只把视线送过去。
|
|
1087
|
+
function goArbitration() { var el = document.getElementById('tskb-escalation'); if (el && el.scrollIntoView) el.scrollIntoView({ block: 'center' }) }
|
|
1088
|
+
function phaseRow(ph, title, hint) {
|
|
1089
|
+
var m = hookStateMeta(task, ph)
|
|
1090
|
+
var b = buf[ph] || { enabled: false, prompt: '' }
|
|
1091
|
+
return React.createElement('div', { key: ph, style: { marginBottom: 6, padding: '5px 7px', border: '1px solid ' + C.border, borderRadius: 5, background: C.nested } },
|
|
1092
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap', marginBottom: 4 } },
|
|
1093
|
+
React.createElement('label', { style: { fontSize: 11, fontWeight: 600, color: C.text, display: 'inline-flex', alignItems: 'center', gap: 4, cursor: 'pointer' } },
|
|
1094
|
+
React.createElement('input', { type: 'checkbox', checked: !!b.enabled, onChange: function (e) { setPhase(ph, { enabled: e.target.checked }) }, title: '启用该点位(停用后 host 全链路跳过它)' }),
|
|
1095
|
+
title),
|
|
1096
|
+
React.createElement('span', { title: 'state 由 host 状态机推进(写在卡上,重启可恢复);失败后重试=把 state 置回 idle,走裁决通道', style: { fontSize: 9, padding: '0 5px', borderRadius: 3, background: 'color-mix(in srgb, ' + m.color + ' 16%, transparent)', color: m.color, fontWeight: 600 } }, m.label),
|
|
1097
|
+
m.dur ? React.createElement('span', { style: { fontSize: 9, color: C.text2 } }, m.dur) : null,
|
|
1098
|
+
m.run && m.run.id ? React.createElement('button', { onClick: function () { if (uiWorkspaceSvc) uiWorkspaceSvc.openSession(m.run.id) }, title: '查看该 hook run 的会话(' + m.run.id + (m.run.model ? ' · ' + m.run.model : '') + ')', style: { fontSize: 9, padding: '1px 6px', border: '1px solid ' + C.brand, borderRadius: 3, background: 'transparent', color: C.brand, cursor: 'pointer' } }, '→ 查看会话') : null,
|
|
1099
|
+
m.state === 'failed' ? React.createElement('button', { onClick: goArbitration, title: '跳到本页裁决区:重试(置回 idle)/ 跳过(置 done 放行)/ 放弃(终止史诗)', style: { fontSize: 9, padding: '1px 6px', border: 'none', borderRadius: 3, background: C.err, color: C_INV, cursor: 'pointer', fontWeight: 600 } }, '前往裁决') : null),
|
|
1100
|
+
React.createElement('textarea', { value: b.prompt, onChange: function (e) { setPhase(ph, { prompt: e.target.value }) }, rows: 2, placeholder: '补充指令(可选)——前置=让子任务具备开跑条件;后置=把这批活收口。具体动作由 hook agent 自行决策', style: { width: '100%', fontSize: 11, padding: '4px 6px', border: '1px solid ' + C.border2, borderRadius: 4, background: C.card, color: C.text, resize: 'vertical', boxSizing: 'border-box', fontFamily: 'inherit' } }),
|
|
1101
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3, lineHeight: 1.6 } }, hint))
|
|
1102
|
+
}
|
|
1103
|
+
return React.createElement('div', { style: { marginBottom: 8, padding: '6px 8px', border: '1px solid ' + C.border, borderRadius: 6, background: C.card } },
|
|
1104
|
+
React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 4 } }, ic('zap', 11), 'Hooks(可选点位)'),
|
|
1105
|
+
phaseRow('pre', '⏳ 前置(pre)', '让子任务具备开跑条件:未完成前该史诗的子任务一张都不派(串行闸门)。'),
|
|
1106
|
+
phaseRow('post', '🧪 收尾(post)', '把这批活收口:全部子任务了结后跑一遍,完成后史诗才转验证中。'),
|
|
1107
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' } },
|
|
1108
|
+
React.createElement('button', { onClick: save, disabled: saving, title: '保存到卡上(update-task RPC,hooks 字段浅合并)', style: { fontSize: 10, padding: '3px 8px', border: 'none', borderRadius: 3, background: C.brand, color: C_INV, cursor: saving ? 'default' : 'pointer', opacity: saving ? 0.6 : 1, fontWeight: 600, display: 'inline-flex', alignItems: 'center', gap: 3 } }, saving ? '保存中…' : [ic('save', 10), ' 保存 hooks']),
|
|
1109
|
+
msg ? React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, msg) : null),
|
|
1110
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 4, lineHeight: 1.6 } }, '每个点位是一次真实 agent 运行(不是声明式命令):prompt 只给薄框架契约与上下文,动作由 hook agent 自行决策,吃不准会歧义上报;失败即转阻塞等人裁决(重试/跳过/放弃),不会自动重跑。清空 prompt 保存 = 撤掉该点位。hooks 仅主窗口可设(host 门禁,失败原因原样回显)。'))
|
|
1111
|
+
}
|
|
1112
|
+
|
|
900
1113
|
function DetailView() {
|
|
901
1114
|
var _R = React; var useState = _R.useState, useEffect = _R.useEffect; var task = getTask(state.detailId)
|
|
902
1115
|
var _a = useState(task ? task.title : ''), editTitle = _a[0], setEditTitle = _a[1]; var _b = useState(task ? task.description || '' : ''), editDesc = _b[0], setEditDesc = _b[1]; var _c = useState(false), saving = _c[0], setSaving = _c[1]; var _d = useState(state.boardMode), mode = _d[0], setMode = _d[1]
|
|
@@ -919,7 +1132,7 @@ function apply(ctx) {
|
|
|
919
1132
|
if (r && r.ok === false && r.error === 'touches-conflict') {
|
|
920
1133
|
var ids = Array.isArray(r.conflicts) ? r.conflicts : []
|
|
921
1134
|
var names = ids.map(function (id) { var t2 = getTask(id); return (t2 ? t2.title : id) + ' (' + id + ')' }).join('、')
|
|
922
|
-
if (window.confirm('⚠️
|
|
1135
|
+
if (window.confirm('⚠️ 文件锁冲突:以下任务正持有同一批文件(touches 重叠;锁持到归档——verifying/resolved 卡也在持锁,等其归档即自动放行):\n\n' + (names || ids.join('、')) + '\n\n强行并行可能互相覆盖改动/diff 冲突。仍要越权派发吗?')) return send(true)
|
|
923
1136
|
setActionMsg('⛔ 已取消派发(等文件锁释放,或调整 touches 声明)')
|
|
924
1137
|
return { ok: false, cancelled: true }
|
|
925
1138
|
}
|
|
@@ -929,9 +1142,34 @@ function apply(ctx) {
|
|
|
929
1142
|
function submitIntervene() { if (!interveneMsg.trim()) return; rpc('intervene-agent', { taskId: task.id, message: interveneMsg }).then(function (r) { setActionMsg(r && r.ok ? '✅ 高优指令已插入 ' + shortId(r.agent) + ' 队首' : '⚠️ ' + ((r && r.error) || '无活动 Agent')); setInterveneMsg(''); fetchTasks() }).catch(function (e) { setActionMsg('⚠️ ' + String(e)) }) }
|
|
930
1143
|
var isManual = task.assignMode === 'manual'; var canJump = (task.status === 'in-progress' || task.status === 'verifying') && task.claimedBy && task.claimedBy !== state.sessionId
|
|
931
1144
|
var canIntervene = task.status === 'in-progress' || task.status === 'verifying'
|
|
1145
|
+
// ===== 无障碍·「流转到」按钮组(反馈 n-mut9rzpyc7p1):状态流转不再只有拖拽一条路 =====
|
|
1146
|
+
// 合法迁移与拖拽 transition()(kernel.js)逐条对齐——host 门禁不变,失败原因 ⚠️ 回显 actionMsg 行;
|
|
1147
|
+
// 原生 button 元素天然键盘可达(Tab 聚焦 + Enter/Space 触发),读屏可报组名与按钮名
|
|
1148
|
+
var FLOW_DEF = {
|
|
1149
|
+
'pending': [{ to: 'in-progress', label: '▶ 开始处理', color: C.brand, tip: '领取并开始处理(待办 → 进行中)' }],
|
|
1150
|
+
'in-progress': [{ to: 'verifying', label: '✅ 提交验收', color: C.ok, tip: '提交验证(进行中 → 验证中),需填解决说明' }, { to: 'blocked', label: '⛔ 标记阻塞', color: C.warn, tip: '标记为阻塞(进行中 → 阻塞)' }],
|
|
1151
|
+
'blocked': [{ to: 'pending', label: '↩ 重投待办', color: C.brand, tip: '解除阻塞重新投放(阻塞 → 待办)' }, { to: 'in-progress', label: '▶ 开始处理', color: C.brand, tip: '领取并开始处理(阻塞 → 进行中)' }],
|
|
1152
|
+
'verifying': [{ to: 'resolved', label: '✔ 验收通过', color: C.ok, tip: '验收通过(验证中 → 已完成)' }, { to: 'in-progress', label: '↩ 驳回重投', color: C.err, tip: '驳回回执行中(验证中 → 进行中)' }]
|
|
1153
|
+
}
|
|
1154
|
+
var flowBtns = FLOW_DEF[task.status] || []
|
|
1155
|
+
function flowTo(to) {
|
|
1156
|
+
var p = null
|
|
1157
|
+
if (to === 'in-progress' && (task.status === 'pending' || task.status === 'blocked')) p = rpc('claim-task', { taskId: task.id })
|
|
1158
|
+
else if (to === 'pending' && task.status === 'blocked') p = rpc('update-task', { taskId: task.id, resetToPending: true })
|
|
1159
|
+
else if (to === 'verifying' && task.status === 'in-progress') { var res = window.prompt('提交验证 — 解决说明(必填):'); if (!res) return; p = rpc('resolve-task', { taskId: task.id, status: 'verifying', resolution: res }) }
|
|
1160
|
+
else if (to === 'blocked' && task.status === 'in-progress') { var rs = window.prompt('阻塞原因(可选):') || ''; p = rpc('resolve-task', { taskId: task.id, status: 'blocked', resolution: rs }) }
|
|
1161
|
+
else if (to === 'resolved' && task.status === 'verifying') p = rpc('verify-task', { taskId: task.id, verdict: 'approved' })
|
|
1162
|
+
else if (to === 'in-progress' && task.status === 'verifying') { var cm = window.prompt('驳回原因(可选):'); p = rpc('verify-task', { taskId: task.id, verdict: 'rejected', comment: cm || '' }) }
|
|
1163
|
+
if (!p) return
|
|
1164
|
+
p.then(function (r) { if (r && r.ok === false) setActionMsg('⚠️ 流转失败:' + (r.error || '未知错误')); else setActionMsg('✅ 已流转到「' + (statusLabels[to] || to) + '」'); fetchTasks() }).catch(function (e) { setActionMsg('⚠️ ' + String(e)) })
|
|
1165
|
+
}
|
|
932
1166
|
return React.createElement('div', { style: { padding: '4px 2px' } },
|
|
933
1167
|
React.createElement('div', { onClick: function () { state.detailId = null; notify() }, style: { fontSize: 11, color: C.brand, cursor: 'pointer', marginBottom: 8 } }, '← 返回看板'),
|
|
934
1168
|
React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, marginBottom: 8 } }, React.createElement('span', { style: { fontSize: 10, padding: '1px 6px', borderRadius: 3, background: 'color-mix(in srgb, ' + (prioColor[task.priority] || prioColor.low) + ' 20%, transparent)', color: (prioColor[task.priority] || prioColor.low) } }, prioLabel[task.priority] || '中'), React.createElement('span', { style: { fontSize: 11, padding: '1px 8px', borderRadius: 3, background: C.nested, color: C.text } }, statusLabels[task.status] || task.status), React.createElement('select', { value: task.pipeline || 'full', onChange: function (e) { rpc('update-task', { taskId: task.id, pipeline: e.target.value }).then(fetchTasks).catch(function () {}) }, title: '管线档位', style: { fontSize: 10, padding: '1px 4px', border: '1px solid ' + C.border, borderRadius: 3, background: C.card, color: C.text2 } }, React.createElement('option', { value: 'full' }, '全流程(执行+验证)'), React.createElement('option', { value: 'work' }, '免验证(只做不验)'), React.createElement('option', { value: 'direct' }, '主窗口处理')), task.pipelineAuto ? React.createElement('span', { style: { fontSize: 9, color: C.text2 }, title: '由规则自动分类,可手动覆盖' }, 'auto') : null, isManual ? React.createElement('span', { style: { fontSize: 10, color: C.text2, display: 'inline-flex', alignItems: 'center', gap: 2 } }, ic('user', 10), '手动派发') : null),
|
|
1169
|
+
// 流转到按钮组(键盘可达的状态迁移入口,替代拖拽;无合法迁移的状态(draft/resolved 等)整块不渲染)
|
|
1170
|
+
flowBtns.length > 0 ? React.createElement('div', { role: 'group', 'aria-label': '状态流转', style: { display: 'flex', alignItems: 'center', gap: 5, flexWrap: 'wrap', marginBottom: 8, padding: '5px 8px', border: '1px solid ' + C.border, borderRadius: 6, background: C.card } },
|
|
1171
|
+
React.createElement('span', { style: { fontSize: 10, fontWeight: 600, color: C.text2 } }, '⇄ 流转到:'),
|
|
1172
|
+
flowBtns.map(function (b) { return React.createElement('button', { key: b.to, onClick: function () { flowTo(b.to) }, title: b.tip, style: { fontSize: 10, padding: '3px 9px', border: '1px solid ' + b.color, borderRadius: 3, background: 'transparent', color: b.color, cursor: 'pointer', fontWeight: 600 } }, b.label) })) : null,
|
|
935
1173
|
// 最近失败(host settle 失败路径写入 task.lastError;缺字段静默不渲染,≤2 行截断,悬停看全文)
|
|
936
1174
|
task.lastError ? React.createElement('div', { style: { fontSize: 11, color: C.err, marginBottom: 8, padding: '4px 8px', border: '1px solid ' + C.err, borderRadius: 6, background: 'color-mix(in srgb, ' + C.err + ' 8%, transparent)', display: '-webkit-box', WebkitBoxOrient: 'vertical', WebkitLineClamp: 2, overflow: 'hidden', wordBreak: 'break-all' }, title: String(task.lastError) }, '最近失败: ' + String(task.lastError)) : null,
|
|
937
1175
|
task.frozen ? React.createElement('div', { style: { fontSize: 11, color: C.text, marginBottom: 8, padding: '6px 8px', border: '1px solid ' + C.brand, borderRadius: 6, background: 'color-mix(in srgb, ' + C.brand + ' 8%, transparent)', display: 'flex', alignItems: 'center', gap: 6, flexWrap: 'wrap' } },
|
|
@@ -950,7 +1188,7 @@ function apply(ctx) {
|
|
|
950
1188
|
React.createElement('span', null, '已运行 ' + elapsedSince(task.claimedAt) + '(软超时 ' + state.softTimeoutMin + ' 分提醒 · 硬超时 ' + state.hardTimeoutMin + ' 分自动终止)'),
|
|
951
1189
|
elapsedMin(task.claimedAt) > state.softTimeoutMin ? React.createElement('span', { style: { color: C.warn, fontWeight: 600 } }, '⏱ 已超软超时') : null,
|
|
952
1190
|
React.createElement('button', { onClick: doTerminate, title: '终止该执行 Agent,任务回 pending 重新排队', style: { fontSize: 10, padding: '2px 8px', border: '1px solid ' + C.err, borderRadius: 3, background: 'transparent', color: C.err, cursor: 'pointer', marginLeft: 'auto' } }, '⏹ 立即终止')) : null,
|
|
953
|
-
task.escalation ? React.createElement('div', { style: { marginBottom: 8, padding: '8px 10px', border: '1px solid ' + C.err, borderRadius: 6, background: 'color-mix(in srgb, ' + C.err + ' 8%, transparent)' } },
|
|
1191
|
+
task.escalation ? React.createElement('div', { id: 'tskb-escalation', style: { marginBottom: 8, padding: '8px 10px', border: '1px solid ' + C.err, borderRadius: 6, background: 'color-mix(in srgb, ' + C.err + ' 8%, transparent)' } },
|
|
954
1192
|
React.createElement('div', { style: { fontSize: 12, fontWeight: 700, color: C.err, marginBottom: 4, display: 'flex', alignItems: 'center', gap: 4 } }, ic('alert-triangle', 13), 'Worker 上报歧义 — 等待主窗口裁决'),
|
|
955
1193
|
React.createElement('div', { style: { fontSize: 11, color: C.text, marginBottom: 6, whiteSpace: 'pre-wrap', maxHeight: 160, overflowY: 'auto' } }, task.escalation.question),
|
|
956
1194
|
React.createElement('div', { style: { fontSize: 10, color: C.text2, marginBottom: 6 } }, '上报于 ' + ago(task.escalation.at) + ' · ' + (task.escalation.by || '')),
|
|
@@ -993,6 +1231,8 @@ function apply(ctx) {
|
|
|
993
1231
|
'📎 调研注入: ' + (empty ? '无调研注入——Worker 需自行定位,建议补 contextFiles/contextNotes' : parts.join(' · ')))
|
|
994
1232
|
})(),
|
|
995
1233
|
React.createElement(FamilySection, { task: task }),
|
|
1234
|
+
// Hooks 区(史诗可选点位):key=task.id 保证切换任务时重挂,编辑缓冲不串卡
|
|
1235
|
+
React.createElement(HooksSection, { key: task.id, task: task }),
|
|
996
1236
|
React.createElement(DepsSection, { task: task }),
|
|
997
1237
|
task.acceptance ? React.createElement('div', { style: { fontSize: 11, color: C.text, marginBottom: 6, padding: '5px 8px', background: C.nested, borderRadius: 4, borderLeft: '2px solid ' + C.ok, fontFamily: 'monospace', display: 'flex', alignItems: 'center', gap: 4 } }, ic('flask-conical', 11), '硬性验收: ' + task.acceptance) : null,
|
|
998
1238
|
task.resolution ? React.createElement('div', { style: { fontSize: 11, color: C.text, marginBottom: 6, padding: '5px 8px', background: C.nested, borderRadius: 4, borderLeft: '2px solid ' + C.warn, maxHeight: 120, overflowY: 'auto', whiteSpace: 'pre-wrap' } }, '📝 ' + task.resolution) : null,
|
|
@@ -1049,7 +1289,7 @@ function apply(ctx) {
|
|
|
1049
1289
|
}
|
|
1050
1290
|
|
|
1051
1291
|
// ============================================================================
|
|
1052
|
-
// dashboard —— 仪表盘域:统计(computeStats/TrendChart/StatCard/BarRow)· 范围筛选(RangeFilter)
|
|
1292
|
+
// dashboard —— 仪表盘域:统计(computeStats/TrendChart/StatCard/BarRow/ResearchRoiRow)· 范围筛选(RangeFilter)
|
|
1053
1293
|
// · 全局总览(GlobalBoards)· 报告(buildReport/ReportButton)· Token 消耗(TokenUsage)
|
|
1054
1294
|
// · 架构健康(HealthHints,架构自省 L1)
|
|
1055
1295
|
// · 团队池(TeamView/PoolStatus)· 设置(WorkModeSwitch/PoolCfg/MinCfg/ModelCfg/PoolCfgPopover)
|
|
@@ -1064,8 +1304,50 @@ function apply(ctx) {
|
|
|
1064
1304
|
recentActivity.sort(function (a, b) { return (b.timestamp || '').localeCompare(a.timestamp || '') }); recentActivity = recentActivity.slice(0, 10)
|
|
1065
1305
|
function avgMs(arr) { if (arr.length === 0) return null; var s = arr.reduce(function (a, b) { return a + b }, 0); return Math.round(s / arr.length) }
|
|
1066
1306
|
function fmtMs(ms) { if (!ms) return '-'; var m = Math.floor(ms / 60000); if (m < 60) return m + ' 分钟'; var h = Math.floor(m / 60); if (h < 24) return h + ' 小时 ' + (m % 60) + ' 分'; return Math.floor(h / 24) + ' 天 ' + (h % 24) + ' 时' }
|
|
1307
|
+
// 调研 ROI 分组(task-mutnjesa):resolved/archived 且有执行数据(claimedAt→resolvedAt 可算,
|
|
1308
|
+
// 无 claimedAt 的手工/direct 卡跳过)的卡按「有无调研注入」分两组——有调研 = context.files /
|
|
1309
|
+
// context.notes 任一非空(context 缺省按无调研,与详情页「调研注入」行同口径)。
|
|
1310
|
+
// 与 usageSummary 同哲学:纯现算零存储。任一组为空或总样本 <4 时 roi=null(样本太少没说服力,不渲染)。
|
|
1311
|
+
var roiYes = [], roiNo = []
|
|
1312
|
+
tasks.forEach(function (t) {
|
|
1313
|
+
if (t.status !== 'resolved' && t.status !== 'archived') return
|
|
1314
|
+
if (!t.claimedAt || !t.resolvedAt) return
|
|
1315
|
+
var execMs = new Date(t.resolvedAt) - new Date(t.claimedAt)
|
|
1316
|
+
if (!(execMs >= 0)) return // 时间戳异常(NaN/负值)跳过
|
|
1317
|
+
var cx = t.context || {}
|
|
1318
|
+
var hasRes = (Array.isArray(cx.files) && cx.files.length > 0) || (typeof cx.notes === 'string' && cx.notes.trim().length > 0)
|
|
1319
|
+
// token 口径与「Token 消耗区」一致化(task-muupnnq5):取**有效消耗**(输入+输出+缓存写,不含缓存读),
|
|
1320
|
+
// 不再拿含缓存读的 total 冒充——本板实测缓存读占总量 ~94%,用 total 会让 ROI 行的 token 均值虚高十几倍,
|
|
1321
|
+
// 与 Token 区大数字口径互相打架。分量字段缺失的老/存量卡兜底退化为 total 并打 tokFallback 标记(title 标注),
|
|
1322
|
+
// 绝不把总量伪装成有效值;无任何结算记录的卡 tok=null,不参与均值(不拉低样本)。
|
|
1323
|
+
var tk = roiTokenOf(t.usage)
|
|
1324
|
+
;(hasRes ? roiYes : roiNo).push({ execMs: execMs, tok: tk.tok, tokFallback: tk.fallback })
|
|
1325
|
+
})
|
|
1326
|
+
var roi = null
|
|
1327
|
+
if (roiYes.length > 0 && roiNo.length > 0 && roiYes.length + roiNo.length >= 4) {
|
|
1328
|
+
var roiAgg = function (arr) {
|
|
1329
|
+
var execMs = Math.round(arr.reduce(function (a, b) { return a + b.execMs }, 0) / arr.length)
|
|
1330
|
+
var toks = [], fb = 0
|
|
1331
|
+
arr.forEach(function (x) { if (x.tok !== null) { toks.push(x.tok); if (x.tokFallback) fb++ } })
|
|
1332
|
+
return { n: arr.length, execMs: execMs, tok: toks.length ? Math.round(toks.reduce(function (a, b) { return a + b }, 0) / toks.length) : null, tokN: toks.length, tokFallbackN: fb }
|
|
1333
|
+
}
|
|
1334
|
+
roi = { yes: roiAgg(roiYes), no: roiAgg(roiNo) }
|
|
1335
|
+
}
|
|
1067
1336
|
// 耗时口径三分离(task-mutdnitw):avgQueue=平均排队(创建→被领取)、avgExec=平均执行(被领取→完成),均只统计领取过的卡;avgVerify 口径不动(完成→验收)
|
|
1068
|
-
return { total: total, byStatus: byStatus, byPriority: byPriority, byAgent: byAgent, avgQueue: fmtMs(avgMs(queueTimes)), avgExec: fmtMs(avgMs(execTimes)), avgVerify: fmtMs(avgMs(verifyTimes)), todayDone: todayDone, dailyDone: dailyDone, recentActivity: recentActivity }
|
|
1337
|
+
return { total: total, byStatus: byStatus, byPriority: byPriority, byAgent: byAgent, avgQueue: fmtMs(avgMs(queueTimes)), avgExec: fmtMs(avgMs(execTimes)), avgVerify: fmtMs(avgMs(verifyTimes)), todayDone: todayDone, dailyDone: dailyDone, recentActivity: recentActivity, roi: roi }
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
// 单卡 token 口径(task-muupnnq5):ROI 行与「Token 消耗区」口径同源,避免同一张卡两处两个数。
|
|
1341
|
+
// 有分量(input/output/cacheWrite 任一 >0)→ 有效消耗(不含缓存读);只有 total 的老/存量卡 → 兜底 total 并标 fallback;
|
|
1342
|
+
// 两者皆无 → tok=null(无结算样本,跳过而不是记 0,避免拉低均值)。
|
|
1343
|
+
// 注:客户端 bundle 只注入 React(无模块系统),故此处内联,host 侧同款判定在 lib/usage.mjs taskEffectiveTokens。
|
|
1344
|
+
function roiTokenOf(u) {
|
|
1345
|
+
if (!u) return { tok: null, fallback: false }
|
|
1346
|
+
function pos(v) { var n = Number(v); return isFinite(n) && n > 0 ? n : 0 }
|
|
1347
|
+
var inp = pos(u.input), outp = pos(u.output), cw = pos(u.cacheWrite), tot = pos(u.total)
|
|
1348
|
+
if (inp > 0 || outp > 0 || cw > 0) return { tok: inp + outp + cw, fallback: false }
|
|
1349
|
+
if (tot > 0) return { tok: tot, fallback: true }
|
|
1350
|
+
return { tok: null, fallback: false }
|
|
1069
1351
|
}
|
|
1070
1352
|
|
|
1071
1353
|
function TrendChart(props) {
|
|
@@ -1088,6 +1370,32 @@ function apply(ctx) {
|
|
|
1088
1370
|
// 双行指标卡(耗时口径三分离:原「平均完成时间」一个展示位拆为 排队/执行 两行,不挤占其他指标位)
|
|
1089
1371
|
function StatCardDual(props) { return React.createElement('div', { style: { flex: '1 1 0', minWidth: 80, padding: '6px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, textAlign: 'center' }, title: props.title }, React.createElement('div', { style: { fontSize: 14, fontWeight: 700, color: props.color || C.text } }, String(props.value1)), React.createElement('div', { style: { fontSize: 10, color: C.text2, marginTop: 1 } }, props.label1), React.createElement('div', { style: { fontSize: 14, fontWeight: 700, color: props.color || C.text, marginTop: 3 } }, String(props.value2)), React.createElement('div', { style: { fontSize: 10, color: C.text2, marginTop: 1 } }, props.label2)) }
|
|
1090
1372
|
|
|
1373
|
+
// 调研 ROI 对比行(task-mutnjesa):让数据替道理说话——「有调研 vs 无调研」分组账单直接摆给主窗口看,
|
|
1374
|
+
// 比任何引导文案都管用。数据源 computeStats 的 roi(null = 任一组为空或总样本 <4,整块不渲染);
|
|
1375
|
+
// 无调研组明显更慢(平均执行 > 有调研组 1.2 倍,阈值写清避免把随机波动误读成结论)时其数字用 warn 色。
|
|
1376
|
+
// token 口径(task-muupnnq5):**有效消耗**(输入+输出+缓存写,不含缓存读),与「Token 消耗区」大数字同源;
|
|
1377
|
+
// 组内只要有一张卡走了 total 兜底(无分量字段的老/存量卡),该数字后加 '~' 并在 title 里写明张数。
|
|
1378
|
+
function ResearchRoiRow(props) {
|
|
1379
|
+
var roi = props.roi
|
|
1380
|
+
if (!roi) return null
|
|
1381
|
+
function fmtM(ms) { var m = Math.round(ms / 60000); if (m < 60) return m + 'm'; return (m / 60).toFixed(1) + 'h' }
|
|
1382
|
+
var noSlower = roi.no.execMs > roi.yes.execMs * 1.2
|
|
1383
|
+
function grp(icon, label, g, warnNums) {
|
|
1384
|
+
var approx = (g.tokFallbackN || 0) > 0
|
|
1385
|
+
var tip = g.tok === null ? label + ':无带 usage 结算记录的卡,token 均值不可计'
|
|
1386
|
+
: g.n + ' 卡中 ' + g.tokN + ' 张有 usage 结算记录;均值口径 = 有效消耗(输入+输出+缓存写,不含缓存读)'
|
|
1387
|
+
+ (approx ? ';其中 ' + g.tokFallbackN + ' 张无分量字段(老/存量结算),退化为含缓存读的合计值参与均值(故标 ~)' : '')
|
|
1388
|
+
return React.createElement('span', { title: tip },
|
|
1389
|
+
icon + ' ' + label + ' ',
|
|
1390
|
+
React.createElement('span', { style: { fontWeight: 600, color: warnNums ? C.warn : C.text } }, g.n + ' 卡 平均 ' + fmtM(g.execMs) + '/约 ' + (g.tok === null ? '-' : (approx ? '~' : '') + fmtTokens(g.tok)) + ' tok'))
|
|
1391
|
+
}
|
|
1392
|
+
return React.createElement('div', { style: { padding: '6px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12, fontSize: 10, color: C.text2, display: 'flex', alignItems: 'baseline', gap: 8, flexWrap: 'wrap' }, title: 'resolved/archived 且领取过的卡按有无调研注入分组现算(执行 = 被领取→完成;token 均值只计有 usage 结算记录的卡,口径 = 有效消耗:输入+输出+缓存写,不含缓存读;老卡无分量字段时退化为合计并标 ~)' },
|
|
1393
|
+
React.createElement('span', { style: { fontSize: 11, fontWeight: 600, color: C.text2, display: 'inline-flex', alignItems: 'center', gap: 4 } }, ic('scale', 11), '调研 ROI'),
|
|
1394
|
+
grp('📎', '有调研', roi.yes, false),
|
|
1395
|
+
React.createElement('span', null, '·'),
|
|
1396
|
+
grp('⚠️', '无调研', roi.no, noSlower))
|
|
1397
|
+
}
|
|
1398
|
+
|
|
1091
1399
|
function BarRow(props) { var pct = props.total > 0 ? (props.count / props.total * 100) : 0; return React.createElement('div', { style: { display: 'flex', alignItems: 'center', gap: 6, marginBottom: 4 } }, React.createElement('span', { style: { width: 40, fontSize: 10, color: C.text2, textAlign: 'right', flexShrink: 0 } }, props.label), React.createElement('div', { style: { flex: 1, height: 8, background: C.nested, borderRadius: 4, overflow: 'hidden' } }, React.createElement('div', { style: { height: '100%', width: pct + '%', background: props.color || C.brand, borderRadius: 4, transition: 'width .3s' } })), React.createElement('span', { style: { width: 24, fontSize: 10, color: C.text2, flexShrink: 0 } }, String(props.count))) }
|
|
1092
1400
|
|
|
1093
1401
|
// ===== 仪表盘:日期范围筛选(共享给报告与全局总览)=====
|
|
@@ -1212,6 +1520,24 @@ function apply(ctx) {
|
|
|
1212
1520
|
// usageSummary 由 host 从各任务 t.usage 现算(t.usage 来自 Worker/Verifier 会话 v4 日志的
|
|
1213
1521
|
// assistant/message.usage 聚合)。这里只做展示、不做计费断言;日志读不到/还没有 run 结算时
|
|
1214
1522
|
// usageSummary.total 为 0,一律显示「暂无数据」。
|
|
1523
|
+
// 日账(usageSummary.byDay:{'YYYY-MM-DD': {t,e}})用于「今日」大数字与「近 7 天」条形。
|
|
1524
|
+
// 双指标口径:t = 总量(含缓存读)、e = 有效消耗(输入+输出+缓存写,不含缓存读)。
|
|
1525
|
+
// e === null 表示该日只有老形态 number 日账 / 存量兜底(没有逐 run 拆分,有效值不可知)——
|
|
1526
|
+
// 展示时退化为 t 并在文案/title 上标 ~ 近似,绝不把总量冒充有效值。
|
|
1527
|
+
// dayKey 口径与 host 记账完全一致——本地 getters 拼,绝不用 toISOString()(UTC 会让
|
|
1528
|
+
// 晚上 8 点后的消耗落到次日,今日消耗直接错位)。
|
|
1529
|
+
function localDayKey(d) {
|
|
1530
|
+
var x = d || new Date()
|
|
1531
|
+
function p2(n) { return (n < 10 ? '0' : '') + n }
|
|
1532
|
+
return x.getFullYear() + '-' + p2(x.getMonth() + 1) + '-' + p2(x.getDate())
|
|
1533
|
+
}
|
|
1534
|
+
// 近 n 天的本地日 key 序列(旧 → 新,最后一个是今天);本地日期构造天然跨月/跨年正确
|
|
1535
|
+
function lastNDays(n) {
|
|
1536
|
+
var out = []
|
|
1537
|
+
var now = new Date()
|
|
1538
|
+
for (var i = n - 1; i >= 0; i--) out.push(localDayKey(new Date(now.getFullYear(), now.getMonth(), now.getDate() - i)))
|
|
1539
|
+
return out
|
|
1540
|
+
}
|
|
1215
1541
|
function fmtTokens(n) {
|
|
1216
1542
|
var v = Number(n) || 0
|
|
1217
1543
|
if (v >= 1000000000) return (v / 1000000000).toFixed(1) + 'B'
|
|
@@ -1238,13 +1564,49 @@ function apply(ctx) {
|
|
|
1238
1564
|
var maxM = models.length ? (models[0].total || 1) : 1
|
|
1239
1565
|
var top = u.topTasks || []
|
|
1240
1566
|
var maxT = top.length ? (top[0].total || 1) : 1
|
|
1567
|
+
// 日账:今日数字取本地日 key,没有日账(byDay 缺字段/老 host)时退化为 0,不炸也不误报。
|
|
1568
|
+
// 读侧兼容两种单元形态:老 number(只有总量,有效值不可知)→ { t: n, e: null }。
|
|
1569
|
+
var byDay = (u.byDay && typeof u.byDay === 'object') ? u.byDay : {}
|
|
1570
|
+
function dayOf(v) {
|
|
1571
|
+
if (v && typeof v === 'object') return { t: Number(v.t) || 0, e: (v.e === 0 || v.e) ? Number(v.e) || 0 : null }
|
|
1572
|
+
return { t: Number(v) || 0, e: null }
|
|
1573
|
+
}
|
|
1574
|
+
var todayKey = localDayKey()
|
|
1575
|
+
var todayCell = dayOf(byDay[todayKey])
|
|
1576
|
+
// 有效消耗缺失(老日账/存量兜底)→ 大数字退化为总量并打 approx 标 ~,口径不伪造
|
|
1577
|
+
var todayApprox = todayCell.e === null
|
|
1578
|
+
var todayEff = todayApprox ? todayCell.t : todayCell.e
|
|
1579
|
+
var days = lastNDays(7)
|
|
1580
|
+
var maxDay = 1
|
|
1581
|
+
var hasDayData = false
|
|
1582
|
+
for (var di = 0; di < days.length; di++) { var dc = dayOf(byDay[days[di]]); var dv = (dc.e === null ? dc.t : dc.e); if (dv > maxDay) maxDay = dv; if (dc.t > 0 || dc.e > 0) hasDayData = true }
|
|
1241
1583
|
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))) }
|
|
1584
|
+
// 累计三分量:有效(真实成本)+ 缓存读(占了 total 的大头,必须单列才看得出虚高来源)+ 合计
|
|
1585
|
+
var effTotal = (typeof u.effective === 'number') ? u.effective : ((u.input || 0) + (u.output || 0) + (u.cacheWrite || 0))
|
|
1242
1586
|
return React.createElement('div', { style: box },
|
|
1243
1587
|
head,
|
|
1244
1588
|
React.createElement('div', { style: { display: 'flex', alignItems: 'baseline', gap: 10, flexWrap: 'wrap', marginBottom: 8 } },
|
|
1245
|
-
React.createElement('span', { style: { fontSize: 20, fontWeight: 700, color: C.brand } }, fmtTokens(
|
|
1246
|
-
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, 'tokens
|
|
1247
|
-
|
|
1589
|
+
React.createElement('span', { style: { fontSize: 20, fontWeight: 700, color: C.brand }, title: '今日有效消耗(本地日 ' + todayKey + ')= 输入+输出+缓存写,不含缓存读;一次 run 的消耗整笔记在结算日' + (todayApprox ? '。本条日账来自老形态/存量兜底数据,有效值不可知,此处以总量近似(标 ~)' : '') }, (todayApprox ? '~' : '') + fmtTokens(todayEff)),
|
|
1590
|
+
React.createElement('span', { style: { fontSize: 10, color: C.text2 } }, 'tokens(今日有效' + (todayApprox ? ' · 近似' : '') + ')'),
|
|
1591
|
+
todayCell.t > todayEff ? React.createElement('span', { style: { fontSize: 10, color: C.text2 }, title: '今日总量(含缓存读)——与有效消耗的差额就是缓存读' }, '含缓存读共 ', React.createElement('span', { style: { color: C.text, fontWeight: 600 } }, fmtTokens(todayCell.t))) : null,
|
|
1592
|
+
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))),
|
|
1593
|
+
mini('输入', u.input), mini('输出', u.output), u.cacheWrite ? mini('缓存写', u.cacheWrite) : null),
|
|
1594
|
+
// 近 7 天迷你条形:高按区间 max 归一(今天高亮 brand,其余浅底 + 边框),
|
|
1595
|
+
// 柱高一律取**有效消耗**;e 不可知的日退化为总量(title 标 ~ 近似)。
|
|
1596
|
+
// 7 天全为 0 时整块不渲染(零残留,不占版面)
|
|
1597
|
+
hasDayData ? React.createElement('div', { style: { marginBottom: 8 } },
|
|
1598
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '近 7 天(有效消耗)'),
|
|
1599
|
+
React.createElement('div', { style: { display: 'flex', alignItems: 'flex-end', gap: 4 } },
|
|
1600
|
+
days.map(function (k) {
|
|
1601
|
+
var c = dayOf(byDay[k])
|
|
1602
|
+
var approx = c.e === null
|
|
1603
|
+
var v = approx ? c.t : c.e
|
|
1604
|
+
var isToday = k === todayKey
|
|
1605
|
+
var h = v > 0 ? Math.max(3, Math.round(v / maxDay * 32)) : 3
|
|
1606
|
+
return React.createElement('div', { key: k, title: k.slice(5) + ':有效 ' + String(v) + (approx ? '(近似:老日账只有总量)' : '') + ' tok' + (c.t > v ? ' / 含缓存读共 ' + String(c.t) + ' tok' : ''), style: { flex: 1, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 2 } },
|
|
1607
|
+
React.createElement('div', { style: { width: '100%', height: h, background: isToday ? C.brand : C.nested, border: '1px solid ' + (isToday ? C.brand : C.border), borderRadius: 2 } }),
|
|
1608
|
+
React.createElement('span', { style: { fontSize: 8, color: isToday ? C.brand : C.text2, whiteSpace: 'nowrap' } }, k.slice(5)))
|
|
1609
|
+
}))) : null,
|
|
1248
1610
|
React.createElement('div', { style: { display: 'flex', gap: 12, flexWrap: 'wrap' } },
|
|
1249
1611
|
React.createElement('div', { style: { flex: '1 1 240px', minWidth: 200 } },
|
|
1250
1612
|
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '按模型分布'),
|
|
@@ -1255,8 +1617,10 @@ function apply(ctx) {
|
|
|
1255
1617
|
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, marginBottom: 4 } }, '任务消耗 Top 8'),
|
|
1256
1618
|
top.length === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无数据') : top.map(function (x) {
|
|
1257
1619
|
var t = getTask(x.id)
|
|
1258
|
-
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 + '
|
|
1259
|
-
})))
|
|
1620
|
+
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((typeof x.effective === 'number') ? x.effective : (x.total - (x.cacheRead || 0))) + ' / 缓存读 ' + String(x.cacheRead || 0) + ' · ' + (x.runs || 0) + ' 次 run)' + (t ? '——点击查看详情' : ''), onClick: t ? function () { state.detailId = x.id; notify() } : undefined })
|
|
1621
|
+
}))),
|
|
1622
|
+
// 口径边界:本区只统计看板派发的 Worker/Verifier run,主窗口对话自身不越界纳入
|
|
1623
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 6, lineHeight: 1.5 } }, '口径:仅看板派发的 Worker/Verifier run 消耗,不含主窗口对话;大数字与「近 7 天」为有效消耗(输入+输出+缓存写,不含缓存读),缓存读单列'))
|
|
1260
1624
|
}
|
|
1261
1625
|
|
|
1262
1626
|
// ===== 架构健康提示区(架构自省 L1 · 数据源:state.healthHints)=====
|
|
@@ -1292,6 +1656,7 @@ function apply(ctx) {
|
|
|
1292
1656
|
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 }) })),
|
|
1293
1657
|
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 }) }))),
|
|
1294
1658
|
React.createElement('div', { style: { display: 'flex', gap: 6, marginBottom: 12, flexWrap: 'wrap' } }, React.createElement(StatCardDual, { label1: '平均排队', value1: stats.avgQueue, label2: '平均执行', value2: stats.avgExec, title: '耗时口径三分离:⏳ 排队 = 创建 → 被领取(等了多久);⏱ 执行 = 被领取 → 完成(干了多久);均不含验收时长' }), React.createElement(StatCard, { label: '平均验证时间', value: stats.avgVerify }), React.createElement(StatCard, { label: '今日完成', value: stats.todayDone, color: C.ok })),
|
|
1659
|
+
React.createElement(ResearchRoiRow, { roi: stats.roi }),
|
|
1295
1660
|
React.createElement(TrendChart, { data: stats.dailyDone }),
|
|
1296
1661
|
Object.keys(stats.byAgent).length > 0 ? React.createElement('div', { style: { padding: '8px 10px', background: C.card, border: '1px solid ' + C.border, borderRadius: 6, marginBottom: 12 } }, React.createElement('div', { style: { fontSize: 11, fontWeight: 600, color: C.text2, marginBottom: 6 } }, 'Agent 负载(进行中+验证中)'), Object.keys(stats.byAgent).map(function (aid) { return React.createElement('div', { key: aid, style: { display: 'flex', alignItems: 'center', gap: 6, marginBottom: 3, fontSize: 11 } }, React.createElement(ActorLink, { id: aid }), React.createElement('span', { style: { color: C.text2 } }, stats.byAgent[aid] + ' 个任务')) })) : null,
|
|
1297
1662
|
React.createElement('div', { style: { 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 } }, '最近活跃'), stats.recentActivity.length === 0 ? React.createElement('div', { style: { fontSize: 10, color: C.text2 } }, '暂无记录') : stats.recentActivity.map(function (a, i) { return React.createElement('div', { key: i, style: { fontSize: 10, color: C.text2, marginBottom: 3, display: 'flex', gap: 4, alignItems: 'center' } }, React.createElement('span', { style: { color: statusColors[a.to] || C.brand, fontWeight: 600 } }, statusLabels[a.to] || a.to), React.createElement('span', { style: { color: C.text, maxWidth: 120, overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' } }, a.title), React.createElement(ActorLink, { id: a.actor }), React.createElement('span', null, ago(a.timestamp))) })))
|
|
@@ -1420,7 +1785,25 @@ function apply(ctx) {
|
|
|
1420
1785
|
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, margin: '7px 0 5px' } }, '学习反馈'),
|
|
1421
1786
|
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 5, fontSize: 10, color: C.text, cursor: 'pointer', whiteSpace: 'normal', maxWidth: 260 } },
|
|
1422
1787
|
React.createElement('input', { type: 'checkbox', checked: !!props.feedbackEnabled, onChange: function (e) { rpc('set-board-config', { key: 'feedbackEnabled', value: e.target.checked }).then(fetchTasks).catch(function () {}) } }),
|
|
1423
|
-
React.createElement('span', null, '候选教训(Verifier 驳回/仲裁结论自动生成候选,Worker prompt 提示先检索历史教训)'))
|
|
1788
|
+
React.createElement('span', null, '候选教训(Verifier 驳回/仲裁结论自动生成候选,Worker prompt 提示先检索历史教训)')),
|
|
1789
|
+
// 回执开关(用户要求「回执可以做一个开关,放到设置里」):派发/完成两类回执各自可关,缺省都开。
|
|
1790
|
+
// 只影响回执播报,不影响派发与状态机;歧义裁决通知不在此闸门内(见下行说明文案)。
|
|
1791
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, margin: '7px 0 5px' } }, '通知'),
|
|
1792
|
+
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 5, fontSize: 10, color: C.text, cursor: 'pointer', whiteSpace: 'normal', maxWidth: 260 } },
|
|
1793
|
+
React.createElement('input', { type: 'checkbox', checked: props.notifyDispatch !== false, onChange: function (e) { rpc('set-board-config', { key: 'notifyDispatch', value: e.target.checked }).then(fetchTasks).catch(function () {}) } }),
|
|
1794
|
+
React.createElement('span', null, '⚡ 派发回执(任务被 Worker/Verifier 领走时播报)')),
|
|
1795
|
+
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 5, fontSize: 10, color: C.text, cursor: 'pointer', whiteSpace: 'normal', maxWidth: 260, marginTop: 3 } },
|
|
1796
|
+
React.createElement('input', { type: 'checkbox', checked: props.notifyDone !== false, onChange: function (e) { rpc('set-board-config', { key: 'notifyDone', value: e.target.checked }).then(fetchTasks).catch(function () {}) } }),
|
|
1797
|
+
React.createElement('span', null, '✅ 完成回执(任务完成或阻塞时聚合播报)')),
|
|
1798
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3, whiteSpace: 'normal', maxWidth: 260 } }, '歧义裁决通知不受这两个开关影响(任务等人裁决必须提醒)'),
|
|
1799
|
+
// 史诗拆分总开关(板级 epicSplit,缺省 true):**只关引导,不禁机制**——关掉后 Team 提示词不再
|
|
1800
|
+
// 注入「大任务必须拆分」第 6 条、create-task 响应不再附 suggestSplit 软提示;显式传 parentId 建
|
|
1801
|
+
// 子卡、史诗自动收口/hooks 状态机照常(用户/主窗口明确要拆时不受阻)。勾选态缺字段=开,与 host 同口径。
|
|
1802
|
+
React.createElement('div', { style: { fontSize: 10, fontWeight: 600, color: C.text2, margin: '7px 0 5px' } }, '功能'),
|
|
1803
|
+
React.createElement('label', { style: { display: 'flex', alignItems: 'center', gap: 5, fontSize: 10, color: C.text, cursor: 'pointer', whiteSpace: 'normal', maxWidth: 260 } },
|
|
1804
|
+
React.createElement('input', { type: 'checkbox', checked: props.epicSplit !== false, onChange: function (e) { rpc('set-board-config', { key: 'epicSplit', value: e.target.checked }).then(fetchTasks).catch(function () {}) } }),
|
|
1805
|
+
React.createElement('span', null, '🧩 史诗拆分:大任务引导拆为 epic + 子任务')),
|
|
1806
|
+
React.createElement('div', { style: { fontSize: 9, color: C.text2, marginTop: 3, whiteSpace: 'normal', maxWidth: 260 } }, '关掉只停引导:显式 parentId 建子卡与史诗自动收口照常工作')) : null)
|
|
1424
1807
|
}
|
|
1425
1808
|
|
|
1426
1809
|
function TeamView() {
|