@easynet/agent-tool 1.0.0 → 1.0.2
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/README.md +90 -73
- package/dist/api/adapters/LangChainToolsHub.d.ts +34 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -0
- package/dist/api/createAgentTools.d.ts +24 -0
- package/dist/api/createAgentTools.d.ts.map +1 -0
- package/dist/api/expose/index.d.ts +16 -0
- package/dist/api/expose/index.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/build.d.ts.map +1 -0
- package/dist/{codegen → api/expose/mcp-build}/generator.d.ts +3 -3
- package/dist/api/expose/mcp-build/generator.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/index.d.ts +8 -0
- package/dist/api/expose/mcp-build/index.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/init.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/run.d.ts.map +1 -0
- package/dist/api/expose/mcp-build/types.d.ts +25 -0
- package/dist/api/expose/mcp-build/types.d.ts.map +1 -0
- package/dist/api/expose/mcpServer.d.ts +75 -0
- package/dist/api/expose/mcpServer.d.ts.map +1 -0
- package/dist/api/expose/openapi.d.ts +23 -0
- package/dist/api/expose/openapi.d.ts.map +1 -0
- package/dist/api/expose/openapiHttp.d.ts +67 -0
- package/dist/api/expose/openapiHttp.d.ts.map +1 -0
- package/dist/api/main.cjs +56 -0
- package/dist/api/main.cjs.map +1 -0
- package/dist/api/main.d.ts +23 -0
- package/dist/api/main.d.ts.map +1 -0
- package/dist/api/main.js +7 -0
- package/dist/api/main.js.map +1 -0
- package/dist/api/runtimeFromConfig.d.ts +34 -0
- package/dist/api/runtimeFromConfig.d.ts.map +1 -0
- package/dist/canonicalCoreSchemas-CTW6CCFY.cjs +20 -0
- package/dist/canonicalCoreSchemas-CTW6CCFY.cjs.map +1 -0
- package/dist/canonicalCoreSchemas-YLHVHYJZ.js +3 -0
- package/dist/canonicalCoreSchemas-YLHVHYJZ.js.map +1 -0
- package/dist/{chunk-AXUNV4MK.js → chunk-5SWSNVMI.js} +3 -3
- package/dist/chunk-5SWSNVMI.js.map +1 -0
- package/dist/chunk-6F5JHLZ7.cjs +243 -0
- package/dist/chunk-6F5JHLZ7.cjs.map +1 -0
- package/dist/chunk-AE6FSNGY.js +201 -0
- package/dist/chunk-AE6FSNGY.js.map +1 -0
- package/dist/chunk-BZOKPJMP.cjs +120 -0
- package/dist/chunk-BZOKPJMP.cjs.map +1 -0
- package/dist/chunk-FA2ZEICE.cjs +1620 -0
- package/dist/chunk-FA2ZEICE.cjs.map +1 -0
- package/dist/chunk-FR2CXERF.js +239 -0
- package/dist/chunk-FR2CXERF.js.map +1 -0
- package/dist/chunk-MGEQPAHV.cjs +475 -0
- package/dist/chunk-MGEQPAHV.cjs.map +1 -0
- package/dist/{chunk-BM4EVYI5.js → chunk-PJ4RUBZL.js} +836 -122
- package/dist/chunk-PJ4RUBZL.js.map +1 -0
- package/dist/chunk-Q7KPGWC6.js +1584 -0
- package/dist/chunk-Q7KPGWC6.js.map +1 -0
- package/dist/chunk-QVH6IQKQ.js +469 -0
- package/dist/chunk-QVH6IQKQ.js.map +1 -0
- package/dist/{chunk-3YLVPZRJ.cjs → chunk-SOFUWEZ6.cjs} +3 -3
- package/dist/chunk-SOFUWEZ6.cjs.map +1 -0
- package/dist/chunk-TBMWJWQ2.js +116 -0
- package/dist/chunk-TBMWJWQ2.js.map +1 -0
- package/dist/{chunk-Z7TGIG77.cjs → chunk-ZBNRHRGM.cjs} +843 -127
- package/dist/chunk-ZBNRHRGM.cjs.map +1 -0
- package/dist/chunk-ZNJBRLKN.cjs +210 -0
- package/dist/chunk-ZNJBRLKN.cjs.map +1 -0
- package/dist/core/index.cjs +20 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/{core.d.ts → core/index.d.ts} +2 -3
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +3 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/registry/ToolRegistry.d.ts.map +1 -0
- package/dist/core/runtime/Budget.d.ts.map +1 -0
- package/dist/core/runtime/Evidence.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntime.d.ts +4 -4
- package/dist/core/runtime/PTCRuntime.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntimeObservability.d.ts +4 -4
- package/dist/core/runtime/PTCRuntimeObservability.d.ts.map +1 -0
- package/dist/{runtime → core/runtime}/PTCRuntimePipeline.d.ts +4 -4
- package/dist/core/runtime/PTCRuntimePipeline.d.ts.map +1 -0
- package/dist/core/runtime/PolicyEngine.d.ts.map +1 -0
- package/dist/core/runtime/Retry.d.ts.map +1 -0
- package/dist/core/runtime/SchemaValidator.d.ts.map +1 -0
- package/dist/core/runtime.cjs +24 -0
- package/dist/core/runtime.cjs.map +1 -0
- package/dist/core/runtime.d.ts +12 -0
- package/dist/core/runtime.d.ts.map +1 -0
- package/dist/core/runtime.js +3 -0
- package/dist/core/runtime.js.map +1 -0
- package/dist/core/types/Events.d.ts.map +1 -0
- package/dist/core/types/ToolIntent.d.ts.map +1 -0
- package/dist/{types → core/types}/ToolResult.d.ts +6 -1
- package/dist/core/types/ToolResult.d.ts.map +1 -0
- package/dist/{types → core/types}/ToolSpec.d.ts +15 -5
- package/dist/core/types/ToolSpec.d.ts.map +1 -0
- package/dist/core/types/ToolTypeHandler.d.ts +88 -0
- package/dist/core/types/ToolTypeHandler.d.ts.map +1 -0
- package/dist/{types → core/types}/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/index.cjs +249 -2749
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +61 -55
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -2688
- package/dist/index.js.map +1 -1
- package/dist/observability/EventLog.d.ts +1 -1
- package/dist/observability/EventLog.d.ts.map +1 -1
- package/dist/tools/discoveryFactory.d.ts +117 -0
- package/dist/tools/discoveryFactory.d.ts.map +1 -0
- package/dist/tools/function/index.d.ts +10 -0
- package/dist/tools/function/index.d.ts.map +1 -0
- package/dist/{codegen/scan → tools/function}/scanner.d.ts +5 -2
- package/dist/{codegen/scan → tools/function}/scanner.d.ts.map +1 -1
- package/dist/{codegen/scan → tools/function}/schemaFromTs.d.ts +1 -1
- package/dist/tools/function/schemaFromTs.d.ts.map +1 -0
- package/dist/tools/function/types.d.ts +20 -0
- package/dist/tools/function/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/{discovery/load → tools/langchain}/LangChainLoader.d.ts +1 -1
- package/dist/tools/langchain/LangChainLoader.d.ts.map +1 -0
- package/dist/tools/langchain/directoryApply.d.ts +5 -0
- package/dist/tools/langchain/directoryApply.d.ts.map +1 -0
- package/dist/tools/langchain/directoryLoad.d.ts +13 -0
- package/dist/tools/langchain/directoryLoad.d.ts.map +1 -0
- package/dist/tools/langchain/index.d.ts +3 -0
- package/dist/tools/langchain/index.d.ts.map +1 -0
- package/dist/tools/langchain/scanner.d.ts +8 -0
- package/dist/tools/langchain/scanner.d.ts.map +1 -0
- package/dist/tools/langchain/types.d.ts +5 -0
- package/dist/tools/langchain/types.d.ts.map +1 -0
- package/dist/{mcp → tools/mcp}/MCPClientAdapter.d.ts +3 -3
- package/dist/tools/mcp/MCPClientAdapter.d.ts.map +1 -0
- package/dist/{discovery/load → tools/mcp}/MCPLoader.d.ts +1 -1
- package/dist/tools/mcp/MCPLoader.d.ts.map +1 -0
- package/dist/tools/mcp/MCPProcessManager.d.ts +29 -0
- package/dist/tools/mcp/MCPProcessManager.d.ts.map +1 -0
- package/dist/{mcp → tools/mcp}/connectMCP.d.ts +3 -3
- package/dist/tools/mcp/connectMCP.d.ts.map +1 -0
- package/dist/tools/mcp/directoryApply.d.ts +10 -0
- package/dist/tools/mcp/directoryApply.d.ts.map +1 -0
- package/dist/{mcp → tools/mcp}/index.d.ts +6 -1
- package/dist/tools/mcp/index.d.ts.map +1 -0
- package/dist/tools/mcp/mcpSpecToToolSpec.d.ts +8 -0
- package/dist/tools/mcp/mcpSpecToToolSpec.d.ts.map +1 -0
- package/dist/{mcp → tools/mcp}/registerMCPTools.d.ts +2 -2
- package/dist/tools/mcp/registerMCPTools.d.ts.map +1 -0
- package/dist/tools/mcp/scanner.d.ts +8 -0
- package/dist/tools/mcp/scanner.d.ts.map +1 -0
- package/dist/tools/mcp/types.d.ts +3 -0
- package/dist/tools/mcp/types.d.ts.map +1 -0
- package/dist/{discovery/load → tools/n8n}/N8nLoader.d.ts +3 -3
- package/dist/tools/n8n/N8nLoader.d.ts.map +1 -0
- package/dist/tools/n8n/directoryApply.d.ts +10 -0
- package/dist/tools/n8n/directoryApply.d.ts.map +1 -0
- package/dist/tools/n8n/index.d.ts +6 -0
- package/dist/tools/n8n/index.d.ts.map +1 -0
- package/dist/tools/n8n/scanN8n.d.ts +20 -0
- package/dist/tools/n8n/scanN8n.d.ts.map +1 -0
- package/dist/tools/n8n/types.d.ts +18 -0
- package/dist/tools/n8n/types.d.ts.map +1 -0
- package/dist/tools/scanPackage.d.ts +42 -0
- package/dist/tools/scanPackage.d.ts.map +1 -0
- package/dist/{discovery/load → tools/skill}/SkillLoader.d.ts +1 -1
- package/dist/tools/skill/SkillLoader.d.ts.map +1 -0
- package/dist/tools/skill/SkillManifest.d.ts.map +1 -0
- package/dist/tools/skill/SkillMdParser.d.ts.map +1 -0
- package/dist/tools/skill/directoryApply.d.ts +10 -0
- package/dist/tools/skill/directoryApply.d.ts.map +1 -0
- package/dist/tools/skill/index.d.ts +8 -0
- package/dist/tools/skill/index.d.ts.map +1 -0
- package/dist/tools/skill/scanSkill.d.ts +20 -0
- package/dist/tools/skill/scanSkill.d.ts.map +1 -0
- package/dist/tools/skill/types.d.ts +19 -0
- package/dist/tools/skill/types.d.ts.map +1 -0
- package/dist/tools/util/canonicalCoreSchemas.d.ts +19 -0
- package/dist/tools/util/canonicalCoreSchemas.d.ts.map +1 -0
- package/dist/tools/util/index.d.ts +13 -0
- package/dist/tools/util/index.d.ts.map +1 -0
- package/dist/tools/util/resolveEntry.d.ts +6 -0
- package/dist/tools/util/resolveEntry.d.ts.map +1 -0
- package/dist/tools/util/scanUtil.d.ts +9 -0
- package/dist/tools/util/scanUtil.d.ts.map +1 -0
- package/dist/tools/util/toolConfig.d.ts +32 -0
- package/dist/tools/util/toolConfig.d.ts.map +1 -0
- package/dist/tools/util/toolDescriptor.d.ts +92 -0
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -0
- package/dist/utils/cli/index.cjs +419 -0
- package/dist/utils/cli/index.cjs.map +1 -0
- package/dist/utils/cli/index.d.ts +9 -0
- package/dist/utils/cli/index.d.ts.map +1 -0
- package/dist/utils/cli/index.js +412 -0
- package/dist/utils/cli/index.js.map +1 -0
- package/dist/utils/cli/toolRuntime.d.ts +19 -0
- package/dist/utils/cli/toolRuntime.d.ts.map +1 -0
- package/dist/utils/npmCache.d.ts +28 -0
- package/dist/utils/npmCache.d.ts.map +1 -0
- package/package.json +20 -11
- package/dist/chunk-3YLVPZRJ.cjs.map +0 -1
- package/dist/chunk-AXUNV4MK.js.map +0 -1
- package/dist/chunk-BM4EVYI5.js.map +0 -1
- package/dist/chunk-P3UEAZHK.cjs +0 -171
- package/dist/chunk-P3UEAZHK.cjs.map +0 -1
- package/dist/chunk-RPAMQCFH.js +0 -167
- package/dist/chunk-RPAMQCFH.js.map +0 -1
- package/dist/chunk-Z7TGIG77.cjs.map +0 -1
- package/dist/cli.cjs +0 -154
- package/dist/cli.cjs.map +0 -1
- package/dist/cli.d.ts +0 -10
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -147
- package/dist/cli.js.map +0 -1
- package/dist/codegen/build.d.ts.map +0 -1
- package/dist/codegen/generator.d.ts.map +0 -1
- package/dist/codegen/index.d.ts +0 -21
- package/dist/codegen/index.d.ts.map +0 -1
- package/dist/codegen/init.d.ts.map +0 -1
- package/dist/codegen/run.d.ts.map +0 -1
- package/dist/codegen/scan/scanN8n.d.ts +0 -17
- package/dist/codegen/scan/scanN8n.d.ts.map +0 -1
- package/dist/codegen/scan/scanSkill.d.ts +0 -17
- package/dist/codegen/scan/scanSkill.d.ts.map +0 -1
- package/dist/codegen/scan/scanTools.d.ts +0 -31
- package/dist/codegen/scan/scanTools.d.ts.map +0 -1
- package/dist/codegen/scan/schemaFromTs.d.ts.map +0 -1
- package/dist/codegen/types.d.ts +0 -81
- package/dist/codegen/types.d.ts.map +0 -1
- package/dist/core.cjs +0 -20
- package/dist/core.cjs.map +0 -1
- package/dist/core.d.ts.map +0 -1
- package/dist/core.js +0 -3
- package/dist/core.js.map +0 -1
- package/dist/discovery/MCPProcessManager.d.ts +0 -57
- package/dist/discovery/MCPProcessManager.d.ts.map +0 -1
- package/dist/discovery/errors.d.ts +0 -13
- package/dist/discovery/errors.d.ts.map +0 -1
- package/dist/discovery/load/LangChainLoader.d.ts.map +0 -1
- package/dist/discovery/load/MCPLoader.d.ts.map +0 -1
- package/dist/discovery/load/N8nLoader.d.ts.map +0 -1
- package/dist/discovery/load/SkillLoader.d.ts.map +0 -1
- package/dist/discovery/load/SkillManifest.d.ts.map +0 -1
- package/dist/discovery/load/SkillMdParser.d.ts.map +0 -1
- package/dist/discovery/load/index.d.ts +0 -6
- package/dist/discovery/load/index.d.ts.map +0 -1
- package/dist/discovery/load/resolveEntry.d.ts +0 -7
- package/dist/discovery/load/resolveEntry.d.ts.map +0 -1
- package/dist/discovery/scan/DirectoryScanner.d.ts +0 -37
- package/dist/discovery/scan/DirectoryScanner.d.ts.map +0 -1
- package/dist/discovery/scan/scanUtil.d.ts +0 -16
- package/dist/discovery/scan/scanUtil.d.ts.map +0 -1
- package/dist/discovery/types.d.ts +0 -99
- package/dist/discovery/types.d.ts.map +0 -1
- package/dist/llm/AgentLLMAdapter.d.ts +0 -27
- package/dist/llm/AgentLLMAdapter.d.ts.map +0 -1
- package/dist/llm/LangChainToolsHub.d.ts +0 -31
- package/dist/llm/LangChainToolsHub.d.ts.map +0 -1
- package/dist/llm/OpenAICompatibleClient.d.ts +0 -64
- package/dist/llm/OpenAICompatibleClient.d.ts.map +0 -1
- package/dist/llm/ReActAgent.d.ts +0 -35
- package/dist/llm/ReActAgent.d.ts.map +0 -1
- package/dist/llm-export.cjs +0 -20
- package/dist/llm-export.cjs.map +0 -1
- package/dist/llm-export.d.ts +0 -9
- package/dist/llm-export.d.ts.map +0 -1
- package/dist/llm-export.js +0 -3
- package/dist/llm-export.js.map +0 -1
- package/dist/mcp/MCPClientAdapter.d.ts.map +0 -1
- package/dist/mcp/connectMCP.d.ts.map +0 -1
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/registerMCPTools.d.ts.map +0 -1
- package/dist/registry/ToolRegistry.d.ts.map +0 -1
- package/dist/report/AgentReportGenerator.d.ts +0 -53
- package/dist/report/AgentReportGenerator.d.ts.map +0 -1
- package/dist/report/agent-report-template.html +0 -362
- package/dist/report/index.d.ts +0 -3
- package/dist/report/index.d.ts.map +0 -1
- package/dist/report/types.d.ts +0 -101
- package/dist/report/types.d.ts.map +0 -1
- package/dist/runAgent.d.ts +0 -37
- package/dist/runAgent.d.ts.map +0 -1
- package/dist/runtime/Budget.d.ts.map +0 -1
- package/dist/runtime/Evidence.d.ts.map +0 -1
- package/dist/runtime/PTCRuntime.d.ts.map +0 -1
- package/dist/runtime/PTCRuntimeObservability.d.ts.map +0 -1
- package/dist/runtime/PTCRuntimePipeline.d.ts.map +0 -1
- package/dist/runtime/PolicyEngine.d.ts.map +0 -1
- package/dist/runtime/Retry.d.ts.map +0 -1
- package/dist/runtime/SchemaValidator.d.ts.map +0 -1
- package/dist/toolDescriptor.d.ts +0 -38
- package/dist/toolDescriptor.d.ts.map +0 -1
- package/dist/types/Events.d.ts.map +0 -1
- package/dist/types/ToolIntent.d.ts.map +0 -1
- package/dist/types/ToolResult.d.ts.map +0 -1
- package/dist/types/ToolSpec.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/extensions/examples/README.md +0 -40
- package/extensions/examples/scripts/agent-tool-react-stock.mjs +0 -30
- package/extensions/examples/tools/instruction-only/skill/SKILL.md +0 -26
- package/extensions/examples/tools/web-search/mcp/mcp.json +0 -8
- /package/dist/{codegen → api/expose/mcp-build}/build.d.ts +0 -0
- /package/dist/{codegen → api/expose/mcp-build}/init.d.ts +0 -0
- /package/dist/{codegen → api/expose/mcp-build}/run.d.ts +0 -0
- /package/dist/{registry → core/registry}/ToolRegistry.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Budget.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Evidence.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/PolicyEngine.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/Retry.d.ts +0 -0
- /package/dist/{runtime → core/runtime}/SchemaValidator.d.ts +0 -0
- /package/dist/{types → core/types}/Events.d.ts +0 -0
- /package/dist/{types → core/types}/ToolIntent.d.ts +0 -0
- /package/dist/{discovery/load → tools/skill}/SkillManifest.d.ts +0 -0
- /package/dist/{discovery/load → tools/skill}/SkillMdParser.d.ts +0 -0
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkSOFUWEZ6_cjs = require('./chunk-SOFUWEZ6.cjs');
|
|
4
|
+
var chunkFA2ZEICE_cjs = require('./chunk-FA2ZEICE.cjs');
|
|
3
5
|
var fs3 = require('fs/promises');
|
|
4
|
-
var
|
|
6
|
+
var path9 = require('path');
|
|
5
7
|
var fs2 = require('fs');
|
|
6
8
|
var ts2 = require('typescript');
|
|
7
9
|
var yaml = require('js-yaml');
|
|
@@ -30,12 +32,11 @@ function _interopNamespace(e) {
|
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
var fs3__namespace = /*#__PURE__*/_interopNamespace(fs3);
|
|
33
|
-
var
|
|
35
|
+
var path9__namespace = /*#__PURE__*/_interopNamespace(path9);
|
|
34
36
|
var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
|
|
35
37
|
var ts2__namespace = /*#__PURE__*/_interopNamespace(ts2);
|
|
36
38
|
var yaml__default = /*#__PURE__*/_interopDefault(yaml);
|
|
37
39
|
|
|
38
|
-
// src/codegen/init.ts
|
|
39
40
|
var TEMPLATES = {
|
|
40
41
|
"package.json": `{
|
|
41
42
|
"name": "my-mcp-tools",
|
|
@@ -119,12 +120,12 @@ Edit \`src/tools/*.ts\` (add \`@tool\` JSDoc) and/or \`skills/*/SKILL.md\`, then
|
|
|
119
120
|
`
|
|
120
121
|
};
|
|
121
122
|
async function initProject(options = {}) {
|
|
122
|
-
const targetPath =
|
|
123
|
+
const targetPath = path9__namespace.resolve(options.targetPath ?? process.cwd());
|
|
123
124
|
const filesCreated = [];
|
|
124
125
|
await fs3__namespace.mkdir(targetPath, { recursive: true });
|
|
125
126
|
for (const [relPath, content] of Object.entries(TEMPLATES)) {
|
|
126
|
-
const fullPath =
|
|
127
|
-
await fs3__namespace.mkdir(
|
|
127
|
+
const fullPath = path9__namespace.join(targetPath, relPath);
|
|
128
|
+
await fs3__namespace.mkdir(path9__namespace.dirname(fullPath), { recursive: true });
|
|
128
129
|
try {
|
|
129
130
|
await fs3__namespace.access(fullPath);
|
|
130
131
|
if (relPath === "package.json") continue;
|
|
@@ -140,7 +141,7 @@ async function findDirsContainingFile(rootPath, fileName) {
|
|
|
140
141
|
await collectDirsWithFile(rootPath, fileName, found);
|
|
141
142
|
return found;
|
|
142
143
|
}
|
|
143
|
-
async function collectDirsWithFile(dir, fileName,
|
|
144
|
+
async function collectDirsWithFile(dir, fileName, acc) {
|
|
144
145
|
let entries;
|
|
145
146
|
try {
|
|
146
147
|
const e = await fs3.readdir(dir, { withFileTypes: true });
|
|
@@ -152,22 +153,16 @@ async function collectDirsWithFile(dir, fileName, found) {
|
|
|
152
153
|
} catch {
|
|
153
154
|
return;
|
|
154
155
|
}
|
|
155
|
-
if (entries.some((x) => x.isFile && x.name === fileName))
|
|
156
|
-
found.push(dir);
|
|
157
|
-
}
|
|
156
|
+
if (entries.some((x) => x.isFile && x.name === fileName)) acc.push(dir);
|
|
158
157
|
for (const entry of entries) {
|
|
159
|
-
if (!entry.isDirectory || entry.name === "node_modules" || entry.name.startsWith("."))
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
await collectDirsWithFile(path5.join(dir, entry.name), fileName, found);
|
|
158
|
+
if (!entry.isDirectory || entry.name === "node_modules" || entry.name.startsWith(".")) continue;
|
|
159
|
+
await collectDirsWithFile(path9.join(dir, entry.name), fileName, acc);
|
|
163
160
|
}
|
|
164
161
|
}
|
|
165
162
|
function pathToToolName(sourcePath, programName) {
|
|
166
163
|
const normalized = sourcePath.replace(/\\/g, "/").replace(/\.(ts|tsx|js|mjs|json)$/i, "");
|
|
167
164
|
const segments = normalized.split("/").filter(Boolean);
|
|
168
|
-
|
|
169
|
-
const pathPart = segments.join(".");
|
|
170
|
-
return `${pathPart}.${programName}`;
|
|
165
|
+
return segments.length === 0 ? programName : `${segments.join(".")}.${programName}`;
|
|
171
166
|
}
|
|
172
167
|
function buildOutputSchemaFromReturnType(node, typeChecker, onWarn) {
|
|
173
168
|
const sig = typeChecker.getSignatureFromDeclaration(node);
|
|
@@ -262,19 +257,60 @@ function typeToJsonSchema(type, typeChecker, onWarn) {
|
|
|
262
257
|
return { type: "object" };
|
|
263
258
|
}
|
|
264
259
|
|
|
265
|
-
// src/
|
|
260
|
+
// src/tools/function/types.ts
|
|
261
|
+
var FUNCTION_KIND = "function";
|
|
262
|
+
|
|
263
|
+
// src/tools/skill/types.ts
|
|
264
|
+
var SKILL_KIND = "skill";
|
|
265
|
+
var SKILL_DIR_NAME = "skill";
|
|
266
|
+
|
|
267
|
+
// src/tools/n8n/types.ts
|
|
268
|
+
var N8N_KIND = "n8n";
|
|
269
|
+
|
|
270
|
+
// src/tools/mcp/mcpSpecToToolSpec.ts
|
|
271
|
+
var DEFAULT_OUTPUT = { type: "object", additionalProperties: true };
|
|
272
|
+
function mcpSpecToToolSpec(spec, projectPath) {
|
|
273
|
+
const base = {
|
|
274
|
+
name: spec.name,
|
|
275
|
+
version: "1.0.0",
|
|
276
|
+
kind: spec.kind,
|
|
277
|
+
description: spec.description,
|
|
278
|
+
inputSchema: spec.inputSchema ?? DEFAULT_OUTPUT,
|
|
279
|
+
outputSchema: "outputSchema" in spec && spec.outputSchema ? spec.outputSchema : chunkSOFUWEZ6_cjs.DEFAULT_OUTPUT_SCHEMA,
|
|
280
|
+
capabilities: [],
|
|
281
|
+
_meta: spec._meta,
|
|
282
|
+
...spec.kind === N8N_KIND && "webhookUrl" in spec && spec.webhookUrl ? { endpoint: spec.webhookUrl } : {}
|
|
283
|
+
};
|
|
284
|
+
if (spec.kind === FUNCTION_KIND && "sourcePath" in spec && "exportName" in spec) {
|
|
285
|
+
base._meta = {
|
|
286
|
+
...base._meta,
|
|
287
|
+
sourcePath: spec.sourcePath,
|
|
288
|
+
exportName: spec.exportName,
|
|
289
|
+
...projectPath && { projectPath }
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
if (spec.kind === SKILL_KIND && "sourcePath" in spec && projectPath) {
|
|
293
|
+
base._meta = { ...base._meta, sourcePath: spec.sourcePath, projectPath };
|
|
294
|
+
}
|
|
295
|
+
if (spec.kind === N8N_KIND && "sourcePath" in spec && projectPath) {
|
|
296
|
+
base._meta = { ...base._meta, sourcePath: spec.sourcePath, projectPath };
|
|
297
|
+
}
|
|
298
|
+
return base;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/tools/function/scanner.ts
|
|
266
302
|
var TOOL_TAG = "@tool";
|
|
267
303
|
var EFFECT_VALUES = ["none", "local_write", "external_write", "destructive"];
|
|
268
304
|
function scanForTools(options) {
|
|
269
|
-
const projectPath =
|
|
270
|
-
const tsconfigPath = options.tsconfigPath ??
|
|
305
|
+
const projectPath = path9__namespace.resolve(options.projectPath);
|
|
306
|
+
const tsconfigPath = options.tsconfigPath ?? path9__namespace.join(projectPath, "tsconfig.json");
|
|
271
307
|
const include = options.include ?? ["**/*.ts"];
|
|
272
308
|
const errors = [];
|
|
273
309
|
const warnings = [];
|
|
274
310
|
let config;
|
|
275
|
-
let configPathResolved =
|
|
311
|
+
let configPathResolved = path9__namespace.resolve(projectPath, tsconfigPath);
|
|
276
312
|
if (!fs2__namespace.existsSync(configPathResolved)) {
|
|
277
|
-
configPathResolved =
|
|
313
|
+
configPathResolved = path9__namespace.join(projectPath, "tsconfig.json");
|
|
278
314
|
}
|
|
279
315
|
if (fs2__namespace.existsSync(configPathResolved)) {
|
|
280
316
|
const configFile = ts2__namespace.readConfigFile(configPathResolved, ts2__namespace.sys.readFile);
|
|
@@ -285,7 +321,7 @@ function scanForTools(options) {
|
|
|
285
321
|
const parsed = ts2__namespace.parseJsonConfigFileContent(
|
|
286
322
|
configFile.config,
|
|
287
323
|
ts2__namespace.sys,
|
|
288
|
-
|
|
324
|
+
path9__namespace.dirname(configPathResolved)
|
|
289
325
|
);
|
|
290
326
|
if (parsed.errors.length) {
|
|
291
327
|
for (const e of parsed.errors) {
|
|
@@ -314,7 +350,7 @@ function scanForTools(options) {
|
|
|
314
350
|
for (const sourceFile of program.getSourceFiles()) {
|
|
315
351
|
const fileName = sourceFile.fileName;
|
|
316
352
|
if (fileName.includes("node_modules") || fileName.endsWith(".d.ts")) continue;
|
|
317
|
-
if (!config.fileNames.some((f) =>
|
|
353
|
+
if (!config.fileNames.some((f) => path9__namespace.resolve(f) === path9__namespace.resolve(fileName))) continue;
|
|
318
354
|
ts2__namespace.forEachChild(sourceFile, (node) => {
|
|
319
355
|
const decl = getExportedFunctionDeclaration(node);
|
|
320
356
|
if (!decl) return;
|
|
@@ -333,10 +369,10 @@ function scanForTools(options) {
|
|
|
333
369
|
const { schema } = buildInputSchemaFromParams(func, typeChecker, onWarn);
|
|
334
370
|
const inputSchema = Object.keys(schema.properties ?? {}).length > 0 ? schema : { type: "object", properties: {} };
|
|
335
371
|
const outputSchema = buildOutputSchemaFromReturnType(func, typeChecker, onWarn);
|
|
336
|
-
const sourcePath =
|
|
372
|
+
const sourcePath = path9__namespace.relative(projectPath, fileName) || path9__namespace.basename(fileName);
|
|
337
373
|
const toolName = pathToToolName(sourcePath, name);
|
|
338
374
|
specs.push({
|
|
339
|
-
kind:
|
|
375
|
+
kind: FUNCTION_KIND,
|
|
340
376
|
name: toolName,
|
|
341
377
|
description: description || humanize(name),
|
|
342
378
|
inputSchema,
|
|
@@ -353,20 +389,20 @@ function resolveGlob(projectPath, patterns) {
|
|
|
353
389
|
const result = [];
|
|
354
390
|
const seen = /* @__PURE__ */ new Set();
|
|
355
391
|
const add = (f) => {
|
|
356
|
-
const abs =
|
|
392
|
+
const abs = path9__namespace.resolve(f);
|
|
357
393
|
if (f.endsWith(".ts") && !f.endsWith(".d.ts") && !seen.has(abs)) {
|
|
358
394
|
seen.add(abs);
|
|
359
395
|
result.push(abs);
|
|
360
396
|
}
|
|
361
397
|
};
|
|
362
398
|
for (const p of patterns) {
|
|
363
|
-
const full =
|
|
399
|
+
const full = path9__namespace.join(projectPath, p);
|
|
364
400
|
if (full.includes("*")) {
|
|
365
401
|
const baseDir = full.replace(/\*\*\/.*$/, "").replace(/\*.*$/, "").replace(/\/?$/, "") || ".";
|
|
366
|
-
const dir =
|
|
402
|
+
const dir = path9__namespace.resolve(projectPath, baseDir);
|
|
367
403
|
if (fs2__namespace.existsSync(dir)) walk(dir, add);
|
|
368
404
|
} else {
|
|
369
|
-
const resolved =
|
|
405
|
+
const resolved = path9__namespace.resolve(projectPath, full);
|
|
370
406
|
if (fs2__namespace.existsSync(resolved)) {
|
|
371
407
|
if (fs2__namespace.statSync(resolved).isFile()) add(resolved);
|
|
372
408
|
else walk(resolved, add);
|
|
@@ -374,14 +410,14 @@ function resolveGlob(projectPath, patterns) {
|
|
|
374
410
|
}
|
|
375
411
|
}
|
|
376
412
|
if (result.length > 0) return result;
|
|
377
|
-
const srcDir =
|
|
413
|
+
const srcDir = path9__namespace.join(projectPath, "src");
|
|
378
414
|
if (fs2__namespace.existsSync(srcDir)) return walkCollect(srcDir);
|
|
379
415
|
return [];
|
|
380
416
|
}
|
|
381
417
|
function walkCollect(dir) {
|
|
382
418
|
const out = [];
|
|
383
419
|
walk(dir, (fullPath) => {
|
|
384
|
-
if (fullPath.endsWith(".ts") && !fullPath.endsWith(".d.ts")) out.push(
|
|
420
|
+
if (fullPath.endsWith(".ts") && !fullPath.endsWith(".d.ts")) out.push(path9__namespace.resolve(fullPath));
|
|
385
421
|
});
|
|
386
422
|
return out;
|
|
387
423
|
}
|
|
@@ -390,7 +426,7 @@ function walk(dir, visit) {
|
|
|
390
426
|
try {
|
|
391
427
|
const entries = fs2__namespace.readdirSync(dir, { withFileTypes: true });
|
|
392
428
|
for (const e of entries) {
|
|
393
|
-
const full =
|
|
429
|
+
const full = path9__namespace.join(dir, e.name);
|
|
394
430
|
if (e.isDirectory() && !SKIP_DIRS.has(e.name)) walk(full, visit);
|
|
395
431
|
else if (e.isFile()) visit(full);
|
|
396
432
|
}
|
|
@@ -490,12 +526,26 @@ function getEffect(host) {
|
|
|
490
526
|
function humanize(name) {
|
|
491
527
|
return name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase()).trim();
|
|
492
528
|
}
|
|
529
|
+
function scan(projectPath, options = {}) {
|
|
530
|
+
const root = path9__namespace.resolve(projectPath);
|
|
531
|
+
const result = scanForTools({
|
|
532
|
+
projectPath: root,
|
|
533
|
+
include: options.include ?? ["**/*.ts"],
|
|
534
|
+
tsconfigPath: options.tsconfigPath
|
|
535
|
+
});
|
|
536
|
+
const specs = result.specs.map((s) => mcpSpecToToolSpec(s, root));
|
|
537
|
+
return Promise.resolve({
|
|
538
|
+
specs,
|
|
539
|
+
errors: result.errors,
|
|
540
|
+
warnings: result.warnings
|
|
541
|
+
});
|
|
542
|
+
}
|
|
493
543
|
|
|
494
|
-
// src/
|
|
544
|
+
// src/tools/skill/SkillManifest.ts
|
|
495
545
|
var SkillManifestError = class extends Error {
|
|
496
|
-
constructor(
|
|
497
|
-
super(`SKILL.md error in ${
|
|
498
|
-
this.path =
|
|
546
|
+
constructor(path12, field, message) {
|
|
547
|
+
super(`SKILL.md error in ${path12}: ${message}`);
|
|
548
|
+
this.path = path12;
|
|
499
549
|
this.field = field;
|
|
500
550
|
this.name = "SkillManifestError";
|
|
501
551
|
}
|
|
@@ -701,7 +751,7 @@ async function scanDir(basePath, currentPath, resources) {
|
|
|
701
751
|
return;
|
|
702
752
|
}
|
|
703
753
|
for (const entry of entries) {
|
|
704
|
-
const fullPath =
|
|
754
|
+
const fullPath = path9.join(currentPath, entry.name);
|
|
705
755
|
if (entry.isDirectory()) {
|
|
706
756
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
707
757
|
continue;
|
|
@@ -711,8 +761,8 @@ async function scanDir(basePath, currentPath, resources) {
|
|
|
711
761
|
if (EXCLUDED_FILES.has(entry.name)) {
|
|
712
762
|
continue;
|
|
713
763
|
}
|
|
714
|
-
const ext =
|
|
715
|
-
const relPath =
|
|
764
|
+
const ext = path9.extname(entry.name).toLowerCase();
|
|
765
|
+
const relPath = path9.relative(basePath, fullPath);
|
|
716
766
|
resources.push({
|
|
717
767
|
relativePath: relPath,
|
|
718
768
|
absolutePath: fullPath,
|
|
@@ -728,7 +778,7 @@ function inferResourceType(ext) {
|
|
|
728
778
|
return "data";
|
|
729
779
|
}
|
|
730
780
|
async function loadSkillDefinition(dirPath) {
|
|
731
|
-
const skillMdPath =
|
|
781
|
+
const skillMdPath = path9.join(dirPath, "SKILL.md");
|
|
732
782
|
let content;
|
|
733
783
|
try {
|
|
734
784
|
content = await fs3.readFile(skillMdPath, "utf-8");
|
|
@@ -749,36 +799,38 @@ async function loadSkillDefinition(dirPath) {
|
|
|
749
799
|
skillMdPath
|
|
750
800
|
};
|
|
751
801
|
}
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
phase;
|
|
759
|
-
/** The underlying cause */
|
|
760
|
-
cause;
|
|
761
|
-
constructor(toolDir, phase, message, cause) {
|
|
762
|
-
super(`[${phase}] ${toolDir}: ${message}`);
|
|
763
|
-
this.name = "DiscoveryError";
|
|
764
|
-
this.toolDir = toolDir;
|
|
765
|
-
this.phase = phase;
|
|
766
|
-
this.cause = cause;
|
|
802
|
+
var DEFAULT_EXTENSIONS = [".js", ".mjs"];
|
|
803
|
+
async function resolveEntryPoint(dirPath, baseName, extensions = DEFAULT_EXTENSIONS) {
|
|
804
|
+
if (extensions.some((ext) => baseName.endsWith(ext))) {
|
|
805
|
+
const fullPath = path9.join(dirPath, baseName);
|
|
806
|
+
await fs3.stat(fullPath);
|
|
807
|
+
return fullPath;
|
|
767
808
|
}
|
|
768
|
-
|
|
809
|
+
for (const ext of extensions) {
|
|
810
|
+
const fullPath = path9.join(dirPath, `${baseName}${ext}`);
|
|
811
|
+
try {
|
|
812
|
+
await fs3.stat(fullPath);
|
|
813
|
+
return fullPath;
|
|
814
|
+
} catch {
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
throw new Error(
|
|
818
|
+
`Could not find entry point in ${dirPath}. Tried: ${extensions.map((e) => baseName + e).join(", ")}`
|
|
819
|
+
);
|
|
820
|
+
}
|
|
769
821
|
var defaultInputSchema = { type: "object", properties: {}, additionalProperties: true };
|
|
770
822
|
async function scanForSkill(projectPath) {
|
|
771
|
-
const projectRoot =
|
|
823
|
+
const projectRoot = path9__namespace.resolve(projectPath);
|
|
772
824
|
const dirs = await findDirsContainingFile(projectRoot, "SKILL.md");
|
|
773
825
|
const skills = [];
|
|
774
826
|
const errors = [];
|
|
775
827
|
for (const dirPath of dirs) {
|
|
776
|
-
const relativePath =
|
|
828
|
+
const relativePath = path9__namespace.relative(projectRoot, dirPath) || path9__namespace.basename(dirPath);
|
|
777
829
|
try {
|
|
778
830
|
const skillDef = await loadSkillDefinition(dirPath);
|
|
779
831
|
const name = pathToToolName(relativePath, skillDef.frontmatter.name);
|
|
780
832
|
skills.push({
|
|
781
|
-
kind:
|
|
833
|
+
kind: SKILL_KIND,
|
|
782
834
|
name,
|
|
783
835
|
description: skillDef.frontmatter.description,
|
|
784
836
|
inputSchema: defaultInputSchema,
|
|
@@ -791,8 +843,17 @@ async function scanForSkill(projectPath) {
|
|
|
791
843
|
}
|
|
792
844
|
return { skills, errors };
|
|
793
845
|
}
|
|
846
|
+
async function scan2(projectPath, _options = {}) {
|
|
847
|
+
const root = path9__namespace.resolve(projectPath);
|
|
848
|
+
const result = await scanForSkill(root);
|
|
849
|
+
const specs = result.skills.map((s) => mcpSpecToToolSpec(s, root));
|
|
850
|
+
return {
|
|
851
|
+
specs,
|
|
852
|
+
errors: result.errors.map((e) => ({ file: e.dir, message: e.message }))
|
|
853
|
+
};
|
|
854
|
+
}
|
|
794
855
|
async function readWorkflowMeta(dirPath, workflowFileName = "workflow.json") {
|
|
795
|
-
const workflowPath =
|
|
856
|
+
const workflowPath = path9.join(dirPath, workflowFileName);
|
|
796
857
|
let raw;
|
|
797
858
|
try {
|
|
798
859
|
raw = await fs3.readFile(workflowPath, "utf-8");
|
|
@@ -823,7 +884,7 @@ async function readWorkflowMeta(dirPath, workflowFileName = "workflow.json") {
|
|
|
823
884
|
);
|
|
824
885
|
}
|
|
825
886
|
const meta = workflowDef.meta;
|
|
826
|
-
const name = workflowDef.name || meta?.name ||
|
|
887
|
+
const name = workflowDef.name || meta?.name || path9.basename(dirPath);
|
|
827
888
|
const description = workflowDef.description || meta?.description || `n8n workflow: ${name}`;
|
|
828
889
|
let webhookUrl;
|
|
829
890
|
const nodes = workflowDef.nodes;
|
|
@@ -849,20 +910,20 @@ async function loadN8nTool(dirPath, manifest) {
|
|
|
849
910
|
return { manifest, dirPath, workflowDef };
|
|
850
911
|
}
|
|
851
912
|
|
|
852
|
-
// src/
|
|
913
|
+
// src/tools/n8n/scanN8n.ts
|
|
853
914
|
var defaultInputSchema2 = { type: "object", properties: {}, additionalProperties: true };
|
|
854
915
|
async function scanForN8n(projectPath) {
|
|
855
|
-
const projectRoot =
|
|
916
|
+
const projectRoot = path9__namespace.resolve(projectPath);
|
|
856
917
|
const dirs = await findDirsContainingFile(projectRoot, "workflow.json");
|
|
857
918
|
const n8n = [];
|
|
858
919
|
const errors = [];
|
|
859
920
|
for (const dirPath of dirs) {
|
|
860
|
-
const relativePath =
|
|
921
|
+
const relativePath = path9__namespace.relative(projectRoot, dirPath) || path9__namespace.basename(dirPath);
|
|
861
922
|
try {
|
|
862
923
|
const { name: wfName, description: wfDesc, webhookUrl } = await readWorkflowMeta(dirPath);
|
|
863
924
|
const toolName = pathToToolName(relativePath, wfName);
|
|
864
925
|
n8n.push({
|
|
865
|
-
kind:
|
|
926
|
+
kind: N8N_KIND,
|
|
866
927
|
name: toolName,
|
|
867
928
|
description: wfDesc,
|
|
868
929
|
inputSchema: defaultInputSchema2,
|
|
@@ -876,38 +937,683 @@ async function scanForN8n(projectPath) {
|
|
|
876
937
|
}
|
|
877
938
|
return { n8n, errors };
|
|
878
939
|
}
|
|
940
|
+
async function scan3(projectPath, _options = {}) {
|
|
941
|
+
const root = path9__namespace.resolve(projectPath);
|
|
942
|
+
const result = await scanForN8n(root);
|
|
943
|
+
const specs = result.n8n.map((s) => mcpSpecToToolSpec(s, root));
|
|
944
|
+
return {
|
|
945
|
+
specs,
|
|
946
|
+
errors: result.errors.map((e) => ({ file: e.dir, message: e.message }))
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
async function scan4(projectPath, options = {}) {
|
|
950
|
+
const root = path9__namespace.resolve(projectPath);
|
|
951
|
+
const namespace = options.namespace ?? "dir";
|
|
952
|
+
const errors = [];
|
|
953
|
+
const scanner = new DirectoryScanner({
|
|
954
|
+
roots: [root],
|
|
955
|
+
namespace,
|
|
956
|
+
extensions: options.extensions,
|
|
957
|
+
onError: (dir, err) => {
|
|
958
|
+
errors.push({ file: dir, message: err.message });
|
|
959
|
+
options.onError?.(dir, err);
|
|
960
|
+
}
|
|
961
|
+
});
|
|
962
|
+
let specs;
|
|
963
|
+
try {
|
|
964
|
+
specs = await scanner.scan();
|
|
965
|
+
} catch (err) {
|
|
966
|
+
errors.push({
|
|
967
|
+
file: root,
|
|
968
|
+
message: err instanceof Error ? err.message : String(err)
|
|
969
|
+
});
|
|
970
|
+
return { specs: [], errors };
|
|
971
|
+
}
|
|
972
|
+
const filtered = specs.filter((s) => s.kind === chunkFA2ZEICE_cjs.MCP_KIND);
|
|
973
|
+
return { specs: filtered, errors };
|
|
974
|
+
}
|
|
975
|
+
async function scan5(projectPath, options = {}) {
|
|
976
|
+
const root = path9__namespace.resolve(projectPath);
|
|
977
|
+
const namespace = options.namespace ?? "dir";
|
|
978
|
+
const errors = [];
|
|
979
|
+
const scanner = new DirectoryScanner({
|
|
980
|
+
roots: [root],
|
|
981
|
+
namespace,
|
|
982
|
+
extensions: options.extensions,
|
|
983
|
+
onError: (dir, err) => {
|
|
984
|
+
errors.push({ file: dir, message: err.message });
|
|
985
|
+
options.onError?.(dir, err);
|
|
986
|
+
}
|
|
987
|
+
});
|
|
988
|
+
let specs;
|
|
989
|
+
try {
|
|
990
|
+
specs = await scanner.scan();
|
|
991
|
+
} catch (err) {
|
|
992
|
+
errors.push({
|
|
993
|
+
file: root,
|
|
994
|
+
message: err instanceof Error ? err.message : String(err)
|
|
995
|
+
});
|
|
996
|
+
return { specs: [], errors };
|
|
997
|
+
}
|
|
998
|
+
const filtered = specs.filter((s) => s.kind === chunkFA2ZEICE_cjs.LANGCHAIN_KIND);
|
|
999
|
+
return { specs: filtered, errors };
|
|
1000
|
+
}
|
|
1001
|
+
async function loadLangChainTool(dirPath, manifest, extensions) {
|
|
1002
|
+
let entryFile;
|
|
1003
|
+
try {
|
|
1004
|
+
entryFile = await resolveEntryPoint(
|
|
1005
|
+
dirPath,
|
|
1006
|
+
manifest.entryPoint ?? "index",
|
|
1007
|
+
extensions
|
|
1008
|
+
);
|
|
1009
|
+
} catch (err) {
|
|
1010
|
+
throw new DiscoveryError(
|
|
1011
|
+
dirPath,
|
|
1012
|
+
"load",
|
|
1013
|
+
`Cannot find LangChain entry point`,
|
|
1014
|
+
err
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
let mod;
|
|
1018
|
+
try {
|
|
1019
|
+
mod = await import(url.pathToFileURL(entryFile).href);
|
|
1020
|
+
} catch (err) {
|
|
1021
|
+
throw new DiscoveryError(
|
|
1022
|
+
dirPath,
|
|
1023
|
+
"load",
|
|
1024
|
+
`Failed to import ${entryFile}`,
|
|
1025
|
+
err
|
|
1026
|
+
);
|
|
1027
|
+
}
|
|
1028
|
+
const tool = mod.default ?? mod.tool ?? mod;
|
|
1029
|
+
if (!tool || typeof tool.invoke !== "function") {
|
|
1030
|
+
throw new DiscoveryError(
|
|
1031
|
+
dirPath,
|
|
1032
|
+
"validate",
|
|
1033
|
+
`Entry point must export an object with invoke() method (LangChainToolLike)`
|
|
1034
|
+
);
|
|
1035
|
+
}
|
|
1036
|
+
return { manifest, dirPath, impl: tool };
|
|
1037
|
+
}
|
|
1038
|
+
var DEFAULT_EXTENSIONS2 = [".js", ".mjs"];
|
|
1039
|
+
async function listSkillProgramFiles(dirPath, extensions = DEFAULT_EXTENSIONS2) {
|
|
1040
|
+
let entries;
|
|
1041
|
+
try {
|
|
1042
|
+
const dirEntries = await fs3.readdir(dirPath, { withFileTypes: true });
|
|
1043
|
+
entries = dirEntries.map((entry) => ({
|
|
1044
|
+
name: entry.name,
|
|
1045
|
+
isFile: entry.isFile()
|
|
1046
|
+
}));
|
|
1047
|
+
} catch {
|
|
1048
|
+
return [];
|
|
1049
|
+
}
|
|
1050
|
+
return entries.filter((e) => e.isFile).map((e) => e.name).filter((name) => {
|
|
1051
|
+
if (name.startsWith(".") || name.startsWith("_")) return false;
|
|
1052
|
+
if (name.includes(".test.") || name.includes(".spec.")) return false;
|
|
1053
|
+
return extensions.some((ext) => name.endsWith(ext));
|
|
1054
|
+
}).sort((a, b) => {
|
|
1055
|
+
if (a === "handler.js" || a === "index.js") return -1;
|
|
1056
|
+
if (b === "handler.js" || b === "index.js") return 1;
|
|
1057
|
+
return a.localeCompare(b);
|
|
1058
|
+
});
|
|
1059
|
+
}
|
|
1060
|
+
function isLangChainLikeTool(val) {
|
|
1061
|
+
return val != null && typeof val === "object" && "invoke" in val && typeof val.invoke === "function";
|
|
1062
|
+
}
|
|
1063
|
+
function isConstructable(val) {
|
|
1064
|
+
return typeof val === "function" && typeof val.prototype === "object";
|
|
1065
|
+
}
|
|
1066
|
+
async function loadOneSkillProgram(dirPath, manifest, entryFile, skillDef, programKey, extensions) {
|
|
1067
|
+
let impl;
|
|
1068
|
+
try {
|
|
1069
|
+
const fullPath = await resolveEntryPoint(dirPath, entryFile, extensions ?? [".js", ".mjs"]);
|
|
1070
|
+
const mod = await import(url.pathToFileURL(fullPath).href);
|
|
1071
|
+
const fn = mod.default ?? mod.handler ?? mod.Tool;
|
|
1072
|
+
if (isLangChainLikeTool(fn)) {
|
|
1073
|
+
impl = fn;
|
|
1074
|
+
} else if (isConstructable(fn)) {
|
|
1075
|
+
const instance = new fn();
|
|
1076
|
+
if (isLangChainLikeTool(instance)) impl = instance;
|
|
1077
|
+
} else if (typeof fn === "function") {
|
|
1078
|
+
impl = fn;
|
|
1079
|
+
}
|
|
1080
|
+
} catch {
|
|
1081
|
+
}
|
|
1082
|
+
return {
|
|
1083
|
+
manifest,
|
|
1084
|
+
dirPath,
|
|
1085
|
+
impl,
|
|
1086
|
+
skillDefinition: skillDef,
|
|
1087
|
+
programKey
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
async function loadSkillTools(dirPath, manifest, extensions) {
|
|
1091
|
+
let skillDef;
|
|
1092
|
+
try {
|
|
1093
|
+
skillDef = await loadSkillDefinition(dirPath);
|
|
1094
|
+
} catch (err) {
|
|
1095
|
+
throw new DiscoveryError(
|
|
1096
|
+
dirPath,
|
|
1097
|
+
"load",
|
|
1098
|
+
`Failed to parse SKILL.md: ${err.message}`,
|
|
1099
|
+
err
|
|
1100
|
+
);
|
|
1101
|
+
}
|
|
1102
|
+
const programs = manifest.programs;
|
|
1103
|
+
if (programs && typeof programs === "object" && Object.keys(programs).length > 0) {
|
|
1104
|
+
const result = [];
|
|
1105
|
+
for (const [programKey, entryFile2] of Object.entries(programs)) {
|
|
1106
|
+
const loaded2 = await loadOneSkillProgram(
|
|
1107
|
+
dirPath,
|
|
1108
|
+
manifest,
|
|
1109
|
+
entryFile2,
|
|
1110
|
+
skillDef,
|
|
1111
|
+
programKey,
|
|
1112
|
+
extensions
|
|
1113
|
+
);
|
|
1114
|
+
result.push(loaded2);
|
|
1115
|
+
}
|
|
1116
|
+
return result;
|
|
1117
|
+
}
|
|
1118
|
+
const exts = extensions ?? DEFAULT_EXTENSIONS2;
|
|
1119
|
+
const files = await listSkillProgramFiles(dirPath, exts);
|
|
1120
|
+
if (files.length >= 2) {
|
|
1121
|
+
const result = [];
|
|
1122
|
+
for (let i = 0; i < files.length; i++) {
|
|
1123
|
+
const file = files[i];
|
|
1124
|
+
const programKey = i === 0 ? "default" : file.replace(/\.[^.]+$/, "");
|
|
1125
|
+
const loaded2 = await loadOneSkillProgram(
|
|
1126
|
+
dirPath,
|
|
1127
|
+
manifest,
|
|
1128
|
+
file,
|
|
1129
|
+
skillDef,
|
|
1130
|
+
programKey,
|
|
1131
|
+
extensions
|
|
1132
|
+
);
|
|
1133
|
+
result.push(loaded2);
|
|
1134
|
+
}
|
|
1135
|
+
return result;
|
|
1136
|
+
}
|
|
1137
|
+
const entryFile = manifest.entryPoint ?? files[0] ?? "handler";
|
|
1138
|
+
const loaded = await loadOneSkillProgram(
|
|
1139
|
+
dirPath,
|
|
1140
|
+
manifest,
|
|
1141
|
+
entryFile,
|
|
1142
|
+
skillDef,
|
|
1143
|
+
void 0,
|
|
1144
|
+
extensions
|
|
1145
|
+
);
|
|
1146
|
+
return [loaded];
|
|
1147
|
+
}
|
|
1148
|
+
async function listLangchainEntryFiles(dirPath, extensions) {
|
|
1149
|
+
let entries;
|
|
1150
|
+
try {
|
|
1151
|
+
const dirEntries = await fs3.readdir(dirPath, { withFileTypes: true });
|
|
1152
|
+
entries = dirEntries.map((entry) => ({
|
|
1153
|
+
name: entry.name,
|
|
1154
|
+
isFile: entry.isFile()
|
|
1155
|
+
}));
|
|
1156
|
+
} catch {
|
|
1157
|
+
return [];
|
|
1158
|
+
}
|
|
1159
|
+
return entries.filter((e) => e.isFile).map((e) => e.name).filter((name) => {
|
|
1160
|
+
if (name.startsWith(".") || name.startsWith("_")) return false;
|
|
1161
|
+
if (name.endsWith(".d.ts")) return false;
|
|
1162
|
+
if (name.includes(".test.") || name.includes(".spec.")) return false;
|
|
1163
|
+
return extensions.some((ext) => name.endsWith(ext));
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
async function loadLangChainToolsFromDir(dirPath, dirName, manifest, strict, namespace, extensions, langchainDirName, toSpec, onError) {
|
|
1167
|
+
const entryFiles = await listLangchainEntryFiles(dirPath, extensions);
|
|
1168
|
+
if (entryFiles.length === 0) {
|
|
1169
|
+
if (strict) {
|
|
1170
|
+
throw new DiscoveryError(dirPath, "load", "No LangChain entry files found");
|
|
1171
|
+
}
|
|
1172
|
+
return [];
|
|
1173
|
+
}
|
|
1174
|
+
const specs = [];
|
|
1175
|
+
const useDirNameForSingle = dirName !== langchainDirName;
|
|
1176
|
+
for (const entryFile of entryFiles) {
|
|
1177
|
+
const fileManifest = { ...manifest, entryPoint: entryFile };
|
|
1178
|
+
try {
|
|
1179
|
+
const loaded = await loadLangChainTool(dirPath, fileManifest, extensions);
|
|
1180
|
+
const fileBase = path9.basename(entryFile).replace(/\.[^.]+$/, "");
|
|
1181
|
+
const nameHint = entryFiles.length === 1 && useDirNameForSingle ? dirName : fileBase;
|
|
1182
|
+
specs.push(toSpec(loaded, nameHint, dirPath, namespace));
|
|
1183
|
+
} catch (error) {
|
|
1184
|
+
const err = error;
|
|
1185
|
+
if (err instanceof DiscoveryError && err.phase === "validate") {
|
|
1186
|
+
if (strict) throw err;
|
|
1187
|
+
continue;
|
|
1188
|
+
}
|
|
1189
|
+
onError?.(path9.join(dirPath, entryFile), err);
|
|
1190
|
+
if (strict) throw err;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
return specs;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// src/tools/mcp/directoryApply.ts
|
|
1197
|
+
function applyLoadedToSpec(spec, loaded, _manifest, _defaultDirName, _namespace) {
|
|
1198
|
+
if (loaded.mcpConfig?.url) spec.endpoint = loaded.mcpConfig.url;
|
|
1199
|
+
spec.impl = loaded.mcpConfig;
|
|
1200
|
+
}
|
|
1201
|
+
var directoryMarker = {
|
|
1202
|
+
kind: "mcp",
|
|
1203
|
+
markerFile: "mcp.json",
|
|
1204
|
+
defaultEntryPoint: "mcp.json"
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
// src/tools/langchain/directoryApply.ts
|
|
1208
|
+
function applyLoadedToSpec2(spec, loaded, manifest, _defaultDirName, namespace) {
|
|
1209
|
+
spec.impl = loaded.impl;
|
|
1210
|
+
if (!manifest.name && loaded.impl) {
|
|
1211
|
+
const toolName = loaded.impl.name;
|
|
1212
|
+
if (toolName) spec.name = `${namespace}/${toolName}`;
|
|
1213
|
+
}
|
|
1214
|
+
if (!manifest.description && loaded.impl) {
|
|
1215
|
+
const d = loaded.impl.description;
|
|
1216
|
+
if (d) spec.description = d;
|
|
1217
|
+
}
|
|
1218
|
+
if (!manifest.inputSchema && loaded.impl) {
|
|
1219
|
+
const schema = loaded.impl.schema;
|
|
1220
|
+
if (schema) spec.inputSchema = schema;
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
// src/tools/skill/directoryApply.ts
|
|
1225
|
+
function applyLoadedToSpec3(spec, loaded, manifest, defaultDirName, namespace) {
|
|
1226
|
+
const skillDef = loaded.skillDefinition;
|
|
1227
|
+
if (skillDef) {
|
|
1228
|
+
spec.name = manifest.name ?? skillDef.frontmatter.name;
|
|
1229
|
+
spec.description = skillDef.frontmatter.description;
|
|
1230
|
+
if (loaded.programKey === "default") {
|
|
1231
|
+
spec.name = `${namespace}/${defaultDirName}`;
|
|
1232
|
+
} else if (loaded.programKey) {
|
|
1233
|
+
spec.name = `${namespace}/${defaultDirName}/${loaded.programKey}`;
|
|
1234
|
+
}
|
|
1235
|
+
const impl = loaded.impl;
|
|
1236
|
+
if (impl && typeof impl === "object" && typeof impl.invoke === "function") {
|
|
1237
|
+
if (impl.description != null && impl.description !== "")
|
|
1238
|
+
spec.description = impl.description;
|
|
1239
|
+
if (impl.schema != null && typeof impl.schema === "object")
|
|
1240
|
+
spec.inputSchema = impl.schema;
|
|
1241
|
+
}
|
|
1242
|
+
spec.impl = { ...skillDef, handler: loaded.impl };
|
|
1243
|
+
} else {
|
|
1244
|
+
spec.impl = loaded.impl;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
var directoryMarker2 = {
|
|
1248
|
+
kind: "skill",
|
|
1249
|
+
markerFile: "SKILL.md",
|
|
1250
|
+
defaultEntryPoint: "handler"
|
|
1251
|
+
};
|
|
1252
|
+
|
|
1253
|
+
// src/tools/n8n/directoryApply.ts
|
|
1254
|
+
function applyLoadedToSpec4(spec, loaded, manifest, _defaultDirName, _namespace) {
|
|
1255
|
+
const workflow = loaded.workflowDef;
|
|
1256
|
+
if (workflow?.id) spec.resourceId = String(workflow.id);
|
|
1257
|
+
if (!manifest.description && workflow) {
|
|
1258
|
+
const d = workflow.description ?? workflow.meta?.description ?? (typeof workflow.name === "string" ? workflow.name : void 0);
|
|
1259
|
+
if (d) spec.description = d;
|
|
1260
|
+
}
|
|
1261
|
+
spec.impl = loaded.workflowDef;
|
|
1262
|
+
}
|
|
1263
|
+
var directoryMarker3 = {
|
|
1264
|
+
kind: "n8n",
|
|
1265
|
+
markerFile: "workflow.json",
|
|
1266
|
+
defaultEntryPoint: "workflow.json"
|
|
1267
|
+
};
|
|
879
1268
|
|
|
880
|
-
// src/
|
|
1269
|
+
// src/tools/discoveryFactory.ts
|
|
1270
|
+
var DiscoveryError = class extends Error {
|
|
1271
|
+
toolDir;
|
|
1272
|
+
phase;
|
|
1273
|
+
cause;
|
|
1274
|
+
constructor(toolDir, phase, message, cause) {
|
|
1275
|
+
super(`[${phase}] ${toolDir}: ${message}`);
|
|
1276
|
+
this.name = "DiscoveryError";
|
|
1277
|
+
this.toolDir = toolDir;
|
|
1278
|
+
this.phase = phase;
|
|
1279
|
+
this.cause = cause;
|
|
1280
|
+
}
|
|
1281
|
+
};
|
|
1282
|
+
var DIRECTORY_KINDS = ["mcp", "langchain", "skill", "n8n"];
|
|
1283
|
+
var DIRECTORY_DISCOVERABLE_KINDS = DIRECTORY_KINDS;
|
|
1284
|
+
var DIRECTORY_KIND_MARKERS = [
|
|
1285
|
+
directoryMarker2,
|
|
1286
|
+
directoryMarker3,
|
|
1287
|
+
directoryMarker
|
|
1288
|
+
];
|
|
1289
|
+
var DIRECTORY_LOADERS = {
|
|
1290
|
+
mcp: async (dirPath, manifest) => [await loadMCPTool(dirPath, manifest)],
|
|
1291
|
+
langchain: async (dirPath, manifest, ext) => [await loadLangChainTool(dirPath, manifest, ext)],
|
|
1292
|
+
skill: (dirPath, manifest, ext) => loadSkillTools(dirPath, manifest, ext),
|
|
1293
|
+
n8n: async (dirPath, manifest) => [await loadN8nTool(dirPath, manifest)]
|
|
1294
|
+
};
|
|
1295
|
+
function getDirectoryLoader(kind) {
|
|
1296
|
+
const loader = DIRECTORY_LOADERS[kind];
|
|
1297
|
+
if (!loader) {
|
|
1298
|
+
throw new DiscoveryError("", "manifest", `Unknown directory tool kind: "${kind}"`);
|
|
1299
|
+
}
|
|
1300
|
+
return loader;
|
|
1301
|
+
}
|
|
1302
|
+
function applyDirectoryLoadedToSpec(spec, loaded, manifest, defaultDirName, namespace) {
|
|
1303
|
+
switch (manifest.kind) {
|
|
1304
|
+
case "mcp":
|
|
1305
|
+
return applyLoadedToSpec(spec, loaded);
|
|
1306
|
+
case "langchain":
|
|
1307
|
+
return applyLoadedToSpec2(spec, loaded, manifest, defaultDirName, namespace);
|
|
1308
|
+
case "skill":
|
|
1309
|
+
return applyLoadedToSpec3(spec, loaded, manifest, defaultDirName, namespace);
|
|
1310
|
+
case "n8n":
|
|
1311
|
+
return applyLoadedToSpec4(spec, loaded, manifest);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
async function discoverTools(type, projectPath, options = {}) {
|
|
1315
|
+
const root = path9__namespace.resolve(projectPath);
|
|
1316
|
+
switch (type) {
|
|
1317
|
+
case "function":
|
|
1318
|
+
return scan(root, options);
|
|
1319
|
+
case "skill":
|
|
1320
|
+
return scan2(root, options);
|
|
1321
|
+
case "n8n":
|
|
1322
|
+
return scan3(root, options);
|
|
1323
|
+
case "mcp":
|
|
1324
|
+
return scan4(root, options);
|
|
1325
|
+
case "langchain":
|
|
1326
|
+
return scan5(root, options);
|
|
1327
|
+
default: {
|
|
1328
|
+
const _ = type;
|
|
1329
|
+
return _;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
var DEFAULT_EXTENSIONS3 = [".js", ".mjs"];
|
|
1334
|
+
var DirectoryScanner = class {
|
|
1335
|
+
roots;
|
|
1336
|
+
extensions;
|
|
1337
|
+
onError;
|
|
1338
|
+
constructor(options) {
|
|
1339
|
+
const defaultNamespace = options.namespace ?? "dir";
|
|
1340
|
+
this.roots = options.roots.map((root) => {
|
|
1341
|
+
if (typeof root === "string") {
|
|
1342
|
+
return { path: root, namespace: defaultNamespace };
|
|
1343
|
+
}
|
|
1344
|
+
return {
|
|
1345
|
+
path: root.path,
|
|
1346
|
+
namespace: root.namespace ?? defaultNamespace
|
|
1347
|
+
};
|
|
1348
|
+
});
|
|
1349
|
+
this.extensions = options.extensions ?? DEFAULT_EXTENSIONS3;
|
|
1350
|
+
this.onError = options.onError;
|
|
1351
|
+
}
|
|
1352
|
+
async scan() {
|
|
1353
|
+
const specs = [];
|
|
1354
|
+
for (const root of this.roots) {
|
|
1355
|
+
const rootSpecs = await this.scanRoot(root.path, root.namespace);
|
|
1356
|
+
specs.push(...rootSpecs);
|
|
1357
|
+
}
|
|
1358
|
+
return specs;
|
|
1359
|
+
}
|
|
1360
|
+
async scanRoot(rootPath, namespace) {
|
|
1361
|
+
return this.scanRecursive(rootPath, namespace);
|
|
1362
|
+
}
|
|
1363
|
+
async scanRecursive(dirPath, namespace) {
|
|
1364
|
+
const specs = [];
|
|
1365
|
+
let dirEntries;
|
|
1366
|
+
try {
|
|
1367
|
+
const entries = await fs3.readdir(dirPath, { withFileTypes: true });
|
|
1368
|
+
dirEntries = entries.map((entry) => ({
|
|
1369
|
+
name: entry.name,
|
|
1370
|
+
isDirectory: entry.isDirectory()
|
|
1371
|
+
}));
|
|
1372
|
+
} catch (error) {
|
|
1373
|
+
this.onError?.(dirPath, error);
|
|
1374
|
+
return specs;
|
|
1375
|
+
}
|
|
1376
|
+
const dirName = path9.basename(dirPath);
|
|
1377
|
+
try {
|
|
1378
|
+
const loadedSpecs = await this.loadToolDir(dirPath, dirName, namespace);
|
|
1379
|
+
if (loadedSpecs.length > 0) specs.push(...loadedSpecs);
|
|
1380
|
+
} catch (error) {
|
|
1381
|
+
this.onError?.(dirPath, error);
|
|
1382
|
+
}
|
|
1383
|
+
for (const entry of dirEntries) {
|
|
1384
|
+
if (!entry.isDirectory) continue;
|
|
1385
|
+
const childPath = path9.join(dirPath, entry.name);
|
|
1386
|
+
try {
|
|
1387
|
+
const childSpecs = await this.scanRecursive(childPath, namespace);
|
|
1388
|
+
specs.push(...childSpecs);
|
|
1389
|
+
} catch (error) {
|
|
1390
|
+
this.onError?.(childPath, error);
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
return specs;
|
|
1394
|
+
}
|
|
1395
|
+
async loadToolDir(dirPath, dirName, namespace) {
|
|
1396
|
+
const manifestPath = path9.join(dirPath, "tool.json");
|
|
1397
|
+
let manifestRaw;
|
|
1398
|
+
try {
|
|
1399
|
+
manifestRaw = await fs3.readFile(manifestPath, "utf-8");
|
|
1400
|
+
} catch {
|
|
1401
|
+
const inferred = await this.inferManifest(dirPath, dirName);
|
|
1402
|
+
if (!inferred) return [];
|
|
1403
|
+
if (inferred.kind === "langchain") {
|
|
1404
|
+
if (inferred.entryPoint) {
|
|
1405
|
+
const loaded3 = await loadLangChainTool(dirPath, inferred, this.extensions);
|
|
1406
|
+
return [this.toToolSpec(loaded3, dirName, dirPath, namespace)];
|
|
1407
|
+
}
|
|
1408
|
+
return loadLangChainToolsFromDir(
|
|
1409
|
+
dirPath,
|
|
1410
|
+
dirName,
|
|
1411
|
+
inferred,
|
|
1412
|
+
false,
|
|
1413
|
+
namespace,
|
|
1414
|
+
this.extensions,
|
|
1415
|
+
chunkFA2ZEICE_cjs.LANGCHAIN_DIR_NAME,
|
|
1416
|
+
(loaded3, nameHint, dp, ns) => this.toToolSpec(loaded3, nameHint, dp, ns),
|
|
1417
|
+
this.onError
|
|
1418
|
+
);
|
|
1419
|
+
}
|
|
1420
|
+
if (inferred.kind === "skill") {
|
|
1421
|
+
const loadedList = await loadSkillTools(dirPath, inferred, this.extensions);
|
|
1422
|
+
return loadedList.map(
|
|
1423
|
+
(loaded3) => this.toToolSpec(loaded3, dirName, dirPath, namespace)
|
|
1424
|
+
);
|
|
1425
|
+
}
|
|
1426
|
+
const loaded2 = await this.loadByKind(dirPath, inferred);
|
|
1427
|
+
return [this.toToolSpec(loaded2, dirName, dirPath, namespace)];
|
|
1428
|
+
}
|
|
1429
|
+
let manifest;
|
|
1430
|
+
try {
|
|
1431
|
+
manifest = JSON.parse(manifestRaw);
|
|
1432
|
+
} catch (err) {
|
|
1433
|
+
throw new DiscoveryError(dirPath, "manifest", "Invalid JSON in tool.json", err);
|
|
1434
|
+
}
|
|
1435
|
+
if (!manifest.kind) {
|
|
1436
|
+
throw new DiscoveryError(dirPath, "manifest", `tool.json must have a "kind" field`);
|
|
1437
|
+
}
|
|
1438
|
+
if (manifest.enabled === false) return [];
|
|
1439
|
+
if (manifest.kind === "langchain") {
|
|
1440
|
+
if (manifest.entryPoint) {
|
|
1441
|
+
const loaded2 = await loadLangChainTool(dirPath, manifest, this.extensions);
|
|
1442
|
+
return [this.toToolSpec(loaded2, dirName, dirPath, namespace)];
|
|
1443
|
+
}
|
|
1444
|
+
return loadLangChainToolsFromDir(
|
|
1445
|
+
dirPath,
|
|
1446
|
+
dirName,
|
|
1447
|
+
manifest,
|
|
1448
|
+
true,
|
|
1449
|
+
namespace,
|
|
1450
|
+
this.extensions,
|
|
1451
|
+
chunkFA2ZEICE_cjs.LANGCHAIN_DIR_NAME,
|
|
1452
|
+
(loaded2, nameHint, dp, ns) => this.toToolSpec(loaded2, nameHint, dp, ns),
|
|
1453
|
+
this.onError
|
|
1454
|
+
);
|
|
1455
|
+
}
|
|
1456
|
+
if (manifest.kind === "skill") {
|
|
1457
|
+
const loadedList = await loadSkillTools(dirPath, manifest, this.extensions);
|
|
1458
|
+
return loadedList.map(
|
|
1459
|
+
(loaded2) => this.toToolSpec(loaded2, dirName, dirPath, namespace)
|
|
1460
|
+
);
|
|
1461
|
+
}
|
|
1462
|
+
const loaded = await this.loadByKind(dirPath, manifest);
|
|
1463
|
+
return [this.toToolSpec(loaded, dirName, dirPath, namespace)];
|
|
1464
|
+
}
|
|
1465
|
+
async inferManifest(dirPath, dirName) {
|
|
1466
|
+
const kinds = [];
|
|
1467
|
+
for (const m of DIRECTORY_KIND_MARKERS) {
|
|
1468
|
+
if (await this.fileExists(path9.join(dirPath, m.markerFile))) kinds.push(m.kind);
|
|
1469
|
+
}
|
|
1470
|
+
const isLangchainDir = dirName === chunkFA2ZEICE_cjs.LANGCHAIN_DIR_NAME;
|
|
1471
|
+
const hasLangchain = isLangchainDir ? (await listLangchainEntryFiles(dirPath, this.extensions)).length > 0 : dirName !== SKILL_DIR_NAME && await this.hasEntryPoint(dirPath, "index");
|
|
1472
|
+
if (hasLangchain) kinds.push("langchain");
|
|
1473
|
+
if (kinds.length === 0) return null;
|
|
1474
|
+
if (kinds.length > 1) {
|
|
1475
|
+
throw new DiscoveryError(
|
|
1476
|
+
dirPath,
|
|
1477
|
+
"manifest",
|
|
1478
|
+
`Ambiguous tool kind (found ${kinds.join(", ")}). Add tool.json to disambiguate.`
|
|
1479
|
+
);
|
|
1480
|
+
}
|
|
1481
|
+
const kind = kinds[0];
|
|
1482
|
+
const manifest = { kind };
|
|
1483
|
+
const marker = DIRECTORY_KIND_MARKERS.find((m) => m.kind === kind);
|
|
1484
|
+
if (marker) {
|
|
1485
|
+
manifest.entryPoint = marker.defaultEntryPoint;
|
|
1486
|
+
}
|
|
1487
|
+
if (kind === "langchain" && !isLangchainDir) manifest.entryPoint = "index";
|
|
1488
|
+
return manifest;
|
|
1489
|
+
}
|
|
1490
|
+
async fileExists(path12) {
|
|
1491
|
+
try {
|
|
1492
|
+
await fs3.access(path12);
|
|
1493
|
+
return true;
|
|
1494
|
+
} catch {
|
|
1495
|
+
return false;
|
|
1496
|
+
}
|
|
1497
|
+
}
|
|
1498
|
+
async hasEntryPoint(dirPath, baseName) {
|
|
1499
|
+
try {
|
|
1500
|
+
await resolveEntryPoint(dirPath, baseName, this.extensions);
|
|
1501
|
+
return true;
|
|
1502
|
+
} catch {
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
async loadByKind(dirPath, manifest) {
|
|
1507
|
+
const kind = manifest.kind;
|
|
1508
|
+
const loader = getDirectoryLoader(kind);
|
|
1509
|
+
const result = await loader(dirPath, manifest, this.extensions);
|
|
1510
|
+
const list = Array.isArray(result) ? result : [result];
|
|
1511
|
+
if (list.length === 0) {
|
|
1512
|
+
throw new DiscoveryError(dirPath, "load", "No tools loaded", new Error("empty"));
|
|
1513
|
+
}
|
|
1514
|
+
return list[0];
|
|
1515
|
+
}
|
|
1516
|
+
toToolSpec(loaded, dirName, dirPath, namespace) {
|
|
1517
|
+
const { manifest } = loaded;
|
|
1518
|
+
const kindDirNames = new Set(DIRECTORY_DISCOVERABLE_KINDS);
|
|
1519
|
+
const parentName = path9.basename(path9.join(dirPath, ".."));
|
|
1520
|
+
const isKindDir = kindDirNames.has(dirName);
|
|
1521
|
+
const defaultDirName = isKindDir ? parentName : dirName;
|
|
1522
|
+
const inferredName = isKindDir ? `${namespace}/${defaultDirName}-${dirName}` : `${namespace}/${defaultDirName}`;
|
|
1523
|
+
const name = manifest.name ?? inferredName;
|
|
1524
|
+
const spec = this.buildBaseSpec(manifest, name, dirName);
|
|
1525
|
+
applyDirectoryLoadedToSpec(spec, loaded, manifest, defaultDirName, namespace);
|
|
1526
|
+
return spec;
|
|
1527
|
+
}
|
|
1528
|
+
buildBaseSpec(manifest, name, dirName) {
|
|
1529
|
+
return {
|
|
1530
|
+
name,
|
|
1531
|
+
version: manifest.version ?? "1.0.0",
|
|
1532
|
+
kind: manifest.kind,
|
|
1533
|
+
description: manifest.description ?? `${manifest.kind} tool: ${dirName}`,
|
|
1534
|
+
tags: manifest.tags,
|
|
1535
|
+
inputSchema: manifest.inputSchema ?? { type: "object", additionalProperties: true },
|
|
1536
|
+
outputSchema: manifest.outputSchema ?? { type: "object", additionalProperties: true },
|
|
1537
|
+
capabilities: manifest.capabilities ?? [],
|
|
1538
|
+
costHints: manifest.costHints
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
|
|
1543
|
+
// src/tools/mcp/MCPLoader.ts
|
|
1544
|
+
function isCursorFormat(obj) {
|
|
1545
|
+
return typeof obj === "object" && obj !== null && "mcpServers" in obj && typeof obj.mcpServers === "object" && obj.mcpServers !== null;
|
|
1546
|
+
}
|
|
1547
|
+
function extractMCPConfig(parsed, toolName) {
|
|
1548
|
+
if (isCursorFormat(parsed)) {
|
|
1549
|
+
const servers = parsed.mcpServers;
|
|
1550
|
+
const keys = Object.keys(servers);
|
|
1551
|
+
if (keys.length === 0) {
|
|
1552
|
+
return {};
|
|
1553
|
+
}
|
|
1554
|
+
const name = toolName && keys.includes(toolName) ? toolName : keys[0];
|
|
1555
|
+
return servers[name];
|
|
1556
|
+
}
|
|
1557
|
+
return parsed;
|
|
1558
|
+
}
|
|
1559
|
+
async function loadMCPTool(dirPath, manifest) {
|
|
1560
|
+
const mcpPath = path9.join(dirPath, manifest.entryPoint ?? "mcp.json");
|
|
1561
|
+
let raw;
|
|
1562
|
+
try {
|
|
1563
|
+
raw = await fs3.readFile(mcpPath, "utf-8");
|
|
1564
|
+
} catch (err) {
|
|
1565
|
+
throw new DiscoveryError(
|
|
1566
|
+
dirPath,
|
|
1567
|
+
"load",
|
|
1568
|
+
`Failed to read MCP config: ${mcpPath}`,
|
|
1569
|
+
err
|
|
1570
|
+
);
|
|
1571
|
+
}
|
|
1572
|
+
let parsed;
|
|
1573
|
+
try {
|
|
1574
|
+
parsed = JSON.parse(raw);
|
|
1575
|
+
} catch (err) {
|
|
1576
|
+
throw new DiscoveryError(
|
|
1577
|
+
dirPath,
|
|
1578
|
+
"load",
|
|
1579
|
+
`Invalid JSON in ${mcpPath}`,
|
|
1580
|
+
err
|
|
1581
|
+
);
|
|
1582
|
+
}
|
|
1583
|
+
const baseName = manifest.name?.split("/").pop();
|
|
1584
|
+
const config = extractMCPConfig(parsed, baseName);
|
|
1585
|
+
if (!config.command && !config.url) {
|
|
1586
|
+
throw new DiscoveryError(
|
|
1587
|
+
dirPath,
|
|
1588
|
+
"validate",
|
|
1589
|
+
`mcp.json must have either "command" or "url" field`
|
|
1590
|
+
);
|
|
1591
|
+
}
|
|
1592
|
+
return { manifest, dirPath, mcpConfig: config };
|
|
1593
|
+
}
|
|
881
1594
|
async function scanForAllTools(projectPath, options = {}) {
|
|
882
1595
|
const include = options.include ?? ["**/*.ts"];
|
|
883
1596
|
const tsconfigPath = options.tsconfigPath;
|
|
884
1597
|
const includeN8n = options.includeN8n === true;
|
|
885
|
-
const
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
1598
|
+
const opts = { include, tsconfigPath };
|
|
1599
|
+
const results = await Promise.all([
|
|
1600
|
+
discoverTools("function", projectPath, opts),
|
|
1601
|
+
discoverTools("skill", projectPath, opts),
|
|
1602
|
+
...includeN8n ? [discoverTools("n8n", projectPath, opts)] : []
|
|
889
1603
|
]);
|
|
890
|
-
const specs =
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
...n8nResult.n8n
|
|
894
|
-
];
|
|
895
|
-
const errors = [
|
|
896
|
-
...functionResult.errors,
|
|
897
|
-
...skillResult.errors.map((e) => ({ file: e.dir, message: e.message })),
|
|
898
|
-
...includeN8n ? n8nResult.errors.map((e) => ({ file: e.dir, message: e.message })) : []
|
|
899
|
-
];
|
|
900
|
-
const warnings = [...functionResult.warnings];
|
|
1604
|
+
const specs = results.flatMap((r) => r.specs);
|
|
1605
|
+
const errors = results.flatMap((r) => r.errors);
|
|
1606
|
+
const warnings = results.flatMap((r) => r.warnings ?? []);
|
|
901
1607
|
return { specs, errors, warnings };
|
|
902
1608
|
}
|
|
903
|
-
var __dirname$1 =
|
|
1609
|
+
var __dirname$1 = path9__namespace.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-ZBNRHRGM.cjs', document.baseURI).href))));
|
|
904
1610
|
async function loadTemplate(name) {
|
|
905
1611
|
for (const dir of [
|
|
906
|
-
|
|
907
|
-
|
|
1612
|
+
path9__namespace.join(__dirname$1, "templates"),
|
|
1613
|
+
path9__namespace.join(__dirname$1, "..", "templates")
|
|
908
1614
|
]) {
|
|
909
1615
|
try {
|
|
910
|
-
return await fs3__namespace.readFile(
|
|
1616
|
+
return await fs3__namespace.readFile(path9__namespace.join(dir, name), "utf-8");
|
|
911
1617
|
} catch {
|
|
912
1618
|
continue;
|
|
913
1619
|
}
|
|
@@ -922,14 +1628,14 @@ var TEMPLATE_NAMES = {
|
|
|
922
1628
|
};
|
|
923
1629
|
function buildToolIndexCases(specs, fromGeneratedToProject) {
|
|
924
1630
|
return specs.map((s) => {
|
|
925
|
-
const modPath =
|
|
926
|
-
return ` case "${s.name}": return (await import("${modPath}")).${s.exportName};`;
|
|
1631
|
+
const modPath = path9__namespace.join(fromGeneratedToProject, s._meta.sourcePath).replace(/\\/g, "/");
|
|
1632
|
+
return ` case "${s.name}": return (await import("${modPath}")).${s._meta.exportName};`;
|
|
927
1633
|
}).join("\n");
|
|
928
1634
|
}
|
|
929
1635
|
function buildSkillInvokerCases(specs, fromGeneratedToProject) {
|
|
930
1636
|
return specs.map((s) => {
|
|
931
|
-
const handlerPath =
|
|
932
|
-
const descEscaped = s.description.replace(/"/g, '\\"');
|
|
1637
|
+
const handlerPath = path9__namespace.join(fromGeneratedToProject, s._meta.sourcePath, "handler").replace(/\\/g, "/");
|
|
1638
|
+
const descEscaped = (s.description ?? "").replace(/"/g, '\\"');
|
|
933
1639
|
return ` case "${s.name}": {
|
|
934
1640
|
const mod = await import("${handlerPath}.js").catch(() => import("${handlerPath}.mjs"));
|
|
935
1641
|
const fn = mod.default ?? mod.handler;
|
|
@@ -942,7 +1648,8 @@ function buildSkillInvokerCases(specs, fromGeneratedToProject) {
|
|
|
942
1648
|
}
|
|
943
1649
|
function buildN8nInvokerCases(specs) {
|
|
944
1650
|
return specs.map((s) => {
|
|
945
|
-
const
|
|
1651
|
+
const webhookUrl = s.endpoint;
|
|
1652
|
+
const url = webhookUrl ? `"${webhookUrl}"` : "process.env.N8N_WEBHOOK_" + s.name.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase() + " ?? null";
|
|
946
1653
|
return ` case "${s.name}": {
|
|
947
1654
|
const url = ${url};
|
|
948
1655
|
if (!url) throw new Error("n8n webhook not configured for ${s.name}. Set N8N_WEBHOOK_* or add webhook to workflow.");
|
|
@@ -955,32 +1662,39 @@ function buildN8nInvokerCases(specs) {
|
|
|
955
1662
|
async function generate(options) {
|
|
956
1663
|
const { specs, outDir, projectPath } = options;
|
|
957
1664
|
await fs3__namespace.mkdir(outDir, { recursive: true });
|
|
958
|
-
const functionSpecs = specs.filter(
|
|
959
|
-
|
|
960
|
-
|
|
1665
|
+
const functionSpecs = specs.filter(
|
|
1666
|
+
(s) => s.kind === FUNCTION_KIND && s._meta?.sourcePath != null && s._meta?.exportName != null
|
|
1667
|
+
);
|
|
1668
|
+
const skillSpecs = specs.filter(
|
|
1669
|
+
(s) => s.kind === SKILL_KIND && s._meta?.sourcePath != null
|
|
1670
|
+
);
|
|
1671
|
+
const n8nSpecs = specs.filter((s) => s.kind === N8N_KIND);
|
|
961
1672
|
const toolSpecsJson = specs.map((s) => ({
|
|
962
1673
|
kind: s.kind,
|
|
963
1674
|
name: s.name,
|
|
964
1675
|
description: s.description,
|
|
965
1676
|
inputSchema: s.inputSchema,
|
|
966
|
-
...s.kind ===
|
|
1677
|
+
...s.kind === FUNCTION_KIND && s._meta?.sourcePath != null && s._meta?.exportName != null && {
|
|
967
1678
|
outputSchema: s.outputSchema ?? { type: "object", additionalProperties: true },
|
|
968
|
-
sourcePath: s.sourcePath,
|
|
969
|
-
exportName: s.exportName
|
|
1679
|
+
sourcePath: s._meta.sourcePath,
|
|
1680
|
+
exportName: s._meta.exportName
|
|
970
1681
|
},
|
|
971
1682
|
_meta: s._meta,
|
|
972
|
-
...s.kind ===
|
|
973
|
-
...s.kind ===
|
|
1683
|
+
...s.kind === SKILL_KIND && s._meta?.sourcePath != null && { sourcePath: s._meta.sourcePath },
|
|
1684
|
+
...s.kind === N8N_KIND && {
|
|
1685
|
+
sourcePath: s._meta?.sourcePath,
|
|
1686
|
+
webhookUrl: s.endpoint
|
|
1687
|
+
}
|
|
974
1688
|
}));
|
|
975
1689
|
await fs3__namespace.writeFile(
|
|
976
|
-
|
|
1690
|
+
path9__namespace.join(outDir, "tool-specs.json"),
|
|
977
1691
|
JSON.stringify(toolSpecsJson, null, 2),
|
|
978
1692
|
"utf-8"
|
|
979
1693
|
);
|
|
980
|
-
const configJson = { projectPath:
|
|
981
|
-
await fs3__namespace.writeFile(
|
|
982
|
-
const rel =
|
|
983
|
-
const fromGeneratedToProject = rel.split(
|
|
1694
|
+
const configJson = { projectPath: path9__namespace.resolve(projectPath) };
|
|
1695
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "config.json"), JSON.stringify(configJson, null, 2), "utf-8");
|
|
1696
|
+
const rel = path9__namespace.relative(outDir, projectPath) || ".";
|
|
1697
|
+
const fromGeneratedToProject = rel.split(path9__namespace.sep).length ? rel : ".";
|
|
984
1698
|
const [mcpServerTemplate, toolIndexTemplate, skillInvokerTemplate, n8nInvokerTemplate] = await Promise.all([
|
|
985
1699
|
loadTemplate(TEMPLATE_NAMES.mcpServer),
|
|
986
1700
|
loadTemplate(TEMPLATE_NAMES.toolIndex),
|
|
@@ -988,21 +1702,21 @@ async function generate(options) {
|
|
|
988
1702
|
loadTemplate(TEMPLATE_NAMES.n8nInvoker)
|
|
989
1703
|
]);
|
|
990
1704
|
const toolIndexTs = toolIndexTemplate.replace("{{CASES}}", buildToolIndexCases(functionSpecs, fromGeneratedToProject));
|
|
991
|
-
await fs3__namespace.writeFile(
|
|
1705
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "tool-index.ts"), toolIndexTs, "utf-8");
|
|
992
1706
|
const skillCases = buildSkillInvokerCases(skillSpecs, fromGeneratedToProject);
|
|
993
1707
|
const skillDefaultCase = skillSpecs.length === 0 ? "default: throw new Error('Unknown skill: ' + name);" : 'default: throw new Error("Unknown skill: " + name);';
|
|
994
1708
|
const skillInvokerTs = skillInvokerTemplate.replace("{{CASES}}", skillCases).replace("{{DEFAULT_CASE}}", skillDefaultCase);
|
|
995
|
-
await fs3__namespace.writeFile(
|
|
1709
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "skill-invoker.ts"), skillInvokerTs, "utf-8");
|
|
996
1710
|
const n8nCases = buildN8nInvokerCases(n8nSpecs);
|
|
997
1711
|
const n8nDefaultCase = n8nSpecs.length === 0 ? "default: throw new Error('Unknown n8n tool: ' + name);" : 'default: throw new Error("Unknown n8n tool: " + name);';
|
|
998
1712
|
const n8nInvokerTs = n8nInvokerTemplate.replace("{{CASES}}", n8nCases).replace("{{DEFAULT_CASE}}", n8nDefaultCase);
|
|
999
|
-
await fs3__namespace.writeFile(
|
|
1000
|
-
await fs3__namespace.writeFile(
|
|
1713
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "n8n-invoker.ts"), n8nInvokerTs, "utf-8");
|
|
1714
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "mcp-server.ts"), mcpServerTemplate, "utf-8");
|
|
1001
1715
|
const mcpJson = {
|
|
1002
1716
|
command: "npx",
|
|
1003
|
-
args: ["-y", "tsx",
|
|
1717
|
+
args: ["-y", "tsx", path9__namespace.join(outDir, "mcp-server.ts")]
|
|
1004
1718
|
};
|
|
1005
|
-
await fs3__namespace.writeFile(
|
|
1719
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "mcp.json"), JSON.stringify(mcpJson, null, 2), "utf-8");
|
|
1006
1720
|
const packageJson = {
|
|
1007
1721
|
name: "function-tools-mcp",
|
|
1008
1722
|
version: "1.0.0",
|
|
@@ -1016,17 +1730,17 @@ async function generate(options) {
|
|
|
1016
1730
|
tsx: ">=4.0.0"
|
|
1017
1731
|
}
|
|
1018
1732
|
};
|
|
1019
|
-
await fs3__namespace.writeFile(
|
|
1733
|
+
await fs3__namespace.writeFile(path9__namespace.join(outDir, "package.json"), JSON.stringify(packageJson, null, 2), "utf-8");
|
|
1020
1734
|
return {
|
|
1021
|
-
entryPath:
|
|
1022
|
-
mcpJsonPath:
|
|
1735
|
+
entryPath: path9__namespace.join(outDir, "mcp-server.ts"),
|
|
1736
|
+
mcpJsonPath: path9__namespace.join(outDir, "mcp.json")
|
|
1023
1737
|
};
|
|
1024
1738
|
}
|
|
1025
1739
|
|
|
1026
|
-
// src/
|
|
1740
|
+
// src/api/expose/mcp-build/build.ts
|
|
1027
1741
|
async function buildMcpPackage(options = {}) {
|
|
1028
|
-
const projectPath =
|
|
1029
|
-
const outDir =
|
|
1742
|
+
const projectPath = path9__namespace.resolve(options.projectPath ?? process.cwd());
|
|
1743
|
+
const outDir = path9__namespace.resolve(projectPath, options.outDir ?? "dist");
|
|
1030
1744
|
const include = options.include ?? ["**/*.ts"];
|
|
1031
1745
|
const tsconfigPath = options.tsconfigPath;
|
|
1032
1746
|
const scanResult = await scanForAllTools(projectPath, {
|
|
@@ -1060,12 +1774,12 @@ var buildFunctionToTool = buildMcpPackage;
|
|
|
1060
1774
|
async function runMcpServer(options = {}) {
|
|
1061
1775
|
const base = options.path ?? process.cwd();
|
|
1062
1776
|
const candidates = [
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1777
|
+
path9__namespace.join(base, "mcp-server.ts"),
|
|
1778
|
+
path9__namespace.join(base, "mcp-server.js"),
|
|
1779
|
+
path9__namespace.join(base, "dist", "mcp-server.ts"),
|
|
1780
|
+
path9__namespace.join(base, "dist", "mcp-server.js"),
|
|
1781
|
+
path9__namespace.join(base, "generated", "mcp-server.ts"),
|
|
1782
|
+
path9__namespace.join(base, "generated", "mcp-server.js")
|
|
1069
1783
|
];
|
|
1070
1784
|
let entry = "";
|
|
1071
1785
|
for (const p of candidates) {
|
|
@@ -1081,8 +1795,8 @@ async function runMcpServer(options = {}) {
|
|
|
1081
1795
|
`MCP entrypoint not found. Run "agent-tool build" first, or pass --path to a directory containing mcp-server.ts. Tried: ${candidates.join(", ")}`
|
|
1082
1796
|
);
|
|
1083
1797
|
}
|
|
1084
|
-
const dir =
|
|
1085
|
-
const child = child_process.spawn("npx", ["-y", "tsx",
|
|
1798
|
+
const dir = path9__namespace.dirname(entry);
|
|
1799
|
+
const child = child_process.spawn("npx", ["-y", "tsx", path9__namespace.basename(entry)], {
|
|
1086
1800
|
cwd: dir,
|
|
1087
1801
|
stdio: ["pipe", "pipe", "inherit"],
|
|
1088
1802
|
shell: false
|
|
@@ -1091,18 +1805,20 @@ async function runMcpServer(options = {}) {
|
|
|
1091
1805
|
}
|
|
1092
1806
|
var runGeneratedMCP = runMcpServer;
|
|
1093
1807
|
|
|
1808
|
+
exports.DirectoryScanner = DirectoryScanner;
|
|
1094
1809
|
exports.DiscoveryError = DiscoveryError;
|
|
1095
1810
|
exports.SkillManifestError = SkillManifestError;
|
|
1096
1811
|
exports.buildFunctionToTool = buildFunctionToTool;
|
|
1097
1812
|
exports.buildMcpPackage = buildMcpPackage;
|
|
1098
1813
|
exports.initProject = initProject;
|
|
1099
|
-
exports.
|
|
1814
|
+
exports.loadMCPTool = loadMCPTool;
|
|
1100
1815
|
exports.loadSkillDefinition = loadSkillDefinition;
|
|
1101
1816
|
exports.parseSkillMd = parseSkillMd;
|
|
1102
1817
|
exports.runGeneratedMCP = runGeneratedMCP;
|
|
1103
1818
|
exports.runMcpServer = runMcpServer;
|
|
1819
|
+
exports.scan = scan;
|
|
1104
1820
|
exports.scanForTools = scanForTools;
|
|
1105
1821
|
exports.scanSkillResources = scanSkillResources;
|
|
1106
1822
|
exports.validateFrontmatter = validateFrontmatter;
|
|
1107
|
-
//# sourceMappingURL=chunk-
|
|
1108
|
-
//# sourceMappingURL=chunk-
|
|
1823
|
+
//# sourceMappingURL=chunk-ZBNRHRGM.cjs.map
|
|
1824
|
+
//# sourceMappingURL=chunk-ZBNRHRGM.cjs.map
|