refac
This commit is contained in:
1 parent
0c23466a3e
commit
7088d245bb
18 files changed
+1329
-211
No files matched your search
@@ -127,6 +127,20 @@ function buildToolCallToken(item: OutputItem, toolOutputByCallId: Record<string,
|
||||
const callId = item.call_id ?? '';
|
||||
const resultItem = toolOutputByCallId[callId];
|
||||
const isDone = isDoneStatus(item.status) || !!resultItem;
|
||||
let name = item.name ?? '';
|
||||
if (name === 'delegate_task') {
|
||||
try {
|
||||
const args =
|
||||
typeof item.arguments === 'string'
|
||||
? JSON.parse(item.arguments || '{}')
|
||||
: (item.arguments ?? {});
|
||||
const task = typeof args.task === 'string' && args.task ? args.task : '?';
|
||||
const label = args.background ? 'Background sub-agent' : 'Sub-agent';
|
||||
name = `${label}: "${task.length > 60 ? `${task.slice(0, 60)}...` : task}"`;
|
||||
} catch {
|
||||
name = 'Sub-agent';
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
summary: isDone ? 'Tool Executed' : 'Executing...',
|
||||
@@ -134,7 +148,7 @@ function buildToolCallToken(item: OutputItem, toolOutputByCallId: Record<string,
|
||||
attributes: {
|
||||
type: 'tool_calls',
|
||||
id: callId,
|
||||
name: item.name ?? '',
|
||||
name,
|
||||
done: isDone ? 'true' : 'false',
|
||||
arguments: stringifyAttribute(item.arguments ?? ''),
|
||||
files: stringifyAttribute(resultItem?.files),
|
||||
|
||||
Reference in new issue
Block a user