@noobdemon/noob-cli 1.13.2 → 1.13.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Tất cả thay đổi đáng kể của `@noobdemon/noob-cli` được ghi vào file này.
4
4
 
5
+ ## [1.13.3] - 2026-06-29
6
+
7
+ ### Fixed
8
+ - **Message nhắc việc nội bộ không còn gây nhiễu mô hình** (`src/agent.js`): các message nhắc tiếp tục công việc (nhắc todo còn dở, hướng dẫn khi tool lỗi, cảnh báo gọi trùng tool) trước đây được chèn vào hội thoại như thể là tin nhắn người dùng và mở đầu bằng nhãn `[SYSTEM]`. Mô hình ở lượt sau đọc lại tưởng có người chèn lệnh giả dạng hệ thống vào cuộc trò chuyện nên sinh nghi ngờ, đi sửa lung tung. Giờ các message này đi đúng kênh kết quả tool và đổi nhãn thành `[TODO]`/`[TOOL GUIDANCE]`.
9
+
10
+ ### Verified
11
+ - `npm test` 109/109 pass.
12
+
5
13
  ## [1.13.2] - 2026-06-28
6
14
 
7
15
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noobdemon/noob-cli",
3
- "version": "1.13.2",
3
+ "version": "1.13.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/src/agent.js CHANGED
@@ -479,18 +479,18 @@ export function todoContinuationMessage(toolName, ok, tasks) {
479
479
  if (!tasks?.length) return null;
480
480
  const next = tasks[0];
481
481
  const status = ok ? `đã hoàn thành` : `vừa LỖI`;
482
- return `[SYSTEM] Việc "${toolName}" ${status}. Còn ${tasks.length} việc: ${tasks.map((t) => `"${t}"`).join(', ')}. Việc tiếp theo BẮT BUỘC phải làm ngay: "${next}". Gọi tool (write_file/edit_file/run_command) để làm việc này. KHÔNG dừng, KHÔNG tóm tắt.`;
482
+ return `[TODO] Việc "${toolName}" ${status}. Còn ${tasks.length} việc: ${tasks.map((t) => `"${t}"`).join(', ')}. Việc tiếp theo BẮT BUỘC phải làm ngay: "${next}". Gọi tool (write_file/edit_file/run_command) để làm việc này. KHÔNG dừng, KHÔNG tóm tắt.`;
483
483
  }
484
484
 
485
485
  export function toolErrorGuidance(name, { result } = {}) {
486
486
  if (name !== 'edit_file' || !String(result || '').includes('old_string not found')) return null;
487
487
  const m = String(result).match(/NEXT REQUIRED TOOL:\s*(read_file \{[^\n]+\})/);
488
488
  if (!m) return null;
489
- return `[SYSTEM] edit_file thất bại vì old_string sai. Bạn PHẢI gọi đúng tool này ngay: ${m[1]}. KHÔNG gọi edit_file lại trước khi đọc file. Sau đó copy đúng text từ read_file mới để retry.`;
489
+ return `[TOOL GUIDANCE] edit_file thất bại vì old_string sai. Bạn PHẢI gọi đúng tool này ngay: ${m[1]}. KHÔNG gọi edit_file lại trước khi đọc file. Sau đó copy đúng text từ read_file mới để retry.`;
490
490
  }
491
491
 
492
492
  export function duplicateToolGuidance(name, input) {
493
- return `[SYSTEM] Tool call vừa rồi TRÙNG HỆT lần trước: ${name} ${JSON.stringify(input || {})}. KHÔNG chạy tool này lại. Dùng kết quả đã có trong history; nếu cần tiến thêm thì gọi tool khác (grep/read_file/edit_file/run_command) hoặc trả lời Markdown nếu xong.`;
493
+ return `[TOOL GUIDANCE] Tool call vừa rồi TRÙNG HỆT lần trước: ${name} ${JSON.stringify(input || {})}. KHÔNG chạy tool này lại. Dùng kết quả đã có trong history; nếu cần tiến thêm thì gọi tool khác (grep/read_file/edit_file/run_command) hoặc trả lời Markdown nếu xong.`;
494
494
  }
495
495
 
496
496
  // Detect câu trả lời bị cắt giữa chừng — KHÔNG phải câu hoàn chỉnh.
@@ -722,7 +722,7 @@ export async function runAgent({
722
722
  });
723
723
  const toolOk = allow && !String(result || '').startsWith('ERROR:');
724
724
  const errorNudge = allow ? toolErrorGuidance(call.name, { result }) : null;
725
- if (errorNudge) history.push({ role: 'user', content: errorNudge });
725
+ if (errorNudge) history.push({ role: 'tool', name: 'tool_guidance', content: errorNudge });
726
726
 
727
727
  // ── Todo continuation nudge ──────────────────────────────────────────
728
728
  // Sau mỗi tool result, inject nudge nếu còn task chưa xong.
@@ -730,7 +730,7 @@ export async function runAgent({
730
730
  {
731
731
  const tasks = pendingTasks || [];
732
732
  const msg = todoContinuationMessage(call.name, toolOk, tasks);
733
- if (msg) history.push({ role: 'user', content: msg });
733
+ if (msg) history.push({ role: 'tool', name: 'todo_continuation', content: msg });
734
734
  }
735
735
 
736
736
  // ── Loop detection ──────────────────────────────────────────────────