@aexol/spectral 0.6.0 → 0.6.1

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.
@@ -839,14 +839,23 @@ export class SessionStreamManager {
839
839
  const parts = [];
840
840
  if (stream.loopGoal) {
841
841
  parts.push(`[GOAL]: ${stream.loopGoal}`);
842
- parts.push("");
843
842
  }
844
843
  parts.push(stream.loopOriginalPrompt);
845
- if (stream.loopGoal) {
846
- parts.push("");
847
- parts.push("After completing your work, evaluate whether the goal has been FULLY achieved. " +
848
- 'Include <LOOP_DONE> in your response ONLY if you are confident the goal is completely met.');
849
- }
844
+ parts.push("");
845
+ parts.push("--- LOOP INSTRUCTIONS ---\n" +
846
+ "You are running in an iterative loop. Each iteration you see your previous changes\n" +
847
+ "and can improve them further.\n" +
848
+ (stream.loopGoal
849
+ ? "The [GOAL] above defines what you need to achieve.\n"
850
+ : "\n") +
851
+ "CRITICAL: After EVERY response you MUST self-evaluate:\n" +
852
+ "- If the task IS FULLY COMPLETE (nothing meaningful left to do), " +
853
+ "respond with <LOOP_DONE> as the VERY FIRST text in your reply,\n" +
854
+ " followed by a brief summary of what was accomplished.\n" +
855
+ "- If more work remains, continue working WITHOUT <LOOP_DONE>.\n" +
856
+ "- <LOOP_DONE> is the ONLY way to stop the loop. If you do not emit it,\n" +
857
+ " you WILL be prompted again to keep working.\n" +
858
+ "Be decisive: if the task is done, stop. Do not keep polishing.");
850
859
  return parts.join("\n");
851
860
  }
852
861
  async sendNextLoopIteration(stream) {
@@ -1090,7 +1099,10 @@ export class SessionStreamManager {
1090
1099
  // iteratively improves the solution.
1091
1100
  if (stream.loopActive && stream.loopOriginalPrompt) {
1092
1101
  const finishedAssistantText = finishedTurn?.assistantText ?? "";
1093
- if (finishedAssistantText.includes(LOOP_DONE_MARKER)) {
1102
+ // Check for the loop-done marker in the first portion of the
1103
+ // response (the prompt instructs the agent to emit it first).
1104
+ const head = finishedAssistantText.slice(0, 500);
1105
+ if (head.includes(LOOP_DONE_MARKER)) {
1094
1106
  console.log(`[loop] completion marker detected after ${stream.loopIterationCount} iteration(s), stopping`);
1095
1107
  const completedIterations = stream.loopIterationCount;
1096
1108
  stream.loopActive = false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aexol/spectral",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Always-on coding agent for Aexol — branded pi wrapper with relay-based browser access.",
5
5
  "type": "module",
6
6
  "private": false,