agents-relay 2.0.270 → 2.0.271
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/dashboard/dashboard.js +31 -6
- package/package.json +1 -1
package/dashboard/dashboard.js
CHANGED
|
@@ -356,18 +356,43 @@ function openJobDetails(){
|
|
|
356
356
|
const inputs=uniqueInputs(candidates,objective);
|
|
357
357
|
showDetailsDialog('Job',job.id,job.title,objective,inputs,readerReviewComments(job));
|
|
358
358
|
}
|
|
359
|
-
function
|
|
359
|
+
function taskReaderEnvelope(task){
|
|
360
|
+
const raw=detailText(task.input);
|
|
361
|
+
if(!raw.startsWith('{'))return null;
|
|
362
|
+
try{
|
|
363
|
+
const parsed=JSON.parse(raw);
|
|
364
|
+
return parsed&&typeof parsed==='object'&&!Array.isArray(parsed)?parsed:null;
|
|
365
|
+
}catch{return null;}
|
|
366
|
+
}
|
|
367
|
+
function taskReaderObjective(task,envelope=taskReaderEnvelope(task)){
|
|
368
|
+
const explicit=detailText(task.objective)||detailText(envelope?.taskObjective)||detailText(envelope?.objective);
|
|
369
|
+
if(explicit)return explicit;
|
|
360
370
|
const title=detailText(task.title);
|
|
361
|
-
//
|
|
371
|
+
// A serialized Script/DAG execution envelope is not a natural-language objective.
|
|
372
|
+
// Until an actual Task objective is persisted, use its title rather than inventing one.
|
|
373
|
+
if(envelope)return title||'Task '+task.id;
|
|
362
374
|
if(title&&/\s/.test(title))return title;
|
|
363
|
-
const
|
|
364
|
-
|
|
375
|
+
const first=detailText(task.input).split(/\n\s*\n/).map(item=>item.trim())
|
|
376
|
+
.find(item=>item&&!/^(Job ID|Task ID|Review head SHA|Execution ID):/i.test(item));
|
|
365
377
|
return first||title||'Task '+task.id;
|
|
366
378
|
}
|
|
379
|
+
function taskReaderInputs(task,envelope=taskReaderEnvelope(task)){
|
|
380
|
+
if(!envelope)return [{content:task.input}];
|
|
381
|
+
const inputs=[];
|
|
382
|
+
const request=detailText(envelope.taskInput)||detailText(envelope.input)||detailText(envelope.prompt);
|
|
383
|
+
const instruction=detailText(envelope.instruction)||detailText(envelope.instructions);
|
|
384
|
+
if(request)inputs.push({source:'Task request',content:request});
|
|
385
|
+
if(instruction)inputs.push({source:'Execution instructions',content:instruction});
|
|
386
|
+
// For unknown JSON input contracts, preserve the full input without turning it
|
|
387
|
+
// into a fake objective. Known DAG transport fields are not user-facing content.
|
|
388
|
+
if(!inputs.length)inputs.push({content:'```json\n'+JSON.stringify(envelope,null,2)+'\n```'});
|
|
389
|
+
return inputs;
|
|
390
|
+
}
|
|
367
391
|
function openTaskDetails(task){
|
|
368
392
|
const job=selected();
|
|
369
|
-
const
|
|
370
|
-
const
|
|
393
|
+
const envelope=taskReaderEnvelope(task);
|
|
394
|
+
const objective=taskReaderObjective(task,envelope);
|
|
395
|
+
const candidates=taskReaderInputs(task,envelope);
|
|
371
396
|
for(const attachment of task.attachments||[])candidates.push({source:'Attachment',content:attachment});
|
|
372
397
|
const inputs=uniqueInputs(candidates,objective);
|
|
373
398
|
showDetailsDialog('Task',task.id,task.title,objective,inputs,readerReviewComments(job,task));
|