tuna-agent 0.1.62 → 0.1.64
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.
|
@@ -883,7 +883,7 @@ export class ClaudeCodeAdapter {
|
|
|
883
883
|
try {
|
|
884
884
|
console.log(`[Self-Improve] Running pattern detection (every ${ClaudeCodeAdapter.PATTERN_CHECK_INTERVAL} tasks, count=${this.taskCount})`);
|
|
885
885
|
const { callMem0Patterns } = await import('../mcp/setup.js');
|
|
886
|
-
const patterns = await callMem0Patterns(this.currentAgentName,
|
|
886
|
+
const patterns = await callMem0Patterns(this.currentAgentName, 2);
|
|
887
887
|
if (patterns.length === 0) {
|
|
888
888
|
console.log(`[Self-Improve] No patterns detected yet`);
|
|
889
889
|
return;
|
package/dist/mcp/setup.js
CHANGED
|
@@ -68,7 +68,7 @@ export async function fetchMem0Count(agentName) {
|
|
|
68
68
|
export async function callMem0AddMemory(text, agentName) {
|
|
69
69
|
if (!MEM0_SSH_HOST && !MEM0_HTTP_BASE)
|
|
70
70
|
throw new Error('Mem0 not configured');
|
|
71
|
-
const safeAgentName = agentName.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
71
|
+
const safeAgentName = agentName.toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
72
72
|
// Try HTTP API first (OpenMemory) — stores in SQLite+Qdrant, shows up in counts
|
|
73
73
|
// Falls through to SSH+curl if HTTP is not reachable (e.g. port not exposed externally)
|
|
74
74
|
if (MEM0_HTTP_BASE && !MEM0_SSH_HOST) {
|
|
@@ -145,7 +145,7 @@ export async function callMem0SearchMemory(query, agentName, limit = 5) {
|
|
|
145
145
|
if (!MEM0_SSH_HOST)
|
|
146
146
|
return [];
|
|
147
147
|
const { execFile } = await import('child_process');
|
|
148
|
-
const safeAgentName = agentName.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
148
|
+
const safeAgentName = agentName.toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
149
149
|
return new Promise((resolve) => {
|
|
150
150
|
let cmd;
|
|
151
151
|
let args;
|
|
@@ -194,7 +194,7 @@ export async function callMem0Patterns(agentName, minCluster = 3) {
|
|
|
194
194
|
if (!MEM0_SSH_HOST)
|
|
195
195
|
return [];
|
|
196
196
|
const { execFile } = await import('child_process');
|
|
197
|
-
const safeAgentName = agentName.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
197
|
+
const safeAgentName = agentName.toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
198
198
|
const input = JSON.stringify({ user_id: safeAgentName, min_cluster: minCluster });
|
|
199
199
|
return new Promise((resolve) => {
|
|
200
200
|
let cmd;
|
|
@@ -318,7 +318,7 @@ function buildMem0McpConfig(agentName) {
|
|
|
318
318
|
if (!MEM0_SSH_HOST)
|
|
319
319
|
return null;
|
|
320
320
|
// Sanitize agent name for shell safety (replace non-alphanumeric with hyphens)
|
|
321
|
-
const safeAgentName = agentName.replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
321
|
+
const safeAgentName = agentName.toLowerCase().replace(/[^a-zA-Z0-9_-]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '') || 'agent';
|
|
322
322
|
const envWithUser = { ...MEM0_ENV_VARS, MEM0_USER_ID: safeAgentName };
|
|
323
323
|
if (MEM0_SSH_HOST === 'local') {
|
|
324
324
|
return {
|