tuna-agent 0.1.23 → 0.1.24
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.
|
@@ -83,6 +83,7 @@ export class ClaudeCodeAdapter {
|
|
|
83
83
|
console.warn(`[Mem0 Recall] Failed:`, err instanceof Error ? err.message : err);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
|
+
let lastTaskOutput = ''; // Track last output for reflection
|
|
86
87
|
try {
|
|
87
88
|
for (let round = 0; round < MAX_ROUNDS; round++) {
|
|
88
89
|
let streamMsgId = `team-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
@@ -203,6 +204,8 @@ export class ClaudeCodeAdapter {
|
|
|
203
204
|
this.runReflection(task, result.result, 'failed', cwd).catch(() => { });
|
|
204
205
|
return;
|
|
205
206
|
}
|
|
207
|
+
// Track last output for reflection
|
|
208
|
+
lastTaskOutput = turnAccumulatedText.trim();
|
|
206
209
|
// Send finalized message for the last turn's remaining text
|
|
207
210
|
if (turnAccumulatedText.trim()) {
|
|
208
211
|
ws.sendPMMessage(task.id, {
|
|
@@ -248,7 +251,8 @@ export class ClaudeCodeAdapter {
|
|
|
248
251
|
if (err instanceof Error && err.message === '__FOLLOW_UP_TIMEOUT__') {
|
|
249
252
|
console.log(`[ClaudeCode] No follow-up after ${FOLLOW_UP_TIMEOUT_MS / 1000}s — closing task`);
|
|
250
253
|
pendingInputResolvers.delete(task.id);
|
|
251
|
-
|
|
254
|
+
const timeoutOutput = lastTaskOutput || 'Task completed (no follow-up)';
|
|
255
|
+
this.runReflection(task, timeoutOutput, 'done', task.repoPath).catch(() => { });
|
|
252
256
|
return;
|
|
253
257
|
}
|
|
254
258
|
throw err;
|
|
@@ -279,8 +283,8 @@ export class ClaudeCodeAdapter {
|
|
|
279
283
|
await new Promise(resolve => setTimeout(resolve, 150));
|
|
280
284
|
ws.sendPMMessage(task.id, { sender: 'pm', content: 'Task completed.' });
|
|
281
285
|
console.log(`[ClaudeCode] Agent Team task ${task.id} completed (${(totalDurationMs / 1000).toFixed(1)}s)`);
|
|
282
|
-
// Post-task reflection (non-blocking
|
|
283
|
-
this.runReflection(task, '
|
|
286
|
+
// Post-task reflection with actual output (non-blocking)
|
|
287
|
+
this.runReflection(task, lastTaskOutput || 'Task completed without text output', 'done', task.repoPath).catch(() => { });
|
|
284
288
|
}
|
|
285
289
|
finally {
|
|
286
290
|
cleanupAttachments(task.id);
|