fluxflow-cli 1.8.23 → 1.8.25
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 +24 -25
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -737,10 +737,10 @@ Use tools contextually when needed, don't flood with unnecessary tool calls.
|
|
|
737
737
|
var JANITOR_TOOLS_PROTOCOL;
|
|
738
738
|
var init_janitor_tools = __esm({
|
|
739
739
|
"src/data/janitor_tools.js"() {
|
|
740
|
-
JANITOR_TOOLS_PROTOCOL = (isMemoryEnabled = true, needTitle =
|
|
740
|
+
JANITOR_TOOLS_PROTOCOL = (isMemoryEnabled = true, needTitle = true) => `
|
|
741
741
|
${needTitle ? `-- START CHAT MANAGEMENT TOOLS --
|
|
742
742
|
1. YOU MUST UPDATE CHAT TITLE (URGENT PRIORITY):
|
|
743
|
-
tool:functions.chat(title='<short
|
|
743
|
+
tool:functions.chat(title='<short creative title of FULL conversation in 3-5 words>') // consider full chat context to generate title NOT just latest message.
|
|
744
744
|
-- END CHAT MANAGEMENT TOOLS --
|
|
745
745
|
|
|
746
746
|
` : ""}
|
|
@@ -748,7 +748,7 @@ ${needTitle ? `-- START CHAT MANAGEMENT TOOLS --
|
|
|
748
748
|
Your tool syntax is: 'tool:functions.function_name(args...)'
|
|
749
749
|
You have access to the following memory functions to persist important information:
|
|
750
750
|
|
|
751
|
-
1. Temporary context (
|
|
751
|
+
1. Temporary context (URGENT PRIORITY):
|
|
752
752
|
tool:functions.memory(action='temp', content='<summary of the user prompt & model responses ONLY FROM LATEST PROMPT UNDER 40 WORDS>. [Talked on: <date> <hour>]')
|
|
753
753
|
|
|
754
754
|
${isMemoryEnabled ? `2. User-specific long-term memory (USE BASED ON CONVERSATION CONTEXT):
|
|
@@ -891,7 +891,7 @@ When you 'finish' an agentic loop, you will lose your previous turn 'thinking' d
|
|
|
891
891
|
Current date and Time is: ${dateTimeStr}
|
|
892
892
|
--- END SYSTEM INSTRUCTION ---`.trim();
|
|
893
893
|
};
|
|
894
|
-
getJanitorInstruction = (originalText, agentRaws, userMemories = "", isMemoryEnabled = true, needTitle =
|
|
894
|
+
getJanitorInstruction = (originalText, agentRaws, userMemories = "", isMemoryEnabled = true, needTitle = true) => {
|
|
895
895
|
let agentRes = `${agentRaws.replace(/tool:functions\..*\n/g, "").replace(/<think>.*<\/think>/g, "").replace(/\[Prompted on:.*?\]/g, "").replace(/\[turn: continue\]/g, "").replace(/\[turn: finish\]/g, "").replace(/\[TOOL_RESULTS\]/g, "").replace(/\[tool_results\]/g, "").substring(0, 3500)}`;
|
|
896
896
|
if (agentRes.length > 3500) {
|
|
897
897
|
agentRes += "\n... (truncated) ...";
|
|
@@ -2465,7 +2465,7 @@ var init_ai = __esm({
|
|
|
2465
2465
|
signalTermination = () => {
|
|
2466
2466
|
TERMINATION_SIGNAL = true;
|
|
2467
2467
|
};
|
|
2468
|
-
runJanitorTask = async (settings, agentText, fullAgentTextRaw, history,
|
|
2468
|
+
runJanitorTask = async (settings, agentText, fullAgentTextRaw, history, callbacks = {}) => {
|
|
2469
2469
|
const { onStatus, onMemoryUpdated, onBackgroundIncrement } = callbacks;
|
|
2470
2470
|
const { profile, thinkingLevel, mode, janitorModel, chatId, systemSettings, sessionStats } = settings;
|
|
2471
2471
|
const isMemoryEnabled = systemSettings?.memory !== false;
|
|
@@ -2476,30 +2476,27 @@ var init_ai = __esm({
|
|
|
2476
2476
|
parts: [{ text: msg.text.replace(/<think>[\s\S]*?<\/think>/g, "").trim() }]
|
|
2477
2477
|
}));
|
|
2478
2478
|
const cleanedFullResponse = fullAgentTextRaw.replace(/<think>[\s\S]*?<\/think>/g, "").trim();
|
|
2479
|
-
let thisRngHas40pChanceToBehave = Math.random() < 0.41;
|
|
2480
|
-
let generateTitle = needTitle || thisRngHas40pChanceToBehave;
|
|
2481
2479
|
const janitorPrompt = getJanitorInstruction(
|
|
2482
2480
|
agentText,
|
|
2483
2481
|
cleanedFullResponse,
|
|
2484
2482
|
janitorUserMemories,
|
|
2485
2483
|
isMemoryEnabled,
|
|
2486
|
-
|
|
2484
|
+
true
|
|
2487
2485
|
);
|
|
2488
2486
|
janitorContents.push({ role: "user", parts: [{ text: janitorPrompt }] });
|
|
2489
2487
|
let finalSynthesis = "";
|
|
2490
2488
|
let attempts = 0;
|
|
2491
|
-
const MAX_JANITOR_RETRIES =
|
|
2489
|
+
const MAX_JANITOR_RETRIES = 4;
|
|
2492
2490
|
while (attempts <= MAX_JANITOR_RETRIES) {
|
|
2493
2491
|
try {
|
|
2494
2492
|
if (!await checkQuota("background", settings)) {
|
|
2495
|
-
console.warn("Quota Exhausted for Background Model. Skipping refinement.");
|
|
2496
2493
|
return;
|
|
2497
2494
|
}
|
|
2498
2495
|
let fullContent = "";
|
|
2499
2496
|
let lastUsage = null;
|
|
2500
2497
|
try {
|
|
2501
2498
|
const timeoutPromise = new Promise(
|
|
2502
|
-
(_, reject) => setTimeout(() => reject(new Error("JANITOR_TIMEOUT")),
|
|
2499
|
+
(_, reject) => setTimeout(() => reject(new Error("JANITOR_TIMEOUT")), 6e4)
|
|
2503
2500
|
);
|
|
2504
2501
|
const streamPromise = (async () => {
|
|
2505
2502
|
const stream = await client.models.generateContentStream({
|
|
@@ -2539,9 +2536,6 @@ var init_ai = __esm({
|
|
|
2539
2536
|
}
|
|
2540
2537
|
}
|
|
2541
2538
|
} catch (e) {
|
|
2542
|
-
if (e.message === "JANITOR_TIMEOUT") {
|
|
2543
|
-
console.error("Janitor API Timeout: No tokens received within 30s.");
|
|
2544
|
-
}
|
|
2545
2539
|
throw e;
|
|
2546
2540
|
}
|
|
2547
2541
|
if (fullContent) {
|
|
@@ -2584,11 +2578,11 @@ DEBUG [${date}]: ${finalSynthesis}
|
|
|
2584
2578
|
|
|
2585
2579
|
`);
|
|
2586
2580
|
if (attempts > MAX_JANITOR_RETRIES) break;
|
|
2587
|
-
const backoff = Math.min(1e3 * Math.pow(2, attempts - 1),
|
|
2581
|
+
const backoff = Math.min(1e3 * Math.pow(2, attempts - 1), 8e3);
|
|
2588
2582
|
await new Promise((resolve) => setTimeout(resolve, backoff));
|
|
2589
2583
|
}
|
|
2590
2584
|
}
|
|
2591
|
-
if (attempts
|
|
2585
|
+
if (attempts) {
|
|
2592
2586
|
const janitorErrDir = path16.join(LOGS_DIR, "janitor");
|
|
2593
2587
|
fs16.appendFileSync(path16.join(janitorErrDir, "error.log"), `-----------------------------------------------------------------------------
|
|
2594
2588
|
|
|
@@ -2801,7 +2795,7 @@ DEBUG [${date}]: ${finalSynthesis}
|
|
|
2801
2795
|
modifiedHistory.push({ role: "user", text: firstUserMsg });
|
|
2802
2796
|
let lastUsage = null;
|
|
2803
2797
|
const MAX_LOOPS = mode === "Flux" ? 50 : 7;
|
|
2804
|
-
const MAX_RETRIES =
|
|
2798
|
+
const MAX_RETRIES = 16;
|
|
2805
2799
|
yield { type: "status", content: "Connecting..." };
|
|
2806
2800
|
TERMINATION_SIGNAL = false;
|
|
2807
2801
|
let fullAgentResponseChunks = [];
|
|
@@ -2867,10 +2861,10 @@ DEBUG [${date}]: ${finalSynthesis}
|
|
|
2867
2861
|
throw new Error("Error: Daily Quota Exausted for Agent");
|
|
2868
2862
|
}
|
|
2869
2863
|
let targetModel = modelName;
|
|
2870
|
-
if (retryCount ===
|
|
2864
|
+
if (retryCount === MAX_RETRIES - 1) {
|
|
2871
2865
|
targetModel = "gemini-3-flash-preview";
|
|
2872
2866
|
yield { type: "model_update", content: "Trying with fallback model" };
|
|
2873
|
-
} else if (retryCount
|
|
2867
|
+
} else if (retryCount === MAX_RETRIES) {
|
|
2874
2868
|
targetModel = "gemini-3.1-flash-lite-preview";
|
|
2875
2869
|
yield { type: "model_update", content: "Trying with fallback model lite" };
|
|
2876
2870
|
} else if (retryCount > 0) {
|
|
@@ -3200,15 +3194,17 @@ ${boxBottom}
|
|
|
3200
3194
|
if (turnText.trim().length > 0) {
|
|
3201
3195
|
if (inStreamRetryCount <= MAX_RETRIES) {
|
|
3202
3196
|
inStreamRetryCount++;
|
|
3203
|
-
const waitTime = Math.min(1e3 * Math.pow(2, inStreamRetryCount - 1),
|
|
3197
|
+
const waitTime = Math.min(1e3 * Math.pow(2, inStreamRetryCount - 1), 24e3);
|
|
3204
3198
|
modifiedHistory.push({ role: "agent", text: turnText });
|
|
3205
3199
|
if (toolResults.length > 0) {
|
|
3206
3200
|
toolResults.forEach((tr) => modifiedHistory.push(tr));
|
|
3207
3201
|
}
|
|
3208
3202
|
modifiedHistory.push({ role: "user", text: "[SYSTEM] Response got cut for internal error, continue from checkpoint seamlessly and DON'T repeat what you already said!" });
|
|
3209
3203
|
accumulatedContext += turnText;
|
|
3210
|
-
|
|
3211
|
-
|
|
3204
|
+
for (let i = waitTime / 1e3; i > 0; i--) {
|
|
3205
|
+
yield { type: "status", content: `Error Occured. Recovering Stream (${inStreamRetryCount}/${MAX_RETRIES}) [${i}s]...` };
|
|
3206
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
3207
|
+
}
|
|
3212
3208
|
yield { type: "status", content: `Error Occured. Recovering Stream...` };
|
|
3213
3209
|
} else {
|
|
3214
3210
|
throw new Error(`Stream collapsed too many times. (Failed to resolve ${MAX_RETRIES} times)
|
|
@@ -3217,10 +3213,13 @@ Error Log can be found in ${path16.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
3217
3213
|
} else {
|
|
3218
3214
|
if (retryCount <= MAX_RETRIES) {
|
|
3219
3215
|
retryCount++;
|
|
3220
|
-
const waitTime = Math.min(1e3 * Math.pow(2, retryCount - 1),
|
|
3216
|
+
const waitTime = Math.min(1e3 * Math.pow(2, retryCount - 1), 32e3);
|
|
3221
3217
|
isInitialAttempt = true;
|
|
3222
3218
|
yield { type: "status", content: `Retrying Connection (${retryCount}/${MAX_RETRIES}) [${(waitTime / 1e3).toFixed(0)}s]...` };
|
|
3223
|
-
|
|
3219
|
+
for (let i = waitTime / 1e3; i > 0; i--) {
|
|
3220
|
+
yield { type: "status", content: `Retrying Connection (${retryCount}/${MAX_RETRIES}) [${i}s]...` };
|
|
3221
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
3222
|
+
}
|
|
3224
3223
|
yield { type: "status", content: `Retrying Connection...` };
|
|
3225
3224
|
} else {
|
|
3226
3225
|
throw new Error(`Model cannot be reached. (Failed ${MAX_RETRIES} times)
|
|
@@ -5234,7 +5233,7 @@ var init_app = __esm({
|
|
|
5234
5233
|
init_text();
|
|
5235
5234
|
SESSION_START_TIME = Date.now();
|
|
5236
5235
|
CHANGELOG_URL = "https://fluxflow-cli.onrender.com/changelog.html";
|
|
5237
|
-
versionFluxflow = "1.8.
|
|
5236
|
+
versionFluxflow = "1.8.25";
|
|
5238
5237
|
updatedOn = "2026-05-11";
|
|
5239
5238
|
ResolutionModal = ({ data, onResolve, onEdit }) => /* @__PURE__ */ React10.createElement(Box10, { flexDirection: "column", borderStyle: "round", borderColor: "magenta", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React10.createElement(Text10, { color: "magenta", bold: true, underline: true }, "\u{1F7E3} STEERING HINT RESOLUTION"), /* @__PURE__ */ React10.createElement(Text10, { marginTop: 1 }, "The agent already finished the task before your hint was consumed."), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1, backgroundColor: "#222", paddingX: 1, width: "100%" }, /* @__PURE__ */ React10.createElement(Text10, { italic: true, color: "gray" }, '"', data, '"')), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(Text10, { color: "cyan" }, "How would you like to proceed?")), /* @__PURE__ */ React10.createElement(Box10, { marginTop: 1 }, /* @__PURE__ */ React10.createElement(
|
|
5240
5239
|
CommandMenu,
|