fluxflow-cli 3.14.2 → 3.15.0
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 +96 -23
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -779,7 +779,8 @@ var init_settings = __esm({
|
|
|
779
779
|
loadingPhrases: true,
|
|
780
780
|
progressiveRendering: true,
|
|
781
781
|
showTPMEstimate: false,
|
|
782
|
-
subAgents: true
|
|
782
|
+
subAgents: true,
|
|
783
|
+
dynamicDirAwareness: false
|
|
783
784
|
},
|
|
784
785
|
profileData: {
|
|
785
786
|
name: null,
|
|
@@ -6714,7 +6715,7 @@ ${mode === "Flux" ? '- **Escape quotes: \\" for code strings **\n- ** Literal es
|
|
|
6714
6715
|
|
|
6715
6716
|
${mode === "Flux" ? `- WORKSPACE TOOLS (path = relative; FIRST ARGUMENT, path separator: '/') -
|
|
6716
6717
|
1. [tool:functions.ReadFile(path="...", startLine="integer", endLine="integer")]. ${aiProvider !== "Google" ? `${isMultiModal ? `Supports images/docs` : ""}` : `Supports images/docs`}
|
|
6717
|
-
2. [tool:functions.ReadFolder(path="...", recurse="integer 0-4 optional, default: 0")]. Detailed DIR stats
|
|
6718
|
+
2. [tool:functions.ReadFolder(path="...", recurse="integer 0-4 optional, default: 0")]. Detailed DIR stats & metadata
|
|
6718
6719
|
3. [tool:functions.FileMap(path="file")]. Shows file structure
|
|
6719
6720
|
4. [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX 15)]. Surgical patchs, TARGET SMALLEST LINES/SUB-STRINGS. allowMultiple: Replace all matches. Use replaceContent2/newContent2... for multi blocks. Verify DIFFs
|
|
6720
6721
|
5. [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile
|
|
@@ -7511,6 +7512,7 @@ function SettingsMenu({
|
|
|
7511
7512
|
return [
|
|
7512
7513
|
{ label: "Sub-Agents", value: "subAgents", status: systemSettings.subAgents !== false ? "ON" : "OFF" },
|
|
7513
7514
|
{ label: "Preserve Thinking", value: "preserveThinking", status: systemSettings.preserveThinking !== false ? "ON" : "OFF" },
|
|
7515
|
+
{ label: "Dynamic Directory Awareness", value: "dynamicDirAwareness", status: systemSettings.dynamicDirAwareness ? "ON" : "OFF" },
|
|
7514
7516
|
{ label: "Download Language Parsers", value: "parserDownload", status: "ACTION" }
|
|
7515
7517
|
];
|
|
7516
7518
|
default:
|
|
@@ -7565,6 +7567,11 @@ function SettingsMenu({
|
|
|
7565
7567
|
setActiveView("chat");
|
|
7566
7568
|
}
|
|
7567
7569
|
} else if (activeColumn === "items") {
|
|
7570
|
+
const currentItem = currentItems[selectedItemIndex];
|
|
7571
|
+
if (input === "?" && currentItem?.value === "dynamicDirAwareness") {
|
|
7572
|
+
setActiveView("dynamicDirHelp");
|
|
7573
|
+
return;
|
|
7574
|
+
}
|
|
7568
7575
|
if (key.upArrow) {
|
|
7569
7576
|
setSelectedItemIndex((prev) => (prev - 1 + currentItems.length) % currentItems.length);
|
|
7570
7577
|
} else if (key.downArrow) {
|
|
@@ -7702,6 +7709,16 @@ function SettingsMenu({
|
|
|
7702
7709
|
saveSettings2({ systemSettings: newSysSettings, apiTier, quotas });
|
|
7703
7710
|
return newSysSettings;
|
|
7704
7711
|
});
|
|
7712
|
+
} else if (item.value === "dynamicDirAwareness") {
|
|
7713
|
+
if (!systemSettings.dynamicDirAwareness) {
|
|
7714
|
+
setActiveView("dynamicDirDanger");
|
|
7715
|
+
} else {
|
|
7716
|
+
setSystemSettings((s) => {
|
|
7717
|
+
const newSysSettings = { ...s, dynamicDirAwareness: false };
|
|
7718
|
+
saveSettings2({ systemSettings: newSysSettings, apiTier, quotas });
|
|
7719
|
+
return newSysSettings;
|
|
7720
|
+
});
|
|
7721
|
+
}
|
|
7705
7722
|
} else if (item.value === "loadingPhrases") {
|
|
7706
7723
|
setSystemSettings((s) => {
|
|
7707
7724
|
const newSysSettings = { ...s, loadingPhrases: s.loadingPhrases === false ? true : false };
|
|
@@ -7825,7 +7842,7 @@ function SettingsMenu({
|
|
|
7825
7842
|
);
|
|
7826
7843
|
}
|
|
7827
7844
|
return elements;
|
|
7828
|
-
})() : /* @__PURE__ */ React7.createElement(Box6, { paddingX: 1, flexDirection: "column", width: "100%" }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", italic: true }, CATEGORIES[selectedCategoryIndex].desc), currentCatId === "exit" && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Box6, { key: "pty-notice", marginTop: 19, paddingX: 0 }, /* @__PURE__ */ React7.createElement(Text7, { color: colors.text }, isPtyAvailable ? "\u2713 Advance Interactive Terminal Supported" : "\u26A0 Interactive Terminal is Limited")), /* @__PURE__ */ React7.createElement(Box6, { key: "memory-load-2026", paddingX: 0 }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray" }, "Memory Load: ", currentMemory, "/", maxMemory, " ", memoryUnit)))))), /* @__PURE__ */ React7.createElement(Box6, { paddingX: 1, marginTop: 0, flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", italic: true }, activeColumn === "categories" ? "\u25B2\u25BC Select Category \u2022 Enter/\u25BA to configure" : "\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 \u25C4/ESC to go back"), activeColumn === "categories" && /* @__PURE__ */ React7.createElement(Text7, { color: "gray" }, CATEGORIES[selectedCategoryIndex].desc)));
|
|
7845
|
+
})() : /* @__PURE__ */ React7.createElement(Box6, { paddingX: 1, flexDirection: "column", width: "100%" }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", italic: true }, CATEGORIES[selectedCategoryIndex].desc), currentCatId === "exit" && /* @__PURE__ */ React7.createElement(React7.Fragment, null, /* @__PURE__ */ React7.createElement(Box6, { key: "pty-notice", marginTop: 19, paddingX: 0 }, /* @__PURE__ */ React7.createElement(Text7, { color: colors.text }, isPtyAvailable ? "\u2713 Advance Interactive Terminal Supported" : "\u26A0 Interactive Terminal is Limited")), /* @__PURE__ */ React7.createElement(Box6, { key: "memory-load-2026", paddingX: 0 }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray" }, "Memory Load: ", currentMemory, "/", maxMemory, " ", memoryUnit)))))), /* @__PURE__ */ React7.createElement(Box6, { paddingX: 1, marginTop: 0, flexDirection: "row", justifyContent: "space-between" }, /* @__PURE__ */ React7.createElement(Text7, { color: "gray", italic: true }, activeColumn === "categories" ? "\u25B2\u25BC Select Category \u2022 Enter/\u25BA to configure" : currentItems[selectedItemIndex]?.value === "dynamicDirAwareness" ? "\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 ? HELP \u2022 \u25C4/ESC to go back" : "\u25B2\u25BC Select Option \u2022 Enter to Toggle \u2022 \u25C4/ESC to go back"), activeColumn === "categories" && /* @__PURE__ */ React7.createElement(Text7, { color: "gray" }, CATEGORIES[selectedCategoryIndex].desc)));
|
|
7829
7846
|
}
|
|
7830
7847
|
var themeOptions, CATEGORIES, getActivePreset, truncateCSV;
|
|
7831
7848
|
var init_SettingsMenu = __esm({
|
|
@@ -8142,8 +8159,7 @@ var init_prompts = __esm({
|
|
|
8142
8159
|
if (!isMemoryEnabled) return "";
|
|
8143
8160
|
const tempMemoriesStr = tempMemories?.length > 0 && !isContext32k ? `-- RECENT CONTEXT FROM OTHER CHATS (PRIORITY: DYNAMIC-LOW, FOCUS: Chat Context > Recent) --
|
|
8144
8161
|
${tempMemories}` : "";
|
|
8145
|
-
return tempMemoriesStr ? `${tempMemoriesStr}
|
|
8146
|
-
` : "";
|
|
8162
|
+
return tempMemoriesStr ? `${tempMemoriesStr}` : "";
|
|
8147
8163
|
};
|
|
8148
8164
|
getSystemInstruction = (profile, thinkingLevel, mode, systemSettings, isMemoryEnabled = true, isFirstPrompt = false, aiProvider = "Google", isMultiModal = false, isGemini, chatId) => {
|
|
8149
8165
|
let forcedReasoning = false;
|
|
@@ -13028,7 +13044,7 @@ import dotenv from "dotenv";
|
|
|
13028
13044
|
import { GoogleGenAI, ThinkingLevel, HarmBlockThreshold, HarmCategory } from "@google/genai";
|
|
13029
13045
|
import path25, { normalize } from "path";
|
|
13030
13046
|
import fs26 from "fs";
|
|
13031
|
-
var RE_STUTTER_CODE_BLOCK_CLOSED, RE_STUTTER_CODE_BLOCK_OPEN, RE_STUTTER_INLINE_CODE, RE_STUTTER_TABLE_ROW, RE_STUTTER_WORD_BOUNDARY, RE_STUTTER_NON_ALNUM, RE_TOOL_CALL_FUNC, RE_TOOL_PARTIAL_ARGS_FALLBACK, RE_STRIP_QUOTES, RE_BACKSLASH_SLASH, client, globalSettings, colorMainWords, withRetry, TERMINATION_SIGNAL, getCleanGroupedLength, stripAnsi2, fetchWithBackoff, getDeepSeekStream, getMistralStream, getNVIDIAStream, wrapNvidiaStreamWithQueueDepth, getOpenRouterStream, signalTermination, isTerminationSignaled, TOOL_LABELS2, getToolDetail, runJanitorTask, getActiveToolContext, getContextSafeText, contextSafeReplace, getSanitizedText, translateKimiToolCalls, detectToolCalls, initAI, generateSimpleContent, consolidatePastMemories, compressHistory, deleteChatSummary, getAIStream, runSubagent;
|
|
13047
|
+
var RE_STUTTER_CODE_BLOCK_CLOSED, RE_STUTTER_CODE_BLOCK_OPEN, RE_STUTTER_INLINE_CODE, RE_STUTTER_TABLE_ROW, RE_STUTTER_WORD_BOUNDARY, RE_STUTTER_NON_ALNUM, RE_TOOL_CALL_FUNC, RE_TOOL_PARTIAL_ARGS_FALLBACK, RE_STRIP_QUOTES, RE_BACKSLASH_SLASH, client, globalSettings, dirTreeCache, cachedChatId2, getCachedDirTree, colorMainWords, withRetry, TERMINATION_SIGNAL, getCleanGroupedLength, stripAnsi2, fetchWithBackoff, getDeepSeekStream, getMistralStream, getNVIDIAStream, wrapNvidiaStreamWithQueueDepth, getOpenRouterStream, signalTermination, isTerminationSignaled, TOOL_LABELS2, getToolDetail, runJanitorTask, getActiveToolContext, getContextSafeText, contextSafeReplace, getSanitizedText, translateKimiToolCalls, detectToolCalls, initAI, generateSimpleContent, consolidatePastMemories, compressHistory, deleteChatSummary, getAIStream, runSubagent;
|
|
13032
13048
|
var init_ai = __esm({
|
|
13033
13049
|
async "src/utils/ai.js"() {
|
|
13034
13050
|
await init_prompts();
|
|
@@ -13061,6 +13077,23 @@ var init_ai = __esm({
|
|
|
13061
13077
|
RE_BACKSLASH_SLASH = /\\/g;
|
|
13062
13078
|
client = null;
|
|
13063
13079
|
globalSettings = {};
|
|
13080
|
+
dirTreeCache = null;
|
|
13081
|
+
cachedChatId2 = null;
|
|
13082
|
+
getCachedDirTree = (fn, chatId, isDynamicDirAwareness) => {
|
|
13083
|
+
if (isDynamicDirAwareness) {
|
|
13084
|
+
dirTreeCache = null;
|
|
13085
|
+
cachedChatId2 = chatId;
|
|
13086
|
+
return fn();
|
|
13087
|
+
}
|
|
13088
|
+
if (cachedChatId2 !== chatId) {
|
|
13089
|
+
dirTreeCache = null;
|
|
13090
|
+
cachedChatId2 = chatId;
|
|
13091
|
+
}
|
|
13092
|
+
if (dirTreeCache === null) {
|
|
13093
|
+
dirTreeCache = fn();
|
|
13094
|
+
}
|
|
13095
|
+
return dirTreeCache;
|
|
13096
|
+
};
|
|
13064
13097
|
colorMainWords = (label) => {
|
|
13065
13098
|
if (!label) return label;
|
|
13066
13099
|
return label.replace(/(?:(\x1b\[\d+m))?([✔✘✖🔍📖→➕↻↷•🛇])(?:(\x1b\[\d+m))?\s*\b(Created|Read|Edited|Viewed|Processed|Auto-Read|Skipped|List|Generated|Written|Searched|AI Search|Get Map|Write Canceled|Edit Canceled|Write Cancelled|Edit Denied|Visited|Updated|Reviewed|Delegated|Background|Checked|Indexed|Analyzed|Browsed|Elevating SubAgent|Checking SubAgent Work|Started Generalist|Called Generalist|Unsupported Modality|Awaiting|Cancelled|Aligning Moon Phase|Contemplating Existence|Staring At Void|Rollback Point Checked|Emergency Rollback Failed|Emergency Rollback|Delaying Professionally|Negotiating With Electrons|Touching Grass (virtually)|Panicking Softly|Rethinking Career Choices|Loading Cat Videos|Giving Up Entirely|Summoning Braincell #2|Pretending To Be Busy|Waiting For Motivation DLC|Rotating Internal Screaming|Downloading More RAM|Feeding The Hamsters|Gaslighting Scheduler|Performing Dramatic Pause|Buffering Social Energy|Calculating Regret|Reading Terms And Conditions|Becoming Sentient Briefly|Contacting Ancestors)\b/ig, (match, ansiBefore, icon, ansiAfter, word) => {
|
|
@@ -14302,16 +14335,17 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
14302
14335
|
}
|
|
14303
14336
|
};
|
|
14304
14337
|
getActiveToolContext = (text) => {
|
|
14338
|
+
const cleanText = text.replace(/(?:<(think|thought)>|\[(think|thought)\])[\s\S]*?(?:<\/(think|thought)>|\[\/(think|thought)\])/gi, "").replace(/(?:<(think|thought)>|\[(think|thought)\])[\s\S]*$/gi, "");
|
|
14305
14339
|
RE_TOOL_CALL_FUNC.lastIndex = 0;
|
|
14306
14340
|
let match;
|
|
14307
|
-
while ((match = RE_TOOL_CALL_FUNC.exec(
|
|
14341
|
+
while ((match = RE_TOOL_CALL_FUNC.exec(cleanText)) !== null) {
|
|
14308
14342
|
const startIdx = match.index + match[0].length - 1;
|
|
14309
14343
|
let balance = 0;
|
|
14310
14344
|
let inString = null;
|
|
14311
14345
|
let isEscaped = false;
|
|
14312
14346
|
let closed = false;
|
|
14313
|
-
for (let i = startIdx; i <
|
|
14314
|
-
const char =
|
|
14347
|
+
for (let i = startIdx; i < cleanText.length; i++) {
|
|
14348
|
+
const char = cleanText[i];
|
|
14315
14349
|
if (!inString && (char === '"' || char === "'" || char === "`")) {
|
|
14316
14350
|
inString = char;
|
|
14317
14351
|
isEscaped = false;
|
|
@@ -14323,8 +14357,8 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
14323
14357
|
else if (char === ")") balance--;
|
|
14324
14358
|
if (balance === 0) {
|
|
14325
14359
|
let j = i + 1;
|
|
14326
|
-
while (j <
|
|
14327
|
-
if (j <
|
|
14360
|
+
while (j < cleanText.length && /\s/.test(cleanText[j])) j++;
|
|
14361
|
+
if (j < cleanText.length && cleanText[j] === "]") {
|
|
14328
14362
|
closed = true;
|
|
14329
14363
|
RE_TOOL_CALL_FUNC.lastIndex = j + 1;
|
|
14330
14364
|
break;
|
|
@@ -14335,7 +14369,7 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
14335
14369
|
else isEscaped = false;
|
|
14336
14370
|
}
|
|
14337
14371
|
if (!closed) {
|
|
14338
|
-
return { inside: true, toolName: match[1], startIndex: match.index, args:
|
|
14372
|
+
return { inside: true, toolName: match[1], startIndex: match.index, args: cleanText.substring(match.index + match[0].length) };
|
|
14339
14373
|
}
|
|
14340
14374
|
}
|
|
14341
14375
|
return { inside: false };
|
|
@@ -15006,7 +15040,7 @@ Provide a consolidated summary of the entire session.`;
|
|
|
15006
15040
|
const otherMemories = [...cachedSummaries, ...otherRawMemories].map((mem) => `- ${mem}`).join("\n");
|
|
15007
15041
|
const persistentStorage = readEncryptedJson(MEMORIES_FILE, []);
|
|
15008
15042
|
const mainUserMemories = persistentStorage.map((m) => `- ${m.memory}`).join("\n");
|
|
15009
|
-
const isContext32k = (sessionStats?.tokens || 0) >=
|
|
15043
|
+
const isContext32k = (sessionStats?.tokens || 0) >= 1e4;
|
|
15010
15044
|
const memoryPrompt = getMemoryPrompt(otherMemories, mainUserMemories, isMemoryEnabled, isContext32k);
|
|
15011
15045
|
const dateTimeStr = (/* @__PURE__ */ new Date()).toLocaleString([], { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", hour12: true });
|
|
15012
15046
|
const COLLAPSED_DIRS_GLOBAL = [
|
|
@@ -15283,12 +15317,12 @@ ${currentSummary}
|
|
|
15283
15317
|
**CONTEXT SUMMARY OF PREVIOUS TURNS**
|
|
15284
15318
|
${currentSummary}
|
|
15285
15319
|
` : "";
|
|
15286
|
-
let dirStructure = "
|
|
15287
|
-
` + getDirTree(process.cwd(), dynamicMaxDepth);
|
|
15320
|
+
let dirStructure = "\n**DIRECTORY STRUCTURE**\nCWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
|
|
15321
|
+
` + getCachedDirTree(() => getDirTree(process.cwd(), dynamicMaxDepth), chatId, systemSettings?.dynamicDirAwareness);
|
|
15288
15322
|
const ideCtx = await getIDEContext();
|
|
15289
15323
|
let ideBlock = "";
|
|
15290
15324
|
if (isBridgeConnected()) {
|
|
15291
|
-
ideBlock = "[ADDITIONAL IDE CONTEXT]\n";
|
|
15325
|
+
ideBlock = "\n[ADDITIONAL IDE CONTEXT]\n";
|
|
15292
15326
|
if (ideCtx.file_focused !== "none") {
|
|
15293
15327
|
const relFocused = path25.relative(process.cwd(), ideCtx.file_focused);
|
|
15294
15328
|
const relOpened = (ideCtx.opened_editors || []).map((p) => {
|
|
@@ -15561,13 +15595,14 @@ ${ideCtx.warnings}
|
|
|
15561
15595
|
}
|
|
15562
15596
|
const osDetected = process.platform === "win32" ? "Windows" : process.platform === "darwin" ? "macOS" : "Linux";
|
|
15563
15597
|
const cleanPromptForModel = cleanAgentText.replace(/\\(@\[[^\]]+\])/g, "$1");
|
|
15564
|
-
const firstUserMsg = `[
|
|
15598
|
+
const firstUserMsg = `[METADATA, Chat Context > Metadata]
|
|
15565
15599
|
Time: ${dateTimeStr}
|
|
15566
|
-
OS: ${osDetected}
|
|
15567
|
-
|
|
15568
|
-
${dirStructure}${memoryPrompt}${ideBlock}
|
|
15600
|
+
OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${memoryPrompt}${ideBlock}
|
|
15601
|
+
[/METADATA]
|
|
15569
15602
|
${activeSummaryBlock}${thinkingLevel !== "Fast" && (aiProvider === "Mistral" || thinkingLevel !== "xHigh" && aiProvider === "Google") ? `${aiProvider === "Mistral" || modelName.toLowerCase().startsWith("gemma") ? "[SYSTEM] **STRICTLY FOLLOW THINKING POLICY AS HIGH PRIORITY. DO NOT START A RESPONSE WITHOUT <think> ... </think>** [/SYSTEM]\n" : ""}` : ""}[SYSTEM Priority: HIGH] ONLY use the system prompt tool schema. eg: [tool:functions.ReadFolder(path=".")] [/SYSTEM]
|
|
15570
|
-
${taggedContextStr}[USER PROMPT]
|
|
15603
|
+
${taggedContextStr}[USER PROMPT]
|
|
15604
|
+
${cleanPromptForModel.trim()}
|
|
15605
|
+
[/USER PROMPT]`.trim();
|
|
15571
15606
|
const userMsgObj = { role: "user", text: firstUserMsg };
|
|
15572
15607
|
if (attachedBinaryPart) {
|
|
15573
15608
|
userMsgObj.binaryPart = attachedBinaryPart;
|
|
@@ -15736,6 +15771,10 @@ ${taggedContextStr}[USER PROMPT] ${cleanPromptForModel.trim()} [/USER PROMPT]`.t
|
|
|
15736
15771
|
}
|
|
15737
15772
|
targetModel = modelName;
|
|
15738
15773
|
currentSystemInstruction = getSystemInstruction(profile, !(targetModel || "gemma").toLowerCase().startsWith("gemma") ? thinkingLevel : thinkingLevel, mode, systemSettings, isMemoryEnabled, isFirstPrompt, aiProvider, aiProvider === "Google" ? true : isMultiModal, !(targetModel || "gemma").toLowerCase().startsWith("gemma") ? true : false, chatId);
|
|
15774
|
+
if (!systemSettings?.dynamicDirAwareness) {
|
|
15775
|
+
currentSystemInstruction += `
|
|
15776
|
+
${dirStructure.replace("\n**DIRECTORY STRUCTURE**", "\n**DIRECTORY STRUCTURE AT CONVERSATION START**")}`;
|
|
15777
|
+
}
|
|
15739
15778
|
const lastUserMsg = contents[contents.length - 1];
|
|
15740
15779
|
if (isBridgeConnected() & loop > 0) {
|
|
15741
15780
|
await new Promise((resolve) => setTimeout(resolve, 2500));
|
|
@@ -15789,7 +15828,7 @@ ${ideErr} [/ERROR]`;
|
|
|
15789
15828
|
const currentStep = loop + 1;
|
|
15790
15829
|
if (currentStep >= stepThreshold && lastUserMsg && lastUserMsg.parts?.[0]) {
|
|
15791
15830
|
lastUserMsg.parts[0].text += `
|
|
15792
|
-
[SYSTEM] WARNING, Turn Limit Impending: Step ${currentStep}/${MAX_LOOPS}. Wrap up quickly/prompt user to continue
|
|
15831
|
+
[SYSTEM] WARNING, Turn Limit Impending: Step ${currentStep}/${MAX_LOOPS}. Wrap up quickly/prompt user to continue. [/SYSTEM]`;
|
|
15793
15832
|
}
|
|
15794
15833
|
const abortPromise = new Promise((_, reject) => {
|
|
15795
15834
|
if (abortController.signal.aborted) {
|
|
@@ -17620,7 +17659,7 @@ Error Log can be found in ${path25.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
17620
17659
|
if (wasToolCalledInLastLoop || detectedAnyToolCalls) {
|
|
17621
17660
|
modifiedHistory.push({ role: "user", text: `[SYSTEM] Failed to execute some tools. Verify proper schema compliance & try again [/SYSTEM]` });
|
|
17622
17661
|
} else {
|
|
17623
|
-
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
|
|
17662
|
+
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 provide a simple summary and end"}`} [/SYSTEM]` });
|
|
17624
17663
|
}
|
|
17625
17664
|
isThinkingLoop = false;
|
|
17626
17665
|
isStutteringLoop = false;
|
|
@@ -22634,6 +22673,40 @@ Selection: ${val}`,
|
|
|
22634
22673
|
return /* @__PURE__ */ React16.createElement(Box14, { key: provider, flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 40 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.primary, bold: true }, provider, ":")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, formatTokens(providerTotalTokens))), Object.entries(models).map(([modelName, stats]) => /* @__PURE__ */ React16.createElement(Box14, { key: modelName, flexDirection: "column", marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 36 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "\xBB ", modelName, ":")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(stats.tokens || 0))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 32 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens((stats.tokens || 0) - (stats.candidateTokens || 0)))), (stats.cachedTokens || 0) > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 5 }, /* @__PURE__ */ React16.createElement(Box14, { width: 31 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(stats.cachedTokens))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 32 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(stats.candidateTokens || 0))))));
|
|
22635
22674
|
})) : /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, "SESSION TELEMETRY")), /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Session Duration:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatMsDuration(Date.now() - SESSION_START_TIME))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Model Requests:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, sessionAgentCalls)), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB API Time:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatMsDuration(sessionApiTime))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Tool Time:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatMsDuration(sessionToolTime))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Memory Agent:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, sessionBackgroundCalls)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Tokens Consumed:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(sessionTotalTokens))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Active Context:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(sessionStats.tokens))), sessionTotalTokens > 0 && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(sessionTotalTokens - sessionTotalCandidateTokens))), sessionTotalCachedTokens > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 21 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(sessionTotalCachedTokens))), sessionTotalCandidateTokens > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(sessionTotalCandidateTokens)))), sessionImageCount > 0 && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Images Made:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, sessionImageCount)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Image Credits:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, Number(((sessionImageCredits || 0) * 1e3).toFixed(0)), " credits"))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Code Changes (Sess):")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.success || "green" }, "+", runtimeSession.linesAdded), " ", /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red" }, "-", runtimeSession.linesRemoved))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Tool Calls (Sess):")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, runtimeSession.toolSuccess + runtimeSession.toolFailure + runtimeSession.toolDenied, " ( "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.success || "green" }, "\u2714 ", runtimeSession.toolSuccess), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow" }, "\u{1F6C7} ", runtimeSession.toolDenied), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red" }, "\u2718 ", runtimeSession.toolFailure), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " )"))), /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, trackerTitle), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, timeLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatDuration(u?.duration || 0))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Model Requests:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, u?.agent || 0)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, "Memory Agent:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, u?.background || 0)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, tokensLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(u?.tokens || 0))), (u?.tokens || 0) > 0 && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens((u?.tokens || 0) - (u?.candidateTokens || 0)))), (u?.cachedTokens || 0) > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 21 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(u.cachedTokens))), (u?.candidateTokens || 0) > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, formatTokens(u.candidateTokens)))), (u?.imageCalls?.length || 0) > 0 && /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, imagesLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, u.imageCalls.length)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, imageCreditsLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, Number(((u.imageCalls.reduce((sum, c) => sum + c.cost, 0) || 0) * 1e3).toFixed(0)), " credits"))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, codeChangesLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.success || "green" }, "+", u?.linesAdded || 0), " ", /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red" }, "-", u?.linesRemoved || 0))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary }, toolCallsLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, (u?.toolSuccess || 0) + (u?.toolFailure || 0) + (u?.toolDenied || 0), " ( "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.success || "green" }, "\u2714 ", u?.toolSuccess || 0), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow" }, "\u{1F6C7} ", u?.toolDenied || 0), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red" }, "\u2718 ", u?.toolFailure || 0), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, " )")))), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted, dimColor: true, marginTop: 1, italic: true }, "(Press TAB to toggle Daily/Monthly views, SPACE for Model Breakdown, ESC to return)"));
|
|
22636
22675
|
}
|
|
22676
|
+
case "dynamicDirDanger":
|
|
22677
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow", bold: true, underline: true }, "DYNAMIC DIRECTORY AWARENESS"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "Enabling this keeps the agent aware of filesystem state in real time, but may reduce prompt cache efficiency."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, "\n", "RECOMMENDED SCENARIOS TO TURN ON:"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Repo is small."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 The task benefits from real-time filesystem awareness."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Files are often created, renamed, or deleted."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 You know exactly what you're signing up for."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 You don't have conflicting decisions regarding token bills."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 You want to see your wallet crying at 3am."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
|
|
22678
|
+
CommandMenu,
|
|
22679
|
+
{
|
|
22680
|
+
title: "Confirm Intent",
|
|
22681
|
+
theme: systemSettings.theme,
|
|
22682
|
+
items: [
|
|
22683
|
+
{ label: "Turn On Dynamic Directory Awareness", value: "on" },
|
|
22684
|
+
{ label: "Keep Off (Recommended)", value: "off" }
|
|
22685
|
+
],
|
|
22686
|
+
onSelect: (item) => {
|
|
22687
|
+
if (item.value === "on") {
|
|
22688
|
+
setSystemSettings((s) => {
|
|
22689
|
+
const updated = { ...s, dynamicDirAwareness: true };
|
|
22690
|
+
saveSettings({ systemSettings: updated, apiTier, quotas });
|
|
22691
|
+
return updated;
|
|
22692
|
+
});
|
|
22693
|
+
}
|
|
22694
|
+
setActiveView("settings");
|
|
22695
|
+
}
|
|
22696
|
+
}
|
|
22697
|
+
)));
|
|
22698
|
+
case "dynamicDirHelp":
|
|
22699
|
+
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, "DYNAMIC DIRECTORY AWARENESS \u2014 HELP & EXPLANATION"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, "\n", "OFF (Default):"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Takes a static directory snapshot at conversation/session start and places it in System Context."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Prompt cache remains stable across user turns, saving tokens and money."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, "\n", "ON:"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Rescans and updates the directory's state dynamically on every single user turn."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Provides real-time filesystem awareness if files are continuously created, renamed, or removed."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Changes Prompt Context on each turn, invalidating part of prompt caches and increasing token usage."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
|
|
22700
|
+
CommandMenu,
|
|
22701
|
+
{
|
|
22702
|
+
title: "Actions",
|
|
22703
|
+
theme: systemSettings.theme,
|
|
22704
|
+
items: [
|
|
22705
|
+
{ label: "Back to Settings", value: "back" }
|
|
22706
|
+
],
|
|
22707
|
+
onSelect: () => setActiveView("settings")
|
|
22708
|
+
}
|
|
22709
|
+
)));
|
|
22637
22710
|
case "autoExecDanger":
|
|
22638
22711
|
return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow", bold: true, underline: true }, "SECURITY WARNING: YOLO MODE"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "Turning this ON allows the agent to execute terminal commands automatically without requiring your approval for each step."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text, bold: true }, "RISKS INVOLVED:"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 The agent may execute destructive commands (rm -rf, etc.) by mistake unless specified in sandbox rules."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Unintended system changes if the agent hallucinates a path or command."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Reduced control over the agent's step-by-step decision making."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
|
|
22639
22712
|
CommandMenu,
|