tuna-agent 0.1.57 → 0.1.59

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.
@@ -43,6 +43,8 @@ export declare class ClaudeCodeAdapter implements AgentAdapter {
43
43
  getMetrics(): Record<string, unknown>;
44
44
  /** Register an agent folder path for rules parsing (called from daemon). */
45
45
  registerAgentFolder(agentId: string, folderPath: string): void;
46
+ /** Seed memoryCount from Mem0 for all registered agents (called once on daemon startup). */
47
+ seedMemoryCounts(): Promise<void>;
46
48
  checkHealth(): Promise<{
47
49
  ok: boolean;
48
50
  message: string;
@@ -57,6 +57,7 @@ export class ClaudeCodeAdapter {
57
57
  this.currentAgentId = savedId;
58
58
  });
59
59
  const agentMetricsMap = {};
60
+ // Include agents from metricsMap
60
61
  this.metricsMap.forEach((m, agentId) => {
61
62
  const entry = { ...m };
62
63
  const rules = this.learnedRulesMap.get(agentId);
@@ -65,12 +66,37 @@ export class ClaudeCodeAdapter {
65
66
  }
66
67
  agentMetricsMap[agentId] = entry;
67
68
  });
69
+ // Include agents that have rules but no metrics yet (no task dispatched since restart)
70
+ this.learnedRulesMap.forEach((rules, agentId) => {
71
+ if (!agentMetricsMap[agentId] && rules.length > 0) {
72
+ agentMetricsMap[agentId] = { learnedRules: rules, rulesCount: rules.length };
73
+ }
74
+ });
68
75
  return { agentMetricsMap };
69
76
  }
70
77
  /** Register an agent folder path for rules parsing (called from daemon). */
71
78
  registerAgentFolder(agentId, folderPath) {
72
79
  this.agentFolderMap.set(agentId, folderPath);
73
80
  }
81
+ /** Seed memoryCount from Mem0 for all registered agents (called once on daemon startup). */
82
+ async seedMemoryCounts() {
83
+ for (const [agentId, folder] of this.agentFolderMap) {
84
+ const agentName = path.basename(folder);
85
+ try {
86
+ const count = await fetchMem0Count(agentName);
87
+ if (count > 0) {
88
+ const savedId = this.currentAgentId;
89
+ this.currentAgentId = agentId;
90
+ if (count > this.metrics.memoryCount) {
91
+ this.metrics.memoryCount = count;
92
+ }
93
+ this.currentAgentId = savedId;
94
+ console.log(`[Metrics] Seeded memoryCount=${count} for "${agentName}"`);
95
+ }
96
+ }
97
+ catch { /* ignore */ }
98
+ }
99
+ }
74
100
  async checkHealth() {
75
101
  try {
76
102
  execSync('which claude', { stdio: 'ignore' });
@@ -193,6 +193,8 @@ export async function startDaemon(config) {
193
193
  }
194
194
  }
195
195
  console.log(`[Daemon] Registered ${msg.agentFolders.length} agent folder(s) for rules sync`);
196
+ // Seed memory counts from Mem0 so they appear on agent detail immediately
197
+ ccAdapter.seedMemoryCounts().catch(() => { });
196
198
  }
197
199
  // Recover orphaned tasks — pass activeTaskId so API won't fail a task we're still running
198
200
  ws.send({ action: 'recover_orphaned_tasks', activeTaskId: currentTaskId ?? undefined });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.57",
3
+ "version": "0.1.59",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"