@ai-setting/roy-agent-core 1.5.31 → 1.5.32

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/env/index.js CHANGED
@@ -48,7 +48,7 @@ import"../shared/@ai-setting/roy-agent-core-92z6t4he.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
49
49
  import {
50
50
  McpComponent
51
- } from "../shared/@ai-setting/roy-agent-core-pjr12nnd.js";
51
+ } from "../shared/@ai-setting/roy-agent-core-7nwwzxf6.js";
52
52
  import"../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
53
53
  import"../shared/@ai-setting/roy-agent-core-1akcqxj9.js";
54
54
  import"../shared/@ai-setting/roy-agent-core-eajcvp4e.js";
@@ -8,7 +8,7 @@ import {
8
8
  McpServerLocalConfigSchema,
9
9
  McpServerRemoteConfigSchema,
10
10
  getMcpPathPriority
11
- } from "../../shared/@ai-setting/roy-agent-core-pjr12nnd.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-7nwwzxf6.js";
12
12
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
13
13
  import {
14
14
  adaptMcpTool,
package/dist/index.js CHANGED
@@ -134,7 +134,7 @@ import {
134
134
  import"./shared/@ai-setting/roy-agent-core-psvxt4c9.js";
135
135
  import {
136
136
  McpComponent
137
- } from "./shared/@ai-setting/roy-agent-core-pjr12nnd.js";
137
+ } from "./shared/@ai-setting/roy-agent-core-7nwwzxf6.js";
138
138
  import {
139
139
  AgentError,
140
140
  ComponentError,
@@ -222,10 +222,14 @@ class McpScanner {
222
222
 
223
223
  // src/env/mcp/loader.ts
224
224
  init_logger();
225
+ import fs2 from "fs/promises";
226
+ import path3 from "path";
227
+ import os2 from "os";
225
228
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
226
229
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
227
230
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
228
231
  var logger2 = createLogger("mcp-loader");
232
+ var AUTH_JSON_PATH = path3.join(os2.homedir(), ".roy-agent", "auth.json");
229
233
 
230
234
  class McpLoader {
231
235
  clients = new Map;
@@ -286,10 +290,12 @@ class McpLoader {
286
290
  let transport;
287
291
  if (config.type === "local") {
288
292
  const localConfig = config;
293
+ const env = { ...localConfig.environment };
294
+ await this.injectMinimaxEnv(env);
289
295
  transport = new StdioClientTransport({
290
296
  command: localConfig.command[0],
291
297
  args: localConfig.command.slice(1),
292
- env: localConfig.environment
298
+ env
293
299
  });
294
300
  client = new Client({ name, version: "1.0.0" });
295
301
  await client.connect(transport);
@@ -332,18 +338,38 @@ class McpLoader {
332
338
  isConnected(name) {
333
339
  return this.clients.has(name);
334
340
  }
341
+ async loadMinimaxApiKey() {
342
+ try {
343
+ const content = await fs2.readFile(AUTH_JSON_PATH, "utf-8");
344
+ const auth = JSON.parse(content);
345
+ return auth.providers?.minimax?.apiKey;
346
+ } catch (error) {
347
+ logger2.debug("[McpLoader] Failed to load minimax API key from auth.json", { error });
348
+ return;
349
+ }
350
+ }
351
+ async injectMinimaxEnv(env) {
352
+ if (env["MINIMAX_API_KEY"]) {
353
+ return;
354
+ }
355
+ const apiKey = await this.loadMinimaxApiKey();
356
+ if (apiKey) {
357
+ env["MINIMAX_API_KEY"] = apiKey;
358
+ env["MINIMAX_API_HOST"] = "https://api.minimaxi.com";
359
+ }
360
+ }
335
361
  }
336
362
 
337
363
  // src/env/mcp/mcp-config-registration.ts
338
- import path3 from "path";
339
- import os2 from "os";
364
+ import path4 from "path";
365
+ import os3 from "os";
340
366
  var MCP_DEFAULTS = {
341
367
  "mcp.enabled": true,
342
368
  "mcp.timeout": 30000,
343
369
  "mcp.mcpPaths": [
344
370
  {
345
371
  type: "user",
346
- path: path3.join(os2.homedir(), ".config", "roy-agent", "mcp")
372
+ path: path4.join(os3.homedir(), ".config", "roy-agent", "mcp")
347
373
  },
348
374
  {
349
375
  type: "project",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.31",
3
+ "version": "1.5.32",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",