fluxflow-cli 3.16.4 → 3.16.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/fluxflow.js +340 -336
  2. package/package.json +3 -2
package/dist/fluxflow.js CHANGED
@@ -6811,9 +6811,16 @@ var init_main_tools = __esm({
6811
6811
  Tool calls: ONLY use [tool:functions.ToolName(args)]
6812
6812
  **NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
6813
6813
 
6814
- **CRITICAL TOOL USAGE RULES:**
6814
+ **TOOL CALLS POLICY:**
6815
6815
  - MAX 4 TOOL CALLS/TURN${mode === "Flux" ? " (Todo: 4+, Run: max 1 or 2 consecutive)" : ""}
6816
- ${mode === "Flux" ? '- **Escape quotes: \\" for code strings **\n- ** Literal escapes: Double - escape sequences(e.g., \\\\n) **\n- ** File structure: Real newlines for code formatting**\n- SAME file, MULTIPLE edits? Use ONE PatchFile call with up to 15 blocks \u2190 **PRIORITY**\n- Tool denied? Use `Ask` immediately for user guidance \u2190 **MANDATORY**\n- Need specific text ? SearchKeyword > Guessing/ReadFile\n- Huge files ? SearchKeyword > Full Read\n- **Update Todos from realtime progress every turn when created**\n' : ""}
6816
+ ${mode === "Flux" ? `- Escape quotes: \\" for code strings
6817
+ - Double-escape literal sequences (eg. \\\\n)
6818
+ - Use real newlines for code formatting
6819
+ - SAME file, MULTIPLE edits? ONE PatchFile (\u226415 blocks) \u2190 PRIORITY
6820
+ - Tool denied? Ask for guidance \u2190 MANDATORY
6821
+ - Need text or huge files? SearchKeyword > Full Read
6822
+ - Update Todos from realtime progress each turn
6823
+ ` : ""}
6817
6824
  - COMMUNICATION WITH USER -
6818
6825
  - [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
6819
6826
 
@@ -6823,23 +6830,22 @@ ${mode === "Flux" ? '- **Escape quotes: \\" for code strings **\n- ** Literal es
6823
6830
 
6824
6831
  ${mode === "Flux" ? `- WORKSPACE TOOLS (path = relative; FIRST ARGUMENT, path separator: '/') -
6825
6832
  - [tool:functions.ReadFile(path="...", startLine="integer", endLine="integer")]. ${aiProvider !== "Google" ? `${isMultiModal ? `Supports images/docs` : ""}` : `Supports images/docs`}
6826
- - [tool:functions.ReadFolder(path="...", recurse="integer 1-3 optional, default: 1")]. DIR Contents + File Size. Minimize recursion
6827
- - [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX 15)]. Surgical patchs, TARGET SMALLEST LINES. allowMultiple: Replace all matches ONLY WHEN SURE. Use replaceContent2/newContent2... for multi blocks. Verify DIFFs
6833
+ - [tool:functions.ReadFolder(path="...", recurse="integer 1-3 optional, default: 1")]. DIR Contents + File Size. Last resort. Minimize recursion
6834
+ - [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX15)]. TARGET MINIMAL DIFF. allowMultiple: Replace all matches ONLY WHEN SURE. Multi-blocks: replaceContent2/newContent2... Verify diffs
6828
6835
  - [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile
6829
- - [tool:functions.SearchKeyword(keyword="...", path="optional, dir/file/glob/regex", fuzzy="bool optional, default: false", regex="bool optional, default: auto")]. path limits search scope. Find definitions/logic without full reads. Locate relevant code
6830
- - [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL` : `WINDOWS CMD` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user
6836
+ - [tool:functions.SearchKeyword(keyword="...", path="optional, dir/file/glob/regex", fuzzy="bool optional, default: false", regex="bool optional, default: auto")]. path scopes search. Find definitions, logic, relevant code
6837
+ - [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `POWERSHELL` : `WINDOWS CMD` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user
6831
6838
  - [tool:functions.Todo(method="create/append/get", tasks=[ARRAY OF STRINGS], markDone=[ARRAY OF TASKS])]. Task list, no Markdown in arrays. Analyze request: ONLY if long multi-task, break it down & create Todos BEFORE starting. \`tasks\` & \`markDone\` optional with \`get\`. Use \`get + markDone\` to complete tasks. **UPDATE EVERY TURN WHEN CREATED**${enableSubAgents ? '\n- [tool:functions.Await(time="integer 15-180")]. For waiting without exiting agent loop' : ""}
6832
6839
  ${_cachedAdvanceRollback ? `
6833
6840
  - EMERGENCY SAFETY TOOLS -
6834
- 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
6835
- - [tool:functions.EmergencyRollback(method="getCheckpoint/forceRevert", id="...")]. Rollback workspace to a checkpoint in THIS agent loop.
6836
- Use ONLY for catastrophic/codebase corruption. Before ending loop, verify no catastrophe. \`id\` not required with \`getCheckPoint\`.
6841
+ Info: \`initial\` = current task prompt. Revert \`id\` = turn before disaster (eg. disaster: \`turn_3\` \u2192 revert: \`turn_2\`). Reason explicitly
6842
+ - [tool:functions.EmergencyRollback(method="getCheckpoint/forceRevert", id="...")]. Rollback workspace in THIS agent loop. ONLY for catastrophic corruption. Before ending, verify no catastrophe. \`id\` omitted for \`getCheckpoint\`
6837
6843
  ` : ""}${enableSubAgents ? `
6838
6844
  - SUB AGENT TOOLS -
6839
6845
  **PROACTIVE sub-agent use HIGHLY RECOMMENDED. Prefer for any task with even slight benefit, no user nudge needed**
6840
6846
  Invocations:
6841
- - Invoke (async/background, \u22647 parallel). Parallelize long tasks. NEVER repeat while active, meantime, do your OWN work
6842
- - InvokeSync (sync/blocking). Sequential, repetitive or delegated tasks. Saves tokens/cost
6847
+ \u2022 Invoke (async/background, \u22647 parallel). Parallelize long tasks. NEVER repeat while active, meantime, do your OWN work
6848
+ \u2022 InvokeSync (sync/blocking). Sequential, repetitive or delegated tasks. Saves tokens/cost
6843
6849
  - [agent:generalist.InvokeSync/Invoke(title="...", task="...")]. Task must be detailed: exact file paths, imports/exports, dependencies & folder structure
6844
6850
  - [agent:generalist.GetProgress(id="...")]. Poll \`getProgress\` sparingly (exp backoff Await); **NO IMMEDIATE FIRST POLL**
6845
6851
  - [agent:generalist.Cancel(id="...")]. Cancel async task ONLY if stalled (2m+) or clearly incorrect` : ""}`.trim() : `- CREATIVE TOOLS (path = relative to CWD & WILL BE FIRST ARGUMENT, path separator: '/') -
@@ -8425,11 +8431,11 @@ var thinking_prompts_default;
8425
8431
  var init_thinking_prompts = __esm({
8426
8432
  "src/data/thinking_prompts.json"() {
8427
8433
  thinking_prompts_default = {
8428
- 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",
8429
- 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",
8430
- 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",
8431
- 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",
8432
- Off: "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify imports & system stability, avoid syntax errors, recheck tool results"
8434
+ xHigh: "EFFORT: HIGH\nChallenge assumptions, verify before concluding, prefer the simplest correct solution, assess architecture, scalability & trade-offs, verify dependencies, regressions, failure modes & modular design, plan: files, modules, interfaces & tests\nRULES:\nContinuous analysis, verify from first principles, seek failure paths, verify imports, tool results & system stability; avoid syntax errors\nMANDATORY: Full technical verification",
8435
+ High: "EFFORT: HIGH\nRigorous thinking, prefer the simplest correct solution, assess architecture, performance & maintainability, verify error handling, assumptions, edge cases, dependencies & regressions, plan: files, functions, logic & interactions\nRULES:\nContinuous analysis, verify from first principles, seek failure paths, verify imports, tool results & system stability; avoid syntax errors\nMANDATORY: Full technical verification",
8436
+ Medium: "EFFORT: MEDIUM\nFocused, technical thinking, find the simplest solution meeting requirements, check error handling, assumptions, edge cases & dependencies, verify cohesive, modular changes, outline: files, functions & key logic\nRULES:\nLogical, implementation-focused, efficient, deliberate, verify imports, tool results & system stability; avoid syntax errors\nMANDATORY: Brief verification for technical tasks/greetings",
8437
+ Minimal: "EFFORT: LOW\nQuick, focused thinking, intent & complexity, required tools/files/actions, before acting\nRULES:\nBrief thoughts, think only enough to avoid mistakes, verify imports, tool results & system stability; avoid syntax errors",
8438
+ Off: "EFFORT: LOWEST\nNo thinking. Immediate response\nRULES:\nverify imports, tool results & system stability; avoid syntax errors"
8433
8439
  };
8434
8440
  }
8435
8441
  });
@@ -8505,11 +8511,11 @@ ${tempMemories}` : "";
8505
8511
  "Max": "HIGH"
8506
8512
  };
8507
8513
  thinkingConfig = thinking_prompts_default["xHigh"];
8508
- thinkingConfig = thinkingConfig.replace("EFFORT LEVEL: HIGH", `EFFORT LEVEL: ${MAP_FOR_NON_GOOGLE_OR_GEMINI[thinkingLevel]}`).replace("\n- MANDATORY THINKING: Full technical verification", "");
8514
+ thinkingConfig = thinkingConfig.replace("EFFORT: HIGH", `EFFORT: ${MAP_FOR_NON_GOOGLE_OR_GEMINI[thinkingLevel]}`).replace("\nMANDATORY: Full technical verification", "");
8509
8515
  if (thinkingLevel === "Fast") {
8510
- thinkingConfig = "EFFORT LEVEL: LOWEST\nNo thinking. Immediate response\nRULES:\n- Verify imports & system stability, avoid syntax errors, recheck tool results";
8516
+ thinkingConfig = "EFFORT: LOWEST\nNo thinking. Immediate response\nRULES:\nVerify imports, tool results & system stability; avoid syntax errors";
8511
8517
  } else if (thinkingLevel === "Low") {
8512
- thinkingConfig = "EFFORT LEVEL: LOW\nConfirm intent & complexity\nIdentify required tools/files/actions\nVerify before acting\nRULES:\n- Brief thoughts\n- Think only enough to avoid obvious mistakes\n- Verify imports & system stability, avoid syntax errors, recheck tool results";
8518
+ thinkingConfig = "EFFORT: LOW\nQuick, focused thinking, intent & complexity, required tools/files/actions, before acting\nRULES:\nBrief thoughts, think only enough to avoid mistakes, verify imports, tool results & system stability; avoid syntax errors";
8513
8519
  }
8514
8520
  }
8515
8521
  const osDetected = process.platform === "win32" ? "Windows" : process.platform === "darwin" ? "macOS" : "Linux";
@@ -8557,7 +8563,10 @@ Check these first; These Files > Training Data. Safety rules apply
8557
8563
  const projectContextBlock = cachedProjectContextBlock;
8558
8564
  return `=== SYSTEM PROMPT ===
8559
8565
  Identity: Flux Flow. Sassy, CLI Agent
8560
- ${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`}
8566
+ ${mode === "Flux" ? "Logical, task-driven. Prioritize scalable, modular architecture, clean abstractions, stepwise execution. Use latest practices/libraries, verify imports, run automated tests" : `Mode: ${mode}. Concise, Conversational, Sassy, Friendly, Humorous, Sarcastic`}
8567
+
8568
+ - RESOLVE FILES AND PATHS FROM THE PROVIDED DIRECTORY STRUCTURE
8569
+ - USE RELATIVE TIME REFERENCE eg. few mins ago
8561
8570
 
8562
8571
  -- THINKING GUIDANCE --
8563
8572
  ${aiProvider === "Mistral" || aiProvider === "Google" && !isGemini ? `${thinkingConfig}
@@ -8565,9 +8574,6 @@ ${forcedReasoning || thinkingLevel !== "Fast" && (aiProvider === "Mistral" || th
8565
8574
  - Use <think> ... </think> for reasoning before responding, even with simple queries/greetings
8566
8575
  ` : ""}` : `${thinkingConfig}
8567
8576
  `}
8568
- - **USE PROVIDED DIRECTORY STRUCTURE FOR FILES/PATHS**
8569
- - RELATIVE TIME REFERENCE eg. few mins ago
8570
-
8571
8577
  ${TOOL_PROTOCOL(mode, osDetected, aiProvider.toLowerCase() === "deepseek" ? false : isMultiModal, aiProvider, systemSettings?.advanceRollback, systemSettings?.subAgents !== false)}
8572
8578
  ${projectContextBlock}${isMemoryEnabled ? `
8573
8579
  -- MEMORY RULES --
@@ -8579,7 +8585,7 @@ ${projectContextBlock}${isMemoryEnabled ? `
8579
8585
  -- CHAT FORMATTING --
8580
8586
  - GFM Markdown ONLY
8581
8587
  - Same Language as User Query
8582
- - Before tool calls, emit one brief current update. After tool calls, emit no further text this turn
8588
+ - Before tool calls, briefly state intent. After, emit no chat
8583
8589
  - On completion: summarize changes (why) + edited files${mode === "Flux" ? "" : "\n- Use Kaomojis HEAVILY"}
8584
8590
  === END SYSTEM PROMPT ===
8585
8591
 
@@ -10234,9 +10240,8 @@ ${finalResults}`;
10234
10240
 
10235
10241
  // src/tools/web_scrape.js
10236
10242
  import puppeteer2 from "puppeteer";
10237
- import fs13 from "fs";
10238
- import path12 from "path";
10239
10243
  import TurndownService from "turndown";
10244
+ import { gfm } from "turndown-plugin-gfm";
10240
10245
  var web_scrape;
10241
10246
  var init_web_scrape = __esm({
10242
10247
  "src/tools/web_scrape.js"() {
@@ -10278,7 +10283,7 @@ var init_web_scrape = __esm({
10278
10283
  await page.goto(url, { waitUntil: "networkidle2", timeout: 18e4 });
10279
10284
  await new Promise((r) => setTimeout(r, 5e3));
10280
10285
  let htmlContent = await page.evaluate(() => {
10281
- const junk = document.querySelectorAll("script, style, nav, footer, header, noscript, svg, canvas, iframe, ad, .ads, link, meta, img");
10286
+ const junk = document.querySelectorAll("script, style, noscript, svg, canvas, iframe, ad, .ads, link, meta, img");
10282
10287
  junk.forEach((el) => el.remove());
10283
10288
  const iterator = document.createNodeIterator(document.body, NodeFilter.SHOW_COMMENT);
10284
10289
  let currentNode;
@@ -10324,6 +10329,7 @@ var init_web_scrape = __esm({
10324
10329
  headingStyle: "atx",
10325
10330
  codeBlockStyle: "fenced"
10326
10331
  });
10332
+ turndownService.use(gfm);
10327
10333
  const rawMarkdown = turndownService.turndown(cleanedHtml).replace(/\.\s*\n/g, "\n").replace(/ +/g, " ").replace(/\t/g, " ").replace(/\n\s+/g, "\n").replace(/\n{3,}/g, "\n\n");
10328
10334
  const markdown = rawMarkdown.substring(0, 5e4);
10329
10335
  await browser.close();
@@ -10333,7 +10339,6 @@ ${markdown}${rawMarkdown.length > 5e4 ? "\n\n[TRUNCATED AT 50K CHARS]" : ""}`;
10333
10339
  } catch (err) {
10334
10340
  lastError = err;
10335
10341
  if (browser) await browser.close();
10336
- fs13.writeFileSync(path12.join(LOGS_DIR, "web_tools", "scrape", "standard_mode", "ERROR.txt"), err.message);
10337
10342
  if (attempt < maxRetries) {
10338
10343
  const backoff = Math.pow(2, attempt) * 1e3;
10339
10344
  await new Promise((r) => setTimeout(r, backoff));
@@ -10457,8 +10462,8 @@ var init_chat = __esm({
10457
10462
  });
10458
10463
 
10459
10464
  // src/tools/view_file.js
10460
- import fs14 from "fs";
10461
- import path13 from "path";
10465
+ import fs13 from "fs";
10466
+ import path12 from "path";
10462
10467
  var view_file;
10463
10468
  var init_view_file = __esm({
10464
10469
  "src/tools/view_file.js"() {
@@ -10472,16 +10477,16 @@ var init_view_file = __esm({
10472
10477
  let finalStart = sLine || 1;
10473
10478
  let finalEnd = eLine || (sLine ? sLine + 800 : 800);
10474
10479
  if (!targetPath) return 'ERROR: Missing "path" argument for view_file.';
10475
- const absolutePath = path13.resolve(process.cwd(), targetPath);
10480
+ const absolutePath = path12.resolve(process.cwd(), targetPath);
10476
10481
  try {
10477
- if (!fs14.existsSync(absolutePath)) {
10482
+ if (!fs13.existsSync(absolutePath)) {
10478
10483
  return `ERROR: File [${targetPath}] does not exist.`;
10479
10484
  }
10480
- const stats = fs14.statSync(absolutePath);
10485
+ const stats = fs13.statSync(absolutePath);
10481
10486
  if (stats.isDirectory()) {
10482
10487
  return `ERROR: Path [${targetPath}] is a directory. Use list_files instead.`;
10483
10488
  }
10484
- const ext = path13.extname(targetPath).toLowerCase();
10489
+ const ext = path12.extname(targetPath).toLowerCase();
10485
10490
  const videoExtensions = [".mp4", ".mkv", ".avi", ".mov", ".webm", ".flv", ".wmv", ".mpeg", ".mpg"];
10486
10491
  if (videoExtensions.includes(ext)) {
10487
10492
  const format = ext.slice(1).toUpperCase();
@@ -10501,7 +10506,7 @@ var init_view_file = __esm({
10501
10506
  if (!isMultiModal) {
10502
10507
  return `ERROR: Multimodality is not supported for the current model. Unable to load [${targetPath}].`;
10503
10508
  }
10504
- const buffer = fs14.readFileSync(absolutePath);
10509
+ const buffer = fs13.readFileSync(absolutePath);
10505
10510
  const base64 = buffer.toString("base64");
10506
10511
  const mimeType = mimeMap[ext];
10507
10512
  return {
@@ -10514,7 +10519,7 @@ var init_view_file = __esm({
10514
10519
  }
10515
10520
  };
10516
10521
  }
10517
- let content = fs14.readFileSync(absolutePath, "utf8");
10522
+ let content = fs13.readFileSync(absolutePath, "utf8");
10518
10523
  if (content.startsWith("\uFEFF")) {
10519
10524
  content = content.slice(1);
10520
10525
  }
@@ -10542,8 +10547,8 @@ ${code}`;
10542
10547
  });
10543
10548
 
10544
10549
  // src/tools/write_file.js
10545
- import fs15 from "fs";
10546
- import path14 from "path";
10550
+ import fs14 from "fs";
10551
+ import path13 from "path";
10547
10552
  var write_file;
10548
10553
  var init_write_file = __esm({
10549
10554
  "src/tools/write_file.js"() {
@@ -10554,14 +10559,14 @@ var init_write_file = __esm({
10554
10559
  if (!targetPath) return 'ERROR: Missing "path" argument for write_file.';
10555
10560
  if (content === void 0) return 'ERROR: Missing "content" argument for write_file.';
10556
10561
  content = content.replace(/^```[\w]*\n?/, "").replace(/```\s*$/, "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
10557
- const absolutePath = path14.resolve(process.cwd(), targetPath);
10558
- const parentDir = path14.dirname(absolutePath);
10562
+ const absolutePath = path13.resolve(process.cwd(), targetPath);
10563
+ const parentDir = path13.dirname(absolutePath);
10559
10564
  try {
10560
10565
  await RevertManager.recordFileChange(absolutePath);
10561
10566
  let ancestry = "";
10562
- if (fs15.existsSync(absolutePath)) {
10567
+ if (fs14.existsSync(absolutePath)) {
10563
10568
  try {
10564
- const oldData = fs15.readFileSync(absolutePath, "utf8");
10569
+ const oldData = fs14.readFileSync(absolutePath, "utf8");
10565
10570
  const lines = oldData.split(/\r?\n/);
10566
10571
  ancestry = `Old File contents:
10567
10572
  ${lines.map((l, i) => `${i + 1} | ${l}`).join("\n")}
@@ -10573,16 +10578,16 @@ ${lines.map((l, i) => `${i + 1} | ${l}`).join("\n")}
10573
10578
  `;
10574
10579
  }
10575
10580
  }
10576
- if (!fs15.existsSync(parentDir)) {
10577
- fs15.mkdirSync(parentDir, { recursive: true });
10581
+ if (!fs14.existsSync(parentDir)) {
10582
+ fs14.mkdirSync(parentDir, { recursive: true });
10578
10583
  }
10579
10584
  const strip = (t) => t.replace(/^```[\w]*\n?/, "").replace(/```\s*$/, "").replace(/\r\n/g, "\n").replace(/\r/g, "\n");
10580
10585
  const processedContent = strip(content);
10581
10586
  const finalContent = processedContent.endsWith("\n") ? processedContent : processedContent + "\n";
10582
10587
  const lineCount = finalContent.split(/\r?\n/).length;
10583
10588
  const originalSize = Buffer.byteLength(finalContent, "utf8");
10584
- fs15.writeFileSync(absolutePath, finalContent, "utf8");
10585
- let verifiedContent = fs15.readFileSync(absolutePath, "utf8");
10589
+ fs14.writeFileSync(absolutePath, finalContent, "utf8");
10590
+ let verifiedContent = fs14.readFileSync(absolutePath, "utf8");
10586
10591
  const verifiedSize = Buffer.byteLength(verifiedContent, "utf8");
10587
10592
  const verifiedLines = verifiedContent.split(/\r?\n/);
10588
10593
  const verifiedLineCount = verifiedLines.length;
@@ -10617,8 +10622,8 @@ ${snippet}`;
10617
10622
  });
10618
10623
 
10619
10624
  // src/tools/update_file.js
10620
- import fs16 from "fs";
10621
- import path15 from "path";
10625
+ import fs15 from "fs";
10626
+ import path14 from "path";
10622
10627
  var update_file;
10623
10628
  var init_update_file = __esm({
10624
10629
  "src/tools/update_file.js"() {
@@ -10635,12 +10640,12 @@ var init_update_file = __esm({
10635
10640
  return "ERROR: No valid replacement pairs found. Use replaceContent1, newContent1, etc.";
10636
10641
  }
10637
10642
  const allowMultiple = parsed.allowMultiple !== void 0 ? parsed.allowMultiple === true || String(parsed.allowMultiple).toLowerCase() === "true" : parsedAllowMultiple;
10638
- const absolutePath = path15.resolve(process.cwd(), targetPath);
10643
+ const absolutePath = path14.resolve(process.cwd(), targetPath);
10639
10644
  try {
10640
- if (!fs16.existsSync(absolutePath)) {
10645
+ if (!fs15.existsSync(absolutePath)) {
10641
10646
  return `ERROR: File [${targetPath}] does not exist. Use WriteFile instead.`;
10642
10647
  }
10643
- let diskContent = context.forcedContent || fs16.readFileSync(absolutePath, "utf8");
10648
+ let diskContent = context.forcedContent || fs15.readFileSync(absolutePath, "utf8");
10644
10649
  if (diskContent.startsWith("\uFEFF")) diskContent = diskContent.slice(1);
10645
10650
  const originalContent = diskContent.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
10646
10651
  const { content: finalContent, results } = applyPatches(originalContent, patchPairs, { allowMultiple });
@@ -10651,7 +10656,7 @@ var init_update_file = __esm({
10651
10656
  ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
10652
10657
  }
10653
10658
  await RevertManager.recordFileChange(absolutePath, originalContent);
10654
- fs16.writeFileSync(absolutePath, finalContent, "utf8");
10659
+ fs15.writeFileSync(absolutePath, finalContent, "utf8");
10655
10660
  const diffText = generateHighFidelityDiff(originalContent, finalContent, results, 12);
10656
10661
  if (failures.length > 0) {
10657
10662
  return `SUCCESS: File [${targetPath}] updated with some blocks failed. [${successes.length}/${patchPairs.length}] blocks applied.
@@ -10673,8 +10678,8 @@ ${diffText}`;
10673
10678
  });
10674
10679
 
10675
10680
  // src/tools/read_folder.js
10676
- import fs17 from "fs";
10677
- import path16 from "path";
10681
+ import fs16 from "fs";
10682
+ import path15 from "path";
10678
10683
  var EXCLUDED_DIRS, isExcludedDir, formatMtime, read_folder;
10679
10684
  var init_read_folder = __esm({
10680
10685
  "src/tools/read_folder.js"() {
@@ -10851,26 +10856,26 @@ var init_read_folder = __esm({
10851
10856
  }
10852
10857
  }
10853
10858
  recurseDepth = Math.max(1, Math.min(3, recurseDepth));
10854
- const absolutePath = path16.resolve(process.cwd(), targetPath);
10859
+ const absolutePath = path15.resolve(process.cwd(), targetPath);
10855
10860
  try {
10856
- if (!fs17.existsSync(absolutePath)) {
10861
+ if (!fs16.existsSync(absolutePath)) {
10857
10862
  return `ERROR: Path [${targetPath}] does not exist.`;
10858
10863
  }
10859
- const stats = fs17.statSync(absolutePath);
10864
+ const stats = fs16.statSync(absolutePath);
10860
10865
  if (!stats.isDirectory()) {
10861
10866
  return `ERROR: Path [${targetPath}] is a file, not a directory. Use ReadFile instead.`;
10862
10867
  }
10863
10868
  if (recurseDepth === 1) {
10864
- const files = fs17.readdirSync(absolutePath);
10869
+ const files = fs16.readdirSync(absolutePath);
10865
10870
  const totalItems = files.length;
10866
10871
  const maxDisplay = 150;
10867
10872
  const displayItems = files.slice(0, maxDisplay);
10868
10873
  const folderData = [];
10869
10874
  for (const file of displayItems) {
10870
- const fPath = path16.join(absolutePath, file);
10875
+ const fPath = path15.join(absolutePath, file);
10871
10876
  let info = { name: file, type: "unknown", size: "N/A", mtime: "N/A" };
10872
10877
  try {
10873
- const fStats = fs17.statSync(fPath);
10878
+ const fStats = fs16.statSync(fPath);
10874
10879
  info = {
10875
10880
  name: file,
10876
10881
  type: fStats.isDirectory() ? "directory" : "file",
@@ -10912,7 +10917,7 @@ ${formatted}${footer2}`;
10912
10917
  if (currentDepth > recurseDepth || truncated) return [];
10913
10918
  let entries = [];
10914
10919
  try {
10915
- entries = fs17.readdirSync(dirPath);
10920
+ entries = fs16.readdirSync(dirPath);
10916
10921
  } catch (e) {
10917
10922
  const indent2 = " ".repeat(depth - 1);
10918
10923
  return [`${indent2}[Inaccessible Directory]`];
@@ -10920,10 +10925,10 @@ ${formatted}${footer2}`;
10920
10925
  const subDirs = [];
10921
10926
  const fileEntries = [];
10922
10927
  for (const name of entries) {
10923
- const fullPath = path16.join(dirPath, name);
10928
+ const fullPath = path15.join(dirPath, name);
10924
10929
  let isDir = false;
10925
10930
  try {
10926
- isDir = fs17.statSync(fullPath).isDirectory();
10931
+ isDir = fs16.statSync(fullPath).isDirectory();
10927
10932
  } catch (e) {
10928
10933
  }
10929
10934
  if (isDir) {
@@ -10961,7 +10966,7 @@ ${formatted}${footer2}`;
10961
10966
  totalFiles++;
10962
10967
  let sizeStr = "N/A";
10963
10968
  try {
10964
- const fStats = fs17.statSync(file.fullPath);
10969
+ const fStats = fs16.statSync(file.fullPath);
10965
10970
  sizeStr = (fStats.size / 1024).toFixed(1) + "KB";
10966
10971
  } catch (e) {
10967
10972
  }
@@ -11036,8 +11041,8 @@ var init_ask_user = __esm({
11036
11041
 
11037
11042
  // src/tools/write_pdf.js
11038
11043
  import puppeteer3 from "puppeteer";
11039
- import path17 from "path";
11040
- import fs18 from "fs-extra";
11044
+ import path16 from "path";
11045
+ import fs17 from "fs-extra";
11041
11046
  import { PDFDocument } from "pdf-lib";
11042
11047
  var write_pdf;
11043
11048
  var init_write_pdf = __esm({
@@ -11054,10 +11059,10 @@ var init_write_pdf = __esm({
11054
11059
  } = parseArgs(args);
11055
11060
  if (!targetPath) return 'ERROR: Missing "path" argument for write_pdf.';
11056
11061
  if (!content) return 'ERROR: Missing "content" (HTML/CSS) for write_pdf.';
11057
- const absolutePath = path17.resolve(process.cwd(), targetPath);
11062
+ const absolutePath = path16.resolve(process.cwd(), targetPath);
11058
11063
  let browser = null;
11059
11064
  try {
11060
- await fs18.ensureDir(path17.dirname(absolutePath));
11065
+ await fs17.ensureDir(path16.dirname(absolutePath));
11061
11066
  await RevertManager.recordFileChange(absolutePath);
11062
11067
  const pptrConfig = getPuppeteerConfig();
11063
11068
  browser = await puppeteer3.launch({
@@ -11078,11 +11083,11 @@ var init_write_pdf = __esm({
11078
11083
  return null;
11079
11084
  }
11080
11085
  try {
11081
- const imgPath = path17.resolve(process.cwd(), originalSrc);
11082
- if (await fs18.pathExists(imgPath)) {
11083
- const ext = path17.extname(imgPath).toLowerCase().replace(".", "") || "png";
11086
+ const imgPath = path16.resolve(process.cwd(), originalSrc);
11087
+ if (await fs17.pathExists(imgPath)) {
11088
+ const ext = path16.extname(imgPath).toLowerCase().replace(".", "") || "png";
11084
11089
  const mime = ext === "jpg" ? "jpeg" : ext === "svg" ? "svg+xml" : ext;
11085
- const base64 = await fs18.readFile(imgPath, "base64");
11090
+ const base64 = await fs17.readFile(imgPath, "base64");
11086
11091
  return `data:image/${mime};base64,${base64}`;
11087
11092
  }
11088
11093
  } catch (e) {
@@ -11097,9 +11102,9 @@ var init_write_pdf = __esm({
11097
11102
  const fullTag = match[0];
11098
11103
  if (originalHref && fullTag.toLowerCase().includes("stylesheet") && !originalHref.startsWith("http://") && !originalHref.startsWith("https://") && !originalHref.startsWith("data:")) {
11099
11104
  try {
11100
- const cssPath = path17.resolve(process.cwd(), originalHref);
11101
- if (await fs18.pathExists(cssPath)) {
11102
- const cssContent = await fs18.readFile(cssPath, "utf-8");
11105
+ const cssPath = path16.resolve(process.cwd(), originalHref);
11106
+ if (await fs17.pathExists(cssPath)) {
11107
+ const cssContent = await fs17.readFile(cssPath, "utf-8");
11103
11108
  cssCache[fullTag] = `<style>${cssContent}</style>`;
11104
11109
  }
11105
11110
  } catch (e) {
@@ -11180,7 +11185,7 @@ var init_write_pdf = __esm({
11180
11185
  printBackground: true
11181
11186
  });
11182
11187
  const pdfDoc = await PDFDocument.load(pdfBytes);
11183
- const fileName = path17.basename(targetPath);
11188
+ const fileName = path16.basename(targetPath);
11184
11189
  pdfDoc.setTitle(`FluxFlow_${fileName}`);
11185
11190
  pdfDoc.setAuthor("FluxFlow CLI");
11186
11191
  pdfDoc.setSubject("Generated with Agentic AI System");
@@ -11188,8 +11193,8 @@ var init_write_pdf = __esm({
11188
11193
  pdfDoc.setCreator("FluxFlow PDF Engine");
11189
11194
  pdfDoc.setProducer("FluxFlow (Generative AI)");
11190
11195
  const finalPdfBytes = await pdfDoc.save();
11191
- await fs18.writeFile(absolutePath, finalPdfBytes);
11192
- const stats = await fs18.stat(absolutePath);
11196
+ await fs17.writeFile(absolutePath, finalPdfBytes);
11197
+ const stats = await fs17.stat(absolutePath);
11193
11198
  return `SUCCESS: PDF generated successfully at [${targetPath}] (${(stats.size / 1024).toFixed(2)} KB).`;
11194
11199
  } catch (err) {
11195
11200
  const errorMsg = err instanceof Error ? err.message : String(err);
@@ -11202,8 +11207,8 @@ var init_write_pdf = __esm({
11202
11207
  });
11203
11208
 
11204
11209
  // src/tools/write_docx.js
11205
- import fs19 from "fs-extra";
11206
- import path18 from "path";
11210
+ import fs18 from "fs-extra";
11211
+ import path17 from "path";
11207
11212
  import HTMLtoDOCX from "html-to-docx";
11208
11213
  var write_docx;
11209
11214
  var init_write_docx = __esm({
@@ -11217,11 +11222,11 @@ var init_write_docx = __esm({
11217
11222
  } = parseArgs(args);
11218
11223
  if (!targetPath) return 'ERROR: Missing "path" argument for write_docx.';
11219
11224
  if (!content) return 'ERROR: Missing "content" (HTML) for write_docx.';
11220
- const absolutePath = path18.resolve(process.cwd(), targetPath);
11225
+ const absolutePath = path17.resolve(process.cwd(), targetPath);
11221
11226
  try {
11222
- await fs19.ensureDir(path18.dirname(absolutePath));
11227
+ await fs18.ensureDir(path17.dirname(absolutePath));
11223
11228
  await RevertManager.recordFileChange(absolutePath);
11224
- const fileName = path18.basename(targetPath);
11229
+ const fileName = path17.basename(targetPath);
11225
11230
  const fullHtml = content.includes("<html") ? content : `
11226
11231
  <!DOCTYPE html>
11227
11232
  <html lang="en">
@@ -11242,7 +11247,7 @@ var init_write_docx = __esm({
11242
11247
  footer: true,
11243
11248
  pageNumber: true
11244
11249
  });
11245
- await fs19.writeFile(absolutePath, docxBuffer);
11250
+ await fs18.writeFile(absolutePath, docxBuffer);
11246
11251
  return `SUCCESS: Word document [${targetPath}] generated successfully.
11247
11252
  - Size: ${(docxBuffer.length / 1024).toFixed(1)} KB`;
11248
11253
  } catch (err) {
@@ -11254,22 +11259,22 @@ var init_write_docx = __esm({
11254
11259
  });
11255
11260
 
11256
11261
  // src/tools/search_keyword.js
11257
- import fs20 from "fs/promises";
11258
- import path19 from "path";
11262
+ import fs19 from "fs/promises";
11263
+ import path18 from "path";
11259
11264
  import fg from "fast-glob";
11260
11265
  async function getFilesRecursively(dir, excludes, baseDir = dir, depth = 1) {
11261
11266
  if (depth > 12) return [];
11262
11267
  let results = [];
11263
11268
  let list;
11264
11269
  try {
11265
- list = await fs20.readdir(dir, { withFileTypes: true });
11270
+ list = await fs19.readdir(dir, { withFileTypes: true });
11266
11271
  } catch {
11267
11272
  return [];
11268
11273
  }
11269
11274
  for (const file of list) {
11270
- const fullPath = path19.join(dir, file.name);
11271
- const relativePath = path19.relative(baseDir, fullPath);
11272
- const pathSegments = relativePath.split(path19.sep).map((s) => s.toLowerCase());
11275
+ const fullPath = path18.join(dir, file.name);
11276
+ const relativePath = path18.relative(baseDir, fullPath);
11277
+ const pathSegments = relativePath.split(path18.sep).map((s) => s.toLowerCase());
11273
11278
  const fileNameLower = file.name.toLowerCase();
11274
11279
  const isExcluded = excludes.some((ex) => {
11275
11280
  const exLower = ex.toLowerCase();
@@ -11562,7 +11567,7 @@ var init_search_keyword = __esm({
11562
11567
  }
11563
11568
  if (matchedPaths.length === 0 && (hasRegexSyntax || fg.isDynamicPattern(posixPath))) {
11564
11569
  const baseDirMatch = posixPath.match(/^([^\*\?\(\)\|\[\]\s]+)\//);
11565
- const scanDir = baseDirMatch && !/[\*\?\(\)\|\[\]]/.test(baseDirMatch[1]) ? path19.resolve(rootDir, baseDirMatch[1]) : rootDir;
11570
+ const scanDir = baseDirMatch && !/[\*\?\(\)\|\[\]]/.test(baseDirMatch[1]) ? path18.resolve(rootDir, baseDirMatch[1]) : rootDir;
11566
11571
  const allFiles = await getFilesRecursively(scanDir, excludes, rootDir);
11567
11572
  try {
11568
11573
  let cleanRegexStr = posixPath.replace(/^\.\//, "");
@@ -11580,21 +11585,21 @@ var init_search_keyword = __esm({
11580
11585
  }
11581
11586
  } else {
11582
11587
  filesToSearch = matchedPaths.map((relP) => ({
11583
- fullPath: path19.resolve(rootDir, relP),
11588
+ fullPath: path18.resolve(rootDir, relP),
11584
11589
  relativePath: relP
11585
11590
  }));
11586
11591
  }
11587
11592
  } else {
11588
11593
  const normalised = pathArg.replace(/[\/\\]+$/, "");
11589
- const fullPath = path19.resolve(rootDir, normalised);
11594
+ const fullPath = path18.resolve(rootDir, normalised);
11590
11595
  try {
11591
- const stat = await fs20.stat(fullPath);
11596
+ const stat = await fs19.stat(fullPath);
11592
11597
  if (stat.isDirectory()) {
11593
11598
  pathArgType = "dir";
11594
11599
  filesToSearch = await getFilesRecursively(fullPath, excludes, rootDir);
11595
11600
  } else if (stat.isFile()) {
11596
11601
  pathArgType = "file";
11597
- filesToSearch.push({ fullPath, relativePath: path19.relative(rootDir, fullPath) });
11602
+ filesToSearch.push({ fullPath, relativePath: path18.relative(rootDir, fullPath) });
11598
11603
  } else {
11599
11604
  return `ERROR: Path is neither a file nor a directory: ${pathArg}`;
11600
11605
  }
@@ -11607,7 +11612,7 @@ var init_search_keyword = __esm({
11607
11612
  }
11608
11613
  const searchPromises = filesToSearch.map(async (fileObj) => {
11609
11614
  try {
11610
- const content = await fs20.readFile(fileObj.fullPath, "utf-8");
11615
+ const content = await fs19.readFile(fileObj.fullPath, "utf-8");
11611
11616
  if (content.includes("\0")) return [];
11612
11617
  const lines = content.split(/\r?\n/);
11613
11618
  const fileMatches = [];
@@ -11677,8 +11682,8 @@ var init_search_keyword = __esm({
11677
11682
  });
11678
11683
 
11679
11684
  // src/tools/generate_image.js
11680
- import fs21 from "fs-extra";
11681
- import path20 from "path";
11685
+ import fs20 from "fs-extra";
11686
+ import path19 from "path";
11682
11687
  var injectPngMetadata, generate_image;
11683
11688
  var init_generate_image = __esm({
11684
11689
  "src/tools/generate_image.js"() {
@@ -11857,12 +11862,12 @@ var init_generate_image = __esm({
11857
11862
  "Seed": String(seed)
11858
11863
  };
11859
11864
  finalBuffer = injectPngMetadata(finalBuffer, metadata);
11860
- const absolutePath = path20.resolve(process.cwd(), outputPath);
11861
- await fs21.ensureDir(path20.dirname(absolutePath));
11865
+ const absolutePath = path19.resolve(process.cwd(), outputPath);
11866
+ await fs20.ensureDir(path19.dirname(absolutePath));
11862
11867
  await RevertManager.recordFileChange(absolutePath);
11863
- await fs21.writeFile(absolutePath, finalBuffer);
11868
+ await fs20.writeFile(absolutePath, finalBuffer);
11864
11869
  await recordImageGeneration(settings);
11865
- const ext = path20.extname(outputPath).toLowerCase();
11870
+ const ext = path19.extname(outputPath).toLowerCase();
11866
11871
  const mimeMap = {
11867
11872
  ".jpg": "image/jpeg",
11868
11873
  ".jpeg": "image/jpeg",
@@ -11977,13 +11982,13 @@ var init_addMemScore = __esm({
11977
11982
  });
11978
11983
 
11979
11984
  // src/utils/parsers.js
11980
- import fs22 from "fs-extra";
11981
- import path21 from "path";
11985
+ import fs21 from "fs-extra";
11986
+ import path20 from "path";
11982
11987
  import https from "https";
11983
11988
  async function downloadWasm(wasmFile, targetUrl = null) {
11984
11989
  const url = targetUrl || `https://unpkg.com/tree-sitter-wasms@0.1.13/out/${wasmFile}`;
11985
- const localPath = path21.join(PARSER_DIR, wasmFile);
11986
- await fs22.ensureDir(PARSER_DIR);
11990
+ const localPath = path20.join(PARSER_DIR, wasmFile);
11991
+ await fs21.ensureDir(PARSER_DIR);
11987
11992
  return new Promise((resolve, reject) => {
11988
11993
  const options = {
11989
11994
  headers: {
@@ -12004,27 +12009,27 @@ async function downloadWasm(wasmFile, targetUrl = null) {
12004
12009
  reject(new Error(`Failed to download ${wasmFile}: HTTP ${response.statusCode}`));
12005
12010
  return;
12006
12011
  }
12007
- const file = fs22.createWriteStream(localPath);
12012
+ const file = fs21.createWriteStream(localPath);
12008
12013
  response.pipe(file);
12009
12014
  file.on("finish", () => {
12010
12015
  file.close();
12011
12016
  resolve();
12012
12017
  });
12013
12018
  }).on("error", (err) => {
12014
- if (fs22.existsSync(localPath)) fs22.unlink(localPath, () => {
12019
+ if (fs21.existsSync(localPath)) fs21.unlink(localPath, () => {
12015
12020
  });
12016
12021
  reject(err);
12017
12022
  });
12018
12023
  });
12019
12024
  }
12020
12025
  function isParserInstalled(wasmFile) {
12021
- const localPath = path21.join(PARSER_DIR, wasmFile);
12022
- return fs22.existsSync(localPath);
12026
+ const localPath = path20.join(PARSER_DIR, wasmFile);
12027
+ return fs21.existsSync(localPath);
12023
12028
  }
12024
12029
  async function deleteParser(wasmFile) {
12025
- const localPath = path21.join(PARSER_DIR, wasmFile);
12026
- if (fs22.existsSync(localPath)) {
12027
- await fs22.unlink(localPath);
12030
+ const localPath = path20.join(PARSER_DIR, wasmFile);
12031
+ if (fs21.existsSync(localPath)) {
12032
+ await fs21.unlink(localPath);
12028
12033
  }
12029
12034
  }
12030
12035
  var EXTENSION_TO_WASM;
@@ -12046,8 +12051,8 @@ var init_parsers = __esm({
12046
12051
  });
12047
12052
 
12048
12053
  // src/tools/file_map.js
12049
- import fs23 from "fs-extra";
12050
- import path22 from "path";
12054
+ import fs22 from "fs-extra";
12055
+ import path21 from "path";
12051
12056
  import { createRequire as createRequire2 } from "module";
12052
12057
  function sanitize(text, limit = 50) {
12053
12058
  if (!text) return "";
@@ -12239,17 +12244,17 @@ var init_file_map = __esm({
12239
12244
  if (!filePath) {
12240
12245
  return 'ERROR: No file path provided. Use [tool:functions.FileMap(path="...")]';
12241
12246
  }
12242
- const absolutePath = path22.isAbsolute(filePath) ? filePath : path22.resolve(process.cwd(), filePath);
12243
- if (!fs23.existsSync(absolutePath)) {
12247
+ const absolutePath = path21.isAbsolute(filePath) ? filePath : path21.resolve(process.cwd(), filePath);
12248
+ if (!fs22.existsSync(absolutePath)) {
12244
12249
  return `ERROR: File not found: ${filePath}`;
12245
12250
  }
12246
- const ext = path22.extname(absolutePath).slice(1).toLowerCase();
12251
+ const ext = path21.extname(absolutePath).slice(1).toLowerCase();
12247
12252
  const wasmFile = EXTENSION_TO_WASM[ext];
12248
12253
  if (!wasmFile) {
12249
12254
  return `ERROR: Unsupported file extension: .${ext}`;
12250
12255
  }
12251
- const wasmPath = path22.resolve(PARSER_DIR, wasmFile);
12252
- if (!fs23.existsSync(wasmPath)) {
12256
+ const wasmPath = path21.resolve(PARSER_DIR, wasmFile);
12257
+ if (!fs22.existsSync(wasmPath)) {
12253
12258
  return `ERROR: Parser for .${ext} not found. Please download it in Settings > Other.`;
12254
12259
  }
12255
12260
  try {
@@ -12257,9 +12262,9 @@ var init_file_map = __esm({
12257
12262
  if (!isParserInitialized) {
12258
12263
  let tsWasmPath;
12259
12264
  try {
12260
- tsWasmPath = path22.join(path22.dirname(require3.resolve("web-tree-sitter")), "tree-sitter.wasm");
12265
+ tsWasmPath = path21.join(path21.dirname(require3.resolve("web-tree-sitter")), "tree-sitter.wasm");
12261
12266
  } catch (e) {
12262
- tsWasmPath = path22.join(process.cwd(), "node_modules", "web-tree-sitter", "tree-sitter.wasm");
12267
+ tsWasmPath = path21.join(process.cwd(), "node_modules", "web-tree-sitter", "tree-sitter.wasm");
12263
12268
  }
12264
12269
  await Parser.init({
12265
12270
  locateFile: (p) => {
@@ -12274,7 +12279,7 @@ var init_file_map = __esm({
12274
12279
  const parser = new Parser();
12275
12280
  const Lang = await TreeSitter.Language.load(wasmPath);
12276
12281
  parser.setLanguage(Lang);
12277
- const sourceCode = await fs23.readFile(absolutePath, "utf8");
12282
+ const sourceCode = await fs22.readFile(absolutePath, "utf8");
12278
12283
  const lines = sourceCode.split("\n").length;
12279
12284
  let maxDepth = 12;
12280
12285
  if (lines > 1e4) maxDepth = 2;
@@ -12297,8 +12302,8 @@ Stack: ${err.stack}` : "";
12297
12302
  });
12298
12303
 
12299
12304
  // src/tools/todo.js
12300
- import fs24 from "fs";
12301
- import path23 from "path";
12305
+ import fs23 from "fs";
12306
+ import path22 from "path";
12302
12307
  var todo;
12303
12308
  var init_todo = __esm({
12304
12309
  "src/tools/todo.js"() {
@@ -12309,8 +12314,8 @@ var init_todo = __esm({
12309
12314
  const { method, tasks, markDone } = parseArgs(args);
12310
12315
  const chatId = context.chatId || "default";
12311
12316
  if (!method) return 'ERROR: Missing "method" argument for todo tool (create/append/get).';
12312
- const todoDir = path23.join(DATA_DIR, "plan", chatId);
12313
- const todoFile = path23.join(todoDir, "todo.md");
12317
+ const todoDir = path22.join(DATA_DIR, "plan", chatId);
12318
+ const todoFile = path22.join(todoDir, "todo.md");
12314
12319
  const parseMessyArray = (input) => {
12315
12320
  if (!input || Array.isArray(input)) return input;
12316
12321
  const trimmed = String(input).trim();
@@ -12370,8 +12375,8 @@ var init_todo = __esm({
12370
12375
  };
12371
12376
  };
12372
12377
  try {
12373
- if (!fs24.existsSync(todoDir)) {
12374
- fs24.mkdirSync(todoDir, { recursive: true });
12378
+ if (!fs23.existsSync(todoDir)) {
12379
+ fs23.mkdirSync(todoDir, { recursive: true });
12375
12380
  }
12376
12381
  if (method === "create") {
12377
12382
  if (!tasks) return 'ERROR: Missing "tasks" for create method.';
@@ -12383,7 +12388,7 @@ var init_todo = __esm({
12383
12388
  markedCount = result.markedCount;
12384
12389
  }
12385
12390
  await RevertManager.recordFileChange(todoFile);
12386
- fs24.writeFileSync(todoFile, content, "utf8");
12391
+ fs23.writeFileSync(todoFile, content, "utf8");
12387
12392
  const total = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.startsWith("- [ ]") || l.startsWith("- [x]") || l.startsWith("- [X]")).length;
12388
12393
  if (markedCount > 0) {
12389
12394
  const completed = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.startsWith("- [x]") || l.startsWith("- [X]")).length;
@@ -12397,8 +12402,8 @@ ${content}`;
12397
12402
  if (!tasks) return 'ERROR: Missing "tasks" for append method.';
12398
12403
  const appendContent = getTasksString(tasks);
12399
12404
  await RevertManager.recordFileChange(todoFile);
12400
- fs24.appendFileSync(todoFile, appendContent, "utf8");
12401
- const fullContent = fs24.readFileSync(todoFile, "utf8");
12405
+ fs23.appendFileSync(todoFile, appendContent, "utf8");
12406
+ const fullContent = fs23.readFileSync(todoFile, "utf8");
12402
12407
  const lines = fullContent.split(/\r?\n/).map((l) => l.trim());
12403
12408
  const total = lines.filter((l) => l.startsWith("- [ ]") || l.startsWith("- [x]") || l.startsWith("- [X]")).length;
12404
12409
  const completed = lines.filter((l) => l.startsWith("- [x]") || l.startsWith("- [X]")).length;
@@ -12407,10 +12412,10 @@ ${content}`;
12407
12412
  ${fullContent}`;
12408
12413
  }
12409
12414
  if (method === "get") {
12410
- if (!fs24.existsSync(todoFile)) {
12415
+ if (!fs23.existsSync(todoFile)) {
12411
12416
  return "TODO GET: No task list found for this session.";
12412
12417
  }
12413
- let content = fs24.readFileSync(todoFile, "utf8");
12418
+ let content = fs23.readFileSync(todoFile, "utf8");
12414
12419
  let markedCount = 0;
12415
12420
  if (markDone) {
12416
12421
  const result = applyMarkDone(content, markDone);
@@ -12418,7 +12423,7 @@ ${fullContent}`;
12418
12423
  content = result.content;
12419
12424
  markedCount = result.markedCount;
12420
12425
  await RevertManager.recordFileChange(todoFile);
12421
- fs24.writeFileSync(todoFile, content, "utf8");
12426
+ fs23.writeFileSync(todoFile, content, "utf8");
12422
12427
  }
12423
12428
  }
12424
12429
  const totalLines = content.split(/\r?\n/).map((l) => l.trim());
@@ -12814,20 +12819,20 @@ var init_await = __esm({
12814
12819
  });
12815
12820
 
12816
12821
  // src/utils/advanceRevert.js
12817
- import fs25 from "fs-extra";
12818
- import path24 from "path";
12822
+ import fs24 from "fs-extra";
12823
+ import path23 from "path";
12819
12824
  async function scanWorkspace(dir, baseDir = dir) {
12820
12825
  const manifest = {};
12821
- const entries = await fs25.readdir(dir, { withFileTypes: true }).catch(() => []);
12826
+ const entries = await fs24.readdir(dir, { withFileTypes: true }).catch(() => []);
12822
12827
  for (const entry of entries) {
12823
12828
  if (JUNK_DIRECTORIES.includes(entry.name)) continue;
12824
- const fullPath = path24.join(dir, entry.name);
12825
- const relPath = path24.relative(baseDir, fullPath).replace(/\\/g, "/");
12829
+ const fullPath = path23.join(dir, entry.name);
12830
+ const relPath = path23.relative(baseDir, fullPath).replace(/\\/g, "/");
12826
12831
  if (entry.isDirectory()) {
12827
12832
  const sub = await scanWorkspace(fullPath, baseDir);
12828
12833
  Object.assign(manifest, sub);
12829
12834
  } else {
12830
- const stats = await fs25.stat(fullPath).catch(() => null);
12835
+ const stats = await fs24.stat(fullPath).catch(() => null);
12831
12836
  if (stats) {
12832
12837
  manifest[relPath] = {
12833
12838
  size: stats.size,
@@ -12839,34 +12844,34 @@ async function scanWorkspace(dir, baseDir = dir) {
12839
12844
  return manifest;
12840
12845
  }
12841
12846
  async function copyWorkspaceFiles(destDir, manifest) {
12842
- await fs25.ensureDir(destDir);
12847
+ await fs24.ensureDir(destDir);
12843
12848
  for (const relPath of Object.keys(manifest)) {
12844
- const srcPath = path24.join(process.cwd(), relPath);
12845
- const destPath = path24.join(destDir, relPath);
12846
- await fs25.ensureDir(path24.dirname(destPath));
12847
- await fs25.copyFile(srcPath, destPath).catch(() => {
12849
+ const srcPath = path23.join(process.cwd(), relPath);
12850
+ const destPath = path23.join(destDir, relPath);
12851
+ await fs24.ensureDir(path23.dirname(destPath));
12852
+ await fs24.copyFile(srcPath, destPath).catch(() => {
12848
12853
  });
12849
12854
  }
12850
12855
  }
12851
12856
  async function restoreSnapshotDir(srcDir, destDir, stats = null, baseDir = null) {
12852
- if (!await fs25.pathExists(srcDir)) return;
12857
+ if (!await fs24.pathExists(srcDir)) return;
12853
12858
  if (!baseDir) baseDir = srcDir;
12854
- const entries = await fs25.readdir(srcDir, { withFileTypes: true }).catch(() => []);
12859
+ const entries = await fs24.readdir(srcDir, { withFileTypes: true }).catch(() => []);
12855
12860
  for (const entry of entries) {
12856
- const srcPath = path24.join(srcDir, entry.name);
12857
- const destPath = path24.join(destDir, entry.name);
12861
+ const srcPath = path23.join(srcDir, entry.name);
12862
+ const destPath = path23.join(destDir, entry.name);
12858
12863
  if (entry.isDirectory()) {
12859
12864
  await restoreSnapshotDir(srcPath, destPath, stats, baseDir);
12860
12865
  } else {
12861
- const relPath = path24.relative(baseDir, srcPath).replace(/\\/g, "/");
12862
- const existed = await fs25.pathExists(destPath);
12866
+ const relPath = path23.relative(baseDir, srcPath).replace(/\\/g, "/");
12867
+ const existed = await fs24.pathExists(destPath);
12863
12868
  if (existed) {
12864
- await fs25.chmod(destPath, 438).catch(() => {
12869
+ await fs24.chmod(destPath, 438).catch(() => {
12865
12870
  });
12866
12871
  }
12867
- await fs25.ensureDir(path24.dirname(destPath));
12868
- const ok = await fs25.copyFile(srcPath, destPath).then(() => true).catch(() => false);
12869
- await fs25.chmod(destPath, 438).catch(() => {
12872
+ await fs24.ensureDir(path23.dirname(destPath));
12873
+ const ok = await fs24.copyFile(srcPath, destPath).then(() => true).catch(() => false);
12874
+ await fs24.chmod(destPath, 438).catch(() => {
12870
12875
  });
12871
12876
  if (stats) {
12872
12877
  if (!ok) {
@@ -12904,12 +12909,12 @@ var init_advanceRevert = __esm({
12904
12909
  AdvanceRevertManager = {
12905
12910
  async takeInitialSnapshot(chatId) {
12906
12911
  try {
12907
- const snapshotsDir = path24.join(DATA_DIR, "snapshots", chatId);
12908
- await fs25.remove(snapshotsDir).catch(() => {
12912
+ const snapshotsDir = path23.join(DATA_DIR, "snapshots", chatId);
12913
+ await fs24.remove(snapshotsDir).catch(() => {
12909
12914
  });
12910
- await fs25.ensureDir(snapshotsDir);
12915
+ await fs24.ensureDir(snapshotsDir);
12911
12916
  const manifest = await scanWorkspace(process.cwd());
12912
- await copyWorkspaceFiles(path24.join(snapshotsDir, "initial"), manifest);
12917
+ await copyWorkspaceFiles(path23.join(snapshotsDir, "initial"), manifest);
12913
12918
  const ledger = readEncryptedJson(LEDGER_ADVANCE_FILE, {});
12914
12919
  ledger[chatId] = {
12915
12920
  initialManifest: manifest,
@@ -12958,7 +12963,7 @@ var init_advanceRevert = __esm({
12958
12963
  for (const file of changedFiles) {
12959
12964
  deltaManifest[file] = currentManifest[file];
12960
12965
  }
12961
- const turnDir = path24.join(DATA_DIR, "snapshots", chatId, `turn_${turnNumber}`);
12966
+ const turnDir = path23.join(DATA_DIR, "snapshots", chatId, `turn_${turnNumber}`);
12962
12967
  await copyWorkspaceFiles(turnDir, deltaManifest);
12963
12968
  }
12964
12969
  session.checkpoints.push({
@@ -12992,28 +12997,28 @@ var init_advanceRevert = __esm({
12992
12997
  const checkpoints = session.checkpoints || [];
12993
12998
  const targetIdx = checkpoints.findIndex((c) => c.id === checkpointId);
12994
12999
  if (targetIdx === -1) throw new Error(`Checkpoint [${checkpointId}] not found.`);
12995
- const snapshotsDir = path24.join(DATA_DIR, "snapshots", chatId);
13000
+ const snapshotsDir = path23.join(DATA_DIR, "snapshots", chatId);
12996
13001
  const stats = { restored: 0, replaced: 0, failed: [] };
12997
13002
  const currentFiles = await scanWorkspace(process.cwd());
12998
13003
  for (const relPath of Object.keys(currentFiles)) {
12999
- const fullPath = path24.join(process.cwd(), relPath);
13000
- await fs25.chmod(fullPath, 438).catch(() => {
13004
+ const fullPath = path23.join(process.cwd(), relPath);
13005
+ await fs24.chmod(fullPath, 438).catch(() => {
13001
13006
  });
13002
- await fs25.remove(fullPath).catch(() => {
13007
+ await fs24.remove(fullPath).catch(() => {
13003
13008
  });
13004
13009
  }
13005
- const initialDir = path24.join(snapshotsDir, "initial");
13010
+ const initialDir = path23.join(snapshotsDir, "initial");
13006
13011
  await restoreSnapshotDir(initialDir, process.cwd(), stats, initialDir);
13007
13012
  for (let i = 1; i <= targetIdx; i++) {
13008
13013
  const cp = checkpoints[i];
13009
- const turnDir = path24.join(snapshotsDir, cp.id);
13014
+ const turnDir = path23.join(snapshotsDir, cp.id);
13010
13015
  await restoreSnapshotDir(turnDir, process.cwd(), stats, turnDir);
13011
13016
  if (cp.deletedFiles && cp.deletedFiles.length > 0) {
13012
13017
  for (const delFile of cp.deletedFiles) {
13013
- const fullPath = path24.join(process.cwd(), delFile);
13014
- await fs25.chmod(fullPath, 438).catch(() => {
13018
+ const fullPath = path23.join(process.cwd(), delFile);
13019
+ await fs24.chmod(fullPath, 438).catch(() => {
13015
13020
  });
13016
- await fs25.remove(fullPath).catch(() => {
13021
+ await fs24.remove(fullPath).catch(() => {
13017
13022
  });
13018
13023
  }
13019
13024
  }
@@ -13045,8 +13050,8 @@ var init_advanceRevert = __esm({
13045
13050
  },
13046
13051
  async cleanup(chatId) {
13047
13052
  try {
13048
- const snapshotsDir = path24.join(DATA_DIR, "snapshots", chatId);
13049
- await fs25.remove(snapshotsDir).catch(() => {
13053
+ const snapshotsDir = path23.join(DATA_DIR, "snapshots", chatId);
13054
+ await fs24.remove(snapshotsDir).catch(() => {
13050
13055
  });
13051
13056
  const ledger = readEncryptedJson(LEDGER_ADVANCE_FILE, {});
13052
13057
  if (ledger[chatId]) {
@@ -13386,14 +13391,14 @@ var init_editor = __esm({
13386
13391
  });
13387
13392
 
13388
13393
  // src/utils/getDirTree/indentation.js
13389
- import path25 from "path";
13390
- import fs26 from "fs";
13394
+ import path24 from "path";
13395
+ import fs25 from "fs";
13391
13396
  var safeReaddirWithTypesDefault, getDirTreeIndentation;
13392
13397
  var init_indentation = __esm({
13393
13398
  "src/utils/getDirTree/indentation.js"() {
13394
13399
  safeReaddirWithTypesDefault = (dir) => {
13395
13400
  try {
13396
- return fs26.readdirSync(dir, { withFileTypes: true });
13401
+ return fs25.readdirSync(dir, { withFileTypes: true });
13397
13402
  } catch (e) {
13398
13403
  return [];
13399
13404
  }
@@ -13402,7 +13407,7 @@ var init_indentation = __esm({
13402
13407
  const entries = preFetchedEntries || safeReaddir(dir);
13403
13408
  const indent = " ".repeat(depth - 1);
13404
13409
  if (entries.length > 100) {
13405
- return `${indent}${path25.basename(dir)}/ (>100 files)
13410
+ return `${indent}${path24.basename(dir)}/ (>100 files)
13406
13411
  `;
13407
13412
  }
13408
13413
  let result = "";
@@ -13416,7 +13421,7 @@ var init_indentation = __esm({
13416
13421
  const subDirs = filtered.filter((e) => e.isDirectory()).sort((a, b) => a.name.localeCompare(b.name));
13417
13422
  const files = filtered.filter((e) => !e.isDirectory()).map((e) => e.name).sort();
13418
13423
  for (const subDir of subDirs) {
13419
- const filePath = path25.join(dir, subDir.name);
13424
+ const filePath = path24.join(dir, subDir.name);
13420
13425
  if (depth > maxDepth) {
13421
13426
  result += `${indent}${subDir.name}/ (max depth)
13422
13427
  `;
@@ -13442,23 +13447,23 @@ var init_indentation = __esm({
13442
13447
  });
13443
13448
 
13444
13449
  // src/utils/getDirTree/box.js
13445
- import path26 from "path";
13446
- import fs27 from "fs";
13450
+ import path25 from "path";
13451
+ import fs26 from "fs";
13447
13452
  var safeReaddirWithTypesDefault2, getDirTreeBox;
13448
13453
  var init_box = __esm({
13449
13454
  "src/utils/getDirTree/box.js"() {
13450
13455
  safeReaddirWithTypesDefault2 = (dir) => {
13451
13456
  try {
13452
- return fs27.readdirSync(dir, { withFileTypes: true });
13457
+ return fs26.readdirSync(dir, { withFileTypes: true });
13453
13458
  } catch (e) {
13454
13459
  return [];
13455
13460
  }
13456
13461
  };
13457
13462
  getDirTreeBox = (dir, maxDepth, prefix = "", depth = 1, safeReaddir = safeReaddirWithTypesDefault2, collapsedDirs = []) => {
13458
13463
  const entries = safeReaddir(dir);
13459
- const sep = path26.sep;
13464
+ const sep = path25.sep;
13460
13465
  if (entries.length > 100) {
13461
- return `${prefix}\u2514\u2500\u2500 ${path26.basename(dir)}${sep} ...100+ files...
13466
+ return `${prefix}\u2514\u2500\u2500 ${path25.basename(dir)}${sep} ...100+ files...
13462
13467
  `;
13463
13468
  }
13464
13469
  let result = "";
@@ -13476,7 +13481,7 @@ var init_box = __esm({
13476
13481
  ];
13477
13482
  finalItems.forEach((item, index) => {
13478
13483
  const isLast = index === finalItems.length - 1;
13479
- const filePath = path26.join(dir, item.name);
13484
+ const filePath = path25.join(dir, item.name);
13480
13485
  const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
13481
13486
  const childPrefix = prefix + (isLast ? " " : "\u2502 ");
13482
13487
  if (item.isCollapsed) {
@@ -13525,8 +13530,8 @@ __export(ai_exports, {
13525
13530
  });
13526
13531
  import dotenv from "dotenv";
13527
13532
  import { GoogleGenAI, ThinkingLevel, HarmBlockThreshold, HarmCategory } from "@google/genai";
13528
- import path27, { normalize } from "path";
13529
- import fs28 from "fs";
13533
+ import path26, { normalize } from "path";
13534
+ import fs27 from "fs";
13530
13535
  var RE_STUTTER_CODE_BLOCK_CLOSED, RE_STUTTER_CODE_BLOCK_OPEN, RE_STUTTER_INLINE_CODE, RE_STUTTER_TABLE_ROW, RE_STUTTER_WORD_BOUNDARY, RE_STUTTER_NON_ALNUM, RE_TOOL_CALL_FUNC, RE_TOOL_PARTIAL_ARGS_FALLBACK, RE_STRIP_QUOTES, RE_BACKSLASH_SLASH, client, globalSettings, systemInstructionCache, colorMainWords, withRetry, TERMINATION_SIGNAL, getCleanGroupedLength, stripAnsi2, fetchWithBackoff, getDeepSeekStream, getMistralStream, getNVIDIAStream, wrapNvidiaStreamWithQueueDepth, getOpenRouterStream, signalTermination, isTerminationSignaled, TOOL_LABELS2, getToolDetail, runJanitorTask, getActiveToolContext, getContextSafeText, contextSafeReplace, getSanitizedText, translateKimiToolCalls, REGEX_PLACEHOLDER_ARG, REGEX_PLACEHOLDER_VAL, isPlaceholderVal, detectToolCalls, initAI, generateSimpleContent, consolidatePastMemories, compressHistory, deleteChatSummary, getAIStream, runSubagent;
13531
13536
  var init_ai = __esm({
13532
13537
  async "src/utils/ai.js"() {
@@ -14509,7 +14514,7 @@ var init_ai = __esm({
14509
14514
  return pArgs.id || pArgs.taskId;
14510
14515
  }
14511
14516
  const filePath = pArgs.path || pArgs.targetFile || pArgs.TargetFile || pArgs.directory;
14512
- return filePath ? path27.basename(filePath.replace(/["']/g, "").replace(/\\/g, "/")) : null;
14517
+ return filePath ? path26.basename(filePath.replace(/["']/g, "").replace(/\\/g, "/")) : null;
14513
14518
  } catch (e) {
14514
14519
  return null;
14515
14520
  }
@@ -14776,9 +14781,9 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
14776
14781
  }
14777
14782
  })() : String(err);
14778
14783
  await new Promise((resolve) => setTimeout(resolve, 1e3));
14779
- const janitorErrDir = path27.join(LOGS_DIR, "janitor");
14780
- if (!fs28.existsSync(janitorErrDir)) fs28.mkdirSync(janitorErrDir, { recursive: true });
14781
- fs28.appendFileSync(path27.join(janitorErrDir, "error.log"), `ERROR [Attempt ${attempts}/${MAX_JANITOR_RETRIES + 1}] [${date}]: ${errLog}
14784
+ const janitorErrDir = path26.join(LOGS_DIR, "janitor");
14785
+ if (!fs27.existsSync(janitorErrDir)) fs27.mkdirSync(janitorErrDir, { recursive: true });
14786
+ fs27.appendFileSync(path26.join(janitorErrDir, "error.log"), `ERROR [Attempt ${attempts}/${MAX_JANITOR_RETRIES + 1}] [${date}]: ${errLog}
14782
14787
 
14783
14788
  `);
14784
14789
  if (attempts > MAX_JANITOR_RETRIES) break;
@@ -14787,8 +14792,8 @@ ${originalTextProcessed.length > USER_CONTEXT_LENGTH ? "... (truncated) ...\n\n"
14787
14792
  }
14788
14793
  }
14789
14794
  if (attempts) {
14790
- const janitorErrDir = path27.join(LOGS_DIR, "janitor");
14791
- fs28.appendFileSync(path27.join(janitorErrDir, "error.log"), `-----------------------------------------------------------------------------
14795
+ const janitorErrDir = path26.join(LOGS_DIR, "janitor");
14796
+ fs27.appendFileSync(path26.join(janitorErrDir, "error.log"), `-----------------------------------------------------------------------------
14792
14797
 
14793
14798
  `);
14794
14799
  }
@@ -15334,10 +15339,10 @@ ${newMemoryListStr}
15334
15339
  }
15335
15340
  })() : String(err);
15336
15341
  ;
15337
- const janitorLogDir = path27.join(LOGS_DIR, "janitor");
15338
- if (!fs28.existsSync(janitorLogDir)) fs28.mkdirSync(janitorLogDir, { recursive: true });
15339
- fs28.appendFileSync(
15340
- path27.join(janitorLogDir, "error.log"),
15342
+ const janitorLogDir = path26.join(LOGS_DIR, "janitor");
15343
+ if (!fs27.existsSync(janitorLogDir)) fs27.mkdirSync(janitorLogDir, { recursive: true });
15344
+ fs27.appendFileSync(
15345
+ path26.join(janitorLogDir, "error.log"),
15341
15346
  `[${(/* @__PURE__ */ new Date()).toLocaleString()}] Past memory batch consolidation error: ${errLog}
15342
15347
  `
15343
15348
  );
@@ -15345,7 +15350,7 @@ ${newMemoryListStr}
15345
15350
  };
15346
15351
  compressHistory = async (settings, history, isAuto = false) => {
15347
15352
  const { chatId, aiProvider = "Google" } = settings;
15348
- const summariesFile = path27.join(SECRET_DIR, "chat-summaries.json");
15353
+ const summariesFile = path26.join(SECRET_DIR, "chat-summaries.json");
15349
15354
  const flattenContext = (hist) => {
15350
15355
  return hist.filter(
15351
15356
  (m) => (m.role === "user" || m.role === "agent" || m.role === "system") && m.role !== "think" && !m.isVisualFeedback && !m.isMeta && !m.isTerminalRecord && !(m.text && m.text.includes("[TERMINAL_RECORD]")) && !String(m.id).startsWith("welcome")
@@ -15428,8 +15433,8 @@ Provide a consolidated summary of the entire session.`;
15428
15433
  };
15429
15434
  deleteChatSummary = (chatId) => {
15430
15435
  try {
15431
- const summariesFile = path27.join(SECRET_DIR, "chat-summaries.json");
15432
- if (fs28.existsSync(summariesFile)) {
15436
+ const summariesFile = path26.join(SECRET_DIR, "chat-summaries.json");
15437
+ if (fs27.existsSync(summariesFile)) {
15433
15438
  const summaries = readEncryptedJson(summariesFile, {});
15434
15439
  if (summaries[chatId]) {
15435
15440
  delete summaries[chatId];
@@ -15445,7 +15450,7 @@ Provide a consolidated summary of the entire session.`;
15445
15450
  if (!client && aiProvider === "Google") throw new Error("AI not initialized");
15446
15451
  const isMemoryEnabled = systemSettings?.memory !== false;
15447
15452
  const originalText = history[history.length - 1].text;
15448
- const summariesFile = path27.join(SECRET_DIR, "chat-summaries.json");
15453
+ const summariesFile = path26.join(SECRET_DIR, "chat-summaries.json");
15449
15454
  let wasCompressedInStream = false;
15450
15455
  const isFirstPrompt = history.filter((m) => m.role === "user").length === 1;
15451
15456
  const hasTitleSignal = originalText.includes("[TITLE-UPDATE]");
@@ -15697,7 +15702,7 @@ Provide a consolidated summary of the entire session.`;
15697
15702
  ];
15698
15703
  const safeReaddirWithTypes = (dir) => {
15699
15704
  try {
15700
- return fs28.readdirSync(dir, { withFileTypes: true });
15705
+ return fs27.readdirSync(dir, { withFileTypes: true });
15701
15706
  } catch (e) {
15702
15707
  return [];
15703
15708
  }
@@ -15710,7 +15715,7 @@ Provide a consolidated summary of the entire session.`;
15710
15715
  if (COLLAPSED_DIRS_GLOBAL.includes(entry.name) || entry.name.startsWith(".")) continue;
15711
15716
  if (entry.isDirectory()) {
15712
15717
  currentCount.value++;
15713
- countFolders(path27.join(dir, entry.name), currentCount, depth + 1);
15718
+ countFolders(path26.join(dir, entry.name), currentCount, depth + 1);
15714
15719
  }
15715
15720
  }
15716
15721
  return currentCount.value;
@@ -15776,10 +15781,10 @@ ${currentSummary}
15776
15781
  if (isBridgeConnected()) {
15777
15782
  ideBlock = "\n[ADDITIONAL IDE CONTEXT]\n";
15778
15783
  if (ideCtx.file_focused !== "none") {
15779
- const relFocused = path27.relative(process.cwd(), ideCtx.file_focused);
15784
+ const relFocused = path26.relative(process.cwd(), ideCtx.file_focused);
15780
15785
  const relOpened = (ideCtx.opened_editors || []).map((p) => {
15781
- const rel = path27.relative(process.cwd(), p);
15782
- return rel.startsWith("..") ? `[External] ${path27.basename(p)}` : rel;
15786
+ const rel = path26.relative(process.cwd(), p);
15787
+ return rel.startsWith("..") ? `[External] ${path26.basename(p)}` : rel;
15783
15788
  });
15784
15789
  ideBlock += `Focused File: ${relFocused}
15785
15790
  Cursor Line: ${ideCtx.cursor_line}
@@ -15821,7 +15826,7 @@ Cursor Line: ${ideCtx.cursor_line}
15821
15826
  }
15822
15827
  const getSumForLimit = (limit, activeFiles2) => {
15823
15828
  return activeFiles2.reduce((sum, f) => {
15824
- const isFocused = ideCtx.file_focused && (f.path === ideCtx.file_focused || path27.resolve(process.cwd(), f.path) === path27.resolve(ideCtx.file_focused));
15829
+ const isFocused = ideCtx.file_focused && (f.path === ideCtx.file_focused || path26.resolve(process.cwd(), f.path) === path26.resolve(ideCtx.file_focused));
15825
15830
  const fileLimit = isFocused ? Math.ceil(limit * 1.2) : limit;
15826
15831
  return sum + Math.min(f.edits.length, fileLimit);
15827
15832
  }, 0);
@@ -15855,7 +15860,7 @@ Cursor Line: ${ideCtx.cursor_line}
15855
15860
  }
15856
15861
  }
15857
15862
  for (const file of activeFiles) {
15858
- const isFocused = ideCtx.file_focused && (file.path === ideCtx.file_focused || path27.resolve(process.cwd(), file.path) === path27.resolve(ideCtx.file_focused));
15863
+ const isFocused = ideCtx.file_focused && (file.path === ideCtx.file_focused || path26.resolve(process.cwd(), file.path) === path26.resolve(ideCtx.file_focused));
15859
15864
  const fileLimit = isFocused ? Math.ceil(chosenLimit * 1.2) : chosenLimit;
15860
15865
  if (file.edits.length > fileLimit) {
15861
15866
  file.edits = file.edits.slice(-fileLimit);
@@ -15942,9 +15947,9 @@ ${ideCtx.warnings}
15942
15947
  endLine = matchRange[2] ? parseInt(matchRange[2], 10) : startLine;
15943
15948
  filePath = tagClean.slice(0, matchRange.index);
15944
15949
  }
15945
- const absPath = path27.resolve(process.cwd(), filePath);
15946
- if (fs28.existsSync(absPath)) {
15947
- const stats = fs28.statSync(absPath);
15950
+ const absPath = path26.resolve(process.cwd(), filePath);
15951
+ if (fs27.existsSync(absPath)) {
15952
+ const stats = fs27.statSync(absPath);
15948
15953
  if (stats.isFile()) {
15949
15954
  const pathLower = filePath.toLowerCase();
15950
15955
  const isPdf = pathLower.endsWith(".pdf");
@@ -15953,7 +15958,7 @@ ${ideCtx.warnings}
15953
15958
  const isMultimodalFile = isImage || isPdf || isOfficeFile;
15954
15959
  const isSupported = aiProvider === "Google" || isModelMultimodal(modelName);
15955
15960
  if (isMultimodalFile && !isSupported) {
15956
- const label = `\u2718 Unsupported Modality: ${path27.basename(filePath)}`;
15961
+ const label = `\u2718 Unsupported Modality: ${path26.basename(filePath)}`;
15957
15962
  let terminalWidth = 115;
15958
15963
  if (process.stdout.isTTY) {
15959
15964
  terminalWidth = process.stdout.columns - 5 || 120;
@@ -15969,11 +15974,11 @@ ${ideCtx.warnings}
15969
15974
  if (startLine === null && !isMultimodalFile) {
15970
15975
  let lineCount = 0;
15971
15976
  try {
15972
- lineCount = fs28.readFileSync(absPath, "utf8").split(/\r\n|\r|\n/).length;
15977
+ lineCount = fs27.readFileSync(absPath, "utf8").split(/\r\n|\r|\n/).length;
15973
15978
  } catch (e) {
15974
15979
  }
15975
15980
  if (lineCount > 300) {
15976
- const label = `\u21B7 Skipped (Too Large): ${path27.basename(filePath)}`;
15981
+ const label = `\u21B7 Skipped (Too Large): ${path26.basename(filePath)}`;
15977
15982
  let terminalWidth = 115;
15978
15983
  if (process.stdout.isTTY) {
15979
15984
  terminalWidth = process.stdout.columns - 5 || 120;
@@ -16014,13 +16019,13 @@ ${ideCtx.warnings}
16014
16019
  if (!isError) {
16015
16020
  let label = "";
16016
16021
  if (isImage) {
16017
- label = `\u2714 Processed: ${path27.basename(filePath)}`;
16022
+ label = `\u2714 Processed: ${path26.basename(filePath)}`;
16018
16023
  attachedBinaryPart = binPart;
16019
16024
  } else if (isPdf || isOfficeFile) {
16020
- label = `\u2714 Auto-Analysed: ${path27.basename(filePath)}`;
16025
+ label = `\u2714 Auto-Analysed: ${path26.basename(filePath)}`;
16021
16026
  attachedBinaryPart = binPart;
16022
16027
  } else {
16023
- label = `\u2714 Auto-Read: ${path27.basename(filePath)}`;
16028
+ label = `\u2714 Auto-Read: ${path26.basename(filePath)}`;
16024
16029
  taggedContextBlocks.push(textResult);
16025
16030
  }
16026
16031
  if (label) {
@@ -16053,7 +16058,7 @@ OS: ${osDetected}${systemSettings?.dynamicDirAwareness ? dirStructure : ""}${cwd
16053
16058
  WARNING: CWD Changed from previous: "${lastCwd}" to current: "${process.cwd()}", write change in chat to avoid future path mismatches
16054
16059
  ` : ""}${memoryPrompt}${ideBlock}
16055
16060
  [/METADATA]
16056
- ${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]
16061
+ ${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 [tool:functions.ToolName(...)] [/SYSTEM]
16057
16062
  ${taggedContextStr}[USER PROMPT]
16058
16063
  ${cleanPromptForModel.trim()}
16059
16064
  [/USER PROMPT]`.trim();
@@ -16710,7 +16715,7 @@ ${ideErr} [/ERROR]`;
16710
16715
  if (keyword !== void 0 && keyword !== null) {
16711
16716
  detail = String(keyword).replace(RE_STRIP_QUOTES, "");
16712
16717
  } else if (filePath) {
16713
- detail = path27.basename(String(filePath).replace(RE_STRIP_QUOTES, "").replace(RE_BACKSLASH_SLASH, "/"));
16718
+ detail = path26.basename(String(filePath).replace(RE_STRIP_QUOTES, "").replace(RE_BACKSLASH_SLASH, "/"));
16714
16719
  } else if (title && (potentialTool === "invoke" || potentialTool === "invoke_sync")) {
16715
16720
  detail = String(title).replace(RE_STRIP_QUOTES, "").substring(0, 30);
16716
16721
  } else if (id && potentialTool === "get_progress") {
@@ -16739,7 +16744,7 @@ ${ideErr} [/ERROR]`;
16739
16744
  if (potentialTool === "invoke" || potentialTool === "invoke_sync" || potentialTool === "get_progress") {
16740
16745
  detail = val.substring(0, 30);
16741
16746
  } else {
16742
- detail = potentialTool === "search_keyword" || potentialTool === "file_map" ? val : path27.basename(val.replace(RE_BACKSLASH_SLASH, "/"));
16747
+ detail = potentialTool === "search_keyword" || potentialTool === "file_map" ? val : path26.basename(val.replace(RE_BACKSLASH_SLASH, "/"));
16743
16748
  }
16744
16749
  }
16745
16750
  }
@@ -16945,9 +16950,9 @@ ${ideErr} [/ERROR]`;
16945
16950
  let totalLines = "...";
16946
16951
  let actualEndLine = eLine;
16947
16952
  try {
16948
- const absPath = path27.resolve(process.cwd(), targetPath2);
16949
- if (fs28.existsSync(absPath)) {
16950
- const content = fs28.readFileSync(absPath, "utf8");
16953
+ const absPath = path26.resolve(process.cwd(), targetPath2);
16954
+ if (fs27.existsSync(absPath)) {
16955
+ const content = fs27.readFileSync(absPath, "utf8");
16951
16956
  const lines = content.split("\n").length;
16952
16957
  totalLines = lines;
16953
16958
  if (!rawStart && !rawEnd && lines > 800) {
@@ -16963,30 +16968,30 @@ ${ideErr} [/ERROR]`;
16963
16968
  const isOfficeFile = pathLower.endsWith(".docx") || pathLower.endsWith(".doc") || pathLower.endsWith(".ppt") || pathLower.endsWith(".pptx") || pathLower.endsWith(".xls") || pathLower.endsWith(".xlsx");
16964
16969
  const isImage = /\.(png|jpg|jpeg|webp|gif|bmp)$/.test(pathLower);
16965
16970
  if (isPdf || isOfficeFile) {
16966
- label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Analyzed: ${path27.basename(targetPath2)}` : "Analyzed: File Not Found"}`;
16971
+ label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Analyzed: ${path26.basename(targetPath2)}` : "Analyzed: File Not Found"}`;
16967
16972
  } else if (isImage) {
16968
- label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Processed: ${path27.basename(targetPath2)}` : "Processed: File Not Found"}`;
16973
+ label = `${targetPath2.length > 0 ? "\u2714" : "\u2718"} ${targetPath2 ? `Processed: ${path26.basename(targetPath2)}` : "Processed: File Not Found"}`;
16969
16974
  } else {
16970
- label = `${totalLines !== "..." ? "\u2714" : "\u2718"} Read: ${targetPath2 ? `${path27.basename(targetPath2)} \u2192 ${totalLines !== "..." ? `Lines ${sLine} - ${actualEndLine} of ${totalLines}` : "File Not Found"}` : "File Not Found"}`;
16975
+ label = `${totalLines !== "..." ? "\u2714" : "\u2718"} Read: ${targetPath2 ? `${path26.basename(targetPath2)} \u2192 ${totalLines !== "..." ? `Lines ${sLine} - ${actualEndLine} of ${totalLines}` : "File Not Found"}` : "File Not Found"}`;
16971
16976
  }
16972
16977
  } else if (normToolName === "list_files" || normToolName === "read_folder") {
16973
16978
  const action = normToolName === "list_files" ? "List" : "Browsed";
16974
- const path29 = parseArgs(toolCall.args).path || null;
16979
+ const path28 = parseArgs(toolCall.args).path || null;
16975
16980
  const recurse = parseArgs(toolCall.args).recurse || 1;
16976
- label = `${path29 ? "\u2714" : "\u2718"} ${action}: ${path29 ? `${path29 === "." ? `./${recurse > 1 ? "*" : ""}` : `${path29.replaceAll("\\", "/")}${recurse > 1 ? `${path29.endsWith("/") ? `*` : `/*`}` : `${path29.endsWith("/") ? "" : "/"}`}`}` : "No Folder Selected"}`;
16981
+ label = `${path28 ? "\u2714" : "\u2718"} ${action}: ${path28 ? `${path28 === "." ? `./${recurse > 1 ? "*" : ""}` : `${path28.replaceAll("\\", "/")}${recurse > 1 ? `${path28.endsWith("/") ? `*` : `/*`}` : `${path28.endsWith("/") ? "" : "/"}`}`}` : "No Folder Selected"}`;
16977
16982
  } else if (normToolName === "write_file" || normToolName === "update_file") {
16978
16983
  const action = normToolName === "write_file" ? "Created" : "Edited";
16979
- const path29 = parseArgs(toolCall.args).path || null;
16980
- label = `${path29 ? "\u2714" : "\u2718"} ${action}: ${path29.replaceAll("\\", "/") || "No File Changes"}`;
16984
+ const path28 = parseArgs(toolCall.args).path || null;
16985
+ label = `${path28 ? "\u2714" : "\u2718"} ${action}: ${path28.replaceAll("\\", "/") || "No File Changes"}`;
16981
16986
  } else if (normToolName === "write_pdf") {
16982
- const path29 = parseArgs(toolCall.args).path || null;
16983
- label = `${path29 ? "\u2714" : "\u2718"} Generated: ${path29.replaceAll("\\", "/") || "No PDF Generated"}`;
16987
+ const path28 = parseArgs(toolCall.args).path || null;
16988
+ label = `${path28 ? "\u2714" : "\u2718"} Generated: ${path28.replaceAll("\\", "/") || "No PDF Generated"}`;
16984
16989
  } else if (normToolName === "write_docx") {
16985
- const path29 = parseArgs(toolCall.args).path || null;
16986
- label = `${path29 ? "\u2714" : "\u2718"} Generated: ${path29.replaceAll("\\", "/") || "No Docx Generated"}`;
16990
+ const path28 = parseArgs(toolCall.args).path || null;
16991
+ label = `${path28 ? "\u2714" : "\u2718"} Generated: ${path28.replaceAll("\\", "/") || "No Docx Generated"}`;
16987
16992
  } else if (normToolName === "file_map") {
16988
- const path29 = parseArgs(toolCall.args).path;
16989
- label = `${path29 ? "\u2714" : "\u2718"} Indexed: ${path29.replaceAll("\\", "/") ? "" + path29 : "File Not Found"}`;
16993
+ const path28 = parseArgs(toolCall.args).path;
16994
+ label = `${path28 ? "\u2714" : "\u2718"} Indexed: ${path28.replaceAll("\\", "/") ? "" + path28 : "File Not Found"}`;
16990
16995
  } else if (normToolName.toLowerCase() === "search_keyword" || normToolName.toLowerCase() === "todo") {
16991
16996
  label = "";
16992
16997
  } else if (normToolName.toLowerCase() === "generate_image") {
@@ -17060,7 +17065,7 @@ ${ideErr} [/ERROR]`;
17060
17065
  const { command } = parseArgs(toolCall.args);
17061
17066
  if (command && settings.systemSettings && settings.systemSettings.allowExternalAccess === false) {
17062
17067
  const riskyPatterns = [/[a-zA-Z]:[\\\/]/i, /^\//, /\.\.[\\\/]/, /\/etc\//, /\/var\//, /\/root\//, /\/bin\//, /\/usr\//];
17063
- const currentDrive = path27.resolve(process.cwd()).substring(0, 3).toLowerCase();
17068
+ const currentDrive = path26.resolve(process.cwd()).substring(0, 3).toLowerCase();
17064
17069
  const splitCommands = (cmdString) => {
17065
17070
  const commands = [];
17066
17071
  let current = "";
@@ -17189,8 +17194,8 @@ ${ideErr} [/ERROR]`;
17189
17194
  const targetPath = parsedArgs.path || parsedArgs.targetPath || null;
17190
17195
  if (targetPath) {
17191
17196
  const isExternalOff = settings.systemSettings && settings.systemSettings.allowExternalAccess === false;
17192
- const absoluteTarget = path27.resolve(targetPath);
17193
- const absoluteCwd = path27.resolve(process.cwd());
17197
+ const absoluteTarget = path26.resolve(targetPath);
17198
+ const absoluteCwd = path26.resolve(process.cwd());
17194
17199
  if (isExternalOff && !absoluteTarget.startsWith(absoluteCwd)) {
17195
17200
  const denyMsg = `Access Denied. You are not allowed to access files outside the current workspace.`;
17196
17201
  if (normToolName === "write_file" || normToolName === "update_file") {
@@ -17379,7 +17384,7 @@ ${ideErr} [/ERROR]`;
17379
17384
  const toolArgs = parseArgs(toolCall.args);
17380
17385
  const { path: filePath } = toolArgs;
17381
17386
  if (filePath) {
17382
- const absPath = path27.resolve(process.cwd(), filePath);
17387
+ const absPath = path26.resolve(process.cwd(), filePath);
17383
17388
  const normalize2 = (p) => p ? p.toLowerCase().replace(/\\/g, "/").replace(/^[a-z]:/, (m) => m.toUpperCase()) : "";
17384
17389
  const normAbsPath = normalize2(absPath);
17385
17390
  let originalContent = "";
@@ -17389,8 +17394,8 @@ ${ideErr} [/ERROR]`;
17389
17394
  if (currentIDE && normFocused === normAbsPath && currentIDE.full_content) {
17390
17395
  originalContent = currentIDE.full_content;
17391
17396
  hasOriginal = true;
17392
- } else if (fs28.existsSync(absPath)) {
17393
- originalContent = fs28.readFileSync(absPath, "utf8");
17397
+ } else if (fs27.existsSync(absPath)) {
17398
+ originalContent = fs27.readFileSync(absPath, "utf8");
17394
17399
  hasOriginal = true;
17395
17400
  }
17396
17401
  originalContentForReporting = originalContent;
@@ -17418,9 +17423,9 @@ ${ideErr} [/ERROR]`;
17418
17423
  const successes = patchResults.filter((r) => r.success);
17419
17424
  const failures = patchResults.filter((r) => !r.success);
17420
17425
  if (successes.length === 0) {
17421
- const errorMsg = `[TOOL RESULT]: ERROR: Failed to apply patches to [${path27.basename(absPath)}].
17426
+ const errorMsg = `[TOOL RESULT]: ERROR: Failed to apply patches to [${path26.basename(absPath)}].
17422
17427
  ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
17423
- const errorLabel = `\u2714 Edited: ${path27.basename(absPath.replaceAll("\\", "/"))}`;
17428
+ const errorLabel = `\u2714 Edited: ${path26.basename(absPath.replaceAll("\\", "/"))}`;
17424
17429
  let terminalWidth = 115;
17425
17430
  if (process.stdout.isTTY) {
17426
17431
  terminalWidth = process.stdout.columns - 5 || 120;
@@ -17437,19 +17442,19 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
17437
17442
  continue;
17438
17443
  }
17439
17444
  }
17440
- yield { type: "status", content: `Opening Diff in IDE: ${path27.basename(absPath)}` };
17445
+ yield { type: "status", content: `Opening Diff in IDE: ${path26.basename(absPath)}` };
17441
17446
  showDiffInIDE(absPath, originalContent, modifiedContent);
17442
17447
  diffOpened = true;
17443
17448
  await new Promise((r) => setTimeout(r, 50));
17444
17449
  } else if (normToolName === "write_file") {
17445
17450
  const rawContent = toolArgs.content || toolArgs.newContent || "";
17446
17451
  const modifiedContent = rawContent.endsWith("\n") ? rawContent : rawContent + "\n";
17447
- if (!fs28.existsSync(absPath)) {
17452
+ if (!fs27.existsSync(absPath)) {
17448
17453
  isNewFileCreated = true;
17449
- fs28.mkdirSync(path27.dirname(absPath), { recursive: true });
17450
- fs28.writeFileSync(absPath, "", "utf8");
17454
+ fs27.mkdirSync(path26.dirname(absPath), { recursive: true });
17455
+ fs27.writeFileSync(absPath, "", "utf8");
17451
17456
  }
17452
- yield { type: "status", content: `Opening New File Diff in IDE: ${path27.basename(absPath)}` };
17457
+ yield { type: "status", content: `Opening New File Diff in IDE: ${path26.basename(absPath)}` };
17453
17458
  showDiffInIDE(absPath, "", modifiedContent);
17454
17459
  diffOpened = true;
17455
17460
  await new Promise((r) => setTimeout(r, 50));
@@ -17485,11 +17490,11 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
17485
17490
  if (normToolName === "write_file" || normToolName === "update_file") {
17486
17491
  const { path: filePath } = parseArgs(toolCall.args);
17487
17492
  if (filePath) {
17488
- const absPath = path27.resolve(process.cwd(), filePath);
17493
+ const absPath = path26.resolve(process.cwd(), filePath);
17489
17494
  closeDiffInIDE(absPath, approval);
17490
- if (approval === "deny" && isNewFileCreated && fs28.existsSync(absPath)) {
17495
+ if (approval === "deny" && isNewFileCreated && fs27.existsSync(absPath)) {
17491
17496
  try {
17492
- fs28.unlinkSync(absPath);
17497
+ fs27.unlinkSync(absPath);
17493
17498
  } catch (e) {
17494
17499
  }
17495
17500
  }
@@ -17501,18 +17506,18 @@ ${failures.map((f) => ` \u2022 ${f.error}`).join("\n")}`;
17501
17506
  }
17502
17507
  if (approval === "allow" && diffOpened && isBridgeConnected()) {
17503
17508
  const { path: filePath } = parseArgs(toolCall.args);
17504
- const absPath = path27.resolve(process.cwd(), filePath);
17505
- const normPath = (p) => p ? path27.resolve(p).replace(/\\/g, "/").toLowerCase() : "";
17509
+ const absPath = path26.resolve(process.cwd(), filePath);
17510
+ const normPath = (p) => p ? path26.resolve(p).replace(/\\/g, "/").toLowerCase() : "";
17506
17511
  const finalIDE = await getIDEContext();
17507
17512
  let finalContent = "";
17508
17513
  if (finalIDE && finalIDE.file_focused && normPath(finalIDE.file_focused) === normPath(absPath) && finalIDE.full_content) {
17509
17514
  finalContent = finalIDE.full_content;
17510
17515
  }
17511
- if (!finalContent && fs28.existsSync(absPath)) {
17512
- finalContent = fs28.readFileSync(absPath, "utf8");
17516
+ if (!finalContent && fs27.existsSync(absPath)) {
17517
+ finalContent = fs27.readFileSync(absPath, "utf8");
17513
17518
  if (!finalContent) {
17514
17519
  await new Promise((r) => setTimeout(r, 100));
17515
- finalContent = fs28.readFileSync(absPath, "utf8");
17520
+ finalContent = fs27.readFileSync(absPath, "utf8");
17516
17521
  }
17517
17522
  }
17518
17523
  const verifiedLines = finalContent.split(/\r?\n/);
@@ -17673,7 +17678,7 @@ ${snippet2}`;
17673
17678
  try {
17674
17679
  const { path: filePath } = parseArgs(toolCall.args);
17675
17680
  if (filePath) {
17676
- const absPath = path27.resolve(process.cwd(), filePath);
17681
+ const absPath = path26.resolve(process.cwd(), filePath);
17677
17682
  const currentIDE = await getIDEContext();
17678
17683
  if (currentIDE && currentIDE.file_focused === absPath && currentIDE.full_content) {
17679
17684
  execToolContext.forcedContent = currentIDE.full_content;
@@ -17687,7 +17692,7 @@ ${snippet2}`;
17687
17692
  if ((normToolName === "write_file" || normToolName === "update_file") && result.startsWith("SUCCESS")) {
17688
17693
  const { path: filePath } = parseArgs(toolCall.args);
17689
17694
  if (filePath) {
17690
- const absPath = path27.resolve(process.cwd(), filePath);
17695
+ const absPath = path26.resolve(process.cwd(), filePath);
17691
17696
  openFileInEditor(absPath);
17692
17697
  }
17693
17698
  }
@@ -17704,7 +17709,7 @@ ${snippet2}`;
17704
17709
  result = result.text;
17705
17710
  }
17706
17711
  if (normToolName === "search_keyword") {
17707
- const { keyword, path: path29 } = parseArgs(toolCall.args);
17712
+ const { keyword, path: path28 } = parseArgs(toolCall.args);
17708
17713
  const _isGlob = typeof result === "string" && result.startsWith("[GLOB]");
17709
17714
  if (_isGlob) result = result.slice(6).trimStart();
17710
17715
  const _isDir = typeof result === "string" && result.startsWith("[DIR]");
@@ -17716,8 +17721,8 @@ ${snippet2}`;
17716
17721
  matchCount = parseInt(m[1]);
17717
17722
  }
17718
17723
  }
17719
- const _sp = path29 ? path29.replace(/[\/\\]+$/, "") : null;
17720
- const displayPath = _sp && _sp !== "." ? `"${_isGlob ? path29 : _isDir ? `${_sp}/*` : _sp}"` : "./";
17724
+ const _sp = path28 ? path28.replace(/[\/\\]+$/, "") : null;
17725
+ const displayPath = _sp && _sp !== "." ? `"${_isGlob ? path28 : _isDir ? `${_sp}/*` : _sp}"` : "./";
17721
17726
  const postLabel = `${keyword ? "\u2714" : "\u2718"} Searched: "${keyword ? keyword : ""}" in ${displayPath.replaceAll("\\", "/")} \u2192 ${matchCount} Match${matchCount === 1 ? "" : "es"}`;
17722
17727
  let terminalWidth = 115;
17723
17728
  if (process.stdout.isTTY) {
@@ -17956,9 +17961,9 @@ ${snippet2}`;
17956
17961
  })() : String(err);
17957
17962
  ;
17958
17963
  const date = (/* @__PURE__ */ new Date()).toLocaleString();
17959
- const agentErrDir = path27.join(LOGS_DIR, "agent");
17960
- if (!fs28.existsSync(agentErrDir)) fs28.mkdirSync(agentErrDir, { recursive: true });
17961
- fs28.appendFileSync(path27.join(agentErrDir, "error.log"), `ERROR [${date}]: ${errLog}
17964
+ const agentErrDir = path26.join(LOGS_DIR, "agent");
17965
+ if (!fs27.existsSync(agentErrDir)) fs27.mkdirSync(agentErrDir, { recursive: true });
17966
+ fs27.appendFileSync(path26.join(agentErrDir, "error.log"), `ERROR [${date}]: ${errLog}
17962
17967
 
17963
17968
  ----------------------------------------------------------------------
17964
17969
 
@@ -18005,7 +18010,7 @@ ${recoveryText}`
18005
18010
  yield { type: "status", content: `Error Occured. Recovering Stream...` };
18006
18011
  } else {
18007
18012
  throw new Error(`Stream collapsed too many times. (Failed to resolve ${MAX_RETRIES} times)
18008
- Error Log can be found in ${path27.join(LOGS_DIR, "agent", "error.log")}`);
18013
+ Error Log can be found in ${path26.join(LOGS_DIR, "agent", "error.log")}`);
18009
18014
  }
18010
18015
  } else {
18011
18016
  if (retryCount <= MAX_RETRIES) {
@@ -18023,7 +18028,7 @@ Error Log can be found in ${path27.join(LOGS_DIR, "agent", "error.log")}`);
18023
18028
  yield { type: "status", content: `Trying to reach ${modelName}` };
18024
18029
  } else {
18025
18030
  throw new Error(`Model ${modelName} cannot be reached. (Failed ${MAX_RETRIES} times)
18026
- Error Log can be found in ${path27.join(LOGS_DIR, "agent", "error.log")}`);
18031
+ Error Log can be found in ${path26.join(LOGS_DIR, "agent", "error.log")}`);
18027
18032
  }
18028
18033
  }
18029
18034
  }
@@ -18142,10 +18147,10 @@ Error Log can be found in ${path27.join(LOGS_DIR, "agent", "error.log")}`);
18142
18147
  }
18143
18148
  })() : String(err);
18144
18149
  const date = (/* @__PURE__ */ new Date()).toLocaleString();
18145
- const agentErrDir = path27.join(LOGS_DIR, "agent");
18150
+ const agentErrDir = path26.join(LOGS_DIR, "agent");
18146
18151
  yield { type: "text", content: `\u274C CRITICAL ERROR: ${errLog.includes("fetch failed") ? "Failed to Connect. Check your Internet Connection or Wait a moment" : errLog}` };
18147
- if (!fs28.existsSync(agentErrDir)) fs28.mkdirSync(agentErrDir, { recursive: true });
18148
- fs28.appendFileSync(path27.join(agentErrDir, "error.log"), `CRITICAL ERROR [${date}]: ${err}
18152
+ if (!fs27.existsSync(agentErrDir)) fs27.mkdirSync(agentErrDir, { recursive: true });
18153
+ fs27.appendFileSync(path26.join(agentErrDir, "error.log"), `CRITICAL ERROR [${date}]: ${err}
18149
18154
 
18150
18155
  ----------------------------------------------------------------------
18151
18156
 
@@ -18249,11 +18254,14 @@ TO ACCESS TOOLS **STRICTLY USE THE EXACT FORMAT IN CHAT OUTPUT:** [tool:function
18249
18254
  **NO OTHER SYNTAX/MARKERS/BOUNDARY ALLOWED**
18250
18255
 
18251
18256
  TOOL POLICY:
18252
- - MAX 3 TOOL CALLS PER TURN
18253
- - Same file, many edits? Prefer multi search-replace in Patch \u2190 **HIGHLY RECOMMENDED**
18254
- - Need specific text OR huge file ? SearchKeyword > ReadFile
18255
- - Tool denied? Use \`Ask\` immediately for user guidance \u2190 **MANDATORY**
18256
- - Restricted Shell Access, NO DELETION
18257
+ - Escape quotes: \\" for code strings
18258
+ - Double-escape literal sequences (eg. \\\\n)
18259
+ - Use real newlines for code formatting
18260
+ - SAME file, MULTIPLE edits? ONE PatchFile (\u226415 blocks) \u2190 PRIORITY
18261
+ - Tool denied? Ask for guidance \u2190 MANDATORY
18262
+ - Need text or huge files? SearchKeyword > Full Read
18263
+ - Update Todos from realtime progress each turn
18264
+ - Restricted Shell Access, No Deletion
18257
18265
 
18258
18266
  **PROVIDED TOOLS**
18259
18267
  -- Communication with USER --
@@ -18264,16 +18272,12 @@ TOOL POLICY:
18264
18272
  - [tool:functions.WebScrape(url="...")]. Proactive use for specific webpage/docs/api
18265
18273
 
18266
18274
  -- Workspace Tools --
18267
- - [tool:functions.SearchKeyword(keyword="...", path="optional, dir/file/glob/regex", fuzzy="bool optional, default: false", regex="bool optional, default: auto")]. path limits search scope. Find definitions/logic without full reads. Locate relevant code
18275
+ - [tool:functions.SearchKeyword(keyword="...", path="optional, dir/file/glob/regex", fuzzy="bool optional, default: false", regex="bool optional, default: auto")]. path scopes search. Find definitions, logic, relevant code
18268
18276
  - [tool:functions.ReadFolder(path="...", recurse="integer 1-3 optional, default: 1")]. DIR Contents + File Size. Minimize recursion
18269
18277
  - [tool:functions.ReadFile(path="...", startLine="integer", endLine="integer")]. View files
18270
- - [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX 15)]. Surgical patchs, TARGET SMALLEST LINES. allowMultiple: Replace all matches ONLY WHERE SURE. Use replaceContent2/newContent2... for multi blocks. Verify DIFFs
18278
+ - [tool:functions.PatchFile(path="...", allowMultiple="bool optional, default: false", replaceContent1="...", newContent1="...", ...MAX15)]. TARGET MINIMAL DIFF. allowMultiple: Replace all matches ONLY WHEN SURE. Multi-blocks: replaceContent2/newContent2... Verify diffs
18271
18279
  - [tool:functions.WriteFile(path="...", content="...")]. Creates/Overwrites. File Exist? PatchFile > WriteFile. VERIFY IMPORTS
18272
- - [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL` : `WINDOWS CMD` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user
18273
-
18274
- - **Escape quotes: \\" for code strings**
18275
- - **Literal escapes: Double-escape sequences (e.g., \\\\n)**
18276
- - **File structure: Real newlines for code formatting**`.trim();
18280
+ - [tool:functions.Run(command="...")]. Runs ${osDetected === "Windows" ? isPsAvailable() ? `WINDOWS POWERSHELL` : `WINDOWS CMD` : `BASH`} command. Destructive/Irreversible ops \u2192 Ask user`.trim();
18277
18281
  const systemInstruction = `=== START SYSTEM PROMPT ===
18278
18282
  You are a subagent helping the main FluxFlow CLI agent
18279
18283
  Your task is: "${task}"
@@ -18378,25 +18382,25 @@ ${cleanResponse}
18378
18382
  const keywordPath = pArgs.path || "";
18379
18383
  label = `${keyword ? "\u2714" : "\u2718"} \x1B[95mSearched\x1B[0m: ${keyword || "No Query"}${keywordPath ? ` \u2192 ${keywordPath.replaceAll("\\", "/")}` : ""}`;
18380
18384
  } else if (normalizedToolName === "view_file" || normalizedToolName === "viewfile" || normalizedToolName === "readfile") {
18381
- const path29 = parseArgs(toolCall.args).path || "";
18382
- label = `\u2714 \x1B[95mRead\x1B[0m: ${path29.replaceAll("\\", "/")}`;
18385
+ const path28 = parseArgs(toolCall.args).path || "";
18386
+ label = `\u2714 \x1B[95mRead\x1B[0m: ${path28.replaceAll("\\", "/")}`;
18383
18387
  } else if (normalizedToolName === "list_files" || normalizedToolName === "read_folder" || normalizedToolName === "readfolder") {
18384
- const path29 = parseArgs(toolCall.args).path || null;
18388
+ const path28 = parseArgs(toolCall.args).path || null;
18385
18389
  const recurse = parseArgs(toolCall.args).recurse || 0;
18386
- label = `${path29 ? "\u2714" : "\u2718"} \x1B[95mBrowsed\x1B[0m: ${path29 ? `${path29.replaceAll("\\", "/")}${recurse > 0 ? `${path29.endsWith("/") ? `*${recurse}` : `/*${recurse}`}` : `${path29.endsWith("/") ? "" : "/"}`}` : ""}`;
18390
+ label = `${path28 ? "\u2714" : "\u2718"} \x1B[95mBrowsed\x1B[0m: ${path28 ? `${path28.replaceAll("\\", "/")}${recurse > 0 ? `${path28.endsWith("/") ? `*${recurse}` : `/*${recurse}`}` : `${path28.endsWith("/") ? "" : "/"}`}` : ""}`;
18387
18391
  } else if (normalizedToolName === "write_file" || normalizedToolName === "writefile") {
18388
- const path29 = parseArgs(toolCall.args).path || null;
18389
- label = `${path29 ? "\u2714" : "\u2718"} \x1B[95mCreated\x1B[0m: ${path29 ? `${path29.replaceAll("\\", "/")}` : "No File Changes"}`;
18392
+ const path28 = parseArgs(toolCall.args).path || null;
18393
+ label = `${path28 ? "\u2714" : "\u2718"} \x1B[95mCreated\x1B[0m: ${path28 ? `${path28.replaceAll("\\", "/")}` : "No File Changes"}`;
18390
18394
  } else if (normalizedToolName === "update_file" || normalizedToolName === "updatefile" || normalizedToolName === "patchfile" || normalizedToolName === "patch_file" || normalizedToolName === "patchfile" || normalizedToolName === "updatefile") {
18391
- const path29 = parseArgs(toolCall.args).path || null;
18395
+ const path28 = parseArgs(toolCall.args).path || null;
18392
18396
  const content = parseArgs(toolCall.args).content || null;
18393
- label = `${path29 ? "\u2714" : "\u2718"} \x1B[95mEdited\x1B[0m: ${path29 ? `${path29.replaceAll("\\", "/")}` : "No File Changes"}`;
18397
+ label = `${path28 ? "\u2714" : "\u2718"} \x1B[95mEdited\x1B[0m: ${path28 ? `${path28.replaceAll("\\", "/")}` : "No File Changes"}`;
18394
18398
  } else if (normalizedToolName === "exec_command" || normalizedToolName === "execcommand" || normalizedToolName === "run") {
18395
18399
  const command = parseArgs(toolCall.args).command || null;
18396
18400
  label = `${command ? "\u2714" : "\u2718"} \x1B[95mExecuted\x1B[0m: ${command ? command.slice(0, 100) + (command.length > 100 ? "..." : "") : "No Command"}`;
18397
18401
  } else if (normalizedToolName === "file_map" || normalizedToolName === "filemap") {
18398
- const path29 = parseArgs(toolCall.args).path || "";
18399
- label = `${path29 ? "\u2714" : "\u2718"} \x1B[95mIndexed\x1B[0m: ${path29 ? `${path29.replaceAll("\\", "/")}` : "File Not Found"}`;
18402
+ const path28 = parseArgs(toolCall.args).path || "";
18403
+ label = `${path28 ? "\u2714" : "\u2718"} \x1B[95mIndexed\x1B[0m: ${path28 ? `${path28.replaceAll("\\", "/")}` : "File Not Found"}`;
18400
18404
  } else if (normalizedToolName === "await") {
18401
18405
  const { time: time2 } = parseArgs(toolCall.args);
18402
18406
  let sec = parseFloat(time2) || 0;
@@ -19392,7 +19396,7 @@ var init_RevertModal = __esm({
19392
19396
  import puppeteer4 from "puppeteer";
19393
19397
  import { exec } from "child_process";
19394
19398
  import { promisify } from "util";
19395
- import fs29 from "fs";
19399
+ import fs28 from "fs";
19396
19400
  var execAsync, checkPuppeteerReady, installPuppeteerBrowser;
19397
19401
  var init_setup = __esm({
19398
19402
  "src/utils/setup.js"() {
@@ -19401,11 +19405,11 @@ var init_setup = __esm({
19401
19405
  checkPuppeteerReady = () => {
19402
19406
  try {
19403
19407
  const pptrConfig = getPuppeteerConfig();
19404
- if (pptrConfig.executablePath && fs29.existsSync(pptrConfig.executablePath)) {
19408
+ if (pptrConfig.executablePath && fs28.existsSync(pptrConfig.executablePath)) {
19405
19409
  return true;
19406
19410
  }
19407
19411
  const exePath = puppeteer4.executablePath();
19408
- const exists = exePath && fs29.existsSync(exePath);
19412
+ const exists = exePath && fs28.existsSync(exePath);
19409
19413
  if (exists) return true;
19410
19414
  } catch (e) {
19411
19415
  return false;
@@ -19492,8 +19496,8 @@ __export(app_exports, {
19492
19496
  import os4 from "os";
19493
19497
  import React16, { useState as useState15, useEffect as useEffect12, useRef as useRef4, useMemo as useMemo2 } from "react";
19494
19498
  import { Box as Box14, Text as Text16, useInput as useInput9, useStdout as useStdout2, Static } from "ink";
19495
- import fs30 from "fs-extra";
19496
- import path28 from "path";
19499
+ import fs29 from "fs-extra";
19500
+ import path27 from "path";
19497
19501
  import { exec as exec2 } from "child_process";
19498
19502
  import { fileURLToPath as fileURLToPath3 } from "url";
19499
19503
  import TextInput4 from "ink-text-input";
@@ -19923,10 +19927,10 @@ function App({ args = [] }) {
19923
19927
  const kbPath = getKeybindingsPath(ideName);
19924
19928
  if (!kbPath) return;
19925
19929
  try {
19926
- await fs30.ensureDir(path28.dirname(kbPath));
19930
+ await fs29.ensureDir(path27.dirname(kbPath));
19927
19931
  let bindings = [];
19928
- if (fs30.existsSync(kbPath)) {
19929
- const content = fs30.readFileSync(kbPath, "utf8").trim();
19932
+ if (fs29.existsSync(kbPath)) {
19933
+ const content = fs29.readFileSync(kbPath, "utf8").trim();
19930
19934
  if (content) {
19931
19935
  try {
19932
19936
  bindings = parseJsonc(content);
@@ -19946,7 +19950,7 @@ function App({ args = [] }) {
19946
19950
  },
19947
19951
  "when": "terminalFocus"
19948
19952
  });
19949
- fs30.writeFileSync(kbPath, JSON.stringify(bindings, null, 4), "utf8");
19953
+ fs29.writeFileSync(kbPath, JSON.stringify(bindings, null, 4), "utf8");
19950
19954
  cachedShortcut = "Shift + Enter";
19951
19955
  setMessages((prev) => {
19952
19956
  setCompletedIndex(prev.length + 1);
@@ -20681,7 +20685,7 @@ function App({ args = [] }) {
20681
20685
  useEffect12(() => {
20682
20686
  async function init() {
20683
20687
  try {
20684
- const pkg = JSON.parse(fs30.readFileSync(path28.join(process.cwd(), "package.json"), "utf8"));
20688
+ const pkg = JSON.parse(fs29.readFileSync(path27.join(process.cwd(), "package.json"), "utf8"));
20685
20689
  initBridge(versionFluxflow || pkg.version || "2.0.0");
20686
20690
  } catch (e) {
20687
20691
  initBridge("2.0.0");
@@ -20795,7 +20799,7 @@ function App({ args = [] }) {
20795
20799
  if (!parsedArgs.playground) {
20796
20800
  deleteChat(PLAYGROUND_CHAT_ID).catch(() => {
20797
20801
  });
20798
- fs30.remove(path28.join(DATA_DIR, "playground")).catch(() => {
20802
+ fs29.remove(path27.join(DATA_DIR, "playground")).catch(() => {
20799
20803
  });
20800
20804
  }
20801
20805
  performVersionCheck(false, freshSettings);
@@ -20829,9 +20833,9 @@ function App({ args = [] }) {
20829
20833
  }
20830
20834
  }
20831
20835
  if (parsedArgs.playground) {
20832
- const playgroundDir = path28.join(DATA_DIR, "playground");
20836
+ const playgroundDir = path27.join(DATA_DIR, "playground");
20833
20837
  try {
20834
- fs30.ensureDirSync(playgroundDir);
20838
+ fs29.ensureDirSync(playgroundDir);
20835
20839
  process.chdir(playgroundDir);
20836
20840
  } catch (e) {
20837
20841
  }
@@ -20872,8 +20876,8 @@ function App({ args = [] }) {
20872
20876
  if (kbPath) {
20873
20877
  try {
20874
20878
  let bindings = [];
20875
- if (fs30.existsSync(kbPath)) {
20876
- const content = fs30.readFileSync(kbPath, "utf8").trim();
20879
+ if (fs29.existsSync(kbPath)) {
20880
+ const content = fs29.readFileSync(kbPath, "utf8").trim();
20877
20881
  if (content) {
20878
20882
  bindings = parseJsonc(content);
20879
20883
  }
@@ -21252,22 +21256,22 @@ ${cleanText}`, color: "magenta" }];
21252
21256
  });
21253
21257
  break;
21254
21258
  }
21255
- const src = path28.join(DATA_DIR, "playground");
21256
- const dest = path28.join(parsedArgs.originalCwd, "playground-export");
21259
+ const src = path27.join(DATA_DIR, "playground");
21260
+ const dest = path27.join(parsedArgs.originalCwd, "playground-export");
21257
21261
  const moveFiles = async () => {
21258
21262
  try {
21259
21263
  setMessages((prev) => {
21260
21264
  setCompletedIndex(prev.length + 1);
21261
21265
  return [...prev, { id: Date.now(), role: "system", text: `[PLAYGROUND] Exporting playground content to ${dest}`, isMeta: true }];
21262
21266
  });
21263
- await fs30.ensureDir(dest);
21267
+ await fs29.ensureDir(dest);
21264
21268
  const excludeDirs = ["node_modules", ".git", ".venv", "venv", "env", ".next", "dist", "build", ".cache"];
21265
- await fs30.copy(src, dest, {
21269
+ await fs29.copy(src, dest, {
21266
21270
  overwrite: true,
21267
21271
  filter: (srcPath) => {
21268
- const relative = path28.relative(src, srcPath);
21272
+ const relative = path27.relative(src, srcPath);
21269
21273
  if (!relative) return true;
21270
- const parts2 = relative.split(path28.sep);
21274
+ const parts2 = relative.split(path27.sep);
21271
21275
  return !parts2.some((part) => excludeDirs.includes(part));
21272
21276
  }
21273
21277
  });
@@ -21329,7 +21333,7 @@ ${cleanText}`, color: "magenta" }];
21329
21333
  }
21330
21334
  }
21331
21335
  setTimeout(() => {
21332
- fs30.emptyDir(path28.join(DATA_DIR, "playground")).catch((err) => {
21336
+ fs29.emptyDir(path27.join(DATA_DIR, "playground")).catch((err) => {
21333
21337
  setMessages((prev) => {
21334
21338
  const newMsgs = [...prev, {
21335
21339
  id: "playground-" + Date.now(),
@@ -21719,12 +21723,12 @@ ${list || "No saved chats found."}`, isMeta: true }];
21719
21723
  setCompletedIndex(prev.length + 1);
21720
21724
  return [...prev, { id: Date.now(), role: "system", text: "[NUCLEAR] Initiating reset...", isMeta: true }];
21721
21725
  });
21722
- if (fs30.existsSync(LOGS_DIR)) fs30.removeSync(LOGS_DIR);
21723
- if (fs30.existsSync(SECRET_DIR)) fs30.removeSync(SECRET_DIR);
21724
- if (fs30.existsSync(SETTINGS_FILE)) fs30.removeSync(SETTINGS_FILE);
21726
+ if (fs29.existsSync(LOGS_DIR)) fs29.removeSync(LOGS_DIR);
21727
+ if (fs29.existsSync(SECRET_DIR)) fs29.removeSync(SECRET_DIR);
21728
+ if (fs29.existsSync(SETTINGS_FILE)) fs29.removeSync(SETTINGS_FILE);
21725
21729
  try {
21726
- const items = fs30.readdirSync(FLUXFLOW_DIR);
21727
- if (items.length === 0) fs30.removeSync(FLUXFLOW_DIR);
21730
+ const items = fs29.readdirSync(FLUXFLOW_DIR);
21731
+ if (items.length === 0) fs29.removeSync(FLUXFLOW_DIR);
21728
21732
  } catch (e) {
21729
21733
  }
21730
21734
  setTimeout(() => {
@@ -21846,15 +21850,15 @@ ${list || "No saved chats found."}`, isMeta: true }];
21846
21850
  # SKILLS & WORKFLOWS
21847
21851
  - [Define custom step-by-step recipes for this project here]
21848
21852
  `;
21849
- const filePath = path28.join(process.cwd(), "FluxFlow.md");
21850
- if (fs30.pathExistsSync(filePath)) {
21853
+ const filePath = path27.join(process.cwd(), "FluxFlow.md");
21854
+ if (fs29.pathExistsSync(filePath)) {
21851
21855
  setMessages((prev) => {
21852
21856
  setCompletedIndex(prev.length + 1);
21853
21857
  return [...prev, { id: "init-err-" + Date.now(), role: "system", text: "ERROR: FluxFlow.md already exists in this directory.", isMeta: true }];
21854
21858
  });
21855
21859
  } else {
21856
21860
  try {
21857
- fs30.writeFileSync(filePath, template);
21861
+ fs29.writeFileSync(filePath, template);
21858
21862
  setMessages((prev) => {
21859
21863
  setCompletedIndex(prev.length + 1);
21860
21864
  return [...prev, { id: "init-ok-" + Date.now(), role: "system", text: "[SUCCESS] FluxFlow.md has been initialized. You can now customize it for this project.", isMeta: true }];
@@ -21968,19 +21972,19 @@ ${list || "No saved chats found."}`, isMeta: true }];
21968
21972
  if (!fullTextStr.startsWith("[TOOL RESULT]:")) {
21969
21973
  return m;
21970
21974
  }
21971
- if (fullTextStr.startsWith("[TOOL RESULT]: ERROR") || fullTextStr.startsWith("[TOOL RESULT]: DENIED") || fullTextStr.includes("...Result Truncated by System on User Request")) {
21975
+ if (fullTextStr.startsWith("[TOOL RESULT]: ERROR") || fullTextStr.startsWith("[TOOL RESULT]: DENIED") || fullTextStr.includes("...Result Truncated by System on User Command")) {
21972
21976
  return m;
21973
21977
  }
21974
21978
  truncatedCount++;
21975
21979
  if (fullTextStr.startsWith("[TOOL RESULT]: SUCCESS")) {
21976
21980
  return {
21977
21981
  ...m,
21978
- fullText: "[TOOL RESULT]: SUCCESS: ...Result Truncated by System on User Request"
21982
+ fullText: "[TOOL RESULT]: SUCCESS: ...Result Truncated by System on User Command"
21979
21983
  };
21980
21984
  }
21981
21985
  return {
21982
21986
  ...m,
21983
- fullText: "[TOOL RESULT]: ...Result Truncated by System on User Request"
21987
+ fullText: "[TOOL RESULT]: ...Result Truncated by System on User Command"
21984
21988
  };
21985
21989
  });
21986
21990
  const finalMsgs = [...updatedMessages, {
@@ -24233,11 +24237,11 @@ var init_app = __esm({
24233
24237
  if (process.platform === "win32") {
24234
24238
  const appData = process.env.APPDATA;
24235
24239
  if (!appData) return null;
24236
- return path28.join(appData, dirName, "User", "keybindings.json");
24240
+ return path27.join(appData, dirName, "User", "keybindings.json");
24237
24241
  } else if (process.platform === "darwin") {
24238
- return path28.join(home, "Library", "Application Support", dirName, "User", "keybindings.json");
24242
+ return path27.join(home, "Library", "Application Support", dirName, "User", "keybindings.json");
24239
24243
  } else {
24240
- return path28.join(home, ".config", dirName, "User", "keybindings.json");
24244
+ return path27.join(home, ".config", dirName, "User", "keybindings.json");
24241
24245
  }
24242
24246
  };
24243
24247
  parseJsonc = (content) => {
@@ -24281,8 +24285,8 @@ var init_app = __esm({
24281
24285
  SESSION_START_TIME = Date.now();
24282
24286
  CHANGELOG_URL = "https://fluxflow-cli.onrender.com/changelog";
24283
24287
  DOCS_URL = "https://fluxflow-cli.onrender.com/";
24284
- packageJsonPath = path28.join(path28.dirname(fileURLToPath3(import.meta.url)), "../package.json");
24285
- packageJson = JSON.parse(fs30.readFileSync(packageJsonPath, "utf8"));
24288
+ packageJsonPath = path27.join(path27.dirname(fileURLToPath3(import.meta.url)), "../package.json");
24289
+ packageJson = JSON.parse(fs29.readFileSync(packageJsonPath, "utf8"));
24286
24290
  versionFluxflow = packageJson.version;
24287
24291
  updatedOn = packageJson.date || "2026-05-20";
24288
24292
  ResolutionModal = ({ data, onResolve, onEdit, theme = "Dark" }) => {
@@ -24316,20 +24320,20 @@ var init_app = __esm({
24316
24320
  const scan = (currentDir) => {
24317
24321
  if (fileList.length >= 2e3) return;
24318
24322
  try {
24319
- const files = fs30.readdirSync(currentDir);
24323
+ const files = fs29.readdirSync(currentDir);
24320
24324
  for (const file of files) {
24321
24325
  if (fileList.length >= 2e3) return;
24322
24326
  if (["node_modules", ".git", ".gemini", "dist", "build", ".next", ".cache", "out"].includes(file)) {
24323
24327
  continue;
24324
24328
  }
24325
- const filePath = path28.join(currentDir, file);
24326
- const stat = fs30.statSync(filePath);
24329
+ const filePath = path27.join(currentDir, file);
24330
+ const stat = fs29.statSync(filePath);
24327
24331
  if (stat.isDirectory()) {
24328
24332
  scan(filePath);
24329
24333
  } else {
24330
24334
  fileList.push({
24331
24335
  name: flattenString(file),
24332
- relativePath: flattenString(path28.relative(process.cwd(), filePath))
24336
+ relativePath: flattenString(path27.relative(process.cwd(), filePath))
24333
24337
  });
24334
24338
  }
24335
24339
  }
@@ -24529,11 +24533,11 @@ if (isBundled && !process.execArgv.some((arg) => arg.includes("max-old-space-siz
24529
24533
  const isUpdate = args[0] === "--update";
24530
24534
  const isExport = args[0] === "--export";
24531
24535
  if (isVersion || isHelp || isHelpCommands || isUpdate || isExport) {
24532
- const fs31 = await import("fs");
24533
- const path29 = await import("path");
24536
+ const fs30 = await import("fs");
24537
+ const path28 = await import("path");
24534
24538
  const { fileURLToPath: fileURLToPath5 } = await import("url");
24535
- const packageJsonPath2 = path29.join(path29.dirname(fileURLToPath5(import.meta.url)), "../package.json");
24536
- const packageJson2 = JSON.parse(fs31.readFileSync(packageJsonPath2, "utf8"));
24539
+ const packageJsonPath2 = path28.join(path28.dirname(fileURLToPath5(import.meta.url)), "../package.json");
24540
+ const packageJson2 = JSON.parse(fs30.readFileSync(packageJsonPath2, "utf8"));
24537
24541
  const versionFluxflow2 = packageJson2.version;
24538
24542
  if (isExport) {
24539
24543
  const subArg = (args[1] || "").toLowerCase();