@ai-setting/roy-agent-core 1.7.6 → 1.7.7

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
@@ -68,7 +68,7 @@ import"../shared/@ai-setting/roy-agent-core-c1v263jn.js";
68
68
  import"../shared/@ai-setting/roy-agent-core-e25xkv53.js";
69
69
  import {
70
70
  PluginComponent
71
- } from "../shared/@ai-setting/roy-agent-core-mfxwnyhs.js";
71
+ } from "../shared/@ai-setting/roy-agent-core-h9230kg6.js";
72
72
  import"../shared/@ai-setting/roy-agent-core-az13yzmc.js";
73
73
  import {
74
74
  McpComponent
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  EventBusNotificationChannel,
3
3
  PluginComponent
4
- } from "../../shared/@ai-setting/roy-agent-core-mfxwnyhs.js";
4
+ } from "../../shared/@ai-setting/roy-agent-core-h9230kg6.js";
5
5
  import {
6
6
  BasePlugin
7
7
  } from "../../shared/@ai-setting/roy-agent-core-az13yzmc.js";
package/dist/index.js CHANGED
@@ -188,7 +188,7 @@ import {
188
188
  } from "./shared/@ai-setting/roy-agent-core-e25xkv53.js";
189
189
  import {
190
190
  PluginComponent
191
- } from "./shared/@ai-setting/roy-agent-core-mfxwnyhs.js";
191
+ } from "./shared/@ai-setting/roy-agent-core-h9230kg6.js";
192
192
  import {
193
193
  BasePlugin
194
194
  } from "./shared/@ai-setting/roy-agent-core-az13yzmc.js";
@@ -174,30 +174,51 @@ class PluginComponent extends BaseComponent {
174
174
  resolvedPath = req.resolve(packageName);
175
175
  } catch {}
176
176
  } catch (_err) {
177
- const projectPluginPath = join(process.cwd(), ".roy", "plugins", packageName);
178
- if (existsSync(projectPluginPath)) {
179
- this.logger.debug(`[PluginComponent] Falling back to project plugin path: ${projectPluginPath}`);
180
- try {
181
- pluginModule = await import(projectPluginPath);
182
- resolvedPath = projectPluginPath;
183
- } catch (err2) {
184
- this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from project path: ${err2}`);
185
- return;
177
+ let loadedFromGlobalRoot = false;
178
+ try {
179
+ const { execSync } = await import("node:child_process");
180
+ const npmGlobalRoot = execSync("npm root -g", {
181
+ encoding: "utf-8",
182
+ stdio: ["ignore", "pipe", "ignore"]
183
+ }).trim();
184
+ if (npmGlobalRoot) {
185
+ const globalPkgPath = join(npmGlobalRoot, packageName);
186
+ if (existsSync(globalPkgPath)) {
187
+ this.logger.debug(`[PluginComponent] Falling back to npm global root: ${globalPkgPath}`);
188
+ pluginModule = await import(globalPkgPath);
189
+ resolvedPath = globalPkgPath;
190
+ loadedFromGlobalRoot = true;
191
+ }
186
192
  }
187
- } else {
188
- const globalPluginPath = join(homedir(), ".roy-agent", "node_modules", packageName);
189
- if (existsSync(globalPluginPath)) {
190
- this.logger.debug(`[PluginComponent] Falling back to global plugin path: ${globalPluginPath}`);
193
+ } catch (npmRootErr) {
194
+ this.logger.debug(`[PluginComponent] npm root -g failed: ${npmRootErr}`);
195
+ }
196
+ if (!loadedFromGlobalRoot) {
197
+ const projectPluginPath = join(process.cwd(), ".roy", "plugins", packageName);
198
+ if (existsSync(projectPluginPath)) {
199
+ this.logger.debug(`[PluginComponent] Falling back to project plugin path: ${projectPluginPath}`);
191
200
  try {
192
- pluginModule = await import(globalPluginPath);
193
- resolvedPath = globalPluginPath;
194
- } catch (err3) {
195
- this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from global path: ${err3}`);
201
+ pluginModule = await import(projectPluginPath);
202
+ resolvedPath = projectPluginPath;
203
+ } catch (err2) {
204
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from project path: ${err2}`);
196
205
  return;
197
206
  }
198
207
  } else {
199
- this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}': ${_err}`);
200
- return;
208
+ const globalPluginPath = join(homedir(), ".roy-agent", "node_modules", packageName);
209
+ if (existsSync(globalPluginPath)) {
210
+ this.logger.debug(`[PluginComponent] Falling back to global plugin path: ${globalPluginPath}`);
211
+ try {
212
+ pluginModule = await import(globalPluginPath);
213
+ resolvedPath = globalPluginPath;
214
+ } catch (err3) {
215
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from global path: ${err3}`);
216
+ return;
217
+ }
218
+ } else {
219
+ this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}': ${_err}`);
220
+ return;
221
+ }
201
222
  }
202
223
  }
203
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-setting/roy-agent-core",
3
- "version": "1.7.6",
3
+ "version": "1.7.7",
4
4
  "type": "module",
5
5
  "description": "Core SDK for roy-agent - Environment, Components, Tools, Sessions, Tasks",
6
6
  "main": "./dist/index.js",