tuna-agent 0.1.29 → 0.1.31
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.
|
@@ -48,6 +48,8 @@ export declare class ClaudeCodeAdapter implements AgentAdapter {
|
|
|
48
48
|
* Runs every N tasks to evolve the agent's permanent knowledge.
|
|
49
49
|
*/
|
|
50
50
|
runSelfImprovement(cwd: string): Promise<void>;
|
|
51
|
+
/** Track task completion metrics (public for daemon resume path). */
|
|
52
|
+
trackMetricsPublic(status: 'done' | 'failed', durationMs: number): void;
|
|
51
53
|
/** Track task completion metrics. */
|
|
52
54
|
private trackMetrics;
|
|
53
55
|
dispose(): Promise<void>;
|
|
@@ -274,6 +274,12 @@ export class ClaudeCodeAdapter {
|
|
|
274
274
|
if (err instanceof Error && err.message === '__FOLLOW_UP_TIMEOUT__') {
|
|
275
275
|
console.log(`[ClaudeCode] No follow-up after ${FOLLOW_UP_TIMEOUT_MS / 1000}s — closing task`);
|
|
276
276
|
pendingInputResolvers.delete(task.id);
|
|
277
|
+
ws.sendTaskDone(task.id, {
|
|
278
|
+
result: 'Agent Team task completed',
|
|
279
|
+
durationMs: totalDurationMs,
|
|
280
|
+
sessionId,
|
|
281
|
+
});
|
|
282
|
+
this.trackMetrics('done', totalDurationMs);
|
|
277
283
|
const timeoutOutput = lastTaskOutput || 'Task completed (no follow-up)';
|
|
278
284
|
this.runReflection(task, timeoutOutput, 'done', task.repoPath)
|
|
279
285
|
.then(() => this.runSelfImprovement(task.repoPath))
|
|
@@ -812,6 +818,10 @@ export class ClaudeCodeAdapter {
|
|
|
812
818
|
console.warn(`[Self-Improve] Failed:`, err instanceof Error ? err.message : err);
|
|
813
819
|
}
|
|
814
820
|
}
|
|
821
|
+
/** Track task completion metrics (public for daemon resume path). */
|
|
822
|
+
trackMetricsPublic(status, durationMs) {
|
|
823
|
+
this.trackMetrics(status, durationMs);
|
|
824
|
+
}
|
|
815
825
|
/** Track task completion metrics. */
|
|
816
826
|
trackMetrics(status, durationMs) {
|
|
817
827
|
this.metrics.taskCount++;
|
package/dist/daemon/index.js
CHANGED
|
@@ -616,6 +616,7 @@ ${skillContent.slice(0, 15000)}`;
|
|
|
616
616
|
wsClient.sendProgress(taskId, 'executing', { startedAt: new Date().toISOString() });
|
|
617
617
|
const cwd = savedState.repoPath;
|
|
618
618
|
const MAX_RESUMED_ROUNDS = 50;
|
|
619
|
+
let lastResumeOutput = '';
|
|
619
620
|
for (let round = 0; round < MAX_RESUMED_ROUNDS; round++) {
|
|
620
621
|
let streamMsgId = `team-resume-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
621
622
|
let firstChunkIso = '';
|
|
@@ -677,6 +678,7 @@ ${skillContent.slice(0, 15000)}`;
|
|
|
677
678
|
startedAt: firstChunkIso || undefined,
|
|
678
679
|
});
|
|
679
680
|
}
|
|
681
|
+
lastResumeOutput = turnAccumulatedText.trim() || lastResumeOutput;
|
|
680
682
|
if (result.isError) {
|
|
681
683
|
wsClient.sendTaskFailed(taskId, result.result);
|
|
682
684
|
return;
|
|
@@ -708,6 +710,17 @@ ${skillContent.slice(0, 15000)}`;
|
|
|
708
710
|
if (err instanceof Error && err.message === '__FOLLOW_UP_TIMEOUT__') {
|
|
709
711
|
console.log(`[Daemon] Resumed agent_team: no follow-up after 60s — closing`);
|
|
710
712
|
resolvers.delete(taskId);
|
|
713
|
+
wsClient.sendTaskDone(taskId, {
|
|
714
|
+
result: 'Resumed agent team task completed',
|
|
715
|
+
durationMs: totalDurationMs,
|
|
716
|
+
sessionId,
|
|
717
|
+
});
|
|
718
|
+
// Track metrics + reflection on the adapter
|
|
719
|
+
if (adapter.type === 'claude-code') {
|
|
720
|
+
const ccAdapter = adapter;
|
|
721
|
+
ccAdapter.trackMetricsPublic('done', totalDurationMs);
|
|
722
|
+
ccAdapter.runReflection({ id: taskId, description: firstMessage, repoPath: cwd, enableReflection: true }, lastResumeOutput || 'Task completed (no follow-up)', 'done', cwd).then(() => ccAdapter.runSelfImprovement(cwd)).catch(() => { });
|
|
723
|
+
}
|
|
711
724
|
return;
|
|
712
725
|
}
|
|
713
726
|
throw err;
|