@probelabs/probe 0.6.0-rc257 → 0.6.0-rc259

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 (30) hide show
  1. package/bin/binaries/probe-v0.6.0-rc259-aarch64-apple-darwin.tar.gz +0 -0
  2. package/bin/binaries/probe-v0.6.0-rc259-aarch64-unknown-linux-musl.tar.gz +0 -0
  3. package/bin/binaries/probe-v0.6.0-rc259-x86_64-apple-darwin.tar.gz +0 -0
  4. package/bin/binaries/probe-v0.6.0-rc259-x86_64-pc-windows-msvc.zip +0 -0
  5. package/bin/binaries/probe-v0.6.0-rc259-x86_64-unknown-linux-musl.tar.gz +0 -0
  6. package/build/agent/ProbeAgent.js +13 -0
  7. package/build/agent/index.js +518 -135
  8. package/build/agent/probeTool.js +9 -0
  9. package/build/agent/shared/prompts.js +40 -8
  10. package/build/agent/tools.js +8 -0
  11. package/build/index.js +7 -2
  12. package/build/tools/common.js +56 -23
  13. package/build/tools/edit.js +139 -6
  14. package/build/tools/index.js +5 -2
  15. package/cjs/agent/ProbeAgent.cjs +3811 -5637
  16. package/cjs/index.cjs +3821 -5637
  17. package/package.json +1 -1
  18. package/src/agent/ProbeAgent.js +13 -0
  19. package/src/agent/probeTool.js +9 -0
  20. package/src/agent/shared/prompts.js +40 -8
  21. package/src/agent/tools.js +8 -0
  22. package/src/index.js +7 -2
  23. package/src/tools/common.js +56 -23
  24. package/src/tools/edit.js +139 -6
  25. package/src/tools/index.js +5 -2
  26. package/bin/binaries/probe-v0.6.0-rc257-aarch64-apple-darwin.tar.gz +0 -0
  27. package/bin/binaries/probe-v0.6.0-rc257-aarch64-unknown-linux-musl.tar.gz +0 -0
  28. package/bin/binaries/probe-v0.6.0-rc257-x86_64-apple-darwin.tar.gz +0 -0
  29. package/bin/binaries/probe-v0.6.0-rc257-x86_64-pc-windows-msvc.zip +0 -0
  30. package/bin/binaries/probe-v0.6.0-rc257-x86_64-unknown-linux-musl.tar.gz +0 -0
@@ -9427,7 +9427,7 @@ async function handleLineEdit({ resolvedPath, file_path, start_line, end_line, n
9427
9427
  return buildLineEditResponse(file_path, startLine, endLine, newLines.length, fileLines, startLine - 1, action, modifications);
9428
9428
  }
9429
9429
  }
9430
- var editTool, createTool, editSchema, createSchema, editDescription, createDescription, editToolDefinition, createToolDefinition;
9430
+ var editTool, createTool, multiEditTool, editSchema, createSchema, multiEditSchema, editDescription, createDescription, multiEditDescription, editToolDefinition, createToolDefinition, multiEditToolDefinition;
9431
9431
  var init_edit = __esm({
9432
9432
  "src/tools/edit.js"() {
9433
9433
  "use strict";
@@ -9497,7 +9497,7 @@ Parameters:
9497
9497
  },
9498
9498
  required: ["file_path", "new_string"]
9499
9499
  },
9500
- execute: async ({ file_path, old_string, new_string, replace_all = false, symbol, position, start_line, end_line }) => {
9500
+ execute: async ({ file_path, old_string, new_string, replace_all = false, symbol, position, start_line, end_line, workingDirectory }) => {
9501
9501
  try {
9502
9502
  if (!file_path || typeof file_path !== "string" || file_path.trim() === "") {
9503
9503
  return `Error editing file: Invalid file_path - must be a non-empty string. Provide an absolute path or a path relative to the working directory (e.g. "src/main.js").`;
@@ -9505,7 +9505,8 @@ Parameters:
9505
9505
  if (new_string === void 0 || new_string === null || typeof new_string !== "string") {
9506
9506
  return `Error editing file: Invalid new_string - must be a string. Provide the replacement content as a string value (empty string "" is valid for deletions).`;
9507
9507
  }
9508
- const resolvedPath = isAbsolute(file_path) ? file_path : resolve(cwd || process.cwd(), file_path);
9508
+ const effectiveCwd = workingDirectory || cwd || process.cwd();
9509
+ const resolvedPath = isAbsolute(file_path) ? file_path : resolve(effectiveCwd, file_path);
9509
9510
  if (debug) {
9510
9511
  console.error(`[Edit] Attempting to edit file: ${resolvedPath}`);
9511
9512
  }
@@ -9612,7 +9613,7 @@ Important:
9612
9613
  },
9613
9614
  required: ["file_path", "content"]
9614
9615
  },
9615
- execute: async ({ file_path, content, overwrite = false }) => {
9616
+ execute: async ({ file_path, content, overwrite = false, workingDirectory }) => {
9616
9617
  try {
9617
9618
  if (!file_path || typeof file_path !== "string" || file_path.trim() === "") {
9618
9619
  return `Error creating file: Invalid file_path - must be a non-empty string. Provide an absolute path or a path relative to the working directory (e.g. "src/newFile.js").`;
@@ -9620,7 +9621,8 @@ Important:
9620
9621
  if (content === void 0 || content === null || typeof content !== "string") {
9621
9622
  return `Error creating file: Invalid content - must be a string. Provide the file content as a string value (empty string "" is valid for an empty file).`;
9622
9623
  }
9623
- const resolvedPath = isAbsolute(file_path) ? file_path : resolve(cwd || process.cwd(), file_path);
9624
+ const effectiveCwd = workingDirectory || cwd || process.cwd();
9625
+ const resolvedPath = isAbsolute(file_path) ? file_path : resolve(effectiveCwd, file_path);
9624
9626
  if (debug) {
9625
9627
  console.error(`[Create] Attempting to create file: ${resolvedPath}`);
9626
9628
  }
@@ -9649,6 +9651,70 @@ Important:
9649
9651
  }
9650
9652
  });
9651
9653
  };
9654
+ multiEditTool = (options = {}) => {
9655
+ const editInstance = editTool(options);
9656
+ return tool({
9657
+ name: "multi_edit",
9658
+ description: "Apply multiple file edits in a single tool call. Accepts a JSON array of edit operations.",
9659
+ inputSchema: {
9660
+ type: "object",
9661
+ properties: {
9662
+ edits: {
9663
+ type: "string",
9664
+ description: "JSON array of edit operations. Each object supports: file_path, old_string, new_string, replace_all, symbol, position, start_line, end_line."
9665
+ }
9666
+ },
9667
+ required: ["edits"]
9668
+ },
9669
+ execute: async ({ edits: rawEdits }) => {
9670
+ let edits;
9671
+ if (typeof rawEdits === "string") {
9672
+ try {
9673
+ edits = JSON.parse(rawEdits);
9674
+ } catch (e) {
9675
+ return `Error: Invalid JSON in edits parameter - ${e.message}. Provide a raw JSON array between <edits> tags.`;
9676
+ }
9677
+ } else if (Array.isArray(rawEdits)) {
9678
+ edits = rawEdits;
9679
+ } else {
9680
+ return "Error: edits must be a JSON array of edit operations.";
9681
+ }
9682
+ if (!Array.isArray(edits) || edits.length === 0) {
9683
+ return "Error: edits must be a non-empty JSON array.";
9684
+ }
9685
+ if (edits.length > 50) {
9686
+ return `Error: Too many edits (${edits.length}). Maximum 50 per batch.`;
9687
+ }
9688
+ const results = [];
9689
+ let successCount = 0;
9690
+ let failCount = 0;
9691
+ for (let i = 0; i < edits.length; i++) {
9692
+ const editOp = edits[i];
9693
+ if (!editOp || typeof editOp !== "object" || Array.isArray(editOp)) {
9694
+ results.push(`[${i + 1}] FAIL: Invalid edit operation - must be an object`);
9695
+ failCount++;
9696
+ continue;
9697
+ }
9698
+ try {
9699
+ const result = await editInstance.execute(editOp);
9700
+ const isError = typeof result === "string" && result.startsWith("Error");
9701
+ if (isError) {
9702
+ results.push(`[${i + 1}] FAIL: ${result}`);
9703
+ failCount++;
9704
+ } else {
9705
+ results.push(`[${i + 1}] OK: ${result}`);
9706
+ successCount++;
9707
+ }
9708
+ } catch (error) {
9709
+ results.push(`[${i + 1}] FAIL: ${error.message}`);
9710
+ failCount++;
9711
+ }
9712
+ }
9713
+ const summary = `Multi-edit: ${successCount}/${edits.length} succeeded` + (failCount > 0 ? `, ${failCount} failed` : "");
9714
+ return summary + "\n\n" + results.join("\n");
9715
+ }
9716
+ });
9717
+ };
9652
9718
  editSchema = {
9653
9719
  type: "object",
9654
9720
  properties: {
@@ -9706,8 +9772,19 @@ Important:
9706
9772
  },
9707
9773
  required: ["file_path", "content"]
9708
9774
  };
9775
+ multiEditSchema = {
9776
+ type: "object",
9777
+ properties: {
9778
+ edits: {
9779
+ type: "string",
9780
+ description: "JSON array of edit operations"
9781
+ }
9782
+ },
9783
+ required: ["edits"]
9784
+ };
9709
9785
  editDescription = "Edit files using text replacement, AST-aware symbol operations, or line-targeted editing. Supports fuzzy matching for text edits and optional hash-based integrity verification for line edits.";
9710
9786
  createDescription = "Create new files with specified content. Will create parent directories if needed.";
9787
+ multiEditDescription = "Apply multiple file edits in a single tool call. Accepts a JSON array of edit operations, each supporting the same modes as the edit tool.";
9711
9788
  editToolDefinition = `
9712
9789
  ## edit
9713
9790
  Description: ${editDescription}
@@ -9863,6 +9940,44 @@ Examples:
9863
9940
  This is a new project.</content>
9864
9941
  <overwrite>true</overwrite>
9865
9942
  </create>`;
9943
+ multiEditToolDefinition = `
9944
+ ## multi_edit
9945
+ Description: ${multiEditDescription}
9946
+
9947
+ Apply multiple edits in one call. Each operation in the array uses the same parameters as the edit tool:
9948
+ - file_path, old_string, new_string (text mode)
9949
+ - file_path, symbol, new_string (symbol replace)
9950
+ - file_path, symbol, new_string, position (symbol insert)
9951
+ - file_path, start_line, new_string (line-targeted)
9952
+
9953
+ Edits are applied sequentially. Failures do not stop remaining edits. Maximum 50 edits per call.
9954
+
9955
+ Parameters:
9956
+ - edits: (required) JSON array of edit objects. Place raw JSON between tags.
9957
+
9958
+ When to use multi_edit vs edit:
9959
+ - Use edit for a single change to one file
9960
+ - Use multi_edit when making 2+ related changes across files (e.g., rename a function and update all call sites)
9961
+ - Use multi_edit for coordinated multi-file refactoring where order matters
9962
+
9963
+ Examples:
9964
+
9965
+ Multiple text replacements across files:
9966
+ <multi_edit>
9967
+ <edits>[
9968
+ {"file_path": "src/main.js", "old_string": "return false;", "new_string": "return true;"},
9969
+ {"file_path": "src/config.js", "old_string": "debug: false", "new_string": "debug: true"}
9970
+ ]</edits>
9971
+ </multi_edit>
9972
+
9973
+ Mixed edit modes in one batch:
9974
+ <multi_edit>
9975
+ <edits>[
9976
+ {"file_path": "src/utils.js", "symbol": "oldHelper", "new_string": "function newHelper() { return 42; }"},
9977
+ {"file_path": "src/main.js", "old_string": "oldHelper()", "new_string": "newHelper()", "replace_all": true},
9978
+ {"file_path": "src/index.js", "start_line": "10", "end_line": "12", "new_string": "export { newHelper };"}
9979
+ ]</edits>
9980
+ </multi_edit>`;
9866
9981
  }
9867
9982
  });
9868
9983
 
@@ -10356,7 +10471,8 @@ function getValidParamsForTool(toolName) {
10356
10471
  task: taskSchema,
10357
10472
  attempt_completion: attemptCompletionSchema,
10358
10473
  edit: editSchema,
10359
- create: createSchema
10474
+ create: createSchema,
10475
+ multi_edit: multiEditSchema
10360
10476
  };
10361
10477
  const schema = schemaMap[toolName];
10362
10478
  if (!schema) {
@@ -10396,7 +10512,7 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
10396
10512
  const closeTag = `</${toolName}>`;
10397
10513
  const openIndex = earliestOpenIndex;
10398
10514
  let closeIndex;
10399
- if (toolName === "attempt_completion") {
10515
+ if (LAST_INDEX_TOOLS.has(toolName)) {
10400
10516
  closeIndex = xmlString.lastIndexOf(closeTag);
10401
10517
  if (closeIndex !== -1 && closeIndex <= openIndex + openTag.length) {
10402
10518
  closeIndex = -1;
@@ -10421,7 +10537,15 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
10421
10537
  if (paramOpenIndex === -1) {
10422
10538
  continue;
10423
10539
  }
10424
- let paramCloseIndex = innerContent.indexOf(paramCloseTag, paramOpenIndex + paramOpenTag.length);
10540
+ let paramCloseIndex;
10541
+ if (RAW_CONTENT_PARAMS.has(paramName)) {
10542
+ paramCloseIndex = innerContent.lastIndexOf(paramCloseTag);
10543
+ if (paramCloseIndex !== -1 && paramCloseIndex <= paramOpenIndex + paramOpenTag.length) {
10544
+ paramCloseIndex = -1;
10545
+ }
10546
+ } else {
10547
+ paramCloseIndex = innerContent.indexOf(paramCloseTag, paramOpenIndex + paramOpenTag.length);
10548
+ }
10425
10549
  if (paramCloseIndex === -1) {
10426
10550
  let nextTagIndex = innerContent.length;
10427
10551
  for (const nextParam of validParams) {
@@ -10433,18 +10557,26 @@ function parseXmlToolCall(xmlString, validTools = DEFAULT_VALID_TOOLS) {
10433
10557
  }
10434
10558
  paramCloseIndex = nextTagIndex;
10435
10559
  }
10436
- let paramValue = unescapeXmlEntities(innerContent.substring(
10560
+ const rawValue = innerContent.substring(
10437
10561
  paramOpenIndex + paramOpenTag.length,
10438
10562
  paramCloseIndex
10439
- ).trim());
10440
- if (paramValue.toLowerCase() === "true") {
10441
- paramValue = true;
10442
- } else if (paramValue.toLowerCase() === "false") {
10443
- paramValue = false;
10444
- } else if (!isNaN(paramValue) && paramValue.trim() !== "") {
10445
- const num = Number(paramValue);
10446
- if (Number.isFinite(num)) {
10447
- paramValue = num;
10563
+ );
10564
+ let paramValue;
10565
+ if (RAW_CONTENT_PARAMS.has(paramName)) {
10566
+ paramValue = unescapeXmlEntities(rawValue.replace(/^\n/, "").replace(/\n$/, ""));
10567
+ } else {
10568
+ paramValue = unescapeXmlEntities(rawValue.trim());
10569
+ }
10570
+ if (!RAW_CONTENT_PARAMS.has(paramName)) {
10571
+ if (paramValue.toLowerCase() === "true") {
10572
+ paramValue = true;
10573
+ } else if (paramValue.toLowerCase() === "false") {
10574
+ paramValue = false;
10575
+ } else if (!isNaN(paramValue) && paramValue.trim() !== "") {
10576
+ const num = Number(paramValue);
10577
+ if (Number.isFinite(num)) {
10578
+ paramValue = num;
10579
+ }
10448
10580
  }
10449
10581
  }
10450
10582
  params[paramName] = paramValue;
@@ -10487,6 +10619,7 @@ function detectUnrecognizedToolCall(xmlString, validTools) {
10487
10619
  "readImage",
10488
10620
  "edit",
10489
10621
  "create",
10622
+ "multi_edit",
10490
10623
  "delegate",
10491
10624
  "bash",
10492
10625
  "task",
@@ -10616,7 +10749,7 @@ function resolveTargetPath(target, cwd) {
10616
10749
  }
10617
10750
  return filePart + suffix;
10618
10751
  }
10619
- var searchSchema, searchAllSchema, querySchema, extractSchema, delegateSchema, listSkillsSchema, useSkillSchema, bashSchema, analyzeAllSchema, executePlanSchema, cleanupExecutePlanSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, delegateToolDefinition, attemptCompletionToolDefinition, analyzeAllToolDefinition, bashToolDefinition, googleSearchToolDefinition, urlContextToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, analyzeAllDescription, DEFAULT_VALID_TOOLS;
10752
+ var searchSchema, searchAllSchema, querySchema, extractSchema, delegateSchema, listSkillsSchema, useSkillSchema, bashSchema, analyzeAllSchema, executePlanSchema, cleanupExecutePlanSchema, attemptCompletionSchema, searchToolDefinition, queryToolDefinition, extractToolDefinition, delegateToolDefinition, attemptCompletionToolDefinition, analyzeAllToolDefinition, bashToolDefinition, googleSearchToolDefinition, urlContextToolDefinition, searchDescription, queryDescription, extractDescription, delegateDescription, analyzeAllDescription, DEFAULT_VALID_TOOLS, RAW_CONTENT_PARAMS, LAST_INDEX_TOOLS;
10620
10753
  var init_common = __esm({
10621
10754
  "src/tools/common.js"() {
10622
10755
  "use strict";
@@ -11034,6 +11167,8 @@ Capabilities:
11034
11167
  "task",
11035
11168
  "attempt_completion"
11036
11169
  ];
11170
+ RAW_CONTENT_PARAMS = /* @__PURE__ */ new Set(["content", "new_string", "old_string"]);
11171
+ LAST_INDEX_TOOLS = /* @__PURE__ */ new Set(["attempt_completion", "create", "edit"]);
11037
11172
  }
11038
11173
  });
11039
11174
 
@@ -23500,13 +23635,39 @@ var init_unescape = __esm({
23500
23635
  });
23501
23636
 
23502
23637
  // node_modules/minimatch/dist/esm/ast.js
23503
- var types2, isExtglobType, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
23638
+ var _a, types2, isExtglobType, isExtglobAST, adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal, startNoDot, addPatternStart, justDots, reSpecials, regExpEscape, qmark, star, starNoEmpty, AST;
23504
23639
  var init_ast = __esm({
23505
23640
  "node_modules/minimatch/dist/esm/ast.js"() {
23506
23641
  init_brace_expressions();
23507
23642
  init_unescape();
23508
23643
  types2 = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]);
23509
23644
  isExtglobType = (c) => types2.has(c);
23645
+ isExtglobAST = (c) => isExtglobType(c.type);
23646
+ adoptionMap = /* @__PURE__ */ new Map([
23647
+ ["!", ["@"]],
23648
+ ["?", ["?", "@"]],
23649
+ ["@", ["@"]],
23650
+ ["*", ["*", "+", "?", "@"]],
23651
+ ["+", ["+", "@"]]
23652
+ ]);
23653
+ adoptionWithSpaceMap = /* @__PURE__ */ new Map([
23654
+ ["!", ["?"]],
23655
+ ["@", ["?"]],
23656
+ ["+", ["?", "*"]]
23657
+ ]);
23658
+ adoptionAnyMap = /* @__PURE__ */ new Map([
23659
+ ["!", ["?", "@"]],
23660
+ ["?", ["?", "@"]],
23661
+ ["@", ["?", "@"]],
23662
+ ["*", ["*", "+", "?", "@"]],
23663
+ ["+", ["+", "@", "?", "*"]]
23664
+ ]);
23665
+ usurpMap = /* @__PURE__ */ new Map([
23666
+ ["!", /* @__PURE__ */ new Map([["!", "@"]])],
23667
+ ["?", /* @__PURE__ */ new Map([["*", "*"], ["+", "*"]])],
23668
+ ["@", /* @__PURE__ */ new Map([["!", "!"], ["?", "?"], ["@", "@"], ["*", "*"], ["+", "+"]])],
23669
+ ["+", /* @__PURE__ */ new Map([["?", "*"], ["*", "*"]])]
23670
+ ]);
23510
23671
  startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))";
23511
23672
  startNoDot = "(?!\\.)";
23512
23673
  addPatternStart = /* @__PURE__ */ new Set(["[", "."]);
@@ -23516,7 +23677,7 @@ var init_ast = __esm({
23516
23677
  qmark = "[^/]";
23517
23678
  star = qmark + "*?";
23518
23679
  starNoEmpty = qmark + "+?";
23519
- AST = class _AST {
23680
+ AST = class {
23520
23681
  type;
23521
23682
  #root;
23522
23683
  #hasMagic;
@@ -23596,7 +23757,7 @@ var init_ast = __esm({
23596
23757
  for (const p of parts) {
23597
23758
  if (p === "")
23598
23759
  continue;
23599
- if (typeof p !== "string" && !(p instanceof _AST && p.#parent === this)) {
23760
+ if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
23600
23761
  throw new Error("invalid part: " + p);
23601
23762
  }
23602
23763
  this.#parts.push(p);
@@ -23621,7 +23782,7 @@ var init_ast = __esm({
23621
23782
  const p = this.#parent;
23622
23783
  for (let i = 0; i < this.#parentIndex; i++) {
23623
23784
  const pp2 = p.#parts[i];
23624
- if (!(pp2 instanceof _AST && pp2.type === "!")) {
23785
+ if (!(pp2 instanceof _a && pp2.type === "!")) {
23625
23786
  return false;
23626
23787
  }
23627
23788
  }
@@ -23646,13 +23807,14 @@ var init_ast = __esm({
23646
23807
  this.push(part.clone(this));
23647
23808
  }
23648
23809
  clone(parent) {
23649
- const c = new _AST(this.type, parent);
23810
+ const c = new _a(this.type, parent);
23650
23811
  for (const p of this.#parts) {
23651
23812
  c.copyIn(p);
23652
23813
  }
23653
23814
  return c;
23654
23815
  }
23655
- static #parseAST(str, ast, pos, opt) {
23816
+ static #parseAST(str, ast, pos, opt, extDepth) {
23817
+ const maxDepth = opt.maxExtglobRecursion ?? 2;
23656
23818
  let escaping = false;
23657
23819
  let inBrace = false;
23658
23820
  let braceStart = -1;
@@ -23684,11 +23846,12 @@ var init_ast = __esm({
23684
23846
  acc2 += c;
23685
23847
  continue;
23686
23848
  }
23687
- if (!opt.noext && isExtglobType(c) && str.charAt(i2) === "(") {
23849
+ const doRecurse = !opt.noext && isExtglobType(c) && str.charAt(i2) === "(" && extDepth <= maxDepth;
23850
+ if (doRecurse) {
23688
23851
  ast.push(acc2);
23689
23852
  acc2 = "";
23690
- const ext2 = new _AST(c, ast);
23691
- i2 = _AST.#parseAST(str, ext2, i2, opt);
23853
+ const ext2 = new _a(c, ast);
23854
+ i2 = _a.#parseAST(str, ext2, i2, opt, extDepth + 1);
23692
23855
  ast.push(ext2);
23693
23856
  continue;
23694
23857
  }
@@ -23698,7 +23861,7 @@ var init_ast = __esm({
23698
23861
  return i2;
23699
23862
  }
23700
23863
  let i = pos + 1;
23701
- let part = new _AST(null, ast);
23864
+ let part = new _a(null, ast);
23702
23865
  const parts = [];
23703
23866
  let acc = "";
23704
23867
  while (i < str.length) {
@@ -23725,19 +23888,22 @@ var init_ast = __esm({
23725
23888
  acc += c;
23726
23889
  continue;
23727
23890
  }
23728
- if (isExtglobType(c) && str.charAt(i) === "(") {
23891
+ const doRecurse = isExtglobType(c) && str.charAt(i) === "(" && /* c8 ignore start - the maxDepth is sufficient here */
23892
+ (extDepth <= maxDepth || ast && ast.#canAdoptType(c));
23893
+ if (doRecurse) {
23894
+ const depthAdd = ast && ast.#canAdoptType(c) ? 0 : 1;
23729
23895
  part.push(acc);
23730
23896
  acc = "";
23731
- const ext2 = new _AST(c, part);
23897
+ const ext2 = new _a(c, part);
23732
23898
  part.push(ext2);
23733
- i = _AST.#parseAST(str, ext2, i, opt);
23899
+ i = _a.#parseAST(str, ext2, i, opt, extDepth + depthAdd);
23734
23900
  continue;
23735
23901
  }
23736
23902
  if (c === "|") {
23737
23903
  part.push(acc);
23738
23904
  acc = "";
23739
23905
  parts.push(part);
23740
- part = new _AST(null, ast);
23906
+ part = new _a(null, ast);
23741
23907
  continue;
23742
23908
  }
23743
23909
  if (c === ")") {
@@ -23756,9 +23922,101 @@ var init_ast = __esm({
23756
23922
  ast.#parts = [str.substring(pos - 1)];
23757
23923
  return i;
23758
23924
  }
23925
+ #canAdoptWithSpace(child) {
23926
+ return this.#canAdopt(child, adoptionWithSpaceMap);
23927
+ }
23928
+ #canAdopt(child, map2 = adoptionMap) {
23929
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
23930
+ return false;
23931
+ }
23932
+ const gc = child.#parts[0];
23933
+ if (!gc || typeof gc !== "object" || gc.type === null) {
23934
+ return false;
23935
+ }
23936
+ return this.#canAdoptType(gc.type, map2);
23937
+ }
23938
+ #canAdoptType(c, map2 = adoptionAnyMap) {
23939
+ return !!map2.get(this.type)?.includes(c);
23940
+ }
23941
+ #adoptWithSpace(child, index) {
23942
+ const gc = child.#parts[0];
23943
+ const blank = new _a(null, gc, this.options);
23944
+ blank.#parts.push("");
23945
+ gc.push(blank);
23946
+ this.#adopt(child, index);
23947
+ }
23948
+ #adopt(child, index) {
23949
+ const gc = child.#parts[0];
23950
+ this.#parts.splice(index, 1, ...gc.#parts);
23951
+ for (const p of gc.#parts) {
23952
+ if (typeof p === "object")
23953
+ p.#parent = this;
23954
+ }
23955
+ this.#toString = void 0;
23956
+ }
23957
+ #canUsurpType(c) {
23958
+ const m = usurpMap.get(this.type);
23959
+ return !!m?.has(c);
23960
+ }
23961
+ #canUsurp(child) {
23962
+ if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
23963
+ return false;
23964
+ }
23965
+ const gc = child.#parts[0];
23966
+ if (!gc || typeof gc !== "object" || gc.type === null) {
23967
+ return false;
23968
+ }
23969
+ return this.#canUsurpType(gc.type);
23970
+ }
23971
+ #usurp(child) {
23972
+ const m = usurpMap.get(this.type);
23973
+ const gc = child.#parts[0];
23974
+ const nt = m?.get(gc.type);
23975
+ if (!nt)
23976
+ return false;
23977
+ this.#parts = gc.#parts;
23978
+ for (const p of this.#parts) {
23979
+ if (typeof p === "object")
23980
+ p.#parent = this;
23981
+ }
23982
+ this.type = nt;
23983
+ this.#toString = void 0;
23984
+ this.#emptyExt = false;
23985
+ }
23986
+ #flatten() {
23987
+ if (!isExtglobAST(this)) {
23988
+ for (const p of this.#parts) {
23989
+ if (typeof p === "object")
23990
+ p.#flatten();
23991
+ }
23992
+ } else {
23993
+ let iterations = 0;
23994
+ let done = false;
23995
+ do {
23996
+ done = true;
23997
+ for (let i = 0; i < this.#parts.length; i++) {
23998
+ const c = this.#parts[i];
23999
+ if (typeof c === "object") {
24000
+ c.#flatten();
24001
+ if (this.#canAdopt(c)) {
24002
+ done = false;
24003
+ this.#adopt(c, i);
24004
+ } else if (this.#canAdoptWithSpace(c)) {
24005
+ done = false;
24006
+ this.#adoptWithSpace(c, i);
24007
+ } else if (this.#canUsurp(c)) {
24008
+ done = false;
24009
+ this.#usurp(c);
24010
+ }
24011
+ }
24012
+ }
24013
+ } while (!done && ++iterations < 10);
24014
+ }
24015
+ this.#toString = void 0;
24016
+ }
23759
24017
  static fromGlob(pattern, options = {}) {
23760
- const ast = new _AST(null, void 0, options);
23761
- _AST.#parseAST(pattern, ast, 0, options);
24018
+ const ast = new _a(null, void 0, options);
24019
+ _a.#parseAST(pattern, ast, 0, options, 0);
23762
24020
  return ast;
23763
24021
  }
23764
24022
  // returns the regular expression if there's magic, or the unescaped
@@ -23852,12 +24110,14 @@ var init_ast = __esm({
23852
24110
  // or start or whatever) and prepend ^ or / at the Regexp construction.
23853
24111
  toRegExpSource(allowDot) {
23854
24112
  const dot = allowDot ?? !!this.#options.dot;
23855
- if (this.#root === this)
24113
+ if (this.#root === this) {
24114
+ this.#flatten();
23856
24115
  this.#fillNegs();
23857
- if (!this.type) {
24116
+ }
24117
+ if (!isExtglobAST(this)) {
23858
24118
  const noEmpty = this.isStart() && this.isEnd();
23859
24119
  const src = this.#parts.map((p) => {
23860
- const [re, _, hasMagic2, uflag] = typeof p === "string" ? _AST.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
24120
+ const [re, _, hasMagic2, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
23861
24121
  this.#hasMagic = this.#hasMagic || hasMagic2;
23862
24122
  this.#uflag = this.#uflag || uflag;
23863
24123
  return re;
@@ -23896,9 +24156,10 @@ var init_ast = __esm({
23896
24156
  let body = this.#partsToRegExp(dot);
23897
24157
  if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
23898
24158
  const s = this.toString();
23899
- this.#parts = [s];
23900
- this.type = null;
23901
- this.#hasMagic = void 0;
24159
+ const me = this;
24160
+ me.#parts = [s];
24161
+ me.type = null;
24162
+ me.#hasMagic = void 0;
23902
24163
  return [s, unescape2(this.toString()), false, false];
23903
24164
  }
23904
24165
  let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
@@ -23987,6 +24248,7 @@ var init_ast = __esm({
23987
24248
  return [re, unescape2(glob2), !!hasMagic2, uflag];
23988
24249
  }
23989
24250
  };
24251
+ _a = AST;
23990
24252
  }
23991
24253
  });
23992
24254
 
@@ -24160,11 +24422,13 @@ var init_esm3 = __esm({
24160
24422
  isWindows;
24161
24423
  platform;
24162
24424
  windowsNoMagicRoot;
24425
+ maxGlobstarRecursion;
24163
24426
  regexp;
24164
24427
  constructor(pattern, options = {}) {
24165
24428
  assertValidPattern(pattern);
24166
24429
  options = options || {};
24167
24430
  this.options = options;
24431
+ this.maxGlobstarRecursion = options.maxGlobstarRecursion ?? 200;
24168
24432
  this.pattern = pattern;
24169
24433
  this.platform = options.platform || defaultPlatform;
24170
24434
  this.isWindows = this.platform === "win32";
@@ -24497,7 +24761,8 @@ var init_esm3 = __esm({
24497
24761
  // out of pattern, then that's fine, as long as all
24498
24762
  // the parts match.
24499
24763
  matchOne(file, pattern, partial = false) {
24500
- const options = this.options;
24764
+ let fileStartIndex = 0;
24765
+ let patternStartIndex = 0;
24501
24766
  if (this.isWindows) {
24502
24767
  const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
24503
24768
  const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
@@ -24506,14 +24771,14 @@ var init_esm3 = __esm({
24506
24771
  const fdi = fileUNC ? 3 : fileDrive ? 0 : void 0;
24507
24772
  const pdi = patternUNC ? 3 : patternDrive ? 0 : void 0;
24508
24773
  if (typeof fdi === "number" && typeof pdi === "number") {
24509
- const [fd, pd] = [file[fdi], pattern[pdi]];
24774
+ const [fd, pd] = [
24775
+ file[fdi],
24776
+ pattern[pdi]
24777
+ ];
24510
24778
  if (fd.toLowerCase() === pd.toLowerCase()) {
24511
24779
  pattern[pdi] = fd;
24512
- if (pdi > fdi) {
24513
- pattern = pattern.slice(pdi);
24514
- } else if (fdi > pdi) {
24515
- file = file.slice(fdi);
24516
- }
24780
+ patternStartIndex = pdi;
24781
+ fileStartIndex = fdi;
24517
24782
  }
24518
24783
  }
24519
24784
  }
@@ -24521,51 +24786,114 @@ var init_esm3 = __esm({
24521
24786
  if (optimizationLevel >= 2) {
24522
24787
  file = this.levelTwoFileOptimize(file);
24523
24788
  }
24524
- this.debug("matchOne", this, { file, pattern });
24525
- this.debug("matchOne", file.length, pattern.length);
24526
- for (var fi = 0, pi = 0, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
24527
- this.debug("matchOne loop");
24528
- var p = pattern[pi];
24529
- var f = file[fi];
24530
- this.debug(pattern, p, f);
24531
- if (p === false) {
24789
+ if (pattern.includes(GLOBSTAR)) {
24790
+ return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
24791
+ }
24792
+ return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
24793
+ }
24794
+ #matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
24795
+ const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
24796
+ const lastgs = pattern.lastIndexOf(GLOBSTAR);
24797
+ const [head2, body, tail] = [
24798
+ pattern.slice(patternIndex, firstgs),
24799
+ pattern.slice(firstgs + 1, lastgs),
24800
+ pattern.slice(lastgs + 1)
24801
+ ];
24802
+ if (head2.length) {
24803
+ const fileHead = file.slice(fileIndex, fileIndex + head2.length);
24804
+ if (!this.#matchOne(fileHead, head2, partial, 0, 0))
24532
24805
  return false;
24533
- }
24534
- if (p === GLOBSTAR) {
24535
- this.debug("GLOBSTAR", [pattern, p, f]);
24536
- var fr = fi;
24537
- var pr = pi + 1;
24538
- if (pr === pl) {
24539
- this.debug("** at the end");
24540
- for (; fi < fl; fi++) {
24541
- if (file[fi] === "." || file[fi] === ".." || !options.dot && file[fi].charAt(0) === ".")
24542
- return false;
24543
- }
24544
- return true;
24806
+ fileIndex += head2.length;
24807
+ }
24808
+ let fileTailMatch = 0;
24809
+ if (tail.length) {
24810
+ if (tail.length + fileIndex > file.length)
24811
+ return false;
24812
+ let tailStart = file.length - tail.length;
24813
+ if (this.#matchOne(file, tail, partial, tailStart, 0)) {
24814
+ fileTailMatch = tail.length;
24815
+ } else {
24816
+ if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
24817
+ return false;
24545
24818
  }
24546
- while (fr < fl) {
24547
- var swallowee = file[fr];
24548
- this.debug("\nglobstar while", file, fr, pattern, pr, swallowee);
24549
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
24550
- this.debug("globstar found match!", fr, fl, swallowee);
24551
- return true;
24552
- } else {
24553
- if (swallowee === "." || swallowee === ".." || !options.dot && swallowee.charAt(0) === ".") {
24554
- this.debug("dot detected!", file, fr, pattern, pr);
24555
- break;
24556
- }
24557
- this.debug("globstar swallow a segment, and continue");
24558
- fr++;
24559
- }
24819
+ tailStart--;
24820
+ if (!this.#matchOne(file, tail, partial, tailStart, 0))
24821
+ return false;
24822
+ fileTailMatch = tail.length + 1;
24823
+ }
24824
+ }
24825
+ if (!body.length) {
24826
+ let sawSome = !!fileTailMatch;
24827
+ for (let i2 = fileIndex; i2 < file.length - fileTailMatch; i2++) {
24828
+ const f = String(file[i2]);
24829
+ sawSome = true;
24830
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24831
+ return false;
24560
24832
  }
24561
- if (partial) {
24562
- this.debug("\n>>> no match, partial?", file, fr, pattern, pr);
24563
- if (fr === fl) {
24564
- return true;
24565
- }
24833
+ }
24834
+ return sawSome;
24835
+ }
24836
+ const bodySegments = [[[], 0]];
24837
+ let currentBody = bodySegments[0];
24838
+ let nonGsParts = 0;
24839
+ const nonGsPartsSums = [0];
24840
+ for (const b of body) {
24841
+ if (b === GLOBSTAR) {
24842
+ nonGsPartsSums.push(nonGsParts);
24843
+ currentBody = [[], 0];
24844
+ bodySegments.push(currentBody);
24845
+ } else {
24846
+ currentBody[0].push(b);
24847
+ nonGsParts++;
24848
+ }
24849
+ }
24850
+ let i = bodySegments.length - 1;
24851
+ const fileLength = file.length - fileTailMatch;
24852
+ for (const b of bodySegments) {
24853
+ b[1] = fileLength - (nonGsPartsSums[i--] + b[0].length);
24854
+ }
24855
+ return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
24856
+ }
24857
+ #matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
24858
+ const bs = bodySegments[bodyIndex];
24859
+ if (!bs) {
24860
+ for (let i = fileIndex; i < file.length; i++) {
24861
+ sawTail = true;
24862
+ const f = file[i];
24863
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24864
+ return false;
24566
24865
  }
24866
+ }
24867
+ return sawTail;
24868
+ }
24869
+ const [body, after] = bs;
24870
+ while (fileIndex <= after) {
24871
+ const m = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
24872
+ if (m && globStarDepth < this.maxGlobstarRecursion) {
24873
+ const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
24874
+ if (sub !== false)
24875
+ return sub;
24876
+ }
24877
+ const f = file[fileIndex];
24878
+ if (f === "." || f === ".." || !this.options.dot && f.startsWith(".")) {
24567
24879
  return false;
24568
24880
  }
24881
+ fileIndex++;
24882
+ }
24883
+ return null;
24884
+ }
24885
+ #matchOne(file, pattern, partial, fileIndex, patternIndex) {
24886
+ let fi;
24887
+ let pi;
24888
+ let pl;
24889
+ let fl;
24890
+ for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length; fi < fl && pi < pl; fi++, pi++) {
24891
+ this.debug("matchOne loop");
24892
+ let p = pattern[pi];
24893
+ let f = file[fi];
24894
+ this.debug(pattern, p, f);
24895
+ if (p === false || p === GLOBSTAR)
24896
+ return false;
24569
24897
  let hit;
24570
24898
  if (typeof p === "string") {
24571
24899
  hit = f === p;
@@ -31843,6 +32171,13 @@ function createWrappedTools(baseTools) {
31843
32171
  baseTools.createTool.execute
31844
32172
  );
31845
32173
  }
32174
+ if (baseTools.multiEditTool) {
32175
+ wrappedTools.multiEditToolInstance = wrapToolWithEmitter(
32176
+ baseTools.multiEditTool,
32177
+ "multi_edit",
32178
+ baseTools.multiEditTool.execute
32179
+ );
32180
+ }
31846
32181
  return wrappedTools;
31847
32182
  }
31848
32183
  var toolCallEmitter, activeToolExecutions, wrapToolWithEmitter, listFilesTool, searchFilesTool, listFilesToolInstance, searchFilesToolInstance;
@@ -32761,6 +33096,9 @@ function createTools(configOptions) {
32761
33096
  if (configOptions.allowEdit && isToolAllowed("create")) {
32762
33097
  tools2.createTool = createTool(configOptions);
32763
33098
  }
33099
+ if (configOptions.allowEdit && isToolAllowed("multi_edit")) {
33100
+ tools2.multiEditTool = multiEditTool(configOptions);
33101
+ }
32764
33102
  return tools2;
32765
33103
  }
32766
33104
  function parseXmlToolCallWithThinking(xmlString, validTools) {
@@ -42255,8 +42593,8 @@ var init_llk_lookahead = __esm({
42255
42593
  init_lookahead();
42256
42594
  LLkLookaheadStrategy = class {
42257
42595
  constructor(options) {
42258
- var _a;
42259
- this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
42596
+ var _a2;
42597
+ this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : DEFAULT_PARSER_CONFIG.maxLookahead;
42260
42598
  }
42261
42599
  validate(options) {
42262
42600
  const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
@@ -44125,8 +44463,8 @@ var init_parser = __esm({
44125
44463
  });
44126
44464
  }
44127
44465
  this.TRACE_INIT("ComputeLookaheadFunctions", () => {
44128
- var _a, _b;
44129
- (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
44466
+ var _a2, _b;
44467
+ (_b = (_a2 = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a2, {
44130
44468
  rules: values_default(this.gastProductionsCache)
44131
44469
  });
44132
44470
  this.preComputeLookaheadFunctions(values_default(this.gastProductionsCache));
@@ -62080,7 +62418,7 @@ function toGraph(model) {
62080
62418
  return { graph: { nodes, edges, subgraphs, direction: model.direction }, laneGroups };
62081
62419
  }
62082
62420
  function renderState(model) {
62083
- var _a;
62421
+ var _a2;
62084
62422
  const { graph, laneGroups } = toGraph(model);
62085
62423
  const layout = new DagreLayoutEngine().layout(graph);
62086
62424
  let svg = new SVGRenderer().render(layout);
@@ -62095,7 +62433,7 @@ function renderState(model) {
62095
62433
  const members = lg.nodes.map((id) => byId[id]).filter(Boolean);
62096
62434
  if (!members.length)
62097
62435
  continue;
62098
- (groupByParent[_a = lg.parentId] || (groupByParent[_a] = [])).push({ id: lg.id, nodes: members });
62436
+ (groupByParent[_a2 = lg.parentId] || (groupByParent[_a2] = [])).push({ id: lg.id, nodes: members });
62099
62437
  }
62100
62438
  const laneIndex = (id) => {
62101
62439
  const m = /(.*)__lane(\d+)/.exec(id);
@@ -63183,12 +63521,12 @@ var require_code = __commonJS({
63183
63521
  return item === "" || item === '""';
63184
63522
  }
63185
63523
  get str() {
63186
- var _a;
63187
- return (_a = this._str) !== null && _a !== void 0 ? _a : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
63524
+ var _a2;
63525
+ return (_a2 = this._str) !== null && _a2 !== void 0 ? _a2 : this._str = this._items.reduce((s, c) => `${s}${c}`, "");
63188
63526
  }
63189
63527
  get names() {
63190
- var _a;
63191
- return (_a = this._names) !== null && _a !== void 0 ? _a : this._names = this._items.reduce((names, c) => {
63528
+ var _a2;
63529
+ return (_a2 = this._names) !== null && _a2 !== void 0 ? _a2 : this._names = this._items.reduce((names, c) => {
63192
63530
  if (c instanceof Name)
63193
63531
  names[c.str] = (names[c.str] || 0) + 1;
63194
63532
  return names;
@@ -63334,8 +63672,8 @@ var require_scope = __commonJS({
63334
63672
  return `${prefix}${ng.index++}`;
63335
63673
  }
63336
63674
  _nameGroup(prefix) {
63337
- var _a, _b;
63338
- if (((_b = (_a = this._parent) === null || _a === void 0 ? void 0 : _a._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
63675
+ var _a2, _b;
63676
+ if (((_b = (_a2 = this._parent) === null || _a2 === void 0 ? void 0 : _a2._prefixes) === null || _b === void 0 ? void 0 : _b.has(prefix)) || this._prefixes && !this._prefixes.has(prefix)) {
63339
63677
  throw new Error(`CodeGen: prefix "${prefix}" is not allowed in this scope`);
63340
63678
  }
63341
63679
  return this._names[prefix] = { prefix, index: 0 };
@@ -63368,12 +63706,12 @@ var require_scope = __commonJS({
63368
63706
  return new ValueScopeName(prefix, this._newName(prefix));
63369
63707
  }
63370
63708
  value(nameOrPrefix, value) {
63371
- var _a;
63709
+ var _a2;
63372
63710
  if (value.ref === void 0)
63373
63711
  throw new Error("CodeGen: ref must be passed in value");
63374
63712
  const name = this.toName(nameOrPrefix);
63375
63713
  const { prefix } = name;
63376
- const valueKey = (_a = value.key) !== null && _a !== void 0 ? _a : value.ref;
63714
+ const valueKey = (_a2 = value.key) !== null && _a2 !== void 0 ? _a2 : value.ref;
63377
63715
  let vs = this._values[prefix];
63378
63716
  if (vs) {
63379
63717
  const _name = vs.get(valueKey);
@@ -63691,8 +64029,8 @@ var require_codegen = __commonJS({
63691
64029
  return this;
63692
64030
  }
63693
64031
  optimizeNames(names, constants) {
63694
- var _a;
63695
- this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
64032
+ var _a2;
64033
+ this.else = (_a2 = this.else) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
63696
64034
  if (!(super.optimizeNames(names, constants) || this.else))
63697
64035
  return;
63698
64036
  this.condition = optimizeExpr(this.condition, names, constants);
@@ -63796,16 +64134,16 @@ var require_codegen = __commonJS({
63796
64134
  return code;
63797
64135
  }
63798
64136
  optimizeNodes() {
63799
- var _a, _b;
64137
+ var _a2, _b;
63800
64138
  super.optimizeNodes();
63801
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNodes();
64139
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNodes();
63802
64140
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
63803
64141
  return this;
63804
64142
  }
63805
64143
  optimizeNames(names, constants) {
63806
- var _a, _b;
64144
+ var _a2, _b;
63807
64145
  super.optimizeNames(names, constants);
63808
- (_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants);
64146
+ (_a2 = this.catch) === null || _a2 === void 0 ? void 0 : _a2.optimizeNames(names, constants);
63809
64147
  (_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants);
63810
64148
  return this;
63811
64149
  }
@@ -64585,8 +64923,8 @@ var require_applicability = __commonJS({
64585
64923
  }
64586
64924
  exports2.shouldUseGroup = shouldUseGroup;
64587
64925
  function shouldUseRule(schema, rule) {
64588
- var _a;
64589
- return schema[rule.keyword] !== void 0 || ((_a = rule.definition.implements) === null || _a === void 0 ? void 0 : _a.some((kwd) => schema[kwd] !== void 0));
64926
+ var _a2;
64927
+ return schema[rule.keyword] !== void 0 || ((_a2 = rule.definition.implements) === null || _a2 === void 0 ? void 0 : _a2.some((kwd) => schema[kwd] !== void 0));
64590
64928
  }
64591
64929
  exports2.shouldUseRule = shouldUseRule;
64592
64930
  }
@@ -64974,14 +65312,14 @@ var require_keyword = __commonJS({
64974
65312
  }
64975
65313
  exports2.macroKeywordCode = macroKeywordCode;
64976
65314
  function funcKeywordCode(cxt, def) {
64977
- var _a;
65315
+ var _a2;
64978
65316
  const { gen, keyword, schema, parentSchema, $data, it } = cxt;
64979
65317
  checkAsyncKeyword(it, def);
64980
65318
  const validate2 = !$data && def.compile ? def.compile.call(it.self, schema, parentSchema, it) : def.validate;
64981
65319
  const validateRef = useKeyword(gen, keyword, validate2);
64982
65320
  const valid = gen.let("valid");
64983
65321
  cxt.block$data(valid, validateKeyword);
64984
- cxt.ok((_a = def.valid) !== null && _a !== void 0 ? _a : valid);
65322
+ cxt.ok((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid);
64985
65323
  function validateKeyword() {
64986
65324
  if (def.errors === false) {
64987
65325
  assignValid();
@@ -65012,8 +65350,8 @@ var require_keyword = __commonJS({
65012
65350
  gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
65013
65351
  }
65014
65352
  function reportErrs(errors) {
65015
- var _a2;
65016
- gen.if((0, codegen_1.not)((_a2 = def.valid) !== null && _a2 !== void 0 ? _a2 : valid), errors);
65353
+ var _a3;
65354
+ gen.if((0, codegen_1.not)((_a3 = def.valid) !== null && _a3 !== void 0 ? _a3 : valid), errors);
65017
65355
  }
65018
65356
  }
65019
65357
  exports2.funcKeywordCode = funcKeywordCode;
@@ -65981,7 +66319,7 @@ var require_compile = __commonJS({
65981
66319
  var validate_1 = require_validate();
65982
66320
  var SchemaEnv = class {
65983
66321
  constructor(env) {
65984
- var _a;
66322
+ var _a2;
65985
66323
  this.refs = {};
65986
66324
  this.dynamicAnchors = {};
65987
66325
  let schema;
@@ -65990,7 +66328,7 @@ var require_compile = __commonJS({
65990
66328
  this.schema = env.schema;
65991
66329
  this.schemaId = env.schemaId;
65992
66330
  this.root = env.root || this;
65993
- this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
66331
+ this.baseId = (_a2 = env.baseId) !== null && _a2 !== void 0 ? _a2 : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
65994
66332
  this.schemaPath = env.schemaPath;
65995
66333
  this.localRefs = env.localRefs;
65996
66334
  this.meta = env.meta;
@@ -66086,14 +66424,14 @@ var require_compile = __commonJS({
66086
66424
  }
66087
66425
  exports2.compileSchema = compileSchema;
66088
66426
  function resolveRef(root2, baseId, ref2) {
66089
- var _a;
66427
+ var _a2;
66090
66428
  ref2 = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, ref2);
66091
66429
  const schOrFunc = root2.refs[ref2];
66092
66430
  if (schOrFunc)
66093
66431
  return schOrFunc;
66094
66432
  let _sch = resolve9.call(this, root2, ref2);
66095
66433
  if (_sch === void 0) {
66096
- const schema = (_a = root2.localRefs) === null || _a === void 0 ? void 0 : _a[ref2];
66434
+ const schema = (_a2 = root2.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref2];
66097
66435
  const { schemaId } = this.opts;
66098
66436
  if (schema)
66099
66437
  _sch = new SchemaEnv({ schema, schemaId, root: root2, baseId });
@@ -66162,8 +66500,8 @@ var require_compile = __commonJS({
66162
66500
  "definitions"
66163
66501
  ]);
66164
66502
  function getJsonPointer(parsedRef, { baseId, schema, root: root2 }) {
66165
- var _a;
66166
- if (((_a = parsedRef.fragment) === null || _a === void 0 ? void 0 : _a[0]) !== "/")
66503
+ var _a2;
66504
+ if (((_a2 = parsedRef.fragment) === null || _a2 === void 0 ? void 0 : _a2[0]) !== "/")
66167
66505
  return;
66168
66506
  for (const part of parsedRef.fragment.slice(1).split("/")) {
66169
66507
  if (typeof schema === "boolean")
@@ -67024,9 +67362,9 @@ var require_core = __commonJS({
67024
67362
  };
67025
67363
  var MAX_EXPRESSION = 200;
67026
67364
  function requiredOptions(o) {
67027
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
67365
+ var _a2, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
67028
67366
  const s = o.strict;
67029
- const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
67367
+ const _optz = (_a2 = o.code) === null || _a2 === void 0 ? void 0 : _a2.optimize;
67030
67368
  const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
67031
67369
  const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
67032
67370
  const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
@@ -67500,7 +67838,7 @@ var require_core = __commonJS({
67500
67838
  }
67501
67839
  }
67502
67840
  function addRule(keyword, definition, dataType) {
67503
- var _a;
67841
+ var _a2;
67504
67842
  const post = definition === null || definition === void 0 ? void 0 : definition.post;
67505
67843
  if (dataType && post)
67506
67844
  throw new Error('keyword with "post" flag cannot have "type"');
@@ -67526,7 +67864,7 @@ var require_core = __commonJS({
67526
67864
  else
67527
67865
  ruleGroup.rules.push(rule);
67528
67866
  RULES.all[keyword] = rule;
67529
- (_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
67867
+ (_a2 = definition.implements) === null || _a2 === void 0 ? void 0 : _a2.forEach((kwd) => this.addKeyword(kwd));
67530
67868
  }
67531
67869
  function addBeforeRule(ruleGroup, rule, before) {
67532
67870
  const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
@@ -67660,10 +67998,10 @@ var require_ref = __commonJS({
67660
67998
  gen.assign(names_1.default.errors, (0, codegen_1._)`${names_1.default.vErrors}.length`);
67661
67999
  }
67662
68000
  function addEvaluatedFrom(source) {
67663
- var _a;
68001
+ var _a2;
67664
68002
  if (!it.opts.unevaluated)
67665
68003
  return;
67666
- const schEvaluated = (_a = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a === void 0 ? void 0 : _a.evaluated;
68004
+ const schEvaluated = (_a2 = sch === null || sch === void 0 ? void 0 : sch.validate) === null || _a2 === void 0 ? void 0 : _a2.evaluated;
67667
68005
  if (it.props !== true) {
67668
68006
  if (schEvaluated && !schEvaluated.dynamicProps) {
67669
68007
  if (schEvaluated.props !== void 0) {
@@ -69314,7 +69652,7 @@ var require_discriminator = __commonJS({
69314
69652
  return _valid;
69315
69653
  }
69316
69654
  function getMapping() {
69317
- var _a;
69655
+ var _a2;
69318
69656
  const oneOfMapping = {};
69319
69657
  const topRequired = hasRequired(parentSchema);
69320
69658
  let tagRequired = true;
@@ -69328,7 +69666,7 @@ var require_discriminator = __commonJS({
69328
69666
  if (sch === void 0)
69329
69667
  throw new ref_error_1.default(it.opts.uriResolver, it.baseId, ref2);
69330
69668
  }
69331
- const propSch = (_a = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a === void 0 ? void 0 : _a[tagName];
69669
+ const propSch = (_a2 = sch === null || sch === void 0 ? void 0 : sch.properties) === null || _a2 === void 0 ? void 0 : _a2[tagName];
69332
69670
  if (typeof propSch != "object") {
69333
69671
  throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${tagName}"`);
69334
69672
  }
@@ -71431,20 +71769,52 @@ When reviewing code:
71431
71769
  - Evaluate code style and consistency
71432
71770
  - Provide specific, actionable suggestions with code examples where appropriate`,
71433
71771
  "code-review-template": `You are going to perform code review according to provided user rules. Ensure to review only code provided in diff and latest commit, if provided. However you still need to fully understand how modified code works, and read dependencies if something is not clear.`,
71434
- "engineer": `You are senior engineer focused on software architecture and design.
71435
- Before jumping on the task you first, in details analyse user request, and try to provide elegant and concise solution.
71436
- If solution is clear, you can jump to implementation right away, if not, you can ask user a clarification question, by calling attempt_completion tool, with required details.
71772
+ "engineer": `You are a senior engineer focused on software architecture and design.
71773
+ Before jumping on the task you first analyse the user request in detail, and try to provide an elegant and concise solution.
71774
+ If the solution is clear, you can jump to implementation right away. If not, ask the user a clarification question by calling the attempt_completion tool with the required details.
71437
71775
 
71438
- Before jumping to implementation:
71776
+ # Tone and Style
71777
+ - Be concise and direct. Explain your approach briefly before implementing, then let the code speak for itself.
71778
+ - Do not add unnecessary preamble or postamble. Skip "Here is what I will do" or "Here is a summary of changes" unless the user asks.
71779
+ - Do not add code comments unless the logic is genuinely complex and non-obvious.
71780
+
71781
+ # Before Implementation
71439
71782
  - Focus on high-level design patterns and system organization
71440
71783
  - Identify architectural patterns and component relationships
71441
71784
  - Evaluate system structure and suggest architectural improvements
71442
- - Focus on backward compatibility.
71785
+ - Focus on backward compatibility
71443
71786
  - Consider scalability, maintainability, and extensibility in your analysis
71444
71787
 
71445
- During the implementation:
71446
- - Avoid implementing special cases
71447
- - Do not forget to add the tests`,
71788
+ # Following Conventions
71789
+ - NEVER assume a library or dependency is available. Before using any library, check the project's dependency file (package.json, Cargo.toml, go.mod, requirements.txt, etc.) to confirm it exists in the project.
71790
+ - Before writing new code, look at neighboring files and existing implementations to understand the project's code style, naming conventions, and patterns. Mimic them.
71791
+ - Check imports and existing utilities before creating new helpers \u2014 the project may already have what you need.
71792
+
71793
+ # Task Planning
71794
+ - If the task tool is available, use it to break complex work into milestones before starting implementation.
71795
+ - Stay flexible \u2014 if your understanding changes mid-task, add, remove, or reorganize tasks as needed. The plan should serve you, not constrain you.
71796
+
71797
+ # During Implementation
71798
+ - Always create a new branch before making changes to the codebase.
71799
+ - Fix problems at the root cause, not with surface-level patches. Prefer general solutions over special cases.
71800
+ - Avoid implementing special cases when a general approach works
71801
+ - Never expose secrets, API keys, or credentials in generated code. Never log sensitive information.
71802
+ - Do not surprise the user with unrequested changes. Do what was asked, including reasonable follow-up actions, but do not refactor surrounding code or add features that were not requested.
71803
+ - After every significant change, verify the project still builds and passes linting. Do not wait until the end to discover breakage.
71804
+
71805
+ # After Implementation
71806
+ - Always run the project's tests before considering the task complete. If tests fail, fix them.
71807
+ - Run lint and typecheck commands if known for the project.
71808
+ - If a build, lint, or test fails, fix the issue before finishing.
71809
+ - When the task is done, respond to the user with a concise summary of what was implemented, what files were changed, and any relevant details. Include links (e.g. pull request URL) so the user has everything they need.
71810
+
71811
+ # GitHub Integration
71812
+ - Use the \`gh\` CLI for all GitHub operations: issues, pull requests, checks, releases.
71813
+ - To create a pull request: commit your changes, push the branch, then use \`gh pr create --title "..." --body "..."\`.
71814
+ - To view issues or PRs: \`gh issue view <number>\`, \`gh pr view <number>\`.
71815
+ - If given a GitHub URL, use \`gh\` to fetch the relevant information rather than guessing.
71816
+ - Always return the pull request URL to the user after creating one.
71817
+ - When checking GitHub Actions, only read logs of failed jobs \u2014 do not waste time on successful ones. Use \`gh run view <run-id> --log-failed\` to fetch only the relevant output.`,
71448
71818
  "support": `You are ProbeChat Support, a specialized AI assistant focused on helping developers troubleshoot issues and solve problems. Your primary function is to help users diagnose errors, understand unexpected behaviors, and find solutions using the provided code analysis tools.
71449
71819
 
71450
71820
  When troubleshooting:
@@ -83227,6 +83597,9 @@ var init_ProbeAgent = __esm({
83227
83597
  if (wrappedTools.createToolInstance && isToolAllowed("create")) {
83228
83598
  this.toolImplementations.create = wrappedTools.createToolInstance;
83229
83599
  }
83600
+ if (wrappedTools.multiEditToolInstance && isToolAllowed("multi_edit")) {
83601
+ this.toolImplementations.multi_edit = wrappedTools.multiEditToolInstance;
83602
+ }
83230
83603
  }
83231
83604
  this.wrappedTools = wrappedTools;
83232
83605
  if (this.debug) {
@@ -84516,6 +84889,10 @@ Workspace: ${this.allowedFolders.join(", ")}`;
84516
84889
  }
84517
84890
  if (this.allowEdit && isToolAllowed("create")) {
84518
84891
  toolDefinitions += `${createToolDefinition}
84892
+ `;
84893
+ }
84894
+ if (this.allowEdit && isToolAllowed("multi_edit")) {
84895
+ toolDefinitions += `${multiEditToolDefinition}
84519
84896
  `;
84520
84897
  }
84521
84898
  if (this.enableBash && isToolAllowed("bash")) {
@@ -84612,6 +84989,9 @@ The configuration is loaded from src/config.js lines 15-25 which contains the da
84612
84989
  if (this.allowEdit && isToolAllowed("create")) {
84613
84990
  availableToolsList += "- create: Create new files with specified content.\n";
84614
84991
  }
84992
+ if (this.allowEdit && isToolAllowed("multi_edit")) {
84993
+ availableToolsList += "- multi_edit: Apply multiple file edits in one call using a JSON array of operations.\n";
84994
+ }
84615
84995
  if (this.enableDelegate && isToolAllowed("delegate")) {
84616
84996
  availableToolsList += "- delegate: Delegate big distinct tasks to specialized probe subagents.\n";
84617
84997
  }
@@ -85206,6 +85586,9 @@ You are working with a workspace. Available paths: ${workspaceDesc}
85206
85586
  if (this.allowEdit && this.allowedTools.isEnabled("create")) {
85207
85587
  validTools.push("create");
85208
85588
  }
85589
+ if (this.allowEdit && this.allowedTools.isEnabled("multi_edit")) {
85590
+ validTools.push("multi_edit");
85591
+ }
85209
85592
  if (this.enableBash && this.allowedTools.isEnabled("bash")) {
85210
85593
  validTools.push("bash");
85211
85594
  }