tuna-agent 0.1.30 → 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>;
|
|
@@ -818,6 +818,10 @@ export class ClaudeCodeAdapter {
|
|
|
818
818
|
console.warn(`[Self-Improve] Failed:`, err instanceof Error ? err.message : err);
|
|
819
819
|
}
|
|
820
820
|
}
|
|
821
|
+
/** Track task completion metrics (public for daemon resume path). */
|
|
822
|
+
trackMetricsPublic(status, durationMs) {
|
|
823
|
+
this.trackMetrics(status, durationMs);
|
|
824
|
+
}
|
|
821
825
|
/** Track task completion metrics. */
|
|
822
826
|
trackMetrics(status, durationMs) {
|
|
823
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;
|