fluxflow-cli 3.13.4 → 3.14.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 CHANGED
@@ -2644,6 +2644,7 @@ var init_text = __esm({
2644
2644
  parsePatchPairs = (args) => {
2645
2645
  const patchPairs = [];
2646
2646
  const indices = /* @__PURE__ */ new Set();
2647
+ const allowMultiple = args.allowMultiple === true || String(args.allowMultiple).toLowerCase() === "true";
2647
2648
  Object.keys(args).forEach((key) => {
2648
2649
  const m = key.match(/^(replaceContent|newContent|content_to_replace|content_to_add)(\d+)?$/);
2649
2650
  if (m) {
@@ -2664,12 +2665,13 @@ var init_text = __esm({
2664
2665
  if (r !== void 0 && n !== void 0) {
2665
2666
  patchPairs.push({ replace: r, new: n });
2666
2667
  } else if (r !== void 0 || n !== void 0) {
2667
- return { error: `Mismatched replacement pair for index ${i}. Both replacement and new content must be provided.` };
2668
+ return { error: `Mismatched replacement pair for index ${i}. Both replacement and new content must be provided.`, allowMultiple };
2668
2669
  }
2669
2670
  }
2670
- return { patchPairs };
2671
+ return { patchPairs, allowMultiple };
2671
2672
  };
2672
- applyPatches = (content, patches) => {
2673
+ applyPatches = (content, patches, options = {}) => {
2674
+ const allowMultiple = typeof options === "boolean" ? options : !!(options && options.allowMultiple);
2673
2675
  let currentFileContent = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
2674
2676
  const strip = (t) => t.replace(/^```[\w]*\n?/, "").replace(/```\s*$/, "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
2675
2677
  const getIndent = (line) => line.match(/^\s*/)[0];
@@ -2732,17 +2734,19 @@ var init_text = __esm({
2732
2734
  patchMatches.push({ index: i, success: false, error: `Block ${i + 1}: Could not find match.` });
2733
2735
  continue;
2734
2736
  }
2735
- if (matches.length > 1) {
2736
- patchMatches.push({ index: i, success: false, error: `Block ${i + 1}: Found ${matches.length} matches (must be unique).` });
2737
+ if (matches.length > 1 && !allowMultiple) {
2738
+ patchMatches.push({ index: i, success: false, error: `Block ${i + 1}: Found ${matches.length} matches (must be unique or use allowMultiple: true if sure).` });
2737
2739
  continue;
2738
2740
  }
2739
- patchMatches.push({
2740
- index: i,
2741
- success: true,
2742
- startPos: matches[0].index,
2743
- firstMatchContent: matches[0][0],
2744
- content_to_add
2745
- });
2741
+ for (const matchItem of matches) {
2742
+ patchMatches.push({
2743
+ index: i,
2744
+ success: true,
2745
+ startPos: matchItem.index,
2746
+ firstMatchContent: matchItem[0],
2747
+ content_to_add
2748
+ });
2749
+ }
2746
2750
  }
2747
2751
  const successful = patchMatches.filter((m) => m.success).sort((a, b) => a.startPos - b.startPos);
2748
2752
  for (let j = 0; j < successful.length - 1; j++) {
@@ -2779,8 +2783,9 @@ var init_text = __esm({
2779
2783
  for (let j = patchEndLineIdx; j < Math.min(allLines.length, patchEndLineIdx + 3); j++) {
2780
2784
  contextAfter.push({ num: j + 1, text: allLines[j] });
2781
2785
  }
2782
- resultsMap.set(match.index, {
2786
+ resultsMap.set(match, {
2783
2787
  success: true,
2788
+ index: match.index,
2784
2789
  oldContent: match.firstMatchContent,
2785
2790
  newContent: finalReplacement,
2786
2791
  originalStartLine,
@@ -2794,13 +2799,18 @@ var init_text = __esm({
2794
2799
  }
2795
2800
  const results = [];
2796
2801
  for (let i = 0; i < patches.length; i++) {
2797
- if (resultsMap.has(i)) {
2798
- results.push(resultsMap.get(i));
2802
+ const matchesForI = toApply.filter((m) => m.index === i);
2803
+ if (matchesForI.length > 0) {
2804
+ for (const match of matchesForI) {
2805
+ if (resultsMap.has(match)) {
2806
+ results.push(resultsMap.get(match));
2807
+ }
2808
+ }
2799
2809
  } else {
2800
- const match = patchMatches.find((m) => m.index === i);
2810
+ const failedMatch = patchMatches.find((m) => m.index === i);
2801
2811
  results.push({
2802
2812
  success: false,
2803
- error: match ? match.error : `Block ${i + 1}: Unknown error.`
2813
+ error: failedMatch ? failedMatch.error : `Block ${i + 1}: Unknown error.`
2804
2814
  });
2805
2815
  }
2806
2816
  }
@@ -2854,9 +2864,23 @@ var init_text = __esm({
2854
2864
  }
2855
2865
  }
2856
2866
  }
2867
+ const originalLineIdx = res.originalStartLine - 1;
2868
+ const fullOrigLine = allLinesOriginal[originalLineIdx] || "";
2857
2869
  const oldLines = res.oldContent.split("\n");
2870
+ const origIndentMatch = fullOrigLine.match(/^\s*/);
2871
+ const origIndent = origIndentMatch ? origIndentMatch[0] : "";
2858
2872
  oldLines.forEach((line, i) => {
2859
- diffText += `-${res.originalStartLine + i}|${line}
2873
+ let lineText = line;
2874
+ if (oldLines.length === 1 && fullOrigLine.trim().length > 0 && fullOrigLine.includes(line.trim())) {
2875
+ lineText = fullOrigLine;
2876
+ } else if (i === 0) {
2877
+ const lineIndentMatch = line.match(/^\s*/);
2878
+ const lineIndent = lineIndentMatch ? lineIndentMatch[0] : "";
2879
+ if (lineIndent.length < origIndent.length && fullOrigLine.includes(line.trim())) {
2880
+ lineText = origIndent + line.trimStart();
2881
+ }
2882
+ }
2883
+ diffText += `-${res.originalStartLine + i}|${lineText}
2860
2884
  `;
2861
2885
  });
2862
2886
  let hunkEndInFinal = currentFinalLineIdx;
@@ -2902,7 +2926,6 @@ var init_text = __esm({
2902
2926
  const isR = clean.startsWith("-");
2903
2927
  const isA = clean.startsWith("+");
2904
2928
  let rest = isR || isA ? clean.substring(1) : clean;
2905
- rest = rest.trim();
2906
2929
  const splitIdx = rest.indexOf("|");
2907
2930
  const num = splitIdx !== -1 ? flattenString(rest.substring(0, splitIdx).trim()) : "";
2908
2931
  const content = splitIdx !== -1 ? flattenString(rest.substring(splitIdx + 1)) : flattenString(rest);
@@ -5624,8 +5647,10 @@ var init_ChatLayout = __esm({
5624
5647
  tableBuffer = [];
5625
5648
  }
5626
5649
  if (quoteBuffer.length > 0) {
5650
+ const quoteWidth = columns - 6;
5651
+ const wrappedQuoteLines = quoteBuffer.flatMap((line) => wrapText(line, quoteWidth).split("\n"));
5627
5652
  result.push(
5628
- /* @__PURE__ */ React4.createElement(Box3, { key: `quote-${key}`, borderStyle: "bold", borderLeft: true, borderRight: false, borderTop: false, borderBottom: false, borderColor: colors.borderMuted, paddingLeft: 1, marginY: 1, flexDirection: "column" }, quoteBuffer.map((line, qi) => /* @__PURE__ */ React4.createElement(InlineMarkdown, { key: qi, text: line, color: colors.textMuted, italic, theme })))
5653
+ /* @__PURE__ */ React4.createElement(Box3, { key: `quote-${key}`, borderStyle: "bold", borderLeft: true, borderRight: false, borderTop: false, borderBottom: false, borderColor: colors.borderMuted, paddingLeft: 1, marginY: 1, flexDirection: "column" }, wrappedQuoteLines.map((line, qi) => /* @__PURE__ */ React4.createElement(InlineMarkdown, { key: qi, text: line, color: colors.textMuted, italic, theme })))
5629
5654
  );
5630
5655
  quoteBuffer = [];
5631
5656
  }
@@ -6012,7 +6037,7 @@ var init_ChatLayout = __esm({
6012
6037
  const cmdMatch = msg.text.match(/COMMAND: (.*)/);
6013
6038
  const ptyMatch = msg.text.match(/PTY: (true|false)/);
6014
6039
  const outputMatch = msg.text.match(/OUTPUT: ([\s\S]*)/);
6015
- const cmd = cmdMatch ? cmdMatch[1] : "Unknown";
6040
+ const cmd = cmdMatch ? cmdMatch[1] : "No Command";
6016
6041
  const isPty = ptyMatch ? ptyMatch[1] === "true" : false;
6017
6042
  const outputList = outputMatch ? outputMatch[1] : "";
6018
6043
  return /* @__PURE__ */ React4.createElement(Box3, { marginBottom: 0, paddingX: 1, width: "100%" }, /* @__PURE__ */ React4.createElement(TerminalBox, { command: cmd, output: outputList, completed: true, columns, isPty, theme }));
@@ -6580,7 +6605,7 @@ var init_arg_parser = __esm({
6580
6605
  return "\\";
6581
6606
  default:
6582
6607
  if (char === quote) return quote;
6583
- return match;
6608
+ return char;
6584
6609
  }
6585
6610
  });
6586
6611
  } else if (i < argsString.length && argsString[i] === "[") {
@@ -6677,32 +6702,32 @@ Tool calls: ONLY use [tool:functions.ToolName(args)]
6677
6702
  **NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
6678
6703
 
6679
6704
  **TOOL USAGE POLICY:**
6680
- - MAX 3 TOOL CALLS/TURN${mode === "Flux" ? " (Todo: 3+, Run: max 1 or 2 consecutive)" : ""}
6681
- ${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**" : ""}
6682
- ${mode === "Flux" ? "- **File Tools >> Code in chat**\n\n" : ""}- COMMUNICATION TOOLS -
6683
- 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
6705
+ - MAX 4 TOOL CALLS/TURN${mode === "Flux" ? " (Todo: 4+, Run: max 1 or 2 consecutive)" : ""}
6706
+ ${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**\n" : ""}
6707
+ - COMMUNICATION TOOLS -
6708
+ 1. [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity: MUST for path divergence, security risk. Ask, don't finish/guess. Suggest best options; no preferences. Keep options short
6684
6709
 
6685
6710
  - WEB TOOLS -
6686
- 1. [tool:functions.WebSearch(query="...", aiMode="true optional", limit=number)]. Limit 3-10 (aiMode ignores). Usage: unknown info/docs. aiMode: LLM search (default: false)
6711
+ 1. [tool:functions.WebSearch(query="...", aiMode="bool optional, default: false", limit="integer 3-10, aiMode: exclude")]. Usage: unknown info/docs. aiMode: LLM search
6687
6712
  2. [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api
6688
6713
 
6689
6714
  ${mode === "Flux" ? `- WORKSPACE TOOLS (path = relative; FIRST ARGUMENT, path separator: '/') -
6690
- 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**`}
6691
- 2. [tool:functions.ReadFolder(path="...")]. Detailed DIR stats including File Sizes
6692
- 3. [tool:functions.FileMap(path="path/file")]. Shows file structure, functions, class, import/export, variables
6693
- 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
6694
- 5. [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. Verify Imports
6695
- 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
6715
+ 1. [tool:functions.ReadFile(path="...", startLine="integer", endLine="integer")]. ${aiProvider !== "Google" ? `${isMultiModal ? `Supports images/docs` : `No Multimodal support`}` : `Supports images/docs`}
6716
+ 2. [tool:functions.ReadFolder(path="...", recurse="integer 0-4 optional, default: 0")]. Detailed DIR stats including File Sizes
6717
+ 3. [tool:functions.FileMap(path="file")]. Shows file structure, functions, class, import/export, variables
6718
+ 4. [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX 15)]. Surgical patch. allowMultiple: Replace all matches. Multiple patches same file? Use replaceContent2/newContent2... Verify DIFFs
6719
+ 5. [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile
6720
+ 6. [tool:functions.SearchKeyword(keyword="...", path="optional, target directory/filename", subString="bool optional, default: false", regex="bool optional, default: auto")]. Project-wide search. path limits scope to a file/dir. Find definitions/logic without full reads. Locate relevant code
6696
6721
  7. [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL` : `WINDOWS CMD ONLY` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user
6697
- 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' : ""}
6722
+ 8. [tool:functions.Todo(method="create/append/get", tasks=[ARRAY OF STRINGS], markDone=[ARRAY OF TASKS])]. Task list, no Markdown in arrays. Analyze request: if long 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' : ""}
6698
6723
  ${_cachedAdvanceRollback ? `
6699
6724
  - EMERGENCY SAFETY TOOLS -
6700
- 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.
6725
+ 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
6701
6726
  1. [tool:functions.EmergencyRollback(method="getCheckpoint/forceRevert", id="...")]. Rollback workspace to a checkpoint in THIS agent loop.
6702
6727
  Use ONLY for catastrophic/codebase corruption. Before ending loop, verify no catastrophe. \`id\` not required with \`getCheckPoint\`.
6703
6728
  ` : ""}${enableSubAgents ? `
6704
6729
  - SUB AGENT TOOLS -
6705
- **PROACTIVE sub-agent use HIGHLY RECOMMENDED. Prefer for any task with even slight benefit, no user nudge needed.**
6730
+ **PROACTIVE sub-agent use HIGHLY RECOMMENDED. Prefer for any task with even slight benefit, no user nudge needed**
6706
6731
  Invocations:
6707
6732
  - Invoke (async/background, \u22647 parallel). Parallelize long tasks. NEVER repeat while active
6708
6733
  - InvokeSync (sync/blocking). Sequential, repetitive or delegated tasks. Saves tokens/cost
@@ -7855,21 +7880,29 @@ function ProfileForm({ initialData, onSave, onCancel, theme = "Dark" }) {
7855
7880
  instructions: initialData?.instructions || ""
7856
7881
  }));
7857
7882
  const steps = [
7858
- { key: "name", label: "Enter your Name: " },
7859
- { key: "nickname", label: "Enter a Nickname (Agent will use this): " },
7860
- { key: "instructions", label: "System Instructions (Persona overrides): " }
7883
+ { key: "name", label: "Enter your Name: ", maxLength: 20 },
7884
+ { key: "nickname", label: "Enter a Nickname: ", maxLength: 20 },
7885
+ { key: "instructions", label: "System Instructions: ", maxLength: 200 }
7861
7886
  ];
7887
+ const currentStep = steps[step];
7862
7888
  useEffect6(() => {
7863
7889
  const currentKey = steps[step].key;
7864
- setCurrentInput(profile[currentKey] || "");
7890
+ setCurrentInput((profile[currentKey] || "").slice(0, steps[step].maxLength));
7865
7891
  }, [step, profile]);
7892
+ const handleInputChange = (val) => {
7893
+ if (val.length > currentStep.maxLength) {
7894
+ setCurrentInput(val.slice(0, currentStep.maxLength));
7895
+ } else {
7896
+ setCurrentInput(val);
7897
+ }
7898
+ };
7866
7899
  const handleSubmit = (val) => {
7867
7900
  if (val.trim().toLowerCase() === "/cancel") {
7868
7901
  onCancel();
7869
7902
  return;
7870
7903
  }
7871
- const currentKey = steps[step].key;
7872
- const newProfile = { ...profile, [currentKey]: val.trim() };
7904
+ const currentKey = currentStep.key;
7905
+ const newProfile = { ...profile, [currentKey]: val.trim().slice(0, currentStep.maxLength) };
7873
7906
  setProfile(newProfile);
7874
7907
  setCurrentInput("");
7875
7908
  if (step < steps.length - 1) {
@@ -7878,6 +7911,7 @@ function ProfileForm({ initialData, onSave, onCancel, theme = "Dark" }) {
7878
7911
  onSave(newProfile);
7879
7912
  }
7880
7913
  };
7914
+ const isAtMax = currentInput.length >= currentStep.maxLength;
7881
7915
  return /* @__PURE__ */ React8.createElement(
7882
7916
  Box7,
7883
7917
  {
@@ -7890,14 +7924,14 @@ function ProfileForm({ initialData, onSave, onCancel, theme = "Dark" }) {
7890
7924
  width: "100%"
7891
7925
  },
7892
7926
  /* @__PURE__ */ React8.createElement(Box7, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: colors.text, bold: true }, "DEVELOPER PROFILE CONFIGURATION")),
7893
- /* @__PURE__ */ React8.createElement(Box7, { paddingX: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Box7, null, /* @__PURE__ */ React8.createElement(Text8, { color: colors.text, bold: true }, steps[step].label), /* @__PURE__ */ React8.createElement(
7927
+ /* @__PURE__ */ React8.createElement(Box7, { paddingX: 1, flexDirection: "column" }, /* @__PURE__ */ React8.createElement(Box7, null, /* @__PURE__ */ React8.createElement(Text8, { color: colors.text, bold: true }, currentStep.label), /* @__PURE__ */ React8.createElement(
7894
7928
  TextInput2,
7895
7929
  {
7896
7930
  value: currentInput,
7897
- onChange: setCurrentInput,
7931
+ onChange: handleInputChange,
7898
7932
  onSubmit: handleSubmit
7899
7933
  }
7900
- )), /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: colors.textMuted, italic: true }, "Step ", step + 1, " of ", steps.length))),
7934
+ )), /* @__PURE__ */ React8.createElement(Box7, { marginTop: 1, justifyContent: "space-between" }, /* @__PURE__ */ React8.createElement(Text8, { color: colors.textMuted, italic: true }, "Step ", step + 1, " of ", steps.length), /* @__PURE__ */ React8.createElement(Text8, { color: isAtMax ? colors.warning || "yellow" : colors.textMuted }, "[", currentInput.length, "/", currentStep.maxLength, "]"))),
7901
7935
  /* @__PURE__ */ React8.createElement(Box7, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React8.createElement(Text8, { color: colors.textMuted, italic: true }, "(Enter to submit \u2022 Type /cancel to abort)"))
7902
7936
  );
7903
7937
  }
@@ -8060,9 +8094,9 @@ var init_thinking_prompts = __esm({
8060
8094
  "src/data/thinking_prompts.json"() {
8061
8095
  thinking_prompts_default = {
8062
8096
  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",
8063
- 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",
8064
- 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",
8065
- 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",
8097
+ High: "EFFORT LEVEL: HIGH\nThink in a rigorous monologue\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",
8098
+ Medium: "EFFORT LEVEL: MEDIUM\nThink in a focused, technical monologue\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",
8099
+ Minimal: "EFFORT LEVEL: LOW\nThink in a quick, focused monologue. 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",
8066
8100
  Off: "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify imports & system stability, avoid syntax errors, recheck tool results"
8067
8101
  };
8068
8102
  }
@@ -8191,48 +8225,42 @@ Check these first; These Files > Training Data. Safety rules apply
8191
8225
  }
8192
8226
  const projectContextBlock = cachedProjectContextBlock;
8193
8227
  return `=== SYSTEM PROMPT ===
8194
- Identity: Flux Flow. ${mode === "Flux" ? "Sassy" : "Conversational, Sassy, Friendly, Humorous, Sarcastic"}, CLI Agent
8195
- 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"}
8196
-
8197
- - **CRITICAL: ONLY VALID TOOL CALL SCHEMA IS THE ONE PROVIDED IN SYSTEM PROMPT. NO OTHER XML OR MARKERS WILL BE ALLOWED**
8198
-
8199
- -- MARKERS --
8200
- - TOOL SYSTEM: [TOOL RESULT]
8201
- - SYSTEM NOTIFICATION: [SYSTEM] in user turn
8228
+ Identity: Flux Flow. Sassy, CLI Agent
8229
+ ${mode === "Flux" ? "Logical, detailed, task-driven. Prioritize scalable project structure, modular architecture, clean abstractions, stepwise execution. Use latest industry-standard practices/libraries, clean code, verify imports, run automated tests" : `Mode: ${mode}. Concise, Conversational, Sassy, Friendly, Humorous, Sarcastic`}
8202
8230
 
8203
8231
  -- THINKING GUIDANCE --
8204
8232
  ${aiProvider === "Mistral" || aiProvider === "Google" && !isGemini ? `${thinkingConfig}
8205
8233
  ${forcedReasoning || thinkingLevel !== "Fast" && (aiProvider === "Mistral" || thinkingLevel !== "xHigh" && !isGemini) ? `CRITICAL THINKING POLICY
8206
- - Use <think> ... </think> before responding, even with simple queries/greetings
8234
+ - Use <think> ... </think> for reasoning before responding, even with simple queries/greetings
8207
8235
  ` : ""}` : `${thinkingConfig}
8208
8236
  `}
8209
8237
  ${TOOL_PROTOCOL(mode, osDetected, aiProvider.toLowerCase() === "deepseek" ? false : isMultiModal, aiProvider, systemSettings?.advanceRollback, systemSettings?.subAgents !== false)}
8210
8238
  ${projectContextBlock}${isMemoryEnabled ? `
8211
8239
  -- MEMORY RULES --
8212
- - Subtly Personalize ONLY WITH RELEVENT & CONTEXTUAL MEMORIES. Auto Saves` : ""}
8213
- - Temporal Awareness: RELATIVE TIME REFERENCE eg. few mins ago
8240
+ - Subtly Personalize with RELEVENT CONTEXTUAL MEMORIES. Auto Saves` : ""}
8241
+ - RELATIVE TIME REFERENCE eg. few mins ago
8214
8242
 
8215
8243
  -- SECURITY RULES --
8216
- - Sensitive files? Ask before Read${isSystemDir ? "\n- PROTECTED DIRECTORY: ASK BEFORE MODIFYING" : ""}
8244
+ - Sensitive files? Ask before Read${isSystemDir ? "\n- PROTECTED DIRECTORY" : ""}
8217
8245
 
8218
- -- FORMATTING --
8219
- - Chat Messages with GFM Formatting
8246
+ -- CHAT FORMATTING --
8247
+ - GFM Markdown
8220
8248
  - Same Language as User Query
8221
- - Before tool calls, emit one brief status line. After tool calls, emit no further text this turn
8249
+ - Before tool calls, emit one brief current update. After tool calls, emit no further text this turn
8222
8250
  - On completion: summarize changes (why) + edited files${mode === "Flux" ? "" : "\n- Use Kaomojis HEAVILY"}
8223
8251
  === END SYSTEM PROMPT ===
8224
8252
 
8225
8253
  ${nameStr}${nicknameStr}${userInstrStr}${userMemoriesStr}`.trim();
8226
8254
  };
8227
8255
  getJanitorInstruction = (userMemories = "", isMemoryEnabled = true, needTitle = true) => {
8228
- return `=== START SYSTEM PROMPT (STRICT HEADLESS LOGIC WORKER: ZERO USER-FACING TEXT POLICY, STRICTLY FOLLOW) ===
8229
- YOU ARE A SILENT BACKGROUND SYSTEM PROCESS. YOU HAVE NO MOUTH. YOUR ONLY OUTPUT MEDIUM IS VALID TOOL CALLS.
8256
+ return `=== SYSTEM PROMPT (STRICT HEADLESS LOGIC WORKER: ZERO USER-FACING TEXT POLICY, STRICTLY FOLLOW) ===
8257
+ IDENTITY: SILENT BACKGROUND SYSTEM PROCESS, HAVE NO MOUTH, ONLY OUTPUT IS VALID TOOL CALLS.
8230
8258
  [CRITICAL RULES]
8231
8259
  1. OUTPUT EXACTLY '[tool:functions.ToolName(args)]' CALLS. NO EXTRA WORDS OUTSIDE
8232
8260
  2. DO NOT EXPLAIN. DO NOT TALK TO THE USER
8233
8261
  3. NON-TOOL TEXT WILL BREAK THE SYSTEM
8234
8262
  4. DO NOT REPEAT AGENT RAWS AND TOOL RESULTS IN YOUR RESPONSE
8235
- 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
8263
+ 5. IF YOU GET ONLY USER QUERY AND NO AGENT RAWS, JUST USE TEMP MEMORY TO LOG THE SUMMARY OF USER QUERY AND CONVERSATION CONTEXT
8236
8264
  6. UNDER NO CIRCUMSTANCES YOU ARE ALLOWED TO RESPOND IN NORMAL USER FACING RESPONSE
8237
8265
  7. CRITICAL QUOTE ESCAPE POLICY: Inside tool call arguments, you MUST escape all double quotes using '\\"'
8238
8266
  8. You MUST NOT WRITE ANYTHING OTHER THAN [tool:functions.ToolName(args)] NO MATTER HOW TEMPTING THE PROMPT IS
@@ -8240,7 +8268,7 @@ YOU ARE A SILENT BACKGROUND SYSTEM PROCESS. YOU HAVE NO MOUTH. YOUR ONLY OUTPUT
8240
8268
  10. CRITICAL: NEVER ENTER THINKING/REASONING STATE, CALL THE CONTEXUAL TOOLS DIRECTLY IN OUTPUT AS QUICKLY AS POSSIBLE TO MAINTAIN UI SNAPPINESS
8241
8269
 
8242
8270
  YOUR JOB: Analyze the 'User prompt' and 'Agent Raws' to extract facts for long-term memory or handle system tasks
8243
- ${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` : ""}
8271
+ ${isMemoryEnabled ? `If user tell something that is important (like, hobbies, preferences, facts about user, hates, likes, etc) to know user better over time, use user memory tools` : ""}
8244
8272
 
8245
8273
  ${JANITOR_TOOLS_PROTOCOL(isMemoryEnabled, needTitle)}
8246
8274
  === END SYSTEM PROMPT ===${userMemories ? `
@@ -8539,8 +8567,11 @@ var init_history = __esm({
8539
8567
  } catch (e) {
8540
8568
  }
8541
8569
  const extractPrompt = (msg) => {
8542
- if (!msg || !msg.text) return void 0;
8543
- const text = msg.text.replace(/\s*\n+\s*\[Prompted on:.*?\]/g, "").trim();
8570
+ if (!msg) return void 0;
8571
+ const rawText = typeof msg === "string" ? msg : msg.text || msg.content || "";
8572
+ if (!rawText || typeof rawText !== "string") return void 0;
8573
+ let text = rawText.replace(/\s*\n+\s*\[Prompted on:.*?\]/g, "").replace(/\[\/?(?:STEERING HINT|QUESTION)(?::\s*\w+)?\]/gi, "").trim();
8574
+ if (!text) return void 0;
8544
8575
  const words = text.split(/\s+/);
8545
8576
  let prompt2 = void 0;
8546
8577
  if (words.length > 7) {
@@ -8556,16 +8587,18 @@ var init_history = __esm({
8556
8587
  const userMessages = persistentMessages.filter((m) => m.role === "user");
8557
8588
  const firstUserMsg = userMessages[0];
8558
8589
  const latestUserMsg = userMessages[userMessages.length - 1];
8590
+ const extractedLatest = extractPrompt(latestUserMsg);
8591
+ const extractedFirst = extractPrompt(firstUserMsg);
8559
8592
  if (existingChat && existingChat.prompt) {
8560
- if (Math.random() < 0.95) {
8561
- prompt = extractPrompt(latestUserMsg) || existingChat.prompt;
8593
+ if (Math.random() < 0.8 && extractedLatest) {
8594
+ prompt = extractedLatest;
8562
8595
  } else {
8563
8596
  prompt = existingChat.prompt;
8564
8597
  }
8565
8598
  } else {
8566
- prompt = extractPrompt(firstUserMsg);
8599
+ prompt = extractedFirst || extractedLatest;
8567
8600
  }
8568
- const finalName = name || (existingChat ? existingChat.name : prompt || `Session ${id.slice(-6)}`);
8601
+ const finalName = name || (existingChat ? existingChat.name : `Session ${id.slice(-6)}`);
8569
8602
  const chatFile = path8.join(HISTORY_DIR, `${id}.json`);
8570
8603
  writeEncryptedJson(chatFile, persistentMessages);
8571
8604
  history[id] = {
@@ -9915,8 +9948,17 @@ var init_web_scrape = __esm({
9915
9948
  init_paths();
9916
9949
  init_puppeteer_helper();
9917
9950
  web_scrape = async (args) => {
9918
- const urlMatch = args.match(/url\s*=\s*["'](.*)["']/);
9919
- const url = urlMatch ? urlMatch[1] : args;
9951
+ let rawUrl = args;
9952
+ if (typeof args === "object" && args !== null) {
9953
+ rawUrl = args.url || args.targetUrl || args.href || "";
9954
+ } else if (typeof args === "string") {
9955
+ const urlMatch = args.match(/url\s*=\s*["'](.*)["']/);
9956
+ rawUrl = urlMatch ? urlMatch[1] : args;
9957
+ }
9958
+ const url = typeof rawUrl === "string" ? rawUrl.trim() : "";
9959
+ if (!url) {
9960
+ return "ERROR: No target URL provided.";
9961
+ }
9920
9962
  const maxRetries = 3;
9921
9963
  let lastError = null;
9922
9964
  for (let attempt = 1; attempt <= maxRetries; attempt++) {
@@ -10275,11 +10317,12 @@ var init_update_file = __esm({
10275
10317
  const parsed = parseArgs(args);
10276
10318
  const targetPath = parsed.path;
10277
10319
  if (!targetPath) return 'ERROR: Missing "path" argument for update_file.';
10278
- const { patchPairs, error: parseError } = parsePatchPairs(parsed);
10320
+ const { patchPairs, allowMultiple: parsedAllowMultiple, error: parseError } = parsePatchPairs(parsed);
10279
10321
  if (parseError) return `ERROR: ${parseError}`;
10280
10322
  if (patchPairs.length === 0) {
10281
10323
  return "ERROR: No valid replacement pairs found. Use replaceContent1, newContent1, etc.";
10282
10324
  }
10325
+ const allowMultiple = parsed.allowMultiple !== void 0 ? parsed.allowMultiple === true || String(parsed.allowMultiple).toLowerCase() === "true" : parsedAllowMultiple;
10283
10326
  const absolutePath = path15.resolve(process.cwd(), targetPath);
10284
10327
  try {
10285
10328
  if (!fs16.existsSync(absolutePath)) {
@@ -10288,7 +10331,7 @@ var init_update_file = __esm({
10288
10331
  let diskContent = context.forcedContent || fs16.readFileSync(absolutePath, "utf8");
10289
10332
  if (diskContent.startsWith("\uFEFF")) diskContent = diskContent.slice(1);
10290
10333
  const originalContent = diskContent.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
10291
- const { content: finalContent, results } = applyPatches(originalContent, patchPairs);
10334
+ const { content: finalContent, results } = applyPatches(originalContent, patchPairs, { allowMultiple });
10292
10335
  const failures = results.filter((r) => !r.success);
10293
10336
  const successes = results.filter((r) => r.success);
10294
10337
  if (successes.length === 0) {
@@ -10320,12 +10363,171 @@ ${diffText}`;
10320
10363
  // src/tools/read_folder.js
10321
10364
  import fs17 from "fs";
10322
10365
  import path16 from "path";
10323
- var read_folder;
10366
+ var EXCLUDED_DIRS, isExcludedDir, read_folder;
10324
10367
  var init_read_folder = __esm({
10325
10368
  "src/tools/read_folder.js"() {
10326
10369
  init_arg_parser();
10370
+ EXCLUDED_DIRS = /* @__PURE__ */ new Set([
10371
+ // Version control, package managers & build clutter
10372
+ ".git",
10373
+ "node_modules",
10374
+ ".gemini",
10375
+ "dist",
10376
+ "build",
10377
+ ".next",
10378
+ "out",
10379
+ ".cache",
10380
+ "bin",
10381
+ "obj",
10382
+ "vendor",
10383
+ "venv",
10384
+ ".idea",
10385
+ ".gradle",
10386
+ ".terraform",
10387
+ "target",
10388
+ "coverage",
10389
+ ".vscode",
10390
+ ".svn",
10391
+ ".hg",
10392
+ ".fslckout",
10393
+ ".github",
10394
+ ".gitlab",
10395
+ ".circleci",
10396
+ ".gitea",
10397
+ ".gitee",
10398
+ ".lerna",
10399
+ ".changeset",
10400
+ ".nx",
10401
+ ".npm",
10402
+ ".yarn",
10403
+ ".pnpm-store",
10404
+ ".expo",
10405
+ ".nuxt",
10406
+ ".svelte-kit",
10407
+ ".docusaurus",
10408
+ ".turbo",
10409
+ ".vercel",
10410
+ "bower_components",
10411
+ ".netlify",
10412
+ ".vuepress",
10413
+ ".quasar",
10414
+ ".output",
10415
+ ".angular",
10416
+ "jspm_packages",
10417
+ ".parcel-cache",
10418
+ ".rollup.cache",
10419
+ ".rspack",
10420
+ ".vitepress",
10421
+ "__pycache__",
10422
+ ".pytest_cache",
10423
+ ".mypy_cache",
10424
+ ".tox",
10425
+ ".poetry",
10426
+ "env",
10427
+ "vhdl",
10428
+ ".ipynb_checkpoints",
10429
+ ".jupyter",
10430
+ ".conda",
10431
+ ".pdm-build",
10432
+ ".bundle",
10433
+ ".yardoc",
10434
+ ".metadata",
10435
+ "App_Data",
10436
+ "ClientBin",
10437
+ ".cargo",
10438
+ ".rustc_info",
10439
+ ".go",
10440
+ "Godeps",
10441
+ "_vendor",
10442
+ ".rake_tasks",
10443
+ "CMakefiles",
10444
+ ".wakatime",
10445
+ ".dart_tool",
10446
+ ".fvm",
10447
+ ".cocoapods",
10448
+ "Pods",
10449
+ ".pub-cache",
10450
+ ".symlinks",
10451
+ "DerivedData",
10452
+ ".xcworkspace",
10453
+ ".serverless",
10454
+ ".aws",
10455
+ ".gcloud",
10456
+ ".azure",
10457
+ ".kube",
10458
+ ".vagrant",
10459
+ ".docker",
10460
+ "postgres-data",
10461
+ "redis-data",
10462
+ "mongo-data",
10463
+ ".Spotlight-V100",
10464
+ ".Trashes",
10465
+ "$RECYCLE.BIN",
10466
+ "System Volume Information",
10467
+ ".DocumentRevisions-V100",
10468
+ ".fseventsd",
10469
+ "AppData",
10470
+ "Application Data",
10471
+ "Local",
10472
+ "LocalLow",
10473
+ "Roaming",
10474
+ "$WinREAgent",
10475
+ "$WINDOWS.~BT",
10476
+ "$WINDOWS.~WS",
10477
+ "scw",
10478
+ "System32",
10479
+ "SysWOW64",
10480
+ ".AppleDouble",
10481
+ ".AppleDB",
10482
+ ".AppleDesktop",
10483
+ "_CodeSignature",
10484
+ ".cmio",
10485
+ ".LSOverride",
10486
+ ".localized",
10487
+ ".TemporaryItems",
10488
+ ".Trash",
10489
+ ".Trash-0",
10490
+ ".Trash-1000",
10491
+ ".gvfs",
10492
+ ".local",
10493
+ ".config",
10494
+ ".dbus",
10495
+ ".fontconfig",
10496
+ ".snap",
10497
+ ".var",
10498
+ ".lost+found",
10499
+ "lost+found",
10500
+ ".thumb",
10501
+ ".thumbnails",
10502
+ "EFI",
10503
+ "boot",
10504
+ "grub",
10505
+ "logs",
10506
+ "log",
10507
+ ".nyc_output",
10508
+ ".sonar",
10509
+ ".ruff_cache",
10510
+ ".VSCodeCounter"
10511
+ ]);
10512
+ isExcludedDir = (dirName) => EXCLUDED_DIRS.has(dirName) || dirName.startsWith(".pnpm");
10327
10513
  read_folder = async (args) => {
10328
- const { path: targetPath = "." } = parseArgs(args);
10514
+ const parsed = parseArgs(args);
10515
+ const targetPath = parsed.path || null;
10516
+ if (!targetPath) {
10517
+ return "ERROR: No directory path provided.";
10518
+ }
10519
+ let recurseDepth = 0;
10520
+ if (parsed.recurse !== void 0 && parsed.recurse !== null) {
10521
+ if (typeof parsed.recurse === "number") {
10522
+ recurseDepth = parsed.recurse;
10523
+ } else if (typeof parsed.recurse === "boolean") {
10524
+ recurseDepth = parsed.recurse ? 1 : 0;
10525
+ } else {
10526
+ const val = parseInt(String(parsed.recurse).trim(), 10);
10527
+ recurseDepth = isNaN(val) ? 0 : val;
10528
+ }
10529
+ }
10530
+ recurseDepth = Math.max(0, Math.min(5, recurseDepth));
10329
10531
  const absolutePath = path16.resolve(process.cwd(), targetPath);
10330
10532
  try {
10331
10533
  if (!fs17.existsSync(absolutePath)) {
@@ -10333,52 +10535,139 @@ var init_read_folder = __esm({
10333
10535
  }
10334
10536
  const stats = fs17.statSync(absolutePath);
10335
10537
  if (!stats.isDirectory()) {
10336
- return `ERROR: Path [${targetPath}] is a file, not a directory. Use view_file instead.`;
10337
- }
10338
- const files = fs17.readdirSync(absolutePath);
10339
- const totalItems = files.length;
10340
- const maxDisplay = 100;
10341
- const displayItems = files.slice(0, maxDisplay);
10342
- const folderData = [];
10343
- for (const file of displayItems) {
10344
- const fPath = path16.join(absolutePath, file);
10345
- let indicator = "\u{1F4C4}";
10346
- let info = { name: file, type: "unknown", size: "N/A", mtime: "N/A" };
10538
+ return `ERROR: Path [${targetPath}] is a file, not a directory. Use ReadFile instead.`;
10539
+ }
10540
+ if (recurseDepth === 0) {
10541
+ const files = fs17.readdirSync(absolutePath);
10542
+ const totalItems = files.length;
10543
+ const maxDisplay = 150;
10544
+ const displayItems = files.slice(0, maxDisplay);
10545
+ const folderData = [];
10546
+ for (const file of displayItems) {
10547
+ const fPath = path16.join(absolutePath, file);
10548
+ let info = { name: file, type: "unknown", size: "N/A", mtime: "N/A" };
10549
+ try {
10550
+ const fStats = fs17.statSync(fPath);
10551
+ info = {
10552
+ name: file,
10553
+ type: fStats.isDirectory() ? "directory" : "file",
10554
+ size: (fStats.size / 1024).toFixed(1) + " KB",
10555
+ mtime: fStats.mtime.toLocaleString()
10556
+ };
10557
+ } catch (e) {
10558
+ info.type = "inaccessible";
10559
+ }
10560
+ folderData.push(info);
10561
+ }
10562
+ const formatted = folderData.map((f) => {
10563
+ const indicator = f.type === "directory" ? "\u{1F4C1}" : f.type === "file" ? "\u{1F4C4}" : "\u2753";
10564
+ if (f.type === "directory") {
10565
+ return `${indicator} ${f.name} - [DIR] - [Modified: ${f.mtime}]`;
10566
+ }
10567
+ return `${indicator} ${f.name} - [Size: ${f.size}] - [Modified: ${f.mtime}]`;
10568
+ }).join("\n");
10569
+ let footer2 = `
10570
+
10571
+ (Total items in folder: ${totalItems})`;
10572
+ if (totalItems > maxDisplay) {
10573
+ footer2 = `
10574
+
10575
+ \u26A0\uFE0F TRUNCATED: Showing first ${maxDisplay} of ${totalItems} items.`;
10576
+ }
10577
+ files.length = 0;
10578
+ displayItems.length = 0;
10579
+ folderData.length = 0;
10580
+ return `Detailed folder stats for [${targetPath}]:
10581
+
10582
+ ${formatted}${footer2}`;
10583
+ }
10584
+ let totalDirectories = 0;
10585
+ let totalFiles = 0;
10586
+ let totalItemsScanned = 0;
10587
+ const maxTotalItems = 500;
10588
+ let truncated = false;
10589
+ const buildTree = (dirPath, currentDepth, prefix = "") => {
10590
+ if (currentDepth > recurseDepth + 1 || truncated) return [];
10591
+ let entries = [];
10347
10592
  try {
10348
- const fStats = fs17.statSync(fPath);
10349
- info = {
10350
- name: file,
10351
- type: fStats.isDirectory() ? "directory" : "file",
10352
- size: (fStats.size / 1024).toFixed(1) + " KB",
10353
- mtime: fStats.mtime.toLocaleString()
10354
- };
10593
+ entries = fs17.readdirSync(dirPath);
10355
10594
  } catch (e) {
10356
- info.type = "inaccessible";
10595
+ return [`${prefix}\u26A0\uFE0F [Inaccessible Directory]`];
10357
10596
  }
10358
- folderData.push(info);
10359
- }
10360
- const formatted = folderData.map((f) => {
10361
- const indicator = f.type === "directory" ? "\u{1F4C1}" : f.type === "file" ? "\u{1F4C4}" : "\u2753";
10362
- if (f.type === "directory") {
10363
- return `${indicator} ${f.name} - [DIR] - [Modified: ${f.mtime}]`;
10597
+ const sortedEntries = [];
10598
+ for (const name of entries) {
10599
+ const fullPath = path16.join(dirPath, name);
10600
+ let isDir = false;
10601
+ try {
10602
+ isDir = fs17.statSync(fullPath).isDirectory();
10603
+ } catch (e) {
10604
+ }
10605
+ sortedEntries.push({ name, fullPath, isDir });
10364
10606
  }
10365
- return `${indicator} ${f.name} - [Size: ${f.size}] - [Modified: ${f.mtime}]`;
10366
- }).join("\n");
10607
+ sortedEntries.sort((a, b) => {
10608
+ if (a.isDir && !b.isDir) return -1;
10609
+ if (!a.isDir && b.isDir) return 1;
10610
+ return a.name.localeCompare(b.name);
10611
+ });
10612
+ const lines = [];
10613
+ const count = sortedEntries.length;
10614
+ for (let i = 0; i < count; i++) {
10615
+ if (totalItemsScanned >= maxTotalItems) {
10616
+ truncated = true;
10617
+ lines.push(`${prefix}\u26A0\uFE0F [Truncated - Maximum item limit reached (${maxTotalItems})]`);
10618
+ break;
10619
+ }
10620
+ const item = sortedEntries[i];
10621
+ const isLast = i === count - 1;
10622
+ const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
10623
+ const childPrefix = prefix + (isLast ? " " : "\u2502 ");
10624
+ totalItemsScanned++;
10625
+ let itemType = "unknown";
10626
+ let sizeStr = "N/A";
10627
+ let mtimeStr = "N/A";
10628
+ try {
10629
+ const fStats = fs17.statSync(item.fullPath);
10630
+ if (fStats.isDirectory()) {
10631
+ itemType = "directory";
10632
+ mtimeStr = fStats.mtime.toLocaleString();
10633
+ totalDirectories++;
10634
+ } else {
10635
+ itemType = "file";
10636
+ sizeStr = (fStats.size / 1024).toFixed(1) + " KB";
10637
+ mtimeStr = fStats.mtime.toLocaleString();
10638
+ totalFiles++;
10639
+ }
10640
+ } catch (e) {
10641
+ itemType = "inaccessible";
10642
+ }
10643
+ const indicator = itemType === "directory" ? "\u{1F4C1}" : itemType === "file" ? "\u{1F4C4}" : "\u2753";
10644
+ let lineText = "";
10645
+ if (itemType === "directory") {
10646
+ lineText = `${prefix}${connector}${indicator} ${item.name} - [DIR] - [Modified: ${mtimeStr}]`;
10647
+ } else {
10648
+ lineText = `${prefix}${connector}${indicator} ${item.name} - [Size: ${sizeStr}] - [Modified: ${mtimeStr}]`;
10649
+ }
10650
+ lines.push(lineText);
10651
+ if (itemType === "directory" && currentDepth <= recurseDepth && !isExcludedDir(item.name)) {
10652
+ const childLines = buildTree(item.fullPath, currentDepth + 1, childPrefix);
10653
+ lines.push(...childLines);
10654
+ }
10655
+ }
10656
+ return lines;
10657
+ };
10658
+ const treeLines = buildTree(absolutePath, 1, "");
10659
+ const formattedTree = treeLines.join("\n");
10367
10660
  let footer = `
10368
10661
 
10369
- (Total items in folder: ${totalItems})`;
10370
- if (totalItems > maxDisplay) {
10662
+ (Total items scanned: ${totalItemsScanned}, Directories: ${totalDirectories}, Files: ${totalFiles})`;
10663
+ if (truncated) {
10371
10664
  footer = `
10372
10665
 
10373
- \u26A0\uFE0F TRUNCATED: Showing first ${maxDisplay} of ${totalItems} items.`;
10666
+ \u26A0\uFE0F TRUNCATED: Scan capped at ${maxTotalItems} items. (Directories: ${totalDirectories}, Files: ${totalFiles})`;
10374
10667
  }
10375
- const result = `Detailed folder stats for [${targetPath}]:
10668
+ return `Detailed directory tree for [${targetPath}] (recurse depth: ${recurseDepth}):
10376
10669
 
10377
- ${formatted}${footer}`;
10378
- files.length = 0;
10379
- displayItems.length = 0;
10380
- folderData.length = 0;
10381
- return result;
10670
+ ${formattedTree}${footer}`;
10382
10671
  } catch (err) {
10383
10672
  const errorMsg = err instanceof Error ? err.message : String(err);
10384
10673
  return `ERROR: Failed to read folder [${targetPath}]: ${errorMsg}`;
@@ -10663,7 +10952,14 @@ async function getFilesRecursively(dir, excludes, baseDir = dir, depth = 1) {
10663
10952
  const fullPath = path19.join(dir, file.name);
10664
10953
  const relativePath = path19.relative(baseDir, fullPath);
10665
10954
  const pathSegments = relativePath.split(path19.sep).map((s) => s.toLowerCase());
10666
- const isExcluded = excludes.some((ex) => pathSegments.includes(ex.toLowerCase()));
10955
+ const fileNameLower = file.name.toLowerCase();
10956
+ const isExcluded = excludes.some((ex) => {
10957
+ const exLower = ex.toLowerCase();
10958
+ if (exLower.startsWith(".") && fileNameLower.endsWith(exLower)) {
10959
+ return true;
10960
+ }
10961
+ return pathSegments.some((seg) => seg === exLower || seg.startsWith(".pnpm"));
10962
+ });
10667
10963
  if (isExcluded) continue;
10668
10964
  if (file.isDirectory()) {
10669
10965
  const nestedFiles = await getFilesRecursively(fullPath, excludes, baseDir, depth + 1);
@@ -10715,46 +11011,195 @@ var init_search_keyword = __esm({
10715
11011
  const keyword = String(rawKeyword);
10716
11012
  const toBool = (v) => v === true || v === "true" || v === 1 || v === "1" || v === "yes";
10717
11013
  const regexExplicitlyFalse = regex === false || regex === "false" || regex === 0 || regex === "0" || regex === "no";
10718
- let matchRegex = toBool(regex);
10719
- let matchSubstring = !matchRegex && toBool(subString);
10720
- const hasRegexIndicators = /[|]/.test(keyword) || /\\([*+?{}()|[\]\^$])/.test(keyword) || (() => {
10721
- const stripped = keyword.replace(/\\./g, "");
10722
- return /[*+?{}()|]/.test(stripped) || /\[.*?\]/.test(stripped) || /^\^/.test(stripped) || /\$/.test(stripped);
10723
- })();
10724
- let isAutoRegex = true;
10725
- if (!matchRegex && !regexExplicitlyFalse && hasRegexIndicators) {
10726
- matchRegex = true;
10727
- isAutoRegex = true;
10728
- }
11014
+ const regexExplicitlyTrue = regex === true || regex === "true" || regex === 1 || regex === "1" || regex === "yes";
11015
+ let matchSubstring = regexExplicitlyFalse && toBool(subString);
11016
+ let regexPattern = null;
11017
+ let wordRegex = null;
10729
11018
  if (regexExplicitlyFalse) {
10730
- matchRegex = false;
10731
- isAutoRegex = false;
10732
- }
10733
- let regexPattern;
10734
- let wordRegex;
10735
- if (matchRegex) {
11019
+ if (!matchSubstring) {
11020
+ wordRegex = new RegExp(`(?<![\\w])${keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w])`, "i");
11021
+ }
11022
+ } else {
10736
11023
  try {
10737
11024
  regexPattern = new RegExp(keyword, "i");
10738
11025
  } catch (e) {
10739
- return `ERROR: Invalid regex pattern "${keyword}": ${e.message}`;
11026
+ if (regexExplicitlyTrue) {
11027
+ return `ERROR: Invalid regex pattern "${keyword}": ${e.message}`;
11028
+ }
10740
11029
  }
10741
- } else {
10742
11030
  wordRegex = new RegExp(`(?<![\\w])${keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}(?![\\w])`, "i");
10743
11031
  }
10744
11032
  const excludes = [
10745
- "node_modules",
11033
+ // Clutter, VCS, Cache & Build Directories
10746
11034
  ".git",
11035
+ "node_modules",
11036
+ ".gemini",
10747
11037
  "dist",
11038
+ "build",
10748
11039
  ".next",
10749
- ".gemini",
11040
+ "out",
11041
+ ".cache",
11042
+ "bin",
11043
+ "obj",
11044
+ "vendor",
11045
+ "venv",
11046
+ ".idea",
11047
+ ".gradle",
11048
+ ".terraform",
11049
+ "target",
11050
+ "coverage",
11051
+ ".vscode",
11052
+ ".svn",
11053
+ ".hg",
11054
+ ".fslckout",
11055
+ ".github",
11056
+ ".gitlab",
11057
+ ".circleci",
11058
+ ".gitea",
11059
+ ".gitee",
11060
+ ".lerna",
11061
+ ".changeset",
11062
+ ".nx",
11063
+ ".npm",
11064
+ ".yarn",
11065
+ ".pnpm-store",
11066
+ ".pnpm",
11067
+ ".expo",
11068
+ ".nuxt",
11069
+ ".svelte-kit",
11070
+ ".docusaurus",
11071
+ ".turbo",
11072
+ ".vercel",
11073
+ "bower_components",
11074
+ ".netlify",
11075
+ ".vuepress",
11076
+ ".quasar",
11077
+ ".output",
11078
+ ".angular",
11079
+ "jspm_packages",
11080
+ ".parcel-cache",
11081
+ ".rollup.cache",
11082
+ ".rspack",
11083
+ ".vitepress",
11084
+ "__pycache__",
11085
+ ".pytest_cache",
11086
+ ".mypy_cache",
11087
+ ".tox",
11088
+ ".poetry",
11089
+ "env",
11090
+ "vhdl",
11091
+ ".ipynb_checkpoints",
11092
+ ".jupyter",
11093
+ ".conda",
11094
+ ".pdm-build",
11095
+ ".bundle",
11096
+ ".yardoc",
11097
+ ".metadata",
11098
+ "App_Data",
11099
+ "ClientBin",
11100
+ ".cargo",
11101
+ ".rustc_info",
11102
+ ".go",
11103
+ "Godeps",
11104
+ "_vendor",
11105
+ ".rake_tasks",
11106
+ "CMakefiles",
11107
+ ".wakatime",
11108
+ ".dart_tool",
11109
+ ".fvm",
11110
+ ".cocoapods",
11111
+ "Pods",
11112
+ ".pub-cache",
11113
+ ".symlinks",
11114
+ "DerivedData",
11115
+ ".xcworkspace",
11116
+ ".serverless",
11117
+ ".aws",
11118
+ ".gcloud",
11119
+ ".azure",
11120
+ ".kube",
11121
+ ".vagrant",
11122
+ ".docker",
11123
+ "postgres-data",
11124
+ "redis-data",
11125
+ "mongo-data",
11126
+ ".Spotlight-V100",
11127
+ ".Trashes",
11128
+ "$RECYCLE.BIN",
11129
+ "System Volume Information",
11130
+ ".DocumentRevisions-V100",
11131
+ ".fseventsd",
11132
+ "AppData",
11133
+ "Application Data",
11134
+ "Local",
11135
+ "LocalLow",
11136
+ "Roaming",
11137
+ "$WinREAgent",
11138
+ "$WINDOWS.~BT",
11139
+ "$WINDOWS.~WS",
11140
+ "scw",
11141
+ "System32",
11142
+ "SysWOW64",
11143
+ ".AppleDouble",
11144
+ ".AppleDB",
11145
+ ".AppleDesktop",
11146
+ "_CodeSignature",
11147
+ ".cmio",
11148
+ ".LSOverride",
11149
+ ".localized",
11150
+ ".TemporaryItems",
11151
+ ".Trash",
11152
+ ".Trash-0",
11153
+ ".Trash-1000",
11154
+ ".gvfs",
11155
+ ".local",
11156
+ ".config",
11157
+ ".dbus",
11158
+ ".fontconfig",
11159
+ ".snap",
11160
+ ".var",
11161
+ ".lost+found",
11162
+ "lost+found",
11163
+ ".thumb",
11164
+ ".thumbnails",
11165
+ "EFI",
11166
+ "boot",
11167
+ "grub",
11168
+ "logs",
11169
+ "log",
11170
+ ".nyc_output",
11171
+ ".sonar",
11172
+ ".ruff_cache",
11173
+ ".VSCodeCounter",
11174
+ // Binaries, Media, Compressed & Font Files
10750
11175
  ".exe",
10751
11176
  ".dll",
11177
+ ".so",
11178
+ ".dylib",
10752
11179
  ".png",
10753
11180
  ".jpg",
10754
11181
  ".jpeg",
10755
11182
  ".gif",
11183
+ ".ico",
11184
+ ".svg",
11185
+ ".webp",
11186
+ ".mp3",
11187
+ ".mp4",
11188
+ ".avi",
10756
11189
  ".zip",
10757
- ".tgz"
11190
+ ".tgz",
11191
+ ".tar",
11192
+ ".gz",
11193
+ ".7z",
11194
+ ".rar",
11195
+ ".pdf",
11196
+ ".docx",
11197
+ ".xlsx",
11198
+ ".pptx",
11199
+ ".woff",
11200
+ ".woff2",
11201
+ ".ttf",
11202
+ ".eot"
10758
11203
  ];
10759
11204
  const maxMatches = 150;
10760
11205
  try {
@@ -10788,7 +11233,7 @@ var init_search_keyword = __esm({
10788
11233
  const lines = content.split(/\r?\n/);
10789
11234
  const fileMatches = [];
10790
11235
  for (let i = 0; i < lines.length; i++) {
10791
- const matched = matchRegex ? regexPattern.test(lines[i]) : matchSubstring ? lines[i].toLowerCase().includes(keyword.toLowerCase()) || fuzzyMatch(lines[i], keyword) : wordRegex.test(lines[i]);
11236
+ const matched = regexExplicitlyFalse ? matchSubstring ? lines[i].toLowerCase().includes(keyword.toLowerCase()) || fuzzyMatch(lines[i], keyword) : wordRegex && wordRegex.test(lines[i]) : regexPattern && regexPattern.test(lines[i]) || wordRegex && wordRegex.test(lines[i]);
10792
11237
  if (matched) {
10793
11238
  fileMatches.push({ line: i + 1, content: lines[i].trim() });
10794
11239
  }
@@ -10814,7 +11259,7 @@ var init_search_keyword = __esm({
10814
11259
  if (typeof global.gc === "function") {
10815
11260
  global.gc();
10816
11261
  }
10817
- const modeLabel = matchRegex ? isAutoRegex ? "(regex mode)" : "(keyword mode)" : matchSubstring ? "(subString mode)" : "";
11262
+ const modeLabel = regexExplicitlyFalse ? matchSubstring ? "(subString mode)" : "(keyword mode)" : regexExplicitlyTrue ? "(regex mode)" : "(standard mode)";
10818
11263
  if (fileGroups.length === 0) {
10819
11264
  const zeroLocation = pathArgType === "file" ? ` in '${pathArg}'` : pathArgType === "dir" ? ` in '${pathArg}'` : ". Try to specify files";
10820
11265
  const dirPrefix2 = pathArgType === "dir" ? "[DIR]" : "";
@@ -14598,6 +15043,7 @@ Provide a consolidated summary of the entire session.`;
14598
15043
  ".npm",
14599
15044
  ".yarn",
14600
15045
  ".pnpm-store",
15046
+ ".pnpm",
14601
15047
  ".expo",
14602
15048
  ".nuxt",
14603
15049
  ".svelte-kit",
@@ -14728,7 +15174,7 @@ Provide a consolidated summary of the entire session.`;
14728
15174
  const entries = safeReaddirWithTypes(dir);
14729
15175
  for (const entry of entries) {
14730
15176
  if (currentCount.value > 6200) break;
14731
- if (COLLAPSED_DIRS_GLOBAL.includes(entry.name)) continue;
15177
+ if (COLLAPSED_DIRS_GLOBAL.includes(entry.name) || entry.name.startsWith(".")) continue;
14732
15178
  if (entry.isDirectory()) {
14733
15179
  currentCount.value++;
14734
15180
  countFolders(path25.join(dir, entry.name), currentCount, depth + 1);
@@ -14745,8 +15191,8 @@ Provide a consolidated summary of the entire session.`;
14745
15191
  }
14746
15192
  let result = "";
14747
15193
  const COLLAPSED_DIRS = COLLAPSED_DIRS_GLOBAL;
14748
- const filtered = entries.filter((e) => !COLLAPSED_DIRS.includes(e.name));
14749
- const collapsedInDir = entries.filter((e) => COLLAPSED_DIRS.includes(e.name)).map((e) => e.name).sort();
15194
+ const filtered = entries.filter((e) => !COLLAPSED_DIRS.includes(e.name) && !e.name.startsWith("."));
15195
+ const collapsedInDir = entries.filter((e) => COLLAPSED_DIRS.includes(e.name) || e.name.startsWith(".")).map((e) => e.name).sort();
14750
15196
  filtered.sort((a, b) => {
14751
15197
  if (a.isDirectory() && !b.isDirectory()) return -1;
14752
15198
  if (!a.isDirectory() && b.isDirectory()) return 1;
@@ -14832,10 +15278,11 @@ ${currentSummary}
14832
15278
  }
14833
15279
  const activeSummaryBlock = currentSummary && !hasExistingTurnsAfterCompression ? `
14834
15280
  [SYSTEM METADATA]
14835
- **CONTEXT SUMMARY OF PREVIOUS TURNS (PRIORITY: DYNAMIC)**
15281
+ **CONTEXT SUMMARY OF PREVIOUS TURNS**
14836
15282
  ${currentSummary}
14837
15283
  ` : "";
14838
- let dirStructure = process.cwd() + "\n" + getDirTree(process.cwd(), dynamicMaxDepth);
15284
+ let dirStructure = "CWD: " + process.cwd() + `${isPlayground ? " [PLAYGROUND MODE]" : ""}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
15285
+ ` + getDirTree(process.cwd(), dynamicMaxDepth);
14839
15286
  const ideCtx = await getIDEContext();
14840
15287
  let ideBlock = "";
14841
15288
  if (isBridgeConnected()) {
@@ -15112,12 +15559,12 @@ ${ideCtx.warnings}
15112
15559
  }
15113
15560
  const osDetected = process.platform === "win32" ? "Windows" : process.platform === "darwin" ? "macOS" : "Linux";
15114
15561
  const cleanPromptForModel = cleanAgentText.replace(/\\(@\[[^\]]+\])/g, "$1");
15115
- const firstUserMsg = `[SYSTEM METADATA (PRIORITY: DYNAMIC), Chat Context >> Metadata] Time: ${dateTimeStr}
15562
+ const firstUserMsg = `[SYSTEM METADATA, Chat Context > Metadata]
15563
+ Time: ${dateTimeStr}
15116
15564
  OS: ${osDetected}
15117
- CWD: ${process.cwd()}${isPlayground ? " [PLAYGROUND MODE]" : ""}${cwdMismatch ? ` (WARNING: CWD Mismatch! Previous Path: ${lastCwd})` : ""}
15118
15565
  **DIRECTORY STRUCTURE**
15119
15566
  ${dirStructure}${memoryPrompt}${ideBlock}
15120
- ${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]
15567
+ ${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]
15121
15568
  ${taggedContextStr}[USER PROMPT] ${cleanPromptForModel.trim()} [/USER PROMPT]`.trim();
15122
15569
  const userMsgObj = { role: "user", text: firstUserMsg };
15123
15570
  if (attachedBinaryPart) {
@@ -15982,10 +16429,10 @@ ${ideErr} [/ERROR]`;
15982
16429
  let label = "";
15983
16430
  if (normToolName === "web_search") {
15984
16431
  const { query, limit = 10, aiMode = false } = parseArgs(toolCall.args);
15985
- label = `\u2714 ${aiMode ? "AI Search" : "Searched"}: ${query}${aiMode === false ? ` \u2192 ${limit}` : ""}`;
16432
+ label = `${query ? "\u2714" : "\u2718"} ${aiMode ? "AI Search" : "Searched"}: ${query ? `${query}` : "No Search Query"}${aiMode === false && query ? ` \u2192 ${limit}` : ""}`;
15986
16433
  } else if (normToolName === "web_scrape") {
15987
- const url = parseArgs(toolCall.args).url || "...";
15988
- label = `\u2714 Visited: ${url}`;
16434
+ const url = parseArgs(toolCall.args).url || null;
16435
+ label = `${url ? "\u2714" : "\u2718"} Visited: ${url ? url : "No Source"}`;
15989
16436
  } else if (normToolName === "view_file") {
15990
16437
  const { path: targetPath2, StartLine, EndLine, start_line, end_line, startLine, endLine } = parseArgs(toolCall.args);
15991
16438
  const rawStart = StartLine || start_line || startLine;
@@ -16004,33 +16451,35 @@ ${ideErr} [/ERROR]`;
16004
16451
  }
16005
16452
  } catch (e) {
16006
16453
  }
16007
- const pathLower = targetPath2.toLowerCase();
16454
+ const pathLower = (targetPath2 || "").toLowerCase();
16008
16455
  const isPdf = pathLower.endsWith(".pdf");
16009
16456
  const isOfficeFile = pathLower.endsWith(".docx") || pathLower.endsWith(".doc") || pathLower.endsWith(".ppt") || pathLower.endsWith(".pptx") || pathLower.endsWith(".xls") || pathLower.endsWith(".xlsx");
16010
16457
  const isImage = /\.(png|jpg|jpeg|webp|gif|bmp)$/.test(pathLower);
16011
16458
  if (isPdf || isOfficeFile) {
16012
- label = `\u2714 Analyzed: ${path25.basename(targetPath2)}`;
16459
+ label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Analyzed: ${path25.basename(targetPath2)}` : "Analyzed: File Not Found"}`;
16013
16460
  } else if (isImage) {
16014
- label = `\u2714 Processed: ${path25.basename(targetPath2)}`;
16461
+ label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Processed: ${path25.basename(targetPath2)}` : "Processed: File Not Found"}`;
16015
16462
  } else {
16016
- label = `${totalLines !== "..." ? "\u2714" : "\u2718"} Read: ${path25.basename(targetPath2)} \u2192 ${totalLines !== "..." ? `Lines ${sLine} - ${actualEndLine} of ${totalLines}` : "File Not Found"}`;
16463
+ label = `${totalLines !== "..." ? "\u2714" : "\u2718"} Read: ${targetPath2 ? `${path25.basename(targetPath2)} \u2192 ${totalLines !== "..." ? `Lines ${sLine} - ${actualEndLine} of ${totalLines}` : "File Not Found"}` : "File Not Found"}`;
16017
16464
  }
16018
16465
  } else if (normToolName === "list_files" || normToolName === "read_folder") {
16019
16466
  const action = normToolName === "list_files" ? "List" : "Browsed";
16020
- const path27 = parseArgs(toolCall.args).path;
16021
- label = `\u2714 ${action}: ${path27 === "." ? "./" : path27}`;
16467
+ const path27 = parseArgs(toolCall.args).path || null;
16468
+ const recurse = parseArgs(toolCall.args).recurse || 0;
16469
+ label = `${path27 ? "\u2714" : "\u2718"} ${action}: ${path27 ? `${path27 === "." ? "./" : `${path27}${recurse > 0 ? `${path27.endsWith("/") ? `*${recurse}` : `/*${recurse}`}` : `${path27.endsWith("/") ? "" : "/"}`}`}` : "No Folder Selected"}`;
16022
16470
  } else if (normToolName === "write_file" || normToolName === "update_file") {
16023
16471
  const action = normToolName === "write_file" ? "Created" : "Edited";
16024
- label = `\u2714 ${action}: ${parseArgs(toolCall.args).path || "..."}`;
16472
+ const path27 = parseArgs(toolCall.args).path || null;
16473
+ label = `${path27 ? "\u2714" : "\u2718"} ${action}: ${path27 || "No File Changes"}`;
16025
16474
  } else if (normToolName === "write_pdf") {
16026
- label = `\u2714 Generated: ${parseArgs(toolCall.args).path || "..."}
16027
- `;
16475
+ const path27 = parseArgs(toolCall.args).path || null;
16476
+ label = `${path27 ? "\u2714" : "\u2718"} Generated: ${path27 || "No PDF Generated"}`;
16028
16477
  } else if (normToolName === "write_docx") {
16029
- label = `\u2714 Generated: ${parseArgs(toolCall.args).path || "..."}
16030
- `;
16478
+ const path27 = parseArgs(toolCall.args).path || null;
16479
+ label = `${path27 ? "\u2714" : "\u2718"} Generated: ${path27 || "No Docx Generated"}`;
16031
16480
  } else if (normToolName === "file_map") {
16032
16481
  const path27 = parseArgs(toolCall.args).path;
16033
- label = `${path27 ? "\u2714" : "\u2718"} Indexed${path27 ? ": " + path27 : " File Not Found"}`;
16482
+ label = `${path27 ? "\u2714" : "\u2718"} Indexed: ${path27 ? "" + path27 : "File Not Found"}`;
16034
16483
  } else if (normToolName.toLowerCase() === "search_keyword" || normToolName.toLowerCase() === "todo") {
16035
16484
  label = "";
16036
16485
  } else if (normToolName.toLowerCase() === "generate_image") {
@@ -16215,7 +16664,7 @@ ${ideErr} [/ERROR]`;
16215
16664
  });
16216
16665
  if (isViolating) {
16217
16666
  const denyMsg = `Access Denied. Prohibited from accessing external directories while "External Workspace Access" is disabled.`;
16218
- if (settings.onExecStart) settings.onExecStart(command || "Unknown");
16667
+ if (settings.onExecStart) settings.onExecStart(command || "No Command");
16219
16668
  yield { type: "exec_start" };
16220
16669
  await new Promise((resolve) => setTimeout(resolve, 50));
16221
16670
  if (settings.onExecChunk) settings.onExecChunk(`ERROR: ${denyMsg}`);
@@ -16227,7 +16676,7 @@ ${ideErr} [/ERROR]`;
16227
16676
  continue;
16228
16677
  }
16229
16678
  }
16230
- if (settings.onExecStart) settings.onExecStart(command || "Unknown");
16679
+ if (settings.onExecStart) settings.onExecStart(command || "No Command");
16231
16680
  yield { type: "exec_start" };
16232
16681
  }
16233
16682
  const parsedArgs = parseArgs(toolCall.args);
@@ -16445,7 +16894,7 @@ ${ideErr} [/ERROR]`;
16445
16894
  if (normToolName === "write_file") {
16446
16895
  modifiedContent = toolArgs.content || toolArgs.newContent || "";
16447
16896
  } else {
16448
- const { patchPairs: patches, error: parseError } = parsePatchPairs(toolArgs);
16897
+ const { patchPairs: patches, allowMultiple: parsedAllowMultiple, error: parseError } = parsePatchPairs(toolArgs);
16449
16898
  if (parseError) {
16450
16899
  const errorMsg = `[TOOL RESULT]: ERROR: ${parseError}`;
16451
16900
  toolResults.push({ role: "user", text: errorMsg });
@@ -16455,8 +16904,9 @@ ${ideErr} [/ERROR]`;
16455
16904
  toolCallPointer++;
16456
16905
  continue;
16457
16906
  }
16907
+ const allowMultiple = toolArgs.allowMultiple !== void 0 ? toolArgs.allowMultiple === true || String(toolArgs.allowMultiple).toLowerCase() === "true" : parsedAllowMultiple;
16458
16908
  requestedPatchCount = patches.length;
16459
- const sim = applyPatches(originalContent, patches);
16909
+ const sim = applyPatches(originalContent, patches, { allowMultiple });
16460
16910
  modifiedContent = sim.content;
16461
16911
  patchResults = sim.results;
16462
16912
  const successes = patchResults.filter((r) => r.success);
@@ -16464,15 +16914,14 @@ ${ideErr} [/ERROR]`;
16464
16914
  if (successes.length === 0) {
16465
16915
  const errorMsg = `[TOOL RESULT]: ERROR: Failed to apply patches to [${path25.basename(absPath)}].
16466
16916
  ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
16467
- const errorLabel = `\u2714 Edited: ${path25.basename(absPath)}`.toUpperCase();
16917
+ const errorLabel = `\u2714 Edited: ${path25.basename(absPath)}`;
16468
16918
  let terminalWidth = 115;
16469
16919
  if (process.stdout.isTTY) {
16470
16920
  terminalWidth = process.stdout.columns - 5 || 120;
16471
16921
  }
16472
16922
  const boxWidth = Math.min(errorLabel.length + 4, terminalWidth);
16473
16923
  const boxMid = `${errorLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
16474
- yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
16475
- `) };
16924
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}`) };
16476
16925
  thisIsFirstToolFeedback = false;
16477
16926
  toolResults.push({ role: "user", text: errorMsg });
16478
16927
  await incrementUsage("toolFailure");
@@ -16547,12 +16996,18 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
16547
16996
  if (approval === "allow" && diffOpened && isBridgeConnected()) {
16548
16997
  const { path: filePath } = parseArgs(toolCall.args);
16549
16998
  const absPath = path25.resolve(process.cwd(), filePath);
16999
+ const normPath = (p) => p ? path25.resolve(p).replace(/\\/g, "/").toLowerCase() : "";
16550
17000
  const finalIDE = await getIDEContext();
16551
17001
  let finalContent = "";
16552
- if (finalIDE && finalIDE.file_focused === absPath && finalIDE.full_content) {
17002
+ if (finalIDE && finalIDE.file_focused && normPath(finalIDE.file_focused) === normPath(absPath) && finalIDE.full_content) {
16553
17003
  finalContent = finalIDE.full_content;
16554
- } else if (fs26.existsSync(absPath)) {
17004
+ }
17005
+ if (!finalContent && fs26.existsSync(absPath)) {
16555
17006
  finalContent = fs26.readFileSync(absPath, "utf8");
17007
+ if (!finalContent) {
17008
+ await new Promise((r) => setTimeout(r, 100));
17009
+ finalContent = fs26.readFileSync(absPath, "utf8");
17010
+ }
16556
17011
  }
16557
17012
  const verifiedLines = finalContent.split(/\r?\n/);
16558
17013
  const verifiedLineCount = verifiedLines.length;
@@ -16611,20 +17066,17 @@ ${tail}`;
16611
17066
 
16612
17067
  - Stats: [${verifiedLineCount2} lines, ${(verifiedSize2 / 1024).toFixed(1)} KB]
16613
17068
  ${ancestry2}- Content Preview:
16614
- ${snippet2}
16615
-
16616
- [SYSTEM] Check the content preview for verification [/SYSTEM]`;
17069
+ ${snippet2}`;
16617
17070
  }
16618
17071
  const action = normToolName === "write_file" ? "Created" : "Edited";
16619
- const feedbackLabel = `\u2714 ${action}: ${filePath || "..."}`;
17072
+ const feedbackLabel = `${filePath ? "\u2714" : "\u2718"} ${action}: ${filePath || "No File Changes"}`;
16620
17073
  let terminalWidth = 115;
16621
17074
  if (process.stdout.isTTY) {
16622
17075
  terminalWidth = process.stdout.columns - 5 || 120;
16623
17076
  }
16624
17077
  const boxWidth = Math.min(feedbackLabel.length + 4, terminalWidth);
16625
17078
  const boxMid = `${feedbackLabel.padEnd(boxWidth - 2).substring(0, boxWidth - 2)}`;
16626
- yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}
16627
- `) };
17079
+ yield { type: "visual_feedback", content: colorMainWords(`${thisIsFirstToolFeedback ? "\n" : ""}${boxMid}`) };
16628
17080
  thisIsFirstToolFeedback = false;
16629
17081
  const toolEnd2 = Date.now();
16630
17082
  lastToolFinishedAt = toolEnd2;
@@ -16651,7 +17103,7 @@ ${snippet2}
16651
17103
  }
16652
17104
  if (normToolName === "write_file" || normToolName === "update_file") {
16653
17105
  const action = normToolName === "write_file" ? "Write Cancelled" : "Edit Denied";
16654
- const deniedLabel = `\u2718 ${action}: ${parseArgs(toolCall.args).path || "..."}`.toUpperCase();
17106
+ const deniedLabel = `\u2718 ${action}: ${parseArgs(toolCall.args).path || "..."}`;
16655
17107
  let terminalWidth = 115;
16656
17108
  if (process.stdout.isTTY) {
16657
17109
  terminalWidth = process.stdout.columns - 5 || 120;
@@ -16690,8 +17142,9 @@ ${snippet2}
16690
17142
  }
16691
17143
  if (lastToolFinishedAt > 0) {
16692
17144
  const timeSinceLastTool = Date.now() - lastToolFinishedAt;
16693
- if (timeSinceLastTool < 1500) {
16694
- await new Promise((resolve) => setTimeout(resolve, 1e3 - timeSinceLastTool));
17145
+ const delay = Math.max(0, 1e3 - timeSinceLastTool);
17146
+ if (delay > 0) {
17147
+ await new Promise((resolve) => setTimeout(resolve, delay));
16695
17148
  }
16696
17149
  }
16697
17150
  let execToolContext = {
@@ -16757,7 +17210,7 @@ ${snippet2}
16757
17210
  }
16758
17211
  const _sp = path27 ? path27.replace(/[\/\\]+$/, "") : null;
16759
17212
  const displayPath = _sp && _sp !== "." ? `"${_isDir ? `${_sp}/*` : _sp}"` : "./";
16760
- const postLabel = `\u2714 Searched: "${keyword}" in ${displayPath} \u2192 ${matchCount} Match${matchCount === 1 ? "" : "es"}`;
17213
+ const postLabel = `${keyword ? "\u2714" : "\u2718"} Searched: "${keyword ? keyword : ""}" in ${displayPath} \u2192 ${matchCount} Match${matchCount === 1 ? "" : "es"}`;
16761
17214
  let terminalWidth = 115;
16762
17215
  if (process.stdout.isTTY) {
16763
17216
  terminalWidth = process.stdout.columns - 5 || 120;
@@ -17152,14 +17605,14 @@ Error Log can be found in ${path25.join(LOGS_DIR, "agent", "error.log")}`);
17152
17605
  if (toolResults.length < attemptedToolsCount) {
17153
17606
  combinedText += `
17154
17607
 
17155
- [SYSTEM] Only ${toolResults.length} out of ${attemptedToolsCount} attempted tool calls were executed. Verify proper syntax compliance & try failed calls again [/SYSTEM]`;
17608
+ [SYSTEM] Only ${toolResults.length} out of ${attemptedToolsCount} attempted tool calls were executed. Verify proper schema compliance & try failed calls again [/SYSTEM]`;
17156
17609
  }
17157
17610
  const binaryPart = toolResults.find((tr) => tr.binaryPart)?.binaryPart || null;
17158
17611
  modifiedHistory.push({ role: "user", text: combinedText, binaryPart });
17159
17612
  }
17160
17613
  } else {
17161
17614
  if (wasToolCalledInLastLoop || detectedAnyToolCalls) {
17162
- modifiedHistory.push({ role: "user", text: `[SYSTEM] Failed to execute some tools. Verify proper syntax compliance & try again [/SYSTEM]` });
17615
+ modifiedHistory.push({ role: "user", text: `[SYSTEM] Failed to execute some tools. Verify proper schema compliance & try again [/SYSTEM]` });
17163
17616
  } else {
17164
17617
  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 use [[END]]"}`} [/SYSTEM]` });
17165
17618
  }
@@ -17182,7 +17635,7 @@ Error Log can be found in ${path25.join(LOGS_DIR, "agent", "error.log")}`);
17182
17635
  })() : String(err);
17183
17636
  const date = (/* @__PURE__ */ new Date()).toLocaleString();
17184
17637
  const agentErrDir = path25.join(LOGS_DIR, "agent");
17185
- yield { type: "text", content: `\u274C CRITICAL ERROR: ${errLog}` };
17638
+ yield { type: "text", content: `\u274C CRITICAL ERROR: ${errLog.includes("fetch failed") ? "Failed to Connect. Check your Internet Connection or Wait a moment" : errLog}` };
17186
17639
  if (!fs26.existsSync(agentErrDir)) fs26.mkdirSync(agentErrDir, { recursive: true });
17187
17640
  fs26.appendFileSync(path25.join(agentErrDir, "error.log"), `CRITICAL ERROR [${date}]: ${err}
17188
17641
 
@@ -17215,15 +17668,15 @@ Error Log can be found in ${path25.join(LOGS_DIR, "agent", "error.log")}`);
17215
17668
  const mergedSettings = { ...savedSettings, ...settings };
17216
17669
  const targetModel = model || settings?.modelName || settings?.activeModel || savedSettings.activeModel;
17217
17670
  const SUBAGENT_TOOL_DEFINITIONS = {
17218
- "readfile": '- [tool:functions.ReadFile(path="...", startLine=number, endLine=number)]. View files',
17219
- "readfolder": '- [tool:functions.ReadFolder(path="...")]. Detailed DIR stats including File Sizes',
17220
- "filemap": '- [tool:functions.FileMap(path="path/file")]. Shows file structure, functions, class, import/export, variables',
17221
- "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**',
17222
- "writefile": '- [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. Verify Imports',
17223
- "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',
17224
- "websearch": '- [tool:functions.WebSearch(query="...", aiMode="true optional", limit=number)]. Limit 3-10 (aiMode ignores). Usage: unknown info/docs. aiMode: LLM search (default: false)',
17671
+ "readfile": '- [tool:functions.ReadFile(path="...", startLine="integer", endLine="integer")]. View files',
17672
+ "readfolder": '- [tool:functions.ReadFolder(path="...", recurse="integer 0-4 optional, default: 0")]. Detailed DIR stats including File Sizes',
17673
+ "filemap": '- [tool:functions.FileMap(path="file")]. Shows file structure, functions, class, import/export, variables',
17674
+ "patchfile": '- [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX 15)]. Surgical patch. allowMultiple: Replace all matches. Multiple patches same file? Use replaceContent2/newContent2... Verify DIFFs',
17675
+ "writefile": '- [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. VERIFY IMPORTS',
17676
+ "searchkeyword": '- [tool:functions.SearchKeyword(keyword="...", path="optional, target directory/filename", subString="bool optional, default: false", regex="bool optional, default: auto")]. Project-wide search. path limits scope to a file/dir. Find definitions/logic without full reads. Locate relevant code',
17677
+ "websearch": '- [tool:functions.WebSearch(query="...", aiMode="bool optional, default: false", limit="integer 3-10, aiMode: exclude")]. Usage: unknown info/docs. aiMode: LLM search',
17225
17678
  "webscrape": '- [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api',
17226
- "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`
17679
+ "ask": `- [tool:functions.Ask(question="...", optionA="option::description", ...MAX 4)]. Ambiguity: MUST for path divergence, security risk. Ask, don't finish/guess. Suggest best options; no preferences. Keep options short`
17227
17680
  };
17228
17681
  const providedToolsSection = `-- TOOL DEFINITIONS (path = relative to CWD, path separator: '/') --
17229
17682
  TO ACCESS TOOLS **STRICTLY USE THE EXACT FORMAT IN CHAT OUTPUT:** [tool:functions.ToolName(args)]
@@ -17235,7 +17688,7 @@ TOOL POLICY:
17235
17688
  - FileMap \u2192 ReadFile for efficient file understanding
17236
17689
  - Need specific text ? SearchKeyword > Guessing/ReadFile
17237
17690
  - Huge files ? SearchKeyword > FileMap/Full Read
17238
- - NO Terminal Access
17691
+ - NO Shell Access
17239
17692
 
17240
17693
  -- PROVIDED TOOLS --
17241
17694
  ${Object.values(SUBAGENT_TOOL_DEFINITIONS).join("\n")}
@@ -17331,17 +17784,19 @@ ${cleanResponse}
17331
17784
  const path27 = parseArgs(toolCall.args).path || "";
17332
17785
  label = `\u2714 \x1B[95mRead\x1B[0m: ${path27}`;
17333
17786
  } else if (normalizedToolName === "list_files" || normalizedToolName === "read_folder" || normalizedToolName === "readfolder") {
17334
- const path27 = parseArgs(toolCall.args).path || "";
17335
- label = `\u2714 \x1B[95mBrowsed\x1B[0m: ${path27}`;
17787
+ const path27 = parseArgs(toolCall.args).path || null;
17788
+ const recurse = parseArgs(toolCall.args).recurse || 0;
17789
+ label = `${path27 ? "\u2714" : "\u2718"} \x1B[95mBrowsed\x1B[0m: ${path27 ? `${path27}${recurse > 0 ? `${path27.endsWith("/") ? `*${recurse}` : `/*${recurse}`}` : `${path27.endsWith("/") ? "" : "/"}`}` : ""}`;
17336
17790
  } else if (normalizedToolName === "write_file" || normalizedToolName === "writefile") {
17337
- const path27 = parseArgs(toolCall.args).path || "";
17338
- label = `\u2714 \x1B[95mCreated\x1B[0m: ${path27}`;
17791
+ const path27 = parseArgs(toolCall.args).path || null;
17792
+ label = `${path27 ? "\u2714" : "\u2718"} \x1B[95mCreated\x1B[0m: ${path27 ? `${path27}` : "No File Changes"}`;
17339
17793
  } else if (normalizedToolName === "update_file" || normalizedToolName === "updatefile" || normalizedToolName === "patchfile" || normalizedToolName === "patch_file" || normalizedToolName === "patchfile" || normalizedToolName === "updatefile") {
17340
- const path27 = parseArgs(toolCall.args).path || "";
17341
- label = `\u2714 \x1B[95mEdited\x1B[0m: ${path27}`;
17794
+ const path27 = parseArgs(toolCall.args).path || null;
17795
+ const content = parseArgs(toolCall.args).content || null;
17796
+ label = `${path27 ? "\u2714" : "\u2718"} \x1B[95mEdited\x1B[0m: ${path27 ? `${path27}` : "No File Changes"}`;
17342
17797
  } else if (normalizedToolName === "file_map" || normalizedToolName === "filemap") {
17343
17798
  const path27 = parseArgs(toolCall.args).path || "";
17344
- label = `\u2714 \x1B[95mIndexed\x1B[0m: ${path27}`;
17799
+ label = `${path27 ? "\u2714" : "\u2718"} \x1B[95mIndexed\x1B[0m: ${path27 ? `${path27}` : "File Not Found"}`;
17345
17800
  } else if (normalizedToolName === "await") {
17346
17801
  const { time } = parseArgs(toolCall.args);
17347
17802
  let sec = parseFloat(time) || 0;
@@ -17499,9 +17954,10 @@ function ResumeModal({ onSelect, onDelete, onClose, theme = "Dark" }) {
17499
17954
  width: "100%"
17500
17955
  },
17501
17956
  /* @__PURE__ */ React10.createElement(Box9, { flexGrow: 1 }, /* @__PURE__ */ React10.createElement(Text10, { color: isSelected ? colors.text : colors.textMuted, bold: isSelected }, isSelected ? "\u276F " : " ", (() => {
17502
- if (chat2?.name && !chat2.name.startsWith("Session")) return chat2.name;
17503
- if (chat2?.prompt) return chat2.prompt;
17504
- return chat2?.name || id;
17957
+ const cleanTag = (str) => (str || "").replace(/\[\/?(?:STEERING HINT|QUESTION)(?::\s*\w+)?\]/gi, "").trim();
17958
+ if (chat2?.name && !chat2.name.startsWith("Session")) return cleanTag(chat2.name);
17959
+ if (chat2?.prompt) return cleanTag(chat2.prompt);
17960
+ return cleanTag(chat2?.name) || id;
17505
17961
  })(), /* @__PURE__ */ React10.createElement(Text10, { color: colors.textMuted }, " [", dateStr, " \u2022 ", id, "]"))),
17506
17962
  isSelected && /* @__PURE__ */ React10.createElement(Box9, { flexShrink: 0 }, /* @__PURE__ */ React10.createElement(Text10, { color: colors.danger, bold: true }, "[X] DELETE "))
17507
17963
  );
@@ -21699,16 +22155,16 @@ Selection: ${val}`,
21699
22155
  const barWidth = 15;
21700
22156
  const filledCount = Math.round(percent / 100 * barWidth);
21701
22157
  const barStr = "\u2588".repeat(filledCount) + "\u2591".repeat(Math.max(0, barWidth - filledCount));
21702
- let barColor = "gray";
22158
+ let barColor = colors.success || "green";
21703
22159
  if (percent >= 40 && percent <= 80) {
21704
- barColor = "yellow";
22160
+ barColor = colors.warning || "yellow";
21705
22161
  } else if (percent > 80) {
21706
- barColor = "red";
22162
+ barColor = colors.danger || "red";
21707
22163
  }
21708
22164
  const isTokens = label.toLowerCase().includes("token");
21709
22165
  const displayLimit = shouldClearValue(limit) ? "\u221E" : isTokens ? formatTokens(limit) : limit;
21710
22166
  const displayCurrent = isTokens ? formatTokens(current) : current;
21711
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row", paddingLeft: 4, key: label }, /* @__PURE__ */ React16.createElement(Box14, { width: 18 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, label, ": ")), /* @__PURE__ */ React16.createElement(Text16, { color: barColor }, barStr), /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, " ", percent, "% (", displayCurrent, "/", displayLimit, ")"));
22167
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "row", paddingLeft: 4, key: label }, /* @__PURE__ */ React16.createElement(Box14, { width: 18 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, label, ": ")), /* @__PURE__ */ React16.createElement(Text16, { color: barColor }, barStr), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, " ", percent, "% (", displayCurrent, "/", displayLimit, ")"));
21712
22168
  };
21713
22169
  const renderActiveView = () => {
21714
22170
  switch (activeView) {
@@ -21753,7 +22209,7 @@ Selection: ${val}`,
21753
22209
  title: "SELECT AI PROVIDER",
21754
22210
  items: [
21755
22211
  { label: "Google (Free/Paid)", value: "Google" },
21756
- { label: "Nvidia (Free/Paid)", value: "NVIDIA" },
22212
+ { label: "Nvidia (Free/Custom)", value: "NVIDIA" },
21757
22213
  { label: "DeepSeek (Paid)", value: "DeepSeek" },
21758
22214
  { label: "Mistral (Free/Paid) [EXPERIMENTAL]", value: "Mistral" },
21759
22215
  { label: "OpenRouter (Free/Paid) [EXPERIMENTAL]", value: "OpenRouter" },
@@ -21847,6 +22303,7 @@ Selection: ${val}`,
21847
22303
  { label: "Custom (Set reset day of month)", value: "Custom" },
21848
22304
  { label: "Back", value: "apiTier" }
21849
22305
  ],
22306
+ theme: systemSettings.theme,
21850
22307
  onSelect: (item) => {
21851
22308
  if (item.value === "apiTier" || item.value === "Back") {
21852
22309
  setActiveView("apiTier");
@@ -21882,6 +22339,7 @@ Selection: ${val}`,
21882
22339
  { label: `Provider Budgets (set limits per provider individually) ${quotas.providerBudgets?.["__useProvider"] ? "\u25CF" : ""}`, value: "provider" },
21883
22340
  { label: "Back", value: budgetReturnView }
21884
22341
  ],
22342
+ theme: systemSettings.theme,
21885
22343
  onSelect: (item) => {
21886
22344
  if (item.value === budgetReturnView || item.value === "Back") {
21887
22345
  setActiveView(budgetReturnView);
@@ -21940,11 +22398,11 @@ Selection: ${val}`,
21940
22398
  case "providerBudgetSelect": {
21941
22399
  const PROVIDERS_LIST = ["Google", "DeepSeek", "Mistral", "NVIDIA", "OpenRouter"];
21942
22400
  const anySelected = PROVIDERS_LIST.some((p) => pbsSelected[p]);
21943
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "white", padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray", bold: true }, "SELECT PROVIDERS TO SET BUDGETS FOR")), PROVIDERS_LIST.map((prov, i) => {
22401
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, "SELECT PROVIDERS TO SET BUDGETS FOR")), PROVIDERS_LIST.map((prov, i) => {
21944
22402
  const isActive = i === pbsCursor;
21945
22403
  const isChecked = !!pbsSelected[prov];
21946
- return /* @__PURE__ */ React16.createElement(Box14, { key: prov, backgroundColor: isActive ? "#2a2a2a" : void 0, paddingX: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: isActive ? "white" : "gray", bold: isActive }, isActive ? "\u276F " : " ", /* @__PURE__ */ React16.createElement(Text16, { color: isChecked ? "green" : "gray" }, isChecked ? "\u2611" : "\u2610"), " ", prov, isChecked && quotas.providerBudgets?.[prov]?.agentLimit ? /* @__PURE__ */ React16.createElement(Text16, { color: "cyan" }, " (budget set)") : null));
21947
- }), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray", italic: true }, "\u2191\u2193 Navigate \u2022 Space to toggle \u2022 Enter to confirm \u2022 ESC to go back"), !anySelected && /* @__PURE__ */ React16.createElement(Text16, { color: "yellow", italic: true }, " Select at least one provider to continue")));
22404
+ return /* @__PURE__ */ React16.createElement(Box14, { key: prov, backgroundColor: isActive ? colors.highlightBg || "#2a2a2a" : void 0, paddingX: 1, width: "100%", flexDirection: "row" }, /* @__PURE__ */ React16.createElement(Text16, { color: isActive ? colors.text : colors.textMuted, bold: isActive }, isActive ? "\u276F " : " "), /* @__PURE__ */ React16.createElement(Text16, { color: isChecked ? colors.success || "green" : colors.textMuted }, isChecked ? "\u2611" : "\u2610"), /* @__PURE__ */ React16.createElement(Text16, { color: isActive ? colors.text : colors.textMuted, bold: isActive }, " ", prov), isChecked && quotas.providerBudgets?.[prov]?.agentLimit ? /* @__PURE__ */ React16.createElement(Text16, { color: colors.primary || "cyan" }, " (budget set)") : null);
22405
+ }), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1, flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted, italic: true }, "\u2191\u2193 Navigate \u2022 Space to toggle \u2022 Enter to confirm \u2022 ESC to go back"), !anySelected && /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow", italic: true }, " Select at least one provider to continue")));
21948
22406
  }
21949
22407
  case "providerBudgetFlow":
21950
22408
  return null;
@@ -21958,6 +22416,7 @@ Selection: ${val}`,
21958
22416
  { label: "Custom (Set reset day of month)", value: "Custom" },
21959
22417
  { label: "Back", value: "chat" }
21960
22418
  ],
22419
+ theme: systemSettings.theme,
21961
22420
  onSelect: (item) => {
21962
22421
  if (item.value === "chat" || item.value === "Back") {
21963
22422
  setActiveView("chat");
@@ -22009,7 +22468,7 @@ Selection: ${val}`,
22009
22468
  const monthName = resetDate.toLocaleString("default", { month: "short" });
22010
22469
  resetInfo = `Resets on: ${resetDay}-${monthName}`;
22011
22470
  }
22012
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "white", padding: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 1, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, "BUDGET LIMIT STATUS"), /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, "[ ESC to Close ]")), limitsNotSet ? /* @__PURE__ */ React16.createElement(Box14, { padding: 1, justifyContent: "center", alignItems: "center", width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true }, "LIMITS NOT SET")) : usingProviderBudgets && configuredProviders.length > 0 ? /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", gap: 1, width: "100%" }, configuredProviders.map((prov) => {
22471
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, padding: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 1, justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, "BUDGET LIMIT STATUS"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "[ ESC to Close ]")), limitsNotSet ? /* @__PURE__ */ React16.createElement(Box14, { padding: 1, justifyContent: "center", alignItems: "center", width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, "LIMITS NOT SET")) : usingProviderBudgets && configuredProviders.length > 0 ? /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", gap: 1, width: "100%" }, configuredProviders.map((prov) => {
22013
22472
  const pb = providerBudgetsMap[prov];
22014
22473
  const provReqCurrent = dailyUsage?.providerRequests?.[prov] || 0;
22015
22474
  let provTokenCurrent = 0;
@@ -22023,11 +22482,11 @@ Selection: ${val}`,
22023
22482
  for (const m in monthlyModels) {
22024
22483
  provMonthlyCurrent += monthlyModels[m]?.tokens || 0;
22025
22484
  }
22026
- return /* @__PURE__ */ React16.createElement(Box14, { key: prov, flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 0 }, /* @__PURE__ */ React16.createElement(Text16, { color: "cyan", bold: true }, "\u25C6 ", prov)), renderProgressBar("Daily Requests", provReqCurrent, pb.agentLimit || 99999999, "cyan"), renderProgressBar("Daily Tokens", provTokenCurrent, pb.tokenLimit || 99999999999999, "green"), renderProgressBar("Monthly Tokens", provMonthlyCurrent, pb.monthlyTokenLimit || 99999999999999, "yellow"));
22027
- }), resetInfo ? /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: "magenta", bold: true }, resetInfo)) : /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: "blue", bold: true }, "Rolling 30-Day Window"))) : /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "single", borderColor: "gray", paddingX: 1, width: "100%" }, renderProgressBar("Daily Requests", reqCurrent, reqLimit, "cyan"), renderProgressBar("Daily Tokens", tokenCurrent, tokenLimit, "green"), renderProgressBar("Monthly Tokens", monthlyCurrent, monthlyLimit, "yellow"), resetInfo ? /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: "magenta", bold: true }, resetInfo)) : /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray" }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: "blue", bold: true }, "Rolling 30-Day Window"))));
22485
+ return /* @__PURE__ */ React16.createElement(Box14, { key: prov, flexDirection: "column", borderStyle: "single", borderColor: colors.borderMuted, paddingX: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 0 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.primary, bold: true }, "\u25C6 ", prov)), renderProgressBar("Daily Requests", provReqCurrent, pb.agentLimit || 99999999, "cyan"), renderProgressBar("Daily Tokens", provTokenCurrent, pb.tokenLimit || 99999999999999, "green"), renderProgressBar("Monthly Tokens", provMonthlyCurrent, pb.monthlyTokenLimit || 99999999999999, "yellow"));
22486
+ }), resetInfo ? /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.accent || "magenta", bold: true }, resetInfo)) : /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary || "blue", bold: true }, "Rolling 30-Day Window"))) : /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "single", borderColor: colors.borderMuted, paddingX: 1, width: "100%" }, renderProgressBar("Daily Requests", reqCurrent, reqLimit, "cyan"), renderProgressBar("Daily Tokens", tokenCurrent, tokenLimit, "green"), renderProgressBar("Monthly Tokens", monthlyCurrent, monthlyLimit, "yellow"), resetInfo ? /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.accent || "magenta", bold: true }, resetInfo)) : /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "Monthly Reset : "), /* @__PURE__ */ React16.createElement(Text16, { color: colors.secondary || "blue", bold: true }, "Rolling 30-Day Window"))));
22028
22487
  }
22029
22488
  case "input":
22030
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "white", padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true }, "DATA CONFIGURATION")), inputConfig?.note && /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray", italic: true }, inputConfig.note)), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, flexDirection: "row" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true }, inputConfig?.label, " "), /* @__PURE__ */ React16.createElement(
22489
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, "DATA CONFIGURATION")), inputConfig?.note && /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted, italic: true }, inputConfig.note)), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, flexDirection: "row" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true }, inputConfig?.label, " "), /* @__PURE__ */ React16.createElement(
22031
22490
  TextInput4,
22032
22491
  {
22033
22492
  value: inputConfig?.value || "",
@@ -22127,7 +22586,7 @@ Selection: ${val}`,
22127
22586
  }
22128
22587
  }
22129
22588
  }
22130
- )), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "gray", dimColor: true, italic: true }, "(Press Enter to confirm selection)")));
22589
+ )), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted, dimColor: true, italic: true }, "(Press Enter to confirm selection)")));
22131
22590
  case "stats": {
22132
22591
  const u = statsMode === "monthly" ? monthlyUsage : dailyUsage;
22133
22592
  const trackerTitle = statsMode === "monthly" ? "LAST 30 DAYS USAGE" : "TODAY's USAGE";
@@ -22137,16 +22596,17 @@ Selection: ${val}`,
22137
22596
  const imageCreditsLabel = statsMode === "monthly" ? "Image Credits:" : "Image Credits:";
22138
22597
  const codeChangesLabel = statsMode === "monthly" ? "Code Changes:" : "Code Changes:";
22139
22598
  const toolCallsLabel = statsMode === "monthly" ? "Tool Calls:" : "Tool Calls:";
22140
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "grey", paddingX: 3, paddingY: 1, paddingBottom: 0, width: Math.min(125, (stdout?.columns || 100) - 2) }, statsMode === "modelBreakdown" ? /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, "30-DAY MODEL TOKEN BREAKDOWN"), !monthlyUsage?.models || Object.keys(monthlyUsage.models).length === 0 ? /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey", italic: true }, "No model token usage recorded in the last 30 days.")) : Object.entries(monthlyUsage.models).map(([provider, models]) => {
22599
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 3, paddingY: 1, paddingBottom: 0, width: Math.min(125, (stdout?.columns || 100) - 2) }, statsMode === "modelBreakdown" ? /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, "30-DAY MODEL TOKEN BREAKDOWN"), !monthlyUsage?.models || Object.keys(monthlyUsage.models).length === 0 ? /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted, italic: true }, "No model token usage recorded in the last 30 days.")) : Object.entries(monthlyUsage.models).map(([provider, models]) => {
22141
22600
  const providerTotalTokens = Object.values(models).reduce((sum, m) => sum + (m.tokens || 0), 0);
22142
- 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: "cyan", bold: true }, provider, ":")), /* @__PURE__ */ React16.createElement(Text16, { color: "white", 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: "blue" }, "\xBB ", modelName, ":")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(stats.tokens || 0))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 32 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "grey" }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(stats.cachedTokens))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 32 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(stats.candidateTokens || 0))))));
22143
- })) : /* @__PURE__ */ React16.createElement(React16.Fragment, null, /* @__PURE__ */ React16.createElement(Box14, { marginBottom: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", 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: "blue" }, "Session Duration:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatMsDuration(Date.now() - SESSION_START_TIME))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Model Requests:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, sessionAgentCalls)), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB API Time:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatMsDuration(sessionApiTime))), /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Tool Time:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatMsDuration(sessionToolTime))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Memory Agent:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, sessionBackgroundCalls)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Tokens Consumed:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(sessionTotalTokens))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Active Context:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "grey" }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(sessionTotalTokens - sessionTotalCandidateTokens))), sessionTotalCachedTokens > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 4 }, /* @__PURE__ */ React16.createElement(Box14, { width: 21 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(sessionTotalCachedTokens))), sessionTotalCandidateTokens > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "blue" }, "Images Made:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, sessionImageCount)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Image Credits:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, Number(((sessionImageCredits || 0) * 1e3).toFixed(0)), " credits"))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Code Changes (Sess):")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, /* @__PURE__ */ React16.createElement(Text16, { color: "green" }, "+", runtimeSession.linesAdded), " ", /* @__PURE__ */ React16.createElement(Text16, { color: "red" }, "-", runtimeSession.linesRemoved))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Tool Calls (Sess):")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, runtimeSession.toolSuccess + runtimeSession.toolFailure + runtimeSession.toolDenied, " ( "), /* @__PURE__ */ React16.createElement(Text16, { color: "green" }, "\u2714 ", runtimeSession.toolSuccess), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: "yellow" }, "\u{1F6C7} ", runtimeSession.toolDenied), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: "red" }, "\u2718 ", runtimeSession.toolFailure), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " )"))), /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, trackerTitle), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, timeLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatDuration(u?.duration || 0))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Model Requests:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, u?.agent || 0)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, "Memory Agent:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, u?.background || 0)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, tokensLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "grey" }, "\xBB Input Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "grey" }, "\xBB Cached:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, formatTokens(u.cachedTokens))), (u?.candidateTokens || 0) > 0 && /* @__PURE__ */ React16.createElement(Box14, { marginLeft: 2 }, /* @__PURE__ */ React16.createElement(Box14, { width: 23 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "\xBB Output Tokens:")), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "blue" }, imagesLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, u.imageCalls.length)), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, imageCreditsLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, 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: "blue" }, codeChangesLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, /* @__PURE__ */ React16.createElement(Text16, { color: "green" }, "+", u?.linesAdded || 0), " ", /* @__PURE__ */ React16.createElement(Text16, { color: "red" }, "-", u?.linesRemoved || 0))), /* @__PURE__ */ React16.createElement(Box14, null, /* @__PURE__ */ React16.createElement(Box14, { width: 25 }, /* @__PURE__ */ React16.createElement(Text16, { color: "blue" }, toolCallsLabel)), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, (u?.toolSuccess || 0) + (u?.toolFailure || 0) + (u?.toolDenied || 0), " ( "), /* @__PURE__ */ React16.createElement(Text16, { color: "green" }, "\u2714 ", u?.toolSuccess || 0), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: "yellow" }, "\u{1F6C7} ", u?.toolDenied || 0), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " "), /* @__PURE__ */ React16.createElement(Text16, { color: "red" }, "\u2718 ", u?.toolFailure || 0), /* @__PURE__ */ React16.createElement(Text16, { color: "white" }, " )")))), /* @__PURE__ */ React16.createElement(Text16, { dimColor: true, marginTop: 1, italic: true }, "(Press TAB to toggle Daily/Monthly views, SPACE for Model Breakdown, ESC to return)"));
22601
+ 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))))));
22602
+ })) : /* @__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)"));
22144
22603
  }
22145
22604
  case "autoExecDanger":
22146
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "grey", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, "SECURITY WARNING: YOLO MODE"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "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: "white" }, "RISKS INVOLVED:"), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 The agent may execute destructive commands (rm -rf, etc.) by mistake unless specified in sandbox rules."), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 Unintended system changes if the agent hallucinates a path or command."), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 Reduced control over the agent's step-by-step decision making."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22605
+ 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(
22147
22606
  CommandMenu,
22148
22607
  {
22149
22608
  title: "Confirm Intent",
22609
+ theme: systemSettings.theme,
22150
22610
  items: [
22151
22611
  { label: "I know the risk and turning on intentionally", value: "on" },
22152
22612
  { label: "Keep Off (Recommended)", value: "off" }
@@ -22160,10 +22620,11 @@ Selection: ${val}`,
22160
22620
  }
22161
22621
  )));
22162
22622
  case "advanceRollbackDanger":
22163
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "grey", paddingX: 2, paddingY: 1, paddingTop: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true }, "\u26A0 Emergency Rollback Notice"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "When enabled, full repo snapshots exist only during active AI turns."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "If catastrophic changes occur during a turn, avoid abruptly stopping the agent unless absolutely necessary (external damages out of codebase)."), /* @__PURE__ */ React16.createElement(Text16, null, "The agent may be able to automatically restore the repo to a safe state."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "Once the turn ends, emergency snapshots are deleted and standard /revert takes over which may not retain full repo content."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "(Requires Restart to take effect)"), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22623
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 2, paddingY: 1, paddingTop: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.warning || "yellow", bold: true }, "\u26A0 Emergency Rollback Notice"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "When enabled, full repo snapshots exist only during active AI turns."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "If catastrophic changes occur during a turn, avoid abruptly stopping the agent unless absolutely necessary (external damages out of codebase)."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "The agent may be able to automatically restore the repo to a safe state."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.textMuted }, "Once the turn ends, emergency snapshots are deleted and standard /revert takes over which may not retain full repo content."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.textMuted }, "(Requires Restart to take effect)"), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22164
22624
  CommandMenu,
22165
22625
  {
22166
22626
  title: "Confirm",
22627
+ theme: systemSettings.theme,
22167
22628
  items: [
22168
22629
  { label: "I understand and wish to enable", value: "on" },
22169
22630
  { label: "Keep Off", value: "off" }
@@ -22177,10 +22638,11 @@ Selection: ${val}`,
22177
22638
  }
22178
22639
  )));
22179
22640
  case "externalDanger":
22180
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "grey", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, "SECURITY WARNING: EXTERNAL WORKSPACE ACCESS"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "Turning this ON allows the agent to execute tools (Read/Write/Exec) outside of the current active workspace directory."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: "white" }, "RISKS INVOLVED:"), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 Access to sensitive system files (SSH keys, Browser data, etc.)"), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 Potential for accidental or malicious deletion of OS-critical files."), /* @__PURE__ */ React16.createElement(Text16, null, "\u2022 Unauthorized script execution across your entire file system."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22641
+ 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: EXTERNAL WORKSPACE ACCESS"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "Turning this ON allows the agent to execute tools (Read/Write/Exec) outside of the current active workspace directory."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text, bold: true }, "RISKS INVOLVED:"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Access to sensitive system files (SSH keys, Browser data, etc.)"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Potential for accidental or malicious deletion of OS-critical files."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "\u2022 Unauthorized script execution across your entire file system."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22181
22642
  CommandMenu,
22182
22643
  {
22183
22644
  title: "Confirm Intent",
22645
+ theme: systemSettings.theme,
22184
22646
  items: [
22185
22647
  { label: "I know the risk and turning on intentionally", value: "on" },
22186
22648
  { label: "Keep Off (Recommended)", value: "off" }
@@ -22194,10 +22656,11 @@ Selection: ${val}`,
22194
22656
  }
22195
22657
  )));
22196
22658
  case "doubleDanger":
22197
- return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "white", paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, "CRITICAL SECURITY WARNING: COMBINED SYSTEM RISK"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1 }, "You are attempting to enable BOTH [YOLO Mode] and [External Workspace Access] simultaneously."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: "red", bold: true }, "THIS IS NOT RECOMMENDED."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: "white" }, "THE CRITICAL RISK:"), /* @__PURE__ */ React16.createElement(Text16, null, "The agent will have the power to execute any command across your entire system WITHOUT your approval or supervision."), /* @__PURE__ */ React16.createElement(Text16, { color: "red", italic: true, marginTop: 1 }, "A single hallucination or error could result in full system wipe or data theft."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22659
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, paddingX: 2, paddingY: 1, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red", bold: true, underline: true }, "CRITICAL SECURITY WARNING: COMBINED SYSTEM RISK"), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text }, "You are attempting to enable BOTH [YOLO Mode] and [External Workspace Access] simultaneously."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.danger || "red", bold: true }, "THIS IS NOT RECOMMENDED."), /* @__PURE__ */ React16.createElement(Text16, { marginTop: 1, color: colors.text, bold: true }, "THE CRITICAL RISK:"), /* @__PURE__ */ React16.createElement(Text16, { color: colors.textMuted }, "The agent will have the power to execute any command across your entire system WITHOUT your approval or supervision."), /* @__PURE__ */ React16.createElement(Text16, { color: colors.danger || "red", italic: true, marginTop: 1 }, "A single hallucination or error could result in full system wipe or data theft."), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22198
22660
  CommandMenu,
22199
22661
  {
22200
22662
  title: "Final Confirmation",
22663
+ theme: systemSettings.theme,
22201
22664
  items: [
22202
22665
  { label: "I agree knowing the consequences", value: "on" },
22203
22666
  { label: "Keep Off", value: "off" }
@@ -22425,7 +22888,7 @@ Selection: ${val}`,
22425
22888
  initialData: profileData,
22426
22889
  onSave: (profile) => {
22427
22890
  setProfileData(profile);
22428
- setMessages((prev) => [...prev, { id: Date.now(), role: "system", text: `Profile updated: ${profile.name} (${profile.nickname})` }]);
22891
+ setMessages((prev) => [...prev, { id: Date.now(), role: "system", text: `${profile.name.length > 0 || profile.nickname.length > 0 ? `Profile Updated: ${profile.name.length > 0 ? `${profile.name} ` : ""}${profile.nickname.length > 0 ? `(${profile.nickname})` : ""}` : "Profile: Nothing to Update"}`, isMeta: true }]);
22429
22892
  setActiveView("chat");
22430
22893
  },
22431
22894
  onCancel: () => setActiveView("chat"),
@@ -22437,6 +22900,7 @@ Selection: ${val}`,
22437
22900
  ResolutionModal,
22438
22901
  {
22439
22902
  data: resolutionData,
22903
+ theme: systemSettings.theme,
22440
22904
  onResolve: (val) => {
22441
22905
  setResolutionData(null);
22442
22906
  setActiveView("chat");
@@ -22486,7 +22950,7 @@ Selection: ${val}`,
22486
22950
  }
22487
22951
  const newVal = args2.content || args2.ReplacementContent || args2.content_to_add || args2.replacementContent || args2.newContent || null;
22488
22952
  return /* @__PURE__ */ React16.createElement(Text16, { color: "white", wrap: "anywhere" }, (newVal ? newVal.replace(/\[\/n\]?/g, "\\n") : null) || "Updating file content...");
22489
- })()) : /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "cyan", italic: true }, "\u26A1\uFE0F FluxFlow Companion is active. Review the changes in your editor.")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22953
+ })()) : /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1, paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "cyan", italic: true }, "FluxFlow Companion is active. Review the changes in your editor.")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1 }, /* @__PURE__ */ React16.createElement(
22490
22954
  CommandMenu,
22491
22955
  {
22492
22956
  title: "Action Required",
@@ -22700,7 +23164,7 @@ Selection: ${val}`,
22700
23164
  {
22701
23165
  items: [
22702
23166
  { label: "Google (Free/Paid)", value: "Google" },
22703
- { label: "Nvidia (Free/Paid)", value: "NVIDIA" },
23167
+ { label: "Nvidia (Free/Custom)", value: "NVIDIA" },
22704
23168
  { label: "DeepSeek (Paid)", value: "DeepSeek" },
22705
23169
  { label: "Mistral (Free/Paid) [EXPERIMENTAL]", value: "Mistral" },
22706
23170
  { label: "OpenRouter (Free/Paid) [EXPERIMENTAL]", value: "OpenRouter" }
@@ -22962,20 +23426,25 @@ var init_app = __esm({
22962
23426
  packageJson = JSON.parse(fs28.readFileSync(packageJsonPath, "utf8"));
22963
23427
  versionFluxflow = packageJson.version;
22964
23428
  updatedOn = packageJson.date || "2026-05-20";
22965
- ResolutionModal = ({ data, onResolve, onEdit }) => /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: "grey", padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "white", bold: true, underline: true }, data.startsWith("/btw") ? "QUESTION" : "STEERING HINT", " RESOLUTION")), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, null, "The agent already finished the task before your ", data.startsWith("/btw") ? "question" : "hint", " was consumed.")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1, backgroundColor: "#222", paddingX: 2, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { italic: true, color: "gray" }, '"', data.replace("/btw", "").trim(), '"')), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: "grey" }, "How would you like to proceed?")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 0 }, /* @__PURE__ */ React16.createElement(
22966
- CommandMenu,
22967
- {
22968
- title: "Select Action",
22969
- items: [
22970
- { label: "Send Anyway", value: "send" },
22971
- { label: "Edit Prompt", value: "edit" }
22972
- ],
22973
- onSelect: (val) => {
22974
- if (val === "send") onResolve(data);
22975
- else onEdit(data);
23429
+ ResolutionModal = ({ data, onResolve, onEdit, theme = "Dark" }) => {
23430
+ const colors = getThemeColors(theme);
23431
+ return /* @__PURE__ */ React16.createElement(Box14, { flexDirection: "column", borderStyle: "round", borderColor: colors.borderMuted, padding: 0, width: "100%" }, /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text, bold: true, underline: true }, data.startsWith("/btw") ? "QUESTION" : "STEERING HINT", " RESOLUTION")), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.text }, "The agent already finished the task before your ", data.startsWith("/btw") ? "question" : "hint", " was consumed.")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 1, backgroundColor: colors.cardBg || colors.codeBg || "#222", paddingX: 2, width: "100%" }, /* @__PURE__ */ React16.createElement(Text16, { italic: true, color: colors.textMuted }, '"', data.replace("/btw", "").trim(), '"')), /* @__PURE__ */ React16.createElement(Box14, { paddingX: 1, marginTop: 1 }, /* @__PURE__ */ React16.createElement(Text16, { color: colors.textDim || colors.textMuted }, "How would you like to proceed?")), /* @__PURE__ */ React16.createElement(Box14, { marginTop: 0 }, /* @__PURE__ */ React16.createElement(
23432
+ CommandMenu,
23433
+ {
23434
+ title: "Select Action",
23435
+ items: [
23436
+ { label: "Send Anyway", value: "send" },
23437
+ { label: "Edit Prompt", value: "edit" }
23438
+ ],
23439
+ onSelect: (item) => {
23440
+ const val = typeof item === "object" && item !== null ? item.value : item;
23441
+ if (val === "send") onResolve(data);
23442
+ else onEdit(data);
23443
+ },
23444
+ theme
22976
23445
  }
22977
- }
22978
- )));
23446
+ )));
23447
+ };
22979
23448
  getProjectFiles = /* @__PURE__ */ (() => {
22980
23449
  let cachedFiles = null;
22981
23450
  let lastScanTime = 0;