@easynet/agent-tool 1.0.37 → 1.0.39

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 (43) hide show
  1. package/dist/api/createAgentTools.d.ts.map +1 -1
  2. package/dist/api/expose/extension-init/initExtension.d.ts +2 -0
  3. package/dist/api/expose/extension-init/initExtension.d.ts.map +1 -1
  4. package/dist/api/main.cjs +14 -14
  5. package/dist/api/main.js +3 -3
  6. package/dist/api/runtimeFromConfig.d.ts +2 -0
  7. package/dist/api/runtimeFromConfig.d.ts.map +1 -1
  8. package/dist/{chunk-WFRHBW32.cjs → chunk-23KQ6MPJ.cjs} +9 -9
  9. package/dist/{chunk-WFRHBW32.cjs.map → chunk-23KQ6MPJ.cjs.map} +1 -1
  10. package/dist/{chunk-DTWOUO7M.cjs → chunk-5BYLYZ22.cjs} +7 -7
  11. package/dist/{chunk-DTWOUO7M.cjs.map → chunk-5BYLYZ22.cjs.map} +1 -1
  12. package/dist/{chunk-4HPV2K7P.cjs → chunk-HUUG5MZ7.cjs} +21 -16
  13. package/dist/chunk-HUUG5MZ7.cjs.map +1 -0
  14. package/dist/{chunk-LP7KHBA3.cjs → chunk-JGQVKMRY.cjs} +54 -6
  15. package/dist/chunk-JGQVKMRY.cjs.map +1 -0
  16. package/dist/{chunk-HEMWFWSK.js → chunk-JRT4FEQB.js} +3 -3
  17. package/dist/{chunk-HEMWFWSK.js.map → chunk-JRT4FEQB.js.map} +1 -1
  18. package/dist/{chunk-NJ46JOBI.js → chunk-OAZPWIHV.js} +3 -3
  19. package/dist/{chunk-NJ46JOBI.js.map → chunk-OAZPWIHV.js.map} +1 -1
  20. package/dist/{chunk-NCPOKCX5.js → chunk-TRJL2ZIH.js} +10 -5
  21. package/dist/chunk-TRJL2ZIH.js.map +1 -0
  22. package/dist/{chunk-7VBJ64YC.js → chunk-YZLDVSS4.js} +52 -6
  23. package/dist/chunk-YZLDVSS4.js.map +1 -0
  24. package/dist/index.cjs +59 -90
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +7 -45
  29. package/dist/index.js.map +1 -1
  30. package/dist/security/sandbox.d.ts +1 -0
  31. package/dist/security/sandbox.d.ts.map +1 -1
  32. package/dist/tools/util/toolConfig.d.ts +2 -0
  33. package/dist/tools/util/toolConfig.d.ts.map +1 -1
  34. package/dist/utils/cli/index.cjs +42 -28
  35. package/dist/utils/cli/index.cjs.map +1 -1
  36. package/dist/utils/cli/index.d.ts.map +1 -1
  37. package/dist/utils/cli/index.js +29 -15
  38. package/dist/utils/cli/index.js.map +1 -1
  39. package/package.json +1 -1
  40. package/dist/chunk-4HPV2K7P.cjs.map +0 -1
  41. package/dist/chunk-7VBJ64YC.js.map +0 -1
  42. package/dist/chunk-LP7KHBA3.cjs.map +0 -1
  43. package/dist/chunk-NCPOKCX5.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,15 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunk4HPV2K7P_cjs = require('./chunk-4HPV2K7P.cjs');
4
- var chunkWFRHBW32_cjs = require('./chunk-WFRHBW32.cjs');
5
- var chunkLP7KHBA3_cjs = require('./chunk-LP7KHBA3.cjs');
3
+ var chunkHUUG5MZ7_cjs = require('./chunk-HUUG5MZ7.cjs');
4
+ var chunk23KQ6MPJ_cjs = require('./chunk-23KQ6MPJ.cjs');
5
+ var chunkJGQVKMRY_cjs = require('./chunk-JGQVKMRY.cjs');
6
6
  var chunkTOSPHMYU_cjs = require('./chunk-TOSPHMYU.cjs');
7
7
  var chunkDYDNPIV2_cjs = require('./chunk-DYDNPIV2.cjs');
8
8
  require('./chunk-UUNG3GL3.cjs');
9
9
  var promises = require('dns/promises');
10
- var path6 = require('path');
11
- var promises$1 = require('fs/promises');
12
10
  var async_hooks = require('async_hooks');
11
+ var path6 = require('path');
13
12
  var url = require('url');
14
13
  var fs = require('fs');
15
14
  var yaml = require('js-yaml');
@@ -193,43 +192,6 @@ function expandIpv6(ip) {
193
192
  for (let i = 0; i < right.length; i++) bytes[16 - right.length + i] = right[i];
194
193
  return bytes;
195
194
  }
196
- async function resolveSandboxedPath(inputPath, sandboxRoot) {
197
- let normalizedRoot;
198
- try {
199
- normalizedRoot = await promises$1.realpath(path6.resolve(sandboxRoot));
200
- } catch {
201
- normalizedRoot = path6.normalize(path6.resolve(sandboxRoot));
202
- }
203
- const resolved = path6.resolve(normalizedRoot, inputPath);
204
- let real;
205
- try {
206
- await promises$1.access(resolved);
207
- real = await promises$1.realpath(resolved);
208
- } catch {
209
- const parentDir = path6.dirname(resolved);
210
- let realParent;
211
- try {
212
- await promises$1.access(parentDir);
213
- realParent = await promises$1.realpath(parentDir);
214
- } catch {
215
- realParent = path6.normalize(parentDir);
216
- }
217
- real = path6.resolve(realParent, path6.basename(resolved));
218
- }
219
- if (!isWithinRoot(real, normalizedRoot)) {
220
- throw chunkTOSPHMYU_cjs.createTaggedError(
221
- "PATH_OUTSIDE_SANDBOX",
222
- `Path "${inputPath}" resolves to "${real}" which is outside sandbox "${normalizedRoot}"`,
223
- { inputPath, resolvedPath: real, sandboxRoot: normalizedRoot }
224
- );
225
- }
226
- return real;
227
- }
228
- function isWithinRoot(path7, root) {
229
- const normalizedPath = path6.normalize(path7);
230
- const normalizedRoot = path6.normalize(root);
231
- return normalizedPath === normalizedRoot || normalizedPath.startsWith(normalizedRoot + "/");
232
- }
233
195
  function createContextRunner() {
234
196
  const storage = new async_hooks.AsyncLocalStorage();
235
197
  return {
@@ -481,7 +443,7 @@ function generateExtensionManifest(projectRoot = process.cwd(), options = {}) {
481
443
  const root = path6__default.default.resolve(projectRoot);
482
444
  const outDir = path6__default.default.resolve(options.outDir ?? path6__default.default.join(root, "dist"));
483
445
  const kind = options.kind ?? "core";
484
- const { specs, errors } = chunkWFRHBW32_cjs.scanForTools({
446
+ const { specs, errors } = chunk23KQ6MPJ_cjs.scanForTools({
485
447
  projectPath: root,
486
448
  include: options.include ?? ["**/*.ts"],
487
449
  tsconfigPath: options.tsconfigPath
@@ -571,7 +533,7 @@ var MCPClientAdapter = class {
571
533
  constructor(client) {
572
534
  this.client = client;
573
535
  }
574
- kind = chunkLP7KHBA3_cjs.MCP_KIND;
536
+ kind = chunkJGQVKMRY_cjs.MCP_KIND;
575
537
  async invoke(spec, args, _ctx) {
576
538
  const params = args != null && typeof args === "object" && !Array.isArray(args) ? args : {};
577
539
  const result = await this.client.callTool({ name: spec.name, arguments: params });
@@ -612,7 +574,7 @@ function mcpToolsToSpecs(tools) {
612
574
  return tools.map((t) => ({
613
575
  name: t.name,
614
576
  version: "1.0.0",
615
- kind: chunkLP7KHBA3_cjs.MCP_KIND,
577
+ kind: chunkJGQVKMRY_cjs.MCP_KIND,
616
578
  description: t.description ?? `MCP tool: ${t.name}`,
617
579
  inputSchema: t.inputSchema ?? chunkDYDNPIV2_cjs.DEFAULT_INPUT_SCHEMA,
618
580
  outputSchema: chunkDYDNPIV2_cjs.DEFAULT_OUTPUT_SCHEMA,
@@ -652,8 +614,8 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
652
614
  const configPath = options.configPath ?? process.env.MCP_CONFIG_PATH ?? path6.join(process.cwd(), "mcp.json");
653
615
  const dirPath = path6.dirname(configPath);
654
616
  const entryPoint = path6.basename(configPath);
655
- const toolName = options.toolName ?? chunkLP7KHBA3_cjs.MCP_KIND;
656
- const loaded = await chunkWFRHBW32_cjs.loadMCPTool(dirPath, { kind: chunkLP7KHBA3_cjs.MCP_KIND, name: toolName, entryPoint });
617
+ const toolName = options.toolName ?? chunkJGQVKMRY_cjs.MCP_KIND;
618
+ const loaded = await chunk23KQ6MPJ_cjs.loadMCPTool(dirPath, { kind: chunkJGQVKMRY_cjs.MCP_KIND, name: toolName, entryPoint });
657
619
  if (!loaded.mcpConfig) {
658
620
  throw new Error("mcp.json must have command or url");
659
621
  }
@@ -669,171 +631,179 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
669
631
 
670
632
  Object.defineProperty(exports, "LangChainToolsHub", {
671
633
  enumerable: true,
672
- get: function () { return chunk4HPV2K7P_cjs.LangChainToolsHub; }
634
+ get: function () { return chunkHUUG5MZ7_cjs.LangChainToolsHub; }
673
635
  });
674
636
  Object.defineProperty(exports, "createAgentTools", {
675
637
  enumerable: true,
676
- get: function () { return chunk4HPV2K7P_cjs.createAgentTools; }
638
+ get: function () { return chunkHUUG5MZ7_cjs.createAgentTools; }
677
639
  });
678
640
  Object.defineProperty(exports, "DirectoryScanner", {
679
641
  enumerable: true,
680
- get: function () { return chunkWFRHBW32_cjs.DirectoryScanner; }
642
+ get: function () { return chunk23KQ6MPJ_cjs.DirectoryScanner; }
681
643
  });
682
644
  Object.defineProperty(exports, "DiscoveryError", {
683
645
  enumerable: true,
684
- get: function () { return chunkWFRHBW32_cjs.DiscoveryError; }
646
+ get: function () { return chunk23KQ6MPJ_cjs.DiscoveryError; }
685
647
  });
686
648
  Object.defineProperty(exports, "SkillManifestError", {
687
649
  enumerable: true,
688
- get: function () { return chunkWFRHBW32_cjs.SkillManifestError; }
650
+ get: function () { return chunk23KQ6MPJ_cjs.SkillManifestError; }
689
651
  });
690
652
  Object.defineProperty(exports, "buildFunctionToTool", {
691
653
  enumerable: true,
692
- get: function () { return chunkWFRHBW32_cjs.buildFunctionToTool; }
654
+ get: function () { return chunk23KQ6MPJ_cjs.buildFunctionToTool; }
693
655
  });
694
656
  Object.defineProperty(exports, "buildMcpPackage", {
695
657
  enumerable: true,
696
- get: function () { return chunkWFRHBW32_cjs.buildMcpPackage; }
658
+ get: function () { return chunk23KQ6MPJ_cjs.buildMcpPackage; }
697
659
  });
698
660
  Object.defineProperty(exports, "initProject", {
699
661
  enumerable: true,
700
- get: function () { return chunkWFRHBW32_cjs.initProject; }
662
+ get: function () { return chunk23KQ6MPJ_cjs.initProject; }
701
663
  });
702
664
  Object.defineProperty(exports, "loadMCPTool", {
703
665
  enumerable: true,
704
- get: function () { return chunkWFRHBW32_cjs.loadMCPTool; }
666
+ get: function () { return chunk23KQ6MPJ_cjs.loadMCPTool; }
705
667
  });
706
668
  Object.defineProperty(exports, "loadSkillDefinition", {
707
669
  enumerable: true,
708
- get: function () { return chunkWFRHBW32_cjs.loadSkillDefinition; }
670
+ get: function () { return chunk23KQ6MPJ_cjs.loadSkillDefinition; }
709
671
  });
710
672
  Object.defineProperty(exports, "parseSkillMd", {
711
673
  enumerable: true,
712
- get: function () { return chunkWFRHBW32_cjs.parseSkillMd; }
674
+ get: function () { return chunk23KQ6MPJ_cjs.parseSkillMd; }
713
675
  });
714
676
  Object.defineProperty(exports, "runGeneratedMCP", {
715
677
  enumerable: true,
716
- get: function () { return chunkWFRHBW32_cjs.runGeneratedMCP; }
678
+ get: function () { return chunk23KQ6MPJ_cjs.runGeneratedMCP; }
717
679
  });
718
680
  Object.defineProperty(exports, "runMcpServer", {
719
681
  enumerable: true,
720
- get: function () { return chunkWFRHBW32_cjs.runMcpServer; }
682
+ get: function () { return chunk23KQ6MPJ_cjs.runMcpServer; }
721
683
  });
722
684
  Object.defineProperty(exports, "scan", {
723
685
  enumerable: true,
724
- get: function () { return chunkWFRHBW32_cjs.scan; }
686
+ get: function () { return chunk23KQ6MPJ_cjs.scan; }
725
687
  });
726
688
  Object.defineProperty(exports, "scanForTools", {
727
689
  enumerable: true,
728
- get: function () { return chunkWFRHBW32_cjs.scanForTools; }
690
+ get: function () { return chunk23KQ6MPJ_cjs.scanForTools; }
729
691
  });
730
692
  Object.defineProperty(exports, "scanSkillResources", {
731
693
  enumerable: true,
732
- get: function () { return chunkWFRHBW32_cjs.scanSkillResources; }
694
+ get: function () { return chunk23KQ6MPJ_cjs.scanSkillResources; }
733
695
  });
734
696
  Object.defineProperty(exports, "validateFrontmatter", {
735
697
  enumerable: true,
736
- get: function () { return chunkWFRHBW32_cjs.validateFrontmatter; }
698
+ get: function () { return chunk23KQ6MPJ_cjs.validateFrontmatter; }
737
699
  });
738
700
  Object.defineProperty(exports, "BudgetManager", {
739
701
  enumerable: true,
740
- get: function () { return chunkLP7KHBA3_cjs.BudgetManager; }
702
+ get: function () { return chunkJGQVKMRY_cjs.BudgetManager; }
741
703
  });
742
704
  Object.defineProperty(exports, "EventLog", {
743
705
  enumerable: true,
744
- get: function () { return chunkLP7KHBA3_cjs.EventLog; }
706
+ get: function () { return chunkJGQVKMRY_cjs.EventLog; }
745
707
  });
746
708
  Object.defineProperty(exports, "Metrics", {
747
709
  enumerable: true,
748
- get: function () { return chunkLP7KHBA3_cjs.Metrics; }
710
+ get: function () { return chunkJGQVKMRY_cjs.Metrics; }
749
711
  });
750
712
  Object.defineProperty(exports, "PTCRuntime", {
751
713
  enumerable: true,
752
- get: function () { return chunkLP7KHBA3_cjs.PTCRuntime; }
714
+ get: function () { return chunkJGQVKMRY_cjs.PTCRuntime; }
753
715
  });
754
716
  Object.defineProperty(exports, "PolicyDeniedError", {
755
717
  enumerable: true,
756
- get: function () { return chunkLP7KHBA3_cjs.PolicyDeniedError; }
718
+ get: function () { return chunkJGQVKMRY_cjs.PolicyDeniedError; }
757
719
  });
758
720
  Object.defineProperty(exports, "PolicyEngine", {
759
721
  enumerable: true,
760
- get: function () { return chunkLP7KHBA3_cjs.PolicyEngine; }
722
+ get: function () { return chunkJGQVKMRY_cjs.PolicyEngine; }
761
723
  });
762
724
  Object.defineProperty(exports, "SchemaValidationError", {
763
725
  enumerable: true,
764
- get: function () { return chunkLP7KHBA3_cjs.SchemaValidationError; }
726
+ get: function () { return chunkJGQVKMRY_cjs.SchemaValidationError; }
765
727
  });
766
728
  Object.defineProperty(exports, "SchemaValidator", {
767
729
  enumerable: true,
768
- get: function () { return chunkLP7KHBA3_cjs.SchemaValidator; }
730
+ get: function () { return chunkJGQVKMRY_cjs.SchemaValidator; }
769
731
  });
770
732
  Object.defineProperty(exports, "Tracing", {
771
733
  enumerable: true,
772
- get: function () { return chunkLP7KHBA3_cjs.Tracing; }
734
+ get: function () { return chunkJGQVKMRY_cjs.Tracing; }
773
735
  });
774
736
  Object.defineProperty(exports, "buildEvidence", {
775
737
  enumerable: true,
776
- get: function () { return chunkLP7KHBA3_cjs.buildEvidence; }
738
+ get: function () { return chunkJGQVKMRY_cjs.buildEvidence; }
777
739
  });
778
740
  Object.defineProperty(exports, "createLogger", {
779
741
  enumerable: true,
780
- get: function () { return chunkLP7KHBA3_cjs.createLogger; }
742
+ get: function () { return chunkJGQVKMRY_cjs.createLogger; }
781
743
  });
782
744
  Object.defineProperty(exports, "ensurePackageInCache", {
783
745
  enumerable: true,
784
- get: function () { return chunkLP7KHBA3_cjs.ensurePackageInCache; }
746
+ get: function () { return chunkJGQVKMRY_cjs.ensurePackageInCache; }
785
747
  });
786
748
  Object.defineProperty(exports, "expandToolDescriptorsToRegistryNames", {
787
749
  enumerable: true,
788
- get: function () { return chunkLP7KHBA3_cjs.expandToolDescriptorsToRegistryNames; }
750
+ get: function () { return chunkJGQVKMRY_cjs.expandToolDescriptorsToRegistryNames; }
789
751
  });
790
752
  Object.defineProperty(exports, "getPackageEntryPath", {
791
753
  enumerable: true,
792
- get: function () { return chunkLP7KHBA3_cjs.getPackageEntryPath; }
754
+ get: function () { return chunkJGQVKMRY_cjs.getPackageEntryPath; }
793
755
  });
794
756
  Object.defineProperty(exports, "importFromCache", {
795
757
  enumerable: true,
796
- get: function () { return chunkLP7KHBA3_cjs.importFromCache; }
758
+ get: function () { return chunkJGQVKMRY_cjs.importFromCache; }
797
759
  });
798
760
  Object.defineProperty(exports, "isNpmToolDescriptor", {
799
761
  enumerable: true,
800
- get: function () { return chunkLP7KHBA3_cjs.isNpmToolDescriptor; }
762
+ get: function () { return chunkJGQVKMRY_cjs.isNpmToolDescriptor; }
801
763
  });
802
764
  Object.defineProperty(exports, "loadToolConfig", {
803
765
  enumerable: true,
804
- get: function () { return chunkLP7KHBA3_cjs.loadToolConfig; }
766
+ get: function () { return chunkJGQVKMRY_cjs.loadToolConfig; }
805
767
  });
806
768
  Object.defineProperty(exports, "normalizeToolList", {
807
769
  enumerable: true,
808
- get: function () { return chunkLP7KHBA3_cjs.normalizeToolList; }
770
+ get: function () { return chunkJGQVKMRY_cjs.normalizeToolList; }
809
771
  });
810
772
  Object.defineProperty(exports, "npmDescriptorToRegistryPrefix", {
811
773
  enumerable: true,
812
- get: function () { return chunkLP7KHBA3_cjs.npmDescriptorToRegistryPrefix; }
774
+ get: function () { return chunkJGQVKMRY_cjs.npmDescriptorToRegistryPrefix; }
813
775
  });
814
776
  Object.defineProperty(exports, "parseNpmToolDescriptor", {
815
777
  enumerable: true,
816
- get: function () { return chunkLP7KHBA3_cjs.parseNpmToolDescriptor; }
778
+ get: function () { return chunkJGQVKMRY_cjs.parseNpmToolDescriptor; }
817
779
  });
818
780
  Object.defineProperty(exports, "resolveLatestVersionFromRegistry", {
819
781
  enumerable: true,
820
- get: function () { return chunkLP7KHBA3_cjs.resolveLatestVersionFromRegistry; }
782
+ get: function () { return chunkJGQVKMRY_cjs.resolveLatestVersionFromRegistry; }
821
783
  });
822
784
  Object.defineProperty(exports, "resolveNpmToolDescriptor", {
823
785
  enumerable: true,
824
- get: function () { return chunkLP7KHBA3_cjs.resolveNpmToolDescriptor; }
786
+ get: function () { return chunkJGQVKMRY_cjs.resolveNpmToolDescriptor; }
787
+ });
788
+ Object.defineProperty(exports, "resolveSandboxedPath", {
789
+ enumerable: true,
790
+ get: function () { return chunkJGQVKMRY_cjs.resolveSandboxedPath; }
825
791
  });
826
792
  Object.defineProperty(exports, "resolveToolDescriptor", {
827
793
  enumerable: true,
828
- get: function () { return chunkLP7KHBA3_cjs.resolveToolDescriptor; }
794
+ get: function () { return chunkJGQVKMRY_cjs.resolveToolDescriptor; }
829
795
  });
830
796
  Object.defineProperty(exports, "sanitizeForLog", {
831
797
  enumerable: true,
832
- get: function () { return chunkLP7KHBA3_cjs.sanitizeForLog; }
798
+ get: function () { return chunkJGQVKMRY_cjs.sanitizeForLog; }
799
+ });
800
+ Object.defineProperty(exports, "setSandboxValidationEnabled", {
801
+ enumerable: true,
802
+ get: function () { return chunkJGQVKMRY_cjs.setSandboxValidationEnabled; }
833
803
  });
834
804
  Object.defineProperty(exports, "summarizeForLog", {
835
805
  enumerable: true,
836
- get: function () { return chunkLP7KHBA3_cjs.summarizeForLog; }
806
+ get: function () { return chunkJGQVKMRY_cjs.summarizeForLog; }
837
807
  });
838
808
  Object.defineProperty(exports, "ToolRegistry", {
839
809
  enumerable: true,
@@ -885,7 +855,6 @@ exports.registerExtension = registerExtension;
885
855
  exports.registerMCPToolsFromConfig = registerMCPToolsFromConfig;
886
856
  exports.registerToolsFromManifest = registerToolsFromManifest;
887
857
  exports.resolveExtensionPackageRoot = resolveExtensionPackageRoot;
888
- exports.resolveSandboxedPath = resolveSandboxedPath;
889
858
  exports.validateUrl = validateUrl;
890
859
  //# sourceMappingURL=index.cjs.map
891
860
  //# sourceMappingURL=index.cjs.map