@easynet/agent-tool 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/main.cjs +14 -14
- package/dist/api/main.js +3 -3
- package/dist/{chunk-5NOAYHLP.cjs → chunk-2E4GZA53.cjs} +7 -7
- package/dist/{chunk-5NOAYHLP.cjs.map → chunk-2E4GZA53.cjs.map} +1 -1
- package/dist/{chunk-FQQDPJ7Z.js → chunk-AC5WE7YP.js} +4 -48
- package/dist/chunk-AC5WE7YP.js.map +1 -0
- package/dist/{chunk-2SH6IOCF.cjs → chunk-BE4VFTNO.cjs} +9 -9
- package/dist/{chunk-2SH6IOCF.cjs.map → chunk-BE4VFTNO.cjs.map} +1 -1
- package/dist/{chunk-FQS77UEY.js → chunk-BQOM3OVB.js} +3 -3
- package/dist/{chunk-FQS77UEY.js.map → chunk-BQOM3OVB.js.map} +1 -1
- package/dist/{chunk-CM5YKSRS.js → chunk-DOBYMSXJ.js} +3 -3
- package/dist/{chunk-CM5YKSRS.js.map → chunk-DOBYMSXJ.js.map} +1 -1
- package/dist/{chunk-UTRTRLZW.js → chunk-LUCTQI4H.js} +3 -3
- package/dist/{chunk-UTRTRLZW.js.map → chunk-LUCTQI4H.js.map} +1 -1
- package/dist/{chunk-5BO3RL5R.cjs → chunk-SASSFELH.cjs} +12 -12
- package/dist/{chunk-5BO3RL5R.cjs.map → chunk-SASSFELH.cjs.map} +1 -1
- package/dist/{chunk-ORKC2PK2.cjs → chunk-SAXVYBRM.cjs} +5 -49
- package/dist/chunk-SAXVYBRM.cjs.map +1 -0
- package/dist/index.cjs +59 -59
- package/dist/index.js +5 -5
- package/dist/tools/util/toolDescriptor.d.ts +9 -12
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +37 -23
- package/dist/utils/cli/index.cjs.map +1 -1
- package/dist/utils/cli/index.d.ts.map +1 -1
- package/dist/utils/cli/index.js +25 -11
- package/dist/utils/cli/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-FQQDPJ7Z.js.map +0 -1
- package/dist/chunk-ORKC2PK2.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkSASSFELH_cjs = require('./chunk-SASSFELH.cjs');
|
|
4
|
+
var chunkBE4VFTNO_cjs = require('./chunk-BE4VFTNO.cjs');
|
|
5
|
+
var chunkSAXVYBRM_cjs = require('./chunk-SAXVYBRM.cjs');
|
|
5
6
|
var chunkSOFUWEZ6_cjs = require('./chunk-SOFUWEZ6.cjs');
|
|
6
|
-
var chunkORKC2PK2_cjs = require('./chunk-ORKC2PK2.cjs');
|
|
7
7
|
var chunkZNJBRLKN_cjs = require('./chunk-ZNJBRLKN.cjs');
|
|
8
8
|
require('./chunk-6F5JHLZ7.cjs');
|
|
9
9
|
var path = require('path');
|
|
@@ -21,7 +21,7 @@ var MCPClientAdapter = class {
|
|
|
21
21
|
constructor(client) {
|
|
22
22
|
this.client = client;
|
|
23
23
|
}
|
|
24
|
-
kind =
|
|
24
|
+
kind = chunkSAXVYBRM_cjs.MCP_KIND;
|
|
25
25
|
async invoke(spec, args, _ctx) {
|
|
26
26
|
const params = args != null && typeof args === "object" && !Array.isArray(args) ? args : {};
|
|
27
27
|
const result = await this.client.callTool({ name: spec.name, arguments: params });
|
|
@@ -62,7 +62,7 @@ function mcpToolsToSpecs(tools) {
|
|
|
62
62
|
return tools.map((t) => ({
|
|
63
63
|
name: t.name,
|
|
64
64
|
version: "1.0.0",
|
|
65
|
-
kind:
|
|
65
|
+
kind: chunkSAXVYBRM_cjs.MCP_KIND,
|
|
66
66
|
description: t.description ?? `MCP tool: ${t.name}`,
|
|
67
67
|
inputSchema: t.inputSchema ?? chunkSOFUWEZ6_cjs.DEFAULT_INPUT_SCHEMA,
|
|
68
68
|
outputSchema: chunkSOFUWEZ6_cjs.DEFAULT_OUTPUT_SCHEMA,
|
|
@@ -102,8 +102,8 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
|
|
|
102
102
|
const configPath = options.configPath ?? process.env.MCP_CONFIG_PATH ?? path.join(process.cwd(), "mcp.json");
|
|
103
103
|
const dirPath = path.dirname(configPath);
|
|
104
104
|
const entryPoint = path.basename(configPath);
|
|
105
|
-
const toolName = options.toolName ??
|
|
106
|
-
const loaded = await
|
|
105
|
+
const toolName = options.toolName ?? chunkSAXVYBRM_cjs.MCP_KIND;
|
|
106
|
+
const loaded = await chunkBE4VFTNO_cjs.loadMCPTool(dirPath, { kind: chunkSAXVYBRM_cjs.MCP_KIND, name: toolName, entryPoint });
|
|
107
107
|
if (!loaded.mcpConfig) {
|
|
108
108
|
throw new Error("mcp.json must have command or url");
|
|
109
109
|
}
|
|
@@ -119,175 +119,175 @@ async function registerMCPToolsFromConfig(runtime, registry, options = {}) {
|
|
|
119
119
|
|
|
120
120
|
Object.defineProperty(exports, "LangChainToolsHub", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkSASSFELH_cjs.LangChainToolsHub; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "createAgentTools", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkSASSFELH_cjs.createAgentTools; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "DirectoryScanner", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkBE4VFTNO_cjs.DirectoryScanner; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "DiscoveryError", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkBE4VFTNO_cjs.DiscoveryError; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "SkillManifestError", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkBE4VFTNO_cjs.SkillManifestError; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "buildFunctionToTool", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkBE4VFTNO_cjs.buildFunctionToTool; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "buildMcpPackage", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkBE4VFTNO_cjs.buildMcpPackage; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "initProject", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkBE4VFTNO_cjs.initProject; }
|
|
151
151
|
});
|
|
152
152
|
Object.defineProperty(exports, "loadMCPTool", {
|
|
153
153
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
154
|
+
get: function () { return chunkBE4VFTNO_cjs.loadMCPTool; }
|
|
155
155
|
});
|
|
156
156
|
Object.defineProperty(exports, "loadSkillDefinition", {
|
|
157
157
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
158
|
+
get: function () { return chunkBE4VFTNO_cjs.loadSkillDefinition; }
|
|
159
159
|
});
|
|
160
160
|
Object.defineProperty(exports, "parseSkillMd", {
|
|
161
161
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
162
|
+
get: function () { return chunkBE4VFTNO_cjs.parseSkillMd; }
|
|
163
163
|
});
|
|
164
164
|
Object.defineProperty(exports, "runGeneratedMCP", {
|
|
165
165
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
166
|
+
get: function () { return chunkBE4VFTNO_cjs.runGeneratedMCP; }
|
|
167
167
|
});
|
|
168
168
|
Object.defineProperty(exports, "runMcpServer", {
|
|
169
169
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
170
|
+
get: function () { return chunkBE4VFTNO_cjs.runMcpServer; }
|
|
171
171
|
});
|
|
172
172
|
Object.defineProperty(exports, "scan", {
|
|
173
173
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
174
|
+
get: function () { return chunkBE4VFTNO_cjs.scan; }
|
|
175
175
|
});
|
|
176
176
|
Object.defineProperty(exports, "scanForTools", {
|
|
177
177
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
178
|
+
get: function () { return chunkBE4VFTNO_cjs.scanForTools; }
|
|
179
179
|
});
|
|
180
180
|
Object.defineProperty(exports, "scanSkillResources", {
|
|
181
181
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
182
|
+
get: function () { return chunkBE4VFTNO_cjs.scanSkillResources; }
|
|
183
183
|
});
|
|
184
184
|
Object.defineProperty(exports, "validateFrontmatter", {
|
|
185
185
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
187
|
-
});
|
|
188
|
-
Object.defineProperty(exports, "DEFAULT_INPUT_SCHEMA", {
|
|
189
|
-
enumerable: true,
|
|
190
|
-
get: function () { return chunkSOFUWEZ6_cjs.DEFAULT_INPUT_SCHEMA; }
|
|
191
|
-
});
|
|
192
|
-
Object.defineProperty(exports, "DEFAULT_OUTPUT_SCHEMA", {
|
|
193
|
-
enumerable: true,
|
|
194
|
-
get: function () { return chunkSOFUWEZ6_cjs.DEFAULT_OUTPUT_SCHEMA; }
|
|
195
|
-
});
|
|
196
|
-
Object.defineProperty(exports, "createToolSpec", {
|
|
197
|
-
enumerable: true,
|
|
198
|
-
get: function () { return chunkSOFUWEZ6_cjs.createToolSpec; }
|
|
186
|
+
get: function () { return chunkBE4VFTNO_cjs.validateFrontmatter; }
|
|
199
187
|
});
|
|
200
188
|
Object.defineProperty(exports, "BudgetManager", {
|
|
201
189
|
enumerable: true,
|
|
202
|
-
get: function () { return
|
|
190
|
+
get: function () { return chunkSAXVYBRM_cjs.BudgetManager; }
|
|
203
191
|
});
|
|
204
192
|
Object.defineProperty(exports, "EventLog", {
|
|
205
193
|
enumerable: true,
|
|
206
|
-
get: function () { return
|
|
194
|
+
get: function () { return chunkSAXVYBRM_cjs.EventLog; }
|
|
207
195
|
});
|
|
208
196
|
Object.defineProperty(exports, "Metrics", {
|
|
209
197
|
enumerable: true,
|
|
210
|
-
get: function () { return
|
|
198
|
+
get: function () { return chunkSAXVYBRM_cjs.Metrics; }
|
|
211
199
|
});
|
|
212
200
|
Object.defineProperty(exports, "PTCRuntime", {
|
|
213
201
|
enumerable: true,
|
|
214
|
-
get: function () { return
|
|
202
|
+
get: function () { return chunkSAXVYBRM_cjs.PTCRuntime; }
|
|
215
203
|
});
|
|
216
204
|
Object.defineProperty(exports, "PolicyDeniedError", {
|
|
217
205
|
enumerable: true,
|
|
218
|
-
get: function () { return
|
|
206
|
+
get: function () { return chunkSAXVYBRM_cjs.PolicyDeniedError; }
|
|
219
207
|
});
|
|
220
208
|
Object.defineProperty(exports, "PolicyEngine", {
|
|
221
209
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
210
|
+
get: function () { return chunkSAXVYBRM_cjs.PolicyEngine; }
|
|
223
211
|
});
|
|
224
212
|
Object.defineProperty(exports, "SchemaValidationError", {
|
|
225
213
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
214
|
+
get: function () { return chunkSAXVYBRM_cjs.SchemaValidationError; }
|
|
227
215
|
});
|
|
228
216
|
Object.defineProperty(exports, "SchemaValidator", {
|
|
229
217
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
218
|
+
get: function () { return chunkSAXVYBRM_cjs.SchemaValidator; }
|
|
231
219
|
});
|
|
232
220
|
Object.defineProperty(exports, "Tracing", {
|
|
233
221
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
222
|
+
get: function () { return chunkSAXVYBRM_cjs.Tracing; }
|
|
235
223
|
});
|
|
236
224
|
Object.defineProperty(exports, "buildEvidence", {
|
|
237
225
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
226
|
+
get: function () { return chunkSAXVYBRM_cjs.buildEvidence; }
|
|
239
227
|
});
|
|
240
228
|
Object.defineProperty(exports, "createLogger", {
|
|
241
229
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
230
|
+
get: function () { return chunkSAXVYBRM_cjs.createLogger; }
|
|
243
231
|
});
|
|
244
232
|
Object.defineProperty(exports, "ensurePackageInCache", {
|
|
245
233
|
enumerable: true,
|
|
246
|
-
get: function () { return
|
|
234
|
+
get: function () { return chunkSAXVYBRM_cjs.ensurePackageInCache; }
|
|
247
235
|
});
|
|
248
236
|
Object.defineProperty(exports, "expandToolDescriptorsToRegistryNames", {
|
|
249
237
|
enumerable: true,
|
|
250
|
-
get: function () { return
|
|
238
|
+
get: function () { return chunkSAXVYBRM_cjs.expandToolDescriptorsToRegistryNames; }
|
|
251
239
|
});
|
|
252
240
|
Object.defineProperty(exports, "getPackageEntryPath", {
|
|
253
241
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
242
|
+
get: function () { return chunkSAXVYBRM_cjs.getPackageEntryPath; }
|
|
255
243
|
});
|
|
256
244
|
Object.defineProperty(exports, "importFromCache", {
|
|
257
245
|
enumerable: true,
|
|
258
|
-
get: function () { return
|
|
246
|
+
get: function () { return chunkSAXVYBRM_cjs.importFromCache; }
|
|
259
247
|
});
|
|
260
248
|
Object.defineProperty(exports, "isNpmToolDescriptor", {
|
|
261
249
|
enumerable: true,
|
|
262
|
-
get: function () { return
|
|
250
|
+
get: function () { return chunkSAXVYBRM_cjs.isNpmToolDescriptor; }
|
|
263
251
|
});
|
|
264
252
|
Object.defineProperty(exports, "loadToolConfig", {
|
|
265
253
|
enumerable: true,
|
|
266
|
-
get: function () { return
|
|
254
|
+
get: function () { return chunkSAXVYBRM_cjs.loadToolConfig; }
|
|
267
255
|
});
|
|
268
256
|
Object.defineProperty(exports, "normalizeToolList", {
|
|
269
257
|
enumerable: true,
|
|
270
|
-
get: function () { return
|
|
258
|
+
get: function () { return chunkSAXVYBRM_cjs.normalizeToolList; }
|
|
271
259
|
});
|
|
272
260
|
Object.defineProperty(exports, "parseNpmToolDescriptor", {
|
|
273
261
|
enumerable: true,
|
|
274
|
-
get: function () { return
|
|
262
|
+
get: function () { return chunkSAXVYBRM_cjs.parseNpmToolDescriptor; }
|
|
275
263
|
});
|
|
276
264
|
Object.defineProperty(exports, "resolveNpmToolDescriptor", {
|
|
277
265
|
enumerable: true,
|
|
278
|
-
get: function () { return
|
|
266
|
+
get: function () { return chunkSAXVYBRM_cjs.resolveNpmToolDescriptor; }
|
|
279
267
|
});
|
|
280
268
|
Object.defineProperty(exports, "resolveToolDescriptor", {
|
|
281
269
|
enumerable: true,
|
|
282
|
-
get: function () { return
|
|
270
|
+
get: function () { return chunkSAXVYBRM_cjs.resolveToolDescriptor; }
|
|
283
271
|
});
|
|
284
272
|
Object.defineProperty(exports, "sanitizeForLog", {
|
|
285
273
|
enumerable: true,
|
|
286
|
-
get: function () { return
|
|
274
|
+
get: function () { return chunkSAXVYBRM_cjs.sanitizeForLog; }
|
|
287
275
|
});
|
|
288
276
|
Object.defineProperty(exports, "summarizeForLog", {
|
|
289
277
|
enumerable: true,
|
|
290
|
-
get: function () { return
|
|
278
|
+
get: function () { return chunkSAXVYBRM_cjs.summarizeForLog; }
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(exports, "DEFAULT_INPUT_SCHEMA", {
|
|
281
|
+
enumerable: true,
|
|
282
|
+
get: function () { return chunkSOFUWEZ6_cjs.DEFAULT_INPUT_SCHEMA; }
|
|
283
|
+
});
|
|
284
|
+
Object.defineProperty(exports, "DEFAULT_OUTPUT_SCHEMA", {
|
|
285
|
+
enumerable: true,
|
|
286
|
+
get: function () { return chunkSOFUWEZ6_cjs.DEFAULT_OUTPUT_SCHEMA; }
|
|
287
|
+
});
|
|
288
|
+
Object.defineProperty(exports, "createToolSpec", {
|
|
289
|
+
enumerable: true,
|
|
290
|
+
get: function () { return chunkSOFUWEZ6_cjs.createToolSpec; }
|
|
291
291
|
});
|
|
292
292
|
Object.defineProperty(exports, "ToolRegistry", {
|
|
293
293
|
enumerable: true,
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { LangChainToolsHub, createAgentTools } from './chunk-
|
|
2
|
-
import { loadMCPTool } from './chunk-
|
|
3
|
-
export { DirectoryScanner, DiscoveryError, SkillManifestError, buildFunctionToTool, buildMcpPackage, initProject, loadMCPTool, loadSkillDefinition, parseSkillMd, runGeneratedMCP, runMcpServer, scan, scanForTools, scanSkillResources, validateFrontmatter } from './chunk-
|
|
1
|
+
export { LangChainToolsHub, createAgentTools } from './chunk-LUCTQI4H.js';
|
|
2
|
+
import { loadMCPTool } from './chunk-DOBYMSXJ.js';
|
|
3
|
+
export { DirectoryScanner, DiscoveryError, SkillManifestError, buildFunctionToTool, buildMcpPackage, initProject, loadMCPTool, loadSkillDefinition, parseSkillMd, runGeneratedMCP, runMcpServer, scan, scanForTools, scanSkillResources, validateFrontmatter } from './chunk-DOBYMSXJ.js';
|
|
4
|
+
import { MCP_KIND } from './chunk-AC5WE7YP.js';
|
|
5
|
+
export { BudgetManager, EventLog, Metrics, PTCRuntime, PolicyDeniedError, PolicyEngine, SchemaValidationError, SchemaValidator, Tracing, buildEvidence, createLogger, ensurePackageInCache, expandToolDescriptorsToRegistryNames, getPackageEntryPath, importFromCache, isNpmToolDescriptor, loadToolConfig, normalizeToolList, parseNpmToolDescriptor, resolveNpmToolDescriptor, resolveToolDescriptor, sanitizeForLog, summarizeForLog } from './chunk-AC5WE7YP.js';
|
|
4
6
|
import { DEFAULT_OUTPUT_SCHEMA, DEFAULT_INPUT_SCHEMA } from './chunk-5SWSNVMI.js';
|
|
5
7
|
export { DEFAULT_INPUT_SCHEMA, DEFAULT_OUTPUT_SCHEMA, createToolSpec } from './chunk-5SWSNVMI.js';
|
|
6
|
-
import { MCP_KIND } from './chunk-FQQDPJ7Z.js';
|
|
7
|
-
export { BudgetManager, EventLog, Metrics, PTCRuntime, PolicyDeniedError, PolicyEngine, SchemaValidationError, SchemaValidator, Tracing, buildEvidence, createLogger, ensurePackageInCache, expandToolDescriptorsToRegistryNames, getPackageEntryPath, importFromCache, isNpmToolDescriptor, loadToolConfig, normalizeToolList, parseNpmToolDescriptor, resolveNpmToolDescriptor, resolveToolDescriptor, sanitizeForLog, summarizeForLog } from './chunk-FQQDPJ7Z.js';
|
|
8
8
|
export { ToolRegistry, createTaggedError, isRetryable, withRetry } from './chunk-AE6FSNGY.js';
|
|
9
9
|
import './chunk-FR2CXERF.js';
|
|
10
10
|
import { join, dirname, basename } from 'path';
|
|
@@ -54,24 +54,21 @@ export declare function isNpmToolDescriptor(descriptor: string): boolean;
|
|
|
54
54
|
* @deprecated Prefer parseToolPath(descriptor) for protocol:scope/package#toolName
|
|
55
55
|
*/
|
|
56
56
|
export declare function parseNpmToolDescriptor(descriptor: string): NpmToolDescriptor | null;
|
|
57
|
-
/** Full package descriptor for builtin tools (display scope). Use with optional @version. */
|
|
58
|
-
export declare const BUILTIN_DISPLAY_SCOPE_PREFIX = "npm:@easynet/agent-tool-builtin";
|
|
59
57
|
/**
|
|
60
|
-
* Return the display scope
|
|
61
|
-
*
|
|
58
|
+
* Return the display scope for a tool: the first segment of the registry name (before the first "/"),
|
|
59
|
+
* or the full name if there is no "/".
|
|
62
60
|
*/
|
|
63
|
-
export declare function getDisplayScope(registryName: string,
|
|
61
|
+
export declare function getDisplayScope(registryName: string, _kind?: string, _toolVersion?: string): string;
|
|
64
62
|
/**
|
|
65
|
-
* Resolve a single npm tool descriptor to
|
|
66
|
-
*
|
|
63
|
+
* Resolve a single npm tool descriptor to a registry name.
|
|
64
|
+
* This package does not resolve npm descriptors to registry names; resolution is done by the runtime/loader.
|
|
65
|
+
* Returns null so that resolveToolDescriptor returns the descriptor as-is.
|
|
67
66
|
*/
|
|
68
67
|
export declare function resolveNpmToolDescriptor(descriptor: string): string | null;
|
|
69
68
|
/**
|
|
70
|
-
* Expand a list of tool descriptors
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
* - npm:@easynet/agent-tool-builtin -> all core/* names from registry
|
|
74
|
-
* - Plain names and already-resolved names are kept as-is (exact match).
|
|
69
|
+
* Expand a list of tool descriptors to registry tool names.
|
|
70
|
+
* Only descriptors that are already registry names (exact match in registryNames) are included.
|
|
71
|
+
* npm:... descriptors are not resolved here; use registry names in the list or resolve elsewhere.
|
|
75
72
|
*/
|
|
76
73
|
export declare function expandToolDescriptorsToRegistryNames(descriptors: string[], registryNames: string[]): string[];
|
|
77
74
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolDescriptor.d.ts","sourceRoot":"","sources":["../../../src/tools/util/toolDescriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,6HAA6H;AAC7H,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAUjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,GAAG,cAAc,CAO9E;AAOD,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAOnF;
|
|
1
|
+
{"version":3,"file":"toolDescriptor.d.ts","sourceRoot":"","sources":["../../../src/tools/util/toolDescriptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,6HAA6H;AAC7H,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAUjE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,kBAAkB,EAAE,MAAM,GAAG,cAAc,CAO9E;AAOD,MAAM,WAAW,iBAAiB;IAChC,2CAA2C;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAOnF;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,YAAY,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAGR;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,oCAAoC,CAClD,WAAW,EAAE,MAAM,EAAE,EACrB,aAAa,EAAE,MAAM,EAAE,GACtB,MAAM,EAAE,CAiBV;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAKhE;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAYjE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAErD"}
|
package/dist/utils/cli/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkBE4VFTNO_cjs = require('../../chunk-BE4VFTNO.cjs');
|
|
5
|
+
var chunk2E4GZA53_cjs = require('../../chunk-2E4GZA53.cjs');
|
|
6
|
+
var chunkSAXVYBRM_cjs = require('../../chunk-SAXVYBRM.cjs');
|
|
5
7
|
require('../../chunk-SOFUWEZ6.cjs');
|
|
6
|
-
var chunk5NOAYHLP_cjs = require('../../chunk-5NOAYHLP.cjs');
|
|
7
|
-
var chunkORKC2PK2_cjs = require('../../chunk-ORKC2PK2.cjs');
|
|
8
8
|
require('../../chunk-ZNJBRLKN.cjs');
|
|
9
9
|
var chunk6F5JHLZ7_cjs = require('../../chunk-6F5JHLZ7.cjs');
|
|
10
10
|
var path = require('path');
|
|
@@ -24,10 +24,10 @@ async function getRuntimeWithTools(pathOpt, verbose = false) {
|
|
|
24
24
|
const stepLog = verbose ? (msg) => process.stderr.write(`[agent-tool] ${msg}
|
|
25
25
|
`) : void 0;
|
|
26
26
|
if (stepLog) stepLog(`Loading tool config from ${searchDir}`);
|
|
27
|
-
const config =
|
|
27
|
+
const config = chunkSAXVYBRM_cjs.findAndLoadToolConfig(searchDir);
|
|
28
28
|
let sandboxRoot = cwd;
|
|
29
29
|
if (config.sandboxedPath && typeof config.sandboxedPath === "string" && config.configPath) {
|
|
30
|
-
sandboxRoot =
|
|
30
|
+
sandboxRoot = chunkSAXVYBRM_cjs.resolveSandboxedPath(config.configPath, config.sandboxedPath);
|
|
31
31
|
}
|
|
32
32
|
if (stepLog) {
|
|
33
33
|
if (config.configPath) {
|
|
@@ -38,7 +38,7 @@ async function getRuntimeWithTools(pathOpt, verbose = false) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
const coreConfig = { sandboxRoot, allowedHosts: [] };
|
|
41
|
-
const result = await
|
|
41
|
+
const result = await chunkSAXVYBRM_cjs.createRuntimeFromConfig({
|
|
42
42
|
coreTools: coreConfig,
|
|
43
43
|
configFilePath: config.configPath,
|
|
44
44
|
stepLog
|
|
@@ -57,6 +57,7 @@ function parseArgv(argv) {
|
|
|
57
57
|
let startSub = "http";
|
|
58
58
|
let help = false;
|
|
59
59
|
let verbose = false;
|
|
60
|
+
let mcpStdio = false;
|
|
60
61
|
let pathOpt = "";
|
|
61
62
|
let outDir = "";
|
|
62
63
|
let include = [];
|
|
@@ -84,6 +85,8 @@ function parseArgv(argv) {
|
|
|
84
85
|
help = true;
|
|
85
86
|
} else if (arg === "--verbose" || arg === "-v") {
|
|
86
87
|
verbose = true;
|
|
88
|
+
} else if (arg === "--stdio") {
|
|
89
|
+
mcpStdio = true;
|
|
87
90
|
} else if (arg === "--path" || arg === "-p") {
|
|
88
91
|
pathOpt = path__default.default.resolve(process.cwd(), args[++i] ?? "");
|
|
89
92
|
} else if (arg === "--out" || arg === "-o") {
|
|
@@ -115,7 +118,7 @@ function parseArgv(argv) {
|
|
|
115
118
|
}
|
|
116
119
|
}
|
|
117
120
|
}
|
|
118
|
-
return { command, startSub, help, verbose, pathOpt, outDir, include, includeN8n, toolName, toolArgsJson, port, host };
|
|
121
|
+
return { command, startSub, help, verbose, mcpStdio, pathOpt, outDir, include, includeN8n, toolName, toolArgsJson, port, host };
|
|
119
122
|
}
|
|
120
123
|
function printHelp() {
|
|
121
124
|
const bin = "agent-tool";
|
|
@@ -126,7 +129,7 @@ Primary commands:
|
|
|
126
129
|
ls List all tools (scope, name, description).
|
|
127
130
|
describe <tool path> Show tool details (schema, capabilities, etc.).
|
|
128
131
|
run <tool path> [params] Run a tool. Params: JSON, e.g. '{"path":"README.md"}'
|
|
129
|
-
start mcp Start MCP server
|
|
132
|
+
start mcp Start MCP server (default: Streamable HTTP; use --stdio for stdio).
|
|
130
133
|
start http Start OpenAPI HTTP server (API + Swagger).
|
|
131
134
|
|
|
132
135
|
Other commands:
|
|
@@ -143,8 +146,9 @@ Options:
|
|
|
143
146
|
--include, -i <glob> For build: glob for TS files.
|
|
144
147
|
--include-n8n For build: include n8n workflow tools.
|
|
145
148
|
--verbose, -v Print step logs (config load, cache, tools registered).
|
|
146
|
-
--
|
|
147
|
-
--
|
|
149
|
+
--stdio For start mcp: use stdio transport (default: Streamable HTTP).
|
|
150
|
+
--port <number> For start mcp/http: port (default: 3000).
|
|
151
|
+
--host <string> For start mcp/http: host (default: 127.0.0.1).
|
|
148
152
|
--help, -h Show this help.
|
|
149
153
|
|
|
150
154
|
Examples:
|
|
@@ -152,6 +156,7 @@ Examples:
|
|
|
152
156
|
${bin} describe core/fs.readText
|
|
153
157
|
${bin} run core/fs.readText '{"path":"README.md"}'
|
|
154
158
|
${bin} start mcp
|
|
159
|
+
${bin} start mcp --stdio
|
|
155
160
|
${bin} start http --port 3000
|
|
156
161
|
${bin} build --path . --out dist
|
|
157
162
|
|
|
@@ -160,7 +165,7 @@ For agent run (ReAct + agent.yaml): npx @easynet/agent-orchestra run "task" -c a
|
|
|
160
165
|
}
|
|
161
166
|
async function cmdInit(pathOpt) {
|
|
162
167
|
try {
|
|
163
|
-
const { targetPath, filesCreated } = await
|
|
168
|
+
const { targetPath, filesCreated } = await chunkBE4VFTNO_cjs.initProject({ targetPath: pathOpt || void 0 });
|
|
164
169
|
process.stdout.write(`Initialized project at ${targetPath}
|
|
165
170
|
Created: ${filesCreated.join(", ")}
|
|
166
171
|
Next: npm install && npm run build
|
|
@@ -174,7 +179,7 @@ Next: npm install && npm run build
|
|
|
174
179
|
}
|
|
175
180
|
async function cmdBuild(pathOpt, outDir, include, includeN8n) {
|
|
176
181
|
try {
|
|
177
|
-
const result = await
|
|
182
|
+
const result = await chunkBE4VFTNO_cjs.buildMcpPackage({
|
|
178
183
|
projectPath: pathOpt || void 0,
|
|
179
184
|
outDir: outDir || void 0,
|
|
180
185
|
include: include.length > 0 ? include : void 0,
|
|
@@ -195,7 +200,7 @@ mcp.json: ${result.mcpJsonPath}
|
|
|
195
200
|
}
|
|
196
201
|
async function cmdServe(pathOpt) {
|
|
197
202
|
try {
|
|
198
|
-
const { process: child } = await
|
|
203
|
+
const { process: child } = await chunkBE4VFTNO_cjs.runMcpServer({ path: pathOpt || void 0 });
|
|
199
204
|
child.stdin?.pipe(process.stdin);
|
|
200
205
|
child.stdout?.pipe(process.stdout);
|
|
201
206
|
process.stdin?.unref();
|
|
@@ -213,7 +218,7 @@ var LS_DESC_MAX = 72;
|
|
|
213
218
|
function formatLsOutput(specs) {
|
|
214
219
|
const rows = specs.map((spec) => {
|
|
215
220
|
const { name } = parseToolName(spec.name);
|
|
216
|
-
const scope =
|
|
221
|
+
const scope = chunkSAXVYBRM_cjs.getDisplayScope(spec.name, spec.kind, spec.version);
|
|
217
222
|
const desc = (spec.description ?? "").replace(/\n/g, " ").trim().slice(0, LS_DESC_MAX);
|
|
218
223
|
return { scope, name, description: desc || "(no description)" };
|
|
219
224
|
});
|
|
@@ -240,7 +245,7 @@ function formatLsOutput(specs) {
|
|
|
240
245
|
}
|
|
241
246
|
function formatDescribeOutput(spec) {
|
|
242
247
|
const { name: localName } = parseToolName(spec.name);
|
|
243
|
-
const scope =
|
|
248
|
+
const scope = chunkSAXVYBRM_cjs.getDisplayScope(spec.name, spec.kind, spec.version);
|
|
244
249
|
const sections = [];
|
|
245
250
|
sections.push("\u250C\u2500 Tool");
|
|
246
251
|
sections.push(`\u2502 name: ${spec.name}`);
|
|
@@ -276,7 +281,7 @@ async function cmdLs(pathOpt, verbose = false) {
|
|
|
276
281
|
process.stdout.write("No tools registered.\n");
|
|
277
282
|
const cwd = process.cwd();
|
|
278
283
|
const searchDir = path__default.default.resolve(cwd, pathOpt ?? ".");
|
|
279
|
-
const config =
|
|
284
|
+
const config = chunkSAXVYBRM_cjs.findAndLoadToolConfig(searchDir);
|
|
280
285
|
const hasNpmTools = Array.isArray(config.tools) && config.tools.some((t) => typeof t === "string" && t.startsWith("npm:"));
|
|
281
286
|
if (hasNpmTools) {
|
|
282
287
|
process.stdout.write("Tip: Install builtin tools in this directory: npm init -y && npm install @easynet/agent-tool-buildin\n");
|
|
@@ -299,7 +304,7 @@ async function cmdDescribe(toolName, pathOpt, verbose = false) {
|
|
|
299
304
|
}
|
|
300
305
|
try {
|
|
301
306
|
const { registry } = await getRuntimeWithTools(pathOpt, verbose);
|
|
302
|
-
const registryName =
|
|
307
|
+
const registryName = chunkSAXVYBRM_cjs.resolveToolDescriptor(toolName.trim());
|
|
303
308
|
const spec = registry.get(registryName);
|
|
304
309
|
if (!spec) {
|
|
305
310
|
process.stderr.write(`Tool not found: ${toolName}
|
|
@@ -348,7 +353,7 @@ async function cmdRun(toolName, toolArgsJson, pathOpt, verbose = false) {
|
|
|
348
353
|
}
|
|
349
354
|
try {
|
|
350
355
|
const { runtime, registry } = await getRuntimeWithTools(pathOpt, verbose);
|
|
351
|
-
const registryName =
|
|
356
|
+
const registryName = chunkSAXVYBRM_cjs.resolveToolDescriptor(toolName.trim());
|
|
352
357
|
if (!registry.get(registryName)) {
|
|
353
358
|
process.stderr.write(`Tool not found: ${toolName}
|
|
354
359
|
`);
|
|
@@ -372,10 +377,19 @@ async function cmdRun(toolName, toolArgsJson, pathOpt, verbose = false) {
|
|
|
372
377
|
return 1;
|
|
373
378
|
}
|
|
374
379
|
}
|
|
375
|
-
async function cmdStartMcp(pathOpt, verbose = false) {
|
|
380
|
+
async function cmdStartMcp(pathOpt, verbose = false, stdio = false, port = 3e3, host = "127.0.0.1") {
|
|
376
381
|
try {
|
|
377
382
|
const { runtime } = await getRuntimeWithTools(pathOpt, verbose);
|
|
378
|
-
|
|
383
|
+
if (stdio) {
|
|
384
|
+
await chunk2E4GZA53_cjs.runMCPServerOverStdio(runtime);
|
|
385
|
+
return 0;
|
|
386
|
+
}
|
|
387
|
+
const streamable = await chunk2E4GZA53_cjs.createMCPServerStreamableHttp(runtime, { port, host, path: "/mcp" });
|
|
388
|
+
const { url, port: actualPort } = await streamable.listen(port, host);
|
|
389
|
+
process.stdout.write(`MCP Streamable HTTP: ${url}
|
|
390
|
+
`);
|
|
391
|
+
await new Promise(() => {
|
|
392
|
+
});
|
|
379
393
|
return 0;
|
|
380
394
|
} catch (err) {
|
|
381
395
|
process.stderr.write(`start mcp failed: ${err instanceof Error ? err.message : String(err)}
|
|
@@ -386,7 +400,7 @@ async function cmdStartMcp(pathOpt, verbose = false) {
|
|
|
386
400
|
async function cmdStartHttp(port, host, pathOpt, verbose = false) {
|
|
387
401
|
try {
|
|
388
402
|
const { runtime } = await getRuntimeWithTools(pathOpt, verbose);
|
|
389
|
-
const http = await
|
|
403
|
+
const http = await chunk2E4GZA53_cjs.createHttpService(runtime);
|
|
390
404
|
const { port: actualPort, host: actualHost } = await http.listen({ port, host });
|
|
391
405
|
const base = `http://${actualHost}:${actualPort}`;
|
|
392
406
|
process.stdout.write(`API: ${base}/invoke (POST), ${base}/tools (GET)
|
|
@@ -403,7 +417,7 @@ async function cmdStartHttp(port, host, pathOpt, verbose = false) {
|
|
|
403
417
|
}
|
|
404
418
|
}
|
|
405
419
|
async function main(argv = process.argv) {
|
|
406
|
-
const { command, startSub, help, verbose, pathOpt, outDir, include, includeN8n, toolName, toolArgsJson, port, host } = parseArgv(argv);
|
|
420
|
+
const { command, startSub, help, verbose, mcpStdio, pathOpt, outDir, include, includeN8n, toolName, toolArgsJson, port, host } = parseArgv(argv);
|
|
407
421
|
if (help || command === "help") {
|
|
408
422
|
printHelp();
|
|
409
423
|
return 0;
|
|
@@ -415,7 +429,7 @@ async function main(argv = process.argv) {
|
|
|
415
429
|
if (command === "describe" || command === "show") return cmdDescribe(toolName, pathOpt, verbose);
|
|
416
430
|
if (command === "run") return cmdRun(toolName, toolArgsJson, pathOpt, verbose);
|
|
417
431
|
if (command === "start") {
|
|
418
|
-
if (startSub === "mcp") return cmdStartMcp(pathOpt, verbose);
|
|
432
|
+
if (startSub === "mcp") return cmdStartMcp(pathOpt, verbose, mcpStdio, port, host);
|
|
419
433
|
if (startSub === "http") return cmdStartHttp(port, host, pathOpt, verbose);
|
|
420
434
|
process.stderr.write("Usage: agent-tool start mcp | agent-tool start http [--port 3000] [--host 127.0.0.1]\n");
|
|
421
435
|
return 1;
|