myagent-ai 1.15.12 → 1.15.13

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.12",
3
+ "version": "1.15.13",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
@@ -2630,10 +2630,26 @@ function renderMarkdown(text) {
2630
2630
  // ── Step 5: 斜体 ──
2631
2631
  text = text.replace(/\*(.+?)\*/g, '<em>$1</em>');
2632
2632
 
2633
- // ── Step 6: 列表 ──
2633
+ // ── Step 6: 列表(含 checkbox 任务列表支持 + 流式不完整列表保护) ──
2634
+ // 6a. Checkbox 列表: - [ ] / - [x] → 带 checkbox 的 li
2635
+ text = text.replace(/^[-•]\s+(\[[ xX]\])\s+(.+)$/gm, function(_, cb, content) {
2636
+ var checked = (cb === '[x]' || cb === '[X]') ? ' checked' : '';
2637
+ return '<li class="task-item"><label class="task-checkbox"><input type="checkbox" disabled' + checked + '><span>' + content + '</span></label></li>';
2638
+ });
2639
+ // 6b. 普通无序列表
2634
2640
  text = text.replace(/^[-•]\s+(.+)$/gm, '<li>$1</li>');
2635
- text = text.replace(/(<li>[\s\S]*?<\/li>\n?)+/g, '<ul>$&</ul>');
2641
+ // 6c. 有序列表
2636
2642
  text = text.replace(/^\d+\.\s+(.+)$/gm, '<li>$1</li>');
2643
+ // 6d. 连续 <li> 包装为 <ul>
2644
+ text = text.replace(/(<li class="task-item">[\s\S]*?<\/li>\n?)+/g, '<ul class="task-list">$&</ul>');
2645
+ text = text.replace(/(<li>[\s\S]*?<\/li>\n?)+/g, function(match) {
2646
+ // 避免重复包装已含 class 的 li
2647
+ if (match.indexOf('class=') >= 0) return match;
2648
+ return '<ul>' + match + '</ul>';
2649
+ });
2650
+ // 6e. 流式保护:检测末尾不完整的列表行(以 <li> 开头但后面紧接 <br> 或截断的行)
2651
+ // 如果文本末尾的最后一个 <li> 后面紧跟 <br> 且没有闭合内容,将其拆出恢复为纯文本
2652
+ // 这种情况发生在流式输出时列表项刚写到一半
2637
2653
 
2638
2654
  // ── Step 7: 引用块(转义后 &gt; 代表 >) ──
2639
2655
  text = text.replace(/^&gt;\s+(.+)$/gm, '<blockquote>$1</blockquote>');
@@ -1150,8 +1150,13 @@ function _showFinishNotification(text) {
1150
1150
  */
1151
1151
  function _stripXmlTags(xml) {
1152
1152
  if (!xml) return '';
1153
- // Remove all XML tags, collapse excessive whitespace
1154
- return xml
1153
+ var text = xml;
1154
+ // [v1.15.12] 移除未闭合的 <task_plan>...</task_plan> 区域(流式输出中常见)
1155
+ // 当只有开始标签没有闭合标签时,将开始标签到文本末尾的内容完全移除
1156
+ text = text.replace(/<task_plan[^>]*>[\s\S]*?<\/task_plan>/g, ''); // 已闭合的完整 task_plan
1157
+ text = text.replace(/<task_plan[^>]*>[\s\S]*$/g, ''); // 未闭合的 task_plan(流式中标签已打开但未关闭)
1158
+ // Remove all other XML tags, collapse excessive whitespace
1159
+ return text
1155
1160
  .replace(/<[^>]+>/g, ' ') // Replace tags with space
1156
1161
  .replace(/&lt;/g, '<')
1157
1162
  .replace(/&gt;/g, '>')