pybao-cli 1.4.86 → 1.4.88

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 (150) hide show
  1. package/dist/REPL-4FCYT7Z5.js +49 -0
  2. package/dist/{acp-UVP7PN5S.js → acp-BEENZ4OG.js} +30 -30
  3. package/dist/{agentsValidate-FL54WGFH.js → agentsValidate-6TS3RP7C.js} +7 -7
  4. package/dist/{ask-PBWLOQ7J.js → ask-XWXGR2SJ.js} +29 -29
  5. package/dist/{autoUpdater-O5RPYHU3.js → autoUpdater-QQFPDEHF.js} +3 -3
  6. package/dist/{chunk-T2A6HHRX.js → chunk-2R3GZBQB.js} +2 -2
  7. package/dist/{chunk-3B4CPOCL.js → chunk-3YEHOKKN.js} +3 -3
  8. package/dist/{chunk-DFM5XVNM.js → chunk-5UF2H2E2.js} +2 -2
  9. package/dist/{chunk-7UFU3WAO.js → chunk-6SQZWXWO.js} +2 -2
  10. package/dist/{chunk-N775QA2Y.js → chunk-BQRQDLGU.js} +1 -1
  11. package/dist/{chunk-CLFHJB6G.js → chunk-C3T4PAJS.js} +2 -2
  12. package/dist/{chunk-PRBRDV6D.js → chunk-E4GAAM6W.js} +1 -1
  13. package/dist/{chunk-PRBRDV6D.js.map → chunk-E4GAAM6W.js.map} +1 -1
  14. package/dist/{chunk-TOHWB6HI.js → chunk-FPY7JUJY.js} +2 -2
  15. package/dist/{chunk-INUAHGET.js → chunk-HFKLDRL6.js} +1 -1
  16. package/dist/{chunk-OXIP2DAD.js → chunk-I3Z4C5AC.js} +38 -36
  17. package/dist/{chunk-OXIP2DAD.js.map → chunk-I3Z4C5AC.js.map} +2 -2
  18. package/dist/{chunk-3JIUIDM2.js → chunk-IIAJFPXS.js} +1 -1
  19. package/dist/{chunk-LZV5TCLM.js → chunk-JHHE7BO3.js} +1 -1
  20. package/dist/{chunk-OOLRCWS2.js → chunk-JPJAU5JW.js} +4 -4
  21. package/dist/{chunk-MDLJYUB5.js → chunk-M5HIDIWE.js} +3 -3
  22. package/dist/{chunk-SU3DRMCQ.js → chunk-MQ3V6HZB.js} +1 -1
  23. package/dist/{chunk-QIA3YTRM.js → chunk-MR6ZKCPK.js} +3 -3
  24. package/dist/{chunk-VLQEJHWT.js → chunk-PITHFG75.js} +3 -3
  25. package/dist/{chunk-XYYAVY4Z.js → chunk-QGEZGMIE.js} +4 -4
  26. package/dist/{chunk-X472W3BH.js → chunk-QW3B6I6E.js} +2 -2
  27. package/dist/{chunk-ZXIIV7IC.js → chunk-QYZL3BWL.js} +1 -1
  28. package/dist/{chunk-2O3X5IWT.js → chunk-RGMF3LVN.js} +1 -1
  29. package/dist/{chunk-GSPJ4GS3.js → chunk-SKT3BY7F.js} +3 -3
  30. package/dist/{chunk-XBM24YJM.js → chunk-SY4QMAAQ.js} +4 -4
  31. package/dist/{chunk-Z3VN6WKQ.js → chunk-UYI7DYIU.js} +4 -4
  32. package/dist/{chunk-R35KKDQG.js → chunk-VDXEXIFH.js} +2 -2
  33. package/dist/{chunk-TUQG5JPN.js → chunk-VX76OKFG.js} +351 -16
  34. package/dist/chunk-VX76OKFG.js.map +7 -0
  35. package/dist/{chunk-NZCROE5X.js → chunk-WCDTF6NW.js} +1 -1
  36. package/dist/{chunk-VP2IDQGT.js → chunk-WJTA42UY.js} +3 -3
  37. package/dist/{chunk-WZZJVQME.js → chunk-X3I3243U.js} +1 -1
  38. package/dist/{chunk-PCMN5JB2.js → chunk-ZGBDUNHT.js} +3 -3
  39. package/dist/{chunk-NPA5AQ7K.js → chunk-ZWWHZISF.js} +1 -1
  40. package/dist/{cli-5H6SVIF4.js → cli-2YSTIJL2.js} +89 -89
  41. package/dist/commands-6JZO4O4Y.js +53 -0
  42. package/dist/{config-ZQSF7J7M.js → config-HGMVFQML.js} +4 -4
  43. package/dist/{context-Q6WNUXMJ.js → context-G5BOQT22.js} +6 -6
  44. package/dist/{conversationTracker-D6IBZAR6.js → conversationTracker-RHL6XD4T.js} +3 -3
  45. package/dist/{customCommands-IPGNOQKK.js → customCommands-HXXCOFR5.js} +4 -4
  46. package/dist/{env-PR3XNREC.js → env-SZ3365S5.js} +2 -2
  47. package/dist/{file-BXLHMQLT.js → file-RPHZQ3RA.js} +4 -4
  48. package/dist/index.js +3 -3
  49. package/dist/{llm-KXFWT6QU.js → llm-XU4EMDUR.js} +30 -30
  50. package/dist/{llmLazy-TD36PKN5.js → llmLazy-HZSBL4PC.js} +1 -1
  51. package/dist/{loader-4PMWRUTH.js → loader-T2INBRIA.js} +4 -4
  52. package/dist/{lsp-LZ2FQAEJ.js → lsp-QI3ZLTQV.js} +6 -6
  53. package/dist/{lspAnchor-RI6XI7OY.js → lspAnchor-6RF6HKGR.js} +6 -6
  54. package/dist/{mcp-633QRPZJ.js → mcp-WTUBCOJV.js} +7 -7
  55. package/dist/{mentionProcessor-SHPTKVDT.js → mentionProcessor-IIP6VLNA.js} +5 -5
  56. package/dist/{messages-ILCXJTM3.js → messages-F6CRVIM2.js} +1 -1
  57. package/dist/{model-KSBEHTGQ.js → model-RWJEGEXK.js} +5 -5
  58. package/dist/{openai-4F2EBT2N.js → openai-5757TKOL.js} +5 -5
  59. package/dist/{outputStyles-SVF7ULKM.js → outputStyles-K47WSCZW.js} +4 -4
  60. package/dist/{pluginRuntime-SX6EVXLI.js → pluginRuntime-G6NDYAL4.js} +6 -6
  61. package/dist/{pluginValidation-66RSOF62.js → pluginValidation-IYL2M6HJ.js} +6 -6
  62. package/dist/prompts-RK4IWH2Q.js +55 -0
  63. package/dist/{pybAgentSessionLoad-XPP25YQJ.js → pybAgentSessionLoad-5P3463AO.js} +4 -4
  64. package/dist/{pybAgentSessionResume-3NDIDTLX.js → pybAgentSessionResume-TB52PBOM.js} +4 -4
  65. package/dist/{pybAgentStreamJsonSession-CBRW7AGT.js → pybAgentStreamJsonSession-M6ARM5CR.js} +1 -1
  66. package/dist/{pybHooks-WVV274FH.js → pybHooks-UOKJXRAF.js} +4 -4
  67. package/dist/query-LQLRUDFT.js +57 -0
  68. package/dist/{registry-PL6BRQ65.js → registry-2FKPKBYH.js} +5 -5
  69. package/dist/{ripgrep-7XBIKVDR.js → ripgrep-UPERJ7LV.js} +3 -3
  70. package/dist/{skillMarketplace-IRJ73YDQ.js → skillMarketplace-GXL44WSR.js} +3 -3
  71. package/dist/{state-GXNXV4HP.js → state-USMPO4SG.js} +2 -2
  72. package/dist/{theme-RUAAOZ7A.js → theme-232GXJQZ.js} +5 -5
  73. package/dist/{toolPermissionSettings-65AHPGX3.js → toolPermissionSettings-DNL2KY42.js} +6 -6
  74. package/dist/tools-LGNPDPHO.js +54 -0
  75. package/dist/{userInput-FGX36YI6.js → userInput-JKGT4IS5.js} +31 -31
  76. package/package.json +1 -1
  77. package/dist/REPL-AYCFBDLU.js +0 -49
  78. package/dist/chunk-TUQG5JPN.js.map +0 -7
  79. package/dist/commands-ZAPC4C6T.js +0 -53
  80. package/dist/prompts-QQD7FUBC.js +0 -55
  81. package/dist/query-UQFC6UNG.js +0 -57
  82. package/dist/tools-233ZNHH7.js +0 -54
  83. /package/dist/{REPL-AYCFBDLU.js.map → REPL-4FCYT7Z5.js.map} +0 -0
  84. /package/dist/{acp-UVP7PN5S.js.map → acp-BEENZ4OG.js.map} +0 -0
  85. /package/dist/{agentsValidate-FL54WGFH.js.map → agentsValidate-6TS3RP7C.js.map} +0 -0
  86. /package/dist/{ask-PBWLOQ7J.js.map → ask-XWXGR2SJ.js.map} +0 -0
  87. /package/dist/{autoUpdater-O5RPYHU3.js.map → autoUpdater-QQFPDEHF.js.map} +0 -0
  88. /package/dist/{chunk-T2A6HHRX.js.map → chunk-2R3GZBQB.js.map} +0 -0
  89. /package/dist/{chunk-3B4CPOCL.js.map → chunk-3YEHOKKN.js.map} +0 -0
  90. /package/dist/{chunk-DFM5XVNM.js.map → chunk-5UF2H2E2.js.map} +0 -0
  91. /package/dist/{chunk-7UFU3WAO.js.map → chunk-6SQZWXWO.js.map} +0 -0
  92. /package/dist/{chunk-N775QA2Y.js.map → chunk-BQRQDLGU.js.map} +0 -0
  93. /package/dist/{chunk-CLFHJB6G.js.map → chunk-C3T4PAJS.js.map} +0 -0
  94. /package/dist/{chunk-TOHWB6HI.js.map → chunk-FPY7JUJY.js.map} +0 -0
  95. /package/dist/{chunk-INUAHGET.js.map → chunk-HFKLDRL6.js.map} +0 -0
  96. /package/dist/{chunk-3JIUIDM2.js.map → chunk-IIAJFPXS.js.map} +0 -0
  97. /package/dist/{chunk-LZV5TCLM.js.map → chunk-JHHE7BO3.js.map} +0 -0
  98. /package/dist/{chunk-OOLRCWS2.js.map → chunk-JPJAU5JW.js.map} +0 -0
  99. /package/dist/{chunk-MDLJYUB5.js.map → chunk-M5HIDIWE.js.map} +0 -0
  100. /package/dist/{chunk-SU3DRMCQ.js.map → chunk-MQ3V6HZB.js.map} +0 -0
  101. /package/dist/{chunk-QIA3YTRM.js.map → chunk-MR6ZKCPK.js.map} +0 -0
  102. /package/dist/{chunk-VLQEJHWT.js.map → chunk-PITHFG75.js.map} +0 -0
  103. /package/dist/{chunk-XYYAVY4Z.js.map → chunk-QGEZGMIE.js.map} +0 -0
  104. /package/dist/{chunk-X472W3BH.js.map → chunk-QW3B6I6E.js.map} +0 -0
  105. /package/dist/{chunk-ZXIIV7IC.js.map → chunk-QYZL3BWL.js.map} +0 -0
  106. /package/dist/{chunk-2O3X5IWT.js.map → chunk-RGMF3LVN.js.map} +0 -0
  107. /package/dist/{chunk-GSPJ4GS3.js.map → chunk-SKT3BY7F.js.map} +0 -0
  108. /package/dist/{chunk-XBM24YJM.js.map → chunk-SY4QMAAQ.js.map} +0 -0
  109. /package/dist/{chunk-Z3VN6WKQ.js.map → chunk-UYI7DYIU.js.map} +0 -0
  110. /package/dist/{chunk-R35KKDQG.js.map → chunk-VDXEXIFH.js.map} +0 -0
  111. /package/dist/{chunk-NZCROE5X.js.map → chunk-WCDTF6NW.js.map} +0 -0
  112. /package/dist/{chunk-VP2IDQGT.js.map → chunk-WJTA42UY.js.map} +0 -0
  113. /package/dist/{chunk-WZZJVQME.js.map → chunk-X3I3243U.js.map} +0 -0
  114. /package/dist/{chunk-PCMN5JB2.js.map → chunk-ZGBDUNHT.js.map} +0 -0
  115. /package/dist/{chunk-NPA5AQ7K.js.map → chunk-ZWWHZISF.js.map} +0 -0
  116. /package/dist/{cli-5H6SVIF4.js.map → cli-2YSTIJL2.js.map} +0 -0
  117. /package/dist/{commands-ZAPC4C6T.js.map → commands-6JZO4O4Y.js.map} +0 -0
  118. /package/dist/{config-ZQSF7J7M.js.map → config-HGMVFQML.js.map} +0 -0
  119. /package/dist/{context-Q6WNUXMJ.js.map → context-G5BOQT22.js.map} +0 -0
  120. /package/dist/{conversationTracker-D6IBZAR6.js.map → conversationTracker-RHL6XD4T.js.map} +0 -0
  121. /package/dist/{customCommands-IPGNOQKK.js.map → customCommands-HXXCOFR5.js.map} +0 -0
  122. /package/dist/{env-PR3XNREC.js.map → env-SZ3365S5.js.map} +0 -0
  123. /package/dist/{file-BXLHMQLT.js.map → file-RPHZQ3RA.js.map} +0 -0
  124. /package/dist/{llm-KXFWT6QU.js.map → llm-XU4EMDUR.js.map} +0 -0
  125. /package/dist/{llmLazy-TD36PKN5.js.map → llmLazy-HZSBL4PC.js.map} +0 -0
  126. /package/dist/{loader-4PMWRUTH.js.map → loader-T2INBRIA.js.map} +0 -0
  127. /package/dist/{lsp-LZ2FQAEJ.js.map → lsp-QI3ZLTQV.js.map} +0 -0
  128. /package/dist/{lspAnchor-RI6XI7OY.js.map → lspAnchor-6RF6HKGR.js.map} +0 -0
  129. /package/dist/{mcp-633QRPZJ.js.map → mcp-WTUBCOJV.js.map} +0 -0
  130. /package/dist/{mentionProcessor-SHPTKVDT.js.map → mentionProcessor-IIP6VLNA.js.map} +0 -0
  131. /package/dist/{messages-ILCXJTM3.js.map → messages-F6CRVIM2.js.map} +0 -0
  132. /package/dist/{model-KSBEHTGQ.js.map → model-RWJEGEXK.js.map} +0 -0
  133. /package/dist/{openai-4F2EBT2N.js.map → openai-5757TKOL.js.map} +0 -0
  134. /package/dist/{outputStyles-SVF7ULKM.js.map → outputStyles-K47WSCZW.js.map} +0 -0
  135. /package/dist/{pluginRuntime-SX6EVXLI.js.map → pluginRuntime-G6NDYAL4.js.map} +0 -0
  136. /package/dist/{pluginValidation-66RSOF62.js.map → pluginValidation-IYL2M6HJ.js.map} +0 -0
  137. /package/dist/{prompts-QQD7FUBC.js.map → prompts-RK4IWH2Q.js.map} +0 -0
  138. /package/dist/{pybAgentSessionLoad-XPP25YQJ.js.map → pybAgentSessionLoad-5P3463AO.js.map} +0 -0
  139. /package/dist/{pybAgentSessionResume-3NDIDTLX.js.map → pybAgentSessionResume-TB52PBOM.js.map} +0 -0
  140. /package/dist/{pybAgentStreamJsonSession-CBRW7AGT.js.map → pybAgentStreamJsonSession-M6ARM5CR.js.map} +0 -0
  141. /package/dist/{pybHooks-WVV274FH.js.map → pybHooks-UOKJXRAF.js.map} +0 -0
  142. /package/dist/{query-UQFC6UNG.js.map → query-LQLRUDFT.js.map} +0 -0
  143. /package/dist/{registry-PL6BRQ65.js.map → registry-2FKPKBYH.js.map} +0 -0
  144. /package/dist/{ripgrep-7XBIKVDR.js.map → ripgrep-UPERJ7LV.js.map} +0 -0
  145. /package/dist/{skillMarketplace-IRJ73YDQ.js.map → skillMarketplace-GXL44WSR.js.map} +0 -0
  146. /package/dist/{state-GXNXV4HP.js.map → state-USMPO4SG.js.map} +0 -0
  147. /package/dist/{theme-RUAAOZ7A.js.map → theme-232GXJQZ.js.map} +0 -0
  148. /package/dist/{toolPermissionSettings-65AHPGX3.js.map → toolPermissionSettings-DNL2KY42.js.map} +0 -0
  149. /package/dist/{tools-233ZNHH7.js.map → tools-LGNPDPHO.js.map} +0 -0
  150. /package/dist/{userInput-FGX36YI6.js.map → userInput-JKGT4IS5.js.map} +0 -0
@@ -10,6 +10,7 @@ import {
10
10
  GlobTool,
11
11
  GrepTool,
12
12
  KillShellTool,
13
+ MessageResponse,
13
14
  NotebookEditTool,
14
15
  SkillTool,
15
16
  SlashCommandTool,
@@ -33,57 +34,60 @@ import {
33
34
  runWithTaskListEnv,
34
35
  runWithTaskListId,
35
36
  updateTask
36
- } from "./chunk-OXIP2DAD.js";
37
+ } from "./chunk-I3Z4C5AC.js";
38
+ import {
39
+ getCurrentSessionId
40
+ } from "./chunk-XKYHFZEC.js";
37
41
  import {
38
42
  queryLLM
39
- } from "./chunk-OOLRCWS2.js";
43
+ } from "./chunk-JPJAU5JW.js";
40
44
  import {
41
45
  FallbackToolUseRejectedMessage,
42
46
  MCPTool,
43
47
  getClients,
44
48
  getMCPTools
45
- } from "./chunk-XBM24YJM.js";
49
+ } from "./chunk-SY4QMAAQ.js";
46
50
  import {
47
51
  emitReminderEvent
48
- } from "./chunk-X472W3BH.js";
52
+ } from "./chunk-QW3B6I6E.js";
49
53
  import {
50
54
  getActiveAgents,
51
55
  getAgentByType,
52
56
  getAvailableAgentTypes
53
- } from "./chunk-7UFU3WAO.js";
57
+ } from "./chunk-6SQZWXWO.js";
54
58
  import {
55
59
  INTERRUPT_MESSAGE,
56
60
  createAssistantMessage,
57
61
  createUserMessage,
58
62
  getLastAssistantMessageId
59
- } from "./chunk-LZV5TCLM.js";
63
+ } from "./chunk-JHHE7BO3.js";
60
64
  import {
61
65
  formatDuration,
62
66
  formatNumber
63
67
  } from "./chunk-OUXHGDLH.js";
64
68
  import {
65
69
  getAbsolutePath
66
- } from "./chunk-TOHWB6HI.js";
70
+ } from "./chunk-FPY7JUJY.js";
67
71
  import {
68
72
  LspFacade,
69
73
  formatDiagnosticsPretty
70
- } from "./chunk-XYYAVY4Z.js";
74
+ } from "./chunk-QGEZGMIE.js";
71
75
  import {
72
76
  getModelManager
73
- } from "./chunk-GSPJ4GS3.js";
77
+ } from "./chunk-SKT3BY7F.js";
74
78
  import {
75
79
  getContext
76
- } from "./chunk-Z3VN6WKQ.js";
80
+ } from "./chunk-UYI7DYIU.js";
77
81
  import {
78
82
  filesToTree,
79
83
  ripGrepWithStatus
80
- } from "./chunk-2O3X5IWT.js";
84
+ } from "./chunk-RGMF3LVN.js";
81
85
  import {
82
86
  getTheme
83
- } from "./chunk-3JIUIDM2.js";
87
+ } from "./chunk-IIAJFPXS.js";
84
88
  import {
85
89
  debug
86
- } from "./chunk-N775QA2Y.js";
90
+ } from "./chunk-BQRQDLGU.js";
87
91
  import {
88
92
  BunShell,
89
93
  getCwd,
@@ -94,7 +98,7 @@ import {
94
98
  overwriteLog,
95
99
  readTaskOutput,
96
100
  resolveXdgDataPath
97
- } from "./chunk-NZCROE5X.js";
101
+ } from "./chunk-WCDTF6NW.js";
98
102
 
99
103
  // src/tools/index.ts
100
104
  import { memoize as memoize2 } from "lodash-es";
@@ -773,7 +777,7 @@ async function analyzeOutputWithLsp(output, exitCode) {
773
777
  if (exitCode !== 0 || errorCount > 0 || warningCount > 0) {
774
778
  try {
775
779
  const { isAbsolute: isAbsolute3, resolve: resolve4 } = await import("path");
776
- const { getSessionRoot: getSessionRoot2 } = await import("./state-GXNXV4HP.js");
780
+ const { getSessionRoot: getSessionRoot2 } = await import("./state-USMPO4SG.js");
777
781
  const lines = output.split("\n");
778
782
  const uniqueFiles = /* @__PURE__ */ new Set();
779
783
  const lspSuggestions = [];
@@ -1146,7 +1150,7 @@ var DeleteTool = {
1146
1150
  }
1147
1151
  if (!force) {
1148
1152
  try {
1149
- const { LspFacade: LspFacade2 } = await import("./lsp-LZ2FQAEJ.js");
1153
+ const { LspFacade: LspFacade2 } = await import("./lsp-QI3ZLTQV.js");
1150
1154
  const referenceDetail = await LspFacade2.checkFileReferences(fullPath);
1151
1155
  if (referenceDetail) {
1152
1156
  failedItems.push(
@@ -3879,6 +3883,336 @@ var TaskUpdateTool = {
3879
3883
  }
3880
3884
  };
3881
3885
 
3886
+ // src/tools/system/ThinkTool/ThinkTool.tsx
3887
+ import { z as z14 } from "zod";
3888
+ import React9 from "react";
3889
+ import { Text as Text9 } from "ink";
3890
+
3891
+ // src/tools/system/ThinkTool/prompt.ts
3892
+ 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.";
3893
+ var PROMPT10 = `## Think Tool - Structured Sequential Thinking
3894
+
3895
+ 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.
3896
+
3897
+ ### \u{1F3AF} When to Use Sequential Thinking
3898
+
3899
+ **Ideal scenarios:**
3900
+ - **Complex problem decomposition** - Breaking a large problem into logical steps
3901
+ - **Planning with uncertainty** - When the full solution path isn't clear initially
3902
+ - **Analysis requiring revision** - When you might need to correct your understanding mid-process
3903
+ - **Multi-approach comparison** - When you want to explore alternative solutions
3904
+ - **Cross-step context maintenance** - When you need to remember insights across multiple reasoning steps
3905
+ - **Hypothesis generation & verification** - Scientific reasoning, debugging complex issues
3906
+
3907
+ **Do NOT use for:**
3908
+ - Simple factual questions (e.g., "What is 2+2?")
3909
+ - Tasks with clear, single-step answers
3910
+ - When you already have a complete solution in mind
3911
+
3912
+ ### \u{1F4CB} How to Use - Schema Fields
3913
+
3914
+ **Required fields:**
3915
+ - \`thought\` (string): Your current thinking step
3916
+
3917
+ **Recommended fields for sequential thinking:**
3918
+ - \`thoughtNumber\` (integer): Current thought number in sequence (1, 2, 3...)
3919
+ - \`totalThoughts\` (integer): Estimated total thoughts needed - **adjustable as understanding deepens**
3920
+ - \`nextThoughtNeeded\` (boolean): Whether more thinking is needed
3921
+
3922
+ **Advanced fields:**
3923
+ - \`parentThought\` (integer): The existing thought number you are revising or branching from
3924
+
3925
+ ### \u{1F504} Sequential Thinking Workflow
3926
+
3927
+ #### 1. Starting a Thinking Sequence
3928
+
3929
+ \`\`\`json
3930
+ {
3931
+ "thoughtNumber": 1,
3932
+ "totalThoughts": 5,
3933
+ "thought": "First, I need to understand the problem requirements. The user wants to...",
3934
+ "nextThoughtNeeded": true
3935
+ }
3936
+ \`\`\`
3937
+
3938
+ **Key points:**
3939
+ - Start with an initial estimate of total thoughts (e.g., 3-7)
3940
+ - Don't worry about being exact - you can adjust later
3941
+ - Clearly state what you're analyzing in this step
3942
+
3943
+ #### 2. Continuing the Sequence
3944
+
3945
+ \`\`\`json
3946
+ {
3947
+ "thoughtNumber": 2,
3948
+ "totalThoughts": 5,
3949
+ "thought": "Now let me analyze the key constraints. I see three main factors:...",
3950
+ "nextThoughtNeeded": true
3951
+ }
3952
+ \`\`\`
3953
+
3954
+ **Key points:**
3955
+ - Build on previous thoughts
3956
+ - Each thought should have a clear focus
3957
+ - Keep \`nextThoughtNeeded: true\` while still reasoning
3958
+
3959
+ #### 3. Revising Previous Thinking (When You Realize a Mistake)
3960
+
3961
+ \`\`\`json
3962
+ {
3963
+ "thoughtNumber": 3,
3964
+ "totalThoughts": 6,
3965
+ "thought": "Wait, I realize my analysis in thought #2 was incomplete. Let me reconsider...",
3966
+ "parentThought": 2,
3967
+ "nextThoughtNeeded": true
3968
+ }
3969
+ \`\`\`
3970
+
3971
+ **Key points:**
3972
+ - **It's safe and encouraged to admit mistakes**
3973
+ - Explain what was wrong and your new understanding
3974
+ - You can increase \`totalThoughts\` to accommodate the revision
3975
+
3976
+ #### 4. Exploring Alternative Paths (Branching)
3977
+
3978
+ \`\`\`json
3979
+ {
3980
+ "thoughtNumber": 4,
3981
+ "totalThoughts": 6,
3982
+ "thought": "Let me explore an alternative approach. What if we...?",
3983
+ "parentThought": 2,
3984
+ "nextThoughtNeeded": true
3985
+ }
3986
+ \`\`\`
3987
+
3988
+ **Key points:**
3989
+ - Useful for comparing multiple solutions
3990
+ - Mark the branching point and give it an ID
3991
+ - You can return to the main path later
3992
+
3993
+ #### 5. Completing the Thinking
3994
+
3995
+ \`\`\`json
3996
+ {
3997
+ "thoughtNumber": 6,
3998
+ "totalThoughts": 6,
3999
+ "thought": "Based on the analysis above, my conclusion is: [clear answer]. The key reasoning steps were: 1)..., 2)..., 3)...",
4000
+ "nextThoughtNeeded": false
4001
+ }
4002
+ \`\`\`
4003
+
4004
+ **Key points:**
4005
+ - Set \`nextThoughtNeeded: false\` only when truly done
4006
+ - Summarize the key insights and final conclusion
4007
+ - Ensure the reasoning chain is clear
4008
+
4009
+ ### \u{1F4CA} Best Practices
4010
+
4011
+ **Do:**
4012
+ - \u2705 Start with a reasonable estimate (3-7 thoughts for most complex problems)
4013
+ - \u2705 Adjust \`totalThoughts\` up or down as your understanding deepens
4014
+ - \u2705 Use revision when you realize a mistake - **this is a strength, not a weakness**
4015
+ - \u2705 Keep each thought focused on one aspect
4016
+ - \u2705 Build logically on previous thoughts
4017
+ - \u2705 Set \`nextThoughtNeeded: false\` when you reach a satisfactory conclusion
4018
+
4019
+ **Don't:**
4020
+ - \u274C Waste thoughts on trivialities (e.g., "I'm thinking...", "Let me continue...")
4021
+ - \u274C Feel locked into your initial \`totalThoughts\` estimate
4022
+ - \u274C Hide uncertainties - express them explicitly
4023
+ - \u274C Use for simple questions that don't need multi-step reasoning
4024
+
4025
+ ### \u{1F393} Complete Example
4026
+
4027
+ **Problem**: "Design a caching strategy for a high-traffic API"
4028
+
4029
+ **Step 1:**
4030
+ \`\`\`json
4031
+ {
4032
+ "thoughtNumber": 1,
4033
+ "totalThoughts": 5,
4034
+ "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)",
4035
+ "nextThoughtNeeded": true
4036
+ }
4037
+ \`\`\`
4038
+
4039
+ **Step 2:**
4040
+ \`\`\`json
4041
+ {
4042
+ "thoughtNumber": 2,
4043
+ "totalThoughts": 5,
4044
+ "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",
4045
+ "nextThoughtNeeded": true
4046
+ }
4047
+ \`\`\`
4048
+
4049
+ **Step 3 (Revision):**
4050
+ \`\`\`json
4051
+ {
4052
+ "thoughtNumber": 3,
4053
+ "totalThoughts": 6,
4054
+ "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.",
4055
+ "parentThought": 2,
4056
+ "nextThoughtNeeded": true
4057
+ }
4058
+ \`\`\`
4059
+
4060
+ **Step 4:**
4061
+ \`\`\`json
4062
+ {
4063
+ "thoughtNumber": 4,
4064
+ "totalThoughts": 6,
4065
+ "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",
4066
+ "nextThoughtNeeded": true
4067
+ }
4068
+ \`\`\`
4069
+
4070
+ **Step 5:**
4071
+ \`\`\`json
4072
+ {
4073
+ "thoughtNumber": 5,
4074
+ "totalThoughts": 6,
4075
+ "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",
4076
+ "nextThoughtNeeded": true
4077
+ }
4078
+ \`\`\`
4079
+
4080
+ **Step 6 (Conclusion):**
4081
+ \`\`\`json
4082
+ {
4083
+ "thoughtNumber": 6,
4084
+ "totalThoughts": 6,
4085
+ "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.",
4086
+ "nextThoughtNeeded": false
4087
+ }
4088
+ \`\`\`
4089
+
4090
+ ### \u{1F527} Integration with Other Tools
4091
+
4092
+ **Think \u2192 Plan workflow:**
4093
+ 1. Use Think to analyze the problem and identify key factors
4094
+ 2. Use Think to generate and compare multiple approaches
4095
+ 3. Use Think to finalize the recommended solution
4096
+ 4. Use Task/Write tools to implement the chosen approach
4097
+
4098
+ **Think \u2192 Debug workflow:**
4099
+ 1. Use Think to list hypotheses about the bug cause
4100
+ 2. Use Think to design experiments to test each hypothesis
4101
+ 3. Use Bash/Read tools to run experiments
4102
+ 4. Use Think to analyze results and narrow down the cause
4103
+
4104
+ **Think \u2192 Edit workflow:**
4105
+ 1. Use Think to understand the code structure and plan the edit
4106
+ 2. Use Think to identify potential side effects and risks
4107
+ 3. Use Read tools to verify your understanding
4108
+ 4. Use Edit tools to implement the changes
4109
+
4110
+ ### \u{1F3AF} Stopping Criteria
4111
+
4112
+ Stop thinking (set \`nextThoughtNeeded: false\`) when:
4113
+ - You have a clear, justified conclusion
4114
+ - Further thinking would be repetitive
4115
+ - The cost of additional analysis exceeds the value
4116
+ - You've addressed all aspects of the problem
4117
+
4118
+ Remember: **Quality of thinking > Quantity of thoughts**. A concise, insightful 3-thought analysis is better than a verbose 10-thought ramble.`;
4119
+
4120
+ // src/tools/system/ThinkTool/ThinkTool.tsx
4121
+ var thinkToolSchema = z14.object({
4122
+ thought: z14.string().describe("Your thoughts."),
4123
+ thoughtNumber: z14.number().int().min(1).optional(),
4124
+ totalThoughts: z14.number().int().min(1).optional(),
4125
+ nextThoughtNeeded: z14.boolean().optional(),
4126
+ parentThought: z14.number().int().min(1).optional()
4127
+ });
4128
+ var isEnabledFlag = (raw) => {
4129
+ const normalized = String(raw ?? "").trim().toLowerCase();
4130
+ if (!normalized) return true;
4131
+ return normalized === "1" || normalized === "true" || normalized === "on" || normalized === "yes";
4132
+ };
4133
+ var thinkingSessions = /* @__PURE__ */ new Map();
4134
+ var resolveSessionKey = () => getCurrentSessionId() ?? "global";
4135
+ var getSessionThoughts = (sessionKey) => {
4136
+ const existing = thinkingSessions.get(sessionKey);
4137
+ if (existing) return existing;
4138
+ const created = [];
4139
+ thinkingSessions.set(sessionKey, created);
4140
+ return created;
4141
+ };
4142
+ var validateParentThought = (parentThought, sessionThoughts) => {
4143
+ if (parentThought < 1 || parentThought > sessionThoughts.length) {
4144
+ throw new Error(
4145
+ `parentThought must reference an existing thought between 1 and ${sessionThoughts.length}`
4146
+ );
4147
+ }
4148
+ };
4149
+ var computeRevisionNumber = (parentThought, sessionThoughts) => sessionThoughts.filter((entry) => entry.parentThought === parentThought).length + 1;
4150
+ var formatThinkToolUseMessage = (input) => {
4151
+ const header = typeof input.thoughtNumber === "number" && typeof input.totalThoughts === "number" ? `#${input.thoughtNumber}/${input.totalThoughts}` : typeof input.thoughtNumber === "number" ? `#${input.thoughtNumber}` : "";
4152
+ const body = typeof input.parentThought === "number" ? `revise #${input.parentThought}: ${input.thought}` : input.thought;
4153
+ return header ? `${header} ${body}` : body;
4154
+ };
4155
+ var ThinkTool = {
4156
+ name: "Think",
4157
+ userFacingName: () => "Think",
4158
+ description: async () => DESCRIPTION10,
4159
+ inputSchema: thinkToolSchema,
4160
+ isEnabled: async () => isEnabledFlag(process.env.PYB_THINK_TOOL),
4161
+ isReadOnly: () => true,
4162
+ isConcurrencySafe: () => false,
4163
+ needsPermissions: () => false,
4164
+ prompt: async () => PROMPT10,
4165
+ async *call(input) {
4166
+ const sessionKey = resolveSessionKey();
4167
+ const sessionThoughts = getSessionThoughts(sessionKey);
4168
+ const expectedNext = sessionThoughts.length + 1;
4169
+ const providedThoughtNumber = typeof input.thoughtNumber === "number" ? input.thoughtNumber : expectedNext;
4170
+ if (providedThoughtNumber !== expectedNext) {
4171
+ throw new Error(
4172
+ `Thought number mismatch: expected ${expectedNext}, got ${providedThoughtNumber}`
4173
+ );
4174
+ }
4175
+ const totalThoughts = typeof input.totalThoughts === "number" ? Math.max(input.totalThoughts, expectedNext) : expectedNext;
4176
+ const parentThought = typeof input.parentThought === "number" ? input.parentThought : void 0;
4177
+ if (typeof parentThought === "number") {
4178
+ validateParentThought(parentThought, sessionThoughts);
4179
+ }
4180
+ const revisionNumber = typeof parentThought === "number" ? computeRevisionNumber(parentThought, sessionThoughts) : void 0;
4181
+ const entry = {
4182
+ thought: input.thought,
4183
+ thoughtNumber: providedThoughtNumber,
4184
+ totalThoughts,
4185
+ currentThought: expectedNext,
4186
+ nextThoughtNeeded: input.nextThoughtNeeded ?? false,
4187
+ parentThought,
4188
+ revisionNumber,
4189
+ timestamp: Date.now()
4190
+ };
4191
+ sessionThoughts.push(entry);
4192
+ yield {
4193
+ type: "result",
4194
+ resultForAssistant: `Thought #${entry.currentThought} logged.`,
4195
+ data: {
4196
+ thought: entry.thought,
4197
+ thoughtNumber: entry.thoughtNumber,
4198
+ currentThought: entry.currentThought,
4199
+ totalThoughts: entry.totalThoughts,
4200
+ totalThoughtsInSession: sessionThoughts.length,
4201
+ nextThoughtNeeded: entry.nextThoughtNeeded,
4202
+ parentThought: entry.parentThought,
4203
+ revisionNumber: entry.revisionNumber
4204
+ }
4205
+ };
4206
+ },
4207
+ renderToolUseMessage(input) {
4208
+ return formatThinkToolUseMessage(input);
4209
+ },
4210
+ renderToolUseRejectedMessage() {
4211
+ return /* @__PURE__ */ React9.createElement(MessageResponse, { children: /* @__PURE__ */ React9.createElement(Text9, { color: getTheme().error }, "Thought cancelled") });
4212
+ },
4213
+ renderResultForAssistant: () => "Your thought has been logged."
4214
+ };
4215
+
3882
4216
  // src/tools/index.ts
3883
4217
  var getAllTools = () => [
3884
4218
  TaskTool,
@@ -3901,6 +4235,7 @@ var getAllTools = () => [
3901
4235
  TaskListTool,
3902
4236
  WebFetchTool,
3903
4237
  WebSearchTool,
4238
+ ThinkTool,
3904
4239
  AskUserQuestionTool,
3905
4240
  SlashCommandTool,
3906
4241
  SkillTool,