@saber2pr/ai-agent 0.0.25 → 0.0.27
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/lib/core/agent-graph.js
CHANGED
|
@@ -60,6 +60,7 @@ class McpGraphAgent {
|
|
|
60
60
|
this.verbose = options.verbose || false;
|
|
61
61
|
this.alwaysSystem = options.alwaysSystem || true;
|
|
62
62
|
this.targetDir = options.targetDir || process.cwd();
|
|
63
|
+
this.recursionLimit = options.recursionLimit || 200;
|
|
63
64
|
process.setMaxListeners(100);
|
|
64
65
|
// ✅ 修复 AbortSignal 监听器数量警告
|
|
65
66
|
// LangChain 的 HTTP 客户端会创建多个 AbortSignal,需要增加默认限制
|
|
@@ -144,7 +145,7 @@ class McpGraphAgent {
|
|
|
144
145
|
messages: [new messages_1.HumanMessage(query)],
|
|
145
146
|
mode: "auto",
|
|
146
147
|
targetCount: 4,
|
|
147
|
-
}, { configurable: { thread_id: "auto_worker" }, recursionLimit:
|
|
148
|
+
}, { configurable: { thread_id: "auto_worker" }, recursionLimit: this.recursionLimit, debug: this.verbose, });
|
|
148
149
|
for await (const output of stream)
|
|
149
150
|
this.renderOutput(output);
|
|
150
151
|
}
|
|
@@ -251,9 +252,8 @@ class McpGraphAgent {
|
|
|
251
252
|
2. 严禁对 JSON 内容进行二次转义。
|
|
252
253
|
|
|
253
254
|
# 指令
|
|
254
|
-
1.
|
|
255
|
-
2.
|
|
256
|
-
3. 不要重复调用相同的工具和参数,如果工具已经返回结果,请基于结果继续工作而不是再次调用。{recentToolCalls}
|
|
255
|
+
1. 避免陷入在同一个文件上的无限循环尝试。
|
|
256
|
+
2. 不要重复调用相同的工具和参数,如果工具已经返回结果,请基于结果继续工作而不是再次调用。{recentToolCalls}
|
|
257
257
|
{extraPrompt}`;
|
|
258
258
|
// 2. 核心逻辑:处理消息上下文
|
|
259
259
|
let inputMessages;
|
package/lib/types/type.d.ts
CHANGED