fix(dsh): isolate damaged decision audit from operations refresh

This commit is contained in:
阿白叔 committed 2026-10-31 11:51:01 +08:00
1 parent a99f84b25e
commit cd66d63f4f
7 files changed
+149 -5

No files matched your search

+6 -3
View File
@@ -29,17 +29,20 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{
h('div',{style:{whiteSpace:'pre-wrap',color:'var(--dsw-alias-label-secondary)',lineHeight:1.8}},text));
const health=data?.operations?.health;
const decisions=data?.operations?.decisions||[];
const audit=data?.operations?.decision_audit;
const auditUnavailable=audit&&['corrupt','unavailable'].includes(audit.status);
const healthText=health?.checks?.map(row=>`${row.name}: ${row.status} · ${row.message}`).join('\n')||'正在读取运行健康…';
return h('div',{'data-testid':'dx-task-overview'},
section('当前任务',data?(data.task_name||data.task_id||'尚未选择任务'):'读取中…'),
h('section',{'data-testid':'dx-health-summary',style:{marginBottom:24}},
h('h3',{style:{fontSize:14,fontWeight:500,marginBottom:10}},'运行健康 · '+(health?.status||'读取中')),
h('div',{style:{whiteSpace:'pre-wrap',color:'var(--dsw-alias-label-secondary)',lineHeight:1.8}},healthText),
h('button',{type:'button',onClick:()=>perform({operation:'health'}),style:{...buttonStyle,marginTop:8}},'重新检查健康状态')),
h('button',{'data-testid':'dx-health-refresh',type:'button',onClick:()=>perform({operation:'health'}),style:{...buttonStyle,marginTop:8}},'重新检查健康状态')),
h('section',{'data-testid':'dx-decision-timeline',style:{marginBottom:24}},
h('h3',{style:{fontSize:14,fontWeight:500,marginBottom:10}},'自动处理决策记录'),
decisions.length?decisions.slice(0,5).map(row=>h('p',{key:row.record_hash,style:{fontSize:12,lineHeight:1.7,margin:'6px 0'}},`#${row.sequence} · ${row.trigger} · ${row.outcome} · ${row.human_takeover?'人工接管':'自动策略'}`)):h('p',{style:{fontSize:12,color:'var(--dsw-alias-label-secondary)'}},'暂无自动处理记录。'),
h('button',{type:'button',onClick:()=>perform({operation:'decisions'}),style:{...buttonStyle,marginTop:8}},'刷新决策记录')),
auditUnavailable?h('p',{'data-testid':'dx-decision-audit-error',role:'status',style:{fontSize:12,lineHeight:1.7}},audit.message):
decisions.length?decisions.slice(0,5).map(row=>h('p',{key:row.record_hash,style:{fontSize:12,lineHeight:1.7,margin:'6px 0'}},`#${row.sequence} · ${row.trigger} · ${row.outcome} · ${row.human_takeover?'人工接管':'自动策略'}`)):h('p',{style:{fontSize:12,color:'var(--dsw-alias-label-secondary)'}},'暂无自动处理记录。'),
h('button',{'data-testid':'dx-decisions-refresh',type:'button',onClick:()=>perform({operation:'decisions'}),style:{...buttonStyle,marginTop:8}},'刷新决策记录')),
data?.lifecycle?.request_id&&h('section',{'data-testid':'dx-task-lifecycle',style:{marginBottom:24}},
h('h3',{style:{fontSize:14,fontWeight:500}},data.lifecycle.title||'对话任务操作'),
h('p',{'data-testid':'dx-lifecycle-status'},({checking:'正在核对真实任务',awaiting_confirmation:'请核对原生确认窗口',