@easynet/agent-tool 1.0.102 → 1.0.104
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 +33 -35
- package/config/build/build.sh +182 -0
- package/config/build/tsconfig.dts.json +34 -0
- package/config/build/tsup.config.ts +19 -0
- package/config/build/vitest.config.ts +29 -0
- package/config/tool.yaml +1 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts +1 -0
- package/dist/api/adapters/LangChainToolsHub.d.ts.map +1 -1
- package/dist/api/extension/createExtension.d.ts +1 -1
- package/dist/api/extension/createExtension.d.ts.map +1 -1
- package/dist/api/extension/index.d.ts +3 -3
- package/dist/api/extension/index.d.ts.map +1 -1
- package/dist/api/extension/support/groupPrefix.d.ts.map +1 -0
- package/dist/api/extension/{types.d.ts → support/types.d.ts} +3 -3
- package/dist/api/extension/support/types.d.ts.map +1 -0
- package/dist/api/resolveAgentSkillRoots.d.ts +7 -0
- package/dist/api/resolveAgentSkillRoots.d.ts.map +1 -0
- package/dist/api/runtimeFromConfig.d.ts +2 -65
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/api/runtimeFromConfig.types.d.ts +37 -0
- package/dist/api/runtimeFromConfig.types.d.ts.map +1 -0
- package/dist/build.cjs +5 -5
- package/dist/build.js +2 -2
- package/dist/{chunk-34SBJLFZ.js → chunk-2MSEJB6X.js} +82 -19
- package/dist/chunk-2MSEJB6X.js.map +1 -0
- package/dist/{chunk-YBMF3C6F.cjs → chunk-2THI5UWA.cjs} +90 -21
- package/dist/chunk-2THI5UWA.cjs.map +1 -0
- package/dist/{chunk-POUTZDWB.js → chunk-2Y6T67HJ.js} +3 -3
- package/dist/chunk-2Y6T67HJ.js.map +1 -0
- package/dist/{chunk-VLV5F6HX.cjs → chunk-45MCEW2Y.cjs} +3 -3
- package/dist/chunk-45MCEW2Y.cjs.map +1 -0
- package/dist/{chunk-34SG3EMW.js → chunk-WNWMAS7C.js} +3 -3
- package/dist/{chunk-34SG3EMW.js.map → chunk-WNWMAS7C.js.map} +1 -1
- package/dist/{chunk-XUIGSBWG.cjs → chunk-YAIP4AYQ.cjs} +7 -7
- package/dist/{chunk-XUIGSBWG.cjs.map → chunk-YAIP4AYQ.cjs.map} +1 -1
- package/dist/core/runtime/PTCRuntimePipeline.d.ts.map +1 -1
- package/dist/index.cjs +120 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -11
- package/dist/index.js.map +1 -1
- package/dist/sdk.cjs +1 -1
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.js +1 -1
- package/dist/sdk.js.map +1 -1
- package/dist/tools/mcp/index.d.ts +1 -0
- package/dist/tools/mcp/index.d.ts.map +1 -1
- package/dist/tools/mcp/support/types.d.ts.map +1 -0
- package/dist/tools/util/toolConfig.d.ts +7 -0
- package/dist/tools/util/toolConfig.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +19 -19
- package/dist/utils/cli/index.js +3 -3
- package/package.json +4 -4
- package/dist/api/extension/groupPrefix.d.ts.map +0 -1
- package/dist/api/extension/types.d.ts.map +0 -1
- package/dist/chunk-34SBJLFZ.js.map +0 -1
- package/dist/chunk-POUTZDWB.js.map +0 -1
- package/dist/chunk-VLV5F6HX.cjs.map +0 -1
- package/dist/chunk-YBMF3C6F.cjs.map +0 -1
- package/dist/tools/mcp/types.d.ts.map +0 -1
- /package/dist/api/extension/{groupPrefix.d.ts → support/groupPrefix.d.ts} +0 -0
- /package/dist/tools/mcp/{types.d.ts → support/types.d.ts} +0 -0
package/dist/utils/cli/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
require('../../chunk-
|
|
4
|
+
var chunkYAIP4AYQ_cjs = require('../../chunk-YAIP4AYQ.cjs');
|
|
5
|
+
var chunk2THI5UWA_cjs = require('../../chunk-2THI5UWA.cjs');
|
|
6
|
+
require('../../chunk-45MCEW2Y.cjs');
|
|
7
7
|
require('../../chunk-AGLGFQUW.cjs');
|
|
8
8
|
require('../../chunk-JW4EMVTE.cjs');
|
|
9
9
|
var chunkUUNG3GL3_cjs = require('../../chunk-UUNG3GL3.cjs');
|
|
@@ -270,14 +270,14 @@ async function getRuntimeWithTools(pathOpt, verbose = false) {
|
|
|
270
270
|
const stepLog = verbose ? (msg) => process.stderr.write(`[agent-tool] ${msg}
|
|
271
271
|
`) : void 0;
|
|
272
272
|
if (stepLog) stepLog(`Loading tool config from ${searchDir}`);
|
|
273
|
-
const config =
|
|
273
|
+
const config = chunk2THI5UWA_cjs.findAndLoadToolConfig(searchDir);
|
|
274
274
|
let sandboxRoot = cwd;
|
|
275
275
|
if (config.sandboxedPath && typeof config.sandboxedPath === "string" && config.configPath) {
|
|
276
|
-
sandboxRoot =
|
|
276
|
+
sandboxRoot = chunk2THI5UWA_cjs.resolveSandboxedPath(config.configPath, config.sandboxedPath);
|
|
277
277
|
}
|
|
278
278
|
if (stepLog) {
|
|
279
279
|
if (config.configPath) {
|
|
280
|
-
const n =
|
|
280
|
+
const n = chunk2THI5UWA_cjs.getToolSourceDescriptors(config).length;
|
|
281
281
|
stepLog(`Config: ${config.configPath} (${n} tool(s)), sandbox: ${sandboxRoot}`);
|
|
282
282
|
} else {
|
|
283
283
|
stepLog("No tool.yaml found");
|
|
@@ -288,7 +288,7 @@ async function getRuntimeWithTools(pathOpt, verbose = false) {
|
|
|
288
288
|
enableSandboxValidation: config.enableSandboxValidation ?? DEFAULT_CORE_CONFIG.enableSandboxValidation,
|
|
289
289
|
allowedHosts: []
|
|
290
290
|
};
|
|
291
|
-
const result = await
|
|
291
|
+
const result = await chunk2THI5UWA_cjs.createRuntimeFromConfig({
|
|
292
292
|
coreTools: coreConfig,
|
|
293
293
|
configFilePath: config.configPath,
|
|
294
294
|
stepLog
|
|
@@ -399,7 +399,7 @@ Next: cd ${path2__namespace.default.basename(targetPath)} && npm install && npm
|
|
|
399
399
|
}
|
|
400
400
|
async function cmdInit(pathOpt) {
|
|
401
401
|
try {
|
|
402
|
-
const { targetPath, filesCreated } = await
|
|
402
|
+
const { targetPath, filesCreated } = await chunkYAIP4AYQ_cjs.initProject({ targetPath: pathOpt || void 0 });
|
|
403
403
|
process.stdout.write(`Initialized project at ${targetPath}
|
|
404
404
|
Created: ${filesCreated.join(", ")}
|
|
405
405
|
Next: npm install && npm run build
|
|
@@ -413,7 +413,7 @@ Next: npm install && npm run build
|
|
|
413
413
|
}
|
|
414
414
|
async function cmdBuild(pathOpt, outDir, include, includeN8n) {
|
|
415
415
|
try {
|
|
416
|
-
const result = await
|
|
416
|
+
const result = await chunkYAIP4AYQ_cjs.buildMCPPackage({
|
|
417
417
|
projectPath: pathOpt || void 0,
|
|
418
418
|
outDir: outDir || void 0,
|
|
419
419
|
include: include.length > 0 ? include : void 0,
|
|
@@ -434,7 +434,7 @@ mcp.json: ${result.mcpJsonPath}
|
|
|
434
434
|
}
|
|
435
435
|
async function cmdServe(pathOpt) {
|
|
436
436
|
try {
|
|
437
|
-
const { process: child } = await
|
|
437
|
+
const { process: child } = await chunkYAIP4AYQ_cjs.runMCPServer({ path: pathOpt || void 0 });
|
|
438
438
|
child.stdin?.pipe(process.stdin);
|
|
439
439
|
child.stdout?.pipe(process.stdout);
|
|
440
440
|
process.stdin?.unref();
|
|
@@ -452,7 +452,7 @@ var LS_DESC_MAX = 72;
|
|
|
452
452
|
function formatLsOutput(specs) {
|
|
453
453
|
const rows = specs.map((spec) => {
|
|
454
454
|
const { name } = parseToolName(spec.name);
|
|
455
|
-
const scope =
|
|
455
|
+
const scope = chunk2THI5UWA_cjs.getDisplayScope(spec.name, spec.kind, spec.version);
|
|
456
456
|
const desc = (spec.description ?? "").replace(/\n/g, " ").trim().slice(0, LS_DESC_MAX);
|
|
457
457
|
return { scope, name, description: desc || "(no description)" };
|
|
458
458
|
});
|
|
@@ -479,7 +479,7 @@ function formatLsOutput(specs) {
|
|
|
479
479
|
}
|
|
480
480
|
function formatDescribeOutput(spec) {
|
|
481
481
|
const { name: localName } = parseToolName(spec.name);
|
|
482
|
-
const scope =
|
|
482
|
+
const scope = chunk2THI5UWA_cjs.getDisplayScope(spec.name, spec.kind, spec.version);
|
|
483
483
|
const sections = [];
|
|
484
484
|
sections.push("\u250C\u2500 Tool");
|
|
485
485
|
sections.push(`\u2502 name: ${spec.name}`);
|
|
@@ -515,8 +515,8 @@ async function cmdLs(pathOpt, verbose = false) {
|
|
|
515
515
|
process.stdout.write("No tools registered.\n");
|
|
516
516
|
const cwd = process.cwd();
|
|
517
517
|
const searchDir = path2__namespace.default.resolve(cwd, pathOpt ?? ".");
|
|
518
|
-
const config =
|
|
519
|
-
const hasNpmTools =
|
|
518
|
+
const config = chunk2THI5UWA_cjs.findAndLoadToolConfig(searchDir);
|
|
519
|
+
const hasNpmTools = chunk2THI5UWA_cjs.getToolSourceDescriptors(config).some((t) => typeof t === "string" && t.startsWith("npm:"));
|
|
520
520
|
if (hasNpmTools) {
|
|
521
521
|
process.stdout.write(
|
|
522
522
|
"Tip: Install builtin tools in this directory so 'agent-tool ls' finds them: npm init -y && npm install @easynet/agent-tool-buildin\n"
|
|
@@ -540,7 +540,7 @@ async function cmdDescribe(toolName, pathOpt, verbose = false) {
|
|
|
540
540
|
}
|
|
541
541
|
try {
|
|
542
542
|
const { registry } = await getRuntimeWithTools(pathOpt, verbose);
|
|
543
|
-
const registryName =
|
|
543
|
+
const registryName = chunk2THI5UWA_cjs.resolveToolDescriptor(toolName.trim());
|
|
544
544
|
const spec = registry.get(registryName);
|
|
545
545
|
if (!spec) {
|
|
546
546
|
process.stderr.write(`Tool not found: ${toolName}
|
|
@@ -589,7 +589,7 @@ async function cmdRun(toolName, toolArgsJson, pathOpt, verbose = false) {
|
|
|
589
589
|
}
|
|
590
590
|
try {
|
|
591
591
|
const { runtime, registry } = await getRuntimeWithTools(pathOpt, verbose);
|
|
592
|
-
const registryName =
|
|
592
|
+
const registryName = chunk2THI5UWA_cjs.resolveToolDescriptor(toolName.trim());
|
|
593
593
|
if (!registry.get(registryName)) {
|
|
594
594
|
process.stderr.write(`Tool not found: ${toolName}
|
|
595
595
|
`);
|
|
@@ -617,10 +617,10 @@ async function cmdStartMcp(pathOpt, verbose = false, stdio = false, port = 3e3,
|
|
|
617
617
|
try {
|
|
618
618
|
const { runtime } = await getRuntimeWithTools(pathOpt, verbose);
|
|
619
619
|
if (stdio) {
|
|
620
|
-
await
|
|
620
|
+
await chunk2THI5UWA_cjs.runMCPServerOverStdio(runtime);
|
|
621
621
|
return 0;
|
|
622
622
|
}
|
|
623
|
-
const streamable = await
|
|
623
|
+
const streamable = await chunk2THI5UWA_cjs.createMCPServerStreamableHttp(runtime, { port, host, path: "/mcp" });
|
|
624
624
|
const { url } = await streamable.listen(port, host);
|
|
625
625
|
process.stdout.write(`MCP Streamable HTTP: ${url}
|
|
626
626
|
`);
|
|
@@ -636,7 +636,7 @@ async function cmdStartMcp(pathOpt, verbose = false, stdio = false, port = 3e3,
|
|
|
636
636
|
async function cmdStartHttp(port, host, pathOpt, verbose = false) {
|
|
637
637
|
try {
|
|
638
638
|
const { runtime } = await getRuntimeWithTools(pathOpt, verbose);
|
|
639
|
-
const http = await
|
|
639
|
+
const http = await chunk2THI5UWA_cjs.createHttpService(runtime);
|
|
640
640
|
const { port: actualPort, host: actualHost } = await http.listen({ port, host });
|
|
641
641
|
const base = `http://${actualHost}:${actualPort}`;
|
|
642
642
|
process.stdout.write(`API: ${base}/invoke (POST), ${base}/tools (GET)
|
package/dist/utils/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { initProject, buildMCPPackage, runMCPServer } from '../../chunk-
|
|
3
|
-
import { findAndLoadToolConfig, getToolSourceDescriptors, resolveToolDescriptor, runMCPServerOverStdio, createMCPServerStreamableHttp, createHttpService, resolveSandboxedPath, createRuntimeFromConfig, getDisplayScope } from '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
2
|
+
import { initProject, buildMCPPackage, runMCPServer } from '../../chunk-WNWMAS7C.js';
|
|
3
|
+
import { findAndLoadToolConfig, getToolSourceDescriptors, resolveToolDescriptor, runMCPServerOverStdio, createMCPServerStreamableHttp, createHttpService, resolveSandboxedPath, createRuntimeFromConfig, getDisplayScope } from '../../chunk-2MSEJB6X.js';
|
|
4
|
+
import '../../chunk-2Y6T67HJ.js';
|
|
5
5
|
import '../../chunk-IVL4TBFB.js';
|
|
6
6
|
import '../../chunk-BDUSB6GT.js';
|
|
7
7
|
import { enrichSpecWithCanonicalSchema } from '../../chunk-NTWOVFEY.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@easynet/agent-tool",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.104",
|
|
4
4
|
"description": "MCP build: init → build → run. Turn your project (@tool, SKILL, n8n) into a standalone MCP npm server (no framework embedding, no package conflict).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"scripts": {
|
|
35
35
|
"preinstall": "node -e \"const fs=require('fs'); const {execSync}=require('child_process'); if (fs.existsSync('scripts/resolve-deps.js')) { execSync('node scripts/resolve-deps.js', { stdio: 'inherit' }); } else { console.log('Skipping resolve-deps for published package'); }\"",
|
|
36
|
-
"build": "npm run clean && npx tsup && npx tsc -p tsconfig.dts.json && (mkdir -p dist/templates && cp src/api/expose/mcp-build/templates/*.js dist/templates/ 2>/dev/null || true)",
|
|
36
|
+
"build": "npm run clean && npx tsup --config config/build/tsup.config.ts && npx tsc -p config/build/tsconfig.dts.json && (mkdir -p dist/templates && cp src/api/expose/mcp-build/templates/*.js dist/templates/ 2>/dev/null || true)",
|
|
37
37
|
"build:ext": "node scripts/build-ext.mjs",
|
|
38
38
|
"dev": "npx tsup --watch",
|
|
39
|
-
"test": "npm run build && vitest run",
|
|
40
|
-
"test:watch": "vitest",
|
|
39
|
+
"test": "npm run build && vitest run --config config/build/vitest.config.ts",
|
|
40
|
+
"test:watch": "vitest --config config/build/vitest.config.ts",
|
|
41
41
|
"typecheck": "tsc --noEmit",
|
|
42
42
|
"example:start": "npm run -s build && tsx example/basic-usage.ts",
|
|
43
43
|
"clean": "rm -rf dist",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"groupPrefix.d.ts","sourceRoot":"","sources":["../../../src/api/extension/groupPrefix.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,oEAAoE;IACpE,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,mFAAmF;IACnF,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,kBAAkB,GAAG,wBAAwB,CAW1F"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/api/extension/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,YAAY,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAErE,sFAAsF;AACtF,MAAM,WAAW,oBAAoB,CAAC,OAAO,GAAG,OAAO;IACrD,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,iFAAiF;AACjF,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC"}
|