tuna-agent 0.1.15 → 0.1.17
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.
|
@@ -233,6 +233,7 @@ export class ClaudeCodeAdapter {
|
|
|
233
233
|
if (err instanceof Error && err.message === '__FOLLOW_UP_TIMEOUT__') {
|
|
234
234
|
console.log(`[ClaudeCode] No follow-up after ${FOLLOW_UP_TIMEOUT_MS / 1000}s — closing task`);
|
|
235
235
|
pendingInputResolvers.delete(task.id);
|
|
236
|
+
this.runReflection(task, 'Agent Team task completed (no follow-up)', 'done', task.repoPath).catch(() => { });
|
|
236
237
|
return;
|
|
237
238
|
}
|
|
238
239
|
throw err;
|
|
@@ -651,37 +652,21 @@ export class ClaudeCodeAdapter {
|
|
|
651
652
|
if (task.enableReflection === false)
|
|
652
653
|
return;
|
|
653
654
|
if (!process.env.MEM0_SSH_HOST)
|
|
654
|
-
return;
|
|
655
|
-
// Skip trivial tasks (< 30s would have no meaningful reflection)
|
|
655
|
+
return;
|
|
656
656
|
const MIN_DESCRIPTION_LENGTH = 20;
|
|
657
657
|
if (task.description.length < MIN_DESCRIPTION_LENGTH)
|
|
658
658
|
return;
|
|
659
|
-
const
|
|
660
|
-
const
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
Task: ${truncatedDesc}
|
|
664
|
-
Status: ${status}
|
|
665
|
-
Result summary: ${truncatedResult}
|
|
666
|
-
|
|
667
|
-
Instructions:
|
|
668
|
-
1. Think about what went well and what could be improved (2-3 sentences max)
|
|
669
|
-
2. Call the mem0 add_memory tool to store your reflection
|
|
670
|
-
3. Do NOT do anything else — no file edits, no other tool calls`;
|
|
659
|
+
const taskContext = task.description.substring(0, 150);
|
|
660
|
+
const resultContext = resultSummary.substring(0, 200);
|
|
661
|
+
const statusLabel = status === 'done' ? 'COMPLETED' : 'FAILED';
|
|
662
|
+
const memoryText = `[TASK ${statusLabel}] "${taskContext}". Result: ${resultContext}`;
|
|
671
663
|
try {
|
|
672
|
-
console.log(`[Reflection]
|
|
673
|
-
await
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
maxTurns: 3,
|
|
677
|
-
outputFormat: 'json',
|
|
678
|
-
timeoutMs: 30000,
|
|
679
|
-
permissionMode: 'bypassPermissions',
|
|
680
|
-
});
|
|
681
|
-
console.log(`[Reflection] Reflection complete for task ${task.id}`);
|
|
664
|
+
console.log(`[Reflection] Storing reflection for task ${task.id} (${status})`);
|
|
665
|
+
const { callMem0AddMemory } = await import('../mcp/setup.js');
|
|
666
|
+
await callMem0AddMemory(memoryText, this.agentConfig.name);
|
|
667
|
+
console.log(`[Reflection] Reflection stored for task ${task.id}`);
|
|
682
668
|
}
|
|
683
669
|
catch (err) {
|
|
684
|
-
// Non-fatal — don't let reflection failure affect task flow
|
|
685
670
|
console.warn(`[Reflection] Failed for task ${task.id}:`, err instanceof Error ? err.message : err);
|
|
686
671
|
}
|
|
687
672
|
}
|