tuna-agent 0.1.102 → 0.1.103

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.
@@ -11,7 +11,7 @@
11
11
  function parseArgs() {
12
12
  const args = process.argv.slice(2);
13
13
  let apiUrl = '';
14
- let token = '';
14
+ let token = process.env.TUNA_AGENT_TOKEN || '';
15
15
  let agentId = '';
16
16
  for (let i = 0; i < args.length; i++) {
17
17
  if (args[i] === '--api-url' && args[i + 1])
@@ -22,7 +22,8 @@ function parseArgs() {
22
22
  agentId = args[++i];
23
23
  }
24
24
  if (!apiUrl || !token || !agentId) {
25
- process.stderr.write('Usage: idea-server --api-url URL --token TOKEN --agent-id ID\n');
25
+ process.stderr.write('Usage: idea-server --api-url URL [--token TOKEN] --agent-id ID\n');
26
+ process.stderr.write('Token can also be set via TUNA_AGENT_TOKEN env var\n');
26
27
  process.exit(1);
27
28
  }
28
29
  return { apiUrl, token, agentId };
@@ -11,7 +11,7 @@
11
11
  function parseArgs() {
12
12
  const args = process.argv.slice(2);
13
13
  let apiUrl = '';
14
- let token = '';
14
+ let token = process.env.TUNA_AGENT_TOKEN || '';
15
15
  let agentId = '';
16
16
  for (let i = 0; i < args.length; i++) {
17
17
  if (args[i] === '--api-url' && args[i + 1])
@@ -22,7 +22,8 @@ function parseArgs() {
22
22
  agentId = args[++i];
23
23
  }
24
24
  if (!apiUrl || !token || !agentId) {
25
- process.stderr.write('Usage: knowledge-server --api-url URL --token TOKEN --agent-id ID\n');
25
+ process.stderr.write('Usage: knowledge-server --api-url URL [--token TOKEN] --agent-id ID\n');
26
+ process.stderr.write('Token can also be set via TUNA_AGENT_TOKEN env var\n');
26
27
  process.exit(1);
27
28
  }
28
29
  return { apiUrl, token, agentId };
package/dist/mcp/setup.js CHANGED
@@ -7,20 +7,20 @@ const MCP_CONFIG_DIR = path.join(process.env.HOME || '', '.tuna-agent');
7
7
  const MCP_CONFIG_PATH = path.join(MCP_CONFIG_DIR, 'mcp-config.json');
8
8
  // Mem0 config from environment variables
9
9
  // MEM0_SSH_HOST: "local" = run mem0-mcp directly, "user@host" = run via SSH, unset = disabled
10
- // MEM0_HTTP_BASE: HTTP base URL of OpenMemory API (e.g. http://redrop.ddns.net:8765)
10
+ // MEM0_HTTP_BASE: HTTP base URL of OpenMemory API (e.g. http://your-mem0-host:8765)
11
11
  const MEM0_SSH_HOST = process.env.MEM0_SSH_HOST;
12
12
  const MEM0_SSH_PORT = process.env.MEM0_SSH_PORT || '22';
13
13
  const MEM0_SSH_KEY = process.env.MEM0_SSH_KEY;
14
14
  const MEM0_HTTP_BASE = process.env.MEM0_HTTP_BASE || '';
15
15
  const MEM0_ENV_VARS = {
16
- MEM0_API_BASE: 'http://127.0.0.1:8765',
17
- MEM0_QDRANT_URL: 'http://127.0.0.1:6333',
18
- MEM0_OLLAMA_URL: 'http://127.0.0.1:11434',
19
- MEM0_EMBED_MODEL: 'mxbai-embed-large:latest',
20
- MEM0_COLLECTION: 'openmemory',
21
- MEM0_NEO4J_URL: 'bolt://127.0.0.1:7687',
22
- MEM0_NEO4J_USER: 'neo4j',
23
- MEM0_NEO4J_PASSWORD: 'mem0graph',
16
+ MEM0_API_BASE: process.env.MEM0_API_BASE || 'http://127.0.0.1:8765',
17
+ MEM0_QDRANT_URL: process.env.MEM0_QDRANT_URL || 'http://127.0.0.1:6333',
18
+ MEM0_OLLAMA_URL: process.env.MEM0_OLLAMA_URL || 'http://127.0.0.1:11434',
19
+ MEM0_EMBED_MODEL: process.env.MEM0_EMBED_MODEL || 'mxbai-embed-large:latest',
20
+ MEM0_COLLECTION: process.env.MEM0_COLLECTION || 'openmemory',
21
+ MEM0_NEO4J_URL: process.env.MEM0_NEO4J_URL || 'bolt://127.0.0.1:7687',
22
+ MEM0_NEO4J_USER: process.env.MEM0_NEO4J_USER || 'neo4j',
23
+ MEM0_NEO4J_PASSWORD: process.env.MEM0_NEO4J_PASSWORD || '',
24
24
  };
25
25
  /**
26
26
  * Fetch Mem0 memory count for an agent via HTTP API.
@@ -34,7 +34,7 @@ export async function fetchMem0Count(agentName) {
34
34
  try {
35
35
  const { execFile } = await import('child_process');
36
36
  const remoteCmd = `curl -s 'http://127.0.0.1:8765/api/v1/memories/?user_id=${safeName}&page=1&page_size=1'`;
37
- const args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=no', MEM0_SSH_HOST, remoteCmd];
37
+ const args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=accept-new', MEM0_SSH_HOST, remoteCmd];
38
38
  const stdout = await new Promise((res, rej) => {
39
39
  execFile('ssh', args, { timeout: 8000 }, (err, out) => err ? rej(err) : res(out));
40
40
  });
@@ -148,7 +148,7 @@ export async function callMem0AddMemory(text, agentName) {
148
148
  else {
149
149
  // Remote mode: SSH then curl to localhost on remote
150
150
  cmd = 'ssh';
151
- args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=no'];
151
+ args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=accept-new'];
152
152
  if (MEM0_SSH_KEY)
153
153
  args.push('-i', MEM0_SSH_KEY);
154
154
  args.push(MEM0_SSH_HOST, `curl -s -X POST http://127.0.0.1:8765/api/v1/memories/ -H 'Content-Type: application/json' -d '${escapedPayload}'`);
@@ -194,7 +194,7 @@ export async function callMem0SearchMemory(query, agentName, limit = 5) {
194
194
  }
195
195
  else {
196
196
  cmd = 'ssh';
197
- args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=no'];
197
+ args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=accept-new'];
198
198
  if (MEM0_SSH_KEY)
199
199
  args.push('-i', MEM0_SSH_KEY);
200
200
  const escapedQuery = query.replace(/'/g, "'\\''");
@@ -244,7 +244,7 @@ export async function callMem0Patterns(agentName, minCluster = 3) {
244
244
  }
245
245
  else {
246
246
  cmd = 'ssh';
247
- args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=no'];
247
+ args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=accept-new'];
248
248
  if (MEM0_SSH_KEY)
249
249
  args.push('-i', MEM0_SSH_KEY);
250
250
  args.push(MEM0_SSH_HOST, 'mem0-patterns');
@@ -365,7 +365,7 @@ function buildMem0McpConfig(agentName) {
365
365
  };
366
366
  }
367
367
  const envString = Object.entries(envWithUser).map(([k, v]) => `${k}=${v}`).join(' ');
368
- const args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=no'];
368
+ const args = ['-p', MEM0_SSH_PORT, '-o', 'StrictHostKeyChecking=accept-new'];
369
369
  if (MEM0_SSH_KEY) {
370
370
  args.push('-i', MEM0_SSH_KEY);
371
371
  }
@@ -382,22 +382,22 @@ export function setupMcpConfig(config) {
382
382
  const browserServerPath = path.join(__dirname, 'browser-server.js');
383
383
  const mcpServers = {
384
384
  'tuna-knowledge': {
385
- command: process.execPath, // full path to current node binary
385
+ command: process.execPath,
386
386
  args: [
387
387
  knowledgeServerPath,
388
388
  '--api-url', config.apiUrl,
389
- '--token', config.agentToken,
390
389
  '--agent-id', config.agentId,
391
390
  ],
391
+ env: { TUNA_AGENT_TOKEN: config.agentToken },
392
392
  },
393
393
  'tuna-idea': {
394
394
  command: process.execPath,
395
395
  args: [
396
396
  ideaServerPath,
397
397
  '--api-url', config.apiUrl,
398
- '--token', config.agentToken,
399
398
  '--agent-id', config.agentId,
400
399
  ],
400
+ env: { TUNA_AGENT_TOKEN: config.agentToken },
401
401
  },
402
402
  'tuna-browser': {
403
403
  command: process.execPath,
@@ -452,18 +452,18 @@ export function writeAgentFolderMcpConfig(agentFolderPath, config, agentId) {
452
452
  args: [
453
453
  knowledgeServerPath,
454
454
  '--api-url', config.apiUrl,
455
- '--token', config.agentToken,
456
455
  '--agent-id', mcpAgentId,
457
456
  ],
457
+ env: { TUNA_AGENT_TOKEN: config.agentToken },
458
458
  },
459
459
  'tuna-idea': {
460
460
  command: process.execPath,
461
461
  args: [
462
462
  ideaServerPath,
463
463
  '--api-url', config.apiUrl,
464
- '--token', config.agentToken,
465
464
  '--agent-id', mcpAgentId,
466
465
  ],
466
+ env: { TUNA_AGENT_TOKEN: config.agentToken },
467
467
  },
468
468
  'tuna-browser': {
469
469
  command: process.execPath,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuna-agent",
3
- "version": "0.1.102",
3
+ "version": "0.1.103",
4
4
  "description": "Tuna Agent - Run AI coding tasks on your machine",
5
5
  "bin": {
6
6
  "tuna-agent": "dist/cli/index.js"