@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-
|
|
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
|
package/dist/env/plugin/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
EventBusNotificationChannel,
|
|
3
3
|
PluginComponent
|
|
4
|
-
} from "../../shared/@ai-setting/roy-agent-core-
|
|
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-
|
|
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
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
|
|
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
|
-
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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(
|
|
193
|
-
resolvedPath =
|
|
194
|
-
} catch (
|
|
195
|
-
this.logger.warn(`[PluginComponent] Could not import plugin '${packageName}' from
|
|
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
|
-
|
|
200
|
-
|
|
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
|
}
|