fluxflow-cli 3.4.7 → 3.4.8

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/dist/fluxflow.js CHANGED
@@ -2843,6 +2843,11 @@ var init_text = __esm({
2843
2843
  active: []
2844
2844
  };
2845
2845
  }
2846
+ if (!text && !msg.isStreaming) {
2847
+ const emptyResult = { completed: [], active: [] };
2848
+ blocksCache.set(cacheKey, emptyResult);
2849
+ return emptyResult;
2850
+ }
2846
2851
  const completedBlocks = [];
2847
2852
  let activeBlock = null;
2848
2853
  let pendingChunk = [];
@@ -13133,9 +13138,8 @@ ${ideCtx.warnings}
13133
13138
  const maxLen = Math.max(...boxLines.map((l) => l.length));
13134
13139
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
13135
13140
  const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
13136
- const isFirst = tIdx === 0;
13137
- const isLast = tIdx === tagsFound.length - 1;
13138
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
13141
+ yield { type: "visual_feedback", content: colorMainWords(`${boxMid}
13142
+ `) };
13139
13143
  continue;
13140
13144
  }
13141
13145
  const finalStart = startLine !== null ? startLine : 1;
@@ -13179,7 +13183,7 @@ ${ideCtx.warnings}
13179
13183
  totalLines = content.split("\n").length;
13180
13184
  } catch (e) {
13181
13185
  }
13182
- label = `\u2714 Auto-Read: ${filePath} \u2192 Lines ${finalStart} - ${Math.min(finalEnd, totalLines)} of ${totalLines}`;
13186
+ label = `\u2714 Auto-Read: ${filePath}`;
13183
13187
  taggedContextBlocks.push(textResult);
13184
13188
  }
13185
13189
  if (label) {
@@ -13191,9 +13195,8 @@ ${ideCtx.warnings}
13191
13195
  const maxLen = Math.max(...boxLines.map((l) => l.length));
13192
13196
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
13193
13197
  const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
13194
- const isFirst = tIdx === 0;
13195
- const isLast = tIdx === tagsFound.length - 1;
13196
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
13198
+ yield { type: "visual_feedback", content: colorMainWords(`${boxMid}
13199
+ `) };
13197
13200
  }
13198
13201
  }
13199
13202
  }
@@ -13292,6 +13295,7 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
13292
13295
  let dedupeBuffer = "";
13293
13296
  let isDedupeActive = false;
13294
13297
  let detectedAnyToolCalls = false;
13298
+ let thisIsFirstToolFeedback = true;
13295
13299
  let targetModel = modelName;
13296
13300
  let currentSystemInstruction = "";
13297
13301
  while (retryCount <= MAX_RETRIES && inStreamRetryCount <= MAX_RETRIES && !success && !TERMINATION_SIGNAL) {
@@ -13303,7 +13307,6 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
13303
13307
  process.stdout.write(`\x1B]0;Working...\x07`);
13304
13308
  }
13305
13309
  yield { type: "turn_reset", content: true };
13306
- yield { type: "spinner", content: true };
13307
13310
  isInitialAttempt = false;
13308
13311
  if (inStreamRetryCount === 1) {
13309
13312
  accumulatedContext = "";
@@ -14296,9 +14299,9 @@ ${ideErr} [/ERROR]`;
14296
14299
  }
14297
14300
  const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
14298
14301
  const boxMid = `${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14299
- const boxBottom = ` ${" ".repeat(boxWidth)} `;
14300
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14301
- ${boxMid}`) };
14302
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14303
+ `) };
14304
+ thisIsFirstToolFeedback = false;
14302
14305
  }
14303
14306
  toolResults.push({ role: "user", text: `[TOOL RESULT]: ERROR: ${denyMsg}` });
14304
14307
  yield { type: "tool_result", content: `[TOOL RESULT]: ERROR: ${denyMsg}` };
@@ -14520,9 +14523,9 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
14520
14523
  }
14521
14524
  const boxWidth = Math.min(errorLabel.length + 4, terminalWidth);
14522
14525
  const boxMid = `${errorLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14523
- const boxBottom = ` ${" ".repeat(boxWidth)} `;
14524
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14525
- ${boxMid}}`) };
14526
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14527
+ `) };
14528
+ thisIsFirstToolFeedback = false;
14526
14529
  toolResults.push({ role: "user", text: errorMsg });
14527
14530
  await incrementUsage("toolFailure");
14528
14531
  if (settings.onToolResult) settings.onToolResult("failure", normToolName);
@@ -14672,9 +14675,9 @@ ${snippet2}
14672
14675
  }
14673
14676
  const boxWidth = Math.min(feedbackLabel.length + 4, terminalWidth);
14674
14677
  const boxMid = `${feedbackLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14675
- const isFirst = toolCallPointer === 0;
14676
- const isLast = toolCallPointer === allToolsFound.length - 1;
14677
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14678
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14679
+ `) };
14680
+ thisIsFirstToolFeedback = false;
14678
14681
  const toolEnd2 = Date.now();
14679
14682
  lastToolFinishedAt = toolEnd2;
14680
14683
  yield { type: "tool_time", content: toolEnd2 - executionStart };
@@ -14708,8 +14711,9 @@ ${snippet2}
14708
14711
  const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
14709
14712
  const boxMid = `${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14710
14713
  const boxBottom = ` ${" ".repeat(boxWidth)} `;
14711
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14712
- ${boxMid}`) };
14714
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14715
+ `) };
14716
+ thisIsFirstToolFeedback = false;
14713
14717
  }
14714
14718
  if (normToolName === "exec_command") {
14715
14719
  await new Promise((resolve) => setTimeout(resolve, 50));
@@ -14733,22 +14737,15 @@ ${boxMid}`) };
14733
14737
  }
14734
14738
  const boxWidth = Math.min(label.length + 4, terminalWidth);
14735
14739
  const boxMid = `${label.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14736
- const isFirst = toolCallPointer === 0;
14737
- const isLast = toolCallPointer === allToolsFound.length - 1;
14738
- yield {
14739
- type: "visual_feedback",
14740
- content: colorMainWords(
14741
- (isFirst ? "\n" : "") + boxMid + (isLast && !/(Created|Edited)/.test(boxMid) ? "\n" : "")
14742
- )
14743
- };
14740
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}${label.includes("\u2714") && (label.includes("Created") || label.includes("Edited")) ? "" : "\n"}`) };
14741
+ thisIsFirstToolFeedback = false;
14744
14742
  }
14745
14743
  if (lastToolFinishedAt > 0) {
14746
14744
  const timeSinceLastTool = Date.now() - lastToolFinishedAt;
14747
- if (timeSinceLastTool < 1e3) {
14745
+ if (timeSinceLastTool < 1500) {
14748
14746
  await new Promise((resolve) => setTimeout(resolve, 1e3 - timeSinceLastTool));
14749
14747
  }
14750
14748
  }
14751
- yield { type: "spinner", content: false };
14752
14749
  let execToolContext = {
14753
14750
  chatId,
14754
14751
  history,
@@ -14780,7 +14777,6 @@ ${boxMid}`) };
14780
14777
  }
14781
14778
  currentTurnTools.push(normToolName);
14782
14779
  let result = await dispatchTool(normToolName, toolCall.args, execToolContext);
14783
- yield { type: "spinner", content: true };
14784
14780
  if ((normToolName === "write_file" || normToolName === "update_file") && result.startsWith("SUCCESS")) {
14785
14781
  const { path: filePath } = parseArgs(toolCall.args);
14786
14782
  if (filePath) {
@@ -14816,9 +14812,9 @@ ${boxMid}`) };
14816
14812
  }
14817
14813
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14818
14814
  const boxMid = `${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14819
- const isFirst = toolCallPointer === 0;
14820
- const isLast = toolCallPointer === allToolsFound.length - 1;
14821
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14815
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14816
+ `) };
14817
+ thisIsFirstToolFeedback = false;
14822
14818
  }
14823
14819
  if (normToolName === "EmergencyRollback") {
14824
14820
  const { method } = parseArgs(toolCall.args);
@@ -14836,9 +14832,9 @@ ${boxMid}`) };
14836
14832
  }
14837
14833
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14838
14834
  const boxMid = `${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14839
- const isFirst = toolCallPointer === 0;
14840
- const isLast = toolCallPointer === allToolsFound.length - 1;
14841
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14835
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14836
+ `) };
14837
+ thisIsFirstToolFeedback = false;
14842
14838
  }
14843
14839
  }
14844
14840
  if (normToolName === "todo") {
@@ -14890,9 +14886,9 @@ ${boxMid}`) };
14890
14886
  ...listItems.map((item) => ` ${item}`)
14891
14887
  // Sub-indented items for that premium look
14892
14888
  ].join("\n");
14893
- const isFirst = toolCallPointer === 0;
14894
- const isLast = toolCallPointer === allToolsFound.length - 1;
14895
- yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + output + (isLast ? "\n" : "")) };
14889
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${output}
14890
+ `) };
14891
+ thisIsFirstToolFeedback = false;
14896
14892
  }
14897
14893
  }
14898
14894
  if (normToolName === "exec_command" && settings.onExecEnd) {
@@ -15209,7 +15205,10 @@ Error Log can be found in ${path22.join(LOGS_DIR, "agent", "error.log")}`);
15209
15205
  `, "").replace(`[SYSTEM] USER QUESTION. RESOLVE THIS SPECIFIC QUERY WITHIN '[ANSWER] ... [/ANSWER]' CONCISELY, NATURALLY
15210
15206
  **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
15211
15207
  `, "").replace(`[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
15212
- `, "");
15208
+ `, "").replaceAll(
15209
+ /\n\[SYSTEM\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/SYSTEM\]/g,
15210
+ ""
15211
+ );
15213
15212
  if (modelName && modelName.toLowerCase().startsWith("gemma") && aiProvider === "Google" && msg.text.startsWith("[TOOL RESULT]")) {
15214
15213
  const jitInstructionFast = `
15215
15214
  [SYSTEM] Tool result received. Analyze output and proceed with your turn [/SYSTEM]`;