refactor: let DSH infer intent from backend capability schemas

This commit is contained in:
阿白叔 committed 2026-10-30 14:49:22 +08:00
1 parent ef40f339cd
commit be382a117d
6 files changed
+43 -6

No files matched your search

+2 -2
View File
@@ -60,7 +60,7 @@ export async function apply(ctx){
for(const request of creations.values())request.reject(Error('Task center disconnected'));
},'dx-task: settle task requests');
ctx.tools.register(defineTool({name:'dx_task_create',
description:'Create real DxDesigner project tasks with replacement rules. Opens the native task preview and project selector; the user confirms the project scope. Returns actual task IDs after creation or cancellation. Does not execute CAD. project_directory only prefills the native dialog and is never scanned automatically.',
description:'Create real DxDesigner project tasks with replacement rules. Opens the native task preview and project selector; the user confirms the project scope. Returns actual task IDs after creation or cancellation. Does not execute CAD. A directory may be omitted: the user can supply it in the native dialog. project_directory only prefills that dialog and is never scanned automatically. Include only options explicitly requested by the user; omit unspecified options to retain task-center defaults. Available to interactive conversations, denied in automatic incident sessions.',
parameters:{name:{type:'string',required:true,description:'Short task name'},note:{type:'string'},
project_directory:{type:'string',description:'Optional directory suggested by the user; only displayed for native confirmation'},
copy_part_number_to_value:{type:'boolean',description:'Copy the part number into Value. Default false; set true only when requested.'},
@@ -112,7 +112,7 @@ export async function apply(ctx){
emit({status:'started',session_id:sessionId});
const agent=ctx.agents.get(sessionId);
const startOffset=agent.session.snapshotEvents().length;
const prompt=(request.phase==='reflect'?'复盘本次未解决的任务异常,结合实际动作与核验,补充候选原因、支持证据、缺失证据与下一步验证。':'自动介入任务异常,先调用 dx_task_snapshot 读取本事件绑定的快照,分析是否符合已知失败重试条件。')+
const prompt=(request.phase==='reflect'?'复盘本次未解决的任务异常,结合实际动作与核验,补充候选原因、支持证据、缺失证据与下一步验证。':'自动介入任务异常,根据实际任务状态和运行记录,分析是否符合已知失败重试条件。')+
'\n用简明中文 Markdown 输出诊断结论、候选原因及证据、仍缺少的证据和下一步验证。区分已证实事实和推测。最后附一个很短的 json 代码块:{"action":"retry_failed 或 none"},供规则协调器读取。'+
'\n不得声称已修改或修复;程序在规则门禁通过后最多重试一次,并以真实执行结果核验。不确定状态不得重试。'+
'任务 status 是业务状态,running 不表示仍有活动 worker;phase=retry 表示已有明确失败项等待重试。intervention 字段是协调器采集的授权、未核验和次数事实,实际执行仍须经过服务租约与状态检查。'+