pybao-cli 1.4.86 → 1.4.87
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.
- package/dist/REPL-6ZKN7FIZ.js +49 -0
- package/dist/{acp-UVP7PN5S.js → acp-EPMYLWYS.js} +30 -30
- package/dist/{agentsValidate-FL54WGFH.js → agentsValidate-BR5ILRIF.js} +7 -7
- package/dist/{ask-PBWLOQ7J.js → ask-WYF2I52E.js} +29 -29
- package/dist/{autoUpdater-O5RPYHU3.js → autoUpdater-YI4LRWHE.js} +3 -3
- package/dist/{chunk-2O3X5IWT.js → chunk-2FRALZLB.js} +1 -1
- package/dist/{chunk-NPA5AQ7K.js → chunk-36EAJNBS.js} +1 -1
- package/dist/{chunk-NZCROE5X.js → chunk-3QBDV77K.js} +1 -1
- package/dist/{chunk-Z3VN6WKQ.js → chunk-4J7OCHGE.js} +4 -4
- package/dist/{chunk-QIA3YTRM.js → chunk-57M7VOVY.js} +3 -3
- package/dist/{chunk-PCMN5JB2.js → chunk-5SAYYPEA.js} +3 -3
- package/dist/{chunk-ZXIIV7IC.js → chunk-6J5LJ5YA.js} +1 -1
- package/dist/{chunk-GSPJ4GS3.js → chunk-6YXOEWR2.js} +3 -3
- package/dist/{chunk-CLFHJB6G.js → chunk-CHZWE2GX.js} +2 -2
- package/dist/{chunk-3JIUIDM2.js → chunk-CRVBBTL7.js} +1 -1
- package/dist/{chunk-T2A6HHRX.js → chunk-F6FUMSOC.js} +2 -2
- package/dist/{chunk-7UFU3WAO.js → chunk-GAJY2O7L.js} +2 -2
- package/dist/{chunk-OOLRCWS2.js → chunk-ICV7AFSR.js} +4 -4
- package/dist/{chunk-PRBRDV6D.js → chunk-IFXTFBIG.js} +1 -1
- package/dist/{chunk-PRBRDV6D.js.map → chunk-IFXTFBIG.js.map} +1 -1
- package/dist/{chunk-N775QA2Y.js → chunk-IT234CFF.js} +1 -1
- package/dist/{chunk-R35KKDQG.js → chunk-M4BJXPOT.js} +2 -2
- package/dist/{chunk-OXIP2DAD.js → chunk-MX4QA7FT.js} +37 -36
- package/dist/{chunk-WZZJVQME.js → chunk-MXQ65O7M.js} +1 -1
- package/dist/{chunk-MDLJYUB5.js → chunk-PJCN2YUU.js} +3 -3
- package/dist/{chunk-VP2IDQGT.js → chunk-QJZPWPWV.js} +3 -3
- package/dist/{chunk-3B4CPOCL.js → chunk-QQFIPQ76.js} +3 -3
- package/dist/{chunk-SU3DRMCQ.js → chunk-RYEKTEXT.js} +1 -1
- package/dist/{chunk-XBM24YJM.js → chunk-S52TK4GY.js} +4 -4
- package/dist/{chunk-VLQEJHWT.js → chunk-SOWMVTRY.js} +3 -3
- package/dist/{chunk-TUQG5JPN.js → chunk-TB3ZV5SP.js} +351 -16
- package/dist/chunk-TB3ZV5SP.js.map +7 -0
- package/dist/{chunk-X472W3BH.js → chunk-VV25PU6H.js} +2 -2
- package/dist/{chunk-INUAHGET.js → chunk-W5T2EMXZ.js} +1 -1
- package/dist/{chunk-TOHWB6HI.js → chunk-WS3ZXWWH.js} +2 -2
- package/dist/{chunk-DFM5XVNM.js → chunk-WZNSDCPB.js} +2 -2
- package/dist/{chunk-LZV5TCLM.js → chunk-Y4LJKT4E.js} +1 -1
- package/dist/{chunk-XYYAVY4Z.js → chunk-YRGTLXHU.js} +4 -4
- package/dist/{cli-5H6SVIF4.js → cli-FCJA5DGG.js} +89 -89
- package/dist/commands-ZABUTTGO.js +53 -0
- package/dist/{config-ZQSF7J7M.js → config-SA7NSVAH.js} +4 -4
- package/dist/{context-Q6WNUXMJ.js → context-JIVLDQUD.js} +6 -6
- package/dist/{conversationTracker-D6IBZAR6.js → conversationTracker-6QM7A4BK.js} +3 -3
- package/dist/{customCommands-IPGNOQKK.js → customCommands-A46XZIEO.js} +4 -4
- package/dist/{env-PR3XNREC.js → env-FSG3VV6X.js} +2 -2
- package/dist/{file-BXLHMQLT.js → file-EYKZT7DW.js} +4 -4
- package/dist/index.js +3 -3
- package/dist/{llm-KXFWT6QU.js → llm-6FRSELJZ.js} +30 -30
- package/dist/{llmLazy-TD36PKN5.js → llmLazy-HA32OY5H.js} +1 -1
- package/dist/{loader-4PMWRUTH.js → loader-3Z77TSAI.js} +4 -4
- package/dist/{lsp-LZ2FQAEJ.js → lsp-MKSIBTE5.js} +6 -6
- package/dist/{lspAnchor-RI6XI7OY.js → lspAnchor-AG42ZLIP.js} +6 -6
- package/dist/{mcp-633QRPZJ.js → mcp-AXJYZHRB.js} +7 -7
- package/dist/{mentionProcessor-SHPTKVDT.js → mentionProcessor-IGNVZ7YV.js} +5 -5
- package/dist/{messages-ILCXJTM3.js → messages-PUXMC35J.js} +1 -1
- package/dist/{model-KSBEHTGQ.js → model-SEPMUK6E.js} +5 -5
- package/dist/{openai-4F2EBT2N.js → openai-I2DMGSQY.js} +5 -5
- package/dist/{outputStyles-SVF7ULKM.js → outputStyles-OUAVKGXS.js} +4 -4
- package/dist/{pluginRuntime-SX6EVXLI.js → pluginRuntime-SHUQLJUJ.js} +6 -6
- package/dist/{pluginValidation-66RSOF62.js → pluginValidation-TX7DJCQ3.js} +6 -6
- package/dist/prompts-EYQN7L33.js +55 -0
- package/dist/{pybAgentSessionLoad-XPP25YQJ.js → pybAgentSessionLoad-KU4QWLFF.js} +4 -4
- package/dist/{pybAgentSessionResume-3NDIDTLX.js → pybAgentSessionResume-ZVMDRGGA.js} +4 -4
- package/dist/{pybAgentStreamJsonSession-CBRW7AGT.js → pybAgentStreamJsonSession-3KIXMIWS.js} +1 -1
- package/dist/{pybHooks-WVV274FH.js → pybHooks-3MLQL77T.js} +4 -4
- package/dist/query-RM2XSCT3.js +57 -0
- package/dist/{registry-PL6BRQ65.js → registry-7YUOFK3K.js} +5 -5
- package/dist/{ripgrep-7XBIKVDR.js → ripgrep-YV5BN7GK.js} +3 -3
- package/dist/{skillMarketplace-IRJ73YDQ.js → skillMarketplace-ONII7HOL.js} +3 -3
- package/dist/{state-GXNXV4HP.js → state-TJOB7BLH.js} +2 -2
- package/dist/{theme-RUAAOZ7A.js → theme-EIFVQAKD.js} +5 -5
- package/dist/{toolPermissionSettings-65AHPGX3.js → toolPermissionSettings-OPZTEYIC.js} +6 -6
- package/dist/tools-2AGCZVZG.js +54 -0
- package/dist/{userInput-FGX36YI6.js → userInput-OA5GHNUF.js} +31 -31
- package/package.json +1 -1
- package/dist/REPL-AYCFBDLU.js +0 -49
- package/dist/chunk-TUQG5JPN.js.map +0 -7
- package/dist/commands-ZAPC4C6T.js +0 -53
- package/dist/prompts-QQD7FUBC.js +0 -55
- package/dist/query-UQFC6UNG.js +0 -57
- package/dist/tools-233ZNHH7.js +0 -54
- /package/dist/{REPL-AYCFBDLU.js.map → REPL-6ZKN7FIZ.js.map} +0 -0
- /package/dist/{acp-UVP7PN5S.js.map → acp-EPMYLWYS.js.map} +0 -0
- /package/dist/{agentsValidate-FL54WGFH.js.map → agentsValidate-BR5ILRIF.js.map} +0 -0
- /package/dist/{ask-PBWLOQ7J.js.map → ask-WYF2I52E.js.map} +0 -0
- /package/dist/{autoUpdater-O5RPYHU3.js.map → autoUpdater-YI4LRWHE.js.map} +0 -0
- /package/dist/{chunk-2O3X5IWT.js.map → chunk-2FRALZLB.js.map} +0 -0
- /package/dist/{chunk-NPA5AQ7K.js.map → chunk-36EAJNBS.js.map} +0 -0
- /package/dist/{chunk-NZCROE5X.js.map → chunk-3QBDV77K.js.map} +0 -0
- /package/dist/{chunk-Z3VN6WKQ.js.map → chunk-4J7OCHGE.js.map} +0 -0
- /package/dist/{chunk-QIA3YTRM.js.map → chunk-57M7VOVY.js.map} +0 -0
- /package/dist/{chunk-PCMN5JB2.js.map → chunk-5SAYYPEA.js.map} +0 -0
- /package/dist/{chunk-ZXIIV7IC.js.map → chunk-6J5LJ5YA.js.map} +0 -0
- /package/dist/{chunk-GSPJ4GS3.js.map → chunk-6YXOEWR2.js.map} +0 -0
- /package/dist/{chunk-CLFHJB6G.js.map → chunk-CHZWE2GX.js.map} +0 -0
- /package/dist/{chunk-3JIUIDM2.js.map → chunk-CRVBBTL7.js.map} +0 -0
- /package/dist/{chunk-T2A6HHRX.js.map → chunk-F6FUMSOC.js.map} +0 -0
- /package/dist/{chunk-7UFU3WAO.js.map → chunk-GAJY2O7L.js.map} +0 -0
- /package/dist/{chunk-OOLRCWS2.js.map → chunk-ICV7AFSR.js.map} +0 -0
- /package/dist/{chunk-N775QA2Y.js.map → chunk-IT234CFF.js.map} +0 -0
- /package/dist/{chunk-R35KKDQG.js.map → chunk-M4BJXPOT.js.map} +0 -0
- /package/dist/{chunk-OXIP2DAD.js.map → chunk-MX4QA7FT.js.map} +0 -0
- /package/dist/{chunk-WZZJVQME.js.map → chunk-MXQ65O7M.js.map} +0 -0
- /package/dist/{chunk-MDLJYUB5.js.map → chunk-PJCN2YUU.js.map} +0 -0
- /package/dist/{chunk-VP2IDQGT.js.map → chunk-QJZPWPWV.js.map} +0 -0
- /package/dist/{chunk-3B4CPOCL.js.map → chunk-QQFIPQ76.js.map} +0 -0
- /package/dist/{chunk-SU3DRMCQ.js.map → chunk-RYEKTEXT.js.map} +0 -0
- /package/dist/{chunk-XBM24YJM.js.map → chunk-S52TK4GY.js.map} +0 -0
- /package/dist/{chunk-VLQEJHWT.js.map → chunk-SOWMVTRY.js.map} +0 -0
- /package/dist/{chunk-X472W3BH.js.map → chunk-VV25PU6H.js.map} +0 -0
- /package/dist/{chunk-INUAHGET.js.map → chunk-W5T2EMXZ.js.map} +0 -0
- /package/dist/{chunk-TOHWB6HI.js.map → chunk-WS3ZXWWH.js.map} +0 -0
- /package/dist/{chunk-DFM5XVNM.js.map → chunk-WZNSDCPB.js.map} +0 -0
- /package/dist/{chunk-LZV5TCLM.js.map → chunk-Y4LJKT4E.js.map} +0 -0
- /package/dist/{chunk-XYYAVY4Z.js.map → chunk-YRGTLXHU.js.map} +0 -0
- /package/dist/{cli-5H6SVIF4.js.map → cli-FCJA5DGG.js.map} +0 -0
- /package/dist/{commands-ZAPC4C6T.js.map → commands-ZABUTTGO.js.map} +0 -0
- /package/dist/{config-ZQSF7J7M.js.map → config-SA7NSVAH.js.map} +0 -0
- /package/dist/{context-Q6WNUXMJ.js.map → context-JIVLDQUD.js.map} +0 -0
- /package/dist/{conversationTracker-D6IBZAR6.js.map → conversationTracker-6QM7A4BK.js.map} +0 -0
- /package/dist/{customCommands-IPGNOQKK.js.map → customCommands-A46XZIEO.js.map} +0 -0
- /package/dist/{env-PR3XNREC.js.map → env-FSG3VV6X.js.map} +0 -0
- /package/dist/{file-BXLHMQLT.js.map → file-EYKZT7DW.js.map} +0 -0
- /package/dist/{llm-KXFWT6QU.js.map → llm-6FRSELJZ.js.map} +0 -0
- /package/dist/{llmLazy-TD36PKN5.js.map → llmLazy-HA32OY5H.js.map} +0 -0
- /package/dist/{loader-4PMWRUTH.js.map → loader-3Z77TSAI.js.map} +0 -0
- /package/dist/{lsp-LZ2FQAEJ.js.map → lsp-MKSIBTE5.js.map} +0 -0
- /package/dist/{lspAnchor-RI6XI7OY.js.map → lspAnchor-AG42ZLIP.js.map} +0 -0
- /package/dist/{mcp-633QRPZJ.js.map → mcp-AXJYZHRB.js.map} +0 -0
- /package/dist/{mentionProcessor-SHPTKVDT.js.map → mentionProcessor-IGNVZ7YV.js.map} +0 -0
- /package/dist/{messages-ILCXJTM3.js.map → messages-PUXMC35J.js.map} +0 -0
- /package/dist/{model-KSBEHTGQ.js.map → model-SEPMUK6E.js.map} +0 -0
- /package/dist/{openai-4F2EBT2N.js.map → openai-I2DMGSQY.js.map} +0 -0
- /package/dist/{outputStyles-SVF7ULKM.js.map → outputStyles-OUAVKGXS.js.map} +0 -0
- /package/dist/{pluginRuntime-SX6EVXLI.js.map → pluginRuntime-SHUQLJUJ.js.map} +0 -0
- /package/dist/{pluginValidation-66RSOF62.js.map → pluginValidation-TX7DJCQ3.js.map} +0 -0
- /package/dist/{prompts-QQD7FUBC.js.map → prompts-EYQN7L33.js.map} +0 -0
- /package/dist/{pybAgentSessionLoad-XPP25YQJ.js.map → pybAgentSessionLoad-KU4QWLFF.js.map} +0 -0
- /package/dist/{pybAgentSessionResume-3NDIDTLX.js.map → pybAgentSessionResume-ZVMDRGGA.js.map} +0 -0
- /package/dist/{pybAgentStreamJsonSession-CBRW7AGT.js.map → pybAgentStreamJsonSession-3KIXMIWS.js.map} +0 -0
- /package/dist/{pybHooks-WVV274FH.js.map → pybHooks-3MLQL77T.js.map} +0 -0
- /package/dist/{query-UQFC6UNG.js.map → query-RM2XSCT3.js.map} +0 -0
- /package/dist/{registry-PL6BRQ65.js.map → registry-7YUOFK3K.js.map} +0 -0
- /package/dist/{ripgrep-7XBIKVDR.js.map → ripgrep-YV5BN7GK.js.map} +0 -0
- /package/dist/{skillMarketplace-IRJ73YDQ.js.map → skillMarketplace-ONII7HOL.js.map} +0 -0
- /package/dist/{state-GXNXV4HP.js.map → state-TJOB7BLH.js.map} +0 -0
- /package/dist/{theme-RUAAOZ7A.js.map → theme-EIFVQAKD.js.map} +0 -0
- /package/dist/{toolPermissionSettings-65AHPGX3.js.map → toolPermissionSettings-OPZTEYIC.js.map} +0 -0
- /package/dist/{tools-233ZNHH7.js.map → tools-2AGCZVZG.js.map} +0 -0
- /package/dist/{userInput-FGX36YI6.js.map → userInput-OA5GHNUF.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-
|
|
37
|
+
} from "./chunk-MX4QA7FT.js";
|
|
38
|
+
import {
|
|
39
|
+
getCurrentSessionId
|
|
40
|
+
} from "./chunk-XKYHFZEC.js";
|
|
37
41
|
import {
|
|
38
42
|
queryLLM
|
|
39
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-ICV7AFSR.js";
|
|
40
44
|
import {
|
|
41
45
|
FallbackToolUseRejectedMessage,
|
|
42
46
|
MCPTool,
|
|
43
47
|
getClients,
|
|
44
48
|
getMCPTools
|
|
45
|
-
} from "./chunk-
|
|
49
|
+
} from "./chunk-S52TK4GY.js";
|
|
46
50
|
import {
|
|
47
51
|
emitReminderEvent
|
|
48
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-VV25PU6H.js";
|
|
49
53
|
import {
|
|
50
54
|
getActiveAgents,
|
|
51
55
|
getAgentByType,
|
|
52
56
|
getAvailableAgentTypes
|
|
53
|
-
} from "./chunk-
|
|
57
|
+
} from "./chunk-GAJY2O7L.js";
|
|
54
58
|
import {
|
|
55
59
|
INTERRUPT_MESSAGE,
|
|
56
60
|
createAssistantMessage,
|
|
57
61
|
createUserMessage,
|
|
58
62
|
getLastAssistantMessageId
|
|
59
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-Y4LJKT4E.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-
|
|
70
|
+
} from "./chunk-WS3ZXWWH.js";
|
|
67
71
|
import {
|
|
68
72
|
LspFacade,
|
|
69
73
|
formatDiagnosticsPretty
|
|
70
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-YRGTLXHU.js";
|
|
71
75
|
import {
|
|
72
76
|
getModelManager
|
|
73
|
-
} from "./chunk-
|
|
77
|
+
} from "./chunk-6YXOEWR2.js";
|
|
74
78
|
import {
|
|
75
79
|
getContext
|
|
76
|
-
} from "./chunk-
|
|
80
|
+
} from "./chunk-4J7OCHGE.js";
|
|
77
81
|
import {
|
|
78
82
|
filesToTree,
|
|
79
83
|
ripGrepWithStatus
|
|
80
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-2FRALZLB.js";
|
|
81
85
|
import {
|
|
82
86
|
getTheme
|
|
83
|
-
} from "./chunk-
|
|
87
|
+
} from "./chunk-CRVBBTL7.js";
|
|
84
88
|
import {
|
|
85
89
|
debug
|
|
86
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-IT234CFF.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-
|
|
101
|
+
} from "./chunk-3QBDV77K.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-
|
|
780
|
+
const { getSessionRoot: getSessionRoot2 } = await import("./state-TJOB7BLH.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-
|
|
1153
|
+
const { LspFacade: LspFacade2 } = await import("./lsp-MKSIBTE5.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,
|