@zhin.js/agent 0.0.1 → 0.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/CHANGELOG.md
CHANGED
|
@@ -10,7 +10,7 @@ export function registerManagementTools() {
|
|
|
10
10
|
useContext('ai', 'tool', (ai, toolService) => {
|
|
11
11
|
if (!ai || !toolService)
|
|
12
12
|
return;
|
|
13
|
-
const listModelsTool = new ZhinTool('
|
|
13
|
+
const listModelsTool = new ZhinTool('ai_models')
|
|
14
14
|
.desc('列出所有可用的 AI 模型')
|
|
15
15
|
.keyword('模型', '可用模型', 'ai模型', 'model', 'models')
|
|
16
16
|
.tag('ai', 'management')
|
|
@@ -28,7 +28,7 @@ export function registerManagementTools() {
|
|
|
28
28
|
}
|
|
29
29
|
return r;
|
|
30
30
|
});
|
|
31
|
-
const clearSessionTool = new ZhinTool('
|
|
31
|
+
const clearSessionTool = new ZhinTool('ai_clear')
|
|
32
32
|
.desc('清除当前对话的历史记录')
|
|
33
33
|
.keyword('清除', '清空', '重置', 'clear', 'reset')
|
|
34
34
|
.tag('ai', 'session')
|
|
@@ -45,7 +45,7 @@ export function registerManagementTools() {
|
|
|
45
45
|
await ai.sessions.reset(sid);
|
|
46
46
|
return '✅ 对话历史已清除';
|
|
47
47
|
});
|
|
48
|
-
const healthCheckTool = new ZhinTool('
|
|
48
|
+
const healthCheckTool = new ZhinTool('ai_health')
|
|
49
49
|
.desc('检查 AI 服务的健康状态')
|
|
50
50
|
.keyword('健康', '状态', '检查', 'health', 'status')
|
|
51
51
|
.tag('ai', 'management')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhin.js/agent",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "Zhin AI Agent — session, ZhinAgent, init; composes @zhin.js/core providers and tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
17
|
-
"@zhin.js/core": "1.0.
|
|
17
|
+
"@zhin.js/core": "1.0.39"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -12,7 +12,7 @@ export function registerManagementTools(): void {
|
|
|
12
12
|
useContext('ai', 'tool', (ai, toolService) => {
|
|
13
13
|
if (!ai || !toolService) return;
|
|
14
14
|
|
|
15
|
-
const listModelsTool = new ZhinTool('
|
|
15
|
+
const listModelsTool = new ZhinTool('ai_models')
|
|
16
16
|
.desc('列出所有可用的 AI 模型')
|
|
17
17
|
.keyword('模型', '可用模型', 'ai模型', 'model', 'models')
|
|
18
18
|
.tag('ai', 'management')
|
|
@@ -30,7 +30,7 @@ export function registerManagementTools(): void {
|
|
|
30
30
|
return r;
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
const clearSessionTool = new ZhinTool('
|
|
33
|
+
const clearSessionTool = new ZhinTool('ai_clear')
|
|
34
34
|
.desc('清除当前对话的历史记录')
|
|
35
35
|
.keyword('清除', '清空', '重置', 'clear', 'reset')
|
|
36
36
|
.tag('ai', 'session')
|
|
@@ -47,7 +47,7 @@ export function registerManagementTools(): void {
|
|
|
47
47
|
return '✅ 对话历史已清除';
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
const healthCheckTool = new ZhinTool('
|
|
50
|
+
const healthCheckTool = new ZhinTool('ai_health')
|
|
51
51
|
.desc('检查 AI 服务的健康状态')
|
|
52
52
|
.keyword('健康', '状态', '检查', 'health', 'status')
|
|
53
53
|
.tag('ai', 'management')
|
package/tests/ai/agent.test.ts
CHANGED
|
@@ -410,13 +410,13 @@ describe('Agent.filterTools 程序化过滤', () => {
|
|
|
410
410
|
|
|
411
411
|
it('应该通过 tags 匹配工具', () => {
|
|
412
412
|
const tools = [
|
|
413
|
-
createMockTool({ name: '
|
|
413
|
+
createMockTool({ name: 'ai_models', description: '列出模型', tags: ['ai', 'management'] }),
|
|
414
414
|
createMockTool({ name: 'weather', description: '天气', tags: ['weather', 'utility'] }),
|
|
415
415
|
] as any[];
|
|
416
416
|
|
|
417
417
|
const result = Agent.filterTools('ai 相关功能', tools);
|
|
418
418
|
expect(result.length).toBeGreaterThanOrEqual(1);
|
|
419
|
-
expect(result[0].name).toBe('
|
|
419
|
+
expect(result[0].name).toBe('ai_models');
|
|
420
420
|
});
|
|
421
421
|
|
|
422
422
|
it('应该通过工具名 token 匹配', () => {
|