tuna-agent 0.1.23 → 0.1.25

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,11 @@ 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();
209
+ if (lastTaskOutput) {
210
+ console.log(`[Reflection] Captured ${lastTaskOutput.length} chars of task output for reflection`);
211
+ }
206
212
  // Send finalized message for the last turn's remaining text
207
213
  if (turnAccumulatedText.trim()) {
208
214
  ws.sendPMMessage(task.id, {
@@ -248,7 +254,8 @@ export class ClaudeCodeAdapter {
248
254
  if (err instanceof Error && err.message === '__FOLLOW_UP_TIMEOUT__') {
249
255
  console.log(`[ClaudeCode] No follow-up after ${FOLLOW_UP_TIMEOUT_MS / 1000}s — closing task`);
250
256
  pendingInputResolvers.delete(task.id);
251
- this.runReflection(task, 'Agent Team task completed (no follow-up)', 'done', task.repoPath).catch(() => { });
257
+ const timeoutOutput = lastTaskOutput || 'Task completed (no follow-up)';
258
+ this.runReflection(task, timeoutOutput, 'done', task.repoPath).catch(() => { });
252
259
  return;
253
260
  }
254
261
  throw err;
@@ -279,8 +286,8 @@ export class ClaudeCodeAdapter {
279
286
  await new Promise(resolve => setTimeout(resolve, 150));
280
287
  ws.sendPMMessage(task.id, { sender: 'pm', content: 'Task completed.' });
281
288
  console.log(`[ClaudeCode] Agent Team task ${task.id} completed (${(totalDurationMs / 1000).toFixed(1)}s)`);
282
- // Post-task reflection (non-blocking — runs after task is marked done)
283
- this.runReflection(task, 'Agent Team task completed', 'done', task.repoPath).catch(() => { });
289
+ // Post-task reflection with actual output (non-blocking)
290
+ this.runReflection(task, lastTaskOutput || 'Task completed without text output', 'done', task.repoPath).catch(() => { });
284
291
  }
285
292
  finally {
286
293
  cleanupAttachments(task.id);
@@ -673,7 +680,7 @@ export class ClaudeCodeAdapter {
673
680
  return;
674
681
  try {
675
682
  // Step 1: Generate AI-powered reflection via Ollama
676
- console.log(`[Reflection] Generating AI reflection for task ${task.id} (${status})`);
683
+ console.log(`[Reflection] Generating AI reflection for task ${task.id} (${status}), input: ${resultSummary.substring(0, 150)}...`);
677
684
  const { callMem0Reflect, callMem0AddMemory } = await import('../mcp/setup.js');
678
685
  const aiReflection = await callMem0Reflect(task.description, resultSummary, status);
679
686
  if (!aiReflection) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.23",
3
+ "version": "0.1.25",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"