@ai-setting/roy-agent-core 1.5.45 → 1.5.47

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.
Files changed (26) hide show
  1. package/dist/env/agent/index.js +3 -3
  2. package/dist/env/index.js +15 -14
  3. package/dist/env/mcp/index.js +7 -5
  4. package/dist/env/mcp/npm-prefix/index.js +21 -0
  5. package/dist/env/memory/index.js +4 -4
  6. package/dist/env/session/index.js +7 -7
  7. package/dist/env/task/delegate/index.js +2 -2
  8. package/dist/env/task/index.js +6 -6
  9. package/dist/env/workflow/engine/index.js +5 -5
  10. package/dist/env/workflow/index.js +19 -19
  11. package/dist/index.js +26 -25
  12. package/dist/shared/@ai-setting/{roy-agent-core-nn9dmffw.js → roy-agent-core-1rzpnycm.js} +113 -16
  13. package/dist/shared/@ai-setting/{roy-agent-core-cr8xer31.js → roy-agent-core-1t5esk1r.js} +3 -3
  14. package/dist/shared/@ai-setting/{roy-agent-core-44g4dhzg.js → roy-agent-core-2rtka82a.js} +4 -4
  15. package/dist/shared/@ai-setting/{roy-agent-core-9p604xjf.js → roy-agent-core-38sc085e.js} +8 -10
  16. package/dist/shared/@ai-setting/{roy-agent-core-r9hq4cjx.js → roy-agent-core-a23brrex.js} +61 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-68qy97r3.js → roy-agent-core-ebap34m2.js} +6 -1
  18. package/dist/shared/@ai-setting/{roy-agent-core-fg3j215p.js → roy-agent-core-emk3q2nt.js} +24 -3
  19. package/dist/shared/@ai-setting/roy-agent-core-fnv3ev18.js +61 -0
  20. package/dist/shared/@ai-setting/{roy-agent-core-8y804aat.js → roy-agent-core-jqq7c2rk.js} +34 -5
  21. package/dist/shared/@ai-setting/{roy-agent-core-dbxm76wf.js → roy-agent-core-kzbj10gk.js} +10 -3
  22. package/dist/shared/@ai-setting/{roy-agent-core-bp3xggmb.js → roy-agent-core-pm73be85.js} +32 -90
  23. package/dist/shared/@ai-setting/{roy-agent-core-w64zachx.js → roy-agent-core-t1ytby5n.js} +4 -4
  24. package/dist/shared/@ai-setting/{roy-agent-core-ye0z728h.js → roy-agent-core-twd8kzag.js} +3 -2
  25. package/package.json +1 -1
  26. package/dist/shared/@ai-setting/{roy-agent-core-ce9w0j8n.js → roy-agent-core-pyv1vb7v.js} +4 -4
@@ -2,6 +2,10 @@ import {
2
2
  ComponentError,
3
3
  ErrorCodes
4
4
  } from "./roy-agent-core-ctdhjv68.js";
5
+ import {
6
+ ensureFallbackNpmPrefix,
7
+ isUsableNpmPrefix
8
+ } from "./roy-agent-core-fnv3ev18.js";
5
9
  import {
6
10
  adaptMcpTool
7
11
  } from "./roy-agent-core-1bfmxx89.js";
@@ -85,18 +89,13 @@ init_logger();
85
89
 
86
90
  // src/env/mcp/scanner.ts
87
91
  init_logger();
88
- import fs3 from "fs/promises";
89
- import path4 from "path";
90
-
91
- // src/env/mcp/command-resolver.ts
92
- import fs2 from "fs";
92
+ import fs2 from "fs/promises";
93
93
  import path3 from "path";
94
94
 
95
- // src/env/mcp/npm-prefix.ts
95
+ // src/env/mcp/command-resolver.ts
96
96
  import fs from "fs";
97
- import { execSync } from "child_process";
98
- import os2 from "os";
99
97
  import path2 from "path";
98
+ var PACKAGE_RUNNERS = new Set(["npx", "npm", "bunx", "yarn"]);
100
99
  function pathExistsSync(p) {
101
100
  try {
102
101
  fs.accessSync(p, fs.constants.F_OK);
@@ -105,68 +104,11 @@ function pathExistsSync(p) {
105
104
  return false;
106
105
  }
107
106
  }
108
- function getFallbackNpmPrefixPath() {
109
- return path2.join(os2.homedir(), ".local", "share", "roy-agent", "npm-prefix");
110
- }
111
- function isUsableNpmPrefix(prefix) {
112
- return pathExistsSync(path2.join(prefix, "lib")) || pathExistsSync(path2.join(prefix, "bin"));
113
- }
114
- function ensureNpmPrefixDirs(prefix) {
115
- fs.mkdirSync(path2.join(prefix, "lib"), { recursive: true });
116
- fs.mkdirSync(path2.join(prefix, "bin"), { recursive: true });
117
- }
118
- function ensureFallbackNpmPrefix() {
119
- const fallback = getFallbackNpmPrefixPath();
120
- ensureNpmPrefixDirs(fallback);
121
- return fallback;
122
- }
123
- function readNpmConfigPrefix() {
124
- try {
125
- const prefix = execSync("npm config get prefix", {
126
- encoding: "utf8",
127
- stdio: ["ignore", "pipe", "ignore"]
128
- }).trim();
129
- return prefix || undefined;
130
- } catch {
131
- return;
132
- }
133
- }
134
- function resolveNpmPrefix() {
135
- const candidates = [
136
- process.env.NPM_CONFIG_PREFIX,
137
- process.env.npm_config_prefix,
138
- readNpmConfigPrefix(),
139
- path2.join(os2.homedir(), ".npm-global")
140
- ].filter(Boolean);
141
- for (const prefix of candidates) {
142
- if (isUsableNpmPrefix(prefix)) {
143
- return prefix;
144
- }
145
- }
146
- return ensureFallbackNpmPrefix();
147
- }
148
- function resolveGlobalNodeModulesPath() {
149
- return path2.join(resolveNpmPrefix(), "lib", "node_modules");
150
- }
151
- function resolveGlobalBinPath() {
152
- return path2.join(resolveNpmPrefix(), "bin");
153
- }
154
-
155
- // src/env/mcp/command-resolver.ts
156
- var PACKAGE_RUNNERS = new Set(["npx", "npm", "bunx", "yarn"]);
157
- function pathExistsSync2(p) {
158
- try {
159
- fs2.accessSync(p, fs2.constants.F_OK);
160
- return true;
161
- } catch {
162
- return false;
163
- }
164
- }
165
107
  function extractPackageName(command) {
166
108
  if (command.length < 2) {
167
109
  return;
168
110
  }
169
- const runner = path3.basename(command[0]);
111
+ const runner = path2.basename(command[0]);
170
112
  if (runner === "npx" || runner === "bunx") {
171
113
  return command[1];
172
114
  }
@@ -186,7 +128,7 @@ function isPackageRunnerCommand(command) {
186
128
  if (command.length < 2) {
187
129
  return false;
188
130
  }
189
- const runner = path3.basename(command[0]);
131
+ const runner = path2.basename(command[0]);
190
132
  if (!PACKAGE_RUNNERS.has(runner)) {
191
133
  return false;
192
134
  }
@@ -206,8 +148,8 @@ function resolvePackageRunnerCommand(command, serverDir) {
206
148
  if (!packageName) {
207
149
  return command;
208
150
  }
209
- const localBin = path3.join(serverDir, "node_modules", ".bin", packageName);
210
- if (pathExistsSync2(localBin)) {
151
+ const localBin = path2.join(serverDir, "node_modules", ".bin", packageName);
152
+ if (pathExistsSync(localBin)) {
211
153
  return [localBin];
212
154
  }
213
155
  return command;
@@ -245,13 +187,13 @@ var ENTRY_SCRIPT_CANDIDATES = [
245
187
  function expandPath(inputPath) {
246
188
  if (inputPath.startsWith("~/")) {
247
189
  const home = process.env.HOME || process.env.USERPROFILE || "";
248
- return path4.join(home, inputPath.slice(2));
190
+ return path3.join(home, inputPath.slice(2));
249
191
  }
250
- return path4.resolve(inputPath);
192
+ return path3.resolve(inputPath);
251
193
  }
252
194
  async function pathExists(p) {
253
195
  try {
254
- await fs3.access(p);
196
+ await fs2.access(p);
255
197
  return true;
256
198
  } catch {
257
199
  return false;
@@ -259,7 +201,7 @@ async function pathExists(p) {
259
201
  }
260
202
  async function parseConfigJsonc(configPath) {
261
203
  try {
262
- const configContent = await fs3.readFile(configPath, "utf-8");
204
+ const configContent = await fs2.readFile(configPath, "utf-8");
263
205
  const cleaned = configContent.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
264
206
  return JSON.parse(cleaned);
265
207
  } catch (error) {
@@ -268,10 +210,10 @@ async function parseConfigJsonc(configPath) {
268
210
  }
269
211
  }
270
212
  function relativeCommandMatchesEntry(cmdPath, entryPath, serverDir) {
271
- if (path4.resolve(serverDir, cmdPath) === entryPath) {
213
+ if (path3.resolve(serverDir, cmdPath) === entryPath) {
272
214
  return true;
273
215
  }
274
- return ENTRY_SCRIPT_CANDIDATES.some((candidate) => cmdPath === candidate && entryPath === path4.join(serverDir, candidate));
216
+ return ENTRY_SCRIPT_CANDIDATES.some((candidate) => cmdPath === candidate && entryPath === path3.join(serverDir, candidate));
275
217
  }
276
218
  function buildDefaultCommand(entryPath, directoryConfig, serverDir) {
277
219
  if (directoryConfig?.command) {
@@ -316,10 +258,10 @@ class McpScanner {
316
258
  }
317
259
  logger.info(`[McpScanner] Scanning: ${expandedPath}`);
318
260
  try {
319
- const entries = await fs3.readdir(expandedPath, { withFileTypes: true });
261
+ const entries = await fs2.readdir(expandedPath, { withFileTypes: true });
320
262
  for (const entry of entries) {
321
- const fullPath = path4.join(expandedPath, entry.name);
322
- const stat = await fs3.stat(fullPath);
263
+ const fullPath = path3.join(expandedPath, entry.name);
264
+ const stat = await fs2.stat(fullPath);
323
265
  if (!stat.isDirectory())
324
266
  continue;
325
267
  await this.discoverServer(entry.name, fullPath, mcpPath.type);
@@ -330,8 +272,8 @@ class McpScanner {
330
272
  }
331
273
  async discoverServer(name, serverDir, sourceType) {
332
274
  const entryPath = await this.findEntryScript(serverDir);
333
- const configPath = path4.join(serverDir, "config.jsonc");
334
- const packagePath = path4.join(serverDir, "package.json");
275
+ const configPath = path3.join(serverDir, "config.jsonc");
276
+ const packagePath = path3.join(serverDir, "package.json");
335
277
  let directoryConfig;
336
278
  if (await pathExists(configPath)) {
337
279
  directoryConfig = await parseConfigJsonc(configPath);
@@ -355,7 +297,7 @@ class McpScanner {
355
297
  }
356
298
  async findEntryScript(serverDir) {
357
299
  for (const candidate of ENTRY_SCRIPT_CANDIDATES) {
358
- const entryPath = path4.join(serverDir, candidate);
300
+ const entryPath = path3.join(serverDir, candidate);
359
301
  if (await pathExists(entryPath)) {
360
302
  return entryPath;
361
303
  }
@@ -369,14 +311,14 @@ class McpScanner {
369
311
 
370
312
  // src/env/mcp/loader.ts
371
313
  init_logger();
372
- import fs4 from "fs/promises";
373
- import path5 from "path";
374
- import os3 from "os";
314
+ import fs3 from "fs/promises";
315
+ import path4 from "path";
316
+ import os2 from "os";
375
317
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
376
318
  import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
377
319
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
378
320
  var logger2 = createLogger("mcp-loader");
379
- var AUTH_JSON_PATH = path5.join(os3.homedir(), ".roy-agent", "auth.json");
321
+ var AUTH_JSON_PATH = path4.join(os2.homedir(), ".roy-agent", "auth.json");
380
322
 
381
323
  class McpLoader {
382
324
  clients = new Map;
@@ -521,7 +463,7 @@ class McpLoader {
521
463
  }
522
464
  async loadMinimaxApiKey() {
523
465
  try {
524
- const content = await fs4.readFile(AUTH_JSON_PATH, "utf-8");
466
+ const content = await fs3.readFile(AUTH_JSON_PATH, "utf-8");
525
467
  const auth = JSON.parse(content);
526
468
  return auth.providers?.minimax?.apiKey;
527
469
  } catch (error) {
@@ -542,15 +484,15 @@ class McpLoader {
542
484
  }
543
485
 
544
486
  // src/env/mcp/mcp-config-registration.ts
545
- import path6 from "path";
546
- import os4 from "os";
487
+ import path5 from "path";
488
+ import os3 from "os";
547
489
  var MCP_DEFAULTS = {
548
490
  "mcp.enabled": true,
549
491
  "mcp.timeout": 30000,
550
492
  "mcp.mcpPaths": [
551
493
  {
552
494
  type: "user",
553
- path: path6.join(os4.homedir(), ".config", "roy-agent", "mcp")
495
+ path: path5.join(os3.homedir(), ".config", "roy-agent", "mcp")
554
496
  },
555
497
  {
556
498
  type: "project",
@@ -791,4 +733,4 @@ class McpComponent extends BaseComponent {
791
733
  await this.loadServers();
792
734
  }
793
735
  }
794
- export { McpServerLocalConfigSchema, McpServerRemoteConfigSchema, McpServerConfigSchema, DEFAULT_MCP_CONFIG, MCP_CONFIG_KEYS, getMcpPathPriority, isUsableNpmPrefix, ensureFallbackNpmPrefix, resolveNpmPrefix, resolveGlobalNodeModulesPath, resolveGlobalBinPath, resolvePackageRunnerCommand, augmentNpmEnvForPackageRunner, McpScanner, McpLoader, McpComponent };
736
+ export { McpServerLocalConfigSchema, McpServerRemoteConfigSchema, McpServerConfigSchema, DEFAULT_MCP_CONFIG, MCP_CONFIG_KEYS, getMcpPathPriority, resolvePackageRunnerCommand, augmentNpmEnvForPackageRunner, McpScanner, McpLoader, McpComponent };
@@ -1,8 +1,11 @@
1
+ import {
2
+ TaskEntityEventTypes
3
+ } from "./roy-agent-core-8gxth0eh.js";
1
4
  import {
2
5
  BackgroundTaskManager,
3
6
  createDelegateTool,
4
7
  createStopTool
5
- } from "./roy-agent-core-8y804aat.js";
8
+ } from "./roy-agent-core-jqq7c2rk.js";
6
9
  import {
7
10
  SQLiteTaskStore,
8
11
  getDefaultTaskDbPath
@@ -25,9 +28,6 @@ import {
25
28
  import {
26
29
  TaskHookPoints
27
30
  } from "./roy-agent-core-92z6t4he.js";
28
- import {
29
- TaskEntityEventTypes
30
- } from "./roy-agent-core-8gxth0eh.js";
31
31
  import {
32
32
  TracedAs,
33
33
  init_decorator
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  AgentComponentAdapter,
3
3
  init_agent_component_adapter
4
- } from "./roy-agent-core-44g4dhzg.js";
5
- import"./roy-agent-core-dbxm76wf.js";
4
+ } from "./roy-agent-core-2rtka82a.js";
5
+ import"./roy-agent-core-kzbj10gk.js";
6
6
  import"./roy-agent-core-nhfy3p8q.js";
7
7
  import"./roy-agent-core-e25xkv53.js";
8
+ import"./roy-agent-core-q5qj0fes.js";
8
9
  import"./roy-agent-core-rgj6hq15.js";
9
10
  import"./roy-agent-core-rm3hay00.js";
10
11
  import"./roy-agent-core-10n2jh7p.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.45",
3
+ "version": "1.5.47",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",
@@ -3,6 +3,10 @@ import {
3
3
  matchesQuery,
4
4
  parseSearchQuery
5
5
  } from "./roy-agent-core-rvxg1wps.js";
6
+ import {
7
+ MemorySessionStore,
8
+ SQLiteSessionStore
9
+ } from "./roy-agent-core-6mcb7nqa.js";
6
10
  import {
7
11
  SummaryAgent
8
12
  } from "./roy-agent-core-kwhv9dcd.js";
@@ -20,10 +24,6 @@ import {
20
24
  createLogger,
21
25
  init_logger
22
26
  } from "./roy-agent-core-10n2jh7p.js";
23
- import {
24
- MemorySessionStore,
25
- SQLiteSessionStore
26
- } from "./roy-agent-core-6mcb7nqa.js";
27
27
  import {
28
28
  __legacyDecorateClassTS
29
29
  } from "./roy-agent-core-fs0mn2jk.js";