@easynet/agent-tool 1.0.98 → 1.0.99

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.
@@ -1886,7 +1886,7 @@ async function importFromCache(packageRoot) {
1886
1886
  fileUrl
1887
1887
  );
1888
1888
  }
1889
- var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-GNYBAJZZ.cjs', document.baseURI).href)));
1889
+ var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-TJUWCIYZ.cjs', document.baseURI).href)));
1890
1890
  function getProjectRequire() {
1891
1891
  const cwd = process.cwd();
1892
1892
  if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
@@ -2052,7 +2052,7 @@ function parseNpmDescriptor(entry) {
2052
2052
  }
2053
2053
 
2054
2054
  // src/api/runtimeFromConfig.ts
2055
- var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-GNYBAJZZ.cjs', document.baseURI).href)));
2055
+ var requireFromPackage2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-TJUWCIYZ.cjs', document.baseURI).href)));
2056
2056
  var DEFAULT_EXTENSION_PACKAGES = [];
2057
2057
  function resolveFileDescriptorPath(descriptor, configFilePath) {
2058
2058
  const parsed = parseToolPath(descriptor.trim());
@@ -2099,7 +2099,34 @@ function loadExtensionFromFileDescriptorSync(descriptor, configFilePath, stepLog
2099
2099
  if (stepLog) stepLog(`Loaded local extension from ${resolvedPath}`);
2100
2100
  return { register: fn, descriptor: entryStr, resolvedVersion: "local", packageRoot: resolvedPath };
2101
2101
  }
2102
- } catch {
2102
+ } catch (error) {
2103
+ if (stepLog) {
2104
+ stepLog(`Failed to load local extension from ${resolvedPath}: ${error instanceof Error ? error.message : String(error)}`);
2105
+ }
2106
+ }
2107
+ return null;
2108
+ }
2109
+ async function loadExtensionFromFileDescriptorAsync(descriptor, configFilePath, stepLog) {
2110
+ const entryStr = descriptor.trim();
2111
+ const path2 = parseToolPath(entryStr);
2112
+ if (!path2 || path2.protocol !== "file") return null;
2113
+ const localPath = path.isAbsolute(configFilePath) ? configFilePath : path.resolve(process.cwd(), configFilePath);
2114
+ const configDir = path.dirname(localPath);
2115
+ const pathPart = `${path2.scope}/${path2.packageWithVersion}`;
2116
+ const resolvedPath = path.resolve(configDir, pathPart);
2117
+ if (!fs.existsSync(resolvedPath) || !fs.statSync(resolvedPath).isDirectory()) return null;
2118
+ try {
2119
+ const entryPath = getPackageEntryPath(resolvedPath);
2120
+ const mod = await import(url.pathToFileURL(entryPath).href);
2121
+ const fn = getRegisterFn(mod);
2122
+ if (typeof fn === "function") {
2123
+ if (stepLog) stepLog(`Loaded local extension from ${resolvedPath} (async import)`);
2124
+ return { register: fn, descriptor: entryStr, resolvedVersion: "local", packageRoot: resolvedPath };
2125
+ }
2126
+ } catch (error) {
2127
+ if (stepLog) {
2128
+ stepLog(`Failed to load local extension from ${resolvedPath}: ${error instanceof Error ? error.message : String(error)}`);
2129
+ }
2103
2130
  }
2104
2131
  return null;
2105
2132
  }
@@ -2268,7 +2295,7 @@ async function loadAllExtensionsFromToolYamlAsync(configFilePath, stepLog) {
2268
2295
  const result = await loadExtensionForDescriptorAsync(entryStr, configFilePath, stepLog);
2269
2296
  if (result) loaded.push(result);
2270
2297
  } else if (entryStr.startsWith("file:")) {
2271
- const result = loadExtensionFromFileDescriptorSync(entryStr, configFilePath, stepLog);
2298
+ const result = await loadExtensionFromFileDescriptorAsync(entryStr, configFilePath, stepLog);
2272
2299
  if (result) {
2273
2300
  loaded.push(result);
2274
2301
  } else {
@@ -2935,5 +2962,5 @@ exports.resolveSandboxedPath = resolveSandboxedPath;
2935
2962
  exports.resolveToolDescriptor = resolveToolDescriptor;
2936
2963
  exports.runMCPServerOverStdio = runMCPServerOverStdio;
2937
2964
  exports.toToolObservationText = toToolObservationText;
2938
- //# sourceMappingURL=chunk-GNYBAJZZ.cjs.map
2939
- //# sourceMappingURL=chunk-GNYBAJZZ.cjs.map
2965
+ //# sourceMappingURL=chunk-TJUWCIYZ.cjs.map
2966
+ //# sourceMappingURL=chunk-TJUWCIYZ.cjs.map