fluxflow-cli 3.4.0 → 3.4.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 +10 -19
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -11676,10 +11676,6 @@ var init_ai = __esm({
|
|
|
11676
11676
|
}
|
|
11677
11677
|
};
|
|
11678
11678
|
runJanitorTask = async (settings, agentText, fullAgentTextRaw, history, callbacks = {}) => {
|
|
11679
|
-
if (process.stdout.isTTY) {
|
|
11680
|
-
process.stdout.write(`\x1B]0;Finalizing...\x07`);
|
|
11681
|
-
process.stdout.write(`\x1B]633;P;TerminalTitle=Finalizing...\x07`);
|
|
11682
|
-
}
|
|
11683
11679
|
const USER_CONTEXT_LENGTH = 4 * (1024 * 2);
|
|
11684
11680
|
const AGENT_CONTEXT_LENGTH = 4 * (1024 * 8);
|
|
11685
11681
|
const { onStatus, onMemoryUpdated, onBackgroundIncrement } = callbacks;
|
|
@@ -11726,10 +11722,6 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
11726
11722
|
let attempts = 0;
|
|
11727
11723
|
const MAX_JANITOR_RETRIES = isMemoryEnabled ? 12 : -1;
|
|
11728
11724
|
while (attempts <= MAX_JANITOR_RETRIES) {
|
|
11729
|
-
if (process.stdout.isTTY) {
|
|
11730
|
-
process.stdout.write(`\x1B]0;Retrying Finalizing... (${attempts + 1})...\x07`);
|
|
11731
|
-
process.stdout.write(`\x1B]633;P;TerminalTitle=Retrying Finalizing... (${attempts + 1})...\x07`);
|
|
11732
|
-
}
|
|
11733
11725
|
try {
|
|
11734
11726
|
if (!await checkQuota("background", settings)) {
|
|
11735
11727
|
return;
|
|
@@ -11813,6 +11805,14 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
11813
11805
|
return { iterator: iterator2, firstResult: firstResult2 };
|
|
11814
11806
|
}
|
|
11815
11807
|
})();
|
|
11808
|
+
if (process.stdout.isTTY) {
|
|
11809
|
+
const historyIndex = await loadHistory();
|
|
11810
|
+
const chatData = historyIndex[chatId];
|
|
11811
|
+
const chatName = chatData?.name || "";
|
|
11812
|
+
const title = chatName && !chatName.startsWith("flow-") && !chatName.startsWith("Session ") ? chatName : "FluxFlow | Idle";
|
|
11813
|
+
process.stdout.write(`\x1B]0;${title}\x07`);
|
|
11814
|
+
process.stdout.write(`\x1B]633;P;TerminalTitle=${title}\x07`);
|
|
11815
|
+
}
|
|
11816
11816
|
const { iterator, firstResult } = await Promise.race([streamPromise, timeoutPromise]);
|
|
11817
11817
|
let { value: firstChunk, done: firstDone } = firstResult;
|
|
11818
11818
|
if (!firstDone && firstChunk) {
|
|
@@ -11900,9 +11900,6 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
11900
11900
|
} catch (err) {
|
|
11901
11901
|
attempts++;
|
|
11902
11902
|
const date = (/* @__PURE__ */ new Date()).toLocaleString();
|
|
11903
|
-
if (process.stdout.isTTY) {
|
|
11904
|
-
process.stdout.write(`\x1B]0;Finalizing Error\x07`);
|
|
11905
|
-
}
|
|
11906
11903
|
const errLog = err instanceof Error ? (() => {
|
|
11907
11904
|
try {
|
|
11908
11905
|
return JSON.parse(JSON.parse(err.message).error.message).error.message;
|
|
@@ -11926,12 +11923,6 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
11926
11923
|
fs23.appendFileSync(path22.join(janitorErrDir, "error.log"), `-----------------------------------------------------------------------------
|
|
11927
11924
|
|
|
11928
11925
|
`);
|
|
11929
|
-
if (attempts >= MAX_JANITOR_RETRIES) {
|
|
11930
|
-
if (process.stdout.isTTY) {
|
|
11931
|
-
process.stdout.write(`\x1B]0;${isMemoryEnabled ? "Finalizing Error" : "Finalizing Skipped"}\x07`);
|
|
11932
|
-
}
|
|
11933
|
-
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
11934
|
-
}
|
|
11935
11926
|
}
|
|
11936
11927
|
if (process.stdout.isTTY) {
|
|
11937
11928
|
try {
|
|
@@ -19245,10 +19236,10 @@ Selection: ${val}`,
|
|
|
19245
19236
|
const parts = chunkText.split(/<\/(think|thought)>/gi);
|
|
19246
19237
|
const thinkPart = parts[0] || "";
|
|
19247
19238
|
const agentPart = parts.slice(2).join("").replace(/<\/?(think|thought)>/gi, "");
|
|
19239
|
+
flushTypewriterNow();
|
|
19248
19240
|
activeStreamingMsgRef.current.text = flattenString(activeStreamingMsgRef.current.text + thinkPart);
|
|
19249
19241
|
const startTime = activeStreamingMsgRef.current.startTime || Date.now();
|
|
19250
19242
|
activeStreamingMsgRef.current.duration = Date.now() - startTime;
|
|
19251
|
-
flushTypewriterNow();
|
|
19252
19243
|
commitActiveStreamingMessage();
|
|
19253
19244
|
inThinkMode = false;
|
|
19254
19245
|
currentAgentId = "agent-" + Date.now();
|
|
@@ -19257,6 +19248,7 @@ Selection: ${val}`,
|
|
|
19257
19248
|
continue;
|
|
19258
19249
|
}
|
|
19259
19250
|
if (inThinkMode && activeStreamingMsgRef.current?.role === "think") {
|
|
19251
|
+
flushTypewriterNow();
|
|
19260
19252
|
const newText = activeStreamingMsgRef.current.text + chunkText;
|
|
19261
19253
|
if (newText.toLowerCase().includes("</think>")) {
|
|
19262
19254
|
const parts = newText.split(/<\/think>/gi);
|
|
@@ -19265,7 +19257,6 @@ Selection: ${val}`,
|
|
|
19265
19257
|
activeStreamingMsgRef.current.text = flattenString(thinkPart);
|
|
19266
19258
|
const startTime = activeStreamingMsgRef.current.startTime || Date.now();
|
|
19267
19259
|
activeStreamingMsgRef.current.duration = Date.now() - startTime;
|
|
19268
|
-
flushTypewriterNow();
|
|
19269
19260
|
commitActiveStreamingMessage();
|
|
19270
19261
|
inThinkMode = false;
|
|
19271
19262
|
currentAgentId = "agent-" + Date.now();
|