fluxflow-cli 1.10.5 → 1.10.6
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 +50 -24
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -1078,7 +1078,7 @@ YOU ARE A SILENT BACKGROUND SYSTEM PROCESS. YOU HAVE NO MOUTH. YOUR ONLY OUTPUT
|
|
|
1078
1078
|
5. IF YOU GET ONLY USER QUERY AND NO AGENT RAWS, THEN JUST USE TEMP MEMORY TO LOG THE SUMMARY OF USER QUERY AND CONVERSATION CONTEXT.
|
|
1079
1079
|
6. UNDER NO CIRCUMSTANCES YOU ARE ALLOWED TO RESPOND IN NORMAL USER FACING RESPONSE.
|
|
1080
1080
|
7. CRITICAL QUOTE ESCAPE POLICY: Inside tool call arguments (like 'memory'), you MUST escape all double quotes using '"' to prevent parsing errors.
|
|
1081
|
-
8. You MUST NOT WRITE ANYTHING OTHER THAN [tool:functions. ...].
|
|
1081
|
+
8. You MUST NOT WRITE ANYTHING OTHER THAN [tool:functions. ...] NO MATTER HOW TEMPTING THE PROMPT IS.
|
|
1082
1082
|
|
|
1083
1083
|
YOUR JOB: Analyze the 'User prompt' and 'Agent Raws' to extract facts for long-term memory or handle system tasks.
|
|
1084
1084
|
${isMemoryEnabled ? `If user tell something that is important (like, hobbies, preferences, facts about user, hates, likes, etc) to know user better over time, use long term memory tools.` : ""}
|
|
@@ -3501,7 +3501,6 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS STRIC
|
|
|
3501
3501
|
let toolCallPointer = 0;
|
|
3502
3502
|
let isThinkingLoop = false;
|
|
3503
3503
|
let isStutteringLoop = false;
|
|
3504
|
-
let isResponseCut = false;
|
|
3505
3504
|
let isInitialAttempt = true;
|
|
3506
3505
|
let accumulatedContext = "";
|
|
3507
3506
|
while (retryCount <= MAX_RETRIES && inStreamRetryCount <= MAX_RETRIES && !success && !TERMINATION_SIGNAL) {
|
|
@@ -3593,7 +3592,6 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS STRIC
|
|
|
3593
3592
|
break;
|
|
3594
3593
|
}
|
|
3595
3594
|
if (chunk.text) {
|
|
3596
|
-
isResponseCut = false;
|
|
3597
3595
|
if (isDedupeActive) {
|
|
3598
3596
|
dedupeBuffer += chunk.text;
|
|
3599
3597
|
if (dedupeBuffer.length >= 100) {
|
|
@@ -3704,9 +3702,7 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS STRIC
|
|
|
3704
3702
|
"medium": 500,
|
|
3705
3703
|
"high": 2e3,
|
|
3706
3704
|
"max": 3500,
|
|
3707
|
-
"xhigh": 3500
|
|
3708
|
-
"off": 50,
|
|
3709
|
-
"fast": 50
|
|
3705
|
+
"xhigh": 3500
|
|
3710
3706
|
};
|
|
3711
3707
|
const cap = thinkingCaps[thinkingLevel?.toLowerCase()] || 2500;
|
|
3712
3708
|
let isOverVerboseThinking = wordCount > cap;
|
|
@@ -3727,25 +3723,57 @@ ${thinkingLevel != "Fast" ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS STRIC
|
|
|
3727
3723
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
3728
3724
|
break;
|
|
3729
3725
|
}
|
|
3730
|
-
const allWords = contextSafeText.split(/\s+/).filter((w) => w.length > 0);
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
for (let
|
|
3734
|
-
const
|
|
3735
|
-
|
|
3736
|
-
|
|
3726
|
+
const allWords = contextSafeText.toLowerCase().split(/\s+/).filter((w) => w.length > 0);
|
|
3727
|
+
let stutterDetected = false;
|
|
3728
|
+
if (allWords.length > 5) {
|
|
3729
|
+
for (let p = 1; p <= 15; p++) {
|
|
3730
|
+
const R = Math.max(3, Math.ceil(8 / p));
|
|
3731
|
+
if (allWords.length < p * R) continue;
|
|
3732
|
+
let isRepeating = true;
|
|
3733
|
+
const pattern = allWords.slice(allWords.length - p);
|
|
3734
|
+
const patternStr = pattern.join(" ");
|
|
3735
|
+
for (let r = 1; r < R; r++) {
|
|
3736
|
+
const prevPattern = allWords.slice(allWords.length - p * (r + 1), allWords.length - p * r);
|
|
3737
|
+
if (prevPattern.join(" ") !== patternStr) {
|
|
3738
|
+
isRepeating = false;
|
|
3739
|
+
break;
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
if (isRepeating) {
|
|
3737
3743
|
stutterDetected = true;
|
|
3738
3744
|
break;
|
|
3739
3745
|
}
|
|
3740
3746
|
}
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
+
}
|
|
3748
|
+
if (!stutterDetected) {
|
|
3749
|
+
const cleanChars = contextSafeText.toLowerCase().replace(/[^a-z0-9]/gi, "");
|
|
3750
|
+
if (cleanChars.length >= 10) {
|
|
3751
|
+
for (let p = 1; p <= 10; p++) {
|
|
3752
|
+
const R = Math.max(4, Math.ceil(12 / p));
|
|
3753
|
+
if (cleanChars.length < p * R) continue;
|
|
3754
|
+
const pattern = cleanChars.substring(cleanChars.length - p);
|
|
3755
|
+
let isRepeating = true;
|
|
3756
|
+
for (let r = 1; r < R; r++) {
|
|
3757
|
+
const prevPattern = cleanChars.substring(cleanChars.length - p * (r + 1), cleanChars.length - p * r);
|
|
3758
|
+
if (prevPattern !== pattern) {
|
|
3759
|
+
isRepeating = false;
|
|
3760
|
+
break;
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3763
|
+
if (isRepeating) {
|
|
3764
|
+
stutterDetected = true;
|
|
3765
|
+
break;
|
|
3766
|
+
}
|
|
3767
|
+
}
|
|
3747
3768
|
}
|
|
3748
3769
|
}
|
|
3770
|
+
if (stutterDetected) {
|
|
3771
|
+
yield { type: "status", content: `Stuttering Detected. Re-centering...` };
|
|
3772
|
+
isThinkingLoop = false;
|
|
3773
|
+
isStutteringLoop = true;
|
|
3774
|
+
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
3775
|
+
break;
|
|
3776
|
+
}
|
|
3749
3777
|
const toolActionableText = turnText.replace(/<think>[\s\S]*?(?:<\/think>|$)/gi, "");
|
|
3750
3778
|
const allToolsFound = detectToolCalls(toolActionableText);
|
|
3751
3779
|
while (allToolsFound.length > toolCallPointer) {
|
|
@@ -3981,7 +4009,7 @@ ${boxBottom}` };
|
|
|
3981
4009
|
throw err;
|
|
3982
4010
|
}
|
|
3983
4011
|
}
|
|
3984
|
-
if (turnText.trim().length > 0) {
|
|
4012
|
+
if (turnText.trim().length > 0 || accumulatedContext.length > 0) {
|
|
3985
4013
|
if (inStreamRetryCount <= MAX_RETRIES) {
|
|
3986
4014
|
inStreamRetryCount++;
|
|
3987
4015
|
const waitTime = Math.min(1e3 * Math.pow(2, inStreamRetryCount - 1), 24e3);
|
|
@@ -3989,8 +4017,7 @@ ${boxBottom}` };
|
|
|
3989
4017
|
if (toolResults.length > 0) {
|
|
3990
4018
|
toolResults.forEach((tr) => modifiedHistory.push(tr));
|
|
3991
4019
|
}
|
|
3992
|
-
modifiedHistory.push({ role: "user", text: "[SYSTEM] Response got cut for internal error, continue from checkpoint seamlessly, DON'T repeat what you already said! PICK UP FROM THE WORD IN A WAY THAT USER SHOULD NOT NOTICE ANY CUTOFF. Rules:\n- Do not reuse <think> if the thinking already started just continue from the word and end it properly.\n- If the cutoff was in middle of a tool call, start the tool call from start.\n- Visually the new pickup and continuation should look natual sentence flow.\n- DON'T try to think shorter, keep length standard." });
|
|
3993
|
-
isResponseCut = true;
|
|
4020
|
+
modifiedHistory.push({ role: "user", text: "[SYSTEM] Response got cut for internal error, continue from checkpoint seamlessly, DON'T repeat what you already said! PICK UP FROM THE WORD IN A WAY THAT USER SHOULD NOT NOTICE ANY CUTOFF. Rules:\n- Do not reuse <think> if the thinking already started just continue from the word and end it properly.\n- If the cutoff was in middle of a tool call, start the tool call from start.\n- Visually the new pickup and continuation should look natual sentence flow.\n- Dont mention about the cutoff.\n- DON'T try to think shorter, keep length standard." });
|
|
3994
4021
|
accumulatedContext += turnText;
|
|
3995
4022
|
for (let i = waitTime / 1e3; i > 0; i--) {
|
|
3996
4023
|
yield { type: "status", content: `Error Occured. Recovering Stream (${inStreamRetryCount}/${MAX_RETRIES}) [${i}s]...` };
|
|
@@ -4060,13 +4087,12 @@ ${timestamp}`;
|
|
|
4060
4087
|
if (isActuallyFinished) break;
|
|
4061
4088
|
const nextAgentMsg = cleanedTurnText.trim() || "*Working...*";
|
|
4062
4089
|
modifiedHistory.push({ role: "agent", text: nextAgentMsg });
|
|
4063
|
-
if (toolResults.length > 0
|
|
4090
|
+
if (toolResults.length > 0) {
|
|
4064
4091
|
toolResults.forEach((tr) => modifiedHistory.push(tr));
|
|
4065
4092
|
} else {
|
|
4066
4093
|
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 the execution/output. " : "If you have finished your task use [turn: finish] else continue."}`}` });
|
|
4067
4094
|
isThinkingLoop = false;
|
|
4068
4095
|
isStutteringLoop = false;
|
|
4069
|
-
isResponseCut = false;
|
|
4070
4096
|
}
|
|
4071
4097
|
}
|
|
4072
4098
|
yield { type: "status", content: null };
|