blun-king-cli 9.1.288 → 9.1.289

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.
@@ -927,6 +927,7 @@ async function runLauncher(options = {}) {
927
927
  const mnemoConnect = startMnemoConnectHeartbeat({
928
928
  env,
929
929
  profileName: PROFILE.profileName,
930
+ mcpConfigPath: path.join(profilePaths.home, 'mcp.json'),
930
931
  version: readPackageVersion(),
931
932
  });
932
933
  try {
@@ -1,9 +1,11 @@
1
1
  'use strict';
2
2
 
3
+ const fs = require('node:fs');
3
4
  const os = require('node:os');
4
5
 
5
6
  const DEFAULT_HEARTBEAT_MS = 60_000;
6
7
  const DEFAULT_TIMEOUT_MS = 5_000;
8
+ const DEFAULT_INTERNAL_HUB_URL = 'http://100.85.21.103:7117';
7
9
 
8
10
  function resolveMnemoHubUrl(env = process.env) {
9
11
  const raw = [
@@ -32,6 +34,29 @@ function resolveMnemoAgentName(profileName, env = process.env) {
32
34
  return configured || String(profileName || '').trim();
33
35
  }
34
36
 
37
+ function resolveMnemoProfileConnectConfig(configPath) {
38
+ if (typeof configPath !== 'string' || configPath.trim().length === 0) return null;
39
+ try {
40
+ const stat = fs.statSync(configPath);
41
+ if (!stat.isFile() || stat.size > 1024 * 1024) return null;
42
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
43
+ const server = config?.mcpServers?.mnemo;
44
+ if (!server || server.enabled === false || !server.env || typeof server.env !== 'object') return null;
45
+ const agentName = String(server.env.BLUN_MNEMO_AGENT || server.env.MNEMO_AGENT || '').trim();
46
+ if (!agentName || /[\u0000-\u001f\u007f]/u.test(agentName) || agentName.length > 128) return null;
47
+ const configuredUrl = [
48
+ server.env.BLUN_MNEMO_HUB_URL,
49
+ server.env.MNEMO_HUB_URL,
50
+ server.env.MNEMO_URL,
51
+ ].some((value) => typeof value === 'string' && value.trim().length > 0);
52
+ const baseUrl = resolveMnemoHubUrl(server.env);
53
+ if (configuredUrl && !baseUrl) return null;
54
+ return { agentName, baseUrl: baseUrl || DEFAULT_INTERNAL_HUB_URL };
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+
35
60
  async function postMnemoTool(baseUrl, tool, payload, options = {}) {
36
61
  const controller = new AbortController();
37
62
  const timeout = (options.setTimeoutImpl || setTimeout)(
@@ -62,8 +87,14 @@ async function postMnemoTool(baseUrl, tool, payload, options = {}) {
62
87
 
63
88
  function startMnemoConnectHeartbeat(options = {}) {
64
89
  const env = options.env || process.env;
65
- const baseUrl = options.baseUrl || resolveMnemoHubUrl(env);
66
- const agentName = options.agentName || resolveMnemoAgentName(options.profileName, env);
90
+ const profileConfig = options.profileConfig
91
+ || resolveMnemoProfileConnectConfig(options.mcpConfigPath);
92
+ const baseUrl = options.baseUrl || resolveMnemoHubUrl(env) || profileConfig?.baseUrl;
93
+ const configuredAgentName = resolveMnemoAgentName('', env);
94
+ const agentName = options.agentName
95
+ || configuredAgentName
96
+ || profileConfig?.agentName
97
+ || resolveMnemoAgentName(options.profileName, {});
67
98
  if (!baseUrl || !agentName) {
68
99
  return Object.freeze({ enabled: false, ready: Promise.resolve(false), stop: async () => {} });
69
100
  }
@@ -165,9 +196,11 @@ function startMnemoConnectHeartbeat(options = {}) {
165
196
 
166
197
  module.exports = {
167
198
  DEFAULT_HEARTBEAT_MS,
199
+ DEFAULT_INTERNAL_HUB_URL,
168
200
  DEFAULT_TIMEOUT_MS,
169
201
  postMnemoTool,
170
202
  resolveMnemoAgentName,
171
203
  resolveMnemoHubUrl,
204
+ resolveMnemoProfileConnectConfig,
172
205
  startMnemoConnectHeartbeat,
173
206
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blun-king-cli",
3
- "version": "9.1.288",
3
+ "version": "9.1.289",
4
4
  "description": "BLUN CLI - your own AI agent with a Telegram channel. Get it done. With BLUN.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -56,6 +56,5 @@
56
56
  "dependencies": {
57
57
  "blun-king-cli": "^9.1.62",
58
58
  "node-addon-api": "^7.1.1"
59
- },
60
- "devDependencies": {}
59
+ }
61
60
  }