@elizaos/core 1.0.0-alpha.34 → 1.0.0-alpha.35

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/index.js CHANGED
@@ -1335,8 +1335,8 @@ function getErrorMap() {
1335
1335
  return overrideErrorMap;
1336
1336
  }
1337
1337
  var makeIssue = (params) => {
1338
- const { data, path: path2, errorMaps, issueData } = params;
1339
- const fullPath = [...path2, ...issueData.path || []];
1338
+ const { data, path: path3, errorMaps, issueData } = params;
1339
+ const fullPath = [...path3, ...issueData.path || []];
1340
1340
  const fullIssue = {
1341
1341
  ...issueData,
1342
1342
  path: fullPath
@@ -1461,11 +1461,11 @@ var errorUtil;
1461
1461
  var _ZodEnum_cache;
1462
1462
  var _ZodNativeEnum_cache;
1463
1463
  var ParseInputLazyPath = class {
1464
- constructor(parent, value, path2, key) {
1464
+ constructor(parent, value, path3, key) {
1465
1465
  this._cachedPath = [];
1466
1466
  this.parent = parent;
1467
1467
  this.data = value;
1468
- this._path = path2;
1468
+ this._path = path3;
1469
1469
  this._key = key;
1470
1470
  }
1471
1471
  get path() {
@@ -5164,11 +5164,11 @@ function validateCharacterConfig(json) {
5164
5164
  if (error instanceof z.ZodError) {
5165
5165
  const groupedErrors = error.errors.reduce(
5166
5166
  (acc, err) => {
5167
- const path2 = err.path.join(".");
5168
- if (!acc[path2]) {
5169
- acc[path2] = [];
5167
+ const path3 = err.path.join(".");
5168
+ if (!acc[path3]) {
5169
+ acc[path3] = [];
5170
5170
  }
5171
- acc[path2].push(err.message);
5171
+ acc[path3].push(err.message);
5172
5172
  return acc;
5173
5173
  },
5174
5174
  {}
@@ -5187,6 +5187,8 @@ function validateCharacterConfig(json) {
5187
5187
  }
5188
5188
 
5189
5189
  // src/import.ts
5190
+ import path2 from "node:path";
5191
+ import fs2 from "node:fs";
5190
5192
  var registrations = /* @__PURE__ */ new Map();
5191
5193
  var dynamicImport = async (specifier) => {
5192
5194
  const module = registrations.get(specifier);
@@ -5203,11 +5205,24 @@ async function handlePluginImporting(plugins) {
5203
5205
  logger_default.debug("Imported are: ", plugins);
5204
5206
  const importedPlugins = await Promise.all(
5205
5207
  plugins.map(async (plugin) => {
5208
+ const functionName = `${plugin.replace("@elizaos/plugin-", "").replace("@elizaos-plugins/", "").replace(/-./g, (x) => x[1].toUpperCase())}Plugin`;
5206
5209
  try {
5207
5210
  const importedPlugin = await import(plugin);
5208
- const functionName = `${plugin.replace("@elizaos/plugin-", "").replace("@elizaos-plugins/", "").replace(/-./g, (x) => x[1].toUpperCase())}Plugin`;
5209
5211
  return importedPlugin.default || importedPlugin[functionName];
5210
5212
  } catch (importError) {
5213
+ const nodeModulesPath = path2.join(process.cwd(), "node_modules");
5214
+ if (fs2.existsSync(nodeModulesPath)) {
5215
+ const pluginPath = path2.join(nodeModulesPath, plugin);
5216
+ if (fs2.existsSync(pluginPath)) {
5217
+ try {
5218
+ const importedPlugin = await import(pluginPath);
5219
+ return importedPlugin.default || importedPlugin[functionName];
5220
+ } catch (importError2) {
5221
+ logger_default.error(`Failed to import plugin: ${plugin}`, importError2);
5222
+ return [];
5223
+ }
5224
+ }
5225
+ }
5211
5226
  logger_default.error(`Failed to import plugin: ${plugin}`, importError);
5212
5227
  return [];
5213
5228
  }