pybao-cli 1.5.47 → 1.5.50

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 (154) hide show
  1. package/dist/REPL-5XUDCAF4.js +53 -0
  2. package/dist/{acp-KELESOXO.js → acp-VXAHCMQ4.js} +30 -30
  3. package/dist/{agentsValidate-J7PHU22S.js → agentsValidate-PFVCK6ZC.js} +7 -7
  4. package/dist/{ask-ZICPHRGR.js → ask-7RQ2G5S3.js} +30 -30
  5. package/dist/{autoUpdater-6KGZQTW5.js → autoUpdater-TDN3ABMG.js} +3 -3
  6. package/dist/{chunk-OTMVCWZ2.js → chunk-3IPEAISZ.js} +3 -3
  7. package/dist/{chunk-5OJHTSFR.js → chunk-5ITEAEJC.js} +2 -1
  8. package/dist/chunk-5ITEAEJC.js.map +7 -0
  9. package/dist/{chunk-Q4WANADY.js → chunk-5P4A6TN2.js} +2 -2
  10. package/dist/{chunk-XIAHHC4E.js → chunk-7MR3XX5X.js} +2 -2
  11. package/dist/{chunk-MWL7Q5HG.js → chunk-A45A3UUU.js} +1 -1
  12. package/dist/{chunk-57BVHCH3.js → chunk-BQCQ3DEN.js} +2 -2
  13. package/dist/{chunk-5OBGGU2O.js → chunk-C7BUAPKP.js} +3 -3
  14. package/dist/{chunk-GHNPBDR6.js → chunk-CHH6TEXB.js} +1 -1
  15. package/dist/{chunk-7WPBMV6W.js → chunk-CNBKKQSV.js} +1 -1
  16. package/dist/{chunk-2AU4PKSQ.js → chunk-CNW45NOZ.js} +3 -3
  17. package/dist/{chunk-6JVCLWCU.js → chunk-DBMDQEQO.js} +3 -3
  18. package/dist/{chunk-N2W52I56.js → chunk-EY3ZOE75.js} +1 -1
  19. package/dist/{chunk-SD3VNTAR.js → chunk-FNDIHEBT.js} +616 -28
  20. package/dist/chunk-FNDIHEBT.js.map +7 -0
  21. package/dist/{chunk-T6S6TXIY.js → chunk-IXFDCJ25.js} +3 -3
  22. package/dist/{chunk-V6W537PO.js → chunk-J6HKEIL2.js} +1 -1
  23. package/dist/{chunk-IAIXAB4N.js → chunk-K3QEELFX.js} +3 -3
  24. package/dist/{chunk-J3TM7T3W.js → chunk-KKNO6B2K.js} +199 -712
  25. package/dist/chunk-KKNO6B2K.js.map +7 -0
  26. package/dist/{chunk-ITD4GQ6O.js → chunk-L4CGYTJQ.js} +1 -1
  27. package/dist/{chunk-OPEQBEHZ.js → chunk-LE5VGGP6.js} +4 -4
  28. package/dist/{chunk-US6EALFL.js → chunk-NBDDIZNJ.js} +2 -2
  29. package/dist/{chunk-VDLMXEHU.js → chunk-NQGIALRP.js} +4 -4
  30. package/dist/{chunk-RRLBQ3XD.js → chunk-NRORTICH.js} +2 -2
  31. package/dist/{chunk-TLMCXAET.js → chunk-NSFU6Y4R.js} +1 -1
  32. package/dist/{chunk-UUTMXSER.js → chunk-PXRUNRK7.js} +1 -1
  33. package/dist/{chunk-CN443EB5.js → chunk-UJRT7VK2.js} +1 -1
  34. package/dist/{chunk-K3AQYDRJ.js → chunk-VAZ4VRTA.js} +3 -3
  35. package/dist/{chunk-4VVWAA6O.js → chunk-XHAEEYYH.js} +1 -1
  36. package/dist/{chunk-Q2FTNJHH.js → chunk-Y7I4XTJJ.js} +3 -3
  37. package/dist/{chunk-A5O2MBVW.js → chunk-YFVKGHW2.js} +2 -2
  38. package/dist/{chunk-ZLNJ6XFU.js → chunk-ZDDVFBS4.js} +4 -4
  39. package/dist/{chunk-7UF7PBUR.js → chunk-ZKW5V7MR.js} +1 -1
  40. package/dist/{cli-P7N4INGY.js → cli-PMOATR2H.js} +90 -90
  41. package/dist/commands-HA2TW7NU.js +57 -0
  42. package/dist/{config-XVX25KIN.js → config-PQYZDDGW.js} +4 -4
  43. package/dist/{context-OBZ5CNGA.js → context-BWXP2WB4.js} +6 -6
  44. package/dist/{conversationPersistence-CB3RZIY7.js → conversationPersistence-CS2SQ6Z6.js} +3 -3
  45. package/dist/{conversationTracker-HDEFZTDC.js → conversationTracker-3OLKEYWM.js} +4 -4
  46. package/dist/{customCommands-ELEQAM5Y.js → customCommands-VPTXXYYR.js} +4 -4
  47. package/dist/{env-FMH4AH2H.js → env-G5ZYCG5S.js} +2 -2
  48. package/dist/{file-6TB2IASX.js → file-2I2KXCVN.js} +4 -4
  49. package/dist/index.js +3 -3
  50. package/dist/{llm-QPAHJ643.js → llm-KXF74SNS.js} +31 -31
  51. package/dist/{llmLazy-RYJWZZ7Y.js → llmLazy-L3IJUBN2.js} +1 -1
  52. package/dist/{loader-EPUS22XU.js → loader-CJOJNOV7.js} +4 -4
  53. package/dist/{lsp-WIEWEHYU.js → lsp-OKPL75YW.js} +6 -6
  54. package/dist/{lspAnchor-YI3SOGER.js → lspAnchor-7Z5YNXX3.js} +6 -6
  55. package/dist/{mcp-Q6UOFMLT.js → mcp-C65V4JYM.js} +7 -7
  56. package/dist/{mentionProcessor-3IV63BZT.js → mentionProcessor-EDZBHP7Y.js} +5 -5
  57. package/dist/{messages-XU4LSUWY.js → messages-YBAYUMKL.js} +1 -1
  58. package/dist/{model-JFUZ777G.js → model-7WMFC6F7.js} +5 -5
  59. package/dist/{openai-PQN2VFKQ.js → openai-YWEX6G4I.js} +5 -5
  60. package/dist/{outputStyles-PJNN6AH4.js → outputStyles-N6S27KGD.js} +4 -4
  61. package/dist/{pluginRuntime-TLFHDTDH.js → pluginRuntime-3XWIAPQ7.js} +6 -6
  62. package/dist/{pluginValidation-TZUKRIFW.js → pluginValidation-2JLTTMJL.js} +6 -6
  63. package/dist/prompts-HCGQPTDJ.js +59 -0
  64. package/dist/{pybAgentSessionLoad-EFAWFGRE.js → pybAgentSessionLoad-XJ6XWCK5.js} +4 -4
  65. package/dist/{pybAgentSessionResume-YQSKGG3W.js → pybAgentSessionResume-SMNXFGFB.js} +4 -4
  66. package/dist/{pybAgentStreamJsonSession-BYHCDZXV.js → pybAgentStreamJsonSession-33YU7WNJ.js} +1 -1
  67. package/dist/{pybHooks-ZH3DUHNO.js → pybHooks-6JRPW3VW.js} +4 -4
  68. package/dist/query-GGJC3XT2.js +57 -0
  69. package/dist/{registry-A2AB7N66.js → registry-67P26WKJ.js} +5 -5
  70. package/dist/{ripgrep-CYA5VVPU.js → ripgrep-DPLWHL7O.js} +3 -3
  71. package/dist/{skillMarketplace-6CDVELA7.js → skillMarketplace-MGU4KRUF.js} +3 -3
  72. package/dist/{state-MDP57623.js → state-NZVNNCHH.js} +2 -2
  73. package/dist/{theme-MYY4MVK7.js → theme-XV4CTBG6.js} +5 -5
  74. package/dist/{toolPermissionSettings-ALND7SVQ.js → toolPermissionSettings-NEXN25B3.js} +6 -6
  75. package/dist/tools-R7EDLOFS.js +57 -0
  76. package/dist/{userInput-FBVWRPOG.js → userInput-PHXM4ITY.js} +32 -32
  77. package/package.json +2 -1
  78. package/dist/REPL-45IVQWUI.js +0 -53
  79. package/dist/chunk-5OJHTSFR.js.map +0 -7
  80. package/dist/chunk-J3TM7T3W.js.map +0 -7
  81. package/dist/chunk-SD3VNTAR.js.map +0 -7
  82. package/dist/commands-BTSWDZVO.js +0 -57
  83. package/dist/prompts-Y4JPHIGG.js +0 -59
  84. package/dist/query-SA5YQRDP.js +0 -57
  85. package/dist/tools-6M5WFR3S.js +0 -57
  86. /package/dist/{REPL-45IVQWUI.js.map → REPL-5XUDCAF4.js.map} +0 -0
  87. /package/dist/{acp-KELESOXO.js.map → acp-VXAHCMQ4.js.map} +0 -0
  88. /package/dist/{agentsValidate-J7PHU22S.js.map → agentsValidate-PFVCK6ZC.js.map} +0 -0
  89. /package/dist/{ask-ZICPHRGR.js.map → ask-7RQ2G5S3.js.map} +0 -0
  90. /package/dist/{autoUpdater-6KGZQTW5.js.map → autoUpdater-TDN3ABMG.js.map} +0 -0
  91. /package/dist/{chunk-OTMVCWZ2.js.map → chunk-3IPEAISZ.js.map} +0 -0
  92. /package/dist/{chunk-Q4WANADY.js.map → chunk-5P4A6TN2.js.map} +0 -0
  93. /package/dist/{chunk-XIAHHC4E.js.map → chunk-7MR3XX5X.js.map} +0 -0
  94. /package/dist/{chunk-MWL7Q5HG.js.map → chunk-A45A3UUU.js.map} +0 -0
  95. /package/dist/{chunk-57BVHCH3.js.map → chunk-BQCQ3DEN.js.map} +0 -0
  96. /package/dist/{chunk-5OBGGU2O.js.map → chunk-C7BUAPKP.js.map} +0 -0
  97. /package/dist/{chunk-GHNPBDR6.js.map → chunk-CHH6TEXB.js.map} +0 -0
  98. /package/dist/{chunk-7WPBMV6W.js.map → chunk-CNBKKQSV.js.map} +0 -0
  99. /package/dist/{chunk-2AU4PKSQ.js.map → chunk-CNW45NOZ.js.map} +0 -0
  100. /package/dist/{chunk-6JVCLWCU.js.map → chunk-DBMDQEQO.js.map} +0 -0
  101. /package/dist/{chunk-N2W52I56.js.map → chunk-EY3ZOE75.js.map} +0 -0
  102. /package/dist/{chunk-T6S6TXIY.js.map → chunk-IXFDCJ25.js.map} +0 -0
  103. /package/dist/{chunk-V6W537PO.js.map → chunk-J6HKEIL2.js.map} +0 -0
  104. /package/dist/{chunk-IAIXAB4N.js.map → chunk-K3QEELFX.js.map} +0 -0
  105. /package/dist/{chunk-ITD4GQ6O.js.map → chunk-L4CGYTJQ.js.map} +0 -0
  106. /package/dist/{chunk-OPEQBEHZ.js.map → chunk-LE5VGGP6.js.map} +0 -0
  107. /package/dist/{chunk-US6EALFL.js.map → chunk-NBDDIZNJ.js.map} +0 -0
  108. /package/dist/{chunk-VDLMXEHU.js.map → chunk-NQGIALRP.js.map} +0 -0
  109. /package/dist/{chunk-RRLBQ3XD.js.map → chunk-NRORTICH.js.map} +0 -0
  110. /package/dist/{chunk-TLMCXAET.js.map → chunk-NSFU6Y4R.js.map} +0 -0
  111. /package/dist/{chunk-UUTMXSER.js.map → chunk-PXRUNRK7.js.map} +0 -0
  112. /package/dist/{chunk-CN443EB5.js.map → chunk-UJRT7VK2.js.map} +0 -0
  113. /package/dist/{chunk-K3AQYDRJ.js.map → chunk-VAZ4VRTA.js.map} +0 -0
  114. /package/dist/{chunk-4VVWAA6O.js.map → chunk-XHAEEYYH.js.map} +0 -0
  115. /package/dist/{chunk-Q2FTNJHH.js.map → chunk-Y7I4XTJJ.js.map} +0 -0
  116. /package/dist/{chunk-A5O2MBVW.js.map → chunk-YFVKGHW2.js.map} +0 -0
  117. /package/dist/{chunk-ZLNJ6XFU.js.map → chunk-ZDDVFBS4.js.map} +0 -0
  118. /package/dist/{chunk-7UF7PBUR.js.map → chunk-ZKW5V7MR.js.map} +0 -0
  119. /package/dist/{cli-P7N4INGY.js.map → cli-PMOATR2H.js.map} +0 -0
  120. /package/dist/{commands-BTSWDZVO.js.map → commands-HA2TW7NU.js.map} +0 -0
  121. /package/dist/{config-XVX25KIN.js.map → config-PQYZDDGW.js.map} +0 -0
  122. /package/dist/{context-OBZ5CNGA.js.map → context-BWXP2WB4.js.map} +0 -0
  123. /package/dist/{conversationPersistence-CB3RZIY7.js.map → conversationPersistence-CS2SQ6Z6.js.map} +0 -0
  124. /package/dist/{conversationTracker-HDEFZTDC.js.map → conversationTracker-3OLKEYWM.js.map} +0 -0
  125. /package/dist/{customCommands-ELEQAM5Y.js.map → customCommands-VPTXXYYR.js.map} +0 -0
  126. /package/dist/{env-FMH4AH2H.js.map → env-G5ZYCG5S.js.map} +0 -0
  127. /package/dist/{file-6TB2IASX.js.map → file-2I2KXCVN.js.map} +0 -0
  128. /package/dist/{llm-QPAHJ643.js.map → llm-KXF74SNS.js.map} +0 -0
  129. /package/dist/{llmLazy-RYJWZZ7Y.js.map → llmLazy-L3IJUBN2.js.map} +0 -0
  130. /package/dist/{loader-EPUS22XU.js.map → loader-CJOJNOV7.js.map} +0 -0
  131. /package/dist/{lsp-WIEWEHYU.js.map → lsp-OKPL75YW.js.map} +0 -0
  132. /package/dist/{lspAnchor-YI3SOGER.js.map → lspAnchor-7Z5YNXX3.js.map} +0 -0
  133. /package/dist/{mcp-Q6UOFMLT.js.map → mcp-C65V4JYM.js.map} +0 -0
  134. /package/dist/{mentionProcessor-3IV63BZT.js.map → mentionProcessor-EDZBHP7Y.js.map} +0 -0
  135. /package/dist/{messages-XU4LSUWY.js.map → messages-YBAYUMKL.js.map} +0 -0
  136. /package/dist/{model-JFUZ777G.js.map → model-7WMFC6F7.js.map} +0 -0
  137. /package/dist/{openai-PQN2VFKQ.js.map → openai-YWEX6G4I.js.map} +0 -0
  138. /package/dist/{outputStyles-PJNN6AH4.js.map → outputStyles-N6S27KGD.js.map} +0 -0
  139. /package/dist/{pluginRuntime-TLFHDTDH.js.map → pluginRuntime-3XWIAPQ7.js.map} +0 -0
  140. /package/dist/{pluginValidation-TZUKRIFW.js.map → pluginValidation-2JLTTMJL.js.map} +0 -0
  141. /package/dist/{prompts-Y4JPHIGG.js.map → prompts-HCGQPTDJ.js.map} +0 -0
  142. /package/dist/{pybAgentSessionLoad-EFAWFGRE.js.map → pybAgentSessionLoad-XJ6XWCK5.js.map} +0 -0
  143. /package/dist/{pybAgentSessionResume-YQSKGG3W.js.map → pybAgentSessionResume-SMNXFGFB.js.map} +0 -0
  144. /package/dist/{pybAgentStreamJsonSession-BYHCDZXV.js.map → pybAgentStreamJsonSession-33YU7WNJ.js.map} +0 -0
  145. /package/dist/{pybHooks-ZH3DUHNO.js.map → pybHooks-6JRPW3VW.js.map} +0 -0
  146. /package/dist/{query-SA5YQRDP.js.map → query-GGJC3XT2.js.map} +0 -0
  147. /package/dist/{registry-A2AB7N66.js.map → registry-67P26WKJ.js.map} +0 -0
  148. /package/dist/{ripgrep-CYA5VVPU.js.map → ripgrep-DPLWHL7O.js.map} +0 -0
  149. /package/dist/{skillMarketplace-6CDVELA7.js.map → skillMarketplace-MGU4KRUF.js.map} +0 -0
  150. /package/dist/{state-MDP57623.js.map → state-NZVNNCHH.js.map} +0 -0
  151. /package/dist/{theme-MYY4MVK7.js.map → theme-XV4CTBG6.js.map} +0 -0
  152. /package/dist/{toolPermissionSettings-ALND7SVQ.js.map → toolPermissionSettings-NEXN25B3.js.map} +0 -0
  153. /package/dist/{tools-6M5WFR3S.js.map → tools-R7EDLOFS.js.map} +0 -0
  154. /package/dist/{userInput-FBVWRPOG.js.map → userInput-PHXM4ITY.js.map} +0 -0
@@ -3,13 +3,13 @@ const require = __pybCreateRequire(import.meta.url);
3
3
  import {
4
4
  getSettingsFileCandidates,
5
5
  loadSettingsWithLegacyFallback
6
- } from "./chunk-7WPBMV6W.js";
6
+ } from "./chunk-CNBKKQSV.js";
7
7
  import {
8
8
  getSessionPlugins
9
9
  } from "./chunk-BJSWTHRM.js";
10
10
  import {
11
11
  getTheme
12
- } from "./chunk-N2W52I56.js";
12
+ } from "./chunk-EY3ZOE75.js";
13
13
  import {
14
14
  addMcprcServerForTesting,
15
15
  getCurrentProjectConfig,
@@ -19,13 +19,13 @@ import {
19
19
  safeParseJSON,
20
20
  saveCurrentProjectConfig,
21
21
  saveGlobalConfig
22
- } from "./chunk-2AU4PKSQ.js";
22
+ } from "./chunk-CNW45NOZ.js";
23
23
  import {
24
24
  PRODUCT_COMMAND,
25
25
  PRODUCT_NAME,
26
26
  getCwd,
27
27
  logMCPError
28
- } from "./chunk-CN443EB5.js";
28
+ } from "./chunk-UJRT7VK2.js";
29
29
 
30
30
  // src/services/mcp/client.ts
31
31
  import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
@@ -695,6 +695,7 @@ function FallbackToolUseRejectedMessage() {
695
695
  }
696
696
 
697
697
  // src/tools/mcp/MCPTool/prompt.ts
698
+ var TOOL_NAME = "mcp";
698
699
  var PROMPT = "";
699
700
  var DESCRIPTION = "";
700
701
 
@@ -906,6 +907,582 @@ function normalizeSandboxRuntimeConfigFromSettings(settings, options) {
906
907
  };
907
908
  }
908
909
 
910
+ // src/tools/filesystem/FileReadTool/prompt.ts
911
+ var MAX_LINES_TO_READ = 2e3;
912
+ var MAX_LINE_LENGTH = 2e3;
913
+ var TOOL_NAME2 = "Read";
914
+ var DESCRIPTION2 = "Read a file or directory from the local filesystem.";
915
+ var PROMPT2 = `Reads a file or directory from the local filesystem. You can access any file or directory directly by using this tool.Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid; otherwise, Ensure the path is confirmed by Glob/Grep before reading.
916
+
917
+ ## Best Practice
918
+ - **Read vs Analyze**: Use this tool when you need to inspect full implementation details.
919
+ - **Workflow**: Locate file (Glob/Grep) -> Read file (FileRead) -> Edit file.
920
+ - **Avoid**: Do not use this to 'search' for code strings; use 'Grep' or 'Glob' for that.
921
+
922
+ ## When NOT to Use Read Tool
923
+ - **Unverified Paths**: Do NOT read a file if the path was inferred or guessed from context. Always verify the path exists using Glob/Grep first.
924
+ - **Exploration Phase**: When exploring unfamiliar code, do NOT assume file locations. Use Glob/Grep to discover actual paths before reading.
925
+ - It is okay to read a file that does not exist; an error will be returned.
926
+
927
+ ## Usage Details
928
+ - The file_path parameter must be an absolute path, not a relative path
929
+ - This tool supports both file mode and directory mode
930
+ - In directory mode, offset/limit are 1-based entry pagination and offset>=1 is required
931
+ - In file mode, offset/limit are 1-based line pagination; offset=1 starts from the first line shown in cat -n output
932
+ - By default, file mode reads up to ${MAX_LINES_TO_READ} lines starting from the beginning of the file
933
+ - You can optionally specify a line offset and limit (especially handy for long files). **Smart Truncation is active** only in file mode when \`limit\` is provided and \`symbol_name\` is not provided: if your limit cuts a function or class in the middle, the tool will automatically extend the read range to include the full semantic block (up to 500 extra lines).
934
+ - Smart Truncation is a best-effort semantic boundary repair (Tree-sitter). If semantic parsing fails, Read falls back to the original offset/limit window.
935
+ - symbol_name enables LSP-assisted symbol read: provide an exact symbol name to resolve the symbol range and read that block directly
936
+ - When \`symbol_name\` is provided, Read resolves symbol range via LSP and reads that block directly (offset/limit are ignored for range selection).
937
+ - Use symbol_name only after file path is confirmed and when you need a specific class/function definition; if symbol is missing, unresolved, or LSP is unavailable, fallback to offset/limit or use LspTool for semantic discovery first.
938
+ - Directory mode returns a one-level tree structure using \u251C\u2500\u2500/\u2514\u2500\u2500 and supports pagination continuation hints
939
+ - For large files, iterate in chunks: offset=1 limit=200, then offset=201 limit=200, and so on until the needed region is covered
940
+ - File text truncation is capped at 50KB per result and 2000 lines; 50KB is file text truncation and not a directory access gate
941
+ - Any lines longer than ${MAX_LINE_LENGTH} characters will be truncated
942
+ - Results are returned using cat -n format, with line numbers starting at 1
943
+ - This tool allows reading images (eg PNG, JPG, etc). When reading an image file the contents are presented visually.
944
+ - This tool can read PDF files and return them as document blocks for analysis.
945
+ - This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
946
+ - For wide repository exploration, still prefer Glob first, then use Read for focused file/directory inspection.
947
+ - You can call multiple tools in a single response. It is always better to speculatively read multiple potentially useful files in parallel.
948
+ - You will regularly be asked to read screenshots. If the user provides a path to a screenshot, ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths.
949
+ - If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.
950
+
951
+ ## Typical Usage Examples
952
+ ### Example 1: Exploring Unfamiliar Codebase
953
+ <example>
954
+ user: How does authentication work in this project?
955
+ assistant: [uses Grep tool with pattern="auth|login" to find relevant files]
956
+ [uses Glob tool with pattern="**/auth*.{ts,js}" to locate auth modules]
957
+ [reads the matched files after confirming their paths]
958
+ </example>
959
+
960
+ ### Example 2: User Mentions a Concept Without Path
961
+ <example>
962
+ user: Check the database configuration
963
+ assistant: [uses Glob tool with pattern="**/config*.{ts,js,json}"]
964
+ [uses Grep tool with pattern="database|db_" to find config files with db settings]
965
+ [reads the confirmed config file]
966
+ </example>
967
+
968
+ ### Example 3: Read Directory Structure Then Read File
969
+ <example>
970
+ user: Check the API module layout and read router implementation
971
+ assistant: [uses Glob tool with pattern="**/api*"]
972
+ [reads the confirmed api directory path to get one-level tree structure with Read]
973
+ [reads the router file path found in that directory tree]
974
+ </example>
975
+
976
+ ### Example 4: LSP-Assisted Symbol Read
977
+ <example>
978
+ user: I only need the function that actually executes file reading, not the whole file
979
+ assistant: [uses Glob/Grep to confirm FileReadTool file path]
980
+ [uses Read with file_path="<absolute path>/FileReadTool.tsx" symbol_name="call"]
981
+ [if symbol is missing or unresolved, uses LspTool documentSymbol to discover exact symbol names, then retries]
982
+ [if LSP is unavailable, falls back to offset/limit chunked reads around likely implementation area]
983
+ <reasoning>
984
+ The assistant used symbol_name-based Read because:
985
+ 1. User intent is a specific implementation block, not whole-file browsing
986
+ 2. symbol_name gives precise semantic range selection and avoids noisy context
987
+ 3. LspTool is used only for symbol discovery fallback, while Read remains the code retrieval tool
988
+ </reasoning>
989
+ </example>
990
+
991
+ ### Example 5: Smart Truncation on Partial Window
992
+ <example>
993
+ user: Please read this file section for me; I do not know where the function ends
994
+ assistant: [uses Read with file_path="<absolute path>/service.ts" offset=120 limit=30]
995
+ [relies on Smart Truncation to auto-extend when the requested window cuts a function/class boundary]
996
+ [checks returned startLine/numLines and continues with adjacent chunks if more context is needed]
997
+ [if semantic parsing fails, falls back to original offset/limit and continues chunked reading]
998
+ <reasoning>
999
+ The assistant used offset/limit Read with Smart Truncation because:
1000
+ 1. User asked for a local section without symbol-level knowledge
1001
+ 2. Pagination windows can split semantic containers, causing misleading partial code
1002
+ 3. Smart Truncation repairs semantic boundaries while preserving pagination workflow
1003
+ </reasoning>
1004
+ </example>
1005
+ `.trim();
1006
+
1007
+ // src/tools/filesystem/FileEditTool/prompt.ts
1008
+ var TOOL_NAME3 = "Edit";
1009
+ var DESCRIPTION3 = `Performs smart string replacements in files using SEARCH/REPLACE blocks.
1010
+
1011
+ Usage:
1012
+ 1. **Read First**: You must use your \`Read\` tool at least once before editing.
1013
+ 2. **Block Format**: Provide changes as one or more SEARCH/REPLACE blocks.
1014
+ \`\`\`
1015
+ <<<<<<< SEARCH
1016
+ [original code to replace]
1017
+ =======
1018
+ [new code to insert]
1019
+ >>>>>>> REPLACE
1020
+ \`\`\`
1021
+ 3. **Multiple Edits**: You can provide multiple blocks in a single turn to perform batch edits.
1022
+ 4. **Context**: Include enough surrounding lines in the SEARCH block to ensure uniqueness.
1023
+ 5. **Indentation**: Preserve the exact indentation (tabs/spaces) of the original file in your SEARCH block.
1024
+ 6. **Smart Matching**: The tool uses a fuzzy matching engine. It can locate code even if there are minor differences in whitespace or indentation.
1025
+ 7. **Conditional Edit**: Use \`if_not_contains\` to skip the edit if the file already contains a specific string.
1026
+ 8. **Thinking**: You can include "thinking" text between blocks; the tool will ignore it.
1027
+
1028
+ ## LSP-Integrated Behavior
1029
+ - **Semantic Anchor Assist**: Before fuzzy replacement, Edit tries LSP anchor matching to narrow replacement to the most relevant symbol range.
1030
+ - **When It Helps**: Especially useful when the same snippet appears multiple times and plain text matching may hit the wrong block.
1031
+ - **Fallback**: If LSP anchor is unavailable, Edit falls back to normal SEARCH/REPLACE matching.
1032
+ - **Post-Edit Verification**: Set \`verify: true\` to run LSP diagnostics after applying edits.
1033
+ - **Verification Guardrail**: If syntax/type diagnostics contain errors after edit, Edit reverts changes and returns a verification failure.
1034
+ - **When LSP Is Unavailable**: You may receive verification unavailable; retry with \`verify: false\` only when you have high confidence in edit safety.
1035
+
1036
+ Notes:
1037
+ - The edit will FAIL if the SEARCH block matches multiple locations(ambiguous). Provide more context.
1038
+ - To delete code, leave the REPLACE section empty.
1039
+ - To create a new file with Edit, use an empty SEARCH block with the desired content in REPLACE only in efficiency-focused scenarios (for example, when you are already performing a multi-block edit workflow and adding one small new helper file in the same operation).
1040
+ - ALWAYS prefer editing existing files. NEVER write new files unless explicitly required.
1041
+ - For Jupyter Notebooks (.ipynb), use the NotebookEditTool instead.
1042
+
1043
+ ## Typical Usage Examples
1044
+ ### Example 1: Ambiguous Duplicate Snippet with LSP Anchor
1045
+ <example>
1046
+ user: Update the constructor guard in UserService, not the test helper copy
1047
+ assistant: [uses Read on UserService file to confirm target block]
1048
+ [uses Edit with SEARCH/REPLACE block and verify=true]
1049
+ [relies on LSP anchor assist to prefer semantic symbol region when duplicate text exists]
1050
+ <reasoning>
1051
+ The assistant enabled semantic-safe editing because:
1052
+ 1. Duplicate snippets can cause ambiguous fuzzy matches
1053
+ 2. LSP anchor narrows replacement to the intended symbol scope
1054
+ 3. verify=true adds post-edit diagnostics guardrail and auto-revert on syntax errors
1055
+ </reasoning>
1056
+ </example>
1057
+
1058
+ ### Example 2: Verification-Unavailable Recovery
1059
+ <example>
1060
+ user: Apply this quick rename in a generated file
1061
+ assistant: [uses Read to confirm exact path and block]
1062
+ [uses Edit with verify=true]
1063
+ [if response says verification unavailable, retries with verify=false and tighter SEARCH context]
1064
+ <reasoning>
1065
+ The assistant keeps verification first, then degrades safely because:
1066
+ 1. LSP verification is preferred for correctness
1067
+ 2. Generated or unsupported files may not have active LSP diagnostics
1068
+ 3. Retrying with verify=false is acceptable only after narrowing context
1069
+ </reasoning>
1070
+ </example>
1071
+ `.trim();
1072
+
1073
+ // src/tools/filesystem/FileWriteTool/prompt.ts
1074
+ var TOOL_NAME4 = "Write";
1075
+ var DESCRIPTION4 = "Write a file to the local filesystem.";
1076
+ var PROMPT3 = `Writes a file to the local filesystem.
1077
+
1078
+ ## Best Practice
1079
+ - **Write vs Edit**: Use this tool when you need to create a new file or fully replace a file's content.
1080
+ - **Primary Role**: This is the default tool for new file,parent directories creation and full-file replacement.
1081
+ - **Workflow**: Locate path (Glob/Grep) -> Read existing file with ${TOOL_NAME2} when applicable -> Write full target content.
1082
+ - **Directory Handling**: If parent directories do not exist, this tool creates them automatically. Do NOT use Bash mkdir for this.
1083
+
1084
+ ## When NOT to Use Write Tool
1085
+ - **Partial updates**: If you only need to change a small section, prefer Edit instead of replacing the entire file.
1086
+ - **Unread existing file**: Do NOT overwrite an existing file unless it has been read first with ${TOOL_NAME2}.
1087
+ - **Unnecessary new files**: ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
1088
+ - **Unrequested docs**: NEVER proactively create documentation files (*.md) or README files. Only create them when explicitly requested by the User.
1089
+
1090
+ ## Usage Details
1091
+ - The file_path parameter must be an absolute path, not a relative path.
1092
+ - This tool overwrites existing files at the provided path.
1093
+ - For existing files, this tool enforces a read-before-write safety check using ${TOOL_NAME2}.
1094
+ - For new files, this tool creates missing parent directories automatically.
1095
+ - The content parameter should be the complete desired final file content.
1096
+ - Preserve repository conventions (line endings, encoding, and formatting) in the written content.
1097
+ - Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.
1098
+
1099
+ ## Typical Usage Examples
1100
+ ### Example 1: Create a New File in Nested Directory
1101
+ <example>
1102
+ user: Create src/features/auth/config/defaults.ts with these defaults...
1103
+ assistant: [uses Glob/Grep to confirm target area and naming conventions]
1104
+ [uses Write with file_path as absolute path under src/features/auth/config/defaults.ts]
1105
+ [Write auto-creates missing parent directories]
1106
+ </example>
1107
+
1108
+ ### Example 2: Replace Entire Existing File Safely
1109
+ <example>
1110
+ user: Rewrite this config file completely with the new schema
1111
+ assistant: [uses ${TOOL_NAME2} to read the existing file first]
1112
+ [uses Write to replace the whole file content]
1113
+ </example>
1114
+
1115
+ ### Example 3: Avoid Write for Small Localized Change
1116
+ <example>
1117
+ user: Change only one import line in this file
1118
+ assistant: [uses ${TOOL_NAME2} to inspect file]
1119
+ [uses Edit for localized update instead of Write]
1120
+ </example>
1121
+ `.trim();
1122
+
1123
+ // src/tools/filesystem/GlobTool/prompt.ts
1124
+ var TOOL_NAME5 = "Glob";
1125
+ var DESCRIPTION5 = `Fast file pattern matching tool that works with any codebase size
1126
+
1127
+ ## WhenToUse & Best Practice
1128
+ - If you have keywords or fuzzy paths, use Glob first to narrow candidates.
1129
+ - When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
1130
+ - You can call multiple tools in a single response. It is always better to speculatively perform multiple searches in parallel if they are potentially useful.
1131
+ - This tool is for FINDING files.
1132
+
1133
+ ## Directory Structure Guidance
1134
+ - For one-level directory structure, use Read directly on the directory path (offset>=1, optional limit)
1135
+ - Use Glob for file-path discovery and candidate narrowing, not as the primary one-level directory listing workflow
1136
+
1137
+ ## Search Strategy
1138
+ - **Broad-to-Narrow Pattern**: Start with a broad pattern, then narrow based on results.
1139
+ - Step 1: Use broad patterns like \`**/*.ts\` or \`src/**/*\` to get an overview
1140
+ - Step 2: Analyze results and refine with more specific patterns
1141
+ - Example: "\`**/*.test.ts\`" \u2192 too many results \u2192 "src/**/auth*.test.ts"
1142
+ - **Pattern Selection Guide**:
1143
+ - Unknown structure? Start with \`**/*.{ext}\` to discover layout, then use Read on specific directory paths for one-level structure
1144
+ - Looking for specific type? Use descriptive names: \`**/test*\`, \`**/config*\`
1145
+ - In a specific area? Combine path + pattern: \`src/auth/**/*.ts\`
1146
+ - **Discovery Workflow**: For unfamiliar codebases, run these in parallel:
1147
+ - \`**/package.json\`, \`**/*.{ts,js,tsx,jsx}\`, \`**/README*\`, \`**/*config*.{ts,js,json}\`
1148
+ - Analyze structure \u2192 refine search \u2192 read key files
1149
+ - **Tool Collaboration**:
1150
+ - Read \`directory_path\` \u2192 Get one-level directory tree structure
1151
+ - Grep \u2192 After Glob finds files, use Grep to search content
1152
+ - Read \u2192 Read the found file contents
1153
+
1154
+ ## Usage Details
1155
+ - Supports glob patterns like "**/*.js" or "src/**/*.ts"
1156
+ - Returns absolute file paths sorted by modification time (most recent first)
1157
+ - Use this tool when you need to find files by name patterns
1158
+ - Powered by ripgrep with \`--files\` mode for fast pattern matching
1159
+ - \`path\` parameter: Specify the directory to search in. If omitted, uses the current working directory. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Supports both relative and absolute paths.
1160
+ - Results are limited to 100 files by default. If truncated, use a more specific path or pattern to narrow results.
1161
+ - Search ignores .gitignore rules and includes hidden files by default.
1162
+ - **Empty Results**: When no files are found, try broader patterns (e.g., src/**/*) or verify path exists.
1163
+ - **Error Handling**: Returns error if \`path\` does not exist or is not a valid directory.
1164
+ - **LSP Semantic Mode**: \`semantic: true\` enables workspace symbol fallback when file globbing returns empty.
1165
+ - **Semantic search is opt-in**: Only set \`semantic: true\` when you intentionally want LSP-assisted fallback.
1166
+ - Semantic output may include:
1167
+ - \`semanticNotice\`: human-readable semantic fallback note
1168
+ - \`semanticReason\`: structured reason code (e.g., \`SYMBOLS_ADDED\`, \`NO_SYMBOL_MATCH\`, \`LSP_UNAVAILABLE\`)
1169
+ - \`semanticSuggestion\`: suggested next action aligned to reason code
1170
+ - **Truncated Results**: When results are truncated (limited to 100 files), narrow down using:
1171
+ 1. Add a more specific path: \`src/core/**/*.ts\` instead of \`**/*.ts\`
1172
+ 2. Use file extension filter: \`src/**/*.test.ts\` instead of \`src/**/*.ts\`
1173
+ 3. Use Read on a specific directory path to confirm one-level structure, then target specific directories with Glob
1174
+
1175
+ ## Typical Usage Examples
1176
+
1177
+ ### Example 1: Project Structure Discovery (Unknown Codebase)
1178
+ <example>
1179
+ user: I'm new to this project, what's the structure?
1180
+ assistant: [uses Glob tool with pattern="**/package.json" to find project roots]
1181
+ [reads the confirmed source directory path to inspect one-level tree structure]
1182
+ [uses Glob tool with pattern="**/*.{ts,tsx,js,jsx}" to locate major source areas]
1183
+ </example>
1184
+
1185
+ ### Example 2: Find Files by Type in Specific Area
1186
+ <example>
1187
+ user: Find all test files in the auth module
1188
+ assistant: [uses Glob tool with pattern="src/auth/**/*.test.ts"]
1189
+ [uses Read tool to examine specific test files]
1190
+ </example>
1191
+
1192
+ ### Example 3: Config File Location (Deterministic)
1193
+ <example>
1194
+ user: Where is the webpack configuration?
1195
+ assistant: [uses Glob tool with pattern="**/webpack*.{js,ts,json}"]
1196
+ [uses Read tool on the matched config file]
1197
+ </example>
1198
+
1199
+ ### Example 4: Parallel Discovery for Entry Points
1200
+ <example>
1201
+ user: What are the main entry points of this application?
1202
+ assistant: [uses Glob tool with pattern="**/index.{ts,js}"]
1203
+ [uses Glob tool with pattern="**/main.{ts,js}"]
1204
+ [uses Glob tool with pattern="**/app.{ts,js}"]
1205
+ [uses Read tool to examine the entry point files]
1206
+ </example>
1207
+
1208
+ ### Example 5: Narrow Down After Broad Results
1209
+ <example>
1210
+ user: Find all TypeScript files in the project
1211
+ assistant: [uses Glob tool with pattern="**/*.ts" - returns 500+ files, truncated]
1212
+ [uses Glob tool with pattern="src/**/*.ts" to focus on source code]
1213
+ [uses Glob tool with pattern="src/core/**/*.ts" to narrow further if needed]
1214
+ </example>
1215
+
1216
+ ### Example 6: Semantic Fallback for Unknown File Path
1217
+ <example>
1218
+ user: Find where AuthService is implemented, I do not know the file name
1219
+ assistant: [uses Glob tool with pattern="**/*AuthService*" semantic=false first]
1220
+ [if no files found, retries with semantic=true]
1221
+ [reads semanticReason and semanticSuggestion to decide next step]
1222
+ <reasoning>
1223
+ The assistant switches to semantic mode because:
1224
+ 1. Filename-based glob failed and user intent is symbol-oriented
1225
+ 2. semantic=true allows LSP workspace symbols to recover likely file paths
1226
+ 3. semanticReason + semanticSuggestion provide explicit fallback diagnostics
1227
+ </reasoning>
1228
+ </example>
1229
+ `.trim();
1230
+
1231
+ // src/tools/search/GrepTool/prompt.ts
1232
+ var TOOL_NAME6 = "Grep";
1233
+ var DESCRIPTION6 = `A powerful fast content search tool that works with any codebase size
1234
+
1235
+ ## Best Practice
1236
+ - Use Grep as a "Scout" to *find* entry points based on text patterns.
1237
+ - STEP 1: Search for a unique string (e.g., error message, URL route, specific variable name).
1238
+ - STEP 2: Once you get a match (File + Line Number), STOP grepping.
1239
+ - STEP 3: Use Read to get the exact line + character, then call LspTool for definition or references.
1240
+ - AVOID: Do not use Grep to trace execution flow (e.g., searching for "functionName" manually). Use LSP for that.
1241
+ - Hotspot strategy: narrow the path scope first, then paginate or refine the search; after truncation, focus on high-signal directories to avoid full-repo scans.
1242
+
1243
+ ## Search Strategy
1244
+ - **Pattern Refinement Workflow**:
1245
+ - Start broad: simple keyword first, observe results
1246
+ - Narrow down: add constraints (type, glob, path) if too many matches
1247
+ - Switch mode: \`files_with_matches\` for discovery, \`content\` for details
1248
+ - **From Vague Intent to Precise Pattern**:
1249
+ - "How does auth work?" \u2192 Start with Grep("auth", type="ts") \u2192 Analyze results \u2192 Refine pattern
1250
+ - "Find the API endpoints" \u2192 Grep("router|route|endpoint", type="ts") \u2192 Read key files
1251
+ - "Where is this error from?" \u2192 Grep(exact error message) \u2192 Trace back to source
1252
+ - **Iterative Narrowing**:
1253
+ - Too many results? Add \`glob\`, \`type\`, or narrower \`path\`
1254
+ - No results? Broaden pattern, try case-insensitive (\`-i\`), or try alternative keywords
1255
+ - Wrong results? Adjust pattern, check regex syntax, try alternative keywords
1256
+ - **Tool Collaboration**:
1257
+ - Read "directory_path" \u2192 Confirm one-level directory structure for search scope
1258
+ - Glob "file_path" \u2192 Confirm file path existence
1259
+ - Read \u2192 Read specific content of matched files
1260
+ - LspTool \u2192 Trace definitions and references (replace manual Grep tracing)
1261
+
1262
+ ## Usage Details
1263
+ - ALWAYS use Grep for search tasks. NEVER invoke \`grep\` or \`rg\` as a Bash command. The Grep tool has been optimized for correct permissions and access.
1264
+ - Powered by ripgrep for fast text search with full regex support (e.g., "log.*Error", "function\\s+\\w+")
1265
+ - Pattern syntax: Uses ripgrep - literal braces need escaping (use \`interface\\{\\}\` to find \`interface{}\` in Go code)
1266
+ - Excludes version control directories (.git, .svn, .hg, .bzr) automatically
1267
+ - Includes hidden files by default
1268
+
1269
+ **Path & Scope**:
1270
+ - \`path\` parameter: File or directory to search in. Defaults to current working directory.
1271
+ - \`glob\` parameter: Filter files by glob pattern (e.g., "*.js", "*.{ts,tsx}") - maps to rg --glob
1272
+ - \`type\` parameter: Filter by file type (e.g., "js", "py", "rust", "go", "java") - more efficient than glob for standard types
1273
+ - Path guidance: If user provides a path, use it directly. If uncertain, confirm with Glob first.
1274
+
1275
+ **Output Modes**:
1276
+ - \`files_with_matches\` (default): Returns file paths sorted by modification time
1277
+ - \`content\`: Shows matching lines with line numbers (supports -A/-B/-C context)
1278
+ - \`count\`: Shows match counts per file
1279
+
1280
+ **Context & Pagination**:
1281
+ - \`-B\`, \`-A\`, \`-C\`: Context lines before/after/around matches (requires output_mode: "content")
1282
+ - \`-n\`: Show line numbers (default: true, requires output_mode: "content")
1283
+ - \`head_limit\`: Limit output to first N entries (works across all modes)
1284
+ - \`offset\`: Skip first N entries before applying head_limit
1285
+ - \`multiline\`: Enable multiline mode where . matches newlines (default: false)
1286
+
1287
+ **Case Sensitivity**:
1288
+ - \`-i\`: Enable case-insensitive search
1289
+
1290
+ **Result Handling**:
1291
+ - Results are truncated at 20,000 characters if too large
1292
+ - Use Task tool for open-ended searches requiring multiple rounds
1293
+ - **Semantic Fallback** (\`semantic: true\`): when text grep has no hit (or \`symbol_type\` is provided), Grep can query LSP workspace symbols.
1294
+ - Semantic-enhanced outputs may include:
1295
+ - \`semanticNotice\`: fallback summary
1296
+ - \`semanticReason\`: structured reason code (e.g., \`SYMBOLS_ADDED\`, \`NO_SYMBOL_MATCH\`, \`LSP_UNAVAILABLE\`)
1297
+ - \`semanticSuggestion\`: suggested next action by reason code
1298
+ - Keep deterministic workflow: text search first, semantic fallback second.
1299
+
1300
+ **Typical Usage Examples**:
1301
+
1302
+ Example 1: Exact Error Message Tracing (Deterministic)
1303
+ <example>
1304
+ user: Where does the error "Connection timeout after 30s" come from?
1305
+ assistant: [uses Grep tool with pattern="Connection timeout after 30s"output_mode="content"]
1306
+ [uses Read tool to examine the error source and surrounding context]
1307
+ </example>
1308
+
1309
+ Example 2: Precise Function Definition Lookup (Deterministic)
1310
+ <example>
1311
+ user: Find the implementation of \`calculateCompoundInterest\` function
1312
+ assistant: [uses Grep tool with pattern="calculateCompoundInterest" type="ts"output_mode="content"]
1313
+ [uses Read tool on the matched file to read the full implementation]
1314
+ </example>
1315
+
1316
+ Example 3: Iterative Narrowing for Broad Patterns
1317
+ <example>
1318
+ user: Find all API route definitions
1319
+ assistant: [uses Grep tool with pattern="router\\.(get|post|put|delete)" type="ts"]
1320
+ [if too many results: adds path="src/routes" to narrow scope]
1321
+ [uses Read tool to inspect specific route handlers]
1322
+ </example>
1323
+
1324
+ Example 4: Handoff to LSP After Entry Point Found
1325
+ <example>
1326
+ user: Find all usages of the \`PaymentService\` class
1327
+ assistant: [uses Grep tool with pattern="class PaymentService" type="ts"output_mode="content"]
1328
+ [uses LSP findReferences at the class definition location to get all references]
1329
+ </example>
1330
+
1331
+ Example 5: Case-Insensitive Search for Config Values
1332
+ <example>
1333
+ user: Where is the database host configured?
1334
+ assistant: [uses Grep tool with pattern="database.*host|db_host|DB_HOST" -i: true]
1335
+ [uses Read tool to examine configuration files]
1336
+ </example>
1337
+
1338
+ Example 6: Semantic Fallback with Structured Reason
1339
+ <example>
1340
+ user: Find usages of PaymentSrvce (name might be misspelled)
1341
+ assistant: [uses Grep tool with pattern="PaymentSrvce" output_mode="files_with_matches"]
1342
+ [if no hit, retries with semantic=true]
1343
+ [uses semanticReason and semanticSuggestion to decide whether to broaden query or switch to LspTool]
1344
+ <reasoning>
1345
+ The assistant uses semantic fallback because:
1346
+ 1. Text grep may miss typo-tolerant symbol matches
1347
+ 2. LSP workspace symbols can recover intended semantic targets
1348
+ 3. Structured reason fields make fallback outcomes explicit and actionable
1349
+ </reasoning>
1350
+ </example>
1351
+ `.trim();
1352
+
1353
+ // src/tools/search/LspTool/prompt.ts
1354
+ var TOOL_NAME7 = "LSP";
1355
+ var PROMPT4 = `Interact with Language Server Protocol (LSP) servers to get code intelligence features.Supports all languages.
1356
+
1357
+ ## Capabilities & Scenarios
1358
+ This tool acts as your "Code Analyst". Use it to understand the codebase semantically, rather than just matching text.
1359
+
1360
+ ### 1. Tracing Logic (Where does this go?)
1361
+ - **Scenario**: You see a function call \`calculateTax(amount)\` and need to know its formula.
1362
+ - **Action**: Use \`goToDefinition\` on the function name.
1363
+ - **Why**: It jumps directly to the implementation, even if it's imported from another file.
1364
+
1365
+ ### 2. Impact Analysis (What uses this?)
1366
+ - **Scenario**: You are planning to rename or modify the \`User\` class.
1367
+ - **Action**: Use \`findReferences\` at the symbol position (line + character) in the file where \`User\` is declared or used.
1368
+ - **Why**: It lists every file and line where \`User\` is referenced, ensuring you don't break dependents.
1369
+
1370
+ ### 3. Exploring New Files (What's in here?)
1371
+ - **Scenario**: You just opened a large file \`utils.ts\` and want a quick overview.
1372
+ - **Action**: Use \`documentSymbol\`.
1373
+ - **Why**: It returns a structured outline (Classes, Functions, Variables) using LspFacade policy: LSP-first for accuracy, Tree-Sitter fallback for speed when needed.
1374
+
1375
+ ### 4. Interface Implementation (Who implements this?)
1376
+ - **Scenario**: You see an interface \`IStorage\` and want to find the concrete class (e.g., \`S3Storage\`).
1377
+ - **Action**: Use \`goToImplementation\`.
1378
+ - **Why**: Grep might just find the import; LSP finds the actual code that implements the interface.
1379
+
1380
+ ### 5. Scope Analysis (What is visible here?)
1381
+ - **Scenario**: You are debugging a closure or nested function and want to know which variables are captured or locally defined.
1382
+ - **Action**: Use \`getScope\`.
1383
+ - **Why**: It returns the local variables and closure captures at the current position. Essential for debugging Python closures or JavaScript lexical scopes.
1384
+
1385
+ ### 6. Real-time Diagnostics (Is this correct?)
1386
+ - **Scenario**: You just edited a file and want to verify if you introduced any syntax errors.
1387
+ - **Action**: Use \`diagnostics\` with \`waitForDiagnostics: true\`.
1388
+ - **Why**: It waits for the language server to re-analyze the file and returns fresh errors/warnings. This is your "Self-Correction" mechanism.
1389
+
1390
+ ### 7. Workspace Symbol Search (Where is this symbol?)
1391
+ - **Scenario**: You need to find a class or function across the entire project.
1392
+ - **Action**: Use \`workspaceSymbol\` with a query string and a scoped filePath (module or directory).
1393
+ - **Why**: It searches across all files in the scope. **Important**: Must provide a scoped path to avoid unbounded full-repo queries.
1394
+
1395
+ ## Supported Operations
1396
+
1397
+ ### Location-Based Operations (require line + character)
1398
+ These 8 operations require precise symbol position:
1399
+ - \`goToDefinition\`: Find where a symbol is defined
1400
+ - \`findReferences\`: Find all references to a symbol
1401
+ - \`hover\`: Get hover information (documentation, type info) for a symbol
1402
+ - \`goToImplementation\`: Find implementations of an interface or abstract method
1403
+ - \`prepareCallHierarchy\`: Get call hierarchy item at a position (functions/methods)
1404
+ - \`incomingCalls\`: Find all functions/methods that call the function at a position
1405
+ - \`outgoingCalls\`: Find all functions/methods called by the function at a position
1406
+ - \`getScope\`: Get local variables and closure captures at a position
1407
+
1408
+ ### Document-Level Operations (no position required)
1409
+ - \`documentSymbol\`: Get all symbols (functions, classes, variables) in a document
1410
+ - \`diagnostics\`: Get validation errors and warnings for a file (supports waiting for fresh results)
1411
+
1412
+ ### Workspace-Level Operations
1413
+ - \`workspaceSymbol\`: Search for symbols across the entire workspace (requires query + scoped filePath)
1414
+
1415
+ ## Parameters
1416
+
1417
+ All operations require:
1418
+ - \`filePath\`: The file or directory to operate on
1419
+
1420
+ Location-based operations require:
1421
+ - \`line\`: The line number (1-based, as shown in editors)
1422
+ - \`character\`: The character offset (1-based, as shown in editors)
1423
+
1424
+ \`workspaceSymbol\` requires:
1425
+ - \`query\`: The symbol name or keyword to search for
1426
+
1427
+ Optional:
1428
+ - \`waitForDiagnostics\`: If true, wait for fresh diagnostics (used with "diagnostics" operation)
1429
+ - \`timeout\`: Timeout in milliseconds for waiting operations (default: 5000)
1430
+
1431
+ ## Intelligent Position Handling
1432
+
1433
+ **Do not pass a symbol name.** LSPTool works on positions, not names. Use Read to locate the symbol and derive line + character first.
1434
+
1435
+ ### Auto-Adjustment Mechanism
1436
+ If the specified position is not on a valid symbol, the tool automatically searches for the nearest valid token:
1437
+ - **Search scope**: Current line, then previous line, then next line
1438
+ - **Priority**: Current line tokens are preferred (lower score)
1439
+ - **Skipped tokens**: Keywords (function, class, if, for, return, etc.) and operators (=, =>, +, -, &&, ||, etc.) are automatically skipped
1440
+ - **If no valid token found**: Returns an error message
1441
+
1442
+ ### Best Practice for Position
1443
+ 1. Use Read to open the file and locate the symbol
1444
+ 2. Provide accurate 1-based line and character offset
1445
+ 3. Position should be on the symbol name itself, not on keywords/operators
1446
+ 4. If unsure, position at the start of the symbol name
1447
+
1448
+ ## Workflow & Scope Guidelines
1449
+ - **Priority order**: documentSymbol \u2192 hotspot detection \u2192 Read \u2192 LSP (ensure line + character)
1450
+ - **workspaceSymbol**: Must provide scoped filePath (module or directory), avoid unbounded full-repo queries
1451
+ - **documentSymbol**: Uses LspFacade policy (LSP-first for accuracy, Tree-Sitter fallback for speed)
1452
+
1453
+ ## Typical Usage Examples
1454
+ ### Example 1: Find Symbol Then Read Precise Block
1455
+ <example>
1456
+ user: Locate JWT validation implementation quickly
1457
+ assistant: [uses LSP workspaceSymbol with query="jwt validate" and scoped filePath]
1458
+ [uses Read on the discovered file and then LSP documentSymbol/definition as needed]
1459
+ <reasoning>
1460
+ The assistant starts semantically because:
1461
+ 1. User asks for implementation location, not broad text grep
1462
+ 2. workspaceSymbol narrows candidate files efficiently
1463
+ 3. Read is then used for exact code extraction once target is known
1464
+ </reasoning>
1465
+ </example>
1466
+
1467
+ ### Example 2: Diagnostics-First Debugging
1468
+ <example>
1469
+ user: Build failed in api package, tell me real code errors
1470
+ assistant: [uses LSP diagnostics with waitForDiagnostics=true on scoped filePath]
1471
+ [uses goToDefinition/findReferences for follow-up impact tracing]
1472
+ <reasoning>
1473
+ The assistant prioritizes diagnostics because:
1474
+ 1. Diagnostics provide direct semantic errors from language tooling
1475
+ 2. Scoped path avoids unbounded workspace queries
1476
+ 3. Follow-up LSP ops can trace root-cause dependencies
1477
+ </reasoning>
1478
+ </example>
1479
+
1480
+ Note: LSP servers are automatically managed and installed for most languages. For system-level languages (like C++, Java), ensure the corresponding tools (clangd, jdtls) are in your PATH.`;
1481
+ var DESCRIPTION7 = PROMPT4;
1482
+
1483
+ // src/tools/agent/TaskTool/constants.ts
1484
+ var TOOL_NAME8 = "Task";
1485
+
909
1486
  // src/tools/system/BashTool/prompt.ts
910
1487
  var DEFAULT_TIMEOUT_MS = 12e4;
911
1488
  var MAX_TIMEOUT_MS = 6e5;
@@ -913,14 +1490,7 @@ var MAX_OUTPUT_LENGTH = 3e4;
913
1490
  var MAX_RENDERED_LINES = 5;
914
1491
  var PROJECT_URL = "https://github.com/pyb-xc/pyb-ts";
915
1492
  var DEFAULT_CO_AUTHOR = "PYB-XC";
916
- var TOOL_NAME_BASH = "Bash";
917
- var TOOL_NAME_GLOB = "Glob";
918
- var TOOL_NAME_GREP = "Grep";
919
- var TOOL_NAME_LSP = "Lsp";
920
- var TOOL_NAME_READ = "Read";
921
- var TOOL_NAME_EDIT = "Edit";
922
- var TOOL_NAME_WRITE = "Write";
923
- var TOOL_NAME_TASK = "Task";
1493
+ var TOOL_NAME9 = "Bash";
924
1494
  function isExperimentalMcpCliEnabled() {
925
1495
  const value = process.env.ENABLE_EXPERIMENTAL_MCP_CLI;
926
1496
  if (!value) return false;
@@ -1012,7 +1582,7 @@ Git Safety Protocol:
1012
1582
  - Before amending: ALWAYS check authorship (git log -1 --format='%an %ae')
1013
1583
  - NEVER commit changes unless the user explicitly asks you to. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.
1014
1584
 
1015
- 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the ${TOOL_NAME_BASH} tool:
1585
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel, each using the ${TOOL_NAME9} tool:
1016
1586
  - Run a git status command to see all untracked files.
1017
1587
  - Run a git diff command to see both staged and unstaged changes that will be committed.
1018
1588
  - Run a git log command to see recent commit messages, so that you can follow this repository's commit message style.
@@ -1034,7 +1604,7 @@ Git Safety Protocol:
1034
1604
 
1035
1605
  Important notes:
1036
1606
  - NEVER run additional commands to read or explore code, besides git bash commands
1037
- - NEVER use the ${TOOL_NAME_WRITE} or ${TOOL_NAME_TASK} tools
1607
+ - NEVER use the ${TOOL_NAME4} or ${TOOL_NAME8} tools
1038
1608
  - DO NOT push to the remote repository unless the user explicitly asks you to do so
1039
1609
  - IMPORTANT: Never use git commands with the -i flag (like git rebase -i or git add -i) since they require interactive input which is not supported.
1040
1610
  - If there are no changes to commit (i.e., no untracked files and no modifications), do not create an empty commit
@@ -1053,7 +1623,7 @@ Use the gh command via the Bash tool for ALL GitHub-related tasks including work
1053
1623
 
1054
1624
  IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
1055
1625
 
1056
- 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel for optimal performance. run the following bash commands in parallel using the ${TOOL_NAME_BASH} tool, in order to understand the current state of the branch since it diverged from the main branch:
1626
+ 1. You can call multiple tools in a single response. When multiple independent pieces of information are requested and all commands are likely to succeed, run multiple tool calls in parallel using the ${TOOL_NAME9} tool, in order to understand the current state of the branch since it diverged from the main branch:
1057
1627
  - Run a git status command to see all untracked files
1058
1628
  - Run a git diff command to see both staged and unstaged changes that will be committed
1059
1629
  - Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
@@ -1077,7 +1647,7 @@ EOF
1077
1647
  </example>
1078
1648
 
1079
1649
  Important:
1080
- - DO NOT use the ${TOOL_NAME_WRITE} or ${TOOL_NAME_TASK} tools
1650
+ - DO NOT use the ${TOOL_NAME4} or ${TOOL_NAME8} tools
1081
1651
  - Return the PR URL when you're done, so the user can see it
1082
1652
 
1083
1653
  # Other common operations
@@ -1092,7 +1662,7 @@ IMPORTANT: This tool is for terminal operations like git, npm, docker, etc. DO N
1092
1662
  Before executing the command, please follow these steps:
1093
1663
 
1094
1664
  1. Directory Verification:
1095
- - If the command will create new directories or files, first use the ${TOOL_NAME_GLOB} tool to verify the parent directory exists and is the correct location
1665
+ - If the command will create new directories or files, first use the ${TOOL_NAME5} tool to verify the parent directory exists and is the correct location
1096
1666
  - For example, before running "mkdir foo/bar", first check if "foo" exists
1097
1667
 
1098
1668
  2. Command Execution:
@@ -1110,21 +1680,22 @@ Usage notes:
1110
1680
  - You can specify an optional timeout in milliseconds (up to ${MAX_TIMEOUT_MS}ms / ${MAX_TIMEOUT_MS / 6e4} minutes). If not specified, commands will timeout after ${DEFAULT_TIMEOUT_MS}ms (${DEFAULT_TIMEOUT_MS / 6e4} minutes).
1111
1681
  - It is very helpful if you write a clear, concise description of what this command does in 5-10 words.
1112
1682
  - If the output exceeds ${MAX_OUTPUT_LENGTH} characters, output will be truncated before being returned to you.
1113
- - You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${TOOL_NAME_BASH} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
1683
+ - You can use the \`run_in_background\` parameter to run the command in the background, which allows you to continue working while the command runs. You can monitor the output using the ${TOOL_NAME9} tool as it becomes available. You do not need to use '&' at the end of the command when using this parameter.
1114
1684
  ${sandboxPrompt}
1115
1685
  - Avoid using Bash with the \`find\`, \`grep\`, \`cat\`, \`head\`, \`tail\`, \`sed\`, \`awk\`, \`echo\`, \`ls\`, \`dir\`, or \`tree\` commands, unless explicitly instructed or when these commands are truly necessary for the task. Instead, always prefer using the dedicated tools for these commands:
1116
- - File search: Use ${TOOL_NAME_GLOB} (NOT find or ls)
1117
- - Directory structure and information: use ${TOOL_NAME_READ} (NOT ls/dir/tree)
1118
- - Content search: Use ${TOOL_NAME_GREP} (NOT grep or rg)
1119
- - Symbol navigation: Use ${TOOL_NAME_LSP} (NOT ctags/gtags)
1120
- - Read files: Use ${TOOL_NAME_READ} (NOT cat/head/tail)
1121
- - Edit files: Use ${TOOL_NAME_EDIT} (NOT sed/awk)
1122
- - Write files: Use ${TOOL_NAME_WRITE} (NOT echo >/cat <<EOF)
1686
+ - File search: Use ${TOOL_NAME5} (NOT find or ls)
1687
+ - Directory structure and information: use ${TOOL_NAME2} (NOT ls/dir/tree)
1688
+ - Content search: Use ${TOOL_NAME6} (NOT grep or rg)
1689
+ - Symbol navigation: Use ${TOOL_NAME7} (NOT ctags/gtags)
1690
+ - Read files: Use ${TOOL_NAME2} (NOT cat/head/tail)
1691
+ - Edit files: Use ${TOOL_NAME3} (NOT sed/awk)
1692
+ - Create directories/files for content writing: Use ${TOOL_NAME4} directly (NOT mkdir/touch first)
1693
+ - Write files: Use ${TOOL_NAME4} (NOT echo >/cat <<EOF)
1123
1694
  - Delete files: Use Delete (NOT rm/rmdir/del). Example: Delete({ file_paths: ["/path/to/file"] })
1124
1695
  - Communication: Output text directly (NOT echo/printf)
1125
1696
  - When issuing multiple commands:
1126
- - If the commands are independent and can run in parallel, make multiple ${TOOL_NAME_BASH} tool calls in a single message. For example, if you need to run "git status" and "git diff", send a single message with two ${TOOL_NAME_BASH} tool calls in parallel.
1127
- - If the commands depend on each other and must run sequentially, use a single ${TOOL_NAME_BASH} call with '&&' to chain them together (e.g., \`git add . && git commit -m "message" && git push\`). For instance, if one operation must complete before another starts (like mkdir before cp, Write before Bash for git operations, or git add before git commit), run these operations sequentially instead.
1697
+ - If the commands are independent and can run in parallel, make multiple ${TOOL_NAME9} tool calls in a single message. For example, if you need to run "git status" and "git diff", send a single message with two ${TOOL_NAME9} tool calls in parallel.
1698
+ - If the commands depend on each other and must run sequentially, use a single ${TOOL_NAME9} call with '&&' to chain them together (e.g., \`git add . && git commit -m "message" && git push\`). For instance, if one operation must complete before another starts (like mkdir before cp, Write before Bash for git operations, or git add before git commit), run these operations sequentially instead.
1128
1699
  - Use ';' only when you need to run commands sequentially but don't care if earlier commands fail
1129
1700
  - DO NOT use newlines to separate commands (newlines are ok in quoted strings)
1130
1701
  - Try to maintain your current working directory throughout the session by using absolute paths and avoiding usage of \`cd\`. You may use \`cd\` if the User explicitly requests it.
@@ -1174,7 +1745,7 @@ var MCPTool = {
1174
1745
  isConcurrencySafe() {
1175
1746
  return false;
1176
1747
  },
1177
- name: "mcp",
1748
+ name: TOOL_NAME,
1178
1749
  async description() {
1179
1750
  return DESCRIPTION;
1180
1751
  },
@@ -1588,8 +2159,25 @@ export {
1588
2159
  FallbackToolUseRejectedMessage,
1589
2160
  loadMergedSettings,
1590
2161
  normalizeSandboxRuntimeConfigFromSettings,
2162
+ TOOL_NAME2 as TOOL_NAME,
2163
+ DESCRIPTION2 as DESCRIPTION,
2164
+ PROMPT2 as PROMPT,
2165
+ TOOL_NAME3 as TOOL_NAME2,
2166
+ DESCRIPTION3 as DESCRIPTION2,
2167
+ TOOL_NAME4 as TOOL_NAME3,
2168
+ DESCRIPTION4 as DESCRIPTION3,
2169
+ PROMPT3 as PROMPT2,
2170
+ TOOL_NAME5 as TOOL_NAME4,
2171
+ DESCRIPTION5 as DESCRIPTION4,
2172
+ TOOL_NAME6 as TOOL_NAME5,
2173
+ DESCRIPTION6 as DESCRIPTION5,
2174
+ TOOL_NAME7 as TOOL_NAME6,
2175
+ PROMPT4 as PROMPT3,
2176
+ DESCRIPTION7 as DESCRIPTION6,
2177
+ TOOL_NAME8 as TOOL_NAME7,
1591
2178
  DEFAULT_TIMEOUT_MS,
1592
2179
  MAX_OUTPUT_LENGTH,
2180
+ TOOL_NAME9 as TOOL_NAME8,
1593
2181
  getBashToolPrompt,
1594
2182
  OutputLine,
1595
2183
  listPluginMCPServers,