fluxflow-cli 3.16.1 → 3.16.3

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 +57 -9
  2. package/package.json +2 -2
package/dist/fluxflow.js CHANGED
@@ -6107,6 +6107,7 @@ var init_ChatLayout = __esm({
6107
6107
  { cmd: "/quit", desc: "Exit and shutdown Flux" },
6108
6108
  { cmd: "/help", desc: "Show all available commands" },
6109
6109
  { cmd: "/compress", desc: "Summarize and compress chat history" },
6110
+ { cmd: "/truncate", desc: "Truncate tool results in chat history" },
6110
6111
  { cmd: "/clear", desc: "Clear terminal screen" },
6111
6112
  { cmd: "/resume", desc: "Load previous session" },
6112
6113
  { cmd: "/revert", desc: "Revert codebase to checkpoint" },
@@ -13601,7 +13602,7 @@ var init_ai = __esm({
13601
13602
  TERMINATION_SIGNAL = false;
13602
13603
  getCleanGroupedLength = (rawHistory) => {
13603
13604
  const preprocessed = rawHistory.filter(
13604
- (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
13605
+ (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !m.isTerminalRecord && !(m.text && m.text.includes("[TERMINAL_RECORD]")) && !String(m.id).startsWith("welcome")
13605
13606
  ).map((m, idx, arr) => {
13606
13607
  let text = m.fullText || m.text || "";
13607
13608
  if (m.role === "user" && idx < arr.length - 1) {
@@ -13647,7 +13648,7 @@ var init_ai = __esm({
13647
13648
  turnMessages.forEach((tm) => {
13648
13649
  const textLower = (tm.text || "").toLowerCase();
13649
13650
  const hasTool = textLower.includes("tool:functions.") || textLower.includes("agent:generalist.");
13650
- 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);
13651
+ const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:"));
13651
13652
  if (tm.role === "agent") {
13652
13653
  if (hasTool) {
13653
13654
  toolCalls.push(tm.text);
@@ -15347,10 +15348,18 @@ ${newMemoryListStr}
15347
15348
  const summariesFile = path27.join(SECRET_DIR, "chat-summaries.json");
15348
15349
  const flattenContext = (hist) => {
15349
15350
  return hist.filter(
15350
- (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
15351
+ (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !m.isTerminalRecord && !(m.text && m.text.includes("[TERMINAL_RECORD]")) && !String(m.id).startsWith("welcome")
15351
15352
  ).map((m) => {
15352
- const role = m.text?.startsWith("[TOOL RESULT]") ? "TOOL" : m.role === "agent" ? "AGENT" : "USER";
15353
- return `[${role}]: ${m.text}`;
15353
+ const rawText = m.fullText || m.text || "";
15354
+ const isToolResult = m.role === "system" || rawText.startsWith("[TOOL RESULT]:") || m.text && m.text.startsWith("[TOOL RESULT]:");
15355
+ let text = rawText;
15356
+ if (isToolResult && (rawText.includes("[TOOL RESULT]:") || m.text && m.text.includes("[TOOL RESULT]:"))) {
15357
+ text = "[TOOL RESULT]: ...truncated for summary";
15358
+ } else {
15359
+ text = text.replace(/(\[(?:tool|agent):[a-zA-Z0-9_\.]+)\([\s\S]*?\)(\])/g, "$1(...)$2");
15360
+ }
15361
+ const role = isToolResult ? "TOOL" : m.role === "agent" ? "AGENT" : "USER";
15362
+ return `[${role}]: ${text}`;
15354
15363
  }).join("\n\n");
15355
15364
  };
15356
15365
  const runCondenser = async (flattenedText2, oldSummary2) => {
@@ -15760,7 +15769,7 @@ ${currentSummary}
15760
15769
  const dynamicDirAwareness = !!systemSettings?.dynamicDirAwareness;
15761
15770
  const sysInstructionCacheKey = `${chatId}|${aiProvider}|${thinkingLevel}|${modelName}|${profile}|${dynamicDirAwareness}`;
15762
15771
  const isSysInstructionCached = !dynamicDirAwareness && systemInstructionCache.key === sysInstructionCacheKey && systemInstructionCache.value;
15763
- let dirStructure = isSysInstructionCached ? "" : "\n**DIRECTORY STRUCTURE**\nCWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
15772
+ let dirStructure = isSysInstructionCached ? "" : "\n**DIRECTORY STRUCTURE**\nCWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}
15764
15773
  ` + getDirTree(process.cwd(), dynamicMaxDepth);
15765
15774
  const ideCtx = await getIDEContext();
15766
15775
  let ideBlock = "";
@@ -16040,7 +16049,8 @@ ${ideCtx.warnings}
16040
16049
  const cleanPromptForModel = cleanAgentText.replace(/\\(@\[[^\]]+\])/g, "$1");
16041
16050
  const firstUserMsg = `[METADATA, Chat Context > Metadata]
16042
16051
  Time: ${dateTimeStr}
16043
- OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${memoryPrompt}${ideBlock}
16052
+ OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${cwdMismatch ? `WARNING: CWD Mismatch! Previous Path: "${lastCwd}" WRITE the change in chat to aviod path mismatch later
16053
+ ` : ""}${memoryPrompt}${ideBlock}
16044
16054
  [/METADATA]
16045
16055
  ${activeSummaryBlock}${thinkingLevel !== "Fast" && (aiProvider === "Mistral" || thinkingLevel !== "xHigh" && aiProvider === "Google") ? `${aiProvider === "Mistral" || modelName.toLowerCase().startsWith("gemma") ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]\n" : ""}` : ""}[SYSTEM Priority: HIGH] ONLY use the system prompt tool schema. eg: [tool:functions.ReadFolder(path=".")] [/SYSTEM]
16046
16056
  ${taggedContextStr}[USER PROMPT]
@@ -21015,6 +21025,7 @@ function App({ args = [] }) {
21015
21025
  { cmd: "/resume", desc: "Load previous session" },
21016
21026
  { cmd: "/clear", desc: "Clear terminal screen" },
21017
21027
  { cmd: "/compress", desc: "Summarize and compress chat history" },
21028
+ { cmd: "/truncate", desc: "Truncate tool results in chat history" },
21018
21029
  { cmd: "/revert", desc: "Revert codebase back to a checkpoint" },
21019
21030
  { cmd: "/gemini", desc: "Get a happy message from Gemini CLI" },
21020
21031
  { cmd: "/save", desc: "Force save current chat" },
@@ -21947,6 +21958,42 @@ ${list || "No saved chats found."}`, isMeta: true }];
21947
21958
  runCompress();
21948
21959
  break;
21949
21960
  }
21961
+ case "/truncate": {
21962
+ setInput("");
21963
+ let truncatedCount = 0;
21964
+ setMessages((prev) => {
21965
+ const updatedMessages = prev.map((m) => {
21966
+ const fullTextStr = m.fullText || m.text || "";
21967
+ if (!fullTextStr.startsWith("[TOOL RESULT]:")) {
21968
+ return m;
21969
+ }
21970
+ if (fullTextStr.startsWith("[TOOL RESULT]: ERROR") || fullTextStr.startsWith("[TOOL RESULT]: DENIED") || fullTextStr.includes("...Result Truncated by System on User Request")) {
21971
+ return m;
21972
+ }
21973
+ truncatedCount++;
21974
+ if (fullTextStr.startsWith("[TOOL RESULT]: SUCCESS")) {
21975
+ return {
21976
+ ...m,
21977
+ fullText: "[TOOL RESULT]: SUCCESS: ...Result Truncated by System on User Request"
21978
+ };
21979
+ }
21980
+ return {
21981
+ ...m,
21982
+ fullText: "[TOOL RESULT]: ...Result Truncated by System on User Request"
21983
+ };
21984
+ });
21985
+ const finalMsgs = [...updatedMessages, {
21986
+ id: Date.now(),
21987
+ role: "system",
21988
+ text: `[SYSTEM] Truncated ${truncatedCount} tool result(s) in chat history.`,
21989
+ isMeta: true
21990
+ }];
21991
+ saveChat(chatId, null, finalMsgs);
21992
+ setCompletedIndex(finalMsgs.length);
21993
+ return finalMsgs;
21994
+ });
21995
+ break;
21996
+ }
21950
21997
  case "/help": {
21951
21998
  setMessages((prev) => {
21952
21999
  setCompletedIndex(prev.length + 1);
@@ -22006,7 +22053,7 @@ ${timestamp}` };
22006
22053
  let isFirstPacket = true;
22007
22054
  try {
22008
22055
  const rawHistory = [...messages, userMessage].filter(
22009
- (m) => m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
22056
+ (m) => m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !m.isTerminalRecord && !(m.text && m.text.includes("[TERMINAL_RECORD]")) && !String(m.id).startsWith("welcome")
22010
22057
  );
22011
22058
  const cleanHistoryForAI = [];
22012
22059
  const preprocessed = rawHistory.map((m, idx) => {
@@ -22048,7 +22095,7 @@ ${timestamp}` };
22048
22095
  i++;
22049
22096
  }
22050
22097
  turnMessages.forEach((tm) => {
22051
- 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);
22098
+ const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:"));
22052
22099
  const emitRole = isResult ? "system" : "agent";
22053
22100
  const rawText = (tm.text || "").trim();
22054
22101
  if (!rawText) return;
@@ -24541,6 +24588,7 @@ Usage: fluxflow --export error`);
24541
24588
  /clear Clear terminal screen
24542
24589
  /resume Load previous session
24543
24590
  /compress Summarize and compress chat history
24591
+ /truncate Truncate tool results in chat history
24544
24592
  /revert Revert codebase back to a checkpoint
24545
24593
  /save Force save current chat
24546
24594
  /export [chat|logs] Export chat session or system error logs
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "fluxflow-cli",
3
- "version": "3.16.1",
4
- "date": "2026-08-01",
3
+ "version": "3.16.3",
4
+ "date": "2026-08-02",
5
5
  "description": "A High-Fidelity Agentic CLI with Sub-Agents for the Flux Era.",
6
6
  "keywords": [
7
7
  "ai",