pybao-cli 1.3.46 → 1.3.48

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 (156) hide show
  1. package/dist/REPL-OL7R2MJU.js +42 -0
  2. package/dist/{acp-37ZYIFLI.js → acp-JETRZ6P6.js} +26 -26
  3. package/dist/{agentsValidate-ZT2GD2IR.js → agentsValidate-VYC6EVAS.js} +7 -7
  4. package/dist/{ask-PSYWFNDP.js → ask-QPUWA3NO.js} +25 -25
  5. package/dist/{autoUpdater-HHBVZBYE.js → autoUpdater-635VM36P.js} +3 -3
  6. package/dist/{chunk-2TG6N7RM.js → chunk-2KKQDLKQ.js} +3 -3
  7. package/dist/{chunk-YOMMEAP6.js → chunk-5UB3SOX7.js} +1 -1
  8. package/dist/{chunk-XPNI6T7J.js → chunk-64WKFBDO.js} +4 -4
  9. package/dist/{chunk-HKQR7WT7.js → chunk-6RWWNWOS.js} +2 -2
  10. package/dist/{chunk-GCQTTFVA.js → chunk-7EP7KWCY.js} +3 -3
  11. package/dist/{chunk-HZDNEHQ4.js → chunk-ACTFQQFN.js} +3 -3
  12. package/dist/{chunk-AHDLGGNV.js → chunk-AS6JW5BZ.js} +1 -1
  13. package/dist/{chunk-AKPC4FCY.js → chunk-BSFVYDCB.js} +2 -2
  14. package/dist/{chunk-PN4VJABA.js → chunk-CO54QZDM.js} +3 -3
  15. package/dist/{chunk-FJROYNRY.js → chunk-D37O2VAS.js} +1 -1
  16. package/dist/{chunk-ZCIAAXXX.js → chunk-FXB6TMAI.js} +2 -2
  17. package/dist/{chunk-MLEJ32DL.js → chunk-GZLYNVI5.js} +2 -2
  18. package/dist/{chunk-K25LUESX.js → chunk-HD5FEXJG.js} +234 -34
  19. package/dist/chunk-HD5FEXJG.js.map +7 -0
  20. package/dist/{chunk-VWOTB6OP.js → chunk-HMJCUNVW.js} +1 -1
  21. package/dist/{chunk-WCSNMHIZ.js → chunk-IFC5ZQBA.js} +1 -1
  22. package/dist/{chunk-JWIWFXZH.js → chunk-JHLYQLDR.js} +2 -2
  23. package/dist/{chunk-J2QBYXHQ.js → chunk-K3UPGA4J.js} +4 -4
  24. package/dist/{chunk-QXB5JU22.js → chunk-NPDDRUQH.js} +3 -3
  25. package/dist/{chunk-O77VW2OG.js → chunk-Q2XSXVMZ.js} +3 -3
  26. package/dist/{chunk-YCIJ2LZ5.js → chunk-QYZDCRZY.js} +1 -1
  27. package/dist/{chunk-UJV74XPJ.js → chunk-RBBUU2DF.js} +3 -3
  28. package/dist/{chunk-FREXXRCP.js → chunk-RDR2NLZG.js} +160 -102
  29. package/dist/{chunk-FREXXRCP.js.map → chunk-RDR2NLZG.js.map} +3 -3
  30. package/dist/{chunk-BSKDTFG4.js → chunk-RIOIJXFA.js} +2 -2
  31. package/dist/{chunk-2B56EMQC.js → chunk-S47PTAAR.js} +19 -4
  32. package/dist/chunk-S47PTAAR.js.map +7 -0
  33. package/dist/{chunk-UH5XH34C.js → chunk-S5WP2LOV.js} +1 -1
  34. package/dist/{chunk-BKP3JI3M.js → chunk-SK5B5Y3H.js} +1 -1
  35. package/dist/{chunk-EL65JN4A.js → chunk-WDLD43PP.js} +1 -1
  36. package/dist/{cli-7ZDUHVBY.js → cli-AQ5YDYRF.js} +77 -77
  37. package/dist/commands-BY46LCQ7.js +46 -0
  38. package/dist/{config-GPGGIEEU.js → config-GSL2P4KS.js} +4 -4
  39. package/dist/{context-XHGQOQ7L.js → context-FF4G3DXK.js} +5 -5
  40. package/dist/{customCommands-SYMV4ZBK.js → customCommands-MDK4S56R.js} +4 -4
  41. package/dist/{env-3UORUGI7.js → env-IH7LGUF3.js} +2 -2
  42. package/dist/index.js +3 -3
  43. package/dist/{llm-Q5CFDHRJ.js → llm-6P5NDUEG.js} +26 -26
  44. package/dist/{llmLazy-SZPYON2Y.js → llmLazy-52ASU3EE.js} +1 -1
  45. package/dist/{loader-DYMAU5JI.js → loader-CDSPDRPD.js} +4 -4
  46. package/dist/{mcp-HYFQC5V2.js → mcp-Y6ETPNYP.js} +7 -7
  47. package/dist/{mentionProcessor-Y6I42D6Q.js → mentionProcessor-35VZ7W3E.js} +5 -5
  48. package/dist/{messages-BCVGUQ7P.js → messages-6XCXESET.js} +1 -1
  49. package/dist/{model-TCTZSQL7.js → model-ML44HYI7.js} +5 -5
  50. package/dist/{openai-KH7QFYJN.js → openai-RW3IN7KT.js} +5 -5
  51. package/dist/{outputStyles-C6NCFK57.js → outputStyles-Y24FUIIO.js} +4 -4
  52. package/dist/{pluginRuntime-T5ID6ROB.js → pluginRuntime-FIOM2MXH.js} +6 -6
  53. package/dist/{pluginValidation-C5BVZ5KJ.js → pluginValidation-GEXKXZ75.js} +6 -6
  54. package/dist/prompts-DILKYQ74.js +48 -0
  55. package/dist/{pybAgentSessionLoad-Z2HXKCCU.js → pybAgentSessionLoad-FX3IZ2TC.js} +4 -4
  56. package/dist/{pybAgentSessionResume-4SEGOPFC.js → pybAgentSessionResume-7477WJNJ.js} +4 -4
  57. package/dist/{pybAgentStreamJsonSession-4K7VFMRX.js → pybAgentStreamJsonSession-5WR47CJA.js} +1 -1
  58. package/dist/{pybHooks-QSPLL3AR.js → pybHooks-HRM55TSD.js} +4 -4
  59. package/dist/query-AYJOPC3P.js +50 -0
  60. package/dist/{ripgrep-D2EUEDNQ.js → ripgrep-M4TPNCDI.js} +3 -3
  61. package/dist/{skillMarketplace-Q4PH6E25.js → skillMarketplace-7H7CESZW.js} +3 -3
  62. package/dist/{state-Q4M7BXGL.js → state-XSKBKB2C.js} +2 -2
  63. package/dist/{theme-B3FIK2UP.js → theme-3IPDEBP7.js} +5 -5
  64. package/dist/{toolPermissionSettings-66WEVSDI.js → toolPermissionSettings-4H2H2JKG.js} +6 -6
  65. package/dist/tools-W7P3JOYP.js +47 -0
  66. package/dist/{userInput-UKA36YDI.js → userInput-65IUQX4I.js} +27 -27
  67. package/package.json +19 -4
  68. package/resources/tree-sitter/tree-sitter-bash.wasm +0 -0
  69. package/resources/tree-sitter/tree-sitter-c-sharp.wasm +0 -0
  70. package/resources/tree-sitter/tree-sitter-c.wasm +0 -0
  71. package/resources/tree-sitter/tree-sitter-c_sharp.wasm +0 -0
  72. package/resources/tree-sitter/tree-sitter-cpp.wasm +0 -0
  73. package/resources/tree-sitter/tree-sitter-css.wasm +0 -0
  74. package/resources/tree-sitter/tree-sitter-go.wasm +0 -0
  75. package/resources/tree-sitter/tree-sitter-haskell.wasm +0 -0
  76. package/resources/tree-sitter/tree-sitter-html.wasm +0 -0
  77. package/resources/tree-sitter/tree-sitter-java.wasm +0 -0
  78. package/resources/tree-sitter/tree-sitter-json.wasm +0 -0
  79. package/resources/tree-sitter/tree-sitter-julia.wasm +0 -0
  80. package/resources/tree-sitter/tree-sitter-nix.wasm +0 -0
  81. package/resources/tree-sitter/tree-sitter-ocaml.wasm +0 -0
  82. package/resources/tree-sitter/tree-sitter-python.wasm +0 -0
  83. package/resources/tree-sitter/tree-sitter-ruby.wasm +0 -0
  84. package/resources/tree-sitter/tree-sitter-rust.wasm +0 -0
  85. package/resources/tree-sitter/tree-sitter-scala.wasm +0 -0
  86. package/resources/tree-sitter/tree-sitter-swift.wasm +0 -0
  87. package/resources/tree-sitter/tree-sitter-tsx.wasm +0 -0
  88. package/resources/tree-sitter/tree-sitter-typescript.wasm +0 -0
  89. package/resources/tree-sitter/tree-sitter-yaml.wasm +0 -0
  90. package/resources/tree-sitter/tree-sitter.wasm +0 -0
  91. package/dist/REPL-ANRALQZB.js +0 -42
  92. package/dist/chunk-2B56EMQC.js.map +0 -7
  93. package/dist/chunk-K25LUESX.js.map +0 -7
  94. package/dist/commands-FGYR52JP.js +0 -46
  95. package/dist/prompts-IWS65CSD.js +0 -48
  96. package/dist/query-5OQI4E7J.js +0 -50
  97. package/dist/tools-HJT5SK6H.js +0 -47
  98. /package/dist/{REPL-ANRALQZB.js.map → REPL-OL7R2MJU.js.map} +0 -0
  99. /package/dist/{acp-37ZYIFLI.js.map → acp-JETRZ6P6.js.map} +0 -0
  100. /package/dist/{agentsValidate-ZT2GD2IR.js.map → agentsValidate-VYC6EVAS.js.map} +0 -0
  101. /package/dist/{ask-PSYWFNDP.js.map → ask-QPUWA3NO.js.map} +0 -0
  102. /package/dist/{autoUpdater-HHBVZBYE.js.map → autoUpdater-635VM36P.js.map} +0 -0
  103. /package/dist/{chunk-2TG6N7RM.js.map → chunk-2KKQDLKQ.js.map} +0 -0
  104. /package/dist/{chunk-YOMMEAP6.js.map → chunk-5UB3SOX7.js.map} +0 -0
  105. /package/dist/{chunk-XPNI6T7J.js.map → chunk-64WKFBDO.js.map} +0 -0
  106. /package/dist/{chunk-HKQR7WT7.js.map → chunk-6RWWNWOS.js.map} +0 -0
  107. /package/dist/{chunk-GCQTTFVA.js.map → chunk-7EP7KWCY.js.map} +0 -0
  108. /package/dist/{chunk-HZDNEHQ4.js.map → chunk-ACTFQQFN.js.map} +0 -0
  109. /package/dist/{chunk-AHDLGGNV.js.map → chunk-AS6JW5BZ.js.map} +0 -0
  110. /package/dist/{chunk-AKPC4FCY.js.map → chunk-BSFVYDCB.js.map} +0 -0
  111. /package/dist/{chunk-PN4VJABA.js.map → chunk-CO54QZDM.js.map} +0 -0
  112. /package/dist/{chunk-FJROYNRY.js.map → chunk-D37O2VAS.js.map} +0 -0
  113. /package/dist/{chunk-ZCIAAXXX.js.map → chunk-FXB6TMAI.js.map} +0 -0
  114. /package/dist/{chunk-MLEJ32DL.js.map → chunk-GZLYNVI5.js.map} +0 -0
  115. /package/dist/{chunk-VWOTB6OP.js.map → chunk-HMJCUNVW.js.map} +0 -0
  116. /package/dist/{chunk-WCSNMHIZ.js.map → chunk-IFC5ZQBA.js.map} +0 -0
  117. /package/dist/{chunk-JWIWFXZH.js.map → chunk-JHLYQLDR.js.map} +0 -0
  118. /package/dist/{chunk-J2QBYXHQ.js.map → chunk-K3UPGA4J.js.map} +0 -0
  119. /package/dist/{chunk-QXB5JU22.js.map → chunk-NPDDRUQH.js.map} +0 -0
  120. /package/dist/{chunk-O77VW2OG.js.map → chunk-Q2XSXVMZ.js.map} +0 -0
  121. /package/dist/{chunk-YCIJ2LZ5.js.map → chunk-QYZDCRZY.js.map} +0 -0
  122. /package/dist/{chunk-UJV74XPJ.js.map → chunk-RBBUU2DF.js.map} +0 -0
  123. /package/dist/{chunk-BSKDTFG4.js.map → chunk-RIOIJXFA.js.map} +0 -0
  124. /package/dist/{chunk-UH5XH34C.js.map → chunk-S5WP2LOV.js.map} +0 -0
  125. /package/dist/{chunk-BKP3JI3M.js.map → chunk-SK5B5Y3H.js.map} +0 -0
  126. /package/dist/{chunk-EL65JN4A.js.map → chunk-WDLD43PP.js.map} +0 -0
  127. /package/dist/{cli-7ZDUHVBY.js.map → cli-AQ5YDYRF.js.map} +0 -0
  128. /package/dist/{commands-FGYR52JP.js.map → commands-BY46LCQ7.js.map} +0 -0
  129. /package/dist/{config-GPGGIEEU.js.map → config-GSL2P4KS.js.map} +0 -0
  130. /package/dist/{context-XHGQOQ7L.js.map → context-FF4G3DXK.js.map} +0 -0
  131. /package/dist/{customCommands-SYMV4ZBK.js.map → customCommands-MDK4S56R.js.map} +0 -0
  132. /package/dist/{env-3UORUGI7.js.map → env-IH7LGUF3.js.map} +0 -0
  133. /package/dist/{llm-Q5CFDHRJ.js.map → llm-6P5NDUEG.js.map} +0 -0
  134. /package/dist/{llmLazy-SZPYON2Y.js.map → llmLazy-52ASU3EE.js.map} +0 -0
  135. /package/dist/{loader-DYMAU5JI.js.map → loader-CDSPDRPD.js.map} +0 -0
  136. /package/dist/{mcp-HYFQC5V2.js.map → mcp-Y6ETPNYP.js.map} +0 -0
  137. /package/dist/{mentionProcessor-Y6I42D6Q.js.map → mentionProcessor-35VZ7W3E.js.map} +0 -0
  138. /package/dist/{messages-BCVGUQ7P.js.map → messages-6XCXESET.js.map} +0 -0
  139. /package/dist/{model-TCTZSQL7.js.map → model-ML44HYI7.js.map} +0 -0
  140. /package/dist/{openai-KH7QFYJN.js.map → openai-RW3IN7KT.js.map} +0 -0
  141. /package/dist/{outputStyles-C6NCFK57.js.map → outputStyles-Y24FUIIO.js.map} +0 -0
  142. /package/dist/{pluginRuntime-T5ID6ROB.js.map → pluginRuntime-FIOM2MXH.js.map} +0 -0
  143. /package/dist/{pluginValidation-C5BVZ5KJ.js.map → pluginValidation-GEXKXZ75.js.map} +0 -0
  144. /package/dist/{prompts-IWS65CSD.js.map → prompts-DILKYQ74.js.map} +0 -0
  145. /package/dist/{pybAgentSessionLoad-Z2HXKCCU.js.map → pybAgentSessionLoad-FX3IZ2TC.js.map} +0 -0
  146. /package/dist/{pybAgentSessionResume-4SEGOPFC.js.map → pybAgentSessionResume-7477WJNJ.js.map} +0 -0
  147. /package/dist/{pybAgentStreamJsonSession-4K7VFMRX.js.map → pybAgentStreamJsonSession-5WR47CJA.js.map} +0 -0
  148. /package/dist/{pybHooks-QSPLL3AR.js.map → pybHooks-HRM55TSD.js.map} +0 -0
  149. /package/dist/{query-5OQI4E7J.js.map → query-AYJOPC3P.js.map} +0 -0
  150. /package/dist/{ripgrep-D2EUEDNQ.js.map → ripgrep-M4TPNCDI.js.map} +0 -0
  151. /package/dist/{skillMarketplace-Q4PH6E25.js.map → skillMarketplace-7H7CESZW.js.map} +0 -0
  152. /package/dist/{state-Q4M7BXGL.js.map → state-XSKBKB2C.js.map} +0 -0
  153. /package/dist/{theme-B3FIK2UP.js.map → theme-3IPDEBP7.js.map} +0 -0
  154. /package/dist/{toolPermissionSettings-66WEVSDI.js.map → toolPermissionSettings-4H2H2JKG.js.map} +0 -0
  155. /package/dist/{tools-HJT5SK6H.js.map → tools-W7P3JOYP.js.map} +0 -0
  156. /package/dist/{userInput-UKA36YDI.js.map → userInput-65IUQX4I.js.map} +0 -0
@@ -26,46 +26,47 @@ import {
26
26
  hasPermissionsToUseTool,
27
27
  hasReadPermission,
28
28
  hasWritePermission,
29
+ loadLanguage,
29
30
  query
30
- } from "./chunk-FREXXRCP.js";
31
+ } from "./chunk-RDR2NLZG.js";
31
32
  import {
32
33
  FallbackToolUseRejectedMessage,
33
34
  MCPTool,
34
35
  getClients,
35
36
  getMCPTools
36
- } from "./chunk-J2QBYXHQ.js";
37
+ } from "./chunk-K3UPGA4J.js";
37
38
  import {
38
39
  queryLLM
39
- } from "./chunk-XPNI6T7J.js";
40
+ } from "./chunk-64WKFBDO.js";
40
41
  import {
41
42
  tree
42
- } from "./chunk-EL65JN4A.js";
43
+ } from "./chunk-WDLD43PP.js";
43
44
  import {
44
45
  generateAgentId
45
- } from "./chunk-BSKDTFG4.js";
46
+ } from "./chunk-RIOIJXFA.js";
46
47
  import {
47
48
  getActiveAgents,
48
49
  getAgentByType,
49
50
  getAvailableAgentTypes
50
- } from "./chunk-MLEJ32DL.js";
51
+ } from "./chunk-GZLYNVI5.js";
51
52
  import {
52
53
  INTERRUPT_MESSAGE,
53
54
  createAssistantMessage,
54
55
  createUserMessage,
55
56
  getLastAssistantMessageId
56
- } from "./chunk-WCSNMHIZ.js";
57
+ } from "./chunk-IFC5ZQBA.js";
57
58
  import {
58
59
  getModelManager
59
- } from "./chunk-O77VW2OG.js";
60
+ } from "./chunk-Q2XSXVMZ.js";
60
61
  import {
61
62
  getContext
62
- } from "./chunk-UJV74XPJ.js";
63
+ } from "./chunk-RBBUU2DF.js";
63
64
  import {
64
65
  getTheme
65
- } from "./chunk-YCIJ2LZ5.js";
66
+ } from "./chunk-QYZDCRZY.js";
66
67
  import {
67
68
  debug
68
- } from "./chunk-FJROYNRY.js";
69
+ } from "./chunk-D37O2VAS.js";
69
70
  import {
70
71
  BunShell,
71
72
  getCwd,
@@ -74,7 +75,7 @@ import {
74
75
  logError,
75
76
  overwriteLog,
76
77
  readTaskOutput
77
- } from "./chunk-BKP3JI3M.js";
78
+ } from "./chunk-SK5B5Y3H.js";
78
79
  import {
79
80
  formatDuration,
80
81
  formatNumber
@@ -980,7 +981,7 @@ var DeleteTool = {
980
981
  return false;
981
982
  },
982
983
  needsPermissions({ file_paths }) {
983
- return file_paths.some((path) => !hasWritePermission(path));
984
+ return file_paths.some((path2) => !hasWritePermission(path2));
984
985
  },
985
986
  renderToolUseMessage(input, { verbose }) {
986
987
  const paths = input.file_paths.map(
@@ -1194,8 +1195,8 @@ var LSTool = {
1194
1195
  isConcurrencySafe() {
1195
1196
  return true;
1196
1197
  },
1197
- needsPermissions({ path }) {
1198
- return !hasReadPermission(path);
1198
+ needsPermissions({ path: path2 }) {
1199
+ return !hasReadPermission(path2);
1199
1200
  },
1200
1201
  async prompt() {
1201
1202
  return DESCRIPTION3;
@@ -1203,10 +1204,10 @@ var LSTool = {
1203
1204
  renderResultForAssistant(data) {
1204
1205
  return data;
1205
1206
  },
1206
- renderToolUseMessage({ path }, { verbose }) {
1207
- const absolutePath = path ? isAbsolute2(path) ? path : resolve2(getCwd(), path) : void 0;
1207
+ renderToolUseMessage({ path: path2 }, { verbose }) {
1208
+ const absolutePath = path2 ? isAbsolute2(path2) ? path2 : resolve2(getCwd(), path2) : void 0;
1208
1209
  const relativePath = absolutePath ? relative2(getCwd(), absolutePath) : ".";
1209
- return `path: "${verbose ? path : relativePath}"`;
1210
+ return `path: "${verbose ? path2 : relativePath}"`;
1210
1211
  },
1211
1212
  renderToolUseRejectedMessage() {
1212
1213
  return /* @__PURE__ */ React5.createElement(FallbackToolUseRejectedMessage, null);
@@ -1220,8 +1221,8 @@ var LSTool = {
1220
1221
  const MAX_DISPLAY_LINES = 10;
1221
1222
  return /* @__PURE__ */ React5.createElement(Box5, { justifyContent: "space-between", width: "100%" }, /* @__PURE__ */ React5.createElement(Box5, null, /* @__PURE__ */ React5.createElement(Text5, null, "\xA0\xA0\u23BF \xA0"), /* @__PURE__ */ React5.createElement(Box5, { flexDirection: "column", paddingLeft: 0 }, lines.slice(0, verbose ? void 0 : MAX_DISPLAY_LINES).map((line, i) => /* @__PURE__ */ React5.createElement(Text5, { key: i }, line)), !verbose && lines.length > MAX_DISPLAY_LINES && /* @__PURE__ */ React5.createElement(Text5, { color: getTheme().secondaryText }, "... (+", lines.length - MAX_DISPLAY_LINES, " lines)"))));
1222
1223
  },
1223
- async *call({ path }, { abortController }) {
1224
- const fullFilePath = isAbsolute2(path) ? path : resolve2(getCwd(), path);
1224
+ async *call({ path: path2 }, { abortController }) {
1225
+ const fullFilePath = isAbsolute2(path2) ? path2 : resolve2(getCwd(), path2);
1225
1226
  const treeOutput = await tree(
1226
1227
  fullFilePath,
1227
1228
  MAX_FILES_LIMIT,
@@ -1268,7 +1269,7 @@ This tool acts as your "Code Analyst". Use it to understand the codebase semanti
1268
1269
  ### 3. Exploring New Files (What's in here?)
1269
1270
  - **Scenario**: You just opened a large file \`utils.ts\` and want a quick overview.
1270
1271
  - **Action**: Use \`documentSymbol\`.
1271
- - **Why**: It returns a structured outline (Classes, Functions, Variables) so you can jump to relevant sections without reading line-by-line.
1272
+ - **Why**: It returns a structured outline (Classes, Functions, Variables) INSTANTLY using local parsing. It does NOT require a heavy LSP server to be running. Always try this first for new files.
1272
1273
 
1273
1274
  ### 4. Interface Implementation (Who implements this?)
1274
1275
  - **Scenario**: You see an interface \`IStorage\` and want to find the concrete class (e.g., \`S3Storage\`).
@@ -1940,7 +1941,7 @@ var BaseLspServer = class {
1940
1941
  return false;
1941
1942
  }
1942
1943
  }
1943
- getLocalBinPath(binName) {
1944
+ getLocalBinPath(binName, npmPackageName) {
1944
1945
  const ext = process.platform === "win32" ? ".cmd" : "";
1945
1946
  const localNodeModulesBin = join3(process.cwd(), "node_modules", ".bin");
1946
1947
  let localBinPath = join3(localNodeModulesBin, `${binName}${ext}`);
@@ -1948,13 +1949,7 @@ var BaseLspServer = class {
1948
1949
  return localBinPath;
1949
1950
  }
1950
1951
  try {
1951
- let pkgName = binName;
1952
- if (binName === "pyright-langserver") pkgName = "pyright";
1953
- if (binName === "intelephense") pkgName = "intelephense";
1954
- if (binName === "docker-langserver") pkgName = "dockerfile-language-server-nodejs";
1955
- if (binName === "vscode-html-language-server") pkgName = "vscode-langservers-extracted";
1956
- if (binName === "vscode-css-language-server") pkgName = "vscode-langservers-extracted";
1957
- if (binName === "vscode-json-language-server") pkgName = "vscode-langservers-extracted";
1952
+ const pkgName = npmPackageName || binName;
1958
1953
  const pkgEntry = __require.resolve(pkgName, { paths: [process.cwd(), __dirname] });
1959
1954
  let current = pkgEntry;
1960
1955
  let pkgRoot = "";
@@ -1997,7 +1992,7 @@ var GenericNpmServer = class extends BaseLspServer {
1997
1992
  if (this.isInPath(this.binName)) {
1998
1993
  return true;
1999
1994
  }
2000
- const localBin = this.getLocalBinPath(this.binName);
1995
+ const localBin = this.getLocalBinPath(this.binName, this.npmPackage);
2001
1996
  if (existsSync4(localBin)) {
2002
1997
  return true;
2003
1998
  }
@@ -2032,7 +2027,7 @@ var GenericNpmServer = class extends BaseLspServer {
2032
2027
  if (this.isInPath(this.binName)) {
2033
2028
  return { command: this.binName, args: this.args };
2034
2029
  }
2035
- const localBin = this.getLocalBinPath(this.binName);
2030
+ const localBin = this.getLocalBinPath(this.binName, this.npmPackage);
2036
2031
  if (existsSync4(localBin)) {
2037
2032
  return { command: localBin, args: this.args };
2038
2033
  }
@@ -2373,6 +2368,13 @@ var LspServerRegistry = class _LspServerRegistry {
2373
2368
  "tinymist",
2374
2369
  []
2375
2370
  ));
2371
+ this.register(new GenericBinaryServer(
2372
+ "metals",
2373
+ [".scala", ".sbt", ".sc"],
2374
+ ["build.sbt"],
2375
+ "metals",
2376
+ []
2377
+ ));
2376
2378
  this.register(new GenericBinaryServer(
2377
2379
  "haskell-language-server",
2378
2380
  [".hs", ".lhs"],
@@ -2553,6 +2555,173 @@ function formatGenericDocumentSymbolResult(result) {
2553
2555
  };
2554
2556
  }
2555
2557
 
2558
+ // src/utils/tree-sitter/registry.ts
2559
+ import path from "path";
2560
+ var ParserRegistry = class {
2561
+ static extensionMap = {
2562
+ ".ts": "typescript",
2563
+ ".tsx": "tsx",
2564
+ ".js": "typescript",
2565
+ // Use TS parser for JS
2566
+ ".jsx": "tsx",
2567
+ ".py": "python",
2568
+ ".sh": "bash",
2569
+ ".bash": "bash",
2570
+ ".rs": "rust",
2571
+ ".go": "go",
2572
+ ".java": "java",
2573
+ ".cpp": "cpp",
2574
+ ".c": "c",
2575
+ ".h": "c",
2576
+ ".cc": "cpp",
2577
+ ".cs": "c_sharp",
2578
+ ".scala": "scala",
2579
+ ".sbt": "scala",
2580
+ ".sc": "scala",
2581
+ ".hs": "haskell",
2582
+ ".lhs": "haskell",
2583
+ ".jl": "julia",
2584
+ ".ml": "ocaml",
2585
+ ".mli": "ocaml",
2586
+ ".swift": "swift",
2587
+ ".nix": "nix",
2588
+ ".rb": "ruby",
2589
+ ".html": "html",
2590
+ ".htm": "html",
2591
+ ".css": "css",
2592
+ ".json": "json",
2593
+ ".jsonc": "json",
2594
+ ".yaml": "yaml",
2595
+ ".yml": "yaml"
2596
+ };
2597
+ /**
2598
+ * Get the supported language ID for a given filename.
2599
+ * Returns null if the extension is not supported.
2600
+ */
2601
+ static getLanguage(filename) {
2602
+ const ext = path.extname(filename).toLowerCase();
2603
+ return this.extensionMap[ext] || null;
2604
+ }
2605
+ /**
2606
+ * Register or override a file extension mapping.
2607
+ */
2608
+ static registerExtension(ext, lang) {
2609
+ const normalizedExt = ext.startsWith(".") ? ext : `.${ext}`;
2610
+ this.extensionMap[normalizedExt.toLowerCase()] = lang;
2611
+ }
2612
+ };
2613
+
2614
+ // src/utils/tree-sitter/lsp-adapter.ts
2615
+ import { readFile } from "fs/promises";
2616
+ var SYMBOL_KIND_MAP = {
2617
+ // TypeScript / JavaScript
2618
+ function_declaration: "Function",
2619
+ method_definition: "Method",
2620
+ class_declaration: "Class",
2621
+ interface_declaration: "Interface",
2622
+ variable_declarator: "Variable",
2623
+ export_statement: "Module",
2624
+ // Python
2625
+ function_definition: "Function",
2626
+ class_definition: "Class",
2627
+ // Bash
2628
+ // function_definition is shared with Python/others
2629
+ // C#
2630
+ namespace_declaration: "Namespace",
2631
+ method_declaration: "Method",
2632
+ struct_declaration: "Struct",
2633
+ enum_declaration: "Enum",
2634
+ property_declaration: "Property",
2635
+ // class_declaration shared
2636
+ // interface_declaration shared
2637
+ // Go
2638
+ type_declaration: "Class",
2639
+ // often struct/interface
2640
+ field_declaration: "Field",
2641
+ // function_declaration shared
2642
+ // method_declaration shared
2643
+ // Rust
2644
+ function_item: "Function",
2645
+ struct_item: "Struct",
2646
+ enum_item: "Enum",
2647
+ impl_item: "Class",
2648
+ trait_item: "Interface",
2649
+ mod_item: "Module",
2650
+ // Java
2651
+ // class_declaration shared
2652
+ // method_declaration shared
2653
+ // interface_declaration shared
2654
+ // enum_declaration shared
2655
+ // Scala
2656
+ object_definition: "Class",
2657
+ trait_definition: "Interface",
2658
+ // class_definition shared with Python
2659
+ // function_definition shared with Python
2660
+ // Ruby
2661
+ module: "Module"
2662
+ // class shared
2663
+ // method shared
2664
+ // PHP
2665
+ // class_declaration shared
2666
+ // method_declaration shared
2667
+ // function_definition shared
2668
+ };
2669
+ var TreeSitterLspAdapter = class {
2670
+ static async getDocumentSymbols(filePath) {
2671
+ const langId = ParserRegistry.getLanguage(filePath);
2672
+ if (!langId) {
2673
+ console.warn(`No language found for file: ${filePath}`);
2674
+ return [];
2675
+ }
2676
+ try {
2677
+ const parser = await loadLanguage(langId);
2678
+ const content = await readFile(filePath, "utf-8");
2679
+ const tree2 = parser.parse(content);
2680
+ return this.collectSymbols(tree2.rootNode);
2681
+ } catch (error) {
2682
+ console.error(`Error parsing file ${filePath}:`, error);
2683
+ return [];
2684
+ }
2685
+ }
2686
+ static collectSymbols(node) {
2687
+ const symbols = [];
2688
+ const kind = SYMBOL_KIND_MAP[node.type];
2689
+ if (kind) {
2690
+ const name = this.getName(node);
2691
+ if (name) {
2692
+ const symbol = {
2693
+ name,
2694
+ kind,
2695
+ range: {
2696
+ start: { line: node.startPosition.row, character: node.startPosition.column },
2697
+ end: { line: node.endPosition.row, character: node.endPosition.column }
2698
+ },
2699
+ children: []
2700
+ };
2701
+ for (const child of node.namedChildren) {
2702
+ symbol.children?.push(...this.collectSymbols(child));
2703
+ }
2704
+ symbols.push(symbol);
2705
+ return symbols;
2706
+ }
2707
+ }
2708
+ for (const child of node.namedChildren) {
2709
+ symbols.push(...this.collectSymbols(child));
2710
+ }
2711
+ return symbols;
2712
+ }
2713
+ static getName(node) {
2714
+ const nameNode = node.childForFieldName("name");
2715
+ if (nameNode) return nameNode.text;
2716
+ for (const child of node.namedChildren) {
2717
+ if (child.type === "identifier" || child.type === "type_identifier") {
2718
+ return child.text;
2719
+ }
2720
+ }
2721
+ return null;
2722
+ }
2723
+ };
2724
+
2556
2725
  // src/tools/search/LspTool/LspTool.tsx
2557
2726
  var inputSchema6 = z6.strictObject({
2558
2727
  operation: z6.enum([
@@ -2720,6 +2889,37 @@ var LspTool = {
2720
2889
  },
2721
2890
  async *call(input, _context) {
2722
2891
  const absPath = getAbsolutePath(input.filePath) ?? input.filePath;
2892
+ if (input.operation === "documentSymbol") {
2893
+ const lang = ParserRegistry.getLanguage(absPath);
2894
+ if (lang) {
2895
+ try {
2896
+ const symbols = await TreeSitterLspAdapter.getDocumentSymbols(absPath);
2897
+ const formatSymbols = (syms, depth = 0) => {
2898
+ let text = "";
2899
+ const indent = " ".repeat(depth);
2900
+ for (const s of syms) {
2901
+ text += `${indent}- ${s.name} (${s.kind}) [Ln ${s.range.start.line + 1}]
2902
+ `;
2903
+ if (s.children && s.children.length > 0) {
2904
+ text += formatSymbols(s.children, depth + 1);
2905
+ }
2906
+ }
2907
+ return text;
2908
+ };
2909
+ const formatted = symbols.length > 0 ? formatSymbols(symbols) : "No symbols found.";
2910
+ const out2 = {
2911
+ operation: input.operation,
2912
+ result: formatted,
2913
+ filePath: input.filePath,
2914
+ resultCount: symbols.length,
2915
+ fileCount: 1
2916
+ };
2917
+ yield { type: "result", data: out2, resultForAssistant: out2.result };
2918
+ return;
2919
+ } catch (err) {
2920
+ }
2921
+ }
2922
+ }
2723
2923
  const client = await LspClientManager.getInstance().getClient(absPath, getCwd());
2724
2924
  if (client) {
2725
2925
  try {
@@ -3123,10 +3323,10 @@ function applyAgentPermissionMode(base, options) {
3123
3323
  }
3124
3324
  return { ...base, mode: options.agentPermissionMode };
3125
3325
  }
3126
- function readJsonArrayFile(path) {
3127
- if (!existsSync6(path)) return null;
3326
+ function readJsonArrayFile(path2) {
3327
+ if (!existsSync6(path2)) return null;
3128
3328
  try {
3129
- const raw = readFileSync4(path, "utf8");
3329
+ const raw = readFileSync4(path2, "utf8");
3130
3330
  const parsed = JSON.parse(raw);
3131
3331
  return Array.isArray(parsed) ? parsed : null;
3132
3332
  } catch {