@agenticforge/tools 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -0
- package/package.json +11 -2
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# @agenticforge/tools
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@agenticforge/tools)
|
|
4
|
+
[](https://github.com/LittleBlacky/AgenticFORGE/blob/main/LICENSE)
|
|
5
|
+
|
|
6
|
+
AgenticFORGE 工具核心包,提供 Tool 抽象、ToolRegistry、ToolChain 与异步执行器。
|
|
7
|
+
|
|
8
|
+
> Tool abstraction, registry, chain, and async executor for AgenticFORGE.
|
|
9
|
+
|
|
10
|
+
## 安装
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @agenticforge/tools
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## 主要导出
|
|
17
|
+
|
|
18
|
+
| 名称 | 说明 |
|
|
19
|
+
|------|------|
|
|
20
|
+
| `Tool` | 工具基类,封装参数定义与执行逻辑 |
|
|
21
|
+
| `toolAction` | 工具动作工厂,结合 Zod 做参数校验 |
|
|
22
|
+
| `ToolRegistry` | 工具注册表,统一管理可用工具 |
|
|
23
|
+
| `ToolChain` | 工具链,支持顺序/并行组合多个工具 |
|
|
24
|
+
| `AsyncToolExecutor` | 异步工具执行器,支持超时与并发控制 |
|
|
25
|
+
|
|
26
|
+
## 使用示例
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import {Tool, toolAction, ToolRegistry} from "@agenticforge/tools";
|
|
30
|
+
import {z} from "zod";
|
|
31
|
+
|
|
32
|
+
const searchTool = new Tool({
|
|
33
|
+
name: "search",
|
|
34
|
+
description: "搜索互联网信息",
|
|
35
|
+
parameters: [
|
|
36
|
+
{name: "query", type: "string", description: "搜索关键词", required: true},
|
|
37
|
+
],
|
|
38
|
+
action: toolAction(z.object({query: z.string()}), async ({query}) => {
|
|
39
|
+
return `搜索结果:${query} 相关内容...`;
|
|
40
|
+
}),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const registry = new ToolRegistry();
|
|
44
|
+
registry.register(searchTool);
|
|
45
|
+
|
|
46
|
+
const tool = registry.get("search");
|
|
47
|
+
const result = await tool.execute({query: "AgenticFORGE"});
|
|
48
|
+
console.log(result);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## 链接
|
|
52
|
+
|
|
53
|
+
- [GitHub](https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/tools)
|
|
54
|
+
- [npm](https://www.npmjs.com/package/@agenticforge/tools)
|
|
55
|
+
- [主项目 README](https://github.com/LittleBlacky/AgenticFORGE)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agenticforge/tools",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Tooling core for
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Tooling core for AgenticFORGE",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -39,5 +39,14 @@
|
|
|
39
39
|
"rollup-plugin-esbuild": "^6.2.1",
|
|
40
40
|
"tsx": "^4.21.0",
|
|
41
41
|
"typescript": "~5.9.3"
|
|
42
|
+
},
|
|
43
|
+
"repository": {
|
|
44
|
+
"type": "git",
|
|
45
|
+
"url": "https://github.com/LittleBlacky/AgenticFORGE.git",
|
|
46
|
+
"directory": "packages/tools"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/LittleBlacky/AgenticFORGE/tree/main/packages/tools#readme",
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "https://github.com/LittleBlacky/AgenticFORGE/issues"
|
|
42
51
|
}
|
|
43
52
|
}
|