fluxflow-cli 3.3.3 → 3.3.5

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.
Files changed (2) hide show
  1. package/dist/fluxflow.js +189 -67
  2. package/package.json +2 -2
package/dist/fluxflow.js CHANGED
@@ -4410,7 +4410,7 @@ var init_ChatLayout = __esm({
4410
4410
  {
4411
4411
  flexDirection: "column",
4412
4412
  borderStyle: "single",
4413
- borderLeft: true,
4413
+ borderLeft: false,
4414
4414
  borderRight: false,
4415
4415
  borderTop: false,
4416
4416
  borderBottom: false,
@@ -4449,7 +4449,7 @@ var init_ChatLayout = __esm({
4449
4449
  paddingRight: 0,
4450
4450
  width: "100%"
4451
4451
  },
4452
- /* @__PURE__ */ React4.createElement(Box3, { marginBottom: 1 }, /* @__PURE__ */ React4.createElement(Text4, { color: "gray", bold: true }, "\u25B6_ ", lang.toUpperCase() || "CODE")),
4452
+ /* @__PURE__ */ React4.createElement(Box3, null, /* @__PURE__ */ React4.createElement(Text4, { color: "gray", bold: true }, "\u25B6_ ", lang.toUpperCase() || "CODE")),
4453
4453
  /* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", width: "100%" }, codeLines.map((line, idx) => /* @__PURE__ */ React4.createElement(Box3, { key: idx, width: "100%" }, /* @__PURE__ */ React4.createElement(Box3, { width: gutterWidth + 2, flexShrink: 0 }, /* @__PURE__ */ React4.createElement(Text4, { color: "gray" }, String(idx + 1).padStart(gutterWidth, " "), " ")), /* @__PURE__ */ React4.createElement(Box3, { flexGrow: 1 }, renderHighlightedLine(line, lang, "#e1e4e8")))))
4454
4454
  );
4455
4455
  }
@@ -4618,6 +4618,9 @@ var init_ChatLayout = __esm({
4618
4618
  }
4619
4619
  return msg.isStreaming ? content : content.trimEnd();
4620
4620
  }, [content, msg.role, showFullThinking, msg.isStreaming]);
4621
+ if (msg.role === "agent" && finalContent.trim() === "") {
4622
+ return null;
4623
+ }
4621
4624
  return (
4622
4625
  // [SPACE POINT]
4623
4626
  /* @__PURE__ */ React4.createElement(Box3, { marginBottom: msg.role === "think" ? 0 : msg.role === "user" ? 0 : msg.role === "agent" ? 0 : 0, marginTop: msg.role === "think" ? 0 : msg.role === "user" ? 0 : msg.role === "agent" ? 0 : 0, flexDirection: "column", flexShrink: 0, width: "100%", flexGrow: 1 }, msg.role === "user" ? /* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", width: columns - 1 }, /* @__PURE__ */ React4.createElement(Box3, { width: columns - 1, height: 1, overflow: "hidden" }, /* @__PURE__ */ React4.createElement(Text4, { color: "#444444" }, "\u2584".repeat(Math.max(1, columns - 1)))), /* @__PURE__ */ React4.createElement(
@@ -4693,7 +4696,7 @@ var init_ChatLayout = __esm({
4693
4696
  }
4694
4697
  if (type === "agent-line") {
4695
4698
  if (!text || text.trim() === "") {
4696
- return /* @__PURE__ */ React4.createElement(Box3, { height: 1 });
4699
+ return null;
4697
4700
  }
4698
4701
  const animatedText = useStreamingText(text, isStreamingMsg, block.isActiveBlock);
4699
4702
  return /* @__PURE__ */ React4.createElement(Box3, { flexDirection: "column", paddingX: 1, width: "100%" }, /* @__PURE__ */ React4.createElement(CodeRenderer, { text: animatedText, columns }));
@@ -4775,7 +4778,7 @@ var init_ChatLayout = __esm({
4775
4778
  flexDirection: "row",
4776
4779
  width: columns,
4777
4780
  borderStyle: "single",
4778
- borderLeft: true,
4781
+ borderLeft: false,
4779
4782
  borderRight: false,
4780
4783
  borderTop: false,
4781
4784
  borderBottom: false,
@@ -4794,7 +4797,7 @@ var init_ChatLayout = __esm({
4794
4797
  flexDirection: "row",
4795
4798
  width: columns,
4796
4799
  borderStyle: "single",
4797
- borderLeft: true,
4800
+ borderLeft: false,
4798
4801
  borderRight: false,
4799
4802
  borderTop: false,
4800
4803
  borderBottom: false,
@@ -6476,7 +6479,7 @@ var init_janitor_tools = __esm({
6476
6479
  Your tool syntax is: '[tool:functions.ToolName(args...)]'
6477
6480
 
6478
6481
  -- CHAT MANAGEMENT TOOLS (MUST CALL THESE 2 TOOLS ALWAYS) --
6479
- [tool:functions.Chat(title="<short creative title of FULL conversation in 3-5 words>")]. Consider full chat context to generate title NOT just latest message.
6482
+ [tool:functions.Chat(title="<short creative title of FULL conversation in 3 or 4 words>")]. Consider full chat context to generate title NOT just latest message.
6480
6483
  [tool:functions.Memory(action="temp", content="<summary of the user prompt & model responses ONLY FROM LATEST PROMPT UNDER 40 WORDS>. [Talked on: <date> <hour>]")]. Time format: YYYY-MM-DD HH am/pm
6481
6484
 
6482
6485
  ${isMemoryEnabled ? `-- User-specific long-term/permanent memory (USE BASED ON CONVERSATION CONTEXT, DO NOT RE-SAVE MEMORY WHICH IS ALREADY SAVED) --
@@ -10828,21 +10831,78 @@ var init_ai = __esm({
10828
10831
  return MULTIMODAL_MODELS.some((m) => m.toLowerCase() === lower);
10829
10832
  };
10830
10833
  getCleanGroupedLength = (rawHistory) => {
10831
- const cleanHistory = [];
10832
- rawHistory.forEach((m) => {
10833
- const isCleanMsg = (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome");
10834
- if (!isCleanMsg) return;
10834
+ const preprocessed = rawHistory.filter(
10835
+ (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
10836
+ ).map((m, idx, arr) => {
10835
10837
  let text = m.fullText || m.text || "";
10836
- if (m.role === "system" && text?.startsWith("[TOOL RESULT]")) {
10837
- const prev = cleanHistory[cleanHistory.length - 1];
10838
- if (prev && prev.role === "system" && prev.text?.startsWith("[TOOL RESULT]")) {
10839
- prev.text += "\n\n" + text;
10840
- return;
10838
+ if (m.role === "user" && idx < arr.length - 1) {
10839
+ if (text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")) {
10840
+ const summaryIndex = text.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");
10841
+ if (summaryIndex !== -1) {
10842
+ const prefix = text.substring(0, summaryIndex);
10843
+ const metadataIndex = prefix.lastIndexOf("[SYSTEM METADATA]");
10844
+ if (metadataIndex !== -1) {
10845
+ text = text.substring(metadataIndex).trim();
10846
+ } else {
10847
+ text = text.substring(summaryIndex).trim();
10848
+ }
10849
+ }
10850
+ } else {
10851
+ const userIndex = text.lastIndexOf("[USER]");
10852
+ const userPromptIndex = text.lastIndexOf("[USER PROMPT]");
10853
+ if (userIndex !== -1) {
10854
+ text = text.substring(userIndex + 6).trim();
10855
+ } else if (userPromptIndex !== -1) {
10856
+ text = text.substring(userPromptIndex).trim();
10857
+ }
10841
10858
  }
10842
10859
  }
10843
- cleanHistory.push({ ...m, text });
10860
+ return { ...m, text };
10844
10861
  });
10845
- return cleanHistory.length;
10862
+ const cleanHistoryForAI = [];
10863
+ let i = 0;
10864
+ while (i < preprocessed.length) {
10865
+ const msg = preprocessed[i];
10866
+ if (msg.role === "user") {
10867
+ cleanHistoryForAI.push(msg);
10868
+ i++;
10869
+ } else {
10870
+ const turnMessages = [];
10871
+ while (i < preprocessed.length && preprocessed[i].role !== "user") {
10872
+ turnMessages.push(preprocessed[i]);
10873
+ i++;
10874
+ }
10875
+ const toolCalls = [];
10876
+ const toolResults = [];
10877
+ const finalResponses = [];
10878
+ turnMessages.forEach((tm) => {
10879
+ const textLower = (tm.text || "").toLowerCase();
10880
+ const hasTool = textLower.includes("tool:functions.") || textLower.includes("agent:generalist.");
10881
+ const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:") || tm.text?.startsWith("[TERMINAL_RECORD]") || tm.isTerminalRecord);
10882
+ if (tm.role === "agent") {
10883
+ if (hasTool) {
10884
+ toolCalls.push(tm.text);
10885
+ } else {
10886
+ finalResponses.push(tm.text);
10887
+ }
10888
+ } else if (isResult) {
10889
+ toolResults.push(tm.text);
10890
+ } else {
10891
+ finalResponses.push(tm.text);
10892
+ }
10893
+ });
10894
+ if (toolCalls.length > 0) {
10895
+ cleanHistoryForAI.push({ role: "agent", text: "combined" });
10896
+ }
10897
+ if (toolResults.length > 0) {
10898
+ cleanHistoryForAI.push({ role: "system", text: "combined" });
10899
+ }
10900
+ if (finalResponses.length > 0) {
10901
+ cleanHistoryForAI.push({ role: "agent", text: "combined" });
10902
+ }
10903
+ }
10904
+ }
10905
+ return cleanHistoryForAI.length;
10846
10906
  };
10847
10907
  stripAnsi2 = (str) => {
10848
10908
  if (typeof str !== "string") return str;
@@ -11765,8 +11825,17 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
11765
11825
  }
11766
11826
  }
11767
11827
  if (process.stdout.isTTY) {
11768
- process.stdout.write("\x1B]0;FluxFlow | Idle\x07");
11769
- process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07");
11828
+ try {
11829
+ const historyIndex = await loadHistory();
11830
+ const chatData = historyIndex[chatId];
11831
+ const chatName = chatData?.name || "";
11832
+ const title = chatName && !chatName.startsWith("flow-") && !chatName.startsWith("Session ") ? chatName : "FluxFlow | Idle";
11833
+ process.stdout.write(`\x1B]0;${title}\x07`);
11834
+ process.stdout.write(`\x1B]633;P;TerminalTitle=${title}\x07`);
11835
+ } catch (e) {
11836
+ process.stdout.write("\x1B]0;FluxFlow | Idle\x07");
11837
+ process.stdout.write("\x1B]633;P;TerminalTitle=FluxFlow | Idle\x07");
11838
+ }
11770
11839
  }
11771
11840
  };
11772
11841
  getActiveToolContext = (text) => {
@@ -12897,7 +12966,8 @@ ${ideCtx.warnings}
12897
12966
  }
12898
12967
  let taggedContextBlocks = [];
12899
12968
  let attachedBinaryPart = null;
12900
- for (const tag of tagsFound) {
12969
+ for (let tIdx = 0; tIdx < tagsFound.length; tIdx++) {
12970
+ const tag = tagsFound[tIdx];
12901
12971
  try {
12902
12972
  let tagClean = tag.trim().replace(/^["']|["']$/g, "");
12903
12973
  const lineRangeRegex = /[:#]L?(\d+)(?:-L?(\d+))?$/i;
@@ -12929,12 +12999,10 @@ ${ideCtx.warnings}
12929
12999
  const boxLines = [label];
12930
13000
  const maxLen = Math.max(...boxLines.map((l) => l.length));
12931
13001
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
12932
- const boxTop = `${" ".repeat(boxWidth)}`;
12933
13002
  const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
12934
- const boxBottom = `${" ".repeat(boxWidth)}`;
12935
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
12936
- ${boxMid}
12937
- `) };
13003
+ const isFirst = tIdx === 0;
13004
+ const isLast = tIdx === tagsFound.length - 1;
13005
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
12938
13006
  continue;
12939
13007
  }
12940
13008
  const finalStart = startLine !== null ? startLine : 1;
@@ -12990,10 +13058,9 @@ ${boxMid}
12990
13058
  const maxLen = Math.max(...boxLines.map((l) => l.length));
12991
13059
  const boxWidth = Math.min(maxLen + 4, terminalWidth);
12992
13060
  const boxMid = boxLines.map((line) => `${line.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`).join("\n");
12993
- const boxBottom = `${" ".repeat(boxWidth)}`;
12994
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
12995
- ${boxMid}
12996
- `) };
13061
+ const isFirst = tIdx === 0;
13062
+ const isLast = tIdx === tagsFound.length - 1;
13063
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
12997
13064
  }
12998
13065
  }
12999
13066
  }
@@ -13884,10 +13951,10 @@ ${ideErr} [/ERROR]`;
13884
13951
  const action = normToolName === "write_file" ? "Created" : "Edited";
13885
13952
  label = `\u2714 ${action}: ${parseArgs(toolCall.args).path || "..."}`;
13886
13953
  } else if (normToolName === "write_pdf") {
13887
- label = `\u2714 Created: ${parseArgs(toolCall.args).path || "..."}
13954
+ label = `\u2714 Generated: ${parseArgs(toolCall.args).path || "..."}
13888
13955
  `;
13889
13956
  } else if (normToolName === "write_docx") {
13890
- label = `\u2714 Created: ${parseArgs(toolCall.args).path || "..."}
13957
+ label = `\u2714 Generated: ${parseArgs(toolCall.args).path || "..."}
13891
13958
  `;
13892
13959
  } else if (normToolName === "file_map") {
13893
13960
  label = `\u2714 Indexed: ${parseArgs(toolCall.args).path || "..."}`;
@@ -14483,8 +14550,9 @@ ${snippet2}
14483
14550
  }
14484
14551
  const boxWidth = Math.min(feedbackLabel.length + 4, terminalWidth);
14485
14552
  const boxMid = `${feedbackLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14486
- yield { type: "visual_feedback", content: colorMainWords(`
14487
- ${boxMid}`) };
14553
+ const isFirst = toolCallPointer === 0;
14554
+ const isLast = toolCallPointer === allToolsFound.length - 1;
14555
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14488
14556
  const toolEnd2 = Date.now();
14489
14557
  lastToolFinishedAt = toolEnd2;
14490
14558
  yield { type: "tool_time", content: toolEnd2 - executionStart };
@@ -14543,10 +14611,14 @@ ${boxMid}`) };
14543
14611
  }
14544
14612
  const boxWidth = Math.min(label.length + 4, terminalWidth);
14545
14613
  const boxMid = `${label.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14546
- const boxBottom = ` ${" ".repeat(boxWidth)} `;
14547
- yield { type: "visual_feedback", content: colorMainWords(`
14548
- ${boxMid}${boxMid.includes("Created") || boxMid.includes("Edited") || boxMid.includes("Written") ? "" : `
14549
- ${boxBottom}`}`) };
14614
+ const isFirst = toolCallPointer === 0;
14615
+ const isLast = toolCallPointer === allToolsFound.length - 1;
14616
+ yield {
14617
+ type: "visual_feedback",
14618
+ content: colorMainWords(
14619
+ (isFirst ? "\n" : "") + boxMid + (isLast && !/(Created|Edited)/.test(boxMid) ? "\n" : "")
14620
+ )
14621
+ };
14550
14622
  }
14551
14623
  if (lastToolFinishedAt > 0) {
14552
14624
  const timeSinceLastTool = Date.now() - lastToolFinishedAt;
@@ -14622,10 +14694,9 @@ ${boxBottom}`}`) };
14622
14694
  }
14623
14695
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14624
14696
  const boxMid = `${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14625
- const boxBottom = ` ${" ".repeat(boxWidth)} `;
14626
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14627
- ${boxMid}
14628
- `) };
14697
+ const isFirst = toolCallPointer === 0;
14698
+ const isLast = toolCallPointer === allToolsFound.length - 1;
14699
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14629
14700
  }
14630
14701
  if (normToolName === "EmergencyRollback") {
14631
14702
  const { method } = parseArgs(toolCall.args);
@@ -14643,10 +14714,9 @@ ${boxMid}
14643
14714
  }
14644
14715
  const boxWidth = Math.min(postLabel.length + 4, terminalWidth);
14645
14716
  const boxMid = `${postLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
14646
- const boxBottom = ` ${" ".repeat(boxWidth)} `;
14647
- yield { type: "visual_feedback", content: colorMainWords(`${boxBottom}
14648
- ${boxMid}
14649
- `) };
14717
+ const isFirst = toolCallPointer === 0;
14718
+ const isLast = toolCallPointer === allToolsFound.length - 1;
14719
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + boxMid + (isLast ? "\n" : "")) };
14650
14720
  }
14651
14721
  }
14652
14722
  if (normToolName === "todo") {
@@ -14695,13 +14765,12 @@ ${boxMid}
14695
14765
  const output = [
14696
14766
  `${uiTitle}`,
14697
14767
  // Clean title with a slight indent aligned with other feedbacks
14698
- ...listItems.map((item) => ` ${item}`),
14768
+ ...listItems.map((item) => ` ${item}`)
14699
14769
  // Sub-indented items for that premium look
14700
- ""
14701
- // Bottom padding spacing
14702
14770
  ].join("\n");
14703
- yield { type: "visual_feedback", content: `
14704
- ${colorMainWords(output)}` };
14771
+ const isFirst = toolCallPointer === 0;
14772
+ const isLast = toolCallPointer === allToolsFound.length - 1;
14773
+ yield { type: "visual_feedback", content: colorMainWords((isFirst ? "\n" : "") + output + (isLast ? "\n" : "")) };
14705
14774
  }
14706
14775
  }
14707
14776
  if (normToolName === "exec_command" && settings.onExecEnd) {
@@ -15032,7 +15101,7 @@ Error Log can be found in ${path21.join(LOGS_DIR, "agent", "error.log")}`);
15032
15101
  const agentErrDir = path21.join(LOGS_DIR, "agent");
15033
15102
  yield { type: "text", content: `\u274C CRITICAL ERROR: ${errLog}` };
15034
15103
  if (!fs22.existsSync(agentErrDir)) fs22.mkdirSync(agentErrDir, { recursive: true });
15035
- fs22.appendFileSync(path21.join(agentErrDir, "error.log"), `CRITICAL ERROR [${date}]: ${errLog}
15104
+ fs22.appendFileSync(path21.join(agentErrDir, "error.log"), `CRITICAL ERROR [${date}]: ${err}
15036
15105
 
15037
15106
  ----------------------------------------------------------------------
15038
15107
 
@@ -18734,33 +18803,86 @@ ${timestamp}` };
18734
18803
  (m) => m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
18735
18804
  );
18736
18805
  const cleanHistoryForAI = [];
18737
- rawHistory.forEach((m, idx) => {
18738
- let text = m.fullText || m.text;
18806
+ const preprocessed = rawHistory.map((m, idx) => {
18807
+ let text = m.fullText || m.text || "";
18739
18808
  if (m.role === "user" && idx < rawHistory.length - 1) {
18740
18809
  if (text.includes("**CONTEXT SUMMARY OF PREVIOUS TURNS")) {
18741
- const summaryIndex = text.indexOf("[SYSTEM METADATA (PRIORITY: DYNAMIC)]");
18810
+ const summaryIndex = text.indexOf("**CONTEXT SUMMARY OF PREVIOUS TURNS");
18742
18811
  if (summaryIndex !== -1) {
18743
- text = text.substring(summaryIndex).trim();
18812
+ const prefix = text.substring(0, summaryIndex);
18813
+ const metadataIndex = prefix.lastIndexOf("[SYSTEM METADATA]");
18814
+ if (metadataIndex !== -1) {
18815
+ text = text.substring(metadataIndex).trim();
18816
+ } else {
18817
+ text = text.substring(summaryIndex).trim();
18818
+ }
18744
18819
  }
18745
18820
  } else {
18746
18821
  const userIndex = text.lastIndexOf("[USER]");
18822
+ const userPromptIndex = text.lastIndexOf("[USER PROMPT]");
18747
18823
  if (userIndex !== -1) {
18748
18824
  text = text.substring(userIndex + 6).trim();
18825
+ } else if (userPromptIndex !== -1) {
18826
+ text = text.substring(userPromptIndex).trim();
18749
18827
  }
18750
18828
  }
18751
18829
  }
18752
- if (m.role === "system" && text?.startsWith("[TOOL RESULT]")) {
18753
- const prev = cleanHistoryForAI[cleanHistoryForAI.length - 1];
18754
- if (prev && prev.role === "system" && prev.text?.startsWith("[TOOL RESULT]")) {
18755
- prev.text += "\n\n" + text;
18756
- return;
18830
+ return { ...m, text };
18831
+ });
18832
+ let i = 0;
18833
+ while (i < preprocessed.length) {
18834
+ const msg = preprocessed[i];
18835
+ if (msg.role === "user") {
18836
+ cleanHistoryForAI.push(msg);
18837
+ i++;
18838
+ } else {
18839
+ const turnMessages = [];
18840
+ while (i < preprocessed.length && preprocessed[i].role !== "user") {
18841
+ turnMessages.push(preprocessed[i]);
18842
+ i++;
18843
+ }
18844
+ const toolCalls = [];
18845
+ const toolResults = [];
18846
+ const finalResponses = [];
18847
+ turnMessages.forEach((tm) => {
18848
+ const textLower = (tm.text || "").toLowerCase();
18849
+ const hasTool = textLower.includes("tool:functions.") || textLower.includes("agent:generalist.");
18850
+ const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:") || tm.text?.startsWith("[TERMINAL_RECORD]") || tm.isTerminalRecord);
18851
+ if (tm.role === "agent") {
18852
+ if (hasTool) {
18853
+ toolCalls.push(tm.text);
18854
+ } else {
18855
+ finalResponses.push(tm.text);
18856
+ }
18857
+ } else if (isResult) {
18858
+ toolResults.push(tm.text);
18859
+ } else {
18860
+ finalResponses.push(tm.text);
18861
+ }
18862
+ });
18863
+ if (toolCalls.length > 0) {
18864
+ cleanHistoryForAI.push({
18865
+ role: "agent",
18866
+ text: toolCalls.map((tc) => tc.trim()).filter(Boolean).join("\n")
18867
+ });
18868
+ }
18869
+ if (toolResults.length > 0) {
18870
+ cleanHistoryForAI.push({
18871
+ role: "system",
18872
+ text: toolResults.map((tr) => {
18873
+ const trimmed = tr.trim();
18874
+ return trimmed.startsWith("[TOOL RESULT]") ? trimmed : `[TOOL RESULT]: ${trimmed}`;
18875
+ }).filter(Boolean).join("\n\n")
18876
+ });
18877
+ }
18878
+ if (finalResponses.length > 0) {
18879
+ cleanHistoryForAI.push({
18880
+ role: "agent",
18881
+ text: finalResponses.map((fr) => fr.trim()).filter(Boolean).join("\n\n")
18882
+ });
18757
18883
  }
18758
18884
  }
18759
- cleanHistoryForAI.push({
18760
- ...m,
18761
- text
18762
- });
18763
- });
18885
+ }
18764
18886
  const stream = getAIStream(
18765
18887
  activeModel,
18766
18888
  cleanHistoryForAI,
@@ -19030,7 +19152,7 @@ Selection: ${val}`,
19030
19152
  });
19031
19153
  clearBlocksCache();
19032
19154
  if (global.gc) {
19033
- for (let i = 0; i < 2; i++) {
19155
+ for (let i2 = 0; i2 < 2; i2++) {
19034
19156
  global.gc();
19035
19157
  await new Promise((resolve) => setImmediate(resolve));
19036
19158
  }
@@ -19175,7 +19297,7 @@ Selection: ${val}`,
19175
19297
  let chunkText = packet.content;
19176
19298
  if (packet.type === "text" && chunkText.includes("Request Cancelled")) {
19177
19299
  if (global.gc) {
19178
- for (let i = 0; i < 3; i++) {
19300
+ for (let i2 = 0; i2 < 3; i2++) {
19179
19301
  global.gc();
19180
19302
  await new Promise((resolve) => setImmediate(resolve));
19181
19303
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "3.3.3",
4
- "date": "2026-07-09",
3
+ "version": "3.3.5",
4
+ "date": "2026-07-10",
5
5
  "description": "A High-Fidelity Agentic CLI with Sub-Agents for the Flux Era.",
6
6
  "keywords": [
7
7
  "ai",