@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.
@@ -22,6 +22,7 @@ export default class McpGraphAgent {
22
22
  private stopLoadingFunc;
23
23
  private verbose;
24
24
  private alwaysSystem;
25
+ private recursionLimit;
25
26
  constructor(options?: AgentOptions);
26
27
  private showLoading;
27
28
  private startLoading;
@@ -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: 100, debug: this.verbose });
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. 一旦完成对一个文件的修改(apply_fix),请立即调用 generate_review 总结该文件的变动。
255
- 2. 避免陷入在同一个文件上的无限循环尝试。
256
- 3. 不要重复调用相同的工具和参数,如果工具已经返回结果,请基于结果继续工作而不是再次调用。{recentToolCalls}
255
+ 1. 避免陷入在同一个文件上的无限循环尝试。
256
+ 2. 不要重复调用相同的工具和参数,如果工具已经返回结果,请基于结果继续工作而不是再次调用。{recentToolCalls}
257
257
  {extraPrompt}`;
258
258
  // 2. 核心逻辑:处理消息上下文
259
259
  let inputMessages;
@@ -63,4 +63,8 @@ export interface AgentOptions {
63
63
  * only for graph agent
64
64
  */
65
65
  alwaysSystem?: boolean;
66
+ /**
67
+ * only for graph agent
68
+ */
69
+ recursionLimit?: number;
66
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saber2pr/ai-agent",
3
- "version": "0.0.25",
3
+ "version": "0.0.27",
4
4
  "description": "AI Assistant CLI.",
5
5
  "author": "saber2pr",
6
6
  "license": "ISC",