@ai-setting/roy-agent-core 1.5.74 → 1.5.75

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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CommandsComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-7wdjpbcr.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-3952rkj0.js";
4
4
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
5
5
  import"../../shared/@ai-setting/roy-agent-core-rgckng3p.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-b8r4tfqq.js";
@@ -4,7 +4,7 @@ import {
4
4
  builtInHandlers,
5
5
  getBuiltInHandler,
6
6
  larkCliHandler
7
- } from "../../shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
7
+ } from "../../shared/@ai-setting/roy-agent-core-f9xyqx9s.js";
8
8
  import {
9
9
  BUILT_IN_EVENT_SOURCE_TYPES,
10
10
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -15,7 +15,7 @@ import {
15
15
  validateEventSourceConfig
16
16
  } from "../../shared/@ai-setting/roy-agent-core-xb4hvk1m.js";
17
17
  import"../../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
18
- import"../../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
18
+ import"../../shared/@ai-setting/roy-agent-core-r12a2qfv.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
21
21
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
package/dist/env/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  BaseEnvironment
3
- } from "../shared/@ai-setting/roy-agent-core-zm86k3rg.js";
3
+ } from "../shared/@ai-setting/roy-agent-core-gb9rb9ny.js";
4
4
  import {
5
5
  EventSourceComponent,
6
6
  builtInHandlers,
7
7
  larkCliHandler
8
- } from "../shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
8
+ } from "../shared/@ai-setting/roy-agent-core-f9xyqx9s.js";
9
9
  import {
10
10
  EventSourceInitHooks,
11
11
  getDefaultConfigForType,
@@ -16,8 +16,8 @@ import {
16
16
  import"../shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
17
17
  import {
18
18
  PluginComponent
19
- } from "../shared/@ai-setting/roy-agent-core-p7grnnzp.js";
20
- import"../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
19
+ } from "../shared/@ai-setting/roy-agent-core-t1ef8hf2.js";
20
+ import"../shared/@ai-setting/roy-agent-core-r12a2qfv.js";
21
21
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
22
22
  import {
23
23
  WorkflowComponent
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PluginComponent
3
- } from "../../shared/@ai-setting/roy-agent-core-p7grnnzp.js";
3
+ } from "../../shared/@ai-setting/roy-agent-core-t1ef8hf2.js";
4
4
  import {
5
5
  BasePlugin
6
6
  } from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
@@ -9,7 +9,7 @@ import {
9
9
  formatExtractorInput,
10
10
  formatExtractorInputFromDescription,
11
11
  parseExtractorOutput
12
- } from "../../../shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
12
+ } from "../../../shared/@ai-setting/roy-agent-core-r12a2qfv.js";
13
13
  import"../../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
14
14
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
15
15
  import"../../../shared/@ai-setting/roy-agent-core-qg4rma4c.js";
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  } from "./shared/@ai-setting/roy-agent-core-prdngx28.js";
18
18
  import {
19
19
  CommandsComponent
20
- } from "./shared/@ai-setting/roy-agent-core-7wdjpbcr.js";
20
+ } from "./shared/@ai-setting/roy-agent-core-3952rkj0.js";
21
21
  import {
22
22
  ToolComponent,
23
23
  ToolRegistry,
@@ -57,13 +57,13 @@ import {
57
57
  BaseEnvironment,
58
58
  generateDescendingId,
59
59
  generateId
60
- } from "./shared/@ai-setting/roy-agent-core-zm86k3rg.js";
60
+ } from "./shared/@ai-setting/roy-agent-core-gb9rb9ny.js";
61
61
  import {
62
62
  EventSourceComponent,
63
63
  builtInHandlers,
64
64
  getBuiltInHandler,
65
65
  larkCliHandler
66
- } from "./shared/@ai-setting/roy-agent-core-w4tqc9m1.js";
66
+ } from "./shared/@ai-setting/roy-agent-core-f9xyqx9s.js";
67
67
  import {
68
68
  BUILT_IN_EVENT_SOURCE_TYPES,
69
69
  BUILT_IN_EVENT_SOURCE_TYPE_LIST,
@@ -79,11 +79,11 @@ import {
79
79
  } from "./shared/@ai-setting/roy-agent-core-v8xa6vs8.js";
80
80
  import {
81
81
  PluginComponent
82
- } from "./shared/@ai-setting/roy-agent-core-p7grnnzp.js";
82
+ } from "./shared/@ai-setting/roy-agent-core-t1ef8hf2.js";
83
83
  import {
84
84
  TaskTagPlugin,
85
85
  createAutoTaskPlugin
86
- } from "./shared/@ai-setting/roy-agent-core-xp8xrxgc.js";
86
+ } from "./shared/@ai-setting/roy-agent-core-r12a2qfv.js";
87
87
  import {
88
88
  BasePlugin
89
89
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
@@ -367,7 +367,7 @@ Run \`${options.name} --help\` to explore full capabilities.
367
367
  const stat = await fs2.lstat(commandPath);
368
368
  const realPath = stat.isSymbolicLink() ? await fs2.readlink(commandPath) : commandPath;
369
369
  const cmdSource = dir === this.projectCommandsDir ? "project" : "user";
370
- const shortDescription = await this.getDescription(realPath);
370
+ const shortDescription = await this.getDescription(realPath, name, dir);
371
371
  return {
372
372
  name,
373
373
  path: realPath,
@@ -436,7 +436,7 @@ Run \`${options.name} --help\` to explore full capabilities.
436
436
  }
437
437
  }
438
438
  const realPath = stat.isSymbolicLink() ? await fs2.readlink(fullPath) : fullPath;
439
- const shortDescription = await this.getDescription(realPath);
439
+ const shortDescription = await this.getDescription(realPath, entry, dir);
440
440
  commands.push({
441
441
  name: entry,
442
442
  path: realPath,
@@ -456,7 +456,17 @@ Run \`${options.name} --help\` to explore full capabilities.
456
456
  const regex = new RegExp("^" + pattern.replace(/\*/g, ".*").replace(/\?/g, ".") + "$");
457
457
  return regex.test(name);
458
458
  }
459
- async getDescription(commandPath) {
459
+ async getDescription(commandPath, name, commandsDir) {
460
+ if (name && commandsDir) {
461
+ const metaPath = path2.join(commandsDir, `${name}.meta.md`);
462
+ try {
463
+ const meta = await parseMetaFile(metaPath, "user");
464
+ if (meta?.description) {
465
+ this.descriptionCache.set(commandPath, meta.description);
466
+ return meta.description;
467
+ }
468
+ } catch {}
469
+ }
460
470
  const cached = this.descriptionCache.get(commandPath);
461
471
  if (cached !== undefined)
462
472
  return cached;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TaskTagPlugin,
3
3
  createLarkCliTaskNotifyHook
4
- } from "./roy-agent-core-xp8xrxgc.js";
4
+ } from "./roy-agent-core-r12a2qfv.js";
5
5
  import {
6
6
  envKeyToConfigKey
7
7
  } from "./roy-agent-core-qxhq8ven.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createAutoTaskPlugin
3
- } from "./roy-agent-core-xp8xrxgc.js";
3
+ } from "./roy-agent-core-r12a2qfv.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -411,7 +411,9 @@ function createAutoTaskPlugin(config) {
411
411
  tr.result.output = (tr.result.output || "") + `
412
412
 
413
413
  ---
414
- \uD83D\uDCCC **System: This session has reached ` + ctx.iteration + " ReAct iterations. " + "The current work may be long-running. Please use `delegate_task` to assign " + "it to a sub-agent (e.g. `roy`) that will create a proper task and continue.**\n" + 'Example: `delegate_task(description="<summary>", prompt="Continue working on the current task...", subagent_type="roy")`\n---';
414
+ ` + "\uD83D\uDEA8 **IMPORTANT: You MUST call `delegate_task` now.**\n\n" + "This session has reached " + ctx.iteration + " ReAct iterations. " + "**You are REQUIRED to stop your current work and call `delegate_task` immediately.** " + `Do NOT continue the current ReAct loop. You MUST hand off the remaining work to a sub-agent.
415
+
416
+ ` + "**You MUST call the tool `delegate_task` with these parameters:**\n" + "- `description`: A short 3-5 word summary of the task\n" + "- `prompt`: Detailed instructions for the sub-agent to continue the work\n" + '- `subagent_type`: Use `"roy"` for general tasks\n\n' + "**Failure to call `delegate_task` will result in the work being lost.**\n" + "---";
415
417
  }
416
418
  logger2.info(`[AutoTaskPlugin] Prompted delegate_task at iteration ${ctx.iteration} (session=${sid.slice(0, 12)}...)`);
417
419
  return { continue: true };
@@ -42,26 +42,34 @@ class PluginComponent extends BaseComponent {
42
42
  this.logger.info("[PluginComponent] Initialized");
43
43
  }
44
44
  async loadInstalledPlugins() {
45
- const configPath = join(homedir(), ".roy-agent", "plugins.json");
46
- if (!existsSync(configPath)) {
47
- this.logger.debug("[PluginComponent] No plugins.json found, skipping auto-load");
48
- return;
49
- }
50
- let config;
51
- try {
52
- const raw = readFileSync(configPath, "utf-8");
53
- config = JSON.parse(raw);
54
- } catch (err) {
55
- this.logger.warn(`[PluginComponent] Failed to read plugins.json: ${err}`);
56
- return;
45
+ const pluginConfigs = [
46
+ { source: "global", path: join(homedir(), ".roy-agent", "plugins.json") },
47
+ { source: "project", path: join(process.cwd(), ".roy", "plugins.json") }
48
+ ];
49
+ const allPlugins = [];
50
+ for (const { source, path } of pluginConfigs) {
51
+ if (!existsSync(path)) {
52
+ this.logger.debug(`[PluginComponent] No plugins.json found at ${path}, skipping`);
53
+ continue;
54
+ }
55
+ try {
56
+ const raw = readFileSync(path, "utf-8");
57
+ const config = JSON.parse(raw);
58
+ const plugins = config.plugins ?? [];
59
+ if (plugins.length > 0) {
60
+ this.logger.info(`[PluginComponent] Found ${plugins.length} plugin(s) in ${source} config: ${path}`);
61
+ allPlugins.push(...plugins);
62
+ }
63
+ } catch (err) {
64
+ this.logger.warn(`[PluginComponent] Failed to read plugins.json at ${path}: ${err}`);
65
+ }
57
66
  }
58
- const plugins = config.plugins ?? [];
59
- if (plugins.length === 0) {
60
- this.logger.debug("[PluginComponent] plugins.json is empty, skipping auto-load");
67
+ if (allPlugins.length === 0) {
68
+ this.logger.debug("[PluginComponent] No plugins found in any config, skipping auto-load");
61
69
  return;
62
70
  }
63
- this.logger.info(`[PluginComponent] Loading ${plugins.length} installed plugin(s) from plugins.json`);
64
- for (const entry of plugins) {
71
+ this.logger.info(`[PluginComponent] Loading ${allPlugins.length} installed plugin(s) from all configs`);
72
+ for (const entry of allPlugins) {
65
73
  try {
66
74
  await this.loadPluginFromPackage(entry.packageName);
67
75
  } catch (err) {
@@ -73,9 +81,31 @@ class PluginComponent extends BaseComponent {
73
81
  let pluginModule;
74
82
  try {
75
83
  pluginModule = await import(packageName);
76
- } catch (err) {
77
- this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}': ${err}`);
78
- return;
84
+ } catch (_err) {
85
+ const projectPluginPath = join(process.cwd(), ".roy", "plugins", packageName);
86
+ if (existsSync(projectPluginPath)) {
87
+ this.logger.debug(`[PluginComponent] Falling back to project plugin path: ${projectPluginPath}`);
88
+ try {
89
+ pluginModule = await import(projectPluginPath);
90
+ } catch (err2) {
91
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from project path: ${err2}`);
92
+ return;
93
+ }
94
+ } else {
95
+ const globalPluginPath = join(homedir(), ".roy-agent", "node_modules", packageName);
96
+ if (existsSync(globalPluginPath)) {
97
+ this.logger.debug(`[PluginComponent] Falling back to global plugin path: ${globalPluginPath}`);
98
+ try {
99
+ pluginModule = await import(globalPluginPath);
100
+ } catch (err3) {
101
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from global path: ${err3}`);
102
+ return;
103
+ }
104
+ } else {
105
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}': ${_err}`);
106
+ return;
107
+ }
108
+ }
79
109
  }
80
110
  const tryCreateInstance = (candidate, exportKind) => {
81
111
  if (!candidate)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.74",
3
+ "version": "1.5.75",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",