pybao-cli 1.4.89 → 1.4.91

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 (162) hide show
  1. package/dist/REPL-XPMCTX6L.js +49 -0
  2. package/dist/{acp-SMGE3N7N.js → acp-WP36SKSE.js} +30 -30
  3. package/dist/{agentsValidate-FJNQTZ6L.js → agentsValidate-RQL2SLGC.js} +7 -7
  4. package/dist/{ask-2XWNVTSB.js → ask-D3IZ5ZRJ.js} +29 -29
  5. package/dist/{autoUpdater-7PB65YC7.js → autoUpdater-OMUHLOGO.js} +3 -3
  6. package/dist/{chunk-CSP6P6NO.js → chunk-2NGXOHGX.js} +2 -2
  7. package/dist/{chunk-YNDZ73R7.js → chunk-35DF6XKC.js} +2 -2
  8. package/dist/{chunk-3JTP3A2Y.js → chunk-3JJGOOVV.js} +1 -1
  9. package/dist/{chunk-JJSCNIBA.js → chunk-4IZGIKGU.js} +1 -1
  10. package/dist/{chunk-LV4FISWZ.js → chunk-5Z6IMMMW.js} +3 -3
  11. package/dist/{chunk-I72YSEMN.js → chunk-6FUTCMZK.js} +4 -4
  12. package/dist/{chunk-UNDLA4M4.js → chunk-7KPYOLFD.js} +3 -3
  13. package/dist/{chunk-A5255NE3.js → chunk-7VNU2ZKH.js} +1 -1
  14. package/dist/{chunk-67D6QME2.js → chunk-B5AO2OEN.js} +9 -1
  15. package/dist/chunk-B5AO2OEN.js.map +7 -0
  16. package/dist/{chunk-THQLFNKQ.js → chunk-B7YI7BZU.js} +3 -3
  17. package/dist/{chunk-IUXFIASK.js → chunk-BZRGSGVE.js} +3 -3
  18. package/dist/{chunk-YVW2YZZ3.js → chunk-C2LGKJSR.js} +3 -3
  19. package/dist/{chunk-KHSTNHZE.js → chunk-CHTGXWNW.js} +4 -4
  20. package/dist/{chunk-JW3MBSMJ.js → chunk-FNYI3AHB.js} +79 -404
  21. package/dist/chunk-FNYI3AHB.js.map +7 -0
  22. package/dist/{chunk-DRHWOS44.js → chunk-FSSXF2YS.js} +1 -1
  23. package/dist/{chunk-JDMIFTZT.js → chunk-FZAPDUPC.js} +1 -1
  24. package/dist/{chunk-RLD57RVF.js → chunk-GZ3J3MB7.js} +1 -1
  25. package/dist/{chunk-NZPUVS6K.js → chunk-IRVS47LS.js} +1 -1
  26. package/dist/{chunk-5DBEI4U3.js → chunk-KLFTZBHM.js} +2 -2
  27. package/dist/{chunk-4CTXCXJV.js → chunk-KSWPVLIN.js} +2 -2
  28. package/dist/{chunk-FYLGTG5A.js → chunk-KXCSPC5I.js} +4 -4
  29. package/dist/{chunk-YAC4ZESX.js → chunk-L5FMWVFJ.js} +2 -2
  30. package/dist/{chunk-R2BVICE2.js → chunk-LMF7SSDW.js} +1 -1
  31. package/dist/{chunk-HVJRX43N.js → chunk-MNVUFKYB.js} +839 -270
  32. package/dist/chunk-MNVUFKYB.js.map +7 -0
  33. package/dist/{chunk-UAMS53ZK.js → chunk-OM7XZWUN.js} +2 -2
  34. package/dist/{chunk-UIGWD3MR.js → chunk-PAW3JPND.js} +1 -1
  35. package/dist/{chunk-XAABWNGX.js → chunk-U3LLCIIX.js} +4 -4
  36. package/dist/{chunk-5DKBPIUY.js → chunk-UULWYB2S.js} +2 -2
  37. package/dist/{chunk-3WX6M33B.js → chunk-W3Z3A6JG.js} +164 -8
  38. package/dist/chunk-W3Z3A6JG.js.map +7 -0
  39. package/dist/{chunk-5N4LX65G.js → chunk-XUPHN5RT.js} +3 -3
  40. package/dist/{chunk-JQBOODVQ.js → chunk-Z7TKBN4K.js} +3 -3
  41. package/dist/{cli-PTMHC2XV.js → cli-IOYAJ3RP.js} +89 -89
  42. package/dist/commands-XLJTAJDU.js +53 -0
  43. package/dist/{config-MCXPTUSG.js → config-QOBUIJ2T.js} +4 -4
  44. package/dist/{context-ZJZSHKCR.js → context-T72O7CNM.js} +6 -6
  45. package/dist/{conversationTracker-A33U2LAZ.js → conversationTracker-DGV5IOEO.js} +3 -3
  46. package/dist/{customCommands-M7HD5SVI.js → customCommands-TB4PW6BZ.js} +4 -4
  47. package/dist/{env-XWJBXPMS.js → env-EN4O7GDK.js} +2 -2
  48. package/dist/{file-HSVA6LNE.js → file-GOVYPFCU.js} +4 -4
  49. package/dist/index.js +3 -3
  50. package/dist/{llm-UGJYESRH.js → llm-VY6QQH5B.js} +30 -30
  51. package/dist/{llmLazy-QEOEBBKC.js → llmLazy-ZRBSOAI6.js} +1 -1
  52. package/dist/{loader-R2QFYVHX.js → loader-6F76UNRR.js} +4 -4
  53. package/dist/{lsp-YN2SPF7O.js → lsp-RE4N652Z.js} +6 -6
  54. package/dist/{lspAnchor-J4GMFONT.js → lspAnchor-KQ2FF4JY.js} +6 -6
  55. package/dist/{mcp-O625QZ5R.js → mcp-ZE7PLYMD.js} +7 -7
  56. package/dist/{mentionProcessor-UPKZXHO4.js → mentionProcessor-7UT4VG43.js} +5 -5
  57. package/dist/{messages-3EGLQBFT.js → messages-JCHA3R7R.js} +1 -1
  58. package/dist/{model-7P6UKMPN.js → model-3NZZUFFU.js} +5 -5
  59. package/dist/{openai-J43QDBDS.js → openai-5MV5ABZF.js} +5 -5
  60. package/dist/{outputStyles-HANCH32Z.js → outputStyles-2HZOTSRS.js} +4 -4
  61. package/dist/{pluginRuntime-GQDZD5BX.js → pluginRuntime-R57OZ4VU.js} +6 -6
  62. package/dist/{pluginValidation-NMBEAEQW.js → pluginValidation-3BCKLZYR.js} +6 -6
  63. package/dist/prompts-QAJNDKD2.js +55 -0
  64. package/dist/{pybAgentSessionLoad-F67ZDP5H.js → pybAgentSessionLoad-X4LXVK5R.js} +4 -4
  65. package/dist/{pybAgentSessionResume-UC66IPGZ.js → pybAgentSessionResume-U5GJDTHH.js} +4 -4
  66. package/dist/{pybAgentStreamJsonSession-IO42JQAR.js → pybAgentStreamJsonSession-3Z5BYBNJ.js} +1 -1
  67. package/dist/{pybHooks-RTLJ2AV5.js → pybHooks-6272ZZXC.js} +4 -4
  68. package/dist/query-Y66ZKOAY.js +57 -0
  69. package/dist/{registry-4NUGUWGX.js → registry-4E7E4FW7.js} +5 -5
  70. package/dist/{ripgrep-GXECIJXM.js → ripgrep-QSJWXAK7.js} +13 -5
  71. package/dist/{skillMarketplace-VM4XNPW4.js → skillMarketplace-Z3ZMMNEG.js} +3 -3
  72. package/dist/{state-QPNSGH4C.js → state-35W4BKTE.js} +2 -2
  73. package/dist/{theme-ME74IEH2.js → theme-YUI56RAR.js} +5 -5
  74. package/dist/{toolPermissionSettings-4DJ7GGUG.js → toolPermissionSettings-RULNIKWU.js} +6 -6
  75. package/dist/tools-VGH43OZ7.js +54 -0
  76. package/dist/{userInput-BEZBVV52.js → userInput-UNVIW76K.js} +31 -31
  77. package/package.json +9 -1
  78. package/resources/ripgrep/COPYING +3 -0
  79. package/resources/ripgrep/arm64-darwin/rg +0 -0
  80. package/resources/ripgrep/arm64-linux/rg +0 -0
  81. package/resources/ripgrep/manifest.json +32 -0
  82. package/resources/ripgrep/x64-darwin/rg +0 -0
  83. package/resources/ripgrep/x64-linux/rg +0 -0
  84. package/resources/ripgrep/x64-win32/rg.exe +0 -0
  85. package/resources/tree-sitter/manifest.json +14 -0
  86. package/scripts/postinstall.js +23 -0
  87. package/dist/REPL-VRZRANK3.js +0 -49
  88. package/dist/chunk-3WX6M33B.js.map +0 -7
  89. package/dist/chunk-67D6QME2.js.map +0 -7
  90. package/dist/chunk-HVJRX43N.js.map +0 -7
  91. package/dist/chunk-JW3MBSMJ.js.map +0 -7
  92. package/dist/commands-52E2E77C.js +0 -53
  93. package/dist/prompts-OFPZUEBC.js +0 -55
  94. package/dist/query-KHETENT7.js +0 -57
  95. package/dist/tools-7V7X7CNV.js +0 -54
  96. /package/dist/{REPL-VRZRANK3.js.map → REPL-XPMCTX6L.js.map} +0 -0
  97. /package/dist/{acp-SMGE3N7N.js.map → acp-WP36SKSE.js.map} +0 -0
  98. /package/dist/{agentsValidate-FJNQTZ6L.js.map → agentsValidate-RQL2SLGC.js.map} +0 -0
  99. /package/dist/{ask-2XWNVTSB.js.map → ask-D3IZ5ZRJ.js.map} +0 -0
  100. /package/dist/{autoUpdater-7PB65YC7.js.map → autoUpdater-OMUHLOGO.js.map} +0 -0
  101. /package/dist/{chunk-CSP6P6NO.js.map → chunk-2NGXOHGX.js.map} +0 -0
  102. /package/dist/{chunk-YNDZ73R7.js.map → chunk-35DF6XKC.js.map} +0 -0
  103. /package/dist/{chunk-3JTP3A2Y.js.map → chunk-3JJGOOVV.js.map} +0 -0
  104. /package/dist/{chunk-JJSCNIBA.js.map → chunk-4IZGIKGU.js.map} +0 -0
  105. /package/dist/{chunk-LV4FISWZ.js.map → chunk-5Z6IMMMW.js.map} +0 -0
  106. /package/dist/{chunk-I72YSEMN.js.map → chunk-6FUTCMZK.js.map} +0 -0
  107. /package/dist/{chunk-UNDLA4M4.js.map → chunk-7KPYOLFD.js.map} +0 -0
  108. /package/dist/{chunk-A5255NE3.js.map → chunk-7VNU2ZKH.js.map} +0 -0
  109. /package/dist/{chunk-THQLFNKQ.js.map → chunk-B7YI7BZU.js.map} +0 -0
  110. /package/dist/{chunk-IUXFIASK.js.map → chunk-BZRGSGVE.js.map} +0 -0
  111. /package/dist/{chunk-YVW2YZZ3.js.map → chunk-C2LGKJSR.js.map} +0 -0
  112. /package/dist/{chunk-KHSTNHZE.js.map → chunk-CHTGXWNW.js.map} +0 -0
  113. /package/dist/{chunk-DRHWOS44.js.map → chunk-FSSXF2YS.js.map} +0 -0
  114. /package/dist/{chunk-JDMIFTZT.js.map → chunk-FZAPDUPC.js.map} +0 -0
  115. /package/dist/{chunk-RLD57RVF.js.map → chunk-GZ3J3MB7.js.map} +0 -0
  116. /package/dist/{chunk-NZPUVS6K.js.map → chunk-IRVS47LS.js.map} +0 -0
  117. /package/dist/{chunk-5DBEI4U3.js.map → chunk-KLFTZBHM.js.map} +0 -0
  118. /package/dist/{chunk-4CTXCXJV.js.map → chunk-KSWPVLIN.js.map} +0 -0
  119. /package/dist/{chunk-FYLGTG5A.js.map → chunk-KXCSPC5I.js.map} +0 -0
  120. /package/dist/{chunk-YAC4ZESX.js.map → chunk-L5FMWVFJ.js.map} +0 -0
  121. /package/dist/{chunk-R2BVICE2.js.map → chunk-LMF7SSDW.js.map} +0 -0
  122. /package/dist/{chunk-UAMS53ZK.js.map → chunk-OM7XZWUN.js.map} +0 -0
  123. /package/dist/{chunk-UIGWD3MR.js.map → chunk-PAW3JPND.js.map} +0 -0
  124. /package/dist/{chunk-XAABWNGX.js.map → chunk-U3LLCIIX.js.map} +0 -0
  125. /package/dist/{chunk-5DKBPIUY.js.map → chunk-UULWYB2S.js.map} +0 -0
  126. /package/dist/{chunk-5N4LX65G.js.map → chunk-XUPHN5RT.js.map} +0 -0
  127. /package/dist/{chunk-JQBOODVQ.js.map → chunk-Z7TKBN4K.js.map} +0 -0
  128. /package/dist/{cli-PTMHC2XV.js.map → cli-IOYAJ3RP.js.map} +0 -0
  129. /package/dist/{commands-52E2E77C.js.map → commands-XLJTAJDU.js.map} +0 -0
  130. /package/dist/{config-MCXPTUSG.js.map → config-QOBUIJ2T.js.map} +0 -0
  131. /package/dist/{context-ZJZSHKCR.js.map → context-T72O7CNM.js.map} +0 -0
  132. /package/dist/{conversationTracker-A33U2LAZ.js.map → conversationTracker-DGV5IOEO.js.map} +0 -0
  133. /package/dist/{customCommands-M7HD5SVI.js.map → customCommands-TB4PW6BZ.js.map} +0 -0
  134. /package/dist/{env-XWJBXPMS.js.map → env-EN4O7GDK.js.map} +0 -0
  135. /package/dist/{file-HSVA6LNE.js.map → file-GOVYPFCU.js.map} +0 -0
  136. /package/dist/{llm-UGJYESRH.js.map → llm-VY6QQH5B.js.map} +0 -0
  137. /package/dist/{llmLazy-QEOEBBKC.js.map → llmLazy-ZRBSOAI6.js.map} +0 -0
  138. /package/dist/{loader-R2QFYVHX.js.map → loader-6F76UNRR.js.map} +0 -0
  139. /package/dist/{lsp-YN2SPF7O.js.map → lsp-RE4N652Z.js.map} +0 -0
  140. /package/dist/{lspAnchor-J4GMFONT.js.map → lspAnchor-KQ2FF4JY.js.map} +0 -0
  141. /package/dist/{mcp-O625QZ5R.js.map → mcp-ZE7PLYMD.js.map} +0 -0
  142. /package/dist/{mentionProcessor-UPKZXHO4.js.map → mentionProcessor-7UT4VG43.js.map} +0 -0
  143. /package/dist/{messages-3EGLQBFT.js.map → messages-JCHA3R7R.js.map} +0 -0
  144. /package/dist/{model-7P6UKMPN.js.map → model-3NZZUFFU.js.map} +0 -0
  145. /package/dist/{openai-J43QDBDS.js.map → openai-5MV5ABZF.js.map} +0 -0
  146. /package/dist/{outputStyles-HANCH32Z.js.map → outputStyles-2HZOTSRS.js.map} +0 -0
  147. /package/dist/{pluginRuntime-GQDZD5BX.js.map → pluginRuntime-R57OZ4VU.js.map} +0 -0
  148. /package/dist/{pluginValidation-NMBEAEQW.js.map → pluginValidation-3BCKLZYR.js.map} +0 -0
  149. /package/dist/{prompts-OFPZUEBC.js.map → prompts-QAJNDKD2.js.map} +0 -0
  150. /package/dist/{pybAgentSessionLoad-F67ZDP5H.js.map → pybAgentSessionLoad-X4LXVK5R.js.map} +0 -0
  151. /package/dist/{pybAgentSessionResume-UC66IPGZ.js.map → pybAgentSessionResume-U5GJDTHH.js.map} +0 -0
  152. /package/dist/{pybAgentStreamJsonSession-IO42JQAR.js.map → pybAgentStreamJsonSession-3Z5BYBNJ.js.map} +0 -0
  153. /package/dist/{pybHooks-RTLJ2AV5.js.map → pybHooks-6272ZZXC.js.map} +0 -0
  154. /package/dist/{query-KHETENT7.js.map → query-Y66ZKOAY.js.map} +0 -0
  155. /package/dist/{registry-4NUGUWGX.js.map → registry-4E7E4FW7.js.map} +0 -0
  156. /package/dist/{ripgrep-GXECIJXM.js.map → ripgrep-QSJWXAK7.js.map} +0 -0
  157. /package/dist/{skillMarketplace-VM4XNPW4.js.map → skillMarketplace-Z3ZMMNEG.js.map} +0 -0
  158. /package/dist/{state-QPNSGH4C.js.map → state-35W4BKTE.js.map} +0 -0
  159. /package/dist/{theme-ME74IEH2.js.map → theme-YUI56RAR.js.map} +0 -0
  160. /package/dist/{toolPermissionSettings-4DJ7GGUG.js.map → toolPermissionSettings-RULNIKWU.js.map} +0 -0
  161. /package/dist/{tools-7V7X7CNV.js.map → tools-VGH43OZ7.js.map} +0 -0
  162. /package/dist/{userInput-BEZBVV52.js.map → userInput-UNVIW76K.js.map} +0 -0
@@ -10,7 +10,6 @@ import {
10
10
  GlobTool,
11
11
  GrepTool,
12
12
  KillShellTool,
13
- MessageResponse,
14
13
  NotebookEditTool,
15
14
  SkillTool,
16
15
  SlashCommandTool,
@@ -34,60 +33,57 @@ import {
34
33
  runWithTaskListEnv,
35
34
  runWithTaskListId,
36
35
  updateTask
37
- } from "./chunk-HVJRX43N.js";
38
- import {
39
- getCurrentSessionId
40
- } from "./chunk-XKYHFZEC.js";
36
+ } from "./chunk-MNVUFKYB.js";
41
37
  import {
42
38
  queryLLM
43
- } from "./chunk-XAABWNGX.js";
39
+ } from "./chunk-U3LLCIIX.js";
44
40
  import {
45
41
  FallbackToolUseRejectedMessage,
46
42
  MCPTool,
47
43
  getClients,
48
44
  getMCPTools
49
- } from "./chunk-KHSTNHZE.js";
45
+ } from "./chunk-CHTGXWNW.js";
50
46
  import {
51
47
  emitReminderEvent
52
- } from "./chunk-YAC4ZESX.js";
48
+ } from "./chunk-L5FMWVFJ.js";
53
49
  import {
54
50
  getActiveAgents,
55
51
  getAgentByType,
56
52
  getAvailableAgentTypes
57
- } from "./chunk-5DBEI4U3.js";
53
+ } from "./chunk-KLFTZBHM.js";
58
54
  import {
59
55
  INTERRUPT_MESSAGE,
60
56
  createAssistantMessage,
61
57
  createUserMessage,
62
58
  getLastAssistantMessageId
63
- } from "./chunk-A5255NE3.js";
59
+ } from "./chunk-7VNU2ZKH.js";
64
60
  import {
65
61
  formatDuration,
66
62
  formatNumber
67
63
  } from "./chunk-OUXHGDLH.js";
68
64
  import {
69
65
  getAbsolutePath
70
- } from "./chunk-UAMS53ZK.js";
66
+ } from "./chunk-OM7XZWUN.js";
71
67
  import {
72
68
  LspFacade,
73
69
  formatDiagnosticsPretty
74
- } from "./chunk-I72YSEMN.js";
70
+ } from "./chunk-6FUTCMZK.js";
75
71
  import {
76
72
  getModelManager
77
- } from "./chunk-UNDLA4M4.js";
73
+ } from "./chunk-7KPYOLFD.js";
78
74
  import {
79
75
  getContext
80
- } from "./chunk-FYLGTG5A.js";
76
+ } from "./chunk-KXCSPC5I.js";
81
77
  import {
82
78
  filesToTree,
83
79
  ripGrepWithStatus
84
- } from "./chunk-3WX6M33B.js";
80
+ } from "./chunk-W3Z3A6JG.js";
85
81
  import {
86
82
  getTheme
87
- } from "./chunk-R2BVICE2.js";
83
+ } from "./chunk-LMF7SSDW.js";
88
84
  import {
89
85
  debug
90
- } from "./chunk-UIGWD3MR.js";
86
+ } from "./chunk-PAW3JPND.js";
91
87
  import {
92
88
  BunShell,
93
89
  getCwd,
@@ -98,7 +94,7 @@ import {
98
94
  overwriteLog,
99
95
  readTaskOutput,
100
96
  resolveXdgDataPath
101
- } from "./chunk-DRHWOS44.js";
97
+ } from "./chunk-FSSXF2YS.js";
102
98
 
103
99
  // src/tools/index.ts
104
100
  import { memoize as memoize2 } from "lodash-es";
@@ -777,7 +773,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
777
773
  if (exitCode !== 0 || errorCount > 0 || warningCount > 0) {
778
774
  try {
779
775
  const { isAbsolute: isAbsolute3, resolve: resolve4 } = await import("path");
780
- const { getSessionRoot: getSessionRoot2 } = await import("./state-QPNSGH4C.js");
776
+ const { getSessionRoot: getSessionRoot2 } = await import("./state-35W4BKTE.js");
781
777
  const lines = output.split("\n");
782
778
  const uniqueFiles = /* @__PURE__ */ new Set();
783
779
  const lspSuggestions = [];
@@ -1150,7 +1146,7 @@ var DeleteTool = {
1150
1146
  }
1151
1147
  if (!force) {
1152
1148
  try {
1153
- const { LspFacade: LspFacade2 } = await import("./lsp-YN2SPF7O.js");
1149
+ const { LspFacade: LspFacade2 } = await import("./lsp-RE4N652Z.js");
1154
1150
  const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
1155
1151
  if (referenceDetail) {
1156
1152
  failedItems.push(
@@ -1326,7 +1322,7 @@ var DESCRIPTION3 = `\u5217\u51FA\u6307\u5B9A\u76EE\u5F55\u7684\u4E00\u5C42\u5B8C
1326
1322
 
1327
1323
  \u7528\u6CD5\uFF1A
1328
1324
  1. **\u5FFD\u7565\u89C4\u5219**\uFF1A\u4F7F\u7528 \`ignore\` \u6392\u9664\u566A\u97F3\u8DEF\u5F84\u4EE5\u51CF\u5C11\u8F93\u51FA\u3002\u9ED8\u8BA4\u5FFD\u7565\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\uFF08\u5982 node_modules\u3001dist\uFF09\u3002
1329
- 2. **\u76EE\u5F55\u7ED3\u6784\u4FE1\u606F**\uFF1A\u8F93\u51FA\u6307\u5B9A\u76EE\u5F55\u7ED3\u6784\u4E0E\u5305\u542B [\u76EE\u5F55\u7ED3\u6784\u4FE1\u606F] + [\u76EE\u5F55\u9876\u5C42\u7ED3\u6784\u89C6\u56FE] + [\u76EE\u5F55\u6838\u5FC3\u7ED3\u6784\u6811\u89C6\u56FE]\u7684\u4FE1\u606F\u3002
1325
+ 2. **\u76EE\u5F55\u7ED3\u6784\u4FE1\u606F**\uFF1A\u8F93\u51FA\u6307\u5B9A\u76EE\u5F55\u7ED3\u6784\u5E76\u5305\u542B [\u76EE\u5F55\u7ED3\u6784\u4FE1\u606F] + [\u76EE\u5F55\u9876\u5C42\u7ED3\u6784\u89C6\u56FE]\uFF08\u4E00\u5C42\u76EE\u5F55\u4E0E\u9876\u5C42\u6587\u4EF6\uFF09\u4FE1\u606F\u3002
1330
1326
 
1331
1327
  ## Search Strategy
1332
1328
  - **\u5206\u5C42\u63A2\u7D22\u6A21\u5F0F**: \u4ECE\u6839\u76EE\u5F55\u5F00\u59CB\uFF0C\u9010\u5C42\u6DF1\u5165\u3002
@@ -1342,7 +1338,7 @@ var DESCRIPTION3 = `\u5217\u51FA\u6307\u5B9A\u76EE\u5F55\u7684\u4E00\u5C42\u5B8C
1342
1338
  - Grep \u2192 \u5B9A\u4F4D\u5177\u4F53\u6587\u4EF6\u6216\u7B26\u53F7
1343
1339
 
1344
1340
  \u8BF4\u660E\uFF1A
1345
- - BFS \u4F1A\u4F18\u5148\u5C55\u793A\u9876\u5C42\uFF08\u6839\u76EE\u5F55\uFF09\u7ED3\u6784\uFF0C\u5373\u4F7F\u8F93\u51FA\u88AB\u622A\u65AD\u3002
1341
+ - \u9ED8\u8BA4\u4EC5\u8F93\u51FA\u4E00\u5C42\u76EE\u5F55\u7ED3\u6784\u4E0E\u7EDF\u8BA1\u4FE1\u606F\u3002
1346
1342
  - path \u53C2\u6570\u5FC5\u987B\u4E3A\u7EDD\u5BF9\u8DEF\u5F84\u3002
1347
1343
  - \u8DEF\u5F84\u6765\u6E90\u7EA6\u675F\uFF1A\u5F53\u8DEF\u5F84\u975E\u7528\u6237\u63D0\u4F9B\u65F6\uFF0C\u5FC5\u987B\u5148\u7528 LS/Glob \u786E\u8BA4\u7236\u7EA7\u76EE\u5F55\u5B58\u5728\uFF0C\u518D\u5BF9\u4E0B\u7EA7\u8DEF\u5F84\u6267\u884C LS\u3002
1348
1344
  - \u5BF9\u5019\u9009\u5B50\u76EE\u5F55\u7EE7\u7EED LS \u6216\u7528 Glob/Grep \u6536\u655B\u3002
@@ -1350,16 +1346,21 @@ var DESCRIPTION3 = `\u5217\u51FA\u6307\u5B9A\u76EE\u5F55\u7684\u4E00\u5C42\u5B8C
1350
1346
  - \u5927\u578B\u4ED3\u5E93\u907F\u514D\u5BF9\u5168\u91CF\u8DEF\u5F84\u53CD\u590D LS\uFF0C\u4F18\u5148\u5206\u7247\u6216\u805A\u7126\u76EE\u5F55\u8303\u56F4\u3002
1351
1347
 
1352
1348
  \u9002\u7528\u573A\u666F\uFF1A
1353
- - \u5FEB\u901F\u4E86\u89E3\u9879\u76EE\u6216\u6307\u5B9A\u76EE\u5F55\u7684\u9876\u5C42\uFF08\u6839\u76EE\u5F55\uFF09\u6587\u4EF6\u76EE\u5F55\u4FE1\u606F\u548C\u76EE\u5F55\u6811\u7ED3\u6784
1354
- - \u9700\u8981\u6DF1\u5165\u5206\u6790\u4EE3\u7801\u5E93\u6216\u529F\u80FD\u7B49\u65F6\u4F5C\u4E3A\u91CD\u8981\u7684\u5E7F\u5EA6\u4F18\u5148\u7684\u76EE\u5F55\u7ED3\u6784\u5206\u6790\u5DE5\u5177\u3002
1349
+ - \u5FEB\u901F\u4E86\u89E3\u9879\u76EE\u6216\u6307\u5B9A\u76EE\u5F55\u7684\u4E00\u5C42\u6587\u4EF6\u76EE\u5F55\u4FE1\u606F\u4E0E\u7EDF\u8BA1\u4FE1\u606F
1350
+ - \u9700\u8981\u6DF1\u5165\u5206\u6790\u4EE3\u7801\u5E93\u6216\u529F\u80FD\u65F6\uFF0C\u4F5C\u4E3A\u76EE\u5F55\u5165\u53E3\u5B9A\u4F4D\u5DE5\u5177\uFF0C\u4E0E Glob/Grep \u914D\u5408\u4F7F\u7528
1355
1351
  - \u521D\u6B21\u63A2\u7D22\u65B0\u9879\u76EE\u65F6\u3002
1356
1352
  - \u5728\u6587\u4EF6\u7CFB\u7EDF\u4E2D\u51FA\u73B0\u8FF7\u5931\u65B9\u5411\u6216\u4E0E\u5B9E\u9645\u8981\u6C42\u4E0D\u7B26\u65F6\u3002
1357
1353
  `.trim();
1358
1354
 
1359
1355
  // src/tools/lsTool/lsTool.tsx
1360
- var MAX_FILES_LIMIT = 100;
1361
- var TOP_LEVEL_LIMIT = 2e3;
1362
- var DISPLAY_LINE_LIMIT = 15;
1356
+ var MAX_FILES_LIMIT = 0;
1357
+ var TOP_LEVEL_LIMIT = 5e3;
1358
+ var DISPLAY_LINE_LIMIT = 10;
1359
+ var isEnabledFlag = (raw, defaultValue = false) => {
1360
+ const normalized = String(raw ?? "").trim().toLowerCase();
1361
+ if (!normalized) return defaultValue;
1362
+ return normalized === "1" || normalized === "true" || normalized === "on" || normalized === "yes";
1363
+ };
1363
1364
  var DEFAULT_IGNORE_PATTERNS = [
1364
1365
  "node_modules/",
1365
1366
  "__pycache__/",
@@ -1496,47 +1497,14 @@ var LSTool = {
1496
1497
  );
1497
1498
  }).sort((a, b) => a.normalized.localeCompare(b.normalized));
1498
1499
  const totalCount = fileEntries.length;
1499
- const truncated = totalCount > MAX_FILES_LIMIT;
1500
- const selectedEntries = truncated ? fileEntries.slice(0, MAX_FILES_LIMIT) : fileEntries;
1501
- const excludedEntries = truncated ? fileEntries.slice(MAX_FILES_LIMIT) : [];
1502
- const selectedFiles = selectedEntries.map((entry) => entry.absolutePath);
1503
- let treeOutput = filesToTree(
1504
- selectedFiles,
1505
- fullFilePath,
1506
- Number.MAX_SAFE_INTEGER
1507
- );
1508
1500
  const topLevelResult = buildTopLevelTree(fullFilePath);
1509
1501
  const { totalDirectories, maxDepth } = getDirectoryStats(
1510
1502
  fileEntries.map((entry) => entry.normalized)
1511
1503
  );
1512
- const selectedDirectories = getDirectorySet(
1513
- selectedEntries.map((entry) => entry.normalized)
1514
- );
1515
- const excludedDirectories = getDirectorySet(
1516
- excludedEntries.map((entry) => entry.normalized)
1517
- );
1518
- const notShownDirectoryCount = Array.from(excludedDirectories).filter(
1519
- (dir) => !selectedDirectories.has(dir)
1520
- ).length;
1521
- const notShownFileCount = truncated ? totalCount - selectedEntries.length : 0;
1522
1504
  const ratioText = totalCount === 0 ? "0.00" : (totalDirectories / totalCount).toFixed(2);
1523
1505
  const structureInfo = `[\u76EE\u5F55\u7ED3\u6784\u4FE1\u606F]\u9876\u5C42\u76EE\u5F55\u6570\uFF1A${topLevelResult.directoryCount}\u4E2A\uFF0C\u9876\u5C42\u6587\u4EF6\u6570\uFF1A${topLevelResult.fileCount}\u4E2A\uFF0C\u603B\u76EE\u5F55\u6570\uFF1A${totalDirectories}\u4E2A\uFF0C\u603B\u6587\u4EF6\u6570\uFF1A${totalCount}\u4E2A\uFF0C\u603B\u76EE\u5F55/\u603B\u6587\u4EF6\u6BD4\u4F8B=${ratioText}\uFF0C\u6700\u6DF1\u76EE\u5F55\u5C42\u7EA7=${maxDepth}\u3002\uFF08\u7EDF\u8BA1\u6570\u636E\u4E0D\u5305\u542B\u7A7A\u76EE\u5F55\u4EE5\u53CA\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\u7B49\u6587\u4EF6\u6216\u76EE\u5F55\uFF09`;
1524
- const treeLines = treeOutput ? treeOutput.split("\n") : [];
1525
- const omittedLines = Math.max(0, treeLines.length - DISPLAY_LINE_LIMIT);
1506
+ const coreTreeEnabled = isEnabledFlag(process.env.PYB_LS_ENABLE_CORE_TREE, false);
1526
1507
  const warnings = [];
1527
- if (truncated) {
1528
- warnings.push(
1529
- "Truncated directory tree: this is a partial view. Use LS on subdirectories or Glob to narrow the scope before further search."
1530
- );
1531
- warnings.push(
1532
- `[\u76EE\u5F55\u6811\u622A\u65AD\u63D0\u9192]\u5F53\u524D\u76EE\u5F55\u7ED3\u6784\u56E0\u8D85\u8FC7\u5C55\u793A\u9600\u503C\u88AB\u622A\u65AD\uFF0C\u672A\u5C55\u793A\u6587\u4EF6\u6570=${notShownFileCount}\uFF0C\u672A\u663E\u793A\u76EE\u5F55\u6570=${notShownDirectoryCount}\uFF0C\u672A\u663E\u793A\u884C\u6570=${omittedLines} lines\uFF08\u7EDF\u8BA1\u6570\u636E\u4E0D\u5305\u542B\u7A7A\u76EE\u5F55\u4EE5\u53CA\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\u7B49\u6587\u4EF6\u6216\u76EE\u5F55\uFF09\u3002\u8BE5\u8F93\u51FA\u4E3A\u90E8\u5206\u89C6\u56FE\uFF0C\u672A\u51FA\u73B0\u8DEF\u5F84\u4E0D\u5F97\u7528\u4E8E\u5B9A\u4F4D\u3002\u4F9D\u636E\u5F53\u524D\u9879\u76EE\u7ED3\u6784\u7EDF\u8BA1\u6570\u636E\uFF0C\u53EF\u521D\u6B65\u8FDB\u884C\u9879\u76EE\u7ED3\u6784\u590D\u6742\u5EA6\u5206\u6790\uFF1A1 \u603B\u76EE\u5F55/\u603B\u6587\u4EF6\u6BD4\u4F8B\u9AD8 \u2192 \u7ED3\u6784\u66F4\u788E\u3001\u5C42\u7EA7\u53EF\u80FD\u66F4\u7EC6\uFF0C\u590D\u6742\u5EA6\u503E\u5411\u66F4\u9AD8\u30022 \u6700\u6DF1\u5C42\u7EA7\u5927 \u2192 \u6DF1\u5C42\u5D4C\u5957\u660E\u663E\uFF0C\u5BFC\u822A\u4E0E\u5B9A\u4F4D\u6210\u672C\u66F4\u9AD8\u30023 \u9876\u5C42\u76EE\u5F55\u6570\u591A \u2192 \u6A21\u5757\u5165\u53E3\u5206\u6563\uFF0C\u9700\u66F4\u4E25\u683C\u5206\u5C42\u786E\u8BA4\u30024 \u6587\u4EF6\u603B\u91CF\u5927 \u2192 \u66F4\u5BB9\u6613\u89E6\u53D1\u8F93\u51FA\u622A\u65AD\u3002\u5904\u7406\u6D41\u7A0B\uFF1A\u590D\u6742\u5EA6\u4F4E \u2192 \u53EF\u76F4\u63A5 LS \u83B7\u53D6\u7ED3\u6784\u7EBF\u7D22\u540E\u8FDB\u5165\u5B9A\u4F4D\uFF1B\u590D\u6742\u5EA6\u9AD8 \u2192 \u5148\u7528 LS \u83B7\u53D6\u9876\u5C42\u7EBF\u7D22\uFF0C\u518D\u7528 Glob \u5206\u5C42\u786E\u8BA4\u8DEF\u5F84\u3002`
1533
- );
1534
- warnings.push("\u82E5\u9700\u6DF1\u5165\u5206\u6790\u5EFA\u8BAE\u5982\u4E0B\u5206\u6B65\u52A8\u4F5C\uFF08\u5C24\u5176\u76EE\u5F55\u7ED3\u6784\u590D\u6742\u5EA6\u8F83\u9AD8\u65F6\uFF09\uFF1A");
1535
- warnings.push("1) \u5C06\u5F53\u524D\u9876\u5C42\u4F5C\u4E3A\u7EBF\u7D22\uFF0C\u4F18\u5148\u7528 LS \u5BF9\u5019\u9009\u9876\u5C42\u76EE\u5F55\u9010\u5C42\u786E\u8BA4\u7ED3\u6784\u3002");
1536
- warnings.push("2) \u5728\u5DF2\u786E\u8BA4\u7684\u5019\u9009\u76EE\u5F55\u4E0B\uFF0C\u4F7F\u7528 Glob dir/* \u4E0E dir/*/ \u7EC6\u5316\u8DEF\u5F84\u5B58\u5728\u6027\u3002");
1537
- warnings.push("3) \u5982\u9700\u66F4\u5E7F\u5339\u914D\uFF0C\u53EF\u7528 Glob dir/** \u4E0E dir/**/* \u7F29\u5C0F\u5230\u6A21\u5757\u7EA7\u8303\u56F4\u3002");
1538
- warnings.push("4) \u5728\u5DF2\u786E\u8BA4\u76EE\u5F55\u5185\u4F7F\u7528 Grep/\u8BED\u4E49\u641C\u7D22\u5B9A\u4F4D\u6587\u4EF6\u6216\u7B26\u53F7\u3002");
1539
- }
1540
1508
  if (topLevelResult.truncated) {
1541
1509
  warnings.push(
1542
1510
  `TOP-LEVEL TRUNCATED: \u9876\u5C42\u6761\u76EE=${topLevelResult.totalCount}; \u4E0A\u9650=${TOP_LEVEL_LIMIT}\u3002\u5982\u9700\u5B8C\u6574\u7ED3\u679C\uFF0C\u9010\u5C42\u7F29\u5C0F\u8303\u56F4\u5E76\u5206\u6B65\u786E\u8BA4\u3002`
@@ -1545,22 +1513,60 @@ var LSTool = {
1545
1513
  const rootLabel = fullFilePath.endsWith(sep2) ? fullFilePath : `${fullFilePath}${sep2}`;
1546
1514
  const topLevelView = `[\u76EE\u5F55\u9876\u5C42\u7ED3\u6784\u89C6\u56FE]
1547
1515
  ${topLevelResult.treeOutput}`;
1548
- const mainTreeHeader = truncated ? `[\u76EE\u5F55\u6838\u5FC3\u7ED3\u6784\u6811\u89C6\u56FE]\u6811\u7ED3\u6784\u8D85\u51FA\u9600\u503C\u88AB\u622A\u65AD\uFF0C\u672A\u663E\u793A\u6587\u4EF6\u6570=${notShownFileCount}\uFF0C\u672A\u663E\u793A\u76EE\u5F55\u6570=${notShownDirectoryCount}\uFF08\u7EDF\u8BA1\u6570\u636E\u4E0D\u5305\u542B\u7A7A\u76EE\u5F55\u4EE5\u53CA\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\u7B49\u6587\u4EF6\u6216\u76EE\u5F55\uFF09` : "";
1549
- const rootName = basename(fullFilePath) || ".";
1550
- const hasRootLine = treeLines.length > 0 && treeLines[0] === rootName;
1551
- const treeBodyLines = hasRootLine ? treeLines.slice(1) : treeLines;
1552
- const treeBody = treeBodyLines.join("\n");
1553
- const mainTreeOutput = treeBody ? `${rootLabel}
1554
- ${treeBody}` : rootLabel;
1555
1516
  const separator = "----------------------------------------";
1556
1517
  const outputParts = [
1557
1518
  structureInfo,
1558
1519
  separator,
1559
- topLevelView,
1560
- separator,
1561
- mainTreeHeader,
1562
- mainTreeOutput
1563
- ].filter(Boolean);
1520
+ topLevelView
1521
+ ];
1522
+ if (coreTreeEnabled) {
1523
+ const truncated = totalCount > MAX_FILES_LIMIT;
1524
+ const selectedEntries = truncated ? fileEntries.slice(0, MAX_FILES_LIMIT) : fileEntries;
1525
+ const excludedEntries = truncated ? fileEntries.slice(MAX_FILES_LIMIT) : [];
1526
+ const selectedFiles = selectedEntries.map((entry) => entry.absolutePath);
1527
+ const treeOutput = filesToTree(
1528
+ selectedFiles,
1529
+ fullFilePath,
1530
+ Number.MAX_SAFE_INTEGER
1531
+ );
1532
+ const treeLines = treeOutput ? treeOutput.split("\n") : [];
1533
+ const omittedLines = Math.max(0, treeLines.length - DISPLAY_LINE_LIMIT);
1534
+ const selectedDirectories = getDirectorySet(
1535
+ selectedEntries.map((entry) => entry.normalized)
1536
+ );
1537
+ const excludedDirectories = getDirectorySet(
1538
+ excludedEntries.map((entry) => entry.normalized)
1539
+ );
1540
+ const notShownDirectoryCount = Array.from(excludedDirectories).filter(
1541
+ (dir) => !selectedDirectories.has(dir)
1542
+ ).length;
1543
+ const notShownFileCount = truncated ? totalCount - selectedEntries.length : 0;
1544
+ if (truncated) {
1545
+ warnings.push(
1546
+ "Truncated directory tree: this is a partial view. Use LS on subdirectories or Glob to narrow the scope before further search."
1547
+ );
1548
+ warnings.push(
1549
+ `[\u76EE\u5F55\u6811\u622A\u65AD\u63D0\u9192]\u5F53\u524D\u76EE\u5F55\u7ED3\u6784\u56E0\u8D85\u8FC7\u5C55\u793A\u9600\u503C\u88AB\u622A\u65AD\uFF0C\u672A\u5C55\u793A\u6587\u4EF6\u6570=${notShownFileCount}\uFF0C\u672A\u663E\u793A\u76EE\u5F55\u6570=${notShownDirectoryCount}\uFF0C\u672A\u663E\u793A\u884C\u6570=${omittedLines} lines\uFF08\u7EDF\u8BA1\u6570\u636E\u4E0D\u5305\u542B\u7A7A\u76EE\u5F55\u4EE5\u53CA\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\u7B49\u6587\u4EF6\u6216\u76EE\u5F55\uFF09\u3002\u8BE5\u8F93\u51FA\u4E3A\u90E8\u5206\u89C6\u56FE\uFF0C\u672A\u51FA\u73B0\u8DEF\u5F84\u4E0D\u5F97\u7528\u4E8E\u5B9A\u4F4D\u3002\u4F9D\u636E\u5F53\u524D\u9879\u76EE\u7ED3\u6784\u7EDF\u8BA1\u6570\u636E\uFF0C\u53EF\u521D\u6B65\u8FDB\u884C\u9879\u76EE\u7ED3\u6784\u590D\u6742\u5EA6\u5206\u6790\uFF1A1 \u603B\u76EE\u5F55/\u603B\u6587\u4EF6\u6BD4\u4F8B\u9AD8 \u2192 \u7ED3\u6784\u66F4\u788E\u3001\u5C42\u7EA7\u53EF\u80FD\u66F4\u7EC6\uFF0C\u590D\u6742\u5EA6\u503E\u5411\u66F4\u9AD8\u30022 \u6700\u6DF1\u5C42\u7EA7\u5927 \u2192 \u6DF1\u5C42\u5D4C\u5957\u660E\u663E\uFF0C\u5BFC\u822A\u4E0E\u5B9A\u4F4D\u6210\u672C\u66F4\u9AD8\u30023 \u9876\u5C42\u76EE\u5F55\u6570\u591A \u2192 \u6A21\u5757\u5165\u53E3\u5206\u6563\uFF0C\u9700\u66F4\u4E25\u683C\u5206\u5C42\u786E\u8BA4\u30024 \u6587\u4EF6\u603B\u91CF\u5927 \u2192 \u66F4\u5BB9\u6613\u89E6\u53D1\u8F93\u51FA\u622A\u65AD\u3002\u5904\u7406\u6D41\u7A0B\uFF1A\u590D\u6742\u5EA6\u4F4E \u2192 \u53EF\u76F4\u63A5 LS \u83B7\u53D6\u7ED3\u6784\u7EBF\u7D22\u540E\u8FDB\u5165\u5B9A\u4F4D\uFF1B\u590D\u6742\u5EA6\u9AD8 \u2192 \u5148\u7528 LS \u83B7\u53D6\u9876\u5C42\u7EBF\u7D22\uFF0C\u518D\u7528 Glob \u5206\u5C42\u786E\u8BA4\u8DEF\u5F84\u3002`
1550
+ );
1551
+ warnings.push(
1552
+ "\u82E5\u9700\u6DF1\u5165\u5206\u6790\u5EFA\u8BAE\u5982\u4E0B\u5206\u6B65\u52A8\u4F5C\uFF08\u5C24\u5176\u76EE\u5F55\u7ED3\u6784\u590D\u6742\u5EA6\u8F83\u9AD8\u65F6\uFF09\uFF1A"
1553
+ );
1554
+ warnings.push("1) \u5C06\u5F53\u524D\u9876\u5C42\u4F5C\u4E3A\u7EBF\u7D22\uFF0C\u4F18\u5148\u7528 LS \u5BF9\u5019\u9009\u9876\u5C42\u76EE\u5F55\u9010\u5C42\u786E\u8BA4\u7ED3\u6784\u3002");
1555
+ warnings.push("2) \u5728\u5DF2\u786E\u8BA4\u7684\u5019\u9009\u76EE\u5F55\u4E0B\uFF0C\u4F7F\u7528 Glob dir/* \u4E0E dir/*/ \u7EC6\u5316\u8DEF\u5F84\u5B58\u5728\u6027\u3002");
1556
+ warnings.push("3) \u5982\u9700\u66F4\u5E7F\u5339\u914D\uFF0C\u53EF\u7528 Glob dir/** \u4E0E dir/**/* \u7F29\u5C0F\u5230\u6A21\u5757\u7EA7\u8303\u56F4\u3002");
1557
+ warnings.push("4) \u5728\u5DF2\u786E\u8BA4\u76EE\u5F55\u5185\u4F7F\u7528 Grep/\u8BED\u4E49\u641C\u7D22\u5B9A\u4F4D\u6587\u4EF6\u6216\u7B26\u53F7\u3002");
1558
+ }
1559
+ const mainTreeHeader = truncated ? `[\u76EE\u5F55\u6838\u5FC3\u7ED3\u6784\u6811\u89C6\u56FE]\u6811\u7ED3\u6784\u8D85\u51FA\u9600\u503C\u88AB\u622A\u65AD\uFF0C\u672A\u663E\u793A\u6587\u4EF6\u6570=${notShownFileCount}\uFF0C\u672A\u663E\u793A\u76EE\u5F55\u6570=${notShownDirectoryCount}\uFF08\u7EDF\u8BA1\u6570\u636E\u4E0D\u5305\u542B\u7A7A\u76EE\u5F55\u4EE5\u53CA\u5E38\u89C1\u975E\u6838\u5FC3\u76EE\u5F55/\u6784\u5EFA\u4EA7\u7269/\u4F9D\u8D56\u7F13\u5B58\u7B49\u6587\u4EF6\u6216\u76EE\u5F55\uFF09` : "";
1560
+ const rootName = basename(fullFilePath) || ".";
1561
+ const hasRootLine = treeLines.length > 0 && treeLines[0] === rootName;
1562
+ const treeBodyLines = hasRootLine ? treeLines.slice(1) : treeLines;
1563
+ const treeBody = treeBodyLines.join("\n");
1564
+ const mainTreeOutput = treeBody ? `${rootLabel}
1565
+ ${treeBody}` : rootLabel;
1566
+ outputParts.push(separator);
1567
+ if (mainTreeHeader) outputParts.push(mainTreeHeader);
1568
+ outputParts.push(mainTreeOutput);
1569
+ }
1564
1570
  const outputForData = outputParts.join("\n");
1565
1571
  const warningsText = warnings.length > 0 ? `
1566
1572
  ${warnings.join("\n")}` : "";
@@ -3888,336 +3894,6 @@ var TaskUpdateTool = {
3888
3894
  }
3889
3895
  };
3890
3896
 
3891
- // src/tools/system/ThinkTool/ThinkTool.tsx
3892
- import { z as z14 } from "zod";
3893
- import React9 from "react";
3894
- import { Text as Text9 } from "ink";
3895
-
3896
- // src/tools/system/ThinkTool/prompt.ts
3897
- var DESCRIPTION10 = "A structured thinking tool for complex problem-solving through sequential reasoning, revision, and branching analysis. Supports step-by-step decomposition of complex problems with revision and alternative path exploration.";
3898
- var PROMPT10 = `## Think Tool - Structured Sequential Thinking
3899
-
3900
- Use the Think tool for **structured, step-by-step reasoning** on complex problems. This tool helps you think systematically by breaking down complex problems into manageable steps, with support for revision and alternative path exploration.
3901
-
3902
- ### \u{1F3AF} When to Use Sequential Thinking
3903
-
3904
- **Ideal scenarios:**
3905
- - **Complex problem decomposition** - Breaking a large problem into logical steps
3906
- - **Planning with uncertainty** - When the full solution path isn't clear initially
3907
- - **Analysis requiring revision** - When you might need to correct your understanding mid-process
3908
- - **Multi-approach comparison** - When you want to explore alternative solutions
3909
- - **Cross-step context maintenance** - When you need to remember insights across multiple reasoning steps
3910
- - **Hypothesis generation & verification** - Scientific reasoning, debugging complex issues
3911
-
3912
- **Do NOT use for:**
3913
- - Simple factual questions (e.g., "What is 2+2?")
3914
- - Tasks with clear, single-step answers
3915
- - When you already have a complete solution in mind
3916
-
3917
- ### \u{1F4CB} How to Use - Schema Fields
3918
-
3919
- **Required fields:**
3920
- - \`thought\` (string): Your current thinking step
3921
-
3922
- **Recommended fields for sequential thinking:**
3923
- - \`thoughtNumber\` (integer): Current thought number in sequence (1, 2, 3...)
3924
- - \`totalThoughts\` (integer): Estimated total thoughts needed - **adjustable as understanding deepens**
3925
- - \`nextThoughtNeeded\` (boolean): Whether more thinking is needed
3926
-
3927
- **Advanced fields:**
3928
- - \`parentThought\` (integer): The existing thought number you are revising or branching from
3929
-
3930
- ### \u{1F504} Sequential Thinking Workflow
3931
-
3932
- #### 1. Starting a Thinking Sequence
3933
-
3934
- \`\`\`json
3935
- {
3936
- "thoughtNumber": 1,
3937
- "totalThoughts": 5,
3938
- "thought": "First, I need to understand the problem requirements. The user wants to...",
3939
- "nextThoughtNeeded": true
3940
- }
3941
- \`\`\`
3942
-
3943
- **Key points:**
3944
- - Start with an initial estimate of total thoughts (e.g., 3-7)
3945
- - Don't worry about being exact - you can adjust later
3946
- - Clearly state what you're analyzing in this step
3947
-
3948
- #### 2. Continuing the Sequence
3949
-
3950
- \`\`\`json
3951
- {
3952
- "thoughtNumber": 2,
3953
- "totalThoughts": 5,
3954
- "thought": "Now let me analyze the key constraints. I see three main factors:...",
3955
- "nextThoughtNeeded": true
3956
- }
3957
- \`\`\`
3958
-
3959
- **Key points:**
3960
- - Build on previous thoughts
3961
- - Each thought should have a clear focus
3962
- - Keep \`nextThoughtNeeded: true\` while still reasoning
3963
-
3964
- #### 3. Revising Previous Thinking (When You Realize a Mistake)
3965
-
3966
- \`\`\`json
3967
- {
3968
- "thoughtNumber": 3,
3969
- "totalThoughts": 6,
3970
- "thought": "Wait, I realize my analysis in thought #2 was incomplete. Let me reconsider...",
3971
- "parentThought": 2,
3972
- "nextThoughtNeeded": true
3973
- }
3974
- \`\`\`
3975
-
3976
- **Key points:**
3977
- - **It's safe and encouraged to admit mistakes**
3978
- - Explain what was wrong and your new understanding
3979
- - You can increase \`totalThoughts\` to accommodate the revision
3980
-
3981
- #### 4. Exploring Alternative Paths (Branching)
3982
-
3983
- \`\`\`json
3984
- {
3985
- "thoughtNumber": 4,
3986
- "totalThoughts": 6,
3987
- "thought": "Let me explore an alternative approach. What if we...?",
3988
- "parentThought": 2,
3989
- "nextThoughtNeeded": true
3990
- }
3991
- \`\`\`
3992
-
3993
- **Key points:**
3994
- - Useful for comparing multiple solutions
3995
- - Mark the branching point and give it an ID
3996
- - You can return to the main path later
3997
-
3998
- #### 5. Completing the Thinking
3999
-
4000
- \`\`\`json
4001
- {
4002
- "thoughtNumber": 6,
4003
- "totalThoughts": 6,
4004
- "thought": "Based on the analysis above, my conclusion is: [clear answer]. The key reasoning steps were: 1)..., 2)..., 3)...",
4005
- "nextThoughtNeeded": false
4006
- }
4007
- \`\`\`
4008
-
4009
- **Key points:**
4010
- - Set \`nextThoughtNeeded: false\` only when truly done
4011
- - Summarize the key insights and final conclusion
4012
- - Ensure the reasoning chain is clear
4013
-
4014
- ### \u{1F4CA} Best Practices
4015
-
4016
- **Do:**
4017
- - \u2705 Start with a reasonable estimate (3-7 thoughts for most complex problems)
4018
- - \u2705 Adjust \`totalThoughts\` up or down as your understanding deepens
4019
- - \u2705 Use revision when you realize a mistake - **this is a strength, not a weakness**
4020
- - \u2705 Keep each thought focused on one aspect
4021
- - \u2705 Build logically on previous thoughts
4022
- - \u2705 Set \`nextThoughtNeeded: false\` when you reach a satisfactory conclusion
4023
-
4024
- **Don't:**
4025
- - \u274C Waste thoughts on trivialities (e.g., "I'm thinking...", "Let me continue...")
4026
- - \u274C Feel locked into your initial \`totalThoughts\` estimate
4027
- - \u274C Hide uncertainties - express them explicitly
4028
- - \u274C Use for simple questions that don't need multi-step reasoning
4029
-
4030
- ### \u{1F393} Complete Example
4031
-
4032
- **Problem**: "Design a caching strategy for a high-traffic API"
4033
-
4034
- **Step 1:**
4035
- \`\`\`json
4036
- {
4037
- "thoughtNumber": 1,
4038
- "totalThoughts": 5,
4039
- "thought": "First, I need to understand the requirements: high-traffic API means we need to minimize latency and database load. Key considerations: 1) What data to cache, 2) Cache invalidation strategy, 3) Cache tier (client/CDN/server/DB)",
4040
- "nextThoughtNeeded": true
4041
- }
4042
- \`\`\`
4043
-
4044
- **Step 2:**
4045
- \`\`\`json
4046
- {
4047
- "thoughtNumber": 2,
4048
- "totalThoughts": 5,
4049
- "thought": "For what data to cache: should cache read-heavy, slowly-changing data. Examples: user profiles, product catalogs, configuration. Should NOT cache: real-time data, user-specific sensitive data, frequently changing inventory",
4050
- "nextThoughtNeeded": true
4051
- }
4052
- \`\`\`
4053
-
4054
- **Step 3 (Revision):**
4055
- \`\`\`json
4056
- {
4057
- "thoughtNumber": 3,
4058
- "totalThoughts": 6,
4059
- "thought": "Wait, I need to reconsider thought #2. Actually, some user-specific data CAN be cached if properly keyed (e.g., user preferences). The key is cache key design, not blanket exclusion.",
4060
- "parentThought": 2,
4061
- "nextThoughtNeeded": true
4062
- }
4063
- \`\`\`
4064
-
4065
- **Step 4:**
4066
- \`\`\`json
4067
- {
4068
- "thoughtNumber": 4,
4069
- "totalThoughts": 6,
4070
- "thought": "For cache invalidation: need a multi-pronged approach: 1) TTL for stale data, 2) Event-driven invalidation on writes, 3) Version-based invalidation for config changes",
4071
- "nextThoughtNeeded": true
4072
- }
4073
- \`\`\`
4074
-
4075
- **Step 5:**
4076
- \`\`\`json
4077
- {
4078
- "thoughtNumber": 5,
4079
- "totalThoughts": 6,
4080
- "thought": "For cache tier strategy: recommend a multi-layer approach: L1 (in-memory, per-instance) for hot data, L2 (Redis cluster) for shared caching, L3 (CDN) for static assets",
4081
- "nextThoughtNeeded": true
4082
- }
4083
- \`\`\`
4084
-
4085
- **Step 6 (Conclusion):**
4086
- \`\`\`json
4087
- {
4088
- "thoughtNumber": 6,
4089
- "totalThoughts": 6,
4090
- "thought": "Final recommendation: Implement a 3-tier caching strategy with Redis as L2. Key design: 1) Cache read-heavy data with proper cache keys, 2) TTL + event-driven invalidation, 3) Multi-tier for different access patterns. Trade-offs: added complexity vs. 10x latency improvement for cached reads.",
4091
- "nextThoughtNeeded": false
4092
- }
4093
- \`\`\`
4094
-
4095
- ### \u{1F527} Integration with Other Tools
4096
-
4097
- **Think \u2192 Plan workflow:**
4098
- 1. Use Think to analyze the problem and identify key factors
4099
- 2. Use Think to generate and compare multiple approaches
4100
- 3. Use Think to finalize the recommended solution
4101
- 4. Use Task/Write tools to implement the chosen approach
4102
-
4103
- **Think \u2192 Debug workflow:**
4104
- 1. Use Think to list hypotheses about the bug cause
4105
- 2. Use Think to design experiments to test each hypothesis
4106
- 3. Use Bash/Read tools to run experiments
4107
- 4. Use Think to analyze results and narrow down the cause
4108
-
4109
- **Think \u2192 Edit workflow:**
4110
- 1. Use Think to understand the code structure and plan the edit
4111
- 2. Use Think to identify potential side effects and risks
4112
- 3. Use Read tools to verify your understanding
4113
- 4. Use Edit tools to implement the changes
4114
-
4115
- ### \u{1F3AF} Stopping Criteria
4116
-
4117
- Stop thinking (set \`nextThoughtNeeded: false\`) when:
4118
- - You have a clear, justified conclusion
4119
- - Further thinking would be repetitive
4120
- - The cost of additional analysis exceeds the value
4121
- - You've addressed all aspects of the problem
4122
-
4123
- Remember: **Quality of thinking > Quantity of thoughts**. A concise, insightful 3-thought analysis is better than a verbose 10-thought ramble.`;
4124
-
4125
- // src/tools/system/ThinkTool/ThinkTool.tsx
4126
- var thinkToolSchema = z14.object({
4127
- thought: z14.string().describe("Your thoughts."),
4128
- thoughtNumber: z14.number().int().min(1).optional(),
4129
- totalThoughts: z14.number().int().min(1).optional(),
4130
- nextThoughtNeeded: z14.boolean().optional(),
4131
- parentThought: z14.number().int().min(1).optional()
4132
- });
4133
- var isEnabledFlag = (raw) => {
4134
- const normalized = String(raw ?? "").trim().toLowerCase();
4135
- if (!normalized) return true;
4136
- return normalized === "1" || normalized === "true" || normalized === "on" || normalized === "yes";
4137
- };
4138
- var thinkingSessions = /* @__PURE__ */ new Map();
4139
- var resolveSessionKey = () => getCurrentSessionId() ?? "global";
4140
- var getSessionThoughts = (sessionKey) => {
4141
- const existing = thinkingSessions.get(sessionKey);
4142
- if (existing) return existing;
4143
- const created = [];
4144
- thinkingSessions.set(sessionKey, created);
4145
- return created;
4146
- };
4147
- var validateParentThought = (parentThought, sessionThoughts) => {
4148
- if (parentThought < 1 || parentThought > sessionThoughts.length) {
4149
- throw new Error(
4150
- `parentThought must reference an existing thought between 1 and ${sessionThoughts.length}`
4151
- );
4152
- }
4153
- };
4154
- var computeRevisionNumber = (parentThought, sessionThoughts) => sessionThoughts.filter((entry) => entry.parentThought === parentThought).length + 1;
4155
- var formatThinkToolUseMessage = (input) => {
4156
- const header = typeof input.thoughtNumber === "number" && typeof input.totalThoughts === "number" ? `#${input.thoughtNumber}/${input.totalThoughts}` : typeof input.thoughtNumber === "number" ? `#${input.thoughtNumber}` : "";
4157
- const body = typeof input.parentThought === "number" ? `revise #${input.parentThought}: ${input.thought}` : input.thought;
4158
- return header ? `${header} ${body}` : body;
4159
- };
4160
- var ThinkTool = {
4161
- name: "Think",
4162
- userFacingName: () => "Think",
4163
- description: async () => DESCRIPTION10,
4164
- inputSchema: thinkToolSchema,
4165
- isEnabled: async () => isEnabledFlag(process.env.PYB_THINK_TOOL),
4166
- isReadOnly: () => true,
4167
- isConcurrencySafe: () => false,
4168
- needsPermissions: () => false,
4169
- prompt: async () => PROMPT10,
4170
- async *call(input) {
4171
- const sessionKey = resolveSessionKey();
4172
- const sessionThoughts = getSessionThoughts(sessionKey);
4173
- const expectedNext = sessionThoughts.length + 1;
4174
- const providedThoughtNumber = typeof input.thoughtNumber === "number" ? input.thoughtNumber : expectedNext;
4175
- if (providedThoughtNumber !== expectedNext) {
4176
- throw new Error(
4177
- `Thought number mismatch: expected ${expectedNext}, got ${providedThoughtNumber}`
4178
- );
4179
- }
4180
- const totalThoughts = typeof input.totalThoughts === "number" ? Math.max(input.totalThoughts, expectedNext) : expectedNext;
4181
- const parentThought = typeof input.parentThought === "number" ? input.parentThought : void 0;
4182
- if (typeof parentThought === "number") {
4183
- validateParentThought(parentThought, sessionThoughts);
4184
- }
4185
- const revisionNumber = typeof parentThought === "number" ? computeRevisionNumber(parentThought, sessionThoughts) : void 0;
4186
- const entry = {
4187
- thought: input.thought,
4188
- thoughtNumber: providedThoughtNumber,
4189
- totalThoughts,
4190
- currentThought: expectedNext,
4191
- nextThoughtNeeded: input.nextThoughtNeeded ?? false,
4192
- parentThought,
4193
- revisionNumber,
4194
- timestamp: Date.now()
4195
- };
4196
- sessionThoughts.push(entry);
4197
- yield {
4198
- type: "result",
4199
- resultForAssistant: `Thought #${entry.currentThought} logged.`,
4200
- data: {
4201
- thought: entry.thought,
4202
- thoughtNumber: entry.thoughtNumber,
4203
- currentThought: entry.currentThought,
4204
- totalThoughts: entry.totalThoughts,
4205
- totalThoughtsInSession: sessionThoughts.length,
4206
- nextThoughtNeeded: entry.nextThoughtNeeded,
4207
- parentThought: entry.parentThought,
4208
- revisionNumber: entry.revisionNumber
4209
- }
4210
- };
4211
- },
4212
- renderToolUseMessage(input) {
4213
- return formatThinkToolUseMessage(input);
4214
- },
4215
- renderToolUseRejectedMessage() {
4216
- return /* @__PURE__ */ React9.createElement(MessageResponse, { children: /* @__PURE__ */ React9.createElement(Text9, { color: getTheme().error }, "Thought cancelled") });
4217
- },
4218
- renderResultForAssistant: () => "Your thought has been logged."
4219
- };
4220
-
4221
3897
  // src/tools/index.ts
4222
3898
  var getAllTools = () => [
4223
3899
  TaskTool,
@@ -4240,7 +3916,6 @@ var getAllTools = () => [
4240
3916
  TaskListTool,
4241
3917
  WebFetchTool,
4242
3918
  WebSearchTool,
4243
- ThinkTool,
4244
3919
  AskUserQuestionTool,
4245
3920
  SlashCommandTool,
4246
3921
  SkillTool,