feat(dsh): harden health decisions and issue transport
This commit is contained in:
1 parent
736b582bc1
commit
eee4e6bde9
18 files changed
+592
-11
No files matched your search
@@ -24,11 +24,22 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{
|
||||
border:0,borderRadius:10,background:'transparent',color:'var(--dsw-alias-label-primary)',cursor:'pointer',font:'inherit'}},
|
||||
h(IconSettingsOutlineMedium,{size:18}),wide&&'工具设置');
|
||||
}
|
||||
function OverviewPanel({data,notice,request}){
|
||||
function OverviewPanel({data,notice,request,perform}){
|
||||
const section=(title,text)=>h('section',{style:{marginBottom:24}},h('h3',{style:{fontSize:14,fontWeight:500,marginBottom:10}},title),
|
||||
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 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('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}},'刷新决策记录')),
|
||||
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:'请核对原生确认窗口',
|
||||
@@ -235,7 +246,7 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{
|
||||
h('div',{role:'tablist','aria-label':'任务监管',style:{display:'flex',flexWrap:'wrap',gap:4,marginBottom:18,paddingBottom:10,borderBottom:border}},
|
||||
...tabs.map(([id,title])=>h('button',{key:id,id:'dx-tab-'+id,role:'tab',type:'button','data-testid':'dx-operations-tab-'+id,'aria-selected':tab===id,'aria-controls':'dx-pane-'+id,onClick:()=>setTab(id),style:{...buttonStyle,border:tab===id?border:'1px solid transparent',fontWeight:tab===id?600:400,color:tab===id?'var(--dsw-alias-label-primary)':secondary}},title))),
|
||||
h('div',{role:'tabpanel',id:'dx-pane-'+tab,'aria-labelledby':'dx-tab-'+tab},
|
||||
tab==='overview'?h(OverviewPanel,{data,notice,request}):
|
||||
tab==='overview'?h(OverviewPanel,{data,notice,request,perform}):
|
||||
tab==='running'?h(RunningPanel,{operations,perform,pending:pending||operations.busy,request}):
|
||||
tab==='impact'?h(ImpactPanel,{report:operations.impact,scope,perform,pending:pending||operations.busy}):
|
||||
tab==='schedules'?h(SchedulesPanel,{operations,scope,perform,pending:pending||operations.busy}):
|
||||
|
||||
@@ -44,7 +44,7 @@ export function registerLifecycle(ctx){
|
||||
{name:'dx_task_execute',capability:'execute',parameters:{operation:{type:'string',required:true,enum:['start','pause','resume']},task_ids:{type:'array',items:{type:'string'},description:ids.description},run_id:{type:'string',description:'For resume only, use the real saved run ID from execution history. Original frozen scope/order and existing checkpoint are inspected, then natively confirmed.'}},
|
||||
description:'Start or continue the existing serial execution queue for an explicit ordered list of real task IDs. Prechecks and native confirmation are required; actual execution can replace and save engineering files using existing backup, interruption and verification gates. Waits for real results including saved, failed and no-match counts. For pause, provide exactly the active run scope; requests safe stopping after the current item and returns pause_requested, not a claim that stopping has completed. No force-stop, no new CAD scripting or hidden retry. Interactive conversations only.'},
|
||||
{name:'dx_task_operations',capability:'operations',parameters:{
|
||||
operation:{type:'string',required:true,enum:['refresh','history','impact','experience','tickets','refresh_ticket','schedule','schedule_dialog','cancel_schedule','run_schedule','resume']},
|
||||
operation:{type:'string',required:true,enum:['refresh','history','health','decisions','impact','experience','tickets','refresh_ticket','schedule','schedule_dialog','cancel_schedule','run_schedule','resume']},
|
||||
task_ids:{type:'array',items:{type:'string'},description:ids.description},run_id:{type:'string'},schedule_id:{type:'string'},incident_id:{type:'string'},issue_code:{type:'string'},
|
||||
title:{type:'string'},priority:{type:'string',enum:['low','normal','high','urgent']},
|
||||
not_before:{type:'string',description:'For schedule: earliest run time as ISO 8601 with explicit timezone offset, e.g. 2026-10-30T18:00:00+08:00. Ask when ambiguous; never guess a date.'},
|
||||
|
||||
@@ -9,6 +9,8 @@ const experience=row=>({...fields(row,['incident_id','issue_code','verified','ve
|
||||
summary:short(row.summary,1200),message:short(row.message)});
|
||||
const ticket=row=>({...fields(row,['incident_id','number','url','state','status','last_sync_at','last_attempt_at','error','reason']),
|
||||
comments:row.comments?.slice(-3).map(c=>({...fields(c,['id','created_at','updated_at','author']),body:short(c.body)}))});
|
||||
const health=row=>({...fields(row,['status','checked_utc']),checks:(row.checks||[]).slice(0,10).map(check=>fields(check,['name','status','code','message','updated_utc']))});
|
||||
const decision=row=>fields(row,['sequence','at_utc','previous_hash','record_hash','incident_id','trigger','evidence_refs','gates','candidate_action','authorized_scope','outcome','human_takeover']);
|
||||
function impact(report){
|
||||
if(!report||typeof report!=='object')return report;
|
||||
const rows=report.rows||[];
|
||||
@@ -29,13 +31,15 @@ export function compactResult(value){
|
||||
if(result.experiences)result.experiences=result.experiences.slice(0,5).map(experience);
|
||||
if(result.tickets)result.tickets=result.tickets.slice(0,5).map(ticket);
|
||||
if(result.ticket)result.ticket=ticket(result.ticket);
|
||||
if(result.health)result.health=health(result.health);
|
||||
if(result.decisions)result.decisions=result.decisions.slice(0,10).map(decision);
|
||||
return JSON.parse(JSON.stringify(result));
|
||||
}
|
||||
export function modelSnapshot(value){
|
||||
const result=fields(value,['task_id','revision','task_name','status','progress','rules_count','issue','issue_code','events','action_result']);
|
||||
const ops=value.operations||{};
|
||||
result.operations=compactResult({busy:ops.busy===true,live_run:ops.live_run,last_execution:ops.last_execution,
|
||||
runs:ops.runs||[],schedules:ops.schedules||[],experiences:ops.experiences||[],tickets:ops.tickets||[]});
|
||||
runs:ops.runs||[],schedules:ops.schedules||[],experiences:ops.experiences||[],tickets:ops.tickets||[],health:ops.health,decisions:ops.decisions||[]});
|
||||
if(value.automation?.incident_id)result.automation=fields(value.automation,['incident_id','task_id','issue_code','status','attempts','verification']);
|
||||
if(value.lifecycle?.status)result.lifecycle=fields(value.lifecycle,['request_id','status','task_ids','run_id']);
|
||||
return result;
|
||||
|
||||
Reference in new issue
Block a user