fluxflow-cli 2.10.0 → 2.10.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 +48 -14
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -2711,8 +2711,20 @@ var init_exec_command = __esm({
|
|
|
2711
2711
|
return new Promise((resolve) => {
|
|
2712
2712
|
const attempt = (usePowerShell) => {
|
|
2713
2713
|
const command = adjustWindowsCommand(rawCommand, usePowerShell);
|
|
2714
|
-
|
|
2715
|
-
|
|
2714
|
+
let shell = isWin ? usePowerShell ? "powershell.exe" : "cmd.exe" : process.env.SHELL || "bash";
|
|
2715
|
+
let shellArgs = isWin ? usePowerShell ? ["-NoProfile", "-Command", command] : ["/c", command] : ["-c", command];
|
|
2716
|
+
if (systemSettings.networkAccess === false && !isWin) {
|
|
2717
|
+
const originalShell = shell;
|
|
2718
|
+
const originalArgs = [...shellArgs];
|
|
2719
|
+
if (process.platform === "linux") {
|
|
2720
|
+
shell = "unshare";
|
|
2721
|
+
shellArgs = ["-n", "-r", originalShell, ...originalArgs];
|
|
2722
|
+
} else if (process.platform === "darwin") {
|
|
2723
|
+
const sbProfile = '(version 1)\n(allow default)\n(deny network-outbound)\n(allow network-outbound (remote ip "localhost:*"))\n(allow network-outbound (remote ip "127.0.0.1:*"))\n';
|
|
2724
|
+
shell = "sandbox-exec";
|
|
2725
|
+
shellArgs = ["-p", sbProfile, originalShell, ...originalArgs];
|
|
2726
|
+
}
|
|
2727
|
+
}
|
|
2716
2728
|
if (pty) {
|
|
2717
2729
|
try {
|
|
2718
2730
|
const ptyProcess = pty.spawn(shell, shellArgs, {
|
|
@@ -2765,11 +2777,11 @@ ${finalOutput}`);
|
|
|
2765
2777
|
if (isWin && usePowerShell && err.code === "ENOENT") {
|
|
2766
2778
|
return false;
|
|
2767
2779
|
}
|
|
2768
|
-
runStandardSpawn(resolve, command, rawCommand, netEnv, onChunk, usePowerShell);
|
|
2780
|
+
runStandardSpawn(resolve, command, rawCommand, netEnv, onChunk, usePowerShell, systemSettings);
|
|
2769
2781
|
return true;
|
|
2770
2782
|
}
|
|
2771
2783
|
} else {
|
|
2772
|
-
runStandardSpawn(resolve, command, rawCommand, netEnv, onChunk, usePowerShell);
|
|
2784
|
+
runStandardSpawn(resolve, command, rawCommand, netEnv, onChunk, usePowerShell, systemSettings);
|
|
2773
2785
|
return true;
|
|
2774
2786
|
}
|
|
2775
2787
|
};
|
|
@@ -2782,12 +2794,23 @@ ${finalOutput}`);
|
|
|
2782
2794
|
}
|
|
2783
2795
|
});
|
|
2784
2796
|
};
|
|
2785
|
-
runStandardSpawn = (resolve, command, rawCommand, netEnv, onChunk, usePowerShell = true) => {
|
|
2797
|
+
runStandardSpawn = (resolve, command, rawCommand, netEnv, onChunk, usePowerShell = true, systemSettings = {}) => {
|
|
2786
2798
|
const isWin = process.platform === "win32";
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
shell
|
|
2799
|
+
let shell = isWin ? usePowerShell ? "powershell.exe" : "cmd.exe" : process.env.SHELL || "bash";
|
|
2800
|
+
let shellArgs = isWin ? usePowerShell ? ["-NoProfile", "-Command", command] : ["/c", command] : ["-c", command];
|
|
2801
|
+
if (systemSettings.networkAccess === false && !isWin) {
|
|
2802
|
+
const originalShell = shell;
|
|
2803
|
+
const originalArgs = [...shellArgs];
|
|
2804
|
+
if (process.platform === "linux") {
|
|
2805
|
+
shell = "unshare";
|
|
2806
|
+
shellArgs = ["-n", "-r", originalShell, ...originalArgs];
|
|
2807
|
+
} else if (process.platform === "darwin") {
|
|
2808
|
+
const sbProfile = '(version 1)\n(allow default)\n(deny network-outbound)\n(allow network-outbound (remote ip "localhost:*"))\n(allow network-outbound (remote ip "127.0.0.1:*"))\n';
|
|
2809
|
+
shell = "sandbox-exec";
|
|
2810
|
+
shellArgs = ["-p", sbProfile, originalShell, ...originalArgs];
|
|
2811
|
+
}
|
|
2812
|
+
}
|
|
2813
|
+
const child = isWin ? spawn(shell, shellArgs, { cwd: process.cwd(), env: { ...process.env, ...netEnv } }) : spawn(shell, shellArgs, {
|
|
2791
2814
|
cwd: process.cwd(),
|
|
2792
2815
|
env: {
|
|
2793
2816
|
...process.env,
|
|
@@ -2854,7 +2877,7 @@ ${finalOutput}`);
|
|
|
2854
2877
|
child.on("error", (err) => {
|
|
2855
2878
|
if (isWin && usePowerShell && err.code === "ENOENT") {
|
|
2856
2879
|
const cmdCommand = adjustWindowsCommand(rawCommand, false);
|
|
2857
|
-
return runStandardSpawn(resolve, cmdCommand, rawCommand, netEnv, onChunk, false);
|
|
2880
|
+
return runStandardSpawn(resolve, cmdCommand, rawCommand, netEnv, onChunk, false, systemSettings);
|
|
2858
2881
|
}
|
|
2859
2882
|
activeChildProcess = null;
|
|
2860
2883
|
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
@@ -8169,7 +8192,8 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
|
|
|
8169
8192
|
let wasToolCalledInLastLoop = false;
|
|
8170
8193
|
modifiedHistory.forEach((msg) => {
|
|
8171
8194
|
if (msg.text && msg.role === "agent") {
|
|
8172
|
-
msg.text = msg.text.replace(/(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])/gi, "")
|
|
8195
|
+
msg.text = msg.text.replace(/(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])/gi, "");
|
|
8196
|
+
msg.text = msg.text.replace(/(?:<(think|thought)>|\[(think|thought)\])[^\[\n]*/gi, "").trim();
|
|
8173
8197
|
}
|
|
8174
8198
|
});
|
|
8175
8199
|
for (let loop = 0; loop <= MAX_LOOPS; loop++) {
|
|
@@ -8331,7 +8355,7 @@ ${activeSummaryBlock}${thinkingLevel !== "Fast" && thinkingLevel !== "xHigh" &&
|
|
|
8331
8355
|
}
|
|
8332
8356
|
currentSystemInstruction = getSystemInstruction(profile, !(targetModel || "gemma").toLowerCase().startsWith("gemma") ? "GEM" : thinkingLevel, mode, systemSettings, isMemoryEnabled, isFirstPrompt, aiProvider, isMultiModal);
|
|
8333
8357
|
const lastUserMsg = contents[contents.length - 1];
|
|
8334
|
-
if (isBridgeConnected()) {
|
|
8358
|
+
if (isBridgeConnected() & loop > 0) {
|
|
8335
8359
|
yield { type: "status", content: "Checking Code..." };
|
|
8336
8360
|
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
8337
8361
|
const ideCtxJIT = await getIDEContext();
|
|
@@ -9082,7 +9106,7 @@ ${boxBottom}` };
|
|
|
9082
9106
|
}
|
|
9083
9107
|
if (!forcePrompt && !decision) {
|
|
9084
9108
|
if (systemSettings2.networkAccess === false) {
|
|
9085
|
-
const networkCmdRegex = /\b(curl|wget|
|
|
9109
|
+
const networkCmdRegex = /\b(curl|wget|httpie|fetch|axial|yarn|npm|pnpm|bun|deno|pip|pip3|poetry|uv|gem|cargo|go\s+(get|install)|composer|nuget|ssh|scp|ping|sftp|rsync|docker|podman|kubectl|helm|git\s+(clone|push|pull|fetch)|ftp|telnet|nc|netcat|socat|traceroute|tracert|dig|nslookup|host|nmap|gcloud|aws|az|terraform|ansible-playbook|nix|nix-env)\b/i;
|
|
9086
9110
|
if (networkCmdRegex.test(cmdTrimmed)) {
|
|
9087
9111
|
decision = "deny";
|
|
9088
9112
|
isNetworkDeny = true;
|
|
@@ -9766,6 +9790,9 @@ Error Log can be found in ${path19.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
9766
9790
|
const cleanedTurnText = contextSafeReplace(turnText, /(\[\s*(turn\s*:)?\s*(continue|finish)\s*\]|\[\[END\]\])/gi, "").trim();
|
|
9767
9791
|
let isActuallyFinished = (hasFinish || toolResults.length === 0) && !isThinkingLoop && !isStutteringLoop && !isGeneralLoop;
|
|
9768
9792
|
isActuallyFinished = toolResults.length === 0 ? isActuallyFinished : false;
|
|
9793
|
+
if (turnText && turnText.trim().endsWith('")]') && toolResults.length === 0) {
|
|
9794
|
+
isActuallyFinished = false;
|
|
9795
|
+
}
|
|
9769
9796
|
if (isActuallyFinished) {
|
|
9770
9797
|
const fullAgentTextRaw = fullAgentResponseChunks.join("\n");
|
|
9771
9798
|
const cleanedFullResponse = fullAgentTextRaw.replace(/(?:<think>|\[think\])[\s\S]*?(?:<\/think>|\[\/think\])/g, "").trim();
|
|
@@ -9795,7 +9822,7 @@ Error Log can be found in ${path19.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
9795
9822
|
}
|
|
9796
9823
|
} else {
|
|
9797
9824
|
if (wasToolCalledInLastLoop) {
|
|
9798
|
-
modifiedHistory.push({ role: "user", text: `[SYSTEM] Failed to verify tool execution,
|
|
9825
|
+
modifiedHistory.push({ role: "user", text: `[SYSTEM] Failed to verify tool execution, MUST check if executed or failed. On failure try again [/SYSTEM]` });
|
|
9799
9826
|
} else {
|
|
9800
9827
|
modifiedHistory.push({ role: "user", text: `[SYSTEM] ${isStutteringLoop && !isThinkingLoop ? `STUTTERING DETECTED by Internal System. Re-calibrate your response & proceed.` : `${isThinkingLoop ? " OVER THINKING" : " LOOP"} DETECTED by Internal System${isThinkingLoop ? " for current EFFORT_LEVEL" : ""}. ${isThinkingLoop ? "If you have planned the task, prioritize execution/output" : "If you have finished your task use [[END]]"}`} [/SYSTEM]` });
|
|
9801
9828
|
}
|
|
@@ -9808,6 +9835,13 @@ Error Log can be found in ${path19.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
9808
9835
|
modifiedHistory.forEach((msg) => {
|
|
9809
9836
|
if (msg.role === "user" && msg.text) {
|
|
9810
9837
|
msg.text = msg.text.replace(/\n\[COMPILE ERROR\][\s\S]*?\[\/ERROR\]/g, "");
|
|
9838
|
+
msg.text = msg.text.replace(`
|
|
9839
|
+
|
|
9840
|
+
[SYSTEM] USER QUESTION. RESOLVE THIS SPECIFIC QUERY WITHIN '[ANSWER] ... [/ANSWER]' CONCISELY, NATURALLY [/SYSTEM]
|
|
9841
|
+
`, "").replace(`[SYSTEM] USER QUESTION. RESOLVE THIS SPECIFIC QUERY WITHIN '[ANSWER] ... [/ANSWER]' CONCISELY, NATURALLY
|
|
9842
|
+
**STRICTLY FOLLOW THINKING POLICY AS CRITICAL PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
|
|
9843
|
+
`, "").replace(`[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS CRITICAL PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]
|
|
9844
|
+
`, "");
|
|
9811
9845
|
if (modelName && modelName.toLowerCase().startsWith("gemma") && aiProvider === "Google" && msg.text.startsWith("[TOOL RESULT]")) {
|
|
9812
9846
|
const jitInstructionFast = `
|
|
9813
9847
|
[SYSTEM] Tool result received. Analyze output and proceed with your turn [/SYSTEM]`;
|