myagent-ai 1.23.42 → 1.23.43

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/scripts/cli.py +19 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.23.42",
3
+ "version": "1.23.43",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/scripts/cli.py CHANGED
@@ -340,23 +340,33 @@ 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"}
343
+ # [v1.23.42] 预过滤不支持的参数,防止 Agent 把系统 grep 参数传进来
344
+ # 区分标志(无参数)和选项(带参数)
345
+ _unsupported_flags = {"-n", "--line-number", "-l", "--files-with-matches",
346
+ "-r", "-R", "--recursive", "-i", "--ignore-case",
347
+ "-c", "--count", "-w", "--word-regexp", "-v",
348
+ "--invert-match", "-E", "-F", "-P", "-m"}
349
+ _unsupported_opts = {"-e", "--regexp", "--include", "--exclude",
350
+ "--after-context", "--before-context", "--context",
351
+ "-A", "-B", "-C", "--max-count", "--color"}
348
352
  _filtered = []
349
353
  _skip_next = False
350
354
  for i, a in enumerate(args):
351
355
  if _skip_next:
352
356
  _skip_next = False
353
357
  continue
354
- # 处理 -nPattern 或 --name=Value 格式
355
- if a in _unsupported:
358
+ if a in _unsupported_flags:
359
+ # 标志参数,不跳过下一个
360
+ continue
361
+ if a in _unsupported_opts:
362
+ # 带参数选项,跳过下一个
356
363
  _skip_next = True
357
364
  continue
358
- if any(a.startswith(k) for k in _unsupported):
359
- # 带值参数如 --max=50 这种已经在 argparse 处理了
365
+ # 处理组合标志如 -rn、长选项 --name=Value
366
+ if any(a.startswith(k) for k in _unsupported_flags):
367
+ # -rn 或 -ni 等组合标志,不跳过下一个
368
+ continue
369
+ if any(a.startswith(k) for k in _unsupported_opts):
360
370
  if "=" not in a:
361
371
  _skip_next = True
362
372
  continue