tuna-agent 0.1.173 → 0.1.174
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.
|
@@ -730,22 +730,12 @@ export class ClaudeCodeAdapter {
|
|
|
730
730
|
// Step 4: Execute subtasks
|
|
731
731
|
console.log(`[ClaudeCode] Starting execution for task ${task.id}`);
|
|
732
732
|
ws.sendProgress(task.id, 'executing', { startedAt: new Date().toISOString() });
|
|
733
|
-
ws.sendPMMessage(task.id, {
|
|
734
|
-
sender: 'pm',
|
|
735
|
-
content: "Starting execution now. I'll keep you updated as each session progresses.",
|
|
736
|
-
});
|
|
737
733
|
// Step 4-6: Execute plan with follow-up loop
|
|
738
734
|
const allSessions = [];
|
|
739
735
|
let lastStatus = 'done';
|
|
740
736
|
const MAX_FOLLOW_UP_ROUNDS = 10;
|
|
741
737
|
for (let followUpRound = 0; followUpRound <= MAX_FOLLOW_UP_ROUNDS; followUpRound++) {
|
|
742
738
|
ws.sendProgress(task.id, 'executing', { startedAt: new Date().toISOString() });
|
|
743
|
-
if (followUpRound === 0) {
|
|
744
|
-
ws.sendPMMessage(task.id, {
|
|
745
|
-
sender: 'pm',
|
|
746
|
-
content: "Starting execution now. I'll keep you updated as each session progresses.",
|
|
747
|
-
});
|
|
748
|
-
}
|
|
749
739
|
const result = await executePlanAndReport(task, plan, ws, pendingInputResolvers, signal, confirmBeforeEdit, onPermissionRequest);
|
|
750
740
|
allSessions.push(...result.sessions);
|
|
751
741
|
lastStatus = result.status;
|
|
@@ -65,11 +65,15 @@ export function buildExecutionCallbacks(taskId, plan, ws, resolvers, onPermissio
|
|
|
65
65
|
role: subtask.role,
|
|
66
66
|
description: subtask.description,
|
|
67
67
|
});
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
68
|
+
// Only announce a "session started" for real multi-role dev teams.
|
|
69
|
+
// A single 'self' agent doing its own work needs no orchestration noise.
|
|
70
|
+
if (subtask.role !== 'self') {
|
|
71
|
+
await new Promise(resolve => setTimeout(resolve, 100));
|
|
72
|
+
ws.sendPMMessage(taskId, {
|
|
73
|
+
sender: 'system',
|
|
74
|
+
content: `${capitalize(subtask.role)} session started`,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
73
77
|
}
|
|
74
78
|
},
|
|
75
79
|
onSubtaskLog: async (subtaskId, logData) => {
|
|
@@ -92,9 +96,13 @@ export function buildExecutionCallbacks(taskId, plan, ws, resolvers, onPermissio
|
|
|
92
96
|
const durationStr = durationMs ? `${(durationMs / 1000).toFixed(1)}s` : '';
|
|
93
97
|
const resultPreview = rawResult ? simplifyMarkdown(rawResult) : '';
|
|
94
98
|
await new Promise(resolve => setTimeout(resolve, 100));
|
|
99
|
+
const isSelf = subtask?.role === 'self';
|
|
95
100
|
ws.sendPMMessage(taskId, {
|
|
96
101
|
sender: 'pm',
|
|
97
|
-
|
|
102
|
+
// Single 'self' agent: just deliver the result, no "X completed successfully" scaffolding.
|
|
103
|
+
content: isSelf
|
|
104
|
+
? (resultPreview || 'Xong ạ.')
|
|
105
|
+
: `${roleName} completed successfully${durationStr ? ` in ${durationStr}` : ''}${resultPreview ? `\n\n${resultPreview}` : ''}`,
|
|
98
106
|
});
|
|
99
107
|
}
|
|
100
108
|
else if (session.status === 'failed') {
|
|
@@ -109,9 +117,10 @@ export function buildExecutionCallbacks(taskId, plan, ws, resolvers, onPermissio
|
|
|
109
117
|
onSubtaskNeedsInput: async (subtaskId, question) => {
|
|
110
118
|
const subtask = plan.subtasks.find((s) => s.id === subtaskId);
|
|
111
119
|
const roleName = subtask ? capitalize(subtask.role) : 'A session';
|
|
120
|
+
const askSelf = subtask?.role === 'self';
|
|
112
121
|
ws.sendPMMessage(taskId, {
|
|
113
122
|
sender: 'pm',
|
|
114
|
-
content: `${roleName} is asking: ${question.question}`,
|
|
123
|
+
content: askSelf ? question.question : `${roleName} is asking: ${question.question}`,
|
|
115
124
|
options: question.options,
|
|
116
125
|
context: question.context,
|
|
117
126
|
});
|
|
@@ -122,10 +131,13 @@ export function buildExecutionCallbacks(taskId, plan, ws, resolvers, onPermissio
|
|
|
122
131
|
context: question.context,
|
|
123
132
|
});
|
|
124
133
|
const { text: answer } = await waitForInput(taskId, resolvers);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
// No "passing this to X" scaffolding for a single self agent.
|
|
135
|
+
if (!askSelf) {
|
|
136
|
+
ws.sendPMMessage(taskId, {
|
|
137
|
+
sender: 'pm',
|
|
138
|
+
content: `Got it! Passing this to ${roleName}...`,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
129
141
|
return answer;
|
|
130
142
|
},
|
|
131
143
|
onLayerStart: async (layerIndex, totalLayers, subtaskIds) => {
|