tuna-agent 0.1.91 → 0.1.93
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.
|
@@ -321,6 +321,16 @@ export class ClaudeCodeAdapter {
|
|
|
321
321
|
sessionId = result.sessionId || sessionId;
|
|
322
322
|
totalDurationMs += result.durationMs || 0;
|
|
323
323
|
if (result.isError) {
|
|
324
|
+
// Save state so user can retry by sending a message to the failed task
|
|
325
|
+
savePMState({
|
|
326
|
+
taskId: task.id,
|
|
327
|
+
pmSessionId: '',
|
|
328
|
+
repoPath: cwd,
|
|
329
|
+
savedAt: new Date().toISOString(),
|
|
330
|
+
mode: 'agent_team',
|
|
331
|
+
agentTeamSessionId: sessionId,
|
|
332
|
+
agentId: task.agentId,
|
|
333
|
+
});
|
|
324
334
|
ws.sendPMMessage(task.id, {
|
|
325
335
|
sender: 'pm',
|
|
326
336
|
content: simplifyMarkdown(result.result),
|
|
@@ -332,14 +342,17 @@ export class ClaudeCodeAdapter {
|
|
|
332
342
|
this.runReflection(task, result.result, 'failed', cwd).catch(() => { });
|
|
333
343
|
return;
|
|
334
344
|
}
|
|
335
|
-
// Track last output for reflection
|
|
336
|
-
lastTaskOutput = turnAccumulatedText.trim();
|
|
345
|
+
// Track last output for reflection (fallback to result.result if no streaming text)
|
|
346
|
+
lastTaskOutput = turnAccumulatedText.trim() || result.result;
|
|
337
347
|
if (lastTaskOutput) {
|
|
338
348
|
console.log(`[Reflection] Captured ${lastTaskOutput.length} chars of task output for reflection`);
|
|
339
349
|
}
|
|
340
350
|
// Send finalized message for the last turn's remaining text (skip if duplicate)
|
|
341
|
-
if (
|
|
342
|
-
|
|
351
|
+
// Fallback: if no streaming deltas were captured (e.g. agent_team mode may emit
|
|
352
|
+
// complete assistant messages instead of stream_event deltas), use result.result
|
|
353
|
+
const finalText = turnAccumulatedText.trim() || result.result;
|
|
354
|
+
if (finalText) {
|
|
355
|
+
const simplified = simplifyMarkdown(finalText);
|
|
343
356
|
if (!isSimilar(simplified, lastSentContent)) {
|
|
344
357
|
ws.sendPMMessage(task.id, {
|
|
345
358
|
sender: 'pm',
|