@easynet/agent-tool 1.0.98 → 1.0.100
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 +32 -30
- package/dist/api/createAgentTools.d.ts +1 -0
- package/dist/api/createAgentTools.d.ts.map +1 -1
- package/dist/api/expose/index.d.ts +1 -1
- package/dist/api/register-tools.d.ts +3 -3
- package/dist/api/register-tools.d.ts.map +1 -1
- package/dist/api/runtimeFromConfig.d.ts.map +1 -1
- package/dist/{chunk-ODML7BYU.js → chunk-34SBJLFZ.js} +47 -13
- package/dist/chunk-34SBJLFZ.js.map +1 -0
- package/dist/{chunk-GNYBAJZZ.cjs → chunk-YBMF3C6F.cjs} +47 -15
- package/dist/chunk-YBMF3C6F.cjs.map +1 -0
- package/dist/index.cjs +23 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -44
- package/dist/index.js.map +1 -1
- package/dist/utils/cli/index.cjs +14 -14
- package/dist/utils/cli/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-GNYBAJZZ.cjs.map +0 -1
- package/dist/chunk-ODML7BYU.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,46 +2,47 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
`@easynet/agent-tool` loads
|
|
5
|
+
`@easynet/agent-tool` loads `tool.yaml`, resolves tool extensions into LangChain-compatible tools, and registers them into the default `AgentContext`.
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Exposed SDK
|
|
8
8
|
|
|
9
|
-
|
|
|
9
|
+
| Export | Type | Purpose |
|
|
10
10
|
| --- | --- | --- |
|
|
11
|
-
| `createAgentTools` |
|
|
11
|
+
| `createAgentTools` | root function | Loads tools asynchronously from config. Preferred initializer for application bootstrap. |
|
|
12
|
+
| `@easynet/agent-tool/sdk` | subpath | SDK entry for building custom tool extensions. |
|
|
13
|
+
| `ToolRegistry` | sdk export | Registry used to register tool definitions. |
|
|
14
|
+
| `createExtension` | sdk export | Creates an extension package entry. |
|
|
15
|
+
| `registerExtension` | sdk export | Registers an extension into the runtime. |
|
|
16
|
+
| `registerToolsFromManifest` | sdk export | Registers tools from a generated manifest. |
|
|
17
|
+
| `loadToolYaml` | sdk export | Loads and parses `tool.yaml`. |
|
|
18
|
+
| `resolveSandboxedPath` | sdk export | Resolves paths under sandbox constraints. |
|
|
19
|
+
| `validateUrl` | sdk export | Validates outbound URLs for HTTP tools. |
|
|
12
20
|
|
|
13
21
|
## Usage
|
|
14
22
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
```yaml
|
|
18
|
-
apiVersion: easynet.world/v1
|
|
19
|
-
kind: ToolConfig
|
|
20
|
-
metadata:
|
|
21
|
-
name: agent-tool-default
|
|
22
|
-
spec:
|
|
23
|
-
sandboxedPath: .
|
|
24
|
-
allowedHosts: []
|
|
25
|
-
blockedHosts: []
|
|
26
|
-
tools:
|
|
27
|
-
npm:@easynet/agent-tool-buildin: {}
|
|
23
|
+
```bash
|
|
24
|
+
npm i @easynet/agent-tool
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
Load tools:
|
|
31
|
-
|
|
32
27
|
```ts
|
|
33
28
|
import { createAgentTools } from "@easynet/agent-tool";
|
|
34
29
|
|
|
35
|
-
const tools = createAgentTools(
|
|
36
|
-
configFilePath: "./tool.yaml",
|
|
37
|
-
});
|
|
30
|
+
const tools = await createAgentTools("./config/tool.yaml");
|
|
38
31
|
|
|
39
32
|
console.log(tools.map((tool) => tool.name));
|
|
40
33
|
```
|
|
41
34
|
|
|
42
|
-
|
|
35
|
+
Use `createAgentTools()` as the default application initializer. It matches the other async registration APIs (`createAgentModel`, `createAgentMemory`, `createAgentSkills`) and works cleanly with async extension loading.
|
|
43
36
|
|
|
44
|
-
|
|
37
|
+
If you are building your own tool extension, use the SDK subpath:
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { createExtension } from "@easynet/agent-tool/sdk";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
The default config file is `config/tool.yaml`.
|
|
45
46
|
|
|
46
47
|
```yaml
|
|
47
48
|
apiVersion: easynet.world/v1
|
|
@@ -56,10 +57,11 @@ spec:
|
|
|
56
57
|
npm:@easynet/agent-tool-buildin: {}
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
|
|
60
|
+
Key fields:
|
|
61
|
+
|
|
62
|
+
- `spec.sandboxedPath`: filesystem root accessible to tools
|
|
63
|
+
- `spec.allowedHosts`: HTTP allowlist
|
|
64
|
+
- `spec.blockedHosts`: HTTP denylist
|
|
65
|
+
- `spec.tools`: extensions to load
|
|
60
66
|
|
|
61
|
-
- `
|
|
62
|
-
- `spec.allowedHosts`: allowlist for outbound HTTP tools.
|
|
63
|
-
- `spec.blockedHosts`: denylist for outbound HTTP tools.
|
|
64
|
-
- `spec.tools`: keyed by tool source descriptor.
|
|
65
|
-
- `npm:@easynet/agent-tool-buildin: {}`: load the built-in tool extension package with default config.
|
|
67
|
+
`npm:@easynet/agent-tool-buildin: {}` loads the built-in tool extension package.
|
|
@@ -26,6 +26,7 @@ export interface CreateAgentToolsOptions extends CreateRuntimeOptions {
|
|
|
26
26
|
* Internal helper consumed by createAgentTools().
|
|
27
27
|
*/
|
|
28
28
|
export declare function createLangChainAgentTools(options?: CreateAgentToolsOptions | string): StructuredToolInterface[];
|
|
29
|
+
export declare function createLangChainAgentToolsAsync(options?: CreateAgentToolsOptions | string): Promise<StructuredToolInterface[]>;
|
|
29
30
|
/**
|
|
30
31
|
* Internal: create an MCP server from tool config.
|
|
31
32
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAgentTools.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"createAgentTools.d.ts","sourceRoot":"","sources":["../../src/api/createAgentTools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAcH,OAAO,KAAK,EAAE,oBAAoB,EAAmB,MAAM,wBAAwB,CAAC;AAEpF,OAAO,EAAmB,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/F,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC9B,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAOrE,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,2GAA2G;IAC3G,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoRD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,GACzC,uBAAuB,EAAE,CAa3B;AAED,wBAAsB,8BAA8B,CAClD,OAAO,CAAC,EAAE,uBAAuB,GAAG,MAAM,GACzC,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAsBpC;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,CAAC,EAAE,CAAC,uBAAuB,GAAG,gBAAgB,CAAC,GAAG,MAAM,GAC9D,OAAO,CAAC,SAAS,CAAC,CAWpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,OAAO,CAAC,EAAE,CAAC,uBAAuB,GAAG,wBAAwB,CAAC,GAAG,MAAM,GACtE,OAAO,CAAC,iBAAiB,CAAC,CAW5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Expose the same tools in multiple ways: LangChain, HTTP (OpenAPI), MCP server.
|
|
3
3
|
*
|
|
4
|
-
* - LangChain: createAgentTools() / LangChainToolsHub
|
|
4
|
+
* - LangChain: await createAgentTools() / LangChainToolsHub
|
|
5
5
|
* - HTTP: createHttpService(runtime) -> { server, openApiSpec, listen() }
|
|
6
6
|
* - MCP: createMCPServer(runtime) -> { server, connectStdio() }
|
|
7
7
|
*/
|
|
@@ -3,15 +3,15 @@ import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
|
3
3
|
export interface CreateAgentToolsModuleOptions extends CreateAgentToolsOptions {
|
|
4
4
|
}
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Preferred async tool initializer for application bootstrap.
|
|
7
7
|
*
|
|
8
8
|
* Sets:
|
|
9
9
|
* - AgentContextTokens.Tools → StructuredToolInterface[]
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
|
-
* createAgentTools(
|
|
13
|
+
* await createAgentTools("config/tool.yaml");
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
export declare function createAgentTools(
|
|
16
|
+
export declare function createAgentTools(configPathOrOptions?: string | CreateAgentToolsModuleOptions): Promise<StructuredToolInterface[]>;
|
|
17
17
|
//# sourceMappingURL=register-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-tools.d.ts","sourceRoot":"","sources":["../../src/api/register-tools.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"register-tools.d.ts","sourceRoot":"","sources":["../../src/api/register-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAGrE,MAAM,WAAW,6BAA8B,SAAQ,uBAAuB;CAAG;AAEjF;;;;;;;;;;GAUG;AACH,wBAAsB,gBAAgB,CACpC,mBAAmB,CAAC,EAAE,MAAM,GAAG,6BAA6B,GAC3D,OAAO,CAAC,uBAAuB,EAAE,CAAC,CAQpC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtimeFromConfig.d.ts","sourceRoot":"","sources":["../../src/api/runtimeFromConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAM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,5 +1,5 @@
|
|
|
1
1
|
import { DirectoryScanner, MCP_KIND } from './chunk-POUTZDWB.js';
|
|
2
|
-
import {
|
|
2
|
+
import { setSandboxValidationEnabled, ToolRegistry, createTaggedError, withRetry } from './chunk-IVL4TBFB.js';
|
|
3
3
|
import { normalizeToolName } from './chunk-BDUSB6GT.js';
|
|
4
4
|
import { enrichSpecWithCanonicalSchema } from './chunk-NTWOVFEY.js';
|
|
5
5
|
import { readFileSync, existsSync, statSync, rmSync, mkdirSync, readdirSync, renameSync } from 'fs';
|
|
@@ -2044,6 +2044,11 @@ function parseNpmDescriptor(entry) {
|
|
|
2044
2044
|
// src/api/runtimeFromConfig.ts
|
|
2045
2045
|
var requireFromPackage2 = createRequire(import.meta.url);
|
|
2046
2046
|
var DEFAULT_EXTENSION_PACKAGES = [];
|
|
2047
|
+
function resolveEffectiveCoreTools(options) {
|
|
2048
|
+
if (options.coreTools) return options.coreTools;
|
|
2049
|
+
if (options.configFilePath) return {};
|
|
2050
|
+
return void 0;
|
|
2051
|
+
}
|
|
2047
2052
|
function resolveFileDescriptorPath(descriptor, configFilePath) {
|
|
2048
2053
|
const parsed = parseToolPath(descriptor.trim());
|
|
2049
2054
|
if (!parsed || parsed.protocol !== "file") return null;
|
|
@@ -2089,7 +2094,34 @@ function loadExtensionFromFileDescriptorSync(descriptor, configFilePath, stepLog
|
|
|
2089
2094
|
if (stepLog) stepLog(`Loaded local extension from ${resolvedPath}`);
|
|
2090
2095
|
return { register: fn, descriptor: entryStr, resolvedVersion: "local", packageRoot: resolvedPath };
|
|
2091
2096
|
}
|
|
2092
|
-
} catch {
|
|
2097
|
+
} catch (error) {
|
|
2098
|
+
if (stepLog) {
|
|
2099
|
+
stepLog(`Failed to load local extension from ${resolvedPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2100
|
+
}
|
|
2101
|
+
}
|
|
2102
|
+
return null;
|
|
2103
|
+
}
|
|
2104
|
+
async function loadExtensionFromFileDescriptorAsync(descriptor, configFilePath, stepLog) {
|
|
2105
|
+
const entryStr = descriptor.trim();
|
|
2106
|
+
const path2 = parseToolPath(entryStr);
|
|
2107
|
+
if (!path2 || path2.protocol !== "file") return null;
|
|
2108
|
+
const localPath = isAbsolute(configFilePath) ? configFilePath : resolve(process.cwd(), configFilePath);
|
|
2109
|
+
const configDir = dirname(localPath);
|
|
2110
|
+
const pathPart = `${path2.scope}/${path2.packageWithVersion}`;
|
|
2111
|
+
const resolvedPath = resolve(configDir, pathPart);
|
|
2112
|
+
if (!existsSync(resolvedPath) || !statSync(resolvedPath).isDirectory()) return null;
|
|
2113
|
+
try {
|
|
2114
|
+
const entryPath = getPackageEntryPath(resolvedPath);
|
|
2115
|
+
const mod = await import(pathToFileURL(entryPath).href);
|
|
2116
|
+
const fn = getRegisterFn(mod);
|
|
2117
|
+
if (typeof fn === "function") {
|
|
2118
|
+
if (stepLog) stepLog(`Loaded local extension from ${resolvedPath} (async import)`);
|
|
2119
|
+
return { register: fn, descriptor: entryStr, resolvedVersion: "local", packageRoot: resolvedPath };
|
|
2120
|
+
}
|
|
2121
|
+
} catch (error) {
|
|
2122
|
+
if (stepLog) {
|
|
2123
|
+
stepLog(`Failed to load local extension from ${resolvedPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
2124
|
+
}
|
|
2093
2125
|
}
|
|
2094
2126
|
return null;
|
|
2095
2127
|
}
|
|
@@ -2258,7 +2290,7 @@ async function loadAllExtensionsFromToolYamlAsync(configFilePath, stepLog) {
|
|
|
2258
2290
|
const result = await loadExtensionForDescriptorAsync(entryStr, configFilePath, stepLog);
|
|
2259
2291
|
if (result) loaded.push(result);
|
|
2260
2292
|
} else if (entryStr.startsWith("file:")) {
|
|
2261
|
-
const result =
|
|
2293
|
+
const result = await loadExtensionFromFileDescriptorAsync(entryStr, configFilePath, stepLog);
|
|
2262
2294
|
if (result) {
|
|
2263
2295
|
loaded.push(result);
|
|
2264
2296
|
} else {
|
|
@@ -2272,8 +2304,9 @@ async function loadAllExtensionsFromToolYamlAsync(configFilePath, stepLog) {
|
|
|
2272
2304
|
function createRuntimeFromConfigSync(options = {}) {
|
|
2273
2305
|
const registry = new ToolRegistry();
|
|
2274
2306
|
const stepLog = options.stepLog;
|
|
2275
|
-
|
|
2276
|
-
|
|
2307
|
+
const effectiveCoreTools = resolveEffectiveCoreTools(options);
|
|
2308
|
+
setSandboxValidationEnabled(effectiveCoreTools?.enableSandboxValidation === true);
|
|
2309
|
+
if (effectiveCoreTools !== void 0) {
|
|
2277
2310
|
if (options.configFilePath) {
|
|
2278
2311
|
const all = loadAllExtensionsFromToolYamlSync(options.configFilePath, stepLog);
|
|
2279
2312
|
if (all.length > 0) {
|
|
@@ -2283,7 +2316,7 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2283
2316
|
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
2284
2317
|
const prefix = ext.descriptor.startsWith("file:") ? fileDescriptorToRegistryPrefix(ext.descriptor) : npmDescriptorToRegistryPrefix(ext.descriptor, ext.resolvedVersion);
|
|
2285
2318
|
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2286
|
-
const adapter = ext.register(reg,
|
|
2319
|
+
const adapter = ext.register(reg, effectiveCoreTools);
|
|
2287
2320
|
runtime3.registerAdapter(adapter);
|
|
2288
2321
|
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
2289
2322
|
runtime3.registerAdapterForTools(registeredNow, adapter);
|
|
@@ -2300,7 +2333,7 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2300
2333
|
const before = new Set(registry.snapshot().map((s) => s.name));
|
|
2301
2334
|
const prefix = npmDescriptorToRegistryPrefix(descriptor, resolvedVersion);
|
|
2302
2335
|
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2303
|
-
const coreAdapter = extensionNode.register(reg,
|
|
2336
|
+
const coreAdapter = extensionNode.register(reg, effectiveCoreTools);
|
|
2304
2337
|
const runtime3 = new PTCRuntime({ registry });
|
|
2305
2338
|
runtime3.registerAdapter(coreAdapter);
|
|
2306
2339
|
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
@@ -2314,8 +2347,9 @@ function createRuntimeFromConfigSync(options = {}) {
|
|
|
2314
2347
|
return { runtime, registry };
|
|
2315
2348
|
}
|
|
2316
2349
|
async function createRuntimeFromConfig(options = {}) {
|
|
2317
|
-
|
|
2318
|
-
|
|
2350
|
+
const effectiveCoreTools = resolveEffectiveCoreTools(options);
|
|
2351
|
+
setSandboxValidationEnabled(effectiveCoreTools?.enableSandboxValidation === true);
|
|
2352
|
+
if (effectiveCoreTools !== void 0 && options.configFilePath) {
|
|
2319
2353
|
const all = await loadAllExtensionsFromToolYamlAsync(options.configFilePath, options.stepLog);
|
|
2320
2354
|
if (all.length > 0) {
|
|
2321
2355
|
if (options.stepLog) options.stepLog(`Registered ${all.length} extension(s) from tool.yaml`);
|
|
@@ -2326,7 +2360,7 @@ async function createRuntimeFromConfig(options = {}) {
|
|
|
2326
2360
|
const prefix = ext.descriptor.startsWith("file:") ? fileDescriptorToRegistryPrefix(ext.descriptor) : npmDescriptorToRegistryPrefix(ext.descriptor, ext.resolvedVersion);
|
|
2327
2361
|
const reg = createPrefixingRegistry(registry, prefix ?? "");
|
|
2328
2362
|
if ("register" in ext) {
|
|
2329
|
-
const adapter = ext.register(reg,
|
|
2363
|
+
const adapter = ext.register(reg, effectiveCoreTools);
|
|
2330
2364
|
runtime.registerAdapter(adapter);
|
|
2331
2365
|
const registeredNow = registry.snapshot().map((s) => s.name).filter((name) => !before.has(name));
|
|
2332
2366
|
runtime.registerAdapterForTools(registeredNow, adapter);
|
|
@@ -2908,6 +2942,6 @@ async function createHttpService(runtimeOrConfig, options = {}) {
|
|
|
2908
2942
|
};
|
|
2909
2943
|
}
|
|
2910
2944
|
|
|
2911
|
-
export { createHttpService, createMCPServerStreamableHttp, createRuntimeFromConfig,
|
|
2912
|
-
//# sourceMappingURL=chunk-
|
|
2913
|
-
//# sourceMappingURL=chunk-
|
|
2945
|
+
export { createHttpService, createMCPServerStreamableHttp, createRuntimeFromConfig, expandToolDescriptorsToRegistryNames, fileDescriptorToPackagePrefix, findAndLoadToolConfig, getDisplayScope, getToolSourceDescriptors, isBarePackageDescriptor, loadToolConfig, npmDescriptorToPackagePrefix, resolveSandboxedPath, resolveToolDescriptor, runMCPServerOverStdio, toToolObservationText };
|
|
2946
|
+
//# sourceMappingURL=chunk-34SBJLFZ.js.map
|
|
2947
|
+
//# sourceMappingURL=chunk-34SBJLFZ.js.map
|