@ai-setting/roy-agent-core 1.5.73 → 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.
Files changed (22) hide show
  1. package/dist/env/agent/index.js +3 -3
  2. package/dist/env/commands/index.js +1 -1
  3. package/dist/env/event-source/index.js +2 -2
  4. package/dist/env/index.js +9 -9
  5. package/dist/env/llm/index.js +2 -2
  6. package/dist/env/plugin/index.js +1 -1
  7. package/dist/env/task/delegate/index.js +2 -2
  8. package/dist/env/task/index.js +3 -3
  9. package/dist/env/task/plugins/index.js +1 -1
  10. package/dist/index.js +11 -11
  11. package/dist/shared/@ai-setting/{roy-agent-core-eq52jra7.js → roy-agent-core-0tgnq4nz.js} +1 -1
  12. package/dist/shared/@ai-setting/{roy-agent-core-84vtpbw6.js → roy-agent-core-11dnsfwp.js} +1 -1
  13. package/dist/shared/@ai-setting/{roy-agent-core-7wdjpbcr.js → roy-agent-core-3952rkj0.js} +13 -3
  14. package/dist/shared/@ai-setting/{roy-agent-core-w4tqc9m1.js → roy-agent-core-f9xyqx9s.js} +1 -1
  15. package/dist/shared/@ai-setting/{roy-agent-core-zm86k3rg.js → roy-agent-core-gb9rb9ny.js} +1 -1
  16. package/dist/shared/@ai-setting/{roy-agent-core-smgpr5tz.js → roy-agent-core-h2d1s8yd.js} +1 -1
  17. package/dist/shared/@ai-setting/{roy-agent-core-3f0bkm7q.js → roy-agent-core-r0m0at3x.js} +4 -1
  18. package/dist/shared/@ai-setting/{roy-agent-core-xp8xrxgc.js → roy-agent-core-r12a2qfv.js} +3 -1
  19. package/dist/shared/@ai-setting/{roy-agent-core-p7grnnzp.js → roy-agent-core-t1ef8hf2.js} +50 -20
  20. package/dist/shared/@ai-setting/{roy-agent-core-9dja7n0q.js → roy-agent-core-w6j4zyps.js} +2 -2
  21. package/dist/shared/@ai-setting/{roy-agent-core-nx3c3ce2.js → roy-agent-core-zf62vkc4.js} +6 -5
  22. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  AgentComponent,
3
3
  AgentComponentConfigSchema
4
- } from "../../shared/@ai-setting/roy-agent-core-9dja7n0q.js";
5
- import"../../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
4
+ } from "../../shared/@ai-setting/roy-agent-core-w6j4zyps.js";
5
+ import"../../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
6
6
  import"../../shared/@ai-setting/roy-agent-core-e25xkv53.js";
7
- import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
7
+ import"../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
8
8
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
9
9
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
10
10
  import {
@@ -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
@@ -39,16 +39,16 @@ import"../shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
39
39
  import {
40
40
  AgentComponent,
41
41
  AgentComponentConfigSchema
42
- } from "../shared/@ai-setting/roy-agent-core-9dja7n0q.js";
43
- import"../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
42
+ } from "../shared/@ai-setting/roy-agent-core-w6j4zyps.js";
43
+ import"../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
44
44
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
45
45
  import {
46
46
  TaskComponent
47
- } from "../shared/@ai-setting/roy-agent-core-84vtpbw6.js";
47
+ } from "../shared/@ai-setting/roy-agent-core-11dnsfwp.js";
48
48
  import"../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
49
- import"../shared/@ai-setting/roy-agent-core-eq52jra7.js";
49
+ import"../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
50
50
  import"../shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
51
- import"../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
51
+ import"../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
52
52
  import {
53
53
  XDG_PATHS,
54
54
  getXDGPath,
@@ -8,13 +8,13 @@ import {
8
8
  ProviderCapabilitiesSchema,
9
9
  ProviderConfigSchema,
10
10
  ProviderManager
11
- } from "../../shared/@ai-setting/roy-agent-core-smgpr5tz.js";
11
+ } from "../../shared/@ai-setting/roy-agent-core-h2d1s8yd.js";
12
12
  import {
13
13
  createInvokeConfig,
14
14
  invoke,
15
15
  invokeNonStream,
16
16
  parseModelString
17
- } from "../../shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
17
+ } from "../../shared/@ai-setting/roy-agent-core-r0m0at3x.js";
18
18
  import"../../shared/@ai-setting/roy-agent-core-ctdhjv68.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-ce10b0ez.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-qxhq8ven.js";
@@ -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";
@@ -3,8 +3,8 @@ import {
3
3
  BackgroundTaskManager,
4
4
  createDelegateTool,
5
5
  createStopTool
6
- } from "../../../shared/@ai-setting/roy-agent-core-eq52jra7.js";
7
- import"../../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
6
+ } from "../../../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
7
+ import"../../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
8
8
  import"../../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
9
9
  import"../../../shared/@ai-setting/roy-agent-core-92z6t4he.js";
10
10
  import"../../../shared/@ai-setting/roy-agent-core-7tp56w6n.js";
@@ -5,16 +5,16 @@ import {
5
5
  TaskPriorityEnum,
6
6
  TaskStatusEnum,
7
7
  TaskTypeEnum
8
- } from "../../shared/@ai-setting/roy-agent-core-84vtpbw6.js";
8
+ } from "../../shared/@ai-setting/roy-agent-core-11dnsfwp.js";
9
9
  import {
10
10
  TaskEntityEventTypes
11
11
  } from "../../shared/@ai-setting/roy-agent-core-8gxth0eh.js";
12
- import"../../shared/@ai-setting/roy-agent-core-eq52jra7.js";
12
+ import"../../shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
13
13
  import {
14
14
  SQLiteTaskStore,
15
15
  getDefaultTaskDbPath
16
16
  } from "../../shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
17
- import"../../shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
17
+ import"../../shared/@ai-setting/roy-agent-core-zf62vkc4.js";
18
18
  import"../../shared/@ai-setting/roy-agent-core-qxnbvgwe.js";
19
19
  import"../../shared/@ai-setting/roy-agent-core-7t0jen73.js";
20
20
  import"../../shared/@ai-setting/roy-agent-core-t94ktchq.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
@@ -11,13 +11,13 @@ import {
11
11
  ModelLimitsSchema,
12
12
  ProviderCapabilitiesSchema,
13
13
  ProviderConfigSchema
14
- } from "./shared/@ai-setting/roy-agent-core-smgpr5tz.js";
14
+ } from "./shared/@ai-setting/roy-agent-core-h2d1s8yd.js";
15
15
  import {
16
16
  ConfigComponent
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";
@@ -116,29 +116,29 @@ import"./shared/@ai-setting/roy-agent-core-1ce3fqrk.js";
116
116
  import {
117
117
  AgentComponent,
118
118
  AgentComponentConfigSchema
119
- } from "./shared/@ai-setting/roy-agent-core-9dja7n0q.js";
119
+ } from "./shared/@ai-setting/roy-agent-core-w6j4zyps.js";
120
120
  import {
121
121
  createInvokeConfig,
122
122
  invoke,
123
123
  invokeNonStream,
124
124
  parseModelString
125
- } from "./shared/@ai-setting/roy-agent-core-3f0bkm7q.js";
125
+ } from "./shared/@ai-setting/roy-agent-core-r0m0at3x.js";
126
126
  import {
127
127
  AskUserError,
128
128
  init_workflow_hil
129
129
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
130
130
  import {
131
131
  TaskComponent
132
- } from "./shared/@ai-setting/roy-agent-core-84vtpbw6.js";
132
+ } from "./shared/@ai-setting/roy-agent-core-11dnsfwp.js";
133
133
  import"./shared/@ai-setting/roy-agent-core-8gxth0eh.js";
134
- import"./shared/@ai-setting/roy-agent-core-eq52jra7.js";
134
+ import"./shared/@ai-setting/roy-agent-core-0tgnq4nz.js";
135
135
  import {
136
136
  SQLiteTaskStore,
137
137
  getDefaultTaskDbPath
138
138
  } from "./shared/@ai-setting/roy-agent-core-r9y8ct0w.js";
139
139
  import {
140
140
  AgentRegistry
141
- } from "./shared/@ai-setting/roy-agent-core-nx3c3ce2.js";
141
+ } from "./shared/@ai-setting/roy-agent-core-zf62vkc4.js";
142
142
  import {
143
143
  XDG_PATHS,
144
144
  getXDGPath,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_SUBAGENT_PROMPT
3
- } from "./roy-agent-core-nx3c3ce2.js";
3
+ } from "./roy-agent-core-zf62vkc4.js";
4
4
  import {
5
5
  TaskHookPoints
6
6
  } from "./roy-agent-core-92z6t4he.js";
@@ -5,7 +5,7 @@ import {
5
5
  BackgroundTaskManager,
6
6
  createDelegateTool,
7
7
  createStopTool
8
- } from "./roy-agent-core-eq52jra7.js";
8
+ } from "./roy-agent-core-0tgnq4nz.js";
9
9
  import {
10
10
  SQLiteTaskStore,
11
11
  getDefaultTaskDbPath
@@ -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
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  invoke
3
- } from "./roy-agent-core-3f0bkm7q.js";
3
+ } from "./roy-agent-core-r0m0at3x.js";
4
4
  import {
5
5
  ContextError,
6
6
  ErrorCodes
@@ -212,7 +212,10 @@ function convertToolChoice(toolChoice) {
212
212
  return;
213
213
  if (typeof toolChoice === "string")
214
214
  return toolChoice;
215
- return { type: "tool", toolName: toolChoice.function.name };
215
+ const toolName = toolChoice.function?.name?.trim();
216
+ if (!toolName)
217
+ return;
218
+ return { type: "tool", toolName };
216
219
  }
217
220
  function createEnvEventEmitter(env, context) {
218
221
  if (!env) {
@@ -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)
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  withTimeout
3
- } from "./roy-agent-core-3f0bkm7q.js";
3
+ } from "./roy-agent-core-r0m0at3x.js";
4
4
  import {
5
5
  AskUserError,
6
6
  init_workflow_hil
7
7
  } from "./roy-agent-core-e25xkv53.js";
8
8
  import {
9
9
  AgentRegistry
10
- } from "./roy-agent-core-nx3c3ce2.js";
10
+ } from "./roy-agent-core-zf62vkc4.js";
11
11
  import {
12
12
  ContextError
13
13
  } from "./roy-agent-core-ctdhjv68.js";
@@ -109,17 +109,18 @@ class AgentRegistry {
109
109
  const promptComponent = this.getActivePromptComponent();
110
110
  if (agent.systemPromptRef) {
111
111
  try {
112
- const prompt = promptComponent?.get?.(agent.systemPromptRef);
113
- if (prompt) {
114
- logger.debug(`[AgentRegistry] Resolved systemPromptRef: ${agent.systemPromptRef}`);
115
- return prompt;
116
- }
117
112
  if (promptComponent?.getPrompt) {
118
113
  const rendered = await promptComponent.getPrompt(agent.systemPromptRef);
119
114
  if (rendered) {
115
+ logger.debug(`[AgentRegistry] Resolved systemPromptRef via getPrompt: ${agent.systemPromptRef}`);
120
116
  return rendered;
121
117
  }
122
118
  }
119
+ const prompt = promptComponent?.get?.(agent.systemPromptRef);
120
+ if (prompt) {
121
+ logger.debug(`[AgentRegistry] Resolved systemPromptRef via get: ${agent.systemPromptRef}`);
122
+ return prompt;
123
+ }
123
124
  if (agent.systemPrompt) {
124
125
  logger.debug(`[AgentRegistry] systemPromptRef not found, falling back to inline`);
125
126
  return agent.systemPrompt;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.5.73",
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",