tuna-agent 0.1.17 → 0.1.19
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.
- package/dist/mcp/setup.js +13 -4
- package/package.json +1 -1
package/dist/mcp/setup.js
CHANGED
|
@@ -54,7 +54,7 @@ export async function callMem0AddMemory(text, agentName) {
|
|
|
54
54
|
resolved = true;
|
|
55
55
|
proc.kill();
|
|
56
56
|
reject(new Error('Mem0 call timed out'));
|
|
57
|
-
} },
|
|
57
|
+
} }, 30000);
|
|
58
58
|
proc.stderr.on('data', () => { }); // ignore stderr
|
|
59
59
|
const initMsg = JSON.stringify({ jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'tuna-agent', version: '1.0' } } });
|
|
60
60
|
const notifyMsg = JSON.stringify({ jsonrpc: '2.0', method: 'notifications/initialized' });
|
|
@@ -75,17 +75,26 @@ export async function callMem0AddMemory(text, agentName) {
|
|
|
75
75
|
clearTimeout(timer);
|
|
76
76
|
proc.stdin.end();
|
|
77
77
|
proc.kill();
|
|
78
|
-
|
|
78
|
+
// Check if the response contains an error
|
|
79
|
+
const hasError = stdout.includes('"isError":true') || stdout.includes('"error"');
|
|
80
|
+
if (hasError) {
|
|
81
|
+
// Extract error message from response
|
|
82
|
+
const errMatch = stdout.match(/"text"\s*:\s*"([^"]+)"/);
|
|
83
|
+
reject(new Error(`Mem0 add_memory failed: ${errMatch?.[1] || 'unknown error'}`));
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
resolve();
|
|
87
|
+
}
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
90
|
});
|
|
82
91
|
// Send init immediately
|
|
83
92
|
proc.stdin.write(initMsg + '\n');
|
|
84
|
-
proc.on('close', () => {
|
|
93
|
+
proc.on('close', (code) => {
|
|
85
94
|
if (!resolved) {
|
|
86
95
|
resolved = true;
|
|
87
96
|
clearTimeout(timer);
|
|
88
|
-
|
|
97
|
+
reject(new Error(`Mem0 process exited (code ${code}) without completing add_memory. stdout: ${stdout.substring(0, 300)}`));
|
|
89
98
|
}
|
|
90
99
|
});
|
|
91
100
|
proc.on('error', (err) => {
|