fluxflow-cli 2.8.6 → 2.8.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 +32 -9
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -1586,12 +1586,33 @@ var init_ChatLayout = __esm({
|
|
|
1586
1586
|
}
|
|
1587
1587
|
}
|
|
1588
1588
|
}
|
|
1589
|
-
return result.replace(/\[TOOL RESULT\]:?\s*/gi, "").split("\n").filter((line) => !line.trim().startsWith("SUCCESS:") && !line.trim().startsWith("ERROR:")).join("\n").replace(/\[\s*turn\s*:\s*(continue|finish)\s*\]/gi, "").replace(/\[\[END\]\]/gi, "").replace(/\[\s*turn\s*:?.*?$/gi, "").replace(/\n\s*turn\s*:?.*?$/gi, "").replace(/\[\s*$/gi, "").replace(/\n\nResponded on .*/g, "").replace(/\n\n\[Prompted on: .*\]/g, "").replace(/(\$?\\?\/?\\rightarrow\$?|\$\\rightarrow\$)/gi, "\u2192").replace(/(\$?\\?\/?\\leftarrow\$?|\$\\leftarrow\$)/gi, "\u2190").replace(/(\$?\\?\/?\\uparrow\$?|\$\\uparrow\$)/gi, "\u2191").replace(/(\$?\\?\/?\\downarrow\$?|\$\\downarrow\$)/gi, "\u2193").replace(/(\$?\\?\/?\\leftrightarrow\$?|\$\\leftrightarrow\$)/gi, "\u2194").replace(/@\[TerminalName:.*?, ProcessId:.*?\]/gi, "").replace(/\b(write_file|update_file|read_folder|view_file|exec_command|web_search|web_scrape|search_keyword|write_pdf|write_docx|generate_image)\b/gi, (match) => TOOL_LABELS[match.toLowerCase()] || match).trim();
|
|
1589
|
+
return result.replace(/\[SYSTEM\][\s\S]*?\[\/SYSTEM\]/gi, "").replace(/\[TOOL RESULT\]:?\s*/gi, "").split("\n").filter((line) => !line.trim().startsWith("SUCCESS:") && !line.trim().startsWith("ERROR:")).join("\n").replace(/\[\s*turn\s*:\s*(continue|finish)\s*\]/gi, "").replace(/\[\[END\]\]/gi, "").replace(/\[\s*turn\s*:?.*?$/gi, "").replace(/\n\s*turn\s*:?.*?$/gi, "").replace(/\[\s*$/gi, "").replace(/\n\nResponded on .*/g, "").replace(/\n\n\[Prompted on: .*\]/g, "").replace(/(\$?\\?\/?\\rightarrow\$?|\$\\rightarrow\$)/gi, "\u2192").replace(/(\$?\\?\/?\\leftarrow\$?|\$\\leftarrow\$)/gi, "\u2190").replace(/(\$?\\?\/?\\uparrow\$?|\$\\uparrow\$)/gi, "\u2191").replace(/(\$?\\?\/?\\downarrow\$?|\$\\downarrow\$)/gi, "\u2193").replace(/(\$?\\?\/?\\leftrightarrow\$?|\$\\leftrightarrow\$)/gi, "\u2194").replace(/@\[TerminalName:.*?, ProcessId:.*?\]/gi, "").replace(/\b(write_file|update_file|read_folder|view_file|exec_command|web_search|web_scrape|search_keyword|write_pdf|write_docx|generate_image)\b/gi, (match) => TOOL_LABELS[match.toLowerCase()] || match).trim();
|
|
1590
1590
|
};
|
|
1591
1591
|
formatThinkText = (cleaned, columns = 80) => {
|
|
1592
1592
|
if (!cleaned) return null;
|
|
1593
1593
|
const availableWidth = columns - 10;
|
|
1594
|
-
|
|
1594
|
+
const trimmed = cleaned.trim();
|
|
1595
|
+
if (!trimmed.includes("```")) {
|
|
1596
|
+
return /* @__PURE__ */ React3.createElement(Box3, { width: "100%", flexDirection: "column" }, /* @__PURE__ */ React3.createElement(MarkdownText, { text: trimmed, color: "gray", columns: availableWidth, italic: true }));
|
|
1597
|
+
}
|
|
1598
|
+
const parts = trimmed.split(/(```\w*\n?[\s\S]*?(?:```|$))/g);
|
|
1599
|
+
return /* @__PURE__ */ React3.createElement(Box3, { width: "100%", flexDirection: "column" }, parts.map((part, i) => {
|
|
1600
|
+
if (part.startsWith("```")) {
|
|
1601
|
+
const match = part.match(/```(\w*)\n?([\s\S]*?)(?:```|$)/);
|
|
1602
|
+
const code = match ? match[2] : part.replace(/^```\w*\n?/, "").replace(/```$/, "");
|
|
1603
|
+
const wrappedCode = wrapText(code.trimEnd(), availableWidth);
|
|
1604
|
+
return /* @__PURE__ */ React3.createElement(Box3, { key: i, flexDirection: "column", width: "100%" }, wrappedCode.split("\n").map((line, idx) => /* @__PURE__ */ React3.createElement(Text3, { key: idx, color: "cyan" }, line)));
|
|
1605
|
+
}
|
|
1606
|
+
let cleanPart = part;
|
|
1607
|
+
if (i > 0) {
|
|
1608
|
+
cleanPart = cleanPart.replace(/^[\r\n]+/, "");
|
|
1609
|
+
}
|
|
1610
|
+
if (i < parts.length - 1) {
|
|
1611
|
+
cleanPart = cleanPart.replace(/[\r\n]+$/, "");
|
|
1612
|
+
}
|
|
1613
|
+
if (!cleanPart) return null;
|
|
1614
|
+
return /* @__PURE__ */ React3.createElement(MarkdownText, { key: i, text: cleanPart, color: "gray", columns: availableWidth, italic: true });
|
|
1615
|
+
}));
|
|
1595
1616
|
};
|
|
1596
1617
|
parseMathSymbols = (content) => {
|
|
1597
1618
|
return content.replace(/\\multiply|\\mul|\\times/g, "\xD7").replace(/\\div/g, "\xF7").replace(/\\cdot/g, "\u22C5").replace(/\\infty/g, "\u221E").replace(/\\pm/g, "\xB1").replace(/\\leq/g, "\u2264").replace(/\\geq/g, "\u2265").replace(/\\neq/g, "\u2260").replace(/\\sqrt\s*\{([^}]+)\}/g, "\u221A($1)").replace(/\\sqrt\s*(\w+|\d+)/g, "\u221A($1)").replace(/\\alpha/g, "\u03B1").replace(/\\beta/g, "\u03B2").replace(/\\theta/g, "\u03B8").replace(/\\pi/g, "\u03C0").replace(/\\approx/g, "\u2248").replace(/\\Delta/g, "\u0394").replace(/\\sigma/g, "\u03C3").replace(/\\sum/g, "\u03A3").replace(/\\prod/g, "\u03A0").replace(/\\rightarrow|\\to/g, "\u2192").replace(/\\left\b|\\right\b/g, "").replace(/\\left\(|\\right\)/g, (match) => match.includes("left") ? "(" : ")").replace(/\\left\[|\\right\]/g, (match) => match.includes("left") ? "[" : "]").replace(/\\\{|\\\}/g, (match) => match.includes("{") ? "{" : "}").replace(/\\text\s*\{([^}]+)\}/g, "$1").replace(/\\text\s+(\w+)/g, "$1").replace(/\\%/g, "%");
|
|
@@ -3427,7 +3448,8 @@ ${projectContextBlock}
|
|
|
3427
3448
|
|
|
3428
3449
|
-- FORMATTING --
|
|
3429
3450
|
- GFM Supported
|
|
3430
|
-
- NO CHAT
|
|
3451
|
+
- NO CHAT RESPONSE **AFTER** CALLING TOOLS IN SAME TURN
|
|
3452
|
+
- ONE THINKING BLOCK PER TURN
|
|
3431
3453
|
- Basic LaTeX${mode === "Flux" ? "" : ". Kaomojis"}
|
|
3432
3454
|
=== END SYSTEM PROMPT ===`.trim();
|
|
3433
3455
|
};
|
|
@@ -9283,7 +9305,7 @@ ${boxBottom}` };
|
|
|
9283
9305
|
await incrementUsage("toolFailure");
|
|
9284
9306
|
if (settings.onToolResult) settings.onToolResult("failure", normToolName);
|
|
9285
9307
|
}
|
|
9286
|
-
const aiContent = `[TOOL RESULT]: ${(result || "").toString().
|
|
9308
|
+
const aiContent = `[TOOL RESULT]: ${(result || "").toString().replaceAll("[UI_CONTEXT]", "[CONTEXT]")}`;
|
|
9287
9309
|
toolResults.push({ role: "user", text: aiContent, binaryPart });
|
|
9288
9310
|
anyToolExecutedInThisTurn = true;
|
|
9289
9311
|
let uiContent = `[TOOL RESULT]: ${result || ""}`;
|
|
@@ -9549,17 +9571,18 @@ Error Log can be found in ${path19.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
9549
9571
|
}
|
|
9550
9572
|
wasToolCalledInLastLoop = toolCallPointer > 0 || anyToolExecutedInThisTurn;
|
|
9551
9573
|
}
|
|
9552
|
-
|
|
9553
|
-
|
|
9554
|
-
|
|
9574
|
+
modifiedHistory.forEach((msg) => {
|
|
9575
|
+
if (msg.role === "user" && msg.text) {
|
|
9576
|
+
msg.text = msg.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g, "");
|
|
9577
|
+
if (modelName && modelName.toLowerCase().startsWith("gemma") && aiProvider === "Google" && msg.text.startsWith("[TOOL RESULT]")) {
|
|
9555
9578
|
const jitInstructionFast = `
|
|
9556
9579
|
[SYSTEM] Tool result received. Analyze output and proceed with your turn [/SYSTEM]`;
|
|
9557
9580
|
const jitInstructionThinking = `
|
|
9558
9581
|
[SYSTEM] Tool result received. Analyze output and proceed with your turn. **STRICTLY MAINTAIN THINKING POLICY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]`;
|
|
9559
9582
|
msg.text = msg.text.replace(jitInstructionThinking, "").replace(jitInstructionFast, "").trim();
|
|
9560
9583
|
}
|
|
9561
|
-
}
|
|
9562
|
-
}
|
|
9584
|
+
}
|
|
9585
|
+
});
|
|
9563
9586
|
} catch (err) {
|
|
9564
9587
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
9565
9588
|
const date = (/* @__PURE__ */ new Date()).toLocaleString();
|