myagent-ai 1.15.40 → 1.15.42

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.
@@ -642,10 +642,22 @@ class MainAgent(BaseAgent):
642
642
  stream_callback,
643
643
  )
644
644
 
645
- # Step 4.2: <output> 块完整性检查 — 不完整的块不输出,触发修正
646
- if not parsed.output_block_complete:
645
+ # Step 4.2: <output> 块完整性检查
646
+ # 仅在块不完整且解析未提取到任何有效内容时才触发修正
647
+ # 如果解析器已经从非完整块中提取到有效内容(response/tools等),则正常继续
648
+ if not parsed.output_block_complete and not parsed.parse_success:
649
+ # 打印完整消息列表(系统提示词+对话历史),便于分析模型为何输出不完整
647
650
  logger.warning(
648
- f"[{task_id}] <output> 块不完整(缺少 </output> 闭合标签),"
651
+ f"[{task_id}] <output> 块不完整且未提取到有效内容\n"
652
+ f"====== 发送给LLM的完整消息列表(共{len(messages)}条)======\n"
653
+ + "\n".join(
654
+ f"--- [{i}] role={m.role} ---\n{m.content[:8000]}{'...(截断)' if len(m.content)>8000 else ''}"
655
+ for i, m in enumerate(messages)
656
+ )
657
+ + f"\n====== 消息列表结束 ======"
658
+ )
659
+ logger.warning(
660
+ f"[{task_id}] <output> 块不完整且未提取到有效内容,"
649
661
  f"跳过本轮输出和工具执行"
650
662
  )
651
663
  if _xml_correction_retries < 1:
@@ -679,6 +691,11 @@ class MainAgent(BaseAgent):
679
691
  stream_callback,
680
692
  )
681
693
  break
694
+ elif not parsed.output_block_complete and parsed.parse_success:
695
+ # 块不完整但已提取到有效内容,记录日志但正常继续
696
+ logger.info(
697
+ f"[{task_id}] <output> 块不完整但已提取到有效内容,跳过修正直接处理"
698
+ )
682
699
 
683
700
  # Step 4.5: 解析失败处理 — 回退给 LLM 修正或提取周边文本
684
701
  if not parsed.parse_success:
@@ -431,9 +431,12 @@ def _custom_parse(raw_text: str) -> ParsedOutput:
431
431
  conservative = not parsed.output_block_complete
432
432
 
433
433
  if conservative:
434
- logger.info(
434
+ logger.warning(
435
435
  "XML <output> 块不完整(缺少 </output> 闭合标签),"
436
- "启用保守解析模式(仅提取完整闭合的标签)"
436
+ "启用保守解析模式(仅提取完整闭合的标签)\n"
437
+ "====== LLM 完整输出开始 ======\n"
438
+ f"{raw_text}\n"
439
+ "====== LLM 完整输出结束 ======"
437
440
  )
438
441
 
439
442
  # ── Step 1: Strip non-XML noise (text before/after <output>) ──
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.40",
3
+ "version": "1.15.42",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
@@ -65,4 +65,4 @@
65
65
  "departments/",
66
66
  "web/"
67
67
  ]
68
- }
68
+ }