myagent-ai 1.23.39 → 1.23.41
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/agents/main_agent.py +2 -2
- package/package.json +1 -1
- package/scripts/cli.py +25 -1
package/agents/main_agent.py
CHANGED
|
@@ -1614,9 +1614,9 @@ class MainAgent(BaseAgent):
|
|
|
1614
1614
|
_tp.initialize()
|
|
1615
1615
|
_tp.save_task(
|
|
1616
1616
|
task_id=task_id,
|
|
1617
|
-
description=context.
|
|
1617
|
+
description=context.user_message or "未完成任务",
|
|
1618
1618
|
session_id=context.session_id or "",
|
|
1619
|
-
agent_path=context.agent_path or "",
|
|
1619
|
+
agent_path=context.metadata.get("agent_path", "") or "",
|
|
1620
1620
|
status="pending",
|
|
1621
1621
|
metadata={"iterations": self._iteration_count, "reason": "达到最大迭代次数"},
|
|
1622
1622
|
last_message=f"达到最大迭代次数 {max_iter},共执行 {self._iteration_count} 次",
|
package/package.json
CHANGED
package/scripts/cli.py
CHANGED
|
@@ -340,13 +340,37 @@ async def cmd_rm(args):
|
|
|
340
340
|
async def cmd_grep(args):
|
|
341
341
|
"""搜索文件内容"""
|
|
342
342
|
import argparse
|
|
343
|
+
# [v1.23.40] 预过滤不支持的参数,防止 Agent 把系统 grep 参数传进来
|
|
344
|
+
_unsupported = {"-n", "--line-number", "-l", "--files-with-matches",
|
|
345
|
+
"-r", "-R", "--recursive", "-i", "--ignore-case",
|
|
346
|
+
"-c", "--count", "-w", "--word-regexp", "-v", "--invert-match",
|
|
347
|
+
"-e", "--regexp", "--include", "--exclude", "-E", "-F", "-P"}
|
|
348
|
+
_filtered = []
|
|
349
|
+
_skip_next = False
|
|
350
|
+
for i, a in enumerate(args):
|
|
351
|
+
if _skip_next:
|
|
352
|
+
_skip_next = False
|
|
353
|
+
continue
|
|
354
|
+
# 处理 -nPattern 或 --name=Value 格式
|
|
355
|
+
if a in _unsupported:
|
|
356
|
+
_skip_next = True
|
|
357
|
+
continue
|
|
358
|
+
if any(a.startswith(k) for k in _unsupported):
|
|
359
|
+
# 带值参数如 --max=50 这种已经在 argparse 处理了
|
|
360
|
+
if "=" not in a:
|
|
361
|
+
_skip_next = True
|
|
362
|
+
continue
|
|
363
|
+
_filtered.append(a)
|
|
364
|
+
if not _filtered:
|
|
365
|
+
_filtered = args # fallback
|
|
366
|
+
|
|
343
367
|
p = argparse.ArgumentParser(prog="myagent-ai grep", description="在目录中搜索文件内容")
|
|
344
368
|
p.add_argument("query", help="搜索关键词")
|
|
345
369
|
p.add_argument("path", help="搜索目录路径")
|
|
346
370
|
p.add_argument("-p", "--pattern", default="*", help="文件匹配模式 (如 *.py)")
|
|
347
371
|
p.add_argument("--max", type=int, default=50, help="最大结果数 (默认50)")
|
|
348
372
|
p.add_argument("--depth", type=int, default=10, help="最大递归深度 (默认10)")
|
|
349
|
-
a = p.parse_args(
|
|
373
|
+
a = p.parse_args(_filtered)
|
|
350
374
|
|
|
351
375
|
from skills.file_skill import FileSearchSkill
|
|
352
376
|
skill = FileSearchSkill()
|