fluxflow-cli 3.4.7 → 3.4.9

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 = [];
@@ -11256,6 +11261,8 @@ var init_ai = __esm({
11256
11261
  const isNemotron = model.includes("nemotron");
11257
11262
  const isLlama3 = model.includes("llama-3");
11258
11263
  const isBytedance = model.includes("seed");
11264
+ const isPoolside = model.includes("poolside");
11265
+ const isThinkingmachines = model.includes("thinkingmachines");
11259
11266
  const GPT_THINKING_LEVELS = {
11260
11267
  "Fast": "low",
11261
11268
  "Low": "low",
@@ -11282,7 +11289,7 @@ var init_ai = __esm({
11282
11289
  temperature,
11283
11290
  ...isGPT && { thinking: GPT_THINKING_LEVELS[thinkingLevel] || "high" }
11284
11291
  };
11285
- if (isLlama3) {
11292
+ if (isLlama3 || isThinkingmachines) {
11286
11293
  } else if (isKimi) {
11287
11294
  body.chat_template_kwargs = { thinking: isThinking };
11288
11295
  } else if (isGemma) {
@@ -11318,6 +11325,8 @@ var init_ai = __esm({
11318
11325
  thinking_budget: parseInt(BYTEDANCE_THINKING_LEVELS[apiLevel] ?? "4096")
11319
11326
  };
11320
11327
  }
11328
+ } else if (isPoolside) {
11329
+ body.chat_template_kwargs = { enable_thinking: isThinking };
11321
11330
  }
11322
11331
  let attempts = 0;
11323
11332
  const maxAttempts = 6;
@@ -13133,9 +13142,8 @@ ${ideCtx.warnings}
13133
13142
  const maxLen = Math.max(...boxLines.map((l) => l.length));
13134
13143
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
13135
13144
  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" : "")) };
13145
+ yield { type: "visual_feedback", content: colorMainWords(`${boxMid}
13146
+ `) };
13139
13147
  continue;
13140
13148
  }
13141
13149
  const finalStart = startLine !== null ? startLine : 1;
@@ -13179,7 +13187,7 @@ ${ideCtx.warnings}
13179
13187
  totalLines = content.split("\n").length;
13180
13188
  } catch (e) {
13181
13189
  }
13182
- label = `\u2714 Auto-Read: ${filePath} \u2192 Lines ${finalStart} - ${Math.min(finalEnd, totalLines)} of ${totalLines}`;
13190
+ label = `\u2714 Auto-Read: ${filePath}`;
13183
13191
  taggedContextBlocks.push(textResult);
13184
13192
  }
13185
13193
  if (label) {
@@ -13191,9 +13199,8 @@ ${ideCtx.warnings}
13191
13199
  const maxLen = Math.max(...boxLines.map((l) => l.length));
13192
13200
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
13193
13201
  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" : "")) };
13202
+ yield { type: "visual_feedback", content: colorMainWords(`${boxMid}
13203
+ `) };
13197
13204
  }
13198
13205
  }
13199
13206
  }
@@ -13292,6 +13299,7 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
13292
13299
  let dedupeBuffer = "";
13293
13300
  let isDedupeActive = false;
13294
13301
  let detectedAnyToolCalls = false;
13302
+ let thisIsFirstToolFeedback = true;
13295
13303
  let targetModel = modelName;
13296
13304
  let currentSystemInstruction = "";
13297
13305
  while (retryCount <= MAX_RETRIES && inStreamRetryCount <= MAX_RETRIES && !success && !TERMINATION_SIGNAL) {
@@ -13303,7 +13311,6 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
13303
13311
  process.stdout.write(`\x1B]0;Working...\x07`);
13304
13312
  }
13305
13313
  yield { type: "turn_reset", content: true };
13306
- yield { type: "spinner", content: true };
13307
13314
  isInitialAttempt = false;
13308
13315
  if (inStreamRetryCount === 1) {
13309
13316
  accumulatedContext = "";
@@ -14296,9 +14303,9 @@ ${ideErr} [/ERROR]`;
14296
14303
  }
14297
14304
  const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
14298
14305
  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}`) };
14306
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14307
+ `) };
14308
+ thisIsFirstToolFeedback = false;
14302
14309
  }
14303
14310
  toolResults.push({ role: "user", text: `[TOOL RESULT]: ERROR: ${denyMsg}` });
14304
14311
  yield { type: "tool_result", content: `[TOOL RESULT]: ERROR: ${denyMsg}` };
@@ -14520,9 +14527,9 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
14520
14527
  }
14521
14528
  const boxWidth = Math.min(errorLabel.length + 4, terminalWidth);
14522
14529
  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}}`) };
14530
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14531
+ `) };
14532
+ thisIsFirstToolFeedback = false;
14526
14533
  toolResults.push({ role: "user", text: errorMsg });
14527
14534
  await incrementUsage("toolFailure");
14528
14535
  if (settings.onToolResult) settings.onToolResult("failure", normToolName);
@@ -14672,9 +14679,9 @@ ${snippet2}
14672
14679
  }
14673
14680
  const boxWidth = Math.min(feedbackLabel.length + 4, terminalWidth);
14674
14681
  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" : "")) };
14682
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14683
+ `) };
14684
+ thisIsFirstToolFeedback = false;
14678
14685
  const toolEnd2 = Date.now();
14679
14686
  lastToolFinishedAt = toolEnd2;
14680
14687
  yield { type: "tool_time", content: toolEnd2 - executionStart };
@@ -14708,8 +14715,9 @@ ${snippet2}
14708
14715
  const boxWidth = Math.min(deniedLabel.length + 4, terminalWidth);
14709
14716
  const boxMid = `${deniedLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14710
14717
  const boxBottom = ` ${" ".repeat(boxWidth)} `;
14711
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14712
- ${boxMid}`) };
14718
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14719
+ `) };
14720
+ thisIsFirstToolFeedback = false;
14713
14721
  }
14714
14722
  if (normToolName === "exec_command") {
14715
14723
  await new Promise((resolve) => setTimeout(resolve, 50));
@@ -14733,22 +14741,15 @@ ${boxMid}`) };
14733
14741
  }
14734
14742
  const boxWidth = Math.min(label.length + 4, terminalWidth);
14735
14743
  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
- };
14744
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}${label.includes("\u2714") && (label.includes("Created") || label.includes("Edited")) ? "" : "\n"}`) };
14745
+ thisIsFirstToolFeedback = false;
14744
14746
  }
14745
14747
  if (lastToolFinishedAt > 0) {
14746
14748
  const timeSinceLastTool = Date.now() - lastToolFinishedAt;
14747
- if (timeSinceLastTool < 1e3) {
14749
+ if (timeSinceLastTool < 1500) {
14748
14750
  await new Promise((resolve) => setTimeout(resolve, 1e3 - timeSinceLastTool));
14749
14751
  }
14750
14752
  }
14751
- yield { type: "spinner", content: false };
14752
14753
  let execToolContext = {
14753
14754
  chatId,
14754
14755
  history,
@@ -14780,7 +14781,6 @@ ${boxMid}`) };
14780
14781
  }
14781
14782
  currentTurnTools.push(normToolName);
14782
14783
  let result = await dispatchTool(normToolName, toolCall.args, execToolContext);
14783
- yield { type: "spinner", content: true };
14784
14784
  if ((normToolName === "write_file" || normToolName === "update_file") && result.startsWith("SUCCESS")) {
14785
14785
  const { path: filePath } = parseArgs(toolCall.args);
14786
14786
  if (filePath) {
@@ -14816,9 +14816,9 @@ ${boxMid}`) };
14816
14816
  }
14817
14817
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14818
14818
  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" : "")) };
14819
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14820
+ `) };
14821
+ thisIsFirstToolFeedback = false;
14822
14822
  }
14823
14823
  if (normToolName === "EmergencyRollback") {
14824
14824
  const { method } = parseArgs(toolCall.args);
@@ -14836,9 +14836,9 @@ ${boxMid}`) };
14836
14836
  }
14837
14837
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14838
14838
  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" : "")) };
14839
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
14840
+ `) };
14841
+ thisIsFirstToolFeedback = false;
14842
14842
  }
14843
14843
  }
14844
14844
  if (normToolName === "todo") {
@@ -14890,9 +14890,9 @@ ${boxMid}`) };
14890
14890
  ...listItems.map((item) => ` ${item}`)
14891
14891
  // Sub-indented items for that premium look
14892
14892
  ].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" : "")) };
14893
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${output}
14894
+ `) };
14895
+ thisIsFirstToolFeedback = false;
14896
14896
  }
14897
14897
  }
14898
14898
  if (normToolName === "exec_command" && settings.onExecEnd) {
@@ -15209,7 +15209,10 @@ Error Log can be found in ${path22.join(LOGS_DIR, "agent", "error.log")}`);
15209
15209
  `, "").replace(`[SYSTEM] USER QUESTION. RESOLVE THIS SPECIFIC QUERY WITHIN '[ANSWER] ... [/ANSWER]' CONCISELY, NATURALLY
15210
15210
  **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
15211
15211
  `, "").replace(`[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
15212
- `, "");
15212
+ `, "").replaceAll(
15213
+ /\n\[SYSTEM\] WARNING, Turn Limit Impending: Step \d+\/\d+\. Wrap up quickly\/prompt user to continue & use \[\[END\]\] quickly\. \[\/SYSTEM\]/g,
15214
+ ""
15215
+ );
15213
15216
  if (modelName && modelName.toLowerCase().startsWith("gemma") && aiProvider === "Google" && msg.text.startsWith("[TOOL RESULT]")) {
15214
15217
  const jitInstructionFast = `
15215
15218
  [SYSTEM] Tool result received. Analyze output and proceed with your turn [/SYSTEM]`;