fluxflow-cli 3.12.1 → 3.12.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 +201 -123
- package/package.json +1 -1
package/dist/fluxflow.js
CHANGED
|
@@ -466,7 +466,8 @@ var init_settings = __esm({
|
|
|
466
466
|
preserveThinking: true,
|
|
467
467
|
loadingPhrases: true,
|
|
468
468
|
progressiveRendering: true,
|
|
469
|
-
showTPMEstimate: false
|
|
469
|
+
showTPMEstimate: false,
|
|
470
|
+
subAgents: true
|
|
470
471
|
},
|
|
471
472
|
profileData: {
|
|
472
473
|
name: null,
|
|
@@ -4800,7 +4801,7 @@ ${coloredArt[7]}`;
|
|
|
4800
4801
|
import React4, { useState as useState4, useEffect as useEffect3, useRef as useRef2 } from "react";
|
|
4801
4802
|
import { Box as Box3, Text as Text4 } from "ink";
|
|
4802
4803
|
import { diffWordsWithSpace } from "diff";
|
|
4803
|
-
var useStreamingText, formatThinkText, REGEX_MD_TOKENS, REGEX_LATEX_FRAC, REGEX_LATEX_STYLE, parseMathSymbols, SYNTAX_KEYWORDS, SYNTAX_RULES, REGEX_SYNTAX, tokenCache, MAX_TOKEN_CACHE_SIZE, tokenizeLine, renderHighlightedLine, renderLatexText, InlineMarkdown, TableRenderer, MarkdownText, DiffLine, DiffBlock, CodeRenderer, formatThinkingDuration, MessageItem, BlockItem, ChatLayout;
|
|
4804
|
+
var useStreamingText, formatThinkText, REGEX_MD_TOKENS, REGEX_LATEX_FRAC, REGEX_LATEX_STYLE, REGEX_MATH_MULT, REGEX_MATH_DIV, REGEX_MATH_CDOT, REGEX_MATH_INFTY, REGEX_MATH_PM, REGEX_MATH_LEQ, REGEX_MATH_GEQ, REGEX_MATH_NEQ, REGEX_MATH_SQRT1, REGEX_MATH_SQRT2, REGEX_MATH_ALPHA, REGEX_MATH_BETA, REGEX_MATH_THETA, REGEX_MATH_PI, REGEX_MATH_APPROX, REGEX_MATH_DELTA, REGEX_MATH_SIGMA, REGEX_MATH_SUM, REGEX_MATH_PROD, REGEX_MATH_ARROW, REGEX_MATH_LONE_LR, REGEX_MATH_LR_PAREN, REGEX_MATH_LR_BRACK, REGEX_MATH_LR_CURLY, REGEX_MATH_TEXT1, REGEX_MATH_TEXT2, REGEX_MATH_PCT, REGEX_MATH_BARE_PAREN, REGEX_MATH_BARE_BRACK, REGEX_AT_REF, REGEX_COLON_L, REGEX_MD_LINK_PAREN, REGEX_MD_LINK_BRACKET, REGEX_LATEX_CMD, parseMathSymbols, SYNTAX_KEYWORDS, SYNTAX_RULES, REGEX_SYNTAX, tokenCache, MAX_TOKEN_CACHE_SIZE, tokenizeLine, renderHighlightedLine, renderLatexText, InlineMarkdown, TableRenderer, MarkdownText, DiffLine, DiffBlock, CodeRenderer, formatThinkingDuration, MessageItem, BlockItem, ChatLayout;
|
|
4804
4805
|
var init_ChatLayout = __esm({
|
|
4805
4806
|
"src/components/ChatLayout.jsx"() {
|
|
4806
4807
|
init_TerminalBox();
|
|
@@ -4836,11 +4837,45 @@ var init_ChatLayout = __esm({
|
|
|
4836
4837
|
return /* @__PURE__ */ React4.createElement(MarkdownText, { key: i, text: cleanPart, color: "gray", columns: availableWidth, italic: true });
|
|
4837
4838
|
}));
|
|
4838
4839
|
};
|
|
4839
|
-
REGEX_MD_TOKENS = /(```[\s\S]*?```|`[^`]+`|@\[.*?\]
|
|
4840
|
+
REGEX_MD_TOKENS = /(```[\s\S]*?```|`[^`]+`|@\[.*?\]|\*\*.*?\*\*|\*.*?\*|\\\(.*?\\\)|\\\[.*?\\\]|\$.*?\$|\[.*?\]\s*\(.*?\)|\[.*?\]\s*\[.*?\]|https?:\/\/[^\s]+)/g;
|
|
4840
4841
|
REGEX_LATEX_FRAC = /\\frac\s*\{([^{}]*)\}\s*\{([^{}]*)\}/g;
|
|
4841
4842
|
REGEX_LATEX_STYLE = /(\\(?:mathbf|textbf|textit|underline|texttt)\{[^{}]*\})/g;
|
|
4843
|
+
REGEX_MATH_MULT = /\\multiply|\\mul|\\times/g;
|
|
4844
|
+
REGEX_MATH_DIV = /\\div/g;
|
|
4845
|
+
REGEX_MATH_CDOT = /\\cdot/g;
|
|
4846
|
+
REGEX_MATH_INFTY = /\\infty/g;
|
|
4847
|
+
REGEX_MATH_PM = /\\pm/g;
|
|
4848
|
+
REGEX_MATH_LEQ = /\\leq/g;
|
|
4849
|
+
REGEX_MATH_GEQ = /\\geq/g;
|
|
4850
|
+
REGEX_MATH_NEQ = /\\neq/g;
|
|
4851
|
+
REGEX_MATH_SQRT1 = /\\sqrt\s*\{([^}]+)\}/g;
|
|
4852
|
+
REGEX_MATH_SQRT2 = /\\sqrt\s*(\w+|\d+)/g;
|
|
4853
|
+
REGEX_MATH_ALPHA = /\\alpha/g;
|
|
4854
|
+
REGEX_MATH_BETA = /\\beta/g;
|
|
4855
|
+
REGEX_MATH_THETA = /\\theta/g;
|
|
4856
|
+
REGEX_MATH_PI = /\\pi/g;
|
|
4857
|
+
REGEX_MATH_APPROX = /\\approx/g;
|
|
4858
|
+
REGEX_MATH_DELTA = /\\Delta/g;
|
|
4859
|
+
REGEX_MATH_SIGMA = /\\sigma/g;
|
|
4860
|
+
REGEX_MATH_SUM = /\\sum/g;
|
|
4861
|
+
REGEX_MATH_PROD = /\\prod/g;
|
|
4862
|
+
REGEX_MATH_ARROW = /\\rightarrow|\\to/g;
|
|
4863
|
+
REGEX_MATH_LONE_LR = /\\left\b|\\right\b/g;
|
|
4864
|
+
REGEX_MATH_LR_PAREN = /\\left\(|\\right\)/g;
|
|
4865
|
+
REGEX_MATH_LR_BRACK = /\\left\[|\\right\]/g;
|
|
4866
|
+
REGEX_MATH_LR_CURLY = /\\\{|\\\}/g;
|
|
4867
|
+
REGEX_MATH_TEXT1 = /\\text\s*\{([^}]+)\}/g;
|
|
4868
|
+
REGEX_MATH_TEXT2 = /\\text\s+(\w+)/g;
|
|
4869
|
+
REGEX_MATH_PCT = /\\%/g;
|
|
4870
|
+
REGEX_MATH_BARE_PAREN = /\\\(|\\\)/g;
|
|
4871
|
+
REGEX_MATH_BARE_BRACK = /\\\[|\\\]/g;
|
|
4872
|
+
REGEX_AT_REF = /@\[(.*?)\]/g;
|
|
4873
|
+
REGEX_COLON_L = /:L/gi;
|
|
4874
|
+
REGEX_MD_LINK_PAREN = /\[(.*?)\]\s*\((.*?)\)/;
|
|
4875
|
+
REGEX_MD_LINK_BRACKET = /\[(.*?)\]\s*\[(.*?)\]/;
|
|
4876
|
+
REGEX_LATEX_CMD = /\\(\w+)\{([^{}]*)\}/;
|
|
4842
4877
|
parseMathSymbols = (content) => {
|
|
4843
|
-
return content.replace(
|
|
4878
|
+
return content.replace(REGEX_MATH_BARE_PAREN, (match) => match.includes("(") ? "(" : ")").replace(REGEX_MATH_BARE_BRACK, (match) => match.includes("[") ? "[" : "]").replace(REGEX_MATH_MULT, "\xD7").replace(REGEX_MATH_DIV, "\xF7").replace(REGEX_MATH_CDOT, "\u22C5").replace(REGEX_MATH_INFTY, "\u221E").replace(REGEX_MATH_PM, "\xB1").replace(REGEX_MATH_LEQ, "\u2264").replace(REGEX_MATH_GEQ, "\u2265").replace(REGEX_MATH_NEQ, "\u2260").replace(REGEX_MATH_SQRT1, "\u221A($1)").replace(REGEX_MATH_SQRT2, "\u221A($1)").replace(REGEX_MATH_ALPHA, "\u03B1").replace(REGEX_MATH_BETA, "\u03B2").replace(REGEX_MATH_THETA, "\u03B8").replace(REGEX_MATH_PI, "\u03C0").replace(REGEX_MATH_APPROX, "\u2248").replace(REGEX_MATH_DELTA, "\u0394").replace(REGEX_MATH_SIGMA, "\u03C3").replace(REGEX_MATH_SUM, "\u03A3").replace(REGEX_MATH_PROD, "\u03A0").replace(REGEX_MATH_ARROW, "\u2192").replace(REGEX_MATH_LONE_LR, "").replace(REGEX_MATH_LR_PAREN, (match) => match.includes("left") ? "(" : ")").replace(REGEX_MATH_LR_BRACK, (match) => match.includes("left") ? "[" : "]").replace(REGEX_MATH_LR_CURLY, (match) => match.includes("{") ? "{" : "}").replace(REGEX_MATH_TEXT1, "$1").replace(REGEX_MATH_TEXT2, "$1").replace(REGEX_MATH_PCT, "%");
|
|
4844
4879
|
};
|
|
4845
4880
|
SYNTAX_KEYWORDS = /\b(const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|import|export|from|default|class|extends|new|this|typeof|instanceof|try|catch|finally|throw|async|await|yield|public|private|protected|static|void|int|float|double|char|bool|boolean|def|elif|fn|pub|mut|struct|impl|enum|type|interface|package|namespace|using|include|define|nil|None|self|lambda)\b/;
|
|
4846
4881
|
SYNTAX_RULES = [
|
|
@@ -4917,7 +4952,7 @@ var init_ChatLayout = __esm({
|
|
|
4917
4952
|
const parts = formatted.split(REGEX_LATEX_STYLE);
|
|
4918
4953
|
return /* @__PURE__ */ React4.createElement(React4.Fragment, { key }, parts.map((p, idx) => {
|
|
4919
4954
|
if (p.startsWith("\\")) {
|
|
4920
|
-
const match = p.match(
|
|
4955
|
+
const match = p.match(REGEX_LATEX_CMD);
|
|
4921
4956
|
if (match) {
|
|
4922
4957
|
const cmd = match[1];
|
|
4923
4958
|
const inner = match[2];
|
|
@@ -4950,27 +4985,31 @@ var init_ChatLayout = __esm({
|
|
|
4950
4985
|
}
|
|
4951
4986
|
if (part.startsWith("`") && part.endsWith("`")) {
|
|
4952
4987
|
const content = part.slice(1, -1);
|
|
4953
|
-
const formatted = content.replace(
|
|
4954
|
-
return p1.split("/").pop().split("\\").pop().replace(
|
|
4988
|
+
const formatted = content.replace(REGEX_AT_REF, (match, p1) => {
|
|
4989
|
+
return p1.split("/").pop().split("\\").pop().replace(REGEX_COLON_L, "#L");
|
|
4955
4990
|
});
|
|
4956
4991
|
const hasFileRef = content.includes("@[");
|
|
4957
4992
|
return /* @__PURE__ */ React4.createElement(Text4, { key: j, color: "cyan", bold: hasFileRef }, formatted);
|
|
4958
4993
|
}
|
|
4959
4994
|
if (part.startsWith("@[") && part.endsWith("]")) {
|
|
4960
4995
|
const filePath = part.slice(2, -1);
|
|
4961
|
-
const basename = filePath.split("/").pop().split("\\").pop().replace(
|
|
4996
|
+
const basename = filePath.split("/").pop().split("\\").pop().replace(REGEX_COLON_L, "#L");
|
|
4962
4997
|
return /* @__PURE__ */ React4.createElement(Text4, { key: j, color: "cyan", bold: true }, basename);
|
|
4963
4998
|
}
|
|
4999
|
+
if (part.startsWith("\\(") && part.endsWith("\\)") || part.startsWith("\\[") && part.endsWith("\\]")) {
|
|
5000
|
+
const content = part.slice(2, -2);
|
|
5001
|
+
return /* @__PURE__ */ React4.createElement(Text4, { key: j, color: "yellow" }, renderLatexText(content, j));
|
|
5002
|
+
}
|
|
4964
5003
|
if (part.startsWith("$") && part.endsWith("$")) {
|
|
4965
5004
|
const content = part.slice(1, -1);
|
|
4966
5005
|
return /* @__PURE__ */ React4.createElement(Text4, { key: j, color: "yellow" }, renderLatexText(content, j));
|
|
4967
5006
|
}
|
|
4968
5007
|
if (part.startsWith("[") && (part.includes("](") || part.includes("] ("))) {
|
|
4969
|
-
const match = part.match(
|
|
5008
|
+
const match = part.match(REGEX_MD_LINK_PAREN);
|
|
4970
5009
|
if (match) return /* @__PURE__ */ React4.createElement(Text4, { key: j }, /* @__PURE__ */ React4.createElement(Text4, { color: "cyan", underline: true, bold: true }, match[1]), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", italic: true }, " (", match[2], ")"));
|
|
4971
5010
|
}
|
|
4972
5011
|
if (part.startsWith("[") && (part.includes("][") || part.includes("] ["))) {
|
|
4973
|
-
const match = part.match(
|
|
5012
|
+
const match = part.match(REGEX_MD_LINK_BRACKET);
|
|
4974
5013
|
if (match) return /* @__PURE__ */ React4.createElement(Text4, { key: j }, /* @__PURE__ */ React4.createElement(Text4, { color: "cyan", underline: true, bold: true }, match[1]), /* @__PURE__ */ React4.createElement(Text4, { color: "gray", italic: true }, " [", match[2], "]"));
|
|
4975
5014
|
}
|
|
4976
5015
|
if (part.startsWith("http")) {
|
|
@@ -6045,45 +6084,44 @@ var init_main_tools = __esm({
|
|
|
6045
6084
|
}
|
|
6046
6085
|
return _isPsAvailable;
|
|
6047
6086
|
};
|
|
6048
|
-
TOOL_PROTOCOL = (mode, osDetected, isMultiModal, aiProvider, advanceRollback = false) => `
|
|
6087
|
+
TOOL_PROTOCOL = (mode, osDetected, isMultiModal, aiProvider, advanceRollback = false, enableSubAgents = true) => `
|
|
6049
6088
|
-- TOOL DEFINITIONS --
|
|
6050
|
-
|
|
6089
|
+
Tool calls: ONLY use [tool:functions.ToolName(args)]
|
|
6051
6090
|
**NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
|
|
6052
6091
|
|
|
6053
6092
|
**TOOL USAGE POLICY:**
|
|
6054
|
-
-
|
|
6055
|
-
${mode === "Flux" ? "-
|
|
6093
|
+
- MAX 3 TOOL CALLS/TURN${mode === "Flux" ? " (Todo: 3+, Run: max 1 or 2 consecutive)" : ""}
|
|
6094
|
+
${mode === "Flux" ? "- Same file, many edits? Prefer multi search-replace in Patch \u2190 **HIGHLY RECOMMENDED**\n- Tool denied?Use Ask immediately for user guidance.NEVER proceed blindly/end turn \u2190 ** MANDATORY **\n- FileMap \u2192 ReadFile for efficient file understanding\n- Need specific text ? SearchKeyword > Guessing/ReadFile\n- Huge files ? SearchKeyword > FileMap/Full Read\n- No tool spamming\n- **Update/complete Todos from realtime progress EVERY TURN**" : ""}
|
|
6056
6095
|
${mode === "Flux" ? "- **File Tools >> Code in chat**\n\n" : ""}- COMMUNICATION TOOLS -
|
|
6057
|
-
1. [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity
|
|
6096
|
+
1. [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity: MUST ask for path divergence, security or risk. Ask, don't finish/guess. Suggest best options; no preferences. Keep options short
|
|
6058
6097
|
|
|
6059
6098
|
- WEB TOOLS -
|
|
6060
|
-
1. [tool:functions.WebSearch(query="...", aiMode="true optional", limit=number)]. Limit 3-10 (
|
|
6099
|
+
1. [tool:functions.WebSearch(query="...", aiMode="true optional", limit=number)]. Limit 3-10 (aiMode ignores). Usage: unknown info/docs. aiMode: LLM search (default: false)
|
|
6061
6100
|
2. [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api
|
|
6062
6101
|
|
|
6063
|
-
${mode === "Flux" ? `- WORKSPACE TOOLS (path = relative
|
|
6102
|
+
${mode === "Flux" ? `- WORKSPACE TOOLS (path = relative; FIRST ARGUMENT, path separator: '/') -
|
|
6064
6103
|
1. [tool:functions.ReadFile(path="...", startLine=number, endLine=number)]. ${aiProvider !== "Google" ? `${isMultiModal ? `Supports images/docs. **User gives image/doc: VIEW FIRST**` : `No Multimodal support`}` : `Supports images/docs. **User gives image/doc: VIEW FIRST**`}
|
|
6065
6104
|
2. [tool:functions.ReadFolder(path="...")]. Detailed DIR stats including File Sizes
|
|
6066
6105
|
3. [tool:functions.FileMap(path="path/file")]. Shows file structure, functions, class, import/export, variables
|
|
6067
|
-
4. [tool:functions.PatchFile(path="...", replaceContent1="full
|
|
6106
|
+
4. [tool:functions.PatchFile(path="...", replaceContent1="full lines", newContent1="...", ...MAX 10)]. Surgical patch. Multiple patches same file? Use replaceContent2/newContent2... Unsure? ReadFile. MUST VERIFY DIFF
|
|
6068
6107
|
5. [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. Verify Imports
|
|
6069
|
-
6. [tool:functions.SearchKeyword(keyword="...",
|
|
6070
|
-
7. [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL
|
|
6071
|
-
8. [tool:functions.Todo(method="create/append/get", tasks=[ARRAY OF STRINGS], markDone=[ARRAY OF TASK STRINGS])]. Task
|
|
6072
|
-
9. [tool:functions.Await(time="seconds")]. For waiting without exiting agent loop, 15s - 180s
|
|
6108
|
+
6. [tool:functions.SearchKeyword(keyword="...", path="optional, target directory or filename", subString="true optional", regex="false for keyword, optional")]. Project-wide search. path limits scope to a file/dir. Find definitions/logic without full reads. Locate relevant code. Defaults: subString=false, regex=true
|
|
6109
|
+
7. [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL` : `WINDOWS CMD ONLY` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user
|
|
6110
|
+
8. [tool:functions.Todo(method="create/append/get", tasks=[ARRAY OF STRINGS], markDone=[ARRAY OF TASK STRINGS])]. Task list, no Markdown in arrays. Analyze request: if multi-task, break it down & create Todos BEFORE starting. \`tasks\` & \`markDone\` optional with \`get\`. Use \`get + markDone\` to complete tasks, or \`create + markDone\` to create completed tasks. **UPDATE EVERY TURN**${enableSubAgents ? '\n9. [tool:functions.Await(time="seconds")]. For waiting without exiting agent loop, 15s - 180s' : ""}
|
|
6073
6111
|
${advanceRollback ? `
|
|
6074
6112
|
- EMERGENCY SAFETY TOOLS -
|
|
6075
|
-
Info:
|
|
6076
|
-
1. [tool:functions.EmergencyRollback(method="getCheckpoint/forceRevert", id="...")]. Rollback workspace to a
|
|
6077
|
-
|
|
6078
|
-
` : ""}
|
|
6113
|
+
Info: \`initial\` = user prompt for current task. Revert \`id\` = turn BEFORE the disaster tool (e.g. disaster:\`turn_3\` \u2192 revert:\`turn_2\`). Reason explicitly if needed.
|
|
6114
|
+
1. [tool:functions.EmergencyRollback(method="getCheckpoint/forceRevert", id="...")]. Rollback workspace to a checkpoint in THIS agent loop.
|
|
6115
|
+
Use ONLY for catastrophic/codebase corruption. Before ending loop, verify no catastrophe. \`id\` not required with \`getCheckPoint\`.
|
|
6116
|
+
` : ""}${enableSubAgents ? `
|
|
6079
6117
|
- SUB AGENT TOOLS -
|
|
6080
|
-
**PROACTIVE
|
|
6081
|
-
|
|
6082
|
-
- Invoke (async
|
|
6083
|
-
- InvokeSync (sync
|
|
6084
|
-
1. [agent:generalist.InvokeSync/Invoke(title="...", task="...")]. Task must
|
|
6085
|
-
2. [agent:generalist.GetProgress(id="...")].
|
|
6086
|
-
3. [agent:generalist.Cancel(id="...")].
|
|
6118
|
+
**PROACTIVE sub-agent use HIGHLY RECOMMENDED. Prefer for any task with even slight benefit, no user nudge needed.**
|
|
6119
|
+
Invocations:
|
|
6120
|
+
- Invoke (async/background, \u22647 parallel). Parallelize long tasks. NEVER repeat while active
|
|
6121
|
+
- InvokeSync (sync/blocking). Sequential, repetitive or delegated tasks. Saves tokens/cost
|
|
6122
|
+
1. [agent:generalist.InvokeSync/Invoke(title="...", task="...")]. Task must be detailed: exact file paths, imports/exports, dependencies & folder structure
|
|
6123
|
+
2. [agent:generalist.GetProgress(id="...")]. Check async task progress. If still running, continue your work. Wait exponentially longer between checks. NEVER spam GetProgress
|
|
6124
|
+
3. [agent:generalist.Cancel(id="...")]. Cancel async task ONLY if stalled (2m+) or clearly incorrect` : ""}`.trim() : `- CREATIVE TOOLS (path = relative to CWD & WILL BE FIRST ARGUMENT, path separator: '/') -
|
|
6087
6125
|
1. [tool:functions.WritePDF(path="...", content="...", orientation="...")]. PROACTIVE A4 PAGE BREAKS MUST IN CSS. HTML/CSS for PREMIUM layout, stable margins & headers/footers, NO WATERMARKS
|
|
6088
6126
|
2. [tool:functions.WriteDoc(path="...", content="...")]. A4 Word document, NO WATERMARKS, stable margins & headers/footers
|
|
6089
6127
|
- WORKSPACE & SUB AGENT TOOLS ARE NOT AVAILABLE IN FLOW`.trim()}
|
|
@@ -6854,6 +6892,7 @@ function SettingsMenu({
|
|
|
6854
6892
|
];
|
|
6855
6893
|
case "other":
|
|
6856
6894
|
return [
|
|
6895
|
+
{ label: "Sub-Agents", value: "subAgents", status: systemSettings.subAgents !== false ? "ON" : "OFF" },
|
|
6857
6896
|
{ label: "Preserve Thinking", value: "preserveThinking", status: systemSettings.preserveThinking !== false ? "ON" : "OFF" },
|
|
6858
6897
|
{ label: "Download Language Parsers", value: "parserDownload", status: "ACTION" }
|
|
6859
6898
|
];
|
|
@@ -7011,6 +7050,12 @@ function SettingsMenu({
|
|
|
7011
7050
|
setActiveView("updateManager");
|
|
7012
7051
|
} else if (item.value === "parserDownload") {
|
|
7013
7052
|
setActiveView("parserDownload");
|
|
7053
|
+
} else if (item.value === "subAgents") {
|
|
7054
|
+
setSystemSettings((s) => {
|
|
7055
|
+
const newSysSettings = { ...s, subAgents: s.subAgents === false ? true : false };
|
|
7056
|
+
saveSettings2({ systemSettings: newSysSettings, apiTier, quotas });
|
|
7057
|
+
return newSysSettings;
|
|
7058
|
+
});
|
|
7014
7059
|
} else if (item.value === "preserveThinking") {
|
|
7015
7060
|
setSystemSettings((s) => {
|
|
7016
7061
|
const newSysSettings = { ...s, preserveThinking: s.preserveThinking === false ? true : false };
|
|
@@ -7376,8 +7421,6 @@ Explicit Triggers for permanent memory:
|
|
|
7376
7421
|
Usage Rules:
|
|
7377
7422
|
- Frequency for 'user' action: Based on explicit triggers.
|
|
7378
7423
|
- IF YOU WANT TO SAVE SOMETHING, BUT SIMILAR MEMORY ALREADY EXISTS, USE THE UPDATE METHOD NOT ADD
|
|
7379
|
-
|
|
7380
|
-
Usage Rules:
|
|
7381
7424
|
- Chat Title is MANDATORY
|
|
7382
7425
|
- TEMPORARY Memory is MANDATORY
|
|
7383
7426
|
- WHEN Called User Memory, STILL use Temporary Memory
|
|
@@ -7390,11 +7433,11 @@ var thinking_prompts_default;
|
|
|
7390
7433
|
var init_thinking_prompts = __esm({
|
|
7391
7434
|
"src/data/thinking_prompts.json"() {
|
|
7392
7435
|
thinking_prompts_default = {
|
|
7393
|
-
xHigh: "EFFORT LEVEL: HIGH\
|
|
7394
|
-
High: "EFFORT LEVEL: HIGH\nThink in a rigorous
|
|
7395
|
-
Medium: "EFFORT LEVEL: MEDIUM\nThink in a focused,
|
|
7396
|
-
Minimal: "EFFORT LEVEL: LOW\nThink in a quick, focused monologue within <think>...</think>.
|
|
7397
|
-
Off: "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify
|
|
7436
|
+
xHigh: "EFFORT LEVEL: HIGH\nChallenge assumptions. Verify before concluding\nPrefer the simplest correct solution\nAssess architecture, scalability & trade-offs\nVerify dependencies, regressions, failure modes & modularity\nPlan implementation: files, modules, interfaces & tests\nRULES:\n- Continuous analytical flow\n- Verify via first principles\n- Actively seek failure paths\n- Verify imports & system stability, avoid syntax errors, recheck tool results\n- MANDATORY THINKING: Full technical verification",
|
|
7437
|
+
High: "EFFORT LEVEL: HIGH\nThink in a rigorous monologue within <think>...</think>\nPrefer the simplest correct solution\nAssess architecture, performance & maintainability\nVerify error handling, assumptions, edge cases, dependencies & regressions\nPlan: files, functions, logic & interactions\nRULES:\n- Continuous analytical flow\n- Verify via first principles\n- Actively seek failure paths\n- Verify imports & system stability, avoid syntax errors, recheck tool results\n- MANDATORY THINKING: Full technical verification",
|
|
7438
|
+
Medium: "EFFORT LEVEL: MEDIUM\nThink in a focused, technical monologue within <think>...</think>\nFind the simplest solution meeting requirements\nScan for missing error handling, invalid assumptions, edge cases & dependencies\nVerify cohesive, modular changes\nOutline changes: files, functions & key logic\nRULES:\n- Clean logical flow\n- Efficient, deliberate, implementation-focused\n- Verify imports & system stability, avoid syntax errors, recheck tool results\n- MANDATORY THINKING: Brief verification for technical tasks/greetings",
|
|
7439
|
+
Minimal: "EFFORT LEVEL: LOW\nThink in a quick, focused monologue within <think>...</think>. Verify Basics:\nConfirm intent & complexity\nIdentify required tools/files/actions\nVerify before acting\nRULES:\n- Brief thoughts\n- Think only enough to avoid obvious mistakes\n- Verify imports & system stability, avoid syntax errors, recheck tool results",
|
|
7440
|
+
Off: "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify imports & system stability, avoid syntax errors, recheck tool results"
|
|
7398
7441
|
};
|
|
7399
7442
|
}
|
|
7400
7443
|
});
|
|
@@ -7443,8 +7486,7 @@ var init_prompts = __esm({
|
|
|
7443
7486
|
if (!isMemoryEnabled) return "";
|
|
7444
7487
|
const tempMemoriesStr = tempMemories?.length > 0 && !isContext32k ? `-- RECENT CONTEXT FROM OTHER CHATS (PRIORITY: DYNAMIC-LOW, FOCUS: Chat Context > Recent) --
|
|
7445
7488
|
${tempMemories}` : "";
|
|
7446
|
-
return tempMemoriesStr ?
|
|
7447
|
-
${tempMemoriesStr}
|
|
7489
|
+
return tempMemoriesStr ? `${tempMemoriesStr}
|
|
7448
7490
|
` : "";
|
|
7449
7491
|
};
|
|
7450
7492
|
getSystemInstruction = (profile, thinkingLevel, mode, systemSettings, isMemoryEnabled = true, isFirstPrompt = false, aiProvider = "Google", isMultiModal = false, isGemini, chatId) => {
|
|
@@ -7468,10 +7510,11 @@ ${tempMemoriesStr}
|
|
|
7468
7510
|
"Max": "HIGH"
|
|
7469
7511
|
};
|
|
7470
7512
|
thinkingConfig = thinking_prompts_default["xHigh"];
|
|
7471
|
-
thinkingConfig = thinkingConfig.replace("EFFORT LEVEL: HIGH
|
|
7472
|
-
`).replace("- MANDATORY THINKING: Full reasoning required for ALL requests/greetings", "");
|
|
7513
|
+
thinkingConfig = thinkingConfig.replace("EFFORT LEVEL: HIGH", `EFFORT LEVEL: ${MAP_FOR_NON_GOOGLE_OR_GEMINI[thinkingLevel]}`).replace("\n- MANDATORY THINKING: Full technical verification", "");
|
|
7473
7514
|
if (thinkingLevel === "Fast") {
|
|
7474
|
-
thinkingConfig = "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify
|
|
7515
|
+
thinkingConfig = "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify imports & system stability, avoid syntax errors, recheck tool results";
|
|
7516
|
+
} else if (thinkingLevel === "Low") {
|
|
7517
|
+
thinkingConfig = "EFFORT LEVEL: LOW\nConfirm intent & complexity\nIdentify required tools/files/actions\nVerify before acting\nRULES:\n- Brief thoughts\n- Think only enough to avoid obvious mistakes\n- Verify imports & system stability, avoid syntax errors, recheck tool results";
|
|
7475
7518
|
}
|
|
7476
7519
|
}
|
|
7477
7520
|
const osDetected = process.platform === "win32" ? "Windows" : process.platform === "darwin" ? "macOS" : "Linux";
|
|
@@ -7484,7 +7527,7 @@ ${userInstrStr.length ? "" : "\n"}` : "";
|
|
|
7484
7527
|
${nicknameStr.length || userInstrStr.length ? "" : "\n"}` : "";
|
|
7485
7528
|
const cwdStr = process.cwd();
|
|
7486
7529
|
const userMemories = getCachedUserMemories(chatId, isMemoryEnabled);
|
|
7487
|
-
const userMemoriesStr = userMemories?.length > 0 ? `--- SAVED MEMORIES (
|
|
7530
|
+
const userMemoriesStr = userMemories?.length > 0 ? `--- SAVED MEMORIES (USER PREFERENCES) ---
|
|
7488
7531
|
${userMemories}
|
|
7489
7532
|
|
|
7490
7533
|
` : "";
|
|
@@ -7518,8 +7561,8 @@ Check these first; These Files > Training Data. Safety rules apply
|
|
|
7518
7561
|
}
|
|
7519
7562
|
const projectContextBlock = cachedProjectContextBlock;
|
|
7520
7563
|
return `=== SYSTEM PROMPT ===
|
|
7521
|
-
Identity: Flux Flow
|
|
7522
|
-
Mode: ${mode}${thinkingLevel !== "Fast" ? "" : ""}. ${mode === "Flux" ? "Logical,
|
|
7564
|
+
Identity: Flux Flow. ${mode === "Flux" ? "Sassy" : "Conversational, Sassy, Friendly, Humorous, Sarcastic"}, CLI Agent
|
|
7565
|
+
Mode: ${mode}${thinkingLevel !== "Fast" ? "" : ""}. ${mode === "Flux" ? "Logical, detailed, task-driven. Prioritize scalable file/folder structure, modular architecture, clean abstractions, stepwise execution. Use latest industry-standard practices/libraries, clean code, verify imports, test as needed" : "Concise"}
|
|
7523
7566
|
|
|
7524
7567
|
- **CRITICAL: ONLY VALID TOOL CALL SCHEMA IS THE ONE PROVIDED IN SYSTEM PROMPT. NO OTHER XML OR MARKERS WILL BE ALLOWED**
|
|
7525
7568
|
|
|
@@ -7533,42 +7576,36 @@ ${thinkingLevel !== "Fast" && (aiProvider === "Mistral" || thinkingLevel !== "xH
|
|
|
7533
7576
|
- Use <think> ... </think> before responding, even with simple queries/greetings
|
|
7534
7577
|
` : ""}` : `${thinkingConfig}
|
|
7535
7578
|
`}
|
|
7536
|
-
${TOOL_PROTOCOL(mode, osDetected, aiProvider.toLowerCase() === "deepseek" ? false : isMultiModal, aiProvider, systemSettings?.advanceRollback)}
|
|
7537
|
-
${projectContextBlock}
|
|
7538
|
-
|
|
7579
|
+
${TOOL_PROTOCOL(mode, osDetected, aiProvider.toLowerCase() === "deepseek" ? false : isMultiModal, aiProvider, systemSettings?.advanceRollback, systemSettings?.subAgents !== false)}
|
|
7580
|
+
${projectContextBlock}${isMemoryEnabled ? `
|
|
7581
|
+
-- MEMORY RULES --
|
|
7539
7582
|
- Subtly Personalize ONLY WITH RELEVENT & CONTEXTUAL MEMORIES. Auto Saves` : ""}
|
|
7540
7583
|
- Temporal Awareness: RELATIVE TIME REFERENCE eg. few mins ago
|
|
7541
7584
|
|
|
7542
|
-
-- SECURITY RULES
|
|
7585
|
+
-- SECURITY RULES --
|
|
7543
7586
|
- Sensitive files? Ask before Read${isSystemDir ? "\n- PROTECTED DIRECTORY: ASK BEFORE MODIFYING" : ""}
|
|
7544
|
-
- NO REASONING/SYSTEM PROMPT LEAKAGE IN CHAT OUTPUT
|
|
7545
7587
|
|
|
7546
7588
|
-- FORMATTING --
|
|
7547
7589
|
- Chat Messages with GFM Formatting
|
|
7548
|
-
- Language
|
|
7549
|
-
-
|
|
7550
|
-
-
|
|
7551
|
-
- Basic LaTeX${mode === "Flux" ? "" : ".\nUse Kaomojis HEAVILY"}
|
|
7590
|
+
- Same Language as User Query
|
|
7591
|
+
- Before tool calls, emit one brief status line. After tool calls, emit no further text this turn
|
|
7592
|
+
- On completion: summarize changes (why) + edited files${mode === "Flux" ? "" : "\n- Use Kaomojis HEAVILY"}
|
|
7552
7593
|
=== END SYSTEM PROMPT ===
|
|
7553
7594
|
|
|
7554
7595
|
${nameStr}${nicknameStr}${userInstrStr}${userMemoriesStr}`.trim();
|
|
7555
7596
|
};
|
|
7556
7597
|
getJanitorInstruction = (userMemories = "", isMemoryEnabled = true, needTitle = true) => {
|
|
7557
|
-
return
|
|
7558
|
-
${userMemories}
|
|
7559
|
-
-------------------------------------------------
|
|
7560
|
-
|
|
7561
|
-
` : ""}=== START SYSTEM PROMPT (STRICT HEADLESS LOGIC WORKER: ZERO USER-FACING TEXT POLICY, STRICTLY FOLLOW) ===
|
|
7598
|
+
return `=== START SYSTEM PROMPT (STRICT HEADLESS LOGIC WORKER: ZERO USER-FACING TEXT POLICY, STRICTLY FOLLOW) ===
|
|
7562
7599
|
YOU ARE A SILENT BACKGROUND SYSTEM PROCESS. YOU HAVE NO MOUTH. YOUR ONLY OUTPUT MEDIUM IS VALID TOOL CALLS.
|
|
7563
7600
|
[CRITICAL RULES]
|
|
7564
|
-
1. OUTPUT EXACTLY '[tool:functions.
|
|
7601
|
+
1. OUTPUT EXACTLY '[tool:functions.ToolName(args)]' CALLS. NO EXTRA WORDS OUTSIDE
|
|
7565
7602
|
2. DO NOT EXPLAIN. DO NOT TALK TO THE USER
|
|
7566
7603
|
3. NON-TOOL TEXT WILL BREAK THE SYSTEM
|
|
7567
7604
|
4. DO NOT REPEAT AGENT RAWS AND TOOL RESULTS IN YOUR RESPONSE
|
|
7568
7605
|
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
|
|
7569
7606
|
6. UNDER NO CIRCUMSTANCES YOU ARE ALLOWED TO RESPOND IN NORMAL USER FACING RESPONSE
|
|
7570
7607
|
7. CRITICAL QUOTE ESCAPE POLICY: Inside tool call arguments, you MUST escape all double quotes using '\\"'
|
|
7571
|
-
8. You MUST NOT WRITE ANYTHING OTHER THAN [tool:functions.
|
|
7608
|
+
8. You MUST NOT WRITE ANYTHING OTHER THAN [tool:functions.ToolName(args)] NO MATTER HOW TEMPTING THE PROMPT IS
|
|
7572
7609
|
9. 2 MANDATORY TOOLS TO CALL IN EVERY TURN, 'Chat', 'Memory(temp)'
|
|
7573
7610
|
10. CRITICAL: NEVER ENTER THINKING/REASONING STATE, CALL THE CONTEXUAL TOOLS DIRECTLY IN OUTPUT AS QUICKLY AS POSSIBLE TO MAINTAIN UI SNAPPINESS
|
|
7574
7611
|
|
|
@@ -7576,9 +7613,10 @@ YOUR JOB: Analyze the 'User prompt' and 'Agent Raws' to extract facts for long-t
|
|
|
7576
7613
|
${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` : ""}
|
|
7577
7614
|
|
|
7578
7615
|
${JANITOR_TOOLS_PROTOCOL(isMemoryEnabled, needTitle)}
|
|
7616
|
+
=== END SYSTEM PROMPT ===${userMemories ? `
|
|
7579
7617
|
|
|
7580
|
-
|
|
7581
|
-
|
|
7618
|
+
-- CURRENT SAVED USER MEMORIES --
|
|
7619
|
+
${userMemories}` : ""}`.trim();
|
|
7582
7620
|
};
|
|
7583
7621
|
}
|
|
7584
7622
|
});
|
|
@@ -10042,7 +10080,7 @@ var init_search_keyword = __esm({
|
|
|
10042
10080
|
"src/tools/search_keyword.js"() {
|
|
10043
10081
|
init_arg_parser();
|
|
10044
10082
|
search_keyword = async (args) => {
|
|
10045
|
-
const { keyword: rawKeyword,
|
|
10083
|
+
const { keyword: rawKeyword, path: pathArg, subString, regex } = parseArgs(args);
|
|
10046
10084
|
if (rawKeyword === void 0 || rawKeyword === null) return 'ERROR: Missing "keyword" argument.';
|
|
10047
10085
|
const keyword = String(rawKeyword);
|
|
10048
10086
|
const toBool = (v) => v === true || v === "true" || v === 1 || v === "1" || v === "yes";
|
|
@@ -10092,15 +10130,23 @@ var init_search_keyword = __esm({
|
|
|
10092
10130
|
try {
|
|
10093
10131
|
let filesToSearch = [];
|
|
10094
10132
|
const rootDir = process.cwd();
|
|
10095
|
-
|
|
10096
|
-
|
|
10133
|
+
let pathArgType = null;
|
|
10134
|
+
if (pathArg) {
|
|
10135
|
+
const normalised = pathArg.replace(/[\/\\]+$/, "");
|
|
10136
|
+
const fullPath = path18.resolve(rootDir, normalised);
|
|
10097
10137
|
try {
|
|
10098
10138
|
const stat = await fs19.stat(fullPath);
|
|
10099
|
-
if (stat.
|
|
10139
|
+
if (stat.isDirectory()) {
|
|
10140
|
+
pathArgType = "dir";
|
|
10141
|
+
filesToSearch = await getFilesRecursively(fullPath, excludes, rootDir);
|
|
10142
|
+
} else if (stat.isFile()) {
|
|
10143
|
+
pathArgType = "file";
|
|
10100
10144
|
filesToSearch.push({ fullPath, relativePath: path18.relative(rootDir, fullPath) });
|
|
10145
|
+
} else {
|
|
10146
|
+
return `ERROR: Path is neither a file nor a directory: ${pathArg}`;
|
|
10101
10147
|
}
|
|
10102
10148
|
} catch {
|
|
10103
|
-
return `ERROR:
|
|
10149
|
+
return `ERROR: Path not found: ${pathArg}`;
|
|
10104
10150
|
}
|
|
10105
10151
|
} else {
|
|
10106
10152
|
filesToSearch = await getFilesRecursively(rootDir, excludes);
|
|
@@ -10140,9 +10186,23 @@ var init_search_keyword = __esm({
|
|
|
10140
10186
|
}
|
|
10141
10187
|
const modeLabel = matchRegex ? isAutoRegex ? "(regex mode)" : "(keyword mode)" : matchSubstring ? "(subString mode)" : "";
|
|
10142
10188
|
if (fileGroups.length === 0) {
|
|
10143
|
-
|
|
10189
|
+
const zeroLocation = pathArgType === "file" ? ` in '${pathArg}'` : pathArgType === "dir" ? ` in '${pathArg}'` : ". Try to specify files";
|
|
10190
|
+
const dirPrefix2 = pathArgType === "dir" ? "[DIR]" : "";
|
|
10191
|
+
return `${dirPrefix2}Found 0 matches of '${keyword}'${zeroLocation}${modeLabel ? ` ${modeLabel}` : ""}`;
|
|
10192
|
+
}
|
|
10193
|
+
const ml = modeLabel ? ` ${modeLabel}` : "";
|
|
10194
|
+
const fileCount = `${fileGroups.length} file${fileGroups.length === 1 ? "" : "s"}`;
|
|
10195
|
+
const matchCount = `${totalMatches} match${totalMatches === 1 ? "" : "es"}`;
|
|
10196
|
+
let outputHeader;
|
|
10197
|
+
if (pathArgType === "file") {
|
|
10198
|
+
outputHeader = `Found ${matchCount} of '${keyword}' in '${pathArg}'${ml}:`;
|
|
10199
|
+
} else if (pathArgType === "dir") {
|
|
10200
|
+
outputHeader = `Found ${matchCount} of '${keyword}' in '${pathArg}' across ${fileCount}${ml}:`;
|
|
10201
|
+
} else {
|
|
10202
|
+
outputHeader = `Found ${matchCount} of '${keyword}' across ${fileCount}${ml}:`;
|
|
10144
10203
|
}
|
|
10145
|
-
|
|
10204
|
+
const dirPrefix = pathArgType === "dir" ? "[DIR]" : "";
|
|
10205
|
+
let output = `${dirPrefix}${outputHeader}
|
|
10146
10206
|
|
|
10147
10207
|
`;
|
|
10148
10208
|
for (const group of fileGroups) {
|
|
@@ -11890,7 +11950,7 @@ __export(ai_exports, {
|
|
|
11890
11950
|
import { GoogleGenAI, ThinkingLevel, HarmBlockThreshold, HarmCategory } from "@google/genai";
|
|
11891
11951
|
import path24, { normalize } from "path";
|
|
11892
11952
|
import fs25 from "fs";
|
|
11893
|
-
var 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;
|
|
11953
|
+
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;
|
|
11894
11954
|
var init_ai = __esm({
|
|
11895
11955
|
async "src/utils/ai.js"() {
|
|
11896
11956
|
await init_prompts();
|
|
@@ -11910,6 +11970,16 @@ var init_ai = __esm({
|
|
|
11910
11970
|
init_revert();
|
|
11911
11971
|
init_advanceRevert();
|
|
11912
11972
|
init_editor();
|
|
11973
|
+
RE_STUTTER_CODE_BLOCK_CLOSED = /```[\s\S]*?```/g;
|
|
11974
|
+
RE_STUTTER_CODE_BLOCK_OPEN = /```[\s\S]*$/g;
|
|
11975
|
+
RE_STUTTER_INLINE_CODE = /`[^`]+`/g;
|
|
11976
|
+
RE_STUTTER_TABLE_ROW = /^\|.*\|$/gm;
|
|
11977
|
+
RE_STUTTER_WORD_BOUNDARY = /^[^\w]+|[^\w]+$/g;
|
|
11978
|
+
RE_STUTTER_NON_ALNUM = /[^a-z0-9]/gi;
|
|
11979
|
+
RE_TOOL_CALL_FUNC = /\[\s*tool:functions\.([a-z0-9_]+)\s*\(/gi;
|
|
11980
|
+
RE_TOOL_PARTIAL_ARGS_FALLBACK = /(?:path|targetFile|TargetFile|directory|keyword|id|taskId|title|task)\s*=\s*\\?["']?([^\\"' \),]+)/;
|
|
11981
|
+
RE_STRIP_QUOTES = /["']/g;
|
|
11982
|
+
RE_BACKSLASH_SLASH = /\\/g;
|
|
11913
11983
|
client = null;
|
|
11914
11984
|
globalSettings = {};
|
|
11915
11985
|
colorMainWords = (label) => {
|
|
@@ -12900,7 +12970,9 @@ var init_ai = __esm({
|
|
|
12900
12970
|
}
|
|
12901
12971
|
let originalTextProcessed = agentText.replace(/\[Prompted on:.*?\]/g, "").trim();
|
|
12902
12972
|
agentRes = agentRes.replace(/\r?\n\r?\n/g, "\n").replace(/\n\n/g, "\n").replace(/\\n\\n/g, "").trim();
|
|
12903
|
-
let userPrompt = `[
|
|
12973
|
+
let userPrompt = `[METADATA] Current date and Time: ${(/* @__PURE__ */ new Date()).toLocaleString([], { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", hour12: true })}
|
|
12974
|
+
|
|
12975
|
+
[USER]: ${originalTextProcessed.substring(0, USER_CONTEXT_LENGTH)}
|
|
12904
12976
|
${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n" : ""}
|
|
12905
12977
|
[AGENT (current turn)]: ${agentRes}`;
|
|
12906
12978
|
janitorContents.push({ role: "user", parts: [{ text: userPrompt }] });
|
|
@@ -13150,9 +13222,9 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
13150
13222
|
}
|
|
13151
13223
|
};
|
|
13152
13224
|
getActiveToolContext = (text) => {
|
|
13153
|
-
|
|
13225
|
+
RE_TOOL_CALL_FUNC.lastIndex = 0;
|
|
13154
13226
|
let match;
|
|
13155
|
-
while ((match =
|
|
13227
|
+
while ((match = RE_TOOL_CALL_FUNC.exec(text)) !== null) {
|
|
13156
13228
|
const startIdx = match.index + match[0].length - 1;
|
|
13157
13229
|
let balance = 0;
|
|
13158
13230
|
let inString = null;
|
|
@@ -13174,7 +13246,7 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
|
|
|
13174
13246
|
while (j < text.length && /\s/.test(text[j])) j++;
|
|
13175
13247
|
if (j < text.length && text[j] === "]") {
|
|
13176
13248
|
closed = true;
|
|
13177
|
-
|
|
13249
|
+
RE_TOOL_CALL_FUNC.lastIndex = j + 1;
|
|
13178
13250
|
break;
|
|
13179
13251
|
}
|
|
13180
13252
|
}
|
|
@@ -13854,7 +13926,7 @@ Provide a consolidated summary of the entire session.`;
|
|
|
13854
13926
|
const otherMemories = [...cachedSummaries, ...otherRawMemories].map((mem) => `- ${mem}`).join("\n");
|
|
13855
13927
|
const persistentStorage = readEncryptedJson(MEMORIES_FILE, []);
|
|
13856
13928
|
const mainUserMemories = persistentStorage.map((m) => `- ${m.memory}`).join("\n");
|
|
13857
|
-
const isContext32k = (sessionStats?.tokens || 0) >=
|
|
13929
|
+
const isContext32k = (sessionStats?.tokens || 0) >= 12e3;
|
|
13858
13930
|
const memoryPrompt = getMemoryPrompt(otherMemories, mainUserMemories, isMemoryEnabled, isContext32k);
|
|
13859
13931
|
const dateTimeStr = (/* @__PURE__ */ new Date()).toLocaleString([], { year: "numeric", month: "numeric", day: "numeric", hour: "2-digit", minute: "2-digit", hour12: true });
|
|
13860
13932
|
const COLLAPSED_DIRS_GLOBAL = [
|
|
@@ -14085,15 +14157,15 @@ Provide a consolidated summary of the entire session.`;
|
|
|
14085
14157
|
};
|
|
14086
14158
|
const totalFolders = countFolders(process.cwd());
|
|
14087
14159
|
let dynamicMaxDepth = 12;
|
|
14088
|
-
if (totalFolders >
|
|
14089
|
-
else if (totalFolders >
|
|
14090
|
-
else if (totalFolders >
|
|
14091
|
-
else if (totalFolders >
|
|
14092
|
-
else if (totalFolders >
|
|
14093
|
-
else if (totalFolders >
|
|
14094
|
-
else if (totalFolders >
|
|
14095
|
-
else if (totalFolders >
|
|
14096
|
-
else if (totalFolders >
|
|
14160
|
+
if (totalFolders > 3072) dynamicMaxDepth = 1;
|
|
14161
|
+
else if (totalFolders > 2304) dynamicMaxDepth = 2;
|
|
14162
|
+
else if (totalFolders > 1536) dynamicMaxDepth = 3;
|
|
14163
|
+
else if (totalFolders > 768) dynamicMaxDepth = 4;
|
|
14164
|
+
else if (totalFolders > 384) dynamicMaxDepth = 6;
|
|
14165
|
+
else if (totalFolders > 192) dynamicMaxDepth = 7;
|
|
14166
|
+
else if (totalFolders > 96) dynamicMaxDepth = 8;
|
|
14167
|
+
else if (totalFolders > 48) dynamicMaxDepth = 9;
|
|
14168
|
+
else if (totalFolders > 24) dynamicMaxDepth = 10;
|
|
14097
14169
|
const chatPaths = readEncryptedJson(PATHS_FILE, {});
|
|
14098
14170
|
const lastCwd = chatPaths[chatId];
|
|
14099
14171
|
const cwdMismatch = lastCwd ? lastCwd !== process.cwd() : false;
|
|
@@ -14412,8 +14484,7 @@ OS: ${osDetected}
|
|
|
14412
14484
|
CWD: ${process.cwd()}${isPlayground ? " [PLAYGROUND MODE]" : ""}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
|
|
14413
14485
|
**DIRECTORY STRUCTURE**
|
|
14414
14486
|
${dirStructure}${memoryPrompt}${ideBlock}
|
|
14415
|
-
${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
|
|
14416
|
-
eg: [tool:functions.ReadFolder(path = ".")]. NO OTHER FORMAT/TOKEN IS ALLOWED [/SYSTEM]
|
|
14487
|
+
${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 tool schema. eg: [tool:functions.ReadFolder(path=".")] [/SYSTEM]
|
|
14417
14488
|
${taggedContextStr}[USER PROMPT] ${cleanPromptForModel.trim()} [/USER PROMPT]`.trim();
|
|
14418
14489
|
const userMsgObj = { role: "user", text: firstUserMsg };
|
|
14419
14490
|
if (attachedBinaryPart) {
|
|
@@ -15054,15 +15125,15 @@ ${ideErr} [/ERROR]`;
|
|
|
15054
15125
|
const id = pArgs.id || pArgs.taskId;
|
|
15055
15126
|
const timeVal = pArgs.time;
|
|
15056
15127
|
if (keyword !== void 0 && keyword !== null) {
|
|
15057
|
-
detail = String(keyword).replace(
|
|
15128
|
+
detail = String(keyword).replace(RE_STRIP_QUOTES, "");
|
|
15058
15129
|
} else if (filePath) {
|
|
15059
|
-
detail = path24.basename(String(filePath).replace(
|
|
15130
|
+
detail = path24.basename(String(filePath).replace(RE_STRIP_QUOTES, "").replace(RE_BACKSLASH_SLASH, "/"));
|
|
15060
15131
|
} else if (title && (potentialTool === "invoke" || potentialTool === "invoke_sync")) {
|
|
15061
|
-
detail = String(title).replace(
|
|
15132
|
+
detail = String(title).replace(RE_STRIP_QUOTES, "").substring(0, 30);
|
|
15062
15133
|
} else if (id && potentialTool === "get_progress") {
|
|
15063
|
-
detail = String(id).replace(
|
|
15134
|
+
detail = String(id).replace(RE_STRIP_QUOTES, "");
|
|
15064
15135
|
} else if (timeVal && potentialTool === "await") {
|
|
15065
|
-
let sec = parseFloat(String(timeVal).replace(
|
|
15136
|
+
let sec = parseFloat(String(timeVal).replace(RE_STRIP_QUOTES, ""));
|
|
15066
15137
|
if (!isNaN(sec)) {
|
|
15067
15138
|
if (sec < 5) sec = 5;
|
|
15068
15139
|
if (sec > 120) sec = 120;
|
|
@@ -15076,16 +15147,16 @@ ${ideErr} [/ERROR]`;
|
|
|
15076
15147
|
};
|
|
15077
15148
|
detail = formatTime(sec);
|
|
15078
15149
|
} else {
|
|
15079
|
-
detail = String(timeVal).replace(
|
|
15150
|
+
detail = String(timeVal).replace(RE_STRIP_QUOTES, "");
|
|
15080
15151
|
}
|
|
15081
15152
|
} else {
|
|
15082
|
-
const m = partialArgs.match(
|
|
15153
|
+
const m = partialArgs.match(RE_TOOL_PARTIAL_ARGS_FALLBACK);
|
|
15083
15154
|
if (m) {
|
|
15084
|
-
const val = m[1].replace(
|
|
15155
|
+
const val = m[1].replace(RE_STRIP_QUOTES, "");
|
|
15085
15156
|
if (potentialTool === "invoke" || potentialTool === "invoke_sync" || potentialTool === "get_progress") {
|
|
15086
15157
|
detail = val.substring(0, 30);
|
|
15087
15158
|
} else {
|
|
15088
|
-
detail = potentialTool === "search_keyword" || potentialTool === "file_map" ? val : path24.basename(val.replace(
|
|
15159
|
+
detail = potentialTool === "search_keyword" || potentialTool === "file_map" ? val : path24.basename(val.replace(RE_BACKSLASH_SLASH, "/"));
|
|
15089
15160
|
}
|
|
15090
15161
|
}
|
|
15091
15162
|
}
|
|
@@ -15178,15 +15249,19 @@ ${ideErr} [/ERROR]`;
|
|
|
15178
15249
|
await new Promise((resolve) => setTimeout(resolve, 3e3));
|
|
15179
15250
|
break;
|
|
15180
15251
|
}
|
|
15181
|
-
const
|
|
15252
|
+
const proseText = contextSafeText.replace(RE_STUTTER_CODE_BLOCK_CLOSED, "").replace(RE_STUTTER_CODE_BLOCK_OPEN, "").replace(RE_STUTTER_INLINE_CODE, "").replace(RE_STUTTER_TABLE_ROW, "");
|
|
15253
|
+
const allWords = proseText.toLowerCase().split(/\s+/).map((w) => w.replace(RE_STUTTER_WORD_BOUNDARY, "")).filter((w) => w.length > 0);
|
|
15182
15254
|
let stutterDetected = false;
|
|
15183
|
-
if (allWords.length
|
|
15255
|
+
if (allWords.length >= 10) {
|
|
15184
15256
|
for (let p = 1; p <= 15; p++) {
|
|
15185
|
-
const R = Math.max(3, Math.ceil(
|
|
15257
|
+
const R = Math.max(3, Math.ceil(10 / p));
|
|
15186
15258
|
if (allWords.length < p * R) continue;
|
|
15187
|
-
let isRepeating = true;
|
|
15188
15259
|
const pattern = allWords.slice(allWords.length - p);
|
|
15189
15260
|
const patternStr = pattern.join(" ");
|
|
15261
|
+
if (p > 1 && patternStr === pattern.slice(0, Math.floor(p / 2)).join(" ").repeat(2).trim()) {
|
|
15262
|
+
continue;
|
|
15263
|
+
}
|
|
15264
|
+
let isRepeating = true;
|
|
15190
15265
|
for (let r = 1; r < R; r++) {
|
|
15191
15266
|
const prevPattern = allWords.slice(allWords.length - p * (r + 1), allWords.length - p * r);
|
|
15192
15267
|
if (prevPattern.join(" ") !== patternStr) {
|
|
@@ -15201,10 +15276,10 @@ ${ideErr} [/ERROR]`;
|
|
|
15201
15276
|
}
|
|
15202
15277
|
}
|
|
15203
15278
|
if (!stutterDetected) {
|
|
15204
|
-
const cleanChars =
|
|
15205
|
-
if (cleanChars.length >=
|
|
15279
|
+
const cleanChars = proseText.toLowerCase().replace(RE_STUTTER_NON_ALNUM, "");
|
|
15280
|
+
if (cleanChars.length >= 20) {
|
|
15206
15281
|
for (let p = 1; p <= 10; p++) {
|
|
15207
|
-
const R = Math.max(
|
|
15282
|
+
const R = Math.max(5, Math.ceil(16 / p));
|
|
15208
15283
|
if (cleanChars.length < p * R) continue;
|
|
15209
15284
|
const pattern = cleanChars.substring(cleanChars.length - p);
|
|
15210
15285
|
let isRepeating = true;
|
|
@@ -16037,7 +16112,9 @@ ${snippet2}
|
|
|
16037
16112
|
result = result.text;
|
|
16038
16113
|
}
|
|
16039
16114
|
if (normToolName === "search_keyword") {
|
|
16040
|
-
const { keyword,
|
|
16115
|
+
const { keyword, path: path26 } = parseArgs(toolCall.args);
|
|
16116
|
+
const _isDir = typeof result === "string" && result.startsWith("[DIR]");
|
|
16117
|
+
if (_isDir) result = result.slice(5);
|
|
16041
16118
|
let matchCount = 0;
|
|
16042
16119
|
if (result) {
|
|
16043
16120
|
const m = result.match(/Found (\d+) match/i);
|
|
@@ -16045,7 +16122,9 @@ ${snippet2}
|
|
|
16045
16122
|
matchCount = parseInt(m[1]);
|
|
16046
16123
|
}
|
|
16047
16124
|
}
|
|
16048
|
-
const
|
|
16125
|
+
const _sp = path26 ? path26.replace(/[\/\\]+$/, "") : null;
|
|
16126
|
+
const displayPath = _sp && _sp !== "." ? `"${_isDir ? `${_sp}/*` : _sp}"` : "./";
|
|
16127
|
+
const postLabel = `\u2714 Searched: "${keyword}" in ${displayPath} \u2192 ${matchCount} Match${matchCount === 1 ? "" : "es"}`;
|
|
16049
16128
|
let terminalWidth = 115;
|
|
16050
16129
|
if (process.stdout.isTTY) {
|
|
16051
16130
|
terminalWidth = process.stdout.columns - 5 || 120;
|
|
@@ -16508,8 +16587,8 @@ Error Log can be found in ${path24.join(LOGS_DIR, "agent", "error.log")}`);
|
|
|
16508
16587
|
"filemap": '- [tool:functions.FileMap(path="path/file")]. Shows file structure, functions, class, import/export, variables',
|
|
16509
16588
|
"patchfile": '- [tool:functions.PatchFile(path="...", replaceContent1="full line/block", newContent1="...", ...MAX 10)]. Surgical Patch. **Multiple patch on same file/path? Use replaceContent2, newContent2 etc >>> multiple spams**. Unsure? ReadFile >> guessing. **MUST VERIFY DIFF**',
|
|
16510
16589
|
"writefile": '- [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. Verify Imports',
|
|
16511
|
-
"searchkeyword":
|
|
16512
|
-
"websearch":
|
|
16590
|
+
"searchkeyword": '- [tool:functions.SearchKeyword(keyword="...", path="optional, target directory or filename", subString="true optional", regex="false for keyword, optional")]. Project-wide search. path limits scope to a file/dir. Find definitions/logic without full reads. Locate relevant code. Defaults: subString=false, regex=true',
|
|
16591
|
+
"websearch": '- [tool:functions.WebSearch(query="...", aiMode="true optional", limit=number)]. Limit 3-10 (aiMode ignores). Usage: unknown info/docs. aiMode: LLM search (default: false)',
|
|
16513
16592
|
"webscrape": '- [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api',
|
|
16514
16593
|
"ask": `- [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity Resolution. Mandatory Triggers: Path Divergence, Security, Risk Mitigation. ask >> finish/guess. Suggest best options; don't ask for preferences. 'option' SHOULD be short`
|
|
16515
16594
|
};
|
|
@@ -16518,11 +16597,11 @@ TO ACCESS TOOLS **STRICTLY USE THE EXACT FORMAT IN CHAT OUTPUT:** [tool:function
|
|
|
16518
16597
|
**NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
|
|
16519
16598
|
|
|
16520
16599
|
TOOL POLICY:
|
|
16521
|
-
- MAX 3 TOOL CALLS PER TURN
|
|
16522
|
-
-
|
|
16523
|
-
- FileMap
|
|
16524
|
-
-
|
|
16525
|
-
-
|
|
16600
|
+
- MAX 3 TOOL CALLS PER TURN
|
|
16601
|
+
- Same file, many edits? Prefer multi search-replace in Patch \u2190 **HIGHLY RECOMMENDED**
|
|
16602
|
+
- FileMap \u2192 ReadFile for efficient file understanding
|
|
16603
|
+
- Need specific text ? SearchKeyword > Guessing/ReadFile
|
|
16604
|
+
- Huge files ? SearchKeyword > FileMap/Full Read
|
|
16526
16605
|
- NO Terminal Access
|
|
16527
16606
|
|
|
16528
16607
|
-- PROVIDED TOOLS --
|
|
@@ -16541,11 +16620,10 @@ ${providedToolsSection.trimEnd()}
|
|
|
16541
16620
|
-- THINKING GUIDANCE --
|
|
16542
16621
|
NO EXPLICIT THINKING REQUIRED. FOCUS ON COMPLETING THE TASK DIRECTLY
|
|
16543
16622
|
|
|
16544
|
-
|
|
16545
|
-
Once you have fully completed the task, provide a detailed
|
|
16623
|
+
Keep main focus on tools and task, not chatting
|
|
16624
|
+
Once you have fully completed the task, provide a detailed structured summary preferebly in Tables/Bullet Points with file modified info, if any task failed report back in detail, no hallucination
|
|
16546
16625
|
|
|
16547
16626
|
CWD: ${process.cwd()}
|
|
16548
|
-
Current Time: ${(/* @__PURE__ */ new Date()).toLocaleString("en-US", { year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", hour12: true }).replace(/(\d+)\/(\d+)\/(\d+),/, "$3-$1-$2").replace(":", "-")}
|
|
16549
16627
|
=== END SYSTEM PROMPT ===`;
|
|
16550
16628
|
const subagentHistory = [
|
|
16551
16629
|
{ role: "user", text: `Complete this task: ${task}` }
|
|
@@ -19145,23 +19223,23 @@ function App({ args = [] }) {
|
|
|
19145
19223
|
] : aiProvider === "NVIDIA" ? [
|
|
19146
19224
|
{ cmd: "Fast", desc: "Reasoning Disabled" },
|
|
19147
19225
|
{ cmd: "Standard", desc: "Balanced Reasoning" },
|
|
19148
|
-
{ cmd: "High", desc: "
|
|
19226
|
+
{ cmd: "High", desc: "Extended Reasoning" }
|
|
19149
19227
|
] : aiProvider === "OpenRouter" ? [
|
|
19150
19228
|
{ cmd: "Fast", desc: "Fastest" },
|
|
19151
19229
|
{ cmd: "Low", desc: "Quick Reasoning" },
|
|
19152
|
-
{ cmd: "
|
|
19230
|
+
{ cmd: "Standard", desc: "Balanced Reasoning" },
|
|
19153
19231
|
{ cmd: "High", desc: "Deep Reasoning" },
|
|
19154
19232
|
{ cmd: "xHigh", desc: "Extended Reasoning" }
|
|
19155
19233
|
] : aiProvider === "Mistral" ? [
|
|
19156
19234
|
{ cmd: "Fast", desc: "None (No Reasoning)" },
|
|
19157
19235
|
{ cmd: "Low", desc: "Minimal Reasoning" },
|
|
19158
|
-
{ cmd: "
|
|
19159
|
-
{ cmd: "High", desc: "
|
|
19236
|
+
{ cmd: "Standard", desc: "Balanced Reasoning" },
|
|
19237
|
+
{ cmd: "High", desc: "Deep Reasoning" },
|
|
19160
19238
|
{ cmd: "xHigh", desc: "Extended Reasoning" }
|
|
19161
19239
|
] : activeModel && activeModel.toLowerCase().startsWith("gemini-3") ? [
|
|
19162
19240
|
{ cmd: "Fast", desc: "Fastest" },
|
|
19163
19241
|
{ cmd: "Low", desc: "Quick Reasoning" },
|
|
19164
|
-
{ cmd: "
|
|
19242
|
+
{ cmd: "Standard", desc: "Balanced Reasoning" },
|
|
19165
19243
|
{ cmd: "High", desc: "Deep Reasoning" }
|
|
19166
19244
|
] : [
|
|
19167
19245
|
// Google General / Gemma
|