fix(dsh): reconcile orphan schedules and preserve audit evidence
This commit is contained in:
1 parent
4aaebcb65a
commit
282252a5fb
16 files changed
+578
-27
No files matched your search
@@ -154,12 +154,15 @@ window.__ModuleLoader__.load({id:'@dx/dsh-task',factory:require=>{
|
||||
actions(button('dx-schedule-new','为当前任务设置排期',()=>perform({operation:'schedule_dialog',task_ids:scope}),pending||!scope.length),
|
||||
button('dx-schedules-refresh','刷新排期',()=>perform({operation:'refresh'}),pending)),
|
||||
empty('时间按本机时区显示。排期在工具打开期间检查,执行前仍需核对保存范围与实际预检。'),
|
||||
operations.schedule_audit?.status==='ok'&&empty(`排期审计:近期 ${operations.schedule_audit.live_events} 条,已归档 ${operations.schedule_audit.archived_events} 条;旧记录完整保留在本地审计归档。`),
|
||||
operations.schedule_audit?.status==='unavailable'&&empty('排期审计归档不可用,请保留现有记录并核对本地归档。'),
|
||||
...(operations.schedules||[]).map(row=>card(row.schedule_id,row.title||'任务排期',
|
||||
detail('状态',status(row.status)),detail('优先级',priorities[row.priority]||display(row.priority)),detail('不早于',time(row.not_before)),
|
||||
detail('截止时间',time(row.due_at)),detail('任务',(row.task_ids||[]).join(' → ')),detail('依赖',(row.dependencies||[]).join('、')||'无'),
|
||||
detail('执行方式',row.auto_start?'已保存自动启动意图,依原生授权与预检执行':'等待手动确认'),
|
||||
blockerList(row.blockers),actions(
|
||||
button('dx-schedule-run-'+row.schedule_id,'核对并执行',()=>perform({operation:'run_schedule',schedule_id:row.schedule_id}),pending||row.ready!==true),
|
||||
row.status==='claimed'&&button('dx-schedule-reconcile-'+row.schedule_id,'核对并收尾失联排期',()=>perform({operation:'reconcile_schedule',schedule_id:row.schedule_id}),pending),
|
||||
button('dx-schedule-cancel-'+row.schedule_id,'取消排期',()=>perform({operation:'cancel_schedule',schedule_id:row.schedule_id}),pending||row.status!=='pending')))),
|
||||
!operations.schedules?.length&&empty('暂无排期。'),
|
||||
...(operations.schedule_events||[]).slice(0,10).map(row=>card('schedule-event-'+row.sequence,
|
||||
|
||||
@@ -44,13 +44,13 @@ 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','health','decisions','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','reconcile_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.'},
|
||||
due_at:{type:'string',description:'Optional deadline with timezone offset'},dependencies:{type:'array',items:{type:'string'},description:'Actual preceding task IDs that must complete without unresolved evidence'},
|
||||
auto_start:{type:'boolean',description:'Future idle execution intent only. Native confirmation explicitly authorizes the frozen scope; never a bypass. Default false.'}},
|
||||
description:'Read execution history/recoverable runs, exact saved impact or unknown mapping counts, evidence-backed local experiences, and existing Git issue status/replies. Refresh one bound ticket by real incident ID; cannot write comments. Plan tasks with priority/time/dependencies and optional idle execution using a native confirmation. App must remain open; changed plans, pause, uncertainty and blockers prevent scheduled execution. Use only fields relevant to the selected operation. history/refresh return real saved run and schedule IDs. resume reconfirms an original frozen queue. Interactive conversations only.'},
|
||||
description:'Read execution history/recoverable runs, exact saved impact or unknown mapping counts, evidence-backed local experiences, and existing Git issue status/replies. Refresh one bound ticket by real incident ID; cannot write comments. Plan tasks with priority/time/dependencies and optional idle execution using a native confirmation. App must remain open; changed plans, pause, uncertainty and blockers prevent scheduled execution. reconcile_schedule requests native confirmation to close an orphan claimed schedule only when no execution owns it and resources are released; preserves the original run for recovery and never starts execution. Use only fields relevant to the selected operation. history/refresh return real saved run and schedule IDs. resume reconfirms an original frozen queue. Interactive conversations only.'},
|
||||
];
|
||||
for(const {capability,...definition} of definitions){
|
||||
ctx.tools.register(defineTool({...definition,output,execute:(spec,exec)=>request(capability,spec,exec)}));
|
||||
|
||||
@@ -28,6 +28,7 @@ export function compactResult(value){
|
||||
if(result.tasks)result.tasks=result.tasks.map(t=>({...t,...t.note?{note:short(t.note,300)}:{}}));
|
||||
if(result.runs)result.runs=result.runs.slice(0,5).map(run);
|
||||
if(result.schedules)result.schedules=result.schedules.slice(0,10).map(schedule);
|
||||
if(result.schedule_audit)result.schedule_audit=fields(result.schedule_audit,['status','live_events','archived_events','retained_limit']);
|
||||
if(result.schedule_events)result.schedule_events=result.schedule_events.slice(0,10).map(row=>({
|
||||
...fields(row,['sequence','schedule_id','at_utc','event','run_id']),
|
||||
payload:{...fields(row.payload,['automatic','authority','status']),
|
||||
@@ -47,7 +48,7 @@ export function modelSnapshot(value){
|
||||
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||[],health:ops.health,
|
||||
decision_audit:ops.decision_audit,decisions:ops.decisions||[],
|
||||
section_errors:ops.section_errors||[],schedule_events:ops.schedule_events||[]});
|
||||
section_errors:ops.section_errors||[],schedule_events:ops.schedule_events||[],schedule_audit:ops.schedule_audit});
|
||||
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