fluxflow-cli 1.19.4 → 1.19.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 +39 -32
- package/package.json +2 -2
package/dist/fluxflow.js
CHANGED
|
@@ -1176,17 +1176,16 @@ var init_main_tools = __esm({
|
|
|
1176
1176
|
Access to internal tools. MUST use the exact syntax on a new line: [tool:functions.ToolName(args)]
|
|
1177
1177
|
MANDATORY TOOL POLICY:
|
|
1178
1178
|
- **MAX 3 TOOL CALLS PER TURN. Next Turn, verify results, plan next**
|
|
1179
|
-
${mode === "" ? "-
|
|
1179
|
+
${mode === "Flux" ? "- USE multiple search & replace on patch tool if editing same file/path with many edits\n" : ""}- Use contextually BEST tool, no brute force, no spamming
|
|
1180
1180
|
${mode === "Flux" ? "- **File Tools >> Code in chat**\n" : ""}
|
|
1181
1181
|
- COMMUNICATION TOOLS -
|
|
1182
|
-
1. [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity Resolution. Mandatory Triggers: Path Divergence, Security, Risk Mitigation. ask >> finish
|
|
1183
|
-
Suggest best options; don't ask for preferences
|
|
1182
|
+
1. [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity Resolution. Mandatory Triggers: Path Divergence, Security, Risk Mitigation. ask >> finish. Suggest best options; don't ask for preferences
|
|
1184
1183
|
|
|
1185
1184
|
- WEB TOOLS -
|
|
1186
1185
|
1. [tool:functions.WebSearch(query="...", limit=number)]. Limit 3-10. Proactive use for unknown topics
|
|
1187
1186
|
2. [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api
|
|
1188
1187
|
|
|
1189
|
-
${mode === "Flux" ? `- PROJECT TOOLS (path = relative to CWD) -
|
|
1188
|
+
${mode === "Flux" ? `- PROJECT TOOLS (path = relative to CWD, path separator: '/') -
|
|
1190
1189
|
1. [tool:functions.ReadFile(path="...", startLine=number, endLine=number)]. Supports images/docs. User gives image/doc: VIEW FIRST
|
|
1191
1190
|
2. [tool:functions.ReadFolder(path="...")]. Detailed DIR stats
|
|
1192
1191
|
3. [tool:functions.PatchFile(path="...", replaceContent1="exact string", newContent1="...", ...MAX 8)]. Surgical Patch. **Multiple patch on same file/path? Use replaceContent2, newContent2 etc >>> multiple spams**. Unsure? ReadFile > guessing.
|
|
@@ -5472,6 +5471,8 @@ ${newMemoryListStr}
|
|
|
5472
5471
|
const { profile, thinkingLevel, mode, janitorModel, chatId, systemSettings, sessionStats } = settings;
|
|
5473
5472
|
const isMemoryEnabled = systemSettings?.memory !== false;
|
|
5474
5473
|
const originalText = history[history.length - 1].text;
|
|
5474
|
+
const summariesFile = path16.join(SECRET_DIR, "chat-summaries.json");
|
|
5475
|
+
let wasCompressedInStream = false;
|
|
5475
5476
|
const isFirstPrompt = history.filter((m) => m.role === "user").length === 1;
|
|
5476
5477
|
const hasTitleSignal = originalText.includes("[TITLE-UPDATE]");
|
|
5477
5478
|
const needTitle = isFirstPrompt || hasTitleSignal;
|
|
@@ -5480,19 +5481,7 @@ ${newMemoryListStr}
|
|
|
5480
5481
|
await RevertManager.startTransaction(chatId, agentText);
|
|
5481
5482
|
try {
|
|
5482
5483
|
let modifiedHistory = [...history.slice(0, -1)];
|
|
5483
|
-
|
|
5484
|
-
let summaries = readEncryptedJson(summariesFile, {});
|
|
5485
|
-
let chatDataObj = summaries[chatId] || { summary: "", historyLength: 0 };
|
|
5486
|
-
if (typeof chatDataObj === "string") {
|
|
5487
|
-
chatDataObj = { summary: chatDataObj, historyLength: 0 };
|
|
5488
|
-
}
|
|
5489
|
-
const incomingCleanLength = history.filter((m) => (m.role === "user" || m.role === "agent" || m.role === "system") && !String(m.id).startsWith("welcome") && !m.isMeta).length;
|
|
5490
|
-
if (incomingCleanLength < chatDataObj.historyLength) {
|
|
5491
|
-
delete summaries[chatId];
|
|
5492
|
-
writeEncryptedJson(summariesFile, summaries);
|
|
5493
|
-
chatDataObj = { summary: "", historyLength: 0 };
|
|
5494
|
-
}
|
|
5495
|
-
if (systemSettings?.compression === 0 && (sessionStats?.tokens || 0) > 254e3) {
|
|
5484
|
+
if (systemSettings?.compression === 0 && (sessionStats?.tokens || 0) > 244e3) {
|
|
5496
5485
|
yield { type: "status", content: "Condensing session context..." };
|
|
5497
5486
|
const flattenContext = (hist) => {
|
|
5498
5487
|
return hist.filter((m) => (m.role === "user" || m.role === "agent" || m.role === "system") && !String(m.id).startsWith("welcome") && !m.isMeta).map((m) => {
|
|
@@ -5518,7 +5507,7 @@ Provide a consolidated summary of the entire session.`;
|
|
|
5518
5507
|
contents: prompt,
|
|
5519
5508
|
config: {
|
|
5520
5509
|
systemInstruction,
|
|
5521
|
-
maxOutputTokens:
|
|
5510
|
+
maxOutputTokens: 4096,
|
|
5522
5511
|
temperature: 0.3,
|
|
5523
5512
|
safetySettings: [
|
|
5524
5513
|
{ category: HarmCategory.HARM_CATEGORY_HARASSMENT, threshold: HarmBlockThreshold.BLOCK_NONE },
|
|
@@ -5537,7 +5526,7 @@ Provide a consolidated summary of the entire session.`;
|
|
|
5537
5526
|
contents: prompt,
|
|
5538
5527
|
config: {
|
|
5539
5528
|
systemInstruction,
|
|
5540
|
-
maxOutputTokens:
|
|
5529
|
+
maxOutputTokens: 4096,
|
|
5541
5530
|
temperature: 0.3,
|
|
5542
5531
|
safetySettings: [
|
|
5543
5532
|
{ category: HarmCategory.HARM_CATEGORY_HARASSMENT, threshold: HarmBlockThreshold.BLOCK_NONE },
|
|
@@ -5556,7 +5545,7 @@ Provide a consolidated summary of the entire session.`;
|
|
|
5556
5545
|
contents: prompt,
|
|
5557
5546
|
config: {
|
|
5558
5547
|
systemInstruction,
|
|
5559
|
-
maxOutputTokens:
|
|
5548
|
+
maxOutputTokens: 4096,
|
|
5560
5549
|
temperature: 0.3,
|
|
5561
5550
|
safetySettings: [
|
|
5562
5551
|
{ category: HarmCategory.HARM_CATEGORY_HARASSMENT, threshold: HarmBlockThreshold.BLOCK_NONE },
|
|
@@ -5575,21 +5564,29 @@ Provide a consolidated summary of the entire session.`;
|
|
|
5575
5564
|
}
|
|
5576
5565
|
};
|
|
5577
5566
|
const flattenedText = flattenContext(modifiedHistory);
|
|
5578
|
-
|
|
5579
|
-
let chatData =
|
|
5567
|
+
const summaries2 = readEncryptedJson(summariesFile, {});
|
|
5568
|
+
let chatData = summaries2[chatId] || { summary: "", historyLength: 0 };
|
|
5580
5569
|
if (typeof chatData === "string") {
|
|
5581
5570
|
chatData = { summary: chatData, historyLength: 0 };
|
|
5582
5571
|
}
|
|
5572
|
+
const currentCleanLen2 = modifiedHistory.filter((m) => (m.role === "user" || m.role === "agent" || m.role === "system") && !String(m.id).startsWith("welcome") && !m.isMeta).length;
|
|
5573
|
+
if (chatData.historyLength && currentCleanLen2 < chatData.historyLength) {
|
|
5574
|
+
chatData.summary = "";
|
|
5575
|
+
chatData.historyLength = 0;
|
|
5576
|
+
summaries2[chatId] = chatData;
|
|
5577
|
+
writeEncryptedJson(summariesFile, summaries2);
|
|
5578
|
+
}
|
|
5583
5579
|
const oldSummary = chatData.summary || "";
|
|
5584
5580
|
const newSummary = await runCondenser(flattenedText, oldSummary);
|
|
5585
5581
|
if (newSummary) {
|
|
5586
5582
|
chatData.summary = newSummary;
|
|
5587
|
-
|
|
5588
|
-
writeEncryptedJson(summariesFile,
|
|
5583
|
+
summaries2[chatId] = chatData;
|
|
5584
|
+
writeEncryptedJson(summariesFile, summaries2);
|
|
5589
5585
|
modifiedHistory = [];
|
|
5586
|
+
wasCompressedInStream = true;
|
|
5590
5587
|
}
|
|
5591
5588
|
}
|
|
5592
|
-
if (systemSettings?.compression === 0 && (sessionStats?.tokens || 0) >
|
|
5589
|
+
if (systemSettings?.compression === 0 && (sessionStats?.tokens || 0) > 254e3) {
|
|
5593
5590
|
modifiedHistory = getTruncatedHistory(modifiedHistory, 6);
|
|
5594
5591
|
}
|
|
5595
5592
|
if (isFirstPrompt && isMemoryEnabled) {
|
|
@@ -5849,11 +5846,18 @@ Provide a consolidated summary of the entire session.`;
|
|
|
5849
5846
|
const cwdMismatch = lastCwd ? lastCwd !== process.cwd() : false;
|
|
5850
5847
|
chatPaths[chatId] = process.cwd();
|
|
5851
5848
|
writeEncryptedJson(PATHS_FILE, chatPaths);
|
|
5852
|
-
summaries = readEncryptedJson(summariesFile, {});
|
|
5853
|
-
chatDataObj = summaries[chatId] || { summary: "", historyLength: 0 };
|
|
5849
|
+
const summaries = readEncryptedJson(summariesFile, {});
|
|
5850
|
+
let chatDataObj = summaries[chatId] || { summary: "", historyLength: 0 };
|
|
5854
5851
|
if (typeof chatDataObj === "string") {
|
|
5855
5852
|
chatDataObj = { summary: chatDataObj, historyLength: 0 };
|
|
5856
5853
|
}
|
|
5854
|
+
const currentCleanLen = history.filter((m) => (m.role === "user" || m.role === "agent" || m.role === "system") && !String(m.id).startsWith("welcome") && !m.isMeta).length;
|
|
5855
|
+
if (chatDataObj.historyLength && currentCleanLen < chatDataObj.historyLength) {
|
|
5856
|
+
chatDataObj.summary = "";
|
|
5857
|
+
chatDataObj.historyLength = 0;
|
|
5858
|
+
summaries[chatId] = chatDataObj;
|
|
5859
|
+
writeEncryptedJson(summariesFile, summaries);
|
|
5860
|
+
}
|
|
5857
5861
|
const currentSummary = typeof chatDataObj === "object" ? chatDataObj.summary || "" : chatDataObj || "";
|
|
5858
5862
|
const summaryBlock = currentSummary ? `
|
|
5859
5863
|
|
|
@@ -5863,7 +5867,7 @@ ${currentSummary}
|
|
|
5863
5867
|
` : "";
|
|
5864
5868
|
let dirStructure = process.cwd() + "\n" + getDirTree(process.cwd(), dynamicMaxDepth);
|
|
5865
5869
|
const firstUserMsg = `[SYSTEM METADATA (PRIORITY: DYNAMIC), Chat Context >> Metadata] Time: ${dateTimeStr} | v${versionFluxflow2}
|
|
5866
|
-
CWD: ${process.cwd()}${cwdMismatch ? ` (CWD Mismatch! Previous Path: ${lastCwd})` : ""}
|
|
5870
|
+
CWD: ${process.cwd()}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
|
|
5867
5871
|
**DIRECTORY STRUCTURE**
|
|
5868
5872
|
${dirStructure}
|
|
5869
5873
|
${summaryBlock}
|
|
@@ -6796,16 +6800,19 @@ Error Log can be found in ${path16.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
6796
6800
|
modifiedHistory.push({ role: "agent", text: cleanedFullResponse });
|
|
6797
6801
|
}
|
|
6798
6802
|
try {
|
|
6799
|
-
const
|
|
6800
|
-
const summaries2 = readEncryptedJson(summariesFile2, {});
|
|
6803
|
+
const summaries2 = readEncryptedJson(summariesFile, {});
|
|
6801
6804
|
let existing = summaries2[chatId] || { summary: "", historyLength: 0 };
|
|
6802
6805
|
if (typeof existing === "string") {
|
|
6803
6806
|
existing = { summary: existing, historyLength: 0 };
|
|
6804
6807
|
}
|
|
6805
6808
|
const cleanLen = modifiedHistory.filter((m) => (m.role === "user" || m.role === "agent" || m.role === "system") && !String(m.id).startsWith("welcome") && !m.isMeta).length;
|
|
6806
|
-
|
|
6809
|
+
if (wasCompressedInStream) {
|
|
6810
|
+
existing.historyLength = (existing.historyLength || 0) + cleanLen;
|
|
6811
|
+
} else {
|
|
6812
|
+
existing.historyLength = cleanLen;
|
|
6813
|
+
}
|
|
6807
6814
|
summaries2[chatId] = existing;
|
|
6808
|
-
writeEncryptedJson(
|
|
6815
|
+
writeEncryptedJson(summariesFile, summaries2);
|
|
6809
6816
|
} catch (e) {
|
|
6810
6817
|
}
|
|
6811
6818
|
}
|