@easynet/agent-tool 1.0.19 → 1.0.20
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 +15 -15
- package/dist/api/main.js +4 -4
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/canonicalCoreSchemas-JPTOIQKR.js +4 -0
- package/dist/{canonicalCoreSchemas-DNBAHSUC.js.map → canonicalCoreSchemas-JPTOIQKR.js.map} +1 -1
- package/dist/canonicalCoreSchemas-K57HKGZJ.cjs +21 -0
- package/dist/{canonicalCoreSchemas-IBTSIPJV.cjs.map → canonicalCoreSchemas-K57HKGZJ.cjs.map} +1 -1
- package/dist/{chunk-EAI37B5W.cjs → chunk-6JWQVVL2.cjs} +4 -3
- package/dist/chunk-6JWQVVL2.cjs.map +1 -0
- package/dist/{chunk-NNOTTUB2.cjs → chunk-6WQYJLVU.cjs} +132 -29
- package/dist/chunk-6WQYJLVU.cjs.map +1 -0
- package/dist/{chunk-TTYAOTOR.js → chunk-IGMDLCV7.js} +132 -30
- package/dist/chunk-IGMDLCV7.js.map +1 -0
- package/dist/{chunk-H2UMNHDE.cjs → chunk-INYWD3OJ.cjs} +10 -10
- package/dist/{chunk-H2UMNHDE.cjs.map → chunk-INYWD3OJ.cjs.map} +1 -1
- package/dist/{chunk-Y33OLGAJ.js → chunk-NNMMUG2X.js} +3 -3
- package/dist/{chunk-Y33OLGAJ.js.map → chunk-NNMMUG2X.js.map} +1 -1
- package/dist/{chunk-QB5ALDM3.js → chunk-OHDIMQ22.js} +3 -3
- package/dist/{chunk-QB5ALDM3.js.map → chunk-OHDIMQ22.js.map} +1 -1
- package/dist/{chunk-46XYOB3H.js → chunk-P5UPHQ7N.js} +4 -3
- package/dist/chunk-P5UPHQ7N.js.map +1 -0
- package/dist/{chunk-TPWEGGKQ.cjs → chunk-QP6JJF76.cjs} +9 -9
- package/dist/{chunk-TPWEGGKQ.cjs.map → chunk-QP6JJF76.cjs.map} +1 -1
- package/dist/{chunk-HISF2FEL.cjs → chunk-TAW4FP3A.cjs} +18 -18
- package/dist/{chunk-HISF2FEL.cjs.map → chunk-TAW4FP3A.cjs.map} +1 -1
- package/dist/{chunk-GGKQQR54.js → chunk-WKWSXCS4.js} +5 -5
- package/dist/{chunk-GGKQQR54.js.map → chunk-WKWSXCS4.js.map} +1 -1
- package/dist/index.cjs +52 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/tools/util/canonicalCoreSchemas.d.ts.map +1 -1
- package/dist/tools/util/index.d.ts +1 -1
- package/dist/tools/util/index.d.ts.map +1 -1
- package/dist/tools/util/toolDescriptor.d.ts +9 -0
- package/dist/tools/util/toolDescriptor.d.ts.map +1 -1
- package/dist/utils/cli/index.cjs +19 -19
- package/dist/utils/cli/index.js +4 -4
- package/package.json +1 -1
- package/dist/canonicalCoreSchemas-DNBAHSUC.js +0 -4
- package/dist/canonicalCoreSchemas-IBTSIPJV.cjs +0 -21
- package/dist/chunk-46XYOB3H.js.map +0 -1
- package/dist/chunk-EAI37B5W.cjs.map +0 -1
- package/dist/chunk-NNOTTUB2.cjs.map +0 -1
- package/dist/chunk-TTYAOTOR.js.map +0 -1
package/dist/api/main.cjs
CHANGED
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
3
|
+
var chunkTAW4FP3A_cjs = require('../chunk-TAW4FP3A.cjs');
|
|
4
|
+
var chunkINYWD3OJ_cjs = require('../chunk-INYWD3OJ.cjs');
|
|
5
|
+
var chunk6WQYJLVU_cjs = require('../chunk-6WQYJLVU.cjs');
|
|
6
6
|
require('../chunk-ONIBCU2Y.cjs');
|
|
7
|
-
require('../chunk-
|
|
7
|
+
require('../chunk-6JWQVVL2.cjs');
|
|
8
8
|
require('../chunk-FGGTT32N.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
Object.defineProperty(exports, "createAgentTools", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkTAW4FP3A_cjs.createAgentTools; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "createLangChainToolsAsync", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkTAW4FP3A_cjs.createLangChainToolsAsync; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "createHttpService", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkINYWD3OJ_cjs.createHttpService; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "createMCPServer", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkINYWD3OJ_cjs.createMCPServer; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "createMCPServerStreamableHttp", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkINYWD3OJ_cjs.createMCPServerStreamableHttp; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "createMCPStreamableHttpHandler", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkINYWD3OJ_cjs.createMCPStreamableHttpHandler; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "createOpenAPIServer", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkINYWD3OJ_cjs.createHttpService; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "runMCPServerOverStdio", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkINYWD3OJ_cjs.runMCPServerOverStdio; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "PTCRuntime", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunk6WQYJLVU_cjs.PTCRuntime; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "createRuntimeFromConfig", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunk6WQYJLVU_cjs.createRuntimeFromConfig; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "createRuntimeFromConfigSync", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunk6WQYJLVU_cjs.createRuntimeFromConfigSync; }
|
|
55
55
|
});
|
|
56
56
|
//# sourceMappingURL=main.cjs.map
|
|
57
57
|
//# sourceMappingURL=main.cjs.map
|
package/dist/api/main.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { createAgentTools, createLangChainToolsAsync } from '../chunk-
|
|
2
|
-
export { createHttpService, createMCPServer, createMCPServerStreamableHttp, createMCPStreamableHttpHandler, createHttpService as createOpenAPIServer, runMCPServerOverStdio } from '../chunk-
|
|
3
|
-
export { PTCRuntime, createRuntimeFromConfig, createRuntimeFromConfigSync } from '../chunk-
|
|
1
|
+
export { createAgentTools, createLangChainToolsAsync } from '../chunk-NNMMUG2X.js';
|
|
2
|
+
export { createHttpService, createMCPServer, createMCPServerStreamableHttp, createMCPStreamableHttpHandler, createHttpService as createOpenAPIServer, runMCPServerOverStdio } from '../chunk-WKWSXCS4.js';
|
|
3
|
+
export { PTCRuntime, createRuntimeFromConfig, createRuntimeFromConfigSync } from '../chunk-IGMDLCV7.js';
|
|
4
4
|
import '../chunk-IU35EFPK.js';
|
|
5
|
-
import '../chunk-
|
|
5
|
+
import '../chunk-P5UPHQ7N.js';
|
|
6
6
|
import '../chunk-GWBJEGS7.js';
|
|
7
7
|
//# sourceMappingURL=main.js.map
|
|
8
8
|
//# sourceMappingURL=main.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeFromConfig.d.ts","sourceRoot":"","sources":["../../src/api/runtimeFromConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"runtimeFromConfig.d.ts","sourceRoot":"","sources":["../../src/api/runtimeFromConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAgB3D,oFAAoF;AACpF,eAAO,MAAM,iBAAiB,UAI7B,CAAC;AAEF,+FAA+F;AAC/F,MAAM,WAAW,mBAAmB;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,gEAAgE;IAChE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,gFAAgF;IAChF,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,oEAAoE;IACpE,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,yEAAyE;IACzE,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,YAAY,CAAC;CACxB;AA4ED,qKAAqK;AACrK,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAQjG;AAsFD;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,oBAAyB,GAAG,mBAAmB,CA6DnG;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAiB9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"canonicalCoreSchemas-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"canonicalCoreSchemas-JPTOIQKR.js"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk6JWQVVL2_cjs = require('./chunk-6JWQVVL2.cjs');
|
|
4
|
+
require('./chunk-FGGTT32N.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Object.defineProperty(exports, "CORE_TOOL_SCHEMAS", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return chunk6JWQVVL2_cjs.CORE_TOOL_SCHEMAS; }
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "enrichSpecWithCanonicalSchema", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return chunk6JWQVVL2_cjs.enrichSpecWithCanonicalSchema; }
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "isGenericSchema", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () { return chunk6JWQVVL2_cjs.isGenericSchema; }
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=canonicalCoreSchemas-K57HKGZJ.cjs.map
|
|
21
|
+
//# sourceMappingURL=canonicalCoreSchemas-K57HKGZJ.cjs.map
|
package/dist/{canonicalCoreSchemas-IBTSIPJV.cjs.map → canonicalCoreSchemas-K57HKGZJ.cjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"canonicalCoreSchemas-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"canonicalCoreSchemas-K57HKGZJ.cjs"}
|
|
@@ -226,7 +226,8 @@ function isGenericSchema(schema) {
|
|
|
226
226
|
}
|
|
227
227
|
function enrichSpecWithCanonicalSchema(spec) {
|
|
228
228
|
if (spec.kind !== "core") return spec;
|
|
229
|
-
const
|
|
229
|
+
const coreSuffix = spec.name.includes(".core.") ? spec.name.slice(spec.name.indexOf(".core.") + 1) : spec.name;
|
|
230
|
+
const key = chunkFGGTT32N_cjs.normalizeToolName(coreSuffix);
|
|
230
231
|
const canonical = CORE_TOOL_SCHEMAS[key];
|
|
231
232
|
if (!canonical) return spec;
|
|
232
233
|
const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;
|
|
@@ -242,5 +243,5 @@ function enrichSpecWithCanonicalSchema(spec) {
|
|
|
242
243
|
exports.CORE_TOOL_SCHEMAS = CORE_TOOL_SCHEMAS;
|
|
243
244
|
exports.enrichSpecWithCanonicalSchema = enrichSpecWithCanonicalSchema;
|
|
244
245
|
exports.isGenericSchema = isGenericSchema;
|
|
245
|
-
//# sourceMappingURL=chunk-
|
|
246
|
-
//# sourceMappingURL=chunk-
|
|
246
|
+
//# sourceMappingURL=chunk-6JWQVVL2.cjs.map
|
|
247
|
+
//# sourceMappingURL=chunk-6JWQVVL2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/tools/util/canonicalCoreSchemas.ts"],"names":["normalizeToolName"],"mappings":";;;;;AASA,IAAM,CAAA,GAAI,CAAC,CAAA,KAAc,CAAA;AAGlB,IAAM,iBAAA,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AAa,IAAA,CAAK,IAAA,CAAK,QAAA,CAAS,QAAQ,IAAI,IAAA,CAAK,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,KAAK,OAAA,CAAQ,QAAQ,CAAA,GAAI,CAAC,IAAI,IAAA,CAAK,IAAA;AAC1G,EAAA,MAAM,GAAA,GAAMA,oCAAkB,UAAU,CAAA;AACxC,EAAA,MAAM,SAAA,GAAY,kBAAkB,GAAG,CAAA;AACvC,EAAA,IAAI,CAAC,WAAW,OAAO,IAAA;AACvB,EAAA,MAAM,WAAW,eAAA,CAAgB,IAAA,CAAK,WAAW,CAAA,GAAI,SAAA,CAAU,cAAc,IAAA,CAAK,WAAA;AAClF,EAAA,MAAM,SAAA,GACJ,UAAU,YAAA,IAAgB,eAAA,CAAgB,KAAK,YAAY,CAAA,GACvD,SAAA,CAAU,YAAA,GACV,IAAA,CAAK,YAAA;AACX,EAAA,IAAI,aAAa,IAAA,CAAK,WAAA,IAAe,SAAA,KAAc,IAAA,CAAK,cAAc,OAAO,IAAA;AAC7E,EAAA,OAAO;AAAA,IACL,GAAG,IAAA;AAAA,IACH,WAAA,EAAa,QAAA;AAAA,IACb,YAAA,EAAc;AAAA,GAChB;AACF","file":"chunk-6JWQVVL2.cjs","sourcesContent":["/**\n * Canonical input/output schemas for core (builtin) tools.\n * Used when the builtin package registers specs with generic schema\n * (type: object, additionalProperties: true) so CLI describe and OpenAPI show real schemas.\n */\n\nimport type { ToolSpec } from \"../../core/types/ToolSpec.js\";\nimport { normalizeToolName } from \"../../core/types/ToolSpec.js\";\n\nconst S = (o: object) => o as Record<string, unknown>;\n\n/** Canonical inputSchema (and optional outputSchema) by tool name (e.g. core/fs.readText). */\nexport const CORE_TOOL_SCHEMAS: Record<\n string,\n { inputSchema: object; outputSchema?: object }\n> = {\n \"core/fs.readText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to the file (within sandbox)\" },\n maxBytes: { type: \"number\", description: \"Max bytes to read (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n outputSchema: S({\n type: \"object\",\n properties: {\n result: {\n type: \"object\",\n properties: {\n path: { type: \"string\" },\n text: { type: \"string\" },\n bytes: { type: \"number\" },\n },\n },\n },\n }),\n },\n \"core.fs.writeText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to write (within sandbox)\" },\n content: { type: \"string\", description: \"UTF-8 content to write\" },\n },\n required: [\"path\", \"content\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.listDir\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Directory path (within sandbox)\" },\n maxEntries: { type: \"number\", description: \"Max entries to return (optional)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.searchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file or directory\" },\n pattern: { type: \"string\", description: \"Search pattern (regex or literal)\" },\n maxMatches: { type: \"number\", description: \"Max matches (optional)\" },\n },\n required: [\"path\", \"pattern\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.sha256\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to file (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.fs.deletePath\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n path: { type: \"string\", description: \"Path to delete (within sandbox)\" },\n },\n required: [\"path\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchText\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" }, description: \"Optional request headers\" },\n timeoutMs: { type: \"number\", description: \"Request timeout in ms (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchJson\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to fetch\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.downloadFile\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL to download\" },\n destPath: { type: \"string\", description: \"Destination path (within sandbox)\" },\n headers: { type: \"object\", additionalProperties: { type: \"string\" } },\n },\n required: [\"url\", \"destPath\"],\n additionalProperties: false,\n }),\n },\n \"core.http.head\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"URL for HEAD request\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.http.duckduckgoSearch\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n query: { type: \"string\", description: \"Search query\" },\n maxResults: { type: \"number\", description: \"Max results (optional)\" },\n },\n required: [\"query\"],\n additionalProperties: false,\n }),\n },\n \"core.http.fetchPageMainContent\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n url: { type: \"string\", description: \"Page URL\" },\n maxLength: { type: \"number\", description: \"Max content length (optional)\" },\n },\n required: [\"url\"],\n additionalProperties: false,\n }),\n },\n \"core.util.json.select\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n json: { description: \"JSON value (object or string)\" },\n selector: { type: \"string\", description: \"JSONPath or selector\" },\n },\n required: [\"json\", \"selector\"],\n additionalProperties: false,\n }),\n },\n \"core.util.text.truncate\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to truncate\" },\n maxLength: { type: \"number\", description: \"Max length\" },\n },\n required: [\"text\", \"maxLength\"],\n additionalProperties: false,\n }),\n },\n \"core.util.hash.sha256Text\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n text: { type: \"string\", description: \"Text to hash\" },\n },\n required: [\"text\"],\n additionalProperties: false,\n }),\n },\n \"core.util.time.now\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n timezone: { type: \"string\", description: \"IANA timezone (optional)\" },\n },\n additionalProperties: false,\n }),\n },\n \"core.util.template.render\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n template: { type: \"string\", description: \"Template string (e.g. Mustache)\" },\n data: { type: \"object\", description: \"Data object for template\" },\n },\n required: [\"template\", \"data\"],\n additionalProperties: false,\n }),\n },\n \"core.exec.runCommand\": {\n inputSchema: S({\n type: \"object\",\n properties: {\n command: { type: \"string\", description: \"Command to run\" },\n args: { type: \"array\", items: { type: \"string\" }, description: \"Arguments (optional)\" },\n cwd: { type: \"string\", description: \"Working directory (optional)\" },\n timeoutMs: { type: \"number\", description: \"Timeout in ms (optional)\" },\n },\n required: [\"command\"],\n additionalProperties: false,\n }),\n },\n};\n\n/** True if schema looks like the generic permissive one. */\nexport function isGenericSchema(schema: unknown): boolean {\n if (schema === null || typeof schema !== \"object\") return false;\n const s = schema as Record<string, unknown>;\n if (s.type !== \"object\") return false;\n if (s.additionalProperties === true && !s.properties) return true;\n if (s.properties === undefined && s.required === undefined) return true;\n return false;\n}\n\n/**\n * If spec is a core tool with generic input/output schema, return spec with canonical schema.\n * Otherwise return spec unchanged.\n */\nexport function enrichSpecWithCanonicalSchema(spec: ToolSpec): ToolSpec {\n if (spec.kind !== \"core\") return spec;\n // Support prefixed names (e.g. npm.easynet.agent.tool.buildin.latest.core.fs.readText) by matching core.* suffix\n const coreSuffix = spec.name.includes(\".core.\") ? spec.name.slice(spec.name.indexOf(\".core.\") + 1) : spec.name;\n const key = normalizeToolName(coreSuffix);\n const canonical = CORE_TOOL_SCHEMAS[key];\n if (!canonical) return spec;\n const useInput = isGenericSchema(spec.inputSchema) ? canonical.inputSchema : spec.inputSchema;\n const useOutput =\n canonical.outputSchema && isGenericSchema(spec.outputSchema)\n ? canonical.outputSchema\n : spec.outputSchema;\n if (useInput === spec.inputSchema && useOutput === spec.outputSchema) return spec;\n return {\n ...spec,\n inputSchema: useInput,\n outputSchema: useOutput,\n };\n}\n"]}
|
|
@@ -1510,6 +1510,26 @@ function parseToolPath(descriptor) {
|
|
|
1510
1510
|
toolName: m[5] ?? ""
|
|
1511
1511
|
};
|
|
1512
1512
|
}
|
|
1513
|
+
function npmDescriptorToRegistryPrefix(descriptor, resolvedVersion) {
|
|
1514
|
+
const s = descriptor.trim();
|
|
1515
|
+
if (typeof s !== "string" || !s.startsWith("npm:")) return "";
|
|
1516
|
+
const rest = s.slice(4).trim();
|
|
1517
|
+
const hashIdx = rest.indexOf("#");
|
|
1518
|
+
const beforeHash = hashIdx < 0 ? rest : rest.slice(0, hashIdx);
|
|
1519
|
+
const lastAt = beforeHash.lastIndexOf("@");
|
|
1520
|
+
const scopeAndPackage = lastAt <= 0 ? beforeHash : beforeHash.slice(0, lastAt);
|
|
1521
|
+
let version = lastAt <= 0 ? "latest" : beforeHash.slice(lastAt + 1).trim() || "latest";
|
|
1522
|
+
if ((version === "latest" || !version) && resolvedVersion != null && resolvedVersion !== "") {
|
|
1523
|
+
version = resolvedVersion;
|
|
1524
|
+
}
|
|
1525
|
+
const slashIdx = scopeAndPackage.indexOf("/");
|
|
1526
|
+
const scope = slashIdx < 0 ? scopeAndPackage : scopeAndPackage.slice(0, slashIdx).replace(/^@/, "");
|
|
1527
|
+
const pkg = slashIdx < 0 ? "" : scopeAndPackage.slice(slashIdx + 1);
|
|
1528
|
+
const segment = [scope, pkg, version].filter(Boolean).join(".");
|
|
1529
|
+
const normalized = chunkFGGTT32N_cjs.normalizeToolName(segment);
|
|
1530
|
+
if (!normalized) return "";
|
|
1531
|
+
return "npm." + normalized + ".";
|
|
1532
|
+
}
|
|
1513
1533
|
function isNpmToolDescriptor(descriptor) {
|
|
1514
1534
|
return isToolPath(descriptor) && parseToolPath(descriptor)?.protocol === "npm";
|
|
1515
1535
|
}
|
|
@@ -1532,15 +1552,31 @@ function expandToolDescriptorsToRegistryNames(descriptors, registryNames) {
|
|
|
1532
1552
|
const out = [];
|
|
1533
1553
|
const seen = /* @__PURE__ */ new Set();
|
|
1534
1554
|
function add(name) {
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1555
|
+
const key = chunkFGGTT32N_cjs.normalizeToolName(name);
|
|
1556
|
+
if (registryNames.includes(key) && !seen.has(key)) {
|
|
1557
|
+
seen.add(key);
|
|
1558
|
+
out.push(key);
|
|
1559
|
+
return;
|
|
1560
|
+
}
|
|
1561
|
+
const matched = registryNames.filter((r) => r === key || r.endsWith("." + key));
|
|
1562
|
+
for (const m of matched) {
|
|
1563
|
+
if (!seen.has(m)) {
|
|
1564
|
+
seen.add(m);
|
|
1565
|
+
out.push(m);
|
|
1566
|
+
}
|
|
1538
1567
|
}
|
|
1539
1568
|
}
|
|
1540
1569
|
for (const d of descriptors) {
|
|
1541
1570
|
const s = d.trim();
|
|
1542
1571
|
if (!s) continue;
|
|
1543
|
-
|
|
1572
|
+
if (isToolPath(s)) {
|
|
1573
|
+
if (registryNames.includes(s) && !seen.has(s)) {
|
|
1574
|
+
seen.add(s);
|
|
1575
|
+
out.push(s);
|
|
1576
|
+
}
|
|
1577
|
+
continue;
|
|
1578
|
+
}
|
|
1579
|
+
const name = chunkFGGTT32N_cjs.normalizeToolName(s);
|
|
1544
1580
|
add(name);
|
|
1545
1581
|
}
|
|
1546
1582
|
return out;
|
|
@@ -1695,7 +1731,7 @@ async function importFromCache(packageRoot) {
|
|
|
1695
1731
|
fileUrl
|
|
1696
1732
|
);
|
|
1697
1733
|
}
|
|
1698
|
-
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-
|
|
1734
|
+
var requireFromPackage = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('chunk-6WQYJLVU.cjs', document.baseURI).href)));
|
|
1699
1735
|
function getProjectRequire() {
|
|
1700
1736
|
const cwd = process.cwd();
|
|
1701
1737
|
if (fs.existsSync(path.join(cwd, "package.json"))) return module$1.createRequire(path.join(cwd, "package.json"));
|
|
@@ -1707,6 +1743,22 @@ var BUILTIN_PKG_NAMES = [
|
|
|
1707
1743
|
"@easynet/agent-tool-builtin",
|
|
1708
1744
|
"@easynet/agent-tool-buildin"
|
|
1709
1745
|
];
|
|
1746
|
+
function getInstalledPackageVersion(packageName) {
|
|
1747
|
+
const projectRequire = getProjectRequire();
|
|
1748
|
+
const requirers = [requireFromPackage];
|
|
1749
|
+
if (projectRequire) requirers.push(projectRequire);
|
|
1750
|
+
for (const req of requirers) {
|
|
1751
|
+
try {
|
|
1752
|
+
const pkgJsonPath = req.resolve(`${packageName}/package.json`);
|
|
1753
|
+
const json = fs.readFileSync(pkgJsonPath, "utf-8");
|
|
1754
|
+
const pkg = JSON.parse(json);
|
|
1755
|
+
return pkg.version ?? null;
|
|
1756
|
+
} catch {
|
|
1757
|
+
continue;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
return null;
|
|
1761
|
+
}
|
|
1710
1762
|
function loadBuiltinTools() {
|
|
1711
1763
|
const projectRequire = getProjectRequire();
|
|
1712
1764
|
const requirers = [requireFromPackage];
|
|
@@ -1715,7 +1767,7 @@ function loadBuiltinTools() {
|
|
|
1715
1767
|
for (const pkg of BUILTIN_PKG_NAMES) {
|
|
1716
1768
|
try {
|
|
1717
1769
|
const mod = req(pkg);
|
|
1718
|
-
if (mod && typeof mod.registerCoreTools === "function") return mod;
|
|
1770
|
+
if (mod && typeof mod.registerCoreTools === "function") return { registerCoreTools: mod.registerCoreTools, packageName: pkg };
|
|
1719
1771
|
} catch {
|
|
1720
1772
|
continue;
|
|
1721
1773
|
}
|
|
@@ -1723,6 +1775,40 @@ function loadBuiltinTools() {
|
|
|
1723
1775
|
}
|
|
1724
1776
|
return null;
|
|
1725
1777
|
}
|
|
1778
|
+
function createPrefixingRegistry(registry, prefix) {
|
|
1779
|
+
return {
|
|
1780
|
+
register(spec) {
|
|
1781
|
+
registry.register({ ...spec, name: prefix + chunkFGGTT32N_cjs.normalizeToolName(spec.name) });
|
|
1782
|
+
},
|
|
1783
|
+
bulkRegister(specs) {
|
|
1784
|
+
specs.forEach((s) => this.register(s));
|
|
1785
|
+
},
|
|
1786
|
+
unregister(name) {
|
|
1787
|
+
return registry.unregister(name);
|
|
1788
|
+
},
|
|
1789
|
+
get(name) {
|
|
1790
|
+
return registry.get(name);
|
|
1791
|
+
},
|
|
1792
|
+
has(name) {
|
|
1793
|
+
return registry.has(name);
|
|
1794
|
+
},
|
|
1795
|
+
search(query) {
|
|
1796
|
+
return registry.search(query);
|
|
1797
|
+
},
|
|
1798
|
+
list() {
|
|
1799
|
+
return registry.list();
|
|
1800
|
+
},
|
|
1801
|
+
get size() {
|
|
1802
|
+
return registry.size;
|
|
1803
|
+
},
|
|
1804
|
+
snapshot() {
|
|
1805
|
+
return registry.snapshot();
|
|
1806
|
+
},
|
|
1807
|
+
clear() {
|
|
1808
|
+
return registry.clear();
|
|
1809
|
+
}
|
|
1810
|
+
};
|
|
1811
|
+
}
|
|
1726
1812
|
function parseNpmDescriptor(entry) {
|
|
1727
1813
|
if (typeof entry !== "string" || !entry.startsWith("npm:")) return null;
|
|
1728
1814
|
const rest = entry.slice(4).trim();
|
|
@@ -1742,7 +1828,8 @@ function loadBuiltinFromToolYamlCache(configFilePath, stepLog) {
|
|
|
1742
1828
|
const cacheOpts = cacheBase ? { cacheBase } : {};
|
|
1743
1829
|
if (stepLog) stepLog(`Loading builtin from tool.yaml cache (cacheBase: ${cacheBase ?? "~/.agent/cache"})`);
|
|
1744
1830
|
for (const entry of tools) {
|
|
1745
|
-
const
|
|
1831
|
+
const entryStr = String(entry).trim();
|
|
1832
|
+
const parsed = parseNpmDescriptor(entryStr);
|
|
1746
1833
|
if (!parsed || !BUILTIN_PKG_NAMES.includes(parsed.packageName)) continue;
|
|
1747
1834
|
for (const opts of [cacheOpts, {}]) {
|
|
1748
1835
|
try {
|
|
@@ -1752,7 +1839,10 @@ function loadBuiltinFromToolYamlCache(configFilePath, stepLog) {
|
|
|
1752
1839
|
const entryPath = getPackageEntryPath(cacheDir);
|
|
1753
1840
|
const req = module$1.createRequire(path.join(cacheDir, "package.json"));
|
|
1754
1841
|
const mod = req(entryPath);
|
|
1755
|
-
if (mod && typeof mod.registerCoreTools === "function")
|
|
1842
|
+
if (mod && typeof mod.registerCoreTools === "function") {
|
|
1843
|
+
const resolvedVersion = path.basename(cacheDir);
|
|
1844
|
+
return { registerCoreTools: mod.registerCoreTools, descriptor: entryStr, resolvedVersion };
|
|
1845
|
+
}
|
|
1756
1846
|
break;
|
|
1757
1847
|
} catch {
|
|
1758
1848
|
if (Object.keys(opts).length > 0) continue;
|
|
@@ -1772,7 +1862,8 @@ async function loadBuiltinFromToolYamlCacheAsync(configFilePath, stepLog) {
|
|
|
1772
1862
|
const cacheOpts = cacheBase ? { cacheBase } : {};
|
|
1773
1863
|
if (stepLog) stepLog("Loading builtin from tool.yaml cache (async)");
|
|
1774
1864
|
for (const entry of tools) {
|
|
1775
|
-
const
|
|
1865
|
+
const entryStr = String(entry).trim();
|
|
1866
|
+
const parsed = parseNpmDescriptor(entryStr);
|
|
1776
1867
|
if (!parsed || !BUILTIN_PKG_NAMES.includes(parsed.packageName)) continue;
|
|
1777
1868
|
for (const opts of [cacheOpts, {}]) {
|
|
1778
1869
|
try {
|
|
@@ -1780,7 +1871,10 @@ async function loadBuiltinFromToolYamlCacheAsync(configFilePath, stepLog) {
|
|
|
1780
1871
|
const cacheDir = ensurePackageInCache(parsed.packageName, parsed.version, opts);
|
|
1781
1872
|
if (stepLog) stepLog(`Using cache: ${cacheDir}`);
|
|
1782
1873
|
const mod = await importFromCache(cacheDir);
|
|
1783
|
-
if (mod && typeof mod.registerCoreTools === "function")
|
|
1874
|
+
if (mod && typeof mod.registerCoreTools === "function") {
|
|
1875
|
+
const resolvedVersion = path.basename(cacheDir);
|
|
1876
|
+
return { registerCoreTools: mod.registerCoreTools, descriptor: entryStr, resolvedVersion };
|
|
1877
|
+
}
|
|
1784
1878
|
break;
|
|
1785
1879
|
} catch {
|
|
1786
1880
|
if (Object.keys(opts).length > 0) continue;
|
|
@@ -1802,10 +1896,14 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
1802
1896
|
const stepLog = options.stepLog;
|
|
1803
1897
|
if (options.coreTools !== void 0) {
|
|
1804
1898
|
if (stepLog) stepLog("Trying builtin from node_modules");
|
|
1805
|
-
let
|
|
1806
|
-
if (
|
|
1899
|
+
let builtinNode = loadBuiltinTools();
|
|
1900
|
+
if (builtinNode) {
|
|
1807
1901
|
if (stepLog) stepLog("Registered builtin from node_modules");
|
|
1808
|
-
const
|
|
1902
|
+
const descriptor = `npm:${builtinNode.packageName}`;
|
|
1903
|
+
const resolvedVersion = getInstalledPackageVersion(builtinNode.packageName);
|
|
1904
|
+
const prefix = npmDescriptorToRegistryPrefix(descriptor, resolvedVersion ?? void 0);
|
|
1905
|
+
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1906
|
+
const coreAdapter = builtinNode.registerCoreTools(reg, options.coreTools);
|
|
1809
1907
|
const runtime3 = new PTCRuntime({ registry });
|
|
1810
1908
|
runtime3.registerAdapter(coreAdapter);
|
|
1811
1909
|
if (options.exampleTools !== void 0) {
|
|
@@ -1819,21 +1917,23 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
1819
1917
|
}
|
|
1820
1918
|
if (options.configFilePath) {
|
|
1821
1919
|
if (stepLog) stepLog("No builtin in node_modules, loading from tool.yaml cache");
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1920
|
+
const builtinCache = loadBuiltinFromToolYamlCache(options.configFilePath, stepLog);
|
|
1921
|
+
if (builtinCache) {
|
|
1922
|
+
if (stepLog) stepLog("Registered builtin from cache");
|
|
1923
|
+
const prefix = npmDescriptorToRegistryPrefix(builtinCache.descriptor, builtinCache.resolvedVersion);
|
|
1924
|
+
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1925
|
+
const coreAdapter = builtinCache.registerCoreTools(reg, options.coreTools);
|
|
1926
|
+
const runtime3 = new PTCRuntime({ registry });
|
|
1927
|
+
runtime3.registerAdapter(coreAdapter);
|
|
1928
|
+
if (options.exampleTools !== void 0) {
|
|
1929
|
+
const example = loadExampleTools();
|
|
1930
|
+
if (example) {
|
|
1931
|
+
const exampleAdapter = example.registerExampleTools(registry, options.exampleTools);
|
|
1932
|
+
runtime3.registerAdapter(exampleAdapter);
|
|
1933
|
+
}
|
|
1834
1934
|
}
|
|
1935
|
+
return { runtime: runtime3, registry };
|
|
1835
1936
|
}
|
|
1836
|
-
return { runtime: runtime3, registry };
|
|
1837
1937
|
}
|
|
1838
1938
|
const runtime2 = new PTCRuntime({ registry });
|
|
1839
1939
|
return { runtime: runtime2, registry };
|
|
@@ -1858,7 +1958,9 @@ async function createRuntimeFromConfig(options = {}) {
|
|
|
1858
1958
|
if (builtin) {
|
|
1859
1959
|
if (options.stepLog) options.stepLog("Registered builtin from async cache");
|
|
1860
1960
|
const registry = new chunkONIBCU2Y_cjs.ToolRegistry();
|
|
1861
|
-
const
|
|
1961
|
+
const prefix = npmDescriptorToRegistryPrefix(builtin.descriptor, builtin.resolvedVersion);
|
|
1962
|
+
const reg = prefix ? createPrefixingRegistry(registry, prefix) : registry;
|
|
1963
|
+
const coreAdapter = builtin.registerCoreTools(reg, options.coreTools);
|
|
1862
1964
|
const runtime = new PTCRuntime({ registry });
|
|
1863
1965
|
runtime.registerAdapter(coreAdapter);
|
|
1864
1966
|
return { runtime, registry };
|
|
@@ -1901,6 +2003,7 @@ exports.isBarePackageDescriptor = isBarePackageDescriptor;
|
|
|
1901
2003
|
exports.isNpmToolDescriptor = isNpmToolDescriptor;
|
|
1902
2004
|
exports.loadToolConfig = loadToolConfig;
|
|
1903
2005
|
exports.normalizeToolList = normalizeToolList;
|
|
2006
|
+
exports.npmDescriptorToRegistryPrefix = npmDescriptorToRegistryPrefix;
|
|
1904
2007
|
exports.parseNpmDescriptor = parseNpmDescriptor;
|
|
1905
2008
|
exports.parseNpmToolDescriptor = parseNpmToolDescriptor;
|
|
1906
2009
|
exports.resolveNpmToolDescriptor = resolveNpmToolDescriptor;
|
|
@@ -1908,5 +2011,5 @@ exports.resolveSandboxedPath = resolveSandboxedPath;
|
|
|
1908
2011
|
exports.resolveToolDescriptor = resolveToolDescriptor;
|
|
1909
2012
|
exports.sanitizeForLog = sanitizeForLog;
|
|
1910
2013
|
exports.summarizeForLog = summarizeForLog;
|
|
1911
|
-
//# sourceMappingURL=chunk-
|
|
1912
|
-
//# sourceMappingURL=chunk-
|
|
2014
|
+
//# sourceMappingURL=chunk-6WQYJLVU.cjs.map
|
|
2015
|
+
//# sourceMappingURL=chunk-6WQYJLVU.cjs.map
|