fluxflow-cli 3.16.1 → 3.16.2
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 +46 -6
- 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:")
|
|
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);
|
|
@@ -15760,7 +15761,7 @@ ${currentSummary}
|
|
|
15760
15761
|
const dynamicDirAwareness = !!systemSettings?.dynamicDirAwareness;
|
|
15761
15762
|
const sysInstructionCacheKey = `${chatId}|${aiProvider}|${thinkingLevel}|${modelName}|${profile}|${dynamicDirAwareness}`;
|
|
15762
15763
|
const isSysInstructionCached = !dynamicDirAwareness && systemInstructionCache.key === sysInstructionCacheKey && systemInstructionCache.value;
|
|
15763
|
-
let dirStructure = isSysInstructionCached ? "" : "\n**DIRECTORY STRUCTURE**\nCWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}
|
|
15764
|
+
let dirStructure = isSysInstructionCached ? "" : "\n**DIRECTORY STRUCTURE**\nCWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}
|
|
15764
15765
|
` + getDirTree(process.cwd(), dynamicMaxDepth);
|
|
15765
15766
|
const ideCtx = await getIDEContext();
|
|
15766
15767
|
let ideBlock = "";
|
|
@@ -16040,7 +16041,8 @@ ${ideCtx.warnings}
|
|
|
16040
16041
|
const cleanPromptForModel = cleanAgentText.replace(/\\(@\[[^\]]+\])/g, "$1");
|
|
16041
16042
|
const firstUserMsg = `[METADATA, Chat Context > Metadata]
|
|
16042
16043
|
Time: ${dateTimeStr}
|
|
16043
|
-
OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${
|
|
16044
|
+
OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${cwdMismatch ? `WARNING: CWD Mismatch! Previous Path: "${lastCwd}" WRITE the change in chat to aviod path mismatch later
|
|
16045
|
+
` : ""}${memoryPrompt}${ideBlock}
|
|
16044
16046
|
[/METADATA]
|
|
16045
16047
|
${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
16048
|
${taggedContextStr}[USER PROMPT]
|
|
@@ -21015,6 +21017,7 @@ function App({ args = [] }) {
|
|
|
21015
21017
|
{ cmd: "/resume", desc: "Load previous session" },
|
|
21016
21018
|
{ cmd: "/clear", desc: "Clear terminal screen" },
|
|
21017
21019
|
{ cmd: "/compress", desc: "Summarize and compress chat history" },
|
|
21020
|
+
{ cmd: "/truncate", desc: "Truncate tool results in chat history" },
|
|
21018
21021
|
{ cmd: "/revert", desc: "Revert codebase back to a checkpoint" },
|
|
21019
21022
|
{ cmd: "/gemini", desc: "Get a happy message from Gemini CLI" },
|
|
21020
21023
|
{ cmd: "/save", desc: "Force save current chat" },
|
|
@@ -21947,6 +21950,42 @@ ${list || "No saved chats found."}`, isMeta: true }];
|
|
|
21947
21950
|
runCompress();
|
|
21948
21951
|
break;
|
|
21949
21952
|
}
|
|
21953
|
+
case "/truncate": {
|
|
21954
|
+
setInput("");
|
|
21955
|
+
let truncatedCount = 0;
|
|
21956
|
+
setMessages((prev) => {
|
|
21957
|
+
const updatedMessages = prev.map((m) => {
|
|
21958
|
+
const fullTextStr = m.fullText || m.text || "";
|
|
21959
|
+
if (!fullTextStr.startsWith("[TOOL RESULT]:")) {
|
|
21960
|
+
return m;
|
|
21961
|
+
}
|
|
21962
|
+
if (fullTextStr.startsWith("[TOOL RESULT]: ERROR") || fullTextStr.startsWith("[TOOL RESULT]: DENIED") || fullTextStr.includes("...Result Truncated by System on User Request")) {
|
|
21963
|
+
return m;
|
|
21964
|
+
}
|
|
21965
|
+
truncatedCount++;
|
|
21966
|
+
if (fullTextStr.startsWith("[TOOL RESULT]: SUCCESS")) {
|
|
21967
|
+
return {
|
|
21968
|
+
...m,
|
|
21969
|
+
fullText: "[TOOL RESULT]: SUCCESS: ...Result Truncated by System on User Request"
|
|
21970
|
+
};
|
|
21971
|
+
}
|
|
21972
|
+
return {
|
|
21973
|
+
...m,
|
|
21974
|
+
fullText: "[TOOL RESULT]: ...Result Truncated by System on User Request"
|
|
21975
|
+
};
|
|
21976
|
+
});
|
|
21977
|
+
const finalMsgs = [...updatedMessages, {
|
|
21978
|
+
id: Date.now(),
|
|
21979
|
+
role: "system",
|
|
21980
|
+
text: `[SYSTEM] Truncated ${truncatedCount} tool result(s) in chat history.`,
|
|
21981
|
+
isMeta: true
|
|
21982
|
+
}];
|
|
21983
|
+
saveChat(chatId, null, finalMsgs);
|
|
21984
|
+
setCompletedIndex(finalMsgs.length);
|
|
21985
|
+
return finalMsgs;
|
|
21986
|
+
});
|
|
21987
|
+
break;
|
|
21988
|
+
}
|
|
21950
21989
|
case "/help": {
|
|
21951
21990
|
setMessages((prev) => {
|
|
21952
21991
|
setCompletedIndex(prev.length + 1);
|
|
@@ -22006,7 +22045,7 @@ ${timestamp}` };
|
|
|
22006
22045
|
let isFirstPacket = true;
|
|
22007
22046
|
try {
|
|
22008
22047
|
const rawHistory = [...messages, userMessage].filter(
|
|
22009
|
-
(m) => m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !String(m.id).startsWith("welcome")
|
|
22048
|
+
(m) => m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !m.isTerminalRecord && !(m.text && m.text.includes("[TERMINAL_RECORD]")) && !String(m.id).startsWith("welcome")
|
|
22010
22049
|
);
|
|
22011
22050
|
const cleanHistoryForAI = [];
|
|
22012
22051
|
const preprocessed = rawHistory.map((m, idx) => {
|
|
@@ -22048,7 +22087,7 @@ ${timestamp}` };
|
|
|
22048
22087
|
i++;
|
|
22049
22088
|
}
|
|
22050
22089
|
turnMessages.forEach((tm) => {
|
|
22051
|
-
const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:")
|
|
22090
|
+
const isResult = tm.role === "system" && (tm.text?.startsWith("[TOOL RESULT]") || tm.text?.startsWith("SUCCESS:") || tm.text?.startsWith("ERROR:"));
|
|
22052
22091
|
const emitRole = isResult ? "system" : "agent";
|
|
22053
22092
|
const rawText = (tm.text || "").trim();
|
|
22054
22093
|
if (!rawText) return;
|
|
@@ -24541,6 +24580,7 @@ Usage: fluxflow --export error`);
|
|
|
24541
24580
|
/clear Clear terminal screen
|
|
24542
24581
|
/resume Load previous session
|
|
24543
24582
|
/compress Summarize and compress chat history
|
|
24583
|
+
/truncate Truncate tool results in chat history
|
|
24544
24584
|
/revert Revert codebase back to a checkpoint
|
|
24545
24585
|
/save Force save current chat
|
|
24546
24586
|
/export [chat|logs] Export chat session or system error logs
|