@ai-zen/agents-sdk 0.2.6 → 0.2.8
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/config/constants.js
CHANGED
|
@@ -138,7 +138,7 @@ export const DEFAULT_APP_CONFIG = {
|
|
|
138
138
|
endpointId: "deepseek",
|
|
139
139
|
modelName: "deepseek-v4-flash",
|
|
140
140
|
maxContextTokens: 250_000,
|
|
141
|
-
defaultParams: { thinking: { type: "
|
|
141
|
+
defaultParams: { thinking: { type: "enabled" } },
|
|
142
142
|
description: "DeepSeek 经济高效模型",
|
|
143
143
|
},
|
|
144
144
|
],
|
|
@@ -29,7 +29,7 @@ export function createAgent(provider, agentId) {
|
|
|
29
29
|
: undefined,
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
const agent = new SdkAgent({
|
|
33
33
|
provider,
|
|
34
34
|
definition,
|
|
35
35
|
model,
|
|
@@ -38,4 +38,18 @@ export function createAgent(provider, agentId) {
|
|
|
38
38
|
permissions: definition.permissions,
|
|
39
39
|
caps,
|
|
40
40
|
});
|
|
41
|
+
// 设置 onUnknownTool 钩子:当 LLM 调用不存在的工具时,给出智能提示
|
|
42
|
+
agent.onUnknownTool = (ctx) => {
|
|
43
|
+
const toolName = ctx.toolCall.function?.name ?? "未知";
|
|
44
|
+
const hasMcpConfig = provider.mcpPaths.length > 0;
|
|
45
|
+
const hasCallMcpTool = tools.some((t) => t.function.name === "call_mcp_tool");
|
|
46
|
+
if (hasMcpConfig && !hasCallMcpTool) {
|
|
47
|
+
return `工具 "${toolName}" 不存在。当前有 MCP 服务器配置,但 call_mcp_tool 权限已被禁用,如需使用 MCP 工具请调整权限。`;
|
|
48
|
+
}
|
|
49
|
+
if (hasMcpConfig && hasCallMcpTool) {
|
|
50
|
+
return `工具 "${toolName}" 不存在。如果要调用 MCP 工具,请使用 call_mcp_tool。`;
|
|
51
|
+
}
|
|
52
|
+
return `工具 "${toolName}" 不存在。`;
|
|
53
|
+
};
|
|
54
|
+
return agent;
|
|
41
55
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-zen/agents-sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "AI-Zen Agents SDK — shared business logic for CLI and Desktop",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
"mcp",
|
|
14
14
|
"model-context-protocol"
|
|
15
15
|
],
|
|
16
|
-
"author": "",
|
|
17
|
-
"license": "
|
|
16
|
+
"author": "LZQCN",
|
|
17
|
+
"license": "MIT",
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
20
20
|
"dayjs": "^1.11.21",
|
|
21
|
-
"@ai-zen/agents-core": "3.0.0-alpha.
|
|
21
|
+
"@ai-zen/agents-core": "3.0.0-alpha.4"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/node": "^24.12.2",
|