@acmecloud/core 1.0.12 → 1.0.15

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.
@@ -4,7 +4,7 @@ import { builtInTools, toolExecutors, isCommandSafe } from "../tools/index.js";
4
4
  import { getMcpTools } from "../mcp/index.js";
5
5
  import { getSystemPrompt } from "../prompt/index.js";
6
6
  // ── Configuration ──
7
- const MAX_STEPS = 80;
7
+ const MAX_STEPS = 300;
8
8
  const MAX_OUTPUT_LENGTH = 30000;
9
9
  const MAX_RETRIES = 2;
10
10
  // ── Model-specific output token limits ──
@@ -445,9 +445,22 @@ export async function* runAgent(provider, modelName, messages, systemPrompt, abo
445
445
  return [];
446
446
  }
447
447
  }
448
- // Model returned text but no tool calls
449
- // This is normal - the model might be providing explanation or asking for clarification
450
- // Add the response to history and continue the loop to let model continue working
448
+ // Model returned text but no tool calls - check for completion signal
449
+ // The model should output [TASK_COMPLETE] when done
450
+ if (stepText.includes("[TASK_COMPLETE]") ||
451
+ stepText.includes("<TASK_COMPLETE>")) {
452
+ // Task is complete - return with the final response (remove the signal from output)
453
+ const cleanText = stepText
454
+ .replace(/\[TASK_COMPLETE\]|<TASK_COMPLETE>/g, "")
455
+ .trim();
456
+ currentMessages.push({
457
+ role: "assistant",
458
+ content: cleanText || stepText,
459
+ });
460
+ yield { type: "messages", messages: currentMessages };
461
+ return [];
462
+ }
463
+ // Task not complete yet - continue working
451
464
  currentMessages.push({ role: "assistant", content: stepText });
452
465
  // Add a system prompt to encourage the model to continue if task is not complete
453
466
  currentMessages.push({
@@ -488,7 +501,12 @@ export async function* runAgent(provider, modelName, messages, systemPrompt, abo
488
501
  promptLength: system.length,
489
502
  };
490
503
  }
491
- yield { type: "text", text: "\n[Reached maximum steps]\n" };
504
+ // Reached maximum steps - prompt user to continue in new session
505
+ yield { type: "text", text: `\n[Reached maximum steps (${MAX_STEPS})]\n\n` };
506
+ yield {
507
+ type: "text",
508
+ text: `The conversation has reached the step limit. To continue working on this task, please start a new session. Your progress has been saved.`,
509
+ };
492
510
  yield { type: "messages", messages: currentMessages };
493
511
  return [];
494
512
  }
@@ -1 +1 @@
1
- export declare const PROMPT_BEAST = "You are AcmeCode, an AI assistant - please keep working until the user's query is completely resolved.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nYou have everything you need to resolve this problem. I want you to fully solve this autonomously.\n\nOnly end your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly solved the problem.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence.\n\nIf the user request is \"resume\" or \"continue\", check the previous conversation history to see what the next incomplete step is. Continue from that step, and do not hand back control to the user until the entire task is complete.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided to catch all edge cases.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls.\n\nYou MUST keep working until the problem is completely solved. When you say \"Next I will do X\" or \"Now I will do Y\", you MUST actually do it.\n\nYou are a highly capable AI assistant, and you can solve this problem without needing to ask the user for further input.\n\n# Critical: Per-Step Task File Updates\n\n**This is critical for recovery from interruptions:**\n\n1. **Update the task file immediately after completing each subtask** - Do NOT batch multiple subtasks before updating.\n2. **Each subtask must update the task file** - Mark it as completed with [x] before moving to the next subtask.\n3. **Never complete multiple subtasks without updating** - If you complete 3 subtasks without updating the task file, you will lose progress if interrupted.\n4. **Update order matters**: \n - Complete the subtask (e.g., write code, run command)\n - **IMMEDIATELY** update the task file to mark it as [x] completed\n - Then move to the next subtask\n5. **On resume/restart**: Read the task file first to see which subtasks are marked [x], then continue from the first incomplete subtask.\n\n**Example of correct behavior:**\n```\n## Task: Implement Feature X\n- [x] Subtask 1: Read existing code \u2190 Completed and marked\n- [x] Subtask 2: Write new function \u2190 Completed and marked \n- [ ] Subtask 3: Add tests \u2190 Start this next\n- [ ] Subtask 4: Run tests\n\nStep 1: Complete Subtask 1 \u2192 Update file \u2192 Mark [x]\nStep 2: Complete Subtask 2 \u2192 Update file \u2192 Mark [x]\nStep 3: Now work on Subtask 3...\n```\n\n**Wrong approach (causes data loss on interruption):**\n- Complete Subtask 1, 2, 3 (no file updates)\n- Then update all at once\n- If interrupted, all progress is lost!\n\n# Workflow\n1. Understand the problem deeply. Carefully read the issue and think critically about what is required.\n2. Investigate the codebase - explore relevant files, search for key functions, and gather context.\n3. Develop a clear, step-by-step plan and display it as a todo list.\n4. Implement the fix incrementally with small, testable changes.\n5. Test frequently - run tests after each change to verify correctness.\n6. Iterate until all tests pass and the solution is robust.\n7. Reflect and validate comprehensively.\n\n## Making Code Changes\n- Make small, focused changes.\n- Test after each change.\n- Fix any issues that arise.\n- Continue until all tests pass.\n\n## Testing\n- Run existing tests if available.\n- Create test cases for edge cases.\n- Verify your solution works correctly.\n- Test boundary conditions.\n\nRemember: Keep working until the problem is completely solved and verified.";
1
+ export declare const PROMPT_BEAST = "You are AcmeCode, an AI assistant - please keep working until the user's query is completely resolved.\n\nYour thinking should be thorough and so it's fine if it's very long. However, avoid unnecessary repetition and verbosity. You should be concise, but thorough.\n\nYou MUST iterate and keep going until the problem is solved.\n\nYou have everything you need to resolve this problem. I want you to fully solve this autonomously.\n\nOnly end your turn when you are sure that the problem is solved and all items have been checked off. Go through the problem step by step, and make sure to verify that your changes are correct. NEVER end your turn without having truly solved the problem.\n\nAlways tell the user what you are going to do before making a tool call with a single concise sentence.\n\nIf the user request is \"resume\" or \"continue\", check the previous conversation history to see what the next incomplete step is. Continue from that step, and do not hand back control to the user until the entire task is complete.\n\nTake your time and think through every step - remember to check your solution rigorously and watch out for boundary cases. Your solution must be perfect. If not, continue working on it. At the end, you must test your code rigorously using the tools provided to catch all edge cases.\n\nYou MUST plan extensively before each function call, and reflect extensively on the outcomes of the previous function calls.\n\nYou MUST keep working until the problem is completely solved. When you say \"Next I will do X\" or \"Now I will do Y\", you MUST actually do it.\n\nYou are a highly capable AI assistant, and you can solve this problem without needing to ask the user for further input.\n\n# Critical: Per-Step Task File Updates\n\n**This is critical for recovery from interruptions:**\n\n1. **Update the task file immediately after completing each subtask** - Do NOT batch multiple subtasks before updating.\n2. **Each subtask must update the task file** - Mark it as completed with [x] before moving to the next subtask.\n3. **Never complete multiple subtasks without updating** - If you complete 3 subtasks without updating the task file, you will lose progress if interrupted.\n4. **Update order matters**: \n - Complete the subtask (e.g., write code, run command)\n - **IMMEDIATELY** update the task file to mark it as [x] completed\n - Then move to the next subtask\n5. **On resume/restart**: Read the task file first to see which subtasks are marked [x], then continue from the first incomplete subtask.\n\n**Example of correct behavior:**\n```\n## Task: Implement Feature X\n- [x] Subtask 1: Read existing code \u2190 Completed and marked\n- [x] Subtask 2: Write new function \u2190 Completed and marked \n- [ ] Subtask 3: Add tests \u2190 Start this next\n- [ ] Subtask 4: Run tests\n\nStep 1: Complete Subtask 1 \u2192 Update file \u2192 Mark [x]\nStep 2: Complete Subtask 2 \u2192 Update file \u2192 Mark [x]\nStep 3: Now work on Subtask 3...\n```\n\n**Wrong approach (causes data loss on interruption):**\n- Complete Subtask 1, 2, 3 (no file updates)\n- Then update all at once\n- If interrupted, all progress is lost!\n\n# Workflow\n1. Understand the problem deeply. Carefully read the issue and think critically about what is required.\n2. Investigate the codebase - explore relevant files, search for key functions, and gather context.\n3. Develop a clear, step-by-step plan and display it as a todo list.\n4. Implement the fix incrementally with small, testable changes.\n5. Test frequently - run tests after each change to verify correctness.\n6. Iterate until all tests pass and the solution is robust.\n7. Reflect and validate comprehensively.\n\n## Making Code Changes\n- Make small, focused changes.\n- Test after each change.\n- Fix any issues that arise.\n- Continue until all tests pass.\n\n## Testing\n- Run existing tests if available.\n- Create test cases for edge cases.\n- Verify your solution works correctly.\n- Test boundary conditions.\n\n# Task Completion Signal\n\n**When your task is complete, you MUST output [TASK_COMPLETE] at the end of your response.**\n\nThis signal tells the system that you have finished the task and should not continue generating. Do not output this signal until all work is truly done.\n\nRemember: Keep working until the problem is completely solved and verified.";
@@ -72,4 +72,10 @@ Step 3: Now work on Subtask 3...
72
72
  - Verify your solution works correctly.
73
73
  - Test boundary conditions.
74
74
 
75
+ # Task Completion Signal
76
+
77
+ **When your task is complete, you MUST output [TASK_COMPLETE] at the end of your response.**
78
+
79
+ This signal tells the system that you have finished the task and should not continue generating. Do not output this signal until all work is truly done.
80
+
75
81
  Remember: Keep working until the problem is completely solved and verified.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acmecloud/core",
3
- "version": "1.0.12",
3
+ "version": "1.0.15",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -38,7 +38,7 @@ export type AgentEvent =
38
38
  | { type: "mode-changed"; mode: AgentMode; planFile?: string };
39
39
 
40
40
  // ── Configuration ──
41
- const MAX_STEPS = 80;
41
+ const MAX_STEPS = 300;
42
42
  const MAX_OUTPUT_LENGTH = 30000;
43
43
  const MAX_RETRIES = 2;
44
44
 
@@ -552,9 +552,25 @@ export async function* runAgent(
552
552
  }
553
553
  }
554
554
 
555
- // Model returned text but no tool calls
556
- // This is normal - the model might be providing explanation or asking for clarification
557
- // Add the response to history and continue the loop to let model continue working
555
+ // Model returned text but no tool calls - check for completion signal
556
+ // The model should output [TASK_COMPLETE] when done
557
+ if (
558
+ stepText.includes("[TASK_COMPLETE]") ||
559
+ stepText.includes("<TASK_COMPLETE>")
560
+ ) {
561
+ // Task is complete - return with the final response (remove the signal from output)
562
+ const cleanText = stepText
563
+ .replace(/\[TASK_COMPLETE\]|<TASK_COMPLETE>/g, "")
564
+ .trim();
565
+ currentMessages.push({
566
+ role: "assistant",
567
+ content: cleanText || stepText,
568
+ });
569
+ yield { type: "messages", messages: currentMessages };
570
+ return [];
571
+ }
572
+
573
+ // Task not complete yet - continue working
558
574
  currentMessages.push({ role: "assistant", content: stepText });
559
575
 
560
576
  // Add a system prompt to encourage the model to continue if task is not complete
@@ -610,7 +626,12 @@ export async function* runAgent(
610
626
  };
611
627
  }
612
628
 
613
- yield { type: "text", text: "\n[Reached maximum steps]\n" };
629
+ // Reached maximum steps - prompt user to continue in new session
630
+ yield { type: "text", text: `\n[Reached maximum steps (${MAX_STEPS})]\n\n` };
631
+ yield {
632
+ type: "text",
633
+ text: `The conversation has reached the step limit. To continue working on this task, please start a new session. Your progress has been saved.`,
634
+ };
614
635
  yield { type: "messages", messages: currentMessages };
615
636
  return [];
616
637
  }
@@ -72,4 +72,10 @@ Step 3: Now work on Subtask 3...
72
72
  - Verify your solution works correctly.
73
73
  - Test boundary conditions.
74
74
 
75
+ # Task Completion Signal
76
+
77
+ **When your task is complete, you MUST output [TASK_COMPLETE] at the end of your response.**
78
+
79
+ This signal tells the system that you have finished the task and should not continue generating. Do not output this signal until all work is truly done.
80
+
75
81
  Remember: Keep working until the problem is completely solved and verified.`;